0byt3m1n1
Path:
/
home1
/
aserty
/
public_html
/
cpmage
/
libs
/
Savant3
/
[
Home
]
File: Savant3.php
<?php include_once dirname( __FILE__).'/Savant3/Filter.php'; include_once dirname( __FILE__).'/Savant3/Plugin.php'; class l4 { protected $l71=array('template_path' => array(),'resource_path' => array(),'error_text' => "\n\nt\145\155plate er\162\157\162, exami\156\145\040fetch(\051\040\162esult\n\n",'exceptions' => FALSE,'autoload' => FALSE,'compiler' => NULL,'filters' => array(),'plugins' => array(),'template' => NULL,'plugin_conf' => array(),'extract' => FALSE,'fetch' => NULL,'escape' => array('htmlspecialchars'),); public function __construct($O71=NULL) { settype($O71,'array'); if ( isset ($O71['template_path'])) { $this->l72('template',$O71['template_path']); } else { $this->l72('template',NULL); } if ( isset ($O71['resource_path'])) { $this->l72('resource',$O71['resource_path']); } else { $this->l72('resource',NULL); } if ( isset ($O71['error_text'])) { $this->O72($O71['error_text']); } if ( isset ($O71['autoload'])) { $this->l73($O71['autoload']); } if ( isset ($O71['extract'])) { $this->O73($O71['extract']); } if ( isset ($O71['exceptions'])) { $this->l74($O71['exceptions']); } if ( isset ($O71['template'])) { $this->O74($O71['template']); } if ( isset ($O71['escape'])) { $this->l75($O71['escape']); } if ( isset ($O71['plugin_conf']) && is_array($O71['plugin_conf'])) { foreach ($O71['plugin_conf'] as $name => $O75) { $this->l76($name,$O75); } } if ( isset ($O71['filters'])) { $this->O76($O71['filters']); } } public function __call($l77,$O77) { $O6y=$this->l78($l77); if ($this->O78($O6y)) { return $O6y; } switch (count($O77)) { case 0: return $O6y->$l77(); case 1: return $O6y->$l77($O77[0]); break; case 2: return $O6y->$l77($O77[0],$O77[1]); break; case 3: return $O6y->$l77($O77[0],$O77[1],$O77[2]); break; default : return call_user_func_array(array($O6y,$l77),$O77); break; } } public function __tostring() { return $this->l79(); } public function apiversion() { return '@package_version@'; } public function l78($name) { $l1e= &$this->l71['plugins']; $O79=$this->l71['autoload']; if (!array_key_exists($name,$l1e)) { $O61= "\123\141\166ant3_P\154\165\147in_$name"; if (!class_exists($O61,$O79)) { $Ow= "$O61.ph\160"; $l31=$this->l7a('resource',$Ow); if (!$l31) { return $this->error('ERR_PLUGIN',array('method' => $name)); } else { include_once $l31; } } $O7a= &$this->l71['plugin_conf']; if (!empty($O7a[$name])) { $O75=$O7a[$name]; } else { $O75=array(); } $O75['Savant']=$this; $l1e[$name]=new $O61($O75); } return $l1e[$name]; } public function l7b($lf=NULL) { if (is_null($lf)) { return $this->l71; } elseif (empty($this->l71[$lf])) { return NULL; } else { return $this->l71[$lf]; } } public function l73($O7b) { $this->l71['autoload']= (bool) $O7b; } public function l7c($O7c) { $this->l71['compiler']=$O7c; } public function O72($l7d) { $this->l71['error_text']=$l7d; } public function l74($O7b) { $this->l71['exceptions']= (bool) $O7b; } public function O73($O7b) { $this->l71['extract']= (bool) $O7b; } public function l76($O6y,$O71=NULL) { $this->l71['plugin_conf'][$O6y]=$O71; } public function O74($l6m) { $this->l71['template']=$l6m; } public function l75() { $this->l71['escape']= (array) @func_get_args(); } public function O7d() { $O77= (array) @func_get_args(); $this->l71['escape']=array_merge($this->l71['escape'],$O77); } public function l7e() { return $this->l71['escape']; } public function escape($value) { if (func_num_args() == 1) { foreach ($this->l71['escape'] as $l77) { if (is_string($l77)) { $value=$l77($value); } else { $value=call_user_func($l77,$value); } } } else { $O7e=func_get_args(); array_shift($O7e); foreach ($O7e as $l77) { if (is_string($l77)) { $value=$l77($value); } else { $value=call_user_func($l77,$value); } } } return $value; } public function l7f($value) { $O7f=func_num_args(); if ($O7f == 1) { echo $this->escape($value); } else { $O77=func_get_args(); echo call_user_func_array(array($this,'escape'),$O77); } } public function l72($l7g,$O4k) { $this->l71[$l7g.'_path']=array(); switch (strtolower($l7g)) { case 'template': $this->O4($l7g,'.'); break; case 'resource': $this->O4($l7g,dirname( __FILE__).'/Savant3/resources/'); break; } $this->O4($l7g,$O4k); } public function O4($l7g,$O4k) { if (is_string($O4k) && !strpos($O4k,'://')) { $O4k=explode(PATH_SEPARATOR,$O4k); $O4k=array_reverse($O4k); } else { settype($O4k,'array'); } foreach ($O4k as $lm) { $lm=trim($lm); if (strpos($lm,'://') && substr($lm,-1) != '/') { $lm.='/'; } elseif (substr($lm,-1) != DIRECTORY_SEPARATOR) { $lm.=DIRECTORY_SEPARATOR; } array_unshift($this->l71[$l7g.'_path'],$lm); } } protected function l7a($l7g,$Ow) { $O7g=$this->l71[$l7g.'_path']; foreach ($O7g as $O4k) { $l7h=$O4k.$Ow; if (strpos($O4k,'://') === FALSE) { $O4k=realpath($O4k); $l7h=realpath($l7h); } if (file_exists($l7h) && is_readable($l7h) && substr($l7h,0,strlen($O4k)) == $O4k) { return $l7h; } } return FALSE; } public function l1u() { $O7h=@func_get_arg(0); $l7i=@func_get_arg(1); if (is_object($O7h)) { foreach (get_object_vars($O7h) as $lf => $Of) { if ($lf != '__config') { $this->$lf=$Of; } } return TRUE; } if (is_array($O7h)) { foreach ($O7h as $lf => $Of) { if ($lf != '__config') { $this->$lf=$Of; } } return TRUE; } if (is_string($O7h) && func_num_args()>1 && $O7h != '__config') { $this->$O7h=$l7i; return TRUE; } return FALSE; } public function O7i($lf,&$Of) { if ($lf != '__config') { $this->$lf= &$Of; return TRUE; } else { return FALSE; } } public function O8($O3=NULL) { echo $this->l79($O3); } public function l79($O3=NULL) { $ls=$this->fetch($O3); if ($this->O78($ls)) { $l7d=$this->l71['error_text']; return $this->escape($l7d); } else { return $ls; } } public function fetch($O3=NULL) { if (is_null($O3)) { $O3=$this->l71['template']; } $l31=$this->template($O3); if (!$l31 || $this->O78($l31)) { return $l31; } else { $this->l71['fetch']=$l31; unset ($l31); unset ($O3); if ($this->l71['extract']) { extract(get_object_vars($this),l7j); } ob_start(); if ($this->l71['filters']) { ob_start(); include $this->l71['fetch']; echo $this->O7j(ob_get_clean()); } else { include $this->l71['fetch']; } $this->l71['fetch']=NULL; return ob_get_clean(); } } protected function template($O3=NULL) { if (is_null($O3)) { $O3=$this->l71['template']; } $Ow=$this->l7a('template',$O3); if (!$Ow) { return $this->error('ERR_TEMPLATE',array('template' => $O3)); } if ($this->l71['compiler']) { $l31=call_user_func(array($this->l71['compiler'],'compile'),$Ow); } else { $l31=$Ow; } if (!$l31 || $this->O78($l31)) { return $this->error('ERR_COMPILER',array('template' => $O3,'compiler' => $l31)); } else { return $l31; } } public function l7k() { $this->l71['filters']= (array) @func_get_args(); } public function O76() { foreach ( (array) @func_get_args() as $O7k) { $this->l71['filters'][]=$O7k; } } protected function O7j($l7l) { $O79=$this->l71['autoload']; foreach ($this->l71['filters'] as $O7k) { if (is_array($O7k) && is_string($O7k[0]) && substr($O7k[0],0,017) == 'Savant3_Filter_' && !class_exists($O7k[0],$O79)) { $Ow=$O7k[0].'.php'; $l31=$this->l7a('resource',$Ow); if ($l31) { include_once $l31; } } $l7l=call_user_func($O7k,$l7l); } return $l7l; } public function error($O7l,$l51=array(),$l7m=E_USER_ERROR,$O7m=TRUE) { $O79=$this->l71['autoload']; if ($this->l71['exceptions']) { if (!class_exists('Savant3_Exception',$O79)) { include_once dirname( __FILE__).'/Savant3/Exception.php'; } throw new l7n($O7l); } $O71=array('code' => $O7l,'info' => (array) $l51,'level' => $l7m,'trace' => $O7m); if (!class_exists('Savant3_Error',$O79)) { include_once dirname( __FILE__).'/Savant3/Error.php'; } $O7n=new l7o($O71); return $O7n; } public function O78($l67) { $O79=$this->l71['autoload']; if (!is_object($l67)) { return FALSE; } else { if (!class_exists('Savant3_Error',$O79)) { include_once dirname( __FILE__).'/Savant3/Error.php'; } $O7o=$l67 instanceof l7o; $lk=is_subclass_of($l67,'Savant3_Error'); return ($O7o || $lk); } } } ?>