本文整理汇总了PHP中Jetpack::enable_module_configurable方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack::enable_module_configurable方法的具体用法?PHP Jetpack::enable_module_configurable怎么用?PHP Jetpack::enable_module_configurable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack
的用法示例。
在下文中一共展示了Jetpack::enable_module_configurable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stats_load
function stats_load()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'stats_configuration_load');
Jetpack::module_configuration_head(__FILE__, 'stats_configuration_head');
Jetpack::module_configuration_screen(__FILE__, 'stats_configuration_screen');
// Generate the tracking code after wp() has queried for posts.
add_action('template_redirect', 'stats_template_redirect', 1);
add_action('wp_head', 'stats_admin_bar_head', 100);
add_action('jetpack_admin_menu', 'stats_admin_menu');
add_action('wp_dashboard_setup', 'stats_register_dashboard_widget');
// Tell HQ about changed settings
add_action('update_option_home', 'stats_update_blog');
add_action('update_option_siteurl', 'stats_update_blog');
add_action('update_option_blogname', 'stats_update_blog');
add_action('update_option_blogdescription', 'stats_update_blog');
add_action('update_option_timezone_string', 'stats_update_blog');
add_action('add_option_timezone_string', 'stats_update_blog');
add_action('update_option_gmt_offset', 'stats_update_blog');
add_action('update_option_page_on_front', 'stats_update_blog');
add_action('update_option_permalink_structure', 'stats_update_blog');
add_action('update_option_category_base', 'stats_update_blog');
add_action('update_option_tag_base', 'stats_update_blog');
// Tell HQ about changed posts
add_action('save_post', 'stats_update_post', 10, 1);
add_filter('jetpack_xmlrpc_methods', 'stats_xmlrpc_methods');
foreach (stats_get_option('roles') as $role) {
$role = get_role($role);
if ($role) {
$role->add_cap('view_stats');
}
}
}
示例2: jetpack_modules_loaded
/**
* After all modules have been loaded.
*/
function jetpack_modules_loaded()
{
$options = $this->get_options();
// Only the connection owner can configure this module.
if ($this->is_connection_owner()) {
Jetpack::enable_module_configurable($this->module);
Jetpack::module_configuration_load($this->module, array($this, 'jetpack_configuration_load'));
Jetpack::module_configuration_screen($this->module, array($this, 'jetpack_configuration_screen'));
}
// Only if the current user can manage the VideoPress library and one has been connected.
if ($this->can('read_videos') && $options['blog_id']) {
add_action('wp_enqueue_media', array($this, 'enqueue_admin_scripts'));
add_action('print_media_templates', array($this, 'print_media_templates'));
// Load these at priority -1 so they're fired before Core's are.
add_action('wp_ajax_query-attachments', array($this, 'wp_ajax_query_attachments'), -1);
add_action('wp_ajax_save-attachment', array($this, 'wp_ajax_save_attachment'), -1);
add_action('wp_ajax_save-attachment-compat', array($this, 'wp_ajax_save_attachment'), -1);
add_action('wp_ajax_delete-post', array($this, 'wp_ajax_delete_post'), -1);
add_action('admin_menu', array($this, 'admin_menu'));
}
if ($this->can('upload_videos') && $options['blog_id']) {
add_action('wp_ajax_videopress-get-upload-token', array($this, 'wp_ajax_videopress_get_upload_token'));
}
add_filter('videopress_shortcode_options', array($this, 'videopress_shortcode_options'));
}
示例3: __construct
public function __construct()
{
$this->in_jetpack = defined('IS_WPCOM') && IS_WPCOM ? false : true;
if ($this->in_jetpack) {
$active = Jetpack::get_active_modules();
if (!in_array('sharedaddy', $active) && !in_array('publicize', $active) && !in_array('likes', $active)) {
add_action('admin_menu', array($this, 'sharing_menu'));
// we don't have a sharing page yet
}
add_action('jetpack_activate_module_likes', array($this, 'module_toggle'));
add_action('jetpack_deactivate_module_likes', array($this, 'module_toggle'));
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, array($this, 'configuration_redirect'));
}
// The visible UI elements for the user
add_action('load-settings_page_sharing', array($this, 'load_management_script_assets'));
add_action('pre_admin_screen_sharing', array($this, 'connection_screen'), 15);
add_action('admin_init', array($this, 'add_meta_box'));
add_action('do_meta_boxes', array($this, 'should_we_show_the_meta_box'));
add_action('sharing_global_options', array($this, 'admin_settings_init'), 20);
add_action('sharing_admin_update', array($this, 'admin_settings_callback'), 20);
if ($this->in_jetpack) {
add_action('pre_admin_screen_sharing', array($this, 'jetpack_disconnect'), 10);
}
}
示例4: module_configure_button
/**
* Add configure button and functionality to the module card on the Jetpack screen
**/
public static function module_configure_button()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, array(__CLASS__, 'module_configuration_load'));
Jetpack::module_configuration_head(__FILE__, array(__CLASS__, 'module_configuration_head'));
Jetpack::module_configuration_screen(__FILE__, array(__CLASS__, 'module_configuration_screen'));
}
示例5: __construct
function __construct()
{
global $publicize_ui;
$this->in_jetpack = class_exists('Jetpack') && method_exists('Jetpack', 'enable_module_configurable') ? true : false;
if ($this->in_jetpack && method_exists('Jetpack', 'module_configuration_load')) {
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, array($this, 'jetpack_configuration_load'));
add_action('init', array($this, 'sync_posts_init'), 999);
}
require_once dirname(__FILE__) . '/publicize/publicize.php';
if ($this->in_jetpack) {
require_once dirname(__FILE__) . '/publicize/publicize-jetpack.php';
} else {
require_once dirname(dirname(__FILE__)) . '/mu-plugins/keyring/keyring.php';
require_once dirname(__FILE__) . '/publicize/publicize-wpcom.php';
}
require_once dirname(__FILE__) . '/publicize/ui.php';
$publicize_ui = new Publicize_UI();
$publicize_ui->in_jetpack = $this->in_jetpack;
// Jetpack specific checks / hooks
if ($this->in_jetpack) {
add_action('jetpack_activate_module_publicize', array($this, 'module_state_toggle'));
add_action('jetpack_deactivate_module_publicize', array($this, 'module_state_toggle'));
add_filter('jetpack_sync_post_module_custom_data', array($this, 'sync_post_module_custom_data'), 10, 2);
// if sharedaddy isn't active, the sharing menu hasn't been added yet
$active = Jetpack::get_active_modules();
if (in_array('publicize', $active) && !in_array('sharedaddy', $active)) {
add_action('admin_menu', array(&$publicize_ui, 'sharing_menu'));
}
}
}
示例6: stats_load
function stats_load()
{
global $wp_roles;
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'stats_configuration_load');
Jetpack::module_configuration_head(__FILE__, 'stats_configuration_head');
Jetpack::module_configuration_screen(__FILE__, 'stats_configuration_screen');
// Tell HQ about changed posts
$post_stati = get_post_stati(array('public' => true));
// All public post stati
$post_stati[] = 'private';
// Content from private stati will be redacted
Jetpack_Sync::sync_posts(__FILE__, array('post_types' => get_post_types(array('public' => true)), 'post_stati' => $post_stati));
// Generate the tracking code after wp() has queried for posts.
add_action('template_redirect', 'stats_template_redirect', 1);
add_action('wp_head', 'stats_admin_bar_head', 100);
add_action('wp_head', 'stats_hide_smile_css');
add_action('jetpack_admin_menu', 'stats_admin_menu');
// Map stats caps
add_filter('map_meta_cap', 'stats_map_meta_caps', 10, 4);
if (isset($_GET['oldwidget'])) {
// Old one.
add_action('wp_dashboard_setup', 'stats_register_dashboard_widget');
} else {
add_action('admin_init', 'stats_merged_widget_admin_init');
}
add_filter('jetpack_xmlrpc_methods', 'stats_xmlrpc_methods');
add_filter('pre_option_db_version', 'stats_ignore_db_version');
}
示例7: vaultpress_jetpack_stub
function vaultpress_jetpack_stub()
{
if (class_exists('VaultPress') || function_exists('vaultpress_contact_service')) {
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'vaultpress_jetpack_configure');
add_filter('jetpack_module_free_text_vaultpress', 'vaultpress_jetpack_module_free_text');
}
}
示例8: action_on_load
/**
* This action triggers if the module is in an active state, load related posts and options.
*
* @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack::module_configuration_load, Jetpack_Sync::sync_posts
* @return null
*/
public function action_on_load()
{
require_once 'related-posts/jetpack-related-posts.php';
Jetpack_RelatedPosts::init();
if (is_admin()) {
// Enable "Configure" button on module card
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, array($this, 'module_configuration_load'));
}
}
示例9: __construct
function __construct() {
$this->in_jetpack = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? false : true;
add_action( 'init', array( &$this, 'action_init' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) );
if ( $this->in_jetpack ) {
add_action( 'jetpack_activate_module_likes', array( $this, 'module_toggle' ) );
add_action( 'jetpack_deactivate_module_likes', array( $this, 'module_toggle' ) );
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, array( $this, 'configuration_redirect' ) );
add_action('admin_print_scripts-settings_page_sharing', array( &$this, 'load_jp_css' ) );
add_filter( 'sharing_show_buttons_on_row_start', array( $this, 'configuration_target_area' ) );
$active = Jetpack::get_active_modules();
if ( ! in_array( 'sharedaddy', $active ) && ! in_array( 'publicize', $active ) ) {
add_action( 'admin_menu', array( $this, 'sharing_menu' ) ); // we don't have a sharing page yet
}
if ( in_array( 'publicize', $active ) && ! in_array( 'sharedaddy', $active ) ) {
add_action( 'pre_admin_screen_sharing', array( $this, 'sharing_block' ), 20 ); // we have a sharing page but not the global options area
add_action( 'pre_admin_screen_sharing', array( $this, 'updated_message' ), -10 );
}
if( ! in_array( 'sharedaddy', $active ) ) {
add_action( 'admin_init', array( $this, 'process_update_requests_if_sharedaddy_not_loaded' ) );
add_action( 'sharing_global_options', array( $this, 'admin_settings_showbuttonon_init' ), 19 );
add_action( 'sharing_admin_update', array( $this, 'admin_settings_showbuttonon_callback' ), 19 );
add_action( 'admin_init', array( $this, 'add_meta_box' ) );
} else {
add_filter( 'sharing_meta_box_title', array( $this, 'add_likes_to_sharing_meta_box_title' ) );
add_action( 'start_sharing_meta_box_content', array( $this, 'meta_box_content' ) );
}
Jetpack_Sync::sync_options( __FILE__, 'social_notifications_like' );
} else { // wpcom
add_action( 'admin_init', array( $this, 'add_meta_box' ) );
add_action( 'end_likes_meta_box_content', array( $this, 'sharing_meta_box_content' ) );
add_filter( 'likes_meta_box_title', array( $this, 'add_likes_to_sharing_meta_box_title' ) );
}
add_action( 'admin_init', array( $this, 'admin_discussion_likes_settings_init' ) ); // Likes notifications
add_action( 'admin_bar_menu', array( $this, 'admin_bar_likes' ), 60 );
add_action( 'save_post', array( $this, 'meta_box_save' ) );
add_action( 'sharing_global_options', array( $this, 'admin_settings_init' ), 20 );
add_action( 'sharing_admin_update', array( $this, 'admin_settings_callback' ), 20 );
}
示例10: grofiles_hovercards_init
function grofiles_hovercards_init()
{
add_filter('get_avatar', 'grofiles_get_avatar', 10, 2);
add_action('wp_footer', 'grofiles_attach_cards');
add_action('wp_footer', 'grofiles_extra_data');
add_action('admin_init', 'grofiles_add_settings');
add_action('load-index.php', 'grofiles_admin_cards');
add_action('load-users.php', 'grofiles_admin_cards');
add_action('load-edit-comments.php', 'grofiles_admin_cards');
add_action('load-options-discussion.php', 'grofiles_admin_cards_forced');
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'gravatar_hovercards_configuration_load');
}
示例11: init
function init()
{
if ($this->maybe_disable_jp_carousel()) {
return;
}
$this->in_jetpack = class_exists('Jetpack') && method_exists('Jetpack', 'enable_module_configurable') ? true : false;
if (is_admin()) {
// Register the Carousel-related related settings
add_action('admin_init', array($this, 'register_settings'), 5);
if (!$this->in_jetpack) {
if (0 == $this->test_1or0_option(get_option('carousel_enable_it'), true)) {
return;
}
// Carousel disabled, abort early, but still register setting so user can switch it back on
}
// If in admin, register the ajax endpoints.
add_action('wp_ajax_get_attachment_comments', array($this, 'get_attachment_comments'));
add_action('wp_ajax_nopriv_get_attachment_comments', array($this, 'get_attachment_comments'));
add_action('wp_ajax_post_attachment_comment', array($this, 'post_attachment_comment'));
add_action('wp_ajax_nopriv_post_attachment_comment', array($this, 'post_attachment_comment'));
} else {
if (!$this->in_jetpack) {
if (0 == $this->test_1or0_option(get_option('carousel_enable_it'), true)) {
return;
}
// Carousel disabled, abort early
}
// If on front-end, do the Carousel thang.
/**
* Filter the array of default prebuilt widths used in Carousel.
*
* @module carousel
*
* @since 1.6.0
*
* @param array $this->prebuilt_widths Array of default widths.
*/
$this->prebuilt_widths = apply_filters('jp_carousel_widths', $this->prebuilt_widths);
add_filter('post_gallery', array($this, 'enqueue_assets'), 1000, 2);
// load later than other callbacks hooked it
add_filter('post_gallery', array($this, 'set_in_gallery'), -1000);
add_filter('gallery_style', array($this, 'add_data_to_container'));
add_filter('wp_get_attachment_image_attributes', array($this, 'add_data_to_images'), 10, 2);
}
if ($this->in_jetpack && method_exists('Jetpack', 'module_configuration_load')) {
Jetpack::enable_module_configurable(dirname(dirname(__FILE__)) . '/carousel.php');
Jetpack::module_configuration_load(dirname(dirname(__FILE__)) . '/carousel.php', array($this, 'jetpack_configuration_load'));
}
}
示例12: stats_load
function stats_load()
{
global $wp_roles;
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'stats_configuration_load');
Jetpack::module_configuration_head(__FILE__, 'stats_configuration_head');
Jetpack::module_configuration_screen(__FILE__, 'stats_configuration_screen');
// Generate the tracking code after wp() has queried for posts.
add_action('template_redirect', 'stats_template_redirect', 1);
add_action('wp_head', 'stats_admin_bar_head', 100);
add_action('wp_head', 'stats_hide_smile_css');
add_action('jetpack_admin_menu', 'stats_admin_menu');
// Map stats caps
add_filter('map_meta_cap', 'stats_map_meta_caps', 10, 4);
if (isset($_GET['oldwidget'])) {
// Old one.
add_action('wp_dashboard_setup', 'stats_register_dashboard_widget');
} else {
add_action('admin_init', 'stats_merged_widget_admin_init');
}
add_filter('jetpack_xmlrpc_methods', 'stats_xmlrpc_methods');
add_filter('pre_option_db_version', 'stats_ignore_db_version');
}
示例13: custom_css_loaded
function custom_css_loaded()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'custom_css_configuration_load');
}
示例14: sharedaddy_loaded
function sharedaddy_loaded()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'sharedaddy_configuration_load');
}
示例15: jetpack_tiled_gallery_loaded
function jetpack_tiled_gallery_loaded()
{
Jetpack::enable_module_configurable(__FILE__);
Jetpack::module_configuration_load(__FILE__, 'jetpack_tiled_gallery_configuration_load');
}