AMP for WP – Accelerated Mobile Pages - Version 1.0.31

Version Description

(28th February 2020) = * Improvement: Added option to hide vukkle comments emoji #4194 * Improvement: Added alt for images in Slider module of AMP page builder #4193 * Improvement: Updated sabberworm folder #4142 * Fixed: Fatal Error fixed with zombify plugin #4184 * Fixed: Validation error due to Mediavine Plugin #4206 * Fixed: Instant article bug #4150 * Fixed: AMP Search Not Working with Betheme #4195 * Fixed: StackPath CDN not working #4123 * Fixed: Extra 301 redirect after enabling ?amp #4167 * Fixed: Table CSS improved #4185 * Fixed: Debug Warnings #4226 * Fixed: AMP Option panel improvements #4202 #4219

Download this release

Release Info

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

Code changes from version 1.0.30 to 1.0.31

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.3.2
7
- Stable tag: 1.0.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,20 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  = 1.0.30 (24th February 2020) =
198
  * Improvement: Added Autoplay in Image Gallery #3705
199
  * Fixed: Jetpack lazy loading not working due to our AMPforWP plugin #4183
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.3.2
7
+ Stable tag: 1.0.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
194
 
195
  == Changelog ==
196
 
197
+ = 1.0.31 (28th February 2020) =
198
+ * Improvement: Added option to hide vukkle comments emoji #4194
199
+ * Improvement: Added alt for images in Slider module of AMP page builder #4193
200
+ * Improvement: Updated sabberworm folder #4142
201
+ * Fixed: Fatal Error fixed with zombify plugin #4184
202
+ * Fixed: Validation error due to Mediavine Plugin #4206
203
+ * Fixed: Instant article bug #4150
204
+ * Fixed: AMP Search Not Working with Betheme #4195
205
+ * Fixed: StackPath CDN not working #4123
206
+ * Fixed: Extra 301 redirect after enabling ?amp #4167
207
+ * Fixed: Table CSS improved #4185
208
+ * Fixed: Debug Warnings #4226
209
+ * Fixed: AMP Option panel improvements #4202 #4219
210
+
211
  = 1.0.30 (24th February 2020) =
212
  * Improvement: Added Autoplay in Image Gallery #3705
213
  * Fixed: Jetpack lazy loading not working due to our AMPforWP plugin #4183
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: 1.0.30
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','1.0.30');
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: 1.0.31
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','1.0.31');
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,19 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.30 (24th February 2020) =
4
  * Improvement: Added Autoplay in Image Gallery #3705
5
  * Fixed: Jetpack lazy loading not working due to our AMPforWP plugin #4183
1
  == Changelog ==
2
 
3
+ = 1.0.31 (28th February 2020) =
4
+ * Improvement: Added option to hide vukkle comments emoji #4194
5
+ * Improvement: Added alt for images in Slider module of AMP page builder #4193
6
+ * Improvement: Updated sabberworm folder #4142
7
+ * Fixed: Fatal Error fixed with zombify plugin #4184
8
+ * Fixed: Validation error due to Mediavine Plugin #4206
9
+ * Fixed: Instant article bug #4150
10
+ * Fixed: AMP Search Not Working with Betheme #4195
11
+ * Fixed: StackPath CDN not working #4123
12
+ * Fixed: Extra 301 redirect after enabling ?amp #4167
13
+ * Fixed: Table CSS improved #4185
14
+ * Fixed: Debug Warnings #4226
15
+ * Fixed: AMP Option panel improvements #4202 #4219
16
+
17
  = 1.0.30 (24th February 2020) =
18
  * Improvement: Added Autoplay in Image Gallery #3705
19
  * Fixed: Jetpack lazy loading not working due to our AMPforWP plugin #4183
