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


PHP Jetpack::disconnect方法代码示例

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


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

示例1: disconnect

 /**
  * Disconnect Jetpack Blogs or Users
  *
  * ## OPTIONS
  *
  * blog: Disconnect the entire blog.
  *
  * user <user_identifier>: Disconnect a specific user from WordPress.com.
  *
  * Please note, the primary account that the blog is connected
  * to WordPress.com with cannot be disconnected without
  * disconnecting the entire blog.
  *
  * ## EXAMPLES
  *
  * wp jetpack disconnect blog
  * wp jetpack disconnect user 13
  * wp jetpack disconnect user username
  * wp jetpack disconnect user email@domain.com
  *
  * @synopsis blog|[user <user_id>]
  */
 public function disconnect($args, $assoc_args)
 {
     if (!Jetpack::is_active()) {
         WP_CLI::error(__('You cannot disconnect, without having first connected.', 'jetpack'));
     }
     $action = isset($args[0]) ? $args[0] : 'prompt';
     if (!in_array($action, array('blog', 'user', 'prompt'))) {
         WP_CLI::error(sprintf(__('%s is not a valid command.', 'jetpack'), $action));
     }
     if (in_array($action, array('user'))) {
         if (isset($args[1])) {
             $user_id = $args[1];
             if (ctype_digit($user_id)) {
                 $field = 'id';
                 $user_id = (int) $user_id;
             } elseif (is_email($user_id)) {
                 $field = 'email';
                 $user_id = sanitize_user($user_id, true);
             } else {
                 $field = 'login';
                 $user_id = sanitize_user($user_id, true);
             }
             if (!($user = get_user_by($field, $user_id))) {
                 WP_CLI::error(__('Please specify a valid user.', 'jetpack'));
             }
         } else {
             WP_CLI::error(__('Please specify a user.', 'jetpack'));
         }
     }
     switch ($action) {
         case 'blog':
             Jetpack::log('disconnect');
             Jetpack::disconnect();
             WP_CLI::success(__('Jetpack has been successfully disconnected.', 'jetpack'));
             break;
         case 'user':
             if (Jetpack::unlink_user($user->ID)) {
                 Jetpack::log('unlink', $user->ID);
                 WP_CLI::success(sprintf(__('%s has been successfully disconnected.', 'jetpack'), $action));
             } else {
                 WP_CLI::error(sprintf(__('%s could not be disconnected.  Are you sure they\'re connected currently?', 'jetpack'), "{$user->login} <{$user->email}>"));
             }
             break;
         case 'prompt':
             WP_CLI::error(__('Please specify if you would like to disconnect a blog or user.', 'jetpack'));
             break;
     }
 }
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:70,代码来源:class.jetpack-cli.php

示例2: 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

示例3: plugin_deactivation

 /**
  * Removes all connection options
  * @static
  */
 function plugin_deactivation($network_wide)
 {
     Jetpack::disconnect(false);
 }
开发者ID:Bencheci,项目名称:blueRavenStudiosProject,代码行数:8,代码来源:jetpack.php

示例4: 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 {
             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->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_description', $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');
                 Jetpack::log('reconnect');
                 $this->disconnect();
                 wp_redirect($this->build_connect_url(true, false, 'reconnect'));
                 exit;
             case 'deactivate':
                 if (!current_user_can('jetpack_deactivate_modules')) {
//.........这里部分代码省略.........
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:101,代码来源:class.jetpack.php

示例5: do_subsitedisconnect

 /**
  * Disconnect functionality for an individual site
  *
  * @since 2.9
  * @see   Jetpack_Network::jetpack_sites_list()
  */
 public function do_subsitedisconnect($site_id = null)
 {
     if (!current_user_can('jetpack_disconnect')) {
         return;
     }
     $site_id = is_null($site_id) ? $_GET['site_id'] : $site_id;
     switch_to_blog($site_id);
     Jetpack::disconnect();
     restore_current_blog();
 }
开发者ID:tinggao,项目名称:woofWarrior,代码行数:16,代码来源:class.jetpack-network.php

示例6: 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

示例7: disconnect_site

 /**
  * Disconnects Jetpack from the WordPress.com Servers
  *
  * @uses Jetpack::disconnect();
  * @since 4.3.0
  * @return bool|WP_Error True if Jetpack successfully disconnected.
  */
 public static function disconnect_site($data)
 {
     $param = $data->get_json_params();
     if (!isset($param['isActive']) || $param['isActive'] !== false) {
         return new WP_Error('invalid_param', esc_html__('Invalid Parameter', 'jetpack'), array('status' => 404));
     }
     if (Jetpack::is_active()) {
         Jetpack::disconnect();
         return rest_ensure_response(array('code' => 'success'));
     }
     return new WP_Error('disconnect_failed', esc_html__('Was not able to disconnect the site.  Please try again.', 'jetpack'), array('status' => 400));
 }
开发者ID:iamtakashi,项目名称:jetpack,代码行数:19,代码来源:class.core-rest-api-endpoints.php

示例8: do_subsitedisconnect

 /**
  * Disconnect functionality for an individual site
  *
  * @since 2.9
  * @see Jetpack_Network::jetpack_sites_list()
  */
 public function do_subsitedisconnect($site_id = null)
 {
     $site_id = is_null($site_id) ? $_GET['site_id'] : $site_id;
     switch_to_blog($site_id);
     Jetpack::disconnect();
     restore_current_blog();
 }
开发者ID:lokenxo,项目名称:familygenerator,代码行数:13,代码来源:class.jetpack-network.php

示例9: disconnect_blog

 /**
  * Disconnect this blog from the connected wordpress.com account
  * @return boolean
  */
 function disconnect_blog()
 {
     Jetpack::log('disconnect');
     Jetpack::disconnect();
     return true;
 }
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:10,代码来源:class.jetpack-xmlrpc-server.php

示例10: disconnect_site

 /**
  * Disconnects Jetpack from the WordPress.com Servers
  *
  * @uses Jetpack::disconnect();
  * @since 4.1.0
  * @return bool|WP_Error True if Jetpack successfully disconnected.
  */
 public static function disconnect_site()
 {
     if (Jetpack::is_active()) {
         Jetpack::disconnect();
         return rest_ensure_response(array('code' => 'success'));
     }
     return new WP_Error('disconnect_failed', esc_html__('Was not able to disconnect the site.  Please try again.', 'jetpack'), array('status' => 400));
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:15,代码来源:class.core-rest-api-endpoints.php

示例11: start_fresh_connection

 /**
  * This IDC resolution will disconnect the site and re-connect to a completely new
  * and separate shadow site than the original.
  *
  * It will first will disconnect the site without phoning home as to not disturb the production site.
  * It then builds a fresh connection URL and sends it back along with the response.
  *
  * @since 4.4.0
  * @return bool|WP_Error
  */
 public static function start_fresh_connection()
 {
     // First clear the options / disconnect.
     Jetpack::disconnect();
     return self::build_connect_url();
 }
开发者ID:automattic,项目名称:jetpack,代码行数:16,代码来源:class.core-rest-api-endpoints.php


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