本文整理汇总了PHP中Sh404sefHelperGeneral::getComponentParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefHelperGeneral::getComponentParams方法的具体用法?PHP Sh404sefHelperGeneral::getComponentParams怎么用?PHP Sh404sefHelperGeneral::getComponentParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sh404sefHelperGeneral
的用法示例。
在下文中一共展示了Sh404sefHelperGeneral::getComponentParams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveqcontrol
/**
* Saves data from the quickStart pane on main dashboard
*/
public function saveqcontrol()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
try {
// get current settings for sh404SEF
$params = Sh404sefHelperGeneral::getComponentParams($forceRead = true);
// set params from the form
$params->set('Enabled', JRequest::getInt('Enabled', 0));
$params->set('canReadRemoteConfig', JRequest::getInt('canReadRemoteConfig', 0));
$params->set('shRewriteMode', JRequest::getInt('shRewriteMode', 1));
$params->set('shSecEnableSecurity', JRequest::getInt('shSecEnableSecurity', 1));
// convert to json and store into db
$textParams = $params->toString();
ShlDbHelper::update('#__extensions', array('params' => $textParams), array('element' => 'com_sh404sef', 'type' => 'component'));
JFactory::getApplication()->enqueueMessage(JText::_('COM_SH404SEF_ELEMENT_SAVED'));
} catch (Exception $e) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_SH404SEF_ELEMENT_NOT_SAVED'), 'error');
}
parent::display();
}
示例2: __construct
/**
* Constructor of the configuration object
* Tries to read config from #__extensions table params.
* If found, builds an object that matches the object format used previously
* (pre- 3.8) so as to maintain b/c compat.
* If not found, search for a configuration file on disk,
* from pre-3.8 versions of sh404SEF
* If found, transfers data in new object and save to #__extensions table
*
* @param boolean $reset if true, params are read again from db
*/
public function __construct($reset = false)
{
$app = JFactory::getApplication();
// try to read from params column of com_sh404sef record in #__extensions table
$values = Sh404sefHelperGeneral::getComponentParams($reset)->toArray();
// if values found, read them and build an object identical to the one
// we would have obtained from reading a config file, pre-3.8 version
if (!empty($values)) {
//options names for components
$com_options = array('manageURL', 'translateURL', 'insertIsoCode', 'shDoNotOverrideOwnSef', 'compEnablePageId', 'defaultComponentString');
//if we have values that mean we have a json object and we can clear the values for the arrays that contain parameters related to components
$this->nocache = array();
$this->skip = array();
$this->useJoomlaRouter = array();
$this->notTranslateURLList = array();
$this->notInsertIsoCodeList = array();
$this->shDoNotOverrideOwnSef = array();
$this->useJoomsefRouter = array();
$this->useAcesefRouter = array();
$this->compEnablePageId = array();
$this->shLangTranslateList = array();
$this->shLangInsertCodeList = array();
$this->defaultComponentStringList = array();
foreach ($values as $key => $value) {
if (property_exists(__CLASS__, $key)) {
$this->{$key} = $value;
} elseif (substr_count($key, "___") && substr_count($key, "com_")) {
$key_arr = explode("___", $key);
$com_str = $key_arr[0];
$field = $key_arr[1];
$com_name = substr($com_str, 4);
switch ($field) {
case 'manageURL':
switch ($value) {
case 1:
$this->nocache[] = $com_name;
break;
case 2:
$this->skip[] = $com_name;
break;
case 3:
$this->useJoomlaRouter[] = $com_name;
break;
default:
break;
}
break;
case 'translateURL':
if ($value == 1) {
$this->notTranslateURLList[] = $com_name;
}
break;
case 'insertIsoCode':
if ($value == 1) {
$this->notInsertIsoCodeList[] = $com_name;
}
break;
case 'shDoNotOverrideOwnSef':
switch ($value) {
case 1:
$this->shDoNotOverrideOwnSef[] = $com_name;
break;
case 30:
$this->useJoomsefRouter[] = $com_name;
break;
case 40:
$this->useAcesefRouter[] = $com_name;
break;
default:
break;
}
break;
case 'compEnablePageId':
if ($value == 1) {
$this->compEnablePageId[] = $com_name;
}
break;
case 'defaultComponentString':
$this->defaultComponentStringList[$com_name] = $value;
break;
}
} elseif (substr_count($key, "languages_")) {
$lang_array = explode("_", $key);
$lang = $lang_array[1];
$lang_param = $lang_array[2];
switch ($lang_param) {
case 'pageText':
$this->pageTexts[$lang] = $value;
break;
//.........这里部分代码省略.........