예제 #1
0
 public function fixLanguageStringSyntax($string = '')
 {
     $string = trim(RLText::html_entity_decoder($string));
     $string = str_replace('"', '"', $string);
     $string = str_replace('span style="font-family:monospace;"', 'span class="rl_code"', $string);
     return $string;
 }
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     RLFunctions::stylesheet('regularlabs/style.min.css');
     require_once __DIR__ . '/toggler.php';
     $toggler = new RLFieldToggler();
     $this->value = (int) $this->value;
     $label = $this->get('label');
     $param_name = $this->get('name');
     $noshow = $this->get('noshow', 0);
     $showclose = $this->get('showclose', 0);
     $html = array();
     if (!$label) {
         if (!$noshow) {
             $html[] = $toggler->getInput(array('div' => 1));
         }
         $html[] = $toggler->getInput(array('div' => 1));
         return '</div>' . implode('', $html);
     }
     $label = RLText::html_entity_decoder(JText::_($label));
     $html[] = '</div>';
     if (!$noshow) {
         $html[] = $toggler->getInput(array('div' => 1, 'param' => 'show_assignments|' . $param_name, 'value' => '1|1,2'));
     }
     $class = 'well well-small rl_well';
     if ($this->value === 1) {
         $class .= ' alert-success';
     } else {
         if ($this->value === 2) {
             $class .= ' alert-error';
         }
     }
     $html[] = '<div class="' . $class . '">';
     if ($showclose && JFactory::getUser()->authorise('core.admin')) {
         $html[] = '<button type="button" class="close rl_remove_assignment">&times;</button>';
     }
     $html[] = '<div class="control-group">';
     $html[] = '<div class="control-label">';
     $html[] = '<label><h4 class="rl_assignmentselection-header">' . $label . '</h4></label>';
     $html[] = '</div>';
     $html[] = '<div class="controls">';
     $html[] = '<fieldset id="' . $this->id . '"  class="radio btn-group">';
     $onclick = ' onclick="RegularLabsScripts.setToggleTitleClass(this, 0)"';
     $html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (!$this->value ? ' checked="checked"' : '') . $onclick . '>';
     $html[] = '<label class="rl_btn-ignore" for="' . $this->id . '0">' . JText::_('RL_IGNORE') . '</label>';
     $onclick = ' onclick="RegularLabsScripts.setToggleTitleClass(this, 1)"';
     $html[] = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . ($this->value === 1 ? ' checked="checked"' : '') . $onclick . '>';
     $html[] = '<label class="rl_btn-include" for="' . $this->id . '1">' . JText::_('RL_INCLUDE') . '</label>';
     $onclick = ' onclick="RegularLabsScripts.setToggleTitleClass(this, 2)"';
     $onclick .= ' onload="RegularLabsScripts.setToggleTitleClass(this, ' . $this->value . ', 7)"';
     $html[] = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . ($this->value === 2 ? ' checked="checked"' : '') . $onclick . '>';
     $html[] = '<label class="rl_btn-exclude" for="' . $this->id . '2">' . JText::_('RL_EXCLUDE') . '</label>';
     $html[] = '</fieldset>';
     $html[] = '</div>';
     $html[] = '</div>';
     $html[] = '<div class="clearfix"> </div>';
     $html[] = $toggler->getInput(array('div' => 1, 'param' => $param_name, 'value' => '1,2'));
     $html[] = '<div><div>';
     return '</div>' . implode('', $html);
 }
 protected function getLabel()
 {
     $this->params = $this->element->attributes();
     $label = $this->get('label') ? $this->get('label') : '';
     $size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
     $class = 'class="' . ($this->get('class') ? $this->get('class') : 'text_area') . '"';
     $this->value = htmlspecialchars(RLText::html_entity_decoder($this->value), ENT_QUOTES);
     return '<label for="' . $this->id . '" style="margin-top: -5px;">' . '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . '>' . '</label>';
 }
