本文整理汇总了PHP中JParameter::getNumParams方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::getNumParams方法的具体用法?PHP JParameter::getNumParams怎么用?PHP JParameter::getNumParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JParameter
的用法示例。
在下文中一共展示了JParameter::getNumParams方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
}
if (JFolder::exists($path . DS . 'extensions')) {
$db =& JFactory::getDBO();
$query = 'SELECT *' . ' FROM #__jce_extensions' . ' WHERE published = 1' . ' AND pid = ' . (int) $plugin->id;
$db->setQuery($query);
$extensions = $db->loadObjectList();
foreach ($extensions as $extension) {
// Load extension xml file
$file = $path . DS . 'extensions' . DS . $extension->folder . DS . $extension->extension . '.xml';
// Load extension language file
$lang =& JFactory::getLanguage();
$lang->load('com_jce_' . trim($name) . '_' . trim($extension->extension), JPATH_SITE);
if (JFile::exists($file)) {
$params = new JParameter($this->group->params, $file);
if ($params->getNumParams()) {
if ($output = $params->render('params')) {
echo $pane->startPanel(JText::_($extension->name), $extension->extension . "-extension-page");
echo $output;
echo $pane->endPanel();
}
}
}
}
}
echo $pane->endPane();
?>
</fieldset>
</div>
<?php
} else {
示例2: testGetNumParams
/**
* Test the JParameter::getNumParams() method.
*
* @return void
*
* @since 11.1
*/
public function testGetNumParams()
{
$p = new JParameter('{"foo":"bar"}', __DIR__ . '/jparameter.xml');
$this->assertThat($p->getNumParams('unknown'), $this->isFalse());
$this->assertThat($p->getNumParams('basic'), $this->equalTo(1));
$this->assertThat($p->getNumParams('advanced'), $this->equalTo(2));
}
示例3: 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);
}
示例4: ajaxShowSettings
/**
* Ajax method to display the application settings
*
* @params $id Int Application id.
* @params $appName String Application element
**/
public function ajaxShowSettings($id, $appName)
{
// Check permissions
$my =& JFactory::getUser();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
$objResponse = new JAXResponse();
$appsModel = CFactory::getModel('apps');
$lang =& JFactory::getLanguage();
$lang->load('plg_' . JString::strtolower($appName), JPATH_ROOT . DS . 'administrator');
$xmlPath = JPATH_PLUGINS . DS . 'community' . DS . $appName . DS . 'config.xml';
jimport('joomla.filesystem.file');
if (JFile::exists($xmlPath)) {
$paramStr = $appsModel->getUserAppParams($id);
$params = new JParameter($paramStr, $xmlPath);
$paramData = isset($params->_xml['_default']->param) ? $params->_xml['_default']->param : array();
$html = '<form method="POST" action="" name="appSetting" id="appSetting">';
$html .= $params->render();
$html .= '<input type="hidden" value="' . $id . '" name="appid"/>';
$html .= '<input type="hidden" value="' . $appName . '" name="appname"/>';
$html .= '</form>';
$objResponse->addAssign('cWindowContent', 'innerHTML', $html);
if (!empty($paramData)) {
$objResponse->addScriptCall('cWindowActions', '<input onclick="joms.apps.saveSettings()" type="submit" value="' . JText::_('CC APPLICATION BTN SAVE') . '" class="button" name="Submit"/>');
}
$parser =& JFactory::getXMLParser('Simple');
$parser->loadFile($xmlPath);
$document =& $parser->document;
$element =& $document->getElementByPath('height');
$height = !empty($element) ? $element->data() : 0;
if ($height) {
$windowHeight = $height;
} else {
$windowHeight = 100 + $params->getNumParams() * 30;
$windowHeight = $windowHeight >= 300 ? 300 : $windowHeight;
}
} else {
$objResponse->addAssign('cWindowContent', 'innerHTML', '<div class-"ajax-notice-apps-configure">' . JText::_('CC APPLICATION AJAX NO CONFIG') . '</div>');
$windowHeight = 100;
}
$objResponse->addScriptCall('cWindowResize', $windowHeight);
$objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('CC APPLICATION SETTINGS TITLE'));
return $objResponse->sendResponse();
}