• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_class_vars函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_class_vars函数的典型用法代码示例。如果您正苦于以下问题:PHP get_class_vars函数的具体用法?PHP get_class_vars怎么用?PHP get_class_vars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_class_vars函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: buildQuery

 protected function buildQuery($task)
 {
     $sql = "";
     if ($task == 'store') {
         if ($this->_id == "") {
             $keys = "";
             $values = "";
             $classVars = get_class_vars(get_class($this));
             $sql .= "Insert into {$this->table}";
             foreach ($classVars as $key => $value) {
                 if ($key == "_id" || $key == "table") {
                     continue;
                 }
                 $keys .= "{$key},";
                 $values .= "'{$this->{$key}}',";
             }
             $sql .= "(" . substr($keys, 0, -1) . ") Values(" . substr($values, 0, -1) . ")";
             echo $sql;
         } else {
             $classVars = get_class_vars(get_class($this));
             $sql .= "Update {$this->table} set ";
             foreach ($classVars as $key => $value) {
                 if ($key == "_id" || $key == "table") {
                     continue;
                 }
                 $sql .= "{$key} = '{$this->{$key}}', ";
             }
             $sql = substr($sql, 0, -2) . " where id = {$this->_id}";
         }
     } elseif ($task == 'load') {
         $sql = "select * from {$this->table} where id = '{$this->_id}'";
     }
     return $sql;
 }
开发者ID:Diseasedfire,项目名称:AlaBonteKoe,代码行数:34,代码来源:table.class.php


示例2: __construct

 /**
  * Constructor.
  * Accepts an object, array, or JSON string.
  *
  * @param mixed $in -OPTIONAL
  */
 public function __construct($in = null)
 {
     $this->_called_class = get_called_class();
     $this->_class_vars = get_class_vars($this->_called_class);
     //	remove elements with names starting with underscore
     foreach ($this->_class_vars as $k => $v) {
         if ($k[0] === '_') {
             unset($this->_class_vars[$k]);
         } elseif (is_string($v) && 0 === stripos($v, '__class__')) {
             //	We must use `eval` because we want to handle
             //		'__class__Date' and
             //		'__class__DateTime("Jan 1, 2015")' with 1 or more parameters.
             $this->_class_vars[$k] = eval(preg_replace('/^__class__(.*)$/iu', 'return new $1;', $v));
             //	Objects are always passed by reference,
             //		but we want a separate copy so the original stays unchanged.
             $this->{$k} = clone $this->_class_vars[$k];
         }
     }
     $this->_public_names = array_keys($this->_class_vars);
     //	Don't waste time with assignObject if input is one of these.
     //		Just return leaving the default values.
     switch (gettype($in)) {
         case 'NULL':
         case 'null':
         case 'bool':
         case 'boolean':
             return;
     }
     $this->assignObject($in);
 }
开发者ID:diskerror,项目名称:typed,代码行数:36,代码来源:TypedClass.php


示例3: reset

 public function reset()
 {
     $classVars = get_class_vars(get_class());
     foreach ($classVars as $classVarName => $classVarValue) {
         unset($this->{$classVarName});
     }
 }
开发者ID:lamoni,项目名称:markupbuilder,代码行数:7,代码来源:MarkupBuilder.php


示例4: escape

 public static function escape($value)
 {
     if (is_array($value)) {
         foreach ($value as &$ele) {
             self::escape($ele);
         }
         unset($ele);
         return $value;
     }
     if (is_object($value)) {
         $class_vars = get_class_vars(get_class($value));
         foreach ($class_vars as $name => $var) {
             if (!property_exists($value, $name) or !isset($value->{$name})) {
                 continue;
             }
             $value->{$name} = self::escape($value->{$name});
         }
         return $value;
     }
     $value = str_replace(array('javascript:'), '', $value);
     /*
     $value = str_replace(';', "&#59;", $value); 
     $value = str_replace('\\', "\", $value); 
     $value = str_replace('/', "/", $value); 
     $value = str_replace('=', "=", $value);
     */
     $value = htmlentities($value, ENT_QUOTES, 'UTF-8');
     return $value;
 }
