当前位置: 首页>>代码示例>>PHP>>正文


PHP Registry::exists方法代码示例

本文整理汇总了PHP中Joomla\Registry\Registry::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::exists方法的具体用法?PHP Registry::exists怎么用?PHP Registry::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Joomla\Registry\Registry的用法示例。


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

示例1: __get

 /**
  * Get a global template var.
  *
  * @param   string  $key  The template var key.
  *
  * @return  mixed
  *
  * @since   1.0
  */
 public function __get($key)
 {
     if ($this->globals->exists($key)) {
         return $this->globals->get($key);
     }
     if ($this->debug) {
         trigger_error('No template var: ' . $key);
     }
     return '';
 }
开发者ID:dextercowley,项目名称:jissues,代码行数:19,代码来源:Php.php

示例2: has

 /**
  * Check whether data exists in the session store
  *
  * @param   string  $name  Name of variable
  *
  * @return  boolean  True if the variable exists
  *
  * @since   4.0
  */
 public function has($name)
 {
     if (!$this->isStarted()) {
         $this->start();
     }
     return $this->data->exists($name);
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:16,代码来源:JoomlaStorage.php

示例3: filter

 /**
  * Method to filter the form data.
  *
  * @param   array   $data   An array of field values to filter.
  * @param   string  $group  The dot-separated form group path on which to filter the fields.
  *
  * @return  mixed  Array or false.
  *
  * @since   11.1
  */
 public function filter($data, $group = null)
 {
     // Make sure there is a valid JForm XML document.
     if (!$this->xml instanceof SimpleXMLElement) {
         return false;
     }
     $input = new Registry($data);
     $output = new Registry();
     // Get the fields for which to filter the data.
     $fields = $this->findFieldsByGroup($group);
     if (!$fields) {
         // PANIC!
         return false;
     }
     // Filter the fields.
     foreach ($fields as $field) {
         $name = (string) $field['name'];
         // Get the field groups for the element.
         $attrs = $field->xpath('ancestor::fields[@name]/@name');
         $groups = array_map('strval', $attrs ? $attrs : array());
         $group = implode('.', $groups);
         $key = $group ? $group . '.' . $name : $name;
         // Filter the value if it exists.
         if ($input->exists($key)) {
             $output->set($key, $this->filterField($field, $input->get($key, (string) $field['default'])));
         }
     }
     return $output->toArray();
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:39,代码来源:form.php

示例4: testExists

 /**
  * Test the Joomla\Registry\Registry::exists method.
  *
  * @return  void
  *
  * @covers  Joomla\Registry\Registry::exists
  * @since   1.0
  */
 public function testExists()
 {
     $a = new Registry();
     $a->set('foo', 'bar1');
     $a->set('config.foo', 'bar2');
     $a->set('deep.level.foo', 'bar3');
     $this->assertThat($a->exists('foo'), $this->isTrue(), 'Line: ' . __LINE__ . ' The path should exist, returning true.');
     $this->assertThat($a->exists('config.foo'), $this->isTrue(), 'Line: ' . __LINE__ . ' The path should exist, returning true.');
     $this->assertThat($a->exists('deep.level.foo'), $this->isTrue(), 'Line: ' . __LINE__ . ' The path should exist, returning true.');
     $this->assertThat($a->exists('deep.level.bar'), $this->isFalse(), 'Line: ' . __LINE__ . ' The path should not exist, returning false.');
     $this->assertThat($a->exists('bar.foo'), $this->isFalse(), 'Line: ' . __LINE__ . ' The path should not exist, returning false.');
 }
开发者ID:ZerGabriel,项目名称:joomla-framework,代码行数:20,代码来源:RegistryTest.php

示例5: filter

 /**
  * Method to filter the form data.
  *
  * @param   array   $data   An array of field values to filter.
  * @param   string  $group  The dot-separated form group path on which to filter the fields.
  *
  * @return  mixed  Array or false.
  *
  * @since   11.1
  */
 public function filter($data, $group = null)
 {
     // Make sure there is a valid JForm XML document.
     if (!$this->xml instanceof SimpleXMLElement) {
         return false;
     }
     $input = new Registry($data);
     $output = new Registry();
     // Get the fields for which to filter the data.
     $fields = $this->findFieldsByGroup($group);
     if (!$fields) {
         // PANIC!
         return false;
     }
     // Filter the fields.
     foreach ($fields as $field) {
         $name = (string) $field['name'];
         // Get the field groups for the element.
         $attrs = $field->xpath('ancestor::fields[@name]/@name');
         $groups = array_map('strval', $attrs ? $attrs : array());
         $group = implode('.', $groups);
         $key = $group ? $group . '.' . $name : $name;
         // Filter the value if it exists.
         if ($input->exists($key)) {
             $output->set($key, $this->filterField($field, $input->get($key, (string) $field['default'])));
         }
         // Get the JFormField object for this field, only it knows if it is supposed to be multiple.
         $jfield = $this->getField($name, $group);
         // Fields supporting multiple values must be stored as empty arrays when no values are selected.
         // If not, they will appear to be unset and then revert to their default value.
         if ($jfield && $jfield->multiple && !$output->exists($key)) {
             $output->set($key, array());
         }
     }
     return $output->toArray();
 }
开发者ID:raviol,项目名称:TEST1,代码行数:46,代码来源:form.php

示例6: has

 /**
  * Check whether data exists in the session store
  *
  * @param   string  $name       Name of variable
  * @param   string  $namespace  Namespace to use, default to 'default'
  *
  * @return  boolean  True if the variable exists
  *
  * @since   11.1
  */
 public function has($name, $namespace = 'default')
 {
     return $this->data->exists($namespace . '.' . $name);
 }
开发者ID:Biromain,项目名称:windwalker-joomla-rad,代码行数:14,代码来源:MockSession.php

示例7: testEnsureEmptyPathsDoNotExist

 /**
  * @testdox  The Registry does not validate an empty path exists
  *
  * @covers   Joomla\Registry\Registry::exists
  */
 public function testEnsureEmptyPathsDoNotExist()
 {
     $a = new Registry();
     $this->assertFalse($a->exists(''), 'An empty path should not exist.');
 }
开发者ID:nkuitche,项目名称:registry,代码行数:10,代码来源:RegistryTest.php


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