From f9493b51ec0c39ed6c47c36586540b1b5d9f5bed Mon Sep 17 00:00:00 2001 From: Hao Sun Date: Mon, 20 Feb 2023 14:02:35 +0800 Subject: [PATCH] * zin: refactor --- zin/core/props.class.php | 4 ++-- zin/utils/style.class.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zin/core/props.class.php b/zin/core/props.class.php index 5e2e53b2cb..9c87ee885b 100755 --- a/zin/core/props.class.php +++ b/zin/core/props.class.php @@ -62,8 +62,8 @@ class props extends \zin\utils\dataset if($prop === 'class' || $prop === '.') return $this->class->set($value); if($prop === 'style' || $prop === '~') return $this->style->set($value); if(strpos($prop, '~') === 0) return $this->style->set(substr($prop, 1), $value); - if($prop === '--') return $this->style->var($value); - if(strpos($prop, '--') === 0) return $this->style->var(substr($prop, 2), $value); + if($prop === '--') return $this->style->cssVar($value); + if(strpos($prop, '--') === 0) return $this->style->cssVar(substr($prop, 2), $value); if($prop === '!') return $this->hx($value); if(strpos($prop, '!') === 0) return $this->hx(substr($prop, 1), $value); if(strpos($prop, ':') === 0) return $this->set('data-' . substr($prop, 1), $value); diff --git a/zin/utils/style.class.php b/zin/utils/style.class.php index 122ac4d144..4fb5cd49bb 100755 --- a/zin/utils/style.class.php +++ b/zin/utils/style.class.php @@ -53,27 +53,27 @@ class style extends dataset * * // Create a style object and set * $style = new style(); - * $style->var('text-size', '14px'); + * $style->cssVar('text-size', '14px'); * * // Set multiple variables - * $style->var(array('text-color' => 'yellow', 'background-image': 'none')); + * $style->cssVar(array('text-color' => 'yellow', 'background-image': 'none')); * * // Get variable value - * echo $style->var('text-size'); // Output "14px" + * echo $style->cssVar('text-size'); // Output "14px" * * // Get all variables value - * echo $style->var(); + * echo $style->cssVar(); * // Output array('text-size' => '14px', 'color' => 'yellow', 'background': 'none'); * * // Remove variable by setting value with an empty string - * $style->var('text-color', ''); + * $style->cssVar('text-color', ''); * * @access public * @param array|string $name - Variable name or variables list * @param mixed $value - Property value * @return mixed */ - public function var($name = '', $value = NULL) + public function cssVar($name = '', $value = NULL) { /* Support for setting multiple variables by an array */ if(is_array($name))