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); } $attr = ''; $attr .= ' size="' . (int) $size . '"'; $attr .= $multiple ? ' multiple="multiple"' : ''; return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); }
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 getGeo() { if (!$this->geo) { require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; $func = new NNFrameworkFunctions(); $this->geo = json_decode($func->getContents('http://www.geoplugin.net/json.gp?ip=' . $_SERVER['REMOTE_ADDR'])); } return $this->geo; }
function __construct() { $url = JFactory::getApplication()->input->getString('url', ''); require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php'; $func = new NNFrameworkFunctions(); if ($url) { echo $func->getByUrl($url); die; } $file = JFactory::getApplication()->input->getString('file', ''); // only allow files that have .inc.php in the file name if (!$file || strpos($file, '.inc.php') === false) { die; } $folder = JFactory::getApplication()->input->getString('folder', ''); if ($folder) { $file = implode('/', explode('.', $folder)) . '/' . $file; } $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/modulesanywhere/modulesanywhere.inc.php', 'plugins/editors-xtd/snippets/snippets.inc.php', 'plugins/editors-xtd/sourcerer/sourcerer.inc.php'); 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'); 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'); if (version_compare(JVERSION, '3.2', 'l')) { JFactory::getApplication()->render(); } else { 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; }
/** * Download and install */ function install($id, $url) { if (!is_string($url)) { return JText::_('NNEM_ERROR_NO_VALID_URL'); } $url = 'http://' . str_replace('http://', '', $url); if (!($target = JInstallerHelper::downloadPackage($url))) { return JText::_('NNEM_ERROR_CANNOT_DOWNLOAD_FILE'); } $target = JFactory::getConfig()->get('tmp_path') . '/' . $target; NNFrameworkFunctions::loadLanguage('com_installer', JPATH_ADMINISTRATOR); jimport('joomla.installer.installer'); jimport('joomla.installer.helper'); // Get an installer instance $installer = JInstaller::getInstance(); // Unpack the package $package = JInstallerHelper::unpack($target); // Cleanup the install files if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile']; } JInstallerHelper::cleanupInstall($package['packagefile'], $package['packagefile']); // Install the package if (!$installer->install($package['dir'])) { // There was an error installing the package return JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); } return true; }
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() { $this->params = $this->element->attributes(); if (!NNFrameworkFunctions::extensionInstalled('flexicontent')) { return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>'; } $group = $this->def('group', 'categories'); $this->db = JFactory::getDBO(); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables)) { return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>'; } if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->def('size'); $multiple = $this->def('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); } else { $attr = ''; $attr .= ' size="' . (int) $size . '"'; $attr .= $multiple ? ' multiple="multiple"' : ''; return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id); } }
protected function getInput() { if (!NNFrameworkFunctions::extensionInstalled('mijoshop')) { return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>'; } $this->params = $this->element->attributes(); $group = $this->def('group', 'categories'); $this->db = JFactory::getDBO(); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'mijoshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) { return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>'; } $this->params = $this->element->attributes(); $parameters = NNParameters::getInstance(); $params = $parameters->getPluginParams('nnframework'); $this->max_list_count = $params->max_list_count; 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->def('size'); $multiple = $this->def('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); } else { $attr = ''; $attr .= ' size="' . (int) $size . '"'; $attr .= $multiple ? ' multiple="multiple"' : ''; return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id); } }
function loadLanguage($extension, $admin = 1) { if (!$extension) { return; } NNFrameworkFunctions::loadLanguage($extension, $admin ? JPATH_ADMINISTRATOR : JPATH_SITE); }
protected function getInput() { 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'); $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::_('NN_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); } NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/simplecategories.min.js'); $html = array(); $html[] = '<div class="nn_simplecategory">'; $html[] = '<input type="hidden" class="nn_simplecategory_value" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '" checked="checked" />'; $html[] = '<div class="nn_simplecategory_select">'; $html[] = NNHtml::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="nntoggler nntoggler_nofx" style="display:none;">'; $html[] = '<div class="nn_simplecategory_new">'; $html[] = '<input type="text" id="' . $this->id . '_new" value="" placeholder="' . JText::_('NN_NEW_CATEGORY_ENTER') . '" />'; $html[] = '</div>'; $html[] = '</div>'; $html[] = '</div>'; return implode('', $html); }
/** * 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; } $user = JFactory::getUser(); if ($user->get('guest') || !$user->authorise('core.edit', 'com_content') && !$user->authorise('core.create', 'com_content')) { 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=popup.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; }
function clean() { if (!($type = $this->getCleanType())) { return; } // Load language for messaging NNFrameworkFunctions::loadLanguage('mod_cachecleaner'); $this->purgeCache($type); // only handle messages in html if (JFactory::getDocument()->getType() != 'html') { return false; } $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'); } }
protected function getInput() { $this->params = $this->element->attributes(); JHtml::_('jquery.framework'); NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/script.min.js'); if ($file = $this->get('file')) { $label = $this->get('label', 'the main extension'); NNFieldDependency::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; 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)) . ')'; NNFieldDependency::setMessage($file, $label); return ''; }
protected function getInput() { $this->params = $this->element->attributes(); if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) { return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>'; } $group = $this->def('group', 'categories'); $this->db = JFactory::getDBO(); $tables = $this->db->getTableList(); if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) { return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>'; } $query = $this->db->getQuery(true); $query->select('config')->from('#__virtuemart_configs')->where('virtuemart_config_id = 1'); $this->db->setQuery($query); $config = $this->db->loadResult(); $lang = substr($config, strpos($config, 'vmlang=')); $lang = substr($lang, 0, strpos($lang, '|')); if (preg_match('#"([^"]*_[^"]*)"#', $lang, $lang)) { $this->lang = $lang['1']; } else { $this->lang = 'en_gb'; } if (!is_array($this->value)) { $this->value = explode(',', $this->value); } $options = $this->{'get' . $group}(); $size = (int) $this->def('size'); $multiple = $this->def('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('hikashop')) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</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() . 'hikashop_' . ($group == 'products' ? 'product' : 'category'), $tables)) { return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</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'; 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); } }
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/ajax.php', 'administrator/modules/mod_addtomenu/popup.php', 'media/rereplacer/images/popup.php', 'plugins/editors-xtd/articlesanywhere/popup.php', 'plugins/editors-xtd/contenttemplater/popup.php', 'plugins/editors-xtd/dummycontent/popup.php', 'plugins/editors-xtd/modals/popup.php', 'plugins/editors-xtd/modulesanywhere/popup.php', 'plugins/editors-xtd/sliders/popup.php', 'plugins/editors-xtd/snippets/popup.php', 'plugins/editors-xtd/sourcerer/popup.php', 'plugins/editors-xtd/tabs/popup.php', 'plugins/editors-xtd/tooltips/popup.php', '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', 'com_content'); 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; }
protected function getInput() { $this->params = $this->element->attributes(); $size = (int) $this->get('size'); $multiple = $this->get('multiple', 0); NNFrameworkFunctions::loadLanguage('com_menus', JPATH_ADMINISTRATOR); $options = $this->getMenuItems(); require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php'; return NNHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple); }
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); }
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); }
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"' : ''; JHtml::stylesheet('nnframework/color.min.css', false, true); 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 . '>'; }
function __construct() { $this->db = JFactory::getDBO(); $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['redshop'] = NNFrameworkFunctions::extensionInstalled('redshop'); $this->has['virtuemart'] = NNFrameworkFunctions::extensionInstalled('virtuemart'); $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', 'RedShop_PageTypes', 'RedShop_Categories', 'RedShop_Products', 'VirtueMart_PageTypes', 'VirtueMart_Categories', 'VirtueMart_Products', 'PHP'); $this->setIdNames(); $this->classes = array(); }
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); NNFrameworkFunctions::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::sprintf('CC_SYSTEM_PLUGIN_NOT_ENABLED', '<a href="index.php?option=com_plugins&filter_type=system&filter_folder=system&search=cache cleaner&filter_search=cache cleaner">', '</a>'))) . "';\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); }
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); }
function getInput($name, $id, $value, $params, $children, $j15 = 0) { $this->params = $params; $description = $value != '' ? $value : $this->def('description'); // variables $v1 = JText::_($this->def('var1')); $v2 = JText::_($this->def('var2')); $v3 = JText::_($this->def('var3')); $v4 = JText::_($this->def('var4')); $v5 = JText::_($this->def('var5')); $html = JText::sprintf($description, $v1, $v2, $v3, $v4, $v5); $html = trim(NNFrameworkFunctions::html_entity_decoder($html)); $html = str_replace('"', '"', $html); $html = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $html); if (!$j15 && ($this->def('label') || $value)) { // display as label on Joomla 1.6+ if there is more than just a description $html = '<fieldset id="' . $id . '" class="radio"><label>' . $html . '</label></fieldset>'; } return $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>'; }
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', 'geopostalcodes' => 'Geo.Postalcodes', '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(); }
protected function getLabel() { $this->params = $this->element->attributes(); $resize = $this->get('resize', 0); $label = NNText::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'); NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/script.min.js'); JHtml::stylesheet('nnframework/style.min.css', false, true); $html .= '<br /><span role="button" class="nn_resize_textarea nn_maximize"' . ' data-id="' . $this->id . '" data-min="' . $this->get('height', 80) . '" data-max="' . $resize . '">' . '<span class="nn_resize_textarea_maximize">' . '[ + ]' . '</span>' . '<span class="nn_resize_textarea_minimize">' . '[ - ]' . '</span>' . '</span>'; } $html .= '</label>'; return $html; }