にへるつおるぐ | src | ブログ | コンタクト | 統計 |

ソースコード・スクリプト・パッチ置き場

アイテム一覧(新着順)

< || 1 | 2 || Next>>

2010-11-22 15:15:48 JST-9 | akebia | General | コメント(0) | 履歴

NP_AutoTwitter.php.patch

--- NP_AutoTwitter.php	2011-01-29 08:27:02.000000000 +0900
+++ NP_AutoTwitter.php	2013-08-18 21:54:14.000000000 +0900
@@ -17,20 +17,20 @@
 	// author of plugin
 	function getAuthor(){
 		global $TWITTER;
-		return $TWITTER['AUTHOR'];
+		return $TWITTER['AUTHOR'].' + akebia';
 	}
 
 	// an URL to the plugin website
 	// can also be of the form mailto:foo@bar.com
 	function getURL(){
 		global $TWITTER;
-		return $TWITTER['URL'];
+		return 'http://nyan.co.uk/akebia/item/695'; //$TWITTER['URL'];
 	}
 
 	// version of the plugin
 	function getVersion(){
 		global $TWITTER;
-		return $TWITTER['VERSION'];
+		return $TWITTER['VERSION'].'-4';
 	}
 
 	// a description to be shown on the installed plugins listing
@@ -38,7 +38,7 @@
 		return 'Allows blog posts to be automatically announced via Twitter.';
 	}
 
