本文整理汇总了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;
}
示例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__ . '.');
}
示例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.');
}