Exemplo n.º 1
0
 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  */
 protected function getInput()
 {
     $text = JText::_('COM_SH404SEF_CONFIGURE_SHLIB_PLUGIN');
     $link = '<span class = "btn sh404sef-textinput"><a href="' . Sh404sefHelperGeneral::getShLibPluginLink() . '" target="_blank">' . $text . '</a></span>';
     return $link;
     $html = '';
     $class = $this->element['class'] ? (string) $this->element['class'] : '';
     // Build the class for the label.
     $class = !empty($this->description) ? 'hasTip' : '';
     $class = $this->required == true ? $class . ' required' : $class;
     // Add the opening label tag and main attributes attributes.
     $field = '<fieldset id="' . $this->id . ' class="' . $class . '"';
     // If a description is specified, use it to build a tooltip.
     $label = '<label for=""';
     if (!empty($this->description)) {
         $label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? JText::_($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
     }
     // Add the label text and closing tag.
     $label .= "></label>";
     $field .= '><span class = "sh404sef-additionaltext">' . $link . '</span></fieldset>';
     $html[] = $field;
     return implode('', $html);
 }
Exemplo n.º 2
0
 public function getForm()
 {
     // import com_config model
     $comConfigModel = Sh404sefHelperGeneral::getComConfigComponentModel('com_sh404sef', JPATH_ADMINISTRATOR . '/components/com_sh404sef/configuration');
     $form = $comConfigModel->getForm();
     $component = $comConfigModel->getComponent();
     // version prefix
     $this->joomlaVersionPrefix = Sh404sefHelperGeneral::getJoomlaVersionPrefix();
     $method = '_getByComponentField' . $this->joomlaVersionPrefix;
     // inject the by components part in the form
     $field = $this->{$method}();
     $form->setField($field);
     // inject the languages part in the form
     $method = '_getLanguagesField' . $this->joomlaVersionPrefix;
     $field = $this->{$method}();
     $form->setField($field);
     // inject the current content of the 404 error page as default value in the txt404 form field
     $currentErrorPageContent = $this->_getErrorPageContent();
     $form->setFieldAttribute('txt404', 'default', $currentErrorPageContent);
     // inject analytics group field in form
     $field = $this->_getAnalyticsGroupsField();
     $form->setField($field);
     // merge categories in jooomla tab
     $field = $this->_getCategoriesField();
     $form->setField($field);
     // Bind the form to the data.
     if ($form && $component->params) {
         $form->bind($component->params);
     }
     // make sure Analytics password is not visible in the source code of the page
     $form->setValue('analyticsPassword', null, '********');
     // special processing for various parameters: turn string into an array
     // security
     $form->setValue('shSecOnlyNumVars', null, implode("\n", $form->getValue('shSecOnlyNumVars', null, array())));
     $form->setValue('shSecAlphaNumVars', null, implode("\n", $form->getValue('shSecAlphaNumVars', null, array())));
     $form->setValue('shSecNoProtocolVars', null, implode("\n", $form->getValue('shSecNoProtocolVars', null, array())));
     $form->setValue('ipWhiteList', null, implode("\n", $form->getValue('ipWhiteList', null, array())));
     $form->setValue('ipBlackList', null, implode("\n", $form->getValue('ipBlackList', null, array())));
     $form->setValue('uAgentWhiteList', null, implode("\n", $form->getValue('uAgentWhiteList', null, array())));
     $form->setValue('uAgentBlackList', null, implode("\n", $form->getValue('uAgentBlackList', null, array())));
     // analytics
     $form->setValue('analyticsExcludeIP', null, implode("\n", $form->getValue('analyticsExcludeIP', null, array())));
     // read mobile params from the mobile plugin, not from the component config, which only has a copy
     $plugin = JPluginHelper::getPlugin('system', 'shmobile');
     $params = new JRegistry();
     $params->loadString($plugin->params);
     $form->setValue('mobile_switch_enabled', null, $params->get('mobile_switch_enabled', 0));
     $form->setValue('mobile_template', null, $params->get('mobile_template', ''));
     // inject a link to shLib plugin params for cache settings
     $form->setFieldAttribute('UrlCacheHandlerLink', 'additionaltext', '<span class = "btn sh404sef-textinput"><a href="' . Sh404sefHelperGeneral::getShLibPluginLink() . '" target="_blank">' . JText::_('COM_SH404SEF_CONFIGURE_SHLIB_PLUGIN') . '</a></span>');
     return $form;
 }