예제 #1
0
파일: core.php 프로젝트: ayoayco/upbeat
 /**
  * Check for mobile user agent
  *
  * @since 1.6.0
  * @author Part taken from WPtouch plugin (http://www.bravenewcode.com)
  * @return bool $result of  check
  */
 static function detect_mobile_phone()
 {
     $useragents = array();
     // Check if WPtouch is running
     if (function_exists('bnc_wptouch_get_user_agents')) {
         $useragents = bnc_wptouch_get_user_agents();
     } else {
         $useragents = array("iPhone", "iPod", "Android", "dream", "CUPCAKE", "blackberry9500", "blackberry9530", "blackberry9520", "blackberry9550", "blackberry9800", "webOS", "incognito", "webmate");
         asort($useragents);
     }
     // Godfather Steve says no to flash
     if (is_array($useragents)) {
         $useragents[] = "iPad";
     }
     // Apple iPad;
     // WPtouch User Agent Filter
     $useragents = apply_filters('wptouch_user_agents', $useragents);
     foreach ($useragents as $useragent) {
         if (preg_match("#{$useragent}#i", $_SERVER['HTTP_USER_AGENT'])) {
             return true;
         }
     }
     return false;
 }
예제 #2
0
 function detectAppleMobile($query = '')
 {
     $container = $_SERVER['HTTP_USER_AGENT'];
     // The below prints out the user agent array. Uncomment to see it shown on the page.
     // print_r($container);
     $this->applemobile = false;
     $useragents = bnc_wptouch_get_user_agents();
     $devfile = compat_get_plugin_dir('wptouch') . '/include/developer.mode';
     foreach ($useragents as $useragent) {
         if (preg_match("#{$useragent}#i", $container) || file_exists($devfile)) {
             $this->applemobile = true;
         }
     }
 }
예제 #3
0
파일: wptouch.php 프로젝트: alx/Tetalab
 function detectAppleMobile($query = '')
 {
     $container = $_SERVER['HTTP_USER_AGENT'];
     // The below prints out the user agent array. Uncomment to see it shown on the page.
     // print_r($container);
     // Add whatever user agents you want here to the array if you want to make this show on another device.
     // No guarantees it'll look pretty, though!
     $useragents = bnc_wptouch_get_user_agents();
     $devfile = compat_get_plugin_dir('wptouch') . '/include/developer.mode';
     $this->applemobile = false;
     foreach ($useragents as $useragent) {
         if (eregi($useragent, $container) || file_exists($devfile)) {
             $this->applemobile = true;
         }
     }
 }
예제 #4
0
</p>	
			<p><?php 
_e("* WPtouch Restricted Mode attempts to fix issues where other plugins load scripts which interfere with WPtouch CSS and JavaScript.", "wptouch");
?>
</p>
		 	<br />
		 	<h4><?php 
_e("Custom User-Agents", "wptouch");
?>
</h4>
		 	<p><?php 
_e("Enter a comma-separated list of user-agents to enable WPtouch for a device that isn't currently officially supported.", "wptouch");
?>
</p>
		 	<p><?php 
echo sprintf(__("The currently enabled user-agents are: <em class='supported'>%s</em>", "wptouch"), implode(", ", bnc_wptouch_get_user_agents()));
?>
</p>
		</div><!-- left-content -->
	
	<div class="right-content">
		<ul>
			<li>
				<input class="checkbox" type="checkbox" name="enable-cats-button" <?php 
if (isset($wptouch_settings['enable-cats-button']) && $wptouch_settings['enable-cats-button'] == 1) {
    echo 'checked';
}
?>
 />
				<label class="label" for="enable-cats-button"><?php 
_e("Enable Categories tab in the header", "wptouch");
예제 #5
0
 function detectAppleMobile($query = '')
 {
     $container = $_SERVER['HTTP_USER_AGENT'];
     // The below prints out the user agent array. Uncomment to see it shown on the page.
     // print_r($container);
     $this->applemobile = false;
     $useragents = bnc_wptouch_get_user_agents();
     $exclude_agents = bnc_wptouch_get_exclude_user_agents();
     foreach ($useragents as $useragent) {
         if (preg_match("#{$useragent}#i", $container)) {
             $this->applemobile = true;
             break;
         }
     }
     if ($this->applemobile) {
         foreach ($exclude_agents as $agent) {
             if (preg_match("#{$agent}#i", $container)) {
                 $this->applemobile = false;
                 break;
             }
         }
     }
 }
예제 #6
0
function wp_super_cache_wptouch_browsers($browsers)
{
    global $cache_wptouch, $wptouch_exclude_ua, $wp_cache_config_file;
    if (false == function_exists('bnc_wptouch_get_exclude_user_agents') || false == function_exists('bnc_wptouch_get_user_agents')) {
        return $browsers;
    }
    $browsers = implode(',', bnc_wptouch_get_exclude_user_agents());
    // hack, support exclude agents too
    if ($browsers != $wptouch_exclude_ua) {
        wp_cache_replace_line('^ *\\$wptouch_exclude_ua', "\$wptouch_exclude_ua = '{$browsers}';", $wp_cache_config_file);
        $wptouch_exclude_ua = $browsers;
    }
    return bnc_wptouch_get_user_agents();
}