summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYury German <blueknight@gentoo.org>2019-04-28 17:39:03 -0400
committerYury German <blueknight@gentoo.org>2019-04-28 17:39:03 -0400
commit2ab16973706e120bc344c83be6295b54fd908c57 (patch)
tree358267a52d9542c77c90e3663cea32d13b8cb639 /plugins/jetpack/_inc/lib/admin-pages
parentUpdate twentysixteen 1.7 (diff)
downloadblogs-gentoo-2ab16973706e120bc344c83be6295b54fd908c57.tar.gz
blogs-gentoo-2ab16973706e120bc344c83be6295b54fd908c57.tar.bz2
blogs-gentoo-2ab16973706e120bc344c83be6295b54fd908c57.zip
Updating packages for 5.1.1
Signed-off-by: Yury German <blueknight@gentoo.org>
Diffstat (limited to 'plugins/jetpack/_inc/lib/admin-pages')
-rw-r--r--plugins/jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php40
-rw-r--r--plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php31
-rw-r--r--plugins/jetpack/_inc/lib/admin-pages/class.jetpack-settings-page.php16
3 files changed, 45 insertions, 42 deletions
diff --git a/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php b/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php
index d352aa56..0c50f380 100644
--- a/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php
+++ b/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-admin-page.php
@@ -35,6 +35,7 @@ abstract class Jetpack_Admin_Page {
}
function add_actions() {
+ global $pagenow;
// If user is not an admin and site is in Dev Mode, don't do anything
if ( ! current_user_can( 'manage_options' ) && Jetpack::is_development_mode() ) {
@@ -61,6 +62,18 @@ abstract class Jetpack_Admin_Page {
if ( ! self::$block_page_rendering_for_idc ) {
add_action( "admin_print_styles-$hook", array( $this, 'additional_styles' ) );
}
+ // If someone just activated Jetpack, let's show them a fullscreen connection banner.
+ if (
+ ( 'admin.php' === $pagenow && isset( $_GET['page'] ) && 'jetpack' === $_GET['page'] )
+ && ! Jetpack::is_active()
+ && current_user_can( 'jetpack_connect' )
+ && ! Jetpack::is_development_mode()
+ ) {
+ add_action( 'admin_enqueue_scripts', array( 'Jetpack_Connection_Banner', 'enqueue_banner_scripts' ) );
+ add_action( 'admin_print_styles', array( Jetpack::init(), 'admin_banner_styles' ) );
+ add_action( 'admin_notices', array( 'Jetpack_Connection_Banner', 'render_connect_prompt_full_screen' ) );
+ delete_transient( 'activated_jetpack' );
+ }
// Check if the site plan changed and deactivate modules accordingly.
add_action( 'current_screen', array( $this, 'check_plan_deactivate_modules' ) );
@@ -72,12 +85,12 @@ abstract class Jetpack_Admin_Page {
function admin_head() {
if ( isset( $_GET['configure'] ) && Jetpack::is_module( $_GET['configure'] ) && current_user_can( 'manage_options' ) ) {
/**
- * Fires in the <head> of a particular Jetpack configuation page.
+ * Fires in the <head> of a particular Jetpack configuration page.
*
* The dynamic portion of the hook name, `$_GET['configure']`,
* refers to the slug of module, such as 'stats', 'sso', etc.
* A complete hook for the latter would be
- * 'jetpack_module_configuation_head_sso'.
+ * 'jetpack_module_configuration_head_sso'.
*
* @since 3.0.0
*/
@@ -130,18 +143,6 @@ abstract class Jetpack_Admin_Page {
}
/**
- * Checks if WordPress version is too old to have REST API.
- *
- * @since 4.3
- *
- * @return bool
- */
- function is_wp_version_too_old() {
- global $wp_version;
- return ( ! function_exists( 'rest_api_init' ) || version_compare( $wp_version, '4.4-z', '<=' ) );
- }
-
- /**
* Checks if REST API is enabled.
*
* @since 4.4.2
@@ -184,7 +185,7 @@ abstract class Jetpack_Admin_Page {
return false;
}
- $current = Jetpack::get_active_plan();
+ $current = Jetpack_Plan::get();
$to_deactivate = array();
if ( isset( $current['product_slug'] ) ) {
@@ -206,7 +207,7 @@ abstract class Jetpack_Admin_Page {
$to_leave_enabled = array();
foreach ( $to_deactivate as $feature ) {
- if ( Jetpack::active_plan_supports( $feature ) ) {
+ if ( Jetpack_Plan::supports( $feature ) ) {
$to_leave_enabled []= $feature;
}
}
@@ -231,9 +232,9 @@ abstract class Jetpack_Admin_Page {
padding-left: 0 !important;
}
#wpbody-content {
- background-color: #f3f6f8;
+ background-color: #f6f6f6;
}
-
+
#jp-plugin-container .wrap {
margin: 0 auto;
max-width:45rem;
@@ -242,6 +243,9 @@ abstract class Jetpack_Admin_Page {
#jp-plugin-container.is-wide .wrap {
max-width: 1040px;
}
+ #jp-plugin-container .wrap .jetpack-wrap-container {
+ margin-top: 1em;
+ }
.wp-admin #dolly {
float: none;
position: relative;
diff --git a/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php b/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php
index 45f7d1e5..f84b62c3 100644
--- a/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php
+++ b/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-react-page.php
@@ -25,8 +25,8 @@ class Jetpack_React_Page extends Jetpack_Admin_Page {
return; // No need to handle the fallback redirection if we are not on the Jetpack page
}
- // Adding a redirect meta tag for older WordPress versions or if the REST API is disabled
- if ( $this->is_wp_version_too_old() || ! $this->is_rest_api_enabled() ) {
+ // Adding a redirect meta tag if the REST API is disabled
+ if ( ! $this->is_rest_api_enabled() ) {
$this->is_redirecting = true;
add_action( 'admin_head', array( $this, 'add_fallback_head_meta' ) );
}
@@ -169,18 +169,25 @@ class Jetpack_React_Page extends Jetpack_Admin_Page {
function page_admin_scripts() {
if ( $this->is_redirecting || isset( $_GET['configure'] ) ) {
- return; // No need for scripts on a fallback page
+ return; // No need for scripts on a fallback page.
}
- // Enqueue jp.js and localize it
- wp_enqueue_script( 'react-plugin', plugins_url( '_inc/build/admin.js', JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION, true );
+ wp_enqueue_script(
+ 'react-plugin',
+ plugins_url( '_inc/build/admin.js', JETPACK__PLUGIN_FILE ),
+ array( 'wp-i18n' ),
+ JETPACK__VERSION,
+ true
+ );
+
+ wp_set_script_translations( 'react-plugin', 'jetpack', JETPACK__PLUGIN_DIR . 'languages/json' );
if ( ! Jetpack::is_development_mode() && Jetpack::is_active() ) {
- // Required for Analytics
+ // Required for Analytics.
wp_enqueue_script( 'jp-tracks', '//stats.wp.com/w.js', array(), gmdate( 'YW' ), true );
}
- // Add objects to be passed to the initial state of the app
+ // Add objects to be passed to the initial state of the app.
wp_localize_script( 'react-plugin', 'Initial_State', $this->get_initial_state() );
}
@@ -231,6 +238,11 @@ class Jetpack_React_Page extends Jetpack_Admin_Page {
? get_permalink( $last_post[0]->ID )
: get_home_url();
+ // Ensure that class to get the affiliate code is loaded
+ if ( ! class_exists( 'Jetpack_Affiliate' ) ) {
+ require_once JETPACK__PLUGIN_DIR . 'class.jetpack-affiliate.php';
+ }
+
return array(
'WP_API_root' => esc_url_raw( rest_url() ),
'WP_API_nonce' => wp_create_nonce( 'wp_rest' ),
@@ -252,7 +264,7 @@ class Jetpack_React_Page extends Jetpack_Admin_Page {
'dismissedNotices' => $this->get_dismissed_jetpack_notices(),
'isDevVersion' => Jetpack::is_development_version(),
'currentVersion' => JETPACK__VERSION,
- 'is_gutenberg_available' => Jetpack_Gutenberg::is_gutenberg_available(),
+ 'is_gutenberg_available' => true,
'getModules' => $modules,
'showJumpstart' => jetpack_show_jumpstart(),
'rawUrl' => Jetpack::build_raw_urls( get_home_url() ),
@@ -267,6 +279,7 @@ class Jetpack_React_Page extends Jetpack_Admin_Page {
),
'roles' => $stats_roles,
),
+ 'aff' => Jetpack_Affiliate::init()->get_affiliate_code(),
'settings' => $this->get_flattened_settings( $modules ),
'userData' => array(
// 'othersLinked' => Jetpack::get_other_linked_admins(),
@@ -286,7 +299,7 @@ class Jetpack_React_Page extends Jetpack_Admin_Page {
*/
'showPromotions' => apply_filters( 'jetpack_show_promotions', true ),
'isAtomicSite' => jetpack_is_atomic_site(),
- 'plan' => Jetpack::get_active_plan(),
+ 'plan' => Jetpack_Plan::get(),
'showBackups' => Jetpack::show_backups_ui(),
),
'themeData' => array(
diff --git a/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-settings-page.php b/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-settings-page.php
index 13854cc7..35369ada 100644
--- a/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-settings-page.php
+++ b/plugins/jetpack/_inc/lib/admin-pages/class.jetpack-settings-page.php
@@ -29,7 +29,7 @@ class Jetpack_Settings_Page extends Jetpack_Admin_Page {
// We have static.html so let's continue trying to fetch the others
$noscript_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-noscript-notice.html' );
- $version_notice = $rest_api_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-version-notice.html' );
+ $rest_api_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-version-notice.html' );
$ie_notice = @file_get_contents( JETPACK__PLUGIN_DIR . '_inc/build/static-ie-notice.html' );
$noscript_notice = str_replace(
@@ -43,17 +43,6 @@ class Jetpack_Settings_Page extends Jetpack_Admin_Page {
$noscript_notice
);
- $version_notice = str_replace(
- '#HEADER_TEXT#',
- esc_html__( 'You are using an outdated version of WordPress', 'jetpack' ),
- $version_notice
- );
- $version_notice = str_replace(
- '#TEXT#',
- esc_html__( "Update WordPress to unlock Jetpack's full potential!", 'jetpack' ),
- $version_notice
- );
-
$rest_api_notice = str_replace(
'#HEADER_TEXT#',
esc_html( __( 'WordPress REST API is disabled', 'jetpack' ) ),
@@ -76,9 +65,6 @@ class Jetpack_Settings_Page extends Jetpack_Admin_Page {
$ie_notice
);
- if ( $this->is_wp_version_too_old() ) {
- echo $version_notice;
- }
if ( ! $this->is_rest_api_enabled() ) {
echo $rest_api_notice;
}