コード例 #1
0
 function is_callable($var, $syntax_only = 0)
 {
     $a = get_func_args();
     if (count($a) >= 3) {
         $fin =& $a[2];
     }
     #-- class/object+method
     if (is_array($var)) {
         if (count($var) != 2) {
             return false;
         }
         list($obj, $method) = $var;
         $class = $obj;
         if (is_object($obj)) {
             $class = get_class($obj);
         }
         if ($syntax_only) {
             $r = preg_match('/^\\w+$/', $method);
             if (!is_object($obj)) {
                 $r = $r && preg_match('/^\\w+$/', $obj);
             }
         } else {
             if (is_object($obj)) {
                 $r = method_exists($obj, $method);
             } else {
                 $all = get_class_methods($obj);
                 $r = in_array($method, $all);
             }
         }
         if ($r) {
             $fin = strtolower("{$class}:{$method}");
         }
     } elseif (is_string($var)) {
         if ($syntax_only) {
             $r = preg_match('/^\\w+$/', $var);
         } else {
             $r = function_exists($var);
         }
         if ($r) {
             $fin = strtolower($var);
         }
     } else {
         $r = false;
     }
     return $r;
 }
コード例 #2
0
 function vprintf($format, $args = NULL)
 {
     call_user_func_array("fprintf", get_func_args());
 }
コード例 #3
0
ファイル: index.php プロジェクト: rk/uFramework
 /**
  * Pass in names of modules under application/modules, and the file 'module.php' will be
  * included. This file must include all other files required by the library/package/module.
  * Modules will only be required once, and can be safely used in a customized controller
  * defined within the includes directory and inherited from.
  *
  * @return boolean
  * @author Robert Kosek
  **/
 public function require_modules()
 {
     foreach (get_func_args() as $name) {
         if (empty(self::$loaded_modules[$name])) {
             self::$loaded_modules[$name] = (require MICRO_PATH . "/application/modules/{$name}/module.php");
         }
     }
 }
コード例 #4
0
 protected function merge()
 {
     foreach (get_func_args() as $nodes) {
         foreach ($nodes as $newNode) {
             if (!$this->elementsContainsNode($newNode)) {
                 $this->elements[] = $newNode;
             }
         }
     }
 }