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);
 }
Exemplo n.º 2
0
 public function fixLanguageStringSyntax($string = '')
 {
     $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;
 }
Exemplo n.º 3
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     if (!is_array($this->value)) {
         $this->value = explode(',', $this->value);
     }
     $group = $this->get('group', 'countries');
     $options = array();
     foreach ($this->{$group} as $key => $val) {
         if (!$val) {
             $options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
         } else {
             if ($key['0'] == '-') {
                 $options[] = JHtml::_('select.option', '-', $val, 'value', 'text', true);
             } else {
                 $val = RLText::prepareSelectItem($val);
                 $options[] = JHtml::_('select.option', $key, $val);
             }
         }
     }
     $size = (int) $this->get('size');
     $multiple = $this->get('multiple');
     require_once dirname(__DIR__) . '/helpers/html.php';
     return RLHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
 }
 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>';
 }
Exemplo n.º 5
0
 function getCategories()
 {
     $query = $this->db->getQuery(true)->select('COUNT(c.id)')->from('#__zoo_category AS c')->where('c.published > -1');
     $this->db->setQuery($query);
     $total = $this->db->loadResult();
     if ($total > $this->max_list_count) {
         return -1;
     }
     $options = array();
     if ($this->get('show_ignore')) {
         if (in_array('-1', $this->value)) {
             $this->value = array('-1');
         }
         $options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_IGNORE') . ' -', 'value', 'text', 0);
         $options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', 1);
     }
     $query->clear()->select('a.id, a.name')->from('#__zoo_application AS a')->order('a.name, a.id');
     $this->db->setQuery($query);
     $apps = $this->db->loadObjectList();
     foreach ($apps as $i => $app) {
         $query->clear()->select('c.id, c.parent AS parent_id, c.name AS title, c.published')->from('#__zoo_category AS c')->where('c.application_id = ' . (int) $app->id)->where('c.published > -1')->order('c.ordering, c.name');
         $this->db->setQuery($query);
         $items = $this->db->loadObjectList();
         if ($i) {
             $options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', 1);
         }
         // establish the hierarchy of the menu
         // TODO: use node model
         $children = array();
         if ($items) {
             // first pass - collect children
             foreach ($items as $v) {
                 $pt = $v->parent_id;
                 $list = @$children[$pt] ? $children[$pt] : array();
                 array_push($list, $v);
                 $children[$pt] = $list;
             }
         }
         // second pass - get an indent list of the items
         $list = JHtml::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0);
         // assemble items to the array
         $options[] = JHtml::_('select.option', 'app' . $app->id, '[' . $app->name . ']', 'value', 'text', 0);
         foreach ($list as $item) {
             $item->treename = '  ' . str_replace('&#160;&#160;- ', '  ', $item->treename);
             $item->treename = RLText::prepareSelectItem($item->treename, $item->published);
             $option = JHtml::_('select.option', $item->id, $item->treename, 'value', 'text', 0);
             $option->level = 1;
             $options[] = $option;
         }
     }
     return $options;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
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>';
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
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);
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     $label = $this->get('label');
     $format = $this->get('format');
     $date = JFactory::getDate();
     $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
     $date->setTimeZone($tz);
     if ($format) {
         if (strpos($format, '%') !== false) {
             require_once dirname(__DIR__) . '/helpers/text.php';
             $format = RLText::dateToDateFormat($format);
         }
         $html = $date->format($format, true);
     } else {
         $html = $date->format('', true);
     }
     if ($label) {
         $html = JText::sprintf($label, $html);
     }
     return '</div><div>' . $html;
 }
Exemplo n.º 13
0
 public function passDate()
 {
     if (!$this->params->publish_up && !$this->params->publish_down) {
         // no date range set
         return $this->assignment == 'include';
     }
     require_once dirname(__DIR__) . '/text.php';
     RLText::fixDate($this->params->publish_up);
     RLText::fixDate($this->params->publish_down);
     $now = $this->getNow();
     $up = $this->getDate($this->params->publish_up);
     $down = $this->getDate($this->params->publish_down);
     if (isset($this->params->recurring) && $this->params->recurring) {
         if (!(int) $this->params->publish_up || !(int) $this->params->publish_down) {
             // no date range set
             return $this->assignment == 'include';
         }
         $up = strtotime(date('Y') . $up->format('-m-d H:i:s', true));
         $down = strtotime(date('Y') . $down->format('-m-d H:i:s', true));
         // pass:
         // 1) now is between up and down
         // 2) up is later in year than down and:
         // 2a) now is after up
         // 2b) now is before down
         if ($up < $now && $down > $now || $up > $down && ($up < $now || $down > $now)) {
             return $this->assignment == 'include';
         }
         // outside date range
         return $this->pass(false);
     }
     if ((int) $this->params->publish_up && strtotime($up->format('Y-m-d H:i:s', true)) > $now || (int) $this->params->publish_down && strtotime($down->format('Y-m-d H:i:s', true)) < $now) {
         // outside date range
         return $this->pass(false);
     }
     // pass
     return $this->assignment == 'include';
 }
Exemplo n.º 14
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);
 }
Exemplo n.º 15
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>'));
 }
