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(); }
/** * 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(); }
/** * 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; }
/** * 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'); } }
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; }
/** * 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'); } }
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; }
/** * 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); }
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; }
* @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');
protected function convertArgsToParams() { $params = new JParameter(""); $params->loadArray($this->args); return $params; }