Plugin Directory

Timestamp:
09/29/2017 07:04:55 PM (7 years ago)
Author:
dsmart
Message:

Jetpack 5.4-beta2

https://github.com/Automattic/jetpack/releases/tag/5.4-beta2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/trunk/class.jetpack.php

    r1736680 r1738590  
    16551655     */
    16561656    public static function load_modules() {
    1657         if ( ! self::is_active() && !self::is_development_mode() ) {
    1658             if ( ! is_multisite() || ! get_site_option( 'jetpack_protect_active' ) ) {
    1659                 return;
    1660             }
     1657        if (
     1658            ! self::is_active()
     1659            && ! self::is_development_mode()
     1660            && (
     1661                ! is_multisite()
     1662                || ! get_site_option( 'jetpack_protect_active' )
     1663            )
     1664        ) {
     1665            return;
    16611666        }
    16621667
     
    17351740
    17361741        // Load module-specific code that is needed even when a module isn't active. Loaded here because code contained therein may need actions such as setup_theme.
    1737         if ( Jetpack::is_active() || Jetpack::is_development_mode() )
    1738             require_once( JETPACK__PLUGIN_DIR . 'modules/module-extras.php' );
     1742        require_once( JETPACK__PLUGIN_DIR . 'modules/module-extras.php' );
    17391743    }
    17401744
     
    52535257                $jpUser = get_user_by( 'email', $jpo->onboarding->jpUser );
    52545258                if ( is_a( $jpUser, 'WP_User' ) ) {
    5255                     $token_type = 'user';
    5256                     $token->external_user_id = $jpUser->ID;
     5259                    wp_set_current_user( $jpUser->ID );
     5260                    $user_can = is_multisite()
     5261                        ? current_user_can_for_blog( get_current_blog_id(), 'manage_options' )
     5262                        : current_user_can( 'manage_options' );
     5263                    if ( $user_can ) {
     5264                        $token_type = 'user';
     5265                        $token->external_user_id = $jpUser->ID;
     5266                    }
    52575267                }
    52585268            }
     
    60206030     * Checks whether the sync_error_idc option is valid or not, and if not, will do cleanup.
    60216031     *
     6032
     6033
     6034
    60226035     * @return bool
    60236036     */
     
    60436056        // Is the site opted in and does the stored sync_error_idc option match what we now generate?
    60446057        $sync_error = Jetpack_Options::get_option( 'sync_error_idc' );
    6045         $local_options = self::get_sync_error_idc_option();
    60466058        if ( $idc_allowed && $sync_error && self::sync_idc_optin() ) {
     6059
    60476060            if ( $sync_error['home'] === $local_options['home'] && $sync_error['siteurl'] === $local_options['siteurl'] ) {
    60486061                $is_valid = true;
     
    60926105     *
    60936106     * @since 4.4.0
     6107
    60946108     *
    60956109     * @param array $response
     
    60976111     */
    60986112    public static function get_sync_error_idc_option( $response = array() ) {
    6099         require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-functions.php';
    6100         $local_options = array(
    6101             'home'    => Jetpack_Sync_Functions::home_url(),
    6102             'siteurl' => Jetpack_Sync_Functions::site_url(),
    6103         );
    6104 
    6105         $options = array_merge( $local_options, $response );
    6106 
    6107         $returned_values = array();
    6108         foreach( $options as $key => $option ) {
    6109             if ( 'error_code' === $key ) {
    6110                 $returned_values[ $key ] = $option;
    6111                 continue;
    6112             }
    6113 
    6114             if ( is_wp_error( $normalized_url = self::normalize_url_protocol_agnostic( $option ) ) ) {
    6115                 continue;
    6116             }
    6117 
    6118             $returned_values[ $key ] = $normalized_url;
     6113        $returned_values = get_transient( 'jetpack_idc_option' );
     6114        if ( false === $returned_values ) {
     6115            require_once JETPACK__PLUGIN_DIR . 'sync/class.jetpack-sync-functions.php';
     6116            $local_options = array(
     6117                'home'    => Jetpack_Sync_Functions::home_url(),
     6118                'siteurl' => Jetpack_Sync_Functions::site_url(),
     6119            );
     6120
     6121            $options = array_merge( $local_options, $response );
     6122
     6123            $returned_values = array();
     6124            foreach( $options as $key => $option ) {
     6125                if ( 'error_code' === $key ) {
     6126                    $returned_values[ $key ] = $option;
     6127                    continue;
     6128                }
     6129
     6130                if ( is_wp_error( $normalized_url = self::normalize_url_protocol_agnostic( $option ) ) ) {
     6131                    continue;
     6132                }
     6133
     6134                $returned_values[ $key ] = $normalized_url;
     6135            }
     6136
     6137            set_transient( 'jetpack_idc_option', $returned_values, MINUTE_IN_SECONDS );
    61196138        }
    61206139
     
    67286747        if ( self::is_active() ) {
    67296748            add_action( 'jetpack_dashboard_widget', array( __CLASS__, 'dashboard_widget_footer' ), 999 );
    6730             $widget_title = __( 'Site Stats', 'jetpack' );
    67316749        }
    67326750
     
    67346752            wp_add_dashboard_widget(
    67356753                'jetpack_summary_widget',
    6736                 $widget_title,
     6754                ,
    67376755                array( __CLASS__, 'dashboard_widget' )
    67386756            );
Note: See TracChangeset for help on using the changeset viewer.