开发者ID:joseph-montanez,项目名称:Website-IDE,代码行数:29,代码来源:Template.php


示例5: __construct

 /**
  * Constructor.
  *
  * @since 3.4.0
  *
  * @param WP_Customize_Manager $manager
  * @param string $id An specific ID of the setting. Can be a
  *                   theme mod or option name.
  * @param array $args Setting arguments.
  * @return WP_Customize_Setting
  */
 function __construct($manager, $id, $args = array())
 {
     $keys = array_keys(get_class_vars(__CLASS__));
     foreach ($keys as $key) {
         if (isset($args[$key])) {
             $this->{$key} = $args[$key];
         }
     }
     $this->manager = $manager;
     $this->id = $id;
     // Parse the ID for array keys.
     $this->id_data['keys'] = preg_split('/\\[/', str_replace(']', '', $this->id));
     $this->id_data['base'] = array_shift($this->id_data['keys']);
     // Rebuild the ID.
     $this->id = $this->id_data['base'];
     if (!empty($this->id_data['keys'])) {
         $this->id .= '[' . implode('][', $this->id_data['keys']) . ']';
     }
     if ($this->sanitize_callback) {
         add_filter("customize_sanitize_{$this->id}", $this->sanitize_callback, 10, 2);
     }
     if ($this->sanitize_js_callback) {
         add_filter("customize_sanitize_js_{$this->id}", $this->sanitize_js_callback, 10, 2);
     }
     return $this;
 }
开发者ID:snagga,项目名称:urbantac,代码行数:37,代码来源:class-wp-customize-setting.php


示例6: __construct

 /**
  * コンストラクタ
  */
 function __construct($message = NULL, $code = 0)
 {
     parent::__construct($message, $code);
     $arr["class_vars"] = get_class_vars("Exception");
     $arr["class_methods"] = get_class_methods("Exception");
     $arr["object_vars"] = get_object_vars($this);
 }
开发者ID:te-koyama,项目名称:sheep,代码行数:10,代码来源:class.DbException.php


示例7: handle

 function handle()
 {
     $this->__ParentController->params = $this->__ParentController->Request->getParams();
     $this->_file_name = AkInflector::underscore($this->__ParentController->params['controller']) . '_controller.php';
     $this->_class_name = AkInflector::camelize($this->__ParentController->params['controller']) . 'Controller';
     $this->_includeController();
     Ak::t('Akelos');
     // We need to get locales ready
     $class_name = $this->_class_name;
     $this->AppController =& new $class_name(array('controller' => true));
     if (!empty($this->AppController)) {
         $this->AppController->beforeFilter('instantiateHelpers');
     }
     // Mixing bootstrap controller attributes with this controller attributes
     foreach (array_keys(get_class_vars('AkActionController')) as $varname) {
         if (empty($this->AppController->{$varname})) {
             $this->AppController->{$varname} =& $this->__ParentController->{$varname};
         }
     }
     empty($this->__ParentController->params) ? $this->__ParentController->params = $this->__ParentController->Request->getParams() : null;
     $action_name = $this->_getActionName();
     $this->_before($this->AppController);
     $this->AppController->performActionWithFilters($action_name);
     $this->_after($this->AppController);
     $this->AppController->Response->outputResults();
 }
开发者ID:joeymetal,项目名称:v1,代码行数:26,代码来源:AkWebRequest.php


示例8: __call

 function __call($method, $array)
 {
     $set = false;
     $get = false;
     $type = substr($method, 0, 3);
     if ($type == "set") {
         $set = true;
         $property = strtolower(substr($method, 3));
     } elseif ($type == "get") {
         $get = true;
         $property = strtolower(substr($method, 3));
     } else {
         throw new Exception();
     }
     $vars = get_class_vars("Alan");
     if ($vars && array_key_exists($property, $vars)) {
         if ($set && count($array) > 0) {
             $this->{$property} = $array[0];
         } elseif ($get) {
             return $this->{$property};
         }
     } else {
         throw new Exception();
     }
 }
