Plugin Directory

Changeset 468471


Ignore:
Timestamp:
11/28/2011 09:33:54 AM (14 years ago)
Author:
messense
Message:

fix some bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wireless-wordpress/trunk/wireless.php

    r436309 r468471  
    33  Plugin Name: Wireless-WordPress
    44  Plugin URI: http://messense.me/wireless-wordpress.html
    5   Description: 为你的WordPress增加wap主题模板功能,让你的WordPress博客拥有一个更加友好的UI.
    6   Version: 1.01
     5  Description: 为你的WordPress增加wap主题模板功能,让你的WordPress博客拥有一个更加友好的手机版页面.
     6  Version: 1.1
    77  Author: 乱了感觉
    88  Author URI: http://messense.me
    99 */
    1010if (!defined('WIRELESS_VERSION')) {
    11     define('WIRELESS_VERSION', '1.0');
     11    define('WIRELESS_VERSION', '1.1');
    1212}
    1313if (!class_exists('WirelessWordPress')) {
     
    8282                $this->option = array(
    8383                    '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,
    8787                    'wap_seindex' => 1,
    8888                    'use_cookie' => 0,
     
    131131                return ''; //如果设置的手机版默认主题不存在则用电脑版主题
    132132            }
    133             if ($this->is_mobile() > 0) {
     133            if ($this->is_mobile()) {
    134134                if ($this->get_option('use_session') > 0) {
    135135                    $_SESSION['wireless'] = 1;
     
    161161
    162162        function is_mobile() {
    163             $mobile = 0;
     163            $mobile = FALSE;
    164164            if (isset($_GET['mobile'])) {
    165165                $custom = intval($_GET['mobile']);
    166166                if ($custom > 0) {
    167                     $mobile = 1;
     167                    $mobile = TRUE;
    168168                }
    169169            } else {
    170170                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;
    174174                } else {
    175175                    if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) {
    176                         $mobile = 1;
     176                        $mobile = TRUE;
    177177                    } else {
    178178                        $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|";
    180180                        $regex.="htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|ppc|";
    181181                        $regex.="blackberry|alcate|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|";
     
    186186                        $regex.="jig browser|hiptop|uc|^benq|haier|^lct|opera\s*mobi|opera\s*mini|2.0 MMP|240x320|400X240|Cellphone|WinWAP).*/i";
    187187                        if (preg_match($regex, $ua)) {
    188                             $mobile = 1;
     188                            $mobile = TRUE;
    189189                        }
    190190                    }
     
    277277                    </p>
    278278                    <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)
    280280                                              echo 'checked="checked "' ?>/> 不调整</p>
    281281                    <p><strong>Wap图片显示宽度</strong><i>(仅当调整图片大小时有效)</i>:</p>
     
    288288                    <p><strong>发送Cookies到客户端浏览器? </strong><input type="radio" name="use_cookie" value="1" <?php if ($this->get_option('use_cookie') > 0)
    289289                                                   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>
    291291                    <p><strong>启用PHP Session? </strong><input type="radio" name="use_session" value="1" <?php if ($this->get_option('use_session') > 0)
    292292                                                     echo 'checked="checked "' ?>/> 启用(推荐) <input type="radio" name="use_session" value="0" <?php if ($this->get_option('use_session') < 1)
     
    322322    add_action('admin_notices', 'class_conflict_exception');
    323323}
    324 ?>
Note: See TracChangeset for help on using the changeset viewer.