AMP for WP – Accelerated Mobile Pages - Version 1.0.61

Version Description

(3rd August 2020) = * Improvement: Added Open By Default option in accordion module of AMP Page Builder #4597 * Fixed: Wrong preview link is generating for the AMP pages and posts #4670 * Fixed: Code improved in category base and tag base remover #4664 * Fixed: Wrong breadcrumb links are generating in the AMP #4666 * Fixed: Optimize gallery code to enhance performance and improve the page load time #4656 * Fixed: Homepage URL has /amp at the end even after enabling AMP Takeover #4662 * Fixed: Background color not appearing in table when created with Tiny MCE advanced plugin #4627 * Fixed: Header right side icons styling improved in Design 3 #3935 * Fixed: The right and left arrows are converting into the special characters in AMP #4668 * Fixed: Removed Shorthand versions of PHP from the code #4659 * Fixed: Wrong width and height in logo for SVG images #4650

Download this release

Release Info

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

Code changes from version 1.0.60 to 1.0.61

README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4.2
7
- Stable tag: 1.0.60
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -193,6 +193,19 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  = 1.0.60 (27th July 2020) =
197
  * Improvement: Added below the related post hook #4653
198
  * Fixed: Validation errors caused by Autoptimize for logged in users #4586
@@ -220,39 +233,4 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
220
  * Fixed: If Extension manager was active it was showing incorrect message #4613
221
  * Fixed: Debug warnings #4626 #4639
222
 
223
- = 1.0.58.5 (15th July 2020) =
224
- * Fixed: Duplicate title tag on non-amp #4631
225
- * Fixed: Database deadlocks error #4618
226
-
227
- = 1.0.58.4 (13th July 2020) =
228
- * Fixed: Website getting blank after 1.0.58 update
229
-
230
- = 1.0.58.3 (9th July 2020) =
231
- * Fixed: Class 'AMPforWP\AMPVendor\WP_Error' not found error in the latest update of Jetpack #4624
232
-
233
- = 1.0.58.2 (9th July 2020) =
234
- * Fixed: Category pages are not working properly #4579
235
-
236
- = 1.0.58.1 (9th July 2020) =
237
- * Fixed: Validation error of target attribute appearing in span tag #4620
238
- * Fixed: Menu is hidden behind the content in iOS devices #4601
239
-
240
- = 1.0.58 (7th July 2020) =
241
- * Improvement: Added before and after comment hooks #4537
242
- * Fixed: WPRocket CDN is not working properly with the amp pages #4342
243
- * Fixed: Two galleries not working with Photo gallery plugin #4421
244
- * Fixed: Arrows not getting aligned in Breadcrumbs in Arabic with Swift theme #4593
245
- * Fixed: Customize font size not applying in the post title #4592
246
- * Fixed: Validation errors when adding 2 columns in AMP pagebuilder #4383
247
- * Fixed: Category pages are not working properly #4579
248
- * Fixed: Autoptimize is causing validation for logged in users #4586
249
- * Fixed: Changed gtag type in googleanalytics #4585
250
- * Fixed: Changed the sub-title tag to h2 with subtitles and jannah theme #4599
251
- * Fixed: The entire post content appearing in the excerpt #4603
252
- * Fixed: Updated the condition for amp ninja activation extension #4606
253
-
254
- = 1.0.57 (3rd July 2020) =
255
- * Fixed: Issue with external link with Rank Math #4584
256
- * Fixed: Incorrect yoast title with TagDiv's themes #4595
257
-
258
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4.2
7
+ Stable tag: 1.0.61
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
193
 
194
  == Changelog ==
195
 
196
+ = 1.0.61 (3rd August 2020) =
197
+ * Improvement: Added Open By Default option in accordion module of AMP Page Builder #4597
198
+ * Fixed: Wrong preview link is generating for the AMP pages and posts #4670
199
+ * Fixed: Code improved in category base and tag base remover #4664
200
+ * Fixed: Wrong breadcrumb links are generating in the AMP #4666
201
+ * Fixed: Optimize gallery code to enhance performance and improve the page load time #4656
202
+ * Fixed: Homepage URL has /amp at the end even after enabling AMP Takeover #4662
203
+ * Fixed: Background color not appearing in table when created with Tiny MCE advanced plugin #4627
204
+ * Fixed: Header right side icons styling improved in Design 3 #3935
205
+ * Fixed: The right and left arrows are converting into the special characters in AMP #4668
206
+ * Fixed: Removed Shorthand versions of PHP from the code #4659
207
+ * Fixed: Wrong width and height in logo for SVG images #4650
208
+
209
  = 1.0.60 (27th July 2020) =
210
  * Improvement: Added below the related post hook #4653
211
  * Fixed: Validation errors caused by Autoptimize for logged in users #4586
233
  * Fixed: If Extension manager was active it was showing incorrect message #4613
