public static function enabled() { if (!JComponentHelper::isEnabled ( 'com_kunena', true )) { return false; } $config = KunenaFactory::getConfig (); return !$config->board_offline; }
public function __construct() { self::$enabled = JComponentHelper::isEnabled('com_jevents'); if (self::$enabled) { require_once JPATH_SITE . '/components/com_jevents/jevents.defines.php'; } }
protected function index(FinderIndexerResult $item, $format = 'html') { // Check if the extension is enabled if (JComponentHelper::isEnabled($this->extension) == false) { return; } $item->body = FinderIndexerHelper::prepareContent($item->getElement('body')); $item->summary = FinderIndexerHelper::prepareContent($item->getElement('body')); $item->addTaxonomy('Type', 'FSF_FINDER_GLOSSARY'); $word = $item->title; $anchor = strtolower(preg_replace("/[^A-Za-z0-9]/", '-', $word)); $letter = strtolower(substr($word, 0, 1)); $item->url = 'index.php?option=com_fsf&view=glossary&letter=' . $letter . '#' . $anchor; $item->route = $item->url; $item->state = $item->published; $item->access = 1; // Get content extras. FinderIndexerHelper::getContentExtras($item); // Index the item. if (FSFJ3Helper::IsJ3()) { $this->indexer->index($item); } else { FinderIndexer::index($item); } }
function cutText($text, $limit_value, $limit_type, $at_end) { // solved problem from: https://www.gavick.com/support/forums/47/12309.html?p=57464#p57464 $cck_path = JPATH_BASE . DS . 'components' . DS . 'com_cck'; if (file_exists($cck_path)) { if (JComponentHelper::isEnabled('com_cck', true)) { // Force parsing plugin if SEBLOD is used if ($this->config['parse_plugins'] == FALSE) { $text = JHtml::_('content.prepare', $text); } $text = trim(substr(strip_tags($text, "<br /><br><strong></strong><p></p><i></i><b></b><span></span><ul></ul><li></li><blockquote></blockquote>"), 0)); } } if ($limit_type == 'words' && $limit_value > 0) { $temp = explode(' ', $text); if (count($temp) > $limit_value) { for ($i = 0; $i < $limit_value; $i++) { $cutted[$i] = $temp[$i]; } $cutted = implode(' ', $cutted); $text = $cutted . $at_end; } } elseif ($limit_type == 'words' && $limit_value == 0) { return ''; } else { if (JString::strlen($text) > $limit_value) { $text = JString::substr($text, 0, $limit_value) . $at_end; } } // replace unnecessary entities at end of the cutted text $toReplace = array('&&', '&a&', '&am&', '&&', '&q&', '&qu&', '&quo&', '"&', '&ap&', '&apo&', '&apos&'); $text = str_replace($toReplace, '&', $text); // return $text; }
/** * Include a script that initialize vote buttons. * * @return void */ public function onBeforeCompileHead() { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ if ($app->isAdmin()) { return; } $document = JFactory::getDocument(); /** @var $document JDocumentHTML */ $type = $document->getType(); if (strcmp("html", $type) != 0) { return; } // Check component enabled if (!JComponentHelper::isEnabled('com_userideas', true)) { return; } // Check for right extension. $option = $app->input->get("option"); if (strcmp("com_userideas", $option) != 0) { return null; } // Check for view. The extensions will work only on view "items" $allowedViews = array("items", "details", "category"); $view = $app->input->getCmd("view"); if (!in_array($view, $allowedViews)) { return; } jimport("itprism.init"); JHtml::_('itprism.ui.joomla_helper'); $document->addScript('plugins/system/userideasvote/votebutton.js'); }
function __construct(& $subject, $config) { // Check if Kunena API exists $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (! is_file ( $api )) return false; jimport ( 'joomla.application.component.helper' ); // Check if Kunena component is installed/enabled if (! JComponentHelper::isEnabled ( 'com_kunena', true )) { return false; } // Load Kunena API require_once $api; // Fix Joomla 1.5 bugs and bad performance $version = new JVersion(); if ($version->RELEASE == '1.5') { $lang = JFactory::getLanguage(); if (JFactory::getApplication()->isAdmin()) { $lang->load('com_kunena.menu', JPATH_ADMINISTRATOR); } else { $filename = JLanguage::getLanguagePath( JPATH_BASE, $lang->_lang)."/{$lang->_lang}.com_kunena.ini"; $lang->_paths['com_kunena'][$filename] = 1; } } parent::__construct ( $subject, $config ); }
/** * @param object $subject * @param array $config */ function __construct(&$subject, $config) { // Check if Kunena API exists $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (!is_file ($api)) { return; } jimport ( 'joomla.application.component.helper' ); // Check if Kunena component is installed/enabled if (!JComponentHelper::isEnabled ( 'com_kunena', true )) { return; } // Load Kunena API require_once $api; // Do not load if Kunena version is not supported or Kunena is not installed if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('4.0') && KunenaForum::installed())) { return; } parent::__construct ( $subject, $config ); // ! Always load language after parent::construct else the name of plugin isn't yet set $this->loadLanguage('plg_system_kunena.sys'); }
/** * onAfterInitialise handler * * Adds ZOO event listeners * * @access public * @return null */ public function onAfterInitialise() { // Make sure ZOO exists jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php')) { return; } // load ZOO config if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php')) { if (!JComponentHelper::isEnabled('com_zoo', true)) { return; } } require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; // make sure App class exists if (!class_exists('App')) { return; } // Get the ZOO App instance $zoo = App::getInstance('zoo'); $zoo->path->register(JPATH_SITE . '/plugins/system/qtc_zoo/qtc_zoo/', 'fields'); $zoo->event->register('plgSystemQtc_zoo'); $zoo->event->dispatcher->connect('application:configparams', array('plgSystemQtc_zoo', 'configParams')); $zoo->event->register('ItemEvent'); $zoo->event->dispatcher->connect('item:init', array('plgSystemQtc_zoo', 'init')); $zoo->event->dispatcher->connect('item:saved', array('plgSystemQtc_zoo', 'saved')); }
public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config = array()); $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php'; if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easysocial', true)) { ApiError::raiseError(404, 'Easyblog not installed'); return; } // Load Easyblog language & bootstrap files $language = JFactory::getLanguage(); $language->load('com_easyblog'); require_once JPATH_ROOT . '/components/com_easyblog/constants.php'; require_once EBLOG_HELPERS . '/helper.php'; // Set resources & access ApiResource::addIncludePath(dirname(__FILE__) . '/easyblog'); $this->setResourceAccess('latest', 'public', 'get'); $this->setResourceAccess('category', 'public', 'get'); $this->setResourceAccess('blog', 'public', 'get'); $this->setResourceAccess('blog', 'public', 'post'); $this->setResourceAccess('comments', 'public', 'get'); $this->setResourceAccess('easyblog_users', 'public', 'get'); $config = EasyBlogHelper::getConfig(); if ($config->get('main_allowguestcomment')) { $this->setResourceAccess('comments', 'public', 'post'); } }
/** * Include a script that initialize vote buttons. * * @return void */ public function onBeforeCompileHead() { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ if ($app->isAdmin()) { return; } $document = JFactory::getDocument(); /** @var $document JDocumentHTML */ $type = $document->getType(); if (strcmp('html', $type) !== 0) { return; } // Check component enabled if (!JComponentHelper::isEnabled('com_userideas')) { return; } // Check for right extension. $option = $app->input->get('option'); if (strcmp('com_userideas', $option) !== 0) { return null; } // Check for view. The extensions will work only on view 'items' $allowedViews = array('items', 'details', 'category'); $view = $app->input->getCmd('view'); if (!in_array($view, $allowedViews, true)) { return; } JHtml::_('Prism.ui.joomlaHelper'); JHtml::_('Userideas.loadVoteScript'); }
public function onAfterDispatch() { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ if ($app->isAdmin()) { return; } $document = JFactory::getDocument(); /** @var $document JDocumentHtml */ $type = $document->getType(); if (strcmp("html", $type) != 0) { return; } // It works only for GET and POST requests. $method = JString::strtolower($app->input->getMethod()); if (!in_array($method, array("get", "post"))) { return; } // Check component enabled if (!JComponentHelper::isEnabled('com_crowdfunding', true)) { return; } $view = $app->input->getCmd("view"); $option = $app->input->getCmd("option"); $isCrowdfundingComponent = strcmp($option, "com_crowdfunding") == 0; $isDetailsPage = (strcmp($option, "com_crowdfunding") == 0 and strcmp($view, "details") == 0); // Allowed views for the module Crowdfunding Details $allowedViewsModuleDetails = array("backing", "embed", "report"); $allowedViewsModuleFilters = array("discover", "category"); // Hide some modules if it is not details page. if (!$isDetailsPage) { $this->hideModule("mod_crowdfundinginfo"); $this->hideModule("mod_crowdfundingprofile"); $this->hideModule("mod_crowdfundingreporting"); } // Module Crowdfunding Rewards (mod_crowdfundingrewards). if (!$isDetailsPage) { $this->hideModule("mod_crowdfundingrewards"); } else { // Check project type. If the rewards are disable, hide the module. $projectId = $app->input->getInt("id"); if (!empty($projectId)) { $project = Crowdfunding\Project::getInstance(JFactory::getDbo(), $projectId); $type = $project->getType(); // Hide the module Crowdfunding Rewards, if rewards are disabled for this type. if (!is_null($type) and !$type->isRewardsEnabled()) { $this->hideModule("mod_crowdfundingrewards"); } } } // Module Crowdfunding Details (mod_crowdfundingdetails) on backing and embed pages. if (!$isCrowdfundingComponent or strcmp($option, "com_crowdfunding") == 0 and !in_array($view, $allowedViewsModuleDetails)) { $this->hideModule("mod_crowdfundingdetails"); } // Module Crowdfunding Filters (mod_crowdfundingfilters). if (!$isCrowdfundingComponent or strcmp($option, "com_crowdfunding") == 0 and !in_array($view, $allowedViewsModuleFilters)) { $this->hideModule("mod_crowdfundingfilters"); } }
public function onAfterDispatch() { $app = JFactory::getApplication(); /** @var $app JApplicationSite */ if ($app->isAdmin()) { return; } $document = JFactory::getDocument(); /** @var $document JDocumentHtml */ $type = $document->getType(); if (strcmp('html', $type) !== 0) { return; } // It works only for GET and POST requests. $method = strtolower($app->input->getMethod()); if (!in_array($method, array('get', 'post'), true)) { return; } // Check component enabled if (!JComponentHelper::isEnabled('com_crowdfunding')) { return; } $view = $app->input->getCmd('view'); $option = $app->input->getCmd('option'); $isCrowdfundingComponent = strcmp($option, 'com_crowdfunding') === 0; $isDetailsPage = (strcmp($option, 'com_crowdfunding') === 0 and strcmp($view, 'details') === 0); // Allowed views for the module Crowdfunding Details $allowedViewsModuleDetails = array('backing', 'embed', 'report', 'friendmail'); $allowedViewsModuleFilters = array('discover', 'category'); // Hide some modules if it is not details page. if (!$isDetailsPage) { $this->hideModule('mod_crowdfundinginfo'); $this->hideModule('mod_crowdfundingprofile'); $this->hideModule('mod_crowdfundingreporting'); } // Module Crowdfunding Rewards (mod_crowdfundingrewards). if (!$isDetailsPage) { $this->hideModule('mod_crowdfundingrewards'); } else { // Check project type. If the rewards are disable, hide the module. $projectId = $app->input->getInt('id'); if ($projectId > 0 and !CrowdfundingHelper::isRewardsEnabled($projectId)) { // Hide the module Crowdfunding Rewards, if rewards are disabled. $this->hideModule('mod_crowdfundingrewards'); } } // Module Crowdfunding Details (mod_crowdfundingdetails) on backing and embed pages. if (!$isCrowdfundingComponent or strcmp($option, 'com_crowdfunding') === 0 and !in_array($view, $allowedViewsModuleDetails, true)) { $this->hideModule('mod_crowdfundingdetails'); } // Module Crowdfunding Filters (mod_crowdfundingfilters). if (!$isCrowdfundingComponent or strcmp($option, 'com_crowdfunding') === 0 and !in_array($view, $allowedViewsModuleFilters, true)) { $this->hideModule('mod_crowdfundingfilters'); } // Module Crowdfunding Filters (mod_crowdfundingsearch). if (!$isCrowdfundingComponent or strcmp($option, 'com_crowdfunding') === 0 and !in_array($view, $allowedViewsModuleFilters, true)) { $this->hideModule('mod_crowdfundingsearch'); } }
/** * Method to check whether a specific component is there * * @param string $component * @return bool */ protected function checkComponent($component) { jimport('joomla.application.component.helper'); if (is_dir(JPATH_ADMINISTRATOR . '/components/' . $component) && JComponentHelper::isEnabled($component) == true) { return true; } else { return false; } }
public function isEnabled() { jimport('joomla.application.component.helper'); if (is_dir(JPATH_ADMINISTRATOR . '/components/com_community') && JComponentHelper::isEnabled('com_community') == true) { return true; } else { return false; } }
public function getUsers() { if (!JComponentHelper::isEnabled('com_kunena')) { JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_SYSTEM_MEMBERMAP_SOURCE_NOT_ENABLED', 'Kunena'), 'error'); return false; } $db = JFactory::getDbo(); $query = $db->getQuery(true)->select('DISTINCT u.id')->from('#__kunena_users AS ku')->join('INNER', '#__users AS u ON(u.id = ku.userid)')->where('u.block = ' . $db->quote(0))->where('ku.location != ' . $db->quote('')); if ($usergroups = $this->params->get('usergroup')) { $query->join('INNER', '#__user_usergroup_map AS g ON(u.id = g.user_id)'); $query->where('g.group_id IN(' . implode(',', $usergroups) . ')'); } switch ($this->params->get('order', 'name')) { default: case 'name': $query->order('u.name'); break; case 'username': $query->order('u.username'); break; case 'userid': $query->order('u.id'); break; case 'location': $query->order('ku.location'); break; case 'random': $query->order('RAND()'); break; } $db->setQuery($query); $members = $db->loadColumn(); if (empty($members)) { return null; } $users = array(); foreach ($members as $key => &$member) { $member = KunenaFactory::getUser($member); $users[$key] = new stdClass(); $users[$key]->address = $member->location; $users[$key]->requests = 0; $users[$key]->ready = false; if ($this->params->get('avatar', 1)) { $users[$key]->avatar = $member->getAvatarURL(); if (!filter_var($users[$key]->avatar, FILTER_VALIDATE_URL)) { $users[$key]->avatar = JUri::root() . $users[$key]->avatar; } } $users[$key]->name = $member->getName(); $users[$key]->url = $member->getURL(); } #domix($users, 1); return $users; }
/** * Constructor * * @param JDatabaseDriver $db A database connector object * * @since 11.1 */ public function __construct(JDatabaseDriver $db) { parent::__construct('#__content', 'id', $db); if (JComponentHelper::isEnabled('com_tags')) { JLoader::register('TagsTableObserverTags', JPATH_ADMINISTRATOR . '/components/com_tags/tables/observer/tags.php'); TagsTableObserverTags::createObserver($this, array('typeAlias' => 'com_content.article')); } if (JComponentHelper::isEnabled('com_contenthistory')) { JLoader::register('ContenthistoryTableObserverHistory', JPATH_ADMINISTRATOR . '/components/com_contenthistory/tables/observer/history.php'); ContenthistoryTableObserverHistory::createObserver($this, array('typeAlias' => 'com_content.article')); } }
public function keygen() { //init variable $obj = new stdclass(); $umodel = new JUser(); $user = $umodel->getInstance(); if (!$user->id) { $user = JFactory::getUser($this->plugin->get('user')->id); } $kmodel = new ApiModelKey(); $model = new ApiModelKeys(); $key = null; // Get login user hash $kmodel->setState('user_id', $user->id); $log_hash = $kmodel->getList(); $log_hash = $log_hash[count($log_hash) - count($log_hash)]; if ($log_hash->hash) { $key = $log_hash->hash; } elseif ($key == null || empty($key)) { // Create new key for user $data = array('userid' => $user->id, 'domain' => '', 'state' => 1, 'id' => '', 'task' => 'save', 'c' => 'key', 'ret' => 'index.php?option=com_api&view=keys', 'option' => 'com_api', JSession::getFormToken() => 1); $result = $kmodel->save($data); $key = $result->hash; //add new key in easysocial table $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php'; if (JFile::exists($easyblog) && JComponentHelper::isEnabled('com_easysocial', true)) { $this->updateEauth($user, $key); } } if (!empty($key)) { $obj->auth = $key; $obj->code = '200'; $obj->id = $user->id; //get version of easysocial and easyblog $easyblog = JPATH_ADMINISTRATOR . '/components/com_easyblog/easyblog.php'; $easysocial = JPATH_ADMINISTRATOR . '/components/com_easysocial/easysocial.php'; //eb version if (JFile::exists($easyblog)) { $obj->easyblog = $this->getCompParams('com_easyblog', 'easyblog'); } //es version if (JFile::exists($easysocial)) { /*$xml = JFactory::getXML(JPATH_ADMINISTRATOR .'/components/com_easysocial/easyblog.xml'); $obj->easysocial_version = (string)$xml->version;*/ $obj->easysocial = $this->getCompParams('com_easysocial', 'easysocial'); } // } else { $obj->code = 403; $obj->message = 'Bad request'; } return $obj; }
public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config); if (!defined('FOF30_INCLUDED') && !@(include_once JPATH_LIBRARIES . '/fof30/include.php')) { $this->enabled = false; } // Do not run if Akeeba Subscriptions is not enabled JLoader::import('joomla.application.component.helper'); if (!JComponentHelper::isEnabled('com_ars')) { $this->enabled = false; } }
/** * Put a code that connect to site with authentication services - Facebook, Twitter,... */ public function onAfterRender() { if (!$this->itpConnectParams->get("facebookOn", 0)) { return; } if (!JComponentHelper::isEnabled('com_itpconnect', true)) { return; } $app = JFactory::getApplication(); /* @var $app JApplication */ if ($app->isAdmin()) { return; } $doc = JFactory::getDocument(); /* @var $doc JDocumentHTML */ $docType = $doc->getType(); // Joomla! must render content of this plugin only in HTML document if (strcmp("html", $docType) != 0) { return; } // Get language if ($this->itpConnectParams->get("fbDynamicLocale", 0)) { $lang = JFactory::getLanguage(); $locale = $lang->getTag(); $locale = str_replace("-", "_", $locale); } else { $locale = $this->itpConnectParams->get("fbLocale", "en_US"); } // Set AJAX loader $ajaxLoader = ""; if ($this->itpConnectParams->get("fbDisplayAjaxLoader")) { $ajaxLoader = "document.id('itpconnect-ajax-loader').show();"; } // Get return page $return = ItpcHelper::getReturn(); $return = base64_encode($return); $buffer = JResponse::getBody(); // $pattern = "/<body[^>]*>/s"; $pattern = "/<\\/body[^>]*>/s"; $matches = array(); if (preg_match($pattern, $buffer, $matches)) { // Add Facebook tags description into html tag // $newHtmlAttr = '<html xmlns:fb="http://www.facebook.com/2008/fbml" '; // $buffer = str_replace("<html",$newHtmlAttr,$buffer); // $newBodyTag = $matches[0] . " $newBodyTag = "\n <div id='fb-root'></div>\n\n <script>\n\tfunction itpLogin() {\n \twindow.location = 'index.php?option=com_itpconnect&task=facebook.connect&return=" . $return . "'\n }\n \n window.fbAsyncInit = function() {\n FB.init({\n appId : '" . $this->itpConnectParams->get("facebookAppId") . "', // App ID\n status : true, // check login status\n cookie : true, // enable cookies to allow the server to access the session\n xfbml : true, // parse XFBML\n oauth \t: true\n });\n \n // Additional initialization code here\n // whenever the user logs in, we refresh the page\n FB.Event.subscribe('auth.login', function() {\n {$ajaxLoader}\n });\n \n // whenever the user logs in, we refresh the page\n FB.Event.subscribe('auth.logout', function() {\n \twindow.location.reload();\n });\n \n };\n \n </script>\n \n <script>(function(d, s, id) {\n var js, fjs = d.getElementsByTagName(s)[0];\n if (d.getElementById(id)) return;\n js = d.createElement(s); js.id = id;\n js.src = \"//connect.facebook.net/" . $locale . "/all.js\";\n fjs.parentNode.insertBefore(js, fjs);\n }(document, 'script', 'facebook-jssdk'));</script>\n\n "; $newBodyTag .= $matches[0]; $buffer = str_replace($matches[0], $newBodyTag, $buffer); } JResponse::setBody($buffer); return; }
/** * Ensure that EasyBlog really exists on the site first * * @since 5.0 * @access public * @param string * @return */ public function exists() { // First we check if the extension is enabled. if (JComponentHelper::isEnabled($this->extension) == false) { return; } $file = JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; jimport('joomla.filesystem.file'); if (!JFile::exists($file)) { return false; } require_once $file; return true; }
function getVmLink($id, &$errorMsg) { if (JComponentHelper::isEnabled('com_virtuemart', true)) { if ((int) $id < 1) { return ""; } } else { return ""; } $db =& JFactory::getDBO(); $query = 'SELECT c.virtuemart_category_id AS catid, a.virtuemart_product_id AS id, a.published AS published, a.product_in_stock AS product_in_stock' . ' FROM #__virtuemart_product_categories AS c' . ' LEFT JOIN #__virtuemart_products AS a ON a.virtuemart_product_id = c.virtuemart_product_id' . ' WHERE c.virtuemart_product_id = ' . (int) $id; $db->setQuery($query, 0, 1); $product = $db->loadObject(); if (!$db->query()) { $this->setError($db->getErrorMsg()); $errorMsg = 'VirtueMart Product Not Found'; return false; } $catPart = ''; if (!empty($product->catid)) { $catPart = '&virtuemart_category_id=' . $product->catid; } $itemId = PhocaGalleryVirtueMart::_getVmItemid(); $link = 'index.php?option=com_virtuemart&view=productdetails' . '&virtuemart_product_id=' . (int) $id . $catPart . '&itemId=' . (int) $itemId; // Check PUBLISHED if (isset($product->published) && $product->published == 0) { $errorMsg = 'VirtueMart Product Not Published'; return ''; //don't display cart icon for unpublished product } // Check Stock if check stock feature is enabled //$component = 'com_virtuemart'; //$paramsC = JComponentHelper::getParams($component) ; if (is_file(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php')) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php'; VmConfig::loadConfig(); if (VmConfig::get('check_stock', 0) == 1) { // Check STOCK if (isset($product->product_in_stock) && $product->product_in_stock == 0) { $errorMsg = 'VirtueMart Product Not On Stock'; return ''; //don't display cart icon for non stock products } } } else { $errorMsg = 'VirtueMart Config Not Found'; return false; } return $link; }
/** * Display the view */ function display($tpl = null) { require_once JPATH_COMPONENT . '/helpers/multilangstatus.php'; $this->homes = multilangstatusHelper::getHomes(); $this->language_filter = JLanguageMultilang::isEnabled(); $this->switchers = multilangstatusHelper::getLangswitchers(); if (JComponentHelper::isEnabled('com_contact', true)) { $this->listUsersError = multilangstatusHelper::getContacts(); } $this->contentlangs = multilangstatusHelper::getContentlangs(); $this->site_langs = multilangstatusHelper::getSitelangs(); $this->statuses = multilangstatusHelper::getStatus(); $this->homepages = multilangstatusHelper::getHomepages(); parent::display($tpl); }
/** * * Method is called after user log in to the system. * * @param array $user An associative array of JAuthenticateResponse type. * @param array $options An associative array containing these keys: ["remember"] => bool, ["return"] => string, ["entry_url"] => string. * * @return void * @since 1.6 * @throws Exception on error. */ public function onUserLogin($user, $options) { if (!JComponentHelper::isEnabled("com_virtualcurrency")) { return; } // Get user id $userName = JArrayHelper::getValue($user, 'username'); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select("a.id")->from($db->quoteName("#__users", "a"))->where("a.username = " . $db->quote($userName)); $db->setQuery($query, 0, 1); $userId = $db->loadResult(); $this->createAccount($userId); /** @todo remove this. I am using it for testing. */ // $this->giveUnits($userId); }
/** * Set the indicator for logout. * I will use the indicator for excetuting the a Facebook function * that will destroy the session. * * @access public * @param array holds the user data * @return boolean True on success */ public function onUserLogout($user) { $itpConnectParams = JComponentHelper::getParams('com_itpconnect'); if (!$itpConnectParams->get("facebookOn", 0)) { return true; } if (!JComponentHelper::isEnabled('com_itpconnect', true)) { return true; } $app = JFactory::getApplication(); /* @var $app JApplication */ if ($app->isAdmin()) { return true; } $facebook = ItpcHelper::getFB(); $facebook->destroySession(); return true; }
/** * Constructor * * For php4 compatability we must not use the __constructor as a constructor for plugins * because func_get_args ( void ) returns a copy of all passed arguments NOT references. * This causes problems with cross-referencing necessary for the observer design pattern. * * @access protected * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.0 */ function onAfterDispatch() { $app = JFactory::getApplication(); if (!JComponentHelper::isEnabled('com_arkeditor')) { return; } $params = JComponentHelper::getParams('com_arkeditor'); $params->merge($this->params); if (!$params->get('enable_sefbasepath', true)) { return; } // No remember me for admin $router = $app->getRouter(); if ($router->getMode() == JROUTER_MODE_SEF) { $document = JFactory::getDocument(); $document->setBase(htmlspecialchars(JURI::root())); //lets set this correctly } }
function preflight($type, $parent) { if (!JComponentHelper::isEnabled('com_j2store')) { Jerror::raiseWarning(null, 'J2Store not found. Please install J2Store before installing this plugin'); return false; } jimport('joomla.filesystem.file'); $version_file = JPATH_ADMINISTRATOR . '/components/com_j2store/version.php'; if (JFile::exists($version_file)) { // abort if the current J2Store release is older if (version_compare(J2STORE_VERSION, '2.7.3', 'lt')) { Jerror::raiseWarning(null, 'You are using an old version of J2Store. Please upgrade to the latest version'); return false; } } else { Jerror::raiseWarning(null, 'J2Store not found or the version file is not found. Make sure that you have installed J2Store before installing this plugin'); return false; } }
/** * Get Joomla extensions that can commentify! * return array */ public function getAvailableComponents() { static $components = array(); if( empty( $components ) ) { // find each component folders $folders = JFolder::folders( JPATH_ROOT . DIRECTORY_SEPARATOR . 'components', 'com_', false, false, array( '.svn', 'CVS', '.DS_Store', '__MACOSX', 'com_komento' ) ); foreach( $folders as $folder ) { if( JFile::exists( JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . 'komento_plugin.php' ) ) { $components[$folder] = $folder; } } // find in plugins folder foreach( $folders as $folder ) { if( JFile::exists( KOMENTO_ROOT . DIRECTORY_SEPARATOR . 'komento_plugins' . DIRECTORY_SEPARATOR . $folder . '.php' ) ) { $components[$folder] = $folder; } } // cleaning up duplicates $components = array_unique($components); // check against the Joomla extension table foreach( $components as $key => $component ) { if( !JComponentHelper::isEnabled( $component ) ) { unset( $components[$key] ); } } } return $components; }
/** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials * @param array $options Array of extra options * @param object $response Authentication response object * @return boolean * @since 1.5 */ public function onUserAuthenticate($credentials, $options, &$response) { $success = false; $itpConnectParams = JComponentHelper::getParams('com_itpconnect'); if (!$itpConnectParams->get("facebookOn")) { return $success; } if (!JComponentHelper::isEnabled('com_itpconnect', true)) { return $success; } $app =& JFactory::getApplication(); /* @var $app JApplication */ if ($app->isAdmin()) { return $success; } $response->type = 'ItpConnect'; $fbUserId = ItpcHelper::getFB()->getUser(); if (!$fbUserId) { $response->status = JAUTHENTICATE_STATUS_FAILURE; $response->error_message = 'Could not authenticate'; } else { $userId = ItpcHelper::getJUserId($fbUserId); $user = JUser::getInstance($userId); // Bring this in line with the rest of the system if (!$user) { $response->status = JAUTHENTICATE_STATUS_FAILURE; $response->error_message = 'Could not authenticate'; } else { $response->email = $user->email; $response->fullname = $user->name; if (JFactory::getApplication()->isAdmin()) { $response->language = $user->getParam('admin_language'); } else { $response->language = $user->getParam('language'); } $response->status = JAUTHENTICATE_STATUS_SUCCESS; $response->error_message = ''; $success = true; } } return $success; }
function __construct(&$subject, $config) { // Check if Kunena API exists $kunena_api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (!is_file($kunena_api)) { return false; } jimport('joomla.application.component.helper'); // Check if Kunena component is installed/enabled if (!JComponentHelper::isEnabled('com_kunena', true)) { return false; } // Load Kunena API require_once $kunena_api; // Fix Joomla 1.5 bug if (JFactory::getApplication()->isAdmin() && KUNENA_JOOMLA_COMPAT == '1.5') { JFactory::getLanguage()->load('com_kunena.menu', JPATH_ADMINISTRATOR); } parent::__construct($subject, $config); }
function __construct(&$subject, $config) { // Check if Kunena API exists $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (!is_file($api)) { return false; } jimport('joomla.application.component.helper'); // Check if Kunena component is installed/enabled if (!JComponentHelper::isEnabled('com_kunena', true)) { return false; } // Load Kunena API require_once $api; // Do not load if Kunena version is not supported or Kunena is not installed if (!(class_exists('KunenaForum') && KunenaForum::isCompatible('2.0') && KunenaForum::installed())) { return false; } $this->loadLanguage('plg_system_kunena.sys', JPATH_ADMINISTRATOR) || $this->loadLanguage('plg_system_kunena.sys', KPATH_ADMIN); if (version_compare(JVERSION, '1.6', '<')) { // Joomla 1.5: Fix bugs and bad performance $lang = JFactory::getLanguage(); if (JFactory::getApplication()->isAdmin()) { // Load the missing language files in administration $lang->load('com_kunena.menu', JPATH_ADMINISTRATOR) || $lang->load('com_kunena.menu', KPATH_ADMIN); $lang->load('com_kunena.sys', JPATH_ADMINISTRATOR) || $lang->load('com_kunena.sys', KPATH_ADMIN); if (JRequest::getCmd('option') == 'com_plugins' && JRequest::getCmd('view') == 'plugin' && JRequest::getCmd('task') == 'edit') { // Support for J!1.7 .sys language files $cid = JRequest::getVar('cid', array(0), '', 'array'); $row = JTable::getInstance('plugin'); $row->load((int) $cid[0]); $lang->load('plg_' . trim($row->folder) . '_' . trim($row->element) . '.sys', JPATH_ADMINISTRATOR) || $lang->load('plg_' . trim($row->folder) . '_' . trim($row->element) . '.sys', KPATH_ADMIN); } } else { // Never load language file $filename = JLanguage::getLanguagePath(JPATH_BASE, $lang->_lang) . "/{$lang->_lang}.com_kunena.ini"; $lang->_paths['com_kunena'][$filename] = 1; } } parent::__construct($subject, $config); }