Esempio n. 1
0
 public function __call($method, $args)
 {
     $list = array();
     $params = range('a', 'z');
     $pParams = array();
     if ($args) {
         if (!is_array($args)) {
             $args = array($args);
         }
         foreach ($args as $v) {
             $pParams[current($params)] = $v;
             next($params);
         }
     }
     if (self::isPlugin($method)) {
         $entry_id = null;
         if ($pParams) {
             $params = func_get_args();
             $data['do'] = plugin::method($method);
             $data['is_plugin'] = $method;
             $data['data'] = $pParams;
             $data['file'] = plugin::file($method);
             $data['filename'] = preg_replace("/.*\\//", '', $data['file']);
             $entry_id = $this->xmlItem($this->xml($data), $method)->id;
         }
         $plugin = plugin::getPluginInstance($method, $params, $entry_id);
         if ($pParams) {
             plugin::instanceTriggers($plugin, $pParams);
         }
         return $plugin;
     } else {
         $data = array();
         $data['do'] = '_fn';
         $data['fn'] = $method;
         $data['fn_data'] = $pParams;
         $item = $this->xmlItem($this->xml($data), 'fn');
         $item->selector = $method;
         return $item;
     }
 }