-	function getEventList() { return array('PostAddItem','PreUpdateItem','PostUpdateItem','PostAddComment','QuickMenu'); }
+	function getEventList() { return array('PostAddItem','PreUpdateItem','PostUpdateItem','PostAddComment','QuickMenu','EditItemFormExtras'); }
 	
 	function init() {
  		if (($this->getOption(UpdatePlugin)=="yes") || ($this->getOption(UpdatePlugin)=="")) {
@@ -50,7 +50,7 @@
 	function event_PostAddComment(&$data) {
 		global $manager,$blog;
 		if($data['comment']['memberid'] > 0){
-			if($this->getMemberOption($data['comment']['memberid'],'twitterComments')){
+			if($this->getMemberOption($data['comment']['memberid'],'twitterComments') === 'yes'){
 				// The following line is causing failure, as blogid is not present in the array.
 				if($data['comment']['blogid']){
 					$blogid=$data['comment']['blogid'];
@@ -70,8 +70,9 @@
 					$b =& $manager->getBlog($CONF['DefaultBlog']);
 				}
 				$BlogURL = $b->getURL();
-				$URLComponents=explode('?',createItemLink($data['comment']['itemid']));
-				$LinkURL=$BlogURL.'?'.$URLComponents[1].'#c';
+//				$URLComponents=explode('?',createItemLink($data['comment']['itemid']));
+//				$LinkURL=$BlogURL.'?'.$URLComponents[1].'#c';
+				$LinkURL=$this->shortenURL($this->itemURL($BlogURL, $data['comment']['itemid']).'#c'.$data['commentid'], $data['comment']['memberid']);
 				
 				$query =  'SELECT i.idraft as draft, i.inumber as itemid, i.iclosed as closed, '
 				       . ' i.ititle as title, i.ibody as body, m.mname as author, '
@@ -100,7 +101,7 @@
 				
 		$items = sql_query($query);
 		$item = mysql_fetch_object($items);
-		if($this->getBlogOption($item->blogid,'twitterNewItems')){
+		if($this->getBlogOption($item->blogid,'twitterNewItems') === 'yes'){
 			if($item->draft==0){
 				$this->sendItemTweet($item);
 			}
@@ -121,14 +122,15 @@
 		$query =  'SELECT i.idraft as draft, i.inumber as itemid,'
 		       . ' i.ititle as title,'
 		       . ' i.iauthor as authorid,'
-		       . ' i.iblog as blogid '
-		       . ' FROM '.sql_table('item').' as i'
-		       . ' WHERE i.inumber=' . $data['itemid'];
+		       . ' c.cblog as blogid '
+		       . ' FROM '.sql_table('item').' as i,'.sql_table('category').' as c'
+		       . ' WHERE i.icat=c.catid && i.inumber=' . $data['itemid'];
 
 		$items = sql_query($query);
 		$item = mysql_fetch_object($items);
-		if($this->getBlogOption($item->blogid,'twitterNewItems')){
-			if(($this->itemIsDraft==1)&&($item->draft==0)){
+		if($this->getBlogOption($item->blogid,'twitterNewItems') === 'yes'){
+			if((($this->itemIsDraft==1)||requestvar('plug_autotwitter_tweet'))&&
+				($item->draft==0)){
 				$this->sendItemTweet($item);
 			}
 		}
@@ -158,6 +160,14 @@
 			$this->createMemberOption('twitterComments','Tweet Comments','yesno');
 		if (count($this->getAllMemberOptions('twitterCommentsTempl'))==0)
 			$this->createMemberOption('twitterCommentsTempl','Tweet Template','text','Commented on %##BLOGNAME##% - %##URL##%');
+		if (count($this->getAllMemberOptions('twitterBitly'))==0)
+			$this->createMemberOption('twitterBitly','Shorten URL with bit.ly','yesno');
+		if (count($this->getAllMemberOptions('twitterBitlyDomain'))==0)
+			$this->createMemberOption('twitterBitlyDomain','bit.ly Domain','text','bit.ly');
+		if (count($this->getAllMemberOptions('twitterBitlyUsername'))==0)
+			$this->createMemberOption('twitterBitlyUsername','bit.ly Username','text','');
+		if (count($this->getAllMemberOptions('twitterBitlyAPIKey'))==0)
+			$this->createMemberOption('twitterBitlyAPIKey','bit.ly API Key','text','');
 		if (count($this->getAllBlogOptions('twitterNewItems'))==0)
 			$this->createBlogOption('twitterNewItems','Tweet New Posts','yesno');
 		if (count($this->getAllBlogOptions('twitterNewItemsTempl'))==0)
@@ -251,18 +261,57 @@
 	 * @return unknown_type
 	 */
 	function sendItemTweet(&$item){
-		global $manager,$blog;
+		global $manager,$blog,$CONF;
 		// Post tweet for item, but only if the user has a username and password specified.
 		$access_token = TwitterDriver::getAccessTokenForUser($item->authorid);
 		if(TwitterDriver::isValidAccessToken($access_token)){
 			$b =& $manager->getBlog($item->blogid);
 			$BlogURL = $b->getURL();
-			$URLComponents=explode('?',createItemLink($item->itemid));
-			$LinkURL=$BlogURL.'?'.$URLComponents[1];
-			$twitterNewItemsTempl=$this->getBlogOption($item->authorid,'twitterNewItemsTempl');
+//			$URLComponents=explode('?',createItemLink($item->itemid));
+//			$LinkURL=$BlogURL.'?'.$URLComponents[1];
+			$LinkURL=$this->shortenURL($this->itemURL($BlogURL, $item->itemid), $item->authorid);
+			$twitterNewItemsTempl=$this->getBlogOption($item->blogid,'twitterNewItemsTempl');
 			$tweet=$this->getReplacedText($twitterNewItemsTempl,$LinkURL,$item->title,$b->getName());
 			TwitterDriver::sendRawTweet($tweet,$access_token);
 		}
 	}
+	
+	function itemURL($blogurl, $itemid){
+		global $CONF;
+		if ($CONF['URLMode'] == 'pathinfo') {
+			$LinkURL = $blogurl . $CONF['ItemKey'] . '/' . $itemid;
+		} else {
+			$LinkURL = $blogurl . '?itemid=' . $itemid;
+		}
+		return $LinkURL;
+	}
+	
+	function shortenURL($url, $authorid){
+		if($this->getMemberOption($authorid,'twitterBitly') === 'yes'){
+			$ch = curl_init();
+			$w = array(
+				CURLOPT_URL =>
+					'http://api.'.$this->getMemberOption($authorid,'twitterBitlyDomain').
+					'/v3/shorten?login='.$this->getMemberOption($authorid,'twitterBitlyUsername').
+					'&apiKey='.$this->getMemberOption($authorid,'twitterBitlyAPIKey').
+					'&format=txt&longUrl='.$url,
+				CURLOPT_RETURNTRANSFER => 1
+			);
+			curl_setopt_array($ch, $w);
+			$w = curl_exec($ch);
+			curl_close($ch);
+			if (substr($w, 0, 7) === 'http://') return $w;
+		}
+		return $url;
+	}
+	
+	function event_EditItemFormExtras(&$data) {
+		if($data['variables']['draft']) return;
+		global $TWITTER;
+		echo '<h3>',$TWITTER['TITLE'],'</h3>',
+		'<p><label>',
+		'<input name="plug_autotwitter_tweet" type="checkbox">Tweet',
+		'</label></p>';
+	}
 }
 ?>
\ ファイル末尾に改行がありません

2009-04-02 15:10:19 JST-9 | akebia | General | コメント(0) | 履歴

NP_RevisionFixDB.php
<?php
class NP_RevisionFixDB extends NucleusPlugin{
  function getName()       {return 'Revision Fix DB';}
  function getAuthor()     {return 'akebia';}
  function getURL()        {return 'http://nyan.co.uk/akebia/item/404';}
  function getVersion()    {return '1.1';}
  function getDescription(){return '初版の履歴データに対し、修正処理(アンクォート)を行います。';}
  function supportsFeature($f)
    {switch($f){case 'SqlTablePrefix': return 1; default: return 0;}}
  function getEventList()  {return array ('PostPluginOptionsUpdate');}
  function install(){
    $this->createOption('A','オプションの保存時に履歴データの修正処理を行いますか?(下の「メッセージ」のテキストエリア内の説明を読んでから決めて下さい。)','yesno','no');
    $this->createOption('B','メッセージ','textarea','履歴データの修正処理は、よく分からない場合には、絶対に行わないこと。やり方を誤ると履歴データが壊れることがあります。このプラグイン自身には、この処理を行うべきか否かを自動的に判断する能力はありません。');
  }
  function event_PostPluginOptionsUpdate($data){
    if($this->getOption('A') != 'yes') return;
    $r = mysql_query(
      'SELECT inumber, ititle, ibody, imore, rrevbase, rrevsub FROM ' .
        sql_table('plugin_revision') .
      " WHERE rcomment REGEXP '^Initial revision( |$)'"
    );
    while($row = mysql_fetch_array($r)){mysql_query(
      'UPDATE ' . sql_table('plugin_revision') .
      ' SET ititle="' . addslashes(stripslashes($row['ititle'])) .
         '",ibody="' . addslashes(stripslashes($row['ibody'])) .
         '",imore="' . addslashes(stripslashes($row['imore'])) . '"' .
      ' WHERE inumber=' . $row['inumber'] .
      ' AND rrevbase=' . $row['rrevbase'] .
      ' AND rrevsub=' . $row['rrevsub']
    );}
    $this->setOption('A', 'no');
    $this->setOption('B', '履歴データの修正処理は完了しました。この処理を繰り返し行うと履歴データが壊れることがあります。このまま「プラグイン管理」に戻り、このプラグインを削除して下さい。');
  }
}
?>

2009-04-02 15:03:14 JST-9 | akebia | General | コメント(0) | 履歴

ご注意

このパッチは、何も考えずに適用すると厄介な事になることがあるので、関連記事をよく読んで納得できてから適用して下さい。

NP_Revision.php.patch

*** NP_Revision.php	2005-05-12 14:15:56.000000000 +0900
--- NP_Revision.php	2010-03-06 19:38:00.000000000 +0900
***************
*** 34,42 ****
  		var $revertinprogress;
  
  		function getName()   	  { 		return 'Revision';   }
! 		function getAuthor() 	  { 		return 'rakaz'; }
! 		function getURL()    	  { 		return 'http://www.rakaz.nl/'; }
! 		function getVersion()	  { 		return '0.7'; }
  		function getDescription() { 		return 'Store and access old revisions of stories.'; }
  	
  		function getTableList()   { 		return array(sql_table("plugin_revision")); }
--- 34,42 ----
  		var $revertinprogress;
  
  		function getName()   	  { 		return 'Revision';   }
! 		function getAuthor() 	  { 		return 'rakaz + akebia'; }
! 		function getURL()    	  { 		return 'http://nyan.co.uk/akebia/item/404'; }
! 		function getVersion()	  { 		return '0.7-4'; }
  		function getDescription() { 		return 'Store and access old revisions of stories.'; }
  	
  		function getTableList()   { 		return array(sql_table("plugin_revision")); }
***************
*** 266,272 ****
  			$rev = requestVar('rev');
  			
  			if ($CONF['URLMode'] == 'pathinfo') {
! 				if (preg_match('/revision\/([0-9]+\.[0-9]+)/', serverVar('PATH_INFO'), $matches)) {
  					$rev = $matches[1];
  				}
  			}
--- 266,274 ----
  			$rev = requestVar('rev');
  			
  			if ($CONF['URLMode'] == 'pathinfo') {
! //				if (preg_match('/revision\/([0-9]+\.[0-9]+)/', serverVar('PATH_INFO'), $matches)) {
! 				global $virtualpath;
! 				if (preg_match('/revision\/([0-9]+\.[0-9]+)/', $virtualpath, $matches)) {
  					$rev = $matches[1];
  				}
  			}
***************
*** 338,344 ****
  		}
  
  		function event_PreAddItem(&$data) {
! 			$this->tmp = $data;
  		}
  		
  		function event_PostAddItem(&$data) {
--- 340,347 ----
  		}
  
  		function event_PreAddItem(&$data) {
! 			//$this->tmp = $data;
! 			foreach ($data as $k => $v){$this->tmp[$k] = $v;}
  		}
  		
  		function event_PostAddItem(&$data) {
***************
*** 484,492 ****
  			echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
  			echo "<html><head><title>Revision overview for item ".$itemid."</title>";
  			echo "<link rel='stylesheet' type='text/css' href='".$CONF['AdminURL']."styles/bookmarklet.css' /><style type='text/css'>\n";
! 			echo "th { text-align: left; }\n .diff-blockheader { background: #EEE; font-weight: bold; width: 50%;}\n";
! 			echo ".diff-context { background: #EEE; }\n.diff-deletedline { background: #F99; }\n.diff-deletedline .diffchange { background: #933; color: #FFF; }\n";
! 			echo ".diff-addedline { background: #9F9; }\n.diff-addedline .diffchange { background: #393; color: #FFF; }\n</style></head><body>";
  			echo "<h1>Revision overview for item ".$itemid."</h1>";
  
  			// Get every revision for this item...
--- 487,495 ----
  			echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
  			echo "<html><head><title>Revision overview for item ".$itemid."</title>";
  			echo "<link rel='stylesheet' type='text/css' href='".$CONF['AdminURL']."styles/bookmarklet.css' /><style type='text/css'>\n";
! 			echo "th { text-align: left; }\n .diff-blockheader { background: #EEE; font-weight: bold; width: 50%; }\n";
! 			echo ".diff-context { background: #EEE; white-space: normal; }\n.diff-deletedline { background: #F99; white-space: normal; }\n.diff-deletedline .diffchange { background: #933; color: #FFF; }\n";
! 			echo ".diff-addedline { background: #9F9; white-space: normal; }\n.diff-addedline .diffchange { background: #393; color: #FFF; }\n</style></head><body>";
  			echo "<h1>Revision overview for item ".$itemid."</h1>";
  
  			// Get every revision for this item...
***************
*** 591,597 ****
  					}
  				
  					echo '<h3>Diff between revision '.$oldbase.'.'.$oldsub.' and '.$newbase.'.'.$newsub.':</h3>';
! 					echo '<table>';
  					
  					if ($olddata['ititle'] != $newdata['ititle']) {
  						echo '<th colspan="4">Title</td>';
--- 594,600 ----
  					}
  				
  					echo '<h3>Diff between revision '.$oldbase.'.'.$oldsub.' and '.$newbase.'.'.$newsub.':</h3>';
! 					echo '<table style="table-layout: auto;">';
  					
  					if ($olddata['ititle'] != $newdata['ititle']) {
  						echo '<th colspan="4">Title</td>';
***************
*** 909,912 ****
  		}		
  	}
  
! ?>
\ ファイル末尾に改行がありません
--- 912,915 ----
  		}		
  	}
  
! ?>

2009-03-23 17:02:27 JST-9 | akebia | General | コメント(0) | 履歴

NP_PluginList.php.patch
*** NP_PluginList.php	2009-03-23 16:43:38.000000000 +0900
--- NP_PluginList.php	2004-02-16 18:58:04.000000000 +0900
***************
*** 15,33 ****
  
  	// author of plugin
  	function getAuthor()  {
! 		return 'mas + akebia';
  	}
  
  	// an URL to the plugin website
  	// can also be of the form mailto:foo@bar.com
  	function getURL()
  	{
! 		return 'http://nyan.co.uk/akebia/item/382';
  	}
  
  	// version of the plugin
  	function getVersion() {
! 		return '1.1-1';
  	}
  
  	// a description to be shown on the installed plugins listing
--- 15,33 ----
  
  	// author of plugin
  	function getAuthor()  {
! 		return 'mas';
  	}
  
  	// an URL to the plugin website
  	// can also be of the form mailto:foo@bar.com
  	function getURL()
  	{
! 		return 'http://neconnect.net/';
  	}
  
  	// version of the plugin
  	function getVersion() {
! 		return '1.1';
  	}
  
  	// a description to be shown on the installed plugins listing
***************
*** 106,114 ****
  			
  			if($this->getOption(linkURL) == 'yes')
  				// Link style
! 				$val = '<a href="'.$url[$key].'" title="author: '.
! 					htmlspecialchars($author[$key]).'">'.
! 					htmlspecialchars($val).'</a>';
  			
  			echo $this->getOption(s_items) . $val .$ver. $this->getOption(e_items)."\n";
  		}
--- 106,112 ----
  			
  			if($this->getOption(linkURL) == 'yes')
  				// Link style
! 				$val = '<a href="'.$url[$key].'" title="author: '.$author[$key].'">'. $val .'</a>';
  			
  			echo $this->getOption(s_items) . $val .$ver. $this->getOption(e_items)."\n";
  		}
***************
*** 117,120 ****
  	}
  
  }
! ?>
--- 115,118 ----
  	}
  
  }