components/comments/comments.php CHANGED
@@ -227,6 +227,9 @@ function ampforwp_framework_get_vuukle_comments(){
227
  $srcUrl = add_query_arg('title' , urlencode($post->post_title), $srcUrl);
228
  $srcUrl = add_query_arg('img' , esc_url($img), $srcUrl);
229
  $srcUrl = add_query_arg('tags' , urlencode($tag_name), $srcUrl);
 
 
 
230
  $consent = '';
231
  if(ampforwp_get_data_consent()){
232
  $consent = 'data-block-on-consent ';
227
  $srcUrl = add_query_arg('title' , urlencode($post->post_title), $srcUrl);
228
  $srcUrl = add_query_arg('img' , esc_url($img), $srcUrl);
229
  $srcUrl = add_query_arg('tags' , urlencode($tag_name), $srcUrl);
230
+ if(ampforwp_get_setting('ampforwp-vuukle-comments-emoji')==false){
231
+ $srcUrl = add_query_arg('emotes' , 'false', $srcUrl);
232
+ }
233
  $consent = '';
234
  if(ampforwp_get_data_consent()){
235
  $consent = 'data-block-on-consent ';
components/components-core.php CHANGED
@@ -739,12 +739,12 @@ function ampforwp_backtotop_global_css(){?>
739
  table.wp-block-table.alignright,table.wp-block-table.alignleft,table.wp-block-table.aligncenter{width: auto;}
740
  table.wp-block-table.aligncenter{width: 50%;}
741
  table.wp-block-table.alignfull,table.wp-block-table.alignwide{display: table;}
742
- table { display: -webkit-box; display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; overflow-x: auto; }
743
  table a:link { font-weight: bold; text-decoration: none; }
744
  table a:visited { color: #999999; font-weight: bold; text-decoration: none; }
745
  table a:active, table a:hover { color: #bd5a35; text-decoration: underline; }
746
- table { font-family: Arial, Helvetica, sans-serif; color: #666; font-size: 12px; text-shadow: 1px 1px 0px #fff; background: #eee; margin: 0px; width: 95%; }
747
- table th { padding: 21px 25px 22px 25px; border-top: 1px solid #fafafa; border-bottom: 1px solid #e0e0e0; background: #ededed; background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#ebebeb)); }
748
  table th:first-child { text-align: left; padding-left: 20px; }
749
  table tr:first-child th:first-child { -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; }
750
  table tr:first-child th:last-child { -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
739
  table.wp-block-table.alignright,table.wp-block-table.alignleft,table.wp-block-table.aligncenter{width: auto;}
740
  table.wp-block-table.aligncenter{width: 50%;}
741
  table.wp-block-table.alignfull,table.wp-block-table.alignwide{display: table;}
742
+ table { display: inline-table; overflow-x: auto; }
743
  table a:link { font-weight: bold; text-decoration: none; }
744
  table a:visited { color: #999999; font-weight: bold; text-decoration: none; }
745
  table a:active, table a:hover { color: #bd5a35; text-decoration: underline; }
746
+ table { font-family: Arial, Helvetica, sans-serif; color: #666; font-size: 15px; text-shadow: 1px 1px 0px #fff; background: #eee; margin: 0px; width: 95%; }
747
+ table th { padding: 21px 25px 22px 25px; border-top: 1px solid #fafafa; border-bottom: 1px solid #e0e0e0; background: #ededed; }
748
  table th:first-child { text-align: left; padding-left: 20px; }
749
  table tr:first-child th:first-child { -webkit-border-top-left-radius: 3px; border-top-left-radius: 3px; }
750
  table tr:first-child th:last-child { -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
feeds/instant-article-feed.php CHANGED
@@ -37,14 +37,15 @@ header('Content-Type: ' . esc_attr(feed_content_type('rss2')) . '; charset=' . e
37
  'posts_per_page' => esc_attr($number_of_articles),
38
  'meta_query' => array(
39
  'relation' => 'OR',
 
 
 
 
40
  array(
41
  'key' => 'ampforwp-ia-on-off',
42
  'value' => 'hide-ia',
43
  'compare' => "!="
44
- ), array(
45
- 'key' => 'ampforwp-ia-on-off',
46
- 'compare' => "NOT EXISTS"
47
- ),
48
  )
49
  );
50
  if ( is_category() ) {
37
  'posts_per_page' => esc_attr($number_of_articles),
38
  'meta_query' => array(
39
  'relation' => 'OR',
40
+ array(
41
+ 'key' => 'ampforwp-ia-on-off',
42
+ 'compare' => "NOT EXISTS"
43
+ ),
44
  array(
45
  'key' => 'ampforwp-ia-on-off',
46
  'value' => 'hide-ia',
47
  'compare' => "!="
48
+ ),
 
 
 
49
  )
50
  );
51
  if ( is_category() ) {
images/jwplayerforwp.png ADDED
Binary file
includes/admin-style.css CHANGED
@@ -2057,4 +2057,14 @@ div#section-ampforwp-ux-section::after,div#section-ampforwp-ux-section-right::af
2057
  }
2058
  i.dashicons.dashicons-before.dashicons-update {
2059
  margin: 7px 2px 0 0;
2060
- }
 
 
 
 
 
 
 
 
 
 
2057
  }
2058
  i.dashicons.dashicons-before.dashicons-update {
2059
  margin: 7px 2px 0 0;
2060
+ }
2061
+ .license-tenure.expire{
2062
+ color:red;
2063
+ }
2064
+ .license-renew-a,.license-renew-a:hover{
2065
+ background: #303e9f;
2066
+ color: #fff;
2067
+ text-decoration: none;
2068
+ padding: 1px 7px 3px;
2069
+ border-radius: 13px;
2070
+ }
includes/features/functions.php CHANGED
@@ -794,11 +794,10 @@ function ampforwp_url_controller( $url, $nonamp = '' ) {
794
  }
795
  $get_permalink_structure = get_option('permalink_structure');
796
  if ( $get_permalink_structure ) {
797
- if ( isset($redux_builder_amp['amp-core-end-point']) && 1 == $redux_builder_amp['amp-core-end-point'] ) {
798
- $new_url = trailingslashit($url);
799
- $new_url = $new_url.'?'.AMPFORWP_AMP_QUERY_VAR;
800
- //$new_url = add_query_arg(AMPFORWP_AMP_QUERY_VAR,'1', $new_url);
801
- }
802
  else {
803
  $new_url = user_trailingslashit( trailingslashit( $url ) . AMPFORWP_AMP_QUERY_VAR);
804
  // WPML COMPATIBILITY FOR LOOP
@@ -1242,4 +1241,57 @@ if(!function_exists('ampforwp_sassy_share_icons')){
1242
  }
1243
  return $ampforwp_the_content;
1244
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1245
  }
794
  }
795
  $get_permalink_structure = get_option('permalink_structure');
796
  if ( $get_permalink_structure ) {
797
+ if(true == ampforwp_get_setting('amp-core-end-point')){
798
+ $new_url = user_trailingslashit($url);
799
+ $new_url = add_query_arg( 'amp', '', $new_url );
800
+ }
 
801
  else {
802
  $new_url = user_trailingslashit( trailingslashit( $url ) . AMPFORWP_AMP_QUERY_VAR);
803
  // WPML COMPATIBILITY FOR LOOP
1241
  }
1242
  return $ampforwp_the_content;
1243
  }
1244
+ }
1245
+
1246
+ // Notice for Dev Mode
1247
+ function ampforwp_dev_mode_notice(){
1248
+ global $redux_builder_amp;
1249
+ $message = '';
1250
+ if(isset($redux_builder_amp['ampforwp-development-mode']) && $redux_builder_amp['ampforwp-development-mode']) {
1251
+ $message = ' Please turn off Development mode, when you are done.';?>
1252
+
1253
+ <div class="notice notice-success is-dismissible amp-dev-notice" style="position:relative;
1254
+ height: 40px; overflow: hidden; ">
1255
+ <div class="ampforwp-dev-mode-message" style="margin-top: 10px;">
1256
+ <?php echo '<strong>'. esc_html__('AMP Dev mode is Enabled!', 'accelerated-mobile-pages').'</strong>'. esc_html__($message, 'accelerated-mobile-pages'); ?>
1257
+ </div>
1258
+ </div>
1259
+ <?php }
1260
+ }
1261
+
1262
+ function ampforwp_seo_selection_notice() {
1263
+ if('' != ampforwp_get_setting('ampforwp-seo-selection')){
1264
+ return;
1265
+ }
1266
+ $seo = '';
1267
+ if(class_exists('WPSEO_Options')){
1268
+ $seo = 'Yoast SEO';
1269
+ }
1270
+ if(class_exists('All_in_One_SEO_Pack')){
1271
+ $seo = 'All in One SEO';
1272
+ }
1273
+ if(function_exists( 'the_seo_framework' )){
1274
+ $seo = 'The SEO Framework';
1275
+ }
1276
+ if(function_exists('genesis_theme_support')){
1277
+ $seo = 'Genesis';
1278
+ }
1279
+ if(function_exists('qode_header_meta')){
1280
+ $seo = 'Bridge Qode SEO';
1281
+ }
1282
+ if(defined( 'RANK_MATH_FILE' )){
1283
+ $seo = 'Rank Math SEO';
1284
+ }
1285
+ if(defined( 'SQ_ALL_PATTERNS' )){
1286
+ $seo = 'Squirrly SEO';
1287
+ }
1288
+ if(class_exists('Smartcrawl_Loader')){
1289
+ $seo = 'Smartcrawl SEO';
1290
+ }
1291
+ if(function_exists('seopress_activation')){
1292
+ $seo = 'SEO Press';
1293
+ }
1294
+ if(!empty($seo)){
1295
+ echo sprintf(('<div class="notice notice-error"><p>%s <a href="%s">%s</a></p></div>'), esc_html__('The configuration of AMPforWP and '.esc_html($seo).' plugin is seems incorrect. Please go to AMPforWP plugin settings and select '.esc_html($seo).' from SEO Plugin Integration or ','accelerated-mobile-pages'),esc_url(admin_url('admin.php?page=amp_options&tab=5')),esc_html__('Click Here','accelerated-mobile-pages'));
1296
+ }
1297
  }
includes/options/admin-config.php CHANGED
@@ -550,6 +550,18 @@ $extension_listing_array = array(
550
  'store_url'=>'https://accounts.ampforwp.com',
551
  'is_activated'=>(is_plugin_active('floating-button-for-amp/floating-button-for-amp.php')? 1 : 2),
552
  ),
 
 
 
 
 
 
 
 
 
 
 
 
553
  );
554
  $viewAllExtensions = array(
555
  'name'=>'View All Extensions',
@@ -627,8 +639,8 @@ foreach ($extension_listing_array as $key => $extension) {
627
  $allResponseData = $selectedOption['amp-license'][$pathExploded]['all_data'];
628
  $remainingExpiresDays = floor( ( strtotime($allResponseData['expires'] )- time() )/( 60*60*24 ) );
629
  if($remainingExpiresDays>0){
630
- $amp_license_response = "<span class='license-tenure'>".esc_html($remainingExpiresDays)." ".esc_html__('Days Remaining', 'accelerated-mobile-pages')."</span>. <a href='https://accounts.ampforwp.com/order/?edd_license_key=".esc_attr($amplicense)."&download_id=".esc_attr($allResponseData['item_name'])."'>".esc_html__('Renew License', 'accelerated-mobile-pages')."</a>";
631
- }else{ $amp_license_response = "<span class='license-tenure'>".esc_html__('Expired', 'accelerated-mobile-pages')."!</span> <a href='https://accounts.ampforwp.com/order/?edd_license_key=".esc_attr($amplicense)."&download_id=".esc_attr($allResponseData['item_name'])."'>".esc_html__('Renew your license', 'accelerated-mobile-pages')."</a>"; }
632
  }
633
  }
634
  if ( '' == $allResponseData['success'] && '' == $allResponseData['success'] ) {
@@ -2299,6 +2311,17 @@ function ampforwp_get_all_tags($id){
2299
  'required' => array(
2300
  array('ampforwp-vuukle-comments-support', '=' , 1),
2301
  ),
 
 
 
 
 
 
 
 
 
 
 
2302
  ),
2303
  //SpotIM Options
2304
  array(
550
  'store_url'=>'https://accounts.ampforwp.com',
551
  'is_activated'=>(is_plugin_active('floating-button-for-amp/floating-button-for-amp.php')? 1 : 2),
552
  ),
553
+ array(
554
+ 'name'=>'JW Player Compatibility for AMP',
555
+ 'class'=>'new-ext',
556
+ 'desc'=>'JW Player for WordPress (By ilGhera) Compatibility in AMP',
557
+ 'img_src'=>AMPFORWP_IMAGE_DIR . '/jwplayerforwp.png',
558
+ 'price'=>'$9',
559
+ 'url_link'=>'https://ampforwp.com/addons/jw-player-compatibility-for-amp/',
560
+ 'plugin_active_path'=> 'jw-player-compatibility-for-amp/jwplayercompatibilityforamp.php',
561
+ 'item_name'=>'JW Player Compatibility for AMP',
562
+ 'store_url'=>'https://accounts.ampforwp.com',
563
+ 'is_activated'=>(is_plugin_active('jw-player-compatibility-for-amp/jwplayercompatibilityforamp.php')? 1 : 2),
564
+ ),
565
  );
566
  $viewAllExtensions = array(
567
  'name'=>'View All Extensions',
639
  $allResponseData = $selectedOption['amp-license'][$pathExploded]['all_data'];
640
  $remainingExpiresDays = floor( ( strtotime($allResponseData['expires'] )- time() )/( 60*60*24 ) );
641
  if($remainingExpiresDays>0){
642
+ $amp_license_response = "<span class='license-tenure'>".esc_html($remainingExpiresDays)." ".esc_html__('Days Remaining', 'accelerated-mobile-pages')."</span>. <a href='https://accounts.ampforwp.com/order/?edd_license_key=".esc_attr($amplicense)."&download_id=".esc_attr($allResponseData['item_name'])."' class='license-renew-a'>".esc_html__('Renew License', 'accelerated-mobile-pages')."</a>";
643
+ }else{ $amp_license_response = "<span class='license-tenure expire'>".esc_html__('Expired', 'accelerated-mobile-pages')."!</span> <a href='https://accounts.ampforwp.com/order/?edd_license_key=".esc_attr($amplicense)."&download_id=".esc_attr($allResponseData['item_name'])."' class='license-renew-a'>".esc_html__('Renew your license', 'accelerated-mobile-pages')."</a>"; }
644
  }
645
  }
646
  if ( '' == $allResponseData['success'] && '' == $allResponseData['success'] ) {
2311
  'required' => array(
2312
  array('ampforwp-vuukle-comments-support', '=' , 1),
2313
  ),
2314
+ ),
2315
+ array(
2316
+ 'class' => 'child_opt child_opt_arrow',
2317
+ 'id' => 'ampforwp-vuukle-comments-emoji',
2318
+ 'type' => 'switch',
2319
+ 'title' => esc_html__('Vuukle Emoji', 'accelerated-mobile-pages'),
2320
+ 'tooltip-subtitle' => esc_html__('Enable/Disable Vuukle comments emoji using this switch.', 'accelerated-mobile-pages'),
2321
+ 'default' => 1,
2322
+ 'required' => array(
2323
+ array('ampforwp-vuukle-comments-support', '=' , 1),
2324
+ ),
2325
  ),
2326
  //SpotIM Options
2327
  array(
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSList.php CHANGED
@@ -1,12 +1,11 @@
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\Parsing\UnexpectedEOFException;
10
  use Sabberworm\CSS\Property\AtRule;
11
  use Sabberworm\CSS\Property\Charset;
12
  use Sabberworm\CSS\Property\CSSNamespace;
@@ -86,21 +85,19 @@ abstract class CSSList implements Renderable, Commentable {
86
  }
87
  return $oAtRule;
88
  } else if ($oParserState->comes('}')) {
89
- if (!$oParserState->getSettings()->bLenientParsing) {
90
- throw new UnexpectedTokenException('CSS selector', '}', 'identifier', $oParserState->currentLine());
91
- } else {
92
- if ($bIsRoot) {
93
- if ($oParserState->getSettings()->bLenientParsing) {
94
- return DeclarationBlock::parse($oParserState);
95
- } else {
96
- throw new SourceException("Unopened {", $oParserState->currentLine());
97
- }
98
  } else {
99
- return null;
100
  }
 
 
101
  }
102
  } else {
103
- return DeclarationBlock::parse($oParserState, $oList);
104
  }
105
  }
106
 
@@ -114,23 +111,20 @@ abstract class CSSList implements Renderable, Commentable {
114
  $oParserState->consumeWhiteSpace();
115
  $sMediaQuery = null;
116
  if (!$oParserState->comes(';')) {
117
- $sMediaQuery = trim($oParserState->consumeUntil(array(';', ParserState::EOF)));
118
  }
119
- $oParserState->consumeUntil(array(';', ParserState::EOF), true, true);
120
- return new Import($oLocation, $sMediaQuery ? $sMediaQuery : null, $iIdentifierLineNum);
121
  } else if ($sIdentifier === 'charset') {
122
  $sCharset = CSSString::parse($oParserState);
123
  $oParserState->consumeWhiteSpace();
124
- $oParserState->consumeUntil(array(';', ParserState::EOF), true, true);
125
  return new Charset($sCharset, $iIdentifierLineNum);
126
  } else if (self::identifierIs($sIdentifier, 'keyframes')) {
127
  $oResult = new KeyFrame($iIdentifierLineNum);
128
  $oResult->setVendorKeyFrame($sIdentifier);
129
  $oResult->setAnimationName(trim($oParserState->consumeUntil('{', false, true)));
130
  CSSList::parseList($oParserState, $oResult);
131
- if ($oParserState->comes('}')) {
132
- $oParserState->consume('}');
133
- }
134
  return $oResult;
135
  } else if ($sIdentifier === 'namespace') {
136
  $sPrefix = null;
@@ -139,7 +133,7 @@ abstract class CSSList implements Renderable, Commentable {
139
  $sPrefix = $mUrl;
140
  $mUrl = Value::parsePrimitiveValue($oParserState);
141
  }
142
- $oParserState->consumeUntil(array(';', ParserState::EOF), true, true);
143
  if ($sPrefix !== null && !is_string($sPrefix)) {
144
  throw new UnexpectedTokenException('Wrong namespace prefix', $sPrefix, 'custom', $iIdentifierLineNum);
145
  }
@@ -170,9 +164,6 @@ abstract class CSSList implements Renderable, Commentable {
170
  } else {
171
  $oAtRule = new AtRuleBlockList($sIdentifier, $sArgs, $iIdentifierLineNum);
172
  CSSList::parseList($oParserState, $oAtRule);
173
- if ($oParserState->comes('}')) {
174
- $oParserState->consume('}');
175
- }
176
  }
177
  return $oAtRule;
178
  }
@@ -241,14 +232,10 @@ abstract class CSSList implements Renderable, Commentable {
241
  * Replaces an item from the CSS list.
242
  * @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)
243
  */
244
- public function replace($oOldItem, $mNewItem) {
245
  $iKey = array_search($oOldItem, $this->aContents, true);
246
  if ($iKey !== false) {
247
- if (is_array($mNewItem)) {
248
- array_splice($this->aContents, $iKey, 1, $mNewItem);
249
- } else {
250
- array_splice($this->aContents, $iKey, 1, array($mNewItem));
251
- }
252
  return true;
253
  }
254
  return false;
@@ -279,9 +266,6 @@ abstract class CSSList implements Renderable, Commentable {
279
  }
280
  foreach ($mSelector as $iKey => &$mSel) {
281
  if (!($mSel instanceof Selector)) {
282
- if (!Selector::isValid($mSel)) {
283
- throw new UnexpectedTokenException("Selector did not match '" . Selector::SELECTOR_VALIDATION_RX . "'.", $mSel, "custom");
284
- }
285
  $mSel = new Selector($mSel);
286
  }
287
  }
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;
85
  }
86
  return $oAtRule;
87
  } else if ($oParserState->comes('}')) {
88
+ $oParserState->consume('}');
89
+ if ($bIsRoot) {
90
+ if ($oParserState->getSettings()->bLenientParsing) {
91
+ while ($oParserState->comes('}')) $oParserState->consume('}');
92
+ return DeclarationBlock::parse($oParserState);
 
 
 
 
93
  } else {
94
+ throw new SourceException("Unopened {", $oParserState->currentLine());
95
  }
96
+ } else {
97
+ return null;
98
  }
99
  } else {
100
+ return DeclarationBlock::parse($oParserState);
101
  }
102
  }
103
 
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
  return $oResult;
129
  } else if ($sIdentifier === 'namespace') {
130
  $sPrefix = null;
133
  $sPrefix = $mUrl;
134
  $mUrl = Value::parsePrimitiveValue($oParserState);
135
  }
136
+ $oParserState->consume(';');
137
  if ($sPrefix !== null && !is_string($sPrefix)) {
138
  throw new UnexpectedTokenException('Wrong namespace prefix', $sPrefix, 'custom', $iIdentifierLineNum);
139
  }
164
  } else {
165
  $oAtRule = new AtRuleBlockList($sIdentifier, $sArgs, $iIdentifierLineNum);
166
  CSSList::parseList($oParserState, $oAtRule);
 
 
 
167
  }
168
  return $oAtRule;
169
  }
232
  * Replaces an item from the CSS list.
233
  * @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)
234
  */
235
+ public function replace($oOldItem, $oNewItem) {
236
  $iKey = array_search($oOldItem, $this->aContents, true);
237
  if ($iKey !== false) {
238
+ array_splice($this->aContents, $iKey, 1, $oNewItem);
 
 
 
 
239
  return true;
240
  }
241
  return false;
266
  }
267
  foreach ($mSelector as $iKey => &$mSel) {
268
  if (!($mSel instanceof Selector)) {
 
 
 
269
  $mSel = new Selector($mSel);
270
  }
271
  }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Parsing/ParserState.php CHANGED
@@ -3,14 +3,11 @@ namespace Sabberworm\CSS\Parsing;
3
 
4
  use Sabberworm\CSS\Comment\Comment;
5
  use Sabberworm\CSS\Parsing\UnexpectedTokenException;
6
- use Sabberworm\CSS\Parsing\UnexpectedEOFException;
7
  use Sabberworm\CSS\Settings;
8
  if ( ! defined( 'ABSPATH' ) ) {
9
  exit;
10
  }
11
- class ParserState {
12
- const EOF = null;
13
-
14
  private $oParserSettings;
15
 
16
  private $sText;
@@ -32,9 +29,7 @@ class ParserState {
32
  public function setCharset($sCharset) {
33
  $this->sCharset = $sCharset;
34
  $this->aText = $this->strsplit($this->sText);
35
- if( is_array($this->aText) ) {
36
- $this->iLength = count($this->aText);
37
- }
38
  }
39
 
40
  public function getCharset() {
@@ -127,7 +122,8 @@ class ParserState {
127
  if($this->oParserSettings->bLenientParsing) {
128
  try {
129
  $oComment = $this->consumeComment();
130
- } catch(UnexpectedEOFException $e) {
 
131
  $this->iCurrentPosition = $this->iLength;
132
  return;
133
  }
@@ -168,7 +164,7 @@ class ParserState {
168
  return $mValue;
169
  } else {
170
  if ($this->iCurrentPosition + $mValue > $this->iLength) {
171
- throw new UnexpectedEOFException($mValue, $this->peek(5), 'count', $this->iLineNo);
172
  }
173
  $sResult = $this->substr($this->iCurrentPosition, $mValue);
174
  $iLineCount = substr_count($sResult, "\n");
@@ -222,8 +218,7 @@ class ParserState {
222
  $out = '';
223
  $start = $this->iCurrentPosition;
224
 
225
- while (!$this->isEnd()) {
226
- $char = $this->consume(1);
227
  if (in_array($char, $aEnd)) {
228
  if ($bIncludeEnd) {
229
  $out .= $char;
@@ -238,12 +233,8 @@ class ParserState {
238
  }
239
  }
240
 
241
- if (in_array(self::EOF, $aEnd)) {
242
- return $out;
243
- }
244
-
245
  $this->iCurrentPosition = $start;
246
- throw new UnexpectedEOFException('One of ("'.implode('","', $aEnd).'")', $this->peek(5), 'search', $this->iLineNo);
247
  }
248
 
249
  private function inputLeft() {
@@ -322,4 +313,4 @@ class ParserState {
322
  return strpos($sString, $sNeedle, $iOffset);
323
  }
324
  }
325
- }
3
 
4
  use Sabberworm\CSS\Comment\Comment;
5
  use Sabberworm\CSS\Parsing\UnexpectedTokenException;
 
6
  use Sabberworm\CSS\Settings;
7
  if ( ! defined( 'ABSPATH' ) ) {
8
  exit;
9
  }
10
+ class ParserState {
 
 
11
  private $oParserSettings;
12
 
13
  private $sText;
29
  public function setCharset($sCharset) {
30
  $this->sCharset = $sCharset;
31
  $this->aText = $this->strsplit($this->sText);
32
+ $this->iLength = count($this->aText);
 
 
33
  }
34
 
35
  public function getCharset() {
122
  if($this->oParserSettings->bLenientParsing) {
123
  try {
124
  $oComment = $this->consumeComment();
125
+ } catch(UnexpectedTokenException $e) {
126
+ // When we can’t find the end of a comment, we assume the document is finished.
127
  $this->iCurrentPosition = $this->iLength;
128
  return;
129
  }
164
  return $mValue;
165
  } else {
166
  if ($this->iCurrentPosition + $mValue > $this->iLength) {
167
+ throw new UnexpectedTokenException($mValue, $this->peek(5), 'count', $this->iLineNo);
168
  }
169
  $sResult = $this->substr($this->iCurrentPosition, $mValue);
170
  $iLineCount = substr_count($sResult, "\n");
218
  $out = '';
219
  $start = $this->iCurrentPosition;
220
 
221
+ while (($char = $this->consume(1)) !== '') {
 
222
  if (in_array($char, $aEnd)) {
223
  if ($bIncludeEnd) {
224
  $out .= $char;
233
  }
234
  }
235
 
 
 
 
 
236
  $this->iCurrentPosition = $start;
237
+ throw new UnexpectedTokenException('One of ("'.implode('","', $aEnd).'")', $this->peek(5), 'search', $this->iLineNo);
238
  }
239
 
240
  private function inputLeft() {
313
  return strpos($sString, $sNeedle, $iOffset);
314
  }
315
  }
316
+ }
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Property/Selector.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
 
3
- namespace Sabberworm\CSS\Property;
4
-
5
- use Sabberworm\CSS\Parsing\UnexpectedTokenException;
6
  if ( ! defined( 'ABSPATH' ) ) {
7
  exit;
8
  }
@@ -39,23 +37,9 @@ class Selector {
39
  ))
40
  /ix';
41
 
42
- const SELECTOR_VALIDATION_RX = '/
43
- ^(
44
- (?:
45
- [a-zA-Z0-9\x{00A0}-\x{FFFF}_^$|*="\'~\[\]()\-\s\.:#+>]* # any sequence of valid unescaped characters
46
- (?:\\\\.)? # a single escaped character
47
- (?:([\'"]).*?(?<!\\\\)\2)? # a quoted text like [id="example"]
48
- )*
49
- )$
50
- /ux';
51
-
52
  private $sSelector;
53
  private $iSpecificity;
54
 
55
- public static function isValid($sSelector) {
56
- return preg_match(static::SELECTOR_VALIDATION_RX, $sSelector);
57
- }
58
-
59
  public function __construct($sSelector, $bCalculateSpecificity = false) {
60
  $this->setSelector($sSelector);
61
  if ($bCalculateSpecificity) {
1
  <?php
2
 
3
+ namespace Sabberworm\CSS\Property;
 
 
4
  if ( ! defined( 'ABSPATH' ) ) {
5
  exit;
6
  }
37
  ))
38
  /ix';
39
 
 
 
 
 
 
 
 
 
 
 
40
  private $sSelector;
41
  private $iSpecificity;
42
 
 
 
 
 
43
  public function __construct($sSelector, $bCalculateSpecificity = false) {
44
  $this->setSelector($sSelector);
45
  if ($bCalculateSpecificity) {
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/RuleSet/DeclarationBlock.php CHANGED
@@ -1,19 +1,16 @@
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\Property\KeyframeSelector;
10
  use Sabberworm\CSS\Rule\Rule;
11
  use Sabberworm\CSS\Value\RuleValueList;
12
  use Sabberworm\CSS\Value\Value;
13
  use Sabberworm\CSS\Value\Size;
14
  use Sabberworm\CSS\Value\Color;
15
  use Sabberworm\CSS\Value\URL;
16
- use Sabberworm\CSS\CSSList\KeyFrame;
17
  if ( ! defined( 'ABSPATH' ) ) {
18
  exit;
19
  }
@@ -30,63 +27,85 @@ class DeclarationBlock extends RuleSet {
30
  $this->aSelectors = array();
31
  }
32
 
33
- public static function parse(ParserState $oParserState, $oList = NULL) {
34
  $aComments = array();
35
  $oResult = new DeclarationBlock($oParserState->currentLine());
36
- try {
37
- $aSelectorParts = array();
38
- $sStringWrapperChar = false;
39
- do {
40
- $aSelectorParts[] = $oParserState->consume(1) . $oParserState->consumeUntil(array('{', '}', '\'', '"'), false, false, $aComments);
41
- if ( in_array($oParserState->peek(), array('\'', '"')) && substr(end($aSelectorParts), -1) != "\\" ) {
42
- if ( $sStringWrapperChar === false ) {
43
- $sStringWrapperChar = $oParserState->peek();
44
- } else if ($sStringWrapperChar == $oParserState->peek()) {
45
- $sStringWrapperChar = false;
46
- }
47
- }
48
- } while (!in_array($oParserState->peek(), array('{', '}')) || $sStringWrapperChar !== false);
49
- $oResult->setSelector(implode('', $aSelectorParts), $oList);
50
- if ($oParserState->comes('{')) {
51
- $oParserState->consume(1);
52
- }
53
- } catch (UnexpectedTokenException $e) {
54
- if($oParserState->getSettings()->bLenientParsing) {
55
- if(!$oParserState->comes('}')) {
56
- $oParserState->consumeUntil('}', false, true);
57
- }
58
- return false;
59
- } else {
60
- throw $e;
61
- }
62
- }
63
  $oResult->setComments($aComments);
64
  RuleSet::parseRuleSet($oParserState, $oResult);
65
  return $oResult;
66
  }
67
 
68
 
69
- public function setSelectors($mSelector, $oList = NULL) {
70
  if (is_array($mSelector)) {
71
  $this->aSelectors = $mSelector;
72
  } else {
73
- $this->aSelectors = explode(',', $mSelector);
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
  foreach ($this->aSelectors as $iKey => $mSelector) {
76
  if (!($mSelector instanceof Selector)) {
77
- if ($oList === NULL || !($oList instanceof KeyFrame)) {
78
- if (!Selector::isValid($mSelector)) {
79
- throw new UnexpectedTokenException("Selector did not match '" . Selector::SELECTOR_VALIDATION_RX . "'.", $mSelector, "custom");
80
- }
81
- $this->aSelectors[$iKey] = new Selector($mSelector);
82
- } else {
83
- if (!KeyframeSelector::isValid($mSelector)) {
84
- throw new UnexpectedTokenException("Selector did not match '" . KeyframeSelector::SELECTOR_VALIDATION_RX . "'.", $mSelector, "custom");
85
- }
86
- $this->aSelectors[$iKey] = new KeyframeSelector($mSelector);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  }
 
 
89
  }
 
90
  }
91
 
92
  // remove one of the selector of the block
@@ -113,8 +132,8 @@ class DeclarationBlock extends RuleSet {
113
  /**
114
  * @deprecated use setSelectors()
115
  */
116
- public function setSelector($mSelector, $oList = NULL) {
117
- $this->setSelectors($mSelector, $oList);
118
  }
119
 
120
  /**
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\Property\Selector;
 
8
  use Sabberworm\CSS\Rule\Rule;
9
  use Sabberworm\CSS\Value\RuleValueList;
10
  use Sabberworm\CSS\Value\Value;
11
  use Sabberworm\CSS\Value\Size;
12
  use Sabberworm\CSS\Value\Color;
13
  use Sabberworm\CSS\Value\URL;
 
14
  if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
16
  }
27
  $this->aSelectors = array();
28
  }
29
 
30
+ public static function parse(ParserState $oParserState) {
31
  $aComments = array();
32
  $oResult = new DeclarationBlock($oParserState->currentLine());
33
+ $oResult->setSelector($oParserState->consumeUntil('{', false, true, $aComments));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  $oResult->setComments($aComments);
35
  RuleSet::parseRuleSet($oParserState, $oResult);
36
  return $oResult;
37
  }
38
 
39
 
40
+ public function setSelectors($mSelector) {
41
  if (is_array($mSelector)) {
42
  $this->aSelectors = $mSelector;
43
  } else {
44
+ list( $sSelectors, $aPlaceholders ) = $this->addSelectorExpressionPlaceholders( $mSelector );
45
+ if ( empty( $aPlaceholders ) ) {
46
+ $this->aSelectors = explode(',', $sSelectors);
47
+ } else {
48
+ $aSearches = array_keys( $aPlaceholders );
49
+ $aReplaces = array_values( $aPlaceholders );
50
+ $this->aSelectors = array_map(
51
+ function( $sSelector ) use ( $aSearches, $aReplaces ) {
52
+ return str_replace( $aSearches, $aReplaces, $sSelector );
53
+ },
54
+ explode(',', $sSelectors)
55
+ );
56
+ }
57
  }
58
  foreach ($this->aSelectors as $iKey => $mSelector) {
59
  if (!($mSelector instanceof Selector)) {
60
+ $this->aSelectors[$iKey] = new Selector($mSelector);
61
+ }
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Add placeholders for parenthetical/bracketed expressions in selectors which may contain commas that break exploding.
67
+ *
68
+ * This prevents a single selector like `.widget:not(.foo, .bar)` from erroneously getting parsed in setSelectors as
69
+ * two selectors `.widget:not(.foo` and `.bar)`.
70
+ *
71
+ * @param string $sSelectors Selectors.
72
+ * @return array First array value is the selectors with placeholders, and second value is the array of placeholders mapped to the original expressions.
73
+ */
74
+ private function addSelectorExpressionPlaceholders( $sSelectors ) {
75
+ $iOffset = 0;
76
+ $aPlaceholders = array();
77
+
78
+ while ( preg_match( '/\(|\[/', $sSelectors, $aMatches, PREG_OFFSET_CAPTURE, $iOffset ) ) {
79
+ $sMatchString = $aMatches[0][0];
80
+ $iMatchOffset = $aMatches[0][1];
81
+ $iStyleLength = strlen( $sSelectors );
82
+ $iOpenParens = 1;
83
+ $iStartOffset = $iMatchOffset + strlen( $sMatchString );
84
+ $iFinalOffset = $iStartOffset;
85
+ for ( ; $iFinalOffset < $iStyleLength; $iFinalOffset++ ) {
86
+ if ( '(' === $sSelectors[ $iFinalOffset ] || '[' === $sSelectors[ $iFinalOffset ] ) {
87
+ $iOpenParens++;
88
+ } elseif ( ')' === $sSelectors[ $iFinalOffset ] || ']' === $sSelectors[ $iFinalOffset ] ) {
89
+ $iOpenParens--;
90
+ }
91
+
92
+ // Found the end of the expression, so replace it with a placeholder.
93
+ if ( 0 === $iOpenParens ) {
94
+ $sMatchedExpr = substr( $sSelectors, $iMatchOffset, $iFinalOffset - $iMatchOffset + 1 );
95
+ $sPlaceholder = sprintf( '{placeholder:%d}', count( $aPlaceholders ) + 1 );
96
+ $aPlaceholders[ $sPlaceholder ] = $sMatchedExpr;
97
+
98
+ // Update the CSS to replace the matched calc() with the placeholder function.
99
+ $sSelectors = substr( $sSelectors, 0, $iMatchOffset ) . $sPlaceholder . substr( $sSelectors, $iFinalOffset + 1 );
100
+ // Update offset based on difference of length of placeholder vs original matched calc().
101
+ $iFinalOffset += strlen( $sPlaceholder ) - strlen( $sMatchedExpr );
102
+ break;
103
  }
104
  }
105
+ // Start matching at the next byte after the match.
106
+ $iOffset = $iFinalOffset + 1;
107
  }
108
+ return array( $sSelectors, $aPlaceholders );
109
  }
110
 
111
  // remove one of the selector of the block
132
  /**
133
  * @deprecated use setSelectors()
134
  */
135
+ public function setSelector($mSelector) {
136
+ $this->setSelectors($mSelector);
137
  }
138
 
139
  /**
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/CalcFunction.php CHANGED
@@ -23,12 +23,10 @@ class CalcFunction extends CSSFunction {
23
  if ($oParserState->comes('(')) {
24
  $iNestingLevel++;
25
  $oCalcList->addListComponent($oParserState->consume(1));
26
- $oParserState->consumeWhiteSpace();
27
  continue;
28
  } else if ($oParserState->comes(')')) {
29
  $iNestingLevel--;
30
  $oCalcList->addListComponent($oParserState->consume(1));
31
- $oParserState->consumeWhiteSpace();
32
  continue;
33
  }
34
  if ($iLastComponentType != CalcFunction::T_OPERAND) {
@@ -57,7 +55,6 @@ class CalcFunction extends CSSFunction {
57
  );
58
  }
59
  }
60
- $oParserState->consumeWhiteSpace();
61
  }
62
  $oList->addListComponent($oCalcList);
63
  $oParserState->consume(')');
23
  if ($oParserState->comes('(')) {
24
  $iNestingLevel++;
25
  $oCalcList->addListComponent($oParserState->consume(1));
 
26
  continue;
27
  } else if ($oParserState->comes(')')) {
28
  $iNestingLevel--;
29
  $oCalcList->addListComponent($oParserState->consume(1));
 
30
  continue;
31
  }
32
  if ($iLastComponentType != CalcFunction::T_OPERAND) {
55
  );
56
  }
57
  }
 
58
  }
59
  $oList->addListComponent($oCalcList);
60
  $oParserState->consume(')');
includes/vendor/css-parser/sabberworm/php-css-parser/lib/Sabberworm/CSS/Value/Size.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- namespace Sabberworm\CSS\Value;
4
 
5
  use Sabberworm\CSS\Parsing\ParserState;
6
  if ( ! defined( 'ABSPATH' ) ) {
@@ -63,7 +63,8 @@ class Size extends PrimitiveValue {
63
  self::$SIZE_UNITS[$iSize][strtolower($val)] = $val;
64
  }
65
 
66
- krsort(self::$SIZE_UNITS, SORT_NUMERIC);
 
67
  }
68
 
69
  return self::$SIZE_UNITS;
@@ -117,8 +118,7 @@ class Size extends PrimitiveValue {
117
  public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
118
  $l = localeconv();
119
  $sPoint = preg_quote($l['decimal_point'], '/');
120
- $sSize = preg_match("/[\d\.]+e[+-]?\d+/i", (string)$this->fSize) ? preg_replace("/$sPoint?0+$/", "", sprintf("%f", $this->fSize)) : $this->fSize;
121
- return preg_replace(array("/$sPoint/", "/^(-?)0\./"), array('.', '$1.'), $sSize) . ($this->sUnit === null ? '' : $this->sUnit);
122
  }
123
 
124
  }
1
  <?php
2
 
3
+ namespace Sabberworm\CSS\Value;
4
 
5
  use Sabberworm\CSS\Parsing\ParserState;
6
  if ( ! defined( 'ABSPATH' ) ) {
63
  self::$SIZE_UNITS[$iSize][strtolower($val)] = $val;
64
  }
65
 
66
+ // FIXME: Should we not order the longest units first?
67
+ ksort(self::$SIZE_UNITS, SORT_NUMERIC);
68
  }
69
 
70
  return self::$SIZE_UNITS;
118
  public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) {
119
  $l = localeconv();
120
  $sPoint = preg_quote($l['decimal_point'], '/');
121
+ return preg_replace(array("/$sPoint/", "/^(-?)0\./"), array('.', '$1.'), $this->fSize) . ($this->sUnit === null ? '' : $this->sUnit);
 
122
  }
123
 
124
  }
pagebuilder/modules/slider-mod-module.php CHANGED
@@ -216,6 +216,14 @@ return array(
216
  'default' =>'',
217
  'content_type'=>'html',
218
  ),
 
 
 
 
 
 
 
 
219
  array(
220
  'type' =>'text',
221
  'name' =>"hyperlink_link_img",
@@ -245,7 +253,9 @@ return array(
245
  array(
246
  "image"=>'
247
  {{if_condition_img_hyperlink==1}}<a href="{{hyperlink_link_img}}" {{if_condition_img_link_open==new_page}}target="_blank"{{ifend_condition_img_link_open_new_page}}>{{ifend_condition_img_hyperlink_1}}
248
- {{if_img_upload}}<figure><amp-img src="{{img_upload}}" {{if_image_width}}width="{{image_width}}"{{ifend_image_width}} {{if_image_height}}height="{{image_height}}"{{ifend_image_height}} {{if_image_layout}}layout="{{image_layout}}"{{ifend_image_layout}} {{if_image_alt}}alt="{{image_alt}}"{{ifend_image_alt}}></amp-img>{{if_image_caption}}<figcaption>{{image_caption}}</figcaption>{{ifend_image_caption}}</figure>{{ifend_img_upload}}{{if_condition_img_hyperlink==1}}</a>{{ifend_condition_img_hyperlink_1}}
 
 
249
  ',
250
  "button"=>'<button on="tap:carousel-with-preview-{{unique_cell_id}}.goToSlide(index={{repeater_unique}})">
251
  {{if_img_upload}}<amp-img src="{{img_upload-thumbnail}}" width="150" height="150" {{if_image_layout}}layout="{{image_layout}}"{{ifend_image_layout}} alt="{{image_alt}}"></amp-img>{{ifend_img_upload}}
216
  'default' =>'',
217
  'content_type'=>'html',
218
  ),
219
+ array(
220
+ 'type' =>'text',
221
+ 'name' =>"image_ind_alt",
222
+ 'label' =>'Image Alt',
223
+ 'tab' =>'customizer',
224
+ 'default' =>'',
225
+ 'content_type'=>'html',
226
+ ),
227
  array(
228
  'type' =>'text',
229
  'name' =>"hyperlink_link_img",
253
  array(
254
  "image"=>'
255
  {{if_condition_img_hyperlink==1}}<a href="{{hyperlink_link_img}}" {{if_condition_img_link_open==new_page}}target="_blank"{{ifend_condition_img_link_open_new_page}}>{{ifend_condition_img_hyperlink_1}}
256
+ {{if_img_upload}}<figure><amp-img src="{{img_upload}}" {{if_image_width}}width="{{image_width}}"{{ifend_image_width}} {{if_image_height}}height="{{image_height}}"{{ifend_image_height}} {{if_image_layout}}layout="{{image_layout}}"{{ifend_image_layout}}
257
+ {{if_condition_image_ind_alt==}}{{if_image_alt}}alt="{{image_alt}}"{{ifend_image_alt}} {{ifend_condition_image_ind_alt_}}
258
+ {{if_image_ind_alt}}alt="{{image_ind_alt}}"{{ifend_image_ind_alt}}></amp-img>{{if_image_caption}}<figcaption>{{image_caption}}</figcaption>{{ifend_image_caption}}</figure>{{ifend_img_upload}}{{if_condition_img_hyperlink==1}}</a>{{ifend_condition_img_hyperlink_1}}
259
  ',
260
  "button"=>'<button on="tap:carousel-with-preview-{{unique_cell_id}}.goToSlide(index={{repeater_unique}})">
261
  {{if_img_upload}}<amp-img src="{{img_upload-thumbnail}}" width="150" height="150" {{if_image_layout}}layout="{{image_layout}}"{{ifend_image_layout}} alt="{{image_alt}}"></amp-img>{{ifend_img_upload}}
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.3.2
7
- Stable tag: 1.0.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,20 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  = 1.0.30 (24th February 2020) =
195
  * Improvement: Added Autoplay in Image Gallery #3705
196
  * Fixed: Jetpack lazy loading not working due to our AMPforWP plugin #4183
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.3.2
7
+ Stable tag: 1.0.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
191
 
192
  == Changelog ==
193
 
194
+ = 1.0.31 (28th February 2020) =
195
+ * Improvement: Added option to hide vukkle comments emoji #4194
196
+ * Improvement: Added alt for images in Slider module of AMP page builder #4193
197
+ * Improvement: Updated sabberworm folder #4142
198
+ * Fixed: Fatal Error fixed with zombify plugin #4184
199
+ * Fixed: Validation error due to Mediavine Plugin #4206
200
+ * Fixed: Instant article bug #4150
201
+ * Fixed: AMP Search Not Working with Betheme #4195
202
+ * Fixed: StackPath CDN not working #4123
203
+ * Fixed: Extra 301 redirect after enabling ?amp #4167
204
+ * Fixed: Table CSS improved #4185
205
+ * Fixed: Debug Warnings #4226
206
+ * Fixed: AMP Option panel improvements #4202 #4219
207
+
208
  = 1.0.30 (24th February 2020) =
209
  * Improvement: Added Autoplay in Image Gallery #3705
210
  * Fixed: Jetpack lazy loading not working due to our AMPforWP plugin #4183
templates/design-manager/swift/style.php CHANGED
@@ -672,7 +672,7 @@ if ( ampforwp_get_setting('swift-featued-image-type') == 2) { ?>
672
  .amp-tags .amp-tag:after{content: "/";display: inline-block;padding: 0px 10px;position: relative;top: -1px;color: #ccc;font-size: 12px;}
673
  .amp-tags .amp-tag:last-child:after{display:none;}
674
  .ss-ic li:before{border-radius: 2px;text-align:center;padding: 4px 6px;}
675
- .sgl table {width: 100%;margin-bottom:25px;border: 1px solid #ddd;}
676
  .sgl th , .sgl td {padding: 0.5em 1em;border: 1px solid #ddd;}
677
  .sgl tr:nth-child(odd) td {background: #f7f7f7;}
678
  <?php // Social Sharing Conditional CSS
672
  .amp-tags .amp-tag:after{content: "/";display: inline-block;padding: 0px 10px;position: relative;top: -1px;color: #ccc;font-size: 12px;}
673
  .amp-tags .amp-tag:last-child:after{display:none;}
674
  .ss-ic li:before{border-radius: 2px;text-align:center;padding: 4px 6px;}
675
+ .sgl table {width: 100%;margin-bottom:25px;border: 1px solid #ddd;display: inline-table;}
676
  .sgl th , .sgl td {padding: 0.5em 1em;border: 1px solid #ddd;}
677
  .sgl tr:nth-child(odd) td {background: #f7f7f7;}
678
  <?php // Social Sharing Conditional CSS
templates/features.php CHANGED
@@ -355,7 +355,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
355
  }
356
  // URL Purifier
357
  $amp_url = ampforwp_url_purifier($amp_url);
358
- if(true == ampforwp_get_setting('amp-core-end-point')){
359
  $amp_url = add_query_arg( 'amp', '', get_the_permalink() );
360
  }
361
  $amp_url = apply_filters('ampforwp_modify_rel_canonical',$amp_url);
@@ -370,6 +370,9 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
370
  // AMPHTML when using custom page and then creating a blog page
371
  add_action('amp_init','ampforwp_allow_homepage_as_blog');
372
  function ampforwp_allow_homepage_as_blog() {
 
 
 
373
  add_action( 'wp', 'ampforwp_static_blog' , 11 );
374
  }
375
  function ampforwp_static_blog(){
@@ -3055,6 +3058,7 @@ if( !function_exists('ampforwp_checking_any_social_profiles') ) {
3055
 
3056
  //52. Adding a generalized sanitizer function for purifiying normal html to amp-html
3057
  function ampforwp_content_sanitizer( $content ) {
 
3058
  $amp_custom_post_content_input = $content;
3059
  if ( !empty( $amp_custom_post_content_input ) ) {
3060
  $amp_custom_content = new AMPFORWP_Content( $amp_custom_post_content_input,
@@ -3075,7 +3079,7 @@ function ampforwp_content_sanitizer( $content ) {
3075
  'AMP_Iframe_Sanitizer' => array(
3076
  'add_placeholder' => true,
3077
  ),
3078
- ) )
3079
  );
3080
 
3081
  if ( $amp_custom_content ) {
@@ -4304,21 +4308,6 @@ if ( ! function_exists('ampforwp_dev_mode_add_noindex') ) {
4304
  }
4305
  }
4306
  }
4307
- // Notice for Dev Mode
4308
- function ampforwp_dev_mode_notice(){
4309
- global $redux_builder_amp;
4310
- $message = '';
4311
- if(isset($redux_builder_amp['ampforwp-development-mode']) && $redux_builder_amp['ampforwp-development-mode']) {
4312
- $message = ' Please turn off Development mode, when you are done.';?>
4313
-
4314
- <div class="notice notice-success is-dismissible amp-dev-notice" style="position:relative;
4315
- height: 40px; overflow: hidden; ">
4316
- <div class="ampforwp-dev-mode-message" style="margin-top: 10px;">
4317
- <?php echo '<strong>'. esc_html__('AMP Dev mode is Enabled!', 'accelerated-mobile-pages').'</strong>'. esc_html__($message, 'accelerated-mobile-pages'); ?>
4318
- </div>
4319
- </div>
4320
- <?php }
4321
- }
4322
 
4323
  // 76. Body Class for AMP pages
4324
  if (! function_exists( 'ampforwp_body_class' ) ) {
@@ -6222,6 +6211,9 @@ function ampforwp_vuukle_comments_markup() {
6222
  $srcUrl = add_query_arg('title' , urlencode($post->post_title), $srcUrl);
6223
  $srcUrl = add_query_arg('img' , esc_url($img), $srcUrl);
6224
  $srcUrl = add_query_arg('tags' , urlencode($tag_name), $srcUrl);
 
 
 
6225
  $consent = '';
6226
  if(ampforwp_get_data_consent()){
6227
  $consent = 'data-block-on-consent ';
@@ -6434,19 +6426,9 @@ function ampforwp_thrive_architect_content(){
6434
  if ( function_exists( 'ampforwp_is_amp_inURL' ) && ampforwp_is_amp_inURL($url_path) ) {
6435
  //#3254 Remove action for Woodmart theme lazyload feature
6436
  remove_action( 'init', 'woodmart_lazy_loading_init', 120 );
6437
- if( class_exists('CDN_Enabler')){
6438
- add_filter('option_cdn_enabler', 'ampforwp_add_exclusions_cdn_enabler');
6439
- }
6440
  }
6441
  }
6442
 
6443
- function ampforwp_add_exclusions_cdn_enabler($options){
6444
- if (!is_array($options)) { return $options; }
6445
- $excluded_urls[] = 'wp-content';
6446
- $urls = implode(',', $excluded_urls);
6447
- $options['excludes'] = empty($options['excludes'])?$urls:$options['excludes'].','.$urls;
6448
- return $options;
6449
- }
6450
 
6451
  function ampforwp_thrive_content($content){
6452
  $post_id = "";
@@ -7746,6 +7728,20 @@ if(!function_exists('ampforwp_transposh_plugin_rtl_css')){
7746
  }
7747
  }
7748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7749
  add_filter('ampforwp_the_content_last_filter','ampforwp_include_required_scripts',12);
7750
  function ampforwp_include_required_scripts($content){
7751
  $comp_to_remove_arr = array();
@@ -8038,42 +8034,6 @@ function ampforwp_ewww_webp_compatibility($content){
8038
  return $content;
8039
  }
8040
  }
8041
- function ampforwp_seo_selection_notice() {
8042
- if('' != ampforwp_get_setting('ampforwp-seo-selection')){
8043
- return;
8044
- }
8045
- $seo = '';
8046
- if(class_exists('WPSEO_Options')){
8047
- $seo = 'Yoast SEO';
8048
- }
8049
- if(class_exists('All_in_One_SEO_Pack')){
8050
- $seo = 'All in One SEO';
8051
- }
8052
- if(function_exists( 'the_seo_framework' )){
8053
- $seo = 'The SEO Framework';
8054
- }
8055
- if(function_exists('genesis_theme_support')){
8056
- $seo = 'Genesis';
8057
- }
8058
- if(function_exists('qode_header_meta')){
8059
- $seo = 'Bridge Qode SEO';
8060
- }
8061
- if(defined( 'RANK_MATH_FILE' )){
8062
- $seo = 'Rank Math SEO';
8063
- }
8064
- if(defined( 'SQ_ALL_PATTERNS' )){
8065
- $seo = 'Squirrly SEO';
8066
- }
8067
- if(class_exists('Smartcrawl_Loader')){
8068
- $seo = 'Smartcrawl SEO';
8069
- }
8070
- if(function_exists('seopress_activation')){
8071
- $seo = 'SEO Press';
8072
- }
8073
- if(!empty($seo)){
8074
- echo sprintf(('<div class="notice notice-error"><p>%s <a href="%s">%s</a></p></div>'), esc_html__('The configuration of AMPforWP and '.esc_html($seo).' plugin is seems incorrect. Please go to AMPforWP plugin settings and select '.esc_html($seo).' from SEO Plugin Integration or ','accelerated-mobile-pages'),esc_url(admin_url('admin.php?page=amp_options&tab=5')),esc_html__('Click Here','accelerated-mobile-pages'));
8075
- }
8076
- }
8077
 
8078
  if(!function_exists('ampforwp_check_image_existance')){
8079
  function ampforwp_check_image_existance($image){
355
  }
356
  // URL Purifier
357
  $amp_url = ampforwp_url_purifier($amp_url);
358
+ if(true == ampforwp_get_setting('amp-core-end-point') && (!is_home() && !is_front_page())){
359
  $amp_url = add_query_arg( 'amp', '', get_the_permalink() );
360
  }
361
  $amp_url = apply_filters('ampforwp_modify_rel_canonical',$amp_url);
370
  // AMPHTML when using custom page and then creating a blog page
371
  add_action('amp_init','ampforwp_allow_homepage_as_blog');
372
  function ampforwp_allow_homepage_as_blog() {
373
+ if(function_exists('mfn_opts_setup')){
374
+ remove_action( 'pre_get_posts', 'mfn_search' );
375
+ }
376
  add_action( 'wp', 'ampforwp_static_blog' , 11 );
377
  }
378
  function ampforwp_static_blog(){
3058
 
3059
  //52. Adding a generalized sanitizer function for purifiying normal html to amp-html
3060
  function ampforwp_content_sanitizer( $content ) {
3061
+ global $post;
3062
  $amp_custom_post_content_input = $content;
3063
  if ( !empty( $amp_custom_post_content_input ) ) {
3064
  $amp_custom_content = new AMPFORWP_Content( $amp_custom_post_content_input,
3079
  'AMP_Iframe_Sanitizer' => array(
3080
  'add_placeholder' => true,
3081
  ),
3082
+ ),$post )
3083
  );
3084
 
3085
  if ( $amp_custom_content ) {
4308
  }
4309
  }
4310
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4311
 
4312
  // 76. Body Class for AMP pages
4313
  if (! function_exists( 'ampforwp_body_class' ) ) {
6211
  $srcUrl = add_query_arg('title' , urlencode($post->post_title), $srcUrl);
6212
  $srcUrl = add_query_arg('img' , esc_url($img), $srcUrl);
6213
  $srcUrl = add_query_arg('tags' , urlencode($tag_name), $srcUrl);
6214
+ if(ampforwp_get_setting('ampforwp-vuukle-comments-emoji')==false){
6215
+ $srcUrl = add_query_arg('emotes' , 'false', $srcUrl);
6216
+ }
6217
  $consent = '';
6218
  if(ampforwp_get_data_consent()){
6219
  $consent = 'data-block-on-consent ';
6426
  if ( function_exists( 'ampforwp_is_amp_inURL' ) && ampforwp_is_amp_inURL($url_path) ) {
6427
  //#3254 Remove action for Woodmart theme lazyload feature
6428
  remove_action( 'init', 'woodmart_lazy_loading_init', 120 );
 
 
 
6429
  }
6430
  }
6431
 
 
 
 
 
 
 
 
6432
 
6433
  function ampforwp_thrive_content($content){
6434
  $post_id = "";
7728
  }
7729
  }
7730
 
7731
+
7732
+ add_filter('ampforwp_the_content_last_filter','ampforwp_remove_unwanted_code',10);
7733
+ function ampforwp_remove_unwanted_code($content){
7734
+ // Mediavine validation issue with form and amp-consent #4206
7735
+ if(preg_match('/<amp-consent id="mv-consent" layout="nodisplay">(.*?)<\/amp-consent>/s', $content)){
7736
+ $content = preg_replace('/<amp-consent id="mv-consent" layout="nodisplay">(.*?)<\/amp-consent>/s', '', $content);
7737
+ }
7738
+ if(preg_match('/<form class="mv-create-print-form">(.*?)<\/form>/s', $content)){
7739
+ $content = preg_replace('/<form class="mv-create-print-form">(.*?)<\/form>/s', '', $content);
7740
+ }
7741
+ // close #4206
7742
+ return $content;
7743
+ }
7744
+
7745
  add_filter('ampforwp_the_content_last_filter','ampforwp_include_required_scripts',12);
7746
  function ampforwp_include_required_scripts($content){
7747
  $comp_to_remove_arr = array();
8034
  return $content;
8035
  }
8036
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8037
 
8038
  if(!function_exists('ampforwp_check_image_existance')){
8039
  function ampforwp_check_image_existance($image){