本文整理汇总了PHP中is_browser函数的典型用法代码示例。如果您正苦于以下问题:PHP is_browser函数的具体用法?PHP is_browser怎么用?PHP is_browser使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_browser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_wysiwyg_compatible
/**
* Returns the maximum compatible editor mode depending on permissions, options and browser
*
* @param integer The requested editor mode (-1 = user default, 0 = simple textarea, 1 = standard editor controls, 2 = wysiwyg controls)
* @param string Editor type (full = 'fe', quick reply = 'qr')
*
* @return integer The maximum possible mode (0, 1, 2)
*/
function is_wysiwyg_compatible($userchoice = -1, $editormode = 'fe')
{
global $vbulletin;
// Netscape 4... don't even bother to check user choice as the toolbars won't work
if (is_browser('netscape') or is_browser('webtv')) {
return 0;
}
// check for a standard setting
if ($userchoice == -1) {
$userchoice = $vbulletin->userinfo['showvbcode'];
}
// unserialize the option if we need to
if (!is_array($vbulletin->options['editormodes_array'])) {
$vbulletin->options['editormodes_array'] = unserialize($vbulletin->options['editormodes']);
}
// make sure we have a valid editor mode to check
switch ($editormode) {
case 'fe':
case 'qr':
case 'qe':
break;
default:
$editormode = 'fe';
}
// check board options for toolbar permissions
if ($userchoice > $vbulletin->options['editormodes_array']["{$editormode}"]) {
$choice = $vbulletin->options['editormodes_array']["{$editormode}"];
} else {
$choice = $userchoice;
}
// Legacy Hook 'editor_wysiwyg_compatible' Removed //
if ($choice == 2) {
if (!is_browser('opera') or is_browser('opera', '9.0')) {
// Check Mozilla Browsers
if (is_browser('firebird', '0.6.1') or is_browser('camino', '0.9') or is_browser('mozilla', '20030312') and !is_browser('firebird') and !is_browser('camino')) {
return 2;
} else {
if (is_browser('ie', '5.5') and !is_browser('mac')) {
return 2;
} else {
if (false and is_browser('opera', '9.0')) {
return 2;
} else {
return 1;
}
}
}
} else {
// browser is incompatible - return standard toolbar
return 1;
}
} else {
// return standard or no toolbar
return $choice;
}
}
示例2: is_browser_shorcode
/**
* @param $browser
* @param string $content
*
* @return bool|string
*/
function is_browser_shorcode($browser, $content = "") {
$browser = shortcode_atts(array(
'name' => '',
'version' => ''
), $browser, 'is_browser');
if (is_browser($browser['name'], $browser['version'])) {
return ($content);
} else {
return FALSE;
}
}
示例3: construct_nav_option
function construct_nav_option($title, $url)
{
// creates an <option> or <a href for the left-panel of index.php
// (depending on value of $cpnavjs)
// NOTE: '&' . $vbulletin->session->vars['sessionurl'] will be AUTOMATICALLY added to the URL - do not add to your link!
global $vbulletin, $options;
static $sessionlink, $bubblefix;
if (!isset($options)) {
$options = array();
if ($vbulletin->session->vars['sessionurl'] == '') {
$sessionlink = '';
} else {
$sessionlink = "&s=" . $vbulletin->session->vars['sessionhash'];
}
// only include the bubble-fix for IE - ignore when encountering the Konqueror/Safari event model
if (is_browser('ie')) {
$bubblefix = ' onclick="nobub()"';
} else {
$bubblefix = '';
}
}
$options[] = "\t\t<div class=\"navlink-normal\" onclick=\"nav_goto('{$url}{$sessionlink}');\" onmouseover=\"this.className='navlink-hover';\" onmouseout=\"this.className='navlink-normal'\"><a href=\"{$url}{$sessionlink}\"{$bubblefix}>{$title}</a></div>\n";
}
示例4: vB_BbCodeParser_Wysiwyg
/**
* Constructor. Sets up the tag list.
*
* @param vB_Registry Reference to registry object
* @param array List of tags to parse
* @param boolean Whether to append custom tags (they will not be parsed anyway)
*/
function vB_BbCodeParser_Wysiwyg(&$registry, $tag_list = array(), $append_custom_tags = true)
{
parent::vB_BbCodeParser($registry, $tag_list, $append_custom_tags);
// change all unparsable tags to use the unparsable callback
foreach ($this->unparsed_tags as $remove) {
if (isset($this->tag_list['option']["{$remove}"])) {
$this->tag_list['option']["{$remove}"]['callback'] = 'handle_wysiwyg_unparsable';
unset($this->tag_list['option']["{$remove}"]['html'], $this->tag_list['option']["{$remove}"]['strip_space_after']);
}
if (isset($this->tag_list['no_option']["{$remove}"])) {
$this->tag_list['no_option']["{$remove}"]['callback'] = 'handle_wysiwyg_unparsable';
unset($this->tag_list['no_option']["{$remove}"]['html'], $this->tag_list['option']["{$remove}"]['strip_space_after']);
}
}
// make the "pre" tags use the correct handler
foreach (array('code', 'php', 'html') as $pre_tag) {
if (isset($this->tag_list['no_option']["{$pre_tag}"])) {
$this->tag_list['no_option']["{$pre_tag}"]['callback'] = 'handle_preformatted_tag';
unset($this->tag_list['no_option']["{$pre_tag}"]['html'], $this->tag_list['option']["{$pre_tag}"]['strip_space_after']);
}
}
$this->type = is_browser('ie') ? 'ie' : 'moz_css';
}
示例5: get_line_end_format
/**
* Helper function for fetching the line end format.
*
* @return String 'win', 'unix', or 'mac' based on the user's browser..
*/
function get_line_end_format()
{
if (is_browser('win')) {
return 'win';
} elseif (is_browser('unix')) {
return 'unix';
} elseif (is_browser('mac')) {
return 'mac';
} else {
return 'unix';
}
}
示例6: file_download
function file_download($filestring, $filename, $filetype = 'application/octet-stream')
{
if (!isset($isIE)) {
static $isIE;
$isIE = iif(is_browser('ie') or is_browser('opera'), true, false);
}
if ($isIE and $filetype == 'application/octet-stream') {
$filetype = 'application/octetstream';
}
if (preg_match('~&#([0-9]+);~', $filename)) {
if (function_exists('iconv')) {
$filename = @iconv(vB_Template_Runtime::fetchStyleVar('charset'), 'UTF-8//IGNORE', $filename);
}
$filename = preg_replace_callback('~&#([0-9]+);~', 'convert_int_to_utf8_callback', $filename);
$filename_charset = 'utf-8';
} else {
$filename_charset = vB_Template_Runtime::fetchStyleVar('charset');
}
$filename = preg_replace('#[\\r\\n]#', '', $filename);
// Opera and IE have not a clue about this, mozilla puts on incorrect extensions.
if (is_browser('mozilla')) {
$filename = "filename*=" . $filename_charset . "''" . rawurlencode($filename);
} else {
// other browsers seem to want names in UTF-8
if ($filename_charset != 'utf-8' and function_exists('iconv')) {
$filename = @iconv($filename_charset, 'UTF-8//IGNORE', $filename);
}
// Should just make this (!is_browser('ie'))
if (is_browser('opera') or is_browser('konqueror') or is_browser('safari')) {
// Opera / konqueror does not support encoded file names
$filename = 'filename="' . str_replace('"', '', $filename) . '"';
} else {
// encode the filename to stay within spec
$filename = 'filename="' . rawurlencode($filename) . '"';
}
}
header('Content-Type: ' . $filetype);
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; ' . $filename);
header('Content-Length: ' . strlen($filestring));
header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
echo $filestring;
exit;
}
示例7: rawurlencode
{
$filename = "filename*=" . $filename_charset . "''" . rawurlencode($filename);
}
else
{
// other browsers seem to want names in UTF-8
if ($filename_charset != 'utf-8' AND function_exists('iconv'))
{
$filename_conv = iconv($filename_charset, 'UTF-8//IGNORE', $filename);
if ($filename_conv !== false)
{
$filename = $filename_conv;
}
}
if (is_browser('opera') OR is_browser('konqueror') OR is_browser('safari'))
{
// Opera / Konqueror does not support encoded file names
$filename = 'filename="' . str_replace('"', '', $filename) . '"';
}
else
{
// encode the filename to stay within spec
$filename = 'filename="' . rawurlencode($filename) . '"';
}
}
if (in_array($extension, array('jpg', 'jpe', 'jpeg', 'gif', 'png')))
{
header("Content-disposition: inline; $filename");
header('Content-transfer-encoding: binary');
示例8: print_template_javascript
/**
* Prints a row containing template search javascript controls
*/
function print_template_javascript()
{
global $stylevar, $vbphrase, $vbulletin;
print_phrase_ref_popup_javascript();
echo '<script type="text/javascript" src="../clientscript/vbulletin_templatemgr.js"></script>';
echo '<script type="text/javascript">
<!--
var textarea_id = "' . $vbulletin->textarea_id . '";
var vbphrase = { \'not_found\' : "' . fetch_js_safe_string($vbphrase['not_found']) . '" };
// -->
</script>
';
print_label_row(iif(is_browser('ie') or is_browser('mozilla', '20040707'), $vbphrase['search_in_template'], $vbphrase['additional_functions']), iif(is_browser('ie') or is_browser('mozilla', '1.7'), '
<input type="text" class="bginput" name="string" accesskey="t" value="' . htmlspecialchars_uni($vbulletin->GPC['searchstring']) . '" size="20" onChange="n=0;" tabindex="1" />
<input type="button" class="button" style="font-weight:normal" value=" ' . $vbphrase['find'] . ' " accesskey="f" onClick="findInPage(document.cpform.string.value);" tabindex="1" />
') . '<input type="button" class="button" style="font-weight:normal" value=" ' . $vbphrase['copy'] . ' " accesskey="c" onclick="HighlightAll();" tabindex="1" />
<input type="button" class="button" style="font-weight:normal" value="' . $vbphrase['view_quickref'] . '" accesskey="v" onclick="js_open_phrase_ref(0, 0);" tabindex="1" />
');
}
示例9: handle_bbcode_quote
/**
* Handles a [quote] tag. Displays a string in an area indicating it was quoted from someone/somewhere else.
*
* @param string The body of the quote.
* @param string If tag has option, the original user to post.
*
* @return string HTML representation of the tag.
*/
function handle_bbcode_quote($message, $username = '')
{
global $vbulletin, $vbphrase, $stylevar, $show;
// remove smilies from username
$username = $this->strip_smilies($username);
if (preg_match('/^(.+)(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});\\s*(\\d+)\\s*$/U', $username, $match)) {
$username = $match[1];
$postid = $match[2];
} else {
$postid = 0;
}
$username = $this->do_word_wrap($username);
$show['username'] = iif($username != '', true, false);
$message = $this->strip_front_back_whitespace($message, 1);
if ($this->options['cachable'] == false) {
$show['iewidthfix'] = (is_browser('ie') and !is_browser('ie', 6));
} else {
// this post may be cached, so we can't allow this "fix" to be included in that cache
$show['iewidthfix'] = false;
}
$template = $this->printable ? 'bbcode_quote_printable' : 'bbcode_quote';
eval('$html = "' . fetch_template($template) . '";');
return $html;
}
示例10: array
require_once CWD . '/includes/init.php';
$vbulletin->input->clean_array_gpc('r', array('referrerid' => TYPE_UINT, 'postid' => TYPE_UINT, 'threadid' => TYPE_UINT, 'forumid' => TYPE_INT, 'pollid' => TYPE_UINT, 'a' => TYPE_STR, 'mode' => TYPE_STR, 'nojs' => TYPE_BOOL));
$vbulletin->input->clean_array_gpc('p', array('ajax' => TYPE_BOOL));
// #############################################################################
// turn off popups if they are not available to this browser
if ($vbulletin->options['usepopups']) {
if (is_browser('ie', 5) and !is_browser('mac') or is_browser('mozilla') or is_browser('firebird') or is_browser('opera', 7) or is_browser('webkit') or is_browser('konqueror', 3.2)) {
// use popups
} else {
// don't use popups
$vbulletin->options['usepopups'] = 0;
}
}
// #############################################################################
// set a variable used by the spacer templates to detect IE versions less than 6
$show['old_explorer'] = (is_browser('ie') and !is_browser('ie', 6));
// #############################################################################
// read the list of collapsed menus from the 'vbulletin_collapse' cookie
$vbcollapse = array();
if (!empty($vbulletin->GPC['vbulletin_collapse'])) {
$val = preg_split('#\\n#', $vbulletin->GPC['vbulletin_collapse'], -1, PREG_SPLIT_NO_EMPTY);
foreach ($val as $key) {
$vbcollapse["collapseobj_{$key}"] = 'display:none;';
$vbcollapse["collapseimg_{$key}"] = '_collapsed';
$vbcollapse["collapsecel_{$key}"] = '_collapsed';
}
unset($val);
}
// #############################################################################
// start server too busy
$servertoobusy = false;
示例11: kleeja_run_hook
($hook = kleeja_run_hook('down_go_page')) ? eval($hook) : null;
//run hook
//start download ,,
if (!is_readable($path_file)) {
($hook = kleeja_run_hook('down_file_not_exists')) ? eval($hook) : null;
//run hook
big_error('----', 'Error - can not open file.');
}
if (!($size = @filesize($path_file))) {
$size = $d_size;
}
$name = empty($rn) ? $n : $rn;
if (is_browser('mozilla')) {
$h_name = "filename*=UTF-8''" . rawurlencode(htmlspecialchars_decode($name));
} else {
if (is_browser('opera, safari, konqueror')) {
$h_name = 'filename="' . str_replace('"', '', htmlspecialchars_decode($name)) . '"';
} else {
$h_name = 'filename="' . rawurlencode(htmlspecialchars_decode($name)) . '"';
}
}
//Figure out the MIME type (if not specified)
$ext = array_pop(explode('.', $path_file));
$mime_type = get_mime_for_header($ext);
if (@ob_get_length()) {
@ob_end_clean();
}
// required for IE, otherwise Content-Disposition may be ignored
if (@ini_get('zlib.output_compression')) {
@ini_set('zlib.output_compression', 'Off');
}
示例12: is_browser
/**
* Browser detection
* returns whether or not the visiting browser is the one specified [part of kleeja style system]
* i.e. is_browser('ie6') -> true or false
* i.e. is_browser('ie, opera') -> true or false
*/
function is_browser($b)
{
//is there , which mean -OR-
if (strpos($b, ',') !== false) {
$e = explode(',', $b);
foreach ($e as $n) {
if (is_browser(trim($n))) {
return true;
}
}
return false;
}
//if no agent, let's take the worst case
$u_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? htmlspecialchars((string) strtolower($_SERVER['HTTP_USER_AGENT'])) : (function_exists('getenv') ? getenv('HTTP_USER_AGENT') : '');
$t = trim(preg_replace('/[0-9.]/', '', $b));
$r = trim(preg_replace('/[a-z]/', '', $b));
$return = false;
switch ($t) {
case 'ie':
$return = strpos($u_agent, trim('msie ' . $r)) !== false ? true : false;
break;
case 'firefox':
$return = strpos(str_replace('/', ' ', $u_agent), trim('firefox ' . $r)) !== false ? true : false;
break;
case 'safari':
$return = strpos($u_agent, trim('safari/' . $r)) !== false ? true : false;
break;
case 'chrome':
$return = strpos($u_agent, trim('chrome ' . $r)) !== false ? true : false;
break;
case 'flock':
$return = strpos($u_agent, trim('flock ' . $r)) !== false ? true : false;
break;
case 'opera':
$return = strpos($u_agent, trim('opera ' . $r)) !== false ? true : false;
break;
case 'konqueror':
$return = strpos($u_agent, trim('konqueror/' . $r)) !== false ? true : false;
break;
case 'mozilla':
$return = strpos($u_agent, trim('gecko/' . $r)) !== false ? true : false;
break;
case 'webkit':
$return = strpos($u_agent, trim('applewebkit/' . $r)) !== false ? true : false;
break;
/**
* Mobile Phones are so popular those days, so we have to support them ...
* This is still in our test lab.
* @see http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones
**/
/**
* Mobile Phones are so popular those days, so we have to support them ...
* This is still in our test lab.
* @see http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones
**/
case 'mobile':
$mobile_agents = array('iPhone;', 'iPod;', 'iPad;', 'BlackBerry', 'Android', 'HTC', 'IEMobile', 'LG/', 'LG-', 'LGE-', 'MOT-', 'Nokia', 'SymbianOS', 'nokia_', 'PalmSource', 'webOS', 'SAMSUNG-', 'SEC-SGHU', 'SonyEricsson');
$return = false;
foreach ($mobile_agents as $agent) {
if (strpos($u_agent, $agent) !== false) {
$return = true;
break;
}
}
break;
}
($hook = kleeja_run_hook('is_browser_func')) ? eval($hook) : null;
//run hook
return $return;
}
示例13: is_wysiwyg_compatible
/**
* Returns the maximum compatible editor mode depending on permissions, options and browser
*
* @param integer The requested editor mode (-1 = user default, 0 = simple textarea, 1 = standard editor controls, 2 = wysiwyg controls)
* @param string Editor type (full = 'fe', quick reply = 'qr')
*
* @return integer The maximum possible mode (0, 1, 2)
*/
function is_wysiwyg_compatible($userchoice = -1, $editormode = 'fe')
{
global $vbulletin;
// Netscape 4... don't even bother to check user choice as the toolbars won't work
if (is_browser('netscape') OR is_browser('webtv'))
{
return 0;
}
// check for a standard setting
if ($userchoice == -1)
{
$userchoice = $vbulletin->userinfo['showvbcode'];
}
// unserialize the option if we need to
if (!is_array($vbulletin->options['editormodes_array']))
{
$vbulletin->options['editormodes_array'] = unserialize($vbulletin->options['editormodes']);
}
// make sure we have a valid editor mode to check
switch ($editormode)
{
case 'fe':
case 'qr':
case 'qe':
break;
default:
$editormode = 'fe';
}
// check board options for toolbar permissions
if ($userchoice > $vbulletin->options['editormodes_array']["$editormode"])
{
$choice = $vbulletin->options['editormodes_array']["$editormode"];
}
else
{
$choice = $userchoice;
}
$hook_return = null;
($hook = vBulletinHook::fetch_hook('editor_wysiwyg_compatible')) ? eval($hook) : false;
if ($hook_return !== null)
{
return $hook_return;
}
if ($choice == 2) // attempting to use WYSIWYG, check that we really can
{
if (!is_browser('opera') OR is_browser('opera', '9.0'))
{
// Check Mozilla Browsers
if (is_browser('firebird', '0.6.1') OR is_browser('camino', '0.9') OR (is_browser('mozilla', '20030312') AND !is_browser('firebird') AND !is_browser('camino')))
{
return 2;
}
else if (is_browser('ie', '5.5') AND !is_browser('mac'))
{
return 2;
}
else if (false AND is_browser('opera', '9.0'))
{
return 2;
}
else
{
return 1;
}
}
else
{
// browser is incompatible - return standard toolbar
return 1;
}
}
else
{
// return standard or no toolbar
return $choice;
}
}
示例14: clean_fragment
/**
* Cleans output to be parsed into the uri.
* Setting $canonical is useful for creating redirect url's that cannot be
* encoded for redirects.
*
* @param string $fragment
* @param bool $canonical - Whether to encode for output
* @return string
*/
public static function clean_fragment($fragment, $canonical = false)
{
global $vbulletin;
if (class_exists('vBulletinHook', false)) {
($hook = vBulletinHook::fetch_hook('friendlyurl_clean_fragment')) ? eval($hook) : false;
}
// Convert to UTF-8
if (self::UNI_CONVERT == $vbulletin->options['friendlyurl_unicode']) {
// convert to UTF-8
$fragment = to_utf8($fragment, $vbulletin->userinfo['lang_charset']);
// convert NCRs
$fragment = unhtmlspecialchars($fragment, true);
} else {
if (self::UNI_STRIP == $vbulletin->options['friendlyurl_unicode']) {
// strip NCRs
$fragment = stripncrs($fragment);
}
}
// Remove url entities
$fragment = self::clean_entities($fragment);
// Prepare the URL for output
if (!$canonical and self::UNI_CONVERT == $vbulletin->options['friendlyurl_unicode'] and 'UTF-8' != $vbulletin->userinfo['lang_charset']) {
if (is_browser('ie')) {
if ($vbulletin->options['friendlyurl_ncrencode']) {
$fragment = ncrencode($fragment, true);
}
} else {
$fragment = urlencode($fragment);
}
} else {
if ($canonical and self::UNI_IGNORE == $vbulletin->options['friendlyurl_unicode']) {
// ensure NCRs are converted
$fragment = unhtmlspecialchars($fragment, true);
}
}
return $fragment;
}
示例15: intval
);
$messagearea = "
<script type=\"text/javascript\">
<!--
var threaded_mode = $threadedmode;
var require_click = $show[qr_require_click];
var is_last_page = $show[allow_ajax_qr]; // leave for people with cached JS files
var allow_ajax_qr = $show[allow_ajax_qr];
var last_post_id = $LASTPOSTID;
var ajax_last_post = " . intval($effective_lastpost) . ";
// -->
</script>
$messagearea
";
if (is_browser('mozilla') AND $show['wysiwyg'] == 2)
{
// Mozilla WYSIWYG can't have the QR collapse button,
// so remove that and force QR to be expanded
$show['quickreply_collapse'] = false;
unset(
$vbcollapse["collapseobj_quickreply"],
$vbcollapse["collapseimg_quickreply"],
$vbcollapse["collapsecel_quickreply"]
);
}
else
{
$show['quickreply_collapse'] = true;
}