! ?>
\ ファイル末尾に改行がありません

2009-03-17 15:19:52 JST-9 | akebia | General | コメント(0) | 履歴

NP_Popularity.php
<?php
class NP_Popularity extends NucleusPlugin{
  function getName()   {return 'Popularity';}
  function getAuthor() {return 'akebia'; }
  function getURL()    {return 'http://nyan.co.uk/akebia/item/372';}
  function getVersion(){return '1.4';}
  function getDescription()
    {return "<%Popularity(order,num,catid,blogid)%>"; }
  function supportsFeature($f){switch($f){
    case 'SqlTablePrefix': case 'SqlApi': return 1; default: return 0;}}
  function getMinNucleusVersion(){return '350';}
  function getTableList(){return sql_table('plugin_popularity');}
  function getEventList ()
    {return array ('PostPluginOptionsUpdate', 'PreDeleteItem',
      'PreDeleteBlog', 'PreUpdateItem');}
  function install(){
    sql_query('CREATE TABLE IF NOT EXISTS '.sql_table('plugin_popularity').'('.
      'id INT KEY,'.
      'views INT NOT NULL,'.
      'ip VARCHAR(255) NOT NULL,'.
      'ctime BIGINT UNSIGNED NOT NULL,'.
      'score INT NOT NULL,'.
      'INDEX(views),'.
      'INDEX(score)'.
    ')');
    $this->createOption('IgnoreRepeat','同じIPからの反復を無視しますか?','yesno','yes');
    $this->createOption('Cleanup','アンインストール時、データベースをクリアしますか?','yesno','no');
    $this->createOption('SA','スコア計算時、アイテムの表示回数に乗ずる数(秒)','text','864000');
    $this->createOption('SD','スコア計算に必要な最低期間(秒)','text','1200');
    $this->createOption('SB','ハイスコア順のリストに出力するアイテムの最低表示回数','text','4');
    $this->createOption('SC','ロースコア順のリストに出力するアイテムの最低表示回数','text','1');
    $this->createOption('exclusion','除外するIP(複数の場合、","で区切る)','text','');
  }
  function event_PostPluginOptionsUpdate($data){
    if(!($this->getOption('SD') > 0)){$this->setOption('SD', 1);}
  }
  function unInstall(){
    if($this->getOption('Cleanup') == 'yes')
      sql_query('DROP TABLE '.sql_table('plugin_popularity'));
  }
  function doTemplateVar(&$item, $order, $num = '', $cat = '', $blog = ''){
    $itemid = $item->itemid;
    switch ($order){
      case 'score': echo quickQuery('SELECT score as result FROM '.
        sql_table('plugin_popularity').' WHERE id='.$itemid); return;
      case 'views': echo quickQuery('SELECT views as result FROM '.
        sql_table('plugin_popularity').' WHERE id='.$itemid); return;
      case 'lisc': $this->li('score', $num, $cat, $blog); return;
      case 'livi': $this->li('views', $num, $cat, $blog); return;
    }
    $remote_ip = ServerVar('REMOTE_ADDR'); $time = time();
    $exclusion_ip = split(",", $this->getOption('exclusion'));
    foreach($exclusion_ip as $value)
      {if(ltrim(rtrim($value)) == $remote_ip) return;}
    $query = "SELECT views,ip,ctime FROM ".sql_table('plugin_popularity').
      " WHERE id=".$itemid;
    $res = sql_query($query); $row = sql_fetch_object($res);
    if(sql_num_rows($res) == 0){
      $query = "INSERT INTO ".sql_table('plugin_popularity') . 
        " VALUES ('$itemid','1','$remote_ip','$time','0')";
    }else{
      if($this->getOption('IgnoreRepeat') == 'yes')
        if($remote_ip == $row->ip) return;
      $time -= $row->ctime;
      if($time >= $this->getOption('SD')){
        $views = $row->views;
        $score = intval($views * $this->getOption('SA') / $time);
        $views++;
      }else{
        $score = -1;
        $views = $row->views + 1;
      }
      $query = "UPDATE ".sql_table('plugin_popularity') .
        " SET ip='$remote_ip',views='$views',score='$score' WHERE id=$itemid";
    }
      sql_query($query);
  }
  function doSkinVar($skinType, $order, $num = '', $cat = '', $blog = ''){
    switch ($order){
      case 'lisc': $this->li('score', $num, $cat, $blog); return;
      case 'livi': $this->li('views', $num, $cat, $blog); return;
    }
  }
  function li($order, $num, $cat = '', $blog = ''){
    $num = intval($num);
    $blog = $blog == '' ? $GLOBALS['blogid'] : intval($blog);
    $cat = $cat == '' ? $GLOBALS['catid'] : intval($cat);
    $blog = $blog ? " AND i.iblog = $blog" : '';
    $cat = $cat ? " AND i.icat = $cat" : '';
    if($order == 'score'){
      $minv = $num >= 0 ? $this->getOption('SB') : $this->getOption('SC');
      $minv = " AND v.views >= $minv AND v.score >= 0";
    }else{
      $minv = '';
    }
    if($num >= 0){$od = 'DESC';}else{$od = 'ASC'; $num = -$num;}
    $q = "SELECT i.inumber id,v.views views,v.score score,i.ititle title".
      " FROM ".sql_table('plugin_popularity')." v, ".sql_table('item')." i".
      " WHERE v.id = i.inumber AND i.idraft = 0".$cat.$blog.$minv.
      " ORDER BY $order $od ".
      " LIMIT 0, ".$num;
    $res = sql_query($q);
    if($GLOBALS['catid']){$ext['catid'] = $GLOBALS['catid'];}
    echo "<ol>";
    while($row = sql_fetch_array($res)){
      echo '<li><a href="'.createItemLink($row['id'], $ext).'">'.($row['title']).
        '<small>('.$row['score'].'/'.$row['views'].')</small></a></li>';
    }
    echo "</ol>";
  }
  function event_PreDeleteItem(&$data) {
    sql_query(
      'DELETE FROM '.sql_table('plugin_popularity').
      ' WHERE id = '.$data['itemid']
    );
  }
  function event_PreUpdateItem(&$data) {
    $q = 'SELECT i.idraft result FROM '.sql_table('item').' i'.
      ' WHERE i.inumber='.$data['itemid'];
    if(quickQuery($q)) $this->event_PreDeleteItem($data);
  }
  function event_PreDeleteBlog(&$data) {
    sql_query(
      'DELETE v FROM '.
        sql_table('plugin_popularity').' v, '.sql_table('item').' i'.
      ' WHERE v.id = i.inumber AND i.iblog = '.$data['blogid']
    );
  }
}
?>

