本文整理汇总了PHP中JBrowser::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JBrowser::getInstance方法的具体用法?PHP JBrowser::getInstance怎么用?PHP JBrowser::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JBrowser
的用法示例。
在下文中一共展示了JBrowser::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addTracking
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);
}
示例2: isMobile
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;
}
}
示例3: getRepeatable
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;
}
示例4: display
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);
}
示例5: onInit
/**
* 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;
}
示例6: __construct
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 = "";
}
}
示例7: isMsieLT10
/**
*
* @return type
*/
public static function isMsieLT10()
{
jimport('joomla.environment.browser');
$oBrowser = JBrowser::getInstance();
return (($oBrowser->getBrowser() == 'msie') && ($oBrowser->getMajor() <= '9'));
}
示例8: plgSystemMobile
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');
}
}
示例9: setupTheme
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>");
}
}
}
示例10: passBrowsers
/**
* 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';
}
}
示例11: isMobile
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;
}
示例12: onAfterInitialise
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');
}
}
示例13: gkIsOldIE
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;
}
示例14: _addScripts
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');
}
}
示例15: onAfterInitialise
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);
}
}