AMP for WP – Accelerated Mobile Pages - Version 0.9.97.57

Version Description

(31st May 2019) = * Improvements: Need to add description field in VideoObject Schema type #2846 * Improvements: Create an option for H1-H6 Heading Font Sizes for all the designs. #3035 * Improvements: Need to AMP compatible with this plugin HTTP / HTTPS Remover #3123 * Improvements: Due to Enable image replacement option in optimole plugin images get removed in AMP #3073 * Improvements: Author name not comes in AMP due to "Simple Author Box" plugin #3145 * Improvements: Need hyperlink option on the slider module image #2932 * Improvements: Need another menu for alternative menu which separate from main menu #2916 * Improvements: Audio Playlist Support #2437 * Improvements: Separate option to enable/disable Tags support im AMP #3016 * Fixed: Controls under swift design should display when selected design is AMP theme framework #2939 * Fixed: AMP Blurb Module shows code on frontend #3228 * Fixed: Need to Use Ajax to fetch all Categories and tags in Featured Slider in D3 #2590 * Fixed: copy the content stop working #3193 * Fixed: mandatory tag 'link rel=canonical' is missing or incorrect on Homepage- when RankMath is active #3250 * Fixed: Uncaught Error: Call to undefined function ampforwp_get_frontpage_id() #3242 * Fixed: Liststyle (Circle) added beside Published by in Design3 in 0.9.97.53 #3222 * Fixed: Version 0.9.97.52 Yoast Meta Information not being picked up #3207 * Fixed: When navigation menu option is disabled then amp menu checkbox should be removed from menu appearance. #2548 * Fixed: Needs to re-write function ampforwp_add_custom_rewrite_rules to improve performace #2924 * Fixed: amp-next-page script of infinity scroll shouldn't load on other custom post type pages #3157 * Fixed: Archive and Tag pages generating incorrect AMP HTML #3170 * Fixed: Images are appearing twice #3186 * Fixed: Debug error on Homepage #3135 * Fixed: Font JavaScript is loading everywhere in console and breaking things in dashboard #3133 * Fixed: Rewrite ampforwp_view_nonamp function to make it future proof #2710 * Fixed: if there's and apostrophe in the post title, it is published as random characters In twitter #2744

Download this release

Release Info

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

Code changes from version 0.9.97.56 to 0.9.97.57

Files changed (35) hide show
  1. README.md +29 -1
  2. accelerated-moblie-pages.php +126 -34
  3. changelog.txt +28 -0
  4. classes/class-ampforwp-infinite-scroll.php +1 -1
  5. components/author-box/author-box.php +1 -1
  6. components/components-core.php +15 -1
  7. components/featured-image/featured-image.php +4 -0
  8. components/menu/menu.php +6 -2
  9. includes/admin-script.js +7 -1
  10. includes/features/functions.php +26 -14
  11. includes/features/structure-data/structured-data-functions.php +4 -1
  12. includes/includes.php +17 -0
  13. includes/modules/ampforwp-blurb.php +2 -2
  14. includes/options/admin-config.php +67 -34
  15. includes/redirect.php +1 -1
  16. includes/thirdparty-compatibility.php +366 -345
  17. includes/vendor/amp/includes/class-amp-content.php +1 -0
  18. includes/vendor/amp/includes/class-amp-post-template.php +2 -0
  19. includes/vendor/amp/includes/embeds/class-amp-playlist-embed-handler.php +320 -0
  20. includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php +8 -3
  21. pagebuilder/inc/viewShowFrontData.php +8 -0
  22. pagebuilder/modules/slider-mod-module.php +41 -2
  23. readme.txt +29 -1
  24. templates/custom-amp-content-button.js +9 -2
  25. templates/custom-amp-content.php +1 -0
  26. templates/custom-sanitizer.php +1 -0
  27. templates/design-manager/design-1/style.php +36 -2
  28. templates/design-manager/design-2/style.php +35 -1
  29. templates/design-manager/design-3/style.php +36 -2
  30. templates/design-manager/swift/footer.php +1 -1
  31. templates/design-manager/swift/functions.php +9 -1
  32. templates/design-manager/swift/header.php +9 -2
  33. templates/design-manager/swift/single.php +2 -2
  34. templates/design-manager/swift/style.php +13 -13
  35. templates/features.php +24 -97
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.1
7
- Stable tag: 0.9.97.56
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -188,6 +188,34 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  = 0.9.97.56 (29th May 2019) =
192
  * Fixed: #3214 fix was causing conflict with AMP Layouts and content was getting blank
193
 
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.1
7
+ Stable tag: 0.9.97.57
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
188
 
189
  == Changelog ==
190
 
191
+ = 0.9.97.57 (31st May 2019) =
192
+ * Improvements: Need to add description field in VideoObject Schema type #2846
193
+ * Improvements: Create an option for H1-H6 Heading Font Sizes for all the designs. #3035
194
+ * Improvements: Need to AMP compatible with this plugin HTTP / HTTPS Remover #3123
195
+ * Improvements: Due to Enable image replacement option in optimole plugin images get removed in AMP #3073
196
+ * Improvements: Author name not comes in AMP due to "Simple Author Box" plugin #3145
197
+ * Improvements: Need hyperlink option on the slider module image #2932
198
+ * Improvements: Need another menu for alternative menu which separate from main menu #2916
199
+ * Improvements: Audio Playlist Support #2437
200
+ * Improvements: Separate option to enable/disable Tags support im AMP #3016
201
+ * Fixed: Controls under swift design should display when selected design is AMP theme framework #2939
202
+ * Fixed: AMP Blurb Module shows code on frontend #3228
203
+ * Fixed: Need to Use Ajax to fetch all Categories and tags in Featured Slider in D3 #2590
204
+ * Fixed: copy the content stop working #3193
205
+ * Fixed: mandatory tag 'link rel=canonical' is missing or incorrect on Homepage- when RankMath is active #3250
206
+ * Fixed: Uncaught Error: Call to undefined function ampforwp_get_frontpage_id() #3242
207
+ * Fixed: Liststyle (Circle) added beside Published by in Design3 in 0.9.97.53 #3222
208
+ * Fixed: Version 0.9.97.52 Yoast Meta Information not being picked up #3207
209
+ * Fixed: When navigation menu option is disabled then amp menu checkbox should be removed from menu appearance. #2548
210
+ * Fixed: Needs to re-write function ampforwp_add_custom_rewrite_rules to improve performace #2924
211
+ * Fixed: amp-next-page script of infinity scroll shouldn't load on other custom post type pages #3157
212
+ * Fixed: Archive and Tag pages generating incorrect AMP HTML #3170
213
+ * Fixed: Images are appearing twice #3186
214
+ * Fixed: Debug error on Homepage #3135
215
+ * Fixed: Font JavaScript is loading everywhere in console and breaking things in dashboard #3133
216
+ * Fixed: Rewrite ampforwp_view_nonamp function to make it future proof #2710
217
+ * Fixed: if there's and apostrophe in the post title, it is published as random characters In twitter #2744
218
+
219
  = 0.9.97.56 (29th May 2019) =
220
  * Fixed: #3214 fix was causing conflict with AMP Layouts and content was getting blank
