' . __( 'View Mobile Site', 'jetpack' ) . ''; } function jetpack_mobile_request_handler() { global $wpdb; if (isset($_GET['ak_action'])) { $url = parse_url( get_bloginfo( 'url' ) ); $domain = $url['host']; if (!empty($url['path'])) { $path = $url['path']; } else { $path = '/'; } $redirect = false; switch ($_GET['ak_action']) { case 'reject_mobile': setcookie( 'akm_mobile' , 'false' , time() + 300000 , $path , $domain ); $redirect = true; /** * In Jetpack's Mobile theme, fires after the user taps on the link to display a full version of the site. * * @module minileven * * @since 1.8.0 */ do_action( 'mobile_reject_mobile' ); break; case 'force_mobile': case 'accept_mobile': setcookie( 'akm_mobile' , 'true' , time() + 300000 , $path , $domain ); $redirect = true; /** * In Jetpack's Mobile theme, fires after the user taps on the link to go back from full site to mobile site. * * @module minileven * * @since 1.8.0 */ do_action( 'mobile_force_mobile' ); break; } if ($redirect) { if ( isset( $_GET['redirect_to'] ) && $_GET['redirect_to'] ) { $go = urldecode( $_GET['redirect_to'] ); } else if (!empty($_SERVER['HTTP_REFERER'])) { $go = $_SERVER['HTTP_REFERER']; } else { $go = remove_query_arg( array( 'ak_action' ) ); } wp_safe_redirect( $go ); exit; } } } add_action('init', 'jetpack_mobile_request_handler'); function jetpack_mobile_theme_setup() { if ( jetpack_check_mobile() ) { // Redirect to download page if user clicked mobile app promo link in mobile footer if ( isset( $_GET['app-download'] ) ) { /** * Fires before you're redirected to download page if you clicked the mobile app promo link in mobile footer * * @module minileven * * @since 1.8.0 * * @param string $_GET['app-download'] app-download URL parameter. */ do_action( 'mobile_app_promo_download', $_GET['app-download'] ); switch ( $_GET['app-download'] ) { case 'android': header( 'Location: market://search?q=pname:org.wordpress.android' ); exit; break; case 'ios': header( 'Location: http://itunes.apple.com/us/app/wordpress/id335703880?mt=8' ); exit; break; case 'blackberry': header( 'Location: http://blackberry.wordpress.org/download/' ); exit; break; } } add_action('stylesheet', 'jetpack_mobile_stylesheet'); add_action('template', 'jetpack_mobile_template'); add_action('option_template', 'jetpack_mobile_template'); add_action('option_stylesheet', 'jetpack_mobile_stylesheet'); if ( class_exists( 'Jetpack_Custom_CSS' ) && method_exists( 'Jetpack_Custom_CSS', 'disable' ) && ! get_option( 'wp_mobile_custom_css' ) ) add_action( 'init', array( 'Jetpack_Custom_CSS', 'disable' ), 11 ); /** * Fires after Jetpack's mobile theme has been setup. * * @module minileven * * @since 1.8.0 */ do_action( 'mobile_setup' ); } } // Need a hook after plugins_loaded (since this code won't be loaded in Jetpack // until then) but after init (because it has its own init hooks to add). add_action( 'setup_theme', 'jetpack_mobile_theme_setup' ); if (isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'false') { add_action('wp_footer', 'jetpack_mobile_available'); } function jetpack_mobile_app_promo() { ?>

add_setting( 'wp_mobile_custom_css' , array( 'default' => true, 'transport' => 'postMessage', 'type' => 'option' ) ); $wp_customize->add_control( 'jetpack_mobile_css_control', array( 'type' => 'checkbox', 'label' => __( 'Include this CSS in the Mobile Theme', 'jetpack' ), 'section' => 'jetpack_custom_css', 'settings' => 'wp_mobile_custom_css', ) ); } add_action( 'jetpack_custom_css_customizer_controls', 'jetpack_mobile_customizer_controls' ); function jetpack_mobile_save_css_settings() { update_option( 'wp_mobile_custom_css', isset( $_POST['mobile_css'] ) && ! empty( $_POST['mobile_css'] ) ); } add_action( 'safecss_save_pre', 'jetpack_mobile_save_css_settings' );