本文整理汇总了PHP中JParameter::setXML方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::setXML方法的具体用法?PHP JParameter::setXML怎么用?PHP JParameter::setXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::setXML方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParams
function getParams($data)
{
// get params definitions
$params = new JParameter($data);
if (WF_JOOMLA15) {
$xml = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox.xml';
$params->loadSetupFile($xml);
return $params->getParams();
} else {
$xml = JPATH_PLUGINS . DS . 'system' . DS . 'jcemediabox' . DS . 'jcemediabox.xml';
$parser = JFactory::getXMLParser('Simple');
if ($parser->loadFile($xml)) {
if ($fieldsets = $parser->document->getElementByPath('config')->getElementByPath('fields')->children()) {
foreach ($fieldsets as $fieldset) {
$params->setXML($fieldset);
}
}
}
$groups = array();
$array = array();
foreach ($params->getGroups() as $group => $num) {
$groups[] = $params->getParams('params', $group);
}
foreach ($groups as $group) {
$array = array_merge($array, $group);
}
return $array;
}
}
示例2: JParameter
function &getParams()
{
// Get the state parameters
$module =& $this->getModule();
$params = new JParameter($module->params);
if ($xml =& $this->_getXML()) {
if ($ps =& $xml->document->params) {
foreach ($ps as $p) {
$params->setXML($p);
}
}
}
return $params;
}
示例3: getSystemParams
function getSystemParams($path)
{
$params = null;
$item = $this->getModulesData();
if (isset($item->params)) {
$params = new JParameter($item->params);
} else {
$params = new JParameter("");
}
if (file_exists($path)) {
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($path)) {
$document =& $xml->document;
$params->setXML($document->getElementByPath('state/params'));
}
}
return $params->render('params');
}
示例4: 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;
}
示例5: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
$parent =& $this->_parent;
$childParameter = new JParameter($parent->_raw);
$paths = $parent->_elementPath;
if (is_array($paths))
foreach ($paths as $path)
$childParameter->addElementPath($path);
$childParameter->setXML($node);
$visible = $node->attributes('visible');
$prefix = $node->attributes('prefix');
$id = 'group_' . $prefix . '_' . $node->attributes('group_id');
return sprintf('<div id="%s" class="el-group" style="display: %s;"><div class="el-group-header"><h4>%s</h4></div><div>%s</div></div>',
$id,
$visible ? 'block' : 'none',
JText::_($node->attributes('label')),
$childParameter->render($control_name));
}
示例6: getPluginParams
function getPluginParams(&$item)
{
JPluginHelper::importPlugin('roknavmenu');
$param_files = array();
$param_sets = array();
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onRokNavMenuRegisterParamsFile', array(&$param_files, $item->id));
reset($param_files);
while (list($key, $value) = each($param_files)) {
$param_file =& $param_files[$key];
$set_params = new JParameter($item->params);
if (file_exists($param_file)) {
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($param_file)) {
$document =& $xml->document;
$set_params->setXML($document->params[0]);
}
}
$param_sets[$key] = $set_params;
}
return $param_sets;
}
示例7: JParameter
function &getSystemParams()
{
// Initialize variables
$params = null;
$item =& $this->getItem();
$params = new JParameter($item->params);
if ($item->type == 'component') {
$path = JPATH_BASE . DS . 'components' . DS . 'com_menus' . DS . 'models' . DS . 'metadata' . DS . 'component.xml';
if (file_exists($path)) {
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($path)) {
$document =& $xml->document;
$params->setXML($document->getElementByPath('state/params'));
}
}
}
return $params;
}
示例8: edit
//.........这里部分代码省略.........
$config = JComponentHelper::getParams('com_advancedmodules');
$config = $parameters->getParams($config->_raw, JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_advancedmodules' . DS . 'config.xml');
$advanced_params = new stdClass();
$xmlfile = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_advancedmodules' . DS . 'assignments.xml';
if (!$cid['0']) {
$lists['assignments'] = new JParameter('', $xmlfile);
// hide if empty
$lists['hideempty'] = JHTML::_('select.booleanlist', 'advancedparams[hideempty]', 'class="inputbox"', 0, 'yes', 'no', 'advancedparamshideempty');
// tooltip
$lists['tooltip'] = '<textarea class="text_area" rows="3" cols="40" name="advancedparams[tooltip]" id="advancedparamstooltip"></textarea>';
} else {
// advanced params
$query = 'SELECT params' . ' FROM #__advancedmodules' . ' WHERE moduleid = ' . (int) $row->id;
$db->setQuery($query);
$advanced_params = $db->loadResult();
if (!$advanced_params || strpos($advanced_params, 'assignto_') === false) {
$advanced_params = $this->updateParams($row->id, $advanced_params);
}
$lists['assignments'] = new JParameter($advanced_params, $xmlfile);
$advanced_params = $parameters->getParams($advanced_params);
// hide if empty
$lists['hideempty'] = JHTML::_('select.booleanlist', 'advancedparams[hideempty]', 'class="inputbox"', isset($advanced_params->hideempty) ? $advanced_params->hideempty : 0, 'yes', 'no', 'advancedparamshideempty');
// tooltip
$lists['tooltip'] = '<textarea class="text_area" rows="3" cols="40" name="advancedparams[tooltip]" id="advancedparamstooltip">' . (isset($advanced_params->tooltip) ? $advanced_params->tooltip : '') . '</textarea>';
if (isset($advanced_params->color)) {
$color = strtoupper(preg_replace('#[^a-z0-9]#si', '', $advanced_params->color));
}
}
require_once JPATH_SITE . DS . 'plugins' . DS . 'system' . DS . 'nonumberelements' . DS . 'elements' . DS . 'colorpicker.php';
$cp = new JElementColorPicker();
$node = new JSimpleXMLElement('');
$lists['color'] = $cp->fetchElement('color', $color, $node, 'advancedparams');
$lists['extra'] = '';
if ($config->show_extra) {
if ($config->extra1) {
$xml = new JSimpleXMLElement('extra', array());
$extraparams = array();
for ($i = 1; $i <= 5; $i++) {
$var = 'extra' . $i;
if ($config->{$var}) {
$a = array();
$a['name'] = $var;
$a['type'] = 'text';
$label = explode('\\|', $config->{$var}, 2);
$a['label'] = $label['0'];
if (isset($label['1'])) {
$a['description'] = $label['1'];
}
$xml->addChild('extra1', $a);
}
if (isset($advanced_params->{$var})) {
$extraparams[] = $var . '=' . $advanced_params->{$var};
}
}
$p = new JParameter(implode("\n", $extraparams));
$p->setXML($xml);
if ($p->getNumParams()) {
$lists['extra'] = $p->render('advancedparams');
}
}
}
}
if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
$lists['access'] = 'Administrator';
$lists['showtitle'] = 'N/A <input type="hidden" name="showtitle" value="1" />';
$lists['selections'] = 'N/A';
} else {
if ($client->id == '1') {
$lists['access'] = 'N/A';
} else {
$lists['access'] = JHTML::_('list.accesslevel', $row);
}
$lists['showtitle'] = JHTML::_('select.booleanlist', 'showtitle', 'class="inputbox"', $row->showtitle);
}
// build the html select list for published
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
$row->description = '';
$lang =& JFactory::getLanguage();
if ($client->id != '1') {
$lang->load(trim($row->module), JPATH_SITE);
} else {
$lang->load(trim($row->module));
}
// xml file for module
if ($row->module == 'custom') {
$xmlfile = JApplicationHelper::getPath($path, 'mod_custom');
} else {
$xmlfile = JApplicationHelper::getPath($path, $row->module);
}
$data = JApplicationHelper::parseXMLInstallFile($xmlfile);
if ($data) {
foreach ($data as $key => $value) {
$row->{$key} = $value;
}
}
// get params definitions
$params = new JParameter($row->params, $xmlfile, 'module');
require_once JApplicationHelper::getPath('admin_html');
HTML_modules::edit($model, $row, $orders2, $lists, $params, $client);
}
示例9: getXMLParams
private function getXMLParams()
{
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'models' . DS . 'item.php';
$item = MenusModelItem::getItem();
$xml_params = new JParameter($item->params);
$path = JPATH_SITE . DS . 'plugins' . DS . 'system' . DS . 'addkeywords' . DS . 'metadata.xml';
if (file_exists($path)) {
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($path)) {
$xml_document =& $xml->document;
$xml_params->setXML($xml_document->getElementByPath('state/params'));
}
}
return $xml_params;
}
示例10: _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;
}
示例11: getSystemParams
function getSystemParams($xmlstring)
{
// Initialize variables
$params = null;
$item = $this->getDatabaseValue();
if (isset($item->params)) {
$params = new JParameter($item->params);
//update value to make it compatible with old parameter
if (!$params->get('mega_subcontent_mod_modules', '') && $params->get('mega_subcontent-mod-modules')) {
$params->set('mega_subcontent_mod_modules', $params->get('mega_subcontent-mod-modules'));
}
if (!$params->get('mega_subcontent_pos_positions', '') && $params->get('mega_subcontent-pos-positions')) {
$params->set('mega_subcontent_pos_positions', $params->get('mega_subcontent-pos-positions'));
}
} else {
$params = new JParameter("");
}
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadString($xmlstring)) {
$document =& $xml->document;
$params->setXML($document->getElementByPath('state/params'));
}
return $params->render('params');
}