protected function getInput()
 {
     JHtml::_('jquery.framework');
     RLFunctions::script('regularlabs/script.min.js');
     RLFunctions::script('regularlabs/toggler.min.js');
     $this->params = $this->element->attributes();
     $size = (int) $this->get('size');
     $attr = $this->get('onchange') ? ' onchange="' . $this->get('onchange') . '"' : '';
     $categories = $this->getOptions();
     $options = parent::getOptions();
     if ($this->get('show_none', 1)) {
         $options[] = JHtml::_('select.option', '', '- ' . JText::_('JNONE') . ' -', 'value', 'text');
     }
     if ($this->get('show_new', 1)) {
         $options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_NEW_CATEGORY') . ' -', 'value', 'text', false);
     }
     $options = array_merge($options, $categories);
     if (!$this->get('show_new', 1)) {
         return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
     }
     RLFunctions::script('regularlabs/simplecategories.min.js');
     $html = array();
     $html[] = '<div class="rl_simplecategory">';
     $html[] = '<input type="hidden" class="rl_simplecategory_value" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '" checked="checked">';
     $html[] = '<div class="rl_simplecategory_select">';
     $html[] = RLHtml::selectlistsimple($options, $this->getName($this->fieldname . '_select'), $this->value, $this->getId('', $this->fieldname . '_select'), $size, false);
     $html[] = '</div>';
     $html[] = '<div id="' . rand(1000000, 9999999) . '___' . $this->fieldname . '_select.-1" class="rl_toggler rl_toggler_nofx" style="display:none;">';
     $html[] = '<div class="rl_simplecategory_new">';
     $html[] = '<input type="text" id="' . $this->id . '_new" value="" placeholder="' . JText::_('RL_NEW_CATEGORY_ENTER') . '">';
     $html[] = '</div>';
     $html[] = '</div>';
     $html[] = '</div>';
     return implode('', $html);
 }
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('jquery.framework');
     RLFunctions::script('regularlabs/script.min.js');
     if ($file = $this->get('file')) {
         $label = $this->get('label', 'the main extension');
         RLFieldDependency::setMessage($file, $label);
         return '';
     }
     $path = $this->get('path') == 'site' ? '' : '/administrator';
     $label = $this->get('label');
     $file = $this->get('alias', $label);
     $file = preg_replace('#[^a-z-]#', '', strtolower($file));
     $extension = $this->get('extension');
     switch ($extension) {
         case 'com':
             $file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
             break;
         case 'mod':
             $file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
             break;
         default:
             $file = '/plugins/' . str_replace('plg_', '', $extension) . '/' . $file . '.xml';
             break;
     }
     $label = JText::_($label) . ' (' . JText::_('RL_' . strtoupper($extension)) . ')';
     RLFieldDependency::setMessage($file, $label);
     return '';
 }
Example #3
0
 function getInput($params)
 {
     $this->params = $params;
     $option = JFactory::getApplication()->input->get('option');
     // do not place toggler stuff on JoomFish pages
     if ($option == 'com_joomfish') {
         return '';
     }
     $param = $this->get('param');
     $value = $this->get('value');
     $nofx = $this->get('nofx');
     $method = $this->get('method');
     $div = $this->get('div', 0);
     JHtml::_('jquery.framework');
     RLFunctions::script('regularlabs/script.min.js');
     RLFunctions::script('regularlabs/toggler.min.js');
     $param = preg_replace('#^\\s*(.*?)\\s*$#', '\\1', $param);
     $param = preg_replace('#\\s*\\|\\s*#', '|', $param);
     $html = array();
     if ($param != '') {
         $param = preg_replace('#[^a-z0-9-\\.\\|\\@]#', '_', $param);
         $param = str_replace('@', '_', $param);
         $set_groups = explode('|', $param);
         $set_values = explode('|', $value);
         $ids = array();
         foreach ($set_groups as $i => $group) {
             $count = $i;
             if ($count >= count($set_values)) {
                 $count = 0;
             }
             $value = explode(',', $set_values[$count]);
             foreach ($value as $val) {
                 $ids[] = $group . '.' . $val;
             }
         }
         if (!$div) {
             $html[] = '</div></div>';
         }
         $html[] = '<div id="' . rand(1000000, 9999999) . '___' . implode('___', $ids) . '" class="rl_toggler';
         if ($nofx) {
             $html[] = ' rl_toggler_nofx';
         }
         if ($method == 'and') {
             $html[] = ' rl_toggler_and';
         }
         $html[] = '">';
         if (!$div) {
             $html[] = '<div><div>';
         }
     } else {
         $html[] = '</div>';
     }
     return implode('', $html);
 }