221
 
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.97.56
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.97.56');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  // any changes to AMP_QUERY_VAR should be refelected here
26
  function ampforwp_generate_endpoint(){
@@ -124,11 +124,15 @@ function ampforwp_add_custom_rewrite_rules() {
124
  );
125
 
126
  // For category pages
127
- $rewrite_category = get_option('category_base');
128
- if ( ! empty($rewrite_category) ) {
 
 
129
  $rewrite_category = get_option('category_base');
130
- } else {
131
- $rewrite_category = 'category';
 
 
132
  }
133
 
134
  add_rewrite_rule(
@@ -144,7 +148,12 @@ function ampforwp_add_custom_rewrite_rules() {
144
  );
145
 
146
  // For category pages with Pagination (Custom Permalink Structure)
147
- $permalink_structure = get_option('permalink_structure');
 
 
 
 
 
148
  $permalink_structure = preg_replace('/(%.*%)/', '', $permalink_structure);
149
  $permalink_structure = preg_replace('/\//', '', $permalink_structure);
150
  if ( $permalink_structure ) {
@@ -156,12 +165,16 @@ function ampforwp_add_custom_rewrite_rules() {
156
  }
157
 
158
  // For tag pages
159
- $rewrite_tag = get_option('tag_base');
160
- if ( ! empty($rewrite_tag) ) {
161
- $rewrite_tag = get_option('tag_base');
162
- } else {
163
- $rewrite_tag = 'tag';
 
 
 
164
  }
 
165
  add_rewrite_rule(
166
  $rewrite_tag.'\/(.+?)\/amp/?$',
167
  'index.php?amp=1&tag=$matches[1]',
@@ -181,6 +194,12 @@ function ampforwp_add_custom_rewrite_rules() {
181
  'top'
182
  );
183
  }
 
 
 
 
 
 
184
  // Rewrite rule for date archive with pagination #2289
185
  add_rewrite_rule(
186
  '([0-9]{4})/([0-9]{1,2})/amp/'.$wp_rewrite->pagination_base.'/?([0-9]{1,})/?$',
@@ -188,41 +207,55 @@ function ampforwp_add_custom_rewrite_rules() {
188
  'top'
189
  );
190
  //Rewrite rule for custom Taxonomies
191
- $args = array(
192
- 'public' => true,
193
- '_builtin' => false,
194
- );
195
- $output = 'names'; // or objects
196
- $operator = 'and'; // 'and' or 'or'
197
- $taxonomies = get_taxonomies( $args, $output, $operator );
 
 
 
 
 
198
 
199
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
200
- if(!is_plugin_active('amp-woocommerce-pro/amp-woocommerce.php' )) {
201
  if( class_exists( 'WooCommerce' ) ) {
202
- $wc_permalinks = get_option( 'woocommerce_permalinks' );
203
-
 
 
 
 
204
  if ( $wc_permalinks ) {
205
  $taxonomies = array_merge($taxonomies, $wc_permalinks);
206
  }
207
  }
208
  }
209
  $post_types = ampforwp_get_all_post_types();
210
- if ( $post_types ) {
211
- foreach ($post_types as $post_type ) {
212
- if ( 'post' != $post_type && 'page' != $post_type ){
213
- add_rewrite_rule(
214
- $post_type.'\/amp/?$',
215
- 'index.php?amp&post_type='.$post_type,
216
- 'top'
217
- );
218
- add_rewrite_rule(
 
 
 
 
 
219
  $post_type.'\/amp/'.$wp_rewrite->pagination_base.'/([0-9]{1,})/?$',
220
  'index.php?amp=1&post_type='.$post_type.'&paged=$matches[1]',
221
  'top'
222
- );
223
- }
224
  }
225
  }
 
 
226
  $taxonomies = apply_filters( 'ampforwp_modify_rewrite_tax', $taxonomies );
227
  if ( $taxonomies ) {
228
  foreach ( $taxonomies as $key => $taxonomy ) {
@@ -243,6 +276,25 @@ function ampforwp_add_custom_rewrite_rules() {
243
  }
244
  }
245
  add_action( 'init', 'ampforwp_add_custom_rewrite_rules', 25 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
  // add re-write rule for Products
247
  add_action( 'init', 'ampforwp_custom_rewrite_rules_for_product_category' );
248
  if ( ! function_exists('ampforwp_custom_rewrite_rules_for_product_category') ) {
@@ -1054,4 +1106,44 @@ if ( ! function_exists('ampforwp_exclude_posts') ) {
1054
  }
1055
  return $exclude_post_values;
1056
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1057
  }
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.97.57
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.97.57');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  // any changes to AMP_QUERY_VAR should be refelected here
26
  function ampforwp_generate_endpoint(){
124
  );
125
 
126
  // For category pages
127
+ $rewrite_category = '';
128
+ $rewrite_category = get_transient('ampforwp_category_base');
129
+
130
+ if ( false == $rewrite_category ) {
131
  $rewrite_category = get_option('category_base');
132
+ if ( empty($rewrite_category) ) {
133
+ $rewrite_category = 'category';
134
+ }
135
+ set_transient('ampforwp_category_base', $rewrite_category);
136
  }
137
 
138
  add_rewrite_rule(
148
  );
149
 
150
  // For category pages with Pagination (Custom Permalink Structure)
151
+ $permalink_structure = '';
152
+ $permalink_structure = get_transient('ampforwp_permalink_structure');
153
+ if ( false == $permalink_structure ) {
154
+ $permalink_structure = get_option('permalink_structure');
155
+ set_transient('ampforwp_permalink_structure', $permalink_structure );
156
+ }
157
  $permalink_structure = preg_replace('/(%.*%)/', '', $permalink_structure);
158
  $permalink_structure = preg_replace('/\//', '', $permalink_structure);
159
  if ( $permalink_structure ) {
165
  }
166
 
167
  // For tag pages
168
+ $rewrite_tag = '';
169
+ $rewrite_tag = get_transient('ampforwp_tag_base');
170
+ if ( false == $rewrite_tag ) {
171
+ $rewrite_tag = get_option('tag_base');
172
+ if ( empty($rewrite_tag) ) {
173
+ $rewrite_tag = 'tag';
174
+ }
175
+ set_transient('ampforwp_tag_base',$rewrite_tag);
176
  }
177
+
178
  add_rewrite_rule(
179
  $rewrite_tag.'\/(.+?)\/amp/?$',
180
  'index.php?amp=1&tag=$matches[1]',
194
  'top'
195
  );
196
  }
197
+ // Rewrite rule for date archive
198
+ add_rewrite_rule(
199
+ '([0-9]{4})/([0-9]{1,2})\/amp\/?$',
200
+ 'index.php?year=$matches[1]&monthnum=$matches[2]&amp=1',
201
+ 'top'
202
+ );
203
  // Rewrite rule for date archive with pagination #2289
204
  add_rewrite_rule(
205
  '([0-9]{4})/([0-9]{1,2})/amp/'.$wp_rewrite->pagination_base.'/?([0-9]{1,})/?$',
207
  'top'
208
  );
209
  //Rewrite rule for custom Taxonomies
210
+ $taxonomies = '';
211
+ $taxonomies = get_transient('ampforwp_get_taxonomies');
212
+ if ( false == $taxonomies ) {
213
+ $args = array(
214
+ 'public' => true,
215
+ '_builtin' => false,
216
+ );
217
+ $output = 'names'; // or objects
218
+ $operator = 'and'; // 'and' or 'or'
219
+ $taxonomies = get_taxonomies( $args, $output, $operator );
220
+ set_transient('ampforwp_get_taxonomies',$taxonomies);
221
+ }
222
 
223
+ if(!function_exists('amp_woocommerce_pro_add_woocommerce_support') ) {
 
224
  if( class_exists( 'WooCommerce' ) ) {
225
+ $wc_permalinks = '';
226
+ $wc_permalinks = get_transient('ampforwp_woocommerce_permalinks');
227
+ if( false == $wc_permalinks ) {
228
+ $wc_permalinks = get_option( 'woocommerce_permalinks' );
229
+ set_transient('ampforwp_woocommerce_permalinks', $wc_permalinks);
230
+ }
231
  if ( $wc_permalinks ) {
232
  $taxonomies = array_merge($taxonomies, $wc_permalinks);
233
  }
234
  }
235
  }
236
  $post_types = ampforwp_get_all_post_types();
237
+ if ( $post_types ) {
238
+ foreach ($post_types as $post_type ) {
239
+ if ( 'post' != $post_type && 'page' != $post_type ){
240
+ add_rewrite_rule(
241
+ $post_type.'\/amp/?$',
242
+ 'index.php?amp&post_type='.$post_type,
243
+ 'top'
244
+ );
245
+ add_rewrite_rule(
246
+ $post_type.'\/(.+?)\/amp\/?$',
247
+ 'index.php?amp&'.$post_type.'=$matches[1]',
248
+ 'top'
249
+ );
250
+ add_rewrite_rule(
251
  $post_type.'\/amp/'.$wp_rewrite->pagination_base.'/([0-9]{1,})/?$',
252
  'index.php?amp=1&post_type='.$post_type.'&paged=$matches[1]',
253
  'top'
254
+ );
 
255
  }
256
  }
257
+ }
258
+
259
  $taxonomies = apply_filters( 'ampforwp_modify_rewrite_tax', $taxonomies );
260
  if ( $taxonomies ) {
261
  foreach ( $taxonomies as $key => $taxonomy ) {
276
  }
277
  }
278
  add_action( 'init', 'ampforwp_add_custom_rewrite_rules', 25 );
279
+ // Delete category_base transient when it is updated #2924
280
+ add_action('update_option_category_base', 'ampforwp_update_option_category_base');
281
+ function ampforwp_update_option_category_base(){
282
+ delete_transient('ampforwp_category_base');
283
+ }
284
+ // Delete category_base transient when it is updated #2924
285
+ add_action('update_option_tag_base', 'ampforwp_update_option_tag_base');
286
+ function ampforwp_update_option_tag_base(){
287
+ delete_transient('ampforwp_tag_base');
288
+ }
289
+ // Delete permalink_structure transient when it is updated #2924
290
+ add_action('update_option_permalink_structure', 'ampforwp_update_option_permalink_structure');
291
+ function ampforwp_update_option_permalink_structure(){
292
+ delete_transient('ampforwp_permalink_structure');
293
+ // Delete ampforwp_woocommerce_permalinks transient when it is updated #2924
294
+ if( class_exists( 'WooCommerce' ) ) {
295
+ delete_transient('ampforwp_woocommerce_permalinks');
296
+ }
297
+ }
298
  // add re-write rule for Products
299
  add_action( 'init', 'ampforwp_custom_rewrite_rules_for_product_category' );
300
  if ( ! function_exists('ampforwp_custom_rewrite_rules_for_product_category') ) {
1106
  }
1107
  return $exclude_post_values;
1108
  }
1109
+ }
1110
+
1111
+ // Redux Options Enabler #2939
1112
+ add_filter( 'redux/options/redux_builder_amp/sections', 'ampforwp_redux_options_enabler',7,1 );
1113
+ function ampforwp_redux_options_enabler($sections){
1114
+ $redux_enabled_options = array();
1115
+ // apply_filters to get the options to enable them
1116
+ $redux_enabled_options = apply_filters('ampforwp_options_enabler', $redux_enabled_options);
1117
+ if(is_array($redux_enabled_options) ) {
1118
+ foreach ($sections as $key => $section_value) {
1119
+ if(count($section_value['fields'])>0){
1120
+ foreach ($section_value['fields'] as $fieldkey => $field_value) {
1121
+ if(isset($field_value['required']) && in_array($field_value['id'], $redux_enabled_options) ){
1122
+ unset($sections[$key]['fields'][$fieldkey]['required']);
1123
+ }
1124
+ }
1125
+ }
1126
+ }
1127
+ }
1128
+ return $sections;
1129
+ }
1130
+
1131
+ // Redux Options Remover #2939
1132
+ add_filter( 'redux/options/redux_builder_amp/sections', 'ampforwp_redux_options_remover',7,1 );
1133
+ function ampforwp_redux_options_remover($sections){
1134
+ $redux_enabled_options = array();
1135
+ // apply_filters to get the options to remove them
1136
+ $redux_enabled_options = apply_filters('ampforwp_options_remover', $redux_enabled_options);
1137
+ if(is_array($redux_enabled_options) ) {
1138
+ foreach ($sections as $key => $section_value) {
1139
+ if(count($section_value['fields'])>0){
1140
+ foreach ($section_value['fields'] as $fieldkey => $field_value) {
1141
+ if(isset($field_value['required']) && in_array($field_value['id'], $redux_enabled_options) ){
1142
+ unset($sections[$key]['fields'][$fieldkey]);
1143
+ }
1144
+ }
1145
+ }
1146
+ }
1147
+ }
1148
+ return $sections;
1149
  }
changelog.txt CHANGED
@@ -1,5 +1,33 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 0.9.97.56 (29th May 2019) =
4
  * Fixed: #3214 fix was causing conflict with AMP Layouts and content was getting blank
5
 
1
  == Changelog ==
2
 
3
+ = 0.9.97.57 (31st May 2019) =
4
+ * Improvements: Need to add description field in VideoObject Schema type #2846
5
+ * Improvements: Create an option for H1-H6 Heading Font Sizes for all the designs. #3035
6
+ * Improvements: Need to AMP compatible with this plugin HTTP / HTTPS Remover #3123
7
+ * Improvements: Due to Enable image replacement option in optimole plugin images get removed in AMP #3073
8
+ * Improvements: Author name not comes in AMP due to "Simple Author Box" plugin #3145
9
+ * Improvements: Need hyperlink option on the slider module image #2932
10
+ * Improvements: Need another menu for alternative menu which separate from main menu #2916
11
+ * Improvements: Audio Playlist Support #2437
12
+ * Improvements: Separate option to enable/disable Tags support im AMP #3016
13
+ * Fixed: Controls under swift design should display when selected design is AMP theme framework #2939
14
+ * Fixed: AMP Blurb Module shows code on frontend #3228
15
+ * Fixed: Need to Use Ajax to fetch all Categories and tags in Featured Slider in D3 #2590
16
+ * Fixed: copy the content stop working #3193
17
+ * Fixed: mandatory tag 'link rel=canonical' is missing or incorrect on Homepage- when RankMath is active #3250
18
+ * Fixed: Uncaught Error: Call to undefined function ampforwp_get_frontpage_id() #3242
19
+ * Fixed: Liststyle (Circle) added beside Published by in Design3 in 0.9.97.53 #3222
20
+ * Fixed: Version 0.9.97.52 Yoast Meta Information not being picked up #3207
21
+ * Fixed: When navigation menu option is disabled then amp menu checkbox should be removed from menu appearance. #2548
22
+ * Fixed: Needs to re-write function ampforwp_add_custom_rewrite_rules to improve performace #2924
23
+ * Fixed: amp-next-page script of infinity scroll shouldn't load on other custom post type pages #3157
24
+ * Fixed: Archive and Tag pages generating incorrect AMP HTML #3170
25
+ * Fixed: Images are appearing twice #3186
26
+ * Fixed: Debug error on Homepage #3135
27
+ * Fixed: Font JavaScript is loading everywhere in console and breaking things in dashboard #3133
28
+ * Fixed: Rewrite ampforwp_view_nonamp function to make it future proof #2710
29
+ * Fixed: if there's and apostrophe in the post title, it is published as random characters In twitter #2744
30
+
31
  = 0.9.97.56 (29th May 2019) =
32
  * Fixed: #3214 fix was causing conflict with AMP Layouts and content was getting blank
33
 
classes/class-ampforwp-infinite-scroll.php CHANGED
@@ -16,7 +16,7 @@ if( ! class_exists('AMPforWP_Infinite_Scroll') ) {
16
  $this->is_single = true == $this->is_single() ? $this->is_single() : $this->is_single;
17
  $this->is_loop = true == $this->is_loop() ? $this->is_loop() : $this->is_loop;
18
  $this->paged = $this->paged();
19
- if ( $this->is_single ){
20
  // amp-next-page experiment meta tag
21
  add_action('amp_experiment_meta', array( $this, 'amp_experiment_meta') );
22
  // amp-next-page script
16
  $this->is_single = true == $this->is_single() ? $this->is_single() : $this->is_single;
17
  $this->is_loop = true == $this->is_loop() ? $this->is_loop() : $this->is_loop;
18
  $this->paged = $this->paged();
19
+ if ( $this->is_single && 'post' === get_post_type(ampforwp_get_the_ID()) ){
20
  // amp-next-page experiment meta tag
21
  add_action('amp_experiment_meta', array( $this, 'amp_experiment_meta') );
22
  // amp-next-page script
components/author-box/author-box.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  function ampforwp_framework_get_author_box( $args=array() ) {
3
  // Simple Author Box compatibility #2268
4
- if( class_exists('Simple_Author_Box') ){
5
  return;
6
  }
7
  global $post, $redux_builder_amp;
1
  <?php
2
  function ampforwp_framework_get_author_box( $args=array() ) {
3
  // Simple Author Box compatibility #2268
4
+ if( class_exists('Simple_Author_Box') && !isset($args['author_info']) ){
5
  return;
6
  }
7
  global $post, $redux_builder_amp;
components/components-core.php CHANGED
@@ -5,7 +5,7 @@ global $redux_builder_amp;
5
  $ampforwpTemplate = '';
6
  $loadComponent = array();
7
  $scriptComponent = array();
8
- $supportComponent = array('AMP-search','AMP-menu','AMP-logo','AMP-social-icons','AMP-sidebar','AMP-featured-image','AMP-author-box','AMP-loop','AMP-categories-tags','AMP-comments','AMP-post-navigation','AMP-related-posts','AMP-post-pagination','AMP-call-now', 'AMP-breadcrumb','AMP-gdpr');
9
 
10
  add_filter( 'amp_post_template_data', 'ampforwp_framework_add_and_form_scripts',20);
11
  function ampforwp_framework_add_and_form_scripts($data) {
@@ -173,6 +173,20 @@ function amp_menu($echo=true, $menu_args=array(), $type='header'){
173
  echo $amp_menu;
174
  }
175
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
  // Social Icons component
178
  function amp_social( $social_icons="" ) {
5
  $ampforwpTemplate = '';
6
  $loadComponent = array();
7
  $scriptComponent = array();
8
+ $supportComponent = array('AMP-search','AMP-menu','AMP-alter-menu','AMP-logo','AMP-social-icons','AMP-sidebar','AMP-featured-image','AMP-author-box','AMP-loop','AMP-categories-tags','AMP-comments','AMP-post-navigation','AMP-related-posts','AMP-post-pagination','AMP-call-now', 'AMP-breadcrumb','AMP-gdpr');
9
 
10
  add_filter( 'amp_post_template_data', 'ampforwp_framework_add_and_form_scripts',20);
11
  function ampforwp_framework_add_and_form_scripts($data) {
173
  echo $amp_menu;
174
  }
175
  }
176
+ // Alternative Menus
177
+ function amp_alter_menu($echo=true){
178
+ global $loadComponent;
179
+ if ( ! has_nav_menu('amp-alternative-menu') ) {
180
+ return false;
181
+ }
182
+ if(isset($loadComponent['AMP-alter-menu']) && $loadComponent['AMP-alter-menu']==true){
183
+ if ( false == $echo ) {
184
+ return amp_menu_html($echo, array(),'amp-alternative-menu');
185
+ }
186
+ else
187
+ echo amp_menu_html($echo, array(), 'amp-alternative-menu');
188
+ }
189
+ }
190
 
191
  // Social Icons component
192
  function amp_social( $social_icons="" ) {
components/featured-image/featured-image.php CHANGED
@@ -20,6 +20,10 @@ function ampforwp_framework_get_featured_image(){
20
  $amp_html = ampforwp_content_sanitizer($featured_video);
21
  }elseif (has_post_thumbnail( $post_id ) ){
22
  $thumb_id = get_post_thumbnail_id($post_id);
 
 
 
 
23
  $image_size = apply_filters( 'ampforwp_featured_image_size', 'full' );
24
  $image = wp_get_attachment_image_src( $thumb_id, $image_size );
25
  $caption = get_the_post_thumbnail_caption( $post_id );
20
  $amp_html = ampforwp_content_sanitizer($featured_video);
21
  }elseif (has_post_thumbnail( $post_id ) ){
22
  $thumb_id = get_post_thumbnail_id($post_id);
23
+ $post_content = $post->post_content;
24
+ if ( true !== apply_filters('ampforwp_allow_featured_image', false) && ( false !== strpos( $post_content, 'wp-image-' . $thumb_id ) || false !== strpos( $post_content, 'attachment_' . $thumb_id ) ) ) {
25
+ return;
26
+ }
27
  $image_size = apply_filters( 'ampforwp_featured_image_size', 'full' );
28
  $image = wp_get_attachment_image_src( $thumb_id, $image_size );
29
  $caption = get_the_post_thumbnail_caption( $post_id );
components/menu/menu.php CHANGED
@@ -2,13 +2,17 @@
2
  require_once AMPFORWP_PLUGIN_DIR .'/classes/class-ampforwp-walker-nav-menu.php';
3
 
4
  function amp_menu_html($echo, $menu_args, $type){
5
- if( has_nav_menu( 'amp-menu' ) || has_nav_menu( 'amp-footer-menu' ) ) {
 
 
 
 
6
  if ( !empty($menu_args) && isset($menu_args['walker']) ) {
7
  $menu_args['walker'] = new Ampforwp_Walker_Nav_Menu();
8
  }
9
  if (empty($menu_args)){
10
  $menu_args = array(
11
- 'theme_location' => 'amp-menu',
12
  'container'=>'aside',
13
  'menu'=>'ul',
14
  'menu_class'=>'amp-menu',
2
  require_once AMPFORWP_PLUGIN_DIR .'/classes/class-ampforwp-walker-nav-menu.php';
3
 
4
  function amp_menu_html($echo, $menu_args, $type){
5
+ $theme_location = 'amp-menu';
6
+ if ( 'amp-alternative-menu' == $type ) {
7
+ $theme_location = 'amp-alternative-menu';
8
+ }
9
+ if( has_nav_menu( 'amp-menu' ) || has_nav_menu( 'amp-footer-menu' ) || has_nav_menu( 'amp-alternative-menu' ) ) {
10
  if ( !empty($menu_args) && isset($menu_args['walker']) ) {
11
  $menu_args['walker'] = new Ampforwp_Walker_Nav_Menu();
12
  }
13
  if (empty($menu_args)){
14
  $menu_args = array(
15
+ 'theme_location' => $theme_location,
16
  'container'=>'aside',
17
  'menu'=>'ul',
18
  'menu_class'=>'amp-menu',
includes/admin-script.js CHANGED
@@ -238,6 +238,10 @@ jQuery(function($) {
238
  function ampforwp_font_generator() {
239
 
240
  gAPIkey = redux_data.google_font_api_key;
 
 
 
 
241
  disableGFonts = redux_data.amp_google_font_restrict;
242
  if($("#google_font_api_key").length>0){
243
  $("#google_font_api_key").after("<input type='submit' value='Verify'>");
@@ -283,7 +287,9 @@ jQuery(function($) {
283
 
284
  }
285
  function ampforwp_fonts_select_data(data){
286
- var values = Object.values(data.items);
 
 
287
  var allFonts = [];
288
 
289
  for (var i = 0; i < values.length; i++) {
238
  function ampforwp_font_generator() {
239
 
240
  gAPIkey = redux_data.google_font_api_key;
241
+ fontswitch = redux_data['ampforwp-google-font-switch'];
242
+ if(fontswitch != 1){
243
+ return;
244
+ }
245
  disableGFonts = redux_data.amp_google_font_restrict;
246
  if($("#google_font_api_key").length>0){
247
  $("#google_font_api_key").after("<input type='submit' value='Verify'>");
287
 
288
  }
289
  function ampforwp_fonts_select_data(data){
290
+ if(data && localStorage.getItem("googlefontapidata") != null ){
291
+ var values = Object.values(data.items);
292
+ }
293
  var allFonts = [];
294
 
295
  for (var i = 0; i < values.length; i++) {
includes/features/functions.php CHANGED
@@ -108,6 +108,22 @@ function ampforwp_get_the_ID($post_id=''){
108
  }
109
  return $post_id;
110
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  // 27. Clean the Defer issue
112
  // TODO : Get back to this issue. #407
113
  function ampforwp_the_content_filter_full( $content_buffer ) {
@@ -163,15 +179,7 @@ function ampforwp_is_custom_field_featured_image(){
163
  function ampforwp_generate_meta_desc($json=""){
164
  global $post, $redux_builder_amp;
165
  $desc = $post_id = '';
166
- if ( ampforwp_is_front_page() ) {
167
- $post_id = ampforwp_get_frontpage_id();
168
- $post = get_post($post_id);
169
- }
170
- if ( ampforwp_is_blog() ) {
171
- $post_id = ampforwp_get_blog_details('id');
172
- $post = get_post($post_id);
173
- }
174
- $post_id = $post->ID;
175
  if ( true == ampforwp_get_setting('ampforwp-seo-meta-description') || !empty($json) ) {
176
  if ( ampforwp_is_home() || ampforwp_is_blog() ) {
177
  $desc = addslashes( strip_tags( get_bloginfo( 'description' ) ) );
@@ -183,8 +191,7 @@ function ampforwp_generate_meta_desc($json=""){
183
  if ( has_excerpt() ) {
184
  $desc = get_the_excerpt();
185
  } else {
186
- global $post;
187
- $id = $post->ID;
188
  $desc = $post->post_content;
189
  }
190
  $desc = preg_replace('/\[(.*?)\]/',' ', $desc);
@@ -194,7 +201,6 @@ function ampforwp_generate_meta_desc($json=""){
194
  $desc = addslashes( ampforwp_translation($redux_builder_amp['amp-translator-search-text'], 'You searched for:') . ' ' . get_search_query() );
195
  }
196
  if ( ampforwp_is_front_page() ) {
197
- $post_id = ampforwp_get_frontpage_id();
198
  $desc = addslashes( wp_trim_words( strip_tags( get_post_field('post_content', $post_id) ) , 15 ) );
199
  }
200
 
@@ -580,8 +586,14 @@ function ampforwp_url_purifier($url){
580
  if ( true == $checker && false == strpos($url, $endpointq) )
581
  $url = trailingslashit($url) . $endpointq;
582
  else {
583
- if ( false == strpos($url, '/'.$endpoint) )
584
- $url = user_trailingslashit( trailingslashit($url) . $endpoint );
 
 
 
 
 
 
585
  }
586
  }
587
  }
108
  }
109
  return $post_id;
110
  }
111
+
112
+ // Backward Compatibility
113
+ function ampforwp_correct_frontpage() {
114
+ return ampforwp_get_frontpage_id();
115
+ }
116
+
117
+ //Common function to get frontpageID
118
+ function ampforwp_get_frontpage_id() {
119
+ $post_id = '';
120
+ if ( ampforwp_is_front_page() ) {
121
+ $post_id = ampforwp_get_setting('amp-frontpage-select-option-pages');
122
+ }
123
+ $post_id = apply_filters('ampforwp_modify_frontpage_id', $post_id);
124
+ return $post_id;
125
+ }
126
+
127
  // 27. Clean the Defer issue
128
  // TODO : Get back to this issue. #407
129
  function ampforwp_the_content_filter_full( $content_buffer ) {
179
  function ampforwp_generate_meta_desc($json=""){
180
  global $post, $redux_builder_amp;
181
  $desc = $post_id = '';
182
+ $post_id = ampforwp_get_the_ID();
 
 
 
 
 
 
 
 
183
  if ( true == ampforwp_get_setting('ampforwp-seo-meta-description') || !empty($json) ) {
184
  if ( ampforwp_is_home() || ampforwp_is_blog() ) {
185
  $desc = addslashes( strip_tags( get_bloginfo( 'description' ) ) );
191
  if ( has_excerpt() ) {
192
  $desc = get_the_excerpt();
193
  } else {
194
+ $id = ampforwp_get_the_ID();
 
195
  $desc = $post->post_content;
196
  }
197
  $desc = preg_replace('/\[(.*?)\]/',' ', $desc);
201
  $desc = addslashes( ampforwp_translation($redux_builder_amp['amp-translator-search-text'], 'You searched for:') . ' ' . get_search_query() );
202
  }
203
  if ( ampforwp_is_front_page() ) {
 
204
  $desc = addslashes( wp_trim_words( strip_tags( get_post_field('post_content', $post_id) ) , 15 ) );
205
  }
206
 
586
  if ( true == $checker && false == strpos($url, $endpointq) )
587
  $url = trailingslashit($url) . $endpointq;
588
  else {
589
+ $checker = explode('/', $url);
590
+ $amp_check = in_array($endpoint, $checker);
591
+ if ( false == $amp_check ) {
592
+ $url = user_trailingslashit( trailingslashit($url) . $endpoint );
593
+ }
594
+ if ( true == $amp_check ) {
595
+ $url = user_trailingslashit( trailingslashit($url) . $endpoint);
596
+ }
597
  }
598
  }
599
  }
includes/features/structure-data/structured-data-functions.php CHANGED
@@ -331,7 +331,10 @@ if ( ! function_exists('ampforwp_structured_data_video_thumb') ) {
331
  $metadata['uploadDate'] = $metadata['datePublished'];
332
  $metadata['thumbnailUrl'] = $structured_data_video_thumb_url;
333
  $desc = $post->post_content;
334
- if($desc){
 
 
 
335
  $desc = addslashes( wp_trim_words( strip_tags( $desc ) , 30 ) );
336
  $metadata['description'] = $desc;
337
  }
331
  $metadata['uploadDate'] = $metadata['datePublished'];
332
  $metadata['thumbnailUrl'] = $structured_data_video_thumb_url;
333
  $desc = $post->post_content;
334
+ if(ampforwp_is_home()){
335
+ $desc = get_bloginfo('description');
336
+ }
337
+ if($desc){
338
  $desc = addslashes( wp_trim_words( strip_tags( $desc ) , 30 ) );
339
  $metadata['description'] = $desc;
340
  }
includes/includes.php CHANGED
@@ -15,11 +15,28 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  // 1.1 AMP Header menu
16
  if (! function_exists( 'ampforwp_menu') ) {
17
  function ampforwp_menu() {
 
18
  register_nav_menus(
19
  array(
20
  'amp-menu' => esc_html__( 'AMP Menu','accelerated-mobile-pages' ),
21
  )
22
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
  add_action( 'init', 'ampforwp_menu' );
25
  }
15
  // 1.1 AMP Header menu
16
  if (! function_exists( 'ampforwp_menu') ) {
17
  function ampforwp_menu() {
18
+ if(ampforwp_get_setting('ampforwp-amp-menu-swift') == true) {
19
  register_nav_menus(
20
  array(
21
  'amp-menu' => esc_html__( 'AMP Menu','accelerated-mobile-pages' ),
22
  )
23
  );
24
+ if(ampforwp_design_selector()==4 && ampforwp_get_setting('primary-menu') == true){
25
+ register_nav_menus(
26
+ array(
27
+ 'amp-alternative-menu' => esc_html__( 'AMP Alternative Menu - Below the Header','accelerated-mobile-pages' ),
28
+ )
29
+ );
30
+ }
31
+ }
32
+ // 1.2 Footer Menu
33
+ if(ampforwp_get_setting('swift-menu') == true){
34
+ register_nav_menus(
35
+ array(
36
+ 'amp-footer-menu' => esc_html__( 'AMP Footer Menu','accelerated-mobile-pages' ),
37
+ )
38
+ );
39
+ }
40
  }
41
  add_action( 'init', 'ampforwp_menu' );
42
  }
includes/modules/ampforwp-blurb.php CHANGED
@@ -47,7 +47,7 @@
47
  $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array();
48
 
49
 
50
- echo esc_html($before_widget);
51
 
52
  $output .= '<div class="amp-wp-content amp_cb_module amp_cb_blurb">';
53
 
@@ -79,7 +79,7 @@
79
  echo $sanitized_output; // amphtml content, no kses
80
  }
81
 
82
- echo esc_html($after_widget);
83
 
84
  } // end widget
85
 
47
  $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array();
48
 
49
 
50
+ echo $before_widget;
51
 
52
  $output .= '<div class="amp-wp-content amp_cb_module amp_cb_blurb">';
53
 
79
  echo $sanitized_output; // amphtml content, no kses
80
  }
81
 
82
+ echo $after_widget;
83
 
84
  } // end widget
85
 
includes/options/admin-config.php CHANGED
@@ -1450,6 +1450,24 @@ Redux::setArgs( "redux_builder_amp", $args );
1450
  'tooltip-subtitle' => esc_html__('Enable AMP Support on Archives.', 'accelerated-mobile-pages'),
1451
  'default' => '0'
1452
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1453
  $amp_cpt_option,
1454
  array(
1455
  'id' => 'ampforwp-amp-convert-to-wp',
@@ -3457,6 +3475,13 @@ Redux::setSection( $opt_name, array(
3457
  'layout_type' => 'accordion',
3458
  'accordion-open'=> 1,
3459
  ),
 
 
 
 
 
 
 
3460
  array(
3461
  'id' => 'menu-type',
3462
  'title' => esc_html__('Menu Type', 'accelerated-mobile-pages'),
@@ -3468,15 +3493,19 @@ Redux::setSection( $opt_name, array(
3468
  ),
3469
  ),
3470
  'default'=> '1',
3471
- 'required' => array( array('amp-design-selector', '=' , '4') ),
 
 
 
3472
  ),
3473
  array(
3474
  'id' => 'menu-search',
3475
  'type' => 'switch',
3476
  'title' => esc_html__('Menu Search', 'accelerated-mobile-pages'),
3477
- 'required' => array(
3478
- array('amp-design-selector', '=' , '4')
3479
- ),
 
3480
  'default' => '1'
3481
  ),
3482
  array(
@@ -3484,7 +3513,8 @@ Redux::setSection( $opt_name, array(
3484
  'type' => 'switch',
3485
  'title' => esc_html__( 'Menu Copyright', 'accelerated-mobile-pages' ),
3486
  'required' => array(
3487
- array('amp-design-selector', '=' , '4')
 
3488
  ),
3489
  'default' => '1'
3490
  ),
@@ -3495,7 +3525,10 @@ Redux::setSection( $opt_name, array(
3495
  'true' => 'true',
3496
  'false' => 'false',
3497
  'default' => '1',
3498
- 'required' => array( array('amp-design-selector', '=' , '4') ),
 
 
 
3499
  ),
3500
  array(
3501
  'id' => 'primary-menu-padding-control',
@@ -4069,7 +4102,7 @@ Redux::setSection( $opt_name, array(
4069
  array('amp-design-3-featured-content', '=', '1'),
4070
  ),
4071
  'ajax' => true,
4072
- 'data-action' => 'categories',
4073
  'data' => 'categories',
4074
  ),
4075
  array(
@@ -4751,33 +4784,6 @@ $single_page_options = array(
4751
  'layout_type' => 'accordion',
4752
  'accordion-open'=> 0,
4753
  ),
4754
- array(
4755
- 'id' => 'ampforwp-swift-recent-posts',
4756
- 'type' => 'switch',
4757
- 'title' => esc_html__('Recent Posts', 'accelerated-mobile-pages'),
4758
- 'tooltip-subtitle' => esc_html__('To enable & disable recent posts', 'accelerated-mobile-pages'),
4759
- 'default' => 1,
4760
- ),
4761
- array(
4762
- 'id' => 'single-new-features',
4763
- 'type' => 'switch',
4764
- 'title' => esc_html__('Advanced Single Options', 'accelerated-mobile-pages'),
4765
- 'default' => 0,
4766
- ),
4767
- array(
4768
- 'id' => 'breadcrumb-border',
4769
- 'type' => 'switch',
4770
- 'title' => esc_html__('Breadcrumbs Border', 'accelerated-mobile-pages'),
4771
- 'default' => 0,
4772
- 'required' => array( array('single-new-features', '=' , '1'),array('amp-design-selector', '=' , '4') ),
4773
- ),
4774
- array(
4775
- 'id' => 'ampforwp-underline-content-links',
4776
- 'type' => 'switch',
4777
- 'title' => esc_html__('Underline on Links', 'accelerated-mobile-pages'),
4778
- 'default' => 0,
4779
- 'required' => array( array('single-new-features', '=' , '1') ),
4780
- ),
4781
  // Content h1 - h6 font sizes //#2059
4782
  array(
4783
  'id' => 'swift_cnt',
@@ -4888,6 +4894,33 @@ $single_page_options = array(
4888
  'required' => array('swift_cnt_h6' , '=' , '1'),
4889
  array('swift_cnt' , '=' , '1')
4890
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4891
  array(
4892
  'id' => 'ampforwp-single_section_5',
4893
  'type' => 'section',
1450
  'tooltip-subtitle' => esc_html__('Enable AMP Support on Archives.', 'accelerated-mobile-pages'),
1451
  'default' => '0'
1452
  ),
1453
+ array(
1454
+ 'id' => 'ampforwp-archive-support-cat',
1455
+ 'type' => 'switch',
1456
+ 'class' => 'child_opt child_opt_arrow',
1457
+ 'title' => esc_html__('Category', 'accelerated-mobile-pages'),
1458
+ 'tooltip-subtitle' => esc_html__('Enable AMP Support on Categories.', 'accelerated-mobile-pages'),
1459
+ 'default' => '1',
1460
+ 'required' => array('ampforwp-archive-support', '=' , '1')
1461
+ ),
1462
+ array(
1463
+ 'id' => 'ampforwp-archive-support-tag',
1464
+ 'type' => 'switch',
1465
+ 'class' => 'child_opt child_opt_arrow',
1466
+ 'title' => esc_html__('Tags', 'accelerated-mobile-pages'),
1467
+ 'tooltip-subtitle' => esc_html__('Enable AMP Support on Tags.', 'accelerated-mobile-pages'),
1468
+ 'default' => '1',
1469
+ 'required' => array('ampforwp-archive-support', '=' , '1')
1470
+ ),
1471
  $amp_cpt_option,
1472
  array(
1473
  'id' => 'ampforwp-amp-convert-to-wp',
3475
  'layout_type' => 'accordion',
3476
  'accordion-open'=> 1,
3477
  ),
3478
+ array(
3479
+ 'id' => 'ampforwp-amp-menu-swift',
3480
+ 'type' => 'switch',
3481
+ 'title' => esc_html__('Navigation Menu', 'accelerated-mobile-pages'),
3482
+ 'required' => array('amp-design-selector', '=' , '4'),
3483
+ 'default' => '1'
3484
+ ),
3485
  array(
3486
  'id' => 'menu-type',
3487
  'title' => esc_html__('Menu Type', 'accelerated-mobile-pages'),
3493
  ),
3494
  ),
3495
  'default'=> '1',
3496
+ 'required' => array(
3497
+ array('amp-design-selector', '=' , '4'),
3498
+ array('ampforwp-amp-menu-swift', '=' , '1')
3499
+ ),
3500
  ),
3501
  array(
3502
  'id' => 'menu-search',
3503
  'type' => 'switch',
3504
  'title' => esc_html__('Menu Search', 'accelerated-mobile-pages'),
3505
+ 'required' => array(
3506
+ array('amp-design-selector', '=' , '4'),
3507
+ array('ampforwp-amp-menu-swift', '=' , '1')
3508
+ ),
3509
  'default' => '1'
3510
  ),
3511
  array(
3513
  'type' => 'switch',
3514
  'title' => esc_html__( 'Menu Copyright', 'accelerated-mobile-pages' ),
3515
  'required' => array(
3516
+ array('amp-design-selector', '=' , '4'),
3517
+ array('ampforwp-amp-menu-swift', '=' , '1')
3518
  ),
3519
  'default' => '1'
3520
  ),
3525
  'true' => 'true',
3526
  'false' => 'false',
3527
  'default' => '1',
3528
+ 'required' => array(
3529
+ array('amp-design-selector', '=' , '4'),
3530
+ array('ampforwp-amp-menu-swift', '=' , '1')
3531
+ ),
3532
  ),
3533
  array(
3534
  'id' => 'primary-menu-padding-control',
4102
  array('amp-design-3-featured-content', '=', '1'),
4103
  ),
4104
  'ajax' => true,
4105
+ 'data-action' => 'ampforwp_categories',
4106
  'data' => 'categories',
4107
  ),
4108
  array(
4784
  'layout_type' => 'accordion',
4785
  'accordion-open'=> 0,
4786
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4787
  // Content h1 - h6 font sizes //#2059
4788
  array(
4789
  'id' => 'swift_cnt',
4894
  'required' => array('swift_cnt_h6' , '=' , '1'),
4895
  array('swift_cnt' , '=' , '1')
4896
  ),
4897
+ array(
4898
+ 'id' => 'ampforwp-swift-recent-posts',
4899
+ 'type' => 'switch',
4900
+ 'title' => esc_html__('Recent Posts', 'accelerated-mobile-pages'),
4901
+ 'tooltip-subtitle' => esc_html__('To enable & disable recent posts', 'accelerated-mobile-pages'),
4902
+ 'default' => 1,
4903
+ ),
4904
+ array(
4905
+ 'id' => 'single-new-features',
4906
+ 'type' => 'switch',
4907
+ 'title' => esc_html__('Advanced Single Options', 'accelerated-mobile-pages'),
4908
+ 'default' => 0,
4909
+ ),
4910
+ array(
4911
+ 'id' => 'breadcrumb-border',
4912
+ 'type' => 'switch',
4913
+ 'title' => esc_html__('Breadcrumbs Border', 'accelerated-mobile-pages'),
4914
+ 'default' => 0,
4915
+ 'required' => array( array('single-new-features', '=' , '1'),array('amp-design-selector', '=' , '4') ),
4916
+ ),
4917
+ array(
4918
+ 'id' => 'ampforwp-underline-content-links',
4919
+ 'type' => 'switch',
4920
+ 'title' => esc_html__('Underline on Links', 'accelerated-mobile-pages'),
4921
+ 'default' => 0,
4922
+ 'required' => array( array('single-new-features', '=' , '1') ),
4923
+ ),
4924
  array(
4925
  'id' => 'ampforwp-single_section_5',
4926
  'type' => 'section',
includes/redirect.php CHANGED
@@ -11,7 +11,7 @@ function ampforwp_redirection() {
11
  $hide_cats_amp = is_category_amp_disabled();
12
  // Redirection for Homepage and Archive Pages when Turned Off from options panel
13
  if ( ampforwp_is_amp_endpoint() ) {
14
- if( is_archive() && 0 == ampforwp_get_setting('ampforwp-archive-support') ){
15
  $archive_check = true;
16
  }
17
  if ( ( true == $archive_check ) || true == $hide_cats_amp || ((ampforwp_is_home() || ampforwp_is_front_page()) && 0 == ampforwp_get_setting('ampforwp-homepage-on-off-support')) ) {
11
  $hide_cats_amp = is_category_amp_disabled();
12
  // Redirection for Homepage and Archive Pages when Turned Off from options panel
13
  if ( ampforwp_is_amp_endpoint() ) {
14
+ if( (is_archive() && 0 == ampforwp_get_setting('ampforwp-archive-support')) || (is_category() && 0 == ampforwp_get_setting('ampforwp-archive-support-cat')) || (is_tag() && 0 == ampforwp_get_setting('ampforwp-archive-support-tag')) ){
15
  $archive_check = true;
16
  }
17
  if ( ( true == $archive_check ) || true == $hide_cats_amp || ((ampforwp_is_home() || ampforwp_is_front_page()) && 0 == ampforwp_get_setting('ampforwp-homepage-on-off-support')) ) {
includes/thirdparty-compatibility.php CHANGED
@@ -567,387 +567,389 @@ function ampforwp_app_box_styles(){
567
  // SEOPress Compatibility #1589
568
  add_action('amp_post_template_head', 'ampforwp_seopress_social');
569
  function ampforwp_seopress_social(){
570
- $options = $facebook = $twitter = $advanced_options = $seopress_social_og_title = $seopress_social_og_desc = '';
571
- $post_id = ampforwp_get_the_ID();
572
- $options = get_option("seopress_social_option_name");
573
- $advanced_options = get_option("seopress_advanced_option_name");
574
- if ( !empty($options) ) {
575
- if (isset($options['seopress_social_facebook_og'])) {
576
- global $wp;
577
- if (isset($advanced_options['seopress_advanced_advanced_trailingslash']) ) {
578
- $current_url = home_url(add_query_arg(array(), $wp->request));
579
- } else {
580
- $current_url = trailingslashit(home_url(add_query_arg(array(), $wp->request)));
581
- }
582
- if (is_search()) {
583
- $seopress_social_og_url = '<meta property="og:url" content="'.esc_url(htmlspecialchars(urldecode(get_home_url().'/search/'.get_search_query()))).'" />';
584
- } else {
585
- $seopress_social_og_url = '<meta property="og:url" content="'.esc_url(htmlspecialchars(urldecode($current_url),ENT_COMPAT, 'UTF-8')).'" />';
586
- }
587
- //Hook on post OG URL - 'seopress_social_og_url'
588
- if (has_filter('seopress_social_og_url')) {
589
- $seopress_social_og_url = apply_filters('seopress_social_og_url', $seopress_social_og_url);
590
- }
591
- echo $seopress_social_og_url."\n";
592
- }
593
- if (isset($options['seopress_social_facebook_og'])) {
594
- $seopress_social_og_site_name = '<meta property="og:site_name" content="'.esc_html(get_bloginfo('name')).'" />';
595
- //Hook on post OG site name - 'seopress_social_og_site_name'
596
- if (has_filter('seopress_social_og_site_name')) {
597
- $seopress_social_og_site_name = apply_filters('seopress_social_og_site_name', $seopress_social_og_site_name);
598
- }
599
- echo $seopress_social_og_site_name."\n";
600
- }
601
- if (isset($options['seopress_social_facebook_og'])) {
602
- $seopress_social_og_locale = '<meta property="og:locale" content="'.esc_attr(get_locale()).'" />';
603
- //Polylang
604
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
605
- if ( is_plugin_active( 'polylang/polylang.php' ) || is_plugin_active( 'polylang-pro/polylang.php' )) {
606
- //@credits Polylang
607
- if (did_action('pll_init') && function_exists('PLL')) {
608
- $alternates = array();
609
-
610
- foreach ( PLL()->model->get_languages_list() as $language ) {
611
- if ( PLL()->curlang->slug !== $language->slug && PLL()->links->get_translation_url( $language ) && isset( $language->facebook ) ) {
612
- $alternates[] = $language->facebook;
 
 
613
  }
614
- }
615
- // There is a risk that 2 languages have the same Facebook locale. So let's make sure to output each locale only once.
616
- $alternates = array_unique( $alternates );
617
 
618
- foreach ( $alternates as $lang ) {
619
- $seopress_social_og_locale .= "\n";
620
- $seopress_social_og_locale .= '<meta property="og:locale:alternate" content="'.esc_attr($lang).'" />';
 
621
  }
622
  }
623
- }
624
- //Hook on post OG locale - 'seopress_social_og_locale'
625
- if (has_filter('seopress_social_og_locale')) {
626
- $seopress_social_og_locale = apply_filters('seopress_social_og_locale', $seopress_social_og_locale);
627
- }
628
- if (isset($seopress_social_og_locale) && $seopress_social_og_locale !='') {
629
- echo $seopress_social_og_locale."\n";
630
- }
631
- }
632
- if (isset($options['seopress_social_facebook_og'])) {
633
- if (is_home() || is_front_page()) {
634
- $seopress_social_og_type = '<meta property="og:type" content="website" />';
635
- } elseif (is_singular('product') || is_singular('download')) {
636
- $seopress_social_og_type = '<meta property="og:type" content="product" />';
637
- } elseif (is_singular()) {
638
- global $post;
639
- $seopress_video_disabled = get_post_meta($post->ID,'_seopress_video_disabled', true);
640
- $seopress_video = get_post_meta($post->ID,'_seopress_video');
641
-
642
- if (!empty($seopress_video[0][0]['url']) && $seopress_video_disabled =='') {
643
- $seopress_social_og_type = '<meta property="og:type" content="video.other" />';
644
- } else {
645
- $seopress_social_og_type = '<meta property="og:type" content="article" />';
646
- }
647
- }
648
- elseif (is_search() || is_archive() || is_404()) {
649
- $seopress_social_og_type = '<meta property="og:type" content="object" />';
650
- }
651
- if (isset($seopress_social_og_type)) {
652
- //Hook on post OG type - 'seopress_social_og_type'
653
- if (has_filter('seopress_social_og_type')) {
654
- $seopress_social_og_type = apply_filters('seopress_social_og_type', $seopress_social_og_type);
655
  }
656
- echo $seopress_social_og_type."\n";
657
- }
658
- }
659
- if ( isset($options['seopress_social_facebook_og']) && ( isset($options['seopress_social_accounts_facebook']) && '' != $options['seopress_social_accounts_facebook'] ) ) {
660
- if (is_singular() && !is_home() && !is_front_page()) {
661
- global $post;
662
- $seopress_video_disabled = get_post_meta($post->ID,'_seopress_video_disabled', true);
663
- $seopress_video = get_post_meta($post->ID,'_seopress_video');
664
-
665
- if (!empty($seopress_video[0][0]['url']) && $seopress_video_disabled =='') {
666
- //do nothing
667
- } else {
668
- $seopress_social_og_author = '<meta property="article:author" content="'.esc_url($options['seopress_social_accounts_facebook']).'" />';
669
- $seopress_social_og_author .= "\n";
670
- $seopress_social_og_author .= '<meta property="article:publisher" content="'.esc_url($options['seopress_social_accounts_facebook']).'" />';
671
  }
672
  }
673
- if (isset($seopress_social_og_author)) {
674
- //Hook on post OG author - 'seopress_social_og_author'
675
- if (has_filter('seopress_social_og_author')) {
676
- $seopress_social_og_author = apply_filters('seopress_social_og_author', $seopress_social_og_author);
677
- }
678
- echo $seopress_social_og_author."\n";
679
- }
680
- }
681
- if (isset($options['seopress_social_facebook_og'])) {
682
- $title = '';
683
- $title = ampforwp_get_seopress_title();
684
- if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true) ){
685
- $title = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true);
686
- }
687
- if ((is_tax() || is_category() || is_tag()) && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true) ) {
688
- $title = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true);
689
- }
690
- if ( '' != get_post_meta($post_id,'_seopress_social_fb_title',true) ){
691
- $title = get_post_meta($post_id,'_seopress_social_fb_title',true);
692
- }
693
- if ( '' == $title && '' != get_the_title() ){
694
- $title = get_the_title();
695
- }
696
- $seopress_social_og_title .= '<meta property="og:title" content="'.esc_attr($title).'" />';
697
- $seopress_social_og_title .= "\n";
698
- //Hook on post OG title - 'seopress_social_og_title'
699
- if (has_filter('seopress_social_og_title')) {
700
- $seopress_social_og_title = apply_filters('seopress_social_og_title', $seopress_social_og_title);
701
- }
702
- if (isset($seopress_social_og_title) && $seopress_social_og_title !='') {
703
- echo $seopress_social_og_title;
704
- }
705
- }
706
-
707
- if (isset($options['seopress_social_facebook_og'])) {
708
- $description = ampforwp_generate_meta_desc();
709
- if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true) ) {
710
- $description = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true);
711
- }
712
- if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true) ) {
713
- $description = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true);
714
- }
715
- if ( '' != get_post_meta($post_id,'_seopress_social_fb_desc',true) ) {
716
- $description = get_post_meta($post_id,'_seopress_social_fb_desc',true);
717
- }
718
- $seopress_social_og_desc .= '<meta property="og:description" content="'.esc_html($description).'" />';
719
- $seopress_social_og_desc .= "\n";
720
- //Hook on post OG description - 'seopress_social_og_desc'
721
- if (has_filter('seopress_social_og_desc')) {
722
- $seopress_social_og_desc = apply_filters('seopress_social_og_desc', $seopress_social_og_desc);
723
- }
724
- if (isset($seopress_social_og_desc) && $seopress_social_og_desc !='') {
725
- echo $seopress_social_og_desc;
726
- }
727
- }
728
- if (isset($options['seopress_social_facebook_og'])) {
729
- $url = '';
730
- if ( ampforwp_is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true) ){
731
- $url = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true);
732
- }
733
- if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true) ) {
734
- $url = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true);
735
- }
736
- if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true) ) {
737
- $url = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true);
738
  }
739
- if ( '' == $url && has_post_thumbnail() ) {
740
- $url = get_the_post_thumbnail_url();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
741
  }
742
- if (function_exists('attachment_url_to_postid')) {
743
- $image_id = attachment_url_to_postid( $url );
744
- if ( !$image_id ){
745
- return;
 
746
  }
747
-
748
- $image_src = wp_get_attachment_image_src( $image_id, 'full' );
749
-
750
- //OG:IMAGE
751
- $seopress_social_og_img = '';
752
- $seopress_social_og_img .= '<meta property="og:image" content="'.esc_url($url).'" />';
753
- $seopress_social_og_img .= "\n";
754
-
755
- //OG:IMAGE:SECURE_URL IF SSL
756
- if (is_ssl()) {
757
- $seopress_social_og_img .= '<meta property="og:image:secure_url" content="'.esc_url($url).'" />';
758
- $seopress_social_og_img .= "\n";
759
  }
760
-
761
- //OG:IMAGE:WIDTH + OG:IMAGE:HEIGHT
762
- if (!empty($image_src)) {
763
- $seopress_social_og_img .= '<meta property="og:image:width" content="'.esc_attr($image_src[1]).'" />';
764
- $seopress_social_og_img .= "\n";
765
- $seopress_social_og_img .= '<meta property="og:image:height" content="'.esc_attr($image_src[2]).'" />';
766
- $seopress_social_og_img .= "\n";
767
  }
768
-
769
- //OG:IMAGE:ALT
770
- if (get_post_meta($image_id, '_wp_attachment_image_alt', true) !='') {
771
- $seopress_social_og_img .= '<meta property="og:image:alt" content="'.esc_attr(get_post_meta($image_id, '_wp_attachment_image_alt', true)).'" />';
772
- $seopress_social_og_img .= "\n";
773
  }
774
- //Hook on post OG thumbnail - 'seopress_social_og_thumb'
775
- if (has_filter('seopress_social_og_thumb')) {
776
- $seopress_social_og_img = apply_filters('seopress_social_og_thumb', $seopress_social_og_img);
 
 
777
  }
778
- if (isset($seopress_social_og_img) && $seopress_social_og_img !='') {
779
- echo $seopress_social_og_img;
780
  }
781
  }
782
- }
783
- if (isset($options['seopress_social_facebook_og']) && isset($options['seopress_social_facebook_link_ownership_id'])) {
784
- $seopress_social_link_ownership_id = '<meta property="fb:pages" content="'.esc_attr($options['seopress_social_facebook_link_ownership_id']).'" />';
785
- echo $seopress_social_link_ownership_id."\n";
786
- }
787
- if (isset($options['seopress_social_facebook_og']) && isset($options['seopress_social_facebook_link_ownership_id']) ) {
788
- $seopress_social_admin_id = '<meta property="fb:admins" content="'.esc_attr($options['seopress_social_facebook_admin_id']).'" />';
789
- echo $seopress_social_admin_id."\n";
790
- }
791
- if (isset($options['seopress_social_facebook_og']) && isset($options['seopress_social_facebook_link_ownership_id']) ) {
792
- $seopress_social_app_id = '<meta property="fb:app_id" content="'.esc_attr($options['seopress_social_facebook_app_id']).'" />';
793
- echo $seopress_social_app_id."\n";
794
- }
795
- if (isset($options['seopress_social_twitter_card'])) {
796
- if ( isset($options['seopress_social_twitter_card_img_size']) && $options['seopress_social_twitter_card_img_size'] =='large') {
797
- $seopress_social_twitter_card_summary = '<meta name="twitter:card" content="summary_large_image">';
798
- } else {
799
- $seopress_social_twitter_card_summary = '<meta name="twitter:card" content="summary" />';
 
 
 
800
  }
801
- //Hook on post Twitter card summary - 'seopress_social_twitter_card_summary'
802
- if (has_filter('seopress_social_twitter_card_summary')) {
803
- $seopress_social_twitter_card_summary = apply_filters('seopress_social_twitter_card_summary', $seopress_social_twitter_card_summary);
804
- }
805
- echo $seopress_social_twitter_card_summary."\n";
806
- }
807
- if (isset($options['seopress_social_twitter_card']) && isset($options['seopress_social_accounts_twitter']) ) {
808
- $seopress_social_twitter_card_site = '<meta name="twitter:site" content="'.esc_attr($options['seopress_social_accounts_twitter']).'" />';
809
- //Hook on post Twitter card site - 'seopress_social_twitter_card_site'
810
- if (has_filter('seopress_social_twitter_card_site')) {
811
- $seopress_social_twitter_card_site = apply_filters('seopress_social_twitter_card_site', $seopress_social_twitter_card_site);
812
- }
813
- echo $seopress_social_twitter_card_site."\n";
814
- }
815
- if (isset($options['seopress_social_twitter_card'])) {
816
- //Init
817
- $seopress_social_twitter_card_creator ='';
818
- if ($options['seopress_social_twitter_card'] =='1' && get_the_author_meta('twitter') ) {
 
819
 
820
- $seopress_social_twitter_card_creator .= '<meta name="twitter:creator" content="@'.esc_attr(get_the_author_meta('twitter')).'" />';
821
 
822
- } elseif ($options['seopress_social_twitter_card'] =='1' && isset($options['seopress_social_accounts_twitter']) && $options['seopress_social_accounts_twitter'] !='' ) {
823
- $seopress_social_twitter_card_creator .= '<meta name="twitter:creator" content="'.esc_attr($options['seopress_social_accounts_twitter']).'" />';
824
- }
825
- //Hook on post Twitter card creator - 'seopress_social_twitter_card_creator'
826
- if (has_filter('seopress_social_twitter_card_creator')) {
827
- $seopress_social_twitter_card_creator = apply_filters('seopress_social_twitter_card_creator', $seopress_social_twitter_card_creator);
828
- }
829
- if (isset($seopress_social_twitter_card_creator) && $seopress_social_twitter_card_creator !='') {
830
- echo $seopress_social_twitter_card_creator."\n";
831
- }
832
- }
833
- if (isset($options['seopress_social_twitter_card'])) {
834
- $title = $seopress_social_twitter_card_title = '';
835
- $title = ampforwp_get_seopress_title();
836
- if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_title',true) ){
837
- $title = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_title',true);
838
- }elseif ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true) ){
839
- $title = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
840
  }
841
- if ((is_tax() || is_category() || is_tag()) && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_title',true) ) {
842
- $title = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_title',true);
843
- }elseif ((is_tax() || is_category() || is_tag()) && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true) ) {
844
- $title = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true);
845
  }
846
- if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_title',true) ){
847
- $title = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_title',true);
848
- }elseif ( '' != get_post_meta($post_id,'_seopress_social_fb_title',true) ){
849
- $title = get_post_meta($post_id,'_seopress_social_fb_title',true);
850
  }
851
- if ( '' == $title && '' != get_the_title() ){
852
- $title = get_the_title();
 
853
  }
854
- $seopress_social_twitter_card_title .= '<meta name="twitter:title" content="'.esc_attr($title).'" />';
855
- //Hook on post Twitter card title - 'seopress_social_twitter_card_title'
856
- if (has_filter('seopress_social_twitter_card_title')) {
857
- $seopress_social_twitter_card_title = apply_filters('seopress_social_twitter_card_title', $seopress_social_twitter_card_title);
858
- }
859
- if (isset($seopress_social_twitter_card_title) && $seopress_social_twitter_card_title !='') {
860
- echo $seopress_social_twitter_card_title."\n";
861
- }
862
- }
863
- if (isset($options['seopress_social_twitter_card'])) {
864
- $seopress_social_twitter_card_desc = $description = '';
865
- $description = ampforwp_generate_meta_desc();
866
- if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_desc',true) ) {
867
- $description = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_desc',true);
868
- }elseif ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true) ) {
869
- $description = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true);
870
  }
871
- if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_desc',true) ) {
872
- $description = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_desc',true);
873
- }elseif (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true) ) {
874
- $description = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true);
 
 
 
875
  }
 
 
 
 
876
 
877
- if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_desc',true) ) {
878
- $description = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_desc',true);
879
- }elseif ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_desc',true) ) {
880
- $description = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_desc',true);
881
- }
882
- $seopress_social_twitter_card_desc .= '<meta name="twitter:description" content="'.esc_html($description).'" />';
883
- //Hook on post Twitter card description - 'seopress_social_twitter_card_desc'
884
- if (has_filter('seopress_social_twitter_card_desc')) {
885
- $seopress_social_twitter_card_desc = apply_filters('seopress_social_twitter_card_desc', $seopress_social_twitter_card_desc);
886
- }
887
- if (isset($seopress_social_twitter_card_desc) && $seopress_social_twitter_card_desc !='') {
888
- echo $seopress_social_twitter_card_desc."\n";
889
- }
890
- }
891
- if (isset($options['seopress_social_twitter_card'])) {
892
- $url = '';
893
- if ( ampforwp_is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_img',true) ){
894
- $url = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_img',true);
895
- }elseif ( ampforwp_is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true) ){
896
- $url = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true);
897
- }
898
- if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_img',true) ) {
899
- $url = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_img',true);
900
- }elseif (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true) ) {
901
- $url = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true);
902
- }
903
- if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_img',true) ) {
904
- $url = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_img',true);
905
- }elseif ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true) ) {
906
- $url = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true);
907
  }
908
- if ( '' == $url && has_post_thumbnail() ) {
909
- $url = get_the_post_thumbnail_url();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
910
  }
911
- if (function_exists('attachment_url_to_postid')) {
912
- $image_id = attachment_url_to_postid( $url );
913
- if ( !$image_id ){
914
- return;
 
 
 
 
 
 
 
 
915
  }
916
 
917
- $image_src = wp_get_attachment_image_src( $image_id, 'full' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
 
919
- //OG:IMAGE
920
- $seopress_twitter_img = '';
921
- $seopress_twitter_img .= '<meta property="twitter:image" content="'.esc_url($url).'" />';
922
- $seopress_twitter_img .= "\n";
923
 
924
- //OG:IMAGE:SECURE_URL IF SSL
925
- if (is_ssl()) {
926
- $seopress_twitter_img .= '<meta property="twitter:image:secure_url" content="'.esc_url($url).'" />';
927
  $seopress_twitter_img .= "\n";
928
- }
929
 
930
- //OG:IMAGE:WIDTH + OG:IMAGE:HEIGHT
931
- if (!empty($image_src)) {
932
- $seopress_twitter_img .= '<meta property="twitter:image:width" content="'.esc_attr($image_src[1]).'" />';
933
- $seopress_twitter_img .= "\n";
934
- $seopress_twitter_img .= '<meta property="twitter:image:height" content="'.esc_attr($image_src[2]).'" />';
935
- $seopress_twitter_img .= "\n";
936
- }
937
 
938
- //OG:IMAGE:ALT
939
- if (get_post_meta($image_id, '_wp_attachment_image_alt', true) !='') {
940
- $seopress_twitter_img .= '<meta property="twitter:image:alt" content="'.esc_attr(get_post_meta($image_id, '_wp_attachment_image_alt', true)).'" />';
941
- $seopress_twitter_img .= "\n";
942
- }
 
 
943
 
944
- //Hook on post OG thumbnail - 'seopress_social_og_thumb'
945
- if (has_filter('seopress_social_og_thumb')) {
946
- $seopress_twitter_img = apply_filters('seopress_social_og_thumb', $seopress_twitter_img);
947
- }
948
- if (isset($seopress_twitter_img) && $seopress_twitter_img !='') {
949
- echo $seopress_twitter_img;
950
- }
 
 
 
 
 
 
 
951
  }
952
  }
953
  }
@@ -985,3 +987,22 @@ if(!function_exists('ampforwp_remove_enfold_theme_shortcodes_tags')){
985
  return $content;
986
  }
987
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
567
  // SEOPress Compatibility #1589
568
  add_action('amp_post_template_head', 'ampforwp_seopress_social');
569
  function ampforwp_seopress_social(){
570
+ if ( 'seopress' == ampforwp_get_setting('ampforwp-seo-selection') ) {
571
+ $options = $facebook = $twitter = $advanced_options = $seopress_social_og_title = $seopress_social_og_desc = '';
572
+ $post_id = ampforwp_get_the_ID();
573
+ $options = get_option("seopress_social_option_name");
574
+ $advanced_options = get_option("seopress_advanced_option_name");
575
+ if ( !empty($options) ) {
576
+ if (isset($options['seopress_social_facebook_og'])) {
577
+ global $wp;
578
+ if (isset($advanced_options['seopress_advanced_advanced_trailingslash']) ) {
579
+ $current_url = home_url(add_query_arg(array(), $wp->request));
580
+ } else {
581
+ $current_url = trailingslashit(home_url(add_query_arg(array(), $wp->request)));
582
+ }
583
+ if (is_search()) {
584
+ $seopress_social_og_url = '<meta property="og:url" content="'.esc_url(htmlspecialchars(urldecode(get_home_url().'/search/'.get_search_query()))).'" />';
585
+ } else {
586
+ $seopress_social_og_url = '<meta property="og:url" content="'.esc_url(htmlspecialchars(urldecode($current_url),ENT_COMPAT, 'UTF-8')).'" />';
587
+ }
588
+ //Hook on post OG URL - 'seopress_social_og_url'
589
+ if (has_filter('seopress_social_og_url')) {
590
+ $seopress_social_og_url = apply_filters('seopress_social_og_url', $seopress_social_og_url);
591
+ }
592
+ echo $seopress_social_og_url."\n";
593
+ }
594
+ if (isset($options['seopress_social_facebook_og'])) {
595
+ $seopress_social_og_site_name = '<meta property="og:site_name" content="'.esc_html(get_bloginfo('name')).'" />';
596
+ //Hook on post OG site name - 'seopress_social_og_site_name'
597
+ if (has_filter('seopress_social_og_site_name')) {
598
+ $seopress_social_og_site_name = apply_filters('seopress_social_og_site_name', $seopress_social_og_site_name);
599
+ }
600
+ echo $seopress_social_og_site_name."\n";
601
+ }
602
+ if (isset($options['seopress_social_facebook_og'])) {
603
+ $seopress_social_og_locale = '<meta property="og:locale" content="'.esc_attr(get_locale()).'" />';
604
+ //Polylang
605
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
606
+ if ( is_plugin_active( 'polylang/polylang.php' ) || is_plugin_active( 'polylang-pro/polylang.php' )) {
607
+ //@credits Polylang
608
+ if (did_action('pll_init') && function_exists('PLL')) {
609
+ $alternates = array();
610
+
611
+ foreach ( PLL()->model->get_languages_list() as $language ) {
612
+ if ( PLL()->curlang->slug !== $language->slug && PLL()->links->get_translation_url( $language ) && isset( $language->facebook ) ) {
613
+ $alternates[] = $language->facebook;
614
+ }
615
  }
616
+ // There is a risk that 2 languages have the same Facebook locale. So let's make sure to output each locale only once.
617
+ $alternates = array_unique( $alternates );
 
618
 
619
+ foreach ( $alternates as $lang ) {
620
+ $seopress_social_og_locale .= "\n";
621
+ $seopress_social_og_locale .= '<meta property="og:locale:alternate" content="'.esc_attr($lang).'" />';
622
+ }
623
  }
624
  }
625
+ //Hook on post OG locale - 'seopress_social_og_locale'
626
+ if (has_filter('seopress_social_og_locale')) {
627
+ $seopress_social_og_locale = apply_filters('seopress_social_og_locale', $seopress_social_og_locale);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
628
  }
629
+ if (isset($seopress_social_og_locale) && $seopress_social_og_locale !='') {
630
+ echo $seopress_social_og_locale."\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
631
  }
632
  }
633
+ if (isset($options['seopress_social_facebook_og'])) {
634
+ if (is_home() || is_front_page()) {
635
+ $seopress_social_og_type = '<meta property="og:type" content="website" />';
636
+ } elseif (is_singular('product') || is_singular('download')) {
637
+ $seopress_social_og_type = '<meta property="og:type" content="product" />';
638
+ } elseif (is_singular()) {
639
+ global $post;
640
+ $seopress_video_disabled = get_post_meta($post->ID,'_seopress_video_disabled', true);
641
+ $seopress_video = get_post_meta($post->ID,'_seopress_video');
642
+
643
+ if (!empty($seopress_video[0][0]['url']) && $seopress_video_disabled =='') {
644
+ $seopress_social_og_type = '<meta property="og:type" content="video.other" />';
645
+ } else {
646
+ $seopress_social_og_type = '<meta property="og:type" content="article" />';
647
+ }
648
+ }
649
+ elseif (is_search() || is_archive() || is_404()) {
650
+ $seopress_social_og_type = '<meta property="og:type" content="object" />';
651
+ }
652
+ if (isset($seopress_social_og_type)) {
653
+ //Hook on post OG type - 'seopress_social_og_type'
654
+ if (has_filter('seopress_social_og_type')) {
655
+ $seopress_social_og_type = apply_filters('seopress_social_og_type', $seopress_social_og_type);
656
+ }
657
+ echo $seopress_social_og_type."\n";
658
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  }
660
+ if ( isset($options['seopress_social_facebook_og']) && ( isset($options['seopress_social_accounts_facebook']) && '' != $options['seopress_social_accounts_facebook'] ) ) {
661
+ if (is_singular() && !is_home() && !is_front_page()) {
662
+ global $post;
663
+ $seopress_video_disabled = get_post_meta($post->ID,'_seopress_video_disabled', true);
664
+ $seopress_video = get_post_meta($post->ID,'_seopress_video');
665
+
666
+ if (!empty($seopress_video[0][0]['url']) && $seopress_video_disabled =='') {
667
+ //do nothing
668
+ } else {
669
+ $seopress_social_og_author = '<meta property="article:author" content="'.esc_url($options['seopress_social_accounts_facebook']).'" />';
670
+ $seopress_social_og_author .= "\n";
671
+ $seopress_social_og_author .= '<meta property="article:publisher" content="'.esc_url($options['seopress_social_accounts_facebook']).'" />';
672
+ }
673
+ }
674
+ if (isset($seopress_social_og_author)) {
675
+ //Hook on post OG author - 'seopress_social_og_author'
676
+ if (has_filter('seopress_social_og_author')) {
677
+ $seopress_social_og_author = apply_filters('seopress_social_og_author', $seopress_social_og_author);
678
+ }
679
+ echo $seopress_social_og_author."\n";
680
+ }
681
  }
682
+ if (isset($options['seopress_social_facebook_og'])) {
683
+ $title = '';
684
+ $title = ampforwp_get_seopress_title();
685
+ if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true) ){
686
+ $title = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true);
687
  }
688
+ if ((is_tax() || is_category() || is_tag()) && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true) ) {
689
+ $title = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true);
 
 
 
 
 
 
 
 
 
 
690
  }
691
+ if ( '' != get_post_meta($post_id,'_seopress_social_fb_title',true) ){
692
+ $title = get_post_meta($post_id,'_seopress_social_fb_title',true);
 
 
 
 
 
693
  }
694
+ if ( '' == $title && '' != get_the_title() ){
695
+ $title = get_the_title();
 
 
 
696
  }
697
+ $seopress_social_og_title .= '<meta property="og:title" content="'.esc_attr($title).'" />';
698
+ $seopress_social_og_title .= "\n";
699
+ //Hook on post OG title - 'seopress_social_og_title'
700
+ if (has_filter('seopress_social_og_title')) {
701
+ $seopress_social_og_title = apply_filters('seopress_social_og_title', $seopress_social_og_title);
702
  }
703
+ if (isset($seopress_social_og_title) && $seopress_social_og_title !='') {
704
+ echo $seopress_social_og_title;
705
  }
706
  }
707
+
708
+ if (isset($options['seopress_social_facebook_og'])) {
709
+ $description = ampforwp_generate_meta_desc();
710
+ if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true) ) {
711
+ $description = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true);
712
+ }
713
+ if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true) ) {
714
+ $description = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true);
715
+ }
716
+ if ( '' != get_post_meta($post_id,'_seopress_social_fb_desc',true) ) {
717
+ $description = get_post_meta($post_id,'_seopress_social_fb_desc',true);
718
+ }
719
+ $seopress_social_og_desc .= '<meta property="og:description" content="'.esc_html($description).'" />';
720
+ $seopress_social_og_desc .= "\n";
721
+ //Hook on post OG description - 'seopress_social_og_desc'
722
+ if (has_filter('seopress_social_og_desc')) {
723
+ $seopress_social_og_desc = apply_filters('seopress_social_og_desc', $seopress_social_og_desc);
724
+ }
725
+ if (isset($seopress_social_og_desc) && $seopress_social_og_desc !='') {
726
+ echo $seopress_social_og_desc;
727
+ }
728
  }
