diff options
Diffstat (limited to 'plugins/jetpack/modules')
99 files changed, 3199 insertions, 1253 deletions
diff --git a/plugins/jetpack/modules/after-the-deadline/atd-rtl.min.css b/plugins/jetpack/modules/after-the-deadline/atd-rtl.min.css index dfa6dbf3..914a4653 100644 --- a/plugins/jetpack/modules/after-the-deadline/atd-rtl.min.css +++ b/plugins/jetpack/modules/after-the-deadline/atd-rtl.min.css @@ -1 +1 @@ -.hiddenSpellError{border-bottom:2px solid red;cursor:default}.hiddenGrammarError{border-bottom:2px solid green;cursor:default}.hiddenSuggestion{border-bottom:2px solid #00f;cursor:default}#suggestmenu{min-width:122px;background:#ebeaeb;position:absolute;display:none;z-index:9999;overflow:none;margin-top:1px;text-align:right;font-size:11px}#suggestmenu strong{background:#ccc;font-weight:700;padding:3px 6px;display:block;border:1px solid #ddd;border-bottom:1px solid #aaa;color:#000}#suggestmenu em{text-align:center;padding:3px 6px;display:block;border-top:1px solid #ccc;border-right:1px solid #ccc}#suggestmenu a,#suggestmenu a:visited{background:#ebeaeb;border-right:1px solid #ddd;border-left:1px solid #ddd;padding:3px 6px;display:block;margin:0;text-decoration:none;color:#000;outline:0}#suggestmenu a.first,#suggestmenu a.first:visited{border-top:1px solid #ddd}#suggestmenu .foot,.spell_sep_top{border-top:1px solid #aaa}.spell_sep_bottom{border-bottom:1px solid #ddd}#suggestmenu a:hover{color:#000;background:#f5f5f5}#suggestmenu .foot{background:#fff}#suggestmenu .foot a,#suggestmenu .foot a:visited{outline:0}div.mce-atd-menu-title.mce-disabled{padding:3px 12px 0}div.mce-atd-menu-title.mce-disabled:hover,div.mce-atd-menu-title.mce-disabled:hover span.mce-text{background:0 0;color:#888;cursor:default}div.mce-atd-menu-title.mce-disabled span.mce-text{font-weight:700;color:#888}
\ No newline at end of file +.hiddenSpellError{border-bottom:2px solid red;cursor:default}.hiddenGrammarError{border-bottom:2px solid green;cursor:default}.hiddenSuggestion{border-bottom:2px solid #00f;cursor:default}#suggestmenu{min-width:122px;background:#ebeaeb;position:absolute;display:none;z-index:9999;overflow:none;margin-top:1px;text-align:right;font-size:11px}#suggestmenu strong{background:#ccc;font-weight:700;padding:3px 6px 3px 6px;display:block;border:1px solid #ddd;border-bottom:1px solid #aaa;color:#000}#suggestmenu em{text-align:center;padding:3px 6px 3px 6px;display:block;border-top:1px solid #ccc;border-right:1px solid #ccc}#suggestmenu a,#suggestmenu a:visited{background:#ebeaeb;border-right:1px solid #ddd;border-left:1px solid #ddd;padding:3px 6px 3px 6px;display:block;margin:0;text-decoration:none;color:#000;outline:0}#suggestmenu a.first,#suggestmenu a.first:visited{border-top:1px solid #ddd}.spell_sep_bottom{border-bottom:1px solid #ddd}.spell_sep_top{border-top:1px solid #aaa}#suggestmenu a:hover{color:#000;background:#f5f5f5}#suggestmenu .foot{border-top:1px solid #aaa;background:#fff}#suggestmenu .foot a,#suggestmenu .foot a:visited{outline:0}div.mce-atd-menu-title.mce-disabled{padding:3px 12px 0}div.mce-atd-menu-title.mce-disabled:hover,div.mce-atd-menu-title.mce-disabled:hover span.mce-text{background:0 0;color:#888;cursor:default}div.mce-atd-menu-title.mce-disabled span.mce-text{font-weight:700;color:#888}
\ No newline at end of file diff --git a/plugins/jetpack/modules/after-the-deadline/atd.min.css b/plugins/jetpack/modules/after-the-deadline/atd.min.css index fd88ac35..b212720a 100644 --- a/plugins/jetpack/modules/after-the-deadline/atd.min.css +++ b/plugins/jetpack/modules/after-the-deadline/atd.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -.hiddenSpellError{border-bottom:2px solid red;cursor:default}.hiddenGrammarError{border-bottom:2px solid green;cursor:default}.hiddenSuggestion{border-bottom:2px solid #00f;cursor:default}#suggestmenu{min-width:122px;background:#ebeaeb;position:absolute;display:none;z-index:9999;overflow:none;margin-top:1px;text-align:left;font-size:11px}#suggestmenu strong{background:#ccc;font-weight:700;padding:3px 6px;display:block;border:1px solid #ddd;border-bottom:1px solid #aaa;color:#000}#suggestmenu em{text-align:center;padding:3px 6px;display:block;border-top:1px solid #ccc;border-left:1px solid #ccc}#suggestmenu a,#suggestmenu a:visited{background:#ebeaeb;border-left:1px solid #ddd;border-right:1px solid #ddd;padding:3px 6px;display:block;margin:0;text-decoration:none;color:#000;outline:0}#suggestmenu a.first,#suggestmenu a.first:visited{border-top:1px solid #ddd}#suggestmenu .foot,.spell_sep_top{border-top:1px solid #aaa}.spell_sep_bottom{border-bottom:1px solid #ddd}#suggestmenu a:hover{color:#000;background:#f5f5f5}#suggestmenu .foot{background:#fff}#suggestmenu .foot a,#suggestmenu .foot a:visited{outline:0}div.mce-atd-menu-title.mce-disabled{padding:3px 12px 0}div.mce-atd-menu-title.mce-disabled:hover,div.mce-atd-menu-title.mce-disabled:hover span.mce-text{background:0 0;color:#888;cursor:default}div.mce-atd-menu-title.mce-disabled span.mce-text{font-weight:700;color:#888}
\ No newline at end of file +.hiddenSpellError{border-bottom:2px solid red;cursor:default}.hiddenGrammarError{border-bottom:2px solid green;cursor:default}.hiddenSuggestion{border-bottom:2px solid #00f;cursor:default}#suggestmenu{min-width:122px;background:#ebeaeb;position:absolute;display:none;z-index:9999;overflow:none;margin-top:1px;text-align:left;font-size:11px}#suggestmenu strong{background:#ccc;font-weight:700;padding:3px 6px 3px 6px;display:block;border:1px solid #ddd;border-bottom:1px solid #aaa;color:#000}#suggestmenu em{text-align:center;padding:3px 6px 3px 6px;display:block;border-top:1px solid #ccc;border-left:1px solid #ccc}#suggestmenu a,#suggestmenu a:visited{background:#ebeaeb;border-left:1px solid #ddd;border-right:1px solid #ddd;padding:3px 6px 3px 6px;display:block;margin:0;text-decoration:none;color:#000;outline:0}#suggestmenu a.first,#suggestmenu a.first:visited{border-top:1px solid #ddd}.spell_sep_bottom{border-bottom:1px solid #ddd}.spell_sep_top{border-top:1px solid #aaa}#suggestmenu a:hover{color:#000;background:#f5f5f5}#suggestmenu .foot{border-top:1px solid #aaa;background:#fff}#suggestmenu .foot a,#suggestmenu .foot a:visited{outline:0}div.mce-atd-menu-title.mce-disabled{padding:3px 12px 0}div.mce-atd-menu-title.mce-disabled:hover,div.mce-atd-menu-title.mce-disabled:hover span.mce-text{background:0 0;color:#888;cursor:default}div.mce-atd-menu-title.mce-disabled span.mce-text{font-weight:700;color:#888}
\ No newline at end of file diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.css b/plugins/jetpack/modules/carousel/jetpack-carousel.css index f9621525..6eb89bac 100644 --- a/plugins/jetpack/modules/carousel/jetpack-carousel.css +++ b/plugins/jetpack/modules/carousel/jetpack-carousel.css @@ -552,7 +552,8 @@ div#carousel-reblog-box { .jp-carousel-image-meta li { width: 48% !important; - float: left !important; + display: inline-block !important; + vertical-align: top !important; margin: 0 2% 15px 0 !important; color: #fff !important; font-size:13px !important; diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.js b/plugins/jetpack/modules/carousel/jetpack-carousel.js index 9ed78b76..b32cc843 100644 --- a/plugins/jetpack/modules/carousel/jetpack-carousel.js +++ b/plugins/jetpack/modules/carousel/jetpack-carousel.js @@ -435,6 +435,42 @@ jQuery(document).ready(function($) { } }; + var processSingleImageGallery = function() { + // process links that contain img tag with attribute data-attachment-id + $( 'a img[data-attachment-id]' ).each(function() { + var container = $( this ).parent(); + + // skip if image was already added to gallery by shortcode + if( container.parent( '.gallery-icon' ).length ) { + return; + } + + var valid = false; + + // if link points to 'Media File' (ignoring GET parameters) and flag is set allow it + if ( $( container ).attr( 'href' ).split( '?' )[0] === $( this ).attr( 'data-orig-file' ).split( '?' )[0] && + 1 === Number( jetpackCarouselStrings.single_image_gallery_media_file ) + ) { + valid = true; + } + + // if link points to 'Attachment Page' allow it + if( $( container ).attr( 'href' ) === $( this ).attr( 'data-permalink' ) ) { + valid = true; + } + + // links to 'Custom URL' or 'Media File' when flag not set are not valid + if( ! valid ) { + return; + } + + // make this node a gallery recognizable by event listener above + $( container ).addClass( 'single-image-gallery' ) ; + // blog_id is needed to allow posting comments to correct blog + $( container ).data( 'carousel-extra', { blog_id: Number( jetpackCarouselStrings.blog_id ) } ); + }); + }; + var methods = { testForData: function(gallery) { gallery = $( gallery ); // make sure we have it as a jQuery object. @@ -1128,7 +1164,7 @@ jQuery(document).ready(function($) { var $ul = $( '<ul class=\'jp-carousel-image-exif\'></ul>' ); $.each( meta, function( key, val ) { - if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, [ 'camera', 'aperture', 'shutter_speed', 'focal_length' ] ) ) { + if ( 0 === parseFloat(val) || !val.length || -1 === $.inArray( key, $.makeArray( jetpackCarouselStrings.meta_data ) ) ) { return; } @@ -1418,39 +1454,10 @@ jQuery(document).ready(function($) { // handle lightbox (single image gallery) for images linking to 'Attachment Page' if ( 1 === Number( jetpackCarouselStrings.single_image_gallery ) ) { - // process links that contain img tag with attribute data-attachment-id - $( 'a img[data-attachment-id]' ).each(function() { - var container = $( this ).parent(); - - // skip if image was already added to gallery by shortcode - if( container.parent( '.gallery-icon' ).length ) { - return; - } - - var valid = false; - - // if link points to 'Media File' and flag is set allow it - if ( $( container ).attr( 'href' ) === $( this ).attr( 'data-orig-file' ) && - 1 === Number( jetpackCarouselStrings.single_image_gallery_media_file ) - ) { - valid = true; - } - - // if link points to 'Attachment Page' allow it - if( $( container ).attr( 'href' ) === $( this ).attr( 'data-permalink' ) ) { - valid = true; - } - - // links to 'Custom URL' or 'Media File' when flag not set are not valid - if( ! valid ) { - return; - } - - // make this node a gallery recognizable by event listener above - $( container ).addClass( 'single-image-gallery' ) ; - // blog_id is needed to allow posting comments to correct blog - $( container ).data( 'carousel-extra', { blog_id: Number( jetpackCarouselStrings.blog_id ) } ); - }); + processSingleImageGallery(); + $( document.body ).on( 'post-load', function() { + processSingleImageGallery(); + } ); } // Makes carousel work on page load and when back button leads to same URL with carousel hash (ie: no actual document.ready trigger) diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.php b/plugins/jetpack/modules/carousel/jetpack-carousel.php index 27fc5280..012b934c 100644 --- a/plugins/jetpack/modules/carousel/jetpack-carousel.php +++ b/plugins/jetpack/modules/carousel/jetpack-carousel.php @@ -197,7 +197,7 @@ class Jetpack_Carousel { function enqueue_assets() { if ( $this->first_run ) { - wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20160325' ), true ); + wp_enqueue_script( 'jetpack-carousel', plugins_url( 'jetpack-carousel.js', __FILE__ ), array( 'jquery.spin' ), $this->asset_version( '20170209' ), true ); // Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted) // Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context. @@ -231,11 +231,13 @@ class Jetpack_Carousel { 'aperture' => __( 'Aperture', 'jetpack' ), 'shutter_speed' => __( 'Shutter Speed', 'jetpack' ), 'focal_length' => __( 'Focal Length', 'jetpack' ), + 'copyright' => __( 'Copyright', 'jetpack' ), 'comment_registration' => $comment_registration, 'require_name_email' => $require_name_email, /** This action is documented in core/src/wp-includes/link-template.php */ 'login_url' => wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ), 'blog_id' => (int) get_current_blog_id(), + 'meta_data' => array( 'camera', 'aperture', 'shutter_speed', 'focal_length', 'copyright' ) ); if ( ! isset( $localize_strings['jetpack_comments_iframe_src'] ) || empty( $localize_strings['jetpack_comments_iframe_src'] ) ) { diff --git a/plugins/jetpack/modules/comments/comments.php b/plugins/jetpack/modules/comments/comments.php index c66e7571..ab00d491 100644 --- a/plugins/jetpack/modules/comments/comments.php +++ b/plugins/jetpack/modules/comments/comments.php @@ -285,13 +285,37 @@ class Jetpack_Comments extends Highlander_Comments_Base { $url .= '&replytocom=' . (int) $_GET['replytocom']; } + /** + * Filter whether the comment title can be displayed. + * + * @module comments + * + * @since 4.7.0 + * + * @param bool $show Can the comment be displayed? Default to true. + */ + $show_greeting = apply_filters( 'jetpack_comment_form_display_greeting', true ); + // The actual iframe (loads comment form from Jetpack server) ?> <div id="respond" class="comment-respond"> - <h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( esc_html( $params['greeting'] ), esc_html( $params['greeting_reply'] ) ); ?> <small><?php cancel_comment_reply_link( esc_html__( 'Cancel reply' , 'jetpack') ); ?></small></h3> + <?php if ( true === $show_greeting ) : ?> + <h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( esc_html( $params['greeting'] ), esc_html( $params['greeting_reply'] ) ); ?> <small><?php cancel_comment_reply_link( esc_html__( 'Cancel reply' , 'jetpack') ); ?></small></h3> + <?php endif; ?> <form id="commentform" class="comment-form"> - <iframe src="<?php echo esc_url( $url ); ?>" allowtransparency="<?php echo $transparent; ?>" style="width:100%; height: <?php echo $height; ?>px;border:0;" frameBorder="0" scrolling="no" name="jetpack_remote_comment" id="jetpack_remote_comment"></iframe> + <iframe src="<?php echo esc_url( $url ); ?>" style="width:100%; height: <?php echo $height; ?>px; border:0;" name="jetpack_remote_comment" class="jetpack_remote_comment" id="jetpack_remote_comment"></iframe> + <!--[if !IE]><!--> + <script> + document.addEventListener( 'DOMContentLoaded', function () { + var commentForms = document.getElementsByClassName( 'jetpack_remote_comment' ); + for ( var i = 0; i < commentForms.length; i++ ) { + commentForms[i].allowTransparency = <?php echo $transparent; ?>; + commentForms[i].scrolling = 'no'; + } + } ); + </script> + <!--<![endif]--> </form> </div> diff --git a/plugins/jetpack/modules/contact-form/admin.php b/plugins/jetpack/modules/contact-form/admin.php index e0ef1db2..b6667204 100644 --- a/plugins/jetpack/modules/contact-form/admin.php +++ b/plugins/jetpack/modules/contact-form/admin.php @@ -775,7 +775,7 @@ add_action( 'omnisearch_add_providers', 'grunion_omnisearch_add_providers' ); function grunion_omnisearch_add_providers() { // Feedback uses capability_type 'page' if ( current_user_can( 'edit_pages' ) ) { - require_once( GRUNION_PLUGIN_DIR . '/grunion-omnisearch.php' ); + require_once( GRUNION_PLUGIN_DIR . 'grunion-omnisearch.php' ); new Jetpack_Omnisearch_Grunion; } } diff --git a/plugins/jetpack/modules/contact-form/grunion-contact-form.php b/plugins/jetpack/modules/contact-form/grunion-contact-form.php index 85bb231f..5df2a664 100644 --- a/plugins/jetpack/modules/contact-form/grunion-contact-form.php +++ b/plugins/jetpack/modules/contact-form/grunion-contact-form.php @@ -14,12 +14,12 @@ define( 'GRUNION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'GRUNION_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); if ( is_admin() ) { - require_once GRUNION_PLUGIN_DIR . '/admin.php'; + require_once GRUNION_PLUGIN_DIR . 'admin.php'; } add_action( 'rest_api_init', 'grunion_contact_form_require_endpoint' ); function grunion_contact_form_require_endpoint() { - require_once GRUNION_PLUGIN_DIR . '/class-grunion-contact-form-endpoint.php'; + require_once GRUNION_PLUGIN_DIR . 'class-grunion-contact-form-endpoint.php'; } /** @@ -116,7 +116,8 @@ class Grunion_Contact_Form_Plugin { if ( is_admin() ) { add_action( 'admin_init', array( $this, 'download_feedback_as_csv' ) ); add_action( 'admin_footer-edit.php', array( $this, 'export_form' ) ); - add_action( 'current_screen', array( $this, 'unread_count' ) ); + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); + add_action( 'current_screen', array( $this, 'unread_count' ) ); } // custom post type we'll use to keep copies of the feedback items @@ -193,6 +194,20 @@ class Grunion_Contact_Form_Plugin { } /** + * Add the 'Export' menu item as a submenu of Feedback. + */ + public function admin_menu() { + add_submenu_page( + 'edit.php?post_type=feedback', + __( 'Export feedback as CSV', 'jetpack' ), + __( 'Export CSV', 'jetpack' ), + 'export', + 'feedback-export', + array( $this, 'export_form' ) + ); + } + + /** * Add to REST API post type whitelist */ function allow_feedback_rest_api_type( $post_types ) { @@ -566,7 +581,8 @@ class Grunion_Contact_Form_Plugin { * Prints the menu */ function export_form() { - if ( get_current_screen()->id != 'edit-feedback' ) { + $current_screen = get_current_screen(); + if ( ! in_array( $current_screen->id, array( 'edit-feedback', 'feedback_page_feedback-export' ) ) ) { return; } @@ -605,7 +621,9 @@ class Grunion_Contact_Form_Plugin { <script type='text/javascript'> var menu = document.getElementById( 'feedback-export' ), wrapper = document.getElementsByClassName( 'wrap' )[0]; + <?php if ( 'edit-feedback' === $current_screen->id ) : ?> wrapper.appendChild(menu); + <?php endif; ?> menu.style.display = 'block'; </script> <?php @@ -1287,6 +1305,10 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode { $default_to = ''; $default_subject = '[' . get_option( 'blogname' ) . ']'; + if ( ! isset( $attributes ) || ! is_array( $attributes ) ) { + $attributes = array(); + } + if ( ! empty( $attributes['widget'] ) && $attributes['widget'] ) { $default_to .= get_option( 'admin_email' ); $attributes['id'] = 'widget-' . $attributes['widget']; @@ -2040,7 +2062,7 @@ class Grunion_Contact_Form extends Crunion_Contact_Form_Shortcode { 'post_status' => addslashes( $feedback_status ), 'post_parent' => (int) $post->ID, 'post_title' => addslashes( wp_kses( $feedback_title, array() ) ), - 'post_content' => addslashes( wp_kses( $comment_content . "\n<!--more-->\n" . "AUTHOR: {$comment_author}\nAUTHOR EMAIL: {$comment_author_email}\nAUTHOR URL: {$comment_author_url}\nSUBJECT: {$subject}\nIP: {$comment_author_IP}\n" . print_r( $all_values, true ), array() ) ), // so that search will pick up this data + 'post_content' => addslashes( wp_kses( $comment_content . "\n<!--more-->\n" . "AUTHOR: {$comment_author}\nAUTHOR EMAIL: {$comment_author_email}\nAUTHOR URL: {$comment_author_url}\nSUBJECT: {$subject}\nIP: {$comment_author_IP}\n" . @print_r( $all_values, true ), array() ) ), // so that search will pick up this data 'post_name' => $feedback_id, ) ); @@ -2341,18 +2363,21 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode { case 'email' : // Make sure the email address is valid if ( ! is_email( $field_value ) ) { + /* translators: %s is the name of a form field */ $this->add_error( sprintf( __( '%s requires a valid email address', 'jetpack' ), $field_label ) ); } break; case 'checkbox-multiple' : // Check that there is at least one option selected if ( empty( $field_value ) ) { + /* translators: %s is the name of a form field */ $this->add_error( sprintf( __( '%s requires at least one selection', 'jetpack' ), $field_label ) ); } break; default : // Just check for presence of any text if ( ! strlen( trim( $field_value ) ) ) { + /* translators: %s is the name of a form field */ $this->add_error( sprintf( __( '%s is required', 'jetpack' ), $field_label ) ); } } diff --git a/plugins/jetpack/modules/contact-form/js/grunion.js b/plugins/jetpack/modules/contact-form/js/grunion.js index 2f34b594..99631d62 100644 --- a/plugins/jetpack/modules/contact-form/js/grunion.js +++ b/plugins/jetpack/modules/contact-form/js/grunion.js @@ -481,7 +481,7 @@ FB.ContactForm = (function() { } } function validateEmails( emails ) { - // Field is allwed to be empty :) + // Field is allowed to be empty :) if ( 0 === emails.length ) { return true; } diff --git a/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css b/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css index 8702fea9..54a7a9c9 100644 --- a/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css +++ b/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.css @@ -1,5 +1,5 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -@import url("cssparsed.css"); +@import url("modules/custom-css/csstidy/cssparsed.css"); html, body { font:0.8em Verdana,Helvetica,sans-serif; diff --git a/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.min.css b/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.min.css index 768bc447..02da7f4c 100644 --- a/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.min.css +++ b/plugins/jetpack/modules/custom-css/csstidy/cssparse-rtl.min.css @@ -1 +1 @@ -dd,dt{height:1.5em}code#copytext{white-space:pre;font-family:Verdana}.at{color:#00008b}.format{color:gray}.property{color:green}.selector{color:#00f}.value{color:red;left:500px}.comment,dd.Warning{color:orange}body,html{font:.8em Verdana,Helvetica,sans-serif;background:#F8F8F6}dt,p.important{font-weight:700}code{font-size:1.2em}div#rightcol{padding-right:32em}fieldset{display:block;margin:.5em 0;padding:1em;border:2px solid #7284AB}fieldset.code_output{display:inline}input#submit,label.block{display:block}h1{font-size:2em}small{font-size:.7em}fieldset#field_input{float:right;margin:0 0 1em .5em}fieldset#code_layout,fieldset#options{width:31em}input#submit{clear:both;margin:1em}select{margin:2px 0 0}legend{background:#c4E1C3;padding:2px 4px;border:1px dashed}textarea#css_text{width:27em;height:370px;display:block;margin-left:1em}.help{cursor:help}p.important{border:1px solid red;padding:1em;background:#fff}p{margin:1em 0}dl{padding-right:.5em}dt{margin:0;float:right;clear:both}dd{margin:0 4em 0 0}fieldset#messages{background:#fff;padding:0 1em 0 0}fieldset#messages div{height:10em;overflow:auto}dd.Information{color:green}
\ No newline at end of file +code#copytext{white-space:pre;font-family:Verdana}.at{color:#00008b}.format{color:gray}.property{color:green}.selector{color:#00f}.value{color:red;left:500px}.comment{color:orange}body,html{font:.8em Verdana,Helvetica,sans-serif;background:#f8f8f6}code{font-size:1.2em}div#rightcol{padding-right:32em}fieldset{display:block;margin:.5em 0;padding:1em;border:solid #7284ab 2px}fieldset.code_output{display:inline}h1{font-size:2em}small{font-size:.7em}fieldset#field_input{float:right;margin:0 0 1em .5em}fieldset#code_layout,fieldset#options{width:31em}input#submit{clear:both;display:block;margin:1em}select{margin:2px 0 0}label.block{display:block}legend{background:#c4e1c3;padding:2px 4px;border:dashed 1px}textarea#css_text{width:27em;height:370px;display:block;margin-left:1em}.help{cursor:help}p.important{border:solid 1px red;font-weight:700;padding:1em;background:#fff}p{margin:1em 0}dl{padding-right:.5em}dt{font-weight:700;margin:0;float:right;clear:both;height:1.5em}dd{margin:0 4em 0 0;height:1.5em}fieldset#messages{background:#fff;padding:0 1em 0 0}fieldset#messages div{height:10em;overflow:auto}dd.Warning{color:orange}dd.Information{color:green}
\ No newline at end of file diff --git a/plugins/jetpack/modules/custom-css/csstidy/cssparse.css b/plugins/jetpack/modules/custom-css/csstidy/cssparse.css index 38fc40b4..bddd34f9 100644 --- a/plugins/jetpack/modules/custom-css/csstidy/cssparse.css +++ b/plugins/jetpack/modules/custom-css/csstidy/cssparse.css @@ -1,4 +1,4 @@ -@import url("cssparsed.css"); +@import url("modules/custom-css/csstidy/cssparsed.css"); html, body { font:0.8em Verdana,Helvetica,sans-serif; diff --git a/plugins/jetpack/modules/custom-css/csstidy/cssparse.min.css b/plugins/jetpack/modules/custom-css/csstidy/cssparse.min.css index 9a3a8b6d..fa4927e5 100644 --- a/plugins/jetpack/modules/custom-css/csstidy/cssparse.min.css +++ b/plugins/jetpack/modules/custom-css/csstidy/cssparse.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -dd,dt{height:1.5em}code#copytext{white-space:pre;font-family:Verdana}.at{color:#00008b}.format{color:gray}.property{color:green}.selector{color:#00f}.value{color:red;left:500px}.comment,dd.Warning{color:orange}body,html{font:.8em Verdana,Helvetica,sans-serif;background:#F8F8F6}dt,p.important{font-weight:700}code{font-size:1.2em}div#rightcol{padding-left:32em}fieldset{display:block;margin:.5em 0;padding:1em;border:2px solid #7284AB}fieldset.code_output{display:inline}input#submit,label.block{display:block}h1{font-size:2em}small{font-size:.7em}fieldset#field_input{float:left;margin:0 .5em 1em 0}fieldset#code_layout,fieldset#options{width:31em}input#submit{clear:both;margin:1em}select{margin:2px 0 0}legend{background:#c4E1C3;padding:2px 4px;border:1px dashed}textarea#css_text{width:27em;height:370px;display:block;margin-right:1em}.help{cursor:help}p.important{border:1px solid red;padding:1em;background:#fff}p{margin:1em 0}dl{padding-left:.5em}dt{margin:0;float:left;clear:both}dd{margin:0 0 0 4em}fieldset#messages{background:#fff;padding:0 0 0 1em}fieldset#messages div{height:10em;overflow:auto}dd.Information{color:green}
\ No newline at end of file +code#copytext{white-space:pre;font-family:Verdana}.at{color:#00008b}.format{color:gray}.property{color:green}.selector{color:#00f}.value{color:red;left:500px}.comment{color:orange}body,html{font:.8em Verdana,Helvetica,sans-serif;background:#f8f8f6}code{font-size:1.2em}div#rightcol{padding-left:32em}fieldset{display:block;margin:.5em 0;padding:1em;border:solid #7284ab 2px}fieldset.code_output{display:inline}h1{font-size:2em}small{font-size:.7em}fieldset#field_input{float:left;margin:0 .5em 1em 0}fieldset#code_layout,fieldset#options{width:31em}input#submit{clear:both;display:block;margin:1em}select{margin:2px 0 0}label.block{display:block}legend{background:#c4e1c3;padding:2px 4px;border:dashed 1px}textarea#css_text{width:27em;height:370px;display:block;margin-right:1em}.help{cursor:help}p.important{border:solid 1px red;font-weight:700;padding:1em;background:#fff}p{margin:1em 0}dl{padding-left:.5em}dt{font-weight:700;margin:0;float:left;clear:both;height:1.5em}dd{margin:0 0 0 4em;height:1.5em}fieldset#messages{background:#fff;padding:0 0 0 1em}fieldset#messages div{height:10em;overflow:auto}dd.Warning{color:orange}dd.Information{color:green}
\ No newline at end of file diff --git a/plugins/jetpack/modules/custom-css/custom-css-4.7.php b/plugins/jetpack/modules/custom-css/custom-css-4.7.php index 0922b0f2..87a38ff6 100644 --- a/plugins/jetpack/modules/custom-css/custom-css-4.7.php +++ b/plugins/jetpack/modules/custom-css/custom-css-4.7.php @@ -149,6 +149,11 @@ class Jetpack_Custom_CSS_Enhancements { * @return array $fields Modified array to include post_content_filtered. */ public static function _wp_post_revision_fields( $fields, $post ) { + // None of the fields in $post are required to be passed in this filter. + if ( ! isset( $post['post_type'], $post['ID'] ) ) { + return $fields; + } + // If we're passed in a revision, go get the main post instead. if ( 'revision' === $post['post_type'] ) { $main_post_id = wp_is_post_revision( $post['ID'] ); @@ -342,7 +347,7 @@ class Jetpack_Custom_CSS_Enhancements { $content_help = __( 'Set a different content width for full size images.', 'jetpack' ); if ( ! empty( $GLOBALS['content_width'] ) ) { $content_help .= sprintf( - __( ' The default content width for the <strong>%1$s</strong> theme is %2$d pixels.', 'jetpack' ), + _n( ' The default content width for the <strong>%1$s</strong> theme is %2$d pixel.', ' The default content width for the <strong>%1$s</strong> theme is %2$d pixels.', intval( $GLOBALS['content_width'] ), 'jetpack' ), wp_get_theme()->Name, intval( $GLOBALS['content_width'] ) ); diff --git a/plugins/jetpack/modules/custom-css/custom-css.php b/plugins/jetpack/modules/custom-css/custom-css.php index 398f10e8..c8fa4507 100644 --- a/plugins/jetpack/modules/custom-css/custom-css.php +++ b/plugins/jetpack/modules/custom-css/custom-css.php @@ -1044,7 +1044,7 @@ class Jetpack_Custom_CSS { <p> <?php - printf( + printf( /* translators: %1$s is replaced with an input field for numbers. */ __( 'Limit width to %1$s pixels for full size images. (<a href="%2$s" target="_blank">More info</a>.)', 'jetpack' ), '<input type="text" id="custom_content_width_visible" value="' . esc_attr( $custom_content_width ) . '" size="4" />', /** @@ -1070,7 +1070,7 @@ class Jetpack_Custom_CSS { $current_theme = get_current_theme(); ?> - <p><?php printf( __( 'The default content width for the %s theme is %d pixels.', 'jetpack' ), $current_theme, intval( $GLOBALS['content_width'] ) ); ?></p> + <p><?php printf( _n( 'The default content width for the %s theme is %d pixel.', 'The default content width for the %s theme is %d pixels.', intval( $GLOBALS['content_width'] ), 'jetpack' ), $current_theme, intval( $GLOBALS['content_width'] ) ); ?></p> <?php } diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css index 934f4e4e..41563c12 100644 --- a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css +++ b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror-rtl.min.css @@ -1 +1 @@ -.CodeMirror,.CodeMirror-sizer{position:relative}.rtl .CodeMirror{direction:rtl}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-left:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 5px 0 3px;min-width:20px;text-align:left;color:#999}.CodeMirror div.CodeMirror-cursor{border-right:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-right:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-operator,.cm-s-default .cm-property{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{font-family:monospace;height:400px;line-height:1;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-left:-30px;padding-bottom:30px;padding-left:30px;height:100%;outline:0;position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{left:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;right:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{left:0;bottom:0}.CodeMirror-gutter-filler{right:0;bottom:0}.CodeMirror-gutters{position:absolute;right:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-left:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-left:none;width:auto}.CodeMirror-linebackground{position:absolute;right:0;left:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-left:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
\ No newline at end of file +.rtl .CodeMirror{direction:rtl}.CodeMirror{font-family:monospace;height:400px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-left:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 5px 0 3px;min-width:20px;text-align:left;color:#999}.CodeMirror div.CodeMirror-cursor{border-right:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-right:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-left:-30px;padding-bottom:30px;padding-left:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{left:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;right:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{left:0;bottom:0}.CodeMirror-gutter-filler{right:0;bottom:0}.CodeMirror-gutters{position:absolute;right:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-left:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-left:none;width:auto}.CodeMirror-linebackground{position:absolute;right:0;left:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-left:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
\ No newline at end of file diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css index f002d9a9..cdc1b372 100644 --- a/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css +++ b/plugins/jetpack/modules/custom-css/custom-css/css/codemirror.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -.CodeMirror,.CodeMirror-sizer{position:relative}.rtl .CodeMirror{direction:ltr}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-operator,.cm-s-default .cm-property{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{font-family:monospace;height:400px;line-height:1;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:none;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
\ No newline at end of file +.rtl .CodeMirror{direction:ltr}.CodeMirror{font-family:monospace;height:400px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-gutter-filler,.CodeMirror-scrollbar-filler{background-color:#fff}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror div.CodeMirror-cursor{border-left:1px solid #000;z-index:3}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor{width:auto;border:0;background:#7e7;z-index:1}.cm-tab{display:inline-block}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable{color:#000}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3{color:#085}.cm-s-default .cm-property{color:#000}.cm-s-default .cm-operator{color:#000}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-error{color:red}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-header{color:#00f}.cm-s-default .cm-quote{color:#090}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:700}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-invalidchar{color:red}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{line-height:1;position:relative;overflow:hidden;background:#fff;color:#000}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.CodeMirror-gutter-filler,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-vscrollbar{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;padding-bottom:30px;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;padding-bottom:30px;margin-bottom:-32px;display:inline-block;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-code pre{border-right:30px solid transparent;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.CodeMirror-wrap .CodeMirror-code pre{border-right:none;width:auto}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;overflow:auto}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror div.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:none;width:0}.CodeMirror-focused div.CodeMirror-cursor{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.cm-searching{background:#ffa;background:rgba(255,255,0,.4)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror div.CodeMirror-cursor{visibility:hidden}}
\ No newline at end of file diff --git a/plugins/jetpack/modules/custom-css/migrate-to-core.php b/plugins/jetpack/modules/custom-css/migrate-to-core.php index 2f36596e..26108941 100644 --- a/plugins/jetpack/modules/custom-css/migrate-to-core.php +++ b/plugins/jetpack/modules/custom-css/migrate-to-core.php @@ -41,6 +41,11 @@ class Jetpack_Custom_CSS_Data_Migration { $preprocessors = apply_filters( 'jetpack_custom_css_preprocessors', array() ); $core_css_post = wp_get_custom_css_post(); $jetpack_css_post = self::get_post(); + + if ( ! $jetpack_css_post ) { + return; + } + $revisions = self::get_all_revisions(); // Migrate the settings from revision meta to theme mod. @@ -50,7 +55,9 @@ class Jetpack_Custom_CSS_Data_Migration { if ( empty( $revisions ) || ! is_array( $revisions ) ) { if ( $jetpack_css_post instanceof WP_Post ) { // Feed in the raw, if the current setting is Sass/LESS, it'll filter it inside. + kses_remove_filters(); wp_update_custom_css_post( $jetpack_css_post->post_content ); + kses_init(); return 1; } return null; @@ -79,11 +86,12 @@ class Jetpack_Custom_CSS_Data_Migration { $css = call_user_func( $preprocessors[ $preprocessor ]['callback'], $pre ); } - // Do we need to remove any filters here for users without `unfiltered_html` ? + kses_remove_filters(); wp_update_custom_css_post( $css, array( 'stylesheet' => $stylesheet, 'preprocessed' => $pre, ) ); + kses_init(); } // If we've migrated some CSS for the current theme and there was already something there in the Core dataset ... diff --git a/plugins/jetpack/modules/custom-post-types/portfolios.php b/plugins/jetpack/modules/custom-post-types/portfolios.php index 119c7574..a69b206b 100644 --- a/plugins/jetpack/modules/custom-post-types/portfolios.php +++ b/plugins/jetpack/modules/custom-post-types/portfolios.php @@ -124,7 +124,7 @@ class Jetpack_Portfolio { */ function setting_html() { if ( current_theme_supports( self::CUSTOM_POST_TYPE ) ) : ?> - <p><?php printf( __( 'Your theme supports <strong>%s</strong>', 'jetpack' ), self::CUSTOM_POST_TYPE ); ?></p> + <p><?php printf( /* translators: %s is the name of a custom post type such as "jetpack-portfolio" */ __( 'Your theme supports <strong>%s</strong>', 'jetpack' ), self::CUSTOM_POST_TYPE ); ?></p> <?php else : ?> <label for="<?php echo esc_attr( self::OPTION_NAME ); ?>"> <input name="<?php echo esc_attr( self::OPTION_NAME ); ?>" id="<?php echo esc_attr( self::OPTION_NAME ); ?>" <?php echo checked( get_option( self::OPTION_NAME, '0' ), true, false ); ?> type="checkbox" value="1" /> @@ -135,6 +135,7 @@ class Jetpack_Portfolio { if ( get_option( self::OPTION_NAME, '0' ) || current_theme_supports( self::CUSTOM_POST_TYPE ) ) : printf( '<p><label for="%1$s">%2$s</label></p>', esc_attr( self::OPTION_READING_SETTING ), + /* translators: %1$s is replaced with an input field for numbers */ sprintf( __( 'Portfolio pages display at most %1$s projects', 'jetpack' ), sprintf( '<input name="%1$s" id="%1$s" type="number" step="1" min="1" value="%2$s" class="small-text" />', esc_attr( self::OPTION_READING_SETTING ), diff --git a/plugins/jetpack/modules/custom-post-types/testimonial.php b/plugins/jetpack/modules/custom-post-types/testimonial.php index 1fbcd70e..c2006731 100644 --- a/plugins/jetpack/modules/custom-post-types/testimonial.php +++ b/plugins/jetpack/modules/custom-post-types/testimonial.php @@ -164,6 +164,7 @@ class Jetpack_Testimonial { if ( $this->site_supports_custom_post_type() ) : printf( '<p><label for="%1$s">%2$s</label></p>', esc_attr( self::OPTION_READING_SETTING ), + /* translators: %1$s is replaced with an input field for numbers */ sprintf( __( 'Testimonial pages display at most %1$s testimonials', 'jetpack' ), sprintf( '<input name="%1$s" id="%1$s" type="number" step="1" min="1" value="%2$s" class="small-text" />', esc_attr( self::OPTION_READING_SETTING ), diff --git a/plugins/jetpack/modules/google-analytics.php b/plugins/jetpack/modules/google-analytics.php new file mode 100644 index 00000000..ae72ea9a --- /dev/null +++ b/plugins/jetpack/modules/google-analytics.php @@ -0,0 +1,14 @@ +<?php + +/** + * Module Name: Google Analytics + * Module Description: Set up Google Analytics without touching a line of code. + * First Introduced: 4.5 + * Sort Order: 37 + * Requires Connection: Yes + * Auto Activate: No + * Feature: Engagement + * Additional Search Queries: webmaster, google, analytics, console + */ + +include dirname( __FILE__ ) . "/google-analytics/wp-google-analytics.php"; diff --git a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php new file mode 100644 index 00000000..56779f77 --- /dev/null +++ b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php @@ -0,0 +1,169 @@ +<?php +/* + Copyright 2006 Aaron D. Campbell (email : wp_plugins@xavisys.com) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/** + * Jetpack_Google_Analytics is the class that handles ALL of the plugin functionality. + * It helps us avoid name collisions + * http://codex.wordpress.org/Writing_a_Plugin#Avoiding_Function_Name_Collisions + */ +class Jetpack_Google_Analytics { + + /** + * @var Jetpack_Google_Analytics - Static property to hold our singleton instance + */ + static $instance = false; + + /** + * This is our constructor, which is private to force the use of get_instance() + * + * @return void + */ + private function __construct() { + add_action( 'wp_footer', array( $this, 'insert_code' ) ); + } + + /** + * Function to instantiate our class and make it a singleton + */ + public static function get_instance() { + if ( ! self::$instance ) { + self::$instance = new self; + } + + return self::$instance; + } + + /** + * Used to generate a tracking URL + * + * @param array $track - Must have ['data'] and ['code']. + * @return string - Tracking URL + */ + private function _get_url( $track ) { + $site_url = ( is_ssl() ? 'https://':'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ); // Input var okay. + foreach ( $track as $k => $value ) { + if ( strpos( strtolower( $value ), strtolower( $site_url ) ) === 0 ) { + $track[ $k ] = substr( $track[ $k ], strlen( $site_url ) ); + } + if ( 'data' === $k ) { + $track[ $k ] = preg_replace( '/^https?:\/\/|^\/+/i', '', $track[ $k ] ); + } + + // This way we don't lose search data. + if ( 'data' === $k && 'search' === $track['code'] ) { + $track[ $k ] = rawurlencode( $track[ $k ] ); + } else { + $track[ $k ] = preg_replace( '/[^a-z0-9\.\/\+\?=-]+/i', '_', $track[ $k ] ); + } + + $track[ $k ] = trim( $track[ $k ], '_' ); + } + $char = ( strpos( $track['data'], '?' ) === false ) ? '?' : '&'; + return str_replace( "'", "\'", "/{$track['code']}/{$track['data']}{$char}referer=" . rawurlencode( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '' ) ); // Input var okay. + } + + /** + * Maybe output or return, depending on the context + */ + private function _output_or_return( $val, $maybe ) { + if ( $maybe ) { + echo $val . "\r\n"; + } else { + return $val; + } + } + + /** + * This injects the Google Analytics code into the footer of the page. + * + * @param bool[optional] $output - defaults to true, false returns but does NOT echo the code. + */ + public function insert_code( $output = true ) { + // If $output is not a boolean false, set it to true (default). + $output = ( false !== $output); + + $tracking_id = $this->_get_tracking_code(); + if ( empty( $tracking_id ) ) { + return $this->_output_or_return( '<!-- Your Google Analytics Plugin is missing the tracking ID -->', $output ); + } + + // If we're in the admin_area, return without inserting code. + if ( is_admin() ) { + return $this->_output_or_return( '<!-- Your Google Analytics Plugin is set to ignore Admin area -->', $output ); + } + + $custom_vars = array( + "_gaq.push(['_setAccount', '{$tracking_id}']);", + ); + + $track = array(); + if ( is_404() ) { + // This is a 404 and we are supposed to track them. + $custom_vars[] = "_gaq.push( [ '_trackEvent', '404', document.location.href, document.referrer ] );"; + } elseif ( is_search() ) { + // Set track for searches, if it's a search, and we are supposed to. + $track['data'] = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // Input var okay. + $track['code'] = 'search'; + } + + if ( ! empty( $track ) ) { + $track['url'] = $this->_get_url( $track ); + // adjust the code that we output, account for both types of tracking. + $track['url'] = esc_js( str_replace( '&', '&', $track['url'] ) ); + $custom_vars[] = "_gaq.push(['_trackPageview','{$track['url']}']);"; + } else { + $custom_vars[] = "_gaq.push(['_trackPageview']);"; + } + + $async_code = "<!-- Jetpack Google Analytics --> + <script type='text/javascript'> + var _gaq = _gaq || []; + %custom_vars% + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script>"; + + $custom_vars_string = implode( "\r\n", $custom_vars ); + $async_code = str_replace( '%custom_vars%', $custom_vars_string, $async_code ); + + return $this->_output_or_return( $async_code, $output ); + } + + /** + * Used to get the tracking code option + * + * @return tracking code option value. + */ + private function _get_tracking_code() { + $o = get_option( 'jetpack_wga' ); + + if ( isset( $o['code'] ) && preg_match( '#UA-[\d-]+#', $o['code'], $matches ) ) { + return $o['code']; + } + + return ''; + } +} + +global $jetpack_google_analytics; +$jetpack_google_analytics = Jetpack_Google_Analytics::get_instance(); diff --git a/plugins/jetpack/modules/holiday-snow.php b/plugins/jetpack/modules/holiday-snow.php index 5f72877c..6ec0ee8f 100644 --- a/plugins/jetpack/modules/holiday-snow.php +++ b/plugins/jetpack/modules/holiday-snow.php @@ -108,6 +108,19 @@ function jetpack_holiday_snow_option_name() { return apply_filters( 'jetpack_holiday_snow_option_name', 'jetpack_holiday_snow_enabled' ); } +function jetpack_show_holiday_snow_option() { + // Always show snow option if a custom snow season has been set. + if ( has_filter( 'jetpack_is_holiday_snow_season' ) ) { + return true; + } + + $today = time(); + $first_option_day = mktime( 0, 0, 0, 11, 24 ); // Nov 24 + $last_option_day = mktime( 0, 0, 0, 1, 4 ); // Jan 4 + + return ( $today >= $first_option_day || $today < $last_option_day ); +} + function jetpack_is_holiday_snow_season() { $today = time(); $first_snow_day = mktime( 0, 0, 0, 12, 1 ); diff --git a/plugins/jetpack/modules/infinite-scroll.php b/plugins/jetpack/modules/infinite-scroll.php index 3c5d5abf..f60da662 100644 --- a/plugins/jetpack/modules/infinite-scroll.php +++ b/plugins/jetpack/modules/infinite-scroll.php @@ -96,7 +96,7 @@ class Jetpack_Infinite_Scroll_Extras { * @return html */ public function setting_google_analytics() { - echo '<label><input name="infinite_scroll_google_analytics" type="checkbox" value="1" ' . checked( true, (bool) get_option( $this->option_name_google_analytics, false ), false ) . ' /> ' . esc_html__( 'Track each Infinite Scroll post load as a page view in Google Analytics', 'jetpack' ) . '</label>'; + echo '<label><input name="infinite_scroll_google_analytics" type="checkbox" value="1" ' . checked( true, (bool) get_option( $this->option_name_google_analytics, false ), false ) . ' /> ' . esc_html__( 'Track each scroll load (7 posts by default) as a page view in Google Analytics', 'jetpack' ) . '</label>'; echo '<p class="description">' . esc_html__( 'Check the box above to record each new set of posts loaded via Infinite Scroll as a page view in Google Analytics.', 'jetpack' ) . '</p>'; } diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.js b/plugins/jetpack/modules/infinite-scroll/infinity.js index 11001246..687762a0 100644 --- a/plugins/jetpack/modules/infinite-scroll/infinity.js +++ b/plugins/jetpack/modules/infinite-scroll/infinity.js @@ -339,6 +339,8 @@ Scroller.prototype.refresh = function() { if ( response.lastbatch ) { if ( self.click_handle ) { $( '#infinite-handle' ).remove(); + // Update body classes + self.body.addClass( 'infinity-end' ).removeClass( 'infinity-success' ); } else { self.body.trigger( 'infinite-scroll-posts-end' ); } @@ -646,6 +648,8 @@ $( document ).ready( function() { if ( 'object' != typeof infiniteScroll ) return; + $( document.body ).addClass( infiniteScroll.settings.body_class ); + // Set ajaxurl (for brevity) ajaxurl = infiniteScroll.settings.ajaxurl; diff --git a/plugins/jetpack/modules/infinite-scroll/infinity.php b/plugins/jetpack/modules/infinite-scroll/infinity.php index f99ca93f..e9cb166d 100644 --- a/plugins/jetpack/modules/infinite-scroll/infinity.php +++ b/plugins/jetpack/modules/infinite-scroll/infinity.php @@ -300,12 +300,27 @@ class The_Neverending_Home_Page { * Is this guaranteed to be the last batch of posts? */ static function is_last_batch() { - $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' ); + $entries = (int) self::wp_query()->found_posts; + $posts_per_page = self::get_settings()->posts_per_page; + + // This is to cope with an issue in certain themes or setups where posts are returned but found_posts is 0. + if ( 0 == $entries ) { + return (bool) ( count( self::wp_query()->posts ) < $posts_per_page ); + } + $paged = self::wp_query()->get( 'paged' ); + + // Are there enough posts for more than the first page? + if ( $entries <= $posts_per_page ) { + return true; } - return $entries <= self::get_settings()->posts_per_page; + + // Calculate entries left after a certain number of pages + if ( $paged && $paged > 1 ) { + $entries -= $posts_per_page * $paged; + } + + // Are there some entries left to display? + return $entries <= 0; } /** @@ -352,7 +367,7 @@ class The_Neverending_Home_Page { echo '<label>' . $notice . '</label>'; } else { echo '<label><input name="infinite_scroll" type="checkbox" value="1" ' . checked( 1, '' !== get_option( self::$option_name_enabled ), false ) . ' /> ' . esc_html__( 'Check to load posts as you scroll. Uncheck to show clickable button to load posts', 'jetpack' ) . '</label>'; - echo '<p class="description">' . sprintf( esc_html__( 'Shows %s posts on each load.', 'jetpack' ), number_format_i18n( self::get_settings()->posts_per_page ) ) . '</p>'; + echo '<p class="description">' . esc_html( sprintf( _n( 'Shows %s post on each load.', 'Shows %s posts on each load.', self::get_settings()->posts_per_page, 'jetpack' ), number_format_i18n( self::get_settings()->posts_per_page ) ) ) . '</p>'; } } @@ -385,9 +400,6 @@ class The_Neverending_Home_Page { return; } - // Add a class to the body. - add_filter( 'body_class', array( $this, 'body_class' ) ); - // Add our scripts. wp_enqueue_script( 'the-neverending-homepage' ); @@ -411,16 +423,21 @@ class The_Neverending_Home_Page { } /** - * Adds an 'infinite-scroll' class to the body. + * Returns classes to be added to <body>. If it's enabled, 'infinite-scroll'. If set to continuous scroll, adds 'neverending' too. + * + * @since 4.7.0 No longer added as a 'body_class' filter but passed to JS environment and added using JS. + * + * @return string */ - function body_class( $classes ) { + function body_class() { + $classes = ''; // Do not add infinity-scroll class if disabled through the Reading page $disabled = '' === get_option( self::$option_name_enabled ) ? true : false; if ( ! $disabled || 'click' == self::get_settings()->type ) { - $classes[] = 'infinite-scroll'; + $classes = 'infinite-scroll'; if ( 'scroll' == self::get_settings()->type ) - $classes[] = 'neverending'; + $classes .= ' neverending'; } return $classes; @@ -742,6 +759,7 @@ class The_Neverending_Home_Page { } if ( isset( $cpt_text ) ) { + /* translators: %s is the name of a custom post type */ $click_handle_text = sprintf( __( 'Older %s', 'jetpack' ), $cpt_text ); unset( $cpt_text ); } @@ -775,6 +793,7 @@ class The_Neverending_Home_Page { ), 'query_args' => self::get_query_vars(), 'last_post_date' => self::get_last_post_date(), + 'body_class' => self::body_class(), ); // Optional order param @@ -1429,6 +1448,10 @@ class The_Neverending_Home_Page { if ( 'scroll' != self::get_settings()->type || ! self::archive_supports_infinity() ) return; + if ( self::is_last_batch() ) { + return; + } + // Display a footer, either user-specified or a default if ( false !== self::get_settings()->footer_callback && is_callable( self::get_settings()->footer_callback ) ) call_user_func( self::get_settings()->footer_callback, self::get_settings() ); @@ -1448,6 +1471,7 @@ class The_Neverending_Home_Page { __( 'Proudly powered by WordPress', 'jetpack' ) ); $credits .= sprintf( + /* translators: %1$s is the name of a theme */ __( 'Theme: %1$s.', 'jetpack' ), function_exists( 'wp_get_theme' ) ? wp_get_theme()->Name : get_current_theme() ); @@ -1466,7 +1490,7 @@ class The_Neverending_Home_Page { <div id="infinite-footer"> <div class="container"> <div class="blog-info"> - <a id="infinity-blog-title" href="<?php echo home_url( '/' ); ?>" target="_blank" rel="home"> + <a id="infinity-blog-title" href="<?php echo home_url( '/' ); ?>" rel="home"> <?php bloginfo( 'name' ); ?> </a> </div> diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen-rtl.css b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen-rtl.css new file mode 100644 index 00000000..396dfc0d --- /dev/null +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen-rtl.css @@ -0,0 +1,168 @@ +.infinite-scroll .pagination { + display: none; +} + +.infinite-wrap > article:before, +.infinite-wrap > article:after { + content: ""; + display: table; +} + +.infinite-wrap > article:after { + clear: both; +} + +.infinite-wrap > article { + padding-bottom: 2em; +} + +/* Spinner */ +.site-main .infinite-loader { + clear: both; + color: currentColor; + height: 42px; + margin-bottom: 3.5em; +} + +.blog:not(.has-sidebar) .infinite-loader { + width: 100%; +} + +.site-main .infinite-loader .spinner { + right: 50%!important; +} + +/* Click-to-load */ +#infinite-handle { + clear: both; + margin: 0 7.6923% 2em; + text-align: center; +} + +/* Style "Load More" button */ +.site-main #infinite-handle span { + background: #1a1a1a; + border-radius: 2px; + color: #fff; + font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif; + font-size: inherit; + font-weight: 700; + letter-spacing: 0.046875em; + line-height: 1; + padding: 0.84375em 0.875em 0.78125em; + text-transform: uppercase; +} + +#infinite-handle span:hover, +#infinite-handle span:focus { + background: #767676; +} + +/* Style "Load More" button when dark color scheme is used */ +.colors-dark .site-main #infinite-handle span { + background: #f8f8f8; + border-radius: 2px; + color: #222; + font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif; + font-size: inherit; + font-weight: 700; + letter-spacing: 0.046875em; + line-height: 1; + padding: 0.84375em 0.875em 0.78125em; + text-transform: uppercase; +} + +.colors-dark #infinite-handle span:hover, +.colors-dark #infinite-handle span:focus { + background: #bbb; + columns: #222; +} + +/* Style Infinite Footer */ +#infinite-footer { + position: fixed !important; +} + +#infinite-footer .container { + background-color: #fff; + border-color: #d1d1d1; + padding: 0 7.6923%; +} + +#infinite-footer .blog-info, +#infinite-footer .blog-credits { + font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif; + text-align: center; + width: auto; +} + +#infinite-footer .blog-info a, +#infinite-footer .blog-credits, +#infinite-footer .blog-credits a { + color: #222222; +} + +#infinite-footer .blog-info a:hover, +#infinite-footer .blog-info a:focus, +#infinite-footer .blog-credits a:hover, +#infinite-footer .blog-credits a:focus { + color: #767676; + text-decoration: none; +} + +.infinite-scroll #navigation, +.infinite-scroll.neverending .jetpack-mobile-link, +.infinite-scroll.neverending .site-footer { + display: none; +} + +/* Shows the footer & mobile link again in case all posts have been loaded */ +.infinity-end.neverending .jetpack-mobile-link, +.infinity-end.neverending .site-footer { + display: block; +} + +@media screen and (min-width: 44.375em) { + #infinite-handle { + margin: 0 0 1em 0; + text-align: center; + } + + .has-sidebar #infinite-handle { + text-align: right; + } + + .site-main #infinite-handle span { + display: inline-block; + } +} + +@media screen and (min-width: 48em) { + .infinite-wrap > article { + padding-bottom: 4em; + } +} + +@media screen and (min-width: 48em) { + #infinite-footer .blog-info, + #infinite-footer .blog-credits { + line-height: 35px; + } + + #infinite-footer .blog-info { + font-size: 1.1rem; + } + + #infinite-footer .blog-credits { + font-size: 0.9rem; + } + + .blog:not(.has-sidebar) .infinite-loader { + float: left; + width: 58%; + } + + .site-main .infinite-loader .spinner { + margin-right: -17px; + } +} diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.css b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.css new file mode 100644 index 00000000..243cfb70 --- /dev/null +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.css @@ -0,0 +1,168 @@ +.infinite-scroll .pagination { + display: none; +} + +.infinite-wrap > article:before, +.infinite-wrap > article:after { + content: ""; + display: table; +} + +.infinite-wrap > article:after { + clear: both; +} + +.infinite-wrap > article { + padding-bottom: 2em; +} + +/* Spinner */ +.site-main .infinite-loader { + clear: both; + color: currentColor; + height: 42px; + margin-bottom: 3.5em; +} + +.blog:not(.has-sidebar) .infinite-loader { + width: 100%; +} + +.site-main .infinite-loader .spinner { + left: 50%!important; +} + +/* Click-to-load */ +#infinite-handle { + clear: both; + margin: 0 7.6923% 2em; + text-align: center; +} + +/* Style "Load More" button */ +.site-main #infinite-handle span { + background: #1a1a1a; + border-radius: 2px; + color: #fff; + font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif; + font-size: inherit; + font-weight: 700; + letter-spacing: 0.046875em; + line-height: 1; + padding: 0.84375em 0.875em 0.78125em; + text-transform: uppercase; +} + +#infinite-handle span:hover, +#infinite-handle span:focus { + background: #767676; +} + +/* Style "Load More" button when dark color scheme is used */ +.colors-dark .site-main #infinite-handle span { + background: #f8f8f8; + border-radius: 2px; + color: #222; + font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif; + font-size: inherit; + font-weight: 700; + letter-spacing: 0.046875em; + line-height: 1; + padding: 0.84375em 0.875em 0.78125em; + text-transform: uppercase; +} + +.colors-dark #infinite-handle span:hover, +.colors-dark #infinite-handle span:focus { + background: #bbb; + columns: #222; +} + +/* Style Infinite Footer */ +#infinite-footer { + position: fixed !important; +} + +#infinite-footer .container { + background-color: #fff; + border-color: #d1d1d1; + padding: 0 7.6923%; +} + +#infinite-footer .blog-info, +#infinite-footer .blog-credits { + font-family: "Libre Franklin", "Helvetica Neue", helvetica, arial, sans-serif; + text-align: center; + width: auto; +} + +#infinite-footer .blog-info a, +#infinite-footer .blog-credits, +#infinite-footer .blog-credits a { + color: #222222; +} + +#infinite-footer .blog-info a:hover, +#infinite-footer .blog-info a:focus, +#infinite-footer .blog-credits a:hover, +#infinite-footer .blog-credits a:focus { + color: #767676; + text-decoration: none; +} + +.infinite-scroll #navigation, +.infinite-scroll.neverending .jetpack-mobile-link, +.infinite-scroll.neverending .site-footer { + display: none; +} + +/* Shows the footer & mobile link again in case all posts have been loaded */ +.infinity-end.neverending .jetpack-mobile-link, +.infinity-end.neverending .site-footer { + display: block; +} + +@media screen and (min-width: 44.375em) { + #infinite-handle { + margin: 0 0 1em 0; + text-align: center; + } + + .has-sidebar #infinite-handle { + text-align: left; + } + + .site-main #infinite-handle span { + display: inline-block; + } +} + +@media screen and (min-width: 48em) { + .infinite-wrap > article { + padding-bottom: 4em; + } +} + +@media screen and (min-width: 48em) { + #infinite-footer .blog-info, + #infinite-footer .blog-credits { + line-height: 35px; + } + + #infinite-footer .blog-info { + font-size: 1.1rem; + } + + #infinite-footer .blog-credits { + font-size: 0.9rem; + } + + .blog:not(.has-sidebar) .infinite-loader { + float: right; + width: 58%; + } + + .site-main .infinite-loader .spinner { + margin-left: -17px; + } +} diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php new file mode 100644 index 00000000..766b240e --- /dev/null +++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php @@ -0,0 +1,57 @@ +<?php +/** + * Infinite Scroll Theme Assets + * + * Register support for Twenty Seventeen. + */ + +/** + * Add theme support for infinite scroll + */ +function jetpack_twentyseventeen_infinite_scroll_init() { + add_theme_support( 'infinite-scroll', array( + 'container' => 'main', + 'render' => 'jetpack_twentyseventeen_infinite_scroll_render', + 'footer' => 'content', + 'footer_widgets' => jetpack_twentyseventeen_has_footer_widgets(), + ) ); +} +add_action( 'init', 'jetpack_twentyseventeen_infinite_scroll_init' ); + +/** + * Custom render function for Infinite Scroll. + */ +function jetpack_twentyseventeen_infinite_scroll_render() { + while ( have_posts() ) { + the_post(); + if ( is_search() ) { + get_template_part( 'template-parts/post/content', 'search' ); + } else { + get_template_part( 'template-parts/post/content', get_post_format() ); + } + } +} + +/** + * Custom function to check for the presence of footer widgets or the social links menu + */ +function jetpack_twentyseventeen_has_footer_widgets() { + if ( is_active_sidebar( 'sidebar-2' ) || + is_active_sidebar( 'sidebar-3' ) || + has_nav_menu( 'social' ) ) { + return true; + } else { + return false; + } +} + +/** + * Enqueue CSS stylesheet with theme styles for Infinite Scroll. + */ +function jetpack_twentyseventeen_infinite_scroll_enqueue_styles() { + if ( wp_script_is( 'the-neverending-homepage' ) ) { + wp_enqueue_style( 'infinity-twentyseventeen', plugins_url( 'twentyseventeen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20161219' ); + wp_style_add_data( 'infinity-twentyseventeen', 'rtl', 'replace' ); + } +} +add_action( 'wp_enqueue_scripts', 'jetpack_twentyseventeen_infinite_scroll_enqueue_styles', 25 ); diff --git a/plugins/jetpack/modules/likes.php b/plugins/jetpack/modules/likes.php index 464ce1e7..52faccca 100644 --- a/plugins/jetpack/modules/likes.php +++ b/plugins/jetpack/modules/likes.php @@ -760,9 +760,9 @@ class Jetpack_Likes { } function post_likes( $content ) { - global $post; + $post_id = get_the_ID(); - if ( ! $this->is_likes_visible() ) + if ( ! is_numeric( $post_id ) || ! $this->is_likes_visible() ) return $content; if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { @@ -784,9 +784,9 @@ class Jetpack_Likes { */ $uniqid = uniqid(); - $src = sprintf( '//widgets.wp.com/likes/#blog_id=%1$d&post_id=%2$d&origin=%3$s&obj_id=%1$d-%2$d-%4$s', $blog_id, $post->ID, $domain, $uniqid ); - $name = sprintf( 'like-post-frame-%1$d-%2$d-%3$s', $blog_id, $post->ID, $uniqid ); - $wrapper = sprintf( 'like-post-wrapper-%1$d-%2$d-%3$s', $blog_id, $post->ID, $uniqid ); + $src = sprintf( '//widgets.wp.com/likes/#blog_id=%1$d&post_id=%2$d&origin=%3$s&obj_id=%1$d-%2$d-%4$s', $blog_id, $post_id, $domain, $uniqid ); + $name = sprintf( 'like-post-frame-%1$d-%2$d-%3$s', $blog_id, $post_id, $uniqid ); + $wrapper = sprintf( 'like-post-wrapper-%1$d-%2$d-%3$s', $blog_id, $post_id, $uniqid ); $headline = sprintf( /** This filter is already documented in modules/sharedaddy/sharing-service.php */ apply_filters( 'jetpack_sharing_headline_html', '<h3 class="sd-title">%s</h3>', esc_html__( 'Like this:', 'jetpack' ), 'likes' ), @@ -845,9 +845,11 @@ class Jetpack_Likes { } function admin_bar_likes() { - global $wp_admin_bar, $post; + global $wp_admin_bar; - if ( ! $this->is_admin_bar_button_visible() ) { + $post_id = get_the_ID(); + + if ( ! is_numeric( $post_id ) || ! $this->is_admin_bar_button_visible() ) { return; } @@ -868,7 +870,7 @@ class Jetpack_Likes { // make sure to include the scripts before the iframe otherwise weird things happen add_action( 'wp_footer', array( $this, 'likes_master' ), 21 ); - $src = sprintf( '%1$s://widgets.wp.com/likes/#blog_id=%2$d&post_id=%3$d&origin=%1$s://%4$s', $protocol, $blog_id, $post->ID, $domain ); + $src = sprintf( '%1$s://widgets.wp.com/likes/#blog_id=%2$d&post_id=%3$d&origin=%1$s://%4$s', $protocol, $blog_id, $post_id, $domain ); $html = "<iframe class='admin-bar-likes-widget jetpack-likes-widget' scrolling='no' frameBorder='0' name='admin-bar-likes-widget' src='$src'></iframe>"; @@ -914,6 +916,7 @@ class Jetpack_Likes { $likes_locale ); + /* translators: The value of %d is not available at the time of output */ $likersText = wp_kses( __( '<span>%d</span> bloggers like this:', 'jetpack' ), array( 'span' => array() ) ); ?> <iframe src='<?php echo $src; ?>' scrolling='no' id='likes-master' name='likes-master' style='display:none;'></iframe> @@ -979,18 +982,12 @@ class Jetpack_Likes { return false; } - global $post, $wp_current_filter; // Used to apply 'sharing_show' filter + global $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; - if ( version_compare( $wp_version, '4.5-alpha', '<=' ) ) { - $comment_popup = is_comments_popup(); - } - // End 4.5 conditional block. + $post = get_post(); // Never show on feeds or previews - if ( is_feed() || is_preview() || $comment_popup ) { // @todo: Remove $comment_popup when 4.5 is minimum. + if ( is_feed() || is_preview() ) { $enabled = false; // Not a feed or preview, so what is it? @@ -1037,7 +1034,7 @@ class Jetpack_Likes { } } - if( is_object( $post ) ) { + if ( $post instanceof WP_Post ) { // Check that the post is a public, published post. if ( 'attachment' == $post->post_type ) { $post_status = get_post_status( $post->post_parent ); diff --git a/plugins/jetpack/modules/markdown.php b/plugins/jetpack/modules/markdown.php index 247694c8..b173ffb1 100644 --- a/plugins/jetpack/modules/markdown.php +++ b/plugins/jetpack/modules/markdown.php @@ -13,15 +13,3 @@ */ include dirname( __FILE__ ) . '/markdown/easy-markdown.php'; - -// If the module is active, let's make this active for posting, period. -// Comments will still be optional. -add_filter( 'pre_option_' . WPCom_Markdown::POST_OPTION, '__return_true' ); -function jetpack_markdown_posting_always_on() { - // why oh why isn't there a remove_settings_field? - global $wp_settings_fields; - if ( isset( $wp_settings_fields['writing']['default'][ WPCom_Markdown::POST_OPTION ] ) ) { - unset( $wp_settings_fields['writing']['default'][ WPCom_Markdown::POST_OPTION ] ); - } -} -add_action( 'admin_init', 'jetpack_markdown_posting_always_on', 11 ); diff --git a/plugins/jetpack/modules/module-headings.php b/plugins/jetpack/modules/module-headings.php index e742142f..926a68a3 100644 --- a/plugins/jetpack/modules/module-headings.php +++ b/plugins/jetpack/modules/module-headings.php @@ -13,203 +13,208 @@ function jetpack_get_module_i18n( $key ) { if ( ! isset( $modules ) ) { $modules = array(
'after-the-deadline' => array(
- 'name' => _x( 'Spelling and Grammar', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Check your spelling, style, and grammar.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Spelling and Grammar', 'Module Name', 'jetpack' ), + 'description' => _x( 'Check your spelling, style, and grammar.', 'Module Description', 'jetpack' ), ),
'carousel' => array(
- 'name' => _x( 'Carousel', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Display images and galleries in a gorgeous, full-screen browsing experience.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Brings your photos and images to life as full-size, easily navigable galleries.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Carousel', 'Module Name', 'jetpack' ), + 'description' => _x( 'Display images and galleries in a gorgeous, full-screen browsing experience.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Brings your photos and images to life as full-size, easily navigable galleries.', 'Jumpstart Description', 'jetpack' ), ),
'comments' => array(
- 'name' => _x( 'Comments', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Allow comments with WordPress.com, Twitter, Facebook, or Google+.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Comments', 'Module Name', 'jetpack' ), + 'description' => _x( 'Allow comments with WordPress.com, Twitter, Facebook, or Google+.', 'Module Description', 'jetpack' ), ),
'contact-form' => array(
- 'name' => _x( 'Contact Form', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Insert a customizable contact form anywhere on your site.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Adds a button to your post and page editors, allowing you to build simple forms to help visitors stay in touch.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Contact Form', 'Module Name', 'jetpack' ), + 'description' => _x( 'Insert a customizable contact form anywhere on your site.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Adds a button to your post and page editors, allowing you to build simple forms to help visitors stay in touch.', 'Jumpstart Description', 'jetpack' ), ),
'custom-content-types' => array(
- 'name' => _x( 'Custom Content Types', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Organize and display different types of content on your site.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Custom Content Types', 'Module Name', 'jetpack' ), + 'description' => _x( 'Organize and display different types of content on your site.', 'Module Description', 'jetpack' ), ),
'custom-css' => array(
- 'name' => _x( 'Custom CSS', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Tweak your site’s CSS without modifying your theme.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Custom CSS', 'Module Name', 'jetpack' ), + 'description' => _x( 'Tweak your site’s CSS without modifying your theme.', 'Module Description', 'jetpack' ), ),
'enhanced-distribution' => array(
- 'name' => _x( 'Enhanced Distribution', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Increase reach and traffic.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Enhanced Distribution', 'Module Name', 'jetpack' ), + 'description' => _x( 'Increase reach and traffic.', 'Module Description', 'jetpack' ), + ),
+
+ 'google-analytics' => array(
+ 'name' => _x( 'Google Analytics', 'Module Name', 'jetpack' ), + 'description' => _x( 'Set up Google Analytics without touching a line of code.', 'Module Description', 'jetpack' ), ),
'gravatar-hovercards' => array(
- 'name' => _x( 'Gravatar Hovercards', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Enable pop-up business cards over commenters’ Gravatars.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Let commenters link their profiles to their Gravatar accounts, making it easy for your visitors to learn more about your community.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Gravatar Hovercards', 'Module Name', 'jetpack' ), + 'description' => _x( 'Enable pop-up business cards over commenters’ Gravatars.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Let commenters link their profiles to their Gravatar accounts, making it easy for your visitors to learn more about your community.', 'Jumpstart Description', 'jetpack' ), ),
'infinite-scroll' => array(
- 'name' => _x( 'Infinite Scroll', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Automatically load new content when a visitor scrolls.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Infinite Scroll', 'Module Name', 'jetpack' ), + 'description' => _x( 'Automatically load new content when a visitor scrolls.', 'Module Description', 'jetpack' ), ),
'json-api' => array(
- 'name' => _x( 'JSON API', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Allow applications to securely access your content.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'JSON API', 'Module Name', 'jetpack' ), + 'description' => _x( 'Allow applications to securely access your content.', 'Module Description', 'jetpack' ), ),
'latex' => array(
- 'name' => _x( 'Beautiful Math', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Use LaTeX markup for complex equations and other geekery.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Beautiful Math', 'Module Name', 'jetpack' ), + 'description' => _x( 'Use LaTeX markup for complex equations and other geekery.', 'Module Description', 'jetpack' ), ),
'likes' => array(
- 'name' => _x( 'Likes', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Give visitors an easy way to show they appreciate your content.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Likes', 'Module Name', 'jetpack' ), + 'description' => _x( 'Give visitors an easy way to show they appreciate your content.', 'Module Description', 'jetpack' ), ),
'manage' => array(
- 'name' => _x( 'Manage', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Manage all of your sites from a centralized dashboard.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Helps you remotely manage plugins, turn on automated updates, and more from <a href="https://wordpress.com/plugins/" target="_blank">wordpress.com</a>.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Manage', 'Module Name', 'jetpack' ), + 'description' => _x( 'Manage all of your sites from a centralized dashboard.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Helps you remotely manage plugins, turn on automated updates, and more from <a href="https://wordpress.com/plugins/" target="_blank">wordpress.com</a>.', 'Jumpstart Description', 'jetpack' ), ),
'markdown' => array(
- 'name' => _x( 'Markdown', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Write posts or pages in plain-text Markdown syntax.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Markdown', 'Module Name', 'jetpack' ), + 'description' => _x( 'Write posts or pages in plain-text Markdown syntax.', 'Module Description', 'jetpack' ), ),
'minileven' => array(
- 'name' => _x( 'Mobile Theme', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Optimize your site for smartphones and tablets.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Mobile Theme', 'Module Name', 'jetpack' ), + 'description' => _x( 'Optimize your site for smartphones and tablets.', 'Module Description', 'jetpack' ), ),
'monitor' => array(
- 'name' => _x( 'Monitor', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Receive immediate notifications if your site goes down, 24/7.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Monitor', 'Module Name', 'jetpack' ), + 'description' => _x( 'Receive immediate notifications if your site goes down, 24/7.', 'Module Description', 'jetpack' ), ),
'notes' => array(
- 'name' => _x( 'Notifications', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Receive instant notifications of site comments and likes.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Notifications', 'Module Name', 'jetpack' ), + 'description' => _x( 'Receive instant notifications of site comments and likes.', 'Module Description', 'jetpack' ), ),
'omnisearch' => array(
- 'name' => _x( 'Omnisearch', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Search your entire database from a single field in your dashboard.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Omnisearch', 'Module Name', 'jetpack' ), + 'description' => _x( 'Search your entire database from a single field in your dashboard.', 'Module Description', 'jetpack' ), ),
'photon' => array(
- 'name' => _x( 'Photon', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Speed up images and photos.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Photon', 'Module Name', 'jetpack' ), + 'description' => _x( 'Speed up images and photos.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Mirrors and serves your images from our free and fast image CDN, improving your site’s performance with no additional load on your servers.', 'Jumpstart Description', 'jetpack' ), ),
'post-by-email' => array(
- 'name' => _x( 'Post by Email', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Publish posts by sending an email.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Post by Email', 'Module Name', 'jetpack' ), + 'description' => _x( 'Publish posts by sending an email.', 'Module Description', 'jetpack' ), ),
'protect' => array(
- 'name' => _x( 'Protect', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Prevent and block malicious login attempts.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Protect', 'Module Name', 'jetpack' ), + 'description' => _x( 'Prevent and block malicious login attempts.', 'Module Description', 'jetpack' ), ),
'publicize' => array(
- 'name' => _x( 'Publicize', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Automated social marketing.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Publicize', 'Module Name', 'jetpack' ), + 'description' => _x( 'Automated social marketing.', 'Module Description', 'jetpack' ), ),
'related-posts' => array(
- 'name' => _x( 'Related Posts', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Increase page views by showing related content to your visitors.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Keep visitors engaged on your blog by highlighting relevant and new content at the bottom of each published post.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Related Posts', 'Module Name', 'jetpack' ), + 'description' => _x( 'Increase page views by showing related content to your visitors.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Keep visitors engaged on your blog by highlighting relevant and new content at the bottom of each published post.', 'Jumpstart Description', 'jetpack' ), ),
'seo-tools' => array(
- 'name' => _x( 'SEO tools', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Better results on search engines and social media.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Better results on search engines and social media.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'SEO tools', 'Module Name', 'jetpack' ), + 'description' => _x( 'Better results on search engines and social media.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Better results on search engines and social media.', 'Jumpstart Description', 'jetpack' ), ),
'sharedaddy' => array(
- 'name' => _x( 'Sharing', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Allow visitors to share your content.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Twitter, Facebook and Google+ buttons at the bottom of each post, making it easy for visitors to share your content.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Sharing', 'Module Name', 'jetpack' ), + 'description' => _x( 'Allow visitors to share your content.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Twitter, Facebook and Google+ buttons at the bottom of each post, making it easy for visitors to share your content.', 'Jumpstart Description', 'jetpack' ), ),
'shortcodes' => array(
- 'name' => _x( 'Shortcode Embeds', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Embed media from popular sites without any coding.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Shortcode Embeds', 'Module Name', 'jetpack' ), + 'description' => _x( 'Embed media from popular sites without any coding.', 'Module Description', 'jetpack' ), ),
'shortlinks' => array(
- 'name' => _x( 'WP.me Shortlinks', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Create short and simple links for all posts and pages.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'WP.me Shortlinks', 'Module Name', 'jetpack' ), + 'description' => _x( 'Create short and simple links for all posts and pages.', 'Module Description', 'jetpack' ), ),
'sitemaps' => array(
- 'name' => _x( 'Sitemaps', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Make it easy for search engines to find your site.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Sitemaps', 'Module Name', 'jetpack' ), + 'description' => _x( 'Make it easy for search engines to find your site.', 'Module Description', 'jetpack' ), ),
'sso' => array(
- 'name' => _x( 'Single Sign On', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Secure user authentication with WordPress.com.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Lets you log in to all your Jetpack-enabled sites with one click using your WordPress.com account.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Single Sign On', 'Module Name', 'jetpack' ), + 'description' => _x( 'Secure user authentication with WordPress.com.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Lets you log in to all your Jetpack-enabled sites with one click using your WordPress.com account.', 'Jumpstart Description', 'jetpack' ), ),
'stats' => array(
- 'name' => _x( 'Site Stats', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Collect valuable traffic stats and insights.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Site Stats', 'Module Name', 'jetpack' ), + 'description' => _x( 'Collect valuable traffic stats and insights.', 'Module Description', 'jetpack' ), ),
'subscriptions' => array(
- 'name' => _x( 'Subscriptions', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Notify your readers of new posts and comments by email.', 'Module Description', 'jetpack' ),
- 'recommended description' => _x( 'Give visitors two easy subscription options — while commenting, or via a separate email subscription widget you can display.', 'Jumpstart Description', 'jetpack' ),
+ 'name' => _x( 'Subscriptions', 'Module Name', 'jetpack' ), + 'description' => _x( 'Notify your readers of new posts and comments by email.', 'Module Description', 'jetpack' ), + 'recommended description' => _x( 'Give visitors two easy subscription options — while commenting, or via a separate email subscription widget you can display.', 'Jumpstart Description', 'jetpack' ), ),
'tiled-gallery' => array(
- 'name' => _x( 'Tiled Galleries', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Display image galleries in a variety of elegant arrangements.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Tiled Galleries', 'Module Name', 'jetpack' ), + 'description' => _x( 'Display image galleries in a variety of elegant arrangements.', 'Module Description', 'jetpack' ), ),
'vaultpress' => array(
- 'name' => _x( 'Data Backups', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Off-site backups, security scans, and automatic fixes.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Data Backups', 'Module Name', 'jetpack' ), + 'description' => _x( 'Off-site backups, security scans, and automatic fixes.', 'Module Description', 'jetpack' ), ),
'verification-tools' => array(
- 'name' => _x( 'Site Verification', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Establish your site\'s authenticity with external services.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Site Verification', 'Module Name', 'jetpack' ), + 'description' => _x( 'Establish your site\'s authenticity with external services.', 'Module Description', 'jetpack' ), ),
'videopress' => array(
- 'name' => _x( 'VideoPress', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Powerful, simple video hosting for WordPress.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'VideoPress', 'Module Name', 'jetpack' ), + 'description' => _x( 'Powerful, simple video hosting for WordPress.', 'Module Description', 'jetpack' ), ),
'widget-visibility' => array(
- 'name' => _x( 'Widget Visibility', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Control where widgets appear on your site.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Widget Visibility', 'Module Name', 'jetpack' ), + 'description' => _x( 'Control where widgets appear on your site.', 'Module Description', 'jetpack' ), ),
'widgets' => array(
- 'name' => _x( 'Extra Sidebar Widgets', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Add images, Twitter streams, and more to your sidebar.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Extra Sidebar Widgets', 'Module Name', 'jetpack' ), + 'description' => _x( 'Add images, Twitter streams, and more to your sidebar.', 'Module Description', 'jetpack' ), ),
'wordads' => array(
- 'name' => _x( 'Ads', 'Module Name', 'jetpack' ),
- 'description' => _x( 'Earn income by allowing Jetpack to display high quality ads.', 'Module Description', 'jetpack' ),
+ 'name' => _x( 'Ads', 'Module Name', 'jetpack' ), + 'description' => _x( 'Earn income by allowing Jetpack to display high quality ads.', 'Module Description', 'jetpack' ), ),
); }
diff --git a/plugins/jetpack/modules/module-info.php b/plugins/jetpack/modules/module-info.php index 6b7d538a..80af1129 100644 --- a/plugins/jetpack/modules/module-info.php +++ b/plugins/jetpack/modules/module-info.php @@ -641,3 +641,18 @@ function jetpack_wordads_more_info() { } add_action( 'jetpack_module_more_info_wordads', 'jetpack_wordads_more_info' ); // WordAds: STOP + +/** + * Google Analytics + */ +function jetpack_google_analytics_more_link() { + echo 'https://jetpack.com/support/google-analytics'; +} +add_action( 'jetpack_learn_more_button_google-analytics', 'jetpack_google_analytics_more_link' ); + +function jetpack_google_analytics_more_info() { + esc_html_e( + 'Track website statistics with Google Analytics for a deeper understanding of your website visitors and customers.' + , 'jetpack' ); +} +add_action( 'jetpack_module_more_info_google-analytics', 'jetpack_google_analytics_more_info' ); diff --git a/plugins/jetpack/modules/notes.php b/plugins/jetpack/modules/notes.php index 7da43732..b1410084 100644 --- a/plugins/jetpack/modules/notes.php +++ b/plugins/jetpack/modules/notes.php @@ -143,7 +143,7 @@ class Jetpack_Notifications { } if ( class_exists( 'GP_Locales' ) ) { - $wpcom_locale_object = GP_Locales::by_field( 'wp_locale', get_locale() ); + $wpcom_locale_object = GP_Locales::by_field( 'wp_locale', $wpcom_locale ); if ( $wpcom_locale_object instanceof GP_Locale ) { $wpcom_locale = $wpcom_locale_object->slug; } diff --git a/plugins/jetpack/modules/post-by-email.php b/plugins/jetpack/modules/post-by-email.php index 7eafdff3..2b76122d 100644 --- a/plugins/jetpack/modules/post-by-email.php +++ b/plugins/jetpack/modules/post-by-email.php @@ -173,7 +173,7 @@ class Jetpack_Post_By_Email { } /** - * Backend function to abstract the xmlrpc function calls to wpcom. + * Back end function to abstract the xmlrpc function calls to wpcom. * * @param $endpoint * @param $error_message diff --git a/plugins/jetpack/modules/protect.php b/plugins/jetpack/modules/protect.php index 2a6e34eb..c9d9696b 100644 --- a/plugins/jetpack/modules/protect.php +++ b/plugins/jetpack/modules/protect.php @@ -548,7 +548,7 @@ class Jetpack_Protect_Module { * @param string $ip IP flagged by Protect. */ do_action( 'jpp_kill_login', $ip ); - $help_url = 'http://jetpack.com/support/security/'; + $help_url = 'https://jetpack.com/support/security-features/#unblock'; $die_string = sprintf( __( 'Your IP (%1$s) has been flagged for potential security violations. <a href="%2$s">Find out more...</a>', 'jetpack' ), str_replace( 'http://', '', esc_url( 'http://' . $ip ) ), esc_url( $help_url ) ); diff --git a/plugins/jetpack/modules/protect/protect-dashboard-widget-rtl.min.css b/plugins/jetpack/modules/protect/protect-dashboard-widget-rtl.min.css index ae43de69..72993a8d 100644 --- a/plugins/jetpack/modules/protect/protect-dashboard-widget-rtl.min.css +++ b/plugins/jetpack/modules/protect/protect-dashboard-widget-rtl.min.css @@ -1 +1 @@ -#protect_dashboard_widget .inside{margin:0;padding:0;text-align:center}.jetpack-security *{box-sizing:border-box}#protect_dashboard_widget .msg{color:#fff;text-align:center;padding:10px}#protect_dashboard_widget .msg.working{background:#7BAC48}#protect_dashboard_widget .msg.attn{background:#d94f4f}#protect_dashboard_widget .msg a{color:#fff;text-decoration:underline}#protect_dashboard_widget .msg a:hover{text-decoration:none}#protect_dashboard_widget .msg .dashicons{float:left;text-decoration:none;border-radius:2px}#protect_dashboard_widget .msg.working .dashicons{color:#609643}#protect_dashboard_widget .msg.working .dashicons:hover{background:#609643;color:#7BAC48}#protect_dashboard_widget .msg.attn .dashicons{color:#a93838}#protect_dashboard_widget .msg.attn .dashicons:hover{background:#a93838;color:#d94f4f}.blocked-attacks,.file-scanning{position:relative}.blocked-attacks{background:#fafafa;border-bottom:1px #eee solid;padding-bottom:35px}.jetpack-security-sharing{width:60px;display:inline-block;position:absolute;left:0;top:10px}.jetpack-security-sharing a{color:#dcdcdc}.jetpack-security-sharing a:hover{color:#cdcbcb}.blocked-attacks h2,.blocked-attacks h3{color:#7BAC48;font-weight:300}.blocked-attacks h2{font-size:4em;line-height:110%;margin:0;padding:10px 12px}.blocked-attacks h3{font-size:1.1em;line-height:110%;padding:0 12px 10px;margin:0}.jetpack-protect-logo{width:50px;position:relative}.file-scanning{margin-top:-30px;padding:0 12px}
\ No newline at end of file +#protect_dashboard_widget .inside{margin:0;padding:0;text-align:center}.jetpack-security *{box-sizing:border-box}#protect_dashboard_widget .msg{color:#fff;text-align:center;padding:10px}#protect_dashboard_widget .msg.working{background:#7bac48}#protect_dashboard_widget .msg.attn{background:#d94f4f}#protect_dashboard_widget .msg a{color:#fff;text-decoration:underline}#protect_dashboard_widget .msg a:hover{text-decoration:none}#protect_dashboard_widget .msg .dashicons{float:left;text-decoration:none;border-radius:2px}#protect_dashboard_widget .msg.working .dashicons{color:#609643}#protect_dashboard_widget .msg.working .dashicons:hover{background:#609643;color:#7bac48}#protect_dashboard_widget .msg.attn .dashicons{color:#a93838}#protect_dashboard_widget .msg.attn .dashicons:hover{background:#a93838;color:#d94f4f}.blocked-attacks,.file-scanning{position:relative}.blocked-attacks{background:#fafafa;border-bottom:1px #eee solid;padding-bottom:35px}.jetpack-security-sharing{width:60px;display:inline-block;position:absolute;left:0;top:10px}.jetpack-security-sharing a{color:#dcdcdc}.jetpack-security-sharing a:hover{color:#cdcbcb}.blocked-attacks h2,.blocked-attacks h3{color:#7bac48;font-weight:300}.blocked-attacks h2{font-size:4em;line-height:110%;margin:0;padding:10px 12px 10px 12px}.blocked-attacks h3{font-size:1.1em;line-height:110%;padding:0 12px 10px 12px;margin:0}.jetpack-protect-logo{width:50px;position:relative}.file-scanning{margin-top:-30px;padding:0 12px}
\ No newline at end of file diff --git a/plugins/jetpack/modules/protect/protect-dashboard-widget.min.css b/plugins/jetpack/modules/protect/protect-dashboard-widget.min.css index 6da1b6ea..d3b0b996 100644 --- a/plugins/jetpack/modules/protect/protect-dashboard-widget.min.css +++ b/plugins/jetpack/modules/protect/protect-dashboard-widget.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -#protect_dashboard_widget .inside{margin:0;padding:0;text-align:center}.jetpack-security *{box-sizing:border-box}#protect_dashboard_widget .msg{color:#fff;text-align:center;padding:10px}#protect_dashboard_widget .msg.working{background:#7BAC48}#protect_dashboard_widget .msg.attn{background:#d94f4f}#protect_dashboard_widget .msg a{color:#fff;text-decoration:underline}#protect_dashboard_widget .msg a:hover{text-decoration:none}#protect_dashboard_widget .msg .dashicons{float:right;text-decoration:none;border-radius:2px}#protect_dashboard_widget .msg.working .dashicons{color:#609643}#protect_dashboard_widget .msg.working .dashicons:hover{background:#609643;color:#7BAC48}#protect_dashboard_widget .msg.attn .dashicons{color:#a93838}#protect_dashboard_widget .msg.attn .dashicons:hover{background:#a93838;color:#d94f4f}.blocked-attacks,.file-scanning{position:relative}.blocked-attacks{background:#fafafa;border-bottom:1px #eee solid;padding-bottom:35px}.jetpack-security-sharing{width:60px;display:inline-block;position:absolute;right:0;top:10px}.jetpack-security-sharing a{color:#dcdcdc}.jetpack-security-sharing a:hover{color:#cdcbcb}.blocked-attacks h2,.blocked-attacks h3{color:#7BAC48;font-weight:300}.blocked-attacks h2{font-size:4em;line-height:110%;margin:0;padding:10px 12px}.blocked-attacks h3{font-size:1.1em;line-height:110%;padding:0 12px 10px;margin:0}.jetpack-protect-logo{width:50px;position:relative}.file-scanning{margin-top:-30px;padding:0 12px}
\ No newline at end of file +#protect_dashboard_widget .inside{margin:0;padding:0;text-align:center}.jetpack-security *{box-sizing:border-box}#protect_dashboard_widget .msg{color:#fff;text-align:center;padding:10px}#protect_dashboard_widget .msg.working{background:#7bac48}#protect_dashboard_widget .msg.attn{background:#d94f4f}#protect_dashboard_widget .msg a{color:#fff;text-decoration:underline}#protect_dashboard_widget .msg a:hover{text-decoration:none}#protect_dashboard_widget .msg .dashicons{float:right;text-decoration:none;border-radius:2px}#protect_dashboard_widget .msg.working .dashicons{color:#609643}#protect_dashboard_widget .msg.working .dashicons:hover{background:#609643;color:#7bac48}#protect_dashboard_widget .msg.attn .dashicons{color:#a93838}#protect_dashboard_widget .msg.attn .dashicons:hover{background:#a93838;color:#d94f4f}.blocked-attacks,.file-scanning{position:relative}.blocked-attacks{background:#fafafa;border-bottom:1px #eee solid;padding-bottom:35px}.jetpack-security-sharing{width:60px;display:inline-block;position:absolute;right:0;top:10px}.jetpack-security-sharing a{color:#dcdcdc}.jetpack-security-sharing a:hover{color:#cdcbcb}.blocked-attacks h2,.blocked-attacks h3{color:#7bac48;font-weight:300}.blocked-attacks h2{font-size:4em;line-height:110%;margin:0;padding:10px 12px 10px 12px}.blocked-attacks h3{font-size:1.1em;line-height:110%;padding:0 12px 10px 12px;margin:0}.jetpack-protect-logo{width:50px;position:relative}.file-scanning{margin-top:-30px;padding:0 12px}
\ No newline at end of file diff --git a/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css b/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css index cf779bff..6e943b26 100644 --- a/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css +++ b/plugins/jetpack/modules/publicize/assets/publicize-rtl.min.css @@ -1 +1 @@ -div#facebook,div#google_plus,div#linkedin,div#path,div#tumblr,div#twitter{padding-right:42px;padding-top:5px}a.publicize-add-connection:hover,a.publicize-profile-link:hover{color:#f1831e}div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 20px 5px 25px;overflow:hidden;max-width:1200px}span.pub-logos{float:right;display:block;width:130px;height:75px;margin-top:-18px;margin-right:5px;vertical-align:top}.left,.right{width:50%;float:right}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px;border-bottom:1px #eee solid;margin-left:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:left;float:left;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;color:#CCC;cursor:auto;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;overflow-y:visible;position:static;left:auto;text-align:right;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto;border-color:#CCC;border-style:none;border-width:0;list-style:none;margin:0;outline:#CCC 0;padding:0}table#option-fanpage td,table#option-fb-fanpage td,table#option-profile td{vertical-align:middle;font-family:"Lucida Grande",Verdana,Arial,sans-serif}.pub-disconnect-button:hover{color:#f1831e}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name,table#option-profile td.details{font-weight:700;color:#333}table#option-profile{padding-bottom:8px}table#option-profile td.radio,table#option-profile td.thumbnail{padding-left:20px}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-left:10px}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red}
\ No newline at end of file +div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 20px 5px 25px;overflow:hidden;max-width:1200px}span.pub-logos{float:right;display:block;width:130px;height:75px;margin-top:-18px;margin-right:5px;vertical-align:top}.left,.right{width:50%;float:right}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px;padding-right:42px;background-position:0 0;padding-top:5px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-profile-link:hover{color:#f1831e}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}a.publicize-add-connection:hover{color:#f1831e}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px 0;border-bottom:1px #eee solid;margin-left:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:left;float:left;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;border-bottom-color:#ccc;border-bottom-style:none;border-bottom-width:0;border-right-color:#ccc;border-right-style:none;border-right-width:0;border-left-color:#ccc;border-left-style:none;border-left-width:0;border-top-color:#ccc;border-top-style:none;border-top-width:0;color:#ccc;cursor:auto;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;list-style-image:none;list-style-position:outside;list-style-type:none;margin-bottom:0;margin-right:0;margin-left:0;margin-top:0;outline-color:#ccc;outline-style:none;outline-width:0;overflow-y:visible;padding-bottom:0;padding-right:0;padding-left:0;padding-top:0;position:static;left:auto;text-align:right;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto}.pub-disconnect-button:hover{color:#f1831e}table#option-profile{padding-bottom:8px}table#option-profile td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-profile td.radio{padding-left:20px}table#option-profile td.thumbnail{padding-left:20px}table#option-profile td.details{font-weight:700;color:#333}table#option-fanpage td,table#option-fb-fanpage td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px 5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-left:10px}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name{font-weight:700;color:#333}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red}
\ No newline at end of file diff --git a/plugins/jetpack/modules/publicize/assets/publicize.min.css b/plugins/jetpack/modules/publicize/assets/publicize.min.css index b6ca6e3d..675e8ce7 100644 --- a/plugins/jetpack/modules/publicize/assets/publicize.min.css +++ b/plugins/jetpack/modules/publicize/assets/publicize.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -div#facebook,div#google_plus,div#linkedin,div#path,div#tumblr,div#twitter{padding-left:42px;padding-top:5px}a.publicize-add-connection:hover,a.publicize-profile-link:hover{color:#f1831e}div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 25px 5px 20px;overflow:hidden;max-width:1200px}span.pub-logos{float:left;display:block;width:130px;height:75px;margin-top:-18px;margin-left:5px;vertical-align:top}.left,.right{width:50%;float:left}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px;border-bottom:1px #eee solid;margin-right:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:right;float:right;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;color:#CCC;cursor:auto;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;overflow-y:visible;position:static;right:auto;text-align:left;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto;border-color:#CCC;border-style:none;border-width:0;list-style:none;margin:0;outline:#CCC 0;padding:0}table#option-fanpage td,table#option-fb-fanpage td,table#option-profile td{vertical-align:middle;font-family:"Lucida Grande",Verdana,Arial,sans-serif}.pub-disconnect-button:hover{color:#f1831e}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name,table#option-profile td.details{font-weight:700;color:#333}table#option-profile{padding-bottom:8px}table#option-profile td.radio,table#option-profile td.thumbnail{padding-right:20px}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-right:10px}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red}
\ No newline at end of file +div#publicize-services-block{display:block;clear:both;margin-bottom:25px;background-color:#fff;padding:25px 25px 5px 20px;overflow:hidden;max-width:1200px}span.pub-logos{float:left;display:block;width:130px;height:75px;margin-top:-18px;margin-left:5px;vertical-align:top}.left,.right{width:50%;float:left}div#facebook{background:url(publicize-fb-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#twitter{background:url(publicize-twitter-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#linkedin{background:url(publicize-linkedin-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#tumblr{background:url(publicize-tumblr-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#path{background:url(publicize-path-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}div#google_plus{background:url(publicize-google-2x.png) no-repeat;background-size:32px 32px;padding-left:42px;background-position:0 0;padding-top:5px}a.publicize-profile-link,a.publicize-profile-link:visited{text-decoration:none;font-weight:700}a.publicize-profile-link:hover{color:#f1831e}a.publicize-add-connection,a.publicize-add-connection:visited{text-decoration:none}a.publicize-add-connection:hover{color:#f1831e}div.publicize-service-entry{clear:both;margin-bottom:10px;padding:10px 0 25px 0;border-bottom:1px #eee solid;margin-right:40px;overflow:hidden}div.publicize-service-entry:last-of-type{border-width:0}div.publicize-service-left{display:inline-block;width:150px;vertical-align:top;min-height:35px}div.publicize-service-left a{font-size:24px;text-decoration:none}div.publicize-service-left a:hover{text-decoration:underline}div.publicize-service-right{display:inline-block;text-align:right;float:right;padding-top:5px}div.publicize-service-right ul{margin-top:0}div.publicize-service-right li{list-style-type:none;font-size:14px}.pub-disconnect-button{-webkit-border-image:none;border-bottom-color:#ccc;border-bottom-style:none;border-bottom-width:0;border-left-color:#ccc;border-left-style:none;border-left-width:0;border-right-color:#ccc;border-right-style:none;border-right-width:0;border-top-color:#ccc;border-top-style:none;border-top-width:0;color:#ccc;cursor:auto;display:inline;font-size:20px;font-style:normal;font-weight:400;height:auto;line-height:22px;list-style-image:none;list-style-position:outside;list-style-type:none;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;outline-color:#ccc;outline-style:none;outline-width:0;overflow-y:visible;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;position:static;right:auto;text-align:left;text-decoration:none;top:auto;vertical-align:baseline;width:auto;z-index:auto}.pub-disconnect-button:hover{color:#f1831e}table#option-profile{padding-bottom:8px}table#option-profile td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-profile td.radio{padding-right:20px}table#option-profile td.thumbnail{padding-right:20px}table#option-profile td.details{font-weight:700;color:#333}table#option-fanpage td,table#option-fb-fanpage td{font-family:"Lucida Grande",Verdana,Arial,sans-serif;vertical-align:middle}table#option-fanpage td.thumbnail,table#option-fb-fanpage td.thumbnail{padding:5px 20px 5px 20px}table#option-fanpage td.details,table#option-fb-fanpage td.details{width:130px;padding-right:10px}table#option-fanpage td.details span.name,table#option-fb-fanpage td.details span.name{font-weight:700;color:#333}table#option-fanpage td.details span.category,table#option-fb-fanpage td.details span.category{font-size:10px;color:#888}input.fb-options{font-family:"Lucida Grande",Verdana,Arial,sans-serif;font-size:12px}.pub-connection-error{color:red}
\ No newline at end of file diff --git a/plugins/jetpack/modules/publicize/publicize-jetpack.php b/plugins/jetpack/modules/publicize/publicize-jetpack.php index 9b86294a..a7eb0b9f 100644 --- a/plugins/jetpack/modules/publicize/publicize-jetpack.php +++ b/plugins/jetpack/modules/publicize/publicize-jetpack.php @@ -72,6 +72,7 @@ class Publicize extends Publicize_Base { <div class="jetpack-wrap-container"> <div class="jetpack-text-container"> <p><?php printf( + /* translators: %s is the name of the blog */ esc_html( wptexturize( __( "To use Publicize, you'll need to link your %s account to your WordPress.com account using the link below.", 'jetpack' ) ) ), '<strong>' . esc_html( $blog_name ) . '</strong>' ); ?></p> @@ -159,7 +160,11 @@ class Publicize extends Publicize_Base { check_admin_referer( "keyring-request-$service_name", 'nonce' ); $verification = Jetpack::create_nonce( 'publicize' ); + if ( is_wp_error( $verification ) ) { + $url = Jetpack::admin_url( 'jetpack#/settings' ); + wp_die( sprintf( __( "Jetpack is not connected. Please connect Jetpack by visiting <a href='%s'>Settings</a>.", 'jetpack' ), $url ) ); + } $stats_options = get_option( 'stats_options' ); $wpcom_blog_id = Jetpack_Options::get_option( 'id' ); $wpcom_blog_id = ! empty( $wpcom_blog_id ) ? $wpcom_blog_id : $stats_options['blog_id']; @@ -476,7 +481,7 @@ class Publicize extends Publicize_Base { return $flags; } - $connected_services = $this->get_services( 'connected' ); + $connected_services = Jetpack_Options::get_option( 'publicize_connections' ); if ( empty( $connected_services ) ) { return $flags; @@ -537,10 +542,7 @@ class Publicize extends Publicize_Base { ?> <?php if ( ! empty( $me['name'] ) ) : ?> - <p><?php printf( - esc_html__( 'Publicize to my %s:', 'jetpack' ), - '<strong>' . esc_html__( 'Facebook Wall', 'jetpack' ) . '</strong>' - ); ?></p> + <p><?php _e( 'Publicize to my <strong>Facebook Wall</strong>:', 'jetpack' ); ?></p> <table id="option-profile"> <tbody> <tr> @@ -560,10 +562,7 @@ class Publicize extends Publicize_Base { <?php if ( $pages ) : ?> - <p><?php printf( - esc_html__( 'Publicize to my %s:', 'jetpack' ), - '<strong>' . esc_html__( 'Facebook Page', 'jetpack' ) . '</strong>' - ); ?></p> + <p><?php _e( 'Publicize to my <strong>Facebook Page</strong>:', 'jetpack' ); ?></p> <table id="option-fb-fanpage"> <tbody> @@ -694,10 +693,7 @@ class Publicize extends Publicize_Base { } ?> - <p><?php printf( - esc_html__( 'Publicize to my %s:', 'jetpack' ), - '<strong>' . esc_html__( 'Tumblr blog', 'jetpack' ) . '</strong>' - ); ?></p> + <p><?php _e( 'Publicize to my <strong>Tumblr blog</strong>:', 'jetpack' ); ?></p> <ul id="option-tumblr-blog"> diff --git a/plugins/jetpack/modules/publicize/publicize.php b/plugins/jetpack/modules/publicize/publicize.php index 5532cdab..1b807a89 100644 --- a/plugins/jetpack/modules/publicize/publicize.php +++ b/plugins/jetpack/modules/publicize/publicize.php @@ -330,8 +330,8 @@ abstract class Publicize_Base { // Did this request happen via wp-admin? $from_web = isset( $_SERVER['REQUEST_METHOD'] ) && - 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) - && + 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) + && isset( $_POST[$this->ADMIN_PAGE] ); if ( ( $from_web || defined( 'POST_BY_EMAIL' ) ) && isset( $_POST['wpas_title'] ) ) { diff --git a/plugins/jetpack/modules/publicize/ui.php b/plugins/jetpack/modules/publicize/ui.php index edb1a952..839b7463 100644 --- a/plugins/jetpack/modules/publicize/ui.php +++ b/plugins/jetpack/modules/publicize/ui.php @@ -326,7 +326,7 @@ jQuery( function($) { wpasTitle = $('#wpas-title').keyup( function() { var length = wpasTitle.val().length; wpasTitleCounter.text( length ); - if ( wpasTwitterCheckbox && length > 140 ) { + if ( wpasTwitterCheckbox && length > 116 ) { wpasTitleCounter.addClass( 'wpas-twitter-length-limit' ); } else { wpasTitleCounter.removeClass( 'wpas-twitter-length-limit' ); diff --git a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php index a77efe11..b4fa1d67 100644 --- a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php +++ b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php @@ -154,7 +154,8 @@ class Jetpack_RelatedPosts { if ( $options['show_headline'] ) { $headline = sprintf( - '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', + /** This filter is already documented in modules/sharedaddy/sharing-service.php */ + apply_filters( 'jetpack_sharing_headline_html', '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html( $options['headline'] ), 'related-posts' ), esc_html( $options['headline'] ) ); } else { @@ -293,6 +294,16 @@ EOT; return $this->_options; } + + public function get_option( $option_name ) { + $options = $this->get_options(); + + if ( isset( $options[ $option_name ] ) ) { + return $options[ $option_name ]; + } + + return false; + } /** * Parses input and returns normalized options array. @@ -307,7 +318,17 @@ EOT; if ( !is_array( $input ) ) $input = array(); - if ( isset( $input['enabled'] ) && '1' == $input['enabled'] ) { + if ( + ! isset( $input['enabled'] ) + || isset( $input['show_date'] ) + || isset( $input['show_context'] ) + || isset( $input['layout'] ) + || isset( $input['headline'] ) + ) { + $input['enabled'] = '1'; + } + + if ( '1' == $input['enabled'] ) { $current['enabled'] = true; $current['show_headline'] = ( isset( $input['show_headline'] ) && '1' == $input['show_headline'] ); $current['show_thumbnails'] = ( isset( $input['show_thumbnails'] ) && '1' == $input['show_thumbnails'] ); @@ -1383,24 +1404,11 @@ EOT; * @return bool */ protected function _enabled_for_request() { - // Default to enabled - $enabled = true; - - // Must have feature enabled - $options = $this->get_options(); - if ( ! $options['enabled'] ) { - $enabled = false; - } - - // Only run for frontend pages - if ( is_admin() ) { - $enabled = false; - } - - // Only run for standalone posts - if ( ! is_single() ) { - $enabled = false; - } + $enabled = is_single() + && + ! is_admin() + && + ( !$this->_allow_feature_toggle() || $this->get_option( 'enabled' ) ); /** * Filter the Enabled value to allow related posts to be shown on pages as well. diff --git a/plugins/jetpack/modules/sharedaddy/admin-sharing-rtl.min.css b/plugins/jetpack/modules/sharedaddy/admin-sharing-rtl.min.css index 7bf0f95e..0d6d4890 100644 --- a/plugins/jetpack/modules/sharedaddy/admin-sharing-rtl.min.css +++ b/plugins/jetpack/modules/sharedaddy/admin-sharing-rtl.min.css @@ -1 +1 @@ -#services-config{min-width:700px;width:100%;float:right}#services-config h3{font-weight:400;font-size:15px;margin:0;padding:8px 10px;overflow:hidden;white-space:nowrap;color:#464646}#available-services,#enabled-services,#live-preview{padding:20px 0 0;width:100%;border-spacing:0}#enabled-services .ui-sortable{min-height:50px}#enabled-services{padding-bottom:20px}#available-services,#enabled-services{border-bottom:2px solid #ccc}#live-preview{border-bottom:1px solid #dfdfdf;padding-bottom:60px}#available-services h3,#enabled-services h3,#live-preview h3{padding:0;margin-top:0;margin-bottom:1em}body.settings_page_sharing .description{width:180px;vertical-align:top}body.settings_page_sharing .description p{font-size:13px;font-style:italic}body.settings_page_sharing .services{padding:0 20px;vertical-align:top}body.settings_page_sharing .services ul li{float:right;cursor:move}body.settings_page_sharing .services ul li.divider{border:none;padding:0;background:0 0;cursor:default}body.settings_page_sharing ul.services-hidden{margin-bottom:0}#available-services .service,#enabled-services .service{margin-left:10px;padding:5px 5px 5px 10px;border-radius:3px;border:1px solid #bbb;background:center center no-repeat #f8f8f8}#available-services .service:hover,#enabled-services .service:hover{background:#fff;border:1px solid #bbb;box-shadow:0 1px 3px rgba(0,0,0,.2)}li.service span:before{color:#555;display:inline-block;-webkit-font-smoothing:antialiased;font:400 18px/1 social-logos;vertical-align:top;position:relative;top:1px;margin-left:3px;width:16px;height:16px;text-align:center}li.service.share-print span:before{content:'\f469'}li.service.share-digg span:before{content:'\f221'}li.service.share-email span:before{content:'\f410'}li.service.share-linkedin span:before{content:'\f207'}li.service.share-twitter span:before{content:'\f202'}li.service.share-reddit span:before{content:'\f222'}li.service.share-tumblr span:before{content:'\f214'}li.service.share-pocket span:before{content:'\f224'}li.service.share-pinterest span:before{content:'\f209'}li.service.share-google-plus-1 span:before{content:'\f218'}li.service.share-facebook span:before{content:'\f203'}li.service.share-press-this span:before{content:'\f205'}li.service.share-telegram span:before{content:'\f606'}li.service.share-jetpack-whatsapp span:before{content:'\f608'}li.service.share-skype span:before{content:'\f220'}body.settings_page_sharing ul.preview{float:right;margin:0}body.settings_page_sharing ul.preview li.preview-item,body.settings_page_sharing ul.preview li.preview-item a{cursor:default;text-decoration:none}div.sd-social-icon .inner li.preview-item a span,div.sd-social-icon ul.preview li.preview-item a span{display:none}div.sd-social-icon ul.preview li.preview-item.preview-custom a span{display:inline-block}.services .preview li.share-custom a{text-decoration:none}.services ul li.end-fix{clear:both;float:none;visibility:hidden;padding:0;margin:0;height:20px;width:0}#enabled-services h2{font-size:20px;padding-top:0;font-weight:400!important;color:#999}body.settings_page_sharing #live-preview h2{font-size:20px;font-weight:400!important;color:#e3e3e3}body.settings_page_sharing .clearing{clear:both}body.settings_page_sharing .options .options-left{float:right}body.settings_page_sharing .input label{font-size:11px;line-height:16px}body.settings_page_sharing .advanced-form{padding:10px 10px 8px 14px;margin-right:-24px;display:none;border-top:1px #e3e3e3 solid;margin-top:4px}body.settings_page_sharing .utility{float:left;padding-top:10px;padding-left:10px;font-size:10px}body.settings_page_sharing .advanced input[type=submit]{float:right;margin-top:10px;margin-left:10px}.services li.dropzone{border:1px dashed #999;border-radius:3px;background:#e3e3e3;margin-left:10px;padding:5px;height:18px}.advanced-form .form-table th{width:auto!important}.advanced-form .button-secondary{margin-top:0!important}#hidden-drop-target{background:#e1e1e1;border:1px solid #cdcdcd;width:29%;padding:10px;vertical-align:top}#hidden-drop-target p{font-size:13px;font-style:italic;margin:0 0 10px}.preview li.preview-item{background-position:0 5px;cursor:default}.preview .option-smart-on{margin:3px 0 0 5px}.preview-digg .option-smart-on{background:url(images/smart-digg.png) top left no-repeat;background-size:76px 17px;width:76px;height:17px;margin-top:2px}.preview-reddit .option-smart-on{background:url(images/smart-reddit.png) top left no-repeat;background-size:104px 21px;width:104px;height:21px}.preview-facebook .option-smart-on{background:url(images/smart-like.png) top left no-repeat;background-size:85px 20px;width:85px;height:20px}.preview-twitter .option-smart-on{background:url(images/smart-twitter.png?1) top left no-repeat;background-size:60px 20px;width:60px;height:20px}.preview-linkedin .option-smart-on{background:url(images/linkedin-smart.png) top center no-repeat;background-size:99px 18px;width:99px;height:20px}.preview-google-plus-1 .option-smart-on{background:url(images/smart-googleplus1.png) top left no-repeat;background-size:96px 20px;width:96px;height:20px}.preview-tumblr .option-smart-on{background:url(images/smart-tumblr.png) top left no-repeat;background-size:62px 20px;width:62px;height:20px}.preview-pinterest .option-smart-on{background:url(images/smart-pinterest.png) top left no-repeat;background-size:39px 20px;width:39px;height:20px}.preview-pocket .option-smart-on{background:url(images/smart-pocket.png) top left no-repeat;background-size:60px 20px;width:60px;height:20px}.preview-skype .option-smart-on{background:url(images/smart-skype.png) top left no-repeat;background-size:60px 20px;width:60px;height:20px}@media (-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.preview-digg .option-smart-on{background-image:url(images/smart-digg@2x.png)}.preview-reddit .option-smart-on{background-image:url(images/smart-reddit@2x.png)}.preview-facebook .option-smart-on{background-image:url(images/smart-like@2x.png)}.preview-twitter .option-smart-on{background-image:url(images/smart-twitter@2x.png?1)}.preview-linkedin .option-smart-on{background-image:url(images/linkedin-smart@2x.png)}.preview-google-plus-1 .option-smart-on{background-image:url(images/smart-googleplus1@2x.png)}.preview-tumblr .option-smart-on{background-image:url(images/smart-tumblr@2x.png)}.preview-pinterest .option-smart-on{background-image:url(images/smart-pinterest@2x.png)}.preview-pocket .option-smart-on{background-image:url(images/smart-pocket@2x.png)}.preview-skype .option-smart-on{background-image:url(images/smart-skype@2x.png)}}.services .sharing-hidden li{background-color:transparent}.sharing-hidden li.share-end{clear:both;height:0;padding:0!important;margin:0!important;width:0;visibility:hidden;float:none}.preview .sharing-label{font-weight:700;border:0;padding:4px 0 0 6px}#services-config a.remove{background:#ddd;color:#fff;padding:0 4px 2px;border-radius:15px;-moz-border-radius:15px;-webkit-border-radius:15px;text-decoration:none;font-weight:700;font-size:10px}#services-config a.remove:hover{background:red}.sd-social-icon .inner a.sd-button span,.sd-social-icon .inner a.share-icon span{display:inline-block;overflow:hidden;width:0;text-indent:100%}
\ No newline at end of file +#services-config{min-width:700px;width:100%;float:right}#services-config h3{font-weight:400;font-size:15px;margin:0;padding:8px 10px;overflow:hidden;white-space:nowrap;color:#464646}#available-services,#enabled-services,#live-preview{padding:0;width:100%;padding-top:20px;border-spacing:0}#enabled-services .ui-sortable{min-height:50px}#enabled-services{padding-bottom:20px}#available-services,#enabled-services{border-bottom:2px solid #ccc}#live-preview{border-bottom:1px solid #dfdfdf;padding-bottom:60px}#available-services h3,#enabled-services h3,#live-preview h3{padding:0;margin-top:0;margin-bottom:1em}body.settings_page_sharing .description{width:180px;vertical-align:top}body.settings_page_sharing .description p{font-size:13px;font-style:italic}body.settings_page_sharing .services{padding:0 20px;vertical-align:top}body.settings_page_sharing .services ul li{float:right;cursor:move}body.settings_page_sharing .services ul li.divider{border:none;padding:0;background:0 0;cursor:default}body.settings_page_sharing ul.services-hidden{margin-bottom:0}#available-services .service,#enabled-services .service{margin-left:10px;padding:5px 5px 5px 10px;border-radius:3px;border:1px solid #bbb;background:#f8f8f8;background-repeat:no-repeat;background-position:center center}#available-services .service:hover,#enabled-services .service:hover{background:#fff;border:1px solid #bbb;box-shadow:0 1px 3px rgba(0,0,0,.2)}li.service span:before{color:#555;display:inline-block;-webkit-font-smoothing:antialiased;font:400 18px/1 social-logos;vertical-align:top;position:relative;top:1px;margin-left:3px;width:16px;height:16px;text-align:center}li.service.share-print span:before{content:'\f469'}li.service.share-digg span:before{content:'\f221'}li.service.share-email span:before{content:'\f410'}li.service.share-linkedin span:before{content:'\f207'}li.service.share-twitter span:before{content:'\f202'}li.service.share-reddit span:before{content:'\f222'}li.service.share-tumblr span:before{content:'\f214'}li.service.share-pocket span:before{content:'\f224'}li.service.share-pinterest span:before{content:'\f209'}li.service.share-google-plus-1 span:before{content:'\f218'}li.service.share-facebook span:before{content:'\f203'}li.service.share-press-this span:before{content:'\f205'}li.service.share-telegram span:before{content:'\f606'}li.service.share-jetpack-whatsapp span:before{content:'\f608'}li.service.share-skype span:before{content:'\f220'}body.settings_page_sharing ul.preview{float:right;margin:0}body.settings_page_sharing ul.preview li.preview-item,body.settings_page_sharing ul.preview li.preview-item a{cursor:default;text-decoration:none}div.sd-social-icon .inner li.preview-item a span,div.sd-social-icon ul.preview li.preview-item a span{display:none}div.sd-social-icon ul.preview li.preview-item.preview-custom a span{display:inline-block}.services .preview li.share-custom a{text-decoration:none}.services ul li.end-fix{clear:both;float:none;visibility:hidden;padding:0;margin:0;height:20px;width:0}#enabled-services h2{font-size:20px;padding-top:0;font-weight:400!important;color:#999}body.settings_page_sharing #live-preview h2{font-size:20px;font-weight:400!important;color:#e3e3e3}body.settings_page_sharing .clearing{clear:both}body.settings_page_sharing .options .options-left{float:right}body.settings_page_sharing .input label{font-size:11px;line-height:16px}body.settings_page_sharing .advanced-form{padding:10px 10px 8px 14px;margin-right:-24px;display:none;border-top:1px #e3e3e3 solid;margin-top:4px}body.settings_page_sharing .utility{float:left;padding-top:10px;padding-left:10px;font-size:10px}body.settings_page_sharing .advanced input[type=submit]{float:right;margin-top:10px;margin-left:10px}.services li.dropzone{border:1px dashed #999;border-radius:3px;background:#e3e3e3;margin-left:10px;padding:5px;height:18px}.advanced-form .form-table th{width:auto!important}.advanced-form .button-secondary{margin-top:0!important}#hidden-drop-target{background:#e1e1e1;border:1px solid #cdcdcd;width:29%;padding:10px;vertical-align:top}#hidden-drop-target p{font-size:13px;font-style:italic;margin:0 0 10px 0}.preview li.preview-item{background-position:0 5px;cursor:default}.preview .option-smart-on{margin:3px 0 0 5px}.preview-digg .option-smart-on{background:url(images/smart-digg.png) no-repeat top left;background-size:76px 17px;width:76px;height:17px;margin-top:2px}.preview-reddit .option-smart-on{background:url(images/smart-reddit.png) no-repeat top left;background-size:104px 21px;width:104px;height:21px}.preview-facebook .option-smart-on{background:url(images/smart-like.png) no-repeat top left;background-size:85px 20px;width:85px;height:20px}.preview-twitter .option-smart-on{background:url(images/smart-twitter.png?1) no-repeat top left;background-size:60px 20px;width:60px;height:20px}.preview-linkedin .option-smart-on{background:url(images/linkedin-smart.png) no-repeat top center;background-size:99px 18px;width:99px;height:20px}.preview-google-plus-1 .option-smart-on{background:url(images/smart-googleplus1.png) no-repeat top left;background-size:96px 20px;width:96px;height:20px}.preview-tumblr .option-smart-on{background:url(images/smart-tumblr.png) no-repeat top left;background-size:62px 20px;width:62px;height:20px}.preview-pinterest .option-smart-on{background:url(images/smart-pinterest.png) no-repeat top left;background-size:39px 20px;width:39px;height:20px}.preview-pocket .option-smart-on{background:url(images/smart-pocket.png) no-repeat top left;background-size:60px 20px;width:60px;height:20px}.preview-skype .option-smart-on{background:url(images/smart-skype.png) no-repeat top left;background-size:60px 20px;width:60px;height:20px}@media (-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.preview-digg .option-smart-on{background-image:url(images/smart-digg@2x.png)}.preview-reddit .option-smart-on{background-image:url(images/smart-reddit@2x.png)}.preview-facebook .option-smart-on{background-image:url(images/smart-like@2x.png)}.preview-twitter .option-smart-on{background-image:url(images/smart-twitter@2x.png?1)}.preview-linkedin .option-smart-on{background-image:url(images/linkedin-smart@2x.png)}.preview-google-plus-1 .option-smart-on{background-image:url(images/smart-googleplus1@2x.png)}.preview-tumblr .option-smart-on{background-image:url(images/smart-tumblr@2x.png)}.preview-pinterest .option-smart-on{background-image:url(images/smart-pinterest@2x.png)}.preview-pocket .option-smart-on{background-image:url(images/smart-pocket@2x.png)}.preview-skype .option-smart-on{background-image:url(images/smart-skype@2x.png)}}.services .sharing-hidden li{background-color:transparent}.sharing-hidden li.share-end{clear:both;height:0;padding:0!important;margin:0!important;width:0;visibility:hidden;float:none}.preview .sharing-label{font-weight:700;border:0;padding:4px 0 0 6px}#services-config a.remove{background:#ddd;color:#fff;padding:0 4px 2px;border-radius:15px;-moz-border-radius:15px;-webkit-border-radius:15px;text-decoration:none;font-weight:700;font-size:10px}#services-config a.remove:hover{background:red}.sd-social-icon .inner a.sd-button span,.sd-social-icon .inner a.share-icon span{display:inline-block;overflow:hidden;width:0;text-indent:100%}
\ No newline at end of file diff --git a/plugins/jetpack/modules/sharedaddy/admin-sharing.js b/plugins/jetpack/modules/sharedaddy/admin-sharing.js index 831c96a2..f546c7fb 100644 --- a/plugins/jetpack/modules/sharedaddy/admin-sharing.js +++ b/plugins/jetpack/modules/sharedaddy/admin-sharing.js @@ -402,7 +402,7 @@ $( '#new-service-form input[type=submit]' ).prop( 'disabled', false ); } else { - document.location = document.location.href.replace( /&create_new_service=true/i, '' ); + document.location.reload(); } } } diff --git a/plugins/jetpack/modules/sharedaddy/admin-sharing.min.css b/plugins/jetpack/modules/sharedaddy/admin-sharing.min.css index 2fb650a1..5283ec21 100644 --- a/plugins/jetpack/modules/sharedaddy/admin-sharing.min.css +++ b/plugins/jetpack/modules/sharedaddy/admin-sharing.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -#services-config{min-width:700px;width:100%;float:left}#services-config h3{font-weight:400;font-size:15px;margin:0;padding:8px 10px;overflow:hidden;white-space:nowrap;color:#464646}#available-services,#enabled-services,#live-preview{padding:20px 0 0;width:100%;border-spacing:0}#enabled-services .ui-sortable{min-height:50px}#enabled-services{padding-bottom:20px}#available-services,#enabled-services{border-bottom:2px solid #ccc}#live-preview{border-bottom:1px solid #dfdfdf;padding-bottom:60px}#available-services h3,#enabled-services h3,#live-preview h3{padding:0;margin-top:0;margin-bottom:1em}body.settings_page_sharing .description{width:180px;vertical-align:top}body.settings_page_sharing .description p{font-size:13px;font-style:italic}body.settings_page_sharing .services{padding:0 20px;vertical-align:top}body.settings_page_sharing .services ul li{float:left;cursor:move}body.settings_page_sharing .services ul li.divider{border:none;padding:0;background:0 0;cursor:default}body.settings_page_sharing ul.services-hidden{margin-bottom:0}#available-services .service,#enabled-services .service{margin-right:10px;padding:5px 10px 5px 5px;border-radius:3px;border:1px solid #bbb;background:center center no-repeat #f8f8f8}#available-services .service:hover,#enabled-services .service:hover{background:#fff;border:1px solid #bbb;box-shadow:0 1px 3px rgba(0,0,0,.2)}li.service span:before{color:#555;display:inline-block;-webkit-font-smoothing:antialiased;font:400 18px/1 social-logos;vertical-align:top;position:relative;top:1px;margin-right:3px;width:16px;height:16px;text-align:center}li.service.share-print span:before{content:'\f469'}li.service.share-digg span:before{content:'\f221'}li.service.share-email span:before{content:'\f410'}li.service.share-linkedin span:before{content:'\f207'}li.service.share-twitter span:before{content:'\f202'}li.service.share-reddit span:before{content:'\f222'}li.service.share-tumblr span:before{content:'\f214'}li.service.share-pocket span:before{content:'\f224'}li.service.share-pinterest span:before{content:'\f209'}li.service.share-google-plus-1 span:before{content:'\f218'}li.service.share-facebook span:before{content:'\f203'}li.service.share-press-this span:before{content:'\f205'}li.service.share-telegram span:before{content:'\f606'}li.service.share-jetpack-whatsapp span:before{content:'\f608'}li.service.share-skype span:before{content:'\f220'}body.settings_page_sharing ul.preview{float:left;margin:0}body.settings_page_sharing ul.preview li.preview-item,body.settings_page_sharing ul.preview li.preview-item a{cursor:default;text-decoration:none}div.sd-social-icon .inner li.preview-item a span,div.sd-social-icon ul.preview li.preview-item a span{display:none}div.sd-social-icon ul.preview li.preview-item.preview-custom a span{display:inline-block}.services .preview li.share-custom a{text-decoration:none}.services ul li.end-fix{clear:both;float:none;visibility:hidden;padding:0;margin:0;height:20px;width:0}#enabled-services h2{font-size:20px;padding-top:0;font-weight:400!important;color:#999}body.settings_page_sharing #live-preview h2{font-size:20px;font-weight:400!important;color:#e3e3e3}body.settings_page_sharing .clearing{clear:both}body.settings_page_sharing .options .options-left{float:left}body.settings_page_sharing .input label{font-size:11px;line-height:16px}body.settings_page_sharing .advanced-form{padding:10px 14px 8px 10px;margin-left:-24px;display:none;border-top:1px #e3e3e3 solid;margin-top:4px}body.settings_page_sharing .utility{float:right;padding-top:10px;padding-right:10px;font-size:10px}body.settings_page_sharing .advanced input[type=submit]{float:left;margin-top:10px;margin-right:10px}.services li.dropzone{border:1px dashed #999;border-radius:3px;background:#e3e3e3;margin-right:10px;padding:5px;height:18px}.advanced-form .form-table th{width:auto!important}.advanced-form .button-secondary{margin-top:0!important}#hidden-drop-target{background:#e1e1e1;border:1px solid #cdcdcd;width:29%;padding:10px;vertical-align:top}#hidden-drop-target p{font-size:13px;font-style:italic;margin:0 0 10px}.preview li.preview-item{background-position:0 5px;cursor:default}.preview .option-smart-on{margin:3px 5px 0 0}.preview-digg .option-smart-on{background:url(images/smart-digg.png) top left no-repeat;background-size:76px 17px;width:76px;height:17px;margin-top:2px}.preview-reddit .option-smart-on{background:url(images/smart-reddit.png) top left no-repeat;background-size:104px 21px;width:104px;height:21px}.preview-facebook .option-smart-on{background:url(images/smart-like.png) top left no-repeat;background-size:85px 20px;width:85px;height:20px}.preview-twitter .option-smart-on{background:url(images/smart-twitter.png?1) top left no-repeat;background-size:60px 20px;width:60px;height:20px}.preview-linkedin .option-smart-on{background:url(images/linkedin-smart.png) top center no-repeat;background-size:99px 18px;width:99px;height:20px}.preview-google-plus-1 .option-smart-on{background:url(images/smart-googleplus1.png) top left no-repeat;background-size:96px 20px;width:96px;height:20px}.preview-tumblr .option-smart-on{background:url(images/smart-tumblr.png) top left no-repeat;background-size:62px 20px;width:62px;height:20px}.preview-pinterest .option-smart-on{background:url(images/smart-pinterest.png) top left no-repeat;background-size:39px 20px;width:39px;height:20px}.preview-pocket .option-smart-on{background:url(images/smart-pocket.png) top left no-repeat;background-size:60px 20px;width:60px;height:20px}.preview-skype .option-smart-on{background:url(images/smart-skype.png) top left no-repeat;background-size:60px 20px;width:60px;height:20px}@media (-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.preview-digg .option-smart-on{background-image:url(images/smart-digg@2x.png)}.preview-reddit .option-smart-on{background-image:url(images/smart-reddit@2x.png)}.preview-facebook .option-smart-on{background-image:url(images/smart-like@2x.png)}.preview-twitter .option-smart-on{background-image:url(images/smart-twitter@2x.png?1)}.preview-linkedin .option-smart-on{background-image:url(images/linkedin-smart@2x.png)}.preview-google-plus-1 .option-smart-on{background-image:url(images/smart-googleplus1@2x.png)}.preview-tumblr .option-smart-on{background-image:url(images/smart-tumblr@2x.png)}.preview-pinterest .option-smart-on{background-image:url(images/smart-pinterest@2x.png)}.preview-pocket .option-smart-on{background-image:url(images/smart-pocket@2x.png)}.preview-skype .option-smart-on{background-image:url(images/smart-skype@2x.png)}}.services .sharing-hidden li{background-color:transparent}.sharing-hidden li.share-end{clear:both;height:0;padding:0!important;margin:0!important;width:0;visibility:hidden;float:none}.preview .sharing-label{font-weight:700;border:0;padding:4px 6px 0 0}#services-config a.remove{background:#ddd;color:#fff;padding:0 4px 2px;border-radius:15px;-moz-border-radius:15px;-webkit-border-radius:15px;text-decoration:none;font-weight:700;font-size:10px}#services-config a.remove:hover{background:red}.sd-social-icon .inner a.sd-button span,.sd-social-icon .inner a.share-icon span{display:inline-block;overflow:hidden;width:0;text-indent:100%}
\ No newline at end of file +#services-config{min-width:700px;width:100%;float:left}#services-config h3{font-weight:400;font-size:15px;margin:0;padding:8px 10px;overflow:hidden;white-space:nowrap;color:#464646}#available-services,#enabled-services,#live-preview{padding:0;width:100%;padding-top:20px;border-spacing:0}#enabled-services .ui-sortable{min-height:50px}#enabled-services{padding-bottom:20px}#available-services,#enabled-services{border-bottom:2px solid #ccc}#live-preview{border-bottom:1px solid #dfdfdf;padding-bottom:60px}#available-services h3,#enabled-services h3,#live-preview h3{padding:0;margin-top:0;margin-bottom:1em}body.settings_page_sharing .description{width:180px;vertical-align:top}body.settings_page_sharing .description p{font-size:13px;font-style:italic}body.settings_page_sharing .services{padding:0 20px;vertical-align:top}body.settings_page_sharing .services ul li{float:left;cursor:move}body.settings_page_sharing .services ul li.divider{border:none;padding:0;background:0 0;cursor:default}body.settings_page_sharing ul.services-hidden{margin-bottom:0}#available-services .service,#enabled-services .service{margin-right:10px;padding:5px 10px 5px 5px;border-radius:3px;border:1px solid #bbb;background:#f8f8f8;background-repeat:no-repeat;background-position:center center}#available-services .service:hover,#enabled-services .service:hover{background:#fff;border:1px solid #bbb;box-shadow:0 1px 3px rgba(0,0,0,.2)}li.service span:before{color:#555;display:inline-block;-webkit-font-smoothing:antialiased;font:400 18px/1 social-logos;vertical-align:top;position:relative;top:1px;margin-right:3px;width:16px;height:16px;text-align:center}li.service.share-print span:before{content:'\f469'}li.service.share-digg span:before{content:'\f221'}li.service.share-email span:before{content:'\f410'}li.service.share-linkedin span:before{content:'\f207'}li.service.share-twitter span:before{content:'\f202'}li.service.share-reddit span:before{content:'\f222'}li.service.share-tumblr span:before{content:'\f214'}li.service.share-pocket span:before{content:'\f224'}li.service.share-pinterest span:before{content:'\f209'}li.service.share-google-plus-1 span:before{content:'\f218'}li.service.share-facebook span:before{content:'\f203'}li.service.share-press-this span:before{content:'\f205'}li.service.share-telegram span:before{content:'\f606'}li.service.share-jetpack-whatsapp span:before{content:'\f608'}li.service.share-skype span:before{content:'\f220'}body.settings_page_sharing ul.preview{float:left;margin:0}body.settings_page_sharing ul.preview li.preview-item,body.settings_page_sharing ul.preview li.preview-item a{cursor:default;text-decoration:none}div.sd-social-icon .inner li.preview-item a span,div.sd-social-icon ul.preview li.preview-item a span{display:none}div.sd-social-icon ul.preview li.preview-item.preview-custom a span{display:inline-block}.services .preview li.share-custom a{text-decoration:none}.services ul li.end-fix{clear:both;float:none;visibility:hidden;padding:0;margin:0;height:20px;width:0}#enabled-services h2{font-size:20px;padding-top:0;font-weight:400!important;color:#999}body.settings_page_sharing #live-preview h2{font-size:20px;font-weight:400!important;color:#e3e3e3}body.settings_page_sharing .clearing{clear:both}body.settings_page_sharing .options .options-left{float:left}body.settings_page_sharing .input label{font-size:11px;line-height:16px}body.settings_page_sharing .advanced-form{padding:10px 14px 8px 10px;margin-left:-24px;display:none;border-top:1px #e3e3e3 solid;margin-top:4px}body.settings_page_sharing .utility{float:right;padding-top:10px;padding-right:10px;font-size:10px}body.settings_page_sharing .advanced input[type=submit]{float:left;margin-top:10px;margin-right:10px}.services li.dropzone{border:1px dashed #999;border-radius:3px;background:#e3e3e3;margin-right:10px;padding:5px;height:18px}.advanced-form .form-table th{width:auto!important}.advanced-form .button-secondary{margin-top:0!important}#hidden-drop-target{background:#e1e1e1;border:1px solid #cdcdcd;width:29%;padding:10px;vertical-align:top}#hidden-drop-target p{font-size:13px;font-style:italic;margin:0 0 10px 0}.preview li.preview-item{background-position:0 5px;cursor:default}.preview .option-smart-on{margin:3px 5px 0 0}.preview-digg .option-smart-on{background:url(images/smart-digg.png) no-repeat top left;background-size:76px 17px;width:76px;height:17px;margin-top:2px}.preview-reddit .option-smart-on{background:url(images/smart-reddit.png) no-repeat top left;background-size:104px 21px;width:104px;height:21px}.preview-facebook .option-smart-on{background:url(images/smart-like.png) no-repeat top left;background-size:85px 20px;width:85px;height:20px}.preview-twitter .option-smart-on{background:url(images/smart-twitter.png?1) no-repeat top left;background-size:60px 20px;width:60px;height:20px}.preview-linkedin .option-smart-on{background:url(images/linkedin-smart.png) no-repeat top center;background-size:99px 18px;width:99px;height:20px}.preview-google-plus-1 .option-smart-on{background:url(images/smart-googleplus1.png) no-repeat top left;background-size:96px 20px;width:96px;height:20px}.preview-tumblr .option-smart-on{background:url(images/smart-tumblr.png) no-repeat top left;background-size:62px 20px;width:62px;height:20px}.preview-pinterest .option-smart-on{background:url(images/smart-pinterest.png) no-repeat top left;background-size:39px 20px;width:39px;height:20px}.preview-pocket .option-smart-on{background:url(images/smart-pocket.png) no-repeat top left;background-size:60px 20px;width:60px;height:20px}.preview-skype .option-smart-on{background:url(images/smart-skype.png) no-repeat top left;background-size:60px 20px;width:60px;height:20px}@media (-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.preview-digg .option-smart-on{background-image:url(images/smart-digg@2x.png)}.preview-reddit .option-smart-on{background-image:url(images/smart-reddit@2x.png)}.preview-facebook .option-smart-on{background-image:url(images/smart-like@2x.png)}.preview-twitter .option-smart-on{background-image:url(images/smart-twitter@2x.png?1)}.preview-linkedin .option-smart-on{background-image:url(images/linkedin-smart@2x.png)}.preview-google-plus-1 .option-smart-on{background-image:url(images/smart-googleplus1@2x.png)}.preview-tumblr .option-smart-on{background-image:url(images/smart-tumblr@2x.png)}.preview-pinterest .option-smart-on{background-image:url(images/smart-pinterest@2x.png)}.preview-pocket .option-smart-on{background-image:url(images/smart-pocket@2x.png)}.preview-skype .option-smart-on{background-image:url(images/smart-skype@2x.png)}}.services .sharing-hidden li{background-color:transparent}.sharing-hidden li.share-end{clear:both;height:0;padding:0!important;margin:0!important;width:0;visibility:hidden;float:none}.preview .sharing-label{font-weight:700;border:0;padding:4px 6px 0 0}#services-config a.remove{background:#ddd;color:#fff;padding:0 4px 2px;border-radius:15px;-moz-border-radius:15px;-webkit-border-radius:15px;text-decoration:none;font-weight:700;font-size:10px}#services-config a.remove:hover{background:red}.sd-social-icon .inner a.sd-button span,.sd-social-icon .inner a.share-icon span{display:inline-block;overflow:hidden;width:0;text-indent:100%}
\ No newline at end of file diff --git a/plugins/jetpack/modules/sharedaddy/sharedaddy.php b/plugins/jetpack/modules/sharedaddy/sharedaddy.php index 83f07e90..8481adff 100644 --- a/plugins/jetpack/modules/sharedaddy/sharedaddy.php +++ b/plugins/jetpack/modules/sharedaddy/sharedaddy.php @@ -25,7 +25,10 @@ function sharing_email_send_post( $data ) { $headers[] = sprintf( 'From: %1$s <%2$s>', $data['name'], $from_email ); $headers[] = sprintf( 'Reply-To: %1$s <%2$s>', $data['name'], $data['source'] ); - wp_mail( $data['target'], '['.__( 'Shared Post', 'jetpack' ).'] '.$data['post']->post_title, $content, $headers ); + // Make sure to pass the title through the normal sharing filters. + $title = $data['sharing_source']->get_share_title( $data['post']->ID ); + + wp_mail( $data['target'], '[' . __( 'Shared Post', 'jetpack' ) . '] ' . $title, $content, $headers ); } @@ -39,7 +42,7 @@ function sharing_email_check_for_spam_via_akismet( $data ) { // Prepare the body_request for akismet $body_request = array( 'blog' => get_option( 'home' ), - 'permalink' => get_permalink( $data['post']->ID ), + 'permalink' => $data['sharing_source']->get_share_url( $data['post']->ID ), 'comment_type' => 'share', 'comment_author' => $data['name'], 'comment_author_email' => $data['source'], @@ -67,8 +70,9 @@ function sharing_email_send_post_content( $data ) { /* translators: included in email when post is shared via email. First item is sender's name. Second is sender's email address. */ $content = sprintf( __( '%1$s (%2$s) thinks you may be interested in the following post:', 'jetpack' ), $data['name'], $data['source'] ); $content .= "\n\n"; - $content .= $data['post']->post_title."\n"; - $content .= get_permalink( $data['post']->ID )."\n"; + // Make sure to pass the title and URL through the normal sharing filters. + $content .= $data['sharing_source']->get_share_title( $data['post']->ID ) . "\n"; + $content .= $data['sharing_source']->get_share_url( $data['post']->ID ) . "\n"; return $content; } diff --git a/plugins/jetpack/modules/sharedaddy/sharing-service.php b/plugins/jetpack/modules/sharedaddy/sharing-service.php index 75a41ad4..f89d8592 100644 --- a/plugins/jetpack/modules/sharedaddy/sharing-service.php +++ b/plugins/jetpack/modules/sharedaddy/sharing-service.php @@ -170,8 +170,15 @@ class Sharing_Service { $enabled = get_option( 'sharing-services' ); $services = $this->get_all_services(); - if ( !is_array( $options ) ) - $options = array( 'global' => $this->get_global_options() ); + /** + * Check if options exist and are well formatted. + * This avoids issues on sites with corrupted options. + * @see https://github.com/Automattic/jetpack/issues/6121 + */ + if ( ! is_array( $options ) || ! isset( $options['button_style'], $options['global'] ) ) { + $global_options = $this->get_global_options(); + $options = array_merge( is_array( $options ) ? $options : array(), $global_options ); + } $global = $options['global']; @@ -541,7 +548,9 @@ function sharing_add_footer() { ); wp_localize_script( 'sharing-js', 'sharing_js_options', $sharing_js_options); } +} +function sharing_add_footer_scripts_inline() { $sharer = new Sharing_Service(); $enabled = $sharer->get_blog_services(); foreach ( array_merge( $enabled['visible'], $enabled['hidden'] ) AS $service ) { @@ -691,7 +700,7 @@ function sharing_display( $text = '', $echo = false ) { /** * Filter the sharing buttons' headline structure. * - * @module sharing + * @module sharedaddy * * @since 4.4.0 * @@ -767,7 +776,12 @@ function sharing_display( $text = '', $echo = false ) { $ver = '20141212'; } wp_register_script( 'sharing-js', plugin_dir_url( __FILE__ ).'sharing.js', array( 'jquery' ), $ver ); + + // Enqueue scripts for the footer add_action( 'wp_footer', 'sharing_add_footer' ); + + // Print inline scripts that depend on jQuery + add_action( 'wp_footer', 'sharing_add_footer_scripts_inline', 25 ); } } diff --git a/plugins/jetpack/modules/sharedaddy/sharing-sources.php b/plugins/jetpack/modules/sharedaddy/sharing-sources.php index ec87639d..98c49a3e 100644 --- a/plugins/jetpack/modules/sharedaddy/sharing-sources.php +++ b/plugins/jetpack/modules/sharedaddy/sharing-sources.php @@ -426,10 +426,11 @@ class Share_Email extends Sharing_Source { */ if ( apply_filters( 'sharing_email_check', true, $post, $post_data ) ) { $data = array( - 'post' => $post, - 'source' => $source_email, - 'target' => $target_email, - 'name' => $source_name, + 'post' => $post, + 'source' => $source_email, + 'target' => $target_email, + 'name' => $source_name, + 'sharing_source' => $this, ); // todo: implement an error message when email doesn't get sent. /** @@ -514,7 +515,7 @@ class Share_Email extends Sharing_Source { <input type="email" name="source_email" id="source_email" value="" /> <?php endif; ?> - <input type="text" id="jetpack-source_f_name" name="source_f_name" class="input" value="" size="25" autocomplete="off" /> + <input type="text" id="jetpack-source_f_name" name="source_f_name" class="input" value="" size="25" autocomplete="off" title="<?php esc_attr_e( 'This field is for validation and should not be changed', 'jetpack' ); ?>" /> <script>jQuery( document ).ready( function(){ document.getElementById('jetpack-source_f_name').value = '' });</script> <?php /** diff --git a/plugins/jetpack/modules/sharedaddy/sharing.css b/plugins/jetpack/modules/sharedaddy/sharing.css index ab8f6592..898b75bf 100644 --- a/plugins/jetpack/modules/sharedaddy/sharing.css +++ b/plugins/jetpack/modules/sharedaddy/sharing.css @@ -184,6 +184,8 @@ body.highlander-dark h3.sd-title:before { margin: 0 5px 5px 0; padding: 0; } +/* Add more pading on touch devices */ +.jp-sharing-input-touch .sd-content ul li { padding-left: 10px; } /* Text + icon & Official */ .sd-social-icon-text .sd-content ul li a span, diff --git a/plugins/jetpack/modules/sharedaddy/sharing.js b/plugins/jetpack/modules/sharedaddy/sharing.js index 57bf81f9..9f5f7f9f 100644 --- a/plugins/jetpack/modules/sharedaddy/sharing.js +++ b/plugins/jetpack/modules/sharedaddy/sharing.js @@ -267,6 +267,8 @@ var updateLinkedInCount = function( data ) { } ); $more_sharing_buttons.data( 'timer', false ); } ); + } else { + $( document.body ).addClass( 'jp-sharing-input-touch' ); } $( document ).click(function() { diff --git a/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php b/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php index cad17e67..cfe37f85 100644 --- a/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php +++ b/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php @@ -230,7 +230,10 @@ class Filter_Embedded_HTML_Objects { foreach ( self::$failed_embeds as $entry ) { $html = sprintf( '<a href="%s">%s</a>', esc_url( $entry['src'] ), esc_url( $entry['src'] ) ); - $string = str_replace( $entry['match'], $html, $string ); + // Check if the string doesn't contain iframe, before replace. + if ( ! preg_match( '/<iframe /', $string ) ) { + $string = str_replace( $entry['match'], $html, $string ); + } } self::$failed_embeds = array(); diff --git a/plugins/jetpack/modules/shortcodes/css/quiz.css b/plugins/jetpack/modules/shortcodes/css/quiz.css index a0e66649..e2a0b36b 100644 --- a/plugins/jetpack/modules/shortcodes/css/quiz.css +++ b/plugins/jetpack/modules/shortcodes/css/quiz.css @@ -1,4 +1,4 @@ -div.quiz { +div.jetpack-quiz { border: 1px solid #deede3; background-color: #f3f3f3; padding: 1em; @@ -7,47 +7,47 @@ div.quiz { border-radius: .2em; } -div.quiz div.question { +div.jetpack-quiz div.jetpack-quiz-question { margin-bottom: .5em; font-weight: bold; } -div.quiz div.answer { +div.jetpack-quiz div.jetpack-quiz-answer { cursor: pointer; margin-bottom: .5em; padding: 1em 0 1em 1em; border-bottom: 1px dotted #999; } -div.quiz div.answer.last { +div.jetpack-quiz div.jetpack-quiz-answer.last { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; } -div.quiz div.answer.correct { +div.jetpack-quiz div.jetpack-quiz-answer.correct { color: green; } -div.quiz div.answer.wrong { +div.jetpack-quiz div.jetpack-quiz-answer.wrong { color: red; } -div.quiz div.answer div.explanation { +div.jetpack-quiz div.jetpack-quiz-answer div.jetpack-quiz-explanation { display: none; } -div.quiz div.answer.correct div.explanation, div.quiz div.answer.wrong div.explanation { +div.jetpack-quiz div.jetpack-quiz-answer.correct div.jetpack-quiz-explanation, div.jetpack-quiz div.jetpack-quiz-answer.wrong div.jetpack-quiz-explanation { display: block; color: black; font-size: 90%; margin-top: 1em; } -div.quiz div.answer.correct div.explanation tt, div.quiz div.answer.wrong div.explanation tt { +div.jetpack-quiz div.jetpack-quiz-answer.correct div.jetpack-quiz-explanation tt, div.jetpack-quiz div.jetpack-quiz-answer.wrong div.jetpack-quiz-explanation tt { font-size: 85%; } -div.quiz pre { +div.jetpack-quiz pre { font: 15px Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; background: transparent; margin: 0; diff --git a/plugins/jetpack/modules/shortcodes/googleplus.php b/plugins/jetpack/modules/shortcodes/googleplus.php index 759d9b62..134246e0 100644 --- a/plugins/jetpack/modules/shortcodes/googleplus.php +++ b/plugins/jetpack/modules/shortcodes/googleplus.php @@ -11,22 +11,10 @@ define( 'JETPACK_GOOGLEPLUS_EMBED_REGEX', '#^https?://plus\.(sandbox\.)?google\. wp_embed_register_handler( 'googleplus', JETPACK_GOOGLEPLUS_EMBED_REGEX, 'jetpack_googleplus_embed_handler' ); function jetpack_googleplus_embed_handler( $matches, $attr, $url ) { - static $did_script; - - if ( ! $did_script ) { - $did_script = true; - add_action( 'wp_footer', 'jetpack_googleplus_add_script' ); - } - + wp_enqueue_script( 'jetpack-gplus-api', 'https://apis.google.com/js/plusone.js', array(), null, true ); return sprintf( '<div class="g-post" data-href="%s"></div>', esc_url( $url ) ); } -function jetpack_googleplus_add_script() { - ?> - <script src="https://apis.google.com/js/plusone.js"></script> - <?php -} - add_shortcode( 'googleplus', 'jetpack_googleplus_shortcode_handler' ); function jetpack_googleplus_shortcode_handler( $atts ) { diff --git a/plugins/jetpack/modules/shortcodes/js/quiz.js b/plugins/jetpack/modules/shortcodes/js/quiz.js index 571177af..5a43c9bc 100644 --- a/plugins/jetpack/modules/shortcodes/js/quiz.js +++ b/plugins/jetpack/modules/shortcodes/js/quiz.js @@ -20,16 +20,16 @@ })(jQuery); jQuery( function( $ ) { - $( '.quiz' ).each( function() { + $( '.jetpack-quiz' ).each( function() { var quiz = $(this); - quiz.find( 'div.answer' ).shuffleQuiz(); + quiz.find( 'div.jetpack-quiz-answer' ).shuffleQuiz(); quiz.find( 'div[data-correct]' ).removeAttr( 'data-correct' ).data( 'correct', 1 ); - quiz.find( 'div.answer:last' ).addClass( 'last' ); + quiz.find( 'div.jetpack-quiz-answer:last' ).addClass( 'last' ); }); - $( 'div.quiz' ).on( 'click', 'div.answer', function() { + $( 'div.jetpack-quiz' ).on( 'click', 'div.jetpack-quiz-answer', function() { var trackid, answer = $( this ), - quiz = answer.closest( 'div.quiz' ); + quiz = answer.closest( 'div.jetpack-quiz' ); if ( quiz.data( 'a8ctraining' ) ) { new Image().src = '//pixel.wp.com/b.gif?v=wpcom-no-pv&x_trainingchaos-' + quiz.data( 'username' ) + '=' + quiz.data( 'a8ctraining' ) + '&rand=' + Math.random(); diff --git a/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js b/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js index a8a52555..4561642d 100644 --- a/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js +++ b/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js @@ -1,170 +1,289 @@ +// jshint ignore: start /* -* printThis v1.3 -* @desc Printing plug-in for jQuery -* @author Jason Day -* -* Resources (based on) : -* jPrintArea: http://plugins.jquery.com/project/jPrintArea -* jqPrint: https://github.com/permanenttourist/jquery.jqprint -* Ben Nadal: http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm -* -* Dual licensed under the MIT and GPL licenses: -* http://www.opensource.org/licenses/mit-license.php -* http://www.gnu.org/licenses/gpl.html -* -* (c) Jason Day 2013 -* -* Usage: -* -* $("#mySelector").printThis({ -* debug: false, * show the iframe for debugging -* importCSS: true, * import page CSS -* printContainer: true, * grab outer container as well as the contents of the selector -* loadCSS: "path/to/my.css", * path to additional css file -* pageTitle: "", * add title to print page -* removeInline: false, * remove all inline styles from print elements -* printDelay: 333, * variable print delay S. Vance -* header: null * prefix to html -* }); -* -* Notes: -* - the loadCSS will load additional css (with or without @media print) into the iframe, adjusting layout -*/ -/* jshint onevar: false, smarttabs: true, devel: true */ -;(function ($) { - var opt; - $.fn.printThis = function (options) { - opt = $.extend({}, $.fn.printThis.defaults, options); - var $element = this instanceof jQuery ? this : $(this); - - var strFrameName = 'printThis-' + (new Date()).getTime(); - - if(window.location.hostname !== document.domain && navigator.userAgent.match(/msie/i)){ - // Ugly IE hacks due to IE not inheriting document.domain from parent - // checks if document.domain is set by comparing the host name against document.domain - var iframeContents = '<head><script>document.domain=\\\'' + document.domain + '\\\';</script></head><body></body>'; - var iframeSrc = 'data:text/html;charset=utf-8,' + encodeURI(iframeContents); - var printI= document.createElement('iframe'); - printI.name = 'printIframe'; - printI.id = strFrameName; - printI.className = 'MSIE'; - document.body.appendChild(printI); - printI.src = iframeSrc; - - } else { - // other browsers inherit document.domain, and IE works if document.domain is not explicitly set - var $frame = $('<iframe id="' + strFrameName +'" name="printIframe" />'); - $frame.appendTo('body'); - } - - - var $iframe = $('#' + strFrameName); - - // show frame if in debug mode - if (!opt.debug) { - $iframe.css({ - position: 'absolute', - width: '0px', - height: '0px', - left: '-600px', - top: '-600px' - }); - } - - - // $iframe.ready() and $iframe.load were inconsistent between browsers - setTimeout ( function () { - - var $doc = $iframe.contents(); - - // import page stylesheets - if (opt.importCSS) { - $('link[rel=stylesheet]').each(function () { - var href = $(this).attr('href'); - if (href) { - var media = $(this).attr('media') || 'all'; - $doc.find('head').append('<link type="text/css" rel="stylesheet" href="' + href + '" media="' + media + '">'); - } - }); - } - - //add title of the page - if (opt.pageTitle) { - $doc.find('head').append('<title>' + opt.pageTitle + '</title>'); - } - - // import additional stylesheet - if (opt.loadCSS) { - $doc.find('head').append('<link type="text/css" rel="stylesheet" href="' + opt.loadCSS + '">'); - } - - // print header - if (opt.header) { - $doc.find('body').append(opt.header); - } - - // grab $.selector as container - if (opt.printContainer) { - $doc.find('body').append($element.outer()); - } - - // otherwise just print interior elements of container - else { - $element.each(function () { - $doc.find('body').append($(this).html()); - }); - } - - // remove inline styles - if (opt.removeInline) { - // $.removeAttr available jQuery 1.7+ - if ($.isFunction($.removeAttr)) { - $doc.find('body *').removeAttr('style'); - } else { - $doc.find('body *').attr('style', ''); - } - } - - setTimeout(function () { - if($iframe.hasClass('MSIE')){ - // check if the iframe was created with the ugly hack - // and perform another ugly hack out of neccessity - window.frames.printIframe.focus(); - $doc.find('head').append('<script> window.print(); </script>'); - } else { - // proper method - $iframe[0].contentWindow.focus(); - $iframe[0].contentWindow.print(); - } - - $element.trigger( 'done'); - //remove iframe after print - if (!opt.debug) { - setTimeout(function () { - $iframe.remove(); - }, 1000); - } - - }, opt.printDelay); - - }, 333 ); - - }; - - // defaults - $.fn.printThis.defaults = { - debug: false, // show the iframe for debugging - importCSS: false, // import parent page css - printContainer: true, // print outer container/$.selector - loadCSS: '', // load an additional css file - pageTitle: '', // add title to print page - removeInline: false, // remove all inline styles - printDelay: 333, // variable print delay S. Vance - header: null // prefix to html - }; - - // $.selector container - jQuery.fn.outer = function () { - return $($('<div></div>').html(this.clone())).html(); - }; + * printThis v1.9.0 + * @desc Printing plug-in for jQuery + * @author Jason Day + * + * Resources (based on) : + * jPrintArea: http://plugins.jquery.com/project/jPrintArea + * jqPrint: https://github.com/permanenttourist/jquery.jqprint + * Ben Nadal: http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm + * + * Licensed under the MIT licence: + * http://www.opensource.org/licenses/mit-license.php + * + * (c) Jason Day 2015 + * + * Usage: + * + * $("#mySelector").printThis({ + * debug: false, * show the iframe for debugging + * importCSS: true, * import page CSS + * importStyle: false, * import style tags + * printContainer: true, * grab outer container as well as the contents of the selector + * loadCSS: "path/to/my.css", * path to additional css file - us an array [] for multiple + * pageTitle: "", * add title to print page + * removeInline: false, * remove all inline styles from print elements + * printDelay: 333, * variable print delay + * header: null, * prefix to html + * footer: null, * postfix to html + * base: false, * preserve the BASE tag, or accept a string for the URL + * formValues: true * preserve input/form values + * canvas: false * copy canvas elements (experimental) + * doctypeString: '...' * enter a different doctype for older markup + * }); + * + * Notes: + * - the loadCSS will load additional css (with or without @media print) into the iframe, adjusting layout + * + * jshint onevar: false, smarttabs: true, devel: true + */ +; +(function($) { + var opt; + $.fn.printThis = function(options) { + opt = $.extend({}, $.fn.printThis.defaults, options); + var $element = this instanceof jQuery ? this : $(this); + + var strFrameName = "printThis-" + (new Date()).getTime(); + + if (window.location.hostname !== document.domain && navigator.userAgent.match(/msie/i)) { + // Ugly IE hacks due to IE not inheriting document.domain from parent + // checks if document.domain is set by comparing the host name against document.domain + var iframeSrc = "javascript:document.write(\"<head><script>document.domain=\\\"" + document.domain + "\\\";</s" + "cript></head><body></body>\")"; + var printI = document.createElement('iframe'); + printI.name = "printIframe"; + printI.id = strFrameName; + printI.className = "MSIE"; + document.body.appendChild(printI); + printI.src = iframeSrc; + + } else { + // other browsers inherit document.domain, and IE works if document.domain is not explicitly set + var $frame = $("<iframe id='" + strFrameName + "' name='printIframe' />"); + $frame.appendTo("body"); + } + + + var $iframe = $("#" + strFrameName); + + // show frame if in debug mode + if (!opt.debug) $iframe.css({ + position: "absolute", + width: "0px", + height: "0px", + left: "-600px", + top: "-600px" + }); + + // $iframe.ready() and $iframe.load were inconsistent between browsers + setTimeout(function() { + + // Add doctype to fix the style difference between printing and render + function setDocType($iframe,doctype){ + var win, doc; + win = $iframe.get(0); + win = win.contentWindow || win.contentDocument || win; + doc = win.document || win.contentDocument || win; + doc.open(); + doc.write(doctype); + doc.close(); + } + if(opt.doctypeString){ + setDocType($iframe,opt.doctypeString); + } + + var $doc = $iframe.contents(), + $head = $doc.find("head"), + $body = $doc.find("body"), + $base = $('base'), + baseURL; + + // add base tag to ensure elements use the parent domain + if (opt.base === true && $base.length > 0) { + // take the base tag from the original page + baseURL = $base.attr('href'); + } else if (typeof opt.base === 'string') { + // An exact base string is provided + baseURL = opt.base; + } else { + // Use the page URL as the base + baseURL = document.location.protocol + '//' + document.location.host; + } + + $head.append('<base href="' + baseURL + '">'); + + // import page stylesheets + if (opt.importCSS) $("link[rel=stylesheet]").each(function() { + var href = $(this).attr("href"); + if (href) { + var media = $(this).attr("media") || "all"; + $head.append("<link type='text/css' rel='stylesheet' href='" + href + "' media='" + media + "'>"); + } + }); + + // import style tags + if (opt.importStyle) $("style").each(function() { + $(this).clone().appendTo($head); + }); + + // add title of the page + if (opt.pageTitle) $head.append("<title>" + opt.pageTitle + "</title>"); + + // import additional stylesheet(s) + if (opt.loadCSS) { + if( $.isArray(opt.loadCSS)) { + jQuery.each(opt.loadCSS, function(index, value) { + $head.append("<link type='text/css' rel='stylesheet' href='" + this + "'>"); + }); + } else { + $head.append("<link type='text/css' rel='stylesheet' href='" + opt.loadCSS + "'>"); + } + } + + // print header + if (opt.header) $body.append(opt.header); + + if (opt.canvas) { + // add canvas data-ids for easy access after the cloning. + var canvasId = 0; + $element.find('canvas').each(function(){ + $(this).attr('data-printthis', canvasId++); + }); + } + + // grab $.selector as container + if (opt.printContainer) $body.append($element.outer()); + + // otherwise just print interior elements of container + else $element.each(function() { + $body.append($(this).html()); + }); + + if (opt.canvas) { + // Re-draw new canvases by referencing the originals + $body.find('canvas').each(function(){ + var cid = $(this).data('printthis'), + $src = $('[data-printthis="' + cid + '"]'); + + this.getContext('2d').drawImage($src[0], 0, 0); + + // Remove the mark-up from the original + $src.removeData('printthis'); + }); + } + + // capture form/field values + if (opt.formValues) { + // loop through inputs + var $input = $element.find('input'); + if ($input.length) { + $input.each(function() { + var $this = $(this), + $name = $(this).attr('name'), + $checker = $this.is(':checkbox') || $this.is(':radio'), + $iframeInput = $doc.find('input[name="' + $name + '"]'), + $value = $this.val(); + + // order matters here + if (!$checker) { + $iframeInput.val($value); + } else if ($this.is(':checked')) { + if ($this.is(':checkbox')) { + $iframeInput.attr('checked', 'checked'); + } else if ($this.is(':radio')) { + $doc.find('input[name="' + $name + '"][value="' + $value + '"]').attr('checked', 'checked'); + } + } + + }); + } + + // loop through selects + var $select = $element.find('select'); + if ($select.length) { + $select.each(function() { + var $this = $(this), + $name = $(this).attr('name'), + $value = $this.val(); + $doc.find('select[name="' + $name + '"]').val($value); + }); + } + + // loop through textareas + var $textarea = $element.find('textarea'); + if ($textarea.length) { + $textarea.each(function() { + var $this = $(this), + $name = $(this).attr('name'), + $value = $this.val(); + $doc.find('textarea[name="' + $name + '"]').val($value); + }); + } + } // end capture form/field values + + // remove inline styles + if (opt.removeInline) { + // $.removeAttr available jQuery 1.7+ + if ($.isFunction($.removeAttr)) { + $doc.find("body *").removeAttr("style"); + } else { + $doc.find("body *").attr("style", ""); + } + } + + // print "footer" + if (opt.footer) $body.append(opt.footer); + + setTimeout(function() { + if ($iframe.hasClass("MSIE")) { + // check if the iframe was created with the ugly hack + // and perform another ugly hack out of neccessity + window.frames["printIframe"].focus(); + $head.append("<script> window.print(); </s" + "cript>"); + } else { + // proper method + if (document.queryCommandSupported("print")) { + $iframe[0].contentWindow.document.execCommand("print", false, null); + } else { + $iframe[0].contentWindow.focus(); + $iframe[0].contentWindow.print(); + } + } + + // remove iframe after print + if (!opt.debug) { + setTimeout(function() { + $iframe.remove(); + }, 1000); + } + + }, opt.printDelay); + + }, 333); + + }; + + // defaults + $.fn.printThis.defaults = { + debug: false, // show the iframe for debugging + importCSS: true, // import parent page css + importStyle: false, // import style tags + printContainer: true, // print outer container/$.selector + loadCSS: "", // load an additional css file - load multiple stylesheets with an array [] + pageTitle: "", // add title to print page + removeInline: false, // remove all inline styles + printDelay: 333, // variable print delay + header: null, // prefix to html + footer: null, // postfix to html + formValues: true, // preserve input/form values + canvas: false, // Copy canvas content (experimental) + base: false, // preserve the BASE tag, or accept a string for the URL + doctypeString: '<!DOCTYPE html>' // html doctype + }; + + // $.selector container + jQuery.fn.outer = function() { + return $($("<div></div>").html(this.clone())).html(); + } })(jQuery); diff --git a/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js b/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js index 08f1ce6f..e17a2d74 100644 --- a/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js +++ b/plugins/jetpack/modules/shortcodes/js/slideshow-shortcode.js @@ -96,6 +96,7 @@ JetpackSlideshow.prototype.finishInit_ = function() { fx: this.transition, prev: this.controls.prev, next: this.controls.next, + timeout: jetpackSlideshowSettings.speed, slideExpr: '.slideshow-slide', onPrevNextEvent: function() { return self.onCyclePrevNextClick_.apply( self, arguments ); diff --git a/plugins/jetpack/modules/shortcodes/quiz.php b/plugins/jetpack/modules/shortcodes/quiz.php index 7de89392..33b3d796 100644 --- a/plugins/jetpack/modules/shortcodes/quiz.php +++ b/plugins/jetpack/modules/shortcodes/quiz.php @@ -181,7 +181,7 @@ class Quiz_Shortcode { } $quiz = self::do_shortcode( $content ); - return '<div class="quiz"' . $id . '>' . $quiz . '</div>'; + return '<div class="jetpack-quiz quiz"' . $id . '>' . $quiz . '</div>'; } /** @@ -224,7 +224,7 @@ class Quiz_Shortcode { */ public static function question_shortcode( $atts, $content = null ) { return isset( $atts['quiz_item'] ) - ? '<div class="question">' . self::do_shortcode( $content ) . '</div>' + ? '<div class="jetpack-quiz-question question">' . self::do_shortcode( $content ) . '</div>' : ''; } @@ -244,7 +244,7 @@ class Quiz_Shortcode { } return isset( $atts['quiz_item'] ) - ? '<div class="answer" data-correct="1">' . self::do_shortcode( $content ) . '</div>' + ? '<div class="jetpack-quiz-answer answer" data-correct="1">' . self::do_shortcode( $content ) . '</div>' : ''; } @@ -264,7 +264,7 @@ class Quiz_Shortcode { } return isset( $atts['quiz_item'] ) - ? '<div class="answer">' . self::do_shortcode( $content ) . '</div>' + ? '<div class="jetpack-quiz-answer answer">' . self::do_shortcode( $content ) . '</div>' : ''; } @@ -284,7 +284,7 @@ class Quiz_Shortcode { } return isset( $atts['quiz_item'] ) - ? '<div class="explanation">' . self::do_shortcode( $content ) . '</div>' + ? '<div class="jetpack-quiz-explanation explanation">' . self::do_shortcode( $content ) . '</div>' : ''; } } diff --git a/plugins/jetpack/modules/shortcodes/recipe.php b/plugins/jetpack/modules/shortcodes/recipe.php index d033c313..d0d1a47b 100644 --- a/plugins/jetpack/modules/shortcodes/recipe.php +++ b/plugins/jetpack/modules/shortcodes/recipe.php @@ -65,7 +65,7 @@ class Jetpack_Recipes { wp_add_inline_style( 'jetpack-recipes-style', self::themecolor_styles() ); // add $themecolors-defined styles - wp_enqueue_script( 'jetpack-recipes-printthis', plugins_url( '/js/recipes-printthis.js', __FILE__ ), array( 'jquery' ), '20131230' ); + wp_enqueue_script( 'jetpack-recipes-printthis', plugins_url( '/js/recipes-printthis.js', __FILE__ ), array( 'jquery' ), '20170202' ); wp_enqueue_script( 'jetpack-recipes-js', plugins_url( '/js/recipes.js', __FILE__ ), array( 'jquery', 'jetpack-recipes-printthis' ), '20131230' ); $title_var = wp_title( '|', false, 'right' ); diff --git a/plugins/jetpack/modules/shortcodes/slideshare.php b/plugins/jetpack/modules/shortcodes/slideshare.php index f2278935..72c94237 100644 --- a/plugins/jetpack/modules/shortcodes/slideshare.php +++ b/plugins/jetpack/modules/shortcodes/slideshare.php @@ -111,5 +111,15 @@ function slideshare_shortcode( $atts ) { $player .= ' allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>'; - return $player; -}
\ No newline at end of file + /** + * Filter the returned SlideShare shortcode. + * + * @module shortcodes + * + * @since 4.7.0 + * + * @param string $player The iframe to return. + * @param array $atts The attributes specified in the shortcode. + */ + return apply_filters( 'jetpack_slideshare_shortcode', $player, $atts ); +} diff --git a/plugins/jetpack/modules/shortcodes/slideshow.php b/plugins/jetpack/modules/shortcodes/slideshow.php index c8ae4ba3..9dd6f546 100644 --- a/plugins/jetpack/modules/shortcodes/slideshow.php +++ b/plugins/jetpack/modules/shortcodes/slideshow.php @@ -270,7 +270,7 @@ class Jetpack_Slideshow_Shortcode { function enqueue_scripts() { wp_enqueue_script( 'jquery-cycle', plugins_url( '/js/jquery.cycle.min.js', __FILE__ ), array( 'jquery' ), '20161231', true ); - wp_enqueue_script( 'jetpack-slideshow', plugins_url( '/js/slideshow-shortcode.js', __FILE__ ), array( 'jquery-cycle' ), '20121214.1', true ); + wp_enqueue_script( 'jetpack-slideshow', plugins_url( '/js/slideshow-shortcode.js', __FILE__ ), array( 'jquery-cycle' ), '20160119.1', true ); if ( is_rtl() ) { wp_enqueue_style( 'jetpack-slideshow', plugins_url( '/css/rtl/slideshow-shortcode-rtl.css', __FILE__ ) ); } else { @@ -286,15 +286,16 @@ class Jetpack_Slideshow_Shortcode { * @module shortcodes * * @since 2.1.0 + * @since 4.7.0 Added the `speed` option to the array of options. * * @param array $args * - string - spinner - URL of the spinner image. + * - string - speed - Speed of the slideshow. Defaults to 4000. */ - apply_filters( - 'jetpack_js_slideshow_settings', array( - 'spinner' => plugins_url( '/img/slideshow-loader.gif', __FILE__ ), - ) - ) + apply_filters( 'jetpack_js_slideshow_settings', array( + 'spinner' => plugins_url( '/img/slideshow-loader.gif', __FILE__ ), + 'speed' => '4000', + ) ) ); } diff --git a/plugins/jetpack/modules/shortcodes/tweet.php b/plugins/jetpack/modules/shortcodes/tweet.php index 5f73aef7..9a6a679a 100644 --- a/plugins/jetpack/modules/shortcodes/tweet.php +++ b/plugins/jetpack/modules/shortcodes/tweet.php @@ -111,6 +111,22 @@ class Jetpack_Tweet { // Twitter doesn't support maxheight so don't send it $provider = remove_query_arg( 'maxheight', $provider ); + /** + * Filter the Twitter Partner ID. + * + * @module shortcodes + * + * @since 4.6.0 + * + * @param string $partner_id Twitter partner ID. + */ + $partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' ); + + // Add Twitter partner ID to track embeds from Jetpack + if ( ! empty( $partner ) ) { + $provider = add_query_arg( 'partner', $partner, $provider ); + } + return $provider; } diff --git a/plugins/jetpack/modules/shortcodes/twitchtv.php b/plugins/jetpack/modules/shortcodes/twitchtv.php index 884a2ac5..6b86f6eb 100644 --- a/plugins/jetpack/modules/shortcodes/twitchtv.php +++ b/plugins/jetpack/modules/shortcodes/twitchtv.php @@ -6,73 +6,67 @@ **/ /** - * Flash: -(Live URL) http://www.twitch.tv/paperbat - -Video: -<object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=paperbat" bgcolor="#000000"> -<param name="allowFullScreen" value="true" /> -<param name="allowScriptAccess" value="always" /> -<param name="allowNetworking" value="all" /> -<param name="movie" value="//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf" /> -<param name="flashvars" value="hostname=www.twitch.tv&channel=paperbat&auto_play=true&start_volume=25" /> -</object> - -(Archive URL) http://www.twitch.tv/paperbat/v/323486192 - -<object bgcolor='#000000' data='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf' height='378' id='clip_embed_player_flash' type='application/x-shockwave-flash' width='620'> -<param name='movie' value='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf'> -<param name='allowScriptAccess' value='always'> -<param name='allowNetworking' value='all'> -<param name='allowFullScreen' value='true'> -<param name='flashvars' value='videoId=v323486192&hostname=www.twitch.tv&channel=paperbat&auto_play=false&title=PBat+Live+-+Playin%27+for+funnnnn+%287%2F1%2F2012%29&start_volume=25'> -</object> + * (Live URL) http://www.twitch.tv/paperbat + * + * <iframe src="https://player.twitch.tv/?autoplay=false&muted=false&channel=paperbat" width="620" height="378" frameborder="0" scrolling="no" allowfullscreen></iframe> + * + * (Archive URL) http://www.twitch.tv/paperbat/v/323486192 + * + * <iframe src="https://player.twitch.tv/?autoplay=false&muted=false&video=v323486192" width="620" height="378" frameborder="0" scrolling="no" allowfullscreen></iframe> + * + * @param $atts array User supplied shortcode arguments. + * + * @return string HTML output of the shortcode. */ -function wpcom_twitchtv_shortcode( $attr, $content = NULL ) { - $attr = extract( shortcode_atts( array( - 'height' => 378, - 'width' => 620, - 'url' => '', - 'autoplay' => false - ), $attr ) ); +function wpcom_twitchtv_shortcode( $atts ) { + $attr = shortcode_atts( + array( + 'height' => 378, + 'width' => 620, + 'url' => '', + 'autoplay' => 'false', + 'muted' => 'false', + 'time' => null + ), $atts + ); - if ( empty( $url ) ) - return; + if ( empty( $attr['url'] ) ) { + return '<!-- Invalid twitchtv URL -->'; + } + + preg_match( '|^http://www.twitch.tv/([^/?]+)(/v/(\d+))?|i', $attr['url'], $match ); - preg_match( '|^http://www.twitch.tv/([^/?]+)(/v/(\d+))?|i', $url, $match ); + $url_args = array( + 'autoplay' => ( false !== $attr['autoplay'] && 'false' !== $attr['autoplay'] ) ? 'true' : 'false', + 'muted' => ( false !== $attr['muted'] && 'false' !== $attr['muted'] ) ? 'true' : 'false', + 'time' => $attr['time'] + ); - $width = (int) $width; - $height = (int) $height; - $autoplay = var_export( filter_var( $autoplay, FILTER_VALIDATE_BOOLEAN ), true ); + $width = intval( $attr['width'] ); + $height = intval( $attr['height'] ); - $user_id = esc_attr( $match[1] ); + $user_id = $match[1]; $video_id = 0; - if ( !empty( $match[3] ) ) + if ( ! empty( $match[3] ) ) { $video_id = (int) $match[3]; + } - /** This action is documented in modules/widgets/social-media-icons.php */ do_action( 'jetpack_bump_stats_extras', 'twitchtv', 'shortcode' ); if ( $video_id > 0 ) { - // Archive video - return "<object bgcolor='#000000' data='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf' height='$height' width='$width' id='clip_embed_player_flash' type='application/x-shockwave-flash'> -<param name='movie' value='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf'> -<param name='allowScriptAccess' value='always'> -<param name='allowNetworking' value='all'> -<param name='allowFullScreen' value='true'> -<param name='flashvars' value='videoId=v$video_id&hostname=www.twitch.tv&channel=$user_id&auto_play=$autoplay'> -</object>"; + $url_args['video'] = 'v' . $video_id; + } else { + $url_args['channel'] = $user_id; } - $html = "<object type='application/x-shockwave-flash' height='$height' width='$width' id='live_embed_player_flash' data='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf?channel=$user_id' bgcolor='#000000'> -<param name='allowFullScreen' value='true' /> -<param name='allowScriptAccess' value='always' /> -<param name='allowNetworking' value='all' /> -<param name='movie' value='//www-cdn.jtvnw.net/swflibs/TwitchPlayer.swf' /> -<param name='flashvars' value='hostname=www.twitch.tv&channel=$user_id&auto_play=$autoplay&start_volume=25' /> -</object>"; + $url = add_query_arg( $url_args, 'https://player.twitch.tv/' ); - return $html; + return sprintf( + '<iframe src="%s" width="%d" height="%d" frameborder="0" scrolling="no" allowfullscreen></iframe>', + esc_url( $url ), + esc_attr( $width ), + esc_attr( $height ) + ); } add_shortcode( 'twitch', 'wpcom_twitchtv_shortcode' ); diff --git a/plugins/jetpack/modules/shortcodes/twitter-timeline.php b/plugins/jetpack/modules/shortcodes/twitter-timeline.php index bce9d2a9..38558b49 100644 --- a/plugins/jetpack/modules/shortcodes/twitter-timeline.php +++ b/plugins/jetpack/modules/shortcodes/twitter-timeline.php @@ -19,6 +19,11 @@ function twitter_timeline_shortcode( $atts ) { $output = '<a class="twitter-timeline"'; + /** This filter is documented in modules/shortcodes/tweet.php */ + $partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' ); + if ( ! empty( $partner ) ) { + $output .= ' data-partner="' . esc_attr( $partner ) . '"'; + } if ( is_numeric( $atts['width'] ) ) { $output .= ' data-width="' . esc_attr( $atts['width'] ) . '"'; } diff --git a/plugins/jetpack/modules/sso.php b/plugins/jetpack/modules/sso.php index 0e6c3482..43134477 100644 --- a/plugins/jetpack/modules/sso.php +++ b/plugins/jetpack/modules/sso.php @@ -132,7 +132,7 @@ class Jetpack_SSO { public function login_enqueue_scripts() { global $action; - if ( ! in_array( $action, array( 'jetpack-sso', 'login' ) ) ) { + if ( ! Jetpack_SSO_Helpers::display_sso_form_for_action( $action ) ) { return; } @@ -154,7 +154,7 @@ class Jetpack_SSO { public function login_body_class( $classes ) { global $action; - if ( ! in_array( $action, array( 'jetpack-sso', 'login' ) ) ) { + if ( ! Jetpack_SSO_Helpers::display_sso_form_for_action( $action ) ) { return $classes; } @@ -325,7 +325,7 @@ class Jetpack_SSO { // And now the exceptions $action = isset( $_GET['loggedout'] ) ? 'loggedout' : $action; - if ( 'login' == $action ) { + if ( Jetpack_SSO_Helpers::display_sso_form_for_action( $action ) ) { $wants_to_login = true; } @@ -358,36 +358,7 @@ class Jetpack_SSO { } } - /** - * If the user is attempting to logout AND the auto-forward to WordPress.com - * login is set then we need to ensure we do not auto-forward the user and get - * them stuck in an infinite logout loop. - */ - if ( isset( $_GET['loggedout'] ) && Jetpack_SSO_Helpers::bypass_login_forward_wpcom() ) { - add_filter( 'jetpack_remove_login_form', '__return_true' ); - } - - /** - * Check to see if the site admin wants to automagically forward the user - * to the WordPress.com login page AND that the request to wp-login.php - * is not something other than login (Like logout!) - */ - if ( - $this->wants_to_login() - && Jetpack_SSO_Helpers::bypass_login_forward_wpcom() - ) { - add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) ); - $this->maybe_save_cookie_redirect(); - $reauth = ! empty( $_GET['force_reauth'] ); - $sso_url = $this->get_sso_url_or_die( $reauth ); - JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' ); - wp_safe_redirect( $sso_url ); - exit; - } - - if ( 'login' === $action ) { - $this->display_sso_login_form(); - } elseif ( 'jetpack-sso' === $action ) { + if ( 'jetpack-sso' === $action ) { if ( isset( $_GET['result'], $_GET['user_id'], $_GET['sso_nonce'] ) && 'success' == $_GET['result'] ) { $this->handle_login(); $this->display_sso_login_form(); @@ -395,7 +366,6 @@ class Jetpack_SSO { if ( Jetpack::is_staging_site() ) { add_filter( 'login_message', array( 'Jetpack_SSO_Notices', 'sso_not_allowed_in_staging' ) ); } else { - $this->maybe_save_cookie_redirect(); // Is it wiser to just use wp_redirect than do this runaround to wp_safe_redirect? add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) ); $reauth = ! empty( $_GET['force_reauth'] ); @@ -405,6 +375,26 @@ class Jetpack_SSO { exit; } } + } else if ( Jetpack_SSO_Helpers::display_sso_form_for_action( $action ) ) { + + // Save cookies so we can handle redirects after SSO + $this->save_cookies(); + + /** + * Check to see if the site admin wants to automagically forward the user + * to the WordPress.com login page AND that the request to wp-login.php + * is not something other than login (Like logout!) + */ + if ( Jetpack_SSO_Helpers::bypass_login_forward_wpcom() && $this->wants_to_login() ) { + add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) ); + $reauth = ! empty( $_GET['force_reauth'] ); + $sso_url = $this->get_sso_url_or_die( $reauth ); + JetpackTracking::record_user_event( 'sso_login_redirect_bypass_success' ); + wp_safe_redirect( $sso_url ); + exit; + } + + $this->display_sso_login_form(); } } @@ -432,17 +422,28 @@ class Jetpack_SSO { /** * Conditionally save the redirect_to url as a cookie. + * + * @since 4.6.0 Renamed to save_cookies from maybe_save_redirect_cookies */ - public static function maybe_save_cookie_redirect() { + public static function save_cookies() { if ( headers_sent() ) { return new WP_Error( 'headers_sent', __( 'Cannot deal with cookie redirects, as headers are already sent.', 'jetpack' ) ); } + setcookie( + 'jetpack_sso_original_request', + esc_url_raw( set_url_scheme( $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) ), + time() + HOUR_IN_SECONDS, + COOKIEPATH, + COOKIE_DOMAIN, + false, + true + ); + if ( ! empty( $_GET['redirect_to'] ) ) { // If we have something to redirect to $url = esc_url_raw( $_GET['redirect_to'] ); setcookie( 'jetpack_sso_redirect_to', $url, time() + HOUR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, false, true ); - } elseif ( ! empty( $_COOKIE['jetpack_sso_redirect_to'] ) ) { // Otherwise, if it's already set, purge it. setcookie( 'jetpack_sso_redirect_to', ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); @@ -655,7 +656,8 @@ class Jetpack_SSO { } // If we've still got nothing, create the user. - if ( empty( $user ) && ( get_option( 'users_can_register' ) || Jetpack_SSO_Helpers::new_user_override() ) ) { + $new_user_override_role = false; + if ( empty( $user ) && ( get_option( 'users_can_register' ) || ( $new_user_override_role = Jetpack_SSO_Helpers::new_user_override( $user_data ) ) ) ) { /** * If not matching by email we still need to verify the email does not exist * or this blows up @@ -665,6 +667,11 @@ class Jetpack_SSO { * user, then we know that email is unused, so it's safe to add. */ if ( Jetpack_SSO_Helpers::match_by_email() || ! get_user_by( 'email', $user_data->email ) ) { + + if ( $new_user_override_role ) { + $user_data->role = $new_user_override_role; + } + $user = Jetpack_SSO_Helpers::generate_user( $user_data ); if ( ! $user ) { JetpackTracking::record_user_event( 'sso_login_failed', array( @@ -674,7 +681,7 @@ class Jetpack_SSO { return; } - $user_found_with = Jetpack_SSO_Helpers::new_user_override() + $user_found_with = $new_user_override_role ? 'user_created_new_user_override' : 'user_created_users_can_register'; } else { @@ -724,14 +731,22 @@ class Jetpack_SSO { setcookie( 'jetpack_sso_redirect_to', ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN ); } + $json_api_auth_environment = Jetpack_SSO_Helpers::get_json_api_auth_environment(); + + $is_json_api_auth = ! empty( $json_api_auth_environment ); $is_user_connected = Jetpack::is_user_connected( $user->ID ); JetpackTracking::record_user_event( 'sso_user_logged_in', array( - 'user_found_with' => $user_found_with, - 'user_connected' => (bool) $is_user_connected, - 'user_role' => Jetpack::translate_current_user_to_role() + 'user_found_with' => $user_found_with, + 'user_connected' => (bool) $is_user_connected, + 'user_role' => Jetpack::translate_current_user_to_role(), + 'is_json_api_auth' => (bool) $is_json_api_auth, ) ); - if ( ! $is_user_connected ) { + if ( $is_json_api_auth ) { + Jetpack::init()->verify_json_api_authorization_request( $json_api_auth_environment ); + Jetpack::init()->store_json_api_authorization_token( $user->user_login, $user ); + + } else if ( ! $is_user_connected ) { $calypso_env = ! empty( $_GET['calypso_env'] ) ? sanitize_key( $_GET['calypso_env'] ) : ''; @@ -750,6 +765,7 @@ class Jetpack_SSO { exit; } + add_filter( 'allowed_redirect_hosts', array( 'Jetpack_SSO_Helpers', 'allowed_redirect_hosts' ) ); wp_safe_redirect( /** This filter is documented in core/src/wp-login.php */ apply_filters( 'login_redirect', $redirect_to, $_request_redirect_to, $user ) diff --git a/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php b/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php index 9d9c5477..f7c6eb92 100644 --- a/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php +++ b/plugins/jetpack/modules/sso/class.jetpack-sso-helpers.php @@ -54,19 +54,32 @@ class Jetpack_SSO_Helpers { * * @return bool */ - static function new_user_override() { + static function new_user_override( $user_data = null ) { $new_user_override = defined( 'WPCC_NEW_USER_OVERRIDE' ) ? WPCC_NEW_USER_OVERRIDE : false; /** - * Allow users to register on your site with a WordPress.com account, even though you disallow normal registrations. + * Allow users to register on your site with a WordPress.com account, even though you disallow normal registrations. + * If you return a string that corresponds to a user role, the user will be given that role. * * @module sso * * @since 2.6.0 + * @since 4.6 $user_data object is now passed to the jetpack_sso_new_user_override filter * - * @param bool $new_user_override Allow users to register on your site with a WordPress.com account. Default to false. + * @param bool $new_user_override Allow users to register on your site with a WordPress.com account. Default to false. + * @param object|null $user_data An object containing the user data returned from WordPress.com. */ - return (bool) apply_filters( 'jetpack_sso_new_user_override', $new_user_override ); + $role = apply_filters( 'jetpack_sso_new_user_override', $new_user_override, $user_data ); + + if ( $role ) { + if ( is_string( $role ) && get_role( $role ) ) { + return $role; + } else { + return get_option( 'default_role' ); + } + } + + return false; } /** @@ -162,6 +175,7 @@ class Jetpack_SSO_Helpers { * default for $api_base due to restrictions with testing constants in our tests. * * @since 4.3.0 + * @since 4.6.0 Added public-api.wordpress.com as an allowed redirect * * @param array $hosts * @param string $api_base @@ -175,6 +189,7 @@ class Jetpack_SSO_Helpers { $hosts[] = 'wordpress.com'; $hosts[] = 'jetpack.wordpress.com'; + $hosts[] = 'public-api.wordpress.com'; if ( ( Jetpack::is_development_mode() || Jetpack::is_development_version() ) && @@ -221,6 +236,11 @@ class Jetpack_SSO_Helpers { $user->last_name = $user_data->last_name; $user->url = $user_data->url; $user->description = $user_data->description; + + if ( isset( $user_data->role ) && $user_data->role ) { + $user->role = $user_data->role; + } + wp_update_user( $user ); update_user_meta( $user->ID, 'wpcom_user_id', $user_data->ID ); @@ -240,6 +260,70 @@ class Jetpack_SSO_Helpers { */ return intval( apply_filters( 'jetpack_sso_auth_cookie_expirtation', YEAR_IN_SECONDS ) ); } + + /** + * Determines if the SSO form should be displayed for the current action. + * + * @since 4.6.0 + * + * @param string $action + * + * @return bool Is SSO allowed for the current action? + */ + static function display_sso_form_for_action( $action ) { + /** + * Allows plugins the ability to overwrite actions where the SSO form is allowed to be used. + * + * @module sso + * + * @since 4.6.0 + * + * @param array $allowed_actions_for_sso + */ + $allowed_actions_for_sso = (array) apply_filters( 'jetpack_sso_allowed_actions', array( + 'login', + 'jetpack-sso', + 'jetpack_json_api_authorization', + ) ); + return in_array( $action, $allowed_actions_for_sso ); + } + + /** + * This method returns an environment array that is meant to simulate `$_REQUEST` when the initial + * JSON API auth request was made. + * + * @since 4.6.0 + * + * @return array|bool + */ + static function get_json_api_auth_environment() { + if ( empty( $_COOKIE['jetpack_sso_original_request'] ) ) { + return false; + } + + $original_request = esc_url_raw( $_COOKIE['jetpack_sso_original_request'] ); + + $parsed_url = wp_parse_url( $original_request ); + if ( empty( $parsed_url ) || empty( $parsed_url['query'] ) ) { + return false; + } + + $args = array(); + wp_parse_str( $parsed_url['query'], $args ); + + if ( empty( $args ) || empty( $args['action'] ) ) { + return false; + } + + if ( 'jetpack_json_api_authorization' != $args['action'] ) { + return false; + } + + return array_merge( + $args, + array( 'jetpack_json_api_original_query' => $original_request ) + ); + } } endif; 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 1d92ae00..513d726f 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-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 +#loginform{position:relative!important;padding-bottom:92px}.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{display:none}.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.min.css b/plugins/jetpack/modules/sso/jetpack-sso-login.min.css index c066b8ae..eeaeff27 100644 --- a/plugins/jetpack/modules/sso/jetpack-sso-login.min.css +++ b/plugins/jetpack/modules/sso/jetpack-sso-login.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -#loginform{position:relative!important;padding-bottom:92px}.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 +#loginform{position:relative!important;padding-bottom:92px}.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{display:none}.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 e4f03580..ebfa5326 100644 --- a/plugins/jetpack/modules/stats.php +++ b/plugins/jetpack/modules/stats.php @@ -10,6 +10,8 @@ * Module Tags: Site Stats, Recommended * Feature: Engagement * Additional Search Queries: statistics, tracking, analytics, views, traffic, stats + * + * @package Jetpack */ if ( defined( 'STATS_VERSION' ) ) { @@ -21,9 +23,13 @@ defined( 'STATS_DASHBOARD_SERVER' ) or define( 'STATS_DASHBOARD_SERVER', 'dashbo add_action( 'jetpack_modules_loaded', 'stats_load' ); +/** + * Load Stats. + * + * @access public + * @return void + */ function stats_load() { - global $wp_roles; - Jetpack::enable_module_configurable( __FILE__ ); Jetpack::module_configuration_load( __FILE__, 'stats_configuration_load' ); Jetpack::module_configuration_head( __FILE__, 'stats_configuration_head' ); @@ -38,8 +44,8 @@ function stats_load() { add_action( 'jetpack_admin_menu', 'stats_admin_menu' ); - // Map stats caps - add_filter( 'map_meta_cap', 'stats_map_meta_caps', 10, 4 ); + // Map stats caps. + add_filter( 'map_meta_cap', 'stats_map_meta_caps', 10, 3 ); if ( isset( $_GET['oldwidget'] ) ) { // Old one. @@ -50,21 +56,36 @@ function stats_load() { add_filter( 'jetpack_xmlrpc_methods', 'stats_xmlrpc_methods' ); - add_filter( 'pre_option_db_version', 'stats_ignore_db_version' ); + + // Add an icon to see stats in WordPress.com for a particular post + add_action( 'admin_print_styles-edit.php', 'jetpack_stats_load_admin_css' ); + add_filter( 'manage_posts_columns', 'jetpack_stats_post_table' ); + add_filter( 'manage_pages_columns', 'jetpack_stats_post_table' ); + add_action( 'manage_posts_custom_column', 'jetpack_stats_post_table_cell', 10, 2 ); + add_action( 'manage_pages_custom_column', 'jetpack_stats_post_table_cell', 10, 2 ); } /** * Delay conditional for current_user_can to after init. + * + * @access public + * @return void */ function stats_merged_widget_admin_init() { if ( current_user_can( 'view_stats' ) ) { add_action( 'load-index.php', 'stats_enqueue_dashboard_head' ); - add_action( 'wp_dashboard_setup', 'stats_register_widget_control_callback' ); // hacky but works + add_action( 'wp_dashboard_setup', 'stats_register_widget_control_callback' ); // Hacky but works. add_action( 'jetpack_dashboard_widget', 'stats_jetpack_dashboard_widget' ); } } +/** + * Enqueue Stats Dashboard + * + * @access public + * @return void + */ function stats_enqueue_dashboard_head() { add_action( 'admin_head', 'stats_dashboard_head' ); } @@ -72,11 +93,15 @@ function stats_enqueue_dashboard_head() { /** * Prevent sparkline img requests being redirected to upgrade.php. * See wp-admin/admin.php where it checks $wp_db_version. + * + * @access public + * @param mixed $version Version. + * @return string $version. */ function stats_ignore_db_version( $version ) { if ( is_admin() && - isset( $_GET['page'] ) && $_GET['page'] == 'stats' && + isset( $_GET['page'] ) && 'stats' === $_GET['page'] && isset( $_GET['chart'] ) && strpos($_GET['chart'], 'admin-bar-hours') === 0 ) { global $wp_db_version; @@ -86,13 +111,17 @@ function stats_ignore_db_version( $version ) { } /** - * Maps view_stats cap to read cap as needed + * Maps view_stats cap to read cap as needed. * - * @return array Possibly mapped capabilities for meta capability + * @access public + * @param mixed $caps Caps. + * @param mixed $cap Cap. + * @param mixed $user_id User ID. + * @return array Possibly mapped capabilities for meta capability. */ -function stats_map_meta_caps( $caps, $cap, $user_id, $args ) { - // Map view_stats to exists - if ( 'view_stats' == $cap ) { +function stats_map_meta_caps( $caps, $cap, $user_id ) { + // Map view_stats to exists. + if ( 'view_stats' === $cap ) { $user = new WP_User( $user_id ); $user_role = array_shift( $user->roles ); $stats_roles = stats_get_option( 'roles' ); @@ -106,23 +135,31 @@ function stats_map_meta_caps( $caps, $cap, $user_id, $args ) { return $caps; } +/** + * Stats Template Redirect. + * + * @access public + * @return void + */ function stats_template_redirect() { global $current_user, $stats_footer; - if ( is_feed() || is_robots() || is_trackback() || is_preview() ) + if ( is_feed() || is_robots() || is_trackback() || is_preview() ) { return; + } // Should we be counting this user's views? - if ( !empty( $current_user->ID ) ) { + if ( ! empty( $current_user->ID ) ) { $count_roles = stats_get_option( 'count_roles' ); - if ( ! array_intersect( $current_user->roles, $count_roles ) ) + if ( ! array_intersect( $current_user->roles, $count_roles ) ) { return; + } } add_action( 'wp_footer', 'stats_footer', 101 ); add_action( 'wp_head', 'stats_add_shutdown_action' ); - $script = set_url_scheme( '//stats.wp.com/e-' . gmdate( 'YW' ) . '.js' ); + $script = 'https://stats.wp.com/e-' . gmdate( 'YW' ) . '.js'; $data = stats_build_view_data(); $data_stats_array = stats_array( $data ); @@ -137,6 +174,13 @@ function stats_template_redirect() { END; } + +/** + * Stats Build View Data. + * + * @access public + * @return array. + */ function stats_build_view_data() { global $wp_the_query; @@ -150,11 +194,10 @@ function stats_build_view_data() { // Store and reset the queried_object and queried_object_id // Otherwise, redirect_canonical() will redirect to home_url( '/' ) for show_on_front = page sites where home_url() is not all lowercase. // Repro: - // 1. Set home_url = http://ExamPle.com/ + // 1. Set home_url = https://ExamPle.com/ // 2. Set show_on_front = page // 3. Set page_on_front = something - // 4. Visit http://example.com/ - + // 4. Visit https://example.com/ ! $queried_object = ( isset( $wp_the_query->queried_object ) ) ? $wp_the_query->queried_object : null; $queried_object_id = ( isset( $wp_the_query->queried_object_id ) ) ? $wp_the_query->queried_object_id : null; $post = $wp_the_query->get_queried_object_id(); @@ -167,17 +210,35 @@ function stats_build_view_data() { return compact( 'v', 'j', 'blog', 'post', 'tz', 'srv' ); } +/** + * Stats Add Shutdown Action. + * + * @access public + * @return void + */ function stats_add_shutdown_action() { - // just in case wp_footer isn't in your theme + // Just in case wp_footer isn't in your theme. add_action( 'shutdown', 'stats_footer', 101 ); } +/** + * Stats Footer. + * + * @access public + * @return void + */ function stats_footer() { global $stats_footer; print $stats_footer; $stats_footer = ''; } +/** + * Stats Get Options. + * + * @access public + * @return array. + */ function stats_get_options() { $options = get_option( 'stats_options' ); @@ -188,30 +249,61 @@ function stats_get_options() { return $options; } +/** + * Get Stats Options. + * + * @access public + * @param mixed $option Option. + * @return mixed|null. + */ function stats_get_option( $option ) { $options = stats_get_options(); - if ( $option == 'blog_id' ) + if ( 'blog_id' === $option ) { return Jetpack_Options::get_option( 'id' ); + } - if ( isset( $options[$option] ) ) - return $options[$option]; + if ( isset( $options[ $option ] ) ) { + return $options[ $option ]; + } return null; } +/** + * Stats Set Options. + * + * @access public + * @param mixed $option Option. + * @param mixed $value Value. + * @return bool. + */ function stats_set_option( $option, $value ) { $options = stats_get_options(); - $options[$option] = $value; + $options[ $option ] = $value; - return stats_set_options($options); + return stats_set_options( $options ); } -function stats_set_options($options) { +/** + * Stats Set Options. + * + * @access public + * @param mixed $options Options. + * @return bool + */ +function stats_set_options( $options ) { return update_option( 'stats_options', $options ); } +/** + * Stats Upgrade Options. + * + * @access public + * @param mixed $options Options. + * @return array|bool + */ function stats_upgrade_options( $options ) { $defaults = array( 'admin_bar' => true, @@ -223,21 +315,23 @@ function stats_upgrade_options( $options ) { ); if ( isset( $options['reg_users'] ) ) { - if ( ! function_exists( 'get_editable_roles' ) ) - require_once( ABSPATH . 'wp-admin/includes/user.php' ); - if ( $options['reg_users'] ) + if ( ! function_exists( 'get_editable_roles' ) ) { + require_once ABSPATH . 'wp-admin/includes/user.php'; + } + if ( $options['reg_users'] ) { $options['count_roles'] = array_keys( get_editable_roles() ); + } unset( $options['reg_users'] ); } - if ( is_array( $options ) && !empty( $options ) ) + if ( is_array( $options ) && ! empty( $options ) ) { $new_options = array_merge( $defaults, $options ); - else - $new_options = $defaults; + } else { $new_options = $defaults; + } $new_options['version'] = STATS_VERSION; - if ( ! stats_set_options( $new_options ) ) { + if ( ! stats_set_options( $new_options ) ) { return false; } @@ -246,6 +340,13 @@ function stats_upgrade_options( $options ) { return $new_options; } +/** + * Stats Array. + * + * @access public + * @param mixed $kvs KVS. + * @return array + */ function stats_array( $kvs ) { /** * Filter the options added to the JavaScript Stats tracking code. @@ -258,22 +359,26 @@ function stats_array( $kvs ) { */ $kvs = apply_filters( 'stats_array', $kvs ); $kvs = array_map( 'addslashes', $kvs ); - foreach ( $kvs as $k => $v ) + foreach ( $kvs as $k => $v ) { $jskvs[] = "$k:'$v'"; + } return join( ',', $jskvs ); } /** - * Admin Pages + * Admin Pages. + * + * @access public + * @return void */ function stats_admin_menu() { global $pagenow; // If we're at an old Stats URL, redirect to the new one. // Don't even bother with caps, menu_page_url(), etc. Just do it. - if ( 'index.php' == $pagenow && isset( $_GET['page'] ) && 'stats' == $_GET['page'] ) { - $redirect_url = str_replace( array( '/wp-admin/index.php?', '/wp-admin/?' ), '/wp-admin/admin.php?', $_SERVER['REQUEST_URI'] ); - $relative_pos = strpos( $redirect_url, '/wp-admin/' ); + if ( 'index.php' === $pagenow && isset( $_GET['page'] ) && 'stats' === $_GET['page'] ) { + $redirect_url = str_replace( array( '/wp-admin/index.php?', '/wp-admin/?' ), '/wp-admin/admin.php?', $_SERVER['REQUEST_URI'] ); + $relative_pos = strpos( $redirect_url, '/wp-admin/' ); if ( false !== $relative_pos ) { wp_safe_redirect( admin_url( substr( $redirect_url, $relative_pos + 10 ) ) ); exit; @@ -284,10 +389,22 @@ function stats_admin_menu() { add_action( "load-$hook", 'stats_reports_load' ); } +/** + * Stats Admin Path. + * + * @access public + * @return string + */ function stats_admin_path() { return Jetpack::module_configuration_url( __FILE__ ); } +/** + * Stats Reports Load. + * + * @access public + * @return void + */ function stats_reports_load() { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'postbox' ); @@ -297,19 +414,25 @@ function stats_reports_load() { if ( isset( $_GET['nojs'] ) && $_GET['nojs'] ) { $parsed = parse_url( admin_url() ); - // Remember user doesn't want JS - setcookie( 'stnojs', '1', time() + 172800, $parsed['path'] ); // 2 days + // Remember user doesn't want JS. + setcookie( 'stnojs', '1', time() + 172800, $parsed['path'] ); // 2 days. } if ( isset( $_COOKIE['stnojs'] ) && $_COOKIE['stnojs'] ) { - // Detect if JS is on. If so, remove cookie so next page load is via JS + // Detect if JS is on. If so, remove cookie so next page load is via JS. add_action( 'admin_print_footer_scripts', 'stats_js_remove_stnojs_cookie' ); - } else if ( !isset( $_GET['noheader'] ) && empty( $_GET['nojs'] ) ) { + } else if ( ! isset( $_GET['noheader'] ) && empty( $_GET['nojs'] ) ) { // Normal page load. Load page content via JS. add_action( 'admin_print_footer_scripts', 'stats_js_load_page_via_ajax' ); } } +/** + * Stats Reports CSS. + * + * @access public + * @return void + */ function stats_reports_css() { ?> <style type="text/css"> @@ -324,7 +447,13 @@ function stats_reports_css() { <?php } -// Detect if JS is on. If so, remove cookie so next page load is via JS. + +/** + * Detect if JS is on. If so, remove cookie so next page load is via JS. + * + * @access public + * @return void + */ function stats_js_remove_stnojs_cookie() { $parsed = parse_url( admin_url() ); ?> @@ -336,7 +465,12 @@ document.cookie = 'stnojs=0; expires=Wed, 9 Mar 2011 16:55:50 UTC; path=<?php ec <?php } -// Normal page load. Load page content via JS. +/** + * Normal page load. Load page content via JS. + * + * @access public + * @return void + */ function stats_js_load_page_via_ajax() { ?> <script type="text/javascript"> @@ -353,37 +487,44 @@ if ( -1 == document.location.href.indexOf( 'noheader' ) ) { <?php } +/** + * Stats Report Page. + * + * @access public + * @param bool $main_chart_only (default: false) Main Chart Only. + */ function stats_reports_page( $main_chart_only = false ) { - if ( isset( $_GET['dashboard'] ) ) + + if ( isset( $_GET['dashboard'] ) ) { return stats_dashboard_widget_content(); + } $blog_id = stats_get_option( 'blog_id' ); $domain = Jetpack::build_raw_urls( get_home_url() ); - if ( ! $main_chart_only && !isset( $_GET['noheader'] ) && empty( $_GET['nojs'] ) && empty( $_COOKIE['stnojs'] ) ) { + if ( ! $main_chart_only && ! isset( $_GET['noheader'] ) && empty( $_GET['nojs'] ) && empty( $_COOKIE['stnojs'] ) ) { $nojs_url = add_query_arg( 'nojs', '1' ); $http = is_ssl() ? 'https' : 'http'; - // Loading message - // No JS fallback message + // Loading message. No JS fallback message. ?> <div class="wrap"> - <h2><?php esc_html_e( 'Site Stats', 'jetpack'); ?> <?php if ( current_user_can( 'jetpack_manage_modules' ) ) : ?><a style="font-size:13px;" href="<?php echo esc_url( admin_url('admin.php?page=jetpack&configure=stats') ); ?>"><?php esc_html_e( 'Configure', 'jetpack'); ?></a><?php endif; ?></h2> + <h2><?php esc_html_e( 'Site Stats', 'jetpack' ); ?> <?php if ( current_user_can( 'jetpack_manage_modules' ) ) : ?><a style="font-size:13px;" href="<?php echo esc_url( admin_url( 'admin.php?page=jetpack&configure=stats' ) ); ?>"><?php esc_html_e( 'Configure', 'jetpack' ); ?></a><?php endif; ?></h2> </div> <div id="stats-loading-wrap" class="wrap"> <p class="hide-if-no-js"><img width="32" height="32" alt="<?php esc_attr_e( 'Loading…', 'jetpack' ); ?>" src="<?php -echo esc_url( - /** - * Sets external resource URL. - * - * @module stats - * - * @since 1.4.0 - * - * @param string $args URL of external resource. - */ - apply_filters( 'jetpack_static_url', "{$http}://en.wordpress.com/i/loading/loading-64.gif" ) -); ?>" /></p> -<p style="font-size: 11pt; margin: 0;"><a href="https://wordpress.com/stats/<?php echo $domain; ?>" target="_blank"><?php esc_html_e( 'View stats on WordPress.com right now', 'jetpack' ); ?></a></p> + echo esc_url( + /** + * Sets external resource URL. + * + * @module stats + * + * @since 1.4.0 + * + * @param string $args URL of external resource. + */ + apply_filters( 'jetpack_static_url', "{$http}://en.wordpress.com/i/loading/loading-64.gif" ) + ); ?>" /></p> +<p style="font-size: 11pt; margin: 0;"><a href="https://wordpress.com/stats/<?php echo esc_attr( $domain ); ?>" target="_blank"><?php esc_html_e( 'View stats on WordPress.com right now', 'jetpack' ); ?></a></p> <p class="hide-if-js"><?php esc_html_e( 'Your Site Stats work better with JavaScript enabled.', 'jetpack' ); ?><br /> <a href="<?php echo esc_url( $nojs_url ); ?>"><?php esc_html_e( 'View Site Stats without JavaScript', 'jetpack' ); ?></a>.</p> </div> @@ -426,20 +567,20 @@ echo esc_url( 'pagenum' => 'int', ); foreach ( $args as $var => $vals ) { - if ( !isset( $_REQUEST[$var] ) ) + if ( ! isset( $_REQUEST[$var] ) ) continue; if ( is_array( $vals ) ) { if ( in_array( $_REQUEST[$var], $vals ) ) $q[$var] = $_REQUEST[$var]; - } elseif ( $vals == 'int' ) { + } elseif ( 'int' === $vals ) { $q[$var] = intval( $_REQUEST[$var] ); - } elseif ( $vals == 'date' ) { + } elseif ( 'date' === $vals ) { if ( preg_match( '/^\d{4}-\d{2}-\d{2}$/', $_REQUEST[$var] ) ) $q[$var] = $_REQUEST[$var]; - } elseif ( $vals == null ) { + } elseif ( null === $vals ) { $q[$var] = ''; - } elseif ( $vals == 'data' ) { - if ( substr( $_REQUEST[$var], 0, 9 ) == 'index.php' ) + } elseif ( 'data' === $vals ) { + if ( 'index.php' === substr( $_REQUEST[$var], 0, 9 ) ) $q[$var] = $_REQUEST[$var]; } } @@ -460,12 +601,12 @@ echo esc_url( $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) ); $get_code = wp_remote_retrieve_response_code( $get ); - if ( is_wp_error( $get ) || ( 2 != intval( $get_code / 100 ) && 304 != $get_code ) || empty( $get['body'] ) ) { + if ( is_wp_error( $get ) || ( 2 !== intval( $get_code / 100 ) && 304 !== $get_code ) || empty( $get['body'] ) ) { stats_print_wp_remote_error( $get, $url ); } else { - if ( !empty( $get['headers']['content-type'] ) ) { + if ( ! empty( $get['headers']['content-type'] ) ) { $type = $get['headers']['content-type']; - if ( substr( $type, 0, 5 ) == 'image' ) { + if ( substr( $type, 0, 5 ) === 'image' ) { $img = $get['body']; header( 'Content-Type: ' . $type ); header( 'Content-Length: ' . strlen( $img ) ); @@ -484,48 +625,88 @@ echo esc_url( JetpackTracking::record_user_event( 'wpa_page_view', array( 'path' => 'old_stats' ) ); } - if ( isset( $_GET['noheader'] ) ) + if ( isset( $_GET['noheader'] ) ) { die; + } } +/** + * Stats Convert Admin Urls. + * + * @access public + * @param mixed $html HTML. + * @return string + */ function stats_convert_admin_urls( $html ) { return str_replace( 'index.php?page=stats', 'admin.php?page=stats', $html ); } +/** + * Stats Convert Image URLs. + * + * @access public + * @param mixed $html HTML. + * @return string + */ function stats_convert_image_urls( $html ) { $url = set_url_scheme( 'https://' . STATS_DASHBOARD_SERVER ); $html = preg_replace( '|(["\'])(/i/stats.+)\\1|', '$1' . $url . '$2$1', $html ); return $html; } +/** + * Stats Convert Chart URLs. + * + * @access public + * @param mixed $html HTML. + * @return string + */ function stats_convert_chart_urls( $html ) { $html = preg_replace_callback( '|https?://[-.a-z0-9]+/wp-includes/charts/([-.a-z0-9]+).php(\??)|', - create_function( - '$matches', - // If there is a query string, change the beginning '?' to a '&' so it fits into the middle of this query string - 'return "admin.php?page=stats&noheader&chart=" . $matches[1] . str_replace( "?", "&", $matches[2] );' - ), - $html ); + create_function( + '$matches', + // If there is a query string, change the beginning '?' to a '&' so it fits into the middle of this query string. + 'return "admin.php?page=stats&noheader&chart=" . $matches[1] . str_replace( "?", "&", $matches[2] );' + ), + $html ); return $html; } +/** + * Stats Convert Post Title HTML + * + * @access public + * @param mixed $html HTML. + * @return string + */ function stats_convert_post_titles( $html ) { - global $wpdb, $stats_posts; + global $stats_posts; $pattern = "<span class='post-(\d+)-link'>.*?</span>"; - if ( !preg_match_all( "!$pattern!", $html, $matches ) ) + if ( ! preg_match_all( "!$pattern!", $html, $matches ) ) { return $html; - $posts = get_posts( array( - 'include' => implode( ',', $matches[1] ), - 'post_type' => 'any', - 'post_status' => 'any', - 'numberposts' => -1, - )); - foreach ( $posts as $post ) - $stats_posts[$post->ID] = $post; + } + $posts = get_posts( + array( + 'include' => implode( ',', $matches[1] ), + 'post_type' => 'any', + 'post_status' => 'any', + 'numberposts' => -1, + ) + ); + foreach ( $posts as $post ) { + $stats_posts[ $post->ID ] = $post; + } $html = preg_replace_callback( "!$pattern!", 'stats_convert_post_title', $html ); return $html; } +/** + * Stats Convert Post Title Matches. + * + * @access public + * @param mixed $matches Matches. + * @return string + */ function stats_convert_post_title( $matches ) { global $stats_posts; $post_id = $matches[1]; @@ -534,21 +715,31 @@ function stats_convert_post_title( $matches ) { return $matches[0]; } +/** + * Stats Configuration Load. + * + * @access public + * @return void + */ function stats_configuration_load() { - if ( isset( $_POST['action'] ) && $_POST['action'] == 'save_options' && $_POST['_wpnonce'] == wp_create_nonce( 'stats' ) ) { + if ( isset( $_POST['action'] ) && 'save_options' === $_POST['action'] && $_POST['_wpnonce'] === wp_create_nonce( 'stats' ) ) { $options = stats_get_options(); $options['admin_bar'] = isset( $_POST['admin_bar'] ) && $_POST['admin_bar']; $options['hide_smile'] = isset( $_POST['hide_smile'] ) && $_POST['hide_smile']; $options['roles'] = array( 'administrator' ); - foreach ( get_editable_roles() as $role => $details ) - if ( isset( $_POST["role_$role"] ) && $_POST["role_$role"] ) + foreach ( get_editable_roles() as $role => $details ) { + if ( isset( $_POST["role_$role"] ) && $_POST["role_$role"] ) { $options['roles'][] = $role; + } + } $options['count_roles'] = array(); - foreach ( get_editable_roles() as $role => $details ) - if ( isset( $_POST["count_role_$role"] ) && $_POST["count_role_$role"] ) + foreach ( get_editable_roles() as $role => $details ) { + if ( isset( $_POST["count_role_$role"] ) && $_POST["count_role_$role"] ) { $options['count_roles'][] = $role; + } + } stats_set_options( $options ); stats_update_blog(); @@ -558,8 +749,14 @@ function stats_configuration_load() { } } +/** + * Stats Configuration Head. + * + * @access public + * @return void + */ function stats_configuration_head() { - ?> +?> <style type="text/css"> #statserror { border: 1px solid #766; @@ -573,42 +770,48 @@ function stats_configuration_head() { <?php } +/** + * Stats Configuration Screen. + * + * @access public + * @return void + */ function stats_configuration_screen() { $options = stats_get_options(); - ?> +?> <div class="narrow"> <p><?php printf( __( 'Visit <a href="%s">Site Stats</a> to see your stats.', 'jetpack' ), esc_url( menu_page_url( 'stats', false ) ) ); ?></p> <form method="post"> <input type='hidden' name='action' value='save_options' /> <?php wp_nonce_field( 'stats' ); ?> <table id="menu" class="form-table"> - <tr valign="top"><th scope="row"><label for="admin_bar"><?php _e( 'Admin bar' , 'jetpack' ); ?></label></th> - <td><label><input type='checkbox'<?php checked( $options['admin_bar'] ); ?> name='admin_bar' id='admin_bar' /> <?php _e( "Put a chart showing 48 hours of views in the admin bar.", 'jetpack' ); ?></label></td></tr> - <tr valign="top"><th scope="row"><?php _e( 'Registered users', 'jetpack' ); ?></th> + <tr valign="top"><th scope="row"><label for="admin_bar"><?php esc_html_e( 'Admin bar' , 'jetpack' ); ?></label></th> + <td><label><input type='checkbox'<?php checked( $options['admin_bar'] ); ?> name='admin_bar' id='admin_bar' /> <?php esc_html_e( 'Put a chart showing 48 hours of views in the admin bar.', 'jetpack' ); ?></label></td></tr> + <tr valign="top"><th scope="row"><?php esc_html_e( 'Registered users', 'jetpack' ); ?></th> <td> - <?php _e( "Count the page views of registered users who are logged in.", 'jetpack' ); ?><br/> + <?php esc_html_e( "Count the page views of registered users who are logged in.", 'jetpack' ); ?><br/> <?php - $count_roles = stats_get_option( 'count_roles' ); - foreach ( get_editable_roles() as $role => $details ) { - ?> + $count_roles = stats_get_option( 'count_roles' ); + foreach ( get_editable_roles() as $role => $details ) { +?> <label><input type='checkbox' name='count_role_<?php echo $role; ?>'<?php checked( in_array( $role, $count_roles ) ); ?> /> <?php echo translate_user_role( $details['name'] ); ?></label><br/> <?php - } - ?> + } +?> </td></tr> - <tr valign="top"><th scope="row"><?php _e( 'Smiley' , 'jetpack' ); ?></th> - <td><label><input type='checkbox'<?php checked( isset( $options['hide_smile'] ) && $options['hide_smile'] ); ?> name='hide_smile' id='hide_smile' /> <?php _e( 'Hide the stats smiley face image.', 'jetpack' ); ?></label><br /> <span class="description"><?php _e( 'The image helps collect stats and <strong>makes the world a better place</strong> but should still work when hidden', 'jetpack' ); ?> <img class="stats-smiley" alt="<?php esc_attr_e( 'Smiley face', 'jetpack' ); ?>" src="<?php echo esc_url( plugins_url( 'images/stats-smiley.gif', dirname( __FILE__ ) ) ); ?>" width="6" height="5" /></span></td></tr> - <tr valign="top"><th scope="row"><?php _e( 'Report visibility' , 'jetpack' ); ?></th> + <tr valign="top"><th scope="row"><?php esc_html_e( 'Smiley' , 'jetpack' ); ?></th> + <td><label><input type='checkbox'<?php checked( isset( $options['hide_smile'] ) && $options['hide_smile'] ); ?> name='hide_smile' id='hide_smile' /> <?php esc_html_e( 'Hide the stats smiley face image.', 'jetpack' ); ?></label><br /> <span class="description"><?php esc_html_e( 'The image helps collect stats and <strong>makes the world a better place</strong> but should still work when hidden', 'jetpack' ); ?> <img class="stats-smiley" alt="<?php esc_attr_e( 'Smiley face', 'jetpack' ); ?>" src="<?php echo esc_url( plugins_url( 'images/stats-smiley.gif', dirname( __FILE__ ) ) ); ?>" width="6" height="5" /></span></td></tr> + <tr valign="top"><th scope="row"><?php esc_html_e( 'Report visibility' , 'jetpack' ); ?></th> <td> - <?php _e( 'Select the roles that will be able to view stats reports.', 'jetpack' ); ?><br/> + <?php esc_html_e( 'Select the roles that will be able to view stats reports.', 'jetpack' ); ?><br/> <?php - $stats_roles = stats_get_option( 'roles' ); - foreach ( get_editable_roles() as $role => $details ) { - ?> - <label><input type='checkbox' <?php if ( $role == 'administrator' ) echo "disabled='disabled' "; ?>name='role_<?php echo $role; ?>'<?php checked( $role == 'administrator' || in_array( $role, $stats_roles ) ); ?> /> <?php echo translate_user_role( $details['name'] ); ?></label><br/> + $stats_roles = stats_get_option( 'roles' ); + foreach ( get_editable_roles() as $role => $details ) { +?> + <label><input type='checkbox' <?php if ( 'administrator' === $role ) echo "disabled='disabled' "; ?>name='role_<?php echo $role; ?>'<?php checked( 'administrator' === $role || in_array( $role, $stats_roles ) ); ?> /> <?php echo translate_user_role( $details['name'] ); ?></label><br/> <?php - } - ?> + } +?> </td></tr> </table> <p class="submit"><input type='submit' class='button-primary' value='<?php echo esc_attr( __( 'Save configuration', 'jetpack' ) ); ?>' /></p> @@ -617,38 +820,50 @@ function stats_configuration_screen() { <?php } +/** + * Stats Hide Smile. + * + * @access public + * @return void + */ function stats_hide_smile_css() { $options = stats_get_options(); if ( isset( $options['hide_smile'] ) && $options['hide_smile'] ) { - ?> +?> <style type='text/css'>img#wpstats{display:none}</style><?php } } +/** + * Stats Admin Bar Head. + * + * @access public + * @return void + */ function stats_admin_bar_head() { - if ( !stats_get_option( 'admin_bar' ) ) + if ( ! stats_get_option( 'admin_bar' ) ) return; - if ( !current_user_can( 'view_stats' ) ) + if ( ! current_user_can( 'view_stats' ) ) return; - if ( function_exists( 'is_admin_bar_showing' ) && !is_admin_bar_showing() ) { + if ( function_exists( 'is_admin_bar_showing' ) && ! is_admin_bar_showing() ) { return; } add_action( 'admin_bar_menu', 'stats_admin_bar_menu', 100 ); - ?> +?> <style type='text/css'> #wpadminbar .quicklinks li#wp-admin-bar-stats { - height: 28px; + height: 32px; } #wpadminbar .quicklinks li#wp-admin-bar-stats a { - height: 28px; + height: 32px; padding: 0; } #wpadminbar .quicklinks li#wp-admin-bar-stats a div { - height: 28px; + height: 32px; width: 95px; overflow: hidden; margin: 0 10px; @@ -659,7 +874,7 @@ function stats_admin_bar_head() { } #wpadminbar .quicklinks li#wp-admin-bar-stats a img { height: 24px; - padding: 2px 0; + padding: 4px 0; max-width: none; border: none; } @@ -667,11 +882,18 @@ function stats_admin_bar_head() { <?php } +/** + * Stats AdminBar. + * + * @access public + * @param mixed $wp_admin_bar WPAdminBar. + * @return void + */ function stats_admin_bar_menu( &$wp_admin_bar ) { $url = add_query_arg( 'page', 'stats', admin_url( 'admin.php' ) ); // no menu_page_url() blog-side. - $img_src = esc_attr( add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours-scale' ), $url ) ); - $img_src_2x = esc_attr( add_query_arg( array( 'noheader'=>'', 'proxy'=>'', 'chart'=>'admin-bar-hours-scale-2x' ), $url ) ); + $img_src = esc_attr( add_query_arg( array( 'noheader' => '', 'proxy' => '', 'chart' => 'admin-bar-hours-scale' ), $url ) ); + $img_src_2x = esc_attr( add_query_arg( array( 'noheader' => '', 'proxy' => '', 'chart' => 'admin-bar-hours-scale-2x' ), $url ) ); $alt = esc_attr( __( 'Stats', 'jetpack' ) ); @@ -682,10 +904,22 @@ function stats_admin_bar_menu( &$wp_admin_bar ) { $wp_admin_bar->add_menu( $menu ); } +/** + * Stats Update Blog. + * + * @access public + * @return void + */ function stats_update_blog() { Jetpack::xmlrpc_async_call( 'jetpack.updateBlog', stats_get_blog() ); } +/** + * Stats Get Blog. + * + * @access public + * @return string + */ function stats_get_blog() { $home = parse_url( trailingslashit( get_option( 'home' ) ) ); $blog = array( @@ -710,6 +944,10 @@ function stats_get_blog() { /** * Modified from stripslashes_deep() + * + * @access public + * @param mixed $value Value. + * @return string */ function stats_esc_html_deep( $value ) { if ( is_array( $value ) ) { @@ -726,6 +964,13 @@ function stats_esc_html_deep( $value ) { return $value; } +/** + * Stats xmlrpc_methods function. + * + * @access public + * @param mixed $methods Methods. + * @return array + */ function stats_xmlrpc_methods( $methods ) { $my_methods = array( 'jetpack.getBlog' => 'stats_get_blog', @@ -734,30 +979,51 @@ function stats_xmlrpc_methods( $methods ) { return array_merge( $methods, $my_methods ); } +/** + * Register Stats Dashboard Widget. + * + * @access public + * @return void + */ function stats_register_dashboard_widget() { if ( ! current_user_can( 'view_stats' ) ) return; - // wp_dashboard_empty: we load in the content after the page load via JS + // With wp_dashboard_empty: we load in the content after the page load via JS. wp_add_dashboard_widget( 'dashboard_stats', __( 'Site Stats', 'jetpack' ), 'wp_dashboard_empty', 'stats_dashboard_widget_control' ); add_action( 'admin_head', 'stats_dashboard_head' ); } +/** + * Stats Dashboard Widget Options. + * + * @access public + * @return array + */ function stats_dashboard_widget_options() { $defaults = array( 'chart' => 1, 'top' => 1, 'search' => 7 ); - if ( ( !$options = get_option( 'stats_dashboard_widget' ) ) || !is_array( $options ) ) + if ( ( ! $options = get_option( 'stats_dashboard_widget' ) ) || ! is_array( $options ) ) { $options = array(); + } - // Ignore obsolete option values + // Ignore obsolete option values. $intervals = array( 1, 7, 31, 90, 365 ); - foreach ( array( 'top', 'search' ) as $key ) - if ( isset( $options[$key] ) && !in_array( $options[$key], $intervals ) ) - unset( $options[$key] ); + foreach ( array( 'top', 'search' ) as $key ) { + if ( isset( $options[ $key ] ) && ! in_array( $options[ $key ], $intervals ) ) { + unset( $options[ $key ] ); + } + } - return array_merge( $defaults, $options ); + return array_merge( $defaults, $options ); } +/** + * Stats Dashboard Widget Control. + * + * @access public + * @return void + */ function stats_dashboard_widget_control() { $periods = array( '1' => __( 'day', 'jetpack' ), @@ -778,61 +1044,68 @@ function stats_dashboard_widget_control() { $options = stats_dashboard_widget_options(); - if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['widget_id'] ) && 'dashboard_stats' == $_POST['widget_id'] ) { - if ( isset( $periods[ $_POST['chart'] ] ) ) + if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['widget_id'] ) && 'dashboard_stats' === $_POST['widget_id'] ) { + if ( isset( $periods[ $_POST['chart'] ] ) ) { $options['chart'] = $_POST['chart']; + } foreach ( array( 'top', 'search' ) as $key ) { - if ( isset( $intervals[ $_POST[$key] ] ) ) - $options[$key] = $_POST[$key]; - else - $options[$key] = $defaults[$key]; + if ( isset( $intervals[ $_POST[ $key ] ] ) ) { + $options[ $key ] = $_POST[ $key ]; + } else { $options[ $key ] = $defaults[ $key ]; + } } update_option( 'stats_dashboard_widget', $options ); } - ?> +?> <p> - <label for="chart"><?php _e( 'Chart stats by' , 'jetpack' ); ?></label> + <label for="chart"><?php esc_html_e( 'Chart stats by' , 'jetpack' ); ?></label> <select id="chart" name="chart"> <?php foreach ( $periods as $val => $label ) { - ?> +?> <option value="<?php echo $val; ?>"<?php selected( $val, $options['chart'] ); ?>><?php echo esc_html( $label ); ?></option> <?php } - ?> +?> </select>. </p> <p> - <label for="top"><?php _e( 'Show top posts over', 'jetpack' ); ?></label> + <label for="top"><?php esc_html_e( 'Show top posts over', 'jetpack' ); ?></label> <select id="top" name="top"> <?php foreach ( $intervals as $val => $label ) { - ?> +?> <option value="<?php echo $val; ?>"<?php selected( $val, $options['top'] ); ?>><?php echo esc_html( $label ); ?></option> <?php } - ?> +?> </select>. </p> <p> - <label for="search"><?php _e( 'Show top search terms over', 'jetpack' ); ?></label> + <label for="search"><?php esc_html_e( 'Show top search terms over', 'jetpack' ); ?></label> <select id="search" name="search"> <?php foreach ( $intervals as $val => $label ) { - ?> +?> <option value="<?php echo $val; ?>"<?php selected( $val, $options['search'] ); ?>><?php echo esc_html( $label ); ?></option> <?php } - ?> +?> </select>. </p> <?php } +/** + * Jetpack Stats Dashboard Widget. + * + * @access public + * @return void + */ function stats_jetpack_dashboard_widget() { - ?> +?> <form id="stats_dashboard_widget_control" action="<?php echo esc_url( admin_url() ); ?>" method="post"> <?php stats_dashboard_widget_control(); ?> <?php wp_nonce_field( 'edit-dashboard-widget_dashboard_stats', 'dashboard-widget-nonce' ); ?> @@ -888,10 +1161,22 @@ function stats_jetpack_dashboard_widget() { <?php } +/** + * Register Stats Widget Control Callback. + * + * @access public + * @return void + */ function stats_register_widget_control_callback() { $GLOBALS['wp_dashboard_control_callbacks']['dashboard_stats'] = 'stats_dashboard_widget_control'; } -// JavaScript and CSS for dashboard widget + +/** + * JavaScript and CSS for dashboard widget. + * + * @access public + * @return void + */ function stats_dashboard_head() { ?> <script type="text/javascript"> /* <![CDATA[ */ @@ -996,14 +1281,22 @@ jQuery( function($) { <?php } +/** + * Stats Dashboard Widget Content. + * + * @access public + * @return void + */ function stats_dashboard_widget_content() { - if ( !isset( $_GET['width'] ) || ( !$width = (int) ( $_GET['width'] / 2 ) ) || $width < 250 ) - $width = 370; - if ( !isset( $_GET['height'] ) || ( !$height = (int) $_GET['height'] - 36 ) || $height < 230 ) + if ( ! isset( $_GET['width'] ) || ( ! $width = (int) ( $_GET['width'] / 2 ) ) || $width < 250 ) { + $width = 370; + } + if ( ! isset( $_GET['height'] ) || ( ! $height = (int) $_GET['height'] - 36 ) || $height < 230 ) { $height = 180; + } $_width = $width - 5; - $_height = $height - ( $GLOBALS['is_winIE'] ? 16 : 5 ); // hack! + $_height = $height - ( $GLOBALS['is_winIE'] ? 16 : 5 ); // Hack! $options = stats_dashboard_widget_options(); $blog_id = Jetpack_Options::get_option( 'id' ); @@ -1031,12 +1324,12 @@ function stats_dashboard_widget_content() { $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) ); $get_code = wp_remote_retrieve_response_code( $get ); - if ( is_wp_error( $get ) || ( 2 != intval( $get_code / 100 ) && 304 != $get_code ) || empty( $get['body'] ) ) { + if ( is_wp_error( $get ) || ( 2 !== intval( $get_code / 100 ) && 304 !== $get_code ) || empty( $get['body'] ) ) { stats_print_wp_remote_error( $get, $url ); } else { - $body = stats_convert_post_titles($get['body']); - $body = stats_convert_chart_urls($body); - $body = stats_convert_image_urls($body); + $body = stats_convert_post_titles( $get['body'] ); + $body = stats_convert_chart_urls( $body ); + $body = stats_convert_image_urls( $body ); echo $body; } @@ -1044,68 +1337,70 @@ function stats_dashboard_widget_content() { $csv_end_date = date( 'Y-m-d', current_time( 'timestamp' ) ); $csv_args = array( 'top' => "&limit=8&end=$csv_end_date", 'search' => "&limit=5&end=$csv_end_date" ); - /* translators: Stats dashboard widget postviews list: "$post_title $views Views" */ + /* Translators: Stats dashboard widget postviews list: "$post_title $views Views". */ $printf = __( '%1$s %2$s Views' , 'jetpack' ); foreach ( $top_posts = stats_get_csv( 'postviews', "days=$options[top]$csv_args[top]" ) as $i => $post ) { - if ( $post['post_id'] == 0 ) { + if ( 0 === $post['post_id'] ) { unset( $top_posts[$i] ); continue; } $post_ids[] = $post['post_id']; } - // cache + // Cache. get_posts( array( 'include' => join( ',', array_unique( $post_ids ) ) ) ); $searches = array(); foreach ( $search_terms = stats_get_csv( 'searchterms', "days=$options[search]$csv_args[search]" ) as $search_term ) { - if ( $search_term['searchterm'] == 'encrypted_search_terms' ) + if ( 'encrypted_search_terms' === $search_term['searchterm'] ) { continue; + } $searches[] = esc_html( $search_term['searchterm'] ); } ?> -<a class="button" href="admin.php?page=stats"><?php _e( 'View All', 'jetpack' ); ?></a> +<a class="button" href="admin.php?page=stats"><?php esc_html_e( 'View All', 'jetpack' ); ?></a> <div id="stats-info"> <div id="top-posts" class='stats-section'> <div class="stats-section-inner"> - <h3 class="heading"><?php _e( 'Top Posts' , 'jetpack' ); ?></h3> + <h3 class="heading"><?php esc_html_e( 'Top Posts' , 'jetpack' ); ?></h3> <?php - if ( empty( $top_posts ) ) { - ?> - <p class="nothing"><?php _e( 'Sorry, nothing to report.', 'jetpack' ); ?></p> + if ( empty( $top_posts ) ) { +?> + <p class="nothing"><?php esc_html_e( 'Sorry, nothing to report.', 'jetpack' ); ?></p> <?php - } else { - foreach ( $top_posts as $post ) { - if ( !get_post( $post['post_id'] ) ) - continue; - ?> + } else { + foreach ( $top_posts as $post ) { + if ( ! get_post( $post['post_id'] ) ) { + continue; + } +?> <p><?php printf( - $printf, - '<a href="' . get_permalink( $post['post_id'] ) . '">' . get_the_title( $post['post_id'] ) . '</a>', - number_format_i18n( $post['views'] ) - ); ?></p> + $printf, + '<a href="' . get_permalink( $post['post_id'] ) . '">' . get_the_title( $post['post_id'] ) . '</a>', + number_format_i18n( $post['views'] ) + ); ?></p> <?php - } } - ?> + } +?> </div> </div> <div id="top-search" class='stats-section'> <div class="stats-section-inner"> - <h3 class="heading"><?php _e( 'Top Searches' , 'jetpack' ); ?></h3> + <h3 class="heading"><?php esc_html_e( 'Top Searches' , 'jetpack' ); ?></h3> <?php - if ( empty( $searches ) ) { - ?> - <p class="nothing"><?php _e( 'Sorry, nothing to report.', 'jetpack' ); ?></p> + if ( empty( $searches ) ) { +?> + <p class="nothing"><?php esc_html_e( 'Sorry, nothing to report.', 'jetpack' ); ?></p> <?php - } else { - ?> + } else { +?> <p><?php echo join( ', ', $searches );?></p> <?php - } - ?> + } +?> </div> </div> </div> @@ -1114,6 +1409,14 @@ function stats_dashboard_widget_content() { exit; } +/** + * Stats Print WP Remote Error. + * + * @access public + * @param mixed $get Get. + * @param mixed $url URL. + * @return void + */ function stats_print_wp_remote_error( $get, $url ) { $state_name = 'stats_remote_error_' . substr( md5( $url ), 0, 8 ); $previous_error = Jetpack::state( $state_name ); @@ -1122,37 +1425,37 @@ function stats_print_wp_remote_error( $get, $url ) { if ( $error !== $previous_error ) { ?> <div class="wrap"> - <p><?php _e( 'We were unable to get your stats just now. Please reload this page to try again.', 'jetpack' ); ?></p> + <p><?php esc_html_e( 'We were unable to get your stats just now. Please reload this page to try again.', 'jetpack' ); ?></p> </div> <?php return; } ?> <div class="wrap"> - <p><?php printf( __( 'We were unable to get your stats just now. Please reload this page to try again. If this error persists, please <a href="%1$s" target="_blank">contact support</a>. In your report please include the information below.', 'jetpack' ), 'http://support.wordpress.com/contact/?jetpack=needs-service' ); ?></p> + <p><?php printf( __( 'We were unable to get your stats just now. Please reload this page to try again. If this error persists, please <a href="%1$s" target="_blank">contact support</a>. In your report please include the information below.', 'jetpack' ), 'https://support.wordpress.com/contact/?jetpack=needs-service' ); ?></p> <pre> User Agent: "<?php echo esc_html( $_SERVER['HTTP_USER_AGENT'] ); ?>" Page URL: "http<?php echo (is_ssl()?'s':'') . '://' . esc_html( $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); ?>" API URL: "<?php echo esc_url( $url ); ?>" <?php - if ( is_wp_error( $get ) ) { - foreach ( $get->get_error_codes() as $code ) { - foreach ( $get->get_error_messages($code) as $message ) { - ?> - <?php print $code . ': "' . $message . '"' ?> +if ( is_wp_error( $get ) ) { + foreach ( $get->get_error_codes() as $code ) { + foreach ( $get->get_error_messages( $code ) as $message ) { +?> +<?php print $code . ': "' . $message . '"' ?> <?php - } } - } else { - $get_code = wp_remote_retrieve_response_code( $get ); - $content_length = strlen( wp_remote_retrieve_body( $get ) ); - ?> - Response code: "<?php print $get_code ?>" - Content length: "<?php print $content_length ?>" + } +} else { + $get_code = wp_remote_retrieve_response_code( $get ); + $content_length = strlen( wp_remote_retrieve_body( $get ) ); +?> +Response code: "<?php print $get_code ?>" +Content length: "<?php print $content_length ?>" <?php - } +} ?></pre> </div> <?php @@ -1161,9 +1464,9 @@ function stats_print_wp_remote_error( $get, $url ) { /** * Get stats from WordPress.com * - * @param string $table The stats which you want to retrieve: postviews, or searchterms - * @param array $args { - * An associative array of arguments. + * @param string $table The stats which you want to retrieve: postviews, or searchterms. + * @param array $args { + * An associative array of arguments. * * @type bool $end The last day of the desired time frame. Format is 'Y-m-d' (e.g. 2007-05-01) * and default timezone is UTC date. Default value is Now. @@ -1198,50 +1501,64 @@ function stats_get_csv( $table, $args = null ) { $key = md5( $stats_csv_url ); - // Get cache + // Get cache. $stats_cache = get_option( 'stats_cache' ); - if ( !$stats_cache || !is_array( $stats_cache ) ) + if ( ! $stats_cache || ! is_array( $stats_cache ) ) { $stats_cache = array(); + } - // Return or expire this key - if ( isset( $stats_cache[$key] ) ) { - $time = key( $stats_cache[$key] ); - if ( time() - $time < 300 ) - return $stats_cache[$key][$time]; - unset( $stats_cache[$key] ); + // Return or expire this key. + if ( isset( $stats_cache[ $key ] ) ) { + $time = key( $stats_cache[ $key ] ); + if ( time() - $time < 300 ) { + return $stats_cache[ $key ][ $time ]; + } + unset( $stats_cache[ $key ] ); } $stats_rows = array(); do { - if ( !$stats = stats_get_remote_csv( $stats_csv_url ) ) + if ( ! $stats = stats_get_remote_csv( $stats_csv_url ) ) { break; + } $labels = array_shift( $stats ); - if ( 0 === stripos( $labels[0], 'error' ) ) + if ( 0 === stripos( $labels[0], 'error' ) ) { break; + } $stats_rows = array(); - for ( $s = 0; isset( $stats[$s] ); $s++ ) { + for ( $s = 0; isset( $stats[ $s ] ); $s++ ) { $row = array(); - foreach ( $labels as $col => $label ) - $row[$label] = $stats[$s][$col]; + foreach ( $labels as $col => $label ) { + $row[ $label ] = $stats[ $s ][ $col ]; + } $stats_rows[] = $row; } - } while( 0 ); + } while ( 0 ); - // Expire old keys - foreach ( $stats_cache as $k => $cache ) - if ( !is_array( $cache ) || 300 < time() - key($cache) ) - unset( $stats_cache[$k] ); + // Expire old keys. + foreach ( $stats_cache as $k => $cache ) { + if ( ! is_array( $cache ) || 300 < time() - key( $cache ) ) { + unset( $stats_cache[ $k ] ); + } + } - // Set cache - $stats_cache[$key] = array( time() => $stats_rows ); + // Set cache. + $stats_cache[ $key ] = array( time() => $stats_rows ); update_option( 'stats_cache', $stats_cache ); return $stats_rows; } +/** + * Stats get remote CSV. + * + * @access public + * @param mixed $url URL. + * @return array + */ function stats_get_remote_csv( $url ) { $method = 'GET'; $timeout = 90; @@ -1249,28 +1566,36 @@ function stats_get_remote_csv( $url ) { $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) ); $get_code = wp_remote_retrieve_response_code( $get ); - if ( is_wp_error( $get ) || ( 2 != intval( $get_code / 100 ) && 304 != $get_code ) || empty( $get['body'] ) ) { + if ( is_wp_error( $get ) || ( 2 !== intval( $get_code / 100 ) && 304 !== $get_code ) || empty( $get['body'] ) ) { return array(); // @todo: return an error? } else { return stats_str_getcsv( $get['body'] ); } } -// rather than parsing the csv and its special cases, we create a new file and do fgetcsv on it. +/** + * Rather than parsing the csv and its special cases, we create a new file and do fgetcsv on it. + * + * @access public + * @param mixed $csv CSV. + * @return array. + */ function stats_str_getcsv( $csv ) { if ( function_exists( 'str_getcsv' ) ) { $lines = str_getcsv( $csv, "\n" ); return array_map( 'str_getcsv', $lines ); } - if ( !$temp = tmpfile() ) // tmpfile() automatically unlinks + if ( ! $temp = tmpfile() ) { // The tmpfile() automatically unlinks. return false; + } $data = array(); fwrite( $temp, $csv, strlen( $csv ) ); fseek( $temp, 0 ); - while ( false !== $row = fgetcsv( $temp, 2000 ) ) + while ( false !== $row = fgetcsv( $temp, 2000 ) ) { $data[] = $row; + } fclose( $temp ); return $data; @@ -1279,7 +1604,7 @@ function stats_str_getcsv( $csv ) { /** * Abstract out building the rest api stats path. * - * @param string $resource + * @param string $resource Resource. * @return string */ function jetpack_stats_api_path( $resource = '' ) { @@ -1291,10 +1616,10 @@ function jetpack_stats_api_path( $resource = '' ) { * Fetches stats data from the REST API. Caches locally for 5 minutes. * * @link: https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/stats/ - * - * @param array|string $args The args that are passed to the endpoint - * @param string $resource Optional sub-endpoint following /stats/ - * @return array|WP_Error + * @access public + * @param array $args (default: array()) The args that are passed to the endpoint. + * @param string $resource (default: '') Optional sub-endpoint following /stats/. + * @return array|WP_Error. */ function stats_get_from_restapi( $args = array(), $resource = '' ) { $endpoint = jetpack_stats_api_path( $resource ); @@ -1302,13 +1627,13 @@ function stats_get_from_restapi( $args = array(), $resource = '' ) { $args = wp_parse_args( $args, array() ); $cache_key = md5( implode( '|', array( $endpoint, $api_version, serialize( $args ) ) ) ); - // Get cache + // Get cache. $stats_cache = Jetpack_Options::get_option( 'restapi_stats_cache', array() ); if ( ! is_array( $stats_cache ) ) { $stats_cache = array(); } - // Return or expire this key + // Return or expire this key. if ( isset( $stats_cache[ $cache_key ] ) ) { $time = key( $stats_cache[ $cache_key ] ); if ( time() - $time < ( 5 * MINUTE_IN_SECONDS ) ) { @@ -1328,14 +1653,14 @@ function stats_get_from_restapi( $args = array(), $resource = '' ) { $data = json_decode( wp_remote_retrieve_body( $response ) ); - // Expire old keys + // Expire old keys. foreach ( $stats_cache as $k => $cache ) { if ( ! is_array( $cache ) || ( 5 * MINUTE_IN_SECONDS ) < time() - key( $cache ) ) { unset( $stats_cache[ $k ] ); } } - // Set cache + // Set cache. $stats_cache[ $cache_key ] = array( time() => $data, ); @@ -1343,3 +1668,69 @@ function stats_get_from_restapi( $args = array(), $resource = '' ) { return $data; } + +/** + * Load CSS needed for Stats column width in WP-Admin area. + * + * @since 4.7.0 + */ +function jetpack_stats_load_admin_css() { + ?> + <style type="text/css"> + .fixed .column-stats { + width: 5em; + } + </style> + <?php +} + +/** + * Set header for column that allows to go to WordPress.com to see an entry's stats. + * + * @param array $columns An array of column names. + * + * @since 4.7.0 + * + * @return mixed + */ +function jetpack_stats_post_table( $columns ) { // Adds a stats link on the edit posts page + if ( ! current_user_can( 'view_stats' ) || ! Jetpack::is_user_connected() ) { + return $columns; + } + // Array-Fu to add before comments + $pos = array_search( 'comments', array_keys( $columns ) ); + if ( ! is_int( $pos ) ) { + return $columns; + } + $chunks = array_chunk( $columns, $pos, true ); + $chunks[0]['stats'] = esc_html__( 'Stats', 'jetpack' ); + + return call_user_func_array( 'array_merge', $chunks ); +} + +/** + * Set content for cell with link to an entry's stats in WordPress.com. + * + * @param string $column The name of the column to display. + * @param int $post_id The current post ID. + * + * @since 4.7.0 + * + * @return mixed + */ +function jetpack_stats_post_table_cell( $column, $post_id ) { + if ( 'stats' == $column ) { + if ( 'publish' != get_post_status( $post_id ) ) { + printf( + '<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>', + esc_html__( 'No stats', 'jetpack' ) + ); + } else { + printf( + '<a href="%s" title="%s" class="dashicons dashicons-chart-bar" target="_blank"></a>', + esc_url( "https://wordpress.com/stats/post/$post_id/" . Jetpack::build_raw_urls( get_home_url() ) ), + esc_html__( 'View stats for this post in WordPress.com', 'jetpack' ) + ); + } + } +} diff --git a/plugins/jetpack/modules/theme-tools/content-options.php b/plugins/jetpack/modules/theme-tools/content-options.php index b8349581..5a97aee8 100644 --- a/plugins/jetpack/modules/theme-tools/content-options.php +++ b/plugins/jetpack/modules/theme-tools/content-options.php @@ -85,9 +85,9 @@ function jetpack_featured_images_get_settings() { function jetpack_featured_images_should_load() { $opts = jetpack_featured_images_get_settings(); - // If the theme doesn't support archive, post and page or if all the options are ticked, don't continue. + // If the theme doesn't support archive, post and page or if all the options are ticked and we aren't in the customizer, don't continue. if ( ( true !== $opts['archive'] && true !== $opts['post'] && true !== $opts['page'] ) - || ( 1 === $opts['archive-option'] && 1 === $opts['post-option'] && 1 === $opts['page-option'] ) ) { + || ( 1 === $opts['archive-option'] && 1 === $opts['post-option'] && 1 === $opts['page-option'] && ! is_customize_preview() ) ) { return false; } diff --git a/plugins/jetpack/modules/theme-tools/social-menu.php b/plugins/jetpack/modules/theme-tools/social-menu.php index 923d9448..feb7fada 100644 --- a/plugins/jetpack/modules/theme-tools/social-menu.php +++ b/plugins/jetpack/modules/theme-tools/social-menu.php @@ -40,26 +40,67 @@ function jetpack_social_menu_init() { // Enqueue CSS add_action( 'wp_enqueue_scripts', 'jetpack_social_menu_style' ); + + // Load SVG icons related functions and filters + if ( 'svg' === jetpack_social_menu_get_type() ) { + require( dirname( __FILE__ ) . '/social-menu/icon-functions.php' ); + } } add_action( 'after_setup_theme', 'jetpack_social_menu_init', 99 ); -/* Function to enqueue CSS */ +/** + * Return the type of menu the theme is using. + * + * @uses get_theme_support() + * @return null|string $menu_type + */ +function jetpack_social_menu_get_type() { + $options = get_theme_support( 'jetpack-social-menu' ); + + if ( empty( $options ) ) { + $menu_type = null; + } else { + $menu_type = ( in_array( $options[0], array( 'genericons', 'svg' ) ) ) ? $options[0] : 'genericons'; + } + + return $menu_type; +} + +/** + * Function to enqueue the CSS. + */ function jetpack_social_menu_style() { + $menu_type = jetpack_social_menu_get_type(); + + if ( ! $menu_type ) { + return; + } + + $deps = ( 'genericons' === $menu_type ) ? array( 'genericons' ) : null; + if ( has_nav_menu( 'jetpack-social-menu' ) ) { - wp_enqueue_style( 'jetpack-social-menu', plugins_url( 'social-menu/social-menu.css', __FILE__ ), array( 'genericons' ), '1.0' ); + wp_enqueue_style( 'jetpack-social-menu', plugins_url( 'social-menu/social-menu.css', __FILE__ ), $deps, '1.0' ); } } -/* Create the function */ +/** + * Create the function for the menu. + */ function jetpack_social_menu() { - if ( has_nav_menu( 'jetpack-social-menu' ) ) : ?> - <nav class="jetpack-social-navigation" role="navigation"> + if ( has_nav_menu( 'jetpack-social-menu' ) ) : + $menu_type = jetpack_social_menu_get_type(); + $link_after = '</span>'; + + if ( 'svg' === $menu_type ) { + $link_after .= jetpack_social_menu_get_svg( array( 'icon' => 'chain' ) ); + } ?> + <nav class="jetpack-social-navigation jetpack-social-navigation-<?php echo esc_attr( $menu_type ); ?>" role="navigation" aria-label="<?php esc_html_e( 'Social Links Menu', 'jetpack' ); ?>"> <?php wp_nav_menu( array( - 'theme_location' => 'jetpack-social-menu', - 'link_before' => '<span class="screen-reader-text">', - 'link_after' => '</span>', - 'depth' => 1, + 'theme_location' => 'jetpack-social-menu', + 'link_before' => '<span class="screen-reader-text">', + 'link_after' => $link_after, + 'depth' => 1, ) ); ?> </nav><!-- .jetpack-social-navigation --> diff --git a/plugins/jetpack/modules/theme-tools/social-menu/icon-functions.php b/plugins/jetpack/modules/theme-tools/social-menu/icon-functions.php new file mode 100644 index 00000000..45cf95e3 --- /dev/null +++ b/plugins/jetpack/modules/theme-tools/social-menu/icon-functions.php @@ -0,0 +1,161 @@ +<?php +/** + * SVG icons related functions and filters + */ + +/** + * Add SVG definitions to the footer. + */ +function jetpack_social_menu_include_svg_icons() { + // Define SVG sprite file. + $svg_icons = dirname( __FILE__ ) . '/social-menu.svg'; + + // If it exists, include it. + if ( file_exists( $svg_icons ) ) { + require_once( $svg_icons ); + } +} +add_action( 'wp_footer', 'jetpack_social_menu_include_svg_icons', 9999 ); + +/** + * Return SVG markup. + * + * @param array $args { + * Parameters needed to display an SVG. + * + * @type string $icon Required SVG icon filename. + * } + * @return string SVG markup. + */ +function jetpack_social_menu_get_svg( $args = array() ) { + // Make sure $args are an array. + if ( empty( $args ) ) { + return esc_html__( 'Please define default parameters in the form of an array.', 'jetpack' ); + } + + // Define an icon. + if ( false === array_key_exists( 'icon', $args ) ) { + return esc_html__( 'Please define an SVG icon filename.', 'jetpack' ); + } + + // Set defaults. + $defaults = array( + 'icon' => '', + 'fallback' => false, + ); + + // Parse args. + $args = wp_parse_args( $args, $defaults ); + + // Set aria hidden. + $aria_hidden = ' aria-hidden="true"'; + + // Begin SVG markup. + $svg = '<svg class="icon icon-' . esc_attr( $args['icon'] ) . '"' . $aria_hidden . ' role="img">'; + + /* + * Display the icon. + * + * The whitespace around `<use>` is intentional - it is a work around to a keyboard navigation bug in Safari 10. + * + * See https://core.trac.wordpress.org/ticket/38387. + */ + $svg .= ' <use href="#icon-' . esc_html( $args['icon'] ) . '" xlink:href="#icon-' . esc_html( $args['icon'] ) . '"></use> '; + + // Add some markup to use as a fallback for browsers that do not support SVGs. + if ( $args['fallback'] ) { + $svg .= '<span class="svg-fallback icon-' . esc_attr( $args['icon'] ) . '"></span>'; + } + + $svg .= '</svg>'; + + return $svg; +} + +/** + * Display SVG icons in social links menu. + * + * @param string $item_output The menu item output. + * @param WP_Post $item Menu item object. + * @param int $depth Depth of the menu. + * @param array $args wp_nav_menu() arguments. + * @return string $item_output The menu item output with social icon. + */ +function jetpack_social_menu_nav_menu_social_icons( $item_output, $item, $depth, $args ) { + // Get supported social icons. + $social_icons = jetpack_social_menu_social_links_icons(); + + // Change SVG icon inside social links menu if there is supported URL. + if ( 'jetpack-social-menu' === $args->theme_location ) { + foreach ( $social_icons as $attr => $value ) { + if ( false !== strpos( $item_output, $attr ) ) { + $item_output = str_replace( $args->link_after, '</span>' . jetpack_social_menu_get_svg( array( 'icon' => esc_attr( $value ) ) ), $item_output ); + } + } + } + + return $item_output; +} +add_filter( 'walker_nav_menu_start_el', 'jetpack_social_menu_nav_menu_social_icons', 10, 4 ); + +/** + * Returns an array of supported social links (URL and icon name). + * + * @return array $social_links_icons + */ +function jetpack_social_menu_social_links_icons() { + // Supported social links icons. + $social_links_icons = array( + 'amazon.cn' => 'amazon', + 'amazon.in' => 'amazon', + 'amazon.fr' => 'amazon', + 'amazon.de' => 'amazon', + 'amazon.it' => 'amazon', + 'amazon.nl' => 'amazon', + 'amazon.es' => 'amazon', + 'amazon.co' => 'amazon', + 'amazon.ca' => 'amazon', + 'amazon.com' => 'amazon', + 'apple.com' => 'apple', + 'itunes.com' => 'apple', + 'bandcamp.com' => 'bandcamp', + 'behance.net' => 'behance', + 'codepen.io' => 'codepen', + 'deviantart.com' => 'deviantart', + 'digg.com' => 'digg', + 'dribbble.com' => 'dribbble', + 'dropbox.com' => 'dropbox', + 'facebook.com' => 'facebook', + '/feed/' => 'feed', + 'flickr.com' => 'flickr', + 'foursquare.com' => 'foursquare', + 'plus.google.com' => 'google-plus', + 'google.com' => 'google', + 'github.com' => 'github', + 'instagram.com' => 'instagram', + 'linkedin.com' => 'linkedin', + 'mailto:' => 'mail', + 'medium.com' => 'medium', + 'pinterest.com' => 'pinterest', + 'getpocket.com' => 'pocket', + 'reddit.com' => 'reddit', + 'skype.com' => 'skype', + 'skype:' => 'skype', + 'slideshare.net' => 'slideshare', + 'snapchat.com' => 'snapchat', + 'soundcloud.com' => 'soundcloud', + 'spotify.com' => 'spotify', + 'stumbleupon.com' => 'stumbleupon', + 'tumblr.com' => 'tumblr', + 'twitch.tv' => 'twitch', + 'twitter.com' => 'twitter', + 'vimeo.com' => 'vimeo', + 'vk.com' => 'vk', + 'wordpress.org' => 'wordpress', + 'wordpress.com' => 'wordpress', + 'yelp.com' => 'yelp', + 'youtube.com' => 'youtube', + ); + + return $social_links_icons; +} diff --git a/plugins/jetpack/modules/theme-tools/social-menu/social-menu.css b/plugins/jetpack/modules/theme-tools/social-menu/social-menu.css index 4ad100af..543bd155 100644 --- a/plugins/jetpack/modules/theme-tools/social-menu/social-menu.css +++ b/plugins/jetpack/modules/theme-tools/social-menu/social-menu.css @@ -1,3 +1,6 @@ +/*-------------------------------------------------------------- +Global +--------------------------------------------------------------*/ .jetpack-social-navigation ul { display: block; margin: 0 0 1.5em; @@ -17,7 +20,21 @@ width: 1em; } -.jetpack-social-navigation a:before { +/*-------------------------------------------------------------- +SVG +--------------------------------------------------------------*/ +.jetpack-social-navigation-svg .icon { + color: inherit; + fill: currentColor; + height: 1em; + vertical-align: middle; + width: 1em; +} + +/*-------------------------------------------------------------- +Genericons +--------------------------------------------------------------*/ +.jetpack-social-navigation-genericons a:before { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; display: inline-block; @@ -34,147 +51,147 @@ } /* Default */ -.jetpack-social-navigation a:before { +.jetpack-social-navigation-genericons a:before { content: "\f415"; } /* CodePen */ -.jetpack-social-navigation a[href*="codepen.io"]:before { +.jetpack-social-navigation-genericons a[href*="codepen.io"]:before { content: "\f216"; } /* Digg */ -.jetpack-social-navigation a[href*="digg.com"]:before { +.jetpack-social-navigation-genericons a[href*="digg.com"]:before { content: "\f221"; } /* Dribbble */ -.jetpack-social-navigation a[href*="dribbble.com"]:before { +.jetpack-social-navigation-genericons a[href*="dribbble.com"]:before { content: "\f201"; } /* Dropbox */ -.jetpack-social-navigation a[href*="dropbox.com"]:before { +.jetpack-social-navigation-genericons a[href*="dropbox.com"]:before { content: "\f225"; } /* Email */ -.jetpack-social-navigation a[href*="mailto:"]:before { +.jetpack-social-navigation-genericons a[href*="mailto:"]:before { content: "\f410"; } /* Facebook */ -.jetpack-social-navigation a[href*="facebook.com"]:before { +.jetpack-social-navigation-genericons a[href*="facebook.com"]:before { content: "\f203"; } /* Flickr */ -.jetpack-social-navigation a[href*="flickr.com"]:before { +.jetpack-social-navigation-genericons a[href*="flickr.com"]:before { content: "\f211"; } /* Foursquare */ -.jetpack-social-navigation a[href*="foursquare.com"]:before { +.jetpack-social-navigation-genericons a[href*="foursquare.com"]:before { content: "\f226"; } /* GitHub */ -.jetpack-social-navigation a[href*="github.com"]:before { +.jetpack-social-navigation-genericons a[href*="github.com"]:before { content: "\f200"; } /* Google Plus */ -.jetpack-social-navigation a[href*="plus.google.com"]:before { +.jetpack-social-navigation-genericons a[href*="plus.google.com"]:before { content: "\f206"; } /* Instagram */ -.jetpack-social-navigation a[href*="instagram.com"]:before { +.jetpack-social-navigation-genericons a[href*="instagram.com"]:before { content: "\f215"; } /* LinkedIn */ -.jetpack-social-navigation a[href*="linkedin.com"]:before { +.jetpack-social-navigation-genericons a[href*="linkedin.com"]:before { content: "\f208"; } /* Path */ -.jetpack-social-navigation a[href*="path.com"]:before { +.jetpack-social-navigation-genericons a[href*="path.com"]:before { content: "\f219"; } /* Pinterest */ -.jetpack-social-navigation a[href*="pinterest.com"]:before { +.jetpack-social-navigation-genericons a[href*="pinterest.com"]:before { content: "\f210"; } /* Pocket */ -.jetpack-social-navigation a[href*="getpocket.com"]:before { +.jetpack-social-navigation-genericons a[href*="getpocket.com"]:before { content: "\f224"; } /* Polldaddy */ -.jetpack-social-navigation a[href*="polldaddy.com"]:before { +.jetpack-social-navigation-genericons a[href*="polldaddy.com"]:before { content: "\f217"; } /* Reddit */ -.jetpack-social-navigation a[href*="reddit.com"]:before { +.jetpack-social-navigation-genericons a[href*="reddit.com"]:before { content: "\f222"; } /* RSS Feed */ -.jetpack-social-navigation a[href$="/feed/"]:before { +.jetpack-social-navigation-genericons a[href$="/feed/"]:before { content: "\f413"; } /* Skype */ -.jetpack-social-navigation a[href*="skype:"]:before { +.jetpack-social-navigation-genericons a[href*="skype:"]:before { content: "\f220"; } /* Spotify */ -.jetpack-social-navigation a[href*="spotify.com"]:before { +.jetpack-social-navigation-genericons a[href*="spotify.com"]:before { content: "\f515"; } /* StumbleUpon */ -.jetpack-social-navigation a[href*="stumbleupon.com"]:before { +.jetpack-social-navigation-genericons a[href*="stumbleupon.com"]:before { content: "\f223"; } /* Tumblr */ -.jetpack-social-navigation a[href*="tumblr.com"]:before { +.jetpack-social-navigation-genericons a[href*="tumblr.com"]:before { content: "\f214"; } /* Twitch */ -.jetpack-social-navigation a[href*="twitch.tv"]:before { +.jetpack-social-navigation-genericons a[href*="twitch.tv"]:before { content: "\f516"; } /* Twitter */ -.jetpack-social-navigation a[href*="twitter.com"]:before { +.jetpack-social-navigation-genericons a[href*="twitter.com"]:before { content: "\f202"; } /* Vimeo */ -.jetpack-social-navigation a[href*="vimeo.com"]:before { +.jetpack-social-navigation-genericons a[href*="vimeo.com"]:before { content: "\f212"; } /* Vine */ -.jetpack-social-navigation a[href*="vine.co"]:before { +.jetpack-social-navigation-genericons a[href*="vine.co"]:before { content: "\f517"; } /* WordPress */ -.jetpack-social-navigation a[href*="wordpress.com"]:before, -.jetpack-social-navigation a[href*="wordpress.org"]:before { +.jetpack-social-navigation-genericons a[href*="wordpress.com"]:before, +.jetpack-social-navigation-genericons a[href*="wordpress.org"]:before { content: "\f205"; } /* YouTube */ -.jetpack-social-navigation a[href*="youtube.com"]:before { +.jetpack-social-navigation-genericons a[href*="youtube.com"]:before { content: "\f213"; }
\ No newline at end of file diff --git a/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg b/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg new file mode 100644 index 00000000..5dc956e1 --- /dev/null +++ b/plugins/jetpack/modules/theme-tools/social-menu/social-menu.svg @@ -0,0 +1,119 @@ +<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<defs> +<symbol id="icon-amazon" viewBox="0 0 24 24"> +<path d="M13.582,8.182C11.934,8.367,9.78,8.49,8.238,9.166c-1.781,0.769-3.03,2.337-3.03,4.644 c0,2.953,1.86,4.429,4.253,4.429c2.02,0,3.125-0.477,4.685-2.065c0.516,0.747,0.685,1.109,1.629,1.894 c0.212,0.114,0.483,0.103,0.672-0.066l0.006,0.006c0.567-0.505,1.599-1.401,2.18-1.888c0.231-0.188,0.19-0.496,0.009-0.754 c-0.52-0.718-1.072-1.303-1.072-2.634V8.305c0-1.876,0.133-3.599-1.249-4.891C15.23,2.369,13.422,2,12.04,2 C9.336,2,6.318,3.01,5.686,6.351C5.618,6.706,5.877,6.893,6.109,6.945l2.754,0.298C9.121,7.23,9.308,6.977,9.357,6.72 c0.236-1.151,1.2-1.706,2.284-1.706c0.584,0,1.249,0.215,1.595,0.738c0.398,0.584,0.346,1.384,0.346,2.061V8.182z M13.049,14.088 c-0.451,0.8-1.169,1.291-1.967,1.291c-1.09,0-1.728-0.83-1.728-2.061c0-2.42,2.171-2.86,4.227-2.86v0.615 C13.582,12.181,13.608,13.104,13.049,14.088z M20.683,19.339C18.329,21.076,14.917,22,11.979,22c-4.118,0-7.826-1.522-10.632-4.057 c-0.22-0.199-0.024-0.471,0.241-0.317c3.027,1.762,6.771,2.823,10.639,2.823c2.608,0,5.476-0.541,8.115-1.66 C20.739,18.62,21.072,19.051,20.683,19.339z M21.336,21.043c-0.194,0.163-0.379,0.076-0.293-0.139 c0.284-0.71,0.92-2.298,0.619-2.684c-0.301-0.386-1.99-0.183-2.749-0.092c-0.23,0.027-0.266-0.173-0.059-0.319 c1.348-0.946,3.555-0.673,3.811-0.356C22.925,17.773,22.599,19.986,21.336,21.043z"/> +</symbol> +<symbol id="icon-apple" viewBox="0 0 24 24"> +<path d="M20.07,17.586a10.874,10.874,0,0,1-1.075,1.933,9.822,9.822,0,0,1-1.385,1.674,2.687,2.687,0,0,1-1.78.784,4.462,4.462,0,0,1-1.644-.393,4.718,4.718,0,0,0-1.77-.391,4.878,4.878,0,0,0-1.82.391A4.9,4.9,0,0,1,9.021,22a2.53,2.53,0,0,1-1.82-.8A10.314,10.314,0,0,1,5.752,19.46,11.987,11.987,0,0,1,4.22,16.417a11.143,11.143,0,0,1-.643-3.627,6.623,6.623,0,0,1,.87-3.465A5.1,5.1,0,0,1,6.268,7.483a4.9,4.9,0,0,1,2.463-.695,5.8,5.8,0,0,1,1.9.443,6.123,6.123,0,0,0,1.511.444,9.04,9.04,0,0,0,1.675-.523,5.537,5.537,0,0,1,2.277-.4,4.835,4.835,0,0,1,3.788,1.994,4.213,4.213,0,0,0-2.235,3.827,4.222,4.222,0,0,0,1.386,3.181,4.556,4.556,0,0,0,1.385.909q-.167.483-.353.927ZM16.211,2.4a4.267,4.267,0,0,1-1.094,2.8,3.726,3.726,0,0,1-3.1,1.528A3.114,3.114,0,0,1,12,6.347a4.384,4.384,0,0,1,1.16-2.828,4.467,4.467,0,0,1,1.414-1.061A4.215,4.215,0,0,1,16.19,2a3.633,3.633,0,0,1,.021.4Z"/> +</symbol> +<symbol id="icon-bandcamp" viewBox="0 0 24 24"> +<path d="M15.27 17.289 3 17.289 8.73 6.711 21 6.711 15.27 17.289"/> +</symbol> +<symbol id="icon-behance" viewBox="0 0 24 24"> +<path d="M7.799,5.698c0.589,0,1.12,0.051,1.606,0.156c0.482,0.102,0.894,0.273,1.241,0.507c0.344,0.235,0.612,0.546,0.804,0.938 c0.188,0.387,0.281,0.871,0.281,1.443c0,0.619-0.141,1.137-0.421,1.551c-0.284,0.413-0.7,0.751-1.255,1.014 c0.756,0.218,1.317,0.601,1.689,1.146c0.374,0.549,0.557,1.205,0.557,1.975c0,0.623-0.12,1.161-0.359,1.612 c-0.241,0.457-0.569,0.828-0.973,1.114c-0.408,0.288-0.876,0.5-1.399,0.637C9.052,17.931,8.514,18,7.963,18H2V5.698H7.799 M7.449,10.668c0.481,0,0.878-0.114,1.192-0.345c0.311-0.228,0.463-0.603,0.463-1.119c0-0.286-0.051-0.523-0.152-0.707 C8.848,8.315,8.711,8.171,8.536,8.07C8.362,7.966,8.166,7.894,7.94,7.854c-0.224-0.044-0.457-0.06-0.697-0.06H4.709v2.874H7.449z M7.6,15.905c0.267,0,0.521-0.024,0.759-0.077c0.243-0.053,0.457-0.137,0.637-0.261c0.182-0.12,0.332-0.283,0.441-0.491 C9.547,14.87,9.6,14.602,9.6,14.278c0-0.633-0.18-1.084-0.533-1.357c-0.356-0.27-0.83-0.404-1.413-0.404H4.709v3.388L7.6,15.905z M16.162,15.864c0.367,0.358,0.897,0.538,1.583,0.538c0.493,0,0.92-0.125,1.277-0.374c0.354-0.248,0.571-0.514,0.654-0.79h2.155 c-0.347,1.072-0.872,1.838-1.589,2.299C19.534,18,18.67,18.23,17.662,18.23c-0.701,0-1.332-0.113-1.899-0.337 c-0.567-0.227-1.041-0.544-1.439-0.958c-0.389-0.415-0.689-0.907-0.904-1.484c-0.213-0.574-0.32-1.21-0.32-1.899 c0-0.666,0.11-1.288,0.329-1.863c0.222-0.577,0.529-1.075,0.933-1.492c0.406-0.42,0.885-0.751,1.444-0.994 c0.558-0.241,1.175-0.363,1.857-0.363c0.754,0,1.414,0.145,1.98,0.44c0.563,0.291,1.026,0.686,1.389,1.181 c0.363,0.493,0.622,1.057,0.783,1.69c0.16,0.632,0.217,1.292,0.171,1.983h-6.428C15.557,14.84,15.795,15.506,16.162,15.864 M18.973,11.184c-0.291-0.321-0.783-0.496-1.384-0.496c-0.39,0-0.714,0.066-0.973,0.2c-0.254,0.132-0.461,0.297-0.621,0.491 c-0.157,0.197-0.265,0.405-0.328,0.628c-0.063,0.217-0.101,0.413-0.111,0.587h3.98C19.478,11.969,19.265,11.509,18.973,11.184z M15.057,7.738h4.985V6.524h-4.985L15.057,7.738z"/> +</symbol> +<symbol id="icon-chain" viewBox="0 0 24 24"> +<path d="M19.647,16.706a1.134,1.134,0,0,0-.343-.833l-2.549-2.549a1.134,1.134,0,0,0-.833-.343,1.168,1.168,0,0,0-.883.392l.233.226q.2.189.264.264a2.922,2.922,0,0,1,.184.233.986.986,0,0,1,.159.312,1.242,1.242,0,0,1,.043.337,1.172,1.172,0,0,1-1.176,1.176,1.237,1.237,0,0,1-.337-.043,1,1,0,0,1-.312-.159,2.76,2.76,0,0,1-.233-.184q-.073-.068-.264-.264l-.226-.233a1.19,1.19,0,0,0-.4.895,1.134,1.134,0,0,0,.343.833L15.837,19.3a1.13,1.13,0,0,0,.833.331,1.18,1.18,0,0,0,.833-.318l1.8-1.789a1.12,1.12,0,0,0,.343-.821Zm-8.615-8.64a1.134,1.134,0,0,0-.343-.833L8.163,4.7a1.134,1.134,0,0,0-.833-.343,1.184,1.184,0,0,0-.833.331L4.7,6.473a1.12,1.12,0,0,0-.343.821,1.134,1.134,0,0,0,.343.833l2.549,2.549a1.13,1.13,0,0,0,.833.331,1.184,1.184,0,0,0,.883-.38L8.728,10.4q-.2-.189-.264-.264A2.922,2.922,0,0,1,8.28,9.9a.986.986,0,0,1-.159-.312,1.242,1.242,0,0,1-.043-.337A1.172,1.172,0,0,1,9.254,8.079a1.237,1.237,0,0,1,.337.043,1,1,0,0,1,.312.159,2.761,2.761,0,0,1,.233.184q.073.068.264.264l.226.233a1.19,1.19,0,0,0,.4-.895ZM22,16.706a3.343,3.343,0,0,1-1.042,2.488l-1.8,1.789a3.536,3.536,0,0,1-4.988-.025l-2.525-2.537a3.384,3.384,0,0,1-1.017-2.488,3.448,3.448,0,0,1,1.078-2.561l-1.078-1.078a3.434,3.434,0,0,1-2.549,1.078,3.4,3.4,0,0,1-2.5-1.029L3.029,9.794A3.4,3.4,0,0,1,2,7.294,3.343,3.343,0,0,1,3.042,4.806l1.8-1.789A3.384,3.384,0,0,1,7.331,2a3.357,3.357,0,0,1,2.5,1.042l2.525,2.537a3.384,3.384,0,0,1,1.017,2.488,3.448,3.448,0,0,1-1.078,2.561l1.078,1.078a3.551,3.551,0,0,1,5.049-.049l2.549,2.549A3.4,3.4,0,0,1,22,16.706Z"/> +</symbol> +<symbol id="icon-codepen" viewBox="0 0 24 24"> +<path d="M22.016,8.84c-0.002-0.013-0.005-0.025-0.007-0.037c-0.005-0.025-0.008-0.048-0.015-0.072 c-0.003-0.015-0.01-0.028-0.013-0.042c-0.008-0.02-0.015-0.04-0.023-0.062c-0.007-0.015-0.013-0.028-0.02-0.042 c-0.008-0.02-0.018-0.037-0.03-0.057c-0.007-0.013-0.017-0.027-0.025-0.038c-0.012-0.018-0.023-0.035-0.035-0.052 c-0.01-0.013-0.02-0.025-0.03-0.037c-0.015-0.017-0.028-0.032-0.043-0.045c-0.01-0.012-0.022-0.023-0.035-0.035 c-0.015-0.015-0.032-0.028-0.048-0.04c-0.012-0.01-0.025-0.02-0.037-0.03c-0.005-0.003-0.01-0.008-0.015-0.012l-9.161-6.096 c-0.289-0.192-0.666-0.192-0.955,0L2.359,8.237C2.354,8.24,2.349,8.245,2.344,8.249L2.306,8.277 c-0.017,0.013-0.033,0.027-0.048,0.04C2.246,8.331,2.234,8.342,2.222,8.352c-0.015,0.015-0.028,0.03-0.042,0.047 c-0.012,0.013-0.022,0.023-0.03,0.037C2.139,8.453,2.125,8.471,2.115,8.488C2.107,8.501,2.099,8.514,2.09,8.526 C2.079,8.548,2.069,8.565,2.06,8.585C2.054,8.6,2.047,8.613,2.04,8.626C2.032,8.648,2.025,8.67,2.019,8.69 c-0.005,0.013-0.01,0.027-0.013,0.042C1.999,8.755,1.995,8.778,1.99,8.803C1.989,8.817,1.985,8.828,1.984,8.84 C1.978,8.879,1.975,8.915,1.975,8.954v6.093c0,0.037,0.003,0.075,0.008,0.112c0.002,0.012,0.005,0.025,0.007,0.038 c0.005,0.023,0.008,0.047,0.015,0.072c0.003,0.015,0.008,0.028,0.013,0.04c0.007,0.022,0.013,0.042,0.022,0.063 c0.007,0.015,0.013,0.028,0.02,0.04c0.008,0.02,0.018,0.038,0.03,0.058c0.007,0.013,0.015,0.027,0.025,0.038 c0.012,0.018,0.023,0.035,0.035,0.052c0.01,0.013,0.02,0.025,0.03,0.037c0.013,0.015,0.028,0.032,0.042,0.045 c0.012,0.012,0.023,0.023,0.035,0.035c0.015,0.013,0.032,0.028,0.048,0.04l0.038,0.03c0.005,0.003,0.01,0.007,0.013,0.01 l9.163,6.095C11.668,21.953,11.833,22,12,22c0.167,0,0.332-0.047,0.478-0.144l9.163-6.095l0.015-0.01 c0.013-0.01,0.027-0.02,0.037-0.03c0.018-0.013,0.035-0.028,0.048-0.04c0.013-0.012,0.025-0.023,0.035-0.035 c0.017-0.015,0.03-0.032,0.043-0.045c0.01-0.013,0.02-0.025,0.03-0.037c0.013-0.018,0.025-0.035,0.035-0.052 c0.008-0.013,0.018-0.027,0.025-0.038c0.012-0.02,0.022-0.038,0.03-0.058c0.007-0.013,0.013-0.027,0.02-0.04 c0.008-0.022,0.015-0.042,0.023-0.063c0.003-0.013,0.01-0.027,0.013-0.04c0.007-0.025,0.01-0.048,0.015-0.072 c0.002-0.013,0.005-0.027,0.007-0.037c0.003-0.042,0.007-0.079,0.007-0.117V8.954C22.025,8.915,22.022,8.879,22.016,8.84z M12.862,4.464l6.751,4.49l-3.016,2.013l-3.735-2.492V4.464z M11.138,4.464v4.009l-3.735,2.494L4.389,8.954L11.138,4.464z M3.699,10.562L5.853,12l-2.155,1.438V10.562z M11.138,19.536l-6.749-4.491l3.015-2.011l3.735,2.492V19.536z M12,14.035L8.953,12 L12,9.966L15.047,12L12,14.035z M12.862,19.536v-4.009l3.735-2.492l3.016,2.011L12.862,19.536z M20.303,13.438L18.147,12 l2.156-1.438L20.303,13.438z"/> +</symbol> +<symbol id="icon-deviantart" viewBox="0 0 24 24"> +<path d="M 18.19 5.636 18.19 2 18.188 2 14.553 2 14.19 2.366 12.474 5.636 11.935 6 5.81 6 5.81 10.994 9.177 10.994 9.477 11.357 5.81 18.363 5.81 22 5.811 22 9.447 22 9.81 21.634 11.526 18.364 12.065 18 18.19 18 18.19 13.006 14.823 13.006 14.523 12.641 18.19 5.636z"/> +</symbol> +<symbol id="icon-digg" viewBox="0 0 24 24"> +<path d="M4.5,5.4h2.2V16H1V8.5h3.5V5.4L4.5,5.4z M4.5,14.2v-4H3.2v4H4.5z M7.6,8.5V16h2.2V8.5C9.8,8.5,7.6,8.5,7.6,8.5z M7.6,5.4 v2.2h2.2V5.4C9.8,5.4,7.6,5.4,7.6,5.4z M10.7,8.5h5.7v10.1h-5.7v-1.8h3.5V16h-3.5C10.7,16,10.7,8.5,10.7,8.5z M14.2,14.2v-4h-1.3v4 H14.2z M17.3,8.5H23v10.1h-5.7v-1.8h3.5V16h-3.5C17.3,16,17.3,8.5,17.3,8.5z M20.8,14.2v-4h-1.3v4H20.8z"/> +</symbol> +<symbol id="icon-dribbble" viewBox="0 0 24 24"> +<path d="M12,22C6.486,22,2,17.514,2,12S6.486,2,12,2c5.514,0,10,4.486,10,10S17.514,22,12,22z M20.434,13.369 c-0.292-0.092-2.644-0.794-5.32-0.365c1.117,3.07,1.572,5.57,1.659,6.09C18.689,17.798,20.053,15.745,20.434,13.369z M15.336,19.876c-0.127-0.749-0.623-3.361-1.822-6.477c-0.019,0.006-0.038,0.013-0.056,0.019c-4.818,1.679-6.547,5.02-6.701,5.334 c1.448,1.129,3.268,1.803,5.243,1.803C13.183,20.555,14.311,20.313,15.336,19.876z M5.654,17.724 c0.193-0.331,2.538-4.213,6.943-5.637c0.111-0.036,0.224-0.07,0.337-0.102c-0.214-0.485-0.448-0.971-0.692-1.45 c-4.266,1.277-8.405,1.223-8.778,1.216c-0.003,0.087-0.004,0.174-0.004,0.261C3.458,14.207,4.29,16.21,5.654,17.724z M3.639,10.264 c0.382,0.005,3.901,0.02,7.897-1.041c-1.415-2.516-2.942-4.631-3.167-4.94C5.979,5.41,4.193,7.613,3.639,10.264z M9.998,3.709 c0.236,0.316,1.787,2.429,3.187,5c3.037-1.138,4.323-2.867,4.477-3.085C16.154,4.286,14.17,3.471,12,3.471 C11.311,3.471,10.641,3.554,9.998,3.709z M18.612,6.612C18.432,6.855,17,8.69,13.842,9.979c0.199,0.407,0.389,0.821,0.567,1.237 c0.063,0.148,0.124,0.295,0.184,0.441c2.842-0.357,5.666,0.215,5.948,0.275C20.522,9.916,19.801,8.065,18.612,6.612z"/> +</symbol> +<symbol id="icon-dropbox" viewBox="0 0 24 24"> +<path d="M12,6.134L6.069,9.797L2,6.54l5.883-3.843L12,6.134z M2,13.054l5.883,3.843L12,13.459L6.069,9.797L2,13.054z M12,13.459 l4.116,3.439L22,13.054l-4.069-3.257L12,13.459z M22,6.54l-5.884-3.843L12,6.134l5.931,3.663L22,6.54z M12.011,14.2l-4.129,3.426 l-1.767-1.153v1.291l5.896,3.539l5.897-3.539v-1.291l-1.769,1.153L12.011,14.2z"/> +</symbol> +<symbol id="icon-facebook" viewBox="0 0 24 24"> +<path d="M20.007,3H3.993C3.445,3,3,3.445,3,3.993v16.013C3,20.555,3.445,21,3.993,21h8.621v-6.971h-2.346v-2.717h2.346V9.31 c0-2.325,1.42-3.591,3.494-3.591c0.993,0,1.847,0.074,2.096,0.107v2.43l-1.438,0.001c-1.128,0-1.346,0.536-1.346,1.323v1.734h2.69 l-0.35,2.717h-2.34V21h4.587C20.555,21,21,20.555,21,20.007V3.993C21,3.445,20.555,3,20.007,3z"/> +</symbol> +<symbol id="icon-feed" viewBox="0 0 24 24"> +<path d="M2,8.667V12c5.515,0,10,4.485,10,10h3.333C15.333,14.637,9.363,8.667,2,8.667z M2,2v3.333 c9.19,0,16.667,7.477,16.667,16.667H22C22,10.955,13.045,2,2,2z M4.5,17C3.118,17,2,18.12,2,19.5S3.118,22,4.5,22S7,20.88,7,19.5 S5.882,17,4.5,17z"/> +</symbol> +<symbol id="icon-flickr" viewBox="0 0 24 24"> +<path d="M6.5,7c-2.75,0-5,2.25-5,5s2.25,5,5,5s5-2.25,5-5S9.25,7,6.5,7z M17.5,7c-2.75,0-5,2.25-5,5s2.25,5,5,5s5-2.25,5-5 S20.25,7,17.5,7z"/> +</symbol> +<symbol id="icon-foursquare" viewBox="0 0 24 24"> +<path d="M17.573,2c0,0-9.197,0-10.668,0S5,3.107,5,3.805s0,16.948,0,16.948c0,0.785,0.422,1.077,0.66,1.172 c0.238,0.097,0.892,0.177,1.285-0.275c0,0,5.035-5.843,5.122-5.93c0.132-0.132,0.132-0.132,0.262-0.132h3.26 c1.368,0,1.588-0.977,1.732-1.552c0.078-0.318,0.692-3.428,1.225-6.122l0.675-3.368C19.56,2.893,19.14,2,17.573,2z M16.495,7.22 c-0.053,0.252-0.372,0.518-0.665,0.518c-0.293,0-4.157,0-4.157,0c-0.467,0-0.802,0.318-0.802,0.787v0.508 c0,0.467,0.337,0.798,0.805,0.798c0,0,3.197,0,3.528,0s0.655,0.362,0.583,0.715c-0.072,0.353-0.407,2.102-0.448,2.295 c-0.04,0.193-0.262,0.523-0.655,0.523c-0.33,0-2.88,0-2.88,0c-0.523,0-0.683,0.068-1.033,0.503 c-0.35,0.437-3.505,4.223-3.505,4.223c-0.032,0.035-0.063,0.027-0.063-0.015V4.852c0-0.298,0.26-0.648,0.648-0.648 c0,0,8.228,0,8.562,0c0.315,0,0.61,0.297,0.528,0.683L16.495,7.22z"/> +</symbol> +<symbol id="icon-google-plus" viewBox="0 0 24 24"> +<path d="M8,11h6.61c0.06,0.35,0.11,0.7,0.11,1.16c0,4-2.68,6.84-6.72,6.84c-3.87,0-7-3.13-7-7s3.13-7,7-7 c1.89,0,3.47,0.69,4.69,1.83l-1.9,1.83C10.27,8.16,9.36,7.58,8,7.58c-2.39,0-4.34,1.98-4.34,4.42S5.61,16.42,8,16.42 c2.77,0,3.81-1.99,3.97-3.02H8V11L8,11z M23,11h-2V9h-2v2h-2v2h2v2h2v-2h2"/> +</symbol> +<symbol id="icon-google" viewBox="0 0 24 24"> +<path d="M12.02,10.18v3.72v0.01h5.51c-0.26,1.57-1.67,4.22-5.5,4.22c-3.31,0-6.01-2.75-6.01-6.12s2.7-6.12,6.01-6.12 c1.87,0,3.13,0.8,3.85,1.48l2.84-2.76C16.99,2.99,14.73,2,12.03,2c-5.52,0-10,4.48-10,10s4.48,10,10,10c5.77,0,9.6-4.06,9.6-9.77 c0-0.83-0.11-1.42-0.25-2.05H12.02z"/> +</symbol> +<symbol id="icon-github" viewBox="0 0 24 24"> +<path d="M12,2C6.477,2,2,6.477,2,12c0,4.419,2.865,8.166,6.839,9.489c0.5,0.09,0.682-0.218,0.682-0.484 c0-0.236-0.009-0.866-0.014-1.699c-2.782,0.602-3.369-1.34-3.369-1.34c-0.455-1.157-1.11-1.465-1.11-1.465 c-0.909-0.62,0.069-0.608,0.069-0.608c1.004,0.071,1.532,1.03,1.532,1.03c0.891,1.529,2.341,1.089,2.91,0.833 +c0.091-0.647,0.349-1.086,0.635-1.337c-2.22-0.251-4.555-1.111-4.555-4.943c0-1.091,0.39-1.984,1.03-2.682 C6.546,8.54,6.202,7.524,6.746,6.148c0,0,0.84-0.269,2.75,1.025C10.295,6.95,11.15,6.84,12,6.836 c0.85,0.004,1.705,0.114,2.504,0.336c1.909-1.294,2.748-1.025,2.748-1.025c0.546,1.376,0.202,2.394,0.1,2.646 c0.64,0.699,1.026,1.591,1.026,2.682c0,3.841-2.337,4.687-4.565,4.935c0.359,0.307,0.679,0.917,0.679,1.852 c0,1.335-0.012,2.415-0.012,2.741c0,0.269,0.18,0.579,0.688,0.481C19.138,20.161,22,16.416,22,12C22,6.477,17.523,2,12,2z"/> +</symbol> +<symbol id="icon-instagram" viewBox="0 0 24 24"> +<path d="M12,4.622c2.403,0,2.688,0.009,3.637,0.052c0.877,0.04,1.354,0.187,1.671,0.31c0.42,0.163,0.72,0.358,1.035,0.673 c0.315,0.315,0.51,0.615,0.673,1.035c0.123,0.317,0.27,0.794,0.31,1.671c0.043,0.949,0.052,1.234,0.052,3.637 s-0.009,2.688-0.052,3.637c-0.04,0.877-0.187,1.354-0.31,1.671c-0.163,0.42-0.358,0.72-0.673,1.035 c-0.315,0.315-0.615,0.51-1.035,0.673c-0.317,0.123-0.794,0.27-1.671,0.31c-0.949,0.043-1.233,0.052-3.637,0.052 s-2.688-0.009-3.637-0.052c-0.877-0.04-1.354-0.187-1.671-0.31c-0.42-0.163-0.72-0.358-1.035-0.673 c-0.315-0.315-0.51-0.615-0.673-1.035c-0.123-0.317-0.27-0.794-0.31-1.671C4.631,14.688,4.622,14.403,4.622,12 s0.009-2.688,0.052-3.637c0.04-0.877,0.187-1.354,0.31-1.671c0.163-0.42,0.358-0.72,0.673-1.035 c0.315-0.315,0.615-0.51,1.035-0.673c0.317-0.123,0.794-0.27,1.671-0.31C9.312,4.631,9.597,4.622,12,4.622 M12,3 C9.556,3,9.249,3.01,8.289,3.054C7.331,3.098,6.677,3.25,6.105,3.472C5.513,3.702,5.011,4.01,4.511,4.511 c-0.5,0.5-0.808,1.002-1.038,1.594C3.25,6.677,3.098,7.331,3.054,8.289C3.01,9.249,3,9.556,3,12c0,2.444,0.01,2.751,0.054,3.711 c0.044,0.958,0.196,1.612,0.418,2.185c0.23,0.592,0.538,1.094,1.038,1.594c0.5,0.5,1.002,0.808,1.594,1.038 c0.572,0.222,1.227,0.375,2.185,0.418C9.249,20.99,9.556,21,12,21s2.751-0.01,3.711-0.054c0.958-0.044,1.612-0.196,2.185-0.418 c0.592-0.23,1.094-0.538,1.594-1.038c0.5-0.5,0.808-1.002,1.038-1.594c0.222-0.572,0.375-1.227,0.418-2.185 C20.99,14.751,21,14.444,21,12s-0.01-2.751-0.054-3.711c-0.044-0.958-0.196-1.612-0.418-2.185c-0.23-0.592-0.538-1.094-1.038-1.594 c-0.5-0.5-1.002-0.808-1.594-1.038c-0.572-0.222-1.227-0.375-2.185-0.418C14.751,3.01,14.444,3,12,3L12,3z M12,7.378 c-2.552,0-4.622,2.069-4.622,4.622S9.448,16.622,12,16.622s4.622-2.069,4.622-4.622S14.552,7.378,12,7.378z M12,15 c-1.657,0-3-1.343-3-3s1.343-3,3-3s3,1.343,3,3S13.657,15,12,15z M16.804,6.116c-0.596,0-1.08,0.484-1.08,1.08 s0.484,1.08,1.08,1.08c0.596,0,1.08-0.484,1.08-1.08S17.401,6.116,16.804,6.116z"/> +</symbol> +<symbol id="icon-linkedin" viewBox="0 0 24 24"> +<path d="M19.7,3H4.3C3.582,3,3,3.582,3,4.3v15.4C3,20.418,3.582,21,4.3,21h15.4c0.718,0,1.3-0.582,1.3-1.3V4.3 C21,3.582,20.418,3,19.7,3z M8.339,18.338H5.667v-8.59h2.672V18.338z M7.004,8.574c-0.857,0-1.549-0.694-1.549-1.548 c0-0.855,0.691-1.548,1.549-1.548c0.854,0,1.547,0.694,1.547,1.548C8.551,7.881,7.858,8.574,7.004,8.574z M18.339,18.338h-2.669 v-4.177c0-0.996-0.017-2.278-1.387-2.278c-1.389,0-1.601,1.086-1.601,2.206v4.249h-2.667v-8.59h2.559v1.174h0.037 c0.356-0.675,1.227-1.387,2.526-1.387c2.703,0,3.203,1.779,3.203,4.092V18.338z"/> +</symbol> +<symbol id="icon-mail" viewBox="0 0 24 24"> +<path d="M20,4H4C2.895,4,2,4.895,2,6v12c0,1.105,0.895,2,2,2h16c1.105,0,2-0.895,2-2V6C22,4.895,21.105,4,20,4z M20,8.236l-8,4.882 L4,8.236V6h16V8.236z"/> +</symbol> +<symbol id="icon-medium" viewBox="0 0 24 24"> +<path d="M20.962,7.257l-5.457,8.867l-3.923-6.375l3.126-5.08c0.112-0.182,0.319-0.286,0.527-0.286c0.05,0,0.1,0.008,0.149,0.02 c0.039,0.01,0.078,0.023,0.114,0.041l5.43,2.715l0.006,0.003c0.004,0.002,0.007,0.006,0.011,0.008 C20.971,7.191,20.98,7.227,20.962,7.257z M9.86,8.592v5.783l5.14,2.57L9.86,8.592z M15.772,17.331l4.231,2.115 C20.554,19.721,21,19.529,21,19.016V8.835L15.772,17.331z M8.968,7.178L3.665,4.527C3.569,4.479,3.478,4.456,3.395,4.456 C3.163,4.456,3,4.636,3,4.938v11.45c0,0.306,0.224,0.669,0.498,0.806l4.671,2.335c0.12,0.06,0.234,0.088,0.337,0.088 c0.29,0,0.494-0.225,0.494-0.602V7.231C9,7.208,8.988,7.188,8.968,7.178z"/> +</symbol> +<symbol id="icon-pinterest" viewBox="0 0 24 24"> +<path d="M12.289,2C6.617,2,3.606,5.648,3.606,9.622c0,1.846,1.025,4.146,2.666,4.878c0.25,0.111,0.381,0.063,0.439-0.169 c0.044-0.175,0.267-1.029,0.365-1.428c0.032-0.128,0.017-0.237-0.091-0.362C6.445,11.911,6.01,10.75,6.01,9.668 c0-2.777,2.194-5.464,5.933-5.464c3.23,0,5.49,2.108,5.49,5.122c0,3.407-1.794,5.768-4.13,5.768c-1.291,0-2.257-1.021-1.948-2.277 c0.372-1.495,1.089-3.112,1.089-4.191c0-0.967-0.542-1.775-1.663-1.775c-1.319,0-2.379,1.309-2.379,3.059 c0,1.115,0.394,1.869,0.394,1.869s-1.302,5.279-1.54,6.261c-0.405,1.666,0.053,4.368,0.094,4.604 c0.021,0.126,0.167,0.169,0.25,0.063c0.129-0.165,1.699-2.419,2.142-4.051c0.158-0.59,0.817-2.995,0.817-2.995 c0.43,0.784,1.681,1.446,3.013,1.446c3.963,0,6.822-3.494,6.822-7.833C20.394,5.112,16.849,2,12.289,2"/> +</symbol> +<symbol id="icon-pocket" viewBox="0 0 24 24"> +<path d="M21.927,4.194C21.667,3.48,20.982,3,20.222,3h-0.01h-1.721H3.839C3.092,3,2.411,3.47,2.145,4.17 C2.066,4.378,2.026,4.594,2.026,4.814v6.035l0.069,1.2c0.29,2.73,1.707,5.115,3.899,6.778c0.039,0.03,0.079,0.059,0.119,0.089 l0.025,0.018c1.175,0.859,2.491,1.441,3.91,1.727c0.655,0.132,1.325,0.2,1.991,0.2c0.615,0,1.232-0.057,1.839-0.17 c0.073-0.014,0.145-0.028,0.219-0.044c0.02-0.004,0.042-0.012,0.064-0.023c1.359-0.297,2.621-0.864,3.753-1.691l0.025-0.018 c0.04-0.029,0.08-0.058,0.119-0.089c2.192-1.664,3.609-4.049,3.898-6.778l0.069-1.2V4.814C22.026,4.605,22,4.398,21.927,4.194z M17.692,10.481l-4.704,4.512c-0.266,0.254-0.608,0.382-0.949,0.382c-0.342,0-0.684-0.128-0.949-0.382l-4.705-4.512 C5.838,9.957,5.82,9.089,6.344,8.542c0.524-0.547,1.392-0.565,1.939-0.04l3.756,3.601l3.755-3.601 c0.547-0.524,1.415-0.506,1.939,0.04C18.256,9.089,18.238,9.956,17.692,10.481z"/> +</symbol> +<symbol id="icon-reddit" viewBox="0 0 24 24"> +<path d="M22,11.816c0-1.256-1.021-2.277-2.277-2.277c-0.593,0-1.122,0.24-1.526,0.614c-1.481-0.965-3.455-1.594-5.647-1.69 l1.171-3.702l3.18,0.748c0.008,1.028,0.846,1.862,1.876,1.862c1.035,0,1.877-0.842,1.877-1.878c0-1.035-0.842-1.877-1.877-1.877 c-0.769,0-1.431,0.466-1.72,1.13l-3.508-0.826c-0.203-0.047-0.399,0.067-0.46,0.261l-1.35,4.268 c-2.316,0.038-4.411,0.67-5.97,1.671C5.368,9.765,4.853,9.539,4.277,9.539C3.021,9.539,2,10.56,2,11.816 c0,0.814,0.433,1.523,1.078,1.925c-0.037,0.221-0.061,0.444-0.061,0.672c0,3.292,4.011,5.97,8.941,5.97s8.941-2.678,8.941-5.97 c0-0.214-0.02-0.424-0.053-0.632C21.533,13.39,22,12.661,22,11.816z M18.776,4.394c0.606,0,1.1,0.493,1.1,1.1s-0.493,1.1-1.1,1.1 s-1.1-0.494-1.1-1.1S18.169,4.394,18.776,4.394z M2.777,11.816c0-0.827,0.672-1.5,1.499-1.5c0.313,0,0.598,0.103,0.838,0.269 c-0.851,0.676-1.477,1.479-1.812,2.36C2.983,12.672,2.777,12.27,2.777,11.816z M11.959,19.606c-4.501,0-8.164-2.329-8.164-5.193 S7.457,9.22,11.959,9.22s8.164,2.329,8.164,5.193S16.46,19.606,11.959,19.606z M20.636,13.001c-0.326-0.89-0.948-1.701-1.797-2.384 c0.248-0.186,0.55-0.301,0.883-0.301c0.827,0,1.5,0.673,1.5,1.5C21.223,12.299,20.992,12.727,20.636,13.001z M8.996,14.704 c-0.76,0-1.397-0.616-1.397-1.376c0-0.76,0.637-1.397,1.397-1.397c0.76,0,1.376,0.637,1.376,1.397 C10.372,14.088,9.756,14.704,8.996,14.704z M16.401,13.328c0,0.76-0.616,1.376-1.376,1.376c-0.76,0-1.399-0.616-1.399-1.376 c0-0.76,0.639-1.397,1.399-1.397C15.785,11.931,16.401,12.568,16.401,13.328z M15.229,16.708c0.152,0.152,0.152,0.398,0,0.55 c-0.674,0.674-1.727,1.002-3.219,1.002c-0.004,0-0.007-0.002-0.011-0.002c-0.004,0-0.007,0.002-0.011,0.002 c-1.492,0-2.544-0.328-3.218-1.002c-0.152-0.152-0.152-0.398,0-0.55c0.152-0.152,0.399-0.151,0.55,0 c0.521,0.521,1.394,0.775,2.669,0.775c0.004,0,0.007,0.002,0.011,0.002c0.004,0,0.007-0.002,0.011-0.002 c1.275,0,2.148-0.253,2.669-0.775C14.831,16.556,15.078,16.556,15.229,16.708z"/> +</symbol> +<symbol id="icon-skype" viewBox="0 0 24 24"> +<path d="M10.113,2.699c0.033-0.006,0.067-0.013,0.1-0.02c0.033,0.017,0.066,0.033,0.098,0.051L10.113,2.699z M2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223z M21.275,13.771 c0.007-0.035,0.011-0.071,0.018-0.106c-0.018-0.031-0.033-0.064-0.052-0.095L21.275,13.771z M13.563,21.199 c0.032,0.019,0.065,0.035,0.096,0.053c0.036-0.006,0.071-0.011,0.105-0.017L13.563,21.199z M22,16.386 c0,1.494-0.581,2.898-1.637,3.953c-1.056,1.057-2.459,1.637-3.953,1.637c-0.967,0-1.914-0.251-2.75-0.725 c0.036-0.006,0.071-0.011,0.105-0.017l-0.202-0.035c0.032,0.019,0.065,0.035,0.096,0.053c-0.543,0.096-1.099,0.147-1.654,0.147 c-1.275,0-2.512-0.25-3.676-0.743c-1.125-0.474-2.135-1.156-3.002-2.023c-0.867-0.867-1.548-1.877-2.023-3.002 c-0.493-1.164-0.743-2.401-0.743-3.676c0-0.546,0.049-1.093,0.142-1.628c0.018,0.032,0.033,0.064,0.051,0.095L2.72,10.223 c-0.006,0.034-0.011,0.069-0.017,0.103C2.244,9.5,2,8.566,2,7.615c0-1.493,0.582-2.898,1.637-3.953 c1.056-1.056,2.46-1.638,3.953-1.638c0.915,0,1.818,0.228,2.622,0.655c-0.033,0.007-0.067,0.013-0.1,0.02l0.199,0.031 c-0.032-0.018-0.066-0.034-0.098-0.051c0.002,0,0.003-0.001,0.004-0.001c0.586-0.112,1.187-0.169,1.788-0.169 c1.275,0,2.512,0.249,3.676,0.742c1.124,0.476,2.135,1.156,3.002,2.024c0.868,0.867,1.548,1.877,2.024,3.002 c0.493,1.164,0.743,2.401,0.743,3.676c0,0.575-0.054,1.15-0.157,1.712c-0.018-0.031-0.033-0.064-0.052-0.095l0.034,0.201 c0.007-0.035,0.011-0.071,0.018-0.106C21.754,14.494,22,15.432,22,16.386z M16.817,14.138c0-1.331-0.613-2.743-3.033-3.282 l-2.209-0.49c-0.84-0.192-1.807-0.444-1.807-1.237c0-0.794,0.679-1.348,1.903-1.348c2.468,0,2.243,1.696,3.468,1.696 c0.645,0,1.209-0.379,1.209-1.031c0-1.521-2.435-2.663-4.5-2.663c-2.242,0-4.63,0.952-4.63,3.488c0,1.221,0.436,2.521,2.839,3.123 l2.984,0.745c0.903,0.223,1.129,0.731,1.129,1.189c0,0.762-0.758,1.507-2.129,1.507c-2.679,0-2.307-2.062-3.743-2.062 c-0.645,0-1.113,0.444-1.113,1.078c0,1.236,1.501,2.886,4.856,2.886C15.236,17.737,16.817,16.199,16.817,14.138z"/> +</symbol> +<symbol id="icon-slideshare" viewBox="0 0 24 24"> +<path d="M11.738,10.232a2.142,2.142,0,0,1-.721,1.619,2.556,2.556,0,0,1-3.464,0,2.183,2.183,0,0,1,0-3.243,2.572,2.572,0,0,1,3.464,0A2.136,2.136,0,0,1,11.738,10.232Zm5.7,0a2.15,2.15,0,0,1-.715,1.619,2.563,2.563,0,0,1-3.469,0,2.183,2.183,0,0,1,0-3.243,2.58,2.58,0,0,1,3.469,0A2.144,2.144,0,0,1,17.439,10.232Zm2.555,2.045V4.7a2.128,2.128,0,0,0-.363-1.4,1.614,1.614,0,0,0-1.261-.415H5.742a1.656,1.656,0,0,0-1.278.386A2.246,2.246,0,0,0,4.129,4.7v7.643a8.212,8.212,0,0,0,1,.454q.516.193.92.318a6.847,6.847,0,0,0,.92.21q.516.085.806.125a6.615,6.615,0,0,0,.795.045l.665.006q.16,0,.642-.023t.506-.023a1.438,1.438,0,0,1,1.079.307,1.134,1.134,0,0,0,.114.1,7.215,7.215,0,0,0,.693.579q.079-1.033,1.34-.988.057,0,.415.017l.488.023q.13.006.517.011t.6-.011l.619-.051a5.419,5.419,0,0,0,.693-.1l.7-.153a5.353,5.353,0,0,0,.761-.221q.345-.131.766-.307a8.727,8.727,0,0,0,.818-.392Zm1.851-.057a10.4,10.4,0,0,1-4.225,2.862,6.5,6.5,0,0,1-.261,5.281,3.524,3.524,0,0,1-2.078,1.681,2.452,2.452,0,0,1-2.067-.17,1.915,1.915,0,0,1-.931-1.863l-.011-3.7V16.3l-.279-.068q-.188-.045-.267-.057l-.011,3.839a1.9,1.9,0,0,1-.943,1.863,2.481,2.481,0,0,1-2.078.17,3.519,3.519,0,0,1-2.067-1.7,6.546,6.546,0,0,1-.25-5.258A10.4,10.4,0,0,1,2.152,12.22a.56.56,0,0,1-.045-.715q.238-.3.681.011l.125.079a.767.767,0,0,1,.125.091V3.8a1.987,1.987,0,0,1,.534-1.4,1.7,1.7,0,0,1,1.295-.579H19.141a1.7,1.7,0,0,1,1.295.579,1.985,1.985,0,0,1,.534,1.4v7.882l.238-.17q.443-.307.681-.011a.56.56,0,0,1-.045.715Z"/> +</symbol> +<symbol id="icon-snapchat" viewBox="0 0 24 24"> +<path d="M12.065,2a5.526,5.526,0,0,1,3.132.892A5.854,5.854,0,0,1,17.326,5.4a5.821,5.821,0,0,1,.351,2.33q0,.612-.117,2.487a.809.809,0,0,0,.365.091,1.93,1.93,0,0,0,.664-.176,1.93,1.93,0,0,1,.664-.176,1.3,1.3,0,0,1,.729.234.7.7,0,0,1,.351.6.839.839,0,0,1-.41.7,2.732,2.732,0,0,1-.9.41,3.192,3.192,0,0,0-.9.378.728.728,0,0,0-.41.618,1.575,1.575,0,0,0,.156.56,6.9,6.9,0,0,0,1.334,1.953,5.6,5.6,0,0,0,1.881,1.315,5.875,5.875,0,0,0,1.042.3.42.42,0,0,1,.365.456q0,.911-2.852,1.341a1.379,1.379,0,0,0-.143.507,1.8,1.8,0,0,1-.182.605.451.451,0,0,1-.429.241,5.878,5.878,0,0,1-.807-.085,5.917,5.917,0,0,0-.833-.085,4.217,4.217,0,0,0-.807.065,2.42,2.42,0,0,0-.82.293,6.682,6.682,0,0,0-.755.5q-.351.267-.755.527a3.886,3.886,0,0,1-.989.436A4.471,4.471,0,0,1,11.831,22a4.307,4.307,0,0,1-1.256-.176,3.784,3.784,0,0,1-.976-.436q-.4-.26-.749-.527a6.682,6.682,0,0,0-.755-.5,2.422,2.422,0,0,0-.807-.293,4.432,4.432,0,0,0-.82-.065,5.089,5.089,0,0,0-.853.1,5,5,0,0,1-.762.1.474.474,0,0,1-.456-.241,1.819,1.819,0,0,1-.182-.618,1.411,1.411,0,0,0-.143-.521q-2.852-.429-2.852-1.341a.42.42,0,0,1,.365-.456,5.793,5.793,0,0,0,1.042-.3,5.524,5.524,0,0,0,1.881-1.315,6.789,6.789,0,0,0,1.334-1.953A1.575,1.575,0,0,0,6,12.9a.728.728,0,0,0-.41-.618,3.323,3.323,0,0,0-.9-.384,2.912,2.912,0,0,1-.9-.41.814.814,0,0,1-.41-.684.71.71,0,0,1,.338-.593,1.208,1.208,0,0,1,.716-.241,1.976,1.976,0,0,1,.625.169,2.008,2.008,0,0,0,.69.169.919.919,0,0,0,.416-.091q-.117-1.849-.117-2.474A5.861,5.861,0,0,1,6.385,5.4,5.516,5.516,0,0,1,8.625,2.819,7.075,7.075,0,0,1,12.062,2Z"/> +</symbol> +<symbol id="icon-soundcloud" viewBox="0 0 24 24"> +<path d="M8.9,16.1L9,14L8.9,9.5c0-0.1,0-0.1-0.1-0.1c0,0-0.1-0.1-0.1-0.1c-0.1,0-0.1,0-0.1,0.1c0,0-0.1,0.1-0.1,0.1L8.3,14l0.1,2.1 c0,0.1,0,0.1,0.1,0.1c0,0,0.1,0.1,0.1,0.1C8.8,16.3,8.9,16.3,8.9,16.1z M11.4,15.9l0.1-1.8L11.4,9c0-0.1,0-0.2-0.1-0.2 c0,0-0.1,0-0.1,0s-0.1,0-0.1,0c-0.1,0-0.1,0.1-0.1,0.2l0,0.1l-0.1,5c0,0,0,0.7,0.1,2v0c0,0.1,0,0.1,0.1,0.1c0.1,0.1,0.1,0.1,0.2,0.1 c0.1,0,0.1,0,0.2-0.1c0.1,0,0.1-0.1,0.1-0.2L11.4,15.9z M2.4,12.9L2.5,14l-0.2,1.1c0,0.1,0,0.1-0.1,0.1c0,0-0.1,0-0.1-0.1L2.1,14 l0.1-1.1C2.2,12.9,2.3,12.9,2.4,12.9C2.3,12.9,2.4,12.9,2.4,12.9z M3.1,12.2L3.3,14l-0.2,1.8c0,0.1,0,0.1-0.1,0.1 c-0.1,0-0.1,0-0.1-0.1L2.8,14L3,12.2C3,12.2,3,12.2,3.1,12.2C3.1,12.2,3.1,12.2,3.1,12.2z M3.9,11.9L4.1,14l-0.2,2.1 c0,0.1,0,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L3.5,14l0.2-2.1c0-0.1,0-0.1,0.1-0.1C3.9,11.8,3.9,11.8,3.9,11.9z M4.7,11.9L4.9,14 l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c-0.1,0-0.1,0-0.1-0.1L4.3,14l0.2-2.2c0-0.1,0-0.1,0.1-0.1C4.7,11.7,4.7,11.8,4.7,11.9z M5.6,12 l0.2,2l-0.2,2.1c0,0.1-0.1,0.1-0.1,0.1c0,0-0.1,0-0.1,0c0,0,0-0.1,0-0.1L5.1,14l0.2-2c0,0,0-0.1,0-0.1s0.1,0,0.1,0 C5.5,11.9,5.5,11.9,5.6,12L5.6,12z M6.4,10.7L6.6,14l-0.2,2.1c0,0,0,0.1,0,0.1c0,0-0.1,0-0.1,0c-0.1,0-0.1-0.1-0.2-0.2L5.9,14 l0.2-3.3c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0C6.4,10.7,6.4,10.7,6.4,10.7z M7.2,10l0.2,4.1l-0.2,2.1c0,0,0,0.1,0,0.1 c0,0-0.1,0-0.1,0c-0.1,0-0.2-0.1-0.2-0.2l-0.1-2.1L6.8,10c0-0.1,0.1-0.2,0.2-0.2c0,0,0.1,0,0.1,0S7.2,9.9,7.2,10z M8,9.6L8.2,14 L8,16.1c0,0.1-0.1,0.2-0.2,0.2c-0.1,0-0.2-0.1-0.2-0.2L7.5,14l0.1-4.4c0-0.1,0-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1c0.1,0,0.1,0,0.1,0.1 C8,9.6,8,9.6,8,9.6z M11.4,16.1L11.4,16.1L11.4,16.1z M9.7,9.6L9.8,14l-0.1,2.1c0,0.1,0,0.1-0.1,0.2s-0.1,0.1-0.2,0.1 c-0.1,0-0.1,0-0.1-0.1s-0.1-0.1-0.1-0.2L9.2,14l0.1-4.4c0-0.1,0-0.1,0.1-0.2s0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S9.7,9.5,9.7,9.6 L9.7,9.6z M10.6,9.8l0.1,4.3l-0.1,2c0,0.1,0,0.1-0.1,0.2c0,0-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c0,0-0.1-0.1-0.1-0.2L10,14 l0.1-4.3c0-0.1,0-0.1,0.1-0.2c0,0,0.1-0.1,0.2-0.1c0.1,0,0.1,0,0.2,0.1S10.6,9.7,10.6,9.8z M12.4,14l-0.1,2c0,0.1,0,0.1-0.1,0.2 c-0.1,0.1-0.1,0.1-0.2,0.1c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2l-0.1-1l-0.1-1l0.1-5.5v0c0-0.1,0-0.2,0.1-0.2 c0.1,0,0.1-0.1,0.2-0.1c0,0,0.1,0,0.1,0c0.1,0,0.1,0.1,0.1,0.2L12.4,14z M22.1,13.9c0,0.7-0.2,1.3-0.7,1.7c-0.5,0.5-1.1,0.7-1.7,0.7 h-6.8c-0.1,0-0.1,0-0.2-0.1c-0.1-0.1-0.1-0.1-0.1-0.2V8.2c0-0.1,0.1-0.2,0.2-0.3c0.5-0.2,1-0.3,1.6-0.3c1.1,0,2.1,0.4,2.9,1.1 c0.8,0.8,1.3,1.7,1.4,2.8c0.3-0.1,0.6-0.2,1-0.2c0.7,0,1.3,0.2,1.7,0.7C21.8,12.6,22.1,13.2,22.1,13.9L22.1,13.9z"/> +</symbol> +<symbol id="icon-spotify" viewBox="0 0 24 24"> +<path d="M12,2C6.477,2,2,6.477,2,12c0,5.523,4.477,10,10,10c5.523,0,10-4.477,10-10C22,6.477,17.523,2,12,2 M16.586,16.424 c-0.18,0.295-0.563,0.387-0.857,0.207c-2.348-1.435-5.304-1.76-8.785-0.964c-0.335,0.077-0.67-0.133-0.746-0.469 c-0.077-0.335,0.132-0.67,0.469-0.746c3.809-0.871,7.077-0.496,9.713,1.115C16.673,15.746,16.766,16.13,16.586,16.424 M17.81,13.7 c-0.226,0.367-0.706,0.482-1.072,0.257c-2.687-1.652-6.785-2.131-9.965-1.166C6.36,12.917,5.925,12.684,5.8,12.273 C5.675,11.86,5.908,11.425,6.32,11.3c3.632-1.102,8.147-0.568,11.234,1.328C17.92,12.854,18.035,13.335,17.81,13.7 M17.915,10.865 c-3.223-1.914-8.54-2.09-11.618-1.156C5.804,9.859,5.281,9.58,5.131,9.086C4.982,8.591,5.26,8.069,5.755,7.919 c3.532-1.072,9.404-0.865,13.115,1.338c0.445,0.264,0.59,0.838,0.327,1.282C18.933,10.983,18.359,11.129,17.915,10.865"/> +</symbol> +<symbol id="icon-stumbleupon" viewBox="0 0 24 24"> +<path d="M12,4.294c-2.469,0-4.471,2.002-4.471,4.471v6.353c0,0.585-0.474,1.059-1.059,1.059c-0.585,0-1.059-0.474-1.059-1.059 v-2.824H2v2.941c0,2.469,2.002,4.471,4.471,4.471c2.469,0,4.471-2.002,4.471-4.471V8.765c0-0.585,0.474-1.059,1.059-1.059 s1.059,0.474,1.059,1.059v1.294l1.412,0.647l2-0.647V8.765C16.471,6.296,14.469,4.294,12,4.294z M13.059,12.353v2.882 c0,2.469,2.002,4.471,4.471,4.471S22,17.704,22,15.235v-2.824h-3.412v2.824c0,0.585-0.474,1.059-1.059,1.059 c-0.585,0-1.059-0.474-1.059-1.059v-2.882l-2,0.647L13.059,12.353z"/> +</symbol> +<symbol id="icon-tumblr" viewBox="0 0 24 24"> +<path d="M16.749,17.396c-0.357,0.17-1.041,0.319-1.551,0.332c-1.539,0.041-1.837-1.081-1.85-1.896V9.847h3.861V6.937h-3.847V2.039 c0,0-2.77,0-2.817,0c-0.046,0-0.127,0.041-0.138,0.144c-0.165,1.499-0.867,4.13-3.783,5.181v2.484h1.945v6.282 c0,2.151,1.587,5.206,5.775,5.135c1.413-0.024,2.982-0.616,3.329-1.126L16.749,17.396z"/> +</symbol> +<symbol id="icon-twitch" viewBox="0 0 24 24"> +<path d="M16.499,8.089h-1.636v4.91h1.636V8.089z M12,8.089h-1.637v4.91H12V8.089z M4.228,3.178L3,6.451v13.092h4.499V22h2.456 l2.454-2.456h3.681L21,14.636V3.178H4.228z M19.364,13.816l-2.864,2.865H12l-2.453,2.453V16.68H5.863V4.814h13.501V13.816z"/> +</symbol> +<symbol id="icon-twitter" viewBox="0 0 24 24"> +<path d="M22.23,5.924c-0.736,0.326-1.527,0.547-2.357,0.646c0.847-0.508,1.498-1.312,1.804-2.27 c-0.793,0.47-1.671,0.812-2.606,0.996C18.324,4.498,17.257,4,16.077,4c-2.266,0-4.103,1.837-4.103,4.103 c0,0.322,0.036,0.635,0.106,0.935C8.67,8.867,5.647,7.234,3.623,4.751C3.27,5.357,3.067,6.062,3.067,6.814 c0,1.424,0.724,2.679,1.825,3.415c-0.673-0.021-1.305-0.206-1.859-0.513c0,0.017,0,0.034,0,0.052c0,1.988,1.414,3.647,3.292,4.023 c-0.344,0.094-0.707,0.144-1.081,0.144c-0.264,0-0.521-0.026-0.772-0.074c0.522,1.63,2.038,2.816,3.833,2.85 c-1.404,1.1-3.174,1.756-5.096,1.756c-0.331,0-0.658-0.019-0.979-0.057c1.816,1.164,3.973,1.843,6.29,1.843 c7.547,0,11.675-6.252,11.675-11.675c0-0.178-0.004-0.355-0.012-0.531C20.985,7.47,21.68,6.747,22.23,5.924z"/> +</symbol> +<symbol id="icon-vimeo" viewBox="0 0 24 24"> +<path d="M22.396,7.164c-0.093,2.026-1.507,4.799-4.245,8.32C15.322,19.161,12.928,21,10.97,21c-1.214,0-2.24-1.119-3.079-3.359 c-0.56-2.053-1.119-4.106-1.68-6.159C5.588,9.243,4.921,8.122,4.206,8.122c-0.156,0-0.701,0.328-1.634,0.98L1.594,7.841 c1.027-0.902,2.04-1.805,3.037-2.708C6.001,3.95,7.03,3.327,7.715,3.264c1.619-0.156,2.616,0.951,2.99,3.321 c0.404,2.557,0.685,4.147,0.841,4.769c0.467,2.121,0.981,3.181,1.542,3.181c0.435,0,1.09-0.688,1.963-2.065 c0.871-1.376,1.338-2.422,1.401-3.142c0.125-1.187-0.343-1.782-1.401-1.782c-0.498,0-1.012,0.115-1.541,0.341 c1.023-3.35,2.977-4.977,5.862-4.884C21.511,3.066,22.52,4.453,22.396,7.164z"/> +</symbol> +<symbol id="icon-vk" viewBox="0 0 24 24"> +<path d="M22,7.1c0.2,0.4-0.4,1.5-1.6,3.1c-0.2,0.2-0.4,0.5-0.7,0.9c-0.5,0.7-0.9,1.1-0.9,1.4c-0.1,0.3-0.1,0.6,0.1,0.8 c0.1,0.1,0.4,0.4,0.8,0.9h0l0,0c1,0.9,1.6,1.7,2,2.3c0,0,0,0.1,0.1,0.1c0,0.1,0,0.1,0.1,0.3c0,0.1,0,0.2,0,0.4 c0,0.1-0.1,0.2-0.3,0.3c-0.1,0.1-0.4,0.1-0.6,0.1l-2.7,0c-0.2,0-0.4,0-0.6-0.1c-0.2-0.1-0.4-0.1-0.5-0.2l-0.2-0.1 c-0.2-0.1-0.5-0.4-0.7-0.7s-0.5-0.6-0.7-0.8c-0.2-0.2-0.4-0.4-0.6-0.6C14.8,15,14.6,15,14.4,15c0,0,0,0-0.1,0c0,0-0.1,0.1-0.2,0.2 c-0.1,0.1-0.2,0.2-0.2,0.3c-0.1,0.1-0.1,0.3-0.2,0.5c-0.1,0.2-0.1,0.5-0.1,0.8c0,0.1,0,0.2,0,0.3c0,0.1-0.1,0.2-0.1,0.2l0,0.1 c-0.1,0.1-0.3,0.2-0.6,0.2h-1.2c-0.5,0-1,0-1.5-0.2c-0.5-0.1-1-0.3-1.4-0.6s-0.7-0.5-1.1-0.7s-0.6-0.4-0.7-0.6l-0.3-0.3 c-0.1-0.1-0.2-0.2-0.3-0.3s-0.4-0.5-0.7-0.9s-0.7-1-1.1-1.6c-0.4-0.6-0.8-1.3-1.3-2.2C2.9,9.4,2.5,8.5,2.1,7.5C2,7.4,2,7.3,2,7.2 c0-0.1,0-0.1,0-0.2l0-0.1c0.1-0.1,0.3-0.2,0.6-0.2l2.9,0c0.1,0,0.2,0,0.2,0.1S5.9,6.9,5.9,7L6,7c0.1,0.1,0.2,0.2,0.3,0.3 C6.4,7.7,6.5,8,6.7,8.4C6.9,8.8,7,9,7.1,9.2l0.2,0.3c0.2,0.4,0.4,0.8,0.6,1.1c0.2,0.3,0.4,0.5,0.5,0.7s0.3,0.3,0.4,0.4 c0.1,0.1,0.3,0.1,0.4,0.1c0.1,0,0.2,0,0.3-0.1c0,0,0,0,0.1-0.1c0,0,0.1-0.1,0.1-0.2c0.1-0.1,0.1-0.3,0.1-0.5c0-0.2,0.1-0.5,0.1-0.8 c0-0.4,0-0.8,0-1.3c0-0.3,0-0.5-0.1-0.8c0-0.2-0.1-0.4-0.1-0.5L9.6,7.6C9.4,7.3,9.1,7.2,8.7,7.1C8.6,7.1,8.6,7,8.7,6.9 C8.9,6.7,9,6.6,9.1,6.5c0.4-0.2,1.2-0.3,2.5-0.3c0.6,0,1,0.1,1.4,0.1c0.1,0,0.3,0.1,0.3,0.1c0.1,0.1,0.2,0.1,0.2,0.3 c0,0.1,0.1,0.2,0.1,0.3s0,0.3,0,0.5c0,0.2,0,0.4,0,0.6c0,0.2,0,0.4,0,0.7c0,0.3,0,0.6,0,0.9c0,0.1,0,0.2,0,0.4c0,0.2,0,0.4,0,0.5 c0,0.1,0,0.3,0,0.4s0.1,0.3,0.1,0.4c0.1,0.1,0.1,0.2,0.2,0.3c0.1,0,0.1,0,0.2,0c0.1,0,0.2,0,0.3-0.1c0.1-0.1,0.2-0.2,0.4-0.4 s0.3-0.4,0.5-0.7c0.2-0.3,0.5-0.7,0.7-1.1c0.4-0.7,0.8-1.5,1.1-2.3c0-0.1,0.1-0.1,0.1-0.2c0-0.1,0.1-0.1,0.1-0.1l0,0l0.1,0 c0,0,0,0,0.1,0s0.2,0,0.2,0l3,0c0.3,0,0.5,0,0.7,0S21.9,7,21.9,7L22,7.1z"/> +</symbol> +<symbol id="icon-wordpress" viewBox="0 0 24 24"> +<path d="M12.158,12.786L9.46,20.625c0.806,0.237,1.657,0.366,2.54,0.366c1.047,0,2.051-0.181,2.986-0.51 c-0.024-0.038-0.046-0.079-0.065-0.124L12.158,12.786z M3.009,12c0,3.559,2.068,6.634,5.067,8.092L3.788,8.341 C3.289,9.459,3.009,10.696,3.009,12z M18.069,11.546c0-1.112-0.399-1.881-0.741-2.48c-0.456-0.741-0.883-1.368-0.883-2.109 c0-0.826,0.627-1.596,1.51-1.596c0.04,0,0.078,0.005,0.116,0.007C16.472,3.904,14.34,3.009,12,3.009 c-3.141,0-5.904,1.612-7.512,4.052c0.211,0.007,0.41,0.011,0.579,0.011c0.94,0,2.396-0.114,2.396-0.114 C7.947,6.93,8.004,7.642,7.52,7.699c0,0-0.487,0.057-1.029,0.085l3.274,9.739l1.968-5.901l-1.401-3.838 C9.848,7.756,9.389,7.699,9.389,7.699C8.904,7.67,8.961,6.93,9.446,6.958c0,0,1.484,0.114,2.368,0.114 c0.94,0,2.397-0.114,2.397-0.114c0.485-0.028,0.542,0.684,0.057,0.741c0,0-0.488,0.057-1.029,0.085l3.249,9.665l0.897-2.996 C17.841,13.284,18.069,12.316,18.069,11.546z M19.889,7.686c0.039,0.286,0.06,0.593,0.06,0.924c0,0.912-0.171,1.938-0.684,3.22 l-2.746,7.94c2.673-1.558,4.47-4.454,4.47-7.771C20.991,10.436,20.591,8.967,19.889,7.686z M12,22C6.486,22,2,17.514,2,12 C2,6.486,6.486,2,12,2c5.514,0,10,4.486,10,10C22,17.514,17.514,22,12,22z"/> +</symbol> +<symbol id="icon-yelp" viewBox="0 0 24 24"> +<path d="M12.271,16.718v1.417q-.011,3.257-.067,3.4a.707.707,0,0,1-.569.446,4.637,4.637,0,0,1-2.024-.424A4.609,4.609,0,0,1,7.8,20.565a.844.844,0,0,1-.19-.4.692.692,0,0,1,.044-.29,3.181,3.181,0,0,1,.379-.524q.335-.412,2.019-2.409.011,0,.669-.781a.757.757,0,0,1,.44-.274.965.965,0,0,1,.552.039.945.945,0,0,1,.418.324.732.732,0,0,1,.139.468Zm-1.662-2.8a.783.783,0,0,1-.58.781l-1.339.435q-3.067.981-3.257.981a.711.711,0,0,1-.6-.4,2.636,2.636,0,0,1-.19-.836,9.134,9.134,0,0,1,.011-1.857,3.559,3.559,0,0,1,.335-1.389.659.659,0,0,1,.625-.357,22.629,22.629,0,0,1,2.253.859q.781.324,1.283.524l.937.379a.771.771,0,0,1,.4.34A.982.982,0,0,1,10.609,13.917Zm9.213,3.313a4.467,4.467,0,0,1-1.021,1.8,4.559,4.559,0,0,1-1.512,1.417.671.671,0,0,1-.7-.078q-.156-.112-2.052-3.2l-.524-.859a.761.761,0,0,1-.128-.513.957.957,0,0,1,.217-.513.774.774,0,0,1,.926-.29q.011.011,1.327.446,2.264.736,2.7.887a2.082,2.082,0,0,1,.524.229.673.673,0,0,1,.245.68Zm-7.5-7.049q.056,1.137-.6,1.361-.647.19-1.272-.792L6.237,4.08a.7.7,0,0,1,.212-.691,5.788,5.788,0,0,1,2.314-1,5.928,5.928,0,0,1,2.5-.352.681.681,0,0,1,.547.5q.034.2.245,3.407T12.327,10.181Zm7.384,1.2a.679.679,0,0,1-.29.658q-.167.112-3.67.959-.747.167-1.015.257l.011-.022a.769.769,0,0,1-.513-.044.914.914,0,0,1-.413-.357.786.786,0,0,1,0-.971q.011-.011.836-1.137,1.394-1.908,1.673-2.275a2.423,2.423,0,0,1,.379-.435A.7.7,0,0,1,17.435,8a4.482,4.482,0,0,1,1.372,1.489,4.81,4.81,0,0,1,.9,1.868v.034Z"/> +</symbol> +<symbol id="icon-youtube" viewBox="0 0 24 24"> +<path d="M21.8,8.001c0,0-0.195-1.378-0.795-1.985c-0.76-0.797-1.613-0.801-2.004-0.847c-2.799-0.202-6.997-0.202-6.997-0.202 h-0.009c0,0-4.198,0-6.997,0.202C4.608,5.216,3.756,5.22,2.995,6.016C2.395,6.623,2.2,8.001,2.2,8.001S2,9.62,2,11.238v1.517 c0,1.618,0.2,3.237,0.2,3.237s0.195,1.378,0.795,1.985c0.761,0.797,1.76,0.771,2.205,0.855c1.6,0.153,6.8,0.201,6.8,0.201 s4.203-0.006,7.001-0.209c0.391-0.047,1.243-0.051,2.004-0.847c0.6-0.607,0.795-1.985,0.795-1.985s0.2-1.618,0.2-3.237v-1.517 C22,9.62,21.8,8.001,21.8,8.001z M9.935,14.594l-0.001-5.62l5.404,2.82L9.935,14.594z"/> +</symbol> +</defs> +</svg> diff --git a/plugins/jetpack/modules/videopress/class.jetpack-videopress.php b/plugins/jetpack/modules/videopress/class.jetpack-videopress.php index 55f5a8a2..e3427936 100644 --- a/plugins/jetpack/modules/videopress/class.jetpack-videopress.php +++ b/plugins/jetpack/modules/videopress/class.jetpack-videopress.php @@ -144,18 +144,12 @@ class Jetpack_VideoPress { } if ( $this->should_override_media_uploader() ) { - // We're going to replace the standard wp-plupload with our own ... messy, I know, but as of now the - // hooks in it are not good enough for us to be able to override / add in just the code we need. - // P.S. Please don't take this as an example of good behavior, this is a temporary fix until I - // can get a more permanent action / filter system added into the core wp-plupload.js to make this - // type of override unnecessary. - wp_dequeue_script( 'wp-plupload' ); - wp_enqueue_script( 'videopress-plupload', plugins_url( 'js/videopress-plupload.js', __FILE__ ), array( - 'jquery' + 'jquery', + 'wp-plupload' ), $this->version ); diff --git a/plugins/jetpack/modules/videopress/class.videopress-cli.php b/plugins/jetpack/modules/videopress/class.videopress-cli.php index e038dff4..0963ca0f 100644 --- a/plugins/jetpack/modules/videopress/class.videopress-cli.php +++ b/plugins/jetpack/modules/videopress/class.videopress-cli.php @@ -38,7 +38,7 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) { public function cleanup_videos() { $num_cleaned = videopress_cleanup_media_library(); - WP_CLI::success( sprintf( __( 'Cleaned up a total of %d videos.', 'jetpack' ), $num_cleaned ) ); + WP_CLI::success( sprintf( _n( 'Cleaned up %d video.', 'Cleaned up a total of %d videos.', $num_cleaned, 'jetpack' ), $num_cleaned ) ); } /** @@ -59,11 +59,8 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) { if ( count( $crons ) === 0 ) { WP_CLI::success( __( 'Found no available cron jobs.', 'jetpack' ) ); - } elseif ( count( $crons ) === 1 ) { - WP_CLI::success( __( 'Found 1 available cron job.', 'jetpack' ) ); - } else { - WP_CLI::success( sprintf( __( 'Found %d available cron jobs.', 'jetpack' ), count( $crons ) ) ); + WP_CLI::success( sprintf( _n( 'Found %d available cron job.', 'Found %d available cron jobs.', count( $crons ), 'jetpack' ), count( $crons ) ) ); } foreach ( $crons as $cron_name => $cron ) { @@ -169,4 +166,4 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) { } WP_CLI::add_command( 'videopress', 'VideoPress_CLI' ); -}
\ No newline at end of file +} diff --git a/plugins/jetpack/modules/videopress/utility-functions.php b/plugins/jetpack/modules/videopress/utility-functions.php index 0bceff33..c6903165 100644 --- a/plugins/jetpack/modules/videopress/utility-functions.php +++ b/plugins/jetpack/modules/videopress/utility-functions.php @@ -545,4 +545,34 @@ function videopress_make_media_upload_path( $blog_id ) { 'https://public-api.wordpress.com/rest/v1.1/sites/%s/media/new', $blog_id ); -}
\ No newline at end of file +} + +/** + * This is a mock of the internal VideoPress method, which is meant to duplicate the functionality + * of the WPCOM API, so that the Jetpack REST API returns the same data with no modifications. + * + * @param int $blog_id Blog ID. + * @param int $post_id Post ID. + * @return bool|stdClass + */ +function video_get_info_by_blogpostid( $blog_id, $post_id ) { + $post = get_post( $post_id ); + + if ( is_wp_error( $post ) ) { + return false; + } + + if ( 'video/videopress' !== $post->post_mime_type ) { + return false; + } + + $video_info = new stdClass(); + $video_info->guid = get_post_meta( $post_id, 'videopress_guid', true ); + $video_info->finish_date_gmt = '0000-00-00 00:00:00'; + + if ( videopress_is_finished_processing( $post_id ) ) { + $video_info->finish_date_gmt = date( 'Y-m-d H:i:s' ); + } + + return $video_info; +} diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions.php b/plugins/jetpack/modules/widget-visibility/widget-conditions.php index 96bba6a7..9f65b08d 100644 --- a/plugins/jetpack/modules/widget-visibility/widget-conditions.php +++ b/plugins/jetpack/modules/widget-visibility/widget-conditions.php @@ -13,8 +13,6 @@ class Jetpack_Widget_Conditions { add_action( 'sidebar_admin_setup', array( __CLASS__, 'widget_admin_setup' ) ); add_filter( 'widget_update_callback', array( __CLASS__, 'widget_update' ), 10, 3 ); add_action( 'in_widget_form', array( __CLASS__, 'widget_conditions_admin' ), 10, 3 ); - add_action( 'wp_ajax_widget_conditions_options', array( __CLASS__, 'widget_conditions_options' ) ); - add_action( 'wp_ajax_widget_conditions_has_children', array( __CLASS__, 'widget_conditions_has_children' ) ); } else if ( ! in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) ) { add_filter( 'widget_display_callback', array( __CLASS__, 'filter_widget' ) ); add_filter( 'sidebars_widgets', array( __CLASS__, 'sidebars_widgets' ) ); @@ -30,256 +28,126 @@ class Jetpack_Widget_Conditions { } wp_enqueue_style( 'widget-conditions', plugins_url( 'widget-conditions/widget-conditions.css', __FILE__ ) ); wp_enqueue_script( 'widget-conditions', plugins_url( 'widget-conditions/widget-conditions.js', __FILE__ ), array( 'jquery', 'jquery-ui-core' ), 20140721, true ); - } - /** - * Provided a second level of granularity for widget conditions. - */ - public static function widget_conditions_options_echo( $major = '', $minor = '' ) { - if ( in_array( $major, array( 'category', 'tag' ) ) && is_numeric( $minor ) ) { - $minor = self::maybe_get_split_term( $minor, $major ); - } + // Set up a single copy of all of the data that Widget Visibility needs. + // This allows all widget conditions to reuse the same data, keeping page size down + // and eliminating the AJAX calls we used to have to use to fetch the minor rule options. + $widget_conditions_data = array(); - switch ( $major ) { - case 'category': - ?> - <option value=""><?php _e( 'All category pages', 'jetpack' ); ?></option> - <?php + $widget_conditions_data['category'] = array(); + $widget_conditions_data['category'][] = array( '', __( 'All category pages', 'jetpack' ) ); - $categories = get_categories( array( 'number' => 1000, 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => false ) ); - usort( $categories, array( __CLASS__, 'strcasecmp_name' ) ); + $categories = get_categories( array( 'number' => 1000, 'orderby' => 'count', 'order' => 'DESC' ) ); + usort( $categories, array( __CLASS__, 'strcasecmp_name' ) ); - foreach ( $categories as $category ) { - ?> - <option value="<?php echo esc_attr( $category->term_id ); ?>" <?php selected( $category->term_id, $minor ); ?>><?php echo esc_html( $category->name ); ?></option> - <?php - } - break; - case 'loggedin': - ?> - <option value="loggedin" <?php selected( 'loggedin', $minor ); ?>><?php _e( 'Logged In', 'jetpack' ); ?></option> - <option value="loggedout" <?php selected( 'loggedout', $minor ); ?>><?php _e( 'Logged Out', 'jetpack' ); ?></option> - <?php - break; - case 'author': - ?> - <option value=""><?php _e( 'All author pages', 'jetpack' ); ?></option> - <?php + foreach ( $categories as $category ) { + $widget_conditions_data['category'][] = array( (string) $category->term_id, $category->name ); + } - foreach ( get_users( array( 'orderby' => 'name', 'exclude_admin' => true ) ) as $author ) { - ?> - <option value="<?php echo esc_attr( $author->ID ); ?>" <?php selected( $author->ID, $minor ); ?>><?php echo esc_html( $author->display_name ); ?></option> - <?php - } - break; - case 'role': - global $wp_roles; + $widget_conditions_data['loggedin'] = array(); + $widget_conditions_data['loggedin'][] = array( 'loggedin', __( 'Logged In', 'jetpack' ) ); + $widget_conditions_data['loggedin'][] = array( 'loggedout', __( 'Logged Out', 'jetpack' ) ); - foreach ( $wp_roles->roles as $role_key => $role ) { - ?> - <option value="<?php echo esc_attr( $role_key ); ?>" <?php selected( $role_key, $minor ); ?> ><?php echo esc_html( $role['name'] ); ?></option> - <?php - } - break; - case 'tag': - ?> - <option value=""><?php _e( 'All tag pages', 'jetpack' ); ?></option> - <?php + $widget_conditions_data['author'] = array(); + $widget_conditions_data['author'][] = array( '', __( 'All author pages', 'jetpack' ) ); - $tags = get_tags( array( 'number' => 1000, 'orderby' => 'count', 'order' => 'DESC', 'hide_empty' => false ) ); - usort( $tags, array( __CLASS__, 'strcasecmp_name' ) ); + $authors = get_users( array( 'orderby' => 'name', 'exclude_admin' => true ) ); - foreach ( $tags as $tag ) { - ?> - <option value="<?php echo esc_attr($tag->term_id ); ?>" <?php selected( $tag->term_id, $minor ); ?>><?php echo esc_html( $tag->name ); ?></option> - <?php - } - break; - case 'date': - ?> - <option value="" <?php selected( '', $minor ); ?>><?php _e( 'All date archives', 'jetpack' ); ?></option> - <option value="day"<?php selected( 'day', $minor ); ?>><?php _e( 'Daily archives', 'jetpack' ); ?></option> - <option value="month"<?php selected( 'month', $minor ); ?>><?php _e( 'Monthly archives', 'jetpack' ); ?></option> - <option value="year"<?php selected( 'year', $minor ); ?>><?php _e( 'Yearly archives', 'jetpack' ); ?></option> - <?php - break; - case 'page': - // Previously hardcoded post type options. - if ( ! $minor ) - $minor = 'post_type-page'; - else if ( 'post' == $minor ) - $minor = 'post_type-post'; + foreach ( $authors as $author ) { + $widget_conditions_data['author'][] = array( (string) $author->ID, $author->display_name ); + } - ?> - <option value="front" <?php selected( 'front', $minor ); ?>><?php _e( 'Front page', 'jetpack' ); ?></option> - <option value="posts" <?php selected( 'posts', $minor ); ?>><?php _e( 'Posts page', 'jetpack' ); ?></option> - <option value="archive" <?php selected( 'archive', $minor ); ?>><?php _e( 'Archive page', 'jetpack' ); ?></option> - <option value="404" <?php selected( '404', $minor ); ?>><?php _e( '404 error page', 'jetpack' ); ?></option> - <option value="search" <?php selected( 'search', $minor ); ?>><?php _e( 'Search results', 'jetpack' ); ?></option> - <optgroup label="<?php esc_attr_e( 'Post type:', 'jetpack' ); ?>"> - <?php + $widget_conditions_data['role'] = array(); - $post_types = get_post_types( array( 'public' => true, '_builtin' => true ), 'objects' ); + global $wp_roles; - foreach ( $post_types as $post_type ) { - ?> - <option value="<?php echo esc_attr( 'post_type-' . $post_type->name ); ?>" <?php selected( 'post_type-' . $post_type->name, $minor ); ?>><?php echo esc_html( $post_type->labels->singular_name ); ?></option> - <?php - } + foreach ( $wp_roles->roles as $role_key => $role ) { + $widget_conditions_data['role'][] = array( (string) $role_key, $role['name'] ); + } - ?> - </optgroup> - <optgroup label="<?php esc_attr_e( 'Static page:', 'jetpack' ); ?>"> - <?php + $widget_conditions_data['tag'] = array(); + $widget_conditions_data['tag'][] = array( '', __( 'All tag pages', 'jetpack' ) ); - echo str_replace( ' value="' . esc_attr( $minor ) . '"', ' value="' . esc_attr( $minor ) . '" selected="selected"', preg_replace( '/<\/?select[^>]*?>/i', '', wp_dropdown_pages( array( 'echo' => false ) ) ) ); + $tags = get_tags( array( 'number' => 1000, 'orderby' => 'count', 'order' => 'DESC' ) ); + usort( $tags, array( __CLASS__, 'strcasecmp_name' ) ); - ?> - </optgroup> - <?php - break; - case 'taxonomy': - ?> - <option value=""><?php _e( 'All taxonomy pages', 'jetpack' ); ?></option> - <?php - $taxonomies = get_taxonomies( - /** - * Filters args passed to get_taxonomies. - * - * @see https://developer.wordpress.org/reference/functions/get_taxonomies/ - * - * @since 4.4.0 - * - * @module widget-visibility - * - * @param array $args Widget Visibility taxonomy arguments. - */ - apply_filters( 'jetpack_widget_visibility_tax_args', array( '_builtin' => false ) ), - 'objects' - ); - usort( $taxonomies, array( __CLASS__, 'strcasecmp_name' ) ); - - $parts = explode( '_tax_', $minor ); - - if ( 2 === count( $parts ) ) { - $minor_id = self::maybe_get_split_term( $parts[1], $parts[0] ); - $minor = $parts[0] . '_tax_' . $minor_id; - } + foreach ( $tags as $tag ) { + $widget_conditions_data['tag'][] = array( (string) $tag->term_id, $tag->name ); + } - foreach ( $taxonomies as $taxonomy ) { - ?> - <optgroup label="<?php esc_attr_e( $taxonomy->labels->name . ':', 'jetpack' ); ?>"> - <option value="<?php echo esc_attr( $taxonomy->name ); ?>" <?php selected( $taxonomy->name, $minor ); ?>> - <?php _e( 'All pages', 'jetpack' ); ?> - </option> - <?php + $widget_conditions_data['date'] = array(); + $widget_conditions_data['date'][] = array( '', __( 'All date archives', 'jetpack' ) ); + $widget_conditions_data['date'][] = array( 'day', __( 'Daily archives', 'jetpack' ) ); + $widget_conditions_data['date'][] = array( 'month', __( 'Monthly archives', 'jetpack' ) ); + $widget_conditions_data['date'][] = array( 'year', __( 'Yearly archives', 'jetpack' ) ); - $terms = get_terms( array( $taxonomy->name ), array( 'number' => 250, 'hide_empty' => false ) ); - foreach ( $terms as $term ) { - ?> - <option value="<?php echo esc_attr( $taxonomy->name . '_tax_' . $term->term_id ); ?>" <?php selected( $taxonomy->name . '_tax_' . $term->term_id, $minor ); ?>><?php echo esc_html( $term->name ); ?></option> - <?php - } + $widget_conditions_data['page'] = array(); + $widget_conditions_data['page'][] = array( 'front', __( 'Front page', 'jetpack' ) ); + $widget_conditions_data['page'][] = array( 'posts', __( 'Posts page', 'jetpack' ) ); + $widget_conditions_data['page'][] = array( 'archive', __( 'Archive page', 'jetpack' ) ); + $widget_conditions_data['page'][] = array( '404', __( '404 error page', 'jetpack' ) ); + $widget_conditions_data['page'][] = array( 'search', __( 'Search results', 'jetpack' ) ); - ?> - </optgroup> - <?php - } - break; + $post_types = get_post_types( array( 'public' => true ), 'objects' ); - case 'post_type': - ?> - <optgroup label="<?php echo esc_attr_x( 'Single post:', 'a heading for a list of custom post types', 'jetpack' ); ?>"> - <?php + $widget_conditions_post_types = array(); - $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ); + foreach ( $post_types as $post_type ) { + $widget_conditions_post_types[] = array( 'post_type-' . $post_type->name, $post_type->labels->singular_name ); + } - foreach ( $post_types as $post_type ) { - ?> - <option - value="<?php echo esc_attr( 'post_type-' . $post_type->name ); ?>" - <?php selected( 'post_type-' . $post_type->name, $minor ); ?>> - <?php echo esc_html( $post_type->labels->singular_name ); ?> - </option> - <?php - } + $widget_conditions_data['page'][] = array( __( 'Post type:', 'jetpack' ), $widget_conditions_post_types ); - ?> - </optgroup> - <optgroup label="<?php echo esc_attr_x( 'Archive page:', 'a heading for a list of custom post archive pages', 'jetpack' ); ?>"> - <?php + $pages_dropdown = preg_replace( '/<\/?select[^>]*?>/i', '', wp_dropdown_pages( array( 'echo' => false ) ) ); - $post_types = get_post_types( array( 'public' => true, '_builtin' => false ), 'objects' ); + preg_match_all( '/value=.([0-9]+).[^>]*>([^<]+)</', $pages_dropdown, $page_ids_and_titles, PREG_SET_ORDER ); - foreach ( $post_types as $post_type ) { - ?> - <option - value="<?php echo esc_attr( 'post_type_archive-' . $post_type->name ); ?>" - <?php selected( 'post_type_archive-' . $post_type->name, $minor ); ?>> - <?php - echo sprintf( - /* translators: %s is a plural name of the custom post type, i.e. testimonials */ - _x( - 'Archive of %s', - 'a label in the list of custom post type archive pages', - 'jetpack' - ), - $post_type->labels->name - ); - ?> - </option> - <?php - } + $static_pages = array(); - ?> - </optgroup> - <?php - break; + foreach ( $page_ids_and_titles as $page_id_and_title ) { + $static_pages[] = array( (string) $page_id_and_title[1], $page_id_and_title[2] ); } - } - /** - * This is the AJAX endpoint for the second level of conditions. - */ - public static function widget_conditions_options() { - self::widget_conditions_options_echo( $_REQUEST['major'], isset( $_REQUEST['minor'] ) ? $_REQUEST['minor'] : '' ); - die; - } + $widget_conditions_data['page'][] = array( __( 'Static page:', 'jetpack' ), $static_pages ); - /** - * Provide an option to include children of pages. - */ - public static function widget_conditions_has_children_echo( $major = '', $minor = '', $has_children = false ) { - if ( ! $major || 'page' !== $major || ! $minor ) { - return null; - } + $widget_conditions_data['taxonomy'] = array(); + $widget_conditions_data['taxonomy'][] = array( '', __( 'All taxonomy pages', 'jetpack' ) ); + + $taxonomies = get_taxonomies( array( '_builtin' => false ), 'objects' ); + usort( $taxonomies, array( __CLASS__, 'strcasecmp_name' ) ); + + foreach ( $taxonomies as $taxonomy ) { + $taxonomy_terms = get_terms( array( $taxonomy->name ), array( 'number' => 250, 'hide_empty' => false ) ); + + $widget_conditions_terms = array(); + $widget_conditions_terms[] = array( $taxonomy->name, __( 'All pages', 'jetpack' ) ); - if ( 'front' == $minor ) { - $minor = get_option( 'page_on_front' ); + foreach ( $taxonomy_terms as $term ) { + $widget_conditions_terms[] = array( $taxonomy->name . '_tax_' . $term->term_id, $term->name ); + } + + $widget_conditions_data['taxonomy'][] = array( $taxonomy->labels->name . ':', $widget_conditions_terms ); } - if ( ! is_numeric( $minor ) ) { - return null; + wp_localize_script( 'widget-conditions', 'widget_conditions_data', $widget_conditions_data ); + + // Save a list of the IDs of all pages that have children for dynamically showing the "Include children" checkbox. + $all_pages = get_pages(); + $all_parents = array(); + + foreach ( $all_pages as $page ) { + if ( $page->post_parent ) { + $all_parents[ (string) $page->post_parent ] = true; + } } - $page_children = get_pages( array( 'child_of' => (int) $minor ) ); + $front_page_id = get_option( 'page_on_front' ); - if ( $page_children ) { - ?> - <label> - <input type="checkbox" id="include_children" name="conditions[page_children][]" value="has" <?php checked( $has_children, true ); ?> /> - <?php echo esc_html_x( "Include children", 'Checkbox on Widget Visibility if choosen page has children.', 'jetpack' ); ?> - </label> - <?php + if ( isset( $all_parents[ $front_page_id ] ) ) { + $all_parents[ 'front' ] = true; } - } - /** - * This is the AJAX endpoint for the has_children input. - */ - public static function widget_conditions_has_children() { - self::widget_conditions_has_children_echo( $_REQUEST['major'], isset( $_REQUEST['minor'] ) ? $_REQUEST['minor'] : '', isset( $_REQUEST['has_children'] ) ? $_REQUEST['has_children'] : false ); - die; + wp_localize_script( 'widget-conditions', 'widget_conditions_parent_pages', $all_parents ); } /** @@ -301,8 +169,30 @@ class Jetpack_Widget_Conditions { if ( empty( $conditions['rules'] ) ) $conditions['rules'][] = array( 'major' => '', 'minor' => '', 'has_children' => '' ); + if ( empty( $conditions['match_all'] ) ) { + $conditions['match_all'] = false; + } + ?> - <div class="widget-conditional <?php if ( empty( $_POST['widget-conditions-visible'] ) || $_POST['widget-conditions-visible'] == '0' ) { ?>widget-conditional-hide<?php } ?>"> + <div + class=" + widget-conditional + <?php + if ( + empty( $_POST['widget-conditions-visible'] ) + || $_POST['widget-conditions-visible'] == '0' + ) { + ?>widget-conditional-hide<?php + } + ?> + <?php + if ( ! empty( $conditions['match_all'] ) && $conditions['match_all'] ) { + ?>intersection<?php + } else { + ?>conjunction<?php + } + ?> + "> <input type="hidden" name="widget-conditions-visible" value="<?php if ( isset( $_POST['widget-conditions-visible'] ) ) { echo esc_attr( $_POST['widget-conditions-visible'] ); } else { ?>0<?php } ?>" /> <?php if ( ! isset( $_POST['widget-conditions-visible'] ) ) { ?><a href="#" class="button display-options"><?php _e( 'Visibility', 'jetpack' ); ?></a><?php } ?> <div class="widget-conditional-inner"> @@ -313,10 +203,10 @@ class Jetpack_Widget_Conditions { <div class="conditions"> <?php - foreach ( $conditions['rules'] as $rule ) { + foreach ( $conditions['rules'] as $rule_index => $rule ) { $rule = wp_parse_args( $rule, array( 'major' => '', 'minor' => '', 'has_children' => '' ) ); ?> - <div class="condition"> + <div class="condition" data-rule-major="<?php echo esc_attr( $rule['major'] ); ?>" data-rule-minor="<?php echo esc_attr( $rule['minor'] ); ?>" data-rule-has-children="<?php echo esc_attr( $rule['has_children'] ); ?>"> <div class="selection alignleft"> <select class="conditions-rule-major" name="conditions[rules_major][]"> <option value="" <?php selected( "", $rule['major'] ); ?>><?php echo esc_html_x( '-- Select --', 'Used as the default option in a dropdown list', 'jetpack' ); ?></option> @@ -331,7 +221,6 @@ class Jetpack_Widget_Conditions { <option value="tag" <?php selected( "tag", $rule['major'] ); ?>><?php echo esc_html_x( 'Tag', 'Noun, as in: "This post has one tag."', 'jetpack' ); ?></option> <option value="date" <?php selected( "date", $rule['major'] ); ?>><?php echo esc_html_x( 'Date', 'Noun, as in: "This page is a date archive."', 'jetpack' ); ?></option> <option value="page" <?php selected( "page", $rule['major'] ); ?>><?php echo esc_html_x( 'Page', 'Example: The user is looking at a page, not a post.', 'jetpack' ); ?></option> - <option value="post_type" <?php selected( "post_type", $rule['major'] ); ?>><?php echo esc_html_x( 'Post Type', 'Example: the user is viewing a custom post type archive.', 'jetpack' ); ?></option> <?php if ( get_taxonomies( array( '_builtin' => false ) ) ) : ?> <option value="taxonomy" <?php selected( "taxonomy", $rule['major'] ); ?>><?php echo esc_html_x( 'Taxonomy', 'Noun, as in: "This post has one taxonomy."', 'jetpack' ); ?></option> <?php endif; ?> @@ -339,19 +228,30 @@ class Jetpack_Widget_Conditions { <?php _ex( 'is', 'Widget Visibility: {Rule Major [Page]} is {Rule Minor [Search results]}', 'jetpack' ); ?> - <select class="conditions-rule-minor" name="conditions[rules_minor][]" <?php if ( ! $rule['major'] ) { ?> disabled="disabled"<?php } ?> data-loading-text="<?php esc_attr_e( 'Loading...', 'jetpack' ); ?>"> - <?php self::widget_conditions_options_echo( $rule['major'], $rule['minor'] ); ?> + <select class="conditions-rule-minor" name="conditions[rules_minor][]" <?php if ( ! $rule['major'] ) { ?> disabled="disabled"<?php } ?>> + <?php /* Include the currently selected value so that if the widget is saved without + expanding the Visibility section, we don't lose the minor part of the rule. + If it is opened, this list is cleared out and populated with all the values. */ ?> + <option value="<?php echo esc_attr( $rule['minor'] ); ?>" selected="selected"></option> </select> - <span class="conditions-rule-has-children"> - <?php self::widget_conditions_has_children_echo( $rule['major'], $rule['minor'], $rule['has_children'] ); ?> + <span class="conditions-rule-has-children" <?php if ( ! $rule['has_children'] ) { ?> style="display: none;"<?php } ?>> + <label> + <input type="checkbox" name="conditions[page_children][<?php echo $rule_index; ?>]" value="has" <?php checked( $rule['has_children'], true ); ?> /> + <?php echo esc_html_x( "Include children", 'Checkbox on Widget Visibility if children of the selected page should be included in the visibility rule.', 'jetpack' ); ?> + </label> </span> </div> <div class="condition-control"> - <span class="condition-conjunction"><?php echo esc_html_x( 'or', 'Shown between widget visibility conditions.', 'jetpack' ); ?></span> + <span class="condition-conjunction"> + <?php echo esc_html_x( 'or', 'Shown between widget visibility conditions.', 'jetpack' ); ?> + </span> + <span class="condition-intersection"> + <?php echo esc_html_x( 'and', 'Shown between widget visibility conditions.', 'jetpack' ); ?> + </span> <div class="actions alignright"> - <a href="#" class="delete-condition"><?php esc_html_e( 'Delete', 'jetpack' ); ?></a> | <a href="#" class="add-condition"><?php esc_html_e( 'Add', 'jetpack' ); ?></a> + <a href="#" class="delete-condition dashicons dashicons-no"><?php esc_html_e( 'Delete', 'jetpack' ); ?></a><a href="#" class="add-condition dashicons dashicons-plus"><?php esc_html_e( 'Add', 'jetpack' ); ?></a> </div> </div> @@ -361,6 +261,19 @@ class Jetpack_Widget_Conditions { ?> </div><!-- .conditions --> + <div class="conditions"> + <div class="condition-top"> + <label> + <input + type="checkbox" + name="conditions[match_all]" + value="1" + class="conditions-match-all" + <?php checked( $conditions['match_all'], '1' ); ?> /> + <?php esc_html_e( 'Match all conditions', 'jetpack' ); ?> + </label> + </div><!-- .condition-top --> + </div><!-- .conditions --> </div><!-- .widget-conditional-inner --> </div><!-- .widget-conditional --> <?php @@ -380,6 +293,7 @@ class Jetpack_Widget_Conditions { $conditions = array(); $conditions['action'] = $_POST['conditions']['action']; + $conditions['match_all'] = ( isset( $_POST['conditions']['match_all'] ) ? '1' : '0' ); $conditions['rules'] = array(); foreach ( $_POST['conditions']['rules_major'] as $index => $major_rule ) { @@ -519,6 +433,7 @@ class Jetpack_Widget_Conditions { $condition_result = false; foreach ( $instance['conditions']['rules'] as $rule ) { + $condition_result = false; $condition_key = self::generate_condition_key( $rule ); if ( isset( $condition_result_cache[ $condition_key ] ) ) { @@ -590,35 +505,52 @@ class Jetpack_Widget_Conditions { } break; case 'tag': - if ( ! $rule['minor'] && is_tag() ) { - $condition_result = true; - } else { - $rule['minor'] = self::maybe_get_split_term( $rule['minor'], $rule['major'] ); - if ( is_singular() && $rule['minor'] && has_tag( $rule['minor'] ) ) { + // All tag pages. + if( ! $rule['minor'] ) { + if ( is_tag() ) { $condition_result = true; - } else { - $tag = get_tag( $rule['minor'] ); - if ( $tag && ! is_wp_error( $tag ) && is_tag( $tag->slug ) ) { + } else if ( is_singular() ) { + if( in_array( 'post_tag', get_post_taxonomies() ) ) { $condition_result = true; } } + break; + } + + // All pages with the specified tag term. + if ( is_tag( $rule['minor'] ) ) { + $condition_result = true; + } + else if ( is_singular() && has_term( $rule['minor'], 'post_tag' ) ) { + $condition_result = true; } break; case 'category': - if ( ! $rule['minor'] && is_category() ) { - $condition_result = true; - } else { - $rule['minor'] = self::maybe_get_split_term( $rule['minor'], $rule['major'] ); - if ( is_category( $rule['minor'] ) ) { - $condition_result = true; - } else if ( is_singular() && $rule['minor'] && in_array( 'category', get_post_taxonomies() ) && has_category( $rule['minor'] ) ) + // All category pages. + if( ! $rule['minor'] ) { + if ( is_category() ) { $condition_result = true; + } + else if ( is_singular() ) { + if( in_array( 'category', get_post_taxonomies() ) ) { + $condition_result = true; + } + } + break; + } + + // All pages with the specified category term. + if ( is_category( $rule['minor'] ) ) { + $condition_result = true; + } + else if ( is_singular() && has_term( $rule['minor'], 'category' ) ) { + $condition_result = true; } break; case 'loggedin': $condition_result = is_user_logged_in(); if ( 'loggedin' !== $rule['minor'] ) { - $condition_result = ! $condition_result; + $condition_result = ! $condition_result; } break; case 'author': @@ -654,19 +586,45 @@ class Jetpack_Widget_Conditions { } break; case 'taxonomy': + // All taxonomy pages. + if( ! $rule['minor'] ) { + if ( is_archive() ) { + if ( is_tag() || is_category() || is_tax() ) { + $condition_result = true; + } + } + else if ( is_singular() ) { + $post_taxonomies = get_post_taxonomies(); + $condition_result = ! empty( $post_taxonomies ); + } + break; + } + + // Specified taxonomy page. $term = explode( '_tax_', $rule['minor'] ); // $term[0] = taxonomy name; $term[1] = term id if ( isset( $term[0] ) && isset( $term[1] ) ) { $term[1] = self::maybe_get_split_term( $term[1], $term[0] ); } - if ( isset( $term[1] ) && is_tax( $term[0], $term[1] ) ) - $condition_result = true; - else if ( isset( $term[1] ) && is_singular() && $term[1] && has_term( $term[1], $term[0] ) ) - $condition_result = true; - else if ( is_singular() && $post_id = get_the_ID() ){ - $terms = get_the_terms( $post_id, $rule['minor'] ); // Does post have terms in taxonomy? - if( $terms && ! is_wp_error( $terms ) ) { + + // All pages of the specified taxonomy. + if ( ! isset( $term[1] ) || ! $term[1] ) { + if ( is_tax( $term[0] ) ) { $condition_result = true; } + else if ( is_singular() ) { + if( in_array( $term[0], get_post_taxonomies() ) ) { + $condition_result = true; + } + } + break; + } + + // All pages with the specified taxonomy term. + if ( is_tax( $term[0], $term[1] ) ) { + $condition_result = true; + } + else if ( is_singular() && has_term( $term[1], $term[0] ) ) { + $condition_result = true; } break; } @@ -679,12 +637,38 @@ class Jetpack_Widget_Conditions { } } - if ( $condition_result ) + if ( + isset( $instance['conditions']['match_all'] ) + && $instance['conditions']['match_all'] == '1' + && ! $condition_result + ) { + + // In case the match_all flag was set we quit on first failed condition break; + } elseif ( + ( + empty( $instance['conditions']['match_all'] ) + || $instance['conditions']['match_all'] !== '1' + ) + && $condition_result + ) { + + // Only quit on first condition if the match_all flag was not set + break; + } } - if ( ( 'show' == $instance['conditions']['action'] && ! $condition_result ) || ( 'hide' == $instance['conditions']['action'] && $condition_result ) ) + if ( + ( + 'show' == $instance['conditions']['action'] + && ! $condition_result + ) || ( + 'hide' == $instance['conditions']['action'] + && $condition_result + ) + ) { return false; + } return $instance; } diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.css b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.css index 7930495f..d2770de6 100644 --- a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.css +++ b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.css @@ -32,9 +32,12 @@ } .widget-conditional .condition { padding-top: 12px; + position: relative; } .widget-conditional .condition select { width: 120px; + position: relative; + z-index: 2; } .widget-conditional .condition-top select { width: auto; @@ -45,19 +48,48 @@ margin-top: -20px; } .widget-conditional .selection { - margin-left: 70px; + margin-left: 50px; + margin-right: 20px; } .widget-conditional .conditions-rule-has-children { display: block; } .widget-conditional .condition .actions { margin-top: -28px; +}.widget-conditional .condition .actions { + margin-top: -28px; } .widget-conditional .condition-control a { text-decoration: none; + position: absolute; + top: 17px; + text-indent: -9999px; + z-index: 1; +} +.widget-conditional .condition-control a:before { + position: absolute; + text-indent: 0; + right: 0; +} +.widget-conditional .condition-control .delete-condition { + right: 0; + color: #f11; +} +.widget-conditional .condition-control .add-condition { + left: 0; } -.widget-conditional .condition:last-child .condition-conjunction { + +.widget-conditional .condition:last-child .condition-conjunction, +.widget-conditional .condition:last-child .condition-intersection { + display: none; +} + +.widget-conditional.conjunction .condition-intersection { + display: none; +} + +.widget-conditional.intersection .condition-conjunction { display: none; } @@ -73,3 +105,11 @@ max-width: none; height: auto; } +.wp-customizer .widget-conditional .condition-control a { + top: 15px; +} +@media screen and ( max-width: 782px ) { + .widget-conditional .condition-control a { + top: 20px; + } +} diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.min.css b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.min.css index 4b07b152..51338f69 100644 --- a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.min.css +++ b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions-rtl.min.css @@ -1 +1 @@ -.widget-conditional .condition-control a,.wp-core-ui .button.display-options:hover{text-decoration:none}.wp-customizer .expanded .widget-conditional .widget-conditional-inner{width:98%;box-sizing:border-box}.wp-customizer .expanded .widget-conditional .form{overflow:scroll;margin-bottom:20px}.widget-liquid-right .widget.expanded{overflow:visible}.widget-conditional-hide{display:none}.widget-conditional .widget-conditional-inner{background:#F9F9F9;border:1px solid #DFDFDF;padding:12px 10px 0}.widget-conditional,.widget-conditional .conditions{margin-bottom:12px}.widget-conditional .condition,.widget-conditional .condition-top{clear:both}.widget-conditional .condition{padding-top:12px}.widget-conditional .condition select{width:120px}.widget-conditional .condition-top select{width:auto}.widget-conditional .condition-control{padding-top:4px;clear:both;margin-top:-20px}.widget-conditional .selection{margin-left:70px}.widget-conditional .conditions-rule-has-children{display:block}.widget-conditional .condition .actions{margin-top:-28px}.widget-conditional .condition:last-child .condition-conjunction{display:none}.wp-core-ui .button.display-options{margin-left:5px}.wp-customizer .widget-conditional select{min-width:0;max-width:none;height:auto}
\ No newline at end of file +.wp-customizer .expanded .widget-conditional .widget-conditional-inner{width:98%;box-sizing:border-box}.wp-customizer .expanded .widget-conditional .form{overflow:scroll;margin-bottom:20px}.widget-liquid-right .widget.expanded{overflow:visible}.widget-conditional-hide{display:none}.widget-conditional .widget-conditional-inner{background:#f9f9f9;border:1px solid #dfdfdf;padding:12px 10px 0}.widget-conditional{margin-bottom:12px}.widget-conditional .conditions{margin-bottom:12px}.widget-conditional .condition,.widget-conditional .condition-top{clear:both}.widget-conditional .condition{padding-top:12px;position:relative}.widget-conditional .condition select{width:120px;position:relative;z-index:2}.widget-conditional .condition-top select{width:auto}.widget-conditional .condition-control{padding-top:4px;clear:both;margin-top:-20px}.widget-conditional .selection{margin-left:50px;margin-right:20px}.widget-conditional .conditions-rule-has-children{display:block}.widget-conditional .condition .actions{margin-top:-28px}.widget-conditional .condition .actions{margin-top:-28px}.widget-conditional .condition-control a{text-decoration:none;position:absolute;top:17px;text-indent:-9999px;z-index:1}.widget-conditional .condition-control a:before{position:absolute;text-indent:0;right:0}.widget-conditional .condition-control .delete-condition{right:0;color:#f11}.widget-conditional .condition-control .add-condition{left:0}.widget-conditional .condition:last-child .condition-conjunction,.widget-conditional .condition:last-child .condition-intersection{display:none}.widget-conditional.conjunction .condition-intersection{display:none}.widget-conditional.intersection .condition-conjunction{display:none}.wp-core-ui .button.display-options{margin-left:5px}.wp-core-ui .button.display-options:hover{text-decoration:none}.wp-customizer .widget-conditional select{min-width:0;max-width:none;height:auto}.wp-customizer .widget-conditional .condition-control a{top:15px}@media screen and (max-width:782px){.widget-conditional .condition-control a{top:20px}}
\ No newline at end of file diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.css b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.css index 7e9bc3fd..264abe9b 100644 --- a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.css +++ b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.css @@ -33,9 +33,12 @@ } .widget-conditional .condition { padding-top: 12px; + position: relative; } .widget-conditional .condition select { width: 120px; + position: relative; + z-index: 2; } .widget-conditional .condition-top select { width: auto; @@ -46,19 +49,48 @@ margin-top: -20px; } .widget-conditional .selection { - margin-right: 70px; + margin-right: 50px; + margin-left: 20px; } .widget-conditional .conditions-rule-has-children { display: block; } .widget-conditional .condition .actions { margin-top: -28px; +}.widget-conditional .condition .actions { + margin-top: -28px; } .widget-conditional .condition-control a { text-decoration: none; + position: absolute; + top: 17px; + text-indent: -9999px; + z-index: 1; +} +.widget-conditional .condition-control a:before { + position: absolute; + text-indent: 0; + left: 0; +} +.widget-conditional .condition-control .delete-condition { + left: 0; + color: #f11; +} +.widget-conditional .condition-control .add-condition { + right: 0; } -.widget-conditional .condition:last-child .condition-conjunction { + +.widget-conditional .condition:last-child .condition-conjunction, +.widget-conditional .condition:last-child .condition-intersection { + display: none; +} + +.widget-conditional.conjunction .condition-intersection { + display: none; +} + +.widget-conditional.intersection .condition-conjunction { display: none; } @@ -74,3 +106,11 @@ max-width: none; height: auto; } +.wp-customizer .widget-conditional .condition-control a { + top: 15px; +} +@media screen and ( max-width: 782px ) { + .widget-conditional .condition-control a { + top: 20px; + } +} diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js index 34dc4dd9..9217e67a 100644 --- a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js +++ b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.js @@ -1,6 +1,8 @@ /* jshint onevar: false, smarttabs: true */ -/* global ajaxurl */ /* global isRtl */ +/* global widget_conditions_parent_pages */ +/* global widget_conditions_data */ +/* global jQuery */ jQuery( function( $ ) { var widgets_shell = $( 'div#widgets-right' ); @@ -10,10 +12,12 @@ jQuery( function( $ ) { } function setWidgetMargin( $widget ) { + var currentWidth, + extra; if ( $( 'body' ).hasClass( 'wp-customizer' ) ) { // set the inside widget 2 top this way we can see the widget settings - $widget.find('.widget-inside').css( 'top', 0 ); + $widget.find( '.widget-inside' ).css( 'top', 0 ); return; } @@ -27,23 +31,20 @@ jQuery( function( $ ) { $widget.data( 'original-style', $widget.attr( 'style' ) ); } - var currentWidth = $widget.width(); + currentWidth = $widget.width(); if ( currentWidth < 400 ) { - var extra = 400 - currentWidth; - if( isRtl ) { + extra = 400 - currentWidth; + if ( isRtl ) { $widget.css( 'position', 'relative' ).css( 'right', '-' + extra + 'px' ).css( 'width', '400px' ); } else { $widget.css( 'position', 'relative' ).css( 'left', '-' + extra + 'px' ).css( 'width', '400px' ); } - } - } - else if ( $widget.data( 'original-style' ) ) { + } else if ( $widget.data( 'original-style' ) ) { // Restore any original inline styles when visibility is toggled off. $widget.attr( 'style', $widget.data( 'original-style' ) ).data( 'original-style', null ); - } - else { + } else { $widget.removeAttr( 'style' ); } } @@ -73,22 +74,24 @@ jQuery( function( $ ) { } ); widgets_shell.on( 'click.widgetconditions', 'a.add-condition', function( e ) { - e.preventDefault(); - var $condition = $( this ).closest( 'div.condition' ), - $conditionClone = $condition.clone().insertAfter( $condition ); + $conditionClone = $condition.clone().data( 'rule-major', '' ).data( 'rule-minor', '' ).data( 'has-children','' ).insertAfter( $condition ); + + e.preventDefault(); $conditionClone.find( 'select.conditions-rule-major' ).val( '' ); $conditionClone.find( 'select.conditions-rule-minor' ).html( '' ).attr( 'disabled' ); - $conditionClone.find( 'span.conditions-rule-has-children' ).hide().html( '' ); - } ); + $conditionClone.find( 'span.conditions-rule-has-children' ).hide().find( 'input[type="checkbox"]' ).removeAttr( 'checked' ); - widgets_shell.on( 'click.widgetconditions', 'a.display-options', function ( e ) { - e.preventDefault(); + resetRuleIndexes( $conditionClone.closest( '.conditions' ) ); + } ); + widgets_shell.on( 'click.widgetconditions', 'a.display-options', function( e ) { var $displayOptionsButton = $( this ), $widget = $displayOptionsButton.closest( 'div.widget' ); + e.preventDefault(); + $widget.find( 'div.widget-conditional' ).toggleClass( 'widget-conditional-hide' ); $( this ).toggleClass( 'active' ); $widget.toggleClass( 'expanded' ); @@ -96,23 +99,27 @@ jQuery( function( $ ) { if ( $( this ).hasClass( 'active' ) ) { $widget.find( 'input[name=widget-conditions-visible]' ).val( '1' ); + $widget.find( '.condition' ).each( function() { + buildMinorConditions( $( this ) ); + } ); } else { $widget.find( 'input[name=widget-conditions-visible]' ).val( '0' ); } - } ); widgets_shell.on( 'click.widgetconditions', 'a.delete-condition', function( e ) { - e.preventDefault(); - var $condition = $( this ).closest( 'div.condition' ); + e.preventDefault(); + if ( $condition.is( ':first-child' ) && $condition.is( ':last-child' ) ) { $( this ).closest( 'div.widget' ).find( 'a.display-options' ).click(); $condition.find( 'select.conditions-rule-major' ).val( '' ).change(); } else { $condition.detach(); } + + resetRuleIndexes( $condition.closest( '.conditions' ) ); } ); widgets_shell.on( 'click.widgetconditions', 'div.widget-top', function() { @@ -130,49 +137,119 @@ jQuery( function( $ ) { } } ); + widgets_shell.on( 'change.widgetconditions', 'input.conditions-match-all', function() { + $( this ).parents( '.widget-conditional' ) + .toggleClass( 'conjunction' ) + .toggleClass( 'intersection' ); + } ); + $( document ).on( 'change.widgetconditions', 'select.conditions-rule-major', function() { - var $conditionsRuleMajor = $ ( this ), + var $conditionsRuleMajor = $( this ), $conditionsRuleMinor = $conditionsRuleMajor.siblings( 'select.conditions-rule-minor:first' ), - $conditionsRuleHasChildren = $conditionsRuleMajor.siblings( 'span.conditions-rule-has-children' ); - - if ( $conditionsRuleMajor.val() ) { - if ( $conditionsRuleMajor.val() !== 'page' ){ - $conditionsRuleHasChildren.hide().html( '' ); - } + $conditionsRuleHasChildren = $conditionsRuleMajor.siblings( 'span.conditions-rule-has-children' ), + $condition = $conditionsRuleMinor.closest( '.condition' ); - $conditionsRuleMinor.html( '' ).append( $( '<option/>' ).text( $conditionsRuleMinor.data( 'loading-text' ) ) ); + $condition.data( 'rule-minor', '' ).data( 'rule-major', $conditionsRuleMajor.val() ); - var data = { - action: 'widget_conditions_options', - major: $conditionsRuleMajor.val() - }; - - jQuery.post( ajaxurl, data, function( html ) { - $conditionsRuleMinor.html( html ).removeAttr( 'disabled' ); - } ); + if ( $conditionsRuleMajor.val() ) { + buildMinorConditions( $condition ); } else { $conditionsRuleMajor.siblings( 'select.conditions-rule-minor' ).attr( 'disabled', 'disabled' ).html( '' ); - $conditionsRuleHasChildren.hide().html( '' ); + $conditionsRuleHasChildren.hide().find( 'input[type="checkbox"]' ).removeAttr( 'checked' ); } } ); $( document ).on( 'change.widgetconditions', 'select.conditions-rule-minor', function() { - var $conditionsRuleMinor = $ ( this ), + var $conditionsRuleMinor = $( this ), $conditionsRuleMajor = $conditionsRuleMinor.siblings( 'select.conditions-rule-major' ), - $conditionsRuleHasChildren = $conditionsRuleMinor.siblings( 'span.conditions-rule-has-children' ); + $conditionsRuleHasChildren = $conditionsRuleMinor.siblings( 'span.conditions-rule-has-children' ), + $condition = $conditionsRuleMinor.closest( '.condition' ); + + $condition.data( 'rule-minor', $conditionsRuleMinor.val() ); if ( $conditionsRuleMajor.val() === 'page' ) { - var data = { - action: 'widget_conditions_has_children', - major: $conditionsRuleMajor.val(), - minor: $conditionsRuleMinor.val() - }; - - jQuery.post( ajaxurl, data, function( html ) { - $conditionsRuleHasChildren.html( html ).show(); - } ); + if ( $conditionsRuleMinor.val() in widget_conditions_parent_pages ) { + $conditionsRuleHasChildren.show(); + } else { + $conditionsRuleHasChildren.hide().find( 'input[type="checkbox"]' ).removeAttr( 'checked' ); + } } else { - $conditionsRuleHasChildren.hide().html( '' ); + $conditionsRuleHasChildren.hide().find( 'input[type="checkbox"]' ).removeAttr( 'checked' ); } } ); + + $( document ).on( 'widget-updated widget-synced', function( e, widget ) { + widget.find( '.condition' ).each( function() { + buildMinorConditions( $( this ) ); + } ); + } ); + + function buildMinorConditions( condition ) { + var minor, + hasChildren, + majorData, + i, + j, + key, + val, + _len, + _jlen, + subkey, + subval, + optgroup, + select = condition.find( '.conditions-rule-minor' ).html( '' ), + major = condition.data( 'rule-major' ); + + if ( ! major ) { + select.attr( 'disabled', 'disabled' ); + return; + } + + minor = condition.data( 'rule-minor' ); + hasChildren = condition.data( 'rule-has-children' ); + majorData = widget_conditions_data[ major ]; + + for ( i = 0, _len = majorData.length; i < _len; i++ ) { + key = majorData[i][0]; + val = majorData[i][1]; + + if ( typeof val === 'object' ) { + optgroup = $( '<optgroup/>' ).attr( 'label', key ); + + for ( j = 0, _jlen = val.length; j < _jlen; j++ ) { + subkey = majorData[i][1][j][0]; + subval = majorData[i][1][j][1]; + + optgroup.append( $( '<option/>' ).val( subkey ).text( subval.replace( / /g, '\xA0' ) ) ); + } + + select.append( optgroup ); + } else { + select.append( $( '<option/>' ).val( key ).text( val.replace( / /g, '\xA0' ) ) ); + } + } + + select.removeAttr( 'disabled' ); + select.val( minor ); + + if ( 'page' === major && minor in widget_conditions_parent_pages ) { + select.siblings( 'span.conditions-rule-has-children' ).show(); + + if ( hasChildren ) { + select.siblings( 'span.conditions-rule-has-children' ).find( 'input[type="checkbox"]' ).attr( 'checked', 'checked' ); + } + } else { + select.siblings( 'span.conditions-rule-has-children' ).hide().find( 'input[type="checkbox"]' ).removeAttr( 'checked' ); + } + } + + function resetRuleIndexes( widget ) { + var index = 0; + widget.find( 'span.conditions-rule-has-children' ) + .find( 'input[type="checkbox"]' ) + .each( function() { + $( this ).attr( 'name', 'conditions[page_children][' + index + ']' ); + index++; + } ); + } } ); diff --git a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.min.css b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.min.css index 2fcb72c6..db85d2f8 100644 --- a/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.min.css +++ b/plugins/jetpack/modules/widget-visibility/widget-conditions/widget-conditions.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -.widget-conditional .condition-control a,.wp-core-ui .button.display-options:hover{text-decoration:none}.wp-customizer .expanded .widget-conditional .widget-conditional-inner{width:98%;box-sizing:border-box}.wp-customizer .expanded .widget-conditional .form{overflow:scroll;margin-bottom:20px}.widget-liquid-right .widget.expanded{overflow:visible}.widget-conditional-hide{display:none}.widget-conditional .widget-conditional-inner{background:#F9F9F9;border:1px solid #DFDFDF;padding:12px 10px 0}.widget-conditional,.widget-conditional .conditions{margin-bottom:12px}.widget-conditional .condition,.widget-conditional .condition-top{clear:both}.widget-conditional .condition{padding-top:12px}.widget-conditional .condition select{width:120px}.widget-conditional .condition-top select{width:auto}.widget-conditional .condition-control{padding-top:4px;clear:both;margin-top:-20px}.widget-conditional .selection{margin-right:70px}.widget-conditional .conditions-rule-has-children{display:block}.widget-conditional .condition .actions{margin-top:-28px}.widget-conditional .condition:last-child .condition-conjunction{display:none}.wp-core-ui .button.display-options{margin-right:5px}.wp-customizer .widget-conditional select{min-width:0;max-width:none;height:auto}
\ No newline at end of file +.wp-customizer .expanded .widget-conditional .widget-conditional-inner{width:98%;box-sizing:border-box}.wp-customizer .expanded .widget-conditional .form{overflow:scroll;margin-bottom:20px}.widget-liquid-right .widget.expanded{overflow:visible}.widget-conditional-hide{display:none}.widget-conditional .widget-conditional-inner{background:#f9f9f9;border:1px solid #dfdfdf;padding:12px 10px 0}.widget-conditional{margin-bottom:12px}.widget-conditional .conditions{margin-bottom:12px}.widget-conditional .condition,.widget-conditional .condition-top{clear:both}.widget-conditional .condition{padding-top:12px;position:relative}.widget-conditional .condition select{width:120px;position:relative;z-index:2}.widget-conditional .condition-top select{width:auto}.widget-conditional .condition-control{padding-top:4px;clear:both;margin-top:-20px}.widget-conditional .selection{margin-right:50px;margin-left:20px}.widget-conditional .conditions-rule-has-children{display:block}.widget-conditional .condition .actions{margin-top:-28px}.widget-conditional .condition .actions{margin-top:-28px}.widget-conditional .condition-control a{text-decoration:none;position:absolute;top:17px;text-indent:-9999px;z-index:1}.widget-conditional .condition-control a:before{position:absolute;text-indent:0;left:0}.widget-conditional .condition-control .delete-condition{left:0;color:#f11}.widget-conditional .condition-control .add-condition{right:0}.widget-conditional .condition:last-child .condition-conjunction,.widget-conditional .condition:last-child .condition-intersection{display:none}.widget-conditional.conjunction .condition-intersection{display:none}.widget-conditional.intersection .condition-conjunction{display:none}.wp-core-ui .button.display-options{margin-right:5px}.wp-core-ui .button.display-options:hover{text-decoration:none}.wp-customizer .widget-conditional select{min-width:0;max-width:none;height:auto}.wp-customizer .widget-conditional .condition-control a{top:15px}@media screen and (max-width:782px){.widget-conditional .condition-control a{top:20px}}
\ No newline at end of file diff --git a/plugins/jetpack/modules/widgets/blog-stats.php b/plugins/jetpack/modules/widgets/blog-stats.php index 0d0683ab..8d3f4788 100644 --- a/plugins/jetpack/modules/widgets/blog-stats.php +++ b/plugins/jetpack/modules/widgets/blog-stats.php @@ -77,7 +77,7 @@ class Jetpack_Blog_Stats_Widget extends WP_Widget { } /** - * Back-end widget form. + * Back end widget form. * * @see WP_Widget::form() * diff --git a/plugins/jetpack/modules/widgets/contact-info.php b/plugins/jetpack/modules/widgets/contact-info.php index cc38c56e..2a164faa 100644 --- a/plugins/jetpack/modules/widgets/contact-info.php +++ b/plugins/jetpack/modules/widgets/contact-info.php @@ -59,6 +59,7 @@ 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' ), + 'email' => null, 'showmap' => 0, 'apikey' => null, 'lat' => null, @@ -123,6 +124,13 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) { } } + if ( is_email( $instance['email'] ) ) { + printf( + '<div class="confit-email"><a href="mailto:%1$s">%1$s</a></div>', + esc_html( $instance['email'] ) + ); + } + if ( '' != $instance['hours'] ) { echo '<div class="confit-hours">' . str_replace( "\n", "<br/>", esc_html( $instance['hours'] ) ) . "</div>"; } @@ -165,6 +173,7 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) { $instance['title'] = wp_kses( $new_instance['title'], array() ); $instance['address'] = wp_kses( $new_instance['address'], array() ); $instance['phone'] = wp_kses( $new_instance['phone'], array() ); + $instance['email'] = wp_kses( $new_instance['email'], array() ); $instance['hours'] = wp_kses( $new_instance['hours'], array() ); $instance['apikey'] = wp_kses( isset( $new_instance['apikey'] ) ? $new_instance['apikey'] : $old_instance['apikey'], array() ); $instance['lat'] = isset( $old_instance['lat'] ) ? floatval( $old_instance['lat'] ) : 0; @@ -275,6 +284,11 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) { </p> <p> + <label for="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>"><?php esc_html_e( 'Email Address:', 'jetpack' ); ?></label> + <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'email' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'email' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['email'] ); ?>" /> + </p> + + <p> <label for="<?php echo esc_attr( $this->get_field_id( 'hours' ) ); ?>"><?php esc_html_e( 'Hours:', 'jetpack' ); ?></label> <textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'hours' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hours' ) ); ?>"><?php echo esc_textarea( $instance['hours'] ); ?></textarea> </p> diff --git a/plugins/jetpack/modules/widgets/facebook-likebox.php b/plugins/jetpack/modules/widgets/facebook-likebox.php index bfa1735c..928adb13 100644 --- a/plugins/jetpack/modules/widgets/facebook-likebox.php +++ b/plugins/jetpack/modules/widgets/facebook-likebox.php @@ -293,7 +293,7 @@ class WPCOM_Widget_Facebook_LikeBox extends WP_Widget { */ function guess_locale_from_lang( $lang ) { _deprecated_function( __METHOD__, '4.0.0', 'Jetpack::guess_locale_from_lang()' ); - Jetpack::$instance->get_locale_from_lang( $lang ); + Jetpack::$instance->guess_locale_from_lang( $lang ); } /** diff --git a/plugins/jetpack/modules/widgets/gallery/css/admin-rtl.min.css b/plugins/jetpack/modules/widgets/gallery/css/admin-rtl.min.css index 1ef4ed3f..de937320 100644 --- a/plugins/jetpack/modules/widgets/gallery/css/admin-rtl.min.css +++ b/plugins/jetpack/modules/widgets/gallery/css/admin-rtl.min.css @@ -1 +1 @@ -.gallery-widget-thumbs-wrapper{margin:-5px 0 .3em}.gallery-widget-thumbs img{border:1px solid #ccc;padding:2px;background-color:#fff;margin:0 0 5px 5px;float:right}
\ No newline at end of file +.gallery-widget-thumbs-wrapper{margin:-5px 0 .3em 0}.gallery-widget-thumbs img{border:1px solid #ccc;padding:2px;background-color:#fff;margin:0 0 5px 5px;float:right}
\ No newline at end of file diff --git a/plugins/jetpack/modules/widgets/gallery/css/admin.min.css b/plugins/jetpack/modules/widgets/gallery/css/admin.min.css index e39b21f4..743791f9 100644 --- a/plugins/jetpack/modules/widgets/gallery/css/admin.min.css +++ b/plugins/jetpack/modules/widgets/gallery/css/admin.min.css @@ -1,2 +1,2 @@ /* Do not modify this file directly. It is concatenated from individual module CSS files. */ -.gallery-widget-thumbs-wrapper{margin:-5px 0 .3em}.gallery-widget-thumbs img{border:1px solid #ccc;padding:2px;background-color:#fff;margin:0 5px 5px 0;float:left}
\ No newline at end of file +.gallery-widget-thumbs-wrapper{margin:-5px 0 .3em 0}.gallery-widget-thumbs img{border:1px solid #ccc;padding:2px;background-color:#fff;margin:0 5px 5px 0;float:left}
\ No newline at end of file diff --git a/plugins/jetpack/modules/widgets/google-translate.php b/plugins/jetpack/modules/widgets/google-translate.php index 2bc7782b..bba613d5 100644 --- a/plugins/jetpack/modules/widgets/google-translate.php +++ b/plugins/jetpack/modules/widgets/google-translate.php @@ -12,7 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -class Google_Translate_Widget extends WP_Widget { +class Jetpack_Google_Translate_Widget extends WP_Widget { static $instance = null; /** @@ -136,6 +136,6 @@ class Google_Translate_Widget extends WP_Widget { * Register the widget for use in Appearance -> Widgets. */ function jetpack_google_translate_widget_init() { - register_widget( 'Google_Translate_Widget' ); + register_widget( 'Jetpack_Google_Translate_Widget' ); } add_action( 'widgets_init', 'jetpack_google_translate_widget_init' ); diff --git a/plugins/jetpack/modules/widgets/image-widget.php b/plugins/jetpack/modules/widgets/image-widget.php index 57def670..82039e7d 100644 --- a/plugins/jetpack/modules/widgets/image-widget.php +++ b/plugins/jetpack/modules/widgets/image-widget.php @@ -69,7 +69,14 @@ class Jetpack_Image_Widget extends WP_Widget { if ( '' != $instance['img_url'] ) { - $output = '<img src="' . esc_attr( $instance['img_url'] ) .'" '; + $image_url = Jetpack::is_module_active( 'photon' ) + ? jetpack_photon_url( $instance['img_url'], array( + 'w' => $instance['img_width'], + 'h' => $instance['img_height'], + ) ) + : $instance['img_url']; + + $output = '<img src="' . esc_url( $image_url ) . '" '; if ( '' != $instance['alt_text'] ) { $output .= 'alt="' . esc_attr( $instance['alt_text'] ) .'" '; @@ -87,11 +94,11 @@ class Jetpack_Image_Widget extends WP_Widget { $output .= 'height="' . esc_attr( $instance['img_height'] ) .'" '; } $output .= '/>'; - if ( '' != $instance['link'] && ! empty( $instance['link_target_blank'] ) ) { - $output = '<a target="_blank" href="' . esc_attr( $instance['link'] ) . '">' . $output . '</a>'; - } - if ( '' != $instance['link'] && empty( $instance['link_target_blank'] ) ) { - $output = '<a href="' . esc_attr( $instance['link'] ) . '">' . $output . '</a>'; + if ( '' != $instance['link'] ) { + $target = ! empty( $instance['link_target_blank'] ) + ? 'target="_blank"' + : ''; + $output = '<a ' . $target . ' href="' . esc_url( $instance['link'] ) . '">' . $output . '</a>'; } if ( '' != $instance['caption'] ) { /** This filter is documented in core/src/wp-includes/default-widgets.php */ @@ -141,12 +148,12 @@ class Jetpack_Image_Widget extends WP_Widget { $instance = $old_instance; $instance['title'] = strip_tags( $new_instance['title'] ); - $instance['img_url'] = esc_url( $new_instance['img_url'], null, 'display' ); + $instance['img_url'] = esc_url( trim( $new_instance['img_url'] ) ); $instance['alt_text'] = strip_tags( $new_instance['alt_text'] ); $instance['img_title'] = strip_tags( $new_instance['img_title'] ); $instance['caption'] = wp_kses( stripslashes($new_instance['caption'] ), $allowed_caption_html ); $instance['align'] = $new_instance['align']; - $instance['link'] = esc_url( $new_instance['link'], null, 'display' ); + $instance['link'] = esc_url( trim( $new_instance['link'] ) ); $instance['link_target_blank'] = isset( $new_instance['link_target_blank'] ) ? (bool) $new_instance['link_target_blank'] : false; $new_img_width = absint( $new_instance['img_width'] ); @@ -178,7 +185,7 @@ class Jetpack_Image_Widget extends WP_Widget { } /** - * Back-end widget form. + * Back end widget form. * * @see WP_Widget::form() * diff --git a/plugins/jetpack/modules/widgets/my-community.php b/plugins/jetpack/modules/widgets/my-community.php index 897ed9f3..00db0660 100644 --- a/plugins/jetpack/modules/widgets/my-community.php +++ b/plugins/jetpack/modules/widgets/my-community.php @@ -57,7 +57,7 @@ class Jetpack_My_Community_Widget extends WP_Widget { } /** - * Back-end widget form. + * Back end widget form. * * @see WP_Widget::form() * diff --git a/plugins/jetpack/modules/widgets/top-posts.php b/plugins/jetpack/modules/widgets/top-posts.php index a30cb6f0..8b4e7178 100644 --- a/plugins/jetpack/modules/widgets/top-posts.php +++ b/plugins/jetpack/modules/widgets/top-posts.php @@ -17,7 +17,7 @@ function jetpack_top_posts_widget_init() { if ( ( ! defined( 'IS_WPCOM' ) || ! IS_WPCOM ) && - ! function_exists( 'stats_get_csv' ) + ! function_exists( 'stats_get_from_restapi' ) ) { return; } @@ -250,6 +250,9 @@ class Jetpack_Top_Posts_Widget extends WP_Widget { 'fallback_to_avatars' => true, /** This filter is documented in modules/stats.php */ 'gravatar_default' => apply_filters( 'jetpack_static_url', set_url_scheme( 'https://en.wordpress.com/i/logo/white-gray-80.png' ) ), + 'avatar_size' => 40, + 'width' => null, + 'height' => null, ); if ( 'grid' == $display ) { $get_image_options['avatar_size'] = 200; @@ -266,6 +269,8 @@ class Jetpack_Top_Posts_Widget extends WP_Widget { * @type bool true Should we default to Gravatars when no image is found? Default is true. * @type string $gravatar_default Default Image URL if no Gravatar is found. * @type int $avatar_size Default Image size. + * @type mixed $width Image width, not set by default and $avatar_size is used instead. + * @type mixed $height Image height, not set by default and $avatar_size is used instead. * } */ $get_image_options = apply_filters( 'jetpack_top_posts_widget_image_options', $get_image_options ); @@ -309,12 +314,31 @@ class Jetpack_Top_Posts_Widget extends WP_Widget { switch ( $display ) { case 'list' : case 'grid' : + // Keep the avatar_size as default dimensions for backward compatibility. + $width = (int) $get_image_options['avatar_size']; + $height = (int) $get_image_options['avatar_size']; + + // Check if the user has changed the width. + if ( ! empty( $get_image_options['width'] ) ) { + $width = (int) $get_image_options['width']; + } + + // Check if the user has changed the height. + if ( ! empty( $get_image_options['height'] ) ) { + $height = (int) $get_image_options['height']; + } + foreach ( $posts as &$post ) { - $image = Jetpack_PostImages::get_image( $post['post_id'], array( 'fallback_to_avatars' => true, 'avatar_size' => (int) $get_image_options['avatar_size'] ) ); + $image = Jetpack_PostImages::get_image( + $post['post_id'], + array( + 'fallback_to_avatars' => true, + 'avatar_size' => (int) $get_image_options['avatar_size'], + ) + ); $post['image'] = $image['src']; if ( 'blavatar' != $image['from'] && 'gravatar' != $image['from'] ) { - $size = (int) $get_image_options['avatar_size']; - $post['image'] = jetpack_photon_url( $post['image'], array( 'resize' => "$size,$size" ) ); + $post['image'] = jetpack_photon_url( $post['image'], array( 'resize' => "$width,$height" ) ); } } @@ -351,8 +375,7 @@ class Jetpack_Top_Posts_Widget extends WP_Widget { ?> <a href="<?php echo esc_url( $filtered_permalink ); ?>" title="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" class="bump-view" data-bump-view="tp"> - <?php $size = (int) $get_image_options['avatar_size']; ?> - <img width="<?php echo absint( $size ); ?>" height="<?php echo absint( $size ); ?>" src="<?php echo esc_url( $post['image'] ); ?>" alt="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" data-pin-nopin="true" /> + <img width="<?php echo absint( $width ); ?>" height="<?php echo absint( $height ); ?>" src="<?php echo esc_url( $post['image'] ); ?>" alt="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" data-pin-nopin="true" /> </a> <?php /** @@ -383,8 +406,7 @@ class Jetpack_Top_Posts_Widget extends WP_Widget { $filtered_permalink = apply_filters( 'jetpack_top_posts_widget_permalink', $post['permalink'], $post ); ?> <a href="<?php echo esc_url( $filtered_permalink ); ?>" title="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" class="bump-view" data-bump-view="tp"> - <?php $size = (int) $get_image_options['avatar_size']; ?> - <img width="<?php echo absint( $size ); ?>" height="<?php echo absint( $size ); ?>" src="<?php echo esc_url( $post['image'] ); ?>" class='widgets-list-layout-blavatar' alt="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" data-pin-nopin="true" /> + <img width="<?php echo absint( $width ); ?>" height="<?php echo absint( $height ); ?>" src="<?php echo esc_url( $post['image'] ); ?>" class='widgets-list-layout-blavatar' alt="<?php echo esc_attr( wp_kses( $post['title'], array() ) ); ?>" data-pin-nopin="true" /> </a> <div class="widgets-list-layout-links"> <a href="<?php echo esc_url( $filtered_permalink ); ?>" class="bump-view" data-bump-view="tp"> @@ -487,12 +509,14 @@ class Jetpack_Top_Posts_Widget extends WP_Widget { $days = 2; } - $post_view_posts = stats_get_csv( 'postviews', array( 'days' => absint( $days ), 'limit' => 11 ) ); - if ( ! $post_view_posts ) { + $post_view_posts = stats_get_from_restapi( array(), 'top-posts?max=11&summarize=1&num=' . absint( $days ) ); + + if ( ! isset( $post_view_posts->summary ) || empty( $post_view_posts->summary->postviews ) ) { return array(); } - $post_view_ids = array_filter( wp_list_pluck( $post_view_posts, 'post_id' ) ); + $post_view_ids = array_filter( wp_list_pluck( $post_view_posts->summary->postviews, 'id' ) ); + if ( ! $post_view_ids ) { return array(); } diff --git a/plugins/jetpack/modules/widgets/twitter-timeline.php b/plugins/jetpack/modules/widgets/twitter-timeline.php index 573127f5..9b4283b0 100644 --- a/plugins/jetpack/modules/widgets/twitter-timeline.php +++ b/plugins/jetpack/modules/widgets/twitter-timeline.php @@ -81,7 +81,7 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { echo $args['before_widget']; $title = isset( $instance['title'] ) ? $instance['title'] : ''; - + /** This filter is documented in core/src/wp-includes/default-widgets.php */ $title = apply_filters( 'widget_title', $title ); if ( ! empty( $title ) ) { @@ -108,6 +108,12 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { } } + /** This filter is documented in modules/shortcodes/tweet.php */ + $partner = apply_filters( 'jetpack_twitter_partner_id', 'jetpack' ); + if ( ! empty( $partner ) ) { + echo ' data-partner="' . esc_attr( $partner ) . '"'; + } + if ( ! empty( $instance['chrome'] ) && is_array( $instance['chrome'] ) ) { echo ' data-chrome="' . esc_attr( join( ' ', $instance['chrome'] ) ) . '"'; } @@ -183,7 +189,18 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { } $tweet_limit = (int) $new_instance['tweet-limit']; - $instance['tweet-limit'] = ( $tweet_limit ? $tweet_limit : null ); + if ( $tweet_limit ) { + $instance['tweet-limit'] = min( max( $tweet_limit, 1 ), 20 ); + /** + * A timeline with a specified limit is expanded to the height of those Tweets. + * The specified height value no longer applies, so reject the height value + * when a valid limit is set: a widget attempting to save both limit 5 and + * height 400 would be saved with just limit 5. + */ + $instance['height'] = ''; + } else { + $instance['tweet-limit'] = null; + } // If they entered something that might be a full URL, try to parse it out if ( is_string( $new_instance['widget-id'] ) ) { @@ -222,7 +239,8 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { 'noheader', 'nofooter', 'noborders', - 'transparent' + 'transparent', + 'noscrollbar', ); if ( isset( $new_instance['chrome'] ) ) { foreach ( $new_instance['chrome'] as $chrome ) { @@ -249,7 +267,7 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { } /** - * Back-end widget form. + * Back end widget form. * * @see WP_Widget::form() * @@ -323,7 +341,7 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { <p> <label for="<?php echo $this->get_field_id( 'tweet-limit' ); ?>"> - <?php esc_html_e( '# of Tweets Shown:', 'jetpack' ); ?> + <?php esc_html_e( '# of Tweets Shown (1 to 20):', 'jetpack' ); ?> </label> <input class="widefat" @@ -415,6 +433,16 @@ class Jetpack_Twitter_Timeline_Widget extends WP_Widget { </label> <br /> <input + type="checkbox"<?php checked( in_array( 'noscrollbar', $instance['chrome'] ) ); ?> + id="<?php echo $this->get_field_id( 'chrome-noscrollbar' ); ?>" + name="<?php echo $this->get_field_name( 'chrome' ); ?>[]" + value="noscrollbar" + /> + <label for="<?php echo $this->get_field_id( 'chrome-noscrollbar' ); ?>"> + <?php esc_html_e( 'No Scrollbar', 'jetpack' ); ?> + </label> + <br /> + <input type="checkbox"<?php checked( in_array( 'transparent', $instance['chrome'] ) ); ?> id="<?php echo $this->get_field_id( 'chrome-transparent' ); ?>" name="<?php echo $this->get_field_name( 'chrome' ); ?>[]" diff --git a/plugins/jetpack/modules/widgets/upcoming-events.php b/plugins/jetpack/modules/widgets/upcoming-events.php index 01a42b8a..5ff00547 100644 --- a/plugins/jetpack/modules/widgets/upcoming-events.php +++ b/plugins/jetpack/modules/widgets/upcoming-events.php @@ -1,6 +1,6 @@ <?php -class Upcoming_Events_Widget extends WP_Widget { +class Jetpack_Upcoming_Events_Widget extends WP_Widget { function __construct() { parent::__construct( 'upcoming_events_widget', @@ -153,7 +153,7 @@ class Upcoming_Events_Widget extends WP_Widget { } function upcoming_events_register_widgets() { - register_widget( 'Upcoming_Events_Widget' ); + register_widget( 'Jetpack_Upcoming_Events_Widget' ); } add_action( 'widgets_init', 'upcoming_events_register_widgets' ); diff --git a/plugins/jetpack/modules/widgets/wordpress-post-widget.php b/plugins/jetpack/modules/widgets/wordpress-post-widget.php index 785be42d..8715698b 100644 --- a/plugins/jetpack/modules/widgets/wordpress-post-widget.php +++ b/plugins/jetpack/modules/widgets/wordpress-post-widget.php @@ -617,7 +617,7 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { return false; } } - + /** * If none of the above checks failed, then we definitely want to update widget data. */ @@ -734,26 +734,28 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { // Enqueue front end assets. $this->enqueue_scripts(); - echo $args['before_widget']; + $content = $args['before_widget']; if ( empty( $instance['url'] ) ) { if ( current_user_can( 'manage_options' ) ) { - echo '<p>'; + $content .= '<p>'; /* Translators: the "Blog URL" field mentioned is the input field labeled as such in the widget form. */ - esc_html_e( 'The Blog URL is not properly setup in the widget.', 'jetpack' ); - echo '</p>'; + $content .= esc_html__( 'The Blog URL is not properly setup in the widget.', 'jetpack' ); + $content .= '</p>'; } - echo $args['after_widget']; + $content .= $args['after_widget']; + + echo $content; return; } $data = $this->get_blog_data( $instance['url'] ); - // check for errors if ( is_wp_error( $data ) || empty( $data['site_info']['data'] ) ) { - echo '<p>' . __( 'Cannot load blog information at this time.', 'jetpack' ) . '</p>'; - echo $args['after_widget']; + $content .= '<p>' . __( 'Cannot load blog information at this time.', 'jetpack' ) . '</p>'; + $content .= $args['after_widget']; + echo $content; return; } @@ -762,19 +764,20 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { if ( ! empty( $instance['title'] ) ) { /** This filter is documented in core/src/wp-includes/default-widgets.php */ $instance['title'] = apply_filters( 'widget_title', $instance['title'] ); - echo $args['before_title'] . esc_html( $instance['title'] . ': ' . $site_info->name ) . $args['after_title']; + $content .= $args['before_title'] . esc_html( $instance['title'] . ': ' . $site_info->name ) . $args['after_title']; } else { - echo $args['before_title'] . esc_html( $site_info->name ) . $args['after_title']; + $content .= $args['before_title'] . esc_html( $site_info->name ) . $args['after_title']; } - echo '<div class="jetpack-display-remote-posts">'; + $content .= '<div class="jetpack-display-remote-posts">'; if ( is_wp_error( $data['posts']['data'] ) || empty( $data['posts']['data'] ) ) { - echo '<p>' . __( 'Cannot load blog posts at this time.', 'jetpack' ) . '</p>'; - echo '</div><!-- .jetpack-display-remote-posts -->'; - echo $args['after_widget']; + $content .= '<p>' . __( 'Cannot load blog posts at this time.', 'jetpack' ) . '</p>'; + $content .= '</div><!-- .jetpack-display-remote-posts -->'; + $content .= $args['after_widget']; + echo $content; return; } @@ -794,7 +797,7 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { if ( isset( $instance['open_in_new_window'] ) && $instance['open_in_new_window'] == true ) { $target = ' target="_blank"'; } - echo '<h4><a href="' . esc_url( $single_post['url'] ) . '"' . $target . '>' . esc_html( $post_title ) . '</a></h4>' . "\n"; + $content .= '<h4><a href="' . esc_url( $single_post['url'] ) . '"' . $target . '>' . esc_html( $post_title ) . '</a></h4>' . "\n"; if ( ( $instance['featured_image'] == true ) && ( ! empty ( $single_post['featured_image'] ) ) ) { $featured_image = $single_post['featured_image']; /** @@ -809,16 +812,27 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { * @param array $args Array of Photon Parameters. */ $image_params = apply_filters( 'jetpack_display_posts_widget_image_params', array() ); - echo '<a title="' . esc_attr( $post_title ) . '" href="' . esc_url( $single_post['url'] ) . '"' . $target . '><img src="' . jetpack_photon_url( $featured_image, $image_params ) . '" alt="' . esc_attr( $post_title ) . '"/></a>'; + $content .= '<a title="' . esc_attr( $post_title ) . '" href="' . esc_url( $single_post['url'] ) . '"' . $target . '><img src="' . jetpack_photon_url( $featured_image, $image_params ) . '" alt="' . esc_attr( $post_title ) . '"/></a>'; } if ( $instance['show_excerpts'] == true ) { - echo $single_post['excerpt']; + $content .= $single_post['excerpt']; } } - echo '</div><!-- .jetpack-display-remote-posts -->'; - echo $args['after_widget']; + $content .= '</div><!-- .jetpack-display-remote-posts -->'; + $content .= $args['after_widget']; + + /** + * Filter the WordPress Posts widget content. + * + * @module widgets + * + * @since 4.7.0 + * + * @param string $content Widget content. + */ + echo apply_filters( 'jetpack_display_posts_widget_content', $content ); } /** @@ -1049,7 +1063,7 @@ class Jetpack_Display_Posts_Widget extends WP_Widget { $instance = array(); $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; - $instance['url'] = ( ! empty( $new_instance['url'] ) ) ? strip_tags( $new_instance['url'] ) : ''; + $instance['url'] = ( ! empty( $new_instance['url'] ) ) ? strip_tags( trim( $new_instance['url'] ) ) : ''; $instance['url'] = preg_replace( "!^https?://!is", "", $instance['url'] ); $instance['url'] = untrailingslashit( $instance['url'] ); diff --git a/plugins/jetpack/modules/wordads/css/style.css b/plugins/jetpack/modules/wordads/css/style.css index a77ec09c..687334d6 100644 --- a/plugins/jetpack/modules/wordads/css/style.css +++ b/plugins/jetpack/modules/wordads/css/style.css @@ -44,11 +44,6 @@ box-shadow: none !important; } -.wpa-about:hover, .wa_infobox a:hover { - text-decoration: underline !important; /* !important necessary, since themes override this routinely */ - color: #444; -} - /* ad unit wrapper */ .wpa .u>div { /* @todo: deprecate wpdvert */ display: block; diff --git a/plugins/jetpack/modules/wordads/php/widgets.php b/plugins/jetpack/modules/wordads/php/widgets.php index a8e36f47..c7beccac 100644 --- a/plugins/jetpack/modules/wordads/php/widgets.php +++ b/plugins/jetpack/modules/wordads/php/widgets.php @@ -31,26 +31,20 @@ class WordAds_Sidebar_Widget extends WP_Widget { $instance['unit'] = 'mrec'; } - $about = __( 'About these ads', 'jetpack' ); + $about = __( 'Advertisements', 'jetpack' ); $width = WordAds::$ad_tag_ids[$instance['unit']]['width']; $height = WordAds::$ad_tag_ids[$instance['unit']]['height']; $snippet = ''; if ( $wordads->option( 'wordads_house', true ) ) { - $ad_url = 'https://s0.wp.com/wp-content/blog-plugins/wordads/house/'; + $unit = 'mrec'; if ( 'leaderboard' == $instance['unit'] && ! $this->params->mobile_device ) { - $ad_url .= 'leaderboard.png'; + $unit = 'leaderboard'; } else if ( 'wideskyscraper' == $instance['unit'] ) { - $ad_url .= 'widesky.png'; - } else { - $ad_url .= 'mrec.png'; + $unit = 'widesky'; } - $snippet = <<<HTML - <a href="https://wordpress.com/create/" target="_blank"> - <img src="$ad_url" alt="WordPress.com: Grow Your Business" width="$width" height="$height" /> - </a> -HTML; + $snippet = $wordads->get_house_ad( $unit ); } else { $section_id = 0 === $wordads->params->blog_id ? WORDADS_API_TEST_ID : $wordads->params->blog_id . '3'; $data_tags = ( $wordads->params->cloudflare ) ? ' data-cfasync="false"' : ''; @@ -64,7 +58,7 @@ HTML; echo <<< HTML <div class="wpcnt"> <div class="wpa"> - <a class="wpa-about" href="https://en.wordpress.com/about-these-ads/" rel="nofollow">$about</a> + <span class="wpa-about">$about</span> <div class="u {$instance['unit']}"> $snippet </div> diff --git a/plugins/jetpack/modules/wordads/wordads.php b/plugins/jetpack/modules/wordads/wordads.php index 5bdcee52..884f92af 100644 --- a/plugins/jetpack/modules/wordads/wordads.php +++ b/plugins/jetpack/modules/wordads/wordads.php @@ -101,9 +101,7 @@ class WordAds { * @since 4.5.0 */ public static function is_infinite_scroll() { - return current_theme_supports( 'infinite-scroll' ) && - class_exists( 'The_Neverending_Home_Page' ) && - The_Neverending_Home_Page::got_infinity(); + return class_exists( 'The_Neverending_Home_Page' ) && The_Neverending_Home_Page::got_infinity(); } /** @@ -302,30 +300,16 @@ HTML; </script> HTML; } else if ( 'house' == $type ) { - $width = 300; - $height = 250; - $ad_url = 'https://s0.wp.com/wp-content/blog-plugins/wordads/house/'; - if ( 'top' == $spot && ! $this->params->mobile_device ) { - $width = 728; - $height = 90; - $ad_url .= 'leaderboard.png'; - } else { - $ad_url .= 'mrec.png'; - } - - $snippet = <<<HTML - <a href="https://wordpress.com/create/" target="_blank"> - <img src="$ad_url" alt="WordPress.com: Grow Your Business" width="$width" height="$height" /> - </a> -HTML; + $leaderboard = 'top' == $spot && ! $this->params->mobile_device; + $snippet = $this->get_house_ad( $leaderboard ? 'leaderboard' : 'mrec' ); } $header = 'top' == $spot ? 'wpcnt-header' : ''; - $about = __( 'About these ads', 'jetpack' ); + $about = __( 'Advertisements', 'jetpack' ); return <<<HTML <div class="wpcnt $header"> <div class="wpa"> - <a class="wpa-about" href="https://en.wordpress.com/about-these-ads/" rel="nofollow">$about</a> + <span class="wpa-about">$about</span> <div class="u $spot"> $snippet </div> @@ -345,6 +329,41 @@ HTML; } /** + * Returns markup for HTML5 house ad base on unit + * @param string $unit mrec, widesky, or leaderboard + * @return string markup for HTML5 house ad + * + * @since 4.7.0 + */ + public function get_house_ad( $unit = 'mrec' ) { + if ( ! in_array( $unit, array( 'mrec', 'widesky', 'leaderboard' ) ) ) { + $unit = 'mrec'; + } + + $width = 300; + $height = 250; + if ( 'widesky' == $unit ) { + $width = 160; + $height = 600; + } else if ( 'leaderboard' == $unit ) { + $width = 728; + $height = 90; + } + + return <<<HTML + <iframe + src="https://s0.wp.com/wp-content/blog-plugins/wordads/house/html5/$unit/index.html" + width="$width" + height="$height" + frameborder="0" + scrolling="no" + marginheight="0" + marginwidth="0"> + </iframe> +HTML; + } + + /** * Activation hook actions * * @since 4.5.0 |