AMP for WP – Accelerated Mobile Pages - Version 0.9.50

Version Description

(24 May 2017) = * View more details on https://ampforwp.com/facebook-comments-in-amp/ * Design 3 Social Icons issue #832 * View non AMP leads to /?nonamp=1 #814 * Youtube shortcode compatibility improved #557 * welcome.php should be shown only if user is administrator #696 * Facebook comments support added in AMP #825 * WP Like Button Compatibility #841 * Custom Taxonomy Support added with Custom Post Type Extension. * Front page comments not found as expected #837 * Fixed xml:lang tag issue #848 * Sanitize Iframe in the archive description Fixed #845 * Compatibility with Newspaper Theme by TagDiv #842 and #796 * Some debug problems (blog page, style.php) #838 * Featured Image hooks added * Twitter is misspelled #854 * The core concept of the AMP Content builder has been built.

Download this release

Release Info

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

Code changes from version 0.9.49 to 0.9.50

Files changed (32) hide show
  1. accelerated-moblie-pages.php +38 -6
  2. includes/modules/ampforwp-blurb.php +277 -0
  3. includes/modules/ampforwp-button.php +252 -0
  4. includes/modules/ampforwp-text.php +254 -0
  5. includes/modules/js/amp.js +158 -0
  6. includes/options/admin-config.php +480 -428
  7. includes/redirect.php +22 -0
  8. includes/welcome.php +1 -1
  9. readme.txt +24 -4
  10. templates/custom-sanitizer.php +1 -1
  11. templates/design-manager/design-1/archive.php +24 -2
  12. templates/design-manager/design-1/elements/comments.php +3 -3
  13. templates/design-manager/design-1/elements/featured-image.php +2 -0
  14. templates/design-manager/design-1/elements/simple-comment-button.php +1 -1
  15. templates/design-manager/design-1/footer.php +22 -9
  16. templates/design-manager/design-1/frontpage.php +3 -4
  17. templates/design-manager/design-1/style.php +1 -0
  18. templates/design-manager/design-2/archive.php +26 -4
  19. templates/design-manager/design-2/elements/comments.php +3 -3
  20. templates/design-manager/design-2/elements/featured-image.php +3 -1
  21. templates/design-manager/design-2/elements/simple-comment-button.php +2 -2
  22. templates/design-manager/design-2/footer.php +22 -9
  23. templates/design-manager/design-2/frontpage.php +3 -4
  24. templates/design-manager/design-2/style.php +1 -0
  25. templates/design-manager/design-3/archive.php +24 -3
  26. templates/design-manager/design-3/elements/comments.php +3 -3
  27. templates/design-manager/design-3/elements/featured-image.php +4 -2
  28. templates/design-manager/design-3/elements/simple-comment-button.php +2 -2
  29. templates/design-manager/design-3/footer.php +22 -9
  30. templates/design-manager/design-3/frontpage.php +3 -4
  31. templates/design-manager/design-3/style.php +2 -2
  32. templates/features.php +107 -5
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.49
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
16
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
17
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
18
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
19
- define('AMPFORWP_VERSION','0.9.49');
20
  // any changes to AMP_QUERY_VAR should be refelected here
21
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
22
 
@@ -36,12 +36,16 @@ add_action( 'init', 'ampforwp_add_custom_post_support',11);
36
  function ampforwp_name_blog_page() {
37
  $page_for_posts = get_option( 'page_for_posts' );
38
  $post = get_post($page_for_posts);
39
- $slug = $post->post_name;
40
- return $slug;
 
 
41
  }
42
  function ampforwp_custom_post_page() {
43
  $front_page_type = get_option( 'show_on_front' );
44
- return $front_page_type;
 
 
45
  }
46
 
47
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
@@ -106,7 +110,30 @@ function ampforwp_add_custom_rewrite_rules() {
106
  'index.php?amp&tag=$matches[1]&paged=$matches[2]',
107
  'top'
108
  );
109
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  }
111
  add_action( 'init', 'ampforwp_add_custom_rewrite_rules' );
112
 
