本文整理汇总了PHP中registry::class_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP registry::class_exists方法的具体用法?PHP registry::class_exists怎么用?PHP registry::class_exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registry
的用法示例。
在下文中一共展示了registry::class_exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($name)
{
$shorts = static::__shortcuts();
if (isset($shorts[$name])) {
if (is_array($shorts[$name])) {
return registry::register($shorts[$name][0], $shorts[$name][1]);
} else {
return registry::register($shorts[$name]);
}
}
if (is_int(array_search($name, $shorts))) {
if (isset(registry::$aliases[$name])) {
if (is_array(registry::$aliases[$name])) {
return registry::register(registry::$aliases[$name][0], registry::$aliases[$name][1]);
} else {
return registry::register(registry::$aliases[$name]);
}
} elseif (registry::class_exists($name)) {
return registry::register($name);
}
}
if ($const = registry::get_const($name)) {
return $const;
}
return null;
}
示例2: __get
public function __get($name)
{
$deps = registry::get_const('short_' . get_class($this));
if (isset($deps[$name])) {
if (is_array($deps[$name])) {
return registry::register($deps[$name][0], $deps[$name][1]);
} else {
return registry::register($deps[$name]);
}
}
if (is_array($deps) && is_int(array_search($name, $deps))) {
if (isset(registry::$aliases[$name])) {
if (is_array(registry::$aliases[$name])) {
return registry::register(registry::$aliases[$name][0], registry::$aliases[$name][1]);
} else {
return registry::register(registry::$aliases[$name]);
}
} elseif (registry::class_exists($name)) {
return registry::register($name);
}
}
if ($const = registry::get_const($name)) {
return $const;
}
return null;
}
示例3: __get
public function __get($name)
{
if (isset($this->_class_index[$name])) {
$obj = registry::grab($this->_class_index[$name][0], $this->_class_index[$name][1]);
if ($obj) {
return $obj;
}
}
if (!$this->_shorts_loaded) {
$this->_shorts = static::__shortcuts();
$this->_shorts_loaded = true;
}
$obj = false;
if (isset($this->_shorts[$name])) {
if (is_array($this->_shorts[$name])) {
$obj = registry::register($this->_shorts[$name][0], $this->_shorts[$name][1]);
} else {
$obj = registry::register($this->_shorts[$name]);
}
} elseif (isset(registry::$aliases[$name])) {
if (is_array(registry::$aliases[$name])) {
$obj = registry::register(registry::$aliases[$name][0], registry::$aliases[$name][1]);
} else {
$obj = registry::register(registry::$aliases[$name]);
}
} elseif (registry::class_exists($name)) {
$obj = registry::register($name);
}
if ($obj) {
$this->_class_index[$name] = array(get_class($obj), $obj->class_hash);
return $obj;
}
if ($const = registry::get_const($name)) {
return $const;
}
return null;
}
示例4: destruct
public static function destruct($class, $class_hash = '')
{
if (self::$destruct_started) {
return;
}
self::$destruct_started = true;
self::$all_deps = array();
foreach (array_keys(self::$loaded) as $classname) {
$deps = $classname::__dependencies();
if (!empty($deps)) {
foreach ($deps as $name) {
if (isset(registry::$aliases[$name])) {
if (is_array(registry::$aliases[$name])) {
$dep_class = registry::$aliases[$name][0];
} else {
$dep_class = registry::$aliases[$name];
}
} elseif (registry::class_exists($name)) {
$dep_class = $name;
}
self::$all_deps[$dep_class][] = $classname;
}
}
}
self::_destruct($class, $class_hash);
self::$destruct_started = false;
}
示例5: value
/**
* shortcut for the return value of a field
*
* @param string $name: name of the field
* @param array $options: any options for the field
* @return mixed returns the input-value of the field
*/
public static function value($name, $options, $lang_prefix = false)
{
if (empty($options['type'])) {
$options['type'] = '';
}
$class_name = 'h' . $options['type'];
if (!registry::class_exists($class_name)) {
return null;
}
$class = new $class_name($name, $options);
// choose language var
if (!isset($options['lang'])) {
$lang = $lang_prefix ? $lang_prefix . 'f_' . $name : $name;
} else {
$lang = $options['lang'];
}
// direct language string?
if (!empty($options['dir_lang'])) {
$language = $options['dir_lang'];
} else {
$language = register('user')->lang($lang, false, false) ? register('user')->lang($lang) : (register('game')->glang($lang) ? register('game')->glang($lang) : $lang);
}
$class->_lang = $language;
if (!empty($options['encrypt'])) {
return register('encrypt')->encrypt($class->inpval());
}
return $class->inpval();
}