2009-03-17 14:49:59 JST-9 | akebia | General | コメント(0) | 履歴

NP_Markdown.php.patch
*** NP_Markdown.php	2005-09-09 08:01:48.000000000 +0900
--- NP_Markdown.php	2009-03-12 15:44:23.000000000 +0900
***************
*** 32,42 ****
   
  	function getName() { return 'Markdown'; }
  
! 	function getAuthor()  { return 'Roberto "rbnet" Bolli'; }
  
! 	function getURL()  { return 'http://www.rbnet.it.com/'; }
  
! 	function getVersion() { return '0.5'; }
  
  	function getDescription() {
        return _MARKDOWN_DESCRIPTION;
--- 32,42 ----
   
  	function getName() { return 'Markdown'; }
  
! 	function getAuthor()  { return 'Roberto "rbnet" Bolli + akebia'; }
  
! 	function getURL()  { return 'http://nyan.co.uk/akebia/item/359'; }
  
! 	function getVersion() { return '0.5-1'; }
  
  	function getDescription() {
        return _MARKDOWN_DESCRIPTION;
***************
*** 130,146 ****
  		//else
  		$CONF['MarkdownSyntax'] = 1;
  		
! 		include_once( $this->getDirectory().'markdown.php' );
  		@include_once( $this->getDirectory().'smartypants.php' ); //warning silenzioso
  		
  		if ( function_exists('SmartyPants') ) {
! 			$data['item']->body = SmartyPants(Markdown($data['item']->body));
  			if ( trim($data['item']->more) )
! 				$data['item']->more = SmartyPants(Markdown($data['item']->more));
  		} else {
! 			$data['item']->body = Markdown($data['item']->body);
  			if ( trim($data['item']->more) )
! 				$data['item']->more = Markdown($data['item']->more);
  		}
  		return;
  	}
--- 130,146 ----
  		//else
  		$CONF['MarkdownSyntax'] = 1;
  		
! 		include_once( $this->getDirectory().'MarkdownEx2.php' );
  		@include_once( $this->getDirectory().'smartypants.php' ); //warning silenzioso
  		
  		if ( function_exists('SmartyPants') ) {
! 			$data['item']->body = SmartyPants(MarkdownEx2($data['item']->body));
  			if ( trim($data['item']->more) )
! 				$data['item']->more = SmartyPants(MarkdownEx2($data['item']->more));
  		} else {
! 			$data['item']->body = MarkdownEx2($data['item']->body);
  			if ( trim($data['item']->more) )
! 				$data['item']->more = MarkdownEx2($data['item']->more);
  		}
  		return;
  	}