@@ -153,6 +180,11 @@ function ampforwp_parent_plugin_check() {
153
  require_once dirname( __FILE__ ).'/includes/options/admin-config.php';
154
  require_once dirname( __FILE__ ).'/templates/report-bugs.php';
155
 
 
 
 
 
 
156
 
157
  /*
158
  * Load Files only in the backend
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.50
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
16
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
17
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
18
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
19
+ define('AMPFORWP_VERSION','0.9.50');
20
  // any changes to AMP_QUERY_VAR should be refelected here
21
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
22
 
36
  function ampforwp_name_blog_page() {
37
  $page_for_posts = get_option( 'page_for_posts' );
38
  $post = get_post($page_for_posts);
39
+ if ( $post ) {
40
+ $slug = $post->post_name;
41
+ return $slug;
42
+ }
43
  }
44
  function ampforwp_custom_post_page() {
45
  $front_page_type = get_option( 'show_on_front' );
46
+ if ( $front_page_type ) {
47
+ return $front_page_type;
48
+ }
49
  }
50
 
51
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
110
  'index.php?amp&tag=$matches[1]&paged=$matches[2]',
111
  'top'
112
  );
113
+
114
+ //Rewrite rule for custom Taxonomies
115
+ $args = array(
116
+ 'public' => true,
117
+ '_builtin' => false
118
+ );
119
+ $output = 'names'; // or objects
120
+ $operator = 'and'; // 'and' or 'or'
121
+ $taxonomies = get_taxonomies( $args, $output, $operator );
122
+ if ( $taxonomies ) {
123
+ foreach ( $taxonomies as $taxonomy ) {
124
+ add_rewrite_rule(
125
+ $taxonomy.'\/(.+?)\/amp/?$',
126
+ 'index.php?amp&'.$taxonomy.'=$matches[1]',
127
+ 'top'
128
+ );
129
+ // For Custom Taxonomies with pages
130
+ add_rewrite_rule(
131
+ $taxonomy.'\/(.+?)\/amp\/page\/?([0-9]{1,})\/?$',
132
+ 'index.php?amp&'.$taxonomy.'=$matches[1]&paged=$matches[2]',
133
+ 'top'
134
+ );
135
+ }
136
+ }
137
  }
138
  add_action( 'init', 'ampforwp_add_custom_rewrite_rules' );
139
 
180
  require_once dirname( __FILE__ ).'/includes/options/admin-config.php';
181
  require_once dirname( __FILE__ ).'/templates/report-bugs.php';
182
 
183
+ // Modules
184
+ // require AMPFORWP_PLUGIN_DIR .'/includes/modules/ampforwp-blurb.php';
185
+ // require AMPFORWP_PLUGIN_DIR .'/includes/modules/ampforwp-text.php';
186
+ // require AMPFORWP_PLUGIN_DIR .'/includes/modules/ampforwp-button.php';
187
+
188
 
189
  /*
190
  * Load Files only in the backend
includes/modules/ampforwp-blurb.php ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AMPFORWP_Blurb_Widget extends WP_Widget {
4
+
5
+ /*--------------------------------------------------*/
6
+ /* Constructor
7
+ /*--------------------------------------------------*/
8
+
9
+ /**
10
+ * Specifies the classname and description, instantiates the widget,
11
+ * loads localization files, and includes necessary stylesheets and JavaScript.
12
+ */
13
+ public function __construct() {
14
+
15
+ // Hooks fired when the Widget is activated and deactivated
16
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
17
+ register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
18
+
19
+ parent::__construct(
20
+ 'ampforwp-blurb',
21
+ __( 'AMP Blurb Module', 'accelerated-mobile-pages' ),
22
+ array( //
23
+ 'classname' => 'ampforwp-blurb',
24
+ 'description' => __( 'Displays Icon, headline and description. Best for showing features.', 'accelerated-mobile-pages' )
25
+ )
26
+ );
27
+
28
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
29
+
30
+ // Add static written Jquery
31
+ add_action( 'admin_footer', array( $this, 'footer_scritps') );
32
+
33
+
34
+ } // end constructor
35
+
36
+ /*--------------------------------------------------*/
37
+ /* Widget API Functions
38
+ /*--------------------------------------------------*/
39
+
40
+ /**
41
+ * Outputs the content of the widget.
42
+ *
43
+ * @param array args The array of form elements
44
+ * @param array instance The current instance of the widget
45
+ */
46
+ public function widget( $args, $instance ) {
47
+
48
+ extract( $args, EXTR_SKIP );
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( );
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array();
54
+
55
+
56
+ echo $before_widget;
57
+
58
+ $output .= '<div class="amp-wp-content amp_cb_module amp_cb_blurb">';
59
+
60
+ if ( $title ) {
61
+ $output .= '<div class="amp_module_title">';
62
+ $output .= $title;
63
+ $output .= '</div>';
64
+ }
65
+
66
+ $output .= '<div class="flex-grid">';
67
+
68
+ foreach( $features as $feature ) {
69
+ $output .= '<div class="clmn">';
70
+ if ( $feature['image'] ) {
71
+ $output .= '<img src="'. $feature['image'] .'" height="80" width="80" alt="" />';
72
+ }
73
+ $output .= '<div class="amp_cb_content">';
74
+ $output .= '<h4>'.$feature['title'].'</h4>';
75
+ $output .= '<p>'.$feature['description'].'</p>';
76
+ $output .= '</div>';
77
+ $output .= '</div>';
78
+ }
79
+ $output .= '</div></div>'; // flex-grid & amp_cb_module
80
+ $sanitizer = new AMPFORWP_Content( $output, array(),
81
+ apply_filters( 'ampforwp_content_sanitizers',array( 'AMP_Img_Sanitizer' => array(),'AMP_Style_Sanitizer' => array() ) ) );
82
+ $sanitized_output = $sanitizer->get_amp_content();
83
+
84
+ if( $sanitized_output ) {
85
+ echo $sanitized_output;
86
+ }
87
+
88
+ echo $after_widget;
89
+
90
+ } // end widget
91
+
92
+ /**
93
+ * Processes the widget's options to be saved.
94
+ *
95
+ * @param array new_instance The new instance of values to be generated via the update.
96
+ * @param array old_instance The previous instance of values before the update.
97
+ */
98
+ public function update( $new_instance, $old_instance ) {
99
+
100
+ $instance = $old_instance;
101
+
102
+ $instance['title'] = strip_tags($new_instance['title']);
103
+
104
+ foreach($new_instance['features'] as $feature){
105
+ $feature['title'] = strip_tags($feature['title']);
106
+ $feature['description'] = strip_tags($feature['description']);
107
+ $feature['image'] = strip_tags($feature['image']);
108
+ }
109
+ $instance['features'] = $new_instance['features'];
110
+
111
+ return $instance;
112
+
113
+ } // end widget
114
+
115
+ /**
116
+ * Generates the administration form for the widget.
117
+ *
118
+ * @param array instance The array of keys and values for the widget.
119
+ */
120
+ public function form( $instance ) {
121
+
122
+ $instance = wp_parse_args(
123
+ (array) $instance
124
+ );
125
+
126
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?>
127
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
128
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
129
+
130
+
131
+ <?php
132
+
133
+ $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array(); ?>
134
+ <span class="ampforwp-blurb-additional">
135
+ <?php
136
+ $c = 0;
137
+ if ( count( $features ) > 0 ) {
138
+ foreach( $features as $feature ) {
139
+ if ( isset( $feature['title'] ) || isset( $feature['description'] ) ) { ?>
140
+ <div class="widget">
141
+ <div class="widget-top"><div class="widget-title"><h3><?php echo $feature['title'];?><span class="in-widget-title"></span></h3></div>
142
+ </div>
143
+
144
+ <div class="widget-inside">
145
+ <p>
146
+ <label for="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][title]'; ?>"><?php _e( 'Title:' ); ?></label>
147
+ <input class="widefat" id="<?php echo $this->get_field_id( 'features' ) .'-'. $c.'-title'; ?>" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][title]'; ?>" type="text" value="<?php echo $feature['title']; ?>" />
148
+ <label for="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][description]'; ?>"><?php _e( 'Description:' ); ?></label>
149
+
150
+ <textarea class="widefat" id="<?php echo $this->get_field_id( 'features' ) .'-'. $c.'-description'; ?>" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][description]'; ?>" rows="6" cols="50"><?php echo $feature['description']; ?></textarea> <span class="clear"></span>
151
+ </p>
152
+ <p>
153
+ <label for="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][image]'; ?>"><?php _e( 'Image:' ); ?></label>
154
+ <input type="button" class="select-img-<?php echo $c;?> button left" style="width:auto;" value="Select Image" onclick="ampSelectImage('<?php echo $c;?>');"/>
155
+ <input type="button" style="display:none" name="removeimg" id="remove-img-<?php echo $c;?>" class="button button-secondary remove-img-button" data-count-type="<?php echo $c;?>" value="Remove Image" onclick="removeImage('<?php echo $c;?>')">
156
+ <img src="<?php echo $instance['features']["$c"]['image'] ?>" class="preview-image block-image-<?php echo $c;?>" >
157
+ <input type="hidden" id="amp-img-field-<?php echo $c;?>" class="img<?php echo $c;?>" style="width:auto;" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][image]'; ?>" id="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][image]';?>'" value="<?php echo $instance['features']["$c"]['image'] ?>" />
158
+ </p>
159
+ <p> <a class="ampforwp-blurb-remove delete button left"><?php _e('Remove Feature','accelerated-mobile-pages')?></a> </p>
160
+ </div>
161
+ </div>
162
+ <?php
163
+ $c = $c +1;
164
+ }
165
+ }
166
+ } ?>
167
+ </span>
168
+
169
+ <a class="ampforwp-blurb-add button left"> <?php _e('Add Feature','accelerated-mobile-pages'); ?> </a>
170
+
171
+ <?php
172
+
173
+ } // end form
174
+
175
+ /*--------------------------------------------------*/
176
+ /* Public Functions
177
+ /*--------------------------------------------------*/
178
+
179
+ /**
180
+ * Fired when the plugin is activated.
181
+ *
182
+ * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
183
+ */
184
+ public function activate( $network_wide ) {
185
+
186
+ } // end activate
187
+
188
+ /**
189
+ * Fired when the plugin is deactivated.
190
+ *
191
+ * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
192
+ */
193
+ public function deactivate( $network_wide ) {
194
+
195
+ } // end deactivate
196
+
197
+ /**
198
+ * Registers and enqueues admin-specific styles.
199
+ */
200
+ public function register_admin_styles() {
201
+
202
+ } // end register_admin_styles
203
+
204
+ /**
205
+ * Registers and enqueues admin-specific JavaScript.
206
+ */
207
+ public function register_admin_scripts() {
208
+
209
+
210
+ wp_enqueue_script('media-upload');
211
+ wp_enqueue_script('thickbox');
212
+ wp_enqueue_style('thickbox');
213
+
214
+
215
+ wp_enqueue_script( 'ampforwp-builder-script', plugins_url('/modules/js/amp.js' , dirname(__FILE__) ) , array( 'jquery' ), false, true );
216
+
217
+ } // end register_admin_scripts
218
+
219
+ public function footer_scritps() { ?>
220
+
221
+ <style>
222
+ .ampforwp-blurb-add:hover{
223
+ cursor: pointer;
224
+ }
225
+ .ampforwp-blurb-add.button {
226
+ margin-bottom: 10px;
227
+ }
228
+ .ampforwp-blurb-additional .preview-image {
229
+ max-width:100%;
230
+ width : 70px;
231
+ height : 70px;
232
+ }
233
+ #toplevel_page_amp_options a .wp-menu-image:before{display: none}
234
+
235
+ body #toplevel_page_amp_options .wp-menu-image{
236
+ background-image:
237
+ url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjMxNHB4IiBoZWlnaHQ9IjMxNXB4IiB2aWV3Qm94PSIwIDAgMzE0IDMxNSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggNDEgKDM1MzI2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5TaGFwZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSIyNjA3MSIgZmlsbD0iI0ZGNEM0QyI+CiAgICAgICAgICAgIDxnIGlkPSJDYXBhXzEiPgogICAgICAgICAgICAgICAgPGcgaWQ9Il94MzJfNDAuX1Bvd2VyIj4KICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMTU3LjAwNywwIEM3MC4yOTIsMCAwLDcwLjI5MiAwLDE1Ny4wMDcgQzAsMjQzLjcxNSA3MC4yOTIsMzE0LjAxNCAxNTcuMDA3LDMxNC4wMTQgQzI0My43MTYsMzE0LjAxNCAzMTQuMDE0LDI0My43MTUgMzE0LjAxNCwxNTcuMDA3IEMzMTQuMDE0LDcwLjI5MiAyNDMuNzE2LDAgMTU3LjAwNywwIFogTTE1Ny4wMDcsMjgyLjYxMiBDODcuNjM0LDI4Mi42MTIgMzEuNDAyLDIyNi4zNzIgMzEuNDAyLDE1Ny4wMDcgQzMxLjQwMiw4Ny42MzQgODcuNjM0LDMxLjQwMiAxNTcuMDA3LDMxLjQwMiBDMjI2LjM3MSwzMS40MDIgMjgyLjYxMSw4Ny42MzQgMjgyLjYxMSwxNTcuMDA3IEMyODIuNjEyLDIyNi4zNzIgMjI2LjM3MiwyODIuNjEyIDE1Ny4wMDcsMjgyLjYxMiBaIE0yMDQuMTExLDE0MS4zNjggTDE2My40NzksMTQxLjUzMyBDMTU5LjEzOSwxNDEuNTUzIDE1Ny41NDQsMTM4LjYyMyAxNTkuOTA1LDEzNC45NzkgTDIwMy4zOTcsNjguMTA5IEMyMDguMTI2LDYwLjg0MSAyMDYuOTg0LDU5LjkyMiAyMDAuODYxLDY2LjA1MyBMMTA1LjMwNSwxNjEuNiBDOTkuMTcyLDE2Ny43MzIgMTAxLjIzMiwxNzIuNjc2IDEwOS45MDYsMTcyLjY0MSBMMTQyLjY3OSwxNzIuNTA4IEMxNTEuMzQ3LDE3Mi40NzIgMTU0LjU1MiwxNzguMzM1IDE0OS44MjQsMTg1LjYwNSBMMTA2LjMzNCwyNTIuNDc3IEMxMDMuOTcyLDI1Ni4xMTIgMTA0LjU0MiwyNTYuNTgxIDEwNy42MiwyNTMuNTI3IEwxNzUuOTE1LDE4NS43MTcgQzE3OC45ODgsMTgyLjY1OSAxODMuOTUsMTc3LjY4NiAxODYuOTgzLDE3NC41OTYgTDIwOC43ODgsMTUyLjQ4NSBDMjE0Ljg3NSwxNDYuMzE3IDIxMi43NzUsMTQxLjMzIDIwNC4xMTEsMTQxLjM2OCBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+) !important;
238
+ background-repeat: no-repeat;
239
+ background-position: center;
240
+ -webkit-background-size: 20px auto;
241
+ background-size: 20px auto;
242
+ }
243
+ .amp_content_builder .redux-group-tab-link-a span:after {
244
+ content: "NEW";
245
+ color: #fff;
246
+ font-size: 10px;
247
+ background: #4452a7;
248
+ padding: 4px 7px;
249
+ border-radius: 30px;
250
+ font-weight: normal;
251
+ position: relative;
252
+ top: -1px;
253
+ left: 5px;
254
+ }
255
+ </style>
256
+ <?php }
257
+
258
+ /**
259
+ * Registers and enqueues widget-specific styles.
260
+ */
261
+ public function register_widget_styles() {
262
+
263
+ } // end register_widget_styles
264
+
265
+ /**
266
+ * Registers and enqueues widget-specific scripts.
267
+ */
268
+ public function register_widget_scripts() {
269
+
270
+ } // end register_widget_scripts
271
+
272
+ } // end class
273
+
274
+
275
+ add_action( 'widgets_init', function(){
276
+ register_widget( 'AMPFORWP_Blurb_Widget' );
277
+ });
includes/modules/ampforwp-button.php ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AMPFORWP_Button_Widget extends WP_Widget {
4
+
5
+ /*--------------------------------------------------*/
6
+ /* Constructor
7
+ /*--------------------------------------------------*/
8
+
9
+ /**
10
+ * Specifies the classname and description, instantiates the widget,
11
+ * loads localization files, and includes necessary stylesheets and JavaScript.
12
+ */
13
+ public function __construct() {
14
+
15
+ // Hooks fired when the Widget is activated and deactivated
16
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
17
+ register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
18
+
19
+ parent::__construct(
20
+ 'ampforwp-button',
21
+ __( 'AMP Button Module', 'accelerated-mobile-pages' ),
22
+ array(
23
+ 'classname' => 'ampforwp-button',
24
+ 'description' => __( 'Displays Button with text and link options.', 'accelerated-mobile-pages' )
25
+ )
26
+ );
27
+
28
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
29
+
30
+ // Add static written Jquery
31
+ add_action( 'admin_footer', array( $this, 'footer_scritps') );
32
+
33
+
34
+ } // end constructor
35
+
36
+ /*--------------------------------------------------*/
37
+ /* Widget API Functions
38
+ /*--------------------------------------------------*/
39
+
40
+ /**
41
+ * Outputs the content of the widget.
42
+ *
43
+ * @param array args The array of form elements
44
+ * @param array instance The current instance of the widget
45
+ */
46
+ public function widget( $args, $instance ) {
47
+
48
+ extract( $args, EXTR_SKIP );
49
+
50
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Classes' );
51
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
52
+
53
+ $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array();
54
+
55
+
56
+ echo $before_widget;
57
+ $target = "";
58
+ $output .= '<div class="amp-wp-content amp_cb_module amp_cb_btn">';
59
+
60
+ foreach( $features as $feature ) {
61
+
62
+ if ( $feature['radio'] == 'radio-off'){
63
+ $target = "_self";
64
+ } elseif( $feature['radio'] == 'radio-on' ){
65
+ $target = "_blank";
66
+ }
67
+
68
+ if ( $feature['size'] == '1'){
69
+ $size = "s_btn";
70
+ } elseif( $feature['size'] == '2' ){
71
+ $size = "m_btn";
72
+ } elseif( $feature['size'] == '3' ){
73
+ $size = "l_btn";
74
+ }
75
+
76
+ $output .= '<a href="#" class="' . $size . '" target="' . $target . '" >'. $feature['title'] .'</a>';
77
+ }
78
+ $output .= '</div>';
79
+
80
+ $sanitizer = new AMPFORWP_Content( $output, array(),
81
+ apply_filters( 'ampforwp_content_sanitizers',array( 'AMP_Img_Sanitizer' => array(),'AMP_Style_Sanitizer' => array() ) ) );
82
+ $sanitized_output = $sanitizer->get_amp_content();
83
+
84
+ if( $sanitized_output ) {
85
+ echo $sanitized_output;
86
+ }
87
+
88
+ echo $after_widget;
89
+
90
+ } // end widget
91
+
92
+ /**
93
+ * Processes the widget's options to be saved.
94
+ *
95
+ * @param array new_instance The new instance of values to be generated via the update.
96
+ * @param array old_instance The previous instance of values before the update.
97
+ */
98
+ public function update( $new_instance, $old_instance ) {
99
+
100
+ $instance = $old_instance;
101
+
102
+ $instance['title'] = strip_tags($new_instance['title']);
103
+
104
+ foreach($new_instance['features'] as $feature){
105
+ $feature['title'] = strip_tags($feature['title']);
106
+ $feature['description'] = strip_tags($feature['description']);
107
+ $feature['image'] = strip_tags($feature['image']);
108
+ }
109
+ $instance['features'] = $new_instance['features'];
110
+
111
+ return $instance;
112
+
113
+ } // end widget
114
+
115
+ /**
116
+ * Generates the administration form for the widget.
117
+ *
118
+ * @param array instance The array of keys and values for the widget.
119
+ */
120
+ public function form( $instance ) {
121
+
122
+ $instance = wp_parse_args(
123
+ (array) $instance
124
+ );
125
+
126
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?>
127
+ <p> </p>
128
+
129
+
130
+ <?php
131
+
132
+ $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array(); ?>
133
+ <span class="ampforwp-button-additional"> <?php
134
+ $c = 0; ?>
135
+
136
+ <?php
137
+
138
+ if ( count( $features ) > 0 ) {
139
+ foreach( $features as $feature ) {
140
+ if ( isset( $feature['title'] ) || isset( $feature['description'] ) ) { ?>
141
+ <div class="widget">
142
+ <div class="widget-top"><div class="widget-title"><h3><?php echo $feature['title'];?><span class="in-widget-title"></span></h3></div>
143
+ </div>
144
+
145
+ <div class="widget-inside">
146
+ <div class="widget-content">
147
+ <p>
148
+ <label for="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][title]'; ?>"><?php _e( 'Button Text:' ); ?></label>
149
+ <input class="widefat" id="<?php echo $this->get_field_id( 'features' ) .'-'. $c.'-title'; ?>" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][title]'; ?>" type="text" value="<?php echo $feature['title']; ?>" /> </p>
150
+
151
+ <p><label for="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][url]'; ?>"><?php _e( 'Url:' ); ?></label>
152
+ <input class="widefat" id="<?php echo $this->get_field_id( 'features' ) .'-'. $c.'-url'; ?>" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][url]'; ?>" type="text" value="<?php echo $feature['url']; ?>" />
153
+ </p>
154
+
155
+
156
+ <p><label><?php _e('URL Target:'); ?> </label><br />
157
+ <label class="radio_label" for="<?php echo $this->get_field_id('id') . "-on"; ?>"><?php _e('New Tab'); ?> </label>
158
+ <input class="widefat" id="<?php echo $this->get_field_id('id') . "-on"; ?>" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][radio]'; ?>" type="radio" value="radio-on" <?php if ( $feature['radio'] == 'radio-on'): ?> checked <?php endif ?> />
159
+
160
+ <label class="radio_label" for="<?php echo $this->get_field_id('id') . "-off"; ?>"> <?php _e('Current'); ?> </label>
161
+
162
+ <input class="widefat" id="<?php echo $this->get_field_id('id') . "-off"; ?>" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][radio]'; ?>" type="radio" value="radio-off" <?php if ( $feature['radio'] == 'radio-off' || $feature['radio'] == ''): ?> checked <?php endif ?> />
163
+ </p>
164
+ <!-- done -->
165
+ <p>
166
+ <label for="<?php echo $this->get_field_id('id') . "-size"; ?>"> <?php _e('Select Size:'); ?> </label>
167
+ <select id="<?php echo $this->get_field_id('id') . "-size"; ?>" class="widefat" name="<?php echo $this->get_field_name( 'features' ) . '['.$c.'][size]'; ?>">
168
+ <option value="1" <?php selected( $feature['size'], 1 ); ?>>Small</option>
169
+ <option value="2" <?php selected( $feature['size'], 2 ); ?>>Medium</option>
170
+ <option value="3" <?php selected( $feature['size'], 3 ); ?>>Large</option>
171
+ </select>
172
+ </p>
173
+
174
+ <p> <a class="ampforwp-button-remove delete button left"><?php _e('Remove Feature','accelerated-mobile-pages')?></a> </p>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ <?php
179
+ $c = $c +1;
180
+ }
181
+ }
182
+ } ?>
183
+ </span>
184
+
185
+ <a class="ampforwp-button-add button left"> <?php _e('Add Feature','accelerated-mobile-pages'); ?> </a>
186
+ <p> </p>
187
+ <?php
188
+
189
+ } // end form
190
+
191
+ /*--------------------------------------------------*/
192
+ /* Public Functions
193
+ /*--------------------------------------------------*/
194
+
195
+ /**
196
+ * Fired when the plugin is activated.
197
+ *
198
+ * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
199
+ */
200
+ public function activate( $network_wide ) {
201
+
202
+ } // end activate
203
+
204
+ /**
205
+ * Fired when the plugin is deactivated.
206
+ *
207
+ * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
208
+ */
209
+ public function deactivate( $network_wide ) {
210
+
211
+ } // end deactivate
212
+
213
+ /**
214
+ * Registers and enqueues admin-specific styles.
215
+ */
216
+ public function register_admin_styles() {
217
+
218
+ } // end register_admin_styles
219
+
220
+ /**
221
+ * Registers and enqueues admin-specific JavaScript.
222
+ */
223
+ public function register_admin_scripts() {
224
+
225
+ wp_enqueue_script( 'ampforwp-builder-script', plugins_url('/modules/js/amp.js' , dirname(__FILE__) ) , array( 'jquery' ), false, true );
226
+
227
+ } // end register_admin_scripts
228
+
229
+ public function footer_scritps() { ?>
230
+ <style>.radio_label{}</style>
231
+ <?php }
232
+
233
+ /**
234
+ * Registers and enqueues widget-specific styles.
235
+ */
236
+ public function register_widget_styles() {
237
+
238
+ } // end register_widget_styles
239
+
240
+ /**
241
+ * Registers and enqueues widget-specific scripts.
242
+ */
243
+ public function register_widget_scripts() {
244
+
245
+ } // end register_widget_scripts
246
+
247
+ } // end class
248
+
249
+
250
+ add_action( 'widgets_init', function(){
251
+ register_widget( 'AMPFORWP_Button_Widget' );
252
+ });
includes/modules/ampforwp-text.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class AMPFORWP_Text_Widget extends WP_Widget {
4
+
5
+ /*--------------------------------------------------*/
6
+ /* Constructor
7
+ /*--------------------------------------------------*/
8
+
9
+ /**
10
+ * Specifies the classname and description, instantiates the widget,
11
+ * loads localization files, and includes necessary stylesheets and JavaScript.
12
+ */
13
+ public function __construct() {
14
+
15
+ // Hooks fired when the Widget is activated and deactivated
16
+ register_activation_hook( __FILE__, array( $this, 'activate' ) );
17
+ register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
18
+
19
+ parent::__construct(
20
+ 'ampforwp-text',
21
+ __( 'AMPforWP Text Module', 'accelerated-mobile-pages' ),
22
+ array( //
23
+ 'classname' => 'ampforwp-text',
24
+ 'description' => __( 'Pulls in the featured classes to display within the widget.', 'accelerated-mobile-pages' )
25
+ )
26
+ );
27
+
28
+ add_action( 'admin_enqueue_scripts', array( $this, 'register_admin_scripts' ) );
29
+
30
+ // Add static written Jquery
31
+ add_action( 'admin_footer', array( $this, 'footer_scritps') );
32
+
33
+
34
+ add_action( 'ampforwp_tinymce_editor', array( $this, 'editor' ), 10, 4 );
35
+
36
+
37
+ add_action('current_screen',array($this, 'hide_editor'), 50);
38
+
39
+
40
+
41
+
42
+ } // end constructor
43
+
44
+ /*--------------------------------------------------*/
45
+ /* Widget API Functions
46
+ /*--------------------------------------------------*/
47
+
48
+ /**
49
+ * Outputs the content of the widget.
50
+ *
51
+ * @param array args The array of form elements
52
+ * @param array instance The current instance of the widget
53
+ */
54
+ public function widget( $args, $instance ) {
55
+
56
+ extract( $args, EXTR_SKIP );
57
+
58
+ $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : __( 'Classes' );
59
+ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
60
+
61
+
62
+ $text = ( ! empty( $instance['text'] ) ) ? $instance['text'] : '';
63
+
64
+ // $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array();
65
+
66
+
67
+ echo $before_widget;
68
+ if ( $title ) echo $before_title . $title . $after_title;
69
+
70
+ $output = "";
71
+
72
+ // foreach( $features as $feature ) {
73
+
74
+ // $output .= '<div class="class-highlight" >';
75
+ // $output .= '<h4>'.$feature['title'].'</h4>';
76
+
77
+ // $output .= '<p>'.$feature['text'].'</p>';
78
+ // $output .= '</div>';
79
+ // }
80
+
81
+
82
+ $output .= '<div class="class-highlight" >';
83
+ $output .= '<p>'. $text .'</p>';
84
+ $output .= '</div>';
85
+
86
+ $sanitizer = new AMPFORWP_Content( $output, array(),
87
+ apply_filters( 'ampforwp_content_sanitizers',array( 'AMP_Img_Sanitizer' => array(),'AMP_Style_Sanitizer' => array(),'AMP_Twitter_Embed_Handler' => array(),
88
+ 'AMP_YouTube_Embed_Handler' => array(),
89
+ 'AMP_Instagram_Embed_Handler' => array(),
90
+ 'AMP_Vine_Embed_Handler' => array(),
91
+ 'AMP_Facebook_Embed_Handler' => array(),
92
+ 'AMP_Gallery_Embed_Handler' => array(), ),$this->post ),
93
+ apply_filters( 'amp_content_sanitizers', array(
94
+ 'AMP_Style_Sanitizer' => array(),
95
+ 'AMP_Blacklist_Sanitizer' => array(),
96
+ /* 'AMP_Img_Sanitizer' => array(),*/
97
+ 'AMP_Video_Sanitizer' => array(),
98
+ 'AMP_Audio_Sanitizer' => array(),
99
+ 'AMP_Iframe_Sanitizer' => array(
100
+ 'add_placeholder' => true, )), $this->post)
101
+ );
102
+ $sanitized_output = $sanitizer->get_amp_content();
103
+
104
+ if( $sanitized_output ) {
105
+ echo $sanitized_output;
106
+ }
107
+
108
+ echo $after_widget;
109
+
110
+ } // end widget
111
+
112
+ /**
113
+ * Processes the widget's options to be saved.
114
+ *
115
+ * @param array new_instance The new instance of values to be generated via the update.
116
+ * @param array old_instance The previous instance of values before the update.
117
+ */
118
+ public function update( $new_instance, $old_instance ) {
119
+
120
+ $instance = $old_instance;
121
+
122
+ $instance['title'] = strip_tags($new_instance['title']);
123
+ $instance['text'] = $new_instance['text'];
124
+ $instance['widget_id'] = $new_instance['widget_id'];
125
+
126
+ return $instance;
127
+
128
+ } // end widget
129
+
130
+ /**
131
+ * Generates the administration form for the widget.
132
+ *
133
+ * @param array instance The array of keys and values for the widget.
134
+ */
135
+ public function form( $instance ) {
136
+
137
+ $instance = wp_parse_args(
138
+ (array) $instance
139
+ );
140
+
141
+ $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?>
142
+ <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
143
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
144
+
145
+ <p>
146
+
147
+ <?php $text = isset( $instance['text'] ) ? esc_attr( $instance['text'] ) : '';
148
+
149
+ do_action( 'ampforwp_tinymce_editor', $instance['text'], $this->get_field_id( 'text' ), $this->get_field_name( 'text' ), $instance['type'] );?>
150
+
151
+ <input type="hidden" class="widefat" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_id( 'text' ); ?>" type="text" value="<?php echo $text; ?>" />
152
+ <input type="hidden" class="widefat ampforwp-widget-editor-id" id="<?php echo $this->get_field_id( 'widget_id' ); ?>" name="<?php echo $this->get_field_id( 'widget_id' ); ?>" type="text" value="<?php echo $this->number ?>" />
153
+ </p>
154
+
155
+ <?php
156
+
157
+ } // end form
158
+
159
+ /*--------------------------------------------------*/
160
+ /* Public Functions
161
+
162
+ <?php $text = isset( $instance['text'] ) ? esc_attr( $instance['text'] ) : '';
163
+
164
+ do_action( 'ampforwp_tinymce_editor', $instance['text'], $this->get_field_id( 'text' ), $this->get_field_name( 'text' ), $instance['type'] );?>
165
+
166
+ <textarea type="hidden" class="widefat hide" id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" cols="30" rows="10"> <?php echo $text; ?> </textarea>
167
+ /*--------------------------------------------------*/
168
+
169
+ /**
170
+ * Fired when the plugin is activated.
171
+ *
172
+ * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog.
173
+ */
174
+ public function activate( $network_wide ) {
175
+
176
+ } // end activate
177
+
178
+ /**
179
+ * Fired when the plugin is deactivated.
180
+ *
181
+ * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog
182
+ */
183
+ public function deactivate( $network_wide ) {
184
+
185
+ } // end deactivate
186
+
187
+ /**
188
+ * Registers and enqueues admin-specific styles.
189
+ */
190
+ public function register_admin_styles() {
191
+
192
+ } // end register_admin_styles
193
+
194
+ /**
195
+ * Registers and enqueues admin-specific JavaScript.
196
+ */
197
+ public function register_admin_scripts() {
198
+
199
+
200
+
201
+ } // end register_admin_scripts
202
+
203
+ public function footer_scritps() { ?>
204
+
205
+ <style>
206
+ .ampforwp-text-add:hover{
207
+ cursor: pointer;
208
+ }
209
+ .ampforwp-text-add.button {
210
+ margin-bottom: 10px;
211
+ }
212
+
213
+ </style>
214
+
215
+
216
+ <?php
217
+ }
218
+
219
+ /**
220
+ * Registers and enqueues widget-specific styles.
221
+ */
222
+ public function register_widget_styles() {
223
+
224
+ } // end register_widget_styles
225
+
226
+ /**
227
+ * Registers and enqueues widget-specific scripts.
228
+ */
229
+ public function register_widget_scripts() {
230
+
231
+ } // end register_widget_scripts
232
+
233
+ public function editor( $text, $editor_id, $name = '', $type = 'visual' ) {
234
+ wp_editor( $text, $editor_id, array( 'textarea_name' => $name, 'default_editor' => $type == 'visual' ? 'tmce' : 'html' ) );
235
+ }
236
+
237
+ public function hide_editor() {
238
+ $screen = get_current_screen();
239
+ if( $screen->id === "widgets" ) {
240
+ add_filter( 'user_can_richedit' , '__return_false', 50 );
241
+ }
242
+ }
243
+
244
+
245
+ } // end class
246
+
247
+
248
+ add_action( 'widgets_init', function(){
249
+ register_widget( 'AMPFORWP_Text_Widget' );
250
+ });
251
+
252
+
253
+
254
+
includes/modules/js/amp.js ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($) {
2
+ var count = 0;
3
+
4
+ //For Blurb Module
5
+ jQuery(".ampforwp-blurb-add").live('click', function(e) {
6
+ console.log('click');
7
+
8
+ event.preventDefault();
9
+ var additional = $(this).parent().parent().find('.ampforwp-blurb-additional');
10
+ var container = $(this).parent().parent().parent().parent();
11
+ var container_class = container.attr('id');
12
+ var container_class_array = container_class.split("ampforwp-blurb-").reverse();
13
+ var instance = container_class_array[0];
14
+ var add = $(this).parent().parent().find('.ampforwp-blurb-add');
15
+ count = additional.find('.widget-top').length;
16
+
17
+ additional.append('<div class="widget"><div class="widget-top"><div class="widget-title-action"> </div> <div class="widget-title"><h3> New Module<span class="in-widget-title"></span></h3></div></div><div class="widget-inside"><p><label for="widget-ampforwp-blurb['+instance+'][features]['+count+'][title]">Title</label>'+
18
+ '<input class="widefat" id="widget-ampforwp-blurb-'+instance+'-features-'+count+'-title" name="widget-ampforwp-blurb['+instance+'][features]['+count+'][title]" type="text" value="Heart Of The Landing Page" />'+
19
+ '<label for="widget-ampforwp-blurb['+instance+'][features]['+count+'][description]">Description</label>'+
20
+ '<textarea class="widefat" id="widget-ampforwp-blurb-'+instance+'-features-'+count+'-description" name="widget-ampforwp-blurb['+instance+'][features]['+count+'][description]" rows=\'6\' cols=\'50\'>This is a sample text which is being used for the dummy purpose to avoid confusion.</textarea> <span class="clear"></span></p>' + '<p> <label for=""> Image: </label><input type="button" class="select-img-'+count+' button left" style="width:auto;" value="Select Image" onclick="ampSelectImage('+count+');"/><input type="button" style="display:none" name="removeimg" id="remove-img-'+count+'" class="button button-secondary remove-img-button" data-count-type="'+count+'" value="Remove Image" onclick="removeImage('+count+')"><img src="http://i.imgur.com/5nPXqZG.png" class="preview-image block-image-'+count+'" >' + '<input type="hidden" id="amp-img-field-'+count+'" class="img'+count+'" style="width:auto;" name="widget-ampforwp-blurb['+instance+'][features]['+count+'][image]" id="'+instance+'-features-'+count+'" value="http://i.imgur.com/5nPXqZG.png" /></p>' + ' <p> <a class="ampforwp-blurb-remove delete button left">Remove Feature</a></p></div></div>');
21
+ });
22
+ jQuery(".ampforwp-blurb-remove").live('click', function() {
23
+ jQuery(this).parent().parent().parent().remove();
24
+ });
25
+
26
+ //For Text Module
27
+ jQuery(".ampforwp-text-add").live('click', function(e) {
28
+ console.log('click');
29
+
30
+ event.preventDefault();
31
+ var additional = $(this).parent().parent().find('.ampforwp-text-additional');
32
+ var container = $(this).parent().parent().parent().parent();
33
+ var container_class = container.attr('id');
34
+ var container_class_array = container_class.split("ampforwp-text-").reverse();
35
+ var instance = container_class_array[0];
36
+ var add = $(this).parent().parent().find('.ampforwp-text-add');
37
+ count = additional.find('.widget-top').length;
38
+
39
+ additional.append('<div class="widget"><div class="widget-top"><div class="widget-title-action"> </div> <div class="widget-title"><h3> New Module<span class="in-widget-title"></span></h3></div></div><div class="widget-inside"><p><label for="widget-ampforwp-text['+instance+'][features]['+count+'][title]">Title</label>'+
40
+ '<input class="widefat" id="widget-ampforwp-text-'+instance+'-features-'+count+'-title" name="widget-ampforwp-text['+instance+'][features]['+count+'][title]" type="text" value="This is the default title" />'+
41
+ '<label for="widget-ampforwp-text['+instance+'][features]['+count+'][description]">Description</label>'+
42
+ '<textarea class="widefat" id="widget-ampforwp-text-'+instance+'-features-'+count+'-description" name="widget-ampforwp-text['+instance+'][features]['+count+'][description]" rows=\'6\' cols=\'50\'>This is the description added by default </textarea> <span class="clear"></span></p>' + ' <p> <a class="ampforwp-text-remove delete button left">Remove Feature</a></p></div></div>' );
43
+ });
44
+ jQuery(".ampforwp-text-remove").live('click', function() {
45
+ jQuery(this).parent().parent().parent().remove();
46
+ });
47
+
48
+ //For Button Module
49
+ jQuery(".ampforwp-button-add").live('click', function(e) {
50
+ console.log('click');
51
+
52
+ event.preventDefault();
53
+ var additional = $(this).parent().parent().find('.ampforwp-button-additional');
54
+ var container = $(this).parent().parent().parent().parent();
55
+ var container_class = container.attr('id');
56
+ var container_class_array = container_class.split("ampforwp-button-").reverse();
57
+ var instance = container_class_array[0];
58
+ var add = $(this).parent().parent().find('.ampforwp-button-add');
59
+ count = additional.find('.widget-top').length;
60
+
61
+ additional.append('<div class="widget"><div class="widget-top"><div class="widget-title-action"> </div> <div class="widget-title"><h3> New Module<span class="in-widget-title"></span></h3></div></div><div class="widget-inside"><p><label for="widget-ampforwp-button['+instance+'][features]['+count+'][title]">Button Text</label>'+
62
+
63
+ //Text Fields
64
+ '<input class="widefat" id="widget-ampforwp-button-'+instance+'-features-'+count+'-title" name="widget-ampforwp-button['+instance+'][features]['+count+'][title]" type="text" value="Click Here" /></p>'+
65
+
66
+ '<p><label for="widget-ampforwp-button['+instance+'][features]['+count+'][url]">Url:</label>'+
67
+ '<input class="widefat" id="widget-ampforwp-button-'+instance+'-features-'+count+'-url" name="widget-ampforwp-button['+instance+'][features]['+count+'][url]" type="text" value="#" /></p>' +
68
+ // Radio
69
+ '<p> <label>URL Target:</label> <br />'+
70
+
71
+ '<label for="widget-ampforwp-button['+instance+'][features]['+count+']'+"-on"+'">New Tab </label>'+
72
+ '<input class="widefat" id="widget-ampforwp-button['+instance+'][features]['+count+']'+"-on"+'" name="widget-ampforwp-button['+instance+'][features]['+count+']'+'[radio]" type="radio" value="radio-on" />'+
73
+ '<label for="widget-ampforwp-button['+instance+'][features]['+count+']'+"-off"+'">Current </label>'+
74
+ '<input class="widefat" id="widget-ampforwp-button['+instance+'][features]['+count+']'+"-off"+'" name="widget-ampforwp-button['+instance+'][features]['+count+']'+'[radio]" type="radio" checked value="radio-off" /></p>'+
75
+ // Select
76
+ '<p> <label for="widget-ampforwp-button['+instance+']'+"-id-size"+'">Select Size:</label>'+
77
+ '<select id="widget-ampforwp-button-'+instance+'-id-size" class="widefat" name="widget-ampforwp-button['+instance+'][features]['+count+'][size]"> <option value="1">Small</option> <option value="2">Medium</option> <option value="3">Large</option> </select> </p>'+
78
+
79
+ '<p> <a class="ampforwp-button-remove delete button left">Remove Feature</a></p></div></div>' );
80
+ });
81
+
82
+
83
+ jQuery(".ampforwp-button-remove").live('click', function() {
84
+ jQuery(this).parent().parent().parent().remove();
85
+ });
86
+
87
+ // Tiny Mce code
88
+ $(document).on('widget-updated', function(event, widget){
89
+ var widget_id = $(widget).attr('id');
90
+ $('#'+widget_id + ' .switch-tmce').hide();
91
+ });
92
+
93
+ remove_button = jQuery('.remove-img-button');
94
+
95
+ remove_button.on('click', function(e) {
96
+
97
+ id = jQuery(this).attr('data-count-type')
98
+
99
+ imageToRemove = jQuery('.block-image-'+ id);
100
+
101
+ imageToRemove.attr('src','');
102
+
103
+ // remove_image_button_activation( id );
104
+
105
+ });
106
+
107
+
108
+ function remove_image_button_activation( id ) {
109
+
110
+ var currentImage = jQuery('.block-image-'+id).attr('src');
111
+
112
+
113
+ console.log(id );
114
+
115
+ if ( currentImage == undefined ) {
116
+ jQuery('#remove-img-'+id).hide();
117
+ } else {
118
+ jQuery('#remove-img-'+id).show();
119
+ }
120
+ }
121
+
122
+
123
+
124
+
125
+ });
126
+
127
+ var image_field1, image_field2, image_field3;
128
+
129
+ function ampSelectImage(count){
130
+
131
+ image_field1 = jQuery('#amp-img-field-'+count);
132
+ image_field2 = jQuery('.block-image-'+count);
133
+ image_field3 = jQuery('#remove-img-'+count);
134
+
135
+
136
+ imageSource = image_field2.attr('src');
137
+
138
+ if ( imageSource ) {
139
+ image_field3.show();
140
+ }
141
+
142
+ tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
143
+ window.send_to_editor = function(html) {
144
+
145
+
146
+ if(image_field1 != undefined){
147
+ imgurl = jQuery("<div>" + html + "</div>").find('img').attr('src');
148
+
149
+
150
+ image_field1.val(imgurl);
151
+ image_field2.attr('src',imgurl);
152
+ image_field2.show();
153
+ image_field3.show();
154
+ tb_remove();
155
+ }
156
+ }
157
+ return false;
158
+ }
includes/options/admin-config.php CHANGED
@@ -266,7 +266,7 @@ $args = array(
266
  'default_show' => false, // If true, shows the default value next to each field that is not the default value.
267
  'default_mark' => '', // What to print by the field's title if the value shown is default. Suggested: *
268
  'admin_bar' => false,
269
- 'admin_bar_icon' => 'dashicons-admin-generic',
270
  // CAREFUL -> These options are for advanced use only
271
  'output' => false, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
272
  'output_tag' => false, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
@@ -572,164 +572,6 @@ Redux::setArgs( "redux_builder_amp", $args );
572
  );