729
+ if (isset($options['seopress_social_facebook_og'])) {
730
+ $url = '';
731
+ if ( ampforwp_is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true) ){
732
+ $url = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true);
733
+ }
734
+ if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true) ) {
735
+ $url = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true);
736
+ }
737
+ if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true) ) {
738
+ $url = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true);
739
+ }
740
+ if ( '' == $url && has_post_thumbnail() ) {
741
+ $url = get_the_post_thumbnail_url();
742
+ }
743
+ if (function_exists('attachment_url_to_postid')) {
744
+ $image_id = attachment_url_to_postid( $url );
745
+ if ( !$image_id ){
746
+ return;
747
+ }
748
 
749
+ $image_src = wp_get_attachment_image_src( $image_id, 'full' );
750
 
751
+ //OG:IMAGE
752
+ $seopress_social_og_img = '';
753
+ $seopress_social_og_img .= '<meta property="og:image" content="'.esc_url($url).'" />';
754
+ $seopress_social_og_img .= "\n";
755
+
756
+ //OG:IMAGE:SECURE_URL IF SSL
757
+ if (is_ssl()) {
758
+ $seopress_social_og_img .= '<meta property="og:image:secure_url" content="'.esc_url($url).'" />';
759
+ $seopress_social_og_img .= "\n";
760
+ }
761
+
762
+ //OG:IMAGE:WIDTH + OG:IMAGE:HEIGHT
763
+ if (!empty($image_src)) {
764
+ $seopress_social_og_img .= '<meta property="og:image:width" content="'.esc_attr($image_src[1]).'" />';
765
+ $seopress_social_og_img .= "\n";
766
+ $seopress_social_og_img .= '<meta property="og:image:height" content="'.esc_attr($image_src[2]).'" />';
767
+ $seopress_social_og_img .= "\n";
768
+ }
769
+
770
+ //OG:IMAGE:ALT
771
+ if (get_post_meta($image_id, '_wp_attachment_image_alt', true) !='') {
772
+ $seopress_social_og_img .= '<meta property="og:image:alt" content="'.esc_attr(get_post_meta($image_id, '_wp_attachment_image_alt', true)).'" />';
773
+ $seopress_social_og_img .= "\n";
774
+ }
775
+ //Hook on post OG thumbnail - 'seopress_social_og_thumb'
776
+ if (has_filter('seopress_social_og_thumb')) {
777
+ $seopress_social_og_img = apply_filters('seopress_social_og_thumb', $seopress_social_og_img);
778
+ }
779
+ if (isset($seopress_social_og_img) && $seopress_social_og_img !='') {
780
+ echo $seopress_social_og_img;
781
+ }
782
+ }
783
  }