234
  * Fixed: Debug warnings #4626 #4639
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 1.0.60
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
- define('AMPFORWP_VERSION','1.0.60');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 1.0.61
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
+ define('AMPFORWP_VERSION','1.0.61');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
base_remover/base_remover.php CHANGED
@@ -98,13 +98,13 @@ function ampforwp_category_url_rewrite_rules( $rewrite ) {
98
 
99
 
100
  function ampforwp_tag_url_rewrite_rules( $rewrite ) {
101
- $terms = get_terms( 'post_tag', array( 'hide_empty' => false ) );
102
- foreach ( $terms as $term ) {
103
- $term_nicename = trim($term->slug);
104
-
105
- $rewrite[ '('.$term_nicename.')'.'/amp/?$' ] = 'index.php?amp&tag=$matches[1]';
106
- $rewrite[ '('.$term_nicename.')'.'/amp/page/?([0-9]{1,})/?$' ] =
107
- 'index.php?amp&tag=$matches[1]&paged=$matches[2]';
108
  }
109
 
110
  return $rewrite;
98
 
99
 
100
  function ampforwp_tag_url_rewrite_rules( $rewrite ) {
101
+ $tags = get_terms('post_tag', array('hide_empty' => false));
102
+ if(is_array( $tags ) && ! empty( $tags ) ) {
103
+ foreach ( $tags as $tag ) {
104
+ $tag_nicename = trim($tag->slug);
105
+ $rewrite[ '('.$tag_nicename.')'.'/amp/?$' ] = 'index.php?amp&tag=$matches[1]';
106
+ $rewrite[ '('.$tag_nicename.')'.'/amp/page/?([0-9]{1,})/?$' ] = 'index.php?amp&tag=$matches[1]&paged=$matches[2]';
107
+ }
108
  }
109
 
110
  return $rewrite;
changelog.txt CHANGED
@@ -1,5 +1,18 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.60 (27th July 2020) =
4
  * Improvement: Added below the related post hook #4653
5
  * Fixed: Validation errors caused by Autoptimize for logged in users #4586
1
  == Changelog ==
2
 
3
+ = 1.0.61 (3rd August 2020) =
4
+ * Improvement: Added Open By Default option in accordion module of AMP Page Builder #4597
5
+ * Fixed: Wrong preview link is generating for the AMP pages and posts #4670
6
+ * Fixed: Code improved in category base and tag base remover #4664
7
+ * Fixed: Wrong breadcrumb links are generating in the AMP #4666
8
+ * Fixed: Optimize gallery code to enhance performance and improve the page load time #4656
9
+ * Fixed: Homepage URL has /amp at the end even after enabling AMP Takeover #4662
10
+ * Fixed: Background color not appearing in table when created with Tiny MCE advanced plugin #4627
11
+ * Fixed: Header right side icons styling improved in Design 3 #3935
12
+ * Fixed: The right and left arrows are converting into the special characters in AMP #4668
13
+ * Fixed: Removed Shorthand versions of PHP from the code #4659
14
+ * Fixed: Wrong width and height in logo for SVG images #4650
15
+
16
  = 1.0.60 (27th July 2020) =
17
  * Improvement: Added below the related post hook #4653
18
  * Fixed: Validation errors caused by Autoptimize for logged in users #4586
classes/class-ampforwp-infinite-scroll.php CHANGED
@@ -103,8 +103,8 @@ if( ! class_exists('AMPforWP_Infinite_Scroll') ) {
103
  <amp-next-page>
104
  <script type="application/json">
105
  {
106
- "pages": <?=json_encode($pages)?>,
107
- "hideSelectors": <?=$classes?>
108
  }
109
  </script>
110
  </amp-next-page>
103
  <amp-next-page>
104
  <script type="application/json">
105
  {
106
+ "pages": <?php echo json_encode($pages)?>,
107
+ "hideSelectors": <?php echo $classes?>
108
  }
109
  </script>
110
  </amp-next-page>
classes/class-ampforwp-rev-slider.php CHANGED
@@ -122,10 +122,9 @@ class AMP_Rev_Slider_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_Embed_Han
122
  $bgtype = $slide->get_param(array('bg', 'type'),'');
123
  $image_id = $slide->image_id;
124
  $url = $slide->image_url;
125
- if ( '' == $image_id ) {
126
- $image_id = attachment_url_to_postid($url);
127
  }
128
- $img_data = wp_get_attachment_metadata( $image_id );
129
  if($bgtype == 'external'){
130
  $url = esc_url($slide->get_param(array('bg','externalSrc'), ''));
131
  $imgalt = esc_attr($slide->get_param('alt_attr', ''));
122
  $bgtype = $slide->get_param(array('bg', 'type'),'');
123
  $image_id = $slide->image_id;
124
  $url = $slide->image_url;
125
+ if ( $image_id ) {
126
+ $img_data = wp_get_attachment_metadata( $image_id );
127
  }
 
128
  if($bgtype == 'external'){
129
  $url = esc_url($slide->get_param(array('bg','externalSrc'), ''));
130
  $imgalt = esc_attr($slide->get_param('alt_attr', ''));
components/components-core.php CHANGED
@@ -760,12 +760,11 @@ function ampforwp_backtotop_global_css(){?>
760
  table tr:first-child th:last-child { -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
761
  table tr { text-align: center; padding-left: 20px; }
762
  table td:first-child {padding-left: 20px; border-left: 0; }
763
- table td { padding: 18px; border-top: 1px solid #ffffff; border-bottom: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0; background: #fafafa; background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa)); }
764
  table tr.even td { background: #f6f6f6; background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); }
765
  table tr:last-child td {border-bottom: 0;}
766
  table tr:last-child td:first-child { -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
767
  table tr:last-child td:last-child { -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
768
- table tr:hover td { background: #f2f2f2; background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0));}
769
  @media screen and (min-width: 650px) { table {display: inline-table;} }
770
 
771
  <?php }
760
  table tr:first-child th:last-child { -webkit-border-top-right-radius: 3px; border-top-right-radius: 3px; }
761
  table tr { text-align: center; padding-left: 20px; }
762
  table td:first-child {padding-left: 20px; border-left: 0; }
763
+ table td { padding: 18px; border-top: 1px solid #ffffff; border-bottom: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0;}
764
  table tr.even td { background: #f6f6f6; background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#f6f6f6)); }
765
  table tr:last-child td {border-bottom: 0;}
766
  table tr:last-child td:first-child { -webkit-border-bottom-left-radius: 3px; border-bottom-left-radius: 3px; }
767
  table tr:last-child td:last-child { -webkit-border-bottom-right-radius: 3px; border-bottom-right-radius: 3px; }
 
768
  @media screen and (min-width: 650px) { table {display: inline-table;} }
769
 
770
  <?php }
includes/features/performance/performance-functions.php CHANGED
@@ -255,6 +255,12 @@ if( !function_exists("ampforwp_tree_shaking_purify_amphtml") ){
255
  /***Replacements***/
256
  if(!empty($completeContent)){
257
  $tmpDoc = new DOMDocument();
 
 
 
 
 
 
258
  libxml_use_internal_errors(true);
259
  $tmpDoc->loadHTML($completeContent);
260
  $font_css = '';
255
  /***Replacements***/
256
  if(!empty($completeContent)){
257
  $tmpDoc = new DOMDocument();
258
+ if( function_exists( 'mb_convert_encoding' ) ){
259
+ $completeContent = mb_convert_encoding($completeContent, 'ENT_QUOTES', 'UTF-8');
260
+ }
261
+ else{
262
+ $completeContent = preg_replace( '/&.*?;/', 'x', $completeContent ); // multi-byte characters converted to X
263
+ }
264
  libxml_use_internal_errors(true);
265
  $tmpDoc->loadHTML($completeContent);
266
  $font_css = '';
includes/options/extensions/vendor_support/vendor_support/vendor/ace_editor/snippets/php.js CHANGED
@@ -1 +1 @@
1
- ace.define("ace/snippets/php",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="snippet <?\n <?php\n\n ${1}\nsnippet ec\n echo ${1};\nsnippet <?e\n <?php echo ${1} ?>\n# this one is for php5.4\nsnippet <?=\n <?=${1}?>\nsnippet ns\n namespace ${1:Foo\\Bar\\Baz};\n ${2}\nsnippet use\n use ${1:Foo\\Bar\\Baz};\n ${2}\nsnippet c\n ${1:abstract }class ${2:$FILENAME}\n {\n ${3}\n }\nsnippet i\n interface ${1:$FILENAME}\n {\n ${2}\n }\nsnippet t.\n $this->${1}\nsnippet f\n function ${1:foo}(${2:array }${3:$bar})\n {\n ${4}\n }\n# method\nsnippet m\n ${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})\n {\n ${7}\n }\n# setter method\nsnippet sm \n ${5:public} function set${6:$2}(${7:$2 }$$1)\n {\n $this->${8:$1} = $$1;\n return $this;\n }${9}\n# getter method\nsnippet gm\n ${3:public} function get${4:$2}()\n {\n return $this->${5:$1};\n }${6}\n#setter\nsnippet $s\n ${1:$foo}->set${2:Bar}(${3});\n#getter\nsnippet $g\n ${1:$foo}->get${2:Bar}();\n\n# Tertiary conditional\nsnippet =?:\n $${1:foo} = ${2:true} ? ${3:a} : ${4};\nsnippet ?:\n ${1:true} ? ${2:a} : ${3}\n\nsnippet C\n $_COOKIE['${1:variable}']${2}\nsnippet E\n $_ENV['${1:variable}']${2}\nsnippet F\n $_FILES['${1:variable}']${2}\nsnippet G\n $_GET['${1:variable}']${2}\nsnippet P\n $_POST['${1:variable}']${2}\nsnippet R\n $_REQUEST['${1:variable}']${2}\nsnippet S\n $_SERVER['${1:variable}']${2}\nsnippet SS\n $_SESSION['${1:variable}']${2}\n \n# the following are old ones\nsnippet inc\n include '${1:file}';${2}\nsnippet inc1\n include_once '${1:file}';${2}\nsnippet req\n require '${1:file}';${2}\nsnippet req1\n require_once '${1:file}';${2}\n# Start Docblock\nsnippet /*\n# Class - post doc\nsnippet doc_cp${5}\n# Class Variable - post doc\nsnippet doc_vp${3}\n# Class Variable\nsnippet doc_v\n ${1:var} $${2};${5}\n# Class\nsnippet doc_c\n ${1:}class ${2:}\n {\n ${7}\n } // END $1class $2\n# Constant Definition - post doc\nsnippet doc_dp${2}\n# Constant Definition\nsnippet doc_d\n ace.define(${1}, ${2});${4}\n# Function - post doc\nsnippet doc_fp${4}\n# Function signature\nsnippet doc_s\n ${1}function ${2}(${3});${7}\n# Function\nsnippet doc_f\n ${1}function ${2}(${3})\n {${7}\n }\n# Header\nsnippet doc_h\n \n# Interface\nsnippet interface\n interface ${1:$FILENAME}\n {\n ${5}\n }\n# class ...\nsnippet class\n class ${2:$FILENAME}\n {\n ${3}\n ${5:public} function ${6:__construct}(${7:argument})\n {\n ${8:// code...}\n }\n }\n# ace.define(...)\nsnippet def\n ace.define('${1}'${2});${3}\n# defined(...)\nsnippet def?\n ${1}defined('${2}')${3}\nsnippet wh\n while (${1:/* condition */}) {\n ${2:// code...}\n }\n# do ... while\nsnippet do\n do {\n ${2:// code... }\n } while (${1:/* condition */});\nsnippet if\n if (${1:/* condition */}) {\n ${2:// code...}\n }\nsnippet ifil\n <?php if (${1:/* condition */}): ?>\n ${2:<!-- code... -->}\n <?php endif; ?>\nsnippet ife\n if (${1:/* condition */}) {\n ${2:// code...}\n } else {\n ${3:// code...}\n }\n ${4}\nsnippet ifeil\n <?php if (${1:/* condition */}): ?>\n ${2:<!-- html... -->}\n <?php else: ?>\n ${3:<!-- html... -->}\n <?php endif; ?>\n ${4}\nsnippet else\n else {\n ${1:// code...}\n }\nsnippet elseif\n elseif (${1:/* condition */}) {\n ${2:// code...}\n }\nsnippet switch\n switch ($${1:variable}) {\n case '${2:value}':\n ${3:// code...}\n break;\n ${5}\n default:\n ${4:// code...}\n break;\n }\nsnippet case\n case '${1:value}':\n ${2:// code...}\n break;${3}\nsnippet for\n for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {\n ${4: // code...}\n }\nsnippet foreach\n foreach ($${1:variable} as $${2:value}) {\n ${3:// code...}\n }\nsnippet foreachil\n <?php foreach ($${1:variable} as $${2:value}): ?>\n ${3:<!-- html... -->}\n <?php endforeach; ?>\nsnippet foreachk\n foreach ($${1:variable} as $${2:key} => $${3:value}) {\n ${4:// code...}\n }\nsnippet foreachkil\n <?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>\n ${4:<!-- html... -->}\n <?php endforeach; ?>\n# $... = array (...)\nsnippet array\n $${1:arrayName} = array('${2}' => ${3});${4}\nsnippet try\n try {\n ${2}\n } catch (${1:Exception} $e) {\n }\n# lambda with closure\nsnippet lambda\n ${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {\n ${4}\n };\n# pre_dump();\nsnippet pd\n echo '<pre>'; var_dump(${1}); echo '</pre>';\n# pre_dump(); die();\nsnippet pdd\n echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});\nsnippet vd\n var_dump(${1});\nsnippet vdd\n var_dump(${1}); die(${2:});\nsnippet http_redirect\n header (\"HTTP/1.1 301 Moved Permanently\"); \n header (\"Location: \".URL); \n exit();\n# Getters & Setters\nsnippet gs\n public function get${3:$2}()\n {\n return $this->${4:$1};\n }\n public function set$3(${7:$2 }$$1)\n {\n $this->$4 = $$1;\n return $this;\n }${8}\n# anotation, get, and set, useful for doctrine\nsnippet ags\n ${2:protected} $${3:foo};\n\n public function get${4:$3}()\n {\n return $this->$3;\n }\n\n public function set$4(${5:$4 }$${6:$3})\n {\n $this->$3 = $$6;\n return $this;\n }\nsnippet rett\n return true;\nsnippet retf\n return false;\n",t.scope="php"})
1
+ ace.define("ace/snippets/php",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="snippet <?php\n <?php\n\n ${1}\nsnippet ec\n echo ${1};\nsnippet <?php e\n <?php echo ${1} ?>\n# this one is for php5.4\nsnippet <?php echo\n <?php echo ${1}?>\nsnippet ns\n namespace ${1:Foo\\Bar\\Baz};\n ${2}\nsnippet use\n use ${1:Foo\\Bar\\Baz};\n ${2}\nsnippet c\n ${1:abstract }class ${2:$FILENAME}\n {\n ${3}\n }\nsnippet i\n interface ${1:$FILENAME}\n {\n ${2}\n }\nsnippet t.\n $this->${1}\nsnippet f\n function ${1:foo}(${2:array }${3:$bar})\n {\n ${4}\n }\n# method\nsnippet m\n ${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})\n {\n ${7}\n }\n# setter method\nsnippet sm \n ${5:public} function set${6:$2}(${7:$2 }$$1)\n {\n $this->${8:$1} = $$1;\n return $this;\n }${9}\n# getter method\nsnippet gm\n ${3:public} function get${4:$2}()\n {\n return $this->${5:$1};\n }${6}\n#setter\nsnippet $s\n ${1:$foo}->set${2:Bar}(${3});\n#getter\nsnippet $g\n ${1:$foo}->get${2:Bar}();\n\n# Tertiary conditional\nsnippet =?:\n $${1:foo} = ${2:true} ? ${3:a} : ${4};\nsnippet ?:\n ${1:true} ? ${2:a} : ${3}\n\nsnippet C\n $_COOKIE['${1:variable}']${2}\nsnippet E\n $_ENV['${1:variable}']${2}\nsnippet F\n $_FILES['${1:variable}']${2}\nsnippet G\n $_GET['${1:variable}']${2}\nsnippet P\n $_POST['${1:variable}']${2}\nsnippet R\n $_REQUEST['${1:variable}']${2}\nsnippet S\n $_SERVER['${1:variable}']${2}\nsnippet SS\n $_SESSION['${1:variable}']${2}\n \n# the following are old ones\nsnippet inc\n include '${1:file}';${2}\nsnippet inc1\n include_once '${1:file}';${2}\nsnippet req\n require '${1:file}';${2}\nsnippet req1\n require_once '${1:file}';${2}\n# Start Docblock\nsnippet /*\n# Class - post doc\nsnippet doc_cp${5}\n# Class Variable - post doc\nsnippet doc_vp${3}\n# Class Variable\nsnippet doc_v\n ${1:var} $${2};${5}\n# Class\nsnippet doc_c\n ${1:}class ${2:}\n {\n ${7}\n } // END $1class $2\n# Constant Definition - post doc\nsnippet doc_dp${2}\n# Constant Definition\nsnippet doc_d\n ace.define(${1}, ${2});${4}\n# Function - post doc\nsnippet doc_fp${4}\n# Function signature\nsnippet doc_s\n ${1}function ${2}(${3});${7}\n# Function\nsnippet doc_f\n ${1}function ${2}(${3})\n {${7}\n }\n# Header\nsnippet doc_h\n \n# Interface\nsnippet interface\n interface ${1:$FILENAME}\n {\n ${5}\n }\n# class ...\nsnippet class\n class ${2:$FILENAME}\n {\n ${3}\n ${5:public} function ${6:__construct}(${7:argument})\n {\n ${8:// code...}\n }\n }\n# ace.define(...)\nsnippet def\n ace.define('${1}'${2});${3}\n# defined(...)\nsnippet def?\n ${1}defined('${2}')${3}\nsnippet wh\n while (${1:/* condition */}) {\n ${2:// code...}\n }\n# do ... while\nsnippet do\n do {\n ${2:// code... }\n } while (${1:/* condition */});\nsnippet if\n if (${1:/* condition */}) {\n ${2:// code...}\n }\nsnippet ifil\n <?php if (${1:/* condition */}): ?>\n ${2:<!-- code... -->}\n <?php endif; ?>\nsnippet ife\n if (${1:/* condition */}) {\n ${2:// code...}\n } else {\n ${3:// code...}\n }\n ${4}\nsnippet ifeil\n <?php if (${1:/* condition */}): ?>\n ${2:<!-- html... -->}\n <?php else: ?>\n ${3:<!-- html... -->}\n <?php endif; ?>\n ${4}\nsnippet else\n else {\n ${1:// code...}\n }\nsnippet elseif\n elseif (${1:/* condition */}) {\n ${2:// code...}\n }\nsnippet switch\n switch ($${1:variable}) {\n case '${2:value}':\n ${3:// code...}\n break;\n ${5}\n default:\n ${4:// code...}\n break;\n }\nsnippet case\n case '${1:value}':\n ${2:// code...}\n break;${3}\nsnippet for\n for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {\n ${4: // code...}\n }\nsnippet foreach\n foreach ($${1:variable} as $${2:value}) {\n ${3:// code...}\n }\nsnippet foreachil\n <?php foreach ($${1:variable} as $${2:value}): ?>\n ${3:<!-- html... -->}\n <?php endforeach; ?>\nsnippet foreachk\n foreach ($${1:variable} as $${2:key} => $${3:value}) {\n ${4:// code...}\n }\nsnippet foreachkil\n <?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>\n ${4:<!-- html... -->}\n <?php endforeach; ?>\n# $... = array (...)\nsnippet array\n $${1:arrayName} = array('${2}' => ${3});${4}\nsnippet try\n try {\n ${2}\n } catch (${1:Exception} $e) {\n }\n# lambda with closure\nsnippet lambda\n ${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {\n ${4}\n };\n# pre_dump();\nsnippet pd\n echo '<pre>'; var_dump(${1}); echo '</pre>';\n# pre_dump(); die();\nsnippet pdd\n echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});\nsnippet vd\n var_dump(${1});\nsnippet vdd\n var_dump(${1}); die(${2:});\nsnippet http_redirect\n header (\"HTTP/1.1 301 Moved Permanently\"); \n header (\"Location: \".URL); \n exit();\n# Getters & Setters\nsnippet gs\n public function get${3:$2}()\n {\n return $this->${4:$1};\n }\n public function set$3(${7:$2 }$$1)\n {\n $this->$4 = $$1;\n return $this;\n }${8}\n# anotation, get, and set, useful for doctrine\nsnippet ags\n ${2:protected} $${3:foo};\n\n public function get${4:$3}()\n {\n return $this->$3;\n }\n\n public function set$4(${5:$4 }$${6:$3})\n {\n $this->$3 = $$6;\n return $this;\n }\nsnippet rett\n return true;\nsnippet retf\n return false;\n",t.scope="php"})
includes/redirect.php CHANGED
@@ -171,11 +171,6 @@ if(is_search() && 0 == ampforwp_get_setting('amp-redirection-search')){
171
  if ( is_archive() && ! $redux_builder_amp['ampforwp-archive-support'] ) {
172
  return;
173
  }
174
-
175
- // AMP and non-amp Homepage
176
- if ( is_home() && ampforwp_is_front_page() && ! ampforwp_is_home() ) {
177
- return;
178
- }
179
 
180
  //blogpage
181
  if ( is_home() && $redux_builder_amp['amp-on-off-for-all-pages']==false ) {
171
  if ( is_archive() && ! $redux_builder_amp['ampforwp-archive-support'] ) {
172
  return;
173
  }
 
 
 
 
 
174
 
175
  //blogpage
176
  if ( is_home() && $redux_builder_amp['amp-on-off-for-all-pages']==false ) {
includes/vendor/amp/includes/sanitizers/class-amp-gallery-block-sanitizer-5-3.php CHANGED
@@ -139,26 +139,15 @@ class AMP_Gallery_Block_Sanitizer extends AMP_Base_Sanitizer {
139
  $url = $element->getAttribute('src');
140
  $width = $element->getAttribute('width');
141
  $height = $element->getAttribute('height');
142
- $attachment_id = attachment_url_to_postid($url);
143
- if($attachment_id==0){
144
- $img_name = explode('/',$url);
145
- $img_name = end($img_name);
146
- $img_croped = explode('-',$img_name);
147
- $img_croped = end($img_croped);
148
- $filetype = wp_check_filetype($img_croped);
149
- $img_ext = $filetype['ext'];
150
- $new_img_url = str_replace("-$img_croped",".$img_ext",$url);
151
- $attachment_id = attachment_url_to_postid($new_img_url);
152
- }
153
  if ( empty( $images ) ) {
154
  $images[] = $element;
155
  }
156
- $urls[] = apply_filters('amp_gallery_image_params', array(
157
  'url' => $url,
158
  'width' => $width,
159
  'height' => $height,
160
  'caption' => $possible_caption_text
161
- ),$attachment_id);
162
  }
163
  if ( empty( $images ) ) {
164
  continue;
139
  $url = $element->getAttribute('src');
140
  $width = $element->getAttribute('width');
141
  $height = $element->getAttribute('height');
 
 
 
 
 
 
 
 
 
 
 
142
  if ( empty( $images ) ) {
143
  $images[] = $element;
144
  }
145
+ $urls[] = array(
146
  'url' => $url,
147
  'width' => $width,
148
  'height' => $height,
149
  'caption' => $possible_caption_text
150
+ );
151
  }
152
  if ( empty( $images ) ) {
153
  continue;
includes/vendor/amp/includes/sanitizers/class-amp-gallery-block-sanitizer.php CHANGED
@@ -140,26 +140,15 @@ class AMP_Gallery_Block_Sanitizer extends AMP_Base_Sanitizer {
140
  $url = $element->getAttribute('src');
141
  $width = $element->getAttribute('width');
142
  $height = $element->getAttribute('height');
143
- $attachment_id = attachment_url_to_postid($url);
144
- if($attachment_id==0){
145
- $img_name = explode('/',$url);
146
- $img_name = end($img_name);
147
- $img_croped = explode('-',$img_name);
148
- $img_croped = end($img_croped);
149
- $filetype = wp_check_filetype($img_croped);
150
- $img_ext = $filetype['ext'];
151
- $new_img_url = str_replace("-$img_croped",".$img_ext",$url);
152
- $attachment_id = attachment_url_to_postid($new_img_url);
153
- }
154
  if ( empty( $images ) ) {
155
  $images[] = $element;
156
  }
157
- $urls[] = apply_filters('amp_gallery_image_params', array(
158
  'url' => $url,
159
  'width' => $width,
160
  'height' => $height,
161
  'caption' => $caption
162
- ),$attachment_id);
163
  }
164
 
165
  // Skip if no images found.
140
  $url = $element->getAttribute('src');
141
  $width = $element->getAttribute('width');
142
  $height = $element->getAttribute('height');
 
 
 
 
 
 
 
 
 
 
 
143
  if ( empty( $images ) ) {
144
  $images[] = $element;
145
  }
146
+ $urls[] = array(
147
  'url' => $url,
148
  'width' => $width,
149
  'height' => $height,
150
  'caption' => $caption
151
+ );
152
  }
153
 
154
  // Skip if no images found.
pagebuilder/modules/accordion-mod-module.php CHANGED
@@ -104,10 +104,25 @@ return array(
104
  'tab' =>'customizer',
105
  'default' =>'Description',
106
  'content_type'=>'html',
107
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  ),
109
  'front_template'=>
110
- '<section>
 
111
  <h5 class="acc-lbl">{{acc_title}}</h5>
112
  <div class="acc-desc">{{ass_desc}}</div>
113
  </section>'
104
  'tab' =>'customizer',
105
  'default' =>'Description',
106
  'content_type'=>'html',
107
+ ),
108
+ array(
109
+ 'type' =>'checkbox_bool',
110
+ 'name' =>'open_accordion',
111
+ 'label' =>'Open By Default',
112
+ 'tab' =>'customizer',
113
+ 'default' =>0,
114
+ 'options' =>array(
115
+ array(
116
+ 'label'=>'Yes',
117
+ 'value'=>1,
118
+ )
119
+ ),
120
+ 'content_type'=>'html',
121
+ ),
122
  ),
123
  'front_template'=>
124
+ '<section {{if_condition_open_accordion==1}}
125
+ expanded{{ifend_condition_open_accordion_1}}>
126
  <h5 class="acc-lbl">{{acc_title}}</h5>
127
  <div class="acc-desc">{{ass_desc}}</div>
128
  </section>'
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4.2
7
- Stable tag: 1.0.60
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,6 +190,19 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  = 1.0.60 (27th July 2020) =
194
  * Improvement: Added below the related post hook #4653
195
  * Fixed: Validation errors caused by Autoptimize for logged in users #4586
@@ -217,39 +230,4 @@ You can contact us from [here](https://ampforwp.com/contact/)
217
  * Fixed: If Extension manager was active it was showing incorrect message #4613
218
  * Fixed: Debug warnings #4626 #4639
219
 
220
- = 1.0.58.5 (15th July 2020) =
221
- * Fixed: Duplicate title tag on non-amp #4631
222
- * Fixed: Database deadlocks error #4618
223
-
224
- = 1.0.58.4 (13th July 2020) =
225
- * Fixed: Website getting blank after 1.0.58 update
226
-
227
- = 1.0.58.3 (9th July 2020) =
228
- * Fixed: Class 'AMPforWP\AMPVendor\WP_Error' not found error in the latest update of Jetpack #4624
229
-
230
- = 1.0.58.2 (9th July 2020) =
231
- * Fixed: Category pages are not working properly #4579
232
-
233
- = 1.0.58.1 (9th July 2020) =
234
- * Fixed: Validation error of target attribute appearing in span tag #4620
235
- * Fixed: Menu is hidden behind the content in iOS devices #4601
236
-
237
- = 1.0.58 (7th July 2020) =
238
- * Improvement: Added before and after comment hooks #4537
239
- * Fixed: WPRocket CDN is not working properly with the amp pages #4342
240
- * Fixed: Two galleries not working with Photo gallery plugin #4421
241
- * Fixed: Arrows not getting aligned in Breadcrumbs in Arabic with Swift theme #4593
242
- * Fixed: Customize font size not applying in the post title #4592
243
- * Fixed: Validation errors when adding 2 columns in AMP pagebuilder #4383
244
- * Fixed: Category pages are not working properly #4579
245
- * Fixed: Autoptimize is causing validation for logged in users #4586
246
- * Fixed: Changed gtag type in googleanalytics #4585
247
- * Fixed: Changed the sub-title tag to h2 with subtitles and jannah theme #4599
248
- * Fixed: The entire post content appearing in the excerpt #4603
249
- * Fixed: Updated the condition for amp ninja activation extension #4606
250
-
251
- = 1.0.57 (3rd July 2020) =
252
- * Fixed: Issue with external link with Rank Math #4584
253
- * Fixed: Incorrect yoast title with TagDiv's themes #4595
254
-
255
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4.2
7
+ Stable tag: 1.0.61
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  == Changelog ==
192
 
193
+ = 1.0.61 (3rd August 2020) =
194
+ * Improvement: Added Open By Default option in accordion module of AMP Page Builder #4597
195
+ * Fixed: Wrong preview link is generating for the AMP pages and posts #4670
196
+ * Fixed: Code improved in category base and tag base remover #4664
197
+ * Fixed: Wrong breadcrumb links are generating in the AMP #4666
198
+ * Fixed: Optimize gallery code to enhance performance and improve the page load time #4656
199
+ * Fixed: Homepage URL has /amp at the end even after enabling AMP Takeover #4662
200
+ * Fixed: Background color not appearing in table when created with Tiny MCE advanced plugin #4627
201
+ * Fixed: Header right side icons styling improved in Design 3 #3935
202
+ * Fixed: The right and left arrows are converting into the special characters in AMP #4668
203
+ * Fixed: Removed Shorthand versions of PHP from the code #4659
204
+ * Fixed: Wrong width and height in logo for SVG images #4650
205
+
206
  = 1.0.60 (27th July 2020) =
207
  * Improvement: Added below the related post hook #4653
208
  * Fixed: Validation errors caused by Autoptimize for logged in users #4586
230
  * Fixed: If Extension manager was active it was showing incorrect message #4613
231
  * Fixed: Debug warnings #4626 #4639
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/design-manager/design-3/style.php CHANGED
@@ -517,6 +517,10 @@ pre{ white-space: pre-wrap; }
517
  .amp-category-post{ width: 32%; display: inline-block; word-wrap: break-word;float: left;}
518
  .amp-category-post amp-img{ margin-bottom:5px; }
519
  .amp-category-block li:nth-child(3){ margin: 0 1%; }
 
 
 
 
520
  .searchmenu{ margin-right: 15px; margin-top: 11px; position: absolute; top: 0; right: 0; }
521
  .searchmenu button{ background:transparent; border:none }
522
  .amp-logo amp-img{margin: 0 auto; position:relative;top:9px;max-width:190px;}
@@ -731,9 +735,13 @@ if( ampforwp_get_setting('ampforwp-advertisement-sticky-type') == 3) {?>
731
  .toggle-navigationv2 a { color:#fff; }
732
  <?php } ?>
733
  <?php if ( ampforwp_get_setting('ampforwp-callnow-button') ) { ?>
734
- .callnow{ position: absolute; top: 15px; right: 20px }
735
  .callnow a:before { content: ""; position: absolute; right: 23px; width: 4px; height: 8px; border-width: 6px 0 6px 3px; border-style: solid; border-color:<?php echo ampforwp_get_setting('amp-opt-color-rgba-colorscheme-call','color','ampforwp_sanitize_color'); ?>; background: transparent; transform: rotate(-30deg); box-sizing: initial; border-top-left-radius: 3px 5px; border-bottom-left-radius: 3px 5px; }
736
  .rtl .callnow{ left: 75px;right: unset; }
 
 
 
 
737
  <?php } ?>
738
  <?php
739
  if ( class_exists('TablePress') ) { ?>
517
  .amp-category-post{ width: 32%; display: inline-block; word-wrap: break-word;float: left;}
518
  .amp-category-post amp-img{ margin-bottom:5px; }
519
  .amp-category-block li:nth-child(3){ margin: 0 1%; }
520
+ <?php if(ampforwp_get_setting('amp-swift-cart-btn')){?>
521
+ #header .searchmenu{right:18px;}
522
+ .h-shop.h-ic{padding-right: 12px;}
523
+ <?php } ?>
524
  .searchmenu{ margin-right: 15px; margin-top: 11px; position: absolute; top: 0; right: 0; }
525
  .searchmenu button{ background:transparent; border:none }
526
  .amp-logo amp-img{margin: 0 auto; position:relative;top:9px;max-width:190px;}
735
  .toggle-navigationv2 a { color:#fff; }
736
  <?php } ?>
737
  <?php if ( ampforwp_get_setting('ampforwp-callnow-button') ) { ?>
738
+ .callnow{ position: absolute; top: 15px; right: 25px }
739
  .callnow a:before { content: ""; position: absolute; right: 23px; width: 4px; height: 8px; border-width: 6px 0 6px 3px; border-style: solid; border-color:<?php echo ampforwp_get_setting('amp-opt-color-rgba-colorscheme-call','color','ampforwp_sanitize_color'); ?>; background: transparent; transform: rotate(-30deg); box-sizing: initial; border-top-left-radius: 3px 5px; border-bottom-left-radius: 3px 5px; }
740
  .rtl .callnow{ left: 75px;right: unset; }
741
+ <?php if(ampforwp_get_setting('amp-swift-cart-btn') && ampforwp_get_setting('amp-design-3-search-feature') ){?>
742
+ .callnow{margin-right: 18px;}
743
+ <?php } ?>
744
+ <?php if ( ampforwp_get_setting('amp-design-3-search-feature') == false ) { ?>.callnow{ margin-right: 0px; } <?php } ?>
745
  <?php } ?>
746
  <?php
747
  if ( class_exists('TablePress') ) { ?>
templates/design-manager/swift/style.php CHANGED
@@ -681,7 +681,6 @@ if ( ampforwp_get_setting('swift-featued-image-type') == 2) { ?>
681
  .ss-ic li:before{border-radius: 2px;text-align:center;padding: 4px 6px;}
682
  .sgl table {width: 100%;margin-bottom:25px;border: 1px solid #ddd;}
683
  .sgl th , .sgl td {padding: 0.5em 1em;border: 1px solid #ddd;}
684
- .sgl tr:nth-child(odd) td {background: #f7f7f7;}
685
  <?php // Social Sharing Conditional CSS
686
  if($redux_builder_amp['swift-social-position'] == 'above-content'){?>
687
  .shr-txt{display:none;}
681
  .ss-ic li:before{border-radius: 2px;text-align:center;padding: 4px 6px;}
682
  .sgl table {width: 100%;margin-bottom:25px;border: 1px solid #ddd;}
683
  .sgl th , .sgl td {padding: 0.5em 1em;border: 1px solid #ddd;}
 
684
  <?php // Social Sharing Conditional CSS
685
  if($redux_builder_amp['swift-social-position'] == 'above-content'){?>
686
  .shr-txt{display:none;}
templates/features.php CHANGED
@@ -404,7 +404,10 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
404
  }
405
  if (is_category() && class_exists('RankMath') && RankMath\Helper::get_settings( 'general.strip_category_base' ) == true && false == ampforwp_get_setting('ampforwp-category-base-removel-link')) {
406
  return;
407
- }
 
 
 
408
  return esc_url_raw($amp_url);
409
  }
410
  }
@@ -5355,11 +5358,20 @@ if( ! function_exists( 'ampforwp_view_amp_admin_bar' ) ) {
5355
  $current_url = home_url();
5356
  }
5357
  }
5358
- $wp_admin_bar->add_node(array(
 
 
 
 
 
 
 
 
5359
  'id' => 'ampforwp-view-amp',
5360
  'title' => 'View ' . esc_html($post_type_title) . ' (AMP)' ,
5361
  'href' => ampforwp_url_controller($current_url)
5362
  ));
 
5363
  }
5364
  }
5365
  }
@@ -5524,6 +5536,10 @@ function ampforwp_default_logo_data() {
5524
  if(empty($image)){
5525
  $image = @getimagesize( $logo_url );
5526
  }
 
 
 
 
5527
  } else {
5528
  $imageDetail = wp_get_attachment_image_src( $logo_id , 'full');
5529
  $logo_url = $imageDetail[0];
@@ -7336,7 +7352,7 @@ function ampforwp_yoast_breadcrumbs_output(){
7336
  if ( true == ampforwp_get_setting('ampforwp-yoast-bread-crumb') && true === WPSEO_Options::get( 'breadcrumbs-enable' ) && function_exists('yoast_breadcrumb')) {
7337
  $breadcrumb = yoast_breadcrumb('','', false);
7338
  if( true == ampforwp_get_setting('convert-internal-nonamplinks-to-amp') && preg_match('/<a\s+href="(.*?)">(.*?)<\/a>/', $breadcrumb)){
7339
- $breadcrumb = preg_replace('/<a\s+href="(.*?)\/">(.*?)<\/a>/', '<a href="'.ampforwp_url_controller("$1").'">$2</a>', $breadcrumb);
7340
  }
7341
  return $breadcrumb;
7342
  }
@@ -7760,12 +7776,22 @@ function ampforwp_head_css(){
7760
  if(function_exists('autoptimize_autoload')){
7761
  $wp_admin_bar->remove_menu( 'autoptimize' );
7762
  }
7763
- $url = ampforwp_get_non_amp_url();
7764
- $wp_admin_bar->add_node(array(
7765
- 'id' => 'ampforwp-view-non-amp',
7766
- 'title' => 'View Non-AMP' ,
7767
- 'href' => esc_url($url)
7768
- ));
 
 
 
 
 
 
 
 
 
 
7769
  }
7770
  }
7771
 
404
  }
405
  if (is_category() && class_exists('RankMath') && RankMath\Helper::get_settings( 'general.strip_category_base' ) == true && false == ampforwp_get_setting('ampforwp-category-base-removel-link')) {
406
  return;
407
+ }
408
+ if (is_preview()) {
409
+ $amp_url = preg_replace('/(.*?)&(.*?)/', '$1&amp&$2', $amp_url);
410
+ }
411
  return esc_url_raw($amp_url);
412
  }
413
  }
5358
  $current_url = home_url();
5359
  }
5360
  }
5361
+ if (is_preview()) {
5362
+ $current_url = $current_url .'&amp=1&preview=true';
5363
+ $wp_admin_bar->add_node(array(
5364
+ 'id' => 'ampforwp-view-amp',
5365
+ 'title' => 'View ' . esc_html($post_type_title) . ' (AMP)' ,
5366
+ 'href' => esc_url($current_url)
5367
+ ));
5368
+ }else{
5369
+ $wp_admin_bar->add_node(array(
5370
  'id' => 'ampforwp-view-amp',
5371
  'title' => 'View ' . esc_html($post_type_title) . ' (AMP)' ,
5372
  'href' => ampforwp_url_controller($current_url)
5373
  ));
5374
+ }
5375
  }
5376
  }
5377
  }
5536
  if(empty($image)){
5537
  $image = @getimagesize( $logo_url );
5538
  }
5539
+ if ( empty($image[0]) || empty($image[1]) ) {
5540
+ $image[0] = '190';
5541
+ $image[1] = '36';
5542
+ }
5543
  } else {
5544
  $imageDetail = wp_get_attachment_image_src( $logo_id , 'full');
5545
  $logo_url = $imageDetail[0];
7352
  if ( true == ampforwp_get_setting('ampforwp-yoast-bread-crumb') && true === WPSEO_Options::get( 'breadcrumbs-enable' ) && function_exists('yoast_breadcrumb')) {
7353
  $breadcrumb = yoast_breadcrumb('','', false);
7354
  if( true == ampforwp_get_setting('convert-internal-nonamplinks-to-amp') && preg_match('/<a\s+href="(.*?)">(.*?)<\/a>/', $breadcrumb)){
7355
+ $breadcrumb = preg_replace('/<a\s+href="(.*?)\/">(.*?)<\/a>/', '<a href="$1/'.AMPFORWP_AMP_QUERY_VAR.'">$2</a>', $breadcrumb);
7356
  }
7357
  return $breadcrumb;
7358
  }
7776
  if(function_exists('autoptimize_autoload')){
7777
  $wp_admin_bar->remove_menu( 'autoptimize' );
7778
  }
7779
+ if (is_preview()) {
7780
+ $url = get_preview_post_link();
7781
+ $wp_admin_bar->add_node(array(
7782
+ 'id' => 'ampforwp-view-non-amp',
7783
+ 'title' => 'View Non-AMP',
7784
+ 'href' => esc_url($url)
7785
+ ));
7786
+ }
7787
+ else{
7788
+ $url = ampforwp_get_non_amp_url();
7789
+ $wp_admin_bar->add_node(array(
7790
+ 'id' => 'ampforwp-view-non-amp',
7791
+ 'title' => 'View Non-AMP' ,
7792
+ 'href' => esc_url($url)
7793
+ ));
7794
+ }
7795
  }
7796
  }
7797