573
 
574
 
575
- // AMP GTM SECTION
576
- Redux::setSection( $opt_name, array(
577
- 'title' => __('Analytics'),
578
- // 'icon' => 'el el-th-large',
579
- 'desc' => __('You can either use Google Tag Manager or Other Analytics Providers','accelerated-mobile-pages'),
580
- 'subsection' => true,
581
- 'fields' =>
582
- array(
583
-
584
-
585
- array(
586
- 'id' => 'amp-analytics-select-option',
587
- 'type' => 'select',
588
- 'title' => __( 'Analytics Type', 'accelerated-mobile-pages' ),
589
- 'subtitle' => __( 'Select your Analytics provider.', 'accelerated-mobile-pages' ),
590
- 'options' => array(
591
- '1' => __('Google Analytics', 'accelerated-mobile-pages' ),
592
- '2' => __('Segment Analytics', 'accelerated-mobile-pages' ),
593
- '3' => __('Piwik Analytics', 'accelerated-mobile-pages' ),
594
- '4' => __('Quantcast Measurement', 'accelerated-mobile-pages' ),
595
- '5' => __('comScore', 'accelerated-mobile-pages' ),
596
- '6' => __('Effective Measure', 'accelerated-mobile-pages' ),
597
- '7' => __('StatCounter', 'accelerated-mobile-pages' ),
598
- ),
599
- 'required' => array(
600
- array('amp-use-gtm-option', '=' , '0'),
601
- ),
602
- 'default' => '1',
603
- ),
604
- array(
605
- 'id' => 'ga-feild',
606
- 'type' => 'text',
607
- 'title' => __( 'Google Analytics', 'accelerated-mobile-pages' ),
608
- 'required' => array(
609
- array('amp-use-gtm-option', '=' , '0'),
610
- array('amp-analytics-select-option', '=' , '1')
611
- ),
612
- 'subtitle' => __( 'Enter your Google Analytics ID.', 'accelerated-mobile-pages' ),
613
- 'desc' => __('Example: UA-XXXXX-Y', 'accelerated-mobile-pages' ),
614
- 'default' => 'UA-XXXXX-Y',
615
- ),
616
- array(
617
- 'id' => 'sa-feild',
618
- 'type' => 'text',
619
- 'title' => __( 'Segment Analytics', 'accelerated-mobile-pages' ),
620
- 'subtitle' => __( 'Enter your Segment Analytics Key.', 'accelerated-mobile-pages' ),
621
- 'required' => array(
622
- array('amp-use-gtm-option', '=' , '0'),
623
- array('amp-analytics-select-option', '=' , '2')
624
- ),
625
- 'default' => 'SEGMENT-WRITE-KEY',
626
- ),
627
- array(
628
- 'id' => 'pa-feild',
629
- 'type' => 'text',
630
- 'title' => __( 'Piwik Analytics', 'accelerated-mobile-pages' ),
631
- 'required' => array(
632
- array('amp-use-gtm-option', '=' , '0'),
633
- array('amp-analytics-select-option', '=' , '3')
634
- ),
635
- 'desc' => __( 'Example: https://piwik.example.org/piwik.php?idsite=YOUR_SITE_ID&rec=1&action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL&rand=RANDOM', 'accelerated-mobile-pages' ),
636
- 'subtitle' => __('Enter your Piwik Analytics URL.', 'accelerated-mobile-pages' ),
637
- 'default' => '#',
638
- ),
639
- array(
640
- 'id' => 'eam-feild',
641
- 'type' => 'text',
642
- 'title' => __( 'Effective Measure Analytics', 'accelerated-mobile-pages' ),
643
- 'required' => array(
644
- array('amp-use-gtm-option', '=' , '0'),
645
- array('amp-analytics-select-option', '=' , '6')
646
- ),
647
- 'desc' => __( 'Example: https://s.effectivemeasure.net/d/6/i?pu=CANONICAL_URL&ru=DOCUMENT_REFERRER&rnd=RANDOM', 'accelerated-mobile-pages' ),
648
- 'subtitle' => __('Enter your Effective Measure URL.', 'accelerated-mobile-pages' ),
649
- 'default' => '#',
650
- ),
651
- array(
652
- 'id' => 'sc-feild',
653
- 'type' => 'text',
654
- 'title' => __( 'StatCounter', 'accelerated-mobile-pages' ),
655
- 'required' => array(
656
- array('amp-use-gtm-option', '=' , '0'),
657
- array('amp-analytics-select-option', '=' , '7')
658
- ),
659
- 'desc' => __( 'Example: https://c.statcounter.com/PROJECT_ID/0/SECURITY_CODE/1/', 'accelerated-mobile-pages' ),
660
- 'subtitle' => __('Enter your StatCounter URL.', 'accelerated-mobile-pages' ),
661
- 'default' => '#',
662
- ),
663
-
664
- array(
665
- 'id' =>'amp-quantcast-analytics-code',
666
- 'type' => 'text',
667
- 'title' => __('p-code','accelerated-mobile-pages'),
668
- 'default' => '',
669
- 'required' => array(
670
- array('amp-analytics-select-option', '=' , '4')),
671
- ),
672
- array(
673
- 'id' =>'amp-comscore-analytics-code-c1',
674
- 'type' => 'text',
675
- 'title' => __('C1','accelerated-mobile-pages'),
676
- 'default' => 1,
677
- 'required' => array(
678
- array('amp-analytics-select-option', '=' , '5')),
679
- ),
680
- array(
681
- 'id' =>'amp-comscore-analytics-code-c2',
682
- 'type' => 'text',
683
- 'title' => __('C2','accelerated-mobile-pages'),
684
- 'default' => '',
685
- 'required' => array(
686
- array('amp-analytics-select-option', '=' , '5')),
687
- ),
688
-
689
- //GTM
690
- array(
691
- 'id' => 'amp-use-gtm-option',
692
- 'type' => 'switch',
693
- 'title' => __( 'Use Google Tag Manager', 'accelerated-mobile-pages' ),
694
- 'subtitle' => __( 'Select your Analytics provider.', 'accelerated-mobile-pages' ),
695
- 'default' => 0,
696
- ),
697
- array(
698
- 'id' =>'amp-gtm-id',
699
- 'type' => 'text',
700
- 'title' => __('Tag Manager ID (Container ID)','accelerated-mobile-pages'),
701
- 'default' => '',
702
- 'desc' => __('Eg: GTM-5XXXXXP','accelerated-mobile-pages'),
703
- // 'validate' => 'not_empty',
704
- 'required' => array(
705
- array('amp-use-gtm-option', '=' , '1')
706
- ),
707
- ),
708
- array(
709
- 'id' =>'amp-gtm-analytics-type',
710
- 'type' => 'text',
711
- 'title' => __('Analytics Type','accelerated-mobile-pages'),
712
- 'default' => '',
713
- 'desc' => __('Eg: googleanalytics','accelerated-mobile-pages'),
714
- // 'validate' => 'not_empty',
715
- 'required' => array(
716
- array('amp-use-gtm-option', '=' , '1')
717
- ),
718
- ),
719
- array(
720
- 'id' =>'amp-gtm-analytics-code',
721
- 'type' => 'text',
722
- 'title' => __('Analytics ID','accelerated-mobile-pages'),
723
- 'default' => '',
724
- 'desc' => 'Eg: UA-XXXXXX-Y',
725
- // 'validate' => 'not_empty',
726
- 'required' => array(
727
- array('amp-use-gtm-option', '=' , '1')),
728
- ),
729
-
730
- )
731
- )
732
- );
733
 