***************
*** 188,191 ****
  	}
  
  }
! ?>
\ ファイル末尾に改行がありません
--- 188,191 ----
  	}
  
  }
! ?>

2009-03-17 14:47:35 JST-9 | akebia | General | コメント(0) | 履歴

MarkdownEx2.php
<?php
require 'markdown.php';

class MarkdownEx2_Parser extends MarkdownExtra_Parser {
	function detab($text) {
		return $text;
	}
}

function MarkdownEx2($text) {
#
# Initialize the parser and return the result of its transform method.
#

	# Setup static parser variable.
	static $parser;
	if (!isset($parser)) {
		$parser_class = 'MarkdownEx2_Parser';
		$parser = new $parser_class;
	}

	# Transform text using parser.
	return $parser->transform($text);
}
?>

2009-03-17 14:40:35 JST-9 | akebia | General | コメント(0) | 履歴

geshi.php.patch
*** geshi.php	2012-08-19 16:25:52.000000000 +0900
--- geshi.php	2013-08-14 21:21:21.499601298 +0900
***************
*** 41,47 ****
  //
  
  /** The version of this GeSHi file */
! define('GESHI_VERSION', '1.0.8.11');
  
  // Define the root directory for the GeSHi code tree
  if (!defined('GESHI_ROOT')) {
--- 41,47 ----
  //
  
  /** The version of this GeSHi file */
! define('GESHI_VERSION', '1.0.8.11-3');
  
  // Define the root directory for the GeSHi code tree
  if (!defined('GESHI_ROOT')) {
***************
*** 4025,4033 ****
              for ($i = 0; $i < $n; ++$i) {
                  // Make lines have at least one space in them if they're empty
                  // BenBE: Checking emptiness using trim instead of relying on blanks
!                 if ('' == trim($code[$i])) {
!                     $code[$i] = '&nbsp;';
!                 }
                  // fancy lines
                  if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
                      $i % $this->line_nth_row == ($this->line_nth_row - 1)) {
--- 4025,4033 ----
              for ($i = 0; $i < $n; ++$i) {
                  // Make lines have at least one space in them if they're empty
                  // BenBE: Checking emptiness using trim instead of relying on blanks
!                 //if ('' == trim($code[$i])) {
!                 //    $code[$i] = '&nbsp;';
!                 //}
                  // fancy lines
                  if ($this->line_numbers == GESHI_FANCY_LINE_NUMBERS &&
                      $i % $this->line_nth_row == ($this->line_nth_row - 1)) {

2009-03-17 14:34:17 JST-9 | akebia | General | コメント(0) | 履歴

NP_GeSHi2.php.patch
*** NP_GeSHi2.php	2007-11-10 14:25:48.000000000 +0900
--- NP_GeSHi2.php	2009-03-12 19:44:05.000000000 +0900
***************
*** 33,41 ****
  class NP_GeSHi2 extends NucleusPlugin {
  
  	function getName() { return 'NP_GeSHi2'; }
! 	function getAuthor()  { return 'Kai Greve'; }
! 	function getURL()  { return 'http://kgblog.de/'; }
! 	function getVersion() { return '0.1'; }
  	function getDescription() {
  		return 'Integrates GeSHi - the Generic Syntax Highlighter - into Nucleus CMS. GeSHi can highlight code from several programming languages.';
  	}
--- 33,41 ----
  class NP_GeSHi2 extends NucleusPlugin {
  
  	function getName() { return 'NP_GeSHi2'; }
! 	function getAuthor()  { return 'Kai Greve + akebia'; }
! 	function getURL()  { return 'http://nyan.co.uk/akebia/item/356'; }
! 	function getVersion() { return '0.1-2'; }
  	function getDescription() {
  		return 'Integrates GeSHi - the Generic Syntax Highlighter - into Nucleus CMS. GeSHi can highlight code from several programming languages.';
  	}
***************
*** 66,80 ****
  
  		// highlight the code with GeSHi		
  		$geshi =& new GeSHi($output, $code[2]);
! 		
! 		$geshi->set_header_type(GESHI_HEADER_NONE);
! 		$output=$geshi->parse_code();
!   
  		if (stristr ($code[1], 'pre')) {
  			$my_header=$this->getOption('pre_header');
  			$my_footer=$this->getOption('pre_footer');
  		}
  		else {
  			$my_header=$this->getOption('code_header');
  			$my_footer=$this->getOption('code_footer');
  		}
--- 66,80 ----
  
  		// highlight the code with GeSHi		
  		$geshi =& new GeSHi($output, $code[2]);
! 
  		if (stristr ($code[1], 'pre')) {
+ 			$output=$geshi->parse_code();
  			$my_header=$this->getOption('pre_header');
  			$my_footer=$this->getOption('pre_footer');
  		}
  		else {
+ 			$geshi->set_header_type(GESHI_HEADER_NONE);
+ 			$output=$geshi->parse_code();
  			$my_header=$this->getOption('code_header');
  			$my_footer=$this->getOption('code_footer');
  		}
< || 1 | 2 || Next>>


http://2hz.org/src/