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


PHP JRegistry::exists方法代码示例

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


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

示例1: testExists

 /**
  * Test the JReigstry::exists method.
  */
 public function testExists()
 {
     $a = new JRegistry();
     $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:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:15,代码来源:JRegistryTest.php

示例2: setRegistrationField

 private function setRegistrationField($name, $value)
 {
     $app = JFactory::getApplication();
     $cs = $app->getUserState('com_users.registration.data');
     $state = new JRegistry();
     $state->loadArray($cs);
     if (!$state->exists($name)) {
         JFactory::getApplication()->setUserState('com_users.registration.data.' . $name, $value);
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:10,代码来源:joomla.php

示例3: patch

 /**
  * Method to send the PATCH command to the server.
  *
  * @param   string   $url      Path to the resource.
  * @param   mixed    $data     Either an associative array or a string to be sent with the request.
  * @param   array    $headers  An array of name-value pairs to include in the header of the request.
  * @param   integer  $timeout  Read timeout in seconds.
  *
  * @return  BDHttpResponse
  *
  * @since   1.0
  */
 public function patch($url, $data, array $headers = null, $timeout = null)
 {
     // Look for headers set in the options.
     $temp = (array) $this->options->get('headers');
     foreach ($temp as $key => $val) {
         if (!isset($headers[$key])) {
             $headers[$key] = $val;
         }
     }
     // Look for timeout set in the options.
     if ($timeout === null && $this->options->exists('timeout')) {
         $timeout = $this->options->get('timeout');
     }
     return $this->transport->request('PATCH', new JUri($url), $data, $headers, $timeout, $this->options->get('userAgent', null));
 }
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:27,代码来源:http.php

示例4: 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;
     }
     // Initialise variables.
     $input = new JRegistry($data);
     $output = new JRegistry();
     // 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) {
         // Initialise variables.
         $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);
         // Get the field value from the data input.
         if ($group) {
             // Filter the value if it exists.
             if ($input->exists($group . '.' . $name)) {
                 $output->set($group . '.' . $name, $this->filterField($field, $input->get($group . '.' . $name, (string) $field['default'])));
             }
         } else {
             // Filter the value if it exists.
             if ($input->exists($name)) {
                 $output->set($name, $this->filterField($field, $input->get($name, (string) $field['default'])));
             }
         }
     }
     return $output->toArray();
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:48,代码来源:form.php

示例5: migrateProfilePluginSettings612

 private function migrateProfilePluginSettings612()
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     // fixed PHP notice from invalid query
     $query->select("setting,value")->from($db->qn("#__jfbconnect_config"))->where($db->qn('setting') . " LIKE " . $db->q("profile_%"))->order('setting');
     $rows = $db->setQuery($query)->loadObjectList();
     if (!empty($rows)) {
         require_once JPATH_ADMINISTRATOR . '/components/com_jfbconnect/models/config.php';
         $configModel = new JFBConnectModelConfig();
         foreach ($rows as $row) {
             $values = explode("_", $row->setting);
             $pluginName = $values[1];
             $settings = new JRegistry();
             $settings->loadString($row->value);
             if ($settings->exists('field_map') && $settings->exists('field_map.facebook')) {
                 $fieldMap = clone $settings->get('field_map');
                 foreach ($fieldMap->facebook as $key => $value) {
                     if ($value == "sex") {
                         $fieldMap->facebook->{$key} = "gender";
                     }
                     if ($value == "profile_url") {
                         $fieldMap->facebook->{$key} = "link";
                     }
                     if ($value == "about_me") {
                         $fieldMap->facebook->{$key} = "bio";
                     }
                     if ($value == "tv") {
                         $fieldMap->facebook->{$key} = "television";
                     }
                     if (in_array($value, array("hometown_location.city", "hometown_location.state", "hometown_location.country"))) {
                         $fieldMap->facebook->{$key} = "hometown.name";
                     }
                     if (in_array($value, array("current_location.city", "current_location.state", "current_location.country"))) {
                         $fieldMap->facebook->{$key} = "location.name";
                     }
                 }
                 $settings->set("field_map", null);
                 $settings->set("field_map", $fieldMap);
                 $configModel->update('profile_' . $pluginName, $settings->toString());
             }
         }
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:44,代码来源:install.php


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