当前位置: 首页>>代码示例>>PHP>>正文


PHP Jetpack::is_module_active方法代码示例

本文整理汇总了PHP中Jetpack::is_module_active方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::is_module_active方法的具体用法?PHP Jetpack::is_module_active怎么用?PHP Jetpack::is_module_active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jetpack的用法示例。


在下文中一共展示了Jetpack::is_module_active方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_paging_nav

    /**
     * Display navigation to next/previous set of posts when applicable.
     */
    function create_paging_nav()
    {
        // Don't print empty markup if there's only one page.
        if ($GLOBALS['wp_query']->max_num_pages < 2) {
            return;
        }
        $pagination_type = get_theme_mod('pagination_type', create_get_default_theme_options('pagination_type'));
        /**
         * Check if navigation type is Jetpack Infinite Scroll and if it is enabled, else goto default pagination
         * if it's active then disable pagination
         */
        if (('infinite-scroll-click' == $pagination_type || 'infinite-scroll-scroll' == $pagination_type) && class_exists('Jetpack') && Jetpack::is_module_active('infinite-scroll')) {
            return false;
        } elseif ('numeric' == $pagination_type && function_exists('the_posts_pagination')) {
            // Previous/next page navigation.
            the_posts_pagination(array('prev_text' => __('Previous page', 'create'), 'next_text' => __('Next page', 'create'), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'create') . ' </span>'));
        } else {
            ?>
		<nav class="navigation paging-navigation" role="navigation">
			<h1 class="screen-reader-text"><?php 
            _e('Posts navigation', 'create');
            ?>
</h1>
			<div class="nav-links">

				<?php 
            if (get_next_posts_link()) {
                ?>
				<div class="nav-previous"><?php 
                next_posts_link(__('<span class="meta-nav">&larr;</span> Older posts', 'create'));
                ?>
</div>
				<?php 
            }
            ?>

				<?php 
            if (get_previous_posts_link()) {
                ?>
				<div class="nav-next"><?php 
                previous_posts_link(__('Newer posts <span class="meta-nav">&rarr;</span>', 'create'));
                ?>
</div>
				<?php 
            }
            ?>

			</div><!-- .nav-links -->
		</nav><!-- .navigation -->
	<?php 
        }
    }
开发者ID:peisheng,项目名称:wp,代码行数:55,代码来源:template-tags.php

示例2: eduardodomingos_photon_enabled

/**
 * Checks if Jetpack Photon module is enabled.
 *
 * @return boolean
 */
function eduardodomingos_photon_enabled()
{
    if (class_exists('Jetpack') && Jetpack::is_module_active('photon')) {
        return true;
    }
    return false;
}
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:12,代码来源:extras.php

示例3: format_module

 protected static function format_module($module_slug)
 {
     $module_data = Jetpack::get_module($module_slug);
     $module = array();
     $module['id'] = $module_slug;
     $module['active'] = Jetpack::is_module_active($module_slug);
     $module['name'] = $module_data['name'];
     $module['short_description'] = $module_data['description'];
     $module['sort'] = $module_data['sort'];
     $module['introduced'] = $module_data['introduced'];
     $module['changed'] = $module_data['changed'];
     $module['free'] = $module_data['free'];
     $module['module_tags'] = $module_data['module_tags'];
     // Fetch the HTML formatted long description
     ob_start();
     if (Jetpack::is_active() && has_action('jetpack_module_more_info_connected_' . $module_slug)) {
         /** This action is documented in class.jetpack-modules-list-table.php */
         do_action('jetpack_module_more_info_connected_' . $module_slug);
     } else {
         /** This action is documented in class.jetpack-modules-list-table.php */
         do_action('jetpack_module_more_info_' . $module_slug);
     }
     $module['description'] = ob_get_clean();
     return $module;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:25,代码来源:class.jetpack-json-api-modules-endpoint.php

示例4: init

 function init()
 {
     if (fastfood_is_mobile()) {
         return;
     }
     //Infinite Scroll
     if (Jetpack::is_module_active('infinite-scroll')) {
         //nop
     }
     //Sharedaddy
     if (Jetpack::is_module_active('sharedaddy')) {
         remove_filter('the_content', 'sharing_display', 19);
         remove_filter('the_excerpt', 'sharing_display', 19);
         add_action('fastfood_hook_entry_bottom', array($this, 'sharedaddy'));
     }
     //Carousel
     if (Jetpack::is_module_active('carousel')) {
         //nop
     }
     //Likes
     if (Jetpack::is_module_active('likes')) {
         add_action('fastfood_hook_entry_bottom', array($this, 'likes'));
         remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1);
         add_filter('fastfood_filter_likes', array(Jetpack_Likes::init(), 'post_likes'), 30, 1);
     }
 }