784
+ if (isset($options['seopress_social_facebook_og']) && isset($options['seopress_social_facebook_link_ownership_id'])) {
785
+ $seopress_social_link_ownership_id = '<meta property="fb:pages" content="'.esc_attr($options['seopress_social_facebook_link_ownership_id']).'" />';
786
+ echo $seopress_social_link_ownership_id."\n";
 
787
  }
788
+ if (isset($options['seopress_social_facebook_og']) && isset($options['seopress_social_facebook_link_ownership_id']) ) {
789
+ $seopress_social_admin_id = '<meta property="fb:admins" content="'.esc_attr($options['seopress_social_facebook_admin_id']).'" />';
790
+ echo $seopress_social_admin_id."\n";
 
791
  }
792
+ if (isset($options['seopress_social_facebook_og']) && isset($options['seopress_social_facebook_link_ownership_id']) ) {
793
+ $seopress_social_app_id = '<meta property="fb:app_id" content="'.esc_attr($options['seopress_social_facebook_app_id']).'" />';
794
+ echo $seopress_social_app_id."\n";
795
  }
796
+ if (isset($options['seopress_social_twitter_card'])) {
797
+ if ( isset($options['seopress_social_twitter_card_img_size']) && $options['seopress_social_twitter_card_img_size'] =='large') {
798
+ $seopress_social_twitter_card_summary = '<meta name="twitter:card" content="summary_large_image">';
799
+ } else {
800
+ $seopress_social_twitter_card_summary = '<meta name="twitter:card" content="summary" />';
801
+ }
802
+ //Hook on post Twitter card summary - 'seopress_social_twitter_card_summary'
803
+ if (has_filter('seopress_social_twitter_card_summary')) {
804
+ $seopress_social_twitter_card_summary = apply_filters('seopress_social_twitter_card_summary', $seopress_social_twitter_card_summary);
805
+ }
806
+ echo $seopress_social_twitter_card_summary."\n";
 
 
 
 
 
807
  }
808
+ if (isset($options['seopress_social_twitter_card']) && isset($options['seopress_social_accounts_twitter']) ) {
809
+ $seopress_social_twitter_card_site = '<meta name="twitter:site" content="'.esc_attr($options['seopress_social_accounts_twitter']).'" />';
810
+ //Hook on post Twitter card site - 'seopress_social_twitter_card_site'
811
+ if (has_filter('seopress_social_twitter_card_site')) {
812
+ $seopress_social_twitter_card_site = apply_filters('seopress_social_twitter_card_site', $seopress_social_twitter_card_site);
813
+ }
814
+ echo $seopress_social_twitter_card_site."\n";
815
  }
816
+ if (isset($options['seopress_social_twitter_card'])) {
817
+ //Init
818
+ $seopress_social_twitter_card_creator ='';
819
+ if ($options['seopress_social_twitter_card'] =='1' && get_the_author_meta('twitter') ) {
820
 
821
+ $seopress_social_twitter_card_creator .= '<meta name="twitter:creator" content="@'.esc_attr(get_the_author_meta('twitter')).'" />';
822
+
823
+ } elseif ($options['seopress_social_twitter_card'] =='1' && isset($options['seopress_social_accounts_twitter']) && $options['seopress_social_accounts_twitter'] !='' ) {
824
+ $seopress_social_twitter_card_creator .= '<meta name="twitter:creator" content="'.esc_attr($options['seopress_social_accounts_twitter']).'" />';
825
+ }
826
+ //Hook on post Twitter card creator - 'seopress_social_twitter_card_creator'
827
+ if (has_filter('seopress_social_twitter_card_creator')) {
828
+ $seopress_social_twitter_card_creator = apply_filters('seopress_social_twitter_card_creator', $seopress_social_twitter_card_creator);
829
+ }
830
+ if (isset($seopress_social_twitter_card_creator) && $seopress_social_twitter_card_creator !='') {
831
+ echo $seopress_social_twitter_card_creator."\n";
832
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
833
  }
834
+ if (isset($options['seopress_social_twitter_card'])) {
835
+ $title = $seopress_social_twitter_card_title = '';
836
+ $title = ampforwp_get_seopress_title();
837
+ if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_title',true) ){
838
+ $title = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_title',true);
839
+ }elseif ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true) ){
840
+ $title = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_title',true);
841
+ }
842
+ if ((is_tax() || is_category() || is_tag()) && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_title',true) ) {
843
+ $title = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_title',true);
844
+ }elseif ((is_tax() || is_category() || is_tag()) && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true) ) {
845
+ $title = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_title',true);
846
+ }
847
+ if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_title',true) ){
848
+ $title = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_title',true);
849
+ }elseif ( '' != get_post_meta($post_id,'_seopress_social_fb_title',true) ){
850
+ $title = get_post_meta($post_id,'_seopress_social_fb_title',true);
851
+ }
852
+ if ( '' == $title && '' != get_the_title() ){
853
+ $title = get_the_title();
854
+ }
855
+ $seopress_social_twitter_card_title .= '<meta name="twitter:title" content="'.esc_attr($title).'" />';
856
+ //Hook on post Twitter card title - 'seopress_social_twitter_card_title'
857
+ if (has_filter('seopress_social_twitter_card_title')) {
858
+ $seopress_social_twitter_card_title = apply_filters('seopress_social_twitter_card_title', $seopress_social_twitter_card_title);
859
+ }
860
+ if (isset($seopress_social_twitter_card_title) && $seopress_social_twitter_card_title !='') {
861
+ echo $seopress_social_twitter_card_title."\n";
862
+ }
863
  }