734
 
735
  //code for fetching ctegories to show as a list in redux settings
@@ -932,130 +774,106 @@ Redux::setArgs( "redux_builder_amp", $args );
932
 
933
  );
934
 
935
- // SEO SECTION
936
- Redux::setSection( $opt_name, array(
937
- 'title' => __( 'SEO', 'accelerated-mobile-pages' ),
938
- 'id' => 'amp-seo',
939
- 'subsection' => true,
940
- 'fields' => array(
941
-
942
- array(
943
- 'id' => 'ampforwp-seo-meta-description',
944
- 'type' => 'switch',
945
- 'title' => __('Meta Description', 'accelerated-mobile-pages'),
946
- 'subtitle' => __('The meta tag that displays in head', 'accelerated-mobile-pages'),
947
- 'default' => 0
948
- ),
949
-
950
- array(
951
- 'id' => 'ampforwp-seo-custom-additional-meta',
952
- 'type' => 'textarea',
953
- 'title' => __('Additional tags for Head section AMP page', 'accelerated-mobile-pages'),
954
- 'subtitle' => __('Adds additional Meta to the head section', 'accelerated-mobile-pages', 'accelerated-mobile-pages'),
955
- 'desc' => __('Only link and meta tags allowed', 'accelerated-mobile-pages'),
956
- 'placeholder' => __('<!-- Paste your Additional HTML , that goes between <head> </head> tags -->','accelerated-mobile-pages')
957
- ),
958
-
959
-
960
- array(
961
- 'id' => 'ampforwp-yoast-seo-sub-section',
962
- 'type' => 'section',
963
- 'title' => __('Yoast SEO Options', 'accelerated-mobile-pages'),
964
- 'indent' => true
965
- ),
966
-
967
- array(
968
- 'id' => 'ampforwp-seo-yoast-meta',
969
- 'type' => 'switch',
970
- 'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
971
- 'title' => __( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
972
- 'default' => '1'
973
- ),
974
- array(
975
- 'id' => 'ampforwp-seo-yoast-description',
976
- 'type' => 'switch',
977
- 'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
978
- 'title' => __( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
979
- 'default' => 0
980
- ),
981
-
982
- array(
983
- 'id' => 'ampforwp-seo-index-noindex-sub-section',
984
- 'type' => 'section',
985
- 'title' => __('Advanced Index & No Index Options', 'accelerated-mobile-pages'),
986
- 'indent' => true
987
- ),
988
- array(
989
- 'id' => 'ampforwp-robots-archive-sub-pages-sitewide',
990
- 'type' => 'switch',
991
- 'title' => __('Archive subpages (sitewide)', 'accelerated-mobile-pages'),
992
- 'desc' => __("Such as /page/2 so on and so forth",'accelerated-mobile-pages'),
993
- 'default' => 0,
994
- 'on' => 'index',
995
- 'off' => 'noindex'
996
- ),
997
- array(
998
- 'id' => 'ampforwp-robots-archive-author-pages',
999
- 'type' => 'switch',
1000
- 'title' => __('Author Archive pages', 'accelerated-mobile-pages'),
1001
- 'default' => 1,
1002
- 'on' => 'index',
1003
- 'off' => 'noindex'
1004
-
1005
- ),
1006
- array(
1007
- 'id' => 'ampforwp-robots-archive-date-pages',
1008
- 'type' => 'switch',
1009
- 'title' => __('Date Archive pages', 'accelerated-mobile-pages'),
1010
- 'default' => 1,
1011
- 'on' => 'index',
1012
- 'off' => 'noindex'
1013
-
1014
- ),
1015
- array(
1016
- 'id' => 'ampforwp-robots-archive-category-pages',
1017
- 'type' => 'switch',
1018
- 'title' => __('Categories', 'accelerated-mobile-pages'),
1019
- 'default' => 1,
1020
- 'on' => 'index',
1021
- 'off' => 'noindex'
1022
- ),
1023
- array(
1024
- 'id' => 'ampforwp-robots-archive-tag-pages',
1025
- 'type' => 'switch',
1026
- 'title' => __('Tags', 'accelerated-mobile-pages'),
1027
- 'default' => 1,
1028
- 'on' => 'index',
1029
- 'off' => 'noindex'
1030
- ),
1031
-
1032
 
1033
- )
1034
 
1035
- )
1036
 
1037
- );
1038
- // AMP Menu SECTION
1039
- Redux::setSection( $opt_name, array(
1040
- 'title' => __( 'Menu', 'accelerated-mobile-pages' ),
1041
- 'desc' => __( 'Add Menus to your AMP pages by clicking on this <a href="'.trailingslashit(get_admin_url()).'nav-menus.php?action=locations">link</a>' , 'accelerated-mobile-pages'),
1042
- 'id' => 'amp-menus',
1043
- 'subsection' => true,
1044
- 'fields' => array(
 
 
1045
 
1046
- array(
1047
- 'id' => 'ampforwp-auto-amp-menu-link',
1048
- 'type' => 'switch',
1049
- 'title' => __('Auto Add AMP in Menu URL', 'accelerated-mobile-pages'),
1050
- 'subtitle' => __('Automatically add <code>AMP</code> at the end of menu url', 'accelerated-mobile-pages'),
1051
- 'true' => 'true',
1052
- 'false' => 'false',
1053
- 'default' => 0
1054
- ),
1055
- )
1056
- )
1057
 
1058
- ) ;
 
 
1059
 
1060
  $AD_URL = "http://ampforwp.com/advanced-amp-ads/#utm_source=options-panel&utm_medium=advertisement-tab&utm_campaign=AMP%20Plugin";
1061
  $desc = '';
@@ -1355,112 +1173,57 @@ Redux::setArgs( "redux_builder_amp", $args );
1355
  ) );
1356
 
1357
 
