summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules')
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css1
-rw-r--r--plugins/jetpack/modules/carousel/jetpack-carousel.php26
-rw-r--r--plugins/jetpack/modules/comments/comments.php360
-rw-r--r--plugins/jetpack/modules/contact-form/css/grunion-rtl.css1
-rw-r--r--plugins/jetpack/modules/contact-form/css/grunion.css94
-rw-r--r--plugins/jetpack/modules/contact-form/css/jquery-ui-datepicker.css160
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-contact-form.php19
-rw-r--r--plugins/jetpack/modules/contact-form/grunion-editor-view.php14
-rw-r--r--plugins/jetpack/modules/contact-form/js/editor-view.js2
-rw-r--r--plugins/jetpack/modules/contact-form/js/grunion-frontend.js6
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css-4.7.php36
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css12
-rw-r--r--plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js83
-rw-r--r--plugins/jetpack/modules/google-analytics/wp-google-analytics.php186
-rw-r--r--plugins/jetpack/modules/gravatar-hovercards.php17
-rw-r--r--plugins/jetpack/modules/infinite-scroll.php2
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php26
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php8
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php25
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php5
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php12
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentyten.php31
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php14
-rw-r--r--plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php27
-rw-r--r--plugins/jetpack/modules/likes.php13
-rw-r--r--plugins/jetpack/modules/masterbar/masterbar.php47
-rw-r--r--plugins/jetpack/modules/masterbar/tracks-events.js154
-rw-r--r--plugins/jetpack/modules/module-extras.php10
-rw-r--r--plugins/jetpack/modules/publicize.php7
-rw-r--r--plugins/jetpack/modules/related-posts/jetpack-related-posts.php22
-rw-r--r--plugins/jetpack/modules/related-posts/related-posts-rtl.css1
-rw-r--r--plugins/jetpack/modules/search/class.jetpack-search.php2
-rw-r--r--plugins/jetpack/modules/seo-tools.php4
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharedaddy.php10
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-service.php6
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing-sources.php56
-rw-r--r--plugins/jetpack/modules/sharedaddy/sharing.css2
-rw-r--r--plugins/jetpack/modules/shortcodes.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/css/recipes-print-rtl.css38
-rw-r--r--plugins/jetpack/modules/shortcodes/css/recipes-rtl.css38
-rw-r--r--plugins/jetpack/modules/shortcodes/css/rtl/recipes-rtl.css38
-rw-r--r--plugins/jetpack/modules/shortcodes/facebook.php9
-rw-r--r--plugins/jetpack/modules/shortcodes/googleplus.php2
-rw-r--r--plugins/jetpack/modules/shortcodes/mailchimp.php8
-rw-r--r--plugins/jetpack/modules/shortcodes/untappd-menu.php4
-rw-r--r--plugins/jetpack/modules/shortlinks.php6
-rw-r--r--plugins/jetpack/modules/simple-payments/paypal-express-checkout.js1
-rw-r--r--plugins/jetpack/modules/simple-payments/simple-payments.css52
-rw-r--r--plugins/jetpack/modules/simple-payments/simple-payments.php8
-rw-r--r--plugins/jetpack/modules/sitemaps.php2
-rw-r--r--plugins/jetpack/modules/sitemaps/sitemap-constants.php2
-rw-r--r--plugins/jetpack/modules/stats.php4
-rw-r--r--plugins/jetpack/modules/subscriptions.php14
-rw-r--r--plugins/jetpack/modules/theme-tools/content-options/blog-display.php28
-rw-r--r--plugins/jetpack/modules/theme-tools/content-options/featured-images.php44
-rw-r--r--plugins/jetpack/modules/theme-tools/content-options/post-details.php14
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery.php2
-rw-r--r--plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css1
-rw-r--r--plugins/jetpack/modules/verification-tools/verification-tools-utils.php6
-rw-r--r--plugins/jetpack/modules/videopress/class.videopress-player.php2
-rw-r--r--plugins/jetpack/modules/videopress/css/editor-rtl.css60
-rw-r--r--plugins/jetpack/modules/videopress/css/editor-rtl.min.css1
-rw-r--r--plugins/jetpack/modules/videopress/css/editor.min.css2
-rw-r--r--plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.css22
-rw-r--r--plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.min.css1
-rw-r--r--plugins/jetpack/modules/videopress/css/videopress-editor-style.min.css2
-rw-r--r--plugins/jetpack/modules/widgets.php1
-rw-r--r--plugins/jetpack/modules/widgets/contact-info.php12
-rw-r--r--plugins/jetpack/modules/widgets/gallery.php16
-rw-r--r--plugins/jetpack/modules/widgets/google-translate.php35
-rw-r--r--plugins/jetpack/modules/widgets/google-translate/google-translate.js2
-rw-r--r--plugins/jetpack/modules/widgets/mailchimp.php10
-rw-r--r--plugins/jetpack/modules/widgets/migrate-to-core/gallery-widget.php198
-rw-r--r--plugins/jetpack/modules/widgets/milestone/admin.js25
-rw-r--r--plugins/jetpack/modules/widgets/milestone/milestone.js67
-rw-r--r--plugins/jetpack/modules/widgets/milestone/milestone.php453
-rw-r--r--plugins/jetpack/modules/widgets/milestone/style-admin.css5
-rw-r--r--plugins/jetpack/modules/widgets/social-media-icons.php2
-rw-r--r--plugins/jetpack/modules/widgets/top-posts.php3
80 files changed, 2074 insertions, 671 deletions
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css b/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css
new file mode 100644
index 00000000..f7b5a964
--- /dev/null
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel-rtl.css
@@ -0,0 +1 @@
+.jp-carousel-wrap *{line-height:inherit}.jp-carousel-overlay{background:#000}div.jp-carousel-fadeaway{background:-moz-linear-gradient(bottom,rgba(0,0,0,.5),rgba(0,0,0,0));background:-webkit-gradient(linear,right bottom,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,0)));position:fixed;bottom:0;z-index:2147483647;width:100%;height:15px}.jp-carousel-next-button span,.jp-carousel-previous-button span{background:url(../modules/carousel/images/arrows.png) no-repeat center center;background-size:200px 126px}.jp-carousel-msg{font-family:"Open Sans",sans-serif;font-style:normal;display:inline-block;line-height:19px;padding:11px 15px;font-size:14px;text-align:center;margin:25px 2px 0 20px;background-color:#fff;border-right:4px solid #ffba00;box-shadow:0 1px 1px 0 rgba(0,0,0,.1)}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){.jp-carousel-next-button span,.jp-carousel-previous-button span{background-image:url(../modules/carousel/images/arrows-2x.png)}}.jp-carousel-wrap{font-family:"Helvetica Neue",sans-serif!important}.jp-carousel-info{position:absolute;bottom:0;text-align:right!important;-webkit-font-smoothing:subpixel-antialiased!important}.jp-carousel-info ::-moz-selection{background:#68c9e8;color:#fff}.jp-carousel-info ::selection{background:#68c9e8;color:#fff}.jp-carousel-info ::-moz-selection{background:#68c9e8;color:#fff}.jp-carousel-photo-info{position:relative;right:25%;width:50%}.jp-carousel-transitions .jp-carousel-photo-info{transition:.4s ease-out}.jp-carousel-info h2{background:100% 0!important;border:none!important;color:#999;display:block!important;font:normal 13px/1.25em "Helvetica Neue",sans-serif!important;letter-spacing:0!important;margin:7px 0 0 0!important;padding:10px 0 0!important;overflow:hidden;text-align:right;text-shadow:none!important;text-transform:none!important;-webkit-font-smoothing:subpixel-antialiased}.jp-carousel-next-button,.jp-carousel-previous-button{text-indent:-9999px;overflow:hidden;cursor:pointer}.jp-carousel-next-button span,.jp-carousel-previous-button span{position:absolute;top:0;bottom:0;width:82px;zoom:1;filter:alpha(opacity=20);opacity:.2}.jp-carousel-transitions .jp-carousel-next-button span,.jp-carousel-transitions .jp-carousel-previous-button span{transition:.5s opacity ease-out}.jp-carousel-next-button:hover span,.jp-carousel-previous-button:hover span{filter:alpha(opacity=60);opacity:.6}.jp-carousel-next-button span{background-position:-110px center;left:0}.jp-carousel-previous-button span{background-position:-10px center;right:0}.jp-carousel-buttons{margin:-18px -20px 15px;padding:8px 10px;border-bottom:1px solid #222;background:#222;text-align:center}div.jp-carousel-buttons a{border:none!important;color:#999;font:normal 11px/1.2em "Helvetica Neue",sans-serif!important;letter-spacing:0!important;padding:5px 0 5px 2px;text-decoration:none!important;text-shadow:none!important;vertical-align:middle;-webkit-font-smoothing:subpixel-antialiased}div.jp-carousel-buttons a:hover{color:#68c9e8;border:none!important}.jp-carousel-transitions div.jp-carousel-buttons a:hover{transition:none!important}.jp-carousel-next-button,.jp-carousel-previous-button,.jp-carousel-slide,.jp-carousel-slide img{-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0)}.jp-carousel-slide{position:fixed;width:0;bottom:0;background-color:#000;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px}.jp-carousel-transitions .jp-carousel-slide{transition:.3s ease-out}.jp-carousel-slide.selected{position:absolute!important;filter:alpha(opacity=100);opacity:1}.jp-carousel-slide{filter:alpha(opacity=25);opacity:.25}.jp-carousel-slide img{display:block;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;background:100% 0!important;border:none!important;padding:0!important;box-shadow:0 2px 8px rgba(0,0,0,.1);zoom:1}.jp-carousel-transitions .jp-carousel-slide{transition:opacity .4s linear}.jp-carousel-close-hint{color:#999;cursor:default;letter-spacing:0!important;padding:.35em 0 0;position:absolute;text-align:left;width:90%}.jp-carousel-transitions .jp-carousel-close-hint{transition:color .2s linear}.jp-carousel-close-hint span{cursor:pointer;background-color:#000;background-color:rgba(0,0,0,.8);display:inline-block;height:22px;font:400 24px/1 "Helvetica Neue",sans-serif!important;line-height:22px;margin:0 .4em 0 0;text-align:center;vertical-align:middle;width:22px;border-radius:4px}.jp-carousel-transitions .jp-carousel-close-hint span{transition:border-color .2s linear}.jp-carousel-close-hint:hover{cursor:default;color:#fff}.jp-carousel-close-hint:hover span{border-color:#fff}a.jp-carousel-image-download,div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{background:url(../modules/carousel/images/carousel-sprite.png?5) no-repeat;background-size:16px 200px}div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{margin:0 0 0 14px!important}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-color:#303030;padding-left:8px!important;border-radius:2px;border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{margin:0 -12px 0 2px!important}div.jp-carousel-buttons a.jp-carousel-reblog,div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover{background-position:6px -36px;padding-left:auto!important;padding-right:26px!important;color:#999}div.jp-carousel-buttons a.jp-carousel-commentlink{background-position:100% -156px;padding-right:19px!important}div.jp-carousel-buttons a.jp-carousel-reblog.reblogged:hover{cursor:default}div.jp-carousel-buttons a.jp-carousel-reblog:hover{background-position:6px -56px;color:#68c9e8}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){a.jp-carousel-image-download,div.jp-carousel-buttons a.jp-carousel-commentlink,div.jp-carousel-buttons a.jp-carousel-reblog{background-image:url(../modules/carousel/images/carousel-sprite-2x.png?5)}}div#carousel-reblog-box{background:#222;background:-moz-linear-gradient(bottom,#222,#333);background:-webkit-gradient(linear,right bottom,right top,from(#222),to(#333));padding:3px 0 0;display:none;margin:5px auto 0;border-radius:2px;box-shadow:0 0 20px rgba(0,0,0,.9);height:74px;width:565px}#carousel-reblog-box textarea{background:#999;font:13px/1.4 "Helvetica Neue",sans-serif!important;color:#444;padding:3px 6px;width:370px;height:48px;float:right;margin:6px 9px 0 9px;border:1px solid #666;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:2px}#carousel-reblog-box textarea:focus{background:#ccc;color:#222}#carousel-reblog-box label{color:#aaa;font-size:11px;padding-left:2px;padding-right:2px;display:inline;font-weight:400}#carousel-reblog-box select{width:110px;padding:0;font-size:12px;font-family:"Helvetica Neue",sans-serif!important;background:#333;color:#eee;border:1px solid #444;margin-top:5px}#carousel-reblog-box .submit,#wrapper #carousel-reblog-box p.response{float:right;width:154px;padding-top:0;padding-right:1px;overflow:hidden;height:34px;margin:3px 2px 0 0!important}#wrapper #carousel-reblog-box p.response{font-size:13px;clear:none;padding-right:2px;height:34px;color:#aaa}#carousel-reblog-box input#carousel-reblog-submit,#jp-carousel-comment-form-button-submit{font:13px/24px "Helvetica Neue",sans-serif!important;margin-top:8px;padding:0 10px!important;border-radius:1em;height:24px;color:#333;cursor:pointer;font-weight:400;background:#aaa;background:-moz-linear-gradient(bottom,#aaa,#ccc);background:-webkit-gradient(linear,right bottom,right top,from(#aaa),to(#ccc));border:1px solid #444}#carousel-reblog-box input#carousel-reblog-submit:hover,#jp-carousel-comment-form-button-submit:hover{background:#ccc;background:-moz-linear-gradient(bottom,#ccc,#eee);background:-webkit-gradient(linear,right bottom,right top,from(#ccc),to(#eee))}#carousel-reblog-box .canceltext{color:#aaa;font-size:11px;line-height:24px}#carousel-reblog-box .canceltext a{color:#fff}.jp-carousel-titleanddesc{border-top:1px solid #222;color:#999;font-size:15px;padding-top:24px;margin-bottom:20px;font-weight:400}.jp-carousel-titleanddesc-title{font:300 1.5em/1.1 "Helvetica Neue",sans-serif!important;text-transform:none!important;color:#fff;margin:0 0 15px;padding:0}.jp-carousel-titleanddesc-desc p{color:#999;line-height:1.4;margin-bottom:.75em}.jp-carousel-comments p a,.jp-carousel-info h2 a,.jp-carousel-titleanddesc p a{color:#fff!important;border:none!important;text-decoration:underline!important;font-weight:400!important;font-style:normal!important}.jp-carousel-titleanddesc p b,.jp-carousel-titleanddesc p strong{font-weight:700;color:#999}.jp-carousel-titleanddesc p em,.jp-carousel-titleanddesc p i{font-style:italic;color:#999}.jp-carousel-comments p a:hover,.jp-carousel-info h2 a:hover,.jp-carousel-titleanddesc p a:hover{color:#68c9e8!important}.jp-carousel-titleanddesc p:empty{display:none}.jp-carousel-left-column-wrapper h1:after,.jp-carousel-left-column-wrapper h1:before,.jp-carousel-photo-info h1:after,.jp-carousel-photo-info h1:before{content:none!important}.jp-carousel-image-meta{background:#111;border:1px solid #222;color:#fff;font-size:13px;font:12px/1.4 "Helvetica Neue",sans-serif!important;overflow:hidden;padding:18px 20px;width:209px!important}.jp-carousel-image-meta h5,.jp-carousel-image-meta li{font-family:"Helvetica Neue",sans-serif!important;position:inherit!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;background:100% 0!important;border:none!important;font-weight:400!important;line-height:1.3em!important}.jp-carousel-image-meta ul{margin:0!important;padding:0!important;list-style:none!important}.jp-carousel-image-meta li{width:48%!important;display:inline-block!important;vertical-align:top!important;margin:0 0 15px 2%!important;color:#fff!important;font-size:13px!important}.jp-carousel-image-meta h5{color:#999!important;text-transform:uppercase!important;font-size:10px!important;margin:0 0 2px!important;letter-spacing:.1em!important}a.jp-carousel-image-download{padding-right:23px;display:inline-block;clear:both;color:#999;line-height:1;font-weight:400;font-size:13px;text-decoration:none;background-position:100% -82px}a.jp-carousel-image-download span.photo-size{font-size:11px;border-radius:1em;margin-right:2px;display:inline-block}a.jp-carousel-image-download span.photo-size-times{padding:0 2px 0 1px}a.jp-carousel-image-download:hover{background-position:100% -122px;color:#68c9e8;border:none!important}.jp-carousel-image-map{position:relative;margin:-20px -20px 20px;border-bottom:1px solid rgba(255,255,255,.17);height:154px}.jp-carousel-image-map img.gmap-main{border-top-right-radius:6px;border-left:1px solid rgba(255,255,255,.17)}.jp-carousel-image-map div.gmap-topright{width:94px;height:154px;position:absolute;top:0;left:0}.jp-carousel-image-map div.imgclip{overflow:hidden;border-top-left-radius:6px}.jp-carousel-image-map div.gmap-topright img{margin-right:-40px}.jp-carousel-image-map img.gmap-bottomright{position:absolute;top:96px;left:0}.jp-carousel-comments{font:15px/1.7 "Helvetica Neue",sans-serif!important;font-weight:400;background:none transparent}.jp-carousel-comments p a:active,.jp-carousel-comments p a:focus,.jp-carousel-comments p a:hover{color:#68c9e8!important}.jp-carousel-comment{background:none transparent;color:#999;margin-bottom:20px;clear:right;overflow:auto;width:100%}.jp-carousel-comment p{color:#999!important}.jp-carousel-comment .comment-author{font-size:13px;font-weight:400;padding:0;width:auto;display:inline;float:none;border:none;margin:0}.jp-carousel-comment .comment-author a{color:#fff}.jp-carousel-comment .comment-gravatar{float:right}.jp-carousel-comment .comment-content{border:none;margin-right:85px;padding:0}.jp-carousel-comment .avatar{margin:0 0 0 20px;border-radius:4px;border:none!important;padding:0!important;background-color:transparent!important}.jp-carousel-comment .comment-date{color:#999;margin-top:4px;font-size:11px;display:inline;float:left}#jp-carousel-comment-form{margin:0 0 10px!important;float:right;width:100%}textarea#jp-carousel-comment-form-comment-field{background:rgba(34,34,34,.9);border:1px solid #3a3a3a;color:#aaa;font:15px/1.4 "Helvetica Neue",sans-serif!important;width:100%;padding:10px 10px 5px;margin:0;float:none;height:147px;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:3px;overflow:hidden;box-sizing:border-box}textarea#jp-carousel-comment-form-comment-field::-webkit-input-placeholder{color:#555}textarea#jp-carousel-comment-form-comment-field:focus{background:#ccc;color:#222}textarea#jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder{color:#aaa}#jp-carousel-comment-form-spinner{color:#fff;margin:22px 10px 0 0;display:block;width:20px;height:20px;float:right}#jp-carousel-comment-form-submit-and-info-wrapper{display:none;overflow:hidden;width:100%}#jp-carousel-comment-form-commenting-as input{background:rgba(34,34,34,.9);border:1px solid #3a3a3a;color:#aaa;font:13px/1.4 "Helvetica Neue",sans-serif!important;padding:3px 6px;float:right;box-shadow:inset -2px 2px 2px rgba(0,0,0,.2);border-radius:2px;width:285px}#jp-carousel-comment-form-commenting-as input:focus{background:#ccc;color:#222}#jp-carousel-comment-form-commenting-as p{font:400 13px/1.7 "Helvetica Neue",sans-serif!important;margin:22px 0 0;float:right}#jp-carousel-comment-form-commenting-as fieldset{float:right;border:none;margin:20px 0 0 0;padding:0}#jp-carousel-comment-form-commenting-as fieldset{clear:both}#jp-carousel-comment-form-commenting-as label{font:400 13px/1.7 "Helvetica Neue",sans-serif!important;margin:0 0 3px 20px;float:right;width:100px}#jp-carousel-comment-form-button-submit{margin-top:20px;float:left}#js-carousel-comment-form-container{margin-bottom:15px;overflow:auto;width:100%}#jp-carousel-comment-form-container{margin-bottom:15px;overflow:auto;width:100%}#jp-carousel-comment-post-results{display:none;overflow:auto;width:100%}#jp-carousel-comment-post-results span{display:block;text-align:center;margin-top:20px;width:100%;overflow:auto;padding:1em 0;box-sizing:border-box;background:rgba(0,0,0,.7);border-radius:2px;font:13px/1.4 "Helvetica Neue",sans-serif!important;border:1px solid rgba(255,255,255,.17);box-shadow:inset 0 0 5px 5px rgba(0,0,0,1)}.jp-carousel-comment-post-error{color:#df4926}#jp-carousel-comments-closed{display:none;color:#999}#jp-carousel-comments-loading{font:400 15px/1.7 "Helvetica Neue",sans-serif!important;display:none;color:#999;text-align:right;margin-bottom:20px}.jp-carousel-light .jp-carousel-overlay{background:#fff}.jp-carousel-light .jp-carousel-next-button:hover span,.jp-carousel-light .jp-carousel-previous-button:hover span{opacity:.8}.jp-carousel-light .jp-carousel-close-hint:hover,.jp-carousel-light .jp-carousel-titleanddesc div{color:#000!important}.jp-carousel-light .jp-carousel-comment .comment-author a,.jp-carousel-light .jp-carousel-comments p a,.jp-carousel-light .jp-carousel-info h2 a,.jp-carousel-light .jp-carousel-titleanddesc p a{color:#1e8cbe!important}.jp-carousel-light .jp-carousel-comment .comment-author a:hover,.jp-carousel-light .jp-carousel-comments p a:hover,.jp-carousel-light .jp-carousel-info h2 a:hover,.jp-carousel-light .jp-carousel-titleanddesc p a:hover{color:#f1831e!important}.jp-carousel-light .jp-carousel-comment,.jp-carousel-light .jp-carousel-comment p,.jp-carousel-light .jp-carousel-info h2,.jp-carousel-light .jp-carousel-titleanddesc,.jp-carousel-light .jp-carousel-titleanddesc p,.jp-carousel-light .jp-carousel-titleanddesc p b,.jp-carousel-light .jp-carousel-titleanddesc p em,.jp-carousel-light .jp-carousel-titleanddesc p i,.jp-carousel-light .jp-carousel-titleanddesc p strong,.jp-carousel-light div.jp-carousel-buttons a{color:#666}.jp-carousel-light .jp-carousel-buttons{border-bottom-color:#f0f0f0;background:#f5f5f5}.jp-carousel-light div.jp-carousel-buttons a:hover{text-decoration:none;color:#f1831e}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog,.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog:hover{background-position:4px -56px;padding-right:24px!important}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-color:#2ea2cc;color:#fff}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-commentlink{background-position:100% -176px}.jp-carousel-light div.jp-carousel-buttons a.jp-carousel-reblog.reblogged{background-position:5px -36px}.jp-carousel-light div#carousel-reblog-box{background:#eee;background:-moz-linear-gradient(bottom,#ececec,#f7f7f7);background:-webkit-gradient(linear,right bottom,right top,from(#ececec),to(#f7f7f7));box-shadow:0 2px 10px rgba(0,0,0,.1);border:1px solid #ddd}.jp-carousel-light #carousel-reblog-box textarea{border:1px inset #ccc;color:#666;border:1px solid #cfcfcf;background:#fff}.jp-carousel-light #carousel-reblog-box .canceltext{color:#888}.jp-carousel-light #carousel-reblog-box .canceltext a{color:#666}.jp-carousel-light #carousel-reblog-box select{background:#eee;color:#333;border:1px solid #aaa}#jp-carousel-comment-form-button-submit,.jp-carousel-light #carousel-reblog-box input#carousel-reblog-submit{color:#333;background:#fff;background:-moz-linear-gradient(bottom,#ddd,#fff);background:-webkit-gradient(linear,right bottom,right top,from(#ddd),to(#fff));border:1px solid #aaa}.jp-carousel-light .jp-carousel-image-meta{background:#fafafa;border:1px solid #eee;border-top-color:#f5f5f5;border-right-color:#f5f5f5;color:#333}.jp-carousel-light .jp-carousel-image-meta li{color:#000!important}.jp-carousel-light .jp-carousel-close-hint{color:#ccc}.jp-carousel-light .jp-carousel-close-hint span{background-color:#fff;border-color:#ccc}.jp-carousel-light #jp-carousel-comment-form-comment-field::-webkit-input-placeholder{color:#aaa}.jp-carousel-light #jp-carousel-comment-form-comment-field:focus{color:#333}.jp-carousel-light #jp-carousel-comment-form-comment-field:focus::-webkit-input-placeholder{color:#ddd}.jp-carousel-light a.jp-carousel-image-download{background-position:100% -122px}.jp-carousel-light a.jp-carousel-image-download:hover{background-position:100% -122px;color:#f1831e}.jp-carousel-light textarea#jp-carousel-comment-form-comment-field{background:#fbfbfb;color:#333;border:1px solid #dfdfdf;box-shadow:inset -2px 2px 2px rgba(0,0,0,.1)}.jp-carousel-light #jp-carousel-comment-form-commenting-as input{background:#fbfbfb;border:1px solid #dfdfdf;color:#333;box-shadow:inset -2px 2px 2px rgba(0,0,0,.1)}.jp-carousel-light #jp-carousel-comment-form-commenting-as input:focus{background:#fbfbfb;color:#333}.jp-carousel-light #jp-carousel-comment-post-results span{background:#f7f7f7;border:1px solid #dfdfdf;box-shadow:inset 0 0 5px rgba(0,0,0,.05)}.jp-carousel-light .jp-carousel-slide{background-color:#fff}.jp-carousel-light .jp-carousel-titleanddesc{border-top:1px solid #eee}.jp-carousel-light .jp-carousel-fadeaway{background:-moz-linear-gradient(bottom,rgba(255,255,255,.75),rgba(255,255,255,0));background:-webkit-gradient(linear,right bottom,right top,from(rgba(255,255,255,.75)),to(rgba(255,255,255,0)))}@media only screen and (max-width:760px){.jp-carousel-info{margin:0 10px!important}.jp-carousel-next-button,.jp-carousel-previous-button{display:none!important}.jp-carousel-buttons{display:none!important}.jp-carousel-image-meta{float:none!important;width:100%!important;box-sizing:border-box}.jp-carousel-close-hint{font-weight:800!important;font-size:26px!important;position:fixed!important;top:-10px}.jp-carousel-slide img{filter:alpha(opacity=100);opacity:1}.jp-carousel-wrap{background-color:#000}.jp-carousel-fadeaway{display:none}#jp-carousel-comment-form-container{display:none!important}.jp-carousel-titleanddesc{padding-top:0!important;border:none!important}.jp-carousel-titleanddesc-title{font-size:1em!important}.jp-carousel-left-column-wrapper{padding:0;width:100%!important}.jp-carousel-photo-info{right:0!important;width:100%!important}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/carousel/jetpack-carousel.php b/plugins/jetpack/modules/carousel/jetpack-carousel.php
index 58613f61..e75b94cd 100644
--- a/plugins/jetpack/modules/carousel/jetpack-carousel.php
+++ b/plugins/jetpack/modules/carousel/jetpack-carousel.php
@@ -348,7 +348,6 @@ class Jetpack_Carousel {
foreach( $matches[0] as $image_html ) {
if ( preg_match( '/wp-image-([0-9]+)/i', $image_html, $class_id ) &&
( $attachment_id = absint( $class_id[1] ) ) ) {
-
/*
* If exactly the same image tag is used more than once, overwrite it.
* All identical tags will be replaced later with 'str_replace()'.
@@ -357,21 +356,32 @@ class Jetpack_Carousel {
}
}
- foreach ( $selected_images as $attachment_id => $image_html ) {
- $attachment = get_post( $attachment_id );
+ $find = array();
+ $replace = array();
+ if ( empty( $selected_images ) ) {
+ return $content;
+ }
- if ( ! $attachment ) {
- continue;
- }
+ $attachments = get_posts( array(
+ 'include' => array_keys( $selected_images ),
+ 'post_type' => 'any',
+ 'post_status' => 'any'
+ ) );
+
+ foreach ( $attachments as $attachment ) {
+ $image_html = $selected_images[ $attachment->ID ];
$attributes = $this->add_data_to_images( array(), $attachment );
$attributes_html = '';
foreach( $attributes as $k => $v ) {
$attributes_html .= esc_attr( $k ) . '="' . esc_attr( $v ) . '" ';
}
- $image_html_with_data = str_replace( '<img ', "<img $attributes_html", $image_html );
- $content = str_replace( $image_html, $image_html_with_data, $content );
+
+ $find[] = $image_html;
+ $replace[] = str_replace( '<img ', "<img $attributes_html", $image_html );
}
+
+ $content = str_replace( $find, $replace, $content );
$this->enqueue_assets();
return $content;
}
diff --git a/plugins/jetpack/modules/comments/comments.php b/plugins/jetpack/modules/comments/comments.php
index 7465159b..9160a164 100644
--- a/plugins/jetpack/modules/comments/comments.php
+++ b/plugins/jetpack/modules/comments/comments.php
@@ -7,7 +7,7 @@ require dirname( __FILE__ ) . '/base.php';
*
* @package JetpackComments
* @version 1.4
- * @since 1.4
+ * @since 1.4
*/
class Jetpack_Comments extends Highlander_Comments_Base {
@@ -30,14 +30,14 @@ class Jetpack_Comments extends Highlander_Comments_Base {
* @var string
* @see ::set_default_color_theme_based_on_theme_settings()
*/
- public $default_color_scheme = 'light';
+ public $default_color_scheme = 'light';
/** Methods ***************************************************************/
public static function init() {
static $instance = false;
- if ( !$instance ) {
+ if ( ! $instance ) {
$instance = new Jetpack_Comments;
}
@@ -59,7 +59,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
*
* @module comments
*
- * @since 1.4.0
+ * @since 1.4.0
*
* @param array $jetpack_comments_loaded First element in array of type Jetpack_Comments
**/
@@ -69,7 +69,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
public function set_default_color_theme_based_on_theme_settings() {
if ( function_exists( 'twentyeleven_get_theme_options' ) ) {
- $theme_options = twentyeleven_get_theme_options();
+ $theme_options = twentyeleven_get_theme_options();
$theme_color_scheme = isset( $theme_options['color_scheme'] ) ? $theme_options['color_scheme'] : 'transparent';
} else {
$theme_color_scheme = get_theme_mod( 'color_scheme', 'transparent' );
@@ -112,11 +112,11 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// Selfishly remove everything from the existing comment form
remove_all_actions( 'comment_form_before' );
- remove_all_actions( 'comment_form_after' );
+ remove_all_actions( 'comment_form_after' );
// Selfishly add only our actions back to the comment form
add_action( 'comment_form_before', array( $this, 'comment_form_before' ) );
- add_action( 'comment_form_after', array( $this, 'comment_form_after' ) );
+ add_action( 'comment_form_after', array( $this, 'comment_form_after' ) );
// Before a comment is posted
add_action( 'pre_comment_on_post', array( $this, 'pre_comment_on_post' ), 1 );
@@ -133,17 +133,19 @@ class Jetpack_Comments extends Highlander_Comments_Base {
parent::setup_filters();
add_filter( 'comment_post_redirect', array( $this, 'capture_comment_post_redirect_to_reload_parent_frame' ), 100 );
- add_filter( 'get_avatar', array( $this, 'get_avatar' ), 10, 4 );
+ add_filter( 'get_avatar', array( $this, 'get_avatar' ), 10, 4 );
}
/**
* Get the comment avatar from Gravatar, Twitter, or Facebook
*
* @since JetpackComments (1.4)
- * @param string $avatar Current avatar URL
+ *
+ * @param string $avatar Current avatar URL
* @param string $comment Comment for the avatar
- * @param int $size Size of the avatar
+ * @param int $size Size of the avatar
* @param string $default Not used
+ *
* @return string New avatar
*/
public function get_avatar( $avatar, $comment, $size, $default ) {
@@ -153,10 +155,10 @@ class Jetpack_Comments extends Highlander_Comments_Base {
}
// Detect whether it's a Facebook or Twitter avatar
- $foreign_avatar = get_comment_meta( $comment->comment_ID, 'hc_avatar', true );
+ $foreign_avatar = get_comment_meta( $comment->comment_ID, 'hc_avatar', true );
$foreign_avatar_hostname = parse_url( $foreign_avatar, PHP_URL_HOST );
if ( ! $foreign_avatar_hostname ||
- ! preg_match( '/\.?(graph\.facebook\.com|twimg\.com)$/', $foreign_avatar_hostname ) ) {
+ ! preg_match( '/\.?(graph\.facebook\.com|twimg\.com)$/', $foreign_avatar_hostname ) ) {
return $avatar;
}
@@ -177,7 +179,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
*
* @module comments
*
- * @since 3.8.1
+ * @since 3.8.1
*
* @param boolean $return Should comments be enabled?
*/
@@ -207,17 +209,18 @@ class Jetpack_Comments extends Highlander_Comments_Base {
ob_end_clean();
// If users are required to be logged in, and they're not, then we don't need to do anything else
- if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) {
+ if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) {
/**
* Changes the log in to comment prompt.
*
* @module comments
*
- * @since 1.4.0
+ * @since 1.4.0
*
* @param string $var Default is "You must log in to post a comment."
*/
echo '<p class="must-log-in">' . sprintf( apply_filters( 'jetpack_must_log_in_to_comment', __( 'You must <a href="%s">log in</a> to post a comment.', 'jetpack' ) ), wp_login_url( get_permalink() . '#respond' ) ) . '</p>';
+
return;
}
@@ -232,14 +235,14 @@ class Jetpack_Comments extends Highlander_Comments_Base {
$stc_enabled = 0;
}
- $params = array(
+ $params = array(
'blogid' => Jetpack_Options::get_option( 'id' ),
'postid' => get_the_ID(),
'comment_registration' => ( get_option( 'comment_registration' ) ? '1' : '0' ), // Need to explicitly send a '1' or a '0' for these
- 'require_name_email' => ( get_option( 'require_name_email' ) ? '1' : '0' ),
+ 'require_name_email' => ( get_option( 'require_name_email' ) ? '1' : '0' ),
'stc_enabled' => $stc_enabled,
'stb_enabled' => $stb_enabled,
- 'show_avatars' => ( get_option( 'show_avatars' ) ? '1' : '0' ),
+ 'show_avatars' => ( get_option( 'show_avatars' ) ? '1' : '0' ),
'avatar_default' => get_option( 'avatar_default' ),
'greeting' => get_option( 'highlander_comment_form_prompt', __( 'Leave a Reply', 'jetpack' ) ),
/**
@@ -247,11 +250,11 @@ class Jetpack_Comments extends Highlander_Comments_Base {
*
* @module comments
*
- * @since 2.3.0
+ * @since 2.3.0
*
* @param string $var Default is "Leave a Reply to %s."
*/
- 'greeting_reply' => apply_filters( 'jetpack_comment_form_prompt_reply', __( 'Leave a Reply to %s' , 'jetpack' ) ),
+ 'greeting_reply' => apply_filters( 'jetpack_comment_form_prompt_reply', __( 'Leave a Reply to %s', 'jetpack' ) ),
'color_scheme' => get_option( 'jetpack_comment_form_color_scheme', $this->default_color_scheme ),
'lang' => get_locale(),
'jetpack_version' => JETPACK__VERSION,
@@ -265,8 +268,9 @@ class Jetpack_Comments extends Highlander_Comments_Base {
$params['hc_username'] = $current_user->display_name;
$params['hc_userurl'] = $current_user->user_url;
$params['hc_useremail'] = md5( strtolower( trim( $current_user->user_email ) ) );
- if ( current_user_can( 'unfiltered_html' ) )
+ if ( current_user_can( 'unfiltered_html' ) ) {
$params['_wp_unfiltered_html_comment'] = wp_create_nonce( 'unfiltered-html-comment_' . get_the_ID() );
+ }
}
$signature = Jetpack_Comments::sign_remote_comment_parameters( $params, Jetpack_Options::get_option( 'blog_token' ) );
@@ -291,7 +295,7 @@ class Jetpack_Comments extends Highlander_Comments_Base {
*
* @module comments
*
- * @since 4.7.0
+ * @since 4.7.0
*
* @param bool $show Can the comment be displayed? Default to true.
*/
@@ -302,19 +306,21 @@ class Jetpack_Comments extends Highlander_Comments_Base {
<div id="respond" class="comment-respond">
<?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>
+ <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 ); ?>" 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++ ) {
+ 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>
@@ -334,101 +340,110 @@ class Jetpack_Comments extends Highlander_Comments_Base {
*/
public function watch_comment_parent() {
$url_origin = set_url_scheme( 'http://jetpack.wordpress.com' );
- ?>
+ ?>
<!--[if IE]>
<script type="text/javascript">
- if ( 0 === window.location.hash.indexOf( '#comment-' ) ) {
- // window.location.reload() doesn't respect the Hash in IE
- window.location.hash = window.location.hash;
- }
+ if ( 0 === window.location.hash.indexOf( '#comment-' ) ) {
+ // window.location.reload() doesn't respect the Hash in IE
+ window.location.hash = window.location.hash;
+ }
</script>
<![endif]-->
<script type="text/javascript">
- var comm_par_el = document.getElementById( 'comment_parent' ),
- comm_par = (comm_par_el && comm_par_el.value) ? comm_par_el.value : '',
- frame = document.getElementById( 'jetpack_remote_comment' ),
- tellFrameNewParent;
-
- tellFrameNewParent = function() {
- if ( comm_par ) {
- frame.src = "<?php echo esc_url_raw( $this->signed_url ); ?>" + '&replytocom=' + parseInt( comm_par, 10 ).toString();
- } else {
- frame.src = "<?php echo esc_url_raw( $this->signed_url ); ?>";
- }
- };
-
- <?php if ( get_option( 'thread_comments' ) && get_option( 'thread_comments_depth' ) ) : ?>
-
- if ( 'undefined' !== typeof addComment ) {
- addComment._Jetpack_moveForm = addComment.moveForm;
+ (function () {
+ var comm_par_el = document.getElementById( 'comment_parent' ),
+ comm_par = ( comm_par_el && comm_par_el.value ) ? comm_par_el.value : '',
+ frame = document.getElementById( 'jetpack_remote_comment' ),
+ tellFrameNewParent;
+
+ tellFrameNewParent = function () {
+ if ( comm_par ) {
+ frame.src = "<?php echo esc_url_raw( $this->signed_url ); ?>" + '&replytocom=' + parseInt( comm_par, 10 ).toString();
+ } else {
+ frame.src = "<?php echo esc_url_raw( $this->signed_url ); ?>";
+ }
+ };
- addComment.moveForm = function( commId, parentId, respondId, postId ) {
- var returnValue = addComment._Jetpack_moveForm( commId, parentId, respondId, postId ), cancelClick, cancel;
+ <?php if ( get_option( 'thread_comments' ) && get_option( 'thread_comments_depth' ) ) : ?>
- if ( false === returnValue ) {
- cancel = document.getElementById( 'cancel-comment-reply-link' );
- cancelClick = cancel.onclick;
- cancel.onclick = function() {
- var cancelReturn = cancelClick.call( this );
- if ( false !== cancelReturn ) {
- return cancelReturn;
- }
+ if ( 'undefined' !== typeof addComment ) {
+ addComment._Jetpack_moveForm = addComment.moveForm;
- if ( !comm_par ) {
- return cancelReturn;
- }
+ addComment.moveForm = function ( commId, parentId, respondId, postId ) {
+ var returnValue = addComment._Jetpack_moveForm( commId, parentId, respondId, postId ),
+ cancelClick, cancel;
- comm_par = 0;
+ if ( false === returnValue ) {
+ cancel = document.getElementById( 'cancel-comment-reply-link' );
+ cancelClick = cancel.onclick;
+ cancel.onclick = function () {
+ var cancelReturn = cancelClick.call( this );
+ if ( false !== cancelReturn ) {
+ return cancelReturn;
+ }
- tellFrameNewParent();
+ if ( ! comm_par ) {
+ return cancelReturn;
+ }
- return cancelReturn;
- };
- }
+ comm_par = 0;
- if ( comm_par == parentId ) {
- return returnValue;
- }
+ tellFrameNewParent();
- comm_par = parentId;
+ return cancelReturn;
+ };
+ }
- tellFrameNewParent();
+ if ( comm_par == parentId ) {
+ return returnValue;
+ }
- return returnValue;
- };
- }
+ comm_par = parentId;
- <?php endif; ?>
+ tellFrameNewParent();
- if ( window.postMessage ) {
- if ( document.addEventListener ) {
- window.addEventListener( 'message', function( event ) {
- if ( <?php echo json_encode( esc_url_raw( $url_origin ) ); ?> !== event.origin ) {
- return;
- }
+ return returnValue;
+ };
+ }
- jQuery( frame ).height( event.data );
- } );
- } else if ( document.attachEvent ) {
- window.attachEvent( 'message', function( event ) {
- if ( <?php echo json_encode( esc_url_raw( $url_origin ) ); ?> !== event.origin ) {
- return;
+ <?php endif; ?>
+
+ // Do the post message bit after the dom has loaded.
+ document.addEventListener( 'DOMContentLoaded', function () {
+ var iframe_url = <?php echo json_encode( esc_url_raw( $url_origin ) ); ?>;
+ if ( window.postMessage ) {
+ if ( document.addEventListener ) {
+ window.addEventListener( 'message', function ( event ) {
+ var origin = event.origin.replace( /^http:\/\//i, 'https://' );
+ if ( iframe_url.replace( /^http:\/\//i, 'https://' ) !== origin ) {
+ return;
+ }
+ jQuery( frame ).height( event.data );
+ });
+ } else if ( document.attachEvent ) {
+ window.attachEvent( 'message', function ( event ) {
+ var origin = event.origin.replace( /^http:\/\//i, 'https://' );
+ if ( iframe_url.replace( /^http:\/\//i, 'https://' ) !== origin ) {
+ return;
+ }
+ jQuery( frame ).height( event.data );
+ });
}
+ }
+ })
- jQuery( frame ).height( event.data );
- } );
- }
- }
+ })();
</script>
- <?php
+ <?php
}
/**
* Verify the hash included in remote comments.
*
* @since JetpackComments (1.4)
+ *
* @param type $comment Not used
*/
public function pre_comment_on_post( $comment ) {
@@ -437,11 +452,13 @@ class Jetpack_Comments extends Highlander_Comments_Base {
// Bail if missing the Jetpack token
if ( ! isset( $post_array['sig'] ) ) {
unset( $_POST['hc_post_as'] );
+
return;
}
- if ( FALSE !== strpos( $post_array['hc_avatar'], '.gravatar.com' ) )
+ if ( false !== strpos( $post_array['hc_avatar'], '.gravatar.com' ) ) {
$post_array['hc_avatar'] = htmlentities( $post_array['hc_avatar'] );
+ }
$check = Jetpack_Comments::sign_remote_comment_parameters( $post_array, Jetpack_Options::get_option( 'blog_token' ) );
if ( is_wp_error( $check ) ) {
@@ -449,8 +466,9 @@ class Jetpack_Comments extends Highlander_Comments_Base {
}
// Bail if token is expired or not valid
- if ( $check !== $post_array['sig'] )
+ if ( $check !== $post_array['sig'] ) {
wp_die( __( 'Invalid security token.', 'jetpack' ) );
+ }
/** This filter is documented in modules/comments/comments.php */
if ( ! apply_filters( 'jetpack_comment_form_enabled_for_' . get_post_type( $post_array['comment_post_ID'] ), true ) ) {
@@ -468,12 +486,13 @@ class Jetpack_Comments extends Highlander_Comments_Base {
* service the comment is from, the avatar, user_id, etc...
*
* @since JetpackComments (1.4)
+ *
* @param type $comment_id
*/
public function add_comment_meta( $comment_id ) {
$comment_meta = array();
- switch( $this->is_highlander_comment_post() ) {
+ switch ( $this->is_highlander_comment_post() ) {
case 'facebook' :
$comment_meta['hc_post_as'] = 'facebook';
$comment_meta['hc_avatar'] = stripslashes( $_POST['hc_avatar'] );
@@ -502,94 +521,99 @@ class Jetpack_Comments extends Highlander_Comments_Base {
}
// Bail if no extra comment meta
- if ( empty( $comment_meta ) )
+ if ( empty( $comment_meta ) ) {
return;
+ }
// Loop through extra meta and add values
- foreach ( $comment_meta as $key => $value )
+ foreach ( $comment_meta as $key => $value ) {
add_comment_meta( $comment_id, $key, $value, true );
+ }
}
+
function capture_comment_post_redirect_to_reload_parent_frame( $url ) {
- if ( !isset( $_GET['for'] ) || 'jetpack' != $_GET['for'] ) {
+ if ( ! isset( $_GET['for'] ) || 'jetpack' != $_GET['for'] ) {
return $url;
}
-?>
-<!DOCTYPE html>
-<html <?php language_attributes(); ?>>
-<!--<![endif]-->
-<head>
-<meta charset="<?php bloginfo( 'charset' ); ?>" />
-<title><?php printf( __( 'Submitting Comment%s', 'jetpack' ), '&hellip;' ); ?></title>
-<style type="text/css">
-body {
- display: table;
- width: 100%;
- height: 60%;
- position: absolute;
- top: 0;
- left: 0;
- overflow: hidden;
- color: #333;
-}
+ ?>
+ <!DOCTYPE html>
+ <html <?php language_attributes(); ?>>
+ <!--<![endif]-->
+ <head>
+ <meta charset="<?php bloginfo( 'charset' ); ?>" />
+ <title><?php printf( __( 'Submitting Comment%s', 'jetpack' ), '&hellip;' ); ?></title>
+ <style type="text/css">
+ body {
+ display: table;
+ width: 100%;
+ height: 60%;
+ position: absolute;
+ top: 0;
+ left: 0;
+ overflow: hidden;
+ color: #333;
+ }
-h1 {
- text-align: center;
- margin: 0;
- padding: 0;
- display: table-cell;
- vertical-align: middle;
- font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
- font-weight: normal;
-}
+ h1 {
+ text-align: center;
+ margin: 0;
+ padding: 0;
+ display: table-cell;
+ vertical-align: middle;
+ font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
+ font-weight: normal;
+ }
-.hidden {
- opacity: 0;
-}
+ .hidden {
+ opacity: 0;
+ }
-h1 span {
- -moz-transition-property: opacity;
- -moz-transition-duration: 1s;
- -moz-transition-timing-function: ease-in-out;
+ h1 span {
+ -moz-transition-property: opacity;
+ -moz-transition-duration: 1s;
+ -moz-transition-timing-function: ease-in-out;
- -webkit-transition-property: opacity;
- -webkit-transition-duration: 1s;
- -webbit-transition-timing-function: ease-in-out;
+ -webkit-transition-property: opacity;
+ -webkit-transition-duration: 1s;
+ -webbit-transition-timing-function: ease-in-out;
- -o-transition-property: opacity;
- -o-transition-duration: 1s;
- -o-transition-timing-function: ease-in-out;
+ -o-transition-property: opacity;
+ -o-transition-duration: 1s;
+ -o-transition-timing-function: ease-in-out;
- -ms-transition-property: opacity;
- -ms-transition-duration: 1s;
- -ms-transition-timing-function: ease-in-out;
+ -ms-transition-property: opacity;
+ -ms-transition-duration: 1s;
+ -ms-transition-timing-function: ease-in-out;
- transition-property: opacity;
- transition-duration: 1s;
- transition-timing-function: ease-in-out;
-}
-</style>
-</head>
-<body>
- <h1><?php printf( __( 'Submitting Comment%s', 'jetpack' ), '<span id="ellipsis" class="hidden">&hellip;</span>' ); ?></h1>
-<script type="text/javascript">
-try {
- window.parent.location = <?php echo json_encode( $url ); ?>;
- window.parent.location.reload( true );
-} catch ( e ) {
- window.location = <?php echo json_encode( $url ); ?>;
- window.location.reload( true );
-}
-ellipsis = document.getElementById( 'ellipsis' );
-function toggleEllipsis() {
- ellipsis.className = ellipsis.className ? '' : 'hidden';
-}
-setInterval( toggleEllipsis, 1200 );
-</script>
-</body>
-</html>
-<?php
+ transition-property: opacity;
+ transition-duration: 1s;
+ transition-timing-function: ease-in-out;
+ }
+ </style>
+ </head>
+ <body>
+ <h1><?php printf( __( 'Submitting Comment%s', 'jetpack' ), '<span id="ellipsis" class="hidden">&hellip;</span>' ); ?></h1>
+ <script type="text/javascript">
+ try {
+ window.parent.location = <?php echo json_encode( $url ); ?>;
+ window.parent.location.reload(true);
+ } catch (e) {
+ window.location = <?php echo json_encode( $url ); ?>;
+ window.location.reload(true);
+ }
+ ellipsis = document.getElementById('ellipsis');
+
+ function toggleEllipsis() {
+ ellipsis.className = ellipsis.className ? '' : 'hidden';
+ }
+
+ setInterval(toggleEllipsis, 1200);
+ </script>
+ </body>
+ </html>
+ <?php
exit;
}
}
-Jetpack_Comments::init();
+Jetpack_Comments::init(); \ No newline at end of file
diff --git a/plugins/jetpack/modules/contact-form/css/grunion-rtl.css b/plugins/jetpack/modules/contact-form/css/grunion-rtl.css
new file mode 100644
index 00000000..6d5cd349
--- /dev/null
+++ b/plugins/jetpack/modules/contact-form/css/grunion-rtl.css
@@ -0,0 +1 @@
+.contact-form .clear-form{clear:both}.contact-form input[type=email],.contact-form input[type=text],.contact-form input[type=url]{width:300px;max-width:98%;margin-bottom:13px}.contact-form select{margin-bottom:13px}.contact-form textarea{height:200px;width:80%;float:none;margin-bottom:13px}.contact-form input[type=checkbox],.contact-form input[type=radio]{float:none;margin-bottom:13px}.contact-form label{margin-bottom:3px;float:none;font-weight:700;display:block}.contact-form label.checkbox,.contact-form label.radio{margin-bottom:3px;float:none;font-weight:700;display:inline-block}.contact-form label span{color:#aaa;margin-right:4px;font-weight:400}.contact-form-submission{margin-bottom:4em;padding:1.5em 1em}.contact-form-submission p{margin:0 auto}.form-errors .form-error-message{color:red}.textwidget .contact-form input[type=email],.textwidget .contact-form input[type=text],.textwidget .contact-form input[type=url],.textwidget .contact-form textarea{width:250px;max-width:100%;box-sizing:border-box}#jetpack-check-feedback-spam{margin:1px 0 0 8px}.jetpack-check-feedback-spam-spinner{display:inline-block;margin-top:7px} \ No newline at end of file
diff --git a/plugins/jetpack/modules/contact-form/css/grunion.css b/plugins/jetpack/modules/contact-form/css/grunion.css
index d0835755..8006876b 100644
--- a/plugins/jetpack/modules/contact-form/css/grunion.css
+++ b/plugins/jetpack/modules/contact-form/css/grunion.css
@@ -1,14 +1,80 @@
-.contact-form .clear-form { clear: both; }
-.contact-form input[type='text'], .contact-form input[type='email'] { width: 300px; max-width: 98%; margin-bottom: 13px; }
-.contact-form select { margin-bottom: 13px; }
-.contact-form textarea { height: 200px; width: 80%; float: none; margin-bottom: 13px; }
-.contact-form input[type='radio'], .contact-form input[type='checkbox'] { float: none; margin-bottom: 13px; }
-.contact-form label { margin-bottom: 3px; float: none; font-weight: bold; display: block; }
-.contact-form label.checkbox, .contact-form label.radio { margin-bottom: 3px; float: none; font-weight: bold; display: inline-block; }
-.contact-form label span { color: #AAA; margin-left: 4px; font-weight: normal; }
-.contact-form-submission { margin-bottom: 4em; padding: 1.5em 1em; }
-.contact-form-submission p { margin: 0 auto; }
-.form-errors .form-error-message { color: red; }
-.textwidget .contact-form input[type='text'], .textwidget .contact-form input[type='email'], .textwidget .contact-form textarea { width: 250px; max-width: 100%; box-sizing: border-box; }
-#jetpack-check-feedback-spam { margin: 1px 8px 0px 0px; }
-.jetpack-check-feedback-spam-spinner { display: inline-block; margin-top: 7px; }
+.contact-form .clear-form {
+ clear: both;
+}
+
+.contact-form input[type='text'],
+.contact-form input[type='email'],
+.contact-form input[type='url'] {
+ width: 300px;
+ max-width: 98%;
+ margin-bottom: 13px;
+}
+
+.contact-form select {
+ margin-bottom: 13px;
+}
+
+.contact-form textarea {
+ height: 200px;
+ width: 80%;
+ float: none;
+ margin-bottom: 13px;
+}
+
+.contact-form input[type='radio'],
+.contact-form input[type='checkbox'] {
+ float: none;
+ margin-bottom: 13px;
+}
+
+.contact-form label {
+ margin-bottom: 3px;
+ float: none;
+ font-weight: bold;
+ display: block;
+}
+
+.contact-form label.checkbox,
+.contact-form label.radio {
+ margin-bottom: 3px;
+ float: none;
+ font-weight: bold;
+ display: inline-block;
+}
+
+.contact-form label span {
+ color: #AAA;
+ margin-left: 4px;
+ font-weight: normal;
+}
+
+.contact-form-submission {
+ margin-bottom: 4em;
+ padding: 1.5em 1em;
+}
+
+.contact-form-submission p {
+ margin: 0 auto;
+}
+
+.form-errors .form-error-message {
+ color: red;
+}
+
+.textwidget .contact-form input[type='text'],
+.textwidget .contact-form input[type='email'],
+.textwidget .contact-form input[type='url'],
+.textwidget .contact-form textarea {
+ width: 250px;
+ max-width: 100%;
+ box-sizing: border-box;
+}
+
+#jetpack-check-feedback-spam {
+ margin: 1px 8px 0px 0px;
+}
+
+.jetpack-check-feedback-spam-spinner {
+ display: inline-block;
+ margin-top: 7px;
+}
diff --git a/plugins/jetpack/modules/contact-form/css/jquery-ui-datepicker.css b/plugins/jetpack/modules/contact-form/css/jquery-ui-datepicker.css
new file mode 100644
index 00000000..e82283eb
--- /dev/null
+++ b/plugins/jetpack/modules/contact-form/css/jquery-ui-datepicker.css
@@ -0,0 +1,160 @@
+.ui-datepicker {
+ padding: 0;
+ margin: 0;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+ background-color: #fff;
+ border: 1px solid #dfdfdf;
+ border-top: none;
+ -webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
+ box-shadow: 0 3px 6px rgba(0, 0, 0, 0.075);
+ width: auto;
+}
+
+.ui-datepicker * {
+ padding: 0;
+ -webkit-border-radius: 0;
+ -moz-border-radius: 0;
+ border-radius: 0;
+}
+
+.ui-datepicker table {
+ width: auto;
+ margin: 0;
+ border: none;
+ border-collapse: collapse;
+}
+
+.ui-datepicker .ui-widget-header,
+.ui-datepicker .ui-datepicker-header {
+ background-image: none;
+ border: none;
+ font-weight: normal;
+}
+
+.ui-datepicker .ui-datepicker-header .ui-state-hover {
+ background: transparent;
+ border-color: transparent;
+ cursor: pointer;
+}
+
+.ui-datepicker .ui-datepicker-title {
+ margin: 0;
+ padding: 10px 0;
+ font-size: 14px;
+ line-height: 14px;
+ text-align: center;
+}
+
+.ui-datepicker .ui-datepicker-prev,
+.ui-datepicker .ui-datepicker-next {
+ position: relative;
+ top: 0;
+ height: 34px;
+ width: 34px;
+}
+
+.ui-datepicker .ui-state-hover.ui-datepicker-prev,
+.ui-datepicker .ui-state-hover.ui-datepicker-next {
+ border: none;
+}
+
+.ui-datepicker .ui-datepicker-prev,
+.ui-datepicker .ui-datepicker-prev-hover {
+ left: 0;
+}
+
+.ui-datepicker .ui-datepicker-next,
+.ui-datepicker .ui-datepicker-next-hover {
+ right: 0;
+}
+
+.ui-datepicker .ui-datepicker-next span,
+.ui-datepicker .ui-datepicker-prev span {
+ display: none;
+}
+
+.ui-datepicker .ui-datepicker-prev {
+ float: left;
+}
+
+.ui-datepicker .ui-datepicker-next {
+ float: right;
+}
+
+.ui-datepicker .ui-datepicker-prev:before,
+.ui-datepicker .ui-datepicker-next:before {
+ font: normal 20px/34px 'dashicons';
+ padding-left: 7px;
+ speak: none;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ width: 34px;
+ height: 34px;
+}
+
+.ui-datepicker .ui-datepicker-prev:before {
+ content: '\f341';
+}
+
+.ui-datepicker .ui-datepicker-next:before {
+ content: '\f345';
+}
+
+.ui-datepicker .ui-datepicker-prev-hover:before,
+.ui-datepicker .ui-datepicker-next-hover:before {
+ opacity: 0.7;
+}
+
+.ui-datepicker select.ui-datepicker-month,
+.ui-datepicker select.ui-datepicker-year {
+ width: 33%;
+}
+
+.ui-datepicker thead {
+ font-weight: 600;
+}
+
+.ui-datepicker th {
+ padding: 10px;
+ border-width: 1px;
+}
+
+.ui-datepicker td {
+ padding: 0;
+ border: 1px solid #f4f4f4;
+}
+
+.ui-datepicker td.ui-datepicker-other-month {
+ border: transparent;
+}
+
+.ui-datepicker td.ui-datepicker-week-end {
+ background-color: #f4f4f4;
+ border: 1px solid #f4f4f4;
+}
+
+.ui-datepicker td.ui-datepicker-today {
+ background-color: #f0f0c0;
+}
+
+.ui-datepicker td.ui-datepicker-current-day {
+ background: #bbdd88;
+}
+
+.ui-datepicker td .ui-state-default {
+ background: transparent;
+ border: none;
+ text-align: center;
+ text-decoration: none;
+ width: auto;
+ display: block;
+ padding: 5px 10px;
+ font-weight: normal;
+ color: #444;
+}
+
+.ui-datepicker td.ui-state-disabled .ui-state-default {
+ opacity: 0.5;
+}
diff --git a/plugins/jetpack/modules/contact-form/grunion-contact-form.php b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
index 3e33b4b6..3323f5e8 100644
--- a/plugins/jetpack/modules/contact-form/grunion-contact-form.php
+++ b/plugins/jetpack/modules/contact-form/grunion-contact-form.php
@@ -97,7 +97,10 @@ class Grunion_Contact_Form_Plugin {
add_filter( 'widget_text', array( $this, 'widget_atts' ), 0 );
// If Text Widgets don't get shortcode processed, hack ours into place.
- if ( ! has_filter( 'widget_text', 'do_shortcode' ) ) {
+ if (
+ version_compare( get_bloginfo( 'version' ), '4.9-z', '<=' )
+ && ! has_filter( 'widget_text', 'do_shortcode' )
+ ) {
add_filter( 'widget_text', array( $this, 'widget_shortcode_hack' ), 5 );
}
@@ -2550,7 +2553,7 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
$field_label = $this->get_attribute( 'label' );
$field_required = $this->get_attribute( 'required' );
$placeholder = $this->get_attribute( 'placeholder' );
- $class = $this->get_attribute( 'class' );
+ $class = 'date' === $field_type ? 'jp-contact-form-date' : $this->get_attribute( 'class' );
$field_placeholder = ( ! empty( $placeholder ) ) ? "placeholder='" . esc_attr( $placeholder ) . "'" : '';
$field_class = "class='" . trim( esc_attr( $field_type ) . ' ' . esc_attr( $class ) ) . "' ";
@@ -2621,6 +2624,12 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
$r .= "\t\t<label for='" . esc_attr( $field_id ) . "' class='grunion-field-label telephone" . ( $this->is_error() ? ' form-error' : '' ) . "'>" . esc_html( $field_label ) . ( $field_required ? '<span>' . $required_field_text . '</span>' : '' ) . "</label>\n";
$r .= "\t\t<input type='tel' name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' value='" . esc_attr( $field_value ) . "' " . $field_class . $field_placeholder . "/>\n";
break;
+ case 'url' :
+ $r .= "\n<div>\n";
+ $r .= "\t\t<label for='" . esc_attr( $field_id ) . "' class='grunion-field-label url" . ( $this->is_error() ? ' form-error' : '' ) . "'>" . esc_html( $field_label ) . ( $field_required ? '<span>' . $required_field_text . '</span>' : '' ) . "</label>\n";
+ $r .= "\t\t<input type='url' name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' value='" . esc_attr( $field_value ) . "' " . $field_class . $field_placeholder . ' ' . ( $field_required ? "required aria-required='true'" : '' ) . "/>\n";
+ $r .= "\t</div>\n";
+ break;
case 'textarea' :
$r .= "\n<div>\n";
$r .= "\t\t<label for='contact-form-comment-" . esc_attr( $field_id ) . "' class='grunion-field-label textarea" . ( $this->is_error() ? ' form-error' : '' ) . "'>" . esc_html( $field_label ) . ( $field_required ? '<span>' . $required_field_text . '</span>' : '' ) . "</label>\n";
@@ -2671,10 +2680,14 @@ class Grunion_Contact_Form_Field extends Crunion_Contact_Form_Shortcode {
case 'date' :
$r .= "\n<div>\n";
$r .= "\t\t<label for='" . esc_attr( $field_id ) . "' class='grunion-field-label " . esc_attr( $field_type ) . ( $this->is_error() ? ' form-error' : '' ) . "'>" . esc_html( $field_label ) . ( $field_required ? '<span>' . $required_field_text . '</span>' : '' ) . "</label>\n";
- $r .= "\t\t<input type='date' name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' value='" . esc_attr( $field_value ) . "' " . $field_class . ( $field_required ? "required aria-required='true'" : '' ) . "/>\n";
+ $r .= "\t\t<input type='text' name='" . esc_attr( $field_id ) . "' id='" . esc_attr( $field_id ) . "' value='" . esc_attr( $field_value ) . "' " . $field_class . ( $field_required ? "required aria-required='true'" : '' ) . "/>\n";
$r .= "\t</div>\n";
wp_enqueue_script( 'grunion-frontend', plugins_url( 'js/grunion-frontend.js', __FILE__ ), array( 'jquery', 'jquery-ui-datepicker' ) );
+ wp_enqueue_style( 'jp-jquery-ui-datepicker', plugins_url( 'css/jquery-ui-datepicker.css', __FILE__ ), array( 'dashicons' ), '1.0' );
+
+ // Using Core's built-in datepicker localization routine
+ wp_localize_jquery_ui_datepicker();
break;
default : // text field
// note that any unknown types will produce a text input, so we can use arbitrary type names to handle
diff --git a/plugins/jetpack/modules/contact-form/grunion-editor-view.php b/plugins/jetpack/modules/contact-form/grunion-editor-view.php
index ce1946f8..ecdcf76e 100644
--- a/plugins/jetpack/modules/contact-form/grunion-editor-view.php
+++ b/plugins/jetpack/modules/contact-form/grunion-editor-view.php
@@ -30,7 +30,7 @@ class Grunion_Editor_View {
$title = __( 'Add Contact Form', 'jetpack' );
?>
- <button id="insert-jetpack-contact-form" class="button" title="<?php echo esc_attr( $title ); ?>" href="javascript:;">
+ <button type="button" id="insert-jetpack-contact-form" class="button" title="<?php echo esc_attr( $title ); ?>" href="javascript:;">
<span class="jetpack-contact-form-icon"></span>
<?php echo esc_html( $title ); ?>
</button>
@@ -83,7 +83,7 @@ class Grunion_Editor_View {
)
) );
- add_editor_style( plugins_url( 'css/editor-style.css', __FILE__ ) );
+ add_editor_style( plugin_dir_url( __FILE__ ) . 'css/editor-style.css' );
}
/**
@@ -171,7 +171,7 @@ class Grunion_Editor_View {
<script type="text/html" id="tmpl-grunion-field-date">
<div>
<label for='{{ data.id }}' class='grunion-field-label {{ data.type }}'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label>
- <input type='date' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class="{{ data.class }}" />
+ <input type='text' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class="{{ data.class }}" />
</div>
</script>
@@ -182,6 +182,13 @@ class Grunion_Editor_View {
</div>
</script>
+<script type="text/html" id="tmpl-grunion-field-url">
+ <div>
+ <label for='{{ data.id }}' class='grunion-field-label {{ data.type }}'>{{ data.label }}<# if ( data.required ) print( " <span>" + data.required + "</span>" ) #></label>
+ <input type='url' name='{{ data.id }}' id='{{ data.id }}' value='{{ data.value }}' class='{{ data.class }}' placeholder='{{ data.placeholder }}' />
+ </div>
+</script>
+
<script type="text/html" id="tmpl-grunion-field-edit">
<div class="card is-compact grunion-field-edit grunion-field-{{ data.type }}" aria-label="<?php esc_attr_e( 'Form Field', 'jetpack' ); ?>">
@@ -201,6 +208,7 @@ class Grunion_Editor_View {
'checkbox-multiple' => __( 'Checkbox with Multiple Items', 'jetpack' ),
'select' => __( 'Drop down', 'jetpack' ),
'radio' => __( 'Radio', 'jetpack' ),
+ 'date' => __( 'Date', 'jetpack' ),
);
?>
<div class="grunion-type-options">
diff --git a/plugins/jetpack/modules/contact-form/js/editor-view.js b/plugins/jetpack/modules/contact-form/js/editor-view.js
index 79a6e608..7cc0674c 100644
--- a/plugins/jetpack/modules/contact-form/js/editor-view.js
+++ b/plugins/jetpack/modules/contact-form/js/editor-view.js
@@ -19,7 +19,7 @@
date : wp.template( 'grunion-field-date' ),
text : wp.template( 'grunion-field-text' ),
name : wp.template( 'grunion-field-text' ),
- url : wp.template( 'grunion-field-text' )
+ url : wp.template( 'grunion-field-url' )
},
edit_template : wp.template( 'grunion-field-edit' ),
editor_inline : wp.template( 'grunion-editor-inline' ),
diff --git a/plugins/jetpack/modules/contact-form/js/grunion-frontend.js b/plugins/jetpack/modules/contact-form/js/grunion-frontend.js
index 25f0e911..dbd5664c 100644
--- a/plugins/jetpack/modules/contact-form/js/grunion-frontend.js
+++ b/plugins/jetpack/modules/contact-form/js/grunion-frontend.js
@@ -1,5 +1,3 @@
jQuery( function ( $ ) {
- if ( 'function' === typeof $.fn.datepicker ) {
- $( '.contact-form input[type="date"]' ).datepicker( { dateFormat : 'yy-mm-dd' } );
- }
-} ); \ No newline at end of file
+ $( '.contact-form input.jp-contact-form-date' ).datepicker();
+} );
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 60feb2dd..259bb79a 100644
--- a/plugins/jetpack/modules/custom-css/custom-css-4.7.php
+++ b/plugins/jetpack/modules/custom-css/custom-css-4.7.php
@@ -59,9 +59,21 @@ class Jetpack_Custom_CSS_Enhancements {
}
wp_register_style( 'jetpack-codemirror', plugins_url( 'custom-css/css/codemirror.css', __FILE__ ), array(), '20120905' );
- wp_register_style( 'jetpack-customizer-css', plugins_url( 'custom-css/css/customizer-control.css', __FILE__ ), array( 'jetpack-codemirror' ), '20140728' );
+ $deps = array();
+ if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
+ // If Core < 4.9
+ $deps[] = 'jetpack-codemirror';
+ }
+ wp_register_style( 'jetpack-customizer-css', plugins_url( 'custom-css/css/customizer-control.css', __FILE__ ), $deps, '20140728' );
wp_register_script( 'jetpack-codemirror', plugins_url( 'custom-css/js/codemirror.min.js', __FILE__ ), array(), '3.16', true );
- wp_register_script( 'jetpack-customizer-css', plugins_url( 'custom-css/js/core-customizer-css.js', __FILE__ ), array( 'customize-controls', 'underscore', 'jetpack-codemirror' ), JETPACK__VERSION, true );
+ $deps = array( 'customize-controls', 'underscore' );
+ $src = plugins_url( 'custom-css/js/core-customizer-css.core-4.9.js', __FILE__ );
+ if ( ! function_exists( 'wp_enqueue_code_editor' ) ) {
+ // If Core < 4.9
+ $deps[] = 'jetpack-codemirror';
+ $src = plugins_url( 'custom-css/js/core-customizer-css.js', __FILE__ );
+ }
+ wp_register_script( 'jetpack-customizer-css', $src, $deps, JETPACK__VERSION, true );
wp_register_script( 'jetpack-customizer-css-preview', plugins_url( 'custom-css/js/core-customizer-css-preview.js', __FILE__ ), array( 'customize-selective-refresh' ), JETPACK__VERSION, true );
@@ -676,12 +688,24 @@ class Jetpack_Custom_CSS_Enhancements {
* CONTROLS.
*/
- // Overwrite the Core Control.
+ // Overwrite or Tweak the Core Control.
$core_custom_css = $wp_customize->get_control( 'custom_css' );
if ( $core_custom_css ) {
- $wp_customize->remove_control( 'custom_css' );
- $core_custom_css->type = 'jetpackCss';
- $wp_customize->add_control( $core_custom_css );
+ if ( $core_custom_css instanceof WP_Customize_Code_Editor_Control ) {
+ // In WP 4.9, we let the Core CodeMirror control keep running the show, but hook into it to tweak stuff.
+ $types = array(
+ 'default' => 'text/css',
+ 'less' => 'text/x-less',
+ 'sass' => 'text/x-scss',
+ );
+ $preprocessor = $wp_customize->get_setting( 'jetpack_custom_css[preprocessor]' )->value();
+ if ( isset( $types[ $preprocessor ] ) ) {
+ $core_custom_css->code_type = $types[ $preprocessor ];
+ }
+ } else {
+ // Core < 4.9 Fallback
+ $core_custom_css->type = 'jetpackCss';
+ }
}
$wp_customize->selective_refresh->add_partial( 'custom_css', array(
diff --git a/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css b/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css
index 160e3d20..e7927ff2 100644
--- a/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css
+++ b/plugins/jetpack/modules/custom-css/custom-css/css/customizer-control.css
@@ -8,13 +8,23 @@
text-align: left;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
+}
+#customize-control-custom_css#customize-control-custom_css {
+ margin-right: -12px;
+ margin-left: -12px;
+ width: calc( 100% + 24px );
+}
+.customize-control-code_editor .CodeMirror {
height: 300px;
- height: calc( 100vh - 244px );
+ height: calc( 100vh - 268px );
}
.for-codemirror {
width: 98%;
height: 300px;
}
+#customize-control-wpcom_custom_css_content_width_control {
+ position: relative;
+}
#customize-control-wpcom_custom_css_content_width_control > label {
position: relative;
width: 100px;
diff --git a/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js b/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js
new file mode 100644
index 00000000..4e98e155
--- /dev/null
+++ b/plugins/jetpack/modules/custom-css/custom-css/js/core-customizer-css.core-4.9.js
@@ -0,0 +1,83 @@
+(function( $, customize ){
+ /**
+ * Helper function to qet a control by ID
+ * @param {string} controlId Control ID
+ * @return {object} jQuery object of the container
+ */
+ function _getControl ( controlId ) {
+ var control = customize.control.value( controlId );
+ if ( control ) {
+ return control.container;
+ }
+ return null;
+ }
+
+ /**
+ * Add some labels that the default checkbox controls don't allow.
+ * Add CSS Revisions and CSS Help links.
+ */
+ $(document).ready( function(){
+ var cssModeControl = _getControl( 'jetpack_css_mode_control' );
+ if ( cssModeControl ) {
+ cssModeControl.prepend( '<span class="customize-control-title">' + window._jp_css_settings.l10n.mode + '</span>' );
+ }
+
+ var mobileCssControl = _getControl( 'jetpack_mobile_css_control' );
+ if ( mobileCssControl ) {
+ mobileCssControl.prepend( '<span class="customize-control-title">' + window._jp_css_settings.l10n.mobile + '</span>' );
+ }
+
+ var widthControl = _getControl( 'wpcom_custom_css_content_width_control' );
+ if ( widthControl ) {
+ widthControl.append( '<span class="description">' + window._jp_css_settings.l10n.contentWidth + '<span>' );
+ widthControl.find( 'input' ).after( '<span>px</span>' );
+ }
+
+ $( '<div />', {
+ id : 'css-help-links',
+ 'class' : 'css-help'
+ }).appendTo( _getControl( 'custom_css' ) );
+
+ $( '<a />', {
+ id : 'help-link',
+ target : '_blank',
+ href : window._jp_css_settings.cssHelpUrl,
+ text : window._jp_css_settings.l10n.css_help_title
+ }).prependTo( '#css-help-links' );
+
+ // Only show the revisions link if there are revisions
+ if ( window._jp_css_settings.areThereCssRevisions ) {
+ $( '<a />', {
+ id : 'revisions-link',
+ target : '_blank',
+ href : window._jp_css_settings.revisionsUrl,
+ text : window._jp_css_settings.l10n.revisions
+ }).prependTo( '#css-help-links' );
+ }
+
+ customize( 'jetpack_custom_css[preprocessor]', function( preprocessorSetting ) {
+ preprocessorSetting.bind( function( curr ) {
+ var preprocessor_modes = {
+ 'default' : 'text/css',
+ less : 'text/x-less',
+ sass : 'text/x-scss'
+ },
+ new_mode = 'text/css';
+
+ if ( 'undefined' !== typeof preprocessor_modes[ curr ] ) {
+ new_mode = preprocessor_modes[ curr ];
+ }
+
+ customize.control( 'custom_css' ).deferred.codemirror.done( function ( cm ) {
+ cm.setOption( 'mode', new_mode );
+ if ( 'text/css' === new_mode ) {
+ cm.setOption( 'lint', true );
+ } else {
+ cm.setOption( 'lint', false );
+ }
+ });
+ });
+ });
+ });
+
+})( jQuery, this.wp.customize );
diff --git a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php
index 56779f77..4176c976 100644
--- a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php
+++ b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php
@@ -35,7 +35,10 @@ class Jetpack_Google_Analytics {
* @return void
*/
private function __construct() {
+ add_filter( 'jetpack_wga_classic_custom_vars', array( $this, 'jetpack_wga_classic_anonymize_ip' ) );
+ add_filter( 'jetpack_wga_classic_custom_vars', array( $this, 'jetpack_wga_classic_track_purchases' ) );
add_action( 'wp_footer', array( $this, 'insert_code' ) );
+ add_action( 'wp_footer', array( $this, 'jetpack_wga_classic_track_add_to_cart' ) );
}
/**
@@ -115,7 +118,7 @@ class Jetpack_Google_Analytics {
$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 ] );";
+ $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.
@@ -131,17 +134,27 @@ class Jetpack_Google_Analytics {
$custom_vars[] = "_gaq.push(['_trackPageview']);";
}
+ /**
+ * Allow for additional elements to be added to the classic Google Analytics queue (_gaq) array
+ *
+ * @since 5.4.0
+ *
+ * @param array $custom_vars Array of classic Google Analytics queue elements
+ */
+ $custom_vars = apply_filters( 'jetpack_wga_classic_custom_vars', $custom_vars );
+
+ // Ref: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce#Example
$async_code = "<!-- Jetpack Google Analytics -->
- <script type='text/javascript'>
- var _gaq = _gaq || [];
- %custom_vars%
+ <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>";
+ (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 );
@@ -163,6 +176,159 @@ class Jetpack_Google_Analytics {
return '';
}
+
+ /**
+ * Used to filter in the anonymize IP snippet to the custom vars array for classic analytics
+ * Ref https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat#_gat._anonymizelp
+ * @param array custom vars to be filtered
+ * @return array possibly updated custom vars
+ */
+ public function jetpack_wga_classic_anonymize_ip( $custom_vars ) {
+ $o = get_option( 'jetpack_wga' );
+ $anonymize_ip = isset( $o[ 'anonymize_ip' ] ) ? $o[ 'anonymize_ip' ] : false;
+ if ( $anonymize_ip ) {
+ array_push( $custom_vars, "_gaq.push(['_gat._anonymizeIp']);" );
+ }
+
+ return $custom_vars;
+ }
+
+ /**
+ * Used to filter in the order details to the custom vars array for classic analytics
+ * @param array custom vars to be filtered
+ * @return array possibly updated custom vars
+ */
+ public function jetpack_wga_classic_track_purchases( $custom_vars ) {
+ global $wp;
+
+ if ( ! class_exists( 'WooCommerce' ) ) {
+ return $custom_vars;
+ }
+
+ // Ref: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce#Example
+ $o = get_option( 'jetpack_wga' );
+ $ec_track_purchases = isset( $o[ 'ec_track_purchases' ] ) ? $o[ 'ec_track_purchases' ] : false;
+ $minimum_woocommerce_active = class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.0', '>=' );
+ if ( $ec_track_purchases && $minimum_woocommerce_active && is_order_received_page() ) {
+ $order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : 0;
+ if ( 0 < $order_id && 1 != get_post_meta( $order_id, '_ga_tracked', true ) ) {
+ $order = new WC_Order( $order_id );
+
+ // [ '_add_Trans', '123', 'Site Title', '21.00', '1.00', '5.00', 'Snohomish', 'WA', 'USA' ]
+ array_push(
+ $custom_vars,
+ sprintf(
+ '_gaq.push( %s );', json_encode(
+ array(
+ '_addTrans',
+ (string) $order->get_order_number(),
+ get_bloginfo( 'name' ),
+ (string) $order->get_total(),
+ (string) $order->get_total_tax(),
+ (string) $order->get_total_shipping(),
+ (string) $order->get_billing_city(),
+ (string) $order->get_billing_state(),
+ (string) $order->get_billing_country()
+ )
+ )
+ )
+ );
+
+ // Order items
+ if ( $order->get_items() ) {
+ foreach ( $order->get_items() as $item ) {
+ $product = $order->get_product_from_item( $item );
+ $product_sku_or_id = $product->get_sku() ? $product->get_sku() : $product->get_id();
+
+ array_push(
+ $custom_vars,
+ sprintf(
+ '_gaq.push( %s );', json_encode(
+ array(
+ '_addItem',
+ (string) $order->get_order_number(),
+ (string) $product_sku_or_id,
+ $item['name'],
+ self::get_product_categories_concatenated( $product ),
+ (string) $order->get_item_total( $item ),
+ (string) $item['qty']
+ )
+ )
+ )
+ );
+ }
+ } // get_items
+
+ // Mark the order as tracked
+ update_post_meta( $order_id, '_ga_tracked', 1 );
+ array_push( $custom_vars, "_gaq.push(['_trackTrans']);" );
+ } // order not yet tracked
+ } // is order received page
+
+ return $custom_vars;
+ }
+
+ /**
+ * Gets product categories or varation attributes as a formatted concatenated string
+ * @param WC_Product
+ * @return string
+ */
+ public function get_product_categories_concatenated( $product ) {
+ $variation_data = $product->is_type( 'variation' ) ? wc_get_product_variation_attributes( $product->get_id() ) : '';
+ if ( is_array( $variation_data ) && ! empty( $variation_data ) ) {
+ $line = wc_get_formatted_variation( $variation_data, true );
+ } else {
+ $out = array();
+ $categories = get_the_terms( $product->get_id(), 'product_cat' );
+ if ( $categories ) {
+ foreach ( $categories as $category ) {
+ $out[] = $category->name;
+ }
+ }
+ $line = join( "/", $out );
+ }
+ return $line;
+ }
+
+ /**
+ * Used to add footer javascript to track user clicking on add-to-cart buttons
+ * on single views (.single_add_to_cart_button) and list views (.add_to_cart_button)
+ */
+ public function jetpack_wga_classic_track_add_to_cart() {
+ if ( ! class_exists( 'WooCommerce' ) ) {
+ return;
+ }
+
+ $tracking_id = $this->_get_tracking_code();
+ if ( empty( $tracking_id ) ) {
+ return;
+ }
+
+ $o = get_option( 'jetpack_wga' );
+ $ec_track_add_to_cart = isset( $o[ 'ec_track_add_to_cart' ] ) ? $o[ 'ec_track_add_to_cart' ] : false;
+ if ( $ec_track_add_to_cart ) {
+ if ( is_product() ) { // product page
+ global $product;
+ $product_sku_or_id = $product->get_sku() ? $product->get_sku() : "#" + $product->get_id();
+ wc_enqueue_js(
+ "jQuery( function( $ ) {
+ $( '.single_add_to_cart_button' ).click( function() {
+ _gaq.push(['_trackEvent', 'Products', 'Add to Cart', '#" . esc_js( $product_sku_or_id ) . "']);
+ } );
+ } );"
+ );
+ } else if ( is_woocommerce() ) { // any other page that uses templates (like product lists, archives, etc)
+ wc_enqueue_js(
+ "jQuery( function( $ ) {
+ $( '.add_to_cart_button:not(.product_type_variable, .product_type_grouped)' ).click( function() {
+ var label = $( this ).data( 'product_sku' ) ? $( this ).data( 'product_sku' ) : '#' + $( this ).data( 'product_id' );
+ _gaq.push(['_trackEvent', 'Products', 'Add to Cart', label]);
+ } );
+ } );"
+ );
+ }
+ }
+ }
}
global $jetpack_google_analytics;
diff --git a/plugins/jetpack/modules/gravatar-hovercards.php b/plugins/jetpack/modules/gravatar-hovercards.php
index 13128655..fe6cce61 100644
--- a/plugins/jetpack/modules/gravatar-hovercards.php
+++ b/plugins/jetpack/modules/gravatar-hovercards.php
@@ -229,15 +229,26 @@ function grofiles_extra_data() {
/**
* Echoes the data from grofiles_hovercards_data() as HTML elements.
*
- * @param int|string $author User ID or email address
+ * @since 5.5.0 Add support for a passed WP_User object
+ *
+ * @param int|string|WP_User $author User ID, email address, or a WP_User object
*/
function grofiles_hovercards_data_html( $author ) {
$data = grofiles_hovercards_data( $author );
+ $hash = '';
if ( is_numeric( $author ) ) {
$user = get_userdata( $author );
- $hash = md5( $user->user_email );
- } else {
+ if ( $user ) {
+ $hash = md5( $user->user_email );
+ }
+ } elseif ( is_email( $author ) ) {
$hash = md5( $author );
+ } elseif ( is_a( $author, 'WP_User' ) ) {
+ $hash = md5( $author->user_email );
+ }
+
+ if ( ! $hash ) {
+ return;
}
?>
<div class="grofile-hash-map-<?php echo $hash; ?>">
diff --git a/plugins/jetpack/modules/infinite-scroll.php b/plugins/jetpack/modules/infinite-scroll.php
index e11dfaa9..0b782024 100644
--- a/plugins/jetpack/modules/infinite-scroll.php
+++ b/plugins/jetpack/modules/infinite-scroll.php
@@ -220,7 +220,7 @@ class Jetpack_Infinite_Scroll_Extras {
// Fire the post_gallery action early so Carousel scripts are present.
if ( Jetpack::is_module_active( 'carousel' ) ) {
/** This filter is already documented in core/wp-includes/media.php */
- do_action( 'post_gallery', '', '' );
+ do_action( 'post_gallery', '', '', 0 );
}
// Always enqueue Tiled Gallery scripts when both IS and Tiled Galleries are enabled
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
index d7f21e38..42a69b2d 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyeleven.php
@@ -8,35 +8,30 @@
/**
* Add theme support for infinity scroll
*/
-function twenty_eleven_infinite_scroll_init() {
+function jetpack_twentyeleven_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
- 'container' => 'content',
- 'footer' => 'page',
+ 'container' => 'content',
+ 'footer' => 'page',
+ 'footer_widgets' => jetpack_twentyeleven_has_footer_widgets(),
) );
}
-add_action( 'init', 'twenty_eleven_infinite_scroll_init' );
+add_action( 'init', 'jetpack_twentyeleven_infinite_scroll_init' );
/**
* Enqueue CSS stylesheet with theme styles for infinity.
*/
-function twenty_eleven_infinite_scroll_enqueue_styles() {
+function jetpack_twentyeleven_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
// Add theme specific styles.
wp_enqueue_style( 'infinity-twentyeleven', plugins_url( 'twentyeleven.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
}
}
-add_action( 'wp_enqueue_scripts', 'twenty_eleven_infinite_scroll_enqueue_styles', 25 );
+add_action( 'wp_enqueue_scripts', 'jetpack_twentyeleven_infinite_scroll_enqueue_styles', 25 );
/**
- * Have we any footer widgets?
- *
- * @param bool $has_widgets
- * @uses is_active_sidebar
- * @uses jetpack_is_mobile
- * @filter infinite_scroll_has_footer_widgets
- * @return bool
+ * Do we have footer widgets?
*/
-function twenty_eleven_has_footer_widgets( $has_widgets ) {
+function jetpack_twentyeleven_has_footer_widgets() {
// Are any of the "Footer Area" sidebars active?
if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) )
return true;
@@ -45,6 +40,5 @@ function twenty_eleven_has_footer_widgets( $has_widgets ) {
if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() && is_active_sidebar( 'sidebar-1' ) )
return true;
- return $has_widgets;
+ return false;
}
-add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_eleven_has_footer_widgets' );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
index a94108f0..d917dd56 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfifteen.php
@@ -8,21 +8,21 @@
/**
* Add theme support for infinite scroll
*/
-function twentyfifteen_infinite_scroll_init() {
+function jetpack_twentyfifteen_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'footer' => 'page',
) );
}
-add_action( 'after_setup_theme', 'twentyfifteen_infinite_scroll_init' );
+add_action( 'after_setup_theme', 'jetpack_twentyfifteen_infinite_scroll_init' );
/**
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
-function twentyfifteen_infinite_scroll_enqueue_styles() {
+function jetpack_twentyfifteen_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
wp_enqueue_style( 'infinity-twentyfifteen', plugins_url( 'twentyfifteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20141022' );
wp_style_add_data( 'infinity-twentyfifteen', 'rtl', 'replace' );
}
}
-add_action( 'wp_enqueue_scripts', 'twentyfifteen_infinite_scroll_enqueue_styles', 25 );
+add_action( 'wp_enqueue_scripts', 'jetpack_twentyfifteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
index 22ae3844..54a1fbc8 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyfourteen.php
@@ -8,42 +8,41 @@
/**
* Add theme support for infinite scroll
*/
-function twentyfourteen_infinite_scroll_init() {
+function jetpack_twentyfourteen_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
- 'container' => 'content',
- 'footer' => 'page'
+ 'container' => 'content',
+ 'footer' => 'page',
+ 'footer_widgets' => jetpack_twentyfourteen_has_footer_widgets(),
) );
}
-add_action( 'after_setup_theme', 'twentyfourteen_infinite_scroll_init' );
+add_action( 'after_setup_theme', 'jetpack_twentyfourteen_infinite_scroll_init' );
/**
* Switch to the "click to load" type IS with the following cases
* 1. Viewed from iPad and the primary sidebar is active.
- * 2. Viewed from mobile and either the primary or the content sudebar is active.
+ * 2. Viewed from mobile and either the primary or the content sidebar is active.
* 3. The footer widget is active.
*
* @return bool
*/
-
-if ( function_exists( 'jetpack_is_mobile' ) ) {
- function twentyfourteen_has_footer_widgets( $has_widgets ) {
+function jetpack_twentyfourteen_has_footer_widgets() {
+ if ( function_exists( 'jetpack_is_mobile' ) ) {
if ( ( Jetpack_User_Agent_Info::is_ipad() && is_active_sidebar( 'sidebar-1' ) )
|| ( jetpack_is_mobile( '', true ) && ( is_active_sidebar( 'sidebar-1' ) || is_active_sidebar( 'sidebar-2' ) ) )
|| is_active_sidebar( 'sidebar-3' ) )
return true;
-
- return $has_widgets;
}
- add_filter( 'infinite_scroll_has_footer_widgets', 'twentyfourteen_has_footer_widgets' );
+
+ return false;
}
/**
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
-function twentyfourteen_infinite_scroll_enqueue_styles() {
+function jetpack_twentyfourteen_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
wp_enqueue_style( 'infinity-twentyfourteen', plugins_url( 'twentyfourteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20131118' );
}
}
-add_action( 'wp_enqueue_scripts', 'twentyfourteen_infinite_scroll_enqueue_styles', 25 ); \ No newline at end of file
+add_action( 'wp_enqueue_scripts', 'jetpack_twentyfourteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php
index 766b240e..ca4c64c7 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyseventeen.php
@@ -39,10 +39,11 @@ 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;
}
+
+ return false;
}
/**
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
index 723d3cee..df0c14e9 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentysixteen.php
@@ -8,19 +8,19 @@
/**
* Add theme support for infinite scroll
*/
-function twentysixteen_infinite_scroll_init() {
+function jetpack_twentysixteen_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
- 'render' => 'twentysixteen_infinite_scroll_render',
+ 'render' => 'jetpack_twentysixteen_infinite_scroll_render',
'footer' => 'content',
) );
}
-add_action( 'after_setup_theme', 'twentysixteen_infinite_scroll_init' );
+add_action( 'after_setup_theme', 'jetpack_twentysixteen_infinite_scroll_init' );
/**
* Custom render function for Infinite Scroll.
*/
-function twentysixteen_infinite_scroll_render() {
+function jetpack_twentysixteen_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
if ( is_search() ) {
@@ -34,10 +34,10 @@ function twentysixteen_infinite_scroll_render() {
/**
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
-function twentysixteen_infinite_scroll_enqueue_styles() {
+function jetpack_twentysixteen_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
wp_enqueue_style( 'infinity-twentysixteen', plugins_url( 'twentysixteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20151102' );
wp_style_add_data( 'infinity-twentysixteen', 'rtl', 'replace' );
}
}
-add_action( 'wp_enqueue_scripts', 'twentysixteen_infinite_scroll_enqueue_styles', 25 );
+add_action( 'wp_enqueue_scripts', 'jetpack_twentysixteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
index a087238d..b6128707 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentyten.php
@@ -8,14 +8,15 @@
/**
* Add theme support for infinity scroll
*/
-function twenty_ten_infinite_scroll_init() {
+function jetpack_twentyten_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
- 'container' => 'content',
- 'render' => 'twenty_ten_infinite_scroll_render',
- 'footer' => 'wrapper',
+ 'container' => 'content',
+ 'render' => 'jetpack_twentyten_infinite_scroll_render',
+ 'footer' => 'wrapper',
+ 'footer_widgets' => jetpack_twentyten_has_footer_widgets(),
) );
}
-add_action( 'init', 'twenty_ten_infinite_scroll_init' );
+add_action( 'init', 'jetpack_twentyten_infinite_scroll_init' );
/**
* Set the code to be rendered on for calling posts,
@@ -23,28 +24,32 @@ add_action( 'init', 'twenty_ten_infinite_scroll_init' );
*
* Note: must define a loop.
*/
-function twenty_ten_infinite_scroll_render() {
+function jetpack_twentyten_infinite_scroll_render() {
get_template_part( 'loop' );
}
/**
* Enqueue CSS stylesheet with theme styles for infinity.
*/
-function twenty_ten_infinite_scroll_enqueue_styles() {
+function jetpack_twentyten_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
// Add theme specific styles.
wp_enqueue_style( 'infinity-twentyten', plugins_url( 'twentyten.css', __FILE__ ), array( 'the-neverending-homepage' ), '20121002' );
}
}
-add_action( 'wp_enqueue_scripts', 'twenty_ten_infinite_scroll_enqueue_styles', 25 );
+add_action( 'wp_enqueue_scripts', 'jetpack_twentyten_infinite_scroll_enqueue_styles', 25 );
/**
* Do we have footer widgets?
*/
-function twenty_ten_has_footer_widgets( $has_widgets ) {
- if ( is_active_sidebar( 'first-footer-widget-area' ) || is_active_sidebar( 'second-footer-widget-area' ) || is_active_sidebar( 'third-footer-widget-area' ) || is_active_sidebar( 'fourth-footer-widget-area' ) )
- $has_widgets = true;
+function jetpack_twentyten_has_footer_widgets() {
+ if ( is_active_sidebar( 'first-footer-widget-area' ) ||
+ is_active_sidebar( 'second-footer-widget-area' ) ||
+ is_active_sidebar( 'third-footer-widget-area' ) ||
+ is_active_sidebar( 'fourth-footer-widget-area' ) ) {
- return $has_widgets;
+ return true;
+ }
+
+ return false;
}
-add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_ten_has_footer_widgets' ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
index 85490b45..803b31bb 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentythirteen.php
@@ -8,21 +8,21 @@
/**
* Add theme support for infinite scroll
*/
-function twentythirteen_infinite_scroll_init() {
+function jetpack_twentythirteen_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
- 'container' => 'content',
- 'footer' => 'page',
- 'footer_widgets' => array( 'sidebar-1' )
+ 'container' => 'content',
+ 'footer' => 'page',
+ 'footer_widgets' => array( 'sidebar-1' ),
) );
}
-add_action( 'after_setup_theme', 'twentythirteen_infinite_scroll_init' );
+add_action( 'after_setup_theme', 'jetpack_twentythirteen_infinite_scroll_init' );
/**
* Enqueue CSS stylesheet with theme styles for Infinite Scroll.
*/
-function twentythirteen_infinite_scroll_enqueue_styles() {
+function jetpack_twentythirteen_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
wp_enqueue_style( 'infinity-twentythirteen', plugins_url( 'twentythirteen.css', __FILE__ ), array( 'the-neverending-homepage' ), '20130409' );
}
}
-add_action( 'wp_enqueue_scripts', 'twentythirteen_infinite_scroll_enqueue_styles', 25 ); \ No newline at end of file
+add_action( 'wp_enqueue_scripts', 'jetpack_twentythirteen_infinite_scroll_enqueue_styles', 25 );
diff --git a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
index 02e802e4..b8b17b3f 100644
--- a/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
+++ b/plugins/jetpack/modules/infinite-scroll/themes/twentytwelve.php
@@ -8,41 +8,36 @@
/**
* Add theme support for infinite scroll
*/
-function twenty_twelve_infinite_scroll_init() {
+function jetpack_twentytwelve_infinite_scroll_init() {
add_theme_support( 'infinite-scroll', array(
'container' => 'content',
- 'footer' => 'page'
+ 'footer' => 'page',
+ 'footer_widgets' => jetpack_twentytwelve_has_footer_widgets(),
) );
}
-add_action( 'after_setup_theme', 'twenty_twelve_infinite_scroll_init' );
+add_action( 'after_setup_theme', 'jetpack_twentytwelve_infinite_scroll_init' );
/**
* Enqueue CSS stylesheet with theme styles for infinity.
*/
-function twenty_twelve_infinite_scroll_enqueue_styles() {
+function jetpack_twentytwelve_infinite_scroll_enqueue_styles() {
if ( wp_script_is( 'the-neverending-homepage' ) ) {
// Add theme specific styles.
wp_enqueue_style( 'infinity-twentytwelve', plugins_url( 'twentytwelve.css', __FILE__ ), array( 'the-neverending-homepage' ), '20120817' );
}
}
-add_action( 'wp_enqueue_scripts', 'twenty_twelve_infinite_scroll_enqueue_styles', 25 );
+add_action( 'wp_enqueue_scripts', 'jetpack_twentytwelve_infinite_scroll_enqueue_styles', 25 );
/**
- * Handle `footer_widgets` argument for mobile devices
- *
- * @param bool $has_widgets
- * @uses jetpack_is_mobile, is_front_page, is_active_sidebar
- * @filter infinite_scroll_has_footer_widgets
- * @return bool
+ * Do we have footer widgets?
*/
-function twenty_twelve_has_footer_widgets( $has_widgets ) {
+function jetpack_twentytwelve_has_footer_widgets() {
if ( function_exists( 'jetpack_is_mobile' ) && jetpack_is_mobile() ) {
if ( is_front_page() && ( is_active_sidebar( 'sidebar-2' ) || is_active_sidebar( 'sidebar-3' ) ) )
- $has_widgets = true;
+ return true;
elseif ( is_active_sidebar( 'sidebar-1' ) )
- $has_widgets = true;
+ return true;
}
- return $has_widgets;
+ return false;
}
-add_filter( 'infinite_scroll_has_footer_widgets', 'twenty_twelve_has_footer_widgets' ); \ No newline at end of file
diff --git a/plugins/jetpack/modules/likes.php b/plugins/jetpack/modules/likes.php
index daf60d00..1a91899b 100644
--- a/plugins/jetpack/modules/likes.php
+++ b/plugins/jetpack/modules/likes.php
@@ -142,6 +142,19 @@ class Jetpack_Likes {
}
/**
+ * Stub for is_likes_visible, since some themes were calling it directly from this class
+ *
+ * @deprecated 5.4
+ * @return bool
+ */
+ function is_likes_visible() {
+ _deprecated_function( __METHOD__, 'jetpack-5.4', 'Jetpack_Likes_Settings()->is_likes_visible' );
+
+ $settings = new Jetpack_Likes_Settings();
+ return $settings->is_likes_visible();
+ }
+
+ /**
* Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box
* @param string $html row heading for the sharedaddy "which page" setting
* @return string html with the jetpack-targetable class and likes id. tbody gets closed after the like settings
diff --git a/plugins/jetpack/modules/masterbar/masterbar.php b/plugins/jetpack/modules/masterbar/masterbar.php
index fde17fb6..9cb2f58f 100644
--- a/plugins/jetpack/modules/masterbar/masterbar.php
+++ b/plugins/jetpack/modules/masterbar/masterbar.php
@@ -31,6 +31,12 @@ class A8C_WPCOM_Masterbar {
return;
}
+ // Atomic only - override user setting that hides masterbar from site's front.
+ // https://github.com/Automattic/jetpack/issues/7667
+ if ( jetpack_is_atomic_site() ) {
+ add_filter( 'show_admin_bar', '__return_true' );
+ }
+
$this->user_data = Jetpack::get_connected_user_data( $this->user_id );
$this->user_login = $this->user_data['login'];
$this->user_email = $this->user_data['email'];
@@ -68,10 +74,6 @@ class A8C_WPCOM_Masterbar {
add_action( 'wp_logout', array( $this, 'maybe_logout_user_from_wpcom' ) );
}
- public function is_automated_transfer_site() {
- return jetpack_is_automated_transfer_site();
- }
-
public function maybe_logout_user_from_wpcom() {
if ( isset( $_GET['context'] ) && 'masterbar' === $_GET['context'] ) {
do_action( 'wp_masterbar_logout' );
@@ -122,6 +124,8 @@ class A8C_WPCOM_Masterbar {
}
wp_enqueue_script( 'jetpack-accessible-focus', plugins_url( '_inc/accessible-focus.js', JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION );
+ wp_enqueue_script( 'a8c_wpcom_masterbar_tracks_events', plugins_url( 'tracks-events.js', __FILE__ ), array( 'jquery' ), JETPACK__VERSION );
+
wp_enqueue_script( 'a8c_wpcom_masterbar_overrides', $this->wpcom_static_url( '/wp-content/mu-plugins/admin-bar/masterbar-overrides/masterbar.js' ), array( 'jquery' ), JETPACK__VERSION );
}
@@ -208,7 +212,7 @@ class A8C_WPCOM_Masterbar {
'</span>' .
'</div>' .
'</div>',
- 'class' => 'menupop',
+ 'class' => 'menupop mb-trackable',
),
'parent' => 'top-secondary',
) );
@@ -220,6 +224,9 @@ class A8C_WPCOM_Masterbar {
'id' => 'newdash',
'title' => esc_html__( 'Reader', 'jetpack' ),
'href' => '#',
+ 'meta' => array(
+ 'class' => 'mb-trackable',
+ )
) );
$wp_admin_bar->add_menu( array(
@@ -342,7 +349,7 @@ class A8C_WPCOM_Masterbar {
}
$avatar = get_avatar( $this->user_email, 32, 'mm', '', array( 'force_display' => true ) );
- $class = empty( $avatar ) ? '' : 'with-avatar';
+ $class = empty( $avatar ) ? 'mb-trackable' : 'with-avatar mb-trackable';
// Add the 'Me' menu
$wp_admin_bar->add_menu( array(
@@ -475,7 +482,7 @@ class A8C_WPCOM_Masterbar {
$help_link = 'https://jetpack.com/support/';
- if ( $this->is_automated_transfer_site() ) {
+ if ( jetpack_is_atomic_site() ) {
$help_link = 'https://wordpress.com/help';
}
@@ -511,6 +518,9 @@ class A8C_WPCOM_Masterbar {
'id' => 'ab-new-post',
'href' => $blog_post_page,
'title' => '<span>' . esc_html__( 'Write', 'jetpack' ) . '</span>',
+ 'meta' => array(
+ 'class' => 'mb-trackable',
+ )
) );
}
@@ -532,7 +542,7 @@ class A8C_WPCOM_Masterbar {
'title' => _n( 'My Site', 'My Sites', $this->user_site_count, 'jetpack' ),
'href' => '#',
'meta' => array(
- 'class' => 'my-sites',
+ 'class' => 'my-sites mb-trackable',
),
) );
@@ -658,7 +668,7 @@ class A8C_WPCOM_Masterbar {
),
array(
'url' => 'https://wordpress.com/page/' . esc_attr( $this->primary_site_slug ),
- 'id' => 'wp-admin-bar-new-page',
+ 'id' => 'wp-admin-bar-new-page-badge',
'label' => esc_html_x( 'Add', 'admin bar menu new item label', 'jetpack' ),
)
);
@@ -690,7 +700,7 @@ class A8C_WPCOM_Masterbar {
),
array(
'url' => 'https://wordpress.com/post/' . esc_attr( $this->primary_site_slug ),
- 'id' => 'wp-admin-bar-new-post',
+ 'id' => 'wp-admin-bar-new-post-badge',
'label' => esc_html_x( 'Add', 'admin bar menu new item label', 'jetpack' ),
)
);
@@ -709,7 +719,7 @@ class A8C_WPCOM_Masterbar {
'id' => 'new-post',
'title' => $posts_title,
'meta' => array(
- 'class' => 'inline-action',
+ 'class' => 'inline-action mb-trackable',
),
) );
@@ -718,7 +728,7 @@ class A8C_WPCOM_Masterbar {
$wp_admin_bar->add_menu( array(
'parent' => 'publish',
'id' => 'comments',
- 'title' => __( 'Comments' ),
+ 'title' => __( 'Comments', 'jetpack' ),
'href' => 'https://wordpress.com/comments/' . esc_attr( $this->primary_site_slug ),
'meta' => array(
'class' => 'mb-icon',
@@ -904,9 +914,9 @@ class A8C_WPCOM_Masterbar {
'label' => esc_html__( 'Plugins', 'jetpack' ),
),
array(
- 'url' => 'https://wordpress.com/plugins/browse/' . esc_attr( $this->primary_site_slug ),
+ 'url' => 'https://wordpress.com/plugins/manage/' . esc_attr( $this->primary_site_slug ),
'id' => 'wp-admin-bar-plugins-add',
- 'label' => esc_html_x( 'Add', 'Label for the button on the Masterbar to add a new plugin', 'jetpack' ),
+ 'label' => esc_html_x( 'Manage', 'Label for the button on the Masterbar to manage plugins', 'jetpack' ),
)
);
@@ -920,7 +930,7 @@ class A8C_WPCOM_Masterbar {
),
) );
- if ( $this->is_automated_transfer_site() ) {
+ if ( jetpack_is_atomic_site() ) {
$domain_title = $this->create_menu_item_pair(
array(
'url' => 'https://wordpress.com/domains/' . esc_attr( $this->primary_site_slug ),
@@ -974,6 +984,13 @@ class A8C_WPCOM_Masterbar {
'href' => '#',
) );
}
+
+ /**
+ * Fires when menu items are added to the masterbar "My Sites" menu.
+ *
+ * @since 5.4
+ */
+ do_action( 'jetpack_masterbar' );
}
}
}
diff --git a/plugins/jetpack/modules/masterbar/tracks-events.js b/plugins/jetpack/modules/masterbar/tracks-events.js
new file mode 100644
index 00000000..7cf95e88
--- /dev/null
+++ b/plugins/jetpack/modules/masterbar/tracks-events.js
@@ -0,0 +1,154 @@
+/*globals JSON */
+( function( $ ) {
+ var eventName = 'masterbar_click';
+
+ var linksTracksEvents = {
+ //top level items
+ 'wp-admin-bar-blog' : 'my_sites',
+ 'wp-admin-bar-newdash' : 'reader',
+ 'wp-admin-bar-ab-new-post' : 'write_button',
+ 'wp-admin-bar-my-account' : 'my_account',
+ 'wp-admin-bar-notes' : 'notifications',
+ //my sites - top items
+ 'wp-admin-bar-switch-site' : 'my_sites_switch_site',
+ 'wp-admin-bar-blog-info' : 'my_sites_blog_info',
+ 'wp-admin-bar-site-view' : 'my_sites_view_site',
+ 'wp-admin-bar-blog-stats' : 'my_sites_blog_stats',
+ 'wp-admin-bar-plan' : 'my_sites_plan',
+ 'wp-admin-bar-plan-badge' : 'my_sites_plan_badge',
+ //my sites - manage
+ 'wp-admin-bar-edit-page' : 'my_sites_manage_site_pages',
+ 'wp-admin-bar-new-page-badge' : 'my_sites_manage_add_page',
+ 'wp-admin-bar-edit-post' : 'my_sites_manage_blog_posts',
+ 'wp-admin-bar-new-post-badge' : 'my_sites_manage_add_new_post',
+ 'wp-admin-bar-edit-attachment' : 'my_sites_manage_media',
+ 'wp-admin-bar-new-attachment-badge' : 'my_sites_manage_add_media',
+ 'wp-admin-bar-comments' : 'my_sites_manage_comments',
+ 'wp-admin-bar-edit-testimonial' : 'my_sites_manage_testimonials',
+ 'wp-admin-bar-new-testimonial' : 'my_sites_manage_add_testimonial',
+ 'wp-admin-bar-edit-portfolio' : 'my_sites_manage_portfolio',
+ 'wp-admin-bar-new-portfolio' : 'my_sites_manage_add_portfolio',
+ //my sites - personalize
+ 'wp-admin-bar-themes' : 'my_sites_personalize_themes',
+ 'wp-admin-bar-cmz' : 'my_sites_personalize_themes_customize',
+ //my sites - configure
+ 'wp-admin-bar-sharing' : 'my_sites_configure_sharing',
+ 'wp-admin-bar-people' : 'my_sites_configure_people',
+ 'wp-admin-bar-people-add' : 'my_sites_configure_people_add_button',
+ 'wp-admin-bar-plugins' : 'my_sites_configure_plugins',
+ 'wp-admin-bar-plugins-add' : 'my_sites_configure_manage_plugins',
+ 'wp-admin-bar-blog-settings' : 'my_sites_configure_settings',
+ //reader
+ 'wp-admin-bar-followed-sites' : 'reader_followed_sites',
+ 'wp-admin-bar-reader-followed-sites-manage': 'reader_manage_followed_sites',
+ 'wp-admin-bar-discover-discover' : 'reader_discover',
+ 'wp-admin-bar-discover-search' : 'reader_search',
+ 'wp-admin-bar-discover-recommended-blogs' : 'reader_recommendations',
+ 'wp-admin-bar-my-activity-my-likes' : 'reader_my_likes',
+ //account
+ 'wp-admin-bar-user-info' : 'my_account_user_name',
+ // account - profile
+ 'wp-admin-bar-my-profile' : 'my_account_profile_my_profile',
+ 'wp-admin-bar-account-settings' : 'my_account_profile_account_settings',
+ 'wp-admin-bar-billing' : 'my_account_profile_manage_purchases',
+ 'wp-admin-bar-security' : 'my_account_profile_security',
+ 'wp-admin-bar-notifications' : 'my_account_profile_notifications',
+ //account - special
+ 'wp-admin-bar-get-apps' : 'my_account_special_get_apps',
+ 'wp-admin-bar-next-steps' : 'my_account_special_next_steps',
+ 'wp-admin-bar-help' : 'my_account_special_help'
+ };
+
+ var notesTracksEvents = {
+ openSite: function( data ) {
+ return {
+ clicked: 'masterbar_notifications_panel_site',
+ site_id: data.siteId
+ };
+ },
+ openPost: function( data ) {
+ return {
+ clicked: 'masterbar_notifications_panel_post',
+ site_id: data.siteId,
+ post_id: data.postId
+ };
+ },
+ openComment: function( data ) {
+ return {
+ clicked: 'masterbar_notifications_panel_comment',
+ site_id: data.siteId,
+ post_id: data.postId,
+ comment_id: data.commentId
+ };
+ }
+ };
+
+ function parseJson( s, defaultValue ) {
+ try {
+ return JSON.parse( s );
+ } catch ( e ) {
+ return defaultValue;
+ }
+ }
+
+ $( document ).ready( function() {
+ var trackableLinks = '.mb-trackable .ab-item:not(div),' +
+ '#wp-admin-bar-notes .ab-item,' +
+ '#wp-admin-bar-user-info .ab-item,' +
+ '.mb-trackable .ab-secondary';
+
+ $( trackableLinks ).on( 'click touchstart', function( e ) {
+ if ( ! window.jpTracksAJAX || 'function' !== typeof( window.jpTracksAJAX.record_ajax_event ) ) {
+ return;
+ }
+
+ var $target = $( e.target ),
+ $parent = $target.closest( 'li' );
+
+ if ( ! $parent ) {
+ return;
+ }
+
+ var trackingId = $target.attr( 'ID' ) || $parent.attr( 'ID' );
+
+ if ( ! linksTracksEvents.hasOwnProperty( trackingId ) ) {
+ return;
+ }
+ var eventProps = { 'clicked': linksTracksEvents[ trackingId ] };
+
+ if ( $parent.hasClass( 'menupop' ) ) {
+ window.jpTracksAJAX.record_ajax_event( eventName, 'click', eventProps );
+ } else {
+ e.preventDefault();
+ window.jpTracksAJAX.record_ajax_event( eventName, 'click', eventProps ).always( function() {
+ window.location = $target.attr( 'href' );
+ } );
+ }
+ } );
+ } );
+
+ // listen for postMessage events from the notifications iframe
+ $( window ).on( 'message', function( e ) {
+ if ( ! window.jpTracksAJAX || 'function' !== typeof( window.jpTracksAJAX.record_ajax_event ) ) {
+ return;
+ }
+
+ var event = ! e.data && e.originalEvent.data ? e.originalEvent : event;
+ if ( event.origin !== 'https://widgets.wp.com' ) {
+ return;
+ }
+
+ var data = ( 'string' === typeof event.data ) ? parseJson( event.data, {} ) : event.data;
+ if ( 'notesIframeMessage' !== data.type ) {
+ return;
+ }
+
+ var eventData = notesTracksEvents[ data.action ];
+ if ( ! eventData ) {
+ return;
+ }
+
+ window.jpTracksAJAX.record_ajax_event( eventName, 'click', eventData( data ) );
+ } );
+
+} )( jQuery );
diff --git a/plugins/jetpack/modules/module-extras.php b/plugins/jetpack/modules/module-extras.php
index e7d8789d..cbc3dc02 100644
--- a/plugins/jetpack/modules/module-extras.php
+++ b/plugins/jetpack/modules/module-extras.php
@@ -27,10 +27,20 @@ $tools = array(
'verification-tools/verification-tools-utils.php',
);
+// Not every tool needs to be included if Jetpack is inactive and not in development mode
+if ( ! Jetpack::is_active() && ! Jetpack::is_development_mode() ) {
+ $tools = array(
+ 'seo-tools/jetpack-seo-utils.php',
+ 'seo-tools/jetpack-seo-titles.php',
+ 'seo-tools/jetpack-seo-posts.php',
+ );
+}
+
/**
* Filter extra tools (not modules) to include.
*
* @since 2.4.0
+ * @since 5.4.0 can be used in multisite when Jetpack is not connected to WordPress.com and not in development mode.
*
* @param array $tools Array of extra tools to include.
*/
diff --git a/plugins/jetpack/modules/publicize.php b/plugins/jetpack/modules/publicize.php
index 40b9b604..0b2b8c73 100644
--- a/plugins/jetpack/modules/publicize.php
+++ b/plugins/jetpack/modules/publicize.php
@@ -167,7 +167,12 @@ class Publicize_Util {
$string = mb_convert_encoding( $string, 'HTML-ENTITIES', 'UTF-8' );
$dom = new DOMDocument( '1.0', 'UTF-8' );
- @$dom->loadHTML( "<html><body>$string</body></html>" ); // suppress parser warning
+
+ // The @ is not enough to suppress errors when dealing with libxml,
+ // we have to tell it directly how we want to handle errors.
+ libxml_use_internal_errors( true );
+ @$dom->loadHTML( "<html><body>$string</body></html>" );
+ libxml_use_internal_errors( false );
// Strip comment nodes, if any
$comment_nodes = self::get_comment_nodes( $dom->documentElement );
diff --git a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
index 3f30be59..72576c02 100644
--- a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
+++ b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php
@@ -584,7 +584,7 @@ EOT;
* Gets an array of related posts that match the given post_id.
*
* @param int $post_id
- * @param array $args - params to use when building ElasticSearch filters to narrow down the search domain.
+ * @param array $args - params to use when building Elasticsearch filters to narrow down the search domain.
* @uses self::get_options, get_post_type, wp_parse_args, apply_filters
* @return array
*/
@@ -620,26 +620,26 @@ EOT;
$filters = $this->_get_es_filters_from_args( $post_id, $args );
/**
- * Filter ElasticSearch options used to calculate Related Posts.
+ * Filter Elasticsearch options used to calculate Related Posts.
*
* @module related-posts
*
* @since 2.8.0
*
- * @param array $filters Array of ElasticSearch filters based on the post_id and args.
+ * @param array $filters Array of Elasticsearch filters based on the post_id and args.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
$filters = apply_filters( 'jetpack_relatedposts_filter_filters', $filters, $post_id );
$results = $this->_get_related_posts( $post_id, $args['size'], $filters );
/**
- * Filter the array of related posts matched by ElasticSearch.
+ * Filter the array of related posts matched by Elasticsearch.
*
* @module related-posts
*
* @since 2.8.0
*
- * @param array $results Array of related posts matched by ElasticSearch.
+ * @param array $results Array of related posts matched by Elasticsearch.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
return apply_filters( 'jetpack_relatedposts_returned_results', $results, $post_id );
@@ -652,7 +652,7 @@ EOT;
*/
/**
- * Creates an array of ElasticSearch filters based on the post_id and args.
+ * Creates an array of Elasticsearch filters based on the post_id and args.
*
* @param int $post_id
* @param array $args
@@ -1165,7 +1165,7 @@ EOT;
*/
/**
- * Workhorse method to return array of related posts matched by ElasticSearch.
+ * Workhorse method to return array of related posts matched by Elasticsearch.
*
* @param int $post_id
* @param int $size
@@ -1183,13 +1183,13 @@ EOT;
);
/**
- * Filter the Related Posts matched by ElasticSearch.
+ * Filter the Related Posts matched by Elasticsearch.
*
* @module related-posts
*
* @since 2.9.0
*
- * @param array $hits Array of Post IDs matched by ElasticSearch.
+ * @param array $hits Array of Post IDs matched by Elasticsearch.
* @param string $post_id Post ID of the post for which we are retrieving Related Posts.
*/
$hits = apply_filters( 'jetpack_relatedposts_filter_hits', $hits, $post_id );
@@ -1202,7 +1202,7 @@ EOT;
}
/**
- * Get array of related posts matched by ElasticSearch.
+ * Get array of related posts matched by Elasticsearch.
*
* @param int $post_id
* @param int $size
@@ -1571,7 +1571,7 @@ class Jetpack_RelatedPosts_Raw extends Jetpack_RelatedPosts {
}
/**
- * Workhorse method to return array of related posts ids matched by ElasticSearch.
+ * Workhorse method to return array of related posts ids matched by Elasticsearch.
*
* @param int $post_id
* @param int $size
diff --git a/plugins/jetpack/modules/related-posts/related-posts-rtl.css b/plugins/jetpack/modules/related-posts/related-posts-rtl.css
new file mode 100644
index 00000000..34d5d361
--- /dev/null
+++ b/plugins/jetpack/modules/related-posts/related-posts-rtl.css
@@ -0,0 +1 @@
+#jp-relatedposts{display:none;padding-top:1em;margin:1em 0;position:relative;clear:both}.jp-relatedposts:after{content:'';display:block;clear:both}#jp-relatedposts h3.jp-relatedposts-headline{margin:0 0 1em 0;display:inline-block;float:right;font-size:9pt;font-weight:700;font-family:inherit}#jp-relatedposts h3.jp-relatedposts-headline em:before{content:"";display:block;width:100%;min-width:30px;border-top:1px solid #ddd;border-top:1px solid rgba(0,0,0,.2);margin-bottom:1em}#jp-relatedposts h3.jp-relatedposts-headline em{font-style:normal;font-weight:700}#jp-relatedposts .jp-relatedposts-items{clear:right}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:-20px}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{float:right;width:33%;margin:0 0 1em;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post{padding-left:20px;filter:alpha(opacity=80);-moz-opacity:.8;opacity:.8}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:nth-child(3n+4),#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post:nth-child(3n+4){clear:both}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:hover .jp-relatedposts-post-title a{text-decoration:underline}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:hover{filter:alpha(opacity=100);-moz-opacity:1;opacity:1}#jp-relatedposts .jp-relatedposts-items p,#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{font-size:14px;line-height:20px;margin:0}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs{position:relative}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs a.jp-relatedposts-post-aoverlay{position:absolute;top:0;bottom:0;right:0;left:0;display:block;border-bottom:0}#jp-relatedposts .jp-relatedposts-items p{margin-bottom:0}#jp-relatedposts .jp-relatedposts-items-visual h4.jp-relatedposts-post-title{text-transform:none;margin:0;font-family:inherit;display:block;max-width:100%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-title a{font-size:inherit;font-weight:400;text-decoration:none;filter:alpha(opacity=100);-moz-opacity:1;opacity:1}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-title a:hover{text-decoration:underline}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post span{display:block;max-width:90%;overflow:hidden;text-overflow:ellipsis}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post span{max-width:100%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-context,#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-date{opacity:.6}.jp-relatedposts-items .jp-relatedposts-post .jp-relatedposts-post-date{display:none}#jp-relatedposts .jp-relatedposts-items-visual div.jp-relatedposts-post-thumbs p.jp-relatedposts-post-excerpt{display:none}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs p.jp-relatedposts-post-excerpt{overflow:hidden}#jp-relatedposts .jp-relatedposts-items-visual .jp-relatedposts-post-nothumbs span{margin-bottom:1em}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post{clear:both;width:100%}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post img.jp-relatedposts-post-img{float:right;overflow:hidden;max-width:33%;margin-left:3%}#jp-relatedposts .jp-relatedposts-list h4.jp-relatedposts-post-title{display:inline-block;max-width:63%}@media only screen and (max-width:640px){#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{width:50%}#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post:nth-child(3n){clear:right}#jp-relatedposts .jp-relatedposts-items-visual{margin-left:20px}}@media only screen and (max-width:320px){#jp-relatedposts .jp-relatedposts-items .jp-relatedposts-post{width:100%;clear:both;margin:0 0 1em}#jp-relatedposts .jp-relatedposts-list .jp-relatedposts-post img.jp-relatedposts-post-img,#jp-relatedposts .jp-relatedposts-list h4.jp-relatedposts-post-title{float:none;max-width:100%;margin-left:0}} \ No newline at end of file
diff --git a/plugins/jetpack/modules/search/class.jetpack-search.php b/plugins/jetpack/modules/search/class.jetpack-search.php
index a216c5e4..5b0e8064 100644
--- a/plugins/jetpack/modules/search/class.jetpack-search.php
+++ b/plugins/jetpack/modules/search/class.jetpack-search.php
@@ -64,7 +64,7 @@ class Jetpack_Search {
* @module search
*/
public function setup() {
- if ( ! Jetpack::is_active() ) {
+ if ( ! Jetpack::is_active() || ! Jetpack::active_plan_supports( 'search' ) ) {
return;
}
diff --git a/plugins/jetpack/modules/seo-tools.php b/plugins/jetpack/modules/seo-tools.php
index ae48885f..18b3ea84 100644
--- a/plugins/jetpack/modules/seo-tools.php
+++ b/plugins/jetpack/modules/seo-tools.php
@@ -26,7 +26,11 @@ $jetpack_seo_conflicting_plugins = array(
foreach( $jetpack_seo_conflicting_plugins as $seo_plugin ) {
if ( Jetpack::is_plugin_active( $seo_plugin ) ) {
+ // Disable all custom meta tags that SEO tools manages.
add_filter( 'jetpack_disable_seo_tools', '__return_true' );
+
+ // Also disable default meta tags.
+ add_filter( 'jetpack_seo_meta_tags_enabled', '__return_false' );
break;
}
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharedaddy.php b/plugins/jetpack/modules/sharedaddy/sharedaddy.php
index f5b51392..2bc170e7 100644
--- a/plugins/jetpack/modules/sharedaddy/sharedaddy.php
+++ b/plugins/jetpack/modules/sharedaddy/sharedaddy.php
@@ -217,15 +217,6 @@ function sharing_add_plugin_settings($links, $file) {
return $links;
}
-function sharing_restrict_to_single( $services ) {
- // This removes Press This from non-multisite blogs - doesn't make much sense
- if ( is_multisite() === false ) {
- unset( $services['press-this'] );
- }
-
- return $services;
-}
-
function sharing_init() {
if ( Jetpack_Options::get_option_and_ensure_autoload( 'sharedaddy_disable_resources', '0' ) ) {
add_filter( 'sharing_js', 'sharing_disable_js' );
@@ -277,7 +268,6 @@ add_action( 'sharing_email_send_post', 'sharing_email_send_post' );
add_filter( 'sharing_email_can_send', 'sharing_email_check_for_spam_via_akismet' );
add_action( 'sharing_global_options', 'sharing_global_resources', 30 );
add_action( 'sharing_admin_update', 'sharing_global_resources_save' );
-add_filter( 'sharing_services', 'sharing_restrict_to_single' );
add_action( 'plugin_action_links_'.basename( dirname( __FILE__ ) ).'/'.basename( __FILE__ ), 'sharing_plugin_settings', 10, 4 );
add_filter( 'plugin_row_meta', 'sharing_add_plugin_settings', 10, 2 );
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-service.php b/plugins/jetpack/modules/sharedaddy/sharing-service.php
index 8f53838e..21e42836 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-service.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-service.php
@@ -40,6 +40,7 @@ class Sharing_Service {
* Gets a list of all available service names and classes
*/
public function get_all_services( $include_custom = true ) {
+ global $wp_version;
// Default services
// if you update this list, please update the REST API tests
// in bin/tests/api/suites/SharingTest.php
@@ -49,7 +50,6 @@ class Sharing_Service {
'linkedin' => 'Share_LinkedIn',
'reddit' => 'Share_Reddit',
'twitter' => 'Share_Twitter',
- 'press-this' => 'Share_PressThis',
'google-plus-1' => 'Share_GooglePlus1',
'tumblr' => 'Share_Tumblr',
'pinterest' => 'Share_Pinterest',
@@ -73,6 +73,10 @@ class Sharing_Service {
$services['email'] = 'Share_Email';
}
+ if ( is_multisite() && ( version_compare( $wp_version, '4.9-RC1-42107', '<' ) || is_plugin_active( 'press-this/press-this-plugin.php' ) ) ) {
+ $services['press-this'] = 'Share_PressThis';
+ }
+
if ( $include_custom ) {
// Add any custom services in
$options = $this->get_global_options();
diff --git a/plugins/jetpack/modules/sharedaddy/sharing-sources.php b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
index 98c49a3e..41a58be3 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing-sources.php
+++ b/plugins/jetpack/modules/sharedaddy/sharing-sources.php
@@ -151,7 +151,7 @@ abstract class Sharing_Source {
if ( ! empty( $query ) ) {
if ( false === stripos( $url, '?' ) ) {
$url .= '?' . $query;
- } else {
+ } else {
$url .= '&amp;' . $query;
}
}
@@ -376,7 +376,7 @@ class Share_Email extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -472,14 +472,14 @@ class Share_Email extends Sharing_Source {
}
die();
- } else {
+ } else {
$error = 2; // Email check failed
}
}
if ( $ajax ) {
echo $error;
- } else {
+ } else {
wp_safe_redirect( get_permalink( $post->ID ) . '?shared=email&msg=fail' );
}
@@ -564,7 +564,7 @@ class Share_Twitter extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -759,7 +759,7 @@ class Share_Reddit extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -771,7 +771,7 @@ class Share_Reddit extends Sharing_Source {
public function get_display( $post ) {
if ( $this->smart ) {
return '<div class="reddit_button"><iframe src="' . $this->http() . '://www.reddit.com/static/button/button1.html?newwindow=true&width=120&amp;url=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&amp;title=' . rawurlencode( $this->get_share_title( $post->ID ) ) . '" height="22" width="120" scrolling="no" frameborder="0"></iframe></div>';
- } else {
+ } else {
return $this->get_link( $this->get_process_request_url( $post->ID ), _x( 'Reddit', 'share to', 'jetpack' ), __( 'Click to share on Reddit', 'jetpack' ), 'share=reddit' );
}
}
@@ -796,7 +796,7 @@ class Share_LinkedIn extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -878,7 +878,7 @@ class Share_Facebook extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -1007,7 +1007,7 @@ class Share_Print extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -1029,7 +1029,7 @@ class Share_PressThis extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -1039,7 +1039,7 @@ class Share_PressThis extends Sharing_Source {
}
public function process_request( $post, array $post_data ) {
- global $current_user;
+ global $current_user, $wp_version;
$primary_blog = (int) get_user_meta( $current_user->ID, 'primary_blog', true );
if ( $primary_blog ) {
@@ -1066,17 +1066,29 @@ class Share_PressThis extends Sharing_Source {
$blog = current( $blogs );
- $url = $blog->siteurl . '/wp-admin/press-this.php?u=' . rawurlencode( $this->get_share_url( $post->ID ) ) . '&t=' . rawurlencode( $this->get_share_title( $post->ID ) );
+ $args = array(
+ 'u' => rawurlencode( $this->get_share_url( $post->ID ) ),
+ );
+
+ if ( version_compare( $wp_version, '4.9-RC1-42107', '>=' ) ) {
+ $args[ 'url-scan-submit' ] = 'Scan';
+ $args[ '_wpnonce' ] = wp_create_nonce( 'scan-site' );
- if ( isset( $_GET['sel'] ) ) {
- $url .= '&s=' . rawurlencode( $_GET['sel'] );
+ } else { // Remove once 4.9 is the minimum.
+ $args['t'] = rawurlencode( $this->get_share_title( $post->ID ) );
+ if ( isset( $_GET['sel'] ) ) {
+ $args['s'] = rawurlencode( $_GET['sel'] );
+ }
}
+ $url = $blog->siteurl . '/wp-admin/press-this.php';
+ $url = add_query_arg( $args, $url );
+
// Record stats
parent::process_request( $post, $post_data );
// Redirect to Press This
- wp_safe_redirect( $url );
+ wp_redirect( $url );
die();
}
@@ -1095,7 +1107,7 @@ class Share_GooglePlus1 extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -1163,7 +1175,7 @@ class Share_GooglePlus1 extends Sharing_Source {
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
- po.src = 'https://apis.google.com/js/plusone.js';
+ po.src = 'https://apis.google.com/js/plusone.min.js';
po.innerHTML = '{"parsetags": "explicit"}';
po.onload = renderGooglePlus1;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
@@ -1393,7 +1405,7 @@ class Share_Tumblr extends Sharing_Source {
parent::__construct( $id, $settings );
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -1442,7 +1454,7 @@ class Share_Pinterest extends Sharing_Source {
parent::__construct( $id, $settings );
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
@@ -1553,7 +1565,7 @@ class Share_Pinterest extends Sharing_Source {
var s = document.createElement("script");
s.type = "text/javascript";
s.async = true;
- <?php if ( $jetpack_pinit_over ) {
+ <?php if ( $jetpack_pinit_over ) {
echo "s.setAttribute('data-pin-hover', true);";
} ?>
s.src = window.location.protocol + "//assets.pinterest.com/js/pinit.js";
@@ -1595,7 +1607,7 @@ class Share_Pocket extends Sharing_Source {
if ( 'official' == $this->button_style ) {
$this->smart = true;
- } else {
+ } else {
$this->smart = false;
}
}
diff --git a/plugins/jetpack/modules/sharedaddy/sharing.css b/plugins/jetpack/modules/sharedaddy/sharing.css
index 898b75bf..68ce779a 100644
--- a/plugins/jetpack/modules/sharedaddy/sharing.css
+++ b/plugins/jetpack/modules/sharedaddy/sharing.css
@@ -448,7 +448,7 @@ body .sd-content ul li.share-custom a.share-icon span
margin-left: 0;
padding: 0 0 0 19px;
display: inline-block;
- height: 16px;
+ height: 21px;
line-height: 16px;
}
diff --git a/plugins/jetpack/modules/shortcodes.php b/plugins/jetpack/modules/shortcodes.php
index e37633cc..ec414573 100644
--- a/plugins/jetpack/modules/shortcodes.php
+++ b/plugins/jetpack/modules/shortcodes.php
@@ -68,7 +68,7 @@ function jetpack_load_shortcodes() {
$shortcode_includes = apply_filters( 'jetpack_shortcodes_to_include', $shortcode_includes );
foreach ( $shortcode_includes as $include ) {
- include $include;
+ include_once $include;
}
}
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 8555da37..17dc5781 100644
--- a/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php
+++ b/plugins/jetpack/modules/shortcodes/class.filter-embedded-html-objects.php
@@ -243,7 +243,7 @@ class Filter_Embedded_HTML_Objects {
static function get_attrs( $html ) {
if ( ! ( function_exists( 'libxml_use_internal_errors' ) && function_exists( 'simplexml_load_string' ) ) ) {
- trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
+ trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension.", 'jetpack' ) );
return array();
}
// We have to go through DOM, since it can load non-well-formed XML (i.e. HTML). SimpleXML cannot.
diff --git a/plugins/jetpack/modules/shortcodes/css/recipes-print-rtl.css b/plugins/jetpack/modules/shortcodes/css/recipes-print-rtl.css
index 52a59b19..bbea4bf2 100644
--- a/plugins/jetpack/modules/shortcodes/css/recipes-print-rtl.css
+++ b/plugins/jetpack/modules/shortcodes/css/recipes-print-rtl.css
@@ -1,37 +1 @@
-/* Do not modify this file directly. It is concatenated from individual module CSS files. */
-.jetpack-recipe-meta li.jetpack-recipe-print {
- display: none;
-}
-
-.jetpack-recipe-title {
- font-size: 16pt;
-}
-
-.jetpack-recipe-content img {
- display: inline-block !important;
- max-width: 100%;
-}
-
-.jetpack-recipe-image {
- display: none !important;
-}
-
-.jetpack-recipe-content .aligncenter {
- display: block !important;
- margin: 0 auto 1em !important;
- text-align: center !important;
-}
-
-.jetpack-recipe-content .alignright {
- float: left !important;
- margin: 0 1em .5em 0 !important;
-}
-
-.jetpack-recipe-content .alignleft {
- float: right !important;
- margin: 0 0 .5em 1em !important;
-}
-
-.jetpack-recipe-content .alignnone {
- display: inline-block;
-}
+.jetpack-recipe-meta li.jetpack-recipe-print{display:none}.jetpack-recipe-title{font-size:16pt}.jetpack-recipe-content img{display:inline-block!important;max-width:100%}.jetpack-recipe-image{display:none!important}.jetpack-recipe-content .aligncenter{display:block!important;margin:0 auto 1em!important;text-align:center!important}.jetpack-recipe-content .alignright{float:left!important;margin:0 1em .5em 0!important}.jetpack-recipe-content .alignleft{float:right!important;margin:0 0 .5em 1em!important}.jetpack-recipe-content .alignnone{display:inline-block} \ No newline at end of file
diff --git a/plugins/jetpack/modules/shortcodes/css/recipes-rtl.css b/plugins/jetpack/modules/shortcodes/css/recipes-rtl.css
index 8251edf5..a0492b5f 100644
--- a/plugins/jetpack/modules/shortcodes/css/recipes-rtl.css
+++ b/plugins/jetpack/modules/shortcodes/css/recipes-rtl.css
@@ -1,37 +1 @@
-/* Do not modify this file directly. It is concatenated from individual module CSS files. */
-.jetpack-recipe {
- border: 1px solid #f2f2f2;
- border-radius: 1px;
- clear: both;
- margin: 1.5em 1%;
- padding: 1% 2%;
-}
-.jetpack-recipe-title {
- border-bottom: 1px solid #ccc;
- margin: .25em 0;
- padding: .25em 0;
-}
-.jetpack-recipe .jetpack-recipe-meta {
- display: block;
- font-size: .9em;
- list-style-type: none;
- margin-left: 0;
- margin-right: 0;
- padding: 0;
- overflow: hidden;
- width: 100%;
-}
-.jetpack-recipe .jetpack-recipe-meta li {
- float: right;
- list-style-type: none;
- margin: 0;
- padding: 0 0 0 5%;
-}
-.jetpack-recipe-meta li.jetpack-recipe-print {
- float: left;
- padding-left: 0;
- text-align: left;
-}
-.jetpack-recipe-notes {
- font-style: italic;
-}
+.jetpack-recipe{border:1px solid #f2f2f2;border-radius:1px;clear:both;margin:1.5em 1%;padding:1% 2%}.jetpack-recipe-title{border-bottom:1px solid #ccc;margin:.25em 0;padding:.25em 0}.jetpack-recipe .jetpack-recipe-meta{display:block;font-size:.9em;list-style-type:none;margin-left:0;margin-right:0;padding:0;overflow:hidden;width:100%}.jetpack-recipe .jetpack-recipe-meta li{float:right;list-style-type:none;margin:0;padding:0 0 0 5%}.jetpack-recipe-meta li.jetpack-recipe-print{float:left;padding-left:0;text-align:left}.jetpack-recipe-notes{font-style:italic} \ No newline at end of file
diff --git a/plugins/jetpack/modules/shortcodes/css/rtl/recipes-rtl.css b/plugins/jetpack/modules/shortcodes/css/rtl/recipes-rtl.css
deleted file mode 100644
index 57d97597..00000000
--- a/plugins/jetpack/modules/shortcodes/css/rtl/recipes-rtl.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/* This file was automatically generated on Apr 19 2016 09:36:47 */
-
-.jetpack-recipe {
- border: 1px solid #f2f2f2;
- border-radius: 1px;
- clear: both;
- margin: 1.5em 1%;
- padding: 1% 2%;
-}
-.jetpack-recipe-title {
- border-bottom: 1px solid #ccc;
- margin: .25em 0;
- padding: .25em 0;
-}
-.jetpack-recipe .jetpack-recipe-meta {
- display: block;
- font-size: .9em;
- list-style-type: none;
- margin-left: 0;
- margin-right: 0;
- padding: 0;
- overflow: hidden;
- width: 100%;
-}
-.jetpack-recipe .jetpack-recipe-meta li {
- float: right;
- list-style-type: none;
- margin: 0;
- padding: 0 0 0 5%;
-}
-.jetpack-recipe-meta li.jetpack-recipe-print {
- float: left;
- padding-left: 0;
- text-align: left;
-}
-.jetpack-recipe-notes {
- font-style: italic;
-}
diff --git a/plugins/jetpack/modules/shortcodes/facebook.php b/plugins/jetpack/modules/shortcodes/facebook.php
index 778fc543..ab7a04f4 100644
--- a/plugins/jetpack/modules/shortcodes/facebook.php
+++ b/plugins/jetpack/modules/shortcodes/facebook.php
@@ -32,7 +32,14 @@ function jetpack_facebook_embed_handler( $matches, $attr, $url ) {
if ( false !== strpos( $url, 'video.php' ) || false !== strpos( $url, '/videos/' ) ) {
$embed = sprintf( '<div class="fb-video" data-allowfullscreen="true" data-href="%s"></div>', esc_url( $url ) );
} else {
- $embed = sprintf( '<fb:post href="%s"></fb:post>', esc_url( $url ) );
+ $width = 552; // As of 01/2017, the default width of Facebook embeds when no width attribute provided
+
+ global $content_width;
+ if ( isset( $content_width ) ) {
+ $width = min( $width, $content_width );
+ }
+
+ $embed = sprintf( '<fb:post href="%s" data-width="%s"></fb:post>', esc_url( $url ), esc_attr( $width ) );
}
// since Facebook is a faux embed, we need to load the JS SDK in the wpview embed iframe
diff --git a/plugins/jetpack/modules/shortcodes/googleplus.php b/plugins/jetpack/modules/shortcodes/googleplus.php
index 134246e0..daa34d1a 100644
--- a/plugins/jetpack/modules/shortcodes/googleplus.php
+++ b/plugins/jetpack/modules/shortcodes/googleplus.php
@@ -11,7 +11,7 @@ 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 ) {
- wp_enqueue_script( 'jetpack-gplus-api', 'https://apis.google.com/js/plusone.js', array(), null, true );
+ wp_enqueue_script( 'jetpack-gplus-api', 'https://apis.google.com/js/plusone.min.js', array(), null, true );
return sprintf( '<div class="g-post" data-href="%s"></div>', esc_url( $url ) );
}
diff --git a/plugins/jetpack/modules/shortcodes/mailchimp.php b/plugins/jetpack/modules/shortcodes/mailchimp.php
index 6f73330d..8bba9978 100644
--- a/plugins/jetpack/modules/shortcodes/mailchimp.php
+++ b/plugins/jetpack/modules/shortcodes/mailchimp.php
@@ -6,7 +6,7 @@
* [mailchimp_subscriber_popup baseUrl="mc.us11.list-manage.com" uuid="1ca7856462585a934b8674c71" lid="2d24f1898b"]
*
* Embed code example:
- * <script type="text/javascript" src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"1ca7856462585a934b8674c71","lid":"2d24f1898b"}) })</script>
+ * <script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"1ca7856462585a934b8674c71","lid":"2d24f1898b"}) })</script>
*
*/
@@ -46,9 +46,9 @@ class MailChimp_Subscriber_Popup {
*/
static $reversal_regexes = array(
/* raw examplejs */
- '/<script type="text\/javascript" src="(https?:)?\/\/s3\.amazonaws.com\/downloads\.mailchimp\.com\/js\/signup-forms\/popup\/embed\.js" data-dojo-config="([^"]*?)"><\/script><script type="text\/javascript">require\(\["mojo\/signup-forms\/Loader"\]\, function\(L\) { L\.start\({([^}]*?)}\) }\)<\/script>/s',
+ '/<script type="text\/javascript" src="(https?:)?\/\/downloads\.mailchimp\.com\/js\/signup-forms\/popup\/embed\.js" data-dojo-config="([^"]*?)"><\/script><script type="text\/javascript">require\(\["mojo\/signup-forms\/Loader"\]\, function\(L\) { L\.start\({([^}]*?)}\) }\)<\/script>/s',
/* visual editor */
- '/&lt;script type="text\/javascript" src="(https?:)?\/\/s3\.amazonaws.com\/downloads\.mailchimp\.com\/js\/signup-forms\/popup\/embed\.js" data-dojo-config="([^"]*?)"&gt;&lt;\/script&gt;&lt;script type="text\/javascript"&gt;require\(\["mojo\/signup-forms\/Loader"]\, function\(L\) { L\.start\({([^}]*?)}\) }\)&lt;\/script&gt;/s',
+ '/&lt;script type="text\/javascript" src="(https?:)?\/\/downloads\.mailchimp\.com\/js\/signup-forms\/popup\/embed\.js" data-dojo-config="([^"]*?)"&gt;&lt;\/script&gt;&lt;script type="text\/javascript"&gt;require\(\["mojo\/signup-forms\/Loader"]\, function\(L\) { L\.start\({([^}]*?)}\) }\)&lt;\/script&gt;/s',
);
/**
@@ -199,6 +199,6 @@ class MailChimp_Subscriber_Popup {
$displayed_once = true;
- return "\n\n" . '<script type="text/javascript" data-dojo-config="' . esc_attr( implode( ', ', $config_vars ) ) . '">jQuery.getScript( "//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js", function( data, textStatus, jqxhr ) { require(["mojo/signup-forms/Loader"], function(L) { L.start(' . wp_json_encode( $js_vars ) . ') }); } );</script>' . "\n\n";
+ return "\n\n" . '<script type="text/javascript" data-dojo-config="' . esc_attr( implode( ', ', $config_vars ) ) . '">jQuery.getScript( "//downloads.mailchimp.com/js/signup-forms/popup/embed.js", function( data, textStatus, jqxhr ) { require(["mojo/signup-forms/Loader"], function(L) { L.start(' . wp_json_encode( $js_vars ) . ') }); } );</script>' . "\n\n";
}
}
diff --git a/plugins/jetpack/modules/shortcodes/untappd-menu.php b/plugins/jetpack/modules/shortcodes/untappd-menu.php
index 39a0e3c3..834c2c77 100644
--- a/plugins/jetpack/modules/shortcodes/untappd-menu.php
+++ b/plugins/jetpack/modules/shortcodes/untappd-menu.php
@@ -41,7 +41,7 @@ class Jetpack_Untappd {
// We're going to clean the user input.
$atts = array_map( 'absint', $atts );
- if ( $atts['location'] < 1 || $atts['theme'] < 1 ){
+ if ( $atts['location'] < 1 || $atts['theme'] < 1 ) {
return;
}
@@ -62,4 +62,4 @@ class Jetpack_Untappd {
}
}
-new Jetpack_Untappd(); \ No newline at end of file
+new Jetpack_Untappd();
diff --git a/plugins/jetpack/modules/shortlinks.php b/plugins/jetpack/modules/shortlinks.php
index c0ce3f43..54e30b94 100644
--- a/plugins/jetpack/modules/shortlinks.php
+++ b/plugins/jetpack/modules/shortlinks.php
@@ -53,8 +53,7 @@ function wpme_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) {
if ( empty( $id ) )
$id = $blog_id;
- $wpme_url = 'http://wp.me/' . wpme_dec2sixtwo( $id );
- return set_url_scheme( $wpme_url );
+ return 'https://wp.me/' . wpme_dec2sixtwo( $id );
}
$post = get_post( $id );
@@ -82,8 +81,7 @@ function wpme_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) {
if ( empty( $type ) )
return '';
- $url = 'http://wp.me/' . $type . wpme_dec2sixtwo( $blog_id ) . '-' . $id;
- return set_url_scheme( $url );
+ return 'https://wp.me/' . $type . wpme_dec2sixtwo( $blog_id ) . '-' . $id;
}
function wpme_get_shortlink_handler( $shortlink, $id, $context, $allow_slugs ) {
diff --git a/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js b/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js
index 55e38e31..5b070891 100644
--- a/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js
+++ b/plugins/jetpack/modules/simple-payments/paypal-express-checkout.js
@@ -140,6 +140,7 @@ var PaypalExpressCheckout = {
style: {
label: 'pay',
+ fundingicons: true,
shape: 'rect',
color: 'silver'
},
diff --git a/plugins/jetpack/modules/simple-payments/simple-payments.css b/plugins/jetpack/modules/simple-payments/simple-payments.css
index 7ecffe79..dd479fc1 100644
--- a/plugins/jetpack/modules/simple-payments/simple-payments.css
+++ b/plugins/jetpack/modules/simple-payments/simple-payments.css
@@ -19,10 +19,9 @@ body .jetpack-simple-payments-wrapper .jetpack-simple-payments-details p {
}
.jetpack-simple-payments-image {
- border: 1px solid rgba(0, 0, 0, 0.1);
box-sizing: border-box;
min-width: 70px;
- padding-top: calc(100% - 2px);
+ padding-top: 100%;
position: relative;
}
@@ -69,32 +68,53 @@ input[type="number"].jetpack-simple-payments-items-number {
}
.jetpack-simple-payments-purchase-message {
+ background-color: rgba(255, 255, 255, 0.7);
+ border: 2px solid #fff;
+ border-radius: 2px;
+ box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
display: none;
- padding: 0.5em 1em;
margin-bottom: 1.5em;
+ min-height: 48px;
+ padding: 1em;
+ position: relative;
}
-/* Higher specificity in order to set the text color */
-body .jetpack-simple-payments-wrapper .jetpack-simple-payments-purchase-message p {
- color: #fff;
- margin: 0 0 0.5em;
- padding: 0;
-}
-
-body .jetpack-simple-payments-wrapper .jetpack-simple-payments-purchase-message p:last-child {
- margin: 0;
+.jetpack-simple-payments-purchase-message:before {
+ font-family: dashicons !important;
+ font-size: 48px !important;
+ line-height: 1 !important;
+ position: absolute;
+ speak: none;
+ top: 50%;
+ left: 0;
+ transform: translateY(-50%);
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
}
.jetpack-simple-payments-purchase-message.show {
display: block;
}
-.jetpack-simple-payments-purchase-message.success {
- background-color: #4ab866;
+.jetpack-simple-payments-purchase-message.success:before {
+ color: #4ab866;
+ content: "\f147";
+}
+
+.jetpack-simple-payments-purchase-message.error:before {
+ color: #d94f4f;
+ content: "\f335";
}
-.jetpack-simple-payments-purchase-message.error {
- background-color: #d94f4f;
+/* Higher specificity in order to reset */
+body .jetpack-simple-payments-wrapper .jetpack-simple-payments-purchase-message p {
+ color: #222;
+ margin: 0 0 0.5em;
+ padding: 0 0 0 40px;
+}
+
+body .jetpack-simple-payments-wrapper .jetpack-simple-payments-purchase-message p:last-child {
+ margin: 0;
}
@media screen and (min-width: 400px) {
diff --git a/plugins/jetpack/modules/simple-payments/simple-payments.php b/plugins/jetpack/modules/simple-payments/simple-payments.php
index 167c6008..d8e91ce4 100644
--- a/plugins/jetpack/modules/simple-payments/simple-payments.php
+++ b/plugins/jetpack/modules/simple-payments/simple-payments.php
@@ -14,7 +14,7 @@ class Jetpack_Simple_Payments {
static $css_classname_prefix = 'jetpack-simple-payments';
// Increase this number each time there's a change in CSS or JS to bust cache.
- static $version = '0.23';
+ static $version = '0.25';
// Classic singleton pattern:
private static $instance;
@@ -77,7 +77,7 @@ class Jetpack_Simple_Payments {
if ( ! $product || is_wp_error( $product ) ) {
return;
}
- if ( $product->post_type !== self::$post_type_product ) {
+ if ( $product->post_type !== self::$post_type_product || 'trash' === $product->post_status ) {
return;
}
@@ -104,7 +104,7 @@ class Jetpack_Simple_Payments {
wp_enqueue_script( 'paypal-express-checkout' );
}
if ( ! wp_style_is( 'simple-payments', 'enqueued' ) ) {
- wp_enqueue_style( 'simple-payments', plugins_url( 'simple-payments.css', __FILE__ ) );
+ wp_enqueue_style( 'simple-payments', plugins_url( 'simple-payments.css', __FILE__ ), array( 'dashicons' ) );
}
wp_add_inline_script( 'paypal-express-checkout', sprintf(
@@ -133,13 +133,13 @@ class Jetpack_Simple_Payments {
}
return "
<div class='{$data['class']} ${css_prefix}-wrapper'>
- <div class='${css_prefix}-purchase-message' id='{$data['dom_id']}-message-container'></div>
<div class='${css_prefix}-product'>
{$image}
<div class='${css_prefix}-details'>
<div class='${css_prefix}-title'><p>{$data['title']}</p></div>
<div class='${css_prefix}-description'><p>{$data['description']}</p></div>
<div class='${css_prefix}-price'><p>{$data['price']}</p></div>
+ <div class='${css_prefix}-purchase-message' id='{$data['dom_id']}-message-container'></div>
<div class='${css_prefix}-purchase-box'>
{$items}
<div class='${css_prefix}-button' id='{$data['dom_id']}_button'></div>
diff --git a/plugins/jetpack/modules/sitemaps.php b/plugins/jetpack/modules/sitemaps.php
index f17f740d..9ce5bd03 100644
--- a/plugins/jetpack/modules/sitemaps.php
+++ b/plugins/jetpack/modules/sitemaps.php
@@ -42,5 +42,5 @@ function jetpack_sitemap_on_activate() {
$sitemap_builder = new Jetpack_Sitemap_Builder();
add_action( 'jetpack_sitemap_generate_on_activate', array( $sitemap_builder, 'update_sitemap' ) );
- wp_schedule_single_event( time(), 'jetpack_sitemap_generate_on_activate' );
+ wp_schedule_single_event( time() + 60, 'jetpack_sitemap_generate_on_activate' );
}
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-constants.php b/plugins/jetpack/modules/sitemaps/sitemap-constants.php
index 6a86ce95..e91a3341 100644
--- a/plugins/jetpack/modules/sitemaps/sitemap-constants.php
+++ b/plugins/jetpack/modules/sitemaps/sitemap-constants.php
@@ -46,7 +46,7 @@ if ( ! defined( 'JP_NEWS_SITEMAP_MAX_ITEMS' ) ) {
* @since 4.8.0
*/
if ( ! defined( 'JP_SITEMAP_BATCH_SIZE' ) ) {
- define( 'JP_SITEMAP_BATCH_SIZE', 1000 );
+ define( 'JP_SITEMAP_BATCH_SIZE', 50 );
}
/**
diff --git a/plugins/jetpack/modules/stats.php b/plugins/jetpack/modules/stats.php
index cb56ef7d..4210f7c6 100644
--- a/plugins/jetpack/modules/stats.php
+++ b/plugins/jetpack/modules/stats.php
@@ -800,7 +800,7 @@ function stats_configuration_screen() {
?>
</td></tr>
<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>
+ <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 echo wp_kses( __( 'The image helps collect stats and <strong>makes the world a better place</strong> but should still work when hidden', 'jetpack' ), array( 'strong' => array() ) ); ?> <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 esc_html_e( 'Select the roles that will be able to view stats reports.', 'jetpack' ); ?><br/>
@@ -1593,7 +1593,7 @@ function stats_str_getcsv( $csv ) {
fwrite( $temp, $csv, strlen( $csv ) );
fseek( $temp, 0 );
- while ( false !== $row = fgetcsv( $temp, 2000 ) ) {
+ while ( false !== $row = fgetcsv( $temp, 2000 ) ) {
$data[] = $row;
}
fclose( $temp );
diff --git a/plugins/jetpack/modules/subscriptions.php b/plugins/jetpack/modules/subscriptions.php
index d0155a5c..f52b9a84 100644
--- a/plugins/jetpack/modules/subscriptions.php
+++ b/plugins/jetpack/modules/subscriptions.php
@@ -666,7 +666,7 @@ class Jetpack_Subscriptions {
if ( isset( $_REQUEST['subscribe_blog'] ) )
$post_ids[] = 0;
- Jetpack_Subscriptions::subscribe(
+ $result = Jetpack_Subscriptions::subscribe(
$comment->comment_author_email,
$post_ids,
true,
@@ -677,6 +677,18 @@ class Jetpack_Subscriptions {
'server_data' => $_SERVER,
)
);
+
+ /**
+ * Fires on each comment subscription form submission.
+ *
+ * @module subscriptions
+ *
+ * @since 5.5.0
+ *
+ * @param NULL|WP_Error $result Result of form submission: NULL on success, WP_Error otherwise.
+ * @param Array $post_ids An array of post IDs that the user subscribed to, 0 means blog subscription.
+ */
+ do_action( 'jetpack_subscriptions_comment_form_submission', $result, $post_ids );
}
/**
diff --git a/plugins/jetpack/modules/theme-tools/content-options/blog-display.php b/plugins/jetpack/modules/theme-tools/content-options/blog-display.php
index 78b88418..d37b6255 100644
--- a/plugins/jetpack/modules/theme-tools/content-options/blog-display.php
+++ b/plugins/jetpack/modules/theme-tools/content-options/blog-display.php
@@ -47,7 +47,7 @@ function jetpack_blog_display_custom_excerpt( $content ) {
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
- if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
+ if ( strpos( _x( 'words', 'Word count type. Do not translate!', 'jetpack' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
preg_match_all( '/./u', $text, $words );
$words = array_slice( $words[0], 0, $excerpt_length + 1 );
@@ -91,9 +91,16 @@ function jetpack_the_excerpt_to_the_content( $content ) {
if ( is_home() || is_archive() ) {
ob_start();
the_content( sprintf(
- /* translators: %s: Name of current post. */
- wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'jetpack' ), array( 'span' => array( 'class' => array() ) ) ),
- the_title( '<span class="screen-reader-text">"', '"</span>', false )
+ wp_kses(
+ /* translators: %s: Name of current post. Only visible to screen readers */
+ __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'jetpack' ),
+ array(
+ 'span' => array(
+ 'class' => array(),
+ ),
+ )
+ ),
+ get_the_title()
) );
$content = ob_get_clean();
}
@@ -126,9 +133,16 @@ function jetpack_the_excerpt_customizer( $excerpt ) {
if ( is_home() || is_archive() ) {
ob_start();
the_content( sprintf(
- /* translators: %s: Name of current post. */
- wp_kses( __( 'Continue reading %s <span class="meta-nav">&rarr;</span>', 'jetpack' ), array( 'span' => array( 'class' => array() ) ) ),
- the_title( '<span class="screen-reader-text">"', '"</span>', false )
+ wp_kses(
+ /* translators: %s: Name of current post. Only visible to screen readers */
+ __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'jetpack' ),
+ array(
+ 'span' => array(
+ 'class' => array(),
+ ),
+ )
+ ),
+ get_the_title()
) );
$content = ob_get_clean();
}
diff --git a/plugins/jetpack/modules/theme-tools/content-options/featured-images.php b/plugins/jetpack/modules/theme-tools/content-options/featured-images.php
index 048ce760..ce66a830 100644
--- a/plugins/jetpack/modules/theme-tools/content-options/featured-images.php
+++ b/plugins/jetpack/modules/theme-tools/content-options/featured-images.php
@@ -5,11 +5,45 @@
function jetpack_featured_images_remove_post_thumbnail( $metadata, $object_id, $meta_key, $single ) {
$opts = jetpack_featured_images_get_settings();
- // Returns false if the archive option or singular option is unticked.
- if ( ( true === $opts['archive'] && ( is_home() || is_archive() || is_search() ) && ! $opts['archive-option'] && ( isset( $meta_key ) && '_thumbnail_id' === $meta_key ) && in_the_loop() )
- || ( true === $opts['post'] && is_single() && ! jetpack_is_product() && ! $opts['post-option'] && ( isset( $meta_key ) && '_thumbnail_id' === $meta_key ) && in_the_loop() )
- || ( true === $opts['page'] && is_singular() && is_page() && ! $opts['page-option'] && ( isset( $meta_key ) && '_thumbnail_id' === $meta_key ) && in_the_loop() )
- || ( true === $opts['portfolio'] && post_type_exists( 'jetpack-portfolio' ) && is_singular( 'jetpack-portfolio' ) && ! $opts['portfolio-option'] && ( isset( $meta_key ) && '_thumbnail_id' === $meta_key ) && in_the_loop() ) ) {
+ // Automatically return metadata if it's a PayPal product - we don't want to hide the Featured Image.
+ if ( 'jp_pay_product' === get_post_type( $object_id ) ) {
+ return $metadata;
+ }
+
+ // Return false if the archive option or singular option is unticked.
+ if (
+ ( true === $opts['archive']
+ && ( is_home() || is_archive() || is_search() )
+ && ! $opts['archive-option']
+ && ( isset( $meta_key )
+ && '_thumbnail_id' === $meta_key )
+ && in_the_loop()
+ )
+ || ( true === $opts['post']
+ && is_single()
+ && ! jetpack_is_product()
+ && ! $opts['post-option']
+ && ( isset( $meta_key )
+ && '_thumbnail_id' === $meta_key )
+ && in_the_loop()
+ )
+ || ( true === $opts['page']
+ && is_singular()
+ && is_page()
+ && ! $opts['page-option']
+ && ( isset( $meta_key )
+ && '_thumbnail_id' === $meta_key )
+ && in_the_loop()
+ )
+ || ( true === $opts['portfolio']
+ && post_type_exists( 'jetpack-portfolio' )
+ && is_singular( 'jetpack-portfolio' )
+ && ! $opts['portfolio-option']
+ && ( isset( $meta_key )
+ && '_thumbnail_id' === $meta_key )
+ && in_the_loop()
+ )
+ ) {
return false;
} else {
return $metadata;
diff --git a/plugins/jetpack/modules/theme-tools/content-options/post-details.php b/plugins/jetpack/modules/theme-tools/content-options/post-details.php
index 3116bc3c..a448381d 100644
--- a/plugins/jetpack/modules/theme-tools/content-options/post-details.php
+++ b/plugins/jetpack/modules/theme-tools/content-options/post-details.php
@@ -121,12 +121,14 @@ function jetpack_post_details_should_run() {
$comment = ( ! empty( $post_details['comment'] ) ) ? $post_details['comment'] : null;
// If there is no stylesheet and there are no date, categories, tags, author or comment declared, don't continue.
- if ( empty( $post_details['stylesheet'] )
- && ( empty( $date )
- || empty( $categories )
- || empty( $tags )
- || empty( $author )
- || empty( $comment ) ) ) {
+ if (
+ empty( $post_details['stylesheet'] )
+ && ( empty( $date )
+ || empty( $categories )
+ || empty( $tags )
+ || empty( $author )
+ || empty( $comment ) )
+ ) {
return $void;
}
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php b/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
index b3421aae..9955b0f1 100644
--- a/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php
@@ -16,6 +16,8 @@ class Jetpack_Tiled_Gallery {
add_action( 'admin_init', array( $this, 'settings_api_init' ) );
add_filter( 'jetpack_gallery_types', array( $this, 'jetpack_gallery_types' ), 9 );
add_filter( 'jetpack_default_gallery_type', array( $this, 'jetpack_default_gallery_type' ) );
+
+
}
public function tiles_enabled() {
diff --git a/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css
new file mode 100644
index 00000000..34e50334
--- /dev/null
+++ b/plugins/jetpack/modules/tiled-gallery/tiled-gallery/tiled-gallery-rtl.css
@@ -0,0 +1 @@
+.tiled-gallery{clear:both;margin:0 0 20px;overflow:hidden}.tiled-gallery img{margin:2px!important}.tiled-gallery .gallery-group{float:right;position:relative}.tiled-gallery .tiled-gallery-item{float:right;margin:0;position:relative;width:inherit}.tiled-gallery .gallery-row{overflow:hidden}.tiled-gallery .tiled-gallery-item a{background:100% 0;border:none;color:inherit;margin:0;padding:0;text-decoration:none;width:auto}.tiled-gallery .tiled-gallery-item img,.tiled-gallery .tiled-gallery-item img:hover{background:100% 0;border:none;box-shadow:none;max-width:100%;padding:0;vertical-align:middle}.tiled-gallery-caption{background:#eee;background:rgba(255,255,255,.8);color:#333;font-size:13px;font-weight:400;overflow:hidden;padding:10px 0;position:absolute;bottom:0;text-indent:10px;text-overflow:ellipsis;width:100%;white-space:nowrap}.tiled-gallery .tiled-gallery-item-small .tiled-gallery-caption{font-size:11px}.widget-gallery .tiled-gallery-unresized{visibility:hidden;height:0;overflow:hidden}.tiled-gallery .tiled-gallery-item img.grayscale{position:absolute;right:0;top:0}.tiled-gallery .tiled-gallery-item img.grayscale:hover{opacity:0}.tiled-gallery.type-circle .tiled-gallery-item img{border-radius:50%!important}.tiled-gallery.type-circle .tiled-gallery-caption{display:none;opacity:0} \ No newline at end of file
diff --git a/plugins/jetpack/modules/verification-tools/verification-tools-utils.php b/plugins/jetpack/modules/verification-tools/verification-tools-utils.php
index 94d54010..8c9a2c4f 100644
--- a/plugins/jetpack/modules/verification-tools/verification-tools-utils.php
+++ b/plugins/jetpack/modules/verification-tools/verification-tools-utils.php
@@ -5,8 +5,8 @@
* This file will be included in module-extras.php.
*/
-function jetpack_verification_validate( $verification_services_codes ) {
- foreach ( $verification_services_codes as $key => &$code ) {
+function jetpack_verification_validate( &$verification_services_codes ) {
+ foreach ( $verification_services_codes as $key => $code ) {
// Parse html meta tags if present
if ( stripos( $code, 'meta' ) )
$code = jetpack_verification_get_code( $code );
@@ -27,6 +27,8 @@ function jetpack_verification_validate( $verification_services_codes ) {
* @param string $code Verification service code provided in field in the Tools menu.
*/
do_action( 'jetpack_site_verification_validate', $key, $code );
+
+ $verification_services_codes[ $key ] = $code;
}
return $verification_services_codes;
}
diff --git a/plugins/jetpack/modules/videopress/class.videopress-player.php b/plugins/jetpack/modules/videopress/class.videopress-player.php
index 09730182..11abc45c 100644
--- a/plugins/jetpack/modules/videopress/class.videopress-player.php
+++ b/plugins/jetpack/modules/videopress/class.videopress-player.php
@@ -621,7 +621,6 @@ class VideoPress_Player {
}
$js_url = 'https://s0.wp.com/wp-content/plugins/video/assets/js/next/videopress-iframe.js';
- $js_url = add_query_arg( 'jetpack_version', JETPACK__VERSION, $js_url );
return "<iframe width='" . esc_attr( $videopress_options['width'] )
. "' height='" . esc_attr( $videopress_options['height'] )
@@ -632,7 +631,6 @@ class VideoPress_Player {
} else {
$videopress_options = json_encode( $videopress_options );
$js_url = 'https://s0.wp.com/wp-content/plugins/video/assets/js/next/videopress.js';
- $js_url = add_query_arg( 'jetpack_version', JETPACK__VERSION, $js_url );
return "<div id='{$video_container_id}'></div>
<script src='{$js_url}'></script>
diff --git a/plugins/jetpack/modules/videopress/css/editor-rtl.css b/plugins/jetpack/modules/videopress/css/editor-rtl.css
new file mode 100644
index 00000000..12945cb6
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/css/editor-rtl.css
@@ -0,0 +1,60 @@
+/* Do not modify this file directly. It is concatenated from individual module CSS files. */
+/* VideoPress Settings Modal style overrides */
+.mce-videopress-field-guid,
+.mce-videopress-field-freedom,
+.mce-videopress-field-flashonly {
+ display: none;
+}
+
+.mce-videopress-checkbox .mce-checkbox {
+ right: 120px !important;
+ width: 100% !important; /* assigning a full width so the label area is clickable */
+}
+
+.mce-videopress-checkbox .mce-label {
+ right: 150px !important;
+}
+
+.mce-videopress-checkbox .mce-label-unit {
+ position: absolute;
+ right: 210px;
+ top: 5px;
+}
+
+.mce-videopress-checkbox i.mce-i-checkbox {
+ background-color: #fff;
+ color: #1e8cbe;
+}
+
+.mce-videopress-checkbox .mce-i-checkbox:before {
+ display: inline-block;
+ vertical-align: middle;
+ width: 16px;
+ font: 400 21px/1 dashicons;
+ speak: none;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ margin: -3px -3px 0 0;
+ content: "\f147";
+}
+
+.mce-videopress-checkbox .mce-i-checkbox.mce-checked:before {
+ content: "\f147";
+}
+
+div[class*=mce-videopress-field] input[type=number] {
+ width: 70px !important;
+ right: 120px !important;
+}
+
+.mce-videopress-field-w .mce-label,
+.mce-videopress-field-at .mce-label {
+ width: 115px !important;
+ text-align: left;
+}
+
+.mce-videopress-field-unit {
+ position: absolute;
+ right: 210px;
+ top: 5px;
+}
diff --git a/plugins/jetpack/modules/videopress/css/editor-rtl.min.css b/plugins/jetpack/modules/videopress/css/editor-rtl.min.css
new file mode 100644
index 00000000..460d6f03
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/css/editor-rtl.min.css
@@ -0,0 +1 @@
+.mce-videopress-field-flashonly,.mce-videopress-field-freedom,.mce-videopress-field-guid{display:none}.mce-videopress-checkbox .mce-checkbox{right:120px!important;width:100%!important}.mce-videopress-checkbox .mce-label{right:150px!important}.mce-videopress-checkbox .mce-label-unit{position:absolute;right:210px;top:5px}.mce-videopress-checkbox i.mce-i-checkbox{background-color:#fff;color:#1e8cbe}.mce-videopress-checkbox .mce-i-checkbox:before{display:inline-block;vertical-align:middle;width:16px;font:400 21px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:-3px -3px 0 0;content:"\f147"}.mce-videopress-checkbox .mce-i-checkbox.mce-checked:before{content:"\f147"}div[class*=mce-videopress-field] input[type=number]{width:70px!important;right:120px!important}.mce-videopress-field-at .mce-label,.mce-videopress-field-w .mce-label{width:115px!important;text-align:left}.mce-videopress-field-unit{position:absolute;right:210px;top:5px} \ No newline at end of file
diff --git a/plugins/jetpack/modules/videopress/css/editor.min.css b/plugins/jetpack/modules/videopress/css/editor.min.css
new file mode 100644
index 00000000..f3a010b7
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/css/editor.min.css
@@ -0,0 +1,2 @@
+/* Do not modify this file directly. It is concatenated from individual module CSS files. */
+.mce-videopress-field-flashonly,.mce-videopress-field-freedom,.mce-videopress-field-guid{display:none}.mce-videopress-checkbox .mce-checkbox{left:120px!important;width:100%!important}.mce-videopress-checkbox .mce-label{left:150px!important}.mce-videopress-checkbox .mce-label-unit{position:absolute;left:210px;top:5px}.mce-videopress-checkbox i.mce-i-checkbox{background-color:#fff;color:#1e8cbe}.mce-videopress-checkbox .mce-i-checkbox:before{display:inline-block;vertical-align:middle;width:16px;font:400 21px/1 dashicons;speak:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:-3px 0 0 -3px;content:"\f147"}.mce-videopress-checkbox .mce-i-checkbox.mce-checked:before{content:"\f147"}div[class*=mce-videopress-field] input[type=number]{width:70px!important;left:120px!important}.mce-videopress-field-at .mce-label,.mce-videopress-field-w .mce-label{width:115px!important;text-align:right}.mce-videopress-field-unit{position:absolute;left:210px;top:5px} \ No newline at end of file
diff --git a/plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.css b/plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.css
new file mode 100644
index 00000000..c3af72cf
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.css
@@ -0,0 +1,22 @@
+/* Do not modify this file directly. It is concatenated from individual module CSS files. */
+/**
+ * VideoPress styles for Editor
+ */
+.videopress-editor-wrapper {
+ position: relative;
+ max-width: 100%;
+ padding: 56.25% 0 0;
+ height: 0;
+ overflow: hidden;
+}
+.tmpl-videopress_iframe_next iframe {
+ position: absolute;
+ top: 0;
+ right: 0;
+ max-width: 100%;
+ max-height: 100%;
+}
+body.rtl .tmpl-videopress_iframe_next iframe {
+ right: auto;
+ left: 0;
+} \ No newline at end of file
diff --git a/plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.min.css b/plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.min.css
new file mode 100644
index 00000000..53c667e8
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/css/videopress-editor-style-rtl.min.css
@@ -0,0 +1 @@
+.videopress-editor-wrapper{position:relative;max-width:100%;padding:56.25% 0 0;height:0;overflow:hidden}.tmpl-videopress_iframe_next iframe{position:absolute;top:0;right:0;max-width:100%;max-height:100%}body.rtl .tmpl-videopress_iframe_next iframe{right:auto;left:0} \ No newline at end of file
diff --git a/plugins/jetpack/modules/videopress/css/videopress-editor-style.min.css b/plugins/jetpack/modules/videopress/css/videopress-editor-style.min.css
new file mode 100644
index 00000000..546cfc5c
--- /dev/null
+++ b/plugins/jetpack/modules/videopress/css/videopress-editor-style.min.css
@@ -0,0 +1,2 @@
+/* Do not modify this file directly. It is concatenated from individual module CSS files. */
+.videopress-editor-wrapper{position:relative;max-width:100%;padding:56.25% 0 0;height:0;overflow:hidden}.tmpl-videopress_iframe_next iframe{position:absolute;top:0;left:0;max-width:100%;max-height:100%}body.rtl .tmpl-videopress_iframe_next iframe{left:auto;right:0} \ No newline at end of file
diff --git a/plugins/jetpack/modules/widgets.php b/plugins/jetpack/modules/widgets.php
index de31236f..257ff5b9 100644
--- a/plugins/jetpack/modules/widgets.php
+++ b/plugins/jetpack/modules/widgets.php
@@ -33,6 +33,7 @@ function jetpack_load_widgets() {
}
include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/image-widget.php';
+ include_once dirname( __FILE__ ) . '/widgets/migrate-to-core/gallery-widget.php';
}
add_action( 'jetpack_modules_loaded', 'jetpack_widgets_loaded' );
diff --git a/plugins/jetpack/modules/widgets/contact-info.php b/plugins/jetpack/modules/widgets/contact-info.php
index aa0d2f1b..d994f20b 100644
--- a/plugins/jetpack/modules/widgets/contact-info.php
+++ b/plugins/jetpack/modules/widgets/contact-info.php
@@ -93,6 +93,8 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
*/
do_action( 'jetpack_contact_info_widget_start' );
+ echo '<div itemscope itemtype="http://schema.org/LocalBusiness">';
+
if ( '' != $instance['address'] ) {
$showmap = $instance['showmap'];
@@ -112,15 +114,15 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
$map_link = $this->build_map_link( $instance['address'] );
- echo '<div class="confit-address"><a href="' . esc_url( $map_link ) . '" target="_blank">' . str_replace( "\n", "<br/>", esc_html( $instance['address'] ) ) . "</a></div>";
+ echo '<div class="confit-address" itemscope itemtype="http://schema.org/PostalAddress" itemprop="address"><a href="' . esc_url( $map_link ) . '" target="_blank">' . str_replace( "\n", "<br/>", esc_html( $instance['address'] ) ) . "</a></div>";
}
if ( '' != $instance['phone'] ) {
if ( wp_is_mobile() ) {
- echo '<div class="confit-phone"><a href="' . esc_url( 'tel:' . $instance['phone'] ) . '">' . esc_html( $instance['phone'] ) . "</a></div>";
+ echo '<div class="confit-phone"><span itemprop="telephone"><a href="' . esc_url( 'tel:' . $instance['phone'] ) . '">' . esc_html( $instance['phone'] ) . "</a></span></div>";
}
else {
- echo '<div class="confit-phone">' . esc_html( $instance['phone'] ) . '</div>';
+ echo '<div class="confit-phone"><span itemprop="telephone">' . esc_html( $instance['phone'] ) . '</span></div>';
}
}
@@ -132,9 +134,11 @@ if ( ! class_exists( 'Jetpack_Contact_Info_Widget' ) ) {
}
if ( '' != $instance['hours'] ) {
- echo '<div class="confit-hours">' . str_replace( "\n", "<br/>", esc_html( $instance['hours'] ) ) . "</div>";
+ echo '<div class="confit-hours" itemprop="openingHours">' . str_replace( "\n", "<br/>", esc_html( $instance['hours'] ) ) . "</div>";
}
+ echo '</div>';
+
/**
* Fires at the end of Contact Info widget.
*
diff --git a/plugins/jetpack/modules/widgets/gallery.php b/plugins/jetpack/modules/widgets/gallery.php
index 1bab5569..ca68dd03 100644
--- a/plugins/jetpack/modules/widgets/gallery.php
+++ b/plugins/jetpack/modules/widgets/gallery.php
@@ -426,6 +426,22 @@ class Jetpack_Gallery_Widget extends WP_Widget {
add_action( 'widgets_init', 'jetpack_gallery_widget_init' );
function jetpack_gallery_widget_init() {
+ /**
+ * Allow the Gallery Widget to be enabled even when Core supports the Media Gallery Widget
+ *
+ * @module widgets
+ *
+ * @since 5.5.0
+ *
+ * @param bool false Whether to force-enable the gallery widget
+ */
+ if (
+ ! apply_filters( 'jetpack_force_enable_gallery_widget', false )
+ && class_exists( 'WP_Widget_Media_Gallery' )
+ && Jetpack_Options::get_option( 'gallery_widget_migration' )
+ ) {
+ return;
+ }
if ( ! method_exists( 'Jetpack', 'is_module_active' ) || Jetpack::is_module_active( 'tiled-gallery' ) )
register_widget( 'Jetpack_Gallery_Widget' );
}
diff --git a/plugins/jetpack/modules/widgets/google-translate.php b/plugins/jetpack/modules/widgets/google-translate.php
index bba613d5..a5787112 100644
--- a/plugins/jetpack/modules/widgets/google-translate.php
+++ b/plugins/jetpack/modules/widgets/google-translate.php
@@ -66,7 +66,40 @@ class Jetpack_Google_Translate_Widget extends WP_Widget {
'title' => $this->default_title,
) );
- wp_localize_script( 'google-translate-init', '_wp_google_translate_widget', array( 'lang' => get_locale() ) );
+ /**
+ * Filter the layout of the Google Translate Widget.
+ *
+ * 3 different integers are accepted.
+ * 0 for the vertical layout.
+ * 1 for the horizontal layout.
+ * 2 for the dropdown only.
+ *
+ * @see https://translate.google.com/manager/website/
+ *
+ * @module widgets
+ *
+ * @since 5.5.0
+ *
+ * @param string $layout layout of the Google Translate Widget.
+ */
+ $button_layout = apply_filters( 'jetpack_google_translate_widget_layout', 2 );
+
+ if (
+ ! is_int( $button_layout )
+ || 0 > $button_layout
+ || 2 < $button_layout
+ ) {
+ $button_layout = 2;
+ }
+
+ wp_localize_script(
+ 'google-translate-init',
+ '_wp_google_translate_widget',
+ array(
+ 'lang' => get_locale(),
+ 'layout' => intval( $button_layout ),
+ )
+ );
wp_enqueue_script( 'google-translate-init' );
wp_enqueue_script( 'google-translate' );
diff --git a/plugins/jetpack/modules/widgets/google-translate/google-translate.js b/plugins/jetpack/modules/widgets/google-translate/google-translate.js
index 6c7cc32f..301f13a7 100644
--- a/plugins/jetpack/modules/widgets/google-translate/google-translate.js
+++ b/plugins/jetpack/modules/widgets/google-translate/google-translate.js
@@ -14,7 +14,7 @@ function googleTranslateElementInit() {
}
new google.translate.TranslateElement( {
pageLanguage: lang,
- layout: google.translate.TranslateElement.InlineLayout.SIMPLE,
+ layout: _wp_google_translate_widget.layout,
autoDisplay: false
}, 'google_translate_element' );
}
diff --git a/plugins/jetpack/modules/widgets/mailchimp.php b/plugins/jetpack/modules/widgets/mailchimp.php
index bbac2923..2af57ac8 100644
--- a/plugins/jetpack/modules/widgets/mailchimp.php
+++ b/plugins/jetpack/modules/widgets/mailchimp.php
@@ -2,11 +2,13 @@
if ( ! class_exists( 'Jetpack_MailChimp_Subscriber_Popup_Widget' ) ) {
+ if ( ! class_exists( 'MailChimp_Subscriber_Popup' ) ) {
+ include_once JETPACK__PLUGIN_DIR . 'modules/shortcodes/mailchimp.php';
+ }
+
//register MailChimp Subscriber Popup widget
function jetpack_mailchimp_subscriber_popup_widget_init() {
- if ( class_exists( 'MailChimp_Subscriber_Popup' ) ) {
- register_widget( 'Jetpack_MailChimp_Subscriber_Popup_Widget' );
- }
+ register_widget( 'Jetpack_MailChimp_Subscriber_Popup_Widget' );
}
add_action( 'widgets_init', 'jetpack_mailchimp_subscriber_popup_widget_init' );
@@ -69,7 +71,7 @@ if ( ! class_exists( 'Jetpack_MailChimp_Subscriber_Popup_Widget' ) ) {
*/
function update( $new_instance, $old_instance ) {
$instance = array();
- $instance['code'] = wp_kses_post( stripslashes( $new_instance['code'] ) );
+ $instance['code'] = MailChimp_Subscriber_Popup::reversal( $new_instance['code'] );
return $instance;
}
diff --git a/plugins/jetpack/modules/widgets/migrate-to-core/gallery-widget.php b/plugins/jetpack/modules/widgets/migrate-to-core/gallery-widget.php
new file mode 100644
index 00000000..8cf2900f
--- /dev/null
+++ b/plugins/jetpack/modules/widgets/migrate-to-core/gallery-widget.php
@@ -0,0 +1,198 @@
+<?php
+/**
+ * Migration from Jetpack's Gallery Widget to WordPress' Core Gallery Widget.
+ *
+ * @since 5.5
+ *
+ * @package Jetpack
+ */
+/**
+ * Migrates all active instances of Jetpack's Gallery widget to Core's Media Gallery widget.
+ */
+function jetpack_migrate_gallery_widget() {
+ // Only trigger the migration from wp-admin and outside unit tests
+ if ( ! is_admin() || defined( 'PHPUNIT_JETPACK_TESTSUITE' ) ) {
+ return;
+ }
+
+ // Only migrate if the new widget is available and we haven't yet migrated
+ if ( ! class_exists( 'WP_Widget_Media_Gallery' ) || Jetpack_Options::get_option( 'gallery_widget_migration' ) ) {
+ return;
+ }
+
+ $old_widgets = get_option( 'widget_gallery', array() );
+ $media_gallery = get_option( 'widget_media_gallery', array() );
+ $sidebars_widgets = wp_get_sidebars_widgets();
+
+ // Array to store legacy widget ids in to unregister on success.
+ $widgets_to_unregister = array();
+
+ $old_widgets = array_filter( $old_widgets, 'jetpack_migrate_gallery_widget_is_importable' );
+ foreach ( $old_widgets as $id => $widget ) {
+ $new_id = $id;
+ // Try to get an unique id for the new type of widget.
+ // It may be the case that the user has already created a core Gallery Widget
+ // before the migration begins. (Maybe Jetpack was deactivated during core's upgrade).
+ for( $i = 0; $i < 10 && in_array( $new_id, array_keys( $media_gallery ) ); $i++, $new_id++ );
+
+ $widget_copy = jetpack_migrate_gallery_widget_upgrade_widget( $widget );
+
+ if ( null === $widget_copy ) {
+ jetpack_migrate_gallery_widget_bump_stats( 'gallery-widget-skipped' );
+ continue;
+ }
+
+ $media_gallery[ $new_id ] = $widget_copy;
+
+ $sidebars_widgets = jetpack_migrate_gallery_widget_update_sidebars( $sidebars_widgets, $id, $new_id );
+
+ $widgets_to_unregister[ $id ] = $new_id;
+ }
+
+ if ( update_option( 'widget_media_gallery', $media_gallery ) ) {
+
+ // Now un-register old widgets and register new.
+ foreach ( $widgets_to_unregister as $id => $new_id ) {
+ wp_unregister_sidebar_widget( "gallery-${id}" );
+
+ // register new widget.
+ $media_gallery_widget = new WP_Widget_Media_Gallery();
+ $media_gallery_widget->_set( $new_id );
+ $media_gallery_widget->_register_one( $new_id );
+ }
+
+ wp_set_sidebars_widgets( $sidebars_widgets );
+
+ // Log if we migrated all, or some for this site.
+ foreach ( $widgets_to_unregister as $w ) {
+ jetpack_migrate_gallery_widget_bump_stats( 'gallery-widget-migrated' );
+ }
+
+ // We need to refresh on widgets page for changes to take effect.
+ // The jetpack_refresh_on_widget_page function is already defined in migrate-to-core/image-widget.php
+ add_action( 'current_screen', 'jetpack_refresh_on_widget_page' );
+ }
+ Jetpack_Options::update_option( 'gallery_widget_migration', true );
+}
+
+function jetpack_migrate_gallery_widget_is_importable( $widget ) {
+ // Can be caused by instantiating but not populating a widget in the Customizer.
+ if ( empty( $widget ) ) {
+ return false;
+ }
+ // The array as stored in the option constains two keys and one
+ // is a string `_multiwidget` which does not represent a widget, so we skip it
+ if ( ! is_array( $widget ) ) {
+ return false;
+ }
+ return true;
+}
+
+/**
+ * Returns a transformed version of the Gallery Widget.
+ * Will return null if the widget is either empty, is not an array or has more keys than expected
+ *
+ * @param $widget One of the Jetpack Gallery widgets to be transformed into a new Core Media Gallery Widget
+ *
+ * @return array|null
+ */
+function jetpack_migrate_gallery_widget_upgrade_widget( $widget ) {
+ $whitelisted_keys = array(
+ 'ids' => '',
+ 'link' => '',
+ 'title' => '',
+ 'type' => '',
+ 'random' => '',
+ 'conditions' => '',
+ );
+
+ $default_data = array(
+ 'columns' => 3,
+ 'ids' => array(),
+ 'link_type' => '',
+ 'orderby_random' => false,
+ 'size' => 'thumbnail',
+ 'title' => '',
+ 'type' => '',
+ );
+
+ if ( ! jetpack_migrate_gallery_widget_is_importable( $widget ) ) {
+ return null;
+ }
+ // Ensure widget has no keys other than those expected.
+ // Not all widgets have conditions, so lets add it in.
+ $widget_copy = array_merge( array( 'conditions' => null ), $widget );
+ $non_whitelisted_keys = array_diff_key( $widget_copy, $whitelisted_keys );
+ if ( count( $non_whitelisted_keys ) > 0 ) {
+ jetpack_migrate_gallery_widget_bump_stats( 'extra-key' );
+
+ // Log the names of the keys not in our whitelist.
+ foreach ( $non_whitelisted_keys as $key => $value ) {
+ jetpack_migrate_gallery_widget_bump_stats( "extra-key-$key", "migration-extra-key" );
+ }
+ }
+
+ $widget_copy = array_merge( $default_data, $widget, array(
+ // ids in Jetpack's Gallery are a string of comma-separated values.
+ // Core's Media Gallery Widget stores ids in an array
+ 'ids' => explode( ',', $widget['ids'] ),
+ 'link_type' => $widget['link'],
+ 'orderby_random' => isset( $widget['random'] ) && $widget['random'] === 'on',
+ ) );
+
+ // Unsetting old widget fields
+ $widget_copy = array_diff_key( $widget_copy, array(
+ 'link' => false,
+ 'random' => false,
+ ) );
+
+ return $widget_copy;
+}
+
+/**
+ * Replaces the references to Jetpack Gallery Widget in the sidebars for references to the new version of the widget
+ *
+ * @param $sidebars_widgets The sidebar widgets array to update
+ * @param $id Old id of the widget (basically its index in the array )
+ * @param $new_id New id that will be using on the sidebar as a new widget
+ *
+ * @return mixed Updated sidebar widgets array
+ */
+function jetpack_migrate_gallery_widget_update_sidebars( $sidebars_widgets, $id, $new_id ) {
+ foreach ( $sidebars_widgets as $sidebar => $widgets ) {
+ if (
+ is_array( $widgets )
+ && false !== ( $key = array_search( "gallery-{$id}", $widgets, true ) )
+ ) {
+ $sidebars_widgets[ $sidebar ][ $key ] = "media_gallery-{$new_id}";
+ // Check if the inactive widgets sidebar exists
+ // Related: https://core.trac.wordpress.org/ticket/14893
+ if ( ! isset( $sidebars_widgets['wp_inactive_widgets'] ) || ! is_array( $sidebars_widgets['wp_inactive_widgets'] ) ) {
+ $sidebars_widgets['wp_inactive_widgets'] = array();
+ }
+ $sidebars_widgets['wp_inactive_widgets'][ $key ] = "gallery-{$id}";
+ }
+ }
+ return $sidebars_widgets;
+}
+
+/**
+ * Will bump stat in jetpack_gallery_widget_migration group.
+ *
+ * @param string $bin The bin to log into.
+ * @param string $group The group name. Defaults to "widget-migration".
+ */
+function jetpack_migrate_gallery_widget_bump_stats( $bin, $group = 'widget-migration' ) {
+ // If this is being run on .com bumps_stats_extra exists, but using the filter looks more elegant.
+ if ( function_exists( 'bump_stats_extras' ) ) {
+ $group = "jetpack-$group";
+ do_action( 'jetpack_bump_stats_extra', $group, $bin );
+ } else {
+ // $group is prepended with 'jetpack-'
+ $jetpack = Jetpack::init();
+ $jetpack->stat( $group, $bin ) ;
+ }
+
+}
+
+add_action( 'widgets_init', 'jetpack_migrate_gallery_widget' );
diff --git a/plugins/jetpack/modules/widgets/milestone/admin.js b/plugins/jetpack/modules/widgets/milestone/admin.js
new file mode 100644
index 00000000..bc7cdb2b
--- /dev/null
+++ b/plugins/jetpack/modules/widgets/milestone/admin.js
@@ -0,0 +1,25 @@
+( function( $ ) {
+ // We could either be in wp-admin/widgets.php or the customizer.
+ var $container = $( '#customize-controls' );
+
+ if ( ! $container.length ) {
+ $container = $( '#wpbody' );
+ }
+
+ $container.on( 'change', '.milestone-type', function() {
+ var $messageWrapper = $( this ).parent().find( '.milestone-message-wrapper' );
+
+ $( this ).find( 'input[type="radio"]:checked' ).val() === 'since' ? $messageWrapper.hide() : $messageWrapper.show();
+ } );
+
+ function triggerChange() {
+ $container.find( '.milestone-type' ).trigger( 'change' );
+ }
+
+ // Used when adding widget via customizer or saving settings.
+ $( document ).on( 'widget-added widget-updated', function() {
+ triggerChange();
+ } );
+
+ triggerChange();
+} )( jQuery );
diff --git a/plugins/jetpack/modules/widgets/milestone/milestone.js b/plugins/jetpack/modules/widgets/milestone/milestone.js
index 9dafafc2..01c761f1 100644
--- a/plugins/jetpack/modules/widgets/milestone/milestone.js
+++ b/plugins/jetpack/modules/widgets/milestone/milestone.js
@@ -2,54 +2,37 @@
var Milestone = ( function( $ ) {
var Milestone = function ( args ) {
- var num,
- labels = MilestoneConfig.labels;
-
- this.id = args.id;
- this.diff = args.diff;
- this.message = args.message;
- this.widget = $( '#' + this.id );
- this.widgetContent = this.widget.find( '.milestone-content' );
+ var $widget = $( '#' + args.id ),
+ id = args.id,
+ refresh = args.refresh * 1000;
this.timer = function() {
- this.diff = this.diff - 1;
-
- if ( 63113852 < this.diff ) { // more than 2 years - show in years, one decimal point
- num = ( this.diff / 60 / 60 / 24 / 365 ).toFixed( 1 );
- if ( 0 === num.charAt( num.length - 1 ) ) {
- num = Math.floor( num );
+ var instance = this;
+
+ $.ajax( {
+ url: MilestoneConfig.api_root + 'jetpack/v4/widgets/' + id,
+ success: function( result ) {
+ $widget.find( '.milestone-countdown' ).replaceWith( result.message );
+ refresh = result.refresh * 1000;
+
+ if ( ! refresh ) {
+ return;
+ }
+
+ setTimeout(
+ function() {
+ instance.timer();
+ },
+ refresh
+ );
}
- this.number = num;
- this.label = labels.years;
- } else if ( 7775999 < this.diff ) { // fewer than 2 years - show in months
- this.number = Math.floor( this.diff / 60 / 60 / 24 / 30 );
- this.label = ( 1 === this.number ) ? labels.month : labels.months;
- } else if ( 86399 < this.diff ) { // fewer than 3 months - show in days
- this.number = Math.floor( this.diff / 60 / 60 / 24 ) + 1;
- this.label = ( 1 === this.number ) ? labels.day : labels.days;
- } else if ( 3599 < this.diff ) { // less than 1 day - show in hours
- this.number = Math.floor( this.diff / 60 / 60 );
- this.label = ( 1 === this.number ) ? labels.hour : labels.hours;
- } else if ( 59 < this.diff ) { // less than 1 hour - show in minutes
- this.number = Math.floor( this.diff / 60 ) + 1;
- this.label = ( 1 === this.number ) ? labels.minute : labels.minutes;
- } else { // less than 1 minute - show in seconds
- this.number = this.diff;
- this.label = ( 1 === this.number ) ? labels.second : labels.seconds;
- }
-
- this.widget.find( '.difference' ).html( this.number );
- this.widget.find( '.label' ).html( this.label );
+ } );
- if ( 1 > this.diff ) {
- this.widget.find( '.milestone-countdown' ).replaceWith( '<div class="milestone-message">' + this.message + '</div>' );
- } else {
- var instance = this;
- setTimeout( function() { instance.timer(); }, 1000 );
- }
};
- this.timer();
+ if ( refresh > 0 ) {
+ this.timer();
+ }
};
return function ( args ) {
return new Milestone( args );
diff --git a/plugins/jetpack/modules/widgets/milestone/milestone.php b/plugins/jetpack/modules/widgets/milestone/milestone.php
index 98dea60a..2364d7fa 100644
--- a/plugins/jetpack/modules/widgets/milestone/milestone.php
+++ b/plugins/jetpack/modules/widgets/milestone/milestone.php
@@ -16,10 +16,22 @@ add_action( 'widgets_init', 'jetpack_register_widget_milestone' );
class Milestone_Widget extends WP_Widget {
private static $dir = null;
private static $url = null;
- private static $labels = null;
private static $defaults = null;
private static $config_js = null;
+ /**
+ * Available time units sorted in descending order.
+ * @var Array
+ */
+ protected $available_units = array(
+ 'years',
+ 'months',
+ 'days',
+ 'hours',
+ 'minutes',
+ 'seconds'
+ );
+
function __construct() {
$widget = array(
'classname' => 'milestone-widget',
@@ -35,20 +47,6 @@ class Milestone_Widget extends WP_Widget {
self::$dir = trailingslashit( dirname( __FILE__ ) );
self::$url = plugin_dir_url( __FILE__ );
- self::$labels = array(
- 'year' => __( 'year', 'jetpack' ),
- 'years' => __( 'years', 'jetpack' ),
- 'month' => __( 'month', 'jetpack' ),
- 'months' => __( 'months', 'jetpack' ),
- 'day' => __( 'day', 'jetpack' ),
- 'days' => __( 'days', 'jetpack' ),
- 'hour' => __( 'hour', 'jetpack' ),
- 'hours' => __( 'hours', 'jetpack' ),
- 'minute' => __( 'minute', 'jetpack' ),
- 'minutes' => __( 'minutes', 'jetpack' ),
- 'second' => __( 'second', 'jetpack' ),
- 'seconds' => __( 'seconds', 'jetpack' ),
- );
add_action( 'wp_enqueue_scripts', array( __class__, 'enqueue_template' ) );
add_action( 'admin_enqueue_scripts', array( __class__, 'enqueue_admin' ) );
@@ -62,6 +60,7 @@ class Milestone_Widget extends WP_Widget {
public static function enqueue_admin( $hook_suffix ) {
if ( 'widgets.php' == $hook_suffix ) {
wp_enqueue_style( 'milestone-admin', self::$url . 'style-admin.css', array(), '20161215' );
+ wp_enqueue_script( 'milestone-admin-js', self::$url . 'admin.js', array( 'jquery' ), '20170915', true );
}
}
@@ -162,88 +161,326 @@ class Milestone_Widget extends WP_Widget {
wp_dequeue_script( 'milestone' );
return;
}
- self::$config_js['labels'] = self::$labels;
+ self::$config_js['api_root'] = esc_url_raw( rest_url() );
wp_localize_script( 'milestone', 'MilestoneConfig', self::$config_js );
}
- /**
- * Widget
- */
- function widget( $args, $instance ) {
- $instance = $this->sanitize_instance( $instance );
-
- $milestone = mktime( $instance['hour'], $instance['min'], 0, $instance['month'], $instance['day'], $instance['year'] );
- $now = (int) current_time( 'timestamp' );
- $diff = (int) floor( $milestone - $now );
-
- $number = 0;
- $label = '';
-
- if ( 63113852 < $diff ) { // more than 2 years - show in years, one decimal point
- $number = round( $diff / 60 / 60 / 24 / 365, 1 );
- $label = self::$labels['years'];
- } else if ( 7775999 < $diff ) { // fewer than 2 years - show in months
- $number = floor( $diff / 60 / 60 / 24 / 30 );
- $label = ( 1 == $number ) ? self::$labels['month'] : self::$labels['months'];
- } else if ( 86399 < $diff ) { // fewer than 3 months - show in days
- $number = floor( $diff / 60 / 60 / 24 ) + 1;
- $label = ( 1 == $number ) ? self::$labels['day'] : self::$labels['days'];
- } else if ( 3599 < $diff ) { // less than 1 day - show in hours
- $number = floor( $diff / 60 / 60 );
- $label = ( 1 == $number ) ? self::$labels['hour'] : self::$labels['hours'];
- } else if ( 59 < $diff ) { // less than 1 hour - show in minutes
- $number = floor( $diff / 60 ) + 1;
- $label = ( 1 == $number ) ? self::$labels['minute'] : self::$labels['minutes'];
- } else { // less than 1 minute - show in seconds
- $number = $diff;
- $label = ( 1 == $number ) ? self::$labels['second'] : self::$labels['seconds'] ;
- }
-
+ /**
+ * Widget
+ */
+ function widget( $args, $instance ) {
echo $args['before_widget'];
+ /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', $instance['title'] );
if ( ! empty( $title ) ) {
echo $args['before_title'] . $title . $args['after_title'];
}
+ $data = $this->get_widget_data( $instance );
+
+ self::$config_js['instances'][] = array(
+ 'id' => $args['widget_id'],
+ 'message' => $data['message'],
+ 'refresh' => $data['refresh']
+ );
+
echo '<div class="milestone-content">';
echo '<div class="milestone-header">';
echo '<strong class="event">' . esc_html( $instance['event'] ) . '</strong>';
- echo '<span class="date">' . esc_html( date_i18n( __( 'F jS, Y', 'jetpack' ), $milestone ) ) . '</span>';
+ echo '<span class="date">' . esc_html( date_i18n( get_option( 'date_format' ), $data['milestone'] ) ) . '</span>';
echo '</div>';
- if ( 1 > $diff ) {
- /* Milestone has past. */
- echo '<div class="milestone-message">' . $instance['message'] . '</div>';
- } else {
- /* Countdown to the milestone. */
- echo '<div class="milestone-countdown">' . sprintf( __( '%1$s %2$s to go.', 'jetpack' ),
- '<span class="difference">' . esc_html( $number ) . '</span>',
- '<span class="label">' . esc_html( $label ) . '</span>'
- ) . '</div>';
-
- self::$config_js['instances'][] = array(
- 'id' => $args['widget_id'],
- 'diff' => $diff,
- 'message' => $instance['message'],
- );
- }
+ echo $data['message'];
echo '</div><!--milestone-content-->';
echo $args['after_widget'];
- /** This action is documented in modules/widgets/gravatar-profile.php */
- do_action( 'jetpack_stats_extra', 'widget_view', 'milestone' );
- }
+ /** This action is documented in modules/widgets/gravatar-profile.php */
+ do_action( 'jetpack_stats_extra', 'widget_view', 'milestone' );
+ }
+
+ function get_widget_data( $instance ) {
+ $data = array();
+
+ $instance = $this->sanitize_instance( $instance );
+
+ $milestone = mktime( $instance['hour'], $instance['min'], 0, $instance['month'], $instance['day'], $instance['year'] );
+ $now = (int) current_time( 'timestamp' );
+ $type = $instance['type'];
+
+ if ( 'since' === $type ) {
+ $diff = (int) floor( $now - $milestone );
+ } else {
+ $diff = (int) floor( $milestone - $now );
+ }
+
+ $data['diff'] = $diff;
+ $data['unit'] = $this->get_unit( $diff, $instance['unit'] );
+
+ // Setting the refresh counter to equal the number of seconds it takes to flip a unit
+ $refresh_intervals = array(
+ 0, // should be YEAR_IN_SECONDS, but doing setTimeout for a year doesn't seem to be logical
+ 0, // same goes for MONTH_IN_SECONDS,
+ DAY_IN_SECONDS,
+ HOUR_IN_SECONDS,
+ MINUTE_IN_SECONDS,
+ 1
+ );
+
+ $data['refresh'] = $refresh_intervals[ array_search( $data['unit'], $this->available_units ) ];
+ $data['milestone'] = $milestone;
+
+ if ( ( 1 > $diff ) && ( 'until' === $type ) ) {
+ $data['message'] = '<div class="milestone-message">' . $instance['message'] . '</div>';
+ $data['refresh'] = 0; // No need to refresh, the milestone has been reached
+ } else {
+ $interval_text = $this->get_interval_in_units( $diff, $data['unit'] );
+ $interval = intval( $interval_text );
+
+ if ( 'since' === $type ) {
+
+ switch ( $data['unit'] ) {
+ case 'years':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">year ago.</span>',
+ '<span class="difference">%s</span> <span class="label">years ago.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'months':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">month ago.</span>',
+ '<span class="difference">%s</span> <span class="label">months ago.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'days':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">day ago.</span>',
+ '<span class="difference">%s</span> <span class="label">days ago.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'hours':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">hour ago.</span>',
+ '<span class="difference">%s</span> <span class="label">hours ago.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'minutes':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">minute ago.</span>',
+ '<span class="difference">%s</span> <span class="label">minutes ago.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'seconds':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">second ago.</span>',
+ '<span class="difference">%s</span> <span class="label">seconds ago.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ }
+ } else {
+ switch ( $this->get_unit( $diff, $instance['unit'] ) ) {
+ case 'years':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">year to go.</span>',
+ '<span class="difference">%s</span> <span class="label">years to go.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'months':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">month to go.</span>',
+ '<span class="difference">%s</span> <span class="label">months to go.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'days':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">day to go.</span>',
+ '<span class="difference">%s</span> <span class="label">days to go.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'hours':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">hour to go.</span>',
+ '<span class="difference">%s</span> <span class="label">hours to go.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'minutes':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">minute to go.</span>',
+ '<span class="difference">%s</span> <span class="label">minutes to go.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ case 'seconds':
+ $data['message'] = sprintf(
+ _n(
+ '<span class="difference">%s</span> <span class="label">second to go.</span>',
+ '<span class="difference">%s</span> <span class="label">seconds to go.</span>',
+ $interval,
+ 'jetpack'
+ ),
+ $interval_text
+ );
+ break;
+ }
+ }
+ $data['message'] = '<div class="milestone-countdown">' . $data['message'] . '</div>';
+ }
+
+ return $data;
+ }
+
+ /**
+ * Return the largest possible time unit that the difference will be displayed in.
+ *
+ * @param Integer $seconds the interval in seconds
+ * @param String $maximum_unit the maximum unit that will be used. Optional.
+ * @return String $calculated_unit
+ */
+ protected function get_unit( $seconds, $maximum_unit = 'automatic' ) {
+ $unit = '';
+
+ if ( $seconds >= YEAR_IN_SECONDS * 2 ) {
+ // more than 2 years - show in years, one decimal point
+ $unit = 'years';
+
+ } else if ( $seconds >= YEAR_IN_SECONDS ) {
+ if ( 'years' === $maximum_unit ) {
+ $unit = 'years';
+ } else {
+ // automatic mode - showing months even if it's between one and two years
+ $unit = 'months';
+ }
+
+ } else if ( $seconds >= MONTH_IN_SECONDS * 3 ) {
+ // fewer than 2 years - show in months
+ $unit = 'months';
+
+ } else if ( $seconds >= MONTH_IN_SECONDS ) {
+ if ( 'months' === $maximum_unit ) {
+ $unit = 'months';
+ } else {
+ // automatic mode - showing days even if it's between one and three months
+ $unit = 'days';
+ }
+
+ } else if ( $seconds >= DAY_IN_SECONDS - 1 ) {
+ // fewer than a month - show in days
+ $unit = 'days';
+
+ } else if ( $seconds >= HOUR_IN_SECONDS - 1 ) {
+ // less than 1 day - show in hours
+ $unit = 'hours';
+
+ } else if ( $seconds >= MINUTE_IN_SECONDS - 1 ) {
+ // less than 1 hour - show in minutes
+ $unit = 'minutes';
+
+ } else {
+ // less than 1 minute - show in seconds
+ $unit = 'seconds';
+ }
+
+ $maximum_unit_index = array_search( $maximum_unit, $this->available_units );
+ $unit_index = array_search( $unit, $this->available_units );
+
+ if (
+ false === $maximum_unit_index // the maximum unit parameter is automatic
+ || $unit_index > $maximum_unit_index // there is not enough seconds for even one maximum time unit
+ ) {
+ return $unit;
+ }
+ return $maximum_unit;
+ }
+
+ /**
+ * Returns a time difference value in specified units.
+ *
+ * @param Integer $seconds
+ * @param String $units
+ * @return Integer|String $time_in_units
+ */
+ protected function get_interval_in_units( $seconds, $units ) {
+ switch ( $units ) {
+ case 'years':
+ $years = $seconds / YEAR_IN_SECONDS;
+ $decimals = abs( round( $years, 1 ) - round( $years ) ) > 0 ? 1 : 0;
+ return number_format_i18n( $years, $decimals );
+ case 'months':
+ return (int) ( $seconds / 60 / 60 / 24 / 30 );
+ case 'days':
+ return (int) ( $seconds / 60 / 60 / 24 + 1 );
+ case 'hours':
+ return (int) ( $seconds / 60 / 60 );
+ case 'minutes':
+ return (int) ( $seconds / 60 + 1 );
+ default:
+ return $seconds;
+ }
+ }
- /**
- * Update
- */
- function update( $new_instance, $old_instance ) {
+ /**
+ * Update
+ */
+ function update( $new_instance, $old_instance ) {
return $this->sanitize_instance( $new_instance );
- }
+ }
/*
* Make sure that a number is within a certain range.
@@ -278,6 +515,8 @@ class Milestone_Widget extends WP_Widget {
$dirty = wp_parse_args( $dirty, array(
'title' => '',
'event' => __( 'The Big Day', 'jetpack' ),
+ 'unit' => 'automatic',
+ 'type' => 'until',
'message' => __( 'The big day is here.', 'jetpack' ),
'day' => date( 'd', $now ),
'month' => date( 'm', $now ),
@@ -295,6 +534,8 @@ class Milestone_Widget extends WP_Widget {
$clean = array(
'title' => trim( strip_tags( stripslashes( $dirty['title'] ) ) ),
'event' => trim( strip_tags( stripslashes( $dirty['event'] ) ) ),
+ 'unit' => $dirty['unit'],
+ 'type' => $dirty['type'],
'message' => wp_kses( $dirty['message'], $allowed_tags ),
'year' => $this->sanitize_range( $dirty['year'], 1901, 2037 ),
'month' => $this->sanitize_range( $dirty['month'], 1, 12 ),
@@ -307,12 +548,20 @@ class Milestone_Widget extends WP_Widget {
return $clean;
}
- /**
- * Form
- */
- function form( $instance ) {
+ /**
+ * Form
+ */
+ function form( $instance ) {
$instance = $this->sanitize_instance( $instance );
- ?>
+
+ $units = array(
+ 'automatic' => _x( 'Automatic', 'Milestone widget: mode in which the date unit is determined automatically', 'jetpack' ),
+ 'years' => _x( 'Years', 'Milestone widget: mode in which the date unit is set to years', 'jetpack' ),
+ 'months' => _x( 'Months', 'Milestone widget: mode in which the date unit is set to months', 'jetpack' ),
+ 'days' => _x( 'Days', 'Milestone widget: mode in which the date unit is set to days', 'jetpack' ),
+ 'hours' => _x( 'Hours', 'Milestone widget: mode in which the date unit is set to hours', 'jetpack' ),
+ );
+ ?>
<div class="milestone-widget">
<p>
@@ -321,7 +570,7 @@ class Milestone_Widget extends WP_Widget {
</p>
<p>
- <label for="<?php echo $this->get_field_id( 'event' ); ?>"><?php _e( 'Event', 'jetpack' ); ?></label>
+ <label for="<?php echo $this->get_field_id( 'event' ); ?>"><?php _e( 'Description', 'jetpack' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'event' ); ?>" name="<?php echo $this->get_field_name( 'event' ); ?>" type="text" value="<?php echo esc_attr( $instance['event'] ); ?>" />
</p>
@@ -357,8 +606,48 @@ class Milestone_Widget extends WP_Widget {
<input id="<?php echo $this->get_field_id( 'min' ); ?>" class="minutes" name="<?php echo $this->get_field_name( 'min' ); ?>" type="text" value="<?php echo esc_attr( $instance['min'] ); ?>">
</fieldset>
- <p>
- <label for="<?php echo $this->get_field_id( 'message' ); ?>"><?php _e( 'Message', 'jetpack' ); ?></label>
+ <fieldset class="jp-ms-data-unit">
+ <legend><?php esc_html_e( 'Time Unit', 'jetpack' ); ?></legend>
+
+ <label for="<?php echo $this->get_field_id( 'unit' ); ?>" class="assistive-text">
+ <?php _e( 'Time Unit', 'jetpack' ); ?>
+ </label>
+ <select id="<?php echo $this->get_field_id( 'unit' ); ?>" class="unit" name="<?php echo $this->get_field_name( 'unit' ); ?>">
+ <?php
+ foreach ( $units as $key => $unit ) {
+ echo '<option value="' . esc_attr( $key ) . '"' . selected( $key, $instance['unit'], false ) . '>' . $unit . '</option>';
+ }
+ ?></select>
+ </fieldset>
+
+ <ul class="milestone-type">
+ <li>
+ <label>
+ <input
+ <?php checked( $instance['type'], 'until' ); ?>
+ name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>"
+ type="radio"
+ value="until"
+ />
+ <?php esc_html_e( 'Until your milestone', 'jetpack' ); ?>
+ </label>
+ </li>
+
+ <li>
+ <label>
+ <input
+ <?php checked( $instance['type'], 'since' ); ?>
+ name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>"
+ type="radio"
+ value="since"
+ />
+ <?php esc_html_e( 'Since your milestone', 'jetpack' ); ?>
+ </label>
+ </li>
+ </ul>
+
+ <p class="milestone-message-wrapper">
+ <label for="<?php echo $this->get_field_id( 'message' ); ?>"><?php _e( 'Milestone Reached Message', 'jetpack' ); ?></label>
<textarea id="<?php echo $this->get_field_id( 'message' ); ?>" name="<?php echo $this->get_field_name( 'message' ); ?>" class="widefat" rows="3"><?php echo esc_textarea( $instance['message'] ); ?></textarea>
</p>
</div>
diff --git a/plugins/jetpack/modules/widgets/milestone/style-admin.css b/plugins/jetpack/modules/widgets/milestone/style-admin.css
index 28b3183e..15a97102 100644
--- a/plugins/jetpack/modules/widgets/milestone/style-admin.css
+++ b/plugins/jetpack/modules/widgets/milestone/style-admin.css
@@ -30,7 +30,8 @@
width: 4.5em;
}
-.jp-ms-data-time .assistive-text {
+.jp-ms-data-time .assistive-text,
+.jp-ms-data-unit .assistive-text {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
@@ -46,4 +47,4 @@
.jp-ms-data-time .year[type="text"] {
width: 4em;
}
-} \ No newline at end of file
+}
diff --git a/plugins/jetpack/modules/widgets/social-media-icons.php b/plugins/jetpack/modules/widgets/social-media-icons.php
index 2ca60f61..8d51ae0a 100644
--- a/plugins/jetpack/modules/widgets/social-media-icons.php
+++ b/plugins/jetpack/modules/widgets/social-media-icons.php
@@ -255,7 +255,7 @@ class WPCOM_social_media_icons_widget extends WP_Widget {
<p>
<label for="<?php echo esc_attr( $this->get_field_id( $service . '_username' ) ); ?>">
<?php
- /* Translators: %s is a social network name, e.g. Facebook. */
+ /* translators: %s is a social network name, e.g. Facebook. */
printf( __( '%s username:', 'jetpack' ), $service_name );
?>
</label>
diff --git a/plugins/jetpack/modules/widgets/top-posts.php b/plugins/jetpack/modules/widgets/top-posts.php
index 8b4e7178..0178d111 100644
--- a/plugins/jetpack/modules/widgets/top-posts.php
+++ b/plugins/jetpack/modules/widgets/top-posts.php
@@ -64,6 +64,9 @@ class Jetpack_Top_Posts_Widget extends WP_Widget {
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $this->defaults() );
+ if ( false === $instance['title'] ) {
+ $instance['title'] = $this->default_title;
+ }
$title = stripslashes( $instance['title'] );
$count = isset( $instance['count'] ) ? (int) $instance['count'] : 10;