Example #4
0
 protected function getInput()
 {
     $this->params = $this->element->attributes();
     JHtml::_('jquery.framework');
     RLFunctions::script('regularlabs/script.min.js');
     $loading = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-refresh icon-spin\");";
     $success = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-ok\");" . "if(data){jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-success alert-inline\").html(data);}";
     $error = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-warning\");" . "if(data){jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-danger alert-inline\").html(data);}";
     $script = "function loadAjax" . $this->id . "() {" . $loading . "jQuery(\"#message_" . $this->id . "\").attr(\"class\", \"\").html(\"\");" . "RegularLabsScripts.loadajax(" . "'" . addslashes($this->get('url')) . "',\n\t\t\t\t\t'var data = data.trim();if(data == \"\" || data.substring(0,1) == \"+\") {" . "data = data.replace(/^\\\\+/, \\'\\');" . $success . "} else {" . $error . "}'," . "'" . $error . "'" . ");" . "}";
     JFactory::getDocument()->addScriptDeclaration($script);
     return '<button id="' . $this->id . '" class="' . $this->get('class', 'btn') . '" title="' . JText::_($this->get('description')) . '" onclick="loadAjax' . $this->id . '();return false;">' . '<span class="' . $this->get('icon', '') . '"></span> ' . JText::_($this->get('text', $this->get('label'))) . '</button>' . '<div id="message_' . $this->id . '"></div>';
 }
 function getInput($name, $id, $value, $params)
 {
     $this->name = $name;
     $this->id = $id;
     $this->value = $value;
     $this->params = $params;
     $action = '';
     if ($this->get('inlist', 0) && $this->get('action')) {
         $this->name = $name . $id;
         $this->id = $name . $id;
         $action = ' onchange="' . $this->get('action') . '"';
     }
     RLFunctions::script('regularlabs/colorpicker.min.js');
     RLFunctions::stylesheet('regularlabs/colorpicker.min.css');
     $class = ' class="' . trim('nncolorpicker chzn-done ' . $this->get('class')) . '"';
     $color = strtolower($this->value);
     if (!$color || in_array($color, array('none', 'transparent'))) {
         $color = 'none';
     } else {
         if ($color['0'] != '#') {
             $color = '#' . $color;
         }
     }
     $colors = $this->get('colors');
     if (empty($colors)) {
         $colors = array('none', '#049cdb', '#46a546', '#9d261d', '#ffc40d', '#f89406', '#c3325f', '#7a43b6', '#ffffff', '#999999', '#555555', '#000000');
     } else {
         $colors = explode(',', $colors);
     }
     $split = (int) $this->get('split');
     if (!$split) {
         $count = count($colors);
         if ($count % 5 == 0) {
             $split = 5;
         } else {
             if ($count % 4 == 0) {
                 $split = 4;
             }
         }
     }
     $split = $split ? $split : 3;
     $html = array();
     $html[] = '<select ' . $action . ' name="' . $this->name . '" id="' . $this->id . '"' . $class . ' style="visibility:hidden;width:22px;height:1px">';
     foreach ($colors as $i => $c) {
         $html[] = '<option' . ($c == $color ? ' selected="selected"' : '') . '>' . $c . '</option>';
         if (($i + 1) % $split == 0) {
             $html[] = '<option>-</option>';
         }
     }
     $html[] = '</select>';
     return implode('', $html);
 }
Example #6
0
 function getInput($name, $id, $value, $params)
 {
     $this->name = $name;
     $this->id = $id;
     $this->value = $value;
     $this->params = $params;
     $class = trim('rl_color minicolors ' . $this->get('class'));
     $disabled = $this->get('disabled') ? ' disabled="disabled"' : '';
     RLFunctions::script('regularlabs/color.min.js');
     RLFunctions::stylesheet('regularlabs/color.min.css');
     $this->value = strtolower(strtoupper(preg_replace('#[^a-z0-9]#si', '', $this->value)));
     return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="' . $class . '" value="' . $this->value . '"' . $disabled . '>';
 }
Example #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);
 }
 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;
 }
