diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2017-04-16 04:35:35 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2017-04-16 04:35:35 -0400 |
commit | 38a805d24a890dea4b5e90851693afb4e2041c9e (patch) | |
tree | 5f4b08ad64e6750936303d18abc370851e0db260 /plugins/jetpack/class.jetpack.php | |
parent | Update plugin wordpress-mobile-pack 2.2.9 (diff) | |
download | blogs-gentoo-38a805d24a890dea4b5e90851693afb4e2041c9e.tar.gz blogs-gentoo-38a805d24a890dea4b5e90851693afb4e2041c9e.tar.bz2 blogs-gentoo-38a805d24a890dea4b5e90851693afb4e2041c9e.zip |
Update jetpack 4.8.2
Diffstat (limited to 'plugins/jetpack/class.jetpack.php')
-rw-r--r-- | plugins/jetpack/class.jetpack.php | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/plugins/jetpack/class.jetpack.php b/plugins/jetpack/class.jetpack.php index 0cd3870d..4a04c4d3 100644 --- a/plugins/jetpack/class.jetpack.php +++ b/plugins/jetpack/class.jetpack.php @@ -223,7 +223,6 @@ class Jetpack { 'facebook-thumb-fixer/_facebook-thumb-fixer.php', // Facebook Thumb Fixer 'facebook-and-digg-thumbnail-generator/facebook-and-digg-thumbnail-generator.php', // Fedmich's Facebook Open Graph Meta - 'header-footer/plugin.php', // Header and Footer 'network-publisher/networkpub.php', // Network Publisher 'nextgen-facebook/nextgen-facebook.php', // NextGEN Facebook OG 'social-networks-auto-poster-facebook-twitter-g/NextScripts_SNAP.php', @@ -1287,6 +1286,7 @@ class Jetpack { $personal_plans = array( 'jetpack_personal', 'jetpack_personal_monthly', + 'personal-bundle', ); if ( in_array( $plan['product_slug'], $personal_plans ) ) { @@ -1300,6 +1300,7 @@ class Jetpack { $premium_plans = array( 'jetpack_premium', 'jetpack_premium_monthly', + 'value_bundle', ); if ( in_array( $plan['product_slug'], $premium_plans ) ) { @@ -1316,6 +1317,7 @@ class Jetpack { $business_plans = array( 'jetpack_business', 'jetpack_business_monthly', + 'business-bundle', ); if ( in_array( $plan['product_slug'], $business_plans ) ) { @@ -1532,6 +1534,7 @@ class Jetpack { wp_oembed_add_provider( '#https?://(www\.)?gfycat\.com/.*#i', 'https://api.gfycat.com/v1/oembed', true ); wp_oembed_add_provider( '#https?://[^.]+\.(wistia\.com|wi\.st)/(medias|embed)/.*#', 'https://fast.wistia.com/oembed', true ); wp_oembed_add_provider( '#https?://sketchfab\.com/.*#i', 'https://sketchfab.com/oembed', true ); + wp_oembed_add_provider( '#https?://(www\.)?icloud\.com/keynote/.*#i', 'https://iwmb.icloud.com/iwmb/oembed', true ); } /** @@ -1603,7 +1606,7 @@ class Jetpack { continue; } - if ( ! @include( Jetpack::get_module_path( $module ) ) ) { + if ( ! include_once( Jetpack::get_module_path( $module ) ) ) { unset( $modules[ $index ] ); self::update_active_modules( array_values( $modules ) ); continue; @@ -2311,12 +2314,29 @@ class Jetpack { $data = get_file_data( $file, $headers ); // Strip out any old Jetpack versions that are cluttering the option. - $file_data_option = array_intersect_key( (array) $file_data_option, array( JETPACK__VERSION => null ) ); + // + // We maintain the data for the current version of Jetpack plus the previous version + // to prevent repeated DB hits on large sites hosted with multiple web servers + // on a single database (since all web servers might not be updated simultaneously) + $file_data_option[ JETPACK__VERSION ][ $key ] = $data; + + if ( count( $file_data_option ) > 2 ) { + $count = 0; + krsort( $file_data_option ); + foreach ( $file_data_option as $version => $values ) { + $count++; + if ( $count > 2 && JETPACK__VERSION != $version ) { + unset( $file_data_option[ $version ] ); + } + } + } + Jetpack_Options::update_option( 'file_data', $file_data_option ); return $data; } + /** * Return translated module tag. @@ -2417,7 +2437,25 @@ class Jetpack { * Saves any generated PHP errors in ::state( 'php_errors', {errors} ) */ public static function catch_errors_on_shutdown() { - Jetpack::state( 'php_errors', ob_get_clean() ); + Jetpack::state( 'php_errors', self::alias_directories( ob_get_clean() ) ); + } + + /** + * Rewrite any string to make paths easier to read. + * + * Rewrites ABSPATH (eg `/home/jetpack/wordpress/`) to ABSPATH, and if WP_CONTENT_DIR + * is located outside of ABSPATH, rewrites that to WP_CONTENT_DIR. + * + * @param $string + * @return mixed + */ + public static function alias_directories( $string ) { + // ABSPATH has a trailing slash. + $string = str_replace( ABSPATH, 'ABSPATH/', $string ); + // WP_CONTENT_DIR does not have a trailing slash. + $string = str_replace( WP_CONTENT_DIR, 'WP_CONTENT_DIR', $string ); + + return $string; } public static function activate_default_modules( $min_version = false, $max_version = false, $other_modules = array(), $redirect = true ) { @@ -2751,6 +2789,9 @@ p { if ( $network_wide ) Jetpack::state( 'network_nag', true ); + // For firing one-off events (notices) immediately after activation + set_transient( 'activated_jetpack', true, .1 * MINUTE_IN_SECONDS ); + Jetpack::plugin_initialize(); } /** @@ -4249,15 +4290,6 @@ p { } } - function debugger_page() { - nocache_headers(); - if ( ! current_user_can( 'manage_options' ) ) { - die( '-1' ); - } - Jetpack_Debugger::jetpack_debug_display_handler(); - exit; - } - public static function admin_screen_configure_module( $module_id ) { // User that doesn't have 'jetpack_configure_modules' will never end up here since Jetpack Landing Page woun't let them. |