當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。