864
+ if (isset($options['seopress_social_twitter_card'])) {
865
+ $seopress_social_twitter_card_desc = $description = '';
866
+ $description = ampforwp_generate_meta_desc();
867
+ if ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_desc',true) ) {
868
+ $description = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_desc',true);
869
+ }elseif ( is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true) ) {
870
+ $description = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_desc',true);
871
+ }
872
+ if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_desc',true) ) {
873
+ $description = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_desc',true);
874
+ }elseif (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true) ) {
875
+ $description = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_desc',true);
876
  }
877
 
878
+ if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_desc',true) ) {
879
+ $description = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_desc',true);
880
+ }elseif ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_desc',true) ) {
881
+ $description = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_desc',true);
882
+ }
883
+ $seopress_social_twitter_card_desc .= '<meta name="twitter:description" content="'.esc_html($description).'" />';
884
+ //Hook on post Twitter card description - 'seopress_social_twitter_card_desc'
885
+ if (has_filter('seopress_social_twitter_card_desc')) {
886
+ $seopress_social_twitter_card_desc = apply_filters('seopress_social_twitter_card_desc', $seopress_social_twitter_card_desc);
887
+ }
888
+ if (isset($seopress_social_twitter_card_desc) && $seopress_social_twitter_card_desc !='') {
889
+ echo $seopress_social_twitter_card_desc."\n";
890
+ }
891
+ }
892
+ if (isset($options['seopress_social_twitter_card'])) {
893
+ $url = '';
894
+ if ( ampforwp_is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_img',true) ){
895
+ $url = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_twitter_img',true);
896
+ }elseif ( ampforwp_is_home() && '' != get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true) ){
897
+ $url = get_post_meta(get_option( 'page_for_posts' ),'_seopress_social_fb_img',true);
898
+ }
899
+ if (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_img',true) ) {
900
+ $url = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_twitter_img',true);
901
+ }elseif (is_tax() || is_category() || is_tag() && '' != get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true) ) {
902
+ $url = get_term_meta(get_queried_object()->{'term_id'},'_seopress_social_fb_img',true);
903
+ }
904
+ if ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_img',true) ) {
905
+ $url = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_twitter_img',true);
906
+ }elseif ( '' != get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true) ) {
907
+ $url = get_post_meta(ampforwp_get_the_ID(),'_seopress_social_fb_img',true);
908
+ }
909
+ if ( '' == $url && has_post_thumbnail() ) {
910
+ $url = get_the_post_thumbnail_url();
911
+ }
912
+ if (function_exists('attachment_url_to_postid')) {
913
+ $image_id = attachment_url_to_postid( $url );
914
+ if ( !$image_id ){
915
+ return;
916
+ }
917
 
918
+ $image_src = wp_get_attachment_image_src( $image_id, 'full' );
 
 
 
919
 
920
+ //OG:IMAGE
921
+ $seopress_twitter_img = '';
922
+ $seopress_twitter_img .= '<meta property="twitter:image" content="'.esc_url($url).'" />';
923
  $seopress_twitter_img .= "\n";
 
924
 
925
+ //OG:IMAGE:SECURE_URL IF SSL
926
+ if (is_ssl()) {
927
+ $seopress_twitter_img .= '<meta property="twitter:image:secure_url" content="'.esc_url($url).'" />';
928
+ $seopress_twitter_img .= "\n";
929
+ }
 
 
930
 
931
+ //OG:IMAGE:WIDTH + OG:IMAGE:HEIGHT
932
+ if (!empty($image_src)) {
933
+ $seopress_twitter_img .= '<meta property="twitter:image:width" content="'.esc_attr($image_src[1]).'" />';
934
+ $seopress_twitter_img .= "\n";
935
+ $seopress_twitter_img .= '<meta property="twitter:image:height" content="'.esc_attr($image_src[2]).'" />';
936
+ $seopress_twitter_img .= "\n";
937
+ }
938
 
939
+ //OG:IMAGE:ALT
940
+ if (get_post_meta($image_id, '_wp_attachment_image_alt', true) !='') {
941
+ $seopress_twitter_img .= '<meta property="twitter:image:alt" content="'.esc_attr(get_post_meta($image_id, '_wp_attachment_image_alt', true)).'" />';
942
+ $seopress_twitter_img .= "\n";
943
+ }
944
+
945
+ //Hook on post OG thumbnail - 'seopress_social_og_thumb'
946
+ if (has_filter('seopress_social_og_thumb')) {
947
+ $seopress_twitter_img = apply_filters('seopress_social_og_thumb', $seopress_twitter_img);
948
+ }
949
+ if (isset($seopress_twitter_img) && $seopress_twitter_img !='') {
950
+ echo $seopress_twitter_img;
951
+ }
952
+ }
953
  }
954
  }
955
  }
987
  return $content;
988
  }
989
  }
990
+
991
+ //Need to AMP compatible with this plugin HTTP / HTTPS Remover #3123
992
+ add_action('wp_loaded','ampforwp_http_remover_support');
993
+ function ampforwp_http_remover_support(){
994
+ if ( class_exists('HTTP_HTTPS_REMOVER')){
995
+ $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH),'/' );
996
+ if (true == ampforwp_get_setting('amp-core-end-point')) {
997
+ $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_QUERY),'/' );
998
+ }
999
+ $explode_path = explode('/', $url_path);
1000
+ if ( AMPFORWP_AMP_QUERY_VAR === end( $explode_path)) {
1001
+ global $http_https_remover;
1002
+ remove_action('wp_loaded', array(
1003
+ $http_https_remover,
1004
+ 'letsGo'
1005
+ ), 99, 1);
1006
+ }
1007
+ }
1008
+ }
includes/vendor/amp/includes/class-amp-content.php CHANGED
@@ -3,6 +3,7 @@ namespace AMPforWP\AMPVendor;
3
  require_once( AMP__VENDOR__DIR__ . '/includes/utils/class-amp-dom-utils.php' );
4
  require_once( AMP__VENDOR__DIR__ . '/includes/sanitizers/class-amp-base-sanitizer.php' );
5
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' );
 
6
 
7
  class AMP_Content {
8
  private $content;
3
  require_once( AMP__VENDOR__DIR__ . '/includes/utils/class-amp-dom-utils.php' );
4
  require_once( AMP__VENDOR__DIR__ . '/includes/sanitizers/class-amp-base-sanitizer.php' );
5
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' );
6
+ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-playlist-embed-handler.php' );
7
 
8
  class AMP_Content {
9
  private $content;
includes/vendor/amp/includes/class-amp-post-template.php CHANGED
@@ -33,6 +33,7 @@ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-soundcloud-embed.
33
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-pinterest-embed.php' );
34
  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
 
37
  class AMP_Post_Template {
38
  const SITE_ICON_SIZE = 32;
@@ -277,6 +278,7 @@ class AMP_Post_Template {
277
  'AMP_Facebook_Embed_Handler' => array(),
278
  'AMP_Pinterest_Embed_Handler' => array(),
279
  'AMP_Gallery_Embed_Handler' => array(),
 
280
  'AMP_Wistia_Embed_Handler' => array(),
281
  ), $this->post ),
282
  apply_filters( 'amp_content_sanitizers', array(
33
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-pinterest-embed.php' );
34
  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;
278
  'AMP_Facebook_Embed_Handler' => array(),
279
  'AMP_Pinterest_Embed_Handler' => array(),
280
  'AMP_Gallery_Embed_Handler' => array(),
281
+ 'AMP_Playlist_Embed_Handler' => array(),
282
  'AMP_Wistia_Embed_Handler' => array(),
283
  ), $this->post ),
284
  apply_filters( 'amp_content_sanitizers', array(
includes/vendor/amp/includes/embeds/class-amp-playlist-embed-handler.php ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace AMPforWP\AMPVendor;
3
+ /**
4
+ * Class AMP_Playlist_Embed_Handler
5
+ *
6
+ * @package AMP
7
+ * @since 0.7
8
+ */
9
+ /**
10
+ * Class AMP_Playlist_Embed_Handler
11
+ *
12
+ * Creates AMP-compatible markup for the WordPress 'playlist' shortcode.
13
+ *
14
+ * @package AMP
15
+ */
16
+ class AMP_Playlist_Embed_Handler extends AMP_Base_Embed_Handler {
17
+ /**
18
+ * The tag of the shortcode.
19
+ *
20
+ * @var string
21
+ */
22
+ const SHORTCODE = 'playlist';
23
+ /**
24
+ * The default height of the thumbnail image for 'audio' playlist tracks.
25
+ *
26
+ * @var int
27
+ */
28
+ const DEFAULT_THUMB_HEIGHT = 64;
29
+ /**
30
+ * The default width of the thumbnail image for 'audio' playlist tracks.
31
+ *
32
+ * @var int
33
+ */
34
+ const DEFAULT_THUMB_WIDTH = 48;
35
+ /**
36
+ * The max width of the audio thumbnail image.
37
+ *
38
+ * This corresponds to the max-width in wp-mediaelement.css:
39
+ * .wp-playlist .wp-playlist-current-item img
40
+ *
41
+ * @var int
42
+ */
43
+ const THUMB_MAX_WIDTH = 60;
44
+ /**
45
+ * The height of the carousel.
46
+ *
47
+ * @var int
48
+ */
49
+ const CAROUSEL_HEIGHT = 250;
50
+ /**
51
+ * The pattern to get the playlist data.
52
+ *
53
+ * @var string
54
+ */
55
+ const PLAYLIST_REGEX = ':<script type="application/json" class="wp-playlist-script">(.+?)</script>:s';
56
+ /**
57
+ * The ID of individual playlist.
58
+ *
59
+ * @var int
60
+ */
61
+ public static $playlist_id = 0;
62
+ /**
63
+ * The removed shortcode callback.
64
+ *
65
+ * @var callable
66
+ */
67
+ public $removed_shortcode_callback;
68
+ /**
69
+ * Registers the playlist shortcode.
70
+ *
71
+ * @global array $shortcode_tags
72
+ * @return void
73
+ */
74
+ public function register_embed() {
75
+ global $shortcode_tags;
76
+ if ( shortcode_exists( self::SHORTCODE ) ) {
77
+ $this->removed_shortcode_callback = $shortcode_tags[ self::SHORTCODE ];
78
+ }
79
+ add_shortcode( self::SHORTCODE, array( $this, 'shortcode' ) );
80
+ remove_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
81
+ }
82
+ /**
83
+ * Unregisters the playlist shortcode.
84
+ *
85
+ * @return void
86
+ */
87
+ public function unregister_embed() {
88
+ if ( $this->removed_shortcode_callback ) {
89
+ add_shortcode( self::SHORTCODE, $this->removed_shortcode_callback );
90
+ $this->removed_shortcode_callback = null;
91
+ }
92
+ add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
93
+ }
94
+ /**
95
+ * Enqueues the playlist styling.
96
+ *
97
+ * @return void
98
+ */
99
+ public function ampforwp_playlist_styles() {
100
+ add_action('amp_post_template_css', array( &$this,'ampforwp_playlist') );
101
+ }
102
+ /**
103
+ * Gets AMP-compliant markup for the playlist shortcode.
104
+ *
105
+ * Uses the JSON that wp_playlist_shortcode() produces.
106
+ * Gets the markup, based on the type of playlist.
107
+ *
108
+ * @param array $attr The playlist attributes.
109
+ * @return string Playlist shortcode markup.
110
+ */
111
+ public function shortcode( $attr ) {
112
+ $data = $this->get_data( $attr );
113
+ if ( isset( $data['type'] ) && ( 'audio' === $data['type'] ) ) {
114
+ return $this->audio_playlist( $data );
115
+ } elseif ( isset( $data['type'] ) && ( 'video' === $data['type'] ) ) {
116
+ return $this->video_playlist( $data );
117
+ }
118
+ }
119
+ /**
120
+ * Gets an AMP-compliant audio playlist.
121
+ *
122
+ * @param array $data Data.
123
+ * @return string Playlist shortcode markup, or an empty string.
124
+ */
125
+ public function audio_playlist( $data ) {
126
+ if ( ! isset( $data['tracks'] ) ) {
127
+ return '';
128
+ }
129
+ self::$playlist_id++;
130
+ $container_id = 'wpPlaylist' . self::$playlist_id . 'Carousel';
131
+ $state_id = 'wpPlaylist' . self::$playlist_id;
132
+ $amp_state = array(
133
+ 'selectedIndex' => 0,
134
+ );
135
+ $this->ampforwp_playlist_styles();
136
+ ob_start();
137
+ ?>
138
+ <div class="wp-playlist wp-audio-playlist wp-playlist-light">
139
+ <amp-state id="<?php echo esc_attr( $state_id ); ?>">
140
+ <script type="application/json"><?php echo wp_json_encode( $amp_state ); ?></script>
141
+ </amp-state>
142
+ <amp-carousel id="<?php echo esc_attr( $container_id ); ?>" [slide]="<?php echo esc_attr( $state_id . '.selectedIndex' ); ?>" height="<?php echo esc_attr( self::CAROUSEL_HEIGHT ); ?>" width="auto" type="slides">
143
+ <?php
144
+ foreach ( $data['tracks'] as $track ) :
145
+ $title = $this->get_title( $track );
146
+ $image_url = isset( $track['thumb']['src'] ) ? $track['thumb']['src'] : '';
147
+ $dimensions = $this->get_thumb_dimensions( $track );
148
+ ?>
149
+ <div>
150
+ <div class="wp-playlist-current-item">
151
+ <?php if ( $image_url ) : ?>
152
+ <amp-img src="<?php echo esc_url( $image_url ); ?>" height="<?php echo esc_attr( $dimensions['height'] ); ?>" width="<?php echo esc_attr( $dimensions['width'] ); ?>"></amp-img>
153
+ <?php endif; ?>
154
+ <div class="wp-playlist-caption">
155
+ <span class="wp-playlist-item-meta wp-playlist-item-title"><?php echo esc_html( $title ); ?></span>
156
+ </div>
157
+ </div><?php
158
+ $track_src = preg_replace('#^https?:#', '', $track['src']);
159
+ ?>
160
+ <amp-audio width="600" height="50" src="<?php echo esc_url( $track_src ); ?>"></amp-audio>
161
+ </div>
162
+ <?php endforeach; ?>
163
+ </amp-carousel>
164
+ <?php $this->print_tracks( $state_id, $data['tracks'] ); ?>
165
+ </div>
166
+ <?php
167
+ return ob_get_clean();
168
+ }
169
+ /**
170
+ * Gets an AMP-compliant video playlist.
171
+ *
172
+ * This uses similar markup to the native playlist shortcode output.
173
+ * So the styles from wp-mediaelement.min.css will apply to it.
174
+ *
175
+ * @global int $content_width
176
+ * @param array $data Data.
177
+ * @return string $video_playlist Markup for the video playlist.
178
+ */
179
+ public function video_playlist( $data ) {
180
+ global $content_width;
181
+ if ( ! isset( $data['tracks'], $data['tracks'][0]['src'] ) ) {
182
+ return '';
183
+ }
184
+ self::$playlist_id++;
185
+ $state_id = 'wpPlaylist' . self::$playlist_id;
186
+ $amp_state = array(
187
+ 'selectedIndex' => 0,
188
+ );
189
+ foreach ( $data['tracks'] as $index => $track ) {
190
+ $amp_state[ $index ] = array(
191
+ 'videoUrl' => $track['src'],
192
+ 'thumb' => isset( $track['thumb']['src'] ) ? $track['thumb']['src'] : '',
193
+ );
194
+ }
195
+ $dimensions = isset( $data['tracks'][0]['dimensions']['resized'] ) ? $data['tracks'][0]['dimensions']['resized'] : null;
196
+ $width = isset( $dimensions['width'] ) ? $dimensions['width'] : $content_width;
197
+ $height = isset( $dimensions['height'] ) ? $dimensions['height'] : null;
198
+ $src_bound = sprintf( '%s[%s.selectedIndex].videoUrl', $state_id, $state_id );
199
+ $this->ampforwp_playlist_styles();
200
+ ob_start();
201
+ ?>
202
+ <div class="wp-playlist wp-video-playlist wp-playlist-light">
203
+ <amp-state id="<?php echo esc_attr( $state_id ); ?>">
204
+ <script type="application/json"><?php echo wp_json_encode( $amp_state ); // WPCS: XSS ok. ?></script>
205
+ </amp-state>
206
+ <amp-video id="amp-video" src="<?php echo esc_url( $data['tracks'][0]['src'] ); ?>" [src]="<?php echo esc_attr( $src_bound ); ?>" width="<?php echo esc_attr( $width ); ?>" height="<?php echo esc_attr( $height ); ?>" controls></amp-video>
207
+ <?php $this->print_tracks( $state_id, $data['tracks'] ); ?>
208
+ </div>
209
+ <?php
210
+ return ob_get_clean(); // WPCS: XSS ok.
211
+ }
212
+ /**
213
+ * Gets the thumbnail image dimensions, including height and width.
214
+ *
215
+ * If the width is higher than the maximum width,
216
+ * reduces it to the maximum width.
217
+ * And it proportionally reduces the height.
218
+ *
219
+ * @param array $track The data for the track.
220
+ * @return array {
221
+ * Dimensions.
222
+ *
223
+ * @type int $height Image height.
224
+ * @type int $width Image width.
225
+ * }
226
+ */
227
+ public function get_thumb_dimensions( $track ) {
228
+ $original_height = isset( $track['thumb']['height'] ) ? intval( $track['thumb']['height'] ) : self::DEFAULT_THUMB_HEIGHT;
229
+ $original_width = isset( $track['thumb']['width'] ) ? intval( $track['thumb']['width'] ) : self::DEFAULT_THUMB_WIDTH;
230
+ if ( $original_width > self::THUMB_MAX_WIDTH ) {
231
+ $ratio = $original_width / self::THUMB_MAX_WIDTH;
232
+ $height = intval( $original_height / $ratio );
233
+ } else {
234
+ $height = $original_height;
235
+ }
236
+ $width = min( self::THUMB_MAX_WIDTH, $original_width );
237
+ return compact( 'height', 'width' );
238
+ }
239
+ /**
240
+ * Outputs the playlist tracks, based on the type of playlist.
241
+ *
242
+ * These typically appear below the player.
243
+ * Clicking a track triggers the player to appear with its src.
244
+ *
245
+ * @param string $state_id The ID of the container.
246
+ * @param array $tracks Tracks.
247
+ * @return void
248
+ */
249
+ public function print_tracks( $state_id, $tracks ) {
250
+ ?>
251
+ <div class="wp-playlist-tracks">
252
+ <?php foreach ( $tracks as $index => $track ) : ?>
253
+ <?php
254
+ $on = 'tap:AMP.setState(' . wp_json_encode( array( $state_id => array( 'selectedIndex' => $index ) ) ) . ')';
255
+ $initial_class = 0 === $index ? 'wp-playlist-item wp-playlist-playing' : 'wp-playlist-item';
256
+ $bound_class = sprintf( '%d == %s.selectedIndex ? "wp-playlist-item wp-playlist-playing" : "wp-playlist-item"', $index, $state_id );
257
+ ?>
258
+ <div class="<?php echo esc_attr( $initial_class ); ?>" [class]="<?php echo esc_attr( $bound_class ); ?>" >
259
+ <a class="wp-playlist-caption" on="<?php echo esc_attr( $on ); ?>">
260
+ <?php echo esc_html( strval( $index + 1 ) . '.' ); ?> <span class="wp-playlist-item-title"><?php echo esc_html( $this->get_title( $track ) ); ?></span>
261
+ </a>
262
+ <?php if ( isset( $track['meta']['length_formatted'] ) ) : ?>
263
+ <div class="wp-playlist-item-length"><?php echo esc_html( $track['meta']['length_formatted'] ); ?></div>
264
+ <?php endif; ?>
265
+ </div>
266
+ <?php endforeach; ?>
267
+ </div>
268
+ <?php
269
+ }
270
+ /**
271
+ * Gets the data for the playlist.
272
+ *
273
+ * @see wp_playlist_shortcode()
274
+ * @param array $attr The shortcode attributes.
275
+ * @return array $data The data for the playlist.
276
+ */
277
+ public function get_data( $attr ) {
278
+ $markup = wp_playlist_shortcode( $attr );
279
+ preg_match( self::PLAYLIST_REGEX, $markup, $matches );
280
+ if ( empty( $matches[1] ) ) {
281
+ return array();
282
+ }
283
+ return json_decode( $matches[1], true );
284
+ }
285
+ /**
286
+ * Gets the title for the track.
287
+ *
288
+ * @param array $track The track data.
289
+ * @return string $title The title of the track.
290
+ */
291
+ public function get_title( $track ) {
292
+ if ( ! empty( $track['caption'] ) ) {
293
+ return $track['caption'];
294
+ } elseif ( ! empty( $track['title'] ) ) {
295
+ return $track['title'];
296
+ }
297
+ return '';
298
+ }
299
+ function ampforwp_playlist(){ ?>
300
+ .amp-carousel-slide .wp-playlist-current-item{display: grid;grid-template-columns: 50px 1fr;align-items: center;margin-bottom: 20px;grid-gap: 0px 20px;}
301
+ .amp-carousel-slide{background: #ccc;padding: 10px;border-radius: 3px;box-sizing: border-box;display: inline-grid;}
302
+ .wp-playlist-tracks{background: #f1f1f1;width: 100%;margin-top: 10px;padding: 30px;margin-bottom:20px;box-sizing: border-box;}
303
+ .wp-playlist-item{margin-bottom:15px;font-size: 16px;line-height: 1.4;}
304
+ .wp-playlist-item a{color:#333;}
305
+ .amp-carousel-slide amp-audio audio{width:100%;}
306
+ .wp-playlist-caption{cursor: pointer;}
307
+ .wp-playlist-item.wp-playlist-playing, .wp-playlist-item.wp-playlist-playing a{color:#00b900;}
308
+ .amp-carousel-slide amp-audio{margin:0 auto;display:block;}
309
+ @media(max-width:767px){
310
+ .amp-carousel-slide amp-audio{max-width:300px}
311
+ }
312
+ @media(max-width:500px){
313
+ .wp-playlist-tracks {padding:20px;}
314
+ }
315
+ @media(max-width:400px){
316
+ .amp-carousel-slide amp-audio{max-width:240px}
317
+ }
318
+ <?php
319
+ }
320
+ }
includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php CHANGED
@@ -104,9 +104,12 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
104
  }
105
  }
106
  $parent_node = $element->parentNode;
107
- $parent_node->removeChild( $element );
108
 
109
- if ( 'body' !== $parent_node->nodeName && AMP_DOM_Utils::is_node_empty( $parent_node ) ) {
 
 
 
110
  $parent_node->parentNode->removeChild( $parent_node );
111
  }
112
  }
@@ -149,7 +152,9 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
149
  if ( empty( $href ) ) {
150
  $name_attr = $node->getAttribute( 'name' );
151
  $id_attr = $node->getAttribute( 'id' );
152
- if ( ! empty( $id_attr ) || ! empty( $name_attr ) ) {
 
 
153
  // No further validation is required
154
  return true;
155
  } else {
104
  }
105
  }
106
  $parent_node = $element->parentNode;
107
+ $allowed_tags = AMP_Allowed_Tags_Generated::get_allowed_tags();
108
 
109
+ if( $parent_node->tagName != 'amp-state'){
110
+ $parent_node->removeChild( $element );
111
+ }
112
+ if ( 'body' !== $parent_node->nodeName && AMP_DOM_Utils::is_node_empty( $parent_node ) ) {
113
  $parent_node->parentNode->removeChild( $parent_node );
114
  }
115
  }
152
  if ( empty( $href ) ) {
153
  $name_attr = $node->getAttribute( 'name' );
154
  $id_attr = $node->getAttribute( 'id' );
155
+ $class = $node->getAttribute( 'class' );
156
+ $on = $node->getAttribute( 'on' );
157
+ if ( ! empty( $name_attr ) || ! empty( $id_attr ) || ! empty( $class ) || ! empty( $on ) ) {
158
  // No further validation is required
159
  return true;
160
  } else {
pagebuilder/inc/viewShowFrontData.php CHANGED
@@ -755,6 +755,7 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
755
  array($imageWidth, $imageWidth),
756
  $repeaterFrontTemplate
757
  );
 
758
  $repeaterFrontTemplate = str_replace(
759
  array('{{image_height}}',
760
  '{{image_height_'.$moduleField['name'].'}}'
@@ -764,6 +765,7 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
764
  ),
765
  $repeaterFrontTemplate
766
  );
 
767
  $repeaterFrontTemplate = str_replace(
768
  array('{{image_alt}}',
769
  '{{image_alt_'.$moduleField['name'].'}}'
@@ -773,6 +775,7 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
773
  ),
774
  $repeaterFrontTemplate
775
  );
 
776
  $repeaterFrontTemplate = str_replace(
777
  array('{{image_caption}}',
778
  '{{image_caption_'.$moduleField['name'].'}}'
@@ -782,6 +785,7 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
782
  ),
783
  $repeaterFrontTemplate
784
  );
 
785
  $repeaterFrontTemplate = ampforwp_replaceIfContentConditional($moduleField['name'], $imageUrl, $repeaterFrontTemplate);
786
  }else{
787
  if($moduleField['type']=="text"){
@@ -964,11 +968,13 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
964
  array($imageWidth,$imageWidth),
965
  $moduleFrontHtml
966
  );
 
967
  $moduleFrontHtml = str_replace(
968
  array('{{image_height}}','{{image_height_'.$field['name'].'}}'),
969
  array($imageHeight,$imageHeight),
970
  $moduleFrontHtml
971
  );
 
972
  $moduleFrontHtml = str_replace(
973
  array('{{image_alt}}',
974
  '{{image_alt_'.$field['name'].'}}'
@@ -978,6 +984,7 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
978
  ),
979
  $moduleFrontHtml
980
  );
 
981
  $moduleFrontHtml = str_replace(
982
  array('{{image_caption}}',
983
  '{{image_caption_'.$field['name'].'}}'
@@ -987,6 +994,7 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
987
  ),
988
  $moduleFrontHtml
989
  );
 
990
  $moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], $imageUrl, $moduleFrontHtml);
991
  }else{
992
  $moduleFrontHtml = str_replace('{{'.$field['name'].'}}', esc_html( $replace), $moduleFrontHtml);
755
  array($imageWidth, $imageWidth),
756
  $repeaterFrontTemplate
757
  );
758
+ $repeaterFrontTemplate = ampforwp_replaceIfContentConditional('image_width', $imageWidth, $repeaterFrontTemplate);
759
  $repeaterFrontTemplate = str_replace(
760
  array('{{image_height}}',
761
  '{{image_height_'.$moduleField['name'].'}}'
765
  ),
766
  $repeaterFrontTemplate
767
  );
768
+ $repeaterFrontTemplate = ampforwp_replaceIfContentConditional('image_height', $imageHeight, $repeaterFrontTemplate);
769
  $repeaterFrontTemplate = str_replace(
770
  array('{{image_alt}}',
771
  '{{image_alt_'.$moduleField['name'].'}}'
775
  ),
776
  $repeaterFrontTemplate
777
  );
778
+ $repeaterFrontTemplate = ampforwp_replaceIfContentConditional('image_alt', $image_alt, $repeaterFrontTemplate);
779
  $repeaterFrontTemplate = str_replace(
780
  array('{{image_caption}}',
781
  '{{image_caption_'.$moduleField['name'].'}}'
785
  ),
786
  $repeaterFrontTemplate
787
  );
788
+ $repeaterFrontTemplate = ampforwp_replaceIfContentConditional('image_caption', $image_caption, $repeaterFrontTemplate);
789
  $repeaterFrontTemplate = ampforwp_replaceIfContentConditional($moduleField['name'], $imageUrl, $repeaterFrontTemplate);
790
  }else{
791
  if($moduleField['type']=="text"){
968
  array($imageWidth,$imageWidth),
969
  $moduleFrontHtml
970
  );
971
+ $moduleFrontHtml = ampforwp_replaceIfContentConditional('image_width', $imageWidth, $moduleFrontHtml);
972
  $moduleFrontHtml = str_replace(
973
  array('{{image_height}}','{{image_height_'.$field['name'].'}}'),
974
  array($imageHeight,$imageHeight),
975
  $moduleFrontHtml
976
  );
977
+ $moduleFrontHtml = ampforwp_replaceIfContentConditional('image_height', $imageHeight, $moduleFrontHtml);
978
  $moduleFrontHtml = str_replace(
979
  array('{{image_alt}}',
980
  '{{image_alt_'.$field['name'].'}}'
984
  ),
985
  $moduleFrontHtml
986
  );
987
+ $moduleFrontHtml = ampforwp_replaceIfContentConditional('image_alt', $image_alt, $moduleFrontHtml);
988
  $moduleFrontHtml = str_replace(
989
  array('{{image_caption}}',
990
  '{{image_caption_'.$field['name'].'}}'
994
  ),
995
  $moduleFrontHtml
996
  );
997
+ $moduleFrontHtml = ampforwp_replaceIfContentConditional('image_caption', $image_caption, $moduleFrontHtml);
998
  $moduleFrontHtml = ampforwp_replaceIfContentConditional($field['name'], $imageUrl, $moduleFrontHtml);
999
  }else{
1000
  $moduleFrontHtml = str_replace('{{'.$field['name'].'}}', esc_html( $replace), $moduleFrontHtml);
pagebuilder/modules/slider-mod-module.php CHANGED
@@ -93,6 +93,7 @@ return array(
93
  'type' =>'checkbox',
94
  'name' =>"image_layout",
95
  'tab' =>'customizer',
 
96
  'default' =>array('responsive'),
97
  'options' =>array(
98
  array(
@@ -106,15 +107,30 @@ return array(
106
  'type' =>'checkbox_bool',
107
  'name' =>"lightbox_gallery",
108
  'tab' =>'customizer',
 
109
  'default' =>0,
110
  'options' =>array(
111
  array(
112
- 'label'=>esc_html__('Lightbox','accelerated-mobile-pages'),
113
  'value'=>1,
114
  ),
115
  ),
116
  'content_type'=>'html',
117
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  array(
119
  'type' =>'select',
120
  'name' =>'align_type',
@@ -200,13 +216,36 @@ return array(
200
  'default' =>'',
201
  'content_type'=>'html',
202
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
 
205
  ),
206
  'front_template'=>
207
  array(
208
  "image"=>'
209
- {{if_img_upload}}<figure><amp-img src="{{img_upload}}" width="{{image_width}}" height="{{image_height}}" {{if_image_layout}}layout="{{image_layout}}"{{ifend_image_layout}} alt="{{image_alt}}"></amp-img><figcaption>{{image_caption}}</figcaption></figure>{{ifend_img_upload}}
 
210
  ',
211
  "button"=>'<button on="tap:carousel-with-preview-{{unique_cell_id}}.goToSlide(index={{repeater_unique}})">
212
  {{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}}
93
  'type' =>'checkbox',
94
  'name' =>"image_layout",
95
  'tab' =>'customizer',
96
+ 'label' =>'Responsive',
97
  'default' =>array('responsive'),
98
  'options' =>array(
99
  array(
107
  'type' =>'checkbox_bool',
108
  'name' =>"lightbox_gallery",
109
  'tab' =>'customizer',
110
+ 'label' =>'Lightbox',
111
  'default' =>0,
112
  'options' =>array(
113
  array(
114
+ 'label'=>esc_html__('Make a Lightbox for Images','accelerated-mobile-pages'),
115
  'value'=>1,
116
  ),
117
  ),
118
  'content_type'=>'html',
119
  ),
120
+ array(
121
+ 'type' =>'checkbox_bool',
122
+ 'name' =>"img_hyperlink",
123
+ 'label' =>'Hyperlink',
124
+ 'tab' =>'customizer',
125
+ 'default' =>0,
126
+ 'content_type'=>'html',
127
+ 'options' =>array(
128
+ array(
129
+ 'label'=>'Make an Hyperlink on Images',
130
+ 'value'=>1,
131
+ ),
132
+ ),
133
+ ),
134
  array(
135
  'type' =>'select',
136
  'name' =>'align_type',
216
  'default' =>'',
217
  'content_type'=>'html',
218
  ),
219
+ array(
220
+ 'type' =>'text',
221
+ 'name' =>"hyperlink_link_img",
222
+ 'label' =>'URL',
223
+ 'tab' =>'customizer',
224
+ 'default' =>'#',
225
+ 'content_type'=>'html',
226
+ 'required' => array('img_hyperlink'=>1),
227
+ ),
228
+ array(
229
+ 'type' =>'select',
230
+ 'name' =>'img_link_open',
231
+ 'label' =>"Open link in",
232
+ 'tab' =>'customizer',
233
+ 'default' =>'new_page',
234
+ 'options_details'=>array(
235
+ 'new_page' =>'New tab',
236
+ 'same_page' =>'Same page'
237
+ ),
238
+ 'content_type'=>'html',
239
+ 'required' => array('img_hyperlink'=>'1'),
240
+ ),
241
 
242
 
243
  ),
244
  'front_template'=>
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}}
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.1
7
- Stable tag: 0.9.97.56
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,6 +190,34 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  = 0.9.97.56 (29th May 2019) =
194
  * Fixed: #3214 fix was causing conflict with AMP Layouts and content was getting blank
195
 
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.1
7
+ Stable tag: 0.9.97.57
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  == Changelog ==
192
 
193
+ = 0.9.97.57 (31st May 2019) =
194
+ * Improvements: Need to add description field in VideoObject Schema type #2846
195
+ * Improvements: Create an option for H1-H6 Heading Font Sizes for all the designs. #3035
196
+ * Improvements: Need to AMP compatible with this plugin HTTP / HTTPS Remover #3123
197
+ * Improvements: Due to Enable image replacement option in optimole plugin images get removed in AMP #3073
198
+ * Improvements: Author name not comes in AMP due to "Simple Author Box" plugin #3145
199
+ * Improvements: Need hyperlink option on the slider module image #2932
200
+ * Improvements: Need another menu for alternative menu which separate from main menu #2916
201
+ * Improvements: Audio Playlist Support #2437
202
+ * Improvements: Separate option to enable/disable Tags support im AMP #3016
203
+ * Fixed: Controls under swift design should display when selected design is AMP theme framework #2939
204
+ * Fixed: AMP Blurb Module shows code on frontend #3228
205
+ * Fixed: Need to Use Ajax to fetch all Categories and tags in Featured Slider in D3 #2590
206
+ * Fixed: copy the content stop working #3193
207
+ * Fixed: mandatory tag 'link rel=canonical' is missing or incorrect on Homepage- when RankMath is active #3250
208
+ * Fixed: Uncaught Error: Call to undefined function ampforwp_get_frontpage_id() #3242
209
+ * Fixed: Liststyle (Circle) added beside Published by in Design3 in 0.9.97.53 #3222
210
+ * Fixed: Version 0.9.97.52 Yoast Meta Information not being picked up #3207
211
+ * Fixed: When navigation menu option is disabled then amp menu checkbox should be removed from menu appearance. #2548
212
+ * Fixed: Needs to re-write function ampforwp_add_custom_rewrite_rules to improve performace #2924
213
+ * Fixed: amp-next-page script of infinity scroll shouldn't load on other custom post type pages #3157
214
+ * Fixed: Archive and Tag pages generating incorrect AMP HTML #3170
215
+ * Fixed: Images are appearing twice #3186
216
+ * Fixed: Debug error on Homepage #3135
217
+ * Fixed: Font JavaScript is loading everywhere in console and breaking things in dashboard #3133
218
+ * Fixed: Rewrite ampforwp_view_nonamp function to make it future proof #2710
219
+ * Fixed: if there's and apostrophe in the post title, it is published as random characters In twitter #2744
220
+
221
  = 0.9.97.56 (29th May 2019) =
222
  * Fixed: #3214 fix was causing conflict with AMP Layouts and content was getting blank
223
 
templates/custom-amp-content-button.js CHANGED
@@ -13,8 +13,15 @@
13
  editor.insertContent(document.getElementById('content').value());
14
  }
15
  }else if(wp.data){
16
- var editedContent = wp.data.select( "core/editor" ).getEditedPostContent();
17
- editor.insertContent(editedContent);
 
 
 
 
 
 
 
18
  }
19
  }
20
  });
13
  editor.insertContent(document.getElementById('content').value());
14
  }