Example #9
0
 public static function getUpdateLink($alias, $version)
 {
     $is_pro = strpos($version, 'PRO') !== false;
     if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_regularlabsmanager/regularlabsmanager.xml')) {
         $url = $is_pro ? 'https://www.regularlabs.com/' . $alias . '#download' : JRoute::_('index.php?option=com_installer&view=update');
         return array($url, '');
     }
     $config = JComponentHelper::getParams('com_regularlabsmanager');
     $key = trim($config->get('key'));
     if ($is_pro && !$key) {
         return array('index.php?option=com_regularlabsmanager', '');
     }
     JHtml::_('bootstrap.framework');
     JHtml::_('behavior.modal');
     jimport('joomla.filesystem.file');
     RLFunctions::script('regularlabs/script.min.js');
     JFactory::getDocument()->addScriptDeclaration("\n\t\t\tvar NNEM_TIMEOUT = " . (int) $config->get('timeout', 5) . ";\n\t\t\tvar NNEM_TOKEN = '" . JSession::getFormToken() . "';\n\t\t");
     RLFunctions::script('regularlabsmanager/script.min.js', '5.2.0');
     $url = 'http://download.regularlabs.com?ext=' . $alias . '&j=3';
     if ($is_pro) {
         $url .= '&k=' . strtolower(substr($key, 0, 8) . md5(substr($key, 8)));
     }
     return array('', 'RegularLabsManager.openModal(\'update\', [\'' . $alias . '\'], [\'' . $url . '\'], true);');
 }