1358
- // Single Section
1359
- Redux::setSection( $opt_name, array(
1360
- 'title' => __( 'Single', 'accelerated-mobile-pages' ),
1361
- // 'desc' => __( 'Additional Options to control the look of Single <a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'"> Click here </a> ', 'accelerated-mobile-pages' ),
1362
- 'id' => 'amp-single',
1363
- 'subsection' => true,
1364
- 'fields' => array(
1365
- // Social Icons ON/OFF
1366
- array(
1367
- 'id' => 'enable-single-social-icons',
1368
- 'type' => 'switch',
1369
- 'title' => __('Sticky Social Icons', 'accelerated-mobile-pages'),
1370
- 'default' => 1,
1371
- 'subtitle' => __('Enable Social Icons in single', 'accelerated-mobile-pages'),
1372
- ),
1373
- array(
1374
- 'id' => 'enable-excerpt-single',
1375
- 'type' => 'switch',
1376
- 'title' => __('Excerpt in single', 'accelerated-mobile-pages'),
1377
- 'default' => 0,
1378
- 'subtitle' => __('Enable feature to add Excerpt above Content in single', 'accelerated-mobile-pages'),
1379
- ),
1380
- //deselectable next previous links
1381
- array(
1382
- 'id' => 'enable-single-next-prev',
1383
- 'type' => 'switch',
1384
- 'title' => __('Next-Previous Links', 'accelerated-mobile-pages'),
1385
- 'default' => 1,
1386
- 'subtitle' => __('Enable Next-Previous links in single', 'accelerated-mobile-pages'),
1387
- ),
1388
- // Post Modified Date
1389
- array(
1390
- 'id' => 'post-modified-date',
1391
- 'type' => 'switch',
1392
- 'title' => __('Show Post Modified Date', 'accelerated-mobile-pages'),
1393
- 'default' => 0,
1394
- 'subtitle' => __('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
1395
- ),
1396
- // Author Bio
1397
- array(
1398
- 'id' => 'amp-author-description',
1399
- 'type' => 'switch',
1400
- 'title' => __( 'Author Bio in Single', 'accelerated-mobile-pages' ),
1401
- 'default' => '1',
1402
- ),
1403
- // Date on Single
1404
- array(
1405
- 'id' => 'amp-design-3-date-feature',
1406
- 'type' => 'switch',
1407
- 'title' => __( 'Display Date on Single', 'accelerated-mobile-pages' ),
1408
- 'required' => array(
1409
- array('amp-design-selector', '=' , '3')
1410
- ),
1411
- 'desc' => __('Display date along with author and category', 'accelerated-mobile-pages' ),
1412
- 'default' => '0'
1413
- ),
1414
- // Related Post
1415
- array(
1416
- 'id' => 'ampforwp-single-select-type-of-related',
1417
- 'type' => 'select',
1418
- 'title' => __('Show Related Post from', 'accelerated-mobile-pages'),
1419
- 'data' => 'page',
1420
- 'subtitle' => __('select the type of related posts', 'accelerated-mobile-pages'),
1421
- 'options' => array(
1422
- '1' => 'Tags',
1423
- '2' => 'Categories'
1424
- ),
1425
- 'default' => '2',
1426
- ),
1427
- array(
1428
- 'id' => 'ampforwp-number-of-related-posts',
1429
- 'type' => 'text',
1430
- 'title' => __('Number of Related Post', 'accelerated-mobile-pages'),
1431
- 'subtitle' => __('Type the number of related posts you need, Eg : 2', 'accelerated-mobile-pages'),
1432
- 'validate' => 'numeric',
1433
- 'default' => '3',
1434
- ),
1435
 
 
 
 
 
 
 
 
 
 
 
 
1436
 
 
1437
 
1438
- // array(
1439
- // 'id' => 'ampforwp-comments-banner',
1440
- // 'type' => 'select',
1441
- // 'desc' => $comment_desc,
1442
- // 'title' => __(' df', 'accelerated-mobile-pages'),
1443
- // 'class' => 'new-class',
1444
- //
1445
- // // 'desc' => ' <br /><a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'" target="_blank"><img class="ampforwp-post-builder-img" src="'.AMPFORWP_IMAGE_DIR . '/amp-post-builder.png" width="489" height="72" /></a>',
1446
- // ),
1447
- //
1448
 
1449
- $fields = array(
1450
- 'id' => 'info_normal',
1451
- 'type' => 'info',
1452
- 'class' => 'extension_banner_bg',
1453
- 'desc' => $single_extension_listing )
 
 
1454
 
1455
- ),
 
 
 
 
 
 
 
 
 
 
1456
 
1457
- ) );
1458
 
1459
- // Social Section
1460
  Redux::setSection( $opt_name, array(
1461
- 'title' => __( 'Social Share', 'accelerated-mobile-pages' ),
1462
  'id' => 'amp-social',
1463
- 'desc' => __('enable social share and your social profiels here','accelerated-mobile-pages'),
1464
  'subsection' => true,
1465
  'fields' => array(
1466
  // Facebook ON/OFF
@@ -1552,7 +1315,7 @@ Redux::setArgs( "redux_builder_amp", $args );
1552
  array(
1553
  'id' => 'enable-single-twittter-profile',
1554
  'type' => 'switch',
1555
- 'title' => __('Twittter ', 'accelerated-mobile-pages'),
1556
  'default' => 1,
1557
  'required' => array(
1558
  array('amp-design-selector', '=' , '3')
@@ -1561,7 +1324,7 @@ Redux::setArgs( "redux_builder_amp", $args );
1561
  array(
1562
  'id' => 'enable-single-twittter-profile-url',
1563
  'type' => 'text',
1564
- 'title' => __('Twittter URL', 'accelerated-mobile-pages'),
1565
  'default' => '#',
1566
  'required' => array(
1567
  array('amp-design-selector', '=' , '3'),
@@ -1773,6 +1536,270 @@ Redux::setArgs( "redux_builder_amp", $args );
1773
  )
1774
  ) );
1775
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1776
  // Structured Data
1777
  Redux::setSection( $opt_name, array(
1778
  'title' => __( 'Structured Data', 'accelerated-mobile-pages' ),
@@ -1850,6 +1877,82 @@ Redux::setArgs( "redux_builder_amp", $args );
1850
 
1851
  ) );
1852
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1853
  // Translation Panel
1854
  Redux::setSection( $opt_name, array(
1855
  'title' => __( 'Translation Panel', 'accelerated-mobile-pages' ),
@@ -2150,57 +2253,6 @@ Redux::setArgs( "redux_builder_amp", $args );
2150
 
2151
 
2152
 
2153
- // Comments
2154
- Redux::setSection( $opt_name, array(
2155
- 'title' => __( 'Comments', 'accelerated-mobile-pages' ),
2156
- 'desc' => $comment_desc,
2157
- 'id' => 'disqus-comments',
2158
- 'subsection' => true,
2159
- 'fields' => array(
2160
- array(
2161
- 'id' => 'ampforwp-disqus-comments-support',
2162
- 'type' => 'switch',
2163
- 'title' => __('Disqus comments Support', 'accelerated-mobile-pages'),
2164
- 'subtitle' => __('Enable/Disable Disqus comments using this switch.', 'accelerated-mobile-pages'),
2165
- 'default' => 0
2166
- ),
2167
- array(
2168
- 'id' => 'ampforwp-disqus-comments-name',
2169
- 'type' => 'text',
2170
- 'title' => __('Disqus Name', 'accelerated-mobile-pages'),
2171
- 'subtitle' => __('Eg: https://xyz.disqus.com', 'accelerated-mobile-pages'),
2172
- 'required' => array('ampforwp-disqus-comments-support', '=' , '1'),
2173
- 'default' => ''
2174
- ),
2175
-
2176
- array(
2177
- 'id' => 'ampforwp-disqus-host-position',
2178
- 'type' => 'switch',
2179
- 'title' => __('Host Disqus Comments through AMPforWP Servers', 'accelerated-mobile-pages'),
2180
- 'subtitle' => __('Use AMPforWP secure servers to serve Comments file. Recommended if your site is non HTTPS', 'accelerated-mobile-pages'),
2181
- 'default' => 1,
2182
- 'required' => array('ampforwp-disqus-comments-support', '=' , '1'),
2183
- ),
2184
-
2185
- array(
2186
- 'id' => 'ampforwp-disqus-host-file',
2187
- 'type' => 'text',
2188
- 'title' => __('Disqus Host File', 'accelerated-mobile-pages'),
2189
- 'subtitle' => __('<a href="https://ampforwp.com/host-disqus-comments/"> Click here to know, How to Setup Disqus Host file on your servers </a>', 'accelerated-mobile-pages'),
2190
- 'placeholder' => 'https://comments.example.com/disqus.php',
2191
- 'required' => array('ampforwp-disqus-host-position', '=' , '0'),
2192
- ),
2193
- array(
2194
- 'id' => 'ampforwp-number-of-comments',
2195
- 'type' => 'text',
2196
- 'desc' => __('This refers to the normal comments','accelerated-mobile-pages'),
2197
- 'title' => __('No of Comments', 'accelerated-mobile-pages'),
2198
- 'default' => 10,
2199
- 'required' => array('ampforwp-disqus-comments-support' , '=' , 0)
2200
- ),
2201
- )
2202
- ) );
2203
-
2204
 
2205
  // Advance Settings SECTION
2206
  Redux::setSection( $opt_name, array(
266
  'default_show' => false, // If true, shows the default value next to each field that is not the default value.
267
  'default_mark' => '', // What to print by the field's title if the value shown is default. Suggested: *
268
  'admin_bar' => false,
269
+ 'admin_bar_icon' => 'dashicons-admin-generic',
270
  // CAREFUL -> These options are for advanced use only
271
  'output' => false, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
272
  'output_tag' => false, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
572
  );
573
 
574
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
 
576
 
577
  //code for fetching ctegories to show as a list in redux settings
774
 
775
  );
776
 
777
+ // Single Section
778
+ Redux::setSection( $opt_name, array(
779
+ 'title' => __( 'Single', 'accelerated-mobile-pages' ),
780
+ // 'desc' => __( 'Additional Options to control the look of Single <a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'"> Click here </a> ', 'accelerated-mobile-pages' ),
781
+ 'id' => 'amp-single',
782
+ 'subsection' => true,
783
+ 'fields' => array(
784
+ // Social Icons ON/OFF
785
+ array(
786
+ 'id' => 'enable-single-social-icons',
787
+ 'type' => 'switch',
788
+ 'title' => __('Sticky Social Icons', 'accelerated-mobile-pages'),
789
+ 'default' => 1,
790
+ 'subtitle' => __('Enable Social Icons in single', 'accelerated-mobile-pages'),
791
+ ),
792
+ array(
793
+ 'id' => 'enable-excerpt-single',
794
+ 'type' => 'switch',
795
+ 'title' => __('Excerpt in single', 'accelerated-mobile-pages'),
796
+ 'default' => 0,
797
+ 'subtitle' => __('Enable feature to add Excerpt above Content in single', 'accelerated-mobile-pages'),
798
+ ),
799
+ //deselectable next previous links
800
+ array(
801
+ 'id' => 'enable-single-next-prev',
802
+ 'type' => 'switch',
803
+ 'title' => __('Next-Previous Links', 'accelerated-mobile-pages'),
804
+ 'default' => 1,
805
+ 'subtitle' => __('Enable Next-Previous links in single', 'accelerated-mobile-pages'),
806
+ ),
807
+ // Post Modified Date
808
+ array(
809
+ 'id' => 'post-modified-date',
810
+ 'type' => 'switch',
811
+ 'title' => __('Show Post Modified Date', 'accelerated-mobile-pages'),
812
+ 'default' => 0,
813
+ 'subtitle' => __('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
814
+ ),
815
+ // Author Bio
816
+ array(
817
+ 'id' => 'amp-author-description',
818
+ 'type' => 'switch',
819
+ 'title' => __( 'Author Bio in Single', 'accelerated-mobile-pages' ),
820
+ 'default' => '1',
821
+ ),
822
+ // Date on Single
823
+ array(
824
+ 'id' => 'amp-design-3-date-feature',
825
+ 'type' => 'switch',
826
+ 'title' => __( 'Display Date on Single', 'accelerated-mobile-pages' ),
827
+ 'required' => array(
828
+ array('amp-design-selector', '=' , '3')
829
+ ),
830
+ 'desc' => __('Display date along with author and category', 'accelerated-mobile-pages' ),
831
+ 'default' => '0'
832
+ ),
833
+ // Related Post
834
+ array(
835
+ 'id' => 'ampforwp-single-select-type-of-related',
836
+ 'type' => 'select',
837
+ 'title' => __('Show Related Post from', 'accelerated-mobile-pages'),
838
+ 'data' => 'page',
839
+ 'subtitle' => __('select the type of related posts', 'accelerated-mobile-pages'),
840
+ 'options' => array(
841
+ '1' => 'Tags',
842
+ '2' => 'Categories'
843
+ ),
844
+ 'default' => '2',
845
+ ),
846
+ array(
847
+ 'id' => 'ampforwp-number-of-related-posts',
848
+ 'type' => 'text',
849
+ 'title' => __('Number of Related Post', 'accelerated-mobile-pages'),
850
+ 'subtitle' => __('Type the number of related posts you need, Eg : 2', 'accelerated-mobile-pages'),
851
+ 'validate' => 'numeric',
852
+ 'default' => '3',
853
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
 
 
855
 
 
856
 
857
+ // array(
858
+ // 'id' => 'ampforwp-comments-banner',
859
+ // 'type' => 'select',
860
+ // 'desc' => $comment_desc,
861
+ // 'title' => __(' df', 'accelerated-mobile-pages'),
862
+ // 'class' => 'new-class',
863
+ //
864
+ // // 'desc' => ' <br /><a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'" target="_blank"><img class="ampforwp-post-builder-img" src="'.AMPFORWP_IMAGE_DIR . '/amp-post-builder.png" width="489" height="72" /></a>',
865
+ // ),
866
+ //
867
 
868
+ $fields = array(
869
+ 'id' => 'info_normal',
870
+ 'type' => 'info',
871
+ 'class' => 'extension_banner_bg',
872
+ 'desc' => $single_extension_listing )
 
 
 
 
 
 
873
 
874
+ ),
875
+
876
+ ) );
877
 
878
  $AD_URL = "http://ampforwp.com/advanced-amp-ads/#utm_source=options-panel&utm_medium=advertisement-tab&utm_campaign=AMP%20Plugin";
879
  $desc = '';
1173
  ) );
1174
 
1175
 
1176
+ // AMP Content Builder SECTION
1177
+ // Redux::setSection( $opt_name, array(
1178
+ // 'title' => __( 'Content Builder', 'accelerated-mobile-pages' ),
1179
+ // 'desc' => __( 'With AMP Content Builder, you can easily build landing pages for AMP with Drag and drop UI of widgets. <a href="'.trailingslashit(get_admin_url()).'nav-menus.php?action=locations">Learn More</a>' , 'accelerated-mobile-pages'),
1180
+ // 'id' => 'amp-content-builder',
1181
+ // 'class' => 'amp_content_builder',
1182
+ // 'subsection' => true,
1183
+ // 'fields' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1184
 
1185
+ // array(
1186
+ // 'id' => 'ampforwp-content-builder',
1187
+ // 'type' => 'switch',
1188
+ // 'title' => __('Content Builder for AMP', 'accelerated-mobile-pages'),
1189
+ // 'subtitle' => __('Build AMP Landing pages in minutes.', 'accelerated-mobile-pages'),
1190
+ // 'true' => 'true',
1191
+ // 'false' => 'false',
1192
+ // 'default' => 1
1193
+ // ),
1194
+ // )
1195
+ // )
1196
 
1197
+ // ) ;
1198
 
 
 
 
 
 
 
 
 
 
 
1199
 
1200
+ // AMP Menu SECTION
1201
+ Redux::setSection( $opt_name, array(
1202
+ 'title' => __( 'Menu', 'accelerated-mobile-pages' ),
1203
+ 'desc' => __( 'Add Menus to your AMP pages by clicking on this <a href="'.trailingslashit(get_admin_url()).'nav-menus.php?action=locations">link</a>' , 'accelerated-mobile-pages'),
1204
+ 'id' => 'amp-menus',
1205
+ 'subsection' => true,
1206
+ 'fields' => array(
1207
 
1208
+ array(
1209
+ 'id' => 'ampforwp-auto-amp-menu-link',
1210
+ 'type' => 'switch',
1211
+ 'title' => __('Auto Add AMP in Menu URL', 'accelerated-mobile-pages'),
1212
+ 'subtitle' => __('Automatically add <code>AMP</code> at the end of menu url', 'accelerated-mobile-pages'),
1213
+ 'true' => 'true',
1214
+ 'false' => 'false',
1215
+ 'default' => 0
1216
+ ),
1217
+ )
1218
+ )
1219
 
1220
+ ) ;
1221
 
1222
+ // Social Section
1223
  Redux::setSection( $opt_name, array(
1224
+ 'title' => __( 'Social', 'accelerated-mobile-pages' ),
1225
  'id' => 'amp-social',
1226
+ 'desc' => __('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
1227
  'subsection' => true,
1228
  'fields' => array(
1229
  // Facebook ON/OFF
1315
  array(
1316
  'id' => 'enable-single-twittter-profile',
1317
  'type' => 'switch',
1318
+ 'title' => __('Twitter ', 'accelerated-mobile-pages'),
1319
  'default' => 1,
1320
  'required' => array(
1321
  array('amp-design-selector', '=' , '3')
1324
  array(
1325
  'id' => 'enable-single-twittter-profile-url',
1326
  'type' => 'text',
1327
+ 'title' => __('Twitter URL', 'accelerated-mobile-pages'),
1328
  'default' => '#',
1329
  'required' => array(
1330
  array('amp-design-selector', '=' , '3'),
1536
  )
1537
  ) );
1538
 
1539
+
1540
+ // SEO SECTION
1541
+ Redux::setSection( $opt_name, array(
1542
+ 'title' => __( 'SEO', 'accelerated-mobile-pages' ),
1543
+ 'id' => 'amp-seo',
1544
+ 'subsection' => true,
1545
+ 'fields' => array(
1546
+
1547
+ array(
1548
+ 'id' => 'ampforwp-seo-meta-description',
1549
+ 'type' => 'switch',
1550
+ 'title' => __('Meta Description', 'accelerated-mobile-pages'),
1551
+ 'subtitle' => __('The meta tag that displays in head', 'accelerated-mobile-pages'),
1552
+ 'default' => 0
1553
+ ),
1554
+
1555
+ array(
1556
+ 'id' => 'ampforwp-seo-custom-additional-meta',
1557
+ 'type' => 'textarea',
1558
+ 'title' => __('Additional tags for Head section AMP page', 'accelerated-mobile-pages'),
1559
+ 'subtitle' => __('Adds additional Meta to the head section', 'accelerated-mobile-pages', 'accelerated-mobile-pages'),
1560
+ 'desc' => __('Only link and meta tags allowed', 'accelerated-mobile-pages'),
1561
+ 'placeholder' => __('<!-- Paste your Additional HTML , that goes between <head> </head> tags -->','accelerated-mobile-pages')
1562
+ ),
1563
+
1564
+
1565
+ array(
1566
+ 'id' => 'ampforwp-yoast-seo-sub-section',
1567
+ 'type' => 'section',
1568
+ 'title' => __('Yoast SEO Options', 'accelerated-mobile-pages'),
1569
+ 'indent' => true
1570
+ ),
1571
+
1572
+ array(
1573
+ 'id' => 'ampforwp-seo-yoast-meta',
1574
+ 'type' => 'switch',
1575
+ 'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
1576
+ 'title' => __( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
1577
+ 'default' => '1'
1578
+ ),
1579
+ array(
1580
+ 'id' => 'ampforwp-seo-yoast-description',
1581
+ 'type' => 'switch',
1582
+ 'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
1583
+ 'title' => __( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
1584
+ 'default' => 0
1585
+ ),
1586
+
1587
+ array(
1588
+ 'id' => 'ampforwp-seo-index-noindex-sub-section',
1589
+ 'type' => 'section',
1590
+ 'title' => __('Advanced Index & No Index Options', 'accelerated-mobile-pages'),
1591
+ 'indent' => true
1592
+ ),
1593
+ array(
1594
+ 'id' => 'ampforwp-robots-archive-sub-pages-sitewide',
1595
+ 'type' => 'switch',
1596
+ 'title' => __('Archive subpages (sitewide)', 'accelerated-mobile-pages'),
1597
+ 'desc' => __("Such as /page/2 so on and so forth",'accelerated-mobile-pages'),
1598
+ 'default' => 0,
1599
+ 'on' => 'index',
1600
+ 'off' => 'noindex'
1601
+ ),
1602
+ array(
1603
+ 'id' => 'ampforwp-robots-archive-author-pages',
1604
+ 'type' => 'switch',
1605
+ 'title' => __('Author Archive pages', 'accelerated-mobile-pages'),
1606
+ 'default' => 1,
1607
+ 'on' => 'index',
1608
+ 'off' => 'noindex'
1609
+
1610
+ ),
1611
+ array(
1612
+ 'id' => 'ampforwp-robots-archive-date-pages',
1613
+ 'type' => 'switch',
1614
+ 'title' => __('Date Archive pages', 'accelerated-mobile-pages'),
1615
+ 'default' => 1,
1616
+ 'on' => 'index',
1617
+ 'off' => 'noindex'
1618
+
1619
+ ),
1620
+ array(
1621
+ 'id' => 'ampforwp-robots-archive-category-pages',
1622
+ 'type' => 'switch',
1623
+ 'title' => __('Categories', 'accelerated-mobile-pages'),
1624
+ 'default' => 1,
1625
+ 'on' => 'index',
1626
+ 'off' => 'noindex'
1627
+ ),
1628
+ array(
1629
+ 'id' => 'ampforwp-robots-archive-tag-pages',
1630
+ 'type' => 'switch',
1631
+ 'title' => __('Tags', 'accelerated-mobile-pages'),
1632
+ 'default' => 1,
1633
+ 'on' => 'index',
1634
+ 'off' => 'noindex'
1635
+ ),
1636
+
1637
+
1638
+ )
1639
+
1640
+ )
1641
+
1642
+ );
1643
+
1644
+ // Analytics SECTION
1645
+ Redux::setSection( $opt_name, array(
1646
+ 'title' => __('Analytics'),
1647
+ // 'icon' => 'el el-th-large',
1648
+ 'desc' => __('You can either use Google Tag Manager or Other Analytics Providers','accelerated-mobile-pages'),
1649
+ 'subsection' => true,
1650
+ 'fields' =>
1651
+ array(
1652
+
1653
+
1654
+ array(
1655
+ 'id' => 'amp-analytics-select-option',
1656
+ 'type' => 'select',
1657
+ 'title' => __( 'Analytics Type', 'accelerated-mobile-pages' ),
1658
+ 'subtitle' => __( 'Select your Analytics provider.', 'accelerated-mobile-pages' ),
1659
+ 'options' => array(
1660
+ '1' => __('Google Analytics', 'accelerated-mobile-pages' ),
1661
+ '2' => __('Segment Analytics', 'accelerated-mobile-pages' ),
1662
+ '3' => __('Piwik Analytics', 'accelerated-mobile-pages' ),
1663
+ '4' => __('Quantcast Measurement', 'accelerated-mobile-pages' ),
1664
+ '5' => __('comScore', 'accelerated-mobile-pages' ),
1665
+ '6' => __('Effective Measure', 'accelerated-mobile-pages' ),
1666
+ '7' => __('StatCounter', 'accelerated-mobile-pages' ),
1667
+ ),
1668
+ 'required' => array(
1669
+ array('amp-use-gtm-option', '=' , '0'),
1670
+ ),
1671
+ 'default' => '1',
1672
+ ),
1673
+ array(
1674
+ 'id' => 'ga-feild',
1675
+ 'type' => 'text',
1676
+ 'title' => __( 'Google Analytics', 'accelerated-mobile-pages' ),
1677
+ 'required' => array(
1678
+ array('amp-use-gtm-option', '=' , '0'),
1679
+ array('amp-analytics-select-option', '=' , '1')
1680
+ ),
1681
+ 'subtitle' => __( 'Enter your Google Analytics ID.', 'accelerated-mobile-pages' ),
1682
+ 'desc' => __('Example: UA-XXXXX-Y', 'accelerated-mobile-pages' ),
1683
+ 'default' => 'UA-XXXXX-Y',
1684
+ ),
1685
+ array(
1686
+ 'id' => 'sa-feild',
1687
+ 'type' => 'text',
1688
+ 'title' => __( 'Segment Analytics', 'accelerated-mobile-pages' ),
1689
+ 'subtitle' => __( 'Enter your Segment Analytics Key.', 'accelerated-mobile-pages' ),
1690
+ 'required' => array(
1691
+ array('amp-use-gtm-option', '=' , '0'),
1692
+ array('amp-analytics-select-option', '=' , '2')
1693
+ ),
1694
+ 'default' => 'SEGMENT-WRITE-KEY',
1695
+ ),
1696
+ array(
1697
+ 'id' => 'pa-feild',
1698
+ 'type' => 'text',
1699
+ 'title' => __( 'Piwik Analytics', 'accelerated-mobile-pages' ),
1700
+ 'required' => array(
1701
+ array('amp-use-gtm-option', '=' , '0'),
1702
+ array('amp-analytics-select-option', '=' , '3')
1703
+ ),
1704
+ 'desc' => __( 'Example: https://piwik.example.org/piwik.php?idsite=YOUR_SITE_ID&rec=1&action_name=TITLE&urlref=DOCUMENT_REFERRER&url=CANONICAL_URL&rand=RANDOM', 'accelerated-mobile-pages' ),
1705
+ 'subtitle' => __('Enter your Piwik Analytics URL.', 'accelerated-mobile-pages' ),
1706
+ 'default' => '#',
1707
+ ),
1708
+ array(
1709
+ 'id' => 'eam-feild',
1710
+ 'type' => 'text',
1711
+ 'title' => __( 'Effective Measure Analytics', 'accelerated-mobile-pages' ),
1712
+ 'required' => array(
1713
+ array('amp-use-gtm-option', '=' , '0'),
1714
+ array('amp-analytics-select-option', '=' , '6')
1715
+ ),
1716
+ 'desc' => __( 'Example: https://s.effectivemeasure.net/d/6/i?pu=CANONICAL_URL&ru=DOCUMENT_REFERRER&rnd=RANDOM', 'accelerated-mobile-pages' ),
1717
+ 'subtitle' => __('Enter your Effective Measure URL.', 'accelerated-mobile-pages' ),
1718
+ 'default' => '#',
1719
+ ),
1720
+ array(
1721
+ 'id' => 'sc-feild',
1722
+ 'type' => 'text',
1723
+ 'title' => __( 'StatCounter', 'accelerated-mobile-pages' ),
1724
+ 'required' => array(
1725
+ array('amp-use-gtm-option', '=' , '0'),
1726
+ array('amp-analytics-select-option', '=' , '7')
1727
+ ),
1728
+ 'desc' => __( 'Example: https://c.statcounter.com/PROJECT_ID/0/SECURITY_CODE/1/', 'accelerated-mobile-pages' ),
1729
+ 'subtitle' => __('Enter your StatCounter URL.', 'accelerated-mobile-pages' ),
1730
+ 'default' => '#',
1731
+ ),
1732
+
1733
+ array(
1734
+ 'id' =>'amp-quantcast-analytics-code',
1735
+ 'type' => 'text',
1736
+ 'title' => __('p-code','accelerated-mobile-pages'),
1737
+ 'default' => '',
1738
+ 'required' => array(
1739
+ array('amp-analytics-select-option', '=' , '4')),
1740
+ ),
1741
+ array(
1742
+ 'id' =>'amp-comscore-analytics-code-c1',
1743
+ 'type' => 'text',
1744
+ 'title' => __('C1','accelerated-mobile-pages'),
1745
+ 'default' => 1,
1746
+ 'required' => array(
1747
+ array('amp-analytics-select-option', '=' , '5')),
1748
+ ),
1749
+ array(
1750
+ 'id' =>'amp-comscore-analytics-code-c2',
1751
+ 'type' => 'text',
1752
+ 'title' => __('C2','accelerated-mobile-pages'),
1753
+ 'default' => '',
1754
+ 'required' => array(
1755
+ array('amp-analytics-select-option', '=' , '5')),
1756
+ ),
1757
+
1758
+ //GTM
1759
+ array(
1760
+ 'id' => 'amp-use-gtm-option',
1761
+ 'type' => 'switch',
1762
+ 'title' => __( 'Use Google Tag Manager', 'accelerated-mobile-pages' ),
1763
+ 'subtitle' => __( 'Select your Analytics provider.', 'accelerated-mobile-pages' ),
1764
+ 'default' => 0,
1765
+ ),
1766
+ array(
1767
+ 'id' =>'amp-gtm-id',
1768
+ 'type' => 'text',
1769
+ 'title' => __('Tag Manager ID (Container ID)','accelerated-mobile-pages'),
1770
+ 'default' => '',
1771
+ 'desc' => __('Eg: GTM-5XXXXXP','accelerated-mobile-pages'),
1772
+ // 'validate' => 'not_empty',
1773
+ 'required' => array(
1774
+ array('amp-use-gtm-option', '=' , '1')
1775
+ ),
1776
+ ),
1777
+ array(
1778
+ 'id' =>'amp-gtm-analytics-type',
1779
+ 'type' => 'text',
1780
+ 'title' => __('Analytics Type','accelerated-mobile-pages'),
1781
+ 'default' => '',
1782
+ 'desc' => __('Eg: googleanalytics','accelerated-mobile-pages'),
1783
+ // 'validate' => 'not_empty',
1784
+ 'required' => array(
1785
+ array('amp-use-gtm-option', '=' , '1')
1786
+ ),
1787
+ ),
1788
+ array(
1789
+ 'id' =>'amp-gtm-analytics-code',
1790
+ 'type' => 'text',
1791
+ 'title' => __('Analytics ID','accelerated-mobile-pages'),
1792
+ 'default' => '',
1793
+ 'desc' => 'Eg: UA-XXXXXX-Y',
1794
+ // 'validate' => 'not_empty',
1795
+ 'required' => array(
1796
+ array('amp-use-gtm-option', '=' , '1')),
1797
+ ),
1798
+
1799
+ )
1800
+ )
1801
+ );
1802
+
1803
  // Structured Data
1804
  Redux::setSection( $opt_name, array(
1805
  'title' => __( 'Structured Data', 'accelerated-mobile-pages' ),
1877
 
1878
  ) );
1879
 
1880
+
1881
+ // Comments
1882
+ Redux::setSection( $opt_name, array(
1883
+ 'title' => __( 'Comments', 'accelerated-mobile-pages' ),
1884
+ 'desc' => $comment_desc,
1885
+ 'id' => 'disqus-comments',
1886
+ 'subsection' => true,
1887
+ 'fields' => array(
1888
+ array(
1889
+ 'id' => 'ampforwp-number-of-comments',
1890
+ 'type' => 'text',
1891
+ 'desc' => __('This refers to the normal comments','accelerated-mobile-pages'),
1892
+ 'title' => __('No of Comments', 'accelerated-mobile-pages'),
1893
+ 'default' => 10,
1894
+ 'required' => array(
1895
+ array('ampforwp-disqus-comments-support' , '=' , 0),
1896
+ array('ampforwp-facebook-comments-support' , '=' , 0)
1897
+ ),
1898
+ ),
1899
+ array(
1900
+ 'id' => 'ampforwp-disqus-comments-support',
1901
+ 'type' => 'switch',
1902
+ 'title' => __('Disqus comments Support', 'accelerated-mobile-pages'),
1903
+ 'subtitle' => __('Enable/Disable Disqus comments using this switch.', 'accelerated-mobile-pages'),
1904
+ 'required' => array('ampforwp-facebook-comments-support', '=' , '0'),
1905
+ 'default' => 0
1906
+ ),
1907
+ array(
1908
+ 'id' => 'ampforwp-disqus-comments-name',
1909
+ 'type' => 'text',
1910
+ 'title' => __('Disqus Name', 'accelerated-mobile-pages'),
1911
+ 'subtitle' => __('Eg: https://xyz.disqus.com', 'accelerated-mobile-pages'),
1912
+ 'required' => array('ampforwp-disqus-comments-support', '=' , '1'),
1913
+ 'default' => ''
1914
+ ),
1915
+
1916
+ array(
1917
+ 'id' => 'ampforwp-disqus-host-position',
1918
+ 'type' => 'switch',
1919
+ 'title' => __('Host Disqus Comments through AMPforWP Servers', 'accelerated-mobile-pages'),
1920
+ 'subtitle' => __('Use AMPforWP secure servers to serve Comments file. Recommended if your site is non HTTPS', 'accelerated-mobile-pages'),
1921
+ 'default' => 1,
1922
+ 'required' => array('ampforwp-disqus-comments-support', '=' , '1'),
1923
+ ),
1924
+
1925
+ array(
1926
+ 'id' => 'ampforwp-disqus-host-file',
1927
+ 'type' => 'text',
1928
+ 'title' => __('Disqus Host File', 'accelerated-mobile-pages'),
1929
+ 'subtitle' => __('<a href="https://ampforwp.com/host-disqus-comments/"> Click here to know, How to Setup Disqus Host file on your servers </a>', 'accelerated-mobile-pages'),
1930
+ 'placeholder' => 'https://comments.example.com/disqus.php',
1931
+ 'required' => array('ampforwp-disqus-host-position', '=' , '0'),
1932
+ ),
1933
+ array(
1934
+ 'id' => 'ampforwp-facebook-comments-support',
1935
+ 'type' => 'switch',
1936
+ 'title' => __('Facebook comments Support', 'accelerated-mobile-pages'),
1937
+ 'subtitle' => __('Enable/Disable Facebook comments using this switch.', 'accelerated-mobile-pages'),
1938
+ 'default' => 0,
1939
+ ),
1940
+ array(
1941
+ 'id' => 'ampforwp-number-of-fb-no-of-comments',
1942
+ 'type' => 'text',
1943
+ 'desc' => __('Enter the number of comments','accelerated-mobile-pages'),
1944
+ 'title' => __('No of Comments', 'accelerated-mobile-pages'),
1945
+ 'default' => 10,
1946
+ 'required' => array(
1947
+ array('ampforwp-facebook-comments-support', '=' , 1),
1948
+
1949
+
1950
+ ),
1951
+ )
1952
+ )
1953
+ ) );
1954
+
1955
+
1956
  // Translation Panel
1957
  Redux::setSection( $opt_name, array(
1958
  'title' => __( 'Translation Panel', 'accelerated-mobile-pages' ),
2253
 
2254
 
2255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2256
 
2257
  // Advance Settings SECTION
2258
  Redux::setSection( $opt_name, array(
includes/redirect.php CHANGED
@@ -87,3 +87,25 @@ function ampforwp_page_template_redirect_archive() {
87
  }
88
  }
89
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  }
89
  }
90
+
91
+ // Redirection code is not working properly. Need fix
92
+ //add_action( 'template_redirect', 'ampforwp_page_template_redirect_non_amp', 10 );
93
+ // function ampforwp_page_template_redirect_non_amp() {
94
+
95
+ // if ( (is_home() || is_front_page() || is_archive()) && $_GET['nonamp']==1 ){
96
+ // global $wp;
97
+ // $current_view_nonamp_url = add_query_arg( '', '', home_url( $wp->request ) );
98
+ // $current_view_nonamp_url = trailingslashit($current_view_nonamp_url);
99
+ // wp_redirect( esc_url( $current_view_nonamp_url ) , 301 );
100
+ // exit();
101
+ // }
102
+
103
+ // elseif ( is_singular() && $_GET['nonamp']==1 ) {
104
+
105
+ // global $wp;
106
+ // $current_view_nonamp_url = add_query_arg( '', '', get_permalink() );
107
+ // $current_view_nonamp_url = trailingslashit($current_view_nonamp_url );
108
+ // wp_redirect( esc_url( $current_view_nonamp_url) , 301 );
109
+ // exit();
110
+ // }
111
+ // }
includes/welcome.php CHANGED
@@ -45,7 +45,7 @@ function ampforwp_welcome_screen_pages() {
45
  add_dashboard_page(
46
  __('Welcome To AMPforWP plugin','accelerated-mobile-pages'),
47
  __('Welcome to AMP','accelerated-mobile-pages'),
48
- 'read',
49
  'ampforwp-welcome-page',
50
  'ampforwp_welcome_screen_content'
51
  );
45
  add_dashboard_page(
46
  __('Welcome To AMPforWP plugin','accelerated-mobile-pages'),
47
  __('Welcome to AMP','accelerated-mobile-pages'),
48
+ 'manage_options',
49
  'ampforwp-welcome-page',
50
  'ampforwp_welcome_screen_content'
51
  );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
- Tested up to: 4.7.4
7
- Stable tag: 0.9.49
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -29,12 +29,13 @@ AMP for WP automatically adds Accelerated Mobile Pages (Google AMP Project) func
29
 
30
  = Features: =
31
 
 
32
  * NEW - Email Opt-in Subscription form support in AMP added
33
  * NEW - Call to Action boxes and notification bars
34
  * NEW - 9 Advertisement sizes - 2 More AD slots added recently
35
  * NEW - Comments Forms in AMP.
36
  * NEW - Native AMP Search functionality.
37
- * NEW - Design 3 [Watch the Video Overview](https://www.youtube.com/watch?v=ub1pwskt3Rc)
38
  * Disqus Comments Support
39
  * Google Tag Manager Support
40
  * Page, Category & Tags Support Added
@@ -131,7 +132,26 @@ You can contact me using this url: http://ampforwp.com/contact/
131
 
132
  == Changelog ==
133
 
134
- = 0.9.48 (12 May 2017) =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  * View more details on https://ampforwp.com/0-9-49-released-small-important-bugs-fixed-56th-update/
136
  * Option added to display the excerpt in Single #806
137
  * Ability to add new invalid tags to filter out from AMP pages #809
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
+ Tested up to: 4.7.5
7
+ Stable tag: 0.9.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
29
 
30
  = Features: =
31
 
32
+ * NEW - Facebook Comments Support
33
  * NEW - Email Opt-in Subscription form support in AMP added
34
  * NEW - Call to Action boxes and notification bars
35
  * NEW - 9 Advertisement sizes - 2 More AD slots added recently
36
  * NEW - Comments Forms in AMP.
37
  * NEW - Native AMP Search functionality.
38
+ * Design 3 [Watch the Video Overview](https://www.youtube.com/watch?v=ub1pwskt3Rc)
39
  * Disqus Comments Support
40
  * Google Tag Manager Support
41
  * Page, Category & Tags Support Added
132
 
133
  == Changelog ==
134
 
135
+ = 0.9.50 (24 May 2017) =
136
+ * View more details on https://ampforwp.com/facebook-comments-in-amp/
137
+ * Design 3 Social Icons issue #832
138
+ * View non AMP leads to /?nonamp=1 #814
139
+ * Youtube shortcode compatibility improved #557
140
+ * welcome.php should be shown only if user is “administrator” #696
141
+ * Facebook comments support added in AMP #825
142
+ * WP Like Button Compatibility #841
143
+ * Custom Taxonomy Support added with Custom Post Type Extension.
144
+ * Front page – comments not found as expected #837
145
+ * Fixed xml:lang tag issue #848
146
+ * Sanitize Iframe in the archive description Fixed #845
147
+ * Compatibility with Newspaper Theme by TagDiv #842 and #796
148
+ * Some debug problems (blog page, style.php) #838
149
+ * Featured Image hooks added
150
+ * Twitter is misspelled #854
151
+ * The core concept of the AMP Content builder has been built.
152
+
153
+
154
+ = 0.9.49 (12 May 2017) =
155
  * View more details on https://ampforwp.com/0-9-49-released-small-important-bugs-fixed-56th-update/
156
  * Option added to display the excerpt in Single #806
157
  * Ability to add new invalid tags to filter out from AMP pages #809
templates/custom-sanitizer.php CHANGED
@@ -7,7 +7,7 @@ require_once( AMP__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' )
7
  class AMPFORWP_Content {
8
  private $content;
9
  private $amp_content = '';
10
- private $amp_scripts = array();
11
  private $amp_styles = array();
12
  private $args = array();
13
  private $embed_handler_classes = array();
7
  class AMPFORWP_Content {
8
  private $content;
9
  private $amp_content = '';
10
+ public $amp_scripts = array();
11
  private $amp_styles = array();
12
  private $args = array();
13
  private $embed_handler_classes = array();
templates/design-manager/design-1/archive.php CHANGED
@@ -12,10 +12,33 @@
12
  $amp_url = trailingslashit($current_archive_url);
13
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
14
  $amp_url = str_replace($remove, '', $amp_url) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  } ?>
16
  <link rel="canonical" href="<?php echo $amp_url ?>">
17
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
18
  <?php do_action( 'amp_post_template_head', $this ); ?>
 
 
 
 
 
 
 
19
  <style amp-custom>
20
  <?php $this->load_parts( array( 'style' ) ); ?>
21
  <?php do_action( 'amp_post_template_css', $this ); ?>
@@ -32,8 +55,7 @@
32
 
33
  <?php if ( is_archive() ) {
34
  the_archive_title( '<h3 class="page-title">', '</h3>' );
35
- $description = get_the_archive_description();
36
- $sanitizer = new AMPFORWP_Content( $description, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array() ) ) );
37
  $arch_desc = $sanitizer->get_amp_content();
38
  if( $arch_desc ) { ?>
39
  <div class="amp-wp-content taxonomy-description">
12
  $amp_url = trailingslashit($current_archive_url);
13
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
14
  $amp_url = str_replace($remove, '', $amp_url) ;
15
+ }
16
+
17
+ if ( is_archive() ) {
18
+ $description = get_the_archive_description();
19
+ $sanitizer = new AMPFORWP_Content( $description, array(),
20
+ apply_filters( 'ampforwp_content_sanitizers',
21
+ array(
22
+ 'AMP_Style_Sanitizer' => array(),
23
+ 'AMP_Blacklist_Sanitizer' => array(),
24
+ 'AMP_Img_Sanitizer' => array(),
25
+ 'AMP_Video_Sanitizer' => array(),
26
+ 'AMP_Audio_Sanitizer' => array(),
27
+ 'AMP_Iframe_Sanitizer' => array(
28
+ 'add_placeholder' => true,
29
+ )
30
+ ) ) );
31
  } ?>
32
  <link rel="canonical" href="<?php echo $amp_url ?>">
33
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
34
  <?php do_action( 'amp_post_template_head', $this ); ?>
35
+ <?php
36
+ $amp_component_scripts = $sanitizer->amp_scripts;
37
+ if ( $sanitizer && $amp_component_scripts) {
38
+ foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) { ?>
39
+ <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
40
+ }
41
+ }?>
42
  <style amp-custom>
43
  <?php $this->load_parts( array( 'style' ) ); ?>
44
  <?php do_action( 'amp_post_template_css', $this ); ?>
55
 
56
  <?php if ( is_archive() ) {
57
  the_archive_title( '<h3 class="page-title">', '</h3>' );
58
+
 
59
  $arch_desc = $sanitizer->get_amp_content();
60
  if( $arch_desc ) { ?>
61
  <div class="amp-wp-content taxonomy-description">
templates/design-manager/design-1/elements/comments.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  global $redux_builder_amp;
3
- if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
4
  return;
5
  }
6
  ?>
@@ -70,7 +70,7 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
70
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
72
  <div class="comment-button-wrapper">
73
- <a href="<?php echo trailingslashit( get_permalink() ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
74
  </div>
75
  <?php } ?>
76
  <?php } else {
@@ -81,7 +81,7 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
81
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
82
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
83
  <div class="comment-button-wrapper">
84
- <a href="<?php echo trailingslashit( get_permalink() ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
85
  </div>
86
  <?php } ?>
87
  <?php } ?>
1
  <?php
2
  global $redux_builder_amp;
3
+ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'] || $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
4
  return;
5
  }
6
  ?>
70
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
72
  <div class="comment-button-wrapper">
73
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
74
  </div>
75
  <?php } ?>
76
  <?php } else {
81
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
82
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
83
  <div class="comment-button-wrapper">
84
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
85
  </div>
86
  <?php } ?>
87
  <?php } ?>
templates/design-manager/design-1/elements/featured-image.php CHANGED
@@ -1,3 +1,4 @@
 
1
  <?php
2
  $featured_image = $this->get( 'featured_image' );
3
 
@@ -16,3 +17,4 @@ $caption = $featured_image['caption'];
16
  </p>
17
  <?php endif; ?>
18
  </figure>
 
1
+ <?php do_action('ampforwp_before_featured_image_hook'); ?>
2
  <?php
3
  $featured_image = $this->get( 'featured_image' );
4
 
17
  </p>
18
  <?php endif; ?>
19
  </figure>
20
+ <?php do_action('ampforwp_after_featured_image_hook'); ?>
templates/design-manager/design-1/elements/simple-comment-button.php CHANGED
@@ -6,6 +6,6 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
6
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
7
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
8
  <div class="comment-button-wrapper ampforwp-comment-button">
9
- <a href="<?php echo trailingslashit( get_permalink() ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
10
  </div>
11
  <?php } ?>
6
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
7
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
8
  <div class="comment-button-wrapper ampforwp-comment-button">
9
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
10
  </div>
11
  <?php } ?>
templates/design-manager/design-1/footer.php CHANGED
@@ -1,23 +1,36 @@
1
  <?php
2
  global $redux_builder_amp;
3
- wp_reset_postdata();
4
-
5
  $ampforwp_backto_nonamp = '';
6
  if ( is_home() ) {
7
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
 
 
 
8
  }
9
  if ( is_single() ){
10
- global $post;
11
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
 
 
12
  }
13
  if ( is_page() ){
14
- global $post;
15
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
 
 
16
  }
17
  if( is_archive() ) {
18
  global $wp;
19
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
20
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
 
 
 
 
 
 
21
  } ?>
22
  <footer class="amp-wp-footer">
23
  <div id="footer">
1
  <?php
2
  global $redux_builder_amp;
3
+ wp_reset_postdata();
4
+ global $post;
5
  $ampforwp_backto_nonamp = '';
6
  if ( is_home() ) {
7
+ if($redux_builder_amp['amp-mobile-redirection']==1)
8
+ $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
9
+ else
10
+ $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
11
  }
12
  if ( is_single() ){
13
+ if($redux_builder_amp['amp-mobile-redirection']==1)
14
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
15
+ else
16
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
17
  }
18
  if ( is_page() ){
19
+ if($redux_builder_amp['amp-mobile-redirection']==1)
20
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
21
+ else
22
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
23
  }
24
  if( is_archive() ) {
25
  global $wp;
26
+ if($redux_builder_amp['amp-mobile-redirection']==1){
27
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
28
+ $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
29
+ }
30
+ else{
31
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
32
+ $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
33
+ }
34
  } ?>
35
  <footer class="amp-wp-footer">
36
  <div id="footer">
templates/design-manager/design-1/frontpage.php CHANGED
@@ -192,13 +192,12 @@ $template = new AMP_Post_Template( $post_id );?>
192
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
193
  </div><?php
194
  } else {
195
- if ( !comments_open() ) {
196
- return;
197
- } ?>
198
  <div class="comment-button-wrapper">
199
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
200
  </div>
201
- <?php } ?>
 
202
  </div> <?php
203
  } ?>
204
 
192
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
193
  </div><?php
194
  } else {
195
+ if ( !comments_open() ) { ?>
 
 
196
  <div class="comment-button-wrapper">
197
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
198
  </div>
199
+ <?php }
200
+ }?>
201
  </div> <?php
202
  } ?>
203
 
templates/design-manager/design-1/style.php CHANGED
@@ -80,6 +80,7 @@ table tr:last-child td {border-bottom: 0;}
80
  table tr:last-child td:first-child { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
81
  table tr:last-child td:last-child { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
82
  table tr:hover td { background: #f2f2f2; background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); }
 
83
 
84
  /* CSS3 icon */
85
  [class*=icono-]:after, [class*=icono-]:before{ content: ''; pointer-events: none; }
80
  table tr:last-child td:first-child { -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
81
  table tr:last-child td:last-child { -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
82
  table tr:hover td { background: #f2f2f2; background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); }
83
+ .amp-facebook-comments{margin: 0 0}
84
 
85
  /* CSS3 icon */
86
  [class*=icono-]:after, [class*=icono-]:before{ content: ''; pointer-events: none; }
templates/design-manager/design-2/archive.php CHANGED
@@ -11,11 +11,35 @@
11
  $amp_url = trailingslashit($current_archive_url);
12
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
13
  $amp_url = str_replace($remove, '', $amp_url) ;
14
- } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  <link rel="canonical" href="<?php echo $amp_url ?>">
16
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
17
  <?php do_action( 'amp_post_template_head', $this ); ?>
18
 
 
 
 
 
 
 
 
19
  <style amp-custom>
20
  <?php $this->load_parts( array( 'style' ) ); ?>
21
  <?php do_action( 'amp_post_template_css', $this ); ?>
@@ -33,9 +57,7 @@
33
  <div class="amp-wp-content amp-archive-heading">
34
  <?php
35
  the_archive_title( '<h3 class="page-title">', '</h3>' );
36
- $description = get_the_archive_description();
37
- $sanitizer = new AMPFORWP_Content( $description, array(),
38
- apply_filters( 'ampforwp_content_sanitizers',array( 'AMP_Img_Sanitizer' => array(),'AMP_Style_Sanitizer' => array() ) ) );
39
  $arch_desc = $sanitizer->get_amp_content();
40
  if( $arch_desc ) { ?>
41
  <div class="amp-wp-content taxonomy-description">
11
  $amp_url = trailingslashit($current_archive_url);
12
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
13
  $amp_url = str_replace($remove, '', $amp_url) ;
14
+ }
15
+
16
+ if ( is_archive() ) {
17
+ $description = get_the_archive_description();
18
+ $sanitizer = new AMPFORWP_Content( $description, array(),
19
+ apply_filters( 'ampforwp_content_sanitizers',
20
+ array(
21
+ 'AMP_Style_Sanitizer' => array(),
22
+ 'AMP_Blacklist_Sanitizer' => array(),
23
+ 'AMP_Img_Sanitizer' => array(),
24
+ 'AMP_Video_Sanitizer' => array(),
25
+ 'AMP_Audio_Sanitizer' => array(),
26
+ 'AMP_Iframe_Sanitizer' => array(
27
+ 'add_placeholder' => true,
28
+ )
29
+ ) ) );
30
+ }
31
+ ?>
32
  <link rel="canonical" href="<?php echo $amp_url ?>">
33
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
34
  <?php do_action( 'amp_post_template_head', $this ); ?>
35
 
36
+ <?php
37
+ $amp_component_scripts = $sanitizer->amp_scripts;
38
+ if ( $sanitizer && $amp_component_scripts) {
39
+ foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) { ?>
40
+ <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
41
+ }
42
+ }?>
43
  <style amp-custom>
44
  <?php $this->load_parts( array( 'style' ) ); ?>
45
  <?php do_action( 'amp_post_template_css', $this ); ?>
57
  <div class="amp-wp-content amp-archive-heading">
58
  <?php
59
  the_archive_title( '<h3 class="page-title">', '</h3>' );
60
+
 
 
61
  $arch_desc = $sanitizer->get_amp_content();
62
  if( $arch_desc ) { ?>
63
  <div class="amp-wp-content taxonomy-description">
templates/design-manager/design-2/elements/comments.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  global $redux_builder_amp;
3
- if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
4
  return;
5
  }
6
  ?>
@@ -70,7 +70,7 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
70
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
72
  <div class="comment-button-wrapper">
73
- <a href="<?php echo trailingslashit( get_permalink() ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
74
  </div>
75
  <?php } ?>
76
  <?php
@@ -82,7 +82,7 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
82
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
83
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
84
  <div class="comment-button-wrapper">
85
- <a href="<?php echo trailingslashit( get_permalink() ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
86
  </div>
87
  <?php } ?>
88
  <?php } ?>
1
  <?php
2
  global $redux_builder_amp;
3
+ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'] || $redux_builder_amp['ampforwp-facebook-comments-support']) {
4
  return;
5
  }
6
  ?>
70
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
72
  <div class="comment-button-wrapper">
73
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
74
  </div>
75
  <?php } ?>
76
  <?php
82
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
83
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
84
  <div class="comment-button-wrapper">
85
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
86
  </div>
87
  <?php } ?>
88
  <?php } ?>
templates/design-manager/design-2/elements/featured-image.php CHANGED
@@ -1,3 +1,4 @@
 
1
  <?php
2
  $featured_image = $this->get( 'featured_image' );
3
 
@@ -17,4 +18,5 @@ $caption = $featured_image['caption'];
17
  </p>
18
  <?php endif; ?>
19
  </figure>
20
- </div>
 
1
+ <?php do_action('ampforwp_before_featured_image_hook'); ?>
2
  <?php
3
  $featured_image = $this->get( 'featured_image' );
4
 
18
  </p>
19
  <?php endif; ?>
20
  </figure>
21
+ </div>
22
+ <?php do_action('ampforwp_after_featured_image_hook'); ?>
templates/design-manager/design-2/elements/simple-comment-button.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  global $redux_builder_amp;
3
- if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
4
  return;
5
  } ?>
6
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
7
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
8
  <div class="comment-button-wrapper ampforwp-comment-button">
9
- <a href="<?php echo trailingslashit( get_permalink() ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
10
  </div>
11
  <?php } ?>
1
  <?php
2
  global $redux_builder_amp;
3
+ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'] || $redux_builder_amp['ampforwp-facebook-comments-support']) {
4
  return;
5
  } ?>
