* zin: change \zin\core and \zin\wg to \zin

This commit is contained in:
Hao Sun
2023-02-14 16:00:23 +08:00
parent 3331836093
commit f6b68b9974
12 changed files with 20 additions and 66 deletions
+3 -4
View File
@@ -9,12 +9,11 @@
* @link https://www.zentao.net
*/
namespace zin\core;
namespace zin;
require_once dirname(__DIR__) . DS . 'utils' . DS . 'flat.func.php';
use stdClass;
use function \zin\utils\flat;
/**
* Create directive object
@@ -82,12 +81,12 @@ function setId($id)
function html(/* string ...$lines */)
{
return directive('html', implode("\n", flat(func_get_args())));
return directive('html', implode("\n", \zin\utils\flat(func_get_args())));
}
function text(/* string ...$lines */)
{
return directive('text', implode("\n", flat(func_get_args())));
return directive('text', implode("\n", \zin\utils\flat(func_get_args())));
}
function block($name, $value = NULL)
+2 -4
View File
@@ -9,14 +9,12 @@
* @link https://www.zentao.net
*/
namespace zin\core;
namespace zin;
require_once dirname(__DIR__) . DS . 'utils' . DS . 'flat.func.php';
require_once 'wg.class.php';
require_once 'directive.func.php';
use function \zin\utils\flat;
class h extends wg
{
protected static $defineProps = 'tagName, selfClose?:bool=false, customProps?:string|array';
@@ -151,7 +149,7 @@ class h extends wg
protected static function convertStrToRawHtml($children)
{
$children = flat($children);
$children = \zin\utils\flat($children);
foreach($children as $key => $child)
{
if(is_string($child)) $children[$key] = html($child);
+1 -1
View File
@@ -9,7 +9,7 @@
* @link https://www.zentao.net
*/
namespace zin\core;
namespace zin;
require_once 'h.class.php';
+4 -4
View File
@@ -9,7 +9,7 @@
* @link https://www.zentao.net
*/
namespace zin\utils;
namespace zin;
require_once dirname(__DIR__) . DS . 'utils' . DS . 'dataset.class.php';
require_once dirname(__DIR__) . DS . 'utils' . DS . 'classlist.class.php';
@@ -18,7 +18,7 @@ require_once dirname(__DIR__) . DS . 'utils' . DS . 'style.class.php';
/**
* Manage properties for html element and widgets
*/
class props extends dataset
class props extends \zin\utils\dataset
{
/**
* Style property
@@ -44,8 +44,8 @@ class props extends dataset
*/
public function __construct($props = NULL)
{
$this->style = new style();
$this->class = new classlist();
$this->style = new \zin\utils\style();
$this->class = new \zin\utils\classlist();
parent::__construct($props);
}
+1 -3
View File
@@ -9,14 +9,12 @@
* @link https://www.zentao.net
*/
namespace zin\core;
namespace zin;
require_once 'props.class.php';
require_once 'wg.func.php';
require_once 'directive.func.php';
use zin\utils\props;
class wg
{
/**
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
namespace zin\core;
namespace zin;
/**
* @param $definition
-26
View File
@@ -16,32 +16,6 @@ require_once __DIR__ . DS . 'core' . DS . 'wg.class.php';
require_once __DIR__ . DS . 'core' . DS . 'h.class.php';
require_once __DIR__ . DS . 'core' . DS . 'h.func.php';
class h extends \zin\core\h {}
function prop() {return call_user_func_array('\zin\core\prop', func_get_args());}
function set() {return call_user_func_array('\zin\core\set', func_get_args());}
function setClass() {return call_user_func_array('\zin\core\setClass', func_get_args());}
function setStyle() {return call_user_func_array('\zin\core\setStyle', func_get_args());}
function setCssVar() {return call_user_func_array('\zin\core\setCssVar', func_get_args());}
function setId() {return call_user_func_array('\zin\core\setId', func_get_args());}
function html() {return call_user_func_array('\zin\core\html', func_get_args());}
function text() {return call_user_func_array('\zin\core\text', func_get_args());}
function block() {return call_user_func_array('\zin\core\block', func_get_args());}
function div() {return call_user_func_array('\zin\core\div', func_get_args());}
function span() {return call_user_func_array('\zin\core\span', func_get_args());}
function a() {return call_user_func_array('\zin\core\a', func_get_args());}
function p() {return call_user_func_array('\zin\core\p', func_get_args());}
function img() {return call_user_func_array('\zin\core\img', func_get_args());}
function button() {return call_user_func_array('\zin\core\button', func_get_args());}
function ol() {return call_user_func_array('\zin\core\ol', func_get_args());}
function ul() {return call_user_func_array('\zin\core\ul', func_get_args());}
function li() {return call_user_func_array('\zin\core\li', func_get_args());}
function input() {return call_user_func_array('\zin\core\input', func_get_args());}
function textarea() {return call_user_func_array('\zin\core\textarea', func_get_args());}
function js() {return call_user_func_array('\zin\core\js', func_get_args());}
function css() {return call_user_func_array('\zin\core\css', func_get_args());}
function import() {return call_user_func_array('\zin\core\import', func_get_args());}
function icon() {return createWg('icon', func_get_args());}
function btn() {return createWg('btn', func_get_args());}
function pagebase() {return createWg('pagebase', func_get_args());}
+1 -1
View File
@@ -47,7 +47,7 @@ function createWg($name, $args)
include_once $app->getBasePath() . 'zin' . DS . 'wg' . DS . $name . DS . "v$wgVer.php";
$className = "\\zin\\wg\\$name";
$className = "\\zin\\$name";
return class_exists($className) ? (new $className($args)) : $className($args);
}
+2 -6
View File
@@ -1,15 +1,11 @@
<?php
namespace zin\wg;
namespace zin;
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'h.class.php';
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'directive.func.php';
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'wg.func.php';
use zin\core\h;
use function zin\core\setClass;
use function zin\core\set;
class btn extends \zin\core\wg
class btn extends wg
{
static $defineProps = 'type,icon,text,square,disabled,active,url,target,size,trailingIcon,caret,hint,btnType';
+2 -6
View File
@@ -1,14 +1,10 @@
<?php
namespace zin\wg;
namespace zin;
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'h.class.php';
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'directive.func.php';
use zin\core\h;
use function zin\core\setClass;
use function zin\core\set;
class icon extends \zin\core\wg
class icon extends wg
{
protected static $defineProps = 'name:string';
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
namespace zin\wg;
namespace zin;
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'wg.class.php';
require_once dirname(__DIR__) . DS . 'pagebase' . DS . 'v1.php';
+2 -9
View File
@@ -1,18 +1,11 @@
<?php
namespace zin\wg;
namespace zin;
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'wg.class.php';
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'h.class.php';
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'directive.func.php';
use zin\core\h;
use function zin\core\html;
use function zin\core\set;
use function zin\core\before;
use function zin\core\import;
use function zin\core\js;
class pagebase extends \zin\core\wg
class pagebase extends wg
{
static $tag = 'html';