summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules')
-rw-r--r--plugins/jetpack/modules/after-the-deadline.php2
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.js8
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.php26
-rw-r--r--plugins/jetpack/modules/comments.php9
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-contact-form.php44
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php2
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php2
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php2
-rw-r--r--plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php1
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css.php11
-rw-r--r--plugins/jetpack/modules/custom-post-types/portfolios.php14
-rw-r--r--plugins/jetpack/modules/custom-post-types/testimonial.php2
-rw-r--r--plugins/jetpack/modules/enhanced-distribution.php24
-rw-r--r--plugins/jetpack/modules/gravatar-hovercards.php2
-rw-r--r--plugins/jetpack/modules/infinite-scroll.php2
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.js12
-rw-r--r--plugins/jetpack/modules/infinite-scroll/infinity.php25
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php4
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyten.php6
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php4
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php6
-rw-r--r--plugins/jetpack/modules/json-api.php5
-rw-r--r--plugins/jetpack/modules/likes.php144
-rw-r--r--plugins/jetpack/modules/manage.php13
-rw-r--r--plugins/jetpack/modules/manage/confirm-admin.php5
-rw-r--r--plugins/jetpack/modules/markdown/easy-markdown.php6
-rw-r--r--plugins/jetpack/modules/minileven.php6
-rw-r--r--plugins/jetpack/modules/minileven/minileven.php2
-rw-r--r--plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php2
-rw-r--r--plugins/jetpack/modules/monitor.php3
-rw-r--r--plugins/jetpack/modules/notes.php23
-rw-r--r--plugins/jetpack/modules/post-by-email.php7
-rw-r--r--plugins/jetpack/modules/protect.php10
-rw-r--r--plugins/jetpack/modules/publicize.php33
-rw-r--r--plugins/jetpack/modules/publicize/publicize-jetpack.php38
-rw-r--r--plugins/jetpack/modules/publicize/publicize.php6
-rw-r--r--plugins/jetpack/modules/related-posts.php16
-rw-r--r--plugins/jetpack/modules/related-posts/jetpack-related-posts.php4
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharedaddy.php2
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-sources.php22
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.css3
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.js6
-rw-r--r--plugins/jetpack/modules/shortcodes.php7
-rw-r--r--plugins/jetpack/modules/shortcodes/cartodb.php21
-rw-r--r--plugins/jetpack/modules/shortcodes/dailymotion.php114
-rw-r--r--plugins/jetpack/modules/shortcodes/slideshow.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/soundcloud.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/vimeo.php8
-rw-r--r--plugins/jetpack/modules/shortcodes/wufoo.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/youtube.php23
-rw-r--r--plugins/jetpack/modules/site-icon.php2
-rw-r--r--plugins/jetpack/modules/site-icon/jetpack-site-icon.php2
-rw-r--r--plugins/jetpack/modules/sitemaps/sitemap-xsl.php32
-rw-r--r--plugins/jetpack/modules/sso.php8
-rw-r--r--plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css6
-rw-r--r--plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css2
-rw-r--r--plugins/jetpack/modules/sso/jetpack-sso-login.css6
-rw-r--r--plugins/jetpack/modules/sso/jetpack-sso-login.js2
-rw-r--r--plugins/jetpack/modules/sso/jetpack-sso-login.min.css2
-rw-r--r--plugins/jetpack/modules/stats.php23
-rw-r--r--plugins/jetpack/modules/subscriptions.php18
-rw-r--r--plugins/jetpack/modules/theme-tools/random-redirect.php6
-rw-r--r--plugins/jetpack/modules/theme-tools/site-breadcrumbs.php70
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery.php2
-rw-r--r--plugins/jetpack/modules/verification-tools/blog-verification-tools.php2
-rw-r--r--plugins/jetpack/modules/videopress/js/videopress-admin.js2
-rw-r--r--plugins/jetpack/modules/widgets/contact-info.php72
-rw-r--r--plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js8
-rw-r--r--plugins/jetpack/modules/widgets/contact-info/contact-info-map.css15
-rw-r--r--plugins/jetpack/modules/widgets/contact-info/contact-info-map.js41
-rw-r--r--plugins/jetpack/modules/widgets/gravatar-profile.php2
-rw-r--r--plugins/jetpack/modules/widgets/social-media-icons.php2
-rw-r--r--plugins/jetpack/modules/widgets/top-posts.php2
-rw-r--r--plugins/jetpack/modules/widgets/top-posts/style.css2
-rw-r--r--plugins/jetpack/modules/widgets/twitter-timeline.php2
78 files changed, 579 insertions, 513 deletions
diff --git a/plugins/jetpack/modules/after-the-deadline.php b/plugins/jetpack/modules/after-the-deadline.php
index 967a9ce6..c3326e45 100644
--- a/plugins/jetpack/modules/after-the-deadline.php
+++ b/plugins/jetpack/modules/after-the-deadline.php
@@ -130,7 +130,7 @@ function register_AtD_button( $buttons ) {
function add_AtD_tinymce_plugin( $plugin_array ) {
$plugin = ATD_TINYMCE_4 ? 'plugin' : 'editor_plugin';
- $plugin_array['AtD'] = plugins_url( 'after-the-deadline/tinymce/' . $plugin . '.js?v=' . ATD_VERSION, __FILE__ );
+ $plugin_array['AtD'] = add_query_arg( 'v', ATD_VERSION, plugins_url( 'after-the-deadline/tinymce/' . $plugin . '.js', __FILE__ ) );
return $plugin_array;
}
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.js b/plugins/jetpack/modules/carousel/jetpack-carousel.js
index 4601a1b5..b4841cd9 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.js
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.js
@@ -692,6 +692,14 @@ jQuery(document).ready(function($) {
caption.fadeOut( 'fast' ).empty();
}
+ // Record pageview in WP Stats, for each new image loaded full-screen.
+ if ( jetpackCarouselStrings.stats ) {
+ new Image().src = document.location.protocol +
+ '//pixel.wp.com/g.gif?' +
+ jetpackCarouselStrings.stats +
+ '&post=' + encodeURIComponent( attachmentId ) +
+ '&rand=' + Math.random();
+ }
// Load the images for the next and previous slides.
$( next ).add( previous ).each( function() {
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.php b/plugins/jetpack/modules/carousel/jetpack-carousel.php
index b3d5302d..3c128c26 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.php
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.php
@@ -82,7 +82,7 @@ class Jetpack_Carousel {
*
* @since 1.6.0
*
- * @param bool false Should Carousel be disabled? Default to fase.
+ * @param bool false Should Carousel be disabled? Default to false.
*/
return apply_filters( 'jp_carousel_maybe_disable', false );
}
@@ -166,9 +166,9 @@ class Jetpack_Carousel {
'lang' => strtolower( substr( get_locale(), 0, 2 ) ),
'ajaxurl' => set_url_scheme( admin_url( 'admin-ajax.php' ) ),
'nonce' => wp_create_nonce( 'carousel_nonce' ),
- 'display_exif' => $this->test_1or0_option( get_option( 'carousel_display_exif' ), true ),
- 'display_geo' => $this->test_1or0_option( get_option( 'carousel_display_geo' ), true ),
- 'background_color' => $this->carousel_background_color_sanitize( get_option( 'carousel_background_color' ) ),
+ 'display_exif' => $this->test_1or0_option( Jetpack_Options::get_option_and_ensure_autoload( 'carousel_display_exif', true ) ),
+ 'display_geo' => $this->test_1or0_option( Jetpack_Options::get_option_and_ensure_autoload( 'carousel_display_geo', true ) ),
+ 'background_color' => $this->carousel_background_color_sanitize( Jetpack_Options::get_option_and_ensure_autoload( 'carousel_background_color', '' ) ),
'comment' => __( 'Comment', 'jetpack' ),
'post_comment' => __( 'Post Comment', 'jetpack' ),
'write_comment' => __( 'Write a Comment...', 'jetpack' ),
@@ -212,6 +212,24 @@ class Jetpack_Carousel {
}
/**
+ * Handle WP stats for images in full-screen.
+ * Build string with tracking info.
+ */
+ if ( 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;
+
+ // 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' ) ) {
+ $stats_options = stats_get_options();
+ $track_loggedin_users = isset( $stats_options['reg_users'] ) ? (bool) $stats_options['reg_users'] : false;
+
+ if ( ! $track_loggedin_users ) {
+ $localize_strings['stats'] = '';
+ }
+ }
+ }
+
+ /**
* Filter the strings passed to the Carousel's js file.
*
* @module carousel
diff --git a/plugins/jetpack/modules/comments.php b/plugins/jetpack/modules/comments.php
index c8456770..a5acfb6f 100644
--- a/plugins/jetpack/modules/comments.php
+++ b/plugins/jetpack/modules/comments.php
@@ -17,15 +17,6 @@ if ( is_admin() ) {
require dirname( __FILE__ ) . '/comments/admin.php';
}
-Jetpack_Sync::sync_options( __FILE__,
- 'comment_registration',
- 'require_name_email',
- 'show_avatars',
- 'avatar_default',
- 'highlander_comment_form_prompt',
- 'jetpack_comment_form_color_scheme'
-);
-
function jetpack_comments_load() {
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, 'jetpack_comments_configuration_load' );
diff --git a/plugins/jetpack/modules/contact-form/grunion-contact-form.php b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
index cda94ccb..6eba2e73 100644
--- a/plugins/jetpack/modules/contact-form/grunion-contact-form.php
+++ b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
@@ -195,20 +195,24 @@ class Grunion_Contact_Form_Plugin {
* Display the count of new feedback entries received. It's reset when user visits the Feedback screen.
*
* @since 4.1.0
+ *
+ * @param object $screen Information about the current screen.
*/
function unread_count( $screen ) {
if ( isset( $screen->post_type ) && 'feedback' == $screen->post_type ) {
update_option( 'feedback_unread_count', 0 );
} else {
global $menu;
- foreach ( $menu as $index => $menu_item ) {
- if ( 'edit.php?post_type=feedback' == $menu_item[2] ) {
- $unread = get_option( 'feedback_unread_count', 0 );
- if ( $unread > 0 ) {
- $unread_count = current_user_can( 'publish_pages' ) ? " <span class='feedback-unread count-{$unread} awaiting-mod'><span class='feedback-unread-count'>" . number_format_i18n( $unread ) . "</span></span>" : '';
- $menu[ $index ][0] .= $unread_count;
+ if ( isset( $menu ) && is_array( $menu ) && ! empty( $menu ) ) {
+ foreach ( $menu as $index => $menu_item ) {
+ if ( 'edit.php?post_type=feedback' == $menu_item[2] ) {
+ $unread = get_option( 'feedback_unread_count', 0 );
+ if ( $unread > 0 ) {
+ $unread_count = current_user_can( 'publish_pages' ) ? " <span class='feedback-unread count-{$unread} awaiting-mod'><span class='feedback-unread-count'>" . number_format_i18n( $unread ) . "</span></span>" : '';
+ $menu[ $index ][0] .= $unread_count;
+ }
+ break;
}
- break;
}
}
}
@@ -863,7 +867,7 @@ class Grunion_Contact_Form_Plugin {
* Put all the fields in `$current_row` array.
*/
foreach ( $fields as $single_field_name ) {
- $current_row[] = $data[ $single_field_name ][ $i ];
+ $current_row[] = $this->esc_csv( $data[ $single_field_name ][ $i ] );
}
/**
@@ -876,6 +880,30 @@ class Grunion_Contact_Form_Plugin {
}
/**
+ * Escape a string to be used in a CSV context
+ *
+ * Malicious input can inject formulas into CSV files, opening up the possibility for phishing attacks and
+ * disclosure of sensitive information.
+ *
+ * Additionally, Excel exposes the ability to launch arbitrary commands through the DDE protocol.
+ *
+ * @see http://www.contextis.com/resources/blog/comma-separated-vulnerabilities/
+ *
+ * @param string $field
+ *
+ * @return string
+ */
+ function esc_csv( $field ) {
+ $active_content_triggers = array( '=', '+', '-', '@' );
+
+ if ( in_array( mb_substr( $field, 0, 1 ), $active_content_triggers, true ) ) {
+ $field = "'" . $field;
+ }
+
+ return $field;
+ }
+
+ /**
* Returns a string of HTML <option> items from an array of posts
*
* @return string a string of HTML <option> items
diff --git a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
index 59e33551..b9e933aa 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy.php
@@ -246,7 +246,7 @@ class csstidy {
* @access private
* @version 1.3
*/
- function csstidy() {
+ function __construct() {
$this->settings['remove_bslash'] = true;
$this->settings['compress_colors'] = true;
$this->settings['compress_font-weight'] = true;
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 2ed9f803..b2e8eb96 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_optimise.php
@@ -47,7 +47,7 @@ class csstidy_optimise {
* @access private
* @version 1.0
*/
- function csstidy_optimise(&$css) {
+ function __construct(&$css) {
$this->parser = & $css;
$this->css = & $css->css;
$this->sub_value = & $css->sub_value;
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 080a368f..21f438cb 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/class.csstidy_print.php
@@ -66,7 +66,7 @@ class csstidy_print {
* @access private
* @version 1.0
*/
- function csstidy_print(&$css) {
+ function __construct(&$css) {
$this->parser = & $css;
$this->css = & $css->css;
$this->template = & $css->template;
diff --git a/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php b/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php
index c6427bbd..b10d461a 100644
--- a/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php
+++ b/plugins/jetpack/modules/custom-css/csstidy/data-wp.inc.php
@@ -87,4 +87,5 @@ $GLOBALS['csstidy']['all_properties']['object-position'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['text-overflow'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['zoom'] = 'CSS3.0';
$GLOBALS['csstidy']['all_properties']['pointer-events'] = 'CSS3.0';
+$GLOBALS['csstidy']['all_properties']['font-feature-settings'] = 'CSS3.0';
diff --git a/plugins/jetpack/modules/custom-css/custom-css.php b/plugins/jetpack/modules/custom-css/custom-css.php
index 88aea4fc..e3fe5987 100644
--- a/plugins/jetpack/modules/custom-css/custom-css.php
+++ b/plugins/jetpack/modules/custom-css/custom-css.php
@@ -522,7 +522,7 @@ class Jetpack_Custom_CSS {
return (bool) ( $custom_css_add === 'no' );
}
- return (bool) ( get_option( 'safecss_add' ) == 'no' );
+ return (bool) ( Jetpack_Options::get_option_and_ensure_autoload( 'safecss_add', '' ) == 'no' );
}
}
}
@@ -721,7 +721,7 @@ class Jetpack_Custom_CSS {
$option = Jetpack_Custom_CSS::is_preview() ? 'safecss_preview' : 'safecss';
if ( 'safecss' == $option ) {
- if ( get_option( 'safecss_revision_migrated' ) ) {
+ if ( Jetpack_Options::get_option_and_ensure_autoload( 'safecss_revision_migrated', '0' ) ) {
$safecss_post = Jetpack_Custom_CSS::get_post();
if ( ! empty( $safecss_post['post_content'] ) ) {
@@ -737,7 +737,7 @@ class Jetpack_Custom_CSS {
// Fix for un-migrated Custom CSS
if ( empty( $safecss_post ) ) {
- $_css = get_option( 'safecss' );
+ $_css = Jetpack_Options::get_option_and_ensure_autoload( 'safecss', '' );
if ( !empty( $_css ) ) {
$css = $_css;
}
@@ -997,7 +997,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/" target="_blank">beginner tutorial</a>. Questions?
- Ask in the <a href="http://wordpress.org/support/forum/themes-and-templates" target="_blank">Themes and Templates forum</a>.', 'jetpack' ) );
+ Ask in the <a href="https://wordpress.org/support/forum/themes-and-templates" 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>
@@ -1812,9 +1812,6 @@ function safecss_class() {
require_once( dirname( __FILE__ ) . '/csstidy/class.csstidy.php' );
class safecss extends csstidy_optimise {
- function __construct( &$css ) {
- return $this->csstidy_optimise( $css );
- }
function postparse() {
diff --git a/plugins/jetpack/modules/custom-post-types/portfolios.php b/plugins/jetpack/modules/custom-post-types/portfolios.php
index 920fcbd2..8e0078bd 100644
--- a/plugins/jetpack/modules/custom-post-types/portfolios.php
+++ b/plugins/jetpack/modules/custom-post-types/portfolios.php
@@ -35,7 +35,10 @@ class Jetpack_Portfolio {
// Make sure the post types are loaded for imports
add_action( 'import_start', array( $this, 'register_post_types' ) );
- $setting = get_option( self::OPTION_NAME, '0' );
+ // Add to REST API post type whitelist
+ add_filter( 'rest_api_allowed_post_types', array( $this, 'allow_portfolio_rest_api_type' ) );
+
+ $setting = Jetpack_Options::get_option_and_ensure_autoload( self::OPTION_NAME, '0' );
// Bail early if Portfolio option is not set and the theme doesn't declare support
if ( empty( $setting ) && ! $this->site_supports_custom_post_type() ) {
@@ -471,6 +474,15 @@ class Jetpack_Portfolio {
}
/**
+ * Add to REST API post type whitelist
+ */
+ function allow_portfolio_rest_api_type( $post_types ) {
+ $post_types[] = self::CUSTOM_POST_TYPE;
+
+ return $post_types;
+ }
+
+ /**
* Our [portfolio] shortcode.
* Prints Portfolio data styled to look good on *any* theme.
*
diff --git a/plugins/jetpack/modules/custom-post-types/testimonial.php b/plugins/jetpack/modules/custom-post-types/testimonial.php
index 9b0e0c3a..b6b1af1c 100644
--- a/plugins/jetpack/modules/custom-post-types/testimonial.php
+++ b/plugins/jetpack/modules/custom-post-types/testimonial.php
@@ -47,7 +47,7 @@ class Jetpack_Testimonial {
// Check on theme switch if theme supports CPT and setting is disabled
add_action( 'after_switch_theme', array( $this, 'activation_post_type_support' ) );
- $setting = get_option( self::OPTION_NAME, '0' );
+ $setting = Jetpack_Options::get_option_and_ensure_autoload( self::OPTION_NAME, '0' );
// Bail early if Testimonial option is not set and the theme doesn't declare support
if ( empty( $setting ) && ! $this->site_supports_custom_post_type() ) {
diff --git a/plugins/jetpack/modules/enhanced-distribution.php b/plugins/jetpack/modules/enhanced-distribution.php
index dd2fdab0..754b90e7 100644
--- a/plugins/jetpack/modules/enhanced-distribution.php
+++ b/plugins/jetpack/modules/enhanced-distribution.php
@@ -11,9 +11,6 @@
* Additional Search Queries: google, seo, firehose, search, broadcast, broadcasting
*/
-Jetpack_Sync::sync_posts( __FILE__ );
-Jetpack_Sync::sync_comments( __FILE__ );
-
function jetpack_enhanced_distribution_activate() {
Jetpack::check_privacy( __FILE__ );
}
@@ -53,3 +50,24 @@ if ( isset( $_GET['get_freshly_pressed_data'] ) ) {
}
}
}
+
+add_action( 'rss_head', 'jetpack_enhanced_distribution_feed_id' );
+add_action( 'rss_item', 'jetpack_enhanced_distribution_post_id' );
+add_action( 'rss2_head', 'jetpack_enhanced_distribution_feed_id' );
+add_action( 'rss2_item', 'jetpack_enhanced_distribution_post_id' );
+
+function jetpack_enhanced_distribution_feed_id(){
+ (int) $id = Jetpack_Options::get_option( 'id' );
+ if ( $id > 0 ) {
+ $output = sprintf( '<site xmlns="com-wordpress:feed-additions:1">%d</site>', $id );
+ echo $output;
+ }
+}
+
+function jetpack_enhanced_distribution_post_id(){
+ $id = get_the_ID();
+ if ( $id ) {
+ $output = sprintf( '<post-id xmlns="com-wordpress:feed-additions:1">%d</post-id>', $id );
+ echo $output;
+ }
+}
diff --git a/plugins/jetpack/modules/gravatar-hovercards.php b/plugins/jetpack/modules/gravatar-hovercards.php
index d96fcba0..77d46881 100644
--- a/plugins/jetpack/modules/gravatar-hovercards.php
+++ b/plugins/jetpack/modules/gravatar-hovercards.php
@@ -181,7 +181,7 @@ function grofiles_attach_cards() {
}
// Is the display of Gravatar Hovercards disabled?
- if ( 'disabled' == get_option( 'gravatar_disable_hovercards' ) ) {
+ if ( 'disabled' == Jetpack_Options::get_option_and_ensure_autoload( 'gravatar_disable_hovercards', '0' ) ) {
return;
}
diff --git a/plugins/jetpack/modules/infinite-scroll.php b/plugins/jetpack/modules/infinite-scroll.php
index 20d326e4..8aacd4ce 100644
--- a/plugins/jetpack/modules/infinite-scroll.php
+++ b/plugins/jetpack/modules/infinite-scroll.php
@@ -171,7 +171,7 @@ class Jetpack_Infinite_Scroll_Extras {
}
// Check if Google Analytics tracking is requested
- $settings['google_analytics'] = (bool) get_option( $this->option_name_google_analytics );
+ $settings['google_analytics'] = (bool) Jetpack_Options::get_option_and_ensure_autoload( $this->option_name_google_analytics, 0 );
return $settings;
}
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.js b/plugins/jetpack/modules/infinite-scroll/infinity.js
index d2827a30..11001246 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.js
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.js
@@ -252,15 +252,8 @@ Scroller.prototype.refresh = function() {
return;
}
- // If there are no remaining posts...
- if ( response.type == 'empty' ) {
- // Disable the scroller.
- self.disabled = true;
- // Update body classes, allowing the footer to return to static positioning
- self.body.addClass( 'infinity-end' ).removeClass( 'infinity-success' );
-
// If we've succeeded...
- } else if ( response.type == 'success' ) {
+ if ( response.type == 'success' ) {
// If additional scripts are required by the incoming set of posts, parse them
if ( response.scripts ) {
$( response.scripts ).each( function() {
@@ -356,6 +349,9 @@ Scroller.prototype.refresh = function() {
self.body.trigger( 'infinite-scroll-posts-more' );
}
}
+ } else if ( response.lastbatch ) {
+ self.disabled = true;
+ self.body.addClass( 'infinity-end' ).removeClass( 'infinity-success' );
}
// Update currentday to the latest value returned from the server
diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.php b/plugins/jetpack/modules/infinite-scroll/infinity.php
index 0aba8d22..c4810fbe 100644
--- a/plugins/jetpack/modules/infinite-scroll/infinity.php
+++ b/plugins/jetpack/modules/infinite-scroll/infinity.php
@@ -255,7 +255,7 @@ class The_Neverending_Home_Page {
self::$settings = apply_filters( 'infinite_scroll_settings', $settings );
}
- /** This filter is documented in modules/infinite-scroll/infinity.php */
+ /** This filter is already documented in modules/infinite-scroll/infinity.php */
return (object) apply_filters( 'infinite_scroll_settings', self::$settings );
}
@@ -300,7 +300,12 @@ class The_Neverending_Home_Page {
* Is this guaranteed to be the last batch of posts?
*/
static function is_last_batch() {
- return (bool) ( count( self::wp_query()->posts ) < self::get_settings()->posts_per_page );
+ $post_type = get_post_type();
+ $entries = wp_count_posts( empty( $post_type ) ? 'post' : $post_type )->publish;
+ if ( self::wp_query()->get( 'paged' ) && self::wp_query()->get( 'paged' ) > 1 ) {
+ $entries -= self::get_settings()->posts_per_page * self::wp_query()->get( 'paged' );
+ }
+ return $entries <= self::get_settings()->posts_per_page;
}
/**
@@ -369,18 +374,25 @@ class The_Neverending_Home_Page {
if ( empty( $id ) )
return;
+ // Add our scripts.
+ wp_register_script( 'the-neverending-homepage', plugins_url( 'infinity.js', __FILE__ ), array( 'jquery' ), '4.0.0', true );
+
+ // Add our default styles.
+ wp_register_style( 'the-neverending-homepage', plugins_url( 'infinity.css', __FILE__ ), array(), '20140422' );
+
// Make sure there are enough posts for IS
- if ( 'click' == self::get_settings()->type && self::is_last_batch() )
+ if ( self::is_last_batch() ) {
return;
+ }
// Add a class to the body.
add_filter( 'body_class', array( $this, 'body_class' ) );
// Add our scripts.
- wp_enqueue_script( 'the-neverending-homepage', plugins_url( 'infinity.js', __FILE__ ), array( 'jquery' ), '4.0.0', true );
+ wp_enqueue_script( 'the-neverending-homepage' );
// Add our default styles.
- wp_enqueue_style( 'the-neverending-homepage', plugins_url( 'infinity.css', __FILE__ ), array(), '20140422' );
+ wp_enqueue_style( 'the-neverending-homepage' );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_spinner_scripts' ) );
@@ -735,6 +747,7 @@ class The_Neverending_Home_Page {
}
}
}
+
unset( $post_type );
// Base JS settings
@@ -1429,7 +1442,7 @@ class The_Neverending_Home_Page {
*/
private function default_footer() {
$credits = sprintf(
- '<a href="http://wordpress.org/" target="_blank" rel="generator">%1$s</a> ',
+ '<a href="https://wordpress.org/" target="_blank" rel="generator">%1$s</a> ',
__( 'Proudly powered by WordPress', 'jetpack' )
);
$credits .= sprintf(
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
index ff6f7878..d7f21e38 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
@@ -20,8 +20,10 @@ add_action( 'init', 'twenty_eleven_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for infinity.
*/
function twenty_eleven_infinite_scroll_enqueue_styles() {
- // Add theme specific styles.
- wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ // Add theme specific styles.
+ wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twenty_eleven_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
index e47a7c2c..a94108f0 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
@@ -20,7 +20,9 @@ add_action( 'after_setup_theme', 'twentyfifteen_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentyfifteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' );
- wp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' );
+ wp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentyfifteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
index f6ddc700..22ae3844 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
@@ -42,6 +42,8 @@ if ( function_exists( 'jetpack_is_mobile' ) ) {
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentyfourteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentyfourteen_infinite_scroll_enqueue_styles', 25 ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
index 99af00ef..723d3cee 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
@@ -35,7 +35,9 @@ function twentysixteen_infinite_scroll_render() {
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentysixteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' );
- wp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' );
+ wp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentysixteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
index 094cef9c..a087238d 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
@@ -31,8 +31,10 @@ function twenty_ten_infinite_scroll_render() {
* Enqueue CSS stylesheet with theme styles for infinity.
*/
function twenty_ten_infinite_scroll_enqueue_styles() {
- // Add theme specific styles.
- wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ // Add theme specific styles.
+ wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twenty_ten_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
index dbc18c70..85490b45 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
@@ -21,6 +21,8 @@ add_action( 'after_setup_theme', 'twentythirteen_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
function twentythirteen_infinite_scroll_enqueue_styles() {
- wp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ wp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twentythirteen_infinite_scroll_enqueue_styles', 25 ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
index f8b77011..02e802e4 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
@@ -20,8 +20,10 @@ add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' );
* Enqueue CSS stylesheet with theme styles for infinity.
*/
function twenty_twelve_infinite_scroll_enqueue_styles() {
- // Add theme specific styles.
- wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
+ if ( wp_script_is( 'the-neverending-homepage' ) ) {
+ // Add theme specific styles.
+ wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
+ }
}
add_action( 'wp_enqueue_scripts', 'twenty_twelve_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/json-api.php b/plugins/jetpack/modules/json-api.php
index aff55d00..069c97c1 100644
--- a/plugins/jetpack/modules/json-api.php
+++ b/plugins/jetpack/modules/json-api.php
@@ -8,7 +8,4 @@
* Auto Activate: Public
* Module Tags: Writing, Developers
* Additional Search Queries: api, rest, develop, developers, json, klout, oauth
- */
-
-add_action( 'jetpack_activate_module_json-api', array( Jetpack::init(), 'toggle_module_on_wpcom' ) );
-add_action( 'jetpack_deactivate_module_json-api', array( Jetpack::init(), 'toggle_module_on_wpcom' ) );
+ */ \ No newline at end of file
diff --git a/plugins/jetpack/modules/likes.php b/plugins/jetpack/modules/likes.php
index 33daccec..1d1ad820 100644
--- a/plugins/jetpack/modules/likes.php
+++ b/plugins/jetpack/modules/likes.php
@@ -38,9 +38,6 @@ class Jetpack_Likes {
add_action( 'admin_init', array( $this, 'admin_init' ) );
if ( $this->in_jetpack ) {
- add_action( 'jetpack_activate_module_likes', array( $this, 'maybe_sync_content' ) );
- add_action( 'jetpack_activate_module_likes', array( $this, 'module_toggle' ) );
- add_action( 'jetpack_deactivate_module_likes', array( $this, 'module_toggle' ) );
add_action( 'jetpack_activate_module_likes', array( $this, 'set_social_notifications_like' ) );
add_action( 'jetpack_deactivate_module_likes', array( $this, 'delete_social_notifications_like' ) );
@@ -70,9 +67,6 @@ class Jetpack_Likes {
add_filter( 'sharing_meta_box_title', array( $this, 'add_likes_to_sharing_meta_box_title' ) );
add_action( 'start_sharing_meta_box_content', array( $this, 'meta_box_content' ) );
}
-
- Jetpack_Sync::sync_options( __FILE__, 'social_notifications_like' );
-
} else { // wpcom
add_action( 'wpmu_new_blog', array( $this, 'enable_comment_likes' ), 10, 1 );
add_action( 'admin_init', array( $this, 'add_meta_box' ) );
@@ -92,17 +86,6 @@ class Jetpack_Likes {
add_action( 'sharing_admin_update', array( $this, 'admin_settings_callback' ), 20 );
}
- function maybe_sync_content() {
- if ( Jetpack::init()->sync->reindex_needed() ) {
- Jetpack::init()->sync->reindex_trigger();
- }
- }
-
- function module_toggle() {
- $jetpack = Jetpack::init();
- $jetpack->sync->register( 'noop' );
- }
-
/**
* Set the social_notifications_like option to `on` when the Likes module is activated.
*
@@ -140,14 +123,14 @@ class Jetpack_Likes {
// Do we really need `admin_styles`? With the new admin UI, it's breaking some bits.
// Jetpack::init()->admin_styles();
}
+
/**
- * Load style on the front end.
+ * Load scripts and styles for front end.
* @return null
*/
function load_styles_register_scripts() {
-
- wp_enqueue_style( 'jetpack_likes', plugins_url( 'likes/style.css', __FILE__ ), array(), JETPACK__VERSION );
- if( $this->in_jetpack ) {
+ if ( $this->in_jetpack ) {
+ wp_enqueue_style( 'jetpack_likes', plugins_url( 'likes/style.css', __FILE__ ), array(), JETPACK__VERSION );
$this->register_scripts();
}
}
@@ -164,9 +147,8 @@ class Jetpack_Likes {
/**
* Replaces the "Sharing" title for the post screen metabox with "Likes and Shares"
- * @param string $title The current title of the metabox, not needed/used.
*/
- function add_likes_to_sharing_meta_box_title( $title ) {
+ function add_likes_to_sharing_meta_box_title() {
return __( 'Likes and Shares', 'jetpack' );
}
@@ -233,7 +215,6 @@ class Jetpack_Likes {
// site like setting.
if ( ( $this->is_enabled_sitewide() && empty( $_POST['wpl_enable_post_likes'] ) ) || ( ! $this->is_enabled_sitewide() && !empty( $_POST['wpl_enable_post_likes'] ) ) ) {
update_post_meta( $post_id, 'switch_like_status', 1 );
- //$g_gif = file_get_contents( 'http://pixel.wp.com/g.gif?v=wpcom-no-pv&x_likes=switched_post_like_status' ); @todo stat
} else {
delete_post_meta( $post_id, 'switch_like_status' );
}
@@ -635,16 +616,6 @@ class Jetpack_Likes {
add_action( 'manage_pages_custom_column', array( $this, 'likes_edit_column' ), 10, 2 );
add_action( 'admin_print_styles-edit.php', array( $this, 'load_admin_css' ) );
add_action( "admin_print_scripts-edit.php", array( $this, 'enqueue_admin_scripts' ) );
-
-
- if ( $this->in_jetpack ) {
- $post_stati = get_post_stati( array( 'public' => true ) ); // All public post stati
- $post_stati[] = 'private'; // Content from private stati will be redacted
- Jetpack_Sync::sync_posts( __FILE__, array(
- 'post_types' => get_post_types( array( 'public' => true ) ),
- 'post_stati' => $post_stati,
- ) );
- }
}
function action_init() {
@@ -674,6 +645,7 @@ class Jetpack_Likes {
wp_enqueue_script( 'postmessage', '/wp-content/js/postmessage.js', array( 'jquery' ), JETPACK__VERSION, false );
wp_enqueue_script( 'jquery_inview', '/wp-content/js/jquery/jquery.inview.js', array( 'jquery' ), JETPACK__VERSION, false );
wp_enqueue_script( 'jetpack_resize', '/wp-content/js/jquery/jquery.jetpack-resize.js', array( 'jquery' ), JETPACK__VERSION, false );
+ wp_enqueue_script( 'jetpack_likes_queuehandler', plugins_url( 'queuehandler.js' , __FILE__ ), array( 'jquery', 'postmessage', 'jetpack_resize', 'jquery_inview' ), JETPACK__VERSION, true );
wp_enqueue_style( 'jetpack_likes', plugins_url( 'jetpack-likes.css', __FILE__ ), array(), JETPACK__VERSION );
}
}
@@ -682,7 +654,6 @@ class Jetpack_Likes {
* Register scripts
*/
function register_scripts() {
- // Lets register all the sciprts
wp_register_script( 'postmessage', plugins_url( '_inc/postmessage.js', dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false );
wp_register_script( 'jquery_inview', plugins_url( '_inc/jquery.inview.js', dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false );
wp_register_script( 'jetpack_resize', plugins_url( '_inc/jquery.jetpack-resize.js' , dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false );
@@ -693,66 +664,42 @@ class Jetpack_Likes {
* Load the CSS needed for the wp-admin area.
*/
function load_admin_css() {
- ?>
- <?php if ( version_compare( $GLOBALS['wp_version'], '4.3-alpha', '>=' ) ) : ?>
- <style type="text/css">
- .vers img { display: none; }
- .metabox-prefs .vers img { display: inline; }
- .fixed .column-likes { width: 5.5em; padding: 8px 0; text-align: left; }
- .fixed .column-stats { width: 5em; }
- .fixed .column-likes .post-com-count {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- display: inline-block;
- padding: 0 8px;
- height: 2em;
- margin-top: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
- background-color: #72777C;
- color: #FFF;
- font-size: 11px;
- line-height: 21px;
- }
- .fixed .column-likes .post-com-count::after { border: none !important; }
- .fixed .column-likes .post-com-count:hover { background-color: #0073AA; }
- .fixed .column-likes .vers:before {
- font: normal 20px/1 dashicons;
- content: '\f155';
- speak: none;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- @media screen and (max-width: 782px) {
- .fixed .column-likes {
- display: none;
- }
- }
- </style>
- <?php else : // @todo Remove when 4.3 is minimum ?>
- <style type="text/css">
- .fixed .column-likes { width: 5em; padding-top: 8px; text-align: center !important; }
- .fixed .column-stats { width: 5em; }
- .fixed .column-likes .post-com-count { background-image: none; }
- .fixed .column-likes .post-com-count::after { border: none !important; }
- .fixed .column-likes .comment-count { background-color: #bbb; }
- .fixed .column-likes .comment-count:hover { background-color: #2ea2cc; }
- .fixed .column-likes .vers img { display: none; }
- .fixed .column-likes .vers:before {
- font: normal 20px/1 dashicons;
- content: '\f155';
- speak: none;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- }
- @media screen and (max-width: 782px) {
- .fixed .column-likes {
- display: none;
- }
+ ?>
+ <style type="text/css">
+ .vers img { display: none; }
+ .metabox-prefs .vers img { display: inline; }
+ .fixed .column-likes { width: 5.5em; padding: 8px 0; text-align: left; }
+ .fixed .column-stats { width: 5em; }
+ .fixed .column-likes .post-com-count {
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ display: inline-block;
+ padding: 0 8px;
+ height: 2em;
+ margin-top: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ background-color: #72777C;
+ color: #FFF;
+ font-size: 11px;
+ line-height: 21px;
+ }
+ .fixed .column-likes .post-com-count::after { border: none !important; }
+ .fixed .column-likes .post-com-count:hover { background-color: #0073AA; }
+ .fixed .column-likes .vers:before {
+ font: normal 20px/1 dashicons;
+ content: '\f155';
+ speak: none;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+ @media screen and (max-width: 782px) {
+ .fixed .column-likes {
+ display: none;
}
- </style>
- <?php endif; ?>
+ }
+ </style>
<?php
}
@@ -841,11 +788,11 @@ class Jetpack_Likes {
$wrapper = sprintf( 'like-post-wrapper-%1$d-%2$d-%3$s', $blog_id, $post->ID, $uniqid );
$html = "<div class='sharedaddy sd-block sd-like jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded' id='$wrapper' data-src='$src' data-name='$name'><h3 class='sd-title'>" . esc_html__( 'Like this:', 'jetpack' ) . '</h3>';
- $html .= "<div class='likes-widget-placeholder post-likes-widget-placeholder' style='height:55px'><span class='button'><span>" . esc_html__( 'Like', 'jetpack' ) . '</span></span> <span class="loading">' . esc_html__( 'Loading...', 'jetpack' ) . '</span></div>';
+ $html .= "<div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>" . esc_html__( 'Like', 'jetpack' ) . '</span></span> <span class="loading">' . esc_html__( 'Loading...', 'jetpack' ) . '</span></div>';
$html .= "<span class='sd-text-color'></span><a class='sd-link-color'></a>";
$html .= '</div>';
- // Lets make sure that the script is enqued
+ // Let's make sure that the script is enqueued
wp_enqueue_script( 'jetpack_likes_queuehandler' );
return $content . $html;
@@ -1020,8 +967,8 @@ class Jetpack_Likes {
* similar logic and filters apply here, too.
*/
function is_likes_visible() {
+ global $post, $wp_current_filter; // Used to apply 'sharing_show' filter
- global $post, $wp_current_filter; // Used to apply 'sharing_show' filter
// @todo: Remove this block when 4.5 is the minimum
global $wp_version;
$comment_popup = false;
@@ -1122,7 +1069,7 @@ class Jetpack_Likes {
*
* @param bool $option Are Likes enabled sitewide.
*/
- return (bool) apply_filters( 'wpl_is_enabled_sitewide', ! get_option( 'disabled_likes' ) );
+ return (bool) apply_filters( 'wpl_is_enabled_sitewide', ! Jetpack_Options::get_option_and_ensure_autoload( 'disabled_likes', 0 ) );
}
/**
@@ -1145,7 +1092,6 @@ class Jetpack_Likes {
/**
* Returns if comment likes are enabled. Defaults to 'off'
- * @todo decide what the default should be
* @return boolean true if we should show comment likes, false if not
*/
function is_comments_enabled() {
diff --git a/plugins/jetpack/modules/manage.php b/plugins/jetpack/modules/manage.php
index e084e9d4..efc81419 100644
--- a/plugins/jetpack/modules/manage.php
+++ b/plugins/jetpack/modules/manage.php
@@ -12,9 +12,6 @@
* Feature: Recommended
* Additional Search Queries: manage, management, remote
*/
-
-add_action( 'jetpack_activate_module_manage', array( Jetpack::init(), 'toggle_module_on_wpcom' ) );
-add_action( 'jetpack_deactivate_module_manage', array( Jetpack::init(), 'toggle_module_on_wpcom' ) );
add_action( 'customize_register', 'add_wpcom_to_allowed_redirect_hosts' );
// Add wordpress.com to the safe redirect whitelist if the Manage module is enabled
@@ -34,16 +31,6 @@ function allow_wpcom_domain( $domains ) {
return array_unique( $domains );
}
-// Re add sync for non public posts when the optin is selected in Calypso.
-// This will only work if you have manage enabled as well.
-if ( Jetpack_Options::get_option( 'sync_non_public_post_stati' ) ) {
- $sync_options = array(
- 'post_types' => get_post_types( array( 'public' => true ) ),
- 'post_stati' => get_post_stati(),
- );
- Jetpack_Sync::sync_posts( __FILE__, $sync_options );
-}
-
Jetpack::module_configuration_screen( 'manage', 'jetpack_manage_config_screen' );
function jetpack_manage_config_screen() {
include ( JETPACK__PLUGIN_DIR . 'modules/manage/confirm-admin.php' );
diff --git a/plugins/jetpack/modules/manage/confirm-admin.php b/plugins/jetpack/modules/manage/confirm-admin.php
index ed7e2e98..c8f105f9 100644
--- a/plugins/jetpack/modules/manage/confirm-admin.php
+++ b/plugins/jetpack/modules/manage/confirm-admin.php
@@ -22,6 +22,11 @@ switch( $section ) {
$link_title = __( 'Manage Your Plugins', 'jetpack' );
break;
+ case 'plugins-setup':
+ $link = 'https://wordpress.com/plugins/setup/' . $normalized_site_url;
+ $link_title = __( 'Back to Plan Setup', 'jetpack' );
+ break;
+
case 'themes':
$link = 'https://wordpress.com/design/' . $normalized_site_url;
$link_title = __( 'Manage Your Themes', 'jetpack' );
diff --git a/plugins/jetpack/modules/markdown/easy-markdown.php b/plugins/jetpack/modules/markdown/easy-markdown.php
index 43b41c20..f3870ce0 100644
--- a/plugins/jetpack/modules/markdown/easy-markdown.php
+++ b/plugins/jetpack/modules/markdown/easy-markdown.php
@@ -16,7 +16,7 @@ Author URI: http://automattic.com/
* http://www.opensource.org/licenses/gpl-license.php
*
* This is an add-on for WordPress
- * http://wordpress.org/
+ * https://wordpress.org/
*
* **********************************************************************
* This program is free software; you can redistribute it and/or modify
@@ -311,7 +311,7 @@ class WPCom_Markdown {
* @return boolean
*/
public function is_posting_enabled() {
- return (bool) get_option( self::POST_OPTION, '' );
+ return (bool) Jetpack_Options::get_option_and_ensure_autoload( self::POST_OPTION, '' );
}
/**
@@ -319,7 +319,7 @@ class WPCom_Markdown {
* @return boolean
*/
public function is_commenting_enabled() {
- return (bool) get_option( self::COMMENT_OPTION, '' );
+ return (bool) Jetpack_Options::get_option_and_ensure_autoload( self::COMMENT_OPTION, '' );
}
/**
diff --git a/plugins/jetpack/modules/minileven.php b/plugins/jetpack/modules/minileven.php
index 674e7cf7..9788fd5c 100644
--- a/plugins/jetpack/modules/minileven.php
+++ b/plugins/jetpack/modules/minileven.php
@@ -16,7 +16,7 @@
function jetpack_load_minileven() {
include dirname( __FILE__ ) . "/minileven/minileven.php";
- if ( get_option( 'wp_mobile_app_promos' ) != '1' )
+ if ( Jetpack_Options::get_option_and_ensure_autoload( 'wp_mobile_app_promos', '0' ) != '1' )
remove_action( 'wp_mobile_theme_footer', 'jetpack_mobile_app_promo' );
}
@@ -129,6 +129,8 @@ function minileven_enabled( $wp_mobile_disable_option ) {
return true;
}
-add_filter( 'option_wp_mobile_disable', 'minileven_enabled' );
+if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
+ add_filter( 'option_wp_mobile_disable', 'minileven_enabled' );
+}
jetpack_load_minileven();
diff --git a/plugins/jetpack/modules/minileven/minileven.php b/plugins/jetpack/modules/minileven/minileven.php
index 16559472..8b609d97 100644
--- a/plugins/jetpack/modules/minileven/minileven.php
+++ b/plugins/jetpack/modules/minileven/minileven.php
@@ -34,7 +34,7 @@ function jetpack_check_mobile() {
return false;
if ( jetpack_mobile_exclude() )
return false;
- if ( 1 == get_option('wp_mobile_disable') )
+ if ( 1 == Jetpack_Options::get_option_and_ensure_autoload( 'wp_mobile_disable', '0' ) )
return false;
if ( isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'true' )
return true;
diff --git a/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php b/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php
index 762fd733..c25fa83a 100644
--- a/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php
+++ b/plugins/jetpack/modules/minileven/theme/pub/minileven/footer.php
@@ -56,7 +56,7 @@
do_action( 'minileven_credits' );
?>
- <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'jetpack' ) ); ?>" target="_blank" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'jetpack' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'jetpack' ), 'WordPress' ); ?></a>
+ <a href="<?php echo esc_url( __( 'https://wordpress.org/', 'jetpack' ) ); ?>" target="_blank" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'jetpack' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s', 'jetpack' ), 'WordPress' ); ?></a>
</div>
</footer><!-- #colophon -->
diff --git a/plugins/jetpack/modules/monitor.php b/plugins/jetpack/modules/monitor.php
index 93a93f17..79a9d15e 100644
--- a/plugins/jetpack/modules/monitor.php
+++ b/plugins/jetpack/modules/monitor.php
@@ -12,9 +12,6 @@
* Additional Search Queries: monitor, uptime, downtime, monitoring
*/
-add_action( 'jetpack_activate_module_monitor', array( Jetpack::init(), 'toggle_module_on_wpcom' ) );
-add_action( 'jetpack_deactivate_module_monitor', array( Jetpack::init(), 'toggle_module_on_wpcom' ) );
-
class Jetpack_Monitor {
public $module = 'monitor';
diff --git a/plugins/jetpack/modules/notes.php b/plugins/jetpack/modules/notes.php
index d37e5de3..af403dea 100644
--- a/plugins/jetpack/modules/notes.php
+++ b/plugins/jetpack/modules/notes.php
@@ -12,19 +12,6 @@
if ( !defined( 'JETPACK_NOTES__CACHE_BUSTER' ) ) define( 'JETPACK_NOTES__CACHE_BUSTER', JETPACK__VERSION . '-' . gmdate( 'oW' ) );
-Jetpack_Sync::sync_options( __FILE__,
- 'home',
- 'blogname',
- 'siteurl',
- 'permalink_structure',
- 'category_base',
- 'tag_base',
- 'comment_moderation',
- 'default_comment_status',
- 'thread_comments',
- 'thread_comments_depth'
-);
-
class Jetpack_Notifications {
public $jetpack = false;
@@ -101,16 +88,6 @@ class Jetpack_Notifications {
}
}
- Jetpack_Sync::sync_posts( __FILE__, array(
- 'post_types' => $filt_post_types,
- 'post_stati' => array( 'publish' ),
- ) );
- Jetpack_Sync::sync_comments( __FILE__, array(
- 'post_types' => $filt_post_types,
- 'post_stati' => array( 'publish' ),
- 'comment_stati' => array( 'approve', 'approved', '1', 'hold', 'unapproved', 'unapprove', '0', 'spam', 'trash' ),
- ) );
-
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
return;
diff --git a/plugins/jetpack/modules/post-by-email.php b/plugins/jetpack/modules/post-by-email.php
index 6a7bae26..17aa532c 100644
--- a/plugins/jetpack/modules/post-by-email.php
+++ b/plugins/jetpack/modules/post-by-email.php
@@ -12,8 +12,6 @@
*/
add_action( 'jetpack_modules_loaded', array( 'Jetpack_Post_By_Email', 'init' ) );
-add_action( 'jetpack_activate_module_post-by-email', array( 'Jetpack_Post_By_Email', 'module_toggle' ) );
-add_action( 'jetpack_deactivate_module_post-by-email', array( 'Jetpack_Post_By_Email', 'module_toggle' ) );
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, array( 'Jetpack_Post_By_Email', 'configuration_redirect' ) );
@@ -33,11 +31,6 @@ class Jetpack_Post_By_Email {
add_action( 'init', array( &$this, 'action_init' ) );
}
- static function module_toggle() {
- $jetpack = Jetpack::init();
- $jetpack->sync->register( 'noop' );
- }
-
static function configuration_redirect() {
wp_safe_redirect( get_edit_profile_url( get_current_user_id() ) . '#post-by-email' );
exit;
diff --git a/plugins/jetpack/modules/protect.php b/plugins/jetpack/modules/protect.php
index 4829e016..0745d456 100644
--- a/plugins/jetpack/modules/protect.php
+++ b/plugins/jetpack/modules/protect.php
@@ -49,9 +49,8 @@ class Jetpack_Protect_Module {
private function __construct() {
add_action( 'jetpack_activate_module_protect', array ( $this, 'on_activation' ) );
add_action( 'jetpack_deactivate_module_protect', array ( $this, 'on_deactivation' ) );
- add_action( 'init', array ( $this, 'maybe_get_protect_key' ) );
add_action( 'jetpack_modules_loaded', array ( $this, 'modules_loaded' ) );
- add_action( 'init', array ( $this, 'check_use_math' ) );
+ add_action( 'login_init', array ( $this, 'check_use_math' ) );
add_filter( 'authenticate', array ( $this, 'check_preauth' ), 10, 3 );
add_action( 'wp_login', array ( $this, 'log_successful_login' ), 10, 2 );
add_action( 'wp_login_failed', array ( $this, 'log_failed_attempt' ) );
@@ -91,9 +90,12 @@ class Jetpack_Protect_Module {
public function maybe_get_protect_key() {
if ( get_site_option( 'jetpack_protect_activating', false ) && ! get_site_option( 'jetpack_protect_key', false ) ) {
- $this->get_protect_key();
+ $key = $this->get_protect_key();
delete_site_option( 'jetpack_protect_activating' );
+ return $key;
}
+
+ return get_site_option( 'jetpack_protect_key' );
}
/**
@@ -649,7 +651,7 @@ class Jetpack_Protect_Module {
function protect_call( $action = 'check_ip', $request = array () ) {
global $wp_version, $wpdb, $current_user;
- $api_key = get_site_option( 'jetpack_protect_key' );
+ $api_key = $this->maybe_get_protect_key();
$user_agent = "WordPress/{$wp_version} | Jetpack/" . constant( 'JETPACK__VERSION' );
diff --git a/plugins/jetpack/modules/publicize.php b/plugins/jetpack/modules/publicize.php
index 9709e300..674708da 100644
--- a/plugins/jetpack/modules/publicize.php
+++ b/plugins/jetpack/modules/publicize.php
@@ -24,7 +24,6 @@ class Jetpack_Publicize {
if ( $this->in_jetpack && method_exists( 'Jetpack', 'module_configuration_load' ) ) {
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, array( $this, 'jetpack_configuration_load' ) );
- add_action( 'init', array( $this, 'sync_posts_init' ), 999 );
}
require_once dirname( __FILE__ ) . '/publicize/publicize.php';
@@ -42,9 +41,6 @@ class Jetpack_Publicize {
// Jetpack specific checks / hooks
if ( $this->in_jetpack) {
- add_action( 'jetpack_activate_module_publicize', array( $this, 'module_state_toggle' ) );
- add_action( 'jetpack_deactivate_module_publicize', array( $this, 'module_state_toggle' ) );
- add_filter( 'jetpack_sync_post_module_custom_data', array( $this, 'sync_post_module_custom_data' ), 10, 2 );
// if sharedaddy isn't active, the sharing menu hasn't been added yet
$active = Jetpack::get_active_modules();
if ( in_array( 'publicize', $active ) && !in_array( 'sharedaddy', $active ) )
@@ -52,35 +48,6 @@ class Jetpack_Publicize {
}
}
- function sync_posts_init() {
- $post_types = array( 'post', 'page' );
- $all_post_types = get_post_types();
- foreach ( $all_post_types as $post_type ) {
- // sync Custom Post Types that support publicize
- if ( post_type_supports( $post_type, 'publicize' ) ) {
- $post_types[] = $post_type;
- }
- }
- Jetpack_Sync::sync_posts( __FILE__, array(
- 'post_types' => $post_types,
- ) );
- }
-
- function sync_post_module_custom_data( $custom_data, $post ) {
- if ( post_type_supports( get_post_type( $post ), 'publicize' ) ) {
- $custom_data['cpt_publicizeable'] = true;
- }
- return $custom_data;
- }
-
- function module_state_toggle() {
- // extra check that we are on the JP blog, just incase
- if ( class_exists( 'Jetpack' ) && $this->in_jetpack ) {
- $jetpack = Jetpack::init();
- $jetpack->sync->register( 'noop' );
- }
- }
-
function jetpack_configuration_load() {
wp_safe_redirect( menu_page_url( 'sharing', false ) );
exit;
diff --git a/plugins/jetpack/modules/publicize/publicize-jetpack.php b/plugins/jetpack/modules/publicize/publicize-jetpack.php
index f21ca16e..ab371433 100644
--- a/plugins/jetpack/modules/publicize/publicize-jetpack.php
+++ b/plugins/jetpack/modules/publicize/publicize-jetpack.php
@@ -27,7 +27,7 @@ class Publicize extends Publicize_Base {
add_filter( 'publicize_checkbox_default', array( $this, 'publicize_checkbox_default' ), 10, 4 );
- add_action( 'transition_post_status', array( $this, 'save_publicized' ), 10, 3 );
+ add_action( 'wp_insert_post', array( $this, 'save_publicized' ), 11, 3 );
add_filter( 'jetpack_twitter_cards_site_tag', array( $this, 'enhaced_twitter_cards_site_tag' ) );
@@ -359,7 +359,25 @@ class Publicize extends Publicize_Base {
}
function flag_post_for_publicize( $new_status, $old_status, $post ) {
- // Stub only. Doesn't need to do anything on Jetpack Client
+ if ( 'publish' == $new_status && 'publish' != $old_status ) {
+ /**
+ * Determines whether a post being published gets publicized.
+ *
+ * Side-note: Possibly our most alliterative filter name.
+ *
+ * @module publicize
+ *
+ * @since 4.1.0
+ *
+ * @param bool $should_publicize Should the post be publicized? Default to true.
+ * @param WP_POST $post Current Post object.
+ */
+ $should_publicize = apply_filters( 'publicize_should_publicize_published_post', true, $post );
+
+ if ( $should_publicize ) {
+ update_post_meta( $post->ID, $this->PENDING, true );
+ }
+ }
}
function test_connection( $service_name, $connection ) {
@@ -405,9 +423,21 @@ class Publicize extends Publicize_Base {
* Save a flag locally to indicate that this post has already been Publicized via the selected
* connections.
*/
- function save_publicized( $new_status, $old_status, $post ) {
+ function save_publicized( $post_ID, $post, $update ) {
// Only do this when a post transitions to being published
- if ( 'publish' == $new_status && 'publish' != $old_status ) {
+ if ( get_post_meta( $post->ID, $this->PENDING ) ) {
+ $connected_services = Jetpack_Options::get_option( 'publicize_connections' );
+ if ( ! empty( $connected_services ) ) {
+ /**
+ * Fires when a post is saved that has is marked as pending publicizing
+ *
+ * @since 4.1.0
+ *
+ * @param int The post ID
+ */
+ do_action( 'jetpack_publicize_post', $post->ID );
+ }
+ delete_post_meta( $post->ID, $this->PENDING );
update_post_meta( $post->ID, $this->POST_DONE . 'all', true );
}
}
diff --git a/plugins/jetpack/modules/publicize/publicize.php b/plugins/jetpack/modules/publicize/publicize.php
index f78bdd9f..6b558f25 100644
--- a/plugins/jetpack/modules/publicize/publicize.php
+++ b/plugins/jetpack/modules/publicize/publicize.php
@@ -326,7 +326,11 @@ abstract class Publicize_Base {
}
// Did this request happen via wp-admin?
- $from_web = 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST[$this->ADMIN_PAGE] );
+ $from_web = isset( $_SERVER['REQUEST_METHOD'] )
+ &&
+ 'post' == strtolower( $_SERVER['REQUEST_METHOD'] )
+ &&
+ isset( $_POST[$this->ADMIN_PAGE] );
if ( ( $from_web || defined( 'POST_BY_EMAIL' ) ) && isset( $_POST['wpas_title'] ) ) {
if ( empty( $_POST['wpas_title'] ) ) {
diff --git a/plugins/jetpack/modules/related-posts.php b/plugins/jetpack/modules/related-posts.php
index ac6ccbf7..8df4b32b 100644
--- a/plugins/jetpack/modules/related-posts.php
+++ b/plugins/jetpack/modules/related-posts.php
@@ -38,19 +38,6 @@ class Jetpack_RelatedPosts_Module {
*/
private function __construct() {
add_action( 'jetpack_module_loaded_related-posts', array( $this, 'action_on_load' ) );
- add_action( 'jetpack_activate_module_related-posts', array( $this, 'action_on_activate' ) );
- }
-
- /**
- * This action triggers when module is activated.
- *
- * @uses Jetpack::init, Jetpack_Sync::reindex_needed, Jetpack_Sync::reindex_trigger
- * @return null
- */
- public function action_on_activate() {
- if ( Jetpack::init()->sync->reindex_needed() ) {
- Jetpack::init()->sync->reindex_trigger();
- }
}
/**
@@ -67,9 +54,6 @@ class Jetpack_RelatedPosts_Module {
// Enable "Configure" button on module card
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, array( $this, 'module_configuration_load' ) );
-
- // Sync new posts
- Jetpack_Sync::sync_posts( __FILE__ );
}
}
diff --git a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
index 5a5d1ae5..f8eaff22 100644
--- a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
+++ b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
@@ -105,7 +105,7 @@ class Jetpack_RelatedPosts {
}
/**
- * Load related posts assets if it's a elegiable frontend page or execute search and return JSON if it's an endpoint request.
+ * Load related posts assets if it's a elegiable front end page or execute search and return JSON if it's an endpoint request.
*
* @global $_GET
* @action wp
@@ -231,7 +231,7 @@ EOT;
*/
public function get_options() {
if ( null === $this->_options ) {
- $this->_options = Jetpack_Options::get_option( 'relatedposts' );
+ $this->_options = Jetpack_Options::get_option( 'relatedposts', array() );
if ( ! is_array( $this->_options ) )
$this->_options = array();
if ( ! isset( $this->_options['enabled'] ) )
diff --git a/plugins/jetpack/modules/sharedaddy/sharedaddy.php b/plugins/jetpack/modules/sharedaddy/sharedaddy.php
index ffd7bbc4..18c04d38 100644
--- a/plugins/jetpack/modules/sharedaddy/sharedaddy.php
+++ b/plugins/jetpack/modules/sharedaddy/sharedaddy.php
@@ -200,7 +200,7 @@ function sharing_restrict_to_single( $services ) {
}
function sharing_init() {
- if ( get_option( 'sharedaddy_disable_resources' ) ) {
+ if ( Jetpack_Options::get_option_and_ensure_autoload( 'sharedaddy_disable_resources', '0' ) ) {
add_filter( 'sharing_js', 'sharing_disable_js' );
remove_action( 'wp_head', 'sharing_add_header', 1 );
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-sources.php b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
index 1fc6cef0..4e6f421b 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-sources.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
@@ -329,15 +329,13 @@ abstract class Sharing_Source {
$opts = implode( ',', $opts );
?>
<script type="text/javascript">
- var windowOpen;
- jQuery(document).on( 'ready post-load', function(){
- jQuery( 'a.share-<?php echo $name; ?>' ).on( 'click', function() {
- if ( 'undefined' !== typeof windowOpen ){ // If there's another sharing window open, close it.
- windowOpen.close();
- }
- windowOpen = window.open( jQuery(this).attr( 'href' ), 'wpcom<?php echo $name; ?>', '<?php echo $opts; ?>' );
- return false;
- });
+ var windowOpen;
+ jQuery(document.body).on('click', 'a.share-<?php echo $name; ?>', function() {
+ if ( 'undefined' !== typeof windowOpen ){ // If there's another sharing window open, close it.
+ windowOpen.close();
+ }
+ windowOpen = window.open( jQuery(this).attr( 'href' ), 'wpcom<?php echo $name; ?>', '<?php echo $opts; ?>' );
+ return false;
});
</script>
<?php
@@ -1518,7 +1516,7 @@ class Share_Pinterest extends Sharing_Source {
</script>
<?php elseif ( 'buttonPin' != $this->get_widget_type() ) : ?>
<script type="text/javascript">
- jQuery(document).on('ready', function(){
+ jQuery(document).ready( function(){
jQuery('body').on('click', 'a.share-pinterest', function(e){
e.preventDefault();
// Load Pinterest Bookmarklet code
@@ -1590,7 +1588,7 @@ class Share_Pocket extends Sharing_Source {
function jetpack_sharing_pocket_init() {
jQuery.getScript( 'https://widgets.getpocket.com/v1/j/btn.js?v=1' );
}
- jQuery( document ).on( 'ready', jetpack_sharing_pocket_init );
+ jQuery( document ).ready( jetpack_sharing_pocket_init );
jQuery( document.body ).on( 'post-load', jetpack_sharing_pocket_init );
</script>
<?php
@@ -1641,7 +1639,7 @@ class Jetpack_Share_WhatsApp extends Sharing_Source {
}
public function get_display( $post ) {
- return $this->get_link( 'whatsapp://send?text=' . rawurlencode( $this->get_share_title( $post->ID ) ) . ' ' . rawurlencode( get_permalink( $post->ID ) ), _x( 'WhatsApp', 'share to', 'jetpack' ), __( 'Click to share on WhatsApp', 'jetpack' ) );
+ return $this->get_link( 'whatsapp://send?text=' . rawurlencode( $this->get_share_title( $post->ID ) ) . ' ' . rawurlencode( $this->get_share_url( $post->ID ) ), _x( 'WhatsApp', 'share to', 'jetpack' ), __( 'Click to share on WhatsApp', 'jetpack' ) );
}
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing.css b/plugins/jetpack/modules/sharedaddy/sharing.css
index 06845483..ab8f6592 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing.css
+++ b/plugins/jetpack/modules/sharedaddy/sharing.css
@@ -77,7 +77,6 @@ body.highlander-dark h3.sd-title:before {
.sd-social-official .sd-content>ul>li .digg_button >a { /* official Digg button no longer works, needs cleaning */
text-decoration: none !important;
display: inline-block;
- margin: 0 5px 5px 0;
font-size: 12px;
font-family: "Open Sans", sans-serif;
font-weight: normal;
@@ -182,7 +181,7 @@ body.highlander-dark h3.sd-title:before {
}
.sd-content ul li {
- margin: 0 !important;
+ margin: 0 5px 5px 0;
padding: 0;
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing.js b/plugins/jetpack/modules/sharedaddy/sharing.js
index ac287a24..34913e81 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing.js
+++ b/plugins/jetpack/modules/sharedaddy/sharing.js
@@ -72,7 +72,7 @@ if ( sharing_js_options && sharing_js_options.counts ) {
}
for ( url in data ) {
- if ( ! data.hasOwnProperty( url ) || ! data[ url ].shares ) {
+ if ( ! data.hasOwnProperty( url ) || ! data[ url ].share.share_count ) {
continue;
}
@@ -82,7 +82,7 @@ if ( sharing_js_options && sharing_js_options.counts ) {
continue;
}
- WPCOMSharing.inject_share_count( 'sharing-facebook-' + WPCOM_sharing_counts[ permalink ], data[ url ].shares );
+ WPCOMSharing.inject_share_count( 'sharing-facebook-' + WPCOM_sharing_counts[ permalink ], data[ url ].share.share_count );
}
},
update_linkedin_count : function( data ) {
@@ -129,7 +129,7 @@ var updateLinkedInCount = function( data ) {
} );
$body = $( document.body ).on( 'post-load', WPCOMSharing_do );
- $( document ).on( 'ready', function() {
+ $( document ).ready( function() {
$sharing_email = $( '#sharing_email' );
$body.append( $sharing_email );
WPCOMSharing_do();
diff --git a/plugins/jetpack/modules/shortcodes.php b/plugins/jetpack/modules/shortcodes.php
index f2181997..1a12604e 100644
--- a/plugins/jetpack/modules/shortcodes.php
+++ b/plugins/jetpack/modules/shortcodes.php
@@ -39,12 +39,12 @@ function shortcode_new_to_old_params( $params, $old_format_support = false ) {
}
function jetpack_load_shortcodes() {
- global $wp_version;
-
$shortcode_includes = array();
foreach ( Jetpack::glob_php( dirname( __FILE__ ) . '/shortcodes' ) as $file ) {
- $shortcode_includes[] = $file;
+ $filename = substr( basename( $file ), 0, -4 );
+
+ $shortcode_includes[ $filename ] = $file;
}
/**
@@ -53,6 +53,7 @@ function jetpack_load_shortcodes() {
* @module shortcodes
*
* @since 2.2.1
+ * @since 4.2.0 Added filename without extension as array key.
*
* @param array $shortcode_includes An array of which shortcodes to include.
*/
diff --git a/plugins/jetpack/modules/shortcodes/cartodb.php b/plugins/jetpack/modules/shortcodes/cartodb.php
index 74292830..6f9e4f5e 100644
--- a/plugins/jetpack/modules/shortcodes/cartodb.php
+++ b/plugins/jetpack/modules/shortcodes/cartodb.php
@@ -2,17 +2,20 @@
/*
- * CartoDB
+ * Carto (formerly CartoDB)
*
- * example URL: http://osm2.cartodb.com/viz/08aef918-94da-11e4-ad83-0e0c41326911/public_map
+ * example URL: http://osm2.carto.com/viz/08aef918-94da-11e4-ad83-0e0c41326911/public_map
*
* possible patterns:
- * [username].cartodb.com/viz/[map-id]/public_map
- * [username].cartodb.com/viz/[map-id]/embed_map
- * [username].cartodb.com/viz/[map-id]/map
- * [organization].cartodb.com/u/[username]/viz/[map-id]/public_map
- * [organization].cartodb.com/u/[username]/viz/[map-id]/embed_map
- * [organization].cartodb.com/u/[username]/viz/[map-id]/map
+ * [username].carto.com/viz/[map-id]/public_map
+ * [username].carto.com/viz/[map-id]/embed_map
+ * [username].carto.com/viz/[map-id]/map
+ * [organization].carto.com/u/[username]/viz/[map-id]/public_map
+ * [organization].carto.com/u/[username]/viz/[map-id]/embed_map
+ * [organization].carto.com/u/[username]/viz/[map-id]/map
+ *
+ * On July 8th, 2016 CartoDB changed its primary domain from cartodb.com to carto.com
+ * So this shortcode still supports the cartodb.com domain for oembeds.
*/
-wp_oembed_add_provider( '#https?://(?:www\.)?[^/^\.]+\.cartodb\.com/\S+#i', 'https://services.cartodb.com/oembed', true ); \ No newline at end of file
+wp_oembed_add_provider( '#https?://(?:www\.)?[^/^\.]+\.carto(db)?\.com/\S+#i', 'https://services.carto.com/oembed', true ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/shortcodes/dailymotion.php b/plugins/jetpack/modules/shortcodes/dailymotion.php
index bd4612ec..9a904dc7 100644
--- a/plugins/jetpack/modules/shortcodes/dailymotion.php
+++ b/plugins/jetpack/modules/shortcodes/dailymotion.php
@@ -75,6 +75,11 @@ add_filter( 'pre_kses', 'dailymotion_embed_to_shortcode' );
*
* The new style is now:
* [dailymotion id=x8oma9 title=2 user=3 video=4]
+ *
+ * Supported parameters for player customization: width, height,
+ * autoplay, endscreen-enable, mute, sharing-enabled, start, subtitles-default,
+ * ui-highlight, ui-logo, ui-start-screen-info, ui-theme
+ * see https://developer.dailymotion.com/player#player-parameters
* @todo: Update code to sniff for iframe embeds and convert those to shortcodes.
*
* @param array $atts
@@ -93,40 +98,115 @@ function dailymotion_shortcode( $atts ) {
$params = shortcode_new_to_old_params( $atts );
parse_str( $params, $atts_new );
- foreach( $atts_new as $k => $v ) {
+ foreach ( $atts_new as $k => $v ) {
$atts[ $k ] = $v;
}
}
- if ( isset( $atts['id'] ) ) {
- $id = $atts['id'];
+ $atts = shortcode_atts(
+ array(
+ 'id' => '', // string
+ 'width' => '', // int
+ 'height' => '', // int
+ 'title' => '', // string
+ 'user' => '', // string
+ 'video' => '', // string
+ 'autoplay' => 0, // int
+ 'endscreen-enable' => 1, // int
+ 'mute' => 0, // int
+ 'sharing-enable' => 1, // int
+ 'start' => '', // int
+ 'subtitles-default' => '', // string
+ 'ui-highlight' => '', // string
+ 'ui-logo' => 1, // int
+ 'ui-start-screen-info' => 0, // int
+ 'ui-theme' => '', // string
+ ), $atts, 'dailymotion'
+ );
+
+ if ( isset( $atts['id'] ) && ! empty( $atts['id'] ) ) {
+ $id = urlencode( $atts['id'] );
} else {
return '<!--Dailymotion error: bad or missing ID-->';
}
- if ( ! empty( $content_width ) ) {
- $width = min( 425, intval( $content_width ) );
- } else {
- $width = 425;
+ /*set width and height using provided parameters if any */
+ $width = isset( $atts['width'] ) ? intval( $atts['width'] ) : 0 ;
+ $height = isset( $atts['height'] ) ? intval( $atts['height'] ) : 0 ;
+
+ if ( ! $width && ! $height ) {
+ if ( ! empty( $content_width ) ) {
+ $width = absint( $content_width );
+ } else {
+ $width = 425;
+ }
+ $height = $width / 425 * 334;
+ } elseif ( ! $height ) {
+ $height = $width / 425 * 334;
+ } elseif ( ! $width ) {
+ $width = $height / 334 * 425;
+ }
+
+ /**
+ * Let's add parameters if needed.
+ *
+ * @see https://developer.dailymotion.com/player
+ */
+ $player_params = array();
+
+ if ( isset( $atts['autoplay'] ) && '1' === $atts['autoplay'] ) {
+ $player_params['autoplay'] = '1';
+ }
+ if ( isset( $atts['endscreen-enable'] ) && '0' === $atts['endscreen-enable'] ) {
+ $player_params['endscreen-enable'] = '0';
+ }
+ if ( isset( $atts['mute'] ) && '1' === $atts['mute'] ) {
+ $player_params['mute'] = '1';
}
+ if ( isset( $atts['sharing-enable'] ) && '0' === $atts['sharing-enable'] ) {
+ $player_params['sharing-enable'] = '0';
+ }
+ if ( isset( $atts['start'] ) && ! empty( $atts['start'] ) ) {
+ $player_params['start'] = abs( intval( $atts['start'] ) );
+ }
+ if ( isset( $atts['subtitles-default'] ) && ! empty( $atts['subtitles-default'] ) ) {
+ $player_params['subtitles-default'] = esc_attr( $atts['subtitles-default'] );
+ }
+ if ( isset( $atts['ui-highlight'] ) && ! empty( $atts['ui-highlight'] ) ) {
+ $player_params['ui-highlight'] = esc_attr( $atts['ui-highlight'] );
+ }
+ if ( isset( $atts['ui-logo'] ) && '0' === $atts['ui-logo'] ) {
+ $player_params['ui-logo'] = '0';
+ }
+ if ( isset( $atts['ui-start-screen-info'] ) && '0' === $atts['ui-start-screen-info'] ) {
+ $player_params['ui-start-screen-info'] = '0';
+ }
+ if ( isset( $atts['ui-theme'] ) && in_array( strtolower( $atts['ui-theme'] ), array( 'dark', 'light' ) ) ) {
+ $player_params['ui-theme'] = esc_attr( $atts['ui-theme'] );
+ }
+
+ // Add those parameters to the Video URL.
+ $video_url = add_query_arg(
+ $player_params,
+ 'https://www.dailymotion.com/embed/video/' . $id
+ );
- $height = ( 425 == $width ) ? 334 : ( $width / 425 ) * 334;
- $id = urlencode( $id );
+ $output = '';
if ( preg_match( '/^[A-Za-z0-9]+$/', $id ) ) {
- $output = '<iframe width="' . $width . '" height="' . $height . '" src="' . esc_url( '//www.dailymotion.com/embed/video/' . $id ) . '" frameborder="0"></iframe>';
- $after = '';
+ $output .= '<iframe width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '" src="' . esc_url( $video_url ) . '" style="border:0;" allowfullscreen></iframe>';
if ( array_key_exists( 'video', $atts ) && $video = preg_replace( '/[^-a-z0-9_]/i', '', $atts['video'] ) && array_key_exists( 'title', $atts ) && $title = wp_kses( $atts['title'], array() ) ) {
- $after .= '<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( 'http://www.dailymotion.com/video/' . $video ) . '" target="_blank">' . esc_html( $title ) . '</a></strong>';
}
if ( array_key_exists( 'user', $atts ) && $user = preg_replace( '/[^-a-z0-9_]/i', '', $atts['user'] ) ) {
- $after .= '<br /><em>Uploaded by <a href="' . esc_url( 'http://www.dailymotion.com/' . $user ) . '" target="_blank">' . esc_html( $user ) . '</a></em>';
+ /* translators: %s is a Dailymotion user name */
+ $output .= '<br /><em>' . wp_kses( sprintf( __( 'Uploaded by %s', 'jetpack' ), '<a href="' . esc_url( 'http://www.dailymotion.com/' . $user ) . '" target="_blank">' . esc_html( $user ) . '</a>' ), array( 'a' => array( 'href' => true, 'target' => true ) ) ) . '</em>';
}
}
- return $output . $after;
+ return $output;
}
add_shortcode( 'dailymotion', 'dailymotion_shortcode' );
@@ -143,13 +223,13 @@ function dailymotion_channel_shortcode( $atts ) {
switch( $atts['type'] ) {
case 'grid':
- return '<iframe width="300px" height="264px" scrolling="no" frameborder="0" src="' . esc_url( '//www.dailymotion.com/badge/user/' . $username . '?type=grid' ) . '"></iframe>';
+ return '<iframe width="300px" height="264px" scrolling="no" style="border:0;" src="' . esc_url( '//www.dailymotion.com/badge/user/' . $username . '?type=grid' ) . '"></iframe>';
break;
case 'carousel':
- return '<iframe width="300px" height="360px" scrolling="no" frameborder="0" src="' . esc_url( '//www.dailymotion.com/badge/user/' . $username . '?type=carousel' ) . '"></iframe>';
+ return '<iframe width="300px" height="360px" scrolling="no" style="border:0;" src="' . esc_url( '//www.dailymotion.com/badge/user/' . $username . '?type=carousel' ) . '"></iframe>';
break;
default:
- return '<iframe width="300px" height="78px" scrolling="no" frameborder="0" src="' . esc_url( '//www.dailymotion.com/badge/user/' . $username ) . '"></iframe>';
+ return '<iframe width="300px" height="78px" scrolling="no" style="border:0;" src="' . esc_url( '//www.dailymotion.com/badge/user/' . $username ) . '"></iframe>';
}
}
diff --git a/plugins/jetpack/modules/shortcodes/slideshow.php b/plugins/jetpack/modules/shortcodes/slideshow.php
index 0ff568d3..949af189 100644
--- a/plugins/jetpack/modules/shortcodes/slideshow.php
+++ b/plugins/jetpack/modules/shortcodes/slideshow.php
@@ -122,7 +122,7 @@ class Jetpack_Slideshow_Shortcode {
'trans' => 'fade',
'order' => 'ASC',
'orderby' => 'menu_order ID',
- 'id' => $post->ID,
+ 'id' => isset( $post->ID ) ? $post->ID : null,
'include' => '',
'exclude' => '',
'autostart' => true,
diff --git a/plugins/jetpack/modules/shortcodes/soundcloud.php b/plugins/jetpack/modules/shortcodes/soundcloud.php
index 3295bf01..6e0b2cb1 100644
--- a/plugins/jetpack/modules/shortcodes/soundcloud.php
+++ b/plugins/jetpack/modules/shortcodes/soundcloud.php
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: SoundCloud Shortcode
-Plugin URI: http://wordpress.org/extend/plugins/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.
diff --git a/plugins/jetpack/modules/shortcodes/vimeo.php b/plugins/jetpack/modules/shortcodes/vimeo.php
index 3d585a0a..0a99d5fc 100644
--- a/plugins/jetpack/modules/shortcodes/vimeo.php
+++ b/plugins/jetpack/modules/shortcodes/vimeo.php
@@ -293,10 +293,8 @@ function vimeo_link_callback( $matches ) {
}
/** This filter is documented in modules/shortcodes/youtube.php */
-if ( apply_filters( 'jetpack_comments_allow_oembed', get_option('embed_autourls') ) ) {
+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.
- if ( ! is_admin() ) {
- // Higher priority because we need it before auto-link and autop get to it
- add_filter( 'comment_text', 'vimeo_link', 1 );
- }
+ // 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/wufoo.php b/plugins/jetpack/modules/shortcodes/wufoo.php
index 3dd88a0e..6638f70f 100644
--- a/plugins/jetpack/modules/shortcodes/wufoo.php
+++ b/plugins/jetpack/modules/shortcodes/wufoo.php
@@ -4,7 +4,7 @@ Plugin Name: Wufoo Shortcode Plugin
Description: Enables shortcode to embed Wufoo forms. Usage: [wufoo username="chriscoyier" formhash="x7w3w3" autoresize="true" height="458" header="show" ssl="true"]
Author: Chris Coyier / Wufoo, evansolomon
-Based on http://wordpress.org/extend/plugins/wufoo-shortcode/
+Based on https://wordpress.org/extend/plugins/wufoo-shortcode/
http://wufoo.com/docs/code-manager/wordpress-shortcode-plugin/
*/
diff --git a/plugins/jetpack/modules/shortcodes/youtube.php b/plugins/jetpack/modules/shortcodes/youtube.php
index d5db874d..d227fa14 100644
--- a/plugins/jetpack/modules/shortcodes/youtube.php
+++ b/plugins/jetpack/modules/shortcodes/youtube.php
@@ -177,14 +177,17 @@ function youtube_id( $url ) {
$input_w = ( isset( $qargs['w'] ) && intval( $qargs['w'] ) ) ? intval( $qargs['w'] ) : 0;
$input_h = ( isset( $qargs['h'] ) && intval( $qargs['h'] ) ) ? intval( $qargs['h'] ) : 0;
- $default_width = get_option('embed_size_w');
+ // 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.h
if ( empty( $default_width ) ) {
- if ( ! empty( $content_width ) ) {
- $default_width = $content_width;
- } else {
- $default_width = 640;
- }
+ $default_width = 640;
}
if ( $input_w > 0 && $input_h > 0 ) {
@@ -363,12 +366,10 @@ add_action( 'init', 'wpcom_youtube_embed_crazy_url_init' );
*
* @param int get_option('embed_autourls') Option to automatically embed all plain text URLs.
*/
-if ( apply_filters( 'jetpack_comments_allow_oembed', get_option('embed_autourls') ) ) {
+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.
- if ( ! is_admin() ) {
- // Higher priority because we need it before auto-link and autop get to it
- add_filter( 'comment_text', 'youtube_link', 1 );
- }
+ // Higher priority because we need it before auto-link and autop get to it
+ add_filter( 'comment_text', 'youtube_link', 1 );
}
/**
diff --git a/plugins/jetpack/modules/site-icon.php b/plugins/jetpack/modules/site-icon.php
index 72cf69f7..d9f0f47a 100644
--- a/plugins/jetpack/modules/site-icon.php
+++ b/plugins/jetpack/modules/site-icon.php
@@ -13,5 +13,3 @@
include dirname( __FILE__ ) . '/site-icon/jetpack-site-icon.php';
include dirname( __FILE__ ) . '/site-icon/site-icon-functions.php';
-
-Jetpack_Sync::sync_options( __FILE__, 'jetpack_site_icon_url' );
diff --git a/plugins/jetpack/modules/site-icon/jetpack-site-icon.php b/plugins/jetpack/modules/site-icon/jetpack-site-icon.php
index db5626f3..afc91b05 100644
--- a/plugins/jetpack/modules/site-icon/jetpack-site-icon.php
+++ b/plugins/jetpack/modules/site-icon/jetpack-site-icon.php
@@ -71,7 +71,7 @@ class Jetpack_Site_Icon {
add_action( 'admin_print_styles-options-general.php', array( $this, 'add_general_options_styles' ) );
- // Add the favicon to the front end and backend if Core's site icon not used.
+ // Add the favicon to the front end and back end if Core's site icon not used.
/**
* As of WP 4.3 and JP 3.6, both are outputting the same icons so no need to fire these.
* This is a temporary solution until Jetpack's module primary function is deprecated.
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-xsl.php b/plugins/jetpack/modules/sitemaps/sitemap-xsl.php
index 906f11fb..eceb38ca 100644
--- a/plugins/jetpack/modules/sitemaps/sitemap-xsl.php
+++ b/plugins/jetpack/modules/sitemaps/sitemap-xsl.php
@@ -90,8 +90,36 @@ $xsl = '<?xml version="1.0" encoding="UTF-8"?>
<body>
<div id="description">
<h1>' . esc_html( ent2ncr( __( 'XML Sitemap', 'jetpack' ) ) ) . '</h1>
- <p>' . wp_kses( sprintf( ent2ncr( __( 'This is an XML Sitemap generated by <a href="%s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%s" target="_blank">Google</a> or <a href="%s" target="_blank">Bing</a>.', 'jetpack' ), 'http://jetpack.com/', 'https://www.google.com', 'https://www.bing.com/' ), array( 'a' => array( 'href' => true, 'title' => true ) ) ) ) . '</p>
- <p>' . wp_kses( sprintf( ent2ncr( __( 'You can find more information on XML sitemaps at <a href="%s" target="_blank">sitemaps.org</a>', 'jetpack' ), 'http://sitemaps.org' ), array( 'a' => array( 'href' => true, 'title' => true ) ) ) ) . '</p>
+ <p>' . wp_kses(
+ ent2ncr(
+ sprintf(
+ __( 'This is an XML Sitemap generated by <a href="%s" target="_blank">Jetpack</a>, meant to be consumed by search engines like <a href="%s" target="_blank">Google</a> or <a href="%s" target="_blank">Bing</a>.', 'jetpack' ),
+ 'http://jetpack.com/',
+ 'https://www.google.com',
+ 'https://www.bing.com/'
+ )
+ ),
+ array(
+ 'a' => array(
+ 'href' => true,
+ 'title' => true
+ )
+ )
+ ) . '</p>
+ <p>' . wp_kses(
+ ent2ncr(
+ sprintf(
+ __( 'You can find more information on XML sitemaps at <a href="%s" target="_blank">sitemaps.org</a>', 'jetpack' ),
+ 'http://sitemaps.org'
+ )
+ ),
+ array(
+ 'a' => array(
+ 'href' => true,
+ 'title' => true
+ )
+ )
+ ) . '</p>
</div>
<div id="content">
<table>
diff --git a/plugins/jetpack/modules/sso.php b/plugins/jetpack/modules/sso.php
index 81b8f883..5b9c34c6 100644
--- a/plugins/jetpack/modules/sso.php
+++ b/plugins/jetpack/modules/sso.php
@@ -532,13 +532,13 @@ class Jetpack_SSO {
<span><?php esc_html_e( 'Or', 'jetpack' ); ?></span>
</div>
- <a href="<?php echo add_query_arg( 'jetpack-sso-show-default-form', '1' ); ?>" class="jetpack-sso-toggle wpcom">
+ <a href="<?php echo esc_url( add_query_arg( 'jetpack-sso-show-default-form', '1' ) ); ?>" class="jetpack-sso-toggle wpcom">
<?php
esc_html_e( 'Log in with username and password', 'jetpack' )
?>
</a>
- <a href="<?php echo add_query_arg( 'jetpack-sso-show-default-form', '0' ); ?>" class="jetpack-sso-toggle default">
+ <a href="<?php echo esc_url( add_query_arg( 'jetpack-sso-show-default-form', '0' ) ); ?>" class="jetpack-sso-toggle default">
<?php
esc_html_e( 'Log in with WordPress.com', 'jetpack' )
?>
@@ -795,7 +795,7 @@ class Jetpack_SSO {
JetpackTracking::record_user_event( 'sso_user_logged_in', array(
'user_found_with' => $user_found_with,
'user_connected' => (bool) $is_user_connected,
- 'user_role' => Jetpack::init()->translate_current_user_to_role()
+ 'user_role' => Jetpack::translate_current_user_to_role()
) );
if ( ! $is_user_connected ) {
@@ -1010,7 +1010,7 @@ class Jetpack_SSO {
$error = sprintf(
wp_kses(
__(
- 'Two-Step Authentication is required to access this site. Please visit your <a href="%1$s" target="_blank">Security Settings</a> to configure <a href="%2$S" target="_blank">Two-step Authentication</a> for your account.',
+ 'Two-Step Authentication is required to access this site. Please visit your <a href="%1$s" target="_blank">Security Settings</a> to configure <a href="%2$s" target="_blank">Two-step Authentication</a> for your account.',
'jetpack'
),
array( 'a' => array( 'href' => array() ) )
diff --git a/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css b/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css
index 48cc5e4f..23993a37 100644
--- a/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css
+++ b/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.css
@@ -177,3 +177,9 @@
.jetpack-sso-form-display #backtoblog {
margin: 24px 0 0;
}
+
+.jetpack-sso-clear:after {
+ content: "";
+ display: table;
+ clear: both;
+}
diff --git a/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css b/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css
index 0445451c..77c6aa07 100644
--- a/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css
+++ b/plugins/jetpack/modules/sso/jetpack-sso-login-rtl.min.css
@@ -1 +1 @@
-#loginform{position:relative!important;padding-bottom:92px}.jetpack-sso .message{margin-top:20px}.jetpack-sso #login .message:first-child,.jetpack-sso #login h1+.message{margin-top:0}.jetpack-sso-repositioned #loginform{padding-bottom:26px}#loginform #jetpack-sso-wrap,#loginform #jetpack-sso-wrap *{box-sizing:border-box}#jetpack-sso-wrap__action,#jetpack-sso-wrap__user{display:none}.jetpack-sso-form-display #jetpack-sso-wrap__action,.jetpack-sso-form-display #jetpack-sso-wrap__user{display:block}#jetpack-sso-wrap{position:absolute;bottom:20px;padding:0 24px;margin-right:-24px;margin-left:-24px;width:100%}.jetpack-sso-repositioned #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:16px;margin-right:0;margin-left:0}.jetpack-sso-form-display #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:0;margin-right:0;margin-left:0}#loginform #jetpack-sso-wrap p{color:#777;margin-bottom:16px}#jetpack-sso-wrap a{display:block;width:100%;text-align:center;text-decoration:none}#jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:none}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:block}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default,.jetpack-sso-form-display #loginform>div,.jetpack-sso-form-display #loginform>p{display:none}.jetpack-sso-form-display #loginform #jetpack-sso-wrap{display:block}.jetpack-sso-form-display #loginform{padding:26px 24px}.jetpack-sso-or{margin-bottom:16px;position:relative;text-align:center}.jetpack-sso-or:before{background:#E5E5E5;content:'';height:1px;position:absolute;right:0;top:50%;width:100%}.jetpack-sso-or span{background:#fff;color:#777;position:relative;padding:0 8px;text-transform:uppercase}.jetpack-sso.button{height:36px;line-height:34px;float:none;margin-bottom:16px;position:relative;width:100%}.jetpack-sso.button>span{position:relative;padding-right:30px}.jetpack-sso.button .genericon-wordpress{position:absolute;right:0;top:-3px;font-size:24px}@media screen and (max-width:782px){.jetpack-sso.button{line-height:22px}}#jetpack-sso-wrap__user img{border-radius:50%;display:block;margin:0 auto 16px}#jetpack-sso-wrap__user h2{font-size:21px;font-weight:300;margin-bottom:16px;text-align:center}#jetpack-sso-wrap__user h2 span{font-weight:700}.jetpack-sso-wrap__reauth{margin-bottom:16px}.jetpack-sso-form-display #nav{display:none}.jetpack-sso-form-display #backtoblog{margin:24px 0 0} \ No newline at end of file
+#loginform{position:relative!important;padding-bottom:92px}.jetpack-sso .message{margin-top:20px}.jetpack-sso #login .message:first-child,.jetpack-sso #login h1+.message{margin-top:0}.jetpack-sso-repositioned #loginform{padding-bottom:26px}#loginform #jetpack-sso-wrap,#loginform #jetpack-sso-wrap *{box-sizing:border-box}#jetpack-sso-wrap__action,#jetpack-sso-wrap__user{display:none}.jetpack-sso-form-display #jetpack-sso-wrap__action,.jetpack-sso-form-display #jetpack-sso-wrap__user{display:block}#jetpack-sso-wrap{position:absolute;bottom:20px;padding:0 24px;margin-right:-24px;margin-left:-24px;width:100%}.jetpack-sso-repositioned #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:16px;margin-right:0;margin-left:0}.jetpack-sso-form-display #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:0;margin-right:0;margin-left:0}#loginform #jetpack-sso-wrap p{color:#777;margin-bottom:16px}#jetpack-sso-wrap a{display:block;width:100%;text-align:center;text-decoration:none}#jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:none}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:block}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default,.jetpack-sso-form-display #loginform>div,.jetpack-sso-form-display #loginform>p{display:none}.jetpack-sso-form-display #loginform #jetpack-sso-wrap{display:block}.jetpack-sso-form-display #loginform{padding:26px 24px}.jetpack-sso-or{margin-bottom:16px;position:relative;text-align:center}.jetpack-sso-or:before{background:#E5E5E5;content:'';height:1px;position:absolute;right:0;top:50%;width:100%}.jetpack-sso-or span{background:#fff;color:#777;position:relative;padding:0 8px;text-transform:uppercase}.jetpack-sso.button{height:36px;line-height:34px;float:none;margin-bottom:16px;position:relative;width:100%}.jetpack-sso.button>span{position:relative;padding-right:30px}.jetpack-sso.button .genericon-wordpress{position:absolute;right:0;top:-3px;font-size:24px}@media screen and (max-width:782px){.jetpack-sso.button{line-height:22px}}#jetpack-sso-wrap__user img{border-radius:50%;display:block;margin:0 auto 16px}#jetpack-sso-wrap__user h2{font-size:21px;font-weight:300;margin-bottom:16px;text-align:center}#jetpack-sso-wrap__user h2 span{font-weight:700}.jetpack-sso-wrap__reauth{margin-bottom:16px}.jetpack-sso-form-display #nav{display:none}.jetpack-sso-form-display #backtoblog{margin:24px 0 0}.jetpack-sso-clear:after{content:"";display:table;clear:both} \ No newline at end of file
diff --git a/plugins/jetpack/modules/sso/jetpack-sso-login.css b/plugins/jetpack/modules/sso/jetpack-sso-login.css
index f1da883f..e79cf1f4 100644
--- a/plugins/jetpack/modules/sso/jetpack-sso-login.css
+++ b/plugins/jetpack/modules/sso/jetpack-sso-login.css
@@ -177,3 +177,9 @@
.jetpack-sso-form-display #backtoblog {
margin: 24px 0 0;
}
+
+.jetpack-sso-clear:after {
+ content: "";
+ display: table;
+ clear: both;
+}
diff --git a/plugins/jetpack/modules/sso/jetpack-sso-login.js b/plugins/jetpack/modules/sso/jetpack-sso-login.js
index 9de8c2b9..53d1a0e8 100644
--- a/plugins/jetpack/modules/sso/jetpack-sso-login.js
+++ b/plugins/jetpack/modules/sso/jetpack-sso-login.js
@@ -6,7 +6,7 @@ jQuery( document ).ready( function( $ ) {
userLogin = $( '#user_login' ),
ssoWrap = $( '#jetpack-sso-wrap' ),
loginForm = $( '#loginform' ),
- overflow = $( '<div style="overflow: auto;"></div>' );
+ overflow = $( '<div class="jetpack-sso-clear"></div>' );
// The overflow div is a poor man's clearfloat. We reposition the remember me
// checkbox and the submit button within that to clear the float on the
diff --git a/plugins/jetpack/modules/sso/jetpack-sso-login.min.css b/plugins/jetpack/modules/sso/jetpack-sso-login.min.css
index 311ade50..c82862e0 100644
--- a/plugins/jetpack/modules/sso/jetpack-sso-login.min.css
+++ b/plugins/jetpack/modules/sso/jetpack-sso-login.min.css
@@ -1 +1 @@
-#loginform{position:relative!important;padding-bottom:92px}.jetpack-sso .message{margin-top:20px}.jetpack-sso #login .message:first-child,.jetpack-sso #login h1+.message{margin-top:0}.jetpack-sso-repositioned #loginform{padding-bottom:26px}#loginform #jetpack-sso-wrap,#loginform #jetpack-sso-wrap *{box-sizing:border-box}#jetpack-sso-wrap__action,#jetpack-sso-wrap__user{display:none}.jetpack-sso-form-display #jetpack-sso-wrap__action,.jetpack-sso-form-display #jetpack-sso-wrap__user{display:block}#jetpack-sso-wrap{position:absolute;bottom:20px;padding:0 24px;margin-left:-24px;margin-right:-24px;width:100%}.jetpack-sso-repositioned #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:16px;margin-left:0;margin-right:0}.jetpack-sso-form-display #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:0;margin-left:0;margin-right:0}#loginform #jetpack-sso-wrap p{color:#777;margin-bottom:16px}#jetpack-sso-wrap a{display:block;width:100%;text-align:center;text-decoration:none}#jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:none}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:block}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default,.jetpack-sso-form-display #loginform>div,.jetpack-sso-form-display #loginform>p{display:none}.jetpack-sso-form-display #loginform #jetpack-sso-wrap{display:block}.jetpack-sso-form-display #loginform{padding:26px 24px}.jetpack-sso-or{margin-bottom:16px;position:relative;text-align:center}.jetpack-sso-or:before{background:#E5E5E5;content:'';height:1px;position:absolute;left:0;top:50%;width:100%}.jetpack-sso-or span{background:#fff;color:#777;position:relative;padding:0 8px;text-transform:uppercase}.jetpack-sso.button{height:36px;line-height:34px;float:none;margin-bottom:16px;position:relative;width:100%}.jetpack-sso.button>span{position:relative;padding-left:30px}.jetpack-sso.button .genericon-wordpress{position:absolute;left:0;top:-3px;font-size:24px}@media screen and (max-width:782px){.jetpack-sso.button{line-height:22px}}#jetpack-sso-wrap__user img{border-radius:50%;display:block;margin:0 auto 16px}#jetpack-sso-wrap__user h2{font-size:21px;font-weight:300;margin-bottom:16px;text-align:center}#jetpack-sso-wrap__user h2 span{font-weight:700}.jetpack-sso-wrap__reauth{margin-bottom:16px}.jetpack-sso-form-display #nav{display:none}.jetpack-sso-form-display #backtoblog{margin:24px 0 0} \ No newline at end of file
+#loginform{position:relative!important;padding-bottom:92px}.jetpack-sso .message{margin-top:20px}.jetpack-sso #login .message:first-child,.jetpack-sso #login h1+.message{margin-top:0}.jetpack-sso-repositioned #loginform{padding-bottom:26px}#loginform #jetpack-sso-wrap,#loginform #jetpack-sso-wrap *{box-sizing:border-box}#jetpack-sso-wrap__action,#jetpack-sso-wrap__user{display:none}.jetpack-sso-form-display #jetpack-sso-wrap__action,.jetpack-sso-form-display #jetpack-sso-wrap__user{display:block}#jetpack-sso-wrap{position:absolute;bottom:20px;padding:0 24px;margin-left:-24px;margin-right:-24px;width:100%}.jetpack-sso-repositioned #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:16px;margin-left:0;margin-right:0}.jetpack-sso-form-display #jetpack-sso-wrap{position:relative;bottom:auto;padding:0;margin-top:0;margin-left:0;margin-right:0}#loginform #jetpack-sso-wrap p{color:#777;margin-bottom:16px}#jetpack-sso-wrap a{display:block;width:100%;text-align:center;text-decoration:none}#jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:none}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.wpcom{display:block}.jetpack-sso-form-display #jetpack-sso-wrap .jetpack-sso-toggle.default,.jetpack-sso-form-display #loginform>div,.jetpack-sso-form-display #loginform>p{display:none}.jetpack-sso-form-display #loginform #jetpack-sso-wrap{display:block}.jetpack-sso-form-display #loginform{padding:26px 24px}.jetpack-sso-or{margin-bottom:16px;position:relative;text-align:center}.jetpack-sso-or:before{background:#E5E5E5;content:'';height:1px;position:absolute;left:0;top:50%;width:100%}.jetpack-sso-or span{background:#fff;color:#777;position:relative;padding:0 8px;text-transform:uppercase}.jetpack-sso.button{height:36px;line-height:34px;float:none;margin-bottom:16px;position:relative;width:100%}.jetpack-sso.button>span{position:relative;padding-left:30px}.jetpack-sso.button .genericon-wordpress{position:absolute;left:0;top:-3px;font-size:24px}@media screen and (max-width:782px){.jetpack-sso.button{line-height:22px}}#jetpack-sso-wrap__user img{border-radius:50%;display:block;margin:0 auto 16px}#jetpack-sso-wrap__user h2{font-size:21px;font-weight:300;margin-bottom:16px;text-align:center}#jetpack-sso-wrap__user h2 span{font-weight:700}.jetpack-sso-wrap__reauth{margin-bottom:16px}.jetpack-sso-form-display #nav{display:none}.jetpack-sso-form-display #backtoblog{margin:24px 0 0}.jetpack-sso-clear:after{content:"";display:table;clear:both} \ No newline at end of file
diff --git a/plugins/jetpack/modules/stats.php b/plugins/jetpack/modules/stats.php
index 2040b682..79ac290d 100644
--- a/plugins/jetpack/modules/stats.php
+++ b/plugins/jetpack/modules/stats.php
@@ -21,21 +21,6 @@ defined( 'STATS_DASHBOARD_SERVER' ) or define( 'STATS_DASHBOARD_SERVER', 'dashbo
add_action( 'jetpack_modules_loaded', 'stats_load' );
-// Tell HQ about changed settings
-Jetpack_Sync::sync_options( __FILE__,
- 'stats_options',
- 'home',
- 'siteurl',
- 'blogname',
- 'blogdescription',
- 'gmt_offset',
- 'timezone_string',
- 'page_on_front',
- 'permalink_structure',
- 'category_base',
- 'tag_base'
-);
-
function stats_load() {
global $wp_roles;
@@ -44,14 +29,6 @@ function stats_load() {
Jetpack::module_configuration_head( __FILE__, 'stats_configuration_head' );
Jetpack::module_configuration_screen( __FILE__, 'stats_configuration_screen' );
- // Tell HQ about changed posts
- $post_stati = get_post_stati( array( 'public' => true ) ); // All public post stati
- $post_stati[] = 'private'; // Content from private stati will be redacted
- Jetpack_Sync::sync_posts( __FILE__, array(
- 'post_types' => get_post_types( array( 'public' => true ) ), // All public post types
- 'post_stati' => $post_stati,
- ) );
-
// Generate the tracking code after wp() has queried for posts.
add_action( 'template_redirect', 'stats_template_redirect', 1 );
diff --git a/plugins/jetpack/modules/subscriptions.php b/plugins/jetpack/modules/subscriptions.php
index d34c8715..0c614fb8 100644
--- a/plugins/jetpack/modules/subscriptions.php
+++ b/plugins/jetpack/modules/subscriptions.php
@@ -15,24 +15,6 @@
add_action( 'jetpack_modules_loaded', 'jetpack_subscriptions_load' );
-Jetpack_Sync::sync_options(
- __FILE__,
- 'home',
- 'blogname',
- 'siteurl',
- 'page_on_front',
- 'permalink_structure',
- 'category_base',
- 'rss_use_excerpt',
- 'subscription_options',
- 'stb_enabled',
- 'stc_enabled',
- 'tag_base'
-);
-
-Jetpack_Sync::sync_posts( __FILE__ );
-Jetpack_Sync::sync_comments( __FILE__ );
-
function jetpack_subscriptions_load() {
Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, 'jetpack_subscriptions_configuration_load' );
diff --git a/plugins/jetpack/modules/theme-tools/random-redirect.php b/plugins/jetpack/modules/theme-tools/random-redirect.php
index a4f29d80..2e58bee6 100644
--- a/plugins/jetpack/modules/theme-tools/random-redirect.php
+++ b/plugins/jetpack/modules/theme-tools/random-redirect.php
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Random Redirect
-Plugin URI: http://wordpress.org/extend/plugins/random-redirect/
+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
@@ -31,6 +31,8 @@ function jetpack_matt_random_redirect() {
if ( is_author() ) {
$random_author_name = get_the_author_meta( 'user_login' );
$random_author_query = 'AND user_login = "' . $random_author_name . '"';
+ } else {
+ $random_author_query = '';
}
// Acceptable URL formats: /[...]/?random=[post type], /?random, /&random, /&random=1
@@ -65,7 +67,7 @@ function jetpack_matt_random_redirect() {
} else {
$random_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_password = '' AND post_status = 'publish' %s ORDER BY RAND() LIMIT 1", $post_type, $random_author_query ) );
}
-
+
$permalink = get_permalink( $random_id );
wp_safe_redirect( $permalink );
exit;
diff --git a/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php b/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php
index 3b783eea..7919d5df 100644
--- a/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php
+++ b/plugins/jetpack/modules/theme-tools/site-breadcrumbs.php
@@ -2,7 +2,7 @@
/**
* Plugin Name: Site Breadcrumbs
* Plugin URI: http://wordpress.com
- * Description: Quickly add breadcrumbs to the single view of a hierarchical post type
+ * Description: Quickly add breadcrumbs to the single view of a hierarchical post type or a hierarchical taxonomy.
* Author: Automattic
* Version: 1.0
* Author URI: http://wordpress.com
@@ -10,28 +10,70 @@
*/
function jetpack_breadcrumbs() {
- if ( ! is_page() || is_front_page() ) {
+ $taxonomy = is_category() ? 'category' : get_query_var( 'taxonomy' );
+ $is_taxonomy_hierarchical = is_taxonomy_hierarchical( $taxonomy );
+
+ $post_type = is_page() ? 'page' : get_query_var( 'post_type' );
+ $is_post_type_hierarchical = is_post_type_hierarchical( $post_type );
+
+ if ( ! ( $is_post_type_hierarchical || $is_taxonomy_hierarchical ) || is_front_page() ) {
return;
}
- global $post;
+ $breadcrumb = '';
- $ancestors = array_reverse( get_post_ancestors( $post->ID ) );
+ if ( $is_post_type_hierarchical ) {
+ $post_id = get_queried_object_id();
+ $ancestors = array_reverse( get_post_ancestors( $post_id ) );
+ if ( $ancestors ) {
+ foreach ( $ancestors as $ancestor ) {
+ $breadcrumb .= '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="' . esc_url( get_permalink( $ancestor ) ) . '" itemprop="item"><span itemprop="name">' . esc_html( get_the_title( $ancestor ) ) . '</span></a></span>';
+ }
+ }
+ $breadcrumb .= '<span class="current-page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">' . esc_html( get_the_title( $post_id ) ) . '</span></span>';
+ } elseif ( $is_taxonomy_hierarchical ) {
+ $current = get_term( get_queried_object_id(), $taxonomy );
- $before = '<nav class="entry-breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList">';
- $after = '</nav>';
+ if ( is_wp_error( $current ) ) {
+ return;
+ }
- $home = '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="' . esc_url( home_url( "/" ) ) . '" class="home-link" itemprop="item" rel="home"><span itemprop="name">' . __( 'Home', 'jetpack' ) . '</span></a></span>';
+ if ( $current->parent ) {
+ $breadcrumb = jetpack_get_term_parents( $current->parent, $taxonomy );
+ }
- $breadcrumb = '';
+ $breadcrumb .= '<span class="current-category" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">' . esc_html( $current->name ) . '</span></span>';
+ }
- if ( $ancestors ) {
- foreach ( $ancestors as $ancestor ) {
- $breadcrumb .= '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="' . esc_url( get_permalink( $ancestor ) ) . '" itemprop="item"><span itemprop="name">' . esc_html( get_the_title( $ancestor ) ) . '</span></a></span>';
- }
+ $home = '<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="' . esc_url( home_url( '/' ) ) . '" class="home-link" itemprop="item" rel="home"><span itemprop="name">' . esc_html__( 'Home', 'jetpack' ) . '</span></a></span>';
+
+ echo '<nav class="entry-breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList">' . $home . $breadcrumb . '</nav>';
+}
+
+/**
+ * Return the parents for a given taxonomy term ID.
+ *
+ * @param int $term Taxonomy term whose parents will be returned.
+ * @param string $taxonomy Taxonomy name that the term belongs to.
+ * @param array $visited Terms already added to prevent duplicates.
+ *
+ * @return string A list of links to the term parents.
+ */
+function jetpack_get_term_parents( $term, $taxonomy, $visited = array() ) {
+ $parent = get_term( $term, $taxonomy );
+
+ if ( is_wp_error( $parent ) ) {
+ return $parent;
+ }
+
+ $chain = '';
+
+ if ( $parent->parent && ( $parent->parent != $parent->term_id ) && ! in_array( $parent->parent, $visited ) ) {
+ $visited[] = $parent->parent;
+ $chain .= jetpack_get_term_parents( $parent->parent, $taxonomy, $visited );
}
- $breadcrumb .= '<span class="current-page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">' . esc_html( get_the_title( $post->ID ) ) . '</span></span>';
+ $chain .= '<a href="' . esc_url( get_category_link( $parent->term_id ) ) . '">' . $parent->name . '</a>';
- echo $before . $home . $breadcrumb . $after;
+ return $chain;
}
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php b/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
index 3d89a071..0cc0b9cb 100644
--- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
@@ -20,7 +20,7 @@ class Jetpack_Tiled_Gallery {
public function tiles_enabled() {
// Check the setting status
- return '' != get_option( 'tiled_galleries' );
+ return '' != Jetpack_Options::get_option_and_ensure_autoload( 'tiled_galleries', '' );
}
public function set_atts( $atts ) {
diff --git a/plugins/jetpack/modules/verification-tools/blog-verification-tools.php b/plugins/jetpack/modules/verification-tools/blog-verification-tools.php
index 7320a8bf..e69e248e 100644
--- a/plugins/jetpack/modules/verification-tools/blog-verification-tools.php
+++ b/plugins/jetpack/modules/verification-tools/blog-verification-tools.php
@@ -31,7 +31,7 @@ function jetpack_verification_options_init() {
add_action( 'admin_init', 'jetpack_verification_options_init' );
function jetpack_verification_print_meta() {
- $verification_services_codes = get_option( 'verification_services_codes' );
+ $verification_services_codes = Jetpack_Options::get_option_and_ensure_autoload( 'verification_services_codes', '0' );
if ( is_array( $verification_services_codes ) ) {
$ver_output = "<!-- Jetpack Site Verification Tags -->\n";
foreach ( jetpack_verification_services() as $name => $service ) {
diff --git a/plugins/jetpack/modules/videopress/js/videopress-admin.js b/plugins/jetpack/modules/videopress/js/videopress-admin.js
index 5daac4f4..76f26272 100644
--- a/plugins/jetpack/modules/videopress/js/videopress-admin.js
+++ b/plugins/jetpack/modules/videopress/js/videopress-admin.js
@@ -465,7 +465,7 @@
var VideoPressModal = new VideoPressModalView();
// Configuration screen behavior
- $(document).on( 'ready', function() {
+ $(document).ready( function() {
var $form = $( '#videopress-settings' );
// Not on a configuration screen
diff --git a/plugins/jetpack/modules/widgets/contact-info.php b/plugins/jetpack/modules/widgets/contact-info.php
index 552f9b91..fd5bef61 100644
--- a/plugins/jetpack/modules/widgets/contact-info.php
+++ b/plugins/jetpack/modules/widgets/contact-info.php
@@ -42,26 +42,10 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
* Enqueue scripts and styles.
*/
public function enqueue_scripts() {
- $google_url = 'https://maps.googleapis.com/maps/api/js';
- /**
- * Set a Google Maps API Key.
- *
- * @since 4.1.0
- *
- * @param string $key Google Maps API Key
- */
- $key = apply_filters( 'jetpack_google_maps_api_key', null );
-
- if ( ! empty( $key ) ) {
- $google_url = add_query_arg( 'key', $key, $google_url );
- }
-
- wp_enqueue_script( 'jquery' );
- wp_enqueue_script( 'google-maps', esc_url( $google_url, null, null ) );
- wp_enqueue_script( 'contact-info-map-js', plugins_url( 'contact-info/contact-info-map.js', __FILE__ ), array( 'jquery', 'google-maps' ), 20150127 );
- wp_enqueue_style( 'contact-info-map-css', plugins_url( 'contact-info/contact-info-map.css', __FILE__ ), null, 20150127 );
+ wp_enqueue_style( 'contact-info-map-css', plugins_url( 'contact-info/contact-info-map.css', __FILE__ ), null, 20160623 );
}
+
/**
* Return an associative array of default values
*
@@ -75,7 +59,8 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
'address' => __( "3999 Mission Boulevard,\nSan Diego CA 92109", 'jetpack' ),
'phone' => _x( '1-202-555-1212', 'Example of a phone number', 'jetpack' ),
'hours' => __( "Lunch: 11am - 2pm \nDinner: M-Th 5pm - 11pm, Fri-Sat:5pm - 1am", 'jetpack' ),
- 'showmap' => 1,
+ 'showmap' => 0,
+ 'apikey' => null,
'lat' => null,
'lon' => null
);
@@ -111,12 +96,17 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
$showmap = $instance['showmap'];
+ /** This action is documented in modules/widgets/contact-info.php */
if ( $showmap && $this->has_good_map( $instance ) ) {
-
- $lat = $instance['lat'];
- $lon = $instance['lon'];
-
- echo $this->build_map( $lat, $lon );
+ /**
+ * Set a Google Maps API Key.
+ *
+ * @since 4.1.0
+ *
+ * @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 );
}
$map_link = $this->build_map_link( $instance['address'] );
@@ -173,6 +163,7 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
$instance['address'] = wp_kses( $new_instance['address'], array() );
$instance['phone'] = wp_kses( $new_instance['phone'], 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;
@@ -186,7 +177,7 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
$address = $this->urlencode_address( $instance['address'] );
$path = "http://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', null );
+ $key = apply_filters( 'jetpack_google_maps_api_key', $instance['apikey'] );
if ( ! empty( $key ) ) {
$path = add_query_arg( 'key', $key, $path );
@@ -239,6 +230,8 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*/
function form( $instance ) {
$instance = wp_parse_args( $instance, $this->defaults() );
+ wp_enqueue_script( 'contact-info-admin', plugins_url( 'contact-info/contact-info-admin.js', __FILE__ ), array( 'jquery' ), 20160727 );
+
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'jetpack' ); ?></label>
@@ -251,7 +244,7 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
<?php
if ( $this->has_good_map( $instance ) ) {
?>
- <input class="" 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 ); ?> />
+ <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
}
@@ -263,6 +256,16 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
}
?>
</p>
+
+ <p class="jp-contact-info-apikey" 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'] ); ?>" />
+ <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.' ), array( 'a' => array( 'href' => true ) ) ), 'https://jetpack.com/support/extra-sidebar-widgets/contact-info-widget/' ); ?></small>
+ </label>
+ </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'] ); ?>" />
@@ -298,19 +301,14 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*
* @return string HTML of the map
*/
- function build_map( $lat, $lon ) {
+ function build_map( $address, $api_key = null ) {
$this->enqueue_scripts();
+ $src = add_query_arg( 'q', urlencode( $address ), 'https://www.google.com/maps/embed/v1/place' );
+ if ( ! empty( $api_key ) ) {
+ $src = add_query_arg( 'key', $api_key, $src );
+ }
- $lat = esc_attr( $lat );
- $lon = esc_attr( $lon );
- $html = <<<EOT
- <div class="contact-map">
- <input type="hidden" class="contact-info-map-lat" value="$lat" />
- <input type="hidden" class="contact-info-map-lon" value="$lon" />
- <div class="contact-info-map-canvas"></div></div>
-EOT;
-
- return $html;
+ return '<iframe width="600" height="216" frameborder="0" src="' . esc_url( $src ) . '" class="contact-map"></iframe>';
}
/**
diff --git a/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js b/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js
new file mode 100644
index 00000000..e38f0dac
--- /dev/null
+++ b/plugins/jetpack/modules/widgets/contact-info/contact-info-admin.js
@@ -0,0 +1,8 @@
+(function( $ ) {
+ $( document ).on( 'change', '.jp-contact-info-showmap', function() {
+ var $checkbox = $( this ),
+ isChecked = $checkbox.is( ':checked' );
+
+ $checkbox.closest( '.widget' ).find( '.jp-contact-info-apikey' ).toggle( isChecked );
+ });
+})( 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 47629e9b..7aa9e698 100644
--- a/plugins/jetpack/modules/widgets/contact-info/contact-info-map.css
+++ b/plugins/jetpack/modules/widgets/contact-info/contact-info-map.css
@@ -1,11 +1,4 @@
-.contact-info-map-canvas {
- height: 216px;
- margin: 0;
- padding: 0;
- overflow: hidden;
-}
-
-/* Prevent Google maps controls from being hidden */
-.gmnoprint img {
- max-width: none !important;
-}
+.contact-map {
+ max-width: 100%;
+ border: 0;
+} \ No newline at end of file
diff --git a/plugins/jetpack/modules/widgets/contact-info/contact-info-map.js b/plugins/jetpack/modules/widgets/contact-info/contact-info-map.js
deleted file mode 100644
index c7036222..00000000
--- a/plugins/jetpack/modules/widgets/contact-info/contact-info-map.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* global google */
-/* jshint unused:false */
-jQuery( function( $ ) {
-
- function setupContactMaps( rootElement ) {
- rootElement = $( rootElement || document.body );
-
- rootElement.find( 'div.contact-map' ).each( function() {
-
- // get lat and lon from hidden input values
- var lat = jQuery(this).find('.contact-info-map-lat').val(),
- lon = jQuery(this).find('.contact-info-map-lon').val(),
- lat_lon = new google.maps.LatLng( lat, lon ),
- mapOptions = {
- zoom: 16,
- center: lat_lon,
- mapTypeId: google.maps.MapTypeId.ROADMAP
- },
- map = new google.maps.Map(jQuery(this).find('.contact-info-map-canvas')[0], mapOptions),
- marker = new google.maps.Marker({
- map: map,
- position: lat_lon
- });
-
- google.maps.event.addListenerOnce(map, 'mouseover', function() {
- google.maps.event.trigger(map, 'resize');
- });
-
- });
- }
-
- setupContactMaps();
-
- if ( 'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh ) {
- wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function( placement ) {
- if ( wp.isJetpackWidgetPlaced( placement, 'widget_contact_info' ) ) {
- setupContactMaps( placement.container );
- }
- } );
- }
-} );
diff --git a/plugins/jetpack/modules/widgets/gravatar-profile.php b/plugins/jetpack/modules/widgets/gravatar-profile.php
index 00e701e2..a82865ea 100644
--- a/plugins/jetpack/modules/widgets/gravatar-profile.php
+++ b/plugins/jetpack/modules/widgets/gravatar-profile.php
@@ -115,7 +115,7 @@ class Jetpack_Gravatar_Profile_Widget extends WP_Widget {
<?php
/**
- * Fires when an item is displayed on the frontend.
+ * Fires when an item is displayed on the front end.
*
* Can be used to track stats about the number of displays for a specific item
*
diff --git a/plugins/jetpack/modules/widgets/social-media-icons.php b/plugins/jetpack/modules/widgets/social-media-icons.php
index f46ef290..fe836d64 100644
--- a/plugins/jetpack/modules/widgets/social-media-icons.php
+++ b/plugins/jetpack/modules/widgets/social-media-icons.php
@@ -170,7 +170,7 @@ class WPCOM_social_media_icons_widget extends WP_Widget {
echo apply_filters( 'jetpack_social_media_icons_widget_output', $html );
}
- // backend
+ // back end
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $this->defaults );
?>
diff --git a/plugins/jetpack/modules/widgets/top-posts.php b/plugins/jetpack/modules/widgets/top-posts.php
index 0756a198..fa1222ff 100644
--- a/plugins/jetpack/modules/widgets/top-posts.php
+++ b/plugins/jetpack/modules/widgets/top-posts.php
@@ -246,7 +246,7 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
$get_image_options = array(
'fallback_to_avatars' => true,
/** This filter is documented in modules/stats.php */
- 'gravatar_default' => apply_filters( 'jetpack_static_url', set_url_scheme( 'http://en.wordpress.com/i/logo/white-gray-80.png' ) ),
+ 'gravatar_default' => apply_filters( 'jetpack_static_url', set_url_scheme( 'https://en.wordpress.com/i/logo/white-gray-80.png' ) ),
);
if ( 'grid' == $display ) {
$get_image_options['avatar_size'] = 200;
diff --git a/plugins/jetpack/modules/widgets/top-posts/style.css b/plugins/jetpack/modules/widgets/top-posts/style.css
index c301ee16..ceeae12b 100644
--- a/plugins/jetpack/modules/widgets/top-posts/style.css
+++ b/plugins/jetpack/modules/widgets/top-posts/style.css
@@ -28,7 +28,7 @@
margin: 0 2px 4px 0;
}
-.widget-grid-view-image:image:nth-child(even) {
+.widget-grid-view-image:nth-child(even) {
float: right;
}
diff --git a/plugins/jetpack/modules/widgets/twitter-timeline.php b/plugins/jetpack/modules/widgets/twitter-timeline.php
index ef9ed60d..4cb663d2 100644
--- a/plugins/jetpack/modules/widgets/twitter-timeline.php
+++ b/plugins/jetpack/modules/widgets/twitter-timeline.php
@@ -2,7 +2,7 @@
/*
* Based on Evolution Twitter Timeline
- * (http://wordpress.org/extend/plugins/evolution-twitter-timeline/)
+ * (https://wordpress.org/extend/plugins/evolution-twitter-timeline/)
* For details on Twitter Timelines see:
* - https://twitter.com/settings/widgets
* - https://dev.twitter.com/docs/embedded-timelines