コード例 #1
0
ファイル: PhpQuery.php プロジェクト: cagartner/phpquery
class phpQueryPlugins
{
    public function __call($method, $args)
    {
        if (isset(phpQuery::$extendStaticMethods[$method])) {
            $return = call_user_func_array(phpQuery::$extendStaticMethods[$method], $args);
        } else {
            if (isset(phpQuery::$pluginsStaticMethods[$method])) {
                $class = phpQuery::$pluginsStaticMethods[$method];
                $realClass = "\\PhpQuery\\Plugin\\Util{$class}";
                $return = call_user_func_array(array($realClass, $method), $args);
                return isset($return) ? $return : $this;
            } else {
                throw new \Exception("Method '{$method}' doesnt exist");
            }
        }
    }
}
// // add plugins dir and Zend framework to include path
// set_include_path(
// 	get_include_path()
// 		.PATH_SEPARATOR.dirname(__FILE__).'/phpQuery/'
// 		.PATH_SEPARATOR.dirname(__FILE__).'/phpQuery/plugins/'
// );
// why ? no __call nor __get for statics in php...
// XXX __callStatic will be available in PHP 5.3
phpQuery::$plugins = new phpQueryPlugins();
// include bootstrap file (personal library config)
if (file_exists(dirname(__FILE__) . '/phpQuery/bootstrap.php')) {
    require_once dirname(__FILE__) . '/phpQuery/bootstrap.php';
}