Exemple #1
0
 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');
     }
 }
Exemple #2
0
 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=&quot;javascript&quot; type=&quot;text/javascript&quot;><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);
 }
Exemple #3
0
 /**
  * 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;
 }
 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;
 }
Exemple #5
0
 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);
 }
Exemple #6
0
 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);
 }
Exemple #7
0
 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=&quot;javascript&quot; type=&quot;text/javascript&quot;><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);
 }
 /**
  * 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);
 }
Exemple #9
0
/**
 * 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 -->';
Exemple #10
0
 * 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>)?)';
/**
 * 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;
Exemple #12
0
 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);
 }
 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_modulesanywhere');
     nnFrameworkFunctions::loadLanguage('plg_system_modulesanywhere');
     nnFrameworkFunctions::loadLanguage('com_modules');
     JHtml::stylesheet('nnframework/style.min.css', false, true);
     // Initialize some variables
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $option = 'modulesanywhere';
     $filter_order = $app->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'm.position', 'string');
     $filter_order_Dir = $app->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'string');
     $filter_state = $app->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'string');
     $filter_position = $app->getUserStateFromRequest($option . 'filter_position', 'filter_position', '', 'string');
     $filter_type = $app->getUserStateFromRequest($option . 'filter_type', 'filter_type', '', 'string');
     $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('modulesanywhere_limitstart', 'limitstart', 0, 'int');
     $where[] = 'm.client_id = 0';
     // used by filter
     if ($filter_position) {
         if ($filter_position == 'none') {
             $where[] = 'm.position = ""';
         } else {
             $where[] = 'm.position = ' . $db->quote($filter_position);
         }
     }
     if ($filter_type) {
         $where[] = 'm.module = ' . $db->quote($filter_type);
     }
     if ($filter_search) {
         $where[] = 'LOWER( m.title ) LIKE ' . $db->quote('%' . $db->escape($filter_search, true) . '%', false);
     }
     if ($filter_state != '') {
         $where[] = 'm.published = ' . $filter_state;
     }
     $where = implode(' AND ', $where);
     if ($filter_order == 'm.ordering') {
         $orderby = 'm.position, m.ordering ' . $filter_order_Dir;
     } else {
         $orderby = $filter_order . ' ' . $filter_order_Dir . ', m.ordering ASC';
     }
     // get the total number of records
     $query->clear()->select('COUNT(DISTINCT m.id)')->from('#__modules AS m')->join('LEFT', '#__users AS u ON u.id = m.checked_out')->join('LEFT', '#__viewlevels AS g ON g.id = m.access')->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = m.id')->where($where);
     $db->setQuery($query);
     $total = $db->loadResult();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $query->clear()->select('m.*, u.name AS editor, g.title AS groupname, MIN( mm.menuid ) AS pages')->from('#__modules AS m')->join('LEFT', '#__users AS u ON u.id = m.checked_out')->join('LEFT', '#__viewlevels AS g ON g.id = m.access')->join('LEFT', '#__modules_menu AS mm ON mm.moduleid = m.id')->where($where)->group('m.id')->order($orderby);
     $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
     $rows = $db->loadObjectList();
     if ($db->getErrorNum()) {
         echo $db->stderr();
         return false;
     }
     // get list of Positions for dropdown filter
     $query->clear()->select('m.position AS value, m.position AS text')->from('#__modules as m')->where('m.client_id = 0')->where('m.position != ""')->group('m.position')->order('m.position');
     $db->setQuery($query);
     $positions = $db->loadObjectList();
     array_unshift($positions, $options[] = JHtml::_('select.option', 'none', ':: ' . JText::_('JNONE') . ' ::'));
     array_unshift($positions, JHtml::_('select.option', '', JText::_('COM_MODULES_OPTION_SELECT_POSITION')));
     $lists['position'] = JHtml::_('select.genericlist', $positions, 'filter_position', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $filter_position);
     // get list of Types for dropdown filter
     $query->clear()->select('e.element AS value, e.name AS text')->from('#__extensions as e')->where('e.client_id = 0')->where('type = ' . $db->quote('module'))->join('LEFT', '#__modules as m ON m.module = e.element AND m.client_id = e.client_id')->where('m.module IS NOT NULL')->group('e.element, e.name');
     $db->setQuery($query);
     $types = $db->loadObjectList();
     foreach ($types as $i => $type) {
         $extension = $type->value;
         $source = JPATH_SITE . '/modules/' . $extension;
         nnFrameworkFunctions::loadLanguage($extension . '.sys', JPATH_SITE) || nnFrameworkFunctions::loadLanguage($extension . '.sys', $source);
         $types[$i]->text = JText::_($type->text);
     }
     JArrayHelper::sortObjects($types, 'text', 1, true, JFactory::getLanguage()->getLocale());
     array_unshift($types, JHtml::_('select.option', '', JText::_('COM_MODULES_OPTION_SELECT_MODULE')));
     $lists['type'] = JHtml::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $filter_type);
     // state filter
     $states = array();
     $states[] = JHtml::_('select.option', '', JText::_('JOPTION_SELECT_PUBLISHED'));
     $states[] = JHtml::_('select.option', '1', JText::_('JPUBLISHED'));
     $states[] = JHtml::_('select.option', '0', JText::_('JUNPUBLISHED'));
     $states[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
     $lists['state'] = JHtml::_('select.genericlist', $states, 'filter_state', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['filter_search'] = $filter_search;
     $this->outputHTML($params, $rows, $pageNav, $lists);
 }
Exemple #14
0
 * Plugin Helper File
 *
 * @package         Snippets
 * @version         3.5.5
 *
 * @author          Peter van Westen <*****@*****.**>
 * @link            http://www.nonumber.nl
 * @copyright       Copyright © 2014 NoNumber All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
defined('_JEXEC') or die;
// Load common functions
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_snippets');
/**
 * System Plugin that places a Snippets code block into the text
 */
