本文整理汇总了PHP中JBrowser类的典型用法代码示例。如果您正苦于以下问题:PHP JBrowser类的具体用法?PHP JBrowser怎么用?PHP JBrowser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JBrowser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIsSSLConnection
/**
* Test...
*
* @covers JBrowser::isSSLConnection
*
* @return void
*/
public function testIsSSLConnection()
{
unset($_SERVER['HTTPS']);
$this->assertThat($this->object->isSSLConnection(), $this->equalTo(false));
$_SERVER['HTTPS'] = 'on';
$this->assertThat($this->object->isSSLConnection(), $this->equalTo(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: 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);
}
示例4: 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;
}
示例5: __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 = "";
}
}
示例6: 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;
}
示例7: 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');
}
}
示例8: 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>");
}
}
}
示例9: isMsieLT10
/**
*
* @return type
*/
public static function isMsieLT10()
{
jimport('joomla.environment.browser');
$oBrowser = JBrowser::getInstance();
return (($oBrowser->getBrowser() == 'msie') && ($oBrowser->getMajor() <= '9'));
}
示例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: _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);
}
示例12: match
function match($userAgent = null, $accept = null)
{
parent::match($userAgent, $accept);
// Add detection for mobile devices that
// JBrowser did not cover
if (strstr($this->_agent, 'Mobile')) {
$this->_mobile = true;
}
}
示例13: 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;
}
示例14: 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');
}
}
示例15: 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;
}