예제 #4
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     RLFunctions::stylesheet('regularlabs/style.min.css');
     $label = RLText::html_entity_decoder(JText::_($this->get('label')));
     $description = $this->prepareText($this->get('description'));
     $lang_file = $this->get('language_file');
     $html = '</td></tr></table></div></div>';
     $html .= '<div class="panel"><h3 class="jpane-toggler title" id="advanced-page"><span>';
     $html .= $label;
     $html .= '</span></h3>';
     $html .= '<div class="jpane-slider content"><table width="100%" class="paramlist admintable" cellspacing="1"><tr><td colspan="2" class="paramlist_value">';
     if ($lang_file) {
         jimport('joomla.filesystem.file');
         // Include extra language file
         $lang = str_replace('_', '-', JFactory::getLanguage()->getTag());
         $inc = '';
         $lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
         if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path)) {
             $inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
         } else {
             if (JFile::exists(JPATH_SITE . '/' . $lang_path)) {
                 $inc = JPATH_SITE . '/' . $lang_path;
             }
         }
         if (!$inc && $lang != 'en-GB') {
             $lang = 'en-GB';
             $lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
             if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path)) {
                 $inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
             } else {
                 if (JFile::exists(JPATH_SITE . '/' . $lang_path)) {
                     $inc = JPATH_SITE . '/' . $lang_path;
                 }
             }
         }
         if ($inc) {
             include $inc;
         }
     }
     if ($description) {
         if ($description['0'] != '<') {
             $description = '<p>' . $description . '</p>';
         }
         $class = 'rl_panel rl_panel_description';
         $html .= '<div class="' . $class . '"><div class="rl_block rl_title">';
         $html .= $description;
         $html .= '<div style="clear: both;"></div></div></div>';
     }
     return $html;
 }
예제 #5
0
 public static function render($name, $check_pro = false)
 {
     if (!$name) {
         return '';
     }
     require_once __DIR__ . '/functions.php';
     $alias = RLFunctions::getAliasByName($name);
     $name = RLFunctions::getNameByAlias($name);
     if ($check_pro && self::isPro($alias)) {
         return '';
     }
     require_once __DIR__ . '/text.php';
     return '<div class="alert rl_licence">' . JText::sprintf('RL_IS_FREE_VERSION', $name) . '<br>' . JText::_('RL_FOR_MORE_GO_PRO') . '<br>' . '<a href="https://www.regularlabs.com/purchase?ext=' . $alias . '" target="_blank" class="btn btn-small btn-primary">' . ' <span class="icon-basket"></span>' . RLText::html_entity_decoder(JText::_('RL_GO_PRO')) . '</a>' . '</div>';
 }
예제 #6
0
 private function prepareText($string = '')
 {
     $string = trim($string);
     if ($string == '') {
         return '';
     }
     // variables
     $var1 = JText::_($this->get('var1'));
     $var2 = JText::_($this->get('var2'));
     $var3 = JText::_($this->get('var3'));
     $var4 = JText::_($this->get('var4'));
     $var5 = JText::_($this->get('var5'));
     $string = JText::sprintf(JText::_($string), $var1, $var2, $var3, $var4, $var5);
     $string = trim(RLText::html_entity_decoder($string));
     $string = str_replace('&quot;', '"', $string);
     $string = str_replace('span style="font-family:monospace;"', 'span class="rl_code"', $string);
     return $string;
 }
