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


PHP Registry::toObject方法代码示例

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


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

示例1: getList


//.........这里部分代码省略.........
             break;
         case 'rdate':
             $orderby = 'c.created DESC';
             break;
         case 'date':
             $orderby = 'c.created ASC';
             break;
         case 'alpha':
             $orderby = 'c.title ASC';
             break;
         case 'ralpha':
             $orderby = 'c.title DESC';
             break;
         case 'author':
             $orderby = 'u.name ASC';
             break;
         case 'rauthor':
             $orderby = 'u.name DESC';
             break;
         case 'hits':
             $orderby = 'c.hits DESC';
             break;
         case 'rhits':
             $orderby = 'c.hits ASC';
             break;
         case 'order':
             $orderby = 'c.ordering ASC';
             break;
     }
     if ($params->get('random_article', 0)) {
         $query->order('RAND()');
     }
     $query->order($orderby);
     $query->group('c.id');
     $db->setQuery($query, 0, $params->get('article_limit', 5));
     $items = $db->loadObjectList();
     if ($items) {
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         TZ_Portfolio_PlusPluginHelper::importPlugin('content');
         TZ_Portfolio_PlusPluginHelper::importPlugin('mediatype');
         $dispatcher->trigger('onAlwaysLoadDocument', array('modules.mod_tz_portfolio_plus_articles'));
         $dispatcher->trigger('onLoadData', array('modules.mod_tz_portfolio_plus_articles', $items, $params));
         foreach ($items as $i => &$item) {
             $item->link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catslug));
             $item->fullLink = JRoute::_(TZ_Portfolio_PlusHelperRoute::getArticleRoute($item->slug, $item->catslug), true, -1);
             $item->author_link = JRoute::_(TZ_Portfolio_PlusHelperRoute::getUserRoute($item->user_id, $params->get('usermenuitem', 'auto')));
             $media = $item->media;
             if (!empty($media)) {
                 $registry = new Registry($media);
                 $media = $registry->toObject();
                 $item->media = $media;
             }
             $item->mediatypes = array();
             // Old plugins: Ensure that text property is available
             if (!isset($item->text)) {
                 $item->text = $item->introtext;
             }
             $item->event = new stdClass();
             //Call trigger in group content
             $results = $dispatcher->trigger('onContentPrepare', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0));
             $item->introtext = $item->text;
             if ($introtext_limit = $params->get('introtext_limit')) {
                 $item->introtext = '<p>' . JHtml::_('string.truncate', $item->introtext, $introtext_limit, true, false) . '</p>';
             }
             //                $results = $dispatcher->trigger('onContentAfterTitle', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0));
             //                $item->event->afterDisplayTitle = trim(implode("\n", $results));
             //
             $results = $dispatcher->trigger('onContentBeforeDisplay', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default')));
             $item->event->beforeDisplayContent = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentAfterDisplay', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default')));
             $item->event->afterDisplayContent = trim(implode("\n", $results));
             // Process the tz portfolio's content plugins.
             $results = $dispatcher->trigger('onBeforeDisplayAdditionInfo', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default')));
             $item->event->beforeDisplayAdditionInfo = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onAfterDisplayAdditionInfo', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default')));
             $item->event->afterDisplayAdditionInfo = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentDisplayListView', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default')));
             $item->event->contentDisplayListView = trim(implode("\n", $results));
             //Call trigger in group tz_portfolio_plus_mediatype
             $results = $dispatcher->trigger('onContentDisplayMediaType', array('modules.mod_tz_portfolio_plus_articles', &$item, &$params, 0, $params->get('layout', 'default')));
             if (isset($item) && $item) {
                 $item->event->onContentDisplayMediaType = trim(implode("\n", $results));
                 if ($results = $dispatcher->trigger('onAddMediaType')) {
                     $mediatypes = array();
                     foreach ($results as $result) {
                         if (isset($result->special) && $result->special) {
                             $mediatypes[] = $result->value;
                         }
                     }
                     $item->mediatypes = $mediatypes;
                 }
             } else {
                 unset($items[$i]);
             }
         }
         return $items;
     }
     return false;
 }
开发者ID:templaza,项目名称:tz_portfolio_plus,代码行数:101,代码来源:helper.php

示例2: testToObject

 /**
  * Test the Joomla\Registry\Registry::toObject method.
  *
  * @return  void
  *
  * @covers  Joomla\Registry\Registry::toObject
  * @since   1.0
  */
 public function testToObject()
 {
     $a = new Registry();
     $a->set('foo1', 'testtoobject1');
     $a->set('foo2', 'testtoobject2');
     $a->set('config.foo3', 'testtoobject3');
     $expected = new stdClass();
     $expected->foo1 = 'testtoobject1';
     $expected->foo2 = 'testtoobject2';
     $expected->config = new StdClass();
     $expected->config->foo3 = 'testtoobject3';
     $this->assertThat($a->toObject(), $this->equalTo($expected), 'Line: ' . __LINE__ . '.');
 }
开发者ID:ZerGabriel,项目名称:joomla-framework,代码行数:21,代码来源:RegistryTest.php

示例3: testTheRegistryCanBeConvertedToAnObject

 /**
  * @testdox  The Registry can be converted to an object
  *
  * @covers   Joomla\Registry\Registry::toObject
  */
 public function testTheRegistryCanBeConvertedToAnObject()
 {
     $a = new Registry(array('foo1' => 'testtoobject1', 'foo2' => 'testtoobject2', 'config' => array('foo3' => 'testtoobject3')));
     $expected = new \stdClass();
     $expected->foo1 = 'testtoobject1';
     $expected->foo2 = 'testtoobject2';
     $expected->config = new \stdClass();
     $expected->config->foo3 = 'testtoobject3';
     $this->assertEquals($expected, $a->toObject(), 'The Registry should be converted to an object.');
 }
开发者ID:nkuitche,项目名称:registry,代码行数:15,代码来源:RegistryTest.php


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