PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 2.7.5
Jetpack – WP Security, Backup, Speed, & Growth v2.7.5
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / theme-tools.php

theme-tools.php in Jetpack – WP Security, Backup, Speed, & Growth 2.7.5, at modules/theme-tools.php

77 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Load code specific to themes or theme tools
4 * This file is special, and is not an actual `module` as such.
5 * It is included by ./module-extras.php
6 */
7
8 function jetpack_load_theme_tools() {
9 if ( current_theme_supports( 'social-links' ) ) {
10 require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/social-links.php' );
11 }
12
13 if ( current_theme_supports( 'tonesque' ) ) {
14 jetpack_require_lib( 'tonesque' );
15 }
16
17 require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/random-redirect.php' );
18 }
19 add_action( 'init', 'jetpack_load_theme_tools', 30 );
20
21 // Featured Content has an internal check for theme support in the constructor.
22 require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/featured-content.php' );
23
24 /**
25 * INFINITE SCROLL
26 */
27
28 /**
29 * Load theme's infinite scroll annotation file, if present in the IS plugin.
30 * The `setup_theme` action is used because the annotation files should be using `after_setup_theme` to register support for IS.
31 *
32 * As released in Jetpack 2.0, a child theme's parent wasn't checked for in the plugin's bundled support, hence the convoluted way the parent is checked for now.
33 *
34 * @uses is_admin, wp_get_theme, get_theme, get_current_theme, apply_filters
35 * @action setup_theme
36 * @return null
37 */
38 function jetpack_load_infinite_scroll_annotation() {
39 if ( is_admin() && isset( $_GET['page'] ) && 'jetpack' == $_GET['page'] ) {
40 $theme = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_theme( get_current_theme() );
41
42 if ( ! is_a( $theme, 'WP_Theme' ) && ! is_array( $theme ) )
43 return;
44
45 $customization_file = apply_filters( 'infinite_scroll_customization_file', dirname( __FILE__ ) . "/infinite-scroll/themes/{$theme['Stylesheet']}.php", $theme['Stylesheet'] );
46
47 if ( is_readable( $customization_file ) ) {
48 require_once( $customization_file );
49 }
50 elseif ( ! empty( $theme['Template'] ) ) {
51 $customization_file = dirname( __FILE__ ) . "/infinite-scroll/themes/{$theme['Template']}.php";
52
53 if ( is_readable( $customization_file ) )
54 require_once( $customization_file );
55 }
56 }
57 }
58 add_action( 'setup_theme', 'jetpack_load_infinite_scroll_annotation' );
59
60 /**
61 * Prevent IS from being activated if theme doesn't support it
62 *
63 * @param bool $can_activate
64 * @filter jetpack_can_activate_infinite-scroll
65 * @return bool
66 */
67 function jetpack_can_activate_infinite_scroll( $can_activate ) {
68 return (bool) current_theme_supports( 'infinite-scroll' );
69 }
70 add_filter( 'jetpack_can_activate_infinite-scroll', 'jetpack_can_activate_infinite_scroll' );
71
72 // Custom Post Types - we don't want a module card for these (yet)
73 require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/comics.php' );
74 require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/testimonial.php' );
75 require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/nova.php' );
76
77