예제 #7
0
 function render()
 {
     if (!isset($this->params->display_link)) {
         return;
     }
     require_once JPATH_LIBRARIES . '/regularlabs/helpers/functions.php';
     require_once JPATH_LIBRARIES . '/regularlabs/helpers/text.php';
     // load the admin language file
     RLFunctions::loadLanguage('mod_cachecleaner');
     $script = "\n\t\t\tvar cachecleaner_base = '" . JUri::base(true) . "';\n\t\t\tvar cachecleaner_root = '" . JUri::root() . "';\n\t\t\tvar cachecleaner_msg_clean = '" . addslashes(RLText::html_entity_decoder(JText::_('CC_CLEANING_CACHE'))) . "';\n\t\t\tvar cachecleaner_msg_inactive = '" . addslashes(RLText::html_entity_decoder(JText::sprintf('CC_SYSTEM_PLUGIN_NOT_ENABLED', '<a href=&quot;index.php?option=com_plugins&filter_type=system&filter_folder=system&search=cache cleaner&filter_search=cache cleaner&quot;>', '</a>'))) . "';\n\t\t\tvar cachecleaner_msg_failure = '" . addslashes(RLText::html_entity_decoder(JText::_('CC_CACHE_COULD_NOT_BE_CLEANED'))) . "';";
     JFactory::getDocument()->addScriptDeclaration($script);
     RLFunctions::script('regularlabs/script.min.js');
     RLFunctions::script('cachecleaner/script.min.js', '5.2.0');
     RLFunctions::stylesheet('regularlabs/style.min.css');
     RLFunctions::stylesheet('cachecleaner/style.min.css', '5.2.0');
     $text_ini = strtoupper(str_replace(' ', '_', $this->params->icon_text));
     $text = JText::_($text_ini);
     if ($text == $text_ini) {
         $text = JText::_($this->params->icon_text);
     }
     if ($this->params->display_toolbar_button) {
         // Generate html for toolbar button
         $html = array();
         $html[] = '<a href="javascript:;" onclick="return false;"  class="btn btn-small cachecleaner_link">';
         $html[] = '<span class="icon-reglab icon-cachecleaner"></span> ';
         $html[] = $text;
         $html[] = '</a>';
         $toolbar = JToolBar::getInstance('toolbar');
         $toolbar->appendButton('Custom', implode('', $html));
     }
     // Generate html for status link
     $html = array();
     $html[] = '<div class="btn-group cachecleaner">';
     $html[] = '<a href="javascript:;" onclick="return false;" class="cachecleaner_link">';
     if ($this->params->display_link != 'text') {
         $html[] = '<span class="icon-reglab icon-cachecleaner"></span> ';
     }
     if ($this->params->display_link != 'icon') {
         $html[] = $text;
     }
     $html[] = '</a>';
     $html[] = '</div>';
     echo implode('', $html);
 }
예제 #8
0
 protected function getLabel()
 {
     $this->params = $this->element->attributes();
     $resize = $this->get('resize', 0);
     $label = RLText::html_entity_decoder(JText::_($this->get('label')));
     $html = '<label id="' . $this->id . '-lbl" for="' . $this->id . '"';
     if ($this->description) {
         $html .= ' class="hasTooltip" title="<strong>' . $label . '</strong><br>' . JText::_($this->description) . '">';
     } else {
         $html .= '>';
     }
     $html .= $label;
     if ($resize) {
         JHtml::_('jquery.framework');
         RLFunctions::script('regularlabs/script.min.js');
         RLFunctions::stylesheet('regularlabs/style.min.css');
         $html .= '<br><span role="button" class="rl_resize_textarea rl_maximize"' . ' data-id="' . $this->id . '"  data-min="' . $this->get('height', 80) . '" data-max="' . $resize . '">' . '<span class="rl_resize_textarea_maximize">' . '[ + ]' . '</span>' . '<span class="rl_resize_textarea_minimize">' . '[ - ]' . '</span>' . '</span>';
     }
     $html .= '</label>';
     return $html;
 }
예제 #9
0
 public function passURLs()
 {
     $regex = isset($this->params->regex) ? $this->params->regex : 0;
     if (!is_array($this->selection)) {
         $this->selection = explode("\n", $this->selection);
     }
     if (count($this->selection) == 1) {
         $this->selection = explode("\n", $this->selection['0']);
     }
     $url = JUri::getInstance();
     $url = $url->toString();
     $urls = array(RLText::html_entity_decoder(urldecode($url)), urldecode($url), RLText::html_entity_decoder($url), $url);
     $urls = array_unique($urls);
     $pass = false;
     foreach ($urls as $url) {
         foreach ($this->selection as $s) {
             $s = trim($s);
             if ($s == '') {
                 continue;
             }
             if ($regex) {
                 $url_part = str_replace(array('#', '&amp;'), array('\\#', '(&amp;|&)'), $s);
                 $s = '#' . $url_part . '#si';
                 if (@preg_match($s . 'u', $url) || @preg_match($s, $url)) {
                     $pass = true;
                     break;
                 }
                 continue;
             }
             if (strpos($url, $s) !== false) {
                 $pass = true;
                 break;
             }
         }
         if ($pass) {
             break;
         }
     }
     return $this->pass($pass);
 }