开发者ID:TwoBeers,项目名称:fastfood,代码行数:26,代码来源:plug-n-play.php

示例5: sandwich_myshortcode

function sandwich_myshortcode()
{
    // No need to register our shortcode since it already exists
    // Check if Shortcake exists
    if (!function_exists('shortcode_ui_register_for_shortcode')) {
        return;
    }
    // Only create the UI when in the admin
    if (!is_admin()) {
        return;
    }
    // Register Shortcake UI
    shortcode_ui_register_for_shortcode('myshortcode', array('label' => __('Some Existing Shortcode', 'pbsandwich'), 'listItemImage' => 'dashicons-wordpress', 'attrs' => array(array('label' => __('Content', 'pbsandwich'), 'attr' => 'content', 'type' => 'textarea'), array('label' => __('Some Text', 'pbsandwich'), 'attr' => 'some_text', 'type' => 'text'), array('label' => __('Some Color', 'pbsandwich'), 'attr' => 'some_color', 'type' => 'color', 'value' => '#333333'))));
    // TODO: If the rendered shortcode in the editor NEEDS to be previewed in a logged out state (e.g. login forms)
    // uncomment this and add in your shortcode here.
    // sandwich_add_logged_out_shortcode( 'myshortcode' );
    // Make sure Jetpack is activated
    if (!class_exists('Jetpack')) {
        add_action('print_media_templates', 'sandwich_jetpack_myshortcode_disabled');
        return;
    }
    // Make sure our required Jetpack module is turned on
    if (!Jetpack::is_module_active('some-jetpack-module')) {
        add_action('print_media_templates', 'sandwich_jetpack_myshortcode_disabled');
        return;
    }
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:27,代码来源:template-jetpack.php

示例6: hoot_base_enqueue_styles

/**
 * Load stylesheets for the front end.
 *
 * @since 1.0
 * @access public
 * @return void
 */
function hoot_base_enqueue_styles()
{
    /* Gets ".min" suffix. */
    $suffix = hoot_get_min_suffix();
    /* Load Google Fonts if 'google-fonts' is active. */
    if (current_theme_supports('google-fonts')) {
        wp_enqueue_style('hoot-google-fonts', hoot_google_fonts_enqueue_url(), array(), null);
    }
    /* Load lightSlider style if 'light-slider' is active. */
    if (current_theme_supports('slick-slider')) {
        wp_enqueue_style('slick', trailingslashit(THEME_URI) . "css/slick{$suffix}.css", false, '1.5.9');
        wp_enqueue_style('slick-theme', trailingslashit(THEME_URI) . "css/slick-theme{$suffix}.css", false, '1.5.9');
    }
    /* Load gallery style if 'cleaner-gallery' is active. */
    if (current_theme_supports('cleaner-gallery')) {
        wp_enqueue_style('gallery', trailingslashit(HOOT_CSS) . "gallery{$suffix}.css");
    }
    /* Load gallery styles if Jetpack 'tiled-gallery' module is active */
    if (class_exists('Jetpack') && Jetpack::is_module_active('tiled-gallery')) {
        wp_enqueue_style('gallery', trailingslashit(HOOT_CSS) . "gallery{$suffix}.css");
        wp_enqueue_style('hoot-jetpack', trailingslashit(THEME_URI) . "css/jetpack{$suffix}.css");
    }
    /* Load font awesome if 'font-awesome' is active. */
    if (current_theme_supports('font-awesome')) {
        wp_enqueue_style('font-awesome', trailingslashit(HOOT_CSS) . "font-awesome{$suffix}.css", false, '4.2.0');
    }
}
开发者ID:hect1c,项目名称:martina-blog,代码行数:34,代码来源:enqueue.php

示例7: maybe_register_cpt

 /**
  * Registers the custom post types and adds action/filter handlers, but
  * only if the site supports it
  */
 function maybe_register_cpt()
 {
     // Add an option to enable the CPT
     add_action('admin_init', array($this, 'settings_api_init'));
     // Check on theme switch if theme supports CPT and setting is disabled
     add_action('after_switch_theme', array($this, 'activation_post_type_support'));
     $setting = Jetpack_Options::get_option_and_ensure_autoload(self::OPTION_NAME, '0');
     // Bail early if Testimonial option is not set and the theme doesn't declare support
     if (empty($setting) && !$this->site_supports_custom_post_type()) {
         return;
     }
     if ((!defined('IS_WPCOM') || !IS_WPCOM) && !Jetpack::is_module_active('custom-content-types')) {
         return;
     }
     // Enable Omnisearch for CPT.
     if (class_exists('Jetpack_Omnisearch_Posts')) {
         new Jetpack_Omnisearch_Posts(self::CUSTOM_POST_TYPE);
     }
     // CPT magic
     $this->register_post_types();
     add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
     add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
     add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'flush_rules_on_first_testimonial'));
     add_action('after_switch_theme', array($this, 'flush_rules_on_switch'));
     // Admin Customization
     add_filter('enter_title_here', array($this, 'change_default_title'));
     add_filter(sprintf('manage_%s_posts_columns', self::CUSTOM_POST_TYPE), array($this, 'edit_title_column_label'));
     add_filter('post_updated_messages', array($this, 'updated_messages'));
     add_action('customize_register', array($this, 'customize_register'));
     // Only add the 'Customize' sub-menu if the theme supports it.
     $num_testimonials = self::count_testimonials();
     if (!empty($num_testimonials) && current_theme_supports(self::CUSTOM_POST_TYPE)) {
         add_action('admin_menu', array($this, 'add_customize_page'));
     }
     if (defined('IS_WPCOM') && IS_WPCOM) {
         // Track all the things
         add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'new_activation_stat_bump'));
         add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'update_option_stat_bump'), 11, 2);
         add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'new_testimonial_stat_bump'));
         // Add to Dotcom XML sitemaps
         add_filter('wpcom_sitemap_post_types', array($this, 'add_to_sitemap'));
     } else {
         // Add to Jetpack XML sitemap
         add_filter('jetpack_sitemap_post_types', array($this, 'add_to_sitemap'));
     }
     // Adjust CPT archive and custom taxonomies to obey CPT reading setting
     add_filter('pre_get_posts', array($this, 'query_reading_setting'), 20);
     add_filter('infinite_scroll_settings', array($this, 'infinite_scroll_click_posts_per_page'));
     // Register [jetpack_testimonials] always and
     // register [testimonials] if [testimonials] isn't already set
     add_shortcode('jetpack_testimonials', array($this, 'jetpack_testimonial_shortcode'));
     if (!shortcode_exists('testimonials')) {
         add_shortcode('testimonials', array($this, 'jetpack_testimonial_shortcode'));
     }
     // If CPT was enabled programatically and no CPT items exist when user switches away, disable
     if ($setting && $this->site_supports_custom_post_type()) {
         add_action('switch_theme', array($this, 'deactivation_post_type_support'));
     }
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:63,代码来源:testimonial.php

