summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules')
-rw-r--r--plugins/jetpack/modules/.eslintrc.js40
-rw-r--r--plugins/jetpack/modules/blocks.php6
-rw-r--r--plugins/jetpack/modules/calypsoify/README.md2
-rw-r--r--plugins/jetpack/modules/calypsoify/class.jetpack-calypsoify.php77
-rw-r--r--plugins/jetpack/modules/calypsoify/gutenberg-styles/button.scss38
-rw-r--r--plugins/jetpack/modules/calypsoify/style-gutenberg-rtl.min.css2
-rw-r--r--plugins/jetpack/modules/calypsoify/style-gutenberg.min.css2
-rw-r--r--plugins/jetpack/modules/calypsoify/style-rtl.min.css2
-rw-r--r--plugins/jetpack/modules/calypsoify/style.min.css2
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css2
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.css4
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.js16
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.php12
-rw-r--r--plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css4
-rw-r--r--plugins/jetpack/modules/comment-likes.php13
-rw-r--r--plugins/jetpack/modules/comments.php2
-rw-r--r--plugins/jetpack/modules/comments/base.php12
-rw-r--r--plugins/jetpack/modules/comments/comments.php42
-rw-r--r--plugins/jetpack/modules/contact-form/admin.php7
-rw-r--r--plugins/jetpack/modules/contact-form/css/grunion-rtl.css2
-rw-r--r--plugins/jetpack/modules/contact-form/css/grunion.css57
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-contact-form.php186
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-editor-view.php8
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-form-view.php7
-rw-r--r--plugins/jetpack/modules/contact-form/js/grunion.js3
-rw-r--r--plugins/jetpack/modules/copy-post.php3
-rw-r--r--plugins/jetpack/modules/custom-content-types.php2
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php162
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_ctype.php4
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php38
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php6
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css4
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/cssparse.css4
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/data.inc.php2
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/lang.inc.php12
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css-4.7.php14
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css.php14
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.css1
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css2
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css2
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css7
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/js/css-editor.js1
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/js/use-codemirror.js2
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php23
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/preprocessors/scss.inc.php8
-rw-r--r--plugins/jetpack/modules/custom-post-types/comics.php14
-rw-r--r--plugins/jetpack/modules/custom-post-types/comics/comics.js1
-rw-r--r--plugins/jetpack/modules/custom-post-types/js/many-items.js2
-rw-r--r--plugins/jetpack/modules/custom-post-types/js/menu-checkboxes.js2
-rw-r--r--plugins/jetpack/modules/custom-post-types/js/nova-drag-drop.js1
-rw-r--r--plugins/jetpack/modules/custom-post-types/nova.php12
-rw-r--r--plugins/jetpack/modules/custom-post-types/portfolios.php4
-rw-r--r--plugins/jetpack/modules/custom-post-types/testimonial.php4
-rw-r--r--plugins/jetpack/modules/debug.php6
-rw-r--r--plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php4
-rw-r--r--plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php14
-rw-r--r--plugins/jetpack/modules/google-analytics/wp-google-analytics.php2
-rw-r--r--plugins/jetpack/modules/gplus-authorship.php6
-rw-r--r--plugins/jetpack/modules/holiday-snow.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll.php2
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.js84
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.php13
-rw-r--r--plugins/jetpack/modules/latex.php2
-rw-r--r--plugins/jetpack/modules/lazy-images.php3
-rw-r--r--plugins/jetpack/modules/lazy-images/js/lazy-images.js4
-rw-r--r--plugins/jetpack/modules/lazy-images/lazy-images.php4
-rw-r--r--plugins/jetpack/modules/likes.php16
-rw-r--r--plugins/jetpack/modules/likes/jetpack-likes-settings.php5
-rw-r--r--plugins/jetpack/modules/likes/post-count.js2
-rw-r--r--plugins/jetpack/modules/manage.php4
-rw-r--r--plugins/jetpack/modules/manage/activate-admin.php4
-rw-r--r--plugins/jetpack/modules/manage/confirm-admin.php4
-rw-r--r--plugins/jetpack/modules/markdown/easy-markdown.php8
-rw-r--r--plugins/jetpack/modules/masterbar.php12
-rw-r--r--plugins/jetpack/modules/masterbar/masterbar.php909
-rw-r--r--plugins/jetpack/modules/masterbar/overrides.css71
-rw-r--r--plugins/jetpack/modules/masterbar/tracks-events.js49
-rw-r--r--plugins/jetpack/modules/memberships/class-jetpack-memberships.php107
-rw-r--r--plugins/jetpack/modules/minileven/minileven.php21
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php19
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php6
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/index.php2
-rw-r--r--plugins/jetpack/modules/module-headings.php27
-rw-r--r--plugins/jetpack/modules/module-info.php21
-rw-r--r--plugins/jetpack/modules/monitor.php9
-rw-r--r--plugins/jetpack/modules/notes.php35
-rw-r--r--plugins/jetpack/modules/omnisearch.php6
-rw-r--r--plugins/jetpack/modules/photon-cdn.php2
-rw-r--r--plugins/jetpack/modules/photon-cdn/jetpack-manifest.php801
-rw-r--r--plugins/jetpack/modules/photon.php3
-rw-r--r--plugins/jetpack/modules/photon/photon.js40
-rw-r--r--plugins/jetpack/modules/plugin-search.php18
-rw-r--r--plugins/jetpack/modules/post-by-email.php5
-rw-r--r--plugins/jetpack/modules/protect.php102
-rw-r--r--plugins/jetpack/modules/protect/blocked-login-page.php5
-rw-r--r--plugins/jetpack/modules/protect/shared-functions.php6
-rw-r--r--plugins/jetpack/modules/publicize/publicize-jetpack.php6
-rw-r--r--plugins/jetpack/modules/publicize/publicize.php8
-rw-r--r--plugins/jetpack/modules/pwa.php40
-rw-r--r--plugins/jetpack/modules/pwa/class.jetpack-pwa-helpers.php64
-rw-r--r--plugins/jetpack/modules/pwa/class.jetpack-pwa-manifest.php97
-rw-r--r--plugins/jetpack/modules/random-redirect.php6
-rw-r--r--plugins/jetpack/modules/related-posts/class.related-posts-customize.php6
-rw-r--r--plugins/jetpack/modules/related-posts/jetpack-related-posts.php153
-rw-r--r--plugins/jetpack/modules/related-posts/related-posts-rtl.css2
-rw-r--r--plugins/jetpack/modules/related-posts/related-posts.css1
-rw-r--r--plugins/jetpack/modules/related-posts/related-posts.js8
-rw-r--r--plugins/jetpack/modules/search/class.jetpack-search-helpers.php6
-rw-r--r--plugins/jetpack/modules/search/class.jetpack-search.php513
-rw-r--r--plugins/jetpack/modules/seo-tools/jetpack-seo-posts.php28
-rw-r--r--plugins/jetpack/modules/seo-tools/jetpack-seo-titles.php4
-rw-r--r--plugins/jetpack/modules/sharedaddy.php4
-rw-r--r--plugins/jetpack/modules/sharedaddy/admin-sharing.js1
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharedaddy.php6
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-service.php86
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-sources.php10
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.css4
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.js1
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.php8
-rw-r--r--plugins/jetpack/modules/shortcodes.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/archiveorg-book.php8
-rw-r--r--plugins/jetpack/modules/shortcodes/archiveorg.php6
-rw-r--r--plugins/jetpack/modules/shortcodes/brightcove.php6
-rw-r--r--plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php19
-rw-r--r--plugins/jetpack/modules/shortcodes/crowdsignal.php1144
-rw-r--r--plugins/jetpack/modules/shortcodes/dailymotion.php15
-rw-r--r--plugins/jetpack/modules/shortcodes/facebook.php14
-rw-r--r--plugins/jetpack/modules/shortcodes/flickr.php20
-rw-r--r--plugins/jetpack/modules/shortcodes/getty.php1
-rw-r--r--plugins/jetpack/modules/shortcodes/gist.php39
-rw-r--r--plugins/jetpack/modules/shortcodes/googlemaps.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/gravatar.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/instagram.php27
-rw-r--r--plugins/jetpack/modules/shortcodes/js/gist.js9
-rw-r--r--plugins/jetpack/modules/shortcodes/js/jmpress.js2
-rw-r--r--plugins/jetpack/modules/shortcodes/js/recipes-printthis.js2
-rw-r--r--plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js1
-rw-r--r--plugins/jetpack/modules/shortcodes/medium.php80
-rw-r--r--plugins/jetpack/modules/shortcodes/mixcloud.php27
-rw-r--r--plugins/jetpack/modules/shortcodes/pinterest.php28
-rw-r--r--plugins/jetpack/modules/shortcodes/polldaddy.php4
-rw-r--r--plugins/jetpack/modules/shortcodes/presentations.php321
-rw-r--r--plugins/jetpack/modules/shortcodes/quiz.php5
-rw-r--r--plugins/jetpack/modules/shortcodes/recipe.php361
-rw-r--r--plugins/jetpack/modules/shortcodes/scribd.php46
-rw-r--r--plugins/jetpack/modules/shortcodes/slideshare.php64
-rw-r--r--plugins/jetpack/modules/shortcodes/slideshow.php171
-rw-r--r--plugins/jetpack/modules/shortcodes/soundcloud.php337
-rw-r--r--plugins/jetpack/modules/shortcodes/ted.php38
-rw-r--r--plugins/jetpack/modules/shortcodes/tweet.php17
-rw-r--r--plugins/jetpack/modules/shortcodes/twitchtv.php21
-rw-r--r--plugins/jetpack/modules/shortcodes/twitter-timeline.php24
-rw-r--r--plugins/jetpack/modules/shortcodes/untappd-menu.php22
-rw-r--r--plugins/jetpack/modules/shortcodes/upcoming-events.php21
-rw-r--r--plugins/jetpack/modules/shortcodes/videopress.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/vimeo.php248
-rw-r--r--plugins/jetpack/modules/shortcodes/vine.php53
-rw-r--r--plugins/jetpack/modules/shortcodes/wordads.php26
-rw-r--r--plugins/jetpack/modules/shortcodes/wufoo.php112
-rw-r--r--plugins/jetpack/modules/shortcodes/youtube.php399
-rw-r--r--plugins/jetpack/modules/simple-payments/paypal-express-checkout.js4
-rw-r--r--plugins/jetpack/modules/simple-payments/simple-payments.php67
-rw-r--r--plugins/jetpack/modules/site-icon.php6
-rw-r--r--plugins/jetpack/modules/sitemaps/sitemap-builder.php12
-rw-r--r--plugins/jetpack/modules/sitemaps/sitemap-constants.php22
-rw-r--r--plugins/jetpack/modules/sitemaps/sitemap-stylist.php26
-rw-r--r--plugins/jetpack/modules/sitemaps/sitemaps.php40
-rw-r--r--plugins/jetpack/modules/social-links.php6
-rw-r--r--plugins/jetpack/modules/sso.php45
-rw-r--r--plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php2
-rw-r--r--plugins/jetpack/modules/sso/jetpack-sso-login.js2
-rw-r--r--plugins/jetpack/modules/stats.php108
-rw-r--r--plugins/jetpack/modules/subscriptions.php5
-rw-r--r--plugins/jetpack/modules/subscriptions/views.php6
-rw-r--r--plugins/jetpack/modules/theme-tools.php18
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentynineteen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentysixteen.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css1
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentytwenty.css232
-rw-r--r--plugins/jetpack/modules/theme-tools/compat/twentytwenty.php132
-rw-r--r--plugins/jetpack/modules/theme-tools/featured-content.php6
-rw-r--r--plugins/jetpack/modules/theme-tools/random-redirect.php6
-rw-r--r--plugins/jetpack/modules/theme-tools/responsive-videos.php10
-rw-r--r--plugins/jetpack/modules/theme-tools/site-logo.php2
-rw-r--r--plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.css39
-rw-r--r--plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css2
-rw-r--r--plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control.min.css3
-rw-r--r--plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo-control.php23
-rw-r--r--plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg2
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery.php7
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css2
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css7
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js2
-rw-r--r--plugins/jetpack/modules/tonesque.php6
-rw-r--r--plugins/jetpack/modules/verification-tools/blog-verification-tools.php2
-rw-r--r--plugins/jetpack/modules/videopress/class.jetpack-videopress.php24
-rw-r--r--plugins/jetpack/modules/videopress/class.videopress-ajax.php4
-rw-r--r--plugins/jetpack/modules/videopress/class.videopress-edit-attachment.php7
-rw-r--r--plugins/jetpack/modules/videopress/class.videopress-gutenberg.php27
-rw-r--r--plugins/jetpack/modules/videopress/class.videopress-player.php22
-rw-r--r--plugins/jetpack/modules/videopress/class.videopress-video.php7
-rw-r--r--plugins/jetpack/modules/videopress/editor-media-view.php6
-rw-r--r--plugins/jetpack/modules/videopress/js/gutenberg-video-upload.js63
-rw-r--r--plugins/jetpack/modules/videopress/shortcode.php6
-rw-r--r--plugins/jetpack/modules/videopress/utility-functions.php6
-rw-r--r--plugins/jetpack/modules/widget-visibility/widget-conditions.php7
-rw-r--r--plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js6
-rw-r--r--plugins/jetpack/modules/widgets/authors.php41
-rw-r--r--plugins/jetpack/modules/widgets/contact-info.php298
-rw-r--r--plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js48
-rw-r--r--plugins/jetpack/modules/widgets/contact-info/contact-info-map.css9
-rw-r--r--plugins/jetpack/modules/widgets/eu-cookie-law.php6
-rw-r--r--plugins/jetpack/modules/widgets/facebook-likebox.php6
-rw-r--r--plugins/jetpack/modules/widgets/flickr.php14
-rw-r--r--plugins/jetpack/modules/widgets/flickr/form.php12
-rw-r--r--plugins/jetpack/modules/widgets/gallery.php8
-rw-r--r--plugins/jetpack/modules/widgets/gallery/js/admin.js1
-rw-r--r--plugins/jetpack/modules/widgets/goodreads.php2
-rw-r--r--plugins/jetpack/modules/widgets/google-translate.php9
-rw-r--r--plugins/jetpack/modules/widgets/gravatar-profile.php2
-rw-r--r--plugins/jetpack/modules/widgets/image-widget.php6
-rw-r--r--plugins/jetpack/modules/widgets/milestone/milestone.php10
-rw-r--r--plugins/jetpack/modules/widgets/search.php14
-rw-r--r--plugins/jetpack/modules/widgets/simple-payments.php19
-rw-r--r--plugins/jetpack/modules/widgets/social-icons.php279
-rw-r--r--plugins/jetpack/modules/widgets/social-media-icons.php2
-rw-r--r--plugins/jetpack/modules/widgets/top-posts.php58
-rw-r--r--plugins/jetpack/modules/widgets/twitter-timeline.php4
-rw-r--r--plugins/jetpack/modules/widgets/wordpress-post-widget.php2
-rw-r--r--plugins/jetpack/modules/widgets/wordpress-post-widget/class.jetpack-display-posts-widget.php4
-rw-r--r--plugins/jetpack/modules/widgets/wordpress-post-widget/style.css9
-rw-r--r--plugins/jetpack/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php18
-rw-r--r--plugins/jetpack/modules/wordads/php/api.php9
-rw-r--r--plugins/jetpack/modules/wordads/php/params.php6
-rw-r--r--plugins/jetpack/modules/wordads/wordads.php153
-rw-r--r--plugins/jetpack/modules/wpcc.php6
-rw-r--r--plugins/jetpack/modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php91
239 files changed, 6747 insertions, 3625 deletions
diff --git a/plugins/jetpack/modules/.eslintrc.js b/plugins/jetpack/modules/.eslintrc.js
new file mode 100644
index 00000000..527bbeab
--- /dev/null
+++ b/plugins/jetpack/modules/.eslintrc.js
@@ -0,0 +1,40 @@
+module.exports = {
+ plugins: [ 'es5' ],
+ extends: [ 'eslint:recommended', 'plugin:es5/no-es2015' ],
+ env: {
+ browser: true,
+ jquery: true,
+ },
+ globals: {
+ _: false,
+ Backbone: false,
+ // jQuery: false,
+ wp: false,
+ },
+ parserOptions: {
+ ecmaVersion: 5,
+ },
+ rules: {
+ // TODO: maybe fix the above warnings
+ eqeqeq: 'warn',
+ curly: 'warn',
+ 'no-console': 'warn',
+ 'no-empty': 'warn',
+ 'no-unused-vars': 'warn',
+ 'es5/no-es6-methods': 0, // TODO: maybe disable it on line/file basis
+ 'no-useless-escape': 0,
+ 'no-control-regex': 0,
+ 'no-unused-expressions': 'warn',
+
+ 'es5/no-block-scoping': [ 'error' ],
+ 'no-caller': 'error',
+ 'no-cond-assign': [ 'error', 'except-parens' ],
+ 'no-eq-null': 'error',
+ 'no-irregular-whitespace': 'error',
+ 'no-trailing-spaces': 'error',
+ 'no-undef': 'error',
+ // 'one-var': [ 'error', 'always' ],
+ quotes: [ 'warn', 'single', { avoidEscape: true } ],
+ 'wrap-iife': [ 'error', 'any' ],
+ },
+};
diff --git a/plugins/jetpack/modules/blocks.php b/plugins/jetpack/modules/blocks.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/blocks.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/calypsoify/README.md b/plugins/jetpack/modules/calypsoify/README.md
index 4ce1273d..4b41c06a 100644
--- a/plugins/jetpack/modules/calypsoify/README.md
+++ b/plugins/jetpack/modules/calypsoify/README.md
@@ -1,4 +1,4 @@
# calypsoify
WordPress plugin for redesigning WP-Admin plugin screens to match Calypso.
-![](https://cldup.com/jxE-hrHGgj.png)
+![](https://cldup.com/awmrHOWz7t.png)
diff --git a/plugins/jetpack/modules/calypsoify/class.jetpack-calypsoify.php b/plugins/jetpack/modules/calypsoify/class.jetpack-calypsoify.php
index 49c44f42..eb0874da 100644
--- a/plugins/jetpack/modules/calypsoify/class.jetpack-calypsoify.php
+++ b/plugins/jetpack/modules/calypsoify/class.jetpack-calypsoify.php
@@ -37,6 +37,8 @@ class Jetpack_Calypsoify {
if ( $this->is_calypsoify_enabled ) {
add_action( 'admin_init', array( $this, 'setup_admin' ), 6 );
+ add_action( 'admin_menu', array( $this, 'remove_core_menus' ), 100 );
+ add_action( 'admin_menu', array( $this, 'add_custom_menus' ), 101 );
}
// Make this always available -- in case calypsoify gets toggled off.
@@ -56,8 +58,6 @@ class Jetpack_Calypsoify {
}
add_action( 'admin_init', array( $this, 'check_page' ) );
- add_action( 'admin_menu', array( $this, 'remove_core_menus' ), 100 );
- add_action( 'admin_menu', array( $this, 'add_plugin_menus' ), 101 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ), 100 );
add_action( 'in_admin_header', array( $this, 'insert_sidebar_html' ) );
add_action( 'wp_before_admin_bar_render', array( $this, 'modify_masterbar' ), 100000 );
@@ -68,6 +68,8 @@ class Jetpack_Calypsoify {
add_action( 'manage_plugins_custom_column', array( $this, 'manage_plugins_custom_column' ), 10, 2 );
add_filter( 'bulk_actions-plugins', array( $this, 'bulk_actions_plugins' ) );
+ add_action( 'current_screen', array( $this, 'attach_views_filter' ) );
+
if ( 'plugins.php' === basename( $_SERVER['PHP_SELF'] ) ) {
add_action( 'admin_notices', array( $this, 'plugins_admin_notices' ) );
}
@@ -202,10 +204,10 @@ class Jetpack_Calypsoify {
}
public function remove_core_menus() {
+ remove_menu_page( 'edit.php?post_type=feedback' );
remove_menu_page( 'index.php' );
remove_menu_page( 'jetpack' );
remove_menu_page( 'edit.php' );
- remove_menu_page( 'edit.php?post_type=feedback' );
remove_menu_page( 'upload.php' );
remove_menu_page( 'edit.php?post_type=page' );
remove_menu_page( 'edit-comments.php' );
@@ -226,21 +228,27 @@ class Jetpack_Calypsoify {
remove_submenu_page( 'options-general.php', 'sharing' );
}
- public function add_plugin_menus() {
+ public function add_custom_menus() {
global $menu, $submenu;
- add_menu_page( __( 'Manage Plugins', 'jetpack' ), __( 'Manage Plugins', 'jetpack' ), 'activate_plugins', 'plugins.php', '', $this->installed_plugins_icon(), 1 );
-
- // // Count the settings page submenus, if it's zero then don't show this.
- if ( empty( $submenu['options-general.php'] ) ) {
+ if ( isset( $_GET['post_type'] ) && 'feedback' === $_GET['post_type'] ) {
+ // there is currently no gridicon for feedback, so using dashicon.
+ add_menu_page( __( 'Feedback', 'jetpack' ), __( 'Feedback', 'jetpack' ), 'edit_pages', 'edit.php?post_type=feedback', '', 'dashicons-feedback', 1 );
remove_menu_page( 'options-general.php' );
+ remove_submenu_page( 'edit.php?post_type=feedback', 'feedback-export' );
} else {
- // Rename and make sure the plugin settings menu is always last.
- // Sneaky plugins seem to override this otherwise.
- // Settings is always key 80.
- $menu[80][0] = __( 'Plugin Settings', 'jetpack' );
- $menu[ max( array_keys( $menu ) ) + 1 ] = $menu[80];
- unset( $menu[80] );
+ add_menu_page( __( 'Manage Plugins', 'jetpack' ), __( 'Manage Plugins', 'jetpack' ), 'activate_plugins', 'plugins.php', '', $this->installed_plugins_icon(), 1 );
+ // Count the settings page submenus, if it's zero then don't show this.
+ if ( empty( $submenu['options-general.php'] ) ) {
+ remove_menu_page( 'options-general.php' );
+ } else {
+ // Rename and make sure the plugin settings menu is always last.
+ // Sneaky plugins seem to override this otherwise.
+ // Settings is always key 80.
+ $menu[80][0] = __( 'Plugin Settings', 'jetpack' );
+ $menu[ max( array_keys( $menu ) ) + 1 ] = $menu[80];
+ unset( $menu[80] );
+ }
}
}
@@ -269,17 +277,20 @@ class Jetpack_Calypsoify {
'calypsoifyGutenberg',
array(
'closeUrl' => $this->get_close_gutenberg_url(),
+ 'manageReusableBlocksUrl' => $this->get_calypso_origin() . '/types/wp_block' . $this->get_site_suffix(),
)
);
}
- public function insert_sidebar_html() { ?>
+ public function insert_sidebar_html() {
+ $heading = ( isset( $_GET['post_type'] ) && 'feedback' === $_GET['post_type'] ) ? __( 'Feedback', 'jetpack' ) : __( 'Plugins', 'jetpack' );
+ ?>
<a href="<?php echo esc_url( 'https://wordpress.com/stats/day/' . Jetpack::build_raw_urls( home_url() ) ); ?>" id="calypso-sidebar-header">
<svg class="gridicon gridicons-chevron-left" height="24" width="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g><path d="M14 20l-8-8 8-8 1.414 1.414L8.828 12l6.586 6.586"></path></g></svg>
<ul>
<li id="calypso-sitename"><?php bloginfo( 'name' ); ?></li>
- <li id="calypso-plugins"><?php esc_html_e( 'Plugins' ); ?></li>
+ <li id="calypso-plugins"><?php echo esc_html( $heading ); ?></li>
</ul>
</a>
<?php
@@ -323,6 +334,19 @@ class Jetpack_Calypsoify {
'https://wordpress.com',
);
return in_array( $origin, $whitelist ) ? $origin : 'https://wordpress.com';
+
+ function get_site_suffix() {
+ if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'build_raw_urls' ) ) {
+ $site_suffix = Jetpack::build_raw_urls( home_url() );
+ } elseif ( class_exists( 'WPCOM_Masterbar' ) && method_exists( 'WPCOM_Masterbar', 'get_calypso_site_slug' ) ) {
+ $site_suffix = WPCOM_Masterbar::get_calypso_site_slug( get_current_blog_id() );
+ }
+
+ if ( $site_suffix ) {
+ return "/${site_suffix}";
+ }
+ return '';
+ }
}
/**
@@ -457,6 +481,27 @@ class Jetpack_Calypsoify {
return false;
}
+
+ /**
+ * Attach a WP_List_Table views filter to all screens.
+ */
+ public function attach_views_filter( $current_screen ) {
+ add_filter( "views_{$current_screen->id}", array( $this, 'filter_views' ) );
+ }
+
+ /**
+ * Remove the parentheses from list table view counts when Calypsofied.
+ *
+ * @param array $views Array of views. See: WP_List_Table::get_views().
+ * @return array Filtered views.
+ */
+ public function filter_views( $views ) {
+ foreach ( $views as $id => $view ) {
+ $views[ $id ] = preg_replace( '/<span class="count">\((\d+)\)<\/span>/', '<span class="count">$1</span>', $view );
+ }
+
+ return $views;
+ }
}
$Jetpack_Calypsoify = Jetpack_Calypsoify::getInstance();
diff --git a/plugins/jetpack/modules/calypsoify/gutenberg-styles/button.scss b/plugins/jetpack/modules/calypsoify/gutenberg-styles/button.scss
index 38c256e8..fe7701cb 100644
--- a/plugins/jetpack/modules/calypsoify/gutenberg-styles/button.scss
+++ b/plugins/jetpack/modules/calypsoify/gutenberg-styles/button.scss
@@ -1,37 +1,37 @@
.components-button {
&.is-default {
- color: $muriel-gray-700;
- border-color: $muriel-gray-100;
+ color: $studio-gray-70;
+ border-color: $studio-gray-10;
background: $white;
box-shadow: none;
border-width: 1px 1px 2px;
&:hover {
background: $white;
- border-color: $muriel-gray-200;
+ border-color: $studio-gray-20;
box-shadow: none;
- color: $muriel-gray-700;
+ color: $studio-gray-70;
}
&:focus:enabled {
background: $white;
- color: $muriel-gray-700;
+ color: $studio-gray-70;
border-color: $color-primary;
box-shadow: 0 0 0 2px $color-primary-light;
}
&:active:enabled {
background: $white;
- border-color: $muriel-gray-100;
+ border-color: $studio-gray-10;
border-width: 2px 1px 1px;
box-shadow: none;
}
&:disabled,
&[aria-disabled='true'] {
- color: $muriel-gray-50;
+ color: $studio-gray-50;
background-color: $white;
- border-color: $muriel-gray-50;
+ border-color: $studio-gray-50;
text-shadow: none;
}
}
@@ -44,7 +44,7 @@
text-shadow: none;
&:focus:enabled {
- background: $muriel-hot-pink-400;
+ background: $studio-pink-40;
border-color: $color-accent;
color: $white;
box-shadow: 0 0 0 2px $color-accent-light;
@@ -52,7 +52,7 @@
&:hover {
box-shadow: none;
- background: $muriel-hot-pink-400;
+ background: $studio-pink-40;
border-color: $color-accent-dark;
color: $white;
}
@@ -62,24 +62,24 @@
}
&:active:enabled {
- background: $muriel-hot-pink-400;
+ background: $studio-pink-40;
border-color: $color-accent-dark;
box-shadow: inset 0 1px 0 $color-accent-dark;
}
&:disabled,
&[aria-disabled='true'] {
- color: $muriel-gray-50;
+ color: $studio-gray-50;
background: $white;
- border-color: $muriel-gray-50;
+ border-color: $studio-gray-50;
text-shadow: none;
&:hover,
&:focus,
&:active {
- color: $muriel-gray-50;
+ color: $studio-gray-50;
background-color: $white;
- border-color: $muriel-gray-50;
+ border-color: $studio-gray-50;
box-shadow: none;
}
}
@@ -90,8 +90,8 @@
background-image: linear-gradient(
-45deg,
$color-accent 28%,
- $muriel-hot-pink-600 28%,
- $muriel-hot-pink-600 72%,
+ $studio-pink-60 28%,
+ $studio-pink-60 72%,
$color-accent 72%
);
border-color: $color-accent-dark;
@@ -125,10 +125,10 @@
&.is-busy {
background-image: repeating-linear-gradient(
-45deg,
- $muriel-gray-500,
+ $studio-gray-50,
$white 11px,
$white 10px,
- $muriel-gray-500 20px
+ $studio-gray-50 20px
);
}
diff --git a/plugins/jetpack/modules/calypsoify/style-gutenberg-rtl.min.css b/plugins/jetpack/modules/calypsoify/style-gutenberg-rtl.min.css
index 002de0ee..df50e909 100644
--- a/plugins/jetpack/modules/calypsoify/style-gutenberg-rtl.min.css
+++ b/plugins/jetpack/modules/calypsoify/style-gutenberg-rtl.min.css
@@ -1,4 +1,4 @@
/* Do not modify this file directly. It is compiled SASS code. */
-.components-button.is-default{color:#3d4145;border-color:#ccced0;background:#fff;box-shadow:none;border-width:1px 1px 2px}.components-button.is-default:hover{background:#fff;border-color:#b0b5b8;box-shadow:none;color:#3d4145}.components-button.is-default:focus:enabled{background:#fff;color:#3d4145;border-color:#016087;box-shadow:0 0 0 2px #6f93ad}.components-button.is-default:active:enabled{background:#fff;border-color:#ccced0;border-width:2px 1px 1px;box-shadow:none}.components-button.is-default:disabled,.components-button.is-default[aria-disabled='true']{color:#e1e2e2;background-color:#fff;border-color:#e1e2e2;text-shadow:none}.components-button.is-primary{background:#d52c82;border-color:#992053;box-shadow:none;color:#fff;text-shadow:none}.components-button.is-primary:focus:enabled{background:#ff3997;border-color:#d52c82;color:#fff;box-shadow:0 0 0 2px #ff76b8}.components-button.is-primary:hover{box-shadow:none;background:#ff3997;border-color:#992053;color:#fff}.components-button.is-primary:focus:enabled{box-shadow:0 0 0 2px #ff76b8}.components-button.is-primary:active:enabled{background:#ff3997;border-color:#992053;box-shadow:inset 0 1px 0 #992053}.components-button.is-primary:disabled,.components-button.is-primary[aria-disabled='true']{color:#e1e2e2;background:#fff;border-color:#e1e2e2;text-shadow:none}.components-button.is-primary:disabled:hover,.components-button.is-primary:disabled:focus,.components-button.is-primary:disabled:active,.components-button.is-primary[aria-disabled='true']:hover,.components-button.is-primary[aria-disabled='true']:focus,.components-button.is-primary[aria-disabled='true']:active{color:#e1e2e2;background-color:#fff;border-color:#e1e2e2;box-shadow:none}.components-button.is-primary.is-busy,.components-button.is-primary.is-busy:disabled,.components-button.is-primary.is-busy[aria-disabled='true']{background-image:linear-gradient(45deg, #d52c82 28%, #b7266a 28%, #b7266a 72%, #d52c82 72%);border-color:#992053}.components-button.is-link{color:#016087}.components-button.is-link:hover,.components-button.is-link:active{color:#23354b}.components-button.is-link:focus{color:#23354b;box-shadow:0 0 0 2px #6f93ad}.components-button.is-link.is-destructive{color:#ff4b1c}.components-button.is-busy{background-image:repeating-linear-gradient(45deg, #636d75, #fff 11px, #fff 10px, #636d75 20px)}.components-button.is-tertiary{color:#016087}.components-button.is-tertiary:not(:disabled):not([aria-disabled='true']):not(.is-default):hover{color:#23354b}.edit-post-more-menu__content .components-menu-group:first-child .components-menu-item__button:last-child{display:none}.editor-inserter__manage-reusable-blocks,a.components-menu-item__button[href*="post_type=wp_block"]{display:none}.edit-post-sidebar__panel-tab.is-active{border-color:#016087}.edit-post-sidebar .input-control:focus,.edit-post-sidebar input[type='checkbox']:focus,.edit-post-sidebar input[type='color']:focus,.edit-post-sidebar input[type='date']:focus,.edit-post-sidebar input[type='datetime-local']:focus,.edit-post-sidebar input[type='datetime']:focus,.edit-post-sidebar input[type='email']:focus,.edit-post-sidebar input[type='month']:focus,.edit-post-sidebar input[type='number']:focus,.edit-post-sidebar input[type='password']:focus,.edit-post-sidebar input[type='radio']:focus,.edit-post-sidebar input[type='search']:focus,.edit-post-sidebar input[type='tel']:focus,.edit-post-sidebar input[type='text']:focus,.edit-post-sidebar input[type='time']:focus,.edit-post-sidebar input[type='url']:focus,.edit-post-sidebar input[type='week']:focus,.edit-post-sidebar select:focus,.edit-post-sidebar textarea:focus{border-color:#016087;box-shadow:0 0 0 2px #6f93ad}.edit-post-sidebar input[type='checkbox']:checked{background:#016087;border-color:#016087}a{color:#016087}a:active,a:hover{color:#23354b}a:focus{color:#23354b;box-shadow:none;outline:thin dotted}.wp-toolbar .revision-php{margin-top:-32px}.revision-php{background:#f6f6f6}.revision-php #wpadminbar,.revision-php #adminmenumain,.revision-php #wp-admin-bar-menu-toggle{display:none}.revision-php #wpcontent{margin-right:0 !important}.revision-php #wpbody{padding-top:0}.revision-php #screen-meta-links{display:none !important}.revision-php #wpfooter{display:none !important}.revision-tickmarks{margin-top:8px}.revisions-controls{height:118px}.revisions-controls .author-card .avatar{border-radius:50%;height:38px;margin-top:4px;width:38px}.revisions-controls .author-card .author-info{line-height:20px;margin-top:4px}.comparing-two-revisions .revisions-controls{height:176px}.revisions-meta{margin-top:28px}.diff-meta{min-height:46px}.revision-toggle-compare-mode label{vertical-align:top}.revisions-tooltip{transform:translateY(-36px)}
+.components-button.is-default{color:#3c434a;border-color:#c3c4c7;background:#fff;box-shadow:none;border-width:1px 1px 2px}.components-button.is-default:hover{background:#fff;border-color:#a7aaad;box-shadow:none;color:#3c434a}.components-button.is-default:focus:enabled{background:#fff;color:#3c434a;border-color:#2271b1;box-shadow:0 0 0 2px #5198d9}.components-button.is-default:active:enabled{background:#fff;border-color:#c3c4c7;border-width:2px 1px 1px;box-shadow:none}.components-button.is-default:disabled,.components-button.is-default[aria-disabled='true']{color:#646970;background-color:#fff;border-color:#646970;text-shadow:none}.components-button.is-primary{background:#c9356e;border-color:#8c1749;box-shadow:none;color:#fff;text-shadow:none}.components-button.is-primary:focus:enabled{background:#e34c84;border-color:#c9356e;color:#fff;box-shadow:0 0 0 2px #eb6594}.components-button.is-primary:hover{box-shadow:none;background:#e34c84;border-color:#8c1749;color:#fff}.components-button.is-primary:focus:enabled{box-shadow:0 0 0 2px #eb6594}.components-button.is-primary:active:enabled{background:#e34c84;border-color:#8c1749;box-shadow:inset 0 1px 0 #8c1749}.components-button.is-primary:disabled,.components-button.is-primary[aria-disabled='true']{color:#646970;background:#fff;border-color:#646970;text-shadow:none}.components-button.is-primary:disabled:hover,.components-button.is-primary:disabled:focus,.components-button.is-primary:disabled:active,.components-button.is-primary[aria-disabled='true']:hover,.components-button.is-primary[aria-disabled='true']:focus,.components-button.is-primary[aria-disabled='true']:active{color:#646970;background-color:#fff;border-color:#646970;box-shadow:none}.components-button.is-primary.is-busy,.components-button.is-primary.is-busy:disabled,.components-button.is-primary.is-busy[aria-disabled='true']{background-image:linear-gradient(45deg, #c9356e 28%, #ab235a 28%, #ab235a 72%, #c9356e 72%);border-color:#8c1749}.components-button.is-link{color:#2271b1}.components-button.is-link:hover,.components-button.is-link:active{color:#0a4b78}.components-button.is-link:focus{color:#0a4b78;box-shadow:0 0 0 2px #5198d9}.components-button.is-link.is-destructive{color:#e65054}.components-button.is-busy{background-image:repeating-linear-gradient(45deg, #646970, #fff 11px, #fff 10px, #646970 20px)}.components-button.is-tertiary{color:#2271b1}.components-button.is-tertiary:not(:disabled):not([aria-disabled='true']):not(.is-default):hover{color:#0a4b78}.edit-post-more-menu__content .components-menu-group:first-child .components-menu-item__button:last-child{display:none}.edit-post-sidebar__panel-tab.is-active{border-color:#2271b1}.edit-post-sidebar .input-control:focus,.edit-post-sidebar input[type='checkbox']:focus,.edit-post-sidebar input[type='color']:focus,.edit-post-sidebar input[type='date']:focus,.edit-post-sidebar input[type='datetime-local']:focus,.edit-post-sidebar input[type='datetime']:focus,.edit-post-sidebar input[type='email']:focus,.edit-post-sidebar input[type='month']:focus,.edit-post-sidebar input[type='number']:focus,.edit-post-sidebar input[type='password']:focus,.edit-post-sidebar input[type='radio']:focus,.edit-post-sidebar input[type='search']:focus,.edit-post-sidebar input[type='tel']:focus,.edit-post-sidebar input[type='text']:focus,.edit-post-sidebar input[type='time']:focus,.edit-post-sidebar input[type='url']:focus,.edit-post-sidebar input[type='week']:focus,.edit-post-sidebar select:focus,.edit-post-sidebar textarea:focus{border-color:#2271b1;box-shadow:0 0 0 2px #5198d9}.edit-post-sidebar input[type='checkbox']:checked{background:#2271b1;border-color:#2271b1}a{color:#2271b1}a:active,a:hover{color:#0a4b78}a:focus{color:#0a4b78;box-shadow:none;outline:thin dotted}.wp-toolbar .revision-php{margin-top:-32px}.revision-php{background:#f6f7f7}.revision-php #wpadminbar,.revision-php #adminmenumain,.revision-php #wp-admin-bar-menu-toggle{display:none}.revision-php #wpcontent{margin-right:0 !important}.revision-php #wpbody{padding-top:0}.revision-php #screen-meta-links{display:none !important}.revision-php #wpfooter{display:none !important}.revision-tickmarks{margin-top:8px}.revisions-controls{height:118px}.revisions-controls .author-card .avatar{border-radius:50%;height:38px;margin-top:4px;width:38px}.revisions-controls .author-card .author-info{line-height:20px;margin-top:4px}.comparing-two-revisions .revisions-controls{height:176px}.revisions-meta{margin-top:28px}.diff-meta{min-height:46px}.revision-toggle-compare-mode label{vertical-align:top}.revisions-tooltip{transform:translateY(-36px)}
/*# sourceMappingURL=style-gutenberg-rtl.min.css.map */
diff --git a/plugins/jetpack/modules/calypsoify/style-gutenberg.min.css b/plugins/jetpack/modules/calypsoify/style-gutenberg.min.css
index cb47e755..82f3f0c4 100644
--- a/plugins/jetpack/modules/calypsoify/style-gutenberg.min.css
+++ b/plugins/jetpack/modules/calypsoify/style-gutenberg.min.css
@@ -1,2 +1,2 @@
/* Do not modify this file directly. It is compiled SASS code. */
-.components-button.is-default{color:#3d4145;border-color:#ccced0;background:#fff;box-shadow:none;border-width:1px 1px 2px}.components-button.is-default:hover{background:#fff;border-color:#b0b5b8;box-shadow:none;color:#3d4145}.components-button.is-default:focus:enabled{background:#fff;color:#3d4145;border-color:#016087;box-shadow:0 0 0 2px #6f93ad}.components-button.is-default:active:enabled{background:#fff;border-color:#ccced0;border-width:2px 1px 1px;box-shadow:none}.components-button.is-default:disabled,.components-button.is-default[aria-disabled='true']{color:#e1e2e2;background-color:#fff;border-color:#e1e2e2;text-shadow:none}.components-button.is-primary{background:#d52c82;border-color:#992053;box-shadow:none;color:#fff;text-shadow:none}.components-button.is-primary:focus:enabled{background:#ff3997;border-color:#d52c82;color:#fff;box-shadow:0 0 0 2px #ff76b8}.components-button.is-primary:hover{box-shadow:none;background:#ff3997;border-color:#992053;color:#fff}.components-button.is-primary:focus:enabled{box-shadow:0 0 0 2px #ff76b8}.components-button.is-primary:active:enabled{background:#ff3997;border-color:#992053;box-shadow:inset 0 1px 0 #992053}.components-button.is-primary:disabled,.components-button.is-primary[aria-disabled='true']{color:#e1e2e2;background:#fff;border-color:#e1e2e2;text-shadow:none}.components-button.is-primary:disabled:hover,.components-button.is-primary:disabled:focus,.components-button.is-primary:disabled:active,.components-button.is-primary[aria-disabled='true']:hover,.components-button.is-primary[aria-disabled='true']:focus,.components-button.is-primary[aria-disabled='true']:active{color:#e1e2e2;background-color:#fff;border-color:#e1e2e2;box-shadow:none}.components-button.is-primary.is-busy,.components-button.is-primary.is-busy:disabled,.components-button.is-primary.is-busy[aria-disabled='true']{background-image:linear-gradient(-45deg, #d52c82 28%, #b7266a 28%, #b7266a 72%, #d52c82 72%);border-color:#992053}.components-button.is-link{color:#016087}.components-button.is-link:hover,.components-button.is-link:active{color:#23354b}.components-button.is-link:focus{color:#23354b;box-shadow:0 0 0 2px #6f93ad}.components-button.is-link.is-destructive{color:#ff4b1c}.components-button.is-busy{background-image:repeating-linear-gradient(-45deg, #636d75, #fff 11px, #fff 10px, #636d75 20px)}.components-button.is-tertiary{color:#016087}.components-button.is-tertiary:not(:disabled):not([aria-disabled='true']):not(.is-default):hover{color:#23354b}.edit-post-more-menu__content .components-menu-group:first-child .components-menu-item__button:last-child{display:none}.editor-inserter__manage-reusable-blocks,a.components-menu-item__button[href*="post_type=wp_block"]{display:none}.edit-post-sidebar__panel-tab.is-active{border-color:#016087}.edit-post-sidebar .input-control:focus,.edit-post-sidebar input[type='checkbox']:focus,.edit-post-sidebar input[type='color']:focus,.edit-post-sidebar input[type='date']:focus,.edit-post-sidebar input[type='datetime-local']:focus,.edit-post-sidebar input[type='datetime']:focus,.edit-post-sidebar input[type='email']:focus,.edit-post-sidebar input[type='month']:focus,.edit-post-sidebar input[type='number']:focus,.edit-post-sidebar input[type='password']:focus,.edit-post-sidebar input[type='radio']:focus,.edit-post-sidebar input[type='search']:focus,.edit-post-sidebar input[type='tel']:focus,.edit-post-sidebar input[type='text']:focus,.edit-post-sidebar input[type='time']:focus,.edit-post-sidebar input[type='url']:focus,.edit-post-sidebar input[type='week']:focus,.edit-post-sidebar select:focus,.edit-post-sidebar textarea:focus{border-color:#016087;box-shadow:0 0 0 2px #6f93ad}.edit-post-sidebar input[type='checkbox']:checked{background:#016087;border-color:#016087}a{color:#016087}a:active,a:hover{color:#23354b}a:focus{color:#23354b;box-shadow:none;outline:thin dotted}.wp-toolbar .revision-php{margin-top:-32px}.revision-php{background:#f6f6f6}.revision-php #wpadminbar,.revision-php #adminmenumain,.revision-php #wp-admin-bar-menu-toggle{display:none}.revision-php #wpcontent{margin-left:0 !important}.revision-php #wpbody{padding-top:0}.revision-php #screen-meta-links{display:none !important}.revision-php #wpfooter{display:none !important}.revision-tickmarks{margin-top:8px}.revisions-controls{height:118px}.revisions-controls .author-card .avatar{border-radius:50%;height:38px;margin-top:4px;width:38px}.revisions-controls .author-card .author-info{line-height:20px;margin-top:4px}.comparing-two-revisions .revisions-controls{height:176px}.revisions-meta{margin-top:28px}.diff-meta{min-height:46px}.revision-toggle-compare-mode label{vertical-align:top}.revisions-tooltip{transform:translateY(-36px)}
+.components-button.is-default{color:#3c434a;border-color:#c3c4c7;background:#fff;box-shadow:none;border-width:1px 1px 2px}.components-button.is-default:hover{background:#fff;border-color:#a7aaad;box-shadow:none;color:#3c434a}.components-button.is-default:focus:enabled{background:#fff;color:#3c434a;border-color:#2271b1;box-shadow:0 0 0 2px #5198d9}.components-button.is-default:active:enabled{background:#fff;border-color:#c3c4c7;border-width:2px 1px 1px;box-shadow:none}.components-button.is-default:disabled,.components-button.is-default[aria-disabled='true']{color:#646970;background-color:#fff;border-color:#646970;text-shadow:none}.components-button.is-primary{background:#c9356e;border-color:#8c1749;box-shadow:none;color:#fff;text-shadow:none}.components-button.is-primary:focus:enabled{background:#e34c84;border-color:#c9356e;color:#fff;box-shadow:0 0 0 2px #eb6594}.components-button.is-primary:hover{box-shadow:none;background:#e34c84;border-color:#8c1749;color:#fff}.components-button.is-primary:focus:enabled{box-shadow:0 0 0 2px #eb6594}.components-button.is-primary:active:enabled{background:#e34c84;border-color:#8c1749;box-shadow:inset 0 1px 0 #8c1749}.components-button.is-primary:disabled,.components-button.is-primary[aria-disabled='true']{color:#646970;background:#fff;border-color:#646970;text-shadow:none}.components-button.is-primary:disabled:hover,.components-button.is-primary:disabled:focus,.components-button.is-primary:disabled:active,.components-button.is-primary[aria-disabled='true']:hover,.components-button.is-primary[aria-disabled='true']:focus,.components-button.is-primary[aria-disabled='true']:active{color:#646970;background-color:#fff;border-color:#646970;box-shadow:none}.components-button.is-primary.is-busy,.components-button.is-primary.is-busy:disabled,.components-button.is-primary.is-busy[aria-disabled='true']{background-image:linear-gradient(-45deg, #c9356e 28%, #ab235a 28%, #ab235a 72%, #c9356e 72%);border-color:#8c1749}.components-button.is-link{color:#2271b1}.components-button.is-link:hover,.components-button.is-link:active{color:#0a4b78}.components-button.is-link:focus{color:#0a4b78;box-shadow:0 0 0 2px #5198d9}.components-button.is-link.is-destructive{color:#e65054}.components-button.is-busy{background-image:repeating-linear-gradient(-45deg, #646970, #fff 11px, #fff 10px, #646970 20px)}.components-button.is-tertiary{color:#2271b1}.components-button.is-tertiary:not(:disabled):not([aria-disabled='true']):not(.is-default):hover{color:#0a4b78}.edit-post-more-menu__content .components-menu-group:first-child .components-menu-item__button:last-child{display:none}.edit-post-sidebar__panel-tab.is-active{border-color:#2271b1}.edit-post-sidebar .input-control:focus,.edit-post-sidebar input[type='checkbox']:focus,.edit-post-sidebar input[type='color']:focus,.edit-post-sidebar input[type='date']:focus,.edit-post-sidebar input[type='datetime-local']:focus,.edit-post-sidebar input[type='datetime']:focus,.edit-post-sidebar input[type='email']:focus,.edit-post-sidebar input[type='month']:focus,.edit-post-sidebar input[type='number']:focus,.edit-post-sidebar input[type='password']:focus,.edit-post-sidebar input[type='radio']:focus,.edit-post-sidebar input[type='search']:focus,.edit-post-sidebar input[type='tel']:focus,.edit-post-sidebar input[type='text']:focus,.edit-post-sidebar input[type='time']:focus,.edit-post-sidebar input[type='url']:focus,.edit-post-sidebar input[type='week']:focus,.edit-post-sidebar select:focus,.edit-post-sidebar textarea:focus{border-color:#2271b1;box-shadow:0 0 0 2px #5198d9}.edit-post-sidebar input[type='checkbox']:checked{background:#2271b1;border-color:#2271b1}a{color:#2271b1}a:active,a:hover{color:#0a4b78}a:focus{color:#0a4b78;box-shadow:none;outline:thin dotted}.wp-toolbar .revision-php{margin-top:-32px}.revision-php{background:#f6f7f7}.revision-php #wpadminbar,.revision-php #adminmenumain,.revision-php #wp-admin-bar-menu-toggle{display:none}.revision-php #wpcontent{margin-left:0 !important}.revision-php #wpbody{padding-top:0}.revision-php #screen-meta-links{display:none !important}.revision-php #wpfooter{display:none !important}.revision-tickmarks{margin-top:8px}.revisions-controls{height:118px}.revisions-controls .author-card .avatar{border-radius:50%;height:38px;margin-top:4px;width:38px}.revisions-controls .author-card .author-info{line-height:20px;margin-top:4px}.comparing-two-revisions .revisions-controls{height:176px}.revisions-meta{margin-top:28px}.diff-meta{min-height:46px}.revision-toggle-compare-mode label{vertical-align:top}.revisions-tooltip{transform:translateY(-36px)}
diff --git a/plugins/jetpack/modules/calypsoify/style-rtl.min.css b/plugins/jetpack/modules/calypsoify/style-rtl.min.css
index 1fdb4250..579a65ec 100644
--- a/plugins/jetpack/modules/calypsoify/style-rtl.min.css
+++ b/plugins/jetpack/modules/calypsoify/style-rtl.min.css
@@ -1,4 +1,4 @@
/* Do not modify this file directly. It is compiled SASS code. */
-body,#wp-content-editor-tools{background:#f6f6f6}#wpwrap{top:14px}#wp-admin-bar-notes #wpnt-notes-unread-count.wpn-unread{background-image:none !important;background-color:#ff76b8 !important;border:none !important}#adminmenu #collapse-menu,#adminmenu .wp-menu-separator,#screen-meta-links,.wp-submenu,#toplevel_page_jetpack{display:none}.wp-menu-open .wp-submenu{display:block}#adminmenuwrap,#adminmenuback,#adminmenu{background:#fff}#adminmenuback{border-left:1px solid #e1e2e2}#adminmenu,#adminmenuwrap,#adminmenuback,#adminmenu .wp-submenu{width:272px}#adminmenu{margin-top:71px}#adminmenu .wp-has-current-submenu .wp-submenu,#adminmenu .opensub .wp-submenu,#adminmenu .opensub .wp-submenu:after,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:transparent !important}#adminmenu li.menu-top:hover,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus,#adminmenu li.wp-menu-open,#adminmenu a:hover{background:#f6f6f6}#adminmenu .wp-submenu-head,#adminmenu a.menu-top{padding:5px 5px 5px 0}#adminmenu .wp-has-current-submenu ul>li>a{padding:11px 20px 11px 16px;font-size:14px}#adminmenu .wp-submenu a:hover{background-color:#e1e2e2}#adminmenu>li.wp-first-item{border-bottom:1px solid rgba(200,215,225,0.5)}#adminmenu a.wp-has-current-submenu:after,#adminmenu>li.current>a.current:after,#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none}#adminmenu .dashicons,#adminmenu .dashicons-before:before{width:24px;height:24px;font-size:24px}#adminmenu a,#adminmenu div.wp-menu-image:before{color:#3d4145 !important}#adminmenu li.current a.menu-top,#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu{background:#d8dee4}#adminmenu div.wp-menu-image.svg{filter:brightness(0.25)}#adminmenu li.wp-menu-open div.wp-menu-image.svg{filter:brightness(100)}#adminmenu li.wp-menu-open div.wp-menu-image:before,#adminmenu li.wp-menu-open div.wp-menu-name{color:#016087 !important}#adminmenu div.wp-menu-name{color:#2b2d2f;font-size:15px;padding:9px 41px 8px 0}#adminmenu li.menu-top{min-height:46px}#adminmenu .awaiting-mod,#adminmenu .update-plugins{background-color:#016087}.no-js li.wp-has-current-submenu:hover .wp-submenu{background:transparent !important}#wpcontent,#wpfooter{margin-right:272px}#toplevel_page_plugins div.wp-menu-image.svg,#toplevel_page_plugin-install div.wp-menu-image.svg{background-size:24px auto}#toplevel_page_plugins div.wp-menu-image.svg{position:relative;right:-2px}#calypso-sidebar-header{position:fixed;top:47px;right:0;width:272px;height:70px;background:#fff;z-index:10000}#calypso-sidebar-header svg{float:right;position:relative;right:10px;top:23px}#calypso-sidebar-header ul{float:right;position:relative;top:3px;right:15px}#calypso-sidebar-header ul li{margin:0}#calypso-sidebar-header ul li#calypso-sitename{font-size:12px;color:#636d75;overflow:hidden;white-space:nowrap;width:225px}@media screen and (max-width: 782px){#calypso-sidebar-header ul li#calypso-sitename{width:150px}}#calypso-sidebar-header ul li#calypso-sitename:after{content:'';display:block;position:absolute;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;background:linear-gradient(to left, rgba(255,255,255,0), #fff 90%);top:0px;bottom:0px;left:0px;right:auto;width:20%;height:auto}#calypso-sidebar-header ul li#calypso-plugins{font-weight:bold;color:#2b2d2f;font-size:16px}.folded #adminmenu .wp-has-current-submenu .wp-submenu,.folded #adminmenu .opensub .wp-submenu,.folded #adminmenu .opensub .wp-submenu:after,.folded #adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:#f6f6f6 !important}.folded #adminmenu li.menu-top .wp-submenu>li>a{padding:7px 46px 7px 12px;font-size:14px}.folded #adminmenu li.current.menu-top,.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.wp-has-current-submenu .wp-submenu .wp-submenu-head{background:#f3f5f6}.folded #adminmenu .wp-submenu .wp-submenu-head{padding:14px 11px 14px 4px}.folded #adminmenu a.menu-top{padding-right:1px}.folded #wpcontent #calypso-sidebar-header{width:36px}.folded #wpcontent #calypso-sidebar-header svg{right:6px}.folded #wpcontent #calypso-sidebar-header ul{display:none}.folded .no-js li.wp-has-current-submenu:hover .wp-submenu{background:#f6f6f6 !important}.folded #toplevel_page_plugins div.wp-menu-image.svg{position:relative;right:-2px}@media only screen and (max-width: 960px){#calypso-sidebar-header{width:36px}#calypso-sidebar-header ul{display:none}#calypso-sidebar-header svg{right:6px}#adminmenu a.menu-top{padding-right:1px}}@media screen and (max-width: 782px){#calypso-sidebar-header{position:absolute;display:none;width:190px;top:-14px}.wp-responsive-open #calypso-sidebar-header{display:block}#calypso-sidebar-header ul{display:block}.auto-fold #adminmenu .wp-menu-name{margin-right:0}.auto-fold #adminmenu{top:-14px}.auto-fold #adminmenu .selected,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus,#adminmenu li.wp-menu-open{background:#d8dee4 !important}#adminmenu .wp-submenu,.auto-fold #adminmenu .selected .wp-submenu,.auto-fold #adminmenu .wp-menu-open .wp-submenu,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:#fff !important}.auto-fold #adminmenu li.selected div.wp-menu-image.svg{filter:brightness(100)}.auto-fold #adminmenu li.selected div.wp-menu-image:before,.auto-fold #adminmenu li.selected div.wp-menu-name{color:#016087 !important}#wpadminbar .quicklinks>ul>li>a,#wpadminbar .quicklinks>ul>li>.ab-empty-item{padding:0 15px !important}#wpadminbar li#wp-admin-bar-ab-new-post a{padding:7px 15px !important}}@media screen and (max-width: 600px){#calypso-sidebar-header{top:32px}.auto-fold #adminmenu{top:32px}}@media screen and (max-width: 480px){#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before{margin-top:4px !important}#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:6px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before{top:-5px !important;margin-right:-12px !important}}.nav-tab-wrapper,.wrap h2.nav-tab-wrapper{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5)}.nav-tab{border:none;background:none;font-weight:400;padding:3px 13px 12px;color:#016087}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active,.nav-tab-active:hover{background:transparent;box-shadow:none}.nav-tab:first-child{margin-right:0}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active{border-bottom:2px solid #3d4145;color:#2b2d2f}#wpadminbar{background:#016087;-webkit-box-shadow:none;-mozilla-box-shadow:none;height:46px;position:fixed}#wpadminbar .ab-top-menu>li>.ab-item{font-size:14px}#wpadminbar .ab-top-menu>li.hover>.ab-item{background:#6f93ad !important;color:#fff}#wpadminbar *{line-height:46px}#wpadminbar .quicklinks a,#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .shortlink-input{height:46px}#wpadminbar .quicklinks>ul>li>a{padding:0 15px}#wpadminbar .quicklinks>ul>li.current>a{background:#004966}#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus,#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,#wpadminbar .ab-top-menu>li.ab-hover>.ab-item{background:transparent !important}#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item{background:#6f93ad !important;color:#fff}#wpadminbar .ab-top-menu>li.my-sites>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.hover>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.ab-hover>.ab-item{background:#004966 !important}#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before,#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:12px}#wpadminbar ul li#wp-admin-bar-ab-new-post{border-radius:3px}#wpadminbar ul li#wp-admin-bar-ab-new-post a{padding:6px 15px;color:#016087 !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a span{color:#016087 !important;font-size:14px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before,#wpadminbar ul li#wp-admin-bar-ab-new-post a:after{background-image:url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="0" fill="none" width="24" height="24"/><g><path fill="%230087be" d="M21 14v5c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V5c0-1.105.895-2 2-2h5v2H5v14h14v-5h2z"/><path fill="%230087be" d="M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"/></g></svg>') !important}#wpadminbar ul li#wp-admin-bar-ab-new-post:hover,#wpadminbar ul li#wp-admin-bar-ab-new-post:hover>.ab-item{background:#f6f6f6 !important;opacity:1;border-radius:3px !important}#wpadminbar li#wp-admin-bar-blog.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-newdash.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-my-account.menupop>.ab-sub-wrapper{display:none !important}#wpadminbar li#wp-admin-bar-notes.active,#wpadminbar li#wp-admin-bar-notes.active>.ab-item{background:#004966 !important}#wpadminbar li#wp-admin-bar-notes>#wpnt-notes-panel2{top:46px}#wpadminbar .ab-top-menu>li.ab-active>.ab-item,#wpadminbar>#wp-toolbar .wpnt-show span.noticon,#wpadminbar #wp-admin-bar-notes.wpnt-show .noticon{color:#fff !important}#wpadminbar .ab-active>a.ab-item:before,#wpadminbar #wp-admin-bar-notes.active .noticon-bell:before{filter:brightness(100) !important}#wpadminbar .quicklinks>ul>li#wp-admin-bar-notes>a.ab-item span.noticon,#wpadminbar>#wp-toolbar span.noticon,#wpadminbar #wp-admin-bar-notes .noticon{top:10px}#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon,#wpadminbar .ab-icon,#wpadminbar .ab-item:before{font-size:24px;line-height:1.45}.wrap{margin:20px 15px 25px 30px}@media screen and (max-width: 782px){.wrap{margin:10px 7px 10px 18px}}.subsubsub,.wp-filter{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5);width:100%;box-shadow:none;padding:0}.subsubsub a,.filter-links li>a{padding:10px 15px;display:inline-block;font-size:14px;margin:0;color:#016087;border-bottom:2px solid #fff;outline:none}.subsubsub a:focus,.filter-links li>a:focus{box-shadow:0 0 0 1px #016087,0 0 2px 1px #6f93ad}.subsubsub a:hover,.filter-links li>a:hover{color:#23354b;background-color:#f3f5f6}.subsubsub a:hover:not(.current),.filter-links li>a:hover:not(.current){border-color:#f3f5f6}.filter-links li>a{padding:16px}.subsubsub a.current,.filter-links .current{border-bottom:2px solid #3d4145}.count{display:inline-block;padding:1px 6px;border:solid 1px #969ca1;border-radius:12px;font-size:11px;font-weight:bold;line-height:14px;color:#636d75;text-align:center;margin-right:2px}.plugins-php .plugins a{color:#016087}.plugins-php .plugins a:hover,.plugins-php .plugins a:focus{color:#23354b}.plugins-php .plugins a:focus{box-shadow:0 0 0 1px #016087,0 0 2px 1px #6f93ad}.plugins-php .plugins a.delete{color:#eb0001}.plugins-php .plugins a.delete:hover,.plugins-php .plugins a.delete:focus{color:#ac120b}.plugins-php .plugins a.delete:focus{box-shadow:0 0 0 1px #eb0001,0 0 2px 1px #ff8248}.plugins-php .tablenav{clear:none;float:right;margin-bottom:15px}.plugins-php .tablenav .one-page .displaying-num{display:none}.plugins-php .bulkactions select:focus{border-color:#016087;box-shadow:0 0 2px #6f93ad}.plugins-php p.search-box{margin-top:5px}.plugins-php p.search-box .wp-filter-search:focus{border-color:#016087;box-shadow:0 0 2px #6f93ad}.plugins-php .plugin-update-tr.active td,.plugins-php .plugins .active th{border-right:4px solid #016087}.plugins-php .plugins .active th,.plugins-php .plugins .active td,.plugins-php .plugins .active th.check-column,.plugins-php .plugin-update-tr.active td{background-color:#f3f5f6}.wrap .wp-heading-inline+.page-title-action,.wrap .add-new-h2,.wrap .add-new-h2:active,.wrap .page-title-action,.wrap .page-title-action:active{background:#d52c82;border-color:#992053;color:#fff;border-style:solid;border-width:1px 1px 2px;cursor:pointer;display:inline-block;margin:0 0 0 5px;outline:0;overflow:hidden;font-weight:500;text-overflow:ellipsis;text-decoration:none;vertical-align:middle;box-sizing:border-box;font-size:13px;line-height:21px;border-radius:4px;padding:2px 10px 2px;margin-bottom:2px;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wrap .wp-heading-inline+.page-title-action:hover,.wrap .add-new-h2:hover,.wrap .add-new-h2:active:hover,.wrap .page-title-action:hover,.wrap .page-title-action:active:hover{background-color:#ff3997}.wrap .wp-heading-inline+.page-title-action:focus,.wrap .add-new-h2:focus,.wrap .add-new-h2:active:focus,.wrap .page-title-action:focus,.wrap .page-title-action:active:focus{box-shadow:0 0 0 2px #ff76b8;background-color:#ff3997}.wp-core-ui .button{background:#fff}.wp-core-ui .button:focus{border-color:#016087;box-shadow:0 0 3px #6f93ad}.wp-core-ui .button-primary{background:#016087;border-color:#23354b;color:#fff;text-shadow:none}.wp-core-ui .button-primary:hover,.wp-core-ui .button-primary:focus{background-color:#46799a}.ui-tabs-nav li,.wp-switch-editor{background-color:#f6f6f6 !important}.plugin-card a,.popular-tags a,.filter-links>li>a{color:#016087}.plugin-card a:hover,.plugin-card a:focus,.popular-tags a:hover,.popular-tags a:focus,.filter-links>li>a:hover,.filter-links>li>a:focus{color:#23354b}.plugin-card a:focus,.popular-tags a:focus,.filter-links>li>a:focus{box-shadow:0 0 0 1px #016087,0 0 2px 1px #6f93ad}.plugin-card-bottom,.alternate,.striped>tbody>:nth-child(odd),ul.striped>:nth-child(odd),.ui-tabs-panel,.ui-tabs-nav li.ui-tabs-active,.ui-tabs-nav li.ui-tabs-active:hover,div.mce-toolbar-grp,.html-active .switch-html,.tmce-active .switch-tmce,#post-status-info,.quicktags-toolbar,#major-publishing-actions{background-color:#fff;border-color:#d7e1e9}.wp-filter .search-form{margin-left:10px}.form-toggle[type="checkbox"]{display:none}.form-toggle__switch{position:relative;display:inline-block;border-radius:12px;box-sizing:border-box;padding:2px;width:40px;height:24px;vertical-align:middle;align-self:flex-start;outline:0;cursor:pointer;transition:all .4s ease, box-shadow 0s}.form-toggle__switch:before,.form-toggle__switch:after{position:relative;display:block;content:"";width:20px;height:20px}.form-toggle__switch:after{right:0;border-radius:50%;background:#fff;transition:all .2s ease}.form-toggle__switch:before{display:none}.accessible-focus .form-toggle__switch:focus{box-shadow:0 0 0 2px #016087}.form-toggle__label{cursor:pointer}.is-disabled .form-toggle__label{cursor:default}.form-toggle__label .form-toggle__label-content{flex:0 1 100%;margin-right:12px}.accessible-focus .form-toggle:focus+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #016087}.accessible-focus .form-toggle:focus:checked+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #6f93ad}.form-toggle+.form-toggle__label .form-toggle__switch{background:#b0b5b8}.form-toggle:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#ccced0}.form-toggle:checked+.form-toggle__label .form-toggle__switch{background:#016087}.form-toggle:checked+.form-toggle__label .form-toggle__switch:after{right:16px}.form-toggle:checked:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#6f93ad}.form-toggle:disabled+label.form-toggle__label span.form-toggle__switch{opacity:0.25;cursor:default}.form-toggle.is-toggling+.form-toggle__label .form-toggle__switch{background:#016087}.form-toggle.is-toggling:checked+.form-toggle__label .form-toggle__switch{background:#ccced0}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch{border-radius:8px;width:24px;height:16px}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:before,.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:after{width:12px;height:12px}.form-toggle.is-compact:checked+.form-toggle__label .form-toggle__switch:after{right:8px}
+body,#wp-content-editor-tools{background:#f6f7f7}#wpwrap{top:14px}#wp-admin-bar-notes #wpnt-notes-unread-count.wpn-unread{background-image:none !important;background-color:#eb6594 !important;border:none !important}#adminmenu #collapse-menu,#adminmenu .wp-menu-separator,#screen-meta-links,.wp-submenu,#toplevel_page_jetpack{display:none}.wp-menu-open .wp-submenu{display:block}#adminmenuwrap,#adminmenuback,#adminmenu{background:#fff}#adminmenuback{border-left:1px solid #f6f7f7}#adminmenu,#adminmenuwrap,#adminmenuback,#adminmenu .wp-submenu{width:272px}#adminmenu{margin-top:71px}#adminmenu .wp-submenu{padding:0}#adminmenu .wp-has-current-submenu .wp-submenu,#adminmenu .opensub .wp-submenu,#adminmenu .opensub .wp-submenu:after,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:transparent !important}#adminmenu li.menu-top:hover,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus,#adminmenu li.wp-menu-open{background:transparent}#adminmenu a:hover{background-color:#f6f7f7 !important}#adminmenu .wp-submenu-head,#adminmenu a.menu-top{padding:5px 5px 5px 0}#adminmenu .wp-has-current-submenu ul>li>a{padding:7px 46px 7px 12px;font-size:15px;font-weight:400 !important}#adminmenu a.wp-has-current-submenu:after,#adminmenu>li.current>a.current:after,#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none}#adminmenu .dashicons,#adminmenu .dashicons-before:before{width:24px;height:24px;font-size:24px}#adminmenu a{color:#2c3338 !important}#adminmenu li.current>a{background:#e9eff5 !important}#adminmenu div.wp-menu-image:before{color:#646970 !important}#adminmenu li a:hover div.wp-menu-image:before{color:#2c3338 !important}#adminmenu li.current a div.wp-menu-image:before{color:#2271b1 !important}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu{background:transparent}#adminmenu div.wp-menu-image.svg{filter:brightness(0.4)}#adminmenu li a:hover div.wp-menu-image.svg,#adminmenu li.current div.wp-menu-image.svg{filter:brightness(0.25)}#adminmenu li.current div.wp-menu-image:before,#adminmenu li.current a,#adminmenu li.current .wp-menu-name{color:#2271b1 !important}#adminmenu div.wp-menu-name{color:#646970;font-size:15px;padding:9px 41px 8px 0;font-weight:600}#adminmenu li a:hover div.wp-menu-name{color:#2c3338}#adminmenu li.menu-top{min-height:46px}#adminmenu .awaiting-mod,#adminmenu .update-plugins{background-color:#2271b1}.no-js li.wp-has-current-submenu:hover .wp-submenu{background:transparent !important}#wpcontent,#wpfooter{margin-right:272px}#toplevel_page_plugins div.wp-menu-image.svg,#toplevel_page_plugin-install div.wp-menu-image.svg{background-size:24px auto}#toplevel_page_plugins div.wp-menu-image.svg{position:relative;right:-2px}#calypso-sidebar-header{border-bottom:1px solid #646970;position:fixed;top:47px;right:0;width:272px;height:65px;background:#fff;z-index:10000}#calypso-sidebar-header svg{float:right;position:relative;right:10px;top:23px}#calypso-sidebar-header ul{float:right;position:relative;right:15px}#calypso-sidebar-header ul li{margin:0}#calypso-sidebar-header ul li#calypso-sitename{font-size:12px;color:#646970;overflow:hidden;white-space:nowrap;width:225px}@media screen and (max-width: 782px){#calypso-sidebar-header ul li#calypso-sitename{width:150px}}#calypso-sidebar-header ul li#calypso-sitename:after{content:'';display:block;position:absolute;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;background:linear-gradient(to left, rgba(255,255,255,0), #fff 90%);top:0px;bottom:0px;left:0px;right:auto;width:20%;height:auto}#calypso-sidebar-header ul li#calypso-plugins{font-weight:bold;color:#2c3338;font-size:16px}.folded #adminmenu .wp-has-current-submenu .wp-submenu,.folded #adminmenu .opensub .wp-submenu,.folded #adminmenu .opensub .wp-submenu:after,.folded #adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:transparent !important}.folded #adminmenu li.menu-top .wp-submenu>li>a{padding:7px 46px 7px 12px;font-size:14px}.folded #adminmenu li.current.menu-top,.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.wp-has-current-submenu .wp-submenu .wp-submenu-head{background:#e9eff5}.folded #adminmenu .wp-submenu .wp-submenu-head{padding:14px 11px 14px 4px}.folded #adminmenu a.menu-top{padding-right:1px}.folded #wpcontent #calypso-sidebar-header{width:36px}.folded #wpcontent #calypso-sidebar-header svg{right:6px}.folded #wpcontent #calypso-sidebar-header ul{display:none}.folded .no-js li.wp-has-current-submenu:hover .wp-submenu{background:#f6f7f7 !important}.folded #toplevel_page_plugins div.wp-menu-image.svg{position:relative;right:-2px}@media only screen and (max-width: 960px){#calypso-sidebar-header{width:36px}#calypso-sidebar-header ul{display:none}#calypso-sidebar-header svg{right:6px}#adminmenu a.menu-top{padding-right:1px}}@media screen and (max-width: 782px){#calypso-sidebar-header{position:absolute;display:none;width:190px;top:-14px}.wp-responsive-open #calypso-sidebar-header{display:block}#calypso-sidebar-header ul{display:block}.auto-fold #adminmenu .wp-menu-name{margin-right:0}.auto-fold #adminmenu{top:-14px}#adminmenu .wp-submenu,.auto-fold #adminmenu .selected .wp-submenu,.auto-fold #adminmenu .wp-menu-open .wp-submenu,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:#fff !important}.auto-fold #adminmenu li.selected div.wp-menu-image.svg{filter:brightness(100)}.auto-fold #adminmenu li.selected div.wp-menu-image:before,.auto-fold #adminmenu li.selected div.wp-menu-name{color:#2271b1 !important}#wpadminbar .quicklinks>ul>li>a,#wpadminbar .quicklinks>ul>li>.ab-empty-item{padding:0 15px !important}#wpadminbar li#wp-admin-bar-ab-new-post a{padding:7px 15px !important}}@media screen and (max-width: 600px){#calypso-sidebar-header{top:32px}.auto-fold #adminmenu{top:32px}}@media screen and (max-width: 480px){#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before{margin-top:4px !important}#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:6px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before{top:-5px !important;margin-right:-12px !important}}.nav-tab-wrapper,.wrap h2.nav-tab-wrapper{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5)}.nav-tab{border:none;background:none;font-weight:400;padding:3px 13px 12px;color:#2271b1}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active,.nav-tab-active:hover{background:transparent;box-shadow:none}.nav-tab:first-child{margin-right:0}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active{border-bottom:2px solid #3c434a;color:#2c3338}#wpadminbar{background:#006088;-webkit-box-shadow:none;-mozilla-box-shadow:none;border-bottom:1px solid #0a4b78;height:46px;position:fixed}#wpadminbar .ab-top-menu>li>.ab-item{font-size:14px}#wpadminbar .ab-top-menu>li.hover>.ab-item{background:#004e6e !important;color:#fff}#wpadminbar *{line-height:46px}#wpadminbar .quicklinks a,#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .shortlink-input{height:46px}#wpadminbar .quicklinks>ul>li>a{padding:0 15px}#wpadminbar .quicklinks>ul>li.current>a{background:#004966}#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus,#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,#wpadminbar .ab-top-menu>li.ab-hover>.ab-item{background:transparent !important}#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item{background:#004e6e !important;color:#fff}#wpadminbar .ab-top-menu>li.my-sites>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.hover>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.ab-hover>.ab-item{background:#002c40 !important}#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before,#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:13px}#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before{top:-2px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post{border-radius:3px}#wpadminbar ul li#wp-admin-bar-ab-new-post a{padding:6px 15px;color:#2271b1 !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a span{color:#2271b1 !important;font-size:14px !important;margin-left:4px;margin-right:6px}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before,#wpadminbar ul li#wp-admin-bar-ab-new-post a:after{background-image:url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="0" fill="none" width="24" height="24"/><g><path fill="%230087be" d="M21 14v5c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V5c0-1.105.895-2 2-2h5v2H5v14h14v-5h2z"/><path fill="%230087be" d="M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"/></g></svg>') !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before{margin-right:-6px}#wpadminbar ul li#wp-admin-bar-ab-new-post:hover,#wpadminbar ul li#wp-admin-bar-ab-new-post:hover>.ab-item{background:#f6f7f7 !important;opacity:1;border-radius:3px !important}#wpadminbar li#wp-admin-bar-blog.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-newdash.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-my-account.menupop>.ab-sub-wrapper{display:none !important}#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar{margin-left:-1px;margin-right:9px}#wpadminbar li#wp-admin-bar-notes.active,#wpadminbar li#wp-admin-bar-notes.active>.ab-item{background:#002c40 !important}#wpadminbar li#wp-admin-bar-notes>#wpnt-notes-panel2{top:46px}#wpadminbar .ab-top-menu>li.ab-active>.ab-item,#wpadminbar>#wp-toolbar .wpnt-show span.noticon,#wpadminbar #wp-admin-bar-notes.wpnt-show .noticon{color:#fff !important}#wpadminbar .ab-active>a.ab-item:before,#wpadminbar #wp-admin-bar-notes.active .noticon-bell:before{filter:brightness(100) !important}#wpadminbar .quicklinks>ul>li#wp-admin-bar-notes>a.ab-item span.noticon,#wpadminbar>#wp-toolbar span.noticon,#wpadminbar #wp-admin-bar-notes .noticon{top:10px}#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon,#wpadminbar .ab-icon,#wpadminbar .ab-item:before{font-size:24px;line-height:1.45}#wpadminbar li#wp-admin-bar-recovery-mode{background-color:#b26200 !important}body #wp-admin-bar-notes>.ab-item{padding:0 15px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post{top:5px !important}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{display:none}.wrap{margin:20px 15px 25px 30px}@media screen and (max-width: 782px){.wrap{margin:10px 7px 10px 18px}}.subsubsub,.wp-filter{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5);width:100%;box-shadow:none;padding:0}.subsubsub a,.filter-links li>a{padding:10px 15px;display:inline-block;font-size:14px;margin:0;color:#2271b1;border-bottom:2px solid #fff;outline:none}.subsubsub a:focus,.filter-links li>a:focus{box-shadow:0 0 0 1px #2271b1,0 0 2px 1px #5198d9}.subsubsub a:hover,.filter-links li>a:hover{color:#0a4b78;background-color:#e9eff5}.subsubsub a:hover:not(.current),.filter-links li>a:hover:not(.current){border-color:#e9eff5}.filter-links li>a{padding:16px}.subsubsub a.current,.filter-links .current{border-bottom:2px solid #3c434a}@media only screen and (max-width: 480px){.filter-links,.filter-links li,.filter-links li a{display:block}.filter-links li>a{font-size:16px}}.count{display:inline-block;padding:1px 6px;border:solid 1px #8e9196;border-radius:12px;font-size:11px;font-weight:bold;line-height:14px;color:#646970;text-align:center;margin-right:2px}.plugins-php .plugins a{color:#2271b1}.plugins-php .plugins a:hover,.plugins-php .plugins a:focus{color:#0a4b78}.plugins-php .plugins a:focus{box-shadow:0 0 0 1px #2271b1,0 0 2px 1px #5198d9}.plugins-php .plugins a.delete{color:#d63638}.plugins-php .plugins a.delete:hover,.plugins-php .plugins a.delete:focus{color:#8a2424}.plugins-php .plugins a.delete:focus{box-shadow:0 0 0 1px #d63638,0 0 2px 1px #f86368}.plugins-php .tablenav{clear:none;float:right;margin-bottom:15px}.plugins-php .tablenav .one-page .displaying-num{display:none}.plugins-php .bulkactions select:focus{border-color:#2271b1;box-shadow:0 0 2px #5198d9}.plugins-php p.search-box{margin-top:5px}.plugins-php p.search-box .wp-filter-search:focus{border-color:#2271b1;box-shadow:0 0 2px #5198d9}.plugins-php .plugin-update-tr.active td,.plugins-php .plugins .active th{border-right:4px solid #2271b1}.plugins-php .plugins .active th,.plugins-php .plugins .active td,.plugins-php .plugins .active th.check-column,.plugins-php .plugin-update-tr.active td{background-color:#e9eff5}.wrap .wp-heading-inline+.page-title-action,.wrap .add-new-h2,.wrap .add-new-h2:active,.wrap .page-title-action,.wrap .page-title-action:active{background:#c9356e;border-color:#8c1749;color:#fff;border-style:solid;border-width:1px 1px 2px;cursor:pointer;display:inline-block;margin:0 0 0 5px;outline:0;overflow:hidden;font-weight:500;text-overflow:ellipsis;text-decoration:none;vertical-align:middle;box-sizing:border-box;font-size:13px;line-height:21px;border-radius:4px;padding:2px 10px 2px;margin-bottom:2px;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wrap .wp-heading-inline+.page-title-action:hover,.wrap .add-new-h2:hover,.wrap .add-new-h2:active:hover,.wrap .page-title-action:hover,.wrap .page-title-action:active:hover{background-color:#e34c84}.wrap .wp-heading-inline+.page-title-action:focus,.wrap .add-new-h2:focus,.wrap .add-new-h2:active:focus,.wrap .page-title-action:focus,.wrap .page-title-action:active:focus{box-shadow:0 0 0 2px #eb6594;background-color:#e34c84}.wp-core-ui .button{background:#fff}.wp-core-ui .button:focus{border-color:#2271b1;box-shadow:0 0 3px #5198d9}.wp-core-ui .button-primary{background:#2271b1;border-color:#0a4b78;color:#fff;text-shadow:none}.wp-core-ui .button-primary:hover,.wp-core-ui .button-primary:focus{background-color:#3582c4}.ui-tabs-nav li,.wp-switch-editor{background-color:#f6f7f7 !important}.plugin-card a,.popular-tags a,.filter-links>li>a{color:#2271b1}.plugin-card a:hover,.plugin-card a:focus,.popular-tags a:hover,.popular-tags a:focus,.filter-links>li>a:hover,.filter-links>li>a:focus{color:#0a4b78}.plugin-card a:focus,.popular-tags a:focus,.filter-links>li>a:focus{box-shadow:0 0 0 1px #2271b1,0 0 2px 1px #5198d9}.plugin-card-bottom,.alternate,.striped>tbody>:nth-child(odd),ul.striped>:nth-child(odd),.ui-tabs-panel,.ui-tabs-nav li.ui-tabs-active,.ui-tabs-nav li.ui-tabs-active:hover,div.mce-toolbar-grp,.html-active .switch-html,.tmce-active .switch-tmce,#post-status-info,.quicktags-toolbar,#major-publishing-actions{background-color:#fff;border-color:#d7e1e9}.wp-filter .search-form{margin-left:10px}@media only screen and (max-width: 1000px){.wp-filter .search-form{margin-right:10px}}@media only screen and (max-width: 782px){.wp-filter .search-form input[type="search"].wp-filter-search{padding:5px}}@media only screen and (max-width: 480px){.wp-filter .search-form.search-plugins{align-items:center;display:flex}.wp-filter .search-form.search-plugins .wp-filter-search{flex:0 1 auto;max-width:none;width:100%}.wp-filter .search-form select{flex-shrink:0}.wp-filter .search-form>label{flex:1 1 auto}}.form-toggle[type="checkbox"]{display:none}.form-toggle__switch{position:relative;display:inline-block;border-radius:12px;box-sizing:border-box;padding:2px;width:40px;height:24px;vertical-align:middle;align-self:flex-start;outline:0;cursor:pointer;transition:all .4s ease, box-shadow 0s}.form-toggle__switch:before,.form-toggle__switch:after{position:relative;display:block;content:"";width:20px;height:20px}.form-toggle__switch:after{right:0;border-radius:50%;background:#fff;transition:all .2s ease}.form-toggle__switch:before{display:none}.accessible-focus .form-toggle__switch:focus{box-shadow:0 0 0 2px #2271b1}.form-toggle__label{cursor:pointer}.is-disabled .form-toggle__label{cursor:default}.form-toggle__label .form-toggle__label-content{flex:0 1 100%;margin-right:12px}.accessible-focus .form-toggle:focus+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #2271b1}.accessible-focus .form-toggle:focus:checked+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #5198d9}.form-toggle+.form-toggle__label .form-toggle__switch{background:#a7aaad}.form-toggle:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#c3c4c7}.form-toggle:checked+.form-toggle__label .form-toggle__switch{background:#2271b1}.form-toggle:checked+.form-toggle__label .form-toggle__switch:after{right:16px}.form-toggle:checked:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#5198d9}.form-toggle:disabled+label.form-toggle__label span.form-toggle__switch{opacity:0.25;cursor:default}.form-toggle.is-toggling+.form-toggle__label .form-toggle__switch{background:#2271b1}.form-toggle.is-toggling:checked+.form-toggle__label .form-toggle__switch{background:#c3c4c7}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch{border-radius:8px;width:24px;height:16px}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:before,.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:after{width:12px;height:12px}.form-toggle.is-compact:checked+.form-toggle__label .form-toggle__switch:after{right:8px}
/*# sourceMappingURL=style-rtl.min.css.map */
diff --git a/plugins/jetpack/modules/calypsoify/style.min.css b/plugins/jetpack/modules/calypsoify/style.min.css
index a21c4beb..0ed5d18b 100644
--- a/plugins/jetpack/modules/calypsoify/style.min.css
+++ b/plugins/jetpack/modules/calypsoify/style.min.css
@@ -1,2 +1,2 @@
/* Do not modify this file directly. It is compiled SASS code. */
-body,#wp-content-editor-tools{background:#f6f6f6}#wpwrap{top:14px}#wp-admin-bar-notes #wpnt-notes-unread-count.wpn-unread{background-image:none !important;background-color:#ff76b8 !important;border:none !important}#adminmenu #collapse-menu,#adminmenu .wp-menu-separator,#screen-meta-links,.wp-submenu,#toplevel_page_jetpack{display:none}.wp-menu-open .wp-submenu{display:block}#adminmenuwrap,#adminmenuback,#adminmenu{background:#fff}#adminmenuback{border-right:1px solid #e1e2e2}#adminmenu,#adminmenuwrap,#adminmenuback,#adminmenu .wp-submenu{width:272px}#adminmenu{margin-top:71px}#adminmenu .wp-has-current-submenu .wp-submenu,#adminmenu .opensub .wp-submenu,#adminmenu .opensub .wp-submenu:after,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:transparent !important}#adminmenu li.menu-top:hover,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus,#adminmenu li.wp-menu-open,#adminmenu a:hover{background:#f6f6f6}#adminmenu .wp-submenu-head,#adminmenu a.menu-top{padding:5px 0 5px 5px}#adminmenu .wp-has-current-submenu ul>li>a{padding:11px 16px 11px 20px;font-size:14px}#adminmenu .wp-submenu a:hover{background-color:#e1e2e2}#adminmenu>li.wp-first-item{border-bottom:1px solid rgba(200,215,225,0.5)}#adminmenu a.wp-has-current-submenu:after,#adminmenu>li.current>a.current:after,#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none}#adminmenu .dashicons,#adminmenu .dashicons-before:before{width:24px;height:24px;font-size:24px}#adminmenu a,#adminmenu div.wp-menu-image:before{color:#3d4145 !important}#adminmenu li.current a.menu-top,#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu{background:#d8dee4}#adminmenu div.wp-menu-image.svg{filter:brightness(0.25)}#adminmenu li.wp-menu-open div.wp-menu-image.svg{filter:brightness(100)}#adminmenu li.wp-menu-open div.wp-menu-image:before,#adminmenu li.wp-menu-open div.wp-menu-name{color:#016087 !important}#adminmenu div.wp-menu-name{color:#2b2d2f;font-size:15px;padding:9px 0 8px 41px}#adminmenu li.menu-top{min-height:46px}#adminmenu .awaiting-mod,#adminmenu .update-plugins{background-color:#016087}.no-js li.wp-has-current-submenu:hover .wp-submenu{background:transparent !important}#wpcontent,#wpfooter{margin-left:272px}#toplevel_page_plugins div.wp-menu-image.svg,#toplevel_page_plugin-install div.wp-menu-image.svg{background-size:24px auto}#toplevel_page_plugins div.wp-menu-image.svg{position:relative;left:-2px}#calypso-sidebar-header{position:fixed;top:47px;left:0;width:272px;height:70px;background:#fff;z-index:10000}#calypso-sidebar-header svg{float:left;position:relative;left:10px;top:23px}#calypso-sidebar-header ul{float:left;position:relative;top:3px;left:15px}#calypso-sidebar-header ul li{margin:0}#calypso-sidebar-header ul li#calypso-sitename{font-size:12px;color:#636d75;overflow:hidden;white-space:nowrap;width:225px}@media screen and (max-width: 782px){#calypso-sidebar-header ul li#calypso-sitename{width:150px}}#calypso-sidebar-header ul li#calypso-sitename:after{content:'';display:block;position:absolute;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;background:linear-gradient(to right, rgba(255,255,255,0), #fff 90%);top:0px;bottom:0px;right:0px;left:auto;width:20%;height:auto}#calypso-sidebar-header ul li#calypso-plugins{font-weight:bold;color:#2b2d2f;font-size:16px}.folded #adminmenu .wp-has-current-submenu .wp-submenu,.folded #adminmenu .opensub .wp-submenu,.folded #adminmenu .opensub .wp-submenu:after,.folded #adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:#f6f6f6 !important}.folded #adminmenu li.menu-top .wp-submenu>li>a{padding:7px 12px 7px 46px;font-size:14px}.folded #adminmenu li.current.menu-top,.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.wp-has-current-submenu .wp-submenu .wp-submenu-head{background:#f3f5f6}.folded #adminmenu .wp-submenu .wp-submenu-head{padding:14px 4px 14px 11px}.folded #adminmenu a.menu-top{padding-left:1px}.folded #wpcontent #calypso-sidebar-header{width:36px}.folded #wpcontent #calypso-sidebar-header svg{left:6px}.folded #wpcontent #calypso-sidebar-header ul{display:none}.folded .no-js li.wp-has-current-submenu:hover .wp-submenu{background:#f6f6f6 !important}.folded #toplevel_page_plugins div.wp-menu-image.svg{position:relative;left:-2px}@media only screen and (max-width: 960px){#calypso-sidebar-header{width:36px}#calypso-sidebar-header ul{display:none}#calypso-sidebar-header svg{left:6px}#adminmenu a.menu-top{padding-left:1px}}@media screen and (max-width: 782px){#calypso-sidebar-header{position:absolute;display:none;width:190px;top:-14px}.wp-responsive-open #calypso-sidebar-header{display:block}#calypso-sidebar-header ul{display:block}.auto-fold #adminmenu .wp-menu-name{margin-left:0}.auto-fold #adminmenu{top:-14px}.auto-fold #adminmenu .selected,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus,#adminmenu li.wp-menu-open{background:#d8dee4 !important}#adminmenu .wp-submenu,.auto-fold #adminmenu .selected .wp-submenu,.auto-fold #adminmenu .wp-menu-open .wp-submenu,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:#fff !important}.auto-fold #adminmenu li.selected div.wp-menu-image.svg{filter:brightness(100)}.auto-fold #adminmenu li.selected div.wp-menu-image:before,.auto-fold #adminmenu li.selected div.wp-menu-name{color:#016087 !important}#wpadminbar .quicklinks>ul>li>a,#wpadminbar .quicklinks>ul>li>.ab-empty-item{padding:0 15px !important}#wpadminbar li#wp-admin-bar-ab-new-post a{padding:7px 15px !important}}@media screen and (max-width: 600px){#calypso-sidebar-header{top:32px}.auto-fold #adminmenu{top:32px}}@media screen and (max-width: 480px){#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before{margin-top:4px !important}#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:6px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before{top:-5px !important;margin-left:-12px !important}}.nav-tab-wrapper,.wrap h2.nav-tab-wrapper{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5)}.nav-tab{border:none;background:none;font-weight:400;padding:3px 13px 12px;color:#016087}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active,.nav-tab-active:hover{background:transparent;box-shadow:none}.nav-tab:first-child{margin-left:0}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active{border-bottom:2px solid #3d4145;color:#2b2d2f}#wpadminbar{background:#016087;-webkit-box-shadow:none;-mozilla-box-shadow:none;height:46px;position:fixed}#wpadminbar .ab-top-menu>li>.ab-item{font-size:14px}#wpadminbar .ab-top-menu>li.hover>.ab-item{background:#6f93ad !important;color:#fff}#wpadminbar *{line-height:46px}#wpadminbar .quicklinks a,#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .shortlink-input{height:46px}#wpadminbar .quicklinks>ul>li>a{padding:0 15px}#wpadminbar .quicklinks>ul>li.current>a{background:#004966}#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus,#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,#wpadminbar .ab-top-menu>li.ab-hover>.ab-item{background:transparent !important}#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item{background:#6f93ad !important;color:#fff}#wpadminbar .ab-top-menu>li.my-sites>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.hover>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.ab-hover>.ab-item{background:#004966 !important}#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before,#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:12px}#wpadminbar ul li#wp-admin-bar-ab-new-post{border-radius:3px}#wpadminbar ul li#wp-admin-bar-ab-new-post a{padding:6px 15px;color:#016087 !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a span{color:#016087 !important;font-size:14px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before,#wpadminbar ul li#wp-admin-bar-ab-new-post a:after{background-image:url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="0" fill="none" width="24" height="24"/><g><path fill="%230087be" d="M21 14v5c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V5c0-1.105.895-2 2-2h5v2H5v14h14v-5h2z"/><path fill="%230087be" d="M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"/></g></svg>') !important}#wpadminbar ul li#wp-admin-bar-ab-new-post:hover,#wpadminbar ul li#wp-admin-bar-ab-new-post:hover>.ab-item{background:#f6f6f6 !important;opacity:1;border-radius:3px !important}#wpadminbar li#wp-admin-bar-blog.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-newdash.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-my-account.menupop>.ab-sub-wrapper{display:none !important}#wpadminbar li#wp-admin-bar-notes.active,#wpadminbar li#wp-admin-bar-notes.active>.ab-item{background:#004966 !important}#wpadminbar li#wp-admin-bar-notes>#wpnt-notes-panel2{top:46px}#wpadminbar .ab-top-menu>li.ab-active>.ab-item,#wpadminbar>#wp-toolbar .wpnt-show span.noticon,#wpadminbar #wp-admin-bar-notes.wpnt-show .noticon{color:#fff !important}#wpadminbar .ab-active>a.ab-item:before,#wpadminbar #wp-admin-bar-notes.active .noticon-bell:before{filter:brightness(100) !important}#wpadminbar .quicklinks>ul>li#wp-admin-bar-notes>a.ab-item span.noticon,#wpadminbar>#wp-toolbar span.noticon,#wpadminbar #wp-admin-bar-notes .noticon{top:10px}#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon,#wpadminbar .ab-icon,#wpadminbar .ab-item:before{font-size:24px;line-height:1.45}.wrap{margin:20px 30px 25px 15px}@media screen and (max-width: 782px){.wrap{margin:10px 18px 10px 7px}}.subsubsub,.wp-filter{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5);width:100%;box-shadow:none;padding:0}.subsubsub a,.filter-links li>a{padding:10px 15px;display:inline-block;font-size:14px;margin:0;color:#016087;border-bottom:2px solid #fff;outline:none}.subsubsub a:focus,.filter-links li>a:focus{box-shadow:0 0 0 1px #016087,0 0 2px 1px #6f93ad}.subsubsub a:hover,.filter-links li>a:hover{color:#23354b;background-color:#f3f5f6}.subsubsub a:hover:not(.current),.filter-links li>a:hover:not(.current){border-color:#f3f5f6}.filter-links li>a{padding:16px}.subsubsub a.current,.filter-links .current{border-bottom:2px solid #3d4145}.count{display:inline-block;padding:1px 6px;border:solid 1px #969ca1;border-radius:12px;font-size:11px;font-weight:bold;line-height:14px;color:#636d75;text-align:center;margin-left:2px}.plugins-php .plugins a{color:#016087}.plugins-php .plugins a:hover,.plugins-php .plugins a:focus{color:#23354b}.plugins-php .plugins a:focus{box-shadow:0 0 0 1px #016087,0 0 2px 1px #6f93ad}.plugins-php .plugins a.delete{color:#eb0001}.plugins-php .plugins a.delete:hover,.plugins-php .plugins a.delete:focus{color:#ac120b}.plugins-php .plugins a.delete:focus{box-shadow:0 0 0 1px #eb0001,0 0 2px 1px #ff8248}.plugins-php .tablenav{clear:none;float:left;margin-bottom:15px}.plugins-php .tablenav .one-page .displaying-num{display:none}.plugins-php .bulkactions select:focus{border-color:#016087;box-shadow:0 0 2px #6f93ad}.plugins-php p.search-box{margin-top:5px}.plugins-php p.search-box .wp-filter-search:focus{border-color:#016087;box-shadow:0 0 2px #6f93ad}.plugins-php .plugin-update-tr.active td,.plugins-php .plugins .active th{border-left:4px solid #016087}.plugins-php .plugins .active th,.plugins-php .plugins .active td,.plugins-php .plugins .active th.check-column,.plugins-php .plugin-update-tr.active td{background-color:#f3f5f6}.wrap .wp-heading-inline+.page-title-action,.wrap .add-new-h2,.wrap .add-new-h2:active,.wrap .page-title-action,.wrap .page-title-action:active{background:#d52c82;border-color:#992053;color:#fff;border-style:solid;border-width:1px 1px 2px;cursor:pointer;display:inline-block;margin:0 5px 0 0;outline:0;overflow:hidden;font-weight:500;text-overflow:ellipsis;text-decoration:none;vertical-align:middle;box-sizing:border-box;font-size:13px;line-height:21px;border-radius:4px;padding:2px 10px 2px;margin-bottom:2px;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wrap .wp-heading-inline+.page-title-action:hover,.wrap .add-new-h2:hover,.wrap .add-new-h2:active:hover,.wrap .page-title-action:hover,.wrap .page-title-action:active:hover{background-color:#ff3997}.wrap .wp-heading-inline+.page-title-action:focus,.wrap .add-new-h2:focus,.wrap .add-new-h2:active:focus,.wrap .page-title-action:focus,.wrap .page-title-action:active:focus{box-shadow:0 0 0 2px #ff76b8;background-color:#ff3997}.wp-core-ui .button{background:#fff}.wp-core-ui .button:focus{border-color:#016087;box-shadow:0 0 3px #6f93ad}.wp-core-ui .button-primary{background:#016087;border-color:#23354b;color:#fff;text-shadow:none}.wp-core-ui .button-primary:hover,.wp-core-ui .button-primary:focus{background-color:#46799a}.ui-tabs-nav li,.wp-switch-editor{background-color:#f6f6f6 !important}.plugin-card a,.popular-tags a,.filter-links>li>a{color:#016087}.plugin-card a:hover,.plugin-card a:focus,.popular-tags a:hover,.popular-tags a:focus,.filter-links>li>a:hover,.filter-links>li>a:focus{color:#23354b}.plugin-card a:focus,.popular-tags a:focus,.filter-links>li>a:focus{box-shadow:0 0 0 1px #016087,0 0 2px 1px #6f93ad}.plugin-card-bottom,.alternate,.striped>tbody>:nth-child(odd),ul.striped>:nth-child(odd),.ui-tabs-panel,.ui-tabs-nav li.ui-tabs-active,.ui-tabs-nav li.ui-tabs-active:hover,div.mce-toolbar-grp,.html-active .switch-html,.tmce-active .switch-tmce,#post-status-info,.quicktags-toolbar,#major-publishing-actions{background-color:#fff;border-color:#d7e1e9}.wp-filter .search-form{margin-right:10px}.form-toggle[type="checkbox"]{display:none}.form-toggle__switch{position:relative;display:inline-block;border-radius:12px;box-sizing:border-box;padding:2px;width:40px;height:24px;vertical-align:middle;align-self:flex-start;outline:0;cursor:pointer;transition:all .4s ease, box-shadow 0s}.form-toggle__switch:before,.form-toggle__switch:after{position:relative;display:block;content:"";width:20px;height:20px}.form-toggle__switch:after{left:0;border-radius:50%;background:#fff;transition:all .2s ease}.form-toggle__switch:before{display:none}.accessible-focus .form-toggle__switch:focus{box-shadow:0 0 0 2px #016087}.form-toggle__label{cursor:pointer}.is-disabled .form-toggle__label{cursor:default}.form-toggle__label .form-toggle__label-content{flex:0 1 100%;margin-left:12px}.accessible-focus .form-toggle:focus+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #016087}.accessible-focus .form-toggle:focus:checked+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #6f93ad}.form-toggle+.form-toggle__label .form-toggle__switch{background:#b0b5b8}.form-toggle:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#ccced0}.form-toggle:checked+.form-toggle__label .form-toggle__switch{background:#016087}.form-toggle:checked+.form-toggle__label .form-toggle__switch:after{left:16px}.form-toggle:checked:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#6f93ad}.form-toggle:disabled+label.form-toggle__label span.form-toggle__switch{opacity:0.25;cursor:default}.form-toggle.is-toggling+.form-toggle__label .form-toggle__switch{background:#016087}.form-toggle.is-toggling:checked+.form-toggle__label .form-toggle__switch{background:#ccced0}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch{border-radius:8px;width:24px;height:16px}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:before,.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:after{width:12px;height:12px}.form-toggle.is-compact:checked+.form-toggle__label .form-toggle__switch:after{left:8px}
+body,#wp-content-editor-tools{background:#f6f7f7}#wpwrap{top:14px}#wp-admin-bar-notes #wpnt-notes-unread-count.wpn-unread{background-image:none !important;background-color:#eb6594 !important;border:none !important}#adminmenu #collapse-menu,#adminmenu .wp-menu-separator,#screen-meta-links,.wp-submenu,#toplevel_page_jetpack{display:none}.wp-menu-open .wp-submenu{display:block}#adminmenuwrap,#adminmenuback,#adminmenu{background:#fff}#adminmenuback{border-right:1px solid #f6f7f7}#adminmenu,#adminmenuwrap,#adminmenuback,#adminmenu .wp-submenu{width:272px}#adminmenu{margin-top:71px}#adminmenu .wp-submenu{padding:0}#adminmenu .wp-has-current-submenu .wp-submenu,#adminmenu .opensub .wp-submenu,#adminmenu .opensub .wp-submenu:after,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:transparent !important}#adminmenu li.menu-top:hover,#adminmenu li.opensub>a.menu-top,#adminmenu li>a.menu-top:focus,#adminmenu li.wp-menu-open{background:transparent}#adminmenu a:hover{background-color:#f6f7f7 !important}#adminmenu .wp-submenu-head,#adminmenu a.menu-top{padding:5px 0 5px 5px}#adminmenu .wp-has-current-submenu ul>li>a{padding:7px 12px 7px 46px;font-size:15px;font-weight:400 !important}#adminmenu a.wp-has-current-submenu:after,#adminmenu>li.current>a.current:after,#adminmenu li.wp-has-submenu.wp-not-current-submenu.opensub:hover:after{border:none}#adminmenu .dashicons,#adminmenu .dashicons-before:before{width:24px;height:24px;font-size:24px}#adminmenu a{color:#2c3338 !important}#adminmenu li.current>a{background:#e9eff5 !important}#adminmenu div.wp-menu-image:before{color:#646970 !important}#adminmenu li a:hover div.wp-menu-image:before{color:#2c3338 !important}#adminmenu li.current a div.wp-menu-image:before{color:#2271b1 !important}#adminmenu li.wp-has-current-submenu a.wp-has-current-submenu{background:transparent}#adminmenu div.wp-menu-image.svg{filter:brightness(0.4)}#adminmenu li a:hover div.wp-menu-image.svg,#adminmenu li.current div.wp-menu-image.svg{filter:brightness(0.25)}#adminmenu li.current div.wp-menu-image:before,#adminmenu li.current a,#adminmenu li.current .wp-menu-name{color:#2271b1 !important}#adminmenu div.wp-menu-name{color:#646970;font-size:15px;padding:9px 0 8px 41px;font-weight:600}#adminmenu li a:hover div.wp-menu-name{color:#2c3338}#adminmenu li.menu-top{min-height:46px}#adminmenu .awaiting-mod,#adminmenu .update-plugins{background-color:#2271b1}.no-js li.wp-has-current-submenu:hover .wp-submenu{background:transparent !important}#wpcontent,#wpfooter{margin-left:272px}#toplevel_page_plugins div.wp-menu-image.svg,#toplevel_page_plugin-install div.wp-menu-image.svg{background-size:24px auto}#toplevel_page_plugins div.wp-menu-image.svg{position:relative;left:-2px}#calypso-sidebar-header{border-bottom:1px solid #646970;position:fixed;top:47px;left:0;width:272px;height:65px;background:#fff;z-index:10000}#calypso-sidebar-header svg{float:left;position:relative;left:10px;top:23px}#calypso-sidebar-header ul{float:left;position:relative;left:15px}#calypso-sidebar-header ul li{margin:0}#calypso-sidebar-header ul li#calypso-sitename{font-size:12px;color:#646970;overflow:hidden;white-space:nowrap;width:225px}@media screen and (max-width: 782px){#calypso-sidebar-header ul li#calypso-sitename{width:150px}}#calypso-sidebar-header ul li#calypso-sitename:after{content:'';display:block;position:absolute;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;background:linear-gradient(to right, rgba(255,255,255,0), #fff 90%);top:0px;bottom:0px;right:0px;left:auto;width:20%;height:auto}#calypso-sidebar-header ul li#calypso-plugins{font-weight:bold;color:#2c3338;font-size:16px}.folded #adminmenu .wp-has-current-submenu .wp-submenu,.folded #adminmenu .opensub .wp-submenu,.folded #adminmenu .opensub .wp-submenu:after,.folded #adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:transparent !important}.folded #adminmenu li.menu-top .wp-submenu>li>a{padding:7px 12px 7px 46px;font-size:14px}.folded #adminmenu li.current.menu-top,.folded #adminmenu li.wp-has-current-submenu,.folded #adminmenu li.wp-has-current-submenu .wp-submenu .wp-submenu-head{background:#e9eff5}.folded #adminmenu .wp-submenu .wp-submenu-head{padding:14px 4px 14px 11px}.folded #adminmenu a.menu-top{padding-left:1px}.folded #wpcontent #calypso-sidebar-header{width:36px}.folded #wpcontent #calypso-sidebar-header svg{left:6px}.folded #wpcontent #calypso-sidebar-header ul{display:none}.folded .no-js li.wp-has-current-submenu:hover .wp-submenu{background:#f6f7f7 !important}.folded #toplevel_page_plugins div.wp-menu-image.svg{position:relative;left:-2px}@media only screen and (max-width: 960px){#calypso-sidebar-header{width:36px}#calypso-sidebar-header ul{display:none}#calypso-sidebar-header svg{left:6px}#adminmenu a.menu-top{padding-left:1px}}@media screen and (max-width: 782px){#calypso-sidebar-header{position:absolute;display:none;width:190px;top:-14px}.wp-responsive-open #calypso-sidebar-header{display:block}#calypso-sidebar-header ul{display:block}.auto-fold #adminmenu .wp-menu-name{margin-left:0}.auto-fold #adminmenu{top:-14px}#adminmenu .wp-submenu,.auto-fold #adminmenu .selected .wp-submenu,.auto-fold #adminmenu .wp-menu-open .wp-submenu,#adminmenu a.wp-has-current-submenu:focus+.wp-submenu{background:#fff !important}.auto-fold #adminmenu li.selected div.wp-menu-image.svg{filter:brightness(100)}.auto-fold #adminmenu li.selected div.wp-menu-image:before,.auto-fold #adminmenu li.selected div.wp-menu-name{color:#2271b1 !important}#wpadminbar .quicklinks>ul>li>a,#wpadminbar .quicklinks>ul>li>.ab-empty-item{padding:0 15px !important}#wpadminbar li#wp-admin-bar-ab-new-post a{padding:7px 15px !important}}@media screen and (max-width: 600px){#calypso-sidebar-header{top:32px}.auto-fold #adminmenu{top:32px}}@media screen and (max-width: 480px){#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before{margin-top:4px !important}#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:6px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before{top:-5px !important;margin-left:-12px !important}}.nav-tab-wrapper,.wrap h2.nav-tab-wrapper{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5)}.nav-tab{border:none;background:none;font-weight:400;padding:3px 13px 12px;color:#2271b1}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active,.nav-tab-active:hover{background:transparent;box-shadow:none}.nav-tab:first-child{margin-left:0}.nav-tab-active,.nav-tab-active:focus,.nav-tab-active:focus:active{border-bottom:2px solid #3c434a;color:#2c3338}#wpadminbar{background:#006088;-webkit-box-shadow:none;-mozilla-box-shadow:none;border-bottom:1px solid #0a4b78;height:46px;position:fixed}#wpadminbar .ab-top-menu>li>.ab-item{font-size:14px}#wpadminbar .ab-top-menu>li.hover>.ab-item{background:#004e6e !important;color:#fff}#wpadminbar *{line-height:46px}#wpadminbar .quicklinks a,#wpadminbar .quicklinks .ab-empty-item,#wpadminbar .shortlink-input{height:46px}#wpadminbar .quicklinks>ul>li>a{padding:0 15px}#wpadminbar .quicklinks>ul>li.current>a{background:#004966}#wpadminbar:not(.mobile) .ab-top-menu>li>.ab-item:focus,#wpadminbar.nojq .quicklinks .ab-top-menu>li>.ab-item:focus,#wpadminbar .ab-top-menu>li.ab-hover>.ab-item{background:transparent !important}#wpadminbar:not(.mobile) .ab-top-menu>li:hover>.ab-item{background:#004e6e !important;color:#fff}#wpadminbar .ab-top-menu>li.my-sites>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.hover>.ab-item,#wpadminbar .ab-top-menu>li.my-sites.ab-hover>.ab-item{background:#002c40 !important}#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before,#wpadminbar #wp-admin-bar-newdash>a.ab-item:before{margin-top:13px}#wpadminbar #wp-admin-bar-blog.my-sites>a.ab-item:before{top:-2px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post{border-radius:3px}#wpadminbar ul li#wp-admin-bar-ab-new-post a{padding:6px 15px;color:#2271b1 !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a span{color:#2271b1 !important;font-size:14px !important;margin-right:4px;margin-left:6px}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before,#wpadminbar ul li#wp-admin-bar-ab-new-post a:after{background-image:url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><rect x="0" fill="none" width="24" height="24"/><g><path fill="%230087be" d="M21 14v5c0 1.105-.895 2-2 2H5c-1.105 0-2-.895-2-2V5c0-1.105.895-2 2-2h5v2H5v14h14v-5h2z"/><path fill="%230087be" d="M21 7h-4V3h-2v4h-4v2h4v4h2V9h4"/></g></svg>') !important}#wpadminbar ul li#wp-admin-bar-ab-new-post a:before{margin-left:-6px}#wpadminbar ul li#wp-admin-bar-ab-new-post:hover,#wpadminbar ul li#wp-admin-bar-ab-new-post:hover>.ab-item{background:#f6f7f7 !important;opacity:1;border-radius:3px !important}#wpadminbar li#wp-admin-bar-blog.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-newdash.menupop>.ab-sub-wrapper,#wpadminbar li#wp-admin-bar-my-account.menupop>.ab-sub-wrapper{display:none !important}#wpadminbar .quicklinks li#wp-admin-bar-my-account.with-avatar{margin-right:-1px;margin-left:9px}#wpadminbar li#wp-admin-bar-notes.active,#wpadminbar li#wp-admin-bar-notes.active>.ab-item{background:#002c40 !important}#wpadminbar li#wp-admin-bar-notes>#wpnt-notes-panel2{top:46px}#wpadminbar .ab-top-menu>li.ab-active>.ab-item,#wpadminbar>#wp-toolbar .wpnt-show span.noticon,#wpadminbar #wp-admin-bar-notes.wpnt-show .noticon{color:#fff !important}#wpadminbar .ab-active>a.ab-item:before,#wpadminbar #wp-admin-bar-notes.active .noticon-bell:before{filter:brightness(100) !important}#wpadminbar .quicklinks>ul>li#wp-admin-bar-notes>a.ab-item span.noticon,#wpadminbar>#wp-toolbar span.noticon,#wpadminbar #wp-admin-bar-notes .noticon{top:10px}#wpadminbar>#wp-toolbar>#wp-admin-bar-root-default .ab-icon,#wpadminbar .ab-icon,#wpadminbar .ab-item:before{font-size:24px;line-height:1.45}#wpadminbar li#wp-admin-bar-recovery-mode{background-color:#b26200 !important}body #wp-admin-bar-notes>.ab-item{padding:0 15px !important}#wpadminbar ul li#wp-admin-bar-ab-new-post{top:5px !important}ul#adminmenu a.wp-has-current-submenu:after,ul#adminmenu>li.current>a.current:after{display:none}.wrap{margin:20px 30px 25px 15px}@media screen and (max-width: 782px){.wrap{margin:10px 18px 10px 7px}}.subsubsub,.wp-filter{margin:10px 0 25px;background:#fff;border:1px solid rgba(200,215,225,0.5);width:100%;box-shadow:none;padding:0}.subsubsub a,.filter-links li>a{padding:10px 15px;display:inline-block;font-size:14px;margin:0;color:#2271b1;border-bottom:2px solid #fff;outline:none}.subsubsub a:focus,.filter-links li>a:focus{box-shadow:0 0 0 1px #2271b1,0 0 2px 1px #5198d9}.subsubsub a:hover,.filter-links li>a:hover{color:#0a4b78;background-color:#e9eff5}.subsubsub a:hover:not(.current),.filter-links li>a:hover:not(.current){border-color:#e9eff5}.filter-links li>a{padding:16px}.subsubsub a.current,.filter-links .current{border-bottom:2px solid #3c434a}@media only screen and (max-width: 480px){.filter-links,.filter-links li,.filter-links li a{display:block}.filter-links li>a{font-size:16px}}.count{display:inline-block;padding:1px 6px;border:solid 1px #8e9196;border-radius:12px;font-size:11px;font-weight:bold;line-height:14px;color:#646970;text-align:center;margin-left:2px}.plugins-php .plugins a{color:#2271b1}.plugins-php .plugins a:hover,.plugins-php .plugins a:focus{color:#0a4b78}.plugins-php .plugins a:focus{box-shadow:0 0 0 1px #2271b1,0 0 2px 1px #5198d9}.plugins-php .plugins a.delete{color:#d63638}.plugins-php .plugins a.delete:hover,.plugins-php .plugins a.delete:focus{color:#8a2424}.plugins-php .plugins a.delete:focus{box-shadow:0 0 0 1px #d63638,0 0 2px 1px #f86368}.plugins-php .tablenav{clear:none;float:left;margin-bottom:15px}.plugins-php .tablenav .one-page .displaying-num{display:none}.plugins-php .bulkactions select:focus{border-color:#2271b1;box-shadow:0 0 2px #5198d9}.plugins-php p.search-box{margin-top:5px}.plugins-php p.search-box .wp-filter-search:focus{border-color:#2271b1;box-shadow:0 0 2px #5198d9}.plugins-php .plugin-update-tr.active td,.plugins-php .plugins .active th{border-left:4px solid #2271b1}.plugins-php .plugins .active th,.plugins-php .plugins .active td,.plugins-php .plugins .active th.check-column,.plugins-php .plugin-update-tr.active td{background-color:#e9eff5}.wrap .wp-heading-inline+.page-title-action,.wrap .add-new-h2,.wrap .add-new-h2:active,.wrap .page-title-action,.wrap .page-title-action:active{background:#c9356e;border-color:#8c1749;color:#fff;border-style:solid;border-width:1px 1px 2px;cursor:pointer;display:inline-block;margin:0 5px 0 0;outline:0;overflow:hidden;font-weight:500;text-overflow:ellipsis;text-decoration:none;vertical-align:middle;box-sizing:border-box;font-size:13px;line-height:21px;border-radius:4px;padding:2px 10px 2px;margin-bottom:2px;-webkit-appearance:none;-moz-appearance:none;appearance:none}.wrap .wp-heading-inline+.page-title-action:hover,.wrap .add-new-h2:hover,.wrap .add-new-h2:active:hover,.wrap .page-title-action:hover,.wrap .page-title-action:active:hover{background-color:#e34c84}.wrap .wp-heading-inline+.page-title-action:focus,.wrap .add-new-h2:focus,.wrap .add-new-h2:active:focus,.wrap .page-title-action:focus,.wrap .page-title-action:active:focus{box-shadow:0 0 0 2px #eb6594;background-color:#e34c84}.wp-core-ui .button{background:#fff}.wp-core-ui .button:focus{border-color:#2271b1;box-shadow:0 0 3px #5198d9}.wp-core-ui .button-primary{background:#2271b1;border-color:#0a4b78;color:#fff;text-shadow:none}.wp-core-ui .button-primary:hover,.wp-core-ui .button-primary:focus{background-color:#3582c4}.ui-tabs-nav li,.wp-switch-editor{background-color:#f6f7f7 !important}.plugin-card a,.popular-tags a,.filter-links>li>a{color:#2271b1}.plugin-card a:hover,.plugin-card a:focus,.popular-tags a:hover,.popular-tags a:focus,.filter-links>li>a:hover,.filter-links>li>a:focus{color:#0a4b78}.plugin-card a:focus,.popular-tags a:focus,.filter-links>li>a:focus{box-shadow:0 0 0 1px #2271b1,0 0 2px 1px #5198d9}.plugin-card-bottom,.alternate,.striped>tbody>:nth-child(odd),ul.striped>:nth-child(odd),.ui-tabs-panel,.ui-tabs-nav li.ui-tabs-active,.ui-tabs-nav li.ui-tabs-active:hover,div.mce-toolbar-grp,.html-active .switch-html,.tmce-active .switch-tmce,#post-status-info,.quicktags-toolbar,#major-publishing-actions{background-color:#fff;border-color:#d7e1e9}.wp-filter .search-form{margin-right:10px}@media only screen and (max-width: 1000px){.wp-filter .search-form{margin-left:10px}}@media only screen and (max-width: 782px){.wp-filter .search-form input[type="search"].wp-filter-search{padding:5px}}@media only screen and (max-width: 480px){.wp-filter .search-form.search-plugins{align-items:center;display:flex}.wp-filter .search-form.search-plugins .wp-filter-search{flex:0 1 auto;max-width:none;width:100%}.wp-filter .search-form select{flex-shrink:0}.wp-filter .search-form>label{flex:1 1 auto}}.form-toggle[type="checkbox"]{display:none}.form-toggle__switch{position:relative;display:inline-block;border-radius:12px;box-sizing:border-box;padding:2px;width:40px;height:24px;vertical-align:middle;align-self:flex-start;outline:0;cursor:pointer;transition:all .4s ease, box-shadow 0s}.form-toggle__switch:before,.form-toggle__switch:after{position:relative;display:block;content:"";width:20px;height:20px}.form-toggle__switch:after{left:0;border-radius:50%;background:#fff;transition:all .2s ease}.form-toggle__switch:before{display:none}.accessible-focus .form-toggle__switch:focus{box-shadow:0 0 0 2px #2271b1}.form-toggle__label{cursor:pointer}.is-disabled .form-toggle__label{cursor:default}.form-toggle__label .form-toggle__label-content{flex:0 1 100%;margin-left:12px}.accessible-focus .form-toggle:focus+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #2271b1}.accessible-focus .form-toggle:focus:checked+.form-toggle__label .form-toggle__switch{box-shadow:0 0 0 2px #5198d9}.form-toggle+.form-toggle__label .form-toggle__switch{background:#a7aaad}.form-toggle:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#c3c4c7}.form-toggle:checked+.form-toggle__label .form-toggle__switch{background:#2271b1}.form-toggle:checked+.form-toggle__label .form-toggle__switch:after{left:16px}.form-toggle:checked:not(:disabled)+.form-toggle__label:hover .form-toggle__switch{background:#5198d9}.form-toggle:disabled+label.form-toggle__label span.form-toggle__switch{opacity:0.25;cursor:default}.form-toggle.is-toggling+.form-toggle__label .form-toggle__switch{background:#2271b1}.form-toggle.is-toggling:checked+.form-toggle__label .form-toggle__switch{background:#c3c4c7}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch{border-radius:8px;width:24px;height:16px}.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:before,.form-toggle.is-compact+.form-toggle__label .form-toggle__switch:after{width:12px;height:12px}.form-toggle.is-compact:checked+.form-toggle__label .form-toggle__switch:after{left:8px}
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css b/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css
index bf71e026..bdfa6af0 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css
@@ -1 +1 @@
-.jp-carousel-wrap *{line-height:inherit}.jp-carousel-overlay{background:#000}div.jp-carousel-fadeaway{background:-moz-linear-gradient(bottom,rgba(0,0,0,.5),rgba(0,0,0,0));background:-webkit-gradient(linear,right bottom,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));position:fixed;bottom:0;z-index:2147483647;width:100%;height:15px}.jp-carousel-next-button span,.jp-carousel-previous-button span{background:url(../modules/carousel/images/arrows.png) no-repeat center center;background-size:200px 126px}.jp-carousel-msg{font-family:"Open Sans",sans-serif;font-style:normal;display:inline-block;line-height:19px;padding:11px 15px;font-size:14px;text-align:center;margin:25px 2px 0 20px;background-color:#fff;border-right:4px solid #ffba00;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){.jp-carousel-next-button span,.jp-carousel-previous-button span{background-image:url(../modules/carousel/images/arrows-2x.png)}}.jp-carousel-wrap{font-family:"Helvetica Neue",sans-serif!important}.jp-carousel-info{position:absolute;bottom:0;text-align:right!important;-webkit-font-smoothing:subpixel-antialiased!important}.jp-carousel-info ::selection{background:#68c9e8;color:#fff}.jp-carousel-info ::-moz-selection{background:#68c9e8;color:#fff}.jp-carousel-photo-info{position:relative;right:25%;width:50%}.jp-carousel-transitions .jp-carousel-photo-info{transition:.4s ease-out}.jp-carousel-info h2{background:100% 0!important;border:none!important;color:#999;display:block!important;font:normal 13px/1.25em "Helvetica Neue",sans-serif!important;letter-spacing:0!important;margin:7px 0 0 0!important;padding:10px 0 0!important;overflow:hidden;text-align:right;text-shadow:none!important;text-transform:none!important;-webkit-font-smoothing:subpixel-antialiased}.jp-carousel-next-button,.jp-carousel-previous-button{text-indent:-9999px;overflow:hidden;cursor:pointer}.jp-carousel-next-button span,.jp-carousel-previous-button span{position:absolute;top:0;bottom:0;width:82px;zoom:1;opacity:.2}.jp-carousel-transitions .jp-carousel-next-button span,.jp-carousel-transitions .jp-carousel-previous-button span{transition:.5s opacity ease-out}.jp-carousel-next-button:hover span,.jp-carousel-previous-button:hover span{opacity:.6}.jp-carousel-next-button span{background-position:-110px center;left:0}.jp-carousel-previous-button span{background-position:-10px center;right:0}.jp-carousel-buttons{margin:-18px -20px 15px;padding:8px 10px;border-bottom:1px solid #222;background:#222;text-align:center}div.jp-carousel-buttons a{border:none!important;color:#999;font:normal 11px/1.2em "Helvetica Neue",sans-serif!important;letter-spacing:0!important;padding:5px 0 5px 2px;text-decoration:none!important;text-shadow:none!important;vertical-align:middle;-webkit-font-smoothing:subpixel-antialiased}div.jp-carousel-buttons a:hover{color:#68c9e8;border:none!important}.jp-carousel-transitions div.jp-carousel-buttons a:hover{transition:none!important}.jp-carousel-next-button,.jp-carousel-previous-button,.jp-carousel-slide,.jp-carousel-slide img{-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.jp-carousel-slide{position:fixed;width:0;bottom:0;background-color:#000;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px}.jp-carousel-transitions .jp-carousel-slide{transition:.3s ease-out}.jp-carousel-slide.selected{position:absolute!important;opacity:1}.jp-carousel-slide{opacity:.25}.jp-carousel-slide img{display:block;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;background:100% 0!important;border:none!important;padding:0!important;box-shadow:0 2px 8px rgba(0,0,0,.1);zoom:1}.jp-carousel-transitions .jp-carousel-slide{transition:opacity .4s linear}.jp-carousel-close-hint{color:#999;cursor:default;letter-spacing:0!important;padding:.35em 0 0;position:absolute;text-align:left;width:90%}.jp-carousel-transitions .jp-carousel-close-hint{transition:color .2s linear}.jp-carousel-close-hint span{cursor:pointer;background-color:#000;background-color:rgba(0,0,0,.8);display:inline-block;height:22px;font:400 24px/1 "Helvetica Neue",sans-serif!important;line-height:22px;margin:0 .4em 0 0;text-align:center;vertical-align:middle;width:22px;border-radius:4px}.jp-carousel-transitions .jp-carousel-close-hint span{transition:border-color .2s linear}.jp-carousel-close-hint:hover{cursor:default;color:#fff}.jp-carousel-close-hint:hover span{border-color:#fff}a.jp-carousel-image-download,div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{background:url(../modules/carousel/images/carousel-sprite.png?5) no-repeat;background-size:16px 200px}div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{margin:0 0 0 14px!important}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-color:#303030;padding-left:8px!important;border-radius:2px;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{margin:0 -12px 0 2px!important}div.jp-carousel-buttons a.jp-carousel-reblog,div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover{background-position:6px -36px;padding-left:auto!important;padding-right:26px!important;color:#999}div.jp-carousel-buttons a.jp-carousel-commentlink{background-position:100% -156px;padding-right:19px!important}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover{cursor:default}div.jp-carousel-buttons a.jp-carousel-reblog:hover{background-position:6px -56px;color:#68c9e8}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){a.jp-carousel-image-download,div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{background-image:url(../modules/carousel/images/carousel-sprite-2x.png?5)}}div#carousel-reblog-box{background:#222;background:-moz-linear-gradient(bottom,#222,#333);background:-webkit-gradient(linear,right bottom,right top,from(#222),to(#333));padding:3px 0 0;display:none;margin:5px auto 0;border-radius:2px;box-shadow:0 0 20px rgba(0,0,0,.9);height:74px;width:565px}#carousel-reblog-box textarea{background:#999;font:13px/1.4 "Helvetica Neue",sans-serif!important;color:#444;padding:3px 6px;width:370px;height:48px;float:right;margin:6px 9px 0 9px;border:1px solid #666;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:2px}#carousel-reblog-box textarea:focus{background:#ccc;color:#222}#carousel-reblog-box label{color:#aaa;font-size:11px;padding-left:2px;padding-right:2px;display:inline;font-weight:400}#carousel-reblog-box select{width:110px;padding:0;font-size:12px;font-family:"Helvetica Neue",sans-serif!important;background:#333;color:#eee;border:1px solid #444;margin-top:5px}#carousel-reblog-box .submit,#wrapper #carousel-reblog-box p.response{float:right;width:154px;padding-top:0;padding-right:1px;overflow:hidden;height:34px;margin:3px 2px 0 0!important}#wrapper #carousel-reblog-box p.response{font-size:13px;clear:none;padding-right:2px;height:34px;color:#aaa}#carousel-reblog-box input#carousel-reblog-submit,#jp-carousel-comment-form-button-submit{font:13px/24px "Helvetica Neue",sans-serif!important;margin-top:8px;padding:0 10px!important;border-radius:1em;height:24px;color:#333;cursor:pointer;font-weight:400;background:#aaa;background:-moz-linear-gradient(bottom,#aaa,#ccc);background:-webkit-gradient(linear,right bottom,right top,from(#aaa),to(#ccc));border:1px solid #444}#carousel-reblog-box input#carousel-reblog-submit:hover,#jp-carousel-comment-form-button-submit:hover{background:#ccc;background:-moz-linear-gradient(bottom,#ccc,#eee);background:-webkit-gradient(linear,right bottom,right top,from(#ccc),to(#eee))}#carousel-reblog-box .canceltext{color:#aaa;font-size:11px;line-height:24px}#carousel-reblog-box .canceltext a{color:#fff}.jp-carousel-titleanddesc{border-top:1px solid #222;color:#999;font-size:15px;padding-top:24px;margin-bottom:20px;font-weight:400}.jp-carousel-titleanddesc-title{font:300 1.5em/1.1 "Helvetica Neue",sans-serif!important;text-transform:none!important;color:#fff;margin:0 0 15px;padding:0}.jp-carousel-titleanddesc-desc p{color:#999;line-height:1.4;margin-bottom:.75em}.jp-carousel-comments p a,.jp-carousel-info h2 a,.jp-carousel-titleanddesc p a{color:#fff!important;border:none!important;text-decoration:underline!important;font-weight:400!important;font-style:normal!important}.jp-carousel-titleanddesc p b,.jp-carousel-titleanddesc p strong{font-weight:700;color:#999}.jp-carousel-titleanddesc p em,.jp-carousel-titleanddesc p i{font-style:italic;color:#999}.jp-carousel-comments p a:hover,.jp-carousel-info h2 a:hover,.jp-carousel-titleanddesc p a:hover{color:#68c9e8!important}.jp-carousel-titleanddesc p:empty{display:none}.jp-carousel-left-column-wrapper h1:after,.jp-carousel-left-column-wrapper h1:before,.jp-carousel-photo-info h1:after,.jp-carousel-photo-info h1:before{content:none!important}.jp-carousel-image-meta{background:#111;border:1px solid #222;color:#fff;font-size:13px;font:12px/1.4 "Helvetica Neue",sans-serif!important;overflow:hidden;padding:18px 20px;width:209px!important}.jp-carousel-image-meta h5,.jp-carousel-image-meta li{font-family:"Helvetica Neue",sans-serif!important;position:inherit!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;background:100% 0!important;border:none!important;font-weight:400!important;line-height:1.3em!important}.jp-carousel-image-meta ul{margin:0!important;padding:0!important;list-style:none!important}.jp-carousel-image-meta li{width:48%!important;display:inline-block!important;vertical-align:top!important;margin:0 0 15px 2%!important;color:#fff!important;font-size:13px!important}.jp-carousel-image-meta h5{color:#999!important;text-transform:uppercase!important;font-size:10px!important;margin:0 0 2px!important;letter-spacing:.1em!important}a.jp-carousel-image-download{padding-right:23px;display:inline-block;clear:both;color:#999;line-height:1;font-weight:400;font-size:13px;text-decoration:none;background-position:100% -82px}a.jp-carousel-image-download span.photo-size{font-size:11px;border-radius:1em;margin-right:2px;display:inline-block}a.jp-carousel-image-download span.photo-size-times{padding:0 2px 0 1px}a.jp-carousel-image-download:hover{background-position:100% -122px;color:#68c9e8;border:none!important}.jp-carousel-image-map{position:relative;margin:-20px -20px 20px;border-bottom:1px solid rgba(255,255,255,.17);height:154px}.jp-carousel-image-map img.gmap-main{border-top-right-radius:6px;border-left:1px solid rgba(255,255,255,.17)}.jp-carousel-image-map div.gmap-topright{width:94px;height:154px;position:absolute;top:0;left:0}.jp-carousel-image-map div.imgclip{overflow:hidden;border-top-left-radius:6px}.jp-carousel-image-map div.gmap-topright img{margin-right:-40px}.jp-carousel-image-map img.gmap-bottomright{position:absolute;top:96px;left:0}.jp-carousel-comments{font:15px/1.7 "Helvetica Neue",sans-serif!important;font-weight:400;background:none transparent}.jp-carousel-comments p a:active,.jp-carousel-comments p a:focus,.jp-carousel-comments p a:hover{color:#68c9e8!important}.jp-carousel-comment{background:none transparent;color:#999;margin-bottom:20px;clear:right;overflow:auto;width:100%}.jp-carousel-comment p{color:#999!important}.jp-carousel-comment .comment-author{font-size:13px;font-weight:400;padding:0;width:auto;display:inline;float:none;border:none;margin:0}.jp-carousel-comment .comment-author a{color:#fff}.jp-carousel-comment .comment-gravatar{float:right}.jp-carousel-comment .comment-content{border:none;margin-right:85px;padding:0}.jp-carousel-comment .avatar{margin:0 0 0 20px;border-radius:4px;border:none!important;padding:0!important;background-color:transparent!important}.jp-carousel-comment .comment-date{color:#999;margin-top:4px;font-size:11px;display:inline;float:left}#jp-carousel-comment-form{margin:0 0 10px!important;float:right;width:100%}textarea#jp-carousel-comment-form-comment-field{background:rgba(34,34,34,.9);border:1px solid #3a3a3a;color:#aaa;font:15px/1.4 "Helvetica Neue",sans-serif!important;width:100%;padding:10px 10px 5px;margin:0;float:none;height:147px;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:3px;overflow:hidden;box-sizing:border-box}textarea#jp-carousel-comment-form-comment-field::-webkit-input-placeholder{color:#555}textarea#jp-carousel-comment-form-comment-field:focus{background:#ccc;color:#222}textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder{color:#aaa}#jp-carousel-comment-form-spinner{color:#fff;margin:22px 10px 0 0;display:block;width:20px;height:20px;float:right}#jp-carousel-comment-form-submit-and-info-wrapper{display:none;overflow:hidden;width:100%}#jp-carousel-comment-form-commenting-as input{background:rgba(34,34,34,.9);border:1px solid #3a3a3a;color:#aaa;font:13px/1.4 "Helvetica Neue",sans-serif!important;padding:3px 6px;float:right;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:2px;width:285px}#jp-carousel-comment-form-commenting-as input:focus{background:#ccc;color:#222}#jp-carousel-comment-form-commenting-as p{font:400 13px/1.7 "Helvetica Neue",sans-serif!important;margin:22px 0 0;float:right}#jp-carousel-comment-form-commenting-as fieldset{float:right;border:none;margin:20px 0 0 0;padding:0}#jp-carousel-comment-form-commenting-as fieldset{clear:both}#jp-carousel-comment-form-commenting-as label{font:400 13px/1.7 "Helvetica Neue",sans-serif!important;margin:0 0 3px 20px;float:right;width:100px}#jp-carousel-comment-form-button-submit{margin-top:20px;float:left}#js-carousel-comment-form-container{margin-bottom:15px;overflow:auto;width:100%}#jp-carousel-comment-form-container{margin-bottom:15px;overflow:auto;width:100%}#jp-carousel-comment-post-results{display:none;overflow:auto;width:100%}#jp-carousel-comment-post-results span{display:block;text-align:center;margin-top:20px;width:100%;overflow:auto;padding:1em 0;box-sizing:border-box;background:rgba(0,0,0,.7);border-radius:2px;font:13px/1.4 "Helvetica Neue",sans-serif!important;border:1px solid rgba(255,255,255,.17);box-shadow:inset 0 0 5px 5px rgba(0,0,0,1)}.jp-carousel-comment-post-error{color:#df4926}#jp-carousel-comments-closed{display:none;color:#999}#jp-carousel-comments-loading{font:400 15px/1.7 "Helvetica Neue",sans-serif!important;display:none;color:#999;text-align:right;margin-bottom:20px}.jp-carousel-light .jp-carousel-overlay{background:#fff}.jp-carousel-light .jp-carousel-next-button:hover span,.jp-carousel-light .jp-carousel-previous-button:hover span{opacity:.8}.jp-carousel-light .jp-carousel-close-hint:hover,.jp-carousel-light .jp-carousel-titleanddesc div{color:#000!important}.jp-carousel-light .jp-carousel-comment .comment-author a,.jp-carousel-light .jp-carousel-comments p a,.jp-carousel-light .jp-carousel-info h2 a,.jp-carousel-light .jp-carousel-titleanddesc p a{color:#1e8cbe!important}.jp-carousel-light .jp-carousel-comment .comment-author a:hover,.jp-carousel-light .jp-carousel-comments p a:hover,.jp-carousel-light .jp-carousel-info h2 a:hover,.jp-carousel-light .jp-carousel-titleanddesc p a:hover{color:#f1831e!important}.jp-carousel-light .jp-carousel-comment,.jp-carousel-light .jp-carousel-comment p,.jp-carousel-light .jp-carousel-info h2,.jp-carousel-light .jp-carousel-titleanddesc,.jp-carousel-light .jp-carousel-titleanddesc p,.jp-carousel-light .jp-carousel-titleanddesc p b,.jp-carousel-light .jp-carousel-titleanddesc p em,.jp-carousel-light .jp-carousel-titleanddesc p i,.jp-carousel-light .jp-carousel-titleanddesc p strong,.jp-carousel-light div.jp-carousel-buttons a{color:#666}.jp-carousel-light .jp-carousel-buttons{border-bottom-color:#f0f0f0;background:#f5f5f5}.jp-carousel-light div.jp-carousel-buttons a:hover{text-decoration:none;color:#f1831e}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog,.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog:hover{background-position:4px -56px;padding-right:24px!important}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-color:#2ea2cc;color:#fff}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink{background-position:100% -176px}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-position:5px -36px}.jp-carousel-light div#carousel-reblog-box{background:#eee;background:-moz-linear-gradient(bottom,#ececec,#f7f7f7);background:-webkit-gradient(linear,right bottom,right top,from(#ececec),to(#f7f7f7));box-shadow:0 2px 10px rgba(0,0,0,.1);border:1px solid #ddd}.jp-carousel-light #carousel-reblog-box textarea{border:1px inset #ccc;color:#666;border:1px solid #cfcfcf;background:#fff}.jp-carousel-light #carousel-reblog-box .canceltext{color:#888}.jp-carousel-light #carousel-reblog-box .canceltext a{color:#666}.jp-carousel-light #carousel-reblog-box select{background:#eee;color:#333;border:1px solid #aaa}#jp-carousel-comment-form-button-submit,.jp-carousel-light #carousel-reblog-box input#carousel-reblog-submit{color:#333;background:#fff;background:-moz-linear-gradient(bottom,#ddd,#fff);background:-webkit-gradient(linear,right bottom,right top,from(#ddd),to(#fff));border:1px solid #aaa}.jp-carousel-light .jp-carousel-image-meta{background:#fafafa;border:1px solid #eee;border-top-color:#f5f5f5;border-right-color:#f5f5f5;color:#333}.jp-carousel-light .jp-carousel-image-meta li{color:#000!important}.jp-carousel-light .jp-carousel-close-hint{color:#ccc}.jp-carousel-light .jp-carousel-close-hint span{background-color:#fff;border-color:#ccc}.jp-carousel-light #jp-carousel-comment-form-comment-field::-webkit-input-placeholder{color:#aaa}.jp-carousel-light #jp-carousel-comment-form-comment-field:focus{color:#333}.jp-carousel-light #jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder{color:#ddd}.jp-carousel-light a.jp-carousel-image-download{background-position:100% -122px}.jp-carousel-light a.jp-carousel-image-download:hover{background-position:100% -122px;color:#f1831e}.jp-carousel-light textarea#jp-carousel-comment-form-comment-field{background:#fbfbfb;color:#333;border:1px solid #dfdfdf;box-shadow:inset -2px 2px 2px rgba(0,0,0,.1)}.jp-carousel-light #jp-carousel-comment-form-commenting-as input{background:#fbfbfb;border:1px solid #dfdfdf;color:#333;box-shadow:inset -2px 2px 2px rgba(0,0,0,.1)}.jp-carousel-light #jp-carousel-comment-form-commenting-as input:focus{background:#fbfbfb;color:#333}.jp-carousel-light #jp-carousel-comment-post-results span{background:#f7f7f7;border:1px solid #dfdfdf;box-shadow:inset 0 0 5px rgba(0,0,0,.05)}.jp-carousel-light .jp-carousel-slide{background-color:#fff}.jp-carousel-light .jp-carousel-titleanddesc{border-top:1px solid #eee}.jp-carousel-light .jp-carousel-fadeaway{background:-moz-linear-gradient(bottom,rgba(255,255,255,.75),rgba(255,255,255,0));background:-webkit-gradient(linear,right bottom,right top,from(rgba(255,255,255,.75)),to(rgba(255,255,255,0)))}@media only screen and (max-width:760px){.jp-carousel-info{margin:0 10px!important}.jp-carousel-next-button,.jp-carousel-previous-button{display:none!important}.jp-carousel-buttons{display:none!important}.jp-carousel-image-meta{float:none!important;width:100%!important;box-sizing:border-box}.jp-carousel-close-hint{font-weight:800!important;font-size:26px!important;position:fixed!important;top:-10px}.jp-carousel-slide img{opacity:1}.jp-carousel-wrap{background-color:#000}.jp-carousel-fadeaway{display:none}#jp-carousel-comment-form-container{display:none!important}.jp-carousel-titleanddesc{padding-top:0!important;border:none!important}.jp-carousel-titleanddesc-title{font-size:1em!important}.jp-carousel-left-column-wrapper{padding:0;width:100%!important}.jp-carousel-photo-info{right:0!important;width:100%!important}} \ No newline at end of file
+[data-carousel-extra]{cursor:pointer}.jp-carousel-wrap *{line-height:inherit}.jp-carousel-overlay{background:#000}div.jp-carousel-fadeaway{background:-moz-linear-gradient(bottom,rgba(0,0,0,.5),rgba(0,0,0,0));background:-webkit-gradient(linear,right bottom,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));position:fixed;bottom:0;z-index:2147483647;width:100%;height:15px}.jp-carousel-next-button span,.jp-carousel-previous-button span{background:url(../modules/carousel/images/arrows.png) no-repeat center center;background-size:200px 126px}.jp-carousel-msg{font-family:"Open Sans",sans-serif;font-style:normal;display:inline-block;line-height:19px;padding:11px 15px;font-size:14px;text-align:center;margin:25px 2px 0 20px;background-color:#fff;border-right:4px solid #ffba00;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){.jp-carousel-next-button span,.jp-carousel-previous-button span{background-image:url(../modules/carousel/images/arrows-2x.png)}}.jp-carousel-wrap{font-family:"Helvetica Neue",sans-serif!important}.jp-carousel-info{position:absolute;bottom:0;text-align:right!important;-webkit-font-smoothing:subpixel-antialiased!important}.jp-carousel-info ::selection{background:#68c9e8;color:#fff}.jp-carousel-info ::-moz-selection{background:#68c9e8;color:#fff}.jp-carousel-photo-info{position:relative;right:25%;width:50%}.jp-carousel-transitions .jp-carousel-photo-info{transition:.4s ease-out}.jp-carousel-info h2{background:100% 0!important;border:none!important;color:#999;display:block!important;font:normal 13px/1.25em "Helvetica Neue",sans-serif!important;letter-spacing:0!important;margin:7px 0 0 0!important;padding:10px 0 0!important;overflow:hidden;text-align:right;text-shadow:none!important;text-transform:none!important;-webkit-font-smoothing:subpixel-antialiased}.jp-carousel-next-button,.jp-carousel-previous-button{text-indent:-9999px;overflow:hidden;cursor:pointer}.jp-carousel-next-button span,.jp-carousel-previous-button span{position:absolute;top:0;bottom:0;width:82px;zoom:1;opacity:.2}.jp-carousel-transitions .jp-carousel-next-button span,.jp-carousel-transitions .jp-carousel-previous-button span{transition:.5s opacity ease-out}.jp-carousel-next-button:hover span,.jp-carousel-previous-button:hover span{opacity:.6}.jp-carousel-next-button span{background-position:-110px center;left:0}.jp-carousel-previous-button span{background-position:-10px center;right:0}.jp-carousel-buttons{margin:-18px -20px 15px;padding:8px 10px;border-bottom:1px solid #222;background:#222;text-align:center}div.jp-carousel-buttons a{border:none!important;color:#999;font:normal 11px/1.2em "Helvetica Neue",sans-serif!important;letter-spacing:0!important;padding:5px 0 5px 2px;text-decoration:none!important;text-shadow:none!important;vertical-align:middle;-webkit-font-smoothing:subpixel-antialiased}div.jp-carousel-buttons a:hover{color:#68c9e8;border:none!important}.jp-carousel-transitions div.jp-carousel-buttons a:hover{transition:none!important}.jp-carousel-next-button,.jp-carousel-previous-button,.jp-carousel-slide,.jp-carousel-slide img{-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.jp-carousel-slide{position:fixed;width:0;bottom:0;background-color:#000;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px}.jp-carousel-transitions .jp-carousel-slide{transition:.3s ease-out}.jp-carousel-slide.selected{position:absolute!important;opacity:1}.jp-carousel-slide{opacity:.25}.jp-carousel-slide img{display:block;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;background:100% 0!important;border:none!important;padding:0!important;box-shadow:0 2px 8px rgba(0,0,0,.1);zoom:1}.jp-carousel-transitions .jp-carousel-slide{transition:opacity .4s linear}.jp-carousel-close-hint{color:#999;cursor:default;letter-spacing:0!important;padding:.35em 0 0;position:absolute;text-align:left;width:90%}.jp-carousel-transitions .jp-carousel-close-hint{transition:color .2s linear}.jp-carousel-close-hint span{cursor:pointer;background-color:#000;background-color:rgba(0,0,0,.8);display:inline-block;height:22px;font:400 24px/1 "Helvetica Neue",sans-serif!important;line-height:22px;margin:0 .4em 0 0;text-align:center;vertical-align:middle;width:22px;border-radius:4px}.jp-carousel-transitions .jp-carousel-close-hint span{transition:border-color .2s linear}.jp-carousel-close-hint:hover{cursor:default;color:#fff}.jp-carousel-close-hint:hover span{border-color:#fff}a.jp-carousel-image-download,div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{background:url(../modules/carousel/images/carousel-sprite.png?5) no-repeat;background-size:16px 200px}div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{margin:0 0 0 14px!important}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-color:#303030;padding-left:8px!important;border-radius:2px;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{margin:0 -12px 0 2px!important}div.jp-carousel-buttons a.jp-carousel-reblog,div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover{background-position:6px -36px;padding-left:auto!important;padding-right:26px!important;color:#999}div.jp-carousel-buttons a.jp-carousel-commentlink{background-position:100% -156px;padding-right:19px!important}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover{cursor:default}div.jp-carousel-buttons a.jp-carousel-reblog:hover{background-position:6px -56px;color:#68c9e8}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){a.jp-carousel-image-download,div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{background-image:url(../modules/carousel/images/carousel-sprite-2x.png?5)}}div#carousel-reblog-box{background:#222;background:-moz-linear-gradient(bottom,#222,#333);background:-webkit-gradient(linear,right bottom,right top,from(#222),to(#333));padding:3px 0 0;display:none;margin:5px auto 0;border-radius:2px;box-shadow:0 0 20px rgba(0,0,0,.9);height:74px;width:565px}#carousel-reblog-box textarea{background:#999;font:13px/1.4 "Helvetica Neue",sans-serif!important;color:#444;padding:3px 6px;width:370px;height:48px;float:right;margin:6px 9px 0 9px;border:1px solid #666;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:2px}#carousel-reblog-box textarea:focus{background:#ccc;color:#222}#carousel-reblog-box label{color:#aaa;font-size:11px;padding-left:2px;padding-right:2px;display:inline;font-weight:400}#carousel-reblog-box select{width:110px;padding:0;font-size:12px;font-family:"Helvetica Neue",sans-serif!important;background:#333;color:#eee;border:1px solid #444;margin-top:5px}#carousel-reblog-box .submit,#wrapper #carousel-reblog-box p.response{float:right;width:154px;padding-top:0;padding-right:1px;overflow:hidden;height:34px;margin:3px 2px 0 0!important}#wrapper #carousel-reblog-box p.response{font-size:13px;clear:none;padding-right:2px;height:34px;color:#aaa}#carousel-reblog-box input#carousel-reblog-submit,#jp-carousel-comment-form-button-submit{font:13px/24px "Helvetica Neue",sans-serif!important;margin-top:8px;padding:0 10px!important;border-radius:1em;height:24px;color:#333;cursor:pointer;font-weight:400;background:#aaa;background:-moz-linear-gradient(bottom,#aaa,#ccc);background:-webkit-gradient(linear,right bottom,right top,from(#aaa),to(#ccc));border:1px solid #444}#carousel-reblog-box input#carousel-reblog-submit:hover,#jp-carousel-comment-form-button-submit:hover{background:#ccc;background:-moz-linear-gradient(bottom,#ccc,#eee);background:-webkit-gradient(linear,right bottom,right top,from(#ccc),to(#eee))}#carousel-reblog-box .canceltext{color:#aaa;font-size:11px;line-height:24px}#carousel-reblog-box .canceltext a{color:#fff}.jp-carousel-titleanddesc{border-top:1px solid #222;color:#999;font-size:15px;padding-top:24px;margin-bottom:20px;font-weight:400}.jp-carousel-titleanddesc-title{font:300 1.5em/1.1 "Helvetica Neue",sans-serif!important;text-transform:none!important;color:#fff;margin:0 0 15px;padding:0}.jp-carousel-titleanddesc-desc p{color:#999;line-height:1.4;margin-bottom:.75em}.jp-carousel-comments p a,.jp-carousel-info h2 a,.jp-carousel-titleanddesc p a{color:#fff!important;border:none!important;text-decoration:underline!important;font-weight:400!important;font-style:normal!important}.jp-carousel-titleanddesc p b,.jp-carousel-titleanddesc p strong{font-weight:700;color:#999}.jp-carousel-titleanddesc p em,.jp-carousel-titleanddesc p i{font-style:italic;color:#999}.jp-carousel-comments p a:hover,.jp-carousel-info h2 a:hover,.jp-carousel-titleanddesc p a:hover{color:#68c9e8!important}.jp-carousel-titleanddesc p:empty{display:none}.jp-carousel-left-column-wrapper h1:after,.jp-carousel-left-column-wrapper h1:before,.jp-carousel-photo-info h1:after,.jp-carousel-photo-info h1:before{content:none!important}.jp-carousel-image-meta{background:#111;border:1px solid #222;color:#fff;font-size:13px;font:12px/1.4 "Helvetica Neue",sans-serif!important;overflow:hidden;padding:18px 20px;width:209px!important}.jp-carousel-image-meta h5,.jp-carousel-image-meta li{font-family:"Helvetica Neue",sans-serif!important;position:inherit!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;background:100% 0!important;border:none!important;font-weight:400!important;line-height:1.3em!important}.jp-carousel-image-meta ul{margin:0!important;padding:0!important;list-style:none!important}.jp-carousel-image-meta li{width:48%!important;display:inline-block!important;vertical-align:top!important;margin:0 0 15px 2%!important;color:#fff!important;font-size:13px!important}.jp-carousel-image-meta h5{color:#999!important;text-transform:uppercase!important;font-size:10px!important;margin:0 0 2px!important;letter-spacing:.1em!important}a.jp-carousel-image-download{padding-right:23px;display:inline-block;clear:both;color:#999;line-height:1;font-weight:400;font-size:13px;text-decoration:none;background-position:100% -82px}a.jp-carousel-image-download span.photo-size{font-size:11px;border-radius:1em;margin-right:2px;display:inline-block}a.jp-carousel-image-download span.photo-size-times{padding:0 2px 0 1px}a.jp-carousel-image-download:hover{background-position:100% -122px;color:#68c9e8;border:none!important}.jp-carousel-image-map{position:relative;margin:-20px -20px 20px;border-bottom:1px solid rgba(255,255,255,.17);height:154px}.jp-carousel-image-map img.gmap-main{border-top-right-radius:6px;border-left:1px solid rgba(255,255,255,.17)}.jp-carousel-image-map div.gmap-topright{width:94px;height:154px;position:absolute;top:0;left:0}.jp-carousel-image-map div.imgclip{overflow:hidden;border-top-left-radius:6px}.jp-carousel-image-map div.gmap-topright img{margin-right:-40px}.jp-carousel-image-map img.gmap-bottomright{position:absolute;top:96px;left:0}.jp-carousel-comments{font:15px/1.7 "Helvetica Neue",sans-serif!important;font-weight:400;background:none transparent}.jp-carousel-comments p a:active,.jp-carousel-comments p a:focus,.jp-carousel-comments p a:hover{color:#68c9e8!important}.jp-carousel-comment{background:none transparent;color:#999;margin-bottom:20px;clear:right;overflow:auto;width:100%}.jp-carousel-comment p{color:#999!important}.jp-carousel-comment .comment-author{font-size:13px;font-weight:400;padding:0;width:auto;display:inline;float:none;border:none;margin:0}.jp-carousel-comment .comment-author a{color:#fff}.jp-carousel-comment .comment-gravatar{float:right}.jp-carousel-comment .comment-content{border:none;margin-right:85px;padding:0}.jp-carousel-comment .avatar{margin:0 0 0 20px;border-radius:4px;border:none!important;padding:0!important;background-color:transparent!important}.jp-carousel-comment .comment-date{color:#999;margin-top:4px;font-size:11px;display:inline;float:left}#jp-carousel-comment-form{margin:0 0 10px!important;float:right;width:100%}textarea#jp-carousel-comment-form-comment-field{background:rgba(34,34,34,.9);border:1px solid #3a3a3a;color:#aaa;font:15px/1.4 "Helvetica Neue",sans-serif!important;width:100%;padding:10px 10px 5px;margin:0;float:none;height:147px;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:3px;overflow:hidden;box-sizing:border-box}textarea#jp-carousel-comment-form-comment-field::-webkit-input-placeholder{color:#555}textarea#jp-carousel-comment-form-comment-field:focus{background:#ccc;color:#222}textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder{color:#aaa}#jp-carousel-comment-form-spinner{color:#fff;margin:22px 10px 0 0;display:block;width:20px;height:20px;float:right}#jp-carousel-comment-form-submit-and-info-wrapper{display:none;overflow:hidden;width:100%}#jp-carousel-comment-form-commenting-as input{background:rgba(34,34,34,.9);border:1px solid #3a3a3a;color:#aaa;font:13px/1.4 "Helvetica Neue",sans-serif!important;padding:3px 6px;float:right;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:2px;width:285px}#jp-carousel-comment-form-commenting-as input:focus{background:#ccc;color:#222}#jp-carousel-comment-form-commenting-as p{font:400 13px/1.7 "Helvetica Neue",sans-serif!important;margin:22px 0 0;float:right}#jp-carousel-comment-form-commenting-as fieldset{float:right;border:none;margin:20px 0 0 0;padding:0}#jp-carousel-comment-form-commenting-as fieldset{clear:both}#jp-carousel-comment-form-commenting-as label{font:400 13px/1.7 "Helvetica Neue",sans-serif!important;margin:0 0 3px 20px;float:right;width:100px}#jp-carousel-comment-form-button-submit{margin-top:20px;float:left}#js-carousel-comment-form-container{margin-bottom:15px;overflow:auto;width:100%}#jp-carousel-comment-form-container{margin-bottom:15px;overflow:auto;width:100%}#jp-carousel-comment-post-results{display:none;overflow:auto;width:100%}#jp-carousel-comment-post-results span{display:block;text-align:center;margin-top:20px;width:100%;overflow:auto;padding:1em 0;box-sizing:border-box;background:rgba(0,0,0,.7);border-radius:2px;font:13px/1.4 "Helvetica Neue",sans-serif!important;border:1px solid rgba(255,255,255,.17);box-shadow:inset 0 0 5px 5px rgba(0,0,0,1)}.jp-carousel-comment-post-error{color:#df4926}#jp-carousel-comments-closed{display:none;color:#999}#jp-carousel-comments-loading{font:400 15px/1.7 "Helvetica Neue",sans-serif!important;display:none;color:#999;text-align:right;margin-bottom:20px}.jp-carousel-light .jp-carousel-overlay{background:#fff}.jp-carousel-light .jp-carousel-next-button:hover span,.jp-carousel-light .jp-carousel-previous-button:hover span{opacity:.8}.jp-carousel-light .jp-carousel-close-hint:hover,.jp-carousel-light .jp-carousel-titleanddesc div{color:#000!important}.jp-carousel-light .jp-carousel-comment .comment-author a,.jp-carousel-light .jp-carousel-comments p a,.jp-carousel-light .jp-carousel-info h2 a,.jp-carousel-light .jp-carousel-titleanddesc p a{color:#1e8cbe!important}.jp-carousel-light .jp-carousel-comment .comment-author a:hover,.jp-carousel-light .jp-carousel-comments p a:hover,.jp-carousel-light .jp-carousel-info h2 a:hover,.jp-carousel-light .jp-carousel-titleanddesc p a:hover{color:#f1831e!important}.jp-carousel-light .jp-carousel-comment,.jp-carousel-light .jp-carousel-comment p,.jp-carousel-light .jp-carousel-info h2,.jp-carousel-light .jp-carousel-titleanddesc,.jp-carousel-light .jp-carousel-titleanddesc p,.jp-carousel-light .jp-carousel-titleanddesc p b,.jp-carousel-light .jp-carousel-titleanddesc p em,.jp-carousel-light .jp-carousel-titleanddesc p i,.jp-carousel-light .jp-carousel-titleanddesc p strong,.jp-carousel-light div.jp-carousel-buttons a{color:#666}.jp-carousel-light .jp-carousel-buttons{border-bottom-color:#f0f0f0;background:#f5f5f5}.jp-carousel-light div.jp-carousel-buttons a:hover{text-decoration:none;color:#f1831e}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog,.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog:hover{background-position:4px -56px;padding-right:24px!important}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-color:#2ea2cc;color:#fff}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink{background-position:100% -176px}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-position:5px -36px}.jp-carousel-light div#carousel-reblog-box{background:#eee;background:-moz-linear-gradient(bottom,#ececec,#f7f7f7);background:-webkit-gradient(linear,right bottom,right top,from(#ececec),to(#f7f7f7));box-shadow:0 2px 10px rgba(0,0,0,.1);border:1px solid #ddd}.jp-carousel-light #carousel-reblog-box textarea{border:1px inset #ccc;color:#666;border:1px solid #cfcfcf;background:#fff}.jp-carousel-light #carousel-reblog-box .canceltext{color:#888}.jp-carousel-light #carousel-reblog-box .canceltext a{color:#666}.jp-carousel-light #carousel-reblog-box select{background:#eee;color:#333;border:1px solid #aaa}#jp-carousel-comment-form-button-submit,.jp-carousel-light #carousel-reblog-box input#carousel-reblog-submit{color:#333;background:#fff;background:-moz-linear-gradient(bottom,#ddd,#fff);background:-webkit-gradient(linear,right bottom,right top,from(#ddd),to(#fff));border:1px solid #aaa}.jp-carousel-light .jp-carousel-image-meta{background:#fafafa;border:1px solid #eee;border-top-color:#f5f5f5;border-right-color:#f5f5f5;color:#333}.jp-carousel-light .jp-carousel-image-meta li{color:#000!important}.jp-carousel-light .jp-carousel-close-hint{color:#ccc}.jp-carousel-light .jp-carousel-close-hint span{background-color:#fff;border-color:#ccc}.jp-carousel-light #jp-carousel-comment-form-comment-field::-webkit-input-placeholder{color:#aaa}.jp-carousel-light #jp-carousel-comment-form-comment-field:focus{color:#333}.jp-carousel-light #jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder{color:#ddd}.jp-carousel-light a.jp-carousel-image-download{background-position:100% -122px}.jp-carousel-light a.jp-carousel-image-download:hover{background-position:100% -122px;color:#f1831e}.jp-carousel-light textarea#jp-carousel-comment-form-comment-field{background:#fbfbfb;color:#333;border:1px solid #dfdfdf;box-shadow:inset -2px 2px 2px rgba(0,0,0,.1)}.jp-carousel-light #jp-carousel-comment-form-commenting-as input{background:#fbfbfb;border:1px solid #dfdfdf;color:#333;box-shadow:inset -2px 2px 2px rgba(0,0,0,.1)}.jp-carousel-light #jp-carousel-comment-form-commenting-as input:focus{background:#fbfbfb;color:#333}.jp-carousel-light #jp-carousel-comment-post-results span{background:#f7f7f7;border:1px solid #dfdfdf;box-shadow:inset 0 0 5px rgba(0,0,0,.05)}.jp-carousel-light .jp-carousel-slide{background-color:#fff}.jp-carousel-light .jp-carousel-titleanddesc{border-top:1px solid #eee}.jp-carousel-light .jp-carousel-fadeaway{background:-moz-linear-gradient(bottom,rgba(255,255,255,.75),rgba(255,255,255,0));background:-webkit-gradient(linear,right bottom,right top,from(rgba(255,255,255,.75)),to(rgba(255,255,255,0)))}@media only screen and (max-width:760px){.jp-carousel-info{margin:0 10px!important}.jp-carousel-next-button,.jp-carousel-previous-button{display:none!important}.jp-carousel-buttons{display:none!important}.jp-carousel-image-meta{float:none!important;width:100%!important;box-sizing:border-box}.jp-carousel-close-hint{font-weight:800!important;font-size:26px!important;position:fixed!important;top:-10px}.jp-carousel-slide img{opacity:1}.jp-carousel-wrap{background-color:#000}.jp-carousel-fadeaway{display:none}#jp-carousel-comment-form-container{display:none!important}.jp-carousel-titleanddesc{padding-top:0!important;border:none!important}.jp-carousel-titleanddesc-title{font-size:1em!important}.jp-carousel-left-column-wrapper{padding:0;width:100%!important}.jp-carousel-photo-info{right:0!important;width:100%!important}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.css b/plugins/jetpack/modules/carousel/jetpack-carousel.css
index 6eb89bac..33e2b9c4 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.css
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.css
@@ -1,3 +1,7 @@
+[data-carousel-extra] {
+ cursor: pointer; /* adds a cursor when the carousel takes effect */
+}
+
.jp-carousel-wrap * {
line-height:inherit; /* prevent declarations of line-height in the universal selector */
}
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.js b/plugins/jetpack/modules/carousel/jetpack-carousel.js
index 3c7a5b45..2a5ad2d6 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.js
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.js
@@ -1,4 +1,3 @@
-/* jshint sub: true, onevar: false, multistr: true, devel: true, smarttabs: true */
/* global jetpackCarouselStrings, DocumentTouch */
jQuery( document ).ready( function( $ ) {
@@ -474,6 +473,9 @@ jQuery( document ).ready( function( $ ) {
$( window ).scrollTop( scroll );
$( '.jp-carousel-previous-button' ).hide();
$( '.jp-carousel-next-button' ).hide();
+ // Set height to original value
+ // Fix some themes where closing carousel brings view back to top
+ $( 'html' ).css( 'height', '' );
} )
.bind( 'jp_carousel.afterClose', function() {
if ( window.location.hash && history.back ) {
@@ -1527,11 +1529,7 @@ jQuery( document ).ready( function( $ ) {
// attachment id might no longer match the current attachment id by the time we get the data back or a now
// registered infiniscroll event kicks in, so we don't ever display comments for the wrong image by mistake.
var current = $( '.jp-carousel div.selected' );
- if (
- current &&
- current.data &&
- current.data( 'attachment-id' ) != args.attachment_id // jshint ignore:line
- ) {
+ if ( current && current.data && current.data( 'attachment-id' ) != args.attachment_id ) {
comments.fadeOut( 'fast' );
comments.empty();
return;
@@ -1667,7 +1665,7 @@ jQuery( document ).ready( function( $ ) {
// register the event listener for starting the gallery
$( document.body ).on(
'click.jp-carousel',
- 'div.gallery, div.tiled-gallery, ul.wp-block-gallery, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery',
+ 'div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery',
function( e ) {
if ( ! $( this ).jp_carousel( 'testForData', e.currentTarget ) ) {
return;
@@ -1691,6 +1689,10 @@ jQuery( document ).ready( function( $ ) {
return;
}
+ // Set height to auto
+ // Fix some themes where closing carousel brings view back to top
+ $( 'html' ).css( 'height', 'auto' );
+
e.preventDefault();
// Stopping propagation in case there are parent elements
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.php b/plugins/jetpack/modules/carousel/jetpack-carousel.php
index 1542a297..40401bd1 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.php
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.php
@@ -1,5 +1,6 @@
<?php
-
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Status;
/*
Plugin Name: Jetpack Carousel
Plugin URL: https://wordpress.com/
@@ -229,7 +230,7 @@ class Jetpack_Carousel {
if ( $this->first_run ) {
wp_enqueue_script(
'jetpack-carousel',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/carousel/jetpack-carousel.min.js',
'modules/carousel/jetpack-carousel.js'
),
@@ -314,8 +315,8 @@ class Jetpack_Carousel {
*
* @param bool Enable Jetpack Carousel stat collection. Default false.
*/
- if ( apply_filters( 'jetpack_enable_carousel_stats', false ) && in_array( 'stats', Jetpack::get_active_modules() ) && ! Jetpack::is_development_mode() ) {
- $localize_strings['stats'] = 'blog=' . Jetpack_Options::get_option( 'id' ) . '&host=' . parse_url( get_option( 'home' ), PHP_URL_HOST ) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
+ if ( apply_filters( 'jetpack_enable_carousel_stats', false ) && in_array( 'stats', Jetpack::get_active_modules() ) && ! ( new Status() )->is_development_mode() ) {
+ $localize_strings['stats'] = 'blog=' . Jetpack_Options::get_option( 'id' ) . '&host=' . wp_parse_url( get_option( 'home' ), PHP_URL_HOST ) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
// Set the stats as empty if user is logged in but logged-in users shouldn't be tracked.
if ( is_user_logged_in() && function_exists( 'stats_get_options' ) ) {
@@ -543,6 +544,7 @@ class Jetpack_Carousel {
foreach ( (array) $extra_data as $data_key => $data_values ) {
$html = str_replace( '<div ', '<div ' . esc_attr( $data_key ) . "='" . json_encode( $data_values ) . "' ", $html );
$html = str_replace( '<ul class="wp-block-gallery', '<ul ' . esc_attr( $data_key ) . "='" . json_encode( $data_values ) . "' class=\"wp-block-gallery", $html );
+ $html = str_replace( '<ul class="blocks-gallery-grid', '<ul ' . esc_attr( $data_key ) . "='" . json_encode( $data_values ) . "' class=\"blocks-gallery-grid", $html );
}
}
@@ -792,7 +794,7 @@ class Jetpack_Carousel {
}
function carousel_display_exif_callback() {
- $this->settings_checkbox( 'carousel_display_exif', __( 'Show photo metadata (<a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format" rel="noopener noreferrer" target="_blank">Exif</a>) in carousel, when available.', 'jetpack' ) );
+ $this->settings_checkbox( 'carousel_display_exif', __( 'Show photo metadata (<a href="https://en.wikipedia.org/wiki/Exchangeable_image_file_format" rel="noopener noreferrer" target="_blank">Exif</a>) in carousel, when available.', 'jetpack' ) );
}
function carousel_display_exif_sanitize( $value ) {
diff --git a/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css b/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css
index c42d454b..a9ad0fdb 100644
--- a/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css
+++ b/plugins/jetpack/modules/carousel/rtl/jetpack-carousel-rtl.css
@@ -1,5 +1,9 @@
/* This file was automatically generated on Jul 30 2015 22:37:09 */
+[data-carousel-extra] {
+ cursor: pointer; /* adds a cursor when the carousel takes effect */
+}
+
.jp-carousel-wrap * {
line-height:inherit; /* prevent declarations of line-height in the universal selector */
}
diff --git a/plugins/jetpack/modules/comment-likes.php b/plugins/jetpack/modules/comment-likes.php
index 4fd73751..b40bd2f3 100644
--- a/plugins/jetpack/modules/comment-likes.php
+++ b/plugins/jetpack/modules/comment-likes.php
@@ -11,6 +11,8 @@
* Additional Search Queries: like widget, like button, like, likes
*/
+use Automattic\Jetpack\Assets;
+
Jetpack::dns_prefetch(
array(
'//widgets.wp.com',
@@ -21,11 +23,12 @@ require_once dirname( __FILE__ ) . '/likes/jetpack-likes-master-iframe.php';
require_once dirname( __FILE__ ) . '/likes/jetpack-likes-settings.php';
class Jetpack_Comment_Likes {
+
public static function init() {
static $instance = NULL;
if ( ! $instance ) {
- $instance = new Jetpack_Comment_Likes;
+ $instance = new Jetpack_Comment_Likes();
}
return $instance;
@@ -35,7 +38,7 @@ class Jetpack_Comment_Likes {
$this->settings = new Jetpack_Likes_Settings();
$this->blog_id = Jetpack_Options::get_option( 'id' );
$this->url = home_url();
- $this->url_parts = parse_url( $this->url );
+ $this->url_parts = wp_parse_url( $this->url );
$this->domain = $this->url_parts['host'];
add_action( 'template_redirect', array( $this, 'frontend_init' ) );
@@ -101,7 +104,7 @@ class Jetpack_Comment_Likes {
wp_enqueue_style( 'comment-like-count', plugins_url( 'comment-likes/admin-style.css', __FILE__ ), array(), JETPACK__VERSION );
wp_enqueue_script(
'comment-like-count',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/comment-likes/comment-like-count.min.js',
'modules/comment-likes/comment-like-count.js'
),
@@ -132,14 +135,14 @@ class Jetpack_Comment_Likes {
wp_enqueue_style( 'jetpack_likes', plugins_url( 'likes/style.css', __FILE__ ), array( 'open-sans' ), JETPACK__VERSION );
wp_enqueue_script(
'postmessage',
- Jetpack::get_file_url_for_environment( '_inc/build/postmessage.min.js', '_inc/postmessage.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/postmessage.min.js', '_inc/postmessage.js' ),
array( 'jquery' ),
JETPACK__VERSION,
false
);
wp_enqueue_script(
'jetpack_resize',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/jquery.jetpack-resize.min.js',
'_inc/jquery.jetpack-resize.js'
),
diff --git a/plugins/jetpack/modules/comments.php b/plugins/jetpack/modules/comments.php
index 1dc4954d..4e607b86 100644
--- a/plugins/jetpack/modules/comments.php
+++ b/plugins/jetpack/modules/comments.php
@@ -2,7 +2,7 @@
/**
* Module Name: Comments
- * Module Description: Let readers use WordPress.com, Twitter, Facebook, or Google+ accounts to comment
+ * Module Description: Let visitors use a WordPress.com, Twitter, Facebook, or Google account to comment
* First Introduced: 1.4
* Sort Order: 20
* Requires Connection: Yes
diff --git a/plugins/jetpack/modules/comments/base.php b/plugins/jetpack/modules/comments/base.php
index ecbbf1c4..137dd982 100644
--- a/plugins/jetpack/modules/comments/base.php
+++ b/plugins/jetpack/modules/comments/base.php
@@ -45,13 +45,13 @@ class Highlander_Comments_Base {
* @param ...
* @return false|string false if it's not a Highlander POST request. The matching credentials slug if it is.
*/
- function is_highlander_comment_post() {
+ function is_highlander_comment_post( ...$args ) {
if ( empty( $_POST['hc_post_as'] ) ) {
return false;
}
- if ( func_num_args() ) {
- foreach ( func_get_args() as $id_source ) {
+ if ( $args ) {
+ foreach ( $args as $id_source ) {
if ( $id_source === $_POST['hc_post_as'] ) {
return $id_source;
}
@@ -80,7 +80,7 @@ class Highlander_Comments_Base {
$signing = array();
foreach ( $parameters as $k => $v ) {
if ( ! is_scalar( $v ) ) {
- return new WP_Error( 'invalid_input', __( 'Invalid request', 'jetpack' ) );
+ return new WP_Error( 'invalid_input', __( 'Invalid request', 'jetpack' ), array( 'status' => 400 ) );
}
$signing[] = "{$k}={$v}";
@@ -236,9 +236,9 @@ class Highlander_Comments_Base {
if ( get_option( 'require_name_email' ) ) {
if ( 6 > strlen( $_POST['email'] ) || empty( $_POST['author'] ) ) {
- wp_die( __( 'Error: please fill the required fields (name, email).', 'jetpack' ) );
+ wp_die( __( 'Error: please fill the required fields (name, email).', 'jetpack' ), 400 );
} elseif ( ! is_email( $_POST['email'] ) ) {
- wp_die( __( 'Error: please enter a valid email address.', 'jetpack' ) );
+ wp_die( __( 'Error: please enter a valid email address.', 'jetpack' ), 400 );
}
}
diff --git a/plugins/jetpack/modules/comments/comments.php b/plugins/jetpack/modules/comments/comments.php
index f80da0fb..dfc8f070 100644
--- a/plugins/jetpack/modules/comments/comments.php
+++ b/plugins/jetpack/modules/comments/comments.php
@@ -1,6 +1,7 @@
<?php
require dirname( __FILE__ ) . '/base.php';
+use Automattic\Jetpack\Connection\Manager as Connection_Manager;
/**
* Main Comments class
@@ -155,7 +156,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// Detect whether it's a Facebook or Twitter avatar
$foreign_avatar = get_comment_meta( $comment->comment_ID, 'hc_avatar', true );
- $foreign_avatar_hostname = parse_url( $foreign_avatar, PHP_URL_HOST );
+ $foreign_avatar_hostname = wp_parse_url( $foreign_avatar, PHP_URL_HOST );
if ( ! $foreign_avatar_hostname ||
! preg_match( '/\.?(graph\.facebook\.com|twimg\.com)$/', $foreign_avatar_hostname ) ) {
return $avatar;
@@ -276,13 +277,32 @@ class Jetpack_Comments extends Highlander_Comments_Base {
$params['has_cookie_consent'] = (int) ! empty( $commenter['comment_author_email'] );
}
- $signature = Jetpack_Comments::sign_remote_comment_parameters( $params, Jetpack_Options::get_option( 'blog_token' ) );
+ $blog_token = Jetpack_Data::get_access_token();
+ list( $token_key ) = explode( '.', $blog_token->secret, 2 );
+ // Prophylactic check: anything else should never happen.
+ if ( $token_key && $token_key !== $blog_token->secret ) {
+ // Is the token a Special Token (@see class.jetpack-data.php)?
+ if ( preg_match( '/^;.\d+;\d+;$/', $token_key, $matches ) ) {
+ // The token key for a Special Token is public.
+ $params['token_key'] = $token_key;
+ } else {
+ /*
+ * The token key for a Normal Token is public but
+ * looks like sensitive data. Since there can only be
+ * one Normal Token per site, avoid concern by
+ * sending the magic "use the Normal Token" token key.
+ */
+ $params['token_key'] = Connection_Manager::MAGIC_NORMAL_TOKEN_KEY;
+ }
+ }
+
+ $signature = Jetpack_Comments::sign_remote_comment_parameters( $params, $blog_token->secret );
if ( is_wp_error( $signature ) ) {
$signature = 'error';
}
$params['sig'] = $signature;
- $url_origin = set_url_scheme( 'http://jetpack.wordpress.com' );
+ $url_origin = 'https://jetpack.wordpress.com';
$url = "{$url_origin}/jetpack-comment/?" . http_build_query( $params );
$url = "{$url}#parent=" . urlencode( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) );
$this->signed_url = $url;
@@ -344,7 +364,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
* @since JetpackComments (1.4)
*/
public function watch_comment_parent() {
- $url_origin = set_url_scheme( 'http://jetpack.wordpress.com' );
+ $url_origin = 'https://jetpack.wordpress.com';
?>
<!--[if IE]>
@@ -455,7 +475,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
$post_array = stripslashes_deep( $_POST );
// Bail if missing the Jetpack token
- if ( ! isset( $post_array['sig'] ) ) {
+ if ( ! isset( $post_array['sig'] ) || ! isset( $post_array['token_key'] ) ) {
unset( $_POST['hc_post_as'] );
return;
@@ -465,14 +485,18 @@ class Jetpack_Comments extends Highlander_Comments_Base {
$post_array['hc_avatar'] = htmlentities( $post_array['hc_avatar'] );
}
- $check = Jetpack_Comments::sign_remote_comment_parameters( $post_array, Jetpack_Options::get_option( 'blog_token' ) );
+ $blog_token = Jetpack_Data::get_access_token( false, $post_array['token_key'] );
+ if ( ! $blog_token ) {
+ wp_die( __( 'Unknown security token.', 'jetpack' ), 400 );
+ }
+ $check = Jetpack_Comments::sign_remote_comment_parameters( $post_array, $blog_token->secret );
if ( is_wp_error( $check ) ) {
wp_die( $check );
}
// Bail if token is expired or not valid
- if ( $check !== $post_array['sig'] ) {
- wp_die( __( 'Invalid security token.', 'jetpack' ) );
+ if ( ! hash_equals( $check, $post_array['sig'] ) ) {
+ wp_die( __( 'Invalid security token.', 'jetpack' ), 400 );
}
/** This filter is documented in modules/comments/comments.php */
@@ -480,7 +504,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// In case the comment POST is legit, but the comments are
// now disabled, we don't allow the comment
- wp_die( __( 'Comments are not allowed.', 'jetpack' ) );
+ wp_die( __( 'Comments are not allowed.', 'jetpack' ), 403 );
}
}
diff --git a/plugins/jetpack/modules/contact-form/admin.php b/plugins/jetpack/modules/contact-form/admin.php
index 0596f798..c8c7d053 100644
--- a/plugins/jetpack/modules/contact-form/admin.php
+++ b/plugins/jetpack/modules/contact-form/admin.php
@@ -1,4 +1,7 @@
<?php
+
+use Automattic\Jetpack\Assets;
+
/**
* Add a contact form button to the post composition screen
*/
@@ -86,7 +89,7 @@ color: #D98500;
* Hack a 'Bulk Delete' option for bulk edit in spam view
*
* There isn't a better way to do this until
- * http://core.trac.wordpress.org/changeset/17297 is resolved
+ * https://core.trac.wordpress.org/changeset/17297 is resolved
*/
add_action( 'admin_head', 'grunion_add_bulk_edit_option' );
function grunion_add_bulk_edit_option() {
@@ -803,7 +806,7 @@ function grunion_enable_spam_recheck() {
// Add the scripts that handle the spam check event.
wp_register_script(
'grunion-admin',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/contact-form/js/grunion-admin.min.js',
'modules/contact-form/js/grunion-admin.js'
),
diff --git a/plugins/jetpack/modules/contact-form/css/grunion-rtl.css b/plugins/jetpack/modules/contact-form/css/grunion-rtl.css
index 952b25fa..cc820aca 100644
--- a/plugins/jetpack/modules/contact-form/css/grunion-rtl.css
+++ b/plugins/jetpack/modules/contact-form/css/grunion-rtl.css
@@ -1 +1 @@
-.contact-form .clear-form{clear:both}.contact-form input:-ms-input-placeholder{transition:opacity .3s ease-out}.contact-form input::-ms-input-placeholder{transition:opacity .3s ease-out}.contact-form input::placeholder{transition:opacity .3s ease-out}.contact-form input:hover:-ms-input-placeholder{opacity:.5}.contact-form input:hover::-ms-input-placeholder{opacity:.5}.contact-form input:hover::placeholder{opacity:.5}.contact-form input:focus:-ms-input-placeholder{opacity:.3}.contact-form input:focus::-ms-input-placeholder{opacity:.3}.contact-form input:focus::placeholder{opacity:.3}.contact-form input[type=email],.contact-form input[type=text],.contact-form input[type=url]{width:300px;max-width:98%;margin-bottom:13px}.contact-form select{margin-bottom:13px}.contact-form textarea{height:200px;width:80%;float:none;margin-bottom:13px}.contact-form input[type=checkbox],.contact-form input[type=radio]{float:none;margin-bottom:13px}.contact-form label{margin-bottom:3px;float:none;font-weight:700;display:block}.contact-form label.checkbox,.contact-form label.radio{margin-bottom:3px;float:none;font-weight:700;display:inline-block}.contact-form label span{color:#aaa;margin-right:4px;font-weight:400}.contact-form-submission{margin-bottom:4em;padding:1.5em 1em}.contact-form-submission p{margin:0 auto;word-wrap:break-word}.form-errors .form-error-message{color:red}.textwidget .contact-form input[type=email],.textwidget .contact-form input[type=text],.textwidget .contact-form input[type=url],.textwidget .contact-form textarea{width:250px;max-width:100%;box-sizing:border-box}#jetpack-check-feedback-spam{margin:1px 0 0 8px}.jetpack-check-feedback-spam-spinner{display:inline-block;margin-top:7px} \ No newline at end of file
+.contact-form .clear-form{clear:both}.contact-form input:-ms-input-placeholder{transition:opacity .3s ease-out}.contact-form input::-ms-input-placeholder{transition:opacity .3s ease-out}.contact-form input::placeholder{transition:opacity .3s ease-out}.contact-form input:hover:-ms-input-placeholder{opacity:.5}.contact-form input:hover::-ms-input-placeholder{opacity:.5}.contact-form input:hover::placeholder{opacity:.5}.contact-form input:focus:-ms-input-placeholder{opacity:.3}.contact-form input:focus::-ms-input-placeholder{opacity:.3}.contact-form input:focus::placeholder{opacity:.3}.contact-form input[type=email],.contact-form input[type=tel],.contact-form input[type=text],.contact-form input[type=url]{box-sizing:border-box;margin-bottom:.75em;width:100%}.contact-form select{margin-bottom:.75em}.contact-form textarea{box-sizing:border-box;float:none;height:200px;margin-bottom:.75em;width:100%}.contact-form input[type=checkbox],.contact-form input[type=radio]{float:none;margin-bottom:.75em;vertical-align:bottom;vertical-align:-webkit-baseline-middle;vertical-align:-moz-middle-with-baseline}.contact-form label{margin-bottom:.25em;float:none;font-weight:700;display:block}.contact-form label.checkbox,.contact-form label.checkbox-multiple,.contact-form label.radio{margin-bottom:.25em;float:none;font-weight:400;display:inline-block}.contact-form .grunion-field-checkbox-multiple-wrap,.contact-form .grunion-field-checkbox-wrap,.contact-form .grunion-field-radio-wrap{margin-bottom:.5em}.contact-form label span{color:#aaa;margin-right:.25em;font-weight:400}.contact-form-submission{margin-bottom:4em;padding:1.5em 1em}.contact-form-submission p{margin:0 auto;word-wrap:break-word}.form-errors .form-error-message{color:red}.textwidget .contact-form input[type=email],.textwidget .contact-form input[type=tel],.textwidget .contact-form input[type=text],.textwidget .contact-form input[type=url],.textwidget .contact-form textarea,.wp-block-column .contact-form input[type=email],.wp-block-column .contact-form input[type=tel],.wp-block-column .contact-form input[type=text],.wp-block-column .contact-form input[type=url],.wp-block-column .contact-form textarea{width:100%}#jetpack-check-feedback-spam{margin:1px 0 0 8px}.jetpack-check-feedback-spam-spinner{display:inline-block;margin-top:7px}@media only screen and (min-width:600px){.contact-form input[type=email],.contact-form input[type=tel],.contact-form input[type=text],.contact-form input[type=url]{width:50%}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/contact-form/css/grunion.css b/plugins/jetpack/modules/contact-form/css/grunion.css
index 1089188d..af3585b6 100644
--- a/plugins/jetpack/modules/contact-form/css/grunion.css
+++ b/plugins/jetpack/modules/contact-form/css/grunion.css
@@ -14,47 +14,59 @@
.contact-form input[type='text'],
.contact-form input[type='email'],
+.contact-form input[type='tel'],
.contact-form input[type='url'] {
- width: 300px;
- max-width: 98%;
- margin-bottom: 13px;
+ box-sizing: border-box;
+ margin-bottom: 0.75em;
+ width: 100%;
}
.contact-form select {
- margin-bottom: 13px;
+ margin-bottom: 0.75em;
}
.contact-form textarea {
- height: 200px;
- width: 80%;
+ box-sizing: border-box;
float: none;
- margin-bottom: 13px;
+ height: 200px;
+ margin-bottom: 0.75em;
+ width: 100%;
}
.contact-form input[type='radio'],
.contact-form input[type='checkbox'] {
float: none;
- margin-bottom: 13px;
+ margin-bottom: 0.75em;
+ vertical-align: bottom;
+ vertical-align: -webkit-baseline-middle;
+ vertical-align: -moz-middle-with-baseline;
}
.contact-form label {
- margin-bottom: 3px;
+ margin-bottom: 0.25em;
float: none;
font-weight: bold;
display: block;
}
.contact-form label.checkbox,
+.contact-form label.checkbox-multiple,
.contact-form label.radio {
- margin-bottom: 3px;
+ margin-bottom: 0.25em;
float: none;
- font-weight: bold;
+ font-weight: normal;
display: inline-block;
}
+.contact-form .grunion-field-checkbox-wrap,
+.contact-form .grunion-field-checkbox-multiple-wrap,
+.contact-form .grunion-field-radio-wrap {
+ margin-bottom: 0.5em;
+}
+
.contact-form label span {
color: #AAA;
- margin-left: 4px;
+ margin-left: 0.25em;
font-weight: normal;
}
@@ -74,11 +86,15 @@
.textwidget .contact-form input[type='text'],
.textwidget .contact-form input[type='email'],
+.textwidget .contact-form input[type='tel'],
.textwidget .contact-form input[type='url'],
-.textwidget .contact-form textarea {
- width: 250px;
- max-width: 100%;
- box-sizing: border-box;
+.textwidget .contact-form textarea,
+.wp-block-column .contact-form input[type='text'],
+.wp-block-column .contact-form input[type='email'],
+.wp-block-column .contact-form input[type='tel'],
+.wp-block-column .contact-form input[type='url'],
+.wp-block-column .contact-form textarea {
+ width: 100%;
}
#jetpack-check-feedback-spam {
@@ -89,3 +105,12 @@
display: inline-block;
margin-top: 7px;
}
+
+@media only screen and (min-width: 600px) {
+ .contact-form input[type='text'],
+ .contact-form input[type='email'],
+ .contact-form input[type='tel'],
+ .contact-form input[type='url'] {
+ width: 50%;
+ }
+}
diff --git a/plugins/jetpack/modules/contact-form/grunion-contact-form.php b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
index a26dc20c..02b6d091 100644
--- a/plugins/jetpack/modules/contact-form/grunion-contact-form.php
+++ b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
@@ -1,14 +1,14 @@
-<?php
-
-/*
-Plugin Name: Grunion Contact Form
-Description: Add a contact form to any post, page or text widget. Emails will be sent to the post's author by default, or any email address you choose. As seen on WordPress.com.
-Plugin URI: http://automattic.com/#
-AUthor: Automattic, Inc.
-Author URI: http://automattic.com/
-Version: 2.4
-License: GPLv2 or later
-*/
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+/**
+ * Grunion Contact Form
+ * Add a contact form to any post, page or text widget.
+ * Emails will be sent to the post's author by default, or any email address you choose.
+ *
+ * @package Jetpack
+ */
+
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Sync\Settings;
define( 'GRUNION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'GRUNION_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@@ -50,7 +50,7 @@ class Grunion_Contact_Form_Plugin {
static $instance = false;
if ( ! $instance ) {
- $instance = new Grunion_Contact_Form_Plugin;
+ $instance = new Grunion_Contact_Form_Plugin();
// Schedule our daily cleanup
add_action( 'wp_scheduled_delete', array( $instance, 'daily_akismet_meta_cleanup' ) );
@@ -186,7 +186,7 @@ class Grunion_Contact_Form_Plugin {
'show_in_rest' => true,
'rest_controller_class' => 'Grunion_Contact_Form_Endpoint',
'capabilities' => array(
- 'create_posts' => false,
+ 'create_posts' => 'do_not_allow',
'publish_posts' => 'publish_pages',
'edit_posts' => 'edit_pages',
'edit_others_posts' => 'edit_others_pages',
@@ -1402,7 +1402,7 @@ class Grunion_Contact_Form_Plugin {
*
* Additionally, Excel exposes the ability to launch arbitrary commands through the DDE protocol.
*
- * @see http://www.contextis.com/resources/blog/comma-separated-vulnerabilities/
+ * @see https://www.contextis.com/en/blog/comma-separated-vulnerabilities
*
* @param string $field
*
@@ -1834,12 +1834,16 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
self::$current_form = $this;
$this->defaults = array(
- 'to' => $default_to,
- 'subject' => $default_subject,
- 'show_subject' => 'no', // only used in back-compat mode
- 'widget' => 0, // Not exposed to the user. Works with Grunion_Contact_Form_Plugin::widget_atts()
- 'id' => null, // Not exposed to the user. Set above.
- 'submit_button_text' => __( 'Submit', 'jetpack' ),
+ 'to' => $default_to,
+ 'subject' => $default_subject,
+ 'show_subject' => 'no', // only used in back-compat mode
+ 'widget' => 0, // Not exposed to the user. Works with Grunion_Contact_Form_Plugin::widget_atts()
+ 'id' => null, // Not exposed to the user. Set above.
+ 'submit_button_text' => __( 'Submit', 'jetpack' ),
+ // These attributes come from the block editor, so use camel case instead of snake case.
+ 'customThankyou' => '', // Whether to show a custom thankyou response after submitting a form. '' for no, 'message' for a custom message, 'redirect' to redirect to a new URL.
+ 'customThankyouMessage' => __( 'Thank you for your submission!', 'jetpack' ), // The message to show when customThankyou is set to 'message'.
+ 'customThankyouRedirect' => '', // The URL to redirect to when customThankyou is set to 'redirect'.
);
$attributes = shortcode_atts( $this->defaults, $attributes, 'contact-form' );
@@ -1935,8 +1939,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
* @return string HTML for the concat form.
*/
static function parse( $attributes, $content ) {
- require_once JETPACK__PLUGIN_DIR . '/sync/class.jetpack-sync-settings.php';
- if ( Jetpack_Sync_Settings::is_syncing() ) {
+ if ( Settings::is_syncing() ) {
return '';
}
// Create a new Grunion_Contact_Form object (this class)
@@ -2076,6 +2079,10 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
if ( is_user_logged_in() ) {
$r .= "\t\t" . wp_nonce_field( 'contact-form_' . $id, '_wpnonce', true, false ) . "\n"; // nonce and referer
}
+
+ if ( isset( $attributes['hasFormSettingsSet'] ) && $attributes['hasFormSettingsSet'] ) {
+ $r .= "\t\t<input type='hidden' name='is_block' value='1' />\n";
+ }
$r .= "\t\t<input type='hidden' name='contact-form-id' value='$id' />\n";
$r .= "\t\t<input type='hidden' name='action' value='grunion-contact-form' />\n";
$r .= "\t\t<input type='hidden' name='contact-form-hash' value='" . esc_attr( $form->hash ) . "' />\n";
@@ -2097,10 +2104,16 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
* @return string $message
*/
static function success_message( $feedback_id, $form ) {
+ if ( 'message' === $form->get_attribute( 'customThankyou' ) ) {
+ $message = wpautop( $form->get_attribute( 'customThankyouMessage' ) );
+ } else {
+ $message = '<blockquote class="contact-form-submission">'
+ . '<p>' . join( '</p><p>', self::get_compiled_form( $feedback_id, $form ) ) . '</p>'
+ . '</blockquote>';
+ }
+
return wp_kses(
- '<blockquote class="contact-form-submission">'
- . '<p>' . join( self::get_compiled_form( $feedback_id, $form ), '</p><p>' ) . '</p>'
- . '</blockquote>',
+ $message,
array(
'br' => array(),
'blockquote' => array( 'class' => array() ),
@@ -2540,6 +2553,10 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
$i++; // Increment prefix counter for the next extra field
}
+ if ( isset( $_REQUEST['is_block'] ) && $_REQUEST['is_block'] ) {
+ $extra_values['is_block'] = true;
+ }
+
$contact_form_subject = trim( $contact_form_subject );
$comment_author_IP = Grunion_Contact_Form_Plugin::get_ip_address();
@@ -2616,7 +2633,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
$to[ $to_key ] = self::add_name_to_address( $to_value );
}
- $blog_url = parse_url( site_url() );
+ $blog_url = wp_parse_url( site_url() );
$from_email_addr = 'wordpress@' . $blog_url['host'];
if ( ! empty( $comment_author_email ) ) {
@@ -2724,7 +2741,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
array_push( $message, '<p>' . __( 'Sent by an unverified visitor to your site.', 'jetpack' ) . '</p>' );
}
- $message = join( $message, '' );
+ $message = join( '', $message );
/**
* Filters the message sent via email after a successful form submission.
@@ -2813,21 +2830,36 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
return self::success_message( $post_id, $this );
}
- $redirect = wp_get_referer();
- if ( ! $redirect ) { // wp_get_referer() returns false if the referer is the same as the current page
- $redirect = $_SERVER['REQUEST_URI'];
+ $redirect = '';
+ $custom_redirect = false;
+ if ( 'redirect' === $this->get_attribute( 'customThankyou' ) ) {
+ $custom_redirect = true;
+ $redirect = esc_url( $this->get_attribute( 'customThankyouRedirect' ) );
}
- $redirect = add_query_arg(
- urlencode_deep(
- array(
- 'contact-form-id' => $id,
- 'contact-form-sent' => $post_id,
- 'contact-form-hash' => $this->hash,
- '_wpnonce' => wp_create_nonce( "contact-form-sent-{$post_id}" ), // wp_nonce_url HTMLencodes :(
- )
- ), $redirect
- );
+ if ( ! $redirect ) {
+ $custom_redirect = false;
+ $redirect = wp_get_referer();
+ }
+
+ if ( ! $redirect ) { // wp_get_referer() returns false if the referer is the same as the current page.
+ $custom_redirect = false;
+ $redirect = $_SERVER['REQUEST_URI'];
+ }
+
+ if ( ! $custom_redirect ) {
+ $redirect = add_query_arg(
+ urlencode_deep(
+ array(
+ 'contact-form-id' => $id,
+ 'contact-form-sent' => $post_id,
+ 'contact-form-hash' => $this->hash,
+ '_wpnonce' => wp_create_nonce( "contact-form-sent-{$post_id}" ), // wp_nonce_url HTMLencodes :( .
+ )
+ ),
+ $redirect
+ );
+ }
/**
* Filter the URL where the reader is redirected after submitting a form.
@@ -2842,7 +2874,8 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode {
*/
$redirect = apply_filters( 'grunion_contact_form_redirect_url', $redirect, $id, $post_id );
- wp_safe_redirect( $redirect );
+ // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- We intentially allow external redirects here.
+ wp_redirect( $redirect );
exit;
}
@@ -3363,12 +3396,23 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
}
function render_date_field( $id, $label, $value, $class, $required, $required_field_text, $placeholder ) {
+
$field = $this->render_label( 'date', $id, $label, $required, $required_field_text );
$field .= $this->render_input_field( 'text', $id, $value, $class, $placeholder, $required );
+ /* For AMP requests, use amp-date-picker element: https://amp.dev/documentation/components/amp-date-picker */
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ return sprintf(
+ '<%1$s mode="overlay" layout="container" type="single" input-selector="[name=%2$s]">%3$s</%1$s>',
+ 'amp-date-picker',
+ esc_attr( $id ),
+ $field
+ );
+ }
+
wp_enqueue_script(
'grunion-frontend',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/contact-form/js/grunion-frontend.min.js',
'modules/contact-form/js/grunion-frontend.js'
),
@@ -3499,3 +3543,61 @@ function grunion_delete_old_spam() {
wp_schedule_single_event( time() + 700, 'grunion_scheduled_delete' );
}
}
+
+/**
+ * Send an event to Tracks on form submission.
+ *
+ * @param int $post_id - the post_id for the CPT that is created.
+ * @param array $all_values - fields from the default contact form.
+ * @param array $extra_values - extra fields added to from the contact form.
+ *
+ * @return null|void
+ */
+function jetpack_tracks_record_grunion_pre_message_sent( $post_id, $all_values, $extra_values ) {
+ // Do not do anything if the submission is not from a block.
+ if (
+ ! isset( $extra_values['is_block'] )
+ || ! $extra_values['is_block']
+ ) {
+ return;
+ }
+
+ /*
+ * Event details.
+ */
+ $event_user = wp_get_current_user();
+ $event_name = 'contact_form_block_message_sent';
+ $event_props = array(
+ 'entry_permalink' => esc_url( $all_values['entry_permalink'] ),
+ 'feedback_id' => esc_attr( $all_values['feedback_id'] ),
+ );
+
+ /*
+ * Record event.
+ * We use different libs on wpcom and Jetpack.
+ */
+ if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
+ $event_name = 'wpcom_' . $event_name;
+ $event_props['blog_id'] = get_current_blog_id();
+ // If the form was sent by a logged out visitor, record event with blog owner.
+ if ( empty( $event_user->ID ) ) {
+ $event_user_id = wpcom_get_blog_owner( $event_props['blog_id'] );
+ $event_user = get_userdata( $event_user_id );
+ }
+
+ require_lib( 'tracks/client' );
+ tracks_record_event( $event_user, $event_name, $event_props );
+ } else {
+ // If the form was sent by a logged out visitor, record event with Jetpack master user.
+ if ( empty( $event_user->ID ) ) {
+ $master_user_id = Jetpack_Options::get_option( 'master_user' );
+ if ( ! empty( $master_user_id ) ) {
+ $event_user = get_userdata( $master_user_id );
+ }
+ }
+
+ $tracking = new Automattic\Jetpack\Tracking();
+ $tracking->record_user_event( $event_name, $event_props, $event_user );
+ }
+}
+add_action( 'grunion_pre_message_sent', 'jetpack_tracks_record_grunion_pre_message_sent', 12, 3 );
diff --git a/plugins/jetpack/modules/contact-form/grunion-editor-view.php b/plugins/jetpack/modules/contact-form/grunion-editor-view.php
index d1ba0439..b8ff5c0c 100644
--- a/plugins/jetpack/modules/contact-form/grunion-editor-view.php
+++ b/plugins/jetpack/modules/contact-form/grunion-editor-view.php
@@ -1,9 +1,11 @@
<?php
+use Automattic\Jetpack\Assets;
+
/*
* A prototype to allow inline editing / editor views for contact forms.\
*
- * Originally developed in: http://github.com/automattic/gm2016-grunion-editor
+ * Originally developed in: https://github.com/automattic/gm2016-grunion-editor
* Authors: Michael Arestad, Andrew Ozz, and George Stephanis
*/
@@ -39,7 +41,7 @@ class Grunion_Editor_View {
}
public static function mce_external_plugins( $plugin_array ) {
- $plugin_array['grunion_form'] = Jetpack::get_file_url_for_environment(
+ $plugin_array['grunion_form'] = Assets::get_file_url_for_environment(
'_inc/build/contact-form/js/tinymce-plugin-form-button.min.js',
'modules/contact-form/js/tinymce-plugin-form-button.js'
);
@@ -69,7 +71,7 @@ class Grunion_Editor_View {
wp_style_add_data( 'grunion-editor-ui', 'rtl', 'replace' );
wp_enqueue_script(
'grunion-editor-view',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/contact-form/js/editor-view.min.js',
'modules/contact-form/js/editor-view.js'
),
diff --git a/plugins/jetpack/modules/contact-form/grunion-form-view.php b/plugins/jetpack/modules/contact-form/grunion-form-view.php
index 26ed6dfe..d5b32602 100644
--- a/plugins/jetpack/modules/contact-form/grunion-form-view.php
+++ b/plugins/jetpack/modules/contact-form/grunion-form-view.php
@@ -1,4 +1,7 @@
<?php
+
+use Automattic\Jetpack\Assets;
+
/**
* Template for form builder
*/
@@ -16,7 +19,7 @@ $max_new_fields = apply_filters( 'grunion_max_new_fields', 5 );
wp_register_script(
'grunion',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/contact-form/js/grunion.min.js',
'modules/contact-form/js/grunion.js'
),
@@ -154,7 +157,7 @@ wp_localize_script(
</style>
</head>
-<body
+<body
<?php
if ( is_rtl() ) {
echo 'class="rtl"'; }
diff --git a/plugins/jetpack/modules/contact-form/js/grunion.js b/plugins/jetpack/modules/contact-form/js/grunion.js
index e34fc135..65c3ab01 100644
--- a/plugins/jetpack/modules/contact-form/js/grunion.js
+++ b/plugins/jetpack/modules/contact-form/js/grunion.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false, devel: true, smarttabs: true */
/* global GrunionFB_i18n: true, FB, ajax_nonce_shortcode, ajax_nonce_json, ajaxurl, postId */
if ( ! window.FB ) {
@@ -710,7 +709,7 @@ FB.ContactForm = ( function() {
}
/* Uses The Official Standard: RFC 5322 -- http://www.regular-expressions.info/email.html */
function validateEmail( email ) {
- var re = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
+ var re = /^(?=[a-z0-9@.!#$%&'*+/=?^_`{|}~-]{6,254}$)(?=[a-z0-9.!#$%&'*+/=?^_`{|}~-]{1,64}@)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:(?=[a-z0-9-]{1,63}\.)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?=[a-z0-9-]{1,63}$)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
return re.test( email );
}
function updateLabel() {
diff --git a/plugins/jetpack/modules/copy-post.php b/plugins/jetpack/modules/copy-post.php
index 1ae33ced..54cfc088 100644
--- a/plugins/jetpack/modules/copy-post.php
+++ b/plugins/jetpack/modules/copy-post.php
@@ -1,8 +1,7 @@
<?php
/**
* Module Name: Copy Post
- * Module Description: Copy an existing post's content into a new draft post
- * Jumpstart Description: Copy an existing post's content into a new draft post
+ * Module Description: Enable the option to copy entire posts and pages, including tags and settings
* Sort Order: 15
* First Introduced: 7.0
* Requires Connection: No
diff --git a/plugins/jetpack/modules/custom-content-types.php b/plugins/jetpack/modules/custom-content-types.php
index 5976bfc1..e213e258 100644
--- a/plugins/jetpack/modules/custom-content-types.php
+++ b/plugins/jetpack/modules/custom-content-types.php
@@ -39,7 +39,7 @@ function jetpack_cpt_section_callback() {
?>
<p>
<?php esc_html_e( 'Use these settings to display different types of content on your site.', 'jetpack' ); ?>
- <a target="_blank" href="http://jetpack.com/support/custom-content-types/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
+ <a target="_blank" href="https://jetpack.com/support/custom-content-types/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
</p>
<?php
}
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
index e92669da..8d977516 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
@@ -19,9 +19,9 @@
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
- * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
+ * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
@@ -64,7 +64,7 @@ require( dirname( __FILE__ ) . '/class.csstidy_optimise.php' );
* In opposite to most other CSS parsers, it does not use regular expressions and
* thus has full CSS2 support and a higher reliability.
* Additional to that it applies some optimisations and fixes to the CSS code.
- * An online version should be available here: http://cdburnerxp.se/cssparse/css_optimiser.php
+ * An online version should be available here: https://cdburnerxp.se/cssparse/css_optimiser.php
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005-2006
* @version 1.3.1
@@ -406,10 +406,10 @@ class csstidy {
$add = '';
$replaced = false;
- while ($i < strlen($string) && (ctype_xdigit($string{$i}) || ctype_space($string{$i})) && strlen($add) < 6) {
- $add .= $string{$i};
+ while ($i < strlen($string) && (ctype_xdigit($string[$i]) || ctype_space($string[$i])) && strlen($add) < 6) {
+ $add .= $string[$i];
- if (ctype_space($string{$i})) {
+ if (ctype_space($string[$i])) {
break;
}
$i++;
@@ -423,12 +423,12 @@ class csstidy {
$add = trim('\\' . $add);
}
- if (@ctype_xdigit($string{$i + 1}) && ctype_space($string{$i})
- && !$replaced || !ctype_space($string{$i})) {
+ if (@ctype_xdigit($string[$i + 1]) && ctype_space($string[$i])
+ && !$replaced || !ctype_space($string[$i])) {
$i--;
}
- if ($add !== '\\' || !$this->get_cfg('remove_bslash') || strpos($this->tokens_list, $string{$i + 1}) !== false) {
+ if ($add !== '\\' || !$this->get_cfg('remove_bslash') || strpos($this->tokens_list, $string[$i + 1]) !== false) {
return $add;
}
@@ -530,7 +530,7 @@ class csstidy {
* @version 1.11
*/
function is_token(&$string, $i) {
- return (strpos($this->tokens_list, $string{$i}) !== false && !csstidy::escaped($string, $i));
+ return (strpos($this->tokens_list, $string[$i]) !== false && !csstidy::escaped($string, $i));
}
/**
@@ -559,7 +559,7 @@ class csstidy {
$cur_comment = '';
for ($i = 0, $size = strlen($string); $i < $size; $i++) {
- if ($string{$i} === "\n" || $string{$i} === "\r") {
+ if ($string[$i] === "\n" || $string[$i] === "\r") {
++$this->line;
}
@@ -567,28 +567,28 @@ class csstidy {
/* Case in at-block */
case 'at':
if (csstidy::is_token($string, $i)) {
- if ($string{$i} === '/' && @$string{$i + 1} === '*') {
+ if ($string[$i] === '/' && @$string[$i + 1] === '*') {
$this->status = 'ic';
++$i;
$this->from[] = 'at';
- } elseif ($string{$i} === '{') {
+ } elseif ($string[$i] === '{') {
$this->status = 'is';
$this->at = $this->css_new_media_section($this->at);
$this->_add_token(AT_START, $this->at);
- } elseif ($string{$i} === ',') {
+ } elseif ($string[$i] === ',') {
$this->at = trim($this->at) . ',';
- } elseif ($string{$i} === '\\') {
+ } elseif ($string[$i] === '\\') {
$this->at .= $this->_unicode($string, $i);
}
// fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5)
// '/' is included for ratios in Opera: (-o-min-device-pixel-ratio: 3/2)
- elseif (in_array($string{$i}, array('(', ')', ':', '.', '/'))) {
- $this->at .= $string{$i};
+ elseif (in_array($string[$i], array('(', ')', ':', '.', '/'))) {
+ $this->at .= $string[$i];
}
} else {
$lastpos = strlen($this->at) - 1;
- if (!( (ctype_space($this->at{$lastpos}) || csstidy::is_token($this->at, $lastpos) && $this->at{$lastpos} === ',') && ctype_space($string{$i}))) {
- $this->at .= $string{$i};
+ if (!( (ctype_space($this->at[$lastpos]) || csstidy::is_token($this->at, $lastpos) && $this->at[$lastpos] === ',') && ctype_space($string[$i]))) {
+ $this->at .= $string[$i];
}
}
break;
@@ -596,11 +596,11 @@ class csstidy {
/* Case in-selector */
case 'is':
if (csstidy::is_token($string, $i)) {
- if ($string{$i} === '/' && @$string{$i + 1} === '*' && trim($this->selector) == '') {
+ if ($string[$i] === '/' && @$string[$i + 1] === '*' && trim($this->selector) == '') {
$this->status = 'ic';
++$i;
$this->from[] = 'is';
- } elseif ($string{$i} === '@' && trim($this->selector) == '') {
+ } elseif ($string[$i] === '@' && trim($this->selector) == '') {
// Check for at-rule
$this->invalid_at = true;
foreach ($at_rules as $name => $type) {
@@ -616,24 +616,24 @@ class csstidy {
$this->selector = '@';
$invalid_at_name = '';
for ($j = $i + 1; $j < $size; ++$j) {
- if (!ctype_alpha($string{$j})) {
+ if (!ctype_alpha($string[$j])) {
break;
}
- $invalid_at_name .= $string{$j};
+ $invalid_at_name .= $string[$j];
}
$this->log('Invalid @-rule: ' . $invalid_at_name . ' (removed)', 'Warning');
}
- } elseif (($string{$i} === '"' || $string{$i} === "'")) {
- $this->cur_string[] = $string{$i};
+ } elseif (($string[$i] === '"' || $string[$i] === "'")) {
+ $this->cur_string[] = $string[$i];
$this->status = 'instr';
- $this->str_char[] = $string{$i};
+ $this->str_char[] = $string[$i];
$this->from[] = 'is';
/* fixing CSS3 attribute selectors, i.e. a[href$=".mp3" */
- $this->quoted_string[] = ($string{$i - 1} == '=' );
- } elseif ($this->invalid_at && $string{$i} === ';') {
+ $this->quoted_string[] = ($string[$i - 1] == '=' );
+ } elseif ($this->invalid_at && $string[$i] === ';') {
$this->invalid_at = false;
$this->status = 'is';
- } elseif ($string{$i} === '{') {
+ } elseif ($string[$i] === '{') {
$this->status = 'ip';
if($this->at == '') {
$this->at = $this->css_new_media_section(DEFAULT_AT);
@@ -641,28 +641,28 @@ class csstidy {
$this->selector = $this->css_new_selector($this->at,$this->selector);
$this->_add_token(SEL_START, $this->selector);
$this->added = false;
- } elseif ($string{$i} === '}') {
+ } elseif ($string[$i] === '}') {
$this->_add_token(AT_END, $this->at);
$this->at = '';
$this->selector = '';
$this->sel_separate = array();
- } elseif ($string{$i} === ',') {
+ } elseif ($string[$i] === ',') {
$this->selector = trim($this->selector) . ',';
$this->sel_separate[] = strlen($this->selector);
- } elseif ($string{$i} === '\\') {
+ } elseif ($string[$i] === '\\') {
$this->selector .= $this->_unicode($string, $i);
- } elseif ($string{$i} === '*' && @in_array($string{$i + 1}, array('.', '#', '[', ':'))) {
+ } elseif ($string[$i] === '*' && @in_array($string[$i + 1], array('.', '#', '[', ':'))) {
// remove unnecessary universal selector, FS#147
} else {
- $this->selector .= $string{$i};
+ $this->selector .= $string[$i];
}
} else {
$lastpos = strlen($this->selector) - 1;
- if ($lastpos == -1 || !( (ctype_space($this->selector{$lastpos}) || csstidy::is_token($this->selector, $lastpos) && $this->selector{$lastpos} === ',') && ctype_space($string{$i}))) {
- $this->selector .= $string{$i};
+ if ($lastpos == -1 || !( (ctype_space($this->selector[$lastpos]) || csstidy::is_token($this->selector, $lastpos) && $this->selector[$lastpos] === ',') && ctype_space($string[$i]))) {
+ $this->selector .= $string[$i];
}
- else if (ctype_space($string{$i}) && $this->get_cfg('preserve_css') && !$this->get_cfg('merge_selectors')) {
- $this->selector .= $string{$i};
+ else if (ctype_space($string[$i]) && $this->get_cfg('preserve_css') && !$this->get_cfg('merge_selectors')) {
+ $this->selector .= $string[$i];
}
}
break;
@@ -670,58 +670,58 @@ class csstidy {
/* Case in-property */
case 'ip':
if (csstidy::is_token($string, $i)) {
- if (($string{$i} === ':' || $string{$i} === '=') && $this->property != '') {
+ if (($string[$i] === ':' || $string[$i] === '=') && $this->property != '') {
$this->status = 'iv';
if (!$this->get_cfg('discard_invalid_properties') || csstidy::property_is_valid($this->property)) {
$this->property = $this->css_new_property($this->at,$this->selector,$this->property);
$this->_add_token(PROPERTY, $this->property);
}
- } elseif ($string{$i} === '/' && @$string{$i + 1} === '*' && $this->property == '') {
+ } elseif ($string[$i] === '/' && @$string[$i + 1] === '*' && $this->property == '') {
$this->status = 'ic';
++$i;
$this->from[] = 'ip';
- } elseif ($string{$i} === '}') {
+ } elseif ($string[$i] === '}') {
$this->explode_selectors();
$this->status = 'is';
$this->invalid_at = false;
$this->_add_token(SEL_END, $this->selector);
$this->selector = '';
$this->property = '';
- } elseif ($string{$i} === ';') {
+ } elseif ($string[$i] === ';') {
$this->property = '';
- } elseif ($string{$i} === '\\') {
+ } elseif ($string[$i] === '\\') {
$this->property .= $this->_unicode($string, $i);
}
// else this is dumb IE a hack, keep it
- elseif ($this->property=='' AND !ctype_space($string{$i})) {
- $this->property .= $string{$i};
+ elseif ($this->property=='' AND !ctype_space($string[$i])) {
+ $this->property .= $string[$i];
}
}
- elseif (!ctype_space($string{$i})) {
- $this->property .= $string{$i};
+ elseif (!ctype_space($string[$i])) {
+ $this->property .= $string[$i];
}
break;
/* Case in-value */
case 'iv':
- $pn = (($string{$i} === "\n" || $string{$i} === "\r") && $this->property_is_next($string, $i + 1) || $i == strlen($string) - 1);
- if ((csstidy::is_token($string, $i) || $pn) && (!($string{$i} == ',' && !ctype_space($string{$i+1})))) {
- if ($string{$i} === '/' && @$string{$i + 1} === '*') {
+ $pn = (($string[$i] === "\n" || $string[$i] === "\r") && $this->property_is_next($string, $i + 1) || $i == strlen($string) - 1);
+ if ((csstidy::is_token($string, $i) || $pn) && (!($string[$i] == ',' && !ctype_space($string[$i+1])))) {
+ if ($string[$i] === '/' && @$string[$i + 1] === '*') {
$this->status = 'ic';
++$i;
$this->from[] = 'iv';
- } elseif (($string{$i} === '"' || $string{$i} === "'" || $string{$i} === '(')) {
- $this->cur_string[] = $string{$i};
- $this->str_char[] = ($string{$i} === '(') ? ')' : $string{$i};
+ } elseif (($string[$i] === '"' || $string[$i] === "'" || $string[$i] === '(')) {
+ $this->cur_string[] = $string[$i];
+ $this->str_char[] = ($string[$i] === '(') ? ')' : $string[$i];
$this->status = 'instr';
$this->from[] = 'iv';
$this->quoted_string[] = in_array(strtolower($this->property), $quoted_string_properties);
- } elseif ($string{$i} === ',') {
+ } elseif ($string[$i] === ',') {
$this->sub_value = trim($this->sub_value) . ',';
- } elseif ($string{$i} === '\\') {
+ } elseif ($string[$i] === '\\') {
$this->sub_value .= $this->_unicode($string, $i);
- } elseif ($string{$i} === ';' || $pn) {
- if ($this->selector{0} === '@' && isset($at_rules[substr($this->selector, 1)]) && $at_rules[substr($this->selector, 1)] === 'iv') {
+ } elseif ($string[$i] === ';' || $pn) {
+ if ($this->selector[0] === '@' && isset($at_rules[substr($this->selector, 1)]) && $at_rules[substr($this->selector, 1)] === 'iv') {
$this->status = 'is';
switch ($this->selector) {
@@ -741,7 +741,7 @@ class csstidy {
if (empty($this->sub_value_arr)) {
// Quote URLs in imports only if they're not already inside url() and not already quoted.
if (substr($this->sub_value, 0, 4) != 'url(') {
- if (!($this->sub_value{0} == substr($this->sub_value, -1) && in_array($this->sub_value{0}, array("'", '"')))) {
+ if (!($this->sub_value[0] == substr($this->sub_value, -1) && in_array($this->sub_value[0], array("'", '"')))) {
$this->sub_value = '"' . $this->sub_value . '"';
}
}
@@ -759,10 +759,10 @@ class csstidy {
} else {
$this->status = 'ip';
}
- } elseif ($string{$i} !== '}') {
- $this->sub_value .= $string{$i};
+ } elseif ($string[$i] !== '}') {
+ $this->sub_value .= $string[$i];
}
- if (($string{$i} === '}' || $string{$i} === ';' || $pn) && !empty($this->selector)) {
+ if (($string[$i] === '}' || $string[$i] === ';' || $pn) && !empty($this->selector)) {
if ($this->at == '') {
$this->at = $this->css_new_media_section(DEFAULT_AT);
}
@@ -822,7 +822,7 @@ class csstidy {
$this->sub_value_arr = array();
$this->value = '';
}
- if ($string{$i} === '}') {
+ if ($string[$i] === '}') {
$this->explode_selectors();
$this->_add_token(SEL_END, $this->selector);
$this->status = 'is';
@@ -830,9 +830,9 @@ class csstidy {
$this->selector = '';
}
} elseif (!$pn) {
- $this->sub_value .= $string{$i};
+ $this->sub_value .= $string[$i];
- if (ctype_space($string{$i}) || $string{$i} == ',') {
+ if (ctype_space($string[$i]) || $string[$i] == ',') {
$this->optimise->subvalue();
if ($this->sub_value != '') {
$this->sub_value_arr[] = $this->sub_value;
@@ -846,26 +846,26 @@ class csstidy {
case 'instr':
$_str_char = $this->str_char[count($this->str_char)-1];
$_cur_string = $this->cur_string[count($this->cur_string)-1];
- $temp_add = $string{$i};
+ $temp_add = $string[$i];
// Add another string to the stack. Strings can't be nested inside of quotes, only parentheses, but
// parentheticals can be nested more than once.
- if ($_str_char === ")" && ($string{$i} === "(" || $string{$i} === '"' || $string{$i} === '\'') && !csstidy::escaped($string, $i)) {
- $this->cur_string[] = $string{$i};
- $this->str_char[] = $string{$i} == "(" ? ")" : $string{$i};
+ if ($_str_char === ")" && ($string[$i] === "(" || $string[$i] === '"' || $string[$i] === '\'') && !csstidy::escaped($string, $i)) {
+ $this->cur_string[] = $string[$i];
+ $this->str_char[] = $string[$i] == "(" ? ")" : $string[$i];
$this->from[] = 'instr';
- $this->quoted_string[] = !($string{$i} === "(");
+ $this->quoted_string[] = !($string[$i] === "(");
continue 2;
}
- if ($_str_char !== ")" && ($string{$i} === "\n" || $string{$i} === "\r") && !($string{$i - 1} === '\\' && !csstidy::escaped($string, $i - 1))) {
+ if ($_str_char !== ")" && ($string[$i] === "\n" || $string[$i] === "\r") && !($string[$i - 1] === '\\' && !csstidy::escaped($string, $i - 1))) {
$temp_add = "\\A";
$this->log('Fixed incorrect newline in string', 'Warning');
}
$_cur_string .= $temp_add;
- if ($string{$i} === $_str_char && !csstidy::escaped($string, $i)) {
+ if ($string[$i] === $_str_char && !csstidy::escaped($string, $i)) {
$_quoted_string = array_pop($this->quoted_string);
$this->status = array_pop($this->from);
@@ -918,13 +918,13 @@ class csstidy {
/* Case in-comment */
case 'ic':
- if ($string{$i} === '*' && $string{$i + 1} === '/') {
+ if ($string[$i] === '*' && $string[$i + 1] === '/') {
$this->status = array_pop($this->from);
$i++;
$this->_add_token(COMMENT, $cur_comment);
$cur_comment = '';
} else {
- $cur_comment .= $string{$i};
+ $cur_comment .= $string[$i];
}
break;
}
@@ -980,7 +980,7 @@ class csstidy {
* @version 1.02
*/
static function escaped(&$string, $pos) {
- return!(@($string{$pos - 1} !== '\\') || csstidy::escaped($string, $pos - 1));
+ return!(@($string[$pos - 1] !== '\\') || csstidy::escaped($string, $pos - 1));
}
/**
@@ -1208,30 +1208,30 @@ class csstidy {
$current_string = "";
for ($i = 0, $_len = strlen($value); $i < $_len; $i++) {
- if (($value{$i} == "," || $value{$i} === " ") && $in_str === true) {
+ if (($value[$i] == "," || $value[$i] === " ") && $in_str === true) {
$in_str = false;
$strings[] = $current_string;
$current_string = "";
}
- else if ($value{$i} == '"' || $value{$i} == "'"){
- if ($in_str === $value{$i}) {
+ else if ($value[$i] == '"' || $value[$i] == "'"){
+ if ($in_str === $value[$i]) {
$strings[] = $current_string;
$in_str = false;
$current_string = "";
continue;
}
else if (!$in_str) {
- $in_str = $value{$i};
+ $in_str = $value[$i];
}
}
else {
if ($in_str){
- $current_string .= $value{$i};
+ $current_string .= $value[$i];
}
else {
- if (!preg_match("/[\s,]/", $value{$i})) {
+ if (!preg_match("/[\s,]/", $value[$i])) {
$in_str = true;
- $current_string = $value{$i};
+ $current_string = $value[$i];
}
}
}
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_ctype.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_ctype.php
index bc5accc5..37e87f7d 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_ctype.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_ctype.php
@@ -22,7 +22,7 @@
* along with CSSTidy; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @license https://opensource.org/licenses/gpl-license.php GNU Public License
* @package csstidy
* @author Nikolay Matsievsky (speed at webo dot name) 2009-2010
* @version 1.0
@@ -43,4 +43,4 @@ if (!function_exists('ctype_alpha')) {
}
}
-?> \ No newline at end of file
+?>
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
index 176e0fd3..2d7996f0 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
@@ -21,9 +21,9 @@
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
- * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
+ * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
@@ -308,8 +308,8 @@ class csstidy_optimise {
// #aabbcc -> #abc
if (strlen($color) == 7) {
$color_temp = strtolower($color);
- if ($color_temp{0} === '#' && $color_temp{1} == $color_temp{2} && $color_temp{3} == $color_temp{4} && $color_temp{5} == $color_temp{6}) {
- $color = '#' . $color{1} . $color{3} . $color{5};
+ if ($color_temp[0] === '#' && $color_temp[1] == $color_temp[2] && $color_temp[3] == $color_temp[4] && $color_temp[5] == $color_temp[6]) {
+ $color = '#' . $color[1] . $color[3] . $color[5];
}
}
@@ -392,7 +392,7 @@ class csstidy_optimise {
*/
function AnalyseCssNumber($string) {
// most simple checks first
- if (strlen($string) == 0 || ctype_alpha($string{0})) {
+ if (strlen($string) == 0 || ctype_alpha($string[0])) {
return false;
}
@@ -557,22 +557,22 @@ class csstidy_optimise {
for ($i = 0, $len = strlen($string); $i < $len; $i++) {
switch ($status) {
case 'st':
- if ($string{$i} == $sep && !csstidy::escaped($string, $i)) {
+ if ($string[$i] == $sep && !csstidy::escaped($string, $i)) {
++$num;
- } elseif ($string{$i} === '"' || $string{$i} === '\'' || $string{$i} === '(' && !csstidy::escaped($string, $i)) {
+ } elseif ($string[$i] === '"' || $string[$i] === '\'' || $string[$i] === '(' && !csstidy::escaped($string, $i)) {
$status = 'str';
- $to = ($string{$i} === '(') ? ')' : $string{$i};
- (isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i};
+ $to = ($string[$i] === '(') ? ')' : $string[$i];
+ (isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i];
} else {
- (isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i};
+ (isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i];
}
break;
case 'str':
- if ($string{$i} == $to && !csstidy::escaped($string, $i)) {
+ if ($string[$i] == $to && !csstidy::escaped($string, $i)) {
$status = 'st';
}
- (isset($output[$num])) ? $output[$num] .= $string{$i} : $output[$num] = $string{$i};
+ (isset($output[$num])) ? $output[$num] .= $string[$i] : $output[$num] = $string[$i];
break;
}
}
@@ -626,6 +626,7 @@ class csstidy_optimise {
* @todo full CSS 3 compliance
*/
static function dissolve_short_bg($str_value) {
+ $have = array();
// don't try to explose background gradient !
if (stripos($str_value, "gradient(")!==FALSE)
return array('background'=>$str_value);
@@ -669,9 +670,9 @@ class csstidy_optimise {
$have['clip'] = true;
} elseif (in_array($str_value[$i][$j], $origin, true)) {
$return['background-origin'] .= $str_value[$i][$j] . ',';
- } elseif ($str_value[$i][$j]{0} === '(') {
+ } elseif ($str_value[$i][$j][0] === '(') {
$return['background-size'] .= substr($str_value[$i][$j], 1, -1) . ',';
- } elseif (in_array($str_value[$i][$j], $pos, true) || is_numeric($str_value[$i][$j]{0}) || $str_value[$i][$j]{0} === null || $str_value[$i][$j]{0} === '-' || $str_value[$i][$j]{0} === '.') {
+ } elseif (in_array($str_value[$i][$j], $pos, true) || is_numeric($str_value[$i][$j][0]) || $str_value[$i][$j][0] === null || $str_value[$i][$j][0] === '-' || $str_value[$i][$j][0] === '.') {
$return['background-position'] .= $str_value[$i][$j];
if (!$have['pos'])
$return['background-position'] .= ' '; else
@@ -784,6 +785,7 @@ class csstidy_optimise {
* @see merge_font()
*/
static function dissolve_short_font($str_value) {
+ $have = array();
$font_prop_default = & $GLOBALS['csstidy']['font_prop_default'];
$font_weight = array('normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900);
$font_variant = array('normal', 'small-caps');
@@ -818,7 +820,7 @@ class csstidy_optimise {
} elseif ($have['style'] === false && in_array($str_value[0][$j], $font_style)) {
$return['font-style'] = $str_value[0][$j];
$have['style'] = true;
- } elseif ($have['size'] === false && (is_numeric($str_value[0][$j]{0}) || $str_value[0][$j]{0} === null || $str_value[0][$j]{0} === '.')) {
+ } elseif ($have['size'] === false && (is_numeric($str_value[0][$j][0]) || $str_value[0][$j][0] === null || $str_value[0][$j][0] === '.')) {
$size = csstidy_optimise::explode_ws('/', trim($str_value[0][$j]));
$return['font-size'] = $size[0];
if (isset($size[1])) {
@@ -848,7 +850,7 @@ class csstidy_optimise {
// Fix for 100 and more font-size
if ($have['size'] === false && isset($return['font-weight']) &&
- is_numeric($return['font-weight']{0})) {
+ is_numeric($return['font-weight'][0])) {
$return['font-size'] = $return['font-weight'];
unset($return['font-weight']);
}
@@ -884,8 +886,8 @@ class csstidy_optimise {
$family = trim($family);
$len = strlen($family);
if (strpos($family, " ") &&
- !(($family{0} == '"' && $family{$len - 1} == '"') ||
- ($family{0} == "'" && $family{$len - 1} == "'"))) {
+ !(($family[0] == '"' && $family[$len - 1] == '"') ||
+ ($family[0] == "'" && $family[$len - 1] == "'"))) {
$family = '"' . $family . '"';
}
$result_families[] = $family;
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
index 56b95404..fc8cf628 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
@@ -20,9 +20,9 @@
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
- * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
+ * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
@@ -222,7 +222,7 @@ class csstidy_print {
case SEL_START:
if ($this->parser->get_cfg('lowercase_s'))
$token[1] = strtolower($token[1]);
- $out .= ( $token[1]{0} !== '@') ? $template[2] . $this->_htmlsp($token[1], $plain) : $template[0] . $this->_htmlsp($token[1], $plain);
+ $out .= ( $token[1][0] !== '@') ? $template[2] . $this->_htmlsp($token[1], $plain) : $template[0] . $this->_htmlsp($token[1], $plain);
$out .= $template[3];
break;
diff --git a/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css b/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css
index 54a7a9c9..522433be 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css
+++ b/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css
@@ -1,5 +1,5 @@
/* Do not modify this file directly. It is concatenated from individual module CSS files. */
-@import url("modules/custom-css/csstidy/cssparsed.css");
+@import url("./cssparsed.css");
html, body {
font:0.8em Verdana,Helvetica,sans-serif;
@@ -116,4 +116,4 @@ color:orange;
dd.Information {
color:green;
-} \ No newline at end of file
+}
diff --git a/plugins/jetpack/modules/custom-css/csstidy/cssparse.css b/plugins/jetpack/modules/custom-css/csstidy/cssparse.css
index bddd34f9..4dab9b50 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/cssparse.css
+++ b/plugins/jetpack/modules/custom-css/csstidy/cssparse.css
@@ -1,4 +1,4 @@
-@import url("modules/custom-css/csstidy/cssparsed.css");
+@import url("./cssparsed.css");
html, body {
font:0.8em Verdana,Helvetica,sans-serif;
@@ -115,4 +115,4 @@ color:orange;
dd.Information {
color:green;
-} \ No newline at end of file
+}
diff --git a/plugins/jetpack/modules/custom-css/csstidy/data.inc.php b/plugins/jetpack/modules/custom-css/csstidy/data.inc.php
index 9ed2e1c4..0cf8f9a3 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/data.inc.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/data.inc.php
@@ -18,7 +18,7 @@
* along with CSSTidy; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @license https://opensource.org/licenses/gpl-license.php GNU Public License
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005
* @author Nikolay Matsievsky (speed at webo dot name) 2010
diff --git a/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php b/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php
index d4c61114..0a3ad014 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/lang.inc.php
@@ -18,9 +18,9 @@
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
*
- * @license http://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
+ * @license https://opensource.org/licenses/lgpl-license.php GNU Lesser General Public License
* @package csstidy
* @author Florian Schmitz (floele at gmail dot com) 2005-2007
* @author Brett Zamir (brettz9 at yahoo dot com) 2007
@@ -45,7 +45,7 @@ $lang['en'][1] = 'CSS Formatter and Optimiser';
$lang['en'][2] = '(based on';
$lang['en'][3] = '(plaintext)';
$lang['en'][4] = 'Important Note:';
-$lang['en'][6] = 'Your code should be well-formed. This is <strong>not a validator</strong> which points out errors in your CSS code. To make sure that your code is valid, use the <a href="http://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
+$lang['en'][6] = 'Your code should be well-formed. This is <strong>not a validator</strong> which points out errors in your CSS code. To make sure that your code is valid, use the <a href="https://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
$lang['en'][7] = 'all comments are removed';
$lang['en'][8] = 'CSS Input:';
$lang['en'][9] = 'CSS-Code:';
@@ -112,7 +112,7 @@ $lang['de'][1] = 'CSS Formatierer und Optimierer';
$lang['de'][2] = '(basierend auf';
$lang['de'][3] = '(Textversion)';
$lang['de'][4] = 'Wichtiger Hinweis:';
-$lang['de'][6] = 'Der CSS Code sollte wohlgeformt sein. Der CSS Code wird <strong>nicht auf Gültigkeit überprüft</strong>. Um sicherzugehen dass dein Code valide ist, benutze den <a href="http://jigsaw.w3.org/css-validator/">W3C Validierungsservice</a>.';
+$lang['de'][6] = 'Der CSS Code sollte wohlgeformt sein. Der CSS Code wird <strong>nicht auf Gültigkeit überprüft</strong>. Um sicherzugehen dass dein Code valide ist, benutze den <a href="https://jigsaw.w3.org/css-validator/">W3C Validierungsservice</a>.';
$lang['de'][7] = 'alle Kommentare werden entfernt';
$lang['de'][8] = 'CSS Eingabe:';
$lang['de'][9] = 'CSS-Code:';
@@ -179,7 +179,7 @@ $lang['fr'][1] = 'CSS Formatteur et Optimiseur';
$lang['fr'][2] = '(basé sur ';
$lang['fr'][3] = '(Version texte)';
$lang['fr'][4] = 'Note Importante&#160;:';
-$lang['fr'][6] = 'Votre code doit être valide. Ce n’est <strong>pas un validateur</strong> qui signale les erreurs dans votre code CSS. Pour être sûr que votre code est correct, utilisez le validateur&#160;: <a href="http://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
+$lang['fr'][6] = 'Votre code doit être valide. Ce n’est <strong>pas un validateur</strong> qui signale les erreurs dans votre code CSS. Pour être sûr que votre code est correct, utilisez le validateur&#160;: <a href="https://jigsaw.w3.org/css-validator/">W3C Validator</a>.';
$lang['fr'][7] = 'tous les commentaires sont enlevés';
$lang['fr'][8] = 'Champ CSS&#160;:';
$lang['fr'][9] = 'Code CSS&#160;:';
@@ -246,7 +246,7 @@ $lang['zh'][1] = 'CSS整形與最佳化工具';
$lang['zh'][2] = '(使用';
$lang['zh'][3] = '(純文字)';
$lang['zh'][4] = '重要事項:';
-$lang['zh'][6] = '你的原始碼必須是良構的(well-formed). 這個工具<strong>沒有內建驗證器(validator)</strong>. 驗證器能夠指出你CSS原始碼裡的錯誤. 請使用 <a href="http://jigsaw.w3.org/css-validator/">W3C 驗證器</a>, 確保你的原始碼合乎規範.';
+$lang['zh'][6] = '你的原始碼必須是良構的(well-formed). 這個工具<strong>沒有內建驗證器(validator)</strong>. 驗證器能夠指出你CSS原始碼裡的錯誤. 請使用 <a href="https://jigsaw.w3.org/css-validator/">W3C 驗證器</a>, 確保你的原始碼合乎規範.';
$lang['zh'][7] = '所有註解都移除了';
$lang['zh'][8] = 'CSS 輸入:';
$lang['zh'][9] = 'CSS 原始碼:';
diff --git a/plugins/jetpack/modules/custom-css/custom-css-4.7.php b/plugins/jetpack/modules/custom-css/custom-css-4.7.php
index bb72caec..4a706f6c 100644
--- a/plugins/jetpack/modules/custom-css/custom-css-4.7.php
+++ b/plugins/jetpack/modules/custom-css/custom-css-4.7.php
@@ -1,4 +1,7 @@
<?php
+
+use Automattic\Jetpack\Assets;
+
/**
* Alternate Custom CSS source for 4.7 compat.
*
@@ -11,6 +14,7 @@
* Class Jetpack_Custom_CSS_Enhancements
*/
class Jetpack_Custom_CSS_Enhancements {
+
/**
* Set up the actions and filters needed for our compatability layer on top of core's Custom CSS implementation.
*/
@@ -57,15 +61,19 @@ class Jetpack_Custom_CSS_Enhancements {
wp_register_style( 'jetpack-codemirror', plugins_url( 'custom-css/css/codemirror.css', __FILE__ ), array(), '20120905' );
wp_register_style( 'jetpack-customizer-css', plugins_url( 'custom-css/css/customizer-control.css', __FILE__ ), array(), '20140728' );
wp_register_script( 'jetpack-codemirror', plugins_url( 'custom-css/js/codemirror.min.js', __FILE__ ), array(), '3.16', true );
- $src = Jetpack::get_file_url_for_environment(
+
+ $src = Assets::get_file_url_for_environment(
'_inc/build/custom-css/custom-css/js/core-customizer-css.core-4.9.min.js',
'modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js'
);
- wp_register_script( 'jetpack-customizer-css', $src, array( 'customize-controls', 'underscore' ), JETPACK__VERSION, true );
+ wp_register_script( 'jetpack-customizer-css', $src, array(
+ 'customize-controls',
+ 'underscore'
+ ), JETPACK__VERSION, true );
wp_register_script(
'jetpack-customizer-css-preview',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-css/custom-css/js/core-customizer-css-preview.min.js',
'modules/custom-css/custom-css/js/core-customizer-css-preview.js'
),
diff --git a/plugins/jetpack/modules/custom-css/custom-css.php b/plugins/jetpack/modules/custom-css/custom-css.php
index 6229014b..068b1f0b 100644
--- a/plugins/jetpack/modules/custom-css/custom-css.php
+++ b/plugins/jetpack/modules/custom-css/custom-css.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
class Jetpack_Custom_CSS {
static function init() {
add_action( 'switch_theme', array( __CLASS__, 'reset' ) );
@@ -24,7 +26,7 @@ class Jetpack_Custom_CSS {
! Jetpack_User_Agent_Info::is_ipad() &&
/**
* Should the Custom CSS module use ACE to process CSS.
- * @see http://ace.c9.io/
+ * @see https://ace.c9.io/
*
* @module custom-css
*
@@ -632,7 +634,7 @@ class Jetpack_Custom_CSS {
apply_filters(
'safecss_default_css',
__(
- "Welcome to Custom CSS!\n\nTo learn how this works, see http://wp.me/PEmnE-Bt",
+ "Welcome to Custom CSS!\n\nTo learn how this works, see https://wp.me/PEmnE-Bt",
'jetpack'
)
)
@@ -932,7 +934,7 @@ class Jetpack_Custom_CSS {
wp_enqueue_script( 'postbox' );
wp_enqueue_script(
'custom-css-editor',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-css/custom-css/js/css-editor.min.js',
'modules/custom-css/custom-css/js/css-editor.js'
),
@@ -949,7 +951,7 @@ class Jetpack_Custom_CSS {
wp_register_script( 'jetpack-css-codemirror', plugins_url( 'custom-css/js/codemirror.min.js', __FILE__ ), array(), '3.16', true );
wp_enqueue_script(
'jetpack-css-use-codemirror',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-css/custom-css/js/use-codemirror.min.js',
'modules/custom-css/custom-css/js/use-codemirror.js'
),
@@ -1004,7 +1006,7 @@ class Jetpack_Custom_CSS {
*
* @param string $str Intro text appearing above the Custom CSS editor.
*/
- echo apply_filters( 'safecss_intro_text', __( 'New to CSS? Start with a <a href="http://www.htmldog.com/guides/cssbeginner/" rel="noopener noreferrer" target="_blank">beginner tutorial</a>. Questions?
+ echo apply_filters( 'safecss_intro_text', __( 'New to CSS? Start with a <a href="https://www.htmldog.com/guides/css/beginner/" rel="noopener noreferrer" target="_blank">beginner tutorial</a>. Questions?
Ask in the <a href="https://wordpress.org/support/forum/themes-and-templates" rel="noopener noreferrer" target="_blank">Themes and Templates forum</a>.', 'jetpack' ) );
?></p>
<p class="css-support"><?php echo __( 'Note: Custom CSS will be reset when changing themes.', 'jetpack' ); ?></p>
@@ -1064,7 +1066,7 @@ class Jetpack_Custom_CSS {
*
* @param string $url Custom CSS limited width's support doc URL.
*/
- apply_filters( 'safecss_limit_width_link', 'http://jetpack.com/support/custom-css/#limited-width' )
+ apply_filters( 'safecss_limit_width_link', 'https://jetpack.com/support/custom-css/#limited-width' )
);
?>
diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.css b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.css
index 359717bf..9450df66 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.css
+++ b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.css
@@ -199,7 +199,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
.CodeMirror-code pre {
border-left: 30px solid transparent;
width: -webkit-fit-content;
- width: -moz-fit-content;
width: fit-content;
}
.CodeMirror-wrap .CodeMirror-code pre {
diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css
index bb4ede28..4e4255ba 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css
+++ b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css
@@ -1 +1 @@
-.rtl .CodeMirror{direction:rtl}.CodeMirror{font-family:monospace;height:400px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-left:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 5px 0 3px;min-width:20px;text-align:left;color:#999}.CodeMirror div.CodeMirror-cursor{border-right:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-right:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-left:-30px;padding-bottom:30px;padding-left:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{left:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;right:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{left:0;bottom:0}.CodeMirror-gutter-filler{right:0;bottom:0}.CodeMirror-gutters{position:absolute;right:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-left:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-left:none;width:auto}.CodeMirror-linebackground{position:absolute;right:0;left:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-left:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}} \ No newline at end of file
+.rtl .CodeMirror{direction:rtl}.CodeMirror{font-family:monospace;height:400px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-left:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 5px 0 3px;min-width:20px;text-align:left;color:#999}.CodeMirror div.CodeMirror-cursor{border-right:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-right:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-left:-30px;padding-bottom:30px;padding-left:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{left:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;right:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{left:0;bottom:0}.CodeMirror-gutter-filler{right:0;bottom:0}.CodeMirror-gutters{position:absolute;right:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-left:30px solid transparent;width:-webkit-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-left:none;width:auto}.CodeMirror-linebackground{position:absolute;right:0;left:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-left:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css
index 92af420a..e7b11f4b 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css
+++ b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css
@@ -1,2 +1,2 @@
/* Do not modify this file directly. It is concatenated from individual module CSS files. */
-.rtl .CodeMirror{direction:ltr}.CodeMirror{font-family:monospace;height:400px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:none;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}} \ No newline at end of file
+.rtl .CodeMirror{direction:ltr}.CodeMirror{font-family:monospace;height:400px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:none;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css b/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css
index e7927ff2..1076f0c5 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css
+++ b/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css
@@ -44,11 +44,7 @@
padding-top: 3px;
opacity: .8;
}
-@-moz-document url-prefix() {
- #customize-control-wpcom_custom_css_content_width_control input[type="text"] + span {
- top: 47px;
- }
-}
+
#customize-control-wpcom_custom_css_content_width_control input[type="text"]:focus + span {
opacity: 1;
}
@@ -147,4 +143,3 @@ body.editing-css .wp-full-overlay.expanded {
input[type=jetpackCss] {
display: none;
}
-
diff --git a/plugins/jetpack/modules/custom-css/custom-css/js/css-editor.js b/plugins/jetpack/modules/custom-css/custom-css/js/css-editor.js
index 9b17d73f..65467aea 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/js/css-editor.js
+++ b/plugins/jetpack/modules/custom-css/custom-css/js/css-editor.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false, smarttabs: true */
/* global postboxes, addLoadEvent */
( function( $ ) {
diff --git a/plugins/jetpack/modules/custom-css/custom-css/js/use-codemirror.js b/plugins/jetpack/modules/custom-css/custom-css/js/use-codemirror.js
index 60439308..5ad75510 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/js/use-codemirror.js
+++ b/plugins/jetpack/modules/custom-css/custom-css/js/use-codemirror.js
@@ -1,5 +1,3 @@
-/* jshint onevar: false, smarttabs: true */
-
( function( $ ) {
var Jetpack_CSS = {
modes: {
diff --git a/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php b/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php
index ddaa4788..81662da7 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php
+++ b/plugins/jetpack/modules/custom-css/custom-css/preprocessors/lessc.inc.php
@@ -2,7 +2,7 @@
/**
* lessphp v0.5.0
- * http://leafo.net/lessphp
+ * https://leafo.net/lessphp
*
* LESS CSS compiler, adapted from http://lesscss.org
*
@@ -746,7 +746,7 @@ class lessc {
if ($suffix !== null &&
$subProp[0] == "assign" &&
is_string($subProp[1]) &&
- $subProp[1]{0} != $this->vPrefix)
+ $subProp[1][0] != $this->vPrefix)
{
$subProp[2] = array(
'list', ' ',
@@ -999,14 +999,7 @@ class lessc {
// IE8 can't handle data uris larger than 32KB
if($fsize/1024 < 32) {
if(is_null($mime)) {
- if(class_exists('finfo')) { // php 5.3+
- // phpcs:ignore PHPCompatibility.PHP.NewClasses.finfoFound
- $finfo = new finfo(FILEINFO_MIME);
- $mime = explode('; ', $finfo->file($fullpath));
- $mime = $mime[0];
- } elseif(function_exists('mime_content_type')) { // PHP 5.2
- $mime = mime_content_type($fullpath);
- }
+ $mime = jetpack_mime_content_type( $fullpath );
}
if(!is_null($mime)) // fallback if the mime type is still unknown
@@ -1202,7 +1195,7 @@ class lessc {
// mixes two colors by weight
// mix(@color1, @color2, [@weight: 50%]);
- // http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
+ // https://sass-lang.com/documentation/functions/color#mix
protected function lib_mix($args) {
if ($args[0] != "list" || count($args[2]) < 2)
$this->throwError("mix expects (color1, color2, weight)");
@@ -1858,7 +1851,7 @@ class lessc {
$this->pushEnv();
$parser = new lessc_parser($this, __METHOD__);
foreach ($args as $name => $strValue) {
- if ($name{0} != '@') $name = '@'.$name;
+ if ($name[0] != '@') $name = '@'.$name;
$parser->count = 0;
$parser->buffer = (string)$strValue;
if (!$parser->propertyValue($value)) {
@@ -2517,7 +2510,7 @@ class lessc_parser {
$hidden = true;
if (!isset($block->args)) {
foreach ($block->tags as $tag) {
- if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) {
+ if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) {
$hidden = false;
break;
}
@@ -2571,7 +2564,7 @@ class lessc_parser {
protected function fixTags($tags) {
// move @ tags out of variable namespace
foreach ($tags as &$tag) {
- if ($tag{0} == $this->lessc->vPrefix)
+ if ($tag[0] == $this->lessc->vPrefix)
$tag[0] = $this->lessc->mPrefix;
}
return $tags;
@@ -2593,7 +2586,7 @@ class lessc_parser {
/**
* Attempt to consume an expression.
- * @link http://en.wikipedia.org/wiki/Operator-precedence_parser#Pseudo-code
+ * @link https://en.wikipedia.org/wiki/Operator-precedence_parser#Pseudo-code
*/
protected function expression(&$out) {
if ($this->value($lhs)) {
diff --git a/plugins/jetpack/modules/custom-css/custom-css/preprocessors/scss.inc.php b/plugins/jetpack/modules/custom-css/custom-css/preprocessors/scss.inc.php
index 344b55f1..a59a653b 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/preprocessors/scss.inc.php
+++ b/plugins/jetpack/modules/custom-css/custom-css/preprocessors/scss.inc.php
@@ -4,10 +4,10 @@
*
* @copyright 2012-2013 Leaf Corcoran
*
- * @license http://opensource.org/licenses/gpl-license GPL-3.0
- * @license http://opensource.org/licenses/MIT MIT
+ * @license https://opensource.org/licenses/gpl-license GPL-3.0
+ * @license https://opensource.org/licenses/MIT MIT
*
- * @link http://leafo.net/scssphp
+ * @link https://leafo.net/scssphp
*/
/**
@@ -2380,7 +2380,7 @@ class scssc {
/**
* CSS Colors
*
- * @see http://www.w3.org/TR/css3-color
+ * @see https://www.w3.org/TR/css-color-3/
*/
static protected $cssColors = array(
'aliceblue' => '240,248,255',
diff --git a/plugins/jetpack/modules/custom-post-types/comics.php b/plugins/jetpack/modules/custom-post-types/comics.php
index 381e9b15..c67b1d97 100644
--- a/plugins/jetpack/modules/custom-post-types/comics.php
+++ b/plugins/jetpack/modules/custom-post-types/comics.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
class Jetpack_Comic {
const POST_TYPE = 'jetpack-comic';
@@ -7,7 +9,7 @@ class Jetpack_Comic {
static $instance = false;
if ( ! $instance )
- $instance = new Jetpack_Comic;
+ $instance = new Jetpack_Comic();
return $instance;
}
@@ -74,7 +76,6 @@ class Jetpack_Comic {
add_action( 'admin_footer-edit.php', array( $this, 'admin_footer' ) );
add_action( 'load-edit.php', array( $this, 'bulk_edit' ) );
add_action( 'admin_notices', array( $this, 'bulk_edit_notices' ) );
-
}
public function admin_footer() {
@@ -171,10 +172,9 @@ class Jetpack_Comic {
public function register_scripts() {
wp_enqueue_style( 'jetpack-comics-style', plugins_url( 'comics/comics.css', __FILE__ ) );
wp_style_add_data( 'jetpack-comics-style', 'rtl', 'replace' );
-
wp_enqueue_script(
'jetpack-comics',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-post-types/comics/comics.min.js',
'modules/custom-post-types/comics/comics.js'
),
@@ -280,7 +280,7 @@ class Jetpack_Comic {
* for Feedbag (the Reader's feed storage mechanism), eschew
* a pretty URL for one that will get the post into the Reader.
*
- * @see http://core.trac.wordpress.org/ticket/19744
+ * @see https://core.trac.wordpress.org/ticket/19744
* @param string $permalink The existing (possibly pretty) permalink.
*/
public function custom_permalink_for_feedbag( $permalink ) {
@@ -311,7 +311,7 @@ class Jetpack_Comic {
7 => esc_html__( 'Comic saved.', 'jetpack' ),
8 => sprintf( __( 'Comic submitted. <a target="_blank" href="%s">Preview comic</a>', 'jetpack'), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
9 => sprintf( __( 'Comic scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview comic</a>', 'jetpack' ),
- // translators: Publish box date format, see http://php.net/date
+ // translators: Publish box date format, see https://php.net/date
date_i18n( __( 'M j, Y @ G:i', 'jetpack' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post->ID) ) ),
10 => sprintf( __( 'Comic draft updated. <a target="_blank" href="%s">Preview comic</a>', 'jetpack' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
);
@@ -521,7 +521,7 @@ function comics_welcome_email( $welcome_email, $blog_id, $user_id, $password, $t
Your webcomic's new site is ready to go. Get started by <a href=\"BLOG_URLwp-admin/customize.php#title\">setting your comic's title and tagline</a> so your readers know what it's all about.
-Looking for more help with setting up your site? Check out the WordPress.com <a href=\"http://learn.wordpress.com/\" target=\"_blank\">beginner's tutorial</a> and the <a href=\"http://en.support.wordpress.com/comics/\" target=\"_blank\">guide to comics on WordPress.com</a>. Dive right in by <a href=\"BLOG_URLwp-admin/customize.php#title\">publishing your first strip!</a>
+Looking for more help with setting up your site? Check out the WordPress.com <a href=\"https://learn.wordpress.com/\" target=\"_blank\">beginner's tutorial</a> and the <a href=\"https://en.support.wordpress.com/comics/\" target=\"_blank\">guide to comics on WordPress.com</a>. Dive right in by <a href=\"BLOG_URLwp-admin/customize.php#title\">publishing your first strip!</a>
Lots of laughs,
The WordPress.com Team", 'jetpack' );
diff --git a/plugins/jetpack/modules/custom-post-types/comics/comics.js b/plugins/jetpack/modules/custom-post-types/comics/comics.js
index 159cf3bd..3e9d708b 100644
--- a/plugins/jetpack/modules/custom-post-types/comics/comics.js
+++ b/plugins/jetpack/modules/custom-post-types/comics/comics.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false, smarttabs: true, devel: true */
/* global Jetpack_Comics_Options */
jQuery( function( $ ) {
diff --git a/plugins/jetpack/modules/custom-post-types/js/many-items.js b/plugins/jetpack/modules/custom-post-types/js/many-items.js
index 3e67e143..5f8eee9d 100644
--- a/plugins/jetpack/modules/custom-post-types/js/many-items.js
+++ b/plugins/jetpack/modules/custom-post-types/js/many-items.js
@@ -1,5 +1,3 @@
-/* jshint onevar: false, smarttabs: true */
-
( function( $ ) {
var menuSelector, nonceInput, methods;
diff --git a/plugins/jetpack/modules/custom-post-types/js/menu-checkboxes.js b/plugins/jetpack/modules/custom-post-types/js/menu-checkboxes.js
index 601f1bd7..d83952b3 100644
--- a/plugins/jetpack/modules/custom-post-types/js/menu-checkboxes.js
+++ b/plugins/jetpack/modules/custom-post-types/js/menu-checkboxes.js
@@ -1,5 +1,3 @@
-/* jshint onevar: false, smarttabs: true, devel: true */
-
( function( $ ) {
var NovaCheckBoxes = {
inputs: null,
diff --git a/plugins/jetpack/modules/custom-post-types/js/nova-drag-drop.js b/plugins/jetpack/modules/custom-post-types/js/nova-drag-drop.js
index d7291e96..7c57d287 100644
--- a/plugins/jetpack/modules/custom-post-types/js/nova-drag-drop.js
+++ b/plugins/jetpack/modules/custom-post-types/js/nova-drag-drop.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false, smarttabs: true */
/* global _novaDragDrop */
( function( $ ) {
diff --git a/plugins/jetpack/modules/custom-post-types/nova.php b/plugins/jetpack/modules/custom-post-types/nova.php
index 7301a314..b4cf0281 100644
--- a/plugins/jetpack/modules/custom-post-types/nova.php
+++ b/plugins/jetpack/modules/custom-post-types/nova.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
/*
* Put the following code in your theme's Food Menu Page Template to customize the markup of the menu.
@@ -51,7 +53,7 @@ class Nova_Restaurant {
static $instance = false;
if ( !$instance ) {
- $instance = new Nova_Restaurant;
+ $instance = new Nova_Restaurant();
}
if ( $menu_item_loop_markup ) {
@@ -278,7 +280,7 @@ class Nova_Restaurant {
8 => sprintf( __( 'Menu item submitted. <a target="_blank" href="%s">Preview item</a>', 'jetpack' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
/* translators: this is about a food menu */
9 => sprintf( __( 'Menu item scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview item</a>', 'jetpack' ),
- // translators: Publish box date format, see http://php.net/date
+ // translators: Publish box date format, see https://php.net/date
date_i18n( __( 'M j, Y @ G:i', 'jetpack' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post->ID) ) ),
/* translators: this is about a food menu */
10 => sprintf( __( 'Menu item draft updated. <a target="_blank" href="%s">Preview item</a>', 'jetpack' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
@@ -439,7 +441,7 @@ class Nova_Restaurant {
wp_register_script(
'nova-menu-checkboxes',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-post-types/js/menu-checkboxes.min.js',
'modules/custom-post-types/js/menu-checkboxes.js'
),
@@ -616,7 +618,7 @@ class Nova_Restaurant {
wp_enqueue_script(
'nova-drag-drop',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-post-types/js/nova-drag-drop.min.js',
'modules/custom-post-types/js/nova-drag-drop.js'
),
@@ -863,7 +865,7 @@ class Nova_Restaurant {
function enqueue_many_items_scripts() {
wp_enqueue_script(
'nova-many-items',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/custom-post-types/js/many-items.min.js',
'modules/custom-post-types/js/many-items.js'
),
diff --git a/plugins/jetpack/modules/custom-post-types/portfolios.php b/plugins/jetpack/modules/custom-post-types/portfolios.php
index dd3858ee..e41728fc 100644
--- a/plugins/jetpack/modules/custom-post-types/portfolios.php
+++ b/plugins/jetpack/modules/custom-post-types/portfolios.php
@@ -137,7 +137,7 @@ class Jetpack_Portfolio {
<label for="<?php echo esc_attr( self::OPTION_NAME ); ?>">
<input name="<?php echo esc_attr( self::OPTION_NAME ); ?>" id="<?php echo esc_attr( self::OPTION_NAME ); ?>" <?php echo checked( get_option( self::OPTION_NAME, '0' ), true, false ); ?> type="checkbox" value="1" />
<?php esc_html_e( 'Enable Portfolio Projects for this site.', 'jetpack' ); ?>
- <a target="_blank" href="http://en.support.wordpress.com/portfolios/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
+ <a target="_blank" href="https://en.support.wordpress.com/portfolios/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
</label>
<?php endif;
if ( get_option( self::OPTION_NAME, '0' ) || current_theme_supports( self::CUSTOM_POST_TYPE ) ) :
@@ -383,7 +383,7 @@ class Jetpack_Portfolio {
7 => esc_html__( 'Project saved.', 'jetpack' ),
8 => sprintf( __( 'Project submitted. <a target="_blank" href="%s">Preview project</a>', 'jetpack'), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
9 => sprintf( __( 'Project scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview project</a>', 'jetpack' ),
- // translators: Publish box date format, see http://php.net/date
+ // translators: Publish box date format, see https://php.net/date
date_i18n( __( 'M j, Y @ G:i', 'jetpack' ), strtotime( $post->post_date ) ), esc_url( get_permalink( $post->ID ) ) ),
10 => sprintf( __( 'Project item draft updated. <a target="_blank" href="%s">Preview project</a>', 'jetpack' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
);
diff --git a/plugins/jetpack/modules/custom-post-types/testimonial.php b/plugins/jetpack/modules/custom-post-types/testimonial.php
index ba427244..30b44a25 100644
--- a/plugins/jetpack/modules/custom-post-types/testimonial.php
+++ b/plugins/jetpack/modules/custom-post-types/testimonial.php
@@ -152,7 +152,7 @@ class Jetpack_Testimonial {
<label for="<?php echo esc_attr( self::OPTION_NAME ); ?>">
<input name="<?php echo esc_attr( self::OPTION_NAME ); ?>" id="<?php echo esc_attr( self::OPTION_NAME ); ?>" <?php echo checked( get_option( self::OPTION_NAME, '0' ), true, false ); ?> type="checkbox" value="1" />
<?php esc_html_e( 'Enable Testimonials for this site.', 'jetpack' ); ?>
- <a target="_blank" href="http://en.support.wordpress.com/testimonials/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
+ <a target="_blank" href="https://en.support.wordpress.com/testimonials/"><?php esc_html_e( 'Learn More', 'jetpack' ); ?></a>
</label>
<?php endif;
@@ -352,7 +352,7 @@ class Jetpack_Testimonial {
7 => esc_html__( 'Testimonial saved.', 'jetpack' ),
8 => sprintf( __( 'Testimonial submitted. <a target="_blank" href="%s">Preview testimonial</a>', 'jetpack'), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
9 => sprintf( __( 'Testimonial scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview testimonial</a>', 'jetpack' ),
- // translators: Publish box date format, see http://php.net/date
+ // translators: Publish box date format, see https://php.net/date
date_i18n( __( 'M j, Y @ G:i', 'jetpack' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post->ID) ) ),
10 => sprintf( __( 'Testimonial draft updated. <a target="_blank" href="%s">Preview testimonial</a>', 'jetpack' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
);
diff --git a/plugins/jetpack/modules/debug.php b/plugins/jetpack/modules/debug.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/debug.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php b/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php
index e4941537..7dcef493 100644
--- a/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php
+++ b/plugins/jetpack/modules/geo-location/class.jetpack-geo-location.php
@@ -249,7 +249,9 @@ class Jetpack_Geo_Location {
* Add the georss namespace during RSS generation.
*/
public function rss_namespace() {
- echo PHP_EOL . 'xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"' . PHP_EOL;
+ echo PHP_EOL . "\t" . 'xmlns:georss="http://www.georss.org/georss"';
+ echo PHP_EOL . "\t" . 'xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"';
+ echo PHP_EOL . "\t";
}
/**
diff --git a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php
index ddca0e46..5356e7f4 100644
--- a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php
+++ b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php
@@ -236,19 +236,15 @@ class Jetpack_Google_Analytics_Legacy {
global $product;
$product_sku_or_id = $product->get_sku() ? $product->get_sku() : "#" + $product->get_id();
wc_enqueue_js(
- "jQuery( function( $ ) {
- $( '.single_add_to_cart_button' ).click( function() {
- _gaq.push(['_trackEvent', 'Products', 'Add to Cart', '#" . esc_js( $product_sku_or_id ) . "']);
- } );
+ "$( '.single_add_to_cart_button' ).click( function() {
+ _gaq.push(['_trackEvent', 'Products', 'Add to Cart', '#" . esc_js( $product_sku_or_id ) . "']);
} );"
);
} else if ( is_woocommerce() ) { // any other page that uses templates (like product lists, archives, etc)
wc_enqueue_js(
- "jQuery( function( $ ) {
- $( '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)' ).click( function() {
- var label = $( this ).data( 'product_sku' ) ? $( this ).data( 'product_sku' ) : '#' + $( this ).data( 'product_id' );
- _gaq.push(['_trackEvent', 'Products', 'Add to Cart', label]);
- } );
+ "$( '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)' ).click( function() {
+ var label = $( this ).data( 'product_sku' ) ? $( this ).data( 'product_sku' ) : '#' + $( this ).data( 'product_id' );
+ _gaq.push(['_trackEvent', 'Products', 'Add to Cart', label]);
} );"
);
}
diff --git a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php
index 8d7cdf24..5c8655bd 100644
--- a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php
+++ b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php
@@ -20,7 +20,7 @@
/**
* Jetpack_Google_Analytics is the class that handles ALL of the plugin functionality.
* It helps us avoid name collisions
- * http://codex.wordpress.org/Writing_a_Plugin#Avoiding_Function_Name_Collisions
+ * https://codex.wordpress.org/Writing_a_Plugin#Avoiding_Function_Name_Collisions
*/
if ( ! defined( 'ABSPATH' ) ) {
diff --git a/plugins/jetpack/modules/gplus-authorship.php b/plugins/jetpack/modules/gplus-authorship.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/gplus-authorship.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/holiday-snow.php b/plugins/jetpack/modules/holiday-snow.php
deleted file mode 100644
index e8a94faa..00000000
--- a/plugins/jetpack/modules/holiday-snow.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer included in Jetpack.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/infinite-scroll.php b/plugins/jetpack/modules/infinite-scroll.php
index 687d2b63..27500718 100644
--- a/plugins/jetpack/modules/infinite-scroll.php
+++ b/plugins/jetpack/modules/infinite-scroll.php
@@ -149,7 +149,7 @@ class Jetpack_Infinite_Scroll_Extras {
}
// We made it this far, so gather the data needed to track IS views
- $settings['stats'] = 'blog=' . Jetpack_Options::get_option( 'id' ) . '&host=' . parse_url( get_option( 'home' ), PHP_URL_HOST ) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
+ $settings['stats'] = 'blog=' . Jetpack_Options::get_option( 'id' ) . '&host=' . wp_parse_url( get_option( 'home' ), PHP_URL_HOST ) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
// Pagetype parameter
$settings['stats'] .= '&x_pagetype=infinite';
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.js b/plugins/jetpack/modules/infinite-scroll/infinity.js
index 67eed745..24dd413e 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.js
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.js
@@ -1,3 +1,4 @@
+/* globals infiniteScroll, _wpmejsSettings, ga, _gaq, WPCOM_sharing_counts */
( function( $ ) {
// Open closure
// Local vars
@@ -7,7 +8,7 @@
var isIE = -1 != navigator.userAgent.search( 'MSIE' );
if ( isIE ) {
var IEVersion = navigator.userAgent.match( /MSIE\s?(\d+)\.?\d*;/ );
- var IEVersion = parseInt( IEVersion[ 1 ] );
+ IEVersion = parseInt( IEVersion[ 1 ] );
}
// HTTP ajaxurl when site is HTTPS causes Access-Control-Allow-Origin failure in Desktop and iOS Safari
@@ -176,12 +177,17 @@
width = $( 'body #' + this.footer.wrap ).outerWidth( false );
// Make the footer match the width of the page
- if ( width > 479 ) this.footer.find( '.container' ).css( 'width', width );
+ if ( width > 479 ) {
+ this.footer.find( '.container' ).css( 'width', width );
+ }
}
// Reveal footer
- if ( this.window.scrollTop() >= 350 ) self.footer.animate( { bottom: 0 }, 'fast' );
- else if ( this.window.scrollTop() < 350 ) self.footer.animate( { bottom: '-50px' }, 'fast' );
+ if ( this.window.scrollTop() >= 350 ) {
+ self.footer.animate( { bottom: 0 }, 'fast' );
+ } else if ( this.window.scrollTop() < 350 ) {
+ self.footer.animate( { bottom: '-50px' }, 'fast' );
+ }
};
/**
@@ -197,7 +203,9 @@
customized;
// If we're disabled, ready, or don't pass the check, bail.
- if ( this.disabled || ! this.ready || ! this.check() ) return;
+ if ( this.disabled || ! this.ready || ! this.check() ) {
+ return;
+ }
// Let's get going -- set ready to false to prevent
// multiple refreshes from occurring at once.
@@ -323,11 +331,14 @@
if (
this.conditional &&
( ! isIE || ! eval( this.conditional.replace( /%ver/g, IEVersion ) ) )
- )
- var style = false;
+ ) {
+ style = false;
+ }
// Append link tag if necessary
- if ( style ) document.getElementsByTagName( 'head' )[ 0 ].appendChild( style );
+ if ( style ) {
+ document.getElementsByTagName( 'head' )[ 0 ].appendChild( style );
+ }
} );
}
@@ -338,17 +349,19 @@
self.page++;
// Record pageview in WP Stats, if available.
- if ( stats )
+ if ( stats ) {
new Image().src =
document.location.protocol +
'//pixel.wp.com/g.gif?' +
stats +
'&post=0&baba=' +
Math.random();
+ }
// Add new posts to the postflair object
- if ( 'object' == typeof response.postflair && 'object' == typeof WPCOM_sharing_counts )
- WPCOM_sharing_counts = $.extend( WPCOM_sharing_counts, response.postflair );
+ if ( 'object' === typeof response.postflair && 'object' === typeof WPCOM_sharing_counts ) {
+ WPCOM_sharing_counts = $.extend( WPCOM_sharing_counts, response.postflair ); // eslint-disable-line no-global-assign
+ }
// Render the results
self.render.apply( self, arguments );
@@ -493,8 +506,11 @@
wrapperQty++;
} );
- if ( wrapperQty > 0 ) aveSetHeight = aveSetHeight / wrapperQty;
- else aveSetHeight = 0;
+ if ( wrapperQty > 0 ) {
+ aveSetHeight = aveSetHeight / wrapperQty;
+ } else {
+ aveSetHeight = 0;
+ }
// Load more posts if space permits, otherwise stop checking for a full viewport
if ( postsHeight < windowHeight && postsHeight + aveSetHeight < windowHeight ) {
@@ -615,8 +631,11 @@
var setData = setsInView.pop();
// If the first set of IS posts is in the same view as the posts loaded in the template by WordPress, determine how much of the view is comprised of IS-loaded posts
- if ( ( windowBottom - setData.top ) / windowSize < 0.5 ) pageNum = -1;
- else pageNum = setData.pageNum;
+ if ( ( windowBottom - setData.top ) / windowSize < 0.5 ) {
+ pageNum = -1;
+ } else {
+ pageNum = setData.pageNum;
+ }
} else {
var majorityPercentageInView = 0;
@@ -627,15 +646,20 @@
percentOfView = 0;
// Figure percentage of view the current set represents
- if ( setData.top > windowTop && setData.top < windowBottom )
+ if ( setData.top > windowTop && setData.top < windowBottom ) {
topInView = ( windowBottom - setData.top ) / windowSize;
+ }
- if ( setData.bottom > windowTop && setData.bottom < windowBottom )
+ if ( setData.bottom > windowTop && setData.bottom < windowBottom ) {
bottomInView = ( setData.bottom - windowTop ) / windowSize;
+ }
// Figure out largest percentage of view for current set
- if ( topInView >= bottomInView ) percentOfView = topInView;
- else if ( bottomInView >= topInView ) percentOfView = bottomInView;
+ if ( topInView >= bottomInView ) {
+ percentOfView = topInView;
+ } else if ( bottomInView >= topInView ) {
+ percentOfView = bottomInView;
+ }
// Does current set's percentage of view supplant the largest previously-found set?
if ( percentOfView > majorityPercentageInView ) {
@@ -647,7 +671,7 @@
// If a page number could be determined, update the URL
// -1 indicates that the original requested URL should be used.
- if ( 'number' == typeof pageNum ) {
+ if ( 'number' === typeof pageNum ) {
self.updateURL( pageNum );
}
};
@@ -662,14 +686,16 @@
return;
}
var self = this,
+ pageSlug = self.origURL;
+
+ if ( -1 !== page ) {
pageSlug =
- -1 == page
- ? self.origURL
- : window.location.protocol +
- '//' +
- self.history.host +
- self.history.path.replace( /%d/, page ) +
- self.history.parameters;
+ window.location.protocol +
+ '//' +
+ self.history.host +
+ self.history.path.replace( /%d/, page ) +
+ self.history.parameters;
+ }
if ( window.location.href != pageSlug ) {
history.pushState( null, null, pageSlug );
@@ -695,7 +721,9 @@
*/
$( document ).ready( function() {
// Check for our variables
- if ( 'object' != typeof infiniteScroll ) return;
+ if ( 'object' !== typeof infiniteScroll ) {
+ return;
+ }
$( document.body ).addClass( infiniteScroll.settings.body_class );
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.php b/plugins/jetpack/modules/infinite-scroll/infinity.php
index 35193cfc..6b8d3775 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.php
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.php
@@ -1,14 +1,16 @@
<?php
+use Automattic\Jetpack\Assets;
+
/*
Plugin Name: The Neverending Home Page.
-Plugin URI: http://automattic.com/
+Plugin URI: https://automattic.com/
Description: Adds infinite scrolling support to the front-end blog post view for themes, pulling the next set of posts automatically into view when the reader approaches the bottom of the page.
Version: 1.1
Author: Automattic
-Author URI: http://automattic.com/
+Author URI: https://automattic.com/
License: GNU General Public License v2 or later
-License URI: http://www.gnu.org/licenses/gpl-2.0.html
+License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
/**
@@ -16,6 +18,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
* styling from each theme; including fixed footer.
*/
class The_Neverending_Home_Page {
+
/**
* Register actions and filters, plus parse IS settings
*
@@ -432,7 +435,7 @@ class The_Neverending_Home_Page {
// Add our scripts.
wp_register_script(
'the-neverending-homepage',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/infinite-scroll/infinity.min.js',
'modules/infinite-scroll/infinity.js'
),
@@ -1608,7 +1611,7 @@ function the_neverending_home_page_init() {
if ( ! current_theme_supports( 'infinite-scroll' ) )
return;
- new The_Neverending_Home_Page;
+ new The_Neverending_Home_Page();
}
add_action( 'init', 'the_neverending_home_page_init', 20 );
diff --git a/plugins/jetpack/modules/latex.php b/plugins/jetpack/modules/latex.php
index 340dfa9f..c006bafa 100644
--- a/plugins/jetpack/modules/latex.php
+++ b/plugins/jetpack/modules/latex.php
@@ -1,7 +1,7 @@
<?php
/**
* Module Name: Beautiful Math
- * Module Description: Use the LaTeX markup language to write mathematical equations and formulas.
+ * Module Description: Use the LaTeX markup language to write mathematical equations and formulas
* Sort Order: 12
* First Introduced: 1.1
* Requires Connection: No
diff --git a/plugins/jetpack/modules/lazy-images.php b/plugins/jetpack/modules/lazy-images.php
index 57df7706..6476a7a9 100644
--- a/plugins/jetpack/modules/lazy-images.php
+++ b/plugins/jetpack/modules/lazy-images.php
@@ -3,14 +3,13 @@
/**
* Module Name: Lazy Images
* Module Description: Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once.
- * Jumpstart Description: Lazy-loading images improve your site's speed and create a smoother viewing experience. Images will load as visitors scroll down the screen, instead of all at once.
* Sort Order: 24
* Recommendation Order: 14
* First Introduced: 5.6.0
* Requires Connection: No
* Auto Activate: No
* Module Tags: Appearance, Recommended
- * Feature: Appearance, Jumpstart
+ * Feature: Appearance
* Additional Search Queries: mobile, theme, fast images, fast image, image, lazy, lazy load, lazyload, images, lazy images, thumbnail, image lazy load, lazy loading, load, loading
*/
diff --git a/plugins/jetpack/modules/lazy-images/js/lazy-images.js b/plugins/jetpack/modules/lazy-images/js/lazy-images.js
index 31286bd3..1ddbc2c6 100644
--- a/plugins/jetpack/modules/lazy-images/js/lazy-images.js
+++ b/plugins/jetpack/modules/lazy-images/js/lazy-images.js
@@ -107,7 +107,7 @@ var jetpackLazyImagesModule = function( $ ) {
srcset = theImage.attr( 'data-lazy-srcset' );
sizes = theImage.attr( 'data-lazy-sizes' );
- theClone = theImage.clone();
+ theClone = theImage.clone(true);
// Remove lazy attributes from the clone.
theClone.removeAttr( 'data-lazy-srcset' ),
@@ -139,7 +139,6 @@ var jetpackLazyImagesModule = function( $ ) {
* https://github.com/w3c/IntersectionObserver/tree/master/polyfill
*/
-/* jshint ignore:start */
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
@@ -864,7 +863,6 @@ var jetpackLazyImagesModule = function( $ ) {
window.IntersectionObserverEntry = IntersectionObserverEntry;
}(window, document));
-/* jshint ignore:end */
// Let's kick things off now
jetpackLazyImagesModule( jQuery );
diff --git a/plugins/jetpack/modules/lazy-images/lazy-images.php b/plugins/jetpack/modules/lazy-images/lazy-images.php
index befa5ec8..c8092840 100644
--- a/plugins/jetpack/modules/lazy-images/lazy-images.php
+++ b/plugins/jetpack/modules/lazy-images/lazy-images.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
class Jetpack_Lazy_Images {
private static $__instance = null;
@@ -341,7 +343,7 @@ class Jetpack_Lazy_Images {
public function enqueue_assets() {
wp_enqueue_script(
'jetpack-lazy-images',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/lazy-images/js/lazy-images.min.js',
'modules/lazy-images/js/lazy-images.js'
),
diff --git a/plugins/jetpack/modules/likes.php b/plugins/jetpack/modules/likes.php
index efc264d7..30290f61 100644
--- a/plugins/jetpack/modules/likes.php
+++ b/plugins/jetpack/modules/likes.php
@@ -11,6 +11,8 @@
* Additional Search Queries: like, likes, wordpress.com
*/
+use Automattic\Jetpack\Assets;
+
Jetpack::dns_prefetch( array(
'//widgets.wp.com',
'//s0.wp.com',
@@ -27,7 +29,7 @@ class Jetpack_Likes {
static $instance = NULL;
if ( ! $instance ) {
- $instance = new Jetpack_Likes;
+ $instance = new Jetpack_Likes();
}
return $instance;
@@ -156,7 +158,7 @@ class Jetpack_Likes {
static function is_post_likeable( $post_id = 0 ) {
_deprecated_function( __METHOD__, 'jetpack-5.4', 'Jetpack_Likes_Settings()->is_post_likeable' );
$settings = new Jetpack_Likes_Settings();
- return $settings->is_post_likeable();
+ return $settings->is_post_likeable( $post_id );
}
/**
@@ -291,14 +293,14 @@ class Jetpack_Likes {
function register_scripts() {
wp_register_script(
'postmessage',
- Jetpack::get_file_url_for_environment( '_inc/build/postmessage.min.js', '_inc/postmessage.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/postmessage.min.js', '_inc/postmessage.js' ),
array( 'jquery' ),
JETPACK__VERSION,
false
);
wp_register_script(
'jetpack_resize',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/jquery.jetpack-resize.min.js',
'_inc/jquery.jetpack-resize.js'
),
@@ -308,7 +310,7 @@ class Jetpack_Likes {
);
wp_register_script(
'jetpack_likes_queuehandler',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/likes/queuehandler.min.js',
'modules/likes/queuehandler.js'
),
@@ -369,7 +371,7 @@ class Jetpack_Likes {
if ( $this->in_jetpack ) {
wp_enqueue_script(
'likes-post-count',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/likes/post-count.min.js',
'modules/likes/post-count.js'
),
@@ -378,7 +380,7 @@ class Jetpack_Likes {
);
wp_enqueue_script(
'likes-post-count-jetpack',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/likes/post-count-jetpack.min.js',
'modules/likes/post-count-jetpack.js'
),
diff --git a/plugins/jetpack/modules/likes/jetpack-likes-settings.php b/plugins/jetpack/modules/likes/jetpack-likes-settings.php
index 390fea1e..a172603b 100644
--- a/plugins/jetpack/modules/likes/jetpack-likes-settings.php
+++ b/plugins/jetpack/modules/likes/jetpack-likes-settings.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Sync\Settings;
+
class Jetpack_Likes_Settings {
function __construct() {
$this->in_jetpack = ! ( defined( 'IS_WPCOM' ) && IS_WPCOM );
@@ -269,8 +271,7 @@ class Jetpack_Likes_Settings {
* similar logic and filters apply here, too.
*/
function is_likes_visible() {
- require_once JETPACK__PLUGIN_DIR . '/sync/class.jetpack-sync-settings.php';
- if ( Jetpack_Sync_Settings::is_syncing() ) {
+ if ( Settings::is_syncing() ) {
return false;
}
diff --git a/plugins/jetpack/modules/likes/post-count.js b/plugins/jetpack/modules/likes/post-count.js
index 1ddfe561..6f4c779f 100644
--- a/plugins/jetpack/modules/likes/post-count.js
+++ b/plugins/jetpack/modules/likes/post-count.js
@@ -1,5 +1,3 @@
-/* jshint onevar: false, smarttabs: true */
-
var wpPostLikeCount = wpPostLikeCount || {};
( function( $ ) {
diff --git a/plugins/jetpack/modules/manage.php b/plugins/jetpack/modules/manage.php
deleted file mode 100644
index b7f5b9a7..00000000
--- a/plugins/jetpack/modules/manage.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-/**
- * Manage is no longer a module. It is baked directly into Jetpack, as its functionality is required for Jetpack to do what it does.
- */
diff --git a/plugins/jetpack/modules/manage/activate-admin.php b/plugins/jetpack/modules/manage/activate-admin.php
deleted file mode 100644
index 4dad036a..00000000
--- a/plugins/jetpack/modules/manage/activate-admin.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-/*
- * Stub, so that updates don't fatal due to "missing files".
- */
diff --git a/plugins/jetpack/modules/manage/confirm-admin.php b/plugins/jetpack/modules/manage/confirm-admin.php
deleted file mode 100644
index 4dad036a..00000000
--- a/plugins/jetpack/modules/manage/confirm-admin.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-/*
- * Stub, so that updates don't fatal due to "missing files".
- */
diff --git a/plugins/jetpack/modules/markdown/easy-markdown.php b/plugins/jetpack/modules/markdown/easy-markdown.php
index 06a2cab9..d8903d2c 100644
--- a/plugins/jetpack/modules/markdown/easy-markdown.php
+++ b/plugins/jetpack/modules/markdown/easy-markdown.php
@@ -2,18 +2,18 @@
/*
Plugin Name: Easy Markdown
-Plugin URI: http://automattic.com/
+Plugin URI: https://automattic.com/
Description: Write in Markdown, publish in WordPress
Version: 0.1
Author: Matt Wiebe
-Author URI: http://automattic.com/
+Author URI: https://automattic.com/
*/
/**
* Copyright (c) Automattic. All rights reserved.
*
* Released under the GPL license
- * http://www.opensource.org/licenses/gpl-license.php
+ * https://www.opensource.org/licenses/gpl-license.php
*
* This is an add-on for WordPress
* https://wordpress.org/
@@ -307,7 +307,7 @@ class WPCom_Markdown {
*
* @param string $url Markdown support URL.
*/
- return apply_filters( 'easy_markdown_support_url', 'http://en.support.wordpress.com/markdown-quick-reference/' );
+ return apply_filters( 'easy_markdown_support_url', 'https://en.support.wordpress.com/markdown-quick-reference/' );
}
/**
diff --git a/plugins/jetpack/modules/masterbar.php b/plugins/jetpack/modules/masterbar.php
index 8efeae3e..aa322ec1 100644
--- a/plugins/jetpack/modules/masterbar.php
+++ b/plugins/jetpack/modules/masterbar.php
@@ -13,14 +13,4 @@
require dirname( __FILE__ ) . '/masterbar/masterbar.php';
-// In order to be able to tell if it's an AMP request or not we have to hook into parse_query at a later priority.
-add_action( 'admin_bar_init', 'jetpack_initialize_masterbar', 99 );
-
-/**
- * Initializes the Masterbar in case the request is not AMP.
- */
-function jetpack_initialize_masterbar() {
- if ( ! Jetpack_AMP_Support::is_amp_request() ) {
- new A8C_WPCOM_Masterbar();
- }
-}
+new A8C_WPCOM_Masterbar();
diff --git a/plugins/jetpack/modules/masterbar/masterbar.php b/plugins/jetpack/modules/masterbar/masterbar.php
index 6a378b89..e782468f 100644
--- a/plugins/jetpack/modules/masterbar/masterbar.php
+++ b/plugins/jetpack/modules/masterbar/masterbar.php
@@ -1,5 +1,7 @@
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+use Automattic\Jetpack\Assets;
+
require_once dirname( __FILE__ ) . '/rtl-admin-bar.php';
/**
@@ -74,6 +76,16 @@ class A8C_WPCOM_Masterbar {
* Constructor
*/
public function __construct() {
+ add_action( 'admin_bar_init', array( $this, 'init' ) );
+
+ // Post logout on the site, also log the user out of WordPress.com.
+ add_action( 'wp_logout', array( $this, 'maybe_logout_user_from_wpcom' ) );
+ }
+
+ /**
+ * Initialize our masterbar.
+ */
+ public function init() {
$this->locale = $this->get_locale();
$this->user_id = get_current_user_id();
@@ -88,6 +100,14 @@ class A8C_WPCOM_Masterbar {
return;
}
+ // Disable the Masterbar on AMP views.
+ if (
+ class_exists( 'Jetpack_AMP_Support' )
+ && Jetpack_AMP_Support::is_amp_request()
+ ) {
+ return;
+ }
+
Jetpack::dns_prefetch(
array(
'//s0.wp.com',
@@ -144,6 +164,28 @@ class A8C_WPCOM_Masterbar {
}
/**
+ * Log out from WordPress.com when logging out of the local site.
+ */
+ public function maybe_logout_user_from_wpcom() {
+ /**
+ * Whether we should sign out from wpcom too when signing out from the masterbar.
+ *
+ * @since 5.9.0
+ *
+ * @param bool $masterbar_should_logout_from_wpcom True by default.
+ */
+ $masterbar_should_logout_from_wpcom = apply_filters( 'jetpack_masterbar_should_logout_from_wpcom', true );
+ if (
+ // No need to check for a nonce here, it happens further up.
+ isset( $_GET['context'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ && 'masterbar' === $_GET['context'] // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ && $masterbar_should_logout_from_wpcom
+ ) {
+ do_action( 'wp_masterbar_logout' );
+ }
+ }
+
+ /**
* Get class name for RTL sites.
*/
public function get_rtl_admin_bar_class() {
@@ -167,7 +209,13 @@ class A8C_WPCOM_Masterbar {
* Remove the default Admin Bar CSS.
*/
public function remove_core_styles() {
- wp_dequeue_style( 'admin-bar' );
+ /*
+ * Notifications need the admin bar styles,
+ * so let's not remove them when the module is active.
+ */
+ if ( ! Jetpack::is_module_active( 'notes' ) ) {
+ wp_dequeue_style( 'admin-bar' );
+ }
}
/**
@@ -200,14 +248,14 @@ class A8C_WPCOM_Masterbar {
wp_enqueue_script(
'jetpack-accessible-focus',
- Jetpack::get_file_url_for_environment( '_inc/build/accessible-focus.min.js', '_inc/accessible-focus.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/accessible-focus.min.js', '_inc/accessible-focus.js' ),
array(),
JETPACK__VERSION,
false
);
wp_enqueue_script(
'a8c_wpcom_masterbar_tracks_events',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/masterbar/tracks-events.min.js',
'modules/masterbar/tracks-events.js'
),
@@ -288,8 +336,10 @@ class A8C_WPCOM_Masterbar {
$this->add_me_submenu( $wp_admin_bar );
$this->add_write_button( $wp_admin_bar );
- // Add a sidebar toggle on mobile.
- wp_admin_bar_sidebar_toggle( $wp_admin_bar );
+ // Recovery mode exit.
+ if ( function_exists( 'wp_admin_bar_recovery_mode_menu' ) ) {
+ wp_admin_bar_recovery_mode_menu( $wp_admin_bar );
+ }
}
/**
@@ -344,45 +394,140 @@ class A8C_WPCOM_Masterbar {
}
/**
- * Add the "My Site" menu item in the root default group.
+ * Add the "Reader" menu item in the root default group.
*
* @param WP_Admin_Bar $wp_admin_bar Admin Bar instance.
*/
- public function add_my_sites_submenu( $wp_admin_bar ) {
+ public function add_reader_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_menu(
array(
'parent' => 'root-default',
- 'id' => 'blog',
- 'title' => _n( 'My Site', 'My Sites', $this->user_site_count, 'jetpack' ),
- 'href' => 'https://wordpress.com/stats/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'newdash',
+ 'title' => esc_html__( 'Reader', 'jetpack' ),
+ 'href' => '#',
'meta' => array(
- 'class' => 'my-sites mb-trackable',
+ 'class' => 'mb-trackable',
),
)
);
- }
- /**
- * Add the "Reader" menu item in the root default group.
- *
- * @param WP_Admin_Bar $wp_admin_bar Admin Bar instance.
- */
- public function add_reader_submenu( $wp_admin_bar ) {
$wp_admin_bar->add_menu(
array(
- 'parent' => 'root-default',
- 'id' => 'newdash',
- 'title' => esc_html__( 'Reader', 'jetpack' ),
- 'href' => 'https://wordpress.com/',
+ 'parent' => 'newdash',
+ 'id' => 'streams-header',
+ 'title' => esc_html_x(
+ 'Streams',
+ 'Title for Reader sub-menu that contains followed sites, likes, and recommendations',
+ 'jetpack'
+ ),
'meta' => array(
- 'class' => 'mb-trackable',
+ 'class' => 'ab-submenu-header',
+ ),
+ )
+ );
+
+ $following_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/',
+ 'id' => 'wp-admin-bar-followed-sites',
+ 'label' => esc_html__( 'Followed Sites', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/following/edit',
+ 'id' => 'wp-admin-bar-reader-followed-sites-manage',
+ 'label' => esc_html__( 'Manage', 'jetpack' ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'newdash',
+ 'id' => 'following',
+ 'title' => $following_title,
+ 'meta' => array( 'class' => 'inline-action' ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'newdash',
+ 'id' => 'discover-discover',
+ 'title' => esc_html__( 'Discover', 'jetpack' ),
+ 'href' => 'https://wordpress.com/discover',
+ 'meta' => array(
+ 'class' => 'mb-icon-spacer',
),
)
);
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'newdash',
+ 'id' => 'discover-search',
+ 'title' => esc_html__( 'Search', 'jetpack' ),
+ 'href' => 'https://wordpress.com/read/search',
+ 'meta' => array(
+ 'class' => 'mb-icon-spacer',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'newdash',
+ 'id' => 'discover-recommended-blogs',
+ 'title' => esc_html__( 'Recommendations', 'jetpack' ),
+ 'href' => 'https://wordpress.com/recommendations',
+ 'meta' => array(
+ 'class' => 'mb-icon-spacer',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'newdash',
+ 'id' => 'my-activity-my-likes',
+ 'title' => esc_html__( 'My Likes', 'jetpack' ),
+ 'href' => 'https://wordpress.com/activities/likes',
+ 'meta' => array(
+ 'class' => 'mb-icon-spacer',
+ ),
+ )
+ );
+
}
/**
- * Define main groups used in our admin bar.
+ * Merge 2 menu items together into 2 link tags.
+ *
+ * @param array $primary Array of menu information.
+ * @param array $secondary Array of menu information.
+ */
+ public function create_menu_item_pair( $primary, $secondary ) {
+ $primary_class = 'ab-item ab-primary mb-icon';
+ $secondary_class = 'ab-secondary';
+
+ $primary_anchor = $this->create_menu_item_anchor( $primary_class, $primary['url'], $primary['label'], $primary['id'] );
+ $secondary_anchor = $this->create_menu_item_anchor( $secondary_class, $secondary['url'], $secondary['label'], $secondary['id'] );
+
+ return $primary_anchor . $secondary_anchor;
+ }
+
+ /**
+ * Create a link tag based on information about a menu item.
+ *
+ * @param string $class Menu item CSS class.
+ * @param string $url URL you go to when clicking on the menu item.
+ * @param string $label Menu item title.
+ * @param string $id Menu item slug.
+ */
+ public function create_menu_item_anchor( $class, $url, $label, $id ) {
+ return '<a href="' . $url . '" class="' . $class . '" id="' . $id . '">' . $label . '</a>';
+ }
+
+ /**
+ * Add Secondary groups for submenu items.
*
* @param WP_Admin_Bar $wp_admin_bar Admin Bar instance.
*/
@@ -398,6 +543,16 @@ class A8C_WPCOM_Masterbar {
$wp_admin_bar->add_group(
array(
+ 'parent' => 'blog',
+ 'id' => 'blog-secondary',
+ 'meta' => array(
+ 'class' => 'ab-sub-secondary',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_group(
+ array(
'id' => 'top-secondary',
'meta' => array(
'class' => 'ab-top-secondary',
@@ -426,12 +581,163 @@ class A8C_WPCOM_Masterbar {
'id' => 'my-account',
'parent' => 'top-secondary',
'title' => $avatar . '<span class="ab-text">' . esc_html__( 'Me', 'jetpack' ) . '</span>',
- 'href' => 'https://wordpress.com/me/account',
+ 'href' => '#',
'meta' => array(
'class' => $class,
),
)
);
+
+ $id = 'user-actions';
+ $wp_admin_bar->add_group(
+ array(
+ 'parent' => 'my-account',
+ 'id' => $id,
+ )
+ );
+
+ $settings_url = 'https://wordpress.com/me/account';
+
+ $logout_url = wp_logout_url();
+ $logout_url = add_query_arg( 'context', 'masterbar', $logout_url );
+
+ $user_info = get_avatar( $this->user_email, 128, 'mm', '', array( 'force_display' => true ) );
+ $user_info .= '<span class="display-name">' . $this->display_name . '</span>';
+ $user_info .= '<a class="username" href="https://gravatar.com/' . $this->user_login . '">@' . $this->user_login . '</a>';
+
+ $user_info .= sprintf(
+ '<div><a href="%s" class="ab-sign-out">%s</a></div>',
+ $logout_url,
+ esc_html__( 'Sign Out', 'jetpack' )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'user-info',
+ 'title' => $user_info,
+ 'meta' => array(
+ 'class' => 'user-info user-info-item',
+ 'tabindex' => -1,
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'profile-header',
+ 'title' => esc_html__( 'Profile', 'jetpack' ),
+ 'meta' => array(
+ 'class' => 'ab-submenu-header',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'my-profile',
+ 'title' => esc_html__( 'My Profile', 'jetpack' ),
+ 'href' => 'https://wordpress.com/me',
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'account-settings',
+ 'title' => esc_html__( 'Account Settings', 'jetpack' ),
+ 'href' => $settings_url,
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'billing',
+ 'title' => esc_html__( 'Manage Purchases', 'jetpack' ),
+ 'href' => 'https://wordpress.com/me/purchases',
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'security',
+ 'title' => esc_html__( 'Security', 'jetpack' ),
+ 'href' => 'https://wordpress.com/me/security',
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'notifications',
+ 'title' => esc_html__( 'Notifications', 'jetpack' ),
+ 'href' => 'https://wordpress.com/me/notifications',
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'special-header',
+ 'title' => esc_html_x(
+ 'Special',
+ 'Title for Me sub-menu that contains Get Apps, Next Steps, and Help options',
+ 'jetpack'
+ ),
+ 'meta' => array(
+ 'class' => 'ab-submenu-header',
+ ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'get-apps',
+ 'title' => esc_html__( 'Get Apps', 'jetpack' ),
+ 'href' => 'https://wordpress.com/me/get-apps',
+ 'meta' => array(
+ 'class' => 'mb-icon user-info-item',
+ ),
+ )
+ );
+
+ $help_link = 'https://jetpack.com/support/';
+
+ if ( jetpack_is_atomic_site() ) {
+ $help_link = 'https://wordpress.com/help';
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => $id,
+ 'id' => 'help',
+ 'title' => esc_html__( 'Help', 'jetpack' ),
+ 'href' => $help_link,
+ 'meta' => array(
+ 'class' => 'mb-icon user-info-item',
+ ),
+ )
+ );
}
/**
@@ -467,4 +773,557 @@ class A8C_WPCOM_Masterbar {
)
);
}
+
+ /**
+ * Add the "My Site" menu item in the root default group.
+ *
+ * @param WP_Admin_Bar $wp_admin_bar Admin Bar instance.
+ */
+ public function add_my_sites_submenu( $wp_admin_bar ) {
+ $current_user = wp_get_current_user();
+
+ $blog_name = get_bloginfo( 'name' );
+ if ( empty( $blog_name ) ) {
+ $blog_name = $this->primary_site_slug;
+ }
+
+ if ( mb_strlen( $blog_name ) > 20 ) {
+ $blog_name = mb_substr( html_entity_decode( $blog_name, ENT_QUOTES ), 0, 20 ) . '&hellip;';
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'root-default',
+ 'id' => 'blog',
+ 'title' => _n( 'My Site', 'My Sites', $this->user_site_count, 'jetpack' ),
+ 'href' => '#',
+ 'meta' => array(
+ 'class' => 'my-sites mb-trackable',
+ ),
+ )
+ );
+
+ if ( $this->user_site_count > 1 ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'switch-site',
+ 'title' => esc_html__( 'Switch Site', 'jetpack' ),
+ 'href' => 'https://wordpress.com/sites',
+ )
+ );
+ } else {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'new-site',
+ 'title' => esc_html__( '+ Add New WordPress', 'jetpack' ),
+ 'href' => 'https://wordpress.com/start?ref=admin-bar-logged-in',
+ )
+ );
+ }
+
+ if ( is_user_member_of_blog( $current_user->ID ) ) {
+ $blavatar = '';
+ $class = 'current-site';
+
+ if ( has_site_icon() ) {
+ $src = get_site_icon_url();
+ $blavatar = '<img class="avatar" src="' . esc_attr( $src ) . '" alt="Current site avatar">';
+ $class = 'has-blavatar';
+ }
+
+ $blog_info = '<div class="ab-site-icon">' . $blavatar . '</div>';
+ $blog_info .= '<span class="ab-site-title">' . esc_html( $blog_name ) . '</span>';
+ $blog_info .= '<span class="ab-site-description">' . esc_html( $this->primary_site_url ) . '</span>';
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'blog-info',
+ 'title' => $blog_info,
+ 'href' => esc_url( trailingslashit( $this->primary_site_url ) ),
+ 'meta' => array(
+ 'class' => $class,
+ ),
+ )
+ );
+ }
+
+ // Site Preview.
+ if ( is_admin() ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'site-view',
+ 'title' => __( 'View Site', 'jetpack' ),
+ 'href' => home_url(),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ 'target' => '_blank',
+ ),
+ )
+ );
+ }
+
+ // Stats.
+ if ( Jetpack::is_module_active( 'stats' ) && current_user_can( 'view_stats' ) ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'blog-stats',
+ 'title' => esc_html__( 'Stats', 'jetpack' ),
+ 'href' => 'https://wordpress.com/stats/' . esc_attr( $this->primary_site_slug ),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+ }
+
+ if ( current_user_can( 'manage_options' ) ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'activity',
+ 'title' => esc_html__( 'Activity', 'jetpack' ),
+ 'href' => 'https://wordpress.com/activity-log/' . esc_attr( $this->primary_site_slug ),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+ }
+
+ // Add Calypso plans link and plan type indicator.
+ if ( is_user_member_of_blog( $current_user->ID ) && current_user_can( 'manage_options' ) ) {
+ $plans_url = 'https://wordpress.com/plans/' . esc_attr( $this->primary_site_slug );
+ $label = esc_html__( 'Plan', 'jetpack' );
+ $plan = Jetpack_Plan::get();
+
+ $plan_title = $this->create_menu_item_pair(
+ array(
+ 'url' => $plans_url,
+ 'id' => 'wp-admin-bar-plan',
+ 'label' => $label,
+ ),
+ array(
+ 'url' => $plans_url,
+ 'id' => 'wp-admin-bar-plan-badge',
+ 'label' => $plan['product_name_short'],
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'plan',
+ 'title' => $plan_title,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+ }
+
+ // Publish group.
+ $wp_admin_bar->add_group(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'publish',
+ )
+ );
+
+ // Publish header.
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'publish',
+ 'id' => 'publish-header',
+ 'title' => esc_html_x( 'Manage', 'admin bar menu group label', 'jetpack' ),
+ 'meta' => array(
+ 'class' => 'ab-submenu-header',
+ ),
+ )
+ );
+
+ // Pages.
+ $pages_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/pages/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-edit-page',
+ 'label' => esc_html__( 'Site Pages', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/page/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-new-page-badge',
+ 'label' => esc_html_x( 'Add', 'admin bar menu new item label', 'jetpack' ),
+ )
+ );
+
+ if ( ! current_user_can( 'edit_pages' ) ) {
+ $pages_title = $this->create_menu_item_anchor(
+ 'ab-item ab-primary mb-icon',
+ 'https://wordpress.com/pages/' . esc_attr( $this->primary_site_slug ),
+ esc_html__( 'Site Pages', 'jetpack' ),
+ 'wp-admin-bar-edit-page'
+ );
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'publish',
+ 'id' => 'new-page',
+ 'title' => $pages_title,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+
+ // Blog Posts.
+ $posts_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/posts/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-edit-post',
+ 'label' => esc_html__( 'Blog Posts', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/post/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-new-post-badge',
+ 'label' => esc_html_x( 'Add', 'admin bar menu new item label', 'jetpack' ),
+ )
+ );
+
+ if ( ! current_user_can( 'edit_posts' ) ) {
+ $posts_title = $this->create_menu_item_anchor(
+ 'ab-item ab-primary mb-icon',
+ 'https://wordpress.com/posts/' . esc_attr( $this->primary_site_slug ),
+ esc_html__( 'Blog Posts', 'jetpack' ),
+ 'wp-admin-bar-edit-post'
+ );
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'publish',
+ 'id' => 'new-post',
+ 'title' => $posts_title,
+ 'meta' => array(
+ 'class' => 'inline-action mb-trackable',
+ ),
+ )
+ );
+
+ // Comments.
+ if ( current_user_can( 'moderate_comments' ) ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'publish',
+ 'id' => 'comments',
+ 'title' => __( 'Comments', 'jetpack' ),
+ 'href' => 'https://wordpress.com/comments/' . esc_attr( $this->primary_site_slug ),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+ }
+
+ // Testimonials.
+ if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_testimonial' ) ) {
+ $testimonials_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-edit-testimonial',
+ 'label' => esc_html__( 'Testimonials', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/edit/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-new-testimonial',
+ 'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),
+ )
+ );
+
+ if ( ! current_user_can( 'edit_pages' ) ) {
+ $testimonials_title = $this->create_menu_item_anchor(
+ 'ab-item ab-primary mb-icon',
+ 'https://wordpress.com/types/jetpack-testimonial/' . esc_attr( $this->primary_site_slug ),
+ esc_html__( 'Testimonials', 'jetpack' ),
+ 'wp-admin-bar-edit-testimonial'
+ );
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'publish',
+ 'id' => 'new-jetpack-testimonial',
+ 'title' => $testimonials_title,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+ }
+
+ // Portfolio.
+ if ( Jetpack::is_module_active( 'custom-content-types' ) && get_option( 'jetpack_portfolio' ) ) {
+ $portfolios_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-edit-portfolio',
+ 'label' => esc_html__( 'Portfolio', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/edit/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-new-portfolio',
+ 'label' => esc_html_x( 'Add', 'Button label for adding a new item via the toolbar menu', 'jetpack' ),
+ )
+ );
+
+ if ( ! current_user_can( 'edit_pages' ) ) {
+ $portfolios_title = $this->create_menu_item_anchor(
+ 'ab-item ab-primary mb-icon',
+ 'https://wordpress.com/types/jetpack-portfolio/' . esc_attr( $this->primary_site_slug ),
+ esc_html__( 'Portfolio', 'jetpack' ),
+ 'wp-admin-bar-edit-portfolio'
+ );
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'publish',
+ 'id' => 'new-jetpack-portfolio',
+ 'title' => $portfolios_title,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+ }
+
+ if ( current_user_can( 'edit_theme_options' ) ) {
+ // Look and Feel group.
+ $wp_admin_bar->add_group(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'look-and-feel',
+ )
+ );
+
+ // Look and Feel header.
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'look-and-feel',
+ 'id' => 'look-and-feel-header',
+ 'title' => esc_html_x( 'Personalize', 'admin bar menu group label', 'jetpack' ),
+ 'meta' => array(
+ 'class' => 'ab-submenu-header',
+ ),
+ )
+ );
+
+ if ( is_admin() ) {
+ // In wp-admin the `return` query arg will return to that page after closing the Customizer.
+ $customizer_url = add_query_arg(
+ array(
+ 'return' => rawurlencode( site_url( $_SERVER['REQUEST_URI'] ) ),
+ ),
+ wp_customize_url()
+ );
+ } else {
+ /*
+ * On the frontend the `url` query arg will load that page in the Customizer
+ * and also return to it after closing
+ * non-home URLs won't work unless we undo domain mapping
+ * since the Customizer preview is unmapped to always have HTTPS.
+ */
+ $current_page = '//' . $this->primary_site_slug . $_SERVER['REQUEST_URI'];
+ $customizer_url = add_query_arg( array( 'url' => rawurlencode( $current_page ) ), wp_customize_url() );
+ }
+
+ $theme_title = $this->create_menu_item_pair(
+ array(
+ 'url' => $customizer_url,
+ 'id' => 'wp-admin-bar-cmz',
+ 'label' => esc_html_x( 'Customize', 'admin bar customize item label', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/themes/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-themes',
+ 'label' => esc_html__( 'Themes', 'jetpack' ),
+ )
+ );
+ $meta = array(
+ 'class' => 'mb-icon',
+ 'class' => 'inline-action',
+ );
+ $href = false;
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'look-and-feel',
+ 'id' => 'themes',
+ 'title' => $theme_title,
+ 'href' => $href,
+ 'meta' => $meta,
+ )
+ );
+ }
+
+ if ( current_user_can( 'manage_options' ) ) {
+ // Configuration group.
+ $wp_admin_bar->add_group(
+ array(
+ 'parent' => 'blog',
+ 'id' => 'configuration',
+ )
+ );
+
+ // Configuration header.
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'configuration-header',
+ 'title' => esc_html_x( 'Configure', 'admin bar menu group label', 'jetpack' ),
+ 'meta' => array(
+ 'class' => 'ab-submenu-header',
+ ),
+ )
+ );
+
+ if ( Jetpack::is_module_active( 'publicize' ) || Jetpack::is_module_active( 'sharedaddy' ) ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'sharing',
+ 'title' => esc_html__( 'Sharing', 'jetpack' ),
+ 'href' => 'https://wordpress.com/sharing/' . esc_attr( $this->primary_site_slug ),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+ }
+
+ $people_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/people/team/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-people',
+ 'label' => esc_html__( 'People', 'jetpack' ),
+ ),
+ array(
+ 'url' => admin_url( 'user-new.php' ),
+ 'id' => 'wp-admin-bar-people-add',
+ 'label' => esc_html_x( 'Add', 'admin bar people item label', 'jetpack' ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'users-toolbar',
+ 'title' => $people_title,
+ 'href' => false,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+
+ $plugins_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/plugins/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-plugins',
+ 'label' => esc_html__( 'Plugins', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/plugins/manage/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-plugins-add',
+ 'label' => esc_html_x( 'Manage', 'Label for the button on the Masterbar to manage plugins', 'jetpack' ),
+ )
+ );
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'plugins',
+ 'title' => $plugins_title,
+ 'href' => false,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+
+ if ( jetpack_is_atomic_site() ) {
+ $domain_title = $this->create_menu_item_pair(
+ array(
+ 'url' => 'https://wordpress.com/domains/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-domains',
+ 'label' => esc_html__( 'Domains', 'jetpack' ),
+ ),
+ array(
+ 'url' => 'https://wordpress.com/domains/add/' . esc_attr( $this->primary_site_slug ),
+ 'id' => 'wp-admin-bar-domains-add',
+ 'label' => esc_html_x( 'Add', 'Label for the button on the Masterbar to add a new domain', 'jetpack' ),
+ )
+ );
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'domains',
+ 'title' => $domain_title,
+ 'href' => false,
+ 'meta' => array(
+ 'class' => 'inline-action',
+ ),
+ )
+ );
+ }
+
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'blog-settings',
+ 'title' => esc_html__( 'Settings', 'jetpack' ),
+ 'href' => 'https://wordpress.com/settings/general/' . esc_attr( $this->primary_site_slug ),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+
+ if ( ! is_admin() ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'parent' => 'configuration',
+ 'id' => 'legacy-dashboard',
+ 'title' => esc_html__( 'Dashboard', 'jetpack' ),
+ 'href' => admin_url(),
+ 'meta' => array(
+ 'class' => 'mb-icon',
+ ),
+ )
+ );
+ }
+
+ // Restore dashboard menu toggle that is needed on mobile views.
+ if ( is_admin() ) {
+ $wp_admin_bar->add_menu(
+ array(
+ 'id' => 'menu-toggle',
+ 'title' => '<span class="ab-icon"></span><span class="screen-reader-text">' . esc_html__( 'Menu', 'jetpack' ) . '</span>',
+ 'href' => '#',
+ )
+ );
+ }
+
+ /**
+ * Fires when menu items are added to the masterbar "My Sites" menu.
+ *
+ * @since 5.4.0
+ */
+ do_action( 'jetpack_masterbar' );
+ }
+ }
}
diff --git a/plugins/jetpack/modules/masterbar/overrides.css b/plugins/jetpack/modules/masterbar/overrides.css
index a1c9a534..d6a09be0 100644
--- a/plugins/jetpack/modules/masterbar/overrides.css
+++ b/plugins/jetpack/modules/masterbar/overrides.css
@@ -59,3 +59,74 @@
#wpadminbar .quicklinks li#wp-admin-bar-my-account #wp-admin-bar-user-info .ab-sign-out {
display: inline-block;
}
+
+/* Move the admin menu toggle in Gutenberg - https://github.com/Automattic/jetpack/issues/12320 */
+.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar #wp-admin-bar-ab-new-post {
+ display: none;
+}
+
+.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar #wp-admin-bar-menu-toggle {
+ top: -4px;
+ position: relative;
+}
+
+.jetpack-masterbar.post-new-php.block-editor-page #wpadminbar #wp-admin-bar-menu-toggle .ab-icon:before {
+ color: #fff !important;
+ font-size: 28px;
+}
+
+.jetpack-masterbar #wpadminbar #wp-admin-bar-recovery-mode {
+ background-color: #ca4a1f;
+ color: #fff;
+ margin-right: 1em;
+}
+
+@media screen and (max-width: 480px) {
+ .jetpack-masterbar.post-new-php.block-editor-page #wp-toolbar ul li {
+ flex: 1;
+ width: auto !important;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wpadminbar ul#wp-admin-bar-root-default {
+ width: 60%;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wpadminbar ul#wp-admin-bar-top-secondary {
+ width: 40%;
+ }
+
+ .wp-admin.jetpack-masterbar.post-new-php.block-editor-page .wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle {
+ left: 0;
+ }
+}
+
+@media screen and (max-width: 782px) {
+ .wp-admin.jetpack-masterbar.post-new-php.block-editor-page .wp-responsive-open #wpadminbar #wp-admin-bar-menu-toggle {
+ left: 0 !important;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wp-toolbar,
+ .jetpack-masterbar.post-new-php.block-editor-page #wp-toolbar ul {
+ display: flex;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wpadminbar ul#wp-admin-bar-root-default {
+ flex-grow: 1;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wpadminbar li#wp-admin-bar-menu-toggle {
+ order: 1;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wpadminbar li#wp-admin-bar-blog {
+ order: 2;
+ }
+
+ .jetpack-masterbar.post-new-php.block-editor-page #wpadminbar li#wp-admin-bar-newdash {
+ order: 3;
+ }
+
+ .jetpack-masterbar #wpadminbar #wp-admin-bar-recovery-mode {
+ display: none;
+ }
+}
diff --git a/plugins/jetpack/modules/masterbar/tracks-events.js b/plugins/jetpack/modules/masterbar/tracks-events.js
index 8364266c..a8993999 100644
--- a/plugins/jetpack/modules/masterbar/tracks-events.js
+++ b/plugins/jetpack/modules/masterbar/tracks-events.js
@@ -9,6 +9,55 @@
'wp-admin-bar-ab-new-post': 'write_button',
'wp-admin-bar-my-account': 'my_account',
'wp-admin-bar-notes': 'notifications',
+ //my sites - top items
+ 'wp-admin-bar-switch-site': 'my_sites_switch_site',
+ 'wp-admin-bar-blog-info': 'my_sites_blog_info',
+ 'wp-admin-bar-site-view': 'my_sites_view_site',
+ 'wp-admin-bar-blog-stats': 'my_sites_blog_stats',
+ 'wp-admin-bar-activity': 'my_sites_activity',
+ 'wp-admin-bar-plan': 'my_sites_plan',
+ 'wp-admin-bar-plan-badge': 'my_sites_plan_badge',
+ //my sites - manage
+ 'wp-admin-bar-edit-page': 'my_sites_manage_site_pages',
+ 'wp-admin-bar-new-page-badge': 'my_sites_manage_add_page',
+ 'wp-admin-bar-edit-post': 'my_sites_manage_blog_posts',
+ 'wp-admin-bar-new-post-badge': 'my_sites_manage_add_new_post',
+ 'wp-admin-bar-edit-attachment': 'my_sites_manage_media',
+ 'wp-admin-bar-new-attachment-badge': 'my_sites_manage_add_media',
+ 'wp-admin-bar-comments': 'my_sites_manage_comments',
+ 'wp-admin-bar-edit-testimonial': 'my_sites_manage_testimonials',
+ 'wp-admin-bar-new-testimonial': 'my_sites_manage_add_testimonial',
+ 'wp-admin-bar-edit-portfolio': 'my_sites_manage_portfolio',
+ 'wp-admin-bar-new-portfolio': 'my_sites_manage_add_portfolio',
+ //my sites - personalize
+ 'wp-admin-bar-themes': 'my_sites_personalize_themes',
+ 'wp-admin-bar-cmz': 'my_sites_personalize_themes_customize',
+ //my sites - configure
+ 'wp-admin-bar-sharing': 'my_sites_configure_sharing',
+ 'wp-admin-bar-people': 'my_sites_configure_people',
+ 'wp-admin-bar-people-add': 'my_sites_configure_people_add_button',
+ 'wp-admin-bar-plugins': 'my_sites_configure_plugins',
+ 'wp-admin-bar-plugins-add': 'my_sites_configure_manage_plugins',
+ 'wp-admin-bar-blog-settings': 'my_sites_configure_settings',
+ //reader
+ 'wp-admin-bar-followed-sites': 'reader_followed_sites',
+ 'wp-admin-bar-reader-followed-sites-manage': 'reader_manage_followed_sites',
+ 'wp-admin-bar-discover-discover': 'reader_discover',
+ 'wp-admin-bar-discover-search': 'reader_search',
+ 'wp-admin-bar-discover-recommended-blogs': 'reader_recommendations',
+ 'wp-admin-bar-my-activity-my-likes': 'reader_my_likes',
+ //account
+ 'wp-admin-bar-user-info': 'my_account_user_name',
+ // account - profile
+ 'wp-admin-bar-my-profile': 'my_account_profile_my_profile',
+ 'wp-admin-bar-account-settings': 'my_account_profile_account_settings',
+ 'wp-admin-bar-billing': 'my_account_profile_manage_purchases',
+ 'wp-admin-bar-security': 'my_account_profile_security',
+ 'wp-admin-bar-notifications': 'my_account_profile_notifications',
+ //account - special
+ 'wp-admin-bar-get-apps': 'my_account_special_get_apps',
+ 'wp-admin-bar-next-steps': 'my_account_special_next_steps',
+ 'wp-admin-bar-help': 'my_account_special_help',
};
var notesTracksEvents = {
diff --git a/plugins/jetpack/modules/memberships/class-jetpack-memberships.php b/plugins/jetpack/modules/memberships/class-jetpack-memberships.php
index 989d4e96..5a3ed64f 100644
--- a/plugins/jetpack/modules/memberships/class-jetpack-memberships.php
+++ b/plugins/jetpack/modules/memberships/class-jetpack-memberships.php
@@ -34,7 +34,29 @@ class Jetpack_Memberships {
*
* @var string
*/
- private static $button_block_name = 'membership-button';
+ private static $button_block_name = 'recurring-payments';
+
+ /**
+ * These are defaults for wp_kses ran on the membership button.
+ *
+ * @var array
+ */
+ private static $tags_allowed_in_the_button = array( 'br' => array() );
+
+ /**
+ * The minimum required plan for this Gutenberg block.
+ *
+ * @var string Plan slug
+ */
+ private static $required_plan;
+
+ /**
+ * Track recurring payments block registration.
+ *
+ * @var boolean True if block registration has been executed.
+ */
+ private static $has_registered_block = false;
+
/**
* Classic singleton pattern
*
@@ -56,6 +78,8 @@ class Jetpack_Memberships {
if ( ! self::$instance ) {
self::$instance = new self();
self::$instance->register_init_hook();
+ // Yes, `personal-bundle` with a dash, `jetpack_personal` with an underscore. Check the v1.5 endpoint to verify.
+ self::$required_plan = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? 'personal-bundle' : 'jetpack_personal';
}
return self::$instance;
@@ -84,6 +108,7 @@ class Jetpack_Memberships {
*/
private function register_init_hook() {
add_action( 'init', array( $this, 'init_hook_action' ) );
+ add_action( 'jetpack_register_gutenberg_extensions', array( $this, 'register_gutenberg_block' ) );
}
/**
@@ -113,7 +138,7 @@ class Jetpack_Memberships {
);
$order_args = array(
'label' => esc_html__( 'Plan', 'jetpack' ),
- 'description' => esc_html__( 'Memberships plans', 'jetpack' ),
+ 'description' => esc_html__( 'Recurring Payments plans', 'jetpack' ),
'supports' => array( 'title', 'custom-fields', 'content' ),
'hierarchical' => false,
'public' => false,
@@ -201,16 +226,18 @@ class Jetpack_Memberships {
'powered_text' => __( 'Powered by WordPress.com', 'jetpack' ),
);
- $classes = array(
- 'components-button',
- 'is-primary',
- 'is-button',
- 'wp-block-jetpack-' . self::$button_block_name,
- self::$css_classname_prefix . '-' . $data['id'],
+ $classes = Jetpack_Gutenberg::block_classes(
+ self::$button_block_name,
+ $attrs,
+ array(
+ 'wp-block-button__link',
+ 'components-button',
+ 'is-primary',
+ 'is-button',
+ self::$css_classname_prefix . '-' . $data['id'],
+ )
);
- if ( isset( $attrs['className'] ) ) {
- array_push( $classes, $attrs['className'] );
- }
+
if ( isset( $attrs['submitButtonText'] ) ) {
$data['button_label'] = $attrs['submitButtonText'];
}
@@ -233,7 +260,7 @@ class Jetpack_Memberships {
)
);
}
- $button_styles = implode( $button_styles, ';' );
+ $button_styles = implode( ';', $button_styles );
add_thickbox();
return sprintf(
'<button data-blog-id="%d" data-powered-text="%s" data-plan-id="%d" data-lang="%s" class="%s" style="%s">%s</button>',
@@ -241,9 +268,9 @@ class Jetpack_Memberships {
esc_attr( $data['powered_text'] ),
esc_attr( $data['id'] ),
esc_attr( get_locale() ),
- esc_attr( implode( $classes, ' ' ) ),
+ esc_attr( $classes ),
esc_attr( $button_styles ),
- esc_html( $data['button_label'] )
+ wp_kses( $data['button_label'], self::$tags_allowed_in_the_button )
);
}
@@ -268,5 +295,57 @@ class Jetpack_Memberships {
public static function get_connected_account_id() {
return get_option( self::$connected_account_id_option_name );
}
+
+ /**
+ * Whether Recurring Payments are enabled.
+ *
+ * @return bool
+ */
+ public static function is_enabled_jetpack_recurring_payments() {
+ // For WPCOM sites.
+ if ( defined( 'IS_WPCOM' ) && IS_WPCOM && function_exists( 'has_any_blog_stickers' ) ) {
+ $site_id = get_current_blog_id();
+ return has_any_blog_stickers( array( 'personal-plan', 'premium-plan', 'business-plan', 'ecommerce-plan' ), $site_id );
+ }
+
+ // For Jetpack sites.
+ return Jetpack::is_active() && (
+ /** This filter is documented in class.jetpack-gutenberg.php */
+ ! apply_filters( 'jetpack_block_editor_enable_upgrade_nudge', false ) || // Remove when the default becomes `true`.
+ Jetpack_Plan::supports( 'recurring-payments' )
+ );
+ }
+
+ /**
+ * Register the Recurring Payments Gutenberg block
+ */
+ public function register_gutenberg_block() {
+ // This gate was introduced to prevent duplicate registration. A race condition exists where
+ // the registration that happens via extensions/blocks/recurring-payments/recurring-payments.php
+ // was adding the registration action after the action had been run in some contexts.
+ if ( self::$has_registered_block ) {
+ return;
+ }
+
+ if ( self::is_enabled_jetpack_recurring_payments() ) {
+ jetpack_register_block(
+ 'jetpack/recurring-payments',
+ array(
+ 'render_callback' => array( $this, 'render_button' ),
+ )
+ );
+ } else {
+ Jetpack_Gutenberg::set_extension_unavailable(
+ 'jetpack/recurring-payments',
+ 'missing_plan',
+ array(
+ 'required_feature' => 'memberships',
+ 'required_plan' => self::$required_plan,
+ )
+ );
+ }
+
+ self::$has_registered_block = true;
+ }
}
Jetpack_Memberships::get_instance();
diff --git a/plugins/jetpack/modules/minileven/minileven.php b/plugins/jetpack/modules/minileven/minileven.php
index abfec53d..2e649dd1 100644
--- a/plugins/jetpack/modules/minileven/minileven.php
+++ b/plugins/jetpack/modules/minileven/minileven.php
@@ -8,7 +8,7 @@
// http://alexking.org/projects/wordpress
//
// Released under the GPL license
-// http://www.opensource.org/licenses/gpl-license.php
+// https://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
@@ -117,13 +117,26 @@ function jetpack_mobile_template( $theme ) {
}
function jetpack_mobile_available() {
- echo '<div class="jetpack-mobile-link" style="text-align:center;margin:10px 0;"><a href="'. esc_url( home_url( add_query_arg('ak_action', 'accept_mobile') ) ) . '">' . __( 'View Mobile Site', 'jetpack' ) . '</a></div>';
+ /*
+ * Create HTML markup with a link to "View Mobile Site".
+ * The link adds "ak_action=accept_mobile" to the current URL.
+ */
+ global $wp;
+ $url_params = array(
+ 'ak_action' => 'accept_mobile',
+ );
+ if ( is_array( $_GET ) && ! empty( $_GET ) ) {
+ $url_params[] = $_GET;
+ }
+ $target_url = home_url( add_query_arg( $url_params, $wp->request ) );
+ $anchor = '<a href="' . esc_url( $target_url ) . '">' . __( 'View Mobile Site', 'jetpack' ) . '</a>';
+ echo '<div class="jetpack-mobile-link" style="text-align:center;margin:10px 0;">' . $anchor . '</div>';
}
function jetpack_mobile_request_handler() {
global $wpdb;
if (isset($_GET['ak_action'])) {
- $url = parse_url( get_bloginfo( 'url' ) );
+ $url = wp_parse_url( get_bloginfo( 'url' ) );
$domain = $url['host'];
if (!empty($url['path'])) {
$path = $url['path'];
@@ -207,7 +220,7 @@ function jetpack_mobile_theme_setup() {
exit;
break;
case 'ios':
- header( 'Location: http://itunes.apple.com/us/app/wordpress/id335703880?mt=8' );
+ header( 'Location: https://itunes.apple.com/us/app/wordpress/id335703880?mt=8' );
exit;
break;
case 'blackberry':
diff --git a/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php b/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php
index 964165f0..bab105bf 100644
--- a/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php
+++ b/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php
@@ -27,7 +27,24 @@
<footer id="colophon" role="contentinfo">
<div id="site-generator">
- <a href="<?php echo esc_url( home_url( add_query_arg('ak_action', 'reject_mobile') ) ); ?>"><?php _e( 'View Full Site', 'jetpack' ); ?></a><br />
+
+ <?php
+ /*
+ * Construct "$target_url", which adds "ak_action=reject_mobile"
+ * to the current URL.
+ */
+ global $wp;
+ $url_params = array(
+ 'ak_action' => 'reject_mobile',
+ );
+ if ( is_array( $_GET ) && ! empty( $_GET ) ) {
+ $url_params[] = $_GET;
+ }
+ $target_url = home_url( add_query_arg( $url_params, $wp->request ) );
+ ?>
+
+ <a href="<?php echo esc_url( $target_url ); ?>"><?php _e( 'View Full Site', 'jetpack' ); ?></a>
+ <br />
<?php
/**
diff --git a/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php b/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php
index fadd678c..cd702872 100644
--- a/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php
+++ b/plugins/jetpack/modules/minileven/theme/pub/minileven/functions.php
@@ -1,4 +1,7 @@
<?php
+
+use Automattic\Jetpack\Assets;
+
/**
* Minileven functions and definitions
*
@@ -78,10 +81,9 @@ function minileven_scripts() {
global $post;
wp_enqueue_style( 'style', get_stylesheet_uri() );
-
wp_enqueue_script(
'small-menu',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/minileven/theme/pub/minileven/js/small-menu.min.js',
'modules/minileven/theme/pub/minileven/js/small-menu.js'
),
diff --git a/plugins/jetpack/modules/minileven/theme/pub/minileven/index.php b/plugins/jetpack/modules/minileven/theme/pub/minileven/index.php
index 63a51a19..14a1afdc 100644
--- a/plugins/jetpack/modules/minileven/theme/pub/minileven/index.php
+++ b/plugins/jetpack/modules/minileven/theme/pub/minileven/index.php
@@ -6,7 +6,7 @@
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
- * Learn more: http://codex.wordpress.org/Template_Hierarchy
+ * Learn more: https://codex.wordpress.org/Template_Hierarchy
*
* @package Minileven
*/
diff --git a/plugins/jetpack/modules/module-headings.php b/plugins/jetpack/modules/module-headings.php
index 62cc135a..65bba2e8 100644
--- a/plugins/jetpack/modules/module-headings.php
+++ b/plugins/jetpack/modules/module-headings.php
@@ -1,8 +1,8 @@
<?php
-// Do not edit this file. It's generated by jetpack/tools/build-module-headings-translations.php
+// Do not edit this file. It's generated by `jetpack/tools/build-module-headings-translations.php`
/**
- * For a given module, return an array with translated name, description and recommended description.
+ * For a given module, return an array with translated name and description.
*
* @param string $key Module file name without .php
*
@@ -24,7 +24,7 @@ function jetpack_get_module_i18n( $key ) {
'comments' => array(
'name' => _x( 'Comments', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Let readers use WordPress.com, Twitter, Facebook, or Google+ accounts to comment', 'Module Description', 'jetpack' ),
+ 'description' => _x( 'Let visitors use a WordPress.com, Twitter, Facebook, or Google account to comment', 'Module Description', 'jetpack' ),
),
'contact-form' => array(
@@ -34,8 +34,7 @@ function jetpack_get_module_i18n( $key ) {
'copy-post' => array(
'name' => _x( 'Copy Post', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Copy an existing post\'s content into a new draft post', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Copy an existing post\'s content into a new draft post', 'Jumpstart Description', 'jetpack' ),
+ 'description' => _x( 'Enable the option to copy entire posts and pages, including tags and settings', 'Module Description', 'jetpack' ),
),
'custom-content-types' => array(
@@ -75,13 +74,12 @@ function jetpack_get_module_i18n( $key ) {
'latex' => array(
'name' => _x( 'Beautiful Math', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Use the LaTeX markup language to write mathematical equations and formulas.', 'Module Description', 'jetpack' ),
+ 'description' => _x( 'Use the LaTeX markup language to write mathematical equations and formulas', 'Module Description', 'jetpack' ),
),
'lazy-images' => array(
'name' => _x( 'Lazy Images', 'Module Name', 'jetpack' ),
'description' => _x( 'Speed up your site and create a smoother viewing experience by loading images as visitors scroll down the screen, instead of all at once.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Lazy-loading images improve your site\'s speed and create a smoother viewing experience. Images will load as visitors scroll down the screen, instead of all at once.', 'Jumpstart Description', 'jetpack' ),
),
'likes' => array(
@@ -107,7 +105,6 @@ function jetpack_get_module_i18n( $key ) {
'monitor' => array(
'name' => _x( 'Monitor', 'Module Name', 'jetpack' ),
'description' => _x( 'Jetpack’s downtime monitoring will continuously watch your site, and alert you the moment that downtime is detected.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Receive immediate notifications if your site goes down, 24/7.', 'Jumpstart Description', 'jetpack' ),
),
'notes' => array(
@@ -123,7 +120,6 @@ function jetpack_get_module_i18n( $key ) {
'photon' => array(
'name' => _x( 'Image CDN', 'Module Name', 'jetpack' ),
'description' => _x( 'Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.', 'Jumpstart Description', 'jetpack' ),
),
'post-by-email' => array(
@@ -133,7 +129,7 @@ function jetpack_get_module_i18n( $key ) {
'protect' => array(
'name' => _x( 'Protect', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Protect yourself from brute force and distributed brute force attacks, which are the most common way for hackers to get into your site.', 'Module Description', 'jetpack' ),
+ 'description' => _x( 'Enabling brute force protection will prevent bots and hackers from attempting to log in to your website with common username and password combinations.', 'Module Description', 'jetpack' ),
),
'publicize' => array(
@@ -141,11 +137,6 @@ function jetpack_get_module_i18n( $key ) {
'description' => _x( 'Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.', 'Module Description', 'jetpack' ),
),
- 'pwa' => array(
- 'name' => _x( 'Progressive Web Apps', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Speed up and improve the reliability of your site using the latest in web technology.', 'Module Description', 'jetpack' ),
- ),
-
'related-posts' => array(
'name' => _x( 'Related posts', 'Module Name', 'jetpack' ),
'description' => _x( 'Keep visitors engaged on your blog by highlighting relevant and new content at the bottom of each published post.', 'Module Description', 'jetpack' ),
@@ -183,8 +174,7 @@ function jetpack_get_module_i18n( $key ) {
'sso' => array(
'name' => _x( 'Secure Sign On', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Allow users to log into this site using WordPress.com accounts', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Lets you log in to all your Jetpack-enabled sites with one click using your WordPress.com account.', 'Jumpstart Description', 'jetpack' ),
+ 'description' => _x( 'Allow users to log in to this site using WordPress.com accounts', 'Module Description', 'jetpack' ),
),
'stats' => array(
@@ -194,7 +184,7 @@ function jetpack_get_module_i18n( $key ) {
'subscriptions' => array(
'name' => _x( 'Subscriptions', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Allow users to subscribe to your posts and comments and receive notifications via email', 'Module Description', 'jetpack' ),
+ 'description' => _x( 'Let visitors subscribe to new posts and comments via email', 'Module Description', 'jetpack' ),
),
'tiled-gallery' => array(
@@ -302,7 +292,6 @@ function jetpack_get_module_i18n_tag( $key ) {
// Modules with `Developers` tag:
// - modules/json-api.php
- // - modules/pwa.php
// - modules/sso.php
'Developers' =>_x( 'Developers', 'Module Tag', 'jetpack' ),
diff --git a/plugins/jetpack/modules/module-info.php b/plugins/jetpack/modules/module-info.php
index f13964de..24f2dd16 100644
--- a/plugins/jetpack/modules/module-info.php
+++ b/plugins/jetpack/modules/module-info.php
@@ -78,7 +78,7 @@ add_action( 'jetpack_module_more_info_shortcodes', 'jetpack_shortcodes_more_info
* Shortlinks support link.
*/
function wpme_load_more_link() {
- echo 'http://wp.me/p1moTy-DL';
+ echo 'https://wp.me/p1moTy-DL';
}
add_filter( 'jetpack_learn_more_button_shortlinks', 'wpme_load_more_link' );
@@ -859,25 +859,6 @@ function jetpack_comment_likes_more_info() {
add_action( 'jetpack_module_more_info_comment-likes', 'jetpack_comment_likes_more_info' );
/**
- * Progressive Web Apps support link.
- */
-function jetpack_pwa_more_link() {
- echo 'https://jetpack.com/support/progressive-web-apps/';
-}
-add_action( 'jetpack_learn_more_button_pwa', 'jetpack_pwa_more_link' );
-
-/**
- * Progressive Web Apps description.
- */
-function jetpack_pwa_more_info() {
- esc_html_e(
- 'Speed up and improve the reliability of your site using the latest in web technology.',
- 'jetpack'
- );
-}
-add_action( 'jetpack_module_more_info_pwa', 'jetpack_pwa_more_info' );
-
-/**
* Asset CDN support link.
*/
function jetpack_assetcdn_more_link() {
diff --git a/plugins/jetpack/modules/monitor.php b/plugins/jetpack/modules/monitor.php
index 4e9f01e8..f5f5566f 100644
--- a/plugins/jetpack/modules/monitor.php
+++ b/plugins/jetpack/modules/monitor.php
@@ -2,14 +2,13 @@
/**
* Module Name: Monitor
* Module Description: Jetpack’s downtime monitoring will continuously watch your site, and alert you the moment that downtime is detected.
- * Jumpstart Description: Receive immediate notifications if your site goes down, 24/7.
* Sort Order: 28
* Recommendation Order: 10
* First Introduced: 2.6
* Requires Connection: Yes
* Auto Activate: No
* Module Tags: Recommended
- * Feature: Security, Jumpstart
+ * Feature: Security
* Additional Search Queries: monitor, uptime, downtime, monitoring, maintenance, maintenance mode, offline, site is down, site down, down, repair, error
*/
@@ -33,7 +32,6 @@ class Jetpack_Monitor {
}
public function is_active() {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id()
) );
@@ -45,7 +43,6 @@ class Jetpack_Monitor {
}
public function update_option_receive_jetpack_monitor_notification( $value ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id()
) );
@@ -72,7 +69,6 @@ class Jetpack_Monitor {
* @return boolean|WP_Error
*/
static function user_receives_notifications( $die_on_error = true ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id()
) );
@@ -89,7 +85,6 @@ class Jetpack_Monitor {
}
public function activate_monitor() {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id()
) );
@@ -103,7 +98,6 @@ class Jetpack_Monitor {
}
public function deactivate_monitor() {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id()
) );
@@ -127,7 +121,6 @@ class Jetpack_Monitor {
// return $last_down;
// }
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id()
) );
diff --git a/plugins/jetpack/modules/notes.php b/plugins/jetpack/modules/notes.php
index 3b7ddfaa..13b6b960 100644
--- a/plugins/jetpack/modules/notes.php
+++ b/plugins/jetpack/modules/notes.php
@@ -38,8 +38,7 @@ class Jetpack_Notifications {
function wpcom_static_url($file) {
$i = hexdec( substr( md5( $file ), -1 ) ) % 2;
- $url = 'http://s' . $i . '.wp.com' . $file;
- return set_url_scheme( $url );
+ return 'https://s' . $i . '.wp.com' . $file;
}
// return the major version of Internet Explorer the viewer is using or false if it's not IE
@@ -120,27 +119,51 @@ class Jetpack_Notifications {
}
if ( ! $is_rtl ) {
- wp_enqueue_style( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-v2.css' ), array(), JETPACK_NOTES__CACHE_BUSTER );
+ wp_enqueue_style( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-v2.css' ), array( 'admin-bar' ), JETPACK_NOTES__CACHE_BUSTER );
} else {
- wp_enqueue_style( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/rtl/admin-bar-v2-rtl.css' ), array(), JETPACK_NOTES__CACHE_BUSTER );
+ wp_enqueue_style( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/rtl/admin-bar-v2-rtl.css' ), array( 'admin-bar' ), JETPACK_NOTES__CACHE_BUSTER );
}
- wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array(), JETPACK_NOTES__CACHE_BUSTER );
+
+ wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array( 'wpcom-notes-admin-bar' ), JETPACK_NOTES__CACHE_BUSTER );
$this->print_js();
// attempt to use core or plugin libraries if registered
+ $script_handles = array();
if ( !wp_script_is( 'mustache', 'registered' ) ) {
wp_register_script( 'mustache', $this->wpcom_static_url( '/wp-content/js/mustache.js' ), null, JETPACK_NOTES__CACHE_BUSTER );
}
+ $script_handles[] = 'mustache';
if ( !wp_script_is( 'underscore', 'registered' ) ) {
wp_register_script( 'underscore', $this->wpcom_static_url( '/wp-includes/js/underscore.min.js' ), null, JETPACK_NOTES__CACHE_BUSTER );
}
+ $script_handles[] = 'underscore';
if ( !wp_script_is( 'backbone', 'registered' ) ) {
wp_register_script( 'backbone', $this->wpcom_static_url( '/wp-includes/js/backbone.min.js' ), array( 'underscore' ), JETPACK_NOTES__CACHE_BUSTER );
}
+ $script_handles[] = 'backbone';
wp_register_script( 'wpcom-notes-common', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/notes-common-v2.js' ), array( 'jquery', 'underscore', 'backbone', 'mustache' ), JETPACK_NOTES__CACHE_BUSTER );
+ $script_handles[] = 'wpcom-notes-common';
+ $script_handles[] = 'jquery';
+ $script_handles[] = 'jquery-migrate';
+ $script_handles[] = 'jquery-core';
wp_enqueue_script( 'wpcom-notes-admin-bar', $this->wpcom_static_url( '/wp-content/mu-plugins/notes/admin-bar-v2.js' ), array( 'wpcom-notes-common' ), JETPACK_NOTES__CACHE_BUSTER );
+ $script_handles[] = 'wpcom-notes-admin-bar';
+
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ add_filter(
+ 'script_loader_tag',
+ function ( $tag, $handle ) use ( $script_handles ) {
+ if ( in_array( $handle, $script_handles, true ) ) {
+ $tag = preg_replace( '/(?<=<script)(?=\s|>)/i', ' data-ampdevmode', $tag );
+ }
+ return $tag;
+ },
+ 10,
+ 2
+ );
+ }
}
function admin_bar_menu() {
@@ -181,7 +204,7 @@ class Jetpack_Notifications {
function print_js() {
$link_accounts_url = is_user_logged_in() && !Jetpack::is_user_connected() ? Jetpack::admin_url() : false;
?>
-<script type="text/javascript">
+<script data-ampdevmode type="text/javascript">
/* <![CDATA[ */
var wpNotesIsJetpackClient = true;
var wpNotesIsJetpackClientV2 = true;
diff --git a/plugins/jetpack/modules/omnisearch.php b/plugins/jetpack/modules/omnisearch.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/omnisearch.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/photon-cdn.php b/plugins/jetpack/modules/photon-cdn.php
index ecf0288c..697344bd 100644
--- a/plugins/jetpack/modules/photon-cdn.php
+++ b/plugins/jetpack/modules/photon-cdn.php
@@ -8,7 +8,7 @@
* Requires Connection: No
* Auto Activate: No
* Module Tags: Photos and Videos, Appearance, Recommended
- * Feature: Recommended, Appearance, Jumpstart
+ * Feature: Recommended, Appearance
* Additional Search Queries: site accelerator, accelerate, static, assets, javascript, css, files, performance, cdn, bandwidth, content delivery network, pagespeed, combine js, optimize css
*/
diff --git a/plugins/jetpack/modules/photon-cdn/jetpack-manifest.php b/plugins/jetpack/modules/photon-cdn/jetpack-manifest.php
index b73bd2c6..239a1302 100644
--- a/plugins/jetpack/modules/photon-cdn/jetpack-manifest.php
+++ b/plugins/jetpack/modules/photon-cdn/jetpack-manifest.php
@@ -15,9 +15,9 @@ $assets = array (
10 => 'css/jetpack-idc-admin-bar-rtl.min.css',
11 => 'css/jetpack-idc-rtl.min.css',
12 => 'css/jetpack-icons.css',
- 13 => 'css/jetpack-admin-jitm-rtl.min.css',
- 14 => 'css/jetpack.css',
- 15 => 'css/jetpack-admin-jitm.css',
+ 13 => 'css/jetpack.css',
+ 14 => 'css/jetpack-connect.css',
+ 15 => 'css/jetpack-connect-rtl.min.css',
16 => 'css/jetpack-icons-rtl.min.css',
17 => 'css/jetpack-idc.css',
18 => 'css/jetpack-banners-rtl.min.css',
@@ -29,390 +29,419 @@ $assets = array (
24 => 'css/jetpack-banners.min.css',
25 => 'css/jetpack-idc-admin-bar.css',
26 => 'css/jetpack-rtl.css',
- 27 => 'css/jetpack-admin-jitm-rtl.css',
+ 27 => 'css/jetpack-connect.min.css',
28 => 'css/dashboard-widget.css',
- 29 => 'css/jetpack-admin-jitm.min.css',
+ 29 => 'css/jetpack-connect-rtl.css',
30 => '3rd-party/debug-bar/debug-bar.css',
31 => '3rd-party/debug-bar/debug-bar.js',
- 32 => '_inc/blocks/vendors~swiper.59b62a96313990494c44.js',
- 33 => '_inc/blocks/tiled-gallery/view.rtl.css',
- 34 => '_inc/blocks/tiled-gallery/view.js',
- 35 => '_inc/blocks/tiled-gallery/view.css',
- 36 => '_inc/blocks/editor.css',
- 37 => '_inc/blocks/vendors~swiper.59b62a96313990494c44.rtl.css',
- 38 => '_inc/blocks/editor.rtl.css',
- 39 => '_inc/blocks/vendors~map/mapbox-gl.f81f5e1d3c950198407d.css',
- 40 => '_inc/blocks/vendors~map/mapbox-gl.f81f5e1d3c950198407d.js',
- 41 => '_inc/blocks/vendors~map/mapbox-gl.f81f5e1d3c950198407d.rtl.css',
- 42 => '_inc/blocks/vendors~swiper.59b62a96313990494c44.css',
- 43 => '_inc/blocks/repeat-visitor/view.js',
- 44 => '_inc/blocks/editor-beta.js',
- 45 => '_inc/blocks/mailchimp/view.rtl.css',
- 46 => '_inc/blocks/mailchimp/view.js',
- 47 => '_inc/blocks/mailchimp/view.css',
- 48 => '_inc/blocks/membership-button/view.rtl.css',
- 49 => '_inc/blocks/membership-button/view.js',
- 50 => '_inc/blocks/membership-button/view.css',
- 51 => '_inc/blocks/editor.js',
- 52 => '_inc/blocks/map/view.rtl.css',
- 53 => '_inc/blocks/map/view.js',
- 54 => '_inc/blocks/map/view.css',
- 55 => '_inc/blocks/editor-beta.css',
- 56 => '_inc/blocks/contact-info/view.rtl.css',
- 57 => '_inc/blocks/contact-info/view.js',
- 58 => '_inc/blocks/contact-info/view.css',
- 59 => '_inc/blocks/slideshow/view.rtl.css',
- 60 => '_inc/blocks/slideshow/view.js',
- 61 => '_inc/blocks/slideshow/view.css',
- 62 => '_inc/blocks/editor-beta.rtl.css',
- 63 => '_inc/blocks/gif/view.rtl.css',
- 64 => '_inc/blocks/gif/view.js',
- 65 => '_inc/blocks/gif/view.css',
- 66 => '_inc/idc-notice.js',
- 67 => '_inc/jetpack-modules.js',
- 68 => '_inc/jquery.jetpack-resize.js',
- 69 => '_inc/genericons/genericons/genericons.css',
- 70 => '_inc/genericons/genericons/rtl/genericons-rtl.css',
- 71 => '_inc/genericons/genericons.css',
- 72 => '_inc/jetpack-modules.views.js',
- 73 => '_inc/jquery.spin.js',
- 74 => '_inc/facebook-embed.js',
- 75 => '_inc/twitter-timeline.js',
- 76 => '_inc/spin.js',
- 77 => '_inc/accessible-focus.js',
- 78 => '_inc/jetpack-jitm.js',
- 79 => '_inc/jetpack-modules.models.js',
- 80 => '_inc/social-logos/social-logos.min.css',
- 81 => '_inc/social-logos/social-logos.css',
- 82 => '_inc/gallery-settings.js',
- 83 => '_inc/lib/tracks/tracks-callables.js',
- 84 => '_inc/lib/tracks/tracks-ajax.js',
- 85 => '_inc/build/infinite-scroll/infinity.min.js',
- 86 => '_inc/build/videopress/js/videopress-plupload.min.js',
- 87 => '_inc/build/videopress/js/videopress-uploader.min.js',
- 88 => '_inc/build/videopress/js/media-video-widget-extensions.min.js',
- 89 => '_inc/build/videopress/js/editor-view.min.js',
- 90 => '_inc/build/tiled-gallery/tiled-gallery/tiled-gallery.min.js',
- 91 => '_inc/build/jetpack-connection-banner.min.js',
- 92 => '_inc/build/style.min.css',
- 93 => '_inc/build/masterbar/tracks-events.min.js',
- 94 => '_inc/build/sharedaddy/admin-sharing.min.js',
- 95 => '_inc/build/sharedaddy/sharing.min.js',
- 96 => '_inc/build/jquery.spin.min.js',
- 97 => '_inc/build/custom-post-types/comics/comics.min.js',
- 98 => '_inc/build/custom-post-types/js/nova-drag-drop.min.js',
- 99 => '_inc/build/custom-post-types/js/many-items.min.js',
- 100 => '_inc/build/custom-post-types/js/menu-checkboxes.min.js',
- 101 => '_inc/build/jquery.jetpack-resize.min.js',
- 102 => '_inc/build/likes/post-count-jetpack.min.js',
- 103 => '_inc/build/likes/queuehandler.min.js',
- 104 => '_inc/build/likes/post-count.min.js',
- 105 => '_inc/build/admin.dops-style.css',
- 106 => '_inc/build/comment-likes/comment-like-count.min.js',
- 107 => '_inc/build/idc-notice.min.js',
- 108 => '_inc/build/accessible-focus.min.js',
- 109 => '_inc/build/contact-form/js/grunion.min.js',
- 110 => '_inc/build/contact-form/js/tinymce-plugin-form-button.min.js',
- 111 => '_inc/build/contact-form/js/grunion-admin.min.js',
- 112 => '_inc/build/contact-form/js/grunion-frontend.min.js',
- 113 => '_inc/build/contact-form/js/editor-view.min.js',
- 114 => '_inc/build/jetpack-modules.models.min.js',
- 115 => '_inc/build/related-posts/related-posts.min.js',
- 116 => '_inc/build/related-posts/related-posts-customizer.min.js',
- 117 => '_inc/build/carousel/jetpack-carousel.min.js',
- 118 => '_inc/build/shortcodes/js/brightcove.min.js',
- 119 => '_inc/build/shortcodes/js/gist.min.js',
- 120 => '_inc/build/shortcodes/js/recipes-printthis.min.js',
- 121 => '_inc/build/shortcodes/js/main.min.js',
- 122 => '_inc/build/shortcodes/js/recipes.min.js',
- 123 => '_inc/build/shortcodes/js/jmpress.min.js',
- 124 => '_inc/build/shortcodes/js/instagram.min.js',
- 125 => '_inc/build/shortcodes/js/slideshow-shortcode.min.js',
- 126 => '_inc/build/shortcodes/js/quiz.min.js',
- 127 => '_inc/build/minileven/theme/pub/minileven/js/small-menu.min.js',
- 128 => '_inc/build/custom-css/custom-css/js/core-customizer-css-preview.min.js',
- 129 => '_inc/build/custom-css/custom-css/js/core-customizer-css.core-4.9.min.js',
- 130 => '_inc/build/custom-css/custom-css/js/use-codemirror.min.js',
- 131 => '_inc/build/custom-css/custom-css/js/core-customizer-css.min.js',
- 132 => '_inc/build/custom-css/custom-css/js/css-editor.min.js',
- 133 => '_inc/build/jetpack-jitm.min.js',
- 134 => '_inc/build/gallery-settings.min.js',
- 135 => '_inc/build/spin.min.js',
- 136 => '_inc/build/jetpack-admin.min.js',
- 137 => '_inc/build/admin.js',
- 138 => '_inc/build/twitter-timeline.min.js',
- 139 => '_inc/build/jetpack-modules.views.min.js',
- 140 => '_inc/build/photon/photon.min.js',
- 141 => '_inc/build/style.min.rtl.css',
- 142 => '_inc/build/jetpack-modules.min.js',
- 143 => '_inc/build/postmessage.min.js',
- 144 => '_inc/build/widget-visibility/widget-conditions/widget-conditions.min.js',
- 145 => '_inc/build/facebook-embed.min.js',
- 146 => '_inc/build/widgets/simple-payments/customizer.min.js',
- 147 => '_inc/build/widgets/social-icons/social-icons-admin.min.js',
- 148 => '_inc/build/widgets/eu-cookie-law/eu-cookie-law.min.js',
- 149 => '_inc/build/widgets/eu-cookie-law/eu-cookie-law-admin.min.js',
- 150 => '_inc/build/widgets/gallery/js/gallery.min.js',
- 151 => '_inc/build/widgets/gallery/js/admin.min.js',
- 152 => '_inc/build/widgets/milestone/milestone.min.js',
- 153 => '_inc/build/widgets/milestone/admin.min.js',
- 154 => '_inc/build/widgets/search/js/search-widget.min.js',
- 155 => '_inc/build/widgets/search/js/search-widget-admin.min.js',
- 156 => '_inc/build/widgets/customizer-utils.min.js',
- 157 => '_inc/build/widgets/contact-info/contact-info-admin.min.js',
- 158 => '_inc/build/widgets/twitter-timeline-admin.min.js',
- 159 => '_inc/build/widgets/google-translate/google-translate.min.js',
- 160 => '_inc/build/lazy-images/js/lazy-images.min.js',
- 161 => '_inc/build/admin.dops-style.rtl.css',
- 162 => '_inc/jetpack-admin.js',
- 163 => '_inc/jetpack-connection-banner.js',
- 164 => '_inc/postmessage.js',
- 165 => 'modules/infinite-scroll/infinity.js',
- 166 => 'modules/infinite-scroll/infinity.css',
- 167 => 'modules/infinite-scroll/themes/twentysixteen.css',
- 168 => 'modules/infinite-scroll/themes/twentyeleven.css',
- 169 => 'modules/infinite-scroll/themes/twentyten.css',
- 170 => 'modules/infinite-scroll/themes/twentyseventeen-rtl.css',
- 171 => 'modules/infinite-scroll/themes/twentyfifteen.css',
- 172 => 'modules/infinite-scroll/themes/twentysixteen-rtl.css',
- 173 => 'modules/infinite-scroll/themes/twentyseventeen.css',
- 174 => 'modules/infinite-scroll/themes/twentytwelve.css',
- 175 => 'modules/infinite-scroll/themes/twentyfourteen.css',
- 176 => 'modules/infinite-scroll/themes/twentyfifteen-rtl.css',
- 177 => 'modules/infinite-scroll/themes/twentythirteen.css',
- 178 => 'modules/videopress/css/videopress-editor-style-rtl.css',
- 179 => 'modules/videopress/css/videopress-editor-style.min.css',
- 180 => 'modules/videopress/css/editor.css',
- 181 => 'modules/videopress/css/videopress-editor-style-rtl.min.css',
- 182 => 'modules/videopress/css/editor.min.css',
- 183 => 'modules/videopress/css/editor-rtl.css',
- 184 => 'modules/videopress/css/editor-rtl.min.css',
- 185 => 'modules/videopress/css/videopress-editor-style.css',
- 186 => 'modules/videopress/js/media-video-widget-extensions.js',
- 187 => 'modules/videopress/js/videopress-plupload.js',
- 188 => 'modules/videopress/js/videopress-uploader.js',
- 189 => 'modules/videopress/js/editor-view.js',
- 190 => 'modules/videopress/videopress-admin.css',
- 191 => 'modules/videopress/videopress-admin.min.css',
- 192 => 'modules/videopress/videopress-admin-rtl.css',
- 193 => 'modules/videopress/videopress-admin-rtl.min.css',
- 194 => 'modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css',
- 195 => 'modules/tiled-gallery/tiled-gallery/tiled-gallery.css',
- 196 => 'modules/tiled-gallery/tiled-gallery/rtl/tiled-gallery-rtl.css',
- 197 => 'modules/tiled-gallery/tiled-gallery/tiled-gallery.js',
- 198 => 'modules/simple-payments/simple-payments.css',
- 199 => 'modules/simple-payments/paypal-express-checkout.js',
- 200 => 'modules/masterbar/overrides.css',
- 201 => 'modules/masterbar/tracks-events.js',
- 202 => 'modules/sharedaddy/admin-sharing-rtl.min.css',
- 203 => 'modules/sharedaddy/sharing.js',
- 204 => 'modules/sharedaddy/sharing.css',
- 205 => 'modules/sharedaddy/admin-sharing.js',
- 206 => 'modules/sharedaddy/admin-sharing.min.css',
- 207 => 'modules/sharedaddy/admin-sharing-rtl.css',
- 208 => 'modules/sharedaddy/admin-sharing.css',
- 209 => 'modules/custom-post-types/comics/comics.min.css',
- 210 => 'modules/custom-post-types/comics/comics-rtl.css',
- 211 => 'modules/custom-post-types/comics/comics.css',
- 212 => 'modules/custom-post-types/comics/comics-rtl.min.css',
- 213 => 'modules/custom-post-types/comics/comics.js',
- 214 => 'modules/custom-post-types/comics/admin.css',
- 215 => 'modules/custom-post-types/comics/rtl/comics-rtl.css',
- 216 => 'modules/custom-post-types/css/portfolio-shortcode.css',
- 217 => 'modules/custom-post-types/css/testimonial-shortcode.css',
- 218 => 'modules/custom-post-types/css/nova-font.css',
- 219 => 'modules/custom-post-types/css/edit-items.css',
- 220 => 'modules/custom-post-types/css/nova.css',
- 221 => 'modules/custom-post-types/css/many-items.css',
- 222 => 'modules/custom-post-types/js/menu-checkboxes.js',
- 223 => 'modules/custom-post-types/js/many-items.js',
- 224 => 'modules/custom-post-types/js/nova-drag-drop.js',
- 225 => 'modules/calypsoify/style-gutenberg-rtl.min.css',
- 226 => 'modules/calypsoify/style-rtl.min.css',
- 227 => 'modules/calypsoify/style.min.css',
- 228 => 'modules/calypsoify/style-gutenberg.min.css',
- 229 => 'modules/calypsoify/mods-gutenberg.js',
- 230 => 'modules/calypsoify/mods.js',
- 231 => 'modules/likes/post-count.js',
- 232 => 'modules/likes/post-count-jetpack.js',
- 233 => 'modules/likes/style.css',
- 234 => 'modules/likes/queuehandler.js',
- 235 => 'modules/protect/protect-dashboard-widget-rtl.min.css',
- 236 => 'modules/protect/protect-dashboard-widget.css',
- 237 => 'modules/protect/protect-dashboard-widget.min.css',
- 238 => 'modules/protect/protect-dashboard-widget-rtl.css',
- 239 => 'modules/comment-likes/comment-like-count.js',
- 240 => 'modules/comment-likes/admin-style.css',
- 241 => 'modules/contact-form/css/editor-ui.min.css',
- 242 => 'modules/contact-form/css/editor-ui-rtl.css',
- 243 => 'modules/contact-form/css/editor-inline-editing-style.css',
- 244 => 'modules/contact-form/css/editor-inline-editing-style-rtl.css',
- 245 => 'modules/contact-form/css/editor-inline-editing-style.min.css',
- 246 => 'modules/contact-form/css/editor-style-rtl.min.css',
- 247 => 'modules/contact-form/css/jquery-ui-datepicker.css',
- 248 => 'modules/contact-form/css/grunion.css',
- 249 => 'modules/contact-form/css/editor-ui.css',
- 250 => 'modules/contact-form/css/editor-style.css',
- 251 => 'modules/contact-form/css/editor-style-rtl.css',
- 252 => 'modules/contact-form/css/editor-inline-editing-style-rtl.min.css',
- 253 => 'modules/contact-form/css/editor-style.min.css',
- 254 => 'modules/contact-form/css/grunion-rtl.css',
- 255 => 'modules/contact-form/css/editor-ui-rtl.min.css',
- 256 => 'modules/contact-form/js/grunion.js',
- 257 => 'modules/contact-form/js/grunion-admin.js',
- 258 => 'modules/contact-form/js/editor-view.js',
- 259 => 'modules/contact-form/js/grunion-frontend.js',
- 260 => 'modules/contact-form/js/tinymce-plugin-form-button.js',
- 261 => 'modules/related-posts/related-posts.css',
- 262 => 'modules/related-posts/related-posts.js',
- 263 => 'modules/related-posts/related-posts-rtl.css',
- 264 => 'modules/related-posts/rtl/related-posts-rtl.css',
- 265 => 'modules/related-posts/related-posts-customizer.js',
- 266 => 'modules/carousel/jetpack-carousel.js',
- 267 => 'modules/carousel/rtl/jetpack-carousel-rtl.css',
- 268 => 'modules/carousel/jetpack-carousel.css',
- 269 => 'modules/carousel/jetpack-carousel-rtl.css',
- 270 => 'modules/shortcodes/css/recipes.css',
- 271 => 'modules/shortcodes/css/slideshow-shortcode.min.css',
- 272 => 'modules/shortcodes/css/slideshow-shortcode-rtl.css',
- 273 => 'modules/shortcodes/css/recipes-print.min.css',
- 274 => 'modules/shortcodes/css/recipes-rtl.css',
- 275 => 'modules/shortcodes/css/recipes.min.css',
- 276 => 'modules/shortcodes/css/recipes-print-rtl.css',
- 277 => 'modules/shortcodes/css/recipes-print.css',
- 278 => 'modules/shortcodes/css/slideshow-shortcode-rtl.min.css',
- 279 => 'modules/shortcodes/css/recipes-rtl.min.css',
- 280 => 'modules/shortcodes/css/recipes-print-rtl.min.css',
- 281 => 'modules/shortcodes/css/style.css',
- 282 => 'modules/shortcodes/css/quiz.css',
- 283 => 'modules/shortcodes/css/slideshow-shortcode.css',
- 284 => 'modules/shortcodes/js/brightcove.js',
- 285 => 'modules/shortcodes/js/quiz.js',
- 286 => 'modules/shortcodes/js/recipes-printthis.js',
- 287 => 'modules/shortcodes/js/jmpress.js',
- 288 => 'modules/shortcodes/js/slideshow-shortcode.js',
- 289 => 'modules/shortcodes/js/main.js',
- 290 => 'modules/shortcodes/js/jquery.cycle.min.js',
- 291 => 'modules/shortcodes/js/instagram.js',
- 292 => 'modules/shortcodes/js/recipes.js',
- 293 => 'modules/shortcodes/js/gist.js',
- 294 => 'modules/subscriptions/subscriptions.css',
- 295 => 'modules/minileven/theme/pub/minileven/js/small-menu.js',
- 296 => 'modules/minileven/theme/pub/minileven/style.css',
- 297 => 'modules/minileven/theme/pub/minileven/rtl.css',
- 298 => 'modules/wordads/css/style.css',
- 299 => 'modules/custom-css/csstidy/cssparse-rtl.min.css',
- 300 => 'modules/custom-css/csstidy/cssparse-rtl.css',
- 301 => 'modules/custom-css/csstidy/cssparse.min.css',
- 302 => 'modules/custom-css/csstidy/cssparsed-rtl.min.css',
- 303 => 'modules/custom-css/csstidy/cssparsed.css',
- 304 => 'modules/custom-css/csstidy/cssparse.css',
- 305 => 'modules/custom-css/csstidy/cssparsed-rtl.css',
- 306 => 'modules/custom-css/csstidy/cssparsed.min.css',
- 307 => 'modules/custom-css/custom-css/css/blank.css',
- 308 => 'modules/custom-css/custom-css/css/css-editor.css',
- 309 => 'modules/custom-css/custom-css/css/use-codemirror.css',
- 310 => 'modules/custom-css/custom-css/css/codemirror.css',
- 311 => 'modules/custom-css/custom-css/css/codemirror-rtl.min.css',
- 312 => 'modules/custom-css/custom-css/css/css-editor-rtl.min.css',
- 313 => 'modules/custom-css/custom-css/css/css-editor-rtl.css',
- 314 => 'modules/custom-css/custom-css/css/customizer-control.css',
- 315 => 'modules/custom-css/custom-css/css/codemirror-rtl.css',
- 316 => 'modules/custom-css/custom-css/css/css-editor.min.css',
- 317 => 'modules/custom-css/custom-css/css/codemirror.min.css',
- 318 => 'modules/custom-css/custom-css/css/rtl/codemirror-rtl.css',
- 319 => 'modules/custom-css/custom-css/css/use-codemirror-rtl.css',
- 320 => 'modules/custom-css/custom-css/css/use-codemirror.min.css',
- 321 => 'modules/custom-css/custom-css/css/use-codemirror-rtl.min.css',
- 322 => 'modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js',
- 323 => 'modules/custom-css/custom-css/js/css-editor.js',
- 324 => 'modules/custom-css/custom-css/js/codemirror.min.js',
- 325 => 'modules/custom-css/custom-css/js/core-customizer-css-preview.js',
- 326 => 'modules/custom-css/custom-css/js/core-customizer-css.js',
- 327 => 'modules/custom-css/custom-css/js/use-codemirror.js',
- 328 => 'modules/sso/jetpack-sso-login.css',
- 329 => 'modules/sso/jetpack-sso-login.js',
- 330 => 'modules/sso/jetpack-sso-login-rtl.css',
- 331 => 'modules/sso/jetpack-sso-login.min.css',
- 332 => 'modules/sso/jetpack-sso-login-rtl.min.css',
- 333 => 'modules/theme-tools/site-logo/css/site-logo-control.css',
- 334 => 'modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css',
- 335 => 'modules/theme-tools/site-logo/css/site-logo-control.min.css',
- 336 => 'modules/theme-tools/site-logo/css/site-logo-control-rtl.css',
- 337 => 'modules/theme-tools/site-logo/js/site-logo.min.js',
- 338 => 'modules/theme-tools/site-logo/js/site-logo.js',
- 339 => 'modules/theme-tools/site-logo/js/site-logo-header-text.js',
- 340 => 'modules/theme-tools/site-logo/js/site-logo-control.js',
- 341 => 'modules/theme-tools/site-logo/js/site-logo-header-text.min.js',
- 342 => 'modules/theme-tools/site-logo/js/site-logo-control.min.js',
- 343 => 'modules/theme-tools/compat/twentysixteen.css',
- 344 => 'modules/theme-tools/compat/twentynineteen.css',
- 345 => 'modules/theme-tools/compat/twentyfourteen-rtl.css',
- 346 => 'modules/theme-tools/compat/twentyfifteen.css',
- 347 => 'modules/theme-tools/compat/twentysixteen-rtl.css',
- 348 => 'modules/theme-tools/compat/twentynineteen-rtl.css',
- 349 => 'modules/theme-tools/compat/twentyfourteen.css',
- 350 => 'modules/theme-tools/compat/twentyfifteen-rtl.css',
- 351 => 'modules/theme-tools/content-options/customizer.js',
- 352 => 'modules/theme-tools/js/suggest.js',
- 353 => 'modules/theme-tools/social-menu/social-menu.css',
- 354 => 'modules/theme-tools/responsive-videos/responsive-videos.css',
- 355 => 'modules/theme-tools/responsive-videos/responsive-videos.js',
- 356 => 'modules/theme-tools/responsive-videos/responsive-videos.min.js',
- 357 => 'modules/post-by-email/post-by-email-rtl.css',
- 358 => 'modules/post-by-email/post-by-email.min.css',
- 359 => 'modules/post-by-email/post-by-email-rtl.min.css',
- 360 => 'modules/post-by-email/post-by-email.css',
- 361 => 'modules/post-by-email/post-by-email.js',
- 362 => 'modules/photon/photon.js',
- 363 => 'modules/plugin-search/plugin-search.css',
- 364 => 'modules/plugin-search/plugin-search.js',
- 365 => 'modules/widget-visibility/widget-conditions/widget-conditions-rtl.min.css',
- 366 => 'modules/widget-visibility/widget-conditions/widget-conditions-rtl.css',
- 367 => 'modules/widget-visibility/widget-conditions/widget-conditions.min.css',
- 368 => 'modules/widget-visibility/widget-conditions/widget-conditions.css',
- 369 => 'modules/widget-visibility/widget-conditions/rtl/widget-conditions-rtl.css',
- 370 => 'modules/widget-visibility/widget-conditions/widget-conditions.js',
- 371 => 'modules/widgets/simple-payments/customizer.css',
- 372 => 'modules/widgets/simple-payments/customizer.js',
- 373 => 'modules/widgets/simple-payments/style.css',
- 374 => 'modules/widgets/twitter-timeline-admin.js',
- 375 => 'modules/widgets/facebook-likebox/style.css',
- 376 => 'modules/widgets/customizer-utils.js',
- 377 => 'modules/widgets/goodreads/css/goodreads.css',
- 378 => 'modules/widgets/goodreads/css/rtl/goodreads-rtl.css',
- 379 => 'modules/widgets/social-media-icons/style.css',
- 380 => 'modules/widgets/my-community/style.css',
- 381 => 'modules/widgets/authors/style.css',
- 382 => 'modules/widgets/social-icons/social-icons-admin.js',
- 383 => 'modules/widgets/social-icons/social-icons-admin.css',
- 384 => 'modules/widgets/social-icons/social-icons.css',
- 385 => 'modules/widgets/eu-cookie-law/eu-cookie-law.js',
- 386 => 'modules/widgets/eu-cookie-law/style.css',
- 387 => 'modules/widgets/eu-cookie-law/eu-cookie-law-admin.js',
- 388 => 'modules/widgets/flickr/style.css',
- 389 => 'modules/widgets/gallery/css/admin-rtl.min.css',
- 390 => 'modules/widgets/gallery/css/admin.css',
- 391 => 'modules/widgets/gallery/css/admin-rtl.css',
- 392 => 'modules/widgets/gallery/css/admin.min.css',
- 393 => 'modules/widgets/gallery/css/rtl/admin-rtl.css',
- 394 => 'modules/widgets/gallery/js/gallery.js',
- 395 => 'modules/widgets/gallery/js/admin.js',
- 396 => 'modules/widgets/top-posts/style.css',
- 397 => 'modules/widgets/milestone/style-admin.css',
- 398 => 'modules/widgets/milestone/milestone.js',
- 399 => 'modules/widgets/milestone/admin.js',
- 400 => 'modules/widgets/search/css/search-widget-frontend.css',
- 401 => 'modules/widgets/search/css/search-widget-admin-ui.css',
- 402 => 'modules/widgets/search/js/search-widget-admin.js',
- 403 => 'modules/widgets/search/js/search-widget.js',
- 404 => 'modules/widgets/contact-info/contact-info-admin.js',
- 405 => 'modules/widgets/contact-info/contact-info-map.css',
- 406 => 'modules/widgets/image-widget/style.css',
- 407 => 'modules/widgets/customizer-controls.css',
- 408 => 'modules/widgets/google-translate/google-translate.js',
- 409 => 'modules/widgets/wordpress-post-widget/style.css',
- 410 => 'modules/widgets/gravatar-profile.css',
- 411 => 'modules/lazy-images/js/lazy-images.js',
- 412 => 'modules/wpgroho.js',
+ 32 => '_inc/blocks/tiled-gallery/view.rtl.css',
+ 33 => '_inc/blocks/tiled-gallery/view.js',
+ 34 => '_inc/blocks/tiled-gallery/view.css',
+ 35 => '_inc/blocks/editor.css',
+ 36 => '_inc/blocks/editor.rtl.css',
+ 37 => '_inc/blocks/rating-star/view.rtl.css',
+ 38 => '_inc/blocks/rating-star/view.js',
+ 39 => '_inc/blocks/rating-star/view.css',
+ 40 => '_inc/blocks/vendors~map/mapbox-gl.1239e27c56411388bad5.rtl.css',
+ 41 => '_inc/blocks/vendors~map/mapbox-gl.1239e27c56411388bad5.css',
+ 42 => '_inc/blocks/vendors~map/mapbox-gl.1239e27c56411388bad5.js',
+ 43 => '_inc/blocks/vendors~swiper.17b5bcc416832d7a0c9e.css',
+ 44 => '_inc/blocks/repeat-visitor/view.js',
+ 45 => '_inc/blocks/business-hours/view.rtl.css',
+ 46 => '_inc/blocks/business-hours/view.js',
+ 47 => '_inc/blocks/business-hours/view.css',
+ 48 => '_inc/blocks/editor-beta.js',
+ 49 => '_inc/blocks/mailchimp/view.rtl.css',
+ 50 => '_inc/blocks/mailchimp/view.js',
+ 51 => '_inc/blocks/mailchimp/view.css',
+ 52 => '_inc/blocks/vendors~swiper.17b5bcc416832d7a0c9e.js',
+ 53 => '_inc/blocks/editor.js',
+ 54 => '_inc/blocks/map/view.rtl.css',
+ 55 => '_inc/blocks/map/view.js',
+ 56 => '_inc/blocks/map/view.css',
+ 57 => '_inc/blocks/components.js',
+ 58 => '_inc/blocks/recurring-payments/view.rtl.css',
+ 59 => '_inc/blocks/recurring-payments/view.js',
+ 60 => '_inc/blocks/recurring-payments/view.css',
+ 61 => '_inc/blocks/editor-beta.css',
+ 62 => '_inc/blocks/contact-info/view.rtl.css',
+ 63 => '_inc/blocks/contact-info/view.js',
+ 64 => '_inc/blocks/contact-info/view.css',
+ 65 => '_inc/blocks/components.rtl.css',
+ 66 => '_inc/blocks/components.css',
+ 67 => '_inc/blocks/slideshow/view.rtl.css',
+ 68 => '_inc/blocks/slideshow/view.js',
+ 69 => '_inc/blocks/slideshow/view.css',
+ 70 => '_inc/blocks/editor-beta.rtl.css',
+ 71 => '_inc/blocks/vendors~swiper.17b5bcc416832d7a0c9e.rtl.css',
+ 72 => '_inc/blocks/gif/view.rtl.css',
+ 73 => '_inc/blocks/gif/view.js',
+ 74 => '_inc/blocks/gif/view.css',
+ 75 => '_inc/idc-notice.js',
+ 76 => '_inc/jetpack-modules.js',
+ 77 => '_inc/crowdsignal-survey.js',
+ 78 => '_inc/polldaddy-shortcode.js',
+ 79 => '_inc/crowdsignal-shortcode.js',
+ 80 => '_inc/connect-button.js',
+ 81 => '_inc/jquery.jetpack-resize.js',
+ 82 => '_inc/genericons/genericons/genericons.css',
+ 83 => '_inc/genericons/genericons/rtl/genericons-rtl.css',
+ 84 => '_inc/genericons/genericons.css',
+ 85 => '_inc/jetpack-modules.views.js',
+ 86 => '_inc/jquery.spin.js',
+ 87 => '_inc/facebook-embed.js',
+ 88 => '_inc/twitter-timeline.js',
+ 89 => '_inc/spin.js',
+ 90 => '_inc/accessible-focus.js',
+ 91 => '_inc/jetpack-jitm.js',
+ 92 => '_inc/jetpack-modules.models.js',
+ 93 => '_inc/social-logos/social-logos.min.css',
+ 94 => '_inc/social-logos/social-logos.css',
+ 95 => '_inc/gallery-settings.js',
+ 96 => '_inc/lib/tracks/tracks-callables.js',
+ 97 => '_inc/lib/tracks/tracks-ajax.js',
+ 98 => '_inc/build/infinite-scroll/infinity.min.js',
+ 99 => '_inc/build/admin.rtl.css',
+ 100 => '_inc/build/videopress/js/videopress-plupload.min.js',
+ 101 => '_inc/build/videopress/js/gutenberg-video-upload.min.js',
+ 102 => '_inc/build/videopress/js/videopress-uploader.min.js',
+ 103 => '_inc/build/videopress/js/media-video-widget-extensions.min.js',
+ 104 => '_inc/build/videopress/js/editor-view.min.js',
+ 105 => '_inc/build/tiled-gallery/tiled-gallery/tiled-gallery.min.js',
+ 106 => '_inc/build/jetpack-connection-banner.min.js',
+ 107 => '_inc/build/style.min.css',
+ 108 => '_inc/build/crowdsignal-survey.min.js',
+ 109 => '_inc/build/masterbar/tracks-events.min.js',
+ 110 => '_inc/build/sharedaddy/admin-sharing.min.js',
+ 111 => '_inc/build/sharedaddy/sharing.min.js',
+ 112 => '_inc/build/jquery.spin.min.js',
+ 113 => '_inc/build/custom-post-types/comics/comics.min.js',
+ 114 => '_inc/build/custom-post-types/js/nova-drag-drop.min.js',
+ 115 => '_inc/build/custom-post-types/js/many-items.min.js',
+ 116 => '_inc/build/custom-post-types/js/menu-checkboxes.min.js',
+ 117 => '_inc/build/instant-search/jp-search.bundle.js',
+ 118 => '_inc/build/instant-search/search.css',
+ 119 => '_inc/build/instant-search/instant-search.min.css',
+ 120 => '_inc/build/instant-search/search.rtl.css',
+ 121 => '_inc/build/jquery.jetpack-resize.min.js',
+ 122 => '_inc/build/crowdsignal-shortcode.min.js',
+ 123 => '_inc/build/likes/post-count-jetpack.min.js',
+ 124 => '_inc/build/likes/queuehandler.min.js',
+ 125 => '_inc/build/likes/post-count.min.js',
+ 126 => '_inc/build/static.rtl.css',
+ 127 => '_inc/build/static.css',
+ 128 => '_inc/build/polldaddy-shortcode.min.js',
+ 129 => '_inc/build/comment-likes/comment-like-count.min.js',
+ 130 => '_inc/build/idc-notice.min.js',
+ 131 => '_inc/build/accessible-focus.min.js',
+ 132 => '_inc/build/contact-form/js/grunion.min.js',
+ 133 => '_inc/build/contact-form/js/tinymce-plugin-form-button.min.js',
+ 134 => '_inc/build/contact-form/js/grunion-admin.min.js',
+ 135 => '_inc/build/contact-form/js/grunion-frontend.min.js',
+ 136 => '_inc/build/contact-form/js/editor-view.min.js',
+ 137 => '_inc/build/jetpack-modules.models.min.js',
+ 138 => '_inc/build/connect-button.min.js',
+ 139 => '_inc/build/related-posts/related-posts.min.js',
+ 140 => '_inc/build/related-posts/related-posts-customizer.min.js',
+ 141 => '_inc/build/carousel/jetpack-carousel.min.js',
+ 142 => '_inc/build/shortcodes/js/brightcove.min.js',
+ 143 => '_inc/build/shortcodes/js/gist.min.js',
+ 144 => '_inc/build/shortcodes/js/recipes-printthis.min.js',
+ 145 => '_inc/build/shortcodes/js/main.min.js',
+ 146 => '_inc/build/shortcodes/js/recipes.min.js',
+ 147 => '_inc/build/shortcodes/js/jmpress.min.js',
+ 148 => '_inc/build/shortcodes/js/instagram.min.js',
+ 149 => '_inc/build/shortcodes/js/slideshow-shortcode.min.js',
+ 150 => '_inc/build/shortcodes/js/quiz.min.js',
+ 151 => '_inc/build/minileven/theme/pub/minileven/js/small-menu.min.js',
+ 152 => '_inc/build/custom-css/custom-css/js/core-customizer-css-preview.min.js',
+ 153 => '_inc/build/custom-css/custom-css/js/core-customizer-css.core-4.9.min.js',
+ 154 => '_inc/build/custom-css/custom-css/js/use-codemirror.min.js',
+ 155 => '_inc/build/custom-css/custom-css/js/core-customizer-css.min.js',
+ 156 => '_inc/build/custom-css/custom-css/js/css-editor.min.js',
+ 157 => '_inc/build/jetpack-jitm.min.js',
+ 158 => '_inc/build/gallery-settings.min.js',
+ 159 => '_inc/build/admin.css',
+ 160 => '_inc/build/spin.min.js',
+ 161 => '_inc/build/jetpack-admin.min.js',
+ 162 => '_inc/build/admin.js',
+ 163 => '_inc/build/twitter-timeline.min.js',
+ 164 => '_inc/build/jetpack-modules.views.min.js',
+ 165 => '_inc/build/photon/photon.min.js',
+ 166 => '_inc/build/style.min.rtl.css',
+ 167 => '_inc/build/jetpack-modules.min.js',
+ 168 => '_inc/build/postmessage.min.js',
+ 169 => '_inc/build/widget-visibility/widget-conditions/widget-conditions.min.js',
+ 170 => '_inc/build/facebook-embed.min.js',
+ 171 => '_inc/build/static.js',
+ 172 => '_inc/build/widgets/simple-payments/customizer.min.js',
+ 173 => '_inc/build/widgets/social-icons/social-icons-admin.min.js',
+ 174 => '_inc/build/widgets/eu-cookie-law/eu-cookie-law.min.js',
+ 175 => '_inc/build/widgets/eu-cookie-law/eu-cookie-law-admin.min.js',
+ 176 => '_inc/build/widgets/gallery/js/gallery.min.js',
+ 177 => '_inc/build/widgets/gallery/js/admin.min.js',
+ 178 => '_inc/build/widgets/milestone/milestone.min.js',
+ 179 => '_inc/build/widgets/milestone/admin.min.js',
+ 180 => '_inc/build/widgets/search/js/search-widget.min.js',
+ 181 => '_inc/build/widgets/search/js/search-widget-admin.min.js',
+ 182 => '_inc/build/widgets/customizer-utils.min.js',
+ 183 => '_inc/build/widgets/contact-info/contact-info-admin.min.js',
+ 184 => '_inc/build/widgets/twitter-timeline-admin.min.js',
+ 185 => '_inc/build/widgets/google-translate/google-translate.min.js',
+ 186 => '_inc/build/lazy-images/js/lazy-images.min.js',
+ 187 => '_inc/jetpack-admin.js',
+ 188 => '_inc/jetpack-connection-banner.js',
+ 189 => '_inc/postmessage.js',
+ 190 => 'modules/infinite-scroll/infinity.js',
+ 191 => 'modules/infinite-scroll/infinity.css',
+ 192 => 'modules/infinite-scroll/themes/twentysixteen.css',
+ 193 => 'modules/infinite-scroll/themes/twentyeleven.css',
+ 194 => 'modules/infinite-scroll/themes/twentyten.css',
+ 195 => 'modules/infinite-scroll/themes/twentyseventeen-rtl.css',
+ 196 => 'modules/infinite-scroll/themes/twentyfifteen.css',
+ 197 => 'modules/infinite-scroll/themes/twentysixteen-rtl.css',
+ 198 => 'modules/infinite-scroll/themes/twentyseventeen.css',
+ 199 => 'modules/infinite-scroll/themes/twentytwelve.css',
+ 200 => 'modules/infinite-scroll/themes/twentyfourteen.css',
+ 201 => 'modules/infinite-scroll/themes/twentyfifteen-rtl.css',
+ 202 => 'modules/infinite-scroll/themes/twentythirteen.css',
+ 203 => 'modules/videopress/css/videopress-editor-style-rtl.css',
+ 204 => 'modules/videopress/css/videopress-editor-style.min.css',
+ 205 => 'modules/videopress/css/editor.css',
+ 206 => 'modules/videopress/css/videopress-editor-style-rtl.min.css',
+ 207 => 'modules/videopress/css/editor.min.css',
+ 208 => 'modules/videopress/css/editor-rtl.css',
+ 209 => 'modules/videopress/css/editor-rtl.min.css',
+ 210 => 'modules/videopress/css/videopress-editor-style.css',
+ 211 => 'modules/videopress/js/media-video-widget-extensions.js',
+ 212 => 'modules/videopress/js/videopress-plupload.js',
+ 213 => 'modules/videopress/js/videopress-uploader.js',
+ 214 => 'modules/videopress/js/editor-view.js',
+ 215 => 'modules/videopress/js/gutenberg-video-upload.js',
+ 216 => 'modules/videopress/videopress-admin.css',
+ 217 => 'modules/videopress/videopress-admin.min.css',
+ 218 => 'modules/videopress/videopress-admin-rtl.css',
+ 219 => 'modules/videopress/videopress-admin-rtl.min.css',
+ 220 => 'modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css',
+ 221 => 'modules/tiled-gallery/tiled-gallery/tiled-gallery.css',
+ 222 => 'modules/tiled-gallery/tiled-gallery/rtl/tiled-gallery-rtl.css',
+ 223 => 'modules/tiled-gallery/tiled-gallery/tiled-gallery.js',
+ 224 => 'modules/simple-payments/simple-payments.css',
+ 225 => 'modules/simple-payments/paypal-express-checkout.js',
+ 226 => 'modules/masterbar/overrides.css',
+ 227 => 'modules/masterbar/tracks-events.js',
+ 228 => 'modules/sharedaddy/admin-sharing-rtl.min.css',
+ 229 => 'modules/sharedaddy/sharing.js',
+ 230 => 'modules/sharedaddy/sharing.css',
+ 231 => 'modules/sharedaddy/admin-sharing.js',
+ 232 => 'modules/sharedaddy/admin-sharing.min.css',
+ 233 => 'modules/sharedaddy/admin-sharing-rtl.css',
+ 234 => 'modules/sharedaddy/admin-sharing.css',
+ 235 => 'modules/custom-post-types/comics/comics.min.css',
+ 236 => 'modules/custom-post-types/comics/comics-rtl.css',
+ 237 => 'modules/custom-post-types/comics/comics.css',
+ 238 => 'modules/custom-post-types/comics/comics-rtl.min.css',
+ 239 => 'modules/custom-post-types/comics/comics.js',
+ 240 => 'modules/custom-post-types/comics/admin.css',
+ 241 => 'modules/custom-post-types/comics/rtl/comics-rtl.css',
+ 242 => 'modules/custom-post-types/css/portfolio-shortcode.css',
+ 243 => 'modules/custom-post-types/css/testimonial-shortcode.css',
+ 244 => 'modules/custom-post-types/css/nova-font.css',
+ 245 => 'modules/custom-post-types/css/edit-items.css',
+ 246 => 'modules/custom-post-types/css/nova.css',
+ 247 => 'modules/custom-post-types/css/many-items.css',
+ 248 => 'modules/custom-post-types/js/menu-checkboxes.js',
+ 249 => 'modules/custom-post-types/js/many-items.js',
+ 250 => 'modules/custom-post-types/js/nova-drag-drop.js',
+ 251 => 'modules/calypsoify/style-gutenberg-rtl.min.css',
+ 252 => 'modules/calypsoify/style-rtl.min.css',
+ 253 => 'modules/calypsoify/style.min.css',
+ 254 => 'modules/calypsoify/style-gutenberg.min.css',
+ 255 => 'modules/calypsoify/mods-gutenberg.js',
+ 256 => 'modules/calypsoify/mods.js',
+ 257 => 'modules/likes/post-count.js',
+ 258 => 'modules/likes/post-count-jetpack.js',
+ 259 => 'modules/likes/style.css',
+ 260 => 'modules/likes/queuehandler.js',
+ 261 => 'modules/protect/protect-dashboard-widget-rtl.min.css',
+ 262 => 'modules/protect/protect-dashboard-widget.css',
+ 263 => 'modules/protect/protect-dashboard-widget.min.css',
+ 264 => 'modules/protect/protect-dashboard-widget-rtl.css',
+ 265 => 'modules/comment-likes/comment-like-count.js',
+ 266 => 'modules/comment-likes/admin-style.css',
+ 267 => 'modules/contact-form/css/editor-ui.min.css',
+ 268 => 'modules/contact-form/css/editor-ui-rtl.css',
+ 269 => 'modules/contact-form/css/editor-inline-editing-style.css',
+ 270 => 'modules/contact-form/css/editor-inline-editing-style-rtl.css',
+ 271 => 'modules/contact-form/css/editor-inline-editing-style.min.css',
+ 272 => 'modules/contact-form/css/editor-style-rtl.min.css',
+ 273 => 'modules/contact-form/css/jquery-ui-datepicker.css',
+ 274 => 'modules/contact-form/css/grunion.css',
+ 275 => 'modules/contact-form/css/editor-ui.css',
+ 276 => 'modules/contact-form/css/editor-style.css',
+ 277 => 'modules/contact-form/css/editor-style-rtl.css',
+ 278 => 'modules/contact-form/css/editor-inline-editing-style-rtl.min.css',
+ 279 => 'modules/contact-form/css/editor-style.min.css',
+ 280 => 'modules/contact-form/css/grunion-rtl.css',
+ 281 => 'modules/contact-form/css/editor-ui-rtl.min.css',
+ 282 => 'modules/contact-form/js/grunion.js',
+ 283 => 'modules/contact-form/js/grunion-admin.js',
+ 284 => 'modules/contact-form/js/editor-view.js',
+ 285 => 'modules/contact-form/js/grunion-frontend.js',
+ 286 => 'modules/contact-form/js/tinymce-plugin-form-button.js',
+ 287 => 'modules/related-posts/related-posts.css',
+ 288 => 'modules/related-posts/related-posts.js',
+ 289 => 'modules/related-posts/related-posts-rtl.css',
+ 290 => 'modules/related-posts/rtl/related-posts-rtl.css',
+ 291 => 'modules/related-posts/related-posts-customizer.js',
+ 292 => 'modules/carousel/jetpack-carousel.js',
+ 293 => 'modules/carousel/rtl/jetpack-carousel-rtl.css',
+ 294 => 'modules/carousel/jetpack-carousel.css',
+ 295 => 'modules/carousel/jetpack-carousel-rtl.css',
+ 296 => 'modules/shortcodes/css/recipes.css',
+ 297 => 'modules/shortcodes/css/slideshow-shortcode.min.css',
+ 298 => 'modules/shortcodes/css/slideshow-shortcode-rtl.css',
+ 299 => 'modules/shortcodes/css/recipes-print.min.css',
+ 300 => 'modules/shortcodes/css/recipes-rtl.css',
+ 301 => 'modules/shortcodes/css/recipes.min.css',
+ 302 => 'modules/shortcodes/css/recipes-print-rtl.css',
+ 303 => 'modules/shortcodes/css/recipes-print.css',
+ 304 => 'modules/shortcodes/css/slideshow-shortcode-rtl.min.css',
+ 305 => 'modules/shortcodes/css/recipes-rtl.min.css',
+ 306 => 'modules/shortcodes/css/recipes-print-rtl.min.css',
+ 307 => 'modules/shortcodes/css/style.css',
+ 308 => 'modules/shortcodes/css/quiz.css',
+ 309 => 'modules/shortcodes/css/slideshow-shortcode.css',
+ 310 => 'modules/shortcodes/js/brightcove.js',
+ 311 => 'modules/shortcodes/js/quiz.js',
+ 312 => 'modules/shortcodes/js/recipes-printthis.js',
+ 313 => 'modules/shortcodes/js/jmpress.js',
+ 314 => 'modules/shortcodes/js/slideshow-shortcode.js',
+ 315 => 'modules/shortcodes/js/main.js',
+ 316 => 'modules/shortcodes/js/jquery.cycle.min.js',
+ 317 => 'modules/shortcodes/js/instagram.js',
+ 318 => 'modules/shortcodes/js/recipes.js',
+ 319 => 'modules/shortcodes/js/gist.js',
+ 320 => 'modules/subscriptions/subscriptions.css',
+ 321 => 'modules/minileven/theme/pub/minileven/js/small-menu.js',
+ 322 => 'modules/minileven/theme/pub/minileven/style.css',
+ 323 => 'modules/minileven/theme/pub/minileven/rtl.css',
+ 324 => 'modules/wordads/css/style.css',
+ 325 => 'modules/custom-css/csstidy/cssparse-rtl.min.css',
+ 326 => 'modules/custom-css/csstidy/cssparse-rtl.css',
+ 327 => 'modules/custom-css/csstidy/cssparse.min.css',
+ 328 => 'modules/custom-css/csstidy/cssparsed-rtl.min.css',
+ 329 => 'modules/custom-css/csstidy/cssparsed.css',
+ 330 => 'modules/custom-css/csstidy/cssparse.css',
+ 331 => 'modules/custom-css/csstidy/cssparsed-rtl.css',
+ 332 => 'modules/custom-css/csstidy/cssparsed.min.css',
+ 333 => 'modules/custom-css/custom-css/css/blank.css',
+ 334 => 'modules/custom-css/custom-css/css/css-editor.css',
+ 335 => 'modules/custom-css/custom-css/css/use-codemirror.css',
+ 336 => 'modules/custom-css/custom-css/css/codemirror.css',
+ 337 => 'modules/custom-css/custom-css/css/codemirror-rtl.min.css',
+ 338 => 'modules/custom-css/custom-css/css/css-editor-rtl.min.css',
+ 339 => 'modules/custom-css/custom-css/css/css-editor-rtl.css',
+ 340 => 'modules/custom-css/custom-css/css/customizer-control.css',
+ 341 => 'modules/custom-css/custom-css/css/codemirror-rtl.css',
+ 342 => 'modules/custom-css/custom-css/css/css-editor.min.css',
+ 343 => 'modules/custom-css/custom-css/css/codemirror.min.css',
+ 344 => 'modules/custom-css/custom-css/css/rtl/codemirror-rtl.css',
+ 345 => 'modules/custom-css/custom-css/css/use-codemirror-rtl.css',
+ 346 => 'modules/custom-css/custom-css/css/use-codemirror.min.css',
+ 347 => 'modules/custom-css/custom-css/css/use-codemirror-rtl.min.css',
+ 348 => 'modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js',
+ 349 => 'modules/custom-css/custom-css/js/css-editor.js',
+ 350 => 'modules/custom-css/custom-css/js/codemirror.min.js',
+ 351 => 'modules/custom-css/custom-css/js/core-customizer-css-preview.js',
+ 352 => 'modules/custom-css/custom-css/js/core-customizer-css.js',
+ 353 => 'modules/custom-css/custom-css/js/use-codemirror.js',
+ 354 => 'modules/sso/jetpack-sso-login.css',
+ 355 => 'modules/sso/jetpack-sso-login.js',
+ 356 => 'modules/sso/jetpack-sso-login-rtl.css',
+ 357 => 'modules/sso/jetpack-sso-login.min.css',
+ 358 => 'modules/sso/jetpack-sso-login-rtl.min.css',
+ 359 => 'modules/theme-tools/site-logo/css/site-logo-control.css',
+ 360 => 'modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css',
+ 361 => 'modules/theme-tools/site-logo/css/site-logo-control.min.css',
+ 362 => 'modules/theme-tools/site-logo/css/site-logo-control-rtl.css',
+ 363 => 'modules/theme-tools/site-logo/js/site-logo.min.js',
+ 364 => 'modules/theme-tools/site-logo/js/site-logo.js',
+ 365 => 'modules/theme-tools/site-logo/js/site-logo-header-text.js',
+ 366 => 'modules/theme-tools/site-logo/js/site-logo-control.js',
+ 367 => 'modules/theme-tools/site-logo/js/site-logo-header-text.min.js',
+ 368 => 'modules/theme-tools/site-logo/js/site-logo-control.min.js',
+ 369 => 'modules/theme-tools/compat/twentysixteen.css',
+ 370 => 'modules/theme-tools/compat/twentynineteen.css',
+ 371 => 'modules/theme-tools/compat/twentytwenty-rtl.css',
+ 372 => 'modules/theme-tools/compat/twentyfourteen-rtl.css',
+ 373 => 'modules/theme-tools/compat/twentyfifteen.css',
+ 374 => 'modules/theme-tools/compat/twentysixteen-rtl.css',
+ 375 => 'modules/theme-tools/compat/twentynineteen-rtl.css',
+ 376 => 'modules/theme-tools/compat/twentyfourteen.css',
+ 377 => 'modules/theme-tools/compat/twentytwenty.css',
+ 378 => 'modules/theme-tools/compat/twentyfifteen-rtl.css',
+ 379 => 'modules/theme-tools/content-options/customizer.js',
+ 380 => 'modules/theme-tools/js/suggest.js',
+ 381 => 'modules/theme-tools/social-menu/social-menu.css',
+ 382 => 'modules/theme-tools/responsive-videos/responsive-videos.css',
+ 383 => 'modules/theme-tools/responsive-videos/responsive-videos.js',
+ 384 => 'modules/theme-tools/responsive-videos/responsive-videos.min.js',
+ 385 => 'modules/post-by-email/post-by-email-rtl.css',
+ 386 => 'modules/post-by-email/post-by-email.min.css',
+ 387 => 'modules/post-by-email/post-by-email-rtl.min.css',
+ 388 => 'modules/post-by-email/post-by-email.css',
+ 389 => 'modules/post-by-email/post-by-email.js',
+ 390 => 'modules/.eslintrc.js',
+ 391 => 'modules/photon/photon.js',
+ 392 => 'modules/plugin-search/plugin-search.css',
+ 393 => 'modules/plugin-search/plugin-search.js',
+ 394 => 'modules/widget-visibility/widget-conditions/widget-conditions-rtl.min.css',
+ 395 => 'modules/widget-visibility/widget-conditions/widget-conditions-rtl.css',
+ 396 => 'modules/widget-visibility/widget-conditions/widget-conditions.min.css',
+ 397 => 'modules/widget-visibility/widget-conditions/widget-conditions.css',
+ 398 => 'modules/widget-visibility/widget-conditions/rtl/widget-conditions-rtl.css',
+ 399 => 'modules/widget-visibility/widget-conditions/widget-conditions.js',
+ 400 => 'modules/widgets/simple-payments/customizer.css',
+ 401 => 'modules/widgets/simple-payments/customizer.js',
+ 402 => 'modules/widgets/simple-payments/style.css',
+ 403 => 'modules/widgets/twitter-timeline-admin.js',
+ 404 => 'modules/widgets/facebook-likebox/style.css',
+ 405 => 'modules/widgets/customizer-utils.js',
+ 406 => 'modules/widgets/goodreads/css/goodreads.css',
+ 407 => 'modules/widgets/goodreads/css/rtl/goodreads-rtl.css',
+ 408 => 'modules/widgets/social-media-icons/style.css',
+ 409 => 'modules/widgets/my-community/style.css',
+ 410 => 'modules/widgets/authors/style.css',
+ 411 => 'modules/widgets/social-icons/social-icons-admin.js',
+ 412 => 'modules/widgets/social-icons/social-icons-admin.css',
+ 413 => 'modules/widgets/social-icons/social-icons.css',
+ 414 => 'modules/widgets/eu-cookie-law/eu-cookie-law.js',
+ 415 => 'modules/widgets/eu-cookie-law/style.css',
+ 416 => 'modules/widgets/eu-cookie-law/eu-cookie-law-admin.js',
+ 417 => 'modules/widgets/flickr/style.css',
+ 418 => 'modules/widgets/gallery/css/admin-rtl.min.css',
+ 419 => 'modules/widgets/gallery/css/admin.css',
+ 420 => 'modules/widgets/gallery/css/admin-rtl.css',
+ 421 => 'modules/widgets/gallery/css/admin.min.css',
+ 422 => 'modules/widgets/gallery/css/rtl/admin-rtl.css',
+ 423 => 'modules/widgets/gallery/js/gallery.js',
+ 424 => 'modules/widgets/gallery/js/admin.js',
+ 425 => 'modules/widgets/top-posts/style.css',
+ 426 => 'modules/widgets/milestone/style-admin.css',
+ 427 => 'modules/widgets/milestone/milestone.js',
+ 428 => 'modules/widgets/milestone/admin.js',
+ 429 => 'modules/widgets/search/css/search-widget-frontend.css',
+ 430 => 'modules/widgets/search/css/search-widget-admin-ui.css',
+ 431 => 'modules/widgets/search/js/search-widget-admin.js',
+ 432 => 'modules/widgets/search/js/search-widget.js',
+ 433 => 'modules/widgets/contact-info/contact-info-admin.js',
+ 434 => 'modules/widgets/contact-info/contact-info-map.css',
+ 435 => 'modules/widgets/image-widget/style.css',
+ 436 => 'modules/widgets/customizer-controls.css',
+ 437 => 'modules/widgets/google-translate/google-translate.js',
+ 438 => 'modules/widgets/wordpress-post-widget/style.css',
+ 439 => 'modules/widgets/gravatar-profile.css',
+ 440 => 'modules/lazy-images/js/lazy-images.js',
+ 441 => 'modules/wpgroho.js',
);
diff --git a/plugins/jetpack/modules/photon.php b/plugins/jetpack/modules/photon.php
index cd61ee70..429797b3 100644
--- a/plugins/jetpack/modules/photon.php
+++ b/plugins/jetpack/modules/photon.php
@@ -2,14 +2,13 @@
/**
* Module Name: Image CDN
* Module Description: Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.
- * Jumpstart Description: Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.
* Sort Order: 25
* Recommendation Order: 1
* First Introduced: 2.0
* Requires Connection: Yes
* Auto Activate: No
* Module Tags: Photos and Videos, Appearance, Recommended
- * Feature: Recommended, Jumpstart, Appearance
+ * Feature: Recommended, Appearance
* Additional Search Queries: photon, photo cdn, image cdn, speed, compression, resize, responsive images, responsive, content distribution network, optimize, page speed, image optimize, photon jetpack
*/
diff --git a/plugins/jetpack/modules/photon/photon.js b/plugins/jetpack/modules/photon/photon.js
index f7d32dfc..f68daebc 100644
--- a/plugins/jetpack/modules/photon/photon.js
+++ b/plugins/jetpack/modules/photon/photon.js
@@ -1,11 +1,9 @@
-/* jshint onevar: false */
-
( function() {
function recalculate() {
if ( this.complete ) {
// Support for lazy loading: if there is a lazy-src attribute and it's value
// is not the same as the current src we should wait until the image load event
- var lazySrc = this.getAttribute('data-lazy-src');
+ var lazySrc = this.getAttribute( 'data-lazy-src' );
if ( lazySrc && this.src !== lazySrc ) {
this.addEventListener( 'onload', recalculate );
return;
@@ -15,35 +13,33 @@
var width = this.width;
var height = this.height;
if ( width && width > 0 && height && height > 0 ) {
- this.setAttribute('width', width);
- this.setAttribute('height', height);
+ this.setAttribute( 'width', width );
+ this.setAttribute( 'height', height );
reset_for_retina( this );
}
- }
- else {
+ } else {
this.addEventListener( 'onload', recalculate );
return;
}
}
-
+
/**
* For images lacking explicit dimensions and needing them, try to add them.
*/
var restore_dims = function() {
- var elements = document.querySelectorAll( 'img[data-recalc-dims]' );
- for (var i = 0; i < elements.length; i++) {
- recalculate.call( elements[i] );
- }
- },
-
- /**
- * Modify given image's markup so that devicepx-jetpack.js will act on the image and it won't be reprocessed by this script.
- */
- reset_for_retina = function( img ) {
- img.removeAttribute( 'data-recalc-dims' );
- img.removeAttribute( 'scale' );
- };
+ var elements = document.querySelectorAll( 'img[data-recalc-dims]' );
+ for ( var i = 0; i < elements.length; i++ ) {
+ recalculate.call( elements[ i ] );
+ }
+ },
+ /**
+ * Modify given image's markup so that devicepx-jetpack.js will act on the image and it won't be reprocessed by this script.
+ */
+ reset_for_retina = function( img ) {
+ img.removeAttribute( 'data-recalc-dims' );
+ img.removeAttribute( 'scale' );
+ };
/**
* Check both when page loads, and when IS is triggered.
@@ -56,6 +52,6 @@
restore_dims();
}
}
-
+
document.body.addEventListener( 'post-load', restore_dims );
} )();
diff --git a/plugins/jetpack/modules/plugin-search.php b/plugins/jetpack/modules/plugin-search.php
index b85e0586..9a950e0d 100644
--- a/plugins/jetpack/modules/plugin-search.php
+++ b/plugins/jetpack/modules/plugin-search.php
@@ -1,4 +1,8 @@
<?php
+
+use Automattic\Jetpack\Constants;
+use Automattic\Jetpack\Tracking;
+
/**
* Disable direct access and execution.
*/
@@ -12,6 +16,8 @@ if (
Jetpack::is_active() &&
/** This filter is documented in _inc/lib/admin-pages/class.jetpack-react-page.php */
apply_filters( 'jetpack_show_promotions', true ) &&
+ // Disable feature hints when plugins cannot be installed.
+ ! Constants::is_true( 'DISALLOW_FILE_MODS' ) &&
jetpack_is_psh_active()
) {
Jetpack_Plugin_Search::init();
@@ -34,7 +40,6 @@ class Jetpack_Plugin_Search {
static $instance = null;
if ( ! $instance ) {
- jetpack_require_lib( 'tracks/client' );
$instance = new Jetpack_Plugin_Search();
}
@@ -285,6 +290,7 @@ class Jetpack_Plugin_Search {
// Looks like a search query; it's matching time
if ( ! empty( $args->search ) ) {
require_once JETPACK__PLUGIN_DIR . 'class.jetpack-admin.php';
+ $tracking = new Tracking();
$jetpack_modules_list = array_intersect_key(
array_merge( $this->get_extra_features(), Jetpack_Admin::init()->get_modules() ),
array_flip( array(
@@ -307,7 +313,7 @@ class Jetpack_Plugin_Search {
// Record event when user searches for a term over 3 chars (less than 3 is not very useful.)
if ( strlen( $args->search ) >= 3 ) {
- JetpackTracking::record_user_event( 'wpa_plugin_search_term', array( 'search_term' => $args->search ) );
+ $tracking->record_user_event( 'wpa_plugin_search_term', array( 'search_term' => $args->search ) );
}
// Lowercase, trim, remove punctuation/special chars, decode url, remove 'jetpack'
@@ -337,7 +343,7 @@ class Jetpack_Plugin_Search {
if ( isset( $matching_module ) && $this->should_display_hint( $matching_module ) ) {
// Record event when a matching feature is found
- JetpackTracking::record_user_event( 'wpa_plugin_search_match_found', array( 'feature' => $matching_module ) );
+ $tracking->record_user_event( 'wpa_plugin_search_match_found', array( 'feature' => $matching_module ) );
$inject = (array) self::get_jetpack_plugin_data();
$image_url = plugins_url( 'modules/plugin-search/psh', JETPACK__PLUGIN_FILE );
@@ -374,16 +380,14 @@ class Jetpack_Plugin_Search {
*
* @since 7.1.0
* @since 7.2.0 Only remove Jetpack.
+ * @since 7.4.0 Simplify for WordPress 5.1+.
*
* @param array|object $plugin
*
* @return bool
*/
function filter_cards( $plugin ) {
- // Take in account that before WordPress 5.1, the list of plugins is an array of objects.
- // With WordPress 5.1 the list of plugins is an array of arrays.
- $slug = is_array( $plugin ) ? $plugin['slug'] : $plugin->slug;
- return ! in_array( $slug, array( 'jetpack' ), true );
+ return ! in_array( $plugin['slug'], array( 'jetpack' ), true );
}
/**
diff --git a/plugins/jetpack/modules/post-by-email.php b/plugins/jetpack/modules/post-by-email.php
index 4d71b93a..851303c1 100644
--- a/plugins/jetpack/modules/post-by-email.php
+++ b/plugins/jetpack/modules/post-by-email.php
@@ -99,7 +99,7 @@ class Jetpack_Post_By_Email {
<div id="jp-pbe-info"<?php echo $info_hidden; ?>>
<p id="jp-pbe-email-wrapper">
<input type="text" id="jp-pbe-email" value="<?php echo esc_attr( $email ); ?>" readonly="readonly" class="regular-text" />
- <span class="description"><a target="_blank" href="http://jetpack.com/support/post-by-email/"><?php esc_html_e( 'More information', 'jetpack' ); ?></a></span>
+ <span class="description"><a target="_blank" href="https://jetpack.com/support/post-by-email/"><?php esc_html_e( 'More information', 'jetpack' ); ?></a></span>
</p>
<p>
<input type="button" name="jp-pbe-regenerate" id="jp-pbe-regenerate" class="button" value="<?php esc_attr_e( 'Regenerate Address', 'jetpack' ); ?> " />
@@ -129,7 +129,6 @@ class Jetpack_Post_By_Email {
}
function get_post_by_email_address() {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id(),
) );
@@ -179,7 +178,7 @@ class Jetpack_Post_By_Email {
if ( empty( $_REQUEST['pbe_nonce'] ) || ! wp_verify_nonce( $_REQUEST['pbe_nonce'], $endpoint ) ) {
wp_send_json_error( $error_message );
}
- Jetpack::load_xml_rpc_client();
+
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id(),
) );
diff --git a/plugins/jetpack/modules/protect.php b/plugins/jetpack/modules/protect.php
index 334439fc..09b0c81c 100644
--- a/plugins/jetpack/modules/protect.php
+++ b/plugins/jetpack/modules/protect.php
@@ -1,7 +1,7 @@
<?php
/**
* Module Name: Protect
- * Module Description: Protect yourself from brute force and distributed brute force attacks, which are the most common way for hackers to get into your site.
+ * Module Description: Enabling brute force protection will prevent bots and hackers from attempting to log in to your website with common username and password combinations.
* Sort Order: 1
* Recommendation Order: 4
* First Introduced: 3.4
@@ -12,6 +12,9 @@
* Additional Search Queries: security, jetpack protect, secure, protection, botnet, brute force, protect, login, bot, password, passwords, strong passwords, strong password, wp-login.php, protect admin
*/
+use Automattic\Jetpack\Constants;
+use Automattic\Jetpack\Connection\Utils as Connection_Utils;
+
include_once JETPACK__PLUGIN_DIR . 'modules/protect/shared-functions.php';
class Jetpack_Protect_Module {
@@ -139,53 +142,77 @@ class Jetpack_Protect_Module {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}
- if ( ! ( is_plugin_active_for_network( 'jetpack/jetpack.php' ) || is_plugin_active_for_network( 'jetpack-dev/jetpack.php' ) ) ) {
- add_action( 'load-index.php', array ( $this, 'prepare_jetpack_protect_multisite_notice' ) );
+ if ( ! is_plugin_active_for_network( plugin_basename( JETPACK__PLUGIN_FILE ) ) ) {
+ add_action( 'load-index.php', array( $this, 'prepare_jetpack_protect_multisite_notice' ) );
+ add_action( 'wp_ajax_jetpack-protect-dismiss-multisite-banner', array( $this, 'ajax_dismiss_handler' ) );
}
}
}
public function prepare_jetpack_protect_multisite_notice() {
- add_action( 'admin_print_styles', array ( $this, 'admin_banner_styles' ) );
+ $dismissed = get_site_option( 'jetpack_dismissed_protect_multisite_banner' );
+ if ( $dismissed ) {
+ return;
+ }
+
add_action( 'admin_notices', array ( $this, 'admin_jetpack_manage_notice' ) );
}
- public function admin_banner_styles() {
- global $wp_styles;
+ public function ajax_dismiss_handler() {
+ check_ajax_referer( 'jetpack_protect_multisite_banner_opt_out' );
+
+ if ( ! current_user_can( 'manage_network' ) ) {
+ wp_send_json_error( new WP_Error( 'insufficient_permissions' ) );
+ }
- $min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
+ update_site_option( 'jetpack_dismissed_protect_multisite_banner', true );
- wp_enqueue_style( 'jetpack', plugins_url( "css/jetpack-banners{$min}.css", JETPACK__PLUGIN_FILE ), false, JETPACK__VERSION );
- $wp_styles->add_data( 'jetpack', 'rtl', true );
+ wp_send_json_success();
}
+ /**
+ * Displays a warning about Jetpack Protect's network activation requirement.
+ * Attaches some custom JS to Core's `is-dismissible` UI to save the dismissed state.
+ */
public function admin_jetpack_manage_notice() {
-
- $dismissed = get_site_option( 'jetpack_dismissed_protect_multisite_banner' );
-
- if ( $dismissed ) {
- return;
- }
-
- $referer = '&_wp_http_referer=' . add_query_arg( '_wp_http_referer', null );
- $opt_out_url = wp_nonce_url( Jetpack::admin_url( 'jetpack-notice=jetpack-protect-multisite-opt-out' . $referer ), 'jetpack_protect_multisite_banner_opt_out' );
-
?>
- <div id="message" class="updated jetpack-message jp-banner is-opt-in protect-error"
- style="display:block !important;">
- <a class="jp-banner__dismiss" href="<?php echo esc_url( $opt_out_url ); ?>"
- title="<?php esc_attr_e( 'Dismiss this notice.', 'jetpack' ); ?>"></a>
-
- <div class="jp-banner__content">
- <h2><?php esc_html_e( 'Protect cannot keep your site secure.', 'jetpack' ); ?></h2>
-
- <p><?php printf( __( 'Thanks for activating Protect! To start protecting your site, please network activate Jetpack on your Multisite installation and activate Protect on your primary site. Due to the way logins are handled on WordPress Multisite, Jetpack must be network-enabled in order for Protect to work properly. <a href="%s" target="_blank">Learn More</a>', 'jetpack' ), 'http://jetpack.com/support/multisite-protect' ); ?></p>
- </div>
- <div class="jp-banner__action-container is-opt-in">
- <a href="<?php echo esc_url( network_admin_url( 'plugins.php' ) ); ?>" class="jp-banner__button"
- id="wpcom-connect"><?php _e( 'View Network Admin', 'jetpack' ); ?></a>
- </div>
+ <div class="jetpack-protect-warning notice notice-warning is-dismissible" data-dismiss-nonce="<?php echo esc_attr( wp_create_nonce( 'jetpack_protect_multisite_banner_opt_out' ) ); ?>">
+ <h2><?php esc_html_e( 'Jetpack Brute Force Attack Prevention cannot keep your site secure', 'jetpack' ); ?></h2>
+
+ <p><?php esc_html_e( "Thanks for activating Jetpack's brute force attack prevention feature! To start protecting your whole WordPress Multisite Network, please network activate the Jetpack plugin. Due to the way logins are handled on WordPress Multisite Networks, Jetpack must be network activated in order for the brute force attack prevention feature to work properly.", 'jetpack' ); ?></p>
+
+ <p>
+ <a class="button-primary" href="<?php echo esc_url( network_admin_url( 'plugins.php' ) ); ?>">
+ <?php esc_html_e( 'View Network Admin', 'jetpack' ); ?>
+ </a>
+ <a class="button" href="<?php echo esc_url( __( 'https://jetpack.com/support/multisite-protect', 'jetpack' ) ); ?>" target="_blank">
+ <?php esc_html_e( 'Learn More' ); ?>
+ </a>
+ </p>
</div>
+ <script>
+ jQuery( function( $ ) {
+ $( '.jetpack-protect-warning' ).on( 'click', 'button.notice-dismiss', function( event ) {
+ event.preventDefault();
+
+ wp.ajax.post(
+ 'jetpack-protect-dismiss-multisite-banner',
+ {
+ _wpnonce: $( event.delegateTarget ).data( 'dismiss-nonce' ),
+ }
+ ).fail( function( error ) { <?php
+ // A failure here is really strange, and there's not really anything a site owner can do to fix one.
+ // Just log the error for now to help debugging. ?>
+
+ if ( 'function' === typeof error.done && '-1' === error.responseText ) {
+ console.error( 'Notice dismissal failed: check_ajax_referer' );
+ } else {
+ console.error( 'Notice dismissal failed: ' + JSON.stringify( error ) );
+ }
+ } )
+ } );
+ } );
+ </script>
<?php
}
@@ -222,7 +249,6 @@ class Jetpack_Protect_Module {
}
// Request the key
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array (
'user_id' => get_current_user_id()
) );
@@ -438,7 +464,7 @@ class Jetpack_Protect_Module {
/**
* JETPACK_ALWAYS_PROTECT_LOGIN will always disable the login page, and use a page provided by Jetpack.
*/
- if ( Jetpack_Constants::is_true( 'JETPACK_ALWAYS_PROTECT_LOGIN' ) ) {
+ if ( Constants::is_true( 'JETPACK_ALWAYS_PROTECT_LOGIN' ) ) {
$this->kill_login();
}
@@ -840,7 +866,7 @@ class Jetpack_Protect_Module {
}
//Check to see if we can use SSL
- $this->api_endpoint = Jetpack::fix_url_for_bad_hosts( JETPACK_PROTECT__API_HOST );
+ $this->api_endpoint = Connection_Utils::fix_url_for_bad_hosts( JETPACK_PROTECT__API_HOST );
return $this->api_endpoint;
}
@@ -856,14 +882,14 @@ class Jetpack_Protect_Module {
$uri = network_home_url();
}
- $uridata = parse_url( $uri );
+ $uridata = wp_parse_url( $uri );
$domain = $uridata['host'];
// If we still don't have the site_url, get it
if ( ! $domain ) {
$uri = get_site_url( 1 );
- $uridata = parse_url( $uri );
+ $uridata = wp_parse_url( $uri );
$domain = $uridata['host'];
}
diff --git a/plugins/jetpack/modules/protect/blocked-login-page.php b/plugins/jetpack/modules/protect/blocked-login-page.php
index 246031f6..eb488692 100644
--- a/plugins/jetpack/modules/protect/blocked-login-page.php
+++ b/plugins/jetpack/modules/protect/blocked-login-page.php
@@ -1,5 +1,6 @@
<?php
+use Automattic\Jetpack\Connection\Client;
/**
* Class Jetpack_Protect_Blocked_Login_Page
@@ -159,7 +160,7 @@ class Jetpack_Protect_Blocked_Login_Page {
public function is_valid_protect_recovery_key( $key, $user_id ) {
$path = sprintf( '/sites/%d/protect/recovery/confirm', Jetpack::get_option( 'id' ) );
- $response = Jetpack_Client::wpcom_json_api_request_as_blog(
+ $response = Client::wpcom_json_api_request_as_blog(
$path,
'1.1',
array(
@@ -243,7 +244,7 @@ class Jetpack_Protect_Blocked_Login_Page {
$path = sprintf( '/sites/%d/protect/recovery/request', Jetpack::get_option( 'id' ) );
- $response = Jetpack_Client::wpcom_json_api_request_as_blog(
+ $response = Client::wpcom_json_api_request_as_blog(
$path,
'1.1',
array(
diff --git a/plugins/jetpack/modules/protect/shared-functions.php b/plugins/jetpack/modules/protect/shared-functions.php
index 322901d8..9091c0be 100644
--- a/plugins/jetpack/modules/protect/shared-functions.php
+++ b/plugins/jetpack/modules/protect/shared-functions.php
@@ -201,7 +201,7 @@ function jetpack_protect_get_ip() {
*/
function jetpack_clean_ip( $ip ) {
- // Some misconfigured servers give back extra info, which comes after "unless"
+ // Some misconfigured servers give back extra info, which comes after "unless".
$ips = explode( ' unless ', $ip );
$ip = $ips[0];
@@ -211,8 +211,8 @@ function jetpack_clean_ip( $ip ) {
$ip = $matches[1];
}
- if ( function_exists( 'parse_url' ) ) {
- $parsed_url = parse_url( $ip );
+ if ( function_exists( 'wp_parse_url' ) ) {
+ $parsed_url = wp_parse_url( $ip );
if ( isset( $parsed_url['host'] ) ) {
$ip = $parsed_url['host'];
diff --git a/plugins/jetpack/modules/publicize/publicize-jetpack.php b/plugins/jetpack/modules/publicize/publicize-jetpack.php
index b2ec20e8..30403a38 100644
--- a/plugins/jetpack/modules/publicize/publicize-jetpack.php
+++ b/plugins/jetpack/modules/publicize/publicize-jetpack.php
@@ -250,7 +250,6 @@ class Publicize extends Publicize_Base {
}
function globalize_connection( $connection_id ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client();
$xml->query( 'jetpack.globalizePublicizeConnection', $connection_id, 'globalize' );
@@ -261,7 +260,6 @@ class Publicize extends Publicize_Base {
}
function unglobalize_connection( $connection_id ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client();
$xml->query( 'jetpack.globalizePublicizeConnection', $connection_id, 'unglobalize' );
@@ -349,7 +347,6 @@ class Publicize extends Publicize_Base {
$id = $this->get_connection_id( $connection );
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client();
$xml->query( 'jetpack.testPublicizeConnection', $id );
@@ -642,7 +639,7 @@ class Publicize extends Publicize_Base {
}
function get_basehostname( $url ) {
- return parse_url( $url, PHP_URL_HOST );
+ return wp_parse_url( $url, PHP_URL_HOST );
}
function options_save_tumblr() {
@@ -655,7 +652,6 @@ class Publicize extends Publicize_Base {
}
function set_remote_publicize_options( $id, $options ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client();
$xml->query( 'jetpack.setPublicizeOptions', $id, $options );
diff --git a/plugins/jetpack/modules/publicize/publicize.php b/plugins/jetpack/modules/publicize/publicize.php
index c3972cf6..1926fd4f 100644
--- a/plugins/jetpack/modules/publicize/publicize.php
+++ b/plugins/jetpack/modules/publicize/publicize.php
@@ -320,7 +320,7 @@ abstract class Publicize_Base {
$cmeta = $this->get_connection_meta( $connection );
if ( isset( $cmeta['connection_data']['meta']['link'] ) ) {
- if ( 'facebook' == $service_name && 0 === strpos( parse_url( $cmeta['connection_data']['meta']['link'], PHP_URL_PATH ), '/app_scoped_user_id/' ) ) {
+ if ( 'facebook' == $service_name && 0 === strpos( wp_parse_url( $cmeta['connection_data']['meta']['link'], PHP_URL_PATH ), '/app_scoped_user_id/' ) ) {
// App-scoped Facebook user IDs are not usable profile links
return false;
}
@@ -329,7 +329,7 @@ abstract class Publicize_Base {
} elseif ( 'facebook' == $service_name && isset( $cmeta['connection_data']['meta']['facebook_page'] ) ) {
return 'https://facebook.com/' . $cmeta['connection_data']['meta']['facebook_page'];
} elseif ( 'tumblr' == $service_name && isset( $cmeta['connection_data']['meta']['tumblr_base_hostname'] ) ) {
- return 'http://' . $cmeta['connection_data']['meta']['tumblr_base_hostname'];
+ return 'https://' . $cmeta['connection_data']['meta']['tumblr_base_hostname'];
} elseif ( 'twitter' == $service_name ) {
return 'https://twitter.com/' . substr( $cmeta['external_display'], 1 ); // Has a leading '@'
} else if ( 'linkedin' == $service_name ) {
@@ -337,7 +337,7 @@ abstract class Publicize_Base {
return false;
}
- $profile_url_query = parse_url( $cmeta['connection_data']['meta']['profile_url'], PHP_URL_QUERY );
+ $profile_url_query = wp_parse_url( $cmeta['connection_data']['meta']['profile_url'], PHP_URL_QUERY );
wp_parse_str( $profile_url_query, $profile_url_query_args );
if ( isset( $profile_url_query_args['key'] ) ) {
$id = $profile_url_query_args['key'];
@@ -347,7 +347,7 @@ abstract class Publicize_Base {
return false;
}
- return esc_url_raw( add_query_arg( 'id', urlencode( $id ), 'http://www.linkedin.com/profile/view' ) );
+ return esc_url_raw( add_query_arg( 'id', urlencode( $id ), 'https://www.linkedin.com/profile/view' ) );
} else {
return false; // no fallback. we just won't link it
}
diff --git a/plugins/jetpack/modules/pwa.php b/plugins/jetpack/modules/pwa.php
index b5e5e6a2..f372fac5 100644
--- a/plugins/jetpack/modules/pwa.php
+++ b/plugins/jetpack/modules/pwa.php
@@ -1,42 +1,4 @@
<?php
/**
- * Module Name: Progressive Web Apps
- * Module Description: Speed up and improve the reliability of your site using the latest in web technology.
- * Sort Order: 38
- * Recommendation Order: 18
- * First Introduced: 5.6.0
- * Requires Connection: Yes
- * Auto Activate: No
- * Module Tags: Developers
- * Feature: Traffic
- * Additional Search Queries: manifest, pwa, progressive
+ * Deprecated. No longer needed.
*/
-
-require_once ( JETPACK__PLUGIN_DIR . 'modules/pwa/class.jetpack-pwa-helpers.php' );
-require_once ( JETPACK__PLUGIN_DIR . 'modules/pwa/class.jetpack-pwa-manifest.php' );
-
-class Jetpack_PWA {
- /**
- * @var Jetpack_PWA
- */
- private static $__instance = null;
-
- /**
- * Singleton implementation
- *
- * @return Jetpack_PWA
- */
- public static function instance() {
- if ( is_null( self::$__instance ) ) {
- self::$__instance = new Jetpack_PWA;
- }
-
- return self::$__instance;
- }
-
- private function __construct() {
- Jetpack_PWA_Manifest::instance();
- }
-}
-
-Jetpack_PWA::instance();
diff --git a/plugins/jetpack/modules/pwa/class.jetpack-pwa-helpers.php b/plugins/jetpack/modules/pwa/class.jetpack-pwa-helpers.php
index 4ac7602d..f372fac5 100644
--- a/plugins/jetpack/modules/pwa/class.jetpack-pwa-helpers.php
+++ b/plugins/jetpack/modules/pwa/class.jetpack-pwa-helpers.php
@@ -1,62 +1,4 @@
<?php
-class Jetpack_PWA_Helpers {
- public static function get_default_manifest_icon_sizes() {
- // These icon sizes based on conversation here:
- // https://github.com/GoogleChrome/lighthouse/issues/291
- return array(
- 192,
- 512,
- );
- }
-
- public static function site_icon_url( $size = 512 ) {
- $url = get_site_icon_url( $size );
-
- // Fall back to built-in WordPress icon
- if ( ! $url && in_array( $size, self::get_default_manifest_icon_sizes() ) ) {
- $url = esc_url_raw(
- plugins_url( "modules/pwa/images/wp-$size.png", JETPACK__PLUGIN_FILE )
- );
- }
-
- return $url;
- }
-
- public static function get_theme_color() {
- $theme_color = false;
-
- // if we have AMP enabled, use those colors?
- if ( class_exists( 'AMP_Customizer_Settings' ) ) {
- /* This filter is documented in wp-content/plugins/amp/includes/class-amp-post-template.php */
- $amp_settings = apply_filters(
- 'amp_post_template_customizer_settings',
- AMP_Customizer_Settings::get_settings(),
- null
- );
-
- if ( isset( $amp_settings['header_background_color'] ) ) {
- $theme_color = $amp_settings['header_background_color'];
- }
- }
-
- if ( ! $theme_color && current_theme_supports( 'custom-background' ) ) {
- $background_color = get_background_color(); // Returns hex key without hash or empty string
- if ( $background_color ) {
- $theme_color = "#$background_color";
- }
- }
-
- if ( ! $theme_color ) {
- $theme_color = '#fff';
- }
-
- /**
- * Allows overriding the PWA theme color which is used when loading the app.
- *
- * @since 5.6.0
- *
- * @param string $theme_color
- */
- return apply_filters( 'jetpack_pwa_background_color', $theme_color );
- }
-}
+/**
+ * Deprecated. No longer needed.
+ */
diff --git a/plugins/jetpack/modules/pwa/class.jetpack-pwa-manifest.php b/plugins/jetpack/modules/pwa/class.jetpack-pwa-manifest.php
index c294c2d0..f372fac5 100644
--- a/plugins/jetpack/modules/pwa/class.jetpack-pwa-manifest.php
+++ b/plugins/jetpack/modules/pwa/class.jetpack-pwa-manifest.php
@@ -1,95 +1,4 @@
<?php
-
-class Jetpack_PWA_Manifest {
- /**
- * @var Jetpack_PWA_Manifest
- */
- private static $__instance = null;
-
- /**
- * When this query var is present, display the PWA manifest.
- *
- * @var string
- */
- const PWA_MANIFEST_QUERY_VAR = 'jetpack_app_manifest';
-
- /**
- * Singleton implementation
- *
- * @return Jetpack_PWA_Manifest
- */
- public static function instance() {
- if ( is_null( self::$__instance ) ) {
- self::$__instance = new Jetpack_PWA_Manifest;
- }
-
- return self::$__instance;
- }
-
- /**
- * Registers actions the first time that instance() is called.
- */
- private function __construct() {
- add_action( 'wp_head', array( $this, 'render_manifest_link' ) );
- add_action( 'amp_post_template_head', array( $this, 'render_manifest_link' ) );
- add_action( 'template_redirect', array( $this, 'render_manifest_json' ), 2 );
- }
-
- function render_manifest_link() {
- ?>
- <link rel="manifest" href="<?php echo esc_url_raw( $this->get_manifest_url() ); ?>">
- <meta name="theme-color" content="<?php echo esc_attr( Jetpack_PWA_Helpers::get_theme_color() ); ?>">
- <?php
- }
-
- public function get_manifest_url() {
- return add_query_arg(
- self::PWA_MANIFEST_QUERY_VAR, '1', home_url()
- );
- }
-
- function render_manifest_json() {
- // Do not load manifest in multiple locations
- if ( is_front_page() && isset( $_GET[ self::PWA_MANIFEST_QUERY_VAR ] ) && $_GET[ self::PWA_MANIFEST_QUERY_VAR ] ) {
- @ini_set( 'display_errors', false ); // Display errors can cause the XML to be not well formed.
-
- $theme_color = Jetpack_PWA_Helpers::get_theme_color();
-
- $manifest = array(
- 'name' => get_bloginfo( 'name' ),
- 'start_url' => get_home_url(),
- 'short_name' => substr( get_bloginfo( 'name' ), 0, 12 ),
- 'display' => 'standalone',
- 'background_color' => $theme_color,
- 'theme_color' => $theme_color,
- );
-
- if ( $description = get_bloginfo( 'description' ) ) {
- $manifest['description'] = $description;
- }
-
- $manifest['icons'] = array_map(
- array( $this, 'build_icon_object' ),
- Jetpack_PWA_Helpers::get_default_manifest_icon_sizes()
- );
-
- /**
- * Allow overriding the manifest.
- *
- * @since 5.6.0
- *
- * @param array $manifest
- */
- $manifest = apply_filters( 'jetpack_pwa_manifest', $manifest );
-
- wp_send_json( $manifest );
- }
- }
-
- function build_icon_object( $size ) {
- return array(
- 'src' => Jetpack_PWA_Helpers::site_icon_url( $size ),
- 'sizes' => sprintf( '%1$dx%1$d', $size ),
- );
- }
-}
+/**
+ * Deprecated. No longer needed.
+ */
diff --git a/plugins/jetpack/modules/random-redirect.php b/plugins/jetpack/modules/random-redirect.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/random-redirect.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/related-posts/class.related-posts-customize.php b/plugins/jetpack/modules/related-posts/class.related-posts-customize.php
index 8f15ca69..c6dd4788 100644
--- a/plugins/jetpack/modules/related-posts/class.related-posts-customize.php
+++ b/plugins/jetpack/modules/related-posts/class.related-posts-customize.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
// Exit if file is accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -268,7 +270,7 @@ class Jetpack_Related_Posts_Customize {
function customize_controls_enqueue_scripts() {
wp_enqueue_script(
'jetpack_related-posts-customizer',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/related-posts/related-posts-customizer.min.js',
'modules/related-posts/related-posts-customizer.js'
),
@@ -297,4 +299,4 @@ class Jetpack_Message_Control extends WP_Customize_Control {
} // class end
// Initialize controls
-new Jetpack_Related_Posts_Customize;
+new Jetpack_Related_Posts_Customize();
diff --git a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
index d1d4855f..aa9adefb 100644
--- a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
+++ b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
@@ -1,6 +1,10 @@
<?php
+
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Sync\Settings;
+
class Jetpack_RelatedPosts {
- const VERSION = '20190204';
+ const VERSION = '20191011';
const SHORTCODE = 'jetpack-related-posts';
private static $instance = null;
@@ -51,6 +55,7 @@ class Jetpack_RelatedPosts {
* Constructor for Jetpack_RelatedPosts.
*
* @uses get_option, add_action, apply_filters
+ *
* @return null
*/
public function __construct() {
@@ -115,7 +120,7 @@ class Jetpack_RelatedPosts {
*/
public function action_frontend_init() {
// Add a shortcode handler that outputs nothing, this gets overridden later if we can display related content
- add_shortcode( self::SHORTCODE, array( $this, 'get_target_html_unsupported' ) );
+ add_shortcode( self::SHORTCODE, array( $this, 'get_client_rendered_html_unsupported' ) );
if ( ! $this->_enabled_for_request() )
return;
@@ -158,25 +163,53 @@ class Jetpack_RelatedPosts {
/**
* Adds a target to the post content to load related posts into if a shortcode for it did not already exist.
- * Will skip adding the target if the post content contains a Related Posts block.
+ * Will skip adding the target if the post content contains a Related Posts block or if the 'get_the_excerpt'
+ * hook is in the current filter list.
*
* @filter the_content
- * @param string $content
+ *
+ * @param string $content Post content.
+ *
* @returns string
*/
public function filter_add_target_to_dom( $content ) {
- if ( has_block( 'jetpack/related-posts', $content ) ) {
+ if ( has_block( 'jetpack/related-posts' ) ) {
return $content;
}
- if ( ! $this->_found_shortcode ) {
- $content .= "\n" . $this->get_target_html();
+ if ( ! $this->_found_shortcode && ! doing_filter( 'get_the_excerpt' ) ) {
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ $content .= "\n" . $this->get_server_rendered_html();
+ } else {
+ $content .= "\n" . $this->get_client_rendered_html();
+ }
}
return $content;
}
/**
+ * Render static markup based on the Gutenberg block code
+ *
+ * @return string Rendered related posts HTML.
+ */
+ public function get_server_rendered_html() {
+ $rp_settings = Jetpack_Options::get_option( 'relatedposts', array() );
+ $block_rp_settings = array(
+ 'displayThumbnails' => $rp_settings['show_thumbnails'],
+ 'showHeadline' => $rp_settings['show_headline'],
+ 'displayDate' => isset( $rp_settings['show_date'] ) ? (bool) $rp_settings['show_date'] : true,
+ 'displayContext' => isset( $rp_settings['show_context'] ) && $rp_settings['show_context'],
+ 'postLayout' => isset( $rp_settings['layout'] ) ? $rp_settings['layout'] : 'grid',
+ 'postsToShow' => isset( $rp_settings['size'] ) ? $rp_settings['size'] : 3,
+ /** This filter is already documented in modules/related-posts/jetpack-related-posts.php */
+ 'headline' => apply_filters( 'jetpack_relatedposts_filter_headline', $this->get_headline() ),
+ );
+
+ return $this->render_block( $block_rp_settings );
+ }
+
+ /**
* Looks for our shortcode on the unfiltered content, this has to execute early.
*
* @filter the_content
@@ -196,9 +229,8 @@ class Jetpack_RelatedPosts {
* @uses esc_html__, apply_filters
* @returns string
*/
- public function get_target_html() {
- require_once JETPACK__PLUGIN_DIR . '/sync/class.jetpack-sync-settings.php';
- if ( Jetpack_Sync_Settings::is_syncing() ) {
+ public function get_client_rendered_html() {
+ if ( Settings::is_syncing() ) {
return '';
}
@@ -231,9 +263,8 @@ EOT;
*
* @returns string
*/
- public function get_target_html_unsupported() {
- require_once JETPACK__PLUGIN_DIR . '/sync/class.jetpack-sync-settings.php';
- if ( Jetpack_Sync_Settings::is_syncing() ) {
+ public function get_client_rendered_html_unsupported() {
+ if ( Settings::is_syncing() ) {
return '';
}
return "\n\n<!-- Jetpack Related Posts is not supported in this context. -->\n\n";
@@ -262,18 +293,18 @@ EOT;
);
$item_markup .= sprintf(
- '<li class="jp-related-posts-i2__post-link"><a id="%1$s" href="%2$s" rel="%4$s">%3$s</a></li>',
+ '<li class="jp-related-posts-i2__post-link"><a id="%1$s" href="%2$s" %4$s>%3$s</a></li>',
esc_attr( $label_id ),
esc_url( $related_post['url'] ),
esc_attr( $related_post['title'] ),
- esc_attr( $related_post['rel'] )
+ ( ! empty( $related_post['rel'] ) ? 'rel="' . esc_attr( $related_post['rel'] ) . '"' : '' )
);
if ( ! empty( $block_attributes['show_thumbnails'] ) && ! empty( $related_post['img']['src'] ) ) {
$img_link = sprintf(
- '<li class="jp-related-posts-i2__post-img-link"><a href="%1$s" rel="%2$s"><img src="%3$s" width="%4$s" alt="%5$s" /></a></li>',
+ '<li class="jp-related-posts-i2__post-img-link"><a href="%1$s" %2$s><img src="%3$s" width="%4$s" alt="%5$s" /></a></li>',
esc_url( $related_post['url'] ),
- esc_attr( $related_post['rel'] ),
+ ( ! empty( $related_post['rel'] ) ? 'rel="' . esc_attr( $related_post['rel'] ) . '"' : '' ),
esc_url( $related_post['img']['src'] ),
esc_attr( $related_post['img']['width'] ),
esc_attr( $related_post['img']['alt_text'] )
@@ -331,6 +362,7 @@ EOT;
*/
public function render_block( $attributes ) {
$block_attributes = array(
+ 'headline' => isset( $attributes['headline'] ) ? $attributes['headline'] : null,
'show_thumbnails' => isset( $attributes['displayThumbnails'] ) && $attributes['displayThumbnails'],
'show_date' => isset( $attributes['displayDate'] ) ? (bool) $attributes['displayDate'] : true,
'show_context' => isset( $attributes['displayContext'] ) && $attributes['displayContext'],
@@ -338,7 +370,8 @@ EOT;
'size' => ! empty( $attributes['postsToShow'] ) ? absint( $attributes['postsToShow'] ) : 3,
);
- $excludes = $this->parse_numeric_get_arg( 'relatedposts_origin' );
+ $excludes = $this->parse_numeric_get_arg( 'relatedposts_origin' );
+
$related_posts = $this->get_for_post_id(
get_the_ID(),
array(
@@ -373,33 +406,26 @@ EOT;
$rows_markup .= $this->render_block_row( $lower_row_posts, $block_attributes );
}
- $target_to_dom_priority = has_filter(
- 'the_content',
- array( $this, 'filter_add_target_to_dom' )
- );
- remove_filter(
- 'the_content',
- array( $this, 'filter_add_target_to_dom' ),
- $target_to_dom_priority
- );
-
/*
- Below is a hack to get the block content to render correctly.
-
- This functionality should be covered in /inc/blocks.php but due to an error,
- this has not been fixed as of this writing.
-
- Alda has submitted a patch to Core in order to have this issue fixed at
- https://core.trac.wordpress.org/attachment/ticket/45495/do_blocks.diff and
- hopefully it makes to to the final RC of WP 5.1.
- */
+ * Below is a hack to get the block content to render correctly.
+ *
+ * This functionality should be covered in /inc/blocks.php but due to an error,
+ * this has not been fixed as of this writing.
+ *
+ * Alda has submitted a patch to Core in order to have this issue fixed at
+ * https://core.trac.wordpress.org/ticket/45495 and
+ * made it into WordPress 5.2.
+ *
+ * @todo update when WP 5.2 is the minimum support version.
+ */
$priority = has_filter( 'the_content', 'wpautop' );
remove_filter( 'the_content', 'wpautop', $priority );
add_filter( 'the_content', '_restore_wpautop_hook', $priority + 1 );
return sprintf(
- '<nav class="jp-relatedposts-i2" data-layout="%1$s">%2$s</nav>',
+ '<nav class="jp-relatedposts-i2" data-layout="%1$s">%2$s%3$s</nav>',
esc_attr( $block_attributes['layout'] ),
+ $block_attributes['headline'],
$rows_markup
);
}
@@ -417,7 +443,7 @@ EOT;
*
* @uses absint
*
- * @param string $arg Name of the GET variable
+ * @param string $arg Name of the GET variable.
* @return array $result Parsed value(s)
*/
public function parse_numeric_get_arg( $arg ) {
@@ -1187,11 +1213,12 @@ EOT;
* @module related-posts
*
* @since 3.7.0
+ * @since 7.9.0 - Change Default value to empty.
*
- * @param string nofollow Link rel attribute for Related Posts' link. Default is nofollow.
- * @param int $post->ID Post ID.
+ * @param string $link_rel Link rel attribute for Related Posts' link. Default is empty.
+ * @param int $post->ID Post ID.
*/
- 'rel' => apply_filters( 'jetpack_relatedposts_filter_post_link_rel', 'nofollow', $post->ID ),
+ 'rel' => apply_filters( 'jetpack_relatedposts_filter_post_link_rel', '', $post->ID ),
/**
* Filter the context displayed below each Related Post.
*
@@ -1604,16 +1631,10 @@ EOT;
*/
protected function _enabled_for_request() {
$enabled = is_single()
+ && ! is_attachment()
&& ! is_admin()
&& ( ! $this->_allow_feature_toggle() || $this->get_option( 'enabled' ) );
- if (
- class_exists( 'Jetpack_AMP_Support' )
- && Jetpack_AMP_Support::is_amp_request()
- ) {
- $enabled = false;
- }
-
/**
* Filter the Enabled value to allow related posts to be shown on pages as well.
*
@@ -1633,7 +1654,9 @@ EOT;
* @return null
*/
protected function _action_frontend_init_page() {
- $this->_enqueue_assets( true, true );
+
+ $enqueue_script = ! ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() );
+ $this->_enqueue_assets( $enqueue_script, true );
$this->_setup_shortcode();
add_filter( 'the_content', array( $this, 'filter_add_target_to_dom' ), 40 );
@@ -1650,7 +1673,7 @@ EOT;
if ( $script ) {
wp_enqueue_script(
'jetpack_related-posts',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/related-posts/related-posts.min.js',
'modules/related-posts/related-posts.js'
),
@@ -1672,9 +1695,14 @@ EOT;
if ( $style ){
wp_enqueue_style( 'jetpack_related-posts', plugins_url( 'related-posts.css', __FILE__ ), array(), self::VERSION );
wp_style_add_data( 'jetpack_related-posts', 'rtl', 'replace' );
+ add_action( 'amp_post_template_css', array( $this, 'render_amp_reader_mode_css' ) );
}
}
+ public function render_amp_reader_mode_css() {
+ echo file_get_contents( plugin_dir_path( __FILE__ ) . 'related-posts.css' );
+ }
+
/**
* Sets up the shortcode processing.
*
@@ -1684,7 +1712,7 @@ EOT;
protected function _setup_shortcode() {
add_filter( 'the_content', array( $this, 'test_for_shortcode' ), 0 );
- add_shortcode( self::SHORTCODE, array( $this, 'get_target_html' ) );
+ add_shortcode( self::SHORTCODE, array( $this, 'get_client_rendered_html' ) );
}
protected function _allow_feature_toggle() {
@@ -1719,14 +1747,19 @@ EOT;
* @return null
*/
public function rest_register_related_posts() {
- register_rest_field( 'post',
- 'jetpack-related-posts',
- array(
- 'get_callback' => array( $this, 'rest_get_related_posts' ),
- 'update_callback' => null,
- 'schema' => null,
- )
- );
+ /** This filter is already documented in class.json-api-endpoints.php */
+ $post_types = apply_filters( 'rest_api_allowed_post_types', array( 'post', 'page', 'revision' ) );
+ foreach ( $post_types as $post_type ) {
+ register_rest_field(
+ $post_type,
+ 'jetpack-related-posts',
+ array(
+ 'get_callback' => array( $this, 'rest_get_related_posts' ),
+ 'update_callback' => null,
+ 'schema' => null,
+ )
+ );
+ }
}
/**
diff --git a/plugins/jetpack/modules/related-posts/related-posts-rtl.css b/plugins/jetpack/modules/related-posts/related-posts-rtl.css
index 21f37004..69ce02fb 100644
--- a/plugins/jetpack/modules/related-posts/related-posts-rtl.css
+++ b/plugins/jetpack/modules/related-posts/related-posts-rtl.css
@@ -1 +1 @@
-.jp-related-posts-i2__row{display:flex;margin-top:1.5rem}.jp-related-posts-i2__row:first-child{margin-top:0}.jp-related-posts-i2__post{flex-grow:1;flex-basis:0;margin:0 10px;display:flex;flex-direction:column;padding-right:0}.jp-related-posts-i2__row[data-post-count="3"] .jp-related-posts-i2__post{max-width:calc(33% - 20px)}.jp-related-posts-i2__row[data-post-count="1"] .jp-related-posts-i2__post,.jp-related-posts-i2__row[data-post-count="2"] .jp-related-posts-i2__post{max-width:calc(50% - 20px)}.jp-related-posts-i2__post-context,.jp-related-posts-i2__post-date,.jp-related-posts-i2__post-heading,.jp-related-posts-i2__post-img-link{flex-direction:row;display:block}.jp-related-posts-i2__post-heading{margin:.5rem 0;font-size:1rem;line-height:1.2em}.jp-related-posts-i2__post-link{display:block;width:100%;line-height:1.2em}.jp-related-posts-i2__post-img-link{order:-1;line-height:1em}.jp-related-posts-i2__post-img-link img{width:100%}.jp-relatedposts-i2[data-layout=list] .jp-related-posts-i2__row{margin-top:0;display:block}.jp-relatedposts-i2[data-layout=list] .jp-related-posts-i2__post{max-width:none;margin:0}.jp-relatedposts-i2[data-layout=list].jp-related-posts-i2__post-img-link{margin-top:1rem}@media only screen and (max-width:640px){.jp-related-posts-i2__row{margin-top:0;display:block}.jp-related-posts-i2__row[data-post-count] .jp-related-posts-i2__post{max-width:none;margin:0;margin-top:1rem}.jp-related-posts-i2__post-img-link{margin-top:1rem}.jp-related-posts-i2__post-img-link img{width:350px}}#jp-relatedposts{display:none;padding-top:1em;margin:1em 0;position:relative;clear:both}.jp-relatedposts:after{content:'';display:block;clear:both}#jp-relatedposts h3.jp-relatedposts-headline{margin:0 0 1em 0;display:inline-block;float:right;font-size:9pt;font-weight:700;font-family:inherit}#jp-relatedposts h3.jp-relatedposts-headline em:before{content:"";display:block;width:100%;min-width:30px;border-top:1px solid #ddd;border-top:1px solid rgba(0,0,0,.2);margin-bottom:1em}#jp-relatedposts h3.jp-relatedposts-headline em{font-style:normal;font-weight:700}#jp-relatedposts .jp-relatedposts-items{clear:right}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:-20px}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{float:right;width:33%;margin:0 0 1em;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post{padding-left:20px;-moz-opacity:.8;opacity:.8}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:nth-child(3n+4),#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post:nth-child(3n+4){clear:both}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:hover .jp-relatedposts-post-title a{text-decoration:underline}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:hover{-moz-opacity:1;opacity:1}#jp-relatedposts .jp-relatedposts-items p,#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{font-size:14px;line-height:20px;margin:0}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs{position:relative}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs a.jp-relatedposts-post-aoverlay{position:absolute;top:0;bottom:0;right:0;left:0;display:block;border-bottom:0}#jp-relatedposts .jp-relatedposts-items p{margin-bottom:0}#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{text-transform:none;margin:0;font-family:inherit;display:block;max-width:100%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-title a{font-size:inherit;font-weight:400;text-decoration:none;-moz-opacity:1;opacity:1}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-title a:hover{text-decoration:underline}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post span{display:block;max-width:90%;overflow:hidden;text-overflow:ellipsis}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post span{max-width:100%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-context,#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-date{opacity:.6}.jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-date{display:none}#jp-relatedposts .jp-relatedposts-items-visual div.jp-relatedposts-post-thumbs p.jp-relatedposts-post-excerpt{display:none}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs p.jp-relatedposts-post-excerpt{overflow:hidden}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs span{margin-bottom:1em}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post{clear:both;width:100%}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post img.jp-relatedposts-post-img{float:right;overflow:hidden;max-width:33%;margin-left:3%}#jp-relatedposts .jp-relatedposts-list h4.jp-relatedposts-post-title{display:inline-block;max-width:63%}@media only screen and (max-width:640px){#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{width:50%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:nth-child(3n){clear:right}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:20px}}@media only screen and (max-width:320px){#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{width:100%;clear:both;margin:0 0 1em}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-list h4.jp-relatedposts-post-title{float:none;max-width:100%;margin-left:0}} \ No newline at end of file
+.jp-related-posts-i2__row{display:flex;margin-top:1.5rem}.jp-related-posts-i2__row:first-child{margin-top:0}.jp-related-posts-i2__post{flex-grow:1;flex-basis:0;margin:0 10px;display:flex;flex-direction:column;padding-right:0}.jp-related-posts-i2__row[data-post-count="3"] .jp-related-posts-i2__post{max-width:calc(33% - 20px)}.jp-related-posts-i2__row[data-post-count="1"] .jp-related-posts-i2__post,.jp-related-posts-i2__row[data-post-count="2"] .jp-related-posts-i2__post{max-width:calc(50% - 20px)}.jp-related-posts-i2__post-context,.jp-related-posts-i2__post-date,.jp-related-posts-i2__post-heading,.jp-related-posts-i2__post-img-link{flex-direction:row;display:block}.jp-related-posts-i2__post-heading{margin:.5rem 0;font-size:1rem;line-height:1.2em}.jp-related-posts-i2__post-link{display:block;width:100%;line-height:1.2em}.jp-related-posts-i2__post-img-link{order:-1}.jp-related-posts-i2__post-img-link img{width:100%}.jp-relatedposts-i2[data-layout=list] .jp-related-posts-i2__row{margin-top:0;display:block}.jp-relatedposts-i2[data-layout=list] .jp-related-posts-i2__post{max-width:none;margin:0}.jp-relatedposts-i2[data-layout=list].jp-related-posts-i2__post-img-link{margin-top:1rem}@media only screen and (max-width:640px){.jp-related-posts-i2__row{margin-top:0;display:block}.jp-related-posts-i2__row[data-post-count] .jp-related-posts-i2__post{max-width:none;margin:0;margin-top:1rem}.jp-related-posts-i2__post-img-link{margin-top:1rem}.jp-related-posts-i2__post-img-link img{width:350px}}#jp-relatedposts{display:none;padding-top:1em;margin:1em 0;position:relative;clear:both}.jp-relatedposts:after{content:'';display:block;clear:both}#jp-relatedposts h3.jp-relatedposts-headline{margin:0 0 1em 0;display:inline-block;float:right;font-size:9pt;font-weight:700;font-family:inherit}#jp-relatedposts h3.jp-relatedposts-headline em:before{content:"";display:block;width:100%;min-width:30px;border-top:1px solid #ddd;border-top:1px solid rgba(0,0,0,.2);margin-bottom:1em}#jp-relatedposts h3.jp-relatedposts-headline em{font-style:normal;font-weight:700}#jp-relatedposts .jp-relatedposts-items{clear:right}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:-20px}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{float:right;width:33%;margin:0 0 1em;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post{padding-left:20px;-moz-opacity:.8;opacity:.8}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:nth-child(3n+4),#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post:nth-child(3n+4){clear:both}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:hover .jp-relatedposts-post-title a{text-decoration:underline}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:hover{-moz-opacity:1;opacity:1}#jp-relatedposts .jp-relatedposts-items p,#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{font-size:14px;line-height:20px;margin:0}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs{position:relative}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs a.jp-relatedposts-post-aoverlay{position:absolute;top:0;bottom:0;right:0;left:0;display:block;border-bottom:0}#jp-relatedposts .jp-relatedposts-items p{margin-bottom:0}#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{text-transform:none;margin:0;font-family:inherit;display:block;max-width:100%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-title a{font-size:inherit;font-weight:400;text-decoration:none;-moz-opacity:1;opacity:1}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-title a:hover{text-decoration:underline}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post span{display:block;max-width:90%;overflow:hidden;text-overflow:ellipsis}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post span{max-width:100%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-context,#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-date{opacity:.6}.jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-date{display:none}#jp-relatedposts .jp-relatedposts-items-visual div.jp-relatedposts-post-thumbs p.jp-relatedposts-post-excerpt{display:none}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs p.jp-relatedposts-post-excerpt{overflow:hidden}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs span{margin-bottom:1em}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post{clear:both;width:100%}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post img.jp-relatedposts-post-img{float:right;overflow:hidden;max-width:33%;margin-left:3%}#jp-relatedposts .jp-relatedposts-list h4.jp-relatedposts-post-title{display:inline-block;max-width:63%}@media only screen and (max-width:640px){#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{width:50%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:nth-child(3n){clear:right}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:20px}}@media only screen and (max-width:320px){#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{width:100%;clear:both;margin:0 0 1em}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-list h4.jp-relatedposts-post-title{float:none;max-width:100%;margin-left:0}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/related-posts/related-posts.css b/plugins/jetpack/modules/related-posts/related-posts.css
index 763dfcdb..fa9e84e6 100644
--- a/plugins/jetpack/modules/related-posts/related-posts.css
+++ b/plugins/jetpack/modules/related-posts/related-posts.css
@@ -53,7 +53,6 @@
.jp-related-posts-i2__post-img-link {
order: -1;
- line-height: 1em;
}
.jp-related-posts-i2__post-img-link img {
width: 100%;
diff --git a/plugins/jetpack/modules/related-posts/related-posts.js b/plugins/jetpack/modules/related-posts/related-posts.js
index f8fa781b..76f7d33d 100644
--- a/plugins/jetpack/modules/related-posts/related-posts.js
+++ b/plugins/jetpack/modules/related-posts/related-posts.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false */
/* globals related_posts_js_options */
/**
@@ -69,11 +68,16 @@
class: classNames,
href: post.url,
title: anchor_title,
- rel: post.rel,
'data-origin': post.url_meta.origin,
'data-position': post.url_meta.position,
} );
+ if ( '' !== post.rel ) {
+ anchor.attr( {
+ rel: post.rel,
+ } );
+ }
+
var anchor_html = $( '<div>' )
.append( anchor )
.html();
diff --git a/plugins/jetpack/modules/search/class.jetpack-search-helpers.php b/plugins/jetpack/modules/search/class.jetpack-search-helpers.php
index 27526b4c..39a89c53 100644
--- a/plugins/jetpack/modules/search/class.jetpack-search-helpers.php
+++ b/plugins/jetpack/modules/search/class.jetpack-search-helpers.php
@@ -7,6 +7,8 @@
* @since 5.8.0
*/
+use Automattic\Jetpack\Constants;
+
/**
* Various helper functions for reuse throughout the Jetpack Search code.
*
@@ -659,8 +661,8 @@ class Jetpack_Search_Helpers {
*/
public static function site_has_vip_index() {
$has_vip_index = (
- Jetpack_Constants::is_defined( 'JETPACK_SEARCH_VIP_INDEX' ) &&
- Jetpack_Constants::get_constant( 'JETPACK_SEARCH_VIP_INDEX' )
+ Constants::is_defined( 'JETPACK_SEARCH_VIP_INDEX' ) &&
+ Constants::get_constant( 'JETPACK_SEARCH_VIP_INDEX' )
);
/**
diff --git a/plugins/jetpack/modules/search/class.jetpack-search.php b/plugins/jetpack/modules/search/class.jetpack-search.php
index 40867589..1271afc6 100644
--- a/plugins/jetpack/modules/search/class.jetpack-search.php
+++ b/plugins/jetpack/modules/search/class.jetpack-search.php
@@ -1,4 +1,4 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Jetpack Search: Main Jetpack_Search class
*
@@ -7,6 +7,9 @@
* @since 5.0.0
*/
+use Automattic\Jetpack\Connection\Client;
+use Automattic\Jetpack\Constants;
+
/**
* The main class for the Jetpack Search module.
*
@@ -151,12 +154,24 @@ class Jetpack_Search {
*/
public function setup() {
if ( ! Jetpack::is_active() || ! Jetpack_Plan::supports( 'search' ) ) {
+ /**
+ * Fires when the Jetpack Search fails and would fallback to MySQL.
+ *
+ * @module search
+ * @since 7.9.0
+ *
+ * @param string $reason Reason for Search fallback.
+ * @param mixed $data Data associated with the request, such as attempted search parameters.
+ */
+ do_action( 'jetpack_search_abort', 'inactive', null );
return;
}
$this->jetpack_blog_id = Jetpack::get_option( 'id' );
if ( ! $this->jetpack_blog_id ) {
+ /** This action is documented in modules/search/class.jetpack-search.php */
+ do_action( 'jetpack_search_abort', 'no_blog_id', null );
return;
}
@@ -184,6 +199,7 @@ class Jetpack_Search {
add_action( 'init', array( $this, 'set_filters_from_widgets' ) );
add_action( 'pre_get_posts', array( $this, 'maybe_add_post_type_as_var' ) );
+ add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ) );
} else {
add_action( 'update_option', array( $this, 'track_widget_updates' ), 10, 3 );
}
@@ -192,6 +208,100 @@ class Jetpack_Search {
}
/**
+ * Loads assets for Jetpack Instant Search Prototype featuring Search As You Type experience.
+ */
+ public function load_assets() {
+ if ( Constants::is_true( 'JETPACK_SEARCH_PROTOTYPE' ) ) {
+ $script_relative_path = '_inc/build/instant-search/jp-search.bundle.js';
+ if ( file_exists( JETPACK__PLUGIN_DIR . $script_relative_path ) ) {
+ $script_version = self::get_asset_version( $script_relative_path );
+ $script_path = plugins_url( $script_relative_path, JETPACK__PLUGIN_FILE );
+ wp_enqueue_script( 'jetpack-instant-search', $script_path, array(), $script_version, true );
+ $this->load_and_initialize_tracks();
+
+ $widget_options = Jetpack_Search_Helpers::get_widgets_from_option();
+ if ( is_array( $widget_options ) ) {
+ $widget_options = end( $widget_options );
+ }
+
+ $filters = Jetpack_Search_Helpers::get_filters_from_widgets();
+ $widgets = array();
+ foreach ( $filters as $key => $filter ) {
+ if ( ! isset( $widgets[ $filter['widget_id'] ] ) ) {
+ $widgets[ $filter['widget_id'] ]['filters'] = array();
+ $widgets[ $filter['widget_id'] ]['widget_id'] = $filter['widget_id'];
+ }
+ $new_filter = $filter;
+ $new_filter['filter_id'] = $key;
+ $widgets[ $filter['widget_id'] ]['filters'][] = $new_filter;
+ }
+
+ $post_type_objs = get_post_types( array(), 'objects' );
+ $post_type_labels = array();
+ foreach ( $post_type_objs as $key => $obj ) {
+ $post_type_labels[ $key ] = array(
+ 'singular_name' => $obj->labels->singular_name,
+ 'name' => $obj->labels->name,
+ );
+ }
+ // This is probably a temporary filter for testing the prototype.
+ $options = array(
+ 'enableLoadOnScroll' => false,
+ 'homeUrl' => home_url(),
+ 'locale' => str_replace( '_', '-', get_locale() ),
+ 'postTypeFilters' => $widget_options['post_types'],
+ 'postTypes' => $post_type_labels,
+ 'siteId' => Jetpack::get_option( 'id' ),
+ 'sort' => $widget_options['sort'],
+ 'widgets' => array_values( $widgets ),
+ );
+ /**
+ * Customize Instant Search Options.
+ *
+ * @module search
+ *
+ * @since 7.7.0
+ *
+ * @param array $options Array of parameters used in Instant Search queries.
+ */
+ $options = apply_filters( 'jetpack_instant_search_options', $options );
+
+ wp_localize_script(
+ 'jetpack-instant-search',
+ 'JetpackInstantSearchOptions',
+ $options
+ );
+ }
+
+ $style_relative_path = '_inc/build/instant-search/instant-search.min.css';
+ if ( file_exists( JETPACK__PLUGIN_DIR . $script_relative_path ) ) {
+ $style_version = self::get_asset_version( $style_relative_path );
+ $style_path = plugins_url( $style_relative_path, JETPACK__PLUGIN_FILE );
+ wp_enqueue_style( 'jetpack-instant-search', $style_path, array(), $style_version );
+ }
+ }
+ }
+
+ /**
+ * Loads scripts for Tracks analytics library
+ */
+ public function load_and_initialize_tracks() {
+ wp_enqueue_script( 'jp-tracks', '//stats.wp.com/w.js', array(), gmdate( 'YW' ), true );
+ }
+
+ /**
+ * Get the version number to use when loading the file. Allows us to bypass cache when developing.
+ *
+ * @param string $file Path of the file we are looking for.
+ * @return string $script_version Version number.
+ */
+ public static function get_asset_version( $file ) {
+ return Jetpack::is_development_version() && file_exists( JETPACK__PLUGIN_DIR . $file )
+ ? filemtime( JETPACK__PLUGIN_DIR . $file )
+ : JETPACK__VERSION;
+ }
+
+ /**
* When an Elasticsearch query fails, this stores it and enqueues some debug information in the footer.
*
* @since 5.6.0
@@ -244,10 +354,10 @@ class Jetpack_Search {
esc_html( $this->last_query_info['es_time'] )
);
- if ( isset( $_GET['searchdebug'] ) ) {
+ if ( isset( $_GET['searchdebug'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
printf(
'<!-- Query response data: %s -->',
- esc_html( print_r( $this->last_query_info, 1 ) )
+ esc_html( print_r( $this->last_query_info, 1 ) ) // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
);
}
}
@@ -315,16 +425,17 @@ class Jetpack_Search {
* @param WP_Query $query A WP_Query instance.
*/
public function maybe_add_post_type_as_var( WP_Query $query ) {
- if ( $this->should_handle_query( $query ) && ! empty( $_GET['post_type'] ) ) {
- $post_types = ( is_string( $_GET['post_type'] ) && false !== strpos( $_GET['post_type'], ',' ) )
- ? $post_type = explode( ',', $_GET['post_type'] )
- : (array) $_GET['post_type'];
+ $post_type = ( ! empty( $_GET['post_type'] ) ) ? $_GET['post_type'] : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ if ( $this->should_handle_query( $query ) && $post_type ) {
+ $post_types = ( is_string( $post_type ) && false !== strpos( $post_type, ',' ) )
+ ? explode( ',', $post_type )
+ : (array) $post_type;
$post_types = array_map( 'sanitize_key', $post_types );
$query->set( 'post_type', $post_types );
}
}
- /*
+ /**
* Run a search on the WordPress.com public API.
*
* @since 5.0.0
@@ -339,7 +450,7 @@ class Jetpack_Search {
$do_authenticated_request = false;
- if ( class_exists( 'Jetpack_Client' ) &&
+ if ( class_exists( 'Automattic\\Jetpack\\Connection\\Client' ) &&
isset( $es_args['authenticated_request'] ) &&
true === $es_args['authenticated_request'] ) {
$do_authenticated_request = true;
@@ -348,7 +459,7 @@ class Jetpack_Search {
unset( $es_args['authenticated_request'] );
$request_args = array(
- 'headers' => array(
+ 'headers' => array(
'Content-Type' => 'application/json',
),
'timeout' => 10,
@@ -362,11 +473,14 @@ class Jetpack_Search {
if ( $do_authenticated_request ) {
$request_args['method'] = 'POST';
- $request = Jetpack_Client::wpcom_json_api_request_as_blog( $endpoint, Jetpack_Client::WPCOM_JSON_API_VERSION, $request_args, $request_body );
+ $request = Client::wpcom_json_api_request_as_blog( $endpoint, Client::WPCOM_JSON_API_VERSION, $request_args, $request_body );
} else {
- $request_args = array_merge( $request_args, array(
- 'body' => $request_body,
- ) );
+ $request_args = array_merge(
+ $request_args,
+ array(
+ 'body' => $request_body,
+ )
+ );
$request = wp_remote_post( $service_url, $request_args );
}
@@ -425,10 +539,13 @@ class Jetpack_Search {
*
* @param array Array containing the response code and response from the failed search query
*/
- do_action( 'failed_jetpack_search_query', array(
- 'response_code' => $response_code,
- 'json' => $response,
- ) );
+ do_action(
+ 'failed_jetpack_search_query',
+ array(
+ 'response_code' => $response_code,
+ 'json' => $response,
+ )
+ );
return new WP_Error( 'invalid_search_api_response', 'Invalid response from API - ' . $response_code );
}
@@ -450,16 +567,19 @@ class Jetpack_Search {
*/
public function filter__posts_pre_query( $posts, $query ) {
if ( ! $this->should_handle_query( $query ) ) {
+ // Intentionally not adding the 'jetpack_search_abort' action since this should fire for every request except for search.
return $posts;
}
$this->do_search( $query );
if ( ! is_array( $this->search_result ) ) {
+ /** This action is documented in modules/search/class.jetpack-search.php */
+ do_action( 'jetpack_search_abort', 'no_search_results_array', $this->search_result );
return $posts;
}
- // If no results, nothing to do
+ // If no results, nothing to do.
if ( ! count( $this->search_result['results']['hits'] ) ) {
return array();
}
@@ -470,7 +590,7 @@ class Jetpack_Search {
$post_ids[] = (int) $result['fields']['post_id'];
}
- // Query all posts now
+ // Query all posts now.
$args = array(
'post__in' => $post_ids,
'orderby' => 'post__in',
@@ -498,6 +618,9 @@ class Jetpack_Search {
*/
public function do_search( WP_Query $query ) {
if ( ! $this->should_handle_query( $query ) ) {
+ // If we make it here, either 'filter__posts_pre_query' somehow allowed it or a different entry to do_search.
+ /** This action is documented in modules/search/class.jetpack-search.php */
+ do_action( 'jetpack_search_abort', 'search_attempted_non_search_query', $query );
return;
}
@@ -567,7 +690,7 @@ class Jetpack_Search {
// Convert the WP-style args into ES args.
$es_query_args = $this->convert_wp_es_to_es_args( $es_wp_query_args );
- //Only trust ES to give us IDs, not the content since it is a mirror
+ // Only trust ES to give us IDs, not the content since it is a mirror.
$es_query_args['fields'] = array(
'post_id',
);
@@ -647,7 +770,6 @@ class Jetpack_Search {
return $args;
}
-
if ( ! $the_tax_query instanceof WP_Tax_Query || empty( $the_tax_query->queried_terms ) || ! is_array( $the_tax_query->queried_terms ) ) {
return $args;
}
@@ -655,7 +777,7 @@ class Jetpack_Search {
$args = array();
foreach ( $the_tax_query->queries as $tax_query ) {
- // Right now we only support slugs...see note above
+ // Right now we only support slugs...see note above.
if ( ! is_array( $tax_query ) || 'slug' !== $tax_query['field'] ) {
continue;
}
@@ -688,9 +810,13 @@ class Jetpack_Search {
// If we're searching 'any', we want to only pass searchable post types to Elasticsearch.
if ( 'any' === $post_types ) {
- $post_types = array_values( get_post_types( array(
- 'exclude_from_search' => false,
- ) ) );
+ $post_types = array_values(
+ get_post_types(
+ array(
+ 'exclude_from_search' => false,
+ )
+ )
+ );
}
if ( ! is_array( $post_types ) ) {
@@ -748,11 +874,11 @@ class Jetpack_Search {
public function filter__add_date_filter_to_query( array $es_wp_query_args, WP_Query $query ) {
if ( $query->get( 'year' ) ) {
if ( $query->get( 'monthnum' ) ) {
- // Padding
+ // Padding.
$date_monthnum = sprintf( '%02d', $query->get( 'monthnum' ) );
if ( $query->get( 'day' ) ) {
- // Padding
+ // Padding.
$date_day = sprintf( '%02d', $query->get( 'day' ) );
$date_start = $query->get( 'year' ) . '-' . $date_monthnum . '-' . $date_day . ' 00:00:00';
@@ -792,14 +918,14 @@ class Jetpack_Search {
$defaults = array(
'blog_id' => get_current_blog_id(),
- 'query' => null, // Search phrase
- 'query_fields' => array(), // list of fields to search
- 'excess_boost' => array(), // map of field to excess boost values (multiply)
- 'post_type' => null, // string or an array
- 'terms' => array(), // ex: array( 'taxonomy-1' => array( 'slug' ), 'taxonomy-2' => array( 'slug-a', 'slug-b' ) )
- 'author' => null, // id or an array of ids
- 'author_name' => array(), // string or an array
- 'date_range' => null, // array( 'field' => 'date', 'gt' => 'YYYY-MM-dd', 'lte' => 'YYYY-MM-dd' ); date formats: 'YYYY-MM-dd' or 'YYYY-MM-dd HH:MM:SS'
+ 'query' => null, // Search phrase.
+ 'query_fields' => array(), // list of fields to search.
+ 'excess_boost' => array(), // map of field to excess boost values (multiply).
+ 'post_type' => null, // string or an array.
+ 'terms' => array(), // ex: array( 'taxonomy-1' => array( 'slug' ), 'taxonomy-2' => array( 'slug-a', 'slug-b' ) ). phpcs:ignore Squiz.PHP.CommentedOutCode.Found.
+ 'author' => null, // id or an array of ids.
+ 'author_name' => array(), // string or an array.
+ 'date_range' => null, // array( 'field' => 'date', 'gt' => 'YYYY-MM-dd', 'lte' => 'YYYY-MM-dd' ); date formats: 'YYYY-MM-dd' or 'YYYY-MM-dd HH:MM:SS'. phpcs:ignore Squiz.PHP.CommentedOutCode.Found.
'orderby' => null, // Defaults to 'relevance' if query is set, otherwise 'date'. Pass an array for multiple orders.
'order' => 'DESC',
'posts_per_page' => 10,
@@ -817,11 +943,23 @@ class Jetpack_Search {
$args = wp_parse_args( $args, $defaults );
- $parser = new Jetpack_WPES_Search_Query_Parser( $args['query'], array( get_locale() ) );
+ $parser = new Jetpack_WPES_Search_Query_Parser(
+ $args['query'],
+ /**
+ * Filter the languages used by Jetpack Search's Query Parser.
+ *
+ * @module search
+ *
+ * @since 7.9.0
+ *
+ * @param array $languages The array of languages. Default is value of get_locale().
+ */
+ apply_filters( 'jetpack_search_query_languages', array( get_locale() ) )
+ );
if ( empty( $args['query_fields'] ) ) {
if ( defined( 'JETPACK_SEARCH_VIP_INDEX' ) && JETPACK_SEARCH_VIP_INDEX ) {
- // VIP indices do not have per language fields
+ // VIP indices do not have per language fields.
$match_fields = $this->_get_caret_boosted_fields(
array(
'title' => 0.1,
@@ -835,13 +973,16 @@ class Jetpack_Search {
);
$boost_fields = $this->_get_caret_boosted_fields(
- $this->_apply_boosts_multiplier( array(
- 'title' => 2,
- 'tag.name' => 1,
- 'category.name' => 1,
- 'author_login' => 1,
- 'author' => 1,
- ), $args['excess_boost'] )
+ $this->_apply_boosts_multiplier(
+ array(
+ 'title' => 2,
+ 'tag.name' => 1,
+ 'category.name' => 1,
+ 'author_login' => 1,
+ 'author' => 1,
+ ),
+ $args['excess_boost']
+ )
);
$boost_phrase_fields = $this->_get_caret_boosted_fields(
@@ -863,22 +1004,32 @@ class Jetpack_Search {
'tag.name' => 0.1,
'category.name' => 0.1,
),
- $this->_get_caret_boosted_fields( array(
- 'author_login' => 0.1,
- 'author' => 0.1,
- ) )
+ $this->_get_caret_boosted_fields(
+ array(
+ 'author_login' => 0.1,
+ 'author' => 0.1,
+ )
+ )
);
$boost_fields = $parser->merge_ml_fields(
- $this->_apply_boosts_multiplier( array(
- 'title' => 2,
- 'tag.name' => 1,
- 'category.name' => 1,
- ), $args['excess_boost'] ),
- $this->_get_caret_boosted_fields( $this->_apply_boosts_multiplier( array(
- 'author_login' => 1,
- 'author' => 1,
- ), $args['excess_boost'] ) )
+ $this->_apply_boosts_multiplier(
+ array(
+ 'title' => 2,
+ 'tag.name' => 1,
+ 'category.name' => 1,
+ ),
+ $args['excess_boost']
+ ),
+ $this->_get_caret_boosted_fields(
+ $this->_apply_boosts_multiplier(
+ array(
+ 'author_login' => 1,
+ 'author' => 1,
+ ),
+ $args['excess_boost']
+ )
+ )
);
$boost_phrase_fields = $parser->merge_ml_fields(
@@ -889,9 +1040,11 @@ class Jetpack_Search {
'tag.name' => 1,
'category.name' => 1,
),
- $this->_get_caret_boosted_fields( array(
- 'author' => 1,
- ) )
+ $this->_get_caret_boosted_fields(
+ array(
+ 'author' => 1,
+ )
+ )
);
}
} else {
@@ -901,20 +1054,26 @@ class Jetpack_Search {
$boost_fields = null;
}
- $parser->phrase_filter( array(
- 'must_query_fields' => $match_fields,
- 'boost_query_fields' => null,
- ) );
- $parser->remaining_query( array(
- 'must_query_fields' => $match_fields,
- 'boost_query_fields' => $boost_fields,
- ) );
+ $parser->phrase_filter(
+ array(
+ 'must_query_fields' => $match_fields,
+ 'boost_query_fields' => null,
+ )
+ );
+ $parser->remaining_query(
+ array(
+ 'must_query_fields' => $match_fields,
+ 'boost_query_fields' => $boost_fields,
+ )
+ );
- // Boost on phrase matches
- $parser->remaining_query( array(
- 'boost_query_fields' => $boost_phrase_fields,
- 'boost_query_type' => 'phrase',
- ) );
+ // Boost on phrase matches.
+ $parser->remaining_query(
+ array(
+ 'boost_query_fields' => $boost_phrase_fields,
+ 'boost_query_type' => 'phrase',
+ )
+ );
/**
* Modify the recency decay parameters for the search query.
@@ -945,10 +1104,13 @@ class Jetpack_Search {
);
if ( ! empty( $decay_params ) ) {
- // Newer content gets weighted slightly higher
- $parser->add_decay( 'gauss', array(
- 'date_gmt' => $decay_params
- ) );
+ // Newer content gets weighted slightly higher.
+ $parser->add_decay(
+ 'gauss',
+ array(
+ 'date_gmt' => $decay_params,
+ )
+ );
}
$es_query_args = array(
@@ -956,7 +1118,7 @@ class Jetpack_Search {
'size' => absint( $args['posts_per_page'] ),
);
- // ES "from" arg (offset)
+ // ES "from" arg (offset).
if ( $args['offset'] ) {
$es_query_args['from'] = absint( $args['offset'] );
} elseif ( $args['paged'] ) {
@@ -969,7 +1131,7 @@ class Jetpack_Search {
$args['author_name'] = array( $args['author_name'] );
}
- // ES stores usernames, not IDs, so transform
+ // ES stores usernames, not IDs, so transform.
if ( ! empty( $args['author'] ) ) {
if ( ! is_array( $args['author'] ) ) {
$args['author'] = array( $args['author'] );
@@ -984,30 +1146,35 @@ class Jetpack_Search {
}
}
- //////////////////////////////////////////////////
- // Build the filters from the query elements.
- // Filters rock because they are cached from one query to the next
- // but they are cached as individual filters, rather than all combined together.
- // May get performance boost by also caching the top level boolean filter too.
+ /*
+ * Build the filters from the query elements.
+ * Filters rock because they are cached from one query to the next
+ * but they are cached as individual filters, rather than all combined together.
+ * May get performance boost by also caching the top level boolean filter too.
+ */
if ( $args['post_type'] ) {
if ( ! is_array( $args['post_type'] ) ) {
$args['post_type'] = array( $args['post_type'] );
}
- $parser->add_filter( array(
- 'terms' => array(
- 'post_type' => $args['post_type'],
- ),
- ) );
+ $parser->add_filter(
+ array(
+ 'terms' => array(
+ 'post_type' => $args['post_type'],
+ ),
+ )
+ );
}
if ( $args['author_name'] ) {
- $parser->add_filter( array(
- 'terms' => array(
- 'author_login' => $args['author_name'],
- ),
- ) );
+ $parser->add_filter(
+ array(
+ 'terms' => array(
+ 'author_login' => $args['author_name'],
+ ),
+ )
+ );
}
if ( ! empty( $args['date_range'] ) && isset( $args['date_range']['field'] ) ) {
@@ -1015,11 +1182,13 @@ class Jetpack_Search {
unset( $args['date_range']['field'] );
- $parser->add_filter( array(
- 'range' => array(
- $field => $args['date_range'],
- ),
- ) );
+ $parser->add_filter(
+ array(
+ 'range' => array(
+ $field => $args['date_range'],
+ ),
+ )
+ );
}
if ( is_array( $args['terms'] ) ) {
@@ -1045,11 +1214,13 @@ class Jetpack_Search {
}
foreach ( $terms as $term ) {
- $parser->add_filter( array(
- 'term' => array(
- $tax_fld => $term,
- ),
- ) );
+ $parser->add_filter(
+ array(
+ 'term' => array(
+ $tax_fld => $term,
+ ),
+ )
+ );
}
}
}
@@ -1063,7 +1234,7 @@ class Jetpack_Search {
}
}
- // Validate the "order" field
+ // Validate the "order" field.
switch ( strtolower( $args['order'] ) ) {
case 'asc':
$args['order'] = 'asc';
@@ -1078,10 +1249,10 @@ class Jetpack_Search {
$es_query_args['sort'] = array();
foreach ( (array) $args['orderby'] as $orderby ) {
- // Translate orderby from WP field to ES field
+ // Translate orderby from WP field to ES field.
switch ( $orderby ) {
- case 'relevance' :
- //never order by score ascending
+ case 'relevance':
+ // never order by score ascending.
$es_query_args['sort'][] = array(
'_score' => array(
'order' => 'desc',
@@ -1090,7 +1261,7 @@ class Jetpack_Search {
break;
- case 'date' :
+ case 'date':
$es_query_args['sort'][] = array(
'date' => array(
'order' => $args['order'],
@@ -1099,7 +1270,7 @@ class Jetpack_Search {
break;
- case 'ID' :
+ case 'ID':
$es_query_args['sort'][] = array(
'id' => array(
'order' => $args['order'],
@@ -1108,7 +1279,7 @@ class Jetpack_Search {
break;
- case 'author' :
+ case 'author':
$es_query_args['sort'][] = array(
'author.raw' => array(
'order' => $args['order'],
@@ -1116,14 +1287,14 @@ class Jetpack_Search {
);
break;
- } // End switch().
- } // End foreach().
+ } // End switch.
+ } // End foreach.
if ( empty( $es_query_args['sort'] ) ) {
unset( $es_query_args['sort'] );
}
- // Aggregations
+ // Aggregations.
if ( ! empty( $args['aggregations'] ) ) {
$this->add_aggregations_to_es_query_builder( $args['aggregations'], $parser );
}
@@ -1190,12 +1361,15 @@ class Jetpack_Search {
break;
}
- $builder->add_aggs( $label, array(
- 'terms' => array(
- 'field' => $field . '.slug',
- 'size' => min( (int) $aggregation['count'], $this->max_aggregations_count ),
- ),
- ) );
+ $builder->add_aggs(
+ $label,
+ array(
+ 'terms' => array(
+ 'field' => $field . '.slug',
+ 'size' => min( (int) $aggregation['count'], $this->max_aggregations_count ),
+ ),
+ )
+ );
}
/**
@@ -1208,12 +1382,15 @@ class Jetpack_Search {
* @param Jetpack_WPES_Query_Builder $builder The builder instance that is creating the Elasticsearch query.
*/
public function add_post_type_aggregation_to_es_query_builder( array $aggregation, $label, Jetpack_WPES_Query_Builder $builder ) {
- $builder->add_aggs( $label, array(
- 'terms' => array(
- 'field' => 'post_type',
- 'size' => min( (int) $aggregation['count'], $this->max_aggregations_count ),
- ),
- ) );
+ $builder->add_aggs(
+ $label,
+ array(
+ 'terms' => array(
+ 'field' => 'post_type',
+ 'size' => min( (int) $aggregation['count'], $this->max_aggregations_count ),
+ ),
+ )
+ );
}
/**
@@ -1228,7 +1405,7 @@ class Jetpack_Search {
public function add_date_histogram_aggregation_to_es_query_builder( array $aggregation, $label, Jetpack_WPES_Query_Builder $builder ) {
$args = array(
'interval' => $aggregation['interval'],
- 'field' => ( ! empty( $aggregation['field'] ) && 'post_date_gmt' == $aggregation['field'] ) ? 'date_gmt' : 'date',
+ 'field' => ( ! empty( $aggregation['field'] ) && 'post_date_gmt' === $aggregation['field'] ) ? 'date_gmt' : 'date',
);
if ( isset( $aggregation['min_doc_count'] ) ) {
@@ -1237,9 +1414,12 @@ class Jetpack_Search {
$args['min_doc_count'] = 1;
}
- $builder->add_aggs( $label, array(
- 'date_histogram' => $args,
- ) );
+ $builder->add_aggs(
+ $label,
+ array(
+ 'date_histogram' => $args,
+ )
+ );
}
/**
@@ -1284,7 +1464,7 @@ class Jetpack_Search {
*
* @since 5.0.0
*
- * @param array $aggregations Array of filters (aggregations) to apply to the search
+ * @param array $aggregations Array of filters (aggregations) to apply to the search.
*/
public function set_filters( array $aggregations ) {
foreach ( (array) $aggregations as $key => $agg ) {
@@ -1380,7 +1560,7 @@ class Jetpack_Search {
return $aggregation_data;
}
- // NOTE - Looping over the _results_, not the original configured aggregations, so we get the 'real' data from ES
+ // NOTE - Looping over the _results_, not the original configured aggregations, so we get the 'real' data from ES.
foreach ( $aggregation_results as $label => $aggregation ) {
if ( empty( $aggregation ) ) {
continue;
@@ -1394,15 +1574,15 @@ class Jetpack_Search {
$tax_query_var = null;
- // Figure out which terms are active in the query, for this taxonomy
+ // Figure out which terms are active in the query, for this taxonomy.
if ( 'taxonomy' === $this->aggregations[ $label ]['type'] ) {
$tax_query_var = $this->get_taxonomy_query_var( $this->aggregations[ $label ]['taxonomy'] );
if ( ! empty( $query->tax_query ) && ! empty( $query->tax_query->queries ) && is_array( $query->tax_query->queries ) ) {
foreach ( $query->tax_query->queries as $tax_query ) {
if ( is_array( $tax_query ) && $this->aggregations[ $label ]['taxonomy'] === $tax_query['taxonomy'] &&
- 'slug' === $tax_query['field'] &&
- is_array( $tax_query['terms'] ) ) {
+ 'slug' === $tax_query['field'] &&
+ is_array( $tax_query['terms'] ) ) {
$existing_term_slugs = array_merge( $existing_term_slugs, $tax_query['terms'] );
}
}
@@ -1416,12 +1596,12 @@ class Jetpack_Search {
$buckets = (array) $aggregation['buckets'];
}
- if ( 'date_histogram' == $type ) {
- //re-order newest to oldest
+ if ( 'date_histogram' === $type ) {
+ // re-order newest to oldest.
$buckets = array_reverse( $buckets );
}
- // Some aggregation types like date_histogram don't support the max results parameter
+ // Some aggregation types like date_histogram don't support the max results parameter.
if ( is_int( $this->aggregations[ $label ]['count'] ) && count( $buckets ) > $this->aggregations[ $label ]['count'] ) {
$buckets = array_slice( $buckets, 0, $this->aggregations[ $label ]['count'] );
}
@@ -1440,7 +1620,7 @@ class Jetpack_Search {
$term = get_term_by( 'slug', $item['key'], $taxonomy );
if ( ! $term || ! $tax_query_var ) {
- continue 2; // switch() is considered a looping structure
+ continue 2; // switch() is considered a looping structure.
}
$query_vars = array(
@@ -1449,7 +1629,7 @@ class Jetpack_Search {
$name = $term->name;
- // Let's determine if this term is active or not
+ // Let's determine if this term is active or not.
if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
$active = true;
@@ -1472,7 +1652,7 @@ class Jetpack_Search {
$post_type = get_post_type_object( $item['key'] );
if ( ! $post_type || $post_type->exclude_from_search ) {
- continue 2; // switch() is considered a looping structure
+ continue 2; // switch() is considered a looping structure.
}
$query_vars = array(
@@ -1488,12 +1668,12 @@ class Jetpack_Search {
$post_types = array( $post_types );
}
- if ( in_array( $item['key'], $post_types ) ) {
+ if ( in_array( $item['key'], $post_types, true ) ) {
$active = true;
$post_type_count = count( $post_types );
- // For the right 'remove filter' url, we need to remove the post type from the array, or remove the param entirely if it's the only one
+ // For the right 'remove filter' url, we need to remove the post type from the array, or remove the param entirely if it's the only one.
if ( $post_type_count > 1 ) {
$remove_url = Jetpack_Search_Helpers::add_query_arg(
'post_type',
@@ -1548,7 +1728,7 @@ class Jetpack_Search {
// Is this month currently selected?
if ( ! empty( $current_year ) && (int) $current_year === $year &&
- ! empty( $current_month ) && (int) $current_month === $month ) {
+ ! empty( $current_month ) && (int) $current_month === $month ) {
$active = true;
$remove_url = Jetpack_Search_Helpers::remove_query_arg( array( 'year', 'monthnum' ) );
@@ -1571,8 +1751,8 @@ class Jetpack_Search {
// Is this day currently selected?
if ( ! empty( $current_year ) && (int) $current_year === $year &&
- ! empty( $current_month ) && (int) $current_month === $month &&
- ! empty( $current_day ) && (int) $current_day === $day ) {
+ ! empty( $current_month ) && (int) $current_month === $month &&
+ ! empty( $current_day ) && (int) $current_day === $day ) {
$active = true;
$remove_url = Jetpack_Search_Helpers::remove_query_arg( array( 'day' ) );
@@ -1581,16 +1761,16 @@ class Jetpack_Search {
break;
default:
- continue 3; // switch() is considered a looping structure
- } // End switch().
+ continue 3; // switch() is considered a looping structure.
+ } // End switch.
break;
default:
- //continue 2; // switch() is considered a looping structure
- } // End switch().
+ // continue 2; // switch() is considered a looping structure.
+ } // End switch.
- // Need to urlencode param values since add_query_arg doesn't
+ // Need to urlencode param values since add_query_arg doesn't.
$url_params = urlencode_deep( $query_vars );
$aggregation_data[ $label ]['buckets'][] = array(
@@ -1602,10 +1782,10 @@ class Jetpack_Search {
'remove_url' => $remove_url,
'type' => $type,
'type_label' => $aggregation_data[ $label ]['name'],
- 'widget_id' => ! empty( $aggregation_data[ $label ]['widget_id'] ) ? $aggregation_data[ $label ]['widget_id'] : 0
+ 'widget_id' => ! empty( $aggregation_data[ $label ]['widget_id'] ) ? $aggregation_data[ $label ]['widget_id'] : 0,
);
- } // End foreach().
- } // End foreach().
+ } // End foreach.
+ } // End foreach.
/**
* Modify the aggregation filters returned by get_filters().
@@ -1762,7 +1942,8 @@ class Jetpack_Search {
return;
}
- jetpack_tracks_record_event(
+ $tracking = new Automattic\Jetpack\Tracking();
+ $tracking->tracks_record_event(
wp_get_current_user(),
sprintf( 'jetpack_search_widget_%s', $event['action'] ),
$event['widget']
@@ -1796,7 +1977,7 @@ class Jetpack_Search {
if ( is_array( $widgets ) ) {
foreach ( $widgets as $key => $widget ) {
- if ( _get_widget_id_base( $widget ) == Jetpack_Search_Helpers::FILTER_WIDGET_BASE ) {
+ if ( _get_widget_id_base( $widget ) === Jetpack_Search_Helpers::FILTER_WIDGET_BASE ) {
$changed = true;
array_unshift( $sidebars_widgets['wp_inactive_widgets'], $widget );
@@ -1836,11 +2017,11 @@ class Jetpack_Search {
* Transforms an array with fields name as keys and boosts as value into
* shorthand "caret" format.
*
- * @param array $fields_boost [ "title" => "2", "content" => "1" ]
+ * @param array $fields_boost [ "title" => "2", "content" => "1" ].
*
* @return array [ "title^2", "content^1" ]
*/
- private function _get_caret_boosted_fields( array $fields_boost ) {
+ private function _get_caret_boosted_fields( array $fields_boost ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
$caret_boosted_fields = array();
foreach ( $fields_boost as $field => $boost ) {
$caret_boosted_fields[] = "$field^$boost";
@@ -1851,21 +2032,23 @@ class Jetpack_Search {
/**
* Apply a multiplier to boost values.
*
- * @param array $fields_boost [ "title" => 2, "content" => 1 ]
- * @param array $fields_boost_multiplier [ "title" => 0.1234 ]
+ * @param array $fields_boost [ "title" => 2, "content" => 1 ].
+ * @param array $fields_boost_multiplier [ "title" => 0.1234 ].
*
* @return array [ "title" => "0.247", "content" => "1.000" ]
*/
- private function _apply_boosts_multiplier( array $fields_boost, array $fields_boost_multiplier ) {
- foreach( $fields_boost as $field_name => $field_boost ) {
+ private function _apply_boosts_multiplier( array $fields_boost, array $fields_boost_multiplier ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
+ foreach ( $fields_boost as $field_name => $field_boost ) {
if ( isset( $fields_boost_multiplier[ $field_name ] ) ) {
$fields_boost[ $field_name ] *= $fields_boost_multiplier[ $field_name ];
}
- // Set a floor and format the number as string
+ // Set a floor and format the number as string.
$fields_boost[ $field_name ] = number_format(
max( 0.001, $fields_boost[ $field_name ] ),
- 3, '.', ''
+ 3,
+ '.',
+ ''
);
}
diff --git a/plugins/jetpack/modules/seo-tools/jetpack-seo-posts.php b/plugins/jetpack/modules/seo-tools/jetpack-seo-posts.php
index 677f6c8b..82c9b0a5 100644
--- a/plugins/jetpack/modules/seo-tools/jetpack-seo-posts.php
+++ b/plugins/jetpack/modules/seo-tools/jetpack-seo-posts.php
@@ -60,4 +60,32 @@ class Jetpack_SEO_Posts {
return $custom_description;
}
+
+ /**
+ * Registers the self::DESCRIPTION_META_KEY post_meta for use in the REST API.
+ */
+ public static function register_post_meta() {
+ $args = array(
+ 'type' => 'string',
+ 'description' => __( 'Custom post description to be used in HTML <meta /> tag.', 'jetpack' ),
+ 'single' => true,
+ 'default' => '',
+ 'show_in_rest' => array(
+ 'name' => self::DESCRIPTION_META_KEY
+ ),
+ );
+
+ register_meta( 'post', self::DESCRIPTION_META_KEY, $args );
+ }
+
+ /**
+ * Register the Advanced SEO Gutenberg extension
+ */
+ public static function register_gutenberg_extension() {
+ if ( Jetpack_SEO_Utils::is_enabled_jetpack_seo() ) {
+ Jetpack_Gutenberg::set_extension_available( 'jetpack-seo' );
+ } else {
+ Jetpack_Gutenberg::set_extension_unavailable( 'jetpack-seo', 'jetpack_seo_disabled' );
+ }
+ }
}
diff --git a/plugins/jetpack/modules/seo-tools/jetpack-seo-titles.php b/plugins/jetpack/modules/seo-tools/jetpack-seo-titles.php
index a1bac401..a7c2758d 100644
--- a/plugins/jetpack/modules/seo-tools/jetpack-seo-titles.php
+++ b/plugins/jetpack/modules/seo-tools/jetpack-seo-titles.php
@@ -131,7 +131,7 @@ class Jetpack_SEO_Titles {
case 'post_title':
case 'page_title':
- return get_the_title();
+ return the_title_attribute( array( 'echo' => false ) );
case 'group_title':
return single_tag_title( '', false );
@@ -156,7 +156,7 @@ class Jetpack_SEO_Titles {
return 'front_page';
}
- if ( is_category() || is_tag() ) {
+ if ( is_category() || is_tag() || is_tax() ) {
return 'groups';
}
diff --git a/plugins/jetpack/modules/sharedaddy.php b/plugins/jetpack/modules/sharedaddy.php
index 6b5d83c7..763f575f 100644
--- a/plugins/jetpack/modules/sharedaddy.php
+++ b/plugins/jetpack/modules/sharedaddy.php
@@ -1,4 +1,6 @@
<?php
+use Automattic\Jetpack\Status;
+
/**
* Module Name: Sharing
* Module Description: Add Twitter, Facebook and Google+ buttons at the bottom of each post, making it easy for visitors to share your content.
@@ -35,7 +37,7 @@ function sharedaddy_loaded() {
* @return string Sharing config URL
*/
function jetpack_sharedaddy_configuration_url() {
- if ( Jetpack::is_development_mode() || Jetpack::is_staging_site() || ! Jetpack::is_user_connected() ) {
+ if ( ( new Status() )->is_development_mode() || Jetpack::is_staging_site() || ! Jetpack::is_user_connected() ) {
return admin_url( 'options-general.php?page=sharing' );
}
diff --git a/plugins/jetpack/modules/sharedaddy/admin-sharing.js b/plugins/jetpack/modules/sharedaddy/admin-sharing.js
index 741931d1..e4834772 100644
--- a/plugins/jetpack/modules/sharedaddy/admin-sharing.js
+++ b/plugins/jetpack/modules/sharedaddy/admin-sharing.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false, smarttabs: true */
/* global sharing_loading_icon */
( function( $ ) {
diff --git a/plugins/jetpack/modules/sharedaddy/sharedaddy.php b/plugins/jetpack/modules/sharedaddy/sharedaddy.php
index 1e5de22c..82fe7af2 100644
--- a/plugins/jetpack/modules/sharedaddy/sharedaddy.php
+++ b/plugins/jetpack/modules/sharedaddy/sharedaddy.php
@@ -4,8 +4,8 @@ Plugin Name: Sharedaddy
Description: The most super duper sharing tool on the interwebs.
Version: 0.3.1
Author: Automattic, Inc.
-Author URI: http://automattic.com/
-Plugin URI: http://en.blog.wordpress.com/2010/08/24/more-ways-to-share/
+Author URI: https://automattic.com/
+Plugin URI: https://en.blog.wordpress.com/2010/08/24/more-ways-to-share/
*/
require_once plugin_dir_path( __FILE__ ).'sharing.php';
@@ -222,7 +222,7 @@ function sharing_plugin_settings( $links ) {
function sharing_add_plugin_settings($links, $file) {
if ( $file == basename( dirname( __FILE__ ) ).'/'.basename( __FILE__ ) ) {
$links[] = '<a href="options-general.php?page=sharing.php">' . __( 'Settings', 'jetpack' ) . '</a>';
- $links[] = '<a href="http://support.wordpress.com/sharing/" rel="noopener noreferrer" target="_blank">' . __( 'Support', 'jetpack' ) . '</a>';
+ $links[] = '<a href="https://support.wordpress.com/sharing/" rel="noopener noreferrer" target="_blank">' . __( 'Support', 'jetpack' ) . '</a>';
}
return $links;
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-service.php b/plugins/jetpack/modules/sharedaddy/sharing-service.php
index 7e453262..823dd94d 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-service.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-service.php
@@ -1,5 +1,8 @@
<?php
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Sync\Settings;
+
include_once dirname( __FILE__ ) . '/sharing-sources.php';
define( 'WP_SHARING_PLUGIN_VERSION', JETPACK__VERSION );
@@ -219,7 +222,10 @@ class Sharing_Service {
// Default services
if ( ! is_array( $enabled ) ) {
$enabled = array(
- 'visible' => array(),
+ 'visible' => array(
+ 'twitter',
+ 'facebook',
+ ),
'hidden' => array(),
);
@@ -303,17 +309,17 @@ class Sharing_Service {
public function set_global_options( $data ) {
$options = get_option( 'sharing-options' );
- // No options yet
+ // No options yet.
if ( ! is_array( $options ) ) {
$options = array();
}
- // Defaults
+ // Defaults.
$options['global'] = array(
'button_style' => 'icon-text',
'sharing_label' => $this->default_sharing_label,
'open_links' => 'same',
- 'show' => array(),
+ 'show' => ! isset( $options['global'] ) ? array( 'post', 'page' ) : array(),
'custom' => isset( $options['global']['custom'] ) ? $options['global']['custom'] : array(),
);
@@ -378,7 +384,7 @@ class Sharing_Service {
if ( is_array( $options ) && isset( $options['global'] ) && is_array( $options['global'] ) ) {
$this->global = $options['global'];
} else {
- $this->global = $this->set_global_options( $options['global'] );
+ $this->global = $this->set_global_options( $options );
}
}
@@ -663,11 +669,18 @@ function sharing_process_requests() {
}
add_action( 'template_redirect', 'sharing_process_requests', 9 );
+/**
+ * Append sharing links to text.
+ *
+ * @param string $text The original text to append sharing links onto.
+ * @param bool $echo Where to echo the text or return.
+ *
+ * @return string The original $text with, if conditions are met, the sharing links.
+ */
function sharing_display( $text = '', $echo = false ) {
global $post, $wp_current_filter;
- require_once JETPACK__PLUGIN_DIR . '/sync/class.jetpack-sync-settings.php';
- if ( Jetpack_Sync_Settings::is_syncing() ) {
+ if ( Settings::is_syncing() ) {
return $text;
}
@@ -679,15 +692,15 @@ function sharing_display( $text = '', $echo = false ) {
return $text;
}
- // Don't output flair on excerpts
- if ( in_array( 'get_the_excerpt', (array) $wp_current_filter ) ) {
+ // Don't output flair on excerpts.
+ if ( in_array( 'get_the_excerpt', (array) $wp_current_filter, true ) ) {
return $text;
}
- // Don't allow flair to be added to the_content more than once (prevent infinite loops)
+ // Don't allow flair to be added to the_content more than once (prevent infinite loops).
$done = false;
foreach ( $wp_current_filter as $filter ) {
- if ( 'the_content' == $filter ) {
+ if ( 'the_content' === $filter ) {
if ( $done ) {
return $text;
} else {
@@ -696,15 +709,19 @@ function sharing_display( $text = '', $echo = false ) {
}
}
- // check whether we are viewing the front page and whether the front page option is checked
+ // check whether we are viewing the front page and whether the front page option is checked.
$options = get_option( 'sharing-options' );
- $display_options = $options['global']['show'];
+ $display_options = null;
- if ( is_front_page() && ( is_array( $display_options ) && ! in_array( 'index', $display_options ) ) ) {
+ if ( is_array( $options ) ) {
+ $display_options = $options['global']['show'];
+ }
+
+ if ( is_front_page() && ( is_array( $display_options ) && ! in_array( 'index', $display_options, true ) ) ) {
return $text;
}
- if ( is_attachment() && in_array( 'the_excerpt', (array) $wp_current_filter ) ) {
+ if ( is_attachment() && in_array( 'the_excerpt', (array) $wp_current_filter, true ) ) {
// Many themes run the_excerpt() conditionally on an attachment page, then run the_content().
// We only want to output the sharing buttons once. Let's stick with the_content().
return $text;
@@ -715,9 +732,9 @@ function sharing_display( $text = '', $echo = false ) {
$show = false;
if ( ! is_feed() ) {
- if ( is_singular() && in_array( get_post_type(), $global['show'] ) ) {
+ if ( is_singular() && in_array( get_post_type(), $global['show'], true ) ) {
$show = true;
- } elseif ( in_array( 'index', $global['show'] ) && ( is_home() || is_front_page() || is_archive() || is_search() || in_array( get_post_type(), $global['show'] ) ) ) {
+ } elseif ( in_array( 'index', $global['show'], true ) && ( is_home() || is_front_page() || is_archive() || is_search() || in_array( get_post_type(), $global['show'], true ) ) ) {
$show = true;
}
}
@@ -741,7 +758,7 @@ function sharing_display( $text = '', $echo = false ) {
$show = false;
}
- // Private post?
+ // Is the post private?
$post_status = get_post_status( $post->ID );
if ( 'private' === $post_status ) {
@@ -786,13 +803,11 @@ function sharing_display( $text = '', $echo = false ) {
$enabled = apply_filters( 'sharing_enabled', $sharer->get_blog_services() );
if ( count( $enabled['all'] ) > 0 ) {
- global $post;
-
$dir = get_option( 'text_direction' );
- // Wrapper
+ // Wrapper.
$sharing_content .= '<div class="sharedaddy sd-sharing-enabled"><div class="robots-nocontent sd-block sd-social sd-social-' . $global['button_style'] . ' sd-sharing">';
- if ( $global['sharing_label'] != '' ) {
+ if ( '' !== $global['sharing_label'] ) {
$sharing_content .= sprintf(
/**
* Filter the sharing buttons' headline structure.
@@ -811,7 +826,7 @@ function sharing_display( $text = '', $echo = false ) {
}
$sharing_content .= '<div class="sd-content"><ul>';
- // Visible items
+ // Visible items.
$visible = '';
foreach ( $enabled['visible'] as $id => $service ) {
$klasses = array( 'share-' . $service->get_class() );
@@ -821,7 +836,7 @@ function sharing_display( $text = '', $echo = false ) {
}
$klasses[] = 'share-deprecated';
}
- // Individual HTML for sharing service
+ // Individual HTML for sharing service.
$visible .= '<li class="' . implode( ' ', $klasses ) . '">' . $service->get_display( $post ) . '</li>';
}
@@ -836,7 +851,7 @@ function sharing_display( $text = '', $echo = false ) {
$parts[] = '<li><a href="#" class="sharing-anchor sd-button share-more"><span>' . $expand . '</span></a></li>';
}
- if ( $dir == 'rtl' ) {
+ if ( 'rtl' === $dir ) {
$parts = array_reverse( $parts );
}
@@ -846,13 +861,13 @@ function sharing_display( $text = '', $echo = false ) {
if ( count( $enabled['hidden'] ) > 0 ) {
$sharing_content .= '<div class="sharing-hidden"><div class="inner" style="display: none;';
- if ( count( $enabled['hidden'] ) == 1 ) {
+ if ( count( $enabled['hidden'] ) === 1 ) {
$sharing_content .= 'width:150px;';
}
$sharing_content .= '">';
- if ( count( $enabled['hidden'] ) == 1 ) {
+ if ( count( $enabled['hidden'] ) === 1 ) {
$sharing_content .= '<ul style="background-image:none;">';
} else {
$sharing_content .= '<ul>';
@@ -860,7 +875,7 @@ function sharing_display( $text = '', $echo = false ) {
$count = 1;
foreach ( $enabled['hidden'] as $id => $service ) {
- // Individual HTML for sharing service
+ // Individual HTML for sharing service.
$klasses = array( 'share-' . $service->get_class() );
if ( $service->is_deprecated() ) {
if ( ! current_user_can( 'manage_options' ) ) {
@@ -872,36 +887,39 @@ function sharing_display( $text = '', $echo = false ) {
$sharing_content .= $service->get_display( $post );
$sharing_content .= '</li>';
- if ( ( $count % 2 ) == 0 ) {
+ if ( ( $count % 2 ) === 0 ) {
$sharing_content .= '<li class="share-end"></li>';
}
$count ++;
}
- // End of wrapper
+ // End of wrapper.
$sharing_content .= '<li class="share-end"></li></ul></div></div>';
}
$sharing_content .= '</div></div></div>';
- // Register our JS
+ // Register our JS.
if ( defined( 'JETPACK__VERSION' ) ) {
$ver = JETPACK__VERSION;
} else {
$ver = '20141212';
}
+
+ // @todo: Investigate if we can load this JS in the footer instead.
wp_register_script(
'sharing-js',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/sharedaddy/sharing.min.js',
'modules/sharedaddy/sharing.js'
),
array( 'jquery' ),
- $ver
+ $ver,
+ false
);
- // Enqueue scripts for the footer
+ // Enqueue scripts for the footer.
add_action( 'wp_footer', 'sharing_add_footer' );
}
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-sources.php b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
index 0cc0ec59..d9954a96 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-sources.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
@@ -1701,7 +1701,15 @@ class Jetpack_Share_WhatsApp extends Sharing_Source {
public function process_request( $post, array $post_data ) {
// Record stats
parent::process_request( $post, $post_data );
- $url = 'https://api.whatsapp.com/send?text=' . rawurlencode( $this->get_share_title( $post->ID ) . ' ' . $this->get_share_url( $post->ID ) );
+
+ // Firefox for desktop doesn't handle the "api.whatsapp.com" URL properly, so use "web.whatsapp.com"
+ if ( Jetpack_User_Agent_Info::is_firefox_desktop() ) {
+ $url = 'https://web.whatsapp.com/send?text=';
+ } else {
+ $url = 'https://api.whatsapp.com/send?text=';
+ }
+
+ $url .= rawurlencode( $this->get_share_title( $post->ID ) . ' ' . $this->get_share_url( $post->ID ) );
wp_redirect( $url );
exit;
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing.css b/plugins/jetpack/modules/sharedaddy/sharing.css
index 7481f416..2ada890d 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing.css
+++ b/plugins/jetpack/modules/sharedaddy/sharing.css
@@ -89,7 +89,7 @@ body.highlander-dark h3.sd-title:before {
font-family: "Open Sans", sans-serif;
font-weight: normal;
border-radius: 3px;
- color: #545454 !important;
+ color: #656565 !important;
background: #f8f8f8;
border: 1px solid #cccccc;
box-shadow: 0 1px 0 rgba(0,0,0,.08);
@@ -599,7 +599,7 @@ body .sd-social-icon .sd-content li.share-custom a span {
}
.sd-social-icon .sd-content ul li[class*='share-'].share-facebook a.sd-button {
- background: #3b5998;
+ background: #1877F2;
color: #fff !important;
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing.js b/plugins/jetpack/modules/sharedaddy/sharing.js
index dcaf0f11..bd027e9e 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing.js
+++ b/plugins/jetpack/modules/sharedaddy/sharing.js
@@ -1,5 +1,4 @@
/* global WPCOM_sharing_counts, grecaptcha */
-/* jshint unused:false */
var sharing_js_options;
if ( sharing_js_options && sharing_js_options.counts ) {
var WPCOMSharing = {
diff --git a/plugins/jetpack/modules/sharedaddy/sharing.php b/plugins/jetpack/modules/sharedaddy/sharing.php
index 49df892b..805dc172 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing.php
@@ -1,10 +1,14 @@
<?php
+
+use Automattic\Jetpack\Assets;
+
if ( ! defined( 'WP_SHARING_PLUGIN_URL' ) ) {
define( 'WP_SHARING_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'WP_SHARING_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
class Sharing_Admin {
+
public function __construct() {
require_once WP_SHARING_PLUGIN_DIR . 'sharing-service.php';
@@ -24,7 +28,7 @@ class Sharing_Admin {
public function sharing_head() {
wp_enqueue_script(
'sharing-js',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/sharedaddy/admin-sharing.min.js',
'modules/sharedaddy/admin-sharing.js'
),
@@ -210,7 +214,7 @@ class Sharing_Admin {
if ( false == function_exists( 'mb_stripos' ) ) {
echo '<div id="message" class="updated fade"><h3>' . __( 'Warning! Multibyte support missing!', 'jetpack' ) . '</h3>';
- echo '<p>' . sprintf( __( 'This plugin will work without it, but multibyte support is used <a href="%s" rel="noopener noreferrer" target="_blank">if available</a>. You may see minor problems with Tweets and other sharing services.', 'jetpack' ), 'http://www.php.net/manual/en/mbstring.installation.php' ) . '</p></div>';
+ echo '<p>' . sprintf( __( 'This plugin will work without it, but multibyte support is used <a href="%s" rel="noopener noreferrer" target="_blank">if available</a>. You may see minor problems with Tweets and other sharing services.', 'jetpack' ), 'https://www.php.net/manual/en/mbstring.installation.php' ) . '</p></div>';
}
if ( isset( $_GET['update'] ) && $_GET['update'] == 'saved' ) {
diff --git a/plugins/jetpack/modules/shortcodes.php b/plugins/jetpack/modules/shortcodes.php
index 23ed63e1..ec4f529a 100644
--- a/plugins/jetpack/modules/shortcodes.php
+++ b/plugins/jetpack/modules/shortcodes.php
@@ -91,7 +91,7 @@ function jetpack_preg_replace_outside_tags( $pattern, $replacement, $content, $s
$textarr = wp_html_split( $content );
unset( $content );
foreach ( $textarr as &$element ) {
- if ( '' === $element || '<' === $element{0} ) {
+ if ( '' === $element || '<' === $element[0] ) {
continue;
}
$element = preg_replace( $pattern, $replacement, $element );
@@ -119,7 +119,7 @@ function jetpack_preg_replace_callback_outside_tags( $pattern, $callback, $conte
$textarr = wp_html_split( $content );
unset( $content );
foreach ( $textarr as &$element ) {
- if ( '' === $element || '<' === $element{0} ) {
+ if ( '' === $element || '<' === $element[0] ) {
continue;
}
$element = preg_replace_callback( $pattern, $callback, $element );
diff --git a/plugins/jetpack/modules/shortcodes/archiveorg-book.php b/plugins/jetpack/modules/shortcodes/archiveorg-book.php
index 88ac328c..013e7924 100644
--- a/plugins/jetpack/modules/shortcodes/archiveorg-book.php
+++ b/plugins/jetpack/modules/shortcodes/archiveorg-book.php
@@ -4,7 +4,7 @@
*
* Usage:
* [archiveorg-book goodytwoshoes00newyiala]
- * [archiveorg-book http://www.archive.org/stream/goodytwoshoes00newyiala]
+ * [archiveorg-book https://www.archive.org/stream/goodytwoshoes00newyiala]
* [archiveorg id=goodytwoshoes00newyiala width=480 height=430]
* <iframe src='https://www.archive.org/stream/goodytwoshoes00newyiala?ui=embed#mode/1up' width='480px' height='430px' frameborder='0' ></iframe>
@@ -76,9 +76,11 @@ function jetpack_archiveorg_book_shortcode( $atts ) {
$height = intval( $atts['height'] );
}
- $url = esc_url( set_url_scheme( "http://archive.org/stream/{$id}?ui=embed#mode/1up" ) );
+ $url = esc_url( "https://archive.org/stream/{$id}?ui=embed#mode/1up" );
- $html = "<div class='embed-archiveorg-book' style='text-align:center;'><iframe src='$url' width='$width' height='$height' style='border:0;' webkitallowfullscreen='true' mozallowfullscreen='true' allowfullscreen></iframe></div>";
+ $title = esc_html__( 'Archive.org Book', 'jetpack' );
+
+ $html = "<div class='embed-archiveorg-book' style='text-align:center;'><iframe title='$title' src='$url' width='$width' height='$height' style='border:0;' webkitallowfullscreen='true' mozallowfullscreen='true' allowfullscreen></iframe></div>";
return $html;
}
diff --git a/plugins/jetpack/modules/shortcodes/archiveorg.php b/plugins/jetpack/modules/shortcodes/archiveorg.php
index 4a335b32..f3e0e2af 100644
--- a/plugins/jetpack/modules/shortcodes/archiveorg.php
+++ b/plugins/jetpack/modules/shortcodes/archiveorg.php
@@ -90,9 +90,11 @@ function jetpack_archiveorg_shortcode( $atts ) {
$poster = '';
}
- $url = esc_url( set_url_scheme( "https://archive.org/embed/{$id}{$autoplay}{$poster}" ) );
+ $url = esc_url( "https://archive.org/embed/{$id}{$autoplay}{$poster}" );
- $html = "<div class='embed-archiveorg' style='text-align:center;'><iframe src='$url' width='$width' height='$height' style='border:0;' webkitallowfullscreen='true' mozallowfullscreen='true' allowfullscreen></iframe></div>";
+ $title = esc_html__( 'Archive.org', 'jetpack' );
+
+ $html = "<div class='embed-archiveorg' style='text-align:center;'><iframe title='$title' src='$url' width='$width' height='$height' style='border:0;' webkitallowfullscreen='true' mozallowfullscreen='true' allowfullscreen></iframe></div>";
return $html;
}
diff --git a/plugins/jetpack/modules/shortcodes/brightcove.php b/plugins/jetpack/modules/shortcodes/brightcove.php
index 5eca5293..4a08b9a8 100644
--- a/plugins/jetpack/modules/shortcodes/brightcove.php
+++ b/plugins/jetpack/modules/shortcodes/brightcove.php
@@ -1,5 +1,7 @@
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+use Automattic\Jetpack\Assets;
+
/**
* Brightcove shortcode.
*
@@ -51,7 +53,7 @@ class Jetpack_Brightcove_Shortcode {
* The latest: [shortcode a=1 b=2] and the legacy: [shortcode a=1&b=2]
* For an old shortcode: [shortcode a=1&b=2&c=3], it would be parsed into array( 'a' => 1&b=2&c=3' ), which is useless.
* However, since we want to determine whether to call convert_to_legacy_studio() or convert_to_new_studio() via passed parameters, we still need to parse the two properly.
- * See http://jetpack.wp-a2z.org/oik_api/shortcode_new_to_old_params/
+ * See https://jetpack.wp-a2z.org/oik_api/shortcode_new_to_old_params/
*
* @since 4.5.0
*
@@ -251,7 +253,7 @@ class Jetpack_Brightcove_Shortcode {
if ( $html5 ) {
wp_enqueue_script(
'brightcove-loader',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/brightcove.min.js', 'modules/shortcodes/js/brightcove.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/brightcove.min.js', 'modules/shortcodes/js/brightcove.js' ),
array( 'jquery' ),
20121127,
false
diff --git a/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php b/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php
index 43e6ca18..5c9d2364 100644
--- a/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php
+++ b/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php
@@ -222,17 +222,22 @@ class Filter_Embedded_HTML_Objects {
* @param array $matches Array of matches.
*/
private static function dispatch_entities( $matches ) {
- $matches[0] = html_entity_decode( $matches[0] );
+ $orig_html = $matches[0];
+ $decoded_matches = array( html_entity_decode( $matches[0] ) );
- return self::dispatch( $matches );
+ return self::dispatch( $decoded_matches, $orig_html );
}
/**
* Filter and replace HTML element.
*
- * @param array $matches Array of matches.
+ * @param array $matches Array of matches.
+ * @param string $orig_html Original html. Returned if no results are found via $matches processing.
*/
- private static function dispatch( $matches ) {
+ private static function dispatch( $matches, $orig_html = null ) {
+ if ( null === $orig_html ) {
+ $orig_html = $matches[0];
+ }
$html = preg_replace( '%&#0*58;//%', '://', $matches[0] );
$attrs = self::get_attrs( $html );
if ( isset( $attrs['src'] ) ) {
@@ -253,7 +258,7 @@ class Filter_Embedded_HTML_Objects {
}
}
- return $matches[0];
+ return $orig_html;
}
$src = trim( $src );
@@ -299,11 +304,11 @@ class Filter_Embedded_HTML_Objects {
// Keep the failed match so we can later replace it with a link,
// but return the original content to give others a chance too.
self::$failed_embeds[] = array(
- 'match' => $matches[0],
+ 'match' => $orig_html,
'src' => esc_url( $src ),
);
- return $matches[0];
+ return $orig_html;
}
/**
diff --git a/plugins/jetpack/modules/shortcodes/crowdsignal.php b/plugins/jetpack/modules/shortcodes/crowdsignal.php
index e2078a68..04177919 100644
--- a/plugins/jetpack/modules/shortcodes/crowdsignal.php
+++ b/plugins/jetpack/modules/shortcodes/crowdsignal.php
@@ -1,610 +1,766 @@
-<?php
-
-// Keep compatibility with polldaddy-plugin
-if ( ! class_exists( 'CrowdsignalShortcode' ) && ! class_exists( 'PolldaddyShortcode' ) ) {
-
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
-* Class wrapper for Crowdsignal shortcodes
-*/
+ * Crowdsignal (PollDaddy) shortcode.
+ *
+ * Formats:
+ * [polldaddy type="iframe" survey="EB151947E5950FCF" height="auto" domain="jeherve" id="a-survey-with-branches"]
+ * [crowdsignal type="iframe" survey="EB151947E5950FCF" height="auto" domain="jeherve" id="a-survey-with-branches"]
+ * https://polldaddy.com/poll/7910844/
+ * https://jeherve.survey.fm/a-survey
+ * https://jeherve.survey.fm/a-survey-with-branches
+ * [crowdsignal type="iframe" survey="7676FB1FF2B56CE9" height="auto" domain="jeherve" id="a-survey"]
+ * [crowdsignal survey="7676FB1FF2B56CE9"]
+ * [polldaddy survey="7676FB1FF2B56CE9"]
+ * [crowdsignal poll=9541291]
+ * [crowdsignal poll=9541291 type=slider]
+ * [crowdsignal rating=8755352]
+ *
+ * @package Jetpack
+ */
+
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Constants;
+
+// Keep compatibility with the PollDaddy plugin.
+if (
+ ! class_exists( 'CrowdsignalShortcode' )
+ && ! class_exists( 'PolldaddyShortcode' )
+) {
+ /**
+ * Class wrapper for Crowdsignal shortcodes
+ */
+ class CrowdsignalShortcode {
-class CrowdsignalShortcode {
+ /**
+ * Should the Crowdsignal JavaScript be added to the page?
+ *
+ * @var bool
+ */
+ private static $add_script = false;
- static $add_script = false;
- static $scripts = false;
+ /**
+ * Array of Polls / Surveys present on the page, and that need to be added.
+ *
+ * @var bool|array
+ */
+ private static $scripts = false;
+
+ /**
+ * Add all the actions & register the shortcode.
+ */
+ public function __construct() {
+ add_action( 'init', array( $this, 'register_scripts' ) );
- /**
- * Add all the actions & resgister the shortcode
- */
- function __construct() {
- if ( defined( 'GLOBAL_TAGS' ) == false ) {
add_shortcode( 'crowdsignal', array( $this, 'crowdsignal_shortcode' ) );
- add_shortcode( 'polldaddy', array( $this, 'crowdsignal_shortcode' ) );
+ add_shortcode( 'polldaddy', array( $this, 'polldaddy_shortcode' ) );
add_filter( 'pre_kses', array( $this, 'crowdsignal_embed_to_shortcode' ) );
+ add_action( 'wp_enqueue_scripts', array( $this, 'check_infinite' ) );
+ add_action( 'infinite_scroll_render', array( $this, 'crowdsignal_shortcode_infinite' ), 11 );
}
- add_action( 'wp_enqueue_scripts', array( $this, 'check_infinite' ) );
- add_action( 'infinite_scroll_render', array( $this, 'crowdsignal_shortcode_infinite' ), 11 );
- }
- private function get_async_code( array $settings, $survey_link ) {
- $include = <<<CONTAINER
-( function( d, c, j ) {
- if ( !d.getElementById( j ) ) {
- var pd = d.createElement( c ), s;
- pd.id = j;
- pd.src = 'https://polldaddy.com/survey.js';
- s = d.getElementsByTagName( c )[0];
- s.parentNode.insertBefore( pd, s );
- }
-}( document, 'script', 'pd-embed' ) );
-CONTAINER;
-
- // Compress it a bit
- $include = $this->compress_it( $include );
-
- $placeholder =
- '<div class="cs-embed pd-embed" data-settings="'
- . esc_attr( json_encode( $settings ) )
- . '"></div>';
- if ( 'button' === $settings['type'] ) {
- $placeholder =
- '<a class="cs-embed pd-embed" href="'
- . esc_attr( $survey_link )
- . '" data-settings="'
- . esc_attr( json_encode( $settings ) )
- . '">'
- . esc_html( $settings['title'] )
- . '</a>';
+ /**
+ * Register scripts that may be enqueued later on by the shortcode.
+ */
+ public static function register_scripts() {
+ wp_register_script(
+ 'crowdsignal-shortcode',
+ Assets::get_file_url_for_environment( '_inc/build/crowdsignal-shortcode.min.js', '_inc/crowdsignal-shortcode.js' ),
+ array( 'jquery' ),
+ JETPACK__VERSION,
+ true
+ );
+ wp_register_script(
+ 'crowdsignal-survey',
+ Assets::get_file_url_for_environment( '_inc/build/crowdsignal-survey.min.js', '_inc/crowdsignal-survey.js' ),
+ array(),
+ JETPACK__VERSION,
+ true
+ );
+ wp_register_script(
+ 'crowdsignal-rating',
+ 'https://polldaddy.com/js/rating/rating.js',
+ array(),
+ JETPACK__VERSION,
+ true
+ );
}
- $js_include = $placeholder . "\n";
- $js_include .= '<script type="text/javascript"><!--//--><![CDATA[//><!--' . "\n";
- $js_include .= $include . "\n";
- $js_include .= "//--><!]]></script>\n";
+ /**
+ * JavaScript code for a specific survey / poll.
+ *
+ * @param array $settings Array of information about a survey / poll.
+ * @param string $survey_link HTML link tag for a specific survey or poll.
+ * @param string $survey_url Link to the survey or poll.
+ */
+ private function get_async_code( array $settings, $survey_link, $survey_url ) {
+ wp_enqueue_script( 'crowdsignal-survey' );
+
+ if ( 'button' === $settings['type'] ) {
+ $placeholder = sprintf(
+ '<a class="cs-embed pd-embed" href="%1$s" data-settings="%2$s">%3$s</a>',
+ esc_url( $survey_url ),
+ esc_attr( wp_json_encode( $settings ) ),
+ esc_html( $settings['title'] )
+ );
+ } else {
+ $placeholder = sprintf(
+ '<div class="cs-embed pd-embed" data-settings="%1$s"></div><noscript>%2$s</noscript>',
+ esc_attr( wp_json_encode( $settings ) ),
+ $survey_link
+ );
+ }
- if ( 'button' !== $settings['type'] ) {
- $js_include .= '<noscript>' . $survey_link . "</noscript>\n";
+ return $placeholder;
}
- return $js_include;
- }
-
- private function compress_it( $js ) {
- $js = str_replace( array( "\n", "\t", "\r" ), '', $js );
- $js = preg_replace( '/\s*([,:\?\{;\-=\(\)])\s*/', '$1', $js );
- return $js;
- }
-
- /*
- * Crowdsignal Poll Embed script - transforms code that looks like that:
- * <script type="text/javascript" charset="utf-8" async src="http://static.polldaddy.com/p/123456.js"></script>
- * <noscript><a href="http://polldaddy.com/poll/123456/">What is your favourite color?</a></noscript>
- * into the [crowdsignal poll=...] shortcode format
- */
- function crowdsignal_embed_to_shortcode( $content ) {
-
- if ( ! is_string( $content ) || false === strpos( $content, 'polldaddy.com/p/' ) ) {
- return $content;
- }
+ /**
+ * Crowdsignal Poll Embed script - transforms code that looks like that:
+ * <script type="text/javascript" charset="utf-8" async src="http://static.polldaddy.com/p/123456.js"></script>
+ * <noscript><a href="http://polldaddy.com/poll/123456/">What is your favourite color?</a></noscript>
+ * into the [crowdsignal poll=...] shortcode format
+ *
+ * @param string $content Post content.
+ */
+ public function crowdsignal_embed_to_shortcode( $content ) {
- $regexes = array();
+ if ( ! is_string( $content ) || false === strpos( $content, 'polldaddy.com/p/' ) ) {
+ return $content;
+ }
- $regexes[] = '#<script[^>]+?src="https?://(secure|static)\.polldaddy\.com/p/([0-9]+)\.js"[^>]*+>\s*?</script>\r?\n?(<noscript>.*?</noscript>)?#i';
+ $regexes = array();
- $regexes[] = '#&lt;script(?:[^&]|&(?!gt;))+?src="https?://(secure|static)\.polldaddy\.com/p/([0-9]+)\.js"(?:[^&]|&(?!gt;))*+&gt;\s*?&lt;/script&gt;\r?\n?(&lt;noscript&gt;.*?&lt;/noscript&gt;)?#i';
+ $regexes[] = '#<script[^>]+?src="https?://(secure|static)\.polldaddy\.com/p/([0-9]+)\.js"[^>]*+>\s*?</script>\r?\n?(<noscript>.*?</noscript>)?#i';
- foreach ( $regexes as $regex ) {
- if ( ! preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) {
- continue;
- }
+ $regexes[] = '#&lt;script(?:[^&]|&(?!gt;))+?src="https?://(secure|static)\.polldaddy\.com/p/([0-9]+)\.js"(?:[^&]|&(?!gt;))*+&gt;\s*?&lt;/script&gt;\r?\n?(&lt;noscript&gt;.*?&lt;/noscript&gt;)?#i';
- foreach ( $matches as $match ) {
- if ( ! isset( $match[2] ) ) {
+ foreach ( $regexes as $regex ) {
+ if ( ! preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) {
continue;
}
- $id = (int) $match[2];
+ foreach ( $matches as $match ) {
+ if ( ! isset( $match[2] ) ) {
+ continue;
+ }
+
+ $id = (int) $match[2];
- if ( $id > 0 ) {
- $content = str_replace( $match[0], " [crowdsignal poll=$id]", $content );
- /** This action is documented in modules/shortcodes/youtube.php */
- do_action( 'jetpack_embed_to_shortcode', 'crowdsignal', $id );
+ if ( $id > 0 ) {
+ $content = str_replace( $match[0], " [crowdsignal poll=$id]", $content );
+ /** This action is documented in modules/shortcodes/youtube.php */
+ do_action( 'jetpack_embed_to_shortcode', 'crowdsignal', $id );
+ }
}
}
- }
- return $content;
- }
-
- /**
- * Shortcode for polldadddy
- * [crowdsignal poll|survey|rating="123456"]
- */
- function crowdsignal_shortcode( $atts ) {
- global $post;
- global $content_width;
+ return $content;
+ }
/**
- * Variables extracted from $atts.
+ * Support for legacy Polldaddy shortcode.
*
- * @var string $survey
- * @var string $link_text
- * @var string $poll
- * @var string $rating
- * @var string $unique_id
- * @var string $item_id
- * @var string $title
- * @var string $permalink
- * @var int $cb
- * @var string $type
- * @var string $body
- * @var string $button
- * @var string $text_color
- * @var string $back_color
- * @var string $align
- * @var string $style
- * @var int $width
- * @var int $height
- * @var int $delay
- * @var string $visit
- * @var string $domain
- * @var string $id
+ * @param array $atts Shortcode attributes.
*/
- extract( shortcode_atts( array(
- 'survey' => null,
- 'link_text' => 'Take Our Survey',
- 'poll' => 'empty',
- 'rating' => 'empty',
- 'unique_id' => null,
- 'item_id' => null,
- 'title' => null,
- 'permalink' => null,
- 'cb' => 0,
- 'type' => 'button',
- 'body' => '',
- 'button' => '',
- 'text_color' => '000000',
- 'back_color' => 'FFFFFF',
- 'align' => '',
- 'style' => '',
- 'width' => $content_width,
- 'height' => floor( $content_width * 3 / 4 ),
- 'delay' => 100,
- 'visit' => 'single',
- 'domain' => '',
- 'id' => '',
- ), $atts, 'crowdsignal' ) );
-
- if ( ! is_array( $atts ) ) {
- return '<!-- Crowdsignal shortcode passed invalid attributes -->';
- }
-
- $inline = ! in_the_loop();
- $no_script = false;
- $infinite_scroll = false;
-
- if ( is_home() && current_theme_supports( 'infinite-scroll' ) ) {
- $infinite_scroll = true;
- }
-
- if ( defined( 'PADPRESS_LOADED' ) ) {
- $inline = true;
- }
-
- if ( function_exists( 'get_option' ) && get_option( 'polldaddy_load_poll_inline' ) ) {
- $inline = true;
- }
+ public function polldaddy_shortcode( $atts ) {
+ if ( ! is_array( $atts ) ) {
+ return '<!-- Polldaddy shortcode passed invalid attributes -->';
+ }
- if ( is_feed() || ( defined( 'DOING_AJAX' ) && ! $infinite_scroll ) ) {
- $no_script = false;
+ $atts['site'] = 'polldaddy.com';
+ return $this->crowdsignal_shortcode( $atts );
}
- self::$add_script = $infinite_scroll;
-
- if ( intval( $rating ) > 0 && ! $no_script ) { //rating embed
+ /**
+ * Shortcode for Crowdsignal
+ * [crowdsignal poll|survey|rating="123456"]
+ *
+ * @param array $atts Shortcode attributes.
+ */
+ public function crowdsignal_shortcode( $atts ) {
+ global $post;
+ global $content_width;
- if ( empty( $unique_id ) ) {
- $unique_id = is_page() ? 'wp-page-' . $post->ID : 'wp-post-' . $post->ID;
+ if ( ! is_array( $atts ) ) {
+ return '<!-- Crowdsignal shortcode passed invalid attributes -->';
}
- if ( empty( $item_id ) ) {
- $item_id = is_page() ? '_page_' . $post->ID : '_post_' . $post->ID;
+ $attributes = shortcode_atts(
+ array(
+ 'survey' => null,
+ 'link_text' => esc_html__( 'Take Our Survey', 'jetpack' ),
+ 'poll' => 'empty',
+ 'rating' => 'empty',
+ 'unique_id' => null,
+ 'item_id' => null,
+ 'title' => null,
+ 'permalink' => null,
+ 'cb' => 0, // cache buster. Helps with testing.
+ 'type' => 'button',
+ 'body' => '',
+ 'button' => '',
+ 'text_color' => '000000',
+ 'back_color' => 'FFFFFF',
+ 'align' => '',
+ 'style' => '',
+ 'width' => $content_width,
+ 'height' => floor( $content_width * 3 / 4 ),
+ 'delay' => 100,
+ 'visit' => 'single',
+ 'domain' => '',
+ 'id' => '',
+ 'site' => 'crowdsignal.com',
+ ),
+ $atts,
+ 'crowdsignal'
+ );
+
+ $inline = ! in_the_loop()
+ && ! Constants::is_defined( 'TESTING_IN_JETPACK' );
+
+ $no_script = false;
+ $infinite_scroll = false;
+
+ if ( is_home() && current_theme_supports( 'infinite-scroll' ) ) {
+ $infinite_scroll = true;
}
- if ( empty( $title ) ) {
- /** This filter is documented in core/src/wp-includes/general-template.php */
- $title = apply_filters( 'wp_title', $post->post_title, '', '' );
+ if ( function_exists( 'get_option' ) && get_option( 'polldaddy_load_poll_inline' ) ) {
+ $inline = true;
}
- if ( empty( $permalink ) ) {
- $permalink = get_permalink( $post->ID );
+ if ( is_feed() || ( defined( 'DOING_AJAX' ) && ! $infinite_scroll ) ) {
+ $no_script = false;
}
- $rating = intval( $rating );
- $unique_id = preg_replace( '/[^\-_a-z0-9]/i', '', wp_strip_all_tags( $unique_id ) );
- $item_id = wp_strip_all_tags( $item_id );
- $item_id = preg_replace( '/[^_a-z0-9]/i', '', $item_id );
-
- $settings = json_encode( array(
- 'id' => $rating,
- 'unique_id' => $unique_id,
- 'title' => rawurlencode( trim( $title ) ),
- 'permalink' => esc_url( $permalink ),
- 'item_id' => $item_id,
- ) );
-
- $item_id = esc_js( $item_id );
-
- if ( Jetpack_AMP_Support::is_amp_request() ) {
- return sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( $permalink ), esc_html( trim( $title ) ) );
- } elseif ( $inline ) {
- return <<<SCRIPT
-<div class="cs-rating pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
-<script type="text/javascript" charset="UTF-8"><!--//--><![CDATA[//><!--
-PDRTJS_settings_{$rating}{$item_id}={$settings};
-//--><!]]></script>
-<script type="text/javascript" charset="UTF-8" async src="https://polldaddy.com/js/rating/rating.js"></script>
-SCRIPT;
- } else {
- if ( false === self::$scripts ) {
- self::$scripts = array();
- }
-
- $data = array( 'id' => $rating, 'item_id' => $item_id, 'settings' => $settings );
-
- self::$scripts['rating'][] = $data;
+ self::$add_script = $infinite_scroll;
- add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
+ /*
+ * Rating embed.
+ */
+ if ( intval( $attributes['rating'] ) > 0 && ! $no_script ) {
- $data = esc_attr( json_encode( $data ) );
-
- if ( $infinite_scroll ) {
- return <<<CONTAINER
-<div class="cs-rating pd-rating" id="pd_rating_holder_{$rating}{$item_id}" data-settings="{$data}"></div>
-CONTAINER;
- } else {
- return <<<CONTAINER
-<div class="cs-rating pd-rating" id="pd_rating_holder_{$rating}{$item_id}"></div>
-CONTAINER;
+ if ( empty( $attributes['unique_id'] ) ) {
+ $attributes['unique_id'] = is_page() ? 'wp-page-' . $post->ID : 'wp-post-' . $post->ID;
}
- }
- } elseif ( intval( $poll ) > 0 ) { //poll embed
-
- if ( empty( $title ) ) {
- $title = __( 'Take Our Poll', 'jetpack' );
- }
- $poll = intval( $poll );
- $poll_url = sprintf( 'https://poll.fm/%d', $poll );
- $poll_js = sprintf( 'https://secure.polldaddy.com/p/%d.js', $poll );
- $poll_link = sprintf( '<a href="%s" target="_blank">%s</a>', esc_url( $poll_url ), esc_html( $title ) );
+ if ( empty( $attributes['item_id'] ) ) {
+ $attributes['item_id'] = is_page() ? '_page_' . $post->ID : '_post_' . $post->ID;
+ }
- if ( $no_script || Jetpack_AMP_Support::is_amp_request() ) {
- return $poll_link;
- } else {
- if ( $type == 'slider' && !$inline ) {
+ if ( empty( $attributes['title'] ) ) {
+ /** This filter is documented in core/src/wp-includes/general-template.php */
+ $attributes['title'] = apply_filters( 'wp_title', $post->post_title, '', '' );
+ }
- if ( ! in_array( $visit, array( 'single', 'multiple' ) ) ) {
- $visit = 'single';
- }
+ if ( empty( $attributes['permalink'] ) ) {
+ $attributes['permalink'] = get_permalink( $post->ID );
+ }
- $settings = array(
- 'type' => 'slider',
- 'embed' => 'poll',
- 'delay' => intval( $delay ),
- 'visit' => $visit,
- 'id' => intval( $poll )
+ $rating = intval( $attributes['rating'] );
+ $unique_id = preg_replace( '/[^\-_a-z0-9]/i', '', wp_strip_all_tags( $attributes['unique_id'] ) );
+ $item_id = wp_strip_all_tags( $attributes['item_id'] );
+ $item_id = preg_replace( '/[^_a-z0-9]/i', '', $item_id );
+
+ $settings = wp_json_encode(
+ array(
+ 'id' => $rating,
+ 'unique_id' => $unique_id,
+ 'title' => rawurlencode( trim( $attributes['title'] ) ),
+ 'permalink' => esc_url( $attributes['permalink'] ),
+ 'item_id' => $item_id,
+ )
+ );
+
+ $item_id = esc_js( $item_id );
+
+ if (
+ class_exists( 'Jetpack_AMP_Support' )
+ && Jetpack_AMP_Support::is_amp_request()
+ ) {
+ return sprintf(
+ '<a href="%s" target="_blank">%s</a>',
+ esc_url( $attributes['permalink'] ),
+ esc_html( trim( $attributes['title'] ) )
+ );
+ } elseif ( $inline ) {
+ $rating_js = "<!--//--><![CDATA[//><!--\n";
+ $rating_js .= "PDRTJS_settings_{$rating}{$item_id}={$settings};";
+ $rating_js .= "\n//--><!]]>";
+
+ wp_enqueue_script( 'crowdsignal-rating' );
+ wp_add_inline_script(
+ 'crowdsignal-rating',
+ $rating_js,
+ 'before'
);
- return $this->get_async_code( $settings, $poll_link );
+ return sprintf(
+ '<div class="cs-rating pd-rating" id="pd_rating_holder_%1$d%2$s"></div>',
+ absint( $rating ),
+ esc_attr( $item_id )
+ );
} else {
- $cb = ( $cb == 1 ? '?cb='.mktime() : false );
- $margins = '';
- $float = '';
-
- if ( in_array( $align, array( 'right', 'left' ) ) ) {
- $float = sprintf( 'float: %s;', $align );
-
- if ( $align == 'left')
- $margins = 'margin: 0px 10px 0px 0px;';
- elseif ( $align == 'right' )
- $margins = 'margin: 0px 0px 0px 10px';
- }
-
- // Force the normal style embed on single posts/pages otherwise it's not rendered on infinite scroll themed blogs ('infinite_scroll_render' isn't fired)
- if ( is_singular() ) {
- $inline = true;
+ if ( false === self::$scripts ) {
+ self::$scripts = array();
}
- if ( false === $cb && ! $inline ) {
- if ( false === self::$scripts ) {
- self::$scripts = array();
- }
-
- $data = array( 'url' => $poll_js );
-
- self::$scripts['poll'][intval( $poll )] = $data;
-
- add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
-
- $data = esc_attr( json_encode( $data ) );
-
- $script_url = esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) );
- $str = <<<CONTAINER
-<a name="pd_a_{$poll}"></a>
-<div class="CSS_Poll PDS_Poll" id="PDI_container{$poll}" data-settings="{$data}" style="display:inline-block;{$float}{$margins}"></div>
-<div id="PD_superContainer"></div>
-<noscript>{$poll_link}</noscript>
-CONTAINER;
+ $data = array(
+ 'id' => $rating,
+ 'item_id' => $item_id,
+ 'settings' => $settings,
+ );
-$loader = <<<SCRIPT
-( function( d, c, j ) {
- if ( ! d.getElementById( j ) ) {
- var pd = d.createElement( c ), s;
- pd.id = j;
- pd.src = '{$script_url}';
- s = d.getElementsByTagName( c )[0];
- s.parentNode.insertBefore( pd, s );
- } else if ( typeof jQuery !== 'undefined' ) {
- jQuery( d.body ).trigger( 'pd-script-load' );
- }
-} ( document, 'script', 'pd-polldaddy-loader' ) );
-SCRIPT;
+ self::$scripts['rating'][] = $data;
- $loader = $this->compress_it( $loader );
- $loader = "<script type='text/javascript'>\n" . $loader . "\n</script>";
+ add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
- return $str . $loader;
+ if ( $infinite_scroll ) {
+ return sprintf(
+ '<div class="cs-rating pd-rating" id="pd_rating_holder_%1$d%2$s" data-settings="%3$s"></div>',
+ absint( $rating ),
+ esc_attr( $item_id ),
+ esc_attr( wp_json_encode( $data ) )
+ );
} else {
- if ( $inline ) {
- $cb = '';
- }
-
- return <<<CONTAINER
-<a id="pd_a_{$poll}"></a>
-<div class="CSS_Poll PDS_Poll" id="PDI_container{$poll}" style="display:inline-block;{$float}{$margins}"></div>
-<div id="PD_superContainer"></div>
-<script type="text/javascript" charset="UTF-8" async src="{$poll_js}{$cb}"></script>
-<noscript>{$poll_link}</noscript>
-CONTAINER;
+ return sprintf(
+ '<div class="cs-rating pd-rating" id="pd_rating_holder_%1$d%2$s"></div>',
+ absint( $rating ),
+ esc_attr( $item_id )
+ );
}
}
- }
- } elseif ( ! empty( $survey ) ) { //survey embed
-
- if ( in_array( $type, array( 'iframe', 'button', 'banner', 'slider' ) ) ) {
+ } elseif ( intval( $attributes['poll'] ) > 0 ) {
+ /*
+ * Poll embed.
+ */
- if ( empty( $title ) ) {
- $title = __( 'Take Our Survey', 'jetpack' );
- if( ! empty( $link_text ) ) {
- $title = $link_text;
- }
+ if ( empty( $attributes['title'] ) ) {
+ $attributes['title'] = esc_html__( 'Take Our Poll', 'jetpack' );
}
- if ( $type == 'banner' || $type == 'slider' )
- $inline = false;
-
- $survey = preg_replace( '/[^a-f0-9]/i', '', $survey );
- $survey_url = esc_url( "https://survey.fm/{$survey}" );
- $survey_link = sprintf( '<a href="%s" target="_blank">%s</a>', $survey_url, esc_html( $title ) );
-
- $settings = array();
+ $poll = intval( $attributes['poll'] );
- // Do we want a full embed code or a link?
- if ( $no_script || $inline || $infinite_scroll || Jetpack_AMP_Support::is_amp_request() ) {
- return $survey_link;
+ if ( 'crowdsignal.com' === $attributes['site'] ) {
+ $poll_url = sprintf( 'https://poll.fm/%d', $poll );
+ } else {
+ $poll_url = sprintf( 'https://polldaddy.com/p/%d', $poll );
}
- if ( $type == 'iframe' ) {
- if ( $height != 'auto' ) {
- if ( isset( $content_width ) && is_numeric( $width ) && $width > $content_width ) {
- $width = $content_width;
- }
+ $poll_js = sprintf( 'https://secure.polldaddy.com/p/%d.js', $poll );
+ $poll_link = sprintf(
+ '<a href="%s" target="_blank">%s</a>',
+ esc_url( $poll_url ),
+ esc_html( $attributes['title'] )
+ );
+
+ if (
+ $no_script
+ || ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() )
+ ) {
+ return $poll_link;
+ } else {
+ /*
+ * Slider poll.
+ */
+ if (
+ 'slider' === $attributes['type']
+ && ! $inline
+ ) {
- if ( ! $width ) {
- $width = '100%';
- } else {
- $width = (int) $width;
+ if ( ! in_array(
+ $attributes['visit'],
+ array( 'single', 'multiple' ),
+ true
+ ) ) {
+ $attributes['visit'] = 'single';
}
- if ( ! $height ) {
- $height = '600';
+ $settings = array(
+ 'type' => 'slider',
+ 'embed' => 'poll',
+ 'delay' => intval( $attributes['delay'] ),
+ 'visit' => $attributes['visit'],
+ 'id' => intval( $poll ),
+ 'site' => $attributes['site'],
+ );
+
+ return $this->get_async_code( $settings, $poll_link, $poll_url );
+ } else {
+ if ( 1 === $attributes['cb'] ) {
+ $attributes['cb'] = '?cb=' . mktime();
} else {
- $height = (int) $height;
+ $attributes['cb'] = false;
+ }
+ $margins = '';
+ $float = '';
+
+ if ( in_array(
+ $attributes['align'],
+ array( 'right', 'left' ),
+ true
+ ) ) {
+ $float = sprintf( 'float: %s;', $attributes['align'] );
+
+ if ( 'left' === $attributes['align'] ) {
+ $margins = 'margin: 0px 10px 0px 0px;';
+ } elseif ( 'right' === $attributes['align'] ) {
+ $margins = 'margin: 0px 0px 0px 10px';
+ }
}
- return <<<CONTAINER
-<iframe src="{$survey_url}?iframe=1" frameborder="0" width="{$width}" height="{$height}" scrolling="auto" allowtransparency="true" marginheight="0" marginwidth="0">{$survey_link}</iframe>
-CONTAINER;
- } elseif ( ! empty( $domain ) && ! empty( $id ) ) {
-
- $domain = preg_replace( '/[^a-z0-9\-]/i', '', $domain );
- $id = preg_replace( '/[\/\?&\{\}]/', '', $id );
-
- $auto_src = esc_url( "https://{$domain}.survey.fm/{$id}" );
- $auto_src = parse_url( $auto_src );
-
- if ( ! is_array( $auto_src ) || count( $auto_src ) == 0 ) {
- return '<!-- no crowdsignal output -->';
+ /*
+ * Force the normal style embed on single posts/pages
+ * otherwise it's not rendered on infinite scroll themed blogs
+ * ('infinite_scroll_render' isn't fired)
+ */
+ if ( is_singular() ) {
+ $inline = true;
}
- if ( ! isset( $auto_src['host'] ) || ! isset( $auto_src['path'] ) ) {
- return '<!-- no crowdsignal output -->';
+ if ( false === $attributes['cb'] && ! $inline ) {
+ if ( false === self::$scripts ) {
+ self::$scripts = array();
+ }
+
+ $data = array( 'url' => $poll_js );
+
+ self::$scripts['poll'][ intval( $poll ) ] = $data;
+
+ add_action( 'wp_footer', array( $this, 'generate_scripts' ) );
+
+ wp_enqueue_script( 'crowdsignal-shortcode' );
+ wp_localize_script(
+ 'crowdsignal-shortcode',
+ 'crowdsignal_shortcode_options',
+ array(
+ 'script_url' => esc_url_raw(
+ Assets::get_file_url_for_environment(
+ '_inc/build/polldaddy-shortcode.min.js',
+ '_inc/polldaddy-shortcode.js'
+ )
+ ),
+ )
+ );
+
+ return sprintf(
+ '<a name="pd_a_%1$d"></a><div class="CSS_Poll PDS_Poll" id="PDI_container%1$d" data-settings="%2$s" style="display:inline-block;%3$s%4$s"></div><div id="PD_superContainer"></div><noscript>%5$s</noscript>',
+ absint( $poll ),
+ esc_attr( wp_json_encode( $data ) ),
+ $float,
+ $margins,
+ $poll_link
+ );
+ } else {
+ if ( $inline ) {
+ $attributes['cb'] = '';
+ }
+
+ wp_enqueue_script(
+ 'crowdsignal-' . absint( $poll ),
+ esc_url( $poll_js . $attributes['cb'] ),
+ array(),
+ JETPACK__VERSION,
+ true
+ );
+
+ return sprintf(
+ '<a id="pd_a_%1$s"></a><div class="CSS_Poll PDS_Poll" id="PDI_container%1$s" style="display:inline-block;%2$s%3$s"></div><div id="PD_superContainer"></div><noscript>%4$s</noscript>',
+ absint( $poll ),
+ $float,
+ $margins,
+ $poll_link
+ );
}
+ }
+ }
+ } elseif ( ! empty( $attributes['survey'] ) ) {
+ /*
+ * Survey embed.
+ */
+
+ if ( in_array(
+ $attributes['type'],
+ array( 'iframe', 'button', 'banner', 'slider' ),
+ true
+ ) ) {
+
+ if ( empty( $attributes['title'] ) ) {
+ $attributes['title'] = esc_html__( 'Take Our Survey', 'jetpack' );
+ if ( ! empty( $attributes['link_text'] ) ) {
+ $attributes['title'] = $attributes['link_text'];
+ }
+ }
- $domain = $auto_src['host'] . '/';
- $id = ltrim( $auto_src['path'], '/' );
+ if (
+ 'banner' === $attributes['type']
+ || 'slider' === $attributes['type']
+ ) {
+ $inline = false;
+ }
- $settings = array(
- 'type' => $type,
- 'auto' => true,
- 'domain' => $domain,
- 'id' => $id
- );
+ $survey = preg_replace( '/[^a-f0-9]/i', '', $attributes['survey'] );
+
+ if ( 'crowdsignal.com' === $attributes['site'] ) {
+ $survey_url = 'https://survey.fm/' . $survey;
+ } else {
+ $survey_url = 'https://polldaddy.com/s/' . $survey;
}
- } else {
- $text_color = preg_replace( '/[^a-f0-9]/i', '', $text_color );
- $back_color = preg_replace( '/[^a-f0-9]/i', '', $back_color );
+ $survey_link = sprintf(
+ '<a href="%s" target="_blank" rel="noopener noreferrer">%s</a>',
+ esc_url( $survey_url ),
+ esc_html( $attributes['title'] )
+ );
+
+ $settings = array();
+
+ // Do we want a full embed code or a link?
if (
- ! in_array(
- $align,
- array(
- 'right',
- 'left',
- 'top-left',
- 'top-right',
- 'middle-left',
- 'middle-right',
- 'bottom-left',
- 'bottom-right'
- )
- )
+ $no_script
+ || $inline
+ || $infinite_scroll
+ || ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() )
) {
- $align = '';
+ return $survey_link;
}
- if (
- ! in_array(
- $style,
+ if ( 'iframe' === $attributes['type'] ) {
+ if ( 'auto' !== $attributes['height'] ) {
+ if (
+ isset( $content_width )
+ && is_numeric( $attributes['width'] )
+ && $attributes['width'] > $content_width
+ ) {
+ $attributes['width'] = $content_width;
+ }
+
+ if ( ! $attributes['width'] ) {
+ $attributes['width'] = '100%';
+ } else {
+ $attributes['width'] = (int) $attributes['width'];
+ }
+
+ if ( ! $attributes['height'] ) {
+ $attributes['height'] = '600';
+ } else {
+ $attributes['height'] = (int) $attributes['height'];
+ }
+
+ return sprintf(
+ '<iframe src="%1$s?iframe=1" frameborder="0" width="%2$d" height="%3$d" scrolling="auto" allowtransparency="true" marginheight="0" marginwidth="0">%4$s</iframe>',
+ esc_url( $survey_url ),
+ absint( $attributes['width'] ),
+ absint( $attributes['height'] ),
+ $survey_link
+ );
+ } elseif (
+ ! empty( $attributes['domain'] )
+ && ! empty( $attributes['id'] )
+ ) {
+ $domain = preg_replace( '/[^a-z0-9\-]/i', '', $attributes['domain'] );
+ $id = preg_replace( '/[\/\?&\{\}]/', '', $attributes['id'] );
+
+ $auto_src = esc_url( "https://{$domain}.survey.fm/{$id}" );
+ $auto_src = wp_parse_url( $auto_src );
+
+ if ( ! is_array( $auto_src ) || 0 === count( $auto_src ) ) {
+ return '<!-- no crowdsignal output -->';
+ }
+
+ if ( ! isset( $auto_src['host'] ) || ! isset( $auto_src['path'] ) ) {
+ return '<!-- no crowdsignal output -->';
+ }
+
+ $domain = $auto_src['host'] . '/';
+ $id = ltrim( $auto_src['path'], '/' );
+
+ $settings = array(
+ 'type' => $attributes['type'],
+ 'auto' => true,
+ 'domain' => $domain,
+ 'id' => $id,
+ 'site' => $attributes['site'],
+ );
+ }
+ } else {
+ $text_color = preg_replace( '/[^a-f0-9]/i', '', $attributes['text_color'] );
+ $back_color = preg_replace( '/[^a-f0-9]/i', '', $attributes['back_color'] );
+
+ if (
+ ! in_array(
+ $attributes['align'],
+ array(
+ 'right',
+ 'left',
+ 'top-left',
+ 'top-right',
+ 'middle-left',
+ 'middle-right',
+ 'bottom-left',
+ 'bottom-right',
+ ),
+ true
+ )
+ ) {
+ $attributes['align'] = '';
+ }
+
+ if (
+ ! in_array(
+ $attributes['style'],
+ array(
+ 'inline',
+ 'side',
+ 'corner',
+ 'rounded',
+ 'square',
+ ),
+ true
+ )
+ ) {
+ $attributes['style'] = '';
+ }
+
+ $settings = array_filter(
array(
- 'inline',
- 'side',
- 'corner',
- 'rounded',
- 'square'
+ 'title' => wp_strip_all_tags( $attributes['title'] ),
+ 'type' => $attributes['type'],
+ 'body' => wp_strip_all_tags( $attributes['body'] ),
+ 'button' => wp_strip_all_tags( $attributes['button'] ),
+ 'text_color' => $text_color,
+ 'back_color' => $back_color,
+ 'align' => $attributes['align'],
+ 'style' => $attributes['style'],
+ 'id' => $survey,
+ 'site' => $attributes['site'],
)
- )
- ) {
- $style = '';
+ );
}
- $title = wp_strip_all_tags( $title );
- $body = wp_strip_all_tags( $body );
- $button = wp_strip_all_tags( $button );
-
- $settings = array_filter( array(
- 'title' => $title,
- 'type' => $type,
- 'body' => $body,
- 'button' => $button,
- 'text_color' => $text_color,
- 'back_color' => $back_color,
- 'align' => $align,
- 'style' => $style,
- 'id' => $survey,
- ) );
- }
+ if ( empty( $settings ) ) {
+ return '<!-- no crowdsignal output -->';
+ }
- if ( empty( $settings ) ) {
- return '<!-- no crowdsignal output -->';
+ return $this->get_async_code( $settings, $survey_link, $survey_url );
}
-
- return $this->get_async_code( $settings, $survey_link );
+ } else {
+ return '<!-- no crowdsignal output -->';
}
- } else {
- return '<!-- no crowdsignal output -->';
}
- }
- function generate_scripts() {
- $script = '';
+ /**
+ * Enqueue JavaScript containing all ratings / polls on the page.
+ * Hooked into wp_footer
+ */
+ public function generate_scripts() {
+ if ( is_array( self::$scripts ) ) {
+ if ( isset( self::$scripts['rating'] ) ) {
+ $script = "<!--//--><![CDATA[//><!--\n";
+ foreach ( self::$scripts['rating'] as $rating ) {
+ $script .= "PDRTJS_settings_{$rating['id']}{$rating['item_id']}={$rating['settings']}; if ( typeof PDRTJS_RATING !== 'undefined' ){if ( typeof PDRTJS_{$rating['id']}{$rating['item_id']} == 'undefined' ){PDRTJS_{$rating['id']}{$rating['item_id']} = new PDRTJS_RATING( PDRTJS_settings_{$rating['id']}{$rating['item_id']} );}}";
+ }
+ $script .= "\n//--><!]]>";
- if ( is_array( self::$scripts ) ) {
- if ( isset( self::$scripts['rating'] ) ) {
- $script = "<script type='text/javascript' charset='UTF-8' id='polldaddyRatings'><!--//--><![CDATA[//><!--\n";
- foreach( self::$scripts['rating'] as $rating ) {
- $script .= "PDRTJS_settings_{$rating['id']}{$rating['item_id']}={$rating['settings']}; if ( typeof PDRTJS_RATING !== 'undefined' ){if ( typeof PDRTJS_{$rating['id']}{$rating['item_id']} == 'undefined' ){PDRTJS_{$rating['id']}{$rating['item_id']} = new PDRTJS_RATING( PDRTJS_settings_{$rating['id']}{$rating['item_id']} );}}";
+ wp_enqueue_script( 'crowdsignal-rating' );
+ wp_add_inline_script(
+ 'crowdsignal-rating',
+ $script,
+ 'before'
+ );
}
- $script .= "\n//--><!]]></script><script type='text/javascript' charset='UTF-8' async src='https://polldaddy.com/js/rating/rating.js'></script>";
-
- }
- if ( isset( self::$scripts['poll'] ) ) {
- foreach( self::$scripts['poll'] as $poll ) {
- $script .= "<script type='text/javascript' charset='UTF-8' async src='{$poll['url']}'></script>";
+ if ( isset( self::$scripts['poll'] ) ) {
+ foreach ( self::$scripts['poll'] as $poll_id => $poll ) {
+ wp_enqueue_script(
+ 'crowdsignal-' . absint( $poll_id ),
+ esc_url( $poll['url'] ),
+ array(),
+ JETPACK__VERSION,
+ true
+ );
+ }
}
}
+ self::$scripts = false;
}
- self::$scripts = false;
- echo $script;
- }
-
- /**
- * If the theme uses infinite scroll, include jquery at the start
- */
- function check_infinite() {
- if (
- current_theme_supports( 'infinite-scroll' )
- && class_exists( 'The_Neverending_Home_Page' )
- && The_Neverending_Home_Page::archive_supports_infinity()
- ) {
- wp_enqueue_script( 'jquery' );
+ /**
+ * If the theme uses infinite scroll, include jquery at the start
+ */
+ public function check_infinite() {
+ if (
+ current_theme_supports( 'infinite-scroll' )
+ && class_exists( 'The_Neverending_Home_Page' )
+ && The_Neverending_Home_Page::archive_supports_infinity()
+ ) {
+ wp_enqueue_script( 'jquery' );
+ }
}
- }
-
- /**
- * Dynamically load the .js, if needed
- *
- * This hooks in late (priority 11) to infinite_scroll_render to determine
- * a posteriori if a shortcode has been called.
- */
- function crowdsignal_shortcode_infinite() {
- // only try to load if a shortcode has been called and theme supports infinite scroll
- if( self::$add_script ) {
- $script_url = esc_url_raw( plugins_url( 'js/polldaddy-shortcode.js', __FILE__ ) );
-
- // if the script hasn't been loaded, load it
- // if the script loads successfully, fire an 'pd-script-load' event
- echo <<<SCRIPT
- <script type='text/javascript'>
- //<![CDATA[
- ( function( d, c, j ) {
- if ( !d.getElementById( j ) ) {
- var pd = d.createElement( c ), s;
- pd.id = j;
- pd.async = true;
- pd.src = '{$script_url}';
- s = d.getElementsByTagName( c )[0];
- s.parentNode.insertBefore( pd, s );
- } else if ( typeof jQuery !== 'undefined' ) {
- jQuery( d.body ).trigger( 'pd-script-load' );
- }
- } ( document, 'script', 'pd-polldaddy-loader' ) );
- //]]>
- </script>
-SCRIPT;
+ /**
+ * Dynamically load the .js, if needed
+ *
+ * This hooks in late (priority 11) to infinite_scroll_render to determine
+ * a posteriori if a shortcode has been called.
+ */
+ public function crowdsignal_shortcode_infinite() {
+ // only try to load if a shortcode has been called and theme supports infinite scroll.
+ if ( self::$add_script ) {
+ wp_enqueue_script( 'crowdsignal-shortcode' );
+ wp_localize_script(
+ 'crowdsignal-shortcode',
+ 'crowdsignal_shortcode_options',
+ array(
+ 'script_url' => esc_url_raw(
+ Assets::get_file_url_for_environment(
+ '_inc/build/polldaddy-shortcode.min.js',
+ '_inc/polldaddy-shortcode.js'
+ )
+ ),
+ )
+ );
+ }
}
}
-}
-// kick it all off
-new CrowdsignalShortcode();
+ // Kick it all off.
+ new CrowdsignalShortcode();
-if ( ! function_exists( 'crowdsignal_link' ) ) {
- // http://polldaddy.com/poll/1562975/?view=results&msg=voted
- function crowdsignal_link( $content ) {
- if ( Jetpack_AMP_Support::is_amp_request() ) {
- return $content;
+ if ( ! function_exists( 'crowdsignal_link' ) ) {
+ /**
+ * Replace link by embed.
+ * Example: http://polldaddy.com/poll/1562975/?view=results&msg=voted
+ *
+ * @param string $content Post content.
+ */
+ function crowdsignal_link( $content ) {
+ if (
+ class_exists( 'Jetpack_AMP_Support' )
+ && Jetpack_AMP_Support::is_amp_request()
+ ) {
+ return $content;
+ }
+
+ return jetpack_preg_replace_outside_tags(
+ '!(?:\n|\A)https?://(polldaddy\.com/poll|poll\.fm)/([0-9]+?)(/.*)?(?:\n|\Z)!i',
+ "\n<script type='text/javascript' charset='utf-8' src='//static.polldaddy.com/p/$2.js'></script><noscript> <a href='https://poll.fm/$2'>View Poll</a></noscript>\n", // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
+ $content,
+ 'polldaddy.com/poll'
+ );
}
- return preg_replace( '!(?:\n|\A)https?://(polldaddy\.com/poll|poll\.fm)/([0-9]+?)(/.*)?(?:\n|\Z)!i', "\n<script type='text/javascript' charset='utf-8' src='//static.polldaddy.com/p/$2.js'></script><noscript> <a href='https://poll.fm/$2'>View Poll</a></noscript>\n", $content );
+ // higher priority because we need it before auto-link and autop get to it.
+ add_filter( 'the_content', 'crowdsignal_link', 1 );
+ add_filter( 'the_content_rss', 'crowdsignal_link', 1 );
}
- // higher priority because we need it before auto-link and autop get to it
- add_filter( 'the_content', 'crowdsignal_link', 1 );
- add_filter( 'the_content_rss', 'crowdsignal_link', 1 );
-}
-
/**
* Note that Core has the oembed of '#https?://survey\.fm/.*#i' as of 5.1.
* This should be removed after Core has the current regex is in our minimum version.
*
* @see https://core.trac.wordpress.org/ticket/46467
- * @todo Confirm patch landed and remove once 5.2 is the minimum version.
+ * @todo Remove once 5.2 is the minimum version.
*/
-wp_oembed_add_provider( '#https?://.+\.survey\.fm/.*#i', 'https://api.crowdsignal.com/oembed', true );
-
+ wp_oembed_add_provider( '#https?://.+\.survey\.fm/.*#i', 'https://api.crowdsignal.com/oembed', true );
}
diff --git a/plugins/jetpack/modules/shortcodes/dailymotion.php b/plugins/jetpack/modules/shortcodes/dailymotion.php
index fd2d620f..09984f3b 100644
--- a/plugins/jetpack/modules/shortcodes/dailymotion.php
+++ b/plugins/jetpack/modules/shortcodes/dailymotion.php
@@ -51,7 +51,7 @@ function dailymotion_embed_to_shortcode( $content ) {
}
$id = basename( substr( $src, strlen( 'www.dailymotion.com/swf' ) ) );
- $id = preg_replace( '/[^a-z0-9].*$/i', '', $id );
+ $id = preg_replace( '/[^a-z0-9].*$/is', '', $id );
$content = str_replace( $match[0], "[dailymotion id=$id]", $content );
/** This action is documented in modules/shortcodes/youtube.php */
@@ -151,6 +151,15 @@ function dailymotion_shortcode( $atts ) {
$width = $height / 334 * 425;
}
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ return sprintf(
+ '<amp-dailymotion data-videoid="%1$s" layout="responsive" width="%2$d" height="%3$d"></amp-dailymotion>',
+ esc_attr( $id ),
+ absint( $width ),
+ absint( $height )
+ );
+ }
+
/**
* Let's add parameters if needed.
*
@@ -208,7 +217,7 @@ function dailymotion_shortcode( $atts ) {
&& array_key_exists( 'title', $atts )
&& $title
) {
- $output .= '<br /><strong><a href="' . esc_url( 'http://www.dailymotion.com/video/' . $video ) . '" target="_blank">' . esc_html( $title ) . '</a></strong>';
+ $output .= '<br /><strong><a href="' . esc_url( 'https://www.dailymotion.com/video/' . $video ) . '" target="_blank">' . esc_html( $title ) . '</a></strong>';
}
$user = preg_replace( '/[^-a-z0-9_]/i', '', $atts['user'] );
@@ -218,7 +227,7 @@ function dailymotion_shortcode( $atts ) {
sprintf(
/* Translators: placeholder is a Dailymotion username, linking to a Dailymotion profile page. */
__( 'Uploaded by %s', 'jetpack' ),
- '<a href="' . esc_url( 'http://www.dailymotion.com/' . $user ) . '" target="_blank">' . esc_html( $user ) . '</a>'
+ '<a href="' . esc_url( 'https://www.dailymotion.com/' . $user ) . '" target="_blank">' . esc_html( $user ) . '</a>'
),
array(
'a' => array(
diff --git a/plugins/jetpack/modules/shortcodes/facebook.php b/plugins/jetpack/modules/shortcodes/facebook.php
index e2b11e3f..71d625c8 100644
--- a/plugins/jetpack/modules/shortcodes/facebook.php
+++ b/plugins/jetpack/modules/shortcodes/facebook.php
@@ -9,7 +9,7 @@ define( 'JETPACK_FACEBOOK_EMBED_REGEX', '#^https?://(www.)?facebook\.com/([^/]+)
define( 'JETPACK_FACEBOOK_ALTERNATE_EMBED_REGEX', '#^https?://(www.)?facebook\.com/permalink.php\?([^\s]+)#' );
define( 'JETPACK_FACEBOOK_PHOTO_EMBED_REGEX', '#^https?://(www.)?facebook\.com/photo.php\?([^\s]+)#' );
define( 'JETPACK_FACEBOOK_PHOTO_ALTERNATE_EMBED_REGEX', '#^https?://(www.)?facebook\.com/([^/]+)/photos/([^/]+)?#' );
-define( 'JETPACK_FACEBOOK_VIDEO_EMBED_REGEX', '#^https?://(www.)?facebook\.com/video.php\?([^\s]+)#' );
+define( 'JETPACK_FACEBOOK_VIDEO_EMBED_REGEX', '#^https?://(www.)?facebook\.com/(?:video.php|watch\/?)\?([^\s]+)#' );
define( 'JETPACK_FACEBOOK_VIDEO_ALTERNATE_EMBED_REGEX', '#^https?://(www.)?facebook\.com/([^/]+)/videos/([^/]+)?#' );
@@ -34,7 +34,11 @@ wp_embed_register_handler( 'facebook-photo', JETPACK_FACEBOOK_PHOTO_EMBED_REGEX,
wp_embed_register_handler( 'facebook-alternate-photo', JETPACK_FACEBOOK_PHOTO_ALTERNATE_EMBED_REGEX, 'jetpack_facebook_embed_handler' );
/*
- * Videos e.g. https://www.facebook.com/video.php?v=772471122790796
+ * Videos
+ *
+ * Formats:
+ * https://www.facebook.com/video.php?v=2836814009877992
+ * https://www.facebook.com/watch/?v=2836814009877992
*/
wp_embed_register_handler( 'facebook-video', JETPACK_FACEBOOK_VIDEO_EMBED_REGEX, 'jetpack_facebook_embed_handler' );
@@ -51,7 +55,11 @@ wp_embed_register_handler( 'facebook-alternate-video', JETPACK_FACEBOOK_VIDEO_AL
* @param array $url Requested URL to be embedded.
*/
function jetpack_facebook_embed_handler( $matches, $attr, $url ) {
- if ( false !== strpos( $url, 'video.php' ) || false !== strpos( $url, '/videos/' ) ) {
+ if (
+ false !== strpos( $url, 'video.php' )
+ || false !== strpos( $url, '/videos/' )
+ || false !== strpos( $url, '/watch' )
+ ) {
$embed = sprintf( '<div class="fb-video" data-allowfullscreen="true" data-href="%s"></div>', esc_url( $url ) );
} else {
$width = 552; // As of 01/2017, the default width of Facebook embeds when no width attribute provided.
diff --git a/plugins/jetpack/modules/shortcodes/flickr.php b/plugins/jetpack/modules/shortcodes/flickr.php
index 73db1172..6ee80200 100644
--- a/plugins/jetpack/modules/shortcodes/flickr.php
+++ b/plugins/jetpack/modules/shortcodes/flickr.php
@@ -69,7 +69,13 @@ function flickr_embed_to_shortcode( $content ) {
continue;
}
- $code_atts = array( 'video' => $flashvars['photo_id'] );
+ $photo_id = preg_replace( '#[^A-Za-z0-9_./@+-]+#', '', $flashvars['photo_id'] );
+
+ if ( ! strlen( $photo_id ) ) {
+ continue;
+ }
+
+ $code_atts = array( 'video' => $photo_id );
if (
isset( $flashvars['flickr_show_info_box'] )
@@ -79,7 +85,10 @@ function flickr_embed_to_shortcode( $content ) {
}
if ( ! empty( $flashvars['photo_secret'] ) ) {
- $code_atts['secret'] = $flashvars['photo_secret'];
+ $photo_secret = preg_replace( '#[^A-Za-z0-9_./@+-]+#', '', $flashvars['photo_secret'] );
+ if ( strlen( $photo_secret ) ) {
+ $code_atts['secret'] = $photo_secret;
+ }
}
if ( ! empty( $params['width']['value'] ) ) {
@@ -135,9 +144,7 @@ function flickr_shortcode_handler( $atts ) {
return '';
}
- if ( is_ssl() ) {
- $src = str_replace( 'http://', 'https://', $src );
- }
+ $src = str_replace( 'http://', 'https://', $src );
if ( 'video' === $showing ) {
@@ -186,7 +193,6 @@ function flickr_shortcode_handler( $atts ) {
*/
function flickr_shortcode_video_markup( $atts ) {
$atts = array_map( 'esc_attr', $atts );
- $http = ( is_ssl() ) ? 'https://' : 'http://';
$photo_vars = "photo_id=$atts[photo_id]";
if ( isset( $atts['secret'] ) ) {
@@ -194,7 +200,7 @@ function flickr_shortcode_video_markup( $atts ) {
}
return <<<EOD
-<object type="application/x-shockwave-flash" width="$atts[w]" height="$atts[h]" data="{$http}www.flickr.com/apps/video/stewart.swf?v=1.161" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="$photo_vars&amp;flickr_show_info_box=$atts[show_info]"></param><param name="movie" value="{$http}www.flickr.com/apps/video/stewart.swf?v=1.161"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="opaque"></param><embed type="application/x-shockwave-flash" src="{$http}www.flickr.com/apps/video/stewart.swf?v=1.161" bgcolor="#000000" allowfullscreen="true" flashvars="$photo_vars&amp;flickr_show_info_box=$atts[show_info]" wmode="opaque" height="$atts[h]" width="$atts[w]"></embed></object>
+<object type="application/x-shockwave-flash" width="$atts[w]" height="$atts[h]" data="https://www.flickr.com/apps/video/stewart.swf?v=1.161" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="$photo_vars&amp;flickr_show_info_box=$atts[show_info]"></param><param name="movie" value="https://www.flickr.com/apps/video/stewart.swf?v=1.161"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><param name="wmode" value="opaque"></param><embed type="application/x-shockwave-flash" src="https://www.flickr.com/apps/video/stewart.swf?v=1.161" bgcolor="#000000" allowfullscreen="true" flashvars="$photo_vars&amp;flickr_show_info_box=$atts[show_info]" wmode="opaque" height="$atts[h]" width="$atts[w]"></embed></object>
EOD;
}
diff --git a/plugins/jetpack/modules/shortcodes/getty.php b/plugins/jetpack/modules/shortcodes/getty.php
index d473e726..71e64060 100644
--- a/plugins/jetpack/modules/shortcodes/getty.php
+++ b/plugins/jetpack/modules/shortcodes/getty.php
@@ -152,6 +152,7 @@ function wpcom_shortcodereverse_getty( $content ) {
if ( ! empty( $height ) ) {
$shortcode .= ' height="' . esc_attr( $height ) . '"';
}
+
/*
* While it does not appear to have any practical impact, Getty has
* requested that we include TLD in the embed request
diff --git a/plugins/jetpack/modules/shortcodes/gist.php b/plugins/jetpack/modules/shortcodes/gist.php
index eba0a1a3..7c558c46 100644
--- a/plugins/jetpack/modules/shortcodes/gist.php
+++ b/plugins/jetpack/modules/shortcodes/gist.php
@@ -18,6 +18,8 @@
* @package Jetpack
*/
+use Automattic\Jetpack\Assets;
+
wp_embed_register_handler( 'github-gist', '#https?://gist\.github\.com/([a-zA-Z0-9/]+)(\#file\-[a-zA-Z0-9\_\-]+)?#', 'github_gist_embed_handler' );
add_shortcode( 'gist', 'github_gist_shortcode' );
@@ -56,6 +58,7 @@ function jetpack_gist_get_shortcode_id( $gist = '' ) {
$gist_info = array(
'id' => '',
'file' => '',
+ 'ts' => 8,
);
// Simple shortcode, with just an ID.
if ( ctype_alnum( $gist ) ) {
@@ -74,6 +77,7 @@ function jetpack_gist_get_shortcode_id( $gist = '' ) {
return array(
'id' => '',
'file' => '',
+ 'ts' => 8,
);
}
@@ -84,10 +88,19 @@ function jetpack_gist_get_shortcode_id( $gist = '' ) {
// Keep the unique identifier without any leading or trailing slashes.
if ( ! empty( $parsed_url['path'] ) ) {
- $gist_info['id'] = preg_replace( '/^\/([^\.]+)\./', '$1', $parsed_url['path'] );
+ $gist_info['id'] = trim( $parsed_url['path'], '/' );
// Overwrite $gist with our identifier to clean it up below.
$gist = $gist_info['id'];
}
+
+ // Parse the query args to obtain the tab spacing.
+ if ( ! empty( $parsed_url['query'] ) ) {
+ $query_args = array();
+ wp_parse_str( $parsed_url['query'], $query_args );
+ if ( ! empty( $query_args['ts'] ) ) {
+ $gist_info['ts'] = absint( $query_args['ts'] );
+ }
+ }
}
// Not a URL nor an ID? Look for "username/id", "/username/id", or "id", and only keep the ID.
@@ -154,6 +167,12 @@ function github_gist_shortcode( $atts, $content = '' ) {
$file = rawurlencode( $file );
}
+ // Set the tab size, allowing attributes to override the query string.
+ $tab_size = $gist_info['ts'];
+ if ( ! empty( $atts['ts'] ) ) {
+ $tab_size = absint( $atts['ts'] );
+ }
+
if (
class_exists( 'Jetpack_AMP_Support' )
&& Jetpack_AMP_Support::is_amp_request()
@@ -186,14 +205,18 @@ function github_gist_shortcode( $atts, $content = '' ) {
wp_enqueue_script(
'jetpack-gist-embed',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/gist.min.js', 'modules/shortcodes/js/gist.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/gist.min.js', 'modules/shortcodes/js/gist.js' ),
array( 'jquery' ),
JETPACK__VERSION,
true
);
// inline style to prevent the bottom margin to the embed that themes like TwentyTen, et al., add to tables.
- $return = '<style>.gist table { margin-bottom: 0; }</style><div class="gist-oembed" data-gist="' . esc_attr( $id ) . '"></div>';
+ $return = sprintf(
+ '<style>.gist table { margin-bottom: 0; }</style><div class="gist-oembed" data-gist="%1$s" data-ts="%2$d"></div>',
+ esc_attr( $id ),
+ absint( $tab_size )
+ );
if (
// No need to check for a nonce here, that's already handled by Core further up.
@@ -204,7 +227,7 @@ function github_gist_shortcode( $atts, $content = '' ) {
&& 'parse-embed' === $_POST['action']
// phpcs:enable WordPress.Security.NonceVerification.Missing
) {
- return github_gist_simple_embed( $id );
+ return github_gist_simple_embed( $id, $tab_size );
}
return $return;
@@ -216,9 +239,11 @@ function github_gist_shortcode( $atts, $content = '' ) {
*
* @since 3.9.0
*
- * @param string $id The ID of the gist.
+ * @param string $id The ID of the gist.
+ * @param int $tab_size The tab size of the gist.
+ * @return string The script tag of the gist.
*/
-function github_gist_simple_embed( $id ) {
+function github_gist_simple_embed( $id, $tab_size = 8 ) {
$id = str_replace( 'json', 'js', $id );
- return '<script src="' . esc_url( "https://gist.github.com/$id" ) . '"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
+ return '<script src="' . esc_url( "https://gist.github.com/$id?ts=$tab_size" ) . '"></script>'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
}
diff --git a/plugins/jetpack/modules/shortcodes/googlemaps.php b/plugins/jetpack/modules/shortcodes/googlemaps.php
index 435e8da0..1871aff3 100644
--- a/plugins/jetpack/modules/shortcodes/googlemaps.php
+++ b/plugins/jetpack/modules/shortcodes/googlemaps.php
@@ -108,9 +108,7 @@ function jetpack_googlemaps_shortcode( $atts ) {
}
$url = substr( $url, 0, -5 );
- if ( is_ssl() ) {
- $url = str_replace( 'http://', 'https://', $url );
- }
+ $url = str_replace( 'http://', 'https://', $url );
$css_class = 'googlemaps';
diff --git a/plugins/jetpack/modules/shortcodes/gravatar.php b/plugins/jetpack/modules/shortcodes/gravatar.php
index cb709af9..f84f1c24 100644
--- a/plugins/jetpack/modules/shortcodes/gravatar.php
+++ b/plugins/jetpack/modules/shortcodes/gravatar.php
@@ -94,7 +94,7 @@ function jetpack_gravatar_profile_shortcode( $atts ) {
}
// Render the shortcode.
- $gravatar_url = set_url_scheme( 'http://gravatar.com/' . $user->user_login );
+ $gravatar_url = 'https://gravatar.com/' . $user->user_login;
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
$avatar_url = wpcom_get_avatar_url( $user->ID, 96 );
diff --git a/plugins/jetpack/modules/shortcodes/instagram.php b/plugins/jetpack/modules/shortcodes/instagram.php
index 85c675b4..30d96ed8 100644
--- a/plugins/jetpack/modules/shortcodes/instagram.php
+++ b/plugins/jetpack/modules/shortcodes/instagram.php
@@ -13,6 +13,8 @@
* @package Jetpack
*/
+use Automattic\Jetpack\Assets;
+
/**
* Embed Reversal for Instagram
*
@@ -107,7 +109,7 @@ function jetpack_instagram_handler( $matches, $atts, $url ) {
if ( is_feed() ) {
// Instagram offers direct links to images, but not to videos.
if ( 'p' === $matches[1] ) {
- $media_url = sprintf( 'http://instagr.am/p/%1$s/media/?size=l', $matches[2] );
+ $media_url = sprintf( 'https://instagr.am/p/%1$s/media/?size=l', $matches[2] );
return sprintf(
'<a href="%1$s" title="%2$s" target="_blank"><img src="%3$s" alt="%4$s" /></a>',
esc_url( $url ),
@@ -207,7 +209,7 @@ function jetpack_instagram_handler( $matches, $atts, $url ) {
if ( ! empty( $response_body->html ) ) {
wp_enqueue_script(
'jetpack-instagram-embed',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/instagram.min.js', 'modules/shortcodes/js/instagram.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/instagram.min.js', 'modules/shortcodes/js/instagram.js' ),
array( 'jquery' ),
JETPACK__VERSION,
true
@@ -260,6 +262,27 @@ function jetpack_shortcode_instagram( $atts ) {
return '';
}
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ $url_pattern = '#http(s?)://(www\.)?instagr(\.am|am\.com)/p/([^/?]+)#i';
+ preg_match( $url_pattern, $atts['url'], $matches );
+ if ( ! $matches ) {
+ return sprintf(
+ '<a href="%1$s" class="amp-wp-embed-fallback">%1$s</a>',
+ esc_url( $atts['url'] )
+ );
+ }
+
+ $shortcode_id = end( $matches );
+ $width = ! empty( $atts['width'] ) ? $atts['width'] : 600;
+ $height = ! empty( $atts['height'] ) ? $atts['height'] : 600;
+ return sprintf(
+ '<amp-instagram data-shortcode="%1$s" layout="responsive" width="%2$d" height="%3$d" data-captioned></amp-instagram>',
+ esc_attr( $shortcode_id ),
+ absint( $width ),
+ absint( $height )
+ );
+ }
+
return $wp_embed->shortcode( $atts, $atts['url'] );
}
add_shortcode( 'instagram', 'jetpack_shortcode_instagram' );
diff --git a/plugins/jetpack/modules/shortcodes/js/gist.js b/plugins/jetpack/modules/shortcodes/js/gist.js
index a97d7f91..d2d704dc 100644
--- a/plugins/jetpack/modules/shortcodes/js/gist.js
+++ b/plugins/jetpack/modules/shortcodes/js/gist.js
@@ -2,13 +2,18 @@
var gistStylesheetLoaded = false,
gistEmbed = function() {
$( '.gist-oembed' ).each( function( i, el ) {
- var url = 'https://gist.github.com/' + $( el ).data( 'gist' );
+ var url = 'https://gist.github.com/' + $( el ).data( 'gist' ),
+ ts = Number.parseInt( $( el ).data( 'ts' ), 10 );
$.ajax( {
url: url,
dataType: 'jsonp',
} ).done( function( response ) {
- $( el ).replaceWith( response.div );
+ if ( ts && 8 !== ts ) {
+ $( el ).replaceWith( $( response.div ).css( 'tab-size', ts.toString() ) );
+ } else {
+ $( el ).replaceWith( response.div );
+ }
if ( ! gistStylesheetLoaded ) {
var stylesheet =
diff --git a/plugins/jetpack/modules/shortcodes/js/jmpress.js b/plugins/jetpack/modules/shortcodes/js/jmpress.js
index c6519cd9..907499bf 100644
--- a/plugins/jetpack/modules/shortcodes/js/jmpress.js
+++ b/plugins/jetpack/modules/shortcodes/js/jmpress.js
@@ -1307,7 +1307,7 @@
if ( item.length === 0 || item.closest( jmpress ).length === 0 ) {
item = $( jmpress )
.find( stepSelector )
- [ prev ? 'last' : 'first' ]();
+ [ prev ? 'last' : 'first' ](); // eslint-disable-line no-unexpected-multiline
}
if ( ! item.length ) {
return false;
diff --git a/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js b/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js
index e31fb24c..f2a1937c 100644
--- a/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js
+++ b/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js
@@ -1,4 +1,3 @@
-// jshint ignore: start
/*
* printThis v1.9.0
* @desc Printing plug-in for jQuery
@@ -36,7 +35,6 @@
* Notes:
* - the loadCSS will load additional css (with or without @media print) into the iframe, adjusting layout
*
- * jshint onevar: false, smarttabs: true, devel: true
*/
( function( $ ) {
var opt;
diff --git a/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js b/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js
index 44a2bd6f..e266465a 100644
--- a/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js
+++ b/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js
@@ -1,4 +1,3 @@
-/* jshint onevar:false, loopfunc:true */
/* global jetpackSlideshowSettings, escape */
function JetpackSlideshow( element, transition, autostart ) {
diff --git a/plugins/jetpack/modules/shortcodes/medium.php b/plugins/jetpack/modules/shortcodes/medium.php
index 02d02aaf..6285759e 100644
--- a/plugins/jetpack/modules/shortcodes/medium.php
+++ b/plugins/jetpack/modules/shortcodes/medium.php
@@ -1,16 +1,26 @@
<?php
-
-// Embed support for Medium https://medium.com/p/3eaed64aed8a
-
/**
- * Faux-oembed support for Medium permalinks
+ * Embed support for Medium
+ *
+ * Supported formats:
+ * - Profiles: https://medium.com/@jeherve
+ * - Stories: https://medium.com/@jeherve/this-is-a-story-19f582daaf5b
+ * - And all the above in shortcode formats:
+ * [medium url="https://medium.com/@jeherve/this-is-a-story-19f582daaf5b" width="100%" border="false" collapsed="true"]
*
- * e.g.
- * https://medium.com/help-center
- * https://medium.com/@richroll
+ * @package Jetpack
*/
+
+// Faux-oembed support for Medium permalinks.
wp_embed_register_handler( 'medium', '#^https?://medium.com/([a-zA-z0-9-_@]+)#', 'jetpack_embed_medium_oembed' );
+/**
+ * Callback to modify output of embedded Medium posts.
+ *
+ * @param array $matches Regex partial matches against the URL passed.
+ * @param array $attr Attributes received in embed response.
+ * @param array $url Requested URL to be embedded.
+ */
function jetpack_embed_medium_oembed( $matches, $attr, $url ) {
$attr = jetpack_embed_medium_args( $attr );
$attr['url'] = $url;
@@ -18,6 +28,11 @@ function jetpack_embed_medium_oembed( $matches, $attr, $url ) {
return jetpack_embed_medium_embed_html( $attr );
}
+/**
+ * Return custom markup to display a Medium profile, collection, or story.
+ *
+ * @param array $args Attributes received in embed response.
+ */
function jetpack_embed_medium_embed_html( $args ) {
$args = jetpack_embed_medium_args( $args );
@@ -27,36 +42,75 @@ function jetpack_embed_medium_embed_html( $args ) {
$args['type'] = jetpack_embed_medium_get_embed_type( $args['url'] );
- return sprintf( '<script async src="https://static.medium.com/embed.js"></script><a class="m-%1$s" href="%2$s" target="_blank" data-width="%3$s" data-border="%4$s" data-collapsed="%5$s">View %1$s at Medium.com</a>', esc_attr( $args['type'] ), esc_url( $args['url'] ), esc_attr( $args['width'] ), esc_attr( $args['border'] ), esc_attr( $args['collapsed'] ) );
+ if ( 'collection' === $args['type'] ) {
+ return sprintf(
+ '<a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a>',
+ esc_url( $args['url'] ),
+ esc_html__( 'View this collection on Medium.com', 'jetpack' )
+ );
+ }
+
+ wp_enqueue_script(
+ 'medium-embed',
+ 'https://static.medium.com/embed.js',
+ array(),
+ JETPACK__VERSION,
+ true
+ );
+
+ return sprintf(
+ '<a class="m-%1$s" href="%2$s" target="_blank" data-width="%3$s" data-border="%4$s" data-collapsed="%5$s">%6$s</a>',
+ esc_attr( $args['type'] ),
+ esc_url( $args['url'] ),
+ esc_attr( $args['width'] ),
+ esc_attr( $args['border'] ),
+ esc_attr( $args['collapsed'] ),
+ esc_html__( 'View at Medium.com', 'jetpack' )
+ );
}
/**
* Shortcode support that allows passing in URL
*
- * [medium url="https://medium.com/help-center" width="100%" border="false" collapsed="true"]
+ * @param array $atts Shortcode attributes.
*/
-add_shortcode( 'medium', 'jetpack_embed_medium_shortcode' );
-
function jetpack_embed_medium_shortcode( $atts ) {
$atts = jetpack_embed_medium_args( $atts );
if ( ! empty( $atts['url'] ) ) {
global $wp_embed;
return $wp_embed->shortcode( $atts, $atts['url'] );
+ } else {
+ if ( current_user_can( 'edit_posts' ) ) {
+ return esc_html__( 'You did not provide a valid Medium URL.', 'jetpack' );
+ } else {
+ return '<!-- Missing Medium URL -->';
+ }
}
}
+add_shortcode( 'medium', 'jetpack_embed_medium_shortcode' );
+/**
+ * Get embed type (profile, collection, or story) based on Medium URL.
+ *
+ * @param string $url Medium URL.
+ */
function jetpack_embed_medium_get_embed_type( $url ) {
- $url_path = parse_url( $url, PHP_URL_PATH );
+ $url_path = wp_parse_url( $url, PHP_URL_PATH );
if ( preg_match( '/^\/@[\.\w]+$/', $url_path ) ) {
return 'profile';
- } elseif ( preg_match( '/^\/[\da-zA-Z-]+$/', $url_path ) ) {
+ } elseif ( preg_match( '/^\/(?:s)\/(.+)$/', $url_path ) ) {
return 'collection';
}
return 'story';
}
+/**
+ * Process Medium shortcode attributes.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function jetpack_embed_medium_args( $atts ) {
return shortcode_atts(
array(
diff --git a/plugins/jetpack/modules/shortcodes/mixcloud.php b/plugins/jetpack/modules/shortcodes/mixcloud.php
index 3580a924..4a016d5f 100644
--- a/plugins/jetpack/modules/shortcodes/mixcloud.php
+++ b/plugins/jetpack/modules/shortcodes/mixcloud.php
@@ -1,8 +1,8 @@
<?php
-/*
+/**
* Mixcloud embeds
*
- * examples:
+ * Examples:
* [mixcloud MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ /]
* [mixcloud MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ width=640 height=480 /]
* [mixcloud http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ /]
@@ -10,21 +10,29 @@
* [mixcloud]http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/[/mixcloud]
* [mixcloud]MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/[/mixcloud]
* [mixcloud http://www.mixcloud.com/mat/playlists/classics/ width=660 height=208 hide_cover=1 hide_tracklist=1]
-*/
+ *
+ * @package Jetpack
+ */
-// Register oEmbed provider
-// Example URL: http://www.mixcloud.com/oembed/?url=http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/
+/*
+ * Register oEmbed provider
+ * Example URL: http://www.mixcloud.com/oembed/?url=http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/
+ */
wp_oembed_add_provider( '#https?://(?:www\.)?mixcloud\.com/\S*#i', 'https://www.mixcloud.com/oembed', true );
-// Register mixcloud shortcode
-add_shortcode( 'mixcloud', 'mixcloud_shortcode' );
+/**
+ * Register mixcloud shortcode.
+ *
+ * @param array $atts Shortcode atttributes.
+ * @param string $content Post content.
+ */
function mixcloud_shortcode( $atts, $content = null ) {
if ( empty( $atts[0] ) && empty( $content ) ) {
return '<!-- mixcloud error: invalid mixcloud resource -->';
}
- $regular_expression = '/((?<=mixcloud\\.com\\/)[\\w-\\/]+$)|(^[\\w-\\/]+$)/i';
+ $regular_expression = '/((?<=mixcloud\.com\/)[\w\-\/]+$)|(^[\w\-\/]+$)/i';
preg_match( $regular_expression, $content, $match );
if ( ! empty( $match ) ) {
$resource_id = trim( $match[0] );
@@ -57,7 +65,7 @@ function mixcloud_shortcode( $atts, $content = null ) {
$atts
);
- // remove falsey values
+ // remove falsey values.
$atts = array_filter( $atts );
$query_args = array( 'url' => $mixcloud_url );
@@ -73,3 +81,4 @@ function mixcloud_shortcode( $atts, $content = null ) {
return $response_body->html;
}
+add_shortcode( 'mixcloud', 'mixcloud_shortcode' );
diff --git a/plugins/jetpack/modules/shortcodes/pinterest.php b/plugins/jetpack/modules/shortcodes/pinterest.php
index caecc619..11e467f0 100644
--- a/plugins/jetpack/modules/shortcodes/pinterest.php
+++ b/plugins/jetpack/modules/shortcodes/pinterest.php
@@ -3,10 +3,13 @@
* Pinterest embeds
*
* Based on "Board Widget" example here: http://business.pinterest.com/widget-builder/#code
+ *
+ * Example URL: https://pinterest.com/pin/129056345550241149/
+ * Second Example URL: https://uk.pinterest.com/annsawesomepins/travel/
+ *
+ * @package Jetpack
*/
-// Example URL: http://pinterest.com/pinterest/pin-pets/
-// Second Example URL: https://uk.pinterest.com/annsawesomepins/travel/
wp_embed_register_handler(
'pinterest',
'#'
@@ -20,12 +23,20 @@ wp_embed_register_handler(
'pinterest_embed_handler'
);
+/**
+ * Callback to modify output of embedded Pinterest posts.
+ *
+ * @param array $matches Regex partial matches against the URL passed.
+ * @param array $attr Attributes received in embed response.
+ * @param array $url Requested URL to be embedded.
+ */
function pinterest_embed_handler( $matches, $attr, $url ) {
- // Pinterest's JS handles making the embed
+ // Pinterest's JS handles making the embed.
$script_src = '//assets.pinterest.com/js/pinit.js';
- wp_enqueue_script( 'pinterest-embed', $script_src, array(), false, true );
- $path = parse_url( $url, PHP_URL_PATH );
+ wp_enqueue_script( 'pinterest-embed', $script_src, array(), JETPACK__VERSION, true );
+
+ $path = wp_parse_url( $url, PHP_URL_PATH );
if ( 0 === strpos( $path, '/pin/' ) ) {
$embed_type = 'embedPin';
} elseif ( preg_match( '#^/([^/]+)/?$#', $path ) ) {
@@ -41,9 +52,12 @@ function pinterest_embed_handler( $matches, $attr, $url ) {
$return = sprintf( '<a data-pin-do="%s" href="%s"></a>', esc_attr( $embed_type ), esc_url( $url ) );
- // If we're generating an embed view for the WordPress Admin via ajax...
+ // If we're generating an embed view for the WordPress Admin via ajax.
if ( doing_action( 'wp_ajax_parse-embed' ) ) {
- $return .= sprintf( '<script src="%s"></script>', esc_url( $script_src ) );
+ $return .= sprintf(
+ '<script src="%s"></script>', // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedScript
+ esc_url( $script_src )
+ );
}
return $return;
diff --git a/plugins/jetpack/modules/shortcodes/polldaddy.php b/plugins/jetpack/modules/shortcodes/polldaddy.php
deleted file mode 100644
index 10a62d65..00000000
--- a/plugins/jetpack/modules/shortcodes/polldaddy.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-/**
- * Deprecated alias for Crowdsignal.
- */
diff --git a/plugins/jetpack/modules/shortcodes/presentations.php b/plugins/jetpack/modules/shortcodes/presentations.php
index 77089189..8914b874 100644
--- a/plugins/jetpack/modules/shortcodes/presentations.php
+++ b/plugins/jetpack/modules/shortcodes/presentations.php
@@ -1,29 +1,48 @@
-<?php
-/*
-Plugin Name: Presentations
-Plugin URI: http://automattic.com/wordpress-plugins/
-Description: Presentations plugin based on the work done by <a href="http://darylkoop.com/">Daryl Koopersmith</a>. Powered by jmpress.js
-Version: 0.2
-Author: Automattic
-Author URI: http://automattic.com/wordpress-plugins/
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
+<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+use Automattic\Jetpack\Assets;
/**
+ * Presentations
+ * Presentations plugin based on the work done by <a href="http://darylkoop.com/">Daryl Koopersmith</a>. Powered by jmpress.js
+ *
+ * HOW TO: How the plugin settings are organized and which features are supported.
+ *
+ * The entire presentation should be wrapped with a [presentation] shortcode, and every
+ * individual slide should be wrapped with a [slide] shortcode. Any settings supported
+ * by [slide] can be set into [presentation], which will apply that setting for the entire
+ * presentation unless overridden by individual slides.
+ *
+ * - [presentation] only settings:
+ * - duration: transition durations, default is one second.
+ * - height: content height, default is 400px
+ * - width: content width, default is 550px
+ * - autoplay: delay between transitions in seconds, default 3s
+ * when set the presentation will automatically transition between slides
+ * as long as the presentation remains in focus
+ *
+ * - [slide] settings:
+ * - transition: specifies where the next slide will be placed relative
+ * to the last one before it. Supported values are "up", "down"
+ * "left", "right", or "none". Default value is "down".
+ *
+ * - scale: scales the content relative to other slides, default value is one
+ *
+ * - rotate: rotates the content by the specified degrees, default is zero
+ *
+ * - fade: slides will fade in and out during transition. Values of "on" or
+ * "true" will enable fading, while values of "no" or "false" will
+ * disable it. Default value is "on"
+ *
+ * - bgcolor: specifies a background color for the slides. Any CSS valid value
+ * is permitted. Default color is transparent.
+ *
+ * - bgimg: specifies an image url which will fill the background. Image is
+ * set to fill the background 100% width and height
+ *
+ * - fadebullets: any html <li> tags will start out with an opacity of 0 and any
+ * subsequent slide transitions will show the bullets one by one
+ *
* Known issues:
*
* - IE 7/8 are not supported by jmpress and presentations will not work
@@ -33,70 +52,53 @@ Author URI: http://automattic.com/wordpress-plugins/
* happens to be on the first loaded page. The permalink page will function
* properly, however.
* - Exiting fullscreen mode will not properly reset the scroll locations in Safari
+ *
+ * @package Jetpack
*/
-
-/*
-HOW TO: How the plugin settings are organized and which features are supported.
-
-The entire presentation should be wrapped with a [presentation] shortcode, and every
-individual slide should be wrapped with a [slide] shortcode. Any settings supported
-by [slide] can be set into [presentation], which will apply that setting for the entire
-presentation unless overridden by individual slides.
-
-- [presentation] only settings:
- - duration: transition durations, default is one second.
- - height: content height, default is 400px
- - width: content width, default is 550px
- - autoplay: delay between transitions in seconds, default 3s
- when set the presentation will automatically transition between slides
- as long as the presentation remains in focus
-
-- [slide] settings:
- - transition: specifies where the next slide will be placed relative
- to the last one before it. Supported values are "up", "down"
- "left", "right", or "none". Default value is "down".
-
- - scale: scales the content relative to other slides, default value is one
-
- - rotate: rotates the content by the specified degrees, default is zero
-
- - fade: slides will fade in and out during transition. Values of "on" or
- "true" will enable fading, while values of "no" or "false" will
- disable it. Default value is "on"
-
- - bgcolor: specifies a background color for the slides. Any CSS valid value
- is permitted. Default color is transparent.
-
- - bgimg: specifies an image url which will fill the background. Image is
- set to fill the background 100% width and height
-
- - fadebullets: any html <li> tags will start out with an opacity of 0 and any
- subsequent slide transitions will show the bullets one by one
-*/
-
if ( ! class_exists( 'Presentations' ) ) :
+ /**
+ * Create a shortcode to display Presentations and slides.
+ */
class Presentations {
+ /**
+ * Presentation settings.
+ *
+ * @var array
+ */
private $presentation_settings;
+ /**
+ * Do we have a Presentation shortcode to be displayed.
+ *
+ * @var bool
+ */
private $presentation_initialized;
+ /**
+ * Were scripts and styles enqueued already.
+ *
+ * @var bool
+ */
private $scripts_and_style_included;
/**
* Constructor
*/
- function __construct() {
+ public function __construct() {
$this->presentation_initialized = false;
$this->scripts_and_style_included = false;
- // Registers shortcodes
+ // Registers shortcodes.
add_action( 'wp_head', array( &$this, 'add_scripts' ), 1 );
add_shortcode( 'presentation', array( &$this, 'presentation_shortcode' ) );
add_shortcode( 'slide', array( &$this, 'slide_shortcode' ) );
}
- function add_scripts() {
+ /**
+ * Enqueue all scripts and styles.
+ */
+ public function add_scripts() {
$this->scripts_and_style_included = false;
if ( empty( $GLOBALS['posts'] ) || ! is_array( $GLOBALS['posts'] ) ) {
@@ -115,28 +117,34 @@ if ( ! class_exists( 'Presentations' ) ) :
}
$plugin = plugin_dir_url( __FILE__ );
- // Add CSS
- wp_enqueue_style( 'presentations', $plugin . 'css/style.css' );
- // Add JavaScript
+ // Add CSS.
+ wp_enqueue_style( 'presentations', $plugin . 'css/style.css', array(), JETPACK__VERSION );
+ // Add JavaScript.
wp_enqueue_script( 'jquery' );
wp_enqueue_script(
'jmpress',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/jmpress.min.js', 'modules/shortcodes/js/jmpress.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/jmpress.min.js', 'modules/shortcodes/js/jmpress.js' ),
array( 'jquery' ),
- '0.4.5',
+ JETPACK__VERSION,
true
);
wp_enqueue_script(
'presentations',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/main.min.js', 'modules/shortcodes/js/main.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/main.min.js', 'modules/shortcodes/js/main.js' ),
array( 'jquery', 'jmpress' ),
- false,
+ JETPACK__VERSION,
true
);
}
- function presentation_shortcode( $atts, $content = '' ) {
- // Mark that we've found a valid [presentation] shortcode
+ /**
+ * Main Presentation shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @param string $content Post content.
+ */
+ public function presentation_shortcode( $atts, $content = '' ) {
+ // Mark that we've found a valid [presentation] shortcode.
$this->presentation_initialized = true;
$atts = shortcode_atts(
@@ -148,7 +156,7 @@ if ( ! class_exists( 'Presentations' ) ) :
'bgimg' => '',
'autoplay' => '',
- // Settings
+ // Settings.
'transition' => '',
'scale' => '',
'rotate' => '',
@@ -173,73 +181,75 @@ if ( ! class_exists( 'Presentations' ) ) :
),
);
- // Set the presentation-wide settings
- if ( '' != trim( $atts['transition'] ) ) {
+ // Set the presentation-wide settings.
+ if ( '' !== trim( $atts['transition'] ) ) {
$this->presentation_settings['transition'] = $atts['transition'];
}
- if ( '' != trim( $atts['scale'] ) ) {
+ if ( '' !== trim( $atts['scale'] ) ) {
$this->presentation_settings['scale'] = floatval( $atts['scale'] );
}
- if ( '' != trim( $atts['rotate'] ) ) {
+ if ( '' !== trim( $atts['rotate'] ) ) {
$this->presentation_settings['rotate'] = floatval( $atts['rotate'] );
}
- if ( '' != trim( $atts['fade'] ) ) {
+ if ( '' !== trim( $atts['fade'] ) ) {
$this->presentation_settings['fade'] = $atts['fade'];
}
- if ( '' != trim( $atts['fadebullets'] ) ) {
+ if ( '' !== trim( $atts['fadebullets'] ) ) {
$this->presentation_settings['fadebullets'] = $atts['fadebullets'];
}
- // Set any settings the slides don't care about
- if ( '' != trim( $atts['duration'] ) ) {
+ // Set any settings the slides don't care about.
+ if ( '' !== trim( $atts['duration'] ) ) {
$duration = floatval( $atts['duration'] ) . 's';
} else {
$duration = '1s';
}
- // Autoplay durations are set in milliseconds
- if ( '' != trim( $atts['autoplay'] ) ) {
+ // Autoplay durations are set in milliseconds.
+ if ( '' !== trim( $atts['autoplay'] ) ) {
$autoplay = floatval( $atts['autoplay'] ) * 1000;
} else {
$autoplay = 0;
} // No autoplay
- // Set the presentation size as specified or with some nicely sized dimensions
- if ( '' != trim( $atts['width'] ) ) {
+ // Set the presentation size as specified or with some nicely sized dimensions.
+ if ( '' !== trim( $atts['width'] ) ) {
$this->presentation_settings['width'] = intval( $atts['width'] );
} else {
$this->presentation_settings['width'] = 480;
}
- if ( '' != trim( $atts['height'] ) ) {
+ if ( '' !== trim( $atts['height'] ) ) {
$this->presentation_settings['height'] = intval( $atts['height'] );
} else {
$this->presentation_settings['height'] = 370;
}
- // Hide the content by default in case the scripts fail
+ // Hide the content by default in case the scripts fail.
$style = 'display: none; width: ' . $this->presentation_settings['width'] . 'px; height: ' . $this->presentation_settings['height'] . 'px;';
- // Check for background color XOR background image
- // Use a white background if nothing specified
+ /*
+ * Check for background color XOR background image
+ * Use a white background if nothing specified
+ */
if ( preg_match( '/https?\:\/\/[^\'"\s]*/', $atts['bgimg'], $matches ) ) {
$style .= ' background-image: url("' . esc_url( $matches[0] ) . '");';
- } elseif ( '' != trim( $atts['bgcolor'] ) ) {
+ } elseif ( '' !== trim( $atts['bgcolor'] ) ) {
$style .= ' background-color: ' . esc_attr( $atts['bgcolor'] ) . ';';
} else {
$style .= ' background-color: #fff;';
}
- // Not supported message style is inlined incase the style sheet doesn't get included
+ // Not supported message style is inlined incase the style sheet doesn't get included.
$out = "<section class='presentation-wrapper'>";
$out .= "<p class='not-supported-msg' style='display: inherit; padding: 25%; text-align: center;'>";
$out .= __( 'This slideshow could not be started. Try refreshing the page or viewing it in another browser.', 'jetpack' ) . '</p>';
- // Bail out unless the scripts were added
+ // Bail out unless the scripts were added.
if ( $this->scripts_and_style_included ) {
$out .= sprintf(
'<div class="presentation" duration="%s" data-autoplay="%s" style="%s">',
@@ -267,8 +277,14 @@ if ( ! class_exists( 'Presentations' ) ) :
return $out;
}
- function slide_shortcode( $atts, $content = '' ) {
- // Bail out unless wrapped by a [presentation] shortcode
+ /**
+ * Slide shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ * @param string $content Post content.
+ */
+ public function slide_shortcode( $atts, $content = '' ) {
+ // Bail out unless wrapped by a [presentation] shortcode.
if ( ! $this->presentation_initialized ) {
return $content;
}
@@ -287,17 +303,17 @@ if ( ! class_exists( 'Presentations' ) ) :
'slide'
);
- // Determine positioning based on transition
- if ( '' == trim( $atts['transition'] ) ) {
+ // Determine positioning based on transition.
+ if ( '' === trim( $atts['transition'] ) ) {
$atts['transition'] = $this->presentation_settings['transition'];
}
- // Setting the content scale
- if ( '' == trim( $atts['scale'] ) ) {
+ // Setting the content scale.
+ if ( '' === trim( $atts['scale'] ) ) {
$atts['scale'] = $this->presentation_settings['scale'];
}
- if ( '' == trim( $atts['scale'] ) ) {
+ if ( '' === trim( $atts['scale'] ) ) {
$scale = 1;
} else {
$scale = floatval( $atts['scale'] );
@@ -307,34 +323,34 @@ if ( ! class_exists( 'Presentations' ) ) :
$scale *= -1;
}
- // Setting the content rotation
- if ( '' == trim( $atts['rotate'] ) ) {
+ // Setting the content rotation.
+ if ( '' === trim( $atts['rotate'] ) ) {
$atts['rotate'] = $this->presentation_settings['rotate'];
}
- if ( '' == trim( $atts['rotate'] ) ) {
+ if ( '' === trim( $atts['rotate'] ) ) {
$rotate = 0;
} else {
$rotate = floatval( $atts['rotate'] );
}
- // Setting if the content should fade
- if ( '' == trim( $atts['fade'] ) ) {
+ // Setting if the content should fade.
+ if ( '' === trim( $atts['fade'] ) ) {
$atts['fade'] = $this->presentation_settings['fade'];
}
- if ( 'on' == $atts['fade'] || 'true' == $atts['fade'] ) {
+ if ( 'on' === $atts['fade'] || 'true' === $atts['fade'] ) {
$fade = 'fade';
} else {
$fade = '';
}
- // Setting if bullets should fade on step changes
- if ( '' == trim( $atts['fadebullets'] ) ) {
+ // Setting if bullets should fade on step changes.
+ if ( '' === trim( $atts['fadebullets'] ) ) {
$atts['fadebullets'] = $this->presentation_settings['fadebullets'];
}
- if ( 'on' == $atts['fadebullets'] || 'true' == $atts['fadebullets'] ) {
+ if ( 'on' === $atts['fadebullets'] || 'true' === $atts['fadebullets'] ) {
$fadebullets = 'fadebullets';
} else {
$fadebullets = '';
@@ -351,11 +367,13 @@ if ( ! class_exists( 'Presentations' ) ) :
$x = $coords['x'];
$y = $coords['y'];
- // Check for background color XOR background image
- // Use a white background if nothing specified
+ /*
+ * Check for background color XOR background image
+ * Use a white background if nothing specified
+ */
if ( preg_match( '/https?\:\/\/[^\'"\s]*/', $atts['bgimg'], $matches ) ) {
$style = 'background-image: url("' . esc_url( $matches[0] ) . '");';
- } elseif ( '' != trim( $atts['bgcolor'] ) ) {
+ } elseif ( '' !== trim( $atts['bgcolor'] ) ) {
$style = 'background-color: ' . esc_attr( $atts['bgcolor'] ) . ';';
} else {
$style = '';
@@ -383,14 +401,17 @@ if ( ! class_exists( 'Presentations' ) ) :
/**
* Determines the position of the next slide based on the position and scaling of the previous slide.
*
- * @param array $args : an array with the following key-value pairs
- * string $transition: the transition name, "up", "down", "left", or "right"
- * float $scale: the scale of the next slide (used to determine the position of the slide after that)
+ * @param array $args {
+ * Array of key-value pairs.
+ *
+ * @type string $transition: the transition name, "up", "down", "left", or "right".
+ * @type float $scale: the scale of the next slide (used to determine the position of the slide after that).
+ * }
*
- * @return array with the 'x' and 'y' coordinates of the slide
+ * @return array with the 'x' and 'y' coordinates of the slide.
*/
- function get_coords( $args ) {
- if ( 0 == $args['scale'] ) {
+ private function get_coords( $args ) {
+ if ( 0 === $args['scale'] ) {
$args['scale'] = 1;
}
@@ -407,30 +428,36 @@ if ( ! class_exists( 'Presentations' ) ) :
);
// All angles are measured from the vertical axis, so everything is backwards!
- $diagAngle = atan2( $width, $height );
- $diagonal = sqrt( pow( $width, 2 ) + pow( $height, 2 ) );
-
- // We offset the angles by the angle formed by the diagonal so that
- // we can multiply the sines directly against the diagonal length
- $theta = deg2rad( $last['rotate'] ) - $diagAngle;
- $phi = deg2rad( $next['rotate'] ) - $diagAngle;
-
- // We start by displacing by the slide dimensions
- $totalHorizDisp = $width * $scale;
- $totalVertDisp = $height * $scale;
-
- // If the previous slide was rotated, we add the incremental offset from the rotation
- // Namely the difference between the regular dimension (no rotation) and the component
- // of the diagonal for that angle
- $totalHorizDisp += ( ( ( abs( sin( $theta ) ) * $diagonal ) - $width ) / 2 ) * $scale;
- $totalVertDisp += ( ( ( abs( cos( $theta ) ) * $diagonal ) - $height ) / 2 ) * $scale;
-
- // Similarly, we check if the current slide has been rotated and add whatever additional
- // offset has been added. This is so that two rotated corners don't clash with each other.
- // Note: we are checking the raw angle relative to the vertical axis, NOT the diagonal angle.
+ $diag_angle = atan2( $width, $height );
+ $diagonal = sqrt( pow( $width, 2 ) + pow( $height, 2 ) );
+
+ /*
+ * We offset the angles by the angle formed by the diagonal so that
+ * we can multiply the sines directly against the diagonal length
+ */
+ $theta = deg2rad( $last['rotate'] ) - $diag_angle;
+ $phi = deg2rad( $next['rotate'] ) - $diag_angle;
+
+ // We start by displacing by the slide dimensions.
+ $total_horiz_disp = $width * $scale;
+ $total_vert_disp = $height * $scale;
+
+ /*
+ * If the previous slide was rotated, we add the incremental offset from the rotation
+ * Namely the difference between the regular dimension (no rotation) and the component
+ * of the diagonal for that angle
+ */
+ $total_horiz_disp += ( ( ( abs( sin( $theta ) ) * $diagonal ) - $width ) / 2 ) * $scale;
+ $total_vert_disp += ( ( ( abs( cos( $theta ) ) * $diagonal ) - $height ) / 2 ) * $scale;
+
+ /*
+ * Similarly, we check if the current slide has been rotated and add whatever additional
+ * offset has been added. This is so that two rotated corners don't clash with each other.
+ * Note: we are checking the raw angle relative to the vertical axis, NOT the diagonal angle.
+ */
if ( 0 !== $next['rotate'] % 180 ) {
- $totalHorizDisp += ( abs( ( sin( $phi ) * $diagonal ) - $width ) / 2 ) * $next['scale'];
- $totalVertDisp += ( abs( ( cos( $phi ) * $diagonal ) - $height ) / 2 ) * $next['scale'];
+ $total_horiz_disp += ( abs( ( sin( $phi ) * $diagonal ) - $width ) / 2 ) * $next['scale'];
+ $total_vert_disp += ( abs( ( cos( $phi ) * $diagonal ) - $height ) / 2 ) * $next['scale'];
}
switch ( trim( $args['transition'] ) ) {
@@ -438,20 +465,20 @@ if ( ! class_exists( 'Presentations' ) ) :
break;
case 'left':
- $next['x'] -= $totalHorizDisp;
+ $next['x'] -= $total_horiz_disp;
break;
case 'right':
- $next['x'] += $totalHorizDisp;
+ $next['x'] += $total_horiz_disp;
break;
case 'up':
- $next['y'] -= $totalVertDisp;
+ $next['y'] -= $total_vert_disp;
break;
case 'down':
default:
- $next['y'] += $totalVertDisp;
+ $next['y'] += $total_vert_disp;
break;
}
diff --git a/plugins/jetpack/modules/shortcodes/quiz.php b/plugins/jetpack/modules/shortcodes/quiz.php
index fa4ed960..e9275a67 100644
--- a/plugins/jetpack/modules/shortcodes/quiz.php
+++ b/plugins/jetpack/modules/shortcodes/quiz.php
@@ -1,4 +1,7 @@
<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileNam
+
+use Automattic\Jetpack\Assets;
+
/**
* Quiz shortcode.
*
@@ -81,7 +84,7 @@ class Quiz_Shortcode {
wp_enqueue_style( 'quiz', plugins_url( 'css/quiz.css', __FILE__ ), array(), JETPACK__VERSION );
wp_enqueue_script(
'quiz',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/quiz.min.js', 'modules/shortcodes/js/quiz.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/quiz.min.js', 'modules/shortcodes/js/quiz.js' ),
array( 'jquery' ),
JETPACK__VERSION,
true
diff --git a/plugins/jetpack/modules/shortcodes/recipe.php b/plugins/jetpack/modules/shortcodes/recipe.php
index 7846b154..983f01ee 100644
--- a/plugins/jetpack/modules/shortcodes/recipe.php
+++ b/plugins/jetpack/modules/shortcodes/recipe.php
@@ -1,4 +1,6 @@
-<?php
+<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+
+use Automattic\Jetpack\Assets;
/**
* Embed recipe 'cards' in post, with basic styling and print functionality
@@ -8,80 +10,63 @@
* - basic styles/themecolor styles
* - validation/sanitization
* - print styles
+ *
+ * @package Jetpack
*/
-class Jetpack_Recipes {
-
- private $scripts_and_style_included = false;
-
- function __construct() {
- add_action( 'init', array( $this, 'action_init' ) );
- add_filter( 'wp_kses_allowed_html', array( $this, 'add_recipes_kses_rules' ), 10, 2 );
- }
+/**
+ * Register and display Recipes in posts.
+ */
+class Jetpack_Recipes {
/**
- * Add Schema-specific attributes to our allowed tags in wp_kses,
- * so we can have better Schema.org compliance.
+ * Have scripts and styles been enqueued already.
*
- * @param array $allowedtags Array of allowed HTML tags in recipes.
- * @param array $context Context to judge allowed tags by.
+ * @var bool
*/
- function add_recipes_kses_rules( $allowedtags, $context ) {
- if ( in_array( $context, array( '', 'post', 'data' ) ) ) :
- // Create an array of all the tags we'd like to add the itemprop attribute to.
- $tags = array( 'li', 'ol', 'ul', 'img', 'p', 'h3', 'time' );
- foreach ( $tags as $tag ) {
- $allowedtags = $this->add_kses_rule(
- $allowedtags,
- $tag,
- array(
- 'class' => array(),
- 'itemprop' => array(),
- 'datetime' => array(),
- )
- );
- }
-
- // Allow itemscope and itemtype for divs.
- $allowedtags = $this->add_kses_rule(
- $allowedtags,
- 'div',
- array(
- 'class' => array(),
- 'itemscope' => array(),
- 'itemtype' => array(),
- )
- );
- endif;
+ private $scripts_and_style_included = false;
- return $allowedtags;
+ /**
+ * Constructor
+ */
+ public function __construct() {
+ add_action( 'init', array( $this, 'action_init' ) );
}
/**
- * Function to add a new property rule to our kses array.
- * Used by add_recipe_kses_rules() above.
+ * Returns KSES tags with Schema-specific attributes.
*
- * @param array $all_tags Array of allowed HTML tags in recipes.
- * @param string $tag New HTML tag to add to the array of allowed HTML.
- * @param array $rules Array of allowed attributes for that HTML tag.
+ * @since 8.0.0
+ *
+ * @return array Array to be used by KSES.
*/
- private function add_kses_rule( $all_tags, $tag, $rules ) {
-
- // If the tag doesn't already exist, add it.
- if ( ! isset( $all_tags[ $tag ] ) ) {
- $all_tags[ $tag ] = array();
+ private static function kses_tags() {
+ $allowedtags = wp_kses_allowed_html( 'post' );
+ // Create an array of all the tags we'd like to add the itemprop attribute to.
+ $tags = array( 'li', 'ol', 'ul', 'img', 'p', 'h3', 'time', 'span' );
+ foreach ( $tags as $tag ) {
+ if ( ! isset( $allowedtags[ $tag ] ) ) {
+ $allowedtags[ $tag ] = array();
+ }
+ $allowedtags[ $tag ]['class'] = array();
+ $allowedtags[ $tag ]['itemprop'] = array();
+ $allowedtags[ $tag ]['datetime'] = array();
}
- // Merge the new tags with existing tags.
- $all_tags[ $tag ] = array_merge( $all_tags[ $tag ], $rules );
-
- return $all_tags;
+ // Allow itemscope and itemtype for divs.
+ if ( ! isset( $allowedtags['div'] ) ) {
+ $allowedtags['div'] = array();
+ }
+ $allowedtags['div']['class'] = array();
+ $allowedtags['div']['itemscope'] = array();
+ $allowedtags['div']['itemtype'] = array();
+ return $allowedtags;
}
/**
* Register our shortcode and enqueue necessary files.
*/
- function action_init() {
+ public function action_init() {
// Enqueue styles if [recipe] exists.
add_action( 'wp_head', array( $this, 'add_scripts' ), 1 );
@@ -90,12 +75,14 @@ class Jetpack_Recipes {
add_shortcode( 'recipe-notes', array( $this, 'recipe_notes_shortcode' ) );
add_shortcode( 'recipe-ingredients', array( $this, 'recipe_ingredients_shortcode' ) );
add_shortcode( 'recipe-directions', array( $this, 'recipe_directions_shortcode' ) );
+ add_shortcode( 'recipe-nutrition', array( $this, 'recipe_nutrition_shortcode' ) );
+ add_shortcode( 'recipe-image', array( $this, 'recipe_image_shortcode' ) );
}
/**
* Enqueue scripts and styles
*/
- function add_scripts() {
+ public function add_scripts() {
if ( empty( $GLOBALS['posts'] ) || ! is_array( $GLOBALS['posts'] ) ) {
return;
}
@@ -116,19 +103,20 @@ class Jetpack_Recipes {
// add $themecolors-defined styles.
wp_add_inline_style( 'jetpack-recipes-style', self::themecolor_styles() );
-
wp_enqueue_script(
'jetpack-recipes-printthis',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes-printthis.min.js', 'modules/shortcodes/js/recipes-printthis.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes-printthis.min.js', 'modules/shortcodes/js/recipes-printthis.js' ),
array( 'jquery' ),
- '20170202'
+ '20170202',
+ false
);
wp_enqueue_script(
'jetpack-recipes-js',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes.min.js', 'modules/shortcodes/js/recipes.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes.min.js', 'modules/shortcodes/js/recipes.js' ),
array( 'jquery', 'jetpack-recipes-printthis' ),
- '20131230'
+ '20131230',
+ false
);
$title_var = wp_title( '|', false, 'right' );
@@ -154,18 +142,21 @@ class Jetpack_Recipes {
*
* @return string HTML for recipe shortcode.
*/
- static function recipe_shortcode( $atts, $content = '' ) {
+ public static function recipe_shortcode( $atts, $content = '' ) {
$atts = shortcode_atts(
array(
'title' => '', // string.
'servings' => '', // intval.
- 'time' => '', // string.
+ 'time' => '', // strtotime-compatible time description.
'difficulty' => '', // string.
- 'print' => '', // string.
+ 'print' => '', // URL for external print version.
'source' => '', // string.
- 'sourceurl' => '', // string.
- 'image' => '', // string.
+ 'sourceurl' => '', // URL string. Only used if source set.
+ 'image' => '', // URL or attachment ID.
'description' => '', // string.
+ 'cooktime' => '', // strtotime-compatible time description.
+ 'preptime' => '', // strtotime-compatible time description.
+ 'rating' => '', // string.
),
$atts,
'recipe'
@@ -182,43 +173,41 @@ class Jetpack_Recipes {
*
* @return string HTML output
*/
- static function recipe_shortcode_html( $atts, $content = '' ) {
+ private static function recipe_shortcode_html( $atts, $content = '' ) {
- $html = '<div class="hrecipe jetpack-recipe" itemscope itemtype="https://schema.org/Recipe">';
+ $html = '<div class="hrecipe h-recipe jetpack-recipe" itemscope itemtype="https://schema.org/Recipe">';
// Print the recipe title if exists.
if ( '' !== $atts['title'] ) {
- $html .= '<h3 class="jetpack-recipe-title" itemprop="name">' . esc_html( $atts['title'] ) . '</h3>';
+ $html .= '<h3 class="p-name jetpack-recipe-title fn" itemprop="name">' . esc_html( $atts['title'] ) . '</h3>';
}
// Print the recipe meta if exists.
- if ( '' !== $atts['servings'] || '' != $atts['time'] || '' != $atts['difficulty'] || '' != $atts['print'] ) {
+ if (
+ '' !== $atts['servings']
+ || '' !== $atts['time']
+ || '' !== $atts['difficulty']
+ || '' !== $atts['print']
+ || '' !== $atts['preptime']
+ || '' !== $atts['cooktime']
+ || '' !== $atts['rating']
+ ) {
$html .= '<ul class="jetpack-recipe-meta">';
if ( '' !== $atts['servings'] ) {
$html .= sprintf(
- '<li class="jetpack-recipe-servings" itemprop="recipeYield"><strong>%1$s: </strong>%2$s</li>',
+ '<li class="jetpack-recipe-servings p-yield yield" itemprop="recipeYield"><strong>%1$s: </strong>%2$s</li>',
esc_html_x( 'Servings', 'recipe', 'jetpack' ),
esc_html( $atts['servings'] )
);
}
- if ( '' !== $atts['time'] ) {
- // Get a time that's supported by Schema.org.
- $duration = WPCOM_JSON_API_Date::format_duration( $atts['time'] );
- // If no duration can be calculated, let's output what the user provided.
- if ( empty( $duration ) ) {
- $duration = $atts['time'];
+ $time_types = array( 'cooktime', 'preptime', 'time' );
+ foreach ( $time_types as $time_type ) {
+ if ( '' === $atts[ $time_type ] ) {
+ continue;
}
-
- $html .= sprintf(
- '<li class="jetpack-recipe-time">
- <time itemprop="totalTime" datetime="%3$s"><strong>%1$s: </strong>%2$s</time>
- </li>',
- esc_html_x( 'Time', 'recipe', 'jetpack' ),
- esc_html( $atts['time'] ),
- esc_attr( $duration )
- );
+ $html .= self::output_time( $atts[ $time_type ], $time_type );
}
if ( '' !== $atts['difficulty'] ) {
@@ -229,6 +218,17 @@ class Jetpack_Recipes {
);
}
+ if ( '' !== $atts['rating'] ) {
+ $html .= sprintf(
+ '<li class="jetpack-recipe-rating">
+ <strong>%1$s: </strong>
+ <span itemprop="contentRating">%2$s</span>
+ </li>',
+ esc_html_x( 'Rating', 'recipe', 'jetpack' ),
+ esc_html( $atts['rating'] )
+ );
+ }
+
if ( '' !== $atts['source'] ) {
$html .= sprintf(
'<li class="jetpack-recipe-source"><strong>%1$s: </strong>',
@@ -261,14 +261,13 @@ class Jetpack_Recipes {
}
$html .= '</ul>';
- } // End if().
+ }
- // Output the image, if we have one.
+ // Output the image if we have one and it's not shown elsewhere.
if ( '' !== $atts['image'] ) {
- $html .= sprintf(
- '<img class="jetpack-recipe-image" itemprop="image" src="%1$s" />',
- esc_url( $atts['image'] )
- );
+ if ( ! has_shortcode( $content, 'recipe-image' ) ) {
+ $html .= self::output_image_html( $atts['image'] );
+ }
}
// Output the description, if we have one.
@@ -291,13 +290,37 @@ class Jetpack_Recipes {
}
// Sanitize html.
- $html = wp_kses_post( $html );
+ $html = wp_kses( $html, self::kses_tags() );
// Return the HTML block.
return $html;
}
/**
+ * Our [recipe-image] shortcode.
+ * Controls placement of image in recipe.
+ *
+ * @param array $atts Array of shortcode attributes.
+ *
+ * @return string HTML for recipe notes shortcode.
+ */
+ public static function recipe_image_shortcode( $atts ) {
+ $atts = shortcode_atts(
+ array(
+ 'image' => '', // string.
+ 0 => '', // string.
+ ),
+ $atts,
+ 'recipe-image'
+ );
+ $src = $atts['image'];
+ if ( ! empty( $atts[0] ) ) {
+ $src = $atts[0];
+ }
+ return self::output_image_html( $src );
+ }
+
+ /**
* Our [recipe-notes] shortcode.
* Outputs ingredients, styled in a div.
*
@@ -306,7 +329,7 @@ class Jetpack_Recipes {
*
* @return string HTML for recipe notes shortcode.
*/
- static function recipe_notes_shortcode( $atts, $content = '' ) {
+ public static function recipe_notes_shortcode( $atts, $content = '' ) {
$atts = shortcode_atts(
array(
'title' => '', // string.
@@ -330,7 +353,7 @@ class Jetpack_Recipes {
$html .= '</div>';
// Sanitize html.
- $html = wp_kses_post( $html );
+ $html = wp_kses( $html, self::kses_tags() );
// Return the HTML block.
return $html;
@@ -345,7 +368,7 @@ class Jetpack_Recipes {
*
* @return string HTML for recipe ingredients shortcode.
*/
- static function recipe_ingredients_shortcode( $atts, $content = '' ) {
+ public static function recipe_ingredients_shortcode( $atts, $content = '' ) {
$atts = shortcode_atts(
array(
'title' => esc_html_x( 'Ingredients', 'recipe', 'jetpack' ), // string.
@@ -367,7 +390,44 @@ class Jetpack_Recipes {
$html .= '</div>';
// Sanitize html.
- $html = wp_kses_post( $html );
+ $html = wp_kses( $html, self::kses_tags() );
+
+ // Return the HTML block.
+ return $html;
+ }
+
+ /**
+ * Our [recipe-nutrition] shortcode.
+ * Outputs notes, styled in a div.
+ *
+ * @param array $atts Array of shortcode attributes.
+ * @param string $content Post content.
+ *
+ * @return string HTML for recipe nutrition shortcode.
+ */
+ public static function recipe_nutrition_shortcode( $atts, $content = '' ) {
+ $atts = shortcode_atts(
+ array(
+ 'title' => esc_html_x( 'Nutrition', 'recipe', 'jetpack' ), // string.
+ ),
+ $atts,
+ 'recipe-nutrition'
+ );
+
+ $html = '<div class="jetpack-recipe-nutrition p-nutrition nutrition">';
+
+ // Print a title unless the user has opted to exclude it.
+ if ( 'false' !== $atts['title'] ) {
+ $html .= '<h4 class="jetpack-recipe-nutrition-title">' . esc_html( $atts['title'] ) . '</h4>';
+ }
+
+ // Format content using list functionality.
+ $html .= self::output_list_content( $content, 'nutrition' );
+
+ $html .= '</div>';
+
+ // Sanitize html.
+ $html = wp_kses( $html, self::kses_tags() );
// Return the HTML block.
return $html;
@@ -387,7 +447,7 @@ class Jetpack_Recipes {
*
* @return string content formatted as a list item
*/
- static function output_list_content( $content, $type ) {
+ private static function output_list_content( $content, $type ) {
$html = '';
switch ( $type ) {
@@ -397,10 +457,20 @@ class Jetpack_Recipes {
$listtype = 'ol';
break;
case 'ingredients':
- $list_item_replacement = '<li class="jetpack-recipe-ingredient" itemprop="recipeIngredient">${1}</li>';
+ $list_item_replacement = '<li class="jetpack-recipe-ingredient p-ingredient ingredient" itemprop="recipeIngredient">${1}</li>';
$itemprop = '';
$listtype = 'ul';
break;
+ case 'nutrition':
+ $list_item_replacement = '<li class="jetpack-recipe-nutrition">${1}</li>';
+ $itemprop = ' itemprop="nutrition"';
+ $listtype = 'ul';
+ break;
+ case 'nutrition':
+ $list_item_replacement = '<li class="jetpack-recipe-nutrition nutrition">${1}</li>';
+ $itemprop = ' itemprop="nutrition"';
+ $listtype = 'ul';
+ break;
default:
$list_item_replacement = '<li class="jetpack-recipe-notes">${1}</li>';
$itemprop = '';
@@ -464,7 +534,7 @@ class Jetpack_Recipes {
*
* @return string HTML for recipe directions shortcode.
*/
- static function recipe_directions_shortcode( $atts, $content = '' ) {
+ public static function recipe_directions_shortcode( $atts, $content = '' ) {
$atts = shortcode_atts(
array(
'title' => esc_html_x( 'Directions', 'recipe', 'jetpack' ), // string.
@@ -473,7 +543,7 @@ class Jetpack_Recipes {
'recipe-directions'
);
- $html = '<div class="jetpack-recipe-directions">';
+ $html = '<div class="jetpack-recipe-directions e-instructions">';
// Print a title unless the user has specified to exclude it.
if ( 'false' !== $atts['title'] ) {
@@ -486,19 +556,102 @@ class Jetpack_Recipes {
$html .= '</div>';
// Sanitize html.
- $html = wp_kses_post( $html );
+ $html = wp_kses( $html, self::kses_tags() );
// Return the HTML block.
return $html;
}
/**
+ * Outputs time meta tag.
+ *
+ * @param string $time_str Raw time to output.
+ * @param string $time_type Type of time to show.
+ *
+ * @return string HTML for recipe time meta.
+ */
+ private static function output_time( $time_str, $time_type ) {
+ // Get a time that's supported by Schema.org.
+ $duration = WPCOM_JSON_API_Date::format_duration( $time_str );
+ // If no duration can be calculated, let's output what the user provided.
+ if ( ! $duration ) {
+ $duration = $time_str;
+ }
+
+ switch ( $time_type ) {
+ case 'cooktime':
+ $title = _x( 'Cook Time', 'recipe', 'jetpack' );
+ $itemprop = 'cookTime';
+ break;
+ case 'preptime':
+ $title = _x( 'Prep Time', 'recipe', 'jetpack' );
+ $itemprop = 'prepTime';
+ break;
+ default:
+ $title = _x( 'Time', 'recipe', 'jetpack' );
+ $itemprop = 'totalTime';
+ break;
+ }
+
+ return sprintf(
+ '<li class="jetpack-recipe-%3$s">
+ <time itemprop="%4$s" datetime="%5$s"><strong>%1$s:</strong> <span class="%3$s">%2$s</span></time>
+ </li>',
+ esc_html( $title ),
+ esc_html( $time_str ),
+ esc_attr( $time_type ),
+ esc_attr( $itemprop ),
+ esc_attr( $duration )
+ );
+ }
+
+ /**
+ * Outputs image tag for recipe.
+ *
+ * @param string $src The image source.
+ *
+ * @return string
+ */
+ private static function output_image_html( $src ) {
+ // Exit if there is no provided source.
+ if ( ! $src ) {
+ return '';
+ }
+
+ // If it's numeric, this may be an attachment.
+ if ( is_numeric( $src ) ) {
+ return wp_get_attachment_image(
+ $src,
+ 'full',
+ false,
+ array(
+ 'class' => 'jetpack-recipe-image u-photo photo',
+ 'itemprop' => 'image',
+ )
+ );
+ }
+
+ // Check if it's an absolute or relative URL, and return if not.
+ if (
+ 0 !== strpos( $src, '/' )
+ && false === filter_var( $src, FILTER_VALIDATE_URL )
+ ) {
+ return '';
+ }
+
+ return sprintf(
+ '<img class="jetpack-recipe-image u-photo photo" itemprop="image" src="%1$s" />',
+ esc_url( $src )
+ );
+ }
+
+ /**
* Use $themecolors array to style the Recipes shortcode
*
* @print style block
* @return string $style
*/
- function themecolor_styles() {
+ public function themecolor_styles() {
global $themecolors;
$style = '';
diff --git a/plugins/jetpack/modules/shortcodes/scribd.php b/plugins/jetpack/modules/shortcodes/scribd.php
index 1810c2fa..a0101ad2 100644
--- a/plugins/jetpack/modules/shortcodes/scribd.php
+++ b/plugins/jetpack/modules/shortcodes/scribd.php
@@ -1,17 +1,22 @@
<?php
+/**
+ * Scribd Shortcode
+ *
+ * [scribd id=DOCUMENT_ID key=DOCUMENT_KEY mode=MODE]
+ * DOCUMENT_ID is an integer (also used as an object_id)
+ * DOCUMENT_KEY is an alphanumeric hash ('-' character as well)
+ * MODE can be 'list', 'book', 'slide', 'slideshow', or 'tile'
+ *
+ * [scribd id=39027960 key=key-3kaiwcjqhtipf25m8tw mode=list]
+ *
+ * @package Jetpack
+ */
-/*
- Scribd Short Code
-Author: Nick Momrik
-
-[scribd id=DOCUMENT_ID key=DOCUMENT_KEY mode=MODE]
-DOCUMENT_ID is an integer (also used as an object_id)
-DOCUMENT_KEY is an alphanumeric hash ('-' character as well)
-MODE can be 'list', 'book', 'slide', 'slideshow', or 'tile'
-
-[scribd id=39027960 key=key-3kaiwcjqhtipf25m8tw mode=list]
-*/
-
+/**
+ * Register Scribd shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function scribd_shortcode_handler( $atts ) {
$atts = shortcode_atts(
array(
@@ -29,7 +34,7 @@ function scribd_shortcode_handler( $atts ) {
if ( preg_match( '/^[A-Za-z0-9-]+$/', $atts['key'], $m ) ) {
$atts['key'] = $m[0];
- if ( ! in_array( $atts['mode'], $modes ) ) {
+ if ( ! in_array( $atts['mode'], $modes, true ) ) {
$atts['mode'] = '';
}
@@ -39,18 +44,26 @@ function scribd_shortcode_handler( $atts ) {
}
}
+/**
+ * Display the shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function scribd_shortcode_markup( $atts ) {
$markup = <<<EOD
<iframe class="scribd_iframe_embed" src="//www.scribd.com/embeds/$atts[id]/content?start_page=1&view_mode=$atts[mode]&access_key=$atts[key]" data-auto-height="true" scrolling="no" id="scribd_$atts[id]" width="100%" height="500" frameborder="0"></iframe>
-<div style="font-size:10px;text-align:center;width:100%"><a href="http://www.scribd.com/doc/$atts[id]" target="_blank">View this document on Scribd</a></div>
+<div style="font-size:10px;text-align:center;width:100%"><a href="https://www.scribd.com/doc/$atts[id]" target="_blank">View this document on Scribd</a></div>
EOD;
return $markup;
}
-
add_shortcode( 'scribd', 'scribd_shortcode_handler' );
-// Scribd supports HTTPS, so use that endpoint to get HTTPS-compatible embeds
+/**
+ * Scribd supports HTTPS, so use that endpoint to get HTTPS-compatible embeds.
+ *
+ * @param array $providers Array of oEmbed providers.
+ */
function scribd_https_oembed( $providers ) {
if ( isset( $providers['#https?://(www\.)?scribd\.com/doc/.*#i'] ) ) {
$providers['#https?://(www\.)?scribd\.com/doc/.*#i'][0] = 'https://www.scribd.com/services/oembed';
@@ -58,5 +71,4 @@ function scribd_https_oembed( $providers ) {
return $providers;
}
-
add_filter( 'oembed_providers', 'scribd_https_oembed' );
diff --git a/plugins/jetpack/modules/shortcodes/slideshare.php b/plugins/jetpack/modules/shortcodes/slideshare.php
index 898ae57e..35740287 100644
--- a/plugins/jetpack/modules/shortcodes/slideshare.php
+++ b/plugins/jetpack/modules/shortcodes/slideshare.php
@@ -1,23 +1,30 @@
<?php
/**
- * Slideshare shortcode format:
+ * Slideshare shortcode
+ *
+ * Formats:
* Old style (still compatible): [slideshare id=5342235&doc=camprock-101002163655-phpapp01&w=300&h=200]
* New style: [slideshare id=5342235&w=300&h=200&fb=0&mw=0&mh=0&sc=no]
*
* Legend:
- * id = Document ID provided by Slideshare
- * w = Width of iFrame (int)
- * h = Height of iFrame (int)
- * fb = iFrame frameborder (int)
- * mw = iFrame marginwidth (int)
- * mh = iFrame marginheight (int)
- * sc = iFrame Scrollbar (yes/no)
- * pro = Slideshare Pro (yes/no)
- * style = Inline CSS (string)
- **/
-
-add_shortcode( 'slideshare', 'slideshare_shortcode' );
+ * id = Document ID provided by Slideshare
+ * w = Width of iFrame (int)
+ * h = Height of iFrame (int)
+ * fb = iFrame frameborder (int)
+ * mw = iFrame marginwidth (int)
+ * mh = iFrame marginheight (int)
+ * sc = iFrame Scrollbar (yes/no)
+ * pro = Slideshare Pro (yes/no)
+ * style = Inline CSS (string)
+ *
+ * @package Jetpack
+ */
+/**
+ * Register and display shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function slideshare_shortcode( $atts ) {
global $content_width;
@@ -43,17 +50,19 @@ function slideshare_shortcode( $atts ) {
$arguments
);
- // check that the Slideshare ID contains letters, numbers and query strings
+ // check that the Slideshare ID contains letters, numbers and query strings.
$pattern = '/[^-_a-zA-Z0-9?=&]/';
if ( empty( $attr['id'] ) || preg_match( $pattern, $attr['id'] ) ) {
return '<!-- SlideShare error: id is missing or has illegal characters -->';
}
- // check the width/height
- $w = $attr['w'];
+ // check the width/height.
+ $w = intval( $attr['w'] );
+
+ // If no width was specified (or uses the wrong format), and if we have a $content_width, use that.
if ( empty( $w ) && ! empty( $content_width ) ) {
$w = intval( $content_width );
- } elseif ( ! ( $w = intval( $w ) ) || $w < 300 || $w > 1600 ) {
+ } elseif ( $w < 300 || $w > 1600 ) { // If width was specified, but is too small/large, set default value.
$w = 425;
} else {
$w = intval( $w );
@@ -61,33 +70,33 @@ function slideshare_shortcode( $atts ) {
$h = ceil( $w * 348 / 425 ); // Note: user-supplied height is ignored.
- if ( isset( $attr['pro'] ) && $attr['pro'] ) {
+ if ( ! empty( $attr['pro'] ) ) {
$source = 'https://www.slideshare.net/slidesharepro/' . $attr['id'];
} else {
$source = 'https://www.slideshare.net/slideshow/embed_code/' . $attr['id'];
}
- if ( isset( $rel ) ) {
- $source = add_query_arg( 'rel', intval( $rel ), $source );
+ if ( isset( $attr['rel'] ) ) {
+ $source = add_query_arg( 'rel', intval( $attr['rel'] ), $source );
}
- if ( isset( $startSlide ) ) {
- $source = add_query_arg( 'startSlide', intval( $startSlide ), $source );
+ if ( ! empty( $attr['startSlide'] ) ) {
+ $source = add_query_arg( 'startSlide', intval( $attr['startSlide'] ), $source );
}
$player = sprintf( "<iframe src='%s' width='%d' height='%d'", esc_url( $source ), $w, $h );
- // check the frameborder
+ // check the frameborder.
if ( ! empty( $attr['fb'] ) || '0' === $attr['fb'] ) {
$player .= " frameborder='" . intval( $attr['fb'] ) . "'";
}
- // check the margin width; if not empty, cast as int
+ // check the margin width; if not empty, cast as int.
if ( ! empty( $attr['mw'] ) || '0' === $attr['mw'] ) {
$player .= " marginwidth='" . intval( $attr['mw'] ) . "'";
}
- // check the margin height, if not empty, cast as int
+ // check the margin height, if not empty, cast as int.
if ( ! empty( $attr['mh'] ) || '0' === $attr['mh'] ) {
$player .= " marginheight='" . intval( $attr['mh'] ) . "'";
}
@@ -96,11 +105,11 @@ function slideshare_shortcode( $atts ) {
$player .= " style='" . esc_attr( $attr['style'] ) . "'";
}
- // check the scrollbar; cast as a lowercase string for comparison
+ // check the scrollbar; cast as a lowercase string for comparison.
if ( ! empty( $attr['sc'] ) ) {
$sc = strtolower( $attr['sc'] );
- if ( in_array( $sc, array( 'yes', 'no' ) ) ) {
+ if ( in_array( $sc, array( 'yes', 'no' ), true ) ) {
$player .= " scrolling='" . $sc . "'";
}
}
@@ -119,3 +128,4 @@ function slideshare_shortcode( $atts ) {
*/
return apply_filters( 'jetpack_slideshare_shortcode', $player, $atts );
}
+add_shortcode( 'slideshare', 'slideshare_shortcode' );
diff --git a/plugins/jetpack/modules/shortcodes/slideshow.php b/plugins/jetpack/modules/shortcodes/slideshow.php
index 43428dc8..a3b99ac1 100644
--- a/plugins/jetpack/modules/shortcodes/slideshow.php
+++ b/plugins/jetpack/modules/shortcodes/slideshow.php
@@ -1,12 +1,29 @@
-<?php
+<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+
+use Automattic\Jetpack\Assets;
+
+/**
+ * Slideshow shortcode.
+ * Adds a new "slideshow" gallery type when adding a gallery using the classic editor.
+ *
+ * @package Jetpack
+ */
/**
* Slideshow shortcode usage: [gallery type="slideshow"] or the older [slideshow]
*/
class Jetpack_Slideshow_Shortcode {
+ /**
+ * Number of slideshows on a page.
+ *
+ * @var int
+ */
public $instance_count = 0;
- function __construct() {
+ /**
+ * Constructor
+ */
+ public function __construct() {
global $shortcode_tags;
// Only if the slideshow shortcode has not already been defined.
@@ -19,31 +36,24 @@ class Jetpack_Slideshow_Shortcode {
add_filter( 'post_gallery', array( $this, 'post_gallery' ), 1002, 2 );
add_filter( 'jetpack_gallery_types', array( $this, 'add_gallery_type' ), 10 );
}
-
- /**
- * For the moment, comment out the setting for v2.8.
- * The remainder should work as it always has.
- * See: https://github.com/Automattic/jetpack/pull/85/files
- */
- // add_action( 'admin_init', array( $this, 'register_settings' ), 5 );
}
/**
* Responds to the [gallery] shortcode, but not an actual shortcode callback.
*
- * @param $value string An empty string if nothing has modified the gallery output, the output html otherwise
- * @param $attr array The shortcode attributes array
+ * @param string $value An empty string if nothing has modified the gallery output, the output html otherwise.
+ * @param array $attr The shortcode attributes array.
*
* @return string The (un)modified $value
*/
- function post_gallery( $value, $attr ) {
- // Bail if somebody else has done something
+ public function post_gallery( $value, $attr ) {
+ // Bail if somebody else has done something.
if ( ! empty( $value ) ) {
return $value;
}
- // If [gallery type="slideshow"] have it behave just like [slideshow]
- if ( ! empty( $attr['type'] ) && 'slideshow' == $attr['type'] ) {
+ // If [gallery type="slideshow"] have it behave just like [slideshow].
+ if ( ! empty( $attr['type'] ) && 'slideshow' === $attr['type'] ) {
return $this->shortcode_callback( $attr );
}
@@ -55,58 +65,22 @@ class Jetpack_Slideshow_Shortcode {
*
* @see Jetpack_Tiled_Gallery::media_ui_print_templates
*
- * @param $types array An array of types where the key is the value, and the value is the caption.
+ * @param array $types An array of types where the key is the value, and the value is the caption.
*
* @return array
*/
- function add_gallery_type( $types = array() ) {
+ public function add_gallery_type( $types = array() ) {
$types['slideshow'] = esc_html__( 'Slideshow', 'jetpack' );
return $types;
}
- function register_settings() {
- add_settings_section( 'slideshow_section', __( 'Image Gallery Slideshow', 'jetpack' ), '__return_empty_string', 'media' );
-
- add_settings_field( 'jetpack_slideshow_background_color', __( 'Background color', 'jetpack' ), array( $this, 'slideshow_background_color_callback' ), 'media', 'slideshow_section' );
-
- register_setting( 'media', 'jetpack_slideshow_background_color', array( $this, 'slideshow_background_color_sanitize' ) );
- }
-
- function slideshow_background_color_callback() {
- $options = array(
- 'black' => __( 'Black', 'jetpack' ),
- 'white' => __( 'White', 'jetpack' ),
- );
- $this->settings_select( 'jetpack_slideshow_background_color', $options );
- }
-
- function settings_select( $name, $values, $extra_text = '' ) {
- if ( empty( $name ) || empty( $values ) || ! is_array( $values ) ) {
- return;
- }
- $option = get_option( $name );
- ?>
- <fieldset>
- <select name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $name ); ?>">
- <?php foreach ( $values as $key => $value ) : ?>
- <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $option ); ?>>
- <?php echo esc_html( $value ); ?>
- </option>
- <?php endforeach; ?>
- </select>
- <?php if ( ! empty( $extra_text ) ) : ?>
- <p class="description"><?php echo esc_html( $extra_text ); ?></p>
- <?php endif; ?>
- </fieldset>
- <?php
- }
-
- function slideshow_background_color_sanitize( $value ) {
- return ( 'white' == $value ) ? 'white' : 'black';
- }
-
- function shortcode_callback( $attr ) {
+ /**
+ * Display shortcode.
+ *
+ * @param array $attr Shortcode attributes.
+ */
+ public function shortcode_callback( $attr ) {
$post_id = get_the_ID();
$attr = shortcode_atts(
@@ -124,7 +98,7 @@ class Jetpack_Slideshow_Shortcode {
'slideshow'
);
- if ( 'rand' == strtolower( $attr['order'] ) ) {
+ if ( 'rand' === strtolower( $attr['order'] ) ) {
$attr['orderby'] = 'none';
}
@@ -137,7 +111,7 @@ class Jetpack_Slideshow_Shortcode {
$attr['size'] = 'full';
}
- // Don't restrict to the current post if include
+ // Don't restrict to the current post if include.
$post_parent = ( empty( $attr['include'] ) ) ? intval( $attr['id'] ) : null;
$attachments = get_posts(
@@ -164,7 +138,7 @@ class Jetpack_Slideshow_Shortcode {
$gallery = array();
foreach ( $attachments as $attachment ) {
$attachment_image_src = wp_get_attachment_image_src( $attachment->ID, $attr['size'] );
- $attachment_image_src = $attachment_image_src[0]; // [url, width, height]
+ $attachment_image_src = $attachment_image_src[0]; // [url, width, height].
$attachment_image_title = get_the_title( $attachment->ID );
$attachment_image_alt = get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true );
/**
@@ -177,7 +151,7 @@ class Jetpack_Slideshow_Shortcode {
* @param string wptexturize( strip_tags( $attachment->post_excerpt ) ) Post excerpt.
* @param string $attachment ->ID Attachment ID.
*/
- $caption = apply_filters( 'jetpack_slideshow_slide_caption', wptexturize( strip_tags( $attachment->post_excerpt ) ), $attachment->ID );
+ $caption = apply_filters( 'jetpack_slideshow_slide_caption', wptexturize( wp_strip_all_tags( $attachment->post_excerpt ) ), $attachment->ID );
$gallery[] = (object) array(
'src' => (string) esc_url_raw( $attachment_image_src ),
@@ -216,52 +190,57 @@ class Jetpack_Slideshow_Shortcode {
*
* Returns the necessary markup and js to fire a slideshow.
*
- * @param $attr array Attributes for the slideshow.
+ * @param array $attr Attributes for the slideshow.
*
* @uses $this->enqueue_scripts()
*
* @return string HTML output.
*/
- function slideshow_js( $attr ) {
- // Enqueue scripts
+ public function slideshow_js( $attr ) {
+ // Enqueue scripts.
$this->enqueue_scripts();
$output = '';
if ( defined( 'JSON_HEX_AMP' ) ) {
- // This is nice to have, but not strictly necessary since we use _wp_specialchars() below
- $gallery = json_encode( $attr['gallery'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ); // phpcs:ignore PHPCompatibility
+ // This is nice to have, but not strictly necessary since we use _wp_specialchars() below.
+ $gallery = wp_json_encode( $attr['gallery'], JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT ); // phpcs:ignore PHPCompatibility
} else {
- $gallery = json_encode( $attr['gallery'] );
+ $gallery = wp_json_encode( $attr['gallery'] );
}
$output .= '<p class="jetpack-slideshow-noscript robots-nocontent">' . esc_html__( 'This slideshow requires JavaScript.', 'jetpack' ) . '</p>';
+
+ /*
+ * The input to json_encode() above can contain '&quot;'.
+ *
+ * For calls to json_encode() lacking the JSON_HEX_AMP option,
+ * that '&quot;' is left unaltered. Running '&quot;' through esc_attr()
+ * also leaves it unaltered since esc_attr() does not double-encode.
+ *
+ * This means we end up with an attribute like
+ * `data-gallery="{&quot;foo&quot;:&quot;&quot;&quot;}"`,
+ * which is interpreted by the browser as `{"foo":"""}`,
+ * which cannot be JSON decoded.
+ *
+ * The preferred workaround is to include the JSON_HEX_AMP (and friends)
+ * options, but these are not available until 5.3.0.
+ * Alternatively, we can use _wp_specialchars( , , , true ) instead of
+ * esc_attr(), which will double-encode.
+ *
+ * Since we can't rely on JSON_HEX_AMP, we do both.
+ *
+ * @todo Update when minimum is PHP 5.3+
+ */
+ $gallery_attributes = _wp_specialchars( wp_check_invalid_utf8( $gallery ), ENT_QUOTES, false, true );
+
$output .= sprintf(
'<div id="%s" class="slideshow-window jetpack-slideshow slideshow-%s" data-trans="%s" data-autostart="%s" data-gallery="%s" itemscope itemtype="https://schema.org/ImageGallery"></div>',
esc_attr( $attr['selector'] . '-slideshow' ),
esc_attr( $attr['color'] ),
esc_attr( $attr['trans'] ),
esc_attr( $attr['autostart'] ),
- /*
- * The input to json_encode() above can contain '&quot;'.
- *
- * For calls to json_encode() lacking the JSON_HEX_AMP option,
- * that '&quot;' is left unaltered. Running '&quot;' through esc_attr()
- * also leaves it unaltered since esc_attr() does not double-encode.
- *
- * This means we end up with an attribute like
- * `data-gallery="{&quot;foo&quot;:&quot;&quot;&quot;}"`,
- * which is interpreted by the browser as `{"foo":"""}`,
- * which cannot be JSON decoded.
- *
- * The preferred workaround is to include the JSON_HEX_AMP (and friends)
- * options, but these are not available until 5.3.0.
- * Alternatively, we can use _wp_specialchars( , , , true ) instead of
- * esc_attr(), which will double-encode.
- *
- * Since we can't rely on JSON_HEX_AMP, we do both.
- */
- _wp_specialchars( wp_check_invalid_utf8( $gallery ), ENT_QUOTES, false, true )
+ $gallery_attributes
);
return $output;
@@ -270,17 +249,22 @@ class Jetpack_Slideshow_Shortcode {
/**
* Actually enqueues the scripts and styles.
*/
- function enqueue_scripts() {
+ public function enqueue_scripts() {
wp_enqueue_script( 'jquery-cycle', plugins_url( '/js/jquery.cycle.min.js', __FILE__ ), array( 'jquery' ), '20161231', true );
wp_enqueue_script(
'jetpack-slideshow',
- Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/slideshow-shortcode.min.js', 'modules/shortcodes/js/slideshow-shortcode.js' ),
+ Assets::get_file_url_for_environment( '_inc/build/shortcodes/js/slideshow-shortcode.min.js', 'modules/shortcodes/js/slideshow-shortcode.js' ),
array( 'jquery-cycle' ),
'20160119.1',
true
);
- wp_enqueue_style( 'jetpack-slideshow', plugins_url( '/css/slideshow-shortcode.css', __FILE__ ) );
+ wp_enqueue_style(
+ 'jetpack-slideshow',
+ plugins_url( '/css/slideshow-shortcode.css', __FILE__ ),
+ array(),
+ JETPACK__VERSION
+ );
wp_style_add_data( 'jetpack-slideshow', 'rtl', 'replace' );
wp_localize_script(
@@ -308,6 +292,9 @@ class Jetpack_Slideshow_Shortcode {
);
}
+ /**
+ * Instantiate shortcode.
+ */
public static function init() {
new Jetpack_Slideshow_Shortcode();
}
diff --git a/plugins/jetpack/modules/shortcodes/soundcloud.php b/plugins/jetpack/modules/shortcodes/soundcloud.php
index 71f281c3..59479fc7 100644
--- a/plugins/jetpack/modules/shortcodes/soundcloud.php
+++ b/plugins/jetpack/modules/shortcodes/soundcloud.php
@@ -1,44 +1,25 @@
<?php
-/*
-Plugin Name: SoundCloud Shortcode
-Plugin URI: https://wordpress.org/extend/plugins/soundcloud-shortcode/
-Description: Converts SoundCloud WordPress shortcodes to a SoundCloud widget. Example: [soundcloud]http://soundcloud.com/forss/flickermood[/soundcloud]
-Version: 2.3
-Author: SoundCloud Inc., simplified for Jetpack by Automattic, Inc.
-Author URI: http://soundcloud.com
-License: GPLv2
-
-Original version: Johannes Wagener <johannes@soundcloud.com>
-Options support: Tiffany Conroy <tiffany@soundcloud.com>
-HTML5 & oEmbed support: Tim Bormans <tim@soundcloud.com>
-*/
-
-/*
-A8C: Taken from http://plugins.svn.wordpress.org/soundcloud-shortcode/trunk/
-at revision 664386.
-
-Commenting out (instead of removing) and replacing code with custom modifs
-so it's eqsy to see what differs from the standard DOTORG version.
-
-All custom modifs are annoted with "A8C" keyword in comment.
-*/
-
/**
- * Register oEmbed provider
+ * SoundCloud Shortcode
+ * Based on this plugin: https://wordpress.org/plugins/soundcloud-shortcode/
+ *
+ * Credits:
+ * Original version: Johannes Wagener <johannes@soundcloud.com>
+ * Options support: Tiffany Conroy <tiffany@soundcloud.com>
+ * HTML5 & oEmbed support: Tim Bormans <tim@soundcloud.com>
+ *
+ * Examples:
+ * [soundcloud]http://soundcloud.com/forss/flickermood[/soundcloud]
+ * [soundcloud url="https://api.soundcloud.com/tracks/156661852" params="auto_play=false&amp;hide_related=false&amp;visual=false" width="100%" height="450" iframe="true" /]
+ * [soundcloud url="https://api.soundcloud.com/tracks/156661852" params="auto_play=false&amp;hide_related=false&amp;visual=true" width="100%" height="450" iframe="true" /]
+ * [soundcloud url="https://soundcloud.com/closetorgan/paul-is-dead" width=400 height=400]
+ * [soundcloud url="https://soundcloud.com/closetorgan/sets/smells-like-lynx-africa-private"]
+ * [soundcloud url="https://soundcloud.com/closetorgan/sets/smells-like-lynx-africa-private" color="00cc11"]
+ * <iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/150745932&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
+ *
+ * @package Jetpack
*/
-/*
- A8C: oEmbed is handled now in core; see wp-includes/class-oembed.php
-wp_oembed_add_provider( '#https?://(?:api\.)?soundcloud\.com/.*#i', 'http://soundcloud.com/oembed', true );
-*/
-
-
-/**
- * Register SoundCloud shortcode
- */
-
-add_shortcode( 'soundcloud', 'soundcloud_shortcode' );
-
/**
* SoundCloud shortcode handler
*
@@ -49,128 +30,153 @@ add_shortcode( 'soundcloud', 'soundcloud_shortcode' );
* @return string Widget embed code HTML
*/
function soundcloud_shortcode( $atts, $content = null ) {
+ global $wp_embed;
+
+ // Custom shortcode options.
+ $shortcode_options = array_merge(
+ array( 'url' => trim( $content ) ),
+ is_array( $atts ) ? $atts : array()
+ );
- // Custom shortcode options
- $shortcode_options = array_merge( array( 'url' => trim( $content ) ), is_array( $atts ) ? $atts : array() );
+ // The "url" option is required.
+ if ( empty( $shortcode_options['url'] ) ) {
+ if ( current_user_can( 'edit_posts' ) ) {
+ return esc_html__( 'Please specify a Soundcloud URL.', 'jetpack' );
+ } else {
+ return '<!-- Missing Soundcloud URL -->';
+ }
+ }
- // Turn shortcode option "param" (param=value&param2=value) into array
+ // Turn shortcode option "param" (param=value&param2=value) into array of params.
$shortcode_params = array();
if ( isset( $shortcode_options['params'] ) ) {
parse_str( html_entity_decode( $shortcode_options['params'] ), $shortcode_params );
+ $shortcode_options = array_merge(
+ $shortcode_options,
+ $shortcode_params
+ );
+ unset( $shortcode_options['params'] );
}
- $shortcode_options['params'] = $shortcode_params;
-
- /*
- A8C: The original plugin exposes options we don't. SoundCloud omits "visual" shortcode
- option when false, so if logic here remains, impossible to have non-visual shortcode.
- $player_type = soundcloud_get_option( 'player_type', 'visual' );
- $isIframe = $player_type !== 'flash';
- $isVisual = ! $player_type || $player_type === 'visual' || $shortcode_options['visual'];
- */
-
- // User preference options
- $plugin_options = array_filter(
+
+ $options = shortcode_atts(
+ // This list used to include an 'iframe' option. We don't include it anymore as we don't support the Flash player anymore.
array(
- 'iframe' => true, // A8C: See above comment; flash is not a supported option
- 'width' => soundcloud_get_option( 'player_width' ),
- 'height' => soundcloud_url_has_tracklist( $shortcode_options['url'] ) ? soundcloud_get_option( 'player_height_multi' ) : soundcloud_get_option( 'player_height' ),
- 'params' => array_filter(
- array(
- 'auto_play' => soundcloud_get_option( 'auto_play' ),
- 'show_comments' => soundcloud_get_option( 'show_comments' ),
- 'color' => soundcloud_get_option( 'color' ),
- 'visual' => 'false', // A8C: Merged with params below at $options assignment
- )
- ),
- )
+ 'url' => '',
+ 'width' => soundcloud_get_option( 'player_width' ),
+ 'height' => soundcloud_url_has_tracklist( $shortcode_options['url'] ) ? soundcloud_get_option( 'player_height_multi' ) : soundcloud_get_option( 'player_height' ),
+ 'auto_play' => soundcloud_get_option( 'auto_play' ),
+ 'hide_related' => false,
+ 'visual' => false,
+ 'show_comments' => soundcloud_get_option( 'show_comments' ),
+ 'color' => soundcloud_get_option( 'color' ),
+ 'show_user' => false,
+ 'show_reposts' => false,
+ ),
+ $shortcode_options,
+ 'soundcloud'
);
- // Needs to be an array
- if ( ! isset( $plugin_options['params'] ) ) {
- $plugin_options['params'] = array();
+ // "width" needs to be an integer.
+ if ( ! empty( $options['width'] ) && ! preg_match( '/^\d+$/', $options['width'] ) ) {
+ // set to 0 so oEmbed will use the default 100% and WordPress themes will leave it alone.
+ $options['width'] = 0;
}
-
- // plugin options < shortcode options
- $options = array_merge(
- $plugin_options,
- $shortcode_options
- );
-
- // plugin params < shortcode params
- $options['params'] = array_merge(
- $plugin_options['params'],
- $shortcode_options['params']
- );
-
- // The "url" option is required
- if ( ! isset( $options['url'] ) ) {
- return '';
+ // Set default width if not defined.
+ $width = ! empty( $options['width'] ) ? absint( $options['width'] ) : '100%';
+
+ // Set default height if not defined.
+ if (
+ empty( $options['height'] )
+ || (
+ // "height" needs to be an integer.
+ ! empty( $options['height'] )
+ && ! preg_match( '/^\d+$/', $options['height'] )
+ )
+ ) {
+ if (
+ soundcloud_url_has_tracklist( $options['url'] )
+ || 'true' === $options['visual']
+ ) {
+ $height = 450;
+ } else {
+ $height = 166;
+ }
} else {
- $options['url'] = trim( $options['url'] );
+ $height = absint( $options['height'] );
}
- // Both "width" and "height" need to be integers
- if ( isset( $options['width'] ) && ! preg_match( '/^\d+$/', $options['width'] ) ) {
- // set to 0 so oEmbed will use the default 100% and WordPress themes will leave it alone
- $options['width'] = 0;
+ // Set visual to false when displaying the smallest player.
+ if ( '20' === $options['height'] ) {
+ $options['visual'] = false;
}
- if ( isset( $options['height'] ) && ! preg_match( '/^\d+$/', $options['height'] ) ) {
- unset( $options['height'] );
+
+ if (
+ class_exists( 'Jetpack_AMP_Support' )
+ && Jetpack_AMP_Support::is_amp_request()
+ && ! empty( $options['url'] )
+ && 'api.soundcloud.com' !== wp_parse_url( $options['url'], PHP_URL_HOST )
+ ) {
+ // Defer to oEmbed if an oEmbeddable URL is provided.
+ return $wp_embed->shortcode( $options, $options['url'] );
}
- // The "iframe" option must be true to load the iframe widget
- $iframe = soundcloud_booleanize( $options['iframe'] );
+ // Build our list of Soundcloud parameters.
+ $query_args = array(
+ 'url' => rawurlencode( $options['url'] ),
+ );
+
+ // Add our options, if they are set to true or false.
+ foreach ( $options as $name => $value ) {
+ if ( 'true' === $value ) {
+ $query_args[ $name ] = 'true';
+ }
- // Remove visual parameter from Flash widget, when it's false because that's the default, or when displaying the smallest player
- if ( $options['params']['visual'] && ( ! $iframe || ! soundcloud_booleanize( $options['params']['visual'] ) || ( isset( $options['height'] ) && '20' == $options['height'] ) ) ) {
- unset( $options['params']['visual'] );
+ if ( 'false' === $value || false === $value ) {
+ $query_args[ $name ] = 'false';
+ }
}
- // Merge in "url" value
- $options['params'] = array_merge(
- array(
- 'url' => $options['url'],
- ),
- $options['params']
+ // Add the color parameter if it was specified and is a valid color.
+ if ( ! empty( $options['color'] ) ) {
+ $color = sanitize_hex_color_no_hash( $options['color'] );
+ if ( ! empty( $color ) ) {
+ $query_args['color'] = $color;
+ }
+ }
+
+ // Build final embed URL.
+ $url = add_query_arg(
+ $query_args,
+ 'https://w.soundcloud.com/player/'
);
- // Return html embed code
- if ( $iframe ) {
- return soundcloud_iframe_widget( $options );
- } else {
- return soundcloud_flash_widget( $options );
- }
+ return sprintf(
+ '<iframe width="%1$s" height="%2$d" scrolling="no" frameborder="no" src="%3$s"></iframe>',
+ esc_attr( $width ),
+ esc_attr( $height ),
+ $url
+ );
}
+add_shortcode( 'soundcloud', 'soundcloud_shortcode' );
/**
* Plugin options getter
*
- * @param string|array $option Option name
- * @param mixed $default Default value
+ * @param string|array $option Option name.
+ * @param mixed $default Default value.
*
* @return mixed Option value
*/
function soundcloud_get_option( $option, $default = false ) {
$value = get_option( 'soundcloud_' . $option );
- return $value === '' ? $default : $value;
-}
-
-/**
- * Booleanize a value
- *
- * @param boolean|string $value
- *
- * @return boolean
- */
-function soundcloud_booleanize( $value ) {
- return is_bool( $value ) ? $value : $value === 'true' ? true : false;
+ return '' === $value ? $default : $value;
}
/**
* Decide if a url has a tracklist
*
- * @param string $url
+ * @param string $url Soundcloud URL.
*
* @return boolean
*/
@@ -179,81 +185,6 @@ function soundcloud_url_has_tracklist( $url ) {
}
/**
- * Parameterize url
- *
- * @param array $match Matched regex
- *
- * @return string Parameterized url
- */
-function soundcloud_oembed_params_callback( $match ) {
- global $soundcloud_oembed_params;
-
- // Convert URL to array
- $url = parse_url( urldecode( $match[1] ) );
- // Convert URL query to array
- parse_str( $url['query'], $query_array );
- // Build new query string
- $query = http_build_query( array_merge( $query_array, $soundcloud_oembed_params ) );
-
- return 'src="' . $url['scheme'] . '://' . $url['host'] . $url['path'] . '?' . $query;
-}
-
-/**
- * Iframe widget embed code
- *
- * @param array $options Parameters
- *
- * @return string Iframe embed code
- */
-function soundcloud_iframe_widget( $options ) {
-
- // Build URL
- $url = set_url_scheme( 'https://w.soundcloud.com/player/?' . http_build_query( $options['params'] ) );
- // Set default width if not defined
- $width = isset( $options['width'] ) && $options['width'] !== 0 ? $options['width'] : '100%';
- // Set default height if not defined
- $height = isset( $options['height'] ) && $options['height'] !== 0
- ? $options['height']
- : ( soundcloud_url_has_tracklist( $options['url'] ) || ( isset( $options['params']['visual'] ) && soundcloud_booleanize( $options['params']['visual'] ) ) ? '450' : '166' );
-
- return sprintf( '<iframe width="%s" height="%s" scrolling="no" frameborder="no" src="%s"></iframe>', $width, $height, $url );
-}
-
-/**
- * Legacy Flash widget embed code
- *
- * @param array $options Parameters
- *
- * @return string Flash embed code
- */
-function soundcloud_flash_widget( $options ) {
- // Build URL
- $url = set_url_scheme( 'https://player.soundcloud.com/player.swf?' . http_build_query( $options['params'] ) );
- // Set default width if not defined
- $width = isset( $options['width'] ) && $options['width'] !== 0 ? $options['width'] : '100%';
- // Set default height if not defined
- $height = isset( $options['height'] ) && $options['height'] !== 0 ? $options['height'] : ( soundcloud_url_has_tracklist( $options['url'] ) ? '255' : '81' );
-
- return preg_replace(
- '/\s\s+/',
- '',
- sprintf(
- '<object width="%s" height="%s">
- <param name="movie" value="%s" />
- <param name="allowscriptaccess" value="always" />
- <embed width="%s" height="%s" src="%s" allowscriptaccess="always" type="application/x-shockwave-flash"></embed>
- </object>',
- $width,
- $height,
- $url,
- $width,
- $height,
- $url
- )
- );
-}
-
-/**
* SoundCloud Embed Reversal
*
* Converts a generic HTML embed code from SoundClound into a
@@ -268,12 +199,6 @@ function jetpack_soundcloud_embed_reversal( $content ) {
return $content;
}
- /*
- Sample embed code:
-
- <iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/150745932&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
- */
-
$regexes = array();
$regexes[] = '#<iframe[^>]+?src="((?:https?:)?//w\.soundcloud\.com/player/[^"\']++)"[^>]*+>\s*?</iframe>#i';
@@ -286,10 +211,10 @@ function jetpack_soundcloud_embed_reversal( $content ) {
foreach ( $matches as $match ) {
- // if pasted from the visual editor - prevent double encoding
+ // if pasted from the visual editor - prevent double encoding.
$match[1] = str_replace( '&amp;amp;', '&amp;', $match[1] );
- $args = parse_url( html_entity_decode( $match[1] ), PHP_URL_QUERY );
+ $args = wp_parse_url( html_entity_decode( $match[1] ), PHP_URL_QUERY );
$args = wp_parse_args( $args );
if ( ! preg_match( '#^(?:https?:)?//api\.soundcloud\.com/.+$#i', $args['url'], $url_matches ) ) {
@@ -316,6 +241,7 @@ function jetpack_soundcloud_embed_reversal( $content ) {
$replace_regex = sprintf( '#\s*%s\s*#', preg_quote( $match[0], '#' ) );
$content = preg_replace( $replace_regex, sprintf( "\n\n%s\n\n", $shortcode ), $content );
+
/** This action is documented in modules/shortcodes/youtube.php */
do_action( 'jetpack_embed_to_shortcode', 'soundcloud', $url_matches[0] );
}
@@ -323,5 +249,4 @@ function jetpack_soundcloud_embed_reversal( $content ) {
return $content;
}
-
add_filter( 'pre_kses', 'jetpack_soundcloud_embed_reversal' );
diff --git a/plugins/jetpack/modules/shortcodes/ted.php b/plugins/jetpack/modules/shortcodes/ted.php
index f66f77d5..b26ef1da 100644
--- a/plugins/jetpack/modules/shortcodes/ted.php
+++ b/plugins/jetpack/modules/shortcodes/ted.php
@@ -1,23 +1,36 @@
<?php
-/*
+/**
* TED Player embed code
* http://www.ted.com
*
+ * Examples:
* http://www.ted.com/talks/view/id/210
* http://www.ted.com/talks/marc_goodman_a_vision_of_crimes_in_the_future.html
* [ted id="210" lang="en"]
* [ted id="http://www.ted.com/talks/view/id/210" lang="en"]
* [ted id=1539 lang=fr width=560 height=315]
+ *
+ * @package Jetpack
*/
-wp_oembed_add_provider( '!https?://(www\.)?ted.com/talks/view/id/.+!i', 'http://www.ted.com/talks/oembed.json', true );
-wp_oembed_add_provider( '!https?://(www\.)?ted.com/talks/[a-zA-Z\-\_]+\.html!i', 'http://www.ted.com/talks/oembed.json', true );
+wp_oembed_add_provider( '!https?://(www\.)?ted.com/talks/view/id/.+!i', 'https://www.ted.com/talks/oembed.json', true );
+wp_oembed_add_provider( '!https?://(www\.)?ted.com/talks/[a-zA-Z\-\_]+\.html!i', 'https://www.ted.com/talks/oembed.json', true );
+/**
+ * Get the unique ID of a TED video.
+ * Used in Jetpack_Media_Meta_Extractor.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function jetpack_shortcode_get_ted_id( $atts ) {
return ( ! empty( $atts['id'] ) ? $atts['id'] : 0 );
}
-add_shortcode( 'ted', 'shortcode_ted' );
+/**
+ * Handle Ted Shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function shortcode_ted( $atts ) {
global $wp_embed;
@@ -35,17 +48,19 @@ function shortcode_ted( $atts ) {
$url = '';
if ( preg_match( '#^[\d]+$#', $atts['id'], $matches ) ) {
- $url = 'http://ted.com/talks/view/id/' . $matches[0];
+ $url = 'https://ted.com/talks/view/id/' . $matches[0];
} elseif ( preg_match( '#^https?://(www\.)?ted\.com/talks/view/id/[0-9]+$#', $atts['id'], $matches ) ) {
- $url = $matches[0];
+ $url = set_url_scheme( $matches[0], 'https' );
}
unset( $atts['id'] );
- $args = array();
+ $args = array();
+ $embed_size_w = get_option( 'embed_size_w' );
+
if ( is_numeric( $atts['width'] ) ) {
$args['width'] = $atts['width'];
- } elseif ( $embed_size_w = get_option( 'embed_size_w' ) ) {
+ } elseif ( $embed_size_w ) {
$args['width'] = $embed_size_w;
} elseif ( ! empty( $GLOBALS['content_width'] ) ) {
$args['width'] = (int) $GLOBALS['content_width'];
@@ -53,7 +68,7 @@ function shortcode_ted( $atts ) {
$args['width'] = 500;
}
- // Default to a 16x9 aspect ratio if there's no height set
+ // Default to a 16x9 aspect ratio if there's no height set.
if ( is_numeric( $atts['height'] ) ) {
$args['height'] = $atts['height'];
} else {
@@ -69,9 +84,14 @@ function shortcode_ted( $atts ) {
return $retval;
}
+add_shortcode( 'ted', 'shortcode_ted' );
/**
* Filter the request URL to also include the $lang parameter
+ *
+ * @param string $provider URL of provider that supplies the tweet we're requesting.
+ * @param string $url URL of tweet to embed.
+ * @param array $args Parameters supplied to shortcode and passed to wp_oembed_get.
*/
function ted_filter_oembed_fetch_url( $provider, $url, $args ) {
return add_query_arg( 'lang', $args['lang'], $provider );
diff --git a/plugins/jetpack/modules/shortcodes/tweet.php b/plugins/jetpack/modules/shortcodes/tweet.php
index 5d6acd29..435195b6 100644
--- a/plugins/jetpack/modules/shortcodes/tweet.php
+++ b/plugins/jetpack/modules/shortcodes/tweet.php
@@ -204,12 +204,23 @@ class Jetpack_Tweet {
remove_filter( 'oembed_fetch_url', array( 'Jetpack_Tweet', 'jetpack_tweet_url_extra_args' ), 10 );
}
- // Add Twitter widgets.js script to the footer.
- add_action( 'wp_footer', array( 'Jetpack_Tweet', 'jetpack_tweet_shortcode_script' ) );
-
/** This action is documented in modules/widgets/social-media-icons.php */
do_action( 'jetpack_bump_stats_extras', 'embeds', 'tweet' );
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ $width = ! empty( $attr['width'] ) ? $attr['width'] : 600;
+ $height = 480;
+ $output = sprintf(
+ '<amp-twitter data-tweetid="%1$s" layout="responsive" width="%2$d" height="%3$d"></amp-twitter>',
+ esc_attr( $tweet_id ),
+ absint( $width ),
+ absint( $height )
+ );
+ } else {
+ // Add Twitter widgets.js script to the footer.
+ add_action( 'wp_footer', array( 'Jetpack_Tweet', 'jetpack_tweet_shortcode_script' ) );
+ }
+
return $output;
}
diff --git a/plugins/jetpack/modules/shortcodes/twitchtv.php b/plugins/jetpack/modules/shortcodes/twitchtv.php
index a5439d05..935a8b3a 100644
--- a/plugins/jetpack/modules/shortcodes/twitchtv.php
+++ b/plugins/jetpack/modules/shortcodes/twitchtv.php
@@ -1,20 +1,24 @@
<?php
/**
- * twitch.tv shortcode
- * [twitchtv url='http://www.twitch.tv/paperbat' height='378' width='620' autoplay='false']
- * [twitchtv url='http://www.twitch.tv/paperbat/b/323486192' height='378' width='620' autoplay='false']
- **/
+ * Twitch.tv shortcode
+ *
+ * Examples:
+ * [twitchtv url='https://www.twitch.tv/paperbat' height='378' width='620' autoplay='false']
+ * [twitchtv url='https://www.twitch.tv/paperbat/b/323486192' height='378' width='620' autoplay='false']
+ *
+ * @package Jetpack
+ */
/**
- * (Live URL) http://www.twitch.tv/paperbat
+ * (Live URL) https://www.twitch.tv/paperbat
*
* <iframe src="https://player.twitch.tv/?autoplay=false&#038;muted=false&#038;channel=paperbat" width="620" height="378" frameborder="0" scrolling="no" allowfullscreen></iframe>
*
- * (Archive URL) http://www.twitch.tv/paperbat/v/323486192
+ * (Archive URL) https://www.twitch.tv/paperbat/v/323486192
*
* <iframe src="https://player.twitch.tv/?autoplay=false&#038;muted=false&#038;video=v323486192" width="620" height="378" frameborder="0" scrolling="no" allowfullscreen></iframe>
*
- * @param $atts array User supplied shortcode arguments.
+ * @param array $atts User supplied shortcode arguments.
*
* @return string HTML output of the shortcode.
*/
@@ -35,7 +39,7 @@ function wpcom_twitchtv_shortcode( $atts ) {
return '<!-- Invalid twitchtv URL -->';
}
- preg_match( '|^http://www.twitch.tv/([^/?]+)(/v/(\d+))?|i', $attr['url'], $match );
+ preg_match( '|^https?://www.twitch.tv/([^/?]+)(/v/(\d+))?|i', $attr['url'], $match );
$url_args = array(
'autoplay' => ( false !== $attr['autoplay'] && 'false' !== $attr['autoplay'] ) ? 'true' : 'false',
@@ -69,6 +73,5 @@ function wpcom_twitchtv_shortcode( $atts ) {
esc_attr( $height )
);
}
-
add_shortcode( 'twitch', 'wpcom_twitchtv_shortcode' );
add_shortcode( 'twitchtv', 'wpcom_twitchtv_shortcode' );
diff --git a/plugins/jetpack/modules/shortcodes/twitter-timeline.php b/plugins/jetpack/modules/shortcodes/twitter-timeline.php
index 38558b49..f282943d 100644
--- a/plugins/jetpack/modules/shortcodes/twitter-timeline.php
+++ b/plugins/jetpack/modules/shortcodes/twitter-timeline.php
@@ -1,6 +1,18 @@
<?php
-add_shortcode( 'twitter-timeline', 'twitter_timeline_shortcode' );
+/**
+ * Twitter Timeline Shortcode.
+ *
+ * Examples:
+ * [twitter-timeline username=jetpack]
+ *
+ * @package Jetpack
+ */
+/**
+ * Render the Twitter shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function twitter_timeline_shortcode( $atts ) {
$default_atts = array(
'username' => '',
@@ -39,7 +51,11 @@ function twitter_timeline_shortcode( $atts ) {
$output .= '>';
- $output .= sprintf( __( 'Tweets by @%s', 'jetpack' ), $atts['username'] );
+ $output .= sprintf(
+ /* Translators: placeholder is a Twitter username. */
+ __( 'Tweets by @%s', 'jetpack' ),
+ $atts['username']
+ );
$output .= '</a>';
@@ -47,7 +63,11 @@ function twitter_timeline_shortcode( $atts ) {
return $output;
}
+add_shortcode( 'twitter-timeline', 'twitter_timeline_shortcode' );
+/**
+ * Enqueue the js used by the Twitter shortcode.
+ */
function twitter_timeline_js() {
if ( is_customize_preview() ) {
wp_enqueue_script( 'jetpack-twitter-timeline' );
diff --git a/plugins/jetpack/modules/shortcodes/untappd-menu.php b/plugins/jetpack/modules/shortcodes/untappd-menu.php
index f8f62f0b..612df9af 100644
--- a/plugins/jetpack/modules/shortcodes/untappd-menu.php
+++ b/plugins/jetpack/modules/shortcodes/untappd-menu.php
@@ -1,4 +1,4 @@
-<?php
+<?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Untappd Shortcodes
*
@@ -8,22 +8,36 @@
* @since 4.1.0
* @param location int Location ID for the Untappd venue. Required.
* @param theme int Theme ID for the Untappd menu. Required.
+ *
+ * @package Jetpack
*/
+/**
+ * Display Untappd data in posts and pages.
+ */
class Jetpack_Untappd {
- function __construct() {
+ /**
+ * Constructor
+ */
+ public function __construct() {
add_action( 'init', array( $this, 'action_init' ) );
}
- function action_init() {
+ /**
+ * Register our shortcodes.
+ */
+ public function action_init() {
add_shortcode( 'untappd-menu', array( $this, 'menu_shortcode' ) );
}
/**
* [untappd-menu] shortcode.
+ *
+ * @param array $atts Shortocde attributes.
+ * @param string $content Post content.
*/
- static function menu_shortcode( $atts, $content = '' ) {
+ public static function menu_shortcode( $atts, $content = '' ) {
// Let's bail if we don't have location or theme.
if ( ! isset( $atts['location'] ) || ! isset( $atts['theme'] ) ) {
if ( current_user_can( 'edit_posts' ) ) {
diff --git a/plugins/jetpack/modules/shortcodes/upcoming-events.php b/plugins/jetpack/modules/shortcodes/upcoming-events.php
index 02f6dda1..69ef9bda 100644
--- a/plugins/jetpack/modules/shortcodes/upcoming-events.php
+++ b/plugins/jetpack/modules/shortcodes/upcoming-events.php
@@ -1,14 +1,30 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
- * Most of the heavy lifting done in iCalendarReader class
+ * Display a list of upcoming events from a calendar.
+ *
+ * @package Jetpack
+ */
+
+/**
+ * Register a upcomingevents shortcode.
+ * Most of the heavy lifting done in iCalendarReader class,
+ * where the icalendar_render_events() function controls the display.
*/
class Upcoming_Events_Shortcode {
+ /**
+ * Register things.
+ */
public static function init() {
add_shortcode( 'upcomingevents', array( __CLASS__, 'shortcode' ) );
}
+ /**
+ * Register the shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
public static function shortcode( $atts = array() ) {
jetpack_require_lib( 'icalendar-reader' );
$atts = shortcode_atts(
@@ -32,5 +48,4 @@ class Upcoming_Events_Shortcode {
return $events;
}
}
-
add_action( 'plugins_loaded', array( 'Upcoming_Events_Shortcode', 'init' ), 101 );
diff --git a/plugins/jetpack/modules/shortcodes/videopress.php b/plugins/jetpack/modules/shortcodes/videopress.php
index a4bfd167..0750a25a 100644
--- a/plugins/jetpack/modules/shortcodes/videopress.php
+++ b/plugins/jetpack/modules/shortcodes/videopress.php
@@ -4,6 +4,8 @@
*
* @since 2.4
* @since 3.9.5 Added compatibility with refactored VideoPress module.
+ *
+ * @package Jetpack
*/
if ( ! Jetpack::is_module_active( 'videopress' ) ) {
diff --git a/plugins/jetpack/modules/shortcodes/vimeo.php b/plugins/jetpack/modules/shortcodes/vimeo.php
index 91492d9c..cc0d3d77 100644
--- a/plugins/jetpack/modules/shortcodes/vimeo.php
+++ b/plugins/jetpack/modules/shortcodes/vimeo.php
@@ -1,14 +1,23 @@
<?php
+/**
+ * Vimeo Shortcode.
+ *
+ * Examples:
+ * [vimeo 141358]
+ * [vimeo http://vimeo.com/141358]
+ * [vimeo 141358 h=500&w=350]
+ * [vimeo id=141358 width=350 height=500]
+ *
+ * <iframe src="http://player.vimeo.com/video/18427511" width="400" height="225" frameborder="0"></iframe><p><a href="http://vimeo.com/18427511">Eskmo 'We Got More' (Official Video)</a> from <a href="http://vimeo.com/ninjatune">Ninja Tune</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
+ *
+ * @package Jetpack
+ */
-/*
-[vimeo 141358]
-[vimeo http://vimeo.com/141358]
-[vimeo 141358 h=500&w=350]
-[vimeo id=141358 width=350 height=500]
-
-<iframe src="http://player.vimeo.com/video/18427511" width="400" height="225" frameborder="0"></iframe><p><a href="http://vimeo.com/18427511">Eskmo 'We Got More' (Official Video)</a> from <a href="http://vimeo.com/ninjatune">Ninja Tune</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
-*/
-
+/**
+ * Extract Vimeo ID from shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function jetpack_shortcode_get_vimeo_id( $atts ) {
if ( isset( $atts[0] ) ) {
$atts[0] = trim( $atts[0], '=' );
@@ -28,74 +37,70 @@ function jetpack_shortcode_get_vimeo_id( $atts ) {
}
/**
- * Convert a Vimeo shortcode into an embed code.
+ * Get video dimensions.
*
- * @param array $atts An array of shortcode attributes.
+ * @since 8.0.0
*
- * @return string The embed code for the Vimeo video.
+ * @param array $attr The attributes of the shortcode.
+ * @param array $old_attr Optional array of attributes from the old shortcode format.
+ *
+ * @return array Width and height.
*/
-function vimeo_shortcode( $atts ) {
+function jetpack_shortcode_get_vimeo_dimensions( $attr, $old_attr = array() ) {
global $content_width;
- $attr = array_map(
- 'intval',
- shortcode_atts(
- array(
- 'id' => 0,
- 'width' => 0,
- 'height' => 0,
- 'autoplay' => 0,
- 'loop' => 0,
- ),
- $atts
- )
- );
-
- if ( isset( $atts[0] ) ) {
- $attr['id'] = jetpack_shortcode_get_vimeo_id( $atts );
- }
-
- if ( ! $attr['id'] ) {
- return '<!-- vimeo error: not a vimeo video -->';
- }
-
- // [vimeo 141358 h=500&w=350]
- $params = shortcode_new_to_old_params( $atts ); // h=500&w=350
- $params = str_replace( array( '&amp;', '&#038;' ), '&', $params );
- parse_str( $params, $args );
+ $default_width = 600;
+ $default_height = 338;
+ $aspect_ratio = $default_height / $default_width;
+ $width = ( ! empty( $attr['width'] ) ? absint( $attr['width'] ) : $default_width );
+ $height = ( ! empty( $attr['height'] ) ? absint( $attr['height'] ) : $default_height );
- $width = intval( $attr['width'] );
- $height = intval( $attr['height'] );
-
- // Support w and h argument as fallback.
- if ( empty( $width ) && isset( $args['w'] ) ) {
- $width = intval( $args['w'] );
+ /*
+ * Support w and h argument as fallbacks.
+ */
+ if (
+ $default_width === $width
+ && ! empty( $old_attr['w'] )
+ ) {
+ $width = absint( $old_attr['w'] );
- if ( empty( $height ) && ! isset( $args['h'] ) ) {
- // The case where w=300 is specified without h=200, otherwise $height
- // will always equal the default of 300, no matter what w was set to.
- $height = round( ( $width / 640 ) * 360 );
+ if (
+ $default_width === $width
+ && empty( $old_attr['h'] )
+ ) {
+ $height = round( $width * $aspect_ratio );
}
}
- if ( empty( $height ) && isset( $args['h'] ) ) {
- $height = (int) $args['h'];
+ if (
+ $default_height === $height
+ && ! empty( $old_attr['h'] )
+ ) {
+ $height = absint( $old_attr['h'] );
- if ( ! isset( $args['w'] ) ) {
- $width = round( ( $height / 360 ) * 640 );
+ if ( empty( $old_attr['w'] ) ) {
+ $width = round( $height * $aspect_ratio );
}
}
- if ( ! $width && ! empty( $content_width ) ) {
+ /*
+ * If we have a content width defined, let it be the new default.
+ */
+ if (
+ $default_width === $width
+ && ! empty( $content_width )
+ ) {
$width = absint( $content_width );
}
- // If setting the width with content_width has failed, defaulting
- if ( ! $width ) {
- $width = 640;
- }
-
- if ( ! $height ) {
+ /*
+ * If we have a custom width, we need a custom height as well
+ * to maintain aspect ratio.
+ */
+ if (
+ $default_width !== $width
+ && $default_height === $height
+ ) {
$height = round( ( $width / 640 ) * 360 );
}
@@ -121,13 +126,53 @@ function vimeo_shortcode( $atts ) {
*/
$height = (int) apply_filters( 'vimeo_height', $height );
+ return array( $width, $height );
+}
+
+/**
+ * Convert a Vimeo shortcode into an embed code.
+ *
+ * @param array $atts An array of shortcode attributes.
+ *
+ * @return string The embed code for the Vimeo video.
+ */
+function vimeo_shortcode( $atts ) {
+ $attr = array_map(
+ 'intval',
+ shortcode_atts(
+ array(
+ 'id' => 0,
+ 'width' => 0,
+ 'height' => 0,
+ 'autoplay' => 0,
+ 'loop' => 0,
+ ),
+ $atts
+ )
+ );
+
+ if ( isset( $atts[0] ) ) {
+ $attr['id'] = jetpack_shortcode_get_vimeo_id( $atts );
+ }
+
+ if ( ! $attr['id'] ) {
+ return '<!-- vimeo error: not a vimeo video -->';
+ }
+
+ // Handle old shortcode params such as h=500&w=350.
+ $params = shortcode_new_to_old_params( $atts );
+ $params = str_replace( array( '&amp;', '&#038;' ), '&', $params );
+ parse_str( $params, $args );
+
+ list( $width, $height ) = jetpack_shortcode_get_vimeo_dimensions( $attr, $args );
+
$url = esc_url( 'https://player.vimeo.com/video/' . $attr['id'] );
// Handle autoplay and loop arguments.
if (
isset( $args['autoplay'] ) && '1' === $args['autoplay'] // Parsed from the embedded URL.
|| $attr['autoplay'] // Parsed from shortcode arguments.
- || in_array( 'autoplay', $atts ) // Catch the argument passed without a value.
+ || in_array( 'autoplay', $atts, true ) // Catch the argument passed without a value.
) {
$url = add_query_arg( 'autoplay', 1, $url );
}
@@ -135,17 +180,29 @@ function vimeo_shortcode( $atts ) {
if (
isset( $args['loop'] ) && '1' === $args['loop'] // Parsed from the embedded URL.
|| $attr['loop'] // Parsed from shortcode arguments.
- || in_array( 'loop', $atts ) // Catch the argument passed without a value.
+ || in_array( 'loop', $atts, true ) // Catch the argument passed without a value.
) {
$url = add_query_arg( 'loop', 1, $url );
}
- $html = sprintf(
- '<div class="embed-vimeo" style="text-align: center;"><iframe src="%1$s" width="%2$u" height="%3$u" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>',
- esc_url( $url ),
- esc_attr( $width ),
- esc_attr( $height )
- );
+ if (
+ class_exists( 'Jetpack_AMP_Support' )
+ && Jetpack_AMP_Support::is_amp_request()
+ ) {
+ $html = sprintf(
+ '<amp-vimeo data-videoid="%1$s" layout="responsive" width="%2$d" height="%3$d"></amp-vimeo>',
+ esc_attr( $attr['id'] ),
+ absint( $width ),
+ absint( $height )
+ );
+ } else {
+ $html = sprintf(
+ '<div class="embed-vimeo" style="text-align: center;"><iframe src="%1$s" width="%2$u" height="%3$u" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>',
+ esc_url( $url ),
+ esc_attr( $width ),
+ esc_attr( $height )
+ );
+ }
/**
* Filter the Vimeo player HTML.
@@ -160,7 +217,6 @@ function vimeo_shortcode( $atts ) {
return $html;
}
-
add_shortcode( 'vimeo', 'vimeo_shortcode' );
/**
@@ -169,8 +225,8 @@ add_shortcode( 'vimeo', 'vimeo_shortcode' );
* @since 3.9
*
* @param array $matches Regex partial matches against the URL passed.
- * @param array $attr Attributes received in embed response
- * @param array $url Requested URL to be embedded
+ * @param array $attr Attributes received in embed response.
+ * @param array $url Requested URL to be embedded.
*
* @return string Return output of Vimeo shortcode with the proper markup.
*/
@@ -190,9 +246,19 @@ function wpcom_vimeo_embed_url_init() {
wp_embed_register_handler( 'wpcom_vimeo_embed_url', '#https?://(.+\.)?vimeo\.com/#i', 'wpcom_vimeo_embed_url' );
}
-// Register handler to modify Vimeo embeds using Jetpack's shortcode output.
-add_action( 'init', 'wpcom_vimeo_embed_url_init' );
+/*
+ * Register handler to modify Vimeo embeds using Jetpack's shortcode output.
+ * This does not happen on WordPress.com, since embeds are handled by core there.
+ */
+if ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) {
+ add_action( 'init', 'wpcom_vimeo_embed_url_init' );
+}
+/**
+ * Transform a Vimeo embed iFrame into a Vimeo shortcode.
+ *
+ * @param string $content Post content.
+ */
function vimeo_embed_to_shortcode( $content ) {
if ( ! is_string( $content ) || false === stripos( $content, 'player.vimeo.com/video/' ) ) {
return $content;
@@ -201,8 +267,8 @@ function vimeo_embed_to_shortcode( $content ) {
$regexp = '!<iframe\s+src=[\'"](https?:)?//player\.vimeo\.com/video/(\d+)[\w=&;?]*[\'"]((?:\s+\w+=[\'"][^\'"]*[\'"])*)((?:[\s\w]*))></iframe>!i';
$regexp_ent = str_replace( '&amp;#0*58;', '&amp;#0*58;|&#0*58;', htmlspecialchars( $regexp, ENT_NOQUOTES ) );
- foreach ( array( 'regexp', 'regexp_ent' ) as $reg ) {
- if ( ! preg_match_all( $$reg, $content, $matches, PREG_SET_ORDER ) ) {
+ foreach ( compact( 'regexp', 'regexp_ent' ) as $reg => $regexp ) {
+ if ( ! preg_match_all( $regexp, $content, $matches, PREG_SET_ORDER ) ) {
continue;
}
@@ -211,7 +277,7 @@ function vimeo_embed_to_shortcode( $content ) {
$params = $match[3];
- if ( 'regexp_ent' == $reg ) {
+ if ( 'regexp_ent' === $reg ) {
$params = html_entity_decode( $params );
}
@@ -232,7 +298,6 @@ function vimeo_embed_to_shortcode( $content ) {
return $content;
}
-
add_filter( 'pre_kses', 'vimeo_embed_to_shortcode' );
/**
@@ -244,7 +309,8 @@ add_filter( 'pre_kses', 'vimeo_embed_to_shortcode' );
* @since 3.7.0
* @since 3.9.5 One regular expression matches shortcodes and plain URLs.
*
- * @param string $content HTML content
+ * @param string $content HTML content.
+ *
* @return string The content with embeds instead of URLs
*/
function vimeo_link( $content ) {
@@ -255,10 +321,12 @@ function vimeo_link( $content ) {
$shortcode = '(?:\[vimeo\s+[^0-9]*)([0-9]+)(?:\])';
/**
- * http://vimeo.com/12345
- * https://vimeo.com/12345
- * //vimeo.com/12345
- * vimeo.com/some/descender/12345
+ * Regex to look for a Vimeo link.
+ *
+ * - http://vimeo.com/12345
+ * - https://vimeo.com/12345
+ * - //vimeo.com/12345
+ * - vimeo.com/some/descender/12345
*
* Should not capture inside HTML attributes
* [Not] <a href="vimeo.com/12345">Cool Video</a>
@@ -293,9 +361,17 @@ function vimeo_link_callback( $matches ) {
return $matches[0];
}
-/** This filter is documented in modules/shortcodes/youtube.php */
-if ( ! is_admin() && apply_filters( 'jetpack_comments_allow_oembed', true ) ) {
- // We attach wp_kses_post to comment_text in default-filters.php with priority of 10 anyway, so the iframe gets filtered out.
- // Higher priority because we need it before auto-link and autop get to it
+if (
+ ! is_admin()
+ /** This filter is documented in modules/shortcodes/youtube.php */
+ && apply_filters( 'jetpack_comments_allow_oembed', true )
+ // No need for this on WordPress.com, this is done for multiple shortcodes at a time there.
+ && ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM )
+) {
+ /*
+ * We attach wp_kses_post to comment_text in default-filters.php with priority of 10 anyway,
+ * so the iframe gets filtered out.
+ * Higher priority because we need it before auto-link and autop get to it
+ */
add_filter( 'comment_text', 'vimeo_link', 1 );
}
diff --git a/plugins/jetpack/modules/shortcodes/vine.php b/plugins/jetpack/modules/shortcodes/vine.php
index 444b9999..e1681622 100644
--- a/plugins/jetpack/modules/shortcodes/vine.php
+++ b/plugins/jetpack/modules/shortcodes/vine.php
@@ -1,9 +1,9 @@
<?php
/**
* Vine shortcode
- */
-
-/**
+ * The service is now archived, but existing embeds are still accessible.
+ *
+ * Examples:
* Vine embed code:
* <iframe class="vine-embed" src="https://vine.co/v/bjHh0zHdgZT" width="600" height="600" frameborder="0"></iframe>
* <script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>
@@ -15,22 +15,34 @@
* [embed]https://vine.co/v/bjHh0zHdgZT[/embed]
* [embed width="300"]https://vine.co/v/bjHh0zHdgZT[/embed]
* [embed type="postcard" width="300"]https://vine.co/v/bjHh0zHdgZT[/embed]
- **/
+ *
+ * @package Jetpack
+ */
+/**
+ * Handle Vine embeds.
+ *
+ * @param array $matches Results after parsing the URL using the regex in wp_embed_register_handler().
+ * @param array $attr Embed attributes.
+ * @param string $url The original URL that was matched by the regex.
+ * @param array $rawattr The original unmodified attributes.
+ * @return string The embed HTML.
+ */
function vine_embed_video( $matches, $attr, $url, $rawattr ) {
- static $vine_flag_embedded_script;
-
$max_height = 300;
$type = 'simple';
- // Only allow 'postcard' or 'simple' types
- if ( isset( $rawattr['type'] ) && $rawattr['type'] === 'postcard' ) {
+ // Only allow 'postcard' or 'simple' types.
+ if (
+ isset( $rawattr['type'] )
+ && 'postcard' === $rawattr['type']
+ ) {
$type = 'postcard';
}
$vine_size = Jetpack::get_content_width();
- // If the user enters a value for width or height, we ignore the Jetpack::get_content_width()
+ // If the user enters a value for width or height, we ignore the Jetpack::get_content_width().
if ( isset( $rawattr['width'] ) || isset( $rawattr['height'] ) ) {
// 300 is the minimum size that Vine provides for embeds. Lower than that, the postcard embeds looks weird.
$vine_size = max( $max_height, min( $attr['width'], $attr['height'] ) );
@@ -41,17 +53,30 @@ function vine_embed_video( $matches, $attr, $url, $rawattr ) {
}
$url = 'https://vine.co/v/' . $matches[1] . '/embed/' . $type;
- $vine_html = sprintf( '<span class="embed-vine" style="display: block;"><iframe class="vine-embed" src="%s" width="%s" height="%s" frameborder="0"></iframe></span>', esc_url( $url ), (int) $vine_size, (int) $vine_size );
+ $vine_html = sprintf(
+ '<span class="embed-vine" style="display: block;"><iframe class="vine-embed" src="%1$s" width="%2$d" height="%3$d" frameborder="0"></iframe></span>',
+ esc_url( $url ),
+ (int) $vine_size,
+ (int) $vine_size
+ );
- if ( $vine_flag_embedded_script !== true ) {
- $vine_html .= '<script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>';
- $vine_flag_embedded_script = true;
- }
+ wp_enqueue_script(
+ 'vine-embed',
+ 'https://platform.vine.co/static/scripts/embed.js',
+ array(),
+ JETPACK__VERSION,
+ true
+ );
return $vine_html;
}
wp_embed_register_handler( 'jetpack_vine', '#https?://vine.co/v/([a-z0-9]+).*#i', 'vine_embed_video' );
+/**
+ * Display the Vine shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function vine_shortcode( $atts ) {
global $wp_embed;
diff --git a/plugins/jetpack/modules/shortcodes/wordads.php b/plugins/jetpack/modules/shortcodes/wordads.php
index bca6c48a..f1797d88 100644
--- a/plugins/jetpack/modules/shortcodes/wordads.php
+++ b/plugins/jetpack/modules/shortcodes/wordads.php
@@ -1,20 +1,36 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+/**
+ * Wordads shortcode.
+ *
+ * Examples:
+ * [wordads]
+ *
+ * @package Jetpack
+ */
/**
* Embed WordAds 'ad' in post
*/
class Jetpack_WordAds_Shortcode {
+ /**
+ * Used to determine whether scripts and styles have been enqueued already.
+ *
+ * @var bool false Should we enqueue scripts and styles.
+ */
private $scripts_and_style_included = false;
- function __construct() {
+ /**
+ * Initialize.
+ */
+ public function __construct() {
add_action( 'init', array( $this, 'action_init' ) );
}
/**
* Register our shortcode and enqueue necessary files.
*/
- function action_init() {
+ public function action_init() {
global $wordads;
if ( empty( $wordads ) ) {
@@ -33,7 +49,7 @@ class Jetpack_WordAds_Shortcode {
*
* @return string HTML for WordAds shortcode.
*/
- static function wordads_shortcode( $atts, $content = '' ) {
+ public static function wordads_shortcode( $atts, $content = '' ) {
$atts = shortcode_atts( array(), $atts, 'wordads' );
return self::wordads_shortcode_html( $atts, $content );
@@ -47,7 +63,7 @@ class Jetpack_WordAds_Shortcode {
*
* @return string HTML output
*/
- static function wordads_shortcode_html( $atts, $content = '' ) {
+ private static function wordads_shortcode_html( $atts, $content = '' ) {
global $wordads;
if ( empty( $wordads ) ) {
diff --git a/plugins/jetpack/modules/shortcodes/wufoo.php b/plugins/jetpack/modules/shortcodes/wufoo.php
index fbe6fe70..023da496 100644
--- a/plugins/jetpack/modules/shortcodes/wufoo.php
+++ b/plugins/jetpack/modules/shortcodes/wufoo.php
@@ -1,14 +1,19 @@
<?php
-/*
-Plugin Name: Wufoo Shortcode Plugin
-Description: Enables shortcode to embed Wufoo forms. Usage: [wufoo username="chriscoyier" formhash="x7w3w3" autoresize="true" height="458" header="show"]
-Author: Chris Coyier / Wufoo, evansolomon
-
-Based on https://wordpress.org/extend/plugins/wufoo-shortcode/
-https://wufoo.com/docs/code-manager/wordpress-shortcode-plugin/
-*/
-
+/**
+ * Plugin Name: Wufoo Shortcode
+ * Based on https://wordpress.org/plugins/wufoo-shortcode/
+ *
+ * Examples:
+ * [wufoo username="jeherve" formhash="z1x13ltw1m8jtrw" autoresize="true" height="338" header="show"]
+ *
+ * @package Jetpack
+ */
+/**
+ * Display the Wufoo shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ */
function wufoo_shortcode( $atts ) {
$attr = shortcode_atts(
array(
@@ -22,59 +27,87 @@ function wufoo_shortcode( $atts ) {
);
// Check username and formhash to ensure they only have alphanumeric characters or underscores, and aren't empty.
- if ( ! preg_match( '/^[a-zA-Z0-9_]+$/', $attr['username'] ) || ! preg_match( '/^[a-zA-Z0-9_]+$/', $attr['formhash'] ) ) {
-
- /**
+ if (
+ ! preg_match( '/^[a-zA-Z0-9_]+$/', $attr['username'] )
+ || ! preg_match( '/^[a-zA-Z0-9_]+$/', $attr['formhash'] )
+ ) {
+ /*
* Return an error to the users with instructions if one of these params is invalid
* They don't have default values because they are user/form-specific
*/
- $return_error = sprintf( __( 'Something is wrong with your Wufoo shortcode. If you copy and paste it from the %1$sWufoo Code Manager%2$s, you should be golden.', 'jetpack' ), '<a href="https://wufoo.com/docs/code-manager/" target="_blank">', '</a>' );
-
- return '
- <div style="border: 20px solid red; border-radius: 40px; padding: 40px; margin: 50px 0 70px;">
- <h3>Uh oh!</h3>
- <p style="margin: 0;">' . $return_error . '</p>
- </div>';
+ if ( current_user_can( 'edit_posts' ) ) {
+ return sprintf(
+ wp_kses(
+ /* translators: URL to Wufoo support page. */
+ __( 'Something is wrong with your Wufoo shortcode. Try following the instructions <a href="%s" target="_blank" rel="noopener noreferrer">here</a> to embed a form on your site.', 'jetpack' ),
+ array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ 'rel' => array(),
+ ),
+ )
+ ),
+ 'https://help.wufoo.com/articles/en_US/kb/Embed'
+ );
+ }
}
/**
* Placeholder which will tell Wufoo where to render the form.
*/
- $js_embed_placeholder = '<div id="wufoo-' . $attr['formhash'] . '"></div>';
+ $js_embed_placeholder = sprintf(
+ '<div id="wufoo-%s"></div>',
+ esc_attr( $attr['formhash'] )
+ );
/**
* Required parameters are present.
* An error will be returned inside the form if they are invalid.
*/
- $js_embed = '(function(){try{var wufoo_' . $attr['formhash'] . ' = new WufooForm();';
- $js_embed .= 'wufoo_' . $attr['formhash'] . '.initialize({';
- $js_embed .= "'userName':'" . $attr['username'] . "', ";
- $js_embed .= "'formHash':'" . $attr['formhash'] . "', ";
- $js_embed .= "'autoResize':" . (bool) ( $attr['autoresize'] ) . ',';
- $js_embed .= "'height':'" . (int) $attr['height'] . "',";
- $js_embed .= "'header':'" . esc_js( $attr['header'] ) . "',";
- $js_embed .= "'ssl':true,'async':true});";
- $js_embed .= 'wufoo_' . $attr['formhash'] . '.display();';
- $js_embed .= '}catch(e){}})();';
+ $js_embed = sprintf(
+ '(function(){try{var wufoo_%1$s = new WufooForm();wufoo_%1$s.initialize({"userName":"%2$s","formHash":"%1$s","autoResize":"%3$s","height":"%4$d","header":"%5$s","ssl":true,"async":true});wufoo_%1$s.display();}catch(e){}})();',
+ esc_attr( $attr['formhash'] ),
+ esc_attr( $attr['username'] ),
+ esc_attr( $attr['autoresize'] ),
+ absint( $attr['height'] ),
+ esc_js( $attr['header'] )
+ );
- /**
+ // Embed URL.
+ $embed_url = sprintf(
+ 'https://%1$s.wufoo.com/embed/%2$s/',
+ $attr['username'],
+ $attr['formhash']
+ );
+
+ // Form URL.
+ $form_url = sprintf(
+ 'https://%1$s.wufoo.com/forms/%2$s/',
+ $attr['username'],
+ $attr['formhash']
+ );
+
+ /*
* iframe embed, loaded inside <noscript> tags.
*/
- $iframe_embed = '<iframe ';
- $iframe_embed .= 'height="' . (int) $attr['height'] . '" ';
- $iframe_embed .= 'allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none;"';
- $iframe_embed .= 'src="https://' . $attr['username'] . '.wufoo.com/embed/' . $attr['formhash'] . '/">';
- $iframe_embed .= '<a href="https://' . $attr['username'] . '.wufoo.com/forms/' . $attr['formhash'] . '/" ';
- $iframe_embed .= 'rel="nofollow" target="_blank">' . __( 'Fill out my Wufoo form!', 'jetpack' ) . '</a></iframe>';
+ $iframe_embed = sprintf(
+ '<iframe height="%1$d" src="%2$s" allowTransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none;">
+ <a href="%3$s" target="_blank" rel="noopener noreferrer">%4$s</a>
+ </iframe>',
+ absint( $attr['height'] ),
+ esc_url( $embed_url ),
+ esc_url( $form_url ),
+ esc_html__( 'Fill out my Wufoo form!', 'jetpack' )
+ );
wp_enqueue_script(
'wufoo-form',
'https://www.wufoo.com/scripts/embed/form.js',
array(),
- false,
+ JETPACK__VERSION,
true
);
-
wp_add_inline_script( 'wufoo-form', $js_embed );
/** This action is already documented in modules/widgets/gravatar-profile.php */
@@ -85,5 +118,4 @@ function wufoo_shortcode( $atts ) {
*/
return "$js_embed_placeholder<noscript>$iframe_embed</noscript>";
}
-
add_shortcode( 'wufoo', 'wufoo_shortcode' );
diff --git a/plugins/jetpack/modules/shortcodes/youtube.php b/plugins/jetpack/modules/shortcodes/youtube.php
index 048eb09b..f3e37faf 100644
--- a/plugins/jetpack/modules/shortcodes/youtube.php
+++ b/plugins/jetpack/modules/shortcodes/youtube.php
@@ -1,64 +1,73 @@
<?php
-
/**
- * youtube shortcode
+ * Youtube shortcode
+ *
+ * Contains shortcode + some improvements over the Core Embeds syntax (see http://codex.wordpress.org/Embeds )
*
- * Contains shortcode + some improvements over the Embeds syntax @
- * http://codex.wordpress.org/Embeds
+ * Examples:
+ * [youtube https://www.youtube.com/watch?v=WVbQ-oro7FQ]
+ * [youtube=http://www.youtube.com/watch?v=wq0rXGLs0YM&fs=1&hl=bg_BG&autohide=1&rel=0]
+ * http://www.youtube.com/watch?v=H2Ncxw1xfck&w=320&h=240&fmt=1&rel=0&showsearch=1&hd=0
+ * http://www.youtube.com/v/9FhMMmqzbD8?fs=1&hl=en_US
+ * https://www.youtube.com/playlist?list=PLP7HaNDU4Cifov7C2fQM8Ij6Ew_uPHEXW
*
- * @example [youtube=http://www.youtube.com/watch?v=wq0rXGLs0YM&amp;fs=1&amp;hl=bg_BG]
+ * @package Jetpack
*/
/**
* Replaces YouTube embeds with YouTube shortcodes.
*
+ * Covers the following formats:
+ * 2008-07-15:
+ * <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/bZBHZT3a-FA&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/bZBHZT3a-FA&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>
+ * around 2008-06-06 youtube changed their old embed code to this:
+ * <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/M1D30gS7Z8U&hl=en"></param><embed src="http://www.youtube.com/v/M1D30gS7Z8U&hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed></object>
+ * old style was:
+ * <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/dGY28Qbj76A&rel=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/dGY28Qbj76A&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="344"></embed></object>
+ * 12-2010:
+ * <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/3H8bnKdf654?fs=1&amp;hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/3H8bnKdf654?fs=1&amp;hl=en_GB" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
+ * 01-2011:
+ * <iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/Qq9El3ki0_g" frameborder="0" allowFullScreen></iframe>
+ * <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0"></iframe>
+ *
* @param string $content HTML content.
* @return string The content with YouTube embeds replaced with YouTube shortcodes.
*/
-// 2008-07-15:
-// <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/bZBHZT3a-FA&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/bZBHZT3a-FA&hl=en&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object>
-// around 2008-06-06 youtube changed their old embed code to this:
-// <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/M1D30gS7Z8U&hl=en"></param><embed src="http://www.youtube.com/v/M1D30gS7Z8U&hl=en" type="application/x-shockwave-flash" width="425" height="344"></embed></object>
-// old style was:
-// <object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/dGY28Qbj76A&rel=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/dGY28Qbj76A&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="344"></embed></object>
-// 12-2010:
-// <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/3H8bnKdf654?fs=1&amp;hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/3H8bnKdf654?fs=1&amp;hl=en_GB" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
-// 01-2011:
-// <iframe title="YouTube video player" class="youtube-player" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/Qq9El3ki0_g" frameborder="0" allowFullScreen></iframe>
-// <iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0"></iframe>
function youtube_embed_to_short_code( $content ) {
if ( ! is_string( $content ) || false === strpos( $content, 'youtube.com' ) ) {
return $content;
}
- // older codes
+ // older codes.
$regexp = '!<object(.*?)>.*?<param\s+name=[\'"]movie[\'"]\s+value=[\'"](https?:)?//www\.youtube\.com/v/([^\'"]+)[\'"].*?>.*?</object>!i';
$regexp_ent = htmlspecialchars( $regexp, ENT_NOQUOTES );
$old_regexp = '!<embed(?:\s+\w+="[^"]*")*\s+src="https?(?:\:|&#0*58;)//www\.youtube\.com/v/([^"]+)"(?:\s+\w+="[^"]*")*\s*(?:/>|>\s*</embed>)!';
$old_regexp_ent = str_replace( '&amp;#0*58;', '&amp;#0*58;|&#0*58;', htmlspecialchars( $old_regexp, ENT_NOQUOTES ) );
- // new code
+ // new code.
$ifr_regexp = '!<iframe((?:\s+\w+="[^"]*")*?)\s+src="(https?:)?//(?:www\.)*youtube.com/embed/([^"]+)".*?</iframe>!i';
$ifr_regexp_ent = str_replace( '&amp;#0*58;', '&amp;#0*58;|&#0*58;', htmlspecialchars( $ifr_regexp, ENT_NOQUOTES ) );
- foreach ( array( 'regexp', 'regexp_ent', 'old_regexp', 'old_regexp_ent', 'ifr_regexp', 'ifr_regexp_ent' ) as $reg ) {
- if ( ! preg_match_all( $$reg, $content, $matches, PREG_SET_ORDER ) ) {
+ foreach ( compact( 'regexp', 'regexp_ent', 'old_regexp', 'old_regexp_ent', 'ifr_regexp', 'ifr_regexp_ent' ) as $reg => $regexp ) {
+ if ( ! preg_match_all( $regexp, $content, $matches, PREG_SET_ORDER ) ) {
continue;
}
foreach ( $matches as $match ) {
- // Hack, but '?' should only ever appear once, and
- // it should be for the 1st field-value pair in query string,
- // if it is present
- // YouTube changed their embed code.
- // Example of how it is now:
- // <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/aP9AaD4tgBY?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/aP9AaD4tgBY?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
- // As shown at the start of function, previous YouTube didn't '?'
- // the 1st field-value pair.
- if ( in_array( $reg, array( 'ifr_regexp', 'ifr_regexp_ent', 'regexp', 'regexp_ent' ) ) ) {
+ /*
+ * Hack, but '?' should only ever appear once, and
+ * it should be for the 1st field-value pair in query string,
+ * if it is present
+ * YouTube changed their embed code.
+ * Example of how it is now:
+ * <object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/aP9AaD4tgBY?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/aP9AaD4tgBY?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
+ * As shown at the start of function, previous YouTube didn't '?'
+ * the 1st field-value pair.
+ */
+ if ( in_array( $reg, array( 'ifr_regexp', 'ifr_regexp_ent', 'regexp', 'regexp_ent' ), true ) ) {
$params = $match[1];
- if ( in_array( $reg, array( 'ifr_regexp_ent', 'regexp_ent' ) ) ) {
+ if ( in_array( $reg, array( 'ifr_regexp_ent', 'regexp_ent' ), true ) ) {
$params = html_entity_decode( $params );
}
@@ -97,13 +106,13 @@ function youtube_embed_to_short_code( $content ) {
return $content;
}
-
add_filter( 'pre_kses', 'youtube_embed_to_short_code' );
/**
* Replaces plain-text links to YouTube videos with YouTube embeds.
*
- * @param string $content HTML content
+ * @param string $content HTML content.
+ *
* @return string The content with embeds instead of URLs
*/
function youtube_link( $content ) {
@@ -113,6 +122,8 @@ function youtube_link( $content ) {
/**
* Callback function for the regex that replaces YouTube URLs with
* YouTube embeds.
+ *
+ * @param array $matches An array containing a YouTube URL.
*/
function youtube_link_callback( $matches ) {
return "\n" . youtube_id( $matches[0] ) . "\n";
@@ -125,6 +136,11 @@ function youtube_link_callback( $matches ) {
* @return string The normalized URL
*/
if ( ! function_exists( 'youtube_sanitize_url' ) ) :
+ /**
+ * Clean up Youtube URL to match a single format.
+ *
+ * @param string $url Youtube URL.
+ */
function youtube_sanitize_url( $url ) {
$url = trim( $url, ' "' );
$url = trim( $url );
@@ -141,8 +157,10 @@ if ( ! function_exists( 'youtube_sanitize_url' ) ) :
}
endif;
-/*
- * url can be:
+/**
+ * Converts a YouTube URL into an embedded YouTube video.
+ *
+ * URL can be:
* http://www.youtube.com/embed/videoseries?list=PL94269DA08231042B&amp;hl=en_US
* http://www.youtube.com/watch#!v=H2Ncxw1xfck
* http://www.youtube.com/watch?v=H2Ncxw1xfck
@@ -150,113 +168,43 @@ endif;
* http://www.youtube.com/v/jF-kELmmvgA
* http://www.youtube.com/v/9FhMMmqzbD8?fs=1&hl=en_US
* http://youtu.be/Rrohlqeir5E
- */
-
-/**
- * Converts a YouTube URL into an embedded YouTube video.
+ *
+ * @param string $url Youtube URL.
*/
function youtube_id( $url ) {
- if ( ! $id = jetpack_get_youtube_id( $url ) ) {
- return '<!--YouTube Error: bad URL entered-->';
+ $id = jetpack_get_youtube_id( $url );
+
+ if ( ! $id ) {
+ return sprintf( '<!--%s-->', esc_html__( 'YouTube Error: bad URL entered', 'jetpack' ) );
}
$url = youtube_sanitize_url( $url );
- $url = parse_url( $url );
+ $url = wp_parse_url( $url );
- if ( ! isset( $url['query'] ) ) {
- return false;
+ $args = jetpack_shortcode_youtube_args( $url );
+ if ( empty( $args ) ) {
+ return sprintf( '<!--%s-->', esc_html__( 'YouTube Error: empty URL args', 'jetpack' ) );
}
- if ( isset( $url['fragment'] ) ) {
- wp_parse_str( $url['fragment'], $fargs );
- } else {
- $fargs = array();
- }
- wp_parse_str( $url['query'], $qargs );
-
- $qargs = array_merge( $fargs, $qargs );
-
- // calculate the width and height, taking content_width into consideration
- global $content_width;
-
- $input_w = ( isset( $qargs['w'] ) && intval( $qargs['w'] ) ) ? intval( $qargs['w'] ) : 0;
- $input_h = ( isset( $qargs['h'] ) && intval( $qargs['h'] ) ) ? intval( $qargs['h'] ) : 0;
+ list( $w, $h ) = jetpack_shortcode_youtube_dimensions( $args );
+ $rel = ( isset( $args['rel'] ) && '0' === $args['rel'] ) ? 0 : 1;
+ $search = ( isset( $args['showsearch'] ) && '1' === $args['showsearch'] ) ? 1 : 0;
+ $info = ( isset( $args['showinfo'] ) && '0' === $args['showinfo'] ) ? 0 : 1;
+ $iv = ( isset( $args['iv_load_policy'] ) && '3' === $args['iv_load_policy'] ) ? 3 : 1;
- // If we have $content_width, use it.
- if ( ! empty( $content_width ) ) {
- $default_width = $content_width;
- } else {
- // Otherwise get default width from the old, now deprecated embed_size_w option.
- $default_width = get_option( 'embed_size_w' );
- }
+ $fmt = ( isset( $args['fmt'] ) && intval( $args['fmt'] ) ) ? '&fmt=' . (int) $args['fmt'] : '';
- // If we don't know those 2 values use a hardcoded width.h
- if ( empty( $default_width ) ) {
- $default_width = 640;
- }
-
- if ( $input_w > 0 && $input_h > 0 ) {
- $w = $input_w;
- $h = $input_h;
- } elseif ( 0 == $input_w && 0 == $input_h ) {
- if ( isset( $qargs['fmt'] ) && intval( $qargs['fmt'] ) ) {
- $w = ( ! empty( $content_width ) ? min( $content_width, 480 ) : 480 );
- } else {
- $w = ( ! empty( $content_width ) ? min( $content_width, $default_width ) : $default_width );
- $h = ceil( ( $w / 16 ) * 9 );
- }
- } elseif ( $input_w > 0 ) {
- $w = $input_w;
- $h = ceil( ( $w / 16 ) * 9 );
- } else {
- if ( isset( $qargs['fmt'] ) && intval( $qargs['fmt'] ) ) {
- $w = ( ! empty( $content_width ) ? min( $content_width, 480 ) : 480 );
- } else {
- $w = ( ! empty( $content_width ) ? min( $content_width, $default_width ) : $default_width );
- $h = $input_h;
- }
- }
-
- /**
- * Filter the YouTube player width.
- *
- * @module shortcodes
- *
- * @since 1.1.0
- *
- * @param int $w Width of the YouTube player in pixels.
- */
- $w = (int) apply_filters( 'youtube_width', $w );
-
- /**
- * Filter the YouTube player height.
- *
- * @module shortcodes
- *
- * @since 1.1.0
- *
- * @param int $h Height of the YouTube player in pixels.
- */
- $h = (int) apply_filters( 'youtube_height', $h );
-
- $rel = ( isset( $qargs['rel'] ) && 0 == $qargs['rel'] ) ? 0 : 1;
- $search = ( isset( $qargs['showsearch'] ) && 1 == $qargs['showsearch'] ) ? 1 : 0;
- $info = ( isset( $qargs['showinfo'] ) && 0 == $qargs['showinfo'] ) ? 0 : 1;
- $iv = ( isset( $qargs['iv_load_policy'] ) && 3 == $qargs['iv_load_policy'] ) ? 3 : 1;
-
- $fmt = ( isset( $qargs['fmt'] ) && intval( $qargs['fmt'] ) ) ? '&fmt=' . (int) $qargs['fmt'] : '';
-
- if ( ! isset( $qargs['autohide'] ) || ( $qargs['autohide'] < 0 || 2 < $qargs['autohide'] ) ) {
+ if ( ! isset( $args['autohide'] ) || ( $args['autohide'] < 0 || 2 < $args['autohide'] ) ) {
$autohide = '&autohide=2';
} else {
- $autohide = '&autohide=' . absint( $qargs['autohide'] );
+ $autohide = '&autohide=' . absint( $args['autohide'] );
}
$start = 0;
- if ( isset( $qargs['start'] ) ) {
- $start = intval( $qargs['start'] );
- } elseif ( isset( $qargs['t'] ) ) {
- $time_pieces = preg_split( '/(?<=\D)(?=\d+)/', $qargs['t'] );
+ if ( isset( $args['start'] ) ) {
+ $start = intval( $args['start'] );
+ } elseif ( isset( $args['t'] ) ) {
+ $time_pieces = preg_split( '/(?<=\D)(?=\d+)/', $args['t'] );
foreach ( $time_pieces as $time_piece ) {
$int = (int) $time_piece;
@@ -275,17 +223,17 @@ function youtube_id( $url ) {
}
$start = $start ? '&start=' . $start : '';
- $end = ( isset( $qargs['end'] ) && intval( $qargs['end'] ) ) ? '&end=' . (int) $qargs['end'] : '';
- $hd = ( isset( $qargs['hd'] ) && intval( $qargs['hd'] ) ) ? '&hd=' . (int) $qargs['hd'] : '';
+ $end = ( isset( $args['end'] ) && intval( $args['end'] ) ) ? '&end=' . (int) $args['end'] : '';
+ $hd = ( isset( $args['hd'] ) && intval( $args['hd'] ) ) ? '&hd=' . (int) $args['hd'] : '';
- $vq = ( isset( $qargs['vq'] ) && in_array( $qargs['vq'], array( 'hd720', 'hd1080' ) ) ) ? '&vq=' . $qargs['vq'] : '';
+ $vq = ( isset( $args['vq'] ) && in_array( $args['vq'], array( 'hd720', 'hd1080' ), true ) ) ? '&vq=' . $args['vq'] : '';
- $cc = ( isset( $qargs['cc_load_policy'] ) ) ? '&cc_load_policy=1' : '';
- $cc_lang = ( isset( $qargs['cc_lang_pref'] ) ) ? '&cc_lang_pref=' . preg_replace( '/[^_a-z0-9-]/i', '', $qargs['cc_lang_pref'] ) : '';
+ $cc = ( isset( $args['cc_load_policy'] ) ) ? '&cc_load_policy=1' : '';
+ $cc_lang = ( isset( $args['cc_lang_pref'] ) ) ? '&cc_lang_pref=' . preg_replace( '/[^_a-z0-9-]/i', '', $args['cc_lang_pref'] ) : '';
- $wmode = ( isset( $qargs['wmode'] ) && in_array( strtolower( $qargs['wmode'] ), array( 'opaque', 'window', 'transparent' ) ) ) ? $qargs['wmode'] : 'transparent';
+ $wmode = ( isset( $args['wmode'] ) && in_array( strtolower( $args['wmode'] ), array( 'opaque', 'window', 'transparent' ), true ) ) ? $args['wmode'] : 'transparent';
- $theme = ( isset( $qargs['theme'] ) && in_array( strtolower( $qargs['theme'] ), array( 'dark', 'light' ) ) ) ? '&theme=' . $qargs['theme'] : '';
+ $theme = ( isset( $args['theme'] ) && in_array( strtolower( $args['theme'] ), array( 'dark', 'light' ), true ) ) ? '&theme=' . $args['theme'] : '';
$autoplay = '';
/**
@@ -297,21 +245,24 @@ function youtube_id( $url ) {
*
* @param bool false Enable autoplay for YouTube videos.
*/
- if ( apply_filters( 'jetpack_youtube_allow_autoplay', false ) && isset( $qargs['autoplay'] ) ) {
- $autoplay = '&autoplay=' . (int) $qargs['autoplay'];
+ if ( apply_filters( 'jetpack_youtube_allow_autoplay', false ) && isset( $args['autoplay'] ) ) {
+ $autoplay = '&autoplay=' . (int) $args['autoplay'];
}
- if ( ( isset( $url['path'] ) && '/videoseries' == $url['path'] ) || isset( $qargs['list'] ) ) {
+ if (
+ ( isset( $url['path'] ) && '/videoseries' === $url['path'] )
+ || isset( $args['list'] )
+ ) {
$html = "<iframe class='youtube-player' type='text/html' width='$w' height='$h' src='" . esc_url( "https://www.youtube.com/embed/videoseries?list=$id&hl=en_US" ) . "' allowfullscreen='true' style='border:0;'></iframe>";
} else {
- $html = "<iframe class='youtube-player' type='text/html' width='$w' height='$h' src='" . esc_url( "https://www.youtube.com/embed/$id?version=3&rel=$rel&fs=1$fmt$autohide&showsearch=$search&showinfo=$info&iv_load_policy=$iv$start$end$hd&wmode=$wmode$theme$autoplay{$cc}{$cc_lang}" ) . "' allowfullscreen='true' style='border:0;'></iframe>";
+ $html = "<iframe class='youtube-player' type='text/html' width='$w' height='$h' src='" . esc_url( "https://www.youtube.com/embed/$id?version=3&rel=$rel&fs=1$fmt$autohide&showsearch=$search&showinfo=$info&iv_load_policy=$iv$start$end$hd&wmode=$wmode$theme$autoplay$vq{$cc}{$cc_lang}" ) . "' allowfullscreen='true' style='border:0;'></iframe>";
}
- // Let's do some alignment wonder in a span, unless we're producing a feed
+ // Let's do some alignment wonder in a span, unless we're producing a feed.
if ( ! is_feed() ) {
$alignmentcss = 'text-align:center;';
- if ( isset( $qargs['align'] ) ) {
- switch ( $qargs['align'] ) {
+ if ( isset( $args['align'] ) ) {
+ switch ( $args['align'] ) {
case 'left':
$alignmentcss = "float:left; width:{$w}px; height:{$h}px; margin-right:10px; margin-bottom: 10px;";
break;
@@ -343,24 +294,177 @@ function youtube_id( $url ) {
return $html;
}
-function youtube_shortcode( $atts ) {
- return youtube_id( ( isset( $atts[0] ) ) ? ltrim( $atts[0], '=' ) : shortcode_new_to_old_params( $atts ) );
+/**
+ * Gets the args present in the YouTube shortcode URL.
+ *
+ * @since 8.0.0
+ *
+ * @param string $url The URL of the shortcode.
+ *
+ * @return array|false The query args of the URL, or false.
+ */
+function jetpack_shortcode_youtube_args( $url ) {
+ $qargs = array();
+ if ( ! empty( $url['query'] ) ) {
+ wp_parse_str( $url['query'], $qargs );
+ } else {
+ return false;
+ }
+
+ $fargs = array();
+ if ( ! empty( $url['fragment'] ) ) {
+ wp_parse_str( $url['fragment'], $fargs );
+ }
+
+ return array_merge( $fargs, $qargs );
}
+/**
+ * Display the Youtube shortcode.
+ *
+ * @param array $atts Shortcode attributes.
+ *
+ * @return string The rendered shortcode.
+ */
+function youtube_shortcode( $atts ) {
+ $url = ( isset( $atts[0] ) ) ? ltrim( $atts[0], '=' ) : shortcode_new_to_old_params( $atts );
+
+ if (
+ class_exists( 'Jetpack_AMP_Support' )
+ && Jetpack_AMP_Support::is_amp_request()
+ ) {
+ return jetpack_amp_youtube_shortcode( $url );
+ } else {
+ return youtube_id( $url );
+ }
+}
add_shortcode( 'youtube', 'youtube_shortcode' );
/**
+ * Renders the [youtube] shortcode as an AMP component.
+ *
+ * @since 8.0.0
+ *
+ * @param string $url The YouTube URL.
+ *
+ * @return string The AMP-compatible rendered shortcode.
+ */
+function jetpack_amp_youtube_shortcode( $url ) {
+ $video_id = jetpack_get_youtube_id( $url );
+ if ( empty( $video_id ) ) {
+ return sprintf(
+ '<a href="%1$s" class="amp-wp-embed-fallback">%1$s</a>',
+ esc_url( $url )
+ );
+ }
+
+ $sanitized_url = youtube_sanitize_url( $url );
+ $parsed_url = wp_parse_url( $sanitized_url );
+ $args = jetpack_shortcode_youtube_args( $parsed_url );
+ list( $width, $height ) = jetpack_shortcode_youtube_dimensions( $args );
+ return sprintf(
+ '<amp-youtube data-videoid="%s" layout="responsive" width="%d" height="%d"></amp-youtube>',
+ esc_attr( $video_id ),
+ absint( $width ),
+ absint( $height )
+ );
+}
+
+/**
+ * Gets the dimensions of the [youtube] shortcode.
+ *
+ * Calculates the width and height, taking $content_width into consideration.
+ *
+ * @since 8.0.0
+ *
+ * @param array $query_args The query args of the URL.
+ *
+ * @return array The width and height of the shortcode.
+ */
+function jetpack_shortcode_youtube_dimensions( $query_args ) {
+ global $content_width;
+
+ $input_w = ( isset( $query_args['w'] ) && intval( $query_args['w'] ) ) ? intval( $query_args['w'] ) : 0;
+ $input_h = ( isset( $query_args['h'] ) && intval( $query_args['h'] ) ) ? intval( $query_args['h'] ) : 0;
+
+ // If we have $content_width, use it.
+ if ( ! empty( $content_width ) ) {
+ $default_width = $content_width;
+ } else {
+ // Otherwise get default width from the old, now deprecated embed_size_w option.
+ $default_width = get_option( 'embed_size_w' );
+ }
+
+ // If we don't know those 2 values use a hardcoded width.
+ if ( empty( $default_width ) ) {
+ $default_width = 640;
+ }
+
+ if ( $input_w > 0 && $input_h > 0 ) {
+ $w = $input_w;
+ $h = $input_h;
+ } elseif ( 0 === $input_w && 0 === $input_h ) {
+ if ( isset( $query_args['fmt'] ) && intval( $query_args['fmt'] ) ) {
+ $w = ( ! empty( $content_width ) ? min( $content_width, 480 ) : 480 );
+ } else {
+ $w = ( ! empty( $content_width ) ? min( $content_width, $default_width ) : $default_width );
+ $h = ceil( ( $w / 16 ) * 9 );
+ }
+ } elseif ( $input_w > 0 ) {
+ $w = $input_w;
+ $h = ceil( ( $w / 16 ) * 9 );
+ } else {
+ if ( isset( $query_args['fmt'] ) && intval( $query_args['fmt'] ) ) {
+ $w = ( ! empty( $content_width ) ? min( $content_width, 480 ) : 480 );
+ } else {
+ $w = ( ! empty( $content_width ) ? min( $content_width, $default_width ) : $default_width );
+ $h = $input_h;
+ }
+ }
+
+ /**
+ * Filter the YouTube player width.
+ *
+ * @module shortcodes
+ *
+ * @since 1.1.0
+ *
+ * @param int $w Width of the YouTube player in pixels.
+ */
+ $w = (int) apply_filters( 'youtube_width', $w );
+
+ /**
+ * Filter the YouTube player height.
+ *
+ * @module shortcodes
+ *
+ * @since 1.1.0
+ *
+ * @param int $h Height of the YouTube player in pixels.
+ */
+ $h = (int) apply_filters( 'youtube_height', $h );
+
+ return array( $w, $h );
+}
+
+/**
* For bare URLs on their own line of the form
* http://www.youtube.com/v/9FhMMmqzbD8?fs=1&hl=en_US
+ *
+ * @param array $matches Regex partial matches against the URL passed.
+ * @param array $attr Attributes received in embed response.
+ * @param array $url Requested URL to be embedded.
*/
function wpcom_youtube_embed_crazy_url( $matches, $attr, $url ) {
return youtube_id( $url );
}
+/**
+ * Add a new handler to automatically transform custom Youtube URLs (like playlists) into embeds.
+ */
function wpcom_youtube_embed_crazy_url_init() {
wp_embed_register_handler( 'wpcom_youtube_embed_crazy_url', '#https?://(?:www\.)?(?:youtube.com/(?:v/|playlist|watch[/\#?])|youtu\.be/).*#i', 'wpcom_youtube_embed_crazy_url' );
}
-
add_action( 'init', 'wpcom_youtube_embed_crazy_url_init' );
/**
@@ -373,8 +477,11 @@ add_action( 'init', 'wpcom_youtube_embed_crazy_url_init' );
* @param int get_option('embed_autourls') Option to automatically embed all plain text URLs.
*/
if ( ! is_admin() && apply_filters( 'jetpack_comments_allow_oembed', true ) ) {
- // We attach wp_kses_post to comment_text in default-filters.php with priority of 10 anyway, so the iframe gets filtered out.
- // Higher priority because we need it before auto-link and autop get to it
+ /*
+ * We attach wp_kses_post to comment_text in default-filters.php with priority of 10 anyway,
+ * so the iframe gets filtered out.
+ * Higher priority because we need it before auto-link and autop get to it.
+ */
add_filter( 'comment_text', 'youtube_link', 1 );
}
@@ -385,6 +492,8 @@ if ( ! is_admin() && apply_filters( 'jetpack_comments_allow_oembed', true ) ) {
* This removes the "=" from the shortcode so it can be parsed.
*
* @see https://github.com/Automattic/jetpack/issues/3121
+ *
+ * @param string $content HTML content.
*/
function jetpack_fix_youtube_shortcode_display_filter( $content ) {
if ( strpos( $content, '[youtube=' ) !== false ) {
diff --git a/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js b/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js
index ad8cc71d..b2d135d3 100644
--- a/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js
+++ b/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js
@@ -4,10 +4,8 @@
* of simple-payments module.
*/
-/* global paypal */
-/* global jQuery */
+/* global paypal, jQuery */
/* exported PaypalExpressCheckout */
-/* jshint unused:false, es3:false, esversion:5 */
var PaypalExpressCheckout = {
primaryCssClassName: 'jetpack-simple-payments',
messageCssClassName: 'jetpack-simple-payments-purchase-message',
diff --git a/plugins/jetpack/modules/simple-payments/simple-payments.php b/plugins/jetpack/modules/simple-payments/simple-payments.php
index e1b7f8d7..c68381de 100644
--- a/plugins/jetpack/modules/simple-payments/simple-payments.php
+++ b/plugins/jetpack/modules/simple-payments/simple-payments.php
@@ -13,6 +13,8 @@ class Jetpack_Simple_Payments {
static $css_classname_prefix = 'jetpack-simple-payments';
+ static $required_plan;
+
// Increase this number each time there's a change in CSS or JS to bust cache.
static $version = '0.25';
@@ -23,6 +25,7 @@ class Jetpack_Simple_Payments {
if ( ! self::$instance ) {
self::$instance = new self();
self::$instance->register_init_hooks();
+ self::$required_plan = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? 'value_bundle' : 'jetpack_premium';
}
return self::$instance;
}
@@ -64,7 +67,14 @@ class Jetpack_Simple_Payments {
if ( $this->is_enabled_jetpack_simple_payments() ) {
jetpack_register_block( 'jetpack/simple-payments' );
} else {
- Jetpack_Gutenberg::set_extension_unavailable( 'jetpack/simple-payments', 'missing_plan' );
+ Jetpack_Gutenberg::set_extension_unavailable(
+ 'jetpack/simple-payments',
+ 'missing_plan',
+ array(
+ 'required_feature' => 'simple-payments',
+ 'required_plan' => self::$required_plan,
+ )
+ );
}
}
@@ -146,7 +156,10 @@ class Jetpack_Simple_Payments {
}
if ( ! $this->is_enabled_jetpack_simple_payments() ) {
- return $this->output_admin_warning( $data );
+ if ( ! is_feed() ) {
+ $this->output_admin_warning( $data );
+ }
+ return;
}
if ( ! wp_script_is( 'paypal-express-checkout', 'enqueued' ) ) {
@@ -168,38 +181,11 @@ class Jetpack_Simple_Payments {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
- $css_prefix = self::$css_classname_prefix;
-
- $support_url = ( defined( 'IS_WPCOM' ) && IS_WPCOM )
- ? 'https://support.wordpress.com/simple-payments/'
- : 'https://jetpack.com/support/simple-payment-button/';
- return sprintf( '
-<div class="%1$s">
- <div class="%2$s">
- <div class="%3$s">
- <div class="%4$s" id="%5$s">
- <p>%6$s</p>
- <p>%7$s</p>
- </div>
- </div>
- </div>
-</div>
-',
- esc_attr( "{$data['class']} ${css_prefix}-wrapper" ),
- esc_attr( "${css_prefix}-product" ),
- esc_attr( "${css_prefix}-details" ),
- esc_attr( "${css_prefix}-purchase-message show error" ),
- esc_attr( "{$data['dom_id']}-message-container" ),
- sprintf(
- wp_kses(
- __( 'Your plan doesn\'t include Simple Payments. <a href="%s" rel="noopener noreferrer" target="_blank">Learn more and upgrade</a>.', 'jetpack' ),
- array( 'a' => array( 'href' => array(), 'rel' => array(), 'target' => array() ) )
- ),
- esc_url( $support_url )
- ),
- esc_html__( '(Only administrators will see this message.)', 'jetpack' )
- );
+ jetpack_require_lib( 'components' );
+ return Jetpack_Components::render_upgrade_nudge( array(
+ 'plan' => self::$required_plan
+ ) );
}
function output_shortcode( $data ) {
@@ -247,9 +233,9 @@ class Jetpack_Simple_Payments {
$image,
esc_attr( "${css_prefix}-details" ),
esc_attr( "${css_prefix}-title" ),
- $data['title'],
+ esc_html( $data['title'] ),
esc_attr( "${css_prefix}-description" ),
- $data['description'],
+ wp_kses( $data['description'], wp_kses_allowed_html( 'post' ) ),
esc_attr( "${css_prefix}-price" ),
esc_html( $data['price'] ),
esc_attr( "${css_prefix}-purchase-message" ),
@@ -391,11 +377,16 @@ class Jetpack_Simple_Payments {
/**
* Sanitize three-character ISO-4217 Simple payments currency
*
- * List has to be in sync with list at the client side:
- * @link https://github.com/Automattic/wp-calypso/blob/6d02ffe73cc073dea7270a22dc30881bff17d8fb/client/lib/simple-payments/constants.js
+ * List has to be in sync with list at the block's client side and widget's backend side:
+ * @link https://github.com/Automattic/jetpack/blob/31efa189ad223c0eb7ad085ac0650a23facf9ef5/extensions/blocks/simple-payments/constants.js#L9-L39
+ * @link https://github.com/Automattic/jetpack/blob/31efa189ad223c0eb7ad085ac0650a23facf9ef5/modules/widgets/simple-payments.php#L19-L44
*
* Currencies should be supported by PayPal:
- * @link https://developer.paypal.com/docs/integration/direct/rest/currency-codes/
+ * @link https://developer.paypal.com/docs/api/reference/currency-codes/
+ *
+ * Indian Rupee (INR) not supported because at the time of the creation of this file
+ * because it's limited to in-country PayPal India accounts only.
+ * Discussion: https://github.com/Automattic/wp-calypso/pull/28236
*/
public static function sanitize_currency( $currency ) {
$valid_currencies = array(
diff --git a/plugins/jetpack/modules/site-icon.php b/plugins/jetpack/modules/site-icon.php
deleted file mode 100644
index af374467..00000000
--- a/plugins/jetpack/modules/site-icon.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed. Site Icons are in Core.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-builder.php b/plugins/jetpack/modules/sitemaps/sitemap-builder.php
index e04f58d5..d6077c0f 100644
--- a/plugins/jetpack/modules/sitemaps/sitemap-builder.php
+++ b/plugins/jetpack/modules/sitemaps/sitemap-builder.php
@@ -998,7 +998,7 @@ class Jetpack_Sitemap_Builder {
/**
* Construct the sitemap index url entry for a sitemap row.
*
- * @link http://www.sitemaps.org/protocol.html#sitemapIndex_sitemap
+ * @link https://www.sitemaps.org/protocol.html#sitemapIndex_sitemap
*
* @access private
* @since 4.8.0
@@ -1104,7 +1104,7 @@ class Jetpack_Sitemap_Builder {
/**
* Construct the sitemap url entry for a WP_Post.
*
- * @link http://www.sitemaps.org/protocol.html#urldef
+ * @link https://www.sitemaps.org/protocol.html#urldef
* @access private
* @since 4.8.0
*
@@ -1182,7 +1182,7 @@ class Jetpack_Sitemap_Builder {
/**
* Construct the image sitemap url entry for a WP_Post of image type.
*
- * @link http://www.sitemaps.org/protocol.html#urldef
+ * @link https://www.sitemaps.org/protocol.html#urldef
*
* @access private
* @since 4.8.0
@@ -1267,7 +1267,7 @@ class Jetpack_Sitemap_Builder {
/**
* Construct the video sitemap url entry for a WP_Post of video type.
*
- * @link http://www.sitemaps.org/protocol.html#urldef
+ * @link https://www.sitemaps.org/protocol.html#urldef
* @link https://developers.google.com/webmasters/videosearch/sitemaps
*
* @access private
@@ -1377,7 +1377,7 @@ class Jetpack_Sitemap_Builder {
/**
* Construct the news sitemap url entry for a WP_Post.
*
- * @link http://www.sitemaps.org/protocol.html#urldef
+ * @link https://www.sitemaps.org/protocol.html#urldef
*
* @access private
* @since 4.8.0
@@ -1417,7 +1417,7 @@ class Jetpack_Sitemap_Builder {
/*
* Trim the locale to an ISO 639 language code as required by Google.
* Special cases are zh-cn (Simplified Chinese) and zh-tw (Traditional Chinese).
- * @link http://www.loc.gov/standards/iso639-2/php/code_list.php
+ * @link https://www.loc.gov/standards/iso639-2/php/code_list.php
*/
$language = strtolower( get_locale() );
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-constants.php b/plugins/jetpack/modules/sitemaps/sitemap-constants.php
index e91a3341..ed0ccad0 100644
--- a/plugins/jetpack/modules/sitemaps/sitemap-constants.php
+++ b/plugins/jetpack/modules/sitemaps/sitemap-constants.php
@@ -8,10 +8,26 @@
*/
/**
+ * Number of seconds between sitemap and news sitemap updates in development code.
+ * In production, sitemaps are cached for 12 hours.
+ * In development, sitemaps are cache for 1 minute.
+ *
+ * @since 7.7.0
+ */
+if ( defined( 'JETPACK_DEV_DEBUG' ) && JETPACK_DEV_DEBUG ) {
+ if ( ! defined( 'JP_SITEMAP_INTERVAL') ) {
+ define( 'JP_SITEMAP_INTERVAL', 60 );
+ }
+ if ( ! defined( 'JP_NEWS_SITEMAP_INTERVAL') ) {
+ define( 'JP_NEWS_SITEMAP_INTERVAL', 60 );
+ }
+}
+
+/**
* Maximum size (in bytes) of a sitemap xml file.
* Max is 716800 = 700kb to avoid potential failures for default memcached limits (1MB)
*
- * @link http://www.sitemaps.org/
+ * @link https://www.sitemaps.org/
* @since 4.8.0
*/
if ( ! defined( 'JP_SITEMAP_MAX_BYTES' ) ) {
@@ -22,7 +38,7 @@ if ( ! defined( 'JP_SITEMAP_MAX_BYTES' ) ) {
* Maximum size (in url nodes) of a sitemap xml file.
* Per the spec, max value is 50000.
*
- * @link http://www.sitemaps.org/
+ * @link https://www.sitemaps.org/
* @since 4.8.0
*/
if ( ! defined( 'JP_SITEMAP_MAX_ITEMS' ) ) {
@@ -77,7 +93,7 @@ if ( ! defined( 'JP_SITEMAP_LOCK_INTERVAL' ) ) {
}
/**
- * Cache lifetime of news sitemap (in seconds).
+ * Number of seconds between news sitemap updates.
*
* @since 4.8.0
*/
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-stylist.php b/plugins/jetpack/modules/sitemaps/sitemap-stylist.php
index ce883d7f..117e9bf5 100644
--- a/plugins/jetpack/modules/sitemaps/sitemap-stylist.php
+++ b/plugins/jetpack/modules/sitemaps/sitemap-stylist.php
@@ -33,7 +33,7 @@ class Jetpack_Sitemap_Stylist {
*
* @access private
* @since 4.8.0
- * @link http://php.net/manual/en/function.vsprintf.php Format string documentation.
+ * @link https://php.net/manual/en/function.vsprintf.php Format string documentation.
*
* @param string $format A vsprintf-style format string to be sanitized.
* @param array $url_array The string substitution array to be passed to vsprintf.
@@ -74,7 +74,7 @@ class Jetpack_Sitemap_Stylist {
'jetpack'
),
array(
- 1 => 'http://jetpack.com/',
+ 1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
@@ -86,7 +86,7 @@ class Jetpack_Sitemap_Stylist {
'jetpack'
),
array(
- 1 => 'http://sitemaps.org',
+ 1 => 'https://sitemaps.org',
)
);
@@ -186,7 +186,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://jetpack.com/',
+ 1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
@@ -206,7 +206,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://sitemaps.org',
+ 1 => 'https://sitemaps.org',
)
);
@@ -314,7 +314,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://jetpack.com/',
+ 1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
@@ -326,7 +326,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://sitemaps.org',
+ 1 => 'https://sitemaps.org',
)
);
@@ -454,7 +454,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://jetpack.com/',
+ 1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
@@ -466,7 +466,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://sitemaps.org',
+ 1 => 'https://sitemaps.org',
)
);
@@ -547,7 +547,7 @@ $css
<xsl:value-of select='video:video/video:title'/>
</td>
<td>
- <xsl:value-of select='video:video/video:description'/>
+ <xsl:value-of select='video:video/video:description' disable-output-escaping='yes'/>
</td>
<td>
<xsl:value-of select='sitemap:lastmod'/>
@@ -594,7 +594,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://jetpack.com/',
+ 1 => 'https://jetpack.com/',
2 => 'https://www.google.com/',
3 => 'https://www.bing.com/',
)
@@ -606,7 +606,7 @@ XSL;
'jetpack'
),
array(
- 1 => 'http://sitemaps.org',
+ 1 => 'https://sitemaps.org',
)
);
@@ -773,7 +773,7 @@ XSL;
border-bottom: none;
}
- img.thumbnail {
+ img {
max-height: 100px;
max-width: 100px;
}
diff --git a/plugins/jetpack/modules/sitemaps/sitemaps.php b/plugins/jetpack/modules/sitemaps/sitemaps.php
index 7078fb8a..9fcd0529 100644
--- a/plugins/jetpack/modules/sitemaps/sitemaps.php
+++ b/plugins/jetpack/modules/sitemaps/sitemaps.php
@@ -1,4 +1,4 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
/**
* Generate sitemap files in base XML as well as some namespace extensions.
*
@@ -14,7 +14,7 @@
* well as the home url. To include other post types use the 'jetpack_sitemap_post_types'
* filter.
*
- * @link http://sitemaps.org/protocol.php Base sitemaps protocol.
+ * @link https://www.sitemaps.org/protocol.html Base sitemaps protocol.
* @link https://support.google.com/webmasters/answer/178636 Image sitemap extension.
* @link https://developers.google.com/webmasters/videosearch/sitemaps Video sitemap extension.
*
@@ -23,7 +23,7 @@
* completeness, instead including at most 1000 of the most recent published posts
* from the previous 2 days, per the news-sitemap spec.
*
- * @link http://www.google.com/support/webmasters/bin/answer.py?answer=74288 News sitemap extension.
+ * @link https://support.google.com/webmasters/answer/74288 News sitemap extension.
*
* @package Jetpack
* @since 3.9.0
@@ -170,7 +170,7 @@ class Jetpack_Sitemap_Manager {
);
}
- echo $the_content;
+ echo $the_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content created by Jetpack.
die();
}
@@ -230,9 +230,9 @@ class Jetpack_Sitemap_Manager {
JP_MASTER_SITEMAP_TYPE
);
- // if there is no master sitemap yet, let's just return an empty sitemap with a short TTL instead of a 404
+ // if there is no master sitemap yet, let's just return an empty sitemap with a short TTL instead of a 404.
if ( empty( $sitemap_content ) ) {
- $builder = new Jetpack_Sitemap_Builder();
+ $builder = new Jetpack_Sitemap_Builder();
$sitemap_content = $builder->empty_sitemap_xml();
}
@@ -437,10 +437,21 @@ class Jetpack_Sitemap_Manager {
*
* @module sitemaps
* @since 3.9.0
+ * @deprecated 7.4.0
*
* @param bool $discover_sitemap Make default sitemap discoverable to robots.
*/
- $discover_sitemap = apply_filters( 'jetpack_sitemap_generate', true );
+ $discover_sitemap = apply_filters_deprecated( 'jetpack_sitemap_generate', array( true ), 'jetpack-7.4.0', 'jetpack_sitemap_include_in_robotstxt' );
+
+ /**
+ * Filter whether to make the default sitemap discoverable to robots or not. Default true.
+ *
+ * @module sitemaps
+ * @since 7.4.0
+ *
+ * @param bool $discover_sitemap Make default sitemap discoverable to robots.
+ */
+ $discover_sitemap = apply_filters( 'jetpack_sitemap_include_in_robotstxt', $discover_sitemap );
if ( true === $discover_sitemap ) {
$sitemap_url = $this->finder->construct_sitemap_url( 'sitemap.xml' );
@@ -452,10 +463,21 @@ class Jetpack_Sitemap_Manager {
*
* @module sitemaps
* @since 3.9.0
+ * @deprecated 7.4.0
+ *
+ * @param bool $discover_news_sitemap Make default news sitemap discoverable to robots.
+ */
+ $discover_news_sitemap = apply_filters_deprecated( 'jetpack_news_sitemap_generate', array( true ), 'jetpack-7.4.0', 'jetpack_news_sitemap_include_in_robotstxt' );
+
+ /**
+ * Filter whether to make the news sitemap discoverable to robots or not. Default true.
+ *
+ * @module sitemaps
+ * @since 7.4.0
*
* @param bool $discover_news_sitemap Make default news sitemap discoverable to robots.
*/
- $discover_news_sitemap = apply_filters( 'jetpack_news_sitemap_generate', true );
+ $discover_news_sitemap = apply_filters( 'jetpack_news_sitemap_include_in_robotstxt', $discover_news_sitemap );
if ( true === $discover_news_sitemap ) {
$news_sitemap_url = $this->finder->construct_sitemap_url( 'news-sitemap.xml' );
@@ -524,7 +546,7 @@ class Jetpack_Sitemap_Manager {
* This way we don't have to wait for init to finish before building sitemaps.
*
* @link https://tools.ietf.org/html/rfc3986#section-3.3 RFC 3986
- * @link http://www.sitemaps.org/ The sitemap protocol
+ * @link https://www.sitemaps.org/ The sitemap protocol
*
* @since 4.8.0
*/
diff --git a/plugins/jetpack/modules/social-links.php b/plugins/jetpack/modules/social-links.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/social-links.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/sso.php b/plugins/jetpack/modules/sso.php
index 34b9609c..1d548213 100644
--- a/plugins/jetpack/modules/sso.php
+++ b/plugins/jetpack/modules/sso.php
@@ -1,18 +1,21 @@
<?php
+
+use Automattic\Jetpack\Roles;
+use Automattic\Jetpack\Tracking;
+
require_once( JETPACK__PLUGIN_DIR . 'modules/sso/class.jetpack-sso-helpers.php' );
require_once( JETPACK__PLUGIN_DIR . 'modules/sso/class.jetpack-sso-notices.php' );
/**
* Module Name: Secure Sign On
- * Module Description: Allow users to log into this site using WordPress.com accounts
- * Jumpstart Description: Lets you log in to all your Jetpack-enabled sites with one click using your WordPress.com account.
+ * Module Description: Allow users to log in to this site using WordPress.com accounts
* Sort Order: 30
* Recommendation Order: 5
* First Introduced: 2.6
* Requires Connection: Yes
* Auto Activate: No
* Module Tags: Developers
- * Feature: Security, Jumpstart
+ * Feature: Security
* Additional Search Queries: sso, single sign on, login, log in
*/
@@ -319,6 +322,8 @@ class Jetpack_SSO {
function login_init() {
global $action;
+ $tracking = new Tracking();
+
if ( Jetpack_SSO_Helpers::should_hide_login_form() ) {
/**
* Since the default authenticate filters fire at priority 20 for checking username and password,
@@ -360,7 +365,7 @@ class Jetpack_SSO {
Jetpack_options::update_option( 'sso_first_login', true );
}
- JetpackTracking::record_user_event( 'sso_login_redirect_success' );
+ $tracking->record_user_event( 'sso_login_redirect_success' );
wp_safe_redirect( $sso_url );
exit;
}
@@ -379,7 +384,7 @@ class Jetpack_SSO {
add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) );
$reauth = ! empty( $_GET['force_reauth'] );
$sso_url = $this->get_sso_url_or_die( $reauth );
- JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' );
+ $tracking->record_user_event( 'sso_login_redirect_bypass_success' );
wp_safe_redirect( $sso_url );
exit;
}
@@ -591,7 +596,7 @@ class Jetpack_SSO {
if ( ! $wpcom_user_id = get_user_meta( $user_id, 'wpcom_user_id', true ) ) {
return;
}
- Jetpack::load_xml_rpc_client();
+
$xml = new Jetpack_IXR_Client( array(
'wpcom_user_id' => $user_id,
) );
@@ -615,7 +620,6 @@ class Jetpack_SSO {
: false;
if ( ! $nonce ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id(),
) );
@@ -647,7 +651,6 @@ class Jetpack_SSO {
$wpcom_nonce = sanitize_key( $_GET['sso_nonce'] );
$wpcom_user_id = (int) $_GET['user_id'];
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_Client( array(
'user_id' => get_current_user_id(),
) );
@@ -674,10 +677,12 @@ class Jetpack_SSO {
*/
do_action( 'jetpack_sso_pre_handle_login', $user_data );
+ $tracking = new Tracking();
+
if ( Jetpack_SSO_Helpers::is_two_step_required() && 0 === (int) $user_data->two_step_enabled ) {
$this->user_data = $user_data;
- JetpackTracking::record_user_event( 'sso_login_failed', array(
+ $tracking->record_user_event( 'sso_login_failed', array(
'error_message' => 'error_msg_enable_two_step'
) );
@@ -724,7 +729,7 @@ class Jetpack_SSO {
$user = Jetpack_SSO_Helpers::generate_user( $user_data );
if ( ! $user ) {
- JetpackTracking::record_user_event( 'sso_login_failed', array(
+ $tracking->record_user_event( 'sso_login_failed', array(
'error_message' => 'could_not_create_username'
) );
add_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'error_unable_to_create_user' ) );
@@ -735,7 +740,7 @@ class Jetpack_SSO {
? 'user_created_new_user_override'
: 'user_created_users_can_register';
} else {
- JetpackTracking::record_user_event( 'sso_login_failed', array(
+ $tracking->record_user_event( 'sso_login_failed', array(
'error_message' => 'error_msg_email_already_exists'
) );
@@ -781,12 +786,13 @@ class Jetpack_SSO {
$json_api_auth_environment = Jetpack_SSO_Helpers::get_json_api_auth_environment();
- $is_json_api_auth = ! empty( $json_api_auth_environment );
+ $is_json_api_auth = ! empty( $json_api_auth_environment );
$is_user_connected = Jetpack::is_user_connected( $user->ID );
- JetpackTracking::record_user_event( 'sso_user_logged_in', array(
+ $roles = new Roles();
+ $tracking->record_user_event( 'sso_user_logged_in', array(
'user_found_with' => $user_found_with,
'user_connected' => (bool) $is_user_connected,
- 'user_role' => Jetpack::translate_current_user_to_role(),
+ 'user_role' => $roles->translate_current_user_to_role(),
'is_json_api_auth' => (bool) $is_json_api_auth,
) );
@@ -795,16 +801,12 @@ class Jetpack_SSO {
Jetpack::init()->store_json_api_authorization_token( $user->user_login, $user );
} else if ( ! $is_user_connected ) {
- $calypso_env = ! empty( $_GET['calypso_env'] )
- ? sanitize_key( $_GET['calypso_env'] )
- : '';
-
wp_safe_redirect(
add_query_arg(
array(
'redirect_to' => $redirect_to,
'request_redirect_to' => $_request_redirect_to,
- 'calypso_env' => $calypso_env,
+ 'calypso_env' => Jetpack::get_calypso_env(),
'jetpack-sso-auth-redirect' => '1',
),
admin_url()
@@ -823,7 +825,7 @@ class Jetpack_SSO {
add_filter( 'jetpack_sso_default_to_sso_login', '__return_false' );
- JetpackTracking::record_user_event( 'sso_login_failed', array(
+ $tracking->record_user_event( 'sso_login_failed', array(
'error_message' => 'cant_find_user'
) );
@@ -899,7 +901,8 @@ class Jetpack_SSO {
$error_message = sanitize_text_field(
sprintf( '%s: %s', $sso_redirect->get_error_code(), $sso_redirect->get_error_message() )
);
- JetpackTracking::record_user_event( 'sso_login_redirect_failed', array(
+ $tracking = new Tracking();
+ $tracking->record_user_event( 'sso_login_redirect_failed', array(
'error_message' => $error_message
) );
wp_die( $error_message );
diff --git a/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php b/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php
index 307e3786..1bb0cb18 100644
--- a/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php
+++ b/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php
@@ -192,7 +192,7 @@ class Jetpack_SSO_Helpers {
$hosts[] = 'public-api.wordpress.com';
if ( false === strpos( $api_base, 'jetpack.wordpress.com/jetpack' ) ) {
- $base_url_parts = parse_url( esc_url_raw( $api_base ) );
+ $base_url_parts = wp_parse_url( esc_url_raw( $api_base ) );
if ( $base_url_parts && ! empty( $base_url_parts[ 'host' ] ) ) {
$hosts[] = $base_url_parts[ 'host' ];
}
diff --git a/plugins/jetpack/modules/sso/jetpack-sso-login.js b/plugins/jetpack/modules/sso/jetpack-sso-login.js
index a37feeb5..18080f8a 100644
--- a/plugins/jetpack/modules/sso/jetpack-sso-login.js
+++ b/plugins/jetpack/modules/sso/jetpack-sso-login.js
@@ -2,6 +2,7 @@ jQuery( document ).ready( function( $ ) {
var body = $( 'body' ),
toggleSSO = $( '.jetpack-sso-toggle' ),
userLogin = $( '#user_login' ),
+ userPassword = $( '#user_pass' ),
ssoWrap = $( '#jetpack-sso-wrap' ),
loginForm = $( '#loginform' ),
overflow = $( '<div class="jetpack-sso-clear"></div>' );
@@ -27,6 +28,7 @@ jQuery( document ).ready( function( $ ) {
body.toggleClass( 'jetpack-sso-form-display' );
if ( ! body.hasClass( 'jetpack-sso-form-display' ) ) {
userLogin.focus();
+ userPassword.prop( 'disabled', false );
}
} );
} );
diff --git a/plugins/jetpack/modules/stats.php b/plugins/jetpack/modules/stats.php
index 56ff817d..362793b8 100644
--- a/plugins/jetpack/modules/stats.php
+++ b/plugins/jetpack/modules/stats.php
@@ -14,6 +14,9 @@
* @package Jetpack
*/
+use Automattic\Jetpack\Tracking;
+use Automattic\Jetpack\Connection\Client;
+
if ( defined( 'STATS_VERSION' ) ) {
return;
}
@@ -166,7 +169,7 @@ function stats_map_meta_caps( $caps, $cap, $user_id ) {
* @return void
*/
function stats_template_redirect() {
- global $current_user, $rendered_stats_footer;
+ global $current_user;
if ( is_feed() || is_robots() || is_trackback() || is_preview() || jetpack_is_dnt_enabled() ) {
return;
@@ -181,9 +184,7 @@ function stats_template_redirect() {
}
add_action( 'wp_footer', 'stats_footer', 101 );
- add_action( 'wp_head', 'stats_add_shutdown_action' );
- $rendered_stats_footer = false;
}
@@ -222,16 +223,6 @@ function stats_build_view_data() {
return compact( 'v', 'j', 'blog', 'post', 'tz', 'srv' );
}
-/**
- * Stats Add Shutdown Action.
- *
- * @access public
- * @return void
- */
-function stats_add_shutdown_action() {
- // Just in case wp_footer isn't in your theme.
- add_action( 'shutdown', 'stats_footer', 101 );
-}
/**
* Stats Footer.
@@ -240,17 +231,13 @@ function stats_add_shutdown_action() {
* @return void
*/
function stats_footer() {
- global $rendered_stats_footer;
-
- if ( ! $rendered_stats_footer ) {
- $data = stats_build_view_data();
- if ( Jetpack_AMP_Support::is_amp_request() ) {
- stats_render_amp_footer( $data );
- } else {
- stats_render_footer( $data );
- }
- $rendered_stats_footer = true;
+ $data = stats_build_view_data();
+ if ( Jetpack_AMP_Support::is_amp_request() ) {
+ stats_render_amp_footer( $data );
+ } else {
+ stats_render_footer( $data );
}
+
}
function stats_render_footer( $data ) {
@@ -682,7 +669,7 @@ function stats_reports_page( $main_chart_only = false ) {
$timeout = 90;
$user_id = JETPACK_MASTER_USER; // means send the wp.com user_id
- $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) );
+ $get = Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) );
$get_code = wp_remote_retrieve_response_code( $get );
if ( is_wp_error( $get ) || ( 2 !== intval( $get_code / 100 ) && 304 !== $get_code ) || empty( $get['body'] ) ) {
stats_print_wp_remote_error( $get, $url );
@@ -705,7 +692,8 @@ function stats_reports_page( $main_chart_only = false ) {
}
if ( isset( $_GET['page'] ) && 'stats' === $_GET['page'] && ! isset( $_GET['chart'] ) ) {
- JetpackTracking::record_user_event( 'wpa_page_view', array( 'path' => 'old_stats' ) );
+ $tracking = new Tracking();
+ $tracking->record_user_event( 'wpa_page_view', array( 'path' => 'old_stats' ) );
}
if ( isset( $_GET['noheader'] ) ) {
@@ -844,7 +832,7 @@ function stats_admin_bar_head() {
add_action( 'admin_bar_menu', 'stats_admin_bar_menu', 100 );
?>
-<style type='text/css'>
+<style data-ampdevmode type='text/css'>
#wpadminbar .quicklinks li#wp-admin-bar-stats {
height: 32px;
}
@@ -890,14 +878,10 @@ function stats_admin_bar_menu( &$wp_admin_bar ) {
$title = esc_attr( __( 'Views over 48 hours. Click for more Site Stats.', 'jetpack' ) );
$menu = array(
- 'id' => 'stats',
- 'href' => $url,
+ 'id' => 'stats',
+ 'href' => $url,
+ 'title' => "<div><img src='$img_src' srcset='$img_src 1x, $img_src_2x 2x' width='112' height='24' alt='$alt' title='$title'></div>",
);
- if ( Jetpack_AMP_Support::is_amp_request() ) {
- $menu['title'] = "<amp-img src='$img_src_2x' width=112 height=24 layout=fixed alt='$alt' title='$title'></amp-img>";
- } else {
- $menu['title'] = "<div><script type='text/javascript'>var src;if(typeof(window.devicePixelRatio)=='undefined'||window.devicePixelRatio<2){src='$img_src';}else{src='$img_src_2x';}document.write('<img src=\''+src+'\' alt=\'$alt\' title=\'$title\' />');</script></div>";
- }
$wp_admin_bar->add_menu( $menu );
}
@@ -919,7 +903,7 @@ function stats_update_blog() {
* @return string
*/
function stats_get_blog() {
- $home = parse_url( trailingslashit( get_option( 'home' ) ) );
+ $home = wp_parse_url( trailingslashit( get_option( 'home' ) ) );
$blog = array(
'host' => $home['host'],
'path' => $home['path'],
@@ -1323,7 +1307,7 @@ function stats_dashboard_widget_content() {
$timeout = 90;
$user_id = JETPACK_MASTER_USER;
- $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) );
+ $get = Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) );
$get_code = wp_remote_retrieve_response_code( $get );
if ( is_wp_error( $get ) || ( 2 !== intval( $get_code / 100 ) && 304 !== $get_code ) || empty( $get['body'] ) ) {
stats_print_wp_remote_error( $get, $url );
@@ -1577,7 +1561,7 @@ function stats_get_remote_csv( $url ) {
$timeout = 90;
$user_id = JETPACK_MASTER_USER;
- $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) );
+ $get = Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) );
$get_code = wp_remote_retrieve_response_code( $get );
if ( is_wp_error( $get ) || ( 2 !== intval( $get_code / 100 ) && 304 !== $get_code ) || empty( $get['body'] ) ) {
return array(); // @todo: return an error?
@@ -1640,48 +1624,40 @@ function stats_get_from_restapi( $args = array(), $resource = '' ) {
$args = wp_parse_args( $args, array() );
$cache_key = md5( implode( '|', array( $endpoint, $api_version, serialize( $args ) ) ) );
- // Get cache.
- $stats_cache = Jetpack_Options::get_option( 'restapi_stats_cache', array() );
- if ( ! is_array( $stats_cache ) ) {
- $stats_cache = array();
- }
+ $transient_name = "jetpack_restapi_stats_cache_{$cache_key}";
+
+ $stats_cache = get_transient( $transient_name );
// Return or expire this key.
- if ( isset( $stats_cache[ $cache_key ] ) ) {
- $time = key( $stats_cache[ $cache_key ] );
- if ( time() - $time < ( 5 * MINUTE_IN_SECONDS ) ) {
- $cached_stats = $stats_cache[ $cache_key ][ $time ];
- if ( is_wp_error( $cached_stats ) ) {
- return $cached_stats;
- }
- $cached_stats = (object) array_merge( array( 'cached_at' => $time ), (array) $cached_stats );
- return $cached_stats;
+ if ( $stats_cache ) {
+ $time = key( $stats_cache );
+ $data = $stats_cache[ $time ]; // WP_Error or string (JSON encoded object)
+
+ if ( is_wp_error( $data ) ) {
+ return $data;
}
- unset( $stats_cache[ $cache_key ] );
+
+ return (object) array_merge( array( 'cached_at' => $time ), (array) json_decode( $data ) );
}
// Do the dirty work.
- $response = Jetpack_Client::wpcom_json_api_request_as_blog( $endpoint, $api_version, $args );
+ $response = Client::wpcom_json_api_request_as_blog( $endpoint, $api_version, $args );
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
+ // WP_Error
$data = is_wp_error( $response ) ? $response : new WP_Error( 'stats_error' );
+ // WP_Error
+ $return = $data;
} else {
- $data = json_decode( wp_remote_retrieve_body( $response ) );
+ // string (JSON encoded object)
+ $data = wp_remote_retrieve_body( $response );
+ // object (rare: null on JSON failure)
+ $return = json_decode( $data );
}
- // Expire old keys.
- foreach ( $stats_cache as $k => $cache ) {
- if ( ! is_array( $cache ) || ( 5 * MINUTE_IN_SECONDS ) < time() - key( $cache ) ) {
- unset( $stats_cache[ $k ] );
- }
- }
+ // To reduce size in storage: store with time as key, store JSON encoded data (unless error).
+ set_transient( $transient_name, array( time() => $data ), 5 * MINUTE_IN_SECONDS );
- // Set cache.
- $stats_cache[ $cache_key ] = array(
- time() => $data,
- );
- Jetpack_Options::update_option( 'restapi_stats_cache', $stats_cache, false );
-
- return $data;
+ return $return;
}
/**
diff --git a/plugins/jetpack/modules/subscriptions.php b/plugins/jetpack/modules/subscriptions.php
index aeda5dd4..3b6bd9f5 100644
--- a/plugins/jetpack/modules/subscriptions.php
+++ b/plugins/jetpack/modules/subscriptions.php
@@ -1,7 +1,7 @@
<?php
/**
* Module Name: Subscriptions
- * Module Description: Allow users to subscribe to your posts and comments and receive notifications via email
+ * Module Description: Let visitors subscribe to new posts and comments via email
* Sort Order: 9
* Recommendation Order: 8
* First Introduced: 1.2
@@ -443,7 +443,6 @@ class Jetpack_Subscriptions {
}
if ( !$async ) {
- Jetpack::load_xml_rpc_client();
$xml = new Jetpack_IXR_ClientMulticall();
}
@@ -670,7 +669,7 @@ class Jetpack_Subscriptions {
*/
$str = apply_filters( 'jetpack_comment_subscription_form', $str );
- return $submit_button . $str;
+ return $str . $submit_button;
}
/**
diff --git a/plugins/jetpack/modules/subscriptions/views.php b/plugins/jetpack/modules/subscriptions/views.php
index 6a332f8f..fc578db4 100644
--- a/plugins/jetpack/modules/subscriptions/views.php
+++ b/plugins/jetpack/modules/subscriptions/views.php
@@ -164,7 +164,7 @@ class Jetpack_Subscriptions_Widget extends WP_Widget {
switch ( $_GET['blogsub'] ) {
case 'confirming':
echo "<div style='background-color: #{$themecolors['bg']}; border: 1px solid #{$themecolors['border']}; color: #{$themecolors['text']}; padding-left: 5px; padding-right: 5px; margin-bottom: 10px;'>";
- _e( 'Thanks for subscribing! You&rsquo;ll get an email with a link to confirm your subscription. If you don&rsquo;t get it, please <a href="http://en.support.wordpress.com/contact/">contact us</a>.' );
+ _e( 'Thanks for subscribing! You&rsquo;ll get an email with a link to confirm your subscription. If you don&rsquo;t get it, please <a href="https://en.support.wordpress.com/contact/">contact us</a>.' );
echo "</div>";
break;
case 'blocked':
@@ -189,7 +189,7 @@ class Jetpack_Subscriptions_Widget extends WP_Widget {
break;
case 'pending':
echo "<div style='background-color: #{$themecolors['bg']}; border: 1px solid #{$themecolors['border']}; color: #{$themecolors['text']}; padding-left: 5px; padding-right: 5px; margin-bottom: 10px;'>";
- _e( 'You have a pending subscription already; we just sent you another email. Click the link or <a href="http://en.support.wordpress.com/contact/">contact us</a> if you don&rsquo;t receive it.' );
+ _e( 'You have a pending subscription already; we just sent you another email. Click the link or <a href="https://en.support.wordpress.com/contact/">contact us</a> if you don&rsquo;t receive it.' );
echo "</div>";
break;
case 'confirmed':
@@ -446,8 +446,6 @@ class Jetpack_Subscriptions_Widget extends WP_Widget {
if ( self::is_jetpack() ) {
$subs_count = get_transient( 'wpcom_subscribers_total' );
if ( false === $subs_count || 'failed' == $subs_count['status'] ) {
- Jetpack::load_xml_rpc_client();
-
$xml = new Jetpack_IXR_Client( array( 'user_id' => JETPACK_MASTER_USER, ) );
$xml->query( 'jetpack.fetchSubscriberCount' );
diff --git a/plugins/jetpack/modules/theme-tools.php b/plugins/jetpack/modules/theme-tools.php
index afb8b000..55dbb4bc 100644
--- a/plugins/jetpack/modules/theme-tools.php
+++ b/plugins/jetpack/modules/theme-tools.php
@@ -34,13 +34,17 @@ function jetpack_load_theme_compat() {
*
* @param array Associative array of theme compat files to load.
*/
- $compat_files = apply_filters( 'jetpack_theme_compat_files', array(
- 'twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php',
- 'twentyfifteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfifteen.php',
- 'twentysixteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentysixteen.php',
- 'twentyseventeen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyseventeen.php',
- 'twentynineteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentynineteen.php',
- ) );
+ $compat_files = apply_filters(
+ 'jetpack_theme_compat_files',
+ array(
+ 'twentyfourteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfourteen.php',
+ 'twentyfifteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyfifteen.php',
+ 'twentysixteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentysixteen.php',
+ 'twentyseventeen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentyseventeen.php',
+ 'twentynineteen' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentynineteen.php',
+ 'twentytwenty' => JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwenty.php',
+ )
+ );
_jetpack_require_compat_file( get_stylesheet(), $compat_files );
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php b/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php
index adaa42b7..b51149c6 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentyfifteen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentyfifteen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php b/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
index fcc8b8c1..12d9b74a 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentynineteen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentynineteen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php b/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php
index 4a60e504..284b54a4 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentyseventeen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentyseventeen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php
index 816a74b5..439a3e95 100644
--- a/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php
+++ b/plugins/jetpack/modules/theme-tools/compat/twentysixteen.php
@@ -1,7 +1,7 @@
<?php
/**
* Jetpack Compatibility File
- * See: http://jetpack.com/
+ * See: https://jetpack.com/
*/
function twentysixteen_jetpack_setup() {
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css b/plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css
new file mode 100644
index 00000000..fc248ab3
--- /dev/null
+++ b/plugins/jetpack/modules/theme-tools/compat/twentytwenty-rtl.css
@@ -0,0 +1 @@
+.infinite-scroll .pagination-wrapper,.infinite-scroll.neverending #site-footer,.infinite-scroll.neverending .footer-nav-widgets-wrapper{display:none}.infinite-end.neverending .footer-nav-widgets-wrapper,.infinity-end.neverending #site-footer{display:block}.infinite-loader{margin:calc(3 * 1rem) auto}.infinite-loader .spinner{margin:0 auto;right:inherit!important}#site-content #infinite-handle{margin:0 auto;max-width:58rem;width:calc(100% - 8rem)}#site-content #infinite-handle span{background:100% 0;display:block;font-size:1.7rem;text-align:center}#site-content #infinite-handle span button,#site-content #infinite-handle span button:focus,#site-content #infinite-handle span button:hover{-webkit-appearance:none;-moz-appearance:none;border:none;background:#cd2653;border-radius:0;color:#fff;cursor:pointer;display:inline-block;font-size:1.5rem;font-weight:600;letter-spacing:.0333em;line-height:1.25;margin:0;opacity:1;padding:1.1em 1.44em;text-align:center;text-decoration:none;text-transform:uppercase;transition:opacity .15s linear}#site-content #infinite-handle span button:hover{text-decoration:underline}#site-content .infinite-wrap .hentry:first-of-type{padding:4rem 0 0}.entry-content #jp-relatedposts h3.jp-relatedposts-headline,.entry-content div.sharedaddy h3.sd-title,.entry-content h3.sd-title{font-size:2.8rem;font-weight:700;letter-spacing:-.016875em;line-height:1.5}@media (min-width:700px){.entry-content #jp-relatedposts h3.jp-relatedposts-headline,.entry-content div.sharedaddy h3.sd-title,.entry-content h3.sd-title{font-size:4rem}}.entry-content div.sharedaddy h3.sd-title:before,.entry-content h3.sd-title:before{border:0 none}.entry-content #jp-relatedposts h3.jp-relatedposts-headline em:before{border:0 none}.widget_authors ul{margin-right:0}.widget_authors li{margin-top:1rem;list-style:none}.widget_authors li:first-child{margin-top:2rem}.widget_eu_cookie_law_widget #eu-cookie-law,.widget_eu_cookie_law_widget #eu-cookie-law .accept{font-size:1.6rem;font-weight:500;padding:2rem}.widget_eu_cookie_law_widget #eu-cookie-law .accept{font-size:1.4rem;font-weight:600;letter-spacing:.0333em;line-height:1.25;padding:1.1em 1.44em;text-decoration:none;text-transform:uppercase;transition:opacity .15s linear}@media (max-width:600px){.widget_eu_cookie_law_widget #eu-cookie-law{font-size:1.4rem;padding:1.5rem 1.5rem 6.5rem}.widget_eu_cookie_law_widget #eu-cookie-law .accept{font-size:1.2rem;bottom:1.5rem;left:auto;right:1.5rem;padding:1rem;margin:0}}.entry-content #jp-relatedposts{max-width:120rem;margin:1em auto;width:calc(100% - 4rem)}@media (min-width:700px){.entry-content #jp-relatedposts{width:calc(100% - 8rem)}}#jp-relatedposts .jp-relatedposts-grid{display:flex;flex-grow:1;flex-basis:0;justify-content:space-between;box-sizing:border-box}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,#jp-relatedposts .jp-relatedposts-post{width:calc(33% - 2rem);margin-right:0;margin-left:0}@media only screen and (max-width:640px){#jp-relatedposts .jp-relatedposts-grid{flex-direction:column}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,#jp-relatedposts .jp-relatedposts-post{width:100%}}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post{padding-left:0}#jp-relatedposts#jp-relatedposts .jp-relatedposts-items p,#jp-relatedposts#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{font-size:inherit;line-height:1.5}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:0}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img{width:100%}.entry-content .jetpack-recipe{margin:1em auto}.jp-related-posts-i2__post li{margin:0}.wp-block-jetpack-gif{margin:1em auto!important} \ No newline at end of file
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentytwenty.css b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.css
new file mode 100644
index 00000000..794c197e
--- /dev/null
+++ b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.css
@@ -0,0 +1,232 @@
+/**
+ * Infinite scroll
+ */
+
+/* Globally hidden elements when Infinite Scroll is supported and in use. */
+.infinite-scroll .pagination-wrapper,
+.infinite-scroll.neverending .footer-nav-widgets-wrapper,
+.infinite-scroll.neverending #site-footer {
+ /* Theme Footer (when set to scrolling) */
+ display: none;
+}
+
+ /* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before. */
+.infinite-end.neverending .footer-nav-widgets-wrapper,
+.infinity-end.neverending #site-footer {
+ display: block;
+}
+
+.infinite-loader {
+ margin: calc(3 * 1rem) auto;
+}
+
+.infinite-loader .spinner {
+ margin: 0 auto;
+ left: inherit !important;
+}
+
+#site-content #infinite-handle {
+ margin: 0 auto;
+ max-width: 58rem;
+ width: calc(100% - 8rem);
+}
+
+#site-content #infinite-handle span {
+ background: transparent;
+ display: block;
+ font-size: 1.7rem;
+ text-align: center;
+}
+
+#site-content #infinite-handle span button,
+#site-content #infinite-handle span button:hover,
+#site-content #infinite-handle span button:focus {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ border: none;
+ background: #cd2653;
+ border-radius: 0;
+ color: #fff;
+ cursor: pointer;
+ display: inline-block;
+ font-size: 1.5rem;
+ font-weight: 600;
+ letter-spacing: 0.0333em;
+ line-height: 1.25;
+ margin: 0;
+ opacity: 1;
+ padding: 1.1em 1.44em;
+ text-align: center;
+ text-decoration: none;
+ text-transform: uppercase;
+ transition: opacity 0.15s linear;
+}
+
+#site-content #infinite-handle span button:hover {
+ text-decoration: underline;
+}
+
+#site-content .infinite-wrap .hentry:first-of-type {
+ padding: 4rem 0 0;
+}
+
+/**
+ * Sharing & Related Posts
+ */
+
+.entry-content div.sharedaddy h3.sd-title,
+.entry-content h3.sd-title,
+.entry-content #jp-relatedposts h3.jp-relatedposts-headline {
+ font-size: 2.8rem;
+ font-weight: 700;
+ letter-spacing: -0.016875em;
+ line-height: 1.5;
+}
+
+@media (min-width: 700px) {
+ .entry-content div.sharedaddy h3.sd-title,
+ .entry-content h3.sd-title,
+ .entry-content #jp-relatedposts h3.jp-relatedposts-headline {
+ font-size: 4rem;
+ }
+}
+
+.entry-content div.sharedaddy h3.sd-title:before,
+.entry-content h3.sd-title:before {
+ border: 0 none;
+}
+
+.entry-content #jp-relatedposts h3.jp-relatedposts-headline em:before {
+ border: 0 none;
+}
+
+/* Authors widget */
+.widget_authors ul {
+ margin-left: 0;
+}
+
+.widget_authors li {
+ margin-top: 1rem;
+ list-style: none;
+}
+
+.widget_authors li:first-child {
+ margin-top: 2rem;
+}
+
+/* EU cookie law */
+.widget_eu_cookie_law_widget #eu-cookie-law,
+.widget_eu_cookie_law_widget #eu-cookie-law .accept {
+ font-size: 1.6rem;
+ font-weight: 500;
+ padding: 2rem;
+}
+
+.widget_eu_cookie_law_widget #eu-cookie-law .accept {
+ font-size: 1.4rem;
+ font-weight: 600;
+ letter-spacing: 0.0333em;
+ line-height: 1.25;
+ padding: 1.1em 1.44em;
+ text-decoration: none;
+ text-transform: uppercase;
+ transition: opacity 0.15s linear;
+}
+
+@media (max-width: 600px) {
+ .widget_eu_cookie_law_widget #eu-cookie-law {
+ font-size: 1.4rem;
+ padding: 1.5rem 1.5rem 6.5rem;
+ }
+
+ .widget_eu_cookie_law_widget #eu-cookie-law .accept {
+ font-size: 1.2rem;
+ bottom: 1.5rem;
+ right: auto;
+ left: 1.5rem;
+ padding: 1rem;
+ margin: 0;
+ }
+}
+
+/* Related Posts */
+
+.entry-content #jp-relatedposts {
+ max-width: 120rem;
+ margin: 1em auto;
+ width: calc(100% - 4rem);
+}
+
+@media (min-width: 700px) {
+ .entry-content #jp-relatedposts {
+ width: calc(100% - 8rem);
+ }
+}
+
+#jp-relatedposts .jp-relatedposts-grid {
+ display: flex;
+ flex-grow: 1;
+ flex-basis: 0;
+ justify-content: space-between;
+ box-sizing: border-box;
+}
+
+#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,
+#jp-relatedposts .jp-relatedposts-post {
+ width: calc(33% - 2rem);
+ margin-left: 0;
+ margin-right: 0;
+}
+
+@media only screen and (max-width: 640px) {
+ #jp-relatedposts .jp-relatedposts-grid {
+ flex-direction: column;
+ }
+
+ #jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post,
+ #jp-relatedposts .jp-relatedposts-post {
+ width: 100%;
+ }
+}
+
+#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post {
+ padding-right: 0;
+}
+
+#jp-relatedposts#jp-relatedposts .jp-relatedposts-items p,
+#jp-relatedposts#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title {
+ font-size: inherit;
+ line-height: 1.5;
+}
+
+#jp-relatedposts .jp-relatedposts-items-visual {
+ margin-right: 0;
+}
+
+#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img {
+ width: 100%;
+}
+
+/**
+ * Shortcodes
+ */
+
+/* Recipe */
+.entry-content .jetpack-recipe {
+ margin: 1em auto;
+}
+
+/**
+ * Blocks
+ */
+
+/* Related Posts Block */
+.jp-related-posts-i2__post li {
+ margin: 0;
+}
+
+/* GIF Block */
+.wp-block-jetpack-gif {
+ /* !important because the gif block styles are loaded in the footer after this file */
+ margin: 1em auto !important;
+}
diff --git a/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php
new file mode 100644
index 00000000..f1620e08
--- /dev/null
+++ b/plugins/jetpack/modules/theme-tools/compat/twentytwenty.php
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Jetpack Compatibility File
+ * See: https://jetpack.com/
+ *
+ * @package Jetpack
+ */
+
+/**
+ * Add Jetpack extra functionality to Twenty Twenty.
+ */
+function twentytwenty_jetpack_setup() {
+ /**
+ * Add theme support for Infinite Scroll.
+ */
+ add_theme_support(
+ 'infinite-scroll',
+ array(
+ 'type' => 'click',
+ 'container' => 'site-content',
+ 'render' => 'twentytwenty_infinite_scroll_render',
+ 'footer' => 'site-content',
+ )
+ );
+
+ /**
+ * Add theme support for geo-location.
+ */
+ add_theme_support( 'jetpack-geo-location' );
+}
+add_action( 'after_setup_theme', 'twentytwenty_jetpack_setup' );
+
+/**
+ * Custom render function for Infinite Scroll.
+ */
+function twentytwenty_infinite_scroll_render() {
+ while ( have_posts() ) {
+ echo '<hr class="post-separator styled-separator is-style-wide section-inner" aria-hidden="true" />';
+ the_post();
+ get_template_part( 'template-parts/content', get_post_type() );
+ }
+}
+
+/**
+ * Remove Sharing buttons and Likes from excerpts that are used as intro on single post views.
+ */
+function twentytwenty_no_sharing_on_excerpts() {
+ if ( is_single() ) {
+ // Remove sharing buttons.
+ remove_filter( 'the_excerpt', 'sharing_display', 19 );
+
+ // Remove Likes.
+ if ( class_exists( 'Jetpack_Likes' ) ) {
+ remove_filter( 'the_excerpt', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
+ }
+ }
+}
+add_action( 'loop_start', 'twentytwenty_no_sharing_on_excerpts' );
+
+/**
+ * We do not need to display the Likes Heading here.
+ *
+ * @param string $heading Headline structure.
+ * @param string $title Title.
+ * @param string $module Module name.
+ */
+function twentytwenty_no_likes_heading( $heading, $title, $module ) {
+ if ( 'likes' === $module ) {
+ return '';
+ }
+
+ return $heading;
+}
+add_filter( 'jetpack_sharing_headline_html', 'twentytwenty_no_likes_heading', 10, 3 );
+
+/**
+ * Disable Ads in post excerpts, that are used as intro on single post views.
+ */
+add_filter( 'wordads_excerpt_disable', '__return_true' );
+
+/**
+ * Add our compat CSS file for Infinite Scroll and custom widget stylings and such.
+ * Set the version equal to filemtime for development builds, and the JETPACK__VERSION for production
+ * or skip it entirely for wpcom.
+ */
+function twentytwenty_enqueue_jetpack_style() {
+ $version = Jetpack::is_development_version()
+ ? filemtime( JETPACK__PLUGIN_DIR . 'modules/theme-tools/compat/twentytwenty.css' )
+ : JETPACK__VERSION;
+
+ wp_enqueue_style( 'twentytwenty-jetpack', plugins_url( 'twentytwenty.css', __FILE__ ), array(), $version );
+ wp_style_add_data( 'twentytwenty-jetpack', 'rtl', 'replace' );
+}
+add_action( 'wp_enqueue_scripts', 'twentytwenty_enqueue_jetpack_style' );
+
+/**
+ * Add inline custom CSS with custom accent color if there is any set.
+ */
+function twentytwenty_infinity_accent_color_css() {
+ // Bail early if no custom color was set.
+ if (
+ 'custom' !== get_theme_mod( 'accent_hue_active' )
+ || empty( get_theme_mod( 'accent_accessible_colors' ) )
+ ) {
+ return;
+ }
+
+ $color_info = get_theme_mod( 'accent_accessible_colors' );
+ $custom_css = sprintf(
+ '
+ .infinite-scroll #site-content #infinite-handle span button,
+ .infinite-scroll #site-content #infinite-handle span button:hover,
+ .infinite-scroll #site-content #infinite-handle span button:focus {
+ background: %1$s;
+ color: %2$s;
+ }
+ #site-content .entry-content div.sharedaddy h3.sd-title,
+ #site-content .entry-content h3.sd-title,
+ #site-content .entry-content #jp-relatedposts h3.jp-relatedposts-headline {
+ color: %3$s;
+ }
+ ',
+ $color_info['content']['accent'],
+ $color_info['content']['background'],
+ $color_info['content']['secondary']
+ );
+
+ // Add our custom style to the existing Twenty Twenty CSS compat file.
+ wp_add_inline_style( 'twentytwenty-jetpack', $custom_css );
+}
+add_action( 'wp_enqueue_scripts', 'twentytwenty_infinity_accent_color_css' );
+
diff --git a/plugins/jetpack/modules/theme-tools/featured-content.php b/plugins/jetpack/modules/theme-tools/featured-content.php
index 1df0f069..c70408c8 100644
--- a/plugins/jetpack/modules/theme-tools/featured-content.php
+++ b/plugins/jetpack/modules/theme-tools/featured-content.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Constants;
+
if ( ! class_exists( 'Featured_Content' ) && isset( $GLOBALS['pagenow'] ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
/**
@@ -501,7 +503,7 @@ if ( ! class_exists( 'Featured_Content' ) && isset( $GLOBALS['pagenow'] ) && 'pl
Add Featured Content settings.
*
* Sanitization callback registered in Featured_Content::validate_settings().
- * See http://themeshaper.com/2013/04/29/validation-sanitization-in-customizer/comment-page-1/#comment-12374
+ * See https://themeshaper.com/2013/04/29/validation-sanitization-in-customizer/comment-page-1/#comment-12374
*/
$wp_customize->add_setting(
'featured-content[tag-name]',
@@ -714,7 +716,7 @@ if ( ! class_exists( 'Featured_Content' ) && isset( $GLOBALS['pagenow'] ) && 'pl
return $request;
}
- if ( Jetpack_Constants::is_true( 'IS_WPCOM' ) && Jetpack_Constants::is_true( 'REST_API_REQUEST' ) ) {
+ if ( Constants::is_true( 'IS_WPCOM' ) && Constants::is_true( 'REST_API_REQUEST' ) ) {
add_filter( 'rest_request_before_callbacks', 'wpcom_rest_request_before_callbacks');
}
diff --git a/plugins/jetpack/modules/theme-tools/random-redirect.php b/plugins/jetpack/modules/theme-tools/random-redirect.php
index d866d336..e78e0277 100644
--- a/plugins/jetpack/modules/theme-tools/random-redirect.php
+++ b/plugins/jetpack/modules/theme-tools/random-redirect.php
@@ -5,12 +5,12 @@ Plugin URI: https://wordpress.org/extend/plugins/random-redirect/
Description: Allows you to create a link to yourblog.example.com/?random which will redirect someone to a random post on your blog, in a StumbleUpon-like fashion.
Version: 1.2-wpcom
Author: Matt Mullenweg
-Author URI: http://photomatt.net/
+Author URI: https://ma.tt/
*/
function jetpack_matt_random_redirect() {
// Verify that the Random Redirect plugin this code is from is not active
- // See http://plugins.trac.wordpress.org/ticket/1898
+ // See https://plugins.trac.wordpress.org/ticket/1898
if ( ! ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if ( is_plugin_active( 'random-redirect/random-redirect.php' ) ) {
@@ -49,7 +49,7 @@ function jetpack_matt_random_redirect() {
// Persistent AppEngine abuse. ORDER BY RAND is expensive.
if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'AppEngine-Google' ) ) {
- wp_die( 'Please <a href="http://en.support.wordpress.com/contact/" rel="noopener noreferrer" target="_blank">contact support</a>' );
+ wp_die( 'Please <a href="https://en.support.wordpress.com/contact/" rel="noopener noreferrer" target="_blank">contact support</a>' );
}
// Set the category ID if the parameter is set.
diff --git a/plugins/jetpack/modules/theme-tools/responsive-videos.php b/plugins/jetpack/modules/theme-tools/responsive-videos.php
index 61987a8d..9bd35dae 100644
--- a/plugins/jetpack/modules/theme-tools/responsive-videos.php
+++ b/plugins/jetpack/modules/theme-tools/responsive-videos.php
@@ -42,6 +42,11 @@ function jetpack_responsive_videos_embed_html( $html ) {
return $html;
}
+ // Short-circuit for AMP responses, since custom scripts are not allowed in AMP and videos are naturally responsive.
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ return $html;
+ }
+
// The customizer video widget wraps videos with a class of wp-video
// mejs as of 4.9 apparently resizes videos too which causes issues
// skip the video if it is wrapped in wp-video.
@@ -79,6 +84,11 @@ function jetpack_responsive_videos_maybe_wrap_oembed( $html, $url = null ) {
return $html;
}
+ // Short-circuit for AMP responses, since custom scripts are not allowed in AMP and videos are naturally responsive.
+ if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
+ return $html;
+ }
+
$jetpack_video_wrapper = '<div class="jetpack-video-wrapper">';
$already_wrapped = strpos( $html, $jetpack_video_wrapper );
diff --git a/plugins/jetpack/modules/theme-tools/site-logo.php b/plugins/jetpack/modules/theme-tools/site-logo.php
index 04f16b71..cef77e69 100644
--- a/plugins/jetpack/modules/theme-tools/site-logo.php
+++ b/plugins/jetpack/modules/theme-tools/site-logo.php
@@ -1,7 +1,7 @@
<?php
/*
* Site Logo.
- * @see http://jetpack.com/support/site-logo/
+ * @see https://jetpack.com/support/site-logo/
*
* This feature will only be activated for themes that declare their support.
* This can be done by adding code similar to the following during the
diff --git a/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.css b/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.css
index d5441db1..e0d9a2c4 100644
--- a/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.css
+++ b/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.css
@@ -1,6 +1,37 @@
+/* Do not modify this file directly. It is concatenated from individual module CSS files. */
/**
- * RTL styles for the Site Logo control. Just swaps the button sides.
+ * Styles for the Site Logo control.
*/
+#customize-control-site_logo .current {
+ margin-bottom: 6px;
+}
+
+#customize-control-site_logo .current span {
+ border: 1px solid #eee;
+ border-radius: 2px;
+ color: #555;
+ display: block;
+ overflow: hidden;
+ line-height: 40px;
+ min-height: 40px;
+ padding: 0 6px;
+ text-align: center;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+#customize-control-site_logo .current img {
+ max-width: 100%;
+}
+
+#customize-control-site_logo button.new,
+#customize-control-site_logo button.change,
+#customize-control-site_logo button.remove {
+ height: auto;
+ width: 48%;
+ white-space: normal;
+}
+
#customize-control-site_logo .remove {
float: right;
margin-left: 3px;
@@ -10,3 +41,9 @@
#customize-control-site_logo .change {
float: left;
}
+
+#customize-control-site_logo .customize-control-description {
+ display: block;
+ clear: both;
+ margin-bottom: 10px;
+} \ No newline at end of file
diff --git a/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css b/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css
index 1893fe9c..f07c2f74 100644
--- a/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css
+++ b/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control-rtl.min.css
@@ -1 +1 @@
-#customize-control-site_logo .remove{float:right;margin-left:3px}#customize-control-site_logo .change,#customize-control-site_logo .new{float:left} \ No newline at end of file
+#customize-control-site_logo .current{margin-bottom:6px}#customize-control-site_logo .current span{border:1px solid #eee;border-radius:2px;color:#555;display:block;overflow:hidden;line-height:40px;min-height:40px;padding:0 6px;text-align:center;text-overflow:ellipsis;white-space:nowrap}#customize-control-site_logo .current img{max-width:100%}#customize-control-site_logo button.change,#customize-control-site_logo button.new,#customize-control-site_logo button.remove{height:auto;width:48%;white-space:normal}#customize-control-site_logo .remove{float:right;margin-left:3px}#customize-control-site_logo .change,#customize-control-site_logo .new{float:left}#customize-control-site_logo .customize-control-description{display:block;clear:both;margin-bottom:10px} \ No newline at end of file
diff --git a/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control.min.css b/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control.min.css
index 7fcee5ae..0c1eede3 100644
--- a/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control.min.css
+++ b/plugins/jetpack/modules/theme-tools/site-logo/css/site-logo-control.min.css
@@ -1 +1,2 @@
-#customize-control-site_logo .current{margin-bottom:6px}#customize-control-site_logo .current span{border:1px solid #eee;-webkit-border-radius:2px;border-radius:2px;color:#555;display:block;overflow:hidden;line-height:40px;min-height:40px;padding:0 6px;text-align:center;text-overflow:ellipsis;white-space:nowrap}#customize-control-site_logo .current img{max-width:100%}#customize-control-site_logo button.change,#customize-control-site_logo button.new,#customize-control-site_logo button.remove{height:auto;width:48%;white-space:normal}#customize-control-site_logo .remove{float:left;margin-right:3px}#customize-control-site_logo .change,#customize-control-site_logo .new{float:right}#customize-control-site_logo .customize-control-description{display:block;clear:both;margin-bottom:10px} \ No newline at end of file
+/* Do not modify this file directly. It is concatenated from individual module CSS files. */
+#customize-control-site_logo .current{margin-bottom:6px}#customize-control-site_logo .current span{border:1px solid #eee;border-radius:2px;color:#555;display:block;overflow:hidden;line-height:40px;min-height:40px;padding:0 6px;text-align:center;text-overflow:ellipsis;white-space:nowrap}#customize-control-site_logo .current img{max-width:100%}#customize-control-site_logo button.change,#customize-control-site_logo button.new,#customize-control-site_logo button.remove{height:auto;width:48%;white-space:normal}#customize-control-site_logo .remove{float:left;margin-right:3px}#customize-control-site_logo .change,#customize-control-site_logo .new{float:right}#customize-control-site_logo .customize-control-description{display:block;clear:both;margin-bottom:10px} \ No newline at end of file
diff --git a/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo-control.php b/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo-control.php
index 5e23507d..209cc000 100644
--- a/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo-control.php
+++ b/plugins/jetpack/modules/theme-tools/site-logo/inc/class-site-logo-control.php
@@ -54,8 +54,27 @@ class Site_Logo_Image_Control extends WP_Customize_Control {
// Enqueues all needed media resources.
wp_enqueue_media();
- // Enqueue our control script and styles.
- wp_enqueue_style( 'site-logo-control', plugins_url( '../css/site-logo-control.css', __FILE__ ) );
+ /*
+ * Enqueue our control script and styles.
+ */
+
+ // We only enqueue a minified version of the file on prod. Jetpack.
+ $min = (
+ ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
+ || ( defined( 'IS_WPCOM' ) && IS_WPCOM )
+ )
+ ? ''
+ : '.min';
+
+ wp_enqueue_style(
+ 'site-logo-control',
+ plugins_url( '../css/site-logo-control.css', __FILE__ ),
+ array(),
+ JETPACK__VERSION
+ );
+ wp_style_add_data( 'site-logo-control', 'rtl', 'replace' );
+ wp_style_add_data( 'site-logo-control', 'suffix', $min );
+
wp_enqueue_script( 'site-logo-control', plugins_url( '../js/site-logo-control.js', __FILE__ ), array( 'media-views', 'customize-controls', 'underscore' ), '', true );
}
diff --git a/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg b/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg
index 896d255f..333dc504 100644
--- a/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg
+++ b/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg
@@ -74,7 +74,7 @@ c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091
<path d="M19.24775,14.722a3.57032,3.57032,0,0,1-2.94457,3.52073,3.61886,3.61886,0,0,1-.64652.05634c-.07314-.0008-.10187.02846-.12507.09547A2.38881,2.38881,0,0,1,13.49453,20.094a2.33092,2.33092,0,0,1-1.827-.50716.13635.13635,0,0,0-.19878-.00408,3.191,3.191,0,0,1-2.104.60248,3.26309,3.26309,0,0,1-3.00324-2.71993,2.19076,2.19076,0,0,1-.03512-.30865c-.00156-.08579-.03413-.1189-.11608-.13493a2.86421,2.86421,0,0,1-1.23189-.56111,2.945,2.945,0,0,1-1.166-2.05749,2.97484,2.97484,0,0,1,.87524-2.50774.112.112,0,0,0,.02091-.16107,2.7213,2.7213,0,0,1-.36648-1.48A2.81256,2.81256,0,0,1,6.57673,7.58838a.35764.35764,0,0,0,.28869-.22819,4.2208,4.2208,0,0,1,6.02892-1.90111.25161.25161,0,0,0,.22023.0243,3.65608,3.65608,0,0,1,3.76031.90678A3.57244,3.57244,0,0,1,17.95918,8.626a2.97339,2.97339,0,0,1,.01829.57356.10637.10637,0,0,0,.0853.12792,1.97669,1.97669,0,0,1,1.27939,1.33733,2.00266,2.00266,0,0,1-.57112,2.12652c-.05284.05166-.04168.08328-.01173.13489A3.51189,3.51189,0,0,1,19.24775,14.722Zm-6.35959-.27836a1.6984,1.6984,0,0,0,1.14556,1.61113,3.82039,3.82039,0,0,0,1.036.17935,1.46888,1.46888,0,0,0,.73509-.12255.44082.44082,0,0,0,.26057-.44274.45312.45312,0,0,0-.29211-.43375.97191.97191,0,0,0-.20678-.063c-.21326-.03806-.42754-.0701-.63973-.11215a.54787.54787,0,0,1-.50172-.60926,2.75864,2.75864,0,0,1,.1773-.901c.1763-.535.414-1.045.64183-1.55913A12.686,12.686,0,0,0,15.85,10.47863a1.58461,1.58461,0,0,0,.04861-.87208,1.04531,1.04531,0,0,0-.85432-.83981,1.60658,1.60658,0,0,0-1.23654.16594.27593.27593,0,0,1-.36286-.03413c-.085-.0747-.16594-.15379-.24918-.23055a.98682.98682,0,0,0-1.33577-.04933,6.1468,6.1468,0,0,1-.4989.41615.47762.47762,0,0,1-.51535.03566c-.17448-.09307-.35512-.175-.53531-.25665a1.74949,1.74949,0,0,0-.56476-.2016,1.69943,1.69943,0,0,0-1.61654.91787,8.05815,8.05815,0,0,0-.32952.80126c-.45471,1.2557-.82507,2.53825-1.20838,3.81639a1.24151,1.24151,0,0,0,.51532,1.44389,1.42659,1.42659,0,0,0,1.22008.17166,1.09728,1.09728,0,0,0,.66994-.69764c.44145-1.04111.839-2.09989,1.25981-3.14926.11581-.28876.22792-.57874.35078-.86438a.44548.44548,0,0,1,.69189-.19539.50521.50521,0,0,1,.15044.43836,1.75625,1.75625,0,0,1-.14731.50453c-.27379.69219-.55265,1.38236-.82766,2.074a2.0836,2.0836,0,0,0-.14038.42876.50719.50719,0,0,0,.27082.57722.87236.87236,0,0,0,.66145.02739.99137.99137,0,0,0,.53406-.532q.61571-1.20914,1.228-2.42031.28423-.55863.57585-1.1133a.87189.87189,0,0,1,.29055-.35253.34987.34987,0,0,1,.37634-.01265.30291.30291,0,0,1,.12434.31459.56716.56716,0,0,1-.04655.1915c-.05318.12739-.10286.25669-.16183.38156-.34118.71775-.68754,1.43273-1.02568,2.152A2.00213,2.00213,0,0,0,12.88816,14.44366Zm4.78568,5.28972a.88573.88573,0,0,0-1.77139.00465.8857.8857,0,0,0,1.77139-.00465Zm-14.83838-7.296a.84329.84329,0,1,0,.00827-1.68655.8433.8433,0,0,0-.00827,1.68655Zm10.366-9.43673a.83506.83506,0,1,0-.0091,1.67.83505.83505,0,0,0,.0091-1.67Zm6.85014,5.22a.71651.71651,0,0,0-1.433.0093.71656.71656,0,0,0,1.433-.0093ZM5.37528,6.17908A.63823.63823,0,1,0,6.015,5.54483.62292.62292,0,0,0,5.37528,6.17908Zm6.68214,14.80843a.54949.54949,0,1,0-.55052.541A.54556.54556,0,0,0,12.05742,20.98752Zm8.53235-8.49689a.54777.54777,0,0,0-.54027.54023.53327.53327,0,0,0,.532.52293.51548.51548,0,0,0,.53272-.5237A.53187.53187,0,0,0,20.58977,12.49063ZM7.82846,2.4715a.44927.44927,0,1,0,.44484.44766A.43821.43821,0,0,0,7.82846,2.4715Zm13.775,7.60492a.41186.41186,0,0,0-.40065.39623.40178.40178,0,0,0,.40168.40168A.38994.38994,0,0,0,22,10.48172.39946.39946,0,0,0,21.60349,10.07642ZM5.79193,17.96207a.40469.40469,0,0,0-.397-.39646.399.399,0,0,0-.396.405.39234.39234,0,0,0,.39939.389A.39857.39857,0,0,0,5.79193,17.96207Z"/>
</symbol>
<symbol id="icon-medium" viewBox="0 0 24 24">
-<path d="M20.962,7.257l-5.457,8.867l-3.923-6.375l3.126-5.08c0.112-0.182,0.319-0.286,0.527-0.286c0.05,0,0.1,0.008,0.149,0.02 c0.039,0.01,0.078,0.023,0.114,0.041l5.43,2.715l0.006,0.003c0.004,0.002,0.007,0.006,0.011,0.008 C20.971,7.191,20.98,7.227,20.962,7.257z M9.86,8.592v5.783l5.14,2.57L9.86,8.592z M15.772,17.331l4.231,2.115 C20.554,19.721,21,19.529,21,19.016V8.835L15.772,17.331z M8.968,7.178L3.665,4.527C3.569,4.479,3.478,4.456,3.395,4.456 C3.163,4.456,3,4.636,3,4.938v11.45c0,0.306,0.224,0.669,0.498,0.806l4.671,2.335c0.12,0.06,0.234,0.088,0.337,0.088 c0.29,0,0.494-0.225,0.494-0.602V7.231C9,7.208,8.988,7.188,8.968,7.178z"/>
+<path d="M5.727 8.027a.623.623 0 0 0-.204-.527L4.02 5.687v-.273H8.69l3.614 7.926 3.175-7.926h4.457v.274l-1.285 1.234a.367.367 0 0 0-.144.36v9.066a.374.374 0 0 0 .144.363l1.258 1.234v.27h-6.324v-.27l1.3-1.265c.13-.13.13-.164.13-.36V8.988l-3.621 9.196h-.489L6.691 8.988v6.164c-.035.258.051.52.235.707l1.691 2.055v.27h-4.8v-.27l1.69-2.055a.814.814 0 0 0 .22-.707zm0 0"/>
</symbol>
<symbol id="icon-pinterest" viewBox="0 0 24 24">
<path d="M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"/>
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php b/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
index 479eadc2..f99e7558 100644
--- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
@@ -1,5 +1,8 @@
<?php
+use Automattic\Jetpack\Assets;
+use Automattic\Jetpack\Status;
+
// Include the class file containing methods for rounding constrained array elements.
// Here the constrained array element is the dimension of a row, group or an image in the tiled gallery.
require_once dirname( __FILE__ ) . '/math/class-constrained-array-rounding.php';
@@ -127,7 +130,7 @@ class Jetpack_Tiled_Gallery {
public static function default_scripts_and_styles() {
wp_enqueue_script(
'tiled-gallery',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/tiled-gallery/tiled-gallery/tiled-gallery.min.js',
'modules/tiled-gallery/tiled-gallery/tiled-gallery.js'
),
@@ -181,7 +184,7 @@ class Jetpack_Tiled_Gallery {
if ( $gallery_html && class_exists( 'Jetpack' ) && class_exists( 'Jetpack_Photon' ) ) {
// Tiled Galleries in Jetpack require that Photon be active.
// If it's not active, run it just on the gallery output.
- if ( ! in_array( 'photon', Jetpack::get_active_modules() ) && ! Jetpack::is_development_mode() ) {
+ if ( ! in_array( 'photon', Jetpack::get_active_modules() ) && ! ( new Status() )->is_development_mode() ) {
$gallery_html = Jetpack_Photon::filter_the_content( $gallery_html );
}
}
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css
index 34e50334..7d730835 100644
--- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css
@@ -1 +1 @@
-.tiled-gallery{clear:both;margin:0 0 20px;overflow:hidden}.tiled-gallery img{margin:2px!important}.tiled-gallery .gallery-group{float:right;position:relative}.tiled-gallery .tiled-gallery-item{float:right;margin:0;position:relative;width:inherit}.tiled-gallery .gallery-row{overflow:hidden}.tiled-gallery .tiled-gallery-item a{background:100% 0;border:none;color:inherit;margin:0;padding:0;text-decoration:none;width:auto}.tiled-gallery .tiled-gallery-item img,.tiled-gallery .tiled-gallery-item img:hover{background:100% 0;border:none;box-shadow:none;max-width:100%;padding:0;vertical-align:middle}.tiled-gallery-caption{background:#eee;background:rgba(255,255,255,.8);color:#333;font-size:13px;font-weight:400;overflow:hidden;padding:10px 0;position:absolute;bottom:0;text-indent:10px;text-overflow:ellipsis;width:100%;white-space:nowrap}.tiled-gallery .tiled-gallery-item-small .tiled-gallery-caption{font-size:11px}.widget-gallery .tiled-gallery-unresized{visibility:hidden;height:0;overflow:hidden}.tiled-gallery .tiled-gallery-item img.grayscale{position:absolute;right:0;top:0}.tiled-gallery .tiled-gallery-item img.grayscale:hover{opacity:0}.tiled-gallery.type-circle .tiled-gallery-item img{border-radius:50%!important}.tiled-gallery.type-circle .tiled-gallery-caption{display:none;opacity:0} \ No newline at end of file
+.tiled-gallery{clear:both;margin:0 0 20px;overflow:hidden}.tiled-gallery img{margin:2px!important}.tiled-gallery .gallery-group{float:right;position:relative}.tiled-gallery .tiled-gallery-item{float:right;margin:0;position:relative;width:inherit}.tiled-gallery .gallery-row{overflow:hidden}.tiled-gallery .tiled-gallery-item a{background:100% 0;border:none;color:inherit;margin:0;padding:0;text-decoration:none;width:auto}.tiled-gallery .tiled-gallery-item img,.tiled-gallery .tiled-gallery-item img:hover{background:100% 0;border:none;box-shadow:none;max-width:100%;padding:0;vertical-align:middle}.tiled-gallery-caption{background:#eee;background:rgba(255,255,255,.8);color:#333;font-size:13px;font-weight:400;overflow:hidden;padding:10px 0;position:absolute;bottom:0;text-indent:10px;text-overflow:ellipsis;width:100%;white-space:nowrap}.tiled-gallery .tiled-gallery-item-small .tiled-gallery-caption{font-size:11px}.widget-gallery .tiled-gallery-unresized{visibility:hidden;height:0;overflow:hidden}.tiled-gallery .tiled-gallery-item img.grayscale{position:absolute;right:0;top:0}.tiled-gallery .tiled-gallery-item img.grayscale:hover{opacity:0}.tiled-gallery.type-circle .tiled-gallery-item img{border-radius:50%!important;-o-object-fit:cover;object-fit:cover}.tiled-gallery.type-circle .tiled-gallery-caption{display:none;opacity:0}.tiled-gallery.type-square .tiled-gallery-item img{-o-object-fit:cover;object-fit:cover} \ No newline at end of file
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css
index b4cdc576..0cc2dc0a 100644
--- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.css
@@ -86,9 +86,16 @@
.tiled-gallery.type-circle .tiled-gallery-item img {
border-radius: 50% !important; /* Ensure that circles are displayed in themes that add border-radius to all images as a default */
+ object-fit: cover;
}
.tiled-gallery.type-circle .tiled-gallery-caption {
display: none;
opacity: 0;
}
+
+/* =Square Layout
+-------------------------------------------------------------- */
+.tiled-gallery.type-square .tiled-gallery-item img {
+ object-fit: cover;
+}
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js
index 087ff3f1..6bf20ca5 100644
--- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery.js
@@ -1,5 +1,3 @@
-/* jshint onevar:false, smarttabs:true */
-
( function( $ ) {
function TiledGalleryCollection() {
this.galleries = [];
diff --git a/plugins/jetpack/modules/tonesque.php b/plugins/jetpack/modules/tonesque.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/tonesque.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/verification-tools/blog-verification-tools.php b/plugins/jetpack/modules/verification-tools/blog-verification-tools.php
index 593e80c5..9b53000a 100644
--- a/plugins/jetpack/modules/verification-tools/blog-verification-tools.php
+++ b/plugins/jetpack/modules/verification-tools/blog-verification-tools.php
@@ -13,7 +13,7 @@ function jetpack_verification_services() {
'name' => 'Bing Webmaster Center',
'key' => 'msvalidate.01',
'format' => '12C1203B5086AECE94EB3A3D9830B2E',
- 'url' => 'http://www.bing.com/webmaster/',
+ 'url' => 'https://www.bing.com/toolbox/webmaster/',
),
'pinterest' => array(
'name' => 'Pinterest Site Verification',
diff --git a/plugins/jetpack/modules/videopress/class.jetpack-videopress.php b/plugins/jetpack/modules/videopress/class.jetpack-videopress.php
index a1073f05..5b73dde6 100644
--- a/plugins/jetpack/modules/videopress/class.jetpack-videopress.php
+++ b/plugins/jetpack/modules/videopress/class.jetpack-videopress.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
/**
* VideoPress in Jetpack
*/
@@ -76,7 +78,7 @@ class Jetpack_VideoPress {
}
// Connection owners are allowed to do all the things.
- if ( $this->is_connection_owner( $user_id ) ) {
+ if ( Jetpack::connection()->is_connection_owner( $user_id ) ) {
return true;
}
@@ -98,15 +100,15 @@ class Jetpack_VideoPress {
/**
* Returns true if the provided user is the Jetpack connection owner.
+ *
+ * @deprecated since 7.7
+ *
+ * @param Integer|Boolean $user_id the user identifier. False for current user.
+ * @return bool Whether the current user is the connection owner.
*/
public function is_connection_owner( $user_id = false ) {
- if ( ! $user_id ) {
- $user_id = get_current_user_id();
- }
-
- $user_token = Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
-
- return $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) && $user_id === $user_token->external_user_id;
+ _deprecated_function( __METHOD__, 'jetpack-7.7', 'Automattic\\Jetpack\\Connection\\Manager::is_connection_owner' );
+ return Jetpack::connection()->is_connection_owner( $user_id );
}
/**
@@ -128,7 +130,7 @@ class Jetpack_VideoPress {
if ( $this->should_override_media_uploader() ) {
wp_enqueue_script(
'videopress-plupload',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/videopress/js/videopress-plupload.min.js',
'modules/videopress/js/videopress-plupload.js'
),
@@ -141,7 +143,7 @@ class Jetpack_VideoPress {
wp_enqueue_script(
'videopress-uploader',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/videopress/js/videopress-uploader.min.js',
'modules/videopress/js/videopress-uploader.js'
),
@@ -153,7 +155,7 @@ class Jetpack_VideoPress {
wp_enqueue_script(
'media-video-widget-extensions',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/videopress/js/media-video-widget-extensions.min.js',
'modules/videopress/js/media-video-widget-extensions.js'
),
diff --git a/plugins/jetpack/modules/videopress/class.videopress-ajax.php b/plugins/jetpack/modules/videopress/class.videopress-ajax.php
index e1943c0b..620605a9 100644
--- a/plugins/jetpack/modules/videopress/class.videopress-ajax.php
+++ b/plugins/jetpack/modules/videopress/class.videopress-ajax.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Connection\Client;
+
class VideoPress_AJAX {
/**
@@ -53,7 +55,7 @@ class VideoPress_AJAX {
);
$endpoint = "sites/{$options['shadow_blog_id']}/media/token";
- $result = Jetpack_Client::wpcom_json_api_request_as_blog( $endpoint, Jetpack_Client::WPCOM_JSON_API_VERSION, $args );
+ $result = Client::wpcom_json_api_request_as_blog( $endpoint, Client::WPCOM_JSON_API_VERSION, $args );
if ( is_wp_error( $result ) ) {
wp_send_json_error( array( 'message' => __( 'Could not obtain a VideoPress upload token. Please try again later.', 'jetpack' ) ) );
diff --git a/plugins/jetpack/modules/videopress/class.videopress-edit-attachment.php b/plugins/jetpack/modules/videopress/class.videopress-edit-attachment.php
index be7ddfde..5d55b2c6 100644
--- a/plugins/jetpack/modules/videopress/class.videopress-edit-attachment.php
+++ b/plugins/jetpack/modules/videopress/class.videopress-edit-attachment.php
@@ -1,4 +1,7 @@
<?php
+
+use Automattic\Jetpack\Connection\Client;
+
/**
* VideoPress edit attachment screen
*
@@ -114,7 +117,7 @@ class VideoPress_Edit_Attachment {
$guid = get_post_meta( $post_id, 'videopress_guid', true );
$endpoint = "videos/{$guid}";
- $result = Jetpack_Client::wpcom_json_api_request_as_blog( $endpoint, Jetpack_Client::WPCOM_JSON_API_VERSION, $args, $values );
+ $result = Client::wpcom_json_api_request_as_blog( $endpoint, Client::WPCOM_JSON_API_VERSION, $args, $values );
if ( is_wp_error( $result ) ) {
$post['errors']['videopress']['errors'][] = __( 'There was an issue saving your updates to the VideoPress service. Please try again later.', 'jetpack' );
@@ -152,7 +155,7 @@ class VideoPress_Edit_Attachment {
'%s://%s/rest/v%s/videos/%s',
'https',
'public-api.wordpress.com', // JETPACK__WPCOM_JSON_API_HOST,
- Jetpack_Client::WPCOM_JSON_API_VERSION,
+ Client::WPCOM_JSON_API_VERSION,
$guid
);
}
diff --git a/plugins/jetpack/modules/videopress/class.videopress-gutenberg.php b/plugins/jetpack/modules/videopress/class.videopress-gutenberg.php
index be0bd1db..55421ee9 100644
--- a/plugins/jetpack/modules/videopress/class.videopress-gutenberg.php
+++ b/plugins/jetpack/modules/videopress/class.videopress-gutenberg.php
@@ -5,6 +5,8 @@
* @package Jetpack
*/
+use Automattic\Jetpack\Assets;
+
/**
* Register a VideoPress extension to replace the default Core Video block.
*/
@@ -31,6 +33,7 @@ class VideoPress_Gutenberg {
private function __construct() {
add_action( 'init', array( $this, 'register_video_block_with_videopress' ) );
add_action( 'jetpack_register_gutenberg_extensions', array( $this, 'set_extension_availability' ) );
+ add_action( 'enqueue_block_editor_assets', array( $this, 'override_video_upload' ) );
}
/**
@@ -164,6 +167,30 @@ class VideoPress_Gutenberg {
1
);
}
+
+ /**
+ * Replaces the video uploaded in the block editor.
+ *
+ * Enqueues a script that registers an API fetch middleware replacing the video uploads in Gutenberg so they are
+ * uploaded against the WP.com API media endpoint and thus transcoded by VideoPress.
+ */
+ public function override_video_upload() {
+ // Bail if Jetpack or VideoPress is not active.
+ if ( ! Jetpack::is_active() || ! Jetpack::is_module_active( 'videopress' ) ) {
+ return;
+ }
+
+ wp_enqueue_script(
+ 'jetpack-videopress-gutenberg-override-video-upload',
+ Assets::get_file_url_for_environment(
+ '_inc/build/videopress/js/gutenberg-video-upload.min.js',
+ 'modules/videopress/js/gutenberg-video-upload.js'
+ ),
+ array( 'wp-api-fetch', 'wp-polyfill', 'lodash' ),
+ JETPACK__VERSION,
+ false
+ );
+ }
}
VideoPress_Gutenberg::init();
diff --git a/plugins/jetpack/modules/videopress/class.videopress-player.php b/plugins/jetpack/modules/videopress/class.videopress-player.php
index 669523c9..ab5105df 100644
--- a/plugins/jetpack/modules/videopress/class.videopress-player.php
+++ b/plugins/jetpack/modules/videopress/class.videopress-player.php
@@ -305,7 +305,7 @@ class VideoPress_Player {
$html .= '<input type="submit" value="' . __( 'Submit', 'jetpack' ) . '" style="cursor:pointer;border-radius: 1em;border:1px solid #333;background-color:#333;background:-webkit-gradient( linear, left top, left bottom, color-stop(0.0, #444), color-stop(1, #111) );background:-moz-linear-gradient(center top, #444 0%, #111 100%);font-size:13px;padding:4px 10px 5px;line-height:1em;vertical-align:top;color:white;text-decoration:none;margin:0" />';
$html .= '</fieldset>';
- $html .= '<p style="padding-top:20px;padding-bottom:60px;text-align:' . $text_align . ';"><a rel="nofollow noopener noreferrer" href="http://videopress.com/" target="_blank" style="color:rgb(128,128,128);text-decoration:underline;font-size:15px">' . __( 'More information', 'jetpack' ) . '</a></p>';
+ $html .= '<p style="padding-top:20px;padding-bottom:60px;text-align:' . $text_align . ';"><a rel="nofollow noopener noreferrer" href="https://videopress.com/" target="_blank" style="color:rgb(128,128,128);text-decoration:underline;font-size:15px">' . __( 'More information', 'jetpack' ) . '</a></p>';
$html .= '</div>';
return $html;
@@ -317,7 +317,7 @@ class VideoPress_Player {
* No Flash fallback.
*
* @since 1.2
- * @link http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html HTML5 video
+ * @link https://html.spec.whatwg.org/multipage/media.html#the-video-element HTML5 video
* @return string HTML5 video element and children
*/
private function html5_static() {
@@ -359,7 +359,7 @@ class VideoPress_Player {
}
$html .= '" src="' . $thumbnail . '" width="' . $this->video->calculated_width . '" height="' . $this->video->calculated_height . '" /></div>';
if ( isset( $this->options['freedom'] ) && $this->options['freedom'] === true ) {
- $html .= '<p class="robots-nocontent">' . sprintf( __( 'You do not have sufficient <a rel="nofollow noopener noreferrer" href="%s" target="_blank">freedom levels</a> to view this video. Support free software and upgrade.', 'jetpack' ), 'http://www.gnu.org/philosophy/free-sw.html' ) . '</p>';
+ $html .= '<p class="robots-nocontent">' . sprintf( __( 'You do not have sufficient <a rel="nofollow noopener noreferrer" href="%s" target="_blank">freedom levels</a> to view this video. Support free software and upgrade.', 'jetpack' ), 'https://www.gnu.org/philosophy/free-sw.html' ) . '</p>';
} elseif ( isset( $this->video->title ) ) {
$html .= '<p>' . esc_html( $this->video->title ) . '</p>';
}
@@ -516,7 +516,7 @@ class VideoPress_Player {
if ( $age_gate_required ) {
$html .= 'if ( jQuery.VideoPress.support.flash() ) {' . PHP_EOL;
/**
- * @link http://code.google.com/p/swfobject/wiki/api#swfobject.embedSWF(swfUrlStr,_replaceElemIdStr,_widthStr,_height
+ * @link https://github.com/swfobject/swfobject/wiki/SWFObject-API#swfobjectembedswfswfurlstr-replaceelemidstr-widthstr-heightstr-swfversionstr-xiswfurlstr-flashvarsobj-parobj-attobj-callbackfn
*/
$html .= 'swfobject.embedSWF(' . implode(
',',
@@ -688,11 +688,11 @@ class VideoPress_Player {
* Only allow legitimate Flash parameters and their values
*
* @since 1.2
- * @link http://kb2.adobe.com/cps/127/tn_12701.html Flash object and embed attributes
- * @link http://kb2.adobe.com/cps/133/tn_13331.html devicefont
- * @link http://kb2.adobe.com/cps/164/tn_16494.html allowscriptaccess
- * @link http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html full screen mode
- * @link http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001079.html allownetworking
+ * @link https://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html Flash object and embed attributes
+ * @link https://helpx.adobe.com/flash/kb/font-outlines-device-fonts.html devicefont
+ * @link https://helpx.adobe.com/flash/kb/control-access-scripts-host-web.html allowscriptaccess
+ * @link https://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html full screen mode
+ * @link https://help.adobe.com/en_US/as3/dev/WS1EFE2EDA-026D-4d14-864E-79DFD56F87C6.html allownetworking
* @param array $flash_params Flash parameters expressed in key-value form
* @return array validated Flash parameters
*/
@@ -796,7 +796,7 @@ class VideoPress_Player {
* Flash player markup in a HTML embed element.
*
* @since 1.1
- * @link http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#the-embed-element embed element
+ * @link https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-embed-element embed element
* @link http://www.google.com/support/reader/bin/answer.py?answer=70664 Google Reader markup support
* @return string HTML markup. Embed element with no children
*/
@@ -849,7 +849,7 @@ class VideoPress_Player {
foreach ( $this->get_flash_parameters() as $attribute => $value ) {
$flash_params .= '<param name="' . esc_attr( $attribute ) . '" value="' . esc_attr( $value ) . '" />';
}
- $flash_help = sprintf( __( 'This video requires <a rel="nofollow noopener noreferrer" href="%s" target="_blank">Adobe Flash</a> for playback.', 'jetpack' ), 'http://www.adobe.com/go/getflashplayer' );
+ $flash_help = sprintf( __( 'This video requires <a rel="nofollow noopener noreferrer" href="%s" target="_blank">Adobe Flash</a> for playback.', 'jetpack' ), 'https://get.adobe.com/flashplayer/' );
$flash_player_url = esc_url( $this->video->players->swf->url, array( 'http', 'https' ) );
$description = '';
if ( isset( $this->video->title ) ) {
diff --git a/plugins/jetpack/modules/videopress/class.videopress-video.php b/plugins/jetpack/modules/videopress/class.videopress-video.php
index a8c3a6b8..f12c5fba 100644
--- a/plugins/jetpack/modules/videopress/class.videopress-video.php
+++ b/plugins/jetpack/modules/videopress/class.videopress-video.php
@@ -314,7 +314,7 @@ class VideoPress_Video {
* @return bool|string host component of the URL, or false if none found
*/
public static function hostname( $url ) {
- return parse_url( esc_url_raw( $url ), PHP_URL_HOST );
+ return wp_parse_url( esc_url_raw( $url ), PHP_URL_HOST );
}
@@ -336,10 +336,7 @@ class VideoPress_Video {
$request_params['maxwidth'] = $this->maxwidth;
}
- $url = 'http://videopress.com/data/wordpress.json';
- if ( is_ssl() ) {
- $url = 'https://v.wordpress.com/data/wordpress.json';
- }
+ $url = 'https://v.wordpress.com/data/wordpress.json';
$response = wp_remote_get(
add_query_arg( $request_params, $url ),
diff --git a/plugins/jetpack/modules/videopress/editor-media-view.php b/plugins/jetpack/modules/videopress/editor-media-view.php
index ed65a08c..f9ff3498 100644
--- a/plugins/jetpack/modules/videopress/editor-media-view.php
+++ b/plugins/jetpack/modules/videopress/editor-media-view.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
/**
* WordPress Shortcode Editor View JS Code
*/
@@ -15,7 +17,7 @@ function videopress_handle_editor_view_js() {
wp_enqueue_style( 'videopress-editor-ui', plugins_url( 'css/editor.css', __FILE__ ) );
wp_enqueue_script(
'videopress-editor-view',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/videopress/js/editor-view.min.js',
'modules/videopress/js/editor-view.js'
),
@@ -27,7 +29,7 @@ function videopress_handle_editor_view_js() {
'videopress-editor-view',
'vpEditorView',
array(
- 'home_url_host' => parse_url( home_url(), PHP_URL_HOST ),
+ 'home_url_host' => wp_parse_url( home_url(), PHP_URL_HOST ),
'min_content_width' => VIDEOPRESS_MIN_WIDTH,
'content_width' => $content_width,
'modal_labels' => array(
diff --git a/plugins/jetpack/modules/videopress/js/gutenberg-video-upload.js b/plugins/jetpack/modules/videopress/js/gutenberg-video-upload.js
new file mode 100644
index 00000000..c3ba1739
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/js/gutenberg-video-upload.js
@@ -0,0 +1,63 @@
+/* globals wp, lodash */
+
+wp.apiFetch.use( function( options, next ) {
+ var path = options.path;
+ var method = options.method;
+ var body = options.body;
+ var file = body ? body.get( 'file' ) : null;
+
+ // Override only requests to the WP REST API media endpoint uploading new videos.
+ if ( ! path || path.indexOf( '/wp/v2/media' ) === -1 ) {
+ return next( options );
+ }
+ if ( ! method || 'post' !== method.toLowerCase() ) {
+ return next( options );
+ }
+ if ( ! file || file.type.indexOf( 'video/' ) !== 0 ) {
+ return next( options );
+ }
+
+ // Get upload token.
+ wp.media
+ .ajax( 'videopress-get-upload-token', { async: false, data: { filename: file.name } } )
+ .done( function( response ) {
+ // Set auth header with upload token.
+ var headers = options.headers || {};
+ headers.Authorization =
+ 'X_UPLOAD_TOKEN token="' +
+ response.upload_token +
+ '" blog_id="' +
+ response.upload_blog_id +
+ '"';
+ options.headers = headers;
+
+ // Replace upload URL.
+ delete options.path;
+ options.url = response.upload_action_url;
+
+ // Handle CORS.
+ options.credentials = 'omit';
+
+ // Set data in expected param by WP.com media endpoint.
+ body.set( 'media[]', file );
+ body.delete( 'file' );
+ options.body = body;
+ } );
+
+ var result = next( options );
+
+ return new Promise( function( resolve, reject ) {
+ result
+ .then( function( data ) {
+ var wpcomMediaObject = lodash.get( data, 'media[0]' );
+ var id = lodash.get( wpcomMediaObject, 'ID' );
+ var gutenbergMediaObject = wp.apiFetch( {
+ path: '/wp/v2/media/' + id,
+ } );
+ resolve( gutenbergMediaObject );
+ } )
+ .catch( function() {
+ reject();
+ } );
+ } );
+} );
diff --git a/plugins/jetpack/modules/videopress/shortcode.php b/plugins/jetpack/modules/videopress/shortcode.php
index 21b163ef..51b7dd47 100644
--- a/plugins/jetpack/modules/videopress/shortcode.php
+++ b/plugins/jetpack/modules/videopress/shortcode.php
@@ -13,7 +13,7 @@ class VideoPress_Shortcode {
protected function __construct() {
// By explicitly declaring the provider here, we can speed things up by not relying on oEmbed discovery.
- wp_oembed_add_provider( '#^https?://videopress.com/v/.*#', 'http://public-api.wordpress.com/oembed/1.0/', true );
+ wp_oembed_add_provider( '#^https?://videopress.com/v/.*#', 'https://public-api.wordpress.com/oembed/1.0/', true );
add_shortcode( 'videopress', array( $this, 'shortcode_callback' ) );
add_shortcode( 'wpvideo', array( $this, 'shortcode_callback' ) );
@@ -44,7 +44,7 @@ class VideoPress_Shortcode {
* [videopress OcobLTqC]
* [wpvideo OcobLTqC]
*
- * @link http://codex.wordpress.org/Shortcode_API Shortcode API
+ * @link https://codex.wordpress.org/Shortcode_API Shortcode API
* @param array $attr shortcode attributes
* @return string HTML markup or blank string on fail
*/
@@ -226,7 +226,7 @@ class VideoPress_Shortcode {
if ( false === stripos( $oembed_provider, 'videopress.com' ) ) {
return $oembed_provider;
}
- return add_query_arg( 'for', parse_url( home_url(), PHP_URL_HOST ), $oembed_provider );
+ return add_query_arg( 'for', wp_parse_url( home_url(), PHP_URL_HOST ), $oembed_provider );
}
/**
diff --git a/plugins/jetpack/modules/videopress/utility-functions.php b/plugins/jetpack/modules/videopress/utility-functions.php
index 345fa719..989eaf52 100644
--- a/plugins/jetpack/modules/videopress/utility-functions.php
+++ b/plugins/jetpack/modules/videopress/utility-functions.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Connection\Client;
+
/**
* We won't have any videos less than sixty pixels wide. That would be silly.
*/
@@ -69,7 +71,7 @@ function videopress_get_video_details( $guid ) {
/**
* Get an attachment ID given a URL.
*
- * Modified from http://wpscholar.com/blog/get-attachment-id-from-wp-image-url/
+ * Modified from https://wpscholar.com/blog/get-attachment-id-from-wp-image-url/
*
* @todo: Add some caching in here.
*
@@ -490,7 +492,7 @@ function videopress_make_video_get_path( $guid ) {
'%s://%s/rest/v%s/videos/%s',
'https',
JETPACK__WPCOM_JSON_API_HOST,
- Jetpack_Client::WPCOM_JSON_API_VERSION,
+ Client::WPCOM_JSON_API_VERSION,
$guid
);
}
diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions.php b/plugins/jetpack/modules/widget-visibility/widget-conditions.php
index f5e12cbb..d049d368 100644
--- a/plugins/jetpack/modules/widget-visibility/widget-conditions.php
+++ b/plugins/jetpack/modules/widget-visibility/widget-conditions.php
@@ -1,5 +1,6 @@
<?php
+use Automattic\Jetpack\Assets;
/**
* Hide or show widgets conditionally.
@@ -25,7 +26,7 @@ class Jetpack_Widget_Conditions {
wp_style_add_data( 'widget-conditions', 'rtl', 'replace' );
wp_enqueue_script(
'widget-conditions',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widget-visibility/widget-conditions/widget-conditions.min.js',
'modules/widget-visibility/widget-conditions/widget-conditions.js'
),
@@ -304,7 +305,7 @@ class Jetpack_Widget_Conditions {
<?php _ex( 'is', 'Widget Visibility: {Rule Major [Page]} is {Rule Minor [Search results]}', 'jetpack' ); ?>
- <select class="conditions-rule-minor" name="conditions[rules_minor][]"
+ <select class="conditions-rule-minor" name="conditions[rules_minor][]"
<?php
if ( ! $rule['major'] ) {
?>
@@ -318,7 +319,7 @@ class Jetpack_Widget_Conditions {
<option value="<?php echo esc_attr( $rule['minor'] ); ?>" selected="selected"></option>
</select>
- <span class="conditions-rule-has-children"
+ <span class="conditions-rule-has-children"
<?php
if ( ! $rule['has_children'] ) {
?>
diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js
index 2feca3f4..0034b97b 100644
--- a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js
+++ b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js
@@ -1,8 +1,4 @@
-/* jshint onevar: false, smarttabs: true */
-/* global isRtl */
-/* global widget_conditions_parent_pages */
-/* global widget_conditions_data */
-/* global jQuery */
+/* global isRtl, widget_conditions_parent_pages, widget_conditions_data, jQuery */
jQuery( function( $ ) {
var widgets_shell = $( 'div#widgets-right' );
diff --git a/plugins/jetpack/modules/widgets/authors.php b/plugins/jetpack/modules/widgets/authors.php
index dfc78652..741856d8 100644
--- a/plugins/jetpack/modules/widgets/authors.php
+++ b/plugins/jetpack/modules/widgets/authors.php
@@ -78,26 +78,41 @@ class Jetpack_Widget_Authors extends WP_Widget {
// We need to query at least one post to determine whether an author has written any posts or not
$query_number = max( $instance['number'], 1 );
- $default_excluded_authors = array();
/**
* Filter authors from the Widget Authors widget.
*
* @module widgets
*
+ * @deprecated 7.7.0 Use jetpack_widget_authors_params instead.
+ *
* @since 4.5.0
*
* @param array $default_excluded_authors Array of user ID's that will be excluded
*/
- $excluded_authors = apply_filters( 'jetpack_widget_authors_exclude', $default_excluded_authors );
+ $excluded_authors = apply_filters( 'jetpack_widget_authors_exclude', array() );
- $authors = get_users(
+ /**
+ * Filter the parameters of `get_users` call in the Widget Authors widget.
+ *
+ * See the following for `get_users` default arguments:
+ * https://codex.wordpress.org/Function_Reference/get_users
+ *
+ * @module widgets
+ *
+ * @since 7.7.0
+ *
+ * @param array $get_author_params Array of params used in `get_user`
+ */
+ $get_author_params = apply_filters(
+ 'jetpack_widget_authors_params',
array(
- 'fields' => 'all',
'who' => 'authors',
'exclude' => (array) $excluded_authors,
)
);
+ $authors = get_users( $get_author_params );
+
echo $args['before_widget'];
/** This filter is documented in core/src/wp-includes/default-widgets.php */
$title = apply_filters( 'widget_title', $instance['title'] );
@@ -157,22 +172,20 @@ class Jetpack_Widget_Authors extends WP_Widget {
continue;
}
- // Display a short list of recent posts for this author
-
+ // Display a short list of recent posts for this author.
if ( $r->have_posts() ) {
echo '<ul>';
while ( $r->have_posts() ) {
$r->the_post();
- echo '<li><a href="' . get_permalink() . '">';
-
- if ( get_the_title() ) {
- echo get_the_title();
- } else {
- echo get_the_ID();
- }
- echo '</a></li>';
+ printf(
+ '<li><a href="%1$s" title="%2$s"%3$s>%4$s</a></li>',
+ esc_url( get_permalink() ),
+ esc_attr( wp_kses( get_the_title(), array() ) ),
+ ( get_queried_object_id() === get_the_ID() ? ' aria-current="page"' : '' ),
+ esc_html( wp_kses( get_the_title(), array() ) )
+ );
}
echo '</ul>';
diff --git a/plugins/jetpack/modules/widgets/contact-info.php b/plugins/jetpack/modules/widgets/contact-info.php
index 93b4695b..761c7b02 100644
--- a/plugins/jetpack/modules/widgets/contact-info.php
+++ b/plugins/jetpack/modules/widgets/contact-info.php
@@ -1,8 +1,12 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+
+use Automattic\Jetpack\Assets;
if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
- //register Contact_Info_Widget widget
+ /**
+ * Register Contact_Info_Widget widget
+ */
function jetpack_contact_info_widget_init() {
register_widget( 'Jetpack_Contact_Info_Widget' );
}
@@ -19,7 +23,9 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
/**
* Constructor
*/
- function __construct() {
+ public function __construct() {
+ global $pagenow;
+
$widget_ops = array(
'classname' => 'widget_contact_info',
'description' => __( 'Display a map with your location, hours, and contact information.', 'jetpack' ),
@@ -35,14 +41,23 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
if ( is_customize_preview() ) {
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
+ } elseif ( 'widgets.php' === $pagenow ) {
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
}
+
+ add_action( 'wp_ajax_customize-contact-info-api-key', array( $this, 'ajax_check_api_key' ) );
}
/**
* Enqueue scripts and styles.
*/
public function enqueue_scripts() {
- wp_enqueue_style( 'contact-info-map-css', plugins_url( 'contact-info/contact-info-map.css', __FILE__ ), null, 20160623 );
+ wp_enqueue_style(
+ 'contact-info-map-css',
+ plugins_url( 'contact-info/contact-info-map.css', __FILE__ ),
+ array(),
+ JETPACK__VERSION
+ );
}
@@ -62,26 +77,25 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
'email' => null,
'showmap' => 0,
'apikey' => null,
- 'lat' => null,
- 'lon' => null,
+ 'goodmap' => null,
);
}
/**
* Outputs the HTML for this widget.
*
- * @param array $args An array of standard parameters for widgets in this theme
- * @param array $instance An array of settings for this widget instance
+ * @param array $args An array of standard parameters for widgets in this theme.
+ * @param array $instance An array of settings for this widget instance.
*
* @return void Echoes it's output
**/
- function widget( $args, $instance ) {
+ public function widget( $args, $instance ) {
$instance = wp_parse_args( $instance, $this->defaults() );
- echo $args['before_widget'];
+ echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
- if ( '' != $instance['title'] ) {
- echo $args['before_title'] . $instance['title'] . $args['after_title'];
+ if ( '' !== $instance['title'] ) {
+ echo $args['before_title'] . esc_html( $instance['title'] ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
@@ -95,12 +109,12 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
echo '<div itemscope itemtype="http://schema.org/LocalBusiness">';
- if ( '' != $instance['address'] ) {
+ if ( '' !== $instance['address'] ) {
$showmap = $instance['showmap'];
+ $goodmap = isset( $instance['goodmap'] ) ? $instance['goodmap'] : $this->has_good_map( $instance );
- /** This action is documented in modules/widgets/contact-info.php */
- if ( $showmap && $this->has_good_map( $instance ) ) {
+ if ( $showmap && true === $goodmap ) {
/**
* Set a Google Maps API Key.
*
@@ -109,15 +123,24 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
* @param string $api_key Google Maps API Key
*/
$api_key = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
- echo $this->build_map( $instance['address'], $api_key );
+ echo $this->build_map( $instance['address'], $api_key ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } elseif ( $showmap && is_customize_preview() && true !== $goodmap ) {
+ printf(
+ '<span class="contact-map-api-error" style="display: block;">%s</span>',
+ esc_html( $instance['goodmap'] )
+ );
}
$map_link = $this->build_map_link( $instance['address'] );
- echo '<div class="confit-address" itemscope itemtype="http://schema.org/PostalAddress" itemprop="address"><a href="' . esc_url( $map_link ) . '" target="_blank">' . str_replace( "\n", '<br/>', esc_html( $instance['address'] ) ) . '</a></div>';
+ printf(
+ '<div class="confit-address" itemscope itemtype="http://schema.org/PostalAddress" itemprop="address"><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a></div>',
+ esc_url( $map_link ),
+ str_replace( "\n", '<br/>', esc_html( $instance['address'] ) ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ );
}
- if ( '' != $instance['phone'] ) {
+ if ( '' !== $instance['phone'] ) {
if ( wp_is_mobile() ) {
echo '<div class="confit-phone"><span itemprop="telephone"><a href="' . esc_url( 'tel:' . $instance['phone'] ) . '">' . esc_html( $instance['phone'] ) . '</a></span></div>';
} else {
@@ -132,8 +155,11 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
);
}
- if ( '' != $instance['hours'] ) {
- echo '<div class="confit-hours" itemprop="openingHours">' . str_replace( "\n", '<br/>', esc_html( $instance['hours'] ) ) . '</div>';
+ if ( '' !== $instance['hours'] ) {
+ printf(
+ '<div class="confit-hours" itemprop="openingHours">%s</div>',
+ str_replace( "\n", '<br/>', esc_html( $instance['hours'] ) ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ );
}
echo '</div>';
@@ -147,7 +173,7 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*/
do_action( 'jetpack_contact_info_widget_end' );
- echo $args['after_widget'];
+ echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
/** This action is documented in modules/widgets/gravatar-profile.php */
do_action( 'jetpack_stats_extra', 'widget_view', 'contact_info' );
@@ -158,19 +184,12 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
* Deals with the settings when they are saved by the admin. Here is
* where any validation should be dealt with.
*
- * @param array $new_instance New configuration values
- * @param array $old_instance Old configuration values
+ * @param array $new_instance New configuration values.
+ * @param array $old_instance Old configuration values.
*
* @return array
*/
- function update( $new_instance, $old_instance ) {
- $update_lat_lon = false;
- if (
- ! isset( $old_instance['address'] ) ||
- $this->urlencode_address( $old_instance['address'] ) != $this->urlencode_address( $new_instance['address'] )
- ) {
- $update_lat_lon = true;
- }
+ public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = wp_kses( $new_instance['title'], array() );
@@ -179,50 +198,6 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
$instance['email'] = wp_kses( $new_instance['email'], array() );
$instance['hours'] = wp_kses( $new_instance['hours'], array() );
$instance['apikey'] = wp_kses( isset( $new_instance['apikey'] ) ? $new_instance['apikey'] : $old_instance['apikey'], array() );
- $instance['lat'] = isset( $old_instance['lat'] ) ? floatval( $old_instance['lat'] ) : 0;
- $instance['lon'] = isset( $old_instance['lon'] ) ? floatval( $old_instance['lon'] ) : 0;
-
- if ( ! $instance['lat'] || ! $instance['lon'] ) {
- $update_lat_lon = true;
- }
-
- if ( $instance['address'] && $update_lat_lon ) {
-
- // Get the lat/lon of the user specified address.
- $address = $this->urlencode_address( $instance['address'] );
- $path = 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=' . $address;
- /** This action is documented in modules/widgets/contact-info.php */
- $key = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
-
- if ( ! empty( $key ) ) {
- $path = add_query_arg( 'key', $key, $path );
- }
- $json = wp_remote_retrieve_body( wp_remote_get( esc_url( $path, null, null ) ) );
-
- if ( ! $json ) {
- // The read failed :(
- esc_html_e( 'There was a problem getting the data to display this address on a map. Please refresh your browser and try again.', 'jetpack' );
- die();
- }
-
- $json_obj = json_decode( $json );
-
- if ( 'ZERO_RESULTS' == $json_obj->status ) {
- // The address supplied does not have a matching lat / lon.
- // No map is available.
- $instance['lat'] = '0';
- $instance['lon'] = '0';
- } else {
-
- $loc = $json_obj->results[0]->geometry->location;
-
- $lat = floatval( $loc->lat );
- $lon = floatval( $loc->lng );
-
- $instance['lat'] = "$lat";
- $instance['lon'] = "$lon";
- }
- }
if ( ! isset( $new_instance['showmap'] ) ) {
$instance['showmap'] = 0;
@@ -230,6 +205,8 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
$instance['showmap'] = intval( $new_instance['showmap'] );
}
+ $instance['goodmap'] = $this->update_goodmap( $old_instance, $instance );
+
return $instance;
}
@@ -241,18 +218,31 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*
* @return void
*/
- function form( $instance ) {
+ public function form( $instance ) {
$instance = wp_parse_args( $instance, $this->defaults() );
+ /** This filter is documented in modules/widgets/contact-info.php */
+ $apikey = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
+
wp_enqueue_script(
'contact-info-admin',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/contact-info/contact-info-admin.min.js',
'modules/widgets/contact-info/contact-info-admin.js'
),
array( 'jquery' ),
- 20160727
+ 20160727,
+ false
);
+ if ( is_customize_preview() ) {
+ $customize_contact_info_api_key_nonce = wp_create_nonce( 'customize_contact_info_api_key' );
+ wp_localize_script(
+ 'contact-info-admin',
+ 'contact_info_api_key_ajax_obj',
+ array( 'nonce' => $customize_contact_info_api_key_nonce )
+ );
+ }
+
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
@@ -262,30 +252,48 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>"><?php esc_html_e( 'Address:', 'jetpack' ); ?></label>
<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'address' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'address' ) ); ?>"><?php echo esc_textarea( $instance['address'] ); ?></textarea>
- <?php
- if ( $this->has_good_map( $instance ) ) {
- ?>
- <input class="jp-contact-info-showmap" id="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'showmap' ) ); ?>" value="1" type="checkbox" <?php checked( $instance['showmap'], 1 ); ?> />
- <label for="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>"><?php esc_html_e( 'Show map', 'jetpack' ); ?></label>
- <?php
- } else {
- ?>
- <span class="error-message"><?php _e( 'Sorry. We can not plot this address. A map will not be displayed. Is the address formatted correctly?', 'jetpack' ); ?></span>
- <input id="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'showmap' ) ); ?>" value="<?php echo( intval( $instance['showmap'] ) ); ?>" type="hidden" />
- <?php
- }
- ?>
+
+ <input class="jp-contact-info-showmap" id="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'showmap' ) ); ?>" value="1" type="checkbox" <?php checked( $instance['showmap'], 1 ); ?> />
+ <label for="<?php echo esc_attr( $this->get_field_id( 'showmap' ) ); ?>"><?php esc_html_e( 'Show map', 'jetpack' ); ?></label>
</p>
- <p class="jp-contact-info-apikey" style="<?php echo $instance['showmap'] ? '' : 'display: none;'; ?>">
+ <p class="jp-contact-info-admin-map" style="<?php echo $instance['showmap'] ? '' : 'display: none;'; ?>">
<label for="<?php echo esc_attr( $this->get_field_id( 'apikey' ) ); ?>">
- <?php _e( 'Google Maps API Key', 'jetpack' ); ?>
- <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'apikey' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'apikey' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['apikey'] ); ?>" />
+ <?php esc_html_e( 'Google Maps API Key', 'jetpack' ); ?>
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'apikey' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'apikey' ) ); ?>" type="text" value="<?php echo esc_attr( $apikey ); ?>" />
<br />
- <small><?php printf( wp_kses( __( 'Google now requires an API key to use their maps on your site. <a href="%s">See our documentation</a> for instructions on acquiring a key.', 'jetpack' ), array( 'a' => array( 'href' => true ) ) ), 'https://jetpack.com/support/extra-sidebar-widgets/contact-info-widget/' ); ?></small>
+ <small>
+ <?php
+ printf(
+ wp_kses(
+ /* Translators: placeholder is a URL to support documentation. */
+ __( 'Google now requires an API key to use their maps on your site. <a href="%s">See our documentation</a> for instructions on acquiring a key.', 'jetpack' ),
+ array(
+ 'a' => array(
+ 'href' => true,
+ ),
+ )
+ ),
+ 'https://jetpack.com/support/extra-sidebar-widgets/contact-info-widget/'
+ );
+ ?>
+ </small>
</label>
</p>
+ <p class="jp-contact-info-admin-map jp-contact-info-embed-map" style="<?php echo $instance['showmap'] ? '' : 'display: none;'; ?>">
+ <?php
+ if ( ! is_customize_preview() && true === $instance['goodmap'] ) {
+ echo $this->build_map( $instance['address'], $apikey ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ } elseif ( true !== $instance['goodmap'] && ! empty( $instance['goodmap'] ) ) {
+ printf(
+ '<span class="notice notice-warning" style="display: block;">%s</span>',
+ esc_html( $instance['goodmap'] )
+ );
+ }
+ ?>
+ </p>
+
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>"><?php esc_html_e( 'Phone:', 'jetpack' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'phone' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'phone' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['phone'] ); ?>" />
@@ -312,21 +320,21 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*
* @return string
*/
- function build_map_link( $address ) {
+ private function build_map_link( $address ) {
// Google map urls have lots of available params but zoom (z) and query (q) are enough.
return 'https://maps.google.com/maps?z=16&q=' . $this->urlencode_address( $address );
}
/**
- * Builds map display HTML code from the supplied latitude and longitude.
+ * Builds map display HTML code from the supplied address.
*
* @param string $address Address.
* @param string $api_key API Key.
*
* @return string HTML of the map.
*/
- function build_map( $address, $api_key = null ) {
+ private function build_map( $address, $api_key = null ) {
$this->enqueue_scripts();
$src = add_query_arg( 'q', rawurlencode( $address ), 'https://www.google.com/maps/embed/v1/place' );
if ( ! empty( $api_key ) ) {
@@ -365,16 +373,54 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
/**
* Encode an URL
*
- * @param string $address The URL to encode
+ * @param string $address The URL to encode.
*
* @return string The encoded URL
*/
- function urlencode_address( $address ) {
+ private function urlencode_address( $address ) {
$address = strtolower( $address );
- $address = preg_replace( '/\s+/', ' ', trim( $address ) ); // Get rid of any unwanted whitespace
- $address = str_ireplace( ' ', '+', $address ); // Use + not %20
- return urlencode( $address );
+ // Get rid of any unwanted whitespace.
+ $address = preg_replace( '/\s+/', ' ', trim( $address ) );
+ // Use + not %20.
+ $address = str_ireplace( ' ', '+', $address );
+ return rawurlencode( $address );
+ }
+
+ /**
+ * Returns the instance's updated 'goodmap' value.
+ *
+ * @param array $old_instance Old configuration values.
+ * @param array $instance Current configuration values.
+ *
+ * @return bool|string The instance's updated 'goodmap' value. The value is true if
+ * $instance can display a good map. If not, returns an error message.
+ */
+ private function update_goodmap( $old_instance, $instance ) {
+ /*
+ * If we have no address or don't want to show a map,
+ * no need to check if the map is valid.
+ */
+ if ( empty( $instance['address'] ) || 0 === $instance['showmap'] ) {
+ return false;
+ }
+
+ /*
+ * If there have been any changes that may impact the map in the widget
+ * (adding an address, address changes, new API key, API key change)
+ * then we want to check whether our map can be displayed again.
+ */
+ if (
+ ! isset( $instance['goodmap'] )
+ || ! isset( $old_instance['address'] )
+ || $this->urlencode_address( $old_instance['address'] ) !== $this->urlencode_address( $instance['address'] )
+ || ! isset( $old_instance['apikey'] )
+ || $old_instance['apikey'] !== $instance['apikey']
+ ) {
+ return $this->has_good_map( $instance );
+ } else {
+ return $instance['goodmap'];
+ }
}
/**
@@ -382,11 +428,49 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*
* @param array $instance Widget instance configuration.
*
- * @return bool Whether or not there is a valid map.
+ * @return bool|string Whether or not there is a valid map. If not, return an error message.
+ */
+ private function has_good_map( $instance ) {
+ /** This filter is documented in modules/widgets/contact-info.php */
+ $api_key = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
+ if ( ! empty( $api_key ) ) {
+ $path = add_query_arg(
+ array(
+ 'q' => rawurlencode( $instance['address'] ),
+ 'key' => $api_key,
+ ),
+ 'https://www.google.com/maps/embed/v1/place'
+ );
+ $wp_remote_get_args = array(
+ 'headers' => array( 'Referer' => home_url() ),
+ );
+ $response = wp_remote_get( esc_url_raw( $path ), $wp_remote_get_args );
+
+ if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
+ return true;
+ } else {
+ return wp_remote_retrieve_body( $response );
+ }
+ }
+
+ return __( 'Please enter a valid Google API Key.', 'jetpack' );
+ }
+
+ /**
+ * Check the Google Maps API key after an Ajax call from the widget's admin form in
+ * the Customizer preview.
*/
- function has_good_map( $instance ) {
- // The lat and lon of an address that could not be plotted will have values of 0 and 0.
- return ! ( '0' == $instance['lat'] && '0' == $instance['lon'] );
+ public function ajax_check_api_key() {
+ if ( isset( $_POST['apikey'] ) ) {
+ if ( check_ajax_referer( 'customize_contact_info_api_key' ) && current_user_can( 'customize' ) ) {
+ $apikey = wp_kses( $_POST['apikey'], array() );
+ $default_instance = $this->defaults();
+ $default_instance['apikey'] = $apikey;
+ wp_send_json( array( 'result' => esc_html( $this->has_good_map( $default_instance ) ) ) );
+ }
+ } else {
+ wp_die();
+ }
}
}
diff --git a/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js b/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js
index f51dccda..9d3d9d46 100644
--- a/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js
+++ b/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js
@@ -1,3 +1,5 @@
+/* global ajaxurl, contact_info_api_key_ajax_obj */
+
( function( $ ) {
$( document ).on( 'change', '.jp-contact-info-showmap', function() {
var $checkbox = $( this ),
@@ -5,7 +7,51 @@
$checkbox
.closest( '.widget' )
- .find( '.jp-contact-info-apikey' )
+ .find( '.jp-contact-info-admin-map' )
.toggle( isChecked );
} );
+
+ $( document ).on( 'widget-synced', function( event, widgetContainer ) {
+ // This event fires for all widgets, so restrict this to Contact Info widgets and the API key input.
+ if (
+ ! widgetContainer.is( '[id*="widget_contact_info"]' ) ||
+ ! $( document.activeElement ).is( 'input[id*="apikey"]' )
+ ) {
+ return;
+ }
+
+ event.preventDefault();
+
+ var $apikey_input = widgetContainer.find( 'input[id*="apikey"]' );
+
+ $.post(
+ ajaxurl,
+ {
+ _ajax_nonce: contact_info_api_key_ajax_obj.nonce,
+ action: 'customize-contact-info-api-key',
+ apikey: $apikey_input.val(),
+ },
+ function( data ) {
+ var $map_element = $apikey_input
+ .closest( '.jp-contact-info-admin-map' )
+ .parent()
+ .find( '.jp-contact-info-embed-map' );
+ var $warning_span = $map_element.find( '[class*="notice"]' );
+
+ if ( '1' !== data.result ) {
+ if ( $warning_span.length === 0 ) {
+ $map_element.append(
+ '<span class="notice notice-warning" style="display: block;">' +
+ data.result +
+ '</span>'
+ );
+ } else if ( $warning_span.text() !== data.result ) {
+ $warning_span.text( data.result );
+ }
+ } else {
+ $map_element.empty();
+ }
+ }
+ );
+ } );
} )( window.jQuery );
diff --git a/plugins/jetpack/modules/widgets/contact-info/contact-info-map.css b/plugins/jetpack/modules/widgets/contact-info/contact-info-map.css
index 7aa9e698..b64d2caa 100644
--- a/plugins/jetpack/modules/widgets/contact-info/contact-info-map.css
+++ b/plugins/jetpack/modules/widgets/contact-info/contact-info-map.css
@@ -1,4 +1,13 @@
.contact-map {
max-width: 100%;
border: 0;
+}
+
+.contact-map-api-error {
+ border-left-color: #ffb900;
+ border-left-style: solid;
+ border-left-width: 4px;
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
+ margin: 5px 0 15px;
+ padding: 1px 12px;
} \ No newline at end of file
diff --git a/plugins/jetpack/modules/widgets/eu-cookie-law.php b/plugins/jetpack/modules/widgets/eu-cookie-law.php
index 62acda4a..27ffa9a3 100644
--- a/plugins/jetpack/modules/widgets/eu-cookie-law.php
+++ b/plugins/jetpack/modules/widgets/eu-cookie-law.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Assets;
+
/**
* Disable direct access/execution to/of the widget code.
*/
@@ -99,7 +101,7 @@ if ( ! class_exists( 'Jetpack_EU_Cookie_Law_Widget' ) ) {
wp_enqueue_style( 'eu-cookie-law-style', plugins_url( 'eu-cookie-law/style.css', __FILE__ ), array(), '20170403' );
wp_enqueue_script(
'eu-cookie-law-script',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/eu-cookie-law/eu-cookie-law.min.js',
'modules/widgets/eu-cookie-law/eu-cookie-law.js'
),
@@ -189,7 +191,7 @@ if ( ! class_exists( 'Jetpack_EU_Cookie_Law_Widget' ) ) {
wp_enqueue_script(
'eu-cookie-law-widget-admin',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/eu-cookie-law/eu-cookie-law-admin.min.js',
'modules/widgets/eu-cookie-law/eu-cookie-law-admin.js'
),
diff --git a/plugins/jetpack/modules/widgets/facebook-likebox.php b/plugins/jetpack/modules/widgets/facebook-likebox.php
index 5fbc23e0..cb392b98 100644
--- a/plugins/jetpack/modules/widgets/facebook-likebox.php
+++ b/plugins/jetpack/modules/widgets/facebook-likebox.php
@@ -77,7 +77,7 @@ class WPCOM_Widget_Facebook_LikeBox extends WP_Widget {
$page_url = set_url_scheme( $like_args['href'], 'https' );
$like_args['show_faces'] = (bool) $like_args['show_faces'] ? 'true' : 'false';
- $like_args['stream'] = (bool) $like_args['stream'] ? 'true' : 'false';
+ $like_args['stream'] = (bool) $like_args['stream'] ? 'timeline' : 'false';
$like_args['cover'] = (bool) $like_args['cover'] ? 'false' : 'true';
echo $before_widget;
@@ -105,7 +105,7 @@ class WPCOM_Widget_Facebook_LikeBox extends WP_Widget {
?>
<div id="fb-root"></div>
- <div class="fb-page" data-href="<?php echo esc_url( $page_url ); ?>" data-width="<?php echo intval( $like_args['width'] ); ?>" data-height="<?php echo intval( $like_args['height'] ); ?>" data-hide-cover="<?php echo esc_attr( $like_args['cover'] ); ?>" data-show-facepile="<?php echo esc_attr( $like_args['show_faces'] ); ?>" data-show-posts="<?php echo esc_attr( $like_args['stream'] ); ?>">
+ <div class="fb-page" data-href="<?php echo esc_url( $page_url ); ?>" data-width="<?php echo intval( $like_args['width'] ); ?>" data-height="<?php echo intval( $like_args['height'] ); ?>" data-hide-cover="<?php echo esc_attr( $like_args['cover'] ); ?>" data-show-facepile="<?php echo esc_attr( $like_args['show_faces'] ); ?>" data-tabs="<?php echo esc_attr( $like_args['stream'] ); ?>">
<div class="fb-xfbml-parse-ignore"><blockquote cite="<?php echo esc_url( $page_url ); ?>"><a href="<?php echo esc_url( $page_url ); ?>"><?php echo esc_html( $title ); ?></a></blockquote></div>
</div>
<?php
@@ -193,7 +193,7 @@ class WPCOM_Widget_Facebook_LikeBox extends WP_Widget {
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'stream' ) ); ?>">
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'stream' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'stream' ) ); ?>" <?php checked( $like_args['stream'] ); ?> />
- <?php _e( 'Show Stream', 'jetpack' ); ?>
+ <?php _e( 'Show Timeline', 'jetpack' ); ?>
<br />
<small><?php _e( 'Show Page Posts.', 'jetpack' ); ?></small>
</label>
diff --git a/plugins/jetpack/modules/widgets/flickr.php b/plugins/jetpack/modules/widgets/flickr.php
index a7867612..20b32dd2 100644
--- a/plugins/jetpack/modules/widgets/flickr.php
+++ b/plugins/jetpack/modules/widgets/flickr.php
@@ -51,6 +51,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
return array(
'title' => esc_html__( 'Flickr Photos', 'jetpack' ),
'items' => 4,
+ 'target' => false,
'flickr_image_size' => 'thumbnail',
'flickr_rss_url' => '',
);
@@ -73,7 +74,7 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
* Parse the URL, and rebuild a URL that's sure to display images.
* Some Flickr Feeds do not display images by default.
*/
- $flickr_parameters = parse_url( htmlspecialchars_decode( $instance['flickr_rss_url'] ) );
+ $flickr_parameters = wp_parse_url( htmlspecialchars_decode( $instance['flickr_rss_url'] ) );
// Is it a Flickr Feed.
if (
@@ -129,8 +130,11 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
break;
}
- $photos .= '<a href="' . esc_url( $photo->get_permalink(), array( 'http', 'https' ) ) . '">';
- $photos .= '<img src="' . esc_url( $src, array( 'http', 'https' ) ) . '" ';
+ $photos .= '<a href="' . esc_url( $photo->get_permalink(), array( 'http', 'https' ) ) . '" ';
+ if ( $instance['target'] ) {
+ $photos .= 'target="_blank" rel="noopener noreferrer" ';
+ }
+ $photos .= '><img src="' . esc_url( $src, array( 'http', 'https' ) ) . '" ';
$photos .= 'alt="' . esc_attr( $photo->get_title() ) . '" ';
$photos .= 'title="' . esc_attr( $photo->get_title() ) . '" ';
$photos .= ' /></a>';
@@ -189,6 +193,10 @@ if ( ! class_exists( 'Jetpack_Flickr_Widget' ) ) {
$instance['items'] = intval( $new_instance['items'] );
}
+ if ( isset( $new_instance['target'] ) ) {
+ $instance['target'] = (bool) $new_instance['target'];
+ }
+
if (
isset( $new_instance['flickr_image_size'] ) &&
in_array( $new_instance['flickr_image_size'], array( 'thumbnail', 'small', 'large' ) )
diff --git a/plugins/jetpack/modules/widgets/flickr/form.php b/plugins/jetpack/modules/widgets/flickr/form.php
index b08e7c4d..0dfc5c9a 100644
--- a/plugins/jetpack/modules/widgets/flickr/form.php
+++ b/plugins/jetpack/modules/widgets/flickr/form.php
@@ -30,7 +30,7 @@
<small>
<?php printf(
__( 'Leave the Flickr RSS URL field blank to display <a target="_blank" href="%s">interesting</a> Flickr photos.', 'jetpack' ),
- 'http://www.flickr.com/explore/interesting'
+ 'https://www.flickr.com/explore/interesting'
); ?>
</small>
</p>
@@ -52,6 +52,16 @@
</p>
<p>
+ <label>
+ <input
+ type="checkbox"
+ name="<?php echo esc_attr( $this->get_field_name( 'target' ) ); ?>"
+ <?php checked( $instance['target'] ); ?>
+ />
+ <?php esc_html_e( 'Open images in new tab?', 'jetpack' ); ?>
+ </label>
+</p>
+<p>
<div>
<?php esc_html_e( 'What size photos would you like to display?', 'jetpack' ); ?>
</div>
diff --git a/plugins/jetpack/modules/widgets/gallery.php b/plugins/jetpack/modules/widgets/gallery.php
index 8cb24d01..aa631e62 100644
--- a/plugins/jetpack/modules/widgets/gallery.php
+++ b/plugins/jetpack/modules/widgets/gallery.php
@@ -5,9 +5,11 @@ Plugin Name: Gallery
Description: Gallery widget
Author: Automattic Inc.
Version: 1.0
-Author URI: http://automattic.com
+Author URI: https://automattic.com
*/
+use Automattic\Jetpack\Assets;
+
class Jetpack_Gallery_Widget extends WP_Widget {
const THUMB_SIZE = 45;
const DEFAULT_WIDTH = 265;
@@ -400,7 +402,7 @@ class Jetpack_Gallery_Widget extends WP_Widget {
public function enqueue_frontend_scripts() {
wp_register_script(
'gallery-widget',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/gallery/js/gallery.min.js',
'modules/widgets/gallery/js/gallery.js'
)
@@ -417,7 +419,7 @@ class Jetpack_Gallery_Widget extends WP_Widget {
wp_enqueue_script(
'gallery-widget-admin',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/gallery/js/admin.min.js',
'modules/widgets/gallery/js/admin.js'
),
diff --git a/plugins/jetpack/modules/widgets/gallery/js/admin.js b/plugins/jetpack/modules/widgets/gallery/js/admin.js
index 71025a9b..6a926d69 100644
--- a/plugins/jetpack/modules/widgets/gallery/js/admin.js
+++ b/plugins/jetpack/modules/widgets/gallery/js/admin.js
@@ -1,4 +1,3 @@
-/* jshint onevar: false, multistr: true */
/* global _wpMediaViewsL10n, _wpGalleryWidgetAdminSettings */
( function( $ ) {
diff --git a/plugins/jetpack/modules/widgets/goodreads.php b/plugins/jetpack/modules/widgets/goodreads.php
index 4160c868..d6ea6515 100644
--- a/plugins/jetpack/modules/widgets/goodreads.php
+++ b/plugins/jetpack/modules/widgets/goodreads.php
@@ -95,7 +95,7 @@ class WPCOM_Widget_Goodreads extends WP_Widget {
$response = wp_remote_head(
$url, array(
'httpversion' => '1.1',
- 'timeout' => 3,
+ 'timeout' => 10,
'redirection' => 2,
)
);
diff --git a/plugins/jetpack/modules/widgets/google-translate.php b/plugins/jetpack/modules/widgets/google-translate.php
index 241fb8ed..87742317 100644
--- a/plugins/jetpack/modules/widgets/google-translate.php
+++ b/plugins/jetpack/modules/widgets/google-translate.php
@@ -1,11 +1,14 @@
<?php
+
+use Automattic\Jetpack\Assets;
+
/**
* Plugin Name: Google Translate Widget for WordPress.com
- * Plugin URI: http://automattic.com
+ * Plugin URI: https://automattic.com
* Description: Add a widget for automatic translation
* Author: Artur Piszek
* Version: 0.1
- * Author URI: http://automattic.com
+ * Author URI: https://automattic.com
* Text Domain: jetpack
*/
if ( ! defined( 'ABSPATH' ) ) {
@@ -46,7 +49,7 @@ class Jetpack_Google_Translate_Widget extends WP_Widget {
public function enqueue_scripts() {
wp_register_script(
'google-translate-init',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/google-translate/google-translate.min.js',
'modules/widgets/google-translate/google-translate.js'
)
diff --git a/plugins/jetpack/modules/widgets/gravatar-profile.php b/plugins/jetpack/modules/widgets/gravatar-profile.php
index f5171665..2dd4e5fb 100644
--- a/plugins/jetpack/modules/widgets/gravatar-profile.php
+++ b/plugins/jetpack/modules/widgets/gravatar-profile.php
@@ -11,7 +11,7 @@ function jetpack_gravatar_profile_widget_init() {
/**
* Display a widgetized version of your Gravatar Profile
- * http://blog.gravatar.com/2010/03/26/gravatar-profiles/
+ * https://blog.gravatar.com/2010/03/26/gravatar-profiles/
*/
class Jetpack_Gravatar_Profile_Widget extends WP_Widget {
diff --git a/plugins/jetpack/modules/widgets/image-widget.php b/plugins/jetpack/modules/widgets/image-widget.php
index 37a353c1..d455b4c2 100644
--- a/plugins/jetpack/modules/widgets/image-widget.php
+++ b/plugins/jetpack/modules/widgets/image-widget.php
@@ -229,13 +229,13 @@ class Jetpack_Image_Widget extends WP_Widget {
<p><label for="' . $this->get_field_id( 'img_url' ) . '">' . esc_html__( 'Image URL:', 'jetpack' ) . '
<input class="widefat" id="' . $this->get_field_id( 'img_url' ) . '" name="' . $this->get_field_name( 'img_url' ) . '" type="text" value="' . $img_url . '" />
</label></p>
- <p><label for="' . $this->get_field_id( 'alt_text' ) . '">' . esc_html__( 'Alternate text:', 'jetpack' ) . ' <a href="http://support.wordpress.com/widgets/image-widget/#image-widget-alt-text" target="_blank">( ? )</a>
+ <p><label for="' . $this->get_field_id( 'alt_text' ) . '">' . esc_html__( 'Alternate text:', 'jetpack' ) . ' <a href="https://support.wordpress.com/widgets/image-widget/#image-widget-alt-text" target="_blank">( ? )</a>
<input class="widefat" id="' . $this->get_field_id( 'alt_text' ) . '" name="' . $this->get_field_name( 'alt_text' ) . '" type="text" value="' . $alt_text . '" />
</label></p>
- <p><label for="' . $this->get_field_id( 'img_title' ) . '">' . esc_html__( 'Image title:', 'jetpack' ) . ' <a href="http://support.wordpress.com/widgets/image-widget/#image-widget-title" target="_blank">( ? )</a>
+ <p><label for="' . $this->get_field_id( 'img_title' ) . '">' . esc_html__( 'Image title:', 'jetpack' ) . ' <a href="https://support.wordpress.com/widgets/image-widget/#image-widget-title" target="_blank">( ? )</a>
<input class="widefat" id="' . $this->get_field_id( 'img_title' ) . '" name="' . $this->get_field_name( 'img_title' ) . '" type="text" value="' . $img_title . '" />
</label></p>
- <p><label for="' . $this->get_field_id( 'caption' ) . '">' . esc_html__( 'Caption:', 'jetpack' ) . ' <a href="http://support.wordpress.com/widgets/image-widget/#image-widget-caption" target="_blank">( ? )</a>
+ <p><label for="' . $this->get_field_id( 'caption' ) . '">' . esc_html__( 'Caption:', 'jetpack' ) . ' <a href="https://support.wordpress.com/widgets/image-widget/#image-widget-caption" target="_blank">( ? )</a>
<textarea class="widefat" id="' . $this->get_field_id( 'caption' ) . '" name="' . $this->get_field_name( 'caption' ) . '" rows="2" cols="20">' . $caption . '</textarea>
</label></p>';
diff --git a/plugins/jetpack/modules/widgets/milestone/milestone.php b/plugins/jetpack/modules/widgets/milestone/milestone.php
index 8490a8ec..2da5582b 100644
--- a/plugins/jetpack/modules/widgets/milestone/milestone.php
+++ b/plugins/jetpack/modules/widgets/milestone/milestone.php
@@ -4,10 +4,12 @@ Plugin Name: Milestone
Description: Countdown to a specific date.
Version: 1.0
Author: Automattic Inc.
-Author URI: http://automattic.com/
+Author URI: https://automattic.com/
License: GPLv2 or later
*/
+use Automattic\Jetpack\Assets;
+
function jetpack_register_widget_milestone() {
register_widget( 'Milestone_Widget' );
}
@@ -62,7 +64,7 @@ class Milestone_Widget extends WP_Widget {
wp_enqueue_style( 'milestone-admin', self::$url . 'style-admin.css', array(), '20161215' );
wp_enqueue_script(
'milestone-admin-js',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/milestone/admin.min.js',
'modules/widgets/milestone/admin.js'
),
@@ -80,7 +82,7 @@ class Milestone_Widget extends WP_Widget {
wp_enqueue_script(
'milestone',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/milestone/milestone.min.js',
'modules/widgets/milestone/milestone.js'
),
@@ -531,7 +533,7 @@ class Milestone_Widget extends WP_Widget {
* Sanitize an instance of this widget.
*
* Date ranges match the documentation for mktime in the php manual.
- * @see http://php.net/manual/en/function.mktime.php#refsect1-function.mktime-parameters
+ * @see https://php.net/manual/en/function.mktime.php#refsect1-function.mktime-parameters
*
* @uses Milestone_Widget::sanitize_range().
*/
diff --git a/plugins/jetpack/modules/widgets/search.php b/plugins/jetpack/modules/widgets/search.php
index 54d866b5..49cb9b7f 100644
--- a/plugins/jetpack/modules/widgets/search.php
+++ b/plugins/jetpack/modules/widgets/search.php
@@ -7,6 +7,9 @@
* @since 5.0.0
*/
+use Automattic\Jetpack\Constants;
+use Automattic\Jetpack\Status;
+
add_action( 'widgets_init', 'jetpack_search_widget_init' );
function jetpack_search_widget_init() {
@@ -164,7 +167,7 @@ class Jetpack_Search_Widget extends WP_Widget {
* @since 5.8.0
*/
public function enqueue_frontend_scripts() {
- if ( ! is_active_widget( false, false, $this->id_base, true ) ) {
+ if ( ! is_active_widget( false, false, $this->id_base, true ) || Constants::is_true( 'JETPACK_SEARCH_PROTOTYPE' ) ) {
return;
}
@@ -266,7 +269,7 @@ class Jetpack_Search_Widget extends WP_Widget {
$display_filters = false;
- if ( Jetpack::is_development_mode() ) {
+ if ( ( new Status() )->is_development_mode() ) {
echo $args['before_widget'];
?><div id="<?php echo esc_attr( $this->id ); ?>-wrapper">
<div class="jetpack-search-sort-wrapper">
@@ -309,7 +312,8 @@ class Jetpack_Search_Widget extends WP_Widget {
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
echo $args['before_widget'];
- ?><div id="<?php echo esc_attr( $this->id ); ?>-wrapper">
+ ?><div id="<?php echo esc_attr( $this->id ); ?>-wrapper" class="<?php
+ echo Constants::is_true( 'JETPACK_SEARCH_PROTOTYPE' ) ? 'jetpack-instant-search-wrapper' : '' ?>">
<?php
if ( ! empty( $title ) ) {
@@ -393,6 +397,10 @@ class Jetpack_Search_Widget extends WP_Widget {
* @param string $orderby The orderby to initialize the select with.
*/
private function maybe_render_sort_javascript( $instance, $order, $orderby ) {
+ if ( Constants::is_true( 'JETPACK_SEARCH_PROTOTYPE' ) ) {
+ return;
+ }
+
if ( ! empty( $instance['user_sort_enabled'] ) ) :
?>
<script type="text/javascript">
diff --git a/plugins/jetpack/modules/widgets/simple-payments.php b/plugins/jetpack/modules/widgets/simple-payments.php
index 4eb60bdb..397c43fe 100644
--- a/plugins/jetpack/modules/widgets/simple-payments.php
+++ b/plugins/jetpack/modules/widgets/simple-payments.php
@@ -1,4 +1,6 @@
<?php
+use Automattic\Jetpack\Tracking;
+
/**
* Disable direct access/execution to/of the widget code.
*/
@@ -13,7 +15,19 @@ if ( ! class_exists( 'Jetpack_Simple_Payments_Widget' ) ) {
* Display a Simple Payments Button as a Widget.
*/
class Jetpack_Simple_Payments_Widget extends WP_Widget {
- // https://developer.paypal.com/docs/integration/direct/rest/currency-codes/
+ /**
+ * Currencies should be supported by PayPal:
+ * @link https://developer.paypal.com/docs/api/reference/currency-codes/
+ *
+ * List has to be in sync with list at the block's client side and API's backend side:
+ * @link https://github.com/Automattic/jetpack/blob/31efa189ad223c0eb7ad085ac0650a23facf9ef5/extensions/blocks/simple-payments/constants.js#L9-L39
+ * @link https://github.com/Automattic/jetpack/blob/31efa189ad223c0eb7ad085ac0650a23facf9ef5/modules/simple-payments/simple-payments.php#L386-L415
+ *
+ * Indian Rupee (INR) is listed here for backwards compatibility with previously added widgets.
+ * It's not supported by Simple Payments because at the time of the creation of this file
+ * because it's limited to in-country PayPal India accounts only.
+ * Discussion: https://github.com/Automattic/wp-calypso/pull/28236
+ */
private static $supported_currency_list = array(
'USD' => '$',
'GBP' => '&#163;',
@@ -435,7 +449,8 @@ if ( ! class_exists( 'Jetpack_Simple_Payments_Widget' ) ) {
return;
}
- jetpack_tracks_record_event( $current_user, 'jetpack_wpa_simple_payments_button_' . $event_action, $event_properties );
+ $tracking = new Tracking();
+ $tracking->tracks_record_event( $current_user, 'jetpack_wpa_simple_payments_button_' . $event_action, $event_properties );
$jetpack = Jetpack::init();
// $jetpack->stat automatically prepends the stat group with 'jetpack-'
$jetpack->stat( 'simple_payments', $stat_name );
diff --git a/plugins/jetpack/modules/widgets/social-icons.php b/plugins/jetpack/modules/widgets/social-icons.php
index 7afbd27d..bea4a147 100644
--- a/plugins/jetpack/modules/widgets/social-icons.php
+++ b/plugins/jetpack/modules/widgets/social-icons.php
@@ -1,6 +1,12 @@
-<?php
+<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
+
+/**
+ * Social Icons Widget.
+ */
class Jetpack_Widget_Social_Icons extends WP_Widget {
/**
+ * Default widget options.
+ *
* @var array Default widget options.
*/
protected $defaults;
@@ -52,8 +58,19 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
* Script & styles for admin widget form.
*/
public function enqueue_admin_scripts() {
- wp_enqueue_script( 'jetpack-widget-social-icons-script', plugins_url( 'social-icons/social-icons-admin.js', __FILE__ ), array( 'jquery-ui-sortable' ), '20170506' );
- wp_enqueue_style( 'jetpack-widget-social-icons-admin', plugins_url( 'social-icons/social-icons-admin.css', __FILE__ ), array(), '20170506' );
+ wp_enqueue_script(
+ 'jetpack-widget-social-icons-script',
+ plugins_url( 'social-icons/social-icons-admin.js', __FILE__ ),
+ array( 'jquery-ui-sortable' ),
+ '20170506',
+ true
+ );
+ wp_enqueue_style(
+ 'jetpack-widget-social-icons-admin',
+ plugins_url( 'social-icons/social-icons-admin.css', __FILE__ ),
+ array(),
+ '20170506'
+ );
}
/**
@@ -67,28 +84,28 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
* JavaScript for admin widget form.
*/
public function render_admin_js() {
- ?>
+ ?>
<script type="text/html" id="tmpl-jetpack-widget-social-icons-template">
<?php self::render_icons_template(); ?>
</script>
- <?php
+ <?php
}
/**
* Add SVG definitions to the footer.
*/
public function include_svg_icons() {
- // Define SVG sprite file in Jetpack
+ // Define SVG sprite file in Jetpack.
$svg_icons = dirname( dirname( __FILE__ ) ) . '/theme-tools/social-menu/social-menu.svg';
- // Define SVG sprite file in WPCOM
+ // Define SVG sprite file in WPCOM.
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
$svg_icons = dirname( dirname( __FILE__ ) ) . '/social-menu/social-menu.svg';
}
// If it exists, include it.
if ( is_file( $svg_icons ) ) {
- require_once( $svg_icons );
+ require_once $svg_icons;
}
}
@@ -106,10 +123,10 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
- echo $args['before_widget'];
+ echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( ! empty( $title ) ) {
- echo $args['before_title'] . esc_html( $title ) . $args['after_title'];
+ echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
if ( ! empty( $instance['icons'] ) ) :
@@ -118,13 +135,13 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
$social_icons = $this->get_supported_icons();
$default_icon = $this->get_svg_icon( array( 'icon' => 'chain' ) );
- // Set target attribute for the link
+ // Set target attribute for the link.
if ( true === $instance['new-tab'] ) {
$target = '_blank';
} else {
$target = '_self';
}
- ?>
+ ?>
<ul class="jetpack-social-widget-list size-<?php echo esc_attr( $instance['icon-size'] ); ?>">
@@ -132,21 +149,31 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
<?php if ( ! empty( $icon['url'] ) ) : ?>
<li class="jetpack-social-widget-item">
- <a href="<?php echo esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype' ) ); ?>" target="<?php echo $target; ?>">
+ <a href="<?php echo esc_url( $icon['url'], array( 'http', 'https', 'mailto', 'skype' ) ); ?>" target="<?php echo esc_attr( $target ); ?>">
<?php
$found_icon = false;
foreach ( $social_icons as $social_icon ) {
- if ( false !== stripos( $icon['url'], $social_icon['url'] ) ) {
- echo '<span class="screen-reader-text">' . esc_attr( $social_icon['label'] ) . '</span>';
- echo $this->get_svg_icon( array( 'icon' => esc_attr( $social_icon['icon'] ) ) );
- $found_icon = true;
- break;
+ foreach ( $social_icon['url'] as $url_fragment ) {
+ if ( false !== stripos( $icon['url'], $url_fragment ) ) {
+ printf(
+ '<span class="screen-reader-text">%1$s</span>%2$s',
+ esc_attr( $social_icon['label'] ),
+ // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
+ $this->get_svg_icon(
+ array(
+ 'icon' => esc_attr( $social_icon['icon'] ),
+ )
+ )
+ );
+ $found_icon = true;
+ break;
+ }
}
}
if ( ! $found_icon ) {
- echo $default_icon;
+ echo $default_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</a>
@@ -157,10 +184,10 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
</ul>
- <?php
+ <?php
endif;
- echo $args['after_widget'];
+ echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
/** This action is documented in modules/widgets/gravatar-profile.php */
do_action( 'jetpack_stats_extra', 'widget_view', 'social_icons' );
@@ -177,15 +204,16 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ) {
+ $instance = array();
+
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['icon-size'] = $this->defaults['icon-size'];
- if ( in_array( $new_instance['icon-size'], array( 'small', 'medium', 'large' ) ) ) {
+ if ( in_array( $new_instance['icon-size'], array( 'small', 'medium', 'large' ), true ) ) {
$instance['icon-size'] = $new_instance['icon-size'];
}
$instance['new-tab'] = isset( $new_instance['new-tab'] ) ? (bool) $new_instance['new-tab'] : false;
- $icon_count = count( $new_instance['url-icons'] );
$instance['icons'] = array();
foreach ( $new_instance['url-icons'] as $url ) {
@@ -222,13 +250,13 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
?>
<p>
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<p>
- <label for="<?php echo $this->get_field_id( 'icon-size' ); ?>"><?php esc_html_e( 'Size:', 'jetpack' ); ?></label>
- <select class="widefat" name="<?php echo $this->get_field_name( 'icon-size' ); ?>">
+ <label for="<?php echo esc_attr( $this->get_field_id( 'icon-size' ) ); ?>"><?php esc_html_e( 'Size:', 'jetpack' ); ?></label>
+ <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'icon-size' ) ); ?>">
<?php foreach ( $sizes as $value => $label ) : ?>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $instance['icon-size'] ); ?>><?php echo esc_attr( $label ); ?></option>
<?php endforeach; ?>
@@ -236,8 +264,8 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
</p>
<div class="jetpack-social-icons-widget-list"
- data-url-icon-id="<?php echo $this->get_field_id( 'url-icons' ); ?>"
- data-url-icon-name="<?php echo $this->get_field_name( 'url-icons' ); ?>"
+ data-url-icon-id="<?php echo esc_attr( $this->get_field_id( 'url-icons' ) ); ?>"
+ data-url-icon-name="<?php echo esc_attr( $this->get_field_name( 'url-icons' ) ); ?>"
>
<?php
@@ -282,19 +310,19 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
</p>
<p>
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id( 'new-tab' ); ?>" name="<?php echo $this->get_field_name( 'new-tab' ); ?>" <?php checked( $new_tab ); ?> />
- <label for="<?php echo $this->get_field_id( 'new-tab' ); ?>"><?php esc_html_e( 'Open link in a new tab', 'jetpack' ); ?></label>
+ <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'new-tab' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'new-tab' ) ); ?>" <?php checked( $new_tab ); ?> />
+ <label for="<?php echo esc_attr( $this->get_field_id( 'new-tab' ) ); ?>"><?php esc_html_e( 'Open link in a new tab', 'jetpack' ); ?></label>
</p>
- <?php
+ <?php
}
/**
* Generates template to add icons.
*
- * @param array $args Template arguments
+ * @param array $args Template arguments.
*/
- static function render_icons_template( $args = array() ) {
+ private static function render_icons_template( $args = array() ) {
$defaults = array(
'url-icon-id' => '',
'url-icon-name' => '',
@@ -311,7 +339,7 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
<p class="jetpack-widget-social-icons-url">
<?php
printf(
- '<input class="widefat id="%1$s" name="%2$s[]" type="text" placeholder="%3$s" value="%4$s"/>',
+ '<input class="widefat" id="%1$s" name="%2$s[]" type="text" placeholder="%3$s" value="%4$s"/>',
esc_attr( $args['url-icon-id'] ),
esc_attr( $args['url-icon-name'] ),
esc_attr__( 'Account URL', 'jetpack' ),
@@ -364,7 +392,7 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
$aria_hidden = ' aria-hidden="true"';
// Begin SVG markup.
- $svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . ' role="img">';
+ $svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . ' role="presentation">';
/*
* Display the icon.
@@ -388,277 +416,256 @@ class Jetpack_Widget_Social_Icons extends WP_Widget {
public function get_supported_icons() {
$social_links_icons = array(
array(
- 'url' => '500px.com',
+ 'url' => array( '500px.com' ),
'icon' => '500px',
'label' => '500px',
),
array(
- 'url' => 'amazon.cn',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.in',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.fr',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.de',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.it',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.nl',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.es',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.co',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.ca',
- 'icon' => 'amazon',
- 'label' => 'Amazon',
- ),
- array(
- 'url' => 'amazon.com',
+ 'url' => array(
+ 'amazon.cn',
+ 'amazon.in',
+ 'amazon.fr',
+ 'amazon.de',
+ 'amazon.it',
+ 'amazon.nl',
+ 'amazon.es',
+ 'amazon.co',
+ 'amazon.ca',
+ 'amazon.com',
+ ),
'icon' => 'amazon',
'label' => 'Amazon',
),
array(
- 'url' => 'apple.com',
+ 'url' => array( 'apple.com' ),
'icon' => 'apple',
'label' => 'Apple',
),
array(
- 'url' => 'itunes.com',
+ 'url' => array( 'itunes.com' ),
'icon' => 'apple',
'label' => 'iTunes',
),
array(
- 'url' => 'bandcamp.com',
+ 'url' => array( 'bandcamp.com' ),
'icon' => 'bandcamp',
'label' => 'Bandcamp',
),
array(
- 'url' => 'behance.net',
+ 'url' => array( 'behance.net' ),
'icon' => 'behance',
'label' => 'Behance',
),
array(
- 'url' => 'codepen.io',
+ 'url' => array( 'codepen.io' ),
'icon' => 'codepen',
'label' => 'CodePen',
),
array(
- 'url' => 'deviantart.com',
+ 'url' => array( 'deviantart.com' ),
'icon' => 'deviantart',
'label' => 'DeviantArt',
),
array(
- 'url' => 'digg.com',
+ 'url' => array( 'digg.com' ),
'icon' => 'digg',
'label' => 'Digg',
),
array(
- 'url' => 'discord.gg',
+ 'url' => array( 'discord.gg', 'discordapp.com' ),
'icon' => 'discord',
'label' => 'Discord',
),
array(
- 'url' => 'discordapp.com',
- 'icon' => 'discord',
- 'label' => 'Discord',
- ),
- array(
- 'url' => 'dribbble.com',
+ 'url' => array( 'dribbble.com' ),
'icon' => 'dribbble',
'label' => 'Dribbble',
),
array(
- 'url' => 'dropbox.com',
+ 'url' => array( 'dropbox.com' ),
'icon' => 'dropbox',
'label' => 'Dropbox',
),
array(
- 'url' => 'etsy.com',
+ 'url' => array( 'etsy.com' ),
'icon' => 'etsy',
'label' => 'Etsy',
),
array(
- 'url' => 'facebook.com',
+ 'url' => array( 'facebook.com' ),
'icon' => 'facebook',
'label' => 'Facebook',
),
array(
- 'url' => '/feed/',
+ 'url' => array(
+ '/feed/', // WordPress default feed url.
+ '/feeds/', // Blogspot and others.
+ '/blog/feed', // No trailing slash WordPress feed, could use /feed but may match unexpectedly.
+ 'format=RSS', // Squarespace and others.
+ '/rss', // Tumblr.
+ '/.rss', // Reddit.
+ '/rss.xml', // Moveable Type, Typepad.
+ 'http://rss.', // Old custom format.
+ 'https://rss.', // Old custom format.
+ 'rss=1',
+ '/feed=rss', // Catches feed=rss / feed=rss2.
+ '?feed=rss', // WordPress non-permalink - Catches feed=rss / feed=rss2.
+ '?feed=rdf', // WordPress non-permalink.
+ '?feed=atom', // WordPress non-permalink.
+ 'http://feeds.', // FeedBurner.
+ 'https://feeds.', // FeedBurner.
+ '/feed.xml', // Feedburner Alias, and others.
+ '/index.xml', // Moveable Type, and others.
+ '/atom.xml', // Typepad, Squarespace.
+ '.atom', // Shopify blog.
+ '/atom', // Some non-WordPress feeds.
+ 'index.rdf', // Typepad.
+ ),
'icon' => 'feed',
'label' => __( 'RSS Feed', 'jetpack' ),
),
array(
- 'url' => 'flickr.com',
+ 'url' => array( 'flickr.com' ),
'icon' => 'flickr',
'label' => 'Flickr',
),
array(
- 'url' => 'foursquare.com',
+ 'url' => array( 'foursquare.com' ),
'icon' => 'foursquare',
'label' => 'Foursquare',
),
array(
- 'url' => 'goodreads.com',
+ 'url' => array( 'goodreads.com' ),
'icon' => 'goodreads',
'label' => 'Goodreads',
- ),
+ ),
array(
- 'url' => 'google.com',
+ 'url' => array( 'google.com', 'google.co.uk', 'google.ca', 'google.cn', 'google.it' ),
'icon' => 'google',
'label' => 'Google',
),
array(
- 'url' => 'github.com',
+ 'url' => array( 'github.com' ),
'icon' => 'github',
'label' => 'GitHub',
),
array(
- 'url' => 'instagram.com',
+ 'url' => array( 'instagram.com' ),
'icon' => 'instagram',
'label' => 'Instagram',
),
array(
- 'url' => 'linkedin.com',
+ 'url' => array( 'linkedin.com' ),
'icon' => 'linkedin',
'label' => 'LinkedIn',
),
array(
- 'url' => 'mailto:',
+ 'url' => array( 'mailto:' ),
'icon' => 'mail',
'label' => __( 'Email', 'jetpack' ),
),
array(
- 'url' => 'meetup.com',
+ 'url' => array( 'meetup.com' ),
'icon' => 'meetup',
'label' => 'Meetup',
),
array(
- 'url' => 'medium.com',
+ 'url' => array( 'medium.com' ),
'icon' => 'medium',
'label' => 'Medium',
),
array(
- 'url' => 'pinterest.',
+ 'url' => array( 'pinterest.' ),
'icon' => 'pinterest',
'label' => 'Pinterest',
),
array(
- 'url' => 'getpocket.com',
+ 'url' => array( 'getpocket.com' ),
'icon' => 'pocket',
'label' => 'Pocket',
),
array(
- 'url' => 'reddit.com',
+ 'url' => array( 'reddit.com' ),
'icon' => 'reddit',
'label' => 'Reddit',
),
array(
- 'url' => 'skype.com',
+ 'url' => array( 'skype.com' ),
'icon' => 'skype',
'label' => 'Skype',
),
array(
- 'url' => 'skype:',
+ 'url' => array( 'skype:' ),
'icon' => 'skype',
'label' => 'Skype',
),
array(
- 'url' => 'slideshare.net',
+ 'url' => array( 'slideshare.net' ),
'icon' => 'slideshare',
'label' => 'SlideShare',
),
array(
- 'url' => 'snapchat.com',
+ 'url' => array( 'snapchat.com' ),
'icon' => 'snapchat',
'label' => 'Snapchat',
),
array(
- 'url' => 'soundcloud.com',
+ 'url' => array( 'soundcloud.com' ),
'icon' => 'soundcloud',
'label' => 'SoundCloud',
),
array(
- 'url' => 'spotify.com',
+ 'url' => array( 'spotify.com' ),
'icon' => 'spotify',
'label' => 'Spotify',
),
array(
- 'url' => 'stackoverflow.com',
+ 'url' => array( 'stackoverflow.com' ),
'icon' => 'stackoverflow',
'label' => 'Stack Overflow',
),
array(
- 'url' => 'stumbleupon.com',
+ 'url' => array( 'stumbleupon.com' ),
'icon' => 'stumbleupon',
'label' => 'StumbleUpon',
),
array(
- 'url' => 'tumblr.com',
+ 'url' => array( 'tumblr.com' ),
'icon' => 'tumblr',
'label' => 'Tumblr',
),
array(
- 'url' => 'twitch.tv',
+ 'url' => array( 'twitch.tv' ),
'icon' => 'twitch',
'label' => 'Twitch',
),
array(
- 'url' => 'twitter.com',
+ 'url' => array( 'twitter.com' ),
'icon' => 'twitter',
'label' => 'Twitter',
),
array(
- 'url' => 'vimeo.com',
+ 'url' => array( 'vimeo.com' ),
'icon' => 'vimeo',
'label' => 'Vimeo',
),
array(
- 'url' => 'vk.com',
+ 'url' => array( 'vk.com' ),
'icon' => 'vk',
'label' => 'VK',
),
array(
- 'url' => 'wordpress.com',
- 'icon' => 'wordpress',
- 'label' => 'WordPress.com',
- ),
- array(
- 'url' => 'wordpress.org',
+ 'url' => array( 'wordpress.com', 'wordpress.org' ),
'icon' => 'wordpress',
'label' => 'WordPress',
),
array(
- 'url' => 'yelp.com',
+ 'url' => array( 'yelp.com' ),
'icon' => 'yelp',
'label' => 'Yelp',
),
array(
- 'url' => 'youtube.com',
+ 'url' => array( 'youtube.com' ),
'icon' => 'youtube',
'label' => 'YouTube',
),
diff --git a/plugins/jetpack/modules/widgets/social-media-icons.php b/plugins/jetpack/modules/widgets/social-media-icons.php
index 0e8028ef..214e6ed9 100644
--- a/plugins/jetpack/modules/widgets/social-media-icons.php
+++ b/plugins/jetpack/modules/widgets/social-media-icons.php
@@ -147,7 +147,7 @@ class WPCOM_social_media_icons_widget extends WP_Widget {
/** Check if full URL entered in configuration, use it instead of tinkering **/
if (
in_array(
- parse_url( $username, PHP_URL_SCHEME ),
+ wp_parse_url( $username, PHP_URL_SCHEME ),
array( 'http', 'https' )
)
) {
diff --git a/plugins/jetpack/modules/widgets/top-posts.php b/plugins/jetpack/modules/widgets/top-posts.php
index cdcd59d1..9a804392 100644
--- a/plugins/jetpack/modules/widgets/top-posts.php
+++ b/plugins/jetpack/modules/widgets/top-posts.php
@@ -310,7 +310,7 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
if ( ! $posts ) {
$link = 'https://jetpack.com/support/getting-more-views-and-traffic/';
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
- $link = 'http://en.support.wordpress.com/getting-more-site-traffic/';
+ $link = 'https://en.support.wordpress.com/getting-more-site-traffic/';
}
if ( current_user_can( 'edit_theme_options' ) ) {
@@ -363,7 +363,7 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
$image = Jetpack_PostImages::get_image(
$post['post_id'],
array(
- 'fallback_to_avatars' => true,
+ 'fallback_to_avatars' => (bool) $get_image_options['fallback_to_avatars'],
'width' => (int) $width,
'height' => (int) $height,
'avatar_size' => (int) $get_image_options['avatar_size'],
@@ -406,11 +406,16 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
*/
$filtered_permalink = apply_filters( 'jetpack_top_posts_widget_permalink', $post['permalink'], $post );
- ?>
- <a href="<?php echo esc_url( $filtered_permalink ); ?>" title="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" class="bump-view" data-bump-view="tp">
- <img width="<?php echo absint( $width ); ?>" height="<?php echo absint( $height ); ?>" src="<?php echo esc_url( $post['image'] ); ?>" alt="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" data-pin-nopin="true" />
- </a>
- <?php
+ printf(
+ '<a href="%1$s" title="%2$s" class="bump-view" data-bump-view="tp"%3$s><img width="%4$d" height="%5$d" src="%6$s" alt="%2$s" data-pin-nopin="true"/></a>',
+ esc_url( $filtered_permalink ),
+ esc_attr( wp_kses( $post['title'], array() ) ),
+ ( get_queried_object_id() === $post['post_id'] ? ' aria-current="page"' : '' ),
+ absint( $width ),
+ absint( $height ),
+ esc_url( $post['image'] )
+ );
+
/**
* Fires after each Top Post result, inside <li>.
*
@@ -437,16 +442,24 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
/** This filter is documented in modules/widgets/top-posts.php */
$filtered_permalink = apply_filters( 'jetpack_top_posts_widget_permalink', $post['permalink'], $post );
- ?>
- <a href="<?php echo esc_url( $filtered_permalink ); ?>" title="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" class="bump-view" data-bump-view="tp">
- <img width="<?php echo absint( $width ); ?>" height="<?php echo absint( $height ); ?>" src="<?php echo esc_url( $post['image'] ); ?>" class='widgets-list-layout-blavatar' alt="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" data-pin-nopin="true" />
- </a>
- <div class="widgets-list-layout-links">
- <a href="<?php echo esc_url( $filtered_permalink ); ?>" class="bump-view" data-bump-view="tp">
- <?php echo esc_html( wp_kses( $post['title'], array() ) ); ?>
+
+ printf(
+ '<a href="%1$s" title="%2$s" class="bump-view" data-bump-view="tp"%3$s>
+ <img width="%4$d" height="%5$d" src="%6$s" alt="%2$s" data-pin-nopin="true" class="widgets-list-layout-blavatar"/>
</a>
- </div>
- <?php
+ <div class="widgets-list-layout-links">
+ <a href="%1$s" title="%2$s" class="bump-view" data-bump-view="tp"%3$s>%7$s</a>
+ </div>
+ ',
+ esc_url( $filtered_permalink ),
+ esc_attr( wp_kses( $post['title'], array() ) ),
+ ( get_queried_object_id() === $post['post_id'] ? ' aria-current="page"' : '' ),
+ absint( $width ),
+ absint( $height ),
+ esc_url( $post['image'] ),
+ esc_html( wp_kses( $post['title'], array() ) )
+ );
+
/** This action is documented in modules/widgets/top-posts.php */
do_action( 'jetpack_widget_top_posts_after_post', $post['post_id'] );
?>
@@ -467,11 +480,14 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
/** This filter is documented in modules/widgets/top-posts.php */
$filtered_permalink = apply_filters( 'jetpack_top_posts_widget_permalink', $post['permalink'], $post );
- ?>
- <a href="<?php echo esc_url( $filtered_permalink ); ?>" class="bump-view" data-bump-view="tp">
- <?php echo esc_html( wp_kses( $post['title'], array() ) ); ?>
- </a>
- <?php
+
+ printf(
+ '<a href="%1$s" class="bump-view" data-bump-view="tp"%2$s>%3$s</a>',
+ esc_url( $filtered_permalink ),
+ ( get_queried_object_id() === $post['post_id'] ? ' aria-current="page"' : '' ),
+ esc_html( wp_kses( $post['title'], array() ) )
+ );
+
/** This action is documented in modules/widgets/top-posts.php */
do_action( 'jetpack_widget_top_posts_after_post', $post['post_id'] );
?>
diff --git a/plugins/jetpack/modules/widgets/twitter-timeline.php b/plugins/jetpack/modules/widgets/twitter-timeline.php
index 0f16e330..6f9662a3 100644
--- a/plugins/jetpack/modules/widgets/twitter-timeline.php
+++ b/plugins/jetpack/modules/widgets/twitter-timeline.php
@@ -8,6 +8,8 @@
* - https://dev.twitter.com/docs/embedded-timelines
*/
+use Automattic\Jetpack\Assets;
+
/**
* Register the widget for use in Appearance -> Widgets
*/
@@ -65,7 +67,7 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget {
if ( 'widgets.php' === $hook ) {
wp_enqueue_script(
'twitter-timeline-admin',
- Jetpack::get_file_url_for_environment(
+ Assets::get_file_url_for_environment(
'_inc/build/widgets/twitter-timeline-admin.min.js',
'modules/widgets/twitter-timeline-admin.js'
)
diff --git a/plugins/jetpack/modules/widgets/wordpress-post-widget.php b/plugins/jetpack/modules/widgets/wordpress-post-widget.php
index f518ad61..fb9ffa7a 100644
--- a/plugins/jetpack/modules/widgets/wordpress-post-widget.php
+++ b/plugins/jetpack/modules/widgets/wordpress-post-widget.php
@@ -4,7 +4,7 @@
* Description: Displays recent posts from a WordPress.com or Jetpack-enabled self-hosted WordPress site.
* Version: 1.0
* Author: Brad Angelcyk, Kathryn Presner, Justin Shreve, Carolyn Sonnek
- * Author URI: http://automattic.com
+ * Author URI: https://automattic.com
* License: GPL2
*/
diff --git a/plugins/jetpack/modules/widgets/wordpress-post-widget/class.jetpack-display-posts-widget.php b/plugins/jetpack/modules/widgets/wordpress-post-widget/class.jetpack-display-posts-widget.php
index 265e2ebb..723bc5a5 100644
--- a/plugins/jetpack/modules/widgets/wordpress-post-widget/class.jetpack-display-posts-widget.php
+++ b/plugins/jetpack/modules/widgets/wordpress-post-widget/class.jetpack-display-posts-widget.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Status;
+
/*
* Display a list of recent posts from a WordPress.com or Jetpack-enabled blog.
*/
@@ -145,7 +147,7 @@ class Jetpack_Display_Posts_Widget extends Jetpack_Display_Posts_Widget__Base {
/**
* If Jetpack is not active or in development mode, we don't want to update widget data.
*/
- if ( ! Jetpack::is_active() && ! Jetpack::is_development_mode() ) {
+ if ( ! Jetpack::is_active() && ! ( new Status() )->is_development_mode() ) {
return false;
}
diff --git a/plugins/jetpack/modules/widgets/wordpress-post-widget/style.css b/plugins/jetpack/modules/widgets/wordpress-post-widget/style.css
index 651ec153..026e40db 100644
--- a/plugins/jetpack/modules/widgets/wordpress-post-widget/style.css
+++ b/plugins/jetpack/modules/widgets/wordpress-post-widget/style.css
@@ -3,20 +3,13 @@
}
.jetpack-display-remote-posts h4 {
- font-size: 90%;
margin: 5px 0;
padding: 0;
}
-.jetpack-display-remote-posts h4 a {
- text-decoration: none;
-}
-
.jetpack-display-remote-posts p {
- margin: 0 !important;
+ margin: 0;
padding: 0;
- line-height: 1.4em !important;
- font-size: 90%;
}
.jetpack-display-remote-posts img {
diff --git a/plugins/jetpack/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php b/plugins/jetpack/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php
index 5214db3f..f8ee1912 100644
--- a/plugins/jetpack/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php
+++ b/plugins/jetpack/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php
@@ -28,8 +28,8 @@ class Jetpack_WooCommerce_Analytics_Universal {
// add to carts from non-product pages or lists (search, store etc.)
add_action( 'wp_head', array( $this, 'loop_session_events' ), 2 );
- // loading s.js
- add_action( 'wp_head', array( $this, 'wp_head_bottom' ), 999999 );
+ // loading s.js.
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_tracking_script' ) );
// Capture cart events
add_action( 'woocommerce_add_to_cart', array( $this, 'capture_add_to_cart' ), 10, 6 );
@@ -64,12 +64,16 @@ class Jetpack_WooCommerce_Analytics_Universal {
/**
- * Place script to call s.js, Store Analytics
+ * Place script to call s.js, Store Analytics.
*/
- public function wp_head_bottom() {
- $filename = 's-' . gmdate( 'YW' ) . '.js';
- $async_code = "<script async src='https://stats.wp.com/" . $filename . "'></script>";
- echo "$async_code\r\n";
+ public function enqueue_tracking_script() {
+ $filename = sprintf(
+ 'https://stats.wp.com/s-%d.js',
+ gmdate( 'YW' )
+ );
+
+ // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
+ wp_enqueue_script( 'woocommerce-analytics', esc_url( $filename ), array(), null, false );
}
/**
diff --git a/plugins/jetpack/modules/wordads/php/api.php b/plugins/jetpack/modules/wordads/php/api.php
index 34b5235a..f2308523 100644
--- a/plugins/jetpack/modules/wordads/php/api.php
+++ b/plugins/jetpack/modules/wordads/php/api.php
@@ -1,5 +1,8 @@
<?php
+use Automattic\Jetpack\Connection\Client;
+use Automattic\Jetpack\Status;
+
/**
* Methods for accessing data through the WPCOM REST API
*
@@ -18,7 +21,7 @@ class WordAds_API {
*/
public static function get_wordads_status() {
global $wordads_status_response;
- if ( Jetpack::is_development_mode() ) {
+ if ( ( new Status() )->is_development_mode() ) {
self::$wordads_status = array(
'approved' => true,
'active' => true,
@@ -30,7 +33,7 @@ class WordAds_API {
}
$endpoint = sprintf( '/sites/%d/wordads/status', Jetpack::get_option( 'id' ) );
- $wordads_status_response = $response = Jetpack_Client::wpcom_json_api_request_as_blog( $endpoint );
+ $wordads_status_response = $response = Client::wpcom_json_api_request_as_blog( $endpoint );
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
return new WP_Error( 'api_error', __( 'Error connecting to API.', 'jetpack' ), $response );
}
@@ -55,7 +58,7 @@ class WordAds_API {
*/
public static function get_wordads_ads_txt() {
$endpoint = sprintf( '/sites/%d/wordads/ads-txt', Jetpack::get_option( 'id' ) );
- $wordads_status_response = $response = Jetpack_Client::wpcom_json_api_request_as_blog( $endpoint );
+ $wordads_status_response = $response = Client::wpcom_json_api_request_as_blog( $endpoint );
if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
return new WP_Error( 'api_error', __( 'Error connecting to API.', 'jetpack' ), $response );
}
diff --git a/plugins/jetpack/modules/wordads/php/params.php b/plugins/jetpack/modules/wordads/php/params.php
index ef3f3326..30c86648 100644
--- a/plugins/jetpack/modules/wordads/php/params.php
+++ b/plugins/jetpack/modules/wordads/php/params.php
@@ -1,5 +1,7 @@
<?php
+use Automattic\Jetpack\Status;
+
class WordAds_Params {
/**
@@ -51,8 +53,8 @@ class WordAds_Params {
$this->mobile_device = jetpack_is_mobile( 'any', true );
$this->targeting_tags = array(
'WordAds' => 1,
- 'BlogId' => Jetpack::is_development_mode() ? 0 : Jetpack_Options::get_option( 'id' ),
- 'Domain' => esc_js( parse_url( home_url(), PHP_URL_HOST ) ),
+ 'BlogId' => ( new Status() )->is_development_mode() ? 0 : Jetpack_Options::get_option( 'id' ),
+ 'Domain' => esc_js( wp_parse_url( home_url(), PHP_URL_HOST ) ),
'PageURL' => esc_js( $this->url ),
'LangId' => false !== strpos( get_bloginfo( 'language' ), 'en' ) ? 1 : 0, // TODO something else?
'AdSafe' => 1, // TODO
diff --git a/plugins/jetpack/modules/wordads/wordads.php b/plugins/jetpack/modules/wordads/wordads.php
index 43a4e7d8..3fc03fb1 100644
--- a/plugins/jetpack/modules/wordads/wordads.php
+++ b/plugins/jetpack/modules/wordads/wordads.php
@@ -61,6 +61,32 @@ class WordAds {
'inline-plugin' => 320,
);
+ /**
+ * Counter to enable unique, sequential section IDs for all amp-ad units
+ *
+ * @var int
+ */
+ public static $amp_section_id = 1;
+
+ /**
+ * Checks for AMP support and returns true iff active & AMP request
+ * @return boolean True if supported AMP request
+ *
+ * @since 7.5.0
+ */
+ public static function is_amp() {
+ return class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request();
+ }
+
+ /**
+ * Increment the AMP section ID and return the value
+ *
+ * @return int
+ */
+ public static function get_amp_section_id() {
+ return self::$amp_section_id++;
+ }
+
public static $SOLO_UNIT_CSS = 'float:left;margin-right:5px;margin-top:0px;';
/**
@@ -106,7 +132,8 @@ class WordAds {
* @since 4.5.0
*/
function __construct() {
- add_action( 'init', array( $this, 'init' ) );
+ add_action( 'wp', array( $this, 'init' ) );
+ add_action( 'rest_api_init', array( $this, 'init' ) );
}
/**
@@ -170,6 +197,7 @@ class WordAds {
* @since 4.5.0
*/
private function insert_adcode() {
+ add_filter( 'wp_resource_hints', array( $this, 'resource_hints' ), 10, 2 );
add_action( 'wp_head', array( $this, 'insert_head_meta' ), 20 );
add_action( 'wp_head', array( $this, 'insert_head_iponweb' ), 30 );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
@@ -206,15 +234,19 @@ class WordAds {
}
if ( $this->option( 'enable_header_ad', true ) ) {
- switch ( get_stylesheet() ) {
- case 'twentyseventeen':
- case 'twentyfifteen':
- case 'twentyfourteen':
- add_action( 'wp_footer', array( $this, 'insert_header_ad_special' ) );
- break;
- default:
- add_action( 'wp_head', array( $this, 'insert_header_ad' ), 100 );
- break;
+ if ( self::is_amp() ) {
+ add_filter( 'the_content', array( $this, 'insert_header_ad_amp' ) );
+ } else {
+ switch ( get_stylesheet() ) {
+ case 'twentyseventeen':
+ case 'twentyfifteen':
+ case 'twentyfourteen':
+ add_action( 'wp_footer', array( $this, 'insert_header_ad_special' ) );
+ break;
+ default:
+ add_action( 'wp_head', array( $this, 'insert_header_ad' ), 100 );
+ break;
+ }
}
}
}
@@ -234,11 +266,43 @@ class WordAds {
}
/**
+ * Add the IPW resource hints
+ *
+ * @since 7.9
+ */
+ public function resource_hints( $hints, $relation_type ) {
+ if ( 'dns-prefetch' === $relation_type ) {
+ $hints[] = '//s.pubmine.com';
+ $hints[] = '//x.bidswitch.net';
+ $hints[] = '//static.criteo.net';
+ $hints[] = '//ib.adnxs.com';
+ $hints[] = '//aax.amazon-adsystem.com';
+ $hints[] = '//bidder.criteo.com';
+ $hints[] = '//cas.criteo.com';
+ $hints[] = '//gum.criteo.com';
+ $hints[] = '//ads.pubmatic.com';
+ $hints[] = '//gads.pubmatic.com';
+ $hints[] = '//tpc.googlesyndication.com';
+ $hints[] = '//ad.doubleclick.net';
+ $hints[] = '//googleads.g.doubleclick.net';
+ $hints[] = '//www.googletagservices.com';
+ $hints[] = '//cdn.switchadhub.com';
+ $hints[] = '//delivery.g.switchadhub.com';
+ $hints[] = '//delivery.swid.switchadhub.com';
+ }
+
+ return $hints;
+ }
+
+ /**
* IPONWEB metadata used by the various scripts
*
* @return [type] [description]
*/
function insert_head_meta() {
+ if ( self::is_amp() ) {
+ return;
+ }
$themename = esc_js( get_stylesheet() );
$pagetype = intval( $this->params->get_page_type_ipw() );
$data_tags = ( $this->params->cloudflare ) ? ' data-cfasync="false"' : '';
@@ -261,23 +325,18 @@ HTML;
* @since 4.5.0
*/
function insert_head_iponweb() {
+ if ( self::is_amp() ) {
+ return;
+ }
$data_tags = ( $this->params->cloudflare ) ? ' data-cfasync="false"' : '';
echo <<<HTML
- <link rel='dns-prefetch' href='//s.pubmine.com' />
- <link rel='dns-prefetch' href='//x.bidswitch.net' />
- <link rel='dns-prefetch' href='//static.criteo.net' />
- <link rel='dns-prefetch' href='//ib.adnxs.com' />
- <link rel='dns-prefetch' href='//aax.amazon-adsystem.com' />
- <link rel='dns-prefetch' href='//bidder.criteo.com' />
- <link rel='dns-prefetch' href='//cas.criteo.com' />
- <link rel='dns-prefetch' href='//gum.criteo.com' />
- <link rel='dns-prefetch' href='//ads.pubmatic.com' />
- <link rel='dns-prefetch' href='//gads.pubmatic.com' />
- <link rel='dns-prefetch' href='//tpc.googlesyndication.com' />
- <link rel='dns-prefetch' href='//ad.doubleclick.net' />
- <link rel='dns-prefetch' href='//googleads.g.doubleclick.net' />
- <link rel='dns-prefetch' href='//www.googletagservices.com' />
- <script$data_tags async type="text/javascript" src="//s.pubmine.com/head.js"></script>
+ <script$data_tags type="text/javascript">
+ (function(){function g(a,c){a:{for(var b=a.length,d="string"==typeof a?a.split(""):a,e=0;e<b;e++)if(e in d&&c.call(void 0,d[e],e,a)){c=e;break a}c=-1}return 0>c?null:"string"==typeof a?a.charAt(c):a[c]};function h(a,c,b){b=null!=b?"="+encodeURIComponent(String(b)):"";if(c+=b){b=a.indexOf("#");0>b&&(b=a.length);var d=a.indexOf("?");if(0>d||d>b){d=b;var e=""}else e=a.substring(d+1,b);a=[a.substr(0,d),e,a.substr(b)];b=a[1];a[1]=c?b?b+"&"+c:c:b;a=a[0]+(a[1]?"?"+a[1]:"")+a[2]}return a};var k=0;function l(a,c){var b=document.createElement("script");b.src=a;b.onload=function(){c&&c(void 0)};b.onerror=function(){c("error")};a=document.getElementsByTagName("head");var d;a&&0!==a.length?d=a[0]:d=document.documentElement;d.appendChild(b)}function m(a){return"string"==typeof a&&0<a.length}
+ function p(a,c,b){c=void 0===c?"":c;b=void 0===b?".":b;var d=[];Object.keys(a).forEach(function(e){var f=a[e],n=typeof f;"object"==n&&null!=f||"function"==n?d.push(p(f,c+e+b)):null!==f&&void 0!==f&&(e=encodeURIComponent(c+e),d.push(e+"="+encodeURIComponent(f)))});return d.filter(m).join("&")}function q(){return window.__ATA||{}}function r(a,c){a||(q().config=c.c,l(c.url))}var t=Math.floor(1E13*Math.random());q().rid=t;
+ var u=q().pageParams,v="//"+(q().serverDomain||"s.pubmine.com")+"/conf",w=window.top===window,x;try{var y=JSON.parse(document.getElementById("oil-configuration").innerText);if("boolean"!==typeof y.gdpr_applies)throw Error("Config doesn't contain gdpr_applies");x=y.gdpr_applies?1:0}catch(a){x=null}
+ var z=x,A=window.__ATA_PP||u||null,B=w?document.referrer?document.referrer:null:null,C=w?null:document.referrer?document.referrer:null,D=function(){var a=void 0===a?document.cookie:a;return(a=g(a.split("; "),function(c){return-1!=c.indexOf("__ATA_tuuid=")}))?a.split("=")[1]:""}(),E=p({gdpr:z,pp:A,rid:t,src:B,ref:C,tuuid:D?D:null,vp:window.innerWidth+"x"+window.innerHeight},"",".");
+ (function(a){var c;k++;var b="callback__"+Date.now().toString(36)+"_"+k.toString(36);a=h(a,void 0===c?"cb":c,b);window[b]=function(d){r(void 0,d)};l(a,function(d){d&&r(d)})})(v+"?"+E);}).call(this);
+ </script>
HTML;
}
@@ -396,11 +455,30 @@ HTML;
$ad_type = $this->option( 'wordads_house' ) ? 'house' : 'iponweb';
echo $this->get_ad( 'top', $ad_type );
- echo <<<HTML
+ if ( ! self::is_amp() ) {
+ echo <<<HTML
<script type="text/javascript">
jQuery('.wpcnt-header').insertBefore('$selector');
</script>
HTML;
+ }
+ }
+
+ /**
+ * Header unit for AMP
+ *
+ * @param string $content Content of the page.
+ *
+ * @since 7.5.0
+ */
+ public function insert_header_ad_amp( $content ) {
+
+ $ad_type = $this->option( 'wordads_house' ) ? 'house' : 'iponweb';
+ if ( 'house' === $ad_type ) {
+ return $content;
+ }
+ return $this->get_ad( 'top_amp', $ad_type ) . $content;
+
}
/**
@@ -456,6 +534,11 @@ HTML;
} elseif ( 'inline' === $spot ) {
$section_id = 0 === $this->params->blog_id ? WORDADS_API_TEST_ID : $this->params->blog_id . '5';
$snippet = $this->get_ad_snippet( $section_id, $height, $width, $spot, self::$SOLO_UNIT_CSS );
+ } elseif ( 'top_amp' === $spot ) {
+ // 320x50 unit which can safely be inserted below title, above content in a variety of themes.
+ $width = 320;
+ $height = 50;
+ $snippet = $this->get_ad_snippet( null, $height, $width );
}
} elseif ( 'house' == $type ) {
$leaderboard = 'top' == $spot && ! $this->params->mobile_device;
@@ -481,14 +564,28 @@ HTML;
*
* @since 5.7
*/
- function get_ad_snippet( $section_id, $height, $width, $location = '', $css = '' ) {
+ public function get_ad_snippet( $section_id, $height, $width, $location = '', $css = '' ) {
$this->ads[] = array(
'location' => $location,
'width' => $width,
'height' => $height,
);
- $ad_number = count( $this->ads ) . '-' . uniqid();
+ if ( self::is_amp() ) {
+ $height = esc_attr( $height + 15 ); // this will ensure enough padding for "Report this ad"
+ $width = esc_attr( $width );
+ $amp_section_id = esc_attr( self::get_amp_section_id() );
+ $site_id = esc_attr( $this->params->blog_id );
+ return <<<HTML
+ <amp-ad width="$width" height="$height"
+ type="pubmine"
+ data-siteid="$site_id"
+ data-section="$amp_section_id">
+ </amp-ad>
+HTML;
+ }
+
+ $ad_number = count( $this->ads ) . '-' . uniqid();
$data_tags = $this->params->cloudflare ? ' data-cfasync="false"' : '';
$css = esc_attr( $css );
diff --git a/plugins/jetpack/modules/wpcc.php b/plugins/jetpack/modules/wpcc.php
deleted file mode 100644
index 88c13090..00000000
--- a/plugins/jetpack/modules/wpcc.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Deprecated. No longer needed.
- *
- * @package Jetpack
- */
diff --git a/plugins/jetpack/modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php b/plugins/jetpack/modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php
index 7fe46fc4..b40dd837 100644
--- a/plugins/jetpack/modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php
+++ b/plugins/jetpack/modules/wpcom-block-editor/class-jetpack-wpcom-block-editor.php
@@ -41,7 +41,8 @@ class Jetpack_WPCOM_Block_Editor {
}
add_action( 'login_init', array( $this, 'allow_block_editor_login' ), 1 );
- add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_scripts' ) );
+ add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_scripts' ), 9 );
+ add_action( 'enqueue_block_assets', array( $this, 'enqueue_styles' ) );
add_filter( 'mce_external_plugins', array( $this, 'add_tinymce_plugins' ) );
}
@@ -137,7 +138,7 @@ class Jetpack_WPCOM_Block_Editor {
*/
public function add_login_html() {
?>
- <input type="hidden" name="redirect_to" value="<?php echo esc_url( $_REQUEST['redirect_to'] ); ?>" />
+ <input type="hidden" name="redirect_to" value="<?php echo esc_url( $_REQUEST['redirect_to'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended ?>" />
<script type="application/javascript">
document.getElementById( 'loginform' ).addEventListener( 'submit' , function() {
document.getElementById( 'wp-submit' ).setAttribute( 'disabled', 'disabled' );
@@ -151,7 +152,7 @@ class Jetpack_WPCOM_Block_Editor {
* Does the redirect to the block editor.
*/
public function do_redirect() {
- wp_redirect( $GLOBALS['redirect_to'] );
+ wp_safe_redirect( $GLOBALS['redirect_to'] );
exit;
}
@@ -265,7 +266,19 @@ class Jetpack_WPCOM_Block_Editor {
wp_enqueue_script(
'wpcom-block-editor-common',
$src_common,
- array( 'lodash', 'wp-compose', 'wp-data', 'wp-editor', 'wp-rich-text' ),
+ array(
+ 'jquery',
+ 'lodash',
+ 'wp-blocks',
+ 'wp-compose',
+ 'wp-data',
+ 'wp-dom-ready',
+ 'wp-editor',
+ 'wp-nux',
+ 'wp-plugins',
+ 'wp-polyfill',
+ 'wp-rich-text',
+ ),
$version,
true
);
@@ -285,16 +298,6 @@ class Jetpack_WPCOM_Block_Editor {
)
);
- $src_styles = $debug
- ? '//widgets.wp.com/wpcom-block-editor/common.css?minify=false'
- : '//widgets.wp.com/wpcom-block-editor/common.min.css';
- wp_enqueue_style(
- 'wpcom-block-editor-styles',
- $src_styles,
- array(),
- $version
- );
-
if ( $this->is_iframed_block_editor() ) {
$src_calypso_iframe_bridge = $debug
? '//widgets.wp.com/wpcom-block-editor/calypso-iframe-bridge-server.js?minify=false'
@@ -303,7 +306,18 @@ class Jetpack_WPCOM_Block_Editor {
wp_enqueue_script(
'wpcom-block-editor-calypso-iframe-bridge',
$src_calypso_iframe_bridge,
- array( 'calypsoify_wpadminmods_js', 'jquery', 'lodash', 'react', 'wp-blocks', 'wp-data', 'wp-hooks', 'wp-tinymce', 'wp-url' ),
+ array(
+ 'calypsoify_wpadminmods_js',
+ 'jquery',
+ 'lodash',
+ 'react',
+ 'wp-blocks',
+ 'wp-data',
+ 'wp-hooks',
+ 'wp-polyfill',
+ 'wp-tinymce',
+ 'wp-url',
+ ),
$version,
true
);
@@ -311,6 +325,53 @@ class Jetpack_WPCOM_Block_Editor {
}
/**
+ * Enqueue WP.com block editor common styles.
+ */
+ public function enqueue_styles() {
+ // Enqueue only for the block editor in WP Admin.
+ global $pagenow;
+ if ( is_admin() && ! in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) {
+ return;
+ }
+
+ // Enqueue on the front-end only if justified blocks are present.
+ if ( ! is_admin() && ! $this->has_justified_block() ) {
+ return;
+ }
+
+ $debug = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
+ $version = gmdate( 'Ymd' );
+
+ $src_styles = $debug
+ ? '//widgets.wp.com/wpcom-block-editor/common.css?minify=false'
+ : '//widgets.wp.com/wpcom-block-editor/common.min.css';
+ wp_enqueue_style(
+ 'wpcom-block-editor-styles',
+ $src_styles,
+ array(),
+ $version
+ );
+ }
+
+ /**
+ * Determines if the current $post contains a justified paragraph block.
+ *
+ * @return boolean true if justified paragraph is found, false otherwise.
+ */
+ public function has_justified_block() {
+ global $post;
+ if ( ! $post instanceof WP_Post ) {
+ return false;
+ };
+
+ if ( ! has_blocks( $post ) ) {
+ return false;
+ }
+
+ return false !== strpos( $post->post_content, '<!-- wp:paragraph {"align":"justify"' );
+ }
+
+ /**
* Register the Tiny MCE plugins for the WordPress.com block editor integration.
*
* @param array $plugin_array An array of external Tiny MCE plugins.