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


PHP Jetpack::log方法代码示例

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


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

示例1: automatic_updates_complete

 /**
  * On completion of an automatic update, let's store the results.
  *
  * @param $results - Sent by WP_Automatic_Updater after it completes an autoupdate action. Results may be empty.
  */
 public function automatic_updates_complete($results)
 {
     if (empty($this->expected)) {
         return;
     }
     $this->results = empty($results) ? self::get_possible_failures() : $results;
     add_action('shutdown', array($this, 'bump_stats'));
     Jetpack::init();
     $items_to_log = array('plugin', 'theme');
     foreach ($items_to_log as $items) {
         $this->log_items($items);
     }
     Jetpack::log('autoupdates', $this->get_log());
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:19,代码来源:class.jetpack-autoupdate.php

示例2: jetpack_my_jetpack_change_user

 function jetpack_my_jetpack_change_user()
 {
     if (!isset($_POST['_my_jetpack_nonce']) || !wp_verify_nonce($_POST['_my_jetpack_nonce'], 'jetpack_change_primary_user')) {
         wp_die(__('Failed permissions, please try again.', 'jetpack'));
         exit;
     }
     if (isset($_POST['jetpack-new-master'])) {
         $old_master_user = Jetpack_Options::get_option('master_user');
         $new_master_user = $_POST['jetpack-new-master'];
         $user_token = Jetpack_Data::get_access_token($new_master_user);
         $is_user_connected = $user_token && !is_wp_error($user_token);
         if (current_user_can('manage_options') && $is_user_connected) {
             Jetpack::log('switch_master_user', array('old_master' => $old_master_user, 'new_master' => $new_master_user));
             Jetpack_Options::update_option('master_user', $new_master_user);
             Jetpack::state('message', 'switch_master');
             //My Jetpack primary user successfully changed, send to MC Stats
             Jetpack::init()->stat('admin', 'change-primary-successful');
             Jetpack::init()->do_stats('server_side');
             // Change the blog owner dotcom side
             $this->wpcom_switch_blog_owner($new_master_user);
         }
     }
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:23,代码来源:class.jetpack-my-jetpack-page.php

示例3: admin_page_load

 /**
  * Handles the page load events for the Jetpack admin page
  */
 function admin_page_load()
 {
     $error = false;
     // Make sure we have the right body class to hook stylings for subpages off of.
     add_filter('admin_body_class', array(__CLASS__, 'add_jetpack_pagestyles'));
     if (!empty($_GET['jetpack_restate'])) {
         // Should only be used in intermediate redirects to preserve state across redirects
         Jetpack::restate();
     }
     if (isset($_GET['connect_url_redirect'])) {
         // User clicked in the iframe to link their accounts
         if (!Jetpack::is_user_connected()) {
             $connect_url = $this->build_connect_url(true);
             if (isset($_GET['notes_iframe'])) {
                 $connect_url .= '&notes_iframe';
             }
             wp_redirect($connect_url);
             exit;
         } else {
             Jetpack::state('message', 'already_authorized');
             wp_safe_redirect(Jetpack::admin_url());
             exit;
         }
     }
     if (isset($_GET['action'])) {
         switch ($_GET['action']) {
             case 'authorize':
                 if (Jetpack::is_active() && Jetpack::is_user_connected()) {
                     Jetpack::state('message', 'already_authorized');
                     wp_safe_redirect(Jetpack::admin_url());
                     exit;
                 }
                 Jetpack::log('authorize');
                 $client_server = new Jetpack_Client_Server();
                 $client_server->authorize();
                 exit;
             case 'register':
                 check_admin_referer('jetpack-register');
                 Jetpack::log('register');
                 Jetpack::maybe_set_version_option();
                 $registered = Jetpack::try_registration();
                 if (is_wp_error($registered)) {
                     $error = $registered->get_error_code();
                     Jetpack::state('error_description', $registered->get_error_message());
                     break;
                 }
                 wp_redirect($this->build_connect_url(true));
                 exit;
             case 'activate':
                 if (!current_user_can('jetpack_activate_modules')) {
                     $error = 'cheatin';
                     break;
                 }
                 $module = stripslashes($_GET['module']);
                 check_admin_referer("jetpack_activate-{$module}");
                 Jetpack::log('activate', $module);
                 Jetpack::activate_module($module);
                 // The following two lines will rarely happen, as Jetpack::activate_module normally exits at the end.
                 wp_safe_redirect(Jetpack::admin_url('page=jetpack'));
                 exit;
             case 'activate_default_modules':
                 check_admin_referer('activate_default_modules');
                 Jetpack::log('activate_default_modules');
                 Jetpack::restate();
                 $min_version = isset($_GET['min_version']) ? $_GET['min_version'] : false;
                 $max_version = isset($_GET['max_version']) ? $_GET['max_version'] : false;
                 $other_modules = isset($_GET['other_modules']) && is_array($_GET['other_modules']) ? $_GET['other_modules'] : array();
                 Jetpack::activate_default_modules($min_version, $max_version, $other_modules);
                 wp_safe_redirect(Jetpack::admin_url('page=jetpack'));
                 exit;
             case 'disconnect':
                 if (!current_user_can('jetpack_disconnect')) {
                     $error = 'cheatin';
                     break;
                 }
                 check_admin_referer('jetpack-disconnect');
                 Jetpack::log('disconnect');
                 Jetpack::disconnect();
                 wp_safe_redirect(Jetpack::admin_url());
                 exit;
             case 'reconnect':
                 if (!current_user_can('jetpack_reconnect')) {
                     $error = 'cheatin';
                     break;
                 }
                 check_admin_referer('jetpack-reconnect');
                 Jetpack::log('reconnect');
                 $this->disconnect();
                 wp_redirect($this->build_connect_url(true));
                 exit;
             case 'deactivate':
                 if (!current_user_can('jetpack_deactivate_modules')) {
                     $error = 'cheatin';
                     break;
                 }
                 $modules = stripslashes($_GET['module']);
                 check_admin_referer("jetpack_deactivate-{$modules}");
//.........这里部分代码省略.........
开发者ID:lokenxo,项目名称:familygenerator,代码行数:101,代码来源:class.jetpack.php

示例4: module

 /**
  * Manage Jetpack Modules
  *
  * ## OPTIONS
  *
  * list          : View all available modules, and their status.
  * activate all  : Activate all modules
  * deactivate all: Deactivate all modules
  *
  * activate   <module_slug> : Activate a module.
  * deactivate <module_slug> : Deactivate a module.
  * toggle     <module_slug> : Toggle a module on or off.
  *
  * ## EXAMPLES
  *
  * wp jetpack module list
  * wp jetpack module activate stats
  * wp jetpack module deactivate stats
  * wp jetpack module toggle stats
  *
  * wp jetpack module activate all
  * wp jetpack module deactivate all
  *
  * @synopsis <list|activate|deactivate|toggle> [<module_name>]
  */
 public function module($args, $assoc_args)
 {
     $action = isset($args[0]) ? $args[0] : 'list';
     if (!in_array($action, array('list', 'activate', 'deactivate', 'toggle'))) {
         WP_CLI::error(sprintf(__('%s is not a valid command.', 'jetpack'), $action));
     }
     if (in_array($action, array('activate', 'deactivate', 'toggle'))) {
         if (isset($args[1])) {
             $module_slug = $args[1];
             if ('all' !== $module_slug && !Jetpack::is_module($module_slug)) {
                 WP_CLI::error(sprintf(__('%s is not a valid module.', 'jetpack'), $module_slug));
             }
             if ('toggle' == $action) {
                 $action = Jetpack::is_module_active($module_slug) ? 'deactivate' : 'activate';
             }
             // Bulk actions
             if ('all' == $args[1]) {
                 $action = 'deactivate' == $action ? 'deactivate_all' : 'activate_all';
             }
             // VaultPress needs to be handled elsewhere.
             if (in_array($action, array('activate', 'deactivate', 'toggle')) && 'vaultpress' == $args[1]) {
                 WP_CLI::error(sprintf(_x('Please visit %s to configure your VaultPress subscription.', '%s is a website', 'jetpack'), esc_url('https://vaultpress.com/jetpack/')));
             }
         } else {
             WP_CLI::line(__('Please specify a valid module.', 'jetpack'));
             $action = 'list';
         }
     }
     switch ($action) {
         case 'list':
             WP_CLI::line(__('Available Modules:', 'jetpack'));
             $modules = Jetpack::get_available_modules();
             sort($modules);
             foreach ($modules as $module_slug) {
                 if ('vaultpress' == $module_slug) {
                     continue;
                 }
                 $active = Jetpack::is_module_active($module_slug) ? __('Active', 'jetpack') : __('Inactive', 'jetpack');
                 WP_CLI::line("\t" . str_pad($module_slug, 24) . $active);
             }
             break;
         case 'activate':
             $module = Jetpack::get_module($module_slug);
             Jetpack::log('activate', $module_slug);
             Jetpack::activate_module($module_slug, false, false);
             WP_CLI::success(sprintf(__('%s has been activated.', 'jetpack'), $module['name']));
             break;
         case 'activate_all':
             $modules = Jetpack::get_available_modules();
             Jetpack::update_active_modules($modules);
             WP_CLI::success(__('All modules activated!', 'jetpack'));
             break;
         case 'deactivate':
             $module = Jetpack::get_module($module_slug);
             Jetpack::log('deactivate', $module_slug);
             Jetpack::deactivate_module($module_slug);
             WP_CLI::success(sprintf(__('%s has been deactivated.', 'jetpack'), $module['name']));
             break;
         case 'deactivate_all':
             Jetpack::delete_active_modules();
             WP_CLI::success(__('All modules deactivated!', 'jetpack'));
             break;
         case 'toggle':
             // Will never happen, should have been handled above and changed to activate or deactivate.
             break;
     }
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:92,代码来源:class.jetpack-cli.php

示例5: module

 /**
  * Manage Jetpack Modules
  *
  * ## OPTIONS
  *
  * list: View all available modules, and their status.
  *
  * activate <module_slug>: Activate a module.
  *
  * deactivate <module_slug>: Deactivate a module.
  *
  * toggle <module_slug>: Toggle a module on or off.
  *
  * ## EXAMPLES
  *
  * wp jetpack module list
  * wp jetpack module activate stats
  * wp jetpack module deactivate stats
  * wp jetpack module toggle stats
  *
  * @synopsis [list|activate|deactivate|toggle [<module_name>]]
  */
 public function module($args, $assoc_args)
 {
     $action = isset($args[0]) ? $args[0] : 'list';
     if (!in_array($action, array('list', 'activate', 'deactivate', 'toggle'))) {
         WP_CLI::error(sprintf(__('%s is not a valid command.', 'jetpack'), $action));
     }
     if (in_array($action, array('activate', 'deactivate', 'toggle'))) {
         if (isset($args[1])) {
             $module_slug = $args[1];
             if (!Jetpack::is_module($module_slug)) {
                 WP_CLI::error(sprintf(__('%s is not a valid module.', 'jetpack'), $module_slug));
             }
             if ('toggle' == $action) {
                 $action = Jetpack::is_module_active($module_slug) ? 'deactivate' : 'activate';
             }
         } else {
             WP_CLI::line(__('Please specify a valid module.', 'jetpack'));
             $action = 'list';
         }
     }
     switch ($action) {
         case 'list':
             WP_CLI::line(__('Available Modules:', 'jetpack'));
             $modules = Jetpack::get_available_modules();
             sort($modules);
             foreach ($modules as $module_slug) {
                 $active = Jetpack::is_module_active($module_slug) ? __('Active', 'jetpack') : __('Inactive', 'jetpack');
                 WP_CLI::line("\t" . str_pad($module_slug, 24) . $active);
             }
             break;
         case 'activate':
             $module = Jetpack::get_module($module_slug);
             Jetpack::log('activate', $module_slug);
             Jetpack::activate_module($module_slug, false);
             WP_CLI::success(sprintf(__('%s has been activated.', 'jetpack'), $module['name']));
             break;
         case 'deactivate':
             $module = Jetpack::get_module($module_slug);
             Jetpack::log('deactivate', $module_slug);
             Jetpack::deactivate_module($module_slug);
             WP_CLI::success(sprintf(__('%s has been deactivated.', 'jetpack'), $module['name']));
             break;
         case 'toggle':
             // Will never happen, should have been handled above and changed to activate or deactivate.
             break;
     }
 }
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:69,代码来源:class.jetpack-cli.php

示例6: jetpack_site_icon_available_in_core

 public static function jetpack_site_icon_available_in_core()
 {
     global $wp_version;
     $core_icon_available = function_exists('has_site_icon') && version_compare($wp_version, '4.3-beta') >= 0;
     if (!$core_icon_available) {
         return false;
     }
     // No need for Jetpack's site icon anymore if core's is already set
     if (has_site_icon()) {
         if (Jetpack::is_module_active('site-icon')) {
             Jetpack::log('deactivate', 'site-icon');
             Jetpack::deactivate_module('site-icon');
         }
         return true;
     }
     // Transfer Jetpack's site icon to use core.
     $site_icon_id = Jetpack::get_option('site_icon_id');
     if ($site_icon_id) {
         // Update core's site icon
         update_option('site_icon', $site_icon_id);
         // Delete Jetpack's icon option. We still want the blavatar and attached data though.
         delete_option('site_icon_id');
     }
     // No need for Jetpack's site icon anymore
     if (Jetpack::is_module_active('site-icon')) {
         Jetpack::log('deactivate', 'site-icon');
         Jetpack::deactivate_module('site-icon');
     }
     return true;
 }
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:30,代码来源:class.jetpack.php

示例7: deactivate_jetpack_modules

 static function deactivate_jetpack_modules()
 {
     check_ajax_referer(self::AJAX_NONCE, 'nonce');
     // shamelessly copied from class.jetpack.php
     $modules = $_REQUEST['modules'];
     $modules = array_map('sanitize_key', $modules);
     // $modules_filtered = Jetpack::init()->filter_default_modules( $modules );
     foreach ($modules as $module_slug) {
         Jetpack::log('deactivate', $module_slug);
         Jetpack::deactivate_module($module_slug);
         Jetpack::state('message', 'module_deactivated');
     }
     wp_send_json_success($modules);
 }
开发者ID:hyperhy,项目名称:hyperhy,代码行数:14,代码来源:class.jetpack-start-end-points.php

示例8: admin_page_load

 /**
  * Handles the page load events for the Jetpack admin page
  */
 function admin_page_load()
 {
     $error = false;
     // Make sure we have the right body class to hook stylings for subpages off of.
     add_filter('admin_body_class', array(__CLASS__, 'add_jetpack_pagestyles'));
     if (!empty($_GET['jetpack_restate'])) {
         // Should only be used in intermediate redirects to preserve state across redirects
         Jetpack::restate();
     }
     if (isset($_GET['connect_url_redirect'])) {
         // User clicked in the iframe to link their accounts
         if (!Jetpack::is_user_connected()) {
             $connect_url = $this->build_connect_url(true, false, 'iframe');
             if (isset($_GET['notes_iframe'])) {
                 $connect_url .= '&notes_iframe';
             }
             wp_redirect($connect_url);
             exit;
         } else {
             if (!isset($_GET['calypso_env'])) {
                 Jetpack::state('message', 'already_authorized');
                 wp_safe_redirect(Jetpack::admin_url());
             } else {
                 $connect_url = $this->build_connect_url(true, false, 'iframe');
                 $connect_url .= '&already_authorized=true';
                 wp_redirect($connect_url);
             }
         }
     }
     if (isset($_GET['action'])) {
         switch ($_GET['action']) {
             case 'authorize':
                 if (Jetpack::is_active() && Jetpack::is_user_connected()) {
                     Jetpack::state('message', 'already_authorized');
                     wp_safe_redirect(Jetpack::admin_url());
                     exit;
                 }
                 Jetpack::log('authorize');
                 $client_server = new Jetpack_Client_Server();
                 $client_server->client_authorize();
                 exit;
             case 'register':
                 if (!current_user_can('jetpack_connect')) {
                     $error = 'cheatin';
                     break;
                 }
                 check_admin_referer('jetpack-register');
                 Jetpack::log('register');
                 Jetpack::maybe_set_version_option();
                 $registered = Jetpack::try_registration();
                 if (is_wp_error($registered)) {
                     $error = $registered->get_error_code();
                     Jetpack::state('error', $error);
                     Jetpack::state('error', $registered->get_error_message());
                     break;
                 }
                 $from = isset($_GET['from']) ? $_GET['from'] : false;
                 wp_redirect($this->build_connect_url(true, false, $from));
                 exit;
             case 'activate':
                 if (!current_user_can('jetpack_activate_modules')) {
                     $error = 'cheatin';
                     break;
                 }
                 $module = stripslashes($_GET['module']);
                 check_admin_referer("jetpack_activate-{$module}");
                 Jetpack::log('activate', $module);
                 Jetpack::activate_module($module);
                 // The following two lines will rarely happen, as Jetpack::activate_module normally exits at the end.
                 wp_safe_redirect(Jetpack::admin_url('page=jetpack'));
                 exit;
             case 'activate_default_modules':
                 check_admin_referer('activate_default_modules');
                 Jetpack::log('activate_default_modules');
                 Jetpack::restate();
                 $min_version = isset($_GET['min_version']) ? $_GET['min_version'] : false;
                 $max_version = isset($_GET['max_version']) ? $_GET['max_version'] : false;
                 $other_modules = isset($_GET['other_modules']) && is_array($_GET['other_modules']) ? $_GET['other_modules'] : array();
                 Jetpack::activate_default_modules($min_version, $max_version, $other_modules);
                 wp_safe_redirect(Jetpack::admin_url('page=jetpack'));
                 exit;
             case 'disconnect':
                 if (!current_user_can('jetpack_disconnect')) {
                     $error = 'cheatin';
                     break;
                 }
                 check_admin_referer('jetpack-disconnect');
                 Jetpack::log('disconnect');
                 Jetpack::disconnect();
                 wp_safe_redirect(Jetpack::admin_url('disconnected=true'));
                 exit;
             case 'reconnect':
                 if (!current_user_can('jetpack_reconnect')) {
                     $error = 'cheatin';
                     break;
                 }
                 check_admin_referer('jetpack-reconnect');
//.........这里部分代码省略.........
开发者ID:automattic,项目名称:jetpack,代码行数:101,代码来源:class.jetpack.php

示例9: jetpack_sites_list

 /**
  * Provides functionality for the Jetpack > Sites page.
  * Does not do the display!
  *
  * @since 2.9
  */
 public function jetpack_sites_list()
 {
     Jetpack::init();
     if (isset($_GET['action'])) {
         switch ($_GET['action']) {
             case 'subsiteregister':
                 /*
                  * @todo check_admin_referer( 'jetpack-subsite-register' );
                  */
                 Jetpack::log('subsiteregister');
                 // If !$_GET['site_id'] stop registration and error
                 if (!isset($_GET['site_id']) || empty($_GET['site_id'])) {
                     // Log error to state cookie for display later
                     /**
                      * @todo Make state messages show on Jetpack NA pages
                      **/
                     Jetpack::state('missing_site_id', 'Site ID must be provided to register a sub-site');
                     break;
                 }
                 // Send data to register endpoint and retrieve shadow blog details
                 $result = $this->do_subsiteregister();
                 $url = $this->get_url('network_admin_page');
                 if (is_wp_error($result)) {
                     $url = add_query_arg('action', 'connection_failed', $url);
                 } else {
                     $url = add_query_arg('action', 'connected', $url);
                 }
                 wp_safe_redirect($url);
                 break;
             case 'subsitedisconnect':
                 Jetpack::log('subsitedisconnect');
                 if (!isset($_GET['site_id']) || empty($_GET['site_id'])) {
                     Jetpack::state('missing_site_id', 'Site ID must be provided to disconnect a sub-site');
                     break;
                 }
                 $this->do_subsitedisconnect();
                 break;
             case 'connected':
             case 'connection_failed':
                 add_action('jetpack_notices', array($this, 'show_jetpack_notice'));
                 break;
         }
     }
 }
开发者ID:tinggao,项目名称:woofWarrior,代码行数:50,代码来源:class.jetpack-network.php

示例10: handle_unrecognized_action

 function handle_unrecognized_action($action)
 {
     switch ($action) {
         case 'bulk-activate':
             if (!current_user_can('jetpack_activate_modules')) {
                 break;
             }
             $modules = (array) $_GET['modules'];
             $modules = array_map('sanitize_key', $modules);
             check_admin_referer('bulk-jetpack_page_jetpack_modules');
             foreach ($modules as $module) {
                 Jetpack::log('activate', $module);
                 Jetpack::activate_module($module, false);
             }
             // The following two lines will rarely happen, as Jetpack::activate_module normally exits at the end.
             wp_safe_redirect(wp_get_referer());
             exit;
         case 'bulk-deactivate':
             if (!current_user_can('jetpack_deactivate_modules')) {
                 break;
             }
             $modules = (array) $_GET['modules'];
             $modules = array_map('sanitize_key', $modules);
             check_admin_referer('bulk-jetpack_page_jetpack_modules');
             foreach ($modules as $module) {
                 Jetpack::log('deactivate', $module);
                 Jetpack::deactivate_module($module);
                 Jetpack::state('message', 'module_deactivated');
             }
             Jetpack::state('module', $modules);
             wp_safe_redirect(wp_get_referer());
             exit;
         default:
             return;
     }
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:36,代码来源:class.jetpack-admin.php

示例11: do_migration

 public static function do_migration()
 {
     Jetpack_Options::update_option('custom_css_4.7_migration', true);
     Jetpack::log('custom_css_4.7_migration', 'start');
     if (!post_type_exists('safecss')) {
         self::register_legacy_post_type();
     }
     /** This filter is documented in modules/custom-css/custom-css.php */
     $preprocessors = apply_filters('jetpack_custom_css_preprocessors', array());
     $core_css_post = wp_get_custom_css_post();
     $jetpack_css_post = self::get_post();
     $revisions = self::get_all_revisions();
     // Migrate the settings from revision meta to theme mod.
     $options = self::get_options($jetpack_css_post->ID);
     set_theme_mod('jetpack_custom_css', $options);
     if (empty($revisions) || !is_array($revisions)) {
         if ($jetpack_css_post instanceof WP_Post) {
             // Feed in the raw, if the current setting is Sass/LESS, it'll filter it inside.
             wp_update_custom_css_post($jetpack_css_post->post_content);
             return 1;
         }
         return null;
     }
     $revisions = array_reverse($revisions);
     $themes = Jetpack_Custom_CSS_Enhancements::get_themes();
     $migrated = array();
     foreach ($revisions as $post_id => $post) {
         // Jetpack had stored the theme Name, not the stylesheet directory, for ... reasons.
         // Get the stylesheet.  If null, the theme is no longer available.  Skip.
         $stylesheet = isset($themes[$post->post_excerpt]) ? $themes[$post->post_excerpt] : null;
         if (empty($stylesheet)) {
             continue;
         }
         $migrated[] = $post->ID;
         $preprocessor = get_post_meta($post->ID, 'custom_css_preprocessor', true);
         $css = $post->post_content;
         $pre = '';
         // Do a revision by revision parsing.
         if ($preprocessor && isset($preprocessors[$preprocessor])) {
             $pre = $css;
             $css = call_user_func($preprocessors[$preprocessor]['callback'], $pre);
         }
         // Do we need to remove any filters here for users without `unfiltered_html` ?
         wp_update_custom_css_post($css, array('stylesheet' => $stylesheet, 'preprocessed' => $pre));
     }
     // If we've migrated some CSS for the current theme and there was already something there in the Core dataset ...
     if ($core_css_post && $jetpack_css_post) {
         $preprocessor = $options['preprocessor'];
         $css = $core_css_post->post_content;
         $pre = $core_css_post->post_content_filtered;
         if ($preprocessor) {
             if ($pre) {
                 $pre .= "\r\n\r\n/*\r\n\t" . esc_js(__('CSS Migrated from Jetpack:', 'jetpack')) . "\r\n*/\r\n\r\n";
             }
             $pre .= $jetpack_css_post->post_content;
             $css .= "\r\n\r\n/*\r\n\t" . esc_js(__('CSS Migrated from Jetpack:', 'jetpack')) . "\r\n*/\r\n\r\n";
             $css .= call_user_func($preprocessors[$preprocessor]['callback'], $jetpack_css_post->post_content);
         } else {
             $css .= "\r\n\r\n/*\r\n\t" . esc_js(__('CSS Migrated from Jetpack:', 'jetpack')) . "\r\n*/\r\n\r\n";
             $css .= $jetpack_css_post->post_content;
         }
         wp_update_custom_css_post($css, array('preprocessed' => $pre));
     }
     Jetpack::log('custom_css_4.7_migration', sizeof($migrated) . 'revisions migrated');
     return sizeof($migrated);
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:66,代码来源:migrate-to-core.php

示例12: jumpstart_activate

 /**
  * Activates a series of valid Jetpack modules and initializes some options.
  *
  * @since 4.3.0
  *
  * @param WP_REST_Request $data {
  *     Array of parameters received by request.
  * }
  *
  * @return bool|WP_Error True if Jumpstart succeeded. Otherwise, a WP_Error instance with the corresponding error.
  */
 public static function jumpstart_activate($data)
 {
     $modules = Jetpack::get_available_modules();
     $activate_modules = array();
     foreach ($modules as $module) {
         $module_info = Jetpack::get_module($module);
         if (isset($module_info['feature']) && is_array($module_info['feature']) && in_array('Jumpstart', $module_info['feature'])) {
             $activate_modules[] = $module;
         }
     }
     // Collect success/error messages like modules that are properly activated.
     $result = array('activated_modules' => array(), 'failed_modules' => array());
     // Update the jumpstart option
     if ('new_connection' === Jetpack_Options::get_option('jumpstart')) {
         $result['jumpstart_activated'] = Jetpack_Options::update_option('jumpstart', 'jumpstart_activated');
     }
     // Check for possible conflicting plugins
     $module_slugs_filtered = Jetpack::init()->filter_default_modules($activate_modules);
     foreach ($module_slugs_filtered as $module_slug) {
         Jetpack::log('activate', $module_slug);
         if (Jetpack::activate_module($module_slug, false, false)) {
             $result['activated_modules'][] = $module_slug;
         } else {
             $result['failed_modules'][] = $module_slug;
         }
     }
     // Set the default sharing buttons and set to display on posts if none have been set.
     $sharing_services = get_option('sharing-services');
     $sharing_options = get_option('sharing-options');
     if (empty($sharing_services['visible'])) {
         // Default buttons to set
         $visible = array('twitter', 'facebook', 'google-plus-1');
         $hidden = array();
         // Set some sharing settings
         $sharing = new Sharing_Service();
         $sharing_options['global'] = array('button_style' => 'icon', 'sharing_label' => $sharing->default_sharing_label, 'open_links' => 'same', 'show' => array('post'), 'custom' => isset($sharing_options['global']['custom']) ? $sharing_options['global']['custom'] : array());
         $result['sharing_options'] = update_option('sharing-options', $sharing_options);
         $result['sharing_services'] = update_option('sharing-services', array('visible' => $visible, 'hidden' => $hidden));
     }
     // If all Jumpstart modules were activated
     if (empty($result['failed_modules'])) {
         return rest_ensure_response(array('code' => 'success', 'message' => esc_html__('Jumpstart done.', 'jetpack'), 'data' => $result));
     }
     return new WP_Error('jumpstart_failed', esc_html(sprintf(_n('Jumpstart failed activating this module: %s.', 'Jumpstart failed activating these modules: %s.', count($result['failed_modules']), 'jetpack'), join(', ', $result['failed_modules']))), array('status' => 400));
 }
开发者ID:iamtakashi,项目名称:jetpack,代码行数:56,代码来源:class.core-rest-api-endpoints.php

示例13: unlink_user

 /**
  * Unlink a user from WordPress.com
  *
  * This will fail if called by the Master User.
  */
 function unlink_user()
 {
     Jetpack::log('unlink');
     return Jetpack::unlink_user();
 }
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:10,代码来源:class.jetpack-xmlrpc-server.php


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