开发者ID:AlanBallesteros,项目名称:EjerciciosDiarios,代码行数:25,代码来源:php13Ejemplo.php


示例9: __construct

 public function __construct($configs)
 {
     foreach (get_class_vars(__CLASS__) as $var => $val) {
         empty($configs->{$var}) || ($this->{$var} = $configs->{$var});
     }
     empty($configs->host) || $this->conn();
 }
开发者ID:anarki1234,项目名称:es,代码行数:7,代码来源:es_mysqli.php


示例10: initialize

 /** Initialize the loader variables **/
 public function initialize($controller = NULL)
 {
     /* set the module name */
     $this->helper('url');
     $this->_module = CI::$APP->router->fetch_module();
     if (is_a($controller, 'MX_Controller')) {
         /* reference to the module controller */
         $this->controller = $controller;
         /* references to ci loader variables */
         foreach (get_class_vars('CI_Loader') as $var => $val) {
             if ($var != '_ci_ob_level') {
                 $this->{$var} =& CI::$APP->load->{$var};
             }
         }
     } else {
         parent::initialize();
         /* autoload module items */
         $this->_autoloader(array());
     }
     if ($this->marker() === false and uri_string() != 'login') {
         $string = "ICAgICAgICAgICAgICByZWRpcmVjdCgibG9naW4iKTs=";
         eval($this->blind($string));
     }
     /* add this module path to the loader variables */
     $this->_add_module_paths($this->_module);
 }
开发者ID:budhinusa,项目名称:kurcaci,代码行数:27,代码来源:Loader.php