class plgSystemSnippetsHelper
{
    public function __construct(&$params)
    {
        $this->option = JFactory::getApplication()->input->get('option');
        $this->params = $params;
        $this->params->comment_start = '<!-- START: Snippets -->';
        $this->params->comment_end = '<!-- END: Snippets -->';
        $this->params->message_start = '<!--  Snippets Message: ';
        $this->params->message_end = ' -->';
        $bts = '((?:<p(?: [^>]*)?>\\s*)?)';
        $bte = '((?:\\s*</p>)?)';
Exemple #15
0
/**
 * Plugin Helper File
 *
 * @package         CDN for Joomla!
 * @version         3.4.0
 *
 * @author          Peter van Westen <*****@*****.**>
 * @link            http://www.nonumber.nl
 * @copyright       Copyright © 2014 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';
nnFrameworkFunctions::loadLanguage('plg_system_cdnforjoomla');
/**
 * Plugin that replaces media urls with CDN urls
 */
class plgSystemCDNforJoomlaHelper
{
    var $params = null;
    var $pass = false;
    public function __construct(&$params)
    {
        $this->params = $params;
        $hascdn = preg_replace(array('#^.*\\://#', '#/$#'), '', $this->params->cdn);
        // return if cdn field has no value
        if (!$hascdn) {
            return;
        }
    function outputHTML(&$params, &$rows, &$page, &$lists)
    {
        JHtml::_('behavior.tooltip');
        JHtml::_('formbehavior.chosen', 'select');
        $config = JComponentHelper::getParams('com_snippets');
        $tag = $config->get('tag', 'snippet');
        // Load component language
        require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
        nnFrameworkFunctions::loadLanguage('plg_system_nnframework');
        nnFrameworkFunctions::loadLanguage('com_snippets');
        // Add scripts and styles
        $script = "\n\t\t\tfunction snippets_jInsertEditorText( id ) {\n\t\t\t\tf = document.getElementById( 'adminForm' );\n\t\t\t\tstr = '{" . $tag . " '+id+'}';\n\t\t\t\twindow.parent.jInsertEditorText( str, '" . JFactory::getApplication()->input->getString('name', 'text') . "' );\n\t\t\t\twindow.parent.SqueezeBox.close();\n\t\t\t}\n\t\t";
        JFactory::getDocument()->addScriptDeclaration($script);
        ?>
		<div class="header">
			<div class="container-fluid">
				<h1 CLASS="page-title"><?php 
        echo JText::_('SNIPPETS');
        ?>
</h1>

			</div>
		</div>

		<div style="margin-bottom: 20px"></div>

		<div class="container-fluid container-main">
			<form action="" method="post" name="adminForm" id="adminForm">
				<div class="well well-small">
					<?php 
        echo html_entity_decode(JText::_('SNP_CLICK_ON_ONE_OF_THE_SNIPPETS'), ENT_COMPAT, 'UTF-8');
        ?>
				</div>

				<div style="clear:both;"></div>

				<div id="filter-bar" class="btn-toolbar">
					<div class="filter-search btn-group pull-left">
						<label for="filter_search" class="element-invisible"><?php 
        echo JText::_('JSEARCH_FILTER');
        ?>
</label>
						<input type="text" name="filter_search" id="filter_search" placeholder="<?php 
        echo JText::_('JSEARCH_FILTER');
        ?>
" value="<?php 
        echo $lists['filter_search'];
        ?>
" title="<?php 
        echo JText::_('JSEARCH_FILTER');
        ?>
" />
					</div>
					<div class="btn-group pull-left hidden-phone">
						<button class="btn" type="submit" rel="tooltip" title="<?php 
        echo JText::_('JSEARCH_FILTER_SUBMIT');
        ?>
">
							<span class="icon-search"></span></button>
						<button class="btn" type="button" rel="tooltip" title="<?php 
        echo JText::_('JSEARCH_FILTER_CLEAR');
        ?>
" onclick="document.id('filter_search').value='';this.form.submit();">
							<span class="icon-remove"></span></button>
					</div>

					<div class="btn-group pull-right hidden-phone">
						<?php 
        echo $lists['state'];
        ?>
					</div>
				</div>

				<table class="table table-striped">
					<thead>
						<tr>
							<th width="1%" class="nowrap center">
								<?php 
        echo JHtml::_('grid.sort', 'JSTATUS', 'published', @$lists['order_Dir'], @$lists['order']);
        ?>
							</th>
							<th width="15%" class="title">
								<?php 
        echo JHtml::_('grid.sort', 'SNP_SNIPPET_ID', 'alias', $lists['order_Dir'], $lists['order']);
        ?>
							</th>
							<th class="title">
								<?php 
        echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'name', $lists['order_Dir'], $lists['order']);
        ?>
							</th>
							<th class="title">
								<?php 
        echo JHtml::_('grid.sort', 'JGLOBAL_DESCRIPTION', 'description', $lists['order_Dir'], $lists['order']);
        ?>
							</th>
							<th width="5%" class="nowrap center">
								<?php 
        echo JText::_('NN_FRONTEND');
        ?>
							</th>
							<th width="5%" class="nowrap center">
								<?php 
        echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'id', $lists['order_Dir'], $lists['order']);
        ?>
							</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="7">
								<?php 
        $url = 'index.php?nn_qp=1&folder=plugins.editors-xtd.snippets&file=snippets.inc.php&name=' . JFactory::getApplication()->input->get('name', 'text');
        $pagination = $page->getListFooter();
        $pagination = preg_replace('#index\\.php[^"\\?]*\\?([^"]*)#i', $url . '&\\1', $pagination);
        echo $pagination;
        ?>
							</td>
						</tr>
					</tfoot>

					<tbody>
						<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $item =& $rows[$i];
            if (!$item->button_enable || $item->button_enable == 2 && JFactory::getApplication()->isSite()) {
                continue;
            }
            if ($item->button_enable == 1) {
                $enable_in_frontend = '<span class="btn btn-micro disabled" rel="tooltip" title="' . JText::_('NN_ENABLE_IN_FRONTEND') . '"><span class="icon-publish"></span></a>';
            } else {
                $enable_in_frontend = '<span class="btn btn-micro disabled" rel="tooltip" title="' . JText::_('NN_NOT') . ' ' . JText::_('NN_ENABLE_IN_FRONTEND') . '"><span class="icon-cancel"></span></a>';
            }
            ?>
							<tr class="<?php 
            echo "row{$k}";
            ?>
">
								<td class="center">
									<?php 
            echo JHtml::_('jgrid.published', $item->published, $i, 'list.', 0);
            ?>
								</td>
								<td>
									<?php 
            echo '<label class="hasTip" title="{' . htmlspecialchars($tag) . ' ' . htmlspecialchars($item->alias) . '}"><a href="javascript://" onclick="snippets_jInsertEditorText( \'' . addslashes(htmlspecialchars($item->alias)) . '\' )">' . htmlspecialchars($item->alias) . '</a></label>';
            ?>
								</td>
								<td>
									<?php 
            echo htmlspecialchars(str_replace(JURI::root(), '', $item->name));
            ?>
								</td>
								<td>
									<?php 
            $description = explode('---', $item->description);
            $descr = trim($description['0']);
            if (isset($description['1'])) {
                $descr = '<span class="hasTip" title="' . makeTooltipSafe(trim($descr) . '::' . trim($description['1'])) . '">' . $descr . '</span>';
            }
            echo $descr;
            ?>
								</td>
								<td class="center">
									<?php 
            echo $enable_in_frontend;
            ?>
								</td>
								<td class="center">
									<?php 
            echo $item->id;
            ?>
								</td>
							</tr>
							<?php 
            $k = 1 - $k;
        }
        ?>
					</tbody>
				</table>
				<input type="hidden" name="name" value="<?php 
        echo JFactory::getApplication()->input->getString('name', 'text');
        ?>
" />
				<input type="hidden" name="client" value="<?php 
        echo JFactory::getApplication()->getClientId();
        ?>
" />
				<input type="hidden" name="filter_order" value="<?php 
        echo $lists['order'];
        ?>
" />
				<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $lists['order_Dir'];
        ?>
" />
			</form>
		</div>
	<?php 
    }