[44] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /*
|
---|
| 4 | Plugin Name: WordPress Mobile Edition
|
---|
| 5 | Plugin URI: http://crowdfavorite.com/wordpress/
|
---|
| 6 | Description: Show your mobile visitors a site presentation designed just for them. Rich experience for iPhone, Android, etc. and clean simple formatting for less capable mobile browsers. Cache-friendly with a Carrington-based theme, and progressive enhancement for advanced mobile browsers.
|
---|
| 7 | Version: 3.1
|
---|
| 8 | Author: Crowd Favorite
|
---|
| 9 | Author URI: http://crowdfavorite.com
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | // WordPress Mobile Edition
|
---|
| 13 | //
|
---|
| 14 | // Copyright (c) 2002-2009 Crowd Favorite, Ltd.
|
---|
| 15 | // http://crowdfavorite.com
|
---|
| 16 | //
|
---|
| 17 | // Released under the GPL license
|
---|
| 18 | // http://www.opensource.org/licenses/gpl-license.php
|
---|
| 19 | //
|
---|
| 20 | // **********************************************************************
|
---|
| 21 | // This program is distributed in the hope that it will be useful, but
|
---|
| 22 | // WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 23 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 24 | // *****************************************************************
|
---|
| 25 |
|
---|
| 26 | // ini_set('display_errors', '1'); ini_set('error_reporting', E_ALL);
|
---|
| 27 |
|
---|
| 28 | define('CF_MOBILE_THEME', 'carrington-mobile-1.0.2');
|
---|
| 29 |
|
---|
| 30 | if (!defined('PLUGINDIR')) {
|
---|
| 31 | define('PLUGINDIR','wp-content/plugins');
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | load_plugin_textdomain('cf-mobile');
|
---|
| 35 |
|
---|
| 36 | if (is_file(trailingslashit(ABSPATH.PLUGINDIR).'wp-mobile.php')) {
|
---|
| 37 | define('CFMOBI_FILE', trailingslashit(ABSPATH.PLUGINDIR).'wp-mobile.php');
|
---|
| 38 | }
|
---|
| 39 | else if (is_file(trailingslashit(ABSPATH.PLUGINDIR).'wordpress-mobile-edition/wp-mobile.php')) {
|
---|
| 40 | define('CFMOBI_FILE', trailingslashit(ABSPATH.PLUGINDIR).'wordpress-mobile-edition/wp-mobile.php');
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | register_activation_hook(CFMOBI_FILE, 'cfmobi_install');
|
---|
| 44 |
|
---|
| 45 | function cfmobi_default_browsers($type = 'mobile') {
|
---|
| 46 | $mobile = array(
|
---|
| 47 | '2.0 MMP',
|
---|
| 48 | '240x320',
|
---|
| 49 | '400X240',
|
---|
| 50 | 'AvantGo',
|
---|
| 51 | 'BlackBerry',
|
---|
| 52 | 'Blazer',
|
---|
| 53 | 'Cellphone',
|
---|
| 54 | 'Danger',
|
---|
| 55 | 'DoCoMo',
|
---|
| 56 | 'Elaine/3.0',
|
---|
| 57 | 'EudoraWeb',
|
---|
| 58 | 'Googlebot-Mobile',
|
---|
| 59 | 'hiptop',
|
---|
| 60 | 'IEMobile',
|
---|
| 61 | 'KYOCERA/WX310K',
|
---|
| 62 | 'LG/U990',
|
---|
| 63 | 'MIDP-2.',
|
---|
| 64 | 'MMEF20',
|
---|
| 65 | 'MOT-V',
|
---|
| 66 | 'NetFront',
|
---|
| 67 | 'Newt',
|
---|
| 68 | 'Nintendo Wii',
|
---|
| 69 | 'Nitro', // Nintendo DS
|
---|
| 70 | 'Nokia',
|
---|
| 71 | 'Opera Mini',
|
---|
| 72 | 'Palm',
|
---|
| 73 | 'PlayStation Portable',
|
---|
| 74 | 'portalmmm',
|
---|
| 75 | 'Proxinet',
|
---|
| 76 | 'ProxiNet',
|
---|
| 77 | 'SHARP-TQ-GX10',
|
---|
| 78 | 'SHG-i900',
|
---|
| 79 | 'Small',
|
---|
| 80 | 'SonyEricsson',
|
---|
| 81 | 'Symbian OS',
|
---|
| 82 | 'SymbianOS',
|
---|
| 83 | 'TS21i-10',
|
---|
| 84 | 'UP.Browser',
|
---|
| 85 | 'UP.Link',
|
---|
| 86 | 'webOS', // Palm Pre, etc.
|
---|
| 87 | 'Windows CE',
|
---|
| 88 | 'WinWAP',
|
---|
| 89 | 'YahooSeeker/M1A1-R2D2',
|
---|
| 90 | );
|
---|
| 91 | $touch = array(
|
---|
| 92 | 'iPhone',
|
---|
| 93 | 'iPod',
|
---|
| 94 | 'Android',
|
---|
| 95 | 'BlackBerry9530',
|
---|
| 96 | 'LG-TU915 Obigo', // LG touch browser
|
---|
| 97 | 'LGE VX',
|
---|
| 98 | 'webOS', // Palm Pre, etc.
|
---|
| 99 | 'Nokia5800',
|
---|
| 100 | );
|
---|
| 101 | switch ($type) {
|
---|
| 102 | case 'mobile':
|
---|
| 103 | case 'touch':
|
---|
| 104 | return $$type;
|
---|
| 105 | }
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | $mobile = explode("\n", trim(get_option('cfmobi_mobile_browsers')));
|
---|
| 109 | $cfmobi_mobile_browsers = apply_filters('cfmobi_mobile_browsers', $mobile);
|
---|
| 110 | $touch = explode("\n", trim(get_option('cfmobi_touch_browsers')));
|
---|
| 111 | $cfmobi_touch_browsers = apply_filters('cfmobi_touch_browsers', $touch);
|
---|
| 112 |
|
---|
| 113 | function cfmobi_install() {
|
---|
| 114 | global $cfmobi_default_mobile_browsers;
|
---|
| 115 | add_option('cfmobi_mobile_browsers', implode("\n", cfmobi_default_browsers('mobile')));
|
---|
| 116 | global $cfmobi_default_touch_browsers;
|
---|
| 117 | add_option('cfmobi_touch_browsers', implode("\n", cfmobi_default_browsers('touch')));
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | function cfmobi_init() {
|
---|
| 121 | global $cfmobi_mobile_browsers, $cfmobi_touch_browsers;
|
---|
| 122 | if (is_admin() && !cfmobi_installed()) {
|
---|
| 123 | global $wp_version;
|
---|
| 124 | if (isset($wp_version) && version_compare($wp_version, '2.9', '>=')) {
|
---|
| 125 | add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>WP Mobile is incorrectly installed. Please check the <a href=\"http://alexking.org/projects/wordpress/readme?project=wordpress-mobile-edition\">README</a>.</p></div>';" ) );
|
---|
| 126 | }
|
---|
| 127 | }
|
---|
| 128 | if (isset($_COOKIE['cf_mobile']) && $_COOKIE['cf_mobile'] == 'false') {
|
---|
| 129 | add_action('the_content', 'cfmobi_mobile_available');
|
---|
| 130 | }
|
---|
| 131 | }
|
---|
| 132 | add_action('init', 'cfmobi_init');
|
---|
| 133 |
|
---|
| 134 | function cfmobi_check_mobile() {
|
---|
| 135 | global $cfmobi_mobile_browsers, $cfmobi_touch_browsers;
|
---|
| 136 | $mobile = null;
|
---|
| 137 | if (!isset($_SERVER["HTTP_USER_AGENT"]) || (isset($_COOKIE['cf_mobile']) && $_COOKIE['cf_mobile'] == 'false')) {
|
---|
| 138 | $mobile = false;
|
---|
| 139 | }
|
---|
| 140 | else if (isset($_COOKIE['cf_mobile']) && $_COOKIE['cf_mobile'] == 'true') {
|
---|
| 141 | $mobile = true;
|
---|
| 142 | }
|
---|
| 143 | $browsers = array_merge($cfmobi_mobile_browsers, $cfmobi_touch_browsers);
|
---|
| 144 | if (is_null($mobile) && count($browsers)) {
|
---|
| 145 | foreach ($browsers as $browser) {
|
---|
| 146 | if (!empty($browser) && strpos($_SERVER["HTTP_USER_AGENT"], trim($browser)) !== false) {
|
---|
| 147 | $mobile = true;
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 | }
|
---|
| 151 | if (is_null($mobile)) {
|
---|
| 152 | $mobile = false;
|
---|
| 153 | }
|
---|
| 154 | return apply_filters('cfmobi_check_mobile', $mobile);
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | if (cfmobi_check_mobile()) {
|
---|
| 158 | add_filter('template', 'cfmobi_template');
|
---|
| 159 | add_filter('option_template', 'cfmobi_template');
|
---|
| 160 | add_filter('option_stylesheet', 'cfmobi_template');
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | function cfmobi_template($theme) {
|
---|
| 164 | if (cfmobi_installed()) {
|
---|
| 165 | return apply_filters('cfmobi_template', CF_MOBILE_THEME);
|
---|
| 166 | }
|
---|
| 167 | else {
|
---|
| 168 | return $theme;
|
---|
| 169 | }
|
---|
| 170 | }
|
---|
| 171 |
|
---|
| 172 | function cfmobi_installed() {
|
---|
| 173 | return is_dir(ABSPATH.'/wp-content/themes/'.CF_MOBILE_THEME);
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | function cfmobi_mobile_exit() {
|
---|
| 177 | echo '<p><a href="'.trailingslashit(get_bloginfo('home')).'?cf_action=reject_mobile">Esci dalla Edizione per Cellulare </a> <span class="small">(vai alla versione standard del browser)</span>.</p>';
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | function cfmobi_mobile_available($content) {
|
---|
| 181 | if (!defined('WPCACHEHOME')) {
|
---|
| 182 | $content = $content.'<p><a href="'.trailingslashit(get_bloginfo('home')).'?cf_action=show_mobile">Ritorna all\'Edizione per Cellulare</a>.</p>';
|
---|
| 183 | }
|
---|
| 184 | return $content;
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | function cfmobi_mobile_link() {
|
---|
| 188 | if (!defined('WPCACHEHOME')) {
|
---|
| 189 | echo '<a href="'.trailingslashit(get_bloginfo('home')).'?cf_action=show_mobile">Mobile Editione</a>';
|
---|
| 190 | }
|
---|
| 191 | }
|
---|
| 192 |
|
---|
| 193 | // TODO - add sidebar widget for link, with some sort of graphic?
|
---|
| 194 |
|
---|
| 195 | function cfmobi_request_handler() {
|
---|
| 196 | if (!empty($_GET['cf_action'])) {
|
---|
| 197 | $url = parse_url(get_bloginfo('home'));
|
---|
| 198 | $domain = $url['host'];
|
---|
| 199 | if (!empty($url['path'])) {
|
---|
| 200 | $path = $url['path'];
|
---|
| 201 | }
|
---|
| 202 | else {
|
---|
| 203 | $path = '/';
|
---|
| 204 | }
|
---|
| 205 | $redirect = false;
|
---|
| 206 | switch ($_GET['cf_action']) {
|
---|
| 207 | case 'cfmobi_admin_js':
|
---|
| 208 | cfmobi_admin_js();
|
---|
| 209 | break;
|
---|
| 210 | case 'cfmobi_admin_css':
|
---|
| 211 | cfmobi_admin_css();
|
---|
| 212 | die();
|
---|
| 213 | break;
|
---|
| 214 | case 'reject_mobile':
|
---|
| 215 | setcookie(
|
---|
| 216 | 'cf_mobile'
|
---|
| 217 | , 'false'
|
---|
| 218 | , time() + 300000
|
---|
| 219 | , $path
|
---|
| 220 | , $domain
|
---|
| 221 | );
|
---|
| 222 | $redirect = true;
|
---|
| 223 | break;
|
---|
| 224 | case 'show_mobile':
|
---|
| 225 | setcookie(
|
---|
| 226 | 'cf_mobile'
|
---|
| 227 | , 'true'
|
---|
| 228 | , time() + 300000
|
---|
| 229 | , $path
|
---|
| 230 | , $domain
|
---|
| 231 | );
|
---|
| 232 | $redirect = true;
|
---|
| 233 | break;
|
---|
| 234 | case 'cfmobi_who':
|
---|
| 235 | if (current_user_can('manage_options')) {
|
---|
| 236 | header("Content-type: text/plain");
|
---|
| 237 | echo sprintf(__('Browser: %s', 'cf-mobile'), strip_tags($_SERVER['HTTP_USER_AGENT']));
|
---|
| 238 | die();
|
---|
| 239 | }
|
---|
| 240 | break;
|
---|
| 241 | }
|
---|
| 242 | if ($redirect) {
|
---|
| 243 | if (!empty($_SERVER['HTTP_REFERER'])) {
|
---|
| 244 | $go = $_SERVER['HTTP_REFERER'];
|
---|
| 245 | }
|
---|
| 246 | else {
|
---|
| 247 | $go = get_bloginfo('home');
|
---|
| 248 | }
|
---|
| 249 | header('Location: '.$go);
|
---|
| 250 | die();
|
---|
| 251 | }
|
---|
| 252 | }
|
---|
| 253 | if (!empty($_POST['cf_action'])) {
|
---|
| 254 | switch ($_POST['cf_action']) {
|
---|
| 255 | case 'cfmobi_update_settings':
|
---|
| 256 | cfmobi_save_settings();
|
---|
| 257 | wp_redirect(trailingslashit(get_bloginfo('wpurl')).'wp-admin/options-general.php?page=wp-mobile.php&updated=true');
|
---|
| 258 | die();
|
---|
| 259 | break;
|
---|
| 260 | }
|
---|
| 261 | }
|
---|
| 262 | }
|
---|
| 263 | add_action('init', 'cfmobi_request_handler');
|
---|
| 264 |
|
---|
| 265 | function cfmobi_admin_js() {
|
---|
| 266 | global $cfmobi_default_mobile_browsers, $cfmobi_default_touch_browsers;
|
---|
| 267 | header('Content-type: text/javascript');
|
---|
| 268 | $mobile = str_replace(array("'","\r", "\n"), array("\'", '', ''), implode('\\n', cfmobi_default_browsers('mobile')));
|
---|
| 269 | $touch = str_replace(array("'","\r", "\n"), array("\'", '', ''), implode('\\n', cfmobi_default_browsers('touch')));
|
---|
| 270 | ?>
|
---|
| 271 | jQuery(function($) {
|
---|
| 272 | $('#cfmobi_mobile_reset').click(function() {
|
---|
| 273 | $('#cfmobi_mobile_browsers').val('<?php echo $mobile; ?>');
|
---|
| 274 | return false;
|
---|
| 275 | });
|
---|
| 276 | $('#cfmobi_touch_reset').click(function() {
|
---|
| 277 | $('#cfmobi_touch_browsers').val('<?php echo $touch; ?>');
|
---|
| 278 | return false;
|
---|
| 279 | });
|
---|
| 280 | });
|
---|
| 281 | <?php
|
---|
| 282 | die();
|
---|
| 283 | }
|
---|
| 284 | if (is_admin()) {
|
---|
| 285 | wp_enqueue_script('cfmobi_admin_js', trailingslashit(get_bloginfo('url')).'?cf_action=cfmobi_admin_js', array('jquery'));
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 | function cfmobi_admin_css() {
|
---|
| 289 | header('Content-type: text/css');
|
---|
| 290 | ?>
|
---|
| 291 | fieldset.options div.option {
|
---|
| 292 | background: #EAF3FA;
|
---|
| 293 | margin-bottom: 8px;
|
---|
| 294 | padding: 10px;
|
---|
| 295 | }
|
---|
| 296 | fieldset.options div.option label {
|
---|
| 297 | display: block;
|
---|
| 298 | float: left;
|
---|
| 299 | font-weight: bold;
|
---|
| 300 | margin-right: 10px;
|
---|
| 301 | width: 150px;
|
---|
| 302 | }
|
---|
| 303 | fieldset.options div.option span.help {
|
---|
| 304 | color: #666;
|
---|
| 305 | font-size: 11px;
|
---|
| 306 | margin-left: 8px;
|
---|
| 307 | }
|
---|
| 308 | #cfmobi_mobile_browsers, #cfmobi_touch_browsers {
|
---|
| 309 | height: 200px;
|
---|
| 310 | width: 300px;
|
---|
| 311 | }
|
---|
| 312 | #cfmobi_mobile_reset, #cfmobi_touch_reset {
|
---|
| 313 | display: block;
|
---|
| 314 | font-size: 11px;
|
---|
| 315 | font-weight: normal;
|
---|
| 316 | }
|
---|
| 317 | <?php
|
---|
| 318 | die();
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | function cfmobi_admin_head() {
|
---|
| 322 | echo '<link rel="stylesheet" type="text/css" href="'.trailingslashit(get_bloginfo('url')).'?cf_action=cfmobi_admin_css" />';
|
---|
| 323 | }
|
---|
| 324 | add_action('admin_head', 'cfmobi_admin_head');
|
---|
| 325 |
|
---|
| 326 | $cfmobi_settings = array(
|
---|
| 327 | 'cfmobi_mobile_browsers' => array(
|
---|
| 328 | 'type' => 'textarea',
|
---|
| 329 | 'label' => 'Mobile Browsers <a href="#" id="cfmobi_mobile_reset">Reset to Default</a>',
|
---|
| 330 | 'default' => cfmobi_default_browsers('mobile'),
|
---|
| 331 | 'help' => '',
|
---|
| 332 | ),
|
---|
| 333 | 'cfmobi_touch_browsers' => array(
|
---|
| 334 | 'type' => 'textarea',
|
---|
| 335 | 'label' => 'Touch Browsers <a href="#" id="cfmobi_touch_reset">Reset to Default</a>',
|
---|
| 336 | 'default' => cfmobi_default_browsers('touch'),
|
---|
| 337 | 'help' => '(iPhone, Android G1, BlackBerry Storm, etc.)',
|
---|
| 338 | ),
|
---|
| 339 | );
|
---|
| 340 |
|
---|
| 341 | function cfmobi_setting($option) {
|
---|
| 342 | $value = get_option($option);
|
---|
| 343 | if (empty($value)) {
|
---|
| 344 | global $cfmobi_settings;
|
---|
| 345 | $value = $cfmobi_settings[$option]['default'];
|
---|
| 346 | }
|
---|
| 347 | return $value;
|
---|
| 348 | }
|
---|
| 349 |
|
---|
| 350 | function cfmobi_admin_menu() {
|
---|
| 351 | if (current_user_can('manage_options')) {
|
---|
| 352 | add_options_page(
|
---|
| 353 | __('WordPress Mobile Edition', 'cf-mobile')
|
---|
| 354 | , __('Mobile', 'cf-mobile')
|
---|
| 355 | , 10
|
---|
| 356 | , basename(__FILE__)
|
---|
| 357 | , 'cfmobi_settings_form'
|
---|
| 358 | );
|
---|
| 359 | }
|
---|
| 360 | }
|
---|
| 361 | add_action('admin_menu', 'cfmobi_admin_menu');
|
---|
| 362 |
|
---|
| 363 | function cfmobi_plugin_action_links($links, $file) {
|
---|
| 364 | $plugin_file = basename(__FILE__);
|
---|
| 365 | if ($file == $plugin_file) {
|
---|
| 366 | $settings_link = '<a href="options-general.php?page='.$plugin_file.'">'.__('Settings', 'cf-mobile').'</a>';
|
---|
| 367 | array_unshift($links, $settings_link);
|
---|
| 368 | }
|
---|
| 369 | return $links;
|
---|
| 370 | }
|
---|
| 371 | add_filter('plugin_action_links', 'cfmobi_plugin_action_links', 10, 2);
|
---|
| 372 |
|
---|
| 373 | if (!function_exists('cf_settings_field')) {
|
---|
| 374 | function cf_settings_field($key, $config) {
|
---|
| 375 | $option = get_option($key);
|
---|
| 376 | $label = '<label for="'.$key.'">'.$config['label'].'</label>';
|
---|
| 377 | $help = '<span class="help">'.$config['help'].'</span>';
|
---|
| 378 | switch ($config['type']) {
|
---|
| 379 | case 'select':
|
---|
| 380 | $output = $label.'<select name="'.$key.'" id="'.$key.'">';
|
---|
| 381 | foreach ($config['options'] as $val => $display) {
|
---|
| 382 | $option == $val ? $sel = ' selected="selected"' : $sel = '';
|
---|
| 383 | $output .= '<option value="'.$val.'"'.$sel.'>'.htmlspecialchars($display).'</option>';
|
---|
| 384 | }
|
---|
| 385 | $output .= '</select>'.$help;
|
---|
| 386 | break;
|
---|
| 387 | case 'textarea':
|
---|
| 388 | if (is_array($option)) {
|
---|
| 389 | $option = implode("\n", $option);
|
---|
| 390 | }
|
---|
| 391 | $output = $label.'<textarea name="'.$key.'" id="'.$key.'">'.htmlspecialchars($option).'</textarea>'.$help;
|
---|
| 392 | break;
|
---|
| 393 | case 'string':
|
---|
| 394 | case 'int':
|
---|
| 395 | default:
|
---|
| 396 | $output = $label.'<input name="'.$key.'" id="'.$key.'" value="'.htmlspecialchars($option).'" />'.$help;
|
---|
| 397 | break;
|
---|
| 398 | }
|
---|
| 399 | return '<div class="option">'.$output.'<div class="clear"></div></div>';
|
---|
| 400 | }
|
---|
| 401 | }
|
---|
| 402 |
|
---|
| 403 | function cfmobi_settings_form() {
|
---|
| 404 | global $cfmobi_settings;
|
---|
| 405 | print('
|
---|
| 406 | <div class="wrap">
|
---|
| 407 | <h2>'.__('WordPress Mobile Edition', 'cf-mobile').'</h2>
|
---|
| 408 | <form id="cfmobi_settings_form" name="cfmobi_settings_form" action="'.get_bloginfo('wpurl').'/wp-admin/options-general.php" method="post">
|
---|
| 409 | <input type="hidden" name="cf_action" value="cfmobi_update_settings" />
|
---|
| 410 | <p>'.__('Browsers that have a <a href="http://en.wikipedia.org/wiki/User_agent">User Agent</a> matching a key below will be shown the mobile version of your site instead of the normal theme.', 'cf-mobile').'</p>
|
---|
| 411 | <fieldset class="options">
|
---|
| 412 | ');
|
---|
| 413 | foreach ($cfmobi_settings as $key => $config) {
|
---|
| 414 | echo cf_settings_field($key, $config);
|
---|
| 415 | }
|
---|
| 416 | print('
|
---|
| 417 | </fieldset>
|
---|
| 418 | <p>'.sprintf(__('To see the User Agent for your browser, <a href="%s">click here</a>.', 'cf-mobile'), trailingslashit(get_bloginfo('home')).'?cf_action=cfmobi_who').'</p>
|
---|
| 419 | <p class="submit">
|
---|
| 420 | <input type="submit" name="submit" class="button-primary" value="'.__('Save Settings', 'cf-mobile').'" />
|
---|
| 421 | </p>
|
---|
| 422 | </form>
|
---|
| 423 | </div>
|
---|
| 424 | ');
|
---|
| 425 | do_action('cfmobi_settings_form');
|
---|
| 426 | }
|
---|
| 427 |
|
---|
| 428 | function cfmobi_save_settings() {
|
---|
| 429 | if (!current_user_can('manage_options')) {
|
---|
| 430 | return;
|
---|
| 431 | }
|
---|
| 432 | global $cfmobi_settings;
|
---|
| 433 | foreach ($cfmobi_settings as $key => $option) {
|
---|
| 434 | $value = '';
|
---|
| 435 | switch ($option['type']) {
|
---|
| 436 | case 'int':
|
---|
| 437 | $value = intval($_POST[$key]);
|
---|
| 438 | break;
|
---|
| 439 | case 'select':
|
---|
| 440 | $test = stripslashes($_POST[$key]);
|
---|
| 441 | if (isset($option['options'][$test])) {
|
---|
| 442 | $value = $test;
|
---|
| 443 | }
|
---|
| 444 | break;
|
---|
| 445 | case 'string':
|
---|
| 446 | case 'textarea':
|
---|
| 447 | default:
|
---|
| 448 | $value = stripslashes($_POST[$key]);
|
---|
| 449 | break;
|
---|
| 450 | }
|
---|
| 451 | update_option($key, $value);
|
---|
| 452 | }
|
---|
| 453 | }
|
---|
| 454 |
|
---|
| 455 | if (!function_exists('get_snoopy')) {
|
---|
| 456 | function get_snoopy() {
|
---|
| 457 | include_once(ABSPATH.'/wp-includes/class-snoopy.php');
|
---|
| 458 | return new Snoopy;
|
---|
| 459 | }
|
---|
| 460 | }
|
---|
| 461 |
|
---|
| 462 | //a:22:{s:11:"plugin_name";s:24:"WordPress Mobile Edition";s:10:"plugin_uri";s:42:"http://crowdfavorite.com/wordpress/plugins";s:18:"plugin_description";s:277:"Show your mobile visitors a site presentation designed just for them. Rich experience for iPhone, Android, etc. and clean simple formatting for less capable mobile browsers. Cache-friendly with a Carrington-based theme, and progressive enhancement for advanced mobile browsers.";s:14:"plugin_version";s:3:"3.0";s:6:"prefix";s:6:"cfmobi";s:8:"filename";s:13:"wp-mobile.php";s:12:"localization";s:9:"cf-mobile";s:14:"settings_title";s:24:"WordPress Mobile Edition";s:13:"settings_link";s:6:"Mobile";s:4:"init";s:1:"1";s:7:"install";s:1:"1";s:9:"post_edit";b:0;s:12:"comment_edit";b:0;s:6:"jquery";b:0;s:6:"wp_css";b:0;s:5:"wp_js";b:0;s:9:"admin_css";s:1:"1";s:8:"admin_js";s:1:"1";s:15:"request_handler";s:1:"1";s:6:"snoopy";s:1:"1";s:11:"setting_cat";b:0;s:14:"setting_author";b:0;}
|
---|
| 463 |
|
---|
| 464 | ?> |
---|