6
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
7
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
8
  <div class="comment-button-wrapper ampforwp-comment-button">
9
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
10
  </div>
11
  <?php } ?>
templates/design-manager/design-2/footer.php CHANGED
@@ -1,22 +1,35 @@
1
  <?php global $redux_builder_amp;
2
  wp_reset_postdata();
3
-
4
- $ampforwp_backto_nonamp = " ";
5
  if ( is_home() ) {
6
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1';
 
 
 
7
  }
8
  if ( is_single() ){
9
- global $post;
10
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
 
 
11
  }
12
  if ( is_page() ){
13
- global $post;
14
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
 
 
15
  }
16
  if( is_archive() ) {
17
  global $wp;
18
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
19
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
 
 
 
 
 
 
20
  }
21
  ?>
22
  <footer class="container">
1
  <?php global $redux_builder_amp;
2
  wp_reset_postdata();
3
+ global $post;
4
+ $ampforwp_backto_nonamp = '';
5
  if ( is_home() ) {
6
+ if($redux_builder_amp['amp-mobile-redirection']==1)
7
+ $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
8
+ else
9
+ $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
10
  }
11
  if ( is_single() ){
12
+ if($redux_builder_amp['amp-mobile-redirection']==1)
13
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
14
+ else
15
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
16
  }
