function getGeo($service) { if ($this->geo !== null) { return $this->geo; } require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; $func = new nnFrameworkFunctions(); $ip = $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ? '' : $_SERVER['REMOTE_ADDR']; switch ($service) { case 'geoplugin': if (!($geo = json_decode($func->getContents('http://www.geoplugin.net/json.gp?ip=' . $ip)))) { $this->geo = false; return false; } if (isset($geo->geoplugin_status) && $geo->geoplugin_status == 404) { $this->geo = false; return false; } $this->geo = (object) array('continent' => isset($geo->geoplugin_continentCode) ? $geo->geoplugin_continentCode : '', 'country' => isset($geo->geoplugin_countryCode) ? $geo->geoplugin_countryCode : '', 'region' => isset($geo->geoplugin_regionCode) ? $geo->geoplugin_regionCode : ''); break; case 'telize': default: if (!($geo = json_decode($func->getContents('http://www.telize.com/geoip/' . $ip)))) { $this->geo = false; return false; } if (isset($geo->code)) { $this->geo = false; return false; } $this->geo = (object) array('continent' => isset($geo->continent_code) ? $geo->continent_code : '', 'country' => isset($geo->country_code) ? $geo->country_code : '', 'region' => isset($geo->region_code) ? $geo->region_code : ''); break; } return $this->geo; }
function render(&$params) { jimport('joomla.filesystem.file'); // Load plugin language require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_system_nnframework'); nnFrameworkFunctions::loadLanguage('plg_editors-xtd_sourcerer'); nnFrameworkFunctions::loadLanguage('plg_system_sourcerer'); $language = 'en'; $locales = JFactory::getLanguage()->getLocale(); foreach ($locales as $locale) { if (JFile::exists(JPATH_PLUGINS . '/editors-xtd/sourcerer/editarea/langs/' . $locale . '.js')) { $language = $locale; break; } } // Add scripts and styles JHtml::_('behavior.mootools'); JFactory::getDocument()->addScript(JURI::root(true) . '/plugins/editors-xtd/sourcerer/editarea/edit_area_full.js'); JHtml::script('sourcerer/script.min.js', false, true); $script = "\n\t\t\teditAreaLoader.init({\n\t\t\t\tid: 'source',\t// id of the textarea to transform\n\t\t\t\tstart_highlight: true,\t// if start with highlight\n\t\t\t\tallow_resize: 'y',\n\t\t\t\tallow_toggle: false,\n\t\t\t\tword_wrap: true,\n\t\t\t\tlanguage: '" . $language . "',\n\t\t\t\tsyntax: 'php',\n\t\t\t\ttoolbar: 'fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, highlight, reset_highlight, word_wrap',\n\t\t\t\tsyntax_selection_allow: 'css,html,js,php'\n\t\t\t});\n\n\t\t\tvar sourcerer_syntax_word = '" . $params->syntax_word . "';\n\t\t\tvar sourcerer_editorname = '" . JFactory::getApplication()->input->getString('name', 'text') . "';\n\t\t\tvar sourcerer_default_addsourcetags = " . (int) $params->addsourcetags . ";\n\t\t\tvar sourcerer_root = '" . JURI::root(true) . "';\n\n\t\t\twindow.addEvent( 'domready', function() { sourcerer_init(); });\n\t\t"; JFactory::getDocument()->addScriptDeclaration($script); JHtml::stylesheet('nnframework/style.min.css', false, true); JHtml::stylesheet('nnframework/popup.min.css', false, true); JHtml::stylesheet('sourcerer/popup.min.css', false, true); $params->code = '<!-- You can place html anywhere within the source tags --><br /><br /><br /><script language="javascript" type="text/javascript"><br /> // You can place JavaScript like this<br /> <br /></script><br /><?php<br /> // You can place PHP like this<br /> <br />?>'; $params->code = str_replace('<br />', "\n", $params->code); echo $this->getHTML($params); }
protected function getInput() { if (!nnFrameworkFunctions::extensionInstalled('flexicontent')) { return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</label></fieldset>'; } $this->params = $this->element->attributes(); $this->db = JFactory::getDBO(); $group = $this->get('group', 'categories'); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables)) { return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</label></fieldset>'; } if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->get('size'); $multiple = $this->get('multiple'); require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); }
protected function getInput() { if (!nnFrameworkFunctions::extensionInstalled('akeebasubs')) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>'; } $this->params = $this->element->attributes(); $this->db = JFactory::getDBO(); $group = $this->get('group', 'categories'); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'akeebasubs_' . $group, $tables)) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>'; } if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->get('size'); $multiple = $this->get('multiple'); require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; switch ($group) { case 'categories': return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); default: return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple); } }
protected function getInput() { if (!nnFrameworkFunctions::extensionInstalled('mijoshop')) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>'; } $this->params = $this->element->attributes(); $this->db = JFactory::getDBO(); $group = $this->get('group', 'categories'); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'mijoshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>'; } $parameters = nnParameters::getInstance(); $params = $parameters->getPluginParams('nnframework'); $this->max_list_count = $params->max_list_count; if (!class_exists('MijoShop')) { require_once JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php'; } $this->store_id = (int) MijoShop::get('opencart')->get('config')->get('config_store_id'); $this->language_id = (int) MijoShop::get('opencart')->get('config')->get('config_language_id'); if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->get('size'); $multiple = $this->get('multiple'); require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; switch ($group) { case 'categories': return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); default: return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple); } }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function render($name) { $button = new JObject(); if (JFactory::getApplication()->isSite() && !$this->params->enable_frontend) { return $button; } require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_editors-xtd_articlesanywhere'); JHtml::_('behavior.modal'); JHtml::stylesheet('nnframework/style.min.css', false, true); $class = 'nonumber icon-articlesanywhere'; $link = 'index.php?nn_qp=1' . '&folder=plugins.editors-xtd.articlesanywhere' . '&file=articlesanywhere.inc.php' . '&name=' . $name; $text_ini = strtoupper(str_replace(' ', '_', $this->params->button_text)); $text = JText::_($text_ini); if ($text == $text_ini) { $text = JText::_($this->params->button_text); } $button->modal = true; $button->class = 'btn'; $button->link = $link; $button->text = trim($text); $button->name = $class; $button->options = "{handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}"; return $button; }
protected function getInput() { $this->params = $this->element->attributes(); JHtml::_('jquery.framework'); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js'); $file = $this->get('file'); if (!$file) { $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; case 'plg_editors-xtd': $file = '/plugins/editors-xtd/' . $file . '.xml'; break; default: $file = '/plugins/system/' . $file . '.xml'; break; } $label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')'; } else { $label = $this->get('label', 'the main extension'); } nnFieldDependency::setMessage($file, $label); return ''; }
protected function getInput() { if (!nnFrameworkFunctions::extensionInstalled('virtuemart')) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>'; } $this->params = $this->element->attributes(); $this->db = JFactory::getDBO(); $group = $this->get('group', 'categories'); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>'; } $parameters = nnParameters::getInstance(); $params = $parameters->getPluginParams('nnframework'); $this->max_list_count = $params->max_list_count; if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->get('size'); $multiple = $this->get('multiple'); if ($group == 'categories') { require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); } $size = $size ? 'style="width:' . $size . 'px"' : ''; $attr = $size; $attr .= $multiple ? ' multiple="multiple"' : ''; return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); }
function clean() { if (!($type = $this->getCleanType())) { return; } // Load language for messaging nnFrameworkFunctions::loadLanguage('mod_cachecleaner'); $this->purgeCache($type); $error = $this->helpers->getParams()->error; if ($error) { $message = JText::_('CC_NOT_ALL_CACHE_COULD_BE_REMOVED'); $message .= $this->helpers->getParams()->error !== true ? '<br />' . $this->helpers->getParams()->error : ''; } else { $message = $this->helpers->getParams()->message ?: JText::_('CC_CACHE_CLEANED'); if ($this->params->show_size && $this->helpers->getParams()->size) { $message .= ' (' . $this->helpers->get('cache')->getSize() . ')'; } } if (JFactory::getApplication()->input->getInt('break')) { echo (!$error ? '+' : '') . str_replace('<br />', ' - ', $message); die; } if ($this->show_message && $message) { JFactory::getApplication()->enqueueMessage($message, $error ? 'error' : 'message'); } }
private static function isPro($element) { require_once __DIR__ . '/functions.php'; if (!($version = nnFrameworkFunctions::getXMLValue('version', $element))) { return false; } return stripos($version, 'PRO') !== false; }
function render() { $url = JFactory::getApplication()->input->getString('url', ''); $func = new nnFrameworkFunctions(); if ($url) { echo $func->getByUrl($url); die; } $allowed = array('administrator/components/com_dbreplacer/dbreplacer.inc.php', 'administrator/components/com_nonumbermanager/details.inc.php', 'administrator/modules/mod_addtomenu/addtomenu.inc.php', 'media/rereplacer/images/image.inc.php', 'plugins/editors-xtd/articlesanywhere/articlesanywhere.inc.php', 'plugins/editors-xtd/contenttemplater/contenttemplater.inc.php', 'plugins/editors-xtd/dummycontent/dummycontent.inc.php', 'plugins/editors-xtd/modulesanywhere/modulesanywhere.inc.php', 'plugins/editors-xtd/snippets/snippets.inc.php', 'plugins/editors-xtd/sourcerer/sourcerer.inc.php'); $file = JFactory::getApplication()->input->getString('file', ''); $folder = JFactory::getApplication()->input->getString('folder', ''); if ($folder) { $file = implode('/', explode('.', $folder)) . '/' . $file; } if (!$file || in_array($file, $allowed) === false) { die; } jimport('joomla.filesystem.file'); if (JFactory::getApplication()->isSite()) { JFactory::getApplication()->setTemplate('../administrator/templates/isis'); } $_REQUEST['tmpl'] = 'component'; JFactory::getApplication()->input->set('option', '1'); header('Content-Type: text/html; charset=utf-8'); JHtml::_('bootstrap.framework'); JFactory::getDocument()->addScript(JURI::root(true) . '/administrator/templates/isis/js/template.js'); JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/administrator/templates/isis/css/template.css'); JHtml::stylesheet('nnframework/popup.min.css', false, true); $file = JPATH_SITE . '/' . $file; $html = ''; if (JFile::exists($file)) { ob_start(); include $file; $html = ob_get_contents(); ob_end_clean(); } JFactory::getDocument()->setBuffer($html, 'component'); nnApplication::render(); $html = JResponse::toString(JFactory::getApplication()->getCfg('gzip')); $html = preg_replace('#\\s*<' . 'link [^>]*href="[^"]*templates/system/[^"]*\\.css[^"]*"[^>]* />#s', '', $html); $html = preg_replace('#(<' . 'body [^>]*class=")#s', '\\1nnpopup ', $html); $html = str_replace('<' . 'body>', '<' . 'body class="nnpopup"', $html); echo $html; die; }
public function onAfterRoute() { $this->_pass = 0; jimport('joomla.filesystem.file'); if (JFile::exists(JPATH_PLUGINS . '/system/nnframework/helpers/protect.php')) { require_once JPATH_PLUGINS . '/system/nnframework/helpers/protect.php'; // return if page should be protected if (nnProtect::isProtectedPage('', 1)) { return; } } // load the admin language file require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_' . $this->_type . '_' . $this->_name); // return if NoNumber Framework plugin is not installed if (!JFile::exists(JPATH_PLUGINS . '/system/nnframework/nnframework.php')) { if (JFactory::getApplication()->isAdmin() && JFactory::getApplication()->input->get('option') != 'com_login') { $msg = JText::_('SRC_NONUMBER_FRAMEWORK_NOT_INSTALLED') . ' ' . JText::sprintf('SRC_EXTENSION_CAN_NOT_FUNCTION', JText::_('SOURCERER')); $mq = JFactory::getApplication()->getMessageQueue(); foreach ($mq as $m) { if ($m['message'] == $msg) { $msg = ''; break; } } if ($msg) { JFactory::getApplication()->enqueueMessage($msg, 'error'); } } return; } if (JFile::exists(JPATH_PLUGINS . '/system/nnframework/helpers/protect.php')) { require_once JPATH_PLUGINS . '/system/nnframework/helpers/protect.php'; // return if current page is an admin page if (nnProtect::isAdmin()) { return; } } else { if (JFactory::getApplication()->isAdmin()) { return; } } // load the site language file require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_' . $this->_type . '_' . $this->_name, JPATH_SITE); // Load plugin parameters require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php'; $parameters = nnParameters::getInstance(); $params = $parameters->getPluginParams($this->_name); // Include the Helper require_once JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name . '/helper.php'; $class = get_class($this) . 'Helper'; $this->_helper = new $class($params); $this->_pass = 1; }
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'); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js'); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/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="nntoggler'; if ($nofx) { $html[] = ' nntoggler_nofx'; } if ($method == 'and') { $html[] = ' nntoggler_and'; } $html[] = '">'; if (!$div) { $html[] = '<div><div>'; } } else { $html[] = '</div>'; } return implode('', $html); }
function getInput($name, $id, $value, $params) { $this->name = $name; $this->id = $id; $this->value = $value; $this->params = $params; $class = trim('nn_color minicolors ' . $this->get('class')); $disabled = $this->get('disabled') ? ' disabled="disabled"' : ''; nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/color.min.js'); $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 . '>'; }
protected function getInput() { $this->params = $this->element->attributes(); JHtml::_('jquery.framework'); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/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\")"; $error = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-warning\");" . "jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-danger alert-inline\").html(data);"; $script = "\n\t\t\tfunction loadAjax" . $this->id . "() {\n\t\t\t\t" . $loading . ";\n\t\t\t\tjQuery(\"#message_" . $this->id . "\").attr(\"class\", \"\").html(\"\");\n\t\t\t\tnnScripts.loadajax(\n\t\t\t\t\t'" . addslashes($this->get('url')) . "',\n\t\t\t\t\t'if(data == \"\") { " . $success . " } else { " . $error . " }',\n\t\t\t\t\t'" . $error . "'\n\t\t\t\t);\n\t\t\t}\n\t\t"; JFactory::getDocument()->addScriptDeclaration($script); return '<button id="' . $this->id . '" 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') . '"'; } JHtml::stylesheet('nnframework/colorpicker.min.css', false, true); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/colorpicker.min.js'); $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); }
private function replaceLinksInCoreModuleManager() { require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('com_advancedmodules'); $body = JResponse::getBody(); $url = 'index.php?option=com_advancedmodules'; if (JFactory::getApplication()->input->get('view') == 'module') { $url .= '&task=module.edit&id=' . (int) JFactory::getApplication()->input->get('id'); } $link = '<a style="float:right;" href="' . JRoute::_($url) . '">' . JText::_('AMM_SWITCH_TO_ADVANCED_MODULE_MANAGER') . '</a><div style="clear:both;"></div>'; $body = preg_replace('#(</script>\\s*)(<form)#', '\\1' . $link . '\\2', $body); $body = preg_replace('#(</form>\\s*)((<\\!--.*?-->\\s*)*</div>)#', '\\1' . $link . '\\2', $body); JResponse::setBody($body); }
function render() { if (!isset($this->params->display_link)) { return; } // load the admin language file require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('mod_cachecleaner'); JHtml::stylesheet('nnframework/style.min.css', false, true); JFactory::getDocument()->addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js'); $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(html_entity_decode(JText::_('CC_CLEANING_CACHE'))) . "';\n\t\t\tvar cachecleaner_msg_inactive = '" . addslashes(html_entity_decode(JText::_('CC_SYSTEM_PLUGIN_NOT_ENABLED'))) . "';\n\t\t\tvar cachecleaner_msg_failure = '" . addslashes(html_entity_decode(JText::_('CC_CACHE_COULD_NOT_BE_CLEANED'))) . "';"; JFactory::getDocument()->addScriptDeclaration($script); JHtml::stylesheet('cachecleaner/style.min.css', false, true); JHtml::script('cachecleaner/script.min.js', false, true); $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-nonumber 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-nonumber icon-cachecleaner"></span> '; } if ($this->params->display_link != 'icon') { $html[] = $text; } $html[] = '</a>'; $html[] = '</div>'; echo implode('', $html); }
public function missingFilesOrTables($tables = array('categories', 'items'), $component = '', $table_prefix = '') { $component = $component ?: $this->type; if (!nnFrameworkFunctions::extensionInstalled(strtolower($component))) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_' . strtoupper($component))) . '</fieldset>'; } $group = $this->getGroup(); if (!in_array($group, $tables) && !in_array($group, array_keys($tables))) { // no need to check database table for this group return false; } $table_list = $this->db->getTableList(); $table = isset($tables[$group]) ? $tables[$group] : $group; $table = $this->db->getPrefix() . strtolower($table_prefix ?: $component) . '_' . $table; if (in_array($table, $table_list)) { // database table exists, so no error return false; } return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_' . strtoupper($component))) . '</fieldset>'; }
function render(&$params) { jimport('joomla.filesystem.file'); // Load plugin language require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_system_nnframework'); nnFrameworkFunctions::loadLanguage('plg_editors-xtd_sourcerer'); nnFrameworkFunctions::loadLanguage('plg_system_sourcerer'); JHtml::stylesheet('nnframework/style.min.css', false, true); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js'); JFactory::getDocument()->addStyleSheet('//code.jquery.com/ui/1.9.2/themes/smoothness/jquery-ui.css'); JFactory::getDocument()->addScript('//code.jquery.com/ui/1.9.2/jquery-ui.js'); $script = "\n\t\t\tvar sourcerer_syntax_word = '" . $params->syntax_word . "';\n\t\t\tvar sourcerer_editorname = '" . JFactory::getApplication()->input->getString('name', 'text') . "';\n\t\t\tvar sourcerer_default_addsourcetags = " . (int) $params->addsourcetags . ";\n\t\t\tvar sourcerer_root = '" . JURI::root(true) . "';\n\t\t"; JFactory::getDocument()->addScriptDeclaration($script); JHtml::stylesheet('sourcerer/popup.min.css', false, true); JHtml::script('sourcerer/script.min.js', false, true); $params->code = '<!-- You can place html anywhere within the source tags --><br /><br /><br /><script language="javascript" type="text/javascript"><br /> // You can place JavaScript like this<br /> <br /></script><br /><?php<br /> // You can place PHP like this<br /> <br />?>'; $params->code = str_replace('<br />', "\n", $params->code); echo $this->getHTML($params); }
public function __construct() { $this->db = JFactory::getDBO(); $this->has = array(); $this->has['easyblog'] = nnFrameworkFunctions::extensionInstalled('easyblog'); $this->has['flexicontent'] = nnFrameworkFunctions::extensionInstalled('flexicontent'); $this->has['form2content'] = nnFrameworkFunctions::extensionInstalled('form2content'); $this->has['k2'] = nnFrameworkFunctions::extensionInstalled('k2'); $this->has['zoo'] = nnFrameworkFunctions::extensionInstalled('zoo'); $this->has['akeebasubs'] = nnFrameworkFunctions::extensionInstalled('akeebasubs'); $this->has['hikashop'] = nnFrameworkFunctions::extensionInstalled('hikashop'); $this->has['mijoshop'] = nnFrameworkFunctions::extensionInstalled('mijoshop'); $this->has['redshop'] = nnFrameworkFunctions::extensionInstalled('redshop'); $this->has['virtuemart'] = nnFrameworkFunctions::extensionInstalled('virtuemart'); $this->has['cookieconfirm'] = nnFrameworkFunctions::extensionInstalled('cookieconfirm'); $this->types = array('menuitems' => 'Menu', 'homepage' => 'HomePage', 'date' => 'DateTime.Date', 'seasons' => 'DateTime.Seasons', 'months' => 'DateTime.Months', 'days' => 'DateTime.Days', 'time' => 'DateTime.Time', 'usergrouplevels' => 'Users.UserGroupLevels', 'users' => 'Users.Users', 'languages' => 'Languages', 'ips' => 'IPs', 'geocontinents' => 'Geo.Continents', 'geocountries' => 'Geo.Countries', 'georegions' => 'Geo.Regions', 'templates' => 'Templates', 'urls' => 'URLs', 'os' => 'Agents.OS', 'browsers' => 'Agents.Browsers', 'components' => 'Components', 'tags' => 'Tags', 'contentpagetypes' => 'Content.PageTypes', 'cats' => 'Content.Categories', 'articles' => 'Content.Articles', 'easyblogpagetypes' => 'EasyBlog.PageTypes', 'easyblogcats' => 'EasyBlog.Categories', 'easyblogtags' => 'EasyBlog.Tags', 'easyblogitems' => 'EasyBlog.Items', 'flexicontentpagetypes' => 'FlexiContent.PageTypes', 'flexicontenttags' => 'FlexiContent.Tags', 'flexicontenttypes' => 'FlexiContent.Types', 'form2contentprojects' => 'Form2Content.Projects', 'k2pagetypes' => 'K2.PageTypes', 'k2cats' => 'K2.Categories', 'k2tags' => 'K2.Tags', 'k2items' => 'K2.Items', 'zoopagetypes' => 'Zoo.PageTypes', 'zoocats' => 'Zoo.Categories', 'zooitems' => 'Zoo.Items', 'akeebasubspagetypes' => 'AkeebaSubs.PageTypes', 'akeebasubslevels' => 'AkeebaSubs.Levels', 'hikashoppagetypes' => 'HikaShop.PageTypes', 'hikashopcats' => 'HikaShop.Categories', 'hikashopproducts' => 'HikaShop.Products', 'mijoshoppagetypes' => 'MijoShop.PageTypes', 'mijoshopcats' => 'MijoShop.Categories', 'mijoshopproducts' => 'MijoShop.Products', 'redshoppagetypes' => 'RedShop.PageTypes', 'redshopcats' => 'RedShop.Categories', 'redshopproducts' => 'RedShop.Products', 'virtuemartpagetypes' => 'VirtueMart.PageTypes', 'virtuemartcats' => 'VirtueMart.Categories', 'virtuemartproducts' => 'VirtueMart.Products', 'cookieconfirm' => 'CookieConfirm', 'php' => 'PHP'); $this->thirdparty = array('EasyBlog', 'FlexiContent', 'Form2Content', 'K2', 'Zoo', 'AkeebaSubs', 'HikaShop', 'MijoShop', 'RedShop', 'VirtueMart', 'CookieConfirm'); $this->nonarray = array('PHP'); $this->setIdNames(); $this->classes = array(); }
public function __construct() { $this->db = JFactory::getDBO(); $this->q = $this->db->getQuery(true); $this->date = JFactory::getDate(); $tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset')); $this->date->setTimeZone($tz); $this->has = array(); $this->has['flexicontent'] = nnFrameworkFunctions::extensionInstalled('flexicontent'); $this->has['k2'] = nnFrameworkFunctions::extensionInstalled('k2'); $this->has['zoo'] = nnFrameworkFunctions::extensionInstalled('zoo'); $this->has['akeebasubs'] = nnFrameworkFunctions::extensionInstalled('akeebasubs'); $this->has['hikashop'] = nnFrameworkFunctions::extensionInstalled('hikashop'); $this->has['mijoshop'] = nnFrameworkFunctions::extensionInstalled('mijoshop'); $this->has['redshop'] = nnFrameworkFunctions::extensionInstalled('redshop'); $this->has['virtuemart'] = nnFrameworkFunctions::extensionInstalled('virtuemart'); $this->has['cookieconfirm'] = nnFrameworkFunctions::extensionInstalled('cookieconfirm'); $this->types = array('Menu', 'HomePage', 'DateTime_Date', 'DateTime_Seasons', 'DateTime_Months', 'DateTime_Days', 'DateTime_Time', 'Users_UserGroupLevels', 'Users_Users', 'Languages', 'IPs', 'Geo_Continents', 'Geo_Countries', 'Geo_Regions', 'Templates', 'URLs', 'Agents_OS', 'Agents_Browsers', 'Components', 'Content_PageTypes', 'Content_Categories', 'Content_Articles', 'FlexiContent_PageTypes', 'FlexiContent_Tags', 'FlexiContent_Types', 'K2_PageTypes', 'K2_Categories', 'K2_Tags', 'K2_Items', 'ZOO_PageTypes', 'ZOO_Categories', 'ZOO_Items', 'AkeebaSubs_PageTypes', 'AkeebaSubs_Levels', 'HikaShop_PageTypes', 'HikaShop_Categories', 'HikaShop_Products', 'MijoShop_PageTypes', 'MijoShop_Categories', 'MijoShop_Products', 'RedShop_PageTypes', 'RedShop_Categories', 'RedShop_Products', 'VirtueMart_PageTypes', 'VirtueMart_Categories', 'VirtueMart_Products', 'CookieConfirm', 'PHP'); $this->nonarray = array('PHP'); $this->setIdNames(); $this->classes = array(); }
protected function getInput() { if (!nnFrameworkFunctions::extensionInstalled('redshop')) { return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_REDSHOP')) . '</label></fieldset>'; } $this->params = $this->element->attributes(); $this->db = JFactory::getDBO(); $group = $this->get('group', 'categories'); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'redshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) { return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_REDSHOP')) . '</label></fieldset>'; } $parameters = nnParameters::getInstance(); $params = $parameters->getPluginParams('nnframework'); $this->max_list_count = $params->max_list_count; if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->get('size'); $multiple = $this->get('multiple'); require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function onDisplay($name) { jimport('joomla.filesystem.file'); // return if system plugin is not installed if (!JFile::exists(JPATH_PLUGINS . '/system/' . $this->_name . '/' . $this->_name . '.php')) { return; } // return if NoNumber Framework plugin is not installed if (!JFile::exists(JPATH_PLUGINS . '/system/nnframework/nnframework.php')) { return; } // load the admin language file require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_' . $this->_type . '_' . $this->_name); // Load plugin parameters require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php'; $parameters = nnParameters::getInstance(); $params = $parameters->getPluginParams($this->_name); // Include the Helper require_once JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name . '/helper.php'; $class = get_class($this) . 'Helper'; $helper = new $class($params); return $helper->render($name); }
public static function getXMLVersion($alias, $urlformat = false, $type = 'component', $folder = 'system') { require_once __DIR__ . '/functions.php'; if (!($version = nnFrameworkFunctions::getXMLValue('version', $alias, $type, $folder))) { return ''; } $version = trim($version); if (!$urlformat) { return $version; } return $version . '?v=' . strtolower(str_replace(array('FREE', 'PRO'), array('f', 'p'), $version)); }
/** * Plugin Helper File * * @package Modules Anywhere * @version 3.6.4 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2015 NoNumber All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; require_once JPATH_PLUGINS . '/system/nnframework/helpers/protect.php'; require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php'; nnFrameworkFunctions::loadLanguage('plg_system_modulesanywhere'); /** * Plugin that places modules */ class plgSystemModulesAnywhereHelper { public function __construct(&$params) { $this->option = JFactory::getApplication()->input->get('option'); $this->params = $params; $this->params->comment_start = '<!-- START: Modules Anywhere -->'; $this->params->comment_end = '<!-- END: Modules Anywhere -->'; $this->params->message_start = '<!-- Modules Anywhere Message: '; $this->params->message_end = ' -->'; $this->params->protect_start = '<!-- START: MA_PROTECT -->'; $this->params->protect_end = '<!-- END: MA_PROTECT -->';
static function selectlist(&$options, $name, $value, $id, $size = 0, $multiple = 0, $simple = 0) { if (empty($options)) { return '<fieldset class="radio">' . JText::_('NN_NO_ITEMS_FOUND') . '</fieldset>'; } require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php'; $parameters = nnParameters::getInstance(); $params = $parameters->getPluginParams('nnframework'); 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::_('NN_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 JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; JFactory::getLanguage()->load('com_modules', JPATH_ADMINISTRATOR); JHtml::stylesheet('nnframework/multiselect.min.css', false, true); nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/multiselect.min.js'); $html = array(); $html[] = '<div class="well well-small nn_multiselect" id="' . $id . '">'; $html[] = ' <div class="form-inline nn_multiselect-controls"> <span class="small">' . JText::_('JSELECT') . ': <a class="nn_multiselect-checkall" href="javascript://">' . JText::_('JALL') . '</a>, <a class="nn_multiselect-uncheckall" href="javascript://">' . JText::_('JNONE') . '</a>, <a class="nn_multiselect-toggleall" href="javascript://">' . JText::_('NN_TOGGLE') . '</a> </span> <span class="width-20">|</span> <span class="small">' . JText::_('NN_EXPAND') . ': <a class="nn_multiselect-expandall" href="javascript://">' . JText::_('JALL') . '</a>, <a class="nn_multiselect-collapseall" href="javascript://">' . JText::_('JNONE') . '</a> </span> <span class="width-20">|</span> <span class="small">' . JText::_('JSHOW') . ': <a class="nn_multiselect-showall" href="javascript://">' . JText::_('JALL') . '</a>, <a class="nn_multiselect-showselected" href="javascript://">' . JText::_('NN_SELECTED') . '</a> </span> <span class="nn_multiselect-maxmin"> <span class="width-20">|</span> <span class="small"> <a class="nn_multiselect-maximize" href="javascript://">' . JText::_('NN_MAXIMIZE') . '</a> <a class="nn_multiselect-minimize" style="display:none;" href="javascript://">' . JText::_('NN_MINIMIZE') . '</a> </span> </span> <input type="text" name=""nn_multiselect-filter" class="nn_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="nn_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="nn_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('nn_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="nn_multiselect-menu-block"> <div class="pull-left nav-hover nn_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="nn_multiselect-menu-expand"> <li class="divider"></li> <li><a class="expandall" href="javascript://"><span class="icon-plus"></span> ' . JText::_('NN_EXPAND') . '</a></li> <li><a class="collapseall" href="javascript://"><span class="icon-minus"></span> ' . JText::_('NN_COLLAPSE') . '</a></li> </div> </ul> </div> </div> </div>'; $html[] = '</div>'; $html = implode('', $html); return self::handlePreparedStyles($html); }
* Plugin Helper File * * @package Sourcerer * @version 4.4.9 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2015 NoNumber All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; require_once JPATH_PLUGINS . '/system/nnframework/helpers/helper.php'; require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php'; require_once JPATH_PLUGINS . '/system/nnframework/helpers/protect.php'; nnFrameworkFunctions::loadLanguage('plg_system_sourcerer'); /** * Plugin that replaces Sourcerer code with its HTML / CSS / JavaScript / PHP equivalent */ class plgSystemSourcererHelper { public function __construct(&$params) { $this->option = JFactory::getApplication()->input->get('option'); // Set plugin parameters $this->src_params = new stdClass(); $this->src_params->syntax_word = $params->syntax_word; // Matches the start and end tags with everything in between // Also matches any surrounding breaks and paragraph tags, to prevent unwanted empty lines in output. $breaks_start = '((?:<p(?: [^>]*)?>\\s*)?)((?:<span [^>]*>\\s*)*)'; $breaks_end = '((?:\\s*</span>)*)((?:\\s*</p>)?)';
function render(&$params) { $app = JFactory::getApplication(); // load the admin language file require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_system_nnframework'); nnFrameworkFunctions::loadLanguage('plg_editors-xtd_articlesanywhere'); nnFrameworkFunctions::loadLanguage('plg_system_articlesanywhere'); nnFrameworkFunctions::loadLanguage('com_content'); JHtml::stylesheet('nnframework/style.min.css', false, true); require_once JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php'; $content_type = 'core'; $k2 = 0; $db = JFactory::getDBO(); $query = $db->getQuery(true); $filter = null; // Get some variables from the request $option = 'articlesanywhere'; $filter_order = $app->getUserStateFromRequest($option . '_filter_order', 'filter_order', 'ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest($option . '_filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_featured = $app->getUserStateFromRequest($option . '_filter_featured', 'filter_featured', '', 'int'); $filter_category = $app->getUserStateFromRequest($option . '_filter_category', 'filter_category', 0, 'int'); $filter_author = $app->getUserStateFromRequest($option . '_filter_author', 'filter_author', 0, 'int'); $filter_state = $app->getUserStateFromRequest($option . '_filter_state', 'filter_state', '', 'word'); $filter_search = $app->getUserStateFromRequest($option . '_filter_search', 'filter_search', '', 'string'); $filter_search = JString::strtolower($filter_search); $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = $app->getUserStateFromRequest($option . '_limitstart', 'limitstart', 0, 'int'); // In case limit has been changed, adjust limitstart accordingly $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $lists = array(); // filter_search filter $lists['filter_search'] = $filter_search; // table ordering if ($filter_order == 'featured') { $filter_order = 'ordering'; $filter_order_Dir = ''; } $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $options = JHtml::_('category.options', 'com_content'); array_unshift($options, JHtml::_('select.option', '0', JText::_('JOPTION_SELECT_CATEGORY'))); $lists['categories'] = JHtml::_('select.genericlist', $options, 'filter_category', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_category); //$lists['categories'] = JHtml::_( 'select.genericlist', $categories, 'filter_category', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_category ); // get list of Authors for dropdown filter $query->clear()->select('c.created_by, u.name')->from('#__content AS c')->join('LEFT', '#__users AS u ON u.id = c.created_by')->where('c.state != -1')->where('c.state != -2')->group('u.id')->order('u.id DESC'); $db->setQuery($query); $options = $db->loadObjectList(); array_unshift($options, JHtml::_('select.option', '0', JText::_('JOPTION_SELECT_AUTHOR'), 'created_by', 'name')); $lists['authors'] = JHtml::_('select.genericlist', $options, 'filter_author', 'class="inputbox" size="1" onchange="this.form.submit( );"', 'created_by', 'name', $filter_author); // state filter $lists['state'] = JHtml::_('grid.state', $filter_state, 'JPUBLISHED', 'JUNPUBLISHED', 'JARCHIVED'); /* ITEMS */ $where = array(); $where[] = 'c.state != -2'; /* * Add the filter specific information to the where clause */ // Category filter if ($filter_category > 0) { $where[] = 'c.catid = ' . (int) $filter_category; } // Author filter if ($filter_author > 0) { $where[] = 'c.created_by = ' . (int) $filter_author; } // Content state filter if ($filter_state) { if ($filter_state == 'P') { $where[] = 'c.state = 1'; } else { if ($filter_state == 'U') { $where[] = 'c.state = 0'; } else { if ($filter_state == 'A') { $where[] = 'c.state = -1'; } else { $where[] = 'c.state != -2'; } } } } // Keyword filter if ($filter_search) { if (stripos($filter_search, 'id:') === 0) { $where[] = 'c.id = ' . (int) substr($filter_search, 3); } else { $cols = array('id', 'title', 'introtext', 'fulltext'); $w = array(); foreach ($cols as $col) { $w[] = 'LOWER(c.' . $col . ') LIKE ' . $db->quote('%' . $db->escape($filter_search, true) . '%', false); } $where[] = '(' . implode(' OR ', $w) . ')'; } } // Build the where clause of the content record query $where = implode(' AND ', $where); // Get the total number of records $query->clear()->select('COUNT(*)')->from('#__content AS c')->join('LEFT', '#__categories AS cc ON cc.id = c.catid')->where($where); $db->setQuery($query); $total = $db->loadResult(); // Create the pagination object jimport('joomla.html.pagination'); $page = new JPagination($total, $limitstart, $limit); if ($filter_order == 'ordering') { $order = 'category, ordering ' . $filter_order_Dir; } else { $order = $filter_order . ' ' . $filter_order_Dir . ', category, ordering'; } // Get the articles $query->clear()->select('c.*, c.state as published, g.title AS accesslevel, cc.title AS category')->select('u.name AS editor, f.content_id AS frontpage, v.name AS author')->from('#__content AS c')->join('LEFT', '#__categories AS cc ON cc.id = c.catid')->join('LEFT', '#__viewlevels AS g ON g.id = c.access')->join('LEFT', '#__users AS u ON u.id = c.checked_out')->join('LEFT', '#__users AS v ON v.id = c.created_by')->join('LEFT', '#__content_frontpage AS f ON f.content_id = c.id')->where($where)->order($order); $db->setQuery($query, $page->limitstart, $page->limit); $rows = $db->loadObjectList(); // If there is a database query error, throw a HTTP 500 and exit if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); return false; } $this->outputHTML($params, $rows, $page, $lists, $k2); }
/** * Main Plugin File * * @package NoNumber Framework * @version 15.4.3 * * @author Peter van Westen <*****@*****.**> * @link http://www.nonumber.nl * @copyright Copyright © 2015 NoNumber All Rights Reserved * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL */ defined('_JEXEC') or die; if (JFactory::getApplication()->isAdmin()) { // load the NoNumber Framework language file require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; nnFrameworkFunctions::loadLanguage('plg_system_nnframework'); } jimport('joomla.filesystem.file'); // If controller.php exists, assume this is K2 v3 define('NN_K2_VERSION', JFile::exists(JPATH_ADMINISTRATOR . '/components/com_k2/controller.php') ? 3 : 2); /** * Plugin that loads Framework */ class plgSystemNNFramework extends JPlugin { public function onAfterRoute() { $this->updateDownloadKey(); $this->loadSearchHelper(); if (!JFactory::getApplication()->input->getInt('nn_qp', 0)) { return;