Skip to content

Commit

Permalink
New build
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve committed Apr 28, 2020
1 parent f9f6889 commit 4a48349
Show file tree
Hide file tree
Showing 93 changed files with 12,301 additions and 20,269 deletions.
2 changes: 1 addition & 1 deletion _inc/build/admin.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-polyfill'), 'version' => '9fcb3d01bd02b88387f06c5c7063c962');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-polyfill'), 'version' => '2570f08597c6924ae224a472b213716c');
2 changes: 1 addition & 1 deletion _inc/build/admin.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions _inc/build/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/build/admin.rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/build/style.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion _inc/build/style.min.rtl.css

Large diffs are not rendered by default.

61 changes: 27 additions & 34 deletions _inc/jetpack-strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@
__( "Explore our Jetpack plans", "jetpack" ), // _inc/client/plans-prompt/index.jsx:30
__( "Now that you're set up, pick a plan that fits your needs.", "jetpack" ), // _inc/client/plans-prompt/index.jsx:32
__( "Start with free", "jetpack" ), // _inc/client/plans-prompt/index.jsx:48
__( "Setting up", "jetpack" ), // _inc/client/pro-status/index.jsx:79
__( "Action needed", "jetpack" ), // _inc/client/pro-status/index.jsx:84
__( "Connected", "jetpack" ), // _inc/client/pro-status/index.jsx:89
_x( "Threats", "A caption for a small button to fix security issues.", "jetpack" ), // _inc/client/pro-status/index.jsx:105
_x( "See threats", "A caption for a small button to fix security issues.", "jetpack" ), // _inc/client/pro-status/index.jsx:109
_x( "Secure", "Short message informing user that the site is secure.", "jetpack" ), // _inc/client/pro-status/index.jsx:121
__( "ACTIVE", "jetpack" ), // _inc/client/pro-status/index.jsx:135
_x( "Set up", "Caption for a button to set up a feature.", "jetpack" ), // _inc/client/pro-status/index.jsx:171
_x( "privacy", "Search term.", "jetpack" ), // _inc/client/privacy/index.jsx:69
_x( "tracks", "Search term.", "jetpack" ), // _inc/client/privacy/index.jsx:70
_x( "data", "Search term.", "jetpack" ), // _inc/client/privacy/index.jsx:71
Expand All @@ -333,14 +341,6 @@
__( "This information helps us improve our products, make marketing to you more relevant, personalize your WordPress.com experience, and more as detailed in our {{pp}}privacy policy{{/pp}}.", "jetpack" ), // _inc/client/privacy/index.jsx:140
__( "We use other tracking tools, including some from third parties. {{cookiePolicyLink}}Read about these{{/cookiePolicyLink}} and how to control them.", "jetpack" ), // _inc/client/privacy/index.jsx:157
__( "For more information on how specific Jetpack features use data and track activity, please refer to our {{privacyCenterLink}}Privacy Center{{/privacyCenterLink}}.", "jetpack" ), // _inc/client/privacy/index.jsx:175
__( "Setting up", "jetpack" ), // _inc/client/pro-status/index.jsx:79
__( "Action needed", "jetpack" ), // _inc/client/pro-status/index.jsx:84
__( "Connected", "jetpack" ), // _inc/client/pro-status/index.jsx:89
_x( "Threats", "A caption for a small button to fix security issues.", "jetpack" ), // _inc/client/pro-status/index.jsx:105
_x( "See threats", "A caption for a small button to fix security issues.", "jetpack" ), // _inc/client/pro-status/index.jsx:109
_x( "Secure", "Short message informing user that the site is secure.", "jetpack" ), // _inc/client/pro-status/index.jsx:121
__( "ACTIVE", "jetpack" ), // _inc/client/pro-status/index.jsx:135
_x( "Set up", "Caption for a button to set up a feature.", "jetpack" ), // _inc/client/pro-status/index.jsx:171
__( "Activate", "jetpack" ), // _inc/client/searchable-modules/index.jsx:61
__( "Checking your spam protection…", "jetpack" ), // _inc/client/security/antispam.jsx:88
__( "Fetching key…", "jetpack" ), // _inc/client/security/antispam.jsx:92
Expand Down Expand Up @@ -634,23 +634,23 @@
__( "daily backups", "jetpack" ), // _inc/client/components/jetpack-notices/plan-conflict-warning.jsx:64
__( "real-time backups", "jetpack" ), // _inc/client/components/jetpack-notices/plan-conflict-warning.jsx:66
__( "Your %(planName)s Plan includes %(featureName)s. Looks like you also purchased the %(productName)s product. Consider removing %(productName)s.", "jetpack" ), // _inc/client/components/jetpack-notices/plan-conflict-warning.jsx:73
__( "Cheatin' uh?", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:41
__( "{{p}}Would you mind telling us why you did not complete the Jetpack connection in this {{a}}2 question survey{{/a}}?{{/p}}{{p}}A Jetpack connection is required for our free security and traffic features to work.{{/p}}", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:44
__( "You need to stay logged in to your WordPress blog while you authorize Jetpack.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:62
__( "We had an issue connecting Jetpack; deactivate then reactivate the Jetpack plugin, then connect again.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:67
__( "There was an issue connecting your Jetpack. Please click \"Connect to WordPress.com\" again.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:72
__( "Your website needs to be publicly accessible to use Jetpack: %(error_key)s", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:78
__( "This site can't be connected to WordPress.com because it violates our {{a}}Terms of Service{{/a}}.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:88
__( "{{s}}Your Jetpack has a glitch.{{/s}} Connecting this site with WordPress.com is not possible. This usually means your site is not publicly accessible (localhost).", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:104
__( "WordPress.com is currently having problems and is unable to fuel up your Jetpack. Please try again later.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:118
__( "Jetpack could not contact WordPress.com: %(error_key)s. This usually means something is incorrectly configured on your web host.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:124
__( "{{s}}Your Jetpack has a glitch.{{/s}} We're sorry for the inconvenience. Please try again later, if the issue continues please contact support with this message: %(error_key)s", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:164
__( "Welcome to {{s}}Jetpack %(jetpack_version)s{{/s}}!", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:202
__( "Your Jetpack is already connected.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:212
__( "You're fueled up and ready to go, Jetpack is now active.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:216
__( "You're fueled up and ready to go.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:220
__( "Your server is misconfigured, which means that Jetpack Protect is unable to effectively protect your site.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:224
__( "Learn More", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:232
__( "Cheatin' uh?", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:40
__( "{{p}}Would you mind telling us why you did not complete the Jetpack connection in this {{a}}2 question survey{{/a}}?{{/p}}{{p}}A Jetpack connection is required for our free security and traffic features to work.{{/p}}", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:43
__( "You need to stay logged in to your WordPress blog while you authorize Jetpack.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:61
__( "We had an issue connecting Jetpack; deactivate then reactivate the Jetpack plugin, then connect again.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:66
__( "There was an issue connecting your Jetpack. Please click \"Connect to WordPress.com\" again.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:71
__( "Your website needs to be publicly accessible to use Jetpack: %(error_key)s", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:77
__( "This site can't be connected to WordPress.com because it violates our {{a}}Terms of Service{{/a}}.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:87
__( "{{s}}Your Jetpack has a glitch.{{/s}} Connecting this site with WordPress.com is not possible. This usually means your site is not publicly accessible (localhost).", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:103
__( "WordPress.com is currently having problems and is unable to fuel up your Jetpack. Please try again later.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:117
__( "Jetpack could not contact WordPress.com: %(error_key)s. This usually means something is incorrectly configured on your web host.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:123
__( "{{s}}Your Jetpack has a glitch.{{/s}} We're sorry for the inconvenience. Please try again later, if the issue continues please contact support with this message: %(error_key)s", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:163
__( "Welcome to {{s}}Jetpack %(jetpack_version)s{{/s}}!", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:201
__( "Your Jetpack is already connected.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:211
__( "You're fueled up and ready to go, Jetpack is now active.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:215
__( "You're fueled up and ready to go.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:219
__( "Your server is misconfigured, which means that Jetpack Protect is unable to effectively protect your site.", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:223
__( "Learn More", "jetpack" ), // _inc/client/components/jetpack-notices/state-notices.jsx:231
__( "Continue", "jetpack" ), // _inc/client/components/jetpack-termination-dialog/dialog.jsx:161
__( "Disconnect", "jetpack" ), // _inc/client/components/jetpack-termination-dialog/dialog.jsx:165
__( "Disable", "jetpack" ), // _inc/client/components/jetpack-termination-dialog/dialog.jsx:165
Expand Down Expand Up @@ -746,15 +746,8 @@
__( "Learn more", "jetpack" ), // _inc/client/components/support-info/index.jsx:79
__( "Learn more", "jetpack" ), // _inc/client/components/support-info/index.jsx:89
__( "Privacy information", "jetpack" ), // _inc/client/components/support-info/index.jsx:99
__( "The features you rely on, adapted for the new WordPress editor.", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:45
__( "A new editor? Yes! {{a}}Learn more{{/a}}.", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:47
__( "Build your Jetpack site with blocks", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:60
__( "Today, we are introducing the first wave of Jetpack-specific blocks built specifically for the new editor experience: Simple Payment button, Form, Map, and Markdown.", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:63
__( "Jetpack is ready for the new WordPress editor", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:72
__( "Take me to the new editor", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:77
__( "Okay, got it!", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:79
__( "Jetpack is ready for the new WordPress editor", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:93
__( "New in Jetpack!", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:96
/* translators: %(version) is a version number. */
__( "New in Jetpack %(version)s", "jetpack" ), // _inc/client/components/upgrade-notice-content/index.jsx:74
__( "Which backup option is best for me?", "jetpack" ), // _inc/client/plans/single-product-backup/body.jsx:80
__( "Select a backup option:", "jetpack" ), // _inc/client/plans/single-product-backup/body.jsx:85
__( "Daily Backups", "jetpack" ), // _inc/client/plans/single-product-backup/index.jsx:35
Expand Down
1 change: 1 addition & 0 deletions _inc/lib/admin-pages/class.jetpack-react-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ function get_initial_state() {
'messageCode' => Jetpack::state( 'message' ),
'errorCode' => Jetpack::state( 'error' ),
'errorDescription' => Jetpack::state( 'error_description' ),
'messageContent' => Jetpack::state( 'message_content' ),
),
'tracksUserData' => Jetpack_Tracks_Client::get_connected_user_tracks_identity(),
'currentIp' => function_exists( 'jetpack_protect_get_ip' ) ? jetpack_protect_get_ip() : false,
Expand Down
17 changes: 10 additions & 7 deletions _inc/lib/class.jetpack-photon-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,17 @@ public function reset_to_original() {
* @return string Basename of the filename.
*/
public function get_filename() {
return wp_basename( $this->get_raw_filename() );
}

if ( true === $this->is_resized() ) {
$filename = $this->get_resized_filename();
} else {
$filename = $this->filename;
}

return wp_basename( $filename );
/**
* Return the absolute filename. If the image has been resized, including
* the resizing params for Jetpack CDN.
*
* @return string Filename.
*/
public function get_raw_filename() {
return $this->is_resized() ? $this->get_resized_filename() : $this->filename;
}

/**
Expand Down
133 changes: 123 additions & 10 deletions class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,7 @@ public static function activate_new_modules( $redirect = false ) {
);

self::state( 'message', 'modules_activated' );

self::activate_default_modules( $jetpack_version, JETPACK__VERSION, $reactivate_modules, $redirect );

if ( $redirect ) {
Expand Down Expand Up @@ -3291,14 +3292,124 @@ public static function get_activation_source( $referer_url ) {
/**
* Runs before bumping version numbers up to a new version
*
* @param string $version Version:timestamp
* @param string $old_version Old Version:timestamp or false if not set yet.
* @return null [description]
* @param string $version Version:timestamp.
* @param string $old_version Old Version:timestamp or false if not set yet.
*/
public static function do_version_bump( $version, $old_version ) {
if ( ! $old_version ) { // For new sites
// There used to be stuff here, but this seems like it might be useful to someone in the future...
if ( $old_version ) { // For existing Jetpack installations.
self::send_update_modal_data();
}
}

/**
* Prepares the release post content and image data and saves it in the
* state array. This data is used to create the update modal.
*/
public static function send_update_modal_data() {
$post_data = self::get_release_post_data();

if ( ! isset( $post_data['posts'][0] ) ) {
return;
}

$post = $post_data['posts'][0];

$post_content = isset( $post['content'] ) ? $post['content'] : null;
if ( empty( $post_content ) ) {
return;
}

// This allows us to embed videopress videos into the release post.
add_filter( 'wp_kses_allowed_html', array( __CLASS__, 'allow_post_embed_iframe' ), 10, 2 );
$content = wp_kses_post( $post_content );
remove_filter( 'wp_kses_allowed_html', array( __CLASS__, 'allow_post_embed_iframe' ), 10, 2 );

$post_title = isset( $post['title'] ) ? $post['title'] : null;
$title = wp_kses( $post_title, array() );

$post_thumbnail = isset( $post['post_thumbnail'] ) ? $post['post_thumbnail'] : null;
if ( ! empty( $post_thumbnail ) ) {
jetpack_require_lib( 'class.jetpack-photon-image' );
$photon_image = new Jetpack_Photon_Image(
array(
'file' => jetpack_photon_url( $post_thumbnail['URL'] ),
'width' => $post_thumbnail['width'],
'height' => $post_thumbnail['height'],
),
$post_thumbnail['mime_type']
);
$photon_image->resize(
array(
'width' => 600,
'height' => null,
'crop' => false,
)
);
$post_thumbnail_url = $photon_image->get_raw_filename();
} else {
$post_thumbnail_url = null;
}

$post_array = array(
'release_post_content' => $content,
'release_post_featured_image' => $post_thumbnail_url,
'release_post_title' => $title,
);

self::state( 'message_content', $post_array );
}

/**
* Temporarily allow post content to contain iframes, e.g. for videopress.
*
* @param string $tags The tags.
* @param string $context The context.
*/
public static function allow_post_embed_iframe( $tags, $context ) {
if ( 'post' === $context ) {
$tags['iframe'] = array(
'src' => true,
'height' => true,
'width' => true,
'frameborder' => true,
'allowfullscreen' => true,
);
}

return $tags;
}

/**
* Obtains the release post from the Jetpack release post blog. A release post will be displayed in the
* update modal when a post has a tag equal to the Jetpack version number.
*
* The response parameters for the post array can be found here:
* https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/posts/%24post_ID/#apidoc-response
*
* @return array|null Returns an associative array containing the release post data at index ['posts'][0].
* Returns null if the release post data is not available.
*/
private static function get_release_post_data() {
if ( Constants::is_defined( 'TESTING_IN_JETPACK' ) && Constants::get_constant( 'TESTING_IN_JETPACK' ) ) {
return null;
}

$release_post_src = add_query_arg(
array(
'order_by' => 'date',
'tag' => JETPACK__VERSION,
'number' => '1',
),
'https://public-api.wordpress.com/rest/v1/sites/' . JETPACK__RELEASE_POST_BLOG_SLUG . '/posts'
);

$response = wp_remote_get( $release_post_src );

if ( ! is_array( $response ) ) {
return null;
}

return json_decode( wp_remote_retrieve_body( $response ), true );
}

/**
Expand Down Expand Up @@ -5732,7 +5843,7 @@ public static function state( $key = null, $value = null, $restate = false ) {

// Extract state from cookies and delete cookies
if ( isset( $_COOKIE['jetpackState'] ) && is_array( $_COOKIE['jetpackState'] ) ) {
$yum = $_COOKIE['jetpackState'];
$yum = wp_unslash( $_COOKIE['jetpackState'] );
unset( $_COOKIE['jetpackState'] );
foreach ( $yum as $k => $v ) {
if ( strlen( $v ) ) {
Expand All @@ -5744,26 +5855,28 @@ public static function state( $key = null, $value = null, $restate = false ) {

if ( $restate ) {
foreach ( $state as $k => $v ) {
setcookie( "jetpackState[$k]", $v, 0, $path, $domain );
if ( 'message_content' !== $k ) {
setcookie( "jetpackState[$k]", $v, 0, $path, $domain );
}
}
return;
}

// Get a state variable
// Get a state variable.
if ( isset( $key ) && ! isset( $value ) ) {
if ( array_key_exists( $key, $state ) ) {
return $state[ $key ];
}
return null;
}

// Set a state variable
// Set a state variable.
if ( isset( $key ) && isset( $value ) ) {
if ( is_array( $value ) && isset( $value[0] ) ) {
$value = $value[0];
}
$state[ $key ] = $value;
if ( ! headers_sent() ) {
if ( 'message_content' !== $key && ! headers_sent() ) {
setcookie( "jetpackState[$key]", $value, 0, $path, $domain );
}
}
Expand Down
Loading

0 comments on commit 4a48349

Please sign in to comment.