* zin: refactor
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace zin;
|
||||
|
||||
require_once dirname(__DIR__) . DS . 'utils' . DS . 'dataset.class.php';
|
||||
require_once dirname(__DIR__) . DS . 'utils' . DS . 'flat.func.php';
|
||||
require_once 'portal.class.php';
|
||||
|
||||
class context extends \zin\utils\dataset
|
||||
@@ -74,7 +75,8 @@ class context extends \zin\utils\dataset
|
||||
|
||||
public function addJSCall()
|
||||
{
|
||||
$code = call_user_func_array('h::createJsCallCode', func_get_args());
|
||||
$code = call_user_func_array('\zin\h::createJsCallCode', func_get_args());
|
||||
\a(array('code', $code, $this->getJsList()));
|
||||
return $this->addToList('jsCall', $code);
|
||||
}
|
||||
|
||||
@@ -97,13 +99,32 @@ class context extends \zin\utils\dataset
|
||||
public static function js(/* string ...$code */)
|
||||
{
|
||||
$context = static::current();
|
||||
call_user_func_array(array($context, 'addJS'), func_get_args());
|
||||
call_user_func_array(array($context, 'addJS'), \zin\utils\flat(func_get_args()));
|
||||
}
|
||||
|
||||
public static function jsCall(/* string ...$code */)
|
||||
{
|
||||
$context = static::current();
|
||||
call_user_func_array(array($context, 'addJSCall'), func_get_args());
|
||||
}
|
||||
|
||||
|
||||
public static function jsVar($name, $value)
|
||||
{
|
||||
$context = static::current();
|
||||
$context->addJSVar($name, $value);
|
||||
}
|
||||
|
||||
public static function css(/* string ...$code */)
|
||||
{
|
||||
$context = static::current();
|
||||
call_user_func_array(array($context, 'addCSS'), func_get_args());
|
||||
call_user_func_array(array($context, 'addCSS'), \zin\utils\flat(func_get_args()));
|
||||
}
|
||||
|
||||
public static function import(/* string ...$files */)
|
||||
{
|
||||
$context = static::current();
|
||||
call_user_func_array(array($context, 'addImport'), func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,22 +18,27 @@ function portal(/* string $name, mixed ...$children */)
|
||||
call_user_func_array('\zin\context::portal', func_get_args());
|
||||
}
|
||||
|
||||
function pageJS()
|
||||
function js()
|
||||
{
|
||||
call_user_func_array('\zin\context::js', func_get_args());
|
||||
}
|
||||
|
||||
function pageCSS()
|
||||
function jsCall()
|
||||
{
|
||||
call_user_func_array('\zin\context::css', func_get_args());
|
||||
call_user_func_array('\zin\context::jsCall', func_get_args());
|
||||
}
|
||||
|
||||
function pageJSVar()
|
||||
function jsVar()
|
||||
{
|
||||
call_user_func_array('\zin\context::jsVar', func_get_args());
|
||||
}
|
||||
|
||||
function pageImport()
|
||||
function css()
|
||||
{
|
||||
call_user_func_array('\zin\context::css', func_get_args());
|
||||
}
|
||||
|
||||
function import()
|
||||
{
|
||||
call_user_func_array('\zin\context::import', func_get_args());
|
||||
}
|
||||
|
||||
@@ -42,9 +42,4 @@ function li() {return call_user_func_array('\zin\h::li', func_get_args());
|
||||
function input() {return call_user_func_array('\zin\h::input', func_get_args());}
|
||||
function textarea() {return call_user_func_array('\zin\h::textarea', func_get_args());}
|
||||
|
||||
function js() {return call_user_func_array('\zin\h::js', func_get_args());}
|
||||
function jsVar() {return call_user_func_array('\zin\h::jsVar', func_get_args());}
|
||||
function jsCall() {return call_user_func_array('\zin\h::jsCall', func_get_args());}
|
||||
function jsRaw() {return call_user_func_array('\zin\h::jsRaw', func_get_args());}
|
||||
function css() {return call_user_func_array('\zin\h::css', func_get_args());}
|
||||
function import() {return call_user_func_array('\zin\h::import', func_get_args());}
|
||||
|
||||
Reference in New Issue
Block a user