plugins:np_or_np_and:np_and_code

NP_and.phpのソースコード

<?php 
class NP_and extends NucleusPlugin { 
	function getName() { return 'NP_and'; }
	function getMinNucleusVersion() { return 330; }
	function getAuthor()  { return 'Katsumi'; }
	function getVersion() { return '0.1.1'; }
	function getURL() {return 'http://japan.nucleuscms.org/wiki/plugins:np_or_np_and';}
	function getDescription() { return $this->getName().' plugin'; } 
	function supportsFeature($what) { return ($what=='SqlTablePrefix')?1:0; }
	var $actions;
	function doIf($p1='',$p2=''){
		if (strlen($p2=($p2)?$p2:'[|]')!=3) return $this->error($p2);
		$begin=preg_quote(substr($p2,0,1),'/');
		$delim=substr($p2,1,1);
		$end  =preg_quote(substr($p2,2,1),'/');
		if (!isset($this->actions)) $this->actions=new ACTIONS('index');
		if (!@preg_match_all('/'.$begin.'([^'.$end.']+)'.$end.'/',$p1,$matches,PREG_SET_ORDER)) return $this->error($p1);
		foreach($matches as $value){
			$args=explode($delim,$value[1]);
			foreach($args as $k=>$v) $args[$k]=rawurldecode($v);
			if (!call_user_func_array(array($this->actions,'checkCondition'),$args)) return false;
		}
		return true;
	}
	function error($msg){
		echo '<!-- --><b>'.$this->getName.': sytax error near "'.htmlspecialchars($msg).'"</b>';
		//return false;
		exit;
	}
}
?>
 
plugins/np_or_np_and/np_and_code.txt · 最終更新: 2011/03/23 21:28 (外部編集)