private function _addTracking() { $doc = JFactory::getDocument(); $browser = JBrowser::getInstance(); $type = $this->params->get('type'); if ($browser->isSSLConnection()) { $file = 'https://ssl.google-analytics.com/ga.js'; } else { $file = 'http://www.google-analytics.com/ga.js'; } $script = " var _gaq = _gaq || []; _gaq.push(['_setAccount', '".htmlspecialchars($this->params->get('account'))."']);"; if ($type == 1) { $script .= "_gaq.push(['_setDomainName', '".htmlspecialchars($this->params->get('domain'))."']);"; } else if ($type == 2) { $script .= " _gaq.push(['_setDomainName', 'none']); _gaq.push(['_setAllowLinker', true]);"; } if ($this->params->get('anoymizeip')) { $script .= "_gaq.push (['_gat._anonymizeIp']);"; } $script .= "_gaq.push(['_trackPageview']);\n"; $doc->addScriptDeclaration($script); $doc->addScript($file, 'text/javascript', true, true); }
public static function isMobile() { /** * Store the mobile value by our preferences and what is consider as mobile * @param Boolean true if its a mobile */ $mobile = false; // detect the browser by checking user agent $browser = JBrowser::getInstance(); $ua = $browser->getAgentString(); switch ($ua) { case preg_match('/ipad/i', $ua) > 0: // ipad specific css break; case preg_match('/android/i', $ua) > 0: $mobile = true; break; case preg_match('/blackberry/i', $ua) > 0: $mobile = true; break; case preg_match('/iphone/i', $ua) > 0: // need to specifically check for user agent $mobile = true; break; } // $browser->isMobile will check for opera/opera mini and other multiplatform browser if ($mobile || $browser->isMobile()) { return true; } else { return false; } }
public function getRepeatable() { $html = ''; $html .= '<script type="text/javascript">'; $html .= "function j2storeOpenModal(url){"; if (JBrowser::getInstance()->getBrowser() == "msie") { $html .= 'var options = {size:{x:document.documentElement.clientWidth-80, y: document.documentElement.clientHeight-80}};'; } else { $html .= "var options = {size:{x: window.innerWidth-80, y: window.innerHeight-80}};{\n\t\t\t\t\tSqueezeBox.initialize();\n\t\t\t\t\tSqueezeBox.setOptions(options);\n\t\t\t\t\tSqueezeBox.setContent('iframe',url);"; } $html .= '</script>'; require_once JPATH_ADMINISTRATOR . '/components/com_j2store/library/browser.php'; $url = JRoute::_('index.php?option=com_j2store&view=myprofile&task=printOrder&layout=order&tmpl=component&order_id=' . $this->item->order_id); if (JBrowser::getInstance()->getBrowser() == 'msie') { $html .= '<a class="btn btn-primary btn-small" href="' . $url . '" target="_blank">'; $html .= JText::_("J2STORE_PRINT_INVOICE"); 'test'; $html .= '</a>'; } else { $html .= '<a onclick="j2storeOpenModal(' . stripslashes($url) . ')">'; $html .= JText::_("J2STORE_PRINT_INVOICE"); $html .= '</a>'; } return $html; }
function display($tpl = null) { $app = JFactory::getApplication(); $rows =& $this->get('data'); $pagination =& $this->get('pagination'); $this->search =& $this->get('search'); $this->search = !empty($this->search) ? $this->escape($this->search) : $this->search; $this->assignRef('rows', $rows); $this->assignRef('pagination', $pagination); $this->assign('jb_render', JobBoardHelper::renderJobBoardx()); $lists['order'] = $app->getUserStateFromRequest('com_jobboard.applicants.filterOrder', 'filter_order', 'request_date'); $lists['orderDirection'] = $app->getUserStateFromRequest('com_jobboard.applicants.filterOrderDirection', 'filter_order_Dir', 'ASC', 'cmd'); $lists['orderDirection'] = strtoupper($lists['orderDirection']) == 'ASC' ? 'ASC' : 'DESC'; $this->assignRef('lists', $lists); $this->day_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%d' : 'd'; $this->long_day_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%a' : 'D'; $this->month_long_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%B' : 'F'; $this->month_short_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%b' : 'M'; $this->year_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%Y' : 'Y'; jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { if (intval($browser->getVersion()) > 7) { $cleafix = ".clearfix {display: block;}"; $document->addStyleDeclaration($cleafix); } } $_format = JRequest::getString('tmpl', ''); $this->is_modal = $_format == 'component' ? true : false; if (!$this->is_modal) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_behavior.php'; } parent::display($tpl); }
/** * Initialise the captcha * * @param string $id The id of the field. * * @return Boolean True on success, false otherwise * * @since 2.5 */ public function onInit($id) { // Initialise variables $lang = $this->_getLanguage(); $pubkey = $this->params->get('public_key', ''); $theme = $this->params->get('theme', 'clean'); if ($pubkey == null || $pubkey == '') { throw new Exception(JText::_('PLG_RECAPTCHA_ERROR_NO_PUBLIC_KEY')); } $server = self::RECAPTCHA_API_SERVER; if (JBrowser::getInstance()->isSSLConnection()) { $server = self::RECAPTCHA_API_SECURE_SERVER; } JHtml::_('script', $server.'/js/recaptcha_ajax.js'); $document = JFactory::getDocument(); $document->addScriptDeclaration('jQ(document).ready(function() { Recaptcha.create("'.$pubkey.'", "dynamic_recaptcha_1", {theme: "'.$theme.'",'.$lang.'tabindex: 0});});' ); return true; }
function __construct($config = null) { parent::__construct($config); $this->jevlayout = "flat"; $this->addHelperPath(dirname(__FILE__) . "/../helpers/"); $this->addHelperPath(JPATH_BASE . '/' . 'templates' . '/' . JFactory::getApplication()->getTemplate() . '/' . 'html' . '/' . JEV_COM_COMPONENT . '/' . "helpers"); $document = JFactory::getDocument(); $params = JComponentHelper::getParams(JEV_COM_COMPONENT); if ($params->get("flatscalable", "1") == "1" || $params->get("flatwidth", 905) == "scalable") { jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); $browserType = $browser->getBrowser(); $browserVersion = $browser->getMajor(); if ($browserType == 'msie' && $browserVersion < 9) { JEVHelper::componentStylesheet($this, "scalable_ie8.css"); } else { JEVHelper::componentStylesheet($this, "scalable.css"); } JEVHelper::componentStylesheet($this); } else { JEVHelper::componentStylesheet($this); JEVHelper::componentStylesheet($this, "w" . $params->get("flatwidth", 905) . ".css"); } if ($params->get("darktemplate", 0)) { JEVHelper::componentStylesheet($this, "dark.css"); } $stylelink = '<!--[if lte IE 6]>' . "\n"; $stylelink .= '<link rel="stylesheet" href="' . JURI::root() . 'components/com_jevents/views/flat/assets/css/ie6.css" />' . "\n"; $stylelink .= '<![endif]-->' . "\n"; $document->addCustomTag($stylelink); $this->colourscheme = $params->get("flatcolourscheme", "red"); if ($this->colourscheme == "gray") { //$this->colourscheme = ""; } }
/** * * @return type */ public static function isMsieLT10() { jimport('joomla.environment.browser'); $oBrowser = JBrowser::getInstance(); return (($oBrowser->getBrowser() == 'msie') && ($oBrowser->getMajor() <= '9')); }
function plgSystemMobile(&$subject, $config) { parent::__construct($subject, $config); // detect the browser by checking user agent $browser = JBrowser::getInstance(); $ua = $browser->getAgentString(); switch ($ua) { case preg_match('/ipad/i', $ua) > 0: // ipad specific css break; case preg_match('/android/i', $ua) > 0: $this->_mobile = true; break; case preg_match('/blackberry/i', $ua) > 0: $this->_mobile = true; break; case preg_match('/iphone/i', $ua) > 0: // need to specifically check for user agent $this->_mobile = true; break; } // $browser->isMobile will check for opera/opera mini and other multiplatform browser if ($this->_mobile || $browser->isMobile()) { JRequest::setVar('template', 'mobile'); } }
public function setupTheme() { // Load our CSS and Javascript files if (!$this->isJFBConnectInstalled) { $this->doc->addStyleSheet(JURI::base(true) . '/media/sourcecoast/css/sc_bootstrap.css'); } $this->doc->addStyleSheet(JURI::base(true) . '/media/sourcecoast/css/common.css'); $paths = array(); $paths[] = JPATH_ROOT . '/templates/' . JFactory::getApplication()->getTemplate() . '/html/mod_sclogin/themes/'; $paths[] = JPATH_ROOT . '/media/sourcecoast/themes/sclogin/'; $theme = $this->params->get('theme', 'default.css'); $file = JPath::find($paths, $theme); $file = str_replace(JPATH_SITE, '', $file); $file = str_replace('\\', "/", $file); //Windows support for file separators $this->doc->addStyleSheet(JURI::base(true) . $file); // Add placeholder Javascript for old browsers that don't support the placeholder field if ($this->user->guest) { jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); $browserType = $browser->getBrowser(); $browserVersion = $browser->getMajor(); if ($browserType == 'msie' && $browserVersion <= 9) { // Using addCustomTag to ensure this is the last section added to the head, which ensures that jfbcJQuery has been defined $this->doc->addCustomTag('<script src="' . JURI::base(true) . '/media/sourcecoast/js/jquery.placeholder.js" type="text/javascript"> </script>'); $this->doc->addCustomTag("<script>jfbcJQuery(document).ready(function() { jfbcJQuery('input').placeholder(); });</script>"); } } }
/** * passBrowsers * @param <object> $params * @param <array> $selection * @param <string> $assignment * @return <bool> */ function passBrowsers(&$main, &$params, $selection = array(), $assignment = 'all') { $pass = 0; $selection = $main->makeArray($selection); if (!empty($selection)) { jimport('joomla.environment.browser'); $browser =& JBrowser::getInstance(); $b = $browser->getAgentString(); if (!(strpos($b, 'Chrome') === false)) { $b = preg_replace('#(Chrome/.*)Safari/[0-9\\.]*#s', '\\1', $b); } else { if (!(strpos($b, 'Opera') === false)) { $b = preg_replace('#(Opera/.*)Version/#s', '\\1Opera/', $b); } } foreach ($selection as $sel) { if ($sel && !(strpos($b, $sel) === false)) { $pass = 1; break; } } } if ($pass) { return $assignment == 'include'; } else { return $assignment == 'exclude'; } }
public static function isMobile() { $browser = JBrowser::getInstance(); $isMob = false; $isMob = $browser->isMobile() ? true : $isMob; $isMob = stripos($browser->getAgentString(), 'iPhone') === false ? $isMob : true; //$isMob = ( stripos( $browser->getAgentString(), 'YOUR_PHONE_HERE' ) === false ) ? $isMob : true; return $isMob; }
public function onAfterInitialise() { // disable plugin on J! < 2.5.5 if (version_compare(JVERSION, '2.5.5') == -1) { $this->_active = false; return; } // load libraries only for J!2.5 if (version_compare(JVERSION, '3.0.0') == -1) { $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'cms'; if (method_exists('JLoader', 'registerPrefix')) { JLoader::registerPrefix('J', $path); } else { $this->_active = false; return; } } // check where to load plugin $app = JFactory::getApplication(); $load = $this->params->get('enable', 1); $isAdmin = ($app->isAdmin() or strpos(JPATH_BASE, 'administrator') !== false); if ($load == 1 and $isAdmin or $load == 2 and !$isAdmin) { $this->_active = false; return; } $doc = JFactory::getDocument(); if ($doc->getType() != 'html') { $this->_active = false; return; } // enable plugin $this->_active = true; // detect browser jimport('joomla.environment.browser'); $this->_isMobile = JBrowser::getInstance()->isMobile(); // load jQuery $load = $this->params->get('load_jquery', 0); if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) { JHtml::_('jquery.framework'); } // load jQuery UI $load = $this->params->get('load_jquery_ui', 0); if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) { JHtml::_('jquery.ui'); } // load Bootstrap JS $load = $this->params->get('load_bootstrap_js', 0); if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) { JHtml::_('bootstrap.framework'); } // load Bootstrap CSS $load = $this->params->get('load_bootstrap_css', 0); if ($load == 1 or $load == 2 and $this->_isMobile == false or $load == 3 and $this->_isMobile == true) { JHtml::_('bootstrap.loadCss'); } }
function gkIsOldIE() { jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); $ie6 = preg_match('/msie\\s(5\\.[5-9]|[6]\\.[0-9]*).*(win)/i', $browser->getAgentString()) && !preg_match('/msie\\s([7-9]\\.[0-9]*).*(win)/i', $browser->getAgentString()); $ie7 = preg_match('/msie\\s[7]/i', $browser->getAgentString()); $ie8 = preg_match('/msie\\s[8]/i', $browser->getAgentString()); $ie9 = preg_match('/msie\\s[9]/i', $browser->getAgentString()); return $ie6 || $ie7 || $ie8 || $ie9; }
private function _addScripts() { JHTML::_('behavior.mootools'); jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { $document->addStyleSheet('components/com_jobboard/css/base_ie.css'); } }
function onAfterInitialise() { $app = JFactory::getApplication(); if ($app->isAdmin()) { return; } jimport('joomla.environment.browser'); $navigator = JBrowser::getInstance(); //$MobileDevice = $browser->get( 'mobile'); $MobileDevice = $navigator->isMobile(); // detection code adapted from http://detectmobilebrowser.com/ $MobileDevice = $MobileDevice || preg_match('/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile|o2|opera m(ob|in)i|palm( os)?|p(ixi|re)\\/|plucker|pocket|psp|smartphone|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce; (iemobile|ppc)|xiino/i', $navigator->getAgentString()) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|e\\-|e\\/|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\\-|2|g)|yas\\-|your|zeto|zte\\-/i', substr($navigator->getAgentString(), 0, 4)); if ($MobileDevice == 1) { $params = $app->getParams('com_playjoom'); //Get template style for mobile device $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('template, params'); $query->from('`#__template_styles`'); $query->where('`client_id` = 0 AND `id`= ' . (int) $params->get('templatetoggle_mobile')); $query->order('`id` ASC'); $db->setQuery($query); $row = $db->loadObject(); if (!$row) { return; } if (empty($row->template)) { return; } //Output Template for mobile devices $app->setTemplate($row->template); $app->getTemplate(true)->params = new JRegistry($row->params); } else { $params = $app->getParams('com_playjoom'); //Get template style for regular device $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('template, params'); $query->from('`#__template_styles`'); $query->where('`client_id` = 0 AND `id`= ' . (int) $params->get('templatetoggle_regular')); $query->order('`id` ASC'); $db->setQuery($query); $row = $db->loadObject(); if (!$row) { return; } if (empty($row->template)) { return; } //Output Template for regular devices $app->setTemplate($row->template); $app->getTemplate(true)->params = new JRegistry($row->params); } }
/** * Execute and display a template script. * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return mixed A string if successful, otherwise a JError object. */ public function display($tpl = Null) { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $date = JFactory::getDate(); $layout = $jinput->get('layout'); if ($layout == 'saveTables') { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('manifest_cache')); $query->from($db->quoteName('#__extensions')); $query->where($db->quoteName('element') . " = " . $db->quote('com_bwpostman')); $db->SetQuery($query); $manifest = json_decode($db->loadResult(), true); $version = str_replace('.', '_', $manifest['version']); $filename = "BwPostman_" . $version . "_Tables_" . $date->format("Y-m-d_H:i") . '.xml'; $mime_type = "application/xml"; // Maybe we need other headers depending on browser type... jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); $user_browser = $browser->getBrowser(); JResponse::clearHeaders(); JResponse::setHeader('Content-Type', $mime_type, true); // Joomla will overwrite this... JResponse::setHeader('Content-Disposition', "attachment; filename=\"{$filename}\"", true); JResponse::setHeader('Expires', gmdate('D, d M Y H:i:s') . ' GMT', true); JResponse::setHeader('Pragma', 'no-cache', true); if ($user_browser == "msie") { JResponse::setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true); JResponse::setHeader('Pragma', 'public', true); } // Joomla overwrites content-type, we can't use JResponse::setHeader() $document = JFactory::getDocument(); $document->setMimeEncoding("application/xml"); @ob_end_clean(); ob_start(); JResponse::sendHeaders(); // Get the export data $model = $this->getModel('maintenance'); readfile($model->saveTables(false)); } if ($layout == 'doRestore') { $model = $this->getModel(); $dest = $app->getUserState('com_bwpostman.maintenance.dest', ''); $model->restoreTables($dest); } if ($layout == 'checkTables') { $model = $this->getModel(); echo '<div class="modal" rel="{size: {x: 700, y: 500}}">'; $model->checkTables(); echo '</div>'; } }
function display($tpl = null) { $cid = JRequest::getVar('cid', false, 'DEFAULT', 'array'); if ($cid) { $id = $cid[0]; } else { $id = JRequest::getInt('id', 0); } $newjob = $id > 0 ? false : true; if ($newjob) { $cfigt = JTable::getInstance('Config', 'Table'); $cfigt->load(1); $this->assignRef('config', $cfigt); } $lang =& JFactory::getLanguage()->getTag(); $lang = explode('-', $lang); $document =& JFactory::getDocument(); $_format = JRequest::getVar('format', ''); jimport('joomla.environment.browser'); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { if (intval($browser->getVersion()) > 7) { $cleafix = ".clearfix {display: block;}"; $document->addStyleDeclaration($cleafix); } } if ($this->config->use_location == 1) { if (empty($_format)) { $this->maps_online = JobBoardHelper::getSite('maps.google.com'); JHTML::_('behavior.mootools'); if ($this->maps_online) { $document->addScript('http://maps.google.com/maps/api/js?v=3&sensor=false&language=' . $lang[0]); } $js_vars = 'var tandolin = tandolin || {}; var mapSlide, windowScroll, jobMap, mapInstrctns; var presentCoords = "' . JText::_('COM_JOBBOARD_TXT_PRESENT_COORDINATES') . '";'; $js_vars .= 'var mapDiv, focusOn, infoSpans, vMapTrigger, mapOpen, jobForm; '; $js_vars .= "window.addEvent('domready', function(){\n jobForm = document.forms['adminForm'];\n infoSpans = document.getElementById('calc_loc').getElements('span');\n });\n "; $document->addScriptDeclaration($js_vars); } } $this->assign('jb_render', JobBoardHelper::renderJobBoardx()); $this->assign('newjob', $newjob); $this->day_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%d' : 'd'; $this->long_day_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%a' : 'D'; $this->month_long_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%B' : 'F'; $this->month_short_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%b' : 'M'; $this->year_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%Y' : 'Y'; $_format = JRequest::getString('tmpl', ''); $this->is_modal = $_format == 'component' ? true : false; if (!$this->is_modal) { require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_behavior.php'; } parent::display($tpl); }
protected function _getURL($user, $sizex, $sizey) { jimport( 'joomla.environment.browser' ); $browser = JBrowser::getInstance(); $protocol = $browser->isSSLConnection() ? "https" : "http"; $size_pixels = min($sizex,$sizey); $avatar = $protocol.'://www.gravatar.com/avatar/'.md5($user->email).'?s='.$size_pixels; return $avatar; }
function display($tpl = null) { jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { if (intval($browser->getVersion()) > 7) { $cleafix = ".clearfix {display: block;}"; $document->addStyleDeclaration($cleafix); } } parent::display($tpl); }
function _addScripts() { JHTML::_('behavior.mootools'); jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { $document->addStyleSheet('components/com_jobboard/css/base_ie.css'); } $js_vars = "var uslnk = '';var titleString = '" . JText::_('LABEL_JOB_TITLE_SRCH') . "';var keywdString = '" . JText::_('LABEL_KEYWD_SRCH') . "';var locnString = '" . JText::_('LABEL_LOCATION_SRCH') . "';var txtLoading = '" . JText::_('LOADING_TEXT') . "';var txtAdvSrch = '" . JText::_('COM_JOBBOARD_ADVANCED_SEARCH') . "';var txtBasicSrch = '" . JText::_('COM_JOBBOARD_BASIC_SEARCH') . "';"; $document->addScriptDeclaration($js_vars); $document->addScript('components/com_jobboard/js/list.js'); }
function getLinkrUrl($editor = 'text') { // Linkr URL $link = 'index.php?option=com_linkr&view=link&tmpl=component&e_name=' . $editor; // Use "popup" mode for IE jimport('joomla.environment.browser'); $browser =& JBrowser::getInstance(); if ($browser->getBrowser() == 'msie') { $link .= '&mode=popup'; } // Return link return JRoute::_($link . '&' . JUtility::getToken() . '=1'); }
/** * Returns the parameters of the user agent. */ public static function getParameters() { static $params = null; if (isset($params)) { return $params; } jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); $agent = $browser->getAgentString(); $params = new stdClass(); if ($browser->isMobile() || stripos($agent, 'mobile') !== false || stripos($agent, 'android') !== false) { $params->handheld = true; $params->browser = $browser->getBrowser(); if (stripos($agent, 'ipad') !== false) { // iPad $params->name = 'ipad'; } elseif (stripos($agent, 'iphone') !== false) { // iPhone $params->name = 'iphone'; } elseif (stripos($agent, 'ipod') !== false) { // iPod $params->name = 'ipod'; } elseif (stripos($agent, 'android') !== false) { // Android device $params->name = 'android'; // find model and build, parse e.g. "Android 2.1-update1; en-us; Nexus One Build/FRF91" $regex = '#android\\s+(\\d+\\.\\d+(?:-update\\d+)?)(?:;\\s+([a-z]{2}-[a-z]{2}))?(?:;\\s+(.*?)\\s+build/(\\w+))?#i'; $matches = array(); if (preg_match($regex, $agent, $matches)) { $params->version = $matches[1]; // e.g. "2.1-update1" if (strlen($matches[2]) > 0) { $params->language = $matches[2]; // e.g. "en-us" } if (strlen($matches[3]) > 0) { $params->model = $matches[3]; // e.g. "Nexus One" } if (strlen($matches[4]) > 0) { $params->build = $matches[4]; // e.g. "FRF91" } } } } else { $params->handheld = false; } return $params; }
function _addScripts($include_page_script = true) { JHTML::_('behavior.mootools'); jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { $document->addStyleSheet('components/com_jobboard/css/base_ie.css'); } if ($include_page_script) { $document->addScript('components/com_jobboard/js/submit.js'); } $document->addScript('components/com_jobboard/js/user_login.js'); }
public function onAfterRender() { $app =& JFactory::getApplication(); if ($app->isSite() && $this->params->get('redirect') == 'warn') { $browser =& JBrowser::getInstance(); //if (stripos($browser->getAgentString(), 'chrome')) { if ($browser->getBrowser() == 'msie' && $browser->getMajor() == '6') { $body = JResponse::getBody(); $pattern = "/(<body .*?>)/i"; $replace = "\$1\n<div class=\"ie6warn\"><p>You are currently using an unsupported browser and may experience issues browsing the site. Click <a href=\"/index.php?tmpl=ie6\">here</a> for more information.</p></div>"; $body = preg_replace($pattern, $replace, $body, 1); JResponse::setBody($body); } } }
function display($tpl = null) { jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { $document->addStyleSheet('components/com_jobboard/css/user_ie.css'); if (intval($browser->getVersion()) > 7) { $cleafix = ".clearfix {display: block;}"; $document->addStyleDeclaration($cleafix); } } $this->month_long_format = !version_compare(JVERSION, '1.6.0', 'ge') ? '%B' : 'F'; parent::display($tpl); }
/** * isMobile */ function isMobile() { /* taken from http://detectmobilebrowsers.com */ $browser = JBrowser::getInstance(); $a = $browser->getAgentString(); $mobiles = array('android.+mobile', 'avantgo', 'bada\\/', 'blackberry', 'blazer', 'compal', 'elaine', 'fennec', 'hiptop', 'iemobile', 'ip(hone|od)', 'iris', 'kindle', 'lge ', 'maemo', 'midp', 'mmp', 'netfront', 'opera m(ob|in)i', 'palm( os)?', 'phone', 'p(ixi|re)\\/', 'plucker', 'pocket', 'psp', 'symbian', 'treo', 'up\\.(browser|link)', 'vodafone', 'wap', 'windows (ce|phone)', 'xda', 'xiino/i'); if (preg_match('#(' . implode('|', $mobiles) . ')#i', $a)) { return 1; } $a = substr($a, 0, 4); $mobiles = array('/1207', '6310', '6590', '3gso', '4thp', '50[1-6]i', '770s', '802s', 'a wa', 'abac', 'ac(er|oo|s\\-)', 'ai(ko|rn)', 'al(av|ca|co)', 'amoi', 'an(ex|ny|yw)', 'aptu', 'ar(ch|go)', 'as(te|us)', 'attw', 'au(di|\\-m|r |s )', 'avan', 'be(ck|ll|nq)', 'bi(lb|rd)', 'bl(ac|az)', 'br[ev]w', 'bumb', 'bw\\-[nu]', 'c55\\/', 'capi', 'ccwa', 'cdm\\-', 'cell', 'chtm', 'cldc', 'cmd\\-', 'co(mp|nd)', 'craw', 'da(it|ll|ng)', 'dbte', 'dc\\-s', 'devi', 'dica', 'dmob', 'do[cp]o', 'ds(12|\\-d)', 'el(49|ai)', 'em(l2|ul)', 'er(ic|k0)', 'esl8', 'ez([4-7]0|os|wa|ze)', 'fetc', 'fly[\\-_]', 'g1 u', 'g560', 'gene', 'gf\\-5', 'g\\-mo', 'go(\\.w|od)', 'gr(ad|un)', 'haie', 'hcit', 'hd\\-[mpt]', 'hei\\-', 'hi(pt|ta)', 'hp( i|ip)', 'hs\\-c', 'ht(c[\\- _agpst]|tp)', 'hu(aw|tc)', 'i\\-(20|go|ma)', 'i230', 'iac[ \\-\\/]', 'ibro', 'idea', 'ig01', 'ikom', 'im1k', 'inno', 'ipaq', 'iris', 'ja[tv]a', 'jbro', 'jemu', 'jigs', 'kddi', 'keji', 'kgt[ \\/]', 'klon', 'kpt ', 'kwc\\-', 'kyo[ck]', 'le(no|xi)', 'lg( g|\\/[klu]|50|54|\\-[a-w])', 'libw', 'lynx', 'm1\\-w', 'm3ga', 'm50\\/', 'ma(te|ui|xo)', 'mc(01|21|ca)', 'm\\-cr', 'me(di|rc|ri)', 'mi(o8|oa|ts)', 'mmef', 'mo(01|02|bi|de|do|t[\\- ov]|zz)', 'mt(50|p1|v )', 'mwbp', 'mywa', 'n10[0-2]', 'n20[2-3]', 'n30[02]', 'n50[025]', 'n7(0[01]|10)', 'ne([cm]\\-|on|tf|wf|wg|wt)', 'nok[6i]', 'nzph', 'o2im', 'op(ti|wv)', 'oran', 'owg1', 'p800', 'pan[adt]', 'pdxg', 'pg(13|\\-([1-8]|c))', 'phil', 'pire', 'pl(ay|uc)', 'pn\\-2', 'po(ck|rt|se)', 'prox', 'psio', 'pt\\-g', 'qa\\-a', 'qc(07|12|21|32|60|\\-[2-7]|i\\-)', 'qtek', 'r380', 'r600', 'raks', 'rim9', 'ro(ve|zo)', 's55\\/', 'sa(ge|ma|mm|ms|ny|va)', 'sc(01|h\\-|oo|p\\-)', 'sdk\\/', 'se(c[\\-01]|47|mc|nd|ri)', 'sgh\\-', 'shar', 'sie[\\-m]', 'sk\\-0', 'sl(45|id)', 'sm(al|ar|b3|it|t5)', 'so(ft|ny)', 'sp(01|h\\-|v\\-|v )', 'sy(01|mb)', 't2(18|50)', 't6(00|10|18)', 'ta(gt|lk)', 'tcl\\-', 'tdg\\-', 'tel[im]', 'tim\\-', 't\\-mo', 'to(pl|sh)', 'ts(70|m\\-|m3|m5)', 'tx\\-9', 'up(\\.b|g1|si)', 'utst', 'v400', 'v750', 'veri', 'vi(rg|te)', 'vk(40|5[0-3]|\\-v)', 'vm40', 'voda', 'vulc', 'vx(52|53|60|61|70|80|81|83|85|98)', 'w3c[\\- ]', 'webc', 'whit', 'wi(g |nc|nw)', 'wmlb', 'wonu', 'x700', 'yas\\-', 'your', 'zeto', 'zte\\-'); if (preg_match('#(' . implode('|', $mobiles) . ')#i', $a)) { return 1; } return 0; }
private function _addScripts($is_modal = false) { if (!$is_modal) { JHTML::_('behavior.mootools'); } jimport('joomla.environment.browser'); $document =& JFactory::getDocument(); $browser =& JBrowser::getInstance(); if (is_int(strpos($browser->getBrowser(), 'msie'))) { $document->addStyleSheet('components/com_jobboard/css/base_ie.css'); if (intval($browser->getVersion()) > 7) { $cleafix = ".clearfix {display: block;}"; $document->addStyleDeclaration($cleafix); } } }
/** * */ function onAfterInitialise() { if (defined('IS_MOBILE')) { return true; } if (!get_cfg_var('is_mobile')) { // Catch mobiles defined in Joomla $browser = JBrowser::getInstance(); if (!$browser->ismobile()) { if (!isset($_SERVER['HTTP_USER_AGENT'])) { return true; } $additional = $this->params->get('additional-mobiles'); if (empty($additional)) { return true; } $mobiles = explode(',', strtolower($additional)); $agent = strtolower(trim($_SERVER['HTTP_USER_AGENT'])); $found = false; foreach ($mobiles as $mobile) { $mobile = trim($mobile); if (empty($mobile)) { continue; } if (stripos($agent, $mobile) !== false) { $found = true; break; } } if (!$found) { return true; } } } define('IS_MOBILE', true); if (isset($_SERVER['HTTP_HOST'])) { $mobilesiteuri = $this->params->get('mobile_site_uri'); if (!empty($mobilesiteuri)) { if ($mobilesiteuri != $_SERVER["HTTP_HOST"]) { JFactory::getApplication()->redirect('http://' . $mobilesiteuri . @$_SERVER["REQUEST_URI"]); } } } return true; }
/** * Checks whether a request is coming from mobile device * * @return boolean true if current page request is from a known mobile device */ public static function isMobileRequest() { static $isMobile = null; static $defaultRecords = array(array('start' => 0, 'stop' => 0, 'string' => '/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile|o2|opera m(ob|in)i|palm( os)?|p(ixi|re)\\/|plucker|pocket|psp|smartphone|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce; (iemobile|ppc)|xiino/i'), array('start' => 0, 'stop' => 4, 'string' => '/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|e\\-|e\\/|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\\-|2|g)|yas\\-|your|zeto|zte\\-/i')); if (is_null($isMobile)) { jimport('joomla.environment.browser'); $browser =& JBrowser::getInstance(); $isMobile = $browser->get('_mobile'); $userAgent = $browser->get('_lowerAgent'); // detection code adapted from http://detectmobilebrowser.com/ $remoteConfig = Sh404sefHelperUpdates::getRemoteConfig($forced = false); $remotesRecords = empty($remoteConfig->config['mobiledetectionstrings']) ? array() : $remoteConfig->config['mobiledetectionstrings']; $records = empty($remotes) ? $defaultRecords : $remotesRecords; foreach ($records as $record) { $isMobile = $isMobile || (empty($record['stop']) ? preg_match($record['string'], substr($userAgent, $record['start'])) : preg_match($record['string'], substr($userAgent, $record['start'], $record['stop']))); } } return $isMobile; }
public function __construct($config = array()) { parent::__construct($config); $document = JFactory::getDocument(); $document->addStyleSheet($this->baseurl . '/css/style.css'); jimport('joomla.environment.browser'); $browser = JBrowser::getInstance(); $browserType = $browser->getBrowser(); $browserVersion = $browser->getMajor(); if ($browserType == 'msie' && $browserVersion == 7) { $document->addStyleSheet($this->baseurl . '/css/style_ie7.css'); } elseif ($browserType == 'msie' && $browserVersion == 8) { $document->addStyleSheet($this->baseurl . '/css/style_ie8.css'); } if (defined('JLEGACY_CMS')) { $document->addScript(str_replace('plugins/editors/jckeditor/install', '', $this->baseurl) . 'media/system/js/mootools.js'); } else { $document->addScript(str_replace('plugins/editors/jckeditor/install', '', $this->baseurl) . 'media/system/js/mootools-core.js'); } }