15
  }else if(wp.data){
16
+ if ( wp.data.select( "core/editor" ) != undefined && typeof wp.data.select( "core/editor" ).getEditedPostContent() != undefined ) {
17
+ var editedContent = wp.data.select( "core/editor" ).getEditedPostContent();
18
+ editor.insertContent(editedContent);
19
+ }
20
+ else if( tinymce.editors.content && typeof tinymce.editors.content.getContent()!= undefined){
21
+ editor.insertContent(tinymce.editors.content.getContent());
22
+ }else{
23
+ editor.insertContent(document.getElementById('content').value());
24
+ }
25
  }
26
  }
27
  });
templates/custom-amp-content.php CHANGED
@@ -52,6 +52,7 @@ function ampforwp_custom_post_content_sanitizer( $data, $post ) {
52
  'AMP_Facebook_Embed_Handler' => array(),
53
  'AMP_Pinterest_Embed_Handler' => array(),
54
  'AMP_Gallery_Embed_Handler' => array(),
 
55
  ) ),
56
  apply_filters( 'amp_content_sanitizers', array(
57
  'AMP_Style_Sanitizer' => array(),
52
  'AMP_Facebook_Embed_Handler' => array(),
53
  'AMP_Pinterest_Embed_Handler' => array(),
54
  'AMP_Gallery_Embed_Handler' => array(),
55
+ 'AMP_Playlist_Embed_Handler' => array(),
56
  ) ),
