Changeset 468471
- Timestamp:
- 11/28/2011 09:33:54 AM (14 years ago)
- File:
-
- 1 edited
-
wireless-wordpress/trunk/wireless.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wireless-wordpress/trunk/wireless.php
r436309 r468471 3 3 Plugin Name: Wireless-WordPress 4 4 Plugin URI: http://messense.me/wireless-wordpress.html 5 Description: 为你的WordPress增加wap主题模板功能,让你的WordPress博客拥有一个更加友好的 UI.6 Version: 1. 015 Description: 为你的WordPress增加wap主题模板功能,让你的WordPress博客拥有一个更加友好的手机版页面. 6 Version: 1.1 7 7 Author: 乱了感觉 8 8 Author URI: http://messense.me 9 9 */ 10 10 if (!defined('WIRELESS_VERSION')) { 11 define('WIRELESS_VERSION', '1. 0');11 define('WIRELESS_VERSION', '1.1'); 12 12 } 13 13 if (!class_exists('WirelessWordPress')) { … … 82 82 $this->option = array( 83 83 'wap_theme' => 'wireless', 84 'wap_imgcut' => 1,85 'wap_imgwidth' => 200,86 'wap_imgheight' => 200,84 'wap_imgcut' => 0, 85 'wap_imgwidth' => 800, 86 'wap_imgheight' => 500, 87 87 'wap_seindex' => 1, 88 88 'use_cookie' => 0, … … 131 131 return ''; //如果设置的手机版默认主题不存在则用电脑版主题 132 132 } 133 if ($this->is_mobile() > 0) {133 if ($this->is_mobile()) { 134 134 if ($this->get_option('use_session') > 0) { 135 135 $_SESSION['wireless'] = 1; … … 161 161 162 162 function is_mobile() { 163 $mobile = 0;163 $mobile = FALSE; 164 164 if (isset($_GET['mobile'])) { 165 165 $custom = intval($_GET['mobile']); 166 166 if ($custom > 0) { 167 $mobile = 1;167 $mobile = TRUE; 168 168 } 169 169 } else { 170 170 if (isset($_SESSION['wireless']) && $_SESSION['wireless'] > 0) { 171 $mobile = 1;172 } else if (isset($_COOKIE["wireless_" . COOKIEHASH]) && intval($_COOKIE["wireless_" . COOKIEHASH]) > 0) {173 $mobile = 1;171 $mobile = TRUE; 172 } else if (isset($_COOKIE["wireless_" . COOKIEHASH]) && intval($_COOKIE["wireless_" . COOKIEHASH]) > 0) { 173 $mobile = TRUE; 174 174 } else { 175 175 if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) { 176 $mobile = 1;176 $mobile = TRUE; 177 177 } else { 178 178 $ua = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ""; 179 $regex = "/.*( nokia|iphone|ipod|andriod|bada|motorola|^mot\-|softbank|foma|docomo|kddi|ip\.browser|up\.link|";179 $regex = "/.*(mobile|nokia|iphone|ipod|andriod|bada|motorola|^mot\-|softbank|foma|docomo|kddi|ip\.browser|up\.link|"; 180 180 $regex.="htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|ppc|"; 181 181 $regex.="blackberry|alcate|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|"; … … 186 186 $regex.="jig browser|hiptop|uc|^benq|haier|^lct|opera\s*mobi|opera\s*mini|2.0 MMP|240x320|400X240|Cellphone|WinWAP).*/i"; 187 187 if (preg_match($regex, $ua)) { 188 $mobile = 1;188 $mobile = TRUE; 189 189 } 190 190 } … … 277 277 </p> 278 278 <p><strong>Wap调整图片大小: </strong><input type="radio" name="wap_imgcut" value="1" <?php if ($this->get_option('wap_imgcut') > 0) 279 echo 'checked="checked "' ?>/> 调整 (推荐)<input type="radio" name="wap_imgcut" value="0" <?php if ($this->get_option('wap_imgcut') < 1)279 echo 'checked="checked "' ?>/> 调整 <input type="radio" name="wap_imgcut" value="0" <?php if ($this->get_option('wap_imgcut') < 1) 280 280 echo 'checked="checked "' ?>/> 不调整</p> 281 281 <p><strong>Wap图片显示宽度</strong><i>(仅当调整图片大小时有效)</i>:</p> … … 288 288 <p><strong>发送Cookies到客户端浏览器? </strong><input type="radio" name="use_cookie" value="1" <?php if ($this->get_option('use_cookie') > 0) 289 289 echo 'checked="checked "' ?>/> 发送 <input type="radio" name="use_cookie" value="0" <?php if ($this->get_option('use_cookie') < 1) 290 echo 'checked="checked "' ?>/> 不发送 <em>(如果您的博客出现headers modified之类的错误,请在此处设置不发送)</em></p>290 echo 'checked="checked "' ?>/> 不发送(推荐)</p> 291 291 <p><strong>启用PHP Session? </strong><input type="radio" name="use_session" value="1" <?php if ($this->get_option('use_session') > 0) 292 292 echo 'checked="checked "' ?>/> 启用(推荐) <input type="radio" name="use_session" value="0" <?php if ($this->get_option('use_session') < 1) … … 322 322 add_action('admin_notices', 'class_conflict_exception'); 323 323 } 324 ?>
Note: See TracChangeset
for help on using the changeset viewer.