AMP for WP – Accelerated Mobile Pages - Version 0.9.98.9

Version Description

(16th SEPTEMBER 2019) =

  • Improvements: Need to implement Tree Shaking feature to remove access css from the AMP pages #2949
  • Improvements: Need to save Post Meta Field Revisions in WordPress #3548
  • Improvements: Add Role based Access to all the options #3480
  • Improvements: Need to improve import/export option. #3364
  • Improvements: Need to make compatibility with amp-connatix-player component #3524
  • Improvements: "Recent Posts below related posts" feature need to implement for the design three #3531
  • Improvements: Need to improve color picker library in AMP FOR WP Plugin #3461
  • Improvements: Recent Posts below Related needs new options #3518
  • Improvements: Excerpt length feature request for related post #2908
  • Improvements: Need to add the option date below the content #3445
  • Improvements: Need to hide time in traditional view option. #3453
  • Improvements: Add feature to go to non AMP page on next and previous links #3253
  • Improvements: Create a filter to Exclude Posts from Related Posts #3582
  • Improvements: Need to add a filter to remove options in sidebar in AMP #3416
  • Improvements: allow option to change the heading tag of Featured module #3560
  • Improvements: AAWP plugin for AMP compatibility in Extension list #3591
  • Fixed: Individual AMP Page (Bulk Edit) "hide by default" option not working #3610
  • Fixed: In Recent Posts below Related need to add which present in below below related post #3596
  • Fixed: Need to shift the Header Background Option and Header Elements option on top in Swift theme #3462
  • Fixed: Need to add 'By Last X Days' option for "In-Content Related Posts" #3219
  • Fixed: Need to add unique class name custom post type #3539
  • Fixed: Need to add Convert AMP to WP theme (Beta) tutorial link in tooltip of this option #3552
  • Fixed: Need to connect with Collapse references by default option of the footnotes plugin. #3586
  • Fixed: Do not generate the AMPhtml for Woocommerce Account Page #3619
  • Fixed: Need to place page builder in custom homepage even amp support is off on pages. #2914
  • Fixed: Need to allow the user to navigate if user is using iframe #3601
  • Fixed: Template mode: Need to changes/fixes #3590
  • Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
  • Fixed: Improper amphtml on HomePage when WPML is activate #3341
  • Fixed: The GDPR consent not working due to passed as string. #3658

Full changelog available at changelog.txt

Download this release

Release Info

Developer mohammed_kaludi
Plugin Icon 128x128 AMP for WP – Accelerated Mobile Pages
Version 0.9.98.9
Comparing to
See all releases

Code changes from version 0.9.98.8 to 0.9.98.9

Files changed (154) hide show
  1. README.md +36 -1
  2. accelerated-moblie-pages.php +2 -2
  3. changelog.txt +33 -0
  4. components/components-core.php +8 -2
  5. components/gdpr/gdpr.php +3 -3
  6. components/loop/loop.php +6 -3
  7. components/post-navigation/post-navigation.php +21 -13
  8. components/related-posts/related-posts.php +14 -4
  9. includes/admin-style.css +8 -0
  10. includes/features/functions.php +108 -3
  11. includes/features/performance/performance-functions.php +71 -1
  12. includes/features/performance/performance-options.php +7 -0
  13. includes/options/admin-config.php +277 -46
  14. includes/options/redux-core/assets/css/import_export/import_export.css +0 -1
  15. includes/options/redux-core/assets/css/redux-admin.css +1 -1
  16. includes/options/redux-core/assets/js/vendor/spectrum/redux-spectrum.js +1 -0
  17. includes/options/redux-core/assets/js/vendor/spectrum/redux-spectrum.min.js +1 -1
  18. includes/options/redux-core/framework.php +1 -1
  19. includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.css +0 -1
  20. includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.js +3 -130
  21. includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.min.js +1 -1
  22. includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.php +28 -35
  23. includes/vendor/amp/includes/class-amp-post-template.php +8 -0
  24. includes/vendor/amp/includes/sanitizers/class-amp-allowed-tags-generated.php +31 -0
  25. includes/vendor/amp/includes/sanitizers/class-amp-iframe-sanitizer.php +1 -1
  26. includes/vendor/amp/includes/sanitizers/class-amp-tree-base-sanitizer.php +584 -0
  27. includes/vendor/amp/includes/sanitizers/class-amp-tree-style-sanitizer.php +2311 -0
  28. includes/vendor/css-parser/autoload.php +7 -0
  29. includes/vendor/css-parser/composer.json +5 -0
  30. includes/vendor/css-parser/composer.lock +63 -0
  31. includes/vendor/css-parser/composer/ClassLoader.php +445 -0
  32. includes/vendor/css-parser/composer/LICENSE +21 -0
  33. includes/vendor/css-parser/composer/autoload_classmap.php +9 -0
  34. includes/vendor/css-parser/composer/autoload_namespaces.php +10 -0
  35. includes/vendor/css-parser/composer/autoload_psr4.php +9 -0
  36. includes/vendor/css-parser/composer/autoload_real.php +52 -0
  37. includes/vendor/css-parser/composer/autoload_static.php +26 -0
  38. includes/vendor/css-parser/composer/installed.json +49 -0
  39. includes/vendor/css-parser/parser-helper-function.php +124 -0
  40. includes/vendor/css-parser/sabberworm/php-css-parser/.gitignore +1 -0
  41. includes/vendor/css-parser/sabberworm/php-css-parser/CHANGELOG.md +224 -0
  42. includes/vendor/css-parser/sabberworm/php-css-parser/Doxyfile +2310 -0
  43. includes/vendor/css-parser/sabberworm/php-css-parser/README.md +642 -0
  44. includes/vendor/css-parser/sabberworm/php-css-parser/composer.json +21 -0
  45. includes/vendor/css-parser/sabberworm/php-css-parser/composer.lock +1478 -0
  46. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php +50 -0
  47. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSBlockList.php +82 -0
  48. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php +359 -0
  49. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/Document.php +113 -0
  50. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/KeyFrame.php +56 -0
  51. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Comment/Comment.php +51 -0
  52. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Comment/Commentable.php +23 -0
  53. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/OutputFormat.php +322 -0
  54. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parser.php +41 -0
  55. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/OutputException.php +12 -0
  56. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/ParserState.php +310 -0
  57. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/SourceException.php +18 -0
  58. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php +31 -0
  59. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/AtRule.php +16 -0
  60. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/CSSNamespace.php +75 -0
  61. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Charset.php +66 -0
  62. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Import.php +69 -0
  63. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Selector.php +90 -0
  64. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Renderable.php +9 -0
  65. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Rule/Rule.php +236 -0
  66. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php +44 -0
  67. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php +658 -0
  68. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/RuleSet.php +212 -0
  69. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Settings.php +54 -0
  70. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CSSFunction.php +40 -0
  71. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CSSString.php +66 -0
  72. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CalcFunction.php +65 -0
  73. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CalcRuleValueList.php +14 -0
  74. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Color.php +95 -0
  75. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/LineName.php +41 -0
  76. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/PrimitiveValue.php +10 -0
  77. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/RuleValueList.php +9 -0
  78. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Size.php +122 -0
  79. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/URL.php +49 -0
  80. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Value.php +131 -0
  81. includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/ValueList.php +47 -0
  82. includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/AtRuleBlockListTest.php +27 -0
  83. includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/DocumentTest.php +26 -0
  84. includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php +170 -0
  85. includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/ParserTest.php +707 -0
  86. includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php +267 -0
  87. includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php +76 -0
  88. includes/vendor/css-parser/sabberworm/php-css-parser/tests/bootstrap.php +10 -0
  89. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-calc-no-space-around-minus.css +1 -0
  90. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-charset-after-rule.css +5 -0
  91. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-charset-in-block.css +3 -0
  92. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-empty-grid-linename.css +1 -0
  93. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-empty.css +0 -0
  94. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-end-token-2.css +1 -0
  95. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-end-token.css +1 -0
  96. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-fault-tolerance.css +15 -0
  97. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-tobedone.css +9 -0
  98. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/1readme.css +10 -0
  99. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/2readme.css +5 -0
  100. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/atrules.css +57 -0
  101. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/calc-nested.css +4 -0
  102. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/calc.css +6 -0
  103. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/case-insensitivity.css +15 -0
  104. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/colortest.css +12 -0
  105. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/comments.css +17 -0
  106. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/create-shorthands.css +6 -0
  107. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/docuwiki.css +1 -0
  108. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/empty-grid-linename.css +1 -0
  109. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/expand-shorthands.css +7 -0
  110. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/functions.css +21 -0
  111. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/grid-linename.css +2 -0
  112. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/hex-alpha.css +2 -0
  113. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/ie-hacks.css +9 -0
  114. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/ie.css +6 -0
  115. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/important.css +8 -0
  116. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/inner-color.css +3 -0
  117. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/line-numbers.css +32 -0
  118. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/missing-property-value.css +4 -0
  119. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/ms-filter.css +1 -0
  120. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/namespaces.css +18 -0
  121. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/nested.css +17 -0
  122. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/slashed.css +4 -0
  123. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/specificity.css +7 -0
  124. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/trailing-whitespace.css +2 -0
  125. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unicode-range.css +3 -0
  126. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unicode.css +12 -0
  127. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unmatched_braces.css +18 -0
  128. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unopened-close-brackets.css +3 -0
  129. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/url.css +4 -0
  130. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/values.css +14 -0
  131. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/webkit.css +1 -0
  132. includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/whitespace.css +3 -0
  133. includes/vendor/css-parser/sabberworm/php-css-parser/tests/quickdump.php +20 -0
  134. pagebuilder/amp-page-builder.php +7 -12
  135. pagebuilder/modules/feature-mod-module.php +27 -2
  136. readme.txt +36 -44
  137. templates/custom-amp-content.php +4 -9
  138. templates/design-manager/design-1/elements/content.php +17 -7
  139. templates/design-manager/design-1/elements/meta-info.php +8 -2
  140. templates/design-manager/design-1/elements/related-posts.php +13 -2
  141. templates/design-manager/design-1/style.php +10 -4
  142. templates/design-manager/design-2/elements/content.php +13 -5
  143. templates/design-manager/design-2/elements/meta-info.php +8 -2
  144. templates/design-manager/design-2/elements/related-posts.php +11 -3
  145. templates/design-manager/design-2/style.php +12 -3
  146. templates/design-manager/design-3/elements/content.php +6 -4
  147. templates/design-manager/design-3/elements/meta-info.php +10 -2
  148. templates/design-manager/design-3/elements/related-posts.php +11 -3
  149. templates/design-manager/design-3/single.php +38 -0
  150. templates/design-manager/design-3/style.php +18 -4
  151. templates/design-manager/swift/single.php +28 -8
  152. templates/design-manager/swift/style.php +13 -3
  153. templates/features.php +161 -132
  154. templates/template-mode/template-mode.php +12 -10
README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
- Stable tag: 0.9.98.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,6 +29,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
29
 
30
  * NEW - Gutenberg Support
31
  * NEW - Divi and Elementor Support [More Info](https://ampforwp.com/amp-pagebuilder-compatibility/)
 
32
  * NEW - Addthis Sharing Support
33
  * NEW - AMP Infinity Scroll Support
34
  * NEW - Revolution Slider plugin Support
@@ -125,6 +126,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
125
  == Credits ==
126
  Some code used in this plugin was forked from 'AMP for WordPress' plugin https://wordpress.org/plugins/amp/ - License URI: http://www.gnu.org/licenses/gpl-2.0.html.
127
  Mobile & Tablet detection library used https://github.com/serbanghita/Mobile-Detect - License URI: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
 
128
 
129
  == Installation ==
130
  **[Visit Help area for the Documentation:](https://ampforwp.com/help/)**
@@ -189,6 +191,39 @@ You can contact us from [here](https://ampforwp.com/contact/)
189
 
190
  == Changelog ==
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  = 0.9.98.8 (7th SEPTEMBER 2019) =
193
  * Improvements: AMP Option panel in mobile view #2603
194
  * Improvements: Need to make compatible with yoast seo primary category option #3551
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
+ Stable tag: 0.9.98.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  * NEW - Gutenberg Support
31
  * NEW - Divi and Elementor Support [More Info](https://ampforwp.com/amp-pagebuilder-compatibility/)
32
+ * NEW - Improved CSS Optimization (Tree Shaking)
33
  * NEW - Addthis Sharing Support
34
  * NEW - AMP Infinity Scroll Support
35
  * NEW - Revolution Slider plugin Support
126
  == Credits ==
127
  Some code used in this plugin was forked from 'AMP for WordPress' plugin https://wordpress.org/plugins/amp/ - License URI: http://www.gnu.org/licenses/gpl-2.0.html.
128
  Mobile & Tablet detection library used https://github.com/serbanghita/Mobile-Detect - License URI: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
129
+ PHP CSS Parser library used https://github.com/sabberworm/PHP-CSS-Parser - License URI: https://github.com/sabberworm/PHP-CSS-Parser#license (PHP-CSS-Parser is freely distributable under the terms of an MIT-style license.)
130
 
131
  == Installation ==
132
  **[Visit Help area for the Documentation:](https://ampforwp.com/help/)**
191
 
192
  == Changelog ==
193
 
194
+ = 0.9.98.9 (16th SEPTEMBER 2019) =
195
+
196
+ * Improvements: Need to implement Tree Shaking feature to remove access css from the AMP pages #2949
197
+ * Improvements: Need to save Post Meta Field Revisions in WordPress #3548
198
+ * Improvements: Add Role based Access to all the options #3480
199
+ * Improvements: Need to improve import/export option. #3364
200
+ * Improvements: Need to make compatibility with amp-connatix-player component #3524
201
+ * Improvements: "Recent Posts below related posts" feature need to implement for the design three #3531
202
+ * Improvements: Need to improve color picker library in AMP FOR WP Plugin #3461
203
+ * Improvements: Recent Posts below Related needs new options #3518
204
+ * Improvements: Excerpt length feature request for related post #2908
205
+ * Improvements: Need to add the option date below the content #3445
206
+ * Improvements: Need to hide time in traditional view option. #3453
207
+ * Improvements: Add feature to go to non AMP page on next and previous links #3253
208
+ * Improvements: Create a filter to Exclude Posts from Related Posts #3582
209
+ * Improvements: Need to add a filter to remove options in sidebar in AMP #3416
210
+ * Improvements: allow option to change the heading tag of Featured module #3560
211
+ * Improvements: AAWP plugin for AMP compatibility in Extension list #3591
212
+ * Fixed: Individual AMP Page (Bulk Edit) "hide by default" option not working #3610
213
+ * Fixed: In Recent Posts below Related need to add which present in below below related post #3596
214
+ * Fixed: Need to shift the Header Background Option and Header Elements option on top in Swift theme #3462
215
+ * Fixed: Need to add 'By Last X Days' option for "In-Content Related Posts" #3219
216
+ * Fixed: Need to add unique class name custom post type #3539
217
+ * Fixed: Need to add Convert AMP to WP theme (Beta) tutorial link in tooltip of this option #3552
218
+ * Fixed: Need to connect with Collapse references by default option of the footnotes plugin. #3586
219
+ * Fixed: Do not generate the AMPhtml for Woocommerce Account Page #3619
220
+ * Fixed: Need to place page builder in custom homepage even amp support is off on pages. #2914
221
+ * Fixed: Need to allow the user to navigate if user is using iframe #3601
222
+ * Fixed: Template mode: Need to changes/fixes #3590
223
+ * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
224
+ * Fixed: Improper amphtml on HomePage when WPML is activate #3341
225
+ * Fixed: The GDPR consent not working due to passed as string. #3658
226
+
227
  = 0.9.98.8 (7th SEPTEMBER 2019) =
228
  * Improvements: AMP Option panel in mobile view #2603
229
  * Improvements: Need to make compatible with yoast seo primary category option #3551
accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 0.9.98.8
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
- define('AMPFORWP_VERSION','0.9.98.8');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 0.9.98.9
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
+ define('AMPFORWP_VERSION','0.9.98.9');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
changelog.txt CHANGED
@@ -1,5 +1,38 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 0.9.98.8 (7th SEPTEMBER 2019) =
4
  * Improvements: AMP Option panel in mobile view #2603
5
  * Improvements: Need to make compatible with yoast seo primary category option #3551
1
  == Changelog ==
2
 
3
+ = 0.9.98.9 (16th SEPTEMBER 2019) =
4
+
5
+ * Improvements: Need to implement Tree Shaking feature to remove access css from the AMP pages #2949
6
+ * Improvements: Need to save Post Meta Field Revisions in WordPress #3548
7
+ * Improvements: Add Role based Access to all the options #3480
8
+ * Improvements: Need to improve import/export option. #3364
9
+ * Improvements: Need to make compatibility with amp-connatix-player component #3524
10
+ * Improvements: "Recent Posts below related posts" feature need to implement for the design three #3531
11
+ * Improvements: Need to improve color picker library in AMP FOR WP Plugin #3461
12
+ * Improvements: Recent Posts below Related needs new options #3518
13
+ * Improvements: Excerpt length feature request for related post #2908
14
+ * Improvements: Need to add the option date below the content #3445
15
+ * Improvements: Need to hide time in traditional view option. #3453
16
+ * Improvements: Add feature to go to non AMP page on next and previous links #3253
17
+ * Improvements: Create a filter to Exclude Posts from Related Posts #3582
18
+ * Improvements: Need to add a filter to remove options in sidebar in AMP #3416
19
+ * Improvements: allow option to change the heading tag of Featured module #3560
20
+ * Improvements: AAWP plugin for AMP compatibility in Extension list #3591
21
+ * Fixed: Individual AMP Page (Bulk Edit) "hide by default" option not working #3610
22
+ * Fixed: In Recent Posts below Related need to add which present in below below related post #3596
23
+ * Fixed: Need to shift the Header Background Option and Header Elements option on top in Swift theme #3462
24
+ * Fixed: Need to add 'By Last X Days' option for "In-Content Related Posts" #3219
25
+ * Fixed: Need to add unique class name custom post type #3539
26
+ * Fixed: Need to add Convert AMP to WP theme (Beta) tutorial link in tooltip of this option #3552
27
+ * Fixed: Need to connect with Collapse references by default option of the footnotes plugin. #3586
28
+ * Fixed: Do not generate the AMPhtml for Woocommerce Account Page #3619
29
+ * Fixed: Need to place page builder in custom homepage even amp support is off on pages. #2914
30
+ * Fixed: Need to allow the user to navigate if user is using iframe #3601
31
+ * Fixed: Template mode: Need to changes/fixes #3590
32
+ * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
33
+ * Fixed: Improper amphtml on HomePage when WPML is activate #3341
34
+ * Fixed: The GDPR consent not working due to passed as string. #3658
35
+
36
  = 0.9.98.8 (7th SEPTEMBER 2019) =
37
  * Improvements: AMP Option panel in mobile view #2603
38
  * Improvements: Need to make compatible with yoast seo primary category option #3551
components/components-core.php CHANGED
@@ -578,11 +578,17 @@ function amp_date( $args=array() ) {
578
  if ( 2 == ampforwp_get_setting('ampforwp-post-date-format') ) {
579
  $args = array('format' => 'traditional');
580
  }
581
- if ( (isset($args['format']) && $args['format'] == 'traditional') && 2 == ampforwp_get_setting('ampforwp-post-date-global') ) {
582
  $post_date = get_the_modified_date( get_option( 'date_format' )). ' '. get_the_modified_time();
583
  }
584
- elseif ( (isset($args['format']) && $args['format'] == 'traditional') || 'time' == $args ){
 
 
 
585
  $post_date = get_the_date(). ' '. get_the_time();
 
 
 
586
  }else{
587
  $post_date = human_time_diff(
588
  get_the_time('U', get_the_ID() ),
578
  if ( 2 == ampforwp_get_setting('ampforwp-post-date-format') ) {
579
  $args = array('format' => 'traditional');
580
  }
581
+ if ( true == ampforwp_get_setting('ampforwp-post-time') && (isset($args['format']) && $args['format'] == 'traditional') && 2 == ampforwp_get_setting('ampforwp-post-date-global') ) {
582
  $post_date = get_the_modified_date( get_option( 'date_format' )). ' '. get_the_modified_time();
583
  }
584
+ elseif ( false == ampforwp_get_setting('ampforwp-post-time') && (isset($args['format']) && $args['format'] == 'traditional') && 2 == ampforwp_get_setting('ampforwp-post-date-global') ){
585
+ $post_date = get_the_modified_date( get_option( 'date_format' ));
586
+ }
587
+ elseif ( true == ampforwp_get_setting('ampforwp-post-time') && (isset($args['format']) && $args['format'] == 'traditional') || 'time' == $args ){
588
  $post_date = get_the_date(). ' '. get_the_time();
589
+ }
590
+ elseif ( false == ampforwp_get_setting('ampforwp-post-time') ){
591
+ $post_date = get_the_date();
592
  }else{
593
  $post_date = human_time_diff(
594
  get_the_time('U', get_the_ID() ),
components/gdpr/gdpr.php CHANGED
@@ -258,6 +258,6 @@ function amp_consent_submission(){
258
  $site_url = parse_url( get_site_url() );
259
  $site_host = $site_url['host'];
260
  $amp_site = $site_url['scheme'] . '://' . $site_url['host'];
261
- header("AMP-Access-Control-Allow-Source-Origin: esc_url($amp_site) ");
262
- header("AMP-Redirect-To: esc_url($current_url) ");
263
- }
258
  $site_url = parse_url( get_site_url() );
259
  $site_host = $site_url['host'];
260
  $amp_site = $site_url['scheme'] . '://' . $site_url['host'];
261
+ header("AMP-Access-Control-Allow-Source-Origin: ".esc_url($amp_site));
262
+ header("AMP-Redirect-To: ".esc_url($current_url));
263
+ }
components/loop/loop.php CHANGED
@@ -362,7 +362,7 @@ function amp_loop_date($args=array()){
362
  $args['format'] = 'traditional';
363
  }
364
  if(isset($args['format']) && $args['format']=='traditional'){
365
- $post_date = get_the_date() . ' '. get_the_time();
366
  }else{
367
  $post_date = human_time_diff(
368
  get_the_time('U', get_the_ID() ),
@@ -405,9 +405,12 @@ function amp_loop_all_content($tag = 'p'){
405
 
406
  function amp_loop_permalink($return = ''){
407
  if (is_single() && ampforwp_get_setting('ampforwp-single-related-posts-link')) {
408
- return get_permalink();
 
 
409
  }
410
- return ampforwp_url_controller( get_permalink() ) ;
 
411
  }
412
 
413
  if (! function_exists('amp_loop_get_permalink')){
362
  $args['format'] = 'traditional';
363
  }
364
  if(isset($args['format']) && $args['format']=='traditional'){
365
+ $post_date = get_the_date();
366
  }else{
367
  $post_date = human_time_diff(
368
  get_the_time('U', get_the_ID() ),
405
 
406
  function amp_loop_permalink($return = ''){
407
  if (is_single() && ampforwp_get_setting('ampforwp-single-related-posts-link')) {
408
+ $url = get_permalink();
409
+ }else{
410
+ $url = ampforwp_url_controller( get_permalink() ) ;
411
  }
412
+ $url = apply_filters('ampforwp_loop_permalink_update',$url);
413
+ return $url;
414
  }
415
 
416
  if (! function_exists('amp_loop_get_permalink')){
components/post-navigation/post-navigation.php CHANGED
@@ -3,23 +3,31 @@ function ampforwp_framework_get_post_navigation(){
3
  global $redux_builder_amp;
4
  if($redux_builder_amp['enable-single-next-prev']) { ?>
5
  <div id="pagination">
6
- <?php $next_post = get_next_post();
7
- if (!empty( $next_post )) {
8
- $next_text = $next_post->post_title; ?>
9
  <div class="next">
10
- <a href="<?php echo ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"> <span><?php echo esc_html(ampforwp_translation($redux_builder_amp['amp-translator-next-text'], 'Next' )); ?></span><?php echo esc_html(apply_filters('ampforwp_next_link',$next_text )); ?> &raquo;</a>
 
 
 
 
 
 
 
 
11
  </div>
12
- <?php } ?>
13
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- <?php $prev_post = get_previous_post();
16
- if (!empty( $prev_post )) {
17
- $prev_text = $prev_post->post_title; ?>
18
- <div class="prev">
19
- <a href="<?php echo ampforwp_url_controller( get_permalink( $prev_post->ID ) ); ?>"> <span><?php echo esc_html(ampforwp_translation($redux_builder_amp['amp-translator-previous-text'], 'Previous' )); ?></span> &laquo; <?php echo esc_html(apply_filters('ampforwp_prev_link',$prev_text )); ?></a>
20
- </div>
21
- <?php } ?>
22
- <div class="clearfix"></div>
23
  </div>
24
  <?php }
25
  }
3
  global $redux_builder_amp;
4
  if($redux_builder_amp['enable-single-next-prev']) { ?>
5
  <div id="pagination">
 
 
 
6
  <div class="next">
7
+ <?php $next_post = get_next_post();
8
+ if (!empty( $next_post )) {
9
+ $next_text = $next_post->post_title;
10
+ $next_link = ampforwp_url_controller( get_permalink( $next_post->ID ));
11
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
12
+ $next_link = get_permalink( $next_post->ID );
13
+ } ?>
14
+ <a href="<?php echo esc_url($next_link); ?>"><span><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-next-text'), 'Next' ); ?></span><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
15
+ } ?>
16
  </div>
 
17
 
18
+ <div class="prev">
19
+ <?php $prev_post = get_previous_post();
20
+ if (!empty( $prev_post )) {
21
+ $prev_text = $prev_post->post_title;
22
+ $prev_link = ampforwp_url_controller( get_permalink( $prev_post->ID ));
23
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
24
+ $prev_link = get_permalink( $prev_post->ID );
25
+ } ?>
26
+ <a href="<?php echo esc_url($prev_link); ?>"><span><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-previous-text'), 'Previous' ); ?></span> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
27
+ } ?>
28
+ </div>
29
 
30
+ <div class="clearfix"></div>
 
 
 
 
 
 
 
31
  </div>
32
  <?php }
33
  }
components/related-posts/related-posts.php CHANGED
@@ -96,6 +96,7 @@ function ampforwp_related_post_loop_query(){
96
  )
97
  );
98
  }
 
99
  $my_query = new wp_query( $args );
100
 
101
  return $my_query;
@@ -174,10 +175,19 @@ function ampforwp_get_relatedpost_content($argsdata=array()){
174
  }else{
175
  $content = get_the_content();
176
  }
177
- ?><p><?php
178
- echo (wp_trim_words( strip_shortcodes( $content ) , 15 ));
179
- ?></p><?php
180
- }
 
 
 
 
 
 
 
 
 
181
  $show_author = (isset($argsdata['show_author'])? $argsdata['show_author'] : true);
182
  if($show_author){
183
  $author_args = isset($argsdata['author_args'])? $argsdata['author_args'] : array();
96
  )
97
  );
98
  }
99
+ $args = apply_filters('ampforwp_component_related_post_args' , $args );
100
  $my_query = new wp_query( $args );
101
 
102
  return $my_query;
175
  }else{
176
  $content = get_the_content();
177
  }
178
+ ?><p><?php $excerpt_length = ampforwp_get_setting('enable-excerpt-single-related-posts');
179
+ if(empty($excerpt_length)){
180
+ $excerpt_length = 15;
181
+ }
182
+ if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){
183
+ $content .= '...';
184
+ }
185
+ echo wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
186
+ ?>
187
+ <?php if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){?>
188
+ <a class="readmore-rp" href="<?php echo esc_url( $related_post_permalink ); ?>"><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-read-more'),'Read More') ?></a></p>
189
+ <?php
190
+ } }
191
  $show_author = (isset($argsdata['show_author'])? $argsdata['show_author'] : true);
192
  if($show_author){
193
  $author_args = isset($argsdata['author_args'])? $argsdata['author_args'] : array();
includes/admin-style.css CHANGED
@@ -941,4 +941,12 @@ font-weight: normal;
941
  padding: 8px 14px;
942
  margin-top: 7px;
943
  display: inline-block;
 
 
 
 
 
 
 
 
944
  }
941
  padding: 8px 14px;
942
  margin-top: 7px;
943
  display: inline-block;
944
+ }
945
+
946
+ #redux-import-file-type{
947
+ display: none;
948
+ }
949
+ #admin-import-file-name{
950
+ color:red;
951
+ font-weight: bold;
952
  }
includes/features/functions.php CHANGED
@@ -10,6 +10,12 @@ function ampforwp_include_aqresizer(){
10
  //Removed Jetpack Mobile theme option #2584
11
  remove_action('option_stylesheet', 'jetpack_mobile_stylesheet');
12
  require AMPFORWP_PLUGIN_DIR .'includes/vendor/aq_resizer.php';
 
 
 
 
 
 
13
  }
14
  // Some Extra Styling for Admin area
15
  add_action( 'admin_enqueue_scripts', 'ampforwp_add_admin_styling' );
@@ -170,8 +176,15 @@ function ampforwp_the_content_filter_full( $content_buffer ) {
170
  $content_buffer = preg_replace('/!important/', '' , $content_buffer);
171
  // Compatibility with the footnotes plugin. #2447
172
  if(class_exists('MCI_Footnotes')){
 
 
 
 
 
 
 
173
  $content_buffer = preg_replace( '/<sup(.*?)id="footnote_plugin_tooltip_(.*?)"(.*?)class="footnote_plugin_tooltip_text"(.*?)>(.*?)<\/sup>/m', '
174
- <sup$1id="footnote_plugin_tooltip_$2"$3class="footnote_plugin_tooltip_text"$4><a href="#footnote_plugin_reference_$2">$5</a></sup>', $content_buffer);
175
  }
176
  $content_buffer = apply_filters('ampforwp_the_content_last_filter', $content_buffer);
177
 
@@ -571,6 +584,7 @@ function ampforwp_url_purifier($url){
571
  $queried_var = "";
572
  $quried_value = "";
573
  $query_arg = "";
 
574
  $endpoint = AMPFORWP_AMP_QUERY_VAR;
575
  $get_permalink_structure = get_option('permalink_structure');
576
  $checker = $redux_builder_amp['amp-core-end-point'];
@@ -608,7 +622,87 @@ function ampforwp_url_purifier($url){
608
  if ( is_singular() && true == $checker ) {
609
  $url = untrailingslashit($url);
610
  }
611
- if ( is_home() || is_archive() || is_front_page() ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
612
  if ( ( is_archive() || is_home() ) && get_query_var('paged') > 1 ) {
613
  if ( true == $checker )
614
  $url = trailingslashit($url).$endpointq;
@@ -1064,4 +1158,15 @@ if( ! function_exists( 'ampforwp_additional_style_carousel_caption' ) ){
1064
  cursor: pointer; }
1065
  figcaption{ margin-bottom: 20px; }
1066
  <?php }
1067
- }
 
 
 
 
 
 
 
 
 
 
 
10
  //Removed Jetpack Mobile theme option #2584
11
  remove_action('option_stylesheet', 'jetpack_mobile_stylesheet');
12
  require AMPFORWP_PLUGIN_DIR .'includes/vendor/aq_resizer.php';
13
+ /*
14
+ Enable Treeshaking
15
+ */
16
+ if( ampforwp_get_setting('ampforwp_css_tree_shaking') ){
17
+ add_filter('ampforwp_the_content_last_filter','ampforwp_tree_shaking_purify_amphtml',11);
18
+ }
19
  }
20
  // Some Extra Styling for Admin area
21
  add_action( 'admin_enqueue_scripts', 'ampforwp_add_admin_styling' );
176
  $content_buffer = preg_replace('/!important/', '' , $content_buffer);
177
  // Compatibility with the footnotes plugin. #2447
178
  if(class_exists('MCI_Footnotes')){
179
+ $footnote_collapse_link = '';
180
+ $footnote_collapse = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE));
181
+ if( $footnote_collapse == true ){
182
+ $footnote_collapse_link = 'on="tap:footnote_references_container.show" role="click" tabindex="1" ';
183
+ $content_buffer = preg_replace( '/<div id=(.*?)footnote_references_container(.*?)\s/m','<div id=$1footnote_references_container$2 hidden ',$content_buffer);
184
+ $content_buffer = preg_replace( '/<div\s(.*?)<a\s(.*?)\+(.*)/m','<div $1 <a on="tap:footnote_references_container.show" $2 + <span on="tap:footnote_references_container.hide" id="fn_span" role="click" tabindex="2" > - </span> $3',$content_buffer);
185
+ }
186
  $content_buffer = preg_replace( '/<sup(.*?)id="footnote_plugin_tooltip_(.*?)"(.*?)class="footnote_plugin_tooltip_text"(.*?)>(.*?)<\/sup>/m', '
187
+ <sup$1id="footnote_plugin_tooltip_$2" '.$footnote_collapse_link.' $3class="footnote_plugin_tooltip_text"$4><a href="#footnote_plugin_reference_$2" id="fn_plugin_refer" >$5</a></sup>', $content_buffer);
188
  }
189
  $content_buffer = apply_filters('ampforwp_the_content_last_filter', $content_buffer);
190
 
584
  $queried_var = "";
585
  $quried_value = "";
586
  $query_arg = "";
587
+ $wpml_lang_checker = true;
588
  $endpoint = AMPFORWP_AMP_QUERY_VAR;
589
  $get_permalink_structure = get_option('permalink_structure');
590
  $checker = $redux_builder_amp['amp-core-end-point'];
622
  if ( is_singular() && true == $checker ) {
623
  $url = untrailingslashit($url);
624
  }
625
+ // WPML compatibility
626
+ if( class_exists('SitePress') ){
627
+ if( get_option('permalink_structure') ){
628
+ global $sitepress_settings, $wp;
629
+ $wpml_lang_checker = false;
630
+ if($sitepress_settings[ 'language_negotiation_type' ] == 3){
631
+ if( is_singular() ){
632
+ $active_langs = $sitepress_settings['active_languages'];
633
+ $found = '';
634
+ $wpml_url =get_permalink( get_queried_object_id() );
635
+ $untrail_wpml_url = untrailingslashit($wpml_url);
636
+ $explode_url = explode('/', $untrail_wpml_url);
637
+ $append_amp = AMPFORWP_AMP_QUERY_VAR;
638
+ foreach ($active_langs as $active_lang) {
639
+ foreach($explode_url as $a) {
640
+ if (stripos('?lang='.$active_lang ,$a) !== false){
641
+ $url = add_query_arg('amp','1',$wpml_url);
642
+ $found = 'found';
643
+ break 2;
644
+ }
645
+ }
646
+ }
647
+ if($found == ''){
648
+ array_splice( $explode_url, count($explode_url), 0, $append_amp );
649
+ $impode_url = implode('/', $explode_url);
650
+ $url = untrailingslashit($impode_url);
651
+ }
652
+ }
653
+ if ( is_home() || is_archive() ){
654
+ global $wp;
655
+ $current_archive_url = home_url( $wp->request );
656
+ $explode_path = explode("/",$current_archive_url);
657
+ $inserted = array(AMPFORWP_AMP_QUERY_VAR);
658
+ $query_arg_array = $wp->query_vars;
659
+ if( array_key_exists( 'paged' , $query_arg_array ) ) {
660
+ $active_langs = $sitepress_settings['active_languages'];
661
+ $found = '';
662
+ foreach ($active_langs as $active_lang) {
663
+
664
+ foreach($explode_path as $a) {
665
+ if (stripos('?lang='.$active_lang ,$a) !== false){
666
+ $url = add_query_arg('amp','1',$current_archive_url);
667
+ $found = 'found';
668
+ break 2;
669
+ }
670
+ }
671
+ }
672
+ if($found == ''){
673
+ array_splice( $explode_path, count($explode_path), 0, $inserted );
674
+ $impode_url = implode('/', $explode_path);
675
+ $url = $impode_url;
676
+
677
+ }
678
+ }
679
+ else{
680
+ $active_langs = $sitepress_settings['active_languages'];
681
+ $found = '';
682
+ foreach ($active_langs as $active_lang) {
683
+
684
+ foreach($explode_path as $a) {
685
+ if (stripos('?lang='.$active_lang ,$a) !== false){
686
+ $url = add_query_arg('amp','1',$current_archive_url);
687
+ $found = 'found';
688
+ break 2;
689
+ }
690
+ }
691
+ }
692
+ if($found == ''){
693
+ array_splice( $explode_path, count($explode_path), 0, $inserted );
694
+ $impode_url = implode('/', $explode_path);
695
+ $url = $impode_url;
696
+
697
+ }
698
+ }
699
+ }
700
+ }else{
701
+ $wpml_lang_checker = true;
702
+ }
703
+ }
704
+ }
705
+ if ( true == $wpml_lang_checker && ( is_home() || is_archive() || is_front_page() ) ) {
706
  if ( ( is_archive() || is_home() ) && get_query_var('paged') > 1 ) {
707
  if ( true == $checker )
708
  $url = trailingslashit($url).$endpointq;
1158
  cursor: pointer; }
1159
  figcaption{ margin-bottom: 20px; }
1160
  <?php }
1161
+ }
1162
+
1163
+ function ampforwp_role_based_access_options(){
1164
+ $currentUser = wp_get_current_user();
1165
+ $amp_roles = ampforwp_get_setting('ampforwp-role-based-access');
1166
+ $currentuserrole = (array) $currentUser->roles;
1167
+ $hasrole = array_intersect( $currentuserrole, $amp_roles );
1168
+ if( empty($hasrole)){
1169
+ return false;
1170
+ }
1171
+ return true;
1172
+ }
includes/features/performance/performance-functions.php CHANGED
@@ -179,4 +179,74 @@ function ampforwp_code_to_add_in_htaccess(){
179
  $htaccess_cntn .= '</IfModule>' . "\n";
180
  $htaccess_cntn .= '# END Caching AMPFORWPLBROWSERCEND' . "\n";
181
  return $htaccess_cntn;
182
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  $htaccess_cntn .= '</IfModule>' . "\n";
180
  $htaccess_cntn .= '# END Caching AMPFORWPLBROWSERCEND' . "\n";
181
  return $htaccess_cntn;
182
+ }
183
+
184
+ // Tree shaking feature #2949 --- starts here ---
185
+ if( !function_exists("ampforwp_tree_shaking_purify_amphtml") ){
186
+ function ampforwp_tree_shaking_purify_amphtml($completeContent){
187
+
188
+ if( function_exists('amp_pagebuilder_compatibility_init') ){
189
+ // compatibility with AMP Pagebuilder Compatibility
190
+ return $completeContent;
191
+ }
192
+ //for fonts
193
+ $completeContent = str_replace(array('"\\', "'\\"), array('":backSlash:',"':backSlash:"), $completeContent);
194
+ /***Replacements***/
195
+ if(!empty($completeContent)){
196
+ $tmpDoc = new DOMDocument();
197
+ libxml_use_internal_errors(true);
198
+ $tmpDoc->loadHTML($completeContent);
199
+ // AMP_treeshaking_Style_Sanitizer class is added in the vendor/amp/includes/sanitizers
200
+ if( AMPforWP\AMPVendor\AMP_treeshaking_Style_Sanitizer::has_required_php_css_parser()){
201
+ $sheet = '';
202
+
203
+ $arg['allow_dirty_styles'] = false;
204
+ $obj = new AMPforWP\AMPVendor\AMP_treeshaking_Style_Sanitizer($tmpDoc, $arg);
205
+ $datatrack = $obj->sanitize();
206
+ // return json_encode($datatrack);
207
+
208
+ $data = $obj->get_stylesheets();
209
+ //return json_encode($data);
210
+
211
+ $comment = $obj->get_comments();
212
+ //return json_encode($comment);
213
+
214
+ foreach($data as $styles){
215
+ $sheet .= $styles;
216
+ }
217
+ $sheet = stripcslashes($sheet);
218
+ if(strpos($sheet, '-keyframes')!==false){
219
+ $sheet = preg_replace("/@(-o-|-moz-|-webkit-|-ms-)*keyframes\s(.*?){([0-9%a-zA-Z,\s.]*{(.*?)})*[\s\n]*}/s", "", $sheet);
220
+ }
221
+ $completeContent = preg_replace("/<style\samp-custom>(.*?)<\/style>/s", "".$comment."<style amp-custom>".$sheet."</style>", $completeContent);
222
+ $completeContent = apply_filters("ampforwp_tree_shaking_add_css", $completeContent);
223
+ }
224
+
225
+ }
226
+ //for fonts
227
+ $completeContent = str_replace(array('":backSlash:', "':backSlash:"), array('"\\', "'\\"), $completeContent);
228
+
229
+ return $completeContent;
230
+ }
231
+ }
232
+
233
+
234
+ add_action( 'redux/options/redux_builder_amp/saved', 'ampforwp_clear_tree_shaking',10,2);
235
+ function ampforwp_clear_tree_shaking($options, $changed_values){
236
+ if( ( isset($changed_values['ampforwp_css_tree_shaking']) && $options['ampforwp_css_tree_shaking']=='0' ) || isset($changed_values['amp-design-selector']) || isset($changed_values['css_editor']) ){
237
+ $upload_dir = wp_upload_dir();
238
+ $user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-tree-shaking';
239
+ if(file_exists($user_dirname)){
240
+ $files = glob($user_dirname . '/*');
241
+ //Loop through the file list.
242
+ foreach($files as $file){
243
+ //Make sure that this is a file and not a directory.
244
+ if(is_file($file) && strpos($file, '_transient')!==false ){
245
+ //Use the unlink function to delete the file.
246
+ unlink($file);
247
+ }
248
+ }
249
+ }
250
+ }
251
+ }
252
+ // Tree shaking feature #2949 --- ends here ---
includes/features/performance/performance-options.php CHANGED
@@ -70,6 +70,13 @@ use ReduxCore\ReduxFramework\Redux;
70
  'title' => esc_html__('Leverage Browser Caching', 'accelerated-mobile-pages'),
71
  'tooltip-subtitle' => esc_html__('Improve the Page Speed and Loading time with Leverage Browser Caching option', 'accelerated-mobile-pages'),
72
  'default' => 0
 
 
 
 
 
 
 
73
  )
74
  )
75
 
70
  'title' => esc_html__('Leverage Browser Caching', 'accelerated-mobile-pages'),
71
  'tooltip-subtitle' => esc_html__('Improve the Page Speed and Loading time with Leverage Browser Caching option', 'accelerated-mobile-pages'),
72
  'default' => 0
73
+ ),
74
+ array(
75
+ 'id' => 'ampforwp_css_tree_shaking',
76
+ 'type' => 'switch',
77
+ 'title' => esc_html__('Optimize CSS (beta)', 'accelerated-mobile-pages'),
78
+ 'tooltip-subtitle' => esc_html__('Improve size of the CSS and Page Speed with Tree Shaking Feature,', 'accelerated-mobile-pages'),
79
+ 'default' => 0
80
  )
81
  )
82
 
includes/options/admin-config.php CHANGED
@@ -536,6 +536,17 @@ $extension_listing_array = array(
536
  'store_url'=>'https://accounts.ampforwp.com',
537
  'is_activated'=>(is_plugin_active('table-of-content-plus-for-amp/table-of-content-plus-for-amp.php')? 1 : 2),
538
  ),
 
 
 
 
 
 
 
 
 
 
 
539
  );
540
  $viewAllExtensions = array(
541
  'name'=>'View All Extensions',
@@ -1181,6 +1192,19 @@ if($ampforwp_nameOfUser!=""){
1181
  if(function_exists('amp_activate') ){
1182
  $proDetailsProvide = "<a class='premium_features_btn_txt' href=\"#\"> AMP by Automattic compatibility has been activated</a>";
1183
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1184
  $args = array(
1185
  // TYPICAL -> Change these values as you need/desire
1186
  'opt_name' => 'redux_builder_amp', // This is where your data is stored in the database and also becomes your global variable name.
@@ -1201,7 +1225,7 @@ $args = array(
1201
  // OPTIONAL -> Give you extra features
1202
  'page_priority' => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
1203
  'page_parent' => 'themes.php', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
1204
- 'page_permissions' => 'manage_options', // Permissions needed to access the options panel.
1205
  'last_tab' => '', // Force your panel to always open to a specific tab (by id)
1206
  'page_icon' => 'icon-themes', // Icon displayed in the admin panel next to your menu_title
1207
  'page_slug' => 'amp_options', // Page slug used to denote the panel
@@ -1354,6 +1378,32 @@ Redux::setArgs( "redux_builder_amp", $args );
1354
  'options' => ampforwp_get_cpt_generated_post_types(),
1355
  );
1356
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1357
  function ampforwp_get_generated_custom_taxonomies(){
1358
  $taxonomies = '';
1359
  $taxonomies = get_transient('ampforwp_get_taxonomies');
@@ -1371,6 +1421,10 @@ Redux::setArgs( "redux_builder_amp", $args );
1371
  'options' => ampforwp_get_generated_custom_taxonomies(),
1372
  );
1373
  }
 
 
 
 
1374
  // AMP to WP Default value
1375
  function ampforwp_amp2wp_default(){
1376
  $default = 0;
@@ -2368,7 +2422,7 @@ Redux::setSection( $opt_name, array(
2368
  'id' => 'ampforwp-amp-convert-to-wp',
2369
  'type' => 'switch',
2370
  'title' => esc_html__('Convert AMP to WP theme (Beta)', 'accelerated-mobile-pages'),
2371
- 'tooltip-subtitle' => esc_html__('It makes your AMP & Non-AMP Same! (AMP will output AMP Compatible code, while WordPress will have the WP code but with the same design)', 'accelerated-mobile-pages'),
2372
  'default' => ampforwp_amp2wp_default(),
2373
  'required' => array('amp-design-selector', '=' , '4'),
2374
  ),
@@ -2543,6 +2597,16 @@ Redux::setSection( $opt_name, array(
2543
  'false' => 'false',
2544
  'default' => 0
2545
  ),
 
 
 
 
 
 
 
 
 
 
2546
  // Delete Data on Deletion
2547
  array(
2548
  'id' => 'ampforwp-delete-on-uninstall',
@@ -2875,6 +2939,14 @@ $e_commerce_support[] = array(
2875
  'placeholder'=>esc_html__('write here','accelerated-mobile-pages'),
2876
  'required' => array( 'amp-use-pot', '=' , 0 )
2877
  ),
 
 
 
 
 
 
 
 
2878
  array(
2879
  'id' => 'amp-translator-modified-date-text',
2880
  'type' => 'text',
@@ -4272,13 +4344,10 @@ Redux::setSection( $opt_name, array(
4272
  array(
4273
  'id' => 'header_design_section',
4274
  'type' => 'section',
4275
- 'title' => __('Header Designs Options', 'accelerated-mobile-pages'),
4276
  'indent' => true,
4277
  'layout_type' => 'accordion',
4278
  'accordion-open'=> 1,
4279
- 'required' => array(
4280
- array('amp-design-selector', '!=' , '4')
4281
- )
4282
  ),
4283
  // Design 1 Fields
4284
  array(
@@ -4349,6 +4418,26 @@ Redux::setSection( $opt_name, array(
4349
  array('amp-design-selector', '=' , '3')
4350
  )
4351
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4352
  // Tab 1 end
4353
  // Tab 2
4354
  array(
@@ -4485,20 +4574,6 @@ Redux::setSection( $opt_name, array(
4485
  array('border-line','=',1)
4486
  )
4487
  ),
4488
-
4489
-
4490
- array(
4491
- 'class' => 'child_opt',
4492
- 'id' => 'swift-background-scheme',
4493
- 'title' => esc_html__('Header Background', 'accelerated-mobile-pages'),
4494
- 'type' => 'color_rgba',
4495
- 'default' => array(
4496
- 'rgba' => 'rgba(255, 255, 255, 255)',
4497
- ),
4498
- 'required' => array(
4499
- array('customize-options','=',1)
4500
- )
4501
- ),
4502
  array(
4503
  'class' => 'child_opt',
4504
  'id' => 'swift-header-overlay',
@@ -4511,19 +4586,6 @@ Redux::setSection( $opt_name, array(
4511
  array('customize-options','=',1)
4512
  )
4513
  ),
4514
- array(
4515
- 'class' => 'child_opt',
4516
- 'id' => 'swift-element-color-control',
4517
- 'title' => esc_html__('Header Elements', 'accelerated-mobile-pages'),
4518
- 'tooltip-subtitle' => esc_html__('Color of the Text and Icons on top of Header','accelerated-mobile-pages'),
4519
- 'type' => 'color_rgba',
4520
- 'default' => array(
4521
- 'color' => '#333',
4522
- ),
4523
- 'required' => array(
4524
- array('customize-options','=',1)
4525
- )
4526
- ),
4527
  array(
4528
  'class' => 'child_opt',
4529
  'id' => 'swift-element-overlay-color-control',
@@ -5137,7 +5199,15 @@ $single_page_options = array(
5137
  'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
5138
  esc_html__('Enable this option to show next and previous links in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-next-previous-links-in-single-page/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5139
 
5140
- ),
 
 
 
 
 
 
 
 
5141
  // Author Bio
5142
  array(
5143
  'id' => 'amp-author-description',
@@ -5222,6 +5292,41 @@ $single_page_options = array(
5222
  'tooltip-subtitle' => esc_html__('Enable this option to show data below each post of Recent post loop'),
5223
  'required' => array('ampforwp-swift-recent-posts' , '=' , '1'),
5224
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5225
  array(
5226
  'id' => 'ampforwp-single_section_3',
5227
  'type' => 'section',
@@ -5301,6 +5406,38 @@ $single_page_options = array(
5301
  array('ampforwp-single-related-posts-switch', '=' , '1')
5302
  ),
5303
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5304
  array(
5305
  'id' => 'ampforwp-single-related-posts-link',
5306
  'type' => 'switch',
@@ -5354,6 +5491,42 @@ $single_page_options = array(
5354
  array('ampforwp-related-posts-days-switch', '=' , '1'),
5355
  ),
5356
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5357
  array(
5358
  'id' => 'ampforwp-inline-related-posts',
5359
  'type' => 'switch',
@@ -5413,6 +5586,24 @@ $single_page_options = array(
5413
  'default' => '3',
5414
  'required' => array( array('ampforwp-inline-related-posts', '=' , '1'),array('ampforwp-inline-related-posts-display-type', '=' , 'paragraphs') ),
5415
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5416
  array(
5417
  'id' => 'single-tab-2',
5418
  'type' => 'section',
@@ -5431,6 +5622,15 @@ $single_page_options = array(
5431
  esc_html__('Enable this option to show lightbox for images in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-lightbox-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5432
 
5433
  ),
 
 
 
 
 
 
 
 
 
5434
  // Dropcap
5435
  array(
5436
  'id' => 'ampforwp-dropcap',
@@ -7117,7 +7317,16 @@ else{
7117
  'id' => 'ampforwp-date-section',
7118
  'subsection' => true,
7119
  'fields' => array(
7120
- // Date on Single Design 3
 
 
 
 
 
 
 
 
 
7121
  array(
7122
  'id' => 'amp-design-3-date-feature',
7123
  'type' => 'switch',
@@ -7128,14 +7337,6 @@ else{
7128
  'tooltip-subtitle' => esc_html__('Display date along with author and category in posts', 'accelerated-mobile-pages' ),
7129
  'default' => '0'
7130
  ),
7131
- array(
7132
- 'id' => 'date-tab-1',
7133
- 'type' => 'section',
7134
- 'title' => esc_html__('General', 'accelerated-mobile-pages'),
7135
- 'indent' => true,
7136
- 'layout_type' => 'accordion',
7137
- 'accordion-open'=> 1,
7138
- ),
7139
  // Show Date As
7140
  array(
7141
  'id' => 'ampforwp-post-date-global',
@@ -7167,14 +7368,44 @@ else{
7167
  'required' => array( array('ampforwp-post-date-format', '=', '1') ),
7168
  'default' =>'% days ago',
7169
  ),
 
 
 
 
 
 
 
 
7170
  // Post Modified Date
7171
- array(
7172
  'id' => 'post-modified-date',
7173
  'type' => 'switch',
7174
- 'title' => esc_html__('Modified Date Notice', 'accelerated-mobile-pages'),
7175
  'default' => 0,
7176
  'tooltip-subtitle' => esc_html__('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
7177
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7178
  )
7179
 
7180
  ) );
536
  'store_url'=>'https://accounts.ampforwp.com',
537
  'is_activated'=>(is_plugin_active('table-of-content-plus-for-amp/table-of-content-plus-for-amp.php')? 1 : 2),
538
  ),
539
+ array(
540
+ 'name'=>'AAWP for AMP',
541
+ 'desc'=>'Automatically Adds Amazon Affiliates Compatibility to your AMP version',
542
+ 'img_src'=> AMPFORWP_IMAGE_DIR . '/click.png',
543
+ 'price'=>'$39',
544
+ 'url_link'=>'http://ampforwp.com/addons/aawp-for-amp/',
545
+ 'plugin_active_path'=> 'aawp-for-amp/aawp-for-amp.php',
546
+ 'item_name'=>'AAWP for AMP',
547
+ 'store_url'=>'https://accounts.ampforwp.com',
548
+ 'is_activated'=>(function_exists('aawp_for_amp_plugin_updater')? 1 : 2),
549
+ ),
550
  );
551
  $viewAllExtensions = array(
552
  'name'=>'View All Extensions',
1192
  if(function_exists('amp_activate') ){
1193
  $proDetailsProvide = "<a class='premium_features_btn_txt' href=\"#\"> AMP by Automattic compatibility has been activated</a>";
1194
  }
1195
+
1196
+ $user = wp_get_current_user();
1197
+ $permissions = "manage_options";
1198
+ $amp_access = ampforwp_get_setting('ampforwp-role-based-access');
1199
+
1200
+ if( in_array( 'administrator', $user->roles ) ) {
1201
+ $permissions = "manage_options";
1202
+ }elseif( in_array( 'editor', $user->roles ) && in_array('editor', $amp_access) ){
1203
+ $permissions = 'edit_pages';
1204
+ }elseif( in_array( 'author', $user->roles ) && in_array('author', $amp_access)){
1205
+ $permissions = 'edit_posts';
1206
+ }
1207
+
1208
  $args = array(
1209
  // TYPICAL -> Change these values as you need/desire
1210
  'opt_name' => 'redux_builder_amp', // This is where your data is stored in the database and also becomes your global variable name.
1225
  // OPTIONAL -> Give you extra features
1226
  'page_priority' => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
1227
  'page_parent' => 'themes.php', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
1228
+ 'page_permissions' => $permissions, // Permissions needed to access the options panel.
1229
  'last_tab' => '', // Force your panel to always open to a specific tab (by id)
1230
  'page_icon' => 'icon-themes', // Icon displayed in the admin panel next to your menu_title
1231
  'page_slug' => 'amp_options', // Page slug used to denote the panel
1378
  'options' => ampforwp_get_cpt_generated_post_types(),
1379
  );
1380
  }
1381
+ function ampforwp_get_user_roles(){
1382
+ global $wp_roles;
1383
+ $allroles = array();
1384
+ foreach ( $wp_roles->roles as $key=>$value ){
1385
+ $allroles[esc_attr($key)] = esc_html($value['name']);
1386
+ }
1387
+ return $allroles;
1388
+ }
1389
+ function ampforwp_default_user_roles(){
1390
+ $roles = '';
1391
+ $metabox_access = ampforwp_get_setting('amp-meta-permissions');
1392
+ if($metabox_access == 'admin'){
1393
+ if(empty(ampforwp_get_setting('ampforwp-role-based-access'))){
1394
+ $roles = array('administrator');
1395
+ }else{
1396
+ $roles = ampforwp_get_setting('ampforwp-role-based-access');
1397
+ }
1398
+ }else{
1399
+ if(empty(ampforwp_get_setting('ampforwp-role-based-access'))){
1400
+ $roles = array('administrator','editor');
1401
+ }else{
1402
+ $roles = ampforwp_get_setting('ampforwp-role-based-access');
1403
+ }
1404
+ }
1405
+ return $roles;
1406
+ }
1407
  function ampforwp_get_generated_custom_taxonomies(){
1408
  $taxonomies = '';
1409
  $taxonomies = get_transient('ampforwp_get_taxonomies');
1421
  'options' => ampforwp_get_generated_custom_taxonomies(),
1422
  );
1423
  }
1424
+ $show_for_admin = '';
1425
+ if(!current_user_can('administrator') ){
1426
+ $show_for_admin = 'hide';
1427
+ }
1428
  // AMP to WP Default value
1429
  function ampforwp_amp2wp_default(){
1430
  $default = 0;
2422
  'id' => 'ampforwp-amp-convert-to-wp',
2423
  'type' => 'switch',
2424
  'title' => esc_html__('Convert AMP to WP theme (Beta)', 'accelerated-mobile-pages'),
2425
+ 'tooltip-subtitle' => sprintf( '%s<a href="%s" target="_blank">%s</a>%s', esc_html__("It makes your AMP & Non-AMP Same! (AMP will output AMP Compatible code, while WordPress will have the WP code but with the same design and ",'accelerated-mobile-pages'),esc_url('https://ampforwp.com/tutorials/article/how-to-convert-your-non-amp-website-to-amp/'),esc_html__('Click Here','accelerated-mobile-pages'),esc_html__(' for more info','accelerated-mobile-pages')),
2426
  'default' => ampforwp_amp2wp_default(),
2427
  'required' => array('amp-design-selector', '=' , '4'),
2428
  ),
2597
  'false' => 'false',
2598
  'default' => 0
2599
  ),
2600
+ array(
2601
+ 'id' => 'ampforwp-role-based-access',
2602
+ 'type' => 'select',
2603
+ 'class' => $show_for_admin,
2604
+ 'title' => esc_html__('Role Based Access', 'accelerated-mobile-pages'),
2605
+ 'tooltip-subtitle' => esc_html__('Allows Administrator to show AMP Options based on User Role.', 'accelerated-mobile-pages'),
2606
+ 'multi' => true,
2607
+ 'options' => ampforwp_get_user_roles(),
2608
+ 'default' => ampforwp_default_user_roles()
2609
+ ),
2610
  // Delete Data on Deletion
2611
  array(
2612
  'id' => 'ampforwp-delete-on-uninstall',
2939
  'placeholder'=>esc_html__('write here','accelerated-mobile-pages'),
2940
  'required' => array( 'amp-use-pot', '=' , 0 )
2941
  ),
2942
+ array(
2943
+ 'id' => 'amp-translator-published-date-text',
2944
+ 'type' => 'text',
2945
+ 'title' => esc_html__('This post was published on ', 'accelerated-mobile-pages'),
2946
+ 'default' => esc_html__('This post was published on ','accelerated-mobile-pages'),
2947
+ 'placeholder'=> esc_html__('write here','accelerated-mobile-pages'),
2948
+ 'required' => array( 'amp-use-pot', '=' , 0 )
2949
+ ),
2950
  array(
2951
  'id' => 'amp-translator-modified-date-text',
2952
  'type' => 'text',
4344
  array(
4345
  'id' => 'header_design_section',
4346
  'type' => 'section',
4347
+ 'title' => esc_html__('Header Design Options', 'accelerated-mobile-pages'),
4348
  'indent' => true,
4349
  'layout_type' => 'accordion',
4350
  'accordion-open'=> 1,
 
 
 
4351
  ),
4352
  // Design 1 Fields
4353
  array(
4418
  array('amp-design-selector', '=' , '3')
4419
  )
4420
  ),
4421
+ // Design 4 Fields
4422
+ array(
4423
+ 'id' => 'swift-background-scheme',
4424
+ 'title' => esc_html__('Header Background', 'accelerated-mobile-pages'),
4425
+ 'type' => 'color_rgba',
4426
+ 'default' => array(
4427
+ 'color' => '#fff',
4428
+ ),
4429
+ 'required' => array('header-type', '<' , '8')
4430
+ ),
4431
+ array(
4432
+ 'id' => 'swift-element-color-control',
4433
+ 'title' => esc_html__('Header Elements', 'accelerated-mobile-pages'),
4434
+ 'tooltip-subtitle' => esc_html__('Color of the Text and Icons on top of Header','accelerated-mobile-pages'),
4435
+ 'type' => 'color_rgba',
4436
+ 'default' => array(
4437
+ 'color' => '#333',
4438
+ ),
4439
+ 'required' => array('header-type', '<' , '8')
4440
+ ),
4441
  // Tab 1 end
4442
  // Tab 2
4443
  array(
4574
  array('border-line','=',1)
4575
  )
4576
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4577
  array(
4578
  'class' => 'child_opt',
4579
  'id' => 'swift-header-overlay',
4586
  array('customize-options','=',1)
4587
  )
4588
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
4589
  array(
4590
  'class' => 'child_opt',
4591
  'id' => 'swift-element-overlay-color-control',
5199
  'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
5200
  esc_html__('Enable this option to show next and previous links in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-next-previous-links-in-single-page/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5201
 
5202
+ ),
5203
+ array(
5204
+ 'id' => 'single-next-prev-to-nonamp',
5205
+ 'type' => 'switch',
5206
+ 'class' => 'child_opt child_opt_arrow',
5207
+ 'title' => esc_html__('Link to Non-AMP page', 'accelerated-mobile-pages'),
5208
+ 'default' => 0,
5209
+ 'required' => array('enable-single-next-prev' , '=' , '1')
5210
+ ),
5211
  // Author Bio
5212
  array(
5213
  'id' => 'amp-author-description',
5292
  'tooltip-subtitle' => esc_html__('Enable this option to show data below each post of Recent post loop'),
5293
  'required' => array('ampforwp-swift-recent-posts' , '=' , '1'),
5294
  ),
5295
+ array(
5296
+ 'id' => 'amforwp-recentpost-image-switch',
5297
+ 'type' => 'switch',
5298
+ 'class' => 'child_opt child_opt_arrow',
5299
+ 'title' => esc_html__('Image', 'accelerated-mobile-pages'),
5300
+ 'default' => 1,
5301
+ 'tooltip-subtitle' => esc_html__('Enable this option to show image for each post of Recent post loop'),
5302
+ 'required' => array('ampforwp-swift-recent-posts' , '=' , '1'),
5303
+ ),
5304
+ array(
5305
+ 'id' => 'amforwp-recentpost-excerpt-switch',
5306
+ 'type' => 'switch',
5307
+ 'class' => 'child_opt child_opt_arrow',
5308
+ 'title' => esc_html__('Excerpt', 'accelerated-mobile-pages'),
5309
+ 'default' => 1,
5310
+ 'tooltip-subtitle' => esc_html__('Enable this option to show excerpt for each post of Recent post loop'),
5311
+ 'required' => array('ampforwp-swift-recent-posts' , '=' , '1'),
5312
+ ),
5313
+ array(
5314
+ 'id' => 'ampforwp-recentpost-posts-link',
5315
+ 'type' => 'switch',
5316
+ 'class' => 'child_opt',
5317
+ 'title' => esc_html__('Link to Non-AMP', 'accelerated-mobile-pages'),
5318
+ 'default' => 0,
5319
+ 'required' => array('ampforwp-swift-recent-posts' , '=' , '1'),
5320
+ ),
5321
+ array(
5322
+ 'id' => 'ampforwp-number-of-recent-posts',
5323
+ 'type' => 'text',
5324
+ 'class' => 'child_opt',
5325
+ 'title' => esc_html__('Number of Recent Post', 'accelerated-mobile-pages'),
5326
+ 'validate' => 'numeric',
5327
+ 'default' => '6',
5328
+ 'required' => array('ampforwp-swift-recent-posts' , '=' , '1'),
5329
+ ),
5330
  array(
5331
  'id' => 'ampforwp-single_section_3',
5332
  'type' => 'section',
5406
  array('ampforwp-single-related-posts-switch', '=' , '1')
5407
  ),
5408
  ),
5409
+ // Excerpt ON/OFF of Related Posts
5410
+ array(
5411
+ 'id' => 'enable-excerpt-single-related-posts',
5412
+ 'type' => 'text',
5413
+ 'class' => 'child_opt',
5414
+ 'title' => esc_html__('Excerpt Length', 'accelerated-mobile-pages'),
5415
+ 'default' => 15,
5416
+ 'tooltip-subtitle' => esc_html__('Excerpt will be displayed on related posts', 'accelerated-mobile-pages'),
5417
+ 'required' => array(
5418
+ array('ampforwp-single-related-posts-excerpt', '=' , '1') ),
5419
+ ),
5420
+ array(
5421
+ 'id' => 'excerpt-option-small-rp',
5422
+ 'class' => 'child_opt',
5423
+ 'type' => 'switch',
5424
+ 'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
5425
+ 'default' => '0',
5426
+ 'required' => array(
5427
+ array('amp-design-selector', '!=' , '4'),
5428
+ array('ampforwp-single-related-posts-excerpt', '=' , '1'),
5429
+ )
5430
+ ),
5431
+ array(
5432
+ 'id' => 'excerpt-option-rp-read-more',
5433
+ 'class' => 'child_opt',
5434
+ 'type' => 'switch',
5435
+ 'title' => esc_html__('Read More Link', 'accelerated-mobile-pages'),
5436
+ 'default' => '0',
5437
+ 'required' => array(
5438
+ array('ampforwp-single-related-posts-excerpt', '=' , '1'),
5439
+ )
5440
+ ),
5441
  array(
5442
  'id' => 'ampforwp-single-related-posts-link',
5443
  'type' => 'switch',
5491
  array('ampforwp-related-posts-days-switch', '=' , '1'),
5492
  ),
5493
  ),
5494
+ // DESIGN 3 RECENT POST BELOW RELATED
5495
+ array(
5496
+ 'id' => 'ampforwp-design3-recent-posts',
5497
+ 'type' => 'switch',
5498
+ 'title' => esc_html__('Recent Posts below Related', 'accelerated-mobile-pages'),
5499
+ 'tooltip-subtitle' => sprintf('%s <a href="%s" target="_blank">%s</a> %s',
5500
+ esc_html__('Enable this option to show recent posts in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-recent-posts-below-related-in-single-page/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5501
+ 'default' => 0,
5502
+ 'required' => array('amp-design-selector' , '=' , '3'),
5503
+ ),
5504
+ array(
5505
+ 'id' => 'amforwp-design3-recentpost-date-switch',
5506
+ 'type' => 'switch',
5507
+ 'class' => 'child_opt child_opt_arrow',
5508
+ 'title' => esc_html__('Recent Posts Date', 'accelerated-mobile-pages'),
5509
+ 'default' => 1,
5510
+ 'tooltip-subtitle' => esc_html__('Enable this option to show data below each post of Recent post loop'),
5511
+ 'required' => array('ampforwp-design3-recent-posts' , '=' , '1'),
5512
+ ),
5513
+ array(
5514
+ 'id' => 'amforwp-design3-recentpost-image-switch',
5515
+ 'type' => 'switch',
5516
+ 'class' => 'child_opt child_opt_arrow',
5517
+ 'title' => esc_html__('Image', 'accelerated-mobile-pages'),
5518
+ 'default' => 1,
5519
+ 'tooltip-subtitle' => esc_html__('Enable this option to show image for each post of Recent post loop'),
5520
+ 'required' => array('ampforwp-design3-recent-posts' , '=' , '1'),
5521
+ ),
5522
+ array(
5523
+ 'id' => 'ampforwp-design3-number-of-recent-posts',
5524
+ 'type' => 'text',
5525
+ 'class' => 'child_opt',
5526
+ 'title' => esc_html__('Number of Recent Post', 'accelerated-mobile-pages'),
5527
+ 'default' => '6',
5528
+ 'required' => array('ampforwp-design3-recent-posts' , '=' , '1'),
5529
+ ),
5530
  array(
5531
  'id' => 'ampforwp-inline-related-posts',
5532
  'type' => 'switch',
5586
  'default' => '3',
5587
  'required' => array( array('ampforwp-inline-related-posts', '=' , '1'),array('ampforwp-inline-related-posts-display-type', '=' , 'paragraphs') ),
5588
  ),
5589
+ array(
5590
+ 'id' => 'ampforwp-in-content-related-posts-days-switch',
5591
+ 'type' => 'switch',
5592
+ 'class' => 'child_opt',
5593
+ 'title' => esc_html__('By Last X Days', 'accelerated-mobile-pages'),
5594
+ 'tooltip-subtitle' => esc_html__('Show In Content Related Posts From Past Few Days', 'accelerated-mobile-pages'),
5595
+ 'default' => 0,
5596
+ 'required' => array('ampforwp-inline-related-posts', '=' , '1'),
5597
+ ),
5598
+ array(
5599
+ 'id' => 'ampforwp-in-content-related-posts-days-text',
5600
+ 'type' => 'text',
5601
+ 'class' => 'child_opt',
5602
+ 'title' => esc_html__('Number of Days', 'accelerated-mobile-pages'),
5603
+ 'validate' => 'numeric',
5604
+ 'default' => '7',
5605
+ 'required' => array('ampforwp-in-content-related-posts-days-switch', '=' , '1'),
5606
+ ),
5607
  array(
5608
  'id' => 'single-tab-2',
5609
  'type' => 'section',
5622
  esc_html__('Enable this option to show lightbox for images in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-lightbox-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5623
 
5624
  ),
5625
+ array(
5626
+ 'id' => 'ampforwp-lightbox-external-links',
5627
+ 'class' => 'child_opt',
5628
+ 'type' => 'switch',
5629
+ 'title' => esc_html__('External Links', 'accelerated-mobile-pages'),
5630
+ 'tooltip-subtitle' => esc_html__('This will show lightbox on your external links also', 'accelerated-mobile-pages'),
5631
+ 'default' => '1',
5632
+ 'required' => array('ampforwp-amp-img-lightbox','=', '1'),
5633
+ ),
5634
  // Dropcap
5635
  array(
5636
  'id' => 'ampforwp-dropcap',
7317
  'id' => 'ampforwp-date-section',
7318
  'subsection' => true,
7319
  'fields' => array(
7320
+
7321
+ array(
7322
+ 'id' => 'date-tab-1',
7323
+ 'type' => 'section',
7324
+ 'title' => esc_html__('General', 'accelerated-mobile-pages'),
7325
+ 'indent' => true,
7326
+ 'layout_type' => 'accordion',
7327
+ 'accordion-open'=> 1,
7328
+ ),
7329
+ // Date on Single Design 3
7330
  array(
7331
  'id' => 'amp-design-3-date-feature',
7332
  'type' => 'switch',
7337
  'tooltip-subtitle' => esc_html__('Display date along with author and category in posts', 'accelerated-mobile-pages' ),
7338
  'default' => '0'
7339
  ),
 
 
 
 
 
 
 
 
7340
  // Show Date As
7341
  array(
7342
  'id' => 'ampforwp-post-date-global',
7368
  'required' => array( array('ampforwp-post-date-format', '=', '1') ),
7369
  'default' =>'% days ago',
7370
  ),
7371
+ array(
7372
+ 'id' =>'ampforwp-post-time',
7373
+ 'type' =>'switch',
7374
+ 'title' => esc_html__('Time','accelerated-mobile-pages'),
7375
+ 'tooltip-subtitle' => esc_html__('Enable or Disable Time In Posts', 'accelerated-mobile-pages'),
7376
+ 'default' =>'1',
7377
+ 'required' => array( array('ampforwp-post-date-format', '=', '2') ),
7378
+ ),
7379
  // Post Modified Date
7380
+ array(
7381
  'id' => 'post-modified-date',
7382
  'type' => 'switch',
7383
+ 'title' => esc_html__('Date Notice', 'accelerated-mobile-pages'),
7384
  'default' => 0,
7385
  'tooltip-subtitle' => esc_html__('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
7386
+ ),
7387
+ array(
7388
+ 'id' =>'ampforwp-post-date-notice-type',
7389
+ 'type' =>'select',
7390
+ 'class' => 'child_opt child_opt_arrow',
7391
+ 'title' =>esc_html__('Notice Type','accelerated-mobile-pages'),
7392
+ 'tooltip-subtitle' => esc_html__('Select Date Format of Posts', 'accelerated-mobile-pages'),
7393
+ 'options' => array(
7394
+ 'modified' => 'Modified Date Notice',
7395
+ 'published' => 'Published Date Notice'
7396
+ ),
7397
+ 'default' =>'modified',
7398
+ 'required' => array( array('post-modified-date', '=', '1') ),
7399
+ ),
7400
+ array(
7401
+ 'id' => 'ampforwp-post-date-notice-time',
7402
+ 'class' => 'child_opt child_opt_arrow',
7403
+ 'type' => 'switch',
7404
+ 'title' => esc_html__('Time', 'accelerated-mobile-pages'),
7405
+ 'default' => 1,
7406
+ 'tooltip-subtitle' => esc_html__('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
7407
+ 'required' => array( array('ampforwp-post-date-notice-type', '!=', ''),array('post-modified-date', '=', '1') ),
7408
+ ),
7409
  )
7410
 
7411
  ) );
includes/options/redux-core/assets/css/import_export/import_export.css CHANGED
@@ -1 +0,0 @@
1
- #redux-import-link-wrapper,#redux-import-code-wrapper{display:none}#redux-export-code,#redux-export-link-value{display:none}#redux-import-action span{color:#B94A48}
 
includes/options/redux-core/assets/css/redux-admin.css CHANGED
@@ -17,7 +17,7 @@
17
  line-height: 2em;
18
  background: #fff;
19
  z-index: 10;
20
- position: relative;}.redux-container .redux-group-tab .redux-section-desc{margin-bottom:15px;color:#666;padding-top:15px;}.redux-container .redux-action_bar{float:right; float: right;
21
  position: relative;
22
  right: 50px;}.redux-container .redux-action_bar .spinner{float:left;margin-top:4px}.redux-container .redux-ajax-loading{display:none;background:red url(data:image/gif;base64,R0lGODlhEAAQAPUAAIiIiIqKio2NjZSUlJqamp6enqKioqSkpK+vr7i4uL+/v8PDw8XFxcnJyc/Pz9HR0dTU1NjY2Nzc3OLi4ubm5unp6ezs7PPz88vLy83NzdDQ0NXV1d3d3eHh4bu7u8zMzOvr6+3t7ZiYmNbW1sDAwMTExNra2s7OztPT09vb2+Xl5QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/i1NYWRlIGJ5IEtyYXNpbWlyYSBOZWpjaGV2YSAod3d3LmxvYWRpbmZvLm5ldCkAIfkEAAoA/wAsAAAAABAAEAAABXDgJY6XZZEoOTnOlI5WdUFNA5UnSR3FJNUSieFAIUUEgcdl4noEBBGSZaHIiSqKhTX2GhVFiQGjuxgkSoYAoosAGE6RhKQrUURHlS+pItMVCHMjEgQ9JBJISg+JT3ciFg4NFkcCNw0OViiDgF0oTC8hACH5BAAKAP8ALAAAAAAQABAAAAVx4CWOZGle1qJYp2hV1xYE29V1JXUYHWUcnQgGwyFFBAENiqUZ1kapFamTyeBcsNOLMkoMGC3GIIEyBBAtRMDAiiSKp04iQqpwc9kRpUCAizgEBVciEQNJFxpKGgECdFAYYBsCAjUMGS0XgAODmDacIyEAIfkEAAoA/wAsAAAAABAAEAAABnbAi3BILBovIMUidBSGQJdNIKBBMomUg6FDMRgoHcOBQowIqNaLJiCIEEMLxdWpnIfITRAHnxgwjiEfDR8UIQYBCEcgDYwdUR6ORxEfG3MgeFiFRB0FBBxEHAQFkUJmaBofamxuRB9/GwICGxeMTRehnrabpERBACH5BAAKAP8ALAAAAAAQABAAAAZ9wItwSCwaL5aFwnIUWiqXUSAwulSYRMrB0KEYDJSO4UAhRgQBDZLpCAgixOSSWFEssEho81IWJgYMTQwDCUgGAQhNCAEGTCMJHU0dCXBDFX1DFhwdeHwFIhxmGBihQxEDaRcOGhYao1WZGIFnAiMUDg6YRR0ioE57Fx2RRkEAIfkEAAoA/wAsAAAAABAAEAAABXLgJY5kaV7WolinaLGQEEBXxZLUUUyUYVATw4FCisg0NZYmIIiQUosKqaJY3FDS1oUoSgwYrcUggTIAEC1EwMCKJCatSYI2qnBx2dGkQOCQOAQFdxdGARoVGhCITE4kGBgWEI8QFgwYWhGTWiMWERFXIyEAIfkEAAoA/wAsAAAAABAAEAAABn/Ai3BILBovloXCchRaKpdRIDC6VJhEysHQoRgMlI7hQCFGBAENkukICCLE5JJYUSywSGjzUhYmBgxNDAMJSAYBCE0IAAZMEQkdTRwKVUMcHHhCFXpDERgYcJYEBZFDI58aFhoOFxpuoUIUGhoUZwJVGA6ZaxccBAQce0QdpUVBACH5BAAKAP8ALAAAAAAQABAAAAZ8wItwSCwaLyEFKXQUhioXSCAAuVSYRMrB0KEYDJSO4UAhmgQBDZKpCQhMxFBJgRVWlFkOtElhUj4NH3VEJQMJFx0NintFCAEGISEQH3BHHR5VThVlRRSMQh0FBBxEHAQFnEJnaRcfHxdtb0WKIWcCVSUNTYgEo7tEHR1HQQAh+QQACgD/ACwAAAAAEAAQAAAGdcCLcEgsGi8hhSJ0FHY6l1EgMLqAmEROo5HqGAwqL5g42qKsoAsqIEgRVacTdAhSLLBI1bWpwiYGDE0MAwlIBgEITQgBBkwjCRxNHQlVdCpGekUqBQSRQxwEBZdDKQIBZ3FqbG5EDYEjpikhW3hFoJ1NRU9HQQA7) no-repeat;width:16px;height:16px;margin:3px 4px 0;float:right}.redux-container #redux-intro-text{background:#f3f3f3;border-bottom:1px solid #dedede;-moz-box-shadow:inset 0 1px 0 #fcfcfc;-webkit-box-shadow:inset 0 1px 0 #fcfcfc;box-shadow:inset 0 1px 0 #fcfcfc;padding:3px;padding:10px 10px}.redux-container #redux-intro-text p{margin:0;font-family:"Lucida Grande", Sans-serif;color:#888}.redux-container .expand_options{cursor:pointer;display:block;height:22px;width:21px;float:left;font-size:0;text-indent:-9999px;margin:1px 0 0 5px;border:1px solid #bbb;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAyCAIAAAAm4OfBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQhJREFUeNrslT0KhDAQhTeLR7ATT6IXSKGFYO0lciFrO1N4AU8TLNXKv0CaJbLJRAZxl1hYyJuXN+PoR/Z9fyFdBNNr27Zf8Oq6bhgGSGUYhpTSzyeBNi8hRFVVEK+6rrXaQFOs6yrvTdOYjcqyVEpTLqXI89yaSypBudq2xckF2TipOSvfmmhZFuAGnJV6Licvey5gj7fnwpwXvEfLfqnT0jQ1OBJCQLnUBvZ9b85VFAV076UU8g1ZckVRxBiDzD6OY62WzPOM9i+cpunvvcZxfCQfPWs9a91Ym2UZ5xyHtd/e8hXWng+/zlrD9jmz1tDj7bkw5wXv0Y210itJEs9az9oHsPYQYACveK0/IuB51AAAAABJRU5ErkJggg==) no-repeat -2px -26px}.redux-container .expand_options.expanded{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAyCAIAAAAm4OfBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQhJREFUeNrslT0KhDAQhTeLR7ATT6IXSKGFYO0lciFrO1N4AU8TLNXKv0CaJbLJRAZxl1hYyJuXN+PoR/Z9fyFdBNNr27Zf8Oq6bhgGSGUYhpTSzyeBNi8hRFVVEK+6rrXaQFOs6yrvTdOYjcqyVEpTLqXI89yaSypBudq2xckF2TipOSvfmmhZFuAGnJV6Licvey5gj7fnwpwXvEfLfqnT0jQ1OBJCQLnUBvZ9b85VFAV076UU8g1ZckVRxBiDzD6OY62WzPOM9i+cpunvvcZxfCQfPWs9a91Ym2UZ5xyHtd/e8hXWng+/zlrD9jmz1tDj7bkw5wXv0Y210itJEs9az9oHsPYQYACveK0/IuB51AAAAABJRU5ErkJggg==) no-repeat -2px -1px}.redux-container .expand_options:hover{border-color:#888}.redux-container .sticky-footer-fixed{background:#f3f3f3;border-top:1px solid #dedede !important;-moz-box-shadow:inset 0 1px 0 #fcfcfc;-webkit-box-shadow:inset 0 1px 0 #fcfcfc;box-shadow:inset 0 1px 0 #fcfcfc}.redux-container .redux-sidebar,.redux-container .redux-main{min-height:300px}.no-js{border:1px solid #ffbaba;margin:0;border-bottom:1px solid #E7E7E7;background-color:#F2DEDE;color:#B94A48;padding:8px 35px 8px 14px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.redux-main{ background: #fff;
23
  border-left: 1px solid #f0f1f2;margin-left:201px; padding:0px 14px 0px 14px;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #FFF;box-shadow:inset 0 1px 0 #FFF;position:relative}.redux-main #redux_ajax_overlay{position:absolute;top:0;left:0;right:0;bottom:0;-moz-opacity:0.10;-khtml-opacity:0.10;opacity:0.10;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10);filter:alpha(opacity=10);background:#000;z-index:200;display:none}.redux-main .form-table.no-border{border-top: none;
17
  line-height: 2em;
18
  background: #fff;
19
  z-index: 10;
20
+ position: relative;}.redux-container .redux-group-tab .redux-section-desc{margin-bottom:15px;color:#666;}.redux-container .redux-action_bar{float:right; float: right;
21
  position: relative;
22
  right: 50px;}.redux-container .redux-action_bar .spinner{float:left;margin-top:4px}.redux-container .redux-ajax-loading{display:none;background:red url(data:image/gif;base64,R0lGODlhEAAQAPUAAIiIiIqKio2NjZSUlJqamp6enqKioqSkpK+vr7i4uL+/v8PDw8XFxcnJyc/Pz9HR0dTU1NjY2Nzc3OLi4ubm5unp6ezs7PPz88vLy83NzdDQ0NXV1d3d3eHh4bu7u8zMzOvr6+3t7ZiYmNbW1sDAwMTExNra2s7OztPT09vb2+Xl5QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/i1NYWRlIGJ5IEtyYXNpbWlyYSBOZWpjaGV2YSAod3d3LmxvYWRpbmZvLm5ldCkAIfkEAAoA/wAsAAAAABAAEAAABXDgJY6XZZEoOTnOlI5WdUFNA5UnSR3FJNUSieFAIUUEgcdl4noEBBGSZaHIiSqKhTX2GhVFiQGjuxgkSoYAoosAGE6RhKQrUURHlS+pItMVCHMjEgQ9JBJISg+JT3ciFg4NFkcCNw0OViiDgF0oTC8hACH5BAAKAP8ALAAAAAAQABAAAAVx4CWOZGle1qJYp2hV1xYE29V1JXUYHWUcnQgGwyFFBAENiqUZ1kapFamTyeBcsNOLMkoMGC3GIIEyBBAtRMDAiiSKp04iQqpwc9kRpUCAizgEBVciEQNJFxpKGgECdFAYYBsCAjUMGS0XgAODmDacIyEAIfkEAAoA/wAsAAAAABAAEAAABnbAi3BILBovIMUidBSGQJdNIKBBMomUg6FDMRgoHcOBQowIqNaLJiCIEEMLxdWpnIfITRAHnxgwjiEfDR8UIQYBCEcgDYwdUR6ORxEfG3MgeFiFRB0FBBxEHAQFkUJmaBofamxuRB9/GwICGxeMTRehnrabpERBACH5BAAKAP8ALAAAAAAQABAAAAZ9wItwSCwaL5aFwnIUWiqXUSAwulSYRMrB0KEYDJSO4UAhRgQBDZLpCAgixOSSWFEssEho81IWJgYMTQwDCUgGAQhNCAEGTCMJHU0dCXBDFX1DFhwdeHwFIhxmGBihQxEDaRcOGhYao1WZGIFnAiMUDg6YRR0ioE57Fx2RRkEAIfkEAAoA/wAsAAAAABAAEAAABXLgJY5kaV7WolinaLGQEEBXxZLUUUyUYVATw4FCisg0NZYmIIiQUosKqaJY3FDS1oUoSgwYrcUggTIAEC1EwMCKJCatSYI2qnBx2dGkQOCQOAQFdxdGARoVGhCITE4kGBgWEI8QFgwYWhGTWiMWERFXIyEAIfkEAAoA/wAsAAAAABAAEAAABn/Ai3BILBovloXCchRaKpdRIDC6VJhEysHQoRgMlI7hQCFGBAENkukICCLE5JJYUSywSGjzUhYmBgxNDAMJSAYBCE0IAAZMEQkdTRwKVUMcHHhCFXpDERgYcJYEBZFDI58aFhoOFxpuoUIUGhoUZwJVGA6ZaxccBAQce0QdpUVBACH5BAAKAP8ALAAAAAAQABAAAAZ8wItwSCwaLyEFKXQUhioXSCAAuVSYRMrB0KEYDJSO4UAhmgQBDZKpCQhMxFBJgRVWlFkOtElhUj4NH3VEJQMJFx0NintFCAEGISEQH3BHHR5VThVlRRSMQh0FBBxEHAQFnEJnaRcfHxdtb0WKIWcCVSUNTYgEo7tEHR1HQQAh+QQACgD/ACwAAAAAEAAQAAAGdcCLcEgsGi8hhSJ0FHY6l1EgMLqAmEROo5HqGAwqL5g42qKsoAsqIEgRVacTdAhSLLBI1bWpwiYGDE0MAwlIBgEITQgBBkwjCRxNHQlVdCpGekUqBQSRQxwEBZdDKQIBZ3FqbG5EDYEjpikhW3hFoJ1NRU9HQQA7) no-repeat;width:16px;height:16px;margin:3px 4px 0;float:right}.redux-container #redux-intro-text{background:#f3f3f3;border-bottom:1px solid #dedede;-moz-box-shadow:inset 0 1px 0 #fcfcfc;-webkit-box-shadow:inset 0 1px 0 #fcfcfc;box-shadow:inset 0 1px 0 #fcfcfc;padding:3px;padding:10px 10px}.redux-container #redux-intro-text p{margin:0;font-family:"Lucida Grande", Sans-serif;color:#888}.redux-container .expand_options{cursor:pointer;display:block;height:22px;width:21px;float:left;font-size:0;text-indent:-9999px;margin:1px 0 0 5px;border:1px solid #bbb;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAyCAIAAAAm4OfBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQhJREFUeNrslT0KhDAQhTeLR7ATT6IXSKGFYO0lciFrO1N4AU8TLNXKv0CaJbLJRAZxl1hYyJuXN+PoR/Z9fyFdBNNr27Zf8Oq6bhgGSGUYhpTSzyeBNi8hRFVVEK+6rrXaQFOs6yrvTdOYjcqyVEpTLqXI89yaSypBudq2xckF2TipOSvfmmhZFuAGnJV6Licvey5gj7fnwpwXvEfLfqnT0jQ1OBJCQLnUBvZ9b85VFAV076UU8g1ZckVRxBiDzD6OY62WzPOM9i+cpunvvcZxfCQfPWs9a91Ym2UZ5xyHtd/e8hXWng+/zlrD9jmz1tDj7bkw5wXv0Y210itJEs9az9oHsPYQYACveK0/IuB51AAAAABJRU5ErkJggg==) no-repeat -2px -26px}.redux-container .expand_options.expanded{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAyCAIAAAAm4OfBAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQhJREFUeNrslT0KhDAQhTeLR7ATT6IXSKGFYO0lciFrO1N4AU8TLNXKv0CaJbLJRAZxl1hYyJuXN+PoR/Z9fyFdBNNr27Zf8Oq6bhgGSGUYhpTSzyeBNi8hRFVVEK+6rrXaQFOs6yrvTdOYjcqyVEpTLqXI89yaSypBudq2xckF2TipOSvfmmhZFuAGnJV6Licvey5gj7fnwpwXvEfLfqnT0jQ1OBJCQLnUBvZ9b85VFAV076UU8g1ZckVRxBiDzD6OY62WzPOM9i+cpunvvcZxfCQfPWs9a91Ym2UZ5xyHtd/e8hXWng+/zlrD9jmz1tDj7bkw5wXv0Y210itJEs9az9oHsPYQYACveK0/IuB51AAAAABJRU5ErkJggg==) no-repeat -2px -1px}.redux-container .expand_options:hover{border-color:#888}.redux-container .sticky-footer-fixed{background:#f3f3f3;border-top:1px solid #dedede !important;-moz-box-shadow:inset 0 1px 0 #fcfcfc;-webkit-box-shadow:inset 0 1px 0 #fcfcfc;box-shadow:inset 0 1px 0 #fcfcfc}.redux-container .redux-sidebar,.redux-container .redux-main{min-height:300px}.no-js{border:1px solid #ffbaba;margin:0;border-bottom:1px solid #E7E7E7;background-color:#F2DEDE;color:#B94A48;padding:8px 35px 8px 14px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.redux-main{ background: #fff;
23
  border-left: 1px solid #f0f1f2;margin-left:201px; padding:0px 14px 0px 14px;-moz-box-shadow:inset 0 1px 0 #fff;-webkit-box-shadow:inset 0 1px 0 #FFF;box-shadow:inset 0 1px 0 #FFF;position:relative}.redux-main #redux_ajax_overlay{position:absolute;top:0;left:0;right:0;bottom:0;-moz-opacity:0.10;-khtml-opacity:0.10;opacity:0.10;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=10);filter:alpha(opacity=10);background:#000;z-index:200;display:none}.redux-main .form-table.no-border{border-top: none;
includes/options/redux-core/assets/js/vendor/spectrum/redux-spectrum.js CHANGED
@@ -143,6 +143,7 @@
143
 
144
  function instanceOptions(o, callbackContext) {
145
  var opts = $.extend({}, defaultOpts, o);
 
146
  opts.callbacks = {
147
  'move': bind(opts.move, callbackContext),
148
  'change': bind(opts.change, callbackContext),
143
 
144
  function instanceOptions(o, callbackContext) {
145
  var opts = $.extend({}, defaultOpts, o);
146
+ opts.clickoutFiresChange = true;
147
  opts.callbacks = {
148
  'move': bind(opts.move, callbackContext),
149
  'change': bind(opts.change, callbackContext),
includes/options/redux-core/assets/js/vendor/spectrum/redux-spectrum.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,b,c){function d(a,b,c,d){for(var e=[],f=0;f<a.length;f++){var g=a[f];if(g){var h=tinycolor(g),i=h.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";i+=tinycolor.equals(b,g)?" sp-thumb-active":"";var j=h.toString(d||"rgb"),k=r?"background-color:"+h.toRgbString():"filter:"+h.toFilter();e.push('<span title="'+j+'" data-color="'+h.toRgbString()+'" class="'+i+'"><span class="sp-thumb-inner" style="'+k+';" /></span>')}else{var l="sp-clear-display";e.push('<span title="No Color Selected" data-color="" style="background-color:transparent;" class="'+l+'"></span>')}}return"<div class='sp-cf "+c+"'>"+e.join("")+"</div>"}function e(){for(var a=0;a<p.length;a++)p[a]&&p[a].hide()}function f(a,c){var d=b.extend({},o,a);return d.callbacks={move:l(d.move,c),change:l(d.change,c),show:l(d.show,c),hide:l(d.hide,c),beforeShow:l(d.beforeShow,c)},d}function g(g,j){function l(){if(T.showPaletteOnly&&(T.showPalette=!0),T.palette){la=T.palette.slice(0),ma=b.isArray(la[0])?la:[la],na={};for(var a=0;a<ma.length;a++)for(var c=0;c<ma[a].length;c++){var d=tinycolor(ma[a][c]).toRgbString();na[d]=!0}}wa.toggleClass("sp-flat",U),wa.toggleClass("sp-input-disabled",!T.showInput),wa.toggleClass("sp-alpha-enabled",T.showAlpha),wa.toggleClass("sp-clear-enabled",Wa),wa.toggleClass("sp-buttons-disabled",!T.showButtons),wa.toggleClass("sp-palette-disabled",!T.showPalette),wa.toggleClass("sp-palette-only",T.showPaletteOnly),wa.toggleClass("sp-initial-disabled",!T.showInitial),wa.addClass(T.className).addClass(T.containerClassName),O()}function o(){function a(a){return a.data&&a.data.ignore?(H(b(this).data("color")),K()):(H(b(this).data("color")),K(),N(!0),F()),!1}if(q&&wa.find("*:not(input)").attr("unselectable","on"),l(),Ma&&ua.after(Na).hide(),Wa||Ia.hide(),U)ua.after(wa).hide();else{var c="parent"===T.appendTo?ua.parent():b(T.appendTo);1!==c.length&&(c=b("body")),c.append(wa)}v(),Oa.bind("click.spectrum touchstart.spectrum",function(a){va||D(),a.stopPropagation(),b(a.target).is("input")||a.preventDefault()}),(ua.is(":disabled")||T.disabled===!0)&&S(),wa.click(k),Ea.change(C),Ea.bind("paste",function(){setTimeout(C,1)}),Ea.keydown(function(a){13==a.keyCode&&C()}),Ha.text(T.cancelText),Ha.bind("click.spectrum",function(a){a.stopPropagation(),a.preventDefault(),F("cancel")}),Ia.attr("title",T.clearText),Ia.bind("click.spectrum",function(a){a.stopPropagation(),a.preventDefault(),Va=!0,K(),U&&N(!0)}),Ja.text(T.chooseText),Ja.bind("click.spectrum",function(a){a.stopPropagation(),a.preventDefault(),J()&&(N(!0),F())}),m(Ca,function(a,b,c){ka=a/ea,Va=!1,c.shiftKey&&(ka=Math.round(10*ka)/10),K()},A,B),m(za,function(a,b){ha=parseFloat(b/ca),Va=!1,T.showAlpha||(ka=1),K()},A,B),m(xa,function(a,b,c){if(c.shiftKey){if(!sa){var d=ia*_,e=aa-ja*aa,f=Math.abs(a-d)>Math.abs(b-e);sa=f?"x":"y"}}else sa=null;var g=!sa||"x"===sa,h=!sa||"y"===sa;g&&(ia=parseFloat(a/_)),h&&(ja=parseFloat((aa-b)/aa)),Va=!1,T.showAlpha||(ka=1),K()},A,B),Qa?(H(Qa),L(),Ta=Sa||tinycolor(Qa).format,w(Qa)):L(),U&&E();var d=q?"mousedown.spectrum":"click.spectrum touchstart.spectrum";Fa.delegate(".sp-thumb-el",d,a),Ga.delegate(".sp-thumb-el:nth-child(1)",d,{ignore:!0},a)}function v(){if(W&&a.localStorage){try{var c=a.localStorage[W].split(",#");c.length>1&&(delete a.localStorage[W],b.each(c,function(a,b){w(b)}))}catch(d){}try{oa=a.localStorage[W].split(";")}catch(d){}}}function w(c){if(V){var d=tinycolor(c).toRgbString();if(!na[d]&&-1===b.inArray(d,oa))for(oa.push(d);oa.length>pa;)oa.shift();if(W&&a.localStorage)try{a.localStorage[W]=oa.join(";")}catch(e){}}}function x(){var a=[];if(T.showPalette)for(i=0;i<oa.length;i++){var b=tinycolor(oa[i]).toRgbString();na[b]||a.push(oa[i])}return a.reverse().slice(0,T.maxSelectionSize)}function y(){var a=I(),c=b.map(ma,function(b,c){return d(b,a,"sp-palette-row sp-palette-row-"+c,T.preferredFormat)});v(),oa&&c.push(d(x(),a,"sp-palette-row sp-palette-row-selection",T.preferredFormat)),Fa.html(c.join(""))}function z(){if(T.showInitial){var a=Ra,b=I();Ga.html(d([a,b],b,"sp-palette-row-initial",T.preferredFormat))}}function A(){(0>=aa||0>=_||0>=ca)&&O(),wa.addClass(qa),sa=null,ua.trigger("dragstart.spectrum",[I()])}function B(){wa.removeClass(qa),ua.trigger("dragstop.spectrum",[I()])}function C(){var a=Ea.val();if(null!==a&&""!==a||!Wa){var b=tinycolor(a);b.ok?(H(b),N(!0)):Ea.addClass("sp-validation-error")}else H(null),N(!0)}function D(){$?F():E()}function E(){var c=b.Event("beforeShow.spectrum");return $?void O():(ua.trigger(c,[I()]),void(Y.beforeShow(I())===!1||c.isDefaultPrevented()||(e(),$=!0,b(ta).bind("click.spectrum",F),b(a).bind("resize.spectrum",Z),Na.addClass("sp-active"),wa.removeClass("sp-hidden"),O(),L(),Ra=I(),z(),Y.show(Ra),ua.trigger("show.spectrum",[Ra]))))}function F(c){if((!c||"click"!=c.type||2!=c.button)&&$&&!U){$=!1,b(ta).unbind("click.spectrum",F),b(a).unbind("resize.spectrum",Z),Na.removeClass("sp-active"),wa.addClass("sp-hidden");var d=!tinycolor.equals(I(),Ra);d&&(Ua&&"cancel"!==c?N(!0):G()),Y.hide(I()),ua.trigger("hide.spectrum",[I()])}}function G(){H(Ra,!0)}function H(a,b){if(tinycolor.equals(a,I()))return void L();var c,d;!a&&Wa?Va=!0:(Va=!1,c=tinycolor(a),d=c.toHsv(),ha=d.h%360/360,ia=d.s,ja=d.v,ka=d.a),L(),c&&c.ok&&!b&&(Ta=Sa||c.format)}function I(a){return a=a||{},Wa&&Va?null:tinycolor.fromRatio({h:ha,s:ia,v:ja,a:Math.round(100*ka)/100},{format:a.format||Ta})}function J(){return!Ea.hasClass("sp-validation-error")}function K(){L(),Y.move(I()),ua.trigger("move.spectrum",[I()])}function L(){Ea.removeClass("sp-validation-error"),M();var a=tinycolor.fromRatio({h:ha,s:1,v:1});xa.css("background-color",a.toHexString());var b=Ta;1>ka&&(0!==ka||"name"!==b)&&("hex"===b||"hex3"===b||"hex6"===b||"name"===b)&&(b="rgb");var c=I({format:b}),d="";if(Pa.removeClass("sp-clear-display"),Pa.css("background-color","transparent"),!c&&Wa)Pa.addClass("sp-clear-display");else{var e=c.toHexString(),f=c.toRgbString();if(r||1===c.alpha?Pa.css("background-color",f):(Pa.css("background-color","transparent"),Pa.css("filter",c.toFilter())),T.showAlpha){var g=c.toRgb();g.a=0;var h=tinycolor(g).toRgbString(),i="linear-gradient(left, "+h+", "+e+")";q?Ba.css("filter",tinycolor(h).toFilter({gradientType:1},e)):(Ba.css("background","-webkit-"+i),Ba.css("background","-moz-"+i),Ba.css("background","-ms-"+i),Ba.css("background","linear-gradient(to right, "+h+", "+e+")"))}d=c.toString(b)}T.showInput&&Ea.val(d),T.showPalette&&y(),z()}function M(){var a=ia,b=ja;if(Wa&&Va)Da.hide(),Aa.hide(),ya.hide();else{Da.show(),Aa.show(),ya.show();var c=a*_,d=aa-b*aa;c=Math.max(-ba,Math.min(_-ba,c-ba)),d=Math.max(-ba,Math.min(aa-ba,d-ba)),ya.css({top:d+"px",left:c+"px"});var e=ka*ea;Da.css({left:e-fa/2+"px"});var f=ha*ca;Aa.css({top:f-ga+"px"})}}function N(a){var b=I(),c="",d=!tinycolor.equals(b,Ra);b&&(c=b.toString(Ta),w(b)),Ka&&ua.val(c),Ra=b,a&&d&&(Y.change(b),ua.trigger("change",[b]))}function O(){_=xa.width(),aa=xa.height(),ba=ya.height(),da=za.width(),ca=za.height(),ga=Aa.height(),ea=Ca.width(),fa=Da.width(),U||(wa.css("position","absolute"),wa.offset(h(wa,Oa))),M(),T.showPalette&&y(),ua.trigger("reflow.spectrum")}function P(){ua.show(),Oa.unbind("click.spectrum touchstart.spectrum"),wa.remove(),Na.remove(),p[Ya.id]=null}function Q(a,d){return a===c?b.extend({},T):d===c?T[a]:(T[a]=d,void l())}function R(){va=!1,ua.attr("disabled",!1),Oa.removeClass("sp-disabled")}function S(){F(),va=!0,ua.attr("disabled",!0),Oa.addClass("sp-disabled")}var T=f(j,g),U=T.flat,V=T.showSelectionPalette,W=T.localStorageKey,X=T.theme,Y=T.callbacks,Z=n(O,10),$=!1,_=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=1,la=[],ma=[],na={},oa=T.selectionPalette.slice(0),pa=T.maxSelectionSize,qa="sp-dragging",ra=T.inputText,sa=null,ta=g.ownerDocument,ua=(ta.body,b(g)),va=!1,wa=b(u,ta).addClass(X),xa=wa.find(".sp-color"),ya=wa.find(".sp-dragger"),za=wa.find(".sp-hue"),Aa=wa.find(".sp-slider"),Ba=wa.find(".sp-alpha-inner"),Ca=wa.find(".sp-alpha"),Da=wa.find(".sp-alpha-handle"),Ea=wa.find(".sp-input"),Fa=wa.find(".sp-palette"),Ga=wa.find(".sp-initial"),Ha=wa.find(".sp-cancel"),Ia=wa.find(".sp-clear"),Ja=wa.find(".sp-choose"),Ka=ua.is("input"),La=Ka&&s&&"color"===ua.attr("type"),Ma=Ka&&!U,Na=Ma?b(t).addClass(X).addClass(T.className).addClass(T.replacerClassName):b([]),Oa=Ma?Na:ua,Pa=Na.find(".sp-preview-inner"),Qa=T.color||Ka&&ua.val(),Ra=!1,Sa=T.preferredFormat,Ta=Sa,Ua=!T.showButtons||T.clickoutFiresChange,Va=!Qa,Wa=T.allowEmpty&&!La;if(""!==ra){var Xa=b(Oa).find("div.sp-dd");Xa.text(ra)}o();var Ya={show:E,hide:F,toggle:D,reflow:O,option:Q,enable:R,disable:S,set:function(a){H(a),N()},get:I,destroy:P,container:wa};return Ya.id=p.push(Ya)-1,Ya}function h(a,c){var d=0,e=a.outerWidth(),f=a.outerHeight(),g=c.outerHeight(),h=a[0].ownerDocument,i=h.documentElement,j=i.clientWidth+b(h).scrollLeft(),k=i.clientHeight+b(h).scrollTop(),l=c.offset();return l.top+=g,l.left-=Math.min(l.left,l.left+e>j&&j>e?Math.abs(l.left+e-j):0),l.top-=Math.min(l.top,l.top+f>k&&k>f?Math.abs(f+g-d):d),l}function j(){}function k(a){a.stopPropagation()}function l(a,b){var c=Array.prototype.slice,d=c.call(arguments,2);return function(){return a.apply(b,d.concat(c.call(arguments)))}}function m(c,d,e,f){function g(a){a.stopPropagation&&a.stopPropagation(),a.preventDefault&&a.preventDefault(),a.returnValue=!1}function h(a){if(l){if(q&&document.documentMode<9&&!a.button)return j();var b=a.originalEvent.touches,e=b?b[0].pageX:a.pageX,f=b?b[0].pageY:a.pageY,h=Math.max(0,Math.min(e-m.left,o)),i=Math.max(0,Math.min(f-m.top,n));p&&g(a),d.apply(c,[h,i,a])}}function i(a){var d=a.which?3==a.which:2==a.button;a.originalEvent.touches;d||l||e.apply(c,arguments)!==!1&&(l=!0,n=b(c).height(),o=b(c).width(),m=b(c).offset(),b(k).bind(r),b(k.body).addClass("sp-dragging"),p||h(a),g(a))}function j(){l&&(b(k).unbind(r),b(k.body).removeClass("sp-dragging"),f.apply(c,arguments)),l=!1}d=d||function(){},e=e||function(){},f=f||function(){};var k=c.ownerDocument||document,l=!1,m={},n=0,o=0,p="ontouchstart"in a,r={};r.selectstart=g,r.dragstart=g,r["touchmove mousemove"]=h,r["touchend mouseup"]=j,b(c).bind("touchstart mousedown",i)}function n(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d),(c||!d)&&(d=setTimeout(g,b))}}var o={beforeShow:j,move:j,change:j,show:j,hide:j,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!1,showInitial:!1,showPalette:!1,showPaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",clearText:"Clear Color Selection",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,inputText:""},p=[],q=!!/msie/i.exec(a.navigator.userAgent),r=function(){function a(a,b){return!!~(""+a).indexOf(b)}var b=document.createElement("div"),c=b.style;return c.cssText="background-color:rgba(0,0,0,.5)",a(c.backgroundColor,"rgba")||a(c.backgroundColor,"hsla")}(),s=function(){var a=b("<input type='color' value='#ffffff' />")[0];return"color"===a.type&&"#ffffff"!==a.value}(),t=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),u=function(){var a="";if(q)for(var b=1;6>=b;b++)a+="<div class='sp-"+b+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",a,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}(),v="spectrum.id";b.fn.spectrum=function(a,c){if("string"==typeof a){var d=this,e=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=p[b(this).data(v)];if(c){var f=c[a];if(!f)throw new Error("Spectrum: no such method: '"+a+"'");"get"==a?d=c.get():"container"==a?d=c.container:"option"==a?d=c.option.apply(c,e):"destroy"==a?(c.destroy(),b(this).removeData(v)):f.apply(c,e)}}),d}return this.spectrum("destroy").each(function(){var c=b.extend({},a,b(this).data()),d=g(this,c);b(this).data(v,d.id)})},b.fn.spectrum.load=!0,b.fn.spectrum.loadOpts={},b.fn.spectrum.draggable=m,b.fn.spectrum.defaults=o,b.spectrum={},b.spectrum.localization={},b.spectrum.palettes={},b.fn.spectrum.processNativeColorInputs=function(){s||b("input[type=color]").spectrum({preferredFormat:"hex6"})},function(){function b(a,d){if(a=a?a:"",d=d||{},"object"==typeof a&&a.hasOwnProperty("_tc_id"))return a;var f=c(a),h=f.r,k=f.g,n=f.b,o=f.a,p=A(100*o)/100,q=d.format||f.format;return 1>h&&(h=A(h)),1>k&&(k=A(k)),1>n&&(n=A(n)),{ok:f.ok,format:q,_tc_id:y++,alpha:o,getAlpha:function(){return o},setAlpha:function(a){o=l(a),p=A(100*o)/100},toHsv:function(){var a=g(h,k,n);return{h:360*a.h,s:a.s,v:a.v,a:o}},toHsvString:function(){var a=g(h,k,n),b=A(360*a.h),c=A(100*a.s),d=A(100*a.v);return 1==o?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+p+")"},toHsl:function(){var a=e(h,k,n);return{h:360*a.h,s:a.s,l:a.l,a:o}},toHslString:function(){var a=e(h,k,n),b=A(360*a.h),c=A(100*a.s),d=A(100*a.l);return 1==o?"hsl("+b+", "+c+"%, "+d+"%)":"hsla("+b+", "+c+"%, "+d+"%, "+p+")"},toHex:function(a){return i(h,k,n,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(){return j(h,k,n,o)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:A(h),g:A(k),b:A(n),a:o}},toRgbString:function(){return 1==o?"rgb("+A(h)+", "+A(k)+", "+A(n)+")":"rgba("+A(h)+", "+A(k)+", "+A(n)+", "+p+")"},toPercentageRgb:function(){return{r:A(100*m(h,255))+"%",g:A(100*m(k,255))+"%",b:A(100*m(n,255))+"%",a:o}},toPercentageRgbString:function(){return 1==o?"rgb("+A(100*m(h,255))+"%, "+A(100*m(k,255))+"%, "+A(100*m(n,255))+"%)":"rgba("+A(100*m(h,255))+"%, "+A(100*m(k,255))+"%, "+A(100*m(n,255))+"%, "+p+")"},toName:function(){return 0===o?"transparent":F[i(h,k,n,!0)]||!1},toFilter:function(a){var c="#"+j(h,k,n,o),e=c,f=d&&d.gradientType?"GradientType = 1, ":"";if(a){var g=b(a);e=g.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+f+"startColorstr="+c+",endColorstr="+e+")"},toString:function(a){var b=!!a;a=a||this.format;var c=!1,d=!b&&1>o&&o>0,e=d&&("hex"===a||"hex6"===a||"hex3"===a||"name"===a);return"rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),("hex"===a||"hex6"===a)&&(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),e?this.toRgbString():c||this.toHexString()}}}function c(a){var b={r:0,g:0,b:0},c=1,e=!1,g=!1;return"string"==typeof a&&(a=v(a)),"object"==typeof a&&(a.hasOwnProperty("r")&&a.hasOwnProperty("g")&&a.hasOwnProperty("b")?(b=d(a.r,a.g,a.b),e=!0,g="%"===String(a.r).substr(-1)?"prgb":"rgb"):a.hasOwnProperty("h")&&a.hasOwnProperty("s")&&a.hasOwnProperty("v")?(a.s=s(a.s),a.v=s(a.v),b=h(a.h,a.s,a.v),e=!0,g="hsv"):a.hasOwnProperty("h")&&a.hasOwnProperty("s")&&a.hasOwnProperty("l")&&(a.s=s(a.s),a.l=s(a.l),b=f(a.h,a.s,a.l),e=!0,g="hsl"),a.hasOwnProperty("a")&&(c=a.a)),c=l(c),{ok:e,format:a.format||g,r:B(255,C(b.r,0)),g:B(255,C(b.g,0)),b:B(255,C(b.b,0)),a:c}}function d(a,b,c){return{r:255*m(a,255),g:255*m(b,255),b:255*m(c,255)}}function e(a,b,c){a=m(a,255),b=m(b,255),c=m(c,255);var d,e,f=C(a,b,c),g=B(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,l:h}}function f(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(a=m(a,360),b=m(b,100),c=m(c,100),0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function g(a,b,c){a=m(a,255),b=m(b,255),c=m(c,255);var d,e,f=C(a,b,c),g=B(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,v:h}}function h(a,b,c){a=6*m(a,360),b=m(b,100),c=m(c,100);var d=z.floor(a),e=a-d,f=c*(1-b),g=c*(1-e*b),h=c*(1-(1-e)*b),i=d%6,j=[c,g,f,f,h,c][i],k=[h,c,c,g,f,f][i],l=[f,f,h,c,c,g][i];return{r:255*j,g:255*k,b:255*l}}function i(a,b,c,d){var e=[r(A(a).toString(16)),r(A(b).toString(16)),r(A(c).toString(16))];return d&&e[0].charAt(0)==e[0].charAt(1)&&e[1].charAt(0)==e[1].charAt(1)&&e[2].charAt(0)==e[2].charAt(1)?e[0].charAt(0)+e[1].charAt(0)+e[2].charAt(0):e.join("")}function j(a,b,c,d){var e=[r(t(d)),r(A(a).toString(16)),r(A(b).toString(16)),r(A(c).toString(16))];return e.join("")}function k(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function l(a){return a=parseFloat(a),(isNaN(a)||0>a||a>1)&&(a=1),a}function m(a,b){p(a)&&(a="100%");var c=q(a);return a=B(b,C(0,parseFloat(a))),c&&(a=parseInt(a*b,10)/100),z.abs(a-b)<1e-6?1:a%b/parseFloat(b)}function n(a){return B(1,C(0,a))}function o(a){return parseInt(a,16)}function p(a){return"string"==typeof a&&-1!=a.indexOf(".")&&1===parseFloat(a)}function q(a){return"string"==typeof a&&-1!=a.indexOf("%")}function r(a){return 1==a.length?"0"+a:""+a}function s(a){return 1>=a&&(a=100*a+"%"),a}function t(a){return Math.round(255*parseFloat(a)).toString(16)}function u(a){return o(a)/255}function v(a){a=a.replace(w,"").replace(x,"").toLowerCase();var b=!1;if(E[a])a=E[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=G.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=G.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=G.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=G.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=G.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=G.hex8.exec(a))?{a:u(c[1]),r:o(c[2]),g:o(c[3]),b:o(c[4]),format:b?"name":"hex8"}:(c=G.hex6.exec(a))?{r:o(c[1]),g:o(c[2]),b:o(c[3]),format:b?"name":"hex"}:(c=G.hex3.exec(a))?{r:o(c[1]+""+c[1]),g:o(c[2]+""+c[2]),b:o(c[3]+""+c[3]),format:b?"name":"hex"}:!1}var w=/^[\s,#]+/,x=/\s+$/,y=0,z=Math,A=z.round,B=z.min,C=z.max,D=z.random;b.fromRatio=function(a,c){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&("a"===e?d[e]=a[e]:d[e]=s(a[e]));a=d}return b(a,c)},b.equals=function(a,c){return a&&c?b(a).toRgbString()==b(c).toRgbString():!1},b.random=function(){return b.fromRatio({r:D(),g:D(),b:D()})},b.desaturate=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s-=c/100,d.s=n(d.s),b(d)},b.saturate=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s+=c/100,d.s=n(d.s),b(d)},b.greyscale=function(a){return b.desaturate(a,100)},b.lighten=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l+=c/100,d.l=n(d.l),b(d)},b.darken=function(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l-=c/100,d.l=n(d.l),b(d)},b.complement=function(a){var c=b(a).toHsl();return c.h=(c.h+180)%360,b(c)},b.triad=function(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+120)%360,s:c.s,l:c.l}),b({h:(d+240)%360,s:c.s,l:c.l})]},b.tetrad=function(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+90)%360,s:c.s,l:c.l}),b({h:(d+180)%360,s:c.s,l:c.l}),b({h:(d+270)%360,s:c.s,l:c.l})]},b.splitcomplement=function(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+72)%360,s:c.s,l:c.l}),b({h:(d+216)%360,s:c.s,l:c.l})]},b.analogous=function(a,c,d){c=c||6,d=d||30;var e=b(a).toHsl(),f=360/d,g=[b(a)];for(e.h=(e.h-(f*c>>1)+720)%360;--c;)e.h=(e.h+f)%360,g.push(b(e));return g},b.monochromatic=function(a,c){c=c||6;for(var d=b(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/c;c--;)h.push(b({h:e,s:f,v:g})),g=(g+i)%1;return h},b.readability=function(a,c){var d=b(a).toRgb(),e=b(c).toRgb(),f=(299*d.r+587*d.g+114*d.b)/1e3,g=(299*e.r+587*e.g+114*e.b)/1e3,h=Math.max(d.r,e.r)-Math.min(d.r,e.r)+Math.max(d.g,e.g)-Math.min(d.g,e.g)+Math.max(d.b,e.b)-Math.min(d.b,e.b);return{brightness:Math.abs(f-g),color:h}},b.readable=function(a,c){var d=b.readability(a,c);return d.brightness>125&&d.color>500},b.mostReadable=function(a,c){for(var d=null,e=0,f=!1,g=0;g<c.length;g++){var h=b.readability(a,c[g]),i=h.brightness>125&&h.color>500,j=3*(h.brightness/125)+h.color/500;(i&&!f||i&&f&&j>e||!i&&!f&&j>e)&&(f=i,e=j,d=b(c[g]))}return d};var E=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=b.hexNames=k(E),G=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();a.tinycolor=b}(),b(function(){b.fn.spectrum.load&&b.fn.spectrum.processNativeColorInputs()})}(window,jQuery);
1
+ !function(e,t,r){var a,n={beforeShow:p,move:p,change:p,show:p,hide:p,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!1,showInitial:!1,showPalette:!1,showPaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",clearText:"Clear Color Selection",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,inputText:""},o=[],s=!!/msie/i.exec(e.navigator.userAgent),l=function(){function e(e,t){return!!~(""+e).indexOf(t)}var t=document.createElement("div").style;return t.cssText="background-color:rgba(0,0,0,.5)",e(t.backgroundColor,"rgba")||e(t.backgroundColor,"hsla")}(),c="color"===(a=t("<input type='color' value='#ffffff' />")[0]).type&&"#ffffff"!==a.value,f=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),u=function(){var e="";if(s)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();function d(e,t,r,a){for(var n=[],o=0;o<e.length;o++){var s=e[o];if(s){var i=tinycolor(s),c=i.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";c+=tinycolor.equals(t,s)?" sp-thumb-active":"";var f=i.toString(a||"rgb"),u=l?"background-color:"+i.toRgbString():"filter:"+i.toFilter();n.push('<span title="'+f+'" data-color="'+i.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+u+';" /></span>')}else{n.push('<span title="No Color Selected" data-color="" style="background-color:transparent;" class="sp-clear-display"></span>')}}return"<div class='sp-cf "+r+"'>"+n.join("")+"</div>"}function h(a,h){var p,m,y,w,x=function(e,r){var a=t.extend({},n,e);return a.clickoutFiresChange=!0,a.callbacks={move:b(a.move,r),change:b(a.change,r),show:b(a.show,r),hide:b(a.hide,r),beforeShow:b(a.beforeShow,r)},a}(h,a),k=x.flat,S=x.showSelectionPalette,C=x.localStorageKey,P=x.theme,H=x.callbacks,A=(p=$e,m=10,function(){var e=this,t=arguments;y&&clearTimeout(w),!y&&w||(w=setTimeout(function(){w=null,p.apply(e,t)},m))}),F=!1,R=0,M=0,O=0,T=0,N=0,q=0,E=0,j=0,D=0,I=0,z=1,K=[],$=[],_={},B=x.selectionPalette.slice(0),X=x.maxSelectionSize,L="sp-dragging",W=x.inputText,Y=null,G=a.ownerDocument,Q=(G.body,t(a)),V=!1,J=t(u,G).addClass(P),U=J.find(".sp-color"),Z=J.find(".sp-dragger"),ee=J.find(".sp-hue"),te=J.find(".sp-slider"),re=J.find(".sp-alpha-inner"),ae=J.find(".sp-alpha"),ne=J.find(".sp-alpha-handle"),oe=J.find(".sp-input"),se=J.find(".sp-palette"),ie=J.find(".sp-initial"),le=J.find(".sp-cancel"),ce=J.find(".sp-clear"),fe=J.find(".sp-choose"),ue=Q.is("input"),de=ue&&c&&"color"===Q.attr("type"),he=ue&&!k,pe=he?t(f).addClass(P).addClass(x.className).addClass(x.replacerClassName):t([]),ge=he?pe:Q,be=pe.find(".sp-preview-inner"),ve=x.color||ue&&Q.val(),me=!1,ye=x.preferredFormat,we=ye,xe=!x.showButtons||x.clickoutFiresChange,ke=!ve,Se=x.allowEmpty&&!de;""!==W&&t(ge).find("div.sp-dd").text(W);function Ce(){if(x.showPaletteOnly&&(x.showPalette=!0),x.palette){K=x.palette.slice(0),$=t.isArray(K[0])?K:[K],_={};for(var e=0;e<$.length;e++)for(var r=0;r<$[e].length;r++){var a=tinycolor($[e][r]).toRgbString();_[a]=!0}}J.toggleClass("sp-flat",k),J.toggleClass("sp-input-disabled",!x.showInput),J.toggleClass("sp-alpha-enabled",x.showAlpha),J.toggleClass("sp-clear-enabled",Se),J.toggleClass("sp-buttons-disabled",!x.showButtons),J.toggleClass("sp-palette-disabled",!x.showPalette),J.toggleClass("sp-palette-only",x.showPaletteOnly),J.toggleClass("sp-initial-disabled",!x.showInitial),J.addClass(x.className).addClass(x.containerClassName),$e()}function Pe(){if(C&&e.localStorage){try{var r=e.localStorage[C].split(",#");r.length>1&&(delete e.localStorage[C],t.each(r,function(e,t){He(t)}))}catch(e){}try{B=e.localStorage[C].split(";")}catch(e){}}}function He(r){if(S){var a=tinycolor(r).toRgbString();if(!_[a]&&-1===t.inArray(a,B))for(B.push(a);B.length>X;)B.shift();if(C&&e.localStorage)try{e.localStorage[C]=B.join(";")}catch(e){}}}function Ae(){var e=je(),r=t.map($,function(t,r){return d(t,e,"sp-palette-row sp-palette-row-"+r,x.preferredFormat)});Pe(),B&&r.push(d(function(){var e=[];if(x.showPalette)for(i=0;i<B.length;i++){var t=tinycolor(B[i]).toRgbString();_[t]||e.push(B[i])}return e.reverse().slice(0,x.maxSelectionSize)}(),e,"sp-palette-row sp-palette-row-selection",x.preferredFormat)),se.html(r.join(""))}function Fe(){if(x.showInitial){var e=me,t=je();ie.html(d([e,t],t,"sp-palette-row-initial",x.preferredFormat))}}function Re(){(M<=0||R<=0||T<=0)&&$e(),J.addClass(L),Y=null,Q.trigger("dragstart.spectrum",[je()])}function Me(){J.removeClass(L),Q.trigger("dragstop.spectrum",[je()])}function Oe(){var e=oe.val();if(null!==e&&""!==e||!Se){var t=tinycolor(e);t.ok?(Ee(t),Ke(!0)):oe.addClass("sp-validation-error")}else Ee(null),Ke(!0)}function Te(){F?qe():Ne()}function Ne(){var r=t.Event("beforeShow.spectrum");F?$e():(Q.trigger(r,[je()]),!1===H.beforeShow(je())||r.isDefaultPrevented()||(!function(){for(var e=0;e<o.length;e++)o[e]&&o[e].hide()}(),F=!0,t(G).bind("click.spectrum",qe),t(e).bind("resize.spectrum",A),pe.addClass("sp-active"),J.removeClass("sp-hidden"),$e(),Ie(),me=je(),Fe(),H.show(me),Q.trigger("show.spectrum",[me])))}function qe(r){r&&"click"==r.type&&2==r.button||F&&!k&&(F=!1,t(G).unbind("click.spectrum",qe),t(e).unbind("resize.spectrum",A),pe.removeClass("sp-active"),J.addClass("sp-hidden"),!tinycolor.equals(je(),me)&&(xe&&"cancel"!==r?Ke(!0):Ee(me,!0)),H.hide(je()),Q.trigger("hide.spectrum",[je()]))}function Ee(e,t){var r,a;tinycolor.equals(e,je())?Ie():(!e&&Se?ke=!0:(ke=!1,a=(r=tinycolor(e)).toHsv(),j=a.h%360/360,D=a.s,I=a.v,z=a.a),Ie(),r&&r.ok&&!t&&(we=ye||r.format))}function je(e){return e=e||{},Se&&ke?null:tinycolor.fromRatio({h:j,s:D,v:I,a:Math.round(100*z)/100},{format:e.format||we})}function De(){Ie(),H.move(je()),Q.trigger("move.spectrum",[je()])}function Ie(){oe.removeClass("sp-validation-error"),ze();var e=tinycolor.fromRatio({h:j,s:1,v:1});U.css("background-color",e.toHexString());var t=we;z<1&&(0!==z||"name"!==t)&&("hex"!==t&&"hex3"!==t&&"hex6"!==t&&"name"!==t||(t="rgb"));var r=je({format:t}),a="";if(be.removeClass("sp-clear-display"),be.css("background-color","transparent"),!r&&Se)be.addClass("sp-clear-display");else{var n=r.toHexString(),o=r.toRgbString();if(l||1===r.alpha?be.css("background-color",o):(be.css("background-color","transparent"),be.css("filter",r.toFilter())),x.showAlpha){var i=r.toRgb();i.a=0;var c=tinycolor(i).toRgbString(),f="linear-gradient(left, "+c+", "+n+")";s?re.css("filter",tinycolor(c).toFilter({gradientType:1},n)):(re.css("background","-webkit-"+f),re.css("background","-moz-"+f),re.css("background","-ms-"+f),re.css("background","linear-gradient(to right, "+c+", "+n+")"))}a=r.toString(t)}x.showInput&&oe.val(a),x.showPalette&&Ae(),Fe()}function ze(){var e=D,t=I;if(Se&&ke)ne.hide(),te.hide(),Z.hide();else{ne.show(),te.show(),Z.show();var r=e*R,a=M-t*M;r=Math.max(-O,Math.min(R-O,r-O)),a=Math.max(-O,Math.min(M-O,a-O)),Z.css({top:a+"px",left:r+"px"});var n=z*N;ne.css({left:n-q/2+"px"});var o=j*T;te.css({top:o-E+"px"})}}function Ke(e){var t=je(),r="",a=!tinycolor.equals(t,me);t&&(r=t.toString(we),He(t)),ue&&Q.val(r),me=t,e&&a&&(H.change(t),Q.trigger("change",[t]))}function $e(){var e,r,a,n,o,s,i,l,c,f;R=U.width(),M=U.height(),O=Z.height(),ee.width(),T=ee.height(),E=te.height(),N=ae.width(),q=ne.width(),k||(J.css("position","absolute"),J.offset((r=ge,a=(e=J).outerWidth(),n=e.outerHeight(),o=r.outerHeight(),s=e[0].ownerDocument,i=s.documentElement,l=i.clientWidth+t(s).scrollLeft(),c=i.clientHeight+t(s).scrollTop(),(f=r.offset()).top+=o,f.left-=Math.min(f.left,f.left+a>l&&l>a?Math.abs(f.left+a-l):0),f.top-=Math.min(f.top,f.top+n>c&&c>n?Math.abs(n+o-0):0),f))),ze(),x.showPalette&&Ae(),Q.trigger("reflow.spectrum")}function _e(){qe(),V=!0,Q.attr("disabled",!0),ge.addClass("sp-disabled")}!function(){if(s&&J.find("*:not(input)").attr("unselectable","on"),Ce(),he&&Q.after(pe).hide(),Se||ce.hide(),k)Q.after(J).hide();else{var e="parent"===x.appendTo?Q.parent():t(x.appendTo);1!==e.length&&(e=t("body")),e.append(J)}function r(e){return e.data&&e.data.ignore?(Ee(t(this).data("color")),De()):(Ee(t(this).data("color")),De(),Ke(!0),qe()),!1}Pe(),ge.bind("click.spectrum touchstart.spectrum",function(e){V||Te(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(Q.is(":disabled")||!0===x.disabled)&&_e(),J.click(g),oe.change(Oe),oe.bind("paste",function(){setTimeout(Oe,1)}),oe.keydown(function(e){13==e.keyCode&&Oe()}),le.text(x.cancelText),le.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),qe("cancel")}),ce.attr("title",x.clearText),ce.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),ke=!0,De(),k&&Ke(!0)}),fe.text(x.chooseText),fe.bind("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),oe.hasClass("sp-validation-error")||(Ke(!0),qe())}),v(ae,function(e,t,r){z=e/N,ke=!1,r.shiftKey&&(z=Math.round(10*z)/10),De()},Re,Me),v(ee,function(e,t){j=parseFloat(t/T),ke=!1,x.showAlpha||(z=1),De()},Re,Me),v(U,function(e,t,r){if(r.shiftKey){if(!Y){var a=D*R,n=M-I*M,o=Math.abs(e-a)>Math.abs(t-n);Y=o?"x":"y"}}else Y=null;var s=!Y||"y"===Y;(!Y||"x"===Y)&&(D=parseFloat(e/R)),s&&(I=parseFloat((M-t)/M)),ke=!1,x.showAlpha||(z=1),De()},Re,Me),ve?(Ee(ve),Ie(),we=ye||tinycolor(ve).format,He(ve)):Ie(),k&&Ne();var a=s?"mousedown.spectrum":"click.spectrum touchstart.spectrum";se.delegate(".sp-thumb-el",a,r),ie.delegate(".sp-thumb-el:nth-child(1)",a,{ignore:!0},r)}();var Be={show:Ne,hide:qe,toggle:Te,reflow:$e,option:function(e,a){return e===r?t.extend({},x):a===r?x[e]:(x[e]=a,void Ce())},enable:function(){V=!1,Q.attr("disabled",!1),ge.removeClass("sp-disabled")},disable:_e,set:function(e){Ee(e),Ke()},get:je,destroy:function(){Q.show(),ge.unbind("click.spectrum touchstart.spectrum"),J.remove(),pe.remove(),o[Be.id]=null},container:J};return Be.id=o.push(Be)-1,Be}function p(){}function g(e){e.stopPropagation()}function b(e,t){var r=Array.prototype.slice,a=r.call(arguments,2);return function(){return e.apply(t,a.concat(r.call(arguments)))}}function v(r,a,n,o){a=a||function(){},n=n||function(){},o=o||function(){};var i=r.ownerDocument||document,l=!1,c={},f=0,u=0,d="ontouchstart"in e,h={};function p(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function g(e){if(l){if(s&&document.documentMode<9&&!e.button)return b();var t=e.originalEvent.touches,n=t?t[0].pageX:e.pageX,o=t?t[0].pageY:e.pageY,i=Math.max(0,Math.min(n-c.left,u)),h=Math.max(0,Math.min(o-c.top,f));d&&p(e),a.apply(r,[i,h,e])}}function b(){l&&(t(i).unbind(h),t(i.body).removeClass("sp-dragging"),o.apply(r,arguments)),l=!1}h.selectstart=p,h.dragstart=p,h["touchmove mousemove"]=g,h["touchend mouseup"]=b,t(r).bind("touchstart mousedown",function(e){var a=e.which?3==e.which:2==e.button;e.originalEvent.touches,a||l||!1!==n.apply(r,arguments)&&(l=!0,f=t(r).height(),u=t(r).width(),c=t(r).offset(),t(i).bind(h),t(i.body).addClass("sp-dragging"),d||g(e),p(e))})}t.fn.spectrum=function(e,r){if("string"==typeof e){var a=this,n=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=o[t(this).data("spectrum.id")];if(r){var s=r[e];if(!s)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?a=r.get():"container"==e?a=r.container:"option"==e?a=r.option.apply(r,n):"destroy"==e?(r.destroy(),t(this).removeData("spectrum.id")):s.apply(r,n)}}),a}return this.spectrum("destroy").each(function(){var r=h(this,t.extend({},e,t(this).data()));t(this).data("spectrum.id",r.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=v,t.fn.spectrum.defaults=n,t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){c||t("input[type=color]").spectrum({preferredFormat:"hex6"})},function(){var t=/^[\s,#]+/,r=/\s+$/,a=0,n=Math,o=n.round,s=n.min,i=n.max,l=n.random;function c(e,l){if(l=l||{},"object"==typeof(e=e||"")&&e.hasOwnProperty("_tc_id"))return e;var m=function(e){var a={r:0,g:0,b:0},o=1,l=!1,c=!1;"string"==typeof e&&(e=function(e){e=e.replace(t,"").replace(r,"").toLowerCase();var a,n=!1;if(p[e])e=p[e],n=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};if(a=P.rgb.exec(e))return{r:a[1],g:a[2],b:a[3]};if(a=P.rgba.exec(e))return{r:a[1],g:a[2],b:a[3],a:a[4]};if(a=P.hsl.exec(e))return{h:a[1],s:a[2],l:a[3]};if(a=P.hsla.exec(e))return{h:a[1],s:a[2],l:a[3],a:a[4]};if(a=P.hsv.exec(e))return{h:a[1],s:a[2],v:a[3]};if(a=P.hex8.exec(e))return{a:(o=a[1],y(o)/255),r:y(a[2]),g:y(a[3]),b:y(a[4]),format:n?"name":"hex8"};var o;if(a=P.hex6.exec(e))return{r:y(a[1]),g:y(a[2]),b:y(a[3]),format:n?"name":"hex"};if(a=P.hex3.exec(e))return{r:y(a[1]+""+a[1]),g:y(a[2]+""+a[2]),b:y(a[3]+""+a[3]),format:n?"name":"hex"};return!1}(e));"object"==typeof e&&(e.hasOwnProperty("r")&&e.hasOwnProperty("g")&&e.hasOwnProperty("b")?(f=e.r,u=e.g,d=e.b,a={r:255*v(f,255),g:255*v(u,255),b:255*v(d,255)},l=!0,c="%"===String(e.r).substr(-1)?"prgb":"rgb"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("v")?(e.s=x(e.s),e.v=x(e.v),a=function(e,t,r){e=6*v(e,360),t=v(t,100),r=v(r,100);var a=n.floor(e),o=e-a,s=r*(1-t),i=r*(1-o*t),l=r*(1-(1-o)*t),c=a%6;return{r:255*[r,i,s,s,l,r][c],g:255*[l,r,r,i,s,s][c],b:255*[s,s,l,r,r,i][c]}}(e.h,e.s,e.v),l=!0,c="hsv"):e.hasOwnProperty("h")&&e.hasOwnProperty("s")&&e.hasOwnProperty("l")&&(e.s=x(e.s),e.l=x(e.l),a=function(e,t,r){var a,n,o;function s(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=v(e,360),t=v(t,100),r=v(r,100),0===t)a=n=o=r;else{var i=r<.5?r*(1+t):r+t-r*t,l=2*r-i;a=s(l,i,e+1/3),n=s(l,i,e),o=s(l,i,e-1/3)}return{r:255*a,g:255*n,b:255*o}}(e.h,e.s,e.l),l=!0,c="hsl"),e.hasOwnProperty("a")&&(o=e.a));var f,u,d;return o=b(o),{ok:l,format:e.format||c,r:s(255,i(a.r,0)),g:s(255,i(a.g,0)),b:s(255,i(a.b,0)),a:o}}(e),w=m.r,k=m.g,S=m.b,C=m.a,H=o(100*C)/100,A=l.format||m.format;return w<1&&(w=o(w)),k<1&&(k=o(k)),S<1&&(S=o(S)),{ok:m.ok,format:A,_tc_id:a++,alpha:C,getAlpha:function(){return C},setAlpha:function(e){C=b(e),H=o(100*C)/100},toHsv:function(){var e=u(w,k,S);return{h:360*e.h,s:e.s,v:e.v,a:C}},toHsvString:function(){var e=u(w,k,S),t=o(360*e.h),r=o(100*e.s),a=o(100*e.v);return 1==C?"hsv("+t+", "+r+"%, "+a+"%)":"hsva("+t+", "+r+"%, "+a+"%, "+H+")"},toHsl:function(){var e=f(w,k,S);return{h:360*e.h,s:e.s,l:e.l,a:C}},toHslString:function(){var e=f(w,k,S),t=o(360*e.h),r=o(100*e.s),a=o(100*e.l);return 1==C?"hsl("+t+", "+r+"%, "+a+"%)":"hsla("+t+", "+r+"%, "+a+"%, "+H+")"},toHex:function(e){return d(w,k,S,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return h(w,k,S,C)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:o(w),g:o(k),b:o(S),a:C}},toRgbString:function(){return 1==C?"rgb("+o(w)+", "+o(k)+", "+o(S)+")":"rgba("+o(w)+", "+o(k)+", "+o(S)+", "+H+")"},toPercentageRgb:function(){return{r:o(100*v(w,255))+"%",g:o(100*v(k,255))+"%",b:o(100*v(S,255))+"%",a:C}},toPercentageRgbString:function(){return 1==C?"rgb("+o(100*v(w,255))+"%, "+o(100*v(k,255))+"%, "+o(100*v(S,255))+"%)":"rgba("+o(100*v(w,255))+"%, "+o(100*v(k,255))+"%, "+o(100*v(S,255))+"%, "+H+")"},toName:function(){return 0===C?"transparent":g[d(w,k,S,!0)]||!1},toFilter:function(e){var t="#"+h(w,k,S,C),r=t,a=l&&l.gradientType?"GradientType = 1, ":"";e&&(r=c(e).toHex8String());return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this.format;var r=!1,a=!t&&C<1&&C>0&&("hex"===e||"hex6"===e||"hex3"===e||"name"===e);return"rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),a?this.toRgbString():r||this.toHexString()}}}function f(e,t,r){e=v(e,255),t=v(t,255),r=v(r,255);var a,n,o=i(e,t,r),l=s(e,t,r),c=(o+l)/2;if(o==l)a=n=0;else{var f=o-l;switch(n=c>.5?f/(2-o-l):f/(o+l),o){case e:a=(t-r)/f+(t<r?6:0);break;case t:a=(r-e)/f+2;break;case r:a=(e-t)/f+4}a/=6}return{h:a,s:n,l:c}}function u(e,t,r){e=v(e,255),t=v(t,255),r=v(r,255);var a,n,o=i(e,t,r),l=s(e,t,r),c=o,f=o-l;if(n=0===o?0:f/o,o==l)a=0;else{switch(o){case e:a=(t-r)/f+(t<r?6:0);break;case t:a=(r-e)/f+2;break;case r:a=(e-t)/f+4}a/=6}return{h:a,s:n,v:c}}function d(e,t,r,a){var n=[w(o(e).toString(16)),w(o(t).toString(16)),w(o(r).toString(16))];return a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function h(e,t,r,a){var n;return[w((n=a,Math.round(255*parseFloat(n)).toString(16))),w(o(e).toString(16)),w(o(t).toString(16)),w(o(r).toString(16))].join("")}c.fromRatio=function(e,t){if("object"==typeof e){var r={};for(var a in e)e.hasOwnProperty(a)&&(r[a]="a"===a?e[a]:x(e[a]));e=r}return c(e,t)},c.equals=function(e,t){return!(!e||!t)&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:l(),g:l(),b:l()})},c.desaturate=function(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.s-=t/100,r.s=m(r.s),c(r)},c.saturate=function(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.s+=t/100,r.s=m(r.s),c(r)},c.greyscale=function(e){return c.desaturate(e,100)},c.lighten=function(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.l+=t/100,r.l=m(r.l),c(r)},c.darken=function(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.l-=t/100,r.l=m(r.l),c(r)},c.complement=function(e){var t=c(e).toHsl();return t.h=(t.h+180)%360,c(t)},c.triad=function(e){var t=c(e).toHsl(),r=t.h;return[c(e),c({h:(r+120)%360,s:t.s,l:t.l}),c({h:(r+240)%360,s:t.s,l:t.l})]},c.tetrad=function(e){var t=c(e).toHsl(),r=t.h;return[c(e),c({h:(r+90)%360,s:t.s,l:t.l}),c({h:(r+180)%360,s:t.s,l:t.l}),c({h:(r+270)%360,s:t.s,l:t.l})]},c.splitcomplement=function(e){var t=c(e).toHsl(),r=t.h;return[c(e),c({h:(r+72)%360,s:t.s,l:t.l}),c({h:(r+216)%360,s:t.s,l:t.l})]},c.analogous=function(e,t,r){t=t||6,r=r||30;var a=c(e).toHsl(),n=360/r,o=[c(e)];for(a.h=(a.h-(n*t>>1)+720)%360;--t;)a.h=(a.h+n)%360,o.push(c(a));return o},c.monochromatic=function(e,t){t=t||6;for(var r=c(e).toHsv(),a=r.h,n=r.s,o=r.v,s=[],i=1/t;t--;)s.push(c({h:a,s:n,v:o})),o=(o+i)%1;return s},c.readability=function(e,t){var r=c(e).toRgb(),a=c(t).toRgb(),n=(299*r.r+587*r.g+114*r.b)/1e3,o=(299*a.r+587*a.g+114*a.b)/1e3,s=Math.max(r.r,a.r)-Math.min(r.r,a.r)+Math.max(r.g,a.g)-Math.min(r.g,a.g)+Math.max(r.b,a.b)-Math.min(r.b,a.b);return{brightness:Math.abs(n-o),color:s}},c.readable=function(e,t){var r=c.readability(e,t);return r.brightness>125&&r.color>500},c.mostReadable=function(e,t){for(var r=null,a=0,n=!1,o=0;o<t.length;o++){var s=c.readability(e,t[o]),i=s.brightness>125&&s.color>500,l=s.brightness/125*3+s.color/500;(i&&!n||i&&n&&l>a||!i&&!n&&l>a)&&(n=i,a=l,r=c(t[o]))}return r};var p=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},g=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(p);function b(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function v(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var r=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=s(t,i(0,parseFloat(e))),r&&(e=parseInt(e*t,10)/100),n.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function m(e){return s(1,i(0,e))}function y(e){return parseInt(e,16)}function w(e){return 1==e.length?"0"+e:""+e}function x(e){return e<=1&&(e=100*e+"%"),e}var k,S,C,P=(S="[\\s|\\(]+("+(k="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",C="[\\s|\\(]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")[,|\\s]+("+k+")\\s*\\)?",{rgb:new RegExp("rgb"+S),rgba:new RegExp("rgba"+C),hsl:new RegExp("hsl"+S),hsla:new RegExp("hsla"+C),hsv:new RegExp("hsv"+S),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});e.tinycolor=c}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})}(window,jQuery);
includes/options/redux-core/framework.php CHANGED
@@ -3279,7 +3279,7 @@
3279
  if ( ! $display ) {
3280
  continue;
3281
  }
3282
-
3283
  $hide_sub = '';
3284
  if ( isset ( $sections[ $nextK ]['hidden'] ) ) {
3285
  $hide_sub = ( $sections[ $nextK ]['hidden'] == true ) ? ' hidden ' : '';
3279
  if ( ! $display ) {
3280
  continue;
3281
  }
3282
+ $sections[ $nextK ] = apply_filters('ampforwp_remove_unused_options',$sections[ $nextK ]);
3283
  $hide_sub = '';
3284
  if ( isset ( $sections[ $nextK ]['hidden'] ) ) {
3285
  $hide_sub = ( $sections[ $nextK ]['hidden'] == true ) ? ' hidden ' : '';
includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.css CHANGED
@@ -1 +0,0 @@
1
- #redux-import-link-wrapper,#redux-import-code-wrapper{display:none}#redux-export-code,#redux-export-link-value{display:none}#redux-import-action span{color:#B94A48}
 
includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.js CHANGED
@@ -38,136 +38,9 @@
38
  redux.args.ajax_save = false;
39
  }
40
  );
41
-
42
- $( this ).find( '#redux-import-code-button' ).click(
43
- function() {
44
- var $el = $( '#redux-import-code-wrapper' );
45
- if ( $( '#redux-import-link-wrapper' ).is( ':visible' ) ) {
46
- $( '#import-link-value' ).text( '' );
47
- $( '#redux-import-link-wrapper' ).slideUp(
48
- 'fast', function() {
49
- $el.slideDown(
50
- 'fast', function() {
51
- $( '#import-code-value' ).focus();
52
- }
53
- );
54
- }
55
- );
56
- } else {
57
- if ( $el.is( ':visible' ) ) {
58
- $el.slideUp();
59
- } else {
60
- $el.slideDown(
61
- 'medium', function() {
62
- $( '#import-code-value' ).focus();
63
- }
64
- );
65
- }
66
- }
67
- }
68
- );
69
-
70
- $( this ).find( '#redux-import-link-button' ).click(
71
- function() {
72
- var $el = $( '#redux-import-link-wrapper' );
73
- if ( $( '#redux-import-code-wrapper' ).is( ':visible' ) ) {
74
- $( '#import-code-value' ).text( '' );
75
- $( '#redux-import-code-wrapper' ).slideUp(
76
- 'fast', function() {
77
- $el.slideDown(
78
- 'fast', function() {
79
- $( '#import-link-value' ).focus();
80
- }
81
- );
82
- }
83
- );
84
- } else {
85
- if ( $el.is( ':visible' ) ) {
86
- $el.slideUp();
87
- } else {
88
- $el.slideDown(
89
- 'medium', function() {
90
- $( '#import-link-value' ).focus();
91
- }
92
- );
93
- }
94
- }
95
- }
96
- );
97
-
98
- $( this ).find( '#redux-export-code-copy' ).click(
99
- function() {
100
- var $el = $( '#redux-export-code' );
101
- if ( $( '#redux-export-link-value' ).is( ':visible' ) ) {
102
- $( '#redux-export-link-value' ).slideUp(
103
- 'fast', function() {
104
- $el.slideDown(
105
- 'medium', function() {
106
- var options = redux.options;
107
- options['redux-backup'] = 1;
108
- $( this ).text( JSON.stringify( options ) ).focus().select();
109
- }
110
- );
111
- }
112
- );
113
- } else {
114
- if ( $el.is( ':visible' ) ) {
115
- $el.slideUp().text( '' );
116
- } else {
117
- $el.slideDown(
118
- 'medium', function() {
119
- var options = redux.options;
120
- options['redux-backup'] = 1;
121
- $( this ).text( JSON.stringify( options ) ).focus().select();
122
- }
123
- );
124
- }
125
- }
126
- }
127
- );
128
-
129
- $( this ).find( 'textarea' ).focusout(
130
- function() {
131
- var $id = $( this ).attr( 'id' );
132
- var $el = $( this );
133
- var $container = $el;
134
- if ( $id == "import-link-value" || $id == "import-code-value" ) {
135
- $container = $( this ).parent();
136
- }
137
- $container.slideUp(
138
- 'medium', function() {
139
- if ( $id != "redux-export-link-value" ) {
140
- $el.text( '' );
141
- }
142
- }
143
- );
144
- }
145
- );
146
-
147
-
148
- $( this ).find( '#redux-export-link' ).click(
149
- function() {
150
- var $el = $( '#redux-export-link-value' );
151
- if ( $( '#redux-export-code' ).is( ':visible' ) ) {
152
- $( '#redux-export-code' ).slideUp(
153
- 'fast', function() {
154
- $el.slideDown().focus().select();
155
- }
156
- );
157
- } else {
158
- if ( $el.is( ':visible' ) ) {
159
- $el.slideUp();
160
- } else {
161
- $el.slideDown(
162
- 'medium', function() {
163
- $( this ).focus().select();
164
- }
165
- );
166
- }
167
-
168
- }
169
- }
170
- );
171
 
172
  var textBox1 = document.getElementById( "redux-export-code" );
173
  textBox1.onfocus = function() {
38
  redux.args.ajax_save = false;
39
  }
40
  );
41
+ var options = redux.options;
42
+ options['redux-backup'] = 1;
43
+ $( '#redux-export-code' ).text( JSON.stringify( options ) ).focus().select();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
  var textBox1 = document.getElementById( "redux-export-code" );
46
  textBox1.onfocus = function() {
includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.min.js CHANGED
@@ -1 +1 @@
1
- !function(a){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.import_export=redux.field_objects.import_export||{},redux.field_objects.import_export.init=function(b){b||(b=a(document).find(".redux-group-tab:visible").find(".redux-container-import_export:visible")),a(b).each(function(){var b=a(this),c=b;b.hasClass("redux-field-container")||(c=b.parents(".redux-field-container:first")),c.is(":hidden")||c.hasClass("redux-field-init")&&(c.removeClass("redux-field-init"),b.each(function(){a("#redux-import").click(function(b){return""===a("#import-code-value").val()&&""===a("#import-link-value").val()?(b.preventDefault(),!1):(window.onbeforeunload=null,void(redux.args.ajax_save=!1))}),a(this).find("#redux-import-code-button").click(function(){var b=a("#redux-import-code-wrapper");a("#redux-import-link-wrapper").is(":visible")?(a("#import-link-value").text(""),a("#redux-import-link-wrapper").slideUp("fast",function(){b.slideDown("fast",function(){a("#import-code-value").focus()})})):b.is(":visible")?b.slideUp():b.slideDown("medium",function(){a("#import-code-value").focus()})}),a(this).find("#redux-import-link-button").click(function(){var b=a("#redux-import-link-wrapper");a("#redux-import-code-wrapper").is(":visible")?(a("#import-code-value").text(""),a("#redux-import-code-wrapper").slideUp("fast",function(){b.slideDown("fast",function(){a("#import-link-value").focus()})})):b.is(":visible")?b.slideUp():b.slideDown("medium",function(){a("#import-link-value").focus()})}),a(this).find("#redux-export-code-copy").click(function(){var b=a("#redux-export-code");a("#redux-export-link-value").is(":visible")?a("#redux-export-link-value").slideUp("fast",function(){b.slideDown("medium",function(){var b=redux.options;b["redux-backup"]=1,a(this).text(JSON.stringify(b)).focus().select()})}):b.is(":visible")?b.slideUp().text(""):b.slideDown("medium",function(){var b=redux.options;b["redux-backup"]=1,a(this).text(JSON.stringify(b)).focus().select()})}),a(this).find("textarea").focusout(function(){var b=a(this).attr("id"),c=a(this),d=c;("import-link-value"==b||"import-code-value"==b)&&(d=a(this).parent()),d.slideUp("medium",function(){"redux-export-link-value"!=b&&c.text("")})}),a(this).find("#redux-export-link").click(function(){var b=a("#redux-export-link-value");a("#redux-export-code").is(":visible")?a("#redux-export-code").slideUp("fast",function(){b.slideDown().focus().select()}):b.is(":visible")?b.slideUp():b.slideDown("medium",function(){a(this).focus().select()})});var b=document.getElementById("redux-export-code");b.onfocus=function(){b.select(),b.onmouseup=function(){return b.onmouseup=null,!1}};var c=document.getElementById("import-code-value");c.onfocus=function(){c.select(),c.onmouseup=function(){return c.onmouseup=null,!1}}}))})}}(jQuery);
1
+ !function(e){"use strict";redux.field_objects=redux.field_objects||{},redux.field_objects.import_export=redux.field_objects.import_export||{},redux.field_objects.import_export.init=function(i){i||(i=e(document).find(".redux-group-tab:visible").find(".redux-container-import_export:visible")),e(i).each(function(){var i=e(this),t=i;i.hasClass("redux-field-container")||(t=i.parents(".redux-field-container:first")),t.is(":hidden")||t.hasClass("redux-field-init")&&(t.removeClass("redux-field-init"),i.each(function(){e("#redux-import").click(function(i){return""===e("#import-code-value").val()&&""===e("#import-link-value").val()?(i.preventDefault(),!1):(window.onbeforeunload=null,void(redux.args.ajax_save=!1))}),e(this).find("#redux-import-code-button").click(function(){var i=e("#redux-import-code-wrapper");e("#redux-import-link-wrapper").is(":visible")?(e("#import-link-value").text(""),e("#redux-import-link-wrapper").slideUp("fast",function(){i.slideDown("fast",function(){e("#import-code-value").focus()})})):i.is(":visible")?i.slideUp():i.slideDown("medium",function(){e("#import-code-value").focus()})}),e(this).find("#redux-import-link-button").click(function(){var i=e("#redux-import-link-wrapper");e("#redux-import-code-wrapper").is(":visible")?(e("#import-code-value").text(""),e("#redux-import-code-wrapper").slideUp("fast",function(){i.slideDown("fast",function(){e("#import-link-value").focus()})})):i.is(":visible")?i.slideUp():i.slideDown("medium",function(){e("#import-link-value").focus()})}),e(this).find("#redux-export-code-copy").click(function(){var i=e("#redux-export-code");e("#redux-export-link-value").is(":visible")?e("#redux-export-link-value").slideUp("fast",function(){i.slideDown("medium",function(){var i=redux.options;i["redux-backup"]=1,e(this).text(JSON.stringify(i)).focus().select()})}):i.is(":visible")?i.slideUp().text(""):i.slideDown("medium",function(){var i=redux.options;i["redux-backup"]=1,e(this).text(JSON.stringify(i)).focus().select()})}),e(this).find("textarea").focusout(function(){e(this).attr("id"),e(this)}),e(this).find("#redux-export-link").click(function(){var i=e("#redux-export-link-value");e("#redux-export-code").is(":visible")?e("#redux-export-code").slideUp("fast",function(){i.slideDown().focus().select()}):i.is(":visible")?i.slideUp():i.slideDown("medium",function(){e(this).focus().select()})});var i=document.getElementById("redux-export-code");i.onfocus=function(){i.select(),i.onmouseup=function(){return i.onmouseup=null,!1}};var t=document.getElementById("import-code-value");t.onfocus=function(){t.select(),t.onmouseup=function(){return t.onmouseup=null,!1}},e("#redux-import-from-file").click(function(){e("#redux-import-file-type").trigger("click")}),e("#redux-import-file-type").on("change",function(){if(1==confirm("Are you sure! You want import the file. Please make sure to take backup of your AMP Settings before importing, it will override your AMP Settings.")){var i=e("#ampforwp_import_nonce").val(),t=e("#redux-import-file-type").prop("files")[0],o=new FormData;o.append("file",t),o.append("action","ampforwp_import_file_from_file"),o.append("security",i),e.ajax({url:ajaxurl,cache:!1,contentType:!1,processData:!1,data:o,type:"post",success:function(i){"0"!=i?(e("#import-code-value").hide(),e("#import-code-value").val(i),e("#redux-import").trigger("click")):e("#admin-import-file-name").html("Unable to import the file.")}})}else location.reload()})}))})}}(jQuery);
includes/options/redux-core/inc/extensions/import_export/import_export/field_import_export.php CHANGED
@@ -93,36 +93,7 @@ namespace ReduxCore\ReduxFramework;
93
 
94
  // $this->field['type'] && $this->field['id'] is sanitized in the ReduxFramework class, no need to re-sanitize it.
95
  ?>
96
- <h4><?php esc_html_e( 'Import Options', 'redux-framework' ); ?></h4>
97
-
98
- <p>
99
- <a href="javascript:void(0);" id="redux-import-code-button" class="button-secondary">
100
- <?php esc_html_e( 'Import from File', 'redux-framework' ); ?>
101
- </a>
102
- <a href="javascript:void(0);" id="redux-import-link-button" class="button-secondary">
103
- <?php esc_html_e( 'Import from URL', 'redux-framework' ) ?>
104
- </a>
105
- </p>
106
-
107
- <div id="redux-import-code-wrapper">
108
- <p class="description" id="import-code-description">
109
- <?php echo esc_html( apply_filters( 'redux-import-file-description', __( 'Input your backup file below and hit Import to restore your sites options from a backup.', 'accelerated-mobile-pages' ) ) ); ?>
110
- </p>
111
- <?php // $this->parent->args['opt_name'] is sanitized in the ReduxFramework class, no need to re-sanitize it. ?>
112
- <textarea id="import-code-value" name="<?php echo $this->parent->args['opt_name']; ?>[import_code]" class="large-text noUpdate" rows="2"></textarea>
113
- </div>
114
-
115
- <div id="redux-import-link-wrapper">
116
- <p class="description" id="import-link-description"><?php echo esc_html( apply_filters( 'redux-import-link-description', __( 'Input the URL to another sites options set and hit Import to load the options from that site.', 'accelerated-mobile-pages' ) ) ); ?></p>
117
- <?php // $this->parent->args['opt_name'] is sanitized in the ReduxFramework class, no need to re-sanitize it. ?>
118
- <textarea class="large-text noUpdate" id="import-link-value" name="<?php echo $this->parent->args['opt_name'] ?>[import_link]" rows="2"></textarea>
119
- </div>
120
-
121
- <p id="redux-import-action"><input type="submit" id="redux-import" name="import" class="button-primary" value="<?php esc_html_e( 'Import', 'redux-framework' ) ?>">&nbsp;&nbsp;<span><?php echo esc_html( apply_filters( 'redux-import-warning', __( 'WARNING! This will overwrite all existing option values, please proceed with caution!', 'redux-framework' ) ) ) ?></span></p>
122
-
123
- <div class="hr"/>
124
- <div class="inner"><span>&nbsp;</span></div></div>
125
- <h4><?php esc_html_e( 'Export Options', 'redux-framework' ) ?></h4>
126
 
127
  <div class="redux-section-desc">
128
  <p class="description">
@@ -133,15 +104,37 @@ namespace ReduxCore\ReduxFramework;
133
  // $this->parent->args['opt_name'] is sanitized in the ReduxFramework class, no need to re-sanitize it.
134
  $link = esc_url( admin_url( 'admin-ajax.php?action=redux_download_options-' . $this->parent->args['opt_name'] . '&secret=' . $secret ) );
135
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  <p>
137
- <a href="javascript:void(0);" id="redux-export-code-copy" class="button-secondary"><?php esc_html_e( 'Copy Data', 'redux-framework' ) ?></a>
138
- <a href="<?php echo $link; ?>" id="redux-export-code-dl" class="button-primary"><?php esc_html_e( 'Download Data File', 'redux-framework' ) ?></a>
139
- <a href="javascript:void(0);" id="redux-export-link" class="button-secondary"><?php esc_html_e( 'Copy Export URL', 'redux-framework' ) ?></a>
140
  </p>
141
 
142
  <p></p>
143
- <textarea class="large-text noUpdate" id="redux-export-code" rows="2"></textarea>
144
- <textarea class="large-text noUpdate" id="redux-export-link-value" data-url="<?php echo $link; ?>" rows="2"><?php echo $link; ?></textarea>
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  <?php
147
  }
93
 
94
  // $this->field['type'] && $this->field['id'] is sanitized in the ReduxFramework class, no need to re-sanitize it.
95
  ?>
96
+ <h4><?php esc_html_e( 'Export Options', 'redux-framework' ) ?></h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
  <div class="redux-section-desc">
99
  <p class="description">
104
  // $this->parent->args['opt_name'] is sanitized in the ReduxFramework class, no need to re-sanitize it.
105
  $link = esc_url( admin_url( 'admin-ajax.php?action=redux_download_options-' . $this->parent->args['opt_name'] . '&secret=' . $secret ) );
106
  ?>
107
+ <p><?php esc_html_e( 'Copy Data To Export All Your Settings', 'redux-framework' ) ?></p>
108
+ <p></p>
109
+ <?php
110
+ $backup_options = get_option('redux_builder_amp');
111
+ $backup_options['redux-backup'] = '1';
112
+ $content = json_encode( $backup_options );
113
+ ?>
114
+ <textarea class="large-text noUpdate" id="redux-export-code" rows="10" readonly="true"><?php echo $content;?></textarea>
115
+ <a href="<?php echo $link; ?>" id="redux-export-code-dl" class="button-primary"><?php esc_html_e( 'Download Data File', 'redux-framework' ) ?></a>
116
+ <p class="description">
117
+ <?php echo esc_html( apply_filters( 'redux-backup-description', __( 'Download a backup file of your settings', 'accelerated-mobile-pages' ) ) ) ?>
118
+ </p>
119
+ <h4><?php esc_html_e( 'Import Options', 'redux-framework' ); ?></h4>
120
  <p>
121
+ <?php esc_html_e( 'Paste The Code Here To Import Your Settings', 'redux-framework' ); ?>
 
 
122
  </p>
123
 
124
  <p></p>
125
+ <div id="redux-import-code-wrapper">
126
+ <textarea id="import-code-value" name="<?php echo $this->parent->args['opt_name']; ?>[import_code]" class="large-text noUpdate" rows="10"></textarea>
127
+ </div>
128
+ <p id="redux-import-action">
129
+ <input type="submit" id="redux-import" name="import" class="button-primary" value="<?php esc_html_e( 'Import', 'redux-framework' ) ?>">&nbsp;&nbsp;
130
+ <input type="button" id="redux-import-from-file" name="import_from_file" class="button-primary" value="<?php esc_html_e( 'Import From File', 'redux-framework' ) ?>">&nbsp;&nbsp;
131
+ <input type="file" id="redux-import-file-type" accept=".json">
132
+ <input type="hidden" id="ampforwp_import_nonce" value="<?php $nonce = wp_create_nonce('ampforwp_import_file'); echo $nonce;?>">
133
+ <span><?php echo esc_html( apply_filters( 'redux-import-warning', esc_html__( 'WARNING! This will overwrite all existing option values, please proceed with caution!', 'redux-framework' ) ) ) ?></span></p>
134
+ <p id="admin-import-file-name"></p>
135
+
136
+ <div class="hr"/>
137
+ <div class="inner"><span>&nbsp;</span></div></div>
138
 
139
  <?php
140
  }
includes/vendor/amp/includes/class-amp-post-template.php CHANGED
@@ -35,6 +35,14 @@ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-wistia-embed.php'
35
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-core-block-handler.php' );
36
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-playlist-embed-handler.php' );
37
 
 
 
 
 
 
 
 
 
38
  class AMP_Post_Template {
39
  const SITE_ICON_SIZE = 32;
40
  const CONTENT_MAX_WIDTH = 600;
35
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-core-block-handler.php' );
36
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-playlist-embed-handler.php' );
37
 
38
+ if ( file_exists( AMPFORWP_PLUGIN_DIR .'includes/vendor/css-parser/autoload.php' ) ) {
39
+ require_once AMPFORWP_PLUGIN_DIR .'includes/vendor/css-parser/autoload.php';
40
+ }
41
+
42
+ require_once( AMP__VENDOR__DIR__ . 'includes/sanitizers/class-amp-tree-style-sanitizer.php' );
43
+
44
+ require_once( AMPFORWP_PLUGIN_DIR . 'includes/vendor/css-parser/parser-helper-function.php' );
45
+
46
  class AMP_Post_Template {
47
  const SITE_ICON_SIZE = 32;
48
  const CONTENT_MAX_WIDTH = 600;
includes/vendor/amp/includes/sanitizers/class-amp-allowed-tags-generated.php CHANGED
@@ -699,6 +699,37 @@ class AMP_Allowed_Tags_Generated {
699
  ),
700
  ),
701
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
702
  'amp-consent' => array(
703
  array(
704
  'attr_spec_list' => array(
699
  ),
700
  ),
701
  ),
702
+ 'amp-connatix-player' => array(
703
+ array(
704
+ 'attr_spec_list' => array(
705
+ 'data-player-id' => array(
706
+ 'mandatory' => true,
707
+ ),
708
+ 'media' => array(),
709
+ 'noloading' => array(
710
+ 'value' => array(
711
+ '',
712
+ ),
713
+ ),
714
+ ),
715
+ 'tag_spec' => array(
716
+ 'amp_layout' => array(
717
+ 'supported_layouts' => array(
718
+ 6,
719
+ 2,
720
+ 3,
721
+ 7,
722
+ 1,
723
+ 4,
724
+ ),
725
+ ),
726
+ 'requires_extension' => array(
727
+ 'amp-connatix-player',
728
+ ),
729
+ 'spec_url' => 'https://www.ampproject.org/docs/reference/components/amp-connatix-player',
730
+ ),
731
+ ),
732
+ ),
733
  'amp-consent' => array(
734
  array(
735
  'attr_spec_list' => array(
includes/vendor/amp/includes/sanitizers/class-amp-iframe-sanitizer.php CHANGED
@@ -7,7 +7,7 @@ require_once( AMP__VENDOR__DIR__ . '/includes/sanitizers/class-amp-base-sanitize
7
  */
8
  class AMP_Iframe_Sanitizer extends AMP_Base_Sanitizer {
9
  const FALLBACK_HEIGHT = 400;
10
- const SANDBOX_DEFAULTS = 'allow-scripts allow-same-origin allow-popups allow-forms';
11
 
12
  public static $tag = 'iframe';
13
 
7
  */
8
  class AMP_Iframe_Sanitizer extends AMP_Base_Sanitizer {
9
  const FALLBACK_HEIGHT = 400;
10
+ const SANDBOX_DEFAULTS = 'allow-scripts allow-same-origin allow-popups allow-forms allow-top-navigation';
11
 
12
  public static $tag = 'iframe';
13
 
includes/vendor/amp/includes/sanitizers/class-amp-tree-base-sanitizer.php ADDED
@@ -0,0 +1,584 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace AMPforWP\AMPVendor;
3
+ /**
4
+ * Class AMP_Base_Sanitizer
5
+ *
6
+ * @package AMP
7
+ */
8
+
9
+ /**
10
+ * Class AMP_Base_Sanitizer
11
+ */
12
+ abstract class AMP_tree_Base_Sanitizer {
13
+
14
+ /**
15
+ * Value used with the height attribute in an $attributes parameter is empty.
16
+ *
17
+ * @since 0.3.3
18
+ *
19
+ * @const int
20
+ */
21
+ const FALLBACK_HEIGHT = 400;
22
+
23
+ /**
24
+ * Value for <amp-image-lightbox> ID.
25
+ *
26
+ * @since 1.0
27
+ *
28
+ * @const string
29
+ */
30
+ const AMP_IMAGE_LIGHTBOX_ID = 'amp-image-lightbox';
31
+
32
+ /**
33
+ * Placeholder for default args, to be set in child classes.
34
+ *
35
+ * @since 0.2
36
+ *
37
+ * @var array
38
+ */
39
+ protected $DEFAULT_ARGS = array();
40
+
41
+ /**
42
+ * DOM.
43
+ *
44
+ * @var DOMDocument A standard PHP representation of an HTML document in object form.
45
+ *
46
+ * @since 0.2
47
+ */
48
+ protected $dom;
49
+
50
+ /**
51
+ * Array of flags used to control sanitization.
52
+ *
53
+ * @var array {
54
+ * @type int $content_max_width
55
+ * @type bool $add_placeholder
56
+ * @type bool $use_document_element
57
+ * @type bool $require_https_src
58
+ * @type string[] $amp_allowed_tags
59
+ * @type string[] $amp_globally_allowed_attributes
60
+ * @type string[] $amp_layout_allowed_attributes
61
+ * @type array $amp_allowed_tags
62
+ * @type array $amp_globally_allowed_attributes
63
+ * @type array $amp_layout_allowed_attributes
64
+ * @type array $amp_bind_placeholder_prefix
65
+ * @type bool $allow_dirty_styles
66
+ * @type bool $allow_dirty_scripts
67
+ * @type bool $should_locate_sources
68
+ * @type callable $validation_error_callback
69
+ * }
70
+ */
71
+ protected $args;
72
+
73
+ /**
74
+ * Flag to be set in child class' sanitize() method indicating if the
75
+ * HTML contained in the DOMDocument has been sanitized yet or not.
76
+ *
77
+ * @since 0.2
78
+ *
79
+ * @var bool
80
+ */
81
+ protected $did_convert_elements = false;
82
+
83
+ /**
84
+ * The root element used for sanitization. Either html or body.
85
+ *
86
+ * @var DOMElement
87
+ */
88
+ protected $root_element;
89
+
90
+ /**
91
+ * Keep track of nodes that should not be removed to prevent duplicated validation errors since sanitization is rejected.
92
+ *
93
+ * @var array
94
+ */
95
+ private $should_not_removed_nodes = array();
96
+
97
+ /**
98
+ * AMP_Base_Sanitizer constructor.
99
+ *
100
+ * @since 0.2
101
+ *
102
+ * @param DOMDocument $dom Represents the HTML document to sanitize.
103
+ * @param array $args {
104
+ * Args.
105
+ *
106
+ * @type int $content_max_width
107
+ * @type bool $add_placeholder
108
+ * @type bool $require_https_src
109
+ * @type string[] $amp_allowed_tags
110
+ * @type string[] $amp_globally_allowed_attributes
111
+ * @type string[] $amp_layout_allowed_attributes
112
+ * }
113
+ */
114
+ public function __construct( $dom, $args = array() ) {
115
+ $this->dom = $dom;
116
+ $this->args = array_merge( $this->DEFAULT_ARGS, $args );
117
+
118
+ if ( ! empty( $this->args['use_document_element'] ) ) {
119
+ $this->root_element = $this->dom->documentElement;
120
+ } else {
121
+ $this->root_element = $this->dom->getElementsByTagName( 'body' )->item( 0 );
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Add filters to manipulate output during output buffering before the DOM is constructed.
127
+ *
128
+ * Add actions and filters before the page is rendered so that the sanitizer can fix issues during output buffering.
129
+ * This provides an alternative to manipulating the DOM in the sanitize method. This is a static function because
130
+ * it is invoked before the class is instantiated, as the DOM is not available yet. This method is only called
131
+ * when 'amp' theme support is present. It is conceptually similar to the AMP_Base_Embed_Handler class's register_embed
132
+ * method.
133
+ *
134
+ * @since 1.0
135
+ * @see \AMP_Base_Embed_Handler::register_embed()
136
+ *
137
+ * @param array $args Args.
138
+ */
139
+ public static function add_buffering_hooks( $args = array() ) {}
140
+
141
+ /**
142
+ * Get mapping of HTML selectors to the AMP component selectors which they may be converted into.
143
+ *
144
+ * @return array Mapping.
145
+ */
146
+ public function get_selector_conversion_mapping() {
147
+ return array();
148
+ }
149
+
150
+ /**
151
+ * Run logic before any sanitizers are run.
152
+ *
153
+ * After the sanitizers are instantiated but before calling sanitize on each of them, this
154
+ * method is called with list of all the instantiated sanitizers.
155
+ *
156
+ * @param AMP_Base_Sanitizer[] $sanitizers Sanitizers.
157
+ */
158
+ public function init( $sanitizers ) {}
159
+
160
+ /**
161
+ * Sanitize the HTML contained in the DOMDocument received by the constructor
162
+ */
163
+ abstract public function sanitize();
164
+
165
+ /**
166
+ * Return array of values that would be valid as an HTML `script` element.
167
+ *
168
+ * Array keys are AMP element names and array values are their respective
169
+ * Javascript URLs from https://cdn.ampproject.org
170
+ *
171
+ * @since 0.2
172
+ *
173
+ * @return string[] Returns component name as array key and JavaScript URL as array value,
174
+ * respectively. Will return an empty array if sanitization has yet to be run
175
+ * or if it did not find any HTML elements to convert to AMP equivalents.
176
+ */
177
+ public function get_scripts() {
178
+ return array();
179
+ }
180
+
181
+ /**
182
+ * Return array of values that would be valid as an HTML `style` attribute.
183
+ *
184
+ * @since 0.4
185
+ * @deprecated As of 1.0, use get_stylesheets().
186
+ *
187
+ * @return array[][] Mapping of CSS selectors to arrays of properties.
188
+ */
189
+ public function get_styles() {
190
+ return array();
191
+ }
192
+
193
+ /**
194
+ * Get stylesheets.
195
+ *
196
+ * @since 0.7
197
+ * @returns array Values are the CSS stylesheets. Keys are MD5 hashes of the stylesheets.
198
+ */
199
+ public function get_stylesheets() {
200
+ $stylesheets = array();
201
+
202
+ foreach ( $this->get_styles() as $selector => $properties ) {
203
+ $stylesheet = sprintf( '%s { %s }', $selector, join( '; ', $properties ) . ';' );
204
+
205
+ $stylesheets[ md5( $stylesheet ) ] = $stylesheet;
206
+ }
207
+
208
+ return $stylesheets;
209
+ }
210
+
211
+ /**
212
+ * Get HTML body as DOMElement from DOMDocument received by the constructor.
213
+ *
214
+ * @deprecated Just reference $root_element instead.
215
+ * @return DOMElement The body element.
216
+ */
217
+ protected function get_body_node() {
218
+ return $this->dom->getElementsByTagName( 'body' )->item( 0 );
219
+ }
220
+
221
+ /**
222
+ * Sanitizes a CSS dimension specifier while being sensitive to dimension context.
223
+ *
224
+ * @param string $value A valid CSS dimension specifier; e.g. 50, 50px, 50%.
225
+ * @param string $dimension 'width' or ignored. 'width' only affects $values ending in '%'.
226
+ *
227
+ * @return float|int|string Returns a numeric dimension value, or an empty string.
228
+ */
229
+ public function sanitize_dimension( $value, $dimension ) {
230
+
231
+ // Allows 0 to be used as valid dimension.
232
+ if ( null === $value ) {
233
+ return '';
234
+ }
235
+
236
+ // Accepts both integers and floats & prevents negative values.
237
+ if ( is_numeric( $value ) ) {
238
+ return max( 0, floatval( $value ) );
239
+ }
240
+
241
+ if ( AMP_String_Utils::endswith( $value, 'px' ) ) {
242
+ return absint( $value );
243
+ }
244
+
245
+ if ( AMP_String_Utils::endswith( $value, '%' ) ) {
246
+ if ( 'width' === $dimension && isset( $this->args['content_max_width'] ) ) {
247
+ $percentage = absint( $value ) / 100;
248
+ return round( $percentage * $this->args['content_max_width'] );
249
+ }
250
+ }
251
+
252
+ return '';
253
+ }
254
+
255
+ /**
256
+ * Sets the layout, and possibly the 'height' and 'width' attributes.
257
+ *
258
+ * @param string[] $attributes {
259
+ * Attributes.
260
+ *
261
+ * @type int $height
262
+ * @type int $width
263
+ * @type string $sizes
264
+ * @type string $class
265
+ * @type string $layout
266
+ * }
267
+ * @return array Attributes.
268
+ */
269
+ public function set_layout( $attributes ) {
270
+ if ( isset( $attributes['layout'] ) && ( 'fill' === $attributes['layout'] || 'flex-item' !== $attributes['layout'] ) ) {
271
+ return $attributes;
272
+ }
273
+ if ( empty( $attributes['height'] ) ) {
274
+ unset( $attributes['width'] );
275
+ $attributes['height'] = self::FALLBACK_HEIGHT;
276
+ }
277
+ if ( empty( $attributes['width'] ) ) {
278
+ $attributes['layout'] = 'fixed-height';
279
+ }
280
+
281
+ return $attributes;
282
+ }
283
+
284
+ /**
285
+ * Adds or appends key and value to list of attributes
286
+ *
287
+ * Adds key and value to list of attributes, or if the key already exists in the array
288
+ * it concatenates to existing attribute separator by a space or other supplied separator.
289
+ *
290
+ * @param string[] $attributes {
291
+ * Attributes.
292
+ *
293
+ * @type int $height
294
+ * @type int $width
295
+ * @type string $sizes
296
+ * @type string $class
297
+ * @type string $layout
298
+ * }
299
+ * @param string $key Valid associative array index to add.
300
+ * @param string $value Value to add or append to array indexed at the key.
301
+ * @param string $separator Optional; defaults to space but some other separator if needed.
302
+ */
303
+ public function add_or_append_attribute( &$attributes, $key, $value, $separator = ' ' ) {
304
+ if ( isset( $attributes[ $key ] ) ) {
305
+ $attributes[ $key ] = trim( $attributes[ $key ] . $separator . $value );
306
+ } else {
307
+ $attributes[ $key ] = $value;
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Decide if we should remove a src attribute if https is required.
313
+ *
314
+ * If not required, the implementing class may want to try and force https instead.
315
+ *
316
+ * @param string $src URL to convert to HTTPS if forced, or made empty if $args['require_https_src'].
317
+ * @param boolean $force_https Force setting of HTTPS if true.
318
+ * @return string URL which may have been updated with HTTPS, or may have been made empty.
319
+ */
320
+ public function maybe_enforce_https_src( $src, $force_https = false ) {
321
+ $protocol = strtok( $src, ':' ); // @todo What about relative URLs? This should use wp_parse_url( $src, PHP_URL_SCHEME )
322
+ if ( 'https' !== $protocol ) {
323
+ // Check if https is required.
324
+ if ( isset( $this->args['require_https_src'] ) && true === $this->args['require_https_src'] ) {
325
+ // Remove the src. Let the implementing class decide what do from here.
326
+ $src = '';
327
+ } elseif ( ( ! isset( $this->args['require_https_src'] ) || false === $this->args['require_https_src'] )
328
+ && true === $force_https ) {
329
+ // Don't remove the src, but force https instead.
330
+ $src = set_url_scheme( $src, 'https' );
331
+ }
332
+ }
333
+
334
+ return $src;
335
+ }
336
+
337
+ /**
338
+ * Removes an invalid child of a node.
339
+ *
340
+ * Also, calls the mutation callback for it.
341
+ * This tracks all the nodes that were removed.
342
+ *
343
+ * @since 0.7
344
+ *
345
+ * @param DOMNode|DOMElement $node The node to remove.
346
+ * @param array $validation_error Validation error details.
347
+ * @return bool Whether the node should have been removed, that is, that the node was sanitized for validity.
348
+ */
349
+ public function remove_invalid_child( $node, $validation_error = array() ) {
350
+
351
+ // Prevent double-reporting nodes that are rejected for sanitization.
352
+ if ( isset( $this->should_not_removed_nodes[ $node->nodeName ] ) && in_array( $node, $this->should_not_removed_nodes[ $node->nodeName ], true ) ) {
353
+ return false;
354
+ }
355
+
356
+ $should_remove = $this->should_sanitize_validation_error( $validation_error, compact( 'node' ) );
357
+ if ( $should_remove ) {
358
+ $node->parentNode->removeChild( $node );
359
+ } else {
360
+ $this->should_not_removed_nodes[ $node->nodeName ][] = $node;
361
+ }
362
+ return $should_remove;
363
+ }
364
+
365
+ /**
366
+ * Removes an invalid attribute of a node.
367
+ *
368
+ * Also, calls the mutation callback for it.
369
+ * This tracks all the attributes that were removed.
370
+ *
371
+ * @since 0.7
372
+ *
373
+ * @param DOMElement $element The node for which to remove the attribute.
374
+ * @param DOMAttr|string $attribute The attribute to remove from the element.
375
+ * @param array $validation_error Validation error details.
376
+ * @return bool Whether the node should have been removed, that is, that the node was sanitized for validity.
377
+ */
378
+ public function remove_invalid_attribute( $element, $attribute, $validation_error = array() ) {
379
+ if ( is_string( $attribute ) ) {
380
+ $node = $element->getAttributeNode( $attribute );
381
+ } else {
382
+ $node = $attribute;
383
+ }
384
+ $should_remove = $this->should_sanitize_validation_error( $validation_error, compact( 'node' ) );
385
+ if ( $should_remove ) {
386
+ $element->removeAttributeNode( $node );
387
+ }
388
+ return $should_remove;
389
+ }
390
+
391
+ /**
392
+ * Check whether or not sanitization should occur in response to validation error.
393
+ *
394
+ * @since 1.0
395
+ *
396
+ * @param array $validation_error Validation error.
397
+ * @param array $data Data including the node.
398
+ * @return bool Whether to sanitize.
399
+ */
400
+ public function should_sanitize_validation_error( $validation_error, $data = array() ) {
401
+ if ( empty( $this->args['validation_error_callback'] ) || ! is_callable( $this->args['validation_error_callback'] ) ) {
402
+ return true;
403
+ }
404
+ $validation_error = $this->prepare_validation_error( $validation_error, $data );
405
+ return false !== call_user_func( $this->args['validation_error_callback'], $validation_error, $data );
406
+ }
407
+
408
+ /**
409
+ * Prepare validation error.
410
+ *
411
+ * @param array $error {
412
+ * Error.
413
+ *
414
+ * @type string $code Error code.
415
+ * }
416
+ * @param array $data {
417
+ * Data.
418
+ *
419
+ * @type DOMElement|DOMNode $node The removed node.
420
+ * }
421
+ * @return array Error.
422
+ */
423
+ public function prepare_validation_error( array $error = array(), array $data = array() ) {
424
+ $node = null;
425
+ $matches = null;
426
+
427
+ if ( isset( $data['node'] ) && $data['node'] instanceof DOMNode ) {
428
+ $node = $data['node'];
429
+
430
+ $error['node_name'] = $node->nodeName;
431
+ if ( $node->parentNode ) {
432
+ $error['parent_name'] = $node->parentNode->nodeName;
433
+ }
434
+ }
435
+
436
+ if ( $node instanceof DOMElement ) {
437
+ if ( ! isset( $error['code'] ) ) {
438
+ $error['code'] = AMP_Validation_Error_Taxonomy::INVALID_ELEMENT_CODE;
439
+ }
440
+
441
+ if ( ! isset( $error['type'] ) ) {
442
+ $error['type'] = 'script' === $node->nodeName ? AMP_Validation_Error_Taxonomy::JS_ERROR_TYPE : AMP_Validation_Error_Taxonomy::HTML_ELEMENT_ERROR_TYPE;
443
+ }
444
+
445
+ if ( ! isset( $error['node_attributes'] ) ) {
446
+ $error['node_attributes'] = array();
447
+ foreach ( $node->attributes as $attribute ) {
448
+ $error['node_attributes'][ $attribute->nodeName ] = $attribute->nodeValue;
449
+ }
450
+ }
451
+
452
+ // Capture script contents.
453
+ if ( 'script' === $node->nodeName && ! $node->hasAttribute( 'src' ) ) {
454
+ $error['text'] = $node->textContent;
455
+ }
456
+
457
+ // Suppress 'ver' param from enqueued scripts and styles.
458
+ if ( 'script' === $node->nodeName && isset( $error['node_attributes']['src'] ) && false !== strpos( $error['node_attributes']['src'], 'ver=' ) ) {
459
+ $error['node_attributes']['src'] = add_query_arg( 'ver', '__normalized__', $error['node_attributes']['src'] );
460
+ } elseif ( 'link' === $node->nodeName && isset( $error['node_attributes']['href'] ) && false !== strpos( $error['node_attributes']['href'], 'ver=' ) ) {
461
+ $error['node_attributes']['href'] = add_query_arg( 'ver', '__normalized__', $error['node_attributes']['href'] );
462
+ }
463
+ } elseif ( $node instanceof DOMAttr ) {
464
+ if ( ! isset( $error['code'] ) ) {
465
+ $error['code'] = AMP_Validation_Error_Taxonomy::INVALID_ATTRIBUTE_CODE;
466
+ }
467
+ if ( ! isset( $error['type'] ) ) {
468
+ // If this is an attribute that begins with on, like onclick, it should be a js_error.
469
+ $error['type'] = preg_match( '/^on\w+/', $node->nodeName ) ? AMP_Validation_Error_Taxonomy::JS_ERROR_TYPE : AMP_Validation_Error_Taxonomy::HTML_ATTRIBUTE_ERROR_TYPE;
470
+ }
471
+ if ( ! isset( $error['element_attributes'] ) ) {
472
+ $error['element_attributes'] = array();
473
+ if ( $node->parentNode && $node->parentNode->hasAttributes() ) {
474
+ foreach ( $node->parentNode->attributes as $attribute ) {
475
+ $error['element_attributes'][ $attribute->nodeName ] = $attribute->nodeValue;
476
+ }
477
+ }
478
+ }
479
+ }
480
+
481
+ return $error;
482
+ }
483
+
484
+ /**
485
+ * Get data-amp-* values from the parent node 'figure' added by editor block.
486
+ *
487
+ * @param DOMElement $node Base node.
488
+ * @return array AMP data array.
489
+ */
490
+ public function get_data_amp_attributes( $node ) {
491
+ $attributes = array();
492
+
493
+ // Editor blocks add 'figure' as the parent node for images. If this node has data-amp-layout then we should add this as the layout attribute.
494
+ $parent_node = $node->parentNode;
495
+ if ( 'figure' === $parent_node->tagName ) {
496
+ $parent_attributes = AMP_DOM_Utils::get_node_attributes_as_assoc_array( $parent_node );
497
+ if ( isset( $parent_attributes['data-amp-layout'] ) ) {
498
+ $attributes['layout'] = $parent_attributes['data-amp-layout'];
499
+ }
500
+ if ( isset( $parent_attributes['data-amp-noloading'] ) && true === filter_var( $parent_attributes['data-amp-noloading'], FILTER_VALIDATE_BOOLEAN ) ) {
501
+ $attributes['noloading'] = $parent_attributes['data-amp-noloading'];
502
+ }
503
+ }
504
+
505
+ return $attributes;
506
+ }
507
+
508
+ /**
509
+ * Set AMP attributes.
510
+ *
511
+ * @param array $attributes Array of attributes.
512
+ * @param array $amp_data Array of AMP attributes.
513
+ * @return array Updated attributes.
514
+ */
515
+ public function filter_data_amp_attributes( $attributes, $amp_data ) {
516
+ if ( isset( $amp_data['layout'] ) ) {
517
+ $attributes['data-amp-layout'] = $amp_data['layout'];
518
+ }
519
+ if ( isset( $amp_data['noloading'] ) ) {
520
+ $attributes['data-amp-noloading'] = '';
521
+ }
522
+ return $attributes;
523
+ }
524
+
525
+ /**
526
+ * Set attributes to node's parent element according to layout.
527
+ *
528
+ * @param DOMElement $node Node.
529
+ * @param array $new_attributes Attributes array.
530
+ * @param string $layout Layout.
531
+ * @return array New attributes.
532
+ */
533
+ public function filter_attachment_layout_attributes( $node, $new_attributes, $layout ) {
534
+
535
+ // The width has to be unset / auto in case of fixed-height.
536
+ if ( 'fixed-height' === $layout ) {
537
+ if ( ! isset( $new_attributes['height'] ) ) {
538
+ $new_attributes['height'] = self::FALLBACK_HEIGHT;
539
+ }
540
+ $new_attributes['width'] = 'auto';
541
+ $node->parentNode->setAttribute( 'style', 'height: ' . $new_attributes['height'] . 'px; width: auto;' );
542
+
543
+ // The parent element should have width/height set and position set in case of 'fill'.
544
+ } elseif ( 'fill' === $layout ) {
545
+ if ( ! isset( $new_attributes['height'] ) ) {
546
+ $new_attributes['height'] = self::FALLBACK_HEIGHT;
547
+ }
548
+ $node->parentNode->setAttribute( 'style', 'position:relative; width: 100%; height: ' . $new_attributes['height'] . 'px;' );
549
+ unset( $new_attributes['width'] );
550
+ unset( $new_attributes['height'] );
551
+ } elseif ( 'responsive' === $layout ) {
552
+ $node->parentNode->setAttribute( 'style', 'position:relative; width: 100%; height: auto' );
553
+ } elseif ( 'fixed' === $layout ) {
554
+ if ( ! isset( $new_attributes['height'] ) ) {
555
+ $new_attributes['height'] = self::FALLBACK_HEIGHT;
556
+ }
557
+ }
558
+
559
+ return $new_attributes;
560
+ }
561
+
562
+ /**
563
+ * Add <amp-image-lightbox> element to body tag if it doesn't exist yet.
564
+ */
565
+ public function maybe_add_amp_image_lightbox_node() {
566
+
567
+ $nodes = $this->dom->getElementById( self::AMP_IMAGE_LIGHTBOX_ID );
568
+ if ( null !== $nodes ) {
569
+ return;
570
+ }
571
+
572
+ $nodes = $this->dom->getElementsByTagName( 'body' );
573
+ if ( ! $nodes->length ) {
574
+ return;
575
+ }
576
+ $body_node = $nodes->item( 0 );
577
+ $amp_image_lightbox = AMP_DOM_Utils::create_node( $this->dom, 'amp-image-lightbox', array(
578
+ 'id' => self::AMP_IMAGE_LIGHTBOX_ID,
579
+ 'layout' => 'nodisplay',
580
+ 'data-close-button-aria-label' => __( 'Close', 'amp' ),
581
+ ) );
582
+ $body_node->appendChild( $amp_image_lightbox );
583
+ }
584
+ }
includes/vendor/amp/includes/sanitizers/class-amp-tree-style-sanitizer.php ADDED
@@ -0,0 +1,2311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace AMPforWP\AMPVendor;
3
+
4
+ require_once( AMP__VENDOR__DIR__ . 'includes/sanitizers/class-amp-tree-base-sanitizer.php' );
5
+ /**
6
+ * Class AMP_Style_Sanitizer
7
+ *
8
+ * @package AMP
9
+ */
10
+
11
+ use \Sabberworm\CSS\RuleSet\DeclarationBlock;
12
+ use \Sabberworm\CSS\CSSList\CSSList;
13
+ use \Sabberworm\CSS\Property\Selector;
14
+ use \Sabberworm\CSS\RuleSet\RuleSet;
15
+ use \Sabberworm\CSS\Property\AtRule;
16
+ use \Sabberworm\CSS\CSSList\KeyFrame;
17
+ use \Sabberworm\CSS\RuleSet\AtRuleSet;
18
+ use \Sabberworm\CSS\Property\Import;
19
+ use \Sabberworm\CSS\CSSList\AtRuleBlockList;
20
+ use \Sabberworm\CSS\Value\RuleValueList;
21
+ use \Sabberworm\CSS\Value\URL;
22
+ use \Sabberworm\CSS\CSSList\Document;
23
+ use \AMPforWP\AMPVendor\AMPFORWP_Tree_Shaking_Transient;
24
+
25
+ /**
26
+ * Class AMP_Style_Sanitizer
27
+ *
28
+ * Collects inline styles and outputs them in the amp-custom stylesheet.
29
+ */
30
+ class AMP_treeshaking_Style_Sanitizer extends AMP_tree_Base_Sanitizer {
31
+
32
+ /**
33
+ * Error code for tree shaking.
34
+ *
35
+ * @var string
36
+ */
37
+ const TREE_SHAKING_ERROR_CODE = 'removed_unused_css_rules';
38
+
39
+ /**
40
+ * Error code for illegal at-rule.
41
+ *
42
+ * @var string
43
+ */
44
+ const ILLEGAL_AT_RULE_ERROR_CODE = 'illegal_css_at_rule';
45
+
46
+ /**
47
+ * Inline style selector's specificity multiplier, i.e. used to generate the number of ':not(#_)' placeholders.
48
+ *
49
+ * @var int
50
+ */
51
+ const INLINE_SPECIFICITY_MULTIPLIER = 5; // @todo The correctness of using "5" should be validated.
52
+
53
+ /**
54
+ * Array of flags used to control sanitization.
55
+ *
56
+ * @var array {
57
+ * @type string $remove_unused_rules Enum 'never', 'sometimes' (default), 'always'. If total CSS is greater than max_bytes, whether to strip selectors (and then empty rules) when they are not found to be used in doc. A validation error will be emitted when stripping happens since it is not completely safe in the case of dynamic content.
58
+ * @type string[] $dynamic_element_selectors Selectors for elements (or their ancestors) which contain dynamic content; selectors containing these will not be filtered.
59
+ * @type bool $use_document_element Whether the root of the document should be used rather than the body.
60
+ * @type bool $require_https_src Require HTTPS URLs.
61
+ * @type bool $allow_dirty_styles Allow dirty styles. This short-circuits the sanitize logic; it is used primarily in Customizer preview.
62
+ * @type callable $validation_error_callback Function to call when a validation error is encountered.
63
+ * @type bool $should_locate_sources Whether to locate the sources when reporting validation errors.
64
+ * @type string $parsed_cache_variant Additional value by which to vary parsed cache.
65
+ * @type bool $accept_tree_shaking Whether to accept tree-shaking by default and bypass a validation error.
66
+ * }
67
+ */
68
+ protected $args;
69
+
70
+ /**
71
+ * Default args.
72
+ *
73
+ * @var array
74
+ */
75
+ protected $DEFAULT_ARGS = array(
76
+ 'remove_unused_rules' => 'sometimes',
77
+ 'dynamic_element_selectors' => array(
78
+ 'amp-list',
79
+ 'amp-live-list',
80
+ '[submit-error]',
81
+ '[submit-success]',
82
+ ),
83
+ 'should_locate_sources' => false,
84
+ 'parsed_cache_variant' => null,
85
+ 'accept_tree_shaking' => false,
86
+ );
87
+
88
+ /**
89
+ * Stylesheets.
90
+ *
91
+ * Values are the CSS stylesheets. Keys are MD5 hashes of the stylesheets,
92
+ *
93
+ * @since 0.7
94
+ * @var string[]
95
+ */
96
+ private $stylesheets = array();
97
+
98
+ private $comments_notice = '';
99
+
100
+ /**
101
+ * List of stylesheet parts prior to selector/rule removal (tree shaking).
102
+ *
103
+ * Keys are MD5 hashes of stylesheets.
104
+ *
105
+ * @since 1.0
106
+ * @var array[] {
107
+ * @type array $stylesheet Array of stylesheet chunked, with declaration blocks being represented as arrays.
108
+ * @type DOMElement|DOMAttr $node Origin for styles.
109
+ * @type array $sources Sources for the node.
110
+ * @type bool $keyframes Whether an amp-keyframes.
111
+ * }
112
+ */
113
+ private $pending_stylesheets = array();
114
+
115
+ /**
116
+ * Spec for style[amp-custom] cdata.
117
+ *
118
+ * @since 1.0
119
+ * @var array
120
+ */
121
+ private $style_custom_cdata_spec;
122
+
123
+ /**
124
+ * The style[amp-custom] element.
125
+ *
126
+ * @var DOMElement
127
+ */
128
+ private $amp_custom_style_element;
129
+
130
+ /**
131
+ * Spec for style[amp-keyframes] cdata.
132
+ *
133
+ * @since 1.0
134
+ * @var array
135
+ */
136
+ private $style_keyframes_cdata_spec;
137
+
138
+ /**
139
+ * Regex for allowed font stylesheet URL.
140
+ *
141
+ * @var string
142
+ */
143
+ private $allowed_font_src_regex;
144
+
145
+ /**
146
+ * Base URL for styles.
147
+ *
148
+ * Full URL with trailing slash.
149
+ *
150
+ * @var string
151
+ */
152
+ private $base_url;
153
+
154
+ /**
155
+ * URL of the content directory.
156
+ *
157
+ * @var string
158
+ */
159
+ private $content_url;
160
+
161
+ /**
162
+ * Class names used in document.
163
+ *
164
+ * @since 1.0
165
+ * @var array
166
+ */
167
+ private $used_class_names = array();
168
+
169
+ /**
170
+ * Tag names used in document.
171
+ *
172
+ * @since 1.0
173
+ * @var array
174
+ */
175
+ private $used_tag_names = array();
176
+
177
+ /**
178
+ * XPath.
179
+ *
180
+ * @since 1.0
181
+ * @var DOMXPath
182
+ */
183
+ private $xpath;
184
+
185
+ /**
186
+ * Amount of time that was spent parsing CSS.
187
+ *
188
+ * @since 1.0
189
+ * @var float
190
+ */
191
+ private $parse_css_duration = 0.0;
192
+
193
+ /**
194
+ * THe HEAD element.
195
+ *
196
+ * @var DOMElement
197
+ */
198
+ private $head;
199
+
200
+ /**
201
+ * Current node being processed.
202
+ *
203
+ * @var DOMElement|DOMAttr
204
+ */
205
+ private $current_node;
206
+
207
+ /**
208
+ * Current sources for a given node.
209
+ *
210
+ * @var array
211
+ */
212
+ private $current_sources;
213
+
214
+ /**
215
+ * Log of the stylesheet URLs that have been imported to guard against infinite loops.
216
+ *
217
+ * @var array
218
+ */
219
+ private $processed_imported_stylesheet_urls = array();
220
+
221
+ /**
222
+ * List of font stylesheets that were @import'ed which should have been <link>'ed to instead.
223
+ *
224
+ * These font URLs will be cached with the parsed CSS and then converted into stylesheet links.
225
+ *
226
+ * @var array
227
+ */
228
+ private $imported_font_urls = array();
229
+
230
+ /**
231
+ * Mapping of HTML element selectors to AMP selector elements.
232
+ *
233
+ * @var array
234
+ */
235
+ private $selector_mappings = array();
236
+
237
+ /**
238
+ * Get error codes that can be raised during parsing of CSS.
239
+ *
240
+ * This is used to determine which validation errors should be taken into account
241
+ * when determining which validation errors should vary the parse cache.
242
+ *
243
+ * @return array
244
+ */
245
+ public static function get_css_parser_validation_error_codes() {
246
+
247
+ return array(
248
+ 'css_parse_error',
249
+ 'excessive_css',
250
+ self::ILLEGAL_AT_RULE_ERROR_CODE,
251
+ 'illegal_css_important',
252
+ 'illegal_css_property',
253
+ self::TREE_SHAKING_ERROR_CODE,
254
+ 'unrecognized_css',
255
+ 'disallowed_file_extension',
256
+ 'file_path_not_found',
257
+ );
258
+ }
259
+
260
+ /**
261
+ * Determine whether the version of PHP-CSS-Parser loaded has all required features for tree shaking and CSS processing.
262
+ *
263
+ * @since 1.0.2
264
+ *
265
+ * @return bool Returns true if the plugin's forked version of PHP-CSS-Parser is loaded by Composer.
266
+ */
267
+ public static function has_required_php_css_parser() {
268
+ $has_required_methods = (
269
+ method_exists( 'Sabberworm\CSS\CSSList\Document', 'splice' )
270
+ &&
271
+ method_exists( 'Sabberworm\CSS\CSSList\Document', 'replace' )
272
+ );
273
+ if ( ! $has_required_methods ) {
274
+ return false;
275
+ }
276
+
277
+ $reflection = new \ReflectionClass( 'Sabberworm\CSS\OutputFormat' );
278
+
279
+ $has_output_format_extensions = (
280
+ $reflection->hasProperty( 'sBeforeAtRuleBlock' )
281
+ &&
282
+ $reflection->hasProperty( 'sAfterAtRuleBlock' )
283
+ &&
284
+ $reflection->hasProperty( 'sBeforeDeclarationBlock' )
285
+ &&
286
+ $reflection->hasProperty( 'sAfterDeclarationBlockSelectors' )
287
+ &&
288
+ $reflection->hasProperty( 'sAfterDeclarationBlock' )
289
+ );
290
+ if ( ! $has_output_format_extensions ) {
291
+ return false;
292
+ }
293
+
294
+ return true;
295
+ }
296
+
297
+ /**
298
+ * AMP_Base_Sanitizer constructor.
299
+ *
300
+ * @since 0.7
301
+ *
302
+ * @param DOMDocument $dom Represents the HTML document to sanitize.
303
+ * @param array $args Args.
304
+ */
305
+ public function __construct( \DOMDocument $dom, array $args = array() ) {
306
+ parent::__construct( $dom, $args );
307
+
308
+ foreach ( AMP_Allowed_Tags_Generated::get_allowed_tag( 'style' ) as $spec_rule ) {
309
+ if ( ! isset( $spec_rule[ AMP_Rule_Spec::TAG_SPEC ]['spec_name'] ) ) {
310
+ continue;
311
+ }
312
+ if ( 'style[amp-keyframes]' === $spec_rule[ AMP_Rule_Spec::TAG_SPEC ]['spec_name'] ) {
313
+ $this->style_keyframes_cdata_spec = $spec_rule[ AMP_Rule_Spec::CDATA ];
314
+ } elseif ( 'style amp-custom' === $spec_rule[ AMP_Rule_Spec::TAG_SPEC ]['spec_name'] ) {
315
+ $this->style_custom_cdata_spec = $spec_rule[ AMP_Rule_Spec::CDATA ];
316
+ }
317
+ }
318
+
319
+ $spec_name = 'link rel=stylesheet for fonts'; // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
320
+ foreach ( AMP_Allowed_Tags_Generated::get_allowed_tag( 'link' ) as $spec_rule ) {
321
+ if ( isset( $spec_rule[ AMP_Rule_Spec::TAG_SPEC ]['spec_name'] ) && $spec_name === $spec_rule[ AMP_Rule_Spec::TAG_SPEC ]['spec_name'] ) {
322
+ $this->allowed_font_src_regex = '@^(' . $spec_rule[ AMP_Rule_Spec::ATTR_SPEC_LIST ]['href']['value_regex'] . ')$@';
323
+ break;
324
+ }
325
+ }
326
+
327
+ /* $guessurl = site_url();
328
+ if ( ! $guessurl ) {
329
+ $guessurl = wp_guess_url();
330
+ } */
331
+ $this->base_url = '';//$guessurl;
332
+ $this->content_url = '';//WP_CONTENT_URL;
333
+ $this->xpath = new \DOMXPath( $dom );
334
+
335
+ }
336
+
337
+ /**
338
+ * Get list of CSS styles in HTML content of DOMDocument ($this->dom).
339
+ *
340
+ * @since 0.4
341
+ * @deprecated As of 1.0, use get_stylesheets().
342
+ *
343
+ * @return array[] Mapping CSS selectors to array of properties, or mapping of keys starting with 'stylesheet:' with value being the stylesheet.
344
+ */
345
+ public function get_styles() {
346
+ return array();
347
+ }
348
+
349
+ /**
350
+ * Get stylesheets.
351
+ *
352
+ * @since 0.7
353
+ * @returns array Values are the CSS stylesheets. Keys are MD5 hashes of the stylesheets.
354
+ */
355
+ public function get_stylesheets() {
356
+ return $this->stylesheets;
357
+ }
358
+
359
+ public function get_comments() {
360
+ return $this->comments_notice;
361
+ }
362
+
363
+ /**
364
+ * Get list of all the class names used in the document, including those used in [class] attributes.
365
+ *
366
+ * @since 1.0
367
+ * @return array Used class names.
368
+ */
369
+ private function get_used_class_names() {
370
+ if ( empty( $this->used_class_names ) ) {
371
+ $classes = ' ';
372
+ foreach ( $this->xpath->query( '//*/@class' ) as $class_attribute ) {
373
+ $classes .= ' ' . $class_attribute->nodeValue;
374
+ }
375
+
376
+ // Find all [class] attributes and capture the contents of any single- or double-quoted strings.
377
+ foreach ( $this->xpath->query( '//*/@' . AMP_DOM_Utils::get_amp_bind_placeholder_prefix() . 'class' ) as $bound_class_attribute ) {
378
+ if ( preg_match_all( '/([\'"])([^\1]*?)\1/', $bound_class_attribute->nodeValue, $matches ) ) {
379
+ $classes .= ' ' . implode( ' ', $matches[2] );
380
+ }
381
+ }
382
+
383
+ $this->used_class_names = array_unique( array_filter( preg_split( '/\s+/', trim( $classes ) ) ) );
384
+ }
385
+ return $this->used_class_names;
386
+ }
387
+
388
+
389
+ /**
390
+ * Get list of all the tag names used in the document.
391
+ *
392
+ * @since 1.0
393
+ * @return array Used tag names.
394
+ */
395
+ private function get_used_tag_names() {
396
+ if ( empty( $this->used_tag_names ) ) {
397
+ $used_tag_names = array();
398
+ foreach ( $this->dom->getElementsByTagName( '*' ) as $el ) {
399
+ $used_tag_names[ $el->tagName ] = true;
400
+ }
401
+ $this->used_tag_names = array_keys( $used_tag_names );
402
+ }
403
+ return $this->used_tag_names;
404
+ }
405
+
406
+ /**
407
+ * Run logic before any sanitizers are run.
408
+ *
409
+ * After the sanitizers are instantiated but before calling sanitize on each of them, this
410
+ * method is called with list of all the instantiated sanitizers.
411
+ *
412
+ * @param AMP_Base_Sanitizer[] $sanitizers Sanitizers.
413
+ */
414
+ public function init( $sanitizers ) {
415
+ parent::init( $sanitizers );
416
+
417
+ foreach ( $sanitizers as $sanitizer ) {
418
+ foreach ( $sanitizer->get_selector_conversion_mapping() as $html_selectors => $amp_selectors ) {
419
+ if ( ! isset( $this->selector_mappings[ $html_selectors ] ) ) {
420
+ $this->selector_mappings[ $html_selectors ] = $amp_selectors;
421
+ } else {
422
+ $this->selector_mappings[ $html_selectors ] = array_unique(
423
+ array_merge( $this->selector_mappings[ $html_selectors ], $amp_selectors )
424
+ );
425
+ }
426
+
427
+ // Prevent selectors like `amp-img img` getting deleted since `img` does not occur in the DOM.
428
+ $this->args['dynamic_element_selectors'] = array_merge(
429
+ $this->args['dynamic_element_selectors'],
430
+ $this->selector_mappings[ $html_selectors ]
431
+ );
432
+ }
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Sanitize CSS styles within the HTML contained in this instance's DOMDocument.
438
+ *
439
+ * @since 0.4
440
+ */
441
+ public function sanitize() {
442
+
443
+ $elements = array();
444
+ // Do nothing if inline styles are allowed.
445
+ /* if ( ! empty( $this->args['allow_dirty_styles'] ) ) {
446
+ return;
447
+ } */
448
+
449
+ $this->head = $this->dom->getElementsByTagName( 'head' )->item( 0 );
450
+ if ( ! $this->head ) {
451
+ $this->head = $this->dom->createElement( 'head' );
452
+ $this->dom->documentElement->insertBefore( $this->head, $this->dom->documentElement->firstChild );
453
+ }
454
+
455
+ $this->parse_css_duration = 0.0;
456
+
457
+ /*
458
+ * Note that xpath is used to query the DOM so that the link and style elements will be
459
+ * in document order. DOMNode::compareDocumentPosition() is not yet implemented.
460
+ */
461
+ $xpath = $this->xpath;
462
+
463
+ $lower_case = 'translate( %s, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz" )'; // In XPath 2.0 this is lower-case().
464
+ $predicates = array(
465
+ sprintf( '( self::style and not( @amp-boilerplate ) and ( not( @type ) or %s = "text/css" ) )', sprintf( $lower_case, '@type' ) ),
466
+ sprintf( '( self::link and @href and %s = "stylesheet" )', sprintf( $lower_case, '@rel' ) ),
467
+ '( self::style and @amp-custom )' ,
468
+ );
469
+
470
+ foreach ( $xpath->query( '//*[ ' . implode( ' or ', $predicates ) . ' ]' ) as $element ) {
471
+ $elements[] = $element;
472
+ }
473
+
474
+ // If 'width' attribute is present for 'col' tag, convert to proper CSS rule.
475
+ foreach ( $this->dom->getElementsByTagName( 'col' ) as $col ) {
476
+ /**
477
+ * Col element.
478
+ *
479
+ * @var DOMElement $col
480
+ */
481
+ $width_attr = $col->getAttribute( 'width' );
482
+ if ( ! empty( $width_attr ) && ( false === strpos( $width_attr, '*' ) ) ) {
483
+ $width_style = 'width: ' . $width_attr;
484
+ if ( is_numeric( $width_attr ) ) {
485
+ $width_style .= 'px';
486
+ }
487
+ if ( $col->hasAttribute( 'style' ) ) {
488
+ $col->setAttribute( 'style', $width_style . ';' . $col->getAttribute( 'style' ) );
489
+ } else {
490
+ $col->setAttribute( 'style', $width_style );
491
+ }
492
+ $col->removeAttribute( 'width' );
493
+ }
494
+ }
495
+
496
+ /**
497
+ * Element.
498
+ *
499
+ * @var DOMElement $element
500
+ */
501
+
502
+ foreach ( $elements as $element ) {
503
+ $node_name = strtolower( $element->nodeName );
504
+ if ( 'style' === $node_name ) {
505
+ $this->process_style_element( $element );
506
+ } /* elseif ( 'link' === $node_name ) {
507
+ $this->process_link_element( $element );
508
+ } */
509
+ }
510
+
511
+ $elements = array();
512
+ foreach ( $xpath->query( '//*[ @style ]' ) as $element ) {
513
+ $elements[] = $element;
514
+ }
515
+ foreach ( $elements as $element ) {
516
+ $this->collect_inline_styles( $element );
517
+ }
518
+
519
+ $this->finalize_styles();
520
+
521
+ $this->did_convert_elements = true;
522
+
523
+ if ( $this->parse_css_duration > 0.0 ) {
524
+ //AMP_HTTP::send_server_timing( 'amp_parse_css', $this->parse_css_duration, 'AMP Parse CSS' );
525
+ }
526
+ }
527
+
528
+ /**
529
+ * Generate a URL's fully-qualified file path.
530
+ *
531
+ * @since 0.7
532
+ * @see WP_Styles::_css_href()
533
+ *
534
+ * @param string $url The file URL.
535
+ * @param string[] $allowed_extensions Allowed file extensions for local files.
536
+ * @return string|WP_Error Style's absolute validated filesystem path, or WP_Error when error.
537
+ */
538
+ public function get_validated_url_file_path( $url, $allowed_extensions = array() ) {
539
+ $needs_base_url = (
540
+ ! is_bool( $url )
541
+ &&
542
+ ! preg_match( '|^(https?:)?//|', $url )
543
+ &&
544
+ ! ( $this->content_url && 0 === strpos( $url, $this->content_url ) )
545
+ );
546
+ if ( $needs_base_url ) {
547
+ $url = $this->base_url . $url;
548
+ }
549
+
550
+ $remove_url_scheme = function( $schemed_url ) {
551
+ return preg_replace( '#^\w+:(?=//)#', '', $schemed_url );
552
+ };
553
+
554
+ // Strip URL scheme, query, and fragment.
555
+ $url = $remove_url_scheme( preg_replace( ':[\?#].*$:', '', $url ) );
556
+
557
+ $includes_url = $remove_url_scheme( includes_url( '/' ) );
558
+ $content_url = $remove_url_scheme( content_url( '/' ) );
559
+ $admin_url = $remove_url_scheme( get_admin_url( null, '/' ) );
560
+ $site_url = $remove_url_scheme( site_url( '/' ) );
561
+
562
+ $allowed_hosts = array(
563
+ wp_parse_url( $includes_url, PHP_URL_HOST ),
564
+ wp_parse_url( $content_url, PHP_URL_HOST ),
565
+ wp_parse_url( $admin_url, PHP_URL_HOST ),
566
+ );
567
+
568
+ $url_host = wp_parse_url( $url, PHP_URL_HOST );
569
+
570
+ // Validate file extensions.
571
+ if ( ! empty( $allowed_extensions ) ) {
572
+ $pattern = sprintf( '/\.(%s)$/i', implode( '|', $allowed_extensions ) );
573
+ if ( ! preg_match( $pattern, $url ) ) {
574
+ /* translators: %s: the file URL. */
575
+ return new WP_Error( 'disallowed_file_extension', sprintf( __( 'File does not have an allowed file extension for filesystem access (%s).', 'amp' ), $url ) );
576
+ }
577
+ }
578
+
579
+ if ( ! in_array( $url_host, $allowed_hosts, true ) ) {
580
+ /* translators: %s: the file URL */
581
+ return new WP_Error( 'external_file_url', sprintf( __( 'URL is located on an external domain: %s.', 'amp' ), $url_host ) );
582
+ }
583
+
584
+ $base_path = null;
585
+ $file_path = null;
586
+ $wp_content = 'wp-content';
587
+ if ( 0 === strpos( $url, $content_url ) ) {
588
+ $base_path = WP_CONTENT_DIR;
589
+ $file_path = substr( $url, strlen( $content_url ) - 1 );
590
+ } elseif ( 0 === strpos( $url, $includes_url ) ) {
591
+ $base_path = ABSPATH . WPINC;
592
+ $file_path = substr( $url, strlen( $includes_url ) - 1 );
593
+ } elseif ( 0 === strpos( $url, $admin_url ) ) {
594
+ $base_path = ABSPATH . 'wp-admin';
595
+ $file_path = substr( $url, strlen( $admin_url ) - 1 );
596
+ } elseif ( 0 === strpos( $url, $site_url . trailingslashit( $wp_content ) ) ) {
597
+ // Account for loading content from original wp-content directory not WP_CONTENT_DIR which can happen via register_theme_directory().
598
+ $base_path = ABSPATH . $wp_content;
599
+ $file_path = substr( $url, strlen( $site_url ) + strlen( $wp_content ) );
600
+ }
601
+
602
+ if ( ! $file_path || false !== strpos( $file_path, '../' ) || false !== strpos( $file_path, '..\\' ) ) {
603
+ /* translators: %s: the file URL. */
604
+ return new WP_Error( 'file_path_not_allowed', sprintf( __( 'Disallowed URL filesystem path for %s.', 'amp' ), $url ) );
605
+ }
606
+ if ( ! file_exists( $base_path . $file_path ) ) {
607
+ /* translators: %s: the file URL. */
608
+ return new WP_Error( 'file_path_not_found', sprintf( __( 'Unable to locate filesystem path for %s.', 'amp' ), $url ) );
609
+ }
610
+
611
+ return $base_path . $file_path;
612
+ }
613
+
614
+ /**
615
+ * Set the current node (and its sources when required).
616
+ *
617
+ * @since 1.0
618
+ * @param DOMElement|DOMAttr|null $node Current node, or null to reset.
619
+ */
620
+ private function set_current_node( $node ) {
621
+ if ( $this->current_node === $node ) {
622
+ return;
623
+ }
624
+
625
+ $this->current_node = $node;
626
+ if ( empty( $node ) ) {
627
+ $this->current_sources = null;
628
+ } elseif ( ! empty( $this->args['should_locate_sources'] ) ) {
629
+ $this->current_sources = AMP_Validation_Manager::locate_sources( $node );
630
+ }
631
+ }
632
+
633
+ /**
634
+ * Process style element.
635
+ *
636
+ * @param DOMElement $element Style element.
637
+ */
638
+ private function process_style_element( \DOMElement $element ) {
639
+ $this->set_current_node( $element ); // And sources when needing to be located.
640
+
641
+ // @todo Any @keyframes rules could be removed from amp-custom and instead added to amp-keyframes.
642
+ $is_keyframes = $element->hasAttribute( 'amp-keyframes' );
643
+ $stylesheet = trim( $element->textContent );
644
+ $cdata_spec = $is_keyframes ? $this->style_keyframes_cdata_spec : $this->style_custom_cdata_spec;
645
+
646
+ // Honor the style's media attribute.
647
+ $media = $element->getAttribute( 'media' );
648
+ if ( $media && 'all' !== $media ) {
649
+ $stylesheet = sprintf( '@media %s { %s }', $media, $stylesheet );
650
+ }
651
+
652
+ $processed = $this->process_stylesheet( $stylesheet, array(
653
+ 'allowed_at_rules' => @$cdata_spec['css_spec']['allowed_at_rules'],
654
+ 'property_whitelist' => @$cdata_spec['css_spec']['declaration'],
655
+ 'validate_keyframes' => @$cdata_spec['css_spec']['validate_keyframes'],
656
+ ) );
657
+
658
+ $this->pending_stylesheets[] = array_merge(
659
+ array(
660
+ 'keyframes' => $is_keyframes,
661
+ 'node' => $element,
662
+ 'sources' => $this->current_sources,
663
+ ),
664
+ wp_array_slice_assoc( $processed, array( 'stylesheet', 'imported_font_urls' ) )
665
+ );
666
+
667
+ if ( $element->hasAttribute( 'amp-custom' ) ) {
668
+ if ( ! $this->amp_custom_style_element ) {
669
+ $this->amp_custom_style_element = $element;
670
+ } else {
671
+ $element->parentNode->removeChild( $element ); // There can only be one. #highlander.
672
+ }
673
+ } else {
674
+
675
+ // Remove from DOM since we'll be adding it to amp-custom.
676
+ $element->parentNode->removeChild( $element );
677
+ }
678
+
679
+ $this->set_current_node( null );
680
+ }
681
+
682
+ /**
683
+ * Process link element.
684
+ *
685
+ * @param DOMElement $element Link element.
686
+ */
687
+ private function process_link_element( DOMElement $element ) {
688
+ $href = $element->getAttribute( 'href' );
689
+
690
+ // Allow font URLs, including protocol-less URLs and recognized URLs that use HTTP instead of HTTPS.
691
+ $normalized_url = preg_replace( '#^(http:)?(?=//)#', 'https:', $href );
692
+ if ( $this->allowed_font_src_regex && preg_match( $this->allowed_font_src_regex, $normalized_url ) ) {
693
+ if ( $href !== $normalized_url ) {
694
+ $element->setAttribute( 'href', $normalized_url );
695
+ }
696
+
697
+ /*
698
+ * Make sure rel=preconnect link is present for Google Fonts stylesheet.
699
+ * Note that core themes normally do this already, per <https://core.trac.wordpress.org/ticket/37171>.
700
+ * But not always, per <https://core.trac.wordpress.org/ticket/44668>.
701
+ * This also ensures that other themes will get the preconnect link when
702
+ * they don't implement the resource hint.
703
+ */
704
+ $needs_preconnect_link = (
705
+ 'https://fonts.googleapis.com/' === substr( $normalized_url, 0, 29 )
706
+ &&
707
+ 0 === $this->xpath->query( '//link[ @rel = "preconnect" and @crossorigin and starts-with( @href, "https://fonts.gstatic.com" ) ]', $this->head )->length
708
+ );
709
+ if ( $needs_preconnect_link ) {
710
+ $link = AMP_DOM_Utils::create_node( $this->dom, 'link', array(
711
+ 'rel' => 'preconnect',
712
+ 'href' => 'https://fonts.gstatic.com/',
713
+ 'crossorigin' => '',
714
+ ) );
715
+ $this->head->insertBefore( $link ); // Note that \AMP_Theme_Support::ensure_required_markup() will put this in the optimal order.
716
+ }
717
+ return;
718
+ }
719
+
720
+ $css_file_path = $this->get_validated_url_file_path( $href, array( 'css', 'less', 'scss', 'sass' ) );
721
+
722
+ if ( is_wp_error( $css_file_path ) && ( 'disallowed_file_extension' === $css_file_path->get_error_code() || 'external_file_url' === $css_file_path->get_error_code() ) ) {
723
+ $contents = $this->fetch_external_stylesheet( $normalized_url );
724
+ if ( is_wp_error( $contents ) ) {
725
+ $this->remove_invalid_child( $element, array(
726
+ 'code' => $css_file_path->get_error_code(),
727
+ 'message' => $css_file_path->get_error_message(),
728
+ 'type' => 'amp_validation_error',
729
+ ) );
730
+ return;
731
+ } else {
732
+ $stylesheet = $contents;
733
+ }
734
+ } elseif ( is_wp_error( $css_file_path ) ) {
735
+ $this->remove_invalid_child( $element, array(
736
+ 'code' => $css_file_path->get_error_code(),
737
+ 'message' => $css_file_path->get_error_message(),
738
+ 'type' => 'amp_validation_error',
739
+ ) );
740
+ return;
741
+ } else {
742
+ $stylesheet = file_get_contents( $css_file_path ); // phpcs:ignore -- It's a local filesystem path not a remote request.
743
+ }
744
+
745
+ if ( false === $stylesheet ) {
746
+ $this->remove_invalid_child( $element, array(
747
+ 'code' => 'stylesheet_file_missing',
748
+ 'type' => 'amp_validation_error',
749
+ ) );
750
+ return;
751
+ }
752
+
753
+ // Honor the link's media attribute.
754
+ $media = $element->getAttribute( 'media' );
755
+ if ( $media && 'all' !== $media ) {
756
+ $stylesheet = sprintf( '@media %s { %s }', $media, $stylesheet );
757
+ }
758
+
759
+ $this->set_current_node( $element ); // And sources when needing to be located.
760
+
761
+ $processed = $this->process_stylesheet( $stylesheet, array(
762
+ 'allowed_at_rules' => $this->style_custom_cdata_spec['css_spec']['allowed_at_rules'],
763
+ 'property_whitelist' => $this->style_custom_cdata_spec['css_spec']['declaration'],
764
+ 'stylesheet_url' => $href,
765
+ 'stylesheet_path' => $css_file_path,
766
+ ) );
767
+
768
+ $this->pending_stylesheets[] = array_merge(
769
+ array(
770
+ 'keyframes' => false,
771
+ 'node' => $element,
772
+ 'sources' => $this->current_sources, // Needed because node is removed below.
773
+ ),
774
+ wp_array_slice_assoc( $processed, array( 'stylesheet', 'imported_font_urls' ) )
775
+ );
776
+
777
+ // Remove now that styles have been processed.
778
+ $element->parentNode->removeChild( $element );
779
+
780
+ $this->set_current_node( null );
781
+ }
782
+
783
+ /**
784
+ * Fetch external stylesheet.
785
+ *
786
+ * @param string $url External stylesheet URL.
787
+ * @return string|WP_Error Stylesheet contents or WP_Error.
788
+ */
789
+ private function fetch_external_stylesheet( $url ) {
790
+ $cache_key = md5( $url );
791
+ $contents = \AMPforWP\AMPVendor\AMPFORWP_Tree_Shaking_Transient::ampforwp_get_file_transient( $cache_key );
792
+ if ( false === $contents ) {
793
+ $r = wp_remote_get( $url );
794
+ if ( 200 !== wp_remote_retrieve_response_code( $r ) ) {
795
+ $contents = new WP_Error(
796
+ wp_remote_retrieve_response_code( $r ),
797
+ wp_remote_retrieve_response_message( $r )
798
+ );
799
+ } else {
800
+ $contents = wp_remote_retrieve_body( $r );
801
+ }
802
+ \AMPforWP\AMPVendor\AMPFORWP_Tree_Shaking_Transient::ampforwp_set_file_transient( $cache_key, $contents, MONTH_IN_SECONDS );
803
+ }
804
+ return $contents;
805
+ }
806
+
807
+ /**
808
+ * Process stylesheet.
809
+ *
810
+ * Sanitized invalid CSS properties and rules, removes rules which do not
811
+ * apply to the current document, and compresses the CSS to remove whitespace and comments.
812
+ *
813
+ * @since 1.0
814
+ *
815
+ * @param string $stylesheet Stylesheet.
816
+ * @param array $options {
817
+ * Options.
818
+ *
819
+ * @type string[] $property_whitelist Exclusively-allowed properties.
820
+ * @type string[] $property_blacklist Disallowed properties.
821
+ * @type string $stylesheet_url Original URL for stylesheet when originating via link or @import.
822
+ * @type string $stylesheet_path Original filesystem path for stylesheet when originating via link or @import.
823
+ * @type array $allowed_at_rules Allowed @-rules.
824
+ * @type bool $validate_keyframes Whether keyframes should be validated.
825
+ * }
826
+ * @return array {
827
+ * Processed stylesheet.
828
+ *
829
+ * @type array $stylesheet Stylesheet parts, where arrays are tuples for declaration blocks.
830
+ * @type array $validation_results Validation results, array containing arrays with error and sanitized keys.
831
+ * @type array $imported_font_urls Imported font stylesheet URLs.
832
+ * }
833
+ */
834
+ private function process_stylesheet( $stylesheet, $options = array() ) {
835
+ $parsed = null;
836
+ $cache_key = null;
837
+ $cache_group = 'amp-parsed-stylesheet-v13'; // This should be bumped whenever the PHP-CSS-Parser is updated.
838
+
839
+ $cache_impacting_options = array_merge(
840
+ wp_array_slice_assoc(
841
+ $options,
842
+ array( 'property_whitelist', 'property_blacklist', 'stylesheet_url', 'allowed_at_rules' )
843
+ ),
844
+ wp_array_slice_assoc(
845
+ $this->args,
846
+ array( 'should_locate_sources', 'parsed_cache_variant' )
847
+ ),
848
+ array(
849
+ 'language' => 'en', // Used to tree-shake html[lang] selectors.
850
+ )
851
+ );
852
+ $cache_key = md5( $stylesheet . wp_json_encode( $cache_impacting_options ) );
853
+
854
+ if ( wp_using_ext_object_cache() ) {
855
+ $parsed = wp_cache_get( $cache_key, $cache_group );
856
+ } else {
857
+ $parsed = \AMPforWP\AMPVendor\AMPFORWP_Tree_Shaking_Transient::ampforwp_get_file_transient( $cache_key . $cache_group );
858
+ }
859
+
860
+ /*
861
+ * Make sure that the parsed stylesheet was cached with current sanitizations.
862
+ * The should_sanitize_validation_error method prevents duplicates from being reported.
863
+ */
864
+ if ( ! empty( $parsed['validation_results'] ) ) {
865
+ foreach ( $parsed['validation_results'] as $validation_result ) {
866
+ $sanitized = $this->should_sanitize_validation_error( $validation_result['error'] );
867
+ if ( $sanitized !== $validation_result['sanitized'] ) {
868
+ $parsed = null; // Change to sanitization of validation error detected, so cache cannot be used.
869
+ break;
870
+ }
871
+ }
872
+ }
873
+
874
+ if ( ! $parsed || ! isset( $parsed['stylesheet'] ) || ! is_array( $parsed['stylesheet'] ) ) {
875
+ $parsed = $this->prepare_stylesheet( $stylesheet, $options );
876
+
877
+ /*
878
+ * When an object cache is not available, we cache with an expiration to prevent the options table from
879
+ * getting filled infinitely. On the other hand, if an external object cache is available then we don't
880
+ * set an expiration because it should implement LRU cache expulsion policy.
881
+ */
882
+ if ( wp_using_ext_object_cache() ) {
883
+ wp_cache_set( $cache_key, $parsed, $cache_group );
884
+ } else {
885
+ // The expiration is to ensure transient doesn't stick around forever since no LRU flushing like with external object cache.
886
+ \AMPforWP\AMPVendor\AMPFORWP_Tree_Shaking_Transient::ampforwp_set_file_transient( $cache_key . $cache_group, $parsed, MONTH_IN_SECONDS );
887
+ }
888
+ }
889
+
890
+ return $parsed;
891
+ }
892
+
893
+ /**
894
+ * Parse imported stylesheet.
895
+ *
896
+ * @param Import $item Import object.
897
+ * @param CSSList $css_list CSS List.
898
+ * @param array $options {
899
+ * Options.
900
+ *
901
+ * @type string $stylesheet_url Original URL for stylesheet when originating via link or @import.
902
+ * }
903
+ * @return array Validation results.
904
+ */
905
+ private function parse_import_stylesheet( Import $item, CSSList $css_list, $options ) {
906
+ $results = array();
907
+ $at_rule_args = $item->atRuleArgs();
908
+ $location = array_shift( $at_rule_args );
909
+ $media_query = array_shift( $at_rule_args );
910
+
911
+ if ( isset( $options['stylesheet_url'] ) ) {
912
+ $this->real_path_urls( array( $location ), $options['stylesheet_url'] );
913
+ }
914
+
915
+ $import_stylesheet_url = $location->getURL()->getString();
916
+
917
+ // Prevent importing something that has already been imported, and avoid infinite recursion.
918
+ if ( isset( $this->processed_imported_stylesheet_urls[ $import_stylesheet_url ] ) ) {
919
+ $css_list->remove( $item );
920
+ return array();
921
+ }
922
+ $this->processed_imported_stylesheet_urls[ $import_stylesheet_url ] = true;
923
+
924
+ // Prevent importing font stylesheets from allowed font CDNs. These will get added to the document as links instead.
925
+ $https_import_stylesheet_url = preg_replace( '#^(http:)?(?=//)#', 'https:', $import_stylesheet_url );
926
+ if ( $this->allowed_font_src_regex && preg_match( $this->allowed_font_src_regex, $https_import_stylesheet_url ) ) {
927
+ $this->imported_font_urls[] = $https_import_stylesheet_url;
928
+ $css_list->remove( $item );
929
+ _doing_it_wrong(
930
+ 'wp_enqueue_style',
931
+ esc_html( sprintf(
932
+ /* translators: %s is URL to font CDN */
933
+ __( 'It is not a best practice to use @import to load font CDN stylesheets. Please use wp_enqueue_style() to enqueue %s as its own separate script.', 'amp' ),
934
+ $import_stylesheet_url
935
+ ) ),
936
+ '1.0'
937
+ );
938
+ return array();
939
+ }
940
+
941
+ $css_file_path = $this->get_validated_url_file_path( $import_stylesheet_url, array( 'css', 'less', 'scss', 'sass' ) );
942
+
943
+ if ( is_wp_error( $css_file_path ) && ( 'disallowed_file_extension' === $css_file_path->get_error_code() || 'external_file_url' === $css_file_path->get_error_code() ) ) {
944
+ $contents = $this->fetch_external_stylesheet( $import_stylesheet_url );
945
+ if ( is_wp_error( $contents ) ) {
946
+ $error = array(
947
+ 'code' => $contents->get_error_code(),
948
+ 'message' => $contents->get_error_message(),
949
+ 'type' => 'amp_validation_error',
950
+ );
951
+ $sanitized = $this->should_sanitize_validation_error( $error );
952
+ if ( $sanitized ) {
953
+ $css_list->remove( $item );
954
+ }
955
+ $results[] = compact( 'error', 'sanitized' );
956
+ return $results;
957
+ } else {
958
+ $stylesheet = $contents;
959
+ }
960
+ } elseif ( is_wp_error( $css_file_path ) ) {
961
+ $error = array(
962
+ 'code' => $css_file_path->get_error_code(),
963
+ 'message' => $css_file_path->get_error_message(),
964
+ 'type' => 'amp_validation_error',
965
+ );
966
+ $sanitized = $this->should_sanitize_validation_error( $error );
967
+ if ( $sanitized ) {
968
+ $css_list->remove( $item );
969
+ }
970
+ $results[] = compact( 'error', 'sanitized' );
971
+ return $results;
972
+ } else {
973
+ $stylesheet = file_get_contents( $css_file_path ); // phpcs:ignore -- It's a local filesystem path not a remote request.
974
+ }
975
+
976
+ if ( $media_query ) {
977
+ $stylesheet = sprintf( '@media %s { %s }', $media_query, $stylesheet );
978
+ }
979
+
980
+ $options['stylesheet_url'] = $import_stylesheet_url;
981
+
982
+ $parsed_stylesheet = $this->parse_stylesheet( $stylesheet, $options );
983
+
984
+ $results = array_merge(
985
+ $results,
986
+ $parsed_stylesheet['validation_results']
987
+ );
988
+
989
+ /**
990
+ * CSS Doc.
991
+ *
992
+ * @var Document $css_document
993
+ */
994
+ $css_document = $parsed_stylesheet['css_document'];
995
+
996
+ if ( ! empty( $parsed_stylesheet['css_document'] ) && method_exists( $css_list, 'replace' ) ) {
997
+ $css_list->replace( $item, $css_document->getContents() );
998
+ } else {
999
+ $css_list->remove( $item );
1000
+ }
1001
+
1002
+ return $results;
1003
+ }
1004
+
1005
+ /**
1006
+ * Parse stylesheet.
1007
+ *
1008
+ * @since 1.0
1009
+ *
1010
+ * @param string $stylesheet_string Stylesheet.
1011
+ * @param array $options Options. See definition in \AMP_Style_Sanitizer::process_stylesheet().
1012
+ * @return array {
1013
+ * Parsed stylesheet.
1014
+ *
1015
+ * @type Document $css_document CSS Document.
1016
+ * @type array $validation_results Validation results, array containing arrays with error and sanitized keys.
1017
+ * }
1018
+ */
1019
+ private function parse_stylesheet( $stylesheet_string, $options ) {
1020
+ $validation_results = array();
1021
+ $css_document = null;
1022
+
1023
+ $this->imported_font_urls = array();
1024
+ try {
1025
+ // Remove spaces from data URLs, which cause errors and PHP-CSS-Parser can't handle them.
1026
+ $stylesheet_string = $this->remove_spaces_from_data_urls( $stylesheet_string );
1027
+
1028
+ $parser_settings = \Sabberworm\CSS\Settings::create();
1029
+ $css_parser = new \Sabberworm\CSS\Parser( $stylesheet_string, $parser_settings );
1030
+ $css_document = $css_parser->parse(); // @todo If 'utf-8' is not $css_parser->getCharset() then issue warning?
1031
+
1032
+ if ( ! empty( $options['stylesheet_url'] ) ) {
1033
+ $this->real_path_urls(
1034
+ array_filter(
1035
+ $css_document->getAllValues(),
1036
+ function ( $value ) {
1037
+ return $value instanceof URL;
1038
+ }
1039
+ ),
1040
+ $options['stylesheet_url']
1041
+ );
1042
+ }
1043
+
1044
+ $validation_results = array_merge(
1045
+ $validation_results,
1046
+ $this->process_css_list( $css_document, $options )
1047
+ );
1048
+ } catch ( Exception $exception ) {
1049
+ $error = array(
1050
+ 'code' => 'css_parse_error',
1051
+ 'message' => $exception->getMessage(),
1052
+ 'type' => 'amp_validation_error',
1053
+ );
1054
+
1055
+ /*
1056
+ * This is not a recoverable error, so sanitized here is just used to give user control
1057
+ * over whether to proceed with serving this exception-raising stylesheet in AMP.
1058
+ */
1059
+ $sanitized = $this->should_sanitize_validation_error( $error );
1060
+
1061
+ $validation_results[] = compact( 'error', 'sanitized' );
1062
+ }
1063
+ return array_merge(
1064
+ compact( 'validation_results', 'css_document' ),
1065
+ array(
1066
+ 'imported_font_urls' => $this->imported_font_urls,
1067
+ )
1068
+ );
1069
+ }
1070
+
1071
+ /**
1072
+ * Prepare stylesheet.
1073
+ *
1074
+ * @since 1.0
1075
+ *
1076
+ * @param string $stylesheet_string Stylesheet.
1077
+ * @param array $options Options. See definition in \AMP_Style_Sanitizer::process_stylesheet().
1078
+ * @return array {
1079
+ * Prepared stylesheet.
1080
+ *
1081
+ * @type array $stylesheet Stylesheet parts, where arrays are tuples for declaration blocks.
1082
+ * @type array $validation_results Validation results, array containing arrays with error and sanitized keys.
1083
+ * @type array $imported_font_urls Imported font stylesheet URLs.
1084
+ * }
1085
+ */
1086
+ private function prepare_stylesheet( $stylesheet_string, $options = array() ) {
1087
+ $start_time = microtime( true );
1088
+
1089
+ $options = array_merge(
1090
+ array(
1091
+ 'allowed_at_rules' => array(),
1092
+ 'property_blacklist' => array(
1093
+ // See <https://www.ampproject.org/docs/design/responsive/style_pages#disallowed-styles>.
1094
+ 'behavior',
1095
+ '-moz-binding',
1096
+ ),
1097
+ 'property_whitelist' => array(),
1098
+ 'validate_keyframes' => false,
1099
+ 'stylesheet_url' => null,
1100
+ 'stylesheet_path' => null,
1101
+ ),
1102
+ $options
1103
+ );
1104
+
1105
+ // Strip the dreaded UTF-8 byte order mark (BOM, \uFEFF). This should ideally get handled by PHP-CSS-Parser <https://github.com/sabberworm/PHP-CSS-Parser/issues/150>.
1106
+ $stylesheet_string = preg_replace( '/^\xEF\xBB\xBF/', '', $stylesheet_string );
1107
+
1108
+ $stylesheet = array();
1109
+ $parsed_stylesheet = $this->parse_stylesheet( $stylesheet_string, $options );
1110
+ $validation_results = $parsed_stylesheet['validation_results'];
1111
+ if ( ! empty( $parsed_stylesheet['css_document'] ) ) {
1112
+ $css_document = $parsed_stylesheet['css_document'];
1113
+
1114
+ $output_format = \Sabberworm\CSS\OutputFormat::createCompact();
1115
+ $output_format->setSemicolonAfterLastRule( false );
1116
+
1117
+ $before_declaration_block = '/*AMP_WP_BEFORE_DECLARATION_BLOCK*/';
1118
+ $between_selectors = '/*AMP_WP_BETWEEN_SELECTORS*/';
1119
+ $after_declaration_block_selectors = '/*AMP_WP_BEFORE_DECLARATION_SELECTORS*/';
1120
+ $after_declaration_block = '/*AMP_WP_AFTER_DECLARATION*/';
1121
+ $before_at_rule = '/*AMP_WP_BEFORE_AT_RULE*/';
1122
+ $after_at_rule = '/*AMP_WP_AFTER_AT_RULE*/';
1123
+
1124
+ // Add comments to stylesheet if PHP-CSS-Parser has the required extensions for tree shaking.
1125
+ if ( self::has_required_php_css_parser() ) {
1126
+ $output_format->set( 'BeforeDeclarationBlock', $before_declaration_block );
1127
+ $output_format->set( 'SpaceBeforeSelectorSeparator', $between_selectors );
1128
+ $output_format->set( 'AfterDeclarationBlockSelectors', $after_declaration_block_selectors );
1129
+ $output_format->set( 'AfterDeclarationBlock', $after_declaration_block );
1130
+ $output_format->set( 'BeforeAtRuleBlock', $before_at_rule );
1131
+ $output_format->set( 'AfterAtRuleBlock', $after_at_rule );
1132
+ }
1133
+
1134
+ $stylesheet_string = $css_document->render( $output_format );
1135
+
1136
+ $pattern = '#';
1137
+ $pattern .= preg_quote( $before_at_rule, '#' );
1138
+ $pattern .= '|';
1139
+ $pattern .= preg_quote( $after_at_rule, '#' );
1140
+ $pattern .= '|';
1141
+ $pattern .= '(' . preg_quote( $before_declaration_block, '#' ) . ')';
1142
+ $pattern .= '(.+?)';
1143
+ $pattern .= preg_quote( $after_declaration_block_selectors, '#' );
1144
+ $pattern .= '(.+?)';
1145
+ $pattern .= preg_quote( $after_declaration_block, '#' );
1146
+ $pattern .= '#s';
1147
+
1148
+ $dynamic_selector_pattern = null;
1149
+ if ( ! empty( $this->args['dynamic_element_selectors'] ) ) {
1150
+ $dynamic_selector_pattern = implode( '|', array_map(
1151
+ function( $selector ) {
1152
+ return preg_quote( $selector, '#' );
1153
+ },
1154
+ $this->args['dynamic_element_selectors']
1155
+ ) );
1156
+ }
1157
+
1158
+ $split_stylesheet = preg_split( $pattern, $stylesheet_string, -1, PREG_SPLIT_DELIM_CAPTURE );
1159
+ $length = count( $split_stylesheet );
1160
+ for ( $i = 0; $i < $length; $i++ ) {
1161
+ if ( $before_declaration_block === $split_stylesheet[ $i ] ) {
1162
+
1163
+ // Skip keyframe-selector, which is can be: from | to | <percentage>.
1164
+ if ( preg_match( '/^((from|to)\b|-?\d+(\.\d+)?%)/i', $split_stylesheet[ $i + 1 ] ) ) {
1165
+ $stylesheet[] = str_replace( $between_selectors, '', $split_stylesheet[ ++$i ] ) . $split_stylesheet[ ++$i ];
1166
+ continue;
1167
+ }
1168
+
1169
+ $selectors = explode( $between_selectors . ',', $split_stylesheet[ ++$i ] );
1170
+ $declaration = $split_stylesheet[ ++$i ];
1171
+
1172
+ $selectors_parsed = array();
1173
+ foreach ( $selectors as $selector ) {
1174
+ $selectors_parsed[ $selector ] = array();
1175
+
1176
+ // Remove :not() and pseudo selectors to eliminate false negatives, such as with `body:not(.title-tagline-hidden) .site-branding-text`.
1177
+ $reduced_selector = preg_replace( '/:[a-zA-Z0-9_-]+(\(.+?\))?/', '', $selector );
1178
+
1179
+ // Remove attribute selectors to eliminate false negative, such as with `.social-navigation a[href*="example.com"]:before`.
1180
+ $reduced_selector = preg_replace( '/\[\w.*?\]/', '', $reduced_selector );
1181
+
1182
+ // Ignore any selector terms that occur under a dynamic selector.
1183
+ if ( $dynamic_selector_pattern ) {
1184
+ $reduced_selector = preg_replace( '#((?:' . $dynamic_selector_pattern . ')(?:\.[a-z0-9_-]+)*)[^a-z0-9_-].*#si', '$1', $reduced_selector . ' ' );
1185
+ }
1186
+
1187
+ $reduced_selector = preg_replace_callback(
1188
+ '/\.([a-zA-Z0-9_-]+)/',
1189
+ function( $matches ) use ( $selector, &$selectors_parsed ) {
1190
+ $selectors_parsed[ $selector ]['classes'][] = $matches[1];
1191
+ return '';
1192
+ },
1193
+ $reduced_selector
1194
+ );
1195
+ $reduced_selector = preg_replace_callback(
1196
+ '/#([a-zA-Z0-9_-]+)/',
1197
+ function( $matches ) use ( $selector, &$selectors_parsed ) {
1198
+ $selectors_parsed[ $selector ]['ids'][] = $matches[1];
1199
+ return '';
1200
+ },
1201
+ $reduced_selector
1202
+ );
1203
+
1204
+ if ( preg_match_all( '/[a-zA-Z0-9_-]+/', $reduced_selector, $matches ) ) {
1205
+ $selectors_parsed[ $selector ]['tags'] = $matches[0];
1206
+ }
1207
+ }
1208
+
1209
+ $stylesheet[] = array(
1210
+ $selectors_parsed,
1211
+ $declaration,
1212
+ );
1213
+ } else {
1214
+ $stylesheet[] = $split_stylesheet[ $i ];
1215
+ }
1216
+ }
1217
+ }
1218
+
1219
+ $this->parse_css_duration += ( microtime( true ) - $start_time );
1220
+
1221
+ return array_merge(
1222
+ compact( 'stylesheet', 'validation_results' ),
1223
+ array(
1224
+ 'imported_font_urls' => $parsed_stylesheet['imported_font_urls'],
1225
+ )
1226
+ );
1227
+ }
1228
+
1229
+ /**
1230
+ * Previous return values from calls to should_sanitize_validation_error().
1231
+ *
1232
+ * This is used to prevent duplicates from being reported when the sanitization status
1233
+ * changes for a validation error in a previously-cached stylesheet.
1234
+ *
1235
+ * @see AMP_Style_Sanitizer::should_sanitize_validation_error()
1236
+ * @var array
1237
+ */
1238
+ protected $previous_should_sanitize_validation_error_results = array();
1239
+
1240
+ /**
1241
+ * Check whether or not sanitization should occur in response to validation error.
1242
+ *
1243
+ * Supply sources to the error and the current node to data.
1244
+ *
1245
+ * @since 1.0
1246
+ *
1247
+ * @param array $validation_error Validation error.
1248
+ * @param array $data Data including the node.
1249
+ * @return bool Whether to sanitize.
1250
+ */
1251
+ public function should_sanitize_validation_error( $validation_error, $data = array() ) {
1252
+ if ( ! isset( $data['node'] ) ) {
1253
+ $data['node'] = $this->current_node;
1254
+ }
1255
+ if ( ! isset( $validation_error['sources'] ) ) {
1256
+ $validation_error['sources'] = $this->current_sources;
1257
+ }
1258
+
1259
+ /*
1260
+ * This is used to prevent duplicates from being reported when the sanitization status
1261
+ * changes for a validation error in a previously-cached stylesheet.
1262
+ */
1263
+ $args = compact( 'validation_error', 'data' );
1264
+ foreach ( $this->previous_should_sanitize_validation_error_results as $result ) {
1265
+ if ( $result['args'] === $args ) {
1266
+ return $result['sanitized'];
1267
+ }
1268
+ }
1269
+
1270
+ $sanitized = parent::should_sanitize_validation_error( $validation_error, $data );
1271
+
1272
+ $this->previous_should_sanitize_validation_error_results[] = compact( 'args', 'sanitized' );
1273
+ return $sanitized;
1274
+ }
1275
+
1276
+ /**
1277
+ * Remove spaces from data URLs which PHP-CSS-Parser doesn't handle.
1278
+ *
1279
+ * @since 1.0
1280
+ *
1281
+ * @param string $css CSS.
1282
+ * @return string CSS with spaces removed from data URLs.
1283
+ */
1284
+ private function remove_spaces_from_data_urls( $css ) {
1285
+ return preg_replace_callback(
1286
+ '/\burl\([^}]*?\)/',
1287
+ function( $matches ) {
1288
+ return preg_replace( '/\s+/', '', $matches[0] );
1289
+ },
1290
+ $css
1291
+ );
1292
+ }
1293
+
1294
+ /**
1295
+ * Process CSS list.
1296
+ *
1297
+ * @since 1.0
1298
+ *
1299
+ * @param CSSList $css_list CSS List.
1300
+ * @param array $options Options.
1301
+ * @return array Validation errors.
1302
+ */
1303
+ private function process_css_list( CSSList $css_list, $options ) {
1304
+ $results = array();
1305
+
1306
+ foreach ( $css_list->getContents() as $css_item ) {
1307
+ $sanitized = false;
1308
+ if ( $css_item instanceof DeclarationBlock && empty( $options['validate_keyframes'] ) ) {
1309
+ $results = array_merge(
1310
+ $results,
1311
+ $this->process_css_declaration_block( $css_item, $css_list, $options )
1312
+ );
1313
+ } elseif ( $css_item instanceof AtRuleBlockList ) {
1314
+ if (is_array($options['allowed_at_rules']) && ! in_array( $css_item->atRuleName(), $options['allowed_at_rules'], true ) ) {
1315
+ $error = array(
1316
+ 'code' => self::ILLEGAL_AT_RULE_ERROR_CODE,
1317
+ 'at_rule' => $css_item->atRuleName(),
1318
+ 'type' => 'amp_validation_error',
1319
+ );
1320
+ $sanitized = $this->should_sanitize_validation_error( $error );
1321
+ $results[] = compact( 'error', 'sanitized' );
1322
+ }
1323
+ if ( ! $sanitized ) {
1324
+ $results = array_merge(
1325
+ $results,
1326
+ $this->process_css_list( $css_item, $options )
1327
+ );
1328
+ }
1329
+ } elseif ( $css_item instanceof Import ) {
1330
+ $results = array_merge(
1331
+ $results,
1332
+ $this->parse_import_stylesheet( $css_item, $css_list, $options )
1333
+ );
1334
+ } elseif ( $css_item instanceof AtRuleSet ) {
1335
+ if ( ! in_array( $css_item->atRuleName(), $options['allowed_at_rules'], true ) ) {
1336
+ $error = array(
1337
+ 'code' => self::ILLEGAL_AT_RULE_ERROR_CODE,
1338
+ 'at_rule' => $css_item->atRuleName(),
1339
+ 'type' => 'amp_validation_error',
1340
+ );
1341
+ $sanitized = $this->should_sanitize_validation_error( $error );
1342
+ $results[] = compact( 'error', 'sanitized' );
1343
+ }
1344
+
1345
+ if ( ! $sanitized ) {
1346
+ $results = array_merge(
1347
+ $results,
1348
+ $this->process_css_declaration_block( $css_item, $css_list, $options )
1349
+ );
1350
+ }
1351
+ } elseif ( $css_item instanceof KeyFrame ) {
1352
+ if ( ! in_array( 'keyframes', $options['allowed_at_rules'], true ) ) {
1353
+ $error = array(
1354
+ 'code' => self::ILLEGAL_AT_RULE_ERROR_CODE,
1355
+ 'at_rule' => $css_item->atRuleName(),
1356
+ 'type' => 'amp_validation_error',
1357
+ );
1358
+ $sanitized = $this->should_sanitize_validation_error( $error );
1359
+ $results[] = compact( 'error', 'sanitized' );
1360
+ }
1361
+
1362
+ if ( ! $sanitized ) {
1363
+ $results = array_merge(
1364
+ $results,
1365
+ $this->process_css_keyframes( $css_item, $options )
1366
+ );
1367
+ }
1368
+ } elseif ( $css_item instanceof AtRule ) {
1369
+ if ( 'charset' === $css_item->atRuleName() ) {
1370
+ /*
1371
+ * The @charset at-rule is not allowed in style elements, so it is not allowed in AMP.
1372
+ * If the @charset is defined, then it really should have already been acknowledged
1373
+ * by PHP-CSS-Parser when the CSS was parsed in the first place, so at this point
1374
+ * it is irrelevant and can be removed.
1375
+ */
1376
+ $sanitized = true;
1377
+ } else {
1378
+ $error = array(
1379
+ 'code' => self::ILLEGAL_AT_RULE_ERROR_CODE,
1380
+ 'at_rule' => $css_item->atRuleName(),
1381
+ 'type' => 'amp_validation_error',
1382
+ );
1383
+ $sanitized = $this->should_sanitize_validation_error( $error );
1384
+ $results[] = compact( 'error', 'sanitized' );
1385
+ }
1386
+ } else {
1387
+ $error = array(
1388
+ 'code' => 'unrecognized_css',
1389
+ 'item' => get_class( $css_item ),
1390
+ 'type' => 'amp_validation_error',
1391
+ );
1392
+ $sanitized = $this->should_sanitize_validation_error( $error );
1393
+ $results[] = compact( 'error', 'sanitized' );
1394
+ }
1395
+
1396
+ if ( $sanitized ) {
1397
+ $css_list->remove( $css_item );
1398
+ }
1399
+ }
1400
+ return $results;
1401
+ }
1402
+
1403
+ /**
1404
+ * Convert URLs in to non-relative real-paths.
1405
+ *
1406
+ * @param URL[] $urls URLs.
1407
+ * @param string $stylesheet_url Stylesheet URL.
1408
+ */
1409
+ private function real_path_urls( $urls, $stylesheet_url ) {
1410
+ $base_url = preg_replace( ':[^/]+(\?.*)?(#.*)?$:', '', $stylesheet_url );
1411
+ if ( empty( $base_url ) ) {
1412
+ return;
1413
+ }
1414
+
1415
+ foreach ( $urls as $url ) {
1416
+ // URLs cannot have spaces in them, so strip them (especially when spaces get erroneously injected in data: URLs).
1417
+ $url_string = $url->getURL()->getString();
1418
+
1419
+ // For data: URLs, all that is needed is to remove spaces so set and continue.
1420
+ if ( 'data:' === substr( $url_string, 0, 5 ) ) {
1421
+ continue;
1422
+ }
1423
+
1424
+ // If the URL is already absolute, continue since there there is nothing left to do.
1425
+ $parsed_url = wp_parse_url( $url_string );
1426
+ if ( ! empty( $parsed_url['host'] ) || empty( $parsed_url['path'] ) || '/' === substr( $parsed_url['path'], 0, 1 ) ) {
1427
+ continue;
1428
+ }
1429
+
1430
+ $relative_url = preg_replace( '#^\./#', '', $url->getURL()->getString() );
1431
+
1432
+ // Resolve any relative parent directory paths.
1433
+ $real_url = $base_url . $relative_url;
1434
+ do {
1435
+ $real_url = preg_replace( '#[^/]+/../#', '', $real_url, -1, $count );
1436
+ } while ( 0 !== $count );
1437
+
1438
+ $url->getURL()->setString( $real_url );
1439
+ }
1440
+ }
1441
+
1442
+ /**
1443
+ * Process CSS rule set.
1444
+ *
1445
+ * @since 1.0
1446
+ * @link https://www.ampproject.org/docs/design/responsive/style_pages#disallowed-styles
1447
+ * @link https://www.ampproject.org/docs/design/responsive/style_pages#restricted-styles
1448
+ *
1449
+ * @param RuleSet $ruleset Ruleset.
1450
+ * @param CSSList $css_list CSS List.
1451
+ * @param array $options Options.
1452
+ *
1453
+ * @return array Validation results.
1454
+ */
1455
+ private function process_css_declaration_block( RuleSet $ruleset, CSSList $css_list, $options ) {
1456
+ $results = array();
1457
+
1458
+ if ( $ruleset instanceof DeclarationBlock ) {
1459
+ $this->ampify_ruleset_selectors( $ruleset );
1460
+ if ( 0 === count( $ruleset->getSelectors() ) ) {
1461
+ $css_list->remove( $ruleset );
1462
+ return $results;
1463
+ }
1464
+ }
1465
+
1466
+ // Remove disallowed properties.
1467
+ if ( ! empty( $options['property_whitelist'] ) ) {
1468
+ $properties = $ruleset->getRules();
1469
+ foreach ( $properties as $property ) {
1470
+ $vendorless_property_name = preg_replace( '/^-\w+-/', '', $property->getRule() );
1471
+ if ( ! in_array( $vendorless_property_name, $options['property_whitelist'], true ) ) {
1472
+ $error = array(
1473
+ 'code' => 'illegal_css_property',
1474
+ 'property_name' => $property->getRule(),
1475
+ 'property_value' => $property->getValue(),
1476
+ 'type' => 'amp_validation_error',
1477
+ );
1478
+ $sanitized = $this->should_sanitize_validation_error( $error );
1479
+ if ( $sanitized ) {
1480
+ $ruleset->removeRule( $property->getRule() );
1481
+ }
1482
+ $results[] = compact( 'error', 'sanitized' );
1483
+ }
1484
+ }
1485
+ } else {
1486
+ foreach ( $options['property_blacklist'] as $illegal_property_name ) {
1487
+ $properties = $ruleset->getRules( $illegal_property_name );
1488
+ foreach ( $properties as $property ) {
1489
+ $error = array(
1490
+ 'code' => 'illegal_css_property',
1491
+ 'property_name' => $property->getRule(),
1492
+ 'property_value' => (string) $property->getValue(),
1493
+ 'type' => 'amp_validation_error',
1494
+ );
1495
+ $sanitized = $this->should_sanitize_validation_error( $error );
1496
+ if ( $sanitized ) {
1497
+ $ruleset->removeRule( $property->getRule() );
1498
+ }
1499
+ $results[] = compact( 'error', 'sanitized' );
1500
+ }
1501
+ }
1502
+ }
1503
+
1504
+ if ( $ruleset instanceof AtRuleSet && 'font-face' === $ruleset->atRuleName() ) {
1505
+ $this->process_font_face_at_rule( $ruleset );
1506
+ }
1507
+
1508
+ $results = array_merge(
1509
+ $results,
1510
+ $this->transform_important_qualifiers( $ruleset, $css_list )
1511
+ );
1512
+
1513
+ // Remove the ruleset if it is now empty.
1514
+ if ( 0 === count( $ruleset->getRules() ) ) {
1515
+ $css_list->remove( $ruleset );
1516
+ }
1517
+ // @todo Delete rules with selectors for -amphtml- class and i-amphtml- tags.
1518
+ return $results;
1519
+ }
1520
+
1521
+ /**
1522
+ * Process @font-face by making src URLs non-relative and converting data: URLs into (assumed) file URLs.
1523
+ *
1524
+ * @since 1.0
1525
+ *
1526
+ * @param AtRuleSet $ruleset Ruleset for @font-face.
1527
+ */
1528
+ private function process_font_face_at_rule( AtRuleSet $ruleset ) {
1529
+ $src_properties = $ruleset->getRules( 'src' );
1530
+ if ( empty( $src_properties ) ) {
1531
+ return;
1532
+ }
1533
+
1534
+ foreach ( $src_properties as $src_property ) {
1535
+ $value = $src_property->getValue();
1536
+ if ( ! ( $value instanceof RuleValueList ) ) {
1537
+ continue;
1538
+ }
1539
+
1540
+ /*
1541
+ * The CSS Parser parses a src such as:
1542
+ *
1543
+ * url(data:application/font-woff;...) format('woff'),
1544
+ * url('Genericons.ttf') format('truetype'),
1545
+ * url('Genericons.svg#genericonsregular') format('svg')
1546
+ *
1547
+ * As a list of components consisting of:
1548
+ *
1549
+ * URL,
1550
+ * RuleValueList( CSSFunction, URL ),
1551
+ * RuleValueList( CSSFunction, URL ),
1552
+ * CSSFunction
1553
+ *
1554
+ * Clearly the components here are not logically grouped. So the first step is to fix the order.
1555
+ */
1556
+ $sources = array();
1557
+ foreach ( $value->getListComponents() as $component ) {
1558
+ if ( $component instanceof RuleValueList ) {
1559
+ $subcomponents = $component->getListComponents();
1560
+ $subcomponent = array_shift( $subcomponents );
1561
+ if ( $subcomponent ) {
1562
+ if ( empty( $sources ) ) {
1563
+ $sources[] = array( $subcomponent );
1564
+ } else {
1565
+ $sources[ count( $sources ) - 1 ][] = $subcomponent;
1566
+ }
1567
+ }
1568
+ foreach ( $subcomponents as $subcomponent ) {
1569
+ $sources[] = array( $subcomponent );
1570
+ }
1571
+ } else {
1572
+ if ( empty( $sources ) ) {
1573
+ $sources[] = array( $component );
1574
+ } else {
1575
+ $sources[ count( $sources ) - 1 ][] = $component;
1576
+ }
1577
+ }
1578
+ }
1579
+
1580
+ /**
1581
+ * Source URL lists.
1582
+ *
1583
+ * @var URL[] $source_file_urls
1584
+ * @var URL[] $source_data_urls
1585
+ */
1586
+ $source_file_urls = array();
1587
+ $source_data_urls = array();
1588
+ foreach ( $sources as $i => $source ) {
1589
+ if ( $source[0] instanceof URL ) {
1590
+ if ( 'data:' === substr( $source[0]->getURL()->getString(), 0, 5 ) ) {
1591
+ $source_data_urls[ $i ] = $source[0];
1592
+ } else {
1593
+ $source_file_urls[ $i ] = $source[0];
1594
+ }
1595
+ }
1596
+ }
1597
+
1598
+ // Convert data: URLs into regular URLs, assuming there will be a file present (e.g. woff fonts in core themes).
1599
+ if ( empty( $source_file_urls ) ) {
1600
+ continue;
1601
+ }
1602
+ $source_file_url = current( $source_file_urls );
1603
+ foreach ( $source_data_urls as $i => $data_url ) {
1604
+ $mime_type = strtok( substr( $data_url->getURL()->getString(), 5 ), ';' );
1605
+ if ( ! $mime_type ) {
1606
+ continue;
1607
+ }
1608
+ $extension = preg_replace( ':.+/(.+-)?:', '', $mime_type );
1609
+ $guessed_url = preg_replace(
1610
+ ':(?<=\.)\w+(\?.*)?(#.*)?$:', // Match the file extension in the URL.
1611
+ $extension,
1612
+ $source_file_url->getURL()->getString(),
1613
+ 1,
1614
+ $count
1615
+ );
1616
+ if ( 1 !== $count ) {
1617
+ continue;
1618
+ }
1619
+
1620
+ // Ensure font file exists.
1621
+ $path = $this->get_validated_url_file_path( $guessed_url, array( 'woff', 'woff2', 'ttf', 'otf', 'svg' ) );
1622
+ if ( is_wp_error( $path ) ) {
1623
+ continue;
1624
+ }
1625
+
1626
+ $data_url->getURL()->setString( $guessed_url );
1627
+ break;
1628
+ }
1629
+ }
1630
+ }
1631
+
1632
+ /**
1633
+ * Process CSS keyframes.
1634
+ *
1635
+ * @since 1.0
1636
+ * @link https://www.ampproject.org/docs/design/responsive/style_pages#restricted-styles.
1637
+ * @link https://github.com/ampproject/amphtml/blob/b685a0780a7f59313666225478b2b79b463bcd0b/validator/validator-main.protoascii#L1002-L1043
1638
+ * @todo Tree shaking could be extended to keyframes, to omit a keyframe if it is not referenced by any rule.
1639
+ *
1640
+ * @param KeyFrame $css_list Ruleset.
1641
+ * @param array $options Options.
1642
+ * @return array Validation results.
1643
+ */
1644
+ private function process_css_keyframes( KeyFrame $css_list, $options ) {
1645
+ $results = array();
1646
+ if ( ! empty( $options['property_whitelist'] ) ) {
1647
+ foreach ( $css_list->getContents() as $rules ) {
1648
+ if ( ! ( $rules instanceof DeclarationBlock ) ) {
1649
+ $error = array(
1650
+ 'code' => 'unrecognized_css',
1651
+ 'item' => get_class( $rules ),
1652
+ 'type' => 'amp_validation_error',
1653
+ );
1654
+ $sanitized = $this->should_sanitize_validation_error( $error );
1655
+ if ( $sanitized ) {
1656
+ $css_list->remove( $rules );
1657
+ }
1658
+ $results[] = compact( 'error', 'sanitized' );
1659
+ continue;
1660
+ }
1661
+
1662
+ $results = array_merge(
1663
+ $results,
1664
+ $this->transform_important_qualifiers( $rules, $css_list )
1665
+ );
1666
+
1667
+ $properties = $rules->getRules();
1668
+ foreach ( $properties as $property ) {
1669
+ $vendorless_property_name = preg_replace( '/^-\w+-/', '', $property->getRule() );
1670
+ if ( ! in_array( $vendorless_property_name, $options['property_whitelist'], true ) ) {
1671
+ $error = array(
1672
+ 'code' => 'illegal_css_property',
1673
+ 'property_name' => $property->getRule(),
1674
+ 'property_value' => (string) $property->getValue(),
1675
+ 'type' => 'amp_validation_error',
1676
+ );
1677
+ $sanitized = $this->should_sanitize_validation_error( $error );
1678
+ if ( $sanitized ) {
1679
+ $rules->removeRule( $property->getRule() );
1680
+ }
1681
+ $results[] = compact( 'error', 'sanitized' );
1682
+ }
1683
+ }
1684
+ }
1685
+ }
1686
+ return $results;
1687
+ }
1688
+
1689
+ /**
1690
+ * Replace !important qualifiers with more specific rules.
1691
+ *
1692
+ * @since 1.0
1693
+ * @see https://www.npmjs.com/package/replace-important
1694
+ * @see https://www.ampproject.org/docs/fundamentals/spec#important
1695
+ *
1696
+ * @param RuleSet|DeclarationBlock $ruleset Rule set.
1697
+ * @param CSSList $css_list CSS List.
1698
+ * @return array Validation results.
1699
+ */
1700
+ private function transform_important_qualifiers( RuleSet $ruleset, CSSList $css_list ) {
1701
+ $results = array();
1702
+
1703
+ // An !important only makes sense for rulesets that have selectors.
1704
+ $allow_transformation = (
1705
+ $ruleset instanceof DeclarationBlock
1706
+ &&
1707
+ ! ( $css_list instanceof KeyFrame )
1708
+ );
1709
+
1710
+ $properties = $ruleset->getRules();
1711
+ $importants = array();
1712
+ foreach ( $properties as $property ) {
1713
+ if ( $property->getIsImportant() ) {
1714
+ if ( $allow_transformation ) {
1715
+ $importants[] = $property;
1716
+ $property->setIsImportant( false );
1717
+ $ruleset->removeRule( $property->getRule() );
1718
+ } else {
1719
+ $error = array(
1720
+ 'code' => 'illegal_css_important',
1721
+ 'type' => 'amp_validation_error',
1722
+ );
1723
+ $sanitized = $this->should_sanitize_validation_error( $error );
1724
+ if ( $sanitized ) {
1725
+ $property->setIsImportant( false );
1726
+ }
1727
+ $results[] = compact( 'error', 'sanitized' );
1728
+ }
1729
+ }
1730
+ }
1731
+ if ( ! $allow_transformation || empty( $importants ) ) {
1732
+ return $results;
1733
+ }
1734
+
1735
+ $important_ruleset = clone $ruleset;
1736
+ $important_ruleset->setSelectors( array_map(
1737
+ /**
1738
+ * Modify selectors to be more specific to roug AMP_Style_Sanitizerhly match the effect of !important.
1739
+ *
1740
+ * @link https://github.com/ampproject/ampstart/blob/4c21d69afdd07b4c60cd190937bda09901955829/tools/replace-important/lib/index.js#L88-L109
1741
+ *
1742
+ * @param Selector $old_selector Original selector.
1743
+ * @return Selector The new more-specific selector.
1744
+ */
1745
+ function( Selector $old_selector ) {
1746
+ // Calculate the specificity multiplier for the placeholder.
1747
+ $specificity_multiplier = AMP_treeshaking_Style_Sanitizer::INLINE_SPECIFICITY_MULTIPLIER + 1 + floor( $old_selector->getSpecificity() / 100 );
1748
+ if ( $old_selector->getSpecificity() % 100 > 0 ) {
1749
+ $specificity_multiplier++;
1750
+ }
1751
+ if ( $old_selector->getSpecificity() % 10 > 0 ) {
1752
+ $specificity_multiplier++;
1753
+ }
1754
+ $selector_mod = str_repeat( ':not(#_)', $specificity_multiplier ); // Here "_" is just a short single-char ID.
1755
+
1756
+ $new_selector = $old_selector->getSelector();
1757
+
1758
+ // Amend the selector mod to the first element in selector if it is already the root; otherwise add new root ancestor.
1759
+ if ( preg_match( '/^\s*(html|:root)\b/i', $new_selector, $matches ) ) {
1760
+ $new_selector = substr( $new_selector, 0, strlen( $matches[0] ) ) . $selector_mod . substr( $new_selector, strlen( $matches[0] ) );
1761
+ } else {
1762
+ $new_selector = sprintf( ':root%s %s', $selector_mod, $new_selector );
1763
+ }
1764
+ return new Selector( $new_selector );
1765
+ },
1766
+ $ruleset->getSelectors()
1767
+ ) );
1768
+ $important_ruleset->setRules( $importants );
1769
+
1770
+ $i = array_search( $ruleset, $css_list->getContents(), true );
1771
+ if ( false !== $i && method_exists( $css_list, 'splice' ) ) {
1772
+ $css_list->splice( $i + 1, 0, array( $important_ruleset ) );
1773
+ } else {
1774
+ $css_list->append( $important_ruleset );
1775
+ }
1776
+
1777
+ return $results;
1778
+ }
1779
+
1780
+ /**
1781
+ * Collect and store all CSS style attributes.
1782
+ *
1783
+ * Collects the CSS styles from within the HTML contained in this instance's DOMDocument.
1784
+ *
1785
+ * @see Retrieve array of styles using $this->get_styles() after calling this method.
1786
+ *
1787
+ * @since 0.4
1788
+ * @since 0.7 Modified to use element passed by XPath query.
1789
+ *
1790
+ * @note Uses recursion to traverse down the tree of DOMDocument nodes.
1791
+ *
1792
+ * @param DOMElement $element Node.
1793
+ */
1794
+ private function collect_inline_styles( $element ) {
1795
+ $style_attribute = $element->getAttributeNode( 'style' );
1796
+ if ( ! $style_attribute || ! trim( $style_attribute->nodeValue ) ) {
1797
+ return;
1798
+ }
1799
+
1800
+ $class = 'amp-wp-' . substr( md5( $style_attribute->nodeValue ), 0, 7 );
1801
+ $root = ':root' . str_repeat( ':not(#_)', self::INLINE_SPECIFICITY_MULTIPLIER );
1802
+ $rule = sprintf( '%s .%s { %s }', $root, $class, $style_attribute->nodeValue );
1803
+
1804
+ $this->set_current_node( $element ); // And sources when needing to be located.
1805
+
1806
+ $processed = $this->process_stylesheet( $rule, array(
1807
+ 'allowed_at_rules' => array(),
1808
+ 'property_whitelist' => $this->style_custom_cdata_spec['css_spec']['declaration'],
1809
+ ) );
1810
+
1811
+ $element->removeAttribute( 'style' );
1812
+
1813
+ if ( $processed['stylesheet'] ) {
1814
+ $this->pending_stylesheets[] = array(
1815
+ 'stylesheet' => $processed['stylesheet'],
1816
+ 'node' => $element,
1817
+ 'sources' => $this->current_sources,
1818
+ );
1819
+
1820
+ if ( $element->hasAttribute( 'class' ) ) {
1821
+ $element->setAttribute( 'class', $element->getAttribute( 'class' ) . ' ' . $class );
1822
+ } else {
1823
+ $element->setAttribute( 'class', $class );
1824
+ }
1825
+ }
1826
+
1827
+ $this->set_current_node( null );
1828
+ }
1829
+
1830
+ /**
1831
+ * Finalize stylesheets for style[amp-custom] and style[amp-keyframes] elements.
1832
+ *
1833
+ * Concatenate all pending stylesheets, remove unused rules if necessary, and add to style elements in doc.
1834
+ * Combine all amp-keyframe styles and add them to the end of the body.
1835
+ *
1836
+ * @since 1.0
1837
+ * @see https://www.ampproject.org/docs/fundamentals/spec#keyframes-stylesheet
1838
+ */
1839
+ private function finalize_styles() {
1840
+
1841
+ $stylesheet_sets = array(
1842
+ 'custom' => array(
1843
+ 'source_map_comment' => "\n\n/*# sourceURL=amp-custom.css */",
1844
+ 'total_size' => 0,
1845
+ 'cdata_spec' => $this->style_custom_cdata_spec,
1846
+ 'pending_stylesheets' => array(),
1847
+ 'final_stylesheets' => array(),
1848
+ 'remove_unused_rules' => $this->args['remove_unused_rules'],
1849
+ ),
1850
+ 'keyframes' => array(
1851
+ 'source_map_comment' => "\n\n/*# sourceURL=amp-keyframes.css */",
1852
+ 'total_size' => 0,
1853
+ 'cdata_spec' => $this->style_keyframes_cdata_spec,
1854
+ 'pending_stylesheets' => array(),
1855
+ 'final_stylesheets' => array(),
1856
+ 'remove_unused_rules' => 'never', // Not relevant.
1857
+ ),
1858
+ );
1859
+ $imported_font_urls = array();
1860
+
1861
+ /*
1862
+ * On Native AMP themes when there are new/rejected validation errors present, a parsed stylesheet may include
1863
+ * @import rules. These must be moved to the beginning to be honored.
1864
+ */
1865
+ $imports = array();
1866
+
1867
+ // Divide pending stylesheet between custom and keyframes, and calculate size of each.
1868
+
1869
+ while ( ! empty( $this->pending_stylesheets ) ) {
1870
+ $pending_stylesheet = array_shift( $this->pending_stylesheets );
1871
+
1872
+ $set_name = ! empty( $pending_stylesheet['keyframes'] ) ? 'keyframes' : 'custom';
1873
+ $size = 0;
1874
+ foreach ( $pending_stylesheet['stylesheet'] as $i => $part ) {
1875
+ if ( is_string( $part ) ) {
1876
+ $size += strlen( $part );
1877
+ if ( '@import' === substr( $part, 0, 7 ) ) {
1878
+ $imports[] = $part;
1879
+ unset( $pending_stylesheet['stylesheet'][ $i ] );
1880
+ }
1881
+ } elseif ( is_array( $part ) ) {
1882
+ $size += strlen( implode( ',', array_keys( $part[0] ) ) ); // Selectors.
1883
+ $size += strlen( $part[1] ); // Declaration block.
1884
+ }
1885
+ }
1886
+ $stylesheet_sets[ $set_name ]['total_size'] += $size;
1887
+ $stylesheet_sets[ $set_name ]['imports'] = $imports;
1888
+ $stylesheet_sets[ $set_name ]['pending_stylesheets'][] = $pending_stylesheet;
1889
+ if ( ! empty( $pending_stylesheet['imported_font_urls'] ) ) {
1890
+ $imported_font_urls = array_merge( $imported_font_urls, $pending_stylesheet['imported_font_urls'] );
1891
+ }
1892
+ }
1893
+
1894
+
1895
+ // Process the pending stylesheets.
1896
+ foreach ( array_keys( $stylesheet_sets ) as $set_name ) {
1897
+ $stylesheet_sets[ $set_name ] = $this->finalize_stylesheet_set( $stylesheet_sets[ $set_name ] );
1898
+ }
1899
+
1900
+ $this->stylesheets = $stylesheet_sets['custom']['final_stylesheets'];
1901
+
1902
+ // If we're not working with the document element (e.g. for legacy post templates) then there is nothing left to do.
1903
+ if ( !ampforwp_get_setting('ampforwp-development-mode') ) {
1904
+ return;
1905
+ }
1906
+
1907
+ // Add style[amp-custom] to document.
1908
+ if ( ! empty( $stylesheet_sets['custom']['final_stylesheets'] ) ) {
1909
+
1910
+ // Ensure style[amp-custom] is present in the document.
1911
+ if ( ! $this->amp_custom_style_element ) {
1912
+ $this->amp_custom_style_element = $this->dom->createElement( 'style' );
1913
+ $this->amp_custom_style_element->setAttribute( 'amp-custom', '' );
1914
+ $this->head->appendChild( $this->amp_custom_style_element );
1915
+ }
1916
+
1917
+ $css = implode( '', $stylesheet_sets['custom']['imports'] ); // For native dirty AMP.
1918
+ $css .= implode( '', $stylesheet_sets['custom']['final_stylesheets'] );
1919
+ $css .= $stylesheet_sets['custom']['source_map_comment'];
1920
+
1921
+ /*
1922
+ * Let the style[amp-custom] be populated with the concatenated CSS.
1923
+ * !important: Updating the contents of this style element by setting textContent is not
1924
+ * reliable across PHP/libxml versions, so this is why the children are removed and the
1925
+ * text node is then explicitly added containing the CSS.
1926
+ */
1927
+ while ( $this->amp_custom_style_element->firstChild ) {
1928
+ $this->amp_custom_style_element->removeChild( $this->amp_custom_style_element->firstChild );
1929
+ }
1930
+ $this->amp_custom_style_element->appendChild( $this->dom->createTextNode( $css ) );
1931
+
1932
+ $included_size = 0;
1933
+ $included_original_size = 0;
1934
+ $excluded_size = 0;
1935
+ $excluded_original_size = 0;
1936
+ $included_sources = array();
1937
+ foreach ( $stylesheet_sets['custom']['pending_stylesheets'] as $i => $pending_stylesheet ) {
1938
+ /*if ( !( $pending_stylesheet['node'] instanceof DOMElement ) ) {
1939
+ continue;
1940
+ }*/
1941
+ $message = sprintf( '% 6d B', $pending_stylesheet['size'] );
1942
+ if ( $pending_stylesheet['size'] && $pending_stylesheet['size'] !== $pending_stylesheet['original_size'] ) {
1943
+ $message .= sprintf( ' (%d%%)', $pending_stylesheet['size'] / $pending_stylesheet['original_size'] * 100 );
1944
+ }
1945
+ $message .= ': ';
1946
+ $message .= $pending_stylesheet['node']->nodeName;
1947
+ if ( $pending_stylesheet['node']->getAttribute( 'id' ) ) {
1948
+ $message .= '#' . $pending_stylesheet['node']->getAttribute( 'id' );
1949
+ }
1950
+ if ( $pending_stylesheet['node']->getAttribute( 'class' ) ) {
1951
+ $message .= '.' . $pending_stylesheet['node']->getAttribute( 'class' );
1952
+ }
1953
+ foreach ( $pending_stylesheet['node']->attributes as $attribute ) {
1954
+ if ( 'id' !== $attribute->nodeName || 'class' !== $attribute->nodeName ) {
1955
+ $message .= sprintf( '[%s=%s]', $attribute->nodeName, $attribute->nodeValue );
1956
+ }
1957
+ }
1958
+
1959
+ if ( ! empty( $pending_stylesheet['included'] ) ) {
1960
+ $included_sources[] = $message;
1961
+ $included_size += $pending_stylesheet['size'];
1962
+ $included_original_size += $pending_stylesheet['original_size'];
1963
+ } else {
1964
+ $excluded_sources[] = $message;
1965
+ $excluded_size += $pending_stylesheet['size'];
1966
+ $excluded_original_size += $pending_stylesheet['original_size'];
1967
+ }
1968
+ }
1969
+ $comment = '';
1970
+ if ( ! empty( $included_sources ) && $included_original_size > 0 ) {
1971
+
1972
+ $comment .= esc_html__( 'The style[amp-custom] element is populated with:', 'amp' ) . "\n" . implode( "\n", $included_sources ) . "\n";
1973
+ if ( self::has_required_php_css_parser() ) {
1974
+ $comment .= sprintf(
1975
+ /* translators: %1$d is number of included bytes, %2$d is percentage of total CSS actually included after tree shaking, %3$d is total included size */
1976
+ esc_html__( 'Total included size: %1$s bytes (%2$d%% of %3$s total after tree shaking)', 'amp' ),
1977
+ number_format_i18n( $included_size ),
1978
+ $included_size / $included_original_size * 100,
1979
+ number_format_i18n( $included_original_size )
1980
+ ) . "\n";
1981
+ } else {
1982
+ $comment .= sprintf(
1983
+ /* translators: %1$d is number of included bytes */
1984
+ esc_html__( 'Total included size: %1$s bytes', 'amp' ),
1985
+ number_format_i18n( $included_size ),
1986
+ $included_size / $included_original_size * 100,
1987
+ number_format_i18n( $included_original_size )
1988
+ ) . "\n";
1989
+ }
1990
+ }
1991
+ if ( ! empty( $excluded_sources ) && $excluded_original_size > 0 ) {
1992
+ if ( $comment ) {
1993
+ $comment .= "\n";
1994
+ }
1995
+ $comment .= esc_html__( 'The following stylesheets are too large to be included in style[amp-custom]:', 'amp' ) . "\n" . implode( "\n", $excluded_sources ) . "\n";
1996
+
1997
+ if ( self::has_required_php_css_parser() ) {
1998
+ $comment .= sprintf(
1999
+ /* translators: %1$d is number of excluded bytes, %2$d is percentage of total CSS actually excluded even after tree shaking, %3$d is total excluded size */
2000
+ esc_html__( 'Total excluded size: %1$s bytes (%2$d%% of %3$s total after tree shaking)', 'amp' ),
2001
+ number_format_i18n( $excluded_size ),
2002
+ $excluded_size / $excluded_original_size * 100,
2003
+ number_format_i18n( $excluded_original_size )
2004
+ ) . "\n";
2005
+ } else {
2006
+ $comment .= sprintf(
2007
+ /* translators: %1$d is number of excluded bytes */
2008
+ esc_html__( 'Total excluded size: %1$s bytes', 'amp' ),
2009
+ number_format_i18n( $excluded_size ),
2010
+ $excluded_size / $excluded_original_size * 100,
2011
+ number_format_i18n( $excluded_original_size )
2012
+ ) . "\n";
2013
+ }
2014
+
2015
+ $total_size = $included_size + $excluded_size;
2016
+ $total_original_size = $included_original_size + $excluded_original_size;
2017
+ if ( $total_size !== $total_original_size ) {
2018
+ $comment .= "\n";
2019
+ $comment .= sprintf(
2020
+ /* translators: %1$d is total combined bytes, %2$d is percentage of CSS after tree shaking, %3$d is total before tree shaking */
2021
+ esc_html__( 'Total combined size: %1$s bytes (%2$d%% of %3$s total after tree shaking)', 'amp' ),
2022
+ number_format_i18n( $total_size ),
2023
+ ( $total_size / $total_original_size ) * 100,
2024
+ number_format_i18n( $total_original_size )
2025
+ ) . "\n";
2026
+ }
2027
+ }
2028
+
2029
+ if ( ! self::has_required_php_css_parser() ) {
2030
+ $comment .= "\n" . esc_html__( '!!!WARNING!!! AMP CSS processing is limited because a conflicting version of PHP-CSS-Parser has been loaded by another plugin/theme. Tree shaking is not available.', 'amp' ) . "\n";
2031
+ }
2032
+
2033
+ if ( $comment ) {
2034
+ $this->comments_notice = '<!-- '.$comment.' -->';
2035
+ /*$this->amp_custom_style_element->parentNode->insertBefore(
2036
+ $this->dom->createComment( "\n$comment" ),
2037
+ $this->amp_custom_style_element
2038
+ );*/
2039
+ }
2040
+
2041
+ }
2042
+ /*
2043
+ * Add font stylesheets from CDNs which were extracted from @import rules.
2044
+ * We can't add crossorigin=anonymous to these since such a CORS request would not be made in the non-AMP version,
2045
+ * and so if the service worker cached the opaque response on the non-AMP version then it wouldn't be usable in
2046
+ * the AMP version if it was requested with CORS.
2047
+ */
2048
+ foreach ( array_unique( $imported_font_urls ) as $imported_font_url ) {
2049
+ $link = $this->dom->createElement( 'link' );
2050
+ $link->setAttribute( 'rel', 'stylesheet' );
2051
+ $link->setAttribute( 'href', $imported_font_url );
2052
+ $this->head->appendChild( $link );
2053
+ }
2054
+
2055
+ // Add style[amp-keyframes] to document.
2056
+ if ( ! empty( $stylesheet_sets['keyframes']['final_stylesheets'] ) ) {
2057
+ $body = $this->dom->getElementsByTagName( 'body' )->item( 0 );
2058
+ if ( ! $body ) {
2059
+ $this->should_sanitize_validation_error( array(
2060
+ 'code' => 'missing_body_element',
2061
+ 'type' => 'amp_validation_error',
2062
+ ) );
2063
+ } else {
2064
+ $css = implode( '', $stylesheet_sets['keyframes']['final_stylesheets'] );
2065
+ $css .= $stylesheet_sets['keyframes']['source_map_comment'];
2066
+
2067
+ $style_element = $this->dom->createElement( 'style' );
2068
+ $style_element->setAttribute( 'amp-keyframes', '' );
2069
+ $style_element->appendChild( $this->dom->createTextNode( $css ) );
2070
+ $body->appendChild( $style_element );
2071
+ }
2072
+ }
2073
+ }
2074
+
2075
+ /**
2076
+ * Convert CSS selectors and remove obsolete selector hacks for IE.
2077
+ *
2078
+ * @param DeclarationBlock $ruleset Ruleset.
2079
+ */
2080
+ private function ampify_ruleset_selectors( $ruleset ) {
2081
+ $selectors = array();
2082
+ $changes = 0;
2083
+ $language = 'en';
2084
+ foreach ( $ruleset->getSelectors() as $old_selector ) {
2085
+ $selector = $old_selector->getSelector();
2086
+
2087
+ // Automatically tree-shake IE6/IE7 hacks for selectors with `* html` and `*+html`.
2088
+ if ( preg_match( '/^\*\s*\+?\s*html/', $selector ) ) {
2089
+ $changes++;
2090
+ continue;
2091
+ }
2092
+
2093
+ // Automatically remove selectors that are for another language (and thus are irrelevant). This is safe because amp-bind'ed [lang] is not allowed.
2094
+ $is_other_language = (
2095
+ preg_match( '/^html\[lang(?P<starts_with>\^?)=([\'"]?)(?P<lang>.+?)\2\]/', $selector, $matches )
2096
+ &&
2097
+ (
2098
+ empty( $matches['starts_with'] )
2099
+ ?
2100
+ $language !== $matches['lang']
2101
+ :
2102
+ substr( $language, 0, strlen( $matches['lang'] ) ) !== $matches['lang']
2103
+ )
2104
+ );
2105
+ if ( $is_other_language ) {
2106
+ $changes++;
2107
+ continue;
2108
+ }
2109
+
2110
+ // An element (type) either starts a selector or is preceded by combinator, comma, opening paren, or closing brace.
2111
+ $before_type_selector_pattern = '(?<=^|\(|\s|>|\+|~|,|})';
2112
+ $after_type_selector_pattern = '(?=$|[^a-zA-Z0-9_-])';
2113
+
2114
+ $edited_selectors = array( $selector );
2115
+ foreach ( $this->selector_mappings as $html_selector => $amp_selectors ) { // Note: The $selector_mappings array contains ~6 items.
2116
+ $html_pattern = '/' . $before_type_selector_pattern . preg_quote( $html_selector, '/' ) . $after_type_selector_pattern . '/i';
2117
+ foreach ( $edited_selectors as &$edited_selector ) { // Note: The $edited_selectors array contains only item in the normal case.
2118
+ $original_selector = $edited_selector;
2119
+ $amp_selector = array_shift( $amp_selectors );
2120
+ $amp_tag_pattern = '/' . $before_type_selector_pattern . preg_quote( $amp_selector, '/' ) . $after_type_selector_pattern . '/i';
2121
+ preg_match( $amp_tag_pattern, $edited_selector, $matches );
2122
+ if ( ! empty( $matches ) && $amp_selector === $matches[0] ) {
2123
+ continue;
2124
+ }
2125
+ $edited_selector = preg_replace( $html_pattern, $amp_selector, $edited_selector, -1, $count );
2126
+ if ( ! $count ) {
2127
+ continue;
2128
+ }
2129
+ $changes += $count;
2130
+ while ( ! empty( $amp_selectors ) ) { // Note: This array contains only a couple items.
2131
+ $amp_selector = array_shift( $amp_selectors );
2132
+ $edited_selectors[] = preg_replace( $html_pattern, $amp_selector, $original_selector, -1, $count );
2133
+ }
2134
+ }
2135
+ }
2136
+ $selectors = array_merge( $selectors, $edited_selectors );
2137
+ }
2138
+
2139
+ if ( $changes > 0 ) {
2140
+ $ruleset->setSelectors( $selectors );
2141
+ }
2142
+ }
2143
+
2144
+ /**
2145
+ * Finalize a stylesheet set (amp-custom or amp-keyframes).
2146
+ *
2147
+ * @since 1.0
2148
+ *
2149
+ * @param array $stylesheet_set Stylesheet set.
2150
+ * @return array Finalized stylesheet set.
2151
+ */
2152
+ private function finalize_stylesheet_set( $stylesheet_set ) {
2153
+ $max_bytes = $stylesheet_set['cdata_spec']['max_bytes'] - strlen( $stylesheet_set['source_map_comment'] );
2154
+ $is_too_much_css = $stylesheet_set['total_size'] > $max_bytes;
2155
+
2156
+ $should_tree_shake = (
2157
+ 'always' === $stylesheet_set['remove_unused_rules'] || (
2158
+ $is_too_much_css
2159
+ &&
2160
+ 'sometimes' === $stylesheet_set['remove_unused_rules']
2161
+ )
2162
+ );
2163
+
2164
+ if ( $is_too_much_css && $should_tree_shake && empty( $this->args['accept_tree_shaking'] ) ) {
2165
+ $should_tree_shake = $this->should_sanitize_validation_error( array(
2166
+ 'code' => self::TREE_SHAKING_ERROR_CODE,
2167
+ 'type' => 'amp_validation_error',
2168
+ ) );
2169
+ }
2170
+
2171
+ $stylesheet_set['processed_nodes'] = array();
2172
+
2173
+ $final_size = 0;
2174
+ $dom = $this->dom;
2175
+ foreach ( $stylesheet_set['pending_stylesheets'] as &$pending_stylesheet ) {
2176
+ $stylesheet_parts = array();
2177
+ $original_size = 0;
2178
+ foreach ( $pending_stylesheet['stylesheet'] as $stylesheet_part ) {
2179
+ if ( is_string( $stylesheet_part ) ) {
2180
+ $stylesheet_parts[] = $stylesheet_part;
2181
+ $original_size += strlen( $stylesheet_part );
2182
+ continue;
2183
+ }
2184
+
2185
+ list( $selectors_parsed, $declaration_block ) = $stylesheet_part;
2186
+ if ( $should_tree_shake ) {
2187
+ $selectors = array();
2188
+ foreach ( $selectors_parsed as $selector => $parsed_selector ) {
2189
+ $should_include = (
2190
+ (
2191
+ // If all class names are used in the doc.
2192
+ (
2193
+ empty( $parsed_selector['classes'] )
2194
+ ||
2195
+ 0 === count( array_diff( $parsed_selector['classes'], $this->get_used_class_names() ) )
2196
+ )
2197
+ &&
2198
+ // If all IDs are used in the doc.
2199
+ (
2200
+ empty( $parsed_selector['ids'] )
2201
+ ||
2202
+ 0 === count( array_filter( $parsed_selector['ids'], function( $id ) use ( $dom ) {
2203
+ return ! $dom->getElementById( $id );
2204
+ } ) )
2205
+ )
2206
+ &&
2207
+ // If tag names are present in the doc.
2208
+ (
2209
+ empty( $parsed_selector['tags'] )
2210
+ ||
2211
+ 0 === count( array_diff( $parsed_selector['tags'], $this->get_used_tag_names() ) )
2212
+ )
2213
+ )
2214
+ );
2215
+ if ( $should_include ) {
2216
+ $selectors[] = $selector;
2217
+ }
2218
+ }
2219
+ } else {
2220
+ $selectors = array_keys( $selectors_parsed );
2221
+ }
2222
+ $stylesheet_part = implode( ',', $selectors ) . $declaration_block;
2223
+ $original_size += strlen( $stylesheet_part );
2224
+ if ( ! empty( $selectors ) ) {
2225
+ $stylesheet_parts[] = $stylesheet_part;
2226
+ }
2227
+ }
2228
+
2229
+ // Strip empty at-rules after tree shaking.
2230
+ $stylesheet_part_count = count( $stylesheet_parts );
2231
+ for ( $i = 0; $i < $stylesheet_part_count; $i++ ) {
2232
+ $stylesheet_part = $stylesheet_parts[ $i ];
2233
+ if ( '@' !== substr( $stylesheet_part, 0, 1 ) ) {
2234
+ continue;
2235
+ }
2236
+
2237
+ // Delete empty at-rules.
2238
+ if ( '{}' === substr( $stylesheet_part, -2 ) ) {
2239
+ $stylesheet_part_count--;
2240
+ array_splice( $stylesheet_parts, $i, 1 );
2241
+ $i--;
2242
+ continue;
2243
+ }
2244
+
2245
+ // Delete at-rules that were emptied due to tree-shaking.
2246
+ if ( '{' === substr( $stylesheet_part, -1 ) ) {
2247
+ $open_braces = 1;
2248
+ for ( $j = $i + 1; $j < $stylesheet_part_count; $j++ ) {
2249
+ $stylesheet_part = $stylesheet_parts[ $j ];
2250
+ $is_at_rule = '@' === substr( $stylesheet_part, 0, 1 );
2251
+ if ( empty( $stylesheet_part ) ) {
2252
+ continue; // There was a shaken rule.
2253
+ } elseif ( $is_at_rule && '{}' === substr( $stylesheet_part, -2 ) ) {
2254
+ continue; // The rule opens is empty from the start.
2255
+ } elseif ( $is_at_rule && '{' === substr( $stylesheet_part, -1 ) ) {
2256
+ $open_braces++;
2257
+ } elseif ( '}' === $stylesheet_part ) {
2258
+ $open_braces--;
2259
+ } else {
2260
+ break;
2261
+ }
2262
+
2263
+ // Splice out the parts that are empty.
2264
+ if ( 0 === $open_braces ) {
2265
+ array_splice( $stylesheet_parts, $i, $j - $i + 1 );
2266
+ $stylesheet_part_count = count( $stylesheet_parts );
2267
+ $i--;
2268
+ continue 2;
2269
+ }
2270
+ }
2271
+ }
2272
+ }
2273
+ $pending_stylesheet['original_size'] = $original_size;
2274
+
2275
+ $stylesheet = implode( '', $stylesheet_parts );
2276
+ unset( $stylesheet_parts );
2277
+ $sheet_size = strlen( $stylesheet );
2278
+ $pending_stylesheet['size'] = $sheet_size;
2279
+
2280
+ // Skip considering stylesheet if an identical one has already been processed.
2281
+ $hash = md5( $stylesheet );
2282
+ if ( isset( $stylesheet_set['final_stylesheets'][ $hash ] ) ) {
2283
+ $pending_stylesheet['included'] = true;
2284
+ continue;
2285
+ }
2286
+ //
2287
+ // Report validation error if size is now too big.
2288
+ if ( false ) {
2289
+ $validation_error = array(
2290
+ 'code' => 'excessive_css',
2291
+ 'type' => 'amp_validation_error',
2292
+ );
2293
+ if ( isset( $pending_stylesheet['sources'] ) ) {
2294
+ $validation_error['sources'] = $pending_stylesheet['sources'];
2295
+ }
2296
+
2297
+ if ( $this->should_sanitize_validation_error( $validation_error, wp_array_slice_assoc( $pending_stylesheet, array( 'node' ) ) ) ) {
2298
+ $pending_stylesheet['included'] = false;
2299
+ continue; // Skip to the next stylesheet.
2300
+ }
2301
+ }
2302
+
2303
+ $final_size += $sheet_size;
2304
+
2305
+ $pending_stylesheet['included'] = true;
2306
+ $stylesheet_set['final_stylesheets'][ $hash ] = $stylesheet;
2307
+ }
2308
+
2309
+ return $stylesheet_set;
2310
+ }
2311
+ }
includes/vendor/css-parser/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit117444c18d5d7304d751024fddbe3a07::getLoader();
includes/vendor/css-parser/composer.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {
2
+ "require": {
3
+ "sabberworm/php-css-parser": "*"
4
+ }
5
+ }
includes/vendor/css-parser/composer.lock ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "246b5f6402d1d1bdd2a0247cb17935a0",
8
+ "packages": [
9
+ {
10
+ "name": "sabberworm/php-css-parser",
11
+ "version": "8.3.0",
12
+ "source": {
13
+ "type": "git",
14
+ "url": "https://github.com/sabberworm/PHP-CSS-Parser.git",
15
+ "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f"
16
+ },
17
+ "dist": {
18
+ "type": "zip",
19
+ "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f",
20
+ "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f",
21
+ "shasum": ""
22
+ },
23
+ "require": {
24
+ "php": ">=5.3.2"
25
+ },
26
+ "require-dev": {
27
+ "codacy/coverage": "^1.4",
28
+ "phpunit/phpunit": "~4.8"
29
+ },
30
+ "type": "library",
31
+ "autoload": {
32
+ "psr-0": {
33
+ "Sabberworm\\CSS": "lib/"
34
+ }
35
+ },
36
+ "notification-url": "https://packagist.org/downloads/",
37
+ "license": [
38
+ "MIT"
39
+ ],
40
+ "authors": [
41
+ {
42
+ "name": "Raphael Schweikert"
43
+ }
44
+ ],
45
+ "description": "Parser for CSS Files written in PHP",
46
+ "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser",
47
+ "keywords": [
48
+ "css",
49
+ "parser",
50
+ "stylesheet"
51
+ ],
52
+ "time": "2019-02-22T07:42:52+00:00"
53
+ }
54
+ ],
55
+ "packages-dev": [],
56
+ "aliases": [],
57
+ "minimum-stability": "stable",
58
+ "stability-flags": [],
59
+ "prefer-stable": false,
60
+ "prefer-lowest": false,
61
+ "platform": [],
62
+ "platform-dev": []
63
+ }
includes/vendor/css-parser/composer/ClassLoader.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+ private $classMapAuthoritative = false;
57
+ private $missingClasses = array();
58
+ private $apcuPrefix;
59
+
60
+ public function getPrefixes()
61
+ {
62
+ if (!empty($this->prefixesPsr0)) {
63
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
64
+ }
65
+
66
+ return array();
67
+ }
68
+
69
+ public function getPrefixesPsr4()
70
+ {
71
+ return $this->prefixDirsPsr4;
72
+ }
73
+
74
+ public function getFallbackDirs()
75
+ {
76
+ return $this->fallbackDirsPsr0;
77
+ }
78
+
79
+ public function getFallbackDirsPsr4()
80
+ {
81
+ return $this->fallbackDirsPsr4;
82
+ }
83
+
84
+ public function getClassMap()
85
+ {
86
+ return $this->classMap;
87
+ }
88
+
89
+ /**
90
+ * @param array $classMap Class to filename map
91
+ */
92
+ public function addClassMap(array $classMap)
93
+ {
94
+ if ($this->classMap) {
95
+ $this->classMap = array_merge($this->classMap, $classMap);
96
+ } else {
97
+ $this->classMap = $classMap;
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Registers a set of PSR-0 directories for a given prefix, either
103
+ * appending or prepending to the ones previously set for this prefix.
104
+ *
105
+ * @param string $prefix The prefix
106
+ * @param array|string $paths The PSR-0 root directories
107
+ * @param bool $prepend Whether to prepend the directories
108
+ */
109
+ public function add($prefix, $paths, $prepend = false)
110
+ {
111
+ if (!$prefix) {
112
+ if ($prepend) {
113
+ $this->fallbackDirsPsr0 = array_merge(
114
+ (array) $paths,
115
+ $this->fallbackDirsPsr0
116
+ );
117
+ } else {
118
+ $this->fallbackDirsPsr0 = array_merge(
119
+ $this->fallbackDirsPsr0,
120
+ (array) $paths
121
+ );
122
+ }
123
+
124
+ return;
125
+ }
126
+
127
+ $first = $prefix[0];
128
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
+
131
+ return;
132
+ }
133
+ if ($prepend) {
134
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
135
+ (array) $paths,
136
+ $this->prefixesPsr0[$first][$prefix]
137
+ );
138
+ } else {
139
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
140
+ $this->prefixesPsr0[$first][$prefix],
141
+ (array) $paths
142
+ );
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Registers a set of PSR-4 directories for a given namespace, either
148
+ * appending or prepending to the ones previously set for this namespace.
149
+ *
150
+ * @param string $prefix The prefix/namespace, with trailing '\\'
151
+ * @param array|string $paths The PSR-4 base directories
152
+ * @param bool $prepend Whether to prepend the directories
153
+ *
154
+ * @throws \InvalidArgumentException
155
+ */
156
+ public function addPsr4($prefix, $paths, $prepend = false)
157
+ {
158
+ if (!$prefix) {
159
+ // Register directories for the root namespace.
160
+ if ($prepend) {
161
+ $this->fallbackDirsPsr4 = array_merge(
162
+ (array) $paths,
163
+ $this->fallbackDirsPsr4
164
+ );
165
+ } else {
166
+ $this->fallbackDirsPsr4 = array_merge(
167
+ $this->fallbackDirsPsr4,
168
+ (array) $paths
169
+ );
170
+ }
171
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
+ // Register directories for a new namespace.
173
+ $length = strlen($prefix);
174
+ if ('\\' !== $prefix[$length - 1]) {
175
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
+ }
177
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
+ } elseif ($prepend) {
180
+ // Prepend directories for an already registered namespace.
181
+ $this->prefixDirsPsr4[$prefix] = array_merge(
182
+ (array) $paths,
183
+ $this->prefixDirsPsr4[$prefix]
184
+ );
185
+ } else {
186
+ // Append directories for an already registered namespace.
187
+ $this->prefixDirsPsr4[$prefix] = array_merge(
188
+ $this->prefixDirsPsr4[$prefix],
189
+ (array) $paths
190
+ );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Registers a set of PSR-0 directories for a given prefix,
196
+ * replacing any others previously set for this prefix.
197
+ *
198
+ * @param string $prefix The prefix
199
+ * @param array|string $paths The PSR-0 base directories
200
+ */
201
+ public function set($prefix, $paths)
202
+ {
203
+ if (!$prefix) {
204
+ $this->fallbackDirsPsr0 = (array) $paths;
205
+ } else {
206
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
+ }
208
+ }
209
+
210
+ /**
211
+ * Registers a set of PSR-4 directories for a given namespace,
212
+ * replacing any others previously set for this namespace.
213
+ *
214
+ * @param string $prefix The prefix/namespace, with trailing '\\'
215
+ * @param array|string $paths The PSR-4 base directories
216
+ *
217
+ * @throws \InvalidArgumentException
218
+ */
219
+ public function setPsr4($prefix, $paths)
220
+ {
221
+ if (!$prefix) {
222
+ $this->fallbackDirsPsr4 = (array) $paths;
223
+ } else {
224
+ $length = strlen($prefix);
225
+ if ('\\' !== $prefix[$length - 1]) {
226
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
+ }
228
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Turns on searching the include path for class files.
235
+ *
236
+ * @param bool $useIncludePath
237
+ */
238
+ public function setUseIncludePath($useIncludePath)
239
+ {
240
+ $this->useIncludePath = $useIncludePath;
241
+ }
242
+
243
+ /**
244
+ * Can be used to check if the autoloader uses the include path to check
245
+ * for classes.
246
+ *
247
+ * @return bool
248
+ */
249
+ public function getUseIncludePath()
250
+ {
251
+ return $this->useIncludePath;
252
+ }
253
+
254
+ /**
255
+ * Turns off searching the prefix and fallback directories for classes
256
+ * that have not been registered with the class map.
257
+ *
258
+ * @param bool $classMapAuthoritative
259
+ */
260
+ public function setClassMapAuthoritative($classMapAuthoritative)
261
+ {
262
+ $this->classMapAuthoritative = $classMapAuthoritative;
263
+ }
264
+
265
+ /**
266
+ * Should class lookup fail if not found in the current class map?
267
+ *
268
+ * @return bool
269
+ */
270
+ public function isClassMapAuthoritative()
271
+ {
272
+ return $this->classMapAuthoritative;
273
+ }
274
+
275
+ /**
276
+ * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
+ *
278
+ * @param string|null $apcuPrefix
279
+ */
280
+ public function setApcuPrefix($apcuPrefix)
281
+ {
282
+ $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
+ }
284
+
285
+ /**
286
+ * The APCu prefix in use, or null if APCu caching is not enabled.
287
+ *
288
+ * @return string|null
289
+ */
290
+ public function getApcuPrefix()
291
+ {
292
+ return $this->apcuPrefix;
293
+ }
294
+
295
+ /**
296
+ * Registers this instance as an autoloader.
297
+ *
298
+ * @param bool $prepend Whether to prepend the autoloader or not
299
+ */
300
+ public function register($prepend = false)
301
+ {
302
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
+ }
304
+
305
+ /**
306
+ * Unregisters this instance as an autoloader.
307
+ */
308
+ public function unregister()
309
+ {
310
+ spl_autoload_unregister(array($this, 'loadClass'));
311
+ }
312
+
313
+ /**
314
+ * Loads the given class or interface.
315
+ *
316
+ * @param string $class The name of the class
317
+ * @return bool|null True if loaded, null otherwise
318
+ */
319
+ public function loadClass($class)
320
+ {
321
+ if ($file = $this->findFile($class)) {
322
+ includeFile($file);
323
+
324
+ return true;
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Finds the path to the file where the class is defined.
330
+ *
331
+ * @param string $class The name of the class
332
+ *
333
+ * @return string|false The path if found, false otherwise
334
+ */
335
+ public function findFile($class)
336
+ {
337
+ // class map lookup
338
+ if (isset($this->classMap[$class])) {
339
+ return $this->classMap[$class];
340
+ }
341
+ if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
+ return false;
343
+ }
344
+ if (null !== $this->apcuPrefix) {
345
+ $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
+ if ($hit) {
347
+ return $file;
348
+ }
349
+ }
350
+
351
+ $file = $this->findFileWithExtension($class, '.php');
352
+
353
+ // Search for Hack files if we are running on HHVM
354
+ if (false === $file && defined('HHVM_VERSION')) {
355
+ $file = $this->findFileWithExtension($class, '.hh');
356
+ }
357
+
358
+ if (null !== $this->apcuPrefix) {
359
+ apcu_add($this->apcuPrefix.$class, $file);
360
+ }
361
+
362
+ if (false === $file) {
363
+ // Remember that this class does not exist.
364
+ $this->missingClasses[$class] = true;
365
+ }
366
+
367
+ return $file;
368
+ }
369
+
370
+ private function findFileWithExtension($class, $ext)
371
+ {
372
+ // PSR-4 lookup
373
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
+
375
+ $first = $class[0];
376
+ if (isset($this->prefixLengthsPsr4[$first])) {
377
+ $subPath = $class;
378
+ while (false !== $lastPos = strrpos($subPath, '\\')) {
379
+ $subPath = substr($subPath, 0, $lastPos);
380
+ $search = $subPath . '\\';
381
+ if (isset($this->prefixDirsPsr4[$search])) {
382
+ $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
+ foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
+ if (file_exists($file = $dir . $pathEnd)) {
385
+ return $file;
386
+ }
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+ // PSR-4 fallback dirs
393
+ foreach ($this->fallbackDirsPsr4 as $dir) {
394
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
+ return $file;
396
+ }
397
+ }
398
+
399
+ // PSR-0 lookup
400
+ if (false !== $pos = strrpos($class, '\\')) {
401
+ // namespaced class name
402
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
+ } else {
405
+ // PEAR-like class name
406
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
+ }
408
+
409
+ if (isset($this->prefixesPsr0[$first])) {
410
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
+ if (0 === strpos($class, $prefix)) {
412
+ foreach ($dirs as $dir) {
413
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
+ return $file;
415
+ }
416
+ }
417
+ }
418
+ }
419
+ }
420
+
421
+ // PSR-0 fallback dirs
422
+ foreach ($this->fallbackDirsPsr0 as $dir) {
423
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
+ return $file;
425
+ }
426
+ }
427
+
428
+ // PSR-0 include paths.
429
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
+ return $file;
431
+ }
432
+
433
+ return false;
434
+ }
435
+ }
436
+
437
+ /**
438
+ * Scope isolated include.
439
+ *
440
+ * Prevents access to $this/self from included files.
441
+ */
442
+ function includeFile($file)
443
+ {
444
+ include $file;
445
+ }
includes/vendor/css-parser/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) Nils Adermann, Jordi Boggiano
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
includes/vendor/css-parser/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
includes/vendor/css-parser/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'Sabberworm\\CSS' => array($vendorDir . '/sabberworm/php-css-parser/lib'),
10
+ );
includes/vendor/css-parser/composer/autoload_psr4.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
includes/vendor/css-parser/composer/autoload_real.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit117444c18d5d7304d751024fddbe3a07
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit117444c18d5d7304d751024fddbe3a07', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit117444c18d5d7304d751024fddbe3a07', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit117444c18d5d7304d751024fddbe3a07::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ return $loader;
51
+ }
52
+ }
includes/vendor/css-parser/composer/autoload_static.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit117444c18d5d7304d751024fddbe3a07
8
+ {
9
+ public static $prefixesPsr0 = array (
10
+ 'S' =>
11
+ array (
12
+ 'Sabberworm\\CSS' =>
13
+ array (
14
+ 0 => __DIR__ . '/..' . '/sabberworm/php-css-parser/lib',
15
+ ),
16
+ ),
17
+ );
18
+
19
+ public static function getInitializer(ClassLoader $loader)
20
+ {
21
+ return \Closure::bind(function () use ($loader) {
22
+ $loader->prefixesPsr0 = ComposerStaticInit117444c18d5d7304d751024fddbe3a07::$prefixesPsr0;
23
+
24
+ }, null, ClassLoader::class);
25
+ }
26
+ }
includes/vendor/css-parser/composer/installed.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "sabberworm/php-css-parser",
4
+ "version": "8.3.0",
5
+ "version_normalized": "8.3.0.0",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/sabberworm/PHP-CSS-Parser.git",
9
+ "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f",
14
+ "reference": "91bcc3e3fdb7386c9a2e0e0aa09ca75cc43f121f",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.3.2"
19
+ },
20
+ "require-dev": {
21
+ "codacy/coverage": "^1.4",
22
+ "phpunit/phpunit": "~4.8"
23
+ },
24
+ "time": "2019-02-22T07:42:52+00:00",
25
+ "type": "library",
26
+ "installation-source": "dist",
27
+ "autoload": {
28
+ "psr-0": {
29
+ "Sabberworm\\CSS": "lib/"
30
+ }
31
+ },
32
+ "notification-url": "https://packagist.org/downloads/",
33
+ "license": [
34
+ "MIT"
35
+ ],
36
+ "authors": [
37
+ {
38
+ "name": "Raphael Schweikert"
39
+ }
40
+ ],
41
+ "description": "Parser for CSS Files written in PHP",
42
+ "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser",
43
+ "keywords": [
44
+ "css",
45
+ "parser",
46
+ "stylesheet"
47
+ ]
48
+ }
49
+ ]
includes/vendor/css-parser/parser-helper-function.php ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace AMPforWP\AMPVendor;
3
+
4
+ class AMPFORWP_Tree_Shaking_Transient{
5
+ public static function ampforwp_get_proper_transient_name($transient){
6
+ global $post;
7
+ if(ampforwp_is_home()){
8
+ $transient = "home";
9
+ }elseif(ampforwp_is_blog()){
10
+ $transient = "blog";
11
+ }elseif(ampforwp_is_front_page()){
12
+ $transient = "post-".ampforwp_get_frontpage_id();
13
+ }elseif(!empty($post) && is_object($post)){
14
+ $transient = "post-".$post->ID;
15
+ }
16
+ return $transient;
17
+ }
18
+ public static function ampforwp_set_file_transient( $transient, $value, $expiration = 0 ) {
19
+
20
+ $transient = self::ampforwp_get_proper_transient_name($transient);
21
+ $expiration = (int) $expiration;
22
+
23
+ $value = apply_filters( "pre_set_transient_{$transient}", $value, $expiration, $transient );
24
+
25
+
26
+ $expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient );
27
+
28
+ if ( wp_using_ext_object_cache() ) {
29
+ $result = wp_cache_set( $transient, $value, 'transient', $expiration );
30
+ } else {
31
+ $transient_timeout = '_transient_timeout_' . $transient;
32
+ $transient_option = '_transient_' . $transient;
33
+
34
+ /***
35
+ Creating a file
36
+ **/
37
+ if($value){
38
+ $upload_dir = wp_upload_dir();
39
+ $user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-tree-shaking';
40
+ if(!file_exists($user_dirname)) wp_mkdir_p($user_dirname);
41
+ $content = $value;
42
+ $new_file = $user_dirname."/".$transient_option.".css";
43
+ $ifp = @fopen( $new_file, 'w+' );
44
+ if ( ! $ifp ) {
45
+ return ( array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) ));
46
+ }
47
+ $result = @fwrite( $ifp, json_encode($value) );
48
+ fclose( $ifp );
49
+ }
50
+
51
+ }
52
+ return $result;
53
+ }
54
+
55
+
56
+ public static function ampforwp_get_file_transient( $transient ) {
57
+
58
+ $transient = self::ampforwp_get_proper_transient_name($transient);
59
+ //$value = '';
60
+ $pre = apply_filters( "pre_transient_{$transient}", false, $transient );
61
+ if ( false !== $pre )
62
+ return $pre;
63
+
64
+ if ( wp_using_ext_object_cache() ) {
65
+ $value = wp_cache_get( $transient, 'transient' );
66
+ } else {
67
+ $transient_option = '_transient_' . $transient;
68
+ /*if ( ! wp_installing() ) {
69
+ // If option is not in alloptions, it is not autoloaded and thus has a timeout
70
+ $alloptions = wp_load_alloptions();
71
+ if ( !isset( $alloptions[$transient_option] ) ) {
72
+ $transient_timeout = '_transient_timeout_' . $transient;
73
+ $timeout = get_option( $transient_timeout );
74
+ if ( false !== $timeout && $timeout < time() ) {
75
+ delete_option( $transient_option );
76
+ delete_option( $transient_timeout );
77
+ $value = false;
78
+ }
79
+ }
80
+ }*/
81
+
82
+ if ( ! isset( $value ) ){
83
+ $upload_dir = wp_upload_dir();
84
+ $user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-tree-shaking';
85
+ if(!file_exists($user_dirname)) wp_mkdir_p($user_dirname);
86
+ $new_file = $user_dirname."/".$transient_option.".css";
87
+ if(file_exists($user_dirname)){
88
+ $files = glob($user_dirname . '/*');
89
+ //Loop through the file list.
90
+ foreach($files as $file){
91
+
92
+ $file_time = filectime($file);
93
+
94
+ $file_date = date("Y-m-d",$file_time);
95
+ $datetime1 = date_create($file_date);
96
+
97
+ $get_current_date = date('Y-m-d');
98
+ $datetime2 = date_create($get_current_date);
99
+
100
+ $interval = date_diff($datetime1, $datetime2);
101
+
102
+ $day_diff = $interval->format('%a');
103
+ if($day_diff >= '30' ){
104
+ //Make sure that this is a file and not a directory.
105
+ if(is_file($file) && strpos($file, '_transient')!==false ){
106
+ //Use the unlink function to delete the file.
107
+ unlink($file);
108
+ }
109
+ }
110
+ }
111
+ }
112
+ if(file_exists($new_file) && filesize($new_file)>0){
113
+ $ifp = @fopen( $new_file, 'r' );
114
+ $value = fread($ifp, filesize($new_file));
115
+ fclose($ifp);
116
+ }
117
+ //$value = get_option( $transient_option );
118
+ }
119
+ }
120
+
121
+
122
+ return apply_filters( "transient_{$transient}", json_decode($value, true), $transient );
123
+ }
124
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ vendor/
includes/vendor/css-parser/sabberworm/php-css-parser/CHANGELOG.md ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Revision History
2
+
3
+ ## 8.0
4
+
5
+ ### 8.0.0 (2016-06-30)
6
+
7
+ * Store source CSS line numbers in tokens and parsing exceptions.
8
+ * *No deprecations*
9
+
10
+ #### Backwards-incompatible changes
11
+
12
+ * Unrecoverable parser errors throw an exception of type `Sabberworm\CSS\Parsing\SourceException` instead of `\Exception`.
13
+
14
+ ### 8.1.0 (2016-07-19)
15
+
16
+ * Comments are no longer silently ignored but stored with the object with which they appear (no render support, though). Thanks to @FMCorz.
17
+ * The IE hacks using `\0` and `\9` can now be parsed (and rendered) in lenient mode. Thanks (again) to @FMCorz.
18
+ * Media queries with or without spaces before the query are parsed. Still no *real* parsing support, though. Sorry…
19
+ * PHPUnit is now listed as a dev-dependency in composer.json.
20
+ * *No backwards-incompatible changes*
21
+ * *No deprecations*
22
+
23
+ ### 8.2.0 (2018-07-13)
24
+
25
+ * Support parsing `calc()`, thanks to @raxbg.
26
+ * Support parsing grid-lines, again thanks to @raxbg.
27
+ * Support parsing legacy IE filters (`progid:`) in lenient mode, thanks to @FMCorz
28
+ * Performance improvements parsing large files, again thanks to @FMCorz
29
+ * *No backwards-incompatible changes*
30
+ * *No deprecations*
31
+
32
+ ### 8.3.0 (2019-02-22)
33
+
34
+ * Refactor parsing logic to mostly reside in the class files whose data structure is to be parsed (this should eventually allow us to unit-test specific parts of the parsing logic individually).
35
+ * Fix error in parsing `calc` expessions when the first operand is a negative number, thanks to @raxbg.
36
+ * Support parsing CSS4 colors in hex notation with alpha values, thanks to @raxbg.
37
+ * Swallow more errors in lenient mode, thanks to @raxbg.
38
+ * Allow specifying arbitrary strings to output before and after declaration blocks, thanks to @westonruter.
39
+ * *No backwards-incompatible changes*
40
+ * *No deprecations*
41
+
42
+ ## 7.0
43
+
44
+ ### 7.0.0 (2015-08-24)
45
+
46
+ * Compatibility with PHP 7. Well timed, eh?
47
+ * *No deprecations*
48
+
49
+ #### Backwards-incompatible changes
50
+
51
+ * The `Sabberworm\CSS\Value\String` class has been renamed to `Sabberworm\CSS\Value\CSSString`.
52
+
53
+ ### 7.0.1 (2015-12-25)
54
+
55
+ * No more suppressed `E_NOTICE`
56
+ * *No backwards-incompatible changes*
57
+ * *No deprecations*
58
+
59
+ ### 7.0.2 (2016-02-11)
60
+
61
+ * 150 time performance boost thanks to @[ossinkine](https://github.com/ossinkine)
62
+ * *No backwards-incompatible changes*
63
+ * *No deprecations*
64
+
65
+ ### 7.0.3 (2016-04-27)
66
+
67
+ * Fixed parsing empty CSS when multibyte is off
68
+ * *No backwards-incompatible changes*
69
+ * *No deprecations*
70
+
71
+ ## 6.0
72
+
73
+ ### 6.0.0 (2014-07-03)
74
+
75
+ * Format output using Sabberworm\CSS\OutputFormat
76
+ * *No backwards-incompatible changes*
77
+
78
+ #### Deprecations
79
+
80
+ * The parse() method replaces __toString with an optional argument (instance of the OutputFormat class)
81
+
82
+ ### 6.0.1 (2015-08-24)
83
+
84
+ * Remove some declarations in interfaces incompatible with PHP 5.3 (< 5.3.9)
85
+ * *No deprecations*
86
+
87
+ ## 5.0
88
+
89
+ ### 5.0.0 (2013-03-20)
90
+
91
+ * Correctly parse all known CSS 3 units (including Hz and kHz).
92
+ * Output RGB colors in short (#aaa or #ababab) notation
93
+ * Be case-insensitive when parsing identifiers.
94
+ * *No deprecations*
95
+
96
+ #### Backwards-incompatible changes
97
+
98
+ * `Sabberworm\CSS\Value\Color`’s `__toString` method overrides `CSSList`’s to maybe return something other than `type(value, …)` (see above).
99
+
100
+ ### 5.0.1 (2013-03-20)
101
+
102
+ * Internal cleanup
103
+ * *No backwards-incompatible changes*
104
+ * *No deprecations*
105
+
106
+ ### 5.0.2 (2013-03-21)
107
+
108
+ * CHANGELOG.md file added to distribution
109
+ * *No backwards-incompatible changes*
110
+ * *No deprecations*
111
+
112
+ ### 5.0.3 (2013-03-21)
113
+
114
+ * More size units recognized
115
+ * *No backwards-incompatible changes*
116
+ * *No deprecations*
117
+
118
+ ### 5.0.4 (2013-03-21)
119
+
120
+ * Don’t output floats with locale-aware separator chars
121
+ * *No backwards-incompatible changes*
122
+ * *No deprecations*
123
+
124
+ ### 5.0.5 (2013-04-17)
125
+
126
+ * Initial support for lenient parsing (setting this parser option will catch some exceptions internally and recover the parser’s state as neatly as possible).
127
+ * *No backwards-incompatible changes*
128
+ * *No deprecations*
129
+
130
+ ### 5.0.6 (2013-05-31)
131
+
132
+ * Fix broken unit test
133
+ * *No backwards-incompatible changes*
134
+ * *No deprecations*
135
+
136
+ ### 5.0.7 (2013-08-04)
137
+
138
+ * Fix broken decimal point output optimization
139
+ * *No backwards-incompatible changes*
140
+ * *No deprecations*
141
+
142
+ ### 5.0.8 (2013-08-15)
143
+
144
+ * Make default settings’ multibyte parsing option dependent on whether or not the mbstring extension is actually installed.
145
+ * *No backwards-incompatible changes*
146
+ * *No deprecations*
147
+
148
+ ### 5.1.0 (2013-10-24)
149
+
150
+ * Performance enhancements by Michael M Slusarz
151
+ * More rescue entry points for lenient parsing (unexpected tokens between declaration blocks and unclosed comments)
152
+ * *No backwards-incompatible changes*
153
+ * *No deprecations*
154
+
155
+ ### 5.1.1 (2013-10-28)
156
+
157
+ * Updated CHANGELOG.md to reflect changes since 5.0.4
158
+ * *No backwards-incompatible changes*
159
+ * *No deprecations*
160
+
161
+ ### 5.1.2 (2013-10-30)
162
+
163
+ * Remove the use of consumeUntil in comment parsing. This makes it possible to parse comments such as `/** Perfectly valid **/`
164
+ * Add fr relative size unit
165
+ * Fix some issues with HHVM
166
+ * *No backwards-incompatible changes*
167
+ * *No deprecations*
168
+
169
+ ### 5.2.0 (2014-06-30)
170
+
171
+ * Support removing a selector from a declaration block using `$oBlock->removeSelector($mSelector)`
172
+ * Introduce a specialized exception (Sabberworm\CSS\Parsing\OuputException) for exceptions during output rendering
173
+
174
+ * *No deprecations*
175
+
176
+ #### Backwards-incompatible changes
177
+
178
+ * Outputting a declaration block that has no selectors throws an OuputException instead of outputting an invalid ` {…}` into the CSS document.
179
+
180
+ ## 4.0
181
+
182
+ ### 4.0.0 (2013-03-19)
183
+
184
+ * Support for more @-rules
185
+ * Generic interface `Sabberworm\CSS\Property\AtRule`, implemented by all @-rule classes
186
+ * *No deprecations*
187
+
188
+ #### Backwards-incompatible changes
189
+
190
+ * `Sabberworm\CSS\RuleSet\AtRule` renamed to `Sabberworm\CSS\RuleSet\AtRuleSet`
191
+ * `Sabberworm\CSS\CSSList\MediaQuery` renamed to `Sabberworm\CSS\RuleSet\CSSList\AtRuleBlockList` with differing semantics and API (which also works for other block-list-based @-rules like `@supports`).
192
+
193
+ ## 3.0
194
+
195
+ ### 3.0.0 (2013-03-06)
196
+
197
+ * Support for lenient parsing (on by default)
198
+ * *No deprecations*
199
+
200
+ #### Backwards-incompatible changes
201
+
202
+ * All properties (like whether or not to use `mb_`-functions, which default charset to use and – new – whether or not to be forgiving when parsing) are now encapsulated in an instance of `Sabberworm\CSS\Settings` which can be passed as the second argument to `Sabberworm\CSS\Parser->__construct()`.
203
+ * Specifying a charset as the second argument to `Sabberworm\CSS\Parser->__construct()` is no longer supported. Use `Sabberworm\CSS\Settings::create()->withDefaultCharset('some-charset')` instead.
204
+ * Setting `Sabberworm\CSS\Parser->bUseMbFunctions` has no effect. Use `Sabberworm\CSS\Settings::create()->withMultibyteSupport(true/false)` instead.
205
+ * `Sabberworm\CSS\Parser->parse()` may throw a `Sabberworm\CSS\Parsing\UnexpectedTokenException` when in strict parsing mode.
206
+
207
+ ## 2.0
208
+
209
+ ### 2.0.0 (2013-01-29)
210
+
211
+ * Allow multiple rules of the same type per rule set
212
+
213
+ #### Backwards-incompatible changes
214
+
215
+ * `Sabberworm\CSS\RuleSet->getRules()` returns an index-based array instead of an associative array. Use `Sabberworm\CSS\RuleSet->getRulesAssoc()` (which eliminates duplicate rules and lets the later rule of the same name win).
216
+ * `Sabberworm\CSS\RuleSet->removeRule()` works as it did before except when passed an instance of `Sabberworm\CSS\Rule\Rule`, in which case it would only remove the exact rule given instead of all the rules of the same type. To get the old behaviour, use `Sabberworm\CSS\RuleSet->removeRule($oRule->getRule()`;
217
+
218
+ ## 1.0
219
+
220
+ Initial release of a stable public API.
221
+
222
+ ## 0.9
223
+
224
+ Last version not to use PSR-0 project organization semantics.
includes/vendor/css-parser/sabberworm/php-css-parser/Doxyfile ADDED
@@ -0,0 +1,2310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Doxyfile 1.8.7
2
+
3
+ # This file describes the settings to be used by the documentation system
4
+ # doxygen (www.doxygen.org) for a project.
5
+ #
6
+ # All text after a double hash (##) is considered a comment and is placed in
7
+ # front of the TAG it is preceding.
8
+ #
9
+ # All text after a single hash (#) is considered a comment and will be ignored.
10
+ # The format is:
11
+ # TAG = value [value, ...]
12
+ # For lists, items can also be appended using:
13
+ # TAG += value [value, ...]
14
+ # Values that contain spaces should be placed between quotes (\" \").
15
+
16
+ #---------------------------------------------------------------------------
17
+ # Project related configuration options
18
+ #---------------------------------------------------------------------------
19
+
20
+ # This tag specifies the encoding used for all characters in the config file
21
+ # that follow. The default is UTF-8 which is also the encoding used for all text
22
+ # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
23
+ # built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
24
+ # for the list of possible encodings.
25
+ # The default value is: UTF-8.
26
+
27
+ DOXYFILE_ENCODING = UTF-8
28
+
29
+ # The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
30
+ # double-quotes, unless you are using Doxywizard) that should identify the
31
+ # project for which the documentation is generated. This name is used in the
32
+ # title of most generated pages and in a few other places.
33
+ # The default value is: My Project.
34
+
35
+ PROJECT_NAME = "Sabberworm/PHP-CSS-Parser"
36
+
37
+ # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
38
+ # could be handy for archiving the generated documentation or if some version
39
+ # control system is used.
40
+
41
+ PROJECT_NUMBER = "7.0.3"
42
+
43
+ # Using the PROJECT_BRIEF tag one can provide an optional one line description
44
+ # for a project that appears at the top of each page and should give viewer a
45
+ # quick idea about the purpose of the project. Keep the description short.
46
+
47
+ PROJECT_BRIEF = "A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS"
48
+
49
+ # With the PROJECT_LOGO tag one can specify an logo or icon that is included in
50
+ # the documentation. The maximum height of the logo should not exceed 55 pixels
51
+ # and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
52
+ # to the output directory.
53
+
54
+ PROJECT_LOGO =
55
+
56
+ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
57
+ # into which the generated documentation will be written. If a relative path is
58
+ # entered, it will be relative to the location where doxygen was started. If
59
+ # left blank the current directory will be used.
60
+
61
+ OUTPUT_DIRECTORY = "../PHP-CSS-Parser-Documentation"
62
+
63
+ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
64
+ # directories (in 2 levels) under the output directory of each output format and
65
+ # will distribute the generated files over these directories. Enabling this
66
+ # option can be useful when feeding doxygen a huge amount of source files, where
67
+ # putting all generated files in the same directory would otherwise causes
68
+ # performance problems for the file system.
69
+ # The default value is: NO.
70
+
71
+ CREATE_SUBDIRS = NO
72
+
73
+ # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
74
+ # characters to appear in the names of generated files. If set to NO, non-ASCII
75
+ # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
76
+ # U+3044.
77
+ # The default value is: NO.
78
+
79
+ ALLOW_UNICODE_NAMES = NO
80
+
81
+ # The OUTPUT_LANGUAGE tag is used to specify the language in which all
82
+ # documentation generated by doxygen is written. Doxygen will use this
83
+ # information to generate all constant output in the proper language.
84
+ # Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
85
+ # Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
86
+ # Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
87
+ # Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
88
+ # Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
89
+ # Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
90
+ # Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
91
+ # Ukrainian and Vietnamese.
92
+ # The default value is: English.
93
+
94
+ OUTPUT_LANGUAGE = English
95
+
96
+ # If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
97
+ # descriptions after the members that are listed in the file and class
98
+ # documentation (similar to Javadoc). Set to NO to disable this.
99
+ # The default value is: YES.
100
+
101
+ BRIEF_MEMBER_DESC = YES
102
+
103
+ # If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
104
+ # description of a member or function before the detailed description
105
+ #
106
+ # Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
107
+ # brief descriptions will be completely suppressed.
108
+ # The default value is: YES.
109
+
110
+ REPEAT_BRIEF = YES
111
+
112
+ # This tag implements a quasi-intelligent brief description abbreviator that is
113
+ # used to form the text in various listings. Each string in this list, if found
114
+ # as the leading text of the brief description, will be stripped from the text
115
+ # and the result, after processing the whole list, is used as the annotated
116
+ # text. Otherwise, the brief description is used as-is. If left blank, the
117
+ # following values are used ($name is automatically replaced with the name of
118
+ # the entity):The $name class, The $name widget, The $name file, is, provides,
119
+ # specifies, contains, represents, a, an and the.
120
+
121
+ ABBREVIATE_BRIEF =
122
+
123
+ # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
124
+ # doxygen will generate a detailed section even if there is only a brief
125
+ # description.
126
+ # The default value is: NO.
127
+
128
+ ALWAYS_DETAILED_SEC = NO
129
+
130
+ # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
131
+ # inherited members of a class in the documentation of that class as if those
132
+ # members were ordinary class members. Constructors, destructors and assignment
133
+ # operators of the base classes will not be shown.
134
+ # The default value is: NO.
135
+
136
+ INLINE_INHERITED_MEMB = NO
137
+
138
+ # If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
139
+ # before files name in the file list and in the header files. If set to NO the
140
+ # shortest path that makes the file name unique will be used
141
+ # The default value is: YES.
142
+
143
+ FULL_PATH_NAMES = YES
144
+
145
+ # The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
146
+ # Stripping is only done if one of the specified strings matches the left-hand
147
+ # part of the path. The tag can be used to show relative paths in the file list.
148
+ # If left blank the directory from which doxygen is run is used as the path to
149
+ # strip.
150
+ #
151
+ # Note that you can specify absolute paths here, but also relative paths, which
152
+ # will be relative from the directory where doxygen is started.
153
+ # This tag requires that the tag FULL_PATH_NAMES is set to YES.
154
+
155
+ STRIP_FROM_PATH = ./lib
156
+
157
+ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
158
+ # path mentioned in the documentation of a class, which tells the reader which
159
+ # header file to include in order to use a class. If left blank only the name of
160
+ # the header file containing the class definition is used. Otherwise one should
161
+ # specify the list of include paths that are normally passed to the compiler
162
+ # using the -I flag.
163
+
164
+ STRIP_FROM_INC_PATH =
165
+
166
+ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
167
+ # less readable) file names. This can be useful is your file systems doesn't
168
+ # support long names like on DOS, Mac, or CD-ROM.
169
+ # The default value is: NO.
170
+
171
+ SHORT_NAMES = NO
172
+
173
+ # If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
174
+ # first line (until the first dot) of a Javadoc-style comment as the brief
175
+ # description. If set to NO, the Javadoc-style will behave just like regular Qt-
176
+ # style comments (thus requiring an explicit @brief command for a brief
177
+ # description.)
178
+ # The default value is: NO.
179
+
180
+ JAVADOC_AUTOBRIEF = YES
181
+
182
+ # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
183
+ # line (until the first dot) of a Qt-style comment as the brief description. If
184
+ # set to NO, the Qt-style will behave just like regular Qt-style comments (thus
185
+ # requiring an explicit \brief command for a brief description.)
186
+ # The default value is: NO.
187
+
188
+ QT_AUTOBRIEF = YES
189
+
190
+ # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
191
+ # multi-line C++ special comment block (i.e. a block of //! or /// comments) as
192
+ # a brief description. This used to be the default behavior. The new default is
193
+ # to treat a multi-line C++ comment block as a detailed description. Set this
194
+ # tag to YES if you prefer the old behavior instead.
195
+ #
196
+ # Note that setting this tag to YES also means that rational rose comments are
197
+ # not recognized any more.
198
+ # The default value is: NO.
199
+
200
+ MULTILINE_CPP_IS_BRIEF = YES
201
+
202
+ # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
203
+ # documentation from any documented member that it re-implements.
204
+ # The default value is: YES.
205
+
206
+ INHERIT_DOCS = YES
207
+
208
+ # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
209
+ # new page for each member. If set to NO, the documentation of a member will be
210
+ # part of the file/class/namespace that contains it.
211
+ # The default value is: NO.
212
+
213
+ SEPARATE_MEMBER_PAGES = NO
214
+
215
+ # The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
216
+ # uses this value to replace tabs by spaces in code fragments.
217
+ # Minimum value: 1, maximum value: 16, default value: 4.
218
+
219
+ TAB_SIZE = 2
220
+
221
+ # This tag can be used to specify a number of aliases that act as commands in
222
+ # the documentation. An alias has the form:
223
+ # name=value
224
+ # For example adding
225
+ # "sideeffect=@par Side Effects:\n"
226
+ # will allow you to put the command \sideeffect (or @sideeffect) in the
227
+ # documentation, which will result in a user-defined paragraph with heading
228
+ # "Side Effects:". You can put \n's in the value part of an alias to insert
229
+ # newlines.
230
+
231
+ ALIASES =
232
+
233
+ # This tag can be used to specify a number of word-keyword mappings (TCL only).
234
+ # A mapping has the form "name=value". For example adding "class=itcl::class"
235
+ # will allow you to use the command class in the itcl::class meaning.
236
+
237
+ TCL_SUBST =
238
+
239
+ # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
240
+ # only. Doxygen will then generate output that is more tailored for C. For
241
+ # instance, some of the names that are used will be different. The list of all
242
+ # members will be omitted, etc.
243
+ # The default value is: NO.
244
+
245
+ OPTIMIZE_OUTPUT_FOR_C = NO
246
+
247
+ # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
248
+ # Python sources only. Doxygen will then generate output that is more tailored
249
+ # for that language. For instance, namespaces will be presented as packages,
250
+ # qualified scopes will look different, etc.
251
+ # The default value is: NO.
252
+
253
+ OPTIMIZE_OUTPUT_JAVA = NO
254
+
255
+ # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
256
+ # sources. Doxygen will then generate output that is tailored for Fortran.
257
+ # The default value is: NO.
258
+
259
+ OPTIMIZE_FOR_FORTRAN = NO
260
+
261
+ # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
262
+ # sources. Doxygen will then generate output that is tailored for VHDL.
263
+ # The default value is: NO.
264
+
265
+ OPTIMIZE_OUTPUT_VHDL = NO
266
+
267
+ # Doxygen selects the parser to use depending on the extension of the files it
268
+ # parses. With this tag you can assign which parser to use for a given
269
+ # extension. Doxygen has a built-in mapping, but you can override or extend it
270
+ # using this tag. The format is ext=language, where ext is a file extension, and
271
+ # language is one of the parsers supported by doxygen: IDL, Java, Javascript,
272
+ # C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
273
+ # FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
274
+ # Fortran. In the later case the parser tries to guess whether the code is fixed
275
+ # or free formatted code, this is the default for Fortran type files), VHDL. For
276
+ # instance to make doxygen treat .inc files as Fortran files (default is PHP),
277
+ # and .f files as C (default is Fortran), use: inc=Fortran f=C.
278
+ #
279
+ # Note For files without extension you can use no_extension as a placeholder.
280
+ #
281
+ # Note that for custom extensions you also need to set FILE_PATTERNS otherwise
282
+ # the files are not read by doxygen.
283
+
284
+ EXTENSION_MAPPING =
285
+
286
+ # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
287
+ # according to the Markdown format, which allows for more readable
288
+ # documentation. See http://daringfireball.net/projects/markdown/ for details.
289
+ # The output of markdown processing is further processed by doxygen, so you can
290
+ # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
291
+ # case of backward compatibilities issues.
292
+ # The default value is: YES.
293
+
294
+ MARKDOWN_SUPPORT = YES
295
+
296
+ # When enabled doxygen tries to link words that correspond to documented
297
+ # classes, or namespaces to their corresponding documentation. Such a link can
298
+ # be prevented in individual cases by by putting a % sign in front of the word
299
+ # or globally by setting AUTOLINK_SUPPORT to NO.
300
+ # The default value is: YES.
301
+
302
+ AUTOLINK_SUPPORT = YES
303
+
304
+ # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
305
+ # to include (a tag file for) the STL sources as input, then you should set this
306
+ # tag to YES in order to let doxygen match functions declarations and
307
+ # definitions whose arguments contain STL classes (e.g. func(std::string);
308
+ # versus func(std::string) {}). This also make the inheritance and collaboration
309
+ # diagrams that involve STL classes more complete and accurate.
310
+ # The default value is: NO.
311
+
312
+ BUILTIN_STL_SUPPORT = NO
313
+
314
+ # If you use Microsoft's C++/CLI language, you should set this option to YES to
315
+ # enable parsing support.
316
+ # The default value is: NO.
317
+
318
+ CPP_CLI_SUPPORT = NO
319
+
320
+ # Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
321
+ # http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
322
+ # will parse them like normal C++ but will assume all classes use public instead
323
+ # of private inheritance when no explicit protection keyword is present.
324
+ # The default value is: NO.
325
+
326
+ SIP_SUPPORT = NO
327
+
328
+ # For Microsoft's IDL there are propget and propput attributes to indicate
329
+ # getter and setter methods for a property. Setting this option to YES will make
330
+ # doxygen to replace the get and set methods by a property in the documentation.
331
+ # This will only work if the methods are indeed getting or setting a simple
332
+ # type. If this is not the case, or you want to show the methods anyway, you
333
+ # should set this option to NO.
334
+ # The default value is: YES.
335
+
336
+ IDL_PROPERTY_SUPPORT = YES
337
+
338
+ # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
339
+ # tag is set to YES, then doxygen will reuse the documentation of the first
340
+ # member in the group (if any) for the other members of the group. By default
341
+ # all members of a group must be documented explicitly.
342
+ # The default value is: NO.
343
+
344
+ DISTRIBUTE_GROUP_DOC = NO
345
+
346
+ # Set the SUBGROUPING tag to YES to allow class member groups of the same type
347
+ # (for instance a group of public functions) to be put as a subgroup of that
348
+ # type (e.g. under the Public Functions section). Set it to NO to prevent
349
+ # subgrouping. Alternatively, this can be done per class using the
350
+ # \nosubgrouping command.
351
+ # The default value is: YES.
352
+
353
+ SUBGROUPING = YES
354
+
355
+ # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
356
+ # are shown inside the group in which they are included (e.g. using \ingroup)
357
+ # instead of on a separate page (for HTML and Man pages) or section (for LaTeX
358
+ # and RTF).
359
+ #
360
+ # Note that this feature does not work in combination with
361
+ # SEPARATE_MEMBER_PAGES.
362
+ # The default value is: NO.
363
+
364
+ INLINE_GROUPED_CLASSES = NO
365
+
366
+ # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
367
+ # with only public data fields or simple typedef fields will be shown inline in
368
+ # the documentation of the scope in which they are defined (i.e. file,
369
+ # namespace, or group documentation), provided this scope is documented. If set
370
+ # to NO, structs, classes, and unions are shown on a separate page (for HTML and
371
+ # Man pages) or section (for LaTeX and RTF).
372
+ # The default value is: NO.
373
+
374
+ INLINE_SIMPLE_STRUCTS = NO
375
+
376
+ # When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
377
+ # enum is documented as struct, union, or enum with the name of the typedef. So
378
+ # typedef struct TypeS {} TypeT, will appear in the documentation as a struct
379
+ # with name TypeT. When disabled the typedef will appear as a member of a file,
380
+ # namespace, or class. And the struct will be named TypeS. This can typically be
381
+ # useful for C code in case the coding convention dictates that all compound
382
+ # types are typedef'ed and only the typedef is referenced, never the tag name.
383
+ # The default value is: NO.
384
+
385
+ TYPEDEF_HIDES_STRUCT = NO
386
+
387
+ # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
388
+ # cache is used to resolve symbols given their name and scope. Since this can be
389
+ # an expensive process and often the same symbol appears multiple times in the
390
+ # code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
391
+ # doxygen will become slower. If the cache is too large, memory is wasted. The
392
+ # cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
393
+ # is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
394
+ # symbols. At the end of a run doxygen will report the cache usage and suggest
395
+ # the optimal cache size from a speed point of view.
396
+ # Minimum value: 0, maximum value: 9, default value: 0.
397
+
398
+ LOOKUP_CACHE_SIZE = 0
399
+
400
+ #---------------------------------------------------------------------------
401
+ # Build related configuration options
402
+ #---------------------------------------------------------------------------
403
+
404
+ # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
405
+ # documentation are documented, even if no documentation was available. Private
406
+ # class members and static file members will be hidden unless the
407
+ # EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
408
+ # Note: This will also disable the warnings about undocumented members that are
409
+ # normally produced when WARNINGS is set to YES.
410
+ # The default value is: NO.
411
+
412
+ EXTRACT_ALL = NO
413
+
414
+ # If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
415
+ # be included in the documentation.
416
+ # The default value is: NO.
417
+
418
+ EXTRACT_PRIVATE = NO
419
+
420
+ # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
421
+ # scope will be included in the documentation.
422
+ # The default value is: NO.
423
+
424
+ EXTRACT_PACKAGE = NO
425
+
426
+ # If the EXTRACT_STATIC tag is set to YES all static members of a file will be
427
+ # included in the documentation.
428
+ # The default value is: NO.
429
+
430
+ EXTRACT_STATIC = NO
431
+
432
+ # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
433
+ # locally in source files will be included in the documentation. If set to NO
434
+ # only classes defined in header files are included. Does not have any effect
435
+ # for Java sources.
436
+ # The default value is: YES.
437
+
438
+ EXTRACT_LOCAL_CLASSES = YES
439
+
440
+ # This flag is only useful for Objective-C code. When set to YES local methods,
441
+ # which are defined in the implementation section but not in the interface are
442
+ # included in the documentation. If set to NO only methods in the interface are
443
+ # included.
444
+ # The default value is: NO.
445
+
446
+ EXTRACT_LOCAL_METHODS = NO
447
+
448
+ # If this flag is set to YES, the members of anonymous namespaces will be
449
+ # extracted and appear in the documentation as a namespace called
450
+ # 'anonymous_namespace{file}', where file will be replaced with the base name of
451
+ # the file that contains the anonymous namespace. By default anonymous namespace
452
+ # are hidden.
453
+ # The default value is: NO.
454
+
455
+ EXTRACT_ANON_NSPACES = NO
456
+
457
+ # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
458
+ # undocumented members inside documented classes or files. If set to NO these
459
+ # members will be included in the various overviews, but no documentation
460
+ # section is generated. This option has no effect if EXTRACT_ALL is enabled.
461
+ # The default value is: NO.
462
+
463
+ HIDE_UNDOC_MEMBERS = NO
464
+
465
+ # If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
466
+ # undocumented classes that are normally visible in the class hierarchy. If set
467
+ # to NO these classes will be included in the various overviews. This option has
468
+ # no effect if EXTRACT_ALL is enabled.
469
+ # The default value is: NO.
470
+
471
+ HIDE_UNDOC_CLASSES = NO
472
+
473
+ # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
474
+ # (class|struct|union) declarations. If set to NO these declarations will be
475
+ # included in the documentation.
476
+ # The default value is: NO.
477
+
478
+ HIDE_FRIEND_COMPOUNDS = NO
479
+
480
+ # If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
481
+ # documentation blocks found inside the body of a function. If set to NO these
482
+ # blocks will be appended to the function's detailed documentation block.
483
+ # The default value is: NO.
484
+
485
+ HIDE_IN_BODY_DOCS = NO
486
+
487
+ # The INTERNAL_DOCS tag determines if documentation that is typed after a
488
+ # \internal command is included. If the tag is set to NO then the documentation
489
+ # will be excluded. Set it to YES to include the internal documentation.
490
+ # The default value is: NO.
491
+
492
+ INTERNAL_DOCS = NO
493
+
494
+ # If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
495
+ # names in lower-case letters. If set to YES upper-case letters are also
496
+ # allowed. This is useful if you have classes or files whose names only differ
497
+ # in case and if your file system supports case sensitive file names. Windows
498
+ # and Mac users are advised to set this option to NO.
499
+ # The default value is: system dependent.
500
+
501
+ CASE_SENSE_NAMES = NO
502
+
503
+ # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
504
+ # their full class and namespace scopes in the documentation. If set to YES the
505
+ # scope will be hidden.
506
+ # The default value is: NO.
507
+
508
+ HIDE_SCOPE_NAMES = YES
509
+
510
+ # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
511
+ # the files that are included by a file in the documentation of that file.
512
+ # The default value is: YES.
513
+
514
+ SHOW_INCLUDE_FILES = YES
515
+
516
+ # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
517
+ # grouped member an include statement to the documentation, telling the reader
518
+ # which file to include in order to use the member.
519
+ # The default value is: NO.
520
+
521
+ SHOW_GROUPED_MEMB_INC = NO
522
+
523
+ # If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
524
+ # files with double quotes in the documentation rather than with sharp brackets.
525
+ # The default value is: NO.
526
+
527
+ FORCE_LOCAL_INCLUDES = NO
528
+
529
+ # If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
530
+ # documentation for inline members.
531
+ # The default value is: YES.
532
+
533
+ INLINE_INFO = YES
534
+
535
+ # If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
536
+ # (detailed) documentation of file and class members alphabetically by member
537
+ # name. If set to NO the members will appear in declaration order.
538
+ # The default value is: YES.
539
+
540
+ SORT_MEMBER_DOCS = YES
541
+
542
+ # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
543
+ # descriptions of file, namespace and class members alphabetically by member
544
+ # name. If set to NO the members will appear in declaration order. Note that
545
+ # this will also influence the order of the classes in the class list.
546
+ # The default value is: NO.
547
+
548
+ SORT_BRIEF_DOCS = NO
549
+
550
+ # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
551
+ # (brief and detailed) documentation of class members so that constructors and
552
+ # destructors are listed first. If set to NO the constructors will appear in the
553
+ # respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
554
+ # Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
555
+ # member documentation.
556
+ # Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
557
+ # detailed member documentation.
558
+ # The default value is: NO.
559
+
560
+ SORT_MEMBERS_CTORS_1ST = NO
561
+
562
+ # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
563
+ # of group names into alphabetical order. If set to NO the group names will
564
+ # appear in their defined order.
565
+ # The default value is: NO.
566
+
567
+ SORT_GROUP_NAMES = NO
568
+
569
+ # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
570
+ # fully-qualified names, including namespaces. If set to NO, the class list will
571
+ # be sorted only by class name, not including the namespace part.
572
+ # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
573
+ # Note: This option applies only to the class list, not to the alphabetical
574
+ # list.
575
+ # The default value is: NO.
576
+
577
+ SORT_BY_SCOPE_NAME = NO
578
+
579
+ # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
580
+ # type resolution of all parameters of a function it will reject a match between
581
+ # the prototype and the implementation of a member function even if there is
582
+ # only one candidate or it is obvious which candidate to choose by doing a
583
+ # simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
584
+ # accept a match between prototype and implementation in such cases.
585
+ # The default value is: NO.
586
+
587
+ STRICT_PROTO_MATCHING = NO
588
+
589
+ # The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
590
+ # todo list. This list is created by putting \todo commands in the
591
+ # documentation.
592
+ # The default value is: YES.
593
+
594
+ GENERATE_TODOLIST = YES
595
+
596
+ # The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
597
+ # test list. This list is created by putting \test commands in the
598
+ # documentation.
599
+ # The default value is: YES.
600
+
601
+ GENERATE_TESTLIST = YES
602
+
603
+ # The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
604
+ # list. This list is created by putting \bug commands in the documentation.
605
+ # The default value is: YES.
606
+
607
+ GENERATE_BUGLIST = YES
608
+
609
+ # The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
610
+ # the deprecated list. This list is created by putting \deprecated commands in
611
+ # the documentation.
612
+ # The default value is: YES.
613
+
614
+ GENERATE_DEPRECATEDLIST= YES
615
+
616
+ # The ENABLED_SECTIONS tag can be used to enable conditional documentation
617
+ # sections, marked by \if <section_label> ... \endif and \cond <section_label>
618
+ # ... \endcond blocks.
619
+
620
+ ENABLED_SECTIONS =
621
+
622
+ # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
623
+ # initial value of a variable or macro / define can have for it to appear in the
624
+ # documentation. If the initializer consists of more lines than specified here
625
+ # it will be hidden. Use a value of 0 to hide initializers completely. The
626
+ # appearance of the value of individual variables and macros / defines can be
627
+ # controlled using \showinitializer or \hideinitializer command in the
628
+ # documentation regardless of this setting.
629
+ # Minimum value: 0, maximum value: 10000, default value: 30.
630
+
631
+ MAX_INITIALIZER_LINES = 30
632
+
633
+ # Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
634
+ # the bottom of the documentation of classes and structs. If set to YES the list
635
+ # will mention the files that were used to generate the documentation.
636
+ # The default value is: YES.
637
+
638
+ SHOW_USED_FILES = YES
639
+
640
+ # Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
641
+ # will remove the Files entry from the Quick Index and from the Folder Tree View
642
+ # (if specified).
643
+ # The default value is: YES.
644
+
645
+ SHOW_FILES = YES
646
+
647
+ # Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
648
+ # page. This will remove the Namespaces entry from the Quick Index and from the
649
+ # Folder Tree View (if specified).
650
+ # The default value is: YES.
651
+
652
+ SHOW_NAMESPACES = NO
653
+
654
+ # The FILE_VERSION_FILTER tag can be used to specify a program or script that
655
+ # doxygen should invoke to get the current version for each file (typically from
656
+ # the version control system). Doxygen will invoke the program by executing (via
657
+ # popen()) the command command input-file, where command is the value of the
658
+ # FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
659
+ # by doxygen. Whatever the program writes to standard output is used as the file
660
+ # version. For an example see the documentation.
661
+
662
+ FILE_VERSION_FILTER =
663
+
664
+ # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
665
+ # by doxygen. The layout file controls the global structure of the generated
666
+ # output files in an output format independent way. To create the layout file
667
+ # that represents doxygen's defaults, run doxygen with the -l option. You can
668
+ # optionally specify a file name after the option, if omitted DoxygenLayout.xml
669
+ # will be used as the name of the layout file.
670
+ #
671
+ # Note that if you run doxygen from a directory containing a file called
672
+ # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
673
+ # tag is left empty.
674
+
675
+ LAYOUT_FILE =
676
+
677
+ # The CITE_BIB_FILES tag can be used to specify one or more bib files containing
678
+ # the reference definitions. This must be a list of .bib files. The .bib
679
+ # extension is automatically appended if omitted. This requires the bibtex tool
680
+ # to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
681
+ # For LaTeX the style of the bibliography can be controlled using
682
+ # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
683
+ # search path. Do not use file names with spaces, bibtex cannot handle them. See
684
+ # also \cite for info how to create references.
685
+
686
+ CITE_BIB_FILES =
687
+
688
+ #---------------------------------------------------------------------------
689
+ # Configuration options related to warning and progress messages
690
+ #---------------------------------------------------------------------------
691
+
692
+ # The QUIET tag can be used to turn on/off the messages that are generated to
693
+ # standard output by doxygen. If QUIET is set to YES this implies that the
694
+ # messages are off.
695
+ # The default value is: NO.
696
+
697
+ QUIET = NO
698
+
699
+ # The WARNINGS tag can be used to turn on/off the warning messages that are
700
+ # generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
701
+ # this implies that the warnings are on.
702
+ #
703
+ # Tip: Turn warnings on while writing the documentation.
704
+ # The default value is: YES.
705
+
706
+ WARNINGS = YES
707
+
708
+ # If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
709
+ # warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
710
+ # will automatically be disabled.
711
+ # The default value is: YES.
712
+
713
+ WARN_IF_UNDOCUMENTED = YES
714
+
715
+ # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
716
+ # potential errors in the documentation, such as not documenting some parameters
717
+ # in a documented function, or documenting parameters that don't exist or using
718
+ # markup commands wrongly.
719
+ # The default value is: YES.
720
+
721
+ WARN_IF_DOC_ERROR = YES
722
+
723
+ # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
724
+ # are documented, but have no documentation for their parameters or return
725
+ # value. If set to NO doxygen will only warn about wrong or incomplete parameter
726
+ # documentation, but not about the absence of documentation.
727
+ # The default value is: NO.
728
+
729
+ WARN_NO_PARAMDOC = NO
730
+
731
+ # The WARN_FORMAT tag determines the format of the warning messages that doxygen
732
+ # can produce. The string should contain the $file, $line, and $text tags, which
733
+ # will be replaced by the file and line number from which the warning originated
734
+ # and the warning text. Optionally the format may contain $version, which will
735
+ # be replaced by the version of the file (if it could be obtained via
736
+ # FILE_VERSION_FILTER)
737
+ # The default value is: $file:$line: $text.
738
+
739
+ WARN_FORMAT = "$file:$line: $text"
740
+
741
+ # The WARN_LOGFILE tag can be used to specify a file to which warning and error
742
+ # messages should be written. If left blank the output is written to standard
743
+ # error (stderr).
744
+
745
+ WARN_LOGFILE =
746
+
747
+ #---------------------------------------------------------------------------
748
+ # Configuration options related to the input files
749
+ #---------------------------------------------------------------------------
750
+
751
+ # The INPUT tag is used to specify the files and/or directories that contain
752
+ # documented source files. You may enter file names like myfile.cpp or
753
+ # directories like /usr/src/myproject. Separate the files or directories with
754
+ # spaces.
755
+ # Note: If this tag is empty the current directory is searched.
756
+
757
+ INPUT =
758
+
759
+ # This tag can be used to specify the character encoding of the source files
760
+ # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
761
+ # libiconv (or the iconv built into libc) for the transcoding. See the libiconv
762
+ # documentation (see: http://www.gnu.org/software/libiconv) for the list of
763
+ # possible encodings.
764
+ # The default value is: UTF-8.
765
+
766
+ INPUT_ENCODING = UTF-8
767
+
768
+ # If the value of the INPUT tag contains directories, you can use the
769
+ # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
770
+ # *.h) to filter out the source-files in the directories. If left blank the
771
+ # following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
772
+ # *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
773
+ # *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
774
+ # *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
775
+ # *.qsf, *.as and *.js.
776
+
777
+ FILE_PATTERNS =
778
+
779
+ # The RECURSIVE tag can be used to specify whether or not subdirectories should
780
+ # be searched for input files as well.
781
+ # The default value is: NO.
782
+
783
+ RECURSIVE = YES
784
+
785
+ # The EXCLUDE tag can be used to specify files and/or directories that should be
786
+ # excluded from the INPUT source files. This way you can easily exclude a
787
+ # subdirectory from a directory tree whose root is specified with the INPUT tag.
788
+ #
789
+ # Note that relative paths are relative to the directory from which doxygen is
790
+ # run.
791
+
792
+ EXCLUDE = tests
793
+
794
+ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
795
+ # directories that are symbolic links (a Unix file system feature) are excluded
796
+ # from the input.
797
+ # The default value is: NO.
798
+
799
+ EXCLUDE_SYMLINKS = NO
800
+
801
+ # If the value of the INPUT tag contains directories, you can use the
802
+ # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
803
+ # certain files from those directories.
804
+ #
805
+ # Note that the wildcards are matched against the file with absolute path, so to
806
+ # exclude all test directories for example use the pattern */test/*
807
+
808
+ EXCLUDE_PATTERNS =
809
+
810
+ # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
811
+ # (namespaces, classes, functions, etc.) that should be excluded from the
812
+ # output. The symbol name can be a fully qualified name, a word, or if the
813
+ # wildcard * is used, a substring. Examples: ANamespace, AClass,
814
+ # AClass::ANamespace, ANamespace::*Test
815
+ #
816
+ # Note that the wildcards are matched against the file with absolute path, so to
817
+ # exclude all test directories use the pattern */test/*
818
+
819
+ EXCLUDE_SYMBOLS =
820
+
821
+ # The EXAMPLE_PATH tag can be used to specify one or more files or directories
822
+ # that contain example code fragments that are included (see the \include
823
+ # command).
824
+
825
+ EXAMPLE_PATH =
826
+
827
+ # If the value of the EXAMPLE_PATH tag contains directories, you can use the
828
+ # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
829
+ # *.h) to filter out the source-files in the directories. If left blank all
830
+ # files are included.
831
+
832
+ EXAMPLE_PATTERNS =
833
+
834
+ # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
835
+ # searched for input files to be used with the \include or \dontinclude commands
836
+ # irrespective of the value of the RECURSIVE tag.
837
+ # The default value is: NO.
838
+
839
+ EXAMPLE_RECURSIVE = NO
840
+
841
+ # The IMAGE_PATH tag can be used to specify one or more files or directories
842
+ # that contain images that are to be included in the documentation (see the
843
+ # \image command).
844
+
845
+ IMAGE_PATH =
846
+
847
+ # The INPUT_FILTER tag can be used to specify a program that doxygen should
848
+ # invoke to filter for each input file. Doxygen will invoke the filter program
849
+ # by executing (via popen()) the command:
850
+ #
851
+ # <filter> <input-file>
852
+ #
853
+ # where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
854
+ # name of an input file. Doxygen will then use the output that the filter
855
+ # program writes to standard output. If FILTER_PATTERNS is specified, this tag
856
+ # will be ignored.
857
+ #
858
+ # Note that the filter must not add or remove lines; it is applied before the
859
+ # code is scanned, but not when the output code is generated. If lines are added
860
+ # or removed, the anchors will not be placed correctly.
861
+
862
+ INPUT_FILTER =
863
+
864
+ # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
865
+ # basis. Doxygen will compare the file name with each pattern and apply the
866
+ # filter if there is a match. The filters are a list of the form: pattern=filter
867
+ # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
868
+ # filters are used. If the FILTER_PATTERNS tag is empty or if none of the
869
+ # patterns match the file name, INPUT_FILTER is applied.
870
+
871
+ FILTER_PATTERNS =
872
+
873
+ # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
874
+ # INPUT_FILTER ) will also be used to filter the input files that are used for
875
+ # producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
876
+ # The default value is: NO.
877
+
878
+ FILTER_SOURCE_FILES = NO
879
+
880
+ # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
881
+ # pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
882
+ # it is also possible to disable source filtering for a specific pattern using
883
+ # *.ext= (so without naming a filter).
884
+ # This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
885
+
886
+ FILTER_SOURCE_PATTERNS =
887
+
888
+ # If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
889
+ # is part of the input, its contents will be placed on the main page
890
+ # (index.html). This can be useful if you have a project on for instance GitHub
891
+ # and want to reuse the introduction page also for the doxygen output.
892
+
893
+ USE_MDFILE_AS_MAINPAGE = README.md
894
+
895
+ #---------------------------------------------------------------------------
896
+ # Configuration options related to source browsing
897
+ #---------------------------------------------------------------------------
898
+
899
+ # If the SOURCE_BROWSER tag is set to YES then a list of source files will be
900
+ # generated. Documented entities will be cross-referenced with these sources.
901
+ #
902
+ # Note: To get rid of all source code in the generated output, make sure that
903
+ # also VERBATIM_HEADERS is set to NO.
904
+ # The default value is: NO.
905
+
906
+ SOURCE_BROWSER = NO
907
+
908
+ # Setting the INLINE_SOURCES tag to YES will include the body of functions,
909
+ # classes and enums directly into the documentation.
910
+ # The default value is: NO.
911
+
912
+ INLINE_SOURCES = NO
913
+
914
+ # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
915
+ # special comment blocks from generated source code fragments. Normal C, C++ and
916
+ # Fortran comments will always remain visible.
917
+ # The default value is: YES.
918
+
919
+ STRIP_CODE_COMMENTS = YES
920
+
921
+ # If the REFERENCED_BY_RELATION tag is set to YES then for each documented
922
+ # function all documented functions referencing it will be listed.
923
+ # The default value is: NO.
924
+
925
+ REFERENCED_BY_RELATION = NO
926
+
927
+ # If the REFERENCES_RELATION tag is set to YES then for each documented function
928
+ # all documented entities called/used by that function will be listed.
929
+ # The default value is: NO.
930
+
931
+ REFERENCES_RELATION = NO
932
+
933
+ # If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
934
+ # to YES, then the hyperlinks from functions in REFERENCES_RELATION and
935
+ # REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
936
+ # link to the documentation.
937
+ # The default value is: YES.
938
+
939
+ REFERENCES_LINK_SOURCE = YES
940
+
941
+ # If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
942
+ # source code will show a tooltip with additional information such as prototype,
943
+ # brief description and links to the definition and documentation. Since this
944
+ # will make the HTML file larger and loading of large files a bit slower, you
945
+ # can opt to disable this feature.
946
+ # The default value is: YES.
947
+ # This tag requires that the tag SOURCE_BROWSER is set to YES.
948
+
949
+ SOURCE_TOOLTIPS = YES
950
+
951
+ # If the USE_HTAGS tag is set to YES then the references to source code will
952
+ # point to the HTML generated by the htags(1) tool instead of doxygen built-in
953
+ # source browser. The htags tool is part of GNU's global source tagging system
954
+ # (see http://www.gnu.org/software/global/global.html). You will need version
955
+ # 4.8.6 or higher.
956
+ #
957
+ # To use it do the following:
958
+ # - Install the latest version of global
959
+ # - Enable SOURCE_BROWSER and USE_HTAGS in the config file
960
+ # - Make sure the INPUT points to the root of the source tree
961
+ # - Run doxygen as normal
962
+ #
963
+ # Doxygen will invoke htags (and that will in turn invoke gtags), so these
964
+ # tools must be available from the command line (i.e. in the search path).
965
+ #
966
+ # The result: instead of the source browser generated by doxygen, the links to
967
+ # source code will now point to the output of htags.
968
+ # The default value is: NO.
969
+ # This tag requires that the tag SOURCE_BROWSER is set to YES.
970
+
971
+ USE_HTAGS = NO
972
+
973
+ # If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
974
+ # verbatim copy of the header file for each class for which an include is
975
+ # specified. Set to NO to disable this.
976
+ # See also: Section \class.
977
+ # The default value is: YES.
978
+
979
+ VERBATIM_HEADERS = YES
980
+
981
+ #---------------------------------------------------------------------------
982
+ # Configuration options related to the alphabetical class index
983
+ #---------------------------------------------------------------------------
984
+
985
+ # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
986
+ # compounds will be generated. Enable this if the project contains a lot of
987
+ # classes, structs, unions or interfaces.
988
+ # The default value is: YES.
989
+
990
+ ALPHABETICAL_INDEX = YES
991
+
992
+ # The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
993
+ # which the alphabetical index list will be split.
994
+ # Minimum value: 1, maximum value: 20, default value: 5.
995
+ # This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
996
+
997
+ COLS_IN_ALPHA_INDEX = 5
998
+
999
+ # In case all classes in a project start with a common prefix, all classes will
1000
+ # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
1001
+ # can be used to specify a prefix (or a list of prefixes) that should be ignored
1002
+ # while generating the index headers.
1003
+ # This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
1004
+
1005
+ IGNORE_PREFIX =
1006
+
1007
+ #---------------------------------------------------------------------------
1008
+ # Configuration options related to the HTML output
1009
+ #---------------------------------------------------------------------------
1010
+
1011
+ # If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
1012
+ # The default value is: YES.
1013
+
1014
+ GENERATE_HTML = YES
1015
+
1016
+ # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
1017
+ # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1018
+ # it.
1019
+ # The default directory is: html.
1020
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1021
+
1022
+ HTML_OUTPUT = .
1023
+
1024
+ # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
1025
+ # generated HTML page (for example: .htm, .php, .asp).
1026
+ # The default value is: .html.
1027
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1028
+
1029
+ HTML_FILE_EXTENSION = .html
1030
+
1031
+ # The HTML_HEADER tag can be used to specify a user-defined HTML header file for
1032
+ # each generated HTML page. If the tag is left blank doxygen will generate a
1033
+ # standard header.
1034
+ #
1035
+ # To get valid HTML the header file that includes any scripts and style sheets
1036
+ # that doxygen needs, which is dependent on the configuration options used (e.g.
1037
+ # the setting GENERATE_TREEVIEW). It is highly recommended to start with a
1038
+ # default header using
1039
+ # doxygen -w html new_header.html new_footer.html new_stylesheet.css
1040
+ # YourConfigFile
1041
+ # and then modify the file new_header.html. See also section "Doxygen usage"
1042
+ # for information on how to generate the default header that doxygen normally
1043
+ # uses.
1044
+ # Note: The header is subject to change so you typically have to regenerate the
1045
+ # default header when upgrading to a newer version of doxygen. For a description
1046
+ # of the possible markers and block names see the documentation.
1047
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1048
+
1049
+ HTML_HEADER =
1050
+
1051
+ # The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
1052
+ # generated HTML page. If the tag is left blank doxygen will generate a standard
1053
+ # footer. See HTML_HEADER for more information on how to generate a default
1054
+ # footer and what special commands can be used inside the footer. See also
1055
+ # section "Doxygen usage" for information on how to generate the default footer
1056
+ # that doxygen normally uses.
1057
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1058
+
1059
+ HTML_FOOTER =
1060
+
1061
+ # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
1062
+ # sheet that is used by each HTML page. It can be used to fine-tune the look of
1063
+ # the HTML output. If left blank doxygen will generate a default style sheet.
1064
+ # See also section "Doxygen usage" for information on how to generate the style
1065
+ # sheet that doxygen normally uses.
1066
+ # Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
1067
+ # it is more robust and this tag (HTML_STYLESHEET) will in the future become
1068
+ # obsolete.
1069
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1070
+
1071
+ HTML_STYLESHEET =
1072
+
1073
+ # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
1074
+ # defined cascading style sheet that is included after the standard style sheets
1075
+ # created by doxygen. Using this option one can overrule certain style aspects.
1076
+ # This is preferred over using HTML_STYLESHEET since it does not replace the
1077
+ # standard style sheet and is therefor more robust against future updates.
1078
+ # Doxygen will copy the style sheet file to the output directory. For an example
1079
+ # see the documentation.
1080
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1081
+
1082
+ HTML_EXTRA_STYLESHEET =
1083
+
1084
+ # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
1085
+ # other source files which should be copied to the HTML output directory. Note
1086
+ # that these files will be copied to the base HTML output directory. Use the
1087
+ # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
1088
+ # files. In the HTML_STYLESHEET file, use the file name only. Also note that the
1089
+ # files will be copied as-is; there are no commands or markers available.
1090
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1091
+
1092
+ HTML_EXTRA_FILES =
1093
+
1094
+ # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
1095
+ # will adjust the colors in the stylesheet and background images according to
1096
+ # this color. Hue is specified as an angle on a colorwheel, see
1097
+ # http://en.wikipedia.org/wiki/Hue for more information. For instance the value
1098
+ # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
1099
+ # purple, and 360 is red again.
1100
+ # Minimum value: 0, maximum value: 359, default value: 220.
1101
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1102
+
1103
+ HTML_COLORSTYLE_HUE = 220
1104
+
1105
+ # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
1106
+ # in the HTML output. For a value of 0 the output will use grayscales only. A
1107
+ # value of 255 will produce the most vivid colors.
1108
+ # Minimum value: 0, maximum value: 255, default value: 100.
1109
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1110
+
1111
+ HTML_COLORSTYLE_SAT = 100
1112
+
1113
+ # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
1114
+ # luminance component of the colors in the HTML output. Values below 100
1115
+ # gradually make the output lighter, whereas values above 100 make the output
1116
+ # darker. The value divided by 100 is the actual gamma applied, so 80 represents
1117
+ # a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
1118
+ # change the gamma.
1119
+ # Minimum value: 40, maximum value: 240, default value: 80.
1120
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1121
+
1122
+ HTML_COLORSTYLE_GAMMA = 80
1123
+
1124
+ # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
1125
+ # page will contain the date and time when the page was generated. Setting this
1126
+ # to NO can help when comparing the output of multiple runs.
1127
+ # The default value is: YES.
1128
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1129
+
1130
+ HTML_TIMESTAMP = YES
1131
+
1132
+ # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
1133
+ # documentation will contain sections that can be hidden and shown after the
1134
+ # page has loaded.
1135
+ # The default value is: NO.
1136
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1137
+
1138
+ HTML_DYNAMIC_SECTIONS = NO
1139
+
1140
+ # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
1141
+ # shown in the various tree structured indices initially; the user can expand
1142
+ # and collapse entries dynamically later on. Doxygen will expand the tree to
1143
+ # such a level that at most the specified number of entries are visible (unless
1144
+ # a fully collapsed tree already exceeds this amount). So setting the number of
1145
+ # entries 1 will produce a full collapsed tree by default. 0 is a special value
1146
+ # representing an infinite number of entries and will result in a full expanded
1147
+ # tree by default.
1148
+ # Minimum value: 0, maximum value: 9999, default value: 100.
1149
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1150
+
1151
+ HTML_INDEX_NUM_ENTRIES = 100
1152
+
1153
+ # If the GENERATE_DOCSET tag is set to YES, additional index files will be
1154
+ # generated that can be used as input for Apple's Xcode 3 integrated development
1155
+ # environment (see: http://developer.apple.com/tools/xcode/), introduced with
1156
+ # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
1157
+ # Makefile in the HTML output directory. Running make will produce the docset in
1158
+ # that directory and running make install will install the docset in
1159
+ # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
1160
+ # startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
1161
+ # for more information.
1162
+ # The default value is: NO.
1163
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1164
+
1165
+ GENERATE_DOCSET = NO
1166
+
1167
+ # This tag determines the name of the docset feed. A documentation feed provides
1168
+ # an umbrella under which multiple documentation sets from a single provider
1169
+ # (such as a company or product suite) can be grouped.
1170
+ # The default value is: Doxygen generated docs.
1171
+ # This tag requires that the tag GENERATE_DOCSET is set to YES.
1172
+
1173
+ DOCSET_FEEDNAME = "Doxygen generated docs"
1174
+
1175
+ # This tag specifies a string that should uniquely identify the documentation
1176
+ # set bundle. This should be a reverse domain-name style string, e.g.
1177
+ # com.mycompany.MyDocSet. Doxygen will append .docset to the name.
1178
+ # The default value is: org.doxygen.Project.
1179
+ # This tag requires that the tag GENERATE_DOCSET is set to YES.
1180
+
1181
+ DOCSET_BUNDLE_ID = org.doxygen.Project
1182
+
1183
+ # The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
1184
+ # the documentation publisher. This should be a reverse domain-name style
1185
+ # string, e.g. com.mycompany.MyDocSet.documentation.
1186
+ # The default value is: org.doxygen.Publisher.
1187
+ # This tag requires that the tag GENERATE_DOCSET is set to YES.
1188
+
1189
+ DOCSET_PUBLISHER_ID = org.doxygen.Publisher
1190
+
1191
+ # The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
1192
+ # The default value is: Publisher.
1193
+ # This tag requires that the tag GENERATE_DOCSET is set to YES.
1194
+
1195
+ DOCSET_PUBLISHER_NAME = Publisher
1196
+
1197
+ # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
1198
+ # additional HTML index files: index.hhp, index.hhc, and index.hhk. The
1199
+ # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
1200
+ # (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
1201
+ # Windows.
1202
+ #
1203
+ # The HTML Help Workshop contains a compiler that can convert all HTML output
1204
+ # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
1205
+ # files are now used as the Windows 98 help format, and will replace the old
1206
+ # Windows help format (.hlp) on all Windows platforms in the future. Compressed
1207
+ # HTML files also contain an index, a table of contents, and you can search for
1208
+ # words in the documentation. The HTML workshop also contains a viewer for
1209
+ # compressed HTML files.
1210
+ # The default value is: NO.
1211
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1212
+
1213
+ GENERATE_HTMLHELP = NO
1214
+
1215
+ # The CHM_FILE tag can be used to specify the file name of the resulting .chm
1216
+ # file. You can add a path in front of the file if the result should not be
1217
+ # written to the html output directory.
1218
+ # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1219
+
1220
+ CHM_FILE =
1221
+
1222
+ # The HHC_LOCATION tag can be used to specify the location (absolute path
1223
+ # including file name) of the HTML help compiler ( hhc.exe). If non-empty
1224
+ # doxygen will try to run the HTML help compiler on the generated index.hhp.
1225
+ # The file has to be specified with full path.
1226
+ # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1227
+
1228
+ HHC_LOCATION =
1229
+
1230
+ # The GENERATE_CHI flag controls if a separate .chi index file is generated (
1231
+ # YES) or that it should be included in the master .chm file ( NO).
1232
+ # The default value is: NO.
1233
+ # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1234
+
1235
+ GENERATE_CHI = NO
1236
+
1237
+ # The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
1238
+ # and project file content.
1239
+ # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1240
+
1241
+ CHM_INDEX_ENCODING =
1242
+
1243
+ # The BINARY_TOC flag controls whether a binary table of contents is generated (
1244
+ # YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
1245
+ # enables the Previous and Next buttons.
1246
+ # The default value is: NO.
1247
+ # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1248
+
1249
+ BINARY_TOC = NO
1250
+
1251
+ # The TOC_EXPAND flag can be set to YES to add extra items for group members to
1252
+ # the table of contents of the HTML help documentation and to the tree view.
1253
+ # The default value is: NO.
1254
+ # This tag requires that the tag GENERATE_HTMLHELP is set to YES.
1255
+
1256
+ TOC_EXPAND = NO
1257
+
1258
+ # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
1259
+ # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
1260
+ # can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
1261
+ # (.qch) of the generated HTML documentation.
1262
+ # The default value is: NO.
1263
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1264
+
1265
+ GENERATE_QHP = NO
1266
+
1267
+ # If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
1268
+ # the file name of the resulting .qch file. The path specified is relative to
1269
+ # the HTML output folder.
1270
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1271
+
1272
+ QCH_FILE =
1273
+
1274
+ # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
1275
+ # Project output. For more information please see Qt Help Project / Namespace
1276
+ # (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
1277
+ # The default value is: org.doxygen.Project.
1278
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1279
+
1280
+ QHP_NAMESPACE = org.doxygen.Project
1281
+
1282
+ # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
1283
+ # Help Project output. For more information please see Qt Help Project / Virtual
1284
+ # Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
1285
+ # folders).
1286
+ # The default value is: doc.
1287
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1288
+
1289
+ QHP_VIRTUAL_FOLDER = doc
1290
+
1291
+ # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
1292
+ # filter to add. For more information please see Qt Help Project / Custom
1293
+ # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
1294
+ # filters).
1295
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1296
+
1297
+ QHP_CUST_FILTER_NAME =
1298
+
1299
+ # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
1300
+ # custom filter to add. For more information please see Qt Help Project / Custom
1301
+ # Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
1302
+ # filters).
1303
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1304
+
1305
+ QHP_CUST_FILTER_ATTRS =
1306
+
1307
+ # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
1308
+ # project's filter section matches. Qt Help Project / Filter Attributes (see:
1309
+ # http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
1310
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1311
+
1312
+ QHP_SECT_FILTER_ATTRS =
1313
+
1314
+ # The QHG_LOCATION tag can be used to specify the location of Qt's
1315
+ # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
1316
+ # generated .qhp file.
1317
+ # This tag requires that the tag GENERATE_QHP is set to YES.
1318
+
1319
+ QHG_LOCATION =
1320
+
1321
+ # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
1322
+ # generated, together with the HTML files, they form an Eclipse help plugin. To
1323
+ # install this plugin and make it available under the help contents menu in
1324
+ # Eclipse, the contents of the directory containing the HTML and XML files needs
1325
+ # to be copied into the plugins directory of eclipse. The name of the directory
1326
+ # within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
1327
+ # After copying Eclipse needs to be restarted before the help appears.
1328
+ # The default value is: NO.
1329
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1330
+
1331
+ GENERATE_ECLIPSEHELP = NO
1332
+
1333
+ # A unique identifier for the Eclipse help plugin. When installing the plugin
1334
+ # the directory name containing the HTML and XML files should also have this
1335
+ # name. Each documentation set should have its own identifier.
1336
+ # The default value is: org.doxygen.Project.
1337
+ # This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
1338
+
1339
+ ECLIPSE_DOC_ID = org.doxygen.Project
1340
+
1341
+ # If you want full control over the layout of the generated HTML pages it might
1342
+ # be necessary to disable the index and replace it with your own. The
1343
+ # DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
1344
+ # of each HTML page. A value of NO enables the index and the value YES disables
1345
+ # it. Since the tabs in the index contain the same information as the navigation
1346
+ # tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
1347
+ # The default value is: NO.
1348
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1349
+
1350
+ DISABLE_INDEX = NO
1351
+
1352
+ # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
1353
+ # structure should be generated to display hierarchical information. If the tag
1354
+ # value is set to YES, a side panel will be generated containing a tree-like
1355
+ # index structure (just like the one that is generated for HTML Help). For this
1356
+ # to work a browser that supports JavaScript, DHTML, CSS and frames is required
1357
+ # (i.e. any modern browser). Windows users are probably better off using the
1358
+ # HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
1359
+ # further fine-tune the look of the index. As an example, the default style
1360
+ # sheet generated by doxygen has an example that shows how to put an image at
1361
+ # the root of the tree instead of the PROJECT_NAME. Since the tree basically has
1362
+ # the same information as the tab index, you could consider setting
1363
+ # DISABLE_INDEX to YES when enabling this option.
1364
+ # The default value is: NO.
1365
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1366
+
1367
+ GENERATE_TREEVIEW = NO
1368
+
1369
+ # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
1370
+ # doxygen will group on one line in the generated HTML documentation.
1371
+ #
1372
+ # Note that a value of 0 will completely suppress the enum values from appearing
1373
+ # in the overview section.
1374
+ # Minimum value: 0, maximum value: 20, default value: 4.
1375
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1376
+
1377
+ ENUM_VALUES_PER_LINE = 4
1378
+
1379
+ # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
1380
+ # to set the initial width (in pixels) of the frame in which the tree is shown.
1381
+ # Minimum value: 0, maximum value: 1500, default value: 250.
1382
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1383
+
1384
+ TREEVIEW_WIDTH = 250
1385
+
1386
+ # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
1387
+ # external symbols imported via tag files in a separate window.
1388
+ # The default value is: NO.
1389
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1390
+
1391
+ EXT_LINKS_IN_WINDOW = NO
1392
+
1393
+ # Use this tag to change the font size of LaTeX formulas included as images in
1394
+ # the HTML documentation. When you change the font size after a successful
1395
+ # doxygen run you need to manually remove any form_*.png images from the HTML
1396
+ # output directory to force them to be regenerated.
1397
+ # Minimum value: 8, maximum value: 50, default value: 10.
1398
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1399
+
1400
+ FORMULA_FONTSIZE = 10
1401
+
1402
+ # Use the FORMULA_TRANPARENT tag to determine whether or not the images
1403
+ # generated for formulas are transparent PNGs. Transparent PNGs are not
1404
+ # supported properly for IE 6.0, but are supported on all modern browsers.
1405
+ #
1406
+ # Note that when changing this option you need to delete any form_*.png files in
1407
+ # the HTML output directory before the changes have effect.
1408
+ # The default value is: YES.
1409
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1410
+
1411
+ FORMULA_TRANSPARENT = YES
1412
+
1413
+ # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
1414
+ # http://www.mathjax.org) which uses client side Javascript for the rendering
1415
+ # instead of using prerendered bitmaps. Use this if you do not have LaTeX
1416
+ # installed or if you want to formulas look prettier in the HTML output. When
1417
+ # enabled you may also need to install MathJax separately and configure the path
1418
+ # to it using the MATHJAX_RELPATH option.
1419
+ # The default value is: NO.
1420
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1421
+
1422
+ USE_MATHJAX = NO
1423
+
1424
+ # When MathJax is enabled you can set the default output format to be used for
1425
+ # the MathJax output. See the MathJax site (see:
1426
+ # http://docs.mathjax.org/en/latest/output.html) for more details.
1427
+ # Possible values are: HTML-CSS (which is slower, but has the best
1428
+ # compatibility), NativeMML (i.e. MathML) and SVG.
1429
+ # The default value is: HTML-CSS.
1430
+ # This tag requires that the tag USE_MATHJAX is set to YES.
1431
+
1432
+ MATHJAX_FORMAT = HTML-CSS
1433
+
1434
+ # When MathJax is enabled you need to specify the location relative to the HTML
1435
+ # output directory using the MATHJAX_RELPATH option. The destination directory
1436
+ # should contain the MathJax.js script. For instance, if the mathjax directory
1437
+ # is located at the same level as the HTML output directory, then
1438
+ # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
1439
+ # Content Delivery Network so you can quickly see the result without installing
1440
+ # MathJax. However, it is strongly recommended to install a local copy of
1441
+ # MathJax from http://www.mathjax.org before deployment.
1442
+ # The default value is: http://cdn.mathjax.org/mathjax/latest.
1443
+ # This tag requires that the tag USE_MATHJAX is set to YES.
1444
+
1445
+ MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
1446
+
1447
+ # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
1448
+ # extension names that should be enabled during MathJax rendering. For example
1449
+ # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
1450
+ # This tag requires that the tag USE_MATHJAX is set to YES.
1451
+
1452
+ MATHJAX_EXTENSIONS =
1453
+
1454
+ # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
1455
+ # of code that will be used on startup of the MathJax code. See the MathJax site
1456
+ # (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
1457
+ # example see the documentation.
1458
+ # This tag requires that the tag USE_MATHJAX is set to YES.
1459
+
1460
+ MATHJAX_CODEFILE =
1461
+
1462
+ # When the SEARCHENGINE tag is enabled doxygen will generate a search box for
1463
+ # the HTML output. The underlying search engine uses javascript and DHTML and
1464
+ # should work on any modern browser. Note that when using HTML help
1465
+ # (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
1466
+ # there is already a search function so this one should typically be disabled.
1467
+ # For large projects the javascript based search engine can be slow, then
1468
+ # enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
1469
+ # search using the keyboard; to jump to the search box use <access key> + S
1470
+ # (what the <access key> is depends on the OS and browser, but it is typically
1471
+ # <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
1472
+ # key> to jump into the search results window, the results can be navigated
1473
+ # using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
1474
+ # the search. The filter options can be selected when the cursor is inside the
1475
+ # search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
1476
+ # to select a filter and <Enter> or <escape> to activate or cancel the filter
1477
+ # option.
1478
+ # The default value is: YES.
1479
+ # This tag requires that the tag GENERATE_HTML is set to YES.
1480
+
1481
+ SEARCHENGINE = YES
1482
+
1483
+ # When the SERVER_BASED_SEARCH tag is enabled the search engine will be
1484
+ # implemented using a web server instead of a web client using Javascript. There
1485
+ # are two flavors of web server based searching depending on the EXTERNAL_SEARCH
1486
+ # setting. When disabled, doxygen will generate a PHP script for searching and
1487
+ # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
1488
+ # and searching needs to be provided by external tools. See the section
1489
+ # "External Indexing and Searching" for details.
1490
+ # The default value is: NO.
1491
+ # This tag requires that the tag SEARCHENGINE is set to YES.
1492
+
1493
+ SERVER_BASED_SEARCH = NO
1494
+
1495
+ # When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
1496
+ # script for searching. Instead the search results are written to an XML file
1497
+ # which needs to be processed by an external indexer. Doxygen will invoke an
1498
+ # external search engine pointed to by the SEARCHENGINE_URL option to obtain the
1499
+ # search results.
1500
+ #
1501
+ # Doxygen ships with an example indexer ( doxyindexer) and search engine
1502
+ # (doxysearch.cgi) which are based on the open source search engine library
1503
+ # Xapian (see: http://xapian.org/).
1504
+ #
1505
+ # See the section "External Indexing and Searching" for details.
1506
+ # The default value is: NO.
1507
+ # This tag requires that the tag SEARCHENGINE is set to YES.
1508
+
1509
+ EXTERNAL_SEARCH = NO
1510
+
1511
+ # The SEARCHENGINE_URL should point to a search engine hosted by a web server
1512
+ # which will return the search results when EXTERNAL_SEARCH is enabled.
1513
+ #
1514
+ # Doxygen ships with an example indexer ( doxyindexer) and search engine
1515
+ # (doxysearch.cgi) which are based on the open source search engine library
1516
+ # Xapian (see: http://xapian.org/). See the section "External Indexing and
1517
+ # Searching" for details.
1518
+ # This tag requires that the tag SEARCHENGINE is set to YES.
1519
+
1520
+ SEARCHENGINE_URL =
1521
+
1522
+ # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
1523
+ # search data is written to a file for indexing by an external tool. With the
1524
+ # SEARCHDATA_FILE tag the name of this file can be specified.
1525
+ # The default file is: searchdata.xml.
1526
+ # This tag requires that the tag SEARCHENGINE is set to YES.
1527
+
1528
+ SEARCHDATA_FILE = searchdata.xml
1529
+
1530
+ # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
1531
+ # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
1532
+ # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
1533
+ # projects and redirect the results back to the right project.
1534
+ # This tag requires that the tag SEARCHENGINE is set to YES.
1535
+
1536
+ EXTERNAL_SEARCH_ID =
1537
+
1538
+ # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
1539
+ # projects other than the one defined by this configuration file, but that are
1540
+ # all added to the same external search index. Each project needs to have a
1541
+ # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
1542
+ # to a relative location where the documentation can be found. The format is:
1543
+ # EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
1544
+ # This tag requires that the tag SEARCHENGINE is set to YES.
1545
+
1546
+ EXTRA_SEARCH_MAPPINGS =
1547
+
1548
+ #---------------------------------------------------------------------------
1549
+ # Configuration options related to the LaTeX output
1550
+ #---------------------------------------------------------------------------
1551
+
1552
+ # If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
1553
+ # The default value is: YES.
1554
+
1555
+ GENERATE_LATEX = NO
1556
+
1557
+ # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
1558
+ # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1559
+ # it.
1560
+ # The default directory is: latex.
1561
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1562
+
1563
+ LATEX_OUTPUT = latex
1564
+
1565
+ # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
1566
+ # invoked.
1567
+ #
1568
+ # Note that when enabling USE_PDFLATEX this option is only used for generating
1569
+ # bitmaps for formulas in the HTML output, but not in the Makefile that is
1570
+ # written to the output directory.
1571
+ # The default file is: latex.
1572
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1573
+
1574
+ LATEX_CMD_NAME = latex
1575
+
1576
+ # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
1577
+ # index for LaTeX.
1578
+ # The default file is: makeindex.
1579
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1580
+
1581
+ MAKEINDEX_CMD_NAME = makeindex
1582
+
1583
+ # If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
1584
+ # documents. This may be useful for small projects and may help to save some
1585
+ # trees in general.
1586
+ # The default value is: NO.
1587
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1588
+
1589
+ COMPACT_LATEX = NO
1590
+
1591
+ # The PAPER_TYPE tag can be used to set the paper type that is used by the
1592
+ # printer.
1593
+ # Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
1594
+ # 14 inches) and executive (7.25 x 10.5 inches).
1595
+ # The default value is: a4.
1596
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1597
+
1598
+ PAPER_TYPE = a4
1599
+
1600
+ # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
1601
+ # that should be included in the LaTeX output. To get the times font for
1602
+ # instance you can specify
1603
+ # EXTRA_PACKAGES=times
1604
+ # If left blank no extra packages will be included.
1605
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1606
+
1607
+ EXTRA_PACKAGES =
1608
+
1609
+ # The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
1610
+ # generated LaTeX document. The header should contain everything until the first
1611
+ # chapter. If it is left blank doxygen will generate a standard header. See
1612
+ # section "Doxygen usage" for information on how to let doxygen write the
1613
+ # default header to a separate file.
1614
+ #
1615
+ # Note: Only use a user-defined header if you know what you are doing! The
1616
+ # following commands have a special meaning inside the header: $title,
1617
+ # $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
1618
+ # replace them by respectively the title of the page, the current date and time,
1619
+ # only the current date, the version number of doxygen, the project name (see
1620
+ # PROJECT_NAME), or the project number (see PROJECT_NUMBER).
1621
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1622
+
1623
+ LATEX_HEADER =
1624
+
1625
+ # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
1626
+ # generated LaTeX document. The footer should contain everything after the last
1627
+ # chapter. If it is left blank doxygen will generate a standard footer.
1628
+ #
1629
+ # Note: Only use a user-defined footer if you know what you are doing!
1630
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1631
+
1632
+ LATEX_FOOTER =
1633
+
1634
+ # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
1635
+ # other source files which should be copied to the LATEX_OUTPUT output
1636
+ # directory. Note that the files will be copied as-is; there are no commands or
1637
+ # markers available.
1638
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1639
+
1640
+ LATEX_EXTRA_FILES =
1641
+
1642
+ # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
1643
+ # prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
1644
+ # contain links (just like the HTML output) instead of page references. This
1645
+ # makes the output suitable for online browsing using a PDF viewer.
1646
+ # The default value is: YES.
1647
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1648
+
1649
+ PDF_HYPERLINKS = YES
1650
+
1651
+ # If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
1652
+ # the PDF file directly from the LaTeX files. Set this option to YES to get a
1653
+ # higher quality PDF documentation.
1654
+ # The default value is: YES.
1655
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1656
+
1657
+ USE_PDFLATEX = YES
1658
+
1659
+ # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
1660
+ # command to the generated LaTeX files. This will instruct LaTeX to keep running
1661
+ # if errors occur, instead of asking the user for help. This option is also used
1662
+ # when generating formulas in HTML.
1663
+ # The default value is: NO.
1664
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1665
+
1666
+ LATEX_BATCHMODE = NO
1667
+
1668
+ # If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
1669
+ # index chapters (such as File Index, Compound Index, etc.) in the output.
1670
+ # The default value is: NO.
1671
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1672
+
1673
+ LATEX_HIDE_INDICES = NO
1674
+
1675
+ # If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
1676
+ # code with syntax highlighting in the LaTeX output.
1677
+ #
1678
+ # Note that which sources are shown also depends on other settings such as
1679
+ # SOURCE_BROWSER.
1680
+ # The default value is: NO.
1681
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1682
+
1683
+ LATEX_SOURCE_CODE = NO
1684
+
1685
+ # The LATEX_BIB_STYLE tag can be used to specify the style to use for the
1686
+ # bibliography, e.g. plainnat, or ieeetr. See
1687
+ # http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
1688
+ # The default value is: plain.
1689
+ # This tag requires that the tag GENERATE_LATEX is set to YES.
1690
+
1691
+ LATEX_BIB_STYLE = plain
1692
+
1693
+ #---------------------------------------------------------------------------
1694
+ # Configuration options related to the RTF output
1695
+ #---------------------------------------------------------------------------
1696
+
1697
+ # If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
1698
+ # RTF output is optimized for Word 97 and may not look too pretty with other RTF
1699
+ # readers/editors.
1700
+ # The default value is: NO.
1701
+
1702
+ GENERATE_RTF = NO
1703
+
1704
+ # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
1705
+ # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1706
+ # it.
1707
+ # The default directory is: rtf.
1708
+ # This tag requires that the tag GENERATE_RTF is set to YES.
1709
+
1710
+ RTF_OUTPUT = rtf
1711
+
1712
+ # If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
1713
+ # documents. This may be useful for small projects and may help to save some
1714
+ # trees in general.
1715
+ # The default value is: NO.
1716
+ # This tag requires that the tag GENERATE_RTF is set to YES.
1717
+
1718
+ COMPACT_RTF = NO
1719
+
1720
+ # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
1721
+ # contain hyperlink fields. The RTF file will contain links (just like the HTML
1722
+ # output) instead of page references. This makes the output suitable for online
1723
+ # browsing using Word or some other Word compatible readers that support those
1724
+ # fields.
1725
+ #
1726
+ # Note: WordPad (write) and others do not support links.
1727
+ # The default value is: NO.
1728
+ # This tag requires that the tag GENERATE_RTF is set to YES.
1729
+
1730
+ RTF_HYPERLINKS = NO
1731
+
1732
+ # Load stylesheet definitions from file. Syntax is similar to doxygen's config
1733
+ # file, i.e. a series of assignments. You only have to provide replacements,
1734
+ # missing definitions are set to their default value.
1735
+ #
1736
+ # See also section "Doxygen usage" for information on how to generate the
1737
+ # default style sheet that doxygen normally uses.
1738
+ # This tag requires that the tag GENERATE_RTF is set to YES.
1739
+
1740
+ RTF_STYLESHEET_FILE =
1741
+
1742
+ # Set optional variables used in the generation of an RTF document. Syntax is
1743
+ # similar to doxygen's config file. A template extensions file can be generated
1744
+ # using doxygen -e rtf extensionFile.
1745
+ # This tag requires that the tag GENERATE_RTF is set to YES.
1746
+
1747
+ RTF_EXTENSIONS_FILE =
1748
+
1749
+ #---------------------------------------------------------------------------
1750
+ # Configuration options related to the man page output
1751
+ #---------------------------------------------------------------------------
1752
+
1753
+ # If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
1754
+ # classes and files.
1755
+ # The default value is: NO.
1756
+
1757
+ GENERATE_MAN = NO
1758
+
1759
+ # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
1760
+ # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1761
+ # it. A directory man3 will be created inside the directory specified by
1762
+ # MAN_OUTPUT.
1763
+ # The default directory is: man.
1764
+ # This tag requires that the tag GENERATE_MAN is set to YES.
1765
+
1766
+ MAN_OUTPUT = man
1767
+
1768
+ # The MAN_EXTENSION tag determines the extension that is added to the generated
1769
+ # man pages. In case the manual section does not start with a number, the number
1770
+ # 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
1771
+ # optional.
1772
+ # The default value is: .3.
1773
+ # This tag requires that the tag GENERATE_MAN is set to YES.
1774
+
1775
+ MAN_EXTENSION = .3
1776
+
1777
+ # The MAN_SUBDIR tag determines the name of the directory created within
1778
+ # MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
1779
+ # MAN_EXTENSION with the initial . removed.
1780
+ # This tag requires that the tag GENERATE_MAN is set to YES.
1781
+
1782
+ MAN_SUBDIR =
1783
+
1784
+ # If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
1785
+ # will generate one additional man file for each entity documented in the real
1786
+ # man page(s). These additional files only source the real man page, but without
1787
+ # them the man command would be unable to find the correct page.
1788
+ # The default value is: NO.
1789
+ # This tag requires that the tag GENERATE_MAN is set to YES.
1790
+
1791
+ MAN_LINKS = NO
1792
+
1793
+ #---------------------------------------------------------------------------
1794
+ # Configuration options related to the XML output
1795
+ #---------------------------------------------------------------------------
1796
+
1797
+ # If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
1798
+ # captures the structure of the code including all documentation.
1799
+ # The default value is: NO.
1800
+
1801
+ GENERATE_XML = NO
1802
+
1803
+ # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
1804
+ # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
1805
+ # it.
1806
+ # The default directory is: xml.
1807
+ # This tag requires that the tag GENERATE_XML is set to YES.
1808
+
1809
+ XML_OUTPUT = xml
1810
+
1811
+ # If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
1812
+ # listings (including syntax highlighting and cross-referencing information) to
1813
+ # the XML output. Note that enabling this will significantly increase the size
1814
+ # of the XML output.
1815
+ # The default value is: YES.
1816
+ # This tag requires that the tag GENERATE_XML is set to YES.
1817
+
1818
+ XML_PROGRAMLISTING = YES
1819
+
1820
+ #---------------------------------------------------------------------------
1821
+ # Configuration options related to the DOCBOOK output
1822
+ #---------------------------------------------------------------------------
1823
+
1824
+ # If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
1825
+ # that can be used to generate PDF.
1826
+ # The default value is: NO.
1827
+
1828
+ GENERATE_DOCBOOK = NO
1829
+
1830
+ # The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
1831
+ # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
1832
+ # front of it.
1833
+ # The default directory is: docbook.
1834
+ # This tag requires that the tag GENERATE_DOCBOOK is set to YES.
1835
+
1836
+ DOCBOOK_OUTPUT = docbook
1837
+
1838
+ #---------------------------------------------------------------------------
1839
+ # Configuration options for the AutoGen Definitions output
1840
+ #---------------------------------------------------------------------------
1841
+
1842
+ # If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
1843
+ # Definitions (see http://autogen.sf.net) file that captures the structure of
1844
+ # the code including all documentation. Note that this feature is still
1845
+ # experimental and incomplete at the moment.
1846
+ # The default value is: NO.
1847
+
1848
+ GENERATE_AUTOGEN_DEF = NO
1849
+
1850
+ #---------------------------------------------------------------------------
1851
+ # Configuration options related to the Perl module output
1852
+ #---------------------------------------------------------------------------
1853
+
1854
+ # If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
1855
+ # file that captures the structure of the code including all documentation.
1856
+ #
1857
+ # Note that this feature is still experimental and incomplete at the moment.
1858
+ # The default value is: NO.
1859
+
1860
+ GENERATE_PERLMOD = NO
1861
+
1862
+ # If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
1863
+ # Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
1864
+ # output from the Perl module output.
1865
+ # The default value is: NO.
1866
+ # This tag requires that the tag GENERATE_PERLMOD is set to YES.
1867
+
1868
+ PERLMOD_LATEX = NO
1869
+
1870
+ # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
1871
+ # formatted so it can be parsed by a human reader. This is useful if you want to
1872
+ # understand what is going on. On the other hand, if this tag is set to NO the
1873
+ # size of the Perl module output will be much smaller and Perl will parse it
1874
+ # just the same.
1875
+ # The default value is: YES.
1876
+ # This tag requires that the tag GENERATE_PERLMOD is set to YES.
1877
+
1878
+ PERLMOD_PRETTY = YES
1879
+
1880
+ # The names of the make variables in the generated doxyrules.make file are
1881
+ # prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
1882
+ # so different doxyrules.make files included by the same Makefile don't
1883
+ # overwrite each other's variables.
1884
+ # This tag requires that the tag GENERATE_PERLMOD is set to YES.
1885
+
1886
+ PERLMOD_MAKEVAR_PREFIX =
1887
+
1888
+ #---------------------------------------------------------------------------
1889
+ # Configuration options related to the preprocessor
1890
+ #---------------------------------------------------------------------------
1891
+
1892
+ # If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
1893
+ # C-preprocessor directives found in the sources and include files.
1894
+ # The default value is: YES.
1895
+
1896
+ ENABLE_PREPROCESSING = YES
1897
+
1898
+ # If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
1899
+ # in the source code. If set to NO only conditional compilation will be
1900
+ # performed. Macro expansion can be done in a controlled way by setting
1901
+ # EXPAND_ONLY_PREDEF to YES.
1902
+ # The default value is: NO.
1903
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1904
+
1905
+ MACRO_EXPANSION = NO
1906
+
1907
+ # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
1908
+ # the macro expansion is limited to the macros specified with the PREDEFINED and
1909
+ # EXPAND_AS_DEFINED tags.
1910
+ # The default value is: NO.
1911
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1912
+
1913
+ EXPAND_ONLY_PREDEF = NO
1914
+
1915
+ # If the SEARCH_INCLUDES tag is set to YES the includes files in the
1916
+ # INCLUDE_PATH will be searched if a #include is found.
1917
+ # The default value is: YES.
1918
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1919
+
1920
+ SEARCH_INCLUDES = YES
1921
+
1922
+ # The INCLUDE_PATH tag can be used to specify one or more directories that
1923
+ # contain include files that are not input files but should be processed by the
1924
+ # preprocessor.
1925
+ # This tag requires that the tag SEARCH_INCLUDES is set to YES.
1926
+
1927
+ INCLUDE_PATH =
1928
+
1929
+ # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
1930
+ # patterns (like *.h and *.hpp) to filter out the header-files in the
1931
+ # directories. If left blank, the patterns specified with FILE_PATTERNS will be
1932
+ # used.
1933
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1934
+
1935
+ INCLUDE_FILE_PATTERNS =
1936
+
1937
+ # The PREDEFINED tag can be used to specify one or more macro names that are
1938
+ # defined before the preprocessor is started (similar to the -D option of e.g.
1939
+ # gcc). The argument of the tag is a list of macros of the form: name or
1940
+ # name=definition (no spaces). If the definition and the "=" are omitted, "=1"
1941
+ # is assumed. To prevent a macro definition from being undefined via #undef or
1942
+ # recursively expanded use the := operator instead of the = operator.
1943
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1944
+
1945
+ PREDEFINED =
1946
+
1947
+ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
1948
+ # tag can be used to specify a list of macro names that should be expanded. The
1949
+ # macro definition that is found in the sources will be used. Use the PREDEFINED
1950
+ # tag if you want to use a different macro definition that overrules the
1951
+ # definition found in the source code.
1952
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1953
+
1954
+ EXPAND_AS_DEFINED =
1955
+
1956
+ # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
1957
+ # remove all references to function-like macros that are alone on a line, have
1958
+ # an all uppercase name, and do not end with a semicolon. Such function macros
1959
+ # are typically used for boiler-plate code, and will confuse the parser if not
1960
+ # removed.
1961
+ # The default value is: YES.
1962
+ # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
1963
+
1964
+ SKIP_FUNCTION_MACROS = YES
1965
+
1966
+ #---------------------------------------------------------------------------
1967
+ # Configuration options related to external references
1968
+ #---------------------------------------------------------------------------
1969
+
1970
+ # The TAGFILES tag can be used to specify one or more tag files. For each tag
1971
+ # file the location of the external documentation should be added. The format of
1972
+ # a tag file without this location is as follows:
1973
+ # TAGFILES = file1 file2 ...
1974
+ # Adding location for the tag files is done as follows:
1975
+ # TAGFILES = file1=loc1 "file2 = loc2" ...
1976
+ # where loc1 and loc2 can be relative or absolute paths or URLs. See the
1977
+ # section "Linking to external documentation" for more information about the use
1978
+ # of tag files.
1979
+ # Note: Each tag file must have a unique name (where the name does NOT include
1980
+ # the path). If a tag file is not located in the directory in which doxygen is
1981
+ # run, you must also specify the path to the tagfile here.
1982
+
1983
+ TAGFILES =
1984
+
1985
+ # When a file name is specified after GENERATE_TAGFILE, doxygen will create a
1986
+ # tag file that is based on the input files it reads. See section "Linking to
1987
+ # external documentation" for more information about the usage of tag files.
1988
+
1989
+ GENERATE_TAGFILE =
1990
+
1991
+ # If the ALLEXTERNALS tag is set to YES all external class will be listed in the
1992
+ # class index. If set to NO only the inherited external classes will be listed.
1993
+ # The default value is: NO.
1994
+
1995
+ ALLEXTERNALS = NO
1996
+
1997
+ # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
1998
+ # the modules index. If set to NO, only the current project's groups will be
1999
+ # listed.
2000
+ # The default value is: YES.
2001
+
2002
+ EXTERNAL_GROUPS = YES
2003
+
2004
+ # If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
2005
+ # the related pages index. If set to NO, only the current project's pages will
2006
+ # be listed.
2007
+ # The default value is: YES.
2008
+
2009
+ EXTERNAL_PAGES = YES
2010
+
2011
+ # The PERL_PATH should be the absolute path and name of the perl script
2012
+ # interpreter (i.e. the result of 'which perl').
2013
+ # The default file (with absolute path) is: /usr/bin/perl.
2014
+
2015
+ PERL_PATH = /usr/bin/perl
2016
+
2017
+ #---------------------------------------------------------------------------
2018
+ # Configuration options related to the dot tool
2019
+ #---------------------------------------------------------------------------
2020
+
2021
+ # If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
2022
+ # (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
2023
+ # NO turns the diagrams off. Note that this option also works with HAVE_DOT
2024
+ # disabled, but it is recommended to install and use dot, since it yields more
2025
+ # powerful graphs.
2026
+ # The default value is: YES.
2027
+
2028
+ CLASS_DIAGRAMS = YES
2029
+
2030
+ # You can define message sequence charts within doxygen comments using the \msc
2031
+ # command. Doxygen will then run the mscgen tool (see:
2032
+ # http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
2033
+ # documentation. The MSCGEN_PATH tag allows you to specify the directory where
2034
+ # the mscgen tool resides. If left empty the tool is assumed to be found in the
2035
+ # default search path.
2036
+
2037
+ MSCGEN_PATH =
2038
+
2039
+ # You can include diagrams made with dia in doxygen documentation. Doxygen will
2040
+ # then run dia to produce the diagram and insert it in the documentation. The
2041
+ # DIA_PATH tag allows you to specify the directory where the dia binary resides.
2042
+ # If left empty dia is assumed to be found in the default search path.
2043
+
2044
+ DIA_PATH =
2045
+
2046
+ # If set to YES, the inheritance and collaboration graphs will hide inheritance
2047
+ # and usage relations if the target is undocumented or is not a class.
2048
+ # The default value is: YES.
2049
+
2050
+ HIDE_UNDOC_RELATIONS = YES
2051
+
2052
+ # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
2053
+ # available from the path. This tool is part of Graphviz (see:
2054
+ # http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
2055
+ # Bell Labs. The other options in this section have no effect if this option is
2056
+ # set to NO
2057
+ # The default value is: NO.
2058
+
2059
+ HAVE_DOT = YES
2060
+
2061
+ # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
2062
+ # to run in parallel. When set to 0 doxygen will base this on the number of
2063
+ # processors available in the system. You can set it explicitly to a value
2064
+ # larger than 0 to get control over the balance between CPU load and processing
2065
+ # speed.
2066
+ # Minimum value: 0, maximum value: 32, default value: 0.
2067
+ # This tag requires that the tag HAVE_DOT is set to YES.
2068
+
2069
+ DOT_NUM_THREADS = 0
2070
+
2071
+ # When you want a differently looking font n the dot files that doxygen
2072
+ # generates you can specify the font name using DOT_FONTNAME. You need to make
2073
+ # sure dot is able to find the font, which can be done by putting it in a
2074
+ # standard location or by setting the DOTFONTPATH environment variable or by
2075
+ # setting DOT_FONTPATH to the directory containing the font.
2076
+ # The default value is: Helvetica.
2077
+ # This tag requires that the tag HAVE_DOT is set to YES.
2078
+
2079
+ DOT_FONTNAME = Helvetica
2080
+
2081
+ # The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
2082
+ # dot graphs.
2083
+ # Minimum value: 4, maximum value: 24, default value: 10.
2084
+ # This tag requires that the tag HAVE_DOT is set to YES.
2085
+
2086
+ DOT_FONTSIZE = 10
2087
+
2088
+ # By default doxygen will tell dot to use the default font as specified with
2089
+ # DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
2090
+ # the path where dot can find it using this tag.
2091
+ # This tag requires that the tag HAVE_DOT is set to YES.
2092
+
2093
+ DOT_FONTPATH =
2094
+
2095
+ # If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
2096
+ # each documented class showing the direct and indirect inheritance relations.
2097
+ # Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
2098
+ # The default value is: YES.
2099
+ # This tag requires that the tag HAVE_DOT is set to YES.
2100
+
2101
+ CLASS_GRAPH = YES
2102
+
2103
+ # If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
2104
+ # graph for each documented class showing the direct and indirect implementation
2105
+ # dependencies (inheritance, containment, and class references variables) of the
2106
+ # class with other documented classes.
2107
+ # The default value is: YES.
2108
+ # This tag requires that the tag HAVE_DOT is set to YES.
2109
+
2110
+ COLLABORATION_GRAPH = YES
2111
+
2112
+ # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
2113
+ # groups, showing the direct groups dependencies.
2114
+ # The default value is: YES.
2115
+ # This tag requires that the tag HAVE_DOT is set to YES.
2116
+
2117
+ GROUP_GRAPHS = YES
2118
+
2119
+ # If the UML_LOOK tag is set to YES doxygen will generate inheritance and
2120
+ # collaboration diagrams in a style similar to the OMG's Unified Modeling
2121
+ # Language.
2122
+ # The default value is: NO.
2123
+ # This tag requires that the tag HAVE_DOT is set to YES.
2124
+
2125
+ UML_LOOK = NO
2126
+
2127
+ # If the UML_LOOK tag is enabled, the fields and methods are shown inside the
2128
+ # class node. If there are many fields or methods and many nodes the graph may
2129
+ # become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
2130
+ # number of items for each type to make the size more manageable. Set this to 0
2131
+ # for no limit. Note that the threshold may be exceeded by 50% before the limit
2132
+ # is enforced. So when you set the threshold to 10, up to 15 fields may appear,
2133
+ # but if the number exceeds 15, the total amount of fields shown is limited to
2134
+ # 10.
2135
+ # Minimum value: 0, maximum value: 100, default value: 10.
2136
+ # This tag requires that the tag HAVE_DOT is set to YES.
2137
+
2138
+ UML_LIMIT_NUM_FIELDS = 10
2139
+
2140
+ # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
2141
+ # collaboration graphs will show the relations between templates and their
2142
+ # instances.
2143
+ # The default value is: NO.
2144
+ # This tag requires that the tag HAVE_DOT is set to YES.
2145
+
2146
+ TEMPLATE_RELATIONS = NO
2147
+
2148
+ # If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
2149
+ # YES then doxygen will generate a graph for each documented file showing the
2150
+ # direct and indirect include dependencies of the file with other documented
2151
+ # files.
2152
+ # The default value is: YES.
2153
+ # This tag requires that the tag HAVE_DOT is set to YES.
2154
+
2155
+ INCLUDE_GRAPH = YES
2156
+
2157
+ # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
2158
+ # set to YES then doxygen will generate a graph for each documented file showing
2159
+ # the direct and indirect include dependencies of the file with other documented
2160
+ # files.
2161
+ # The default value is: YES.
2162
+ # This tag requires that the tag HAVE_DOT is set to YES.
2163
+
2164
+ INCLUDED_BY_GRAPH = YES
2165
+
2166
+ # If the CALL_GRAPH tag is set to YES then doxygen will generate a call
2167
+ # dependency graph for every global function or class method.
2168
+ #
2169
+ # Note that enabling this option will significantly increase the time of a run.
2170
+ # So in most cases it will be better to enable call graphs for selected
2171
+ # functions only using the \callgraph command.
2172
+ # The default value is: NO.
2173
+ # This tag requires that the tag HAVE_DOT is set to YES.
2174
+
2175
+ CALL_GRAPH = YES
2176
+
2177
+ # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
2178
+ # dependency graph for every global function or class method.
2179
+ #
2180
+ # Note that enabling this option will significantly increase the time of a run.
2181
+ # So in most cases it will be better to enable caller graphs for selected
2182
+ # functions only using the \callergraph command.
2183
+ # The default value is: NO.
2184
+ # This tag requires that the tag HAVE_DOT is set to YES.
2185
+
2186
+ CALLER_GRAPH = YES
2187
+
2188
+ # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
2189
+ # hierarchy of all classes instead of a textual one.
2190
+ # The default value is: YES.
2191
+ # This tag requires that the tag HAVE_DOT is set to YES.
2192
+
2193
+ GRAPHICAL_HIERARCHY = YES
2194
+
2195
+ # If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
2196
+ # dependencies a directory has on other directories in a graphical way. The
2197
+ # dependency relations are determined by the #include relations between the
2198
+ # files in the directories.
2199
+ # The default value is: YES.
2200
+ # This tag requires that the tag HAVE_DOT is set to YES.
2201
+
2202
+ DIRECTORY_GRAPH = YES
2203
+
2204
+ # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
2205
+ # generated by dot.
2206
+ # Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
2207
+ # to make the SVG files visible in IE 9+ (other browsers do not have this
2208
+ # requirement).
2209
+ # Possible values are: png, jpg, gif and svg.
2210
+ # The default value is: png.
2211
+ # This tag requires that the tag HAVE_DOT is set to YES.
2212
+
2213
+ DOT_IMAGE_FORMAT = svg
2214
+
2215
+ # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
2216
+ # enable generation of interactive SVG images that allow zooming and panning.
2217
+ #
2218
+ # Note that this requires a modern browser other than Internet Explorer. Tested
2219
+ # and working are Firefox, Chrome, Safari, and Opera.
2220
+ # Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
2221
+ # the SVG files visible. Older versions of IE do not have SVG support.
2222
+ # The default value is: NO.
2223
+ # This tag requires that the tag HAVE_DOT is set to YES.
2224
+
2225
+ INTERACTIVE_SVG = YES
2226
+
2227
+ # The DOT_PATH tag can be used to specify the path where the dot tool can be
2228
+ # found. If left blank, it is assumed the dot tool can be found in the path.
2229
+ # This tag requires that the tag HAVE_DOT is set to YES.
2230
+
2231
+ DOT_PATH =
2232
+
2233
+ # The DOTFILE_DIRS tag can be used to specify one or more directories that
2234
+ # contain dot files that are included in the documentation (see the \dotfile
2235
+ # command).
2236
+ # This tag requires that the tag HAVE_DOT is set to YES.
2237
+
2238
+ DOTFILE_DIRS =
2239
+
2240
+ # The MSCFILE_DIRS tag can be used to specify one or more directories that
2241
+ # contain msc files that are included in the documentation (see the \mscfile
2242
+ # command).
2243
+
2244
+ MSCFILE_DIRS =
2245
+
2246
+ # The DIAFILE_DIRS tag can be used to specify one or more directories that
2247
+ # contain dia files that are included in the documentation (see the \diafile
2248
+ # command).
2249
+
2250
+ DIAFILE_DIRS =
2251
+
2252
+ # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
2253
+ # that will be shown in the graph. If the number of nodes in a graph becomes
2254
+ # larger than this value, doxygen will truncate the graph, which is visualized
2255
+ # by representing a node as a red box. Note that doxygen if the number of direct
2256
+ # children of the root node in a graph is already larger than
2257
+ # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
2258
+ # the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
2259
+ # Minimum value: 0, maximum value: 10000, default value: 50.
2260
+ # This tag requires that the tag HAVE_DOT is set to YES.
2261
+
2262
+ DOT_GRAPH_MAX_NODES = 50
2263
+
2264
+ # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
2265
+ # generated by dot. A depth value of 3 means that only nodes reachable from the
2266
+ # root by following a path via at most 3 edges will be shown. Nodes that lay
2267
+ # further from the root node will be omitted. Note that setting this option to 1
2268
+ # or 2 may greatly reduce the computation time needed for large code bases. Also
2269
+ # note that the size of a graph can be further restricted by
2270
+ # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
2271
+ # Minimum value: 0, maximum value: 1000, default value: 0.
2272
+ # This tag requires that the tag HAVE_DOT is set to YES.
2273
+
2274
+ MAX_DOT_GRAPH_DEPTH = 0
2275
+
2276
+ # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
2277
+ # background. This is disabled by default, because dot on Windows does not seem
2278
+ # to support this out of the box.
2279
+ #
2280
+ # Warning: Depending on the platform used, enabling this option may lead to
2281
+ # badly anti-aliased labels on the edges of a graph (i.e. they become hard to
2282
+ # read).
2283
+ # The default value is: NO.
2284
+ # This tag requires that the tag HAVE_DOT is set to YES.
2285
+
2286
+ DOT_TRANSPARENT = NO
2287
+
2288
+ # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
2289
+ # files in one run (i.e. multiple -o and -T options on the command line). This
2290
+ # makes dot run faster, but since only newer versions of dot (>1.8.10) support
2291
+ # this, this feature is disabled by default.
2292
+ # The default value is: NO.
2293
+ # This tag requires that the tag HAVE_DOT is set to YES.
2294
+
2295
+ DOT_MULTI_TARGETS = NO
2296
+
2297
+ # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
2298
+ # explaining the meaning of the various boxes and arrows in the dot generated
2299
+ # graphs.
2300
+ # The default value is: YES.
2301
+ # This tag requires that the tag HAVE_DOT is set to YES.
2302
+
2303
+ GENERATE_LEGEND = YES
2304
+
2305
+ # If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
2306
+ # files that are used to generate the various graphs.
2307
+ # The default value is: YES.
2308
+ # This tag requires that the tag HAVE_DOT is set to YES.
2309
+
2310
+ DOT_CLEANUP = YES
includes/vendor/css-parser/sabberworm/php-css-parser/README.md ADDED
@@ -0,0 +1,642 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PHP CSS Parser
2
+ --------------
3
+
4
+ [![build status](https://api.travis-ci.org/sabberworm/PHP-CSS-Parser.svg)](https://travis-ci.org/sabberworm/PHP-CSS-Parser) [![HHVM Status](http://hhvm.h4cc.de/badge/sabberworm/php-css-parser.svg)](http://hhvm.h4cc.de/package/sabberworm/php-css-parser)
5
+
6
+ A Parser for CSS Files written in PHP. Allows extraction of CSS files into a data structure, manipulation of said structure and output as (optimized) CSS.
7
+
8
+ ## Usage
9
+
10
+ ### Installation using composer
11
+
12
+ Add php-css-parser to your composer.json
13
+
14
+ ```json
15
+ {
16
+ "require": {
17
+ "sabberworm/php-css-parser": "*"
18
+ }
19
+ }
20
+ ```
21
+
22
+ ### Extraction
23
+
24
+ To use the CSS Parser, create a new instance. The constructor takes the following form:
25
+
26
+ ```php
27
+ new Sabberworm\CSS\Parser($sText);
28
+ ```
29
+
30
+ To read a file, for example, you’d do the following:
31
+
32
+ ```php
33
+ $oCssParser = new Sabberworm\CSS\Parser(file_get_contents('somefile.css'));
34
+ $oCssDocument = $oCssParser->parse();
35
+ ```
36
+
37
+ The resulting CSS document structure can be manipulated prior to being output.
38
+
39
+ ### Options
40
+
41
+ #### Charset
42
+
43
+ The charset option is used only if no @charset declaration is found in the CSS file. UTF-8 is the default, so you won’t have to create a settings object at all if you don’t intend to change that.
44
+
45
+ ```php
46
+ $oSettings = Sabberworm\CSS\Settings::create()->withDefaultCharset('windows-1252');
47
+ new Sabberworm\CSS\Parser($sText, $oSettings);
48
+ ```
49
+
50
+ #### Strict parsing
51
+
52
+ To have the parser choke on invalid rules, supply a thusly configured Sabberworm\CSS\Settings object:
53
+
54
+ ```php
55
+ $oCssParser = new Sabberworm\CSS\Parser(file_get_contents('somefile.css'), Sabberworm\CSS\Settings::create()->beStrict());
56
+ ```
57
+
58
+ #### Disable multibyte functions
59
+
60
+ To achieve faster parsing, you can choose to have PHP-CSS-Parser use regular string functions instead of `mb_*` functions. This should work fine in most cases, even for UTF-8 files, as all the multibyte characters are in string literals. Still it’s not recommended to use this with input you have no control over as it’s not thoroughly covered by test cases.
61
+
62
+ ```php
63
+ $oSettings = Sabberworm\CSS\Settings::create()->withMultibyteSupport(false);
64
+ new Sabberworm\CSS\Parser($sText, $oSettings);
65
+ ```
66
+
67
+ ### Manipulation
68
+
69
+ The resulting data structure consists mainly of five basic types: `CSSList`, `RuleSet`, `Rule`, `Selector` and `Value`. There are two additional types used: `Import` and `Charset` which you won’t use often.
70
+
71
+ #### CSSList
72
+
73
+ `CSSList` represents a generic CSS container, most likely containing declaration blocks (rule sets with a selector) but it may also contain at-rules, charset declarations, etc. `CSSList` has the following concrete subtypes:
74
+
75
+ * `Document` – representing the root of a CSS file.
76
+ * `MediaQuery` – represents a subsection of a CSSList that only applies to a output device matching the contained media query.
77
+
78
+ To access the items stored in a `CSSList` – like the document you got back when calling `$oCssParser->parse()` –, use `getContents()`, then iterate over that collection and use instanceof to check whether you’re dealing with another `CSSList`, a `RuleSet`, a `Import` or a `Charset`.
79
+
80
+ To append a new item (selector, media query, etc.) to an existing `CSSList`, construct it using the constructor for this class and use the `append($oItem)` method.
81
+
82
+ #### RuleSet
83
+
84
+ `RuleSet` is a container for individual rules. The most common form of a rule set is one constrained by a selector. The following concrete subtypes exist:
85
+
86
+ * `AtRuleSet` – for generic at-rules which do not match the ones specifically mentioned like @import, @charset or @media. A common example for this is @font-face.
87
+ * `DeclarationBlock` – a RuleSet constrained by a `Selector`; contains an array of selector objects (comma-separated in the CSS) as well as the rules to be applied to the matching elements.
88
+
89
+ Note: A `CSSList` can contain other `CSSList`s (and `Import`s as well as a `Charset`) while a `RuleSet` can only contain `Rule`s.
90
+
91
+ If you want to manipulate a `RuleSet`, use the methods `addRule(Rule $oRule)`, `getRules()` and `removeRule($mRule)` (which accepts either a Rule instance or a rule name; optionally suffixed by a dash to remove all related rules).
92
+
93
+ #### Rule
94
+
95
+ `Rule`s just have a key (the rule) and a value. These values are all instances of a `Value`.
96
+
97
+ #### Value
98
+
99
+ `Value` is an abstract class that only defines the `render` method. The concrete subclasses for atomic value types are:
100
+
101
+ * `Size` – consists of a numeric `size` value and a unit.
102
+ * `Color` – colors can be input in the form #rrggbb, #rgb or schema(val1, val2, …) but are always stored as an array of ('s' => val1, 'c' => val2, 'h' => val3, …) and output in the second form.
103
+ * `CSSString` – this is just a wrapper for quoted strings to distinguish them from keywords; always output with double quotes.
104
+ * `URL` – URLs in CSS; always output in URL("") notation.
105
+
106
+ There is another abstract subclass of `Value`, `ValueList`. A `ValueList` represents a lists of `Value`s, separated by some separation character (mostly `,`, whitespace, or `/`). There are two types of `ValueList`s:
107
+
108
+ * `RuleValueList` – The default type, used to represent all multi-valued rules like `font: bold 12px/3 Helvetica, Verdana, sans-serif;` (where the value would be a whitespace-separated list of the primitive value `bold`, a slash-separated list and a comma-separated list).
109
+ * `CSSFunction` – A special kind of value that also contains a function name and where the values are the function’s arguments. Also handles equals-sign-separated argument lists like `filter: alpha(opacity=90);`.
110
+
111
+ #### Convenience methods
112
+
113
+ There are a few convenience methods on Document to ease finding, manipulating and deleting rules:
114
+
115
+ * `getAllDeclarationBlocks()` – does what it says; no matter how deeply nested your selectors are. Aliased as `getAllSelectors()`.
116
+ * `getAllRuleSets()` – does what it says; no matter how deeply nested your rule sets are.
117
+ * `getAllValues()` – finds all `Value` objects inside `Rule`s.
118
+
119
+ ## To-Do
120
+
121
+ * More convenience methods [like `selectorsWithElement($sId/Class/TagName)`, `attributesOfType($sType)`, `removeAttributesOfType($sType)`]
122
+ * Real multibyte support. Currently only multibyte charsets whose first 255 code points take up only one byte and are identical with ASCII are supported (yes, UTF-8 fits this description).
123
+ * Named color support (using `Color` instead of an anonymous string literal)
124
+
125
+ ## Use cases
126
+
127
+ ### Use `Parser` to prepend an id to all selectors
128
+
129
+ ```php
130
+ $sMyId = "#my_id";
131
+ $oParser = new Sabberworm\CSS\Parser($sText);
132
+ $oCss = $oParser->parse();
133
+ foreach($oCss->getAllDeclarationBlocks() as $oBlock) {
134
+ foreach($oBlock->getSelectors() as $oSelector) {
135
+ //Loop over all selector parts (the comma-separated strings in a selector) and prepend the id
136
+ $oSelector->setSelector($sMyId.' '.$oSelector->getSelector());
137
+ }
138
+ }
139
+ ```
140
+
141
+ ### Shrink all absolute sizes to half
142
+
143
+ ```php
144
+ $oParser = new Sabberworm\CSS\Parser($sText);
145
+ $oCss = $oParser->parse();
146
+ foreach($oCss->getAllValues() as $mValue) {
147
+ if($mValue instanceof CSSSize && !$mValue->isRelative()) {
148
+ $mValue->setSize($mValue->getSize()/2);
149
+ }
150
+ }
151
+ ```
152
+
153
+ ### Remove unwanted rules
154
+
155
+ ```php
156
+ $oParser = new Sabberworm\CSS\Parser($sText);
157
+ $oCss = $oParser->parse();
158
+ foreach($oCss->getAllRuleSets() as $oRuleSet) {
159
+ $oRuleSet->removeRule('font-'); //Note that the added dash will make this remove all rules starting with font- (like font-size, font-weight, etc.) as well as a potential font-rule
160
+ $oRuleSet->removeRule('cursor');
161
+ }
162
+ ```
163
+
164
+ ### Output
165
+
166
+ To output the entire CSS document into a variable, just use `->render()`:
167
+
168
+ ```php
169
+ $oCssParser = new Sabberworm\CSS\Parser(file_get_contents('somefile.css'));
170
+ $oCssDocument = $oCssParser->parse();
171
+ print $oCssDocument->render();
172
+ ```
173
+
174
+ If you want to format the output, pass an instance of type `Sabberworm\CSS\OutputFormat`:
175
+
176
+ ```php
177
+ $oFormat = Sabberworm\CSS\OutputFormat::create()->indentWithSpaces(4)->setSpaceBetweenRules("\n");
178
+ print $oCssDocument->render($oFormat);
179
+ ```
180
+
181
+ Or use one of the predefined formats:
182
+
183
+ ```php
184
+ print $oCssDocument->render(Sabberworm\CSS\OutputFormat::createPretty());
185
+ print $oCssDocument->render(Sabberworm\CSS\OutputFormat::createCompact());
186
+ ```
187
+
188
+ To see what you can do with output formatting, look at the tests in `tests/Sabberworm/CSS/OutputFormatTest.php`.
189
+
190
+ ## Examples
191
+
192
+ ### Example 1 (At-Rules)
193
+
194
+ #### Input
195
+
196
+ ```css
197
+ @charset "utf-8";
198
+
199
+ @font-face {
200
+ font-family: "CrassRoots";
201
+ src: url("../media/cr.ttf")
202
+ }
203
+
204
+ html, body {
205
+ font-size: 1.6em
206
+ }
207
+
208
+ @keyframes mymove {
209
+ from { top: 0px; }
210
+ to { top: 200px; }
211
+ }
212
+
213
+ ```
214
+
215
+ #### Structure (`var_dump()`)
216
+
217
+ ```php
218
+ class Sabberworm\CSS\CSSList\Document#4 (2) {
219
+ protected $aContents =>
220
+ array(4) {
221
+ [0] =>
222
+ class Sabberworm\CSS\Property\Charset#6 (2) {
223
+ private $sCharset =>
224
+ class Sabberworm\CSS\Value\CSSString#5 (2) {
225
+ private $sString =>
226
+ string(5) "utf-8"
227
+ protected $iLineNo =>
228
+ int(1)
229
+ }
230
+ protected $iLineNo =>
231
+ int(1)
232
+ }
233
+ [1] =>
234
+ class Sabberworm\CSS\RuleSet\AtRuleSet#7 (4) {
235
+ private $sType =>
236
+ string(9) "font-face"
237
+ private $sArgs =>
238
+ string(0) ""
239
+ private $aRules =>
240
+ array(2) {
241
+ 'font-family' =>
242
+ array(1) {
243
+ [0] =>
244
+ class Sabberworm\CSS\Rule\Rule#8 (4) {
245
+ private $sRule =>
246
+ string(11) "font-family"
247
+ private $mValue =>
248
+ class Sabberworm\CSS\Value\CSSString#9 (2) {
249
+ private $sString =>
250
+ string(10) "CrassRoots"
251
+ protected $iLineNo =>
252
+ int(4)
253
+ }
254
+ private $bIsImportant =>
255
+ bool(false)
256
+ protected $iLineNo =>
257
+ int(4)
258
+ }
259
+ }
260
+ 'src' =>
261
+ array(1) {
262
+ [0] =>
263
+ class Sabberworm\CSS\Rule\Rule#10 (4) {
264
+ private $sRule =>
265
+ string(3) "src"
266
+ private $mValue =>
267
+ class Sabberworm\CSS\Value\URL#11 (2) {
268
+ private $oURL =>
269
+ class Sabberworm\CSS\Value\CSSString#12 (2) {
270
+ private $sString =>
271
+ string(15) "../media/cr.ttf"
272
+ protected $iLineNo =>
273
+ int(5)
274
+ }
275
+ protected $iLineNo =>
276
+ int(5)
277
+ }
278
+ private $bIsImportant =>
279
+ bool(false)
280
+ protected $iLineNo =>
281
+ int(5)
282
+ }
283
+ }
284
+ }
285
+ protected $iLineNo =>
286
+ int(3)
287
+ }
288
+ [2] =>
289
+ class Sabberworm\CSS\RuleSet\DeclarationBlock#13 (3) {
290
+ private $aSelectors =>
291
+ array(2) {
292
+ [0] =>
293
+ class Sabberworm\CSS\Property\Selector#14 (2) {
294
+ private $sSelector =>
295
+ string(4) "html"
296
+ private $iSpecificity =>
297
+ NULL
298
+ }
299
+ [1] =>
300
+ class Sabberworm\CSS\Property\Selector#15 (2) {
301
+ private $sSelector =>
302
+ string(4) "body"
303
+ private $iSpecificity =>
304
+ NULL
305
+ }
306
+ }
307
+ private $aRules =>
308
+ array(1) {
309
+ 'font-size' =>
310
+ array(1) {
311
+ [0] =>
312
+ class Sabberworm\CSS\Rule\Rule#16 (4) {
313
+ private $sRule =>
314
+ string(9) "font-size"
315
+ private $mValue =>
316
+ class Sabberworm\CSS\Value\Size#17 (4) {
317
+ private $fSize =>
318
+ double(1.6)
319
+ private $sUnit =>
320
+ string(2) "em"
321
+ private $bIsColorComponent =>
322
+ bool(false)
323
+ protected $iLineNo =>
324
+ int(9)
325
+ }
326
+ private $bIsImportant =>
327
+ bool(false)
328
+ protected $iLineNo =>
329
+ int(9)
330
+ }
331
+ }
332
+ }
333
+ protected $iLineNo =>
334
+ int(8)
335
+ }
336
+ [3] =>
337
+ class Sabberworm\CSS\CSSList\KeyFrame#18 (4) {
338
+ private $vendorKeyFrame =>
339
+ string(9) "keyframes"
340
+ private $animationName =>
341
+ string(6) "mymove"
342
+ protected $aContents =>
343
+ array(2) {
344
+ [0] =>
345
+ class Sabberworm\CSS\RuleSet\DeclarationBlock#19 (3) {
346
+ private $aSelectors =>
347
+ array(1) {
348
+ [0] =>
349
+ class Sabberworm\CSS\Property\Selector#20 (2) {
350
+ private $sSelector =>
351
+ string(4) "from"
352
+ private $iSpecificity =>
353
+ NULL
354
+ }
355
+ }
356
+ private $aRules =>
357
+ array(1) {
358
+ 'top' =>
359
+ array(1) {
360
+ [0] =>
361
+ class Sabberworm\CSS\Rule\Rule#21 (4) {
362
+ private $sRule =>
363
+ string(3) "top"
364
+ private $mValue =>
365
+ class Sabberworm\CSS\Value\Size#22 (4) {
366
+ private $fSize =>
367
+ double(0)
368
+ private $sUnit =>
369
+ string(2) "px"
370
+ private $bIsColorComponent =>
371
+ bool(false)
372
+ protected $iLineNo =>
373
+ int(13)
374
+ }
375
+ private $bIsImportant =>
376
+ bool(false)
377
+ protected $iLineNo =>
378
+ int(13)
379
+ }
380
+ }
381
+ }
382
+ protected $iLineNo =>
383
+ int(13)
384
+ }
385
+ [1] =>
386
+ class Sabberworm\CSS\RuleSet\DeclarationBlock#23 (3) {
387
+ private $aSelectors =>
388
+ array(1) {
389
+ [0] =>
390
+ class Sabberworm\CSS\Property\Selector#24 (2) {
391
+ private $sSelector =>
392
+ string(2) "to"
393
+ private $iSpecificity =>
394
+ NULL
395
+ }
396
+ }
397
+ private $aRules =>
398
+ array(1) {
399
+ 'top' =>
400
+ array(1) {
401
+ [0] =>
402
+ class Sabberworm\CSS\Rule\Rule#25 (4) {
403
+ private $sRule =>
404
+ string(3) "top"
405
+ private $mValue =>
406
+ class Sabberworm\CSS\Value\Size#26 (4) {
407
+ private $fSize =>
408
+ double(200)
409
+ private $sUnit =>
410
+ string(2) "px"
411
+ private $bIsColorComponent =>
412
+ bool(false)
413
+ protected $iLineNo =>
414
+ int(14)
415
+ }
416
+ private $bIsImportant =>
417
+ bool(false)
418
+ protected $iLineNo =>
419
+ int(14)
420
+ }
421
+ }
422
+ }
423
+ protected $iLineNo =>
424
+ int(14)
425
+ }
426
+ }
427
+ protected $iLineNo =>
428
+ int(12)
429
+ }
430
+ }
431
+ protected $iLineNo =>
432
+ int(1)
433
+ }
434
+
435
+ ```
436
+
437
+ #### Output (`render()`)
438
+
439
+ ```css
440
+ @charset "utf-8";
441
+ @font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}
442
+ html, body {font-size: 1.6em;}
443
+ @keyframes mymove {from {top: 0px;}
444
+ to {top: 200px;}}
445
+ ```
446
+
447
+ ### Example 2 (Values)
448
+
449
+ #### Input
450
+
451
+ ```css
452
+ #header {
453
+ margin: 10px 2em 1cm 2%;
454
+ font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
455
+ color: red !important;
456
+ }
457
+
458
+ ```
459
+
460
+ #### Structure (`var_dump()`)
461
+
462
+ ```php
463
+ class Sabberworm\CSS\CSSList\Document#4 (2) {
464
+ protected $aContents =>
465
+ array(1) {
466
+ [0] =>
467
+ class Sabberworm\CSS\RuleSet\DeclarationBlock#5 (3) {
468
+ private $aSelectors =>
469
+ array(1) {
470
+ [0] =>
471
+ class Sabberworm\CSS\Property\Selector#6 (2) {
472
+ private $sSelector =>
473
+ string(7) "#header"
474
+ private $iSpecificity =>
475
+ NULL
476
+ }
477
+ }
478
+ private $aRules =>
479
+ array(3) {
480
+ 'margin' =>
481
+ array(1) {
482
+ [0] =>
483
+ class Sabberworm\CSS\Rule\Rule#7 (4) {
484
+ private $sRule =>
485
+ string(6) "margin"
486
+ private $mValue =>
487
+ class Sabberworm\CSS\Value\RuleValueList#12 (3) {
488
+ protected $aComponents =>
489
+ array(4) {
490
+ [0] =>
491
+ class Sabberworm\CSS\Value\Size#8 (4) {
492
+ private $fSize =>
493
+ double(10)
494
+ private $sUnit =>
495
+ string(2) "px"
496
+ private $bIsColorComponent =>
497
+ bool(false)
498
+ protected $iLineNo =>
499
+ int(2)
500
+ }
501
+ [1] =>
502
+ class Sabberworm\CSS\Value\Size#9 (4) {
503
+ private $fSize =>
504
+ double(2)
505
+ private $sUnit =>
506
+ string(2) "em"
507
+ private $bIsColorComponent =>
508
+ bool(false)
509
+ protected $iLineNo =>
510
+ int(2)
511
+ }
512
+ [2] =>
513
+ class Sabberworm\CSS\Value\Size#10 (4) {
514
+ private $fSize =>
515
+ double(1)
516
+ private $sUnit =>
517
+ string(2) "cm"
518
+ private $bIsColorComponent =>
519
+ bool(false)
520
+ protected $iLineNo =>
521
+ int(2)
522
+ }
523
+ [3] =>
524
+ class Sabberworm\CSS\Value\Size#11 (4) {
525
+ private $fSize =>
526
+ double(2)
527
+ private $sUnit =>
528
+ string(1) "%"
529
+ private $bIsColorComponent =>
530
+ bool(false)
531
+ protected $iLineNo =>
532
+ int(2)
533
+ }
534
+ }
535
+ protected $sSeparator =>
536
+ string(1) " "
537
+ protected $iLineNo =>
538
+ int(2)
539
+ }
540
+ private $bIsImportant =>
541
+ bool(false)
542
+ protected $iLineNo =>
543
+ int(2)
544
+ }
545
+ }
546
+ 'font-family' =>
547
+ array(1) {
548
+ [0] =>
549
+ class Sabberworm\CSS\Rule\Rule#13 (4) {
550
+ private $sRule =>
551
+ string(11) "font-family"
552
+ private $mValue =>
553
+ class Sabberworm\CSS\Value\RuleValueList#15 (3) {
554
+ protected $aComponents =>
555
+ array(4) {
556
+ [0] =>
557
+ string(7) "Verdana"
558
+ [1] =>
559
+ string(9) "Helvetica"
560
+ [2] =>
561
+ class Sabberworm\CSS\Value\CSSString#14 (2) {
562
+ private $sString =>
563
+ string(9) "Gill Sans"
564
+ protected $iLineNo =>
565
+ int(3)
566
+ }
567
+ [3] =>
568
+ string(10) "sans-serif"
569
+ }
570
+ protected $sSeparator =>
571
+ string(1) ","
572
+ protected $iLineNo =>
573
+ int(3)
574
+ }
575
+ private $bIsImportant =>
576
+ bool(false)
577
+ protected $iLineNo =>
578
+ int(3)
579
+ }
580
+ }
581
+ 'color' =>
582
+ array(1) {
583
+ [0] =>
584
+ class Sabberworm\CSS\Rule\Rule#16 (4) {
585
+ private $sRule =>
586
+ string(5) "color"
587
+ private $mValue =>
588
+ string(3) "red"
589
+ private $bIsImportant =>
590
+ bool(true)
591
+ protected $iLineNo =>
592
+ int(4)
593
+ }
594
+ }
595
+ }
596
+ protected $iLineNo =>
597
+ int(1)
598
+ }
599
+ }
600
+ protected $iLineNo =>
601
+ int(1)
602
+ }
603
+
604
+ ```
605
+
606
+ #### Output (`render()`)
607
+
608
+ ```css
609
+ #header {margin: 10px 2em 1cm 2%;font-family: Verdana,Helvetica,"Gill Sans",sans-serif;color: red !important;}
610
+ ```
611
+
612
+ ## Contributors/Thanks to
613
+
614
+ * [raxbg](https://github.com/raxbg) for contributions to parse `calc`, grid lines, and various bugfixes.
615
+ * [westonruter](https://github.com/westonruter) for bugfixes and improvements.
616
+ * [FMCorz](https://github.com/FMCorz) for many patches and suggestions, for being able to parse comments and IE hacks (in lenient mode).
617
+ * [Lullabot](https://github.com/Lullabot) for a patch that allows to know the line number for each parsed token.
618
+ * [ju1ius](https://github.com/ju1ius) for the specificity parsing code and the ability to expand/compact shorthand properties.
619
+ * [ossinkine](https://github.com/ossinkine) for a 150 time performance boost.
620
+ * [GaryJones](https://github.com/GaryJones) for lots of input and [http://css-specificity.info/](http://css-specificity.info/).
621
+ * [docteurklein](https://github.com/docteurklein) for output formatting and `CSSList->remove()` inspiration.
622
+ * [nicolopignatelli](https://github.com/nicolopignatelli) for PSR-0 compatibility.
623
+ * [diegoembarcadero](https://github.com/diegoembarcadero) for keyframe at-rule parsing.
624
+ * [goetas](https://github.com/goetas) for @namespace at-rule support.
625
+ * [View full list](https://github.com/sabberworm/PHP-CSS-Parser/contributors)
626
+
627
+ ## Misc
628
+
629
+ * Legacy Support: The latest pre-PSR-0 version of this project can be checked with the `0.9.0` tag.
630
+ * Running Tests: To run all unit tests for this project, run `composer install` to install phpunit and use `./vendor/phpunit/phpunit/phpunit`.
631
+
632
+ ## License
633
+
634
+ PHP-CSS-Parser is freely distributable under the terms of an MIT-style license.
635
+
636
+ Copyright (c) 2011 Raphael Schweikert, http://sabberworm.com/
637
+
638
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
639
+
640
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
641
+
642
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
includes/vendor/css-parser/sabberworm/php-css-parser/composer.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "sabberworm/php-css-parser",
3
+ "type": "library",
4
+ "description": "Parser for CSS Files written in PHP",
5
+ "keywords": ["parser", "css", "stylesheet"],
6
+ "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser",
7
+ "license": "MIT",
8
+ "authors": [
9
+ {"name": "Raphael Schweikert"}
10
+ ],
11
+ "require": {
12
+ "php": ">=5.3.2"
13
+ },
14
+ "require-dev": {
15
+ "phpunit/phpunit": "~4.8",
16
+ "codacy/coverage": "^1.4"
17
+ },
18
+ "autoload": {
19
+ "psr-0": { "Sabberworm\\CSS": "lib/" }
20
+ }
21
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/composer.lock ADDED
@@ -0,0 +1,1478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "a09a0e09f5a1356a2c833ec123e09593",
8
+ "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "codacy/coverage",
12
+ "version": "1.4.2",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/codacy/php-codacy-coverage.git",
16
+ "reference": "4988cd098db4d578681bfd3176071931ad475150"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/codacy/php-codacy-coverage/zipball/4988cd098db4d578681bfd3176071931ad475150",
21
+ "reference": "4988cd098db4d578681bfd3176071931ad475150",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "gitonomy/gitlib": ">=1.0",
26
+ "php": ">=5.3.3",
27
+ "symfony/console": "~2.5|~3.0|~4.0"
28
+ },
29
+ "require-dev": {
30
+ "phpunit/phpunit": "~6.5"
31
+ },
32
+ "bin": [
33
+ "bin/codacycoverage"
34
+ ],
35
+ "type": "library",
36
+ "autoload": {
37
+ "classmap": [
38
+ "src/"
39
+ ]
40
+ },
41
+ "notification-url": "https://packagist.org/downloads/",
42
+ "license": [
43
+ "MIT"
44
+ ],
45
+ "authors": [
46
+ {
47
+ "name": "Jakob Pupke",
48
+ "email": "jakob.pupke@gmail.com"
49
+ }
50
+ ],
51
+ "description": "Sends PHP test coverage information to Codacy.",
52
+ "homepage": "https://github.com/codacy/php-codacy-coverage",
53
+ "time": "2018-03-22T16:43:39+00:00"
54
+ },
55
+ {
56
+ "name": "doctrine/instantiator",
57
+ "version": "1.1.0",
58
+ "source": {
59
+ "type": "git",
60
+ "url": "https://github.com/doctrine/instantiator.git",
61
+ "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda"
62
+ },
63
+ "dist": {
64
+ "type": "zip",
65
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
66
+ "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
67
+ "shasum": ""
68
+ },
69
+ "require": {
70
+ "php": "^7.1"
71
+ },
72
+ "require-dev": {
73
+ "athletic/athletic": "~0.1.8",
74
+ "ext-pdo": "*",
75
+ "ext-phar": "*",
76
+ "phpunit/phpunit": "^6.2.3",
77
+ "squizlabs/php_codesniffer": "^3.0.2"
78
+ },
79
+ "type": "library",
80
+ "extra": {
81
+ "branch-alias": {
82
+ "dev-master": "1.2.x-dev"
83
+ }
84
+ },
85
+ "autoload": {
86
+ "psr-4": {
87
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
88
+ }
89
+ },
90
+ "notification-url": "https://packagist.org/downloads/",
91
+ "license": [
92
+ "MIT"
93
+ ],
94
+ "authors": [
95
+ {
96
+ "name": "Marco Pivetta",
97
+ "email": "ocramius@gmail.com",
98
+ "homepage": "http://ocramius.github.com/"
99
+ }
100
+ ],
101
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
102
+ "homepage": "https://github.com/doctrine/instantiator",
103
+ "keywords": [
104
+ "constructor",
105
+ "instantiate"
106
+ ],
107
+ "time": "2017-07-22T11:58:36+00:00"
108
+ },
109
+ {
110
+ "name": "gitonomy/gitlib",
111
+ "version": "v1.0.4",
112
+ "source": {
113
+ "type": "git",
114
+ "url": "https://github.com/gitonomy/gitlib.git",
115
+ "reference": "932a960221ae3484a3e82553b3be478e56beb68d"
116
+ },
117
+ "dist": {
118
+ "type": "zip",
119
+ "url": "https://api.github.com/repos/gitonomy/gitlib/zipball/932a960221ae3484a3e82553b3be478e56beb68d",
120
+ "reference": "932a960221ae3484a3e82553b3be478e56beb68d",
121
+ "shasum": ""
122
+ },
123
+ "require": {
124
+ "php": "^5.3 || ^7.0",
125
+ "symfony/process": "^2.3|^3.0|^4.0"
126
+ },
127
+ "require-dev": {
128
+ "phpunit/phpunit": "^4.8.35|^5.7",
129
+ "psr/log": "^1.0"
130
+ },
131
+ "suggest": {
132
+ "psr/log": "Add some log"
133
+ },
134
+ "type": "library",
135
+ "extra": {
136
+ "branch-alias": {
137
+ "dev-master": "1.0-dev"
138
+ }
139
+ },
140
+ "autoload": {
141
+ "psr-4": {
142
+ "Gitonomy\\Git\\": "src/Gitonomy/Git/"
143
+ }
144
+ },
145
+ "notification-url": "https://packagist.org/downloads/",
146
+ "license": [
147
+ "MIT"
148
+ ],
149
+ "authors": [
150
+ {
151
+ "name": "Alexandre Salomé",
152
+ "email": "alexandre.salome@gmail.com",
153
+ "homepage": "http://alexandre-salome.fr"
154
+ },
155
+ {
156
+ "name": "Julien DIDIER",
157
+ "email": "genzo.wm@gmail.com",
158
+ "homepage": "http://www.jdidier.net"
159
+ }
160
+ ],
161
+ "description": "Library for accessing git",
162
+ "homepage": "http://gitonomy.com",
163
+ "time": "2018-04-22T19:55:36+00:00"
164
+ },
165
+ {
166
+ "name": "phpdocumentor/reflection-common",
167
+ "version": "1.0.1",
168
+ "source": {
169
+ "type": "git",
170
+ "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
171
+ "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6"
172
+ },
173
+ "dist": {
174
+ "type": "zip",
175
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
176
+ "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6",
177
+ "shasum": ""
178
+ },
179
+ "require": {
180
+ "php": ">=5.5"
181
+ },
182
+ "require-dev": {
183
+ "phpunit/phpunit": "^4.6"
184
+ },
185
+ "type": "library",
186
+ "extra": {
187
+ "branch-alias": {
188
+ "dev-master": "1.0.x-dev"
189
+ }
190
+ },
191
+ "autoload": {
192
+ "psr-4": {
193
+ "phpDocumentor\\Reflection\\": [
194
+ "src"
195
+ ]
196
+ }
197
+ },
198
+ "notification-url": "https://packagist.org/downloads/",
199
+ "license": [
200
+ "MIT"
201
+ ],
202
+ "authors": [
203
+ {
204
+ "name": "Jaap van Otterdijk",
205
+ "email": "opensource@ijaap.nl"
206
+ }
207
+ ],
208
+ "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
209
+ "homepage": "http://www.phpdoc.org",
210
+ "keywords": [
211
+ "FQSEN",
212
+ "phpDocumentor",
213
+ "phpdoc",
214
+ "reflection",
215
+ "static analysis"
216
+ ],
217
+ "time": "2017-09-11T18:02:19+00:00"
218
+ },
219
+ {
220
+ "name": "phpdocumentor/reflection-docblock",
221
+ "version": "4.3.0",
222
+ "source": {
223
+ "type": "git",
224
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
225
+ "reference": "94fd0001232e47129dd3504189fa1c7225010d08"
226
+ },
227
+ "dist": {
228
+ "type": "zip",
229
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08",
230
+ "reference": "94fd0001232e47129dd3504189fa1c7225010d08",
231
+ "shasum": ""
232
+ },
233
+ "require": {
234
+ "php": "^7.0",
235
+ "phpdocumentor/reflection-common": "^1.0.0",
236
+ "phpdocumentor/type-resolver": "^0.4.0",
237
+ "webmozart/assert": "^1.0"
238
+ },
239
+ "require-dev": {
240
+ "doctrine/instantiator": "~1.0.5",
241
+ "mockery/mockery": "^1.0",
242
+ "phpunit/phpunit": "^6.4"
243
+ },
244
+ "type": "library",
245
+ "extra": {
246
+ "branch-alias": {
247
+ "dev-master": "4.x-dev"
248
+ }
249
+ },
250
+ "autoload": {
251
+ "psr-4": {
252
+ "phpDocumentor\\Reflection\\": [
253
+ "src/"
254
+ ]
255
+ }
256
+ },
257
+ "notification-url": "https://packagist.org/downloads/",
258
+ "license": [
259
+ "MIT"
260
+ ],
261
+ "authors": [
262
+ {
263
+ "name": "Mike van Riel",
264
+ "email": "me@mikevanriel.com"
265
+ }
266
+ ],
267
+ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
268
+ "time": "2017-11-30T07:14:17+00:00"
269
+ },
270
+ {
271
+ "name": "phpdocumentor/type-resolver",
272
+ "version": "0.4.0",
273
+ "source": {
274
+ "type": "git",
275
+ "url": "https://github.com/phpDocumentor/TypeResolver.git",
276
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
277
+ },
278
+ "dist": {
279
+ "type": "zip",
280
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
281
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
282
+ "shasum": ""
283
+ },
284
+ "require": {
285
+ "php": "^5.5 || ^7.0",
286
+ "phpdocumentor/reflection-common": "^1.0"
287
+ },
288
+ "require-dev": {
289
+ "mockery/mockery": "^0.9.4",
290
+ "phpunit/phpunit": "^5.2||^4.8.24"
291
+ },
292
+ "type": "library",
293
+ "extra": {
294
+ "branch-alias": {
295
+ "dev-master": "1.0.x-dev"
296
+ }
297
+ },
298
+ "autoload": {
299
+ "psr-4": {
300
+ "phpDocumentor\\Reflection\\": [
301
+ "src/"
302
+ ]
303
+ }
304
+ },
305
+ "notification-url": "https://packagist.org/downloads/",
306
+ "license": [
307
+ "MIT"
308
+ ],
309
+ "authors": [
310
+ {
311
+ "name": "Mike van Riel",
312
+ "email": "me@mikevanriel.com"
313
+ }
314
+ ],
315
+ "time": "2017-07-14T14:27:02+00:00"
316
+ },
317
+ {
318
+ "name": "phpspec/prophecy",
319
+ "version": "1.7.6",
320
+ "source": {
321
+ "type": "git",
322
+ "url": "https://github.com/phpspec/prophecy.git",
323
+ "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712"
324
+ },
325
+ "dist": {
326
+ "type": "zip",
327
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
328
+ "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
329
+ "shasum": ""
330
+ },
331
+ "require": {
332
+ "doctrine/instantiator": "^1.0.2",
333
+ "php": "^5.3|^7.0",
334
+ "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
335
+ "sebastian/comparator": "^1.1|^2.0|^3.0",
336
+ "sebastian/recursion-context": "^1.0|^2.0|^3.0"
337
+ },
338
+ "require-dev": {
339
+ "phpspec/phpspec": "^2.5|^3.2",
340
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5"
341
+ },
342
+ "type": "library",
343
+ "extra": {
344
+ "branch-alias": {
345
+ "dev-master": "1.7.x-dev"
346
+ }
347
+ },
348
+ "autoload": {
349
+ "psr-0": {
350
+ "Prophecy\\": "src/"
351
+ }
352
+ },
353
+ "notification-url": "https://packagist.org/downloads/",
354
+ "license": [
355
+ "MIT"
356
+ ],
357
+ "authors": [
358
+ {
359
+ "name": "Konstantin Kudryashov",
360
+ "email": "ever.zet@gmail.com",
361
+ "homepage": "http://everzet.com"
362
+ },
363
+ {
364
+ "name": "Marcello Duarte",
365
+ "email": "marcello.duarte@gmail.com"
366
+ }
367
+ ],
368
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
369
+ "homepage": "https://github.com/phpspec/prophecy",
370
+ "keywords": [
371
+ "Double",
372
+ "Dummy",
373
+ "fake",
374
+ "mock",
375
+ "spy",
376
+ "stub"
377
+ ],
378
+ "time": "2018-04-18T13:57:24+00:00"
379
+ },
380
+ {
381
+ "name": "phpunit/php-code-coverage",
382
+ "version": "2.2.4",
383
+ "source": {
384
+ "type": "git",
385
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
386
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
387
+ },
388
+ "dist": {
389
+ "type": "zip",
390
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
391
+ "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
392
+ "shasum": ""
393
+ },
394
+ "require": {
395
+ "php": ">=5.3.3",
396
+ "phpunit/php-file-iterator": "~1.3",
397
+ "phpunit/php-text-template": "~1.2",
398
+ "phpunit/php-token-stream": "~1.3",
399
+ "sebastian/environment": "^1.3.2",
400
+ "sebastian/version": "~1.0"
401
+ },
402
+ "require-dev": {
403
+ "ext-xdebug": ">=2.1.4",
404
+ "phpunit/phpunit": "~4"
405
+ },
406
+ "suggest": {
407
+ "ext-dom": "*",
408
+ "ext-xdebug": ">=2.2.1",
409
+ "ext-xmlwriter": "*"
410
+ },
411
+ "type": "library",
412
+ "extra": {
413
+ "branch-alias": {
414
+ "dev-master": "2.2.x-dev"
415
+ }
416
+ },
417
+ "autoload": {
418
+ "classmap": [
419
+ "src/"
420
+ ]
421
+ },
422
+ "notification-url": "https://packagist.org/downloads/",
423
+ "license": [
424
+ "BSD-3-Clause"
425
+ ],
426
+ "authors": [
427
+ {
428
+ "name": "Sebastian Bergmann",
429
+ "email": "sb@sebastian-bergmann.de",
430
+ "role": "lead"
431
+ }
432
+ ],
433
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
434
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
435
+ "keywords": [
436
+ "coverage",
437
+ "testing",
438
+ "xunit"
439
+ ],
440
+ "time": "2015-10-06T15:47:00+00:00"
441
+ },
442
+ {
443
+ "name": "phpunit/php-file-iterator",
444
+ "version": "1.4.5",
445
+ "source": {
446
+ "type": "git",
447
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
448
+ "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
449
+ },
450
+ "dist": {
451
+ "type": "zip",
452
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
453
+ "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
454
+ "shasum": ""
455
+ },
456
+ "require": {
457
+ "php": ">=5.3.3"
458
+ },
459
+ "type": "library",
460
+ "extra": {
461
+ "branch-alias": {
462
+ "dev-master": "1.4.x-dev"
463
+ }
464
+ },
465
+ "autoload": {
466
+ "classmap": [
467
+ "src/"
468
+ ]
469
+ },
470
+ "notification-url": "https://packagist.org/downloads/",
471
+ "license": [
472
+ "BSD-3-Clause"
473
+ ],
474
+ "authors": [
475
+ {
476
+ "name": "Sebastian Bergmann",
477
+ "email": "sb@sebastian-bergmann.de",
478
+ "role": "lead"
479
+ }
480
+ ],
481
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
482
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
483
+ "keywords": [
484
+ "filesystem",
485
+ "iterator"
486
+ ],
487
+ "time": "2017-11-27T13:52:08+00:00"
488
+ },
489
+ {
490
+ "name": "phpunit/php-text-template",
491
+ "version": "1.2.1",
492
+ "source": {
493
+ "type": "git",
494
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
495
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
496
+ },
497
+ "dist": {
498
+ "type": "zip",
499
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
500
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
501
+ "shasum": ""
502
+ },
503
+ "require": {
504
+ "php": ">=5.3.3"
505
+ },
506
+ "type": "library",
507
+ "autoload": {
508
+ "classmap": [
509
+ "src/"
510
+ ]
511
+ },
512
+ "notification-url": "https://packagist.org/downloads/",
513
+ "license": [
514
+ "BSD-3-Clause"
515
+ ],
516
+ "authors": [
517
+ {
518
+ "name": "Sebastian Bergmann",
519
+ "email": "sebastian@phpunit.de",
520
+ "role": "lead"
521
+ }
522
+ ],
523
+ "description": "Simple template engine.",
524
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
525
+ "keywords": [
526
+ "template"
527
+ ],
528
+ "time": "2015-06-21T13:50:34+00:00"
529
+ },
530
+ {
531
+ "name": "phpunit/php-timer",
532
+ "version": "1.0.9",
533
+ "source": {
534
+ "type": "git",
535
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
536
+ "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f"
537
+ },
538
+ "dist": {
539
+ "type": "zip",
540
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
541
+ "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f",
542
+ "shasum": ""
543
+ },
544
+ "require": {
545
+ "php": "^5.3.3 || ^7.0"
546
+ },
547
+ "require-dev": {
548
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
549
+ },
550
+ "type": "library",
551
+ "extra": {
552
+ "branch-alias": {
553
+ "dev-master": "1.0-dev"
554
+ }
555
+ },
556
+ "autoload": {
557
+ "classmap": [
558
+ "src/"
559
+ ]
560
+ },
561
+ "notification-url": "https://packagist.org/downloads/",
562
+ "license": [
563
+ "BSD-3-Clause"
564
+ ],
565
+ "authors": [
566
+ {
567
+ "name": "Sebastian Bergmann",
568
+ "email": "sb@sebastian-bergmann.de",
569
+ "role": "lead"
570
+ }
571
+ ],
572
+ "description": "Utility class for timing",
573
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
574
+ "keywords": [
575
+ "timer"
576
+ ],
577
+ "time": "2017-02-26T11:10:40+00:00"
578
+ },
579
+ {
580
+ "name": "phpunit/php-token-stream",
581
+ "version": "1.4.12",
582
+ "source": {
583
+ "type": "git",
584
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
585
+ "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16"
586
+ },
587
+ "dist": {
588
+ "type": "zip",
589
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16",
590
+ "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16",
591
+ "shasum": ""
592
+ },
593
+ "require": {
594
+ "ext-tokenizer": "*",
595
+ "php": ">=5.3.3"
596
+ },
597
+ "require-dev": {
598
+ "phpunit/phpunit": "~4.2"
599
+ },
600
+ "type": "library",
601
+ "extra": {
602
+ "branch-alias": {
603
+ "dev-master": "1.4-dev"
604
+ }
605
+ },
606
+ "autoload": {
607
+ "classmap": [
608
+ "src/"
609
+ ]
610
+ },
611
+ "notification-url": "https://packagist.org/downloads/",
612
+ "license": [
613
+ "BSD-3-Clause"
614
+ ],
615
+ "authors": [
616
+ {
617
+ "name": "Sebastian Bergmann",
618
+ "email": "sebastian@phpunit.de"
619
+ }
620
+ ],
621
+ "description": "Wrapper around PHP's tokenizer extension.",
622
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
623
+ "keywords": [
624
+ "tokenizer"
625
+ ],
626
+ "time": "2017-12-04T08:55:13+00:00"
627
+ },
628
+ {
629
+ "name": "phpunit/phpunit",
630
+ "version": "4.8.36",
631
+ "source": {
632
+ "type": "git",
633
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
634
+ "reference": "46023de9a91eec7dfb06cc56cb4e260017298517"
635
+ },
636
+ "dist": {
637
+ "type": "zip",
638
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517",
639
+ "reference": "46023de9a91eec7dfb06cc56cb4e260017298517",
640
+ "shasum": ""
641
+ },
642
+ "require": {
643
+ "ext-dom": "*",
644
+ "ext-json": "*",
645
+ "ext-pcre": "*",
646
+ "ext-reflection": "*",
647
+ "ext-spl": "*",
648
+ "php": ">=5.3.3",
649
+ "phpspec/prophecy": "^1.3.1",
650
+ "phpunit/php-code-coverage": "~2.1",
651
+ "phpunit/php-file-iterator": "~1.4",
652
+ "phpunit/php-text-template": "~1.2",
653
+ "phpunit/php-timer": "^1.0.6",
654
+ "phpunit/phpunit-mock-objects": "~2.3",
655
+ "sebastian/comparator": "~1.2.2",
656
+ "sebastian/diff": "~1.2",
657
+ "sebastian/environment": "~1.3",
658
+ "sebastian/exporter": "~1.2",
659
+ "sebastian/global-state": "~1.0",
660
+ "sebastian/version": "~1.0",
661
+ "symfony/yaml": "~2.1|~3.0"
662
+ },
663
+ "suggest": {
664
+ "phpunit/php-invoker": "~1.1"
665
+ },
666
+ "bin": [
667
+ "phpunit"
668
+ ],
669
+ "type": "library",
670
+ "extra": {
671
+ "branch-alias": {
672
+ "dev-master": "4.8.x-dev"
673
+ }
674
+ },
675
+ "autoload": {
676
+ "classmap": [
677
+ "src/"
678
+ ]
679
+ },
680
+ "notification-url": "https://packagist.org/downloads/",
681
+ "license": [
682
+ "BSD-3-Clause"
683
+ ],
684
+ "authors": [
685
+ {
686
+ "name": "Sebastian Bergmann",
687
+ "email": "sebastian@phpunit.de",
688
+ "role": "lead"
689
+ }
690
+ ],
691
+ "description": "The PHP Unit Testing framework.",
692
+ "homepage": "https://phpunit.de/",
693
+ "keywords": [
694
+ "phpunit",
695
+ "testing",
696
+ "xunit"
697
+ ],
698
+ "time": "2017-06-21T08:07:12+00:00"
699
+ },
700
+ {
701
+ "name": "phpunit/phpunit-mock-objects",
702
+ "version": "2.3.8",
703
+ "source": {
704
+ "type": "git",
705
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
706
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
707
+ },
708
+ "dist": {
709
+ "type": "zip",
710
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
711
+ "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
712
+ "shasum": ""
713
+ },
714
+ "require": {
715
+ "doctrine/instantiator": "^1.0.2",
716
+ "php": ">=5.3.3",
717
+ "phpunit/php-text-template": "~1.2",
718
+ "sebastian/exporter": "~1.2"
719
+ },
720
+ "require-dev": {
721
+ "phpunit/phpunit": "~4.4"
722
+ },
723
+ "suggest": {
724
+ "ext-soap": "*"
725
+ },
726
+ "type": "library",
727
+ "extra": {
728
+ "branch-alias": {
729
+ "dev-master": "2.3.x-dev"
730
+ }
731
+ },
732
+ "autoload": {
733
+ "classmap": [
734
+ "src/"
735
+ ]
736
+ },
737
+ "notification-url": "https://packagist.org/downloads/",
738
+ "license": [
739
+ "BSD-3-Clause"
740
+ ],
741
+ "authors": [
742
+ {
743
+ "name": "Sebastian Bergmann",
744
+ "email": "sb@sebastian-bergmann.de",
745
+ "role": "lead"
746
+ }
747
+ ],
748
+ "description": "Mock Object library for PHPUnit",
749
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
750
+ "keywords": [
751
+ "mock",
752
+ "xunit"
753
+ ],
754
+ "time": "2015-10-02T06:51:40+00:00"
755
+ },
756
+ {
757
+ "name": "sebastian/comparator",
758
+ "version": "1.2.4",
759
+ "source": {
760
+ "type": "git",
761
+ "url": "https://github.com/sebastianbergmann/comparator.git",
762
+ "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
763
+ },
764
+ "dist": {
765
+ "type": "zip",
766
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
767
+ "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
768
+ "shasum": ""
769
+ },
770
+ "require": {
771
+ "php": ">=5.3.3",
772
+ "sebastian/diff": "~1.2",
773
+ "sebastian/exporter": "~1.2 || ~2.0"
774
+ },
775
+ "require-dev": {
776
+ "phpunit/phpunit": "~4.4"
777
+ },
778
+ "type": "library",
779
+ "extra": {
780
+ "branch-alias": {
781
+ "dev-master": "1.2.x-dev"
782
+ }
783
+ },
784
+ "autoload": {
785
+ "classmap": [
786
+ "src/"
787
+ ]
788
+ },
789
+ "notification-url": "https://packagist.org/downloads/",
790
+ "license": [
791
+ "BSD-3-Clause"
792
+ ],
793
+ "authors": [
794
+ {
795
+ "name": "Jeff Welch",
796
+ "email": "whatthejeff@gmail.com"
797
+ },
798
+ {
799
+ "name": "Volker Dusch",
800
+ "email": "github@wallbash.com"
801
+ },
802
+ {
803
+ "name": "Bernhard Schussek",
804
+ "email": "bschussek@2bepublished.at"
805
+ },
806
+ {
807
+ "name": "Sebastian Bergmann",
808
+ "email": "sebastian@phpunit.de"
809
+ }
810
+ ],
811
+ "description": "Provides the functionality to compare PHP values for equality",
812
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
813
+ "keywords": [
814
+ "comparator",
815
+ "compare",
816
+ "equality"
817
+ ],
818
+ "time": "2017-01-29T09:50:25+00:00"
819
+ },
820
+ {
821
+ "name": "sebastian/diff",
822
+ "version": "1.4.3",
823
+ "source": {
824
+ "type": "git",
825
+ "url": "https://github.com/sebastianbergmann/diff.git",
826
+ "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4"
827
+ },
828
+ "dist": {
829
+ "type": "zip",
830
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4",
831
+ "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4",
832
+ "shasum": ""
833
+ },
834
+ "require": {
835
+ "php": "^5.3.3 || ^7.0"
836
+ },
837
+ "require-dev": {
838
+ "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0"
839
+ },
840
+ "type": "library",
841
+ "extra": {
842
+ "branch-alias": {
843
+ "dev-master": "1.4-dev"
844
+ }
845
+ },
846
+ "autoload": {
847
+ "classmap": [
848
+ "src/"
849
+ ]
850
+ },
851
+ "notification-url": "https://packagist.org/downloads/",
852
+ "license": [
853
+ "BSD-3-Clause"
854
+ ],
855
+ "authors": [
856
+ {
857
+ "name": "Kore Nordmann",
858
+ "email": "mail@kore-nordmann.de"
859
+ },
860
+ {
861
+ "name": "Sebastian Bergmann",
862
+ "email": "sebastian@phpunit.de"
863
+ }
864
+ ],
865
+ "description": "Diff implementation",
866
+ "homepage": "https://github.com/sebastianbergmann/diff",
867
+ "keywords": [
868
+ "diff"
869
+ ],
870
+ "time": "2017-05-22T07:24:03+00:00"
871
+ },
872
+ {
873
+ "name": "sebastian/environment",
874
+ "version": "1.3.8",
875
+ "source": {
876
+ "type": "git",
877
+ "url": "https://github.com/sebastianbergmann/environment.git",
878
+ "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
879
+ },
880
+ "dist": {
881
+ "type": "zip",
882
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea",
883
+ "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
884
+ "shasum": ""
885
+ },
886
+ "require": {
887
+ "php": "^5.3.3 || ^7.0"
888
+ },
889
+ "require-dev": {
890
+ "phpunit/phpunit": "^4.8 || ^5.0"
891
+ },
892
+ "type": "library",
893
+ "extra": {
894
+ "branch-alias": {
895
+ "dev-master": "1.3.x-dev"
896
+ }
897
+ },
898
+ "autoload": {
899
+ "classmap": [
900
+ "src/"
901
+ ]
902
+ },
903
+ "notification-url": "https://packagist.org/downloads/",
904
+ "license": [
905
+ "BSD-3-Clause"
906
+ ],
907
+ "authors": [
908
+ {
909
+ "name": "Sebastian Bergmann",
910
+ "email": "sebastian@phpunit.de"
911
+ }
912
+ ],
913
+ "description": "Provides functionality to handle HHVM/PHP environments",
914
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
915
+ "keywords": [
916
+ "Xdebug",
917
+ "environment",
918
+ "hhvm"
919
+ ],
920
+ "time": "2016-08-18T05:49:44+00:00"
921
+ },
922
+ {
923
+ "name": "sebastian/exporter",
924
+ "version": "1.2.2",
925
+ "source": {
926
+ "type": "git",
927
+ "url": "https://github.com/sebastianbergmann/exporter.git",
928
+ "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
929
+ },
930
+ "dist": {
931
+ "type": "zip",
932
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
933
+ "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
934
+ "shasum": ""
935
+ },
936
+ "require": {
937
+ "php": ">=5.3.3",
938
+ "sebastian/recursion-context": "~1.0"
939
+ },
940
+ "require-dev": {
941
+ "ext-mbstring": "*",
942
+ "phpunit/phpunit": "~4.4"
943
+ },
944
+ "type": "library",
945
+ "extra": {
946
+ "branch-alias": {
947
+ "dev-master": "1.3.x-dev"
948
+ }
949
+ },
950
+ "autoload": {
951
+ "classmap": [
952
+ "src/"
953
+ ]
954
+ },
955
+ "notification-url": "https://packagist.org/downloads/",
956
+ "license": [
957
+ "BSD-3-Clause"
958
+ ],
959
+ "authors": [
960
+ {
961
+ "name": "Jeff Welch",
962
+ "email": "whatthejeff@gmail.com"
963
+ },
964
+ {
965
+ "name": "Volker Dusch",
966
+ "email": "github@wallbash.com"
967
+ },
968
+ {
969
+ "name": "Bernhard Schussek",
970
+ "email": "bschussek@2bepublished.at"
971
+ },
972
+ {
973
+ "name": "Sebastian Bergmann",
974
+ "email": "sebastian@phpunit.de"
975
+ },
976
+ {
977
+ "name": "Adam Harvey",
978
+ "email": "aharvey@php.net"
979
+ }
980
+ ],
981
+ "description": "Provides the functionality to export PHP variables for visualization",
982
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
983
+ "keywords": [
984
+ "export",
985
+ "exporter"
986
+ ],
987
+ "time": "2016-06-17T09:04:28+00:00"
988
+ },
989
+ {
990
+ "name": "sebastian/global-state",
991
+ "version": "1.1.1",
992
+ "source": {
993
+ "type": "git",
994
+ "url": "https://github.com/sebastianbergmann/global-state.git",
995
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
996
+ },
997
+ "dist": {
998
+ "type": "zip",
999
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
1000
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
1001
+ "shasum": ""
1002
+ },
1003
+ "require": {
1004
+ "php": ">=5.3.3"
1005
+ },
1006
+ "require-dev": {
1007
+ "phpunit/phpunit": "~4.2"
1008
+ },
1009
+ "suggest": {
1010
+ "ext-uopz": "*"
1011
+ },
1012
+ "type": "library",
1013
+ "extra": {
1014
+ "branch-alias": {
1015
+ "dev-master": "1.0-dev"
1016
+ }
1017
+ },
1018
+ "autoload": {
1019
+ "classmap": [
1020
+ "src/"
1021
+ ]
1022
+ },
1023
+ "notification-url": "https://packagist.org/downloads/",
1024
+ "license": [
1025
+ "BSD-3-Clause"
1026
+ ],
1027
+ "authors": [
1028
+ {
1029
+ "name": "Sebastian Bergmann",
1030
+ "email": "sebastian@phpunit.de"
1031
+ }
1032
+ ],
1033
+ "description": "Snapshotting of global state",
1034
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
1035
+ "keywords": [
1036
+ "global state"
1037
+ ],
1038
+ "time": "2015-10-12T03:26:01+00:00"
1039
+ },
1040
+ {
1041
+ "name": "sebastian/recursion-context",
1042
+ "version": "1.0.5",
1043
+ "source": {
1044
+ "type": "git",
1045
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
1046
+ "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7"
1047
+ },
1048
+ "dist": {
1049
+ "type": "zip",
1050
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
1051
+ "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7",
1052
+ "shasum": ""
1053
+ },
1054
+ "require": {
1055
+ "php": ">=5.3.3"
1056
+ },
1057
+ "require-dev": {
1058
+ "phpunit/phpunit": "~4.4"
1059
+ },
1060
+ "type": "library",
1061
+ "extra": {
1062
+ "branch-alias": {
1063
+ "dev-master": "1.0.x-dev"
1064
+ }
1065
+ },
1066
+ "autoload": {
1067
+ "classmap": [
1068
+ "src/"
1069
+ ]
1070
+ },
1071
+ "notification-url": "https://packagist.org/downloads/",
1072
+ "license": [
1073
+ "BSD-3-Clause"
1074
+ ],
1075
+ "authors": [
1076
+ {
1077
+ "name": "Jeff Welch",
1078
+ "email": "whatthejeff@gmail.com"
1079
+ },
1080
+ {
1081
+ "name": "Sebastian Bergmann",
1082
+ "email": "sebastian@phpunit.de"
1083
+ },
1084
+ {
1085
+ "name": "Adam Harvey",
1086
+ "email": "aharvey@php.net"
1087
+ }
1088
+ ],
1089
+ "description": "Provides functionality to recursively process PHP variables",
1090
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
1091
+ "time": "2016-10-03T07:41:43+00:00"
1092
+ },
1093
+ {
1094
+ "name": "sebastian/version",
1095
+ "version": "1.0.6",
1096
+ "source": {
1097
+ "type": "git",
1098
+ "url": "https://github.com/sebastianbergmann/version.git",
1099
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
1100
+ },
1101
+ "dist": {
1102
+ "type": "zip",
1103
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
1104
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
1105
+ "shasum": ""
1106
+ },
1107
+ "type": "library",
1108
+ "autoload": {
1109
+ "classmap": [
1110
+ "src/"
1111
+ ]
1112
+ },
1113
+ "notification-url": "https://packagist.org/downloads/",
1114
+ "license": [
1115
+ "BSD-3-Clause"
1116
+ ],
1117
+ "authors": [
1118
+ {
1119
+ "name": "Sebastian Bergmann",
1120
+ "email": "sebastian@phpunit.de",
1121
+ "role": "lead"
1122
+ }
1123
+ ],
1124
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
1125
+ "homepage": "https://github.com/sebastianbergmann/version",
1126
+ "time": "2015-06-21T13:59:46+00:00"
1127
+ },
1128
+ {
1129
+ "name": "symfony/console",
1130
+ "version": "v4.1.6",
1131
+ "source": {
1132
+ "type": "git",
1133
+ "url": "https://github.com/symfony/console.git",
1134
+ "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b"
1135
+ },
1136
+ "dist": {
1137
+ "type": "zip",
1138
+ "url": "https://api.github.com/repos/symfony/console/zipball/dc7122fe5f6113cfaba3b3de575d31112c9aa60b",
1139
+ "reference": "dc7122fe5f6113cfaba3b3de575d31112c9aa60b",
1140
+ "shasum": ""
1141
+ },
1142
+ "require": {
1143
+ "php": "^7.1.3",
1144
+ "symfony/polyfill-mbstring": "~1.0"
1145
+ },
1146
+ "conflict": {
1147
+ "symfony/dependency-injection": "<3.4",
1148
+ "symfony/process": "<3.3"
1149
+ },
1150
+ "require-dev": {
1151
+ "psr/log": "~1.0",
1152
+ "symfony/config": "~3.4|~4.0",
1153
+ "symfony/dependency-injection": "~3.4|~4.0",
1154
+ "symfony/event-dispatcher": "~3.4|~4.0",
1155
+ "symfony/lock": "~3.4|~4.0",
1156
+ "symfony/process": "~3.4|~4.0"
1157
+ },
1158
+ "suggest": {
1159
+ "psr/log-implementation": "For using the console logger",
1160
+ "symfony/event-dispatcher": "",
1161
+ "symfony/lock": "",
1162
+ "symfony/process": ""
1163
+ },
1164
+ "type": "library",
1165
+ "extra": {
1166
+ "branch-alias": {
1167
+ "dev-master": "4.1-dev"
1168
+ }
1169
+ },
1170
+ "autoload": {
1171
+ "psr-4": {
1172
+ "Symfony\\Component\\Console\\": ""
1173
+ },
1174
+ "exclude-from-classmap": [
1175
+ "/Tests/"
1176
+ ]
1177
+ },
1178
+ "notification-url": "https://packagist.org/downloads/",
1179
+ "license": [
1180
+ "MIT"
1181
+ ],
1182
+ "authors": [
1183
+ {
1184
+ "name": "Fabien Potencier",
1185
+ "email": "fabien@symfony.com"
1186
+ },
1187
+ {
1188
+ "name": "Symfony Community",
1189
+ "homepage": "https://symfony.com/contributors"
1190
+ }
1191
+ ],
1192
+ "description": "Symfony Console Component",
1193
+ "homepage": "https://symfony.com",
1194
+ "time": "2018-10-03T08:15:46+00:00"
1195
+ },
1196
+ {
1197
+ "name": "symfony/polyfill-ctype",
1198
+ "version": "v1.8.0",
1199
+ "source": {
1200
+ "type": "git",
1201
+ "url": "https://github.com/symfony/polyfill-ctype.git",
1202
+ "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
1203
+ },
1204
+ "dist": {
1205
+ "type": "zip",
1206
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
1207
+ "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
1208
+ "shasum": ""
1209
+ },
1210
+ "require": {
1211
+ "php": ">=5.3.3"
1212
+ },
1213
+ "type": "library",
1214
+ "extra": {
1215
+ "branch-alias": {
1216
+ "dev-master": "1.8-dev"
1217
+ }
1218
+ },
1219
+ "autoload": {
1220
+ "psr-4": {
1221
+ "Symfony\\Polyfill\\Ctype\\": ""
1222
+ },
1223
+ "files": [
1224
+ "bootstrap.php"
1225
+ ]
1226
+ },
1227
+ "notification-url": "https://packagist.org/downloads/",
1228
+ "license": [
1229
+ "MIT"
1230
+ ],
1231
+ "authors": [
1232
+ {
1233
+ "name": "Symfony Community",
1234
+ "homepage": "https://symfony.com/contributors"
1235
+ },
1236
+ {
1237
+ "name": "Gert de Pagter",
1238
+ "email": "BackEndTea@gmail.com"
1239
+ }
1240
+ ],
1241
+ "description": "Symfony polyfill for ctype functions",
1242
+ "homepage": "https://symfony.com",
1243
+ "keywords": [
1244
+ "compatibility",
1245
+ "ctype",
1246
+ "polyfill",
1247
+ "portable"
1248
+ ],
1249
+ "time": "2018-04-30T19:57:29+00:00"
1250
+ },
1251
+ {
1252
+ "name": "symfony/polyfill-mbstring",
1253
+ "version": "v1.9.0",
1254
+ "source": {
1255
+ "type": "git",
1256
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
1257
+ "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
1258
+ },
1259
+ "dist": {
1260
+ "type": "zip",
1261
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
1262
+ "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
1263
+ "shasum": ""
1264
+ },
1265
+ "require": {
1266
+ "php": ">=5.3.3"
1267
+ },
1268
+ "suggest": {
1269
+ "ext-mbstring": "For best performance"
1270
+ },
1271
+ "type": "library",
1272
+ "extra": {
1273
+ "branch-alias": {
1274
+ "dev-master": "1.9-dev"
1275
+ }
1276
+ },
1277
+ "autoload": {
1278
+ "psr-4": {
1279
+ "Symfony\\Polyfill\\Mbstring\\": ""
1280
+ },
1281
+ "files": [
1282
+ "bootstrap.php"
1283
+ ]
1284
+ },
1285
+ "notification-url": "https://packagist.org/downloads/",
1286
+ "license": [
1287
+ "MIT"
1288
+ ],
1289
+ "authors": [
1290
+ {
1291
+ "name": "Nicolas Grekas",
1292
+ "email": "p@tchwork.com"
1293
+ },
1294
+ {
1295
+ "name": "Symfony Community",
1296
+ "homepage": "https://symfony.com/contributors"
1297
+ }
1298
+ ],
1299
+ "description": "Symfony polyfill for the Mbstring extension",
1300
+ "homepage": "https://symfony.com",
1301
+ "keywords": [
1302
+ "compatibility",
1303
+ "mbstring",
1304
+ "polyfill",
1305
+ "portable",
1306
+ "shim"
1307
+ ],
1308
+ "time": "2018-08-06T14:22:27+00:00"
1309
+ },
1310
+ {
1311
+ "name": "symfony/process",
1312
+ "version": "v4.1.6",
1313
+ "source": {
1314
+ "type": "git",
1315
+ "url": "https://github.com/symfony/process.git",
1316
+ "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529"
1317
+ },
1318
+ "dist": {
1319
+ "type": "zip",
1320
+ "url": "https://api.github.com/repos/symfony/process/zipball/ee33c0322a8fee0855afcc11fff81e6b1011b529",
1321
+ "reference": "ee33c0322a8fee0855afcc11fff81e6b1011b529",
1322
+ "shasum": ""
1323
+ },
1324
+ "require": {
1325
+ "php": "^7.1.3"
1326
+ },
1327
+ "type": "library",
1328
+ "extra": {
1329
+ "branch-alias": {
1330
+ "dev-master": "4.1-dev"
1331
+ }
1332
+ },
1333
+ "autoload": {
1334
+ "psr-4": {
1335
+ "Symfony\\Component\\Process\\": ""
1336
+ },
1337
+ "exclude-from-classmap": [
1338
+ "/Tests/"
1339
+ ]
1340
+ },
1341
+ "notification-url": "https://packagist.org/downloads/",
1342
+ "license": [
1343
+ "MIT"
1344
+ ],
1345
+ "authors": [
1346
+ {
1347
+ "name": "Fabien Potencier",
1348
+ "email": "fabien@symfony.com"
1349
+ },
1350
+ {
1351
+ "name": "Symfony Community",
1352
+ "homepage": "https://symfony.com/contributors"
1353
+ }
1354
+ ],
1355
+ "description": "Symfony Process Component",
1356
+ "homepage": "https://symfony.com",
1357
+ "time": "2018-10-02T12:40:59+00:00"
1358
+ },
1359
+ {
1360
+ "name": "symfony/yaml",
1361
+ "version": "v3.4.12",
1362
+ "source": {
1363
+ "type": "git",
1364
+ "url": "https://github.com/symfony/yaml.git",
1365
+ "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0"
1366
+ },
1367
+ "dist": {
1368
+ "type": "zip",
1369
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/c5010cc1692ce1fa328b1fb666961eb3d4a85bb0",
1370
+ "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0",
1371
+ "shasum": ""
1372
+ },
1373
+ "require": {
1374
+ "php": "^5.5.9|>=7.0.8",
1375
+ "symfony/polyfill-ctype": "~1.8"
1376
+ },
1377
+ "conflict": {
1378
+ "symfony/console": "<3.4"
1379
+ },
1380
+ "require-dev": {
1381
+ "symfony/console": "~3.4|~4.0"
1382
+ },
1383
+ "suggest": {
1384
+ "symfony/console": "For validating YAML files using the lint command"
1385
+ },
1386
+ "type": "library",
1387
+ "extra": {
1388
+ "branch-alias": {
1389
+ "dev-master": "3.4-dev"
1390
+ }
1391
+ },
1392
+ "autoload": {
1393
+ "psr-4": {
1394
+ "Symfony\\Component\\Yaml\\": ""
1395
+ },
1396
+ "exclude-from-classmap": [
1397
+ "/Tests/"
1398
+ ]
1399
+ },
1400
+ "notification-url": "https://packagist.org/downloads/",
1401
+ "license": [
1402
+ "MIT"
1403
+ ],
1404
+ "authors": [
1405
+ {
1406
+ "name": "Fabien Potencier",
1407
+ "email": "fabien@symfony.com"
1408
+ },
1409
+ {
1410
+ "name": "Symfony Community",
1411
+ "homepage": "https://symfony.com/contributors"
1412
+ }
1413
+ ],
1414
+ "description": "Symfony Yaml Component",
1415
+ "homepage": "https://symfony.com",
1416
+ "time": "2018-05-03T23:18:14+00:00"
1417
+ },
1418
+ {
1419
+ "name": "webmozart/assert",
1420
+ "version": "1.3.0",
1421
+ "source": {
1422
+ "type": "git",
1423
+ "url": "https://github.com/webmozart/assert.git",
1424
+ "reference": "0df1908962e7a3071564e857d86874dad1ef204a"
1425
+ },
1426
+ "dist": {
1427
+ "type": "zip",
1428
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
1429
+ "reference": "0df1908962e7a3071564e857d86874dad1ef204a",
1430
+ "shasum": ""
1431
+ },
1432
+ "require": {
1433
+ "php": "^5.3.3 || ^7.0"
1434
+ },
1435
+ "require-dev": {
1436
+ "phpunit/phpunit": "^4.6",
1437
+ "sebastian/version": "^1.0.1"
1438
+ },
1439
+ "type": "library",
1440
+ "extra": {
1441
+ "branch-alias": {
1442
+ "dev-master": "1.3-dev"
1443
+ }
1444
+ },
1445
+ "autoload": {
1446
+ "psr-4": {
1447
+ "Webmozart\\Assert\\": "src/"
1448
+ }
1449
+ },
1450
+ "notification-url": "https://packagist.org/downloads/",
1451
+ "license": [
1452
+ "MIT"
1453
+ ],
1454
+ "authors": [
1455
+ {
1456
+ "name": "Bernhard Schussek",
1457
+ "email": "bschussek@gmail.com"
1458
+ }
1459
+ ],
1460
+ "description": "Assertions to validate method input/output with nice error messages.",
1461
+ "keywords": [
1462
+ "assert",
1463
+ "check",
1464
+ "validate"
1465
+ ],
1466
+ "time": "2018-01-29T19:49:41+00:00"
1467
+ }
1468
+ ],
1469
+ "aliases": [],
1470
+ "minimum-stability": "stable",
1471
+ "stability-flags": [],
1472
+ "prefer-stable": false,
1473
+ "prefer-lowest": false,
1474
+ "platform": {
1475
+ "php": ">=5.3.2"
1476
+ },
1477
+ "platform-dev": []
1478
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/AtRuleBlockList.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\Property\AtRule;
6
+
7
+ /**
8
+ * A BlockList constructed by an unknown @-rule. @media rules are rendered into AtRuleBlockList objects.
9
+ */
10
+ class AtRuleBlockList extends CSSBlockList implements AtRule {
11
+
12
+ private $sType;
13
+ private $sArgs;
14
+
15
+ public function __construct($sType, $sArgs = '', $iLineNo = 0) {
16
+ parent::__construct($iLineNo);
17
+ $this->sType = $sType;
18
+ $this->sArgs = $sArgs;
19
+ }
20
+
21
+ public function atRuleName() {
22
+ return $this->sType;
23
+ }
24
+
25
+ public function atRuleArgs() {
26
+ return $this->sArgs;
27
+ }
28
+
29
+ public function __toString() {
30
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
31
+ }
32
+
33
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
34
+ $sArgs = $this->sArgs;
35
+ if($sArgs) {
36
+ $sArgs = ' ' . $sArgs;
37
+ }
38
+ $sResult = $oOutputFormat->sBeforeAtRuleBlock;
39
+ $sResult .= "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{";
40
+ $sResult .= parent::render($oOutputFormat);
41
+ $sResult .= '}';
42
+ $sResult .= $oOutputFormat->sAfterAtRuleBlock;
43
+ return $sResult;
44
+ }
45
+
46
+ public function isRootList() {
47
+ return false;
48
+ }
49
+
50
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSBlockList.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\RuleSet\DeclarationBlock;
6
+ use Sabberworm\CSS\RuleSet\RuleSet;
7
+ use Sabberworm\CSS\Property\Selector;
8
+ use Sabberworm\CSS\Rule\Rule;
9
+ use Sabberworm\CSS\Value\ValueList;
10
+ use Sabberworm\CSS\Value\CSSFunction;
11
+
12
+ /**
13
+ * A CSSBlockList is a CSSList whose DeclarationBlocks are guaranteed to contain valid declaration blocks or at-rules.
14
+ * Most CSSLists conform to this category but some at-rules (such as @keyframes) do not.
15
+ */
16
+ abstract class CSSBlockList extends CSSList {
17
+ public function __construct($iLineNo = 0) {
18
+ parent::__construct($iLineNo);
19
+ }
20
+
21
+ protected function allDeclarationBlocks(&$aResult) {
22
+ foreach ($this->aContents as $mContent) {
23
+ if ($mContent instanceof DeclarationBlock) {
24
+ $aResult[] = $mContent;
25
+ } else if ($mContent instanceof CSSBlockList) {
26
+ $mContent->allDeclarationBlocks($aResult);
27
+ }
28
+ }
29
+ }
30
+
31
+ protected function allRuleSets(&$aResult) {
32
+ foreach ($this->aContents as $mContent) {
33
+ if ($mContent instanceof RuleSet) {
34
+ $aResult[] = $mContent;
35
+ } else if ($mContent instanceof CSSBlockList) {
36
+ $mContent->allRuleSets($aResult);
37
+ }
38
+ }
39
+ }
40
+
41
+ protected function allValues($oElement, &$aResult, $sSearchString = null, $bSearchInFunctionArguments = false) {
42
+ if ($oElement instanceof CSSBlockList) {
43
+ foreach ($oElement->getContents() as $oContent) {
44
+ $this->allValues($oContent, $aResult, $sSearchString, $bSearchInFunctionArguments);
45
+ }
46
+ } else if ($oElement instanceof RuleSet) {
47
+ foreach ($oElement->getRules($sSearchString) as $oRule) {
48
+ $this->allValues($oRule, $aResult, $sSearchString, $bSearchInFunctionArguments);
49
+ }
50
+ } else if ($oElement instanceof Rule) {
51
+ $this->allValues($oElement->getValue(), $aResult, $sSearchString, $bSearchInFunctionArguments);
52
+ } else if ($oElement instanceof ValueList) {
53
+ if ($bSearchInFunctionArguments || !($oElement instanceof CSSFunction)) {
54
+ foreach ($oElement->getListComponents() as $mComponent) {
55
+ $this->allValues($mComponent, $aResult, $sSearchString, $bSearchInFunctionArguments);
56
+ }
57
+ }
58
+ } else {
59
+ //Non-List Value or CSSString (CSS identifier)
60
+ $aResult[] = $oElement;
61
+ }
62
+ }
63
+
64
+ protected function allSelectors(&$aResult, $sSpecificitySearch = null) {
65
+ $aDeclarationBlocks = array();
66
+ $this->allDeclarationBlocks($aDeclarationBlocks);
67
+ foreach ($aDeclarationBlocks as $oBlock) {
68
+ foreach ($oBlock->getSelectors() as $oSelector) {
69
+ if ($sSpecificitySearch === null) {
70
+ $aResult[] = $oSelector;
71
+ } else {
72
+ $sComparison = "\$bRes = {$oSelector->getSpecificity()} $sSpecificitySearch;";
73
+ eval($sComparison);
74
+ if ($bRes) {
75
+ $aResult[] = $oSelector;
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\Comment\Commentable;
6
+ use Sabberworm\CSS\Parsing\ParserState;
7
+ use Sabberworm\CSS\Parsing\SourceException;
8
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
9
+ use Sabberworm\CSS\Property\AtRule;
10
+ use Sabberworm\CSS\Property\Charset;
11
+ use Sabberworm\CSS\Property\CSSNamespace;
12
+ use Sabberworm\CSS\Property\Import;
13
+ use Sabberworm\CSS\Property\Selector;
14
+ use Sabberworm\CSS\Renderable;
15
+ use Sabberworm\CSS\RuleSet\AtRuleSet;
16
+ use Sabberworm\CSS\RuleSet\DeclarationBlock;
17
+ use Sabberworm\CSS\RuleSet\RuleSet;
18
+ use Sabberworm\CSS\Value\CSSString;
19
+ use Sabberworm\CSS\Value\URL;
20
+ use Sabberworm\CSS\Value\Value;
21
+
22
+ /**
23
+ * A CSSList is the most generic container available. Its contents include RuleSet as well as other CSSList objects.
24
+ * Also, it may contain Import and Charset objects stemming from @-rules.
25
+ */
26
+ abstract class CSSList implements Renderable, Commentable {
27
+
28
+ protected $aComments;
29
+ protected $aContents;
30
+ protected $iLineNo;
31
+
32
+ public function __construct($iLineNo = 0) {
33
+ $this->aComments = array();
34
+ $this->aContents = array();
35
+ $this->iLineNo = $iLineNo;
36
+ }
37
+
38
+ public static function parseList(ParserState $oParserState, CSSList $oList) {
39
+ $bIsRoot = $oList instanceof Document;
40
+ if(is_string($oParserState)) {
41
+ $oParserState = new ParserState($oParserState);
42
+ }
43
+ $bLenientParsing = $oParserState->getSettings()->bLenientParsing;
44
+ while(!$oParserState->isEnd()) {
45
+ $comments = $oParserState->consumeWhiteSpace();
46
+ $oListItem = null;
47
+ if($bLenientParsing) {
48
+ try {
49
+ $oListItem = self::parseListItem($oParserState, $oList);
50
+ } catch (UnexpectedTokenException $e) {
51
+ $oListItem = false;
52
+ }
53
+ } else {
54
+ $oListItem = self::parseListItem($oParserState, $oList);
55
+ }
56
+ if($oListItem === null) {
57
+ // List parsing finished
58
+ return;
59
+ }
60
+ if($oListItem) {
61
+ $oListItem->setComments($comments);
62
+ $oList->append($oListItem);
63
+ }
64
+ $oParserState->consumeWhiteSpace();
65
+ }
66
+ if(!$bIsRoot && !$bLenientParsing) {
67
+ throw new SourceException("Unexpected end of document", $oParserState->currentLine());
68
+ }
69
+ }
70
+
71
+ private static function parseListItem(ParserState $oParserState, CSSList $oList) {
72
+ $bIsRoot = $oList instanceof Document;
73
+ if ($oParserState->comes('@')) {
74
+ $oAtRule = self::parseAtRule($oParserState);
75
+ if($oAtRule instanceof Charset) {
76
+ if(!$bIsRoot) {
77
+ throw new UnexpectedTokenException('@charset may only occur in root document', '', 'custom', $oParserState->currentLine());
78
+ }
79
+ if(count($oList->getContents()) > 0) {
80
+ throw new UnexpectedTokenException('@charset must be the first parseable token in a document', '', 'custom', $oParserState->currentLine());
81
+ }
82
+ $oParserState->setCharset($oAtRule->getCharset()->getString());
83
+ }
84
+ return $oAtRule;
85
+ } else if ($oParserState->comes('}')) {
86
+ if (!$oParserState->getSettings()->bLenientParsing) {
87
+ throw new UnexpectedTokenException('CSS selector', '}', 'identifier', $oParserState->currentLine());
88
+ } else {
89
+ if ($bIsRoot) {
90
+ if ($oParserState->getSettings()->bLenientParsing) {
91
+ return DeclarationBlock::parse($oParserState);
92
+ } else {
93
+ throw new SourceException("Unopened {", $oParserState->currentLine());
94
+ }
95
+ } else {
96
+ return null;
97
+ }
98
+ }
99
+ } else {
100
+ return DeclarationBlock::parse($oParserState);
101
+ }
102
+ }
103
+
104
+ private static function parseAtRule(ParserState $oParserState) {
105
+ $oParserState->consume('@');
106
+ $sIdentifier = $oParserState->parseIdentifier();
107
+ $iIdentifierLineNum = $oParserState->currentLine();
108
+ $oParserState->consumeWhiteSpace();
109
+ if ($sIdentifier === 'import') {
110
+ $oLocation = URL::parse($oParserState);
111
+ $oParserState->consumeWhiteSpace();
112
+ $sMediaQuery = null;
113
+ if (!$oParserState->comes(';')) {
114
+ $sMediaQuery = $oParserState->consumeUntil(';');
115
+ }
116
+ $oParserState->consume(';');
117
+ return new Import($oLocation, $sMediaQuery, $iIdentifierLineNum);
118
+ } else if ($sIdentifier === 'charset') {
119
+ $sCharset = CSSString::parse($oParserState);
120
+ $oParserState->consumeWhiteSpace();
121
+ $oParserState->consume(';');
122
+ return new Charset($sCharset, $iIdentifierLineNum);
123
+ } else if (self::identifierIs($sIdentifier, 'keyframes')) {
124
+ $oResult = new KeyFrame($iIdentifierLineNum);
125
+ $oResult->setVendorKeyFrame($sIdentifier);
126
+ $oResult->setAnimationName(trim($oParserState->consumeUntil('{', false, true)));
127
+ CSSList::parseList($oParserState, $oResult);
128
+ if ($oParserState->comes('}')) {
129
+ $oParserState->consume('}');
130
+ }
131
+ return $oResult;
132
+ } else if ($sIdentifier === 'namespace') {
133
+ $sPrefix = null;
134
+ $mUrl = Value::parsePrimitiveValue($oParserState);
135
+ if (!$oParserState->comes(';')) {
136
+ $sPrefix = $mUrl;
137
+ $mUrl = Value::parsePrimitiveValue($oParserState);
138
+ }
139
+ $oParserState->consume(';');
140
+ if ($sPrefix !== null && !is_string($sPrefix)) {
141
+ throw new UnexpectedTokenException('Wrong namespace prefix', $sPrefix, 'custom', $iIdentifierLineNum);
142
+ }
143
+ if (!($mUrl instanceof CSSString || $mUrl instanceof URL)) {
144
+ throw new UnexpectedTokenException('Wrong namespace url of invalid type', $mUrl, 'custom', $iIdentifierLineNum);
145
+ }
146
+ return new CSSNamespace($mUrl, $sPrefix, $iIdentifierLineNum);
147
+ } else {
148
+ //Unknown other at rule (font-face or such)
149
+ $sArgs = trim($oParserState->consumeUntil('{', false, true));
150
+ if (substr_count($sArgs, "(") != substr_count($sArgs, ")")) {
151
+ if($oParserState->getSettings()->bLenientParsing) {
152
+ return NULL;
153
+ } else {
154
+ throw new SourceException("Unmatched brace count in media query", $oParserState->currentLine());
155
+ }
156
+ }
157
+ $bUseRuleSet = true;
158
+ foreach(explode('/', AtRule::BLOCK_RULES) as $sBlockRuleName) {
159
+ if(self::identifierIs($sIdentifier, $sBlockRuleName)) {
160
+ $bUseRuleSet = false;
161
+ break;
162
+ }
163
+ }
164
+ if($bUseRuleSet) {
165
+ $oAtRule = new AtRuleSet($sIdentifier, $sArgs, $iIdentifierLineNum);
166
+ RuleSet::parseRuleSet($oParserState, $oAtRule);
167
+ } else {
168
+ $oAtRule = new AtRuleBlockList($sIdentifier, $sArgs, $iIdentifierLineNum);
169
+ CSSList::parseList($oParserState, $oAtRule);
170
+ if ($oParserState->comes('}')) {
171
+ $oParserState->consume('}');
172
+ }
173
+ }
174
+ return $oAtRule;
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Tests an identifier for a given value. Since identifiers are all keywords, they can be vendor-prefixed. We need to check for these versions too.
180
+ */
181
+ private static function identifierIs($sIdentifier, $sMatch) {
182
+ return (strcasecmp($sIdentifier, $sMatch) === 0)
183
+ ?: preg_match("/^(-\\w+-)?$sMatch$/i", $sIdentifier) === 1;
184
+ }
185
+
186
+
187
+ /**
188
+ * @return int
189
+ */
190
+ public function getLineNo() {
191
+ return $this->iLineNo;
192
+ }
193
+
194
+ /**
195
+ * Prepend item to list of contents.
196
+ *
197
+ * @param object $oItem Item.
198
+ */
199
+ public function prepend($oItem) {
200
+ array_unshift($this->aContents, $oItem);
201
+ }
202
+
203
+ /**
204
+ * Append item to list of contents.
205
+ *
206
+ * @param object $oItem Item.
207
+ */
208
+ public function append($oItem) {
209
+ $this->aContents[] = $oItem;
210
+ }
211
+
212
+ /**
213
+ * Splice the list of contents.
214
+ *
215
+ * @param int $iOffset Offset.
216
+ * @param int $iLength Length. Optional.
217
+ * @param RuleSet[] $mReplacement Replacement. Optional.
218
+ */
219
+ public function splice($iOffset, $iLength = null, $mReplacement = null) {
220
+ array_splice($this->aContents, $iOffset, $iLength, $mReplacement);
221
+ }
222
+
223
+ /**
224
+ * Removes an item from the CSS list.
225
+ * @param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery)
226
+ * @return bool Whether the item was removed.
227
+ */
228
+ public function remove($oItemToRemove) {
229
+ $iKey = array_search($oItemToRemove, $this->aContents, true);
230
+ if ($iKey !== false) {
231
+ unset($this->aContents[$iKey]);
232
+ return true;
233
+ }
234
+ return false;
235
+ }
236
+
237
+ /**
238
+ * Replaces an item from the CSS list.
239
+ * @param RuleSet|Import|Charset|CSSList $oItemToRemove May be a RuleSet (most likely a DeclarationBlock), a Import, a Charset or another CSSList (most likely a MediaQuery)
240
+ */
241
+ public function replace($oOldItem, $oNewItem) {
242
+ $iKey = array_search($oOldItem, $this->aContents, true);
243
+ if ($iKey !== false) {
244
+ array_splice($this->aContents, $iKey, 1, $oNewItem);
245
+ return true;
246
+ }
247
+ return false;
248
+ }
249
+
250
+ /**
251
+ * Set the contents.
252
+ * @param array $aContents Objects to set as content.
253
+ */
254
+ public function setContents(array $aContents) {
255
+ $this->aContents = array();
256
+ foreach ($aContents as $content) {
257
+ $this->append($content);
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Removes a declaration block from the CSS list if it matches all given selectors.
263
+ * @param array|string $mSelector The selectors to match.
264
+ * @param boolean $bRemoveAll Whether to stop at the first declaration block found or remove all blocks
265
+ */
266
+ public function removeDeclarationBlockBySelector($mSelector, $bRemoveAll = false) {
267
+ if ($mSelector instanceof DeclarationBlock) {
268
+ $mSelector = $mSelector->getSelectors();
269
+ }
270
+ if (!is_array($mSelector)) {
271
+ $mSelector = explode(',', $mSelector);
272
+ }
273
+ foreach ($mSelector as $iKey => &$mSel) {
274
+ if (!($mSel instanceof Selector)) {
275
+ if (!Selector::isValid($mSel)) {
276
+ throw new UnexpectedTokenException("Selector did not match '" . Selector::SELECTOR_VALIDATION_RX . "'.", $mSel, "custom");
277
+ }
278
+ $mSel = new Selector($mSel);
279
+ }
280
+ }
281
+ foreach ($this->aContents as $iKey => $mItem) {
282
+ if (!($mItem instanceof DeclarationBlock)) {
283
+ continue;
284
+ }
285
+ if ($mItem->getSelectors() == $mSelector) {
286
+ unset($this->aContents[$iKey]);
287
+ if (!$bRemoveAll) {
288
+ return;
289
+ }
290
+ }
291
+ }
292
+ }
293
+
294
+ public function __toString() {
295
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
296
+ }
297
+
298
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
299
+ $sResult = '';
300
+ $bIsFirst = true;
301
+ $oNextLevel = $oOutputFormat;
302
+ if(!$this->isRootList()) {
303
+ $oNextLevel = $oOutputFormat->nextLevel();
304
+ }
305
+ foreach ($this->aContents as $oContent) {
306
+ $sRendered = $oOutputFormat->safely(function() use ($oNextLevel, $oContent) {
307
+ return $oContent->render($oNextLevel);
308
+ });
309
+ if($sRendered === null) {
310
+ continue;
311
+ }
312
+ if($bIsFirst) {
313
+ $bIsFirst = false;
314
+ $sResult .= $oNextLevel->spaceBeforeBlocks();
315
+ } else {
316
+ $sResult .= $oNextLevel->spaceBetweenBlocks();
317
+ }
318
+ $sResult .= $sRendered;
319
+ }
320
+
321
+ if(!$bIsFirst) {
322
+ // Had some output
323
+ $sResult .= $oOutputFormat->spaceAfterBlocks();
324
+ }
325
+
326
+ return $sResult;
327
+ }
328
+
329
+ /**
330
+ * Return true if the list can not be further outdented. Only important when rendering.
331
+ */
332
+ public abstract function isRootList();
333
+
334
+ public function getContents() {
335
+ return $this->aContents;
336
+ }
337
+
338
+ /**
339
+ * @param array $aComments Array of comments.
340
+ */
341
+ public function addComments(array $aComments) {
342
+ $this->aComments = array_merge($this->aComments, $aComments);
343
+ }
344
+
345
+ /**
346
+ * @return array
347
+ */
348
+ public function getComments() {
349
+ return $this->aComments;
350
+ }
351
+
352
+ /**
353
+ * @param array $aComments Array containing Comment objects.
354
+ */
355
+ public function setComments(array $aComments) {
356
+ $this->aComments = $aComments;
357
+ }
358
+
359
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/Document.php ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+
7
+ /**
8
+ * The root CSSList of a parsed file. Contains all top-level css contents, mostly declaration blocks, but also any @-rules encountered.
9
+ */
10
+ class Document extends CSSBlockList {
11
+ /**
12
+ * Document constructor.
13
+ * @param int $iLineNo
14
+ */
15
+ public function __construct($iLineNo = 0) {
16
+ parent::__construct($iLineNo);
17
+ }
18
+
19
+ public static function parse(ParserState $oParserState) {
20
+ $oDocument = new Document($oParserState->currentLine());
21
+ CSSList::parseList($oParserState, $oDocument);
22
+ return $oDocument;
23
+ }
24
+
25
+ /**
26
+ * Gets all DeclarationBlock objects recursively.
27
+ */
28
+ public function getAllDeclarationBlocks() {
29
+ $aResult = array();
30
+ $this->allDeclarationBlocks($aResult);
31
+ return $aResult;
32
+ }
33
+
34
+ /**
35
+ * @deprecated use getAllDeclarationBlocks()
36
+ */
37
+ public function getAllSelectors() {
38
+ return $this->getAllDeclarationBlocks();
39
+ }
40
+
41
+ /**
42
+ * Returns all RuleSet objects found recursively in the tree.
43
+ */
44
+ public function getAllRuleSets() {
45
+ $aResult = array();
46
+ $this->allRuleSets($aResult);
47
+ return $aResult;
48
+ }
49
+
50
+ /**
51
+ * Returns all Value objects found recursively in the tree.
52
+ * @param (object|string) $mElement the CSSList or RuleSet to start the search from (defaults to the whole document). If a string is given, it is used as rule name filter (@see{RuleSet->getRules()}).
53
+ * @param (bool) $bSearchInFunctionArguments whether to also return Value objects used as Function arguments.
54
+ */
55
+ public function getAllValues($mElement = null, $bSearchInFunctionArguments = false) {
56
+ $sSearchString = null;
57
+ if ($mElement === null) {
58
+ $mElement = $this;
59
+ } else if (is_string($mElement)) {
60
+ $sSearchString = $mElement;
61
+ $mElement = $this;
62
+ }
63
+ $aResult = array();
64
+ $this->allValues($mElement, $aResult, $sSearchString, $bSearchInFunctionArguments);
65
+ return $aResult;
66
+ }
67
+
68
+ /**
69
+ * Returns all Selector objects found recursively in the tree.
70
+ * Note that this does not yield the full DeclarationBlock that the selector belongs to (and, currently, there is no way to get to that).
71
+ * @param $sSpecificitySearch An optional filter by specificity. May contain a comparison operator and a number or just a number (defaults to "==").
72
+ * @example getSelectorsBySpecificity('>= 100')
73
+ */
74
+ public function getSelectorsBySpecificity($sSpecificitySearch = null) {
75
+ if (is_numeric($sSpecificitySearch) || is_numeric($sSpecificitySearch[0])) {
76
+ $sSpecificitySearch = "== $sSpecificitySearch";
77
+ }
78
+ $aResult = array();
79
+ $this->allSelectors($aResult, $sSpecificitySearch);
80
+ return $aResult;
81
+ }
82
+
83
+ /**
84
+ * Expands all shorthand properties to their long value
85
+ */
86
+ public function expandShorthands() {
87
+ foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
88
+ $oDeclaration->expandShorthands();
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Create shorthands properties whenever possible
94
+ */
95
+ public function createShorthands() {
96
+ foreach ($this->getAllDeclarationBlocks() as $oDeclaration) {
97
+ $oDeclaration->createShorthands();
98
+ }
99
+ }
100
+
101
+ // Override render() to make format argument optional
102
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat = null) {
103
+ if($oOutputFormat === null) {
104
+ $oOutputFormat = new \Sabberworm\CSS\OutputFormat();
105
+ }
106
+ return parent::render($oOutputFormat);
107
+ }
108
+
109
+ public function isRootList() {
110
+ return true;
111
+ }
112
+
113
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/KeyFrame.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\Property\AtRule;
6
+
7
+ class KeyFrame extends CSSList implements AtRule {
8
+
9
+ private $vendorKeyFrame;
10
+ private $animationName;
11
+
12
+ public function __construct($iLineNo = 0) {
13
+ parent::__construct($iLineNo);
14
+ $this->vendorKeyFrame = null;
15
+ $this->animationName = null;
16
+ }
17
+
18
+ public function setVendorKeyFrame($vendorKeyFrame) {
19
+ $this->vendorKeyFrame = $vendorKeyFrame;
20
+ }
21
+
22
+ public function getVendorKeyFrame() {
23
+ return $this->vendorKeyFrame;
24
+ }
25
+
26
+ public function setAnimationName($animationName) {
27
+ $this->animationName = $animationName;
28
+ }
29
+
30
+ public function getAnimationName() {
31
+ return $this->animationName;
32
+ }
33
+
34
+ public function __toString() {
35
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
36
+ }
37
+
38
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
39
+ $sResult = "@{$this->vendorKeyFrame} {$this->animationName}{$oOutputFormat->spaceBeforeOpeningBrace()}{";
40
+ $sResult .= parent::render($oOutputFormat);
41
+ $sResult .= '}';
42
+ return $sResult;
43
+ }
44
+
45
+ public function isRootList() {
46
+ return false;
47
+ }
48
+
49
+ public function atRuleName() {
50
+ return $this->vendorKeyFrame;
51
+ }
52
+
53
+ public function atRuleArgs() {
54
+ return $this->animationName;
55
+ }
56
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Comment/Comment.php ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Comment;
4
+
5
+ use Sabberworm\CSS\Renderable;
6
+
7
+ class Comment implements Renderable {
8
+ protected $iLineNo;
9
+ protected $sComment;
10
+
11
+ public function __construct($sComment = '', $iLineNo = 0) {
12
+ $this->sComment = $sComment;
13
+ $this->iLineNo = $iLineNo;
14
+ }
15
+
16
+ /**
17
+ * @return string
18
+ */
19
+ public function getComment() {
20
+ return $this->sComment;
21
+ }
22
+
23
+ /**
24
+ * @return int
25
+ */
26
+ public function getLineNo() {
27
+ return $this->iLineNo;
28
+ }
29
+
30
+ /**
31
+ * @return string
32
+ */
33
+ public function setComment($sComment) {
34
+ $this->sComment = $sComment;
35
+ }
36
+
37
+ /**
38
+ * @return string
39
+ */
40
+ public function __toString() {
41
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
42
+ }
43
+
44
+ /**
45
+ * @return string
46
+ */
47
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
48
+ return '/*' . $this->sComment . '*/';
49
+ }
50
+
51
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Comment/Commentable.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Comment;
4
+
5
+ interface Commentable {
6
+
7
+ /**
8
+ * @param array $aComments Array of comments.
9
+ */
10
+ public function addComments(array $aComments);
11
+
12
+ /**
13
+ * @return array
14
+ */
15
+ public function getComments();
16
+
17
+ /**
18
+ * @param array $aComments Array containing Comment objects.
19
+ */
20
+ public function setComments(array $aComments);
21
+
22
+
23
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/OutputFormat.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS;
4
+
5
+ use Sabberworm\CSS\Parsing\OutputException;
6
+
7
+ /**
8
+ * Class OutputFormat
9
+ *
10
+ * @method OutputFormat setSemicolonAfterLastRule( bool $bSemicolonAfterLastRule ) Set whether semicolons are added after last rule.
11
+ */
12
+ class OutputFormat {
13
+ /**
14
+ * Value format
15
+ */
16
+ // " means double-quote, ' means single-quote
17
+ public $sStringQuotingType = '"';
18
+ // Output RGB colors in hash notation if possible
19
+ public $bRGBHashNotation = true;
20
+
21
+ /**
22
+ * Declaration format
23
+ */
24
+ // Semicolon after the last rule of a declaration block can be omitted. To do that, set this false.
25
+ public $bSemicolonAfterLastRule = true;
26
+
27
+ /**
28
+ * Spacing
29
+ * Note that these strings are not sanity-checked: the value should only consist of whitespace
30
+ * Any newline character will be indented according to the current level.
31
+ * The triples (After, Before, Between) can be set using a wildcard (e.g. `$oFormat->set('Space*Rules', "\n");`)
32
+ */
33
+ public $sSpaceAfterRuleName = ' ';
34
+
35
+ public $sSpaceBeforeRules = '';
36
+ public $sSpaceAfterRules = '';
37
+ public $sSpaceBetweenRules = '';
38
+
39
+ public $sSpaceBeforeBlocks = '';
40
+ public $sSpaceAfterBlocks = '';
41
+ public $sSpaceBetweenBlocks = "\n";
42
+
43
+ // Content injected in and around @-rule blocks.
44
+ public $sBeforeAtRuleBlock = '';
45
+ public $sAfterAtRuleBlock = '';
46
+
47
+ // This is what’s printed before and after the comma if a declaration block contains multiple selectors.
48
+ public $sSpaceBeforeSelectorSeparator = '';
49
+ public $sSpaceAfterSelectorSeparator = ' ';
50
+ // This is what’s printed after the comma of value lists
51
+ public $sSpaceBeforeListArgumentSeparator = '';
52
+ public $sSpaceAfterListArgumentSeparator = '';
53
+
54
+ public $sSpaceBeforeOpeningBrace = ' ';
55
+
56
+ // Content injected in and around declaration blocks.
57
+ public $sBeforeDeclarationBlock = '';
58
+ public $sAfterDeclarationBlockSelectors = '';
59
+ public $sAfterDeclarationBlock = '';
60
+
61
+ /**
62
+ * Indentation
63
+ */
64
+ // Indentation character(s) per level. Only applicable if newlines are used in any of the spacing settings.
65
+ public $sIndentation = "\t";
66
+
67
+ /**
68
+ * Output exceptions.
69
+ */
70
+ public $bIgnoreExceptions = false;
71
+
72
+
73
+ private $oFormatter = null;
74
+ private $oNextLevelFormat = null;
75
+ private $iIndentationLevel = 0;
76
+
77
+ public function __construct() {
78
+ }
79
+
80
+ public function get($sName) {
81
+ $aVarPrefixes = array('a', 's', 'm', 'b', 'f', 'o', 'c', 'i');
82
+ foreach($aVarPrefixes as $sPrefix) {
83
+ $sFieldName = $sPrefix.ucfirst($sName);
84
+ if(isset($this->$sFieldName)) {
85
+ return $this->$sFieldName;
86
+ }
87
+ }
88
+ return null;
89
+ }
90
+
91
+ public function set($aNames, $mValue) {
92
+ $aVarPrefixes = array('a', 's', 'm', 'b', 'f', 'o', 'c', 'i');
93
+ if(is_string($aNames) && strpos($aNames, '*') !== false) {
94
+ $aNames = array(str_replace('*', 'Before', $aNames), str_replace('*', 'Between', $aNames), str_replace('*', 'After', $aNames));
95
+ } else if(!is_array($aNames)) {
96
+ $aNames = array($aNames);
97
+ }
98
+ foreach($aVarPrefixes as $sPrefix) {
99
+ $bDidReplace = false;
100
+ foreach($aNames as $sName) {
101
+ $sFieldName = $sPrefix.ucfirst($sName);
102
+ if(isset($this->$sFieldName)) {
103
+ $this->$sFieldName = $mValue;
104
+ $bDidReplace = true;
105
+ }
106
+ }
107
+ if($bDidReplace) {
108
+ return $this;
109
+ }
110
+ }
111
+ // Break the chain so the user knows this option is invalid
112
+ return false;
113
+ }
114
+
115
+ public function __call($sMethodName, $aArguments) {
116
+ if(strpos($sMethodName, 'set') === 0) {
117
+ return $this->set(substr($sMethodName, 3), $aArguments[0]);
118
+ } else if(strpos($sMethodName, 'get') === 0) {
119
+ return $this->get(substr($sMethodName, 3));
120
+ } else if(method_exists('\\Sabberworm\\CSS\\OutputFormatter', $sMethodName)) {
121
+ return call_user_func_array(array($this->getFormatter(), $sMethodName), $aArguments);
122
+ } else {
123
+ throw new \Exception('Unknown OutputFormat method called: '.$sMethodName);
124
+ }
125
+ }
126
+
127
+ public function indentWithTabs($iNumber = 1) {
128
+ return $this->setIndentation(str_repeat("\t", $iNumber));
129
+ }
130
+
131
+ public function indentWithSpaces($iNumber = 2) {
132
+ return $this->setIndentation(str_repeat(" ", $iNumber));
133
+ }
134
+
135
+ public function nextLevel() {
136
+ if($this->oNextLevelFormat === null) {
137
+ $this->oNextLevelFormat = clone $this;
138
+ $this->oNextLevelFormat->iIndentationLevel++;
139
+ $this->oNextLevelFormat->oFormatter = null;
140
+ }
141
+ return $this->oNextLevelFormat;
142
+ }
143
+
144
+ public function beLenient() {
145
+ $this->bIgnoreExceptions = true;
146
+ }
147
+
148
+ public function getFormatter() {
149
+ if($this->oFormatter === null) {
150
+ $this->oFormatter = new OutputFormatter($this);
151
+ }
152
+ return $this->oFormatter;
153
+ }
154
+
155
+ public function level() {
156
+ return $this->iIndentationLevel;
157
+ }
158
+
159
+ /**
160
+ * Create format.
161
+ *
162
+ * @return OutputFormat Format.
163
+ */
164
+ public static function create() {
165
+ return new OutputFormat();
166
+ }
167
+
168
+ /**
169
+ * Create compact format.
170
+ *
171
+ * @return OutputFormat Format.
172
+ */
173
+ public static function createCompact() {
174
+ $format = self::create();
175
+ $format->set('Space*Rules', "")->set('Space*Blocks', "")->setSpaceAfterRuleName('')->setSpaceBeforeOpeningBrace('')->setSpaceAfterSelectorSeparator('');
176
+ return $format;
177
+ }
178
+
179
+ /**
180
+ * Create pretty format.
181
+ *
182
+ * @return OutputFormat Format.
183
+ */
184
+ public static function createPretty() {
185
+ $format = self::create();
186
+ $format->set('Space*Rules', "\n")->set('Space*Blocks', "\n")->setSpaceBetweenBlocks("\n\n")->set('SpaceAfterListArgumentSeparator', array('default' => '', ',' => ' '));
187
+ return $format;
188
+ }
189
+ }
190
+
191
+ class OutputFormatter {
192
+ private $oFormat;
193
+
194
+ public function __construct(OutputFormat $oFormat) {
195
+ $this->oFormat = $oFormat;
196
+ }
197
+
198
+ public function space($sName, $sType = null) {
199
+ $sSpaceString = $this->oFormat->get("Space$sName");
200
+ // If $sSpaceString is an array, we have multple values configured depending on the type of object the space applies to
201
+ if(is_array($sSpaceString)) {
202
+ if($sType !== null && isset($sSpaceString[$sType])) {
203
+ $sSpaceString = $sSpaceString[$sType];
204
+ } else {
205
+ $sSpaceString = reset($sSpaceString);
206
+ }
207
+ }
208
+ return $this->prepareSpace($sSpaceString);
209
+ }
210
+
211
+ public function spaceAfterRuleName() {
212
+ return $this->space('AfterRuleName');
213
+ }
214
+
215
+ public function spaceBeforeRules() {
216
+ return $this->space('BeforeRules');
217
+ }
218
+
219
+ public function spaceAfterRules() {
220
+ return $this->space('AfterRules');
221
+ }
222
+
223
+ public function spaceBetweenRules() {
224
+ return $this->space('BetweenRules');
225
+ }
226
+
227
+ public function spaceBeforeBlocks() {
228
+ return $this->space('BeforeBlocks');
229
+ }
230
+
231
+ public function spaceAfterBlocks() {
232
+ return $this->space('AfterBlocks');
233
+ }
234
+
235
+ public function spaceBetweenBlocks() {
236
+ return $this->space('BetweenBlocks');
237
+ }
238
+
239
+ public function spaceBeforeSelectorSeparator() {
240
+ return $this->space('BeforeSelectorSeparator');
241
+ }
242
+
243
+ public function spaceAfterSelectorSeparator() {
244
+ return $this->space('AfterSelectorSeparator');
245
+ }
246
+
247
+ public function spaceBeforeListArgumentSeparator($sSeparator) {
248
+ return $this->space('BeforeListArgumentSeparator', $sSeparator);
249
+ }
250
+
251
+ public function spaceAfterListArgumentSeparator($sSeparator) {
252
+ return $this->space('AfterListArgumentSeparator', $sSeparator);
253
+ }
254
+
255
+ public function spaceBeforeOpeningBrace() {
256
+ return $this->space('BeforeOpeningBrace');
257
+ }
258
+
259
+ /**
260
+ * Runs the given code, either swallowing or passing exceptions, depending on the bIgnoreExceptions setting.
261
+ */
262
+ public function safely($cCode) {
263
+ if($this->oFormat->get('IgnoreExceptions')) {
264
+ // If output exceptions are ignored, run the code with exception guards
265
+ try {
266
+ return $cCode();
267
+ } catch (OutputException $e) {
268
+ return null;
269
+ } //Do nothing
270
+ } else {
271
+ // Run the code as-is
272
+ return $cCode();
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Clone of the implode function but calls ->render with the current output format instead of __toString()
278
+ */
279
+ public function implode($sSeparator, $aValues, $bIncreaseLevel = false) {
280
+ $sResult = '';
281
+ $oFormat = $this->oFormat;
282
+ if($bIncreaseLevel) {
283
+ $oFormat = $oFormat->nextLevel();
284
+ }
285
+ $bIsFirst = true;
286
+ foreach($aValues as $mValue) {
287
+ if($bIsFirst) {
288
+ $bIsFirst = false;
289
+ } else {
290
+ $sResult .= $sSeparator;
291
+ }
292
+ if($mValue instanceof \Sabberworm\CSS\Renderable) {
293
+ $sResult .= $mValue->render($oFormat);
294
+ } else {
295
+ $sResult .= $mValue;
296
+ }
297
+ }
298
+ return $sResult;
299
+ }
300
+
301
+ public function removeLastSemicolon($sString) {
302
+ if($this->oFormat->get('SemicolonAfterLastRule')) {
303
+ return $sString;
304
+ }
305
+ $sString = explode(';', $sString);
306
+ if(count($sString) < 2) {
307
+ return $sString[0];
308
+ }
309
+ $sLast = array_pop($sString);
310
+ $sNextToLast = array_pop($sString);
311
+ array_push($sString, $sNextToLast.$sLast);
312
+ return implode(';', $sString);
313
+ }
314
+
315
+ private function prepareSpace($sSpaceString) {
316
+ return str_replace("\n", "\n".$this->indent(), $sSpaceString);
317
+ }
318
+
319
+ private function indent() {
320
+ return str_repeat($this->oFormat->sIndentation, $this->oFormat->level());
321
+ }
322
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parser.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS;
4
+
5
+ use Sabberworm\CSS\CSSList\Document;
6
+ use Sabberworm\CSS\Parsing\ParserState;
7
+
8
+ /**
9
+ * Parser class parses CSS from text into a data structure.
10
+ */
11
+ class Parser {
12
+ private $oParserState;
13
+
14
+ /**
15
+ * Parser constructor.
16
+ * Note that that iLineNo starts from 1 and not 0
17
+ *
18
+ * @param $sText
19
+ * @param Settings|null $oParserSettings
20
+ * @param int $iLineNo
21
+ */
22
+ public function __construct($sText, Settings $oParserSettings = null, $iLineNo = 1) {
23
+ if ($oParserSettings === null) {
24
+ $oParserSettings = Settings::create();
25
+ }
26
+ $this->oParserState = new ParserState($sText, $oParserSettings, $iLineNo);
27
+ }
28
+
29
+ public function setCharset($sCharset) {
30
+ $this->oParserState->setCharset($sCharset);
31
+ }
32
+
33
+ public function getCharset() {
34
+ $this->oParserState->getCharset();
35
+ }
36
+
37
+ public function parse() {
38
+ return Document::parse($this->oParserState);
39
+ }
40
+
41
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/OutputException.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Parsing;
4
+
5
+ /**
6
+ * Thrown if the CSS parsers attempts to print something invalid
7
+ */
8
+ class OutputException extends SourceException {
9
+ public function __construct($sMessage, $iLineNo = 0) {
10
+ parent::__construct($sMessage, $iLineNo);
11
+ }
12
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/ParserState.php ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Sabberworm\CSS\Parsing;
3
+
4
+ use Sabberworm\CSS\Comment\Comment;
5
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
6
+ use Sabberworm\CSS\Settings;
7
+
8
+ class ParserState {
9
+ private $oParserSettings;
10
+
11
+ private $sText;
12
+
13
+ private $aText;
14
+ private $iCurrentPosition;
15
+ private $sCharset;
16
+ private $iLength;
17
+ private $iLineNo;
18
+
19
+ public function __construct($sText, Settings $oParserSettings, $iLineNo = 1) {
20
+ $this->oParserSettings = $oParserSettings;
21
+ $this->sText = $sText;
22
+ $this->iCurrentPosition = 0;
23
+ $this->iLineNo = $iLineNo;
24
+ $this->setCharset($this->oParserSettings->sDefaultCharset);
25
+ }
26
+
27
+ public function setCharset($sCharset) {
28
+ $this->sCharset = $sCharset;
29
+ $this->aText = $this->strsplit($this->sText);
30
+ $this->iLength = count($this->aText);
31
+ }
32
+
33
+ public function getCharset() {
34
+ $this->oParserHelper->getCharset();
35
+ return $this->sCharset;
36
+ }
37
+
38
+ public function currentLine() {
39
+ return $this->iLineNo;
40
+ }
41
+
42
+ public function getSettings() {
43
+ return $this->oParserSettings;
44
+ }
45
+
46
+ public function parseIdentifier($bIgnoreCase = true) {
47
+ $sResult = $this->parseCharacter(true);
48
+ if ($sResult === null) {
49
+ throw new UnexpectedTokenException($sResult, $this->peek(5), 'identifier', $this->iLineNo);
50
+ }
51
+ $sCharacter = null;
52
+ while (($sCharacter = $this->parseCharacter(true)) !== null) {
53
+ $sResult .= $sCharacter;
54
+ }
55
+ if ($bIgnoreCase) {
56
+ $sResult = $this->strtolower($sResult);
57
+ }
58
+ return $sResult;
59
+ }
60
+
61
+ public function parseCharacter($bIsForIdentifier) {
62
+ if ($this->peek() === '\\') {
63
+ if ($bIsForIdentifier && $this->oParserSettings->bLenientParsing && ($this->comes('\0') || $this->comes('\9'))) {
64
+ // Non-strings can contain \0 or \9 which is an IE hack supported in lenient parsing.
65
+ return null;
66
+ }
67
+ $this->consume('\\');
68
+ if ($this->comes('\n') || $this->comes('\r')) {
69
+ return '';
70
+ }
71
+ if (preg_match('/[0-9a-fA-F]/Su', $this->peek()) === 0) {
72
+ return $this->consume(1);
73
+ }
74
+ $sUnicode = $this->consumeExpression('/^[0-9a-fA-F]{1,6}/u', 6);
75
+ if ($this->strlen($sUnicode) < 6) {
76
+ //Consume whitespace after incomplete unicode escape
77
+ if (preg_match('/\\s/isSu', $this->peek())) {
78
+ if ($this->comes('\r\n')) {
79
+ $this->consume(2);
80
+ } else {
81
+ $this->consume(1);
82
+ }
83
+ }
84
+ }
85
+ $iUnicode = intval($sUnicode, 16);
86
+ $sUtf32 = "";
87
+ for ($i = 0; $i < 4; ++$i) {
88
+ $sUtf32 .= chr($iUnicode & 0xff);
89
+ $iUnicode = $iUnicode >> 8;
90
+ }
91
+ return iconv('utf-32le', $this->sCharset, $sUtf32);
92
+ }
93
+ if ($bIsForIdentifier) {
94
+ $peek = ord($this->peek());
95
+ // Ranges: a-z A-Z 0-9 - _
96
+ if (($peek >= 97 && $peek <= 122) ||
97
+ ($peek >= 65 && $peek <= 90) ||
98
+ ($peek >= 48 && $peek <= 57) ||
99
+ ($peek === 45) ||
100
+ ($peek === 95) ||
101
+ ($peek > 0xa1)) {
102
+ return $this->consume(1);
103
+ }
104
+ } else {
105
+ return $this->consume(1);
106
+ }
107
+ return null;
108
+ }
109
+
110
+ public function consumeWhiteSpace() {
111
+ $comments = array();
112
+ do {
113
+ while (preg_match('/\\s/isSu', $this->peek()) === 1) {
114
+ $this->consume(1);
115
+ }
116
+ if($this->oParserSettings->bLenientParsing) {
117
+ try {
118
+ $oComment = $this->consumeComment();
119
+ } catch(UnexpectedTokenException $e) {
120
+ // When we can’t find the end of a comment, we assume the document is finished.
121
+ $this->iCurrentPosition = $this->iLength;
122
+ return;
123
+ }
124
+ } else {
125
+ $oComment = $this->consumeComment();
126
+ }
127
+ if ($oComment !== false) {
128
+ $comments[] = $oComment;
129
+ }
130
+ } while($oComment !== false);
131
+ return $comments;
132
+ }
133
+
134
+ public function comes($sString, $bCaseInsensitive = false) {
135
+ $sPeek = $this->peek(strlen($sString));
136
+ return ($sPeek == '')
137
+ ? false
138
+ : $this->streql($sPeek, $sString, $bCaseInsensitive);
139
+ }
140
+
141
+ public function peek($iLength = 1, $iOffset = 0) {
142
+ $iOffset += $this->iCurrentPosition;
143
+ if ($iOffset >= $this->iLength) {
144
+ return '';
145
+ }
146
+ return $this->substr($iOffset, $iLength);
147
+ }
148
+
149
+ public function consume($mValue = 1) {
150
+ if (is_string($mValue)) {
151
+ $iLineCount = substr_count($mValue, "\n");
152
+ $iLength = $this->strlen($mValue);
153
+ if (!$this->streql($this->substr($this->iCurrentPosition, $iLength), $mValue)) {
154
+ throw new UnexpectedTokenException($mValue, $this->peek(max($iLength, 5)), $this->iLineNo);
155
+ }
156
+ $this->iLineNo += $iLineCount;
157
+ $this->iCurrentPosition += $this->strlen($mValue);
158
+ return $mValue;
159
+ } else {
160
+ if ($this->iCurrentPosition + $mValue > $this->iLength) {
161
+ throw new UnexpectedTokenException($mValue, $this->peek(5), 'count', $this->iLineNo);
162
+ }
163
+ $sResult = $this->substr($this->iCurrentPosition, $mValue);
164
+ $iLineCount = substr_count($sResult, "\n");
165
+ $this->iLineNo += $iLineCount;
166
+ $this->iCurrentPosition += $mValue;
167
+ return $sResult;
168
+ }
169
+ }
170
+
171
+ public function consumeExpression($mExpression, $iMaxLength = null) {
172
+ $aMatches = null;
173
+ $sInput = $iMaxLength !== null ? $this->peek($iMaxLength) : $this->inputLeft();
174
+ if (preg_match($mExpression, $sInput, $aMatches, PREG_OFFSET_CAPTURE) === 1) {
175
+ return $this->consume($aMatches[0][0]);
176
+ }
177
+ throw new UnexpectedTokenException($mExpression, $this->peek(5), 'expression', $this->iLineNo);
178
+ }
179
+
180
+ /**
181
+ * @return false|Comment
182
+ */
183
+ public function consumeComment() {
184
+ $mComment = false;
185
+ if ($this->comes('/*')) {
186
+ $iLineNo = $this->iLineNo;
187
+ $this->consume(1);
188
+ $mComment = '';
189
+ while (($char = $this->consume(1)) !== '') {
190
+ $mComment .= $char;
191
+ if ($this->comes('*/')) {
192
+ $this->consume(2);
193
+ break;
194
+ }
195
+ }
196
+ }
197
+
198
+ if ($mComment !== false) {
199
+ // We skip the * which was included in the comment.
200
+ return new Comment(substr($mComment, 1), $iLineNo);
201
+ }
202
+
203
+ return $mComment;
204
+ }
205
+
206
+ public function isEnd() {
207
+ return $this->iCurrentPosition >= $this->iLength;
208
+ }
209
+
210
+ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, array &$comments = array()) {
211
+ $aEnd = is_array($aEnd) ? $aEnd : array($aEnd);
212
+ $out = '';
213
+ $start = $this->iCurrentPosition;
214
+
215
+ while (($char = $this->consume(1)) !== '') {
216
+ if (in_array($char, $aEnd)) {
217
+ if ($bIncludeEnd) {
218
+ $out .= $char;
219
+ } elseif (!$consumeEnd) {
220
+ $this->iCurrentPosition -= $this->strlen($char);
221
+ }
222
+ return $out;
223
+ }
224
+ $out .= $char;
225
+ if ($comment = $this->consumeComment()) {
226
+ $comments[] = $comment;
227
+ }
228
+ }
229
+
230
+ $this->iCurrentPosition = $start;
231
+ throw new UnexpectedTokenException('One of ("'.implode('","', $aEnd).'")', $this->peek(5), 'search', $this->iLineNo);
232
+ }
233
+
234
+ private function inputLeft() {
235
+ return $this->substr($this->iCurrentPosition, -1);
236
+ }
237
+
238
+ public function streql($sString1, $sString2, $bCaseInsensitive = true) {
239
+ if($bCaseInsensitive) {
240
+ return $this->strtolower($sString1) === $this->strtolower($sString2);
241
+ } else {
242
+ return $sString1 === $sString2;
243
+ }
244
+ }
245
+
246
+ public function backtrack($iAmount) {
247
+ $this->iCurrentPosition -= $iAmount;
248
+ }
249
+
250
+ public function strlen($sString) {
251
+ if ($this->oParserSettings->bMultibyteSupport) {
252
+ return mb_strlen($sString, $this->sCharset);
253
+ } else {
254
+ return strlen($sString);
255
+ }
256
+ }
257
+
258
+ private function substr($iStart, $iLength) {
259
+ if ($iLength < 0) {
260
+ $iLength = $this->iLength - $iStart + $iLength;
261
+ }
262
+ if ($iStart + $iLength > $this->iLength) {
263
+ $iLength = $this->iLength - $iStart;
264
+ }
265
+ $sResult = '';
266
+ while ($iLength > 0) {
267
+ $sResult .= $this->aText[$iStart];
268
+ $iStart++;
269
+ $iLength--;
270
+ }
271
+ return $sResult;
272
+ }
273
+
274
+ private function strtolower($sString) {
275
+ if ($this->oParserSettings->bMultibyteSupport) {
276
+ return mb_strtolower($sString, $this->sCharset);
277
+ } else {
278
+ return strtolower($sString);
279
+ }
280
+ }
281
+
282
+ private function strsplit($sString) {
283
+ if ($this->oParserSettings->bMultibyteSupport) {
284
+ if ($this->streql($this->sCharset, 'utf-8')) {
285
+ return preg_split('//u', $sString, null, PREG_SPLIT_NO_EMPTY);
286
+ } else {
287
+ $iLength = mb_strlen($sString, $this->sCharset);
288
+ $aResult = array();
289
+ for ($i = 0; $i < $iLength; ++$i) {
290
+ $aResult[] = mb_substr($sString, $i, 1, $this->sCharset);
291
+ }
292
+ return $aResult;
293
+ }
294
+ } else {
295
+ if($sString === '') {
296
+ return array();
297
+ } else {
298
+ return str_split($sString);
299
+ }
300
+ }
301
+ }
302
+
303
+ private function strpos($sString, $sNeedle, $iOffset) {
304
+ if ($this->oParserSettings->bMultibyteSupport) {
305
+ return mb_strpos($sString, $sNeedle, $iOffset, $this->sCharset);
306
+ } else {
307
+ return strpos($sString, $sNeedle, $iOffset);
308
+ }
309
+ }
310
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/SourceException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Parsing;
4
+
5
+ class SourceException extends \Exception {
6
+ private $iLineNo;
7
+ public function __construct($sMessage, $iLineNo = 0) {
8
+ $this->iLineNo = $iLineNo;
9
+ if (!empty($iLineNo)) {
10
+ $sMessage .= " [line no: $iLineNo]";
11
+ }
12
+ parent::__construct($sMessage);
13
+ }
14
+
15
+ public function getLineNo() {
16
+ return $this->iLineNo;
17
+ }
18
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/UnexpectedTokenException.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Parsing;
4
+
5
+ /**
6
+ * Thrown if the CSS parsers encounters a token it did not expect
7
+ */
8
+ class UnexpectedTokenException extends SourceException {
9
+ private $sExpected;
10
+ private $sFound;
11
+ // Possible values: literal, identifier, count, expression, search
12
+ private $sMatchType;
13
+
14
+ public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0) {
15
+ $this->sExpected = $sExpected;
16
+ $this->sFound = $sFound;
17
+ $this->sMatchType = $sMatchType;
18
+ $sMessage = "Token “{$sExpected}” ({$sMatchType}) not found. Got “{$sFound}”.";
19
+ if($this->sMatchType === 'search') {
20
+ $sMessage = "Search for “{$sExpected}” returned no results. Context: “{$sFound}”.";
21
+ } else if($this->sMatchType === 'count') {
22
+ $sMessage = "Next token was expected to have {$sExpected} chars. Context: “{$sFound}”.";
23
+ } else if($this->sMatchType === 'identifier') {
24
+ $sMessage = "Identifier expected. Got “{$sFound}”";
25
+ } else if($this->sMatchType === 'custom') {
26
+ $sMessage = trim("$sExpected $sFound");
27
+ }
28
+
29
+ parent::__construct($sMessage, $iLineNo);
30
+ }
31
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/AtRule.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Property;
4
+
5
+ use Sabberworm\CSS\Renderable;
6
+ use Sabberworm\CSS\Comment\Commentable;
7
+
8
+ interface AtRule extends Renderable, Commentable {
9
+ // Since there are more set rules than block rules, we’re whitelisting the block rules and have anything else be treated as a set rule.
10
+ const BLOCK_RULES = 'media/document/supports/region-style/font-feature-values';
11
+ // …and more font-specific ones (to be used inside font-feature-values)
12
+ const SET_RULES = 'font-face/counter-style/page/swash/styleset/annotation';
13
+
14
+ public function atRuleName();
15
+ public function atRuleArgs();
16
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/CSSNamespace.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Property;
4
+
5
+ /**
6
+ * CSSNamespace represents an @namespace rule.
7
+ */
8
+ class CSSNamespace implements AtRule {
9
+ private $mUrl;
10
+ private $sPrefix;
11
+ private $iLineNo;
12
+ protected $aComments;
13
+
14
+ public function __construct($mUrl, $sPrefix = null, $iLineNo = 0) {
15
+ $this->mUrl = $mUrl;
16
+ $this->sPrefix = $sPrefix;
17
+ $this->iLineNo = $iLineNo;
18
+ $this->aComments = array();
19
+ }
20
+
21
+ /**
22
+ * @return int
23
+ */
24
+ public function getLineNo() {
25
+ return $this->iLineNo;
26
+ }
27
+
28
+ public function __toString() {
29
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
30
+ }
31
+
32
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
33
+ return '@namespace '.($this->sPrefix === null ? '' : $this->sPrefix.' ').$this->mUrl->render($oOutputFormat).';';
34
+ }
35
+
36
+ public function getUrl() {
37
+ return $this->mUrl;
38
+ }
39
+
40
+ public function getPrefix() {
41
+ return $this->sPrefix;
42
+ }
43
+
44
+ public function setUrl($mUrl) {
45
+ $this->mUrl = $mUrl;
46
+ }
47
+
48
+ public function setPrefix($sPrefix) {
49
+ $this->sPrefix = $sPrefix;
50
+ }
51
+
52
+ public function atRuleName() {
53
+ return 'namespace';
54
+ }
55
+
56
+ public function atRuleArgs() {
57
+ $aResult = array($this->mUrl);
58
+ if($this->sPrefix) {
59
+ array_unshift($aResult, $this->sPrefix);
60
+ }
61
+ return $aResult;
62
+ }
63
+
64
+ public function addComments(array $aComments) {
65
+ $this->aComments = array_merge($this->aComments, $aComments);
66
+ }
67
+
68
+ public function getComments() {
69
+ return $this->aComments;
70
+ }
71
+
72
+ public function setComments(array $aComments) {
73
+ $this->aComments = $aComments;
74
+ }
75
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Charset.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Property;
4
+
5
+ /**
6
+ * Class representing an @charset rule.
7
+ * The following restrictions apply:
8
+ * • May not be found in any CSSList other than the Document.
9
+ * • May only appear at the very top of a Document’s contents.
10
+ * • Must not appear more than once.
11
+ */
12
+ class Charset implements AtRule {
13
+
14
+ private $sCharset;
15
+ protected $iLineNo;
16
+ protected $aComment;
17
+
18
+ public function __construct($sCharset, $iLineNo = 0) {
19
+ $this->sCharset = $sCharset;
20
+ $this->iLineNo = $iLineNo;
21
+ $this->aComments = array();
22
+ }
23
+
24
+ /**
25
+ * @return int
26
+ */
27
+ public function getLineNo() {
28
+ return $this->iLineNo;
29
+ }
30
+
31
+ public function setCharset($sCharset) {
32
+ $this->sCharset = $sCharset;
33
+ }
34
+
35
+ public function getCharset() {
36
+ return $this->sCharset;
37
+ }
38
+
39
+ public function __toString() {
40
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
41
+ }
42
+
43
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
44
+ return "@charset {$this->sCharset->render($oOutputFormat)};";
45
+ }
46
+
47
+ public function atRuleName() {
48
+ return 'charset';
49
+ }
50
+
51
+ public function atRuleArgs() {
52
+ return $this->sCharset;
53
+ }
54
+
55
+ public function addComments(array $aComments) {
56
+ $this->aComments = array_merge($this->aComments, $aComments);
57
+ }
58
+
59
+ public function getComments() {
60
+ return $this->aComments;
61
+ }
62
+
63
+ public function setComments(array $aComments) {
64
+ $this->aComments = $aComments;
65
+ }
66
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Import.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Property;
4
+
5
+ use Sabberworm\CSS\Value\URL;
6
+
7
+ /**
8
+ * Class representing an @import rule.
9
+ */
10
+ class Import implements AtRule {
11
+ private $oLocation;
12
+ private $sMediaQuery;
13
+ protected $iLineNo;
14
+ protected $aComments;
15
+
16
+ public function __construct(URL $oLocation, $sMediaQuery, $iLineNo = 0) {
17
+ $this->oLocation = $oLocation;
18
+ $this->sMediaQuery = $sMediaQuery;
19
+ $this->iLineNo = $iLineNo;
20
+ $this->aComments = array();
21
+ }
22
+
23
+ /**
24
+ * @return int
25
+ */
26
+ public function getLineNo() {
27
+ return $this->iLineNo;
28
+ }
29
+
30
+ public function setLocation($oLocation) {
31
+ $this->oLocation = $oLocation;
32
+ }
33
+
34
+ public function getLocation() {
35
+ return $this->oLocation;
36
+ }
37
+
38
+ public function __toString() {
39
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
40
+ }
41
+
42
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
43
+ return "@import ".$this->oLocation->render($oOutputFormat).($this->sMediaQuery === null ? '' : ' '.$this->sMediaQuery).';';
44
+ }
45
+
46
+ public function atRuleName() {
47
+ return 'import';
48
+ }
49
+
50
+ public function atRuleArgs() {
51
+ $aResult = array($this->oLocation);
52
+ if($this->sMediaQuery) {
53
+ array_push($aResult, $this->sMediaQuery);
54
+ }
55
+ return $aResult;
56
+ }
57
+
58
+ public function addComments(array $aComments) {
59
+ $this->aComments = array_merge($this->aComments, $aComments);
60
+ }
61
+
62
+ public function getComments() {
63
+ return $this->aComments;
64
+ }
65
+
66
+ public function setComments(array $aComments) {
67
+ $this->aComments = $aComments;
68
+ }
69
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Selector.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Property;
4
+
5
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
6
+
7
+ /**
8
+ * Class representing a single CSS selector. Selectors have to be split by the comma prior to being passed into this class.
9
+ */
10
+ class Selector {
11
+
12
+ //Regexes for specificity calculations
13
+ const NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX = '/
14
+ (\.[\w]+) # classes
15
+ |
16
+ \[(\w+) # attributes
17
+ |
18
+ (\:( # pseudo classes
19
+ link|visited|active
20
+ |hover|focus
21
+ |lang
22
+ |target
23
+ |enabled|disabled|checked|indeterminate
24
+ |root
25
+ |nth-child|nth-last-child|nth-of-type|nth-last-of-type
26
+ |first-child|last-child|first-of-type|last-of-type
27
+ |only-child|only-of-type
28
+ |empty|contains
29
+ ))
30
+ /ix';
31
+
32
+ const ELEMENTS_AND_PSEUDO_ELEMENTS_RX = '/
33
+ ((^|[\s\+\>\~]+)[\w]+ # elements
34
+ |
35
+ \:{1,2}( # pseudo-elements
36
+ after|before|first-letter|first-line|selection
37
+ ))
38
+ /ix';
39
+
40
+ const SELECTOR_VALIDATION_RX = '/
41
+ ^(
42
+ (?:
43
+ [a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters
44
+ (?:\\\\.)? # a single escaped character
45
+ (?:([\'"]).*?(?<!\\\\)\2)? # a quoted text like [id="example"]
46
+ )*
47
+ )$
48
+ /ux';
49
+
50
+ private $sSelector;
51
+ private $iSpecificity;
52
+
53
+ public static function isValid($sSelector) {
54
+ return preg_match(self::SELECTOR_VALIDATION_RX, $sSelector);
55
+ }
56
+
57
+ public function __construct($sSelector, $bCalculateSpecificity = false) {
58
+ $this->setSelector($sSelector);
59
+ if ($bCalculateSpecificity) {
60
+ $this->getSpecificity();
61
+ }
62
+ }
63
+
64
+ public function getSelector() {
65
+ return $this->sSelector;
66
+ }
67
+
68
+ public function setSelector($sSelector) {
69
+ $this->sSelector = trim($sSelector);
70
+ $this->iSpecificity = null;
71
+ }
72
+
73
+ public function __toString() {
74
+ return $this->getSelector();
75
+ }
76
+
77
+ public function getSpecificity() {
78
+ if ($this->iSpecificity === null) {
79
+ $a = 0;
80
+ /// @todo should exclude \# as well as "#"
81
+ $aMatches = null;
82
+ $b = substr_count($this->sSelector, '#');
83
+ $c = preg_match_all(self::NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_RX, $this->sSelector, $aMatches);
84
+ $d = preg_match_all(self::ELEMENTS_AND_PSEUDO_ELEMENTS_RX, $this->sSelector, $aMatches);
85
+ $this->iSpecificity = ($a * 1000) + ($b * 100) + ($c * 10) + $d;
86
+ }
87
+ return $this->iSpecificity;
88
+ }
89
+
90
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Renderable.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS;
4
+
5
+ interface Renderable {
6
+ public function __toString();
7
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat);
8
+ public function getLineNo();
9
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Rule/Rule.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Rule;
4
+
5
+ use Sabberworm\CSS\Comment\Commentable;
6
+ use Sabberworm\CSS\Parsing\ParserState;
7
+ use Sabberworm\CSS\Renderable;
8
+ use Sabberworm\CSS\Value\RuleValueList;
9
+ use Sabberworm\CSS\Value\Value;
10
+
11
+ /**
12
+ * RuleSets contains Rule objects which always have a key and a value.
13
+ * In CSS, Rules are expressed as follows: “key: value[0][0] value[0][1], value[1][0] value[1][1];”
14
+ */
15
+ class Rule implements Renderable, Commentable {
16
+
17
+ private $sRule;
18
+ private $mValue;
19
+ private $bIsImportant;
20
+ private $aIeHack;
21
+ protected $iLineNo;
22
+ protected $aComments;
23
+
24
+ public function __construct($sRule, $iLineNo = 0) {
25
+ $this->sRule = $sRule;
26
+ $this->mValue = null;
27
+ $this->bIsImportant = false;
28
+ $this->aIeHack = array();
29
+ $this->iLineNo = $iLineNo;
30
+ $this->aComments = array();
31
+ }
32
+
33
+ public static function parse(ParserState $oParserState) {
34
+ $aComments = $oParserState->consumeWhiteSpace();
35
+ $oRule = new Rule($oParserState->parseIdentifier(), $oParserState->currentLine());
36
+ $oRule->setComments($aComments);
37
+ $oRule->addComments($oParserState->consumeWhiteSpace());
38
+ $oParserState->consume(':');
39
+ $oValue = Value::parseValue($oParserState, self::listDelimiterForRule($oRule->getRule()));
40
+ $oRule->setValue($oValue);
41
+ if ($oParserState->getSettings()->bLenientParsing) {
42
+ while ($oParserState->comes('\\')) {
43
+ $oParserState->consume('\\');
44
+ $oRule->addIeHack($oParserState->consume());
45
+ $oParserState->consumeWhiteSpace();
46
+ }
47
+ }
48
+ $oParserState->consumeWhiteSpace();
49
+ if ($oParserState->comes('!')) {
50
+ $oParserState->consume('!');
51
+ $oParserState->consumeWhiteSpace();
52
+ $oParserState->consume('important');
53
+ $oRule->setIsImportant(true);
54
+ }
55
+ $oParserState->consumeWhiteSpace();
56
+ while ($oParserState->comes(';')) {
57
+ $oParserState->consume(';');
58
+ }
59
+ $oParserState->consumeWhiteSpace();
60
+
61
+ return $oRule;
62
+ }
63
+
64
+ private static function listDelimiterForRule($sRule) {
65
+ if (preg_match('/^font($|-)/', $sRule)) {
66
+ return array(',', '/', ' ');
67
+ }
68
+ return array(',', ' ', '/');
69
+ }
70
+
71
+ /**
72
+ * @return int
73
+ */
74
+ public function getLineNo() {
75
+ return $this->iLineNo;
76
+ }
77
+
78
+ public function setRule($sRule) {
79
+ $this->sRule = $sRule;
80
+ }
81
+
82
+ public function getRule() {
83
+ return $this->sRule;
84
+ }
85
+
86
+ public function getValue() {
87
+ return $this->mValue;
88
+ }
89
+
90
+ public function setValue($mValue) {
91
+ $this->mValue = $mValue;
92
+ }
93
+
94
+ /**
95
+ * @deprecated Old-Style 2-dimensional array given. Retained for (some) backwards-compatibility. Use setValue() instead and wrapp the value inside a RuleValueList if necessary.
96
+ */
97
+ public function setValues($aSpaceSeparatedValues) {
98
+ $oSpaceSeparatedList = null;
99
+ if (count($aSpaceSeparatedValues) > 1) {
100
+ $oSpaceSeparatedList = new RuleValueList(' ', $this->iLineNo);
101
+ }
102
+ foreach ($aSpaceSeparatedValues as $aCommaSeparatedValues) {
103
+ $oCommaSeparatedList = null;
104
+ if (count($aCommaSeparatedValues) > 1) {
105
+ $oCommaSeparatedList = new RuleValueList(',', $this->iLineNo);
106
+ }
107
+ foreach ($aCommaSeparatedValues as $mValue) {
108
+ if (!$oSpaceSeparatedList && !$oCommaSeparatedList) {
109
+ $this->mValue = $mValue;
110
+ return $mValue;
111
+ }
112
+ if ($oCommaSeparatedList) {
113
+ $oCommaSeparatedList->addListComponent($mValue);
114
+ } else {
115
+ $oSpaceSeparatedList->addListComponent($mValue);
116
+ }
117
+ }
118
+ if (!$oSpaceSeparatedList) {
119
+ $this->mValue = $oCommaSeparatedList;
120
+ return $oCommaSeparatedList;
121
+ } else {
122
+ $oSpaceSeparatedList->addListComponent($oCommaSeparatedList);
123
+ }
124
+ }
125
+ $this->mValue = $oSpaceSeparatedList;
126
+ return $oSpaceSeparatedList;
127
+ }
128
+
129
+ /**
130
+ * @deprecated Old-Style 2-dimensional array returned. Retained for (some) backwards-compatibility. Use getValue() instead and check for the existance of a (nested set of) ValueList object(s).
131
+ */
132
+ public function getValues() {
133
+ if (!$this->mValue instanceof RuleValueList) {
134
+ return array(array($this->mValue));
135
+ }
136
+ if ($this->mValue->getListSeparator() === ',') {
137
+ return array($this->mValue->getListComponents());
138
+ }
139
+ $aResult = array();
140
+ foreach ($this->mValue->getListComponents() as $mValue) {
141
+ if (!$mValue instanceof RuleValueList || $mValue->getListSeparator() !== ',') {
142
+ $aResult[] = array($mValue);
143
+ continue;
144
+ }
145
+ if ($this->mValue->getListSeparator() === ' ' || count($aResult) === 0) {
146
+ $aResult[] = array();
147
+ }
148
+ foreach ($mValue->getListComponents() as $mValue) {
149
+ $aResult[count($aResult) - 1][] = $mValue;
150
+ }
151
+ }
152
+ return $aResult;
153
+ }
154
+
155
+ /**
156
+ * Adds a value to the existing value. Value will be appended if a RuleValueList exists of the given type. Otherwise, the existing value will be wrapped by one.
157
+ */
158
+ public function addValue($mValue, $sType = ' ') {
159
+ if (!is_array($mValue)) {
160
+ $mValue = array($mValue);
161
+ }
162
+ if (!$this->mValue instanceof RuleValueList || $this->mValue->getListSeparator() !== $sType) {
163
+ $mCurrentValue = $this->mValue;
164
+ $this->mValue = new RuleValueList($sType, $this->iLineNo);
165
+ if ($mCurrentValue) {
166
+ $this->mValue->addListComponent($mCurrentValue);
167
+ }
168
+ }
169
+ foreach ($mValue as $mValueItem) {
170
+ $this->mValue->addListComponent($mValueItem);
171
+ }
172
+ }
173
+
174
+ public function addIeHack($iModifier) {
175
+ $this->aIeHack[] = $iModifier;
176
+ }
177
+
178
+ public function setIeHack(array $aModifiers) {
179
+ $this->aIeHack = $aModifiers;
180
+ }
181
+
182
+ public function getIeHack() {
183
+ return $this->aIeHack;
184
+ }
185
+
186
+ public function setIsImportant($bIsImportant) {
187
+ $this->bIsImportant = $bIsImportant;
188
+ }
189
+
190
+ public function getIsImportant() {
191
+ return $this->bIsImportant;
192
+ }
193
+
194
+ public function __toString() {
195
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
196
+ }
197
+
198
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
199
+ $sResult = "{$this->sRule}:{$oOutputFormat->spaceAfterRuleName()}";
200
+ if ($this->mValue instanceof Value) { //Can also be a ValueList
201
+ $sResult .= $this->mValue->render($oOutputFormat);
202
+ } else {
203
+ $sResult .= $this->mValue;
204
+ }
205
+ if (!empty($this->aIeHack)) {
206
+ $sResult .= ' \\' . implode('\\', $this->aIeHack);
207
+ }
208
+ if ($this->bIsImportant) {
209
+ $sResult .= ' !important';
210
+ }
211
+ $sResult .= ';';
212
+ return $sResult;
213
+ }
214
+
215
+ /**
216
+ * @param array $aComments Array of comments.
217
+ */
218
+ public function addComments(array $aComments) {
219
+ $this->aComments = array_merge($this->aComments, $aComments);
220
+ }
221
+
222
+ /**
223
+ * @return array
224
+ */
225
+ public function getComments() {
226
+ return $this->aComments;
227
+ }
228
+
229
+ /**
230
+ * @param array $aComments Array containing Comment objects.
231
+ */
232
+ public function setComments(array $aComments) {
233
+ $this->aComments = $aComments;
234
+ }
235
+
236
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/AtRuleSet.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\RuleSet;
4
+
5
+ use Sabberworm\CSS\Property\AtRule;
6
+
7
+ /**
8
+ * A RuleSet constructed by an unknown @-rule. @font-face rules are rendered into AtRuleSet objects.
9
+ */
10
+ class AtRuleSet extends RuleSet implements AtRule {
11
+
12
+ private $sType;
13
+ private $sArgs;
14
+
15
+ public function __construct($sType, $sArgs = '', $iLineNo = 0) {
16
+ parent::__construct($iLineNo);
17
+ $this->sType = $sType;
18
+ $this->sArgs = $sArgs;
19
+ }
20
+
21
+ public function atRuleName() {
22
+ return $this->sType;
23
+ }
24
+
25
+ public function atRuleArgs() {
26
+ return $this->sArgs;
27
+ }
28
+
29
+ public function __toString() {
30
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
31
+ }
32
+
33
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
34
+ $sArgs = $this->sArgs;
35
+ if($sArgs) {
36
+ $sArgs = ' ' . $sArgs;
37
+ }
38
+ $sResult = "@{$this->sType}$sArgs{$oOutputFormat->spaceBeforeOpeningBrace()}{";
39
+ $sResult .= parent::render($oOutputFormat);
40
+ $sResult .= '}';
41
+ return $sResult;
42
+ }
43
+
44
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php ADDED
@@ -0,0 +1,658 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\RuleSet;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+ use Sabberworm\CSS\Parsing\OutputException;
7
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
8
+ use Sabberworm\CSS\Property\Selector;
9
+ use Sabberworm\CSS\Rule\Rule;
10
+ use Sabberworm\CSS\Value\RuleValueList;
11
+ use Sabberworm\CSS\Value\Value;
12
+ use Sabberworm\CSS\Value\Size;
13
+ use Sabberworm\CSS\Value\Color;
14
+ use Sabberworm\CSS\Value\URL;
15
+
16
+ /**
17
+ * Declaration blocks are the parts of a css file which denote the rules belonging to a selector.
18
+ * Declaration blocks usually appear directly inside a Document or another CSSList (mostly a MediaQuery).
19
+ */
20
+ class DeclarationBlock extends RuleSet {
21
+
22
+ private $aSelectors;
23
+
24
+ public function __construct($iLineNo = 0) {
25
+ parent::__construct($iLineNo);
26
+ $this->aSelectors = array();
27
+ }
28
+
29
+ public static function parse(ParserState $oParserState) {
30
+ $aComments = array();
31
+ $oResult = new DeclarationBlock($oParserState->currentLine());
32
+ try {
33
+ $aSelectorParts = array();
34
+ $sStringWrapperChar = false;
35
+ do {
36
+ $aSelectorParts[] = $oParserState->consume(1) . $oParserState->consumeUntil(array('{', '}', '\'', '"'), false, false, $aComments);
37
+ if ( in_array($oParserState->peek(), array('\'', '"')) && substr(end($aSelectorParts), -1) != "\\" ) {
38
+ if ( $sStringWrapperChar === false ) {
39
+ $sStringWrapperChar = $oParserState->peek();
40
+ } else if ($sStringWrapperChar == $oParserState->peek()) {
41
+ $sStringWrapperChar = false;
42
+ }
43
+ }
44
+ } while (!in_array($oParserState->peek(), array('{', '}')) || $sStringWrapperChar !== false);
45
+ $oResult->setSelector(implode('', $aSelectorParts));
46
+ if ($oParserState->comes('{')) {
47
+ $oParserState->consume(1);
48
+ }
49
+ } catch (UnexpectedTokenException $e) {
50
+ if($oParserState->getSettings()->bLenientParsing) {
51
+ if(!$oParserState->comes('}')) {
52
+ $oParserState->consumeUntil('}', false, true);
53
+ }
54
+ return false;
55
+ } else {
56
+ throw $e;
57
+ }
58
+ }
59
+ $oResult->setComments($aComments);
60
+ RuleSet::parseRuleSet($oParserState, $oResult);
61
+ return $oResult;
62
+ }
63
+
64
+
65
+ public function setSelectors($mSelector) {
66
+ if (is_array($mSelector)) {
67
+ $this->aSelectors = $mSelector;
68
+ } else {
69
+ $this->aSelectors = explode(',', $mSelector);
70
+ }
71
+ foreach ($this->aSelectors as $iKey => $mSelector) {
72
+ if (!($mSelector instanceof Selector)) {
73
+ if (!Selector::isValid($mSelector)) {
74
+ throw new UnexpectedTokenException("Selector did not match '" . Selector::SELECTOR_VALIDATION_RX . "'.", $mSelector, "custom");
75
+ }
76
+ $this->aSelectors[$iKey] = new Selector($mSelector);
77
+ }
78
+ }
79
+ }
80
+
81
+ // remove one of the selector of the block
82
+ public function removeSelector($mSelector) {
83
+ if($mSelector instanceof Selector) {
84
+ $mSelector = $mSelector->getSelector();
85
+ }
86
+ foreach($this->aSelectors as $iKey => $oSelector) {
87
+ if($oSelector->getSelector() === $mSelector) {
88
+ unset($this->aSelectors[$iKey]);
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * @deprecated use getSelectors()
97
+ */
98
+ public function getSelector() {
99
+ return $this->getSelectors();
100
+ }
101
+
102
+ /**
103
+ * @deprecated use setSelectors()
104
+ */
105
+ public function setSelector($mSelector) {
106
+ $this->setSelectors($mSelector);
107
+ }
108
+
109
+ /**
110
+ * Get selectors.
111
+ *
112
+ * @return Selector[] Selectors.
113
+ */
114
+ public function getSelectors() {
115
+ return $this->aSelectors;
116
+ }
117
+
118
+ /**
119
+ * Split shorthand declarations (e.g. +margin+ or +font+) into their constituent parts.
120
+ * */
121
+ public function expandShorthands() {
122
+ // border must be expanded before dimensions
123
+ $this->expandBorderShorthand();
124
+ $this->expandDimensionsShorthand();
125
+ $this->expandFontShorthand();
126
+ $this->expandBackgroundShorthand();
127
+ $this->expandListStyleShorthand();
128
+ }
129
+
130
+ /**
131
+ * Create shorthand declarations (e.g. +margin+ or +font+) whenever possible.
132
+ * */
133
+ public function createShorthands() {
134
+ $this->createBackgroundShorthand();
135
+ $this->createDimensionsShorthand();
136
+ // border must be shortened after dimensions
137
+ $this->createBorderShorthand();
138
+ $this->createFontShorthand();
139
+ $this->createListStyleShorthand();
140
+ }
141
+
142
+ /**
143
+ * Split shorthand border declarations (e.g. <tt>border: 1px red;</tt>)
144
+ * Additional splitting happens in expandDimensionsShorthand
145
+ * Multiple borders are not yet supported as of 3
146
+ * */
147
+ public function expandBorderShorthand() {
148
+ $aBorderRules = array(
149
+ 'border', 'border-left', 'border-right', 'border-top', 'border-bottom'
150
+ );
151
+ $aBorderSizes = array(
152
+ 'thin', 'medium', 'thick'
153
+ );
154
+ $aRules = $this->getRulesAssoc();
155
+ foreach ($aBorderRules as $sBorderRule) {
156
+ if (!isset($aRules[$sBorderRule]))
157
+ continue;
158
+ $oRule = $aRules[$sBorderRule];
159
+ $mRuleValue = $oRule->getValue();
160
+ $aValues = array();
161
+ if (!$mRuleValue instanceof RuleValueList) {
162
+ $aValues[] = $mRuleValue;
163
+ } else {
164
+ $aValues = $mRuleValue->getListComponents();
165
+ }
166
+ foreach ($aValues as $mValue) {
167
+ if ($mValue instanceof Value) {
168
+ $mNewValue = clone $mValue;
169
+ } else {
170
+ $mNewValue = $mValue;
171
+ }
172
+ if ($mValue instanceof Size) {
173
+ $sNewRuleName = $sBorderRule . "-width";
174
+ } else if ($mValue instanceof Color) {
175
+ $sNewRuleName = $sBorderRule . "-color";
176
+ } else {
177
+ if (in_array($mValue, $aBorderSizes)) {
178
+ $sNewRuleName = $sBorderRule . "-width";
179
+ } else/* if(in_array($mValue, $aBorderStyles)) */ {
180
+ $sNewRuleName = $sBorderRule . "-style";
181
+ }
182
+ }
183
+ $oNewRule = new Rule($sNewRuleName, $this->iLineNo);
184
+ $oNewRule->setIsImportant($oRule->getIsImportant());
185
+ $oNewRule->addValue(array($mNewValue));
186
+ $this->addRule($oNewRule);
187
+ }
188
+ $this->removeRule($sBorderRule);
189
+ }
190
+ }
191
+
192
+ /**
193
+ * Split shorthand dimensional declarations (e.g. <tt>margin: 0px auto;</tt>)
194
+ * into their constituent parts.
195
+ * Handles margin, padding, border-color, border-style and border-width.
196
+ * */
197
+ public function expandDimensionsShorthand() {
198
+ $aExpansions = array(
199
+ 'margin' => 'margin-%s',
200
+ 'padding' => 'padding-%s',
201
+ 'border-color' => 'border-%s-color',
202
+ 'border-style' => 'border-%s-style',
203
+ 'border-width' => 'border-%s-width'
204
+ );
205
+ $aRules = $this->getRulesAssoc();
206
+ foreach ($aExpansions as $sProperty => $sExpanded) {
207
+ if (!isset($aRules[$sProperty]))
208
+ continue;
209
+ $oRule = $aRules[$sProperty];
210
+ $mRuleValue = $oRule->getValue();
211
+ $aValues = array();
212
+ if (!$mRuleValue instanceof RuleValueList) {
213
+ $aValues[] = $mRuleValue;
214
+ } else {
215
+ $aValues = $mRuleValue->getListComponents();
216
+ }
217
+ $top = $right = $bottom = $left = null;
218
+ switch (count($aValues)) {
219
+ case 1:
220
+ $top = $right = $bottom = $left = $aValues[0];
221
+ break;
222
+ case 2:
223
+ $top = $bottom = $aValues[0];
224
+ $left = $right = $aValues[1];
225
+ break;
226
+ case 3:
227
+ $top = $aValues[0];
228
+ $left = $right = $aValues[1];
229
+ $bottom = $aValues[2];
230
+ break;
231
+ case 4:
232
+ $top = $aValues[0];
233
+ $right = $aValues[1];
234
+ $bottom = $aValues[2];
235
+ $left = $aValues[3];
236
+ break;
237
+ }
238
+ foreach (array('top', 'right', 'bottom', 'left') as $sPosition) {
239
+ $oNewRule = new Rule(sprintf($sExpanded, $sPosition), $this->iLineNo);
240
+ $oNewRule->setIsImportant($oRule->getIsImportant());
241
+ $oNewRule->addValue(${$sPosition});
242
+ $this->addRule($oNewRule);
243
+ }
244
+ $this->removeRule($sProperty);
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Convert shorthand font declarations
250
+ * (e.g. <tt>font: 300 italic 11px/14px verdana, helvetica, sans-serif;</tt>)
251
+ * into their constituent parts.
252
+ * */
253
+ public function expandFontShorthand() {
254
+ $aRules = $this->getRulesAssoc();
255
+ if (!isset($aRules['font']))
256
+ return;
257
+ $oRule = $aRules['font'];
258
+ // reset properties to 'normal' per http://www.w3.org/TR/21/fonts.html#font-shorthand
259
+ $aFontProperties = array(
260
+ 'font-style' => 'normal',
261
+ 'font-variant' => 'normal',
262
+ 'font-weight' => 'normal',
263
+ 'font-size' => 'normal',
264
+ 'line-height' => 'normal'
265
+ );
266
+ $mRuleValue = $oRule->getValue();
267
+ $aValues = array();
268
+ if (!$mRuleValue instanceof RuleValueList) {
269
+ $aValues[] = $mRuleValue;
270
+ } else {
271
+ $aValues = $mRuleValue->getListComponents();
272
+ }
273
+ foreach ($aValues as $mValue) {
274
+ if (!$mValue instanceof Value) {
275
+ $mValue = mb_strtolower($mValue);
276
+ }
277
+ if (in_array($mValue, array('normal', 'inherit'))) {
278
+ foreach (array('font-style', 'font-weight', 'font-variant') as $sProperty) {
279
+ if (!isset($aFontProperties[$sProperty])) {
280
+ $aFontProperties[$sProperty] = $mValue;
281
+ }
282
+ }
283
+ } else if (in_array($mValue, array('italic', 'oblique'))) {
284
+ $aFontProperties['font-style'] = $mValue;
285
+ } else if ($mValue == 'small-caps') {
286
+ $aFontProperties['font-variant'] = $mValue;
287
+ } else if (
288
+ in_array($mValue, array('bold', 'bolder', 'lighter'))
289
+ || ($mValue instanceof Size
290
+ && in_array($mValue->getSize(), range(100, 900, 100)))
291
+ ) {
292
+ $aFontProperties['font-weight'] = $mValue;
293
+ } else if ($mValue instanceof RuleValueList && $mValue->getListSeparator() == '/') {
294
+ list($oSize, $oHeight) = $mValue->getListComponents();
295
+ $aFontProperties['font-size'] = $oSize;
296
+ $aFontProperties['line-height'] = $oHeight;
297
+ } else if ($mValue instanceof Size && $mValue->getUnit() !== null) {
298
+ $aFontProperties['font-size'] = $mValue;
299
+ } else {
300
+ $aFontProperties['font-family'] = $mValue;
301
+ }
302
+ }
303
+ foreach ($aFontProperties as $sProperty => $mValue) {
304
+ $oNewRule = new Rule($sProperty, $this->iLineNo);
305
+ $oNewRule->addValue($mValue);
306
+ $oNewRule->setIsImportant($oRule->getIsImportant());
307
+ $this->addRule($oNewRule);
308
+ }
309
+ $this->removeRule('font');
310
+ }
311
+
312
+ /*
313
+ * Convert shorthand background declarations
314
+ * (e.g. <tt>background: url("chess.png") gray 50% repeat fixed;</tt>)
315
+ * into their constituent parts.
316
+ * @see http://www.w3.org/TR/21/colors.html#propdef-background
317
+ * */
318
+
319
+ public function expandBackgroundShorthand() {
320
+ $aRules = $this->getRulesAssoc();
321
+ if (!isset($aRules['background']))
322
+ return;
323
+ $oRule = $aRules['background'];
324
+ $aBgProperties = array(
325
+ 'background-color' => array('transparent'), 'background-image' => array('none'),
326
+ 'background-repeat' => array('repeat'), 'background-attachment' => array('scroll'),
327
+ 'background-position' => array(new Size(0, '%', null, false, $this->iLineNo), new Size(0, '%', null, false, $this->iLineNo))
328
+ );
329
+ $mRuleValue = $oRule->getValue();
330
+ $aValues = array();
331
+ if (!$mRuleValue instanceof RuleValueList) {
332
+ $aValues[] = $mRuleValue;
333
+ } else {
334
+ $aValues = $mRuleValue->getListComponents();
335
+ }
336
+ if (count($aValues) == 1 && $aValues[0] == 'inherit') {
337
+ foreach ($aBgProperties as $sProperty => $mValue) {
338
+ $oNewRule = new Rule($sProperty, $this->iLineNo);
339
+ $oNewRule->addValue('inherit');
340
+ $oNewRule->setIsImportant($oRule->getIsImportant());
341
+ $this->addRule($oNewRule);
342
+ }
343
+ $this->removeRule('background');
344
+ return;
345
+ }
346
+ $iNumBgPos = 0;
347
+ foreach ($aValues as $mValue) {
348
+ if (!$mValue instanceof Value) {
349
+ $mValue = mb_strtolower($mValue);
350
+ }
351
+ if ($mValue instanceof URL) {
352
+ $aBgProperties['background-image'] = $mValue;
353
+ } else if ($mValue instanceof Color) {
354
+ $aBgProperties['background-color'] = $mValue;
355
+ } else if (in_array($mValue, array('scroll', 'fixed'))) {
356
+ $aBgProperties['background-attachment'] = $mValue;
357
+ } else if (in_array($mValue, array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'))) {
358
+ $aBgProperties['background-repeat'] = $mValue;
359
+ } else if (in_array($mValue, array('left', 'center', 'right', 'top', 'bottom'))
360
+ || $mValue instanceof Size
361
+ ) {
362
+ if ($iNumBgPos == 0) {
363
+ $aBgProperties['background-position'][0] = $mValue;
364
+ $aBgProperties['background-position'][1] = 'center';
365
+ } else {
366
+ $aBgProperties['background-position'][$iNumBgPos] = $mValue;
367
+ }
368
+ $iNumBgPos++;
369
+ }
370
+ }
371
+ foreach ($aBgProperties as $sProperty => $mValue) {
372
+ $oNewRule = new Rule($sProperty, $this->iLineNo);
373
+ $oNewRule->setIsImportant($oRule->getIsImportant());
374
+ $oNewRule->addValue($mValue);
375
+ $this->addRule($oNewRule);
376
+ }
377
+ $this->removeRule('background');
378
+ }
379
+
380
+ public function expandListStyleShorthand() {
381
+ $aListProperties = array(
382
+ 'list-style-type' => 'disc',
383
+ 'list-style-position' => 'outside',
384
+ 'list-style-image' => 'none'
385
+ );
386
+ $aListStyleTypes = array(
387
+ 'none', 'disc', 'circle', 'square', 'decimal-leading-zero', 'decimal',
388
+ 'lower-roman', 'upper-roman', 'lower-greek', 'lower-alpha', 'lower-latin',
389
+ 'upper-alpha', 'upper-latin', 'hebrew', 'armenian', 'georgian', 'cjk-ideographic',
390
+ 'hiragana', 'hira-gana-iroha', 'katakana-iroha', 'katakana'
391
+ );
392
+ $aListStylePositions = array(
393
+ 'inside', 'outside'
394
+ );
395
+ $aRules = $this->getRulesAssoc();
396
+ if (!isset($aRules['list-style']))
397
+ return;
398
+ $oRule = $aRules['list-style'];
399
+ $mRuleValue = $oRule->getValue();
400
+ $aValues = array();
401
+ if (!$mRuleValue instanceof RuleValueList) {
402
+ $aValues[] = $mRuleValue;
403
+ } else {
404
+ $aValues = $mRuleValue->getListComponents();
405
+ }
406
+ if (count($aValues) == 1 && $aValues[0] == 'inherit') {
407
+ foreach ($aListProperties as $sProperty => $mValue) {
408
+ $oNewRule = new Rule($sProperty, $this->iLineNo);
409
+ $oNewRule->addValue('inherit');
410
+ $oNewRule->setIsImportant($oRule->getIsImportant());
411
+ $this->addRule($oNewRule);
412
+ }
413
+ $this->removeRule('list-style');
414
+ return;
415
+ }
416
+ foreach ($aValues as $mValue) {
417
+ if (!$mValue instanceof Value) {
418
+ $mValue = mb_strtolower($mValue);
419
+ }
420
+ if ($mValue instanceof Url) {
421
+ $aListProperties['list-style-image'] = $mValue;
422
+ } else if (in_array($mValue, $aListStyleTypes)) {
423
+ $aListProperties['list-style-types'] = $mValue;
424
+ } else if (in_array($mValue, $aListStylePositions)) {
425
+ $aListProperties['list-style-position'] = $mValue;
426
+ }
427
+ }
428
+ foreach ($aListProperties as $sProperty => $mValue) {
429
+ $oNewRule = new Rule($sProperty, $this->iLineNo);
430
+ $oNewRule->setIsImportant($oRule->getIsImportant());
431
+ $oNewRule->addValue($mValue);
432
+ $this->addRule($oNewRule);
433
+ }
434
+ $this->removeRule('list-style');
435
+ }
436
+
437
+ public function createShorthandProperties(array $aProperties, $sShorthand) {
438
+ $aRules = $this->getRulesAssoc();
439
+ $aNewValues = array();
440
+ foreach ($aProperties as $sProperty) {
441
+ if (!isset($aRules[$sProperty]))
442
+ continue;
443
+ $oRule = $aRules[$sProperty];
444
+ if (!$oRule->getIsImportant()) {
445
+ $mRuleValue = $oRule->getValue();
446
+ $aValues = array();
447
+ if (!$mRuleValue instanceof RuleValueList) {
448
+ $aValues[] = $mRuleValue;
449
+ } else {
450
+ $aValues = $mRuleValue->getListComponents();
451
+ }
452
+ foreach ($aValues as $mValue) {
453
+ $aNewValues[] = $mValue;
454
+ }
455
+ $this->removeRule($sProperty);
456
+ }
457
+ }
458
+ if (count($aNewValues)) {
459
+ $oNewRule = new Rule($sShorthand, $this->iLineNo);
460
+ foreach ($aNewValues as $mValue) {
461
+ $oNewRule->addValue($mValue);
462
+ }
463
+ $this->addRule($oNewRule);
464
+ }
465
+ }
466
+
467
+ public function createBackgroundShorthand() {
468
+ $aProperties = array(
469
+ 'background-color', 'background-image', 'background-repeat',
470
+ 'background-position', 'background-attachment'
471
+ );
472
+ $this->createShorthandProperties($aProperties, 'background');
473
+ }
474
+
475
+ public function createListStyleShorthand() {
476
+ $aProperties = array(
477
+ 'list-style-type', 'list-style-position', 'list-style-image'
478
+ );
479
+ $this->createShorthandProperties($aProperties, 'list-style');
480
+ }
481
+
482
+ /**
483
+ * Combine border-color, border-style and border-width into border
484
+ * Should be run after create_dimensions_shorthand!
485
+ * */
486
+ public function createBorderShorthand() {
487
+ $aProperties = array(
488
+ 'border-width', 'border-style', 'border-color'
489
+ );
490
+ $this->createShorthandProperties($aProperties, 'border');
491
+ }
492
+
493
+ /*
494
+ * Looks for long format CSS dimensional properties
495
+ * (margin, padding, border-color, border-style and border-width)
496
+ * and converts them into shorthand CSS properties.
497
+ * */
498
+
499
+ public function createDimensionsShorthand() {
500
+ $aPositions = array('top', 'right', 'bottom', 'left');
501
+ $aExpansions = array(
502
+ 'margin' => 'margin-%s',
503
+ 'padding' => 'padding-%s',
504
+ 'border-color' => 'border-%s-color',
505
+ 'border-style' => 'border-%s-style',
506
+ 'border-width' => 'border-%s-width'
507
+ );
508
+ $aRules = $this->getRulesAssoc();
509
+ foreach ($aExpansions as $sProperty => $sExpanded) {
510
+ $aFoldable = array();
511
+ foreach ($aRules as $sRuleName => $oRule) {
512
+ foreach ($aPositions as $sPosition) {
513
+ if ($sRuleName == sprintf($sExpanded, $sPosition)) {
514
+ $aFoldable[$sRuleName] = $oRule;
515
+ }
516
+ }
517
+ }
518
+ // All four dimensions must be present
519
+ if (count($aFoldable) == 4) {
520
+ $aValues = array();
521
+ foreach ($aPositions as $sPosition) {
522
+ $oRule = $aRules[sprintf($sExpanded, $sPosition)];
523
+ $mRuleValue = $oRule->getValue();
524
+ $aRuleValues = array();
525
+ if (!$mRuleValue instanceof RuleValueList) {
526
+ $aRuleValues[] = $mRuleValue;
527
+ } else {
528
+ $aRuleValues = $mRuleValue->getListComponents();
529
+ }
530
+ $aValues[$sPosition] = $aRuleValues;
531
+ }
532
+ $oNewRule = new Rule($sProperty, $this->iLineNo);
533
+ if ((string) $aValues['left'][0] == (string) $aValues['right'][0]) {
534
+ if ((string) $aValues['top'][0] == (string) $aValues['bottom'][0]) {
535
+ if ((string) $aValues['top'][0] == (string) $aValues['left'][0]) {
536
+ // All 4 sides are equal
537
+ $oNewRule->addValue($aValues['top']);
538
+ } else {
539
+ // Top and bottom are equal, left and right are equal
540
+ $oNewRule->addValue($aValues['top']);
541
+ $oNewRule->addValue($aValues['left']);
542
+ }
543
+ } else {
544
+ // Only left and right are equal
545
+ $oNewRule->addValue($aValues['top']);
546
+ $oNewRule->addValue($aValues['left']);
547
+ $oNewRule->addValue($aValues['bottom']);
548
+ }
549
+ } else {
550
+ // No sides are equal
551
+ $oNewRule->addValue($aValues['top']);
552
+ $oNewRule->addValue($aValues['left']);
553
+ $oNewRule->addValue($aValues['bottom']);
554
+ $oNewRule->addValue($aValues['right']);
555
+ }
556
+ $this->addRule($oNewRule);
557
+ foreach ($aPositions as $sPosition) {
558
+ $this->removeRule(sprintf($sExpanded, $sPosition));
559
+ }
560
+ }
561
+ }
562
+ }
563
+
564
+ /**
565
+ * Looks for long format CSS font properties (e.g. <tt>font-weight</tt>) and
566
+ * tries to convert them into a shorthand CSS <tt>font</tt> property.
567
+ * At least font-size AND font-family must be present in order to create a shorthand declaration.
568
+ * */
569
+ public function createFontShorthand() {
570
+ $aFontProperties = array(
571
+ 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', 'font-family'
572
+ );
573
+ $aRules = $this->getRulesAssoc();
574
+ if (!isset($aRules['font-size']) || !isset($aRules['font-family'])) {
575
+ return;
576
+ }
577
+ $oNewRule = new Rule('font', $this->iLineNo);
578
+ foreach (array('font-style', 'font-variant', 'font-weight') as $sProperty) {
579
+ if (isset($aRules[$sProperty])) {
580
+ $oRule = $aRules[$sProperty];
581
+ $mRuleValue = $oRule->getValue();
582
+ $aValues = array();
583
+ if (!$mRuleValue instanceof RuleValueList) {
584
+ $aValues[] = $mRuleValue;
585
+ } else {
586
+ $aValues = $mRuleValue->getListComponents();
587
+ }
588
+ if ($aValues[0] !== 'normal') {
589
+ $oNewRule->addValue($aValues[0]);
590
+ }
591
+ }
592
+ }
593
+ // Get the font-size value
594
+ $oRule = $aRules['font-size'];
595
+ $mRuleValue = $oRule->getValue();
596
+ $aFSValues = array();
597
+ if (!$mRuleValue instanceof RuleValueList) {
598
+ $aFSValues[] = $mRuleValue;
599
+ } else {
600
+ $aFSValues = $mRuleValue->getListComponents();
601
+ }
602
+ // But wait to know if we have line-height to add it
603
+ if (isset($aRules['line-height'])) {
604
+ $oRule = $aRules['line-height'];
605
+ $mRuleValue = $oRule->getValue();
606
+ $aLHValues = array();
607
+ if (!$mRuleValue instanceof RuleValueList) {
608
+ $aLHValues[] = $mRuleValue;
609
+ } else {
610
+ $aLHValues = $mRuleValue->getListComponents();
611
+ }
612
+ if ($aLHValues[0] !== 'normal') {
613
+ $val = new RuleValueList('/', $this->iLineNo);
614
+ $val->addListComponent($aFSValues[0]);
615
+ $val->addListComponent($aLHValues[0]);
616
+ $oNewRule->addValue($val);
617
+ }
618
+ } else {
619
+ $oNewRule->addValue($aFSValues[0]);
620
+ }
621
+ $oRule = $aRules['font-family'];
622
+ $mRuleValue = $oRule->getValue();
623
+ $aFFValues = array();
624
+ if (!$mRuleValue instanceof RuleValueList) {
625
+ $aFFValues[] = $mRuleValue;
626
+ } else {
627
+ $aFFValues = $mRuleValue->getListComponents();
628
+ }
629
+ $oFFValue = new RuleValueList(',', $this->iLineNo);
630
+ $oFFValue->setListComponents($aFFValues);
631
+ $oNewRule->addValue($oFFValue);
632
+
633
+ $this->addRule($oNewRule);
634
+ foreach ($aFontProperties as $sProperty) {
635
+ $this->removeRule($sProperty);
636
+ }
637
+ }
638
+
639
+ public function __toString() {
640
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
641
+ }
642
+
643
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
644
+ if(count($this->aSelectors) === 0) {
645
+ // If all the selectors have been removed, this declaration block becomes invalid
646
+ throw new OutputException("Attempt to print declaration block with missing selector", $this->iLineNo);
647
+ }
648
+ $sResult = $oOutputFormat->sBeforeDeclarationBlock;
649
+ $sResult .= $oOutputFormat->implode($oOutputFormat->spaceBeforeSelectorSeparator() . ',' . $oOutputFormat->spaceAfterSelectorSeparator(), $this->aSelectors);
650
+ $sResult .= $oOutputFormat->sAfterDeclarationBlockSelectors;
651
+ $sResult .= $oOutputFormat->spaceBeforeOpeningBrace() . '{';
652
+ $sResult .= parent::render($oOutputFormat);
653
+ $sResult .= '}';
654
+ $sResult .= $oOutputFormat->sAfterDeclarationBlock;
655
+ return $sResult;
656
+ }
657
+
658
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/RuleSet.php ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\RuleSet;
4
+
5
+ use Sabberworm\CSS\Comment\Commentable;
6
+ use Sabberworm\CSS\Parsing\ParserState;
7
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
8
+ use Sabberworm\CSS\Renderable;
9
+ use Sabberworm\CSS\Rule\Rule;
10
+
11
+ /**
12
+ * RuleSet is a generic superclass denoting rules. The typical example for rule sets are declaration block.
13
+ * However, unknown At-Rules (like @font-face) are also rule sets.
14
+ */
15
+ abstract class RuleSet implements Renderable, Commentable {
16
+
17
+ private $aRules;
18
+ protected $iLineNo;
19
+ protected $aComments;
20
+
21
+ public function __construct($iLineNo = 0) {
22
+ $this->aRules = array();
23
+ $this->iLineNo = $iLineNo;
24
+ $this->aComments = array();
25
+ }
26
+
27
+ public static function parseRuleSet(ParserState $oParserState, RuleSet $oRuleSet) {
28
+ while ($oParserState->comes(';')) {
29
+ $oParserState->consume(';');
30
+ }
31
+ while (!$oParserState->comes('}')) {
32
+ $oRule = null;
33
+ if($oParserState->getSettings()->bLenientParsing) {
34
+ try {
35
+ $oRule = Rule::parse($oParserState);
36
+ } catch (UnexpectedTokenException $e) {
37
+ try {
38
+ $sConsume = $oParserState->consumeUntil(array("\n", ";", '}'), true);
39
+ // We need to “unfind” the matches to the end of the ruleSet as this will be matched later
40
+ if($oParserState->streql(substr($sConsume, -1), '}')) {
41
+ $oParserState->backtrack(1);
42
+ } else {
43
+ while ($oParserState->comes(';')) {
44
+ $oParserState->consume(';');
45
+ }
46
+ }
47
+ } catch (UnexpectedTokenException $e) {
48
+ // We’ve reached the end of the document. Just close the RuleSet.
49
+ return;
50
+ }
51
+ }
52
+ } else {
53
+ $oRule = Rule::parse($oParserState);
54
+ }
55
+ if($oRule) {
56
+ $oRuleSet->addRule($oRule);
57
+ }
58
+ }
59
+ $oParserState->consume('}');
60
+ }
61
+
62
+ /**
63
+ * @return int
64
+ */
65
+ public function getLineNo() {
66
+ return $this->iLineNo;
67
+ }
68
+
69
+ public function addRule(Rule $oRule, Rule $oSibling = null) {
70
+ $sRule = $oRule->getRule();
71
+ if(!isset($this->aRules[$sRule])) {
72
+ $this->aRules[$sRule] = array();
73
+ }
74
+
75
+ $iPosition = count($this->aRules[$sRule]);
76
+
77
+ if ($oSibling !== null) {
78
+ $iSiblingPos = array_search($oSibling, $this->aRules[$sRule], true);
79
+ if ($iSiblingPos !== false) {
80
+ $iPosition = $iSiblingPos;
81
+ }
82
+ }
83
+
84
+ array_splice($this->aRules[$sRule], $iPosition, 0, array($oRule));
85
+ }
86
+
87
+ /**
88
+ * Returns all rules matching the given rule name
89
+ * @param (null|string|Rule) $mRule pattern to search for. If null, returns all rules. if the pattern ends with a dash, all rules starting with the pattern are returned as well as one matching the pattern with the dash excluded. passing a Rule behaves like calling getRules($mRule->getRule()).
90
+ * @example $oRuleSet->getRules('font-') //returns an array of all rules either beginning with font- or matching font.
91
+ * @example $oRuleSet->getRules('font') //returns array(0 => $oRule, …) or array().
92
+ * @return Rule[] Rules.
93
+ */
94
+ public function getRules($mRule = null) {
95
+ if ($mRule instanceof Rule) {
96
+ $mRule = $mRule->getRule();
97
+ }
98
+ $aResult = array();
99
+ foreach($this->aRules as $sName => $aRules) {
100
+ // Either no search rule is given or the search rule matches the found rule exactly or the search rule ends in “-” and the found rule starts with the search rule.
101
+ if(!$mRule || $sName === $mRule || (strrpos($mRule, '-') === strlen($mRule) - strlen('-') && (strpos($sName, $mRule) === 0 || $sName === substr($mRule, 0, -1)))) {
102
+ $aResult = array_merge($aResult, $aRules);
103
+ }
104
+ }
105
+ return $aResult;
106
+ }
107
+
108
+ /**
109
+ * Override all the rules of this set.
110
+ * @param Rule[] $aRules The rules to override with.
111
+ */
112
+ public function setRules(array $aRules) {
113
+ $this->aRules = array();
114
+ foreach ($aRules as $rule) {
115
+ $this->addRule($rule);
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Returns all rules matching the given pattern and returns them in an associative array with the rule’s name as keys. This method exists mainly for backwards-compatibility and is really only partially useful.
121
+ * @param (string) $mRule pattern to search for. If null, returns all rules. if the pattern ends with a dash, all rules starting with the pattern are returned as well as one matching the pattern with the dash excluded. passing a Rule behaves like calling getRules($mRule->getRule()).
122
+ * Note: This method loses some information: Calling this (with an argument of 'background-') on a declaration block like { background-color: green; background-color; rgba(0, 127, 0, 0.7); } will only yield an associative array containing the rgba-valued rule while @link{getRules()} would yield an indexed array containing both.
123
+ * @return Rule[] Rules.
124
+ */
125
+ public function getRulesAssoc($mRule = null) {
126
+ $aResult = array();
127
+ foreach($this->getRules($mRule) as $oRule) {
128
+ $aResult[$oRule->getRule()] = $oRule;
129
+ }
130
+ return $aResult;
131
+ }
132
+
133
+ /**
134
+ * Remove a rule from this RuleSet. This accepts all the possible values that @link{getRules()} accepts. If given a Rule, it will only remove this particular rule (by identity). If given a name, it will remove all rules by that name. Note: this is different from pre-v.2.0 behaviour of PHP-CSS-Parser, where passing a Rule instance would remove all rules with the same name. To get the old behvaiour, use removeRule($oRule->getRule()).
135
+ * @param (null|string|Rule) $mRule pattern to remove. If $mRule is null, all rules are removed. If the pattern ends in a dash, all rules starting with the pattern are removed as well as one matching the pattern with the dash excluded. Passing a Rule behaves matches by identity.
136
+ */
137
+ public function removeRule($mRule) {
138
+ if($mRule instanceof Rule) {
139
+ $sRule = $mRule->getRule();
140
+ if(!isset($this->aRules[$sRule])) {
141
+ return;
142
+ }
143
+ foreach($this->aRules[$sRule] as $iKey => $oRule) {
144
+ if($oRule === $mRule) {
145
+ unset($this->aRules[$sRule][$iKey]);
146
+ }
147
+ }
148
+ } else {
149
+ foreach($this->aRules as $sName => $aRules) {
150
+ // Either no search rule is given or the search rule matches the found rule exactly or the search rule ends in “-” and the found rule starts with the search rule or equals it (without the trailing dash).
151
+ if(!$mRule || $sName === $mRule || (strrpos($mRule, '-') === strlen($mRule) - strlen('-') && (strpos($sName, $mRule) === 0 || $sName === substr($mRule, 0, -1)))) {
152
+ unset($this->aRules[$sName]);
153
+ }
154
+ }
155
+ }
156
+ }
157
+
158
+ public function __toString() {
159
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
160
+ }
161
+
162
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
163
+ $sResult = '';
164
+ $bIsFirst = true;
165
+ foreach ($this->aRules as $aRules) {
166
+ foreach($aRules as $oRule) {
167
+ $sRendered = $oOutputFormat->safely(function() use ($oRule, $oOutputFormat) {
168
+ return $oRule->render($oOutputFormat->nextLevel());
169
+ });
170
+ if($sRendered === null) {
171
+ continue;
172
+ }
173
+ if($bIsFirst) {
174
+ $bIsFirst = false;
175
+ $sResult .= $oOutputFormat->nextLevel()->spaceBeforeRules();
176
+ } else {
177
+ $sResult .= $oOutputFormat->nextLevel()->spaceBetweenRules();
178
+ }
179
+ $sResult .= $sRendered;
180
+ }
181
+ }
182
+
183
+ if(!$bIsFirst) {
184
+ // Had some output
185
+ $sResult .= $oOutputFormat->spaceAfterRules();
186
+ }
187
+
188
+ return $oOutputFormat->removeLastSemicolon($sResult);
189
+ }
190
+
191
+ /**
192
+ * @param array $aComments Array of comments.
193
+ */
194
+ public function addComments(array $aComments) {
195
+ $this->aComments = array_merge($this->aComments, $aComments);
196
+ }
197
+
198
+ /**
199
+ * @return array
200
+ */
201
+ public function getComments() {
202
+ return $this->aComments;
203
+ }
204
+
205
+ /**
206
+ * @param array $aComments Array containing Comment objects.
207
+ */
208
+ public function setComments(array $aComments) {
209
+ $this->aComments = $aComments;
210
+ }
211
+
212
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Settings.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS;
4
+
5
+ use Sabberworm\CSS\Rule\Rule;
6
+
7
+ /**
8
+ * Parser settings class.
9
+ *
10
+ * Configure parser behaviour here.
11
+ */
12
+ class Settings {
13
+ /**
14
+ * Multi-byte string support. If true (mbstring extension must be enabled), will use (slower) mb_strlen, mb_convert_case, mb_substr and mb_strpos functions. Otherwise, the normal (ASCII-Only) functions will be used.
15
+ */
16
+ public $bMultibyteSupport;
17
+
18
+ /**
19
+ * The default charset for the CSS if no `@charset` rule is found. Defaults to utf-8.
20
+ */
21
+ public $sDefaultCharset = 'utf-8';
22
+
23
+ /**
24
+ * Lenient parsing. When used (which is true by default), the parser will not choke on unexpected tokens but simply ignore them.
25
+ */
26
+ public $bLenientParsing = true;
27
+
28
+ private function __construct() {
29
+ $this->bMultibyteSupport = extension_loaded('mbstring');
30
+ }
31
+
32
+ public static function create() {
33
+ return new Settings();
34
+ }
35
+
36
+ public function withMultibyteSupport($bMultibyteSupport = true) {
37
+ $this->bMultibyteSupport = $bMultibyteSupport;
38
+ return $this;
39
+ }
40
+
41
+ public function withDefaultCharset($sDefaultCharset) {
42
+ $this->sDefaultCharset = $sDefaultCharset;
43
+ return $this;
44
+ }
45
+
46
+ public function withLenientParsing($bLenientParsing = true) {
47
+ $this->bLenientParsing = $bLenientParsing;
48
+ return $this;
49
+ }
50
+
51
+ public function beStrict() {
52
+ return $this->withLenientParsing(false);
53
+ }
54
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CSSFunction.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ class CSSFunction extends ValueList {
6
+
7
+ protected $sName;
8
+
9
+ public function __construct($sName, $aArguments, $sSeparator = ',', $iLineNo = 0) {
10
+ if($aArguments instanceof RuleValueList) {
11
+ $sSeparator = $aArguments->getListSeparator();
12
+ $aArguments = $aArguments->getListComponents();
13
+ }
14
+ $this->sName = $sName;
15
+ $this->iLineNo = $iLineNo;
16
+ parent::__construct($aArguments, $sSeparator, $iLineNo);
17
+ }
18
+
19
+ public function getName() {
20
+ return $this->sName;
21
+ }
22
+
23
+ public function setName($sName) {
24
+ $this->sName = $sName;
25
+ }
26
+
27
+ public function getArguments() {
28
+ return $this->aComponents;
29
+ }
30
+
31
+ public function __toString() {
32
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
33
+ }
34
+
35
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
36
+ $aArguments = parent::render($oOutputFormat);
37
+ return "{$this->sName}({$aArguments})";
38
+ }
39
+
40
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CSSString.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+ use Sabberworm\CSS\Parsing\SourceException;
7
+
8
+ class CSSString extends PrimitiveValue {
9
+
10
+ private $sString;
11
+
12
+ public function __construct($sString, $iLineNo = 0) {
13
+ $this->sString = $sString;
14
+ parent::__construct($iLineNo);
15
+ }
16
+
17
+ public static function parse(ParserState $oParserState) {
18
+ $sBegin = $oParserState->peek();
19
+ $sQuote = null;
20
+ if ($sBegin === "'") {
21
+ $sQuote = "'";
22
+ } else if ($sBegin === '"') {
23
+ $sQuote = '"';
24
+ }
25
+ if ($sQuote !== null) {
26
+ $oParserState->consume($sQuote);
27
+ }
28
+ $sResult = "";
29
+ $sContent = null;
30
+ if ($sQuote === null) {
31
+ // Unquoted strings end in whitespace or with braces, brackets, parentheses
32
+ while (!preg_match('/[\\s{}()<>\\[\\]]/isu', $oParserState->peek())) {
33
+ $sResult .= $oParserState->parseCharacter(false);
34
+ }
35
+ } else {
36
+ while (!$oParserState->comes($sQuote)) {
37
+ $sContent = $oParserState->parseCharacter(false);
38
+ if ($sContent === null) {
39
+ throw new SourceException("Non-well-formed quoted string {$oParserState->peek(3)}", $oParserState->currentLine());
40
+ }
41
+ $sResult .= $sContent;
42
+ }
43
+ $oParserState->consume($sQuote);
44
+ }
45
+ return new CSSString($sResult, $oParserState->currentLine());
46
+ }
47
+
48
+ public function setString($sString) {
49
+ $this->sString = $sString;
50
+ }
51
+
52
+ public function getString() {
53
+ return $this->sString;
54
+ }
55
+
56
+ public function __toString() {
57
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
58
+ }
59
+
60
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
61
+ $sString = addslashes($this->sString);
62
+ $sString = str_replace("\n", '\A', $sString);
63
+ return $oOutputFormat->getStringQuotingType() . $sString . $oOutputFormat->getStringQuotingType();
64
+ }
65
+
66
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CalcFunction.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
7
+
8
+ class CalcFunction extends CSSFunction {
9
+ const T_OPERAND = 1;
10
+ const T_OPERATOR = 2;
11
+
12
+ public static function parse(ParserState $oParserState) {
13
+ $aOperators = array('+', '-', '*', '/');
14
+ $sFunction = trim($oParserState->consumeUntil('(', false, true));
15
+ $oCalcList = new CalcRuleValueList($oParserState->currentLine());
16
+ $oList = new RuleValueList(',', $oParserState->currentLine());
17
+ $iNestingLevel = 0;
18
+ $iLastComponentType = NULL;
19
+ while(!$oParserState->comes(')') || $iNestingLevel > 0) {
20
+ $oParserState->consumeWhiteSpace();
21
+ if ($oParserState->comes('(')) {
22
+ $iNestingLevel++;
23
+ $oCalcList->addListComponent($oParserState->consume(1));
24
+ $oParserState->consumeWhiteSpace();
25
+ continue;
26
+ } else if ($oParserState->comes(')')) {
27
+ $iNestingLevel--;
28
+ $oCalcList->addListComponent($oParserState->consume(1));
29
+ $oParserState->consumeWhiteSpace();
30
+ continue;
31
+ }
32
+ if ($iLastComponentType != CalcFunction::T_OPERAND) {
33
+ $oVal = Value::parsePrimitiveValue($oParserState);
34
+ $oCalcList->addListComponent($oVal);
35
+ $iLastComponentType = CalcFunction::T_OPERAND;
36
+ } else {
37
+ if (in_array($oParserState->peek(), $aOperators)) {
38
+ if (($oParserState->comes('-') || $oParserState->comes('+'))) {
39
+ if ($oParserState->peek(1, -1) != ' ' || !($oParserState->comes('- ') || $oParserState->comes('+ '))) {
40
+ throw new UnexpectedTokenException(" {$oParserState->peek()} ", $oParserState->peek(1, -1) . $oParserState->peek(2), 'literal', $oParserState->currentLine());
41
+ }
42
+ }
43
+ $oCalcList->addListComponent($oParserState->consume(1));
44
+ $iLastComponentType = CalcFunction::T_OPERATOR;
45
+ } else {
46
+ throw new UnexpectedTokenException(
47
+ sprintf(
48
+ 'Next token was expected to be an operand of type %s. Instead "%s" was found.',
49
+ implode(', ', $aOperators),
50
+ $oVal
51
+ ),
52
+ '',
53
+ 'custom',
54
+ $oParserState->currentLine()
55
+ );
56
+ }
57
+ }
58
+ $oParserState->consumeWhiteSpace();
59
+ }
60
+ $oList->addListComponent($oCalcList);
61
+ $oParserState->consume(')');
62
+ return new CalcFunction($sFunction, $oList, ',', $oParserState->currentLine());
63
+ }
64
+
65
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CalcRuleValueList.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ class CalcRuleValueList extends RuleValueList {
6
+ public function __construct($iLineNo = 0) {
7
+ parent::__construct(array(), ',', $iLineNo);
8
+ }
9
+
10
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
11
+ return $oOutputFormat->implode(' ', $this->aComponents);
12
+ }
13
+
14
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Color.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+
7
+ class Color extends CSSFunction {
8
+
9
+ public function __construct($aColor, $iLineNo = 0) {
10
+ parent::__construct(implode('', array_keys($aColor)), $aColor, ',', $iLineNo);
11
+ }
12
+
13
+ public static function parse(ParserState $oParserState) {
14
+ $aColor = array();
15
+ if ($oParserState->comes('#')) {
16
+ $oParserState->consume('#');
17
+ $sValue = $oParserState->parseIdentifier(false);
18
+ if ($oParserState->strlen($sValue) === 3) {
19
+ $sValue = $sValue[0] . $sValue[0] . $sValue[1] . $sValue[1] . $sValue[2] . $sValue[2];
20
+ } else if ($oParserState->strlen($sValue) === 4) {
21
+ $sValue = $sValue[0] . $sValue[0] . $sValue[1] . $sValue[1] . $sValue[2] . $sValue[2] . $sValue[3] . $sValue[3];
22
+ }
23
+
24
+ if ($oParserState->strlen($sValue) === 8) {
25
+ $aColor = array(
26
+ 'r' => new Size(intval($sValue[0] . $sValue[1], 16), null, true, $oParserState->currentLine()),
27
+ 'g' => new Size(intval($sValue[2] . $sValue[3], 16), null, true, $oParserState->currentLine()),
28
+ 'b' => new Size(intval($sValue[4] . $sValue[5], 16), null, true, $oParserState->currentLine()),
29
+ 'a' => new Size(round(self::mapRange(intval($sValue[6] . $sValue[7], 16), 0, 255, 0, 1), 2), null, true, $oParserState->currentLine())
30
+ );
31
+ } else {
32
+ $aColor = array(
33
+ 'r' => new Size(intval($sValue[0] . $sValue[1], 16), null, true, $oParserState->currentLine()),
34
+ 'g' => new Size(intval($sValue[2] . $sValue[3], 16), null, true, $oParserState->currentLine()),
35
+ 'b' => new Size(intval($sValue[4] . $sValue[5], 16), null, true, $oParserState->currentLine())
36
+ );
37
+ }
38
+ } else {
39
+ $sColorMode = $oParserState->parseIdentifier(true);
40
+ $oParserState->consumeWhiteSpace();
41
+ $oParserState->consume('(');
42
+ $iLength = $oParserState->strlen($sColorMode);
43
+ for ($i = 0; $i < $iLength; ++$i) {
44
+ $oParserState->consumeWhiteSpace();
45
+ $aColor[$sColorMode[$i]] = Size::parse($oParserState, true);
46
+ $oParserState->consumeWhiteSpace();
47
+ if ($i < ($iLength - 1)) {
48
+ $oParserState->consume(',');
49
+ }
50
+ }
51
+ $oParserState->consume(')');
52
+ }
53
+ return new Color($aColor, $oParserState->currentLine());
54
+ }
55
+
56
+ private static function mapRange($fVal, $fFromMin, $fFromMax, $fToMin, $fToMax) {
57
+ $fFromRange = $fFromMax - $fFromMin;
58
+ $fToRange = $fToMax - $fToMin;
59
+ $fMultiplier = $fToRange / $fFromRange;
60
+ $fNewVal = $fVal - $fFromMin;
61
+ $fNewVal *= $fMultiplier;
62
+ return $fNewVal + $fToMin;
63
+ }
64
+
65
+ public function getColor() {
66
+ return $this->aComponents;
67
+ }
68
+
69
+ public function setColor($aColor) {
70
+ $this->setName(implode('', array_keys($aColor)));
71
+ $this->aComponents = $aColor;
72
+ }
73
+
74
+ public function getColorDescription() {
75
+ return $this->getName();
76
+ }
77
+
78
+ public function __toString() {
79
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
80
+ }
81
+
82
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
83
+ // Shorthand RGB color values
84
+ if($oOutputFormat->getRGBHashNotation() && implode('', array_keys($this->aComponents)) === 'rgb') {
85
+ $sResult = sprintf(
86
+ '%02x%02x%02x',
87
+ $this->aComponents['r']->getSize(),
88
+ $this->aComponents['g']->getSize(),
89
+ $this->aComponents['b']->getSize()
90
+ );
91
+ return '#'.(($sResult[0] == $sResult[1]) && ($sResult[2] == $sResult[3]) && ($sResult[4] == $sResult[5]) ? "$sResult[0]$sResult[2]$sResult[4]" : $sResult);
92
+ }
93
+ return parent::render($oOutputFormat);
94
+ }
95
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/LineName.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
7
+
8
+ class LineName extends ValueList {
9
+ public function __construct($aComponents = array(), $iLineNo = 0) {
10
+ parent::__construct($aComponents, ' ', $iLineNo);
11
+ }
12
+
13
+ public static function parse(ParserState $oParserState) {
14
+ $oParserState->consume('[');
15
+ $oParserState->consumeWhiteSpace();
16
+ $aNames = array();
17
+ do {
18
+ if($oParserState->getSettings()->bLenientParsing) {
19
+ try {
20
+ $aNames[] = $oParserState->parseIdentifier();
21
+ } catch(UnexpectedTokenException $e) {}
22
+ } else {
23
+ $aNames[] = $oParserState->parseIdentifier();
24
+ }
25
+ $oParserState->consumeWhiteSpace();
26
+ } while (!$oParserState->comes(']'));
27
+ $oParserState->consume(']');
28
+ return new LineName($aNames, $oParserState->currentLine());
29
+ }
30
+
31
+
32
+
33
+ public function __toString() {
34
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
35
+ }
36
+
37
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
38
+ return '[' . parent::render(\Sabberworm\CSS\OutputFormat::createCompact()) . ']';
39
+ }
40
+
41
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/PrimitiveValue.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ abstract class PrimitiveValue extends Value {
6
+ public function __construct($iLineNo = 0) {
7
+ parent::__construct($iLineNo);
8
+ }
9
+
10
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/RuleValueList.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ class RuleValueList extends ValueList {
6
+ public function __construct($sSeparator = ',', $iLineNo = 0) {
7
+ parent::__construct(array(), $sSeparator, $iLineNo);
8
+ }
9
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Size.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+
7
+ class Size extends PrimitiveValue {
8
+
9
+ const ABSOLUTE_SIZE_UNITS = 'px/cm/mm/mozmm/in/pt/pc/vh/vw/vm/vmin/vmax/rem'; //vh/vw/vm(ax)/vmin/rem are absolute insofar as they don’t scale to the immediate parent (only the viewport)
10
+ const RELATIVE_SIZE_UNITS = '%/em/ex/ch/fr';
11
+ const NON_SIZE_UNITS = 'deg/grad/rad/s/ms/turns/Hz/kHz';
12
+
13
+ private static $SIZE_UNITS = null;
14
+
15
+ private $fSize;
16
+ private $sUnit;
17
+ private $bIsColorComponent;
18
+
19
+ public function __construct($fSize, $sUnit = null, $bIsColorComponent = false, $iLineNo = 0) {
20
+ parent::__construct($iLineNo);
21
+ $this->fSize = floatval($fSize);
22
+ $this->sUnit = $sUnit;
23
+ $this->bIsColorComponent = $bIsColorComponent;
24
+ }
25
+
26
+ public static function parse(ParserState $oParserState, $bIsColorComponent = false) {
27
+ $sSize = '';
28
+ if ($oParserState->comes('-')) {
29
+ $sSize .= $oParserState->consume('-');
30
+ }
31
+ while (is_numeric($oParserState->peek()) || $oParserState->comes('.')) {
32
+ if ($oParserState->comes('.')) {
33
+ $sSize .= $oParserState->consume('.');
34
+ } else {
35
+ $sSize .= $oParserState->consume(1);
36
+ }
37
+ }
38
+
39
+ $sUnit = null;
40
+ $aSizeUnits = self::getSizeUnits();
41
+ foreach($aSizeUnits as $iLength => &$aValues) {
42
+ $sKey = strtolower($oParserState->peek($iLength));
43
+ if(array_key_exists($sKey, $aValues)) {
44
+ if (($sUnit = $aValues[$sKey]) !== null) {
45
+ $oParserState->consume($iLength);
46
+ break;
47
+ }
48
+ }
49
+ }
50
+ return new Size(floatval($sSize), $sUnit, $bIsColorComponent, $oParserState->currentLine());
51
+ }
52
+
53
+ private static function getSizeUnits() {
54
+ if(self::$SIZE_UNITS === null) {
55
+ self::$SIZE_UNITS = array();
56
+ foreach (explode('/', Size::ABSOLUTE_SIZE_UNITS.'/'.Size::RELATIVE_SIZE_UNITS.'/'.Size::NON_SIZE_UNITS) as $val) {
57
+ $iSize = strlen($val);
58
+ if(!isset(self::$SIZE_UNITS[$iSize])) {
59
+ self::$SIZE_UNITS[$iSize] = array();
60
+ }
61
+ self::$SIZE_UNITS[$iSize][strtolower($val)] = $val;
62
+ }
63
+
64
+ // FIXME: Should we not order the longest units first?
65
+ ksort(self::$SIZE_UNITS, SORT_NUMERIC);
66
+ }
67
+
68
+ return self::$SIZE_UNITS;
69
+ }
70
+
71
+ public function setUnit($sUnit) {
72
+ $this->sUnit = $sUnit;
73
+ }
74
+
75
+ public function getUnit() {
76
+ return $this->sUnit;
77
+ }
78
+
79
+ public function setSize($fSize) {
80
+ $this->fSize = floatval($fSize);
81
+ }
82
+
83
+ public function getSize() {
84
+ return $this->fSize;
85
+ }
86
+
87
+ public function isColorComponent() {
88
+ return $this->bIsColorComponent;
89
+ }
90
+
91
+ /**
92
+ * Returns whether the number stored in this Size really represents a size (as in a length of something on screen).
93
+ * @return false if the unit an angle, a duration, a frequency or the number is a component in a Color object.
94
+ */
95
+ public function isSize() {
96
+ if (in_array($this->sUnit, explode('/', self::NON_SIZE_UNITS))) {
97
+ return false;
98
+ }
99
+ return !$this->isColorComponent();
100
+ }
101
+
102
+ public function isRelative() {
103
+ if (in_array($this->sUnit, explode('/', self::RELATIVE_SIZE_UNITS))) {
104
+ return true;
105
+ }
106
+ if ($this->sUnit === null && $this->fSize != 0) {
107
+ return true;
108
+ }
109
+ return false;
110
+ }
111
+
112
+ public function __toString() {
113
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
114
+ }
115
+
116
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
117
+ $l = localeconv();
118
+ $sPoint = preg_quote($l['decimal_point'], '/');
119
+ return preg_replace(array("/$sPoint/", "/^(-?)0\./"), array('.', '$1.'), $this->fSize) . ($this->sUnit === null ? '' : $this->sUnit);
120
+ }
121
+
122
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/URL.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+
7
+ class URL extends PrimitiveValue {
8
+
9
+ private $oURL;
10
+
11
+ public function __construct(CSSString $oURL, $iLineNo = 0) {
12
+ parent::__construct($iLineNo);
13
+ $this->oURL = $oURL;
14
+ }
15
+
16
+ public static function parse(ParserState $oParserState) {
17
+ $bUseUrl = $oParserState->comes('url', true);
18
+ if ($bUseUrl) {
19
+ $oParserState->consume('url');
20
+ $oParserState->consumeWhiteSpace();
21
+ $oParserState->consume('(');
22
+ }
23
+ $oParserState->consumeWhiteSpace();
24
+ $oResult = new URL(CSSString::parse($oParserState), $oParserState->currentLine());
25
+ if ($bUseUrl) {
26
+ $oParserState->consumeWhiteSpace();
27
+ $oParserState->consume(')');
28
+ }
29
+ return $oResult;
30
+ }
31
+
32
+
33
+ public function setURL(CSSString $oURL) {
34
+ $this->oURL = $oURL;
35
+ }
36
+
37
+ public function getURL() {
38
+ return $this->oURL;
39
+ }
40
+
41
+ public function __toString() {
42
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
43
+ }
44
+
45
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
46
+ return "url({$this->oURL->render($oOutputFormat)})";
47
+ }
48
+
49
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Value.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ use Sabberworm\CSS\Parsing\ParserState;
6
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
7
+ use Sabberworm\CSS\Renderable;
8
+
9
+ abstract class Value implements Renderable {
10
+ protected $iLineNo;
11
+
12
+ public function __construct($iLineNo = 0) {
13
+ $this->iLineNo = $iLineNo;
14
+ }
15
+
16
+ public static function parseValue(ParserState $oParserState, $aListDelimiters = array()) {
17
+ $aStack = array();
18
+ $oParserState->consumeWhiteSpace();
19
+ //Build a list of delimiters and parsed values
20
+ while (!($oParserState->comes('}') || $oParserState->comes(';') || $oParserState->comes('!') || $oParserState->comes(')') || $oParserState->comes('\\'))) {
21
+ if (count($aStack) > 0) {
22
+ $bFoundDelimiter = false;
23
+ foreach ($aListDelimiters as $sDelimiter) {
24
+ if ($oParserState->comes($sDelimiter)) {
25
+ array_push($aStack, $oParserState->consume($sDelimiter));
26
+ $oParserState->consumeWhiteSpace();
27
+ $bFoundDelimiter = true;
28
+ break;
29
+ }
30
+ }
31
+ if (!$bFoundDelimiter) {
32
+ //Whitespace was the list delimiter
33
+ array_push($aStack, ' ');
34
+ }
35
+ }
36
+ array_push($aStack, self::parsePrimitiveValue($oParserState));
37
+ $oParserState->consumeWhiteSpace();
38
+ }
39
+ //Convert the list to list objects
40
+ foreach ($aListDelimiters as $sDelimiter) {
41
+ if (count($aStack) === 1) {
42
+ return $aStack[0];
43
+ }
44
+ $iStartPosition = null;
45
+ while (($iStartPosition = array_search($sDelimiter, $aStack, true)) !== false) {
46
+ $iLength = 2; //Number of elements to be joined
47
+ for ($i = $iStartPosition + 2; $i < count($aStack); $i+=2, ++$iLength) {
48
+ if ($sDelimiter !== $aStack[$i]) {
49
+ break;
50
+ }
51
+ }
52
+ $oList = new RuleValueList($sDelimiter, $oParserState->currentLine());
53
+ for ($i = $iStartPosition - 1; $i - $iStartPosition + 1 < $iLength * 2; $i+=2) {
54
+ $oList->addListComponent($aStack[$i]);
55
+ }
56
+ array_splice($aStack, $iStartPosition - 1, $iLength * 2 - 1, array($oList));
57
+ }
58
+ }
59
+ if (!isset($aStack[0])) {
60
+ throw new UnexpectedTokenException(" {$oParserState->peek()} ", $oParserState->peek(1, -1) . $oParserState->peek(2), 'literal', $oParserState->currentLine());
61
+ }
62
+ return $aStack[0];
63
+ }
64
+
65
+ public static function parseIdentifierOrFunction(ParserState $oParserState, $bIgnoreCase = false) {
66
+ $sResult = $oParserState->parseIdentifier($bIgnoreCase);
67
+
68
+ if ($oParserState->comes('(')) {
69
+ $oParserState->consume('(');
70
+ $aArguments = Value::parseValue($oParserState, array('=', ' ', ','));
71
+ $sResult = new CSSFunction($sResult, $aArguments, ',', $oParserState->currentLine());
72
+ $oParserState->consume(')');
73
+ }
74
+
75
+ return $sResult;
76
+ }
77
+
78
+ public static function parsePrimitiveValue(ParserState $oParserState) {
79
+ $oValue = null;
80
+ $oParserState->consumeWhiteSpace();
81
+ if (is_numeric($oParserState->peek()) || ($oParserState->comes('-.') && is_numeric($oParserState->peek(1, 2))) || (($oParserState->comes('-') || $oParserState->comes('.')) && is_numeric($oParserState->peek(1, 1)))) {
82
+ $oValue = Size::parse($oParserState);
83
+ } else if ($oParserState->comes('#') || $oParserState->comes('rgb', true) || $oParserState->comes('hsl', true)) {
84
+ $oValue = Color::parse($oParserState);
85
+ } else if ($oParserState->comes('url', true)) {
86
+ $oValue = URL::parse($oParserState);
87
+ } else if ($oParserState->comes('calc', true) || $oParserState->comes('-webkit-calc', true) || $oParserState->comes('-moz-calc', true)) {
88
+ $oValue = CalcFunction::parse($oParserState);
89
+ } else if ($oParserState->comes("'") || $oParserState->comes('"')) {
90
+ $oValue = CSSString::parse($oParserState);
91
+ } else if ($oParserState->comes("progid:") && $oParserState->getSettings()->bLenientParsing) {
92
+ $oValue = self::parseMicrosoftFilter($oParserState);
93
+ } else if ($oParserState->comes("[")) {
94
+ $oValue = LineName::parse($oParserState);
95
+ } else if ($oParserState->comes("U+")) {
96
+ $oValue = self::parseUnicodeRangeValue($oParserState);
97
+ } else {
98
+ $oValue = self::parseIdentifierOrFunction($oParserState);
99
+ }
100
+ $oParserState->consumeWhiteSpace();
101
+ return $oValue;
102
+ }
103
+
104
+ private static function parseMicrosoftFilter(ParserState $oParserState) {
105
+ $sFunction = $oParserState->consumeUntil('(', false, true);
106
+ $aArguments = Value::parseValue($oParserState, array(',', '='));
107
+ return new CSSFunction($sFunction, $aArguments, ',', $oParserState->currentLine());
108
+ }
109
+
110
+ private static function parseUnicodeRangeValue(ParserState $oParserState) {
111
+ $iCodepointMaxLenth = 6; // Code points outside BMP can use up to six digits
112
+ $sRange = "";
113
+ $oParserState->consume("U+");
114
+ do {
115
+ if ($oParserState->comes('-')) $iCodepointMaxLenth = 13; // Max length is 2 six digit code points + the dash(-) between them
116
+ $sRange .= $oParserState->consume(1);
117
+ } while (strlen($sRange) < $iCodepointMaxLenth && preg_match("/[A-Fa-f0-9\?-]/", $oParserState->peek()));
118
+ return "U+{$sRange}";
119
+ }
120
+
121
+ /**
122
+ * @return int
123
+ */
124
+ public function getLineNo() {
125
+ return $this->iLineNo;
126
+ }
127
+
128
+ //Methods are commented out because re-declaring them here is a fatal error in PHP < 5.3.9
129
+ //public abstract function __toString();
130
+ //public abstract function render(\Sabberworm\CSS\OutputFormat $oOutputFormat);
131
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/ValueList.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\Value;
4
+
5
+ abstract class ValueList extends Value {
6
+
7
+ protected $aComponents;
8
+ protected $sSeparator;
9
+
10
+ public function __construct($aComponents = array(), $sSeparator = ',', $iLineNo = 0) {
11
+ parent::__construct($iLineNo);
12
+ if (!is_array($aComponents)) {
13
+ $aComponents = array($aComponents);
14
+ }
15
+ $this->aComponents = $aComponents;
16
+ $this->sSeparator = $sSeparator;
17
+ }
18
+
19
+ public function addListComponent($mComponent) {
20
+ $this->aComponents[] = $mComponent;
21
+ }
22
+
23
+ public function getListComponents() {
24
+ return $this->aComponents;
25
+ }
26
+
27
+ public function setListComponents($aComponents) {
28
+ $this->aComponents = $aComponents;
29
+ }
30
+
31
+ public function getListSeparator() {
32
+ return $this->sSeparator;
33
+ }
34
+
35
+ public function setListSeparator($sSeparator) {
36
+ $this->sSeparator = $sSeparator;
37
+ }
38
+
39
+ public function __toString() {
40
+ return $this->render(new \Sabberworm\CSS\OutputFormat());
41
+ }
42
+
43
+ public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
44
+ return $oOutputFormat->implode($oOutputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator . $oOutputFormat->spaceAfterListArgumentSeparator($this->sSeparator), $this->aComponents);
45
+ }
46
+
47
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/AtRuleBlockListTest.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\Parser;
6
+
7
+ class AtRuleBlockListTest extends \PHPUnit_Framework_TestCase {
8
+
9
+ public function testMediaQueries() {
10
+ $sCss = '@media(min-width: 768px){.class{color:red}}';
11
+ $oParser = new Parser($sCss);
12
+ $oDoc = $oParser->parse();
13
+ $aContents = $oDoc->getContents();
14
+ $oMediaQuery = $aContents[0];
15
+ $this->assertSame('media', $oMediaQuery->atRuleName(), 'Does not interpret the type as a function');
16
+ $this->assertSame('(min-width: 768px)', $oMediaQuery->atRuleArgs(), 'The media query is the value');
17
+
18
+ $sCss = '@media (min-width: 768px) {.class{color:red}}';
19
+ $oParser = new Parser($sCss);
20
+ $oDoc = $oParser->parse();
21
+ $aContents = $oDoc->getContents();
22
+ $oMediaQuery = $aContents[0];
23
+ $this->assertSame('media', $oMediaQuery->atRuleName(), 'Does not interpret the type as a function');
24
+ $this->assertSame('(min-width: 768px)', $oMediaQuery->atRuleArgs(), 'The media query is the value');
25
+ }
26
+
27
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/CSSList/DocumentTest.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\CSSList;
4
+
5
+ use Sabberworm\CSS\Parser;
6
+
7
+ class DocumentTest extends \PHPUnit_Framework_TestCase {
8
+
9
+ public function testOverrideContents() {
10
+ $sCss = '.thing { left: 10px; }';
11
+ $oParser = new Parser($sCss);
12
+ $oDoc = $oParser->parse();
13
+ $aContents = $oDoc->getContents();
14
+ $this->assertCount(1, $aContents);
15
+
16
+ $sCss2 = '.otherthing { right: 10px; }';
17
+ $oParser2 = new Parser($sCss);
18
+ $oDoc2 = $oParser2->parse();
19
+ $aContents2 = $oDoc2->getContents();
20
+
21
+ $oDoc->setContents(array($aContents[0], $aContents2[0]));
22
+ $aFinalContents = $oDoc->getContents();
23
+ $this->assertCount(2, $aFinalContents);
24
+ }
25
+
26
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/OutputFormatTest.php ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS;
4
+
5
+ use Sabberworm\CSS\Parser;
6
+ use Sabberworm\CSS\OutputFormat;
7
+
8
+ global $TEST_CSS;
9
+
10
+ $TEST_CSS = <<<EOT
11
+
12
+ .main, .test {
13
+ font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;
14
+ background: white;
15
+ }
16
+
17
+ @media screen {
18
+ .main {
19
+ background-size: 100% 100%;
20
+ font-size: 1.3em;
21
+ background-color: #fff;
22
+ }
23
+ }
24
+
25
+ EOT;
26
+
27
+ class OutputFormatTest extends \PHPUnit_Framework_TestCase {
28
+ private $oParser;
29
+ private $oDocument;
30
+
31
+ function setUp() {
32
+ global $TEST_CSS;
33
+ $this->oParser = new Parser($TEST_CSS);
34
+ $this->oDocument = $this->oParser->parse();
35
+ }
36
+
37
+ public function testPlain() {
38
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
39
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render());
40
+ }
41
+
42
+ public function testCompact() {
43
+ $this->assertSame('.main,.test{font:italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background:white;}@media screen{.main{background-size:100% 100%;font-size:1.3em;background-color:#fff;}}', $this->oDocument->render(OutputFormat::createCompact()));
44
+ }
45
+
46
+ public function testPretty() {
47
+ global $TEST_CSS;
48
+ $this->assertSame($TEST_CSS, $this->oDocument->render(OutputFormat::createPretty()));
49
+ }
50
+
51
+ public function testSpaceAfterListArgumentSeparator() {
52
+ $this->assertSame('.main, .test {font: italic normal bold 16px/ 1.2 "Helvetica", Verdana, sans-serif;background: white;}
53
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator(" ")));
54
+ }
55
+
56
+ public function testSpaceAfterListArgumentSeparatorComplex() {
57
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica", Verdana, sans-serif;background: white;}
58
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterListArgumentSeparator(array('default' => ' ', ',' => "\t", '/' => '', ' ' => ''))));
59
+ }
60
+
61
+ public function testSpaceAfterSelectorSeparator() {
62
+ $this->assertSame('.main,
63
+ .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
64
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterSelectorSeparator("\n")));
65
+ }
66
+
67
+ public function testStringQuotingType() {
68
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 \'Helvetica\',Verdana,sans-serif;background: white;}
69
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setStringQuotingType("'")));
70
+ }
71
+
72
+ public function testRGBHashNotation() {
73
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
74
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: rgb(255,255,255);}}', $this->oDocument->render(OutputFormat::create()->setRGBHashNotation(false)));
75
+ }
76
+
77
+ public function testSemicolonAfterLastRule() {
78
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white}
79
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff}}', $this->oDocument->render(OutputFormat::create()->setSemicolonAfterLastRule(false)));
80
+ }
81
+
82
+ public function testSpaceAfterRuleName() {
83
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
84
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceAfterRuleName("\t")));
85
+ }
86
+
87
+ public function testSpaceRules() {
88
+ $this->assertSame('.main, .test {
89
+ font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
90
+ background: white;
91
+ }
92
+ @media screen {.main {
93
+ background-size: 100% 100%;
94
+ font-size: 1.3em;
95
+ background-color: #fff;
96
+ }}', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")));
97
+ }
98
+
99
+ public function testSpaceBlocks() {
100
+ $this->assertSame('
101
+ .main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
102
+ @media screen {
103
+ .main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
104
+ }
105
+ ', $this->oDocument->render(OutputFormat::create()->set('Space*Blocks', "\n")));
106
+ }
107
+
108
+ public function testSpaceBoth() {
109
+ $this->assertSame('
110
+ .main, .test {
111
+ font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
112
+ background: white;
113
+ }
114
+ @media screen {
115
+ .main {
116
+ background-size: 100% 100%;
117
+ font-size: 1.3em;
118
+ background-color: #fff;
119
+ }
120
+ }
121
+ ', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")));
122
+ }
123
+
124
+ public function testSpaceBetweenBlocks() {
125
+ $this->assertSame('.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceBetweenBlocks('')));
126
+ }
127
+
128
+ public function testIndentation() {
129
+ $this->assertSame('
130
+ .main, .test {
131
+ font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
132
+ background: white;
133
+ }
134
+ @media screen {
135
+ .main {
136
+ background-size: 100% 100%;
137
+ font-size: 1.3em;
138
+ background-color: #fff;
139
+ }
140
+ }
141
+ ', $this->oDocument->render(OutputFormat::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")->setIndentation('')));
142
+ }
143
+
144
+ public function testSpaceBeforeBraces() {
145
+ $this->assertSame('.main, .test{font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
146
+ @media screen{.main{background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setSpaceBeforeOpeningBrace('')));
147
+ }
148
+
149
+ /**
150
+ * @expectedException Sabberworm\CSS\Parsing\OutputException
151
+ */
152
+ public function testIgnoreExceptionsOff() {
153
+ $aBlocks = $this->oDocument->getAllDeclarationBlocks();
154
+ $oFirstBlock = $aBlocks[0];
155
+ $oFirstBlock->removeSelector('.main');
156
+ $this->assertSame('.test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
157
+ @media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(false)));
158
+ $oFirstBlock->removeSelector('.test');
159
+ $this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(false));
160
+ }
161
+
162
+ public function testIgnoreExceptionsOn() {
163
+ $aBlocks = $this->oDocument->getAllDeclarationBlocks();
164
+ $oFirstBlock = $aBlocks[0];
165
+ $oFirstBlock->removeSelector('.main');
166
+ $oFirstBlock->removeSelector('.test');
167
+ $this->assertSame('@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}}', $this->oDocument->render(OutputFormat::create()->setIgnoreExceptions(true)));
168
+ }
169
+
170
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/ParserTest.php ADDED
@@ -0,0 +1,707 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS;
4
+
5
+ use Sabberworm\CSS\CSSList\KeyFrame;
6
+ use Sabberworm\CSS\Value\Size;
7
+ use Sabberworm\CSS\Property\Selector;
8
+ use Sabberworm\CSS\RuleSet\DeclarationBlock;
9
+ use Sabberworm\CSS\Property\AtRule;
10
+ use Sabberworm\CSS\Value\URL;
11
+ use Sabberworm\CSS\Parsing\UnexpectedTokenException;
12
+
13
+ class ParserTest extends \PHPUnit_Framework_TestCase {
14
+
15
+ function testFiles() {
16
+ $sDirectory = dirname(__FILE__) . '/../../files';
17
+ if ($rHandle = opendir($sDirectory)) {
18
+ /* This is the correct way to loop over the directory. */
19
+ while (false !== ($sFileName = readdir($rHandle))) {
20
+ if (strpos($sFileName, '.') === 0) {
21
+ continue;
22
+ }
23
+ if (strrpos($sFileName, '.css') !== strlen($sFileName) - strlen('.css')) {
24
+ continue;
25
+ }
26
+ if (strpos($sFileName, '-') === 0) {
27
+ //Either a file which SHOULD fail (at least in strict mode) or a future test of a as-of-now missing feature
28
+ continue;
29
+ }
30
+ $oParser = new Parser(file_get_contents($sDirectory . DIRECTORY_SEPARATOR . $sFileName));
31
+ try {
32
+ $this->assertNotEquals('', $oParser->parse()->render());
33
+ } catch (\Exception $e) {
34
+ $this->fail($e);
35
+ }
36
+ }
37
+ closedir($rHandle);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * @depends testFiles
43
+ */
44
+ function testColorParsing() {
45
+ $oDoc = $this->parsedStructureForFile('colortest');
46
+ foreach ($oDoc->getAllRuleSets() as $oRuleSet) {
47
+ if (!$oRuleSet instanceof DeclarationBlock) {
48
+ continue;
49
+ }
50
+ $sSelector = $oRuleSet->getSelectors();
51
+ $sSelector = $sSelector[0]->getSelector();
52
+ if ($sSelector === '#mine') {
53
+ $aColorRule = $oRuleSet->getRules('color');
54
+ $oColor = $aColorRule[0]->getValue();
55
+ $this->assertSame('red', $oColor);
56
+ $aColorRule = $oRuleSet->getRules('background-');
57
+ $oColor = $aColorRule[0]->getValue();
58
+ $this->assertEquals(array('r' => new Size(35.0, null, true, $oColor->getLineNo()), 'g' => new Size(35.0, null, true, $oColor->getLineNo()), 'b' => new Size(35.0, null, true, $oColor->getLineNo())), $oColor->getColor());
59
+ $aColorRule = $oRuleSet->getRules('border-color');
60
+ $oColor = $aColorRule[0]->getValue();
61
+ $this->assertEquals(array('r' => new Size(10.0, null, true, $oColor->getLineNo()), 'g' => new Size(100.0, null, true, $oColor->getLineNo()), 'b' => new Size(230.0, null, true, $oColor->getLineNo())), $oColor->getColor());
62
+ $oColor = $aColorRule[1]->getValue();
63
+ $this->assertEquals(array('r' => new Size(10.0, null, true, $oColor->getLineNo()), 'g' => new Size(100.0, null, true, $oColor->getLineNo()), 'b' => new Size(231.0, null, true, $oColor->getLineNo()), 'a' => new Size("0000.3", null, true, $oColor->getLineNo())), $oColor->getColor());
64
+ $aColorRule = $oRuleSet->getRules('outline-color');
65
+ $oColor = $aColorRule[0]->getValue();
66
+ $this->assertEquals(array('r' => new Size(34.0, null, true, $oColor->getLineNo()), 'g' => new Size(34.0, null, true, $oColor->getLineNo()), 'b' => new Size(34.0, null, true, $oColor->getLineNo())), $oColor->getColor());
67
+ } else if($sSelector === '#yours') {
68
+ $aColorRule = $oRuleSet->getRules('background-color');
69
+ $oColor = $aColorRule[0]->getValue();
70
+ $this->assertEquals(array('h' => new Size(220.0, null, true, $oColor->getLineNo()), 's' => new Size(10.0, '%', true, $oColor->getLineNo()), 'l' => new Size(220.0, '%', true, $oColor->getLineNo())), $oColor->getColor());
71
+ $oColor = $aColorRule[1]->getValue();
72
+ $this->assertEquals(array('h' => new Size(220.0, null, true, $oColor->getLineNo()), 's' => new Size(10.0, '%', true, $oColor->getLineNo()), 'l' => new Size(220.0, '%', true, $oColor->getLineNo()), 'a' => new Size(0000.3, null, true, $oColor->getLineNo())), $oColor->getColor());
73
+ }
74
+ }
75
+ foreach ($oDoc->getAllValues('color') as $sColor) {
76
+ $this->assertSame('red', $sColor);
77
+ }
78
+ $this->assertSame('#mine {color: red;border-color: #0a64e6;border-color: rgba(10,100,231,.3);outline-color: #222;background-color: #232323;}
79
+ #yours {background-color: hsl(220,10%,220%);background-color: hsla(220,10%,220%,.3);}', $oDoc->render());
80
+ }
81
+
82
+ function testUnicodeParsing() {
83
+ $oDoc = $this->parsedStructureForFile('unicode');
84
+ foreach ($oDoc->getAllDeclarationBlocks() as $oRuleSet) {
85
+ $sSelector = $oRuleSet->getSelectors();
86
+ $sSelector = $sSelector[0]->getSelector();
87
+ if (substr($sSelector, 0, strlen('.test-')) !== '.test-') {
88
+ continue;
89
+ }
90
+ $aContentRules = $oRuleSet->getRules('content');
91
+ $aContents = $aContentRules[0]->getValues();
92
+ $sString = $aContents[0][0]->__toString();
93
+ if ($sSelector == '.test-1') {
94
+ $this->assertSame('" "', $sString);
95
+ }
96
+ if ($sSelector == '.test-2') {
97
+ $this->assertSame('"é"', $sString);
98
+ }
99
+ if ($sSelector == '.test-3') {
100
+ $this->assertSame('" "', $sString);
101
+ }
102
+ if ($sSelector == '.test-4') {
103
+ $this->assertSame('"𝄞"', $sString);
104
+ }
105
+ if ($sSelector == '.test-5') {
106
+ $this->assertSame('"水"', $sString);
107
+ }
108
+ if ($sSelector == '.test-6') {
109
+ $this->assertSame('"¥"', $sString);
110
+ }
111
+ if ($sSelector == '.test-7') {
112
+ $this->assertSame('"\A"', $sString);
113
+ }
114
+ if ($sSelector == '.test-8') {
115
+ $this->assertSame('"\"\""', $sString);
116
+ }
117
+ if ($sSelector == '.test-9') {
118
+ $this->assertSame('"\"\\\'"', $sString);
119
+ }
120
+ if ($sSelector == '.test-10') {
121
+ $this->assertSame('"\\\'\\\\"', $sString);
122
+ }
123
+ if ($sSelector == '.test-11') {
124
+ $this->assertSame('"test"', $sString);
125
+ }
126
+ }
127
+ }
128
+
129
+ function testUnicodeRangeParsing() {
130
+ $oDoc = $this->parsedStructureForFile('unicode-range');
131
+ $sExpected = "@font-face {unicode-range: U+0100-024F,U+0259,U+1E??-2EFF,U+202F;}";
132
+ $this->assertSame($sExpected, $oDoc->render());
133
+ }
134
+
135
+ function testSpecificity() {
136
+ $oDoc = $this->parsedStructureForFile('specificity');
137
+ $oDeclarationBlock = $oDoc->getAllDeclarationBlocks();
138
+ $oDeclarationBlock = $oDeclarationBlock[0];
139
+ $aSelectors = $oDeclarationBlock->getSelectors();
140
+ foreach ($aSelectors as $oSelector) {
141
+ switch ($oSelector->getSelector()) {
142
+ case "#test .help":
143
+ $this->assertSame(110, $oSelector->getSpecificity());
144
+ break;
145
+ case "#file":
146
+ $this->assertSame(100, $oSelector->getSpecificity());
147
+ break;
148
+ case ".help:hover":
149
+ $this->assertSame(20, $oSelector->getSpecificity());
150
+ break;
151
+ case "ol li::before":
152
+ $this->assertSame(3, $oSelector->getSpecificity());
153
+ break;
154
+ case "li.green":
155
+ $this->assertSame(11, $oSelector->getSpecificity());
156
+ break;
157
+ default:
158
+ $this->fail("specificity: untested selector " . $oSelector->getSelector());
159
+ }
160
+ }
161
+ $this->assertEquals(array(new Selector('#test .help', true)), $oDoc->getSelectorsBySpecificity('> 100'));
162
+ }
163
+
164
+ function testManipulation() {
165
+ $oDoc = $this->parsedStructureForFile('atrules');
166
+ $this->assertSame('@charset "utf-8";
167
+ @font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}
168
+ html, body {font-size: -.6em;}
169
+ @keyframes mymove {from {top: 0px;}
170
+ to {top: 200px;}}
171
+ @-moz-keyframes some-move {from {top: 0px;}
172
+ to {top: 200px;}}
173
+ @supports ( (perspective: 10px) or (-moz-perspective: 10px) or (-webkit-perspective: 10px) or (-ms-perspective: 10px) or (-o-perspective: 10px) ) {body {font-family: "Helvetica";}}
174
+ @page :pseudo-class {margin: 2in;}
175
+ @-moz-document url(http://www.w3.org/),
176
+ url-prefix(http://www.w3.org/Style/),
177
+ domain(mozilla.org),
178
+ regexp("https:.*") {body {color: purple;background: yellow;}}
179
+ @media screen and (orientation: landscape) {@-ms-viewport {width: 1024px;height: 768px;}}
180
+ @region-style #intro {p {color: blue;}}', $oDoc->render());
181
+ foreach ($oDoc->getAllDeclarationBlocks() as $oBlock) {
182
+ foreach ($oBlock->getSelectors() as $oSelector) {
183
+ //Loop over all selector parts (the comma-separated strings in a selector) and prepend the id
184
+ $oSelector->setSelector('#my_id ' . $oSelector->getSelector());
185
+ }
186
+ }
187
+ $this->assertSame('@charset "utf-8";
188
+ @font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}
189
+ #my_id html, #my_id body {font-size: -.6em;}
190
+ @keyframes mymove {from {top: 0px;}
191
+ to {top: 200px;}}
192
+ @-moz-keyframes some-move {from {top: 0px;}
193
+ to {top: 200px;}}
194
+ @supports ( (perspective: 10px) or (-moz-perspective: 10px) or (-webkit-perspective: 10px) or (-ms-perspective: 10px) or (-o-perspective: 10px) ) {#my_id body {font-family: "Helvetica";}}
195
+ @page :pseudo-class {margin: 2in;}
196
+ @-moz-document url(http://www.w3.org/),
197
+ url-prefix(http://www.w3.org/Style/),
198
+ domain(mozilla.org),
199
+ regexp("https:.*") {#my_id body {color: purple;background: yellow;}}
200
+ @media screen and (orientation: landscape) {@-ms-viewport {width: 1024px;height: 768px;}}
201
+ @region-style #intro {#my_id p {color: blue;}}', $oDoc->render());
202
+
203
+ $oDoc = $this->parsedStructureForFile('values');
204
+ $this->assertSame('#header {margin: 10px 2em 1cm 2%;font-family: Verdana,Helvetica,"Gill Sans",sans-serif;font-size: 10px;color: red !important;background-color: green;background-color: rgba(0,128,0,.7);frequency: 30Hz;}
205
+ body {color: green;font: 75% "Lucida Grande","Trebuchet MS",Verdana,sans-serif;}', $oDoc->render());
206
+ foreach ($oDoc->getAllRuleSets() as $oRuleSet) {
207
+ $oRuleSet->removeRule('font-');
208
+ }
209
+ $this->assertSame('#header {margin: 10px 2em 1cm 2%;color: red !important;background-color: green;background-color: rgba(0,128,0,.7);frequency: 30Hz;}
210
+ body {color: green;}', $oDoc->render());
211
+ foreach ($oDoc->getAllRuleSets() as $oRuleSet) {
212
+ $oRuleSet->removeRule('background-');
213
+ }
214
+ $this->assertSame('#header {margin: 10px 2em 1cm 2%;color: red !important;frequency: 30Hz;}
215
+ body {color: green;}', $oDoc->render());
216
+ }
217
+
218
+ function testRuleGetters() {
219
+ $oDoc = $this->parsedStructureForFile('values');
220
+ $aBlocks = $oDoc->getAllDeclarationBlocks();
221
+ $oHeaderBlock = $aBlocks[0];
222
+ $oBodyBlock = $aBlocks[1];
223
+ $aHeaderRules = $oHeaderBlock->getRules('background-');
224
+ $this->assertSame(2, count($aHeaderRules));
225
+ $this->assertSame('background-color', $aHeaderRules[0]->getRule());
226
+ $this->assertSame('background-color', $aHeaderRules[1]->getRule());
227
+ $aHeaderRules = $oHeaderBlock->getRulesAssoc('background-');
228
+ $this->assertSame(1, count($aHeaderRules));
229
+ $this->assertSame(true, $aHeaderRules['background-color']->getValue() instanceof \Sabberworm\CSS\Value\Color);
230
+ $this->assertSame('rgba', $aHeaderRules['background-color']->getValue()->getColorDescription());
231
+ $oHeaderBlock->removeRule($aHeaderRules['background-color']);
232
+ $aHeaderRules = $oHeaderBlock->getRules('background-');
233
+ $this->assertSame(1, count($aHeaderRules));
234
+ $this->assertSame('green', $aHeaderRules[0]->getValue());
235
+ }
236
+
237
+ function testSlashedValues() {
238
+ $oDoc = $this->parsedStructureForFile('slashed');
239
+ $this->assertSame('.test {font: 12px/1.5 Verdana,Arial,sans-serif;border-radius: 5px 10px 5px 10px/10px 5px 10px 5px;}', $oDoc->render());
240
+ foreach ($oDoc->getAllValues(null) as $mValue) {
241
+ if ($mValue instanceof Size && $mValue->isSize() && !$mValue->isRelative()) {
242
+ $mValue->setSize($mValue->getSize() * 3);
243
+ }
244
+ }
245
+ foreach ($oDoc->getAllDeclarationBlocks() as $oBlock) {
246
+ $oRule = $oBlock->getRules('font');
247
+ $oRule = $oRule[0];
248
+ $oSpaceList = $oRule->getValue();
249
+ $this->assertEquals(' ', $oSpaceList->getListSeparator());
250
+ $oSlashList = $oSpaceList->getListComponents();
251
+ $oCommaList = $oSlashList[1];
252
+ $oSlashList = $oSlashList[0];
253
+ $this->assertEquals(',', $oCommaList->getListSeparator());
254
+ $this->assertEquals('/', $oSlashList->getListSeparator());
255
+ $oRule = $oBlock->getRules('border-radius');
256
+ $oRule = $oRule[0];
257
+ $oSlashList = $oRule->getValue();
258
+ $this->assertEquals('/', $oSlashList->getListSeparator());
259
+ $oSpaceList1 = $oSlashList->getListComponents();
260
+ $oSpaceList2 = $oSpaceList1[1];
261
+ $oSpaceList1 = $oSpaceList1[0];
262
+ $this->assertEquals(' ', $oSpaceList1->getListSeparator());
263
+ $this->assertEquals(' ', $oSpaceList2->getListSeparator());
264
+ }
265
+ $this->assertSame('.test {font: 36px/1.5 Verdana,Arial,sans-serif;border-radius: 15px 30px 15px 30px/30px 15px 30px 15px;}', $oDoc->render());
266
+ }
267
+
268
+ function testFunctionSyntax() {
269
+ $oDoc = $this->parsedStructureForFile('functions');
270
+ $sExpected = 'div.main {background-image: linear-gradient(#000,#fff);}
271
+ .collapser::before, .collapser::-moz-before, .collapser::-webkit-before {content: "»";font-size: 1.2em;margin-right: .2em;-moz-transition-property: -moz-transform;-moz-transition-duration: .2s;-moz-transform-origin: center 60%;}
272
+ .collapser.expanded::before, .collapser.expanded::-moz-before, .collapser.expanded::-webkit-before {-moz-transform: rotate(90deg);}
273
+ .collapser + * {height: 0;overflow: hidden;-moz-transition-property: height;-moz-transition-duration: .3s;}
274
+ .collapser.expanded + * {height: auto;}';
275
+ $this->assertSame($sExpected, $oDoc->render());
276
+
277
+ foreach ($oDoc->getAllValues(null, true) as $mValue) {
278
+ if ($mValue instanceof Size && $mValue->isSize()) {
279
+ $mValue->setSize($mValue->getSize() * 3);
280
+ }
281
+ }
282
+ $sExpected = str_replace(array('1.2em', '.2em', '60%'), array('3.6em', '.6em', '180%'), $sExpected);
283
+ $this->assertSame($sExpected, $oDoc->render());
284
+
285
+ foreach ($oDoc->getAllValues(null, true) as $mValue) {
286
+ if ($mValue instanceof Size && !$mValue->isRelative() && !$mValue->isColorComponent()) {
287
+ $mValue->setSize($mValue->getSize() * 2);
288
+ }
289
+ }
290
+ $sExpected = str_replace(array('.2s', '.3s', '90deg'), array('.4s', '.6s', '180deg'), $sExpected);
291
+ $this->assertSame($sExpected, $oDoc->render());
292
+ }
293
+
294
+ function testExpandShorthands() {
295
+ $oDoc = $this->parsedStructureForFile('expand-shorthands');
296
+ $sExpected = 'body {font: italic 500 14px/1.618 "Trebuchet MS",Georgia,serif;border: 2px solid #f0f;background: #ccc url("/images/foo.png") no-repeat left top;margin: 1em !important;padding: 2px 6px 3px;}';
297
+ $this->assertSame($sExpected, $oDoc->render());
298
+ $oDoc->expandShorthands();
299
+ $sExpected = 'body {margin-top: 1em !important;margin-right: 1em !important;margin-bottom: 1em !important;margin-left: 1em !important;padding-top: 2px;padding-right: 6px;padding-bottom: 3px;padding-left: 6px;border-top-color: #f0f;border-right-color: #f0f;border-bottom-color: #f0f;border-left-color: #f0f;border-top-style: solid;border-right-style: solid;border-bottom-style: solid;border-left-style: solid;border-top-width: 2px;border-right-width: 2px;border-bottom-width: 2px;border-left-width: 2px;font-style: italic;font-variant: normal;font-weight: 500;font-size: 14px;line-height: 1.618;font-family: "Trebuchet MS",Georgia,serif;background-color: #ccc;background-image: url("/images/foo.png");background-repeat: no-repeat;background-attachment: scroll;background-position: left top;}';
300
+ $this->assertSame($sExpected, $oDoc->render());
301
+ }
302
+
303
+ function testCreateShorthands() {
304
+ $oDoc = $this->parsedStructureForFile('create-shorthands');
305
+ $sExpected = 'body {font-size: 2em;font-family: Helvetica,Arial,sans-serif;font-weight: bold;border-width: 2px;border-color: #999;border-style: dotted;background-color: #fff;background-image: url("foobar.png");background-repeat: repeat-y;margin-top: 2px;margin-right: 3px;margin-bottom: 4px;margin-left: 5px;}';
306
+ $this->assertSame($sExpected, $oDoc->render());
307
+ $oDoc->createShorthands();
308
+ $sExpected = 'body {background: #fff url("foobar.png") repeat-y;margin: 2px 5px 4px 3px;border: 2px dotted #999;font: bold 2em Helvetica,Arial,sans-serif;}';
309
+ $this->assertSame($sExpected, $oDoc->render());
310
+ }
311
+
312
+ function testNamespaces() {
313
+ $oDoc = $this->parsedStructureForFile('namespaces');
314
+ $sExpected = '@namespace toto "http://toto.example.org";
315
+ @namespace "http://example.com/foo";
316
+ @namespace foo url("http://www.example.com/");
317
+ @namespace foo url("http://www.example.com/");
318
+ foo|test {gaga: 1;}
319
+ |test {gaga: 2;}';
320
+ $this->assertSame($sExpected, $oDoc->render());
321
+ }
322
+
323
+ function testInnerColors() {
324
+ $oDoc = $this->parsedStructureForFile('inner-color');
325
+ $sExpected = 'test {background: -webkit-gradient(linear,0 0,0 bottom,from(#006cad),to(hsl(202,100%,49%)));}';
326
+ $this->assertSame($sExpected, $oDoc->render());
327
+ }
328
+
329
+ function testPrefixedGradient() {
330
+ $oDoc = $this->parsedStructureForFile('webkit');
331
+ $sExpected = '.test {background: -webkit-linear-gradient(top right,white,black);}';
332
+ $this->assertSame($sExpected, $oDoc->render());
333
+ }
334
+
335
+ function testListValueRemoval() {
336
+ $oDoc = $this->parsedStructureForFile('atrules');
337
+ foreach ($oDoc->getContents() as $oItem) {
338
+ if ($oItem instanceof AtRule) {
339
+ $oDoc->remove($oItem);
340
+ continue;
341
+ }
342
+ }
343
+ $this->assertSame('html, body {font-size: -.6em;}', $oDoc->render());
344
+
345
+ $oDoc = $this->parsedStructureForFile('nested');
346
+ foreach ($oDoc->getAllDeclarationBlocks() as $oBlock) {
347
+ $oDoc->removeDeclarationBlockBySelector($oBlock, false);
348
+ break;
349
+ }
350
+ $this->assertSame('html {some-other: -test(val1);}
351
+ @media screen {html {some: -test(val2);}}
352
+ #unrelated {other: yes;}', $oDoc->render());
353
+
354
+ $oDoc = $this->parsedStructureForFile('nested');
355
+ foreach ($oDoc->getAllDeclarationBlocks() as $oBlock) {
356
+ $oDoc->removeDeclarationBlockBySelector($oBlock, true);
357
+ break;
358
+ }
359
+ $this->assertSame('@media screen {html {some: -test(val2);}}
360
+ #unrelated {other: yes;}', $oDoc->render());
361
+ }
362
+
363
+ /**
364
+ * @expectedException Sabberworm\CSS\Parsing\OutputException
365
+ */
366
+ function testSelectorRemoval() {
367
+ $oDoc = $this->parsedStructureForFile('1readme');
368
+ $aBlocks = $oDoc->getAllDeclarationBlocks();
369
+ $oBlock1 = $aBlocks[0];
370
+ $this->assertSame(true, $oBlock1->removeSelector('html'));
371
+ $sExpected = '@charset "utf-8";
372
+ @font-face {font-family: "CrassRoots";src: url("../media/cr.ttf");}
373
+ body {font-size: 1.6em;}';
374
+ $this->assertSame($sExpected, $oDoc->render());
375
+ $this->assertSame(false, $oBlock1->removeSelector('html'));
376
+ $this->assertSame(true, $oBlock1->removeSelector('body'));
377
+ // This tries to output a declaration block without a selector and throws.
378
+ $oDoc->render();
379
+ }
380
+
381
+ function testComments() {
382
+ $oDoc = $this->parsedStructureForFile('comments');
383
+ $sExpected = '@import url("some/url.css") screen;
384
+ .foo, #bar {background-color: #000;}
385
+ @media screen {#foo.bar {position: absolute;}}';
386
+ $this->assertSame($sExpected, $oDoc->render());
387
+ }
388
+
389
+ function testUrlInFile() {
390
+ $oDoc = $this->parsedStructureForFile('url', Settings::create()->withMultibyteSupport(true));
391
+ $sExpected = 'body {background: #fff url("http://somesite.com/images/someimage.gif") repeat top center;}
392
+ body {background-url: url("http://somesite.com/images/someimage.gif");}';
393
+ $this->assertSame($sExpected, $oDoc->render());
394
+ }
395
+
396
+ function testHexAlphaInFile() {
397
+ $oDoc = $this->parsedStructureForFile('hex-alpha', Settings::create()->withMultibyteSupport(true));
398
+ $sExpected = 'div {background: rgba(17,34,51,.27);}
399
+ div {background: rgba(17,34,51,.27);}';
400
+ $this->assertSame($sExpected, $oDoc->render());
401
+ }
402
+
403
+ function testCalcInFile() {
404
+ $oDoc = $this->parsedStructureForFile('calc', Settings::create()->withMultibyteSupport(true));
405
+ $sExpected = 'div {width: calc(100% / 4);}
406
+ div {margin-top: calc(-120% - 4px);}
407
+ div {height: -webkit-calc(9 / 16 * 100%) !important;width: -moz-calc(( 50px - 50% ) * 2);}';
408
+ $this->assertSame($sExpected, $oDoc->render());
409
+ }
410
+
411
+ function testCalcNestedInFile() {
412
+ $oDoc = $this->parsedStructureForFile('calc-nested', Settings::create()->withMultibyteSupport(true));
413
+ $sExpected = '.test {font-size: calc(( 3 * 4px ) + -2px);top: calc(200px - calc(20 * 3px));}';
414
+ $this->assertSame($sExpected, $oDoc->render());
415
+ }
416
+
417
+ function testGridLineNameInFile() {
418
+ $oDoc = $this->parsedStructureForFile('grid-linename', Settings::create()->withMultibyteSupport(true));
419
+ $sExpected = "div {grid-template-columns: [linename] 100px;}\nspan {grid-template-columns: [linename1 linename2] 100px;}";
420
+ $this->assertSame($sExpected, $oDoc->render());
421
+ }
422
+
423
+ function testEmptyGridLineNameLenientInFile() {
424
+ $oDoc = $this->parsedStructureForFile('empty-grid-linename');
425
+ $sExpected = '.test {grid-template-columns: [] 100px;}';
426
+ $this->assertSame($sExpected, $oDoc->render());
427
+ }
428
+
429
+ function testUnmatchedBracesInFile() {
430
+ $oDoc = $this->parsedStructureForFile('unmatched_braces', Settings::create()->withMultibyteSupport(true));
431
+ $sExpected = 'button, input, checkbox, textarea {outline: 0;margin: 0;}';
432
+ $this->assertSame($sExpected, $oDoc->render());
433
+ }
434
+
435
+ /**
436
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
437
+ */
438
+ function testLineNameFailure() {
439
+ $this->parsedStructureForFile('-empty-grid-linename', Settings::create()->withLenientParsing(false));
440
+ }
441
+
442
+ /**
443
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
444
+ */
445
+ function testCalcFailure() {
446
+ $this->parsedStructureForFile('-calc-no-space-around-minus', Settings::create()->withLenientParsing(false));
447
+ }
448
+
449
+ function testUrlInFileMbOff() {
450
+ $oDoc = $this->parsedStructureForFile('url', Settings::create()->withMultibyteSupport(false));
451
+ $sExpected = 'body {background: #fff url("http://somesite.com/images/someimage.gif") repeat top center;}
452
+ body {background-url: url("http://somesite.com/images/someimage.gif");}';
453
+ $this->assertSame($sExpected, $oDoc->render());
454
+ }
455
+
456
+ function testEmptyFile() {
457
+ $oDoc = $this->parsedStructureForFile('-empty', Settings::create()->withMultibyteSupport(true));
458
+ $sExpected = '';
459
+ $this->assertSame($sExpected, $oDoc->render());
460
+ }
461
+
462
+ function testEmptyFileMbOff() {
463
+ $oDoc = $this->parsedStructureForFile('-empty', Settings::create()->withMultibyteSupport(false));
464
+ $sExpected = '';
465
+ $this->assertSame($sExpected, $oDoc->render());
466
+ }
467
+
468
+ function testCharsetLenient1() {
469
+ $oDoc = $this->parsedStructureForFile('-charset-after-rule', Settings::create()->withLenientParsing(true));
470
+ $sExpected = '#id {prop: var(--val);}';
471
+ $this->assertSame($sExpected, $oDoc->render());
472
+ }
473
+
474
+ function testCharsetLenient2() {
475
+ $oDoc = $this->parsedStructureForFile('-charset-in-block', Settings::create()->withLenientParsing(true));
476
+ $sExpected = '@media print {}';
477
+ $this->assertSame($sExpected, $oDoc->render());
478
+ }
479
+
480
+ function testTrailingWhitespace() {
481
+ $oDoc = $this->parsedStructureForFile('trailing-whitespace', Settings::create()->withLenientParsing(false));
482
+ $sExpected = 'div {width: 200px;}';
483
+ $this->assertSame($sExpected, $oDoc->render());
484
+ }
485
+
486
+ /**
487
+ * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
488
+ */
489
+ function testCharsetFailure1() {
490
+ $this->parsedStructureForFile('-charset-after-rule', Settings::create()->withLenientParsing(false));
491
+ }
492
+
493
+ /**
494
+ * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
495
+ */
496
+ function testCharsetFailure2() {
497
+ $this->parsedStructureForFile('-charset-in-block', Settings::create()->withLenientParsing(false));
498
+ }
499
+
500
+ /**
501
+ * @expectedException \Sabberworm\CSS\Parsing\SourceException
502
+ */
503
+ function testUnopenedClosingBracketFailure() {
504
+ $this->parsedStructureForFile('unopened-close-brackets', Settings::create()->withLenientParsing(false));
505
+ }
506
+
507
+ /**
508
+ * Ensure that a missing property value raises an exception.
509
+ *
510
+ * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
511
+ * @covers \Sabberworm\CSS\Value\Value::parseValue()
512
+ */
513
+ function testMissingPropertyValueStrict() {
514
+ $this->parsedStructureForFile('missing-property-value', Settings::create()->withLenientParsing(false));
515
+ }
516
+
517
+ /**
518
+ * Ensure that a missing property value is ignored when in lenient parsing mode.
519
+ *
520
+ * @covers \Sabberworm\CSS\Value\Value::parseValue()
521
+ */
522
+ function testMissingPropertyValueLenient() {
523
+ $parsed = $this->parsedStructureForFile('missing-property-value', Settings::create()->withLenientParsing(true));
524
+ $rulesets = $parsed->getAllRuleSets();
525
+ $this->assertCount( 1, $rulesets );
526
+ $block = $rulesets[0];
527
+ $this->assertTrue( $block instanceof DeclarationBlock );
528
+ $this->assertEquals( array( 'div' ), $block->getSelectors() );
529
+ $rules = $block->getRules();
530
+ $this->assertCount( 1, $rules );
531
+ $rule = $rules[0];
532
+ $this->assertEquals( 'display', $rule->getRule() );
533
+ $this->assertEquals( 'inline-block', $rule->getValue() );
534
+ }
535
+
536
+ /**
537
+ * Parse structure for file.
538
+ *
539
+ * @param string $sFileName Filename.
540
+ * @param null|obJeCt $oSettings Settings.
541
+ *
542
+ * @return CSSList\Document Parsed document.
543
+ */
544
+ function parsedStructureForFile($sFileName, $oSettings = null) {
545
+ $sFile = dirname(__FILE__) . '/../../files' . DIRECTORY_SEPARATOR . "$sFileName.css";
546
+ $oParser = new Parser(file_get_contents($sFile), $oSettings);
547
+ return $oParser->parse();
548
+ }
549
+
550
+ /**
551
+ * @depends testFiles
552
+ */
553
+ function testLineNumbersParsing() {
554
+ $oDoc = $this->parsedStructureForFile('line-numbers');
555
+ // array key is the expected line number
556
+ $aExpected = array(
557
+ 1 => array('Sabberworm\CSS\Property\Charset'),
558
+ 3 => array('Sabberworm\CSS\Property\CSSNamespace'),
559
+ 5 => array('Sabberworm\CSS\RuleSet\AtRuleSet'),
560
+ 11 => array('Sabberworm\CSS\RuleSet\DeclarationBlock'),
561
+ // Line Numbers of the inner declaration blocks
562
+ 17 => array('Sabberworm\CSS\CSSList\KeyFrame', 18, 20),
563
+ 23 => array('Sabberworm\CSS\Property\Import'),
564
+ 25 => array('Sabberworm\CSS\RuleSet\DeclarationBlock')
565
+ );
566
+
567
+ $aActual = array();
568
+ foreach ($oDoc->getContents() as $oContent) {
569
+ $aActual[$oContent->getLineNo()] = array(get_class($oContent));
570
+ if ($oContent instanceof KeyFrame) {
571
+ foreach ($oContent->getContents() as $block) {
572
+ $aActual[$oContent->getLineNo()][] = $block->getLineNo();
573
+ }
574
+ }
575
+ }
576
+
577
+ $aUrlExpected = array(7, 26); // expected line numbers
578
+ $aUrlActual = array();
579
+ foreach ($oDoc->getAllValues() as $oValue) {
580
+ if ($oValue instanceof URL) {
581
+ $aUrlActual[] = $oValue->getLineNo();
582
+ }
583
+ }
584
+
585
+ // Checking for the multiline color rule lines 27-31
586
+ $aExpectedColorLines = array(28, 29, 30);
587
+ $aDeclBlocks = $oDoc->getAllDeclarationBlocks();
588
+ // Choose the 2nd one
589
+ $oDeclBlock = $aDeclBlocks[1];
590
+ $aRules = $oDeclBlock->getRules();
591
+ // Choose the 2nd one
592
+ $oColor = $aRules[1]->getValue();
593
+ $this->assertEquals(27, $aRules[1]->getLineNo());
594
+
595
+ foreach ($oColor->getColor() as $oSize) {
596
+ $aActualColorLines[] = $oSize->getLineNo();
597
+ }
598
+
599
+ $this->assertEquals($aExpectedColorLines, $aActualColorLines);
600
+ $this->assertEquals($aUrlExpected, $aUrlActual);
601
+ $this->assertEquals($aExpected, $aActual);
602
+ }
603
+
604
+ /**
605
+ * @expectedException \Sabberworm\CSS\Parsing\UnexpectedTokenException
606
+ * Credit: This test by @sabberworm (from https://github.com/sabberworm/PHP-CSS-Parser/pull/105#issuecomment-229643910 )
607
+ */
608
+ function testUnexpectedTokenExceptionLineNo() {
609
+ $oParser = new Parser("\ntest: 1;", Settings::create()->beStrict());
610
+ try {
611
+ $oParser->parse();
612
+ } catch (UnexpectedTokenException $e) {
613
+ $this->assertSame(2, $e->getLineNo());
614
+ throw $e;
615
+ }
616
+ }
617
+
618
+ /**
619
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
620
+ */
621
+ function testIeHacksStrictParsing() {
622
+ // We can't strictly parse IE hacks.
623
+ $this->parsedStructureForFile('ie-hacks', Settings::create()->beStrict());
624
+ }
625
+
626
+ function testIeHacksParsing() {
627
+ $oDoc = $this->parsedStructureForFile('ie-hacks', Settings::create()->withLenientParsing(true));
628
+ $sExpected = 'p {padding-right: .75rem \9;background-image: none \9;color: red \9\0;background-color: red \9\0;background-color: red \9\0 !important;content: "red \0";content: "red઼";}';
629
+ $this->assertEquals($sExpected, $oDoc->render());
630
+ }
631
+
632
+ /**
633
+ * @depends testFiles
634
+ */
635
+ function testCommentExtracting() {
636
+ $oDoc = $this->parsedStructureForFile('comments');
637
+ $aNodes = $oDoc->getContents();
638
+
639
+ // Import property.
640
+ $importComments = $aNodes[0]->getComments();
641
+ $this->assertCount(1, $importComments);
642
+ $this->assertEquals("*\n * Comments Hell.\n ", $importComments[0]->getComment());
643
+
644
+ // Declaration block.
645
+ $fooBarBlock = $aNodes[1];
646
+ $fooBarBlockComments = $fooBarBlock->getComments();
647
+ // TODO Support comments in selectors.
648
+ // $this->assertCount(2, $fooBarBlockComments);
649
+ // $this->assertEquals("* Number 4 *", $fooBarBlockComments[0]->getComment());
650
+ // $this->assertEquals("* Number 5 *", $fooBarBlockComments[1]->getComment());
651
+
652
+ // Declaration rules.
653
+ $fooBarRules = $fooBarBlock->getRules();
654
+ $fooBarRule = $fooBarRules[0];
655
+ $fooBarRuleComments = $fooBarRule->getComments();
656
+ $this->assertCount(1, $fooBarRuleComments);
657
+ $this->assertEquals(" Number 6 ", $fooBarRuleComments[0]->getComment());
658
+
659
+ // Media property.
660
+ $mediaComments = $aNodes[2]->getComments();
661
+ $this->assertCount(0, $mediaComments);
662
+
663
+ // Media children.
664
+ $mediaRules = $aNodes[2]->getContents();
665
+ $fooBarComments = $mediaRules[0]->getComments();
666
+ $this->assertCount(1, $fooBarComments);
667
+ $this->assertEquals("* Number 10 *", $fooBarComments[0]->getComment());
668
+
669
+ // Media -> declaration -> rule.
670
+ $fooBarRules = $mediaRules[0]->getRules();
671
+ $fooBarChildComments = $fooBarRules[0]->getComments();
672
+ $this->assertCount(1, $fooBarChildComments);
673
+ $this->assertEquals("* Number 10b *", $fooBarChildComments[0]->getComment());
674
+ }
675
+
676
+ function testFlatCommentExtracting() {
677
+ $parser = new Parser('div {/*Find Me!*/left:10px; text-align:left;}');
678
+ $doc = $parser->parse();
679
+ $contents = $doc->getContents();
680
+ $divRules = $contents[0]->getRules();
681
+ $comments = $divRules[0]->getComments();
682
+ $this->assertCount(1, $comments);
683
+ $this->assertEquals("Find Me!", $comments[0]->getComment());
684
+ }
685
+
686
+ function testTopLevelCommentExtracting() {
687
+ $parser = new Parser('/*Find Me!*/div {left:10px; text-align:left;}');
688
+ $doc = $parser->parse();
689
+ $contents = $doc->getContents();
690
+ $comments = $contents[0]->getComments();
691
+ $this->assertCount(1, $comments);
692
+ $this->assertEquals("Find Me!", $comments[0]->getComment());
693
+ }
694
+
695
+ /**
696
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
697
+ */
698
+ function testMicrosoftFilterStrictParsing() {
699
+ $oDoc = $this->parsedStructureForFile('ms-filter', Settings::create()->beStrict());
700
+ }
701
+
702
+ function testMicrosoftFilterParsing() {
703
+ $oDoc = $this->parsedStructureForFile('ms-filter');
704
+ $sExpected = ".test {filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\"#80000000\",endColorstr=\"#00000000\",GradientType=1);}";
705
+ $this->assertSame($sExpected, $oDoc->render());
706
+ }
707
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/DeclarationBlockTest.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\RuleSet;
4
+
5
+ use Sabberworm\CSS\Parser;
6
+ use Sabberworm\CSS\Rule\Rule;
7
+ use Sabberworm\CSS\Value\Size;
8
+
9
+ class DeclarationBlockTest extends \PHPUnit_Framework_TestCase {
10
+
11
+ /**
12
+ * @dataProvider expandBorderShorthandProvider
13
+ * */
14
+ public function testExpandBorderShorthand($sCss, $sExpected) {
15
+ $oParser = new Parser($sCss);
16
+ $oDoc = $oParser->parse();
17
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
18
+ $oDeclaration->expandBorderShorthand();
19
+ }
20
+ $this->assertSame(trim((string) $oDoc), $sExpected);
21
+ }
22
+
23
+ public function expandBorderShorthandProvider() {
24
+ return array(
25
+ array('body{ border: 2px solid #000 }', 'body {border-width: 2px;border-style: solid;border-color: #000;}'),
26
+ array('body{ border: none }', 'body {border-style: none;}'),
27
+ array('body{ border: 2px }', 'body {border-width: 2px;}'),
28
+ array('body{ border: #f00 }', 'body {border-color: #f00;}'),
29
+ array('body{ border: 1em solid }', 'body {border-width: 1em;border-style: solid;}'),
30
+ array('body{ margin: 1em; }', 'body {margin: 1em;}')
31
+ );
32
+ }
33
+
34
+ /**
35
+ * @dataProvider expandFontShorthandProvider
36
+ * */
37
+ public function testExpandFontShorthand($sCss, $sExpected) {
38
+ $oParser = new Parser($sCss);
39
+ $oDoc = $oParser->parse();
40
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
41
+ $oDeclaration->expandFontShorthand();
42
+ }
43
+ $this->assertSame(trim((string) $oDoc), $sExpected);
44
+ }
45
+
46
+ public function expandFontShorthandProvider() {
47
+ return array(
48
+ array(
49
+ 'body{ margin: 1em; }',
50
+ 'body {margin: 1em;}'
51
+ ),
52
+ array(
53
+ 'body {font: 12px serif;}',
54
+ 'body {font-style: normal;font-variant: normal;font-weight: normal;font-size: 12px;line-height: normal;font-family: serif;}'
55
+ ),
56
+ array(
57
+ 'body {font: italic 12px serif;}',
58
+ 'body {font-style: italic;font-variant: normal;font-weight: normal;font-size: 12px;line-height: normal;font-family: serif;}'
59
+ ),
60
+ array(
61
+ 'body {font: italic bold 12px serif;}',
62
+ 'body {font-style: italic;font-variant: normal;font-weight: bold;font-size: 12px;line-height: normal;font-family: serif;}'
63
+ ),
64
+ array(
65
+ 'body {font: italic bold 12px/1.6 serif;}',
66
+ 'body {font-style: italic;font-variant: normal;font-weight: bold;font-size: 12px;line-height: 1.6;font-family: serif;}'
67
+ ),
68
+ array(
69
+ 'body {font: italic small-caps bold 12px/1.6 serif;}',
70
+ 'body {font-style: italic;font-variant: small-caps;font-weight: bold;font-size: 12px;line-height: 1.6;font-family: serif;}'
71
+ ),
72
+ );
73
+ }
74
+
75
+ /**
76
+ * @dataProvider expandBackgroundShorthandProvider
77
+ * */
78
+ public function testExpandBackgroundShorthand($sCss, $sExpected) {
79
+ $oParser = new Parser($sCss);
80
+ $oDoc = $oParser->parse();
81
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
82
+ $oDeclaration->expandBackgroundShorthand();
83
+ }
84
+ $this->assertSame(trim((string) $oDoc), $sExpected);
85
+ }
86
+
87
+ public function expandBackgroundShorthandProvider() {
88
+ return array(
89
+ array('body {border: 1px;}', 'body {border: 1px;}'),
90
+ array('body {background: #f00;}', 'body {background-color: #f00;background-image: none;background-repeat: repeat;background-attachment: scroll;background-position: 0% 0%;}'),
91
+ array('body {background: #f00 url("foobar.png");}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: repeat;background-attachment: scroll;background-position: 0% 0%;}'),
92
+ array('body {background: #f00 url("foobar.png") no-repeat;}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: no-repeat;background-attachment: scroll;background-position: 0% 0%;}'),
93
+ array('body {background: #f00 url("foobar.png") no-repeat center;}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: no-repeat;background-attachment: scroll;background-position: center center;}'),
94
+ array('body {background: #f00 url("foobar.png") no-repeat top left;}', 'body {background-color: #f00;background-image: url("foobar.png");background-repeat: no-repeat;background-attachment: scroll;background-position: top left;}'),
95
+ );
96
+ }
97
+
98
+ /**
99
+ * @dataProvider expandDimensionsShorthandProvider
100
+ * */
101
+ public function testExpandDimensionsShorthand($sCss, $sExpected) {
102
+ $oParser = new Parser($sCss);
103
+ $oDoc = $oParser->parse();
104
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
105
+ $oDeclaration->expandDimensionsShorthand();
106
+ }
107
+ $this->assertSame(trim((string) $oDoc), $sExpected);
108
+ }
109
+
110
+ public function expandDimensionsShorthandProvider() {
111
+ return array(
112
+ array('body {border: 1px;}', 'body {border: 1px;}'),
113
+ array('body {margin-top: 1px;}', 'body {margin-top: 1px;}'),
114
+ array('body {margin: 1em;}', 'body {margin-top: 1em;margin-right: 1em;margin-bottom: 1em;margin-left: 1em;}'),
115
+ array('body {margin: 1em 2em;}', 'body {margin-top: 1em;margin-right: 2em;margin-bottom: 1em;margin-left: 2em;}'),
116
+ array('body {margin: 1em 2em 3em;}', 'body {margin-top: 1em;margin-right: 2em;margin-bottom: 3em;margin-left: 2em;}'),
117
+ );
118
+ }
119
+
120
+ /**
121
+ * @dataProvider createBorderShorthandProvider
122
+ * */
123
+ public function testCreateBorderShorthand($sCss, $sExpected) {
124
+ $oParser = new Parser($sCss);
125
+ $oDoc = $oParser->parse();
126
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
127
+ $oDeclaration->createBorderShorthand();
128
+ }
129
+ $this->assertSame(trim((string) $oDoc), $sExpected);
130
+ }
131
+
132
+ public function createBorderShorthandProvider() {
133
+ return array(
134
+ array('body {border-width: 2px;border-style: solid;border-color: #000;}', 'body {border: 2px solid #000;}'),
135
+ array('body {border-style: none;}', 'body {border: none;}'),
136
+ array('body {border-width: 1em;border-style: solid;}', 'body {border: 1em solid;}'),
137
+ array('body {margin: 1em;}', 'body {margin: 1em;}')
138
+ );
139
+ }
140
+
141
+ /**
142
+ * @dataProvider createFontShorthandProvider
143
+ * */
144
+ public function testCreateFontShorthand($sCss, $sExpected) {
145
+ $oParser = new Parser($sCss);
146
+ $oDoc = $oParser->parse();
147
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
148
+ $oDeclaration->createFontShorthand();
149
+ }
150
+ $this->assertSame(trim((string) $oDoc), $sExpected);
151
+ }
152
+
153
+ public function createFontShorthandProvider() {
154
+ return array(
155
+ array('body {font-size: 12px; font-family: serif}', 'body {font: 12px serif;}'),
156
+ array('body {font-size: 12px; font-family: serif; font-style: italic;}', 'body {font: italic 12px serif;}'),
157
+ array('body {font-size: 12px; font-family: serif; font-style: italic; font-weight: bold;}', 'body {font: italic bold 12px serif;}'),
158
+ array('body {font-size: 12px; font-family: serif; font-style: italic; font-weight: bold; line-height: 1.6;}', 'body {font: italic bold 12px/1.6 serif;}'),
159
+ array('body {font-size: 12px; font-family: serif; font-style: italic; font-weight: bold; line-height: 1.6; font-variant: small-caps;}', 'body {font: italic small-caps bold 12px/1.6 serif;}'),
160
+ array('body {margin: 1em;}', 'body {margin: 1em;}')
161
+ );
162
+ }
163
+
164
+ /**
165
+ * @dataProvider createDimensionsShorthandProvider
166
+ * */
167
+ public function testCreateDimensionsShorthand($sCss, $sExpected) {
168
+ $oParser = new Parser($sCss);
169
+ $oDoc = $oParser->parse();
170
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
171
+ $oDeclaration->createDimensionsShorthand();
172
+ }
173
+ $this->assertSame(trim((string) $oDoc), $sExpected);
174
+ }
175
+
176
+ public function createDimensionsShorthandProvider() {
177
+ return array(
178
+ array('body {border: 1px;}', 'body {border: 1px;}'),
179
+ array('body {margin-top: 1px;}', 'body {margin-top: 1px;}'),
180
+ array('body {margin-top: 1em; margin-right: 1em; margin-bottom: 1em; margin-left: 1em;}', 'body {margin: 1em;}'),
181
+ array('body {margin-top: 1em; margin-right: 2em; margin-bottom: 1em; margin-left: 2em;}', 'body {margin: 1em 2em;}'),
182
+ array('body {margin-top: 1em; margin-right: 2em; margin-bottom: 3em; margin-left: 2em;}', 'body {margin: 1em 2em 3em;}'),
183
+ );
184
+ }
185
+
186
+ /**
187
+ * @dataProvider createBackgroundShorthandProvider
188
+ * */
189
+ public function testCreateBackgroundShorthand($sCss, $sExpected) {
190
+ $oParser = new Parser($sCss);
191
+ $oDoc = $oParser->parse();
192
+ foreach ($oDoc->getAllDeclarationBlocks() as $oDeclaration) {
193
+ $oDeclaration->createBackgroundShorthand();
194
+ }
195
+ $this->assertSame(trim((string) $oDoc), $sExpected);
196
+ }
197
+
198
+ public function createBackgroundShorthandProvider() {
199
+ return array(
200
+ array('body {border: 1px;}', 'body {border: 1px;}'),
201
+ array('body {background-color: #f00;}', 'body {background: #f00;}'),
202
+ array('body {background-color: #f00;background-image: url(foobar.png);}', 'body {background: #f00 url("foobar.png");}'),
203
+ array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;}', 'body {background: #f00 url("foobar.png") no-repeat;}'),
204
+ array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;}', 'body {background: #f00 url("foobar.png") no-repeat;}'),
205
+ array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;background-position: center;}', 'body {background: #f00 url("foobar.png") no-repeat center;}'),
206
+ array('body {background-color: #f00;background-image: url(foobar.png);background-repeat: no-repeat;background-position: top left;}', 'body {background: #f00 url("foobar.png") no-repeat top left;}'),
207
+ );
208
+ }
209
+
210
+ public function testOverrideRules() {
211
+ $sCss = '.wrapper { left: 10px; text-align: left; }';
212
+ $oParser = new Parser($sCss);
213
+ $oDoc = $oParser->parse();
214
+ $oRule = new Rule('right');
215
+ $oRule->setValue('-10px');
216
+ $aContents = $oDoc->getContents();
217
+ $oWrapper = $aContents[0];
218
+
219
+ $this->assertCount(2, $oWrapper->getRules());
220
+ $aContents[0]->setRules(array($oRule));
221
+
222
+ $aRules = $oWrapper->getRules();
223
+ $this->assertCount(1, $aRules);
224
+ $this->assertEquals('right', $aRules[0]->getRule());
225
+ $this->assertEquals('-10px', $aRules[0]->getValue());
226
+ }
227
+
228
+ public function testRuleInsertion() {
229
+ $sCss = '.wrapper { left: 10px; text-align: left; }';
230
+ $oParser = new Parser($sCss);
231
+ $oDoc = $oParser->parse();
232
+ $aContents = $oDoc->getContents();
233
+ $oWrapper = $aContents[0];
234
+
235
+ $oFirst = $oWrapper->getRules('left');
236
+ $this->assertCount(1, $oFirst);
237
+ $oFirst = $oFirst[0];
238
+
239
+ $oSecond = $oWrapper->getRules('text-');
240
+ $this->assertCount(1, $oSecond);
241
+ $oSecond = $oSecond[0];
242
+
243
+ $oBefore = new Rule('left');
244
+ $oBefore->setValue(new Size(16, 'em'));
245
+
246
+ $oMiddle = new Rule('text-align');
247
+ $oMiddle->setValue(new Size(1));
248
+
249
+ $oAfter = new Rule('border-bottom-width');
250
+ $oAfter->setValue(new Size(1, 'px'));
251
+
252
+ $oWrapper->addRule($oAfter);
253
+ $oWrapper->addRule($oBefore, $oFirst);
254
+ $oWrapper->addRule($oMiddle, $oSecond);
255
+
256
+ $aRules = $oWrapper->getRules();
257
+
258
+ $this->assertSame($oBefore, $aRules[0]);
259
+ $this->assertSame($oFirst, $aRules[1]);
260
+ $this->assertSame($oMiddle, $aRules[2]);
261
+ $this->assertSame($oSecond, $aRules[3]);
262
+ $this->assertSame($oAfter, $aRules[4]);
263
+
264
+ $this->assertSame('.wrapper {left: 16em;left: 10px;text-align: 1;text-align: left;border-bottom-width: 1px;}', $oDoc->render());
265
+ }
266
+
267
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/Sabberworm/CSS/RuleSet/LenientParsingTest.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Sabberworm\CSS\RuleSet;
4
+
5
+ use Sabberworm\CSS\Parser;
6
+ use Sabberworm\CSS\Settings;
7
+
8
+ class LenientParsingTest extends \PHPUnit_Framework_TestCase {
9
+
10
+ /**
11
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
12
+ */
13
+ public function testFaultToleranceOff() {
14
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-fault-tolerance.css";
15
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
16
+ $oParser->parse();
17
+ }
18
+
19
+ public function testFaultToleranceOn() {
20
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-fault-tolerance.css";
21
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
22
+ $oResult = $oParser->parse();
23
+ $this->assertSame('.test1 {}'."\n".'.test2 {hello: 2.2;hello: 2000000000000.2;}'."\n".'#test {}'."\n".'#test2 {help: none;}', $oResult->render());
24
+ }
25
+
26
+ /**
27
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
28
+ */
29
+ public function testEndToken() {
30
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token.css";
31
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
32
+ $oParser->parse();
33
+ }
34
+
35
+ /**
36
+ * @expectedException Sabberworm\CSS\Parsing\UnexpectedTokenException
37
+ */
38
+ public function testEndToken2() {
39
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token-2.css";
40
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->beStrict());
41
+ $oParser->parse();
42
+ }
43
+
44
+ public function testEndTokenPositive() {
45
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token.css";
46
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
47
+ $oResult = $oParser->parse();
48
+ $this->assertSame("", $oResult->render());
49
+ }
50
+
51
+ public function testEndToken2Positive() {
52
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-end-token-2.css";
53
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
54
+ $oResult = $oParser->parse();
55
+ $this->assertSame('#home .bg-layout {background-image: url("/bundles/main/img/bg1.png?5");}', $oResult->render());
56
+ }
57
+
58
+ public function testLocaleTrap() {
59
+ setlocale(LC_ALL, "pt_PT", "no");
60
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "-fault-tolerance.css";
61
+ $oParser = new Parser(file_get_contents($sFile), Settings::create()->withLenientParsing(true));
62
+ $oResult = $oParser->parse();
63
+ $this->assertSame('.test1 {}'."\n".'.test2 {hello: 2.2;hello: 2000000000000.2;}'."\n".'#test {}'."\n".'#test2 {help: none;}', $oResult->render());
64
+ }
65
+
66
+ public function testCaseInsensitivity() {
67
+ $sFile = dirname(__FILE__) . '/../../../files' . DIRECTORY_SEPARATOR . "case-insensitivity.css";
68
+ $oParser = new Parser(file_get_contents($sFile));
69
+ $oResult = $oParser->parse();
70
+ $this->assertSame('@charset "utf-8";
71
+ @import url("test.css");
72
+ @media screen {}
73
+ #myid {case: insensitive !important;frequency: 30Hz;font-size: 1em;color: #ff0;color: hsl(40,40%,30%);font-family: Arial;}', $oResult->render());
74
+ }
75
+
76
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/bootstrap.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ spl_autoload_register(function($class)
4
+ {
5
+ $file = __DIR__.'/../lib/'.strtr($class, '\\', '/').'.php';
6
+ if (file_exists($file)) {
7
+ require $file;
8
+ return true;
9
+ }
10
+ });
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-calc-no-space-around-minus.css ADDED
@@ -0,0 +1 @@
 
1
+ div { width: calc(50% -8px); }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-charset-after-rule.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ #id {
2
+ prop: var(--val);
3
+ }
4
+
5
+ @charset 'utf-16';
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-charset-in-block.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ @media print {
2
+ @charset 'utf-16';
3
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-empty-grid-linename.css ADDED
@@ -0,0 +1 @@
 
1
+ .test { grid-template-columns: [] 100px; }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-empty.css ADDED
File without changes
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-end-token-2.css ADDED
@@ -0,0 +1 @@
 
1
+ #home .bg-layout { background-image: url(/bundles/main/img/bg1.png?5);};
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-end-token.css ADDED
@@ -0,0 +1 @@
 
1
+ /* Test comment
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-fault-tolerance.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .test1 {
2
+ //gaga: hello;
3
+ }
4
+
5
+ .test2 {
6
+ *hello: 1;
7
+ hello: 2.2;
8
+ hello: 2000000000000.2;
9
+ }
10
+
11
+ #test {
12
+ #hello: 1}
13
+
14
+ #test2 {
15
+ help: none;
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/-tobedone.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ .some[selectors-may='contain-a-{'] {
2
+
3
+ }
4
+
5
+ @media only screen and (min-width: 200px) {
6
+ .test {
7
+ prop: val;
8
+ }
9
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/1readme.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ @charset "utf-8";
2
+
3
+ @font-face {
4
+ font-family: "CrassRoots";
5
+ src: url("../media/cr.ttf")
6
+ }
7
+
8
+ html, body {
9
+ font-size: 1.6em
10
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/2readme.css ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ #header {
2
+ margin: 10px 2em 1cm 2%;
3
+ font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
4
+ color: red !important;
5
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/atrules.css ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @charset "utf-8";
2
+
3
+ @font-face {
4
+ font-family: "CrassRoots";
5
+ src: url("../media/cr.ttf")
6
+ }
7
+
8
+ html, body {
9
+ font-size: -0.6em
10
+ }
11
+
12
+ @keyframes mymove {
13
+ from { top: 0px; }
14
+ to { top: 200px; }
15
+ }
16
+
17
+ @-moz-keyframes some-move {
18
+ from { top: 0px; }
19
+ to { top: 200px; }
20
+ }
21
+
22
+ @supports ( (perspective: 10px) or (-moz-perspective: 10px) or (-webkit-perspective: 10px) or (-ms-perspective: 10px) or (-o-perspective: 10px) ) {
23
+ body {
24
+ font-family: 'Helvetica';
25
+ }
26
+ }
27
+
28
+ @page :pseudo-class {
29
+ margin:2in;
30
+ }
31
+
32
+ @-moz-document url(http://www.w3.org/),
33
+ url-prefix(http://www.w3.org/Style/),
34
+ domain(mozilla.org),
35
+ regexp("https:.*") {
36
+ /* CSS rules here apply to:
37
+ + The page "http://www.w3.org/".
38
+ + Any page whose URL begins with "http://www.w3.org/Style/"
39
+ + Any page whose URL's host is "mozilla.org" or ends with
40
+ ".mozilla.org"
41
+ + Any page whose URL starts with "https:" */
42
+
43
+ /* make the above-mentioned pages really ugly */
44
+ body { color: purple; background: yellow; }
45
+ }
46
+
47
+ @media screen and (orientation: landscape) {
48
+ @-ms-viewport {
49
+ width: 1024px;
50
+ height: 768px;
51
+ }
52
+ /* CSS for landscape layout goes here */
53
+ }
54
+
55
+ @region-style #intro {
56
+ p { color: blue; }
57
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/calc-nested.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ .test {
2
+ font-size: calc((3 * 4px) + -2px);
3
+ top: calc(200px - calc(20 * 3px));
4
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/calc.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ div { width: calc(100% / 4); }
2
+ div { margin-top: calc(-120% - 4px); }
3
+ div {
4
+ height: -webkit-calc(9/16 * 100%)!important;
5
+ width: -moz-calc((50px - 50%)*2);
6
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/case-insensitivity.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @CharSet "utf-8";
2
+ @IMPORT uRL(test.css);
3
+
4
+ @MEDIA screen {
5
+
6
+ }
7
+
8
+ #myid {
9
+ CaSe: insensitive !imPORTANT;
10
+ frequency: 30hz;
11
+ font-size: 1EM;
12
+ color: RGB(255, 255, 0);
13
+ color: hSL(40, 40%, 30%);
14
+ font-Family: Arial; /* The value needs to remain capitalized */
15
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/colortest.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #mine {
2
+ color: red;
3
+ border-color: rgb(10, 100, 230);
4
+ border-color: rgba(10, 100, 231, 0.3);
5
+ outline-color: #222;
6
+ background-color: #232323;
7
+ }
8
+
9
+ #yours {
10
+ background-color: hsl(220, 10%, 220%);
11
+ background-color: hsla(220, 10%, 220%, 0.3);
12
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/comments.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Comments Hell.
3
+ */
4
+ @import /* Number 1 */"some/url.css"/* Number 2 */ screen/* Number 3 */;
5
+
6
+ .foo, /* Number 4 */ #bar/* Number 5 */ {
7
+ background-color/* Number 6 */: #000/* Number 7 */;
8
+ }
9
+
10
+ @media /* Number 8 */screen /* Number 9 */{
11
+ /** Number 10 **/
12
+ #foo.bar {
13
+ /** Number 10b **/
14
+ position: absolute;/**/
15
+ }
16
+ }
17
+ /** Number 11 **/
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/create-shorthands.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ body {
2
+ font-size: 2em; font-family: Helvetica,Arial,sans-serif; font-weight: bold;
3
+ border-width: 2px; border-color: #999; border-style: dotted;
4
+ background-color: #fff; background-image: url('foobar.png'); background-repeat: repeat-y;
5
+ margin-top: 2px; margin-right: 3px; margin-bottom: 4px; margin-left: 5px;
6
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/docuwiki.css ADDED
@@ -0,0 +1 @@
 
1
+ div.dokuwiki div.ajax_qsearch{position:absolute;right:237px;;width:200px;opacity:0.9;display:none;font-size:80%;line-height:1.2em;border:1px solid #8cacbb;background-color:#f7f9fa;text-align:left;padding:4px;}
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/empty-grid-linename.css ADDED
@@ -0,0 +1 @@
 
1
+ .test { grid-template-columns: [] 100px; }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/expand-shorthands.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ body {
2
+ font: italic 500 14px/1.618 "Trebuchet MS", Georgia, serif;
3
+ border: 2px solid #f0f;
4
+ background: #ccc url("/images/foo.png") no-repeat left top;
5
+ margin: 1em !important;
6
+ padding: 2px 6px 3px;
7
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/functions.css ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ div.main { background-image: linear-gradient(#000, #fff) }
2
+ .collapser::before,
3
+ .collapser::-moz-before,
4
+ .collapser::-webkit-before {
5
+ content: "»";
6
+ font-size: 1.2em;
7
+ margin-right: .2em;
8
+ -moz-transition-property: -moz-transform;
9
+ -moz-transition-duration: .2s;
10
+ -moz-transform-origin: center 60%;
11
+ }
12
+ .collapser.expanded::before,
13
+ .collapser.expanded::-moz-before,
14
+ .collapser.expanded::-webkit-before { -moz-transform: rotate(90deg) }
15
+ .collapser + * {
16
+ height: 0;
17
+ overflow: hidden;
18
+ -moz-transition-property: height;
19
+ -moz-transition-duration: .3s;
20
+ }
21
+ .collapser.expanded + * { height: auto }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/grid-linename.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ div { grid-template-columns: [ linename ] 100px; }
2
+ span { grid-template-columns: [ linename1 linename2 ] 100px; }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/hex-alpha.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ div { background: #1234; }
2
+ div { background: #11223344; }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/ie-hacks.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ p {
2
+ padding-right: .75rem \9;
3
+ background-image: none \9;
4
+ color:red\9\0;
5
+ background-color:red \9 \0;
6
+ background-color:red \9 \0 !important;
7
+ content: "red \9\0";
8
+ content: "red\0abc";
9
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/ie.css ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ .nav-thumb-wrapper:hover img, a.activeSlide img {
2
+ filter: alpha(opacity=100);
3
+ -moz-opacity: 1;
4
+ -khtml-opacity: 1;
5
+ opacity: 1;
6
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/important.css ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
2
+ div.rating-cancel,div.rating-cancel a{background:url(images/delete.gif) no-repeat 0 -16px}
3
+ div.star-rating,div.star-rating a{background:url(images/star.gif) no-repeat 0 0px}
4
+ div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
5
+ div.star-rating-on a{background-position:0 -16px!important}
6
+ div.star-rating-hover a{background-position:0 -32px}
7
+ div.star-rating-readonly a{cursor:default !important}
8
+ div.star-rating{background:transparent!important; overflow:hidden!important}
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/inner-color.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ test {
2
+ background: -webkit-gradient(linear, 0 0, 0 bottom, from(#006cad), to(hsl(202, 100%, 49%)));
3
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/line-numbers.css ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @charset "utf-8"; /* line 1 */
2
+
3
+ @namespace "http://toto.example.org"; /* line 3 */
4
+
5
+ @font-face { /* line 5 */
6
+ font-family: "CrassRoots";
7
+ src: url("http://example.com/media/cr.ttf") /* line 7 */
8
+ }
9
+
10
+
11
+ #header { /* line 11 */
12
+ margin: 10px 2em 1cm 2%;
13
+ font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
14
+ color: red !important;
15
+ }
16
+
17
+ @keyframes mymove { /* line 17 */
18
+ from { top: 0px; } /* line 18 */
19
+
20
+ to { top: 200px; } /* line 20 */
21
+ }
22
+
23
+ @IMPORT uRL(test.css); /* line 23 */
24
+
25
+ body {
26
+ background: #FFFFFF url("http://somesite.com/images/someimage.gif") repeat top center; /* line 25 */
27
+ color: rgb( /* line 27 */
28
+ 233, /* line 28 */
29
+ 100, /* line 29 */
30
+ 450 /* line 30 */
31
+ );
32
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/missing-property-value.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ div {
2
+ display: inline-block;
3
+ display:
4
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/ms-filter.css ADDED
@@ -0,0 +1 @@
 
1
+ .test {filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);}
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/namespaces.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* From the spec at http://www.w3.org/TR/css3-namespace/ */
2
+
3
+ @namespace toto "http://toto.example.org";
4
+ @namespace "http://example.com/foo";
5
+
6
+
7
+ /* From an introduction at http://www.blooberry.com/indexdot/css/syntax/atrules/namespace.htm */
8
+ @namespace foo url("http://www.example.com/");
9
+ @namespace foo url('http://www.example.com/');
10
+
11
+
12
+ foo|test {
13
+ gaga: 1;
14
+ }
15
+
16
+ |test {
17
+ gaga: 2;
18
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/nested.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html {
2
+ some: -test(val1);
3
+ }
4
+
5
+ html {
6
+ some-other: -test(val1);
7
+ }
8
+
9
+ @media screen {
10
+ html {
11
+ some: -test(val2);
12
+ }
13
+ }
14
+
15
+ #unrelated {
16
+ other: yes;
17
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/slashed.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ .test {
2
+ font: 12px/1.5 Verdana, Arial, sans-serif;
3
+ border-radius: 5px 10px 5px 10px / 10px 5px 10px 5px;
4
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/specificity.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ #test .help,
2
+ #file,
3
+ .help:hover,
4
+ li.green,
5
+ ol li::before {
6
+ font-family: Helvetica;
7
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/trailing-whitespace.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ div { width: 200px; }
2
+
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unicode-range.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ @font-face {
2
+ unicode-range: U+0100-024F, U+0259, U+1E??-2EFF, U+202F;
3
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unicode.css ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .test-1 { content: "\20"; } /* Same as " " */
2
+ .test-2 { content: "\E9"; } /* Same as "é" */
3
+ .test-3 { content: "\0020"; } /* Same as " " */
4
+ .test-5 { content: "\6C34" } /* Same as "水" */
5
+ .test-6 { content: "\00A5" } /* Same as "¥" */
6
+ .test-7 { content: '\a' } /* Same as "\A" (Newline) */
7
+ .test-8 { content: "\"\22" } /* Same as "\"\"" */
8
+ .test-9 { content: "\"\27" } /* Same as ""\"\'"" */
9
+ .test-10 { content: "\'\\" } /* Same as "'\" */
10
+ .test-11 { content: "\test" } /* Same as "test" */
11
+
12
+ .test-4 { content: "\1D11E" } /* Beyond the Basic Multilingual Plane */
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unmatched_braces.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ button,input,checkbox,textarea {
2
+ outline: 0;
3
+ margin: 0;
4
+ }
5
+
6
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio:3/@media all and (orientation:portrait) {
7
+ #wrapper {
8
+ max-width:640px;
9
+ margin: 0 auto;
10
+ }
11
+ }
12
+
13
+ @media all and (orientation: landscape) {
14
+ #wrapper {
15
+ max-width:640px;
16
+ margin: 0 auto;
17
+ }
18
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/unopened-close-brackets.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ }}}.blue{
2
+ background: #00F;
3
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/url.css ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ body { background: #FFFFFF url("http://somesite.com/images/someimage.gif") repeat top center; }
2
+ body {
3
+ background-url: url("http://somesite.com/images/someimage.gif");
4
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/values.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #header {
2
+ margin: 10px 2em 1cm 2%;
3
+ font-family: Verdana, Helvetica, "Gill Sans", sans-serif;
4
+ font-size: 10px;
5
+ color: red !important;
6
+ background-color: green;
7
+ background-color: rgba(0,128,0,0.7);
8
+ frequency: 30Hz;
9
+ }
10
+
11
+ body {
12
+ color: green;
13
+ font: 75% "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
14
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/webkit.css ADDED
@@ -0,0 +1 @@
 
1
+ .test { background:-webkit-linear-gradient(top right, white, black)}
includes/vendor/css-parser/sabberworm/php-css-parser/tests/files/whitespace.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .test {
2
+ background-image : url ( 4px ) ;
3
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/tests/quickdump.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env php
2
+ <?php
3
+
4
+ require_once(dirname(__FILE__).'/bootstrap.php');
5
+
6
+ $sSource = file_get_contents('php://stdin');
7
+ $oParser = new Sabberworm\CSS\Parser($sSource);
8
+
9
+ $oDoc = $oParser->parse();
10
+ echo "\n".'#### Input'."\n\n```css\n";
11
+ print $sSource;
12
+
13
+ echo "\n```\n\n".'#### Structure (`var_dump()`)'."\n\n```php\n";
14
+ var_dump($oDoc);
15
+
16
+ echo "\n```\n\n".'#### Output (`render()`)'."\n\n```css\n";
17
+ print $oDoc->render();
18
+
19
+ echo "\n```\n";
20
+
pagebuilder/amp-page-builder.php CHANGED
@@ -13,24 +13,19 @@ require_once(AMP_PAGE_BUILDER."config/moduleTemplate.php");
13
  add_action('add_meta_boxes','ampforwp_pagebuilder_content_meta_register', 10 ,1);
14
  function ampforwp_pagebuilder_content_meta_register($post_type){
15
  global $redux_builder_amp;
16
-
17
- $user_level = '';
18
- $user_level = current_user_can( 'manage_options' );
19
-
20
- if ( isset( $redux_builder_amp['amp-meta-permissions'] ) && $redux_builder_amp['amp-meta-permissions'] == 'all' ) {
21
- $user_level = true;
22
- }
23
-
24
- if ( $user_level && ( current_user_can('edit_posts') || current_user_can('edit_pages') ) ) {
25
  // Page builder for posts
26
- if( $redux_builder_amp['amp-on-off-for-all-posts'] && $post_type == 'post' ) {
27
  add_meta_box( 'pagebilder_content', esc_html__( 'AMP Page Builder', 'accelerated-mobile-pages' ), 'amp_content_pagebuilder_title_callback', 'post' , 'normal', 'default' );
28
  }
 
29
  // Page builder for pages
30
- if ( $redux_builder_amp['amp-on-off-for-all-pages'] && $post_type == 'page' ) {
31
  add_meta_box( 'pagebilder_content', esc_html__( 'AMP Page Builder', 'accelerated-mobile-pages' ), 'amp_content_pagebuilder_title_callback', 'page' , 'normal', 'default' );
32
  }
33
- if( (isset($redux_builder_amp['ampforwp-custom-type']) && is_array($redux_builder_amp['ampforwp-custom-type'] ) ) && in_array($post_type, $redux_builder_amp['ampforwp-custom-type']) ){
34
  add_meta_box( 'pagebilder_content', esc_html__( 'AMP Page Builder', 'accelerated-mobile-pages' ), 'amp_content_pagebuilder_title_callback', $post_type , 'normal', 'default' );
35
  }
36
 
13
  add_action('add_meta_boxes','ampforwp_pagebuilder_content_meta_register', 10 ,1);
14
  function ampforwp_pagebuilder_content_meta_register($post_type){
15
  global $redux_builder_amp;
16
+ global $post_id;
17
+
18
+ if ( ampforwp_role_based_access_options() == true && ( current_user_can('edit_posts') || current_user_can('edit_pages') ) ) {
 
 
 
 
 
 
19
  // Page builder for posts
20
+ if( ampforwp_get_setting('amp-on-off-for-all-posts') && $post_type == 'post' ) {
21
  add_meta_box( 'pagebilder_content', esc_html__( 'AMP Page Builder', 'accelerated-mobile-pages' ), 'amp_content_pagebuilder_title_callback', 'post' , 'normal', 'default' );
22
  }
23
+ $frontpage_id = ampforwp_get_the_ID();
24
  // Page builder for pages
25
+ if ( ( true == ampforwp_get_setting('amp-on-off-for-all-pages') && $post_type == 'page' ) || ( true == ampforwp_get_setting('amp-frontpage-select-option') && $post_id == $frontpage_id )) {
26
  add_meta_box( 'pagebilder_content', esc_html__( 'AMP Page Builder', 'accelerated-mobile-pages' ), 'amp_content_pagebuilder_title_callback', 'page' , 'normal', 'default' );
27
  }
28
+ if( is_array(ampforwp_get_setting('ampforwp-custom-type') ) && in_array($post_type, ampforwp_get_setting('ampforwp-custom-type')) ){
29
  add_meta_box( 'pagebilder_content', esc_html__( 'AMP Page Builder', 'accelerated-mobile-pages' ), 'amp_content_pagebuilder_title_callback', $post_type , 'normal', 'default' );
30
  }
31
 
pagebuilder/modules/feature-mod-module.php CHANGED
@@ -9,7 +9,15 @@ $css = '
9
  {{module-class}} .ln-fx{width:100%;display:flex; flex-wrap:wrap;}
10
  .feat-blk{ margin: 0 3% 3% 0; background: {{background_color_picker}}; width: 47%; text-align: {{align_type}};padding: 40px; position: relative;color: #26292c;}
11
  .feat-blk p{color: #333;font-size: 18px;padding-top:15px;}
12
- .feat-blk h3{font-size:28px;color:{{font_color_picker}};font-weight:400;padding-bottom:15px;}
 
 
 
 
 
 
 
 
13
  .feat-blk amp-img{margin:0 auto;width:100%}
14
  .feat-blk amp-img{width:{{img_width}};}
15
  {{if_condition_check_for_btn==1}}
@@ -58,6 +66,23 @@ return array(
58
  ),
59
  'content_type'=>'html',
60
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  array(
62
  'type' =>'checkbox',
63
  'name' =>"image_layout",
@@ -299,7 +324,7 @@ return array(
299
  ),
300
  'front_template'=>
301
  '{{if_condition_feature_layout_type==1}}<div class="feat-blk">
302
- <h3 class="t-txt">{{content_title}}</h3>
303
  {{if_img_upload}}<amp-img src="{{img_upload}}" width="{{image_width}}" height="{{image_height}}" {{image_layout}} alt="{{image_alt}}"></amp-img>{{ifend_img_upload}}
304
  <p>{{content}}</p>
305
  {{if_condition_check_for_btn==1}}
9
  {{module-class}} .ln-fx{width:100%;display:flex; flex-wrap:wrap;}
10
  .feat-blk{ margin: 0 3% 3% 0; background: {{background_color_picker}}; width: 47%; text-align: {{align_type}};padding: 40px; position: relative;color: #26292c;}
11
  .feat-blk p{color: #333;font-size: 18px;padding-top:15px;}
12
+ .feat-blk h1{font-size:28px;}
13
+ .feat-blk h2{font-size:25px;}
14
+ .feat-blk h3{font-size:22px;}
15
+ .feat-blk h4{font-size:19px;}
16
+ .feat-blk h5{font-size:17px;}
17
+ .feat-blk h6{font-size:15px;}
18
+ .feat-blk h1, .feat-blk h2, .feat-blk h3, .feat-blk h4, .feat-blk h5, .feat-blk h6{
19
+ color:{{font_color_picker}};font-weight:400;padding-bottom:15px;
20
+ }
21
  .feat-blk amp-img{margin:0 auto;width:100%}
22
  .feat-blk amp-img{width:{{img_width}};}
23
  {{if_condition_check_for_btn==1}}
66
  ),
67
  'content_type'=>'html',
68
  ),
69
+ array(
70
+ 'type' =>'select',
71
+ 'name' =>'heading_tags',
72
+ 'label' => esc_html__('Heading Tags','accelerated-mobile-pages'),
73
+ 'tab' =>'customizer',
74
+ 'default' =>'h3',
75
+ 'options_details'=>array(
76
+ 'h1' =>'H1',
77
+ 'h2' =>'H2',
78
+ 'h3' =>'H3',
79
+ 'h4' =>'H4',
80
+ 'h5' =>'H5',
81
+ 'h6' =>'H6'
82
+ ),
83
+ 'content_type'=>'html',
84
+ 'required' => array('feature_layout_type'=> 1),
85
+ ),
86
  array(
87
  'type' =>'checkbox',
88
  'name' =>"image_layout",
324
  ),
325
  'front_template'=>
326
  '{{if_condition_feature_layout_type==1}}<div class="feat-blk">
327
+ {{if_heading_tags}}<{{heading_tags}} class="t-txt">{{content_title}}</{{heading_tags}}>{{ifend_heading_tags}}
328
  {{if_img_upload}}<amp-img src="{{img_upload}}" width="{{image_width}}" height="{{image_height}}" {{image_layout}} alt="{{image_alt}}"></amp-img>{{ifend_img_upload}}
329
  <p>{{content}}</p>
330
  {{if_condition_check_for_btn==1}}
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
- Stable tag: 0.9.98.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,6 +29,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
29
 
30
  * NEW - Gutenberg Support
31
  * NEW - Divi and Elementor Support [More Info](https://ampforwp.com/amp-pagebuilder-compatibility/)
 
32
  * NEW - Addthis Sharing Support
33
  * NEW - AMP Infinity Scroll Support
34
  * NEW - Revolution Slider plugin Support
@@ -125,6 +126,7 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
125
  == Credits ==
126
  Some code used in this plugin was forked from 'AMP for WordPress' plugin https://wordpress.org/plugins/amp/ - License URI: http://www.gnu.org/licenses/gpl-2.0.html.
127
  Mobile & Tablet detection library used https://github.com/serbanghita/Mobile-Detect - License URI: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
 
128
 
129
  == Installation ==
130
  **[Visit Help area for the Documentation:](https://ampforwp.com/help/)**
@@ -189,48 +191,38 @@ You can contact us from [here](https://ampforwp.com/contact/)
189
 
190
  == Changelog ==
191
 
192
- = 0.9.98.8 (7th SEPTEMBER 2019) =
193
- * Improvements: AMP Option panel in mobile view #2603
194
- * Improvements: Need to make compatible with yoast seo primary category option #3551
195
- * Improvements: The "redirect chain" report taking extra steps to process. #3575
196
- * Improvements: Rank math Titles & Meta compatibility #3592
197
- * Improvements: Improvement in iframe #3563
198
- * Improvements: optimize the TEL link to remove validation and provide better UX #3581
199
- * Fixed: Need to check function exist get_cart_url as it is getting fatal error when only amp woocommere is active. #3584
200
- * Fixed: Change Internal Links to AMP #3561
201
- * Fixed: Rare issue with Yoast SEO/Excerpt #3511
202
- * Fixed: lighthouse issues #3547
203
- * Fixed: Gallery Captions not working #3536
204
- * Fixed: Table is not aligning properly in amp version #3549
205
- * Fixed: Getting Debug error ( cdn_url_main ) #3555
206
- * Fixed: Delete button gone in page builder in RTL language #3545
207
- * Fixed: caption design is different when comparing Gutenberg and classic editor #3573
208
- * Fixed: Image is not aligned properly #3542
209
- * Fixed: The extension 'amp-wistia-player' was found on this page, but is unused. Please remove this extension. #3587
210
- * Fixed: No Index issue #2303
211
- * Fixed: Need to create a basic tutorial for each elements of single in Swift #3499
212
- * Fixed: Facebook like button is not aligned properly #3589
213
- * Fixed: h1 was changed to h2 in the custom frontpage title after update #3546
214
- * Fixed: When using JNews AMP Extender, It makes posts blank #3526
215
- * Fixed: Infinite scroll script is adding in woocommerce archive pages #3570
216
- * Fixed: Clicky analytics option getting hidden when GTM is on #3585
217
- * Fixed: In add on mode when amp is in standard mode frontend is getting blank screen. #3508
218
- * Fixed: Proper escaping in facebook instant article #3564
219
- * Fixed: No Icon in Facebook Message when Font Awesome Icon type selected #3572
220
- * Fixed: yoast breadcrumb making all ul list in capital letters #3540
221
- * Fixed: Comments should be removed in the out put of Analytics Code #3593
222
- * Fixed: Related post excerpt is not working with horizontal design #3595
223
- * Fixed: Issue in Breacrumb if category has a comma #3598
224
- * Fixed: After last update the cookie bar text shows the html code (a href) instead of creating a link. #3617
225
-
226
- = 0.9.98.6 (31th AUGUST 2019) =
227
- * Improvements: Structured Data improvements #3567
228
- * Improvements: Addthis share button's postion field in 1,2 and 3 designs #3553
229
- * Fixed: Rare issue AMP settings are not getting saved showing popup error "There was a problem with your action. Please try again or reload the page." #3494
230
- * Fixed: Plugin removes Telegram links #3578
231
- * Fixed: amp-addthis validation error on pages #3580
232
- * Fixed: Spot.IM Comments not working on all designs #3568
233
- * Fixed: Incorrect title tags being generated #3565
234
- * Fixed: Reduce the size of auto inline css. #3115
235
 
236
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
+ Stable tag: 0.9.98.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  * NEW - Gutenberg Support
31
  * NEW - Divi and Elementor Support [More Info](https://ampforwp.com/amp-pagebuilder-compatibility/)
32
+ * NEW - Improved CSS Optimization (Tree Shaking)
33
  * NEW - Addthis Sharing Support
34
  * NEW - AMP Infinity Scroll Support
35
  * NEW - Revolution Slider plugin Support
126
  == Credits ==
127
  Some code used in this plugin was forked from 'AMP for WordPress' plugin https://wordpress.org/plugins/amp/ - License URI: http://www.gnu.org/licenses/gpl-2.0.html.
128
  Mobile & Tablet detection library used https://github.com/serbanghita/Mobile-Detect - License URI: https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt
129
+ PHP CSS Parser library used https://github.com/sabberworm/PHP-CSS-Parser - License URI: https://github.com/sabberworm/PHP-CSS-Parser#license (PHP-CSS-Parser is freely distributable under the terms of an MIT-style license.)
130
 
131
  == Installation ==
132
  **[Visit Help area for the Documentation:](https://ampforwp.com/help/)**
191
 
192
  == Changelog ==
193
 
194
+ = 0.9.98.9 (16th SEPTEMBER 2019) =
195
+
196
+ * Improvements: Need to implement Tree Shaking feature to remove access css from the AMP pages #2949
197
+ * Improvements: Need to save Post Meta Field Revisions in WordPress #3548
198
+ * Improvements: Add Role based Access to all the options #3480
199
+ * Improvements: Need to improve import/export option. #3364
200
+ * Improvements: Need to make compatibility with amp-connatix-player component #3524
201
+ * Improvements: "Recent Posts below related posts" feature need to implement for the design three #3531
202
+ * Improvements: Need to improve color picker library in AMP FOR WP Plugin #3461
203
+ * Improvements: Recent Posts below Related needs new options #3518
204
+ * Improvements: Excerpt length feature request for related post #2908
205
+ * Improvements: Need to add the option date below the content #3445
206
+ * Improvements: Need to hide time in traditional view option. #3453
207
+ * Improvements: Add feature to go to non AMP page on next and previous links #3253
208
+ * Improvements: Create a filter to Exclude Posts from Related Posts #3582
209
+ * Improvements: Need to add a filter to remove options in sidebar in AMP #3416
210
+ * Improvements: allow option to change the heading tag of Featured module #3560
211
+ * Improvements: AAWP plugin for AMP compatibility in Extension list #3591
212
+ * Fixed: Individual AMP Page (Bulk Edit) "hide by default" option not working #3610
213
+ * Fixed: In Recent Posts below Related need to add which present in below below related post #3596
214
+ * Fixed: Need to shift the Header Background Option and Header Elements option on top in Swift theme #3462
215
+ * Fixed: Need to add 'By Last X Days' option for "In-Content Related Posts" #3219
216
+ * Fixed: Need to add unique class name custom post type #3539
217
+ * Fixed: Need to add Convert AMP to WP theme (Beta) tutorial link in tooltip of this option #3552
218
+ * Fixed: Need to connect with Collapse references by default option of the footnotes plugin. #3586
219
+ * Fixed: Do not generate the AMPhtml for Woocommerce Account Page #3619
220
+ * Fixed: Need to place page builder in custom homepage even amp support is off on pages. #2914
221
+ * Fixed: Need to allow the user to navigate if user is using iframe #3601
222
+ * Fixed: Template mode: Need to changes/fixes #3590
223
+ * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
224
+ * Fixed: Improper amphtml on HomePage when WPML is activate #3341
225
+ * Fixed: The GDPR consent not working due to passed as string. #3658
226
+
 
 
 
 
 
 
 
 
 
 
227
 
228
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/custom-amp-content.php CHANGED
@@ -81,20 +81,15 @@ function ampforwp_custom_post_content_sanitizer( $data, $post ) {
81
 
82
  function ampforwp_custom_content_meta_register() {
83
  global $redux_builder_amp;
 
84
 
85
- $user_level = '';
86
- $user_level = current_user_can( 'manage_options' );
87
-
88
- if ( isset( $redux_builder_amp['amp-meta-permissions'] ) && 'all' === $redux_builder_amp['amp-meta-permissions'] ) {
89
- $user_level = true;
90
- }
91
-
92
- if ( $user_level ) {
93
  if ( $redux_builder_amp['amp-on-off-for-all-posts'] ) {
94
  add_meta_box( 'custom_content_editor', esc_html__( 'Custom AMP Editor', 'accelerated-mobile-pages' ), 'amp_content_editor_title_callback', 'post','normal', 'default' );
95
  }
96
 
97
- if ( $redux_builder_amp['amp-on-off-for-all-pages'] ) {
 
98
  add_meta_box( 'custom_content_editor', esc_html__( 'Custom AMP Editor','accelerated-mobile-pages' ), 'amp_content_editor_title_callback', 'page','normal', 'default' );
99
  }
100
  // Custom AMP Editor for Custom Post Types
81
 
82
  function ampforwp_custom_content_meta_register() {
83
  global $redux_builder_amp;
84
+ global $post_id;
85
 
86
+ if( ampforwp_role_based_access_options() == true && ( current_user_can('edit_posts') || current_user_can('edit_pages') ) ){
 
 
 
 
 
 
 
87
  if ( $redux_builder_amp['amp-on-off-for-all-posts'] ) {
88
  add_meta_box( 'custom_content_editor', esc_html__( 'Custom AMP Editor', 'accelerated-mobile-pages' ), 'amp_content_editor_title_callback', 'post','normal', 'default' );
89
  }
90
 
91
+ $frontpage_id = ampforwp_get_the_ID();
92
+ if ( true == ampforwp_get_setting('amp-on-off-for-all-pages') || ( true == ampforwp_get_setting('amp-frontpage-select-option') && $post_id == $frontpage_id )) {
93
  add_meta_box( 'custom_content_editor', esc_html__( 'Custom AMP Editor','accelerated-mobile-pages' ), 'amp_content_editor_title_callback', 'page','normal', 'default' );
94
  }
95
  // Custom AMP Editor for Custom Post Types
templates/design-manager/design-1/elements/content.php CHANGED
@@ -20,20 +20,30 @@
20
  <div class="amp-wp-content post-pagination-meta">
21
  <div id="pagination">
22
  <?php $next_post = get_next_post();
23
- if (!empty( $next_post )) { ?>
 
24
  <div class="next">
25
- <?php $next_text = $next_post->post_title; ?>
26
- <a href="<?php echo ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a>
 
 
 
 
 
27
  </div>
28
  <?php }
29
 
30
  $prev_post = get_previous_post();
31
  if (!empty( $prev_post )) { ?>
32
  <div class="prev">
33
- <?php $prev_text = $prev_post->post_title; ?>
34
- <a href="<?php echo ampforwp_url_controller( get_permalink( $prev_post->ID ) ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a>
35
- </div>
36
- <?php } ?>
 
 
 
 
37
  <div class="cb"></div>
38
  </div>
39
  </div>
20
  <div class="amp-wp-content post-pagination-meta">
21
  <div id="pagination">
22
  <?php $next_post = get_next_post();
23
+ if (!empty( $next_post )) {
24
+ if(false == ampforwp_get_setting('single-next-prev-to-nonamp')){ ?>
25
  <div class="next">
26
+ <?php $next_text = $next_post->post_title;
27
+ $next_link = ampforwp_url_controller( get_permalink( $next_post->ID ));
28
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
29
+ $next_link = get_permalink( $next_post->ID );
30
+ } ?>
31
+ <a href="<?php echo esc_url($next_link); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
32
+ } ?>
33
  </div>
34
  <?php }
35
 
36
  $prev_post = get_previous_post();
37
  if (!empty( $prev_post )) { ?>
38
  <div class="prev">
39
+ <?php $prev_text = $prev_post->post_title;
40
+ $prev_link = ampforwp_url_controller( get_permalink( $prev_post->ID ));
41
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
42
+ $prev_link = get_permalink( $prev_post->ID );
43
+ } ?>
44
+ <a href="<?php echo esc_url($prev_link); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php } ?>
45
+
46
+ </div>
47
  <div class="cb"></div>
48
  </div>
49
  </div>
templates/design-manager/design-1/elements/meta-info.php CHANGED
@@ -29,8 +29,14 @@ if ( is_single() || (is_page() && $redux_builder_amp['meta_page']) ) : ?>
29
  <?php if( is_single() || ( is_page() && $redux_builder_amp['meta_page'] ) ) {
30
  global $redux_builder_amp;
31
  $date = get_the_date( get_option( 'date_format' ));
32
- if( 2 == $redux_builder_amp['ampforwp-post-date-global'] ){
33
- $date = get_the_modified_date( get_option( 'date_format' )) . ', ' . get_the_modified_time() ;
 
 
 
 
 
 
34
  }
35
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date ));
36
  }?>
29
  <?php if( is_single() || ( is_page() && $redux_builder_amp['meta_page'] ) ) {
30
  global $redux_builder_amp;
31
  $date = get_the_date( get_option( 'date_format' ));
32
+ if(1 == ampforwp_get_setting('ampforwp-post-date-global') && true == ampforwp_get_setting('ampforwp-post-time')){
33
+ $date = $date . ', ' . get_the_time();
34
+ }
35
+ if( 2 == ampforwp_get_setting('ampforwp-post-date-global')) {
36
+ $date = get_the_modified_date( get_option( 'date_format' ) );
37
+ }
38
+ if( 2 == ampforwp_get_setting('ampforwp-post-date-global') && true == ampforwp_get_setting('ampforwp-post-time')){
39
+ $date = get_the_modified_date( get_option( 'date_format' ) ) . ', ' . get_the_modified_time();
40
  }
41
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date ));
42
  }?>
templates/design-manager/design-1/elements/related-posts.php CHANGED
@@ -104,13 +104,24 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
104
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" title="<?php echo esc_html( $title ); ?>" ><?php the_title(); ?></a>
105
  <?php
106
  if ( isset($redux_builder_amp['ampforwp-single-related-posts-excerpt']) && true == $redux_builder_amp['ampforwp-single-related-posts-excerpt'] ) {
 
 
 
 
107
  if(has_excerpt()){
108
  $content = get_the_excerpt();
109
  }else{
110
  $content = get_the_content();
111
  } ?>
112
- <p><?php echo wp_trim_words( strip_shortcodes( $content ) , 15 ); ?></p>
113
- <?php } ?>
 
 
 
 
 
 
 
114
  </div>
115
  </li>
116
  <?php
104
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" title="<?php echo esc_html( $title ); ?>" ><?php the_title(); ?></a>
105
  <?php
106
  if ( isset($redux_builder_amp['ampforwp-single-related-posts-excerpt']) && true == $redux_builder_amp['ampforwp-single-related-posts-excerpt'] ) {
107
+ $class = 'large-screen-excerpt';
108
+ if ( true == ampforwp_get_setting('excerpt-option-small-rp') ) {
109
+ $class = 'small-screen-excerpt';
110
+ }
111
  if(has_excerpt()){
112
  $content = get_the_excerpt();
113
  }else{
114
  $content = get_the_content();
115
  } ?>
116
+ <p><?php $excerpt_length = ampforwp_get_setting('enable-excerpt-single-related-posts');
117
+ if(empty($excerpt_length)){
118
+ $excerpt_length = 15;
119
+ }
120
+ if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){
121
+ $content .= '...&nbsp;';
122
+ }
123
+ echo wp_trim_words( strip_shortcodes( $content ) , $excerpt_length ); ?><?php if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){ ?><a class="readmore-rp" href="<?php echo esc_url( $related_post_permalink ); ?>"><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-read-more'),'Read More') ?></a></p>
124
+ <?php } } ?>
125
  </div>
126
  </li>
127
  <?php
templates/design-manager/design-1/style.php CHANGED
@@ -300,7 +300,7 @@ a.btt:hover {
300
  amp-lightbox{ background: rgba(0, 0, 0,0.85); }
301
  <?php if( !ampforwp_woocommerce_conditional_check() ) { ?>
302
  <?php if( true == ampforwp_get_setting('ampforwp-single-select-type-of-related') && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID()) ){ ?>
303
- .related_posts span{display: block;}.related_posts ol{list-style-type:none;margin:0;padding:0}.related_posts ol li{width:100%;margin-bottom:12px;padding:0}.related_posts .related_link a{color:#000;font-size:18px}.related_posts ol li amp-img{width:100px;float:left;margin-right:15px}.related_posts ol li p{font-size:12px;color:#999;line-height:1.2;margin:7px 0 0}.no_related_thumbnail{padding:15px 18px} main .amp-wp-content.relatedpost{background:0 0;box-shadow:none;max-width:1030px}.relatedpost{margin:2em 16px}.related_posts span{font-size:14px;font-weight:700;letter-spacing:.4px;margin:25px 0 10px;color:#333; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;}
304
  .related_posts ol li{display:inline-block}
305
  <?php } ?>
306
  <?php if( is_singular() || is_home() && true == ampforwp_get_setting('amp-frontpage-select-option') && ampforwp_get_blog_details() == false && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID()) ) { ?>
@@ -609,8 +609,8 @@ if(class_exists('MCI_Footnotes')){ ?>
609
  div#footnote_references_container{
610
  display: unset;
611
  }
612
- .footnote_container_prepare p span:last-child {
613
- display:none;
614
  }
615
  <?php } ?>
616
  <?php // Footer Widget Satyling
@@ -679,4 +679,10 @@ amp-user-notification{
679
  <?php } //amp-enable-notifications Condition Ends Here ?>
680
  amp-facebook-like{
681
  max-height: 28px;
682
- }
 
 
 
 
 
 
300
  amp-lightbox{ background: rgba(0, 0, 0,0.85); }
301
  <?php if( !ampforwp_woocommerce_conditional_check() ) { ?>
302
  <?php if( true == ampforwp_get_setting('ampforwp-single-select-type-of-related') && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID()) ){ ?>
303
+ .related_posts span{display: block;}.related_posts ol{list-style-type:none;margin:0;padding:0}.related_posts ol li{width:100%;margin-bottom:12px;padding:0}.related_posts .related_link a{color:#000;font-size:18px}.related_posts ol li amp-img{width:100px;float:left;margin-right:15px}.related_posts ol li p{font-size:14px;color:#999;line-height:1.2;margin:7px 0 0}.no_related_thumbnail{padding:15px 18px} main .amp-wp-content.relatedpost{background:0 0;box-shadow:none;max-width:1030px}.relatedpost{margin:2em 16px}.related_posts span{font-size:14px;font-weight:700;letter-spacing:.4px;margin:25px 0 10px;color:#333; font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;}
304
  .related_posts ol li{display:inline-block}
305
  <?php } ?>
306
  <?php if( is_singular() || is_home() && true == ampforwp_get_setting('amp-frontpage-select-option') && ampforwp_get_blog_details() == false && !checkAMPforPageBuilderStatus(ampforwp_get_the_ID()) ) { ?>
609
  div#footnote_references_container{
610
  display: unset;
611
  }
612
+ #fn_span{
613
+ margin-left: 14px;
614
  }
615
  <?php } ?>
616
  <?php // Footer Widget Satyling
679
  <?php } //amp-enable-notifications Condition Ends Here ?>
680
  amp-facebook-like{
681
  max-height: 28px;
682
+ }
683
+ <?php if(true == ampforwp_get_setting('ampforwp-single-related-posts-excerpt')){?>
684
+ .related_posts .related_link a.readmore-rp {
685
+ font-size: 13px;
686
+ color:#999;
687
+ }
688
+ <?php }
templates/design-manager/design-2/elements/content.php CHANGED
@@ -23,16 +23,24 @@
23
  <?php $next_post = get_next_post();
24
  if (!empty( $next_post )) { ?>
25
  <div class="next">
26
- <?php $next_text = $next_post->post_title; ?> <a href="<?php echo ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo esc_attr(apply_filters('ampforwp_next_link',$next_text )); ?> &raquo;</a>
 
 
 
 
 
27
  </div>
28
  <?php }
29
  $prev_post = get_previous_post();
30
  if (!empty( $prev_post )) { ?>
31
  <div class="prev">
32
- <?php $prev_text = $prev_post->post_title; ?>
33
- <a href="<?php echo ampforwp_url_controller( get_permalink( $prev_post->ID ) ); ?>"> &laquo; <?php echo esc_attr(apply_filters('ampforwp_prev_link',$prev_text )); ?></a>
34
- </div>
35
- <?php } ?>
 
 
 
36
  <div class="clearfix"></div>
37
  </div>
38
  </div>
23
  <?php $next_post = get_next_post();
24
  if (!empty( $next_post )) { ?>
25
  <div class="next">
26
+ <?php $next_text = $next_post->post_title;
27
+ $next_link = ampforwp_url_controller( get_permalink( $next_post->ID ));
28
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
29
+ $next_link = get_permalink( $next_post->ID );
30
+ } ?>
31
+ <a href="<?php echo esc_url($next_link); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a>
32
  </div>
33
  <?php }
34
  $prev_post = get_previous_post();
35
  if (!empty( $prev_post )) { ?>
36
  <div class="prev">
37
+ <?php $prev_text = $prev_post->post_title;
38
+ $prev_link = ampforwp_url_controller( get_permalink( $prev_post->ID ));
39
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
40
+ $prev_link = get_permalink( $prev_post->ID );
41
+ } ?>
42
+ <a href="<?php echo esc_url($prev_link); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php } ?>
43
+ </div>
44
  <div class="clearfix"></div>
45
  </div>
46
  </div>
templates/design-manager/design-2/elements/meta-info.php CHANGED
@@ -14,8 +14,14 @@ if ( is_single() || (is_page() && $redux_builder_amp['meta_page']) ) : ?>
14
  echo ampforwp_get_author_details( $post_author , 'meta-info' ); ?>
15
  <li class="amp-wp-meta-date"> <?php global $redux_builder_amp;
16
  $date = get_the_date( get_option( 'date_format' ) );
17
- if( 2 == $redux_builder_amp['ampforwp-post-date-global'] ){
18
- $date = get_the_modified_date( get_option( 'date_format' )) . ', ' . get_the_modified_time() ;
 
 
 
 
 
 
19
  }
20
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date )) ?></li>
21
  <?php } ?>
14
  echo ampforwp_get_author_details( $post_author , 'meta-info' ); ?>
15
  <li class="amp-wp-meta-date"> <?php global $redux_builder_amp;
16
  $date = get_the_date( get_option( 'date_format' ) );
17
+ if(1 == ampforwp_get_setting('ampforwp-post-date-global') && true == ampforwp_get_setting('ampforwp-post-time')){
18
+ $date = $date . ', ' . get_the_time();
19
+ }
20
+ if( 2 == ampforwp_get_setting('ampforwp-post-date-global')) {
21
+ $date = get_the_modified_date( get_option( 'date_format' ) );
22
+ }
23
+ if( 2 == ampforwp_get_setting('ampforwp-post-date-global') && true == ampforwp_get_setting('ampforwp-post-time')){
24
+ $date = get_the_modified_date( get_option( 'date_format' ) ) . ', ' . get_the_modified_time();
25
  }
26
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date )) ?></li>
27
  <?php } ?>
templates/design-manager/design-2/elements/related-posts.php CHANGED
@@ -104,7 +104,7 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
104
 
105
  <?php if ( isset($redux_builder_amp['ampforwp-single-related-posts-excerpt']) && true == $redux_builder_amp['ampforwp-single-related-posts-excerpt'] ) {
106
  $class = 'large-screen-excerpt';
107
- if ( true == $redux_builder_amp['excerpt-option-design-2'] ) {
108
  $class = 'small-screen-excerpt';
109
  }
110
  if(has_excerpt()){
@@ -112,8 +112,16 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
112
  }else{
113
  $content = get_the_content();
114
  } ?>
115
- <p class="<?php echo esc_attr( $class ); ?>"><?php echo wp_trim_words( strip_shortcodes($content) , 15 ); ?></p>
116
- <?php } ?>
 
 
 
 
 
 
 
 
117
  </div>
118
  </li>
119
  <?php
104
 
105
  <?php if ( isset($redux_builder_amp['ampforwp-single-related-posts-excerpt']) && true == $redux_builder_amp['ampforwp-single-related-posts-excerpt'] ) {
106
  $class = 'large-screen-excerpt';
107
+ if ( true == ampforwp_get_setting('excerpt-option-small-rp') ) {
108
  $class = 'small-screen-excerpt';
109
  }
110
  if(has_excerpt()){
112
  }else{
113
  $content = get_the_content();
114
  } ?>
115
+ <p class="<?php echo $class; ?>"><?php
116
+ $excerpt_length = ampforwp_get_setting('enable-excerpt-single-related-posts');
117
+ if(empty($excerpt_length)){
118
+ $excerpt_length = 15;
119
+ }
120
+ if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){
121
+ $content .= '...&nbsp;';
122
+ }
123
+ echo wp_trim_words( strip_shortcodes($content) , $excerpt_length ); ?><?php if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){?><a class="readmore-rp" href="<?php echo esc_url( $related_post_permalink ); ?>"><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-read-more'),'Read More') ?></a></p>
124
+ <?php } } ?>
125
  </div>
126
  </li>
127
  <?php
templates/design-manager/design-2/style.php CHANGED
@@ -718,8 +718,8 @@ if(class_exists('MCI_Footnotes')){ ?>
718
  div#footnote_references_container{
719
  display: unset;
720
  }
721
- .footnote_container_prepare p span:last-child {
722
- display:none;
723
  }
724
  <?php } ?>
725
  <?php // Footer Widget Satyling
@@ -790,4 +790,13 @@ amp-user-notification{
790
  <?php } //amp-enable-notifications Condition Ends Here ?>
791
  amp-facebook-like{
792
  max-height: 28px;
793
- }
 
 
 
 
 
 
 
 
 
718
  div#footnote_references_container{
719
  display: unset;
720
  }
721
+ #fn_span{
722
+ margin-left: 14px;
723
  }
724
  <?php } ?>
725
  <?php // Footer Widget Satyling
790
  <?php } //amp-enable-notifications Condition Ends Here ?>
791
  amp-facebook-like{
792
  max-height: 28px;
793
+ }
794
+ <?php
795
+ if(true == ampforwp_get_setting('ampforwp-single-related-posts-excerpt')){?>
796
+ .related_posts .related_link a.readmore-rp {
797
+ font-size: 13px;
798
+ margin-left: 5px;
799
+ color: #999;
800
+ font-weight: normal;
801
+ }
802
+ <?php }
templates/design-manager/design-3/elements/content.php CHANGED
@@ -18,10 +18,12 @@
18
  <div class="amp-wp-content post-pagination-meta">
19
  <div id="pagination">
20
  <?php $next_post = get_next_post();
21
- if (!empty( $next_post )) { ?>
22
- <span><?php global $redux_builder_amp; echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-next-read-text'], 'Next Read' )); ?></span> <a href="<?php echo
23
- ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo $next_post->post_title; ?> &raquo;</a> <?php
24
- } ?>
 
 
25
  </div>
26
  </div>
27
  <?php } ?>
18
  <div class="amp-wp-content post-pagination-meta">
19
  <div id="pagination">
20
  <?php $next_post = get_next_post();
21
+ if (!empty( $next_post )) {
22
+ $next_link = ampforwp_url_controller( get_permalink( $next_post->ID ));
23
+ if(true == ampforwp_get_setting('single-next-prev-to-nonamp')){
24
+ $next_link = get_permalink( $next_post->ID );
25
+ } ?>
26
+ <span><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-next-read-text'), 'Next Read' ); ?></span> <a href="<?php echo esc_url($next_link); ?>"><?php echo esc_html($next_post->post_title); ?> &raquo;</a> <?php } ?>
27
  </div>
28
  </div>
29
  <?php } ?>
templates/design-manager/design-3/elements/meta-info.php CHANGED
@@ -42,10 +42,18 @@ if( isset($redux_builder_amp['ampforwp-cats-single']) && $redux_builder_amp['amp
42
  <?php if ( $redux_builder_amp['amp-design-3-date-feature'] ) : ?>
43
  <span class="ampforwp-design3-single-date"><?php global $redux_builder_amp;
44
  $date = get_the_date( get_option( 'date_format' ));
45
- if( 2 == $redux_builder_amp['ampforwp-post-date-global'] ){
 
 
 
46
  $date = get_the_modified_date( get_option( 'date_format' ) ) . ', ' . get_the_modified_time() ;
47
  }
48
-
 
 
 
 
 
49
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date )) ?></span>
50
  <?php endif; ?>
51
 
42
  <?php if ( $redux_builder_amp['amp-design-3-date-feature'] ) : ?>
43
  <span class="ampforwp-design3-single-date"><?php global $redux_builder_amp;
44
  $date = get_the_date( get_option( 'date_format' ));
45
+ if(1 == ampforwp_get_setting('ampforwp-post-date-global') && true == ampforwp_get_setting('ampforwp-post-time')){
46
+ $date = get_the_date( get_option( 'date_format' )) . ', ' . get_the_time();
47
+ }
48
+ elseif( 2 == ampforwp_get_setting('ampforwp-post-date-global') && true == ampforwp_get_setting('ampforwp-post-time')){
49
  $date = get_the_modified_date( get_option( 'date_format' ) ) . ', ' . get_the_modified_time() ;
50
  }
51
+ elseif(1 == ampforwp_get_setting('ampforwp-post-date-global')){
52
+ $date = get_the_date( get_option( 'date_format' ));
53
+ }
54
+ elseif(2 == ampforwp_get_setting('ampforwp-post-date-global')){
55
+ $date = get_the_modified_date( get_option( 'date_format' ) );
56
+ }
57
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date )) ?></span>
58
  <?php endif; ?>
59
 
templates/design-manager/design-3/elements/related-posts.php CHANGED
@@ -109,7 +109,7 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
109
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" title="<?php echo esc_html( $title ); ?>" ><?php the_title(); ?></a>
110
  <?php if ( isset($redux_builder_amp['ampforwp-single-related-posts-excerpt']) && true == $redux_builder_amp['ampforwp-single-related-posts-excerpt'] ) {
111
  $class = 'large-screen-excerpt-design-3';
112
- if ( true == $redux_builder_amp['excerpt-option-design-3'] ) {
113
  $class = 'small-screen-excerpt-design-3';
114
  }
115
  if(has_excerpt()){
@@ -117,8 +117,16 @@ if( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_
117
  }else{
118
  $content = get_the_content();
119
  } ?>
120
- <p class="<?php echo esc_attr($class); ?>"><?php echo wp_trim_words( strip_shortcodes( $content ) , 15 ); ?></p>
121
- <?php } ?>
 
 
 
 
 
 
 
 
122
  </div>
123
  </li>
124
  <?php
109
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" title="<?php echo esc_html( $title ); ?>" ><?php the_title(); ?></a>
110
  <?php if ( isset($redux_builder_amp['ampforwp-single-related-posts-excerpt']) && true == $redux_builder_amp['ampforwp-single-related-posts-excerpt'] ) {
111
  $class = 'large-screen-excerpt-design-3';
112
+ if ( true == ampforwp_get_setting('excerpt-option-small-rp')) {
113
  $class = 'small-screen-excerpt-design-3';
114
  }
115
  if(has_excerpt()){
117
  }else{
118
  $content = get_the_content();
119
  } ?>
120
+ <p class="<?php echo $class; ?>"><?php
121
+ $excerpt_length = ampforwp_get_setting('enable-excerpt-single-related-posts');
122
+ if(empty($excerpt_length)){
123
+ $excerpt_length = 15;
124
+ }
125
+ if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){
126
+ $content .= '...&nbsp;';
127
+ }
128
+ echo wp_trim_words( strip_shortcodes( $content ) , $excerpt_length ); ?><?php if (true == ampforwp_get_setting('excerpt-option-rp-read-more')){?><a class="readmore-rp" href="<?php echo esc_url( $related_post_permalink ); ?>"><?php echo ampforwp_translation(ampforwp_get_setting('amp-translator-read-more'),'Read More') ?></a></p>
129
+ <?php } } ?>
130
  </div>
131
  </li>
132
  <?php
templates/design-manager/design-3/single.php CHANGED
@@ -23,6 +23,44 @@
23
  <?php do_action('ampforwp_post_before_design_elements') ?>
24
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
25
  <?php do_action('ampforwp_post_after_design_elements') ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  </article>
27
  </main>
28
  <?php do_action( 'amp_post_template_above_footer', $this ); ?>
23
  <?php do_action('ampforwp_post_before_design_elements') ?>
24
  <?php $this->load_parts( apply_filters( 'ampforwp_design_elements', array( 'empty-filter' ) ) ); ?>
25
  <?php do_action('ampforwp_post_after_design_elements') ?>
26
+ <?php if(true==ampforwp_get_setting('ampforwp-design3-recent-posts') && !checkAMPforPageBuilderStatus(get_the_ID()) ) {?>
27
+ <div class="amp-wp-content relatedpost recentpost">
28
+ <div class="related_posts">
29
+ <span class="related-title"><?php echo esc_attr(ampforwp_translation(ampforwp_get_setting('amp-translator-recent-text'), 'Recent Posts' )); ?></span>
30
+ <ol class="clearfix">
31
+ <?php
32
+ $number_of_posts = 6;
33
+ if( !empty(ampforwp_get_setting('ampforwp-design3-number-of-recent-posts')) ){
34
+ $number_of_posts = (int) ampforwp_get_setting('ampforwp-design3-number-of-recent-posts');
35
+ }
36
+ while( amp_loop('start', array( 'posts_per_page' => $number_of_posts ) ) ): ?>
37
+ <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
38
+ <div class="related-post_image">
39
+ <a href="<?php echo esc_url( amp_loop_permalink() ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
40
+ <?php if ( ampforwp_has_post_thumbnail() ) {
41
+ $thumb_url = ampforwp_get_post_thumbnail();
42
+ $thumb_width = ampforwp_get_post_thumbnail('width');
43
+ $thumb_height = ampforwp_get_post_thumbnail('height');
44
+ if( $thumb_url && true == ampforwp_get_setting('amforwp-design3-recentpost-image-switch') ) { ?>
45
+ <amp-img src="<?php echo esc_url( $thumb_url ); ?>" width=<?php echo esc_attr($thumb_width); ?> height=<?php echo esc_attr($thumb_height); ?> layout="responsive"></amp-img>
46
+ <?php }
47
+ }?>
48
+ </a>
49
+ </div>
50
+ <div class="related_link">
51
+ <?php $title = get_the_title(); ?>
52
+ <a href="<?php echo esc_url( amp_loop_permalink() ); ?>" title="<?php echo esc_html( $title ); ?>" ><?php the_title(); ?></a>
53
+ <?php
54
+ if (true == ampforwp_get_setting('amforwp-design3-recentpost-date-switch') ) {
55
+ amp_loop_date();
56
+ }
57
+ ?>
58
+ </div>
59
+ </li>
60
+ <?php endwhile; amp_loop('end'); ?>
61
+ </div>
62
+ </div>
63
+ <?php } ?>
64
  </article>
65
  </main>
66
  <?php do_action( 'amp_post_template_above_footer', $this ); ?>
templates/design-manager/design-3/style.php CHANGED
@@ -369,6 +369,7 @@ main .amp-wp-content.featured-image-content{ padding: 0px; border: 0; margin-bot
369
  if ( ampforwp_get_setting('ampforwp-single-select-type-of-related') ) { ?>
370
  /* Related Posts */
371
  main .amp-wp-content.relatedpost{ background: none; box-shadow: none; padding:0px 0 0 0; margin:1.8em auto 1.5em auto }
 
372
  .single-post main,.related-title,.single-post .comments_list h3{ font-size: 20px; color: #777; font-family:'Roboto Slab', serif; border-bottom: 1px solid #eee; font-weight: 400; padding-bottom: 1px; margin-bottom: 10px; }
373
  .related-title {display:block}
374
  .related_posts ol{ list-style-type:none; margin:0; padding:0 }
@@ -881,7 +882,11 @@ if ( is_singular() && false == ampforwp_get_setting('amp-opt-sticky-head') ){?>
881
  margin-top: -75px;
882
  height: 75px;
883
  visibility: hidden;}
884
- <?php } ?>
 
 
 
 
885
 
886
  <?php // H1 - H6 Font Sizes
887
  if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h1') ){ ?>
@@ -919,8 +924,8 @@ if(class_exists('MCI_Footnotes')){ ?>
919
  div#footnote_references_container{
920
  display: unset;
921
  }
922
- .footnote_container_prepare p span:last-child {
923
- display:none;
924
  }
925
  <?php } ?>
926
  <?php // Footer Widget Satyling
@@ -992,4 +997,13 @@ amp-user-notification{
992
  amp-facebook-like{
993
  max-height: 28px;
994
  bottom: 8px;
995
- }
 
 
 
 
 
 
 
 
 
369
  if ( ampforwp_get_setting('ampforwp-single-select-type-of-related') ) { ?>
370
  /* Related Posts */
371
  main .amp-wp-content.relatedpost{ background: none; box-shadow: none; padding:0px 0 0 0; margin:1.8em auto 1.5em auto }
372
+ .recentpost .loop-date{font-size:14px;}
373
  .single-post main,.related-title,.single-post .comments_list h3{ font-size: 20px; color: #777; font-family:'Roboto Slab', serif; border-bottom: 1px solid #eee; font-weight: 400; padding-bottom: 1px; margin-bottom: 10px; }
374
  .related-title {display:block}
375
  .related_posts ol{ list-style-type:none; margin:0; padding:0 }
882
  margin-top: -75px;
883
  height: 75px;
884
  visibility: hidden;}
885
+ <?php if(class_exists('MCI_Footnotes')){ ?>
886
+ .amp-wp-content *[id]:before{
887
+ display: inline-block;
888
+ }
889
+ <?php } } ?>
890
 
891
  <?php // H1 - H6 Font Sizes
892
  if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h1') ){ ?>
924
  div#footnote_references_container{
925
  display: unset;
926
  }
927
+ #fn_span{
928
+ margin-left: 14px;
929
  }
930
  <?php } ?>
931
  <?php // Footer Widget Satyling
997
  amp-facebook-like{
998
  max-height: 28px;
999
  bottom: 8px;
1000
+ }
1001
+ <?php
1002
+ if(true == ampforwp_get_setting('ampforwp-single-related-posts-excerpt')){?>
1003
+ a.related_posts .related_link a.readmore-rp {
1004
+ font-size: 13px;
1005
+ color:#999;
1006
+ font-weight:normal;
1007
+ margin-left: 5px;
1008
+ }
1009
+ <?php }
templates/design-manager/swift/single.php CHANGED
@@ -215,11 +215,16 @@ do_action("ampforwp_single_design_type_handle_d1");
215
  </div>
216
  </div>
217
  <?php wp_reset_postdata(); } } ?>
218
- <?php if($redux_builder_amp['single-design-type'] == '1' && isset($redux_builder_amp['ampforwp-swift-recent-posts']) && $redux_builder_amp['ampforwp-swift-recent-posts']=='1' && !checkAMPforPageBuilderStatus(get_the_ID()) ) { ?>
219
  <div class="r-pf">
220
  <div class="cntr">
221
  <h3><?php echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-recent-text'], 'Recent Posts' )); ?></h3>
222
- <?php while( amp_loop('start', array( 'posts_per_page' => 6 ) ) ): ?>
 
 
 
 
 
223
  <div class="fsp">
224
  <?php if( ampforwp_has_post_thumbnail() ){
225
  $width = 346;
@@ -229,15 +234,19 @@ do_action("ampforwp_single_design_type_handle_d1");
229
  $height = $redux_builder_amp['ampforwp-swift-homepage-posts-height'];
230
  }
231
  $args = array("tag"=>'div',"tag_class"=>'image-container','image_size'=>'full','image_crop'=>'true','image_crop_width'=>$width,'image_crop_height'=>$height, 'responsive'=> true); ?>
 
232
  <div class="fsp-img">
233
  <?php amp_loop_image($args); ?>
234
  </div>
 
235
  <?php } ?>
236
  <div class="fsp-cnt">
237
  <?php amp_loop_category(); ?>
238
- <?php amp_loop_title(); ?>
239
- <?php amp_loop_excerpt(20); ?>
240
- <?php if( true == ampforwp_get_setting('amforwp-recentpost-date-switch')){?>
 
 
241
  <div class="pt-dt">
242
  <?php amp_loop_date(); ?>
243
  </div>
@@ -486,10 +495,15 @@ do_action("ampforwp_single_design_type_handle_d1");
486
  </div><!-- /.sp-rt -->
487
  </div><!-- /.sp-rl -->
488
  </div><!-- /.sp-cntn -->
489
- <?php if( $redux_builder_amp['single-design-type'] == '4' && isset($redux_builder_amp['ampforwp-swift-recent-posts']) && $redux_builder_amp['ampforwp-swift-recent-posts']=='1' && !checkAMPforPageBuilderStatus(get_the_ID()) ) {?>
490
  <div class="r-pf">
491
  <h3><?php echo ampforwp_translation($redux_builder_amp['amp-translator-recent-text'], 'Recent Posts' ); ?></h3>
492
- <?php while( amp_loop('start', array( 'posts_per_page' => 6 ) ) ): ?>
 
 
 
 
 
493
  <div class="fsp">
494
  <?php
495
  if(ampforwp_has_post_thumbnail()){
@@ -500,14 +514,20 @@ do_action("ampforwp_single_design_type_handle_d1");
500
  $height = $redux_builder_amp['ampforwp-swift-homepage-posts-height'];
501
  }
502
  $args = array("tag"=>'div',"tag_class"=>'image-container','image_size'=>'full','image_crop'=>'true','image_crop_width'=>$width,'image_crop_height'=>$height, 'responsive'=> true); ?>
 
 
 
503
  <div class="fsp-img">
504
  <?php amp_loop_image($args); ?>
505
  </div>
 
506
  <?php } ?>
507
  <div class="fsp-cnt">
508
  <?php amp_loop_category(); ?>
509
  <?php amp_loop_title(); ?>
510
- <?php amp_loop_excerpt(20); ?>
 
 
511
  <?php if( true == ampforwp_get_setting('amforwp-recentpost-date-switch')){?>
512
  <div class="pt-dt">
513
  <?php amp_loop_date(); ?>
215
  </div>
216
  </div>
217
  <?php wp_reset_postdata(); } } ?>
218
+ <?php if(ampforwp_get_setting('single-design-type') == true && ampforwp_get_setting('ampforwp-swift-recent-posts')=='1' && !checkAMPforPageBuilderStatus(get_the_ID()) ) { ?>
219
  <div class="r-pf">
220
  <div class="cntr">
221
  <h3><?php echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-recent-text'], 'Recent Posts' )); ?></h3>
222
+ <?php
223
+ $number_of_posts = 6;
224
+ if( !empty(ampforwp_get_setting('ampforwp-number-of-recent-posts')) ){
225
+ $number_of_posts = (int) ampforwp_get_setting('ampforwp-number-of-recent-posts');
226
+ }
227
+ while( amp_loop('start', array( 'posts_per_page' => $number_of_posts ) ) ): ?>
228
  <div class="fsp">
229
  <?php if( ampforwp_has_post_thumbnail() ){
230
  $width = 346;
234
  $height = $redux_builder_amp['ampforwp-swift-homepage-posts-height'];
235
  }
236
  $args = array("tag"=>'div',"tag_class"=>'image-container','image_size'=>'full','image_crop'=>'true','image_crop_width'=>$width,'image_crop_height'=>$height, 'responsive'=> true); ?>
237
+ <?php if( ampforwp_get_setting('amforwp-recentpost-image-switch') == true){?>
238
  <div class="fsp-img">
239
  <?php amp_loop_image($args); ?>
240
  </div>
241
+ <?php } ?>
242
  <?php } ?>
243
  <div class="fsp-cnt">
244
  <?php amp_loop_category(); ?>
245
+ <?php amp_loop_title(); ?>
246
+ <?php if( true == ampforwp_get_setting('amforwp-recentpost-excerpt-switch') ){
247
+ amp_loop_excerpt(20);
248
+ }
249
+ if( true == ampforwp_get_setting('amforwp-recentpost-date-switch')){ ?>
250
  <div class="pt-dt">
251
  <?php amp_loop_date(); ?>
252
  </div>
495
  </div><!-- /.sp-rt -->
496
  </div><!-- /.sp-rl -->
497
  </div><!-- /.sp-cntn -->
498
+ <?php if( $redux_builder_amp['single-design-type'] == '4' && ampforwp_get_setting('ampforwp-swift-recent-posts')=='1' && !checkAMPforPageBuilderStatus(get_the_ID()) ) {?>
499
  <div class="r-pf">
500
  <h3><?php echo ampforwp_translation($redux_builder_amp['amp-translator-recent-text'], 'Recent Posts' ); ?></h3>
501
+ <?php
502
+ $number_of_posts = 6;
503
+ if( !empty(ampforwp_get_setting('ampforwp-number-of-recent-posts')) ){
504
+ $number_of_posts = (int) ampforwp_get_setting('ampforwp-number-of-recent-posts');
505
+ }
506
+ while( amp_loop('start', array( 'posts_per_page' => $number_of_posts ) ) ): ?>
507
  <div class="fsp">
508
  <?php
509
  if(ampforwp_has_post_thumbnail()){
514
  $height = $redux_builder_amp['ampforwp-swift-homepage-posts-height'];
515
  }
516
  $args = array("tag"=>'div',"tag_class"=>'image-container','image_size'=>'full','image_crop'=>'true','image_crop_width'=>$width,'image_crop_height'=>$height, 'responsive'=> true); ?>
517
+ <?php
518
+ if( ampforwp_get_setting('amforwp-recentpost-image-switch') == true){
519
+ ?>
520
  <div class="fsp-img">
521
  <?php amp_loop_image($args); ?>
522
  </div>
523
+ <?php } ?>
524
  <?php } ?>
525
  <div class="fsp-cnt">
526
  <?php amp_loop_category(); ?>
527
  <?php amp_loop_title(); ?>
528
+ <?php if( true == ampforwp_get_setting('amforwp-recentpost-excerpt-switch') ){
529
+ amp_loop_excerpt(20);
530
+ } ?>
531
  <?php if( true == ampforwp_get_setting('amforwp-recentpost-date-switch')){?>
532
  <div class="pt-dt">
533
  <?php amp_loop_date(); ?>
templates/design-manager/swift/style.php CHANGED
@@ -676,6 +676,9 @@ padding-right:20px;
676
  padding-left: 20px;
677
  <?php } ?>
678
  }
 
 
 
679
  .artl-cnt ul li:before{content: "";display: inline-block;width: 5px;height: 5px;background: #333;position: absolute;top:12px;
680
  <?php if( true == ampforwp_get_setting('amp-rtl-select-option') ) {?>
681
  right:0;
@@ -795,6 +798,7 @@ letter-spacing: 0.10px;margin-top: 5px;font-weight: 400;}
795
  .related_posts .has_related_thumbnail{display: inline-flex;width: 29%;flex-direction: column;margin:0px 30px 30px 0px;justify-content: space-evenly;padding:0;}
796
  .related_posts .related_link p{word-break: break-word;color: #444;font-size: 13px;line-height: 20px;
797
  letter-spacing: 0.10px;margin-top: 5px;font-weight: 400;}
 
798
  <?php } ?>
799
  <?php if( true == ampforwp_get_setting('amp-author-description') ) { ?>
800
  .sp-rt .amp-author {padding: 20px 20px;border-radius: 0;background: #f9f9f9;border: 1px solid #ececec;display: inline-block;width: 100%;}
@@ -2199,9 +2203,9 @@ if(class_exists('MCI_Footnotes')){ ?>
2199
  div#footnote_references_container{
2200
  display: unset;
2201
  }
2202
- .footnote_container_prepare p span:last-child {
2203
- display:none;
2204
- }
2205
  <?php } ?>
2206
  <?php // Notification CSS
2207
  if( ampforwp_get_setting('amp-enable-notifications') && ampforwp_get_setting('enable-single-social-icons') && is_single() ) { ?>
@@ -2226,4 +2230,10 @@ if( true == ampforwp_get_setting('gnrl-sidebar') && true == ampforwp_get_setting
2226
  max-width:100%;
2227
  }
2228
  }
 
 
 
 
 
 
2229
  <?php }
676
  padding-left: 20px;
677
  <?php } ?>
678
  }
679
+ .ampforwp-inline-related-post .artl-cnt ul li, .artl-cnt ol li{
680
+ position: unset;
681
+ }
682
  .artl-cnt ul li:before{content: "";display: inline-block;width: 5px;height: 5px;background: #333;position: absolute;top:12px;
683
  <?php if( true == ampforwp_get_setting('amp-rtl-select-option') ) {?>
684
  right:0;
798
  .related_posts .has_related_thumbnail{display: inline-flex;width: 29%;flex-direction: column;margin:0px 30px 30px 0px;justify-content: space-evenly;padding:0;}
799
  .related_posts .related_link p{word-break: break-word;color: #444;font-size: 13px;line-height: 20px;
800
  letter-spacing: 0.10px;margin-top: 5px;font-weight: 400;}
801
+ .related_posts ol li::before{ content: " ";}
802
  <?php } ?>
803
  <?php if( true == ampforwp_get_setting('amp-author-description') ) { ?>
804
  .sp-rt .amp-author {padding: 20px 20px;border-radius: 0;background: #f9f9f9;border: 1px solid #ececec;display: inline-block;width: 100%;}
2203
  div#footnote_references_container{
2204
  display: unset;
2205
  }
2206
+ #fn_span{
2207
+ margin-left: 14px;
2208
+ }
2209
  <?php } ?>
2210
  <?php // Notification CSS
2211
  if( ampforwp_get_setting('amp-enable-notifications') && ampforwp_get_setting('enable-single-social-icons') && is_single() ) { ?>
2230
  max-width:100%;
2231
  }
2232
  }
2233
+ <?php }
2234
+
2235
+ if(true == ampforwp_get_setting('ampforwp-single-related-posts-excerpt')){?>
2236
+ a.readmore-rp {
2237
+ font-size: 13px;
2238
+ }
2239
  <?php }
templates/features.php CHANGED
@@ -199,14 +199,14 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
199
  global $wp, $post;
200
  $post_id = '';
201
  $endpoint_check = false;
202
- $endpoint_check = $redux_builder_amp['amp-core-end-point'];
203
  if( is_attachment() ) {
204
  return;
205
  }
206
- if( is_home() && is_front_page() && !$redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
207
  return;
208
  }
209
- if( is_front_page() && ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
210
  return;
211
  }
212
  // Skip this condition for woocommerce product archive and shop pages.
@@ -241,6 +241,9 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
241
  if(function_exists('is_checkout') && is_checkout()){
242
  return;
243
  }
 
 
 
244
  }
245
  // no-amphtml for search
246
  // if(is_search()){
@@ -250,14 +253,14 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
250
  if ( is_category_amp_disabled() ) {
251
  return;
252
  }
253
- if ( is_page() && ! $redux_builder_amp['amp-on-off-for-all-pages'] && ! is_home() && ! is_front_page() ) {
254
  return;
255
  }
256
- if ( is_home() && ! ampforwp_is_blog() && !$redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
257
  return;
258
  }
259
 
260
- if ( ampforwp_is_blog() && ! $redux_builder_amp['amp-on-off-for-all-pages'] ) {
261
  return;
262
  }
263
  $query_arg_array = $wp->query_vars;
@@ -299,12 +302,9 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
299
 
300
  $type = get_post_type();
301
  if(is_home() || is_front_page()){
302
- if(isset($redux_builder_amp['ampforwp-homepage-on-off-support'])
303
- && $redux_builder_amp['ampforwp-homepage-on-off-support'] == 1
304
- && isset($redux_builder_amp['amp-on-off-for-all-posts'])
305
- && $redux_builder_amp['amp-on-off-for-all-posts'] == 0
306
- && isset($redux_builder_amp['amp-on-off-for-all-pages'])
307
- && $redux_builder_amp['amp-on-off-for-all-pages'] == 0 ){
308
 
309
  $supported_types['post'] = 'post';
310
  }
@@ -340,93 +340,8 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
340
  $current_search_url =trailingslashit(get_home_url())."?amp=1&s=".get_search_query();
341
  $amp_url = untrailingslashit($current_search_url);
342
  }
343
-
344
-
345
- if( class_exists('SitePress') ){
346
- if( get_option('permalink_structure') ){
347
- global $sitepress_settings, $wp;
348
- if($sitepress_settings[ 'language_negotiation_type' ] == 3){
349
- if( is_singular() ){
350
- $active_langs = $sitepress_settings['active_languages'];
351
- $found = '';
352
- $wpml_url =get_permalink( get_queried_object_id() );
353
- $untrail_wpml_url = untrailingslashit($wpml_url);
354
- $explode_url = explode('/', $untrail_wpml_url);
355
- $append_amp = AMPFORWP_AMP_QUERY_VAR;
356
- foreach ($active_langs as $active_lang) {
357
- foreach($explode_url as $a) {
358
- if (stripos('?lang='.$active_lang ,$a) !== false){
359
- $amp_url = add_query_arg('amp','1',$wpml_url);
360
- $found = 'found';
361
- break 2;
362
- }
363
- }
364
- }
365
- if($found == ''){
366
- array_splice( $explode_url, count($explode_url), 0, $append_amp );
367
- $impode_url = implode('/', $explode_url);
368
- $amp_url = trailingslashit($impode_url);
369
- }
370
- }
371
- if ( is_home() || is_archive() ){
372
- global $wp;
373
- $current_archive_url = home_url( $wp->request );
374
- $explode_path = explode("/",$current_archive_url);
375
- $inserted = array(AMPFORWP_AMP_QUERY_VAR);
376
- $query_arg_array = $wp->query_vars;
377
- if( array_key_exists( 'paged' , $query_arg_array ) ) {
378
- $active_langs = $sitepress_settings['active_languages'];
379
- $found = '';
380
- foreach ($active_langs as $active_lang) {
381
-
382
- foreach($explode_path as $a) {
383
- if (stripos('?lang='.$active_lang ,$a) !== false){
384
- $amp_url = add_query_arg('amp','1',$current_archive_url);
385
- $found = 'found';
386
- break 2;
387
- }
388
- }
389
-
390
- }
391
- if($found == ''){
392
- array_splice( $explode_path, count($explode_path), 0, $inserted );
393
- $impode_url = implode('/', $explode_path);
394
- $amp_url = $impode_url;
395
-
396
- }
397
- }
398
- else{
399
- $active_langs = $sitepress_settings['active_languages'];
400
- $found = '';
401
- foreach ($active_langs as $active_lang) {
402
-
403
- foreach($explode_path as $a) {
404
- if (stripos('?lang='.$active_lang ,$a) !== false){
405
-
406
- $amp_url = add_query_arg('amp','1',$current_archive_url);
407
- $found = 'found';
408
- break 2;
409
- }
410
- }
411
- }
412
- if($found == ''){
413
- array_splice( $explode_path, count($explode_path), 0, $inserted );
414
- $impode_url = implode('/', $explode_path);
415
- $amp_url = trailingslashit($impode_url);
416
-
417
- }
418
- }
419
- }
420
- }else{
421
- $amp_url = ampforwp_url_purifier($amp_url);
422
- }
423
- }
424
- }
425
- if( !class_exists('SitePress') ){
426
- // URL Purifier
427
- $amp_url = ampforwp_url_purifier($amp_url);
428
- }
429
-
430
  $amp_url = apply_filters('ampforwp_modify_rel_canonical',$amp_url);
431
 
432
  if( $supported_amp_post_types || ampforwp_is_front_page() ) {
@@ -733,6 +648,8 @@ function ampforwp_new_dir( $dir ) {
733
  $content = preg_replace('/<a(.*?)(value=".*?")(.*?)>/', '<a$1$3>', $content);
734
  //Compatibility with Cloudflare stream. #3230
735
  $content = preg_replace('/<stream[^>]* src="(.*?)"><\/stream>/', '<amp-iframe width="175" height="100" sandbox="allow-scripts allow-same-origin" layout="responsive" allowfullscreen src="https://iframe.cloudflarestream.com/$1"></amp-iframe>', $content);
 
 
736
 
737
  return $content;
738
  }
@@ -762,18 +679,11 @@ function ampforwp_new_dir( $dir ) {
762
  * Adds a meta box to the post editing screen for AMP on-off on specific pages
763
  */
764
  function ampforwp_title_custom_meta() {
765
- global $redux_builder_amp;
766
-
767
  $post_types = ampforwp_get_all_post_types();
768
 
769
- $user_level = '';
770
- $user_level = current_user_can( 'manage_options' );
771
-
772
- if ( isset( $redux_builder_amp['amp-meta-permissions'] ) && $redux_builder_amp['amp-meta-permissions'] == 'all' ) {
773
- $user_level = true;
774
- }
775
-
776
- if ( $post_types && $user_level ) { // If there are any custom public post types.
777
 
778
  foreach ( $post_types as $post_type ) {
779
 
@@ -785,7 +695,8 @@ function ampforwp_title_custom_meta() {
785
  add_meta_box( 'ampforwp_title_meta', esc_html__( 'Show AMP for Current Page?','accelerated-mobile-pages' ), 'ampforwp_title_callback', 'post','side' );
786
  }
787
  // Pages
788
- if( $redux_builder_amp['amp-on-off-for-all-pages'] && $post_type == 'page' ) {
 
789
  add_meta_box( 'ampforwp_title_meta', esc_html__( 'Show AMP for Current Page?' ,'accelerated-mobile-pages'), 'ampforwp_title_callback','page','side' );
790
  }
791
  // Custom Post Types
@@ -834,7 +745,7 @@ function ampforwp_title_callback( $post ) {
834
  set_transient('ampforwp_exclude_post_transient', $exclude_post_value);
835
  }
836
  }
837
- if ( empty( $ampforwp_stored_meta['ampforwp-amp-on-off'][0] ) && $post->post_type == 'page' && ampforwp_get_setting('amp-pages-meta-default') == 'hide' ) {
838
  $ampforwp_stored_meta['ampforwp-amp-on-off'][0] = 'hide-amp';
839
  }?>
840
  <p>
@@ -888,14 +799,7 @@ function ampforwp_mobile_redirection() {
888
  global $redux_builder_amp;
889
  $post_types = ampforwp_get_all_post_types();
890
 
891
- $user_level = '';
892
- $user_level = current_user_can( 'manage_options' );
893
-
894
- if ( isset( $redux_builder_amp['amp-meta-permissions'] ) && $redux_builder_amp['amp-meta-permissions'] == 'all' ) {
895
- $user_level = true;
896
- }
897
-
898
- if ( $post_types && $user_level ) { // If there are any custom public post types.
899
 
900
  foreach ( $post_types as $post_type ) {
901
 
@@ -3173,17 +3077,36 @@ function ampforwp_call_button_html_output(){
3173
  add_action('ampforwp_after_post_content','ampforwp_add_modified_date');
3174
  function ampforwp_add_modified_date($post_object){
3175
  global $redux_builder_amp;
3176
- if ( is_single() && $redux_builder_amp['post-modified-date'] && ( ! checkAMPforPageBuilderStatus( get_the_ID() ) ) ) { ?>
3177
  <div class="ampforwp-last-modified-date">
3178
  <p> <?php
3179
- if( $post_object->get( 'post_modified_timestamp' ) !== $post_object->get( 'post_publish_timestamp' ) ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3180
  echo esc_html(
3181
  sprintf(
3182
- _x( ampforwp_translation( $redux_builder_amp['amp-translator-modified-date-text'],'This article was last modified on ' ) . ' %s ' , '%s = human-readable time difference', 'accelerated-mobile-pages' ),
3183
- date_i18n( get_option( 'date_format' ) , $post_object->get( 'post_modified_timestamp' ) )
3184
  )
3185
  );
3186
- echo get_the_modified_time(); } ?>
 
 
 
 
3187
  </p>
3188
  </div> <?php
3189
  }
@@ -4348,7 +4271,20 @@ if (! function_exists( 'ampforwp_get_body_class' ) ) {
4348
  // Ensure that we always coerce class to being an array.
4349
  $class = array();
4350
  }
4351
-
 
 
 
 
 
 
 
 
 
 
 
 
 
4352
  $classes = array_map( 'esc_attr', $classes );
4353
  $classes = apply_filters( 'ampforwp_body_class', $classes, $class );
4354
 
@@ -4577,6 +4513,18 @@ function ampforwp_inline_related_posts(){
4577
  );
4578
  }
4579
  }//end of block for tags
 
 
 
 
 
 
 
 
 
 
 
 
4580
  $my_query = new wp_query( $args );
4581
  if( $my_query->have_posts() ) {
4582
  $inline_related_posts_img = '';
@@ -5799,7 +5747,7 @@ function ampforwp_coauthors_links($args){
5799
  //remove anchor from the image when lightbox option is enabled #2695
5800
  add_action('pre_amp_render_post','ampforwp_remove_ahref_lightbox');
5801
  function ampforwp_remove_ahref_lightbox(){
5802
- if(true == ampforwp_get_setting('ampforwp-amp-img-lightbox')){
5803
  add_filter( 'the_content', 'ampforwp_remove_ahref_lightbox_in_amp' );
5804
  add_filter('tablepress_table_render_data','amforwp_remove_tp_image_href');
5805
  }
@@ -6295,12 +6243,8 @@ add_action( 'add_meta_boxes', 'ampforwp_ia_meta_box' );
6295
  if ( ! function_exists('ampforwp_ia_meta_box') ) {
6296
  function ampforwp_ia_meta_box() {
6297
  global $redux_builder_amp, $post;
6298
- $user_level = '';
6299
- $user_level = current_user_can( 'manage_options' );
6300
- if ( isset( $redux_builder_amp['amp-meta-permissions'] ) && $redux_builder_amp['amp-meta-permissions'] == 'all' ) {
6301
- $user_level = true;
6302
- }
6303
- if ( $user_level ) {
6304
  if( true == $redux_builder_amp['fb-instant-article-switch'] && $post->post_type == 'post' ) {
6305
  add_meta_box( 'ampforwp_ia_meta', esc_html__( 'Show Instant Article for Current Post?','accelerated-mobile-pages' ), 'ampforwp_ia_meta_callback', 'post','side' );
6306
  }
@@ -6988,3 +6932,88 @@ if ( ! function_exists('ampforwp_include_opengraph') ) {
6988
  }
6989
  }
6990
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  global $wp, $post;
200
  $post_id = '';
201
  $endpoint_check = false;
202
+ $endpoint_check = ampforwp_get_setting('amp-core-end-point');
203
  if( is_attachment() ) {
204
  return;
205
  }
206
+ if( is_home() && is_front_page() && !ampforwp_get_setting('ampforwp-homepage-on-off-support') ) {
207
  return;
208
  }
209
+ if( is_front_page() && ! ampforwp_get_setting('ampforwp-homepage-on-off-support') ) {
210
  return;
211
  }
212
  // Skip this condition for woocommerce product archive and shop pages.
241
  if(function_exists('is_checkout') && is_checkout()){
242
  return;
243
  }
244
+ if(function_exists('is_account_page') && is_account_page()){
245
+ return;
246
+ }
247
  }
248
  // no-amphtml for search
249
  // if(is_search()){
253
  if ( is_category_amp_disabled() ) {
254
  return;
255
  }
256
+ if ( is_page() && ! ampforwp_get_setting('amp-on-off-for-all-pages') && ! is_home() && ! is_front_page() ) {
257
  return;
258
  }
259
+ if ( is_home() && ! ampforwp_is_blog() && !ampforwp_get_setting('ampforwp-homepage-on-off-support') ) {
260
  return;
261
  }
262
 
263
+ if ( ampforwp_is_blog() && ! ampforwp_get_setting('amp-on-off-for-all-pages') ) {
264
  return;
265
  }
266
  $query_arg_array = $wp->query_vars;
302
 
303
  $type = get_post_type();
304
  if(is_home() || is_front_page()){
305
+ if( ampforwp_get_setting('ampforwp-homepage-on-off-support') == 1
306
+ && ampforwp_get_setting('amp-on-off-for-all-posts') == 0
307
+ && ampforwp_get_setting('amp-on-off-for-all-pages') == 0 ){
 
 
 
308
 
309
  $supported_types['post'] = 'post';
310
  }
340
  $current_search_url =trailingslashit(get_home_url())."?amp=1&s=".get_search_query();
341
  $amp_url = untrailingslashit($current_search_url);
342
  }
343
+ // URL Purifier
344
+ $amp_url = ampforwp_url_purifier($amp_url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  $amp_url = apply_filters('ampforwp_modify_rel_canonical',$amp_url);
346
 
347
  if( $supported_amp_post_types || ampforwp_is_front_page() ) {
648
  $content = preg_replace('/<a(.*?)(value=".*?")(.*?)>/', '<a$1$3>', $content);
649
  //Compatibility with Cloudflare stream. #3230
650
  $content = preg_replace('/<stream[^>]* src="(.*?)"><\/stream>/', '<amp-iframe width="175" height="100" sandbox="allow-scripts allow-same-origin" layout="responsive" allowfullscreen src="https://iframe.cloudflarestream.com/$1"></amp-iframe>', $content);
651
+ //Compatibility with amp-connatix-player #3524
652
+ $content = preg_replace('/<script id="(.*?)">(.*?)playerId:\s\'(.*?)\'(.*?)mediaId:\s\'(.*?)\'(.*?)<\/script>/s', '<amp-connatix-player data-player-id="$3" data-media-id = "$5" layout="responsive" width="16" height="9"></amp-connatix-player>', $content);
653
 
654
  return $content;
655
  }
679
  * Adds a meta box to the post editing screen for AMP on-off on specific pages
680
  */
681
  function ampforwp_title_custom_meta() {
682
+ global $redux_builder_amp;
683
+ global $post_id;
684
  $post_types = ampforwp_get_all_post_types();
685
 
686
+ if ( $post_types && (ampforwp_role_based_access_options() == true && ( current_user_can('edit_posts') || current_user_can('edit_pages') ) ) ) { // If there are any custom public post types.
 
 
 
 
 
 
 
687
 
688
  foreach ( $post_types as $post_type ) {
689
 
695
  add_meta_box( 'ampforwp_title_meta', esc_html__( 'Show AMP for Current Page?','accelerated-mobile-pages' ), 'ampforwp_title_callback', 'post','side' );
696
  }
697
  // Pages
698
+ $frontpage_id = ampforwp_get_the_ID();
699
+ if( ampforwp_get_setting('amp-on-off-for-all-pages') && $post_type == 'page' || ( true == ampforwp_get_setting('amp-frontpage-select-option') && $post_id == $frontpage_id ) ) {
700
  add_meta_box( 'ampforwp_title_meta', esc_html__( 'Show AMP for Current Page?' ,'accelerated-mobile-pages'), 'ampforwp_title_callback','page','side' );
701
  }
702
  // Custom Post Types
745
  set_transient('ampforwp_exclude_post_transient', $exclude_post_value);
746
  }
747
  }
748
+ if ($post->post_type == 'page' && ampforwp_get_setting('amp-pages-meta-default') == 'hide' ) {
749
  $ampforwp_stored_meta['ampforwp-amp-on-off'][0] = 'hide-amp';
750
  }?>
751
  <p>
799
  global $redux_builder_amp;
800
  $post_types = ampforwp_get_all_post_types();
801
 
802
+ if ( $post_types && ampforwp_role_based_access_options() == true ) { // If there are any custom public post types.
 
 
 
 
 
 
 
803
 
804
  foreach ( $post_types as $post_type ) {
805
 
3077
  add_action('ampforwp_after_post_content','ampforwp_add_modified_date');
3078
  function ampforwp_add_modified_date($post_object){
3079
  global $redux_builder_amp;
3080
+ if ( is_single() && $redux_builder_amp['post-modified-date'] == true && ( ! checkAMPforPageBuilderStatus( get_the_ID() ) ) ) { ?>
3081
  <div class="ampforwp-last-modified-date">
3082
  <p> <?php
3083
+ $date_notice_type = ampforwp_get_setting('ampforwp-post-date-notice-type');
3084
+ if( $date_notice_type == "modified" && $post_object->get( 'post_modified_timestamp' ) !== $post_object->get( 'post_publish_timestamp' ) ){
3085
+ $date_notice_text = ampforwp_get_setting('amp-translator-modified-date-text');
3086
+ $date = $post_object->get( 'post_modified_timestamp' );
3087
+ echo esc_html(
3088
+ sprintf(
3089
+ _x( ampforwp_translation( $date_notice_text ,'This article was last modified on ' ) . ' %s ' , '%s = human-readable time difference', 'accelerated-mobile-pages' ),
3090
+ date_i18n( get_option( 'date_format' ) , $date )
3091
+ )
3092
+ );
3093
+ if(true == ampforwp_get_setting('ampforwp-post-date-notice-time')){
3094
+ echo get_the_modified_time();
3095
+ }
3096
+ }elseif($date_notice_type == "published"){
3097
+ $date_notice_text = ampforwp_get_setting('amp-translator-published-date-text');
3098
+ $date = $post_object->get( 'post_publish_timestamp' );
3099
  echo esc_html(
3100
  sprintf(
3101
+ _x( ampforwp_translation( $date_notice_text ,'This article was last modified on ' ) . ' %s ' , '%s = human-readable time difference', 'accelerated-mobile-pages' ),
3102
+ date_i18n( get_option( 'date_format' ) , $date )
3103
  )
3104
  );
3105
+ if(true == ampforwp_get_setting('ampforwp-post-date-notice-time')){
3106
+ echo get_the_modified_time();
3107
+ }
3108
+ }
3109
+ ?>
3110
  </p>
3111
  </div> <?php
3112
  }
4271
  // Ensure that we always coerce class to being an array.
4272
  $class = array();
4273
  }
4274
+ if(is_tax()){
4275
+ $term = get_queried_object();
4276
+ if ( isset( $term->term_id ) ) {
4277
+ $term_class = sanitize_html_class( $term->slug, $term->term_id );
4278
+ if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
4279
+ $term_class = $term->term_id;
4280
+ }
4281
+ $classes[] = 'tax-' . sanitize_html_class( $term->taxonomy );
4282
+ $classes[] = 'term-' . $term_class;
4283
+ $classes[] = 'term-' . $term->term_id;
4284
+ }
4285
+ }else{
4286
+ $classes[] = get_post_type();
4287
+ }
4288
  $classes = array_map( 'esc_attr', $classes );
4289
  $classes = apply_filters( 'ampforwp_body_class', $classes, $class );
4290
 
4513
  );
4514
  }
4515
  }//end of block for tags
4516
+ if(true == ampforwp_get_setting('ampforwp-in-content-related-posts-days-switch')){
4517
+ $date_range = strtotime ( '-' . ampforwp_get_setting('ampforwp-in-content-related-posts-days-text') .' day' );
4518
+ $args['date_query'] = array(
4519
+ array(
4520
+ 'after' => array(
4521
+ 'year' => date('Y', esc_html($date_range) ),
4522
+ 'month' => date('m', esc_html($date_range) ),
4523
+ 'day' => date('d', esc_html($date_range)),
4524
+ ),
4525
+ )
4526
+ );
4527
+ }
4528
  $my_query = new wp_query( $args );
4529
  if( $my_query->have_posts() ) {
4530
  $inline_related_posts_img = '';
5747
  //remove anchor from the image when lightbox option is enabled #2695
5748
  add_action('pre_amp_render_post','ampforwp_remove_ahref_lightbox');
5749
  function ampforwp_remove_ahref_lightbox(){
5750
+ if(true == ampforwp_get_setting('ampforwp-amp-img-lightbox') && true == ampforwp_get_setting('ampforwp-lightbox-external-links')){
5751
  add_filter( 'the_content', 'ampforwp_remove_ahref_lightbox_in_amp' );
5752
  add_filter('tablepress_table_render_data','amforwp_remove_tp_image_href');
5753
  }
6243
  if ( ! function_exists('ampforwp_ia_meta_box') ) {
6244
  function ampforwp_ia_meta_box() {
6245
  global $redux_builder_amp, $post;
6246
+
6247
+ if ( ampforwp_role_based_access_options() == true ) {
 
 
 
 
6248
  if( true == $redux_builder_amp['fb-instant-article-switch'] && $post->post_type == 'post' ) {
6249
  add_meta_box( 'ampforwp_ia_meta', esc_html__( 'Show Instant Article for Current Post?','accelerated-mobile-pages' ), 'ampforwp_ia_meta_callback', 'post','side' );
6250
  }
6932
  }
6933
  }
6934
  }
6935
+
6936
+ add_action('wp_ajax_ampforwp_import_file_from_file','ampforwp_import_settings_from_file');
6937
+ function ampforwp_import_settings_from_file(){
6938
+ $security = $_POST['security'];
6939
+ if ( wp_verify_nonce( $security, 'ampforwp_import_file' ) && current_user_can( 'manage_options' ) ) {
6940
+ if(isset($_FILES["file"]["tmp_name"])){
6941
+ $content = file_get_contents($_FILES["file"]["tmp_name"]);
6942
+ if ( ! empty ( $content ) ) {
6943
+ $imported_options = json_decode( $content, true );
6944
+ }
6945
+ $plugin_options = get_option('redux_builder_amp');
6946
+ if ( ! empty ( $imported_options ) && is_array( $imported_options ) && isset ( $imported_options['redux-backup'] ) && $imported_options['redux-backup'] == '1' ) {
6947
+ echo $content;
6948
+ }
6949
+ }
6950
+ }
6951
+ }
6952
+
6953
+ add_filter('ampforwp_loop_image_update','ampforwp_recentpost_link_to_nonamp');
6954
+ function ampforwp_recentpost_link_to_nonamp($image_link_data){
6955
+ if( true == ampforwp_get_setting('ampforwp-recentpost-posts-link') ){
6956
+ $image_link_data['image_link'] = get_permalink();
6957
+ }else{
6958
+ $image_link_data['image_link'] = ampforwp_url_controller( get_permalink() ) ;
6959
+ }
6960
+ return $image_link_data;
6961
+ }
6962
+ #3596 link to nonamp option on title for recent posts
6963
+ add_filter('ampforwp_loop_permalink_update','ampforwp_recentpost_title_link_to_nonamp');
6964
+ function ampforwp_recentpost_title_link_to_nonamp($title_link){
6965
+ if( true == ampforwp_get_setting('ampforwp-recentpost-posts-link') ){
6966
+ $title_link = get_permalink();
6967
+ }else{
6968
+ $title_link = ampforwp_url_controller( get_permalink() ) ;
6969
+ }
6970
+ return $title_link;
6971
+ }
6972
+
6973
+ // Post Meta Revisions #3548 -- start here --
6974
+ add_filter( '_wp_post_revision_field_amp_page_builder', 'ampforwp_meta_revi_pb_field', 22, 2 );
6975
+ add_action( 'save_post', 'ampforwp_meta_revi_save_post', 10, 2 );
6976
+ add_action( 'wp_restore_post_revision', 'ampforwp_meta_restore_revision', 10, 2 );
6977
+ add_filter( '_wp_post_revision_fields', 'ampforwp_meta_revi_fields' );
6978
+ // Displaying the meta field on the revisions screen
6979
+ function ampforwp_meta_revi_fields( $fields ) {
6980
+ $fields['post_title'] = 'Title';
6981
+ $fields['post_content'] = 'Content';
6982
+ $fields['post_excerpt'] = 'Excerpt';
6983
+ $fields['amp-page-builder'] = 'AMP Page Builder';
6984
+ return $fields;
6985
+ }
6986
+ // Displaying the meta field on the revisions screen
6987
+ function ampforwp_meta_revi_pb_field( $value, $field ) {
6988
+ global $revision;
6989
+ return get_metadata( 'post', $revision->ID, $field, true );
6990
+ }
6991
+ // Reverting to the correct revision of the meta field when a post is reverted
6992
+ function ampforwp_meta_restore_revision( $post_id, $revision_id ) {
6993
+ if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
6994
+ return;
6995
+ }
6996
+ $post = get_post( $post_id );
6997
+ $revision = get_post( $revision_id );
6998
+ $meta = get_metadata( 'post', $revision->ID, 'amp-page-builder', true );
6999
+ if ( false === $meta ) {
7000
+ delete_post_meta( $post_id, 'amp-page-builder' );
7001
+ }
7002
+ else{
7003
+ update_post_meta( $post_id, 'amp-page-builder', $meta );
7004
+ }
7005
+ }
7006
+ // Storing a revision of the meta field when a post is saved
7007
+ function ampforwp_meta_revi_save_post( $post_id, $post ) {
7008
+ if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) {
7009
+ return;
7010
+ }
7011
+ if ( $parent_id = wp_is_post_revision( $post_id ) ) {
7012
+ $parent = get_post( $parent_id );
7013
+ $pb_meta = get_post_meta( $parent->ID, 'amp-page-builder', true );
7014
+ if ( false !== $pb_meta ){
7015
+ add_metadata( 'post', $post_id, 'amp-page-builder', $pb_meta );
7016
+ }
7017
+ }
7018
+ }
7019
+ // Post Meta Revisions #3548 -- end here --
templates/template-mode/template-mode.php CHANGED
@@ -7,7 +7,7 @@ Class AMPforWP_theme_mode{
7
  add_action( 'init', array("AMPforWP_theme_mode", 'removeUnusedAction'));
8
  add_action( 'init', array("AMPforWP_theme_mode", 'removeUnusedMenuWidgets'), 11);
9
 
10
- if(!is_admin() && $GLOBALS['pagenow'] !== 'wp-login.php' ){
11
  add_action( 'init', array($this, 'rm_wp_core'), 20 );
12
  add_filter("ampforwp_is_amp_endpoint", array($this, 'ampforwp_theme_mode_enable'));
13
  add_action( 'init', array($this, 'dynamic_sidebar_callback_bkp') );
@@ -570,16 +570,18 @@ Class AMPforWP_theme_mode{
570
  $node_name = strtolower( $element->nodeName );
571
  if( $element->getAttribute('method')=='post' ){
572
  if($node_name=='form'){
573
- if($element->hasAttribute('action') && !$element->hasAttribute('action-xhr')){
574
- $url = str_replace("http:", "https:", $element->getAttribute('action'));
575
- $element->setAttribute('action-xhr', $url);
576
- $element->removeAttribute('action');
577
- }else{
578
- $scheme = is_ssl() ? 'https://' : 'http://';
 
579
 
580
- $path = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
581
- $path = str_replace("http:", "https:", $path);
582
- $element->setAttribute('action-xhr', esc_url($path) );
 
583
  }
584
  }
585
  }elseif( $element->getAttribute('method')=='get' ){
7
  add_action( 'init', array("AMPforWP_theme_mode", 'removeUnusedAction'));
8
  add_action( 'init', array("AMPforWP_theme_mode", 'removeUnusedMenuWidgets'), 11);
9
 
10
+ if(!is_admin() && $GLOBALS['pagenow'] !== 'wp-login.php' && (!is_preview() && !isset($_GET['elementor-preview'])) ){
11
  add_action( 'init', array($this, 'rm_wp_core'), 20 );
12
  add_filter("ampforwp_is_amp_endpoint", array($this, 'ampforwp_theme_mode_enable'));
13
  add_action( 'init', array($this, 'dynamic_sidebar_callback_bkp') );
570
  $node_name = strtolower( $element->nodeName );
571
  if( $element->getAttribute('method')=='post' ){
572
  if($node_name=='form'){
573
+ if(!$element->hasAttribute('action-xhr')){
574
+ if($element->hasAttribute('action')){
575
+ $url = str_replace("http:", "https:", $element->getAttribute('action'));
576
+ $element->setAttribute('action-xhr', $url);
577
+ $element->removeAttribute('action');
578
+ }else{
579
+ $scheme = is_ssl() ? 'https://' : 'http://';
580
 
581
+ $path = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
582
+ $path = str_replace("http:", "https:", $path);
583
+ $element->setAttribute('action-xhr', esc_url($path) );
584
+ }
585
  }
586
  }
587
  }elseif( $element->getAttribute('method')=='get' ){