Version Description
Download this release
Release Info
Developer | westonruter |
Plugin | AMP for WordPress |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- amp.php +2 -2
- assets/js/amp-block-editor.asset.php +1 -1
- assets/js/amp-block-editor.js +3 -3
- assets/js/amp-block-validation.asset.php +1 -1
- includes/amp-helper-functions.php +22 -11
- includes/class-amp-comment-walker.php +2 -1
- includes/class-amp-theme-support.php +12 -11
- includes/embeds/class-amp-wordpress-tv-embed-handler.php +4 -8
- includes/sanitizers/class-amp-block-sanitizer.php +15 -12
- includes/sanitizers/class-amp-iframe-sanitizer.php +23 -4
- includes/sanitizers/class-amp-link-sanitizer.php +5 -6
- includes/sanitizers/class-amp-style-sanitizer.php +3 -6
- includes/templates/class-amp-post-template.php +17 -25
- includes/templates/reader-template-loader.php +1 -1
- includes/validation/class-amp-validation-manager.php +11 -0
- readme.txt +2 -1
- src/Admin/SiteHealth.php +61 -32
- src/Transformer/AmpSchemaOrgMetadata.php +8 -4
- vendor/ampproject/common/src/Dom/Document.php +20 -20
- vendor/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php +1 -1
- vendor/ampproject/common/src/RemoteRequest/FilesystemRemoteGetRequest.php +4 -3
- vendor/ampproject/common/src/RuntimeVersion.php +1 -1
- vendor/ampproject/optimizer/resources/local_fallback/rtv/metadata +1 -1
- vendor/ampproject/optimizer/resources/local_fallback/v0.css +2 -2
- vendor/ampproject/optimizer/src/Configurable.php +0 -13
- vendor/ampproject/optimizer/src/Configuration/AmpRuntimeCssConfiguration.php +19 -0
- vendor/ampproject/optimizer/src/MakesRemoteRequests.php +0 -13
- vendor/ampproject/optimizer/src/TransformationEngine.php +59 -21
- vendor/ampproject/optimizer/src/Transformer/AmpRuntimeCss.php +23 -17
- vendor/ampproject/optimizer/src/Transformer/ReorderHead.php +1 -1
- vendor/ampproject/optimizer/src/Transformer/ServerSideRendering.php +7 -8
- vendor/ampproject/optimizer/src/Transformer/TransformedIdentifier.php +1 -2
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +0 -2
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +5 -7
- vendor/composer/installed.json +18 -13
amp.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Plugin URI: https://amp-wp.org
|
6 |
* Author: AMP Project Contributors
|
7 |
* Author URI: https://github.com/ampproject/amp-wp/graphs/contributors
|
8 |
-
* Version: 1.5.
|
9 |
* Text Domain: amp
|
10 |
* Domain Path: /languages/
|
11 |
* License: GPLv2 or later
|
@@ -17,7 +17,7 @@
|
|
17 |
|
18 |
define( 'AMP__FILE__', __FILE__ );
|
19 |
define( 'AMP__DIR__', dirname( __FILE__ ) );
|
20 |
-
define( 'AMP__VERSION', '1.5.
|
21 |
|
22 |
/**
|
23 |
* Errors encountered while loading the plugin.
|
5 |
* Plugin URI: https://amp-wp.org
|
6 |
* Author: AMP Project Contributors
|
7 |
* Author URI: https://github.com/ampproject/amp-wp/graphs/contributors
|
8 |
+
* Version: 1.5.4
|
9 |
* Text Domain: amp
|
10 |
* Domain Path: /languages/
|
11 |
* License: GPLv2 or later
|
17 |
|
18 |
define( 'AMP__FILE__', __FILE__ );
|
19 |
define( 'AMP__DIR__', dirname( __FILE__ ) );
|
20 |
+
define( 'AMP__VERSION', '1.5.4' );
|
21 |
|
22 |
/**
|
23 |
* Errors encountered while loading the plugin.
|
assets/js/amp-block-editor.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-edit-post', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-polyfill', 'wp-url'), 'version' => '9eea7db16ccac81e566921ff22528157');
|
assets/js/amp-block-editor.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=36)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,a){e.exports=a(28)()},function(e,t,a){"use strict";a.d(t,"a",(function(){return S})),a.d(t,"c",(function(){return C})),a.d(t,"b",(function(){return I})),a.d(t,"d",(function(){return B}));var r=a(19),n=a.n(r),i=a(25),o=a.n(i),c=a(20),l=a.n(c),u=a(21),s=a.n(u),d=a(16),m=a.n(d),b=a(22),p=a.n(b),f=a(0),h=(a(18),a(12)),O=(a(5),a(2)),g=a(1),y=a(3),j=a(15),v=a(31),_=a(14),w=a(7),
|
2 |
/* translators: accessibility text */
|
3 |
-
Object(g.__)("(opens in a new tab)","amp")))
|
4 |
/* translators: %s is the layout name */
|
5 |
Object(g.__)("Width is required for %s layout","amp"),n)),Object(f.createElement)(O.TextControl,{type:"number",label:Object(g.__)("Width (px)","amp"),value:void 0!==o?o:"",onChange:function(e){return a({width:e})}}),c&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(g.sprintf)(
|
6 |
/* translators: %s is the layout name */
|
@@ -8,7 +8,7 @@ Object(g.__)("Height is required for %s layout","amp"),n)),Object(f.createElemen
|
|
8 |
/* translators: 1: .jpg, 2: .png. 3: .gif */
|
9 |
Object(n.sprintf)(Object(n.__)("The featured image must be in %1$s, %2$s, or %3$s format.","amp"),".jpg",".png",".gif")),!function(e,t){if(!e||!e.width||!e.height)return!1;var a=t.width,r=t.height;return e.width>=a&&e.height>=r}(e.media_details,t)){var i=t.width,o=t.height;r.push(
|
10 |
/* translators: 1: minimum width, 2: minimum height. */
|
11 |
-
Object(n.sprintf)(Object(n.__)("The featured image should have a size of at least %1$s by %2$s pixels.","amp"),Math.ceil(i),Math.ceil(o)))}return 0===r.length?null:r},l=function(e){var t=Object(r.template)("<p>".concat(e,"</p>"),{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});return function(e){return t(e)}},u=function(e,t){if(e){var a=Object(r.get)(this,["options","allowedTypes"],null),n=this.get("select");a&&e.get("type")&&!function(e,t){var a=e.get("type"),r=e.get("mime");return!(!t.includes(a)&&!t.includes(r))&&"video"!==a}(e,a)?(this.secondary.set(i.a,new t({mimeType:e.get("mime")})),n&&n.model&&n.model.set("disabled",!0)):(this.secondary.unset(i.a),n&&n.model&&n.model.set("disabled",!1))}},s=function(e){var t=e.url,a=e.id,n=e.width,i=e.height,o=e.onSelect,c=e.dispatchImage,l={};l.url=t,l.thumbnail_url=t,l.timestamp=Object(r.now)(),a&&(l.attachment_id=a),n&&(l.width=n),i&&(l.height=i),o(l),c(a)}},function(e,t,a){"use strict";a.d(t,"d",(function(){return r})),a.d(t,"b",(function(){return n})),a.d(t,"c",(function(){return i})),a.d(t,"a",(function(){return o}));var r=6,n=72,i=1200,o="select-file-type-error"},function(e,t){function a(){return e.exports=a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},a.apply(this,arguments)}e.exports=a},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.moment}()},function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"d",(function(){return f})),a.d(t,"b",(function(){return g})),a.d(t,"c",(function(){return y})),a.d(t,"e",(function(){return D})),a.d(t,"f",(function(){return F}));var r=a(8),n=a.n(r),i=a(0),o=(a(5),a(18),a(1)),c=a(2),l=a(4),u=a(3),s=a(7),d=a(10);function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var b=[{value:"nodisplay",label:Object(o.__)("No Display","amp"),notAvailable:["core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]},{value:"fixed",label:Object(o.__)("Fixed","amp"),notAvailable:["core-embed/soundcloud"]},{value:"responsive",label:Object(o.__)("Responsive","amp"),notAvailable:["core-embed/soundcloud"]},{value:"fixed-height",label:Object(o.__)("Fixed Height","amp"),notAvailable:[]},{value:"fill",label:Object(o.__)("Fill","amp"),notAvailable:["core-embed/soundcloud"]},{value:"flex-item",label:Object(o.__)("Flex Item","amp"),notAvailable:["core-embed/soundcloud"]},{value:"intrinsic",label:Object(o.__)("Intrinsic","amp"),notAvailable:["core/video","core-embed/youtube","core-embed/facebook","core-embed/instagram","core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]}],p=function(e,t){return"core/shortcode"!==t&&"core/gallery"!==t||(e.attributes||(e.attributes={}),e.attributes.ampCarousel={type:"boolean"},e.attributes.ampLightbox={type:"boolean"}),"core/image"===t&&(e.attributes||(e.attributes={}),e.attributes.ampLightbox={type:"boolean"}),s.e.includes(t)&&(e.attributes||(e.attributes={}),e.attributes.ampFitText={default:!1},e.attributes.minFont={default:d.d,source:"attribute",selector:"amp-fit-text",attribute:"min-font-size"},e.attributes.maxFont={default:d.b,source:"attribute",selector:"amp-fit-text",attribute:"max-font-size"},e.attributes.height={default:"core/image"===t?200:10*Math.ceil(d.b/10),source:"attribute",selector:"amp-fit-text",attribute:"height"}),(0===t.indexOf("core-embed")||s.c.includes(t))&&(e.attributes||(e.attributes={}),e.attributes.ampLayout={type:"string"},e.attributes.ampNoLoading={type:"boolean"}),e},f=function(e,t,a){var r=a.text||"",n="",o={layout:"fixed-height"};if("core/shortcode"===t.name&&A(a)){if(a.ampLightbox||M(a.text||"")&&(r=k(a.text)),a.ampCarousel){if(T(r)&&(r=I(r)),!a.ampLightbox)return a.text!==r?Object(i.createElement)(i.RawHTML,null,r):e}else r=T(a.text||"")?a.text:a.text.replace("[gallery","[gallery amp-carousel=false");if(a.ampLightbox&&!M(r)&&(r=r.replace("[gallery","[gallery amp-lightbox=true")),a.text!==r)return Object(i.createElement)(i.RawHTML,null,r)}else if("core/paragraph"!==t.name||a.ampFitText){if(s.e.includes(t.name)&&a.ampFitText)return a.minFont&&(o["min-font-size"]=a.minFont),a.maxFont&&(o["max-font-size"]=a.maxFont),a.height&&(o.height=a.height),o.children=e,Object(i.createElement)("amp-fit-text",o)}else if((n=h(a.content))!==a.content)return Object(i.cloneElement)(e,{key:"new",value:n});return e},h=function(e){var t=/<amp-fit-text\b[^>]*>(.*?)<\/amp-fit-text>/.exec(e),a=e;return t&&t[1]&&(a=t[1]),a},O=function(e){var t=[{value:"",label:Object(o.__)("Default","amp")}],a=!0,r=!1,n=void 0;try{for(var i,c=b[Symbol.iterator]();!(a=(i=c.next()).done);a=!0){var l=i.value;!l.notAvailable.includes(e)&&t.push({value:l.value,label:l.label})}}catch(e){r=!0,n=e}finally{try{a||null==c.return||c.return()}finally{if(r)throw n}}return t},g=function(e,t,a){var r={};return"core/shortcode"===t.name?e:"amp/"===t.name.substr(0,4)?e:(a.ampLayout&&(r["data-amp-layout"]=a.ampLayout),a.ampNoLoading&&(r["data-amp-noloading"]=a.ampNoLoading),a.ampLightbox&&(r["data-amp-lightbox"]=a.ampLightbox),a.ampCarousel&&(r["data-amp-carousel"]=a.ampCarousel),function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},r,{},e))},y=function(e){return function(t){var a,r=t.attributes,n=r.text,o=r.ampLayout,c=t.setAttributes,l=t.name;if("core/shortcode"===l){if(T(n||"")&&c({text:I(n)}),M(n||"")&&c({text:k(n)}),""===(a=P(t)))return Object(i.createElement)(e,t)}else"core/gallery"===l?a=C(t):"core/image"===l?a=S(t):s.c.includes(l)||0===l.indexOf("core-embed/")?a=j(t):s.e.includes(l)&&(a=w(t));return o&&"nodisplay"===o?[a]:Object(i.createElement)(i.Fragment,null,Object(i.createElement)(e,t),a)}},j=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e))):null},v=function(e){var t=e.name,a=e.attributes.ampLayout,r=e.setAttributes,n=Object(o.__)("AMP Layout","amp");return"core/image"===t&&(n=Object(o.__)("AMP Layout (modifies width/height)","amp")),Object(i.createElement)(c.SelectControl,{label:n,value:a,options:O(t),onChange:function(t){r({ampLayout:t}),"core/image"===e.name&&function(e,t){var a=e.attributes,r=e.setAttributes;switch(t){case"fixed-height":a.height||r({height:s.a}),a.ampLightbox&&r({ampLightbox:!1});break;case"fixed":a.height||r({height:s.a}),a.width||r({width:s.b})}}(e,t)}})},_=function(e){var t=e.attributes.ampNoLoading,a=e.setAttributes,r=Object(o.__)("AMP Noloading","amp");return Object(i.createElement)(c.ToggleControl,{label:r,checked:t,onChange:function(){return a({ampNoLoading:!t})}})},w=function(e){var t=e.isSelected,a=e.attributes,r=e.setAttributes,n=a.ampFitText,u=a.minFont,s=a.maxFont,m=a.height,b=[{name:"small",shortName:Object(o._x)("S","font size","amp"),size:14},{name:"regular",shortName:Object(o._x)("M","font size","amp"),size:16},{name:"large",shortName:Object(o._x)("L","font size","amp"),size:36},{name:"larger",shortName:Object(o._x)("XL","font size","amp"),size:48}];if(!t)return null;var p=Object(o.__)("Automatically fit text to container","amp");return n&&(s=parseInt(s),m=parseInt(m),u=parseInt(u)),Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp"),className:n?"is-amp-fit-text":""},Object(i.createElement)(c.ToggleControl,{label:p,checked:n,onChange:function(){return r({ampFitText:!n})}})),n&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(c.TextControl,{label:Object(o.__)("Height","amp"),value:m,min:1,onChange:function(e){r({height:e})}}),s>m&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The height must be greater than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Minimum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:14,value:u,fontSizes:b,onChange:function(e){e||(e=d.d),parseInt(e)<=s&&r({minFont:e})}})),u>s&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The min font size must less than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Maximum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:48,value:s,fontSizes:b,onChange:function(e){e||(e=d.b),r({maxFont:e,height:Math.max(e,m)})}}))))},P=function(e){var t=e.isSelected;if(!A(e.attributes)||!t)return null;var a=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},a&&Object(i.createElement)(E,e),Object(i.createElement)(x,e)))},x=function(e){var t=e.attributes,a=t.ampLightbox,r=t.linkTo,n=t.ampLayout,l=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Add lightbox effect","amp"),checked:a,onChange:function(e){l({ampLightbox:!a}),e&&("fixed-height"===n&&l({ampLayout:"fixed"}),r&&"none"!==r&&l({linkTo:"none"}))}})},E=function(e){var t=e.attributes.ampCarousel,a=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Display as carousel","amp"),checked:t,onChange:function(){return a({ampCarousel:!t})}})},S=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e),Object(i.createElement)(x,e))):null},C=function(e){if(!e.isSelected)return null;var t=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},t&&Object(i.createElement)(E,e),Object(i.createElement)(x,e)))},I=function(e){return e.replace(" amp-carousel=false","")},k=function(e){return e.replace(" amp-lightbox=true","")},T=function(e){return-1!==e.indexOf("amp-carousel=false")},M=function(e){return-1!==e.indexOf("amp-lightbox=true")},A=function(e){return e.text&&-1!==e.text.indexOf("gallery")},D=function(){var e=Object(u.select)("amp/block-editor"),t=e.getDefaultStatus,a=e.getPossibleStatuses,r=(0,Object(u.select)("core/editor").getEditedPostAttribute)("meta");return r&&r.amp_status&&a().includes(r.amp_status)?"enabled"===r.amp_status:"enabled"===t()},F=function(e){var t=document.querySelector(".".concat(s.d));if(t&&t.nextSibling){var a=document.createElement("div");a.id="amp-wrapper-post-preview",Object(i.render)(Object(i.createElement)(e,null),a),t.parentNode.insertBefore(a,t.nextSibling)}}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){!function(){e.exports=this.React}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,a){var r=a(37),n=a(16);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?n(e):t}},function(e,t){function a(t){return e.exports=a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(t)}e.exports=a},function(e,t,a){var r=a(38);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,a){"use strict";a.d(t,"b",(function(){return b})),a.d(t,"a",(function(){return p})),a.d(t,"c",(function(){return f}));var r=a(8),n=a.n(r),i=a(12),o=a(1),c=a(9);function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var u,s=window.wp,d=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:(u=Object(o.sprintf)(
|
12 |
/* translators: 1: image width in pixels. 2: image height in pixels. 3: required minimum width in pixels. 4: required minimum height in pixels. */
|
13 |
Object(o.__)("The selected image is too small (%1$s by %2$s pixels). It should have a size of at least %3$s by %4$s pixels.","amp"),"{{width}}","{{height}}","{{minWidth}}","{{minHeight}}"),Object(c.c)(u))}),m=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:function(){var e=Object(o.sprintf)(
|
14 |
/* translators: 1: the selected file type. */
|
1 |
+
!function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=36)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wp.components}()},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t,a){e.exports=a(28)()},function(e,t,a){"use strict";a.d(t,"a",(function(){return S})),a.d(t,"c",(function(){return C})),a.d(t,"b",(function(){return I})),a.d(t,"d",(function(){return B}));var r=a(19),n=a.n(r),i=a(25),o=a.n(i),c=a(20),l=a.n(c),u=a(21),s=a.n(u),d=a(16),m=a.n(d),b=a(22),p=a.n(b),f=a(0),h=(a(18),a(12)),O=(a(5),a(2)),g=a(1),y=a(3),j=a(15),v=a(31),_=a(14),w=a(7),x=function(e){return Object(f.createElement)("svg",e,Object(f.createElement)("path",{className:"outer",d:"M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",fill:"none"}),Object(f.createElement)("path",{className:"inner",d:"M48 33c8.285 0 15 6.716 15 15 0 8.284-6.715 15-15 15-8.284 0-15-6.716-15-15 0-8.284 6.716-15 15-15zm-1.15 24.098l6.293-10.472a.555.555 0 0 0 .12-.335.569.569 0 0 0-.624-.568l-3.508.004 1.155-6.834-1.159-.005-6.272 10.46s-.125.228-.125.363c0 .314.255.57.569.57l.048-.001 3.49-.005-1.126 6.823h1.14z",fill:"none"}))};x.defaultProps={xmlns:"http://www.w3.org/2000/svg"};var P=function(e){return Object(f.createElement)("svg",e,Object(f.createElement)("path",{d:"M41.629 28.161L28.624 49.804h-2.356l2.33-14.102-7.214.009-.1.002c-.65 0-1.176-.526-1.176-1.176 0-.279.259-.751.259-.751L33.329 12.17l2.395.01-2.388 14.123 7.251-.009h.115c.65 0 1.176.525 1.176 1.175 0 .264-.103.495-.25.691v.001zM31 0C13.879 0 0 13.88 0 31c0 17.121 13.879 31 31 31 17.12 0 31-13.879 31-31C62 13.88 48.12 0 31 0z",fill:"#82878c"}))};P.defaultProps={width:"62",height:"62",viewBox:"0 0 62 62",xmlns:"http://www.w3.org/2000/svg"};var E=function(e){function t(){var e,a;n()(this,t);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];return(a=l()(this,(e=s()(t)).call.apply(e,[this].concat(i)))).moveButton=a.moveButton.bind(m()(a)),a.openPreviewWindow=a.openPreviewWindow.bind(m()(a)),a.buttonRef=Object(f.createRef)(),a}return p()(t,e),o()(t,[{key:"componentDidUpdate",value:function(e){var t=this.props.previewLink;t&&!e.previewLink&&this.setPreviewWindowLink(t),this.moveButton()}},{key:"moveButton",value:function(){var e=Object(h.get)(this,["buttonRef","current","parentNode"],!1);if(e&&(!e.previousSibling||!e.previousSibling.classList.contains(w.d))){var t=document.querySelector(".".concat(w.d));Object(h.get)(t,"nextSibling")&&e.parentNode.insertBefore(e,t.nextSibling)}}},{key:"setPreviewWindowLink",value:function(e){var t=this.previewWindow;t&&!t.closed&&(t.location=e)}},{key:"getWindowTarget",value:function(){var e=this.props.postId;return"amp-preview-".concat(e)}},{key:"openPreviewWindow",value:function(e){var t,a;(e.preventDefault(),this.previewWindow&&!this.previewWindow.closed||(this.previewWindow=window.open("",this.getWindowTarget())),this.previewWindow.focus(),this.props.isAutosaveable)?(this.props.isDraft?this.props.savePost({isPreview:!0}):this.props.autosave({isPreview:!0}),t=this.previewWindow.document,a=Object(f.renderToString)(Object(f.createElement)("div",{className:"editor-post-preview-button__interstitial-message"},Object(f.createElement)(O.Icon,{icon:x({viewBox:"0 0 98 98"})}),Object(f.createElement)("p",null,Object(g.__)("Generating AMP preview…","amp")))),a+='\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message {\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t\twidth: 100vw;\n\t\t\t}\n\t\t\t@-webkit-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-moz-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@-o-keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t@keyframes paint {\n\t\t\t\t0% {\n\t\t\t\t\tstroke-dashoffset: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg {\n\t\t\t\twidth: 198px;\n\t\t\t\theight: 198px;\n\t\t\t\tstroke: #555d66;\n\t\t\t\tstroke-width: 0.75;\n\t\t\t}\n\t\t\t.editor-post-preview-button__interstitial-message svg .outer,\n\t\t\t.editor-post-preview-button__interstitial-message svg .inner {\n\t\t\t\tstroke-dasharray: 280;\n\t\t\t\tstroke-dashoffset: 280;\n\t\t\t\t-webkit-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-moz-animation: paint 1.5s ease infinite alternate;\n\t\t\t\t-o-animation: paint 1.5s ease infinite alternate;\n\t\t\t\tanimation: paint 1.5s ease infinite alternate;\n\t\t\t}\n\t\t\tp {\n\t\t\t\ttext-align: center;\n\t\t\t\tfont-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;\n\t\t\t}\n\t\t</style>\n\t',t.write(a),t.title=Object(g.__)("Generating AMP preview…","amp"),t.close()):this.setPreviewWindowLink(e.target.href)}},{key:"render",value:function(){var e=this.props,t=e.previewLink,a=e.currentPostLink,r=e.errorMessages,n=e.isEnabled,i=e.isSaveable,o=e.isStandardMode,c=t||a;return n&&!r.length&&!o&&Object(f.createElement)(O.Button,{className:"amp-editor-post-preview",href:c,title:Object(g.__)("Preview AMP","amp"),isSecondary:!0,disabled:!i,onClick:this.openPreviewWindow,ref:this.buttonRef},P({viewBox:"0 0 62 62",width:18,height:18}),Object(f.createElement)("span",{className:"screen-reader-text"},
|
2 |
/* translators: accessibility text */
|
3 |
+
Object(g.__)("(opens in a new tab)","amp")))}}]),t}(f.Component),S=Object(j.compose)([Object(y.withSelect)((function(e,t){var a=t.forcePreviewLink,r=t.forceIsAutosaveable,n=e("core/editor"),i=n.getCurrentPostId,o=n.getCurrentPostAttribute,c=n.getEditedPostAttribute,l=n.isEditedPostSaveable,u=n.isEditedPostAutosaveable,s=n.getEditedPostPreviewLink,d=e("amp/block-editor"),m=d.getAmpSlug,b=d.getErrorMessages,p=d.isStandardMode,f={};f[m()]=1;var h=s(),O=h?Object(v.addQueryArgs)(h,f):void 0;return{postId:i(),currentPostLink:Object(v.addQueryArgs)(o("link"),f),previewLink:void 0!==a?a:O,isSaveable:l(),isAutosaveable:r||u(),isDraft:-1!==["draft","auto-draft"].indexOf(c("status")),isEnabled:Object(_.e)(),errorMessages:b(),isStandardMode:p()}})),Object(y.withDispatch)((function(e){return{autosave:e("core/editor").autosave,savePost:e("core/editor").savePost}}))])(E),C=function(e){var t=e.name,a=e.url;return Object(f.createElement)(O.Placeholder,{label:t},Object(f.createElement)("p",{className:"components-placeholder__error"},a),Object(f.createElement)("p",{className:"components-placeholder__error"},Object(g.__)("Previews for this are unavailable in the editor, sorry!","amp")))},I=function(e){var t=e.attributes,a=e.setAttributes,r=e.ampLayoutOptions,n=t.ampLayout,i=t.height,o=t.width,c=!i&&("fixed"===n||"fixed-height"===n),l=!o&&"fixed"===n;return Object(f.createElement)(f.Fragment,null,Object(f.createElement)(O.SelectControl,{label:Object(g.__)("Layout","amp"),value:n,options:r,onChange:function(e){return a({ampLayout:e})}}),l&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(g.sprintf)(
|
4 |
/* translators: %s is the layout name */
|
5 |
Object(g.__)("Width is required for %s layout","amp"),n)),Object(f.createElement)(O.TextControl,{type:"number",label:Object(g.__)("Width (px)","amp"),value:void 0!==o?o:"",onChange:function(e){return a({width:e})}}),c&&Object(f.createElement)(O.Notice,{status:"error",isDismissible:!1},Object(g.sprintf)(
|
6 |
/* translators: %s is the layout name */
|
8 |
/* translators: 1: .jpg, 2: .png. 3: .gif */
|
9 |
Object(n.sprintf)(Object(n.__)("The featured image must be in %1$s, %2$s, or %3$s format.","amp"),".jpg",".png",".gif")),!function(e,t){if(!e||!e.width||!e.height)return!1;var a=t.width,r=t.height;return e.width>=a&&e.height>=r}(e.media_details,t)){var i=t.width,o=t.height;r.push(
|
10 |
/* translators: 1: minimum width, 2: minimum height. */
|
11 |
+
Object(n.sprintf)(Object(n.__)("The featured image should have a size of at least %1$s by %2$s pixels.","amp"),Math.ceil(i),Math.ceil(o)))}return 0===r.length?null:r},l=function(e){var t=Object(r.template)("<p>".concat(e,"</p>"),{evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^\}]+?)\}\}(?!\})/g});return function(e){return t(e)}},u=function(e,t){if(e){var a=Object(r.get)(this,["options","allowedTypes"],null),n=this.get("select");a&&e.get("type")&&!function(e,t){var a=e.get("type"),r=e.get("mime");return!(!t.includes(a)&&!t.includes(r))&&"video"!==a}(e,a)?(this.secondary.set(i.a,new t({mimeType:e.get("mime")})),n&&n.model&&n.model.set("disabled",!0)):(this.secondary.unset(i.a),n&&n.model&&n.model.set("disabled",!1))}},s=function(e){var t=e.url,a=e.id,n=e.width,i=e.height,o=e.onSelect,c=e.dispatchImage,l={};l.url=t,l.thumbnail_url=t,l.timestamp=Object(r.now)(),a&&(l.attachment_id=a),n&&(l.width=n),i&&(l.height=i),o(l),c(a)}},function(e,t,a){"use strict";a.d(t,"d",(function(){return r})),a.d(t,"b",(function(){return n})),a.d(t,"c",(function(){return i})),a.d(t,"a",(function(){return o}));var r=6,n=72,i=1200,o="select-file-type-error"},function(e,t){function a(){return e.exports=a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r])}return e},a.apply(this,arguments)}e.exports=a},function(e,t){!function(){e.exports=this.lodash}()},function(e,t){!function(){e.exports=this.moment}()},function(e,t,a){"use strict";a.d(t,"a",(function(){return p})),a.d(t,"d",(function(){return f})),a.d(t,"b",(function(){return g})),a.d(t,"c",(function(){return y})),a.d(t,"e",(function(){return D})),a.d(t,"f",(function(){return F}));var r=a(8),n=a.n(r),i=a(0),o=(a(5),a(18),a(1)),c=a(2),l=a(4),u=a(3),s=a(7),d=a(10);function m(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var b=[{value:"nodisplay",label:Object(o.__)("No Display","amp"),notAvailable:["core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]},{value:"fixed",label:Object(o.__)("Fixed","amp"),notAvailable:["core-embed/soundcloud"]},{value:"responsive",label:Object(o.__)("Responsive","amp"),notAvailable:["core-embed/soundcloud"]},{value:"fixed-height",label:Object(o.__)("Fixed Height","amp"),notAvailable:[]},{value:"fill",label:Object(o.__)("Fill","amp"),notAvailable:["core-embed/soundcloud"]},{value:"flex-item",label:Object(o.__)("Flex Item","amp"),notAvailable:["core-embed/soundcloud"]},{value:"intrinsic",label:Object(o.__)("Intrinsic","amp"),notAvailable:["core/video","core-embed/youtube","core-embed/facebook","core-embed/instagram","core-embed/vimeo","core-embed/dailymotion","core-embed/hulu","core-embed/reddit","core-embed/soundcloud"]}],p=function(e,t){return"core/shortcode"!==t&&"core/gallery"!==t||(e.attributes||(e.attributes={}),e.attributes.ampCarousel={type:"boolean"},e.attributes.ampLightbox={type:"boolean"}),"core/image"===t&&(e.attributes||(e.attributes={}),e.attributes.ampLightbox={type:"boolean"}),s.e.includes(t)&&(e.attributes||(e.attributes={}),e.attributes.ampFitText={default:!1},e.attributes.minFont={default:d.d,source:"attribute",selector:"amp-fit-text",attribute:"min-font-size"},e.attributes.maxFont={default:d.b,source:"attribute",selector:"amp-fit-text",attribute:"max-font-size"},e.attributes.height={default:"core/image"===t?200:10*Math.ceil(d.b/10),source:"attribute",selector:"amp-fit-text",attribute:"height"}),(0===t.indexOf("core-embed")||s.c.includes(t))&&(e.attributes||(e.attributes={}),e.attributes.ampLayout={type:"string"},e.attributes.ampNoLoading={type:"boolean"}),e},f=function(e,t,a){var r=a.text||"",n="",o={layout:"fixed-height"};if("core/shortcode"===t.name&&A(a)){if(a.ampLightbox||M(a.text||"")&&(r=k(a.text)),a.ampCarousel){if(T(r)&&(r=I(r)),!a.ampLightbox)return a.text!==r?Object(i.createElement)(i.RawHTML,null,r):e}else r=T(a.text||"")?a.text:a.text.replace("[gallery","[gallery amp-carousel=false");if(a.ampLightbox&&!M(r)&&(r=r.replace("[gallery","[gallery amp-lightbox=true")),a.text!==r)return Object(i.createElement)(i.RawHTML,null,r)}else if("core/paragraph"!==t.name||a.ampFitText){if(s.e.includes(t.name)&&a.ampFitText)return a.minFont&&(o["min-font-size"]=a.minFont),a.maxFont&&(o["max-font-size"]=a.maxFont),a.height&&(o.height=a.height),o.children=e,Object(i.createElement)("amp-fit-text",o)}else if((n=h(a.content))!==a.content)return Object(i.cloneElement)(e,{key:"new",value:n});return e},h=function(e){var t=/<amp-fit-text\b[^>]*>(.*?)<\/amp-fit-text>/.exec(e),a=e;return t&&t[1]&&(a=t[1]),a},O=function(e){var t=[{value:"",label:Object(o.__)("Default","amp")}],a=!0,r=!1,n=void 0;try{for(var i,c=b[Symbol.iterator]();!(a=(i=c.next()).done);a=!0){var l=i.value;!l.notAvailable.includes(e)&&t.push({value:l.value,label:l.label})}}catch(e){r=!0,n=e}finally{try{a||null==c.return||c.return()}finally{if(r)throw n}}return t},g=function(e,t,a){var r={};return"core/shortcode"===t.name?e:"amp/"===t.name.substr(0,4)?e:(a.ampLayout&&(r["data-amp-layout"]=a.ampLayout),a.ampNoLoading&&(r["data-amp-noloading"]=a.ampNoLoading),a.ampLightbox&&(r["data-amp-lightbox"]=a.ampLightbox),a.ampCarousel&&(r["data-amp-carousel"]=a.ampCarousel),function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?m(Object(a),!0).forEach((function(t){n()(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({},r,{},e))},y=function(e){return function(t){var a,r=t.attributes,n=r.text,o=r.ampLayout,c=t.setAttributes,l=t.name;if("core/shortcode"===l){if(T(n||"")&&c({text:I(n)}),M(n||"")&&c({text:k(n)}),""===(a=x(t)))return Object(i.createElement)(e,t)}else"core/gallery"===l?a=C(t):"core/image"===l?a=S(t):s.c.includes(l)||0===l.indexOf("core-embed/")?a=j(t):s.e.includes(l)&&(a=w(t));return o&&"nodisplay"===o?[a]:Object(i.createElement)(i.Fragment,null,Object(i.createElement)(e,t),a)}},j=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e))):null},v=function(e){var t=e.name,a=e.attributes.ampLayout,r=e.setAttributes,n=Object(o.__)("AMP Layout","amp");return"core/image"===t&&(n=Object(o.__)("AMP Layout (modifies width/height)","amp")),Object(i.createElement)(c.SelectControl,{label:n,value:a,options:O(t),onChange:function(t){r({ampLayout:t}),"core/image"===e.name&&function(e,t){var a=e.attributes,r=e.setAttributes;switch(t){case"fixed-height":a.height||r({height:s.a}),a.ampLightbox&&r({ampLightbox:!1});break;case"fixed":a.height||r({height:s.a}),a.width||r({width:s.b})}}(e,t)}})},_=function(e){var t=e.attributes.ampNoLoading,a=e.setAttributes,r=Object(o.__)("AMP Noloading","amp");return Object(i.createElement)(c.ToggleControl,{label:r,checked:t,onChange:function(){return a({ampNoLoading:!t})}})},w=function(e){var t=e.isSelected,a=e.attributes,r=e.setAttributes,n=a.ampFitText,u=a.minFont,s=a.maxFont,m=a.height,b=[{name:"small",shortName:Object(o._x)("S","font size","amp"),size:14},{name:"regular",shortName:Object(o._x)("M","font size","amp"),size:16},{name:"large",shortName:Object(o._x)("L","font size","amp"),size:36},{name:"larger",shortName:Object(o._x)("XL","font size","amp"),size:48}];if(!t)return null;var p=Object(o.__)("Automatically fit text to container","amp");return n&&(s=parseInt(s),m=parseInt(m),u=parseInt(u)),Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp"),className:n?"is-amp-fit-text":""},Object(i.createElement)(c.ToggleControl,{label:p,checked:n,onChange:function(){return r({ampFitText:!n})}})),n&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(c.TextControl,{label:Object(o.__)("Height","amp"),value:m,min:1,onChange:function(e){r({height:e})}}),s>m&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The height must be greater than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Minimum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:14,value:u,fontSizes:b,onChange:function(e){e||(e=d.d),parseInt(e)<=s&&r({minFont:e})}})),u>s&&Object(i.createElement)(c.Notice,{status:"error",isDismissible:!1},Object(o.__)("The min font size must less than the max font size.","amp")),Object(i.createElement)(c.PanelBody,{title:Object(o.__)("Maximum font size","amp")},Object(i.createElement)(c.FontSizePicker,{fallbackFontSize:48,value:s,fontSizes:b,onChange:function(e){e||(e=d.b),r({maxFont:e,height:Math.max(e,m)})}}))))},x=function(e){var t=e.isSelected;if(!A(e.attributes)||!t)return null;var a=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},a&&Object(i.createElement)(E,e),Object(i.createElement)(P,e)))},P=function(e){var t=e.attributes,a=t.ampLightbox,r=t.linkTo,n=t.ampLayout,l=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Add lightbox effect","amp"),checked:a,onChange:function(e){l({ampLightbox:!a}),e&&("fixed-height"===n&&l({ampLayout:"fixed"}),r&&"none"!==r&&l({linkTo:"none"}))}})},E=function(e){var t=e.attributes.ampCarousel,a=e.setAttributes;return Object(i.createElement)(c.ToggleControl,{label:Object(o.__)("Display as carousel","amp"),checked:t,onChange:function(){return a({ampCarousel:!t})}})},S=function(e){return e.isSelected?Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},Object(i.createElement)(v,e),Object(i.createElement)(_,e),Object(i.createElement)(P,e))):null},C=function(e){if(!e.isSelected)return null;var t=Object(u.select)("amp/block-editor").hasThemeSupport();return Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(c.PanelBody,{title:Object(o.__)("AMP Settings","amp")},t&&Object(i.createElement)(E,e),Object(i.createElement)(P,e)))},I=function(e){return e.replace(" amp-carousel=false","")},k=function(e){return e.replace(" amp-lightbox=true","")},T=function(e){return-1!==e.indexOf("amp-carousel=false")},M=function(e){return-1!==e.indexOf("amp-lightbox=true")},A=function(e){return e.text&&-1!==e.text.indexOf("gallery")},D=function(){var e=Object(u.select)("amp/block-editor"),t=e.getDefaultStatus,a=e.getPossibleStatuses,r=(0,Object(u.select)("core/editor").getEditedPostAttribute)("meta");return r&&r.amp_status&&a().includes(r.amp_status)?"enabled"===r.amp_status:"enabled"===t()},F=function(e){var t=document.querySelector(".".concat(s.d));if(t&&t.nextSibling){var a=document.createElement("div");a.id="amp-wrapper-post-preview",Object(i.render)(Object(i.createElement)(e,null),a),t.parentNode.insertBefore(a,t.nextSibling)}}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){!function(){e.exports=this.wp.hooks}()},function(e,t){!function(){e.exports=this.React}()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,a){var r=a(37),n=a(16);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?n(e):t}},function(e,t){function a(t){return e.exports=a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(t)}e.exports=a},function(e,t,a){var r=a(38);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,a){"use strict";a.d(t,"b",(function(){return b})),a.d(t,"a",(function(){return p})),a.d(t,"c",(function(){return f}));var r=a(8),n=a.n(r),i=a(12),o=a(1),c=a(9);function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}var u,s=window.wp,d=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:(u=Object(o.sprintf)(
|
12 |
/* translators: 1: image width in pixels. 2: image height in pixels. 3: required minimum width in pixels. 4: required minimum height in pixels. */
|
13 |
Object(o.__)("The selected image is too small (%1$s by %2$s pixels). It should have a size of at least %3$s by %4$s pixels.","amp"),"{{width}}","{{height}}","{{minWidth}}","{{minHeight}}"),Object(c.c)(u))}),m=s.media.View.extend({className:"notice notice-warning notice-alt inline",template:function(){var e=Object(o.sprintf)(
|
14 |
/* translators: 1: the selected file type. */
|
assets/js/amp-block-validation.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), 'version' => 'a6a76a54dcc641af6fda84e0d8ab2d91');
|
includes/amp-helper-functions.php
CHANGED
@@ -786,6 +786,14 @@ function amp_register_default_scripts( $wp_scripts ) {
|
|
786 |
null
|
787 |
);
|
788 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
}
|
790 |
|
791 |
/**
|
@@ -1209,8 +1217,9 @@ function amp_get_content_sanitizers( $post = null ) {
|
|
1209 |
'AMP_Playbuzz_Sanitizer' => [],
|
1210 |
'AMP_Embed_Sanitizer' => [],
|
1211 |
'AMP_Iframe_Sanitizer' => [
|
1212 |
-
'add_placeholder'
|
1213 |
-
'current_origin'
|
|
|
1214 |
],
|
1215 |
'AMP_Gallery_Block_Sanitizer' => [ // Note: Gallery block sanitizer must come after image sanitizers since itś logic is using the already sanitized images.
|
1216 |
'carousel_required' => ! is_array( $theme_support_args ), // For back-compat.
|
@@ -1459,20 +1468,20 @@ function amp_get_schemaorg_metadata() {
|
|
1459 |
$metadata['publisher']['logo'] = $publisher_logo;
|
1460 |
}
|
1461 |
|
1462 |
-
$
|
1463 |
-
if ( $
|
1464 |
$metadata = array_merge(
|
1465 |
$metadata,
|
1466 |
[
|
1467 |
'@type' => is_page() ? 'WebPage' : 'BlogPosting',
|
1468 |
'mainEntityOfPage' => get_permalink(),
|
1469 |
'headline' => get_the_title(),
|
1470 |
-
'datePublished' => mysql2date( 'c', $
|
1471 |
-
'dateModified' => mysql2date( 'c', $
|
1472 |
]
|
1473 |
);
|
1474 |
|
1475 |
-
$post_author = get_userdata( $
|
1476 |
if ( $post_author ) {
|
1477 |
$metadata['author'] = [
|
1478 |
'@type' => 'Person',
|
@@ -1480,7 +1489,7 @@ function amp_get_schemaorg_metadata() {
|
|
1480 |
];
|
1481 |
}
|
1482 |
|
1483 |
-
$image_metadata = amp_get_post_image_metadata( $
|
1484 |
if ( $image_metadata ) {
|
1485 |
$metadata['image'] = $image_metadata['url'];
|
1486 |
}
|
@@ -1493,10 +1502,12 @@ function amp_get_schemaorg_metadata() {
|
|
1493 |
*
|
1494 |
* @since 0.3
|
1495 |
*
|
1496 |
-
* @param array $metadata
|
1497 |
-
* @param WP_Post $
|
1498 |
*/
|
1499 |
-
$metadata = apply_filters( 'amp_post_template_metadata', $metadata, $
|
|
|
|
|
1500 |
}
|
1501 |
|
1502 |
/**
|
786 |
null
|
787 |
);
|
788 |
}
|
789 |
+
|
790 |
+
if ( $wp_scripts->query( 'amp-experiment', 'registered' ) ) {
|
791 |
+
/*
|
792 |
+
* Version 1.0 of amp-experiment is still experimental and requires the user to enable it.
|
793 |
+
* @todo Revisit once amp-experiment is no longer experimental.
|
794 |
+
*/
|
795 |
+
$wp_scripts->registered['amp-experiment']->src = 'https://cdn.ampproject.org/v0/amp-experiment-0.1.js';
|
796 |
+
}
|
797 |
}
|
798 |
|
799 |
/**
|
1217 |
'AMP_Playbuzz_Sanitizer' => [],
|
1218 |
'AMP_Embed_Sanitizer' => [],
|
1219 |
'AMP_Iframe_Sanitizer' => [
|
1220 |
+
'add_placeholder' => true,
|
1221 |
+
'current_origin' => $current_origin,
|
1222 |
+
'align_wide_support' => current_theme_supports( 'align-wide' ),
|
1223 |
],
|
1224 |
'AMP_Gallery_Block_Sanitizer' => [ // Note: Gallery block sanitizer must come after image sanitizers since itś logic is using the already sanitized images.
|
1225 |
'carousel_required' => ! is_array( $theme_support_args ), // For back-compat.
|
1468 |
$metadata['publisher']['logo'] = $publisher_logo;
|
1469 |
}
|
1470 |
|
1471 |
+
$queried_object = get_queried_object();
|
1472 |
+
if ( $queried_object instanceof WP_Post ) {
|
1473 |
$metadata = array_merge(
|
1474 |
$metadata,
|
1475 |
[
|
1476 |
'@type' => is_page() ? 'WebPage' : 'BlogPosting',
|
1477 |
'mainEntityOfPage' => get_permalink(),
|
1478 |
'headline' => get_the_title(),
|
1479 |
+
'datePublished' => mysql2date( 'c', $queried_object->post_date_gmt, false ),
|
1480 |
+
'dateModified' => mysql2date( 'c', $queried_object->post_modified_gmt, false ),
|
1481 |
]
|
1482 |
);
|
1483 |
|
1484 |
+
$post_author = get_userdata( $queried_object->post_author );
|
1485 |
if ( $post_author ) {
|
1486 |
$metadata['author'] = [
|
1487 |
'@type' => 'Person',
|
1489 |
];
|
1490 |
}
|
1491 |
|
1492 |
+
$image_metadata = amp_get_post_image_metadata( $queried_object );
|
1493 |
if ( $image_metadata ) {
|
1494 |
$metadata['image'] = $image_metadata['url'];
|
1495 |
}
|
1502 |
*
|
1503 |
* @since 0.3
|
1504 |
*
|
1505 |
+
* @param array $metadata Metadata.
|
1506 |
+
* @param WP_Post $queried_object Post.
|
1507 |
*/
|
1508 |
+
$metadata = apply_filters( 'amp_post_template_metadata', $metadata, $queried_object );
|
1509 |
+
} elseif ( is_archive() ) {
|
1510 |
+
$metadata['@type'] = 'CollectionPage';
|
1511 |
}
|
1512 |
|
1513 |
/**
|
includes/class-amp-comment-walker.php
CHANGED
@@ -81,10 +81,11 @@ class AMP_Comment_Walker extends Walker_Comment {
|
|
81 |
* @param int $max_depth The maximum hierarchical depth.
|
82 |
* @param int $page_num The specific page number, beginning with 1.
|
83 |
* @param int $per_page Per page counter.
|
|
|
84 |
*
|
85 |
* @return string XHTML of the specified page of elements.
|
86 |
*/
|
87 |
-
public function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
|
88 |
if ( empty( $elements ) || $max_depth < -1 ) {
|
89 |
return '';
|
90 |
}
|
81 |
* @param int $max_depth The maximum hierarchical depth.
|
82 |
* @param int $page_num The specific page number, beginning with 1.
|
83 |
* @param int $per_page Per page counter.
|
84 |
+
* @param mixed ...$args Optional additional arguments.
|
85 |
*
|
86 |
* @return string XHTML of the specified page of elements.
|
87 |
*/
|
88 |
+
public function paged_walk( $elements, $max_depth, $page_num, $per_page, ...$args ) {
|
89 |
if ( empty( $elements ) || $max_depth < -1 ) {
|
90 |
return '';
|
91 |
}
|
includes/class-amp-theme-support.php
CHANGED
@@ -1611,16 +1611,6 @@ class AMP_Theme_Support {
|
|
1611 |
* @param string[] $script_handles AMP script handles for components identified during output buffering.
|
1612 |
*/
|
1613 |
public static function ensure_required_markup( Document $dom, $script_handles = [] ) {
|
1614 |
-
/**
|
1615 |
-
* Elements.
|
1616 |
-
*
|
1617 |
-
* @var DOMElement $meta
|
1618 |
-
* @var DOMElement $script
|
1619 |
-
* @var DOMElement $link
|
1620 |
-
* @var DOMElement $style
|
1621 |
-
* @var DOMElement $noscript
|
1622 |
-
*/
|
1623 |
-
|
1624 |
// Gather all links.
|
1625 |
$links = [
|
1626 |
Attribute::REL_PRECONNECT => [
|
@@ -1636,6 +1626,11 @@ class AMP_Theme_Support {
|
|
1636 |
],
|
1637 |
];
|
1638 |
$link_elements = $dom->head->getElementsByTagName( Tag::LINK );
|
|
|
|
|
|
|
|
|
|
|
1639 |
foreach ( $link_elements as $link ) {
|
1640 |
if ( $link->hasAttribute( Attribute::REL ) ) {
|
1641 |
$links[ $link->getAttribute( Attribute::REL ) ][] = $link;
|
@@ -1673,6 +1668,12 @@ class AMP_Theme_Support {
|
|
1673 |
$ordered_scripts = [];
|
1674 |
$head_scripts = [];
|
1675 |
$runtime_src = wp_scripts()->registered[ Amp::RUNTIME ]->src;
|
|
|
|
|
|
|
|
|
|
|
|
|
1676 |
foreach ( $dom->head->getElementsByTagName( Tag::SCRIPT ) as $script ) { // Note that prepare_response() already moved body scripts to head.
|
1677 |
$head_scripts[] = $script;
|
1678 |
}
|
@@ -2173,7 +2174,7 @@ class AMP_Theme_Support {
|
|
2173 |
|
2174 |
$enable_ssr = array_key_exists( ConfigurationArgument::ENABLE_SSR, $args )
|
2175 |
? $args[ ConfigurationArgument::ENABLE_SSR ]
|
2176 |
-
:
|
2177 |
|
2178 |
/**
|
2179 |
* Filter whether the AMP Optimizer should use server-side rendering or not.
|
1611 |
* @param string[] $script_handles AMP script handles for components identified during output buffering.
|
1612 |
*/
|
1613 |
public static function ensure_required_markup( Document $dom, $script_handles = [] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1614 |
// Gather all links.
|
1615 |
$links = [
|
1616 |
Attribute::REL_PRECONNECT => [
|
1626 |
],
|
1627 |
];
|
1628 |
$link_elements = $dom->head->getElementsByTagName( Tag::LINK );
|
1629 |
+
/**
|
1630 |
+
* Link element.
|
1631 |
+
*
|
1632 |
+
* @var DOMElement $link
|
1633 |
+
*/
|
1634 |
foreach ( $link_elements as $link ) {
|
1635 |
if ( $link->hasAttribute( Attribute::REL ) ) {
|
1636 |
$links[ $link->getAttribute( Attribute::REL ) ][] = $link;
|
1668 |
$ordered_scripts = [];
|
1669 |
$head_scripts = [];
|
1670 |
$runtime_src = wp_scripts()->registered[ Amp::RUNTIME ]->src;
|
1671 |
+
|
1672 |
+
/**
|
1673 |
+
* Script element.
|
1674 |
+
*
|
1675 |
+
* @var DOMElement $script
|
1676 |
+
*/
|
1677 |
foreach ( $dom->head->getElementsByTagName( Tag::SCRIPT ) as $script ) { // Note that prepare_response() already moved body scripts to head.
|
1678 |
$head_scripts[] = $script;
|
1679 |
}
|
2174 |
|
2175 |
$enable_ssr = array_key_exists( ConfigurationArgument::ENABLE_SSR, $args )
|
2176 |
? $args[ ConfigurationArgument::ENABLE_SSR ]
|
2177 |
+
: true;
|
2178 |
|
2179 |
/**
|
2180 |
* Filter whether the AMP Optimizer should use server-side rendering or not.
|
includes/embeds/class-amp-wordpress-tv-embed-handler.php
CHANGED
@@ -9,17 +9,12 @@
|
|
9 |
/**
|
10 |
* Class AMP_WordPress_TV_Embed_Handler
|
11 |
*
|
|
|
|
|
12 |
* @since 1.4
|
13 |
*/
|
14 |
class AMP_WordPress_TV_Embed_Handler extends AMP_Base_Embed_Handler {
|
15 |
|
16 |
-
/**
|
17 |
-
* The URL pattern to determine if an embed URL is for this type, copied from WP_oEmbed.
|
18 |
-
*
|
19 |
-
* @see https://github.com/WordPress/wordpress-develop/blob/e13480/src/wp-includes/class-wp-oembed.php#L64
|
20 |
-
*/
|
21 |
-
const URL_PATTERN = '#https?://wordpress\.tv/.*#i';
|
22 |
-
|
23 |
/**
|
24 |
* Register embed.
|
25 |
*/
|
@@ -42,7 +37,8 @@ class AMP_WordPress_TV_Embed_Handler extends AMP_Base_Embed_Handler {
|
|
42 |
* @return string The filtered embed markup.
|
43 |
*/
|
44 |
public function filter_oembed_html( $cache, $url ) {
|
45 |
-
|
|
|
46 |
return $cache;
|
47 |
}
|
48 |
|
9 |
/**
|
10 |
* Class AMP_WordPress_TV_Embed_Handler
|
11 |
*
|
12 |
+
* This sanitizes embeds both for WordPress.tv and for VideoPress (which use the same underlying infrastructure).
|
13 |
+
*
|
14 |
* @since 1.4
|
15 |
*/
|
16 |
class AMP_WordPress_TV_Embed_Handler extends AMP_Base_Embed_Handler {
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Register embed.
|
20 |
*/
|
37 |
* @return string The filtered embed markup.
|
38 |
*/
|
39 |
public function filter_oembed_html( $cache, $url ) {
|
40 |
+
$host = wp_parse_url( $url, PHP_URL_HOST );
|
41 |
+
if ( ! in_array( $host, [ 'wordpress.tv', 'videopress.com' ], true ) ) {
|
42 |
return $cache;
|
43 |
}
|
44 |
|
includes/sanitizers/class-amp-block-sanitizer.php
CHANGED
@@ -41,27 +41,30 @@ class AMP_Block_Sanitizer extends AMP_Base_Sanitizer {
|
|
41 |
$node = $nodes->item( $i );
|
42 |
|
43 |
// We are only looking for <figure> elements which have wp-block-embed as class.
|
44 |
-
$
|
45 |
-
|
|
|
46 |
continue;
|
47 |
}
|
48 |
|
49 |
-
// Remove classes like wp-embed-aspect-16-9 since responsive layout is handled by AMP's layout system.
|
50 |
$responsive_width = null;
|
51 |
$responsive_height = null;
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
57 |
$responsive_width = $matches['width'];
|
58 |
$responsive_height = $matches['height'];
|
59 |
-
return
|
60 |
-
}
|
61 |
-
$class
|
62 |
-
|
63 |
);
|
64 |
|
|
|
|
|
65 |
// We're looking for <figure> elements that have one child node only.
|
66 |
if ( 1 !== count( $node->childNodes ) ) {
|
67 |
continue;
|
41 |
$node = $nodes->item( $i );
|
42 |
|
43 |
// We are only looking for <figure> elements which have wp-block-embed as class.
|
44 |
+
$classes = preg_split( '/\s+/', trim( $node->getAttribute( 'class' ) ) );
|
45 |
+
|
46 |
+
if ( ! in_array( 'wp-block-embed', $classes, true ) ) {
|
47 |
continue;
|
48 |
}
|
49 |
|
|
|
50 |
$responsive_width = null;
|
51 |
$responsive_height = null;
|
52 |
+
|
53 |
+
// Remove classes related to aspect ratios as the embed's responsiveness will be handled by AMP's layout system.
|
54 |
+
$classes = array_filter(
|
55 |
+
$classes,
|
56 |
+
static function ( $class ) use ( &$responsive_width, &$responsive_height ) {
|
57 |
+
if ( preg_match( '/^wp-embed-aspect-(?P<width>\d+)-(?P<height>\d+)$/', $class, $matches ) ) {
|
58 |
$responsive_width = $matches['width'];
|
59 |
$responsive_height = $matches['height'];
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
return 'wp-has-aspect-ratio' !== $class;
|
63 |
+
}
|
64 |
);
|
65 |
|
66 |
+
$node->setAttribute( 'class', implode( ' ', $classes ) );
|
67 |
+
|
68 |
// We're looking for <figure> elements that have one child node only.
|
69 |
if ( 1 !== count( $node->childNodes ) ) {
|
70 |
continue;
|
includes/sanitizers/class-amp-iframe-sanitizer.php
CHANGED
@@ -6,6 +6,8 @@
|
|
6 |
*/
|
7 |
|
8 |
use AmpProject\DevMode;
|
|
|
|
|
9 |
|
10 |
/**
|
11 |
* Class AMP_Iframe_Sanitizer
|
@@ -124,8 +126,7 @@ class AMP_Iframe_Sanitizer extends AMP_Base_Sanitizer {
|
|
124 |
}
|
125 |
|
126 |
$this->did_convert_elements = true;
|
127 |
-
if ( empty( $normalized_attributes[
|
128 |
-
$normalized_attributes['layout'] = 'intrinsic';
|
129 |
|
130 |
// Set layout to responsive if the iframe is aligned to full width.
|
131 |
$figure_node = null;
|
@@ -135,8 +136,15 @@ class AMP_Iframe_Sanitizer extends AMP_Base_Sanitizer {
|
|
135 |
if ( $node->parentNode->parentNode instanceof DOMElement && 'figure' === $node->parentNode->parentNode->tagName ) {
|
136 |
$figure_node = $node->parentNode->parentNode;
|
137 |
}
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
|
142 |
$this->add_or_append_attribute( $normalized_attributes, 'class', 'amp-wp-enforced-sizes' );
|
@@ -213,6 +221,7 @@ class AMP_Iframe_Sanitizer extends AMP_Base_Sanitizer {
|
|
213 |
* @type int $frameborder <iframe> `frameborder` attribute - Filter to '0' or '1'; default to '0'
|
214 |
* @type bool $allowfullscreen <iframe> `allowfullscreen` attribute - Convert 'false' to empty string ''
|
215 |
* @type bool $allowtransparency <iframe> `allowtransparency` attribute - Convert 'false' to empty string ''
|
|
|
216 |
* }
|
217 |
* @return array Returns HTML attributes; normalizes src, dimensions, frameborder, sandbox, allowtransparency and allowfullscreen
|
218 |
*/
|
@@ -296,6 +305,16 @@ class AMP_Iframe_Sanitizer extends AMP_Base_Sanitizer {
|
|
296 |
// No need to copy.
|
297 |
break;
|
298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
default:
|
300 |
$out[ $name ] = $value;
|
301 |
break;
|
6 |
*/
|
7 |
|
8 |
use AmpProject\DevMode;
|
9 |
+
use AmpProject\Attribute;
|
10 |
+
use AmpProject\Layout;
|
11 |
|
12 |
/**
|
13 |
* Class AMP_Iframe_Sanitizer
|
126 |
}
|
127 |
|
128 |
$this->did_convert_elements = true;
|
129 |
+
if ( empty( $normalized_attributes[ Attribute::LAYOUT ] ) && ! empty( $normalized_attributes[ Attribute::HEIGHT ] ) && ! empty( $normalized_attributes[ Attribute::WIDTH ] ) ) {
|
|
|
130 |
|
131 |
// Set layout to responsive if the iframe is aligned to full width.
|
132 |
$figure_node = null;
|
136 |
if ( $node->parentNode->parentNode instanceof DOMElement && 'figure' === $node->parentNode->parentNode->tagName ) {
|
137 |
$figure_node = $node->parentNode->parentNode;
|
138 |
}
|
139 |
+
|
140 |
+
if (
|
141 |
+
! empty( $this->args['align_wide_support'] )
|
142 |
+
&& $figure_node
|
143 |
+
&& preg_match( '/(^|\s)(alignwide|alignfull)(\s|$)/', $figure_node->getAttribute( Attribute::CLASS_ ) )
|
144 |
+
) {
|
145 |
+
$normalized_attributes[ Attribute::LAYOUT ] = Layout::RESPONSIVE;
|
146 |
+
} else {
|
147 |
+
$normalized_attributes[ Attribute::LAYOUT ] = Layout::INTRINSIC;
|
148 |
}
|
149 |
|
150 |
$this->add_or_append_attribute( $normalized_attributes, 'class', 'amp-wp-enforced-sizes' );
|
221 |
* @type int $frameborder <iframe> `frameborder` attribute - Filter to '0' or '1'; default to '0'
|
222 |
* @type bool $allowfullscreen <iframe> `allowfullscreen` attribute - Convert 'false' to empty string ''
|
223 |
* @type bool $allowtransparency <iframe> `allowtransparency` attribute - Convert 'false' to empty string ''
|
224 |
+
* @type string $type <iframe> `type` attribute - Pass along if value is not `text/html`
|
225 |
* }
|
226 |
* @return array Returns HTML attributes; normalizes src, dimensions, frameborder, sandbox, allowtransparency and allowfullscreen
|
227 |
*/
|
305 |
// No need to copy.
|
306 |
break;
|
307 |
|
308 |
+
case 'type':
|
309 |
+
/*
|
310 |
+
* Omit the `type` attribute if its value is `text/html`. Popular embed providers such as Amazon
|
311 |
+
* Kindle use this non-standard attribute, which is apparently a vestige from usage on <object>.
|
312 |
+
*/
|
313 |
+
if ( 'text/html' !== strtolower( $value ) ) {
|
314 |
+
$out[ $name ] = $value;
|
315 |
+
}
|
316 |
+
break;
|
317 |
+
|
318 |
default:
|
319 |
$out[ $name ] = $value;
|
320 |
break;
|
includes/sanitizers/class-amp-link-sanitizer.php
CHANGED
@@ -130,12 +130,6 @@ class AMP_Link_Sanitizer extends AMP_Base_Sanitizer {
|
|
130 |
* Process links by adding adding AMP query var to links in paired mode and adding rel=amphtml.
|
131 |
*/
|
132 |
public function process_links() {
|
133 |
-
/**
|
134 |
-
* Element.
|
135 |
-
*
|
136 |
-
* @var DOMElement $element
|
137 |
-
*/
|
138 |
-
|
139 |
// Remove admin bar from DOM to prevent mutating it.
|
140 |
$admin_bar_container = $this->dom->getElementById( 'wpadminbar' );
|
141 |
$admin_bar_placeholder = null;
|
@@ -144,6 +138,11 @@ class AMP_Link_Sanitizer extends AMP_Base_Sanitizer {
|
|
144 |
$admin_bar_container->parentNode->replaceChild( $admin_bar_placeholder, $admin_bar_container );
|
145 |
}
|
146 |
|
|
|
|
|
|
|
|
|
|
|
147 |
foreach ( $this->dom->xpath->query( '//*[ local-name() = "a" or local-name() = "area" ]' ) as $element ) {
|
148 |
if ( ! $element->hasAttribute( 'href' ) ) {
|
149 |
continue;
|
130 |
* Process links by adding adding AMP query var to links in paired mode and adding rel=amphtml.
|
131 |
*/
|
132 |
public function process_links() {
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
// Remove admin bar from DOM to prevent mutating it.
|
134 |
$admin_bar_container = $this->dom->getElementById( 'wpadminbar' );
|
135 |
$admin_bar_placeholder = null;
|
138 |
$admin_bar_container->parentNode->replaceChild( $admin_bar_placeholder, $admin_bar_container );
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* Element.
|
143 |
+
*
|
144 |
+
* @var DOMElement $element
|
145 |
+
*/
|
146 |
foreach ( $this->dom->xpath->query( '//*[ local-name() = "a" or local-name() = "area" ]' ) as $element ) {
|
147 |
if ( ! $element->hasAttribute( 'href' ) ) {
|
148 |
continue;
|
includes/sanitizers/class-amp-style-sanitizer.php
CHANGED
@@ -1498,7 +1498,7 @@ class AMP_Style_Sanitizer extends AMP_Base_Sanitizer {
|
|
1498 |
$parsed = null;
|
1499 |
$cache_key = null;
|
1500 |
$cached = true;
|
1501 |
-
$cache_group = 'amp-parsed-stylesheet-
|
1502 |
$use_transients = $this->should_use_transient_caching();
|
1503 |
|
1504 |
$cache_impacting_options = array_merge(
|
@@ -2078,11 +2078,8 @@ class AMP_Style_Sanitizer extends AMP_Base_Sanitizer {
|
|
2078 |
}
|
2079 |
if ( ! $sanitized ) {
|
2080 |
$at_rule_processed_list = $this->process_css_list( $css_item, $options );
|
2081 |
-
|
2082 |
-
|
2083 |
-
}
|
2084 |
-
|
2085 |
-
$validation_results = array_merge(
|
2086 |
$validation_results,
|
2087 |
$at_rule_processed_list['validation_results']
|
2088 |
);
|
1498 |
$parsed = null;
|
1499 |
$cache_key = null;
|
1500 |
$cached = true;
|
1501 |
+
$cache_group = 'amp-parsed-stylesheet-v28'; // This should be bumped whenever the PHP-CSS-Parser is updated or parsed format is updated.
|
1502 |
$use_transients = $this->should_use_transient_caching();
|
1503 |
|
1504 |
$cache_impacting_options = array_merge(
|
2078 |
}
|
2079 |
if ( ! $sanitized ) {
|
2080 |
$at_rule_processed_list = $this->process_css_list( $css_item, $options );
|
2081 |
+
$viewport_rules = array_merge( $viewport_rules, $at_rule_processed_list['viewport_rules'] );
|
2082 |
+
$validation_results = array_merge(
|
|
|
|
|
|
|
2083 |
$validation_results,
|
2084 |
$at_rule_processed_list['validation_results']
|
2085 |
);
|
includes/templates/class-amp-post-template.php
CHANGED
@@ -8,8 +8,6 @@
|
|
8 |
/**
|
9 |
* Class AMP_Post_Template
|
10 |
*
|
11 |
-
* @property WP_Post $post
|
12 |
-
*
|
13 |
* @since 0.2
|
14 |
*/
|
15 |
class AMP_Post_Template {
|
@@ -66,6 +64,14 @@ class AMP_Post_Template {
|
|
66 |
*/
|
67 |
public $ID;
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
/**
|
70 |
* AMP_Post_Template constructor.
|
71 |
*
|
@@ -73,9 +79,11 @@ class AMP_Post_Template {
|
|
73 |
*/
|
74 |
public function __construct( $post ) {
|
75 |
if ( is_int( $post ) ) {
|
76 |
-
$this->ID
|
|
|
77 |
} elseif ( $post instanceof WP_Post ) {
|
78 |
-
$this->ID
|
|
|
79 |
}
|
80 |
}
|
81 |
|
@@ -107,7 +115,7 @@ class AMP_Post_Template {
|
|
107 |
'content_max_width' => $content_max_width,
|
108 |
|
109 |
'document_title' => wp_get_document_title(),
|
110 |
-
'canonical_url' => get_permalink( $this->
|
111 |
'home_url' => home_url( '/' ),
|
112 |
'blog_name' => get_bloginfo( 'name' ),
|
113 |
|
@@ -151,22 +159,6 @@ class AMP_Post_Template {
|
|
151 |
$this->data = apply_filters( 'amp_post_template_data', $this->data, $this->post );
|
152 |
}
|
153 |
|
154 |
-
/**
|
155 |
-
* Getter.
|
156 |
-
*
|
157 |
-
* @since 1.5
|
158 |
-
*
|
159 |
-
* @param string $name Property name.
|
160 |
-
* @return mixed
|
161 |
-
*/
|
162 |
-
public function __get( $name ) {
|
163 |
-
switch ( $name ) {
|
164 |
-
case 'post':
|
165 |
-
return get_post( $this->ID );
|
166 |
-
}
|
167 |
-
return null;
|
168 |
-
}
|
169 |
-
|
170 |
/**
|
171 |
* Get template directory for Reader mode.
|
172 |
*
|
@@ -281,8 +273,8 @@ class AMP_Post_Template {
|
|
281 |
* @since 0.2
|
282 |
*/
|
283 |
private function build_post_data() {
|
284 |
-
$post_title = get_the_title( $this->
|
285 |
-
$post_publish_timestamp = get_the_date( 'U', $this->
|
286 |
$post_modified_timestamp = get_post_modified_time( 'U', false, $this->post );
|
287 |
$post_author = get_userdata( $this->post->post_author );
|
288 |
|
@@ -317,7 +309,7 @@ class AMP_Post_Template {
|
|
317 |
return;
|
318 |
}
|
319 |
|
320 |
-
$comments_open = comments_open( $this->
|
321 |
|
322 |
// Don't show link if close and no comments.
|
323 |
if ( ! $comments_open
|
@@ -325,7 +317,7 @@ class AMP_Post_Template {
|
|
325 |
return;
|
326 |
}
|
327 |
|
328 |
-
$comments_link_url = get_comments_link( $this->
|
329 |
$comments_link_text = $comments_open
|
330 |
? __( 'Leave a Comment', 'amp' )
|
331 |
: __( 'View Comments', 'amp' );
|
8 |
/**
|
9 |
* Class AMP_Post_Template
|
10 |
*
|
|
|
|
|
11 |
* @since 0.2
|
12 |
*/
|
13 |
class AMP_Post_Template {
|
64 |
*/
|
65 |
public $ID;
|
66 |
|
67 |
+
/**
|
68 |
+
* Post
|
69 |
+
*
|
70 |
+
* @since 0.2
|
71 |
+
* @var WP_Post
|
72 |
+
*/
|
73 |
+
public $post;
|
74 |
+
|
75 |
/**
|
76 |
* AMP_Post_Template constructor.
|
77 |
*
|
79 |
*/
|
80 |
public function __construct( $post ) {
|
81 |
if ( is_int( $post ) ) {
|
82 |
+
$this->ID = $post;
|
83 |
+
$this->post = get_post( $post );
|
84 |
} elseif ( $post instanceof WP_Post ) {
|
85 |
+
$this->ID = $post->ID;
|
86 |
+
$this->post = $post;
|
87 |
}
|
88 |
}
|
89 |
|
115 |
'content_max_width' => $content_max_width,
|
116 |
|
117 |
'document_title' => wp_get_document_title(),
|
118 |
+
'canonical_url' => get_permalink( $this->post ),
|
119 |
'home_url' => home_url( '/' ),
|
120 |
'blog_name' => get_bloginfo( 'name' ),
|
121 |
|
159 |
$this->data = apply_filters( 'amp_post_template_data', $this->data, $this->post );
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
/**
|
163 |
* Get template directory for Reader mode.
|
164 |
*
|
273 |
* @since 0.2
|
274 |
*/
|
275 |
private function build_post_data() {
|
276 |
+
$post_title = get_the_title( $this->post );
|
277 |
+
$post_publish_timestamp = get_the_date( 'U', $this->post );
|
278 |
$post_modified_timestamp = get_post_modified_time( 'U', false, $this->post );
|
279 |
$post_author = get_userdata( $this->post->post_author );
|
280 |
|
309 |
return;
|
310 |
}
|
311 |
|
312 |
+
$comments_open = comments_open( $this->post );
|
313 |
|
314 |
// Don't show link if close and no comments.
|
315 |
if ( ! $comments_open
|
317 |
return;
|
318 |
}
|
319 |
|
320 |
+
$comments_link_url = get_comments_link( $this->post );
|
321 |
$comments_link_text = $comments_open
|
322 |
? __( 'Leave a Comment', 'amp' )
|
323 |
: __( 'View Comments', 'amp' );
|
includes/templates/reader-template-loader.php
CHANGED
@@ -32,5 +32,5 @@ do_action( 'pre_amp_render_post', get_queried_object_id() );
|
|
32 |
require_once AMP__DIR__ . '/includes/amp-post-template-functions.php';
|
33 |
amp_post_template_init_hooks();
|
34 |
|
35 |
-
$amp_post_template = new AMP_Post_Template(
|
36 |
$amp_post_template->load();
|
32 |
require_once AMP__DIR__ . '/includes/amp-post-template-functions.php';
|
33 |
amp_post_template_init_hooks();
|
34 |
|
35 |
+
$amp_post_template = new AMP_Post_Template( $post );
|
36 |
$amp_post_template->load();
|
includes/validation/class-amp-validation-manager.php
CHANGED
@@ -2105,6 +2105,17 @@ class AMP_Validation_Manager {
|
|
2105 |
$validation_url
|
2106 |
);
|
2107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2108 |
if ( '' === $response ) {
|
2109 |
return new WP_Error( 'white_screen_of_death' );
|
2110 |
}
|
2105 |
$validation_url
|
2106 |
);
|
2107 |
|
2108 |
+
// Strip byte order mark (BOM).
|
2109 |
+
while ( "\xEF\xBB\xBF" === substr( $response, 0, 3 ) ) {
|
2110 |
+
$response = substr( $response, 3 );
|
2111 |
+
}
|
2112 |
+
|
2113 |
+
// Strip any leading whitespace.
|
2114 |
+
$response = ltrim( $response );
|
2115 |
+
|
2116 |
+
// Strip HTML comments that may have been injected at the end of the response (e.g. by a caching plugin).
|
2117 |
+
$response = preg_replace( '/<!--.*?-->\s*$/s', '', $response );
|
2118 |
+
|
2119 |
if ( '' === $response ) {
|
2120 |
return new WP_Error( 'white_screen_of_death' );
|
2121 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: google, xwp, automattic, westonruter, albertomedina, schlessera, s
|
|
3 |
Tags: amp, mobile, optimization, accelerated mobile pages, framework, components, blocks, performance, ux, seo, official
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.4
|
6 |
-
Stable tag: 1.5.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires PHP: 5.6
|
@@ -20,6 +20,7 @@ Features and capabilities provided by the plugin include:
|
|
20 |
- **Core Theme Support**: enabling AMP compatibility for all core themes, from Twenty Ten all the way through Twenty Twenty.
|
21 |
- **Compatibility Tool**: when automatic conversion of markup to AMP is not possible, debug AMP validation errors with detailed information including the invalid markup and the specific components responsible on site (e.g theme, plugin, embed); validation errors are shown contextually with their respective blocks in the editor.
|
22 |
- **CSS Tree Shaking**: automatically remove the majority of unused CSS to bring the total under AMP's 75KB limit; when the total after tree shaking is still over this limit, prioritization is used so that the all-important theme stylesheet important is retained, leaving less important ones to be excluded (e.g. print styles).
|
|
|
23 |
|
24 |
Please note that the [Stories](https://amp.dev/about/stories) experience has been removed from the AMP plugin in favor of the feature being released as a standalone plugin. It will be available soon!
|
25 |
|
3 |
Tags: amp, mobile, optimization, accelerated mobile pages, framework, components, blocks, performance, ux, seo, official
|
4 |
Requires at least: 4.9
|
5 |
Tested up to: 5.4
|
6 |
+
Stable tag: 1.5.4
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires PHP: 5.6
|
20 |
- **Core Theme Support**: enabling AMP compatibility for all core themes, from Twenty Ten all the way through Twenty Twenty.
|
21 |
- **Compatibility Tool**: when automatic conversion of markup to AMP is not possible, debug AMP validation errors with detailed information including the invalid markup and the specific components responsible on site (e.g theme, plugin, embed); validation errors are shown contextually with their respective blocks in the editor.
|
22 |
- **CSS Tree Shaking**: automatically remove the majority of unused CSS to bring the total under AMP's 75KB limit; when the total after tree shaking is still over this limit, prioritization is used so that the all-important theme stylesheet important is retained, leaving less important ones to be excluded (e.g. print styles).
|
23 |
+
- **Server-side Rendering**: integrated PHP-port of the [AMP Optimizer](https://github.com/ampproject/amp-toolbox/tree/main/packages/optimizer) providing automated [server-side rendering](https://amp.dev/documentation/guides-and-tutorials/optimize-and-measure/server-side-rendering/) of AMP pages, drastically improving the [Last Contentful Paint](https://web.dev/lcp/) (LCP) metric.
|
24 |
|
25 |
Please note that the [Stories](https://amp.dev/about/stories) experience has been removed from the AMP plugin in favor of the feature being released as a standalone plugin. It will be available soon!
|
26 |
|
src/Admin/SiteHealth.php
CHANGED
@@ -29,7 +29,7 @@ final class SiteHealth {
|
|
29 |
add_filter( 'site_status_tests', [ $this, 'add_tests' ] );
|
30 |
add_filter( 'debug_information', [ $this, 'add_debug_information' ] );
|
31 |
add_filter( 'site_status_test_php_modules', [ $this, 'add_extensions' ] );
|
32 |
-
add_action( 'admin_print_styles', [ $this, 'add_styles' ] );
|
33 |
|
34 |
( new ReenableCssTransientCachingAjaxAction() )->register();
|
35 |
}
|
@@ -49,15 +49,19 @@ final class SiteHealth {
|
|
49 |
'label' => esc_html__( 'cURL multi functions', 'amp' ),
|
50 |
'test' => [ $this, 'curl_multi_functions' ],
|
51 |
];
|
52 |
-
|
53 |
-
|
54 |
-
'
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
57 |
'label' => esc_html__( 'Transient caching of stylesheets', 'amp' ),
|
58 |
'test' => [ $this, 'css_transient_caching' ],
|
59 |
];
|
60 |
-
$tests['direct']['amp_xdebug_extension']
|
61 |
'label' => esc_html__( 'Xdebug extension', 'amp' ),
|
62 |
'test' => [ $this, 'xdebug_extension' ],
|
63 |
];
|
@@ -512,33 +516,35 @@ final class SiteHealth {
|
|
512 |
/**
|
513 |
* Adds suggested PHP extensions to those that Core depends on.
|
514 |
*
|
515 |
-
* @param array $
|
516 |
* @return array The extensions, including those for AMP.
|
517 |
*/
|
518 |
-
public function add_extensions( $
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
'
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
'
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
]
|
541 |
-
|
|
|
|
|
542 |
}
|
543 |
|
544 |
/**
|
@@ -577,4 +583,27 @@ final class SiteHealth {
|
|
577 |
</style>
|
578 |
';
|
579 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
}
|
29 |
add_filter( 'site_status_tests', [ $this, 'add_tests' ] );
|
30 |
add_filter( 'debug_information', [ $this, 'add_debug_information' ] );
|
31 |
add_filter( 'site_status_test_php_modules', [ $this, 'add_extensions' ] );
|
32 |
+
add_action( 'admin_print_styles-site-health.php', [ $this, 'add_styles' ] );
|
33 |
|
34 |
( new ReenableCssTransientCachingAjaxAction() )->register();
|
35 |
}
|
49 |
'label' => esc_html__( 'cURL multi functions', 'amp' ),
|
50 |
'test' => [ $this, 'curl_multi_functions' ],
|
51 |
];
|
52 |
+
|
53 |
+
if ( $this->is_intl_extension_needed() ) {
|
54 |
+
$tests['direct']['amp_icu_version'] = [
|
55 |
+
'label' => esc_html__( 'ICU version', 'amp' ),
|
56 |
+
'test' => [ $this, 'icu_version' ],
|
57 |
+
];
|
58 |
+
}
|
59 |
+
|
60 |
+
$tests['direct']['amp_css_transient_caching'] = [
|
61 |
'label' => esc_html__( 'Transient caching of stylesheets', 'amp' ),
|
62 |
'test' => [ $this, 'css_transient_caching' ],
|
63 |
];
|
64 |
+
$tests['direct']['amp_xdebug_extension'] = [
|
65 |
'label' => esc_html__( 'Xdebug extension', 'amp' ),
|
66 |
'test' => [ $this, 'xdebug_extension' ],
|
67 |
];
|
516 |
/**
|
517 |
* Adds suggested PHP extensions to those that Core depends on.
|
518 |
*
|
519 |
+
* @param array $core_extensions The existing extensions from Core.
|
520 |
* @return array The extensions, including those for AMP.
|
521 |
*/
|
522 |
+
public function add_extensions( $core_extensions ) {
|
523 |
+
$extensions = [
|
524 |
+
'json' => [
|
525 |
+
'extension' => 'json',
|
526 |
+
'function' => 'json_encode',
|
527 |
+
'required' => false,
|
528 |
+
],
|
529 |
+
'mbstring' => [
|
530 |
+
'extension' => 'mbstring',
|
531 |
+
'required' => false,
|
532 |
+
],
|
533 |
+
'zip' => [
|
534 |
+
'extension' => 'zip',
|
535 |
+
'required' => false,
|
536 |
+
],
|
537 |
+
];
|
538 |
+
|
539 |
+
if ( $this->is_intl_extension_needed() ) {
|
540 |
+
$extensions['intl'] = [
|
541 |
+
'extension' => 'intl',
|
542 |
+
'function' => 'idn_to_utf8',
|
543 |
+
'required' => false,
|
544 |
+
];
|
545 |
+
}
|
546 |
+
|
547 |
+
return array_merge( $core_extensions, $extensions );
|
548 |
}
|
549 |
|
550 |
/**
|
583 |
</style>
|
584 |
';
|
585 |
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* Determine if the `intl` extension is needed.
|
589 |
+
*
|
590 |
+
* @return bool True if the `intl` extension is needed, otherwise false.
|
591 |
+
*/
|
592 |
+
private function is_intl_extension_needed() {
|
593 |
+
// Publisher's own origins.
|
594 |
+
$domains = array_unique(
|
595 |
+
[
|
596 |
+
wp_parse_url( site_url(), PHP_URL_HOST ),
|
597 |
+
wp_parse_url( home_url(), PHP_URL_HOST ),
|
598 |
+
]
|
599 |
+
);
|
600 |
+
|
601 |
+
foreach ( $domains as $domain ) {
|
602 |
+
if ( preg_match( '/(^|\.)xn--/', $domain ) ) {
|
603 |
+
return true;
|
604 |
+
}
|
605 |
+
}
|
606 |
+
|
607 |
+
return false;
|
608 |
+
}
|
609 |
}
|
src/Transformer/AmpSchemaOrgMetadata.php
CHANGED
@@ -9,7 +9,6 @@ namespace AmpProject\AmpWP\Transformer;
|
|
9 |
|
10 |
use AmpProject\Attribute;
|
11 |
use AmpProject\Dom\Document;
|
12 |
-
use AmpProject\Optimizer\Configurable;
|
13 |
use AmpProject\Optimizer\ErrorCollection;
|
14 |
use AmpProject\Optimizer\Transformer;
|
15 |
use AmpProject\Optimizer\TransformerConfiguration;
|
@@ -20,7 +19,7 @@ use AmpProject\Tag;
|
|
20 |
*
|
21 |
* @package AmpProject\AmpWP
|
22 |
*/
|
23 |
-
final class AmpSchemaOrgMetadata implements Transformer
|
24 |
|
25 |
/**
|
26 |
* XPath query to use for fetching the schema.org meta script.
|
@@ -60,11 +59,16 @@ final class AmpSchemaOrgMetadata implements Transformer, Configurable {
|
|
60 |
return;
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
$script = $document->createElement( Tag::SCRIPT );
|
64 |
$script->setAttribute( Attribute::TYPE, Attribute::TYPE_LD_JSON );
|
65 |
|
66 |
-
$
|
67 |
-
$json = wp_json_encode( $metadata, JSON_UNESCAPED_UNICODE );
|
68 |
$script->appendChild( $document->createTextNode( $json ) );
|
69 |
|
70 |
$document->head->appendChild( $script );
|
9 |
|
10 |
use AmpProject\Attribute;
|
11 |
use AmpProject\Dom\Document;
|
|
|
12 |
use AmpProject\Optimizer\ErrorCollection;
|
13 |
use AmpProject\Optimizer\Transformer;
|
14 |
use AmpProject\Optimizer\TransformerConfiguration;
|
19 |
*
|
20 |
* @package AmpProject\AmpWP
|
21 |
*/
|
22 |
+
final class AmpSchemaOrgMetadata implements Transformer {
|
23 |
|
24 |
/**
|
25 |
* XPath query to use for fetching the schema.org meta script.
|
59 |
return;
|
60 |
}
|
61 |
|
62 |
+
$metadata = $this->configuration->get( AmpSchemaOrgMetadataConfiguration::METADATA );
|
63 |
+
|
64 |
+
if ( ! $metadata ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
|
68 |
$script = $document->createElement( Tag::SCRIPT );
|
69 |
$script->setAttribute( Attribute::TYPE, Attribute::TYPE_LD_JSON );
|
70 |
|
71 |
+
$json = wp_json_encode( $metadata, JSON_UNESCAPED_UNICODE );
|
|
|
72 |
$script->appendChild( $document->createTextNode( $json ) );
|
73 |
|
74 |
$document->head->appendChild( $script );
|
vendor/ampproject/common/src/Dom/Document.php
CHANGED
@@ -134,7 +134,7 @@ final class Document extends DOMDocument
|
|
134 |
const PROPERTY_GETTER_ERROR_MESSAGE = 'Undefined property: AmpProject\\Dom\\Document::';
|
135 |
|
136 |
// Regex patterns and values used for adding and removing http-equiv charsets for compatibility.
|
137 |
-
const HTML_GET_HEAD_OPENING_TAG_PATTERN = '/(?><!--.*?-->\s*)*<head(?>\s+[^>]*)?>/is'; // This pattern contains a comment to make sure we don't match a <head> tag within a comment.
|
138 |
const HTML_GET_HEAD_OPENING_TAG_REPLACEMENT = '$0<meta http-equiv="content-type" content="text/html; charset=utf-8">';
|
139 |
const HTML_GET_HTTP_EQUIV_TAG_PATTERN = '#<meta http-equiv=([\'"])content-type\1 content=([\'"])text/html; charset=utf-8\2>#i';
|
140 |
const HTML_HTTP_EQUIV_VALUE = 'content-type';
|
@@ -838,26 +838,26 @@ final class Document extends DOMDocument
|
|
838 |
*/
|
839 |
private function maybeReplaceNoscriptElements($html)
|
840 |
{
|
841 |
-
if (
|
842 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
843 |
}
|
844 |
|
845 |
-
return
|
846 |
-
'#^.+?(?=<body)#is',
|
847 |
-
function ($headMatches) {
|
848 |
-
return preg_replace_callback(
|
849 |
-
'#<noscript[^>]*>.*?</noscript>#si',
|
850 |
-
function ($noscriptMatches) {
|
851 |
-
$placeholder = sprintf('<!--noscript:%s-->', (string)$this->rand());
|
852 |
-
|
853 |
-
$this->noscriptPlaceholderComments[$placeholder] = $noscriptMatches[0];
|
854 |
-
return $placeholder;
|
855 |
-
},
|
856 |
-
$headMatches[0]
|
857 |
-
);
|
858 |
-
},
|
859 |
-
$html
|
860 |
-
);
|
861 |
}
|
862 |
|
863 |
/**
|
@@ -1411,7 +1411,7 @@ final class Document extends DOMDocument
|
|
1411 |
/**
|
1412 |
* Main tag to keep.
|
1413 |
*
|
1414 |
-
* @var DOMElement $mainTag
|
1415 |
*/
|
1416 |
$mainTag = $tags->item(0);
|
1417 |
|
134 |
const PROPERTY_GETTER_ERROR_MESSAGE = 'Undefined property: AmpProject\\Dom\\Document::';
|
135 |
|
136 |
// Regex patterns and values used for adding and removing http-equiv charsets for compatibility.
|
137 |
+
const HTML_GET_HEAD_OPENING_TAG_PATTERN = '/(?><!--.*?-->\s*)*<head(?>\s+[^>]*)?>/is'; // This pattern contains a comment to make sure we don't match a <head> tag within a comment.
|
138 |
const HTML_GET_HEAD_OPENING_TAG_REPLACEMENT = '$0<meta http-equiv="content-type" content="text/html; charset=utf-8">';
|
139 |
const HTML_GET_HTTP_EQUIV_TAG_PATTERN = '#<meta http-equiv=([\'"])content-type\1 content=([\'"])text/html; charset=utf-8\2>#i';
|
140 |
const HTML_HTTP_EQUIV_VALUE = 'content-type';
|
838 |
*/
|
839 |
private function maybeReplaceNoscriptElements($html)
|
840 |
{
|
841 |
+
if (version_compare(LIBXML_DOTTED_VERSION, '2.8', '<')) {
|
842 |
+
$html = preg_replace_callback(
|
843 |
+
'#^.+?(?=<body)#is',
|
844 |
+
function ($headMatches) {
|
845 |
+
return preg_replace_callback(
|
846 |
+
'#<noscript[^>]*>.*?</noscript>#si',
|
847 |
+
function ($noscriptMatches) {
|
848 |
+
$placeholder = sprintf('<!--noscript:%s-->', (string)$this->rand());
|
849 |
+
|
850 |
+
$this->noscriptPlaceholderComments[$placeholder] = $noscriptMatches[0];
|
851 |
+
return $placeholder;
|
852 |
+
},
|
853 |
+
$headMatches[0]
|
854 |
+
);
|
855 |
+
},
|
856 |
+
$html
|
857 |
+
);
|
858 |
}
|
859 |
|
860 |
+
return $html;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
861 |
}
|
862 |
|
863 |
/**
|
1411 |
/**
|
1412 |
* Main tag to keep.
|
1413 |
*
|
1414 |
+
* @var DOMElement|null $mainTag
|
1415 |
*/
|
1416 |
$mainTag = $tags->item(0);
|
1417 |
|
vendor/ampproject/common/src/Exception/FailedToGetFromRemoteUrl.php
CHANGED
@@ -18,7 +18,7 @@ final class FailedToGetFromRemoteUrl extends RuntimeException implements FailedR
|
|
18 |
*
|
19 |
* This is not always set.
|
20 |
*
|
21 |
-
* @var int
|
22 |
*/
|
23 |
private $statusCode;
|
24 |
|
18 |
*
|
19 |
* This is not always set.
|
20 |
*
|
21 |
+
* @var int|null
|
22 |
*/
|
23 |
private $statusCode;
|
24 |
|
vendor/ampproject/common/src/RemoteRequest/FilesystemRemoteGetRequest.php
CHANGED
@@ -20,16 +20,17 @@ final class FilesystemRemoteGetRequest implements RemoteGetRequest
|
|
20 |
{
|
21 |
|
22 |
/**
|
23 |
-
* Associative array of data for mapping between arguments and
|
24 |
*
|
25 |
* @var array
|
26 |
*/
|
27 |
private $argumentMap;
|
28 |
|
29 |
/**
|
30 |
-
* Instantiate a
|
31 |
*
|
32 |
-
* @param array $argumentMap Associative array of data for mapping between arguments and
|
|
|
33 |
*/
|
34 |
public function __construct($argumentMap)
|
35 |
{
|
20 |
{
|
21 |
|
22 |
/**
|
23 |
+
* Associative array of data for mapping between arguments and filepaths pointing to the results to return.
|
24 |
*
|
25 |
* @var array
|
26 |
*/
|
27 |
private $argumentMap;
|
28 |
|
29 |
/**
|
30 |
+
* Instantiate a FilesystemRemoteGetRequest object.
|
31 |
*
|
32 |
+
* @param array $argumentMap Associative array of data for mapping between arguments and filepaths pointing to the
|
33 |
+
* results to return.
|
34 |
*/
|
35 |
public function __construct($argumentMap)
|
36 |
{
|
vendor/ampproject/common/src/RuntimeVersion.php
CHANGED
@@ -78,7 +78,7 @@ final class RuntimeVersion
|
|
78 |
$response = $this->remoteRequest->get(self::RUNTIME_METADATA_ENDPOINT);
|
79 |
$statusCode = $response->getStatusCode();
|
80 |
|
81 |
-
if (
|
82 |
return '0';
|
83 |
}
|
84 |
|
78 |
$response = $this->remoteRequest->get(self::RUNTIME_METADATA_ENDPOINT);
|
79 |
$statusCode = $response->getStatusCode();
|
80 |
|
81 |
+
if ($statusCode < 200 || $statusCode >= 300) {
|
82 |
return '0';
|
83 |
}
|
84 |
|
vendor/ampproject/optimizer/resources/local_fallback/rtv/metadata
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"ampRuntimeVersion":"
|
1 |
+
{"ampRuntimeVersion":"012004252135000","ampCssUrl":"https://cdn.ampproject.org/rtv/012004252135000/v0.css","canaryPercentage":"0.005","diversions":["002004252135000","002005050322000","022004252135000","032004252135000","032005050322000","042005051629000","052004252135000","102004252135000"],"ltsRuntimeVersion":"012004030010070","ltsCssUrl":"https://cdn.ampproject.org/rtv/012004030010070/v0.css"}
|
vendor/ampproject/optimizer/resources/local_fallback/v0.css
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
html{overflow-x:hidden!important}html.i-amphtml-fie{height:100%!important;width:100%!important}html:not([amp4ads]),html:not([amp4ads]) body{height:auto!important}html:not([amp4ads]) body{margin:0!important}body{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}html.i-amphtml-singledoc.i-amphtml-embedded{-ms-touch-action:pan-y;touch-action:pan-y}html.i-amphtml-fie>body,html.i-amphtml-singledoc>body{overflow:visible!important}html.i-amphtml-fie:not(.i-amphtml-inabox)>body,html.i-amphtml-singledoc:not(.i-amphtml-inabox)>body{position:relative!important}html.i-amphtml-webview>body{overflow-x:hidden!important;overflow-y:visible!important;min-height:100vh!important}html.i-amphtml-ios-embed-legacy>body{overflow-x:hidden!important;overflow-y:auto!important;position:absolute!important}html.i-amphtml-ios-embed{overflow-y:auto!important;position:static}#i-amphtml-wrapper{overflow-x:hidden!important;overflow-y:auto!important;position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;margin:0!important;display:block!important}html.i-amphtml-ios-embed.i-amphtml-ios-overscroll,html.i-amphtml-ios-embed.i-amphtml-ios-overscroll>#i-amphtml-wrapper{-webkit-overflow-scrolling:touch!important}#i-amphtml-wrapper>body{position:relative!important;border-top:1px solid transparent!important}#i-amphtml-wrapper+body{visibility:visible}#i-amphtml-wrapper+body .i-amphtml-lightbox-element,#i-amphtml-wrapper+body[i-amphtml-lightbox]{visibility:hidden}#i-amphtml-wrapper+body[i-amphtml-lightbox] .i-amphtml-lightbox-element{visibility:visible}#i-amphtml-wrapper.i-amphtml-scroll-disabled,.i-amphtml-scroll-disabled{overflow-x:hidden!important;overflow-y:hidden!important}amp-instagram{padding:54px 0px 0px!important;background-color:#fff}amp-iframe iframe{box-sizing:border-box!important}[amp-access][amp-access-hide]{display:none}[subscriptions-dialog],body:not(.i-amphtml-subs-ready) [subscriptions-action],body:not(.i-amphtml-subs-ready) [subscriptions-section]{display:none!important}amp-experiment,amp-live-list>[update],amp-share-tracking{display:none}.i-amphtml-jank-meter{position:fixed;background-color:rgba(232,72,95,0.5);bottom:0;right:0;color:#fff;font-size:16px;z-index:1000;padding:5px}amp-list[resizable-children]>.i-amphtml-loading-container.amp-hidden{display:none!important}amp-list[load-more] [load-more-button],amp-list[load-more] [load-more-end],amp-list[load-more] [load-more-failed],amp-list[load-more] [load-more-loading]{display:none}amp-story-page,amp-story[standalone]{min-height:1px!important;display:block!important;height:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;width:100%!important}amp-story[standalone]{background-color:#202125!important;position:relative!important}amp-story-page{background-color:#757575}amp-story .amp-active>div{display:none!important}amp-story-page:not(:first-of-type):not([distance]):not([active]){transform:translateY(1000vh)!important}amp-autocomplete{position:relative!important;display:inline-block!important}amp-autocomplete>input,amp-autocomplete>textarea{padding:0.5rem;border:1px solid rgba(0,0,0,0.33)}.i-amphtml-autocomplete-results,amp-autocomplete>input,amp-autocomplete>textarea{font-size:1rem;line-height:1.5rem}[amp-fx^=fly-in]{visibility:hidden}
|
2 |
-
/*# sourceURL=/css/ampdoc.css*/[hidden]{display:none!important}.i-amphtml-element{display:inline-block}.i-amphtml-blurry-placeholder{transition:opacity 0.3s cubic-bezier(0.0,0.0,0.2,1)!important}[layout=nodisplay]:not(.i-amphtml-element){display:none!important}.i-amphtml-layout-fixed,[layout=fixed][width][height]:not(.i-amphtml-layout-fixed){display:inline-block;position:relative}.i-amphtml-layout-responsive,[layout=responsive][width][height]:not(.i-amphtml-layout-responsive),[width][height][sizes]:not(.i-amphtml-layout-responsive){display:block;position:relative}.i-amphtml-layout-intrinsic{display:inline-block;position:relative;max-width:100%}.i-amphtml-intrinsic-sizer{max-width:100%;display:block!important}.i-amphtml-layout-container,.i-amphtml-layout-fixed-height,[layout=container],[layout=fixed-height][height]{display:block;position:relative}.i-amphtml-layout-fill,[layout=fill]:not(.i-amphtml-layout-fill){display:block;overflow:hidden!important;position:absolute;top:0;left:0;bottom:0;right:0}.i-amphtml-layout-flex-item,[layout=flex-item]:not(.i-amphtml-layout-flex-item){display:block;position:relative;-ms-flex:1 1 auto;flex:1 1 auto}.i-amphtml-layout-fluid{position:relative}.i-amphtml-layout-size-defined{overflow:hidden!important}.i-amphtml-layout-awaiting-size{position:absolute!important;top:auto!important;bottom:auto!important}i-amphtml-sizer{display:block!important}.i-amphtml-blurry-placeholder,.i-amphtml-fill-content{display:block;height:0;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:0;margin:auto}.i-amphtml-layout-size-defined .i-amphtml-fill-content{position:absolute;top:0;left:0;bottom:0;right:0}.i-amphtml-layout-intrinsic .i-amphtml-sizer{max-width:100%}.i-amphtml-replaced-content,.i-amphtml-screen-reader{padding:0!important;border:none!important}.i-amphtml-screen-reader{position:fixed!important;top:0px!important;left:0px!important;width:4px!important;height:4px!important;opacity:0!important;overflow:hidden!important;margin:0!important;display:block!important;visibility:visible!important}.i-amphtml-screen-reader~.i-amphtml-screen-reader{left:8px!important}.i-amphtml-screen-reader~.i-amphtml-screen-reader~.i-amphtml-screen-reader{left:12px!important}.i-amphtml-screen-reader~.i-amphtml-screen-reader~.i-amphtml-screen-reader~.i-amphtml-screen-reader{left:16px!important}.i-amphtml-unresolved{position:relative;overflow:hidden!important}.i-amphtml-select-disabled{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.i-amphtml-notbuilt,[layout]:not(.i-amphtml-element){position:relative;overflow:hidden!important;color:transparent!important}.i-amphtml-notbuilt:not(.i-amphtml-layout-container)>*,[layout]:not([layout=container]):not(.i-amphtml-element)>*{display:none}.i-amphtml-ghost{visibility:hidden!important}.i-amphtml-element>[placeholder],[layout]:not(.i-amphtml-element)>[placeholder]{display:block}.i-amphtml-element>[placeholder].amp-hidden,.i-amphtml-element>[placeholder].hidden{visibility:hidden}.i-amphtml-element:not(.amp-notsupported)>[fallback],.i-amphtml-layout-container>[placeholder].amp-hidden,.i-amphtml-layout-container>[placeholder].hidden{display:none}.i-amphtml-layout-size-defined>[fallback],.i-amphtml-layout-size-defined>[placeholder]{position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:1}.i-amphtml-notbuilt>[placeholder]{display:block!important}.i-amphtml-hidden-by-media-query{display:none!important}.i-amphtml-element-error{background:red!important;color:#fff!important;position:relative!important}.i-amphtml-element-error:before{content:attr(error-message)}i-amp-scroll-container,i-amphtml-scroll-container{position:absolute;top:0;left:0;right:0;bottom:0;display:block}i-amp-scroll-container.amp-active,i-amphtml-scroll-container.amp-active{overflow:auto;-webkit-overflow-scrolling:touch}.i-amphtml-loading-container{display:block!important;pointer-events:none;z-index:1}.i-amphtml-notbuilt>.i-amphtml-loading-container{display:block!important}.i-amphtml-loading-container.amp-hidden{visibility:hidden}.i-amphtml-element>[overflow]{cursor:pointer;position:relative;z-index:2;visibility:hidden}.i-amphtml-element>[overflow].amp-visible{visibility:visible}template{display:none!important}.amp-border-box,.amp-border-box *,.amp-border-box :after,.amp-border-box :before{box-sizing:border-box}amp-pixel{display:none!important}amp-analytics,amp-story-auto-ads{position:fixed!important;top:0!important;width:1px!important;height:1px!important;overflow:hidden!important;visibility:hidden}html.i-amphtml-fie>amp-analytics{position:initial!important}[visible-when-invalid]:not(.visible),
|
3 |
/*# sourceURL=/css/ampshared.css*/
|
1 |
+
html{overflow-x:hidden!important}html.i-amphtml-fie{height:100%!important;width:100%!important}html:not([amp4ads]),html:not([amp4ads]) body{height:auto!important}html:not([amp4ads]) body{margin:0!important}body{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}html.i-amphtml-singledoc.i-amphtml-embedded{-ms-touch-action:pan-y;touch-action:pan-y}html.i-amphtml-fie>body,html.i-amphtml-singledoc>body{overflow:visible!important}html.i-amphtml-fie:not(.i-amphtml-inabox)>body,html.i-amphtml-singledoc:not(.i-amphtml-inabox)>body{position:relative!important}html.i-amphtml-webview>body{overflow-x:hidden!important;overflow-y:visible!important;min-height:100vh!important}html.i-amphtml-ios-embed-legacy>body{overflow-x:hidden!important;overflow-y:auto!important;position:absolute!important}html.i-amphtml-ios-embed{overflow-y:auto!important;position:static}#i-amphtml-wrapper{overflow-x:hidden!important;overflow-y:auto!important;position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;margin:0!important;display:block!important}html.i-amphtml-ios-embed.i-amphtml-ios-overscroll,html.i-amphtml-ios-embed.i-amphtml-ios-overscroll>#i-amphtml-wrapper{-webkit-overflow-scrolling:touch!important}#i-amphtml-wrapper>body{position:relative!important;border-top:1px solid transparent!important}#i-amphtml-wrapper+body{visibility:visible}#i-amphtml-wrapper+body .i-amphtml-lightbox-element,#i-amphtml-wrapper+body[i-amphtml-lightbox]{visibility:hidden}#i-amphtml-wrapper+body[i-amphtml-lightbox] .i-amphtml-lightbox-element{visibility:visible}#i-amphtml-wrapper.i-amphtml-scroll-disabled,.i-amphtml-scroll-disabled{overflow-x:hidden!important;overflow-y:hidden!important}amp-instagram{padding:54px 0px 0px!important;background-color:#fff}amp-iframe iframe{box-sizing:border-box!important}[amp-access][amp-access-hide]{display:none}[subscriptions-dialog],body:not(.i-amphtml-subs-ready) [subscriptions-action],body:not(.i-amphtml-subs-ready) [subscriptions-section]{display:none!important}amp-experiment,amp-live-list>[update],amp-share-tracking{display:none}.i-amphtml-jank-meter{position:fixed;background-color:rgba(232,72,95,0.5);bottom:0;right:0;color:#fff;font-size:16px;z-index:1000;padding:5px}amp-list[resizable-children]>.i-amphtml-loading-container.amp-hidden{display:none!important}amp-list [fetch-error],amp-list[load-more] [load-more-button],amp-list[load-more] [load-more-end],amp-list[load-more] [load-more-failed],amp-list[load-more] [load-more-loading]{display:none}amp-list[diffable] div[role=list]{display:block}amp-story-page,amp-story[standalone]{min-height:1px!important;display:block!important;height:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;width:100%!important}amp-story[standalone]{background-color:#202125!important;position:relative!important}amp-story-page{background-color:#757575}amp-story .amp-active>div{display:none!important}amp-story-page:not(:first-of-type):not([distance]):not([active]){transform:translateY(1000vh)!important}amp-autocomplete{position:relative!important;display:inline-block!important}amp-autocomplete>input,amp-autocomplete>textarea{padding:0.5rem;border:1px solid rgba(0,0,0,0.33)}.i-amphtml-autocomplete-results,amp-autocomplete>input,amp-autocomplete>textarea{font-size:1rem;line-height:1.5rem}[amp-fx^=fly-in]{visibility:hidden}
|
2 |
+
/*# sourceURL=/css/ampdoc.css*/[hidden]{display:none!important}.i-amphtml-element{display:inline-block}.i-amphtml-blurry-placeholder{transition:opacity 0.3s cubic-bezier(0.0,0.0,0.2,1)!important}[layout=nodisplay]:not(.i-amphtml-element){display:none!important}.i-amphtml-layout-fixed,[layout=fixed][width][height]:not(.i-amphtml-layout-fixed){display:inline-block;position:relative}.i-amphtml-layout-responsive,[layout=responsive][width][height]:not(.i-amphtml-layout-responsive),[width][height][sizes]:not(.i-amphtml-layout-responsive){display:block;position:relative}.i-amphtml-layout-intrinsic{display:inline-block;position:relative;max-width:100%}.i-amphtml-intrinsic-sizer{max-width:100%;display:block!important}.i-amphtml-layout-container,.i-amphtml-layout-fixed-height,[layout=container],[layout=fixed-height][height]{display:block;position:relative}.i-amphtml-layout-fill,[layout=fill]:not(.i-amphtml-layout-fill){display:block;overflow:hidden!important;position:absolute;top:0;left:0;bottom:0;right:0}.i-amphtml-layout-flex-item,[layout=flex-item]:not(.i-amphtml-layout-flex-item){display:block;position:relative;-ms-flex:1 1 auto;flex:1 1 auto}.i-amphtml-layout-fluid{position:relative}.i-amphtml-layout-size-defined{overflow:hidden!important}.i-amphtml-layout-awaiting-size{position:absolute!important;top:auto!important;bottom:auto!important}i-amphtml-sizer{display:block!important}.i-amphtml-blurry-placeholder,.i-amphtml-fill-content{display:block;height:0;max-height:100%;max-width:100%;min-height:100%;min-width:100%;width:0;margin:auto}.i-amphtml-layout-size-defined .i-amphtml-fill-content{position:absolute;top:0;left:0;bottom:0;right:0}.i-amphtml-layout-intrinsic .i-amphtml-sizer{max-width:100%}.i-amphtml-replaced-content,.i-amphtml-screen-reader{padding:0!important;border:none!important}.i-amphtml-screen-reader{position:fixed!important;top:0px!important;left:0px!important;width:4px!important;height:4px!important;opacity:0!important;overflow:hidden!important;margin:0!important;display:block!important;visibility:visible!important}.i-amphtml-screen-reader~.i-amphtml-screen-reader{left:8px!important}.i-amphtml-screen-reader~.i-amphtml-screen-reader~.i-amphtml-screen-reader{left:12px!important}.i-amphtml-screen-reader~.i-amphtml-screen-reader~.i-amphtml-screen-reader~.i-amphtml-screen-reader{left:16px!important}.i-amphtml-unresolved{position:relative;overflow:hidden!important}.i-amphtml-select-disabled{-webkit-user-select:none!important;-moz-user-select:none!important;-ms-user-select:none!important;user-select:none!important}.i-amphtml-notbuilt,[layout]:not(.i-amphtml-element){position:relative;overflow:hidden!important;color:transparent!important}.i-amphtml-notbuilt:not(.i-amphtml-layout-container)>*,[layout]:not([layout=container]):not(.i-amphtml-element)>*{display:none}.i-amphtml-ghost{visibility:hidden!important}.i-amphtml-element>[placeholder],[layout]:not(.i-amphtml-element)>[placeholder]{display:block}.i-amphtml-element>[placeholder].amp-hidden,.i-amphtml-element>[placeholder].hidden{visibility:hidden}.i-amphtml-element:not(.amp-notsupported)>[fallback],.i-amphtml-layout-container>[placeholder].amp-hidden,.i-amphtml-layout-container>[placeholder].hidden{display:none}.i-amphtml-layout-size-defined>[fallback],.i-amphtml-layout-size-defined>[placeholder]{position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;z-index:1}.i-amphtml-notbuilt>[placeholder]{display:block!important}.i-amphtml-hidden-by-media-query{display:none!important}.i-amphtml-element-error{background:red!important;color:#fff!important;position:relative!important}.i-amphtml-element-error:before{content:attr(error-message)}i-amp-scroll-container,i-amphtml-scroll-container{position:absolute;top:0;left:0;right:0;bottom:0;display:block}i-amp-scroll-container.amp-active,i-amphtml-scroll-container.amp-active{overflow:auto;-webkit-overflow-scrolling:touch}.i-amphtml-loading-container{display:block!important;pointer-events:none;z-index:1}.i-amphtml-notbuilt>.i-amphtml-loading-container{display:block!important}.i-amphtml-loading-container.amp-hidden{visibility:hidden}.i-amphtml-element>[overflow]{cursor:pointer;position:relative;z-index:2;visibility:hidden;display:initial}.i-amphtml-element>[overflow].amp-visible{visibility:visible}template{display:none!important}.amp-border-box,.amp-border-box *,.amp-border-box :after,.amp-border-box :before{box-sizing:border-box}amp-pixel{display:none!important}amp-analytics,amp-story-auto-ads{position:fixed!important;top:0!important;width:1px!important;height:1px!important;overflow:hidden!important;visibility:hidden}html.i-amphtml-fie>amp-analytics{position:initial!important}[visible-when-invalid]:not(.visible),form [submit-error],form [submit-success],form [submitting]{display:none}amp-accordion{display:block!important}amp-accordion>section{float:none!important}amp-accordion>section>*{float:none!important;display:block!important;overflow:hidden!important;position:relative!important}amp-accordion,amp-accordion>section{margin:0}amp-accordion>section>:last-child{display:none!important}amp-accordion>section[expanded]>:last-child{display:block!important}
|
3 |
/*# sourceURL=/css/ampshared.css*/
|
vendor/ampproject/optimizer/src/Configurable.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace AmpProject\Optimizer;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Marker interface to denote a transformer that accepts configuration settings.
|
7 |
-
*
|
8 |
-
* @package ampproject/optimizer
|
9 |
-
*/
|
10 |
-
interface Configurable
|
11 |
-
{
|
12 |
-
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/ampproject/optimizer/src/Configuration/AmpRuntimeCssConfiguration.php
CHANGED
@@ -20,10 +20,21 @@ final class AmpRuntimeCssConfiguration extends BaseTransformerConfiguration
|
|
20 |
/**
|
21 |
* Configuration key that holds the version number to use.
|
22 |
*
|
|
|
|
|
23 |
* @var string
|
24 |
*/
|
25 |
const VERSION = 'version';
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* Configuration key that holds the flag for the canary version of the runtime style.
|
29 |
*
|
@@ -42,6 +53,7 @@ final class AmpRuntimeCssConfiguration extends BaseTransformerConfiguration
|
|
42 |
{
|
43 |
return [
|
44 |
self::VERSION => '',
|
|
|
45 |
self::CANARY => false,
|
46 |
];
|
47 |
}
|
@@ -63,6 +75,13 @@ final class AmpRuntimeCssConfiguration extends BaseTransformerConfiguration
|
|
63 |
$value = trim($value);
|
64 |
break;
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
case self::CANARY:
|
67 |
if (! is_bool($value)) {
|
68 |
throw InvalidConfigurationValue::forInvalidSubValueType(self::class, self::CANARY, 'boolean', gettype($value));
|
20 |
/**
|
21 |
* Configuration key that holds the version number to use.
|
22 |
*
|
23 |
+
* If the version is not provided, the latest runtime version is fetched from cdn.ampproject.org.
|
24 |
+
*
|
25 |
* @var string
|
26 |
*/
|
27 |
const VERSION = 'version';
|
28 |
|
29 |
+
/**
|
30 |
+
* Configuration key that holds the actual runtime CSS styles to use.
|
31 |
+
*
|
32 |
+
* If the styles are not provided, the latest runtime styles are fetched from cdn.ampproject.org.
|
33 |
+
*
|
34 |
+
* @var string
|
35 |
+
*/
|
36 |
+
const STYLES = 'styles';
|
37 |
+
|
38 |
/**
|
39 |
* Configuration key that holds the flag for the canary version of the runtime style.
|
40 |
*
|
53 |
{
|
54 |
return [
|
55 |
self::VERSION => '',
|
56 |
+
self::STYLES => '',
|
57 |
self::CANARY => false,
|
58 |
];
|
59 |
}
|
75 |
$value = trim($value);
|
76 |
break;
|
77 |
|
78 |
+
case self::STYLES:
|
79 |
+
if (! is_string($value)) {
|
80 |
+
throw InvalidConfigurationValue::forInvalidSubValueType(self::class, self::STYLES, 'string', gettype($value));
|
81 |
+
}
|
82 |
+
$value = trim($value);
|
83 |
+
break;
|
84 |
+
|
85 |
case self::CANARY:
|
86 |
if (! is_bool($value)) {
|
87 |
throw InvalidConfigurationValue::forInvalidSubValueType(self::class, self::CANARY, 'boolean', gettype($value));
|
vendor/ampproject/optimizer/src/MakesRemoteRequests.php
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
namespace AmpProject\Optimizer;
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Marker interface to denote a transformer that makes remote requests.
|
7 |
-
*
|
8 |
-
* @package ampproject/optimizer
|
9 |
-
*/
|
10 |
-
interface MakesRemoteRequests
|
11 |
-
{
|
12 |
-
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/ampproject/optimizer/src/TransformationEngine.php
CHANGED
@@ -5,6 +5,8 @@ namespace AmpProject\Optimizer;
|
|
5 |
use AmpProject\Dom\Document;
|
6 |
use AmpProject\RemoteGetRequest;
|
7 |
use AmpProject\RemoteRequest\CurlRemoteGetRequest;
|
|
|
|
|
8 |
|
9 |
/**
|
10 |
* Transformation engine that accepts HTML and returns optimized HTML.
|
@@ -28,17 +30,26 @@ final class TransformationEngine
|
|
28 |
*/
|
29 |
private $remoteRequest;
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* Instantiate a TransformationEngine object.
|
33 |
*
|
34 |
-
* @param Configuration $configuration Configuration data to use for setting up the transformers.
|
35 |
-
* @param RemoteGetRequest $remoteRequest Optional. Transport to use for remote requests. Defaults to the
|
36 |
* CurlRemoteGetRequest implementation shipped with the library.
|
37 |
*/
|
38 |
-
public function __construct(Configuration $configuration, RemoteGetRequest $remoteRequest = null)
|
39 |
{
|
40 |
-
$this->configuration = $configuration;
|
41 |
$this->remoteRequest = isset($remoteRequest) ? $remoteRequest : new CurlRemoteGetRequest();
|
|
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -50,7 +61,7 @@ final class TransformationEngine
|
|
50 |
*/
|
51 |
public function optimizeDom(Document $document, ErrorCollection $errors)
|
52 |
{
|
53 |
-
foreach ($this->
|
54 |
$transformer->transform($document, $errors);
|
55 |
}
|
56 |
}
|
@@ -71,31 +82,58 @@ final class TransformationEngine
|
|
71 |
}
|
72 |
|
73 |
/**
|
74 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
*
|
76 |
-
* @
|
|
|
|
|
77 |
*/
|
78 |
-
private function
|
79 |
{
|
80 |
-
|
|
|
|
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
$arguments = [];
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
|
|
|
94 |
|
95 |
-
|
|
|
|
|
96 |
}
|
|
|
|
|
|
|
97 |
}
|
98 |
|
99 |
-
return $
|
100 |
}
|
101 |
}
|
5 |
use AmpProject\Dom\Document;
|
6 |
use AmpProject\RemoteGetRequest;
|
7 |
use AmpProject\RemoteRequest\CurlRemoteGetRequest;
|
8 |
+
use ReflectionClass;
|
9 |
+
use ReflectionException;
|
10 |
|
11 |
/**
|
12 |
* Transformation engine that accepts HTML and returns optimized HTML.
|
30 |
*/
|
31 |
private $remoteRequest;
|
32 |
|
33 |
+
/**
|
34 |
+
* Collection of transformers that were initialized.
|
35 |
+
*
|
36 |
+
* @var Transformer[]
|
37 |
+
*/
|
38 |
+
private $transformers;
|
39 |
+
|
40 |
/**
|
41 |
* Instantiate a TransformationEngine object.
|
42 |
*
|
43 |
+
* @param Configuration|null $configuration Optional. Configuration data to use for setting up the transformers.
|
44 |
+
* @param RemoteGetRequest|null $remoteRequest Optional. Transport to use for remote requests. Defaults to the
|
45 |
* CurlRemoteGetRequest implementation shipped with the library.
|
46 |
*/
|
47 |
+
public function __construct(Configuration $configuration = null, RemoteGetRequest $remoteRequest = null)
|
48 |
{
|
49 |
+
$this->configuration = isset($configuration) ? $configuration : new Configuration();
|
50 |
$this->remoteRequest = isset($remoteRequest) ? $remoteRequest : new CurlRemoteGetRequest();
|
51 |
+
|
52 |
+
$this->initializeTransformers();
|
53 |
}
|
54 |
|
55 |
/**
|
61 |
*/
|
62 |
public function optimizeDom(Document $document, ErrorCollection $errors)
|
63 |
{
|
64 |
+
foreach ($this->transformers as $transformer) {
|
65 |
$transformer->transform($document, $errors);
|
66 |
}
|
67 |
}
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
+
* Initialize the array of transformers to use.
|
86 |
+
*/
|
87 |
+
private function initializeTransformers()
|
88 |
+
{
|
89 |
+
$this->transformers = [];
|
90 |
+
|
91 |
+
foreach ($this->configuration->get(Configuration::KEY_TRANSFORMERS) as $transformerClass) {
|
92 |
+
$this->transformers[$transformerClass] = new $transformerClass(
|
93 |
+
...$this->getTransformerDependencies($transformerClass)
|
94 |
+
);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get the dependencies of a transformer and put them in the correct order.
|
100 |
*
|
101 |
+
* @param string $transformerClass Class of the transformer to get the dependencies for.
|
102 |
+
* @return array Array of dependencies in the order as they appear in the transformer's constructor.
|
103 |
+
* @throws ReflectionException If the transformer could not be reflected upon.
|
104 |
*/
|
105 |
+
private function getTransformerDependencies($transformerClass)
|
106 |
{
|
107 |
+
$constructor = (new ReflectionClass($transformerClass))->getConstructor();
|
108 |
+
|
109 |
+
if ($constructor === null) {
|
110 |
+
return [];
|
111 |
+
}
|
112 |
|
113 |
+
$dependencies = [];
|
114 |
+
foreach ($constructor->getParameters() as $parameter) {
|
115 |
+
$dependencyType = $parameter->getClass();
|
|
|
116 |
|
117 |
+
if ($dependencyType === null) {
|
118 |
+
// No type provided, so we pass `null` in the hopes that the argument is optional.
|
119 |
+
$dependencies[] = null;
|
120 |
+
continue;
|
121 |
+
}
|
122 |
|
123 |
+
if (is_a($dependencyType->name, TransformerConfiguration::class, true)) {
|
124 |
+
$dependencies[] = $this->configuration->getTransformerConfiguration($transformerClass);
|
125 |
+
continue;
|
126 |
+
}
|
127 |
|
128 |
+
if (is_a($dependencyType->name, RemoteGetRequest::class, true)) {
|
129 |
+
$dependencies[] = $this->remoteRequest;
|
130 |
+
continue;
|
131 |
}
|
132 |
+
|
133 |
+
// Unknown dependency type, so we pass `null` in the hopes that the argument is optional.
|
134 |
+
$dependencies[] = null;
|
135 |
}
|
136 |
|
137 |
+
return $dependencies;
|
138 |
}
|
139 |
}
|
vendor/ampproject/optimizer/src/Transformer/AmpRuntimeCss.php
CHANGED
@@ -5,11 +5,9 @@ namespace AmpProject\Optimizer\Transformer;
|
|
5 |
use AmpProject\Amp;
|
6 |
use AmpProject\Attribute;
|
7 |
use AmpProject\Dom\Document;
|
8 |
-
use AmpProject\Optimizer\Configurable;
|
9 |
use AmpProject\Optimizer\Configuration\AmpRuntimeCssConfiguration;
|
10 |
use AmpProject\Optimizer\Error;
|
11 |
use AmpProject\Optimizer\ErrorCollection;
|
12 |
-
use AmpProject\Optimizer\MakesRemoteRequests;
|
13 |
use AmpProject\Optimizer\TransformerConfiguration;
|
14 |
use AmpProject\RemoteGetRequest;
|
15 |
use AmpProject\Optimizer\Transformer;
|
@@ -36,7 +34,7 @@ use Exception;
|
|
36 |
*
|
37 |
* @package ampproject/optimizer
|
38 |
*/
|
39 |
-
final class AmpRuntimeCss implements Transformer
|
40 |
{
|
41 |
|
42 |
/**
|
@@ -61,29 +59,29 @@ final class AmpRuntimeCss implements Transformer, Configurable, MakesRemoteReque
|
|
61 |
const V0_CSS_URL = Amp::CACHE_HOST . '/' . self::V0_CSS;
|
62 |
|
63 |
/**
|
64 |
-
*
|
65 |
*
|
66 |
-
* @var
|
67 |
*/
|
68 |
-
private $
|
69 |
|
70 |
/**
|
71 |
-
*
|
72 |
*
|
73 |
-
* @var
|
74 |
*/
|
75 |
-
private $
|
76 |
|
77 |
/**
|
78 |
* Instantiate an AmpRuntimeCss object.
|
79 |
*
|
80 |
-
* @param RemoteGetRequest $remoteRequest Transport to use for remote requests.
|
81 |
* @param TransformerConfiguration $configuration Configuration store to use.
|
|
|
82 |
*/
|
83 |
-
public function __construct(
|
84 |
{
|
85 |
-
$this->remoteRequest = $remoteRequest;
|
86 |
$this->configuration = $configuration;
|
|
|
87 |
}
|
88 |
|
89 |
/**
|
@@ -143,6 +141,7 @@ final class AmpRuntimeCss implements Transformer, Configurable, MakesRemoteReque
|
|
143 |
} catch (Exception $exception) {
|
144 |
$errors->add(Error\CannotInlineRuntimeCss::fromException($exception, $ampRuntimeStyle, $version));
|
145 |
$this->linkCss($document, $ampRuntimeStyle);
|
|
|
146 |
}
|
147 |
}
|
148 |
|
@@ -164,14 +163,21 @@ final class AmpRuntimeCss implements Transformer, Configurable, MakesRemoteReque
|
|
164 |
}
|
165 |
|
166 |
$ampRuntimeStyle->setAttribute(Attribute::I_AMPHTML_VERSION, $version);
|
167 |
-
$response = $this->remoteRequest->get($v0CssUrl);
|
168 |
-
$statusCode = $response->getStatusCode();
|
169 |
|
170 |
-
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
|
174 |
-
$ampRuntimeStyle->textContent = $
|
175 |
}
|
176 |
|
177 |
/**
|
5 |
use AmpProject\Amp;
|
6 |
use AmpProject\Attribute;
|
7 |
use AmpProject\Dom\Document;
|
|
|
8 |
use AmpProject\Optimizer\Configuration\AmpRuntimeCssConfiguration;
|
9 |
use AmpProject\Optimizer\Error;
|
10 |
use AmpProject\Optimizer\ErrorCollection;
|
|
|
11 |
use AmpProject\Optimizer\TransformerConfiguration;
|
12 |
use AmpProject\RemoteGetRequest;
|
13 |
use AmpProject\Optimizer\Transformer;
|
34 |
*
|
35 |
* @package ampproject/optimizer
|
36 |
*/
|
37 |
+
final class AmpRuntimeCss implements Transformer
|
38 |
{
|
39 |
|
40 |
/**
|
59 |
const V0_CSS_URL = Amp::CACHE_HOST . '/' . self::V0_CSS;
|
60 |
|
61 |
/**
|
62 |
+
* Configuration store to use.
|
63 |
*
|
64 |
+
* @var TransformerConfiguration
|
65 |
*/
|
66 |
+
private $configuration;
|
67 |
|
68 |
/**
|
69 |
+
* Transport to use for remote requests.
|
70 |
*
|
71 |
+
* @var RemoteGetRequest
|
72 |
*/
|
73 |
+
private $remoteRequest;
|
74 |
|
75 |
/**
|
76 |
* Instantiate an AmpRuntimeCss object.
|
77 |
*
|
|
|
78 |
* @param TransformerConfiguration $configuration Configuration store to use.
|
79 |
+
* @param RemoteGetRequest $remoteRequest Transport to use for remote requests.
|
80 |
*/
|
81 |
+
public function __construct(TransformerConfiguration $configuration, RemoteGetRequest $remoteRequest)
|
82 |
{
|
|
|
83 |
$this->configuration = $configuration;
|
84 |
+
$this->remoteRequest = $remoteRequest;
|
85 |
}
|
86 |
|
87 |
/**
|
141 |
} catch (Exception $exception) {
|
142 |
$errors->add(Error\CannotInlineRuntimeCss::fromException($exception, $ampRuntimeStyle, $version));
|
143 |
$this->linkCss($document, $ampRuntimeStyle);
|
144 |
+
$ampRuntimeStyle->parentNode->removeChild($ampRuntimeStyle);
|
145 |
}
|
146 |
}
|
147 |
|
163 |
}
|
164 |
|
165 |
$ampRuntimeStyle->setAttribute(Attribute::I_AMPHTML_VERSION, $version);
|
|
|
|
|
166 |
|
167 |
+
$styles = $this->configuration->get(AmpRuntimeCssConfiguration::STYLES);
|
168 |
+
|
169 |
+
if (empty($styles)) {
|
170 |
+
$response = $this->remoteRequest->get($v0CssUrl);
|
171 |
+
$statusCode = $response->getStatusCode();
|
172 |
+
|
173 |
+
if (200 < $statusCode || $statusCode >= 300) {
|
174 |
+
return;
|
175 |
+
}
|
176 |
+
|
177 |
+
$styles = $response->getBody();
|
178 |
}
|
179 |
|
180 |
+
$ampRuntimeStyle->textContent = $styles;
|
181 |
}
|
182 |
|
183 |
/**
|
vendor/ampproject/optimizer/src/Transformer/ReorderHead.php
CHANGED
@@ -17,7 +17,7 @@ use DOMNode;
|
|
17 |
* ReorderHead reorders the children of <head>. Specifically, it
|
18 |
* orders the <head> like so:
|
19 |
* (0) <meta charset> tag
|
20 |
-
* (1) <style amp-runtime> (inserted by
|
21 |
* (2) remaining <meta> tags (those other than <meta charset>)
|
22 |
* (3) AMP runtime .js <script> tag
|
23 |
* (4) AMP viewer runtime .js <script>
|
17 |
* ReorderHead reorders the children of <head>. Specifically, it
|
18 |
* orders the <head> like so:
|
19 |
* (0) <meta charset> tag
|
20 |
+
* (1) <style amp-runtime> (inserted by AmpRuntimeCss transformer)
|
21 |
* (2) remaining <meta> tags (those other than <meta charset>)
|
22 |
* (3) AMP runtime .js <script> tag
|
23 |
* (4) AMP viewer runtime .js <script>
|
vendor/ampproject/optimizer/src/Transformer/ServerSideRendering.php
CHANGED
@@ -528,14 +528,13 @@ final class ServerSideRendering implements Transformer
|
|
528 |
$sizer_img->setAttribute(Attribute::CLASS_, Amp::INTRINSIC_SIZER_ELEMENT);
|
529 |
$sizer_img->setAttribute(Attribute::ROLE, Role::PRESENTATION);
|
530 |
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
$sizer_img->setAttribute(Attribute::SRC, "data:image/svg+xml;charset=utf-8,<svg height="{$height_int}" width="{$width_int}" xmlns="http://www.w3.org/2000/svg" version="1.1"/>");
|
539 |
|
540 |
$sizer->appendChild($sizer_img);
|
541 |
|
528 |
$sizer_img->setAttribute(Attribute::CLASS_, Amp::INTRINSIC_SIZER_ELEMENT);
|
529 |
$sizer_img->setAttribute(Attribute::ROLE, Role::PRESENTATION);
|
530 |
|
531 |
+
$sizer_img->setAttribute(
|
532 |
+
Attribute::SRC,
|
533 |
+
sprintf(
|
534 |
+
'data:image/svg+xml;base64,%s',
|
535 |
+
base64_encode("<svg height='{$height->getNumeral()}' width='{$width->getNumeral()}' xmlns='http://www.w3.org/2000/svg' version='1.1'/>")
|
536 |
+
)
|
537 |
+
);
|
|
|
538 |
|
539 |
$sizer->appendChild($sizer_img);
|
540 |
|
vendor/ampproject/optimizer/src/Transformer/TransformedIdentifier.php
CHANGED
@@ -3,7 +3,6 @@
|
|
3 |
namespace AmpProject\Optimizer\Transformer;
|
4 |
|
5 |
use AmpProject\Dom\Document;
|
6 |
-
use AmpProject\Optimizer\Configurable;
|
7 |
use AmpProject\Optimizer\Configuration\TransformedIdentifierConfiguration;
|
8 |
use AmpProject\Optimizer\ErrorCollection;
|
9 |
use AmpProject\Optimizer\Transformer;
|
@@ -25,7 +24,7 @@ use AmpProject\Optimizer\TransformerConfiguration;
|
|
25 |
*
|
26 |
* @package ampproject/optimizer
|
27 |
*/
|
28 |
-
final class TransformedIdentifier implements Transformer
|
29 |
{
|
30 |
|
31 |
/**
|
3 |
namespace AmpProject\Optimizer\Transformer;
|
4 |
|
5 |
use AmpProject\Dom\Document;
|
|
|
6 |
use AmpProject\Optimizer\Configuration\TransformedIdentifierConfiguration;
|
7 |
use AmpProject\Optimizer\ErrorCollection;
|
8 |
use AmpProject\Optimizer\Transformer;
|
24 |
*
|
25 |
* @package ampproject/optimizer
|
26 |
*/
|
27 |
+
final class TransformedIdentifier implements Transformer
|
28 |
{
|
29 |
|
30 |
/**
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitd9baa440e9e56e97be99543689d7a8f5::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -121,7 +121,6 @@ return array(
|
|
121 |
'AmpProject\\Extension' => $vendorDir . '/ampproject/common/src/Extension.php',
|
122 |
'AmpProject\\Fonts' => $vendorDir . '/ampproject/common/src/Fonts.php',
|
123 |
'AmpProject\\Layout' => $vendorDir . '/ampproject/common/src/Layout.php',
|
124 |
-
'AmpProject\\Optimizer\\Configurable' => $vendorDir . '/ampproject/optimizer/src/Configurable.php',
|
125 |
'AmpProject\\Optimizer\\Configuration' => $vendorDir . '/ampproject/optimizer/src/Configuration.php',
|
126 |
'AmpProject\\Optimizer\\Configuration\\AmpRuntimeCssConfiguration' => $vendorDir . '/ampproject/optimizer/src/Configuration/AmpRuntimeCssConfiguration.php',
|
127 |
'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' => $vendorDir . '/ampproject/optimizer/src/Configuration/BaseTransformerConfiguration.php',
|
@@ -140,7 +139,6 @@ return array(
|
|
140 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationClass' => $vendorDir . '/ampproject/optimizer/src/Exception/UnknownConfigurationClass.php',
|
141 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationKey' => $vendorDir . '/ampproject/optimizer/src/Exception/UnknownConfigurationKey.php',
|
142 |
'AmpProject\\Optimizer\\LocalFallback' => $vendorDir . '/ampproject/optimizer/src/LocalFallback.php',
|
143 |
-
'AmpProject\\Optimizer\\MakesRemoteRequests' => $vendorDir . '/ampproject/optimizer/src/MakesRemoteRequests.php',
|
144 |
'AmpProject\\Optimizer\\TransformationEngine' => $vendorDir . '/ampproject/optimizer/src/TransformationEngine.php',
|
145 |
'AmpProject\\Optimizer\\Transformer' => $vendorDir . '/ampproject/optimizer/src/Transformer.php',
|
146 |
'AmpProject\\Optimizer\\TransformerConfiguration' => $vendorDir . '/ampproject/optimizer/src/TransformerConfiguration.php',
|
121 |
'AmpProject\\Extension' => $vendorDir . '/ampproject/common/src/Extension.php',
|
122 |
'AmpProject\\Fonts' => $vendorDir . '/ampproject/common/src/Fonts.php',
|
123 |
'AmpProject\\Layout' => $vendorDir . '/ampproject/common/src/Layout.php',
|
|
|
124 |
'AmpProject\\Optimizer\\Configuration' => $vendorDir . '/ampproject/optimizer/src/Configuration.php',
|
125 |
'AmpProject\\Optimizer\\Configuration\\AmpRuntimeCssConfiguration' => $vendorDir . '/ampproject/optimizer/src/Configuration/AmpRuntimeCssConfiguration.php',
|
126 |
'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' => $vendorDir . '/ampproject/optimizer/src/Configuration/BaseTransformerConfiguration.php',
|
139 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationClass' => $vendorDir . '/ampproject/optimizer/src/Exception/UnknownConfigurationClass.php',
|
140 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationKey' => $vendorDir . '/ampproject/optimizer/src/Exception/UnknownConfigurationKey.php',
|
141 |
'AmpProject\\Optimizer\\LocalFallback' => $vendorDir . '/ampproject/optimizer/src/LocalFallback.php',
|
|
|
142 |
'AmpProject\\Optimizer\\TransformationEngine' => $vendorDir . '/ampproject/optimizer/src/TransformationEngine.php',
|
143 |
'AmpProject\\Optimizer\\Transformer' => $vendorDir . '/ampproject/optimizer/src/Transformer.php',
|
144 |
'AmpProject\\Optimizer\\TransformerConfiguration' => $vendorDir . '/ampproject/optimizer/src/TransformerConfiguration.php',
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit4ec3764ba81323ddf112cd91ef3337df
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
@@ -51,19 +51,19 @@ class ComposerAutoloaderInit4ec3764ba81323ddf112cd91ef3337df
|
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
-
$includeFiles = Composer\Autoload\
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
-
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
function
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitd9baa440e9e56e97be99543689d7a8f5
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitd9baa440e9e56e97be99543689d7a8f5', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitd9baa440e9e56e97be99543689d7a8f5', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
51 |
$loader->register(true);
|
52 |
|
53 |
if ($useStaticLoader) {
|
54 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5::$files;
|
55 |
} else {
|
56 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
}
|
58 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
+
composerRequired9baa440e9e56e97be99543689d7a8f5($fileIdentifier, $file);
|
60 |
}
|
61 |
|
62 |
return $loader;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
function composerRequired9baa440e9e56e97be99543689d7a8f5($fileIdentifier, $file)
|
67 |
{
|
68 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'6f5653f9af3eab04254ad2c7f20515c8' => __DIR__ . '/../..' . '/back-compat/back-compat.php',
|
@@ -171,7 +171,6 @@ class ComposerStaticInit4ec3764ba81323ddf112cd91ef3337df
|
|
171 |
'AmpProject\\Extension' => __DIR__ . '/..' . '/ampproject/common/src/Extension.php',
|
172 |
'AmpProject\\Fonts' => __DIR__ . '/..' . '/ampproject/common/src/Fonts.php',
|
173 |
'AmpProject\\Layout' => __DIR__ . '/..' . '/ampproject/common/src/Layout.php',
|
174 |
-
'AmpProject\\Optimizer\\Configurable' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configurable.php',
|
175 |
'AmpProject\\Optimizer\\Configuration' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configuration.php',
|
176 |
'AmpProject\\Optimizer\\Configuration\\AmpRuntimeCssConfiguration' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configuration/AmpRuntimeCssConfiguration.php',
|
177 |
'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configuration/BaseTransformerConfiguration.php',
|
@@ -190,7 +189,6 @@ class ComposerStaticInit4ec3764ba81323ddf112cd91ef3337df
|
|
190 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationClass' => __DIR__ . '/..' . '/ampproject/optimizer/src/Exception/UnknownConfigurationClass.php',
|
191 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationKey' => __DIR__ . '/..' . '/ampproject/optimizer/src/Exception/UnknownConfigurationKey.php',
|
192 |
'AmpProject\\Optimizer\\LocalFallback' => __DIR__ . '/..' . '/ampproject/optimizer/src/LocalFallback.php',
|
193 |
-
'AmpProject\\Optimizer\\MakesRemoteRequests' => __DIR__ . '/..' . '/ampproject/optimizer/src/MakesRemoteRequests.php',
|
194 |
'AmpProject\\Optimizer\\TransformationEngine' => __DIR__ . '/..' . '/ampproject/optimizer/src/TransformationEngine.php',
|
195 |
'AmpProject\\Optimizer\\Transformer' => __DIR__ . '/..' . '/ampproject/optimizer/src/Transformer.php',
|
196 |
'AmpProject\\Optimizer\\TransformerConfiguration' => __DIR__ . '/..' . '/ampproject/optimizer/src/TransformerConfiguration.php',
|
@@ -258,10 +256,10 @@ class ComposerStaticInit4ec3764ba81323ddf112cd91ef3337df
|
|
258 |
public static function getInitializer(ClassLoader $loader)
|
259 |
{
|
260 |
return \Closure::bind(function () use ($loader) {
|
261 |
-
$loader->prefixLengthsPsr4 =
|
262 |
-
$loader->prefixDirsPsr4 =
|
263 |
-
$loader->prefixesPsr0 =
|
264 |
-
$loader->classMap =
|
265 |
|
266 |
}, null, ClassLoader::class);
|
267 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'6f5653f9af3eab04254ad2c7f20515c8' => __DIR__ . '/../..' . '/back-compat/back-compat.php',
|
171 |
'AmpProject\\Extension' => __DIR__ . '/..' . '/ampproject/common/src/Extension.php',
|
172 |
'AmpProject\\Fonts' => __DIR__ . '/..' . '/ampproject/common/src/Fonts.php',
|
173 |
'AmpProject\\Layout' => __DIR__ . '/..' . '/ampproject/common/src/Layout.php',
|
|
|
174 |
'AmpProject\\Optimizer\\Configuration' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configuration.php',
|
175 |
'AmpProject\\Optimizer\\Configuration\\AmpRuntimeCssConfiguration' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configuration/AmpRuntimeCssConfiguration.php',
|
176 |
'AmpProject\\Optimizer\\Configuration\\BaseTransformerConfiguration' => __DIR__ . '/..' . '/ampproject/optimizer/src/Configuration/BaseTransformerConfiguration.php',
|
189 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationClass' => __DIR__ . '/..' . '/ampproject/optimizer/src/Exception/UnknownConfigurationClass.php',
|
190 |
'AmpProject\\Optimizer\\Exception\\UnknownConfigurationKey' => __DIR__ . '/..' . '/ampproject/optimizer/src/Exception/UnknownConfigurationKey.php',
|
191 |
'AmpProject\\Optimizer\\LocalFallback' => __DIR__ . '/..' . '/ampproject/optimizer/src/LocalFallback.php',
|
|
|
192 |
'AmpProject\\Optimizer\\TransformationEngine' => __DIR__ . '/..' . '/ampproject/optimizer/src/TransformationEngine.php',
|
193 |
'AmpProject\\Optimizer\\Transformer' => __DIR__ . '/..' . '/ampproject/optimizer/src/Transformer.php',
|
194 |
'AmpProject\\Optimizer\\TransformerConfiguration' => __DIR__ . '/..' . '/ampproject/optimizer/src/TransformerConfiguration.php',
|
256 |
public static function getInitializer(ClassLoader $loader)
|
257 |
{
|
258 |
return \Closure::bind(function () use ($loader) {
|
259 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5::$prefixLengthsPsr4;
|
260 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5::$prefixDirsPsr4;
|
261 |
+
$loader->prefixesPsr0 = ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5::$prefixesPsr0;
|
262 |
+
$loader->classMap = ComposerStaticInitd9baa440e9e56e97be99543689d7a8f5::$classMap;
|
263 |
|
264 |
}, null, ClassLoader::class);
|
265 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
[
|
2 |
{
|
3 |
"name": "ampproject/common",
|
4 |
-
"version": "dev
|
5 |
-
"version_normalized": "dev
|
6 |
"dist": {
|
7 |
"type": "path",
|
8 |
"url": "lib/common",
|
9 |
-
"reference": "
|
10 |
},
|
11 |
"require": {
|
12 |
"ext-dom": "*",
|
@@ -32,7 +32,7 @@
|
|
32 |
},
|
33 |
"downloads": {
|
34 |
"phpstan": {
|
35 |
-
"url": "https://github.com/phpstan/phpstan/releases/download/
|
36 |
"path": "vendor/bin/phpstan",
|
37 |
"type": "phar"
|
38 |
}
|
@@ -66,7 +66,7 @@
|
|
66 |
"@analyze"
|
67 |
],
|
68 |
"analyze": [
|
69 |
-
"if [ -z $TEST_SKIP_PHPSTAN ]; then phpstan analyze --ansi; fi"
|
70 |
],
|
71 |
"unit": [
|
72 |
"if [ -z $TEST_SKIP_PHPUNIT ]; then phpunit --colors=always; fi"
|
@@ -77,17 +77,18 @@
|
|
77 |
],
|
78 |
"description": "PHP library with common base functionality for AMP integrations.",
|
79 |
"transport-options": {
|
80 |
-
"symlink": true
|
|
|
81 |
}
|
82 |
},
|
83 |
{
|
84 |
"name": "ampproject/optimizer",
|
85 |
-
"version": "dev
|
86 |
-
"version_normalized": "dev
|
87 |
"dist": {
|
88 |
"type": "path",
|
89 |
"url": "lib/optimizer",
|
90 |
-
"reference": "
|
91 |
},
|
92 |
"require": {
|
93 |
"ampproject/common": "^1",
|
@@ -114,7 +115,7 @@
|
|
114 |
},
|
115 |
"downloads": {
|
116 |
"phpstan": {
|
117 |
-
"url": "https://github.com/phpstan/phpstan/releases/download/
|
118 |
"path": "vendor/bin/phpstan",
|
119 |
"type": "phar"
|
120 |
}
|
@@ -142,7 +143,7 @@
|
|
142 |
"if [ -z $TEST_SKIP_LINTING ]; then parallel-lint -j 10 --colors --exclude vendor .; fi"
|
143 |
],
|
144 |
"post-update-cmd": [
|
145 |
-
"
|
146 |
"bin/sync-amp-runtime-local-fallback-resources.php"
|
147 |
],
|
148 |
"test": [
|
@@ -152,10 +153,13 @@
|
|
152 |
"@analyze"
|
153 |
],
|
154 |
"analyze": [
|
155 |
-
"if [ -z $TEST_SKIP_PHPSTAN ]; then phpstan analyze --ansi; fi"
|
156 |
],
|
157 |
"unit": [
|
158 |
"if [ -z $TEST_SKIP_PHPUNIT ]; then phpunit --colors=always; fi"
|
|
|
|
|
|
|
159 |
]
|
160 |
},
|
161 |
"license": [
|
@@ -163,7 +167,8 @@
|
|
163 |
],
|
164 |
"description": "PHP library for optimizing AMP pages.",
|
165 |
"transport-options": {
|
166 |
-
"symlink": true
|
|
|
167 |
}
|
168 |
},
|
169 |
{
|
1 |
[
|
2 |
{
|
3 |
"name": "ampproject/common",
|
4 |
+
"version": "1.5.x-dev",
|
5 |
+
"version_normalized": "1.5.9999999.9999999-dev",
|
6 |
"dist": {
|
7 |
"type": "path",
|
8 |
"url": "lib/common",
|
9 |
+
"reference": "630737c71b1e0708d2fde85d04826581c04d41da"
|
10 |
},
|
11 |
"require": {
|
12 |
"ext-dom": "*",
|
32 |
},
|
33 |
"downloads": {
|
34 |
"phpstan": {
|
35 |
+
"url": "https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar",
|
36 |
"path": "vendor/bin/phpstan",
|
37 |
"type": "phar"
|
38 |
}
|
66 |
"@analyze"
|
67 |
],
|
68 |
"analyze": [
|
69 |
+
"if [ -z $TEST_SKIP_PHPSTAN ]; then phpstan --version; phpstan analyze --ansi; fi"
|
70 |
],
|
71 |
"unit": [
|
72 |
"if [ -z $TEST_SKIP_PHPUNIT ]; then phpunit --colors=always; fi"
|
77 |
],
|
78 |
"description": "PHP library with common base functionality for AMP integrations.",
|
79 |
"transport-options": {
|
80 |
+
"symlink": true,
|
81 |
+
"relative": true
|
82 |
}
|
83 |
},
|
84 |
{
|
85 |
"name": "ampproject/optimizer",
|
86 |
+
"version": "1.5.x-dev",
|
87 |
+
"version_normalized": "1.5.9999999.9999999-dev",
|
88 |
"dist": {
|
89 |
"type": "path",
|
90 |
"url": "lib/optimizer",
|
91 |
+
"reference": "2659539ed2f0a42a6b974fce469ff3278e7fe55f"
|
92 |
},
|
93 |
"require": {
|
94 |
"ampproject/common": "^1",
|
115 |
},
|
116 |
"downloads": {
|
117 |
"phpstan": {
|
118 |
+
"url": "https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar",
|
119 |
"path": "vendor/bin/phpstan",
|
120 |
"type": "phar"
|
121 |
}
|
143 |
"if [ -z $TEST_SKIP_LINTING ]; then parallel-lint -j 10 --colors --exclude vendor .; fi"
|
144 |
],
|
145 |
"post-update-cmd": [
|
146 |
+
"@update-test-specs",
|
147 |
"bin/sync-amp-runtime-local-fallback-resources.php"
|
148 |
],
|
149 |
"test": [
|
153 |
"@analyze"
|
154 |
],
|
155 |
"analyze": [
|
156 |
+
"if [ -z $TEST_SKIP_PHPSTAN ]; then phpstan version; phpstan analyze --ansi; fi"
|
157 |
],
|
158 |
"unit": [
|
159 |
"if [ -z $TEST_SKIP_PHPUNIT ]; then phpunit --colors=always; fi"
|
160 |
+
],
|
161 |
+
"update-test-specs": [
|
162 |
+
"rm -rf tests/spec && bin/sync-amp-toolbox-test-suite.php"
|
163 |
]
|
164 |
},
|
165 |
"license": [
|
167 |
],
|
168 |
"description": "PHP library for optimizing AMP pages.",
|
169 |
"transport-options": {
|
170 |
+
"symlink": true,
|
171 |
+
"relative": true
|
172 |
}
|
173 |
},
|
174 |
{
|