Example #10
0
    static function selectlist(&$options, $name, $value, $id, $size = 0, $multiple = 0, $simple = 0)
    {
        if (empty($options)) {
            return '<fieldset class="radio">' . JText::_('RL_NO_ITEMS_FOUND') . '</fieldset>';
        }
        require_once __DIR__ . '/parameters.php';
        $parameters = RLParameters::getInstance();
        $params = $parameters->getPluginParams('regularlabs');
        if (!is_array($value)) {
            $value = explode(',', $value);
        }
        $count = 0;
        if ($options != -1) {
            foreach ($options as $option) {
                $count++;
                if (isset($option->links)) {
                    $count += count($option->links);
                }
                if ($count > $params->max_list_count) {
                    break;
                }
            }
        }
        if ($options == -1 || $count > $params->max_list_count) {
            if (is_array($value)) {
                $value = implode(',', $value);
            }
            if (!$value) {
                $input = '<textarea name="' . $name . '" id="' . $id . '" cols="40" rows="5">' . $value . '</textarea>';
            } else {
                $input = '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '" size="60">';
            }
            return '<fieldset class="radio"><label for="' . $id . '">' . JText::_('RL_ITEM_IDS') . ':</label>' . $input . '</fieldset>';
        }
        if (!$multiple) {
            $first_level = isset($options['0']->level) ? $options['0']->level : 0;
            foreach ($options as &$option) {
                if (!isset($option->level)) {
                    continue;
                }
                $repeat = $option->level - $first_level > 0 ? $option->level - $first_level : 0;
                $option->text = str_repeat(' - ', $repeat) . $option->text;
            }
            $html = JHtml::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value);
            return self::handlePreparedStyles($html);
        }
        $size = (int) $size ?: 300;
        if ($simple) {
            $attr = 'style="width: ' . $size . 'px"';
            $attr .= $multiple ? ' multiple="multiple"' : '';
            $html = JHtml::_('select.genericlist', $options, $name, trim($attr), 'value', 'text', $value, $id);
            return self::handlePreparedStyles($html);
        }
        require_once __DIR__ . '/functions.php';
        RLFunctions::loadLanguage('com_modules', JPATH_ADMINISTRATOR);
        RLFunctions::script('regularlabs/multiselect.min.js');
        RLFunctions::stylesheet('regularlabs/multiselect.min.css');
        $html = array();
        $html[] = '<div class="well well-small rl_multiselect" id="' . $id . '">';
        $html[] = '
			<div class="form-inline rl_multiselect-controls">
				<span class="small">' . JText::_('JSELECT') . ':
					<a class="rl_multiselect-checkall" href="javascript:;">' . JText::_('JALL') . '</a>,
					<a class="rl_multiselect-uncheckall" href="javascript:;">' . JText::_('JNONE') . '</a>,
					<a class="rl_multiselect-toggleall" href="javascript:;">' . JText::_('RL_TOGGLE') . '</a>
				</span>
				<span class="width-20">|</span>
				<span class="small">' . JText::_('RL_EXPAND') . ':
					<a class="rl_multiselect-expandall" href="javascript:;">' . JText::_('JALL') . '</a>,
					<a class="rl_multiselect-collapseall" href="javascript:;">' . JText::_('JNONE') . '</a>
				</span>
				<span class="width-20">|</span>
				<span class="small">' . JText::_('JSHOW') . ':
					<a class="rl_multiselect-showall" href="javascript:;">' . JText::_('JALL') . '</a>,
					<a class="rl_multiselect-showselected" href="javascript:;">' . JText::_('RL_SELECTED') . '</a>
				</span>
				<span class="rl_multiselect-maxmin">
				<span class="width-20">|</span>
				<span class="small">
					<a class="rl_multiselect-maximize" href="javascript:;">' . JText::_('RL_MAXIMIZE') . '</a>
					<a class="rl_multiselect-minimize" style="display:none;" href="javascript:;">' . JText::_('RL_MINIMIZE') . '</a>
				</span>
				</span>
				<input type="text" name="rl_multiselect-filter" class="rl_multiselect-filter input-medium search-query pull-right" size="16"
					autocomplete="off" placeholder="' . JText::_('JSEARCH_FILTER') . '" aria-invalid="false" tabindex="-1">
			</div>

			<div class="clearfix"></div>

			<hr class="hr-condensed">';
        $o = array();
        foreach ($options as $option) {
            $option->level = isset($option->level) ? $option->level : 0;
            $o[] = $option;
            if (isset($option->links)) {
                foreach ($option->links as $link) {
                    $link->level = $option->level + (isset($link->level) ? $link->level : 1);
                    $o[] = $link;
                }
            }
        }
        $html[] = '<ul class="rl_multiselect-ul" style="max-height:300px;min-width:' . $size . 'px;overflow-x: hidden;">';
        $prevlevel = 0;
        foreach ($o as $i => $option) {
            if ($prevlevel < $option->level) {
                // correct wrong level indentations
                $option->level = $prevlevel + 1;
                $html[] = '<ul class="rl_multiselect-sub">';
            } else {
                if ($prevlevel > $option->level) {
                    $html[] = str_repeat('</li></ul>', $prevlevel - $option->level);
                } else {
                    if ($i) {
                        $html[] = '</li>';
                    }
                }
            }
            $labelclass = trim('pull-left ' . (isset($option->labelclass) ? $option->labelclass : ''));
            $html[] = '<li>';
            $item = '<div class="' . trim('rl_multiselect-item pull-left ' . (isset($option->class) ? $option->class : '')) . '">';
            if (isset($option->title)) {
                $labelclass .= ' nav-header';
            }
            if (isset($option->title) && (!isset($option->value) || !$option->value)) {
                $item .= '<label class="' . $labelclass . '">' . $option->title . '</label>';
            } else {
                $selected = in_array($option->value, $value) ? ' checked="checked"' : '';
                $disabled = isset($option->disable) && $option->disable ? ' readonly="readonly" style="visibility:hidden"' : '';
                $item .= '<input type="checkbox" class="pull-left" name="' . $name . '" id="' . $id . $option->value . '" value="' . $option->value . '"' . $selected . $disabled . '>
					<label for="' . $id . $option->value . '" class="' . $labelclass . '">' . $option->text . '</label>';
            }
            $item .= '</div>';
            $html[] = $item;
            if (!isset($o[$i + 1]) && $option->level > 0) {
                $html[] = str_repeat('</li></ul>', (int) $option->level);
            }
            $prevlevel = $option->level;
        }
        $html[] = '</ul>';
        $html[] = '
			<div style="display:none;" class="rl_multiselect-menu-block">
				<div class="pull-left nav-hover rl_multiselect-menu">
					<div class="btn-group">
						<a href="#" data-toggle="dropdown" class="dropdown-toggle btn btn-micro">
							<span class="caret"></span>
						</a>
						<ul class="dropdown-menu">
							<li class="nav-header">' . JText::_('COM_MODULES_SUBITEMS') . '</li>
							<li class="divider"></li>
							<li class=""><a class="checkall" href="javascript:;"><span class="icon-checkbox"></span> ' . JText::_('JSELECT') . '</a>
							</li>
							<li><a class="uncheckall" href="javascript:;"><span class="icon-checkbox-unchecked"></span> ' . JText::_('COM_MODULES_DESELECT') . '</a>
							</li>
							<div class="rl_multiselect-menu-expand">
								<li class="divider"></li>
								<li><a class="expandall" href="javascript:;"><span class="icon-plus"></span> ' . JText::_('RL_EXPAND') . '</a></li>
								<li><a class="collapseall" href="javascript:;"><span class="icon-minus"></span> ' . JText::_('RL_COLLAPSE') . '</a></li>
							</div>
						</ul>
					</div>
				</div>
			</div>';
        $html[] = '</div>';
        $html = implode('', $html);
        return self::handlePreparedStyles($html);
    }