本文整理汇总了PHP中JParameter::loadArray方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::loadArray方法的具体用法?PHP JParameter::loadArray怎么用?PHP JParameter::loadArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::loadArray方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$model = $this->getModel();
$module = $model->getRow();
if ($this->getLayout() == 'modal') {
$this->menus = $this->getObject('com:pages.model.menus')->sort('title')->getRowset();
$this->pages = $this->getObject('com:pages.model.pages')->application('site')->getRowset();
$this->modules = $this->getObject('com:pages.model.modules')->application('site')->getRowset();
}
if ($this->getModel()->getState()->isUnique()) {
if ($module->isNew()) {
$module->application = $model->application;
$module->name = $model->name;
}
$path = Library\ClassLoader::getInstance()->getApplication($module->application);
JFactory::getLanguage()->load(substr($module->extension_name, 4), $module->name, $path);
}
// Build path to module config file
$path = Library\ClassLoader::getInstance()->getApplication('site');
$path .= '/component/' . substr($module->extension_name, 4) . '/module/' . substr($module->name, 4) . '/config.xml';
$params = new \JParameter(null, $path);
$params->loadArray($module->params->toArray());
$this->params = $params;
return parent::render();
}
示例2: _actionSave
/**
* Saves a configuration
*
* @param KCommandContext $context
*
* @return
*/
protected function _actionSave(KCommandContext $context)
{
$context->append(array('data' => array('params' => array())));
//find or create a new component
$component = $this->getService('repos://admin/components.component')->findOrAddNew(array('option' => 'com_' . $this->getIdentifier()->package), array('data' => array('name' => ucfirst($this->getIdentifier()->package))));
$params = new JParameter('');
$params->loadArray((array) $context->data['params']);
$component->params = $params->toString();
$component->save();
}
示例3: getParameters
/**
* Renders a form using an xml path
*
* @param array $config
* @return void
*/
public function getParameters($config = array())
{
$config = new KConfig($config);
$config->append(array('data' => array(), 'element_paths' => array(dirname(__FILE__) . '/forms')));
$content = file_exists($config->path) ? file_get_contents($config->path) : '';
$paths = array();
//replace all the addpath="{KServiceIdentifier}" with real path
if (preg_match_all('/addpath="([^"]+)"/', $content, $paths)) {
$replaces = array();
foreach ($paths[1] as $path) {
if (strpos($path, '.')) {
$replaces[] = str_replace(JPATH_ROOT . '/', '', dirname(KLoader::path($path . '.dummy')));
} else {
$replaces[] = $path;
}
}
$content = str_replace($paths[1], $replaces, $content);
}
$xml =& JFactory::getXMLParser('Simple');
$parameter = new JParameter('');
$data = KConfig::unbox($config->data);
if ($data instanceof JParameter) {
$data = $data->toArray();
}
if (is_array($data)) {
$parameter->loadArray($data);
} else {
$parameter->loadINI($data);
}
$parameter->template_data = $config->template_data;
foreach ($config->element_paths as $path) {
$parameter->addElementPath($path);
}
if ($xml->loadString($content)) {
if ($params =& $xml->document->params) {
foreach ($params as $param) {
$parameter->setXML($param);
}
}
}
return $parameter;
}
示例4: array
/**
* Load the editor
*
* @param array Associative array of editor config paramaters
* @since 1.5
*/
function _loadEditor($config = array())
{
//check if editor is already loaded
if (!is_null($this->_editor)) {
return;
}
jimport('joomla.filesystem.file');
// Build the path to the needed editor plugin
$name = JFilterInput::clean($this->_name, 'cmd');
//$path = JPATH_SITE.DS.'plugins'.DS.'editors'.DS.$name.'.php';
//$$$rob - redirect to our own editor classes!
$path = JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'helpers' . DS . 'editors' . DS . $name . '.php';
if (!JFile::exists($path)) {
$path = JPATH_SITE . DS . 'plugins' . DS . 'editors' . DS . $name . '.php';
}
if (!JFile::exists($path)) {
$path = JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'helpers' . DS . 'editors' . DS . 'tinymce' . '.php';
}
// Require plugin file
require_once $path;
// Get the plugin
$plugin =& JPluginHelper::getPlugin('editors', $this->_name);
$params = new JParameter($plugin->params);
$params->loadArray($config);
$plugin->params = $params;
// Build editor plugin classname
$name = 'FplgEditor' . $this->_name;
if (!class_exists($name)) {
$name = 'plgEditor' . $this->_name;
}
if ($this->_editor = new $name($this, (array) $plugin)) {
// load plugin parameters
$this->initialise();
JPluginHelper::importPlugin('editors-xtd');
}
}
示例5: JParameter
function &getUrlParams()
{
// Get the state parameters
$item =& $this->getItem();
$params = new JParameter('');
if ($state =& $this->_getStateXML()) {
if (is_a($state, 'JSimpleXMLElement')) {
$sp =& $state->getElementByPath('url');
$params->setXML($sp);
if (isset($item->linkparts) && is_array($item->linkparts)) {
$params->loadArray($item->linkparts);
}
}
}
return $params;
}
示例6: array
/**
* Load the editor
*
* @access private
* @param array Associative array of editor config paramaters
* @since 1.5
*/
function _loadEditor($config = array())
{
//check if editor is already loaded
if (!is_null($this->_editor)) {
return;
}
jimport('joomla.filesystem.file');
// Build the path to the needed editor plugin
$name = JFilterInput::clean($this->_name, 'cmd');
$path = JPATH_SITE . DS . 'plugins' . DS . 'editors' . DS . $name . '.php';
if (!JFile::exists($path)) {
$message = JText::_('Cannot load the editor');
JError::raiseWarning(500, $message);
return false;
}
// Require plugin file
require_once $path;
// Get the plugin
$plugin =& JPluginHelper::getPlugin('editors', $this->_name);
$params = new JParameter($plugin->params);
$params->loadArray($config);
$plugin->params = $params;
// Build editor plugin classname
$name = 'plgEditor' . $this->_name;
if ($this->_editor = new $name($this, (array) $plugin)) {
// load plugin parameters
$this->initialise();
JPluginHelper::importPlugin('editors-xtd');
}
}
示例7: _getLayoutParams
protected function _getLayoutParams()
{
$state = $this->_getPageXml()->document->getElementByPath('state');
$params = new \JParameter(null);
if ($state instanceof \JSimpleXMLElement) {
$params->setXML($state->getElementByPath('params'));
if ($this->link_url) {
$params->loadArray($this->getLink()->query);
}
}
return $params;
}
示例8: bind
/**
* Overloaded bind function
*
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = array())
{
if (!isset($array['params'])) {
$parameter = new JParameter();
$params = array();
// custom group
if (isset($array['custom']) && is_array($array['custom'])) {
$params['custom'] = $array['custom'];
}
if (isset($array['alt']) && is_array($array['alt'])) {
$params['alt'] = $array['alt'];
}
if (isset($array['flash']) && is_array($array['flash'])) {
$params['flash'] = $array['flash'];
}
if (isset($array['image']) && is_array($array['image'])) {
$params['image'] = $array['image'];
}
// encode params to JSON
$parameter->loadArray($params);
$array['params'] = $parameter->toString();
}
return parent::bind($array, $ignore);
}
示例9: store
function store()
{
$row =& $this->getTable();
$post = JRequest::get('post');
// Bind the form fields to the table
if (!$row->bind($post)) {
JError::raiseError(500, $row->getError());
}
// Save params
$params = JRequest::getVar('params', array(), 'post', 'array');
if (is_array($params)) {
$p = new JParameter('');
$p->loadArray($params);
$row->params = $p->toString();
// Set the title
if (isset($params['customMenuTitle'])) {
$row->title = $params['customMenuTitle'];
}
}
// Save subdomains
$option = JRequest::getString('option', null, 'post');
if (strlen($params['subdomain'])) {
$query = "INSERT INTO #__sef_subdomains";
$query .= " SET subdomain=" . $this->_db->quote($params["subdomain"]) . ", `option`=" . $this->_db->quote($option) . ", Itemid_titlepage=" . $this->_db->quote($params["home_subdomain"]);
$query .= " ON DUPLICATE KEY UPDATE `option`=" . $this->_db->quote($option) . ", Itemid_titlepage=" . $this->_db->quote($params["home_subdomain"]);
} else {
$query = "DELETE FROM #__sef_subdomains";
$query .= " WHERE `option`=" . $this->_db->quote($option);
}
$this->_db->setQuery($query);
if (!$this->_db->query()) {
JError::raiseError(500, $this->_db->stderr(true));
}
// Make sure the record is valid
if (!$row->check()) {
JError::raiseError(500, $row->getError());
}
// Store the table to the database
if (!$row->store()) {
JError::raiseError(500, $row->getError());
}
// Update default texts
if (isset($post['defaulttexts']) && is_array($post['defaulttexts'])) {
$db =& JFactory::getDBO();
foreach ($post['defaulttexts'] as $id => $text) {
$query = "UPDATE `#__sefexttexts` SET `value` = " . $db->Quote($text) . " WHERE `id` = '" . intval($id) . "' LIMIT 1";
$db->setQuery($query);
if (!$db->query()) {
JError::raiseError(500, $db->getErrorMsg());
}
}
}
return true;
}
示例10: die
* @category Nooku
* @package Nooku_Server
* @subpackage Settings
* @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net).
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.nooku.org
*/
defined('KOOWA') or die('Restricted access');
?>
<?php
echo @helper('tabs.startPanel', array('id' => $settings->getName(), 'title' => @text(ucfirst($settings->getName()))));
?>
<h2><?php
echo @text(ucfirst($settings->getName()));
?>
</h2>
<section>
<h3><?php
echo @text(ucfirst($settings->getName()));
?>
</h3>
<?
$params = new JParameter( null, $settings->getPath() );
$params->loadArray($settings->toArray());
echo $params->render('settings['.$settings->getName().']');
?>
</section>
<?php
echo @helper('tabs.endPanel');
示例11: convertArgsToParams
protected function convertArgsToParams() {
$params = new JParameter("");
$params->loadArray($this->args);
return $params;
}