Plugin Directory


Ignore:
Timestamp:
07/09/2014 07:57:26 PM (12 years ago)
Author:
enej
Message:

Jetpack: Updating trunk to 3.1-beta1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/modules/theme-tools.php

    r894377 r945782  
    77
    88function 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 
    139    if ( current_theme_supports( 'tonesque' ) ) {
    1410        jetpack_require_lib( 'tonesque' );
    1511    }
    16 
    17     require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/random-redirect.php' );
    1812}
    1913add_action( 'init', 'jetpack_load_theme_tools', 30 );
    20 
    21 // Featured Content has an internal check for theme support in the constructor.
    22 // This could already be defined by Twenty Fourteen if it's loaded first.
    23 // Be sure to not load this on the plugin page in case another plugin is activating
    24 // with the same class name in an attempt to override Jetpack's Featured_Content
    25 if ( ! class_exists( 'Featured_Content' ) && isset( $GLOBALS['pagenow'] ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
    26     require_once( JETPACK__PLUGIN_DIR . 'modules/theme-tools/featured-content.php' );
    27 }
    28 
    29 /**
    30  * INFINITE SCROLL
    31  */
    32 
    33 /**
    34  * Load theme's infinite scroll annotation file, if present in the IS plugin.
    35  * The `setup_theme` action is used because the annotation files should be using `after_setup_theme` to register support for IS.
    36  *
    37  * 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.
    38  *
    39  * @uses is_admin, wp_get_theme, get_theme, get_current_theme, apply_filters
    40  * @action setup_theme
    41  * @return null
    42  */
    43 function jetpack_load_infinite_scroll_annotation() {
    44     if ( is_admin() && isset( $_GET['page'] ) && 'jetpack' == $_GET['page'] ) {
    45         $theme = function_exists( 'wp_get_theme' ) ? wp_get_theme() : get_theme( get_current_theme() );
    46 
    47         if ( ! is_a( $theme, 'WP_Theme' ) && ! is_array( $theme ) )
    48             return;
    49 
    50         $customization_file = apply_filters( 'infinite_scroll_customization_file', dirname( __FILE__ ) . "/infinite-scroll/themes/{$theme['Stylesheet']}.php", $theme['Stylesheet'] );
    51 
    52         if ( is_readable( $customization_file ) ) {
    53             require_once( $customization_file );
    54         }
    55         elseif ( ! empty( $theme['Template'] ) ) {
    56             $customization_file = dirname( __FILE__ ) . "/infinite-scroll/themes/{$theme['Template']}.php";
    57 
    58             if ( is_readable( $customization_file ) )
    59                 require_once( $customization_file );
    60         }
    61     }
    62 }
    63 add_action( 'setup_theme', 'jetpack_load_infinite_scroll_annotation' );
    64 
    65 /**
    66  * Prevent IS from being activated if theme doesn't support it
    67  *
    68  * @param bool $can_activate
    69  * @filter jetpack_can_activate_infinite-scroll
    70  * @return bool
    71  */
    72 function jetpack_can_activate_infinite_scroll( $can_activate ) {
    73     return (bool) current_theme_supports( 'infinite-scroll' );
    74 }
    75 add_filter( 'jetpack_can_activate_infinite-scroll', 'jetpack_can_activate_infinite_scroll' );
    76 
    77 // Custom Post Types - we don't want a module card for these (yet)
    78 require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/comics.php' );
    79 require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/testimonial.php' );
    80 require_once( JETPACK__PLUGIN_DIR . 'modules/custom-post-types/nova.php' );
    8114
    8215/**
Note: See TracChangeset for help on using the changeset viewer.