本文整理汇总了PHP中Joomla\Registry\Registry::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::toArray方法的具体用法?PHP Registry::toArray怎么用?PHP Registry::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joomla\Registry\Registry
的用法示例。
在下文中一共展示了Registry::toArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute()
{
$this->state->set('plugins', $this->state->get('plugins', false));
$app = new Sp4kAppsProductApp(new Joomla\Registry\Registry($this->state->toObject()));
$items = new Registry($app->getItems());
if ($this->state->get('nest', false)) {
$this->items[] = (array) $this->create_tree($items->toArray());
} else {
$this->items = $items->toArray();
}
}
示例2: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->interventions)) {
// JSON Decode interventions.
$item->interventions = json_decode($item->interventions);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_costbenefitprojection.intervention');
}
}
return $item;
}
示例3: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->template)) {
// base64 Decode template.
$item->template = base64_decode($item->template);
}
if (!empty($item->php_view)) {
// base64 Decode php_view.
$item->php_view = base64_decode($item->php_view);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_componentbuilder.template');
}
}
return $item;
}
示例4: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->groups)) {
// JSON Decode groups.
$item->groups = json_decode($item->groups, true);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_componentbuilder.help_document');
}
}
return $item;
}
示例5: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->testcompanies)) {
// JSON Decode testcompanies.
$item->testcompanies = json_decode($item->testcompanies);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_costbenefitprojection.service_provider');
}
}
$this->service_providervvvx = $item->id;
return $item;
}
示例6: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->causesrisks)) {
// JSON Decode causesrisks.
$item->causesrisks = json_decode($item->causesrisks);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_costbenefitprojection.country');
}
}
$this->countryvvvy = $item->id;
$this->countryvvvz = $item->id;
$this->countryvvwa = $item->id;
return $item;
}
示例7: prepareExecute
/**
* prepareExecute
*
* @return void
*/
protected function prepareExecute()
{
parent::prepareExecute();
$this->app->setUserState("com_userxtd.edit.field.data", $this->input->getVar('jform'));
$attrs = $this->app->getUserState("com_userxtd.edit.field.attrs", array());
$postAttrs = $this->input->getVar('attrs', array());
$attrs = new Registry($attrs);
$attrs->loadArray($postAttrs);
$this->app->setUserState("com_userxtd.edit.field.attrs", $attrs->toArray());
}
示例8: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->php_after_getitem)) {
// base64 Decode php_after_getitem.
$item->php_after_getitem = base64_decode($item->php_after_getitem);
}
if (!empty($item->php_before_getitems)) {
// base64 Decode php_before_getitems.
$item->php_before_getitems = base64_decode($item->php_before_getitems);
}
if (!empty($item->php_before_getitem)) {
// base64 Decode php_before_getitem.
$item->php_before_getitem = base64_decode($item->php_before_getitem);
}
if (!empty($item->php_getlistquery)) {
// base64 Decode php_getlistquery.
$item->php_getlistquery = base64_decode($item->php_getlistquery);
}
if (!empty($item->php_after_getitems)) {
// base64 Decode php_after_getitems.
$item->php_after_getitems = base64_decode($item->php_after_getitems);
}
if (!empty($item->php_calculation)) {
// base64 Decode php_calculation.
$item->php_calculation = base64_decode($item->php_calculation);
}
if (!empty($item->php_custom_get)) {
// base64 Decode php_custom_get.
$item->php_custom_get = base64_decode($item->php_custom_get);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_componentbuilder.dynamic_get');
}
}
return $item;
}
示例9: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
// Convert the images field to an array.
$registry = new Registry();
$registry->loadString($item->images);
$item->images = $registry->toArray();
//Convert the sensors field to an array
$registry = new Registry();
$registry->loadString($item->sensors);
$item->sensors = $registry->toArray();
}
return $item;
}
示例10: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->xml)) {
// JSON Decode xml.
$item->xml = json_decode($item->xml);
}
if (!empty($item->css_view)) {
// base64 Decode css_view.
$item->css_view = base64_decode($item->css_view);
}
if (!empty($item->css_views)) {
// base64 Decode css_views.
$item->css_views = base64_decode($item->css_views);
}
if (!empty($item->javascript_view_footer)) {
// base64 Decode javascript_view_footer.
$item->javascript_view_footer = base64_decode($item->javascript_view_footer);
}
if (!empty($item->javascript_views_footer)) {
// base64 Decode javascript_views_footer.
$item->javascript_views_footer = base64_decode($item->javascript_views_footer);
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_componentbuilder.field');
}
}
return $item;
}
示例11: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
if (!empty($item->params)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata)) {
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_demo.look');
}
}
return $item;
}
示例12: getItem
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk)) {
// Convert the params field to an array.
$registry = new Registry();
$registry->loadString($item->attribs);
$item->attribs = $registry->toArray();
// Convert the metadata field to an array.
$registry = new Registry();
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
// Convert the images field to an array.
$registry = new Registry();
$registry->loadString($item->images);
$item->images = $registry->toArray();
// Convert the urls field to an array.
$registry = new Registry();
$registry->loadString($item->urls);
$item->urls = $registry->toArray();
$item->articletext = trim($item->fulltext) != '' ? $item->introtext . "<hr id=\"system-readmore\" />" . $item->fulltext : $item->introtext;
if (!empty($item->id)) {
$item->tags = new JHelperTags();
$item->tags->getTagIds($item->id, 'com_content.article');
}
}
// Load associated content items
$app = JFactory::getApplication();
$assoc = JLanguageAssociations::isEnabled();
if ($assoc) {
$item->associations = array();
if ($item->id != null) {
$associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $item->id);
foreach ($associations as $tag => $association) {
$item->associations[$tag] = $association->id;
}
}
}
return $item;
}
示例13: merge
/**
* Merge a Registry object into this one
*
* @param Registry $source Source Registry object to merge.
* @param boolean $recursive True to support recursive merge the children values.
*
* @return Registry Return this object to support chaining.
*
* @since 1.0
*/
public function merge($source, $recursive = false)
{
if (!$source instanceof Registry) {
return false;
}
$this->bindData($this->data, $source->toArray(), $recursive, false);
return $this;
}
示例14: getData
/**
* Method to get the profile form data.
*
* The base form data is loaded and then an event is fired
* for users plugins to extend the data.
*
* @return mixed Data object on success, false on failure.
*
* @since 1.6
*/
public function getData()
{
if ($this->data === null) {
$userId = $this->getState('user.id');
// Initialise the table with JUser.
$this->data = new JUser($userId);
// Set the base user data.
$this->data->email1 = $this->data->get('email');
$this->data->email2 = $this->data->get('email');
// Override the base user data with any data in the session.
$temp = (array) JFactory::getApplication()->getUserState('com_users.edit.profile.data', array());
foreach ($temp as $k => $v) {
$this->data->{$k} = $v;
}
// Unset the passwords.
unset($this->data->password1);
unset($this->data->password2);
$registry = new Registry($this->data->params);
$this->data->params = $registry->toArray();
// Get the dispatcher and load the users plugins.
$dispatcher = JEventDispatcher::getInstance();
JPluginHelper::importPlugin('user');
// Trigger the data preparation event.
$results = $dispatcher->trigger('onContentPrepareData', array('com_users.profile', $this->data));
// Check for errors encountered while preparing the data.
if (count($results) && in_array(false, $results, true)) {
$this->setError($dispatcher->getError());
$this->data = false;
}
}
return $this->data;
}
示例15: getItems
/**
* Method to get a list of teamids.
*
* Overriden to inject convert the params fields into an object.
*
* @return mixed An array of objects on success, false on failure.
*
*/
public function getItems()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
$user_id = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();
// Get the global params
$global_params = JComponentHelper::getParams('com_knvbapi2', true);
if ($items = parent::getItems()) {
// Convert the parameter fields into objects.
foreach ($items as &$item) {
$query->clear();
$teamid_params = new Registry();
$teamid_params->loadString($item->params);
// Convert the images field to an array.
$registry = new Registry();
$registry->loadString($item->images);
$item->images = $registry->toArray();
$registry = null;
//release memory
// Convert the urls field to an array.
$registry = new Registry();
$registry->loadString($item->urls);
$item->urls = $registry->toArray();
$registry = null;
//release memory
$item->introdescription = trim($item->intro) != '' ? $item->intro . $item->description : $item->description;
// Unpack readmore and layout params
$item->teamid_alternative_readmore = $teamid_params->get('teamid_alternative_readmore');
$item->layout = $teamid_params->get('layout');
if (!is_object($this->getState('params'))) {
$item->params = $teamid_params;
} else {
$item->params = clone $this->getState('params');
// Teamid params override menu item params only if menu param = 'use_teamid'
// Otherwise, menu item params control the layout
// If menu item is 'use_teamid' and there is no teamid param, use global
// create an array of just the params set to 'use_teamid'
$menu_params_array = $this->getState('params')->toArray();
$teamid_array = array();
foreach ($menu_params_array as $key => $value) {
if ($value === 'use_teamid') {
// if the teamid has a value, use it
if ($teamid_params->get($key) != '') {
// get the value from the teamid
$teamid_array[$key] = $teamid_params->get($key);
} else {
// otherwise, use the global value
$teamid_array[$key] = $global_params->get($key);
}
}
}
// merge the selected teamid params
if (count($teamid_array) > 0) {
$teamid_params = new Registry();
$teamid_params->loadArray($teamid_array);
$item->params->merge($teamid_params);
}
// get display date
switch ($item->params->get('list_show_teamid_date')) {
case 'modified':
$item->display_date = $item->modified;
break;
case 'publish_up':
$item->display_date = $item->publish_up;
if ($item->publish_up == 0) {
$item->display_date = $item->created;
}
break;
case 'created':
$item->display_date = $item->created;
break;
default:
$item->display_date = 0;
break;
}
}
// Compute the asset access permissions.
// Technically guest could edit an teamid, but lets not check that to improve performance a little.
if (!$guest) {
$asset = 'com_knvbapi2.teamid.' . $item->id;
// Check general edit permission first.
if ($user->authorise('core.edit', $asset)) {
$item->params->set('access-edit', true);
} else {
if (!empty($user_id) and $user->authorise('core.edit.own', $asset)) {
// Check for a valid user and that they are the owner.
if ($user_id == $item->created_by) {
$item->params->set('access-edit', true);
}
//.........这里部分代码省略.........