示例8: amp_jetpack_mods

/**
 * Disable Jetpack features that are not compatible with AMP.
 *
 **/
function amp_jetpack_mods()
{
    if (Jetpack::is_module_active('stats')) {
        add_action('amp_post_template_footer', 'jetpack_amp_add_stats_pixel');
    }
    amp_jetpack_disable_sharing();
    amp_jetpack_disable_related_posts();
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:12,代码来源:jetpack-helper.php

示例9: __construct

 private function __construct()
 {
     global $pagenow;
     $jetpack_hide_jitm = Jetpack_Options::get_option('hide_jitm');
     if ('media-new.php' == $pagenow && !Jetpack::is_module_active('photon') && 'hide' != $jetpack_hide_jitm['photon']) {
         add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
         add_action('post-plupload-upload-ui', array($this, 'photon_msg'));
     }
 }
开发者ID:tinggao,项目名称:woofWarrior,代码行数:9,代码来源:class.jetpack-jitm.php

示例10: __construct

 private function __construct()
 {
     if (Jetpack::is_module_active('manage')) {
         add_filter('auto_update_plugin', array($this, 'autoupdate_plugin'), 10, 2);
         add_filter('auto_update_theme', array($this, 'autoupdate_theme'), 10, 2);
         add_filter('auto_update_core', array($this, 'autoupdate_core'), 10, 2);
         add_action('automatic_updates_complete', array($this, 'automatic_updates_complete'), 999, 1);
     }
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:9,代码来源:class.jetpack-autoupdate.php

示例11: plugins_loaded

 function plugins_loaded()
 {
     $this->role = apply_filters('jetpack_force_2fa_cap', 'manage_options');
     // Bail if Jetpack SSO is not active
     if (!class_exists('Jetpack') || !Jetpack::is_module_active('sso')) {
         add_action('admin_notices', array($this, 'admin_notice'));
         return;
     }
     $this->force_2fa();
 }
开发者ID:Automattic,项目名称:jetpack-force-2fa,代码行数:10,代码来源:jetpack-force-2fa.php

示例12: photonfill_hook_prefix

/**
 * Our photon hook prefix as this plugin supports both Jetpack Photon and My-Photon
 * @return string. (Either 'jetpack' or 'my');
 */
function photonfill_hook_prefix()
{
    // If photon module is active, then use it over my photon.
    if (class_exists('Jetpack') && Jetpack::is_module_active('photon')) {
        return 'jetpack';
    } elseif (class_exists('My_Photon_Settings') && My_Photon_Settings::get('active')) {
        return 'my';
    }
    return 'jetpack';
}
开发者ID:jasonbahl,项目名称:photonfill,代码行数:14,代码来源:photonfill.php

示例13: init

 static function init()
 {
     if (!Jetpack::is_module_active('sharedaddy')) {
         return false;
     }
     if (!self::$instance) {
         self::$instance = new jetwhats_Sharing_Service();
     }
     return self::$instance;
 }
开发者ID:robertoAg,项目名称:wordpress_humor,代码行数:10,代码来源:class.whatsapp-service.php

示例14: setup

 protected function setup()
 {
     $this->sharing_service = new Sharing_Service();
     if (!current_user_can('manage_options')) {
         return new WP_Error('forbidden', 'You do not have the capability to manage sharing buttons for this site', 403);
     } else {
         if (!class_exists('Sharing_Service') || !class_exists('Sharing_Source') || method_exists('Jetpack', 'is_module_active') && !Jetpack::is_module_active('sharedaddy')) {
             return new WP_Error('missing_jetpack_module', 'The Sharing module must be activated in order to use this endpoint', 400);
         }
     }
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:11,代码来源:class.wpcom-json-api-sharing-buttons-endpoint.php

示例15: jetpack_add_dashboard_sub_nav_item

 /**
  * Add Jetpack Dashboard sub-link and point it to AAG if the user can view stats, manage modules or if Protect is active.
  * Otherwise and only if user is allowed to see the Jetpack Admin, the Dashboard sub-link is added but pointed to Apps tab.
  *
  * Works in Dev Mode or when user is connected.
  *
  * @since 4.3.0
  */
 function jetpack_add_dashboard_sub_nav_item()
 {
     if (Jetpack::is_development_mode() || Jetpack::is_active()) {
         global $submenu;
         if (current_user_can('jetpack_manage_modules') || Jetpack::is_module_active('protect') || current_user_can('view_stats')) {
             $submenu['jetpack'][] = array(__('Dashboard', 'jetpack'), 'jetpack_admin_page', Jetpack::admin_url('page=jetpack#/dashboard'));
         } elseif (current_user_can('jetpack_admin_page')) {
             $submenu['jetpack'][] = array(__('Dashboard', 'jetpack'), 'jetpack_admin_page', Jetpack::admin_url('page=jetpack#/apps'));
         }
     }
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:19,代码来源:class.jetpack-react-page.php


注:本文中的Jetpack::is_module_active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。