public function __construct() { $this->jConfig = EB::jConfig(); $this->app = JFactory::getApplication(); $this->input = EB::request(); $this->config = EB::config(); $this->apiKey = $this->config->get('integrations_facebook_api_key'); $this->apiSecret = $this->config->get('integrations_facebook_secret_key'); // Default redirection url $this->redirect = rtrim(JURI::root(), '/') . '/administrator/index.php?option=com_easyblog&task=facebook.grant'; // Determines if there's a "system" in the url $system = $this->input->get('system', false, 'bool'); if ($system) { $this->redirect .= '&system=1'; } // Determines if there's a "userId" in the url $userId = $this->input->get('userId', null, 'default'); if ($userId) { $this->redirect .= '&userId=' . $userId; } parent::__construct(array('appId' => $this->apiKey, 'secret' => $this->apiSecret)); }
/** * Retrieves the base url * * @since 5.0 * @access public * @param string * @return */ public static function getBaseUrl() { static $url = null; if (is_null($url)) { $app = JFactory::getApplication(); $config = EB::jConfig(); $uri = JFactory::getURI(); $language = $uri->getVar('lang', 'none'); $router = $app->getRouter(); // Ensure that the language doesn't contain any strange characters. $language = str_ireplace(array('"', "'"), '', $language); $url = rtrim(JURI::base(), '/') . '/index.php?option=com_easyblog&lang=' . $language; $pluginEnabled = JPluginHelper::isEnabled('system', 'languagefilter'); // When SEF is enabled, the URL should be different otherwise Joomla will keep redirecting if ($router->getMode() == JROUTER_MODE_SEF && $pluginEnabled) { $rewrite = $config->get('sef_rewrite'); // Reset the base url $base = str_ireplace(JURI::root(true), '', $uri->getPath()); // Fix the path $path = $rewrite ? $base : JString::substr($base, 10); $path = JString::trim($path, '/'); $parts = explode('/', $path); // The first segment will always be the language filter $language = 'none'; if ($parts) { $language = reset($parts); } // Build the final url $url = rtrim(JURI::root(), '/') . '/index.php/' . $language . '/?option=com_easyblog'; // When rewrite is enabled, we need to use the proper paths if ($rewrite) { $url = rtrim(JURI::root(), '/') . '/' . $language . '/?option=com_easyblog'; $language = 'none'; } } // Append the item id if necessary $activeMenu = $app->getMenu()->getActive(); if ($activeMenu && isset($activeMenu->id)) { $url .= '&Itemid=' . $activeMenu->id; } // Some SEF components tries to do a 301 redirect from non-www prefix to www prefix. $currentUrl = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; if ($currentUrl) { // When the url contains www and the current accessed url does not contain www, fix it. if (stristr($currentUrl, 'www') === false && stristr($url, 'www') !== false) { $url = str_ireplace('www.', '', $url); } // When the url does not contain www and the current accessed url contains www. if (stristr($currentUrl, 'www') !== false && stristr($url, 'www') === false) { $url = str_ireplace('://', '://www.', $url); } } } return $url; }
/** * Adds an email address to the queue * * @since 4.0 * @access public * @param string * @return */ public function send($emails, $emailTitle, $template, $data) { $jConfig = EB::jConfig(); // Ensure that the title is translated. EB::loadLanguages(); $emailTitle = JText::_($emailTitle); // Get the sender's name and email $fromEmail = $this->config->get('notification_from_email', $jConfig->get('mailfrom')); $fromName = $this->config->get('notification_from_name', $jConfig->get('fromname')); // Ensure that all the emails are unique and we do not send any duplicates. foreach ($emails as $email => $obj) { // Ensure that the unsubscribe link is passed into the template if ($obj->unsubscribe && !isset($data['unsubscribeLink'])) { $data['unsubscribeLink'] = $obj->unsubscribe; } $mailq = EB::table('MailQueue'); $mailq->mailfrom = $fromEmail; $mailq->fromname = $fromName; $mailq->recipient = $obj->email; $mailq->subject = $emailTitle; // We only get the contents of the body later when we are dispatching the emails $mailq->body = ''; $mailq->created = EB::date()->toSql(); $mailq->template = $template; $mailq->data = json_encode($data); $mailq->store(); } }
/** * Determiens if SEF is enabled on the site * * @since 5.0 * @access public * @param string * @return */ public static function isSefEnabled() { $jConfig = EB::jConfig(); $isSef = false; $isSef = EBR::isSh404Enabled(); // If sh404sef not enabled, we need to check if joomla has it enabled if (!$isSef) { $isSef = $jConfig->get('sef'); } return $isSef; }
/** * START OF STRING RETURN FUNCTIONS */ public function debug() { $jConfig = EB::jConfig(); $prefix = $jConfig->getValue('dbprefix'); $query = $this->buildSql(); return str_ireplace('#__', $prefix, $query); }