From 73ce9c10188ce4f5014c97ad4c0f8c9f69410113 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Tue, 12 Dec 2017 20:29:44 -0500 Subject: Update jetpack 5.6 Signed-off-by: Anthony G. Basile --- plugins/jetpack/_inc/accessible-focus.js | 19 - plugins/jetpack/_inc/build/accessible-focus.min.js | 2 + plugins/jetpack/_inc/build/admin.dops-style.css | 8 - .../jetpack/_inc/build/admin.dops-style.rtl.css | 8 - plugins/jetpack/_inc/build/admin.js | 87 +-- plugins/jetpack/_inc/build/facebook-embed.min.js | 3 + plugins/jetpack/_inc/build/gallery-settings.min.js | 5 + plugins/jetpack/_inc/build/idc-notice.min.js | 3 + plugins/jetpack/_inc/build/jetpack-admin.min.js | 2 + .../_inc/build/jetpack-connection-banner.min.js | 3 + plugins/jetpack/_inc/build/jetpack-jitm.min.js | 2 + plugins/jetpack/_inc/build/jetpack-modules.min.js | 2 + .../_inc/build/jetpack-modules.models.min.js | 2 + .../_inc/build/jetpack-modules.views.min.js | 2 + .../_inc/build/jquery.jetpack-resize.min.js | 24 + plugins/jetpack/_inc/build/jquery.spin.min.js | 6 + plugins/jetpack/_inc/build/postmessage.min.js | 25 + .../_inc/build/shortcodes/js/brightcove.min.js | 3 + .../jetpack/_inc/build/shortcodes/js/gist.min.js | 2 + .../_inc/build/shortcodes/js/instagram.min.js | 3 + .../_inc/build/shortcodes/js/jmpress.min.js | 21 + .../jetpack/_inc/build/shortcodes/js/main.min.js | 2 + .../jetpack/_inc/build/shortcodes/js/quiz.min.js | 2 + .../build/shortcodes/js/recipes-printthis.min.js | 42 ++ .../_inc/build/shortcodes/js/recipes.min.js | 3 + .../build/shortcodes/js/slideshow-shortcode.min.js | 4 + plugins/jetpack/_inc/build/spin.min.js | 7 + plugins/jetpack/_inc/build/static-ie-notice.html | 2 +- .../jetpack/_inc/build/static-noscript-notice.html | 2 +- .../jetpack/_inc/build/static-version-notice.html | 2 +- plugins/jetpack/_inc/build/static.html | 2 +- plugins/jetpack/_inc/build/style.min.css | 2 +- plugins/jetpack/_inc/build/style.min.rtl.css | 2 +- plugins/jetpack/_inc/build/twitter-timeline.min.js | 3 + plugins/jetpack/_inc/facebook-embed.js | 36 - plugins/jetpack/_inc/fonts/jetpack/jetpack.eot | Bin 1860 -> 1654 bytes plugins/jetpack/_inc/fonts/jetpack/jetpack.svg | 23 +- plugins/jetpack/_inc/fonts/jetpack/jetpack.ttf | Bin 1688 -> 1480 bytes plugins/jetpack/_inc/fonts/jetpack/jetpack.woff | Bin 1172 -> 1056 bytes plugins/jetpack/_inc/gallery-settings.js | 33 - plugins/jetpack/_inc/idc-notice.js | 231 ------- plugins/jetpack/_inc/jetpack-admin.js | 58 -- plugins/jetpack/_inc/jetpack-connection-banner.js | 89 --- plugins/jetpack/_inc/jetpack-jitm.js | 81 --- plugins/jetpack/_inc/jetpack-modules.js | 71 -- plugins/jetpack/_inc/jetpack-modules.models.js | 72 -- plugins/jetpack/_inc/jetpack-modules.views.js | 62 -- plugins/jetpack/_inc/jetpack-strings.php | 760 +++++++++++---------- plugins/jetpack/_inc/jquery.jetpack-resize.js | 285 -------- plugins/jetpack/_inc/jquery.spin.js | 104 --- .../lib/admin-pages/class.jetpack-react-page.php | 2 +- .../admin-pages/class.jetpack-settings-page.php | 7 +- .../jetpack-wpes-query-parser.php | 4 +- plugins/jetpack/_inc/postmessage.js | 438 ------------ plugins/jetpack/_inc/spin.js | 349 ---------- plugins/jetpack/_inc/twitter-timeline.js | 10 - plugins/jetpack/bin/partner-provision.sh | 16 +- plugins/jetpack/changelog.txt | 82 +++ plugins/jetpack/class.jetpack-cli.php | 85 ++- .../jetpack/class.jetpack-connection-banner.php | 73 +- plugins/jetpack/class.jetpack-debugger.php | 5 +- plugins/jetpack/class.jetpack-idc.php | 10 +- plugins/jetpack/class.jetpack-jitm.php | 8 +- .../jetpack/class.jetpack-modules-list-table.php | 15 +- plugins/jetpack/class.jetpack.php | 101 ++- plugins/jetpack/class.json-api-endpoints.php | 5 + plugins/jetpack/class.photon.php | 32 +- plugins/jetpack/css/dashboard-widget-rtl.css | 26 +- plugins/jetpack/css/dashboard-widget-rtl.css.map | 2 +- plugins/jetpack/css/dashboard-widget-rtl.min.css | 2 +- plugins/jetpack/css/dashboard-widget.css | 26 +- plugins/jetpack/css/dashboard-widget.css.map | 2 +- plugins/jetpack/css/dashboard-widget.min.css | 2 +- plugins/jetpack/css/jetpack-admin-jitm-rtl.css | 2 +- plugins/jetpack/css/jetpack-admin-jitm-rtl.css.map | 2 +- plugins/jetpack/css/jetpack-admin-jitm-rtl.min.css | 2 +- plugins/jetpack/css/jetpack-admin-jitm.css | 2 +- plugins/jetpack/css/jetpack-admin-jitm.css.map | 2 +- plugins/jetpack/css/jetpack-admin-jitm.min.css | 2 +- plugins/jetpack/css/jetpack-banners-rtl.css | 4 +- plugins/jetpack/css/jetpack-banners-rtl.css.map | 2 +- plugins/jetpack/css/jetpack-banners-rtl.min.css | 2 +- plugins/jetpack/css/jetpack-banners.css | 4 +- plugins/jetpack/css/jetpack-banners.css.map | 2 +- plugins/jetpack/css/jetpack-banners.min.css | 2 +- plugins/jetpack/css/jetpack-icons-rtl.css | 2 +- plugins/jetpack/css/jetpack-icons-rtl.css.map | 2 +- plugins/jetpack/css/jetpack-icons-rtl.min.css | 2 +- plugins/jetpack/css/jetpack-icons.css | 2 +- plugins/jetpack/css/jetpack-icons.css.map | 2 +- plugins/jetpack/css/jetpack-icons.min.css | 2 +- plugins/jetpack/css/jetpack-idc-rtl.css | 2 +- plugins/jetpack/css/jetpack-idc-rtl.css.map | 2 +- plugins/jetpack/css/jetpack-idc-rtl.min.css | 2 +- plugins/jetpack/css/jetpack-idc.css | 2 +- plugins/jetpack/css/jetpack-idc.css.map | 2 +- plugins/jetpack/css/jetpack-idc.min.css | 2 +- plugins/jetpack/css/jetpack-rtl.css | 3 + plugins/jetpack/css/jetpack.css | 3 + plugins/jetpack/functions.gallery.php | 7 +- plugins/jetpack/functions.opengraph.php | 2 +- plugins/jetpack/jetpack.php | 4 +- plugins/jetpack/json-endpoints.php | 11 + ...ss.wpcom-json-api-bulk-delete-post-endpoint.php | 3 +- ...s.wpcom-json-api-bulk-restore-post-endpoint.php | 3 +- ....wpcom-json-api-get-comment-counts-endpoint.php | 74 ++ ...wpcom-json-api-get-comment-history-endpoint.php | 53 ++ ...om-json-api-get-comments-tree-v1-2-endpoint.php | 148 ++++ ....wpcom-json-api-site-settings-v1-3-endpoint.php | 8 +- ....wpcom-json-api-site-settings-v1-4-endpoint.php | 131 ++++ ...ss.wpcom-json-api-update-post-v1-2-endpoint.php | 3 + ...etpack-json-api-check-capabilities-endpoint.php | 3 +- ...s.jetpack-json-api-get-user-backup-endpoint.php | 2 +- ...ss.jetpack-json-api-plugins-modify-endpoint.php | 2 +- ...tpack-json-api-plugins-modify-v1-2-endpoint.php | 2 +- ...ass.jetpack-json-api-themes-active-endpoint.php | 3 +- .../jetpack/json-api-jetpack-endpoints.php | 2 +- plugins/jetpack/languages/jetpack-bg_BG.mo | Bin 248119 -> 217457 bytes plugins/jetpack/languages/jetpack-gl_ES.mo | Bin 287567 -> 34160 bytes plugins/jetpack/languages/jetpack-pl_PL.mo | Bin 141784 -> 44189 bytes plugins/jetpack/languages/json/jetpack-ar.json | 2 +- plugins/jetpack/languages/json/jetpack-bg_BG.json | 2 +- plugins/jetpack/languages/json/jetpack-de_DE.json | 2 +- .../languages/json/jetpack-de_DE_formal.json | 2 +- plugins/jetpack/languages/json/jetpack-el.json | 2 +- plugins/jetpack/languages/json/jetpack-en_AU.json | 2 +- plugins/jetpack/languages/json/jetpack-en_CA.json | 2 +- plugins/jetpack/languages/json/jetpack-en_GB.json | 2 +- plugins/jetpack/languages/json/jetpack-en_NZ.json | 2 +- plugins/jetpack/languages/json/jetpack-eo.json | 2 +- plugins/jetpack/languages/json/jetpack-es_AR.json | 2 +- plugins/jetpack/languages/json/jetpack-es_CL.json | 2 +- plugins/jetpack/languages/json/jetpack-es_CR.json | 1 - plugins/jetpack/languages/json/jetpack-es_ES.json | 2 +- plugins/jetpack/languages/json/jetpack-es_VE.json | 2 +- plugins/jetpack/languages/json/jetpack-fa_IR.json | 2 +- plugins/jetpack/languages/json/jetpack-fi.json | 2 +- plugins/jetpack/languages/json/jetpack-fr_BE.json | 2 +- plugins/jetpack/languages/json/jetpack-fr_FR.json | 2 +- plugins/jetpack/languages/json/jetpack-gl_ES.json | 2 +- plugins/jetpack/languages/json/jetpack-he_IL.json | 2 +- plugins/jetpack/languages/json/jetpack-hr.json | 2 +- plugins/jetpack/languages/json/jetpack-id_ID.json | 2 +- plugins/jetpack/languages/json/jetpack-it_IT.json | 2 +- plugins/jetpack/languages/json/jetpack-ja.json | 2 +- plugins/jetpack/languages/json/jetpack-ko_KR.json | 2 +- plugins/jetpack/languages/json/jetpack-nl_NL.json | 2 +- .../languages/json/jetpack-nl_NL_formal.json | 2 +- plugins/jetpack/languages/json/jetpack-pl_PL.json | 2 +- plugins/jetpack/languages/json/jetpack-pt_BR.json | 2 +- plugins/jetpack/languages/json/jetpack-ro_RO.json | 2 +- plugins/jetpack/languages/json/jetpack-ru_RU.json | 2 +- plugins/jetpack/languages/json/jetpack-sk_SK.json | 2 +- plugins/jetpack/languages/json/jetpack-sq.json | 2 +- plugins/jetpack/languages/json/jetpack-sv_SE.json | 2 +- plugins/jetpack/languages/json/jetpack-tr_TR.json | 2 +- plugins/jetpack/languages/json/jetpack-zh_CN.json | 2 +- plugins/jetpack/languages/json/jetpack-zh_HK.json | 2 +- plugins/jetpack/languages/json/jetpack-zh_TW.json | 2 +- plugins/jetpack/modules/comment-likes.php | 19 +- .../css/editor-inline-editing-style-rtl.css | 25 - .../css/editor-inline-editing-style-rtl.min.css | 2 +- .../css/editor-inline-editing-style.min.css | 2 +- .../modules/contact-form/css/editor-style-rtl.css | 24 - .../contact-form/css/editor-style-rtl.min.css | 2 +- .../modules/contact-form/css/editor-style.min.css | 2 +- .../modules/custom-css/csstidy/data-wp.inc.php | 11 + .../classes/wp-google-analytics-legacy.php | 256 +++++++ .../classes/wp-google-analytics-options.php | 70 ++ .../classes/wp-google-analytics-universal.php | 412 +++++++++++ .../classes/wp-google-analytics-utils.php | 63 ++ .../google-analytics/wp-google-analytics.php | 305 +-------- plugins/jetpack/modules/lazy-images.php | 27 + .../modules/lazy-images/images/1x1.trans.gif | Bin 0 -> 42 bytes .../jetpack/modules/lazy-images/js/lazy-images.js | 157 +++++ .../jetpack/modules/lazy-images/lazy-images.php | 180 +++++ plugins/jetpack/modules/likes.php | 19 +- .../modules/likes/jetpack-likes-master-iframe.php | 2 +- plugins/jetpack/modules/likes/queuehandler.js | 2 +- plugins/jetpack/modules/masterbar.php | 9 - plugins/jetpack/modules/masterbar/masterbar.php | 25 +- plugins/jetpack/modules/masterbar/overrides.css | 5 + plugins/jetpack/modules/masterbar/tracks-events.js | 8 +- plugins/jetpack/modules/module-headings.php | 21 +- plugins/jetpack/modules/protect.php | 148 ++-- .../jetpack/modules/protect/blocked-login-page.php | 337 +++++++++ .../jetpack/modules/protect/jetpack-security.png | Bin 0 -> 12131 bytes plugins/jetpack/modules/publicize/ui.php | 2 +- plugins/jetpack/modules/pwa.php | 42 ++ .../modules/pwa/class.jetpack-pwa-helpers.php | 64 ++ .../modules/pwa/class.jetpack-pwa-manifest.php | 95 +++ plugins/jetpack/modules/pwa/images/wp-192.png | Bin 0 -> 6584 bytes plugins/jetpack/modules/pwa/images/wp-512.png | Bin 0 -> 16496 bytes .../related-posts/jetpack-related-posts.php | 2 +- .../modules/search/class.jetpack-search.php | 124 +++- .../jetpack/modules/sharedaddy/sharing-sources.php | 3 +- plugins/jetpack/modules/sharedaddy/sharing.js | 10 +- plugins/jetpack/modules/shortcodes/brightcove.php | 8 +- .../class.filter-embedded-html-objects.php | 2 +- plugins/jetpack/modules/shortcodes/gist.php | 8 +- plugins/jetpack/modules/shortcodes/googleplus.php | 2 +- plugins/jetpack/modules/shortcodes/instagram.php | 8 +- plugins/jetpack/modules/shortcodes/js/jmpress.js | 13 +- .../jetpack/modules/shortcodes/js/jmpress.min.js | 13 - .../jetpack/modules/shortcodes/presentations.php | 16 +- plugins/jetpack/modules/shortcodes/quiz.php | 8 +- plugins/jetpack/modules/shortcodes/recipe.php | 15 +- plugins/jetpack/modules/shortcodes/slideshow.php | 8 +- .../modules/simple-payments/simple-payments.php | 2 +- .../jetpack/modules/sitemaps/sitemap-builder.php | 3 +- .../jetpack/modules/sitemaps/sitemap-librarian.php | 2 + .../jetpack/modules/sitemaps/sitemap-logger.php | 14 +- plugins/jetpack/modules/stats.php | 25 +- .../theme-tools/content-options/blog-display.php | 2 +- .../modules/theme-tools/responsive-videos.php | 12 + plugins/jetpack/modules/wordads/php/params.php | 29 + plugins/jetpack/modules/wordads/wordads.php | 16 +- plugins/jetpack/readme.txt | 49 +- plugins/jetpack/scss/jetpack-icons.scss | 2 +- plugins/jetpack/scss/organisms/_banners.scss | 8 +- .../jetpack/sync/class.jetpack-sync-functions.php | 7 +- .../sync/class.jetpack-sync-module-callables.php | 29 +- .../sync/class.jetpack-sync-module-plugins.php | 2 +- .../sync/class.jetpack-sync-module-posts.php | 7 +- .../sync/class.jetpack-sync-module-protect.php | 23 +- .../sync/class.jetpack-sync-module-users.php | 28 +- .../jetpack/sync/class.jetpack-sync-modules.php | 2 + plugins/jetpack/webpack.config.js | 60 +- 228 files changed, 3889 insertions(+), 3119 deletions(-) delete mode 100644 plugins/jetpack/_inc/accessible-focus.js create mode 100644 plugins/jetpack/_inc/build/accessible-focus.min.js create mode 100644 plugins/jetpack/_inc/build/facebook-embed.min.js create mode 100644 plugins/jetpack/_inc/build/gallery-settings.min.js create mode 100644 plugins/jetpack/_inc/build/idc-notice.min.js create mode 100644 plugins/jetpack/_inc/build/jetpack-admin.min.js create mode 100644 plugins/jetpack/_inc/build/jetpack-connection-banner.min.js create mode 100644 plugins/jetpack/_inc/build/jetpack-jitm.min.js create mode 100644 plugins/jetpack/_inc/build/jetpack-modules.min.js create mode 100644 plugins/jetpack/_inc/build/jetpack-modules.models.min.js create mode 100644 plugins/jetpack/_inc/build/jetpack-modules.views.min.js create mode 100644 plugins/jetpack/_inc/build/jquery.jetpack-resize.min.js create mode 100644 plugins/jetpack/_inc/build/jquery.spin.min.js create mode 100644 plugins/jetpack/_inc/build/postmessage.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/brightcove.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/gist.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/instagram.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/jmpress.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/main.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/quiz.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/recipes-printthis.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/recipes.min.js create mode 100644 plugins/jetpack/_inc/build/shortcodes/js/slideshow-shortcode.min.js create mode 100644 plugins/jetpack/_inc/build/spin.min.js create mode 100644 plugins/jetpack/_inc/build/twitter-timeline.min.js delete mode 100644 plugins/jetpack/_inc/facebook-embed.js delete mode 100644 plugins/jetpack/_inc/gallery-settings.js delete mode 100644 plugins/jetpack/_inc/idc-notice.js delete mode 100644 plugins/jetpack/_inc/jetpack-admin.js delete mode 100644 plugins/jetpack/_inc/jetpack-connection-banner.js delete mode 100644 plugins/jetpack/_inc/jetpack-jitm.js delete mode 100644 plugins/jetpack/_inc/jetpack-modules.js delete mode 100644 plugins/jetpack/_inc/jetpack-modules.models.js delete mode 100644 plugins/jetpack/_inc/jetpack-modules.views.js delete mode 100644 plugins/jetpack/_inc/jquery.jetpack-resize.js delete mode 100644 plugins/jetpack/_inc/jquery.spin.js delete mode 100644 plugins/jetpack/_inc/postmessage.js delete mode 100644 plugins/jetpack/_inc/spin.js delete mode 100644 plugins/jetpack/_inc/twitter-timeline.js create mode 100644 plugins/jetpack/json-endpoints/class.wpcom-json-api-get-comment-counts-endpoint.php create mode 100644 plugins/jetpack/json-endpoints/class.wpcom-json-api-get-comment-history-endpoint.php create mode 100644 plugins/jetpack/json-endpoints/class.wpcom-json-api-get-comments-tree-v1-2-endpoint.php create mode 100644 plugins/jetpack/json-endpoints/class.wpcom-json-api-site-settings-v1-4-endpoint.php delete mode 100644 plugins/jetpack/languages/json/jetpack-es_CR.json create mode 100644 plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-legacy.php create mode 100644 plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-options.php create mode 100644 plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-universal.php create mode 100644 plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-utils.php create mode 100644 plugins/jetpack/modules/lazy-images.php create mode 100644 plugins/jetpack/modules/lazy-images/images/1x1.trans.gif create mode 100644 plugins/jetpack/modules/lazy-images/js/lazy-images.js create mode 100644 plugins/jetpack/modules/lazy-images/lazy-images.php create mode 100644 plugins/jetpack/modules/protect/blocked-login-page.php create mode 100644 plugins/jetpack/modules/protect/jetpack-security.png create mode 100644 plugins/jetpack/modules/pwa.php create mode 100644 plugins/jetpack/modules/pwa/class.jetpack-pwa-helpers.php create mode 100644 plugins/jetpack/modules/pwa/class.jetpack-pwa-manifest.php create mode 100644 plugins/jetpack/modules/pwa/images/wp-192.png create mode 100644 plugins/jetpack/modules/pwa/images/wp-512.png delete mode 100644 plugins/jetpack/modules/shortcodes/js/jmpress.min.js diff --git a/plugins/jetpack/_inc/accessible-focus.js b/plugins/jetpack/_inc/accessible-focus.js deleted file mode 100644 index 44608c2b..00000000 --- a/plugins/jetpack/_inc/accessible-focus.js +++ /dev/null @@ -1,19 +0,0 @@ -var keyboardNavigation = false, - keyboardNavigationKeycodes = [ 9, 32, 37, 38, 39, 40 ]; // keyCodes for tab, space, left, up, right, down respectively - -document.addEventListener( 'keydown', function( event ) { - if ( keyboardNavigation ) { - return; - } - if ( keyboardNavigationKeycodes.indexOf( event.keyCode ) !== -1 ) { - keyboardNavigation = true; - document.documentElement.classList.add( 'accessible-focus' ); - } -} ); -document.addEventListener( 'mouseup', function() { - if ( ! keyboardNavigation ) { - return; - } - keyboardNavigation = false; - document.documentElement.classList.remove( 'accessible-focus' ); -} ); diff --git a/plugins/jetpack/_inc/build/accessible-focus.min.js b/plugins/jetpack/_inc/build/accessible-focus.min.js new file mode 100644 index 00000000..0c394f6a --- /dev/null +++ b/plugins/jetpack/_inc/build/accessible-focus.min.js @@ -0,0 +1,2 @@ +/* Do not modify this file directly. It is compiled from other files. */ +var keyboardNavigation=!1,keyboardNavigationKeycodes=[9,32,37,38,39,40];document.addEventListener("keydown",function(e){keyboardNavigation||-1!==keyboardNavigationKeycodes.indexOf(e.keyCode)&&(keyboardNavigation=!0,document.documentElement.classList.add("accessible-focus"))}),document.addEventListener("mouseup",function(){keyboardNavigation&&(keyboardNavigation=!1,document.documentElement.classList.remove("accessible-focus"))}); \ No newline at end of file diff --git a/plugins/jetpack/_inc/build/admin.dops-style.css b/plugins/jetpack/_inc/build/admin.dops-style.css index 9d1126a2..035ef3f4 100644 --- a/plugins/jetpack/_inc/build/admin.dops-style.css +++ b/plugins/jetpack/_inc/build/admin.dops-style.css @@ -932,8 +932,6 @@ background-color: white; transition: all .15s ease-in-out; box-shadow: none; } - .dops-text-input.dops-text-input::-webkit-input-placeholder { - color: #87a6bc; } .dops-text-input.dops-text-input:-ms-input-placeholder { color: #87a6bc; } .dops-text-input.dops-text-input::placeholder { @@ -953,8 +951,6 @@ -webkit-text-fill-color: #a8bece; } .dops-text-input.dops-text-input:disabled:hover { cursor: default; } - .dops-text-input.dops-text-input:disabled::-webkit-input-placeholder { - color: #a8bece; } .dops-text-input.dops-text-input:disabled:-ms-input-placeholder { color: #a8bece; } .dops-text-input.dops-text-input:disabled::placeholder { @@ -2078,8 +2074,6 @@ button.dops-foldable-card__action { background-color: white; transition: all .15s ease-in-out; box-shadow: none; } - .dops-textarea::-webkit-input-placeholder { - color: #87a6bc; } .dops-textarea:-ms-input-placeholder { color: #87a6bc; } .dops-textarea::placeholder { @@ -2099,8 +2093,6 @@ button.dops-foldable-card__action { -webkit-text-fill-color: #a8bece; } .dops-textarea:disabled:hover { cursor: default; } - .dops-textarea:disabled::-webkit-input-placeholder { - color: #a8bece; } .dops-textarea:disabled:-ms-input-placeholder { color: #a8bece; } .dops-textarea:disabled::placeholder { diff --git a/plugins/jetpack/_inc/build/admin.dops-style.rtl.css b/plugins/jetpack/_inc/build/admin.dops-style.rtl.css index 90ad707a..b6271ad6 100644 --- a/plugins/jetpack/_inc/build/admin.dops-style.rtl.css +++ b/plugins/jetpack/_inc/build/admin.dops-style.rtl.css @@ -931,8 +931,6 @@ background-color: white; transition: all .15s ease-in-out; box-shadow: none; } - .dops-text-input.dops-text-input::-webkit-input-placeholder { - color: #87a6bc; } .dops-text-input.dops-text-input:-ms-input-placeholder { color: #87a6bc; } .dops-text-input.dops-text-input::placeholder { @@ -952,8 +950,6 @@ -webkit-text-fill-color: #a8bece; } .dops-text-input.dops-text-input:disabled:hover { cursor: default; } - .dops-text-input.dops-text-input:disabled::-webkit-input-placeholder { - color: #a8bece; } .dops-text-input.dops-text-input:disabled:-ms-input-placeholder { color: #a8bece; } .dops-text-input.dops-text-input:disabled::placeholder { @@ -2077,8 +2073,6 @@ button.dops-foldable-card__action { background-color: white; transition: all .15s ease-in-out; box-shadow: none; } - .dops-textarea::-webkit-input-placeholder { - color: #87a6bc; } .dops-textarea:-ms-input-placeholder { color: #87a6bc; } .dops-textarea::placeholder { @@ -2098,8 +2092,6 @@ button.dops-foldable-card__action { -webkit-text-fill-color: #a8bece; } .dops-textarea:disabled:hover { cursor: default; } - .dops-textarea:disabled::-webkit-input-placeholder { - color: #a8bece; } .dops-textarea:disabled:-ms-input-placeholder { color: #a8bece; } .dops-textarea:disabled::placeholder { diff --git a/plugins/jetpack/_inc/build/admin.js b/plugins/jetpack/_inc/build/admin.js index 206adb4b..eb7e4720 100644 --- a/plugins/jetpack/_inc/build/admin.js +++ b/plugins/jetpack/_inc/build/admin.js @@ -1,40 +1,49 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var a=n(1),o=r(a),i=n(142),s=r(i),c=n(154),l=n(189),u=n(250),d=n(255),p=n(276),f=(r(p),n(318)),h=r(f),m=n(319),_=r(m),M=n(524),g=r(M),v=n(753),b=r(v),y=n(464);!function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);t.default=e}(y);(0,h.default)();var A=window.Initial_State;A.locale=JSON.parse(A.locale),void 0!==A.locale[""]?(A.locale[""].localeSlug=A.localeSlug,Number.prototype.realToLocaleString=Number.prototype.toLocaleString,Number.prototype.toLocaleString=function(e,t){return e=e||A.localeSlug,t=t||{},this.realToLocaleString(e,t)}):A.locale={"":{localeSlug:A.localeSlug}},g.default.setLocale(A.locale);var E=(0,l.useRouterHistory)(d.createHashHistory)({queryKey:!1}),T=(0,u.syncHistoryWithStore)(E,_.default);!function(){var e=document.getElementById("jp-plugin-container");null!==e&&o.default.render(s.default.createElement("div",null,s.default.createElement(c.Provider,{store:_.default},s.default.createElement(l.Router,{history:T},s.default.createElement(l.Route,{path:"/",name:g.default.translate("At A Glance",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/jumpstart",component:b.default}),s.default.createElement(l.Route,{path:"/dashboard",name:g.default.translate("At A Glance"),component:b.default}),s.default.createElement(l.Route,{path:"/plans",name:g.default.translate("Plans",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/settings",name:g.default.translate("Settings",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/discussion",name:g.default.translate("Discussion",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/security",name:g.default.translate("Security",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/traffic",name:g.default.translate("Traffic",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/writing",name:g.default.translate("Writing",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/sharing",name:g.default.translate("Sharing",{context:"Navigation item."}),component:b.default}),s.default.createElement(l.Route,{path:"/wpbody-content",component:b.default}),s.default.createElement(l.Route,{path:"/wp-toolbar",component:b.default}),s.default.createElement(l.Route,{path:"*",component:b.default})))),e)}()},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),a=n(4),o=n(69),i=n(43),s=n(26),c=n(16),l=n(48),u=n(52),d=n(140),p=n(89),f=n(141);n(23);o.inject();var h=c.measure("React","render",s.render),m={findDOMNode:p,render:h,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:u.batchedUpdates,unstable_renderSubtreeIntoContainer:f};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:i,Mount:s,Reconciler:l,TextComponent:a});e.exports=m},function(e,t){"use strict";var n={current:null};e.exports=n},function(e,t,n){"use strict";var r=n(5),a=n(20),o=n(24),i=n(26),s=n(37),c=n(19),l=n(18),u=(n(68),function(e){});s(u.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){if(this._rootNodeID=e,t.useCreateElement){var r=n[i.ownerDocumentContextKey],o=r.createElement("span");return a.setAttributeForID(o,e),i.getID(o),l(o,this._stringText),o}var s=c(this._stringText);return t.renderToStaticMarkup?s:""+s+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var a=i.getNode(this._rootNodeID);r.updateTextContent(a,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=u},function(e,t,n){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var a=n(6),o=n(14),i=n(16),s=n(17),c=n(18),l=n(11),u={dangerouslyReplaceNodeWithMarkup:a.dangerouslyReplaceNodeWithMarkup,updateTextContent:c,processUpdates:function(e,t){for(var n,i=null,u=null,d=0;d]+)/,u={dangerouslyRenderMarkup:function(e){a.canUseDOM||c(!1);for(var t,n={},u=0;u":"<"+e+">",s[e]=!i.firstChild),s[e]?p[e]:null}var a=n(7),o=n(11),i=a.canUseDOM?document.createElement("div"):null,s={},c=[1,'"],l=[1,"","
"],u=[3,"","
"],d=[1,'',""],p={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:c,option:c,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:u,th:u};["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"].forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(15),a=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=a},function(e,t,n){"use strict";var r=n(11),a=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)||r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};e.exports=a},function(e,t,n){"use strict";function r(e,t,n){return n}var a={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){a.storedMeasure=e}}};e.exports=a},function(e,t,n){"use strict";var r=n(7),a=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=i},function(e,t,n){"use strict";var r=n(7),a=n(19),o=n(17),i=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(i=function(e,t){o(e,a(t))})),e.exports=i},function(e,t){"use strict";function n(e){return a[e]}function r(e){return(""+e).replace(o,n)}var a={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){"use strict";function r(e){return!!u.hasOwnProperty(e)||!l.hasOwnProperty(e)&&(c.test(e)?(u[e]=!0,!0):(l[e]=!0,!1))}function a(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&!1===t}var o=n(21),i=n(16),s=n(22),c=(n(23),/^[a-zA-Z_][\w\.\-]*$/),l={},u={},d={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,t){var n=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(n){if(a(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&!0===t?r+'=""':r+"="+s(t)}return o.isCustomAttribute(e)?null==t?"":e+"="+s(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,t,n){var r=o.properties.hasOwnProperty(t)?o.properties[t]:null;if(r){var i=r.mutationMethod;if(i)i(e,n);else if(a(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute){var s=r.attributeName,c=r.attributeNamespace;c?e.setAttributeNS(c,s,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===n?e.setAttribute(s,""):e.setAttribute(s,""+n)}else{var l=r.propertyName;r.hasSideEffects&&""+e[l]==""+n||(e[l]=n)}}else o.isCustomAttribute(t)&&d.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=o.properties.hasOwnProperty(t)?o.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseAttribute)e.removeAttribute(n.attributeName);else{var a=n.propertyName,i=o.getDefaultValueForProperty(e.nodeName,a);n.hasSideEffects&&""+e[a]===i||(e[a]=i)}}else o.isCustomAttribute(t)&&e.removeAttribute(t)}};i.measureMethods(d,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=d},function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var a=n(11),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=o,n=e.Properties||{},i=e.DOMAttributeNamespaces||{},c=e.DOMAttributeNames||{},l=e.DOMPropertyNames||{},u=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var d in n){s.properties.hasOwnProperty(d)&&a(!1);var p=d.toLowerCase(),f=n[d],h={attributeName:p,attributeNamespace:null,propertyName:d,mutationMethod:null,mustUseAttribute:r(f,t.MUST_USE_ATTRIBUTE),mustUseProperty:r(f,t.MUST_USE_PROPERTY),hasSideEffects:r(f,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(f,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(f,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(f,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(f,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(h.mustUseAttribute&&h.mustUseProperty&&a(!1),!h.mustUseProperty&&h.hasSideEffects&&a(!1),h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1||a(!1),c.hasOwnProperty(d)){var m=c[d];h.attributeName=m}i.hasOwnProperty(d)&&(h.attributeNamespace=i[d]),l.hasOwnProperty(d)&&(h.propertyName=l[d]),u.hasOwnProperty(d)&&(h.mutationMethod=u[d]),s.properties[d]=h}}},i={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t-1||i(!1),!l.plugins[n]){t.extractEvents||i(!1),l.plugins[n]=t;var r=t.eventTypes;for(var o in r)a(r[o],t,o)||i(!1)}}}function a(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)&&i(!1),l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var a in r)if(r.hasOwnProperty(a)){var s=r[a];o(s,t,n)}return!0}return!!e.registrationName&&(o(e.registrationName,t,n),!0)}function o(e,t,n){l.registrationNameModules[e]&&i(!1),l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=n(11),s=null,c={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s&&i(!1),s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var a=e[n];c.hasOwnProperty(n)&&c[n]===a||(c[n]&&i(!1),c[n]=a,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in c)c.hasOwnProperty(e)&&delete c[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var a in r)r.hasOwnProperty(a)&&delete r[a]}};e.exports=l},function(e,t,n){"use strict";function r(e){return e===_.topMouseUp||e===_.topTouchEnd||e===_.topTouchCancel}function a(e){return e===_.topMouseMove||e===_.topTouchMove}function o(e){return e===_.topMouseDown||e===_.topTouchStart}function i(e,t,n,r){var a=e.type||"unknown-event";e.currentTarget=m.Mount.getNode(r),t?f.invokeGuardedCallbackWithCatch(a,n,e,r):f.invokeGuardedCallback(a,n,e,r),e.currentTarget=null}function s(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var a=0;a1){for(var d=Array(u),p=0;p1){for(var f=Array(p),h=0;h1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,a){var o=l(e,t);o!==e&&u(e,o,n,r,!1,!0),o!==t&&u(o,t,n,a,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(u("",e,t,n,!0,!1),u(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(u("",e,t,n,!0,!0),u(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){u("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:c,isAncestorIDOf:i,SEPARATOR:f};e.exports=_},function(e,t){"use strict";var n={injectCreateReactRootIndex:function(e){r.createReactRootIndex=e}},r={createReactRootIndex:null,injection:n};e.exports=r},function(e,t){"use strict";var n={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};e.exports=n},function(e,t,n){"use strict";var r=n(47),a=/\/?>/,o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(a," "+o.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(o.CHECKSUM_ATTR_NAME);return n=n&&parseInt(n,10),r(e)===n}};e.exports=o},function(e,t){"use strict";function n(e){for(var t=1,n=0,a=0,o=e.length,i=-4&o;a8&&A<=11),L=32,w=String.fromCharCode(L),k=p.topLevelTypes,S={beforeInput:{phasedRegistrationNames:{bubbled:g({onBeforeInput:null}),captured:g({onBeforeInputCapture:null})},dependencies:[k.topCompositionEnd,k.topKeyPress,k.topTextInput,k.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:g({onCompositionEnd:null}),captured:g({onCompositionEndCapture:null})},dependencies:[k.topBlur,k.topCompositionEnd,k.topKeyDown,k.topKeyPress,k.topKeyUp,k.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:g({onCompositionStart:null}),captured:g({onCompositionStartCapture:null})},dependencies:[k.topBlur,k.topCompositionStart,k.topKeyDown,k.topKeyPress,k.topKeyUp,k.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:g({onCompositionUpdate:null}),captured:g({onCompositionUpdateCapture:null})},dependencies:[k.topBlur,k.topCompositionUpdate,k.topKeyDown,k.topKeyPress,k.topKeyUp,k.topMouseDown]}},C=!1,O=null,z={eventTypes:S,extractEvents:function(e,t,n,r,a){return[c(e,t,n,r,a),d(e,t,n,r,a)]}};e.exports=z},function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return g(e,r)}function a(e,t,n){var a=t?M.bubbled:M.captured,o=r(e,n,a);o&&(n._dispatchListeners=m(n._dispatchListeners,o),n._dispatchIDs=m(n._dispatchIDs,e))}function o(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,a,e)}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(e.dispatchMarker,a,e)}function s(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,a=g(e,r);a&&(n._dispatchListeners=m(n._dispatchListeners,a),n._dispatchIDs=m(n._dispatchIDs,e))}}function c(e){e&&e.dispatchConfig.registrationName&&s(e.dispatchMarker,null,e)}function l(e){_(e,o)}function u(e){_(e,i)}function d(e,t,n,r){h.injection.getInstanceHandle().traverseEnterLeave(n,r,s,e,t)}function p(e){_(e,c)}var f=n(28),h=n(29),m=(n(23),n(33)),_=n(34),M=f.PropagationPhases,g=h.getListener,v={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:u,accumulateDirectDispatches:p,accumulateEnterLeaveDispatches:d};e.exports=v},function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var a=n(54),o=n(37),i=n(73);o(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,a=this.getText(),o=a.length;for(e=0;e1?1-t:void 0;return this._fallbackText=a.slice(e,s),this._fallbackText}}),a.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";function r(){return!o&&a.canUseDOM&&(o="textContent"in document.documentElement?"textContent":"innerText"),o}var a=n(7),o=null;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(75),o={data:null};a.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var a=this.constructor.Interface;for(var o in a)if(a.hasOwnProperty(o)){var s=a[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var c=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;this.isDefaultPrevented=c?i.thatReturnsTrue:i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse}var a=n(54),o=n(37),i=n(13),s=(n(23),{type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null});o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=s,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);o(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=o({},n.Interface,t),e.augmentClass=n.augmentClass,a.addPoolingTo(e,a.fourArgumentPooler)},a.addPoolingTo(r,a.fourArgumentPooler),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(75),o={data:null};a.augmentClass(r,o),e.exports=r},function(e,t){"use strict";var n=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=n},function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function a(e){var t=E.getPooled(C.change,z,e,T(e));b.accumulateTwoPhaseDispatches(t),A.batchedUpdates(o,t)}function o(e){v.enqueueEvents(e),v.processEventQueue(!1)}function i(e,t){O=e,z=t,O.attachEvent("onchange",a)}function s(){O&&(O.detachEvent("onchange",a),O=null,z=null)}function c(e,t,n){if(e===S.topChange)return n}function l(e,t,n){e===S.topFocus?(s(),i(t,n)):e===S.topBlur&&s()}function u(e,t){O=e,z=t,N=e.value,P=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(O,"value",j),O.attachEvent("onpropertychange",p)}function d(){O&&(delete O.value,O.detachEvent("onpropertychange",p),O=null,z=null,N=null,P=null)}function p(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==N&&(N=t,a(e))}}function f(e,t,n){if(e===S.topInput)return n}function h(e,t,n){e===S.topFocus?(d(),u(t,n)):e===S.topBlur&&d()}function m(e,t,n){if((e===S.topSelectionChange||e===S.topKeyUp||e===S.topKeyDown)&&O&&O.value!==N)return N=O.value,z}function _(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function M(e,t,n){if(e===S.topClick)return n}var g=n(28),v=n(29),b=n(71),y=n(7),A=n(52),E=n(75),T=n(79),L=n(38),w=n(80),k=n(77),S=g.topLevelTypes,C={change:{phasedRegistrationNames:{bubbled:k({onChange:null}),captured:k({onChangeCapture:null})},dependencies:[S.topBlur,S.topChange,S.topClick,S.topFocus,S.topInput,S.topKeyDown,S.topKeyUp,S.topSelectionChange]}},O=null,z=null,N=null,P=null,D=!1;y.canUseDOM&&(D=L("change")&&(!("documentMode"in document)||document.documentMode>8));var x=!1;y.canUseDOM&&(x=L("input")&&(!("documentMode"in document)||document.documentMode>9));var j={get:function(){return P.get.call(this)},set:function(e){N=""+e,P.set.call(this,e)}},R={eventTypes:C, -extractEvents:function(e,t,n,a,o){var i,s;if(r(t)?D?i=c:s=l:w(t)?x?i=f:(i=m,s=h):_(t)&&(i=M),i){var u=i(e,t,n);if(u){var d=E.getPooled(C.change,u,a,o);return d.type="change",b.accumulateTwoPhaseDispatches(d),d}}s&&s(e,t,n)}};e.exports=R},function(e,t){"use strict";function n(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}e.exports=n},function(e,t){"use strict";function n(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&r[e.type]||"textarea"===t)}var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=n},function(e,t){"use strict";var n=0,r={createReactRootIndex:function(){return n++}};e.exports=r},function(e,t,n){"use strict";var r=n(77),a=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];e.exports=a},function(e,t,n){"use strict";var r=n(28),a=n(71),o=n(84),i=n(26),s=n(77),c=r.topLevelTypes,l=i.getFirstReactDOM,u={mouseEnter:{registrationName:s({onMouseEnter:null}),dependencies:[c.topMouseOut,c.topMouseOver]},mouseLeave:{registrationName:s({onMouseLeave:null}),dependencies:[c.topMouseOut,c.topMouseOver]}},d=[null,null],p={eventTypes:u,extractEvents:function(e,t,n,r,s){if(e===c.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==c.topMouseOut&&e!==c.topMouseOver)return null;var p;if(t.window===t)p=t;else{var f=t.ownerDocument;p=f?f.defaultView||f.parentWindow:window}var h,m,_="",M="";if(e===c.topMouseOut?(h=t,_=n,m=l(r.relatedTarget||r.toElement),m?M=i.getID(m):m=p,m=m||p):(h=p,m=t,M=n),h===m)return null;var g=o.getPooled(u.mouseLeave,_,r,s);g.type="mouseleave",g.target=h,g.relatedTarget=m;var v=o.getPooled(u.mouseEnter,M,r,s);return v.type="mouseenter",v.target=m,v.relatedTarget=h,a.accumulateEnterLeaveDispatches(g,v,_,M),d[0]=g,d[1]=v,d}};e.exports=p},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(85),o=n(36),i=n(86),s={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:i,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+o.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+o.currentScrollTop}};a.augmentClass(r,s),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(75),o=n(79),i={view:function(e){if(e.view)return e.view;var t=o(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};a.augmentClass(r,i),e.exports=r},function(e,t){"use strict";function n(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=a[e];return!!r&&!!n[r]}function r(e){return n}var a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=r},function(e,t,n){"use strict";var r,a=n(21),o=n(7),i=a.injection.MUST_USE_ATTRIBUTE,s=a.injection.MUST_USE_PROPERTY,c=a.injection.HAS_BOOLEAN_VALUE,l=a.injection.HAS_SIDE_EFFECTS,u=a.injection.HAS_NUMERIC_VALUE,d=a.injection.HAS_POSITIVE_NUMERIC_VALUE,p=a.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(o.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|c,allowTransparency:i,alt:null,async:c,autoComplete:null,autoPlay:c,capture:i|c,cellPadding:null,cellSpacing:null,charSet:i,challenge:i,checked:s|c,classID:i,className:r?i:s,cols:i|d,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:s|c,coords:null,crossOrigin:null,data:null,dateTime:i,default:c,defer:c,dir:null,disabled:i|c,download:p,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:c,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|c,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:s,inputMode:i,integrity:null,is:i,keyParams:i,keyType:i,kind:null,label:null,lang:null,list:i,loop:s|c,low:null,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,minLength:i,multiple:s|c,muted:s|c,name:null,nonce:i,noValidate:c,open:c,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:s|c,rel:null,required:c,reversed:c,role:i,rows:i|d,rowSpan:null,sandbox:null,scope:null,scoped:c,scrolling:null,seamless:i|c,selected:s|c,shape:null,size:i|d,sizes:i,span:d,spellCheck:null,src:null,srcDoc:s,srcLang:null,srcSet:i,start:u,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:s|l,width:i,wmode:i,wrap:null,about:i,datatype:i,inlist:i,prefix:i,property:i,resource:i,typeof:i,vocab:i,autoCapitalize:i,autoCorrect:i,autoSave:null,color:null,itemProp:i,itemScope:i|c,itemType:i,itemID:i,itemRef:i,results:null,security:i,unselectable:i},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};e.exports=h},function(e,t,n){"use strict";var r=(n(45),n(89)),a=(n(23),{getDOMNode:function(){return this.constructor._getDOMNodeDidWarn=!0,r(this)}});e.exports=a},function(e,t,n){"use strict";function r(e){return null==e?null:1===e.nodeType?e:a.has(e)?o.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render&&i(!1),void i(!1))}var a=(n(3),n(45)),o=n(26),i=n(11);n(23);e.exports=r},function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var a=n(52),o=n(55),i=n(37),s=n(13),c={initialize:s,close:function(){p.isBatchingUpdates=!1}},l={initialize:s,close:a.flushBatchedUpdates.bind(a)},u=[l,c];i(r.prototype,o.Mixin,{getTransactionWrappers:function(){return u}});var d=new r,p={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,a,o){var i=p.isBatchingUpdates;p.isBatchingUpdates=!0,i?e(t,n,r,a,o):d.perform(e,null,t,n,r,a,o)}};e.exports=p},function(e,t,n){"use strict";function r(){return this}function a(){var e=this._reactInternalComponent;return!!e}function o(){}function i(e,t){var n=this._reactInternalComponent;n&&(N.enqueueSetPropsInternal(n,e),t&&N.enqueueCallbackInternal(n,t))}function s(e,t){var n=this._reactInternalComponent;n&&(N.enqueueReplacePropsInternal(n,e),t&&N.enqueueCallbackInternal(n,t))}function c(e,t){t&&(null!=t.dangerouslySetInnerHTML&&(null!=t.children&&j(!1),"object"==typeof t.dangerouslySetInnerHTML&&X in t.dangerouslySetInnerHTML||j(!1)),null!=t.style&&"object"!=typeof t.style&&j(!1))}function l(e,t,n,r){var a=C.findReactContainerForID(e);if(a){var o=a.nodeType===V?a.ownerDocument:a;I(t,o)}r.getReactMountReady().enqueue(u,{id:e,registrationName:t,listener:n})}function u(){var e=this;A.putListener(e.id,e.registrationName,e.listener)}function d(){var e=this;e._rootNodeID||j(!1);var t=C.getNode(e._rootNodeID);switch(t||j(!1),e._tag){case"iframe":e._wrapperState.listeners=[A.trapBubbledEvent(y.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in J)J.hasOwnProperty(n)&&e._wrapperState.listeners.push(A.trapBubbledEvent(y.topLevelTypes[n],J[n],t));break;case"img":e._wrapperState.listeners=[A.trapBubbledEvent(y.topLevelTypes.topError,"error",t),A.trapBubbledEvent(y.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[A.trapBubbledEvent(y.topLevelTypes.topReset,"reset",t),A.trapBubbledEvent(y.topLevelTypes.topSubmit,"submit",t)]}}function p(){L.mountReadyWrapper(this)}function f(){k.postUpdateWrapper(this)}function h(e){$.call(Z,e)||(Q.test(e)||j(!1),Z[e]=!0)}function m(e,t){return e.indexOf("-")>=0||null!=t.is}function _(e){h(e),this._tag=e.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var M=n(92),g=n(94),v=n(21),b=n(20),y=n(28),A=n(27),E=n(24),T=n(102),L=n(103),w=n(107),k=n(110),S=n(111),C=n(26),O=n(112),z=n(16),N=n(51),P=n(37),D=n(41),x=n(19),j=n(11),R=(n(38),n(77)),Y=n(17),W=n(18),q=(n(115),n(68),n(23),A.deleteListener),I=A.listenTo,B=A.registrationNameModules,U={string:!0,number:!0},H=R({children:null}),F=R({style:null}),X=R({__html:null}),V=1,J={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},K={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},G={listing:!0,pre:!0,textarea:!0},Q=(P({menuitem:!0},K),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),Z={},$={}.hasOwnProperty;_.displayName="ReactDOMComponent",_.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e;var r=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(d,this);break;case"button":r=T.getNativeProps(this,r,n);break;case"input":L.mountWrapper(this,r,n),r=L.getNativeProps(this,r,n);break;case"option":w.mountWrapper(this,r,n),r=w.getNativeProps(this,r,n);break;case"select":k.mountWrapper(this,r,n),r=k.getNativeProps(this,r,n),n=k.processChildContext(this,r,n);break;case"textarea":S.mountWrapper(this,r,n),r=S.getNativeProps(this,r,n)}c(this,r);var a;if(t.useCreateElement){var o=n[C.ownerDocumentContextKey],i=o.createElement(this._currentElement.type);b.setAttributeForID(i,this._rootNodeID),C.getID(i),this._updateDOMProperties({},r,t,i),this._createInitialChildren(t,r,n,i),a=i}else{var s=this._createOpenTagMarkupAndPutListeners(t,r),l=this._createContentMarkup(t,r,n);a=!l&&K[this._tag]?s+"/>":s+">"+l+""}switch(this._tag){case"input":t.getReactMountReady().enqueue(p,this);case"button":case"select":case"textarea":r.autoFocus&&t.getReactMountReady().enqueue(M.focusDOMComponent,this)}return a},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var a=t[r];if(null!=a)if(B.hasOwnProperty(r))a&&l(this._rootNodeID,r,a,e);else{r===F&&(a&&(a=this._previousStyleCopy=P({},t.style)),a=g.createMarkupForStyles(a));var o=null;null!=this._tag&&m(this._tag,t)?r!==H&&(o=b.createMarkupForCustomAttribute(r,a)):o=b.createMarkupForProperty(r,a),o&&(n+=" "+o)}}return e.renderToStaticMarkup?n:n+" "+b.createMarkupForID(this._rootNodeID)},_createContentMarkup:function(e,t,n){var r="",a=t.dangerouslySetInnerHTML;if(null!=a)null!=a.__html&&(r=a.__html);else{var o=U[typeof t.children]?t.children:null,i=null!=o?null:t.children;if(null!=o)r=x(o);else if(null!=i){var s=this.mountChildren(i,e,n);r=s.join("")}}return G[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var a=t.dangerouslySetInnerHTML;if(null!=a)null!=a.__html&&Y(r,a.__html);else{var o=U[typeof t.children]?t.children:null,i=null!=o?null:t.children;if(null!=o)W(r,o);else if(null!=i)for(var s=this.mountChildren(i,e,n),c=0;c>"}var m=n(40),_=n(64),M=n(13),g=n(106),v="<>",b={array:a("array"),bool:a("boolean"),func:a("function"),number:a("number"),object:a("object"),string:a("string"),any:function(){return r(M.thatReturns(null))}(),arrayOf:o,element:function(){function e(e,t,n,r,a){if(!m.isValidElement(e[t])){var o=_[r];return new Error("Invalid "+o+" `"+a+"` supplied to `"+n+"`, expected a single ReactElement.")}return null}return r(e)}(),instanceOf:i,node:function(){function e(e,t,n,r,a){if(!d(e[t])){var o=_[r];return new Error("Invalid "+o+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}return null}return r(e)}(),objectOf:c,oneOf:s,oneOfType:l,shape:u};e.exports=b},function(e,t){"use strict";function n(e){var t=e&&(r&&e[r]||e[a]);if("function"==typeof t)return t}var r="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";e.exports=n},function(e,t,n){"use strict";var r=n(108),a=n(110),o=n(37),i=(n(23),a.valueContextKey),s={mountWrapper:function(e,t,n){var r=n[i],a=null;if(null!=r)if(a=!1,Array.isArray(r)){for(var o=0;ot.end?(n=t.end,r=t.start):(n=t.start,r=t.end),a.moveToElementText(e),a.moveStart("character",n),a.setEndPoint("EndToStart",a),a.moveEnd("character",r-n),a.select()}function s(e,t){if(window.getSelection){var n=window.getSelection(),r=e[u()].length,a=Math.min(t.start,r),o=void 0===t.end?a:Math.min(t.end,r);if(!n.extend&&a>o){var i=o;o=a,a=i}var s=l(e,a),c=l(e,o);if(s&&c){var d=document.createRange();d.setStart(s.node,s.offset),n.removeAllRanges(),a>o?(n.addRange(d),n.extend(c.node,c.offset)):(d.setEnd(c.node,c.offset),n.addRange(d))}}}var c=n(7),l=n(126),u=n(73),d=c.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:d?a:o,setOffsets:d?i:s};e.exports=p},function(e,t){"use strict";function n(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function r(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function a(e,t){for(var a=n(e),o=0,i=0;a;){if(3===a.nodeType){if(i=o+a.textContent.length,o<=t&&i>=t)return{node:a,offset:t-o};o=i}a=n(r(a))}}e.exports=a},function(e,t){"use strict";function n(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}e.exports=n},function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&c.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function a(e,t){if(b||null==M||M!==u())return null;var n=r(M);if(!v||!f(v,n)){v=n;var a=l.getPooled(_.select,g,e,t);return a.type="select",a.target=M,i.accumulateTwoPhaseDispatches(a),a}return null}var o=n(28),i=n(71),s=n(7),c=n(124),l=n(75),u=n(127),d=n(80),p=n(77),f=n(115),h=o.topLevelTypes,m=s.canUseDOM&&"documentMode"in document&&document.documentMode<=11,_={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[h.topBlur,h.topContextMenu,h.topFocus,h.topKeyDown,h.topMouseDown,h.topMouseUp,h.topSelectionChange]}},M=null,g=null,v=null,b=!1,y=!1,A=p({onSelect:null}),E={eventTypes:_,extractEvents:function(e,t,n,r,o){if(!y)return null;switch(e){case h.topFocus:(d(t)||"true"===t.contentEditable)&&(M=t,g=n,v=null);break;case h.topBlur:M=null,g=null,v=null;break;case h.topMouseDown:b=!0;break;case h.topContextMenu:case h.topMouseUp:return b=!1,a(r,o);case h.topSelectionChange:if(m)break;case h.topKeyDown:case h.topKeyUp:return a(r,o)}return null},didPutListener:function(e,t,n){t===A&&(y=!0)}};e.exports=E},function(e,t){"use strict";var n=Math.pow(2,53),r={createReactRootIndex:function(){return Math.ceil(Math.random()*n)}};e.exports=r},function(e,t,n){"use strict";var r=n(28),a=n(117),o=n(71),i=n(26),s=n(131),c=n(75),l=n(132),u=n(133),d=n(84),p=n(136),f=n(137),h=n(85),m=n(138),_=n(13),M=n(134),g=n(11),v=n(77),b=r.topLevelTypes,y={abort:{phasedRegistrationNames:{bubbled:v({onAbort:!0}),captured:v({onAbortCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:v({onBlur:!0}),captured:v({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:v({onCanPlay:!0}),captured:v({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:v({onCanPlayThrough:!0}),captured:v({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:v({onClick:!0}),captured:v({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:v({onContextMenu:!0}),captured:v({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:v({onCopy:!0}),captured:v({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:v({onCut:!0}),captured:v({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:v({onDoubleClick:!0}),captured:v({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:v({onDrag:!0}),captured:v({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:v({onDragEnd:!0}),captured:v({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:v({onDragEnter:!0}),captured:v({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:v({onDragExit:!0}),captured:v({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:v({onDragLeave:!0}),captured:v({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:v({onDragOver:!0}),captured:v({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:v({onDragStart:!0}),captured:v({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:v({onDrop:!0}),captured:v({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:v({onDurationChange:!0}),captured:v({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:v({onEmptied:!0}),captured:v({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:v({onEncrypted:!0}),captured:v({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:v({onEnded:!0}),captured:v({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:v({onError:!0}),captured:v({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:v({onFocus:!0}),captured:v({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:v({onInput:!0}),captured:v({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:v({onKeyDown:!0}),captured:v({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:v({onKeyPress:!0}),captured:v({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:v({onKeyUp:!0}),captured:v({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:v({onLoad:!0}),captured:v({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:v({onLoadedData:!0}),captured:v({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:v({onLoadedMetadata:!0}),captured:v({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:v({onLoadStart:!0}),captured:v({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:v({onMouseDown:!0}),captured:v({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:v({onMouseMove:!0}),captured:v({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:v({onMouseOut:!0}),captured:v({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:v({onMouseOver:!0}),captured:v({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:v({onMouseUp:!0}),captured:v({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:v({onPaste:!0}),captured:v({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:v({onPause:!0}),captured:v({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:v({onPlay:!0}),captured:v({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:v({onPlaying:!0}),captured:v({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:v({onProgress:!0}),captured:v({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:v({onRateChange:!0}),captured:v({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:v({onReset:!0}),captured:v({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:v({onScroll:!0}),captured:v({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:v({onSeeked:!0}),captured:v({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:v({onSeeking:!0}),captured:v({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:v({onStalled:!0}),captured:v({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:v({onSubmit:!0}),captured:v({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:v({onSuspend:!0}),captured:v({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:v({onTimeUpdate:!0}),captured:v({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:v({onTouchCancel:!0}),captured:v({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:v({onTouchEnd:!0}),captured:v({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:v({onTouchMove:!0}),captured:v({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:v({onTouchStart:!0}),captured:v({onTouchStartCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:v({onVolumeChange:!0}),captured:v({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:v({onWaiting:!0}),captured:v({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:v({onWheel:!0}),captured:v({onWheelCapture:!0})}}},A={topAbort:y.abort,topBlur:y.blur,topCanPlay:y.canPlay,topCanPlayThrough:y.canPlayThrough,topClick:y.click,topContextMenu:y.contextMenu,topCopy:y.copy,topCut:y.cut,topDoubleClick:y.doubleClick,topDrag:y.drag,topDragEnd:y.dragEnd,topDragEnter:y.dragEnter,topDragExit:y.dragExit,topDragLeave:y.dragLeave,topDragOver:y.dragOver,topDragStart:y.dragStart,topDrop:y.drop,topDurationChange:y.durationChange,topEmptied:y.emptied,topEncrypted:y.encrypted,topEnded:y.ended,topError:y.error,topFocus:y.focus,topInput:y.input,topKeyDown:y.keyDown,topKeyPress:y.keyPress,topKeyUp:y.keyUp,topLoad:y.load,topLoadedData:y.loadedData,topLoadedMetadata:y.loadedMetadata,topLoadStart:y.loadStart,topMouseDown:y.mouseDown,topMouseMove:y.mouseMove,topMouseOut:y.mouseOut,topMouseOver:y.mouseOver,topMouseUp:y.mouseUp,topPaste:y.paste,topPause:y.pause,topPlay:y.play,topPlaying:y.playing,topProgress:y.progress,topRateChange:y.rateChange,topReset:y.reset,topScroll:y.scroll,topSeeked:y.seeked,topSeeking:y.seeking,topStalled:y.stalled,topSubmit:y.submit,topSuspend:y.suspend,topTimeUpdate:y.timeUpdate,topTouchCancel:y.touchCancel,topTouchEnd:y.touchEnd,topTouchMove:y.touchMove,topTouchStart:y.touchStart,topVolumeChange:y.volumeChange,topWaiting:y.waiting,topWheel:y.wheel};for(var E in A)A[E].dependencies=[E];var T=v({onClick:null}),L={},w={eventTypes:y,extractEvents:function(e,t,n,r,a){var i=A[e];if(!i)return null;var _;switch(e){case b.topAbort:case b.topCanPlay:case b.topCanPlayThrough:case b.topDurationChange:case b.topEmptied:case b.topEncrypted:case b.topEnded:case b.topError:case b.topInput:case b.topLoad:case b.topLoadedData:case b.topLoadedMetadata:case b.topLoadStart:case b.topPause:case b.topPlay:case b.topPlaying:case b.topProgress:case b.topRateChange:case b.topReset:case b.topSeeked:case b.topSeeking:case b.topStalled:case b.topSubmit:case b.topSuspend:case b.topTimeUpdate:case b.topVolumeChange:case b.topWaiting:_=c;break;case b.topKeyPress:if(0===M(r))return null;case b.topKeyDown:case b.topKeyUp:_=u;break;case b.topBlur:case b.topFocus:_=l;break;case b.topClick:if(2===r.button)return null;case b.topContextMenu:case b.topDoubleClick:case b.topMouseDown:case b.topMouseMove:case b.topMouseOut:case b.topMouseOver:case b.topMouseUp:_=d;break;case b.topDrag:case b.topDragEnd:case b.topDragEnter:case b.topDragExit:case b.topDragLeave:case b.topDragOver:case b.topDragStart:case b.topDrop:_=p;break;case b.topTouchCancel:case b.topTouchEnd:case b.topTouchMove:case b.topTouchStart:_=f;break;case b.topScroll:_=h;break;case b.topWheel:_=m;break;case b.topCopy:case b.topCut:case b.topPaste:_=s}_||g(!1);var v=_.getPooled(i,n,r,a);return o.accumulateTwoPhaseDispatches(v),v},didPutListener:function(e,t,n){if(t===T){var r=i.getNode(e);L[e]||(L[e]=a.listen(r,"click",_))}},willDeleteListener:function(e,t){t===T&&(L[e].remove(),delete L[e])}};e.exports=w},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(75),o={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};a.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(85),o={relatedTarget:null};a.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(85),o=n(134),i=n(135),s=n(86),c={key:i,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(e){return"keypress"===e.type?o(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?o(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};a.augmentClass(r,c),e.exports=r},function(e,t){"use strict";function n(e){var t,n=e.keyCode;return"charCode"in e?0===(t=e.charCode)&&13===n&&(t=13):t=n,t>=32||13===t?t:0}e.exports=n},function(e,t,n){"use strict";function r(e){if(e.key){var t=o[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=a(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}var a=n(134),o={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(84),o={dataTransfer:null};a.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(85),o=n(86),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:o};a.augmentClass(r,i),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){a.call(this,e,t,n,r)}var a=n(84),o={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};a.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";var r=n(21),a=r.injection.MUST_USE_ATTRIBUTE,o={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},i={Properties:{clipPath:a,cx:a,cy:a,d:a,dx:a,dy:a,fill:a,fillOpacity:a,fontFamily:a,fontSize:a,fx:a,fy:a,gradientTransform:a,gradientUnits:a,markerEnd:a,markerMid:a,markerStart:a,offset:a,opacity:a,patternContentUnits:a,patternUnits:a,points:a,preserveAspectRatio:a,r:a,rx:a,ry:a,spreadMethod:a,stopColor:a,stopOpacity:a,stroke:a,strokeDasharray:a,strokeLinecap:a,strokeOpacity:a,strokeWidth:a,textAnchor:a,transform:a,version:a,viewBox:a,x1:a,x2:a,x:a,xlinkActuate:a,xlinkArcrole:a,xlinkHref:a,xlinkRole:a,xlinkShow:a,xlinkTitle:a,xlinkType:a,xmlBase:a,xmlLang:a,xmlSpace:a,y1:a,y2:a,y:a},DOMAttributeNamespaces:{xlinkActuate:o.xlink,xlinkArcrole:o.xlink,xlinkHref:o.xlink,xlinkRole:o.xlink,xlinkShow:o.xlink,xlinkTitle:o.xlink,xlinkType:o.xlink,xmlBase:o.xml,xmlLang:o.xml,xmlSpace:o.xml},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space"}};e.exports=i},function(e,t){"use strict";e.exports="0.14.9"},function(e,t,n){"use strict";var r=n(26);e.exports=r.renderSubtreeIntoContainer},function(e,t,n){"use strict";e.exports=n(143)},function(e,t,n){"use strict";var r=n(2),a=n(144),o=n(148),i=n(37),s=n(153),c={};i(c,o),i(c,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",a,a.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",a,a.renderToStaticMarkup)}),c.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,c.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=a,e.exports=c},function(e,t,n){"use strict";var r=n(69),a=n(145),o=n(140);r.inject();var i={renderToString:a.renderToString,renderToStaticMarkup:a.renderToStaticMarkup,version:o};e.exports=i},function(e,t,n){"use strict";function r(e){i.isValidElement(e)||h(!1);var t;try{d.injection.injectBatchingStrategy(l);var n=s.createReactRootID();return t=u.getPooled(!1),t.perform(function(){var r=f(e,null),a=r.mountComponent(n,t,p);return c.addChecksumToMarkup(a)},null)}finally{u.release(t),d.injection.injectBatchingStrategy(o)}}function a(e){i.isValidElement(e)||h(!1);var t;try{d.injection.injectBatchingStrategy(l);var n=s.createReactRootID();return t=u.getPooled(!0),t.perform(function(){return f(e,null).mountComponent(n,t,p)},null)}finally{u.release(t),d.injection.injectBatchingStrategy(o)}}var o=n(90),i=n(40),s=n(43),c=n(46),l=n(146),u=n(147),d=n(52),p=n(56),f=n(60),h=n(11);e.exports={renderToString:r,renderToStaticMarkup:a}},function(e,t){"use strict";var n={isBatchingUpdates:!1,batchedUpdates:function(e){}};e.exports=n},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=o.getPooled(null),this.useCreateElement=!1}var a=n(54),o=n(53),i=n(55),s=n(37),c=n(13),l={initialize:function(){this.reactMountReady.reset()},close:c},u=[l],d={getTransactionWrappers:function(){return u},getReactMountReady:function(){return this.reactMountReady},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null}};s(r.prototype,i.Mixin,d),a.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(108),a=n(121),o=n(120),i=n(149),s=n(40),c=(n(150),n(105)),l=n(140),u=n(37),d=n(152),p=s.createElement,f=s.createFactory,h=s.cloneElement,m={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:d},Component:a,createElement:p,cloneElement:h,isValidElement:s.isValidElement,PropTypes:c,createClass:o.createClass, -createFactory:f,createMixin:function(e){return e},DOM:i,version:l,__spread:u};e.exports=m},function(e,t,n){"use strict";function r(e){return a.createFactory(e)}var a=n(40),o=(n(150),n(151)),i=o({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul",var:"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",image:"image",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);e.exports=i},function(e,t,n){"use strict";function r(){if(d.current){var e=d.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function a(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;o("uniqueKey",e,t)}}function o(e,t,n){var a=r();if(!a){var o="string"==typeof n?n:n.displayName||n.name;o&&(a=" Check the top-level render call using <"+o+">.")}var i=h[e]||(h[e]={});if(i[a])return null;i[a]=!0;var s={parentOrOwner:a,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return t&&t._owner&&t._owner!==d.current&&(s.childOwner=" It was passed a child from "+t._owner.getName()+"."),s}function i(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:{},l=Boolean(e),p=e||T,h=void 0;h="function"==typeof t?t:t?(0,M.default)(t):L;var _=n||w,g=r.pure,v=void 0===g||g,b=r.withRef,A=void 0!==b&&b,C=v&&_!==w,O=S++;return function(e){function t(e,t,n){var r=_(e,t,n);return r}var n="Connect("+s(e)+")",r=function(r){function s(e,t){a(this,s);var i=o(this,r.call(this,e,t));i.version=O,i.store=e.store||t.store,(0,E.default)(i.store,'Could not find "store" in either the context or props of "'+n+'". Either wrap the root component in a , or explicitly pass "store" as a prop to "'+n+'".');var c=i.store.getState();return i.state={storeState:c},i.clearCache(),i}return i(s,r),s.prototype.shouldComponentUpdate=function(){return!v||this.haveOwnPropsChanged||this.hasStoreStateChanged},s.prototype.computeStateProps=function(e,t){if(!this.finalMapStateToProps)return this.configureFinalMapState(e,t);var n=e.getState(),r=this.doStatePropsDependOnOwnProps?this.finalMapStateToProps(n,t):this.finalMapStateToProps(n);return r},s.prototype.configureFinalMapState=function(e,t){var n=p(e.getState(),t),r="function"==typeof n;return this.finalMapStateToProps=r?n:p,this.doStatePropsDependOnOwnProps=1!==this.finalMapStateToProps.length,r?this.computeStateProps(e,t):n},s.prototype.computeDispatchProps=function(e,t){if(!this.finalMapDispatchToProps)return this.configureFinalMapDispatch(e,t);var n=e.dispatch,r=this.doDispatchPropsDependOnOwnProps?this.finalMapDispatchToProps(n,t):this.finalMapDispatchToProps(n);return r},s.prototype.configureFinalMapDispatch=function(e,t){var n=h(e.dispatch,t),r="function"==typeof n;return this.finalMapDispatchToProps=r?n:h,this.doDispatchPropsDependOnOwnProps=1!==this.finalMapDispatchToProps.length,r?this.computeDispatchProps(e,t):n},s.prototype.updateStatePropsIfNeeded=function(){var e=this.computeStateProps(this.store,this.props);return(!this.stateProps||!(0,m.default)(e,this.stateProps))&&(this.stateProps=e,!0)},s.prototype.updateDispatchPropsIfNeeded=function(){var e=this.computeDispatchProps(this.store,this.props);return(!this.dispatchProps||!(0,m.default)(e,this.dispatchProps))&&(this.dispatchProps=e,!0)},s.prototype.updateMergedPropsIfNeeded=function(){var e=t(this.stateProps,this.dispatchProps,this.props);return!(this.mergedProps&&C&&(0,m.default)(e,this.mergedProps))&&(this.mergedProps=e,!0)},s.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},s.prototype.trySubscribe=function(){l&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},s.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},s.prototype.componentDidMount=function(){this.trySubscribe()},s.prototype.componentWillReceiveProps=function(e){v&&(0,m.default)(e,this.props)||(this.haveOwnPropsChanged=!0)},s.prototype.componentWillUnmount=function(){this.tryUnsubscribe(),this.clearCache()},s.prototype.clearCache=function(){this.dispatchProps=null,this.stateProps=null,this.mergedProps=null,this.haveOwnPropsChanged=!0,this.hasStoreStateChanged=!0,this.haveStatePropsBeenPrecalculated=!1,this.statePropsPrecalculationError=null,this.renderedElement=null,this.finalMapDispatchToProps=null,this.finalMapStateToProps=null},s.prototype.handleChange=function(){if(this.unsubscribe){var e=this.store.getState(),t=this.state.storeState;if(!v||t!==e){if(v&&!this.doStatePropsDependOnOwnProps){var n=c(this.updateStatePropsIfNeeded,this);if(!n)return;n===k&&(this.statePropsPrecalculationError=k.value),this.haveStatePropsBeenPrecalculated=!0}this.hasStoreStateChanged=!0,this.setState({storeState:e})}}},s.prototype.getWrappedInstance=function(){return(0,E.default)(A,"To access the wrapped instance, you need to specify { withRef: true } as the fourth argument of the connect() call."),this.refs.wrappedInstance},s.prototype.render=function(){var t=this.haveOwnPropsChanged,n=this.hasStoreStateChanged,r=this.haveStatePropsBeenPrecalculated,a=this.statePropsPrecalculationError,o=this.renderedElement;if(this.haveOwnPropsChanged=!1,this.hasStoreStateChanged=!1,this.haveStatePropsBeenPrecalculated=!1,this.statePropsPrecalculationError=null,a)throw a;var i=!0,s=!0;v&&o&&(i=n||t&&this.doStatePropsDependOnOwnProps,s=t&&this.doDispatchPropsDependOnOwnProps);var c=!1,l=!1;r?c=!0:i&&(c=this.updateStatePropsIfNeeded()),s&&(l=this.updateDispatchPropsIfNeeded());return!(!!(c||l||t)&&this.updateMergedPropsIfNeeded())&&o?o:(this.renderedElement=A?(0,d.createElement)(e,u({},this.mergedProps,{ref:"wrappedInstance"})):(0,d.createElement)(e,this.mergedProps),this.renderedElement)},s}(d.Component);return r.displayName=n,r.WrappedComponent=e,r.contextTypes={store:f.default},r.propTypes={store:f.default},(0,y.default)(r,e)}}t.__esModule=!0;var u=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(c)throw c;for(var r=!1,o={},i=0;i2?n-2:0),a=2;a should not have a "'+t+'" prop')}t.__esModule=!0,t.routes=t.route=t.components=t.component=t.history=void 0,t.falsy=r;var a=n(142),o=a.PropTypes.func,i=a.PropTypes.object,s=a.PropTypes.arrayOf,c=a.PropTypes.oneOfType,l=a.PropTypes.element,u=a.PropTypes.shape,d=a.PropTypes.string,p=(t.history=u({listen:o.isRequired,push:o.isRequired,replace:o.isRequired,go:o.isRequired,goBack:o.isRequired,goForward:o.isRequired}),t.component=c([o,d])),f=(t.components=c([p,i]),t.route=c([i,l]));t.routes=c([f,s(f)])},function(e,t,n){"use strict";function r(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(e){for(var t="",n=[],a=[],o=void 0,i=0,s=/:([a-zA-Z_$][a-zA-Z0-9_$]*)|\*\*|\*|\(|\)/g;o=s.exec(e);)o.index!==i&&(a.push(e.slice(i,o.index)),t+=r(e.slice(i,o.index))),o[1]?(t+="([^/]+)",n.push(o[1])):"**"===o[0]?(t+="(.*)",n.push("splat")):"*"===o[0]?(t+="(.*?)",n.push("splat")):"("===o[0]?t+="(?:":")"===o[0]&&(t+=")?"),a.push(o[0]),i=s.lastIndex;return i!==e.length&&(a.push(e.slice(i,e.length)),t+=r(e.slice(i,e.length))),{pattern:e,regexpSource:t,paramNames:n,tokens:a}}function o(e){return p[e]||(p[e]=a(e)),p[e]}function i(e,t){"/"!==e.charAt(0)&&(e="/"+e);var n=o(e),r=n.regexpSource,a=n.paramNames,i=n.tokens;"/"!==e.charAt(e.length-1)&&(r+="/?"),"*"===i[i.length-1]&&(r+="$");var s=t.match(new RegExp("^"+r,"i"));if(null==s)return null;var c=s[0],l=t.substr(c.length);if(l){if("/"!==c.charAt(c.length-1))return null;l="/"+l}return{remainingPathname:l,paramNames:a,paramValues:s.slice(1).map(function(e){return e&&decodeURIComponent(e)})}}function s(e){return o(e).paramNames}function c(e,t){var n=i(e,t);if(!n)return null;var r=n.paramNames,a=n.paramValues,o={};return r.forEach(function(e,t){o[e]=a[t]}),o}function l(e,t){t=t||{};for(var n=o(e),r=n.tokens,a=0,i="",s=0,c=void 0,l=void 0,u=void 0,p=0,f=r.length;p0||(0,d.default)(!1),null!=u&&(i+=encodeURI(u))):"("===c?a+=1:")"===c?a-=1:":"===c.charAt(0)?(l=c.substring(1),u=t[l],null!=u||a>0||(0,d.default)(!1),null!=u&&(i+=encodeURIComponent(u))):i+=c;return i.replace(/\/+/g,"/")}t.__esModule=!0,t.compilePattern=o,t.matchPattern=i,t.getParamNames=s,t.getParams=c,t.formatPattern=l;var u=n(188),d=function(e){return e&&e.__esModule?e:{default:e}}(u),p=Object.create(null)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return!e||!e.__v2_compatible__}function i(e){return e&&e.getCurrentLocation}t.__esModule=!0;var s=Object.assign||function(e){for(var t=1;t=0&&0===window.sessionStorage.length)return;throw e}}function o(e){var t=void 0;try{t=window.sessionStorage.getItem(r(e))}catch(e){if(e.name===l)return null}if(t)try{return JSON.parse(t)}catch(e){}return null}t.__esModule=!0,t.saveState=a,t.readState=o;var i=n(199),s=(function(e){e&&e.__esModule}(i),"@@History/"),c=["QuotaExceededError","QUOTA_EXCEEDED_ERR"],l="SecurityError"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e){function t(e){return c.canUseDOM||s.default(!1),n.listen(e)}var n=d.default(o({getUserConfirmation:l.getUserConfirmation},e,{go:l.go}));return o({},n,{listen:t})}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t0&&"number"!=typeof e[0]))}function o(e,t,n){var o,u;if(r(e)||r(t))return!1;if(e.prototype!==t.prototype)return!1;if(c(e))return!!c(t)&&(e=i.call(e),t=i.call(t),l(e,t,n));if(a(e)){if(!a(t))return!1;if(e.length!==t.length)return!1;for(o=0;o=0;o--)if(d[o]!=p[o])return!1;for(o=d.length-1;o>=0;o--)if(u=d[o],!l(e[u],t[u],n))return!1;return typeof e==typeof t}var i=Array.prototype.slice,s=n(208),c=n(209),l=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:o(e,t,n))}},function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}t=e.exports="function"==typeof Object.keys?Object.keys:n,t.shim=n},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}var a="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();t=e.exports=a?n:r,t.supported=n,t.unsupported=r},function(e,t){"use strict";function n(e,t,n){function a(){if(s=!0,c)return void(u=[].concat(r.call(arguments)));n.apply(this,arguments)}function o(){if(!s&&(l=!0,!c)){for(c=!0;!s&&i=e&&l&&(s=!0,n())}}var i=0,s=!1,c=!1,l=!1,u=void 0;o()}t.__esModule=!0;var r=Array.prototype.slice;t.loopAsync=n},function(e,t,n){"use strict";function r(){var e=arguments.length<=0||void 0===arguments[0]?"/":arguments[0],t=arguments.length<=1||void 0===arguments[1]?i.POP:arguments[1],n=arguments.length<=2||void 0===arguments[2]?null:arguments[2],r=arguments.length<=3||void 0===arguments[3]?null:arguments[3];return"string"==typeof e&&(e=s.parsePath(e)),"object"==typeof t&&(e=a({},e,{state:t}),t=n||i.POP,n=r),{pathname:e.pathname||"/",search:e.search||"",hash:e.hash||"",state:e.state||null,action:t,key:n}}t.__esModule=!0;var a=Object.assign||function(e){for(var t=1;t1?r-1:0),o=1;o=e&&c&&(i=!0,n())}}var o=0,i=!1,s=!1,c=!1,l=void 0;a()}function r(e,t,n){function r(e,t,r){i||(t?(i=!0,n(t)):(o[e]=r,(i=++s===a)&&n(null,o)))}var a=e.length,o=[];if(0===a)return n(null,o);var i=!1,s=0;e.forEach(function(e,n){t(e,n,function(e,t){r(n,e,t)})})}t.__esModule=!0,t.loopAsync=n,t.mapAsync=r},function(e,t,n){"use strict";function r(e,t){if(e==t)return!0;if(null==e||null==t)return!1;if(Array.isArray(e))return Array.isArray(t)&&e.length===t.length&&e.every(function(e,n){return r(e,t[n])});if("object"===(void 0===e?"undefined":c(e))){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n))if(void 0===e[n]){if(void 0!==t[n])return!1}else{if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!r(e[n],t[n]))return!1}return!0}return String(e)===String(t)}function a(e,t){return"/"!==t.charAt(0)&&(t="/"+t),"/"!==e.charAt(e.length-1)&&(e+="/"),"/"!==t.charAt(t.length-1)&&(t+="/"),t===e}function o(e,t,n){for(var r=e,a=[],o=[],i=0,s=t.length;i=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return 0===e.button}function i(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function s(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function c(e,t){var n=t.query,r=t.hash,a=t.state;return n||r||a?{pathname:e,query:n,hash:r,state:a}:e}t.__esModule=!0;var l=Object.assign||function(e){for(var t=1;t=0;r--){var a=e[r],o=a.path||"";if(n=o.replace(/\/*$/,"/")+n,0===o.indexOf("/"))break}return"/"+n}},propTypes:{path:p,from:p,to:p.isRequired,query:f,state:f,onEnter:u.falsy,children:u.falsy},render:function(){(0,s.default)(!1)}});t.default=h,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var a=n(142),o=r(a),i=n(193),s=(r(i),n(188)),c=r(s),l=n(190),u=n(195),d=o.default.PropTypes.func,p=o.default.createClass({displayName:"IndexRoute",statics:{createRouteFromReactElement:function(e,t){t&&(t.indexRoute=(0,l.createRouteFromReactElement)(e))}},propTypes:{path:u.falsy,component:u.component,components:u.components,getComponent:d,getComponents:d},render:function(){(0,c.default)(!1)}});t.default=p,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var a=n(142),o=r(a),i=n(188),s=r(i),c=n(190),l=n(195),u=o.default.PropTypes,d=u.string,p=u.func,f=o.default.createClass({displayName:"Route",statics:{createRouteFromReactElement:c.createRouteFromReactElement},propTypes:{path:d,component:l.component,components:l.components,getComponent:p,getComponents:p},render:function(){(0,s.default)(!1)}});t.default=f,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var r=n(193),a=(function(e){e&&e.__esModule}(r),n(195)),o={contextTypes:{history:a.history},componentWillMount:function(){this.history=this.context.history}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var a=n(193),o=(r(a),n(142)),i=r(o),s=n(188),c=r(s),l=i.default.PropTypes.object,u={contextTypes:{history:l.isRequired,route:l},propTypes:{route:l},componentDidMount:function(){this.routerWillLeave||(0,c.default)(!1);var e=this.props.route||this.context.route;e||(0,c.default)(!1), -this._unlistenBeforeLeavingRoute=this.context.history.listenBeforeLeavingRoute(e,this.routerWillLeave)},componentWillUnmount:function(){this._unlistenBeforeLeavingRoute&&this._unlistenBeforeLeavingRoute()}};t.default=u,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var a=n(193),o=(r(a),n(142)),i=r(o),s=i.default.PropTypes.object,c={propTypes:{route:s.isRequired},childContextTypes:{route:s.isRequired},getChildContext:function(){return{route:this.props.route}},componentWillMount:function(){}};t.default=c,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=t.routes,r=a(t,["routes"]),o=(0,c.default)(e)(r),s=(0,u.default)(o,n);return i({},o,s)}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e,t){var n=e.history,r=e.routes,o=e.location,c=a(e,["history","routes","location"]);n||o||(0,l.default)(!1),n=n||(0,d.default)(c);var u=(0,f.default)(n,(0,h.createRoutes)(r)),p=void 0;o?o=n.createLocation(o):p=n.listen(function(e){o=e});var _=(0,m.createRouterObject)(n,u);n=(0,m.createRoutingHistory)(n,u),u.match(o,function(e,r,a){t(e,r&&_.createLocation(r,s.REPLACE),a&&i({},a,{history:n,router:_,matchContext:{history:n,transitionManager:u,router:_}})),p&&p()})}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t1?t-1:0),o=1;o=0&&t=0&&_0&&void 0!==arguments[0]?arguments[0]:o,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,i=t.payload;return n===a?r({},e,{locationBeforeTransitions:i}):e}Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:{},r=n.selectLocationState,s=void 0===r?i:r,c=n.adjustUrlOnReplay,l=void 0===c||c;if(void 0===s(t.getState()))throw new Error("Expected the routing state to be available either as `state.routing` or as the custom expression you can specify as `selectLocationState` in the `syncHistoryWithStore()` options. Ensure you have added the `routerReducer` to your store's reducers via `combineReducers` or whatever method you use to isolate your reducers.");var u=void 0,d=void 0,p=void 0,f=void 0,h=void 0,m=function(e){return s(t.getState()).locationBeforeTransitions||(e?u:void 0)};if(u=m(),l){var _=function(){var t=m(!0);h!==t&&u!==t&&(d=!0,h=t,e.transitionTo(a({},t,{action:"PUSH"})),d=!1)};p=t.subscribe(_),_()}var M=function(e){d||(h=e,!u&&(u=e,m())||t.dispatch({type:o.LOCATION_CHANGE,payload:e}))};return f=e.listen(M),e.getCurrentLocation&&M(e.getCurrentLocation()),a({},e,{listen:function(n){var r=m(!0),a=!1,o=t.subscribe(function(){var e=m(!0);e!==r&&(r=e,a||n(r))});return e.getCurrentLocation||n(r),function(){a=!0,o()}},unsubscribe:function(){l&&p(),f()}})}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t=0&&0===window.sessionStorage.length)return;throw e}}function o(e){var t=void 0;try{t=window.sessionStorage.getItem(r(e))}catch(e){if(e.name===l)return null}if(t)try{return JSON.parse(t)}catch(e){}return null}t.__esModule=!0,t.saveState=a,t.readState=o;var i=n(257),s=(function(e){e&&e.__esModule}(i),"@@History/"),c=["QuotaExceededError","QUOTA_EXCEEDED_ERR"],l="SecurityError"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e){function t(e){return c.canUseDOM||s.default(!1),n.listen(e)}var n=d.default(o({getUserConfirmation:l.getUserConfirmation},e,{go:l.go}));return o({},n,{listen:t})}t.__esModule=!0;var o=Object.assign||function(e){for(var t=1;t=0&&t=0&&_=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return function(){function t(e){return v&&null==e.basename&&(0===e.pathname.indexOf(v)?(e.pathname=e.pathname.substring(v.length),e.basename=v,""===e.pathname&&(e.pathname="/")):e.basename=""),e}function n(e){if(!v)return e;"string"==typeof e&&(e=c.parsePath(e));var t=e.pathname,n="/"===v.slice(-1)?v:v+"/",r="/"===t.charAt(0)?t.slice(1):t;return i({},e,{pathname:n+r})}function r(e){return y.listenBefore(function(n,r){u.default(e,t(n),r)})}function o(e){return y.listen(function(n){e(t(n))})}function l(e){y.push(n(e))}function d(e){y.replace(n(e))}function f(e){return y.createPath(n(e))}function h(e){return y.createHref(n(e))}function m(e){for(var r=arguments.length,a=Array(r>1?r-1:0),o=1;o0&&(p=p.filter(function(t){return t!==e}),0===p.length&&u())}var l=e(t),u=void 0,p=[];return i({},l,{listenBeforeUnload:r,registerBeforeUnloadHook:d.default(o,"registerBeforeUnloadHook is deprecated; use listenBeforeUnload instead"),unregisterBeforeUnloadHook:d.default(s,"unregisterBeforeUnloadHook is deprecated; use the callback returned from listenBeforeUnload instead")})}}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function o(e){return l.stringify(e).replace(/%20/g,"+")}function i(e){return function(){function t(e){if(null==e.query){var t=e.search;e.query=A(t.substring(1)),e[m]={search:t,searchBase:""}}return e}function n(e,t){var n,r=e[m],a=t?y(t):"";if(!r&&!a)return e;"string"==typeof e&&(e=p.parsePath(e));var o=void 0;o=r&&e.search===r.search?r.searchBase:e.search||"";var i=o;return a&&(i+=(i?"&":"?")+a),s({},e,(n={search:i},n[m]={search:i,searchBase:o},n))}function r(e){return T.listenBefore(function(n,r){d.default(e,t(n),r)})}function i(e){return T.listen(function(n){e(t(n))})}function c(e){T.push(n(e,e.query))}function l(e){T.replace(n(e,e.query))}function u(e,t){return T.createPath(n(e,t||e.query))}function f(e,t){return T.createHref(n(e,t||e.query))}function M(e){for(var r=arguments.length,a=Array(r>1?r-1:0),o=1;o1?n[a-1]:void 0,s=a>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(a--,i):void 0,s&&o(n[0],n[1],s)&&(i=a<3?void 0:i,a=1),t=Object(t);++r0){if(++t>=r)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var r=800,a=16,o=Date.now;e.exports=n},function(e,t,n){function r(e,t,n){if(!s(n))return!1;var r=typeof t;return!!("number"==r?o(n)&&i(t,n.length):"string"==r&&t in n)&&a(n[t],e)}var a=n(288),o=n(300),i=n(302),s=n(283);e.exports=r},function(e,t,n){function r(e){return null!=e&&o(e.length)&&!a(e)}var a=n(282),o=n(301);e.exports=r},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}var r=9007199254740991;e.exports=n},function(e,t){function n(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||a.test(e))&&e>-1&&e%1==0&&e=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(325),a=n(326);e.exports=function(e){return function(t,n){var o,i,s=String(a(t)),c=r(n),l=s.length;return c<0||c>=l?e?"":void 0:(o=s.charCodeAt(c),o<55296||o>56319||c+1===l||(i=s.charCodeAt(c+1))<56320||i>57343?e?s.charAt(c):o:e?s.slice(c,c+2):i-56320+(o-55296<<10)+65536)}}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){"use strict";var r=n(328),a=n(329),o=n(344),i=n(334),s=n(345),c=n(346),l=n(347),u=n(363),d=n(365),p=n(364)("iterator"),f=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,m,_,M,g){l(n,t,m);var v,b,y,A=function(e){if(!f&&e in w)return w[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",T="values"==_,L=!1,w=e.prototype,k=w[p]||w["@@iterator"]||_&&w[_],S=k||A(_),C=_?T?A("entries"):S:void 0,O="Array"==t?w.entries||k:k;if(O&&(y=d(O.call(new e)))!==Object.prototype&&y.next&&(u(y,E,!0),r||s(y,p)||i(y,p,h)),T&&k&&"values"!==k.name&&(L=!0,S=function(){return k.call(this)}),r&&!g||!f&&!L&&w[p]||i(w,p,S),c[t]=S,c[E]=h,_)if(v={values:T?S:A("values"),keys:M?S:A("keys"),entries:C},g)for(b in v)b in w||o(w,b,v[b]);else a(a.P+a.F*(f||L),t,v);return v}},function(e,t){e.exports=!0},function(e,t,n){var r=n(330),a=n(331),o=n(332),i=n(334),s=function(e,t,n){var c,l,u,d=e&s.F,p=e&s.G,f=e&s.S,h=e&s.P,m=e&s.B,_=e&s.W,M=p?a:a[t]||(a[t]={}),g=M.prototype,v=p?r:f?r[t]:(r[t]||{}).prototype;p&&(n=t);for(c in n)(l=!d&&v&&void 0!==v[c])&&c in M||(u=l?v[c]:n[c],M[c]=p&&"function"!=typeof v[c]?n[c]:m&&l?o(u,r):_&&v[c]==u?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(u):h&&"function"==typeof u?o(Function.call,u):u,h&&((M.virtual||(M.virtual={}))[c]=u,e&s.R&&g&&!g[c]&&i(g,c,u)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){var n=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(333);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,a){return e.call(t,n,r,a)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(335),a=n(343);e.exports=n(339)?function(e,t,n){return r.f(e,t,a(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var r=n(336),a=n(338),o=n(342),i=Object.defineProperty;t.f=n(339)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),a)try{return i(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var r=n(337);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(339)&&!n(340)(function(){return 7!=Object.defineProperty(n(341)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){e.exports=!n(340)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var r=n(337),a=n(330).document,o=r(a)&&r(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},function(e,t,n){var r=n(337);e.exports=function(e,t){if(!r(e))return e;var n,a;if(t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;if("function"==typeof(n=e.valueOf)&&!r(a=n.call(e)))return a;if(!t&&"function"==typeof(n=e.toString)&&!r(a=n.call(e)))return a;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){e.exports=n(334)},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports={}},function(e,t,n){"use strict";var r=n(348),a=n(343),o=n(363),i={};n(334)(i,n(364)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(i,{next:a(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(336),a=n(349),o=n(361),i=n(358)("IE_PROTO"),s=function(){},c=function(){var e,t=n(341)("iframe"),r=o.length;for(t.style.display="none",n(362).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(""; + + $custom_vars_string = implode( "\r\n", $custom_vars ); + $async_code = str_replace( '%custom_vars%', $custom_vars_string, $async_code ); + + echo "$async_code\r\n"; + } + + /** + * 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 ) { + if ( Jetpack_Google_Analytics_Options::anonymize_ip_is_enabled() ) { + 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; + } + + if ( ! Jetpack_Google_Analytics_Options::has_tracking_code() ) { + return; + } + + // Ref: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingEcommerce#Example + if ( ! Jetpack_Google_Analytics_Options::track_purchases_is_enabled() ) { + return $custom_vars; + } + + $minimum_woocommerce_active = class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.0', '>=' ); + if ( $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'], + Jetpack_Google_Analytics_Utils::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; + } + + /** + * 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; + } + + if ( ! Jetpack_Google_Analytics_Options::has_tracking_code() ) { + return; + } + + if ( ! Jetpack_Google_Analytics_Options::track_add_to_cart_is_enabled() ) { + return; + } + + 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]); + } ); + } );" + ); + } + } +} diff --git a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-options.php b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-options.php new file mode 100644 index 00000000..b6e208b7 --- /dev/null +++ b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-options.php @@ -0,0 +1,70 @@ +\r\n"; + return; + } + + // If we're in the admin_area, return without inserting code. + if ( is_admin() ) { + return; + } + + // At this time, we only leverage universal analytics for enhanced ecommerce. If WooCommerce is not + // present, don't bother emitting the tracking ID or fetching analytics.js + if ( ! class_exists( 'WooCommerce' ) ) { + return; + } + + /** + * Allow for additional elements to be added to the universal Google Analytics queue (ga) array + * + * @since 5.6.0 + * + * @param array $custom_vars Array of universal Google Analytics queue elements + */ + $universal_commands = apply_filters( 'jetpack_wga_universal_commands', array() ); + + $async_code = " + + + + + "; + $async_code = str_replace( '%tracking_id%', $tracking_code, $async_code ); + + $universal_commands_string = implode( "\r\n", $universal_commands ); + $async_code = str_replace( '%universal_commands%', $universal_commands_string, $async_code ); + + echo "$async_code\r\n"; + } + + public function maybe_anonymize_ip( $command_array ) { + if ( Jetpack_Google_Analytics_Options::anonymize_ip_is_enabled() ) { + array_push( $command_array, "ga( 'set', 'anonymizeIp', true );" ); + } + + return $command_array; + } + + public function maybe_track_purchases( $command_array ) { + global $wp; + + if ( ! Jetpack_Google_Analytics_Options::track_purchases_is_enabled() ) { + return $command_array; + } + + if ( ! class_exists( 'WooCommerce' ) ) { + return $command_array; + } + + $minimum_woocommerce_active = class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.0', '>=' ); + if ( ! $minimum_woocommerce_active ) { + return $command_array; + } + + if ( ! is_order_received_page() ) { + return $command_array; + } + + $order_id = isset( $wp->query_vars['order-received'] ) ? $wp->query_vars['order-received'] : 0; + if ( 0 == $order_id ) { + return $command_array; + } + + // A 1 indicates we've already tracked this order - don't do it again + if ( 1 == get_post_meta( $order_id, '_ga_tracked', true ) ) { + return $command_array; + } + + $order = new WC_Order( $order_id ); + $order_currency = $order->get_currency(); + $command = "ga( 'set', '&cu', '" . esc_js( $order_currency ) . "' );"; + array_push( $command_array, $command ); + + // Order items + if ( $order->get_items() ) { + foreach ( $order->get_items() as $item ) { + $product = $order->get_product_from_item( $item ); + $product_sku_or_id = Jetpack_Google_Analytics_Utils::get_product_sku_or_id( $product ); + + $item_details = array( + 'id' => $product_sku_or_id, + 'name' => $item['name'], + 'category' => Jetpack_Google_Analytics_Utils::get_product_categories_concatenated( $product ), + 'price' => $order->get_item_total( $item ), + 'quantity' => $item['qty'], + ); + $command = "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . " );"; + array_push( $command_array, $command ); + } + } + + // Order summary + $summary = array( + 'id' => $order->get_order_number(), + 'affiliation' => get_bloginfo( 'name' ), + 'revenue' => $order->get_total(), + 'tax' => $order->get_total_tax(), + 'shipping' => $order->get_total_shipping() + ); + $command = "ga( 'ec:setAction', 'purchase', " . wp_json_encode( $summary ) . " );"; + array_push( $command_array, $command ); + + update_post_meta( $order_id, '_ga_tracked', 1 ); + + return $command_array; + } + + public function add_to_cart() { + if ( ! Jetpack_Google_Analytics_Options::track_add_to_cart_is_enabled() ) { + return; + } + + if ( ! is_single() ) { + return; + } + + global $product; + + $product_sku_or_id = Jetpack_Google_Analytics_Utils::get_product_sku_or_id( $product ); + $selector = ".single_add_to_cart_button"; + + wc_enqueue_js( + "$( '" . esc_js( $selector ) . "' ).click( function() { + var productDetails = { + 'id': '" . esc_js( $product_sku_or_id ) . "', + 'name' : '" . esc_js( $product->get_title() ) . "', + 'quantity': $( 'input.qty' ).val() ? $( 'input.qty' ).val() : '1', + }; + ga( 'ec:addProduct', productDetails ); + ga( 'ec:setAction', 'add' ); + ga( 'send', 'event', 'UX', 'click', 'add to cart' ); + } );" + ); + } + + public function loop_add_to_cart() { + if ( ! Jetpack_Google_Analytics_Options::track_add_to_cart_is_enabled() ) { + return; + } + + if ( ! class_exists( 'WooCommerce' ) ) { + return; + } + + $minimum_woocommerce_active = class_exists( 'WooCommerce' ) && version_compare( WC_VERSION, '3.0', '>=' ); + if ( ! $minimum_woocommerce_active ) { + return; + } + + $selector = ".add_to_cart_button:not(.product_type_variable, .product_type_grouped)"; + + wc_enqueue_js( + "$( '" . esc_js( $selector ) . "' ).click( function() { + var productSku = $( this ).data( 'product_sku' ); + var productID = $( this ).data( 'product_id' ); + var productDetails = { + 'id': productSku ? productSku : '#' + productID, + 'quantity': $( this ).data( 'quantity' ), + }; + ga( 'ec:addProduct', productDetails ); + ga( 'ec:setAction', 'add' ); + ga( 'send', 'event', 'UX', 'click', 'add to cart' ); + } );" + ); + } + + public function remove_from_cart() { + if ( ! Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { + return; + } + + if ( ! Jetpack_Google_Analytics_Options::track_remove_from_cart_is_enabled() ) { + return; + } + + // We listen at div.woocommerce because the cart 'form' contents get forcibly + // updated and subsequent removals from cart would then not have this click + // handler attached + wc_enqueue_js( + "$( 'div.woocommerce' ).on( 'click', 'a.remove', function() { + var productSku = $( this ).data( 'product_sku' ); + var productID = $( this ).data( 'product_id' ); + var quantity = $( this ).parent().parent().find( '.qty' ).val() + var productDetails = { + 'id': productSku ? productSku : '#' + productID, + 'quantity': quantity ? quantity : '1', + }; + ga( 'ec:addProduct', productDetails ); + ga( 'ec:setAction', 'remove' ); + ga( 'send', 'event', 'UX', 'click', 'remove from cart' ); + } );" + ); + } + + /** + * Adds the product ID and SKU to the remove product link (for use by remove_from_cart above) if not present + */ + public function remove_from_cart_attributes( $url, $key ) { + if ( false !== strpos( $url, 'data-product_id' ) ) { + return $url; + } + + $item = WC()->cart->get_cart_item( $key ); + $product = $item[ 'data' ]; + + $new_attributes = sprintf( 'href="%s" data-product_id="%s" data-product_sku="%s"', + esc_attr( $url ), + esc_attr( $product->get_id() ), + esc_attr( $product->get_sku() ) + ); + $url = str_replace( 'href=', $new_attributes ); + return $url; + } + + public function listing_impression() { + if ( ! Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { + return; + } + + if ( ! Jetpack_Google_Analytics_Options::track_product_impressions_is_enabled() ) { + return; + } + + if ( isset( $_GET['s'] ) ) { + $list = "Search Results"; + } else { + $list = "Product List"; + } + + global $product, $woocommerce_loop; + $product_sku_or_id = Jetpack_Google_Analytics_Utils::get_product_sku_or_id( $product ); + + $item_details = array( + 'id' => $product_sku_or_id, + 'name' => $product->get_title(), + 'category' => Jetpack_Google_Analytics_Utils::get_product_categories_concatenated( $product ), + 'list' => $list, + 'position' => $woocommerce_loop['loop'] + ); + wc_enqueue_js( "ga( 'ec:addImpression', " . wp_json_encode( $item_details ) . " );" ); + } + + public function listing_click() { + if ( ! Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { + return; + } + + if ( ! Jetpack_Google_Analytics_Options::track_product_clicks_is_enabled() ) { + return; + } + + if ( isset( $_GET['s'] ) ) { + $list = "Search Results"; + } else { + $list = "Product List"; + } + + global $product, $woocommerce_loop; + $product_sku_or_id = Jetpack_Google_Analytics_Utils::get_product_sku_or_id( $product ); + + $selector = ".products .post-" . esc_js( $product->get_id() ) . " a"; + + $item_details = array( + 'id' => $product_sku_or_id, + 'name' => $product->get_title(), + 'category' => Jetpack_Google_Analytics_Utils::get_product_categories_concatenated( $product ), + 'position' => $woocommerce_loop['loop'] + ); + + wc_enqueue_js( + "$( '" . esc_js( $selector ) . "' ).click( function() { + if ( true === $( this ).hasClass( 'add_to_cart_button' ) ) { + return; + } + + ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . " ); + ga( 'ec:setAction', 'click', { list: '" . esc_js( $list ) . "' } ); + ga( 'send', 'event', 'UX', 'click', { list: '" . esc_js( $list ) . "' } ); + } );" + ); + } + + public function product_detail() { + if ( ! Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { + return; + } + + if ( ! Jetpack_Google_Analytics_Options::track_product_detail_view_is_enabled() ) { + return; + } + + global $product; + $product_sku_or_id = Jetpack_Google_Analytics_Utils::get_product_sku_or_id( $product ); + + $item_details = array( + 'id' => $product_sku_or_id, + 'name' => $product->get_title(), + 'category' => Jetpack_Google_Analytics_Utils::get_product_categories_concatenated( $product ), + 'price' => $product->get_price() + ); + wc_enqueue_js( + "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . " );" . + "ga( 'ec:setAction', 'detail' );" + ); + } + + public function checkout_process() { + if ( ! Jetpack_Google_Analytics_Options::enhanced_ecommerce_tracking_is_enabled() ) { + return; + } + + if ( ! Jetpack_Google_Analytics_Options::track_checkout_started_is_enabled() ) { + return; + } + + $universal_commands = array(); + $cart = WC()->cart->get_cart(); + + foreach ( $cart as $cart_item_key => $cart_item ) { + /** + * This filter is already documented in woocommerce/templates/cart/cart.php + */ + $product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); + $product_sku_or_id = Jetpack_Google_Analytics_Utils::get_product_sku_or_id( $product ); + + $item_details = array( + 'id' => $product_sku_or_id, + 'name' => $product->get_title(), + 'category' => Jetpack_Google_Analytics_Utils::get_product_categories_concatenated( $product ), + 'price' => $product->get_price(), + 'quantity' => $cart_item[ 'quantity' ] + ); + + array_push( $universal_commands, "ga( 'ec:addProduct', " . wp_json_encode( $item_details ) . " );" ); + } + + array_push( $universal_commands, "ga( 'ec:setAction','checkout' );" ); + + wc_enqueue_js( implode( "\r\n", $universal_commands ) ); + } + + public function send_pageview_in_footer() { + if ( ! Jetpack_Google_Analytics_Options::has_tracking_code() ) { + return; + } + + if ( is_admin() ) { + return; + } + + if ( ! class_exists( 'WooCommerce' ) ) { + return; + } + + wc_enqueue_js( "ga( 'send', 'pageview' );" ); + } +} \ No newline at end of file diff --git a/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-utils.php b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-utils.php new file mode 100644 index 00000000..807461de --- /dev/null +++ b/plugins/jetpack/modules/google-analytics/classes/wp-google-analytics-utils.php @@ -0,0 +1,63 @@ +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; + } + + /** + * Gets a product's SKU with fallback to just ID. IDs are prepended with a hash symbol. + * @param WC_Product + * @return string + */ + public static function get_product_sku_or_id( $product ) { + if ( ! class_exists( 'WooCommerce' ) ) { + return ''; + } + + if ( ! $product ) { + return ''; + } + + return $product->get_sku() ? $product->get_sku() : '#' . $product->get_id(); + } +} \ No newline at end of file diff --git a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php index 4176c976..b4824a6a 100644 --- a/plugins/jetpack/modules/google-analytics/wp-google-analytics.php +++ b/plugins/jetpack/modules/google-analytics/wp-google-analytics.php @@ -1,6 +1,6 @@ $value ) { - if ( strpos( strtolower( $value ), strtolower( $site_url ) ) === 0 ) { - $track[ $k ] = substr( $track[ $k ], strlen( $site_url ) ); - } - if ( 'data' === $k ) { - $track[ $k ] = preg_replace( '/^https?:\/\/|^\/+/i', '', $track[ $k ] ); - } - - // This way we don't lose search data. - if ( 'data' === $k && 'search' === $track['code'] ) { - $track[ $k ] = rawurlencode( $track[ $k ] ); - } else { - $track[ $k ] = preg_replace( '/[^a-z0-9\.\/\+\?=-]+/i', '_', $track[ $k ] ); - } - - $track[ $k ] = trim( $track[ $k ], '_' ); - } - $char = ( strpos( $track['data'], '?' ) === false ) ? '?' : '&'; - return str_replace( "'", "\'", "/{$track['code']}/{$track['data']}{$char}referer=" . rawurlencode( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '' ) ); // Input var okay. - } - - /** - * Maybe output or return, depending on the context - */ - private function _output_or_return( $val, $maybe ) { - if ( $maybe ) { - echo $val . "\r\n"; - } else { - return $val; - } - } - - /** - * This injects the Google Analytics code into the footer of the page. - * - * @param bool[optional] $output - defaults to true, false returns but does NOT echo the code. - */ - public function insert_code( $output = true ) { - // If $output is not a boolean false, set it to true (default). - $output = ( false !== $output); - - $tracking_id = $this->_get_tracking_code(); - if ( empty( $tracking_id ) ) { - return $this->_output_or_return( '', $output ); - } - - // If we're in the admin_area, return without inserting code. - if ( is_admin() ) { - return $this->_output_or_return( '', $output ); - } - - $custom_vars = array( - "_gaq.push(['_setAccount', '{$tracking_id}']);", - ); - - $track = array(); - if ( is_404() ) { - // This is a 404 and we are supposed to track them. - $custom_vars[] = "_gaq.push(['_trackEvent', '404', document.location.href, document.referrer]);"; - } elseif ( is_search() ) { - // Set track for searches, if it's a search, and we are supposed to. - $track['data'] = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // Input var okay. - $track['code'] = 'search'; - } - - if ( ! empty( $track ) ) { - $track['url'] = $this->_get_url( $track ); - // adjust the code that we output, account for both types of tracking. - $track['url'] = esc_js( str_replace( '&', '&', $track['url'] ) ); - $custom_vars[] = "_gaq.push(['_trackPageview','{$track['url']}']);"; - } else { - $custom_vars[] = "_gaq.push(['_trackPageview']);"; - } - - /** - * 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 = " - "; - - $custom_vars_string = implode( "\r\n", $custom_vars ); - $async_code = str_replace( '%custom_vars%', $custom_vars_string, $async_code ); - - return $this->_output_or_return( $async_code, $output ); - } - - /** - * Used to get the tracking code option - * - * @return tracking code option value. - */ - private function _get_tracking_code() { - $o = get_option( 'jetpack_wga' ); - - if ( isset( $o['code'] ) && preg_match( '#UA-[\d-]+#', $o['code'], $matches ) ) { - return $o['code']; - } - - return ''; - } - - /** - * 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/lazy-images.php b/plugins/jetpack/modules/lazy-images.php new file mode 100644 index 00000000..d0dd0a38 --- /dev/null +++ b/plugins/jetpack/modules/lazy-images.php @@ -0,0 +1,27 @@ +} immediateImages List of lazy-loaded images to load immediately. + */ + function loadImagesImmediately( immediateImages ) { + var i; + + // foreach() is not supported in IE + for ( i = 0; i < immediateImages.length; i++ ) { + var image = immediateImages[ i ]; + applyImage( image ); + } + } + + /** + * On intersection + * @param {array} entries List of elements being observed. + */ + function onIntersection( entries ) { + var i; + + // Disconnect if we've already loaded all of the images + if ( imageCount === 0 ) { + observer.disconnect(); + } + + // Loop through the entries + for ( i = 0; i < entries.length; i++ ) { + var entry = entries[ i ]; + + // Are we in viewport? + if ( entry.intersectionRatio > 0 ) { + imageCount--; + + // Stop watching and load the image + observer.unobserve( entry.target ); + applyImage( entry.target ); + } + } + } + + /** + * Apply the image + * @param {object} image The image object. + */ + function applyImage( image ) { + var src = image.getAttribute( 'data-lazy-src' ), + srcset = image.getAttribute( 'data-lazy-srcset' ), + sizes = image.getAttribute( 'data-lazy-sizes' ); + + if ( ! src ) { + return; + } + + // Prevent this from being lazy loaded a second time. + image.classList && image.classList.add( 'jetpack-lazy-image--handled' ); + image.setAttribute( 'data-lazy-loaded', '1' ); + + image.setAttribute( 'src', src ); + image.removeAttribute( 'data-lazy-src' ); + + if ( srcset ) { + image.setAttribute( 'srcset', srcset ); + image.removeAttribute( 'data-lazy-srcset' ); + } + + if ( sizes ) { + image.setAttribute( 'sizes', sizes ); + image.removeAttribute( 'data-lazy-sizes' ); + } + } +}; + +/** + * The following is an Intersection observer polyfill which is licensed under MIT + * and can be found at https://github.com/que-etc/intersection-observer-polyfill + */ + +/* + * The MIT License (MIT) + * + * Copyright (c) 2016 Denis Rul + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* jshint ignore:start */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IntersectionObserver=e():t.IntersectionObserver=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=n(o),s=void 0;s="function"==typeof window.IntersectionObserver?window.IntersectionObserver:i["default"],e["default"]=s,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},s=function(){function t(t,e){for(var r=0;r=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var s=i;t.call(e,s[1],s[0])}},i(e,[{key:"size",get:function(){return this.__entries__.length}}]),e}(a)}();e.Map=u,e.WeakMap=a},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){var e=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=!1;return function(){for(var n=this,o=arguments.length,i=Array(o),s=0;s=e.length)break;o=e[n++]}else{if(n=e.next(),n.done)break;o=n.value}var i=o;i.updateObservations()&&(t=!0),i.hasEntries()&&i.notifySubscriber()}return t},t.prototype.startUpdateCycle=function(){this._cycleStartTime=(0,u["default"])(),this.scheduleUpdate()},t.prototype.scheduleUpdate=function(t){var e="number"==typeof t;if(e){var r=this._updateObservers();if(this._isUpdateScheduled=!1,!this._wasCycleStarted())return;r?this.startUpdateCycle():this._hasIdleTimeEnded()?this._onCycleEnded():this.scheduleUpdate()}else this._isUpdateScheduled||(l(this.scheduleUpdate),this._isUpdateScheduled=!0)},t.prototype._hasIdleTimeEnded=function(){return(0,u["default"])()-this._cycleStartTime>this._idleTimeout},t.prototype._wasCycleStarted=function(){return this._cycleStartTime!==-1},t.prototype._onCycleEnded=function(){this._cycleStartTime=-1,this._repeatCycle&&(this._cycleStartTime=0,this._repeatHandler())},t.prototype._initListeners=function(){this._isListening||(this._isListening=!0,window.addEventListener("resize",this.startUpdateCycle,!0),window.addEventListener("scroll",this.scheduleUpdate,!0),this._trackHovers&&this._addHoverListener(),c?(this._mutationsObserver=new MutationObserver(this._onMutation),this._mutationsObserver.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(this._repeatCycle=!0,window.addEventListener("click",this.startUpdateCycle,!0),this.startUpdateCycle()))},t.prototype._removeListeners=function(){this._isListening&&(window.removeEventListener("resize",this.startUpdateCycle,!0),window.removeEventListener("scroll",this.scheduleUpdate,!0),this._removeHoverListener(),c?this._mutationsObserver&&(this._mutationsObserver.disconnect(),this._mutationsObserver=null):(this._repeatCycle=!1,window.removeEventListener("click",this.startUpdateCycle,!0)),this._isListening=!1)},t.prototype.enableHover=function(){this._trackHovers=!0,this._isListening&&this._addHoverListener()},t.prototype.disableHover=function(){this._trackHovers=!1,this._removeHoverListener()},t.prototype.isHoverEnabled=function(){return this._trackHovers},t.prototype._addHoverListener=function(){this._hoverInitiated||(window.addEventListener("mouseover",this._onMouseOver,!0),this._hoverInitiated=!0)},t.prototype._removeHoverListener=function(){this._hoverInitiated&&(window.removeEventListener("mouseover",this._onMouseOver,!0),this._hoverInitiated=!1)},t.prototype._onMutation=function(t){var e=t.every(function(t){return"attributes"!==t.type});e?this.scheduleUpdate():this.startUpdateCycle()},s(t,[{key:"idleTimeout",get:function(){return this._idleTimeout},set:function(t){this._idleTimeout=t}}]),t}();e["default"]=h,t.exports=e["default"]},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=function(){return window.performance&&window.performance.now?function(){return window.performance.now()}:function(){return Date.now()}}(),t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=t;return Array.isArray(t)?t.length||(e=[0]):e=[t],e.map(function(t){if(t=Number(t),!window.isFinite(t))throw new TypeError("The provided double value is non-finite.");if(t<0||t>1)throw new RangeError("Threshold values must be between 0 and 1.");return t}).sort()}function s(){var t=arguments.length<=0||void 0===arguments[0]?"0px":arguments[0];if(t=(t+"").split(/\s+/),t.length>4)throw new Error("Extra text found at the end of rootMargin.");t[0]=t[0]||"0px",t[1]=t[1]||t[0],t[2]=t[2]||t[0],t[3]=t[3]||t[1];var e=t.join(" "),r=t.map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t)||[],r=e[1],n=e[2],o="px"===n;if(r=parseFloat(r),!window.isFinite(r))throw new Error("rootMargin must be specified in pixels or percent.");return o||(r/=100),{value:r,pixels:o}});return{rawData:e,parsedData:r}}function a(t,e){e=e.map(function(e,r){var n=e.value;return e.pixels||(n*=r%2?t.width:t.height),n});var r={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return r.width=r.right-r.left,r.height=r.bottom-r.top,r}Object.defineProperty(e,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},c=r(2),l=r(6),h=r(7),f=n(h),p=function(){function t(e){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=arguments[2],a=arguments[3];if(o(this,t),"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");if("object"!==("undefined"==typeof r?"undefined":u(r)))throw new TypeError("parameter 2 is not an object.");if("root"in r&&!(r.root instanceof Element))throw new TypeError("member root is not of type Element.");var l=i(r.threshold),h=s(r.rootMargin);this.root=r.root||null,this.rootMargin=h.rawData,this.thresholds=Object.freeze(l),this._root=r.root||document.documentElement,this._callback=e,this._rootMargin=h.parsedData,this._targets=new c.Map,this._quedEntries=[],this._publicObserver=a||this,this.controller=n}return t.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(t instanceof Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this._targets;e.has(t)||(e.set(t,new f["default"](t,this)),this.controller.isConnected(this)||this.controller.connect(this),this.controller.startUpdateCycle())},t.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(t instanceof Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this._targets;e.has(t)&&e["delete"](t),e.size||this.disconnect()},t.prototype.disconnect=function(){this._targets.clear(),this.controller.disconnect(this)},t.prototype.takeRecords=function(){return this._quedEntries.splice(0)},t.prototype.notifySubscriber=function(){var t=this.takeRecords(),e=this._publicObserver;t.length&&this._callback.call(e,t,e)},t.prototype.queueEntry=function(t){this._quedEntries.push(t)},t.prototype.hasEntries=function(){return!!this._quedEntries.length},t.prototype.updateObservations=function(){var t=this._root,e=this.getRootRect(),r=!1;return this._targets.forEach(function(n){var o=n.updateIntersection(t,e);(o.ratioChanged||o.targetRectChanged)&&(r=!0)}),r},t.prototype.getThresholdGreaterThan=function(t){for(var e=this.thresholds,r=e.length,n=0;n=r.length)break;i=r[o++]}else{if(o=r.next(),o.done)break;i=o.value}var s=i;e[s]={value:t[s]}}return Object.defineProperties({},e)}function n(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],e=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=arguments.length<=2||void 0===arguments[2]?0:arguments[2],n=arguments.length<=3||void 0===arguments[3]?0:arguments[3];return{left:t,top:e,width:r,height:n,bottom:e+n,right:t+r}}function o(t){return t===document.documentElement?n(0,0,t.clientWidth,t.clientHeight):t.getBoundingClientRect()}function i(t){return t.width*t.height}function s(t){return 0===t.height&&0===t.width}function a(t,e){return t.top===e.top&&t.left===e.left&&t.right===e.right&&t.bottom===e.bottom}Object.defineProperty(e,"__esModule",{value:!0}),e.mapToClientRect=r,e.createRectangle=n,e.getRectangle=o,e.getArea=i,e.isEmpty=s,e.isEqual=a},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){var r=document.documentElement;return t!==r&&!r.contains(t)||!t.contains(e)}function s(t,e){var r=Math.max(e.left,t.left),n=Math.min(e.right,t.right),o=Math.max(e.top,t.top),i=Math.min(e.bottom,t.bottom),s=n-r,a=i-o;return(0,l.createRectangle)(r,o,s,a)}function a(t,e,r,n){for(var o=n,i=e.parentNode,a=!1;!a;){var u=null;i===t||1!==i.nodeType?(a=!0,u=r):"visible"!==window.getComputedStyle(i).overflow&&(u=(0,l.getRectangle)(i)),u&&(o=s(o,u)),i=i.parentNode}return o}Object.defineProperty(e,"__esModule",{value:!0});var u=r(4),c=n(u),l=r(6),h=r(8),f=n(h),p=(0,l.createRectangle)(),d=function(){function t(e,r){o(this,t),this.target=e,this.observer=r,this.prevTargetRect=p,this.prevThreshold=0,this.prevRatio=0}return t.prototype.updateIntersection=function(t,e){var r=(0,l.getRectangle)(this.target),n=this.getIntersectionData(t,e,r),o=+n.exists,i=n.ratio!==this.prevRatio,s=!(0,l.isEqual)(r,this.prevTargetRect),a=void 0;if(n.exists&&!(0,l.isEmpty)(r)&&(o=this.observer.getThresholdGreaterThan(n.ratio)),a=o!==this.prevThreshold,this.prevTargetRect=r,this.prevThreshold=o,this.prevRatio=n.ratio,n.exists||(n.ratio=0,n.rect=p),a){var u=new f["default"](this.target,r,n.rect,n.ratio,e,(0,c["default"])());this.observer.queueEntry(u)}return{ratioChanged:i,thresholdChanged:a,targetRectChanged:s}},t.prototype.getIntersectionData=function(t,e,r){var n=this.target;r||(r=(0,l.getRectangle)(this.target)),e||(e=(0,l.getRectangle)(t));var o=i(t,n),s=o?p:a(t,n,e,r),u=!o&&s.width>=0&&s.height>=0,c=(0,l.getArea)(s)/(0,l.getArea)(r)||0;return{rect:s,ratio:c,exists:u}},t}();e["default"]=d,t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=r(6),i=function s(t,e,r,i,a,u){n(this,s),Object.defineProperties(this,{boundingClientRect:{value:e},intersectionRatio:{value:i},intersectionRect:{value:(0,o.mapToClientRect)(r)},rootBounds:{value:(0,o.mapToClientRect)(a)},target:{value:t},time:{value:u}})};e["default"]=i,t.exports=e["default"]}])}); +/* jshint ignore:end */ + +// Let's kick things off now +jetpackLazyImagesModule( jQuery ); diff --git a/plugins/jetpack/modules/lazy-images/lazy-images.php b/plugins/jetpack/modules/lazy-images/lazy-images.php new file mode 100644 index 00000000..38610bab --- /dev/null +++ b/plugins/jetpack/modules/lazy-images/lazy-images.php @@ -0,0 +1,180 @@ + since it's mostly all metadata + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) ); + + // Do not lazy load avatar in admin bar + add_action( 'admin_bar_menu', array( $this, 'remove_filters' ), 0 ); + } + + public function setup_filters() { + add_filter( 'the_content', array( $this, 'add_image_placeholders' ), 99 ); // run this later, so other content filters have run, including image_add_wh on WP.com + add_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), 11 ); + add_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), 11 ); + } + + public function remove_filters() { + remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), 99 ); + remove_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), 11 ); + remove_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), 11 ); + } + + public function add_image_placeholders( $content ) { + // Don't lazyload for feeds, previews + if ( is_feed() || is_preview() ) { + return $content; + } + + // Don't lazy-load if the content has already been run through previously + if ( false !== strpos( $content, 'data-lazy-src' ) ) { + return $content; + } + + // Don't lazyload for amp-wp content + if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { + return $content; + } + + // This is a pretty simple regex, but it works + $content = preg_replace_callback( '#<(img)([^>]+?)(>(.*?)|[\/]?>)#si', array( __CLASS__, 'process_image' ), $content ); + + return $content; + } + + static function process_image( $matches ) { + $old_attributes_str = $matches[2]; + $old_attributes_kses_hair = wp_kses_hair( $old_attributes_str, wp_allowed_protocols() ); + + if ( empty( $old_attributes_kses_hair['src'] ) ) { + return $matches[0]; + } + + $old_attributes = self::flatten_kses_hair_data( $old_attributes_kses_hair ); + $new_attributes = $old_attributes; + + // Set placeholder and lazy-src + $new_attributes['src'] = self::get_placeholder_image(); + $new_attributes['data-lazy-src'] = $old_attributes['src']; + + // Handle `srcset` + if ( ! empty( $new_attributes['srcset'] ) ) { + $new_attributes['data-lazy-srcset'] = $old_attributes['srcset']; + unset( $new_attributes['srcset'] ); + } + + // Handle `sizes` + if ( ! empty( $new_attributes['sizes'] ) ) { + $new_attributes['data-lazy-sizes'] = $old_attributes['sizes']; + unset( $new_attributes['sizes'] ); + } + + /** + * Allow plugins and themes to override the attributes on the image before the content is updated. + * + * One potential use of this filter is for themes that set `height:auto` on the `img` tag. + * With this filter, the theme could get the width and height attributes from the + * $new_attributes array and then add a style tag that sets those values as well, which could + * minimize reflow as images load. + * + * @module lazy-images + * + * @since 5.6.0 + * + * @param array An array containing the attributes for the image, where the key is the attribute name + * and the value is the attribute value. + */ + $new_attributes = apply_filters( 'jetpack_lazy_images_new_attributes', $new_attributes ); + $new_attributes_str = self::build_attributes_string( $new_attributes ); + + return sprintf( '', $new_attributes_str, $matches[0] ); + } + + private static function get_placeholder_image() { + /** + * Allows plugins and themes to modify the placeholder image. + * + * This filter is not prefixed with jetpack_ to provide a smoother migration + * process from the WordPress Lazy Load plugin. + * + * @module lazy-images + * + * @since 5.6.0 + * + * @param string The URL to the placeholder image + */ + return apply_filters( + 'lazyload_images_placeholder_image', + plugins_url( 'modules/lazy-images/images/1x1.trans.gif', JETPACK__PLUGIN_FILE ) + ); + } + + private static function flatten_kses_hair_data( $attributes ) { + $flattened_attributes = array(); + foreach ( $attributes as $name => $attribute ) { + $flattened_attributes[ $name ] = $attribute['value']; + } + return $flattened_attributes; + } + + private static function build_attributes_string( $attributes ) { + $string = array(); + foreach ( $attributes as $name => $value ) { + if ( '' === $value ) { + $string[] = sprintf( '%s', $name ); + } else { + $string[] = sprintf( '%s="%s"', $name, esc_attr( $value ) ); + } + } + return implode( ' ', $string ); + } + + public function enqueue_assets() { + wp_enqueue_script( + 'jetpack-lazy-images', + plugins_url( 'modules/lazy-images/js/lazy-images.js', JETPACK__PLUGIN_FILE ), + array( 'jquery' ), + JETPACK__VERSION, + true + ); + } +} diff --git a/plugins/jetpack/modules/likes.php b/plugins/jetpack/modules/likes.php index 1a91899b..84204cc3 100644 --- a/plugins/jetpack/modules/likes.php +++ b/plugins/jetpack/modules/likes.php @@ -279,8 +279,23 @@ class Jetpack_Likes { * Register scripts */ function register_scripts() { - wp_register_script( 'postmessage', plugins_url( '_inc/postmessage.js', dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false ); - wp_register_script( 'jetpack_resize', plugins_url( '_inc/jquery.jetpack-resize.js' , dirname(__FILE__) ), array( 'jquery' ), JETPACK__VERSION, false ); + wp_register_script( + 'postmessage', + Jetpack::get_file_url_for_environment( '_inc/build/postmessage.min.js', '_inc/postmessage.js' ), + array( 'jquery' ), + JETPACK__VERSION, + false + ); + wp_register_script( + 'jetpack_resize', + Jetpack::get_file_url_for_environment( + '_inc/build/jquery.jetpack-resize.min.js', + '_inc/jquery.jetpack-resize.js' + ), + array( 'jquery' ), + JETPACK__VERSION, + false + ); wp_register_script( 'jetpack_likes_queuehandler', plugins_url( 'likes/queuehandler.js' , __FILE__ ), array( 'jquery', 'postmessage', 'jetpack_resize' ), JETPACK__VERSION, true ); } diff --git a/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php b/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php index ffb68741..38e5f235 100644 --- a/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php +++ b/plugins/jetpack/modules/likes/jetpack-likes-master-iframe.php @@ -4,7 +4,7 @@ * This function needs to get loaded after the like scripts get added to the page. */ function jetpack_likes_master_iframe() { - $version = '20170629'; + $version = '20171126'; $in_jetpack = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? false : true; $_locale = get_locale(); diff --git a/plugins/jetpack/modules/likes/queuehandler.js b/plugins/jetpack/modules/likes/queuehandler.js index 3eaeec38..1917ab9a 100644 --- a/plugins/jetpack/modules/likes/queuehandler.js +++ b/plugins/jetpack/modules/likes/queuehandler.js @@ -302,7 +302,7 @@ function jetpackLoadLikeWidgetIframe( wrapperID ) { commentLikesFrame.name = $wrapper.data( 'name' ); commentLikesFrame.src = $wrapper.data( 'src' ); commentLikesFrame.height = '18px'; - commentLikesFrame.width = '200px'; + commentLikesFrame.width = '100%'; commentLikesFrame.frameBorder = '0'; commentLikesFrame.scrolling = 'no'; diff --git a/plugins/jetpack/modules/masterbar.php b/plugins/jetpack/modules/masterbar.php index e80a8083..6672a992 100644 --- a/plugins/jetpack/modules/masterbar.php +++ b/plugins/jetpack/modules/masterbar.php @@ -13,13 +13,4 @@ include dirname( __FILE__ ) . '/masterbar/masterbar.php'; -Jetpack::dns_prefetch( array( - '//s0.wp.com', - '//s1.wp.com', - '//s2.wp.com', - '//0.gravatar.com', - '//1.gravatar.com', - '//2.gravatar.com', -) ); - new A8C_WPCOM_Masterbar; diff --git a/plugins/jetpack/modules/masterbar/masterbar.php b/plugins/jetpack/modules/masterbar/masterbar.php index 9cb2f58f..c634c9f8 100644 --- a/plugins/jetpack/modules/masterbar/masterbar.php +++ b/plugins/jetpack/modules/masterbar/masterbar.php @@ -31,6 +31,15 @@ class A8C_WPCOM_Masterbar { return; } + Jetpack::dns_prefetch( array( + '//s0.wp.com', + '//s1.wp.com', + '//s2.wp.com', + '//0.gravatar.com', + '//1.gravatar.com', + '//2.gravatar.com', + ) ); + // Atomic only - override user setting that hides masterbar from site's front. // https://github.com/Automattic/jetpack/issues/7667 if ( jetpack_is_atomic_site() ) { @@ -123,7 +132,12 @@ class A8C_WPCOM_Masterbar { wp_enqueue_style( 'noticons', $this->wpcom_static_url( '/i/noticons/noticons.css' ), array(), JETPACK__VERSION . '-' . gmdate( 'oW' ) ); } - wp_enqueue_script( 'jetpack-accessible-focus', plugins_url( '_inc/accessible-focus.js', JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION ); + wp_enqueue_script( + 'jetpack-accessible-focus', + Jetpack::get_file_url_for_environment( '_inc/build/accessible-focus.min.js', '_inc/accessible-focus.js' ), + 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 ); @@ -376,7 +390,12 @@ class A8C_WPCOM_Masterbar { $user_info = get_avatar( $this->user_email, 128, 'mm', '', array( 'force_display' => true ) ); $user_info .= '' . $this->display_name . ''; $user_info .= '@' . $this->user_login . ''; - $user_info .= '
'; + + $user_info .= sprintf( + '', + $logout_url, + esc_html__( 'Sign Out', 'jetpack' ) + ); $wp_admin_bar->add_menu( array( 'parent' => $id, @@ -728,7 +747,7 @@ class A8C_WPCOM_Masterbar { $wp_admin_bar->add_menu( array( 'parent' => 'publish', 'id' => 'comments', - 'title' => __( 'Comments', 'jetpack' ), + 'title' => __( 'Comments' ), 'href' => 'https://wordpress.com/comments/' . esc_attr( $this->primary_site_slug ), 'meta' => array( 'class' => 'mb-icon', diff --git a/plugins/jetpack/modules/masterbar/overrides.css b/plugins/jetpack/modules/masterbar/overrides.css index 4440c21c..a1c9a534 100644 --- a/plugins/jetpack/modules/masterbar/overrides.css +++ b/plugins/jetpack/modules/masterbar/overrides.css @@ -54,3 +54,8 @@ #wp-admin-bar-notes.active .noticon-bell:before { content: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cmVjdCB4PSIwIiBmaWxsPSJub25lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiLz48Zz48cGF0aCBmaWxsPSIjMjMyODJkIiBkPSJNNi4xNCAxNC45N2wyLjgyOCAyLjgyN2MtLjM2Mi4zNjItLjg2Mi41ODYtMS40MTQuNTg2LTEuMTA1IDAtMi0uODk1LTItMiAwLS41NTIuMjI0LTEuMDUyLjU4Ni0xLjQxNHptOC44NjcgNS4zMjRMMTQuMyAyMSAzIDkuN2wuNzA2LS43MDcgMS4xMDIuMTU3Yy43NTQuMTA4IDEuNjktLjEyMiAyLjA3Ny0uNTFsMy44ODUtMy44ODRjMi4zNC0yLjM0IDYuMTM1LTIuMzQgOC40NzUgMHMyLjM0IDYuMTM1IDAgOC40NzVsLTMuODg1IDMuODg2Yy0uMzg4LjM4OC0uNjE4IDEuMzIzLS41MSAyLjA3N2wuMTU3IDEuMXoiLz48L2c+PC9zdmc+") !important; } + +/* Fit width of sign out button to content */ +#wpadminbar .quicklinks li#wp-admin-bar-my-account #wp-admin-bar-user-info .ab-sign-out { + display: inline-block; +} diff --git a/plugins/jetpack/modules/masterbar/tracks-events.js b/plugins/jetpack/modules/masterbar/tracks-events.js index 7cf95e88..10b63f80 100644 --- a/plugins/jetpack/modules/masterbar/tracks-events.js +++ b/plugins/jetpack/modules/masterbar/tracks-events.js @@ -97,7 +97,7 @@ '#wp-admin-bar-user-info .ab-item,' + '.mb-trackable .ab-secondary'; - $( trackableLinks ).on( 'click touchstart', function( e ) { + $( trackableLinks ).on( 'click touchstart', function( e ) { if ( ! window.jpTracksAJAX || 'function' !== typeof( window.jpTracksAJAX.record_ajax_event ) ) { return; } @@ -105,7 +105,11 @@ var $target = $( e.target ), $parent = $target.closest( 'li' ); - if ( ! $parent ) { + if ( ! $target.is( 'a' ) ) { + $target = $target.closest( 'a' ); + } + + if ( ! $parent || ! $target ) { return; } diff --git a/plugins/jetpack/modules/module-headings.php b/plugins/jetpack/modules/module-headings.php index 5e4c134b..5612ccbb 100644 --- a/plugins/jetpack/modules/module-headings.php +++ b/plugins/jetpack/modules/module-headings.php @@ -80,6 +80,11 @@ function jetpack_get_module_i18n( $key ) { 'description' => _x( 'Use LaTeX markup for complex equations and other geekery.', 'Module Description', 'jetpack' ), ), + 'lazy-images' => array( + 'name' => _x( 'Lazy Images', 'Module Name', 'jetpack' ), + 'description' => _x( 'Improve performance by loading images just before they scroll into view', 'Module Description', 'jetpack' ), + ), + 'likes' => array( 'name' => _x( 'Likes', 'Module Name', 'jetpack' ), 'description' => _x( 'Give visitors an easy way to show they appreciate your content.', 'Module Description', 'jetpack' ), @@ -139,6 +144,11 @@ function jetpack_get_module_i18n( $key ) { 'description' => _x( 'Automated social marketing.', 'Module Description', 'jetpack' ), ), + 'pwa' => array( + 'name' => _x( 'Progressive Web Apps', 'Module Name', 'jetpack' ), + 'description' => _x( 'Speed up and improve the reliability of your site using the latest in web technology.', 'Module Description', 'jetpack' ), + ), + 'related-posts' => array( 'name' => _x( 'Related posts', 'Module Name', 'jetpack' ), 'description' => _x( 'Increase page views by showing related content to your visitors.', 'Module Description', 'jetpack' ), @@ -286,6 +296,7 @@ function jetpack_get_module_i18n_tag( $key ) { // - modules/custom-css.php // - modules/gravatar-hovercards.php // - modules/infinite-scroll.php + // - modules/lazy-images.php // - modules/minileven.php // - modules/photon.php // - modules/seo-tools.php @@ -297,14 +308,12 @@ function jetpack_get_module_i18n_tag( $key ) { // Modules with `Developers` tag: // - modules/json-api.php + // - modules/pwa.php // - modules/sso.php 'Developers' =>_x( 'Developers', 'Module Tag', 'jetpack' ), - // Modules with `Centralized Management` tag: - // - modules/manage.php - 'Centralized Management' =>_x( 'Centralized Management', 'Module Tag', 'jetpack' ), - // Modules with `Recommended` tag: + // - modules/lazy-images.php // - modules/manage.php // - modules/minileven.php // - modules/monitor.php @@ -317,6 +326,10 @@ function jetpack_get_module_i18n_tag( $key ) { // - modules/stats.php 'Recommended' =>_x( 'Recommended', 'Module Tag', 'jetpack' ), + // Modules with `Centralized Management` tag: + // - modules/manage.php + 'Centralized Management' =>_x( 'Centralized Management', 'Module Tag', 'jetpack' ), + // Modules with `General` tag: // - modules/masterbar.php 'General' =>_x( 'General', 'Module Tag', 'jetpack' ), diff --git a/plugins/jetpack/modules/protect.php b/plugins/jetpack/modules/protect.php index 1677e2b9..a47a1af9 100644 --- a/plugins/jetpack/modules/protect.php +++ b/plugins/jetpack/modules/protect.php @@ -58,7 +58,7 @@ class Jetpack_Protect_Module { add_action( 'admin_init', array ( $this, 'maybe_display_security_warning' ) ); // This is a backup in case $pagenow fails for some reason - add_action( 'login_head', array ( $this, 'check_login_ability' ) ); + add_action( 'login_head', array ( $this, 'check_login_ability' ), 100, 3 ); // Runs a script every day to clean up expired transients so they don't // clog up our users' databases @@ -427,6 +427,47 @@ class Jetpack_Protect_Module { * @return bool Either returns true, fires $this->kill_login, or includes a math fallback and returns false */ function check_login_ability( $preauth = false ) { + + /** + * JETPACK_ALWAYS_PROTECT_LOGIN will always disable the login page, and use a page provided by Jetpack. + */ + if ( defined( 'JETPACK_ALWAYS_PROTECT_LOGIN' ) && JETPACK_ALWAYS_PROTECT_LOGIN ) { + $this->kill_login(); + } + + if ( $this->is_current_ip_whitelisted() ) { + return true; + } + + $status = $this->get_cached_status(); + + if ( empty( $status ) ) { + // If we've reached this point, this means that the IP isn't cached. + // Now we check with the Protect API to see if we should allow login + $response = $this->protect_call( $action = 'check_ip' ); + + if ( isset( $response['math'] ) && ! function_exists( 'brute_math_authenticate' ) ) { + include_once dirname( __FILE__ ) . '/protect/math-fallback.php'; + new Jetpack_Protect_Math_Authenticate; + + return false; + } + + $status = $response['status']; + } + + if ( 'blocked' == $status ) { + $this->block_with_math(); + } + + if ( 'blocked-hard' == $status ) { + $this->kill_login(); + } + + return true; + } + + function is_current_ip_whitelisted() { $ip = jetpack_protect_get_ip(); // Server is misconfigured and we can't get an IP @@ -455,11 +496,6 @@ class Jetpack_Protect_Module { return true; } - $headers = $this->get_headers(); - $header_hash = md5( json_encode( $headers ) ); - $transient_name = 'jpp_li_' . $header_hash; - $transient_value = $this->get_transient( $transient_name ); - if ( jetpack_protect_ip_is_private( $ip ) ) { return true; } @@ -467,40 +503,26 @@ class Jetpack_Protect_Module { if ( $this->ip_is_whitelisted( $ip ) ) { return true; } + } - // Check out our transients - if ( isset( $transient_value ) && 'ok' == $transient_value['status'] ) { - return true; - } - - if ( isset( $transient_value ) && 'blocked' == $transient_value['status'] ) { - $this->block_with_math(); - } - - if ( isset( $transient_value ) && 'blocked-hard' == $transient_value['status'] ) { - $this->kill_login(); - } - - // If we've reached this point, this means that the IP isn't cached. - // Now we check with the Protect API to see if we should allow login - $response = $this->protect_call( $action = 'check_ip' ); + function has_login_ability() { + if ( $this->is_current_ip_whitelisted() ) { + return true; + } + $status = $this->get_cached_status(); + if ( empty( $status ) || $status === 'ok' ) { + return true; + } + return false; + } - if ( isset( $response['math'] ) && ! function_exists( 'brute_math_authenticate' ) ) { - include_once dirname( __FILE__ ) . '/protect/math-fallback.php'; - new Jetpack_Protect_Math_Authenticate; - - return false; - } - - if ( 'blocked' == $response['status'] ) { - $this->block_with_math(); - } - - if ( 'blocked-hard' == $response['status'] ) { - $this->kill_login(); - } - - return true; + function get_cached_status() { + $transient_name = $this->get_transient_name(); + $value = $this->get_transient( $transient_name ); + if ( isset( $value['status'] ) ) { + return $value['status']; + } + return ''; } function block_with_math() { @@ -541,6 +563,17 @@ class Jetpack_Protect_Module { * Kill a login attempt */ function kill_login() { + if ( + isset( $_GET['action'], $_GET['_wpnonce'] ) && + 'logout' === $_GET['action'] && + wp_verify_nonce( $_GET['_wpnonce'], 'log-out' ) && + wp_get_current_user() + + ) { + // Allow users to logout + return; + } + $ip = jetpack_protect_get_ip(); /** * Fires before every killed login. @@ -552,19 +585,24 @@ class Jetpack_Protect_Module { * @param string $ip IP flagged by Protect. */ do_action( 'jpp_kill_login', $ip ); - $help_url = 'https://jetpack.com/support/security-features/#unblock'; - - $die_string = sprintf( __( 'Your IP (%1$s) has been flagged for potential security violations. Find out more...', 'jetpack' ), str_replace( 'http://', '', esc_url( 'http://' . $ip ) ), esc_url( $help_url ) ); if( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { $die_string = sprintf( __( 'Your IP (%1$s) has been flagged for potential security violations.', 'jetpack' ), str_replace( 'http://', '', esc_url( 'http://' . $ip ) ) ); + wp_die( + $die_string, + __( 'Login Blocked by Jetpack', 'jetpack' ), + array ( 'response' => 403 ) + ); } - wp_die( - $die_string, - __( 'Login Blocked by Jetpack', 'jetpack' ), - array ( 'response' => 403 ) - ); + require_once dirname( __FILE__ ) . '/protect/blocked-login-page.php'; + $blocked_login_page = Jetpack_Protect_Blocked_Login_Page::instance( $ip ); + + if ( $blocked_login_page->is_blocked_user_valid() ) { + return; + } + + $blocked_login_page->render_and_die(); } /* @@ -681,7 +719,7 @@ class Jetpack_Protect_Module { * @return array */ function protect_call( $action = 'check_ip', $request = array () ) { - global $wp_version, $wpdb, $current_user; + global $wp_version; $api_key = $this->maybe_get_protect_key(); @@ -721,9 +759,8 @@ class Jetpack_Protect_Module { $response_json = wp_remote_post( $this->get_api_host(), $args ); $this->last_response_raw = $response_json; - $headers = $this->get_headers(); - $header_hash = md5( json_encode( $headers ) ); - $transient_name = 'jpp_li_' . $header_hash; + + $transient_name = $this->get_transient_name(); $this->delete_transient( $transient_name ); if ( is_array( $response_json ) ) { @@ -753,6 +790,12 @@ class Jetpack_Protect_Module { return $response; } + function get_transient_name() { + $headers = $this->get_headers(); + $header_hash = md5( json_encode( $headers ) ); + + return 'jpp_li_' . $header_hash; + } /** * Wrapper for WordPress set_transient function, our version sets @@ -862,8 +905,9 @@ class Jetpack_Protect_Module { } -Jetpack_Protect_Module::instance(); +$jetpack_protect = Jetpack_Protect_Module::instance(); +global $pagenow; if ( isset( $pagenow ) && 'wp-login.php' == $pagenow ) { - Jetpack_Protect_Module::check_login_ability(); + $jetpack_protect->check_login_ability(); } diff --git a/plugins/jetpack/modules/protect/blocked-login-page.php b/plugins/jetpack/modules/protect/blocked-login-page.php new file mode 100644 index 00000000..ec1e8835 --- /dev/null +++ b/plugins/jetpack/modules/protect/blocked-login-page.php @@ -0,0 +1,337 @@ +can_send_recovery_emails = apply_filters( 'jetpack_protect_can_send_recovery_emails', true ); + $this->ip_address = $ip_address; + + add_filter( 'wp_authenticate_user', array( $this, 'check_valid_blocked_user' ), 10, 1 ); + add_filter( 'site_url', array( $this, 'add_args_to_login_post_url' ), 10, 3 ); + add_filter( 'network_site_url', array( $this, 'add_args_to_login_post_url' ), 10, 3 ); + add_filter( 'lostpassword_url', array( $this, 'add_args_to_lostpassword_url' ), 10, 2 ); + add_filter( 'login_url', array( $this, 'add_args_to_login_url' ), 10, 3 ); + add_filter( 'lostpassword_redirect', array( $this, 'add_args_to_lostpassword_redirect_url' ), 10, 1 ); + } + + public function add_args_to_lostpassword_redirect_url( $url ) { + if ( $this->valid_blocked_user_id ) { + $url = empty( $url ) ? wp_login_url() : $url; + $url = add_query_arg( + array( + 'validate_jetpack_protect_recovery' => $_GET['validate_jetpack_protect_recovery'], + 'user_id' => $_GET['user_id'], + 'checkemail' => 'confirm', + ), + $url + ); + } + + return $url; + } + + public function add_args_to_lostpassword_url( $url, $redirect ) { + if ( $this->valid_blocked_user_id ) { + $args = array( + 'validate_jetpack_protect_recovery' => $_GET['validate_jetpack_protect_recovery'], + 'user_id' => $_GET['user_id'], + 'action' => 'lostpassword', + ); + if ( ! empty( $redirect ) ) { + $args['redirect_to'] = $redirect; + } + $url = add_query_arg( $args, $url ); + } + + return $url; + } + + public function add_args_to_login_post_url( $url, $path, $scheme ) { + if ( $this->valid_blocked_user_id && ( 'login_post' === $scheme || 'login' === $scheme ) ) { + $url = add_query_arg( + array( + 'validate_jetpack_protect_recovery' => $_GET['validate_jetpack_protect_recovery'], + 'user_id' => $_GET['user_id'], + ), + $url + ); + + } + + return $url; + } + + public function add_args_to_login_url( $url, $redirect, $force_reauth ) { + if ( $this->valid_blocked_user_id ) { + $args = array( + 'validate_jetpack_protect_recovery' => $_GET['validate_jetpack_protect_recovery'], + 'user_id' => $_GET['user_id'], + ); + + if ( ! empty( $redirect ) ) { + $args['redirect_to'] = $redirect; + } + + if ( ! empty( $force_reauth ) ) { + $args['reauth'] = '1'; + } + $url = add_query_arg( $args, $url ); + } + + return $url; + } + + public function check_valid_blocked_user( $user ) { + if ( $this->valid_blocked_user_id && $this->valid_blocked_user_id != $user->ID ) { + return new WP_Error( 'invalid_recovery_token', __( 'The recovery token is not valid for this user.', 'jetpack' ) ); + } + + return $user; + } + + public function is_blocked_user_valid() { + if ( ! $this->can_send_recovery_emails ) { + return false; + } + + if ( $this->valid_blocked_user_id ) { + return true; + } + + if ( ! isset( $_GET['validate_jetpack_protect_recovery'], $_GET['user_id'] ) ) { + return false; + } + + if ( ! $this->is_valid_protect_recovery_key( $_GET['validate_jetpack_protect_recovery'], $_GET['user_id'] ) ) { + return false; + } + + $this->valid_blocked_user_id = (int) $_GET['user_id']; + + return true; + } + + public function is_valid_protect_recovery_key( $key, $user_id ) { + + $path = sprintf( '/sites/%d/protect/recovery/confirm', Jetpack::get_option( 'id' ) ); + $response = Jetpack_Client::wpcom_json_api_request_as_blog( + $path, + '1.1', + array( + 'method' => 'post' + ), + array( + 'token' => $key, + 'user_id' => $user_id, + 'ip' => $this->ip_address, + ) + ); + + $result = json_decode( wp_remote_retrieve_body( $response ) ); + + if ( is_wp_error( $result ) || empty( $result ) || isset( $result->error ) ) { + return false; + } + + return true; + } + + public function render_and_die() { + $this->page_title = __( 'Login Blocked by Jetpack', 'jetpack' ); + + if ( ! $this->can_send_recovery_emails ) { + $this->render_blocked_login_message(); + + return; + } + + if ( isset( $_GET['validate_jetpack_protect_recovery'] ) && $_GET['user_id'] ) { + $this->protect_die( __( 'Could not validate recovery token.', 'jetpack' ) ); + + return; + } + + if ( + isset( $_GET['jetpack-protect-recovery'] ) && + isset( $_POST['_wpnonce'] ) && + wp_verify_nonce( $_POST['_wpnonce'], 'bypass-protect' ) + ) { + $this->process_recovery_email(); + + return; + } + + if ( isset( $_GET['loggedout'] ) && 'true' === $_GET['loggedout'] ) { + $this->protect_die( __( 'You successfully logged out.', 'jetpack' ) ); + } + + $this->render_recovery_form(); + } + + public function render_blocked_login_message() { + $this->protect_die( $this->get_html_blocked_login_message() ); + } + + function process_recovery_email() { + $sent = $this->send_recovery_email(); + + if ( is_wp_error( $sent ) ) { + $this->protect_die( $sent, true ); + } else { + $this->render_recovery_success(); + } + } + + function send_recovery_email() { + $email = isset( $_POST['email'] ) ? $_POST['email'] : ''; + if ( sanitize_email( $email ) !== $email || ! is_email( $email ) ) { + return new WP_Error( 'invalid_email', __( "Oops, looks like that's not the right email address. Please try again!", 'jetpack' ) ); + } + $user = get_user_by( 'email', trim( $email ) ); + + if ( ! $user ) { + return new WP_Error( 'invalid_user', __( 'Oops, could not find a user with that email address.', 'jetpack' ) ); + } + $this->email_address = $email; + $path = sprintf( '/sites/%d/protect/recovery/request', Jetpack::get_option( 'id' ) ); + + + $response = Jetpack_Client::wpcom_json_api_request_as_blog( + $path, + '1.1', + array( + 'method' => 'post' + ), + array( + 'user_id' => $user->ID, + 'ip' => $this->ip_address + ) + ); + + $code = wp_remote_retrieve_response_code( $response ); + $result = json_decode( wp_remote_retrieve_body( $response ) ); + + if ( self::HTTP_STATUS_CODE_TOO_MANY_REQUESTS === $code ) { + return new WP_Error( 'email_already_sent', __( 'An email was already sent to this address.', 'jetpack' ) ); + } else if ( is_wp_error( $result ) || empty( $result ) || isset( $result->error ) ) { + return new WP_Error( 'email_send_error', __( 'There was an error sending your email.', 'jetpack' ) ); + } + + return true; + } + + function protect_die( $content, $back_link = false ) { + $image = sprintf( + '', + plugins_url( 'modules/protect/jetpack-security.png', JETPACK__PLUGIN_FILE ) + ); + + if ( is_wp_error( $content ) ) { + $content = $content->get_error_message(); + } + // hack to get around default wp_die_handler. https://core.trac.wordpress.org/browser/tags/4.8.1/src/wp-includes/functions.php#L2698 + $content = $image . '

' . $content . '

'; + + if ( isset( $_GET['interim-login'] ) ) { + $content = "" . $content; + } + + wp_die( $content, $this->page_title, array( 'back_link' => $back_link, 'response' => 200 ) ); + } + + function render_recovery_form() { + $content = $this->get_html_blocked_login_message() . $this->get_html_recovery_form(); + $this->protect_die( $content ); + } + + function render_recovery_success() { + $this->protect_die( sprintf( __( 'An email with recovery instructions was sent to %s.', 'jetpack' ), $this->email_address ) ); + } + + + function get_html_blocked_login_message() { + $icon = ''; + $ip = str_replace( 'http://', '', esc_url( 'http://' . $this->ip_address ) ); + ob_start(); ?> +

+ %1$sYour IP (%2$s) has been flagged for potential security violations. Learn More

', 'jetpack' ), + $icon, + $ip, + esc_url( self::HELP_URL ) + ); + + $contents = ob_get_contents(); + ob_end_clean(); + + return $contents; + } + + function get_html_recovery_form() { + ob_start(); ?> +
+

+
+ +

+ + +

+
+
+ + 116 ) { + if ( wpasTwitterCheckbox && length > 256 ) { wpasTitleCounter.addClass( 'wpas-twitter-length-limit' ); } else { wpasTitleCounter.removeClass( 'wpas-twitter-length-limit' ); diff --git a/plugins/jetpack/modules/pwa.php b/plugins/jetpack/modules/pwa.php new file mode 100644 index 00000000..b5e5e6a2 --- /dev/null +++ b/plugins/jetpack/modules/pwa.php @@ -0,0 +1,42 @@ + + + + get_bloginfo( 'name' ), + 'start_url' => get_home_url(), + 'short_name' => substr( get_bloginfo( 'name' ), 0, 12 ), + 'display' => 'standalone', + 'background_color' => $theme_color, + 'theme_color' => $theme_color, + ); + + if ( $description = get_bloginfo( 'description' ) ) { + $manifest['description'] = $description; + } + + $manifest['icons'] = array_map( + array( $this, 'build_icon_object' ), + Jetpack_PWA_Helpers::get_default_manifest_icon_sizes() + ); + + /** + * Allow overriding the manifest. + * + * @since 5.6.0 + * + * @param array $manifest + */ + $manifest = apply_filters( 'jetpack_pwa_manifest', $manifest ); + + wp_send_json( $manifest ); + } + } + + function build_icon_object( $size ) { + return array( + 'src' => Jetpack_PWA_Helpers::site_icon_url( $size ), + 'sizes' => sprintf( '%1$dx%1$d', $size ), + ); + } +} diff --git a/plugins/jetpack/modules/pwa/images/wp-192.png b/plugins/jetpack/modules/pwa/images/wp-192.png new file mode 100644 index 00000000..9bfd50f7 Binary files /dev/null and b/plugins/jetpack/modules/pwa/images/wp-192.png differ diff --git a/plugins/jetpack/modules/pwa/images/wp-512.png b/plugins/jetpack/modules/pwa/images/wp-512.png new file mode 100644 index 00000000..36106626 Binary files /dev/null and b/plugins/jetpack/modules/pwa/images/wp-512.png differ diff --git a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php index 72576c02..c9255afd 100644 --- a/plugins/jetpack/modules/related-posts/jetpack-related-posts.php +++ b/plugins/jetpack/modules/related-posts/jetpack-related-posts.php @@ -772,9 +772,9 @@ EOT; */ $args['exclude_post_ids'] = apply_filters( 'jetpack_relatedposts_filter_exclude_post_ids', $args['exclude_post_ids'], $post_id ); if ( !empty( $args['exclude_post_ids'] ) && is_array( $args['exclude_post_ids'] ) ) { + $excluded_post_ids = array(); foreach ( $args['exclude_post_ids'] as $exclude_post_id) { $exclude_post_id = (int)$exclude_post_id; - $excluded_post_ids = array(); if ( $exclude_post_id > 0 ) $excluded_post_ids[] = $exclude_post_id; } diff --git a/plugins/jetpack/modules/search/class.jetpack-search.php b/plugins/jetpack/modules/search/class.jetpack-search.php index 5b0e8064..9733d2a2 100644 --- a/plugins/jetpack/modules/search/class.jetpack-search.php +++ b/plugins/jetpack/modules/search/class.jetpack-search.php @@ -19,6 +19,10 @@ class Jetpack_Search { protected $aggregations = array(); protected $max_aggregations_count = 100; + // used to output query meta into page + protected $last_query_info; + protected $last_query_failure_info; + protected static $instance; //Languages with custom analyzers, other languages are supported, @@ -89,6 +93,35 @@ class Jetpack_Search { add_filter( 'posts_pre_query', array( $this, 'filter__posts_pre_query' ), 10, 2 ); add_filter( 'jetpack_search_es_wp_query_args', array( $this, 'filter__add_date_filter_to_query' ), 10, 2 ); + + add_action( 'did_jetpack_search_query', array( $this, 'store_query_success' ) ); + add_action( 'failed_jetpack_search_query', array( $this, 'store_query_failure' ) ); + } + } + + /** + * Print query info as a HTML comment in the footer + */ + + public function store_query_failure( $meta ) { + $this->last_query_failure_info = $meta; + add_action( 'wp_footer', array( $this, 'print_query_failure' ) ); + } + + public function print_query_failure() { + if ( $this->last_query_failure_info ) { + echo ''; + } + } + + public function store_query_success( $meta ) { + $this->last_query_info = $meta; + add_action( 'wp_footer', array( $this, 'print_query_success' ) ); + } + + public function print_query_success() { + if ( $this->last_query_info ) { + echo ''; } } @@ -146,13 +179,22 @@ class Jetpack_Search { } $response_code = wp_remote_retrieve_response_code( $request ); + $response = json_decode( wp_remote_retrieve_body( $request ), true ); if ( ! $response_code || $response_code < 200 || $response_code >= 300 ) { + /** + * Fires after a search query request has failed + * + * @module search + * + * @since 5.6.0 + * + * @param array Array containing the response code and response from the failed search query + */ + do_action( 'failed_jetpack_search_query', array( 'response_code' => $response_code, 'json' => $response ) ); return new WP_Error( 'invalid_search_api_response', 'Invalid response from API - ' . $response_code ); } - $response = json_decode( wp_remote_retrieve_body( $request ), true ); - $took = is_array( $response ) && $response['took'] ? $response['took'] : null; $query = array( @@ -176,7 +218,9 @@ class Jetpack_Search { * float es_time Amount of time Elasticsearch spent running the request, in milliseconds * string url API url that was queried * - * @since 5.0 + * @module search + * + * @since 5.0.0 * * @param array $query Array of information about the query performed */ @@ -198,7 +242,16 @@ class Jetpack_Search { * @return array Array of matching posts */ public function filter__posts_pre_query( $posts, $query ) { - if ( ! $query->is_main_query() || ! $query->is_search() ) { + /** + * Determine whether a given WP_Query should be handled by ElasticSearch + * + * @module search + * + * @since 5.6.0 + * @param bool $should_handle Should be handled by Jetpack Search + * @param WP_Query $query The wp_query object + */ + if ( ! apply_filters( 'jetpack_search_should_handle_query', ( $query->is_main_query() && $query->is_search() ), $query ) ) { return $posts; } @@ -242,10 +295,6 @@ class Jetpack_Search { * @param WP_Query $query The original WP_Query to use for the parameters of our search */ public function do_search( WP_Query $query ) { - if ( ! $query->is_main_query() || ! $query->is_search() ) { - return; - } - $page = ( $query->get( 'paged' ) ) ? absint( $query->get( 'paged' ) ) : 1; $posts_per_page = $query->get( 'posts_per_page' ); @@ -340,6 +389,12 @@ class Jetpack_Search { return; } + // If we have aggregations, fix the ordering to match the input order (ES doesn't + // guarantee the return order) + if ( isset( $this->search_result['results']['aggregations'] ) && ! empty( $this->search_result['results']['aggregations'] ) ) { + $this->search_result['results']['aggregations'] = $this->fix_aggregation_ordering( $this->search_result['results']['aggregations'], $this->aggregations ); + } + // Total number of results for paging purposes. Capped at $this->>max_offset + $posts_per_page, as deep paging // gets quite expensive $this->found_posts = min( $this->search_result['results']['total'], $this->max_offset + $posts_per_page ); @@ -374,7 +429,7 @@ class Jetpack_Search { foreach ( $the_tax_query->queries as $tax_query ) { // Right now we only support slugs...see note above - if ( 'slug' !== $tax_query['field'] ) { + if ( ! is_array( $tax_query ) || 'slug' !== $tax_query['field'] ) { continue; } @@ -426,7 +481,6 @@ class Jetpack_Search { } $post_type_object = get_post_type_object( $post_type ); - if ( ! $post_type_object || $post_type_object->exclude_from_search ) { continue; } @@ -856,11 +910,19 @@ class Jetpack_Search { * @param Jetpack_WPES_Query_Builder $builder The builder instance that is creating the ES query */ public function add_date_histogram_aggregation_to_es_query_builder( array $aggregation, $label, Jetpack_WPES_Query_Builder $builder ) { + $args = array( + 'interval' => $aggregation['interval'], + 'field' => ( ! empty( $aggregation['field'] ) && 'post_date_gmt' == $aggregation['field'] ) ? 'date_gmt' : 'date', + ); + + if ( isset( $aggregation['min_doc_count'] ) ) { + $args['min_doc_count'] = intval( $aggregation['min_doc_count'] ); + } else { + $args['min_doc_count'] = 1; + } + $builder->add_aggs( $label, array( - 'date_histogram' => array( - 'interval' => $aggregation['interval'], - 'field' => ( ! empty( $aggregation['field'] ) && 'post_date_gmt' == $aggregation['field'] ) ? 'date_gmt' : 'date', - ), + 'date_histogram' => $args, )); } @@ -1047,7 +1109,7 @@ class Jetpack_Search { if ( ! empty( $query->tax_query ) && ! empty( $query->tax_query->queries ) && is_array( $query->tax_query->queries ) ) { foreach( $query->tax_query->queries as $tax_query ) { - if ( $this->aggregations[ $label ]['taxonomy'] === $tax_query['taxonomy'] && + if ( is_array( $tax_query ) && $this->aggregations[ $label ]['taxonomy'] === $tax_query['taxonomy'] && 'slug' === $tax_query['field'] && is_array( $tax_query['terms'] ) ) { $existing_term_slugs = array_merge( $existing_term_slugs, $tax_query['terms'] ); @@ -1280,7 +1342,7 @@ class Jetpack_Search { } foreach( $filters as $filter ) { - if ( isset( $filters['buckets'] ) && is_array( $filter['buckets'] ) ) { + if ( isset( $filter['buckets'] ) && is_array( $filter['buckets'] ) ) { foreach( $filter['buckets'] as $item ) { if ( isset( $item['active'] ) && $item['active'] ) { $active_buckets[] = $item; @@ -1335,4 +1397,34 @@ class Jetpack_Search { */ return apply_filters( 'jetpack_search_taxonomy_query_var', $taxonomy->query_var, $taxonomy_name ); } + + /** + * Takes an array of aggregation results, and ensures the array key ordering matches the key order in $desired + * which is the input order + * + * Necessary because ES does not always return Aggs in the same order that you pass them in, and it should be possible + * to control the display order easily + * + * @module search + * + * @param array $aggregations Agg results to be reordered + * @param array $desired Array with keys representing the desired ordering + * + * @return array A new array with reordered keys, matching those in $desired + */ + public function fix_aggregation_ordering( array $aggregations, array $desired ) { + if ( empty( $aggregations ) || empty( $desired ) ) { + return $aggregations; + } + + $reordered = array(); + + foreach( array_keys( $desired ) as $agg_name ) { + if ( isset( $aggregations[ $agg_name ] ) ) { + $reordered[ $agg_name ] = $aggregations[ $agg_name ]; + } + } + + return $reordered; + } } diff --git a/plugins/jetpack/modules/sharedaddy/sharing-sources.php b/plugins/jetpack/modules/sharedaddy/sharing-sources.php index 41a58be3..8ad1e50b 100644 --- a/plugins/jetpack/modules/sharedaddy/sharing-sources.php +++ b/plugins/jetpack/modules/sharedaddy/sharing-sources.php @@ -516,7 +516,6 @@ class Share_Email extends Sharing_Source { - esc_js( $js_tld ) ) ); 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 17dc5781..8555da37 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.", 'jetpack' ) ); + trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); 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/gist.php b/plugins/jetpack/modules/shortcodes/gist.php index b5f2c038..072014ef 100644 --- a/plugins/jetpack/modules/shortcodes/gist.php +++ b/plugins/jetpack/modules/shortcodes/gist.php @@ -54,7 +54,13 @@ function github_gist_shortcode( $atts, $content = '' ) { return ''; } - wp_enqueue_script( 'jetpack-gist-embed', plugins_url( 'js/gist.js', __FILE__ ), array( 'jquery' ), false, true ); + wp_enqueue_script( + 'jetpack-gist-embed', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/gist.min.js', 'modules/shortcodes/js/gist.js' ), + array( 'jquery' ), + false, + true + ); if ( false !== strpos( $id, '#file-' ) ) { // URL points to a specific file in the gist diff --git a/plugins/jetpack/modules/shortcodes/googleplus.php b/plugins/jetpack/modules/shortcodes/googleplus.php index daa34d1a..0a8ae294 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.min.js', array(), null, true ); + wp_enqueue_script( 'jetpack-gplus-api', 'https://apis.google.com/js/platform.js', array(), null, true ); return sprintf( '
', esc_url( $url ) ); } diff --git a/plugins/jetpack/modules/shortcodes/instagram.php b/plugins/jetpack/modules/shortcodes/instagram.php index bebc19d3..13eeacfb 100644 --- a/plugins/jetpack/modules/shortcodes/instagram.php +++ b/plugins/jetpack/modules/shortcodes/instagram.php @@ -145,7 +145,13 @@ function jetpack_instagram_handler( $matches, $atts, $url ) { } if ( ! empty( $response_body->html ) ) { - wp_enqueue_script( 'jetpack-instagram-embed', plugins_url( 'js/instagram.js', __FILE__ ), array( 'jquery' ), false, true ); + wp_enqueue_script( + 'jetpack-instagram-embed', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/instagram.min.js', 'modules/shortcodes/js/instagram.js' ), + array( 'jquery' ), + false, + true + ); // there's a script in the response, which we strip on purpose since it's added by this ^ script $ig_embed = preg_replace( '@<(script)[^>]*?>.*?@si', '', $response_body->html ); diff --git a/plugins/jetpack/modules/shortcodes/js/jmpress.js b/plugins/jetpack/modules/shortcodes/js/jmpress.js index 429531fa..385bb2a7 100644 --- a/plugins/jetpack/modules/shortcodes/js/jmpress.js +++ b/plugins/jetpack/modules/shortcodes/js/jmpress.js @@ -1,15 +1,4 @@ -/*! - * jmpress.js v0.4.5 - * http://jmpressjs.github.com/jmpress.js - * - * A jQuery plugin to build a website on the infinite canvas. - * - * Copyright 2013 Kyle Robinson Young @shama & Tobias Koppers @sokra - * Licensed MIT - * http://www.opensource.org/licenses/mit-license.php - * - * Based on the foundation laid by Bartek Szopka @bartaz - *//*! +/** * jmpress.js v0.4.5 * http://jmpressjs.github.com/jmpress.js * diff --git a/plugins/jetpack/modules/shortcodes/js/jmpress.min.js b/plugins/jetpack/modules/shortcodes/js/jmpress.min.js deleted file mode 100644 index c650c830..00000000 --- a/plugins/jetpack/modules/shortcodes/js/jmpress.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/*! - * jmpress.js v0.4.5 - * http://jmpressjs.github.com/jmpress.js - * - * A jQuery plugin to build a website on the infinite canvas. - * - * Copyright 2013 Kyle Robinson Young @shama & Tobias Koppers @sokra - * Licensed MIT - * http://www.opensource.org/licenses/mit-license.php - * - * Based on the foundation laid by Bartek Szopka @bartaz - */(function(e,t,s,a){"use strict";function r(e){if(e){var t=1+e.substr(1).search(/[A-Z]/),s=e.substr(0,t).toLowerCase(),a=e.substr(t).toLowerCase();return"-"+s+"-"+a}}function n(e){return e?e+",":""}function i(e){return e.length>0?e:null}function o(r){function n(t,s){var a=p(t),r={oldStyle:e(t).attr("style")||""},n={data:a,stepData:r};f.call(this,"beforeInitStep",e(t),n),r.delegate=a.delegate,f.call(this,"initStep",e(t),n),e(t).data("stepData",r),e(t).attr("id")||e(t).attr("id","step-"+(s+1)),f.call(this,"applyStep",e(t),n)}function o(t){var s=e(t).data("stepData");e(t).attr("style",s.oldStyle),f.call(this,"unapplyStep",e(t),{stepData:s})}function c(t){f.call(this,"unapplyStep",e(t),{stepData:t.data("stepData")}),f.call(this,"applyStep",e(t),{stepData:t.data("stepData")})}function l(){O&&f.call(this,"setInactive",O,{stepData:e(O).data("stepData"),reason:"deinit"}),Y.jmpressClass&&e(I).removeClass(Y.jmpressClass),f.call(this,"beforeDeinit",e(this),{}),e(A.stepSelector,I).each(function(){o.call(I,this)}),k.attr("style",Z.container),A.fullscreen&&e("html").attr("style",""),z.attr("style",Z.area),e(X).children().each(function(){I.append(e(this))}),A.fullscreen?X.remove():(X.remove(),z.remove()),f.call(this,"afterDeinit",e(this),{}),e(I).data("jmpressmethods",!1)}function f(t,s,a){a.settings=A,a.current=Y,a.container=k,a.parents=s?d(s):null,a.current=Y,a.jmpress=this;var r={};return e.each(A[t],function(e,t){r.value=t.call(I,s,a)||r.value}),r.value}function d(t){return e(t).parentsUntil(I).not(I).filter(A.stepSelector)}function v(e){return g({step:O,substep:F},e)}function g(t,s){var r;if(e.isPlainObject(t)&&(r=t.substep,t=t.step),"string"==typeof t&&(t=I.find(t).first()),!t||!e(t).data("stepData"))return!1;b.call(this);var n=e(t).data("stepData"),o=!1;if(f.call(this,"beforeChange",t,{stepData:n,reason:s,cancel:function(){o=!0}}),o)return a;var c={},l=t;e(t).data("stepData").delegate&&(l=i(e(t).parentsUntil(I).filter(A.stepSelector).filter(n.delegate))||i(e(t).near(n.delegate))||i(e(t).near(n.delegate,!0))||i(e(n.delegate,I)),l?n=l.data("stepData"):l=t),Q&&f.call(this,"setInactive",Q,{stepData:e(Q).data("stepData"),delegatedFrom:O,reason:s,target:c,nextStep:l,nextSubstep:r,nextStepData:n});var u={stepData:n,delegatedFrom:t,reason:s,target:c,substep:r,prevStep:Q,prevSubstep:F,prevStepData:Q&&e(Q).data("stepData")};return f.call(this,"beforeActive",l,u),f.call(this,"setActive",l,u),Y.jmpressClass&&e(I).removeClass(Y.jmpressClass),e(I).addClass(Y.jmpressClass="step-"+e(l).attr("id")),Y.jmpressDelegatedClass&&e(I).removeClass(Y.jmpressDelegatedClass),e(I).addClass(Y.jmpressDelegatedClass="delegating-step-"+e(t).attr("id")),f.call(this,"applyTarget",l,e.extend({canvas:X,area:z,beforeActive:Q},u)),O=t,F=u.substep,Q=l,Y.idleTimeout&&clearTimeout(Y.idleTimeout),Y.idleTimeout=setTimeout(function(){f.call(this,"idle",l,u)},Math.max(1,A.transitionDuration-100)),l}function b(){(function t(){function a(){(0!==e(k).scrollTop()||0!==e(k).scrollLeft())&&t()}if("BODY"===e(k)[0].tagName)try{s.scrollTo(0,0)}catch(r){}e(k).scrollTop(0),e(k).scrollLeft(0),setTimeout(a,1),setTimeout(a,10),setTimeout(a,100),setTimeout(a,200),setTimeout(a,400)})()}function y(e){return g.call(this,e,"jump")}function j(){return g.call(this,f.call(this,"selectNext",O,{stepData:e(O).data("stepData"),substep:F}),"next")}function D(){return g.call(this,f.call(this,"selectPrev",O,{stepData:e(O).data("stepData"),substep:F}),"prev")}function S(){return g.call(this,f.call(this,"selectHome",O,{stepData:e(O).data("stepData")}),"home")}function x(){return g.call(this,f.call(this,"selectEnd",O,{stepData:e(O).data("stepData")}),"end")}function w(t){return u(X,t||{}),e(X)}function C(){return Q&&e(Q)}function T(t,s,r){return h[t]?f.call(this,t,s,r):(e.error("callback "+t+" is not registered."),a)}function M(){var e=navigator.userAgent.toLowerCase();return-1===e.search(/(iphone)|(ipod)|(android)/)||-1!==e.search(/(chrome)/)}r=e.extend(!0,{},r||{});var P={},N=null;for(N in h)P[N]=e.isFunction(r[N])?[r[N]]:r[N],r[N]=[];var A=e.extend(!0,{},m,r);for(N in h)P[N]&&Array.prototype.push.apply(A[N],P[N]);var I=e(this),k=null,z=null,Z={container:"",area:""},X=null,Y=null,O=!1,F=null,Q=!1;if(I.data("jmpressmethods",{select:g,reselect:v,scrollFix:b,goTo:y,next:j,prev:D,home:S,end:x,canvas:w,container:function(){return k},settings:function(){return A},active:C,current:function(){return Y},fire:T,init:function(t){n.call(this,e(t),Y.nextIdNumber++)},deinit:function(t){t?o.call(this,e(t)):l.call(this)},reapply:c}),M()===!1)return A.notSupportedClass&&I.addClass(A.notSupportedClass),a;A.notSupportedClass&&I.removeClass(A.notSupportedClass);var E=e(A.stepSelector,I);k=I,z=e("
"),X=e("
"),e(I).children().filter(E).each(function(){X.append(e(this))}),A.fullscreen&&(k=e("body"),e("html").css({overflow:"hidden"}),z=I),Z.area=z.attr("style")||"",Z.container=k.attr("style")||"",A.fullscreen?(k.css({height:"100%"}),I.append(X)):(k.css({position:"relative"}),z.append(X),I.append(z)),e(k).addClass(A.containerClass),e(z).addClass(A.areaClass),e(X).addClass(A.canvasClass),t.documentElement.style.height="100%",k.css({overflow:"hidden"});var L={position:"absolute",transitionDuration:"0s"};L=e.extend({},A.animation,L),u(z,L),u(z,{top:"50%",left:"50%",perspective:"1000px"}),u(X,L),Y={},f.call(this,"beforeInit",null,{}),E.each(function(e){n.call(I,this,e)}),Y.nextIdNumber=E.length,f.call(this,"afterInit",null,{}),g.call(this,f.call(this,"selectInitialStep","init",{})),A.initClass&&e(E).removeClass(A.initClass)}function c(){return m}function l(t,s){e.isFunction(s)?g[t]?e.error("function "+t+" is already registered."):g[t]=s:h[t]?e.error("callback "+t+" is already registered."):(h[t]=1,m[t]=[])}function u(t,s){var a,r,n={};for(a in s)s.hasOwnProperty(a)&&(r=d(a),null!==r&&(n[r]=s[a]));return e(t).css(n),t}function p(t){function s(e){e=e.split("-");for(var t=1;e.length>t;t++)e[t]=e[t].substr(0,1).toUpperCase()+e[t].substr(1);return e.join("")}if(e(t)[0].dataset)return e.extend({},e(t)[0].dataset);var a={},r=e(t)[0].attributes;return e.each(r,function(e,t){"data-"===t.nodeName.substr(0,5)&&(a[s(t.nodeName.substr(5))]=t.nodeValue)}),a}function f(){return!!e(this).data("jmpressmethods")}var d=function(){var e=t.createElement("dummy").style,s="Webkit Moz O ms Khtml".split(" "),r={};return function(t){if(r[t]===a){var n=t.charAt(0).toUpperCase()+t.substr(1),i=(t+" "+s.join(n+" ")+n).split(" ");r[t]=null;for(var o in i)if(e[i[o]]!==a){r[t]=i[o];break}}return r[t]}}(),m={stepSelector:".step",containerClass:"",canvasClass:"",areaClass:"",notSupportedClass:"not-supported",fullscreen:!0,animation:{transformOrigin:"top left",transitionProperty:n(r(d("transform")))+n(r(d("perspective")))+"opacity",transitionDuration:"1s",transitionDelay:"500ms",transitionTimingFunction:"ease-in-out",transformStyle:"preserve-3d"},transitionDuration:1500},h={beforeChange:1,beforeInitStep:1,initStep:1,beforeInit:1,afterInit:1,beforeDeinit:1,afterDeinit:1,applyStep:1,unapplyStep:1,setInactive:1,beforeActive:1,setActive:1,selectInitialStep:1,selectPrev:1,selectNext:1,selectHome:1,selectEnd:1,idle:1,applyTarget:1};for(var v in h)m[v]=[];var g={init:o,initialized:f,deinit:function(){},css:u,pfx:d,defaults:c,register:l,dataset:p};e.fn.jmpress=function(t){function s(){var s=e(this).data("jmpressmethods");if(s&&s[t])return s[t].apply(this,Array.prototype.slice.call(arguments,1));if(g[t])return g[t].apply(this,Array.prototype.slice.call(arguments,1));if(h[t]&&s){var a=s.settings(),r=Array.prototype.slice.call(arguments,1)[0];e.isFunction(r)&&(a[t]=a[t]||[],a[t].push(r))}else{if("object"==typeof t||!t)return o.apply(this,arguments);e.error("Method "+t+" does not exist on jQuery.jmpress")}return this}var a,r=arguments;return e(this).each(function(e,t){a=s.apply(t,r)}),a},e.extend({jmpress:function(t){if(g[t])return g[t].apply(this,Array.prototype.slice.call(arguments,1));if(h[t]){var s=Array.prototype.slice.call(arguments,1)[0];e.isFunction(s)?m[t].push(s):e.error("Second parameter should be a function: $.jmpress( callbackName, callbackFunction )")}else e.error("Method "+t+" does not exist on jQuery.jmpress")}})})(jQuery,document,window),function(e){"use strict";function t(t,s,a,r){var n;return t.each(function(t,i){return r&&(n=s(i,a,r))?!1:e(i).is(a)?(n=i,!1):!r&&(n=s(i,a,r))?!1:undefined}),n}function s(a,r,n){var i=e(a).children();return n&&(i=e(i.get().reverse())),t(i,s,r,n)}function a(a,r,n){return t(e(a)[n?"prevAll":"nextAll"](),s,r,n)}function r(t,s,r){var n,i=e(t).parents();return i=e(i.get()),e.each(i.get(),function(t,i){return r&&e(i).is(s)?(n=i,!1):(n=a(i,s,r),n?!1:undefined)}),n}e.fn.near=function(t,n){var i=[];return e(this).each(function(e,o){var c=(n?!1:s(o,t,n))||a(o,t,n)||r(o,t,n);c&&i.push(c)}),e(i)}}(jQuery,document,window),function(e,t,s,a){"use strict";function r(e){return Math.round(1e4*e)/1e4+""}var n={3:{transform:function(t,s){var a="translate(-50%,-50%)";e.each(s,function(e,t){var s,n=["X","Y","Z"];if("translate"===t[0])a+=" translate3d("+r(t[1]||0)+"px,"+r(t[2]||0)+"px,"+r(t[3]||0)+"px)";else if("rotate"===t[0]){var i=t[4]?[1,2,3]:[3,2,1];for(s=0;3>s;s++)a+=" rotate"+n[i[s]-1]+"("+r(t[i[s]]||0)+"deg)"}else if("scale"===t[0])for(s=0;3>s;s++)a+=" scale"+n[s]+"("+r(t[s+1]||1)+")"}),e.jmpress("css",t,e.extend({},{transform:a}))}},2:{transform:function(t,s){var a="translate(-50%,-50%)";e.each(s,function(e,t){var s=["X","Y"];if("translate"===t[0])a+=" translate("+r(t[1]||0)+"px,"+r(t[2]||0)+"px)";else if("rotate"===t[0])a+=" rotate("+r(t[3]||0)+"deg)";else if("scale"===t[0])for(var n=0;2>n;n++)a+=" scale"+s[n]+"("+r(t[n+1]||1)+")"}),e.jmpress("css",t,e.extend({},{transform:a}))}},1:{transform:function(t,s){var a={top:0,left:0};e.each(s,function(e,t){"translate"===t[0]&&(a.left=Math.round(t[1]||0)+"px",a.top=Math.round(t[2]||0)+"px")}),t.animate(a,1e3)}}},i=function(){return e.jmpress("pfx","perspective")?n[3]:e.jmpress("pfx","transform")?n[2]:n[1]}();e.jmpress("defaults").reasonableAnimation={},e.jmpress("initStep",function(t,s){var a=s.data,r=s.stepData,n=parseFloat;e.extend(r,{x:n(a.x)||0,y:n(a.y)||0,z:n(a.z)||0,r:n(a.r)||0,phi:n(a.phi)||0,rotate:n(a.rotate)||0,rotateX:n(a.rotateX)||0,rotateY:n(a.rotateY)||0,rotateZ:n(a.rotateZ)||0,revertRotate:!1,scale:n(a.scale)||1,scaleX:n(a.scaleX)||!1,scaleY:n(a.scaleY)||!1,scaleZ:n(a.scaleZ)||1})}),e.jmpress("afterInit",function(t,s){var a=s.settings.stepSelector,r=s.current;r.perspectiveScale=1,r.maxNestedDepth=0;for(var n=e(s.jmpress).find(a).children(a);n.length;)r.maxNestedDepth++,n=n.children(a)}),e.jmpress("applyStep",function(t,s){e.jmpress("css",e(t),{position:"absolute",transformStyle:"preserve-3d"}),s.parents.length>0&&e.jmpress("css",e(t),{top:"50%",left:"50%"});var a=s.stepData,r=[["translate",a.x||a.r*Math.sin(a.phi*Math.PI/180),a.y||-a.r*Math.cos(a.phi*Math.PI/180),a.z],["rotate",a.rotateX,a.rotateY,a.rotateZ||a.rotate,!0],["scale",a.scaleX||a.scale,a.scaleY||a.scale,a.scaleZ||a.scale]];i.transform(t,r)}),e.jmpress("setActive",function(t,s){var r=s.target,n=s.stepData,i=r.transform=[];r.perspectiveScale=1;for(var o=s.current.maxNestedDepth;o>(s.parents.length||0);o--)i.push(["scale"],["rotate"],["translate"]);i.push(["scale",1/(n.scaleX||n.scale),1/(n.scaleY||n.scale),1/n.scaleZ]),i.push(["rotate",-n.rotateX,-n.rotateY,-(n.rotateZ||n.rotate)]),i.push(["translate",-(n.x||n.r*Math.sin(n.phi*Math.PI/180)),-(n.y||-n.r*Math.cos(n.phi*Math.PI/180)),-n.z]),r.perspectiveScale*=n.scaleX||n.scale,e.each(s.parents,function(t,s){var a=e(s).data("stepData");i.push(["scale",1/(a.scaleX||a.scale),1/(a.scaleY||a.scale),1/a.scaleZ]),i.push(["rotate",-a.rotateX,-a.rotateY,-(a.rotateZ||a.rotate)]),i.push(["translate",-(a.x||a.r*Math.sin(a.phi*Math.PI/180)),-(a.y||-a.r*Math.cos(a.phi*Math.PI/180)),-a.z]),r.perspectiveScale*=a.scaleX||a.scale}),e.each(i,function(e,t){function r(r){s.current["rotate"+r+"-"+e]===a&&(s.current["rotate"+r+"-"+e]=t[r]||0);var n=s.current["rotate"+r+"-"+e],i=t[r]||0,o=n%360,c=i%360;0>o&&(o+=360),0>c&&(c+=360);var l=c-o;-180>l?l+=360:l>180&&(l-=360),s.current["rotate"+r+"-"+e]=t[r]=n+l}"rotate"===t[0]&&(r(1),r(2),r(3))})}),e.jmpress("applyTarget",function(t,s){var r,n=s.target,o=(s.stepData,s.settings),c=1.3*n.perspectiveScale1.3*s.current.perspectiveScale,u=-1;e.each(n.transform,function(e,t){return 1>=t.length||"rotate"===t[0]&&0===t[1]%360&&0===t[2]%360&&0===t[3]%360?a:"scale"!==t[0]?!1:(u=e,a)}),u!==s.current.oldLastScale&&(c=l=!1,s.current.oldLastScale=u);var p=[];if(-1!==u)for(;u>=0;)"scale"===n.transform[u][0]&&(p.push(n.transform[u]),n.transform[u]=["scale"]),u--;var f=o.animation;o.reasonableAnimation[s.reason]&&(f=e.extend({},f,o.reasonableAnimation[s.reason])),r={perspective:Math.round(1e3*n.perspectiveScale)+"px"},r=e.extend({},f,r),c||(r.transitionDelay="0s"),s.beforeActive||(r.transitionDuration="0s",r.transitionDelay="0s"),e.jmpress("css",s.area,r),i.transform(s.area,p),r=e.extend({},f),l||(r.transitionDelay="0s"),s.beforeActive||(r.transitionDuration="0s",r.transitionDelay="0s"),s.current.perspectiveScale=n.perspectiveScale,e.jmpress("css",s.canvas,r),i.transform(s.canvas,n.transform)})}(jQuery,document,window),function(e){"use strict";var t=e.jmpress,s="activeClass",a="nestedActiveClass",r=t("defaults");r[a]="nested-active",r[s]="active",t("setInactive",function(t,r){var n=r.settings,i=n[s],o=n[a];i&&e(t).removeClass(i),o&&e.each(r.parents,function(t,s){e(s).removeClass(o)})}),t("setActive",function(t,r){var n=r.settings,i=n[s],o=n[a];i&&e(t).addClass(i),o&&e.each(r.parents,function(t,s){e(s).addClass(o)})})}(jQuery,document,window),function(e){"use strict";function t(t,s){return e(this).find(s.settings.stepSelector).first()}function s(t,s,a,r){if(!s)return!1;var n=a.settings.stepSelector;s=e(s);do{var i=s.near(n,r);if((0===i.length||0===i.closest(t).length)&&(i=e(t).find(n)[r?"last":"first"]()),!i.length)return!1;s=i}while(s.data("stepData").exclude);return s}var a=e.jmpress;a("initStep",function(e,t){t.stepData.exclude=t.data.exclude&&-1===["false","no"].indexOf(t.data.exclude)}),a("selectInitialStep",t),a("selectHome",t),a("selectEnd",function(t,s){return e(this).find(s.settings.stepSelector).last()}),a("selectPrev",function(e,t){return s(this,e,t,!0)}),a("selectNext",function(e,t){return s(this,e,t)})}(jQuery,document,window),function(e){"use strict";e.jmpress("selectInitialStep",function(e,t){return t.settings.start})}(jQuery,document,window),function(e){"use strict";function t(t,s,a){for(var r=0;s.length-1>r;r++){var n=s[r],i=s[r+1];e(t).jmpress("initialized")?e(n,t).data("stepData")[a]=i:e(n,t).attr("data-"+a,i)}}function s(t,s,a,r){var n=s.stepData;if(n[a]){var i=e(t).near(n[a],r);if(i&&i.length)return i;if(i=e(n[a],this)[r?"last":"first"](),i&&i.length)return i}}var a=e.jmpress;a("register","route",function(e,s,a){"string"==typeof e&&(e=[e,e]),t(this,e,a?"prev":"next"),s||t(this,e.reverse(),a?"next":"prev")}),a("initStep",function(e,t){for(var s in{next:1,prev:1})t.stepData[s]=t.data[s]}),a("selectNext",function(e,t){return s.call(this,e,t,"next")}),a("selectPrev",function(e,t){return s.call(this,e,t,"prev",!0)})}(jQuery,document,window),function(e){"use strict";var t=e.jmpress,s="ajax:afterStepLoaded",a="ajax:loadStep";t("register",a),t("register",s),t("defaults").ajaxLoadedClass="loaded",t("initStep",function(t,s){s.stepData.src=e(t).attr("href")||s.data.src||!1,s.stepData.srcLoaded=!1}),t(a,function(t,a){var r=a.stepData,n=r&&r.src,i=a.settings;n&&(e(t).addClass(i.ajaxLoadedClass),r.srcLoaded=!0,e(t).load(n,function(r,n,i){e(a.jmpress).jmpress("fire",s,t,e.extend({},a,{response:r,status:n,xhr:i}))}))}),t("idle",function(t,s){if(t){var r=s.settings,n=e(this);s.stepData;var i=e(t).add(e(t).near(r.stepSelector)).add(e(t).near(r.stepSelector,!0)).add(n.jmpress("fire","selectPrev",t,{stepData:e(t).data("stepData")})).add(n.jmpress("fire","selectNext",t,{stepData:e(t).data("stepData")}));i.each(function(){var t=this,s=e(t).data("stepData");s.src&&!s.srcLoaded&&n.jmpress("fire",a,t,{stepData:e(t).data("stepData")})})}}),t("setActive",function(t){var s=e(t).data("stepData");s.src&&!s.srcLoaded&&e(this).jmpress("fire",a,t,{stepData:e(t).data("stepData")})})}(jQuery,document,window),function(e,t,s,a){"use strict";function r(){return""+Math.round(1e5*Math.random(),0)}function n(t){try{var r=e("#"+s.location.hash.replace(/^#\/?/,""));return r.length>0&&r.is(t.stepSelector)?r:a}catch(n){}}function i(e){var t="#/"+e;s.history&&s.history.pushState?s.location.hash!==t&&s.history.pushState({},"",t):s.location.hash!==t&&(s.location.hash=t)}var o=e.jmpress,c="a[href^=#]";o("defaults").hash={use:!0,update:!0,bindChange:!0},o("selectInitialStep",function(t,o){var l=o.settings,u=l.hash,p=o.current,f=e(this);return o.current.hashNamespace=".jmpress-"+r(),u.use?(u.bindChange&&(e(s).bind("hashchange"+p.hashNamespace,function(e){var t=n(l);f.jmpress("initialized")&&f.jmpress("scrollFix"),t&&t.length&&(t.attr("id")!==f.jmpress("active").attr("id")&&f.jmpress("select",t),i(t.attr("id"))),e.preventDefault()}),e(c).on("click"+p.hashNamespace,function(t){var s=e(this).attr("href");try{e(s).is(l.stepSelector)&&(f.jmpress("select",s),t.preventDefault(),t.stopPropagation())}catch(a){}})),n(l)):a}),o("afterDeinit",function(t,a){e(c).off(a.current.hashNamespace),e(s).unbind(a.current.hashNamespace)}),o("setActive",function(t,s){var a=s.settings,r=s.current;a.hash.use&&a.hash.update&&(clearTimeout(r.hashtimeout),r.hashtimeout=setTimeout(function(){i(e(s.delegatedFrom).attr("id"))},a.transitionDuration+200))})}(jQuery,document,window),function(e,t,s,a){"use strict";function r(){return""+Math.round(1e5*Math.random(),0)}function n(e){e.preventDefault(),e.stopPropagation()}var i=e.jmpress,o="next",c="prev";i("defaults").keyboard={use:!0,keys:{33:c,37:c,38:c,9:o+":"+c,32:o,34:o,39:o,40:o,36:"home",35:"end"},ignore:{INPUT:[32,37,38,39,40],TEXTAREA:[32,37,38,39,40],SELECT:[38,40]},tabSelector:"a[href]:visible, :input:visible"},i("afterInit",function(s,i){var o=i.settings,c=o.keyboard,l=c.ignore,u=i.current,p=e(this);o.fullscreen||p.attr("tabindex",0),u.keyboardNamespace=".jmpress-"+r(),e(o.fullscreen?t:p).bind("keypress"+u.keyboardNamespace,function(e){for(var t in l)if(e.target.nodeName===t&&-1!==l[t].indexOf(e.which))return;(e.which>=37&&40>=e.which||32===e.which)&&n(e)}),e(o.fullscreen?t:p).bind("keydown"+u.keyboardNamespace,function(t){var s=e(t.target);if((o.fullscreen||s.closest(p).length)&&c.use){for(var r in l)if(s[0].nodeName===r&&-1!==l[r].indexOf(t.which))return;var i,u=!1;if(9===t.which){if(s.closest(p.jmpress("active")).length?(i=s.near(c.tabSelector,t.shiftKey),e(i).closest(o.stepSelector).is(p.jmpress("active"))||(i=a)):t.shiftKey?u=!0:i=p.jmpress("active").find("a[href], :input").filter(":visible").first(),i&&i.length>0)return i.focus(),p.jmpress("scrollFix"),n(t),a;t.shiftKey&&(u=!0)}var f=c.keys[t.which];"string"==typeof f?(-1!==f.indexOf(":")&&(f=f.split(":"),f=t.shiftKey?f[1]:f[0]),p.jmpress(f),n(t)):e.isFunction(f)?f.call(p,t):f&&(p.jmpress.apply(p,f),n(t)),u&&(i=p.jmpress("active").find("a[href], :input").filter(":visible").last(),i.focus(),p.jmpress("scrollFix"))}})}),i("afterDeinit",function(s,a){e(t).unbind(a.current.keyboardNamespace)})}(jQuery,document,window),function(e,t,s,a){"use strict";function r(){return""+Math.round(1e5*Math.random(),0)}function n(e,t){return Math.max(Math.min(e,t),-t)}function i(t,s,a){var r=e(this).jmpress("current"),i=e(this).jmpress("settings"),o=e(this).jmpress("active").data("stepData"),c=e(this).jmpress("container");if(!(0===r.userZoom&&0>a)){var l=o.viewPortZoomable||i.viewPort.zoomable;if(!(r.userZoom===l&&a>0)){r.userZoom+=a;var u=e(c).innerWidth()/2,p=e(c).innerHeight()/2;t=t?t-u:t,s=s?s-p:s,r.userTranslateX=n(r.userTranslateX-a*t/r.zoomOriginWindowScale/l,u*r.userZoom*r.userZoom/l),r.userTranslateY=n(r.userTranslateY-a*s/r.zoomOriginWindowScale/l,p*r.userZoom*r.userZoom/l),e(this).jmpress("reselect","zoom")}}}var o=function(){var e=navigator.userAgent.toLowerCase(),t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return t[1]||""}(),c=e.jmpress("defaults");c.viewPort={width:!1,height:!1,maxScale:0,minScale:0,zoomable:0,zoomBindMove:!0,zoomBindWheel:!0};var l=c.keyboard.keys;l["mozilla"===o?107:187]="zoomIn",l["mozilla"===o?109:189]="zoomOut",c.reasonableAnimation.resize={transitionDuration:"0s",transitionDelay:"0ms"},c.reasonableAnimation.zoom={transitionDuration:"0s",transitionDelay:"0ms"},e.jmpress("initStep",function(e,t){for(var s in{viewPortHeight:1,viewPortWidth:1,viewPortMinScale:1,viewPortMaxScale:1,viewPortZoomable:1})t.stepData[s]=t.data[s]&&parseFloat(t.data[s])}),e.jmpress("afterInit",function(n,i){var o=this;i.current.viewPortNamespace=".jmpress-"+r(),e(s).bind("resize"+i.current.viewPortNamespace,function(){e(o).jmpress("reselect","resize")}),i.current.userZoom=0,i.current.userTranslateX=0,i.current.userTranslateY=0,i.settings.viewPort.zoomBindWheel&&e(i.settings.fullscreen?t:this).bind("mousewheel"+i.current.viewPortNamespace+" DOMMouseScroll"+i.current.viewPortNamespace,function(t,s){s=s||t.originalEvent.wheelDelta||-t.originalEvent.detail;var a=s/Math.abs(s);return 0>a?e(i.jmpress).jmpress("zoomOut",t.originalEvent.x,t.originalEvent.y):a>0&&e(i.jmpress).jmpress("zoomIn",t.originalEvent.x,t.originalEvent.y),!1}),i.settings.viewPort.zoomBindMove&&e(i.settings.fullscreen?t:this).bind("mousedown"+i.current.viewPortNamespace,function(e){i.current.userZoom&&(i.current.userTranslating={x:e.clientX,y:e.clientY},e.preventDefault(),e.stopImmediatePropagation())}).bind("mousemove"+i.current.viewPortNamespace,function(t){var s=i.current.userTranslating;s&&(e(o).jmpress("zoomTranslate",t.clientX-s.x,t.clientY-s.y),s.x=t.clientX,s.y=t.clientY,t.preventDefault(),t.stopImmediatePropagation())}).bind("mouseup"+i.current.viewPortNamespace,function(e){i.current.userTranslating&&(i.current.userTranslating=a,e.preventDefault(),e.stopImmediatePropagation())})}),e.jmpress("register","zoomIn",function(e,t){i.call(this,e||0,t||0,1)}),e.jmpress("register","zoomOut",function(e,t){i.call(this,e||0,t||0,-1)}),e.jmpress("register","zoomTranslate",function(t,s){var a=e(this).jmpress("current"),r=e(this).jmpress("settings"),i=e(this).jmpress("active").data("stepData"),o=e(this).jmpress("container"),c=i.viewPortZoomable||r.viewPort.zoomable,l=e(o).innerWidth(),u=e(o).innerHeight();a.userTranslateX=n(a.userTranslateX+t/a.zoomOriginWindowScale,l*a.userZoom*a.userZoom/c),a.userTranslateY=n(a.userTranslateY+s/a.zoomOriginWindowScale,u*a.userZoom*a.userZoom/c),e(this).jmpress("reselect","zoom")}),e.jmpress("afterDeinit",function(a,r){e(r.settings.fullscreen?t:this).unbind(r.current.viewPortNamespace),e(s).unbind(r.current.viewPortNamespace)}),e.jmpress("setActive",function(t,s){var a=s.settings.viewPort,r=s.stepData.viewPortHeight||a.height,n=s.stepData.viewPortWidth||a.width,i=s.stepData.viewPortMaxScale||a.maxScale,o=s.stepData.viewPortMinScale||a.minScale,c=r&&e(s.container).innerHeight()/r,l=n&&e(s.container).innerWidth()/n,u=(l||c)&&Math.min(l||c,c||l);if(u){u=u||1,i&&(u=Math.min(u,i)),o&&(u=Math.max(u,o));var p=s.stepData.viewPortZoomable||s.settings.viewPort.zoomable;if(p){var f=1/u-1/i;f/=p,u=1/(1/u-f*s.current.userZoom)}s.target.transform.reverse(),s.current.userTranslateX&&s.current.userTranslateY?s.target.transform.push(["translate",s.current.userTranslateX,s.current.userTranslateY,0]):s.target.transform.push(["translate"]),s.target.transform.push(["scale",u,u,1]),s.target.transform.reverse(),s.target.perspectiveScale/=u}s.current.zoomOriginWindowScale=u}),e.jmpress("setInactive",function(t,s){s.nextStep&&t&&e(s.nextStep).attr("id")===e(t).attr("id")||(s.current.userZoom=0,s.current.userTranslateX=0,s.current.userTranslateY=0)})}(jQuery,document,window),function(e){"use strict";function t(){return""+Math.round(1e5*Math.random(),0)}var s=e.jmpress;s("defaults").mouse={clickSelects:!0},s("afterInit",function(s,a){var r=a.settings,n=r.stepSelector,i=a.current,o=e(this);i.clickableStepsNamespace=".jmpress-"+t(),o.bind("click"+i.clickableStepsNamespace,function(t){if(r.mouse.clickSelects&&!i.userZoom){var s=e(t.target).closest(n);s.is(o.jmpress("active"))||s.length&&(o.jmpress("select",s[0],"click"),t.preventDefault(),t.stopPropagation())}})}),s("afterDeinit",function(t,s){e(this).unbind(s.current.clickableStepsNamespace)})}(jQuery,document,window),function(e,t){"use strict";function s(){return""+Math.round(1e5*Math.random(),0)}var a=e.jmpress;a("afterInit",function(a,r){var n=r.settings,i=r.current,o=r.jmpress;i.mobileNamespace=".jmpress-"+s();var c,l=[0,0];e(n.fullscreen?t:o).bind("touchstart"+i.mobileNamespace,function(e){c=e.originalEvent.touches[0],l=[c.pageX,c.pageY]}).bind("touchmove"+i.mobileNamespace,function(e){return c=e.originalEvent.touches[0],e.preventDefault(),!1}).bind("touchend"+i.mobileNamespace,function(t){var s=[c.pageX,c.pageY],a=[s[0]-l[0],s[1]-l[1]];return Math.max(Math.abs(a[0]),Math.abs(a[1]))>50?(a=Math.abs(a[0])>Math.abs(a[1])?a[0]:a[1],e(o).jmpress(a>0?"prev":"next"),t.preventDefault(),!1):undefined})}),a("afterDeinit",function(s,a){var r=a.settings,n=a.current,i=a.jmpress;e(r.fullscreen?t:i).unbind(n.mobileNamespace)})}(jQuery,document,window),function(e,t,s,a){"use strict";function r(t,s,n){for(var i in s){var o=i;n&&(o=n+o.substr(0,1).toUpperCase()+o.substr(1)),e.isPlainObject(s[i])?r(t,s[i],o):t[o]===a&&(t[o]=s[i])}}function n(t,s){e.isArray(s)?s.lengthi;i++){var o=s[i];switch(n){case"":"after"===o?n="after":e.warn("unknown keyword in '"+t+"'. '"+o+"' unknown.");break;case"after":if(o.match(/^[1-9][0-9]*m?s?/)){var c=parseFloat(o);-1!==o.indexOf("ms")?c*=1:-1!==o.indexOf("s")?c*=1e3:-1!==o.indexOf("m")&&(c*=6e4),r.delay=c}else r.after=Array.prototype.slice.call(s,i).join(" "),i=s.length}}return r}function n(t,s,a,r){r=r||t.length-1,a=a||0;for(var n=a;r+1>n;n++)if(e(t[n].element).is(s))return n}function i(t,s,a){e.each(s._on,function(e,s){t.push({substep:s.substep,delay:s.delay+a}),i(t,s.substep,s.delay+a)})}e.jmpress("defaults").customAnimationDataAttribute="jmpress",e.jmpress("afterInit",function(e,t){t.current.animationTimeouts=[],t.current.animationCleanupWaiting=[]}),e.jmpress("applyStep",function(t,s){function o(e,t){return t.substep._after?(u=t.substep._after,!1):a}var c={},l=[];if(e(t).find("[data-"+s.settings.customAnimationDataAttribute+"]").each(function(a,r){e(r).closest(s.settings.stepSelector).is(t)&&l.push({element:r})}),0!==l.length){e.each(l,function(t,a){a.info=r(e(a.element).data(s.settings.customAnimationDataAttribute)),e(a.element).addClass(a.info.willClass),a._on=[],a._after=null});var u={_after:a,_on:[],info:{}};if(e.each(l,function(e,t){var s=t.info.after;if(s)if("step"===s)s=u;else if("prev"===s)s=l[e-1];else{var r=n(l,s,0,e-1);r===a&&(r=n(l,s)),s=r===a||r===e?l[e-1]:l[r]}else s=l[e-1];if(s){if(!t.info.delay){if(!s._after)return s._after=t,a;s=s._after}s._on.push({substep:t,delay:t.info.delay||0})}}),u._after===a&&0===u._on.length){var p=n(l,s.stepData.startSubstep)||0;u._after=l[p]}var f=[];do{var d=[{substep:u,delay:0}];i(d,u,0),f.push(d),u=null,e.each(d,o)}while(u);c.list=f,e(t).data("substepsData",c)}}),e.jmpress("unapplyStep",function(t){var s=e(t).data("substepsData");s&&e.each(s.list,function(t,s){e.each(s,function(t,s){s.substep.info.willClass&&e(s.substep.element).removeClass(s.substep.info.willClass),s.substep.info.hasClass&&e(s.substep.element).removeClass(s.substep.info.hasClass),s.substep.info.doClass&&e(s.substep.element).removeClass(s.substep.info.doClass)})})}),e.jmpress("setActive",function(t,s){var r=e(t).data("substepsData");if(r){s.substep===a&&(s.substep="prev"===s.reason?r.list.length-1:0);var n=s.substep;e.each(s.current.animationTimeouts,function(e,t){clearTimeout(t)}),s.current.animationTimeouts=[],e.each(r.list,function(t,a){var r=n>t,i=n>=t;e.each(a,function(t,a){function n(){e(a.substep.element).addClass(a.substep.info.doClass)}a.substep.info.hasClass&&e(a.substep.element)[(r?"add":"remove")+"Class"](a.substep.info.hasClass),i&&!r&&a.delay&&"prev"!==s.reason?a.substep.info.doClass&&(e(a.substep.element).removeClass(a.substep.info.doClass),s.current.animationTimeouts.push(setTimeout(n,a.delay))):a.substep.info.doClass&&e(a.substep.element)[(i?"add":"remove")+"Class"](a.substep.info.doClass)})})}}),e.jmpress("setInactive",function(t,s){function a(t){e.each(t.list,function(t,s){e.each(s,function(t,s){s.substep.info.hasClass&&e(s.substep.element).removeClass(s.substep.info.hasClass),s.substep.info.doClass&&e(s.substep.element).removeClass(s.substep.info.doClass)})})}if(s.nextStep!==t){e.each(s.current.animationCleanupWaiting,function(e,t){a(t)}),s.current.animationCleanupWaiting=[];var r=e(t).data("substepsData");r&&s.current.animationCleanupWaiting.push(r)}}),e.jmpress("selectNext",function(t,s){if(s.substep!==a){var r=e(t).data("substepsData");if(r)return s.substep0?{step:t,substep:s.substep-1}:a}})}(jQuery,document,window),function(e,t){"use strict";e.jmpress("register","toggle",function(s,a,r){var n=this;e(t).bind("keydown",function(t){t.keyCode===s&&(e(n).jmpress("initialized")?e(n).jmpress("deinit"):e(n).jmpress(a))}),r&&e(n).jmpress(a)})}(jQuery,document,window),function(e){"use strict";function t(t,s,a){if(t.secondary&&-1!==t.secondary.split(" ").indexOf(s)){for(var r in t)if(r.length>9&&0===r.indexOf("secondary")){var n=t[r],i=r.substr(9);i=i.substr(0,1).toLowerCase()+i.substr(1),t[r]=t[i],t[i]=n}e(this).jmpress("reapply",e(a))}}e.jmpress("initStep",function(e,t){for(var s in t.data)0===s.indexOf("secondary")&&(t.stepData[s]=t.data[s])}),e.jmpress("beforeActive",function(s,a){t.call(a.jmpress,e(s).data("stepData"),"self",s);var r=e(s).parent();e(r).children(a.settings.stepSelector).each(function(s,r){var n=e(r).data("stepData");t.call(a.jmpress,n,"siblings",r)});for(var n=1;a.parents.length>n;n++)e(a.parents[n]).children(a.settings.stepSelector).each()}),e.jmpress("setInactive",function(s,a){function r(s,r){var n=e(r).data("stepData");t.call(a.jmpress,n,"grandchildren",r)}t.call(a.jmpress,e(s).data("stepData"),"self",s); -var n=e(s).parent();e(n).children(a.settings.stepSelector).each(function(s,r){var n=e(r).data("stepData");t.call(a.jmpress,n,"siblings",r)});for(var i=1;a.parents.length>i;i++)e(a.parents[i]).children(a.settings.stepSelector).each(r)})}(jQuery,document,window),function(e,t,s,a){"use strict";e.jmpress("defaults").duration={defaultValue:-1,defaultAction:"next",barSelector:a,barProperty:"width",barPropertyStart:"0",barPropertyEnd:"100%"},e.jmpress("initStep",function(e,t){t.stepData.duration=t.data.duration&&parseInt(t.data.duration,10),t.stepData.durationAction=t.data.durationAction}),e.jmpress("setInactive",function(t,s){var a=s.settings,r=a.duration,n=s.current;if(s.stepData.duration||r.defaultValue,n.durationTimeout){if(r.barSelector){var i={transitionProperty:r.barProperty,transitionDuration:"0",transitionDelay:"0",transitionTimingFunction:"linear"};i[r.barProperty]=r.barPropertyStart;var o=e(r.barSelector);e.jmpress("css",o,i),o.each(function(t,s){var a=e(s).next(),r=e(s).parent();e(s).detach(),a.length?a.insertBefore(s):r.append(s)})}clearTimeout(n.durationTimeout),delete n.durationTimeout}}),e.jmpress("setActive",function(t,s){var r=s.settings,n=r.duration,i=s.current,o=s.stepData.duration||n.defaultValue;if(o&&o>0){if(n.barSelector){var c={transitionProperty:n.barProperty,transitionDuration:o-2*r.transitionDuration/3-100+"ms",transitionDelay:2*r.transitionDuration/3+"ms",transitionTimingFunction:"linear"};c[n.barProperty]=n.barPropertyEnd,e.jmpress("css",e(n.barSelector),c)}var l=this;i.durationTimeout&&(clearTimeout(i.durationTimeout),i.durationTimeout=a),i.durationTimeout=setTimeout(function(){var t=s.stepData.durationAction||n.defaultAction;e(l).jmpress(t)},o)}})}(jQuery,document,window),function(e,t,s){"use strict";var a=e.jmpress,r="jmpress-presentation-";a("defaults").presentationMode={use:!0,url:"presentation-screen.html",notesUrl:!1,transferredValues:["userZoom","userTranslateX","userTranslateY"]},a("defaults").keyboard.keys[80]="presentationPopup",a("afterInit",function(t,a){var n=a.current;if(n.selectMessageListeners=[],a.settings.presentationMode.use){s.addEventListener("message",function(t){try{if("string"!=typeof t.data||0!==t.data.indexOf(r))return;var i=JSON.parse(t.data.slice(r.length));switch(i.type){case"select":e.each(a.settings.presentationMode.transferredValues,function(e,t){a.current[t]=i[t]}),/[a-z0-9\-]+/i.test(i.targetId)&&typeof i.substep in{number:1,undefined:1}?e(a.jmpress).jmpress("select",{step:"#"+i.targetId,substep:i.substep},i.reason):e.error("For security reasons the targetId must match /[a-z0-9\\-]+/i and substep must be a number.");break;case"listen":n.selectMessageListeners.push(t.source);break;case"ok":clearTimeout(n.presentationPopupTimeout);break;case"read":try{t.source.postMessage(r+JSON.stringify({type:"url",url:s.location.href,notesUrl:a.settings.presentationMode.notesUrl}),"*")}catch(o){e.error("Cannot post message to source: "+o)}break;default:throw"Unknown message type: "+i.type}}catch(o){e.error("Received message is malformed: "+o)}});try{s.parent&&s.parent!==s&&s.parent.postMessage(r+JSON.stringify({type:"afterInit"}),"*")}catch(i){e.error("Cannot post message to parent: "+i)}}}),a("afterDeinit",function(t,a){if(a.settings.presentationMode.use)try{s.parent&&s.parent!==s&&s.parent.postMessage(r+JSON.stringify({type:"afterDeinit"}),"*")}catch(n){e.error("Cannot post message to parent: "+n)}}),a("setActive",function(t,s){var a=e(s.delegatedFrom).attr("id"),n=s.substep,i=s.reason;e.each(s.current.selectMessageListeners,function(t,o){try{var c={type:"select",targetId:a,substep:n,reason:i};e.each(s.settings.presentationMode.transferredValues,function(e,t){c[t]=s.current[t]}),o.postMessage(r+JSON.stringify(c),"*")}catch(l){e.error("Cannot post message to listener: "+l)}})}),a("register","presentationPopup",function(){function t(){n.jmpress("current").presentationPopupTimeout=setTimeout(t,100);try{a.postMessage(r+JSON.stringify({type:"url",url:s.location.href,notesUrl:n.jmpress("settings").presentationMode.notesUrl}),"*")}catch(e){}}var a,n=e(this);n.jmpress("settings").presentationMode.use&&(a=s.open(e(this).jmpress("settings").presentationMode.url),n.jmpress("current").presentationPopupTimeout=setTimeout(t,100))})}(jQuery,document,window); \ No newline at end of file diff --git a/plugins/jetpack/modules/shortcodes/presentations.php b/plugins/jetpack/modules/shortcodes/presentations.php index 962c4434..9c9c568b 100644 --- a/plugins/jetpack/modules/shortcodes/presentations.php +++ b/plugins/jetpack/modules/shortcodes/presentations.php @@ -119,8 +119,20 @@ class Presentations { wp_enqueue_style( 'presentations', $plugin . 'css/style.css' ); // Add JavaScript wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'jmpress', $plugin . 'js/jmpress.min.js', array( 'jquery' ), '0.4.5', true ); - wp_enqueue_script( 'presentations', $plugin . 'js/main.js', array( 'jquery', 'jmpress' ), false, true ); + wp_enqueue_script( + 'jmpress', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/jmpress.min.js', 'modules/shortcodes/js/jmpress.js' ), + array( 'jquery' ), + '0.4.5', + true + ); + wp_enqueue_script( + 'presentations', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/main.min.js', 'modules/shortcodes/js/main.js' ), + array( 'jquery', 'jmpress' ), + false, + true + ); } function presentation_shortcode( $atts, $content = '' ) { diff --git a/plugins/jetpack/modules/shortcodes/quiz.php b/plugins/jetpack/modules/shortcodes/quiz.php index 33b3d796..063f9a42 100644 --- a/plugins/jetpack/modules/shortcodes/quiz.php +++ b/plugins/jetpack/modules/shortcodes/quiz.php @@ -79,7 +79,13 @@ class Quiz_Shortcode { */ private static function enqueue_scripts() { wp_enqueue_style( 'quiz', plugins_url( 'css/quiz.css', __FILE__ ) ); - wp_enqueue_script( 'quiz', plugins_url( 'js/quiz.js', __FILE__ ), array( 'jquery' ), null, true ); + wp_enqueue_script( + 'quiz', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/quiz.min.js', 'modules/shortcodes/js/quiz.js' ), + array( 'jquery' ), + null, + true + ); } /** diff --git a/plugins/jetpack/modules/shortcodes/recipe.php b/plugins/jetpack/modules/shortcodes/recipe.php index fb04f3e3..f6dd17fb 100644 --- a/plugins/jetpack/modules/shortcodes/recipe.php +++ b/plugins/jetpack/modules/shortcodes/recipe.php @@ -117,8 +117,19 @@ class Jetpack_Recipes { // add $themecolors-defined styles. wp_add_inline_style( 'jetpack-recipes-style', self::themecolor_styles() ); - wp_enqueue_script( 'jetpack-recipes-printthis', plugins_url( '/js/recipes-printthis.js', __FILE__ ), array( 'jquery' ), '20170202' ); - wp_enqueue_script( 'jetpack-recipes-js', plugins_url( '/js/recipes.js', __FILE__ ), array( 'jquery', 'jetpack-recipes-printthis' ), '20131230' ); + wp_enqueue_script( + 'jetpack-recipes-printthis', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes-printthis.min.js', 'modules/shortcodes/js/recipes-printthis.js' ), + array( 'jquery' ), + '20170202' + ); + + wp_enqueue_script( + 'jetpack-recipes-js', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/recipes.min.js', 'modules/shortcodes/js/recipes.js' ), + array( 'jquery', 'jetpack-recipes-printthis' ), + '20131230' + ); $title_var = wp_title( '|', false, 'right' ); $rtl = is_rtl() ? '-rtl' : ''; diff --git a/plugins/jetpack/modules/shortcodes/slideshow.php b/plugins/jetpack/modules/shortcodes/slideshow.php index a4a37e11..e84ab0d1 100644 --- a/plugins/jetpack/modules/shortcodes/slideshow.php +++ b/plugins/jetpack/modules/shortcodes/slideshow.php @@ -270,7 +270,13 @@ class Jetpack_Slideshow_Shortcode { function enqueue_scripts() { wp_enqueue_script( 'jquery-cycle', plugins_url( '/js/jquery.cycle.min.js', __FILE__ ), array( 'jquery' ), '20161231', true ); - wp_enqueue_script( 'jetpack-slideshow', plugins_url( '/js/slideshow-shortcode.js', __FILE__ ), array( 'jquery-cycle' ), '20160119.1', true ); + wp_enqueue_script( + 'jetpack-slideshow', + Jetpack::get_file_url_for_environment( '_inc/build/shortcodes/js/slideshow-shortcode.min.js', 'modules/shortcodes/js/slideshow-shortcode.js' ), + array( 'jquery-cycle' ), + '20160119.1', + true + ); wp_enqueue_style( 'jetpack-slideshow', plugins_url( '/css/slideshow-shortcode.css', __FILE__ ) ); wp_style_add_data( 'jetpack-slideshow', 'rtl', 'replace' ); diff --git a/plugins/jetpack/modules/simple-payments/simple-payments.php b/plugins/jetpack/modules/simple-payments/simple-payments.php index d8e91ce4..a7e5371a 100644 --- a/plugins/jetpack/modules/simple-payments/simple-payments.php +++ b/plugins/jetpack/modules/simple-payments/simple-payments.php @@ -258,7 +258,7 @@ class Jetpack_Simple_Payments { $product_args = array( 'label' => esc_html__( 'Product', 'jetpack' ), 'description' => esc_html__( 'Simple Payments products', 'jetpack' ), - 'supports' => array( 'title', 'editor','thumbnail', 'custom-fields' ), + 'supports' => array( 'title', 'editor','thumbnail', 'custom-fields', 'author' ), 'hierarchical' => false, 'public' => false, 'show_ui' => false, diff --git a/plugins/jetpack/modules/sitemaps/sitemap-builder.php b/plugins/jetpack/modules/sitemaps/sitemap-builder.php index 9cf91c24..55358c8a 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-builder.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-builder.php @@ -123,7 +123,8 @@ class Jetpack_Sitemap_Builder { . 'XML support is highly recommended for WordPress and Jetpack, please enable ' . 'it or contact your hosting provider about it.', 'jetpack' - ) + ), + true ); } } diff --git a/plugins/jetpack/modules/sitemaps/sitemap-librarian.php b/plugins/jetpack/modules/sitemaps/sitemap-librarian.php index 89a86830..f56a0ff8 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-librarian.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-librarian.php @@ -225,10 +225,12 @@ class Jetpack_Sitemap_Librarian { "SELECT * FROM $wpdb->posts WHERE post_type=%s + AND post_status=%s AND ID>%d ORDER BY ID ASC LIMIT %d;", $type, + 'draft', $from_id, $num_posts ), diff --git a/plugins/jetpack/modules/sitemaps/sitemap-logger.php b/plugins/jetpack/modules/sitemaps/sitemap-logger.php index 8e602b11..16e12f1a 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-logger.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-logger.php @@ -58,12 +58,18 @@ class Jetpack_Sitemap_Logger { * @access public * @since 4.8.0 * - * @param string $message The string to be written to the log. + * @param string $message The string to be written to the log. + * @param boolean $is_error If true, $message will be logged even if JETPACK_DEV_DEBUG is not enabled */ - public function report( $message ) { - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { - error_log( 'jp-sitemap-' . $this->key . ': ' . $message ); + public function report( $message, $is_error = false ) { + $message = 'jp-sitemap-' . $this->key . ': ' . $message; + if ( ! ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ) { + return; } + if ( ! $is_error && ! ( defined( 'JETPACK_DEV_DEBUG' ) && JETPACK_DEV_DEBUG ) ) { + return; + } + error_log( $message ); return; } diff --git a/plugins/jetpack/modules/stats.php b/plugins/jetpack/modules/stats.php index 4210f7c6..a0a1f7d4 100644 --- a/plugins/jetpack/modules/stats.php +++ b/plugins/jetpack/modules/stats.php @@ -654,6 +654,19 @@ function stats_convert_image_urls( $html ) { return $html; } +/** + * Callback for preg_replace_callback used in stats_convert_chart_urls() + * + * @since 5.6.0 + * + * @param array $matches The matches resulting from the preg_replace_callback call. + * @return string The admin url for the chart. + */ +function jetpack_stats_convert_chart_urls_callback( $matches ) { + // If there is a query string, change the beginning '?' to a '&' so it fits into the middle of this query string. + return 'admin.php?page=stats&noheader&chart=' . $matches[1] . str_replace( '?', '&', $matches[2] ); +} + /** * Stats Convert Chart URLs. * @@ -662,13 +675,11 @@ function stats_convert_image_urls( $html ) { * @return string */ function stats_convert_chart_urls( $html ) { - $html = preg_replace_callback( '|https?://[-.a-z0-9]+/wp-includes/charts/([-.a-z0-9]+).php(\??)|', - create_function( - '$matches', - // If there is a query string, change the beginning '?' to a '&' so it fits into the middle of this query string. - 'return "admin.php?page=stats&noheader&chart=" . $matches[1] . str_replace( "?", "&", $matches[2] );' - ), - $html ); + $html = preg_replace_callback( + '|https?://[-.a-z0-9]+/wp-includes/charts/([-.a-z0-9]+).php(\??)|', + 'jetpack_stats_convert_chart_urls_callback', + $html + ); return $html; } 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 d37b6255..3b87c1d2 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!', 'jetpack' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) { + if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), '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 ); diff --git a/plugins/jetpack/modules/theme-tools/responsive-videos.php b/plugins/jetpack/modules/theme-tools/responsive-videos.php index 59913a96..c7a5d72f 100644 --- a/plugins/jetpack/modules/theme-tools/responsive-videos.php +++ b/plugins/jetpack/modules/theme-tools/responsive-videos.php @@ -33,6 +33,18 @@ function jetpack_responsive_videos_embed_html( $html ) { return $html; } + // The customizer video widget wraps videos with a class of wp-video + // mejs as of 4.9 apparently resizes videos too which causes issues + // skip the video if it is wrapped in wp-video. + $video_widget_wrapper = 'class="wp-video"'; + + $mejs_wrapped = strpos( $html, $video_widget_wrapper ); + + // If this is a video widget wrapped by mejs, return the html. + if ( false !== $mejs_wrapped ) { + return $html; + } + if ( defined( 'SCRIPT_DEBUG' ) && true == SCRIPT_DEBUG ) { wp_enqueue_script( 'jetpack-responsive-videos-script', plugins_url( 'responsive-videos/responsive-videos.js', __FILE__ ), array( 'jquery' ), '1.2', true ); } else { diff --git a/plugins/jetpack/modules/wordads/php/params.php b/plugins/jetpack/modules/wordads/php/params.php index 70ed4149..9ec48911 100644 --- a/plugins/jetpack/modules/wordads/php/params.php +++ b/plugins/jetpack/modules/wordads/php/params.php @@ -147,6 +147,35 @@ class WordAds_Params { return $this->page_type; } + /** + * @return int The page type code for ipw config + * + * @since 5.6.0 + */ + public function get_page_type_ipw() { + if ( ! empty( $this->page_type_ipw ) ) { + return $this->page_type_ipw; + } + + $page_type_ipw = 6; + if ( self::is_static_home() || is_home() || is_front_page() ) { + $page_type_ipw = 0; + } else if ( is_page() ) { + $page_type_ipw = 2; + } else if ( is_singular() ) { + $page_type_ipw = 1; + } else if ( is_search() ) { + $page_type_ipw = 4; + } else if ( is_category() || is_tag() || is_archive() || is_author() ) { + $page_type_ipw = 3; + } else if ( is_404() ) { + $page_type_ipw = 5; + } + + $this->page_type_ipw = $page_type_ipw; + return $page_type_ipw; + } + /** * Returns true if page is static home * @return boolean true if page is static home diff --git a/plugins/jetpack/modules/wordads/wordads.php b/plugins/jetpack/modules/wordads/wordads.php index 9ec3e07f..1f63d02f 100644 --- a/plugins/jetpack/modules/wordads/wordads.php +++ b/plugins/jetpack/modules/wordads/wordads.php @@ -149,18 +149,16 @@ class WordAds { * @return [type] [description] */ function insert_head_meta() { - $domain = $this->params->targeting_tags['Domain']; - $pageURL = $this->params->targeting_tags['PageURL']; - $adsafe = $this->params->targeting_tags['AdSafe']; + $themename = esc_js( get_stylesheet() ); + $pagetype = intval( $this->params->get_page_type_ipw() ); $data_tags = ( $this->params->cloudflare ) ? ' data-cfasync="false"' : ''; echo << - var _ipw_custom = { - wordAds: '1', - domain: '$domain', - pageURL: '$pageURL', - adSafe: '$adsafe' - }; + var __ATA_PP = { pt: $pagetype, ht: 2, tn: '$themename', amp: false }; + var __ATA = __ATA || {}; + __ATA.cmd = __ATA.cmd || []; + __ATA.criteo = __ATA.criteo || {}; + __ATA.criteo.cmd = __ATA.criteo.cmd || []; HTML; } diff --git a/plugins/jetpack/readme.txt b/plugins/jetpack/readme.txt index ca08e4b6..0f432b63 100644 --- a/plugins/jetpack/readme.txt +++ b/plugins/jetpack/readme.txt @@ -1,9 +1,9 @@ === Jetpack by WordPress.com === Contributors: automattic, adamkheckler, aduth, akirk, allendav, alternatekev, andy, annezazu, apeatling, azaozz, batmoo, barry, beaulebens, blobaugh, cainm, cena, cfinke, chaselivingston, chellycat, csonnek, danielbachhuber, davoraltman, daniloercoli, designsimply, dllh, drawmyface, dsmart, dzver, ebinnion, eliorivero, enej, eoigal, erania-pinnera, ethitter, gcorne, georgestephanis, gibrown, goldsounds, hew, hugobaeta, hypertextranch, iammattthomas, iandunn, jacobshere, jblz, jeherve, jenhooks, jenia, jgs, jkudish, jmdodd, Joen, johnjamesjacoby, jshreve, koke, kraftbj, lamdayap, lancewillett, lschuyler, macmanx, martinremy, matt, matveb, mattwiebe, maverick3x6, mcsf, mdawaffe, michael-arestad, migueluy, mikeyarce, mkaz, nancythanki, nickmomrik, obenland, pento, professor44, rachelsquirrel, rdcoll, ryancowles, richardmuscat, richardmtl, roccotripaldi, samhotchkiss, scarstocea, sdquirk, stephdau, tmoorewp, tyxla, Viper007Bond, westi, yoavf, zinigor Tags: Jetpack, WordPress.com, backup, security, related posts, CDN, speed, anti-spam, social sharing, SEO, video, stats -Stable tag: 5.5 +Stable tag: 5.6 Requires at least: 4.7 -Tested up to: 4.8 +Tested up to: 4.9 The one plugin you need for stats, related posts, search engine optimization, social sharing, protection, backups, speed, and email list management. @@ -103,6 +103,51 @@ There are opportunities for developers at all levels to contribute. [Learn more == Changelog == += 5.6 = + +* Release date: December 5, 2017 +* Release post: https://wp.me/p1moTy-6zt + +**Major Enhancements** +* Google Analytics: Add support for universal analytics for WooCommerce. +* Performance: minify all JavaScript files used in the plugin. +* Performance: add new Lazy Images module. +* Protect: add new mechanism allowing you to send yourself an email with a link to the form when you are locked out of your site. + +**Enhancements** +* Custom CSS: add new set of font properties that can be used in the CSS editor. +* Photon: do not remove `width` and `height` attributes from image tags when known. +* Sitemaps: add CLI commands to purge and built the sitemaps. +* Sitemaps: only display the reporter log success messages if `JETPACK_DEV_DEBUG` is defined. +* WordPress.com API: add new endpoints to allow for better comment management in third party interfaces like WordPress.com. +* WordPress.com Toolbar: prevent dns prefetching for logged out users. + +**Improved compatibility** +* Stats: remove function deprecated in PHP 7.2. + +**Bug fixes** +* Comment Likes: make sure Like text is properly translated. +* General: only load stats code when necessary. +* Related Posts: allow site owners to exclude multiple blog posts from the list of Related Posts. +* Sharing: remove inline JavaScript used in the email sharing form. +* Search: Maintain ordering of the search filters in the widget. +* Sync: avoid PHP notices during the synchronization process. +* WordPress.com Toolbar: avoid broken link when using the sign out button. + += 5.5.1 = + +* Release date: November 21, 2017 +* Release post: https://wp.me/p1moTy-6Bd + +**Bug fixes** +* In Jetpack 5.5 we made some changes that created errors if you were using other plugins that added custom links to the Plugins menu. This is now fixed. +* We have fixed a problem that did not allow to upload plugins using API requests. +* Open Graph links in post headers are no longer invalid in some special cases. +* We fixed warnings happening when syncing users with WordPress.com. +* We updated the way the Google+ button is loaded to match changes made by Google, to ensure the button is always displayed properly. +* We fixed conflicts between Jetpack's Responsive Videos and the updates made to Video players in WordPress 4.9. +* We updated Publicize's message length to match Twitter's new 280 character limit. + = 5.5 = * Release date: November 7, 2017 diff --git a/plugins/jetpack/scss/jetpack-icons.scss b/plugins/jetpack/scss/jetpack-icons.scss index 9b399945..0d896e78 100644 --- a/plugins/jetpack/scss/jetpack-icons.scss +++ b/plugins/jetpack/scss/jetpack-icons.scss @@ -22,7 +22,7 @@ li.toplevel_page_jetpack .wp-menu-image:before { font-family: 'jetpack' !important; - content: '\f102'; + content: '\f100'; } #menu-posts-feedback .wp-menu-image:before { font-family: dashicons !important; diff --git a/plugins/jetpack/scss/organisms/_banners.scss b/plugins/jetpack/scss/organisms/_banners.scss index 9f6174d7..8eba95fe 100644 --- a/plugins/jetpack/scss/organisms/_banners.scss +++ b/plugins/jetpack/scss/organisms/_banners.scss @@ -83,7 +83,7 @@ }; } -// dismiss +// dismiss .jp-connect-full__svg-dismiss { position: absolute; right: 0; @@ -319,7 +319,7 @@ color: #87a6bc; cursor: pointer; - // trick to hide the bottom border of the last menu item when the menu is the tallest element, + // trick to hide the bottom border of the last menu item when the menu is the tallest element, // but display the border when the overall container is taller than the menu &:last-of-type { position: relative; @@ -334,7 +334,7 @@ color: #2e4453; &.jp-feature-intro { - border-left: 3px solid #8CC258; + border-left: 3px solid #00BE28; } } @@ -360,7 +360,7 @@ &.jp-feature-intro { svg { - fill: #8CC258; + fill: #00BE28; } } diff --git a/plugins/jetpack/sync/class.jetpack-sync-functions.php b/plugins/jetpack/sync/class.jetpack-sync-functions.php index 1ef3f11e..89a70642 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-functions.php +++ b/plugins/jetpack/sync/class.jetpack-sync-functions.php @@ -206,8 +206,11 @@ class Jetpack_Sync_Functions { if ( ! $parsed_url ) { return $new_value; } - - $scheme = $parsed_url['scheme']; + if ( array_key_exists ( 'scheme' , $parsed_url ) ) { + $scheme = $parsed_url['scheme']; + } else { + $scheme = ''; + } $scheme_history = get_option( $option_key, array() ); $scheme_history[] = $scheme; diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-callables.php b/plugins/jetpack/sync/class.jetpack-sync-module-callables.php index f52d81fc..7aa1c4d2 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-callables.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-callables.php @@ -29,7 +29,7 @@ class Jetpack_Sync_Module_Callables extends Jetpack_Sync_Module { 'jetpack_active_modules', 'home', 'siteurl', - 'jetpack_sync_error_idc' + 'jetpack_sync_error_idc', ); foreach( $always_send_updates_to_these_options as $option ) { add_action( "update_option_{$option}", array( $this, 'unlock_sync_callable' ) ); @@ -119,6 +119,7 @@ class Jetpack_Sync_Module_Callables extends Jetpack_Sync_Module { public function unlock_plugin_action_link_and_callables() { delete_transient( self::CALLABLES_AWAIT_TRANSIENT_NAME ); delete_transient( 'jetpack_plugin_api_action_links_refresh' ); + add_filter( 'jetpack_check_and_send_callables', '__return_true' ); } public function set_plugin_action_links() { @@ -130,6 +131,7 @@ class Jetpack_Sync_Module_Callables extends Jetpack_Sync_Module { return; } + $plugins_action_links = array(); // Is the transient lock in place? $plugins_lock = get_transient( 'jetpack_plugin_api_action_links_refresh', false ); if ( ! empty( $plugins_lock ) ) { @@ -137,10 +139,21 @@ class Jetpack_Sync_Module_Callables extends Jetpack_Sync_Module { } $plugins = array_keys( Jetpack_Sync_Functions::get_plugins() ); foreach ( $plugins as $plugin_file ) { + /** + * Plugins often like to unset things but things break if they are not able to. + */ + $action_links = array( + 'deactivate' => '', + 'activate' => '', + 'details' => '', + 'delete' => '', + 'edit' => '' + ); /** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */ - $action_links = apply_filters( 'plugin_action_links', array(), $plugin_file, null, 'all' ); + $action_links = apply_filters( 'plugin_action_links', $action_links, $plugin_file, null, 'all' ); /** This filter is documented in src/wp-admin/includes/class-wp-plugins-list-table.php */ $action_links = apply_filters( "plugin_action_links_{$plugin_file}", $action_links, $plugin_file, null, 'all' ); + $action_links = array_filter( $action_links ); $formatted_action_links = null; if ( ! empty( $action_links ) && count( $action_links ) > 0 ) { $dom_doc = new DOMDocument; @@ -193,12 +206,14 @@ class Jetpack_Sync_Module_Callables extends Jetpack_Sync_Module { } public function maybe_sync_callables() { - if ( ! is_admin() || Jetpack_Sync_Settings::is_doing_cron() ) { - return; - } + if ( ! apply_filters( 'jetpack_check_and_send_callables', false ) ) { + if ( ! is_admin() || Jetpack_Sync_Settings::is_doing_cron() ) { + return; + } - if ( get_transient( self::CALLABLES_AWAIT_TRANSIENT_NAME ) ) { - return; + if ( get_transient( self::CALLABLES_AWAIT_TRANSIENT_NAME ) ) { + return; + } } set_transient( self::CALLABLES_AWAIT_TRANSIENT_NAME, microtime( true ), Jetpack_Sync_Defaults::$default_sync_callables_wait_time ); diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php b/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php index a488950d..e72425d6 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-plugins.php @@ -16,7 +16,7 @@ class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module { add_action( 'activated_plugin', $callable, 10, 2 ); add_action( 'deactivated_plugin', $callable, 10, 2 ); add_action( 'delete_plugin', array( $this, 'delete_plugin') ); - add_action( 'upgrader_process_complete', array( $this, 'check_upgrader'), 10, 2 ); + add_action( 'upgrader_process_complete', array( $this, 'check_upgrader' ), 10, 2 ); add_action( 'jetpack_installed_plugin', $callable, 10, 2 ); add_action( 'admin_action_update', array( $this, 'check_plugin_edit') ); add_action( 'jetpack_edited_plugin', $callable, 10, 2 ); diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-posts.php b/plugins/jetpack/sync/class.jetpack-sync-module-posts.php index 4824aeaa..f7cc2bff 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-posts.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-posts.php @@ -227,7 +227,7 @@ class Jetpack_Sync_Module_Posts extends Jetpack_Sync_Module { global $post; $post = $post_object; - // return non existant post + // return non existant post $post_type = get_post_type_object( $post->post_type ); if ( empty( $post_type ) || ! is_object( $post_type ) ) { $non_existant_post = new stdClass(); @@ -345,6 +345,11 @@ class Jetpack_Sync_Module_Posts extends Jetpack_Sync_Module { $just_published = true; } + // workaround for https://github.com/woocommerce/woocommerce/issues/18007 + if ( $post && 'shop_order' === $post->post_type ) { + $post = get_post( $post_ID ); + } + call_user_func( $this->action_handler, $post_ID, $post, $update, $is_auto_save, $just_published ); $this->send_published( $post_ID, $post ); $this->send_trashed( $post_ID, $post ); diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-protect.php b/plugins/jetpack/sync/class.jetpack-sync-module-protect.php index 88c13090..d81d3591 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-protect.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-protect.php @@ -1,6 +1,23 @@ has_login_ability() ) { + do_action( 'jetpack_valid_failed_login_attempt', $ip ); + } + } +} diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-users.php b/plugins/jetpack/sync/class.jetpack-sync-module-users.php index 420a73cd..a3f000e3 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-users.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-users.php @@ -70,23 +70,39 @@ class Jetpack_Sync_Module_Users extends Jetpack_Sync_Module { } public function sanitize_user_and_expand( $user ) { + $user = $this->get_user( $user ); $user = $this->add_to_user( $user ); return $this->sanitize_user( $user ); } + private function get_user( $user ) { + if ( $user && ! is_object( $user ) && is_numeric( $user ) ) { + $user = get_user_by( 'id', $user ); + } + if ( $user instanceof WP_User ) { + return $user; + } + return null; + } + public function sanitize_user( $user ) { + $user = $this->get_user( $user ); // this create a new user object and stops the passing of the object by reference. $user = unserialize( serialize( $user ) ); if ( is_object( $user ) && is_object( $user->data ) ) { unset( $user->data->user_pass ); } - - $user->allcaps = $this->get_real_user_capabilities( $user ); + if ( $user ) { + $user->allcaps = $this->get_real_user_capabilities( $user ); + } return $user; } public function add_to_user( $user ) { + if ( ! is_object( $user ) ) { + return null; + } $user->allowed_mime_types = get_allowed_mime_types( $user ); if ( function_exists( 'get_user_locale' ) ) { @@ -102,6 +118,9 @@ class Jetpack_Sync_Module_Users extends Jetpack_Sync_Module { public function get_real_user_capabilities( $user ) { $user_capabilities = array(); + if ( is_wp_error( $user ) ) { + return $user_capabilities; + } foreach( Jetpack_Sync_Defaults::get_capabilities_whitelist() as $capability ) { if ( $user_has_capabilities = user_can( $user , $capability ) ) { $user_capabilities[ $capability ] = true; @@ -130,10 +149,15 @@ class Jetpack_Sync_Module_Users extends Jetpack_Sync_Module { public function expand_logout_username( $args, $user_id ) { $user = get_userdata( $user_id ); $user = $this->sanitize_user( $user ); + $login = ''; if ( is_object( $user ) && is_object( $user->data ) ) { $login = $user->data->user_login; } + // if we don't have a user here lets not send anything. + if ( empty( $login ) ) { + return false; + } return array( $login, $user ); } diff --git a/plugins/jetpack/sync/class.jetpack-sync-modules.php b/plugins/jetpack/sync/class.jetpack-sync-modules.php index 170c4ba8..f544f090 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-modules.php +++ b/plugins/jetpack/sync/class.jetpack-sync-modules.php @@ -22,6 +22,7 @@ require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-terms.php'; require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-plugins.php'; require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-full-sync.php'; require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-stats.php'; +require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-protect.php'; class Jetpack_Sync_Modules { @@ -35,6 +36,7 @@ class Jetpack_Sync_Modules { 'Jetpack_Sync_Module_Menus', 'Jetpack_Sync_Module_Users', 'Jetpack_Sync_Module_Posts', + 'Jetpack_Sync_Module_Protect', 'Jetpack_Sync_Module_Comments', 'Jetpack_Sync_Module_Updates', 'Jetpack_Sync_Module_Attachments', diff --git a/plugins/jetpack/webpack.config.js b/plugins/jetpack/webpack.config.js index 63165716..1a128480 100644 --- a/plugins/jetpack/webpack.config.js +++ b/plugins/jetpack/webpack.config.js @@ -8,14 +8,6 @@ var ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); var IS_HOT_UPDATE = ( process.env.NODE_ENV !== 'production' ); -var jsLoader = IS_HOT_UPDATE ? - [ require.resolve( 'react-hot-loader' ), require.resolve( 'babel-loader' ), require.resolve( 'eslint-loader' ) ] : - [ require.resolve( 'babel-loader' ), require.resolve( "eslint-loader" ) ]; - -var cssLoader = IS_HOT_UPDATE ? - 'style!css?sourceMap!autoprefixer!' : - ExtractTextPlugin.extract( 'css?sourceMap!autoprefixer!' ); - // This file is written in ES5 because it is run via Node.js and is not transpiled by babel. We want to support various versions of node, so it is best to not use any ES6 features even if newer versions support ES6 features out of the box. var webpackConfig = { @@ -32,11 +24,33 @@ var webpackConfig = { module: { // Webpack loaders are applied when a resource is matches the test case - loaders: [ + rules: [ { test: /\.jsx?$/, - loaders: jsLoader, + use: [ + // { + // loader: 'eslint-loader', + // query: { + // configFile: path.join(__dirname, '.eslintrc'), + // quiet: true + // }, + // }, + { + loader: 'babel-loader', + options: { + presets: ['es2015', 'stage-1', 'react'], + plugins: [ + "transform-runtime", + "add-module-exports", + "transform-es3-member-expression-literals", + "transform-export-extensions" + ] + } + }, + ], + + // exclude: /node_modules/, // include both typical npm-linked locations and default module locations to handle both cases include: [ path.join( __dirname, 'test' ), @@ -51,7 +65,10 @@ var webpackConfig = { }, { test: /\.css$/, - loader: cssLoader + use: ExtractTextPlugin.extract({ + fallback: "style-loader", + use: [ "css-loader", "autoprefixer-loader" ] + }) }, { test: /\.html$/, @@ -59,7 +76,10 @@ var webpackConfig = { }, { test: /\.scss$/, - loader: ExtractTextPlugin.extract( 'style-loader', 'css!sass' ) + use: ExtractTextPlugin.extract({ + fallback: "style-loader", + use: [ "css-loader", "sass-loader" ] + }) }, { test: /\.svg/, @@ -68,26 +88,23 @@ var webpackConfig = { ] }, resolve: { - extensions: [ '', '.js', '.jsx' ], + extensions: [ '.js', '.jsx' ], alias: { "react": path.join(__dirname, "/node_modules/react") }, - root: [ + modules: [ + path.resolve( __dirname, 'node_modules' ), path.resolve( __dirname, '_inc/client' ), fs.realpathSync( path.join(__dirname, 'node_modules/@automattic/dops-components/client') ) ] }, resolveLoader: { - root: path.join( __dirname, 'node_modules' ) + modules: [ path.join( __dirname, 'node_modules' ) ] }, node: { fs: "empty", process: true }, - eslint: { - configFile: path.join(__dirname, '.eslintrc'), - quiet: true - }, plugins: [ new webpack.DefinePlugin({ @@ -95,7 +112,8 @@ var webpackConfig = { // be used in development 'process.env.NODE_ENV': JSON.stringify( NODE_ENV ) }), - new ExtractTextPlugin( '[name].dops-style.css' ) + new ExtractTextPlugin( '[name].dops-style.css' ), + // new webpack.optimize.UglifyJsPlugin(), ], externals: { 'react/addons': true, @@ -107,7 +125,7 @@ var webpackConfig = { if ( NODE_ENV === 'production' ) { - webpack.DefinePlugin( { + new webpack.DefinePlugin( { // This has effect on the react lib size 'process.env.NODE_ENV': JSON.stringify( process.env.NODE_ENV ) // TODO switch depending on actual environment } ); -- cgit v1.2.3-18-g5258