17
  if ( is_page() ){
18
+ if($redux_builder_amp['amp-mobile-redirection']==1)
19
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
20
+ else
21
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
22
  }
23
  if( is_archive() ) {
24
  global $wp;
25
+ if($redux_builder_amp['amp-mobile-redirection']==1){
26
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
27
+ $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
28
+ }
29
+ else{
30
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
31
+ $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
32
+ }
33
  }
34
  ?>
35
  <footer class="container">
templates/design-manager/design-2/frontpage.php CHANGED
@@ -191,13 +191,12 @@ $template = new AMP_Post_Template( $post_id );?>
191
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
192
  </div><?php
193
  } else {
194
- if ( !comments_open() ) {
195
- return;
196
- } ?>
197
  <div class="comment-button-wrapper">
198
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
199
  </div>
200
- <?php } ?>
 
201
  </div> <?php
202
  } ?>
203
 
191
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
192
  </div><?php
193
  } else {
194
+ if ( !comments_open() ) { ?>
 
 
195
  <div class="comment-button-wrapper">
196
  <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
197
  </div>
198
+ <?php }
199
+ } ?>
200
  </div> <?php
201
  } ?>
202
 
templates/design-manager/design-2/style.php CHANGED
@@ -177,6 +177,7 @@ main .amp-wp-content.comments_list {background: none;box-shadow: none;max-width:
177
  .comments_list li li{ margin: 20px 20px 10px 20px;background: #f7f7f7;box-shadow: none;border: 1px solid #eee;}
178
  .comments_list li li li{ margin:20px 20px 10px 20px}
179
  .comment-content amp-img{max-width: 300px;}
 
180
  /* ADS */
181
  .amp_home_body .amp_ad_1{ margin-top: 10px; margin-bottom: -20px; }
182
  .single-post .amp_ad_1{ margin-top: 10px; margin-bottom: -20px; }
177
  .comments_list li li{ margin: 20px 20px 10px 20px;background: #f7f7f7;box-shadow: none;border: 1px solid #eee;}
178
  .comments_list li li li{ margin:20px 20px 10px 20px}
179
  .comment-content amp-img{max-width: 300px;}
180
+ .amp-facebook-comments{margin-top:45px}
181
  /* ADS */
182
  .amp_home_body .amp_ad_1{ margin-top: 10px; margin-bottom: -20px; }
183
  .single-post .amp_ad_1{ margin-top: 10px; margin-bottom: -20px; }
templates/design-manager/design-3/archive.php CHANGED
@@ -12,11 +12,33 @@
12
  $amp_url = trailingslashit($current_archive_url);
13
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
14
  $amp_url = str_replace($remove, '', $amp_url) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  } ?>
16
  <link rel="canonical" href="<?php echo $amp_url ?>">
17
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
18
  <?php do_action( 'amp_post_template_head', $this ); ?>
19
-
 
 
 
 
 
 
20
  <style amp-custom>
21
  <?php $this->load_parts( array( 'style' ) ); ?>
22
  <?php do_action( 'amp_post_template_css', $this ); ?>
@@ -55,8 +77,7 @@ if ( get_query_var( 'paged' ) ) {
55
 
56
  <?php if ( is_archive() ) {
57
  the_archive_title( '<h3 class="amp-wp-content page-title">', '</h3>' );
58
- $description = get_the_archive_description();
59
- $sanitizer = new AMPFORWP_Content( $description, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array() ) ) );
60
  $arch_desc = $sanitizer->get_amp_content();
61
  if( $arch_desc ) { ?>
62
  <div class="amp-wp-content taxonomy-description">
12
  $amp_url = trailingslashit($current_archive_url);
13
  $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
14
  $amp_url = str_replace($remove, '', $amp_url) ;
15
+ }
16
+
17
+ if ( is_archive() ) {
18
+ $description = get_the_archive_description();
19
+ $sanitizer = new AMPFORWP_Content( $description, array(),
20
+ apply_filters( 'ampforwp_content_sanitizers',
21
+ array(
22
+ 'AMP_Style_Sanitizer' => array(),
23
+ 'AMP_Blacklist_Sanitizer' => array(),
24
+ 'AMP_Img_Sanitizer' => array(),
25
+ 'AMP_Video_Sanitizer' => array(),
26
+ 'AMP_Audio_Sanitizer' => array(),
27
+ 'AMP_Iframe_Sanitizer' => array(
28
+ 'add_placeholder' => true,
29
+ )
30
+ ) ) );
31
  } ?>
32
  <link rel="canonical" href="<?php echo $amp_url ?>">
33
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
34
  <?php do_action( 'amp_post_template_head', $this ); ?>
35
+ <?php
36
+ $amp_component_scripts = $sanitizer->amp_scripts;
37
+ if ( $sanitizer && $amp_component_scripts) {
38
+ foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) { ?>
39
+ <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
40
+ }
41
+ }?>
42
  <style amp-custom>
43
  <?php $this->load_parts( array( 'style' ) ); ?>
44
  <?php do_action( 'amp_post_template_css', $this ); ?>
77
 
78
  <?php if ( is_archive() ) {
79
  the_archive_title( '<h3 class="amp-wp-content page-title">', '</h3>' );
80
+
 
81
  $arch_desc = $sanitizer->get_amp_content();
82
  if( $arch_desc ) { ?>
83
  <div class="amp-wp-content taxonomy-description">
templates/design-manager/design-3/elements/comments.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  global $redux_builder_amp;
3
- if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
4
  return;
5
  }
6
  ?>
@@ -70,7 +70,7 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
70
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
72
  <div class="comment-button-wrapper">
73
- <a href="<?php echo trailingslashit( get_permalink() ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
74
  </div>
75
  <?php } ?>
76
  <?php
@@ -82,7 +82,7 @@ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'])
82
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
83
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
84
  <div class="comment-button-wrapper">
85
- <a href="<?php echo trailingslashit( get_permalink() ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
86
  </div>
87
  <?php } ?>
88
  <?php } ?>
1
  <?php
2
  global $redux_builder_amp;
