|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Module Name: Mobile Theme |
|
5
|
|
|
* Module Description: Enable the Jetpack Mobile theme |
|
6
|
|
|
* Sort Order: 21 |
|
7
|
|
|
* Recommendation Order: 11 |
|
8
|
|
|
* First Introduced: 1.8 |
|
9
|
|
|
* Requires Connection: No |
|
10
|
|
|
* Auto Activate: No |
|
11
|
|
|
* Module Tags: Appearance, Mobile, Recommended |
|
12
|
|
|
* Feature: Appearance |
|
13
|
|
|
* Additional Search Queries: mobile, theme, minileven |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
function jetpack_load_minileven() { |
|
17
|
|
|
include dirname( __FILE__ ) . "/minileven/minileven.php"; |
|
18
|
|
|
|
|
19
|
|
|
if ( Jetpack_Options::get_option_and_ensure_autoload( 'wp_mobile_app_promos', '0' ) != '1' ) |
|
20
|
|
|
remove_action( 'wp_mobile_theme_footer', 'jetpack_mobile_app_promo' ); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
add_action( 'jetpack_modules_loaded', 'minileven_loaded' ); |
|
24
|
|
|
|
|
25
|
|
|
function minileven_loaded() { |
|
26
|
|
|
Jetpack::enable_module_configurable( __FILE__ ); |
|
27
|
|
|
Jetpack::module_configuration_load( __FILE__, 'minileven_configuration_load' ); |
|
28
|
|
|
Jetpack::module_configuration_screen( __FILE__, 'minileven_configuration_screen' ); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
function minileven_configuration_load() { |
|
32
|
|
|
if ( isset( $_POST['action'] ) && $_POST['action'] == 'save_options' && $_POST['_wpnonce'] == wp_create_nonce( 'minileven' ) ) { |
|
33
|
|
View Code Duplication |
if ( isset( $_POST['wp_mobile_excerpt'] ) ) { |
|
34
|
|
|
update_option( 'wp_mobile_excerpt', '1' == $_POST['wp_mobile_excerpt'] ? '1' : '0' ); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
View Code Duplication |
if ( isset( $_POST['wp_mobile_featured_images'] ) ) { |
|
38
|
|
|
update_option( 'wp_mobile_featured_images', '1' == $_POST['wp_mobile_featured_images'] ? '1' : '0' ); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
update_option( 'wp_mobile_app_promos', ( isset( $_POST['wp_mobile_app_promos'] ) ) ? '1' : '0' ); |
|
42
|
|
|
|
|
43
|
|
|
Jetpack::state( 'message', 'module_configured' ); |
|
44
|
|
|
wp_safe_redirect( Jetpack::module_configuration_url( 'minileven' ) ); |
|
45
|
|
|
exit; |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
function minileven_configuration_screen() { |
|
50
|
|
|
$excerpts = ( 0 == get_option( 'wp_mobile_excerpt' ) ) ? 0 : 1; |
|
51
|
|
|
$featured_images = ( 0 == get_option( 'wp_mobile_featured_images' ) ) ? 0 : 1; |
|
52
|
|
|
$promos = ( '1' == get_option( 'wp_mobile_app_promos' ) ) ? 1 : 0; |
|
53
|
|
|
|
|
54
|
|
|
?> |
|
55
|
|
|
<form method="post"> |
|
56
|
|
|
<input type="hidden" name="action" value="save_options" /> |
|
57
|
|
|
<?php wp_nonce_field( 'minileven' ); ?> |
|
58
|
|
|
<table id="menu" class="form-table"> |
|
59
|
|
|
<tr valign="top"> |
|
60
|
|
|
<th scope="row"><?php _e( 'Excerpts', 'jetpack' ); ?></th> |
|
61
|
|
|
<td> |
|
62
|
|
|
<label> |
|
63
|
|
|
<input name="wp_mobile_excerpt" type="radio" value="1" class="code" <?php checked( 1, $excerpts, true ); ?> /> |
|
64
|
|
|
<?php _e( 'Enable excerpts on front page and on archive pages', 'jetpack' ); ?> |
|
65
|
|
|
</label> |
|
66
|
|
|
<br /> |
|
67
|
|
|
<label> |
|
68
|
|
|
<input name="wp_mobile_excerpt" type="radio" value="0" class="code" <?php checked( 0, $excerpts, true ); ?> /> |
|
69
|
|
|
<?php _e( 'Show full posts on front page and on archive pages', 'jetpack' ); ?> |
|
70
|
|
|
</label> |
|
71
|
|
|
</td> |
|
72
|
|
|
</tr> |
|
73
|
|
|
<tr valign="top"> |
|
74
|
|
|
<th scope="row"><?php _e( 'Featured Images', 'jetpack' ); ?></th> |
|
75
|
|
|
<td> |
|
76
|
|
|
<label> |
|
77
|
|
|
<input name="wp_mobile_featured_images" type="radio" value="0" class="code" <?php checked( 0, $featured_images, true ); ?> /> |
|
78
|
|
|
<?php _e( 'Hide all featured images', 'jetpack' ); ?> |
|
79
|
|
|
</label> |
|
80
|
|
|
<br /> |
|
81
|
|
|
<label> |
|
82
|
|
|
<input name="wp_mobile_featured_images" type="radio" value="1" class="code" <?php checked( 1, $featured_images, true ); ?> /> |
|
83
|
|
|
<?php _e( 'Display featured images', 'jetpack' ); ?> |
|
84
|
|
|
</label> |
|
85
|
|
|
</td> |
|
86
|
|
|
</tr> |
|
87
|
|
|
<tr valign="top"> |
|
88
|
|
|
<th scope="row"><?php _e( 'Mobile App Promos', 'jetpack' ); ?></th> |
|
89
|
|
|
<td> |
|
90
|
|
|
<label> |
|
91
|
|
|
<input name="wp_mobile_app_promos" type="checkbox" value="1" <?php checked( 1, $promos, true ); ?> /> |
|
92
|
|
|
<?php _e ( 'Show a promo for the WordPress mobile apps in the footer of the mobile theme.', 'jetpack' ); ?> |
|
93
|
|
|
</label> |
|
94
|
|
|
</td> |
|
95
|
|
|
</tr> |
|
96
|
|
|
</table> |
|
97
|
|
|
<p class="submit"> |
|
98
|
|
|
<input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save configuration', 'jetpack' ); ?>" /> |
|
99
|
|
|
</p> |
|
100
|
|
|
</form> |
|
101
|
|
|
<h3><?php _e( 'Mobile Apps', 'jetpack' ); ?></h3> |
|
102
|
|
|
<p><?php _e( 'Take WordPress with you.', 'jetpack' ); ?></p> |
|
103
|
|
|
<a href="https://wordpress.org/mobile/" target="_blank"><img src="<?php echo plugin_dir_url( __FILE__ ); ?>/minileven/images/wp-app-devices.png" width="332" height="73" /></a> |
|
104
|
|
|
<p><?php printf( __( 'We have apps for <a href="%s" target="_blank">iOS (iPhone, iPad, iPod Touch) and Android</a>!', 'jetpack' ), 'https://apps.wordpress.org/' ); ?></p> |
|
105
|
|
|
<?php |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
function minileven_theme_root( $theme_root ) { |
|
109
|
|
|
if ( jetpack_check_mobile() ) { |
|
110
|
|
|
return dirname( __FILE__ ) . '/minileven/theme'; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
return $theme_root; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
add_filter( 'theme_root', 'minileven_theme_root' ); |
|
117
|
|
|
|
|
118
|
|
|
function minileven_theme_root_uri( $theme_root_uri ) { |
|
119
|
|
|
if ( jetpack_check_mobile() ) { |
|
120
|
|
|
return plugins_url( 'modules/minileven/theme', dirname( __FILE__ ) ); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
return $theme_root_uri; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
add_filter( 'theme_root_uri', 'minileven_theme_root_uri' ); |
|
127
|
|
|
|
|
128
|
|
|
function minileven_enabled( $wp_mobile_disable_option ) { |
|
129
|
|
|
return true; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { |
|
133
|
|
|
add_filter( 'option_wp_mobile_disable', 'minileven_enabled' ); |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
jetpack_load_minileven(); |
|
137
|
|
|
|