예제 #10
0
 private static function getFooterReview($name)
 {
     require_once __DIR__ . '/functions.php';
     $alias = RLFunctions::getAliasByName($name);
     $jed_url = 'http://regl.io/jed-' . $alias . '#reviews';
     return RLText::html_entity_decoder(JText::sprintf('RL_JED_REVIEW', '<a href="' . $jed_url . '" target="_blank">', '</a>' . ' <a href="' . $jed_url . '" target="_blank" class="stars">' . '<span class="icon-star"></span><span class="icon-star"></span><span class="icon-star"></span><span class="icon-star"></span><span class="icon-star"></span>' . '</a>'));
 }
예제 #11
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     RLFunctions::stylesheet('regularlabs/style.min.css');
     $title = $this->get('label');
     $description = $this->get('description');
     $xml = $this->get('xml');
     $url = $this->get('url');
     if ($description) {
         // variables
         $v1 = $this->get('var1');
         $v2 = $this->get('var2');
         $v3 = $this->get('var3');
         $v4 = $this->get('var4');
         $v5 = $this->get('var5');
         $description = RLText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
     }
     if ($title) {
         $title = JText::_($title);
     }
     if ($description) {
         $description = str_replace('span style="font-family:monospace;"', 'span class="rl_code"', $description);
         if ($description['0'] != '<') {
             $description = '<p>' . $description . '</p>';
         }
     }
     if (!$xml && $this->form->getValue('element')) {
         if ($this->form->getValue('folder')) {
             $xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
         } else {
             $xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
         }
     }
     if ($xml) {
         $xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . '/' . $xml);
         $version = 0;
         if ($xml && isset($xml['version'])) {
             $version = $xml['version'];
         }
         if ($version) {
             if (strpos($version, 'PRO') !== false) {
                 $version = str_replace('PRO', '', $version);
                 $version .= ' <small style="color:green">[PRO]</small>';
             } else {
                 if (strpos($version, 'FREE') !== false) {
                     $version = str_replace('FREE', '', $version);
                     $version .= ' <small style="color:green">[FREE]</small>';
                 }
             }
             if ($title) {
                 $title .= ' v';
             } else {
                 $title = JText::_('Version') . ' ';
             }
             $title .= $version;
         }
     }
     $html = array();
     if ($title) {
         if ($url) {
             $title = '<a href="' . $url . '" target="_blank" title="' . preg_replace('#<[^>]*>#', '', $title) . '">' . $title . '</a>';
         }
         $html[] = '<h4>' . RLText::html_entity_decoder($title) . '</h4>';
     }
     if ($description) {
         $html[] = $description;
     }
     if ($url) {
         $html[] = '<p><a href="' . $url . '" target="_blank" title="' . JText::_('RL_MORE_INFO') . '">' . JText::_('RL_MORE_INFO') . '...</a></p>';
     }
     return '</div><div>' . implode('', $html);
 }
예제 #12
0
 /**
  * Creates an array of different syntaxes of titles to match against a url variable
  */
 public static function createUrlMatches($titles = array())
 {
     $matches = array();
     foreach ($titles as $title) {
         $matches[] = $title;
         $matches[] = RLString::strtolower($title);
     }
     $matches = array_unique($matches);
     foreach ($matches as $title) {
         $matches[] = htmlspecialchars(RLText::html_entity_decoder($title));
     }
     $matches = array_unique($matches);
     foreach ($matches as $title) {
         $matches[] = urlencode($title);
         $matches[] = utf8_decode($title);
         $matches[] = str_replace(' ', '', $title);
         $matches[] = trim(preg_replace('#[^a-z0-9]#i', '', $title));
         $matches[] = trim(preg_replace('#[^a-z]#i', '', $title));
     }
     $matches = array_unique($matches);
     foreach ($matches as $i => $title) {
         $matches[$i] = trim(str_replace('?', '', $title));
     }
     $matches = array_diff(array_unique($matches), array('', '-'));
     return $matches;
 }