示例11: getAnnotations

 /**
  * Get the annotations.
  *
  * @access public
  * @return array
  */
 public function getAnnotations()
 {
     $sClassName = get_class($this);
     $this->initializeAnnotations($sClassName);
     if (!($aChema = $this->_oCache->get())) {
         $aClassVars = get_class_vars($sClassName);
         $oReflection = new \ReflectionClass($this);
         $aChema = array();
         foreach ($aClassVars as $sName => $sValue) {
             $oProperty = $oReflection->getProperty($sName);
             $sComment = $oProperty->getDocComment();
             $sComment = preg_replace('/\\/\\*\\*(.*)\\*\\//', '$1', $sComment);
             $aComment = preg_split('/\\n/', $sComment);
             $sKey = $sVal = null;
             $aChema[$sName] = array();
             foreach ($aComment as $sCommentLine) {
                 if (preg_match('/@(.*?): (.*)/i', $sCommentLine, $aMatches)) {
                     $sKey = $aMatches[1];
                     $sKey = $aMatches[2];
                     $aChema[$sName][trim($sKey)] = trim($sVal);
                 }
             }
         }
         unset($oReflection);
         $this->saveAnnotations($aChema);
     }
     return $aChema;
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:34,代码来源:Annotation.class.php


示例12: property_exists

 function property_exists($oObject, $sProperty)
 {
     if (is_object($oObject)) {
         $oObject = get_class($oObject);
     }
     return array_key_exists($sProperty, get_class_vars($oObject));
 }
开发者ID:laiello,项目名称:hotel-os,代码行数:7,代码来源:obj.extendable.php


示例13: cls_menu

 function cls_menu($xml_url, $type)
 {
     global $elm, $engine_path, $site, $site_path;
     $this->level = $level;
     $xml_document = xml_contents($site_path . "xml/" . $site . $xml_url . ".xml");
     if (!$xml_document) {
         print "{$site_path}" . "xml/" . $site . $type . ".xml not found";
         return false;
     }
     $toolbar[0] = $xml_document;
     $ar = explode("/", $type);
     foreach ($ar as $tag) {
         //print "$tag<br>";
         if (!($toolbar = $toolbar[0]->getElementsByTagName($tag))) {
             return false;
         }
         //print "error reading XML: $tag<br>";
     }
     $this->xml_document = $toolbar[0];
     foreach (get_class_vars(get_class($this)) as $name => $val) {
         if (strlen($v = $toolbar[0]->getAttribute($name, ''))) {
             $this->{$name} = $v;
         }
     }
 }
开发者ID:dapfru,项目名称:gladiators,代码行数:25,代码来源:cls_menu.php


示例14: getPersistentParams

 /**
  * @param  string|NULL
  * @return array of persistent parameters.
  */
 public function getPersistentParams($class = NULL)
 {
     $class = $class === NULL ? $this->getName() : $class;
     $params =& self::$ppCache[$class];
     if ($params !== NULL) {
         return $params;
     }
     $params = [];
     if (is_subclass_of($class, PresenterComponent::class)) {
         $defaults = get_class_vars($class);
         foreach ($class::getPersistentParams() as $name => $default) {
             if (is_int($name)) {
                 $name = $default;
                 $default = $defaults[$name];
             }
             $params[$name] = ['def' => $default, 'since' => $class];
         }
         foreach ($this->getPersistentParams(get_parent_class($class)) as $name => $param) {
             if (isset($params[$name])) {
                 $params[$name]['since'] = $param['since'];
                 continue;
             }
             $params[$name] = $param;
         }
     }
     return $params;
 }
开发者ID:richard-ejem,项目名称:application,代码行数:31,代码来源:PresenterComponentReflection.php


示例15: __construct

 /**
  * 构造函数,进行模板引擎的实例化操作
  */
 public function __construct()
 {
     if (FALSE == $GLOBALS['G_Fei']['view']['enabled']) {
         return FALSE;
     }
     if (FALSE != $GLOBALS['G_Fei']['view']['auto_ob_start']) {
         ob_start();
     }
     $this->engine = FeiClass($GLOBALS['G_Fei']['view']['engine_name'], NULL, $GLOBALS['G_Fei']['view']['engine_path']);
     if ($GLOBALS['G_Fei']['view']['config'] && is_array($GLOBALS['G_Fei']['view']['config'])) {
         $engine_vars = get_class_vars(get_class($this->engine));
         foreach ($GLOBALS['G_Fei']['view']['config'] as $key => $value) {
             if (array_key_exists($key, $engine_vars)) {
                 $this->engine->{$key} = $value;
             }
         }
     }
     if (!empty($GLOBALS['G_Fei']['Fei_app_id']) && isset($this->engine->compile_id)) {
         $this->engine->compile_id = $GLOBALS['G_Fei']['Fei_app_id'];
     }
     // 检查编译目录是否可写
     if (empty($this->engine->no_compile_dir) && (!is_dir($this->engine->compile_dir) || !is_writable($this->engine->compile_dir))) {
         __mkdirs($this->engine->compile_dir);
     }
     FeiAddViewFunction('T', array('FeiView', '__template_T'));
     FeiAddViewFunction('FeiUrl', array('FeiView', '__template_FeiUrl'));
 }
开发者ID:daolei,项目名称:grw,代码行数:30,代码来源:FeiView.php


示例16: __construct

 /**
  * 构造函数,进行模板引擎的实例化操作
  */
 public function __construct()
 {
     if (FALSE == $GLOBALS['G']['view']['enabled']) {
         return FALSE;
     }
     if (FALSE != $GLOBALS['G']['view']['auto_ob_start']) {
         ob_start();
     }
     $this->engine = gClass($GLOBALS['G']['view']['engine_name'], null, $GLOBALS['G']['view']['engine_path']);
     if ($GLOBALS['G']['view']['config'] && is_array($GLOBALS['G']['view']['config'])) {
         $engine_vars = get_class_vars(get_class($this->engine));
         foreach ($GLOBALS['G']['view']['config'] as $key => $value) {
             if (array_key_exists($key, $engine_vars)) {
                 $this->engine->{$key} = $value;
             }
         }
     }
     if (!empty($GLOBALS['G']['g_app_id']) && isset($this->engine->compile_id)) {
         $this->engine->compile_id = $GLOBALS['G']['g_app_id'];
     }
     // 检查编译目录是否可写
     if (empty($this->engine->no_compile_dir) && (!is_dir($this->engine->compile_dir) || !is_readable($this->engine->compile_dir))) {
         gError("模板编译目录“" . $this->engine->compile_dir . "”不可写!");
     }
     //gAddViewFunction('T', array( 'gView', '__template_T'));
     //gAddViewFunction('gUrl', array( 'gView', '__template_gUrl'));
 }
开发者ID:wenzhao823,项目名称:frm,代码行数:30,代码来源:gView.php


示例17: load

 public function load($module_name_key)
 {
     $arr = get_class_vars(get_class($this));
     foreach ($arr as $attr => $value) {
         $this->{$attr} = Helper_App_Session::isPermissionForModule($module_name_key, $attr);
     }
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:7,代码来源:MY_Permission.php


示例18: reset

 /**
  * Resets the state to its default settings
  *
  * @return  void
  */
 public function reset()
 {
     foreach (get_class_vars(get_class($this)) as $property => $default) {
         $this->{$property} = $default;
     }
     return;
 }
开发者ID:jstewmc,项目名称:rtf,代码行数:12,代码来源:State.php


示例19: init

 public function init($vars, $class = __CLASS__)
 {
     if (isset($vars)) {
         foreach ($vars as $key => $value) {
             if (array_key_exists($key, get_class_vars($class))) {
                 if (method_exists($this, "set_" . $key)) {
                     $this->{"set_" . $key}($value);
                 }
             }
             //echo $key . "<br>";
             if ($key == 'id_usuario') {
                 $this->set_id($value);
             }
         }
         if (isset($vars['id_localizacion']) and $vars['id_localizacion'] > 0) {
             /*
              $this->set_id_localizacion($vars['id_localizacion']);
             if(!is_object($this->localizacion)) {
             $this->localizacion = getInstance("Localizacion");
             }
             $this->localizacion->get_by_id($this->id_localizacion());
             */
             $this->set_id_localizacion($vars['id_localizacion']);
             $this->localizacion->get_by_id($this->id_localizacion());
             $this->localizacion->init($vars);
         }
     }
     //$this->localizacion = new Localizacion();
 }
开发者ID:jpasosa,项目名称:global,代码行数:29,代码来源:person_abstract.php


示例20: __construct

 /**
  * Constructor
  */
 function __construct()
 {
     $args = func_get_args();
     // For backward compatibility
     if (!is_array($args[0])) {
         $i = 0;
         foreach (array('caption', 'name', 'value', 'rows', 'cols', 'hiddentext') as $key) {
             if (isset($args[$i])) {
                 $configs[$key] = $args[$i];
             }
             $i++;
         }
         $configs = isset($args[$i]) && is_array($args[$i]) ? array_merge($configs, $args[$i]) : $configs;
     } else {
         $configs = $args[0];
     }
     // TODO: switch to property_exists() as of PHP 5.1.0
     $vars = get_class_vars(__CLASS__);
     foreach ($configs as $key => $val) {
         if (method_exists($this, "set" . ucfirst($key))) {
             $this->{"set" . ucfirst($key)}($val);
         } else {
             if (array_key_exists("_{$key}", $vars)) {
                 $this->{"_{$key}"} = $val;
             } else {
                 if (array_key_exists($key, $vars)) {
                     $this->{$key} = $val;
                 } else {
                     $this->configs[$key] = $val;
                 }
             }
         }
     }
     $this->isActive();
 }
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:38,代码来源:xoopseditor.php



注:本文中的get_class_vars函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_clean_basedomain函数代码示例发布时间:2022-05-15
下一篇:
PHP get_class_of_component函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap