v029086 濾 \ 4 l D  | T ,  d <  t L $ \ 4 ż Ɣ l D  ˤ | T ,  д ь d <  ֜ t L $ ۬ ܄ \ 4 l D  | T ,  d <  t L $ \ 4 l D   | T ,    d <  t L $    \ 4    l D    | T ,  ! " #d $< % & ' (t )L *$ + , - .\ /4 0 1 2 3l 4D 5 6 7 8| 9T :, ; < = >d ?< @ A B Ct DL E$ F G H I\ J4 K L M Nl OD P Q R S| TT U, V W X Yd Z< [ \ ] ^t _L `$ a b c d\ e4 f g h ih j@ k l m nt oL p$ q r s t\ u4 v w x yl zD { | } ~| T ,  d <  t L $ \ 4 l D  | T ,  d <  t L $1539861 h 2 <   0 h  X  P @ 0  0  $ t  p  p  x   @  T  f  4f  xf  f  f  Hf  f  f  f  Tf  f  f  8f  |f  f  f  Df  f  f  f  \f  f  f  8f  !f  "f  $ f  %Lf  &f  'f  )f  *\f  +f  ,f  .(f  /tf  0f  1f  3@f  4f  5f  7f  8Tf  9f  :f  <f  =\f  >f  ?f  A(f  Bhf  Cf  Df  F8f  Gf  Hf  Jf  KPf  Lf  Mf  O$f  Ppf  Qf  Rf  T @ A| B D$ E G H J K M N P Q SD T VH W Yx [ \ ^@ _ a| c, d fh g ih j l\ m oH p r( s u v x y {, | ~x x ` H H p   $ P  $  | x  @ p  @ h x ( ɼ P l ѐ , Դ T l x l D L 0  p h p 0 P x   8  H h      ,  @  <  4 "P # %` & ( *, + - /4 0 2 44 5 7X 8 : ; =p > @d A CD D F G I$ J LT M Op Q R T( U W` X Zl [ ]| _ ` b c e< f hT i kH l nh o q s t v$32598 h x a3acng hL i j, kL lp mx n o ph q4w010419dLx y z | } ~ ( 4 8 < @ L P \ d p X \ h l t     $ ( , 8 < @ D H L T X l p t x |     , 0 4 8 < @ D P X d p t Ԉ ՜ ֨ ׬ ذ ٸ ݴ ޘ x P ,  \ 8  p X X L $    $ , < D ` H h x M ( P l     T h       , @ t         p !D "8 # $ %d &0 ' ( ) *d +4 , - . / 0 1 2 3 4 5 6 7| 8x 9t :x ;t

