function save() { $mainframe =& JFactory::getApplication(); $row =& JTable::getInstance('K2UserGroup', 'Table'); if (!$row->bind(JRequest::get('post'))) { $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error'); } if (!$row->check()) { $mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error'); } if (!$row->store()) { $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error'); } $cache =& JFactory::getCache('com_k2'); $cache->clean(); switch (JRequest::getCmd('task')) { case 'apply': $msg = JText::_('Changes to User Group saved'); $link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id; break; case 'save': default: $msg = JText::_('User Group Saved'); $link = 'index.php?option=com_k2&view=userGroups'; break; } $mainframe->redirect($link, $msg); }
/** * get list articles */ public static function getList($params) { $list = array(); if ($params->get('enable_cache')) { $cache =& JFactory::getCache('mod_ice_carousel'); $cache->setCaching(true); $cache->setLifeTime($params->get('cache_time', 15) * 60); $list = $cache->get(array('modIceCarousel', 'getGroupObject'), array($params)); } else { $list = self::getGroupObject($params); } if ($list) { $grouped = false; $article_grouping = $params->get('article_grouping', 'none'); $article_grouping_direction = $params->get('article_grouping_direction', 'ksort'); $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx')); $item_heading = $params->get('item_heading'); if ($article_grouping !== 'none') { $grouped = true; switch ($article_grouping) { case 'year': case 'month_year': $list = self::groupByDate($list, $article_grouping, $article_grouping_direction, $params->get('month_year_format', 'F Y')); break; case 'author': case 'category_title': $list = self::groupBy($list, $article_grouping, $article_grouping_direction); break; default: break; } } } return $list; }
public function postflight($type, $parent) { // Clear Joomla system cache. /** @var JCache|JCacheController $cache */ $cache = JFactory::getCache(); $cache->clean('_system'); // Clear Gantry5 cache. $path = JFactory::getConfig()->get('cache_path', JPATH_SITE . '/cache') . '/gantry5'; if (is_dir($path)) { JFolder::delete($path); } // Make sure that PHP has the latest data of the files. clearstatcache(); // Remove all compiled files from opcode cache. if (function_exists('opcache_reset')) { @opcache_reset(); } elseif (function_exists('apc_clear_cache')) { @apc_clear_cache(); } if ($type == 'uninstall') { return true; } /** @var JInstallerAdapter $parent */ $manifest = $parent->getManifest(); // Enable and lock extensions to prevent uninstalling them individually. $this->prepareExtensions($manifest, 1); // Make sure that all file formats used by Gantry 5 are editable from template manager. $this->adjustTemplateSettings(); return true; }
/** * @return object A function cache object */ function &getCache(&$sitemap) { $cache =& JFactory::getCache('com_xmap_' . $sitemap->id); $cache->setCaching($sitemap->usecache); $cache->setLifeTime($sitemap->cachelifetime); return $cache; }
public function __construct($groupName) { $this->cache = JFactory::getCache($groupName, 'output'); $handler = 'output'; $options = array('storage' => 'file', 'defaultgroup' => $groupName, 'locking' => true, 'locktime' => 15, 'checkTime' => false, 'caching' => true); $this->cache = JCache::getInstance($handler, $options); }
public function __construct() { $app = JFactory::getApplication(); $this->params = $app->getTemplate(true)->params; $this->cache = JFactory::getCache(self::CACHEKEY, ''); $this->cache->setCaching(true); }
/** * Get a parsed XML Feed Source * * @param string $url Url for feed source. * @param integer $cache_time Time to cache feed for (using internal cache mechanism). * * @return mixed SimplePie parsed object on success, false on failure. * * @since 12.2 * @deprecated 4.0 Use JFeedFactory($url) instead. * * @note In 3.2 will be proxied to JFeedFactory() */ public static function getFeedParser($url, $cache_time = 0) { JLog::add(__METHOD__ . ' is deprecated. Use JFeedFactory() or supply Simple Pie instead.', JLog::WARNING, 'deprecated'); $cache = JFactory::getCache('feed_parser', 'callback'); if ($cache_time > 0) { $cache->setLifeTime($cache_time); } $simplepie = new SimplePie(null, null, 0); $simplepie->enable_cache(false); $simplepie->set_feed_url($url); $simplepie->force_feed(true); $contents = $cache->get(array($simplepie, 'init'), null, false, false); if ($contents) { return $simplepie; } JLog::add(JText::_('JLIB_UTIL_ERROR_LOADING_FEED_DATA'), JLog::WARNING, 'jerror'); return false; }
/** * Constructor * * Prevent creating instances of this class by making the contructor private * * @param object An optional KConfig object with configuration options */ public function __construct(KConfig $config) { parent::__construct($config); if (JFactory::getConfig()->getValue('config.caching')) { $this->_cache = JFactory::getCache('template', 'output'); } }
public function postflight($type, $parent) { $this->fixUpdateSite(); // Clear Joomla system cache. /** @var JCache|JCacheController $cache */ $cache = JFactory::getCache(); $cache->clean('_system'); // Remove all compiled files from APC cache. if (function_exists('apc_clear_cache')) { @apc_clear_cache(); } if ($type == 'uninstall') { return true; } $this->enablePlugin('system', 'kunena'); $this->enablePlugin('quickicon', 'kunena'); $app = JFactory::getApplication(); if (version_compare(JVERSION, '3.0', '>')) { $modal = <<<EOS <div id="kunena-modal" class="modal hide fade"><div class="modal-body"></div></div><script>jQuery('#kunena-modal').remove().prependTo('body').modal({backdrop: 'static', keyboard: false, remote: '{$this->makeRoute('index.php?option=com_kunena&view=install&format=raw')}'})</script> EOS; } else { $modal = "<script>window.addEvent('domready',function(){SqueezeBox.open('{$this->makeRoute('index.php?option=com_kunena&view=install&tmpl=component')}',{size:{x:530,y:140},sizeLoading:{x:530,y:140},closable:false,handler:'iframe'});});</script>"; } $app->enqueueMessage('Installing Kunena... ' . $modal); return true; }
/** * Logic to remove */ function remove() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // Get the model $model = $this->getModel('groups'); // Get the selected items $cid = JRequest::getVar('cid', array(0), 'post', 'array'); // Force array elements to be integers JArrayHelper::toInteger($cid, array(0)); $msg = ''; // No items are selected if (!is_array($cid) || count($cid) < 1) { JError::raiseWarning(500, JText::_('SELECT ITEM DELETE')); } else { $model->remove($cid); $total = count($cid); $msg = JText::sprintf('RST_GROUPS_DELETED', $total); // Clean the cache, if any $cache =& JFactory::getCache('com_rsticketspro'); $cache->clean(); } // Redirect $this->setRedirect('index.php?option=com_rsticketspro&view=groups', $msg); }
private function getBalance() { $cache = JFactory::getCache('paypal', 'output'); $cache->setCaching(1); $cache->setLifeTime($this->params->get('cache', 60) * 60); $key = md5($this->params->toString()); if (!($result = $cache->get($key))) { try { $http = JHttpFactory::getHttp(); $data = array('USER' => $this->params->get('apiuser'), 'PWD' => $this->params->get('apipw'), 'SIGNATURE' => $this->params->get('apisig'), 'VERSION' => '112', 'METHOD' => 'GetBalance'); $result = $http->post($this->url, $data); } catch (Exception $e) { JFactory::getApplication()->enqueueMessage($e->getMessage()); return $this->output = JText::_('ERROR'); } $cache->store($result, $key); } if ($result->code != 200) { $msg = __CLASS__ . ' HTTP-Status ' . JHtml::_('link', 'http://wikipedia.org/wiki/List_of_HTTP_status_codes#' . $result->code, $result->code, array('target' => '_blank')); JFactory::getApplication()->enqueueMessage($msg, 'error'); return $this->output = JText::_('ERROR'); } parse_str($result->body, $result->body); if (!isset($result->body['ACK']) || $result->body['ACK'] != 'Success') { return $this->output = $result->body['L_SHORTMESSAGE0']; } $this->success = true; $this->output = $result->body['L_AMT0'] . ' ' . $result->body['L_CURRENCYCODE0']; }
public function onContentPrepare($context, $article, $params, $page = 0) { //running from the backend if (JFactory::getApplication()->isAdmin()) { return false; } if (strpos($context, 'productlist') !== false) { return; } if ($this->_cleaned == false) { $cache = JFactory::getCache(); $cache->clean('com_content'); $cache->clean('com_j2store'); $this->_cleaned = true; } $j2params = J2Store::config(); $placement = $j2params->get('addtocart_placement', 'default'); if (strpos($context, 'com_content') !== false) { if ($placement == 'default' || $placement == 'both') { $this->defaultPosition($context, $article, $params, $page); } } if ($placement == 'tag' || $placement == 'both') { $this->withinArticle($context, $article, $params, $page); } $this->processShortCodes($context, $article, $params, $page); }
/** * Pulls together data and options and outputs the build feed. * Header and mime is automaticly set. * * @access public * @uses JCache * @see JFactory::getCache() * @see CKunenaRSSData::fetch() * @see self::buildFeed() * @return void */ public function display() { $cache = JFactory::getCache('com_kunena_rss'); if ($this->caching) { $cache->setCaching(1); $cache->setLifeTime($this->caching); } // Fetch data $data = $cache->call(array('CKunenaRSSData', 'fetch'), $this->type, $this->incl_cat, $this->excl_cat, $this->limit, $this->timelimit); // Set datas document header $this->document = $this->document->getInstance('feed'); $this->document->setLink('/'); $this->document->setTitle($this->app->getCfg('sitename') . ' - Forum'); $this->document->setDescription('Kunena Site Syndication'); $this->document->setGenerator('Kunena 1.6'); // Image link for feed $link = JURI::root(); $rss_url = $this->uri->toString(array('scheme', 'host', 'port')) . $_SERVER["REQUEST_URI"]; $rss_icon = KUNENA_URLICONSPATH . 'rss.png'; // Create image for feed $image = new JFeedImage(); $image->title = $this->document->getTitle(); $image->url = $rss_icon; $image->link = $link; $image->description = $this->document->getDescription(); $this->document->image = $image; $this->buildFeed($data); // Render the feed echo $this->document->render(); }
/** * Display the view */ function display() { $document =& JFactory::getDocument(); $viewName = str_replace('FabrikControllerVisualization', '', get_class($this)); $viewType = $document->getType(); // Set the default view name from the Request $view =& $this->getView($viewName, $viewType); //create a form view as well to render the add event form. $view->_formView =& $this->getView('Form', $viewType); $formModel =& $this->getModel('Form'); $view->_formView->setModel($formModel, true); // Push a model into the view $model =& $this->getModel($viewName); if (!JError::isError($model)) { //$model->setAdmin( false); $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); $post = JRequest::get('post'); //build unique cache id on url, post and user id $user =& JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache =& JFactory::getCache('com_fabrik', 'view'); echo $cache->get($view, 'display', $cacheid); }
function onProfileDisplay() { JPlugin::loadLanguage('plg_community_mygoogleads', JPATH_ADMINISTRATOR); $config = CFactory::getConfig(); $config = CFactory::getConfig(); $this->loadUserParams(); $uri = JURI::base(); $user = CFactory::getRequestUser(); $document = JFactory::getDocument(); $css = $uri . 'plugins/community/mygoogleads/mygoogleads/style.css'; $document->addStyleSheet($css); $googleCode = $this->userparams->get('googleCode'); $content = ''; if (!empty($googleCode)) { $mainframe = JFactory::getApplication(); $caching = $this->params->get('cache', 1); if ($caching) { $caching = $mainframe->getCfg('caching'); } $cache = JFactory::getCache('plgCommunityMyGoogleAds'); $cache->setCaching($caching); $callback = array('plgCommunityMyGoogleAds', '_getGoogleAdsHTML'); $content = $cache->call($callback, $googleCode, $user->id); } else { // $content = "<div class=\"icon-nopost\"><img src=\"".JURI::base()."components/com_community/assets/error.gif\" alt=\"\" /></div>"; $content .= "<div class=\"content-nopost\">" . JText::_('PLG_GOOGLE_ADS_NOT_SET') . "</div>"; } return $content; }
protected function getMenuItems() { //Cache this basd on access level $conf =& JFactory::getConfig(); if ($conf->getValue('config.caching') && $this->args["module_cache"]) { $user =& JFactory::getUser(); $cache =& JFactory::getCache('mod_roknavmenu'); $cache->setCaching(true); $args = array($this->args); $checksum = md5(implode(',',$this->args)); $menuitems = $cache->get(array($this, 'getFullMenuItems'), $args, 'mod_roknavmenu-'.$user->get('aid', 0).'-'.$checksum); } else { $menuitems = $this->getFullMenuItems($this->args); } $jmenu = JSite::getMenu(); $active = $jmenu->getActive(); if (is_object($active)){ if (array_key_exists($active->id, $menuitems)){ $this->current_node = $active->id; } } $this->populateActiveBranch($menuitems); return $menuitems; }
/** * Display the view */ function display($model = null) { $document = JFactory::getDocument(); $viewName = JRequest::getVar('view', 'list', 'default', 'cmd'); $modelName = $viewName; $layout = JRequest::getWord('layout', 'default'); $viewType = $document->getType(); // Set the default view name from the Request $view = $this->getView($viewName, $viewType); $view->setLayout($layout); // Push a model into the view if (is_null($model)) { $model = $this->getModel($modelName, 'FabrikFEModel'); } if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); $post = JRequest::get('post'); //build unique cache id on url, post and user id $user = JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); // f3 cache with raw view gives error if (in_array(JRequest::getCmd('format'), array('raw', 'csv', 'pdf', 'json', 'fabrikfeed'))) { $view->display(); } else { $cache->get($view, 'display', $cacheid); } }
function getList($params) { global $mainframe; $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $temp = JRequest::getString('id'); $temp = explode(':', $temp); $id = $temp[0]; $aid = $user->get('aid', 0); $showDate = $params->get('showDate', 0); $conf =& JFactory::getConfig(); if ($option == 'com_content' && $view == 'article' && $id) { if ($params->get('cache_items', 0) == 1 && $conf->getValue('config.caching')) { $cache =& JFactory::getCache('mod_related_items', 'callback'); $cache->setLifeTime($params->get('cache_time', $conf->getValue('config.cachetime') * 60)); $cache->setCacheValidation(true); $related = $cache->get(array('modRelatedItemsHelper', 'getRelatedItemsById'), array($id, $aid, $showDate)); } else { $related = modRelatedItemsHelper::getRelatedItemsById($id, $aid, $showDate); } } else { $related = array(); } return $related; }
/** * Ajax function to save a new wall entry * * @param message A message that is submitted by the user * @param uniqueId The unique id for this group * * */ function onProfileDisplay() { //Load language file. JPlugin::loadLanguage('plg_community_myarticles', JPATH_ADMINISTRATOR); // Attach CSS $document = JFactory::getDocument(); $css = JURI::base() . 'plugins/community/myarticles/myarticles/style.css'; $document->addStyleSheet($css); if (JRequest::getVar('task', '', 'REQUEST') == 'app') { $app = 1; } else { $app = 0; } $user = CFactory::getRequestUser(); $userid = $user->id; $def_limit = $this->params->get('count', 10); $limit = JRequest::getVar('limit', $def_limit, 'REQUEST'); $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST'); $row = $this->getArticle($userid, $limitstart, $limit, $this->section); $cat = $this->getCatAlias(); $total = $this->countArticle($userid, $this->section); if ($this->params->get('hide_empty', 0) && !$total) { return ''; } $mainframe = JFactory::getApplication(); $caching = $this->params->get('cache', 1); if ($caching) { $caching = $mainframe->getCfg('caching'); } $cache = JFactory::getCache('plgCommunityMyArticles'); $cache->setCaching($caching); $callback = array('plgCommunityMyArticles', '_getArticleHTML'); $content = $cache->call($callback, $userid, $limit, $limitstart, $row, $app, $total, $cat, $this->params); return $content; }
function listevents() { list($year, $month, $day) = JEVHelper::getYMD(); $Itemid = JEVHelper::getItemid(); // get the view $document =& JFactory::getDocument(); $viewType = $document->getType(); $cfg =& JEVConfig::getInstance(); $theme = JEV_CommonFunctions::getJEventsViewName(); $view = "day"; $this->addViewPath($this->_basePath . DS . "views" . DS . $theme); $this->view =& $this->getView($view, $viewType, $theme, array('base_path' => $this->_basePath, "template_path" => $this->_basePath . DS . "views" . DS . $theme . DS . $view . DS . 'tmpl', "name" => $theme . DS . $view)); // Set the layout $this->view->setLayout('listevents'); $this->view->assign("Itemid", $Itemid); $this->view->assign("month", $month); $this->view->assign("day", $day); $this->view->assign("year", $year); $this->view->assign("task", $this->_task); // View caching logic -- simple... are we logged in? $cfg =& JEVConfig::getInstance(); $useCache = intval($cfg->get('com_cache', 0)); $user =& JFactory::getUser(); if ($user->get('id') || !$useCache) { $this->view->display(); } else { $cache =& JFactory::getCache(JEV_COM_COMPONENT, 'view'); $cache->get($this->view, 'display'); } }
function onProfileDisplay() { JPlugin::loadLanguage('plg_community_events', JPATH_ADMINISTRATOR); $config = CFactory::getConfig(); if (!$config->get('enableevents')) { return JText::_('PLG_EVENTS_EVENT_DISABLED'); } $document = JFactory::getDocument(); $mainframe = JFactory::getApplication(); $user = CFactory::getRequestUser(); $caching = $this->params->get('cache', 1); $model = CFactory::getModel('Events'); $my = CFactory::getUser(); $this->loadUserParams(); //CFactory::load( 'helpers' , 'event' ); $event = JTable::getInstance('Event', 'CTable'); $handler = CEventHelper::getHandler($event); $events = $model->getEvents(null, $user->id, $this->params->get('sorting', 'latest'), null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId(), $this->userparams->get('count', 5)); if ($this->params->get('hide_empty', 0) && !count($events)) { return ''; } if ($caching) { $caching = $mainframe->getCfg('caching'); } $creatable = $my->canCreateEvents(); $cache = JFactory::getCache('plgCommunityEvents'); $cache->setCaching($caching); $callback = array($this, '_getEventsHTML'); $content = $cache->call($callback, true, $events, $user, $config, $model->getEventsCount($user->id), $creatable); return $content; }
/** * Display module contents. */ public final function display() { // Load CSS only once if (static::$css) { $this->document->addStyleSheet(JURI::root(true) . static::$css); static::$css = null; } // Use caching also for registered users if enabled. if ($this->params->get('owncache', 0)) { /** @var $cache JCacheControllerOutput */ $cache = JFactory::getCache('com_kunena', 'output'); $me = KunenaFactory::getUser(); $cache->setLifeTime($this->params->get('cache_time', 180)); $hash = md5(serialize($this->params)); if ($cache->start("display.{$me->userid}.{$hash}", 'mod_kunenalatest')) { return; } } // Initialize Kunena. KunenaForum::setup(); // Display module. $this->_display(); // Store cached page. if (isset($cache)) { $cache->end(); } }
/** * Converts an amount from one currency into another using * the rate conversion table from the European Central Bank * * @param float $amountA * @param string $currA defaults to $vendor_currency * @param string $currB defaults to * @return mixed The converted amount when successful, false on failure */ function convert($amountA, $currA = '', $currB = '', $a2rC = true, $relatedCurrency = 'EUR') { // cache subfolder(group) 'convertECB', cache method: callback $cache = JFactory::getCache('convertECB', 'callback'); // save configured lifetime @($lifetime = $cache->lifetime); $cache->setLifeTime(360); // check 4 time per day // save cache conf $conf = JFactory::getConfig(); // check if cache is enabled in configuration $cacheactive = $conf->get('caching'); $cache->setCaching(1); //enable caching $globalCurrencyConverter = $cache->call(array('convertECB', 'getSetExchangeRates'), $this->document_address); // revert configuration $cache->setCaching($cacheactive); if (!$globalCurrencyConverter) { return $amountA; } else { $valA = isset($globalCurrencyConverter[$currA]) ? $globalCurrencyConverter[$currA] : 1.0; $valB = isset($globalCurrencyConverter[$currB]) ? $globalCurrencyConverter[$currB] : 1.0; $val = (double) $amountA * (double) $valB / (double) $valA; return $val; } }
static function getCurrentTemplate() { $cache = JFactory::getCache('com_rokcandy', ''); if (!($templates = $cache->get('templates'))) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id, home, template, params'); $query->from('#__template_styles'); $query->where('client_id = 0'); $db->setQuery($query); $templates = $db->loadObjectList('id'); foreach ($templates as &$template) { $registry = new JRegistry(); $registry->loadString($template->params); $template->params = $registry; // Create home element if ($template->home == '1' && !isset($templates[0])) { $templates[0] = clone $template; } } $cache->store($templates, 'templates'); } $template = $templates[0]; return $template->template; }
/** * Ajax function to save a new wall entry * * @param message A message that is submitted by the user * @param uniqueId The unique id for this group * **/ function onProfileDisplay() { JPlugin::loadLanguage('plg_community_myvideos', JPATH_ADMINISTRATOR); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $user = CFactory::getRequestUser(); $userid = $user->id; $this->loadUserParams(); $def_limit = $this->params->get('count', 10); $limit = JRequest::getVar('limit', $def_limit, 'REQUEST'); $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST'); $row = $this->getVideos($userid, $limitstart, $limit); $total = count($row); if ($this->params->get('hide_empty', 0) && !$total) { return ''; } $caching = $this->params->get('cache', 1); if ($caching) { $caching = $mainframe->getCfg('caching'); } $cache = JFactory::getCache('plgCommunityMyVideos'); $cache->setCaching($caching); $callback = array('plgCommunityMyVideos', '_getLatestVideosHTML'); $count = $this->userparams->get('count', $def_limit); $dbg = "<!--DEFLIMIT {$def_limit} USERPARAMLIMIT {$count}-->"; $content = $dbg . $cache->call($callback, $userid, $count, $limitstart, $row, $total); return $content; }
function save() { $mainframe = JFactory::getApplication(); $row = JTable::getInstance('K2UserGroup', 'Table'); if (!$row->bind(JRequest::get('post'))) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=usergroups'); } if (!$row->check()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=usergroup&cid=' . $row->id); } if (!$row->store()) { $mainframe->enqueueMessage($row->getError(), 'error'); $mainframe->redirect('index.php?option=com_k2&view=usergroups'); } $cache = JFactory::getCache('com_k2'); $cache->clean(); switch (JRequest::getCmd('task')) { case 'apply': $msg = JText::_('K2_CHANGES_TO_USER_GROUP_SAVED'); $link = 'index.php?option=com_k2&view=usergroup&cid=' . $row->id; break; case 'save': default: $msg = JText::_('K2_USER_GROUP_SAVED'); $link = 'index.php?option=com_k2&view=usergroups'; break; } $mainframe->enqueueMessage($msg); $mainframe->redirect($link); }
function plgSystemmyApiOpenGraph(&$subject, $config){ parent::__construct($subject, $config); if(!class_exists('plgSystemmyApiConnect')) return; $cache = & JFactory::getCache('plgSystemmyApiOpenGraph - FB Admins query'); $cache->setCaching( 1 ); $config =& JFactory::getConfig(); $connect_plugin =& JPluginHelper::getPlugin('system', 'myApiConnect'); $connect_params = new JParameter( $connect_plugin->params ); $plugin =& JPluginHelper::getPlugin('system', 'myApiOpenGraph'); $plugin_params = new JParameter( $plugin->params ); $db_admins = $cache->call( array( 'plgSystemmyApiOpenGraph', 'getFbAdmins')); $param_admins = ($plugin_params->get('fbadmins') != '') ? explode(',',$plugin_params->get('fbadmins')) : array(); $admins = array_merge($db_admins,$param_admins); $ogptags_default = array(); $ogptags_default['og:title'] = $config->getValue( 'config.sitename' ); $ogptags_default['og:type'] = 'website'; $ogptags_default['og:url'] = JURI::getInstance()->toString(); $ogptags_default['og:site_name'] = $config->getValue( 'config.sitename' ); $ogptags_default['fb:app_id'] = $connect_params->get('appId'); $ogptags_default['fb:admins'] = implode(',',$admins); if($plugin_params->get('ogimage') != '' && $plugin_params->get('ogimage') != -1) $ogptags_default['og:image'] = JURI::base().'images/'.$plugin_params->get('ogimage'); if($plugin_params->get('fbpageid') != '') $ogptags_default['fb:page_id'] = $plugin_params->get('fbpageid'); plgSystemmyApiOpenGraph::setTags($ogptags_default); }
/** * Obtain analytics information, as stored in cache * by checkAnalytics * */ public static function getData($options) { // main option: are we forcing update, or only using the cached data ? $options['forced'] = empty($options['forced']) ? 0 : $options['forced']; $sefConfig = Sh404sefFactory::getConfig(); $dataTypeString = str_replace('ga:', '', $sefConfig->analyticsDashboardDataType); // store options self::$_options = $options; // create cache Id and get cache object $cacheId = md5($dataTypeString . $options['accountId'] . $options['showFilters'] . $options['groupBy'] . $options['startDate'] . $options['endDate'] . $options['cpWidth'] . $options['report'] . $options['subrequest']); $cache = JFactory::getCache('sh404sef_analytics'); $cache->setLifetime(60); // cache result for 1 hours $cache->setCaching(1); // force caching on // empty cache if we are going to look for updates or if reports are disabled (so that next time // they enabled, we start wih fresh data if (self::$_options['forced'] || !$sefConfig->analyticsReportsEnabled) { // clean our cache $cache->remove($cacheId); } $response = $cache->get(array('Sh404sefHelperAnalytics', '_doCheck'), $args = array(), $cacheId); // return response, either dummy or from cache return $response; }
/** * Ajax function to save a new wall entry * * @param message A message that is submitted by the user * @param uniqueId The unique id for this group * **/ function onProfileDisplay() { JPlugin::loadLanguage('plg_community_mytaggedvideos', JPATH_ADMINISTRATOR); $mainframe = JFactory::getApplication(); // Attach CSS $document = JFactory::getDocument(); // $css = JURI::base() . 'plugins/community/myvideos/style.css'; // $document->addStyleSheet($css); $user = CFactory::getRequestUser(); $userid = $user->id; $this->loadUserParams(); $def_limit = $this->params->get('count', 10); $limit = JRequest::getVar('limit', $def_limit, 'REQUEST'); $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST'); $row = $this->getVideos($userid); $total = count($row); if ($this->params->get('hide_empty', 0) && !$total) { return ''; } $caching = $this->params->get('cache', 1); if ($caching) { $caching = $mainframe->getCfg('caching'); } $cache = JFactory::getCache('plgCommunityMyTaggedVideos'); $cache->setCaching($caching); $callback = array('plgCommunityMyTaggedVideos', '_getLatestVideosHTML'); $content = $cache->call($callback, $userid, $this->userparams->get('count', 5), $limitstart, $row, $total); return $content; }
/** * Install an extension. * * @return void * @since 1.8 */ public function install() { // Check for request forgeries JRequest::checkToken() or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); $app = JFactory::getApplication(); $model = $this->getModel('install'); $r = new JObject(); if ($model->install()) { $cache = JFactory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits $r->success = true; $r->redirect = $app->getUserState('com_installer.redirect_url'); } else { $r->success = false; $r->redirect = $app->getUserState('com_installer.redirect_url'); } if (!$r->redirect) { $r->message = $app->getUserState('com_installer.message'); $r->extensionmessage = $app->getUserState('com_installer.extension_message'); // wipe out the user state $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); } // wipe out the redicrect url $app->setUserState('com_installer.redirect_url', ''); $this->sendJsonResponse($r); }