本文整理汇总了PHP中JParameter::toObject方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::toObject方法的具体用法?PHP JParameter::toObject怎么用?PHP JParameter::toObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::toObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get()
{
require_once JPATH_ADMINISTRATOR . '/components/com_k2/models/item.php';
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_k2/tables');
$model = JModel::getInstance('item', 'K2Model');
$item = (object) $model->getData()->getProperties();
if (JRequest::getVar('formready', 1)) {
jimport('joomla.html.parameter');
$meta = new JParameter($item->metadata);
$item->metadata = $meta->toObject();
$item->params = json_decode($item->params);
$item->tags = $model->getCurrentTags($item->id);
}
$this->plugin->setResponse($item);
}
示例2: toObject
/**
* Legacy function, use {@link JParameter::toObject() JParameter->toObject()} instead
*
* @deprecated As of version 1.5
*/
function toObject()
{
parent::toObject();
}
示例3: getParams
/**
* Internal function to get the component settings
*
* @return an object with global settings
* @since 0.5.7
* @throws Exception
*/
public function getParams()
{
// Getting the categories id's
$query = "SELECT params\n\t\t\t\t\t\t\tFROM jos_components AS c\n\t\t\t\t\t\t\tWHERE c.option = 'com_jupgrade'";
$this->db_old->setQuery($query);
$params = $this->db_old->loadResult();
// Check for query error.
$error = $this->db_old->getErrorMsg();
if ($error) {
throw new Exception($error);
return false;
}
$temp = new JParameter($params);
$object = $temp->toObject();
return $object;
}
示例4: loadMenu
function loadMenu()
{
$user =& JFactory::getUser();
$children = array();
$aid = $user->get('aid', 0);
// Get Menu Items
$menu =& JSite::getMenu();
$rows = $menu->getItems('menutype', $this->getParam('menutype'));
if (!count($rows)) {
$this->setParam('menutype', 'mainmenu');
$rows = $menu->getItems('menutype', 'mainmenu');
}
// search the active tree
$open = array();
$active = $menu->getActive();
if (isset($active)) {
if ($active->menutype != $this->getParam('menutype')) {
//detect the active in this menu: point to same link or is alias
foreach ($rows as $index => $v) {
if ($v->link == $active->link || $v->type == 'menulink' && !empty($v->query['Itemid'])) {
$open = array_reverse($v->tree);
break;
}
}
} else {
$open = array_reverse($active->tree);
}
}
$this->open = $open;
if (!count($rows)) {
return;
}
// first pass - collect children
$cacheIndex = array();
$this->items = array();
foreach ($rows as $index => $v) {
if (isset($v->title)) {
$v->name = $v->title;
}
$v->name = str_replace('&', '&', str_replace('&', '&', $v->name));
if ($v->access <= $aid) {
$pt = $v->parent;
$list = @$children[$pt] ? $children[$pt] : array();
$v->megaparams = $this->parseTitle($v->name);
$v->megaparams->set('class', str_replace(',', ' ', $v->megaparams->get('class', '')));
$v->name = trim($v->megaparams->get('title'));
//Load params added by plugin
$vparams = new JParameter($v->params);
//get mega params
$megaparams = $vparams->toObject();
if ($megaparams) {
foreach (get_object_vars($megaparams) as $mega_name => $mega_value) {
if (preg_match('/mega_(.+)/', $mega_name, $matches)) {
if ($matches[1] == 'colxw') {
if (preg_match_all('/([^\\s]+)=([^\\s]+)/', $mega_value, $colwmatches)) {
for ($i = 0; $i < count($colwmatches[0]); $i++) {
$v->megaparams->set($colwmatches[1][$i], $colwmatches[2][$i]);
}
}
} else {
if (is_array($mega_value)) {
$mega_value = implode(',', $mega_value);
}
$v->megaparams->set($matches[1], $mega_value);
}
}
}
}
//reset cols for group item
//if ($v->megaparams->get('group')) $v->megaparams->set('cols', 1);
if ($this->getParam('megamenu')) {
$modules = $this->loadModules($v->megaparams);
//Update title: clear title if not show - Not clear title => causing none title when showing menu in other module
//if (!$v->megaparams->get ('showtitle', 1)) $v->name = '';
if ($modules && count($modules) > 0) {
$v->content = "";
$total = count($modules);
$cols = min($v->megaparams->get('cols'), $total);
for ($col = 0; $col < $cols; $col++) {
$pos = $col == 0 ? 'first' : ($col == $cols - 1 ? 'last' : '');
if ($cols > 1) {
$v->content .= $this->beginSubMenuModules($v->id, 1, $pos, $col, true);
}
$i = $col;
while ($i < $total) {
$mod = $modules[$i];
if (!isset($mod->name)) {
$mod->name = $mod->module;
}
$i += $cols;
$mod_params = new JParameter($mod->params);
//$v->content .= JModuleHelper::renderModule($mod, array('style'=>$v->megaparams->get('style','jaxhtml')));
$v->content .= "<jdoc:include type=\"module\" name=\"{$mod->name}\" title=\"{$mod->title}\" style=\"" . $v->megaparams->get('style', 'jaxhtml') . "\" />";
}
if ($cols > 1) {
$v->content .= $this->endSubMenuModules($v->id, 1, true);
}
}
$v->cols = $cols;
$v->content = trim($v->content);
//.........这里部分代码省略.........
示例5: toObject
/**
* Convert JSON data to JParameter Object
* @param $data JSON data
*/
public static function toObject($data)
{
$param = new JParameter('');
$param->bind($data);
return $param->toObject();
}
示例6: loadMenu
function loadMenu()
{
$user =& JFactory::getUser();
$children = array();
$aid = $user->get('aid', 0);
// Get Menu Items
$items =& JSite::getMenu();
$rows = $items->getItems('menutype', $this->getParam('menutype'));
if (!count($rows)) {
$rows = $items->getItems('menutype', 'mainmenu');
}
if (!count($rows)) {
return;
}
// first pass - collect children
$cacheIndex = array();
$this->items = array();
foreach ($rows as $index => $v) {
$v->name = str_replace('&', '&', str_replace('&', '&', $v->name));
if ($v->access <= $aid) {
$pt = $v->parent;
$list = @$children[$pt] ? $children[$pt] : array();
$v->megaparams = $this->parseTitle($v->name);
$v->megaparams->set('class', str_replace(',', ' ', $v->megaparams->get('class', '')));
$v->name = trim($v->megaparams->get('title'));
//Load params added by plugin
$vparams = new JParameter($v->params);
//get mega params
$megaparams = $vparams->toObject();
if ($megaparams) {
foreach (get_object_vars($megaparams) as $mega_name => $mega_value) {
if (preg_match('/mega_(.+)/', $mega_name, $matches)) {
if ($matches[1] == 'colxw') {
if (preg_match_all('/([^\\s]+)=([^\\s]+)/', $mega_value, $colwmatches)) {
for ($i = 0; $i < count($colwmatches[0]); $i++) {
$v->megaparams->set($colwmatches[1][$i], $colwmatches[2][$i]);
}
}
} else {
if (is_array($mega_value)) {
$mega_value = implode(',', $mega_value);
}
$v->megaparams->set($matches[1], $mega_value);
}
}
}
}
//reset cols for group item
if ($v->megaparams->get('group')) {
$v->megaparams->set('cols', 1);
}
if ($this->getParam('megamenu')) {
$modules = $this->loadModules($v->megaparams);
//Update title: clear title if not show
if (!$v->megaparams->get('showtitle', 1)) {
$v->name = '';
}
//if ($v->name == 'FAQ') {print_r ($v->megaparams);exit;}
if ($modules && count($modules) > 0) {
$v->content = "";
$total = count($modules);
$cols = min($v->megaparams->get('cols'), $total);
for ($col = 0; $col < $cols; $col++) {
$pos = $col == 0 ? 'first' : ($col == $cols - 1 ? 'last' : '');
if ($cols > 1) {
$v->content .= $this->beginSubMenuModules($v->id, 1, $pos, $col, true);
}
$i = $col;
while ($i < $total) {
$mod = $modules[$i];
$i += $cols;
$mod_params = new JParameter($mod->params);
$v->content .= JModuleHelper::renderModule($mod, array('style' => $v->megaparams->get('style', 'xhtml')));
}
if ($cols > 1) {
$v->content .= $this->endSubMenuModules($v->id, 1, true);
}
}
$v->cols = $cols;
$v->content = trim($v->content);
$this->items[$v->id] = $v;
}
}
switch ($v->type) {
case 'separator':
$v->url = '#';
break;
case 'url':
if (strpos($v->link, 'index.php?') !== false && strpos($v->link, 'Itemid=') === false) {
$v->url = $v->link . '&Itemid=' . $v->id;
} else {
$v->url = $v->link;
}
break;
default:
$router = JSite::getRouter();
$v->url = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid=' . $v->id : $v->link . '&Itemid=' . $v->id;
break;
}
// Handle SSL links
//.........这里部分代码省略.........