3
+ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'] || $redux_builder_amp['ampforwp-facebook-comments-support']) {
4
  return;
5
  }
6
  ?>
70
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
71
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
72
  <div class="comment-button-wrapper">
73
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
74
  </div>
75
  <?php } ?>
76
  <?php
82
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
83
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
84
  <div class="comment-button-wrapper">
85
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
86
  </div>
87
  <?php } ?>
88
  <?php } ?>
templates/design-manager/design-3/elements/featured-image.php CHANGED
@@ -1,3 +1,4 @@
 
1
  <div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
2
  <?php
3
  $featured_image = $this->get( 'featured_image' );
@@ -14,6 +15,7 @@ $caption = $featured_image['caption'];
14
  <p class="wp-caption-text">
15
  <?php echo wp_kses_data( $caption ); ?>
16
  </p>
17
- <?php endif; ?>
18
  </figure>
19
- </div></div>
 
1
+ <?php do_action('ampforwp_before_featured_image_hook'); ?>
2
  <div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
3
  <?php
4
  $featured_image = $this->get( 'featured_image' );
15
  <p class="wp-caption-text">
16
  <?php echo wp_kses_data( $caption ); ?>
17
  </p>
18
+ <?php endif; ?>
19
  </figure>
20
+ </div></div>
21
+ <?php do_action('ampforwp_after_featured_image_hook'); ?>
templates/design-manager/design-3/elements/simple-comment-button.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
  global $redux_builder_amp;
3
- if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support']) {
4
  return;
5
  } ?>
6
 
7
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
8
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
9
  <div class="comment-button-wrapper ampforwp-comment-button">
10
- <a href="<?php echo trailingslashit( get_permalink() ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
11
  </div>
12
  <?php } ?>
1
  <?php
2
  global $redux_builder_amp;
3
+ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'] || $redux_builder_amp['ampforwp-facebook-comments-support']) {
4
  return;
5
  } ?>
6
 
7
  <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
8
  if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
9
  <div class="comment-button-wrapper ampforwp-comment-button">
10
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
11
  </div>
12
  <?php } ?>
templates/design-manager/design-3/footer.php CHANGED
@@ -1,22 +1,35 @@
1
  <?php global $redux_builder_amp;
2
  wp_reset_postdata();
3
-
4
- $ampforwp_backto_nonamp = " ";
5
  if ( is_home() ) {
6
- $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1';
 
 
 
7
  }
8
  if ( is_single() ){
9
- global $post;
10
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
 
 
11
  }
12
  if ( is_page() ){
13
- global $post;
14
- $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
 
 
15
  }
16
  if( is_archive() ) {
17
  global $wp;
18
- $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
19
- $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
 
 
 
 
 
 
20
  }
21
  ?>
22
 
1
  <?php global $redux_builder_amp;
2
  wp_reset_postdata();
3
+ global $post;
4
+ $ampforwp_backto_nonamp = '';
5
  if ( is_home() ) {
6
+ if($redux_builder_amp['amp-mobile-redirection']==1)
7
+ $ampforwp_backto_nonamp = trailingslashit(home_url()).'?nonamp=1' ;
8
+ else
9
+ $ampforwp_backto_nonamp = trailingslashit(home_url()) ;
10
  }
11
  if ( is_single() ){
12
+ if($redux_builder_amp['amp-mobile-redirection']==1)
13
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1' ;
14
+ else
15
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )) ;
16
  }
17
  if ( is_page() ){
18
+ if($redux_builder_amp['amp-mobile-redirection']==1)
19
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID )).'?nonamp=1';
20
+ else
21
+ $ampforwp_backto_nonamp = trailingslashit(get_permalink( $post->ID ));
22
  }
23
  if( is_archive() ) {
24
  global $wp;
25
+ if($redux_builder_amp['amp-mobile-redirection']==1){
26
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )).'?nonamp=1' );
27
+ $ampforwp_backto_nonamp = preg_replace('/\/amp\?nonamp=1/','/?nonamp=1',$ampforwp_backto_nonamp);
28
+ }
29
+ else{
30
+ $ampforwp_backto_nonamp = esc_url( untrailingslashit(home_url( $wp->request )) );
31
+ $ampforwp_backto_nonamp = preg_replace('/amp/','',$ampforwp_backto_nonamp);
32
+ }
33
  }
34
  ?>
35
 
templates/design-manager/design-3/frontpage.php CHANGED
@@ -192,13 +192,12 @@ $template = new AMP_Post_Template( $post_id );?>
192
  <a href="<?php echo trailingslashit( $comment_button_url ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
193
  </div><?php
194
  } else {
195
- if ( !comments_open() ) {
196
- return;
197
- } ?>
198
  <div class="comment-button-wrapper">
199
  <a href="<?php echo trailingslashit( $comment_button_url ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
200
  </div>
201
- <?php } ?>
 
202
  </div> <?php
203
  } ?>
204
 
192
  <a href="<?php echo trailingslashit( $comment_button_url ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
193
  </div><?php
194
  } else {
195
+ if ( !comments_open() ) { ?>
 
 
196
  <div class="comment-button-wrapper">
197
  <a href="<?php echo trailingslashit( $comment_button_url ).'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
198
  </div>
199
+ <?php }
200
+ } ?>
201
  </div> <?php
202
  } ?>
203
 
templates/design-manager/design-3/style.php CHANGED
@@ -364,8 +364,8 @@ amp-user-notification button { background-color: <?php echo $redux_builder_amp[
364
  .icon-snapchat-ghost:before{ content: "\f2ac"; background:#fffc00 }
365
  .social_icons{ font-size: 15px; display: inline-block; }
366
  .social_icons ul{ list-style-type:none; padding:0;margin:0; text-align:center }
367
- .social_icons li{ display:inline-block; margin:5px; }
368
- .social_icons li:before{ color:#fff; padding: 10px; display: inline-block; border-radius: 70px; width: 18px; height: 18px; line-height: 20px; text-align: center; }
369
  #ampsomething { display: none; }
370
  #header, .headerlogo a{ background:<?php echo $redux_builder_amp['amp-opt-color-rgba-headercolor']['color']; ?> }
371
  .comment-button-wrapper a, #pagination .next a, #pagination .prev a{ background: <?php echo $redux_builder_amp['amp-opt-color-rgba-colorscheme']['color']; ?> ; }
364
  .icon-snapchat-ghost:before{ content: "\f2ac"; background:#fffc00 }
365
  .social_icons{ font-size: 15px; display: inline-block; }
366
  .social_icons ul{ list-style-type:none; padding:0;margin:0; text-align:center }
367
+ .social_icons li{ box-sizing: initial; display:inline-block; margin:5px; }
368
+ .social_icons li:before{ box-sizing: initial; color:#fff; padding: 10px; display: inline-block; border-radius: 70px; width: 18px; height: 18px; line-height: 20px; text-align: center; }
369
  #ampsomething { display: none; }
370
  #header, .headerlogo a{ background:<?php echo $redux_builder_amp['amp-opt-color-rgba-headercolor']['color']; ?> }
371
  .comment-button-wrapper a, #pagination .next a, #pagination .prev a{ background: <?php echo $redux_builder_amp['amp-opt-color-rgba-colorscheme']['color']; ?> ; }
templates/features.php CHANGED
@@ -67,6 +67,10 @@
67
  55. Call Now Button Feature added
68
  56. Multi Translation Feature #540
69
  57. Adding Updated date at in the Content
 
 
 
 
70
  */
71
  // Adding AMP-related things to the main theme
72
  global $redux_builder_amp;
@@ -834,6 +838,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', $redux_builder_amp['ampforwp-number-of-comm
834
  $content = preg_replace('/<g:plusone\s(.*?)>(.*)<\/g:plusone>/i', '', $content);
835
  $content = preg_replace('/imageanchor="1"/i', '', $content);
836
  $content = preg_replace('/<plusone\s(.*?)>(.*?)<\/plusone>/', '', $content);
 
837
 
838
  // $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
839
  return $content;
@@ -1204,6 +1209,10 @@ function ampforwp_remove_schema_data() {
1204
  // Removed GTranslate Flags from AMP pages #819
1205
  remove_filter('wp_nav_menu_items', 'gtranslate_menu_item', 10, 2);
1206
 
 
 
 
 
1207
  }
1208
 
1209
  // 22. Removing author links from comments Issue #180
@@ -1474,6 +1483,8 @@ function ampforwp_frontpage_title_markup () {
1474
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="false"/', '$1', $content_buffer);
1475
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="true"/', '$1', $content_buffer);
1476
  $content_buffer = preg_replace("/about:blank/", "#", $content_buffer);
 
 
1477
  //$content_buffer = preg_replace('/<style type=(.*?)>|\[.*?\]\s\{(.*)\}|<\/style>(?!(<\/noscript>)|(\n<\/head>)|(<noscript>))/','',$content_buffer);
1478
 
1479
  }
@@ -1684,6 +1695,45 @@ function ampforwp_add_disqus_scripts( $data ) {
1684
  return $data;
1685
  }
1686
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1687
  //36. remove photon support in AMP
1688
  //add_action('amp_init','ampforwp_photon_remove');
1689
  //function ampforwp_photon_remove(){
@@ -1820,8 +1870,8 @@ if (function_exists('register_sidebar')) {
1820
  'name' => 'AMP Above Loop',
1821
  'id' => 'ampforwp-above-loop',
1822
  'description' => 'Widget area for above the Loop Output',
1823
- 'before_widget' => '<div class="category-widget-wrapper"><div class="category-widget-gutter">',
1824
- 'after_widget' => '</div></div>',
1825
  'before_title' => '<h4>',
1826
  'after_title' => '</h4>'
1827
  ));
@@ -1829,8 +1879,8 @@ if (function_exists('register_sidebar')) {
1829
  'name' => 'AMP Below Loop',
1830
  'id' => 'ampforwp-below-loop',
1831
  'description' => 'Widget area for below the Loop Output',
1832
- 'before_widget' => '<div class="category-widget-wrapper"><div class="category-widget-gutter">',
1833
- 'after_widget' => '</div></div>',
1834
  'before_title' => '<h4>',
1835
  'after_title' => '</h4>'
1836
  ));
@@ -2323,4 +2373,56 @@ function ampforwp_add_modified_date($post_id){
2323
  </p>
2324
  </div> <?php
2325
  }
2326
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  55. Call Now Button Feature added
68
  56. Multi Translation Feature #540
69
  57. Adding Updated date at in the Content
70
+ 58. YouTube Shortcode compatablity with AMP #557
71
+ 59. Comment Button URL
72
+ 60. Remove Category Layout modification code added by TagDiv #842 and #796
73
+
74
  */
75
  // Adding AMP-related things to the main theme
76
  global $redux_builder_amp;
838
  $content = preg_replace('/<g:plusone\s(.*?)>(.*)<\/g:plusone>/i', '', $content);
839
  $content = preg_replace('/imageanchor="1"/i', '', $content);
840
  $content = preg_replace('/<plusone\s(.*?)>(.*?)<\/plusone>/', '', $content);
841
+ $content = preg_replace('/xml:lang=[^>]*/', '', $content);
842
 
843
  // $content = preg_replace('/<img*/', '<amp-img', $content); // Fallback for plugins
844
  return $content;
1209
  // Removed GTranslate Flags from AMP pages #819
1210
  remove_filter('wp_nav_menu_items', 'gtranslate_menu_item', 10, 2);
1211
 
1212
+ // Remove elements of WP Like Button plugin #841
1213
+ remove_filter('the_content', 'fb_like_button');
1214
+ remove_filter('the_excerpt', 'fb_like_button');
1215
+
1216
  }
1217
 
1218
  // 22. Removing author links from comments Issue #180
1483
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="false"/', '$1', $content_buffer);
1484
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="true"/', '$1', $content_buffer);
1485
  $content_buffer = preg_replace("/about:blank/", "#", $content_buffer);
1486
+ $content_buffer = preg_replace("/<script data-cfasync[^>]*>.*?<\/script>/", "", $content_buffer);
1487
+ $content_buffer = preg_replace('/<font(.*?)>(.*?)<\/font>/', '$2', $content_buffer);
1488
  //$content_buffer = preg_replace('/<style type=(.*?)>|\[.*?\]\s\{(.*)\}|<\/style>(?!(<\/noscript>)|(\n<\/head>)|(<noscript>))/','',$content_buffer);
1489
 
1490
  }
1695
  return $data;
1696
  }
1697
 
1698
+ // Facebook Comments Support #825
1699
+
1700
+ add_action('ampforwp_post_after_design_elements','ampforwp_facebook_comments_support');
1701
+ function ampforwp_facebook_comments_support() {
1702
+ echo ampforwp_facebook_comments_markup();
1703
+ }
1704
+ function ampforwp_facebook_comments_markup() {
1705
+
1706
+ global $redux_builder_amp;
1707
+ $facebook_comments_markup = '';
1708
+ if ( !comments_open() ){
1709
+ return;
1710
+ }
1711
+ if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
1712
+
1713
+ $facebook_comments_markup = '<section class="amp-wp-content post-comments amp-wp-article-content amp-facebook-comments" id="comments">';
1714
+ $facebook_comments_markup .= '<amp-facebook-comments width=486 height=357
1715
+ layout="responsive" data-numposts=';
1716
+ $facebook_comments_markup .= '"'. $redux_builder_amp['ampforwp-number-of-fb-no-of-comments']. '" ';
1717
+
1718
+ $facebook_comments_markup .= 'data-href=" ' . get_permalink() . ' "';
1719
+ $facebook_comments_markup .= '></amp-facebook-comments>';
1720
+
1721
+ return $facebook_comments_markup;
1722
+ }
1723
+ }
1724
+
1725
+ add_filter( 'amp_post_template_data', 'ampforwp_add_fbcomments_scripts' );
1726
+ function ampforwp_add_fbcomments_scripts( $data ) {
1727
+
1728
+ $facebook_comments_check = ampforwp_facebook_comments_markup();
1729
+ global $redux_builder_amp;
1730
+ if ( $facebook_comments_check && $redux_builder_amp['ampforwp-facebook-comments-support'] && is_singular() ) {
1731
+ if ( empty( $data['amp_component_scripts']['amp-facebook-comments'] ) ) {
1732
+ $data['amp_component_scripts']['amp-facebook-comments'] = 'https://cdn.ampproject.org/v0/amp-facebook-comments-0.1.js';
1733
+ }
1734
+ }
1735
+ return $data;
1736
+ }
1737
  //36. remove photon support in AMP
1738
  //add_action('amp_init','ampforwp_photon_remove');
1739
  //function ampforwp_photon_remove(){
1870
  'name' => 'AMP Above Loop',
1871
  'id' => 'ampforwp-above-loop',
1872
  'description' => 'Widget area for above the Loop Output',
1873
+ 'before_widget' => '',
1874
+ 'after_widget' => '',
1875
  'before_title' => '<h4>',
1876
  'after_title' => '</h4>'
1877
  ));
1879
  'name' => 'AMP Below Loop',
1880
  'id' => 'ampforwp-below-loop',
1881
  'description' => 'Widget area for below the Loop Output',
1882
+ 'before_widget' => '',
1883
+ 'after_widget' => '',
1884
  'before_title' => '<h4>',
1885
  'after_title' => '</h4>'
1886
  ));
2373
  </p>
2374
  </div> <?php
2375
  }
2376
+ }
2377
+
2378
+ // 58. YouTube Shortcode compatablity with AMP #557
2379
+ if ( ! function_exists( 'shortcode_new_to_old_params') ) {
2380
+
2381
+ function shortcode_new_to_old_params( $params, $old_format_support = false ) {
2382
+ $str = '';
2383
+
2384
+ $youtube_url = 'https://www.youtube.com/watch?v=';
2385
+ $parsed_url = parse_url( $params['id'] );
2386
+ $server = 'www.youtube.com';
2387
+
2388
+ if ( in_array( $server, $parsed_url ) === false ) {
2389
+ $new_url = $youtube_url . $params['id'] ;
2390
+ $params['id'] = $new_url;
2391
+ }
2392
+
2393
+ if ( $old_format_support && isset( $params[0] ) ) {
2394
+ $str = ltrim( $params[0], '=' );
2395
+ } elseif ( is_array( $params ) ) {
2396
+ foreach ( array_keys( $params ) as $key ) {
2397
+ if ( ! is_numeric( $key ) ) {
2398
+ $str = $key . '=' . $params[ $key ];
2399
+ }
2400
+ }
2401
+ }
2402
+
2403
+ return str_replace( array( '&amp;', '&#038;' ), '&', $str );
2404
+ }
2405
+ }
2406
+
2407
+ // 59. Comment Button URL
2408
+ function ampforwp_comment_button_url(){
2409
+ global $redux_builder_amp;
2410
+ $button_url = "";
2411
+ $ampforwp_nonamp = "";
2412
+ if($redux_builder_amp['amp-mobile-redirection']==1)
2413
+ $ampforwp_nonamp = '?nonamp=1';
2414
+ else
2415
+ $ampforwp_nonamp = '';
2416
+
2417
+ $button_url = trailingslashit( get_permalink() ) .$ampforwp_nonamp. '#commentform';
2418
+
2419
+ return $button_url;
2420
+ }
2421
+
2422
+ // 60. Remove Category Layout modification code added by TagDiv #842 and #796
2423
+ function ampforwp_remove_support_tagdiv_cateroy_layout(){
2424
+ if ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) {
2425
+ remove_action('pre_get_posts', 'td_modify_main_query_for_category_page');
2426
+ }
2427
+ }
2428
+ add_action('pre_get_posts','ampforwp_remove_support_tagdiv_cateroy_layout',9);