| ?x @t Ap Bl Ch Dd E` Fh Gd H` I\ JX KT LX M8 N  O P Q Rd SH T, U V W X Yx Z [ \ ] ^ _ ` a b c d e f g i j k l( m4 n@ oL pX qd rp s| t u v w x y z { | }   $ 0 < H T 4  \ H 4  t \ H 4   t d L 4   5ad7 < 0 h D T  T L return false; } // Decode the results. $results = json_decode( $body, true ); if ( ! is_array( $results ) ) { return false; } if ( isset( $results['products'] ) ) { // Store the site's products in an option and return true if updated. self::store_data_in_option( self::SITE_PRODUCTS_OPTION, $results['products'] ); } if ( ! isset( $results['plan'] ) ) { return false; } $current_plan = get_option( self::PLAN_OPTION, array() ); if ( ! empty( $current_plan ) && $current_plan === $results['plan'] ) { // Bail if the plans array hasn't changed. return false; } // Store the new plan in an option and return true if updated. $result = self::store_data_in_option( self::PLAN_OPTION, $results['plan'] ); if ( $result ) { // Reset the cache since we've just updated the plan. self::$active_plan_cache = null; } return $result; } /** * Store data in an option. * * @param string $option The name of the option that will store the data. * @param array $data Data to be store in an option. * @return bool Were the subscriptions successfully updated? */ private static function store_data_in_option( $option, $data ) { $result = update_option( $option, $data, true ); // If something goes wrong with the update, so delete the current option and then update it. if ( ! $result ) { delete_option( $option ); $result = update_option( $option, $data, true ); } return $result; } /** * Make an API call to WordPress.com for plan status * * @uses Jetpack_Options::get_option() * @uses Client::wpcom_json_api_request_as_blog() * @uses update_option() * * @access public * @static * * @return bool True if plan is updated, false if no update */ public static function refresh_from_wpcom() { $site_id = Manager::get_site_id(); if ( is_wp_error( $site_id ) ) { return false; } // Make the API request. $response = Client::wpcom_json_api_request_as_blog( sprintf( '/sites/%d?force=wpcom', $site_id ), '1.1' ); return self::update_from_sites_response( $response ); } /** * Get the plan that this Jetpack site is currently using. * * @uses get_option() * * @access public * @static * * @return array Active Jetpack plan details */ public static function get() { // this can be expensive to compute so we cache for the duration of a request. if ( is_array( self::$active_plan_cache ) && ! empty( self::$active_plan_cache ) ) { return self::$active_plan_cache; } $plan = get_option( self::PLAN_OPTION, array() ); // Set the default options. $plan = wp_parse_args( $plan, array( 'product_slug' => 'jetpack_free', 'class' => 'free', 'features' => array( 'active' => array(), ), ) ); list( $plan['class'], $supports ) = self::get_class_and_features( $plan['product_slug'] ); $modules = new Modules(); foreach ( $modules->get_available() as $module_slug ) { $module = $modules->get( $module_slug ); if ( ! isset( $module ) || ! is_array( $module ) ) { continue; } if ( in_array( 'free', $module['plan_classes'], true ) || in_array( $plan['class'], $module['plan_classes'], true ) ) { $supports[] = $module_slug; } } $plan['supports'] = $supports; self::$active_plan_cache = $plan; return $plan; } /** * Get the site's products. * * @uses get_option() * * @access public * @static * * @return array Active Jetpack products */ public static function get_products() { return get_option( self::SITE_PRODUCTS_OPTION, array() ); } /** * Get the class of plan and a list of features it supports * * @param string $plan_slug The plan that we're interested in. * @return array Two item array, the plan class and the an array of features. */ private static function get_class_and_features( $plan_slug ) { $features = array(); foreach ( self::PLAN_DATA as $class => $details ) { $features = array_merge( $features, $details['supports'] ); if ( in_array( $plan_slug, $details['plans'], true ) ) { return array( $class, $features ); } } return array( 'free', self::PLAN_DATA['free']['supports'] ); } /** * Gets the minimum plan slug that supports the given feature * * @param string $feature The name of the feature. * @return string|bool The slug for the minimum plan that supports. * the feature or false if not found */ public static function get_minimum_plan_for_feature( $feature ) { foreach ( self::PLAN_DATA as $details ) { if ( in_array( $feature, $details['supports'], true ) ) { return $details['plans'][0]; } } return false; } /** * Determine whether the active plan supports a particular feature * * @uses self::get() * * @access public * @static * * @param string $feature The module or feature to check. * @param bool $refresh_from_wpcom Refresh the local plan cache from wpcom. * * @return bool True if plan supports feature, false if not */ public static function supports( $feature, $refresh_from_wpcom = false ) { if ( $refresh_from_wpcom ) { self::refresh_from_wpcom(); } // Hijack the feature eligibility check on WordPress.com sites since they are gated differently. $should_wpcom_gate_feature = ( function_exists( 'wpcom_site_has_feature' ) && function_exists( 'wpcom_feature_exists' ) && wpcom_feature_exists( $feature ) ); if ( $should_wpcom_gate_feature ) { return wpcom_site_has_feature( $feature ); } // Search product bypasses plan feature check. if ( 'search' === $feature && (bool) get_option( 'has_jetpack_search_product' ) ) { return true; } // As of Q3 2021 - a videopress free tier is available to all plans. if ( 'videopress' === $feature ) { return true; } // As of 05 2023 - all plans support Earn features (minus 'simple-payments'). if ( in_array( $feature, array( 'donations', 'recurring-payments', 'premium-content/container' ), true ) ) { return true; } $plan = self::get(); if ( in_array( $feature, $plan['supports'], true ) || in_array( $feature, $plan['features']['active'], true ) ) { return true; } return false; } /** * Retrieve site-specific features for Simple sites. * * See Jetpack_Gutenberg::get_site_specific_features() * * @return array */ public static function get_simple_site_specific_features() { $is_simple_site = defined( 'IS_WPCOM' ) && constant( 'IS_WPCOM' ); if ( ! $is_simple_site ) { return array( 'active' => array(), 'available' => array(), ); } $current_blog_id = get_current_blog_id(); // Return the cached value if it exists. if ( isset( self::$simple_site_specific_features[ $current_blog_id ] ) ) { return self::$simple_site_specific_features[ $current_blog_id ]; } if ( ! class_exists( '\Store_Product_List' ) ) { require WP_CONTENT_DIR . '/admin-plugins/wpcom-billing/store-product-list.php'; } $simple_site_specific_features = \Store_Product_List::get_site_specific_features_data( $current_blog_id ); self::$simple_site_specific_features[ $current_blog_id ] = $simple_site_specific_features; return $simple_site_specific_features; } }