1+ <?php
2+
3+ /**
4+ * Module Name: Mobile Theme
5+ * Module Description: Automatically optimize your site for mobile devices.
6+ * Sort Order: 11
7+ * First Introduced: 1.8
8+ */
9+
10+ function jetpack_load_minileven () {
11+ include dirname ( __FILE__ ) . "/minileven/minileven.php " ;
12+ }
13+
14+ add_action ( 'jetpack_modules_loaded ' , 'minileven_loaded ' );
15+
16+ function minileven_loaded () {
17+ Jetpack ::enable_module_configurable ( __FILE__ );
18+ Jetpack ::module_configuration_load ( __FILE__ , 'minileven_configuration_load ' );
19+ Jetpack ::module_configuration_screen ( __FILE__ , 'minileven_configuration_screen ' );
20+ }
21+
22+ function minileven_configuration_load () {
23+ if ( isset ( $ _POST ['action ' ] ) && $ _POST ['action ' ] == 'save_options ' && $ _POST ['_wpnonce ' ] == wp_create_nonce ( 'minileven ' ) ) {
24+ if ( isset ( $ _POST ['wp_mobile_excerpt ' ] ) )
25+ update_option ( 'wp_mobile_excerpt ' , '1 ' == $ _POST ['wp_mobile_excerpt ' ] ? '1 ' : '0 ' );
26+
27+ Jetpack ::state ( 'message ' , 'module_configured ' );
28+ wp_safe_redirect ( Jetpack ::module_configuration_url ( 'minileven ' ) );
29+ exit ;
30+ }
31+ }
32+
33+ function minileven_configuration_screen () {
34+ $ excerpts = ( 0 == get_option ( 'wp_mobile_excerpt ' ) ) ? 0 : 1 ;
35+
36+ ?>
37+ <form method="post">
38+ <input type="hidden" name="action" value="save_options" />
39+ <?php wp_nonce_field ( 'minileven ' ); ?>
40+ <table id="menu" class="form-table">
41+ <tr valign="top">
42+ <th scope="row"><?php _e ( 'Excerpts ' , 'jetpack ' ); ?> </th>
43+ <td>
44+ <label>
45+ <input name="wp_mobile_excerpt" type="radio" value="1" class="code" <?php checked ( 1 , $ excerpts , true ); ?> />
46+ <?php _e ( 'Enable excerpts on front page and on archive pages ' , 'jetpack ' ); ?>
47+ </label>
48+ <br />
49+ <label>
50+ <input name="wp_mobile_excerpt" type="radio" value="0" class="code" <?php checked ( 0 , $ excerpts , true ); ?> />
51+ <?php _e ( 'Show full posts on front page and on archive pages ' , 'jetpack ' ); ?>
52+ </label>
53+ </td>
54+ </tr>
55+ </table>
56+ <p class="submit">
57+ <input type="submit" class="button-primary" value="<?php esc_attr_e ( __ ( 'Save configuration ' , 'jetpack ' ) ); ?> " />
58+ </p>
59+ </form>
60+ <?php
61+ }
62+
63+ function minileven_theme_root ( $ theme_root ) {
64+ if ( jetpack_check_mobile () ) {
65+ return dirname ( __FILE__ ) . '/theme ' ;
66+ }
67+
68+ return $ theme_root ;
69+ }
70+
71+ add_filter ( 'theme_root ' , 'minileven_theme_root ' );
72+
73+ function minileven_theme_root_uri ( $ theme_root_uri ) {
74+ if ( jetpack_check_mobile () ) {
75+ return plugins_url ( 'minileven/theme ' , dirname ( __FILE__ ) );
76+ }
77+
78+ return $ theme_root_uri ;
79+ }
80+
81+ add_filter ( 'theme_root_uri ' , 'minileven_theme_root_uri ' );
82+
83+ function minileven_enabled ( $ wp_mobile_disable_option ) {
84+ return true ;
85+ }
86+
87+ add_filter ( 'option_wp_mobile_disable ' , 'minileven_enabled ' );
88+
89+ jetpack_load_minileven ();
0 commit comments