57
  apply_filters( 'amp_content_sanitizers', array(
58
  'AMP_Style_Sanitizer' => array(),
templates/custom-sanitizer.php CHANGED
@@ -8,6 +8,7 @@ if ( ! defined( 'ABSPATH' ) ) {
8
  require_once( AMP__VENDOR__DIR__ . '/includes/utils/class-amp-dom-utils.php' );
9
  require_once( AMP__VENDOR__DIR__ . '/includes/sanitizers/class-amp-base-sanitizer.php' );
10
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' );
 
11
 
12
  class AMPFORWP_Content {
13
  private $content;
8
  require_once( AMP__VENDOR__DIR__ . '/includes/utils/class-amp-dom-utils.php' );
9
  require_once( AMP__VENDOR__DIR__ . '/includes/sanitizers/class-amp-base-sanitizer.php' );
10
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' );
11
+ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-playlist-embed-handler.php' );
12
 
13
  class AMPFORWP_Content {
14
  private $content;
templates/design-manager/design-1/style.php CHANGED
@@ -126,7 +126,7 @@ blockquote {color: <?php echo sanitize_hex_color( $text_color ); ?>;background:
126
 
127
 
128
  .comments_list ul li p{margin:0;font-size:14px;clear:both;padding-top:5px; word-break:break-word;}
129
- .comments_list ul li{font-family:sans-serif;font-size:11px;list-style-type:none;margin-bottom:12px;background:#fefefe;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:0 2px 3px rgba(0,0,0,.05);-webkit-box-shadow:0 2px 3px rgba(0,0,0,.05);box-shadow:0 2px 3px rgba(0,0,0,.05);padding:0;max-width:1000px;width:96%}.comments_list ul li .says{margin-right:4px}.comments_list li li,.comments_list li li li{margin:20px 20px 10px}.comments_list ul li p{font-family:Merriweather,'Times New Roman',Times,Serif}.comments_list ul li .comment-body{padding:10px 0 15px}.comment-author{float:left}.single-post footer.comment-meta{padding-bottom:0; line-height: 1.9;}.comments_list li li{background:#f7f7f7;box-shadow:none;border:1px solid #eee} .page-numbers{ padding: 9px 10px; background: #fff; font-size: 14px; } .comment-author-img{float: left; margin-right: 5px; border-radius: 60px;} .comment-content amp-img{max-width: 300px;}<?php } ?>amp-sidebar{width:250px}.amp-sidebar-image{line-height:100px;vertical-align:middle}.amp-close-image{top:15px;left:225px;cursor:pointer}.toggle-navigationv2 ul{list-style-type:none;margin:0;font-family:sans-serif;padding:0}.toggle-navigationv2 ul ul li a{padding-left:35px;background:#fff;display:inline-block}.toggle-navigationv2 ul li a{padding:10px 15px 10px 25px;width:88%;text-decoration:none;background:#fafafa;font-size:13px;border-bottom:1px solid #efefef}.close-nav{font-size:12px;font-family:sans-serif;background:rgba(0,0,0,.25);letter-spacing:1px;padding:10px;border-radius:100px;line-height:8px;margin:14px;left:191px;color:#fff}.close-nav:hover{background:rgba(0,0,0,.45)}.toggle-navigation ul{list-style-type:none;margin:0;padding:0;width:100%}.menu-all-pages-container:after{content:"";clear:both}.toggle-navigation ul li{font-size:13px;border-bottom:1px solid rgba(0,0,0,.11);padding:11px 0;width:25%;float:left;text-align:center;margin-top:6px}.toggle-navigation ul ul{display:none}.toggle-navigation ul li a{color:#eee;padding:15px}.toggle-navigation{display:none;background:#444}.nav_container:hover+.toggle-navigation,.toggle-navigation:active,.toggle-navigation:focus,.toggle-navigation:hover{display:inline-block;width:100%}#amp-user-notification1 p{display:inline-block}amp-user-notification{padding:5px;text-align:center;background:#fff;border-top:1px solid} amp-user-notification button {padding: 8px 10px;background: <?php echo sanitize_hex_color( $header_background_color ); ?>;color: <?php echo sanitize_hex_color( $header_color ); ?>;margin-left: 5px;border: 0;}.amp-not-privacy{color:<?php echo sanitize_hex_color( $header_background_color ); ?>;text-decoration: none;font-size: 15px;}amp-user-notification button:hover {cursor: pointer} .amp-ad-wrapper {text-align: center} <?php if( $redux_builder_amp['enable-single-social-icons'] == true && is_single() ) { ?>body {padding-bottom: 43px;}<?php } ?> .sticky_social a{text-decoration:none}.sticky_social{width:100%;bottom:0;display:block;left:0;box-shadow:0 4px 7px #000;background:#fff;padding:7px 0 0;position:fixed;margin:0;z-index:10;text-align:center}.whatsapp-share-icon{width:50px;height:28px;display:inline-block;background:#5cbe4a;padding:4px 0;position:relative;top:-4px}.amp-wp-tax-category span:first-child:after{content:' '}.amp-wp-tax-category span:after,.amp-wp-tax-tag span:after{content:', '}.amp-wp-tax-category span:last-child:after,.amp-wp-tax-tag span:last-child:after{content:' '}pre{white-space:pre-wrap}.amp-ad-wrapper.amp_ad_1{padding-top:20px}
130
  .amp-wp-content-loop{width:100%}
131
  .amp-wp-content-loop ul{margin:0}
132
  .ampforwp_single_excerpt { margin-bottom:15px; }
@@ -462,4 +462,38 @@ if(is_singular() || ampforwp_is_front_page()){?>
462
  max-width:50%;
463
  margin: 0px 10px;
464
  }
465
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
 
128
  .comments_list ul li p{margin:0;font-size:14px;clear:both;padding-top:5px; word-break:break-word;}
129
+ .comments_list ul li{font-family:sans-serif;font-size:11px;list-style-type:none;margin-bottom:12px;background:#fefefe;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-moz-box-shadow:0 2px 3px rgba(0,0,0,.05);-webkit-box-shadow:0 2px 3px rgba(0,0,0,.05);box-shadow:0 2px 3px rgba(0,0,0,.05);padding:0;max-width:1000px;width:96%}.comments_list ul li .says{margin-right:4px}.comments_list li li,.comments_list li li li{margin:20px 20px 10px}.comments_list ul li p{font-family:Merriweather,'Times New Roman',Times,Serif}.comments_list ul li .comment-body{padding:10px 0 15px}.comment-author{float:left}.single-post footer.comment-meta{padding-bottom:0; line-height: 1.9;}.comments_list li li{background:#f7f7f7;box-shadow:none;border:1px solid #eee} .page-numbers{ padding: 9px 10px; background: #fff; font-size: 14px; } .comment-author-img{float: left; margin-right: 5px; border-radius: 60px;} .comment-content amp-img{max-width: 300px;}<?php } ?>amp-sidebar{width:250px}.amp-sidebar-image{line-height:100px;vertical-align:middle}.amp-close-image{top:15px;left:225px;cursor:pointer}.toggle-navigationv2 ul{list-style-type:none;margin:0;font-family:sans-serif;padding:0}.toggle-navigationv2 ul ul li a{padding-left:35px;background:#fff;display:inline-block}.toggle-navigationv2 ul li a{padding:10px 15px 10px 25px;width:100%;text-decoration:none;background:#fafafa;font-size:13px;border-bottom:1px solid #efefef}.close-nav{font-size:12px;font-family:sans-serif;background:rgba(0,0,0,.25);letter-spacing:1px;padding:10px;border-radius:100px;line-height:8px;margin:14px;left:191px;color:#fff}.close-nav:hover{background:rgba(0,0,0,.45)}.toggle-navigation ul{list-style-type:none;margin:0;padding:0;width:100%}.menu-all-pages-container:after{content:"";clear:both}.toggle-navigation ul li{font-size:13px;border-bottom:1px solid rgba(0,0,0,.11);padding:11px 0;width:25%;float:left;text-align:center;margin-top:6px}.toggle-navigation ul ul{display:none}.toggle-navigation ul li a{color:#eee;padding:15px}.toggle-navigation{display:none;background:#444}.nav_container:hover+.toggle-navigation,.toggle-navigation:active,.toggle-navigation:focus,.toggle-navigation:hover{display:inline-block;width:100%}#amp-user-notification1 p{display:inline-block}amp-user-notification{padding:5px;text-align:center;background:#fff;border-top:1px solid} amp-user-notification button {padding: 8px 10px;background: <?php echo sanitize_hex_color( $header_background_color ); ?>;color: <?php echo sanitize_hex_color( $header_color ); ?>;margin-left: 5px;border: 0;}.amp-not-privacy{color:<?php echo sanitize_hex_color( $header_background_color ); ?>;text-decoration: none;font-size: 15px;}amp-user-notification button:hover {cursor: pointer} .amp-ad-wrapper {text-align: center} <?php if( $redux_builder_amp['enable-single-social-icons'] == true && is_single() ) { ?>body {padding-bottom: 43px;}<?php } ?> .sticky_social a{text-decoration:none}.sticky_social{width:100%;bottom:0;display:block;left:0;box-shadow:0 4px 7px #000;background:#fff;padding:7px 0 0;position:fixed;margin:0;z-index:10;text-align:center}.whatsapp-share-icon{width:50px;height:28px;display:inline-block;background:#5cbe4a;padding:4px 0;position:relative;top:-4px}.amp-wp-tax-category span:first-child:after{content:' '}.amp-wp-tax-category span:after,.amp-wp-tax-tag span:after{content:', '}.amp-wp-tax-category span:last-child:after,.amp-wp-tax-tag span:last-child:after{content:' '}pre{white-space:pre-wrap}.amp-ad-wrapper.amp_ad_1{padding-top:20px}
130
  .amp-wp-content-loop{width:100%}
131
  .amp-wp-content-loop ul{margin:0}
132
  .ampforwp_single_excerpt { margin-bottom:15px; }
462
  max-width:50%;
463
  margin: 0px 10px;
464
  }
465
+ }
466
+ /*** H-1 to H-6 Font Sizes ***/
467
+ .amp-wp-content h1, .amp-wp-content h2, .amp-wp-content h3, .amp-wp-content h4, .amp-wp-content h5, .amp-wp-content h6{margin: 15px 0px;line-height: 1.4;}
468
+ <?php // H1 - H6 Font Sizes
469
+ if( ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h1') ){ ?>
470
+ .amp-wp-content h1{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h1_sz') )?>;}
471
+ <?php } else { ?>
472
+ .amp-wp-content h1 {font-size: 32px;}
473
+ <?php } //H1 ends
474
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h2') ){ ?>
475
+ .amp-wp-content h2{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h2_sz') )?>;}
476
+ <?php } else { ?>
477
+ .amp-wp-content h2 {font-size: 27px;}
478
+ <?php } // H2 Ends
479
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h3') ){ ?>
480
+ .amp-wp-content h3{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h3_sz') )?>;}
481
+ <?php } else { ?>
482
+ .amp-wp-content h3 {font-size: 24px;}
483
+ <?php } // H3 Ends
484
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h4') ){ ?>
485
+ .amp-wp-content h4{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h4_sz') )?>;}
486
+ <?php } else { ?>
487
+ .amp-wp-content h4 {font-size: 20px;}
488
+ <?php } // H4 Ends
489
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h5') ){ ?>
490
+ .amp-wp-content h5{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h5_sz') )?>;}
491
+ <?php } else { ?>
492
+ .amp-wp-content h5 {font-size: 17px;}
493
+ <?php } // H5 Ends
494
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h6') ){ ?>
495
+ .amp-wp-content h6{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h6_sz') )?>;}
496
+ <?php } else { ?>
497
+ .amp-wp-content h6 {font-size: 15px;}
498
+ <?php } // H6 Ends
499
+ // swift Content Heading Sizes Ends?>
templates/design-manager/design-2/style.php CHANGED
@@ -598,4 +598,38 @@ if(is_singular() || ampforwp_is_front_page()){?>
598
  max-width:50%;
599
  margin: 0px 10px;
600
  }
601
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
598
  max-width:50%;
599
  margin: 0px 10px;
600
  }
601
+ }
602
+ /*** H-1 to H-6 Font Sizes ***/
603
+ .amp-wp-content h1, .amp-wp-content h2, .amp-wp-content h3, .amp-wp-content h4, .amp-wp-content h5, .amp-wp-content h6{margin: 15px 0px;}
604
+ <?php // H1 - H6 Font Sizes
605
+ if( ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h1') ){ ?>
606
+ .amp-wp-content h1{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h1_sz') )?>;}
607
+ <?php } else { ?>
608
+ .amp-wp-content h1 {font-size: 32px;}
609
+ <?php } //H1 ends
610
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h2') ){ ?>
611
+ .amp-wp-content h2{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h2_sz') )?>;}
612
+ <?php } else { ?>
613
+ .amp-wp-content h2 {font-size: 27px;}
614
+ <?php } // H2 Ends
615
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h3') ){ ?>
616
+ .amp-wp-content h3{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h3_sz') )?>;}
617
+ <?php } else { ?>
618
+ .amp-wp-content h3 {font-size: 24px;}
619
+ <?php } // H3 Ends
620
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h4') ){ ?>
621
+ .amp-wp-content h4{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h4_sz') )?>;}
622
+ <?php } else { ?>
623
+ .amp-wp-content h4 {font-size: 20px;}
624
+ <?php } // H4 Ends
625
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h5') ){ ?>
626
+ .amp-wp-content h5{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h5_sz') )?>;}
627
+ <?php } else { ?>
628
+ .amp-wp-content h5 {font-size: 17px;}
629
+ <?php } // H5 Ends
630
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h6') ){ ?>
631
+ .amp-wp-content h6{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h6_sz') )?>;}
632
+ <?php } else { ?>
633
+ .amp-wp-content h6 {font-size: 15px;}
634
+ <?php } // H6 Ends
635
+ // swift Content Heading Sizes Ends?>
templates/design-manager/design-3/style.php CHANGED
@@ -84,7 +84,7 @@ amp-sidebar{ width: 280px; background: #131313; font-family: 'Roboto Slab', seri
84
  .amp-close-image{ top: 15px; left: 225px; cursor: pointer; }
85
  .navigation_heading{ padding: 20px 20px 15px 20px; color: #aaa; font-size: 10px; font-family: sans-serif; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #555; display: inline-block; width: 100%}
86
  .toggle-navigationv2 ul{ list-style-type: none; margin: 15px 0 0 0; padding: 0}
87
- .toggle-navigationv2 ul.amp-menu li a{ padding: 10px 15px 10px 20px; display: inline-block; font-size: 14px; color:#eee; width:94% }
88
  .amp-menu li{position:relative}
89
  .toggle-navigationv2 ul.amp-menu li a:hover{background:#666;color:#fff}
90
  .amp-menu li.menu-item-has-children ul{display:none;margin:0;background:#666;position:relative;
@@ -156,6 +156,7 @@ header{ padding-bottom:50px; }
156
  <?php } ?>
157
  #header <?php if(is_single()){ ?> h2 <?php } else{?>h1<?php }?>{ text-align: center; font-size: 16px; position: relative; font-weight: bold; line-height: 50px; padding: 0; margin: 0; text-transform: uppercase }
158
  main .amp-wp-content{ font-size: 18px; line-height: 29px; color:#111 }
 
159
  .single-post main .amp-wp-article-content h1{ font-size:2em}
160
  .single-post main .amp-wp-article-content h1, .single-post main .amp-wp-article-content h2, .single-post main .amp-wp-article-content h3, .single-post main .amp-wp-article-content h4, .single-post main .amp-wp-article-content h5, .single-post main .amp-wp-article-content h6{ font-family: 'Roboto Slab', serif; margin: 0px 0px 5px 0px; line-height: 1.6; }
161
  .home-post_image{ float: left; width:33%; padding-right: 2%; overflow:hidden; max-height: 225px }
@@ -788,4 +789,37 @@ if ( is_singular() && false == ampforwp_get_setting('amp-opt-sticky-head') ){?>
788
  margin-top: -75px;
789
  height: 75px;
790
  visibility: hidden;}
791
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  .amp-close-image{ top: 15px; left: 225px; cursor: pointer; }
85
  .navigation_heading{ padding: 20px 20px 15px 20px; color: #aaa; font-size: 10px; font-family: sans-serif; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid #555; display: inline-block; width: 100%}
86
  .toggle-navigationv2 ul{ list-style-type: none; margin: 15px 0 0 0; padding: 0}
87
+ .toggle-navigationv2 ul.amp-menu li a{ padding: 10px 15px 10px 20px; display: inline-block; font-size: 14px; color:#eee; width:100% }
88
  .amp-menu li{position:relative}
89
  .toggle-navigationv2 ul.amp-menu li a:hover{background:#666;color:#fff}
90
  .amp-menu li.menu-item-has-children ul{display:none;margin:0;background:#666;position:relative;
156
  <?php } ?>
157
  #header <?php if(is_single()){ ?> h2 <?php } else{?>h1<?php }?>{ text-align: center; font-size: 16px; position: relative; font-weight: bold; line-height: 50px; padding: 0; margin: 0; text-transform: uppercase }
158
  main .amp-wp-content{ font-size: 18px; line-height: 29px; color:#111 }
159
+ .amp-wp-meta.amp-meta-wrapper{list-style-type:none;}
160
  .single-post main .amp-wp-article-content h1{ font-size:2em}
161
  .single-post main .amp-wp-article-content h1, .single-post main .amp-wp-article-content h2, .single-post main .amp-wp-article-content h3, .single-post main .amp-wp-article-content h4, .single-post main .amp-wp-article-content h5, .single-post main .amp-wp-article-content h6{ font-family: 'Roboto Slab', serif; margin: 0px 0px 5px 0px; line-height: 1.6; }
162
  .home-post_image{ float: left; width:33%; padding-right: 2%; overflow:hidden; max-height: 225px }
789
  margin-top: -75px;
790
  height: 75px;
791
  visibility: hidden;}
792
+ <?php } ?>
793
+
794
+ <?php // H1 - H6 Font Sizes
795
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h1') ){ ?>
796
+ .single-post main .amp-wp-article-content h1{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h1_sz') )?>;}
797
+ <?php } else { ?>
798
+ .single-post main .amp-wp-article-content h1 {font-size: 32px;}
799
+ <?php } //H1 ends
800
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h2') ){ ?>
801
+ .single-post main .amp-wp-article-content h2{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h2_sz') )?>;}
802
+ <?php } else { ?>
803
+ .single-post main .amp-wp-article-content h2 {font-size: 27px;}
804
+ <?php } // H2 Ends
805
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h3') ){ ?>
806
+ .single-post main .amp-wp-article-content h3{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h3_sz') )?>;}
807
+ <?php } else { ?>
808
+ .single-post main .amp-wp-article-content h3 {font-size: 24px;}
809
+ <?php } // H3 Ends
810
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h4') ){ ?>
811
+ .single-post main .amp-wp-article-content h4{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h4_sz') )?>;}
812
+ <?php } else { ?>
813
+ .single-post main .amp-wp-article-content h4 {font-size: 20px;}
814
+ <?php } // H4 Ends
815
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h5') ){ ?>
816
+ .single-post main .amp-wp-article-content h5{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h5_sz') )?>;}
817
+ <?php } else { ?>
818
+ .single-post main .amp-wp-article-content h5 {font-size: 17px;}
819
+ <?php } // H5 Ends
820
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h6') ){ ?>
821
+ .single-post main .amp-wp-article-content h6{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h6_sz') )?>;}
822
+ <?php } else { ?>
823
+ .single-post main .amp-wp-article-content h6 {font-size: 15px;}
824
+ <?php } // H6 Ends
825
+ // swift Content Heading Sizes Ends?>
templates/design-manager/swift/footer.php CHANGED
@@ -88,7 +88,7 @@ if( (is_single() && $redux_builder_amp['enable-single-social-icons']) || (is_pag
88
  <?php } ?>
89
  <?php if($redux_builder_amp['enable-single-twitter-share']){?>
90
  <li>
91
- <a title="twitter share" class="s_tw" target="_blank" <?php ampforwp_nofollow_social_links(); ?> href="https://twitter.com/intent/tweet?url=<?php echo esc_url($amp_permalink); ?>&text=<?php echo esc_attr(rawurlencode(get_the_title())); ?>">
92
  </a>
93
  </li>
94
  <?php } ?>
88
  <?php } ?>
89
  <?php if($redux_builder_amp['enable-single-twitter-share']){?>
90
  <li>
91
+ <a title="twitter share" class="s_tw" target="_blank" <?php ampforwp_nofollow_social_links(); ?> href="https://twitter.com/intent/tweet?url=<?php echo esc_url($amp_permalink); ?>&text=<?php echo esc_attr(ampforwp_sanitize_twitter_title(get_the_title())); ?>">
92
  </a>
93
  </li>
94
  <?php } ?>
templates/design-manager/swift/functions.php CHANGED
@@ -14,6 +14,7 @@ add_amp_theme_support('AMP-logo');
14
  add_amp_theme_support('AMP-social-icons');
15
  //Menu
16
  add_amp_theme_support('AMP-menu');
 
17
  //Call Now
18
  add_amp_theme_support('AMP-call-now');
19
  //Breadcrumb
@@ -61,7 +62,7 @@ function ampforwp_swift_social_icons(){
61
  <?php } ?>
62
  <?php if($redux_builder_amp['enable-single-twitter-share']){?>
63
  <li>
64
- <a class="s_tw" target="_blank" <?php ampforwp_nofollow_social_links(); ?> href="https://twitter.com/intent/tweet?url=<?php echo esc_url($amp_permalink); ?>&text=<?php echo esc_attr(rawurlencode(get_the_title())); ?>">
65
  </a>
66
  </li>
67
  <?php } ?>
@@ -199,3 +200,10 @@ function ampforwp_swift_social_icons(){
199
  // Remove default sticky social from Swift
200
  remove_action('amp_post_template_footer','ampforwp_sticky_social_icons');
201
  remove_action('amp_post_template_css','amp_social_styles',11);
 
 
 
 
 
 
 
14
  add_amp_theme_support('AMP-social-icons');
15
  //Menu
16
  add_amp_theme_support('AMP-menu');
17
+ add_amp_theme_support('AMP-alter-menu');
18
  //Call Now
19
  add_amp_theme_support('AMP-call-now');
20
  //Breadcrumb
62
  <?php } ?>
63
  <?php if($redux_builder_amp['enable-single-twitter-share']){?>
64
  <li>
65
+ <a class="s_tw" target="_blank" <?php ampforwp_nofollow_social_links(); ?> href="https://twitter.com/intent/tweet?url=<?php echo esc_url($amp_permalink); ?>&text=<?php echo esc_attr(ampforwp_sanitize_twitter_title(get_the_title())); ?>">
66
  </a>
67
  </li>
68
  <?php } ?>
200
  // Remove default sticky social from Swift
201
  remove_action('amp_post_template_footer','ampforwp_sticky_social_icons');
202
  remove_action('amp_post_template_css','amp_social_styles',11);
203
+ //Twitter title #2744
204
+ function ampforwp_sanitize_twitter_title($post_title){
205
+ $post_title = html_entity_decode( $post_title, ENT_QUOTES, 'UTF-8' );
206
+ $post_title = rawurlencode( $post_title );
207
+ $post_title = esc_html( $post_title );
208
+ return $post_title;
209
+ }
templates/design-manager/swift/header.php CHANGED
@@ -94,9 +94,11 @@ if( !ampforwp_levelup_compatibility('hf_builder_head') ){
94
  <label for="offcanvas-menu" class="fsc"></label>
95
  <div class="cntr">
96
  <div class="head h_m_w">
 
97
  <div class="h-nav">
98
  <label for="offcanvas-menu" class="t-btn"></label>
99
  </div><!--end menu-->
 
100
  <div class="logo">
101
  <?php amp_logo(); ?>
102
  </div><!-- /.logo -->
@@ -137,6 +139,7 @@ if( !ampforwp_levelup_compatibility('hf_builder_head') ){
137
  <div class="hamb-mnu">
138
  <aside class="m-ctr">
139
  <div class="m-scrl">
 
140
  <div class="menu-heading clearfix">
141
  <label for="offcanvas-menu" class="c-btn"></label>
142
  </div><!--end menu-heading-->
@@ -218,9 +221,11 @@ if( !ampforwp_levelup_compatibility('hf_builder_head') ){
218
  <label for="offcanvas-menu" class="fsc"></label>
219
  <div class="cntr">
220
  <div class="head-2 h_m_w">
 
221
  <div class="h-nav">
222
  <label for="offcanvas-menu" class="t-btn"></label>
223
  </div><!-- /.left-nav -->
 
224
  <div class="h-logo">
225
  <?php amp_logo(); ?>
226
  </div>
@@ -360,9 +365,11 @@ if( !ampforwp_levelup_compatibility('hf_builder_head') ){
360
  <a href="tel:<?php echo esc_attr($redux_builder_amp['enable-amp-call-numberfield']);?>"></a>
361
  </div>
362
  <?php } ?>
 
363
  <div class="h-nav">
364
  <label for="offcanvas-menu" class="t-btn"></label>
365
  </div><!-- /.left-nav -->
 
366
  </div>
367
  </div>
368
  </div>
@@ -378,9 +385,9 @@ do_action("ampforwp_advance_header_layout_options");
378
  if(!ampforwp_levelup_compatibility('hf_builder_head') ){
379
  if($redux_builder_amp['primary-menu']){?>
380
  <div class="p-m-fl">
381
- <?php if ( amp_menu(false) ) : ?>
382
  <div class="p-menu">
383
- <?php amp_menu(); ?>
384
  </div>
385
  <?php endif; ?>
386
  <?php do_action('ampforwp_after_primary_menu'); ?>
94
  <label for="offcanvas-menu" class="fsc"></label>
95
  <div class="cntr">
96
  <div class="head h_m_w">
97
+ <?php if(ampforwp_get_setting('ampforwp-amp-menu-swift') == true) {?>
98
  <div class="h-nav">
99
  <label for="offcanvas-menu" class="t-btn"></label>
100
  </div><!--end menu-->
101
+ <?php } ?>
102
  <div class="logo">
103
  <?php amp_logo(); ?>
104
  </div><!-- /.logo -->
139
  <div class="hamb-mnu">
140
  <aside class="m-ctr">
141
  <div class="m-scrl">
142
+
143
  <div class="menu-heading clearfix">
144
  <label for="offcanvas-menu" class="c-btn"></label>
145
  </div><!--end menu-heading-->
221
  <label for="offcanvas-menu" class="fsc"></label>
222
  <div class="cntr">
223
  <div class="head-2 h_m_w">
224
+ <?php if(ampforwp_get_setting('ampforwp-amp-menu-swift') == true) {?>
225
  <div class="h-nav">
226
  <label for="offcanvas-menu" class="t-btn"></label>
227
  </div><!-- /.left-nav -->
228
+ <?php } ?>
229
  <div class="h-logo">
230
  <?php amp_logo(); ?>
231
  </div>
365
  <a href="tel:<?php echo esc_attr($redux_builder_amp['enable-amp-call-numberfield']);?>"></a>
366
  </div>
367
  <?php } ?>
368
+ <?php if(ampforwp_get_setting('ampforwp-amp-menu-swift') == true) {?>
369
  <div class="h-nav">
370
  <label for="offcanvas-menu" class="t-btn"></label>
371
  </div><!-- /.left-nav -->
372
+ <?php } ?>
373
  </div>
374
  </div>
375
  </div>
385
  if(!ampforwp_levelup_compatibility('hf_builder_head') ){
386
  if($redux_builder_amp['primary-menu']){?>
387
  <div class="p-m-fl">
388
+ <?php if ( amp_alter_menu(false) ) : ?>
389
  <div class="p-menu">
390
+ <?php amp_alter_menu(true); ?>
391
  </div>
392
  <?php endif; ?>
393
  <?php do_action('ampforwp_after_primary_menu'); ?>
templates/design-manager/swift/single.php CHANGED
@@ -73,7 +73,7 @@
73
  <div class="sp-athr">
74
  <span class="athr-tx"><?php echo ampforwp_translation($redux_builder_amp['amp-translator-published-by'], 'Published by' ); ?></span>
75
  <?php amp_author_box(
76
- array('author_pub_name'=>true,)
77
  ); ?>
78
  </div>
79
  <?php } ?>
@@ -282,7 +282,7 @@ do_action("ampforwp_single_design_type_handle_d1");
282
  <?php } ?>
283
  <?php if($redux_builder_amp['enable-single-twitter-share']){?>
284
  <li>
285
- <a class="s_tw" target="_blank" href="https://twitter.com/intent/tweet?url=<?php the_permalink(); ?>&text=<?php echo esc_attr(htmlspecialchars(get_the_title())); ?>">
286
  </a>
287
  </li>
288
  <?php } ?>
73
  <div class="sp-athr">
74
  <span class="athr-tx"><?php echo ampforwp_translation($redux_builder_amp['amp-translator-published-by'], 'Published by' ); ?></span>
75
  <?php amp_author_box(
76
+ array('author_pub_name'=>true,'author_info'=>true)
77
  ); ?>
78
  </div>
79
  <?php } ?>
282
  <?php } ?>
283
  <?php if($redux_builder_amp['enable-single-twitter-share']){?>
284
  <li>
285
+ <a class="s_tw" target="_blank" href="https://twitter.com/intent/tweet?url=<?php the_permalink(); ?>&text=<?php echo esc_attr(ampforwp_sanitize_twitter_title(get_the_title())); ?>">
286
  </a>
287
  </li>
288
  <?php } ?>
templates/design-manager/swift/style.php CHANGED
@@ -286,7 +286,7 @@ padding: <?php echo esc_html($redux_builder_amp['primary-menu-padding-control'][
286
  <?php // Dropdown CSS
287
  if($redux_builder_amp['drp-dwn']){?>
288
  .p-menu ul li:hover>ul{display:block;z-index:9;padding: 7px 0px 7px 7px;
289
- box-shadow: 1px 1px 15px 1px rgba(0, 0, 0, 0.30);background: #fff;border-radius: 4px;}
290
  .p-menu li a{transition: all 0.3s ease-in-out 0s;}
291
  .p-menu .amp-menu li ul{background: <?php echo ampforwp_sanitize_color($redux_builder_amp['primary-menu-background-scheme']['rgba']); ?>;left: 0;min-width: 200px;opacity: 1;position: absolute;top: 100%;transform: translateY(15px);transition: all 0.3s ease-in-out 0s;visibility: hidden;text-align:left;}
292
  .p-menu .amp-menu li ul li ul{left: 100%;top: 0;}
@@ -562,35 +562,35 @@ if($redux_builder_amp['swift-social-position'] == 'below-content'){?>
562
 
563
 
564
  .cntn-wrp{font-size:18px;color:#000;line-height:1.7;word-break: break-word;}
565
- .sp-artl h1, h2, h3, h4, h5, h6{margin-bottom:5px;}
566
  <?php // H1 - H6 Font Sizes
567
- if($redux_builder_amp['swift_cnt'] && $redux_builder_amp['swift_cnt_h1']){ ?>
568
- .cntn-wrp h1{font-size:<?php echo esc_html($redux_builder_amp['swift_h1_sz'])?>;}
569
  <?php } else { ?>
570
  .cntn-wrp h1 {font-size: 32px;}
571
  <?php } //H1 ends
572
- if($redux_builder_amp['swift_cnt'] && $redux_builder_amp['swift_cnt_h2']){ ?>
573
  .cntn-wrp h2{font-size:<?php echo esc_html($redux_builder_amp['swift_h2_sz'])?>;}
574
  <?php } else { ?>
575
  .cntn-wrp h2 {font-size: 27px;}
576
  <?php } // H2 Ends
577
- if($redux_builder_amp['swift_cnt'] && $redux_builder_amp['swift_cnt_h3']){ ?>
578
- .cntn-wrp h3{font-size:<?php echo esc_html($redux_builder_amp['swift_h3_sz'])?>;}
579
  <?php } else { ?>
580
  .cntn-wrp h3 {font-size: 24px;}
581
  <?php } // H3 Ends
582
- if($redux_builder_amp['swift_cnt'] && $redux_builder_amp['swift_cnt_h4']){ ?>
583
- .cntn-wrp h4{font-size:<?php echo esc_html($redux_builder_amp['swift_h4_sz'])?>;}
584
  <?php } else { ?>
585
  .cntn-wrp h4 {font-size: 20px;}
586
  <?php } // H4 Ends
587
- if($redux_builder_amp['swift_cnt'] && $redux_builder_amp['swift_cnt_h5']){ ?>
588
- .cntn-wrp h5{font-size:<?php echo esc_html($redux_builder_amp['swift_h5_sz'])?>;}
589
  <?php } else { ?>
590
  .cntn-wrp h5 {font-size: 17px;}
591
  <?php } // H5 Ends
592
- if($redux_builder_amp['swift_cnt'] && $redux_builder_amp['swift_cnt_h6']){ ?>
593
- .cntn-wrp h6{font-size:<?php echo esc_html($redux_builder_amp['swift_h6_sz'])?>;}
594
  <?php } else { ?>
595
  .cntn-wrp h6 {font-size: 15px;}
596
  <?php } // H6 Ends
286
  <?php // Dropdown CSS
287
  if($redux_builder_amp['drp-dwn']){?>
288
  .p-menu ul li:hover>ul{display:block;z-index:9;padding: 7px 0px 7px 7px;
289
+ box-shadow: 1px 1px 15px 1px rgba(0, 0, 0, 0.30);border-radius: 4px;}
290
  .p-menu li a{transition: all 0.3s ease-in-out 0s;}
291
  .p-menu .amp-menu li ul{background: <?php echo ampforwp_sanitize_color($redux_builder_amp['primary-menu-background-scheme']['rgba']); ?>;left: 0;min-width: 200px;opacity: 1;position: absolute;top: 100%;transform: translateY(15px);transition: all 0.3s ease-in-out 0s;visibility: hidden;text-align:left;}
292
  .p-menu .amp-menu li ul li ul{left: 100%;top: 0;}
562
 
563
 
564
  .cntn-wrp{font-size:18px;color:#000;line-height:1.7;word-break: break-word;}
565
+ .cntn-wrp h1, .cntn-wrp h2, .cntn-wrp h3, .cntn-wrp h4, .cntn-wrp h5, h6{margin-bottom:5px;}
566
  <?php // H1 - H6 Font Sizes
567
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h1') ){ ?>
568
+ .cntn-wrp h1{font-size:<?php echo esc_html( ampforwp_get_setting('swift_h1_sz') )?>;}
569
  <?php } else { ?>
570
  .cntn-wrp h1 {font-size: 32px;}
571
  <?php } //H1 ends
572
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h2') ){ ?>
573
  .cntn-wrp h2{font-size:<?php echo esc_html($redux_builder_amp['swift_h2_sz'])?>;}
574
  <?php } else { ?>
575
  .cntn-wrp h2 {font-size: 27px;}
576
  <?php } // H2 Ends
577
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h3') ){ ?>
578
+ .cntn-wrp h3{font-size:<?php echo esc_html(ampforwp_get_setting('swift_h3_sz') )?>;}
579
  <?php } else { ?>
580
  .cntn-wrp h3 {font-size: 24px;}
581
  <?php } // H3 Ends
582
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h4') ){ ?>
583
+ .cntn-wrp h4{font-size:<?php echo esc_html(ampforwp_get_setting('swift_h4_sz') )?>;}
584
  <?php } else { ?>
585
  .cntn-wrp h4 {font-size: 20px;}
586
  <?php } // H4 Ends
587
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h5') ){ ?>
588
+ .cntn-wrp h5{font-size:<?php echo esc_html(ampforwp_get_setting('swift_h5_sz') )?>;}
589
  <?php } else { ?>
590
  .cntn-wrp h5 {font-size: 17px;}
591
  <?php } // H5 Ends
592
+ if(ampforwp_get_setting('swift_cnt') && ampforwp_get_setting('swift_cnt_h6') ){ ?>
593
+ .cntn-wrp h6{font-size:<?php echo esc_html(ampforwp_get_setting('swift_h6_sz') )?>;}
594
  <?php } else { ?>
595
  .cntn-wrp h6 {font-size: 15px;}
596
  <?php } // H6 Ends
templates/features.php CHANGED
@@ -209,9 +209,17 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
209
  if( is_front_page() && ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
210
  return;
211
  }
212
- if ( is_archive() && !$redux_builder_amp['ampforwp-archive-support'] ) {
 
213
  return;
214
  }
 
 
 
 
 
 
 
215
  // #1192 Password Protected posts exclusion
216
  if(post_password_required( $post )){
217
  return;
@@ -1067,6 +1075,8 @@ function ampforwp_remove_schema_data() {
1067
  ampforwp_remove_filters_for_class( 'post_thumbnail_html', 'WP_Smush_Lazy_Load', 'set_lazy_load_attributes', 100 );
1068
  // Removing A3 Lazy Load plugin #2872
1069
  ampforwp_remove_filters_for_class( 'the_content', 'A3_Lazy_Load', 'filter_content_images', 100 );
 
 
1070
  //SiteOrigin Page builder compatibilty with AMP Frontpage
1071
  if ( ampforwp_is_front_page() ) {
1072
  ampforwp_remove_filters_for_class( 'the_content', 'SiteOrigin_Panels', 'generate_post_content', 10 );
@@ -1395,18 +1405,16 @@ function ampforwp_yoast_social_title($type) {
1395
  //Added the opengraph for frontpage in AMP #2454
1396
  if(ampforwp_is_front_page() || ampforwp_is_blog() ){
1397
  $title = $page_id = '';
1398
- if ( ampforwp_is_front_page() ) {
1399
- $page_id = ampforwp_get_frontpage_id();
1400
- }
1401
- if ( ampforwp_is_blog() ){
1402
- $page_id = ampforwp_get_blog_details('id');
1403
- }
1404
  if( 'og' == $type ) {
1405
  $title = WPSEO_Meta::get_value( 'opengraph-title', $page_id );
1406
  }
1407
  if( 'twitter' == $type ) {
1408
  $title = WPSEO_Meta::get_value('twitter-title',$page_id );
1409
  }
 
 
 
1410
  if (empty($title) ){
1411
  $title = get_the_title($page_id);
1412
  }
@@ -3529,70 +3537,14 @@ function ampforwp_remove_sq_seo() {
3529
  //67 View Non AMP
3530
  function ampforwp_view_nonamp(){
3531
  global $redux_builder_amp, $post, $wp;
3532
- $ampforwp_backto_nonamp = $nofollow = $page = '';
3533
- if ( is_home() && get_option( 'page_for_posts' ) && get_queried_object_id() ) {
3534
- $post_id = get_option('page_for_posts');
3535
- if($redux_builder_amp['amp-mobile-redirection']==1)
3536
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post_id )).'?nonamp=1';
3537
- else
3538
- $ampforwp_backto_nonamp = user_trailingslashit(get_permalink( $post_id ));
3539
- }
3540
- elseif ( is_home() ) {
3541
- if($redux_builder_amp['amp-mobile-redirection']==1)
3542
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
3543
- else
3544
- $ampforwp_backto_nonamp = user_trailingslashit(home_url()) ;
3545
- }
3546
- if ( is_single() ){
3547
- if($redux_builder_amp['amp-mobile-redirection']==1)
3548
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
3549
- else
3550
- $ampforwp_backto_nonamp = user_trailingslashit(get_permalink( $post->ID )) ;
3551
- }
3552
- if ( is_page() ){
3553
- if($redux_builder_amp['amp-mobile-redirection']==1)
3554
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
3555
- else
3556
- $ampforwp_backto_nonamp = user_trailingslashit(get_permalink( $post->ID ));
3557
- }
3558
- if( is_archive() || is_search() ) {
3559
-
3560
- $permalink_structure = '';
3561
- $permalink_structure = get_option('permalink_structure');
3562
-
3563
- if($redux_builder_amp['amp-mobile-redirection']==1){
3564
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
3565
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
3566
- } else {
3567
- $ampforwp_backto_nonamp = untrailingslashit( home_url( $wp->request ) );
3568
- $ampforwp_backto_nonamp = dirname($ampforwp_backto_nonamp);
3569
- $ampforwp_backto_nonamp = user_trailingslashit($ampforwp_backto_nonamp);
3570
-
3571
- if('' == $permalink_structure){
3572
- $ampforwp_backto_nonamp = site_url('?'.$wp->query_string);
3573
- $ampforwp_backto_nonamp = remove_query_arg( 'amp', $ampforwp_backto_nonamp );
3574
- }
3575
- }
3576
- if ( is_search() ) {
3577
- if ( ! empty( $permalink_structure ) ){
3578
- $ampforwp_backto_nonamp = add_query_arg('s', $wp->query_vars['s'], $ampforwp_backto_nonamp);
3579
- }
3580
- }
3581
- }
3582
-
3583
- if( true == $redux_builder_amp['ampforwp-nofollow-view-nonamp'] ){
3584
  $nofollow = 'rel=nofollow';
3585
  }
3586
- if ( isset($redux_builder_amp['ampforwp-amp-takeover']) && $redux_builder_amp['ampforwp-amp-takeover'] ) {
3587
- $ampforwp_backto_nonamp = '';
3588
- }
3589
-
3590
- $amp_url = "";
3591
  $amp_url = untrailingslashit( home_url( $wp->request ) );
3592
  $amp_url = explode('/', $amp_url);
3593
  $amp_url = array_flip($amp_url);
3594
  unset($amp_url['amp']);
3595
- $non_amp_url = "";
3596
  $non_amp_url = array_flip($amp_url);
3597
  $non_amp_url = implode('/', $non_amp_url);
3598
  $query_arg_array = $wp->query_vars;
@@ -3607,8 +3559,13 @@ function ampforwp_view_nonamp(){
3607
  if ( ampforwp_get_setting('amp-mobile-redirection') ) {
3608
  $non_amp_url = add_query_arg('nonamp','1',$non_amp_url);
3609
  }
 
 
 
 
 
3610
 
3611
- if ( $ampforwp_backto_nonamp ) { ?><a class="view-non-amp" href="<?php echo esc_url(apply_filters('ampforwp_view_nonamp_url', $non_amp_url) ) ?>" <?php echo esc_attr($nofollow); ?>><?php echo esc_html__( ampforwp_get_setting('amp-translator-non-amp-page-text'), 'accelerated-mobile-pages') ;?></a><?php
3612
  }
3613
  }
3614
 
@@ -3962,16 +3919,7 @@ function ampforwp_rel_canonical_home_archive(){
3962
  $remove = '';
3963
  $query_arg_array = '';
3964
  $page = '' ;
3965
- $show_canonical = true ;
3966
-
3967
- // RankMath canonical copatibility #2975
3968
- if ( defined('RANK_MATH_FILE') ) {
3969
- $show_canonical = false;
3970
- if (class_exists('RankMath\\Helper') && \RankMath\Helper::is_module_active( 'amp' ) == false){
3971
- $show_canonical = true;
3972
- }
3973
- }
3974
- if ( (is_home() || is_front_page() || (is_archive() && $redux_builder_amp['ampforwp-archive-support']) ) && $show_canonical ) {
3975
  $current_archive_url = home_url( $wp->request );
3976
  $amp_url = trailingslashit($current_archive_url);
3977
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
@@ -5745,27 +5693,6 @@ if ( ! function_exists('ampforwp_amp2wp_fb') ) {
5745
  }
5746
  }
5747
 
5748
- // Backward Compatibility
5749
- function ampforwp_correct_frontpage() {
5750
- return ampforwp_get_frontpage_id();
5751
- }
5752
-
5753
- //Common function to get frontpageID
5754
- function ampforwp_get_frontpage_id() {
5755
- global $redux_builder_amp;
5756
- $post_id = '';
5757
-
5758
- //$post_id = get_the_ID();
5759
- if ( ampforwp_is_front_page() && $redux_builder_amp['amp-frontpage-select-option']==1
5760
- && isset( $redux_builder_amp['amp-frontpage-select-option-pages'] )
5761
- ) {
5762
- $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
5763
- }
5764
-
5765
- $post_id = apply_filters('ampforwp_modify_frontpage_id', $post_id);
5766
- return $post_id;
5767
- }
5768
-
5769
  // Removing AMPHTML Added by Facebook's Instant Article's Plugin #2043
5770
  add_action( 'wp', 'ampforwp_remove_instant_articles_amp_markup' );
5771
  function ampforwp_remove_instant_articles_amp_markup(){
209
  if( is_front_page() && ! $redux_builder_amp['ampforwp-homepage-on-off-support'] ) {
210
  return;
211
  }
212
+ if ( is_archive() ) {
213
+ if(!ampforwp_get_setting('ampforwp-archive-support')){
214
  return;
215
  }
216
+ if( is_category() && !ampforwp_get_setting('ampforwp-archive-support-cat')){
217
+ return;
218
+ }
219
+ if( is_tag() && !ampforwp_get_setting('ampforwp-archive-support-tag') ){
220
+ return;
221
+ }
222
+ }
223
  // #1192 Password Protected posts exclusion
224
  if(post_password_required( $post )){
225
  return;
1075
  ampforwp_remove_filters_for_class( 'post_thumbnail_html', 'WP_Smush_Lazy_Load', 'set_lazy_load_attributes', 100 );
1076
  // Removing A3 Lazy Load plugin #2872
1077
  ampforwp_remove_filters_for_class( 'the_content', 'A3_Lazy_Load', 'filter_content_images', 100 );
1078
+ //optimole plugin images get removed in AMP #3073
1079
+ ampforwp_remove_filters_for_class( 'optml_content_url', 'Optml_Url_Replacer', 'build_image_url', 1, 2 );
1080
  //SiteOrigin Page builder compatibilty with AMP Frontpage
1081
  if ( ampforwp_is_front_page() ) {
1082
  ampforwp_remove_filters_for_class( 'the_content', 'SiteOrigin_Panels', 'generate_post_content', 10 );
1405
  //Added the opengraph for frontpage in AMP #2454
1406
  if(ampforwp_is_front_page() || ampforwp_is_blog() ){
1407
  $title = $page_id = '';
1408
+ $page_id = ampforwp_get_the_ID();
 
 
 
 
 
1409
  if( 'og' == $type ) {
1410
  $title = WPSEO_Meta::get_value( 'opengraph-title', $page_id );
1411
  }
1412
  if( 'twitter' == $type ) {
1413
  $title = WPSEO_Meta::get_value('twitter-title',$page_id );
1414
  }
1415
+ if (empty($title) ){
1416
+ $title = get_post_meta($page_id, '_yoast_wpseo_title', true);
1417
+ }
1418
  if (empty($title) ){
1419
  $title = get_the_title($page_id);
1420
  }
3537
  //67 View Non AMP
3538
  function ampforwp_view_nonamp(){
3539
  global $redux_builder_amp, $post, $wp;
3540
+ $nofollow = $page = $amp_url = $non_amp_url = '';
3541
+ if( true == ampforwp_get_setting('ampforwp-nofollow-view-nonamp') ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3542
  $nofollow = 'rel=nofollow';
3543
  }
 
 
 
 
 
3544
  $amp_url = untrailingslashit( home_url( $wp->request ) );
3545
  $amp_url = explode('/', $amp_url);
3546
  $amp_url = array_flip($amp_url);
3547
  unset($amp_url['amp']);
 
3548
  $non_amp_url = array_flip($amp_url);
3549
  $non_amp_url = implode('/', $non_amp_url);
3550
  $query_arg_array = $wp->query_vars;
3559
  if ( ampforwp_get_setting('amp-mobile-redirection') ) {
3560
  $non_amp_url = add_query_arg('nonamp','1',$non_amp_url);
3561
  }
3562
+ else
3563
+ $non_amp_url = user_trailingslashit($non_amp_url);
3564
+ if ( true == ampforwp_get_setting('ampforwp-amp-takeover') ) {
3565
+ $non_amp_url = '';
3566
+ }
3567
 
3568
+ if ( $non_amp_url ) { ?><a class="view-non-amp" href="<?php echo esc_url(apply_filters('ampforwp_view_nonamp_url', $non_amp_url) ) ?>" <?php echo esc_attr($nofollow); ?>><?php echo esc_html__( ampforwp_get_setting('amp-translator-non-amp-page-text'), 'accelerated-mobile-pages') ;?></a> <?php
3569
  }
3570
  }
3571
 
3919
  $remove = '';
3920
  $query_arg_array = '';
3921
  $page = '' ;
3922
+ if ( is_home() || is_front_page() || (is_archive() && ampforwp_get_setting('ampforwp-archive-support')) ) {
 
 
 
 
 
 
 
 
 
3923
  $current_archive_url = home_url( $wp->request );
3924
  $amp_url = trailingslashit($current_archive_url);
3925
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
5693
  }
5694
  }
5695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5696
  // Removing AMPHTML Added by Facebook's Instant Article's Plugin #2043
5697
  add_action( 'wp', 'ampforwp_remove_instant_articles_amp_markup' );
5698
  function ampforwp_remove_instant_articles_amp_markup(){