Exemplo n.º 16
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('behavior.modal', 'a.modal');
     $size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
     $multiple = $this->get('multiple');
     $showtype = $this->get('showtype');
     $showid = $this->get('showid');
     $showinput = $this->get('showinput');
     // load the list of modules
     $query = $this->db->getQuery(true)->select('m.id, m.title, m.position, m.module, m.published, m.language')->from('#__modules AS m')->where('m.client_id = 0')->where('m.published > -2')->order('m.position, m.title, m.ordering, m.id');
     $this->db->setQuery($query);
     $modules = $this->db->loadObjectList();
     // assemble menu items to the array
     $options = array();
     $p = 0;
     foreach ($modules as $item) {
         if ($p !== $item->position) {
             $pos = $item->position;
             if ($pos == '') {
                 $pos = ':: ' . JText::_('JNONE') . ' ::';
             }
             $options[] = JHtml::_('select.option', '-', '[ ' . $pos . ' ]', 'value', 'text', true);
         }
         $p = $item->position;
         $item->title = $item->title;
         if ($showtype) {
             $item->title .= ' [' . $item->module . ']';
         }
         if ($showinput || $showid) {
             $item->title .= ' [' . $item->id . ']';
         }
         if ($item->language && $item->language != '*') {
             $item->title .= ' (' . $item->language . ')';
         }
         $item->title = RLText::prepareSelectItem($item->title, $item->published);
         $options[] = JHtml::_('select.option', $item->id, $item->title);
     }
     if ($showinput) {
         array_unshift($options, JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true));
         array_unshift($options, JHtml::_('select.option', '-', '- ' . JText::_('Select Item') . ' -'));
         if ($multiple) {
             $onchange = 'if ( this.value ) { if ( ' . $this->id . '.value ) { ' . $this->id . '.value+=\',\'; } ' . $this->id . '.value+=this.value; } this.value=\'\';';
         } else {
             $onchange = 'if ( this.value ) { ' . $this->id . '.value=this.value;' . $this->id . '_text.value=this.options[this.selectedIndex].innerHTML.replace( /^((&|&amp;|&#160;)nbsp;|-)*/gm, \'\' ).trim(); } this.value=\'\';';
         }
         $attribs = 'class="inputbox" onchange="' . $onchange . '"';
         $html = '<table cellpadding="0" cellspacing="0"><tr><td style="padding: 0px;">' . "\n";
         if (!$multiple) {
             $val_name = $this->value;
             if ($this->value) {
                 foreach ($modules as $item) {
                     if ($item->id == $this->value) {
                         $val_name = $item->title;
                         if ($showtype) {
                             $val_name .= ' [' . $item->module . ']';
                         }
                         $val_name .= ' [' . $this->value . ']';
                         break;
                     }
                 }
             }
             $html .= '<input type="text" id="' . $this->id . '_text" value="' . $val_name . '" class="inputbox" ' . $size . ' disabled="disabled">';
             $html .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '">';
         } else {
             $html .= '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '" class="inputbox" ' . $size . '>';
         }
         $html .= '</td><td style="padding: 0px;"padding-left: 5px;>' . "\n";
         $html .= JHtml::_('select.genericlist', $options, '', $attribs, 'value', 'text', '', '');
         $html .= '</td></tr></table>' . "\n";
     } else {
         $attr = $size;
         $attr .= $multiple ? ' multiple="multiple"' : '';
         $attr .= ' class="input-xxlarge"';
         $html = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
         $html = '<div class="input-maximize">' . $html . '</div>';
     }
     return preg_replace('#>\\[\\[\\:(.*?)\\:\\]\\]#si', ' style="\\1">', $html);
 }
Exemplo n.º 17
0
 public static function cleanSurroundingTags($tags, $elements = array('p', 'span'))
 {
     require_once __DIR__ . '/text.php';
     $breaks = '(?:(?:<br ?/?>|:\\|:)\\s*)*';
     $keys = array_keys($tags);
     $string = implode(':|:', $tags);
     // Remove empty tags
     while (preg_match('#<(' . implode('|', $elements) . ')(?: [^>]*)?>\\s*(' . $breaks . ')<\\/\\1>\\s*#s', $string, $match)) {
         $string = str_replace($match['0'], $match['2'], $string);
     }
     // Remove paragraphs around block elements
     $block_elements = array('p', 'div', 'table', 'tr', 'td', 'thead', 'tfoot', 'h[1-6]');
     $block_elements = '(' . implode('|', $block_elements) . ')';
     while (preg_match('#(<p(?: [^>]*)?>)(\\s*' . $breaks . ')(<' . $block_elements . '(?: [^>]*)?>)#s', $string, $match)) {
         if ($match['4'] == 'p') {
             $match['3'] = $match['1'] . $match['3'];
             RLText::combinePTags($match['3']);
         }
         $string = str_replace($match['0'], $match['2'] . $match['3'], $string);
     }
     while (preg_match('#(</' . $block_elements . '>\\s*' . $breaks . ')</p>#s', $string, $match)) {
         $string = str_replace($match['0'], $match['1'], $string);
     }
     $tags = explode(':|:', $string);
     $new_tags = array();
     foreach ($tags as $key => $val) {
         $key = isset($keys[$key]) ? $keys[$key] : $key;
         $new_tags[$key] = $val;
     }
     return $new_tags;
 }
Exemplo n.º 18
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;
 }
Exemplo n.º 19
0
 /**
  * prepare the tags and protected tags array
  */
 private static function prepareTags($tags, $include_closing_tags = true)
 {
     if (!is_array($tags)) {
         $tags = array($tags);
     }
     $hash = md5('prepareTags_' . json_encode($tags) . '_' . $include_closing_tags);
     if (RLCache::has($hash)) {
         return RLCache::get($hash);
     }
     foreach ($tags as $i => $tag) {
         if (RLText::is_alphanumeric($tag['0'])) {
             $tag = '{' . $tag;
         }
         $tags[$i] = $tag;
         if ($include_closing_tags) {
             $tags[] = preg_replace('#^([^a-z0-9]+)#', '\\1/', $tag);
         }
     }
     return RLCache::set($hash, array($tags, self::protectArray($tags, 1)));
 }