FEEDZY RSS Feeds Lite - Version 3.8.2

Version Description

Download this release

Release Info

Developer themeisle
Plugin Icon 128x128 FEEDZY RSS Feeds Lite
Version 3.8.2
Comparing to
See all releases

Code changes from version 3.8.1 to 3.8.2

CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  ##### [Version 3.8.1](https://github.com/Codeinwp/feedzy-rss-feeds/compare/v3.8.0...v3.8.1) (2021-12-20)
2
 
3
  - Show the import job title in post row action
1
+ ##### [Version 3.8.2](https://github.com/Codeinwp/feedzy-rss-feeds/compare/v3.8.1...v3.8.2) (2022-01-28)
2
+
3
+ - Add a new filter to add the custom refresh time
4
+ - Remove elementor hidden WP widget feature so feedzy widget can be used
5
+ - Fix keyword filter issue with date filter
6
+ - Fix cURL timeout error
7
+ - Add new import job setting field and manipulate custom tag data
8
+ - Fix trimming title issue for Elementor & Gutenberg
9
+
10
  ##### [Version 3.8.1](https://github.com/Codeinwp/feedzy-rss-feeds/compare/v3.8.0...v3.8.1) (2021-12-20)
11
 
12
  - Show the import job title in post row action
css/feedzy-rss-feeds.css CHANGED
@@ -2,7 +2,7 @@
2
  * feedzy-rss-feeds.css
3
  * Feedzy RSS Feed
4
  * Copyright: (c) 2016 Themeisle, themeisle.com
5
- * Version: 3.8.1
6
  * Plugin Name: FEEDZY RSS Feeds
7
  * Plugin URI: http://themeisle.com/plugins/feedzy-rss-feeds/
8
  * Author: Themeisle
2
  * feedzy-rss-feeds.css
3
  * Feedzy RSS Feed
4
  * Copyright: (c) 2016 Themeisle, themeisle.com
5
+ * Version: 3.8.2
6
  * Plugin Name: FEEDZY RSS Feeds
7
  * Plugin URI: http://themeisle.com/plugins/feedzy-rss-feeds/
8
  * Author: Themeisle
feedzy-rss-feed.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: Feedzy RSS Feeds Lite
16
  * Plugin URI: https://themeisle.com/plugins/feedzy-rss-feeds-lite/
17
  * Description: A small and lightweight RSS aggregator plugin. Fast and very easy to use, it allows you to aggregate multiple RSS feeds into your WordPress site through fully customizable shortcodes & widgets.
18
- * Version: 3.8.1
19
  * Author: Themeisle
20
  * Author URI: http://themeisle.com
21
  * License: GPL-2.0+
15
  * Plugin Name: Feedzy RSS Feeds Lite
16
  * Plugin URI: https://themeisle.com/plugins/feedzy-rss-feeds-lite/
17
  * Description: A small and lightweight RSS aggregator plugin. Fast and very easy to use, it allows you to aggregate multiple RSS feeds into your WordPress site through fully customizable shortcodes & widgets.
18
+ * Version: 3.8.2
19
  * Author: Themeisle
20
  * Author URI: http://themeisle.com
21
  * License: GPL-2.0+
includes/abstract/feedzy-rss-feeds-admin-abstract.php CHANGED
@@ -311,7 +311,7 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
311
  if ( ! empty( $keywords ) ) {
312
  $continue = false;
313
  if ( ! empty( $inc_on ) ) {
314
- $continue = $this->feedzy_feed_item_keywords_by( $inc_on, $keywords, $item );
315
  } else {
316
  if ( preg_match( "/^$keywords.*$/i", $item->get_title() ) || preg_match( "/^$keywords.*$/i", $item->get_description() ) ) {
317
  $continue = true;
@@ -323,7 +323,7 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
323
  if ( ! empty( $keywords ) ) {
324
  $continue = false;
325
  if ( ! empty( $inc_on ) ) {
326
- $continue = $this->feedzy_feed_item_keywords_by( $inc_on, $keywords, $item );
327
  } else {
328
  if ( preg_match( "/^$keywords.*$/i", $item->get_title() ) ) {
329
  $continue = true;
@@ -336,7 +336,7 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
336
  $keywords = $sc['keywords_exc'];
337
  if ( ! empty( $keywords ) ) {
338
  if ( ! empty( $exc_on ) ) {
339
- $exc_item = $this->feedzy_feed_item_keywords_by( $exc_on, $keywords, $item );
340
  if ( $exc_item ) {
341
  $continue = false;
342
  }
@@ -350,7 +350,7 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
350
  $keywords = $sc['keywords_ban'];
351
  if ( ! empty( $keywords ) ) {
352
  if ( ! empty( $exc_on ) ) {
353
- $keywords_ban = $this->feedzy_feed_item_keywords_by( $exc_on, $keywords, $item );
354
  if ( $keywords_ban ) {
355
  $continue = false;
356
  }
@@ -1310,11 +1310,14 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
1310
  $content_title = html_entity_decode( $item->get_title(), ENT_QUOTES, 'UTF-8' );
1311
  if ( is_numeric( $sc['title'] ) ) {
1312
  $length = intval( $sc['title'] );
 
 
 
1313
  if ( $length > 0 && strlen( $content_title ) > $length ) {
1314
  $content_title = preg_replace( '/\s+?(\S+)?$/', '', substr( $content_title, 0, $length ) ) . '...';
1315
  }
1316
  }
1317
- if ( empty( $content_title ) ) {
1318
  $content_title = esc_html__( 'Post Title', 'feedzy-rss-feeds' );
1319
  }
1320
  $content_title = apply_filters( 'feedzy_title_output', $content_title, $feed_url, $item );
@@ -1771,20 +1774,22 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
1771
  *
1772
  * @return bool
1773
  */
1774
- public function feedzy_feed_item_keywords_by( $filter_by = '', $keywords = '', $item ) {
 
 
1775
  if ( empty( $filter_by ) ) {
1776
- return false;
1777
  }
1778
 
1779
  if ( 'title' === $filter_by ) {
1780
  $item_title = wp_strip_all_tags( $item->get_title(), true );
1781
  if ( ! empty( $item_title ) && preg_match( "/^$keywords.*$/i", $item_title ) ) {
1782
- return true;
1783
  }
1784
  } elseif ( 'description' === $filter_by ) {
1785
  $description = wp_strip_all_tags( $item->get_content(), true );
1786
  if ( ! empty( $description ) && preg_match( "/^$keywords.*$/i", $description ) ) {
1787
- return true;
1788
  }
1789
  } elseif ( 'author' === $filter_by ) {
1790
  $author = $item->get_author();
@@ -1793,15 +1798,23 @@ abstract class Feedzy_Rss_Feeds_Admin_Abstract {
1793
  $author_name = $author->get_name();
1794
  }
1795
  if ( ! empty( $author_name ) && preg_match( "/^$keywords.*$/i", $author_name ) ) {
1796
- return true;
1797
  }
1798
  } elseif ( 'fullcontent' === $filter_by ) {
1799
  $content = $item->get_item_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'full-content' );
1800
  $content = wp_strip_all_tags( $content[0]['data'], true );
1801
  if ( ! empty( $content ) && preg_match( "/^$keywords.*$/i", $content ) ) {
1802
- return true;
1803
  }
1804
  }
1805
- return false;
 
 
 
 
 
 
 
 
1806
  }
1807
  }
311
  if ( ! empty( $keywords ) ) {
312
  $continue = false;
313
  if ( ! empty( $inc_on ) ) {
314
+ $continue = $this->feedzy_feed_item_keywords_by( $inc_on, $keywords, $item, $sc );
315
  } else {
316
  if ( preg_match( "/^$keywords.*$/i", $item->get_title() ) || preg_match( "/^$keywords.*$/i", $item->get_description() ) ) {
317
  $continue = true;
323
  if ( ! empty( $keywords ) ) {
324
  $continue = false;
325
  if ( ! empty( $inc_on ) ) {
326
+ $continue = $this->feedzy_feed_item_keywords_by( $inc_on, $keywords, $item, $sc );
327
  } else {
328
  if ( preg_match( "/^$keywords.*$/i", $item->get_title() ) ) {
329
  $continue = true;
336
  $keywords = $sc['keywords_exc'];
337
  if ( ! empty( $keywords ) ) {
338
  if ( ! empty( $exc_on ) ) {
339
+ $exc_item = $this->feedzy_feed_item_keywords_by( $exc_on, $keywords, $item, $sc );
340
  if ( $exc_item ) {
341
  $continue = false;
342
  }
350
  $keywords = $sc['keywords_ban'];
351
  if ( ! empty( $keywords ) ) {
352
  if ( ! empty( $exc_on ) ) {
353
+ $keywords_ban = $this->feedzy_feed_item_keywords_by( $exc_on, $keywords, $item, $sc );
354
  if ( $keywords_ban ) {
355
  $continue = false;
356
  }
1310
  $content_title = html_entity_decode( $item->get_title(), ENT_QUOTES, 'UTF-8' );
1311
  if ( is_numeric( $sc['title'] ) ) {
1312
  $length = intval( $sc['title'] );
1313
+ if ( 0 === $length ) {
1314
+ $content_title = '';
1315
+ }
1316
  if ( $length > 0 && strlen( $content_title ) > $length ) {
1317
  $content_title = preg_replace( '/\s+?(\S+)?$/', '', substr( $content_title, 0, $length ) ) . '...';
1318
  }
1319
  }
1320
+ if ( ! is_numeric( $sc['title'] ) && empty( $content_title ) ) {
1321
  $content_title = esc_html__( 'Post Title', 'feedzy-rss-feeds' );
1322
  }
1323
  $content_title = apply_filters( 'feedzy_title_output', $content_title, $feed_url, $item );
1774
  *
1775
  * @return bool
1776
  */
1777
+ public function feedzy_feed_item_keywords_by( $filter_by = '', $keywords = '', $item, $sc = array() ) {
1778
+ $is_valid = false;
1779
+
1780
  if ( empty( $filter_by ) ) {
1781
+ return $is_valid;
1782
  }
1783
 
1784
  if ( 'title' === $filter_by ) {
1785
  $item_title = wp_strip_all_tags( $item->get_title(), true );
1786
  if ( ! empty( $item_title ) && preg_match( "/^$keywords.*$/i", $item_title ) ) {
1787
+ $is_valid = true;
1788
  }
1789
  } elseif ( 'description' === $filter_by ) {
1790
  $description = wp_strip_all_tags( $item->get_content(), true );
1791
  if ( ! empty( $description ) && preg_match( "/^$keywords.*$/i", $description ) ) {
1792
+ $is_valid = true;
1793
  }
1794
  } elseif ( 'author' === $filter_by ) {
1795
  $author = $item->get_author();
1798
  $author_name = $author->get_name();
1799
  }
1800
  if ( ! empty( $author_name ) && preg_match( "/^$keywords.*$/i", $author_name ) ) {
1801
+ $is_valid = true;
1802
  }
1803
  } elseif ( 'fullcontent' === $filter_by ) {
1804
  $content = $item->get_item_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'full-content' );
1805
  $content = wp_strip_all_tags( $content[0]['data'], true );
1806
  if ( ! empty( $content ) && preg_match( "/^$keywords.*$/i", $content ) ) {
1807
+ $is_valid = true;
1808
  }
1809
  }
1810
+
1811
+ // Date filter.
1812
+ if ( $is_valid && ( ! empty( $sc['from_datetime'] ) && ! empty( $sc['to_datetime'] ) ) ) {
1813
+ $from_datetime = strtotime( $sc['from_datetime'] );
1814
+ $to_datetime = strtotime( $sc['to_datetime'] );
1815
+ $item_date = strtotime( $item->get_date() );
1816
+ $is_valid = ( ( $from_datetime <= $item_date ) && ( $item_date <= $to_datetime ) );
1817
+ }
1818
+ return $is_valid;
1819
  }
1820
  }
includes/admin/feedzy-rss-feeds-admin.php CHANGED
@@ -610,6 +610,8 @@ class Feedzy_Rss_Feeds_Admin extends Feedzy_Rss_Feeds_Admin_Abstract {
610
  $args['reject_unsafe_urls'] = false;
611
  // allow SSLs to go through without certificate verification.
612
  $args['sslverify'] = false;
 
 
613
 
614
  return $args;
615
  }
@@ -826,4 +828,14 @@ class Feedzy_Rss_Feeds_Admin extends Feedzy_Rss_Feeds_Admin_Abstract {
826
  break;
827
  }
828
  }
 
 
 
 
 
 
 
 
 
 
829
  }
610
  $args['reject_unsafe_urls'] = false;
611
  // allow SSLs to go through without certificate verification.
612
  $args['sslverify'] = false;
613
+ // Set timeout.
614
+ $args['timeout'] = 300;
615
 
616
  return $args;
617
  }
828
  break;
829
  }
830
  }
831
+
832
+ /**
833
+ * Remove elementor register feature.
834
+ *
835
+ * @param object $manager_object Manager class object.
836
+ * @param array $experimental_data Experimental data.
837
+ */
838
+ public function feedzy_remove_elementor_feature( $manager_object, $experimental_data ) {
839
+ $manager_object->remove_feature( 'e_hidden_wordpress_widgets' );
840
+ }
841
  }
includes/admin/feedzy-rss-feeds-import.php CHANGED
@@ -300,6 +300,7 @@ class Feedzy_Rss_Feeds_Import {
300
  $exc_on = get_post_meta( $post->ID, 'exc_on', true );
301
  $import_title = get_post_meta( $post->ID, 'import_post_title', true );
302
  $import_date = get_post_meta( $post->ID, 'import_post_date', true );
 
303
  $import_content = get_post_meta( $post->ID, 'import_post_content', true );
304
  $import_item_img_url = get_post_meta( $post->ID, 'import_use_external_image', true );
305
  $import_item_img_url = 'yes' === $import_item_img_url ? 'checked' : '';
@@ -1124,6 +1125,7 @@ class Feedzy_Rss_Feeds_Import {
1124
  $exc_on = get_post_meta( $job->ID, 'exc_on', true );
1125
  $import_title = get_post_meta( $job->ID, 'import_post_title', true );
1126
  $import_date = get_post_meta( $job->ID, 'import_post_date', true );
 
1127
  $import_content = get_post_meta( $job->ID, 'import_post_content', true );
1128
  $import_featured_img = get_post_meta( $job->ID, 'import_post_featured_img', true );
1129
  $import_post_type = get_post_meta( $job->ID, 'import_post_type', true );
@@ -1403,6 +1405,25 @@ class Feedzy_Rss_Feeds_Import {
1403
  $post_content = trim( $post_content );
1404
  }
1405
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1406
  $new_post = apply_filters(
1407
  'feedzy_insert_post_args',
1408
  array(
@@ -1411,10 +1432,12 @@ class Feedzy_Rss_Feeds_Import {
1411
  'post_content' => $post_content,
1412
  'post_date' => $post_date,
1413
  'post_status' => $import_post_status,
 
1414
  ),
1415
  $item,
1416
  $post_title,
1417
  $post_content,
 
1418
  $index,
1419
  $job
1420
  );
@@ -2308,4 +2331,18 @@ class Feedzy_Rss_Feeds_Import {
2308
  }
2309
  wp_die();
2310
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2311
  }
300
  $exc_on = get_post_meta( $post->ID, 'exc_on', true );
301
  $import_title = get_post_meta( $post->ID, 'import_post_title', true );
302
  $import_date = get_post_meta( $post->ID, 'import_post_date', true );
303
+ $post_excerpt = get_post_meta( $post->ID, 'import_post_excerpt', true );
304
  $import_content = get_post_meta( $post->ID, 'import_post_content', true );
305
  $import_item_img_url = get_post_meta( $post->ID, 'import_use_external_image', true );
306
  $import_item_img_url = 'yes' === $import_item_img_url ? 'checked' : '';
1125
  $exc_on = get_post_meta( $job->ID, 'exc_on', true );
1126
  $import_title = get_post_meta( $job->ID, 'import_post_title', true );
1127
  $import_date = get_post_meta( $job->ID, 'import_post_date', true );
1128
+ $post_excerpt = get_post_meta( $job->ID, 'import_post_excerpt', true );
1129
  $import_content = get_post_meta( $job->ID, 'import_post_content', true );
1130
  $import_featured_img = get_post_meta( $job->ID, 'import_post_featured_img', true );
1131
  $import_post_type = get_post_meta( $job->ID, 'import_post_type', true );
1405
  $post_content = trim( $post_content );
1406
  }
1407
  }
1408
+
1409
+ $item_post_excerpt = str_replace(
1410
+ array(
1411
+ '[#item_title]',
1412
+ '[#item_content]',
1413
+ '[#item_description]',
1414
+ ),
1415
+ array(
1416
+ $post_title,
1417
+ $post_content,
1418
+ $item['item_description'],
1419
+ ),
1420
+ $post_excerpt
1421
+ );
1422
+
1423
+ if ( $this->feedzy_is_business() ) {
1424
+ $item_post_excerpt = apply_filters( 'feedzy_parse_custom_tags', $item_post_excerpt, ! empty( $xml_results ) ? $xml_results['feed'] : $results['feed'], $item['item_index'] );
1425
+ }
1426
+
1427
  $new_post = apply_filters(
1428
  'feedzy_insert_post_args',
1429
  array(
1432
  'post_content' => $post_content,
1433
  'post_date' => $post_date,
1434
  'post_status' => $import_post_status,
1435
+ 'post_excerpt' => $item_post_excerpt,
1436
  ),
1437
  $item,
1438
  $post_title,
1439
  $post_content,
1440
+ $item_post_excerpt,
1441
  $index,
1442
  $job
1443
  );
2331
  }
2332
  wp_die();
2333
  }
2334
+
2335
+ /**
2336
+ * Renders the tags for the post excerpt.
2337
+ *
2338
+ * @access public
2339
+ *
2340
+ * @param array $default The default tags, empty.
2341
+ */
2342
+ public function magic_tags_post_excerpt( $default ) {
2343
+ $default['item_title'] = __( 'Item Title', 'feedzy-rss-feeds' );
2344
+ $default['item_content'] = __( 'Item Content', 'feedzy-rss-feeds' );
2345
+ $default['item_description'] = __( 'Item Description', 'feedzy-rss-feeds' );
2346
+ return $default;
2347
+ }
2348
  }
includes/feedzy-rss-feeds.php CHANGED
@@ -104,7 +104,7 @@ class Feedzy_Rss_Feeds {
104
  */
105
  public function init() {
106
  self::$plugin_name = 'feedzy-rss-feeds';
107
- self::$version = '3.8.1';
108
  self::$instance->load_dependencies();
109
  self::$instance->set_locale();
110
  self::$instance->define_admin_hooks();
@@ -262,6 +262,9 @@ class Feedzy_Rss_Feeds {
262
  self::$instance->loader->add_filter( 'feedzy_is_license_of_type', $plugin_import, 'feedzy_is_license_of_type', 10, 2 );
263
  self::$instance->loader->add_filter( 'post_row_actions', $plugin_import, 'add_import_actions', 10, 2 );
264
  self::$instance->loader->add_filter( 'wp_kses_allowed_html', $plugin_import, 'feedzy_wp_kses_allowed_html', 10, 2 );
 
 
 
265
  }
266
 
267
  if ( ! defined( 'TI_UNIT_TESTING' ) ) {
104
  */
105
  public function init() {
106
  self::$plugin_name = 'feedzy-rss-feeds';
107
+ self::$version = '3.8.2';
108
  self::$instance->load_dependencies();
109
  self::$instance->set_locale();
110
  self::$instance->define_admin_hooks();
262
  self::$instance->loader->add_filter( 'feedzy_is_license_of_type', $plugin_import, 'feedzy_is_license_of_type', 10, 2 );
263
  self::$instance->loader->add_filter( 'post_row_actions', $plugin_import, 'add_import_actions', 10, 2 );
264
  self::$instance->loader->add_filter( 'wp_kses_allowed_html', $plugin_import, 'feedzy_wp_kses_allowed_html', 10, 2 );
265
+ self::$instance->loader->add_filter( 'feedzy_magic_tags_post_excerpt', $plugin_import, 'magic_tags_post_excerpt', 11 );
266
+ // Remove elementor feature.
267
+ self::$instance->loader->add_action( 'elementor/experiments/feature-registered', self::$instance->admin, 'feedzy_remove_elementor_feature', 10, 2 );
268
  }
269
 
270
  if ( ! defined( 'TI_UNIT_TESTING' ) ) {
includes/gutenberg/build/block.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={20:e=>{var t="%[a-f0-9]{2}",r=new RegExp(t,"gi"),a=new RegExp("("+t+")+","gi");function n(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),a=e.slice(t);return Array.prototype.concat.call([],n(r),n(a))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),a=1;a<t.length;a++)t=(e=n(t,a).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=a.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var n=o(r[0]);n!==r[0]&&(t[r[0]]=n)}r=a.exec(e)}t["%C2"]="�";for(var s=Object.keys(t),i=0;i<s.length;i++){var l=s[i];e=e.replace(new RegExp(l,"g"),t[l])}return e}(e)}}},806:e=>{e.exports=function(e,t){for(var r={},a=Object.keys(e),n=Array.isArray(t),o=0;o<a.length;o++){var s=a[o],i=e[s];(n?-1!==t.indexOf(s):t(s,i,e))&&(r[s]=i)}return r}},563:(e,t,r)=>{const a=r(610),n=r(20),o=r(500),s=r(806);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function l(e,t){return t.encode?t.strict?a(e):encodeURIComponent(e):e}function p(e,t){return t.decode?n(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function c(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function m(e){const t=(e=c(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function d(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function f(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,a)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===a[e]&&(a[e]={}),a[e][t[1]]=r):a[e]=r};case"bracket":return(e,r,a)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==a[e]?a[e]=[].concat(a[e],r):a[e]=[r]:a[e]=r};case"comma":case"separator":return(t,r,a)=>{const n="string"==typeof r&&r.includes(e.arrayFormatSeparator),o="string"==typeof r&&!n&&p(r,e).includes(e.arrayFormatSeparator);r=o?p(r,e):r;const s=n||o?r.split(e.arrayFormatSeparator).map((t=>p(t,e))):null===r?r:p(r,e);a[t]=s};case"bracket-separator":return(t,r,a)=>{const n=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!n)return void(a[t]=r?p(r,e):r);const o=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>p(t,e)));void 0!==a[t]?a[t]=[].concat(a[t],o):a[t]=o};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),a=Object.create(null);if("string"!=typeof e)return a;if(!(e=e.trim().replace(/^[?#&]/,"")))return a;for(const n of e.split("&")){if(""===n)continue;let[e,s]=o(t.decode?n.replace(/\+/g," "):n,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:p(s,t),r(p(e,t),s,a)}for(const e of Object.keys(a)){const r=a[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=d(r[e],t);else a[e]=d(r,t)}return!1===t.sort?a:(!0===t.sort?Object.keys(a).sort():Object.keys(a).sort(t.sort)).reduce(((e,t)=>{const r=a[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=u(r):e[t]=r,e}),Object.create(null))}t.extract=m,t.parse=f,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],a=function(e){switch(e.arrayFormat){case"index":return t=>(r,a)=>{const n=r.length;return void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?r:null===a?[...r,[l(t,e),"[",n,"]"].join("")]:[...r,[l(t,e),"[",l(n,e),"]=",l(a,e)].join("")]};case"bracket":return t=>(r,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?r:null===a?[...r,[l(t,e),"[]"].join("")]:[...r,[l(t,e),"[]=",l(a,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(a,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?a:(n=null===n?"":n,0===a.length?[[l(r,e),t,l(n,e)].join("")]:[[a,l(n,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?r:null===a?[...r,l(t,e)]:[...r,[l(t,e),"=",l(a,e)].join("")]}}(t),n={};for(const t of Object.keys(e))r(t)||(n[t]=e[t]);const o=Object.keys(n);return!1!==t.sort&&o.sort(t.sort),o.map((r=>{const n=e[r];return void 0===n?"":null===n?l(r,t):Array.isArray(n)?0===n.length&&"bracket-separator"===t.arrayFormat?l(r,t)+"[]":n.reduce(a(r),[]).join("&"):l(r,t)+"="+l(n,t)})).filter((e=>e.length>0)).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,a]=o(e,"#");return Object.assign({url:r.split("?")[0]||"",query:f(m(e),t)},t&&t.parseFragmentIdentifier&&a?{fragmentIdentifier:p(a,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const a=c(e.url).split("?")[0]||"",n=t.extract(e.url),o=t.parse(n,{sort:!1}),s=Object.assign(o,e.query);let i=t.stringify(s,r);i&&(i=`?${i}`);let p=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(p=`#${l(e.fragmentIdentifier,r)}`),`${a}${i}${p}`},t.pick=(e,r,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:n,query:o,fragmentIdentifier:i}=t.parseUrl(e,a);return t.stringifyUrl({url:n,query:s(o,r),fragmentIdentifier:i},a)},t.exclude=(e,r,a)=>{const n=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,n,a)}},500:e=>{e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},610:e=>{e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,r),o.exports}(()=>{var e=r(563),t=lodash.isEmpty,a=wp.components.BaseControl;const n=(0,wp.compose.withInstanceId)((function(e){var r=e.label,n=e.selected,o=e.help,s=e.instanceId,i=e.onChange,l=e.disabled,p=e.options,u=void 0===p?[]:p,c="inspector-radio-image-control-".concat(s),m=function(e){return i(e.target.value)};return!t(u)&&wp.element.createElement(a,{label:r,id:c,help:o,className:"components-radio-image-control"},wp.element.createElement("div",{className:"components-radio-image-control__container"},u.map((function(e,t){return wp.element.createElement("div",{key:"".concat(c,"-").concat(t),className:"components-radio-image-control__option"},wp.element.createElement("input",{id:"".concat(c,"-").concat(t),className:"components-radio-image-control__input",type:"radio",name:c,value:e.value,onChange:m,checked:e.value===n,"aria-describedby":o?"".concat(c,"__help"):void 0,disabled:l}),wp.element.createElement("label",{htmlFor:"".concat(c,"-").concat(t),title:e.label},wp.element.createElement("img",{src:e.src}),wp.element.createElement("span",{class:"image-clickable"})))}))))}));function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=wp.i18n.__,m=wp.blockEditor||wp.editor,d=m.InspectorControls,f=m.MediaUpload,h=wp.element,y=h.Component,b=(h.Fragment,wp.components),g=b.BaseControl,v=b.ExternalLink,w=b.PanelBody,E=b.RangeControl,k=b.TextControl,C=b.Button,T=b.ToggleControl,x=b.SelectControl,z=b.ResponsiveWrapper;const N=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(h,e);var t,r,a,o,m=(a=h,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=u(a);if(o){var r=u(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return p(this,e)});function h(){return s(this,h),m.apply(this,arguments)}return t=h,(r=[{key:"render",value:function(){var e=this,t="";return"https"===this.props.attributes.http&&(t+=c("Please verify that the images exist on HTTPS.")),wp.element.createElement(d,{key:"inspector"},0!==this.props.attributes.status&&wp.element.createElement(w,null,wp.element.createElement(k,{label:c("Feed Source"),className:"feedzy-source",value:this.props.attributes.feeds,onChange:this.props.edit.onChangeFeed}),wp.element.createElement(C,{isLarge:!0,isPrimary:!0,type:"submit",onClick:this.props.edit.loadFeed,className:"loadFeed"},c("Load Feed"))),"fetched"===this.props.state.route&&[wp.element.createElement(w,{title:c("Feed Settings"),initialOpen:!0,className:"feedzy-options"},wp.element.createElement(E,{label:c("Number of Items"),value:Number(this.props.attributes.max)||5,onChange:this.props.edit.onChangeMax,min:1,max:this.props.attributes.feedData.items.length||10,beforeIcon:"sort",className:"feedzy-max"}),wp.element.createElement(E,{label:c("Ignore first N items"),value:Number(this.props.attributes.offset)||0,onChange:this.props.edit.onChangeOffset,min:0,max:this.props.attributes.feedData.items.length,beforeIcon:"sort",className:"feedzy-offset"}),null!==this.props.attributes.feedData.channel&&wp.element.createElement(T,{label:c("Display feed title?"),checked:!!this.props.attributes.feed_title,onChange:this.props.edit.onToggleFeedTitle,className:"feedzy-title"}),wp.element.createElement(T,{label:c("Lazy load feed?"),checked:!!this.props.attributes.lazy,onChange:this.props.edit.onToggleLazy,className:"feedzy-lazy",help:c("Only on the front end.")}),wp.element.createElement(x,{label:c("Feed Caching Time"),value:this.props.attributes.refresh,options:[{label:c("1 Hour"),value:"1_hours"},{label:c("2 Hours"),value:"3_hours"},{label:c("12 Hours"),value:"12_hours"},{label:c("1 Day"),value:"1_days"},{label:c("3 Days"),value:"3_days"},{label:c("15 Days"),value:"15_days"}],onChange:this.props.edit.onRefresh,className:"feedzy-refresh"}),wp.element.createElement(x,{label:c("Sorting Order"),value:this.props.attributes.sort,options:[{label:c("Default"),value:"default"},{label:c("Date Descending"),value:"date_desc"},{label:c("Date Ascending"),value:"date_asc"},{label:c("Title Descending"),value:"title_desc"},{label:c("Title Ascending"),value:"title_asc"}],onChange:this.props.edit.onSort,className:"feedzy-sort"})),wp.element.createElement(w,{title:c("Item Options"),initialOpen:!1,className:"feedzy-item-options"},wp.element.createElement(x,{label:c("Open Links In"),value:this.props.attributes.target,options:[{label:c("New Tab"),value:"_blank"},{label:c("Same Tab"),value:"_self"}],onChange:this.props.edit.onTarget}),wp.element.createElement(k,{label:c("Title Character Limit"),help:c("Leave empty to show full title."),type:"number",value:this.props.attributes.title,onChange:this.props.edit.onTitle,className:"feedzy-title-length",min:0}),wp.element.createElement(g,null,wp.element.createElement(k,{label:feedzyjs.isPro?c("Should we display additional meta fields out of author, date, time or categories? (comma-separated list, in order of display)."):c("Should we display additional meta fields out of author, date or time? (comma-separated list, in order of display)."),help:c('Leave empty to display all and "no" to display nothing.'),placeholder:feedzyjs.isPro?c("(eg: author, date, time, tz=local, categories)"):c("(eg: author, date, time, tz=local)"),value:this.props.attributes.metafields,onChange:this.props.edit.onChangeMeta,className:"feedzy-meta"}),wp.element.createElement(k,{label:c("When using multiple sources, should we display additional meta fields? - source (comma-separated list)."),placeholder:c("(eg: source)"),value:this.props.attributes.multiple_meta,onChange:this.props.edit.onChangeMultipleMeta,className:"feedzy-multiple-meta"}),wp.element.createElement(v,{href:"https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed"},c("You can find more info about available meta field values here."))),wp.element.createElement(T,{label:c("Display post description?"),checked:!!this.props.attributes.summary,onChange:this.props.edit.onToggleSummary,className:"feedzy-summary"}),this.props.attributes.summary&&wp.element.createElement(k,{label:c("Description Character Limit"),help:c("Leave empty to show full description."),type:"number",value:this.props.attributes.summarylength,onChange:this.props.edit.onSummaryLength,className:"feedzy-summary-length",min:0}),feedzyjs.isPro&&[wp.element.createElement(k,{label:c("Only display if selected field contains:"),help:c("Use comma(,) and plus(+) keyword"),value:this.props.attributes.keywords_title,onChange:this.props.edit.onKeywordsTitle,className:"feedzy-include"}),wp.element.createElement(x,{label:c("Select a field if you want to inc keyword."),value:this.props.attributes.keywords_inc_on,options:[{label:c("Title"),value:"title"},{label:c("Author"),value:"author"},{label:c("Description"),value:"description"}],onChange:this.props.edit.onKeywordsIncludeOn}),wp.element.createElement(k,{label:c("Exclude if selected field contains:"),help:c("Use comma(,) and plus(+) keyword"),value:this.props.attributes.keywords_ban,onChange:this.props.edit.onKeywordsBan,className:"feedzy-ban"}),wp.element.createElement(x,{label:c("Select a field if you want to exc keyword."),value:this.props.attributes.keywords_exc_on,options:[{label:c("Title"),value:"title"},{label:c("Author"),value:"author"},{label:c("Description"),value:"description"}],onChange:this.props.edit.onKeywordsExcludeOn}),wp.element.createElement("p",null,c("Filter feed item by date range.")),wp.element.createElement(k,{type:"datetime-local",label:c("From:"),value:this.props.attributes.from_datetime,onChange:this.props.edit.onFromDateTime}),wp.element.createElement(k,{type:"datetime-local",label:c("To:"),value:this.props.attributes.to_datetime,onChange:this.props.edit.onToDateTime})]),wp.element.createElement(w,{title:c("Item Image Options"),initialOpen:!1,className:"feedzy-image-options"},wp.element.createElement(x,{label:c("Display first image if available?"),value:this.props.attributes.thumb,options:[{label:c("Yes (without a fallback image)"),value:"auto"},{label:c("Yes (with a fallback image)"),value:"yes"},{label:c("No"),value:"no"}],onChange:this.props.edit.onThumb,className:"feedzy-thumb"}),"no"!==this.props.attributes.thumb&&["auto"!==this.props.attributes.thumb&&wp.element.createElement("div",{className:"feedzy-blocks-base-control"},wp.element.createElement("label",{className:"blocks-base-control__label",for:"inspector-media-upload"},c("Fallback image if no image is found.")),wp.element.createElement(f,{type:"image",id:"inspector-media-upload",value:this.props.attributes.default,onSelect:this.props.edit.onDefault,render:function(t){var r=t.open;return[void 0!==e.props.attributes.default&&[wp.element.createElement(z,{naturalWidth:e.props.attributes.default.width,naturalHeight:e.props.attributes.default.height},wp.element.createElement("img",{src:e.props.attributes.default.url,alt:c("Featured image")})),wp.element.createElement(C,{isLarge:!0,isSecondary:!0,onClick:function(){return e.props.setAttributes({default:void 0})},style:{marginTop:"10px"}},c("Remove Image"))],wp.element.createElement(C,{isLarge:!0,isPrimary:!0,onClick:r,style:{marginTop:"10px"},className:void 0===e.props.attributes.default&&"feedzy_image_upload"},c("Upload Image"))]}})),wp.element.createElement(k,{label:c("Thumbnails dimension."),type:"number",value:this.props.attributes.size,onChange:this.props.edit.onSize}),wp.element.createElement(x,{label:c("How should we treat HTTP images?"),value:this.props.attributes.http,options:[{label:c("Show with HTTP link"),value:"auto"},{label:c("Force HTTPS"),value:"https"},{label:c("Ignore and show the default image instead"),value:"default"}],onChange:this.props.edit.onHTTP,className:"feedzy-http",help:t})]),feedzyjs.isPro&&wp.element.createElement(w,{title:c("Pro Features"),initialOpen:!1,className:"feedzy-pro-options"},wp.element.createElement(T,{label:c("Display price if available?"),help:this.props.attributes.price&&"default"===this.props.attributes.template?c("Choose a different template for this to work."):null,checked:!!this.props.attributes.price,onChange:this.props.edit.onTogglePrice,className:"feedzy-pro-price"}),wp.element.createElement(k,{label:c("Referral URL parameters."),help:c('Without ("?")'),placeholder:_("(eg. promo_code=feedzy_is_awesome)"),value:this.props.attributes.referral_url,onChange:this.props.edit.onReferralURL}),wp.element.createElement(E,{label:c("Columns"),help:c("How many columns we should use to display the feed items?"),value:this.props.attributes.columns||1,onChange:this.props.edit.onColumns,min:1,max:6,beforeIcon:"sort",allowReset:!0}),wp.element.createElement(n,{label:c("Feed Template"),selected:this.props.attributes.template,options:[{label:c("Default"),src:feedzyjs.imagepath+"feedzy-default-template.jpg",value:"default"},{label:c("Style 1"),src:feedzyjs.imagepath+"feedzy-style1-template.jpg",value:"style1"},{label:c("Style 2"),src:feedzyjs.imagepath+"feedzy-style2-template.jpg",value:"style2"}],onChange:this.props.edit.onTemplate,className:"feedzy-pro-template"}))])}}])&&i(t.prototype,r),h}(y);var O=function(e){var t=document.createElement("div");return t.innerHTML=e,void 0!==t.innerText?t.innerText:t.textContent},S=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t="",r=[];return""!==e&&e.replace(/[^a-zA-Z]/g,"").length<=500&&(e.split(",").forEach((function(e){""!==(e=e.trim())&&(e=e.split("+").map((function(e){return"(?=.*"+(e=e.trim())+")"})),r.push(e.join("")))})),t="^"+(t=r.join("|"))+".*$",t=new RegExp(t,"i")),t};function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(){return(j=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function R(e,t,r,a,n,o,s){try{var i=e[o](s),l=i.value}catch(e){return void r(e)}i.done?t(l):Promise.resolve(l).then(a,n)}function A(e){return function(){var t=this,r=arguments;return new Promise((function(a,n){var o=e.apply(t,r);function s(e){R(o,a,n,s,i,"next",e)}function i(e){R(o,a,n,s,i,"throw",e)}s(void 0)}))}}function L(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e,t){return!t||"object"!==F(t)&&"function"!=typeof t?U(e):t}function U(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function M(e){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var B=wp.i18n.__,K=wp,H=(K.apiFetch,K.apiRequest),$=wp.element,Y=$.Component,V=($.Fragment,wp.components),q=V.ExternalLink,W=V.Placeholder,X=V.TextControl,Q=V.Button,Z=V.Spinner;wp.date.date;const G=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&P(e,t)}(p,t);var r,a,n,o,s,i,l=(s=p,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=M(s);if(i){var r=M(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return I(this,e)});function p(){var e;return L(this,p),(e=l.apply(this,arguments)).loadFeed=e.loadFeed.bind(U(e)),e.loadCategories=e.loadCategories.bind(U(e)),e.metaExists=e.metaExists.bind(U(e)),e.multipleMetaExists=e.multipleMetaExists.bind(U(e)),e.getImageURL=e.getImageURL.bind(U(e)),e.getValidateURL=e.getValidateURL.bind(U(e)),e.onChangeFeed=e.onChangeFeed.bind(U(e)),e.onChangeMax=e.onChangeMax.bind(U(e)),e.onChangeOffset=e.onChangeOffset.bind(U(e)),e.onToggleFeedTitle=e.onToggleFeedTitle.bind(U(e)),e.onRefresh=e.onRefresh.bind(U(e)),e.onSort=e.onSort.bind(U(e)),e.onTarget=e.onTarget.bind(U(e)),e.onTitle=e.onTitle.bind(U(e)),e.onChangeMeta=e.onChangeMeta.bind(U(e)),e.onChangeMultipleMeta=e.onChangeMultipleMeta.bind(U(e)),e.onToggleSummary=e.onToggleSummary.bind(U(e)),e.onToggleLazy=e.onToggleLazy.bind(U(e)),e.onSummaryLength=e.onSummaryLength.bind(U(e)),e.onKeywordsTitle=e.onKeywordsTitle.bind(U(e)),e.onKeywordsBan=e.onKeywordsBan.bind(U(e)),e.onThumb=e.onThumb.bind(U(e)),e.onDefault=e.onDefault.bind(U(e)),e.onSize=e.onSize.bind(U(e)),e.onHTTP=e.onHTTP.bind(U(e)),e.onReferralURL=e.onReferralURL.bind(U(e)),e.onColumns=e.onColumns.bind(U(e)),e.onTemplate=e.onTemplate.bind(U(e)),e.onTogglePrice=e.onTogglePrice.bind(U(e)),e.onKeywordsIncludeOn=e.onKeywordsIncludeOn.bind(U(e)),e.onKeywordsExcludeOn=e.onKeywordsExcludeOn.bind(U(e)),e.onFromDateTime=e.onFromDateTime.bind(U(e)),e.onToDateTime=e.onToDateTime.bind(U(e)),e.feedzyCategoriesList=e.feedzyCategoriesList.bind(U(e)),e.state={route:e.props.attributes.route,loading:!1,error:!1},e}return r=p,(a=[{key:"componentDidMount",value:(o=A(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.loadFeed(),void 0===this.props.attributes.categories&&(this.props.attributes.meta||this.props.setAttributes({meta:!0,metafields:"no"}),setTimeout((function(){t.loadCategories()})));case 2:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"componentDidUpdate",value:(n=A(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"reload"===this.state.route&&this.loadFeed();case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"loadFeed",value:function(){var t=this,r=this.props.attributes.feeds;if(void 0!==r){if(function(e,t){if(void 0===t)return!1;for(var r=!1,a=0;a<t.length;a++)if(t[a]===e){r=!0;break}return r}(r,this.props.attributes.categories)){var a=r;r=e.stringify({category:a},{arrayFormat:"bracket"})}else r=r.replace(/\s/g,"").split(",").filter((function(e){return""!==e})),r=e.stringify({url:r},{arrayFormat:"bracket"});this.setState({route:"home",loading:!0}),H({path:"/feedzy/v1/feed?".concat(r),method:"POST",data:this.props.attributes}).then((function(e){return t.unmounting?e:e.error?(t.setState({route:"home",loading:!1,error:!0}),e):(t.props.setAttributes({feedData:e}),t.setState({route:"fetched",loading:!1}),e)})).fail((function(e){return t.setState({route:"home",loading:!1,error:!0}),e}))}}},{key:"loadCategories",value:function(){var e=this;H({path:"/wp/v2/feedzy_categories?per_page=100"}).then((function(t){if(e.unmounting)return t;var r=0,a=[];t.forEach((function(e){a[r]=e.slug,r+=1}));var n=e;n.props.setAttributes({categories:a}),jQuery(".feedzy-source input").autocomplete({classes:{"ui-autocomplete":"feedzy-ui-autocomplete"},source:a,minLength:0,select:function(e,t){n.props.setAttributes({feeds:t.item.label})}})})).fail((function(e){return e}))}},{key:"metaExists",value:function(e){return 0<=this.props.attributes.metafields.replace(/\s/g,"").split(",").indexOf(e)||""===this.props.attributes.metafields}},{key:"multipleMetaExists",value:function(e){return 0<=this.props.attributes.multiple_meta.replace(/\s/g,"").split(",").indexOf(e)||""===this.props.attributes.multiple_meta}},{key:"getImageURL",value:function(e,t){var r=e.thumbnail?e.thumbnail:this.props.attributes.default?this.props.attributes.default.url:feedzyjs.imagepath+"feedzy.svg";switch(this.props.attributes.http){case"default":-1===r.indexOf("https")&&0===r.indexOf("http")&&(r=this.props.attributes.default?this.props.attributes.default.url:feedzyjs.imagepath+"feedzy.svg");break;case"https":r=r.replace(/http:/g,"https:")}return t&&(r="url("+r+")"),r}},{key:"onChangeFeed",value:function(e){this.props.setAttributes({feeds:e})}},{key:"onChangeMax",value:function(e){this.props.setAttributes({max:e?Number(e):5})}},{key:"onChangeOffset",value:function(e){this.props.setAttributes({offset:Number(e)})}},{key:"onToggleFeedTitle",value:function(e){this.props.setAttributes({feed_title:!this.props.attributes.feed_title})}},{key:"onRefresh",value:function(e){this.props.setAttributes({refresh:e})}},{key:"onSort",value:function(e){this.props.setAttributes({sort:e})}},{key:"onTarget",value:function(e){this.props.setAttributes({target:e})}},{key:"onTitle",value:function(e){this.props.setAttributes({title:Number(e)})}},{key:"onChangeMeta",value:function(e){this.props.setAttributes({metafields:e})}},{key:"onChangeMultipleMeta",value:function(e){this.props.setAttributes({multiple_meta:e})}},{key:"onToggleSummary",value:function(e){this.props.setAttributes({summary:!this.props.attributes.summary})}},{key:"onToggleLazy",value:function(e){this.props.setAttributes({lazy:!this.props.attributes.lazy})}},{key:"onSummaryLength",value:function(e){this.props.setAttributes({summarylength:Number(e)})}},{key:"onKeywordsTitle",value:function(e){this.props.setAttributes({keywords_title:e})}},{key:"onKeywordsBan",value:function(e){this.props.setAttributes({keywords_ban:e})}},{key:"onThumb",value:function(e){this.props.setAttributes({thumb:e})}},{key:"onDefault",value:function(e){this.props.setAttributes({default:e}),this.setState({route:"reload"})}},{key:"onSize",value:function(e){this.props.setAttributes({size:e?Number(e):150})}},{key:"onHTTP",value:function(e){this.props.setAttributes({http:e}),this.setState({route:"reload"})}},{key:"onReferralURL",value:function(e){this.props.setAttributes({referral_url:e})}},{key:"onColumns",value:function(e){this.props.setAttributes({columns:e})}},{key:"onTemplate",value:function(e){this.props.setAttributes({template:e})}},{key:"onTogglePrice",value:function(e){this.props.setAttributes({price:!this.props.attributes.price})}},{key:"onKeywordsIncludeOn",value:function(e){this.props.setAttributes({keywords_inc_on:e})}},{key:"onKeywordsExcludeOn",value:function(e){this.props.setAttributes({keywords_exc_on:e})}},{key:"onFromDateTime",value:function(e){this.props.setAttributes({from_datetime:e})}},{key:"onToDateTime",value:function(e){this.props.setAttributes({to_datetime:e})}},{key:"feedzyCategoriesList",value:function(e){jQuery(".feedzy-source input").autocomplete("search","")}},{key:"getValidateURL",value:function(){var e="https://validator.w3.org/feed/";return this.props.attributes.feeds&&(e+="check.cgi?url="+this.props.attributes.feeds),e}},{key:"render",value:function(){var e,t,r,a,n,o,s,i,l,p,u=this;return["fetched"===this.state.route&&wp.element.createElement(N,j({edit:this,state:this.state},this.props)),"home"===this.state.route&&wp.element.createElement("div",{className:this.props.className},wp.element.createElement(W,{key:"placeholder",icon:"rss",label:B("Feedzy RSS Feeds")},this.state.loading?wp.element.createElement("div",{key:"loading",className:"wp-block-embed is-loading"},wp.element.createElement(Z,null),wp.element.createElement("p",null,B("Fetching..."))):[wp.element.createElement("div",{className:"feedzy-source-wrap"},wp.element.createElement(X,{type:"url",className:"feedzy-source",placeholder:B("Enter URL or category of your feed here..."),onChange:this.onChangeFeed,value:this.props.attributes.feeds}),wp.element.createElement("span",{className:"dashicons dashicons-arrow-down-alt2",onClick:this.feedzyCategoriesList})),wp.element.createElement(Q,{isLarge:!0,isPrimary:!0,type:"submit",onClick:this.loadFeed},B("Load Feed")),wp.element.createElement(q,{href:this.getValidateURL(),title:B("Validate Feed ")},B("Validate ")),this.state.error&&wp.element.createElement("div",null,B("Feed URL is invalid. Invalid feeds will NOT display items.")),wp.element.createElement("p",null,B("Enter the full URL of the feed source you wish to display here, or the name of a category you've created. Also you can add multiple URLs just separate them with a comma. You can manage your categories feed from")," ",wp.element.createElement("a",{href:"edit.php?post_type=feedzy_categories",title:B("feedzy categories "),target:"_blank"},B("here ")))])),!("fetched"!==this.state.route||void 0===this.props.attributes.feedData)&&wp.element.createElement("div",{className:"feedzy-rss"},this.props.attributes.feed_title&&null!==this.props.attributes.feedData.channel&&wp.element.createElement("div",{className:"rss_header"},wp.element.createElement("h2",null,wp.element.createElement("a",{className:"rss_title"},O(this.props.attributes.feedData.channel.title)),wp.element.createElement("span",{className:"rss_description"}," "+O(this.props.attributes.feedData.channel.description)))),wp.element.createElement("ul",{className:"feedzy-".concat(this.props.attributes.template)},(e=this.props.attributes.feedData.items,t=this.props.attributes.sort,r=S(this.props.attributes.keywords_title),a=S(this.props.attributes.keywords_ban),n=this.props.attributes.max,o=this.props.attributes.offset,s=this.props.attributes.keywords_inc_on,i=this.props.attributes.keywords_exc_on,l=this.props.attributes.from_datetime,p=this.props.attributes.to_datetime,s="author"===s?"creator":s,i="author"===i?"creator":i,l=""!==l&&void 0!==l&&moment(l).format("X"),p=""!==p&&void 0!==p&&moment(p).format("X"),e=Array.from(e).sort((function(e,r){var a,n;return"date_desc"===t||"date_asc"===t?(a=e.pubDate,n=r.pubDate):"title_desc"!==t&&"title_asc"!==t||(a=e.title.toUpperCase(),n=r.title.toUpperCase()),a<n?"date_desc"===t||"title_desc"===t?1:-1:a>n?"date_desc"===t||"title_desc"===t?-1:1:0})).filter((function(e){return!r||r.test(e[s])})).filter((function(e){return!a||!a.test(e[i])})).filter((function(e){var t=e.date+" "+e.time;return t=moment(new Date(t)).format("X"),!l||!p||l<=t&&t<=p})).slice(o,n+o)).map((function(e,t){var r=(e.date||"")+" "+(e.time||"")+" UTC +0000",a=O(e.date)||"",n=O(e.time)||"",o=O(e.categories)||"";if(u.metaExists("tz=local")){var s=new Date(r);s=s.toUTCString(),a=moment.utc(s).format("MMMM D, YYYY"),n=moment.utc(s).format("h:mm A")}var i=e.creator&&u.metaExists("author")?e.creator:"";""!==u.props.attributes.multiple_meta&&"no"!==u.props.attributes.multiple_meta&&((u.multipleMetaExists("source")||u.multipleMetaExists("yes"))&&""!==i&&""!==e.source?i=i+" ("+e.source+")":(u.multipleMetaExists("source")||u.multipleMetaExists("yes"))&&""!==e.source&&(i=e.source)),""===e.thumbnail&&"auto"===u.props.attributes.thumb&&(e.thumbnail=e.default_img);var l=new Object;return l.author=B("by")+" "+i,l.date=B("on")+" "+O(a),l.time=B("at")+" "+O(n),l.categories=B("in")+" "+O(o),wp.element.createElement("li",{key:t,style:{padding:"15px 0 25px"},className:"rss_item feedzy-rss-col-".concat(u.props.attributes.columns)},(e.thumbnail&&"auto"===u.props.attributes.thumb||"yes"===u.props.attributes.thumb)&&wp.element.createElement("div",{className:"rss_image",style:{width:u.props.attributes.size+"px",height:u.props.attributes.size+"px"}},wp.element.createElement("a",{title:O(e.title),style:{width:u.props.attributes.size+"px",height:u.props.attributes.size+"px"}},wp.element.createElement("span",{className:"fetched",style:{width:u.props.attributes.size+"px",height:u.props.attributes.size+"px",backgroundImage:u.getImageURL(e,!0)},title:O(e.title)}))),wp.element.createElement("div",{className:"rss_content_wrap"},wp.element.createElement("span",{className:"title"},wp.element.createElement("a",null,u.props.attributes.title&&O(e.title).length>u.props.attributes.title?O(e.title).substring(0,u.props.attributes.title)+"...":O(e.title))),wp.element.createElement("div",{className:"rss_content"},"no"!==u.props.attributes.metafields&&wp.element.createElement("small",{className:"meta"},function(e,t){var r="";""===t&&(t="author, date, time");for(var a=t.replace(/\s/g,"").split(","),n=0;n<a.length;n++)void 0!==e[a[n]]&&(r=r+" "+e[a[n]]);return r}(l,u.props.attributes.metafields)),u.props.attributes.summary&&wp.element.createElement("p",{className:"description"},u.props.attributes.summarylength&&O(e.description).length>u.props.attributes.summarylength?O(e.description).substring(0,u.props.attributes.summarylength)+" [...]":O(e.description)),feedzyjs.isPro&&e.media&&e.media.src&&wp.element.createElement("audio",{controls:!0,controlsList:"nodownload"},wp.element.createElement("source",{src:e.media.src,type:e.media.type}),B("Your browser does not support the audio element. But you can check this for the original link: "),wp.element.createElement("a",{href:e.media.src},e.media.src)),feedzyjs.isPro&&u.props.attributes.price&&e.price&&"default"!==u.props.attributes.template&&wp.element.createElement("div",{className:"price-wrap"},wp.element.createElement("a",null,wp.element.createElement("button",{className:"price"},e.price))))))}))))]}}])&&D(r.prototype,a),p}(Y);var J=wp.i18n.__;(0,wp.blocks.registerBlockType)("feedzy-rss-feeds/feedzy-block",{title:J("Feedzy RSS Feeds"),category:"common",icon:"rss",keywords:[J("Feedzy RSS Feeds"),J("RSS"),J("Feeds")],supports:{html:!1},attributes:{feeds:{type:"string"},max:{type:"number",default:5},offset:{type:"number",default:0},feed_title:{type:"boolean",default:!0},refresh:{type:"string",default:"12_hours"},sort:{type:"string",default:"default"},target:{type:"string",default:"_blank"},title:{type:"number"},meta:{type:"boolean",default:!0},lazy:{type:"boolean",default:!1},metafields:{type:"string",default:""},multiple_meta:{type:"string",default:""},summary:{type:"boolean",default:!0},summarylength:{type:"number"},keywords_title:{type:"string"},keywords_inc_on:{type:"string",default:"title"},keywords_ban:{type:"string"},keywords_exc_on:{type:"string",default:"title"},thumb:{type:"string",default:"auto"},default:{type:"object"},size:{type:"number",default:150},http:{type:"string"},referral_url:{type:"string"},columns:{type:"number",default:1},template:{type:"string",default:"default"},price:{type:"boolean",default:!0},route:{type:"string",default:"home"},feedData:{type:"object"},categories:{type:"object"},from_datetime:{type:"string"},to_datetime:{type:"string"}},edit:G,save:function(){return null}})})()})();
1
+ !function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";const a=r(1),n=r(2),o=r(3),s=r(4);function i(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function l(e,t){return t.encode?t.strict?a(e):encodeURIComponent(e):e}function u(e,t){return t.decode?n(e):e}function p(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function c(e){const t=(e=p(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function m(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function d(e,t){i((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,a)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===a[e]&&(a[e]={}),a[e][t[1]]=r):a[e]=r};case"bracket":return(e,r,a)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==a[e]?a[e]=[].concat(a[e],r):a[e]=[r]:a[e]=r};case"comma":case"separator":return(t,r,a)=>{const n="string"==typeof r&&r.includes(e.arrayFormatSeparator),o="string"==typeof r&&!n&&u(r,e).includes(e.arrayFormatSeparator);r=o?u(r,e):r;const s=n||o?r.split(e.arrayFormatSeparator).map(t=>u(t,e)):null===r?r:u(r,e);a[t]=s};case"bracket-separator":return(t,r,a)=>{const n=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!n)return void(a[t]=r?u(r,e):r);const o=null===r?[]:r.split(e.arrayFormatSeparator).map(t=>u(t,e));void 0!==a[t]?a[t]=[].concat(a[t],o):a[t]=o};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),a=Object.create(null);if("string"!=typeof e)return a;if(!(e=e.trim().replace(/^[?#&]/,"")))return a;for(const n of e.split("&")){if(""===n)continue;let[e,s]=o(t.decode?n.replace(/\+/g," "):n,"=");s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:u(s,t),r(u(e,t),s,a)}for(const e of Object.keys(a)){const r=a[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=m(r[e],t);else a[e]=m(r,t)}return!1===t.sort?a:(!0===t.sort?Object.keys(a).sort():Object.keys(a).sort(t.sort)).reduce((e,t)=>{const r=a[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(r):e[t]=r,e},Object.create(null))}t.extract=c,t.parse=d,t.stringify=(e,t)=>{if(!e)return"";i((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],a=function(e){switch(e.arrayFormat){case"index":return t=>(r,a)=>{const n=r.length;return void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?r:null===a?[...r,[l(t,e),"[",n,"]"].join("")]:[...r,[l(t,e),"[",l(n,e),"]=",l(a,e)].join("")]};case"bracket":return t=>(r,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?r:null===a?[...r,[l(t,e),"[]"].join("")]:[...r,[l(t,e),"[]=",l(a,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(a,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?a:(n=null===n?"":n,0===a.length?[[l(r,e),t,l(n,e)].join("")]:[[a,l(n,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,a)=>void 0===a||e.skipNull&&null===a||e.skipEmptyString&&""===a?r:null===a?[...r,l(t,e)]:[...r,[l(t,e),"=",l(a,e)].join("")]}}(t),n={};for(const t of Object.keys(e))r(t)||(n[t]=e[t]);const o=Object.keys(n);return!1!==t.sort&&o.sort(t.sort),o.map(r=>{const n=e[r];return void 0===n?"":null===n?l(r,t):Array.isArray(n)?0===n.length&&"bracket-separator"===t.arrayFormat?l(r,t)+"[]":n.reduce(a(r),[]).join("&"):l(r,t)+"="+l(n,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,a]=o(e,"#");return Object.assign({url:r.split("?")[0]||"",query:d(c(e),t)},t&&t.parseFragmentIdentifier&&a?{fragmentIdentifier:u(a,t)}:{})},t.stringifyUrl=(e,r)=>{r=Object.assign({encode:!0,strict:!0},r);const a=p(e.url).split("?")[0]||"",n=t.extract(e.url),o=t.parse(n,{sort:!1}),s=Object.assign(o,e.query);let i=t.stringify(s,r);i&&(i="?"+i);let u=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(u="#"+l(e.fragmentIdentifier,r)),`${a}${i}${u}`},t.pick=(e,r,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:n,query:o,fragmentIdentifier:i}=t.parseUrl(e,a);return t.stringifyUrl({url:n,query:s(o,r),fragmentIdentifier:i},a)},t.exclude=(e,r,a)=>{const n=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return t.pick(e,n,a)}},function(e,t,r){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())},function(e,t,r){"use strict";var a=new RegExp("%[a-f0-9]{2}","gi"),n=new RegExp("(%[a-f0-9]{2})+","gi");function o(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),a=e.slice(t);return Array.prototype.concat.call([],o(r),o(a))}function s(e){try{return decodeURIComponent(e)}catch(n){for(var t=e.match(a),r=1;r<t.length;r++)t=(e=o(t,r).join("")).match(a);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},r=n.exec(e);r;){try{t[r[0]]=decodeURIComponent(r[0])}catch(e){var a=s(r[0]);a!==r[0]&&(t[r[0]]=a)}r=n.exec(e)}t["%C2"]="�";for(var o=Object.keys(t),i=0;i<o.length;i++){var l=o[i];e=e.replace(new RegExp(l,"g"),t[l])}return e}(e)}}},function(e,t,r){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},function(e,t,r){"use strict";e.exports=function(e,t){for(var r={},a=Object.keys(e),n=Array.isArray(t),o=0;o<a.length;o++){var s=a[o],i=e[s];(n?-1!==t.indexOf(s):t(s,i,e))&&(r[s]=i)}return r}},function(e,t,r){"use strict";r.r(t);var a={feeds:{type:"string"},max:{type:"number",default:5},offset:{type:"number",default:0},feed_title:{type:"boolean",default:!0},refresh:{type:"string",default:"12_hours"},sort:{type:"string",default:"default"},target:{type:"string",default:"_blank"},title:{type:"number"},meta:{type:"boolean",default:!0},lazy:{type:"boolean",default:!1},metafields:{type:"string",default:""},multiple_meta:{type:"string",default:""},summary:{type:"boolean",default:!0},summarylength:{type:"number"},keywords_title:{type:"string"},keywords_inc_on:{type:"string",default:"title"},keywords_ban:{type:"string"},keywords_exc_on:{type:"string",default:"title"},thumb:{type:"string",default:"auto"},default:{type:"object"},size:{type:"number",default:150},http:{type:"string"},referral_url:{type:"string"},columns:{type:"number",default:1},template:{type:"string",default:"default"},price:{type:"boolean",default:!0},route:{type:"string",default:"home"},feedData:{type:"object"},categories:{type:"object"},from_datetime:{type:"string"},to_datetime:{type:"string"}},n=r(0),o=r.n(n),s=lodash.isEmpty,i=wp.components.BaseControl;var l=(0,wp.compose.withInstanceId)((function(e){var t=e.label,r=e.selected,a=e.help,n=e.instanceId,o=e.onChange,l=e.disabled,u=e.options,p=void 0===u?[]:u,c="inspector-radio-image-control-".concat(n),m=function(e){return o(e.target.value)};return!s(p)&&wp.element.createElement(i,{label:t,id:c,help:a,className:"components-radio-image-control"},wp.element.createElement("div",{className:"components-radio-image-control__container"},p.map((function(e,t){return wp.element.createElement("div",{key:"".concat(c,"-").concat(t),className:"components-radio-image-control__option"},wp.element.createElement("input",{id:"".concat(c,"-").concat(t),className:"components-radio-image-control__input",type:"radio",name:c,value:e.value,onChange:m,checked:e.value===r,"aria-describedby":a?"".concat(c,"__help"):void 0,disabled:l}),wp.element.createElement("label",{htmlFor:"".concat(c,"-").concat(t),title:e.label},wp.element.createElement("img",{src:e.src}),wp.element.createElement("span",{class:"image-clickable"})))}))))}));function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=h(e);if(t){var n=h(this).constructor;r=Reflect.construct(a,arguments,n)}else r=a.apply(this,arguments);return f(this,r)}}function f(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y=wp.i18n.__,b=wp.hooks.applyFilters,g=wp.blockEditor||wp.editor,v=g.InspectorControls,w=g.MediaUpload,k=wp.element,E=k.Component,T=(k.Fragment,wp.components),C=T.BaseControl,x=T.ExternalLink,z=T.PanelBody,O=T.RangeControl,S=T.TextControl,j=T.Button,N=T.ToggleControl,F=T.SelectControl,R=T.ResponsiveWrapper,A=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(o,e);var t,r,a,n=d(o);function o(){return p(this,o),n.apply(this,arguments)}return t=o,(r=[{key:"render",value:function(){var e=this,t="",r=b("feedzy_widget_refresh_feed",[{label:y("1 Hour"),value:"1_hours"},{label:y("2 Hours"),value:"3_hours"},{label:y("12 Hours"),value:"12_hours"},{label:y("1 Day"),value:"1_days"},{label:y("3 Days"),value:"3_days"},{label:y("15 Days"),value:"15_days"}]);return"https"===this.props.attributes.http&&(t+=y("Please verify that the images exist on HTTPS.")),wp.element.createElement(v,{key:"inspector"},0!==this.props.attributes.status&&wp.element.createElement(z,null,wp.element.createElement(S,{label:y("Feed Source"),className:"feedzy-source",value:this.props.attributes.feeds,onChange:this.props.edit.onChangeFeed}),wp.element.createElement(j,{isLarge:!0,isPrimary:!0,type:"submit",onClick:this.props.edit.loadFeed,className:"loadFeed"},y("Load Feed"))),"fetched"===this.props.state.route&&[wp.element.createElement(z,{title:y("Feed Settings"),initialOpen:!0,className:"feedzy-options"},wp.element.createElement(O,{label:y("Number of Items"),value:Number(this.props.attributes.max)||5,onChange:this.props.edit.onChangeMax,min:1,max:this.props.attributes.feedData.items.length||10,beforeIcon:"sort",className:"feedzy-max"}),wp.element.createElement(O,{label:y("Ignore first N items"),value:Number(this.props.attributes.offset)||0,onChange:this.props.edit.onChangeOffset,min:0,max:this.props.attributes.feedData.items.length,beforeIcon:"sort",className:"feedzy-offset"}),null!==this.props.attributes.feedData.channel&&wp.element.createElement(N,{label:y("Display feed title?"),checked:!!this.props.attributes.feed_title,onChange:this.props.edit.onToggleFeedTitle,className:"feedzy-title"}),wp.element.createElement(N,{label:y("Lazy load feed?"),checked:!!this.props.attributes.lazy,onChange:this.props.edit.onToggleLazy,className:"feedzy-lazy",help:y("Only on the front end.")}),wp.element.createElement(F,{label:y("Feed Caching Time"),value:this.props.attributes.refresh,options:r,onChange:this.props.edit.onRefresh,className:"feedzy-refresh"}),wp.element.createElement(F,{label:y("Sorting Order"),value:this.props.attributes.sort,options:[{label:y("Default"),value:"default"},{label:y("Date Descending"),value:"date_desc"},{label:y("Date Ascending"),value:"date_asc"},{label:y("Title Descending"),value:"title_desc"},{label:y("Title Ascending"),value:"title_asc"}],onChange:this.props.edit.onSort,className:"feedzy-sort"})),wp.element.createElement(z,{title:y("Item Options"),initialOpen:!1,className:"feedzy-item-options"},wp.element.createElement(F,{label:y("Open Links In"),value:this.props.attributes.target,options:[{label:y("New Tab"),value:"_blank"},{label:y("Same Tab"),value:"_self"}],onChange:this.props.edit.onTarget}),wp.element.createElement(S,{label:y("Title Character Limit"),help:y("Leave empty to show full title. A value of 0 will remove the title."),type:"number",value:this.props.attributes.title,onChange:this.props.edit.onTitle,className:"feedzy-title-length"}),wp.element.createElement(C,null,wp.element.createElement(S,{label:feedzyjs.isPro?y("Should we display additional meta fields out of author, date, time or categories? (comma-separated list, in order of display)."):y("Should we display additional meta fields out of author, date or time? (comma-separated list, in order of display)."),help:y('Leave empty to display all and "no" to display nothing.'),placeholder:feedzyjs.isPro?y("(eg: author, date, time, tz=local, categories)"):y("(eg: author, date, time, tz=local)"),value:this.props.attributes.metafields,onChange:this.props.edit.onChangeMeta,className:"feedzy-meta"}),wp.element.createElement(S,{label:y("When using multiple sources, should we display additional meta fields? - source (comma-separated list)."),placeholder:y("(eg: source)"),value:this.props.attributes.multiple_meta,onChange:this.props.edit.onChangeMultipleMeta,className:"feedzy-multiple-meta"}),wp.element.createElement(x,{href:"https://docs.themeisle.com/article/1089-how-to-display-author-date-or-time-from-the-feed"},y("You can find more info about available meta field values here."))),wp.element.createElement(N,{label:y("Display post description?"),checked:!!this.props.attributes.summary,onChange:this.props.edit.onToggleSummary,className:"feedzy-summary"}),this.props.attributes.summary&&wp.element.createElement(S,{label:y("Description Character Limit"),help:y("Leave empty to show full description."),type:"number",value:this.props.attributes.summarylength,onChange:this.props.edit.onSummaryLength,className:"feedzy-summary-length",min:0}),feedzyjs.isPro&&[wp.element.createElement(S,{label:y("Only display if selected field contains:"),help:y("Use comma(,) and plus(+) keyword"),value:this.props.attributes.keywords_title,onChange:this.props.edit.onKeywordsTitle,className:"feedzy-include"}),wp.element.createElement(F,{label:y("Select a field if you want to inc keyword."),value:this.props.attributes.keywords_inc_on,options:[{label:y("Title"),value:"title"},{label:y("Author"),value:"author"},{label:y("Description"),value:"description"}],onChange:this.props.edit.onKeywordsIncludeOn}),wp.element.createElement(S,{label:y("Exclude if selected field contains:"),help:y("Use comma(,) and plus(+) keyword"),value:this.props.attributes.keywords_ban,onChange:this.props.edit.onKeywordsBan,className:"feedzy-ban"}),wp.element.createElement(F,{label:y("Select a field if you want to exc keyword."),value:this.props.attributes.keywords_exc_on,options:[{label:y("Title"),value:"title"},{label:y("Author"),value:"author"},{label:y("Description"),value:"description"}],onChange:this.props.edit.onKeywordsExcludeOn}),wp.element.createElement("p",null,y("Filter feed item by date range.")),wp.element.createElement(S,{type:"datetime-local",label:y("From:"),value:this.props.attributes.from_datetime,onChange:this.props.edit.onFromDateTime}),wp.element.createElement(S,{type:"datetime-local",label:y("To:"),value:this.props.attributes.to_datetime,onChange:this.props.edit.onToDateTime})]),wp.element.createElement(z,{title:y("Item Image Options"),initialOpen:!1,className:"feedzy-image-options"},wp.element.createElement(F,{label:y("Display first image if available?"),value:this.props.attributes.thumb,options:[{label:y("Yes (without a fallback image)"),value:"auto"},{label:y("Yes (with a fallback image)"),value:"yes"},{label:y("No"),value:"no"}],onChange:this.props.edit.onThumb,className:"feedzy-thumb"}),"no"!==this.props.attributes.thumb&&["auto"!==this.props.attributes.thumb&&wp.element.createElement("div",{className:"feedzy-blocks-base-control"},wp.element.createElement("label",{className:"blocks-base-control__label",for:"inspector-media-upload"},y("Fallback image if no image is found.")),wp.element.createElement(w,{type:"image",id:"inspector-media-upload",value:this.props.attributes.default,onSelect:this.props.edit.onDefault,render:function(t){var r=t.open;return[void 0!==e.props.attributes.default&&[wp.element.createElement(R,{naturalWidth:e.props.attributes.default.width,naturalHeight:e.props.attributes.default.height},wp.element.createElement("img",{src:e.props.attributes.default.url,alt:y("Featured image")})),wp.element.createElement(j,{isLarge:!0,isSecondary:!0,onClick:function(){return e.props.setAttributes({default:void 0})},style:{marginTop:"10px"}},y("Remove Image"))],wp.element.createElement(j,{isLarge:!0,isPrimary:!0,onClick:r,style:{marginTop:"10px"},className:void 0===e.props.attributes.default&&"feedzy_image_upload"},y("Upload Image"))]}})),wp.element.createElement(S,{label:y("Thumbnails dimension."),type:"number",value:this.props.attributes.size,onChange:this.props.edit.onSize}),wp.element.createElement(F,{label:y("How should we treat HTTP images?"),value:this.props.attributes.http,options:[{label:y("Show with HTTP link"),value:"auto"},{label:y("Force HTTPS"),value:"https"},{label:y("Ignore and show the default image instead"),value:"default"}],onChange:this.props.edit.onHTTP,className:"feedzy-http",help:t})]),feedzyjs.isPro&&wp.element.createElement(z,{title:y("Pro Features"),initialOpen:!1,className:"feedzy-pro-options"},wp.element.createElement(N,{label:y("Display price if available?"),help:this.props.attributes.price&&"default"===this.props.attributes.template?y("Choose a different template for this to work."):null,checked:!!this.props.attributes.price,onChange:this.props.edit.onTogglePrice,className:"feedzy-pro-price"}),wp.element.createElement(S,{label:y("Referral URL parameters."),help:y('Without ("?")'),placeholder:_("(eg. promo_code=feedzy_is_awesome)"),value:this.props.attributes.referral_url,onChange:this.props.edit.onReferralURL}),wp.element.createElement(O,{label:y("Columns"),help:y("How many columns we should use to display the feed items?"),value:this.props.attributes.columns||1,onChange:this.props.edit.onColumns,min:1,max:6,beforeIcon:"sort",allowReset:!0}),wp.element.createElement(l,{label:y("Feed Template"),selected:this.props.attributes.template,options:[{label:y("Default"),src:feedzyjs.imagepath+"feedzy-default-template.jpg",value:"default"},{label:y("Style 1"),src:feedzyjs.imagepath+"feedzy-style1-template.jpg",value:"style1"},{label:y("Style 2"),src:feedzyjs.imagepath+"feedzy-style2-template.jpg",value:"style2"}],onChange:this.props.edit.onTemplate,className:"feedzy-pro-template"}))])}}])&&c(t.prototype,r),a&&c(t,a),o}(E),L=function(e){var t=document.createElement("div");return t.innerHTML=e,void 0!==t.innerText?t.innerText:t.textContent},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t="",r=[];return""!==e&&e.replace(/[^a-zA-Z]/g,"").length<=500&&(e.split(",").forEach((function(e){""!==(e=e.trim())&&(e=e.split("+").map((function(e){return"(?=.*"+(e=e.trim())+")"})),r.push(e.join("")))})),t="^"+(t=r.join("|"))+".*$",t=new RegExp(t,"i")),t};function D(e){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(){return(I=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function U(e,t,r,a,n,o,s){try{var i=e[o](s),l=i.value}catch(e){return void r(e)}i.done?t(l):Promise.resolve(l).then(a,n)}function M(e){return function(){var t=this,r=arguments;return new Promise((function(a,n){var o=e.apply(t,r);function s(e){U(o,a,n,s,i,"next",e)}function i(e){U(o,a,n,s,i,"throw",e)}s(void 0)}))}}function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function H(e,t){return(H=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function $(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=q(e);if(t){var n=q(this).constructor;r=Reflect.construct(a,arguments,n)}else r=a.apply(this,arguments);return Y(this,r)}}function Y(e,t){return!t||"object"!==D(t)&&"function"!=typeof t?V(e):t}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(e){return(q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var W=wp.i18n.__,X=wp,Q=(X.apiFetch,X.apiRequest),Z=wp.element,G=Z.Component,J=(Z.Fragment,wp.components),ee=J.ExternalLink,te=J.Placeholder,re=J.TextControl,ae=J.Button,ne=J.Spinner,oe=(wp.date.date,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&H(e,t)}(l,e);var t,r,a,n,s,i=$(l);function l(){var e;return B(this,l),(e=i.apply(this,arguments)).loadFeed=e.loadFeed.bind(V(e)),e.loadCategories=e.loadCategories.bind(V(e)),e.metaExists=e.metaExists.bind(V(e)),e.multipleMetaExists=e.multipleMetaExists.bind(V(e)),e.getImageURL=e.getImageURL.bind(V(e)),e.getValidateURL=e.getValidateURL.bind(V(e)),e.onChangeFeed=e.onChangeFeed.bind(V(e)),e.onChangeMax=e.onChangeMax.bind(V(e)),e.onChangeOffset=e.onChangeOffset.bind(V(e)),e.onToggleFeedTitle=e.onToggleFeedTitle.bind(V(e)),e.onRefresh=e.onRefresh.bind(V(e)),e.onSort=e.onSort.bind(V(e)),e.onTarget=e.onTarget.bind(V(e)),e.onTitle=e.onTitle.bind(V(e)),e.onChangeMeta=e.onChangeMeta.bind(V(e)),e.onChangeMultipleMeta=e.onChangeMultipleMeta.bind(V(e)),e.onToggleSummary=e.onToggleSummary.bind(V(e)),e.onToggleLazy=e.onToggleLazy.bind(V(e)),e.onSummaryLength=e.onSummaryLength.bind(V(e)),e.onKeywordsTitle=e.onKeywordsTitle.bind(V(e)),e.onKeywordsBan=e.onKeywordsBan.bind(V(e)),e.onThumb=e.onThumb.bind(V(e)),e.onDefault=e.onDefault.bind(V(e)),e.onSize=e.onSize.bind(V(e)),e.onHTTP=e.onHTTP.bind(V(e)),e.onReferralURL=e.onReferralURL.bind(V(e)),e.onColumns=e.onColumns.bind(V(e)),e.onTemplate=e.onTemplate.bind(V(e)),e.onTogglePrice=e.onTogglePrice.bind(V(e)),e.onKeywordsIncludeOn=e.onKeywordsIncludeOn.bind(V(e)),e.onKeywordsExcludeOn=e.onKeywordsExcludeOn.bind(V(e)),e.onFromDateTime=e.onFromDateTime.bind(V(e)),e.onToDateTime=e.onToDateTime.bind(V(e)),e.feedzyCategoriesList=e.feedzyCategoriesList.bind(V(e)),e.state={route:e.props.attributes.route,loading:!1,error:!1},e}return t=l,(r=[{key:"componentDidMount",value:(s=M(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.loadFeed(),void 0===this.props.attributes.categories&&(this.props.attributes.meta||this.props.setAttributes({meta:!0,metafields:"no"}),setTimeout((function(){t.loadCategories()})));case 2:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"componentDidUpdate",value:(n=M(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"reload"===this.state.route&&this.loadFeed();case 1:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"loadFeed",value:function(){var e=this,t=this.props.attributes.feeds;if(void 0!==t){if(function(e,t){if(void 0===t)return!1;for(var r=!1,a=0;a<t.length;a++)if(t[a]===e){r=!0;break}return r}(t,this.props.attributes.categories)){var r=t;t=o.a.stringify({category:r},{arrayFormat:"bracket"})}else t=t.replace(/\s/g,"").split(",").filter((function(e){return""!==e})),t=o.a.stringify({url:t},{arrayFormat:"bracket"});this.setState({route:"home",loading:!0}),Q({path:"/feedzy/v1/feed?".concat(t),method:"POST",data:this.props.attributes}).then((function(t){return e.unmounting?t:t.error?(e.setState({route:"home",loading:!1,error:!0}),t):(e.props.setAttributes({feedData:t}),e.setState({route:"fetched",loading:!1}),t)})).fail((function(t){return e.setState({route:"home",loading:!1,error:!0}),t}))}}},{key:"loadCategories",value:function(){var e=this;Q({path:"/wp/v2/feedzy_categories?per_page=100"}).then((function(t){if(e.unmounting)return t;var r=0,a=[];t.forEach((function(e){a[r]=e.slug,r+=1}));var n=e;n.props.setAttributes({categories:a}),jQuery(".feedzy-source input").autocomplete({classes:{"ui-autocomplete":"feedzy-ui-autocomplete"},source:a,minLength:0,select:function(e,t){n.props.setAttributes({feeds:t.item.label})}})})).fail((function(e){return e}))}},{key:"metaExists",value:function(e){return 0<=this.props.attributes.metafields.replace(/\s/g,"").split(",").indexOf(e)||""===this.props.attributes.metafields}},{key:"multipleMetaExists",value:function(e){return 0<=this.props.attributes.multiple_meta.replace(/\s/g,"").split(",").indexOf(e)||""===this.props.attributes.multiple_meta}},{key:"getImageURL",value:function(e,t){var r=e.thumbnail?e.thumbnail:this.props.attributes.default?this.props.attributes.default.url:feedzyjs.imagepath+"feedzy.svg";switch(this.props.attributes.http){case"default":-1===r.indexOf("https")&&0===r.indexOf("http")&&(r=this.props.attributes.default?this.props.attributes.default.url:feedzyjs.imagepath+"feedzy.svg");break;case"https":r=r.replace(/http:/g,"https:")}return t&&(r="url("+r+")"),r}},{key:"onChangeFeed",value:function(e){this.props.setAttributes({feeds:e})}},{key:"onChangeMax",value:function(e){this.props.setAttributes({max:e?Number(e):5})}},{key:"onChangeOffset",value:function(e){this.props.setAttributes({offset:Number(e)})}},{key:"onToggleFeedTitle",value:function(e){this.props.setAttributes({feed_title:!this.props.attributes.feed_title})}},{key:"onRefresh",value:function(e){this.props.setAttributes({refresh:e})}},{key:"onSort",value:function(e){this.props.setAttributes({sort:e})}},{key:"onTarget",value:function(e){this.props.setAttributes({target:e})}},{key:"onTitle",value:function(e){""!==e&&(e=Number(e))<0&&(e=0),this.props.setAttributes({title:e})}},{key:"onChangeMeta",value:function(e){this.props.setAttributes({metafields:e})}},{key:"onChangeMultipleMeta",value:function(e){this.props.setAttributes({multiple_meta:e})}},{key:"onToggleSummary",value:function(e){this.props.setAttributes({summary:!this.props.attributes.summary})}},{key:"onToggleLazy",value:function(e){this.props.setAttributes({lazy:!this.props.attributes.lazy})}},{key:"onSummaryLength",value:function(e){this.props.setAttributes({summarylength:Number(e)})}},{key:"onKeywordsTitle",value:function(e){this.props.setAttributes({keywords_title:e})}},{key:"onKeywordsBan",value:function(e){this.props.setAttributes({keywords_ban:e})}},{key:"onThumb",value:function(e){this.props.setAttributes({thumb:e})}},{key:"onDefault",value:function(e){this.props.setAttributes({default:e}),this.setState({route:"reload"})}},{key:"onSize",value:function(e){this.props.setAttributes({size:e?Number(e):150})}},{key:"onHTTP",value:function(e){this.props.setAttributes({http:e}),this.setState({route:"reload"})}},{key:"onReferralURL",value:function(e){this.props.setAttributes({referral_url:e})}},{key:"onColumns",value:function(e){this.props.setAttributes({columns:e})}},{key:"onTemplate",value:function(e){this.props.setAttributes({template:e})}},{key:"onTogglePrice",value:function(e){this.props.setAttributes({price:!this.props.attributes.price})}},{key:"onKeywordsIncludeOn",value:function(e){this.props.setAttributes({keywords_inc_on:e})}},{key:"onKeywordsExcludeOn",value:function(e){this.props.setAttributes({keywords_exc_on:e})}},{key:"onFromDateTime",value:function(e){this.props.setAttributes({from_datetime:e})}},{key:"onToDateTime",value:function(e){this.props.setAttributes({to_datetime:e})}},{key:"feedzyCategoriesList",value:function(e){jQuery(".feedzy-source input").autocomplete("search","")}},{key:"getValidateURL",value:function(){var e="https://validator.w3.org/feed/";return this.props.attributes.feeds&&(e+="check.cgi?url="+this.props.attributes.feeds),e}},{key:"render",value:function(){var e,t,r,a,n,o,s,i,l,u,p=this;return["fetched"===this.state.route&&wp.element.createElement(A,I({edit:this,state:this.state},this.props)),"home"===this.state.route&&wp.element.createElement("div",{className:this.props.className},wp.element.createElement(te,{key:"placeholder",icon:"rss",label:W("Feedzy RSS Feeds")},this.state.loading?wp.element.createElement("div",{key:"loading",className:"wp-block-embed is-loading"},wp.element.createElement(ne,null),wp.element.createElement("p",null,W("Fetching..."))):[wp.element.createElement("div",{className:"feedzy-source-wrap"},wp.element.createElement(re,{type:"url",className:"feedzy-source",placeholder:W("Enter URL or category of your feed here..."),onChange:this.onChangeFeed,value:this.props.attributes.feeds}),wp.element.createElement("span",{className:"dashicons dashicons-arrow-down-alt2",onClick:this.feedzyCategoriesList})),wp.element.createElement(ae,{isLarge:!0,isPrimary:!0,type:"submit",onClick:this.loadFeed},W("Load Feed")),wp.element.createElement(ee,{href:this.getValidateURL(),title:W("Validate Feed ")},W("Validate ")),this.state.error&&wp.element.createElement("div",null,W("Feed URL is invalid. Invalid feeds will NOT display items.")),wp.element.createElement("p",null,W("Enter the full URL of the feed source you wish to display here, or the name of a category you've created. Also you can add multiple URLs just separate them with a comma. You can manage your categories feed from")," ",wp.element.createElement("a",{href:"edit.php?post_type=feedzy_categories",title:W("feedzy categories "),target:"_blank"},W("here ")))])),!("fetched"!==this.state.route||void 0===this.props.attributes.feedData)&&wp.element.createElement("div",{className:"feedzy-rss"},this.props.attributes.feed_title&&null!==this.props.attributes.feedData.channel&&wp.element.createElement("div",{className:"rss_header"},wp.element.createElement("h2",null,wp.element.createElement("a",{className:"rss_title"},L(this.props.attributes.feedData.channel.title)),wp.element.createElement("span",{className:"rss_description"}," "+L(this.props.attributes.feedData.channel.description)))),wp.element.createElement("ul",{className:"feedzy-".concat(this.props.attributes.template)},(e=this.props.attributes.feedData.items,t=this.props.attributes.sort,r=P(this.props.attributes.keywords_title),a=P(this.props.attributes.keywords_ban),n=this.props.attributes.max,o=this.props.attributes.offset,s=this.props.attributes.keywords_inc_on,i=this.props.attributes.keywords_exc_on,l=this.props.attributes.from_datetime,u=this.props.attributes.to_datetime,s="author"===s?"creator":s,i="author"===i?"creator":i,l=""!==l&&void 0!==l&&moment(l).format("X"),u=""!==u&&void 0!==u&&moment(u).format("X"),e=Array.from(e).sort((function(e,r){var a,n;return"date_desc"===t||"date_asc"===t?(a=e.pubDate,n=r.pubDate):"title_desc"!==t&&"title_asc"!==t||(a=e.title.toUpperCase(),n=r.title.toUpperCase()),a<n?"date_desc"===t||"title_desc"===t?1:-1:a>n?"date_desc"===t||"title_desc"===t?-1:1:0})).filter((function(e){return!r||r.test(e[s])})).filter((function(e){return!a||!a.test(e[i])})).filter((function(e){var t=e.date+" "+e.time;return t=moment(new Date(t)).format("X"),!l||!u||l<=t&&t<=u})).slice(o,n+o)).map((function(e,t){var r=(e.date||"")+" "+(e.time||"")+" UTC +0000",a=L(e.date)||"",n=L(e.time)||"",o=L(e.categories)||"";if(p.metaExists("tz=local")){var s=new Date(r);s=s.toUTCString(),a=moment.utc(s).format("MMMM D, YYYY"),n=moment.utc(s).format("h:mm A")}var i=e.creator&&p.metaExists("author")?e.creator:"";""!==p.props.attributes.multiple_meta&&"no"!==p.props.attributes.multiple_meta&&((p.multipleMetaExists("source")||p.multipleMetaExists("yes"))&&""!==i&&""!==e.source?i=i+" ("+e.source+")":(p.multipleMetaExists("source")||p.multipleMetaExists("yes"))&&""!==e.source&&(i=e.source)),""===e.thumbnail&&"auto"===p.props.attributes.thumb&&(e.thumbnail=e.default_img);var l=new Object;return l.author=W("by")+" "+i,l.date=W("on")+" "+L(a),l.time=W("at")+" "+L(n),l.categories=W("in")+" "+L(o),wp.element.createElement("li",{key:t,style:{padding:"15px 0 25px"},className:"rss_item feedzy-rss-col-".concat(p.props.attributes.columns)},(e.thumbnail&&"auto"===p.props.attributes.thumb||"yes"===p.props.attributes.thumb)&&wp.element.createElement("div",{className:"rss_image",style:{width:p.props.attributes.size+"px",height:p.props.attributes.size+"px"}},wp.element.createElement("a",{title:L(e.title),style:{width:p.props.attributes.size+"px",height:p.props.attributes.size+"px"}},wp.element.createElement("span",{className:"fetched",style:{width:p.props.attributes.size+"px",height:p.props.attributes.size+"px",backgroundImage:p.getImageURL(e,!0)},title:L(e.title)}))),wp.element.createElement("div",{className:"rss_content_wrap"},0!==p.props.attributes.title?wp.element.createElement("span",{className:"title"},wp.element.createElement("a",null,p.props.attributes.title&&L(e.title).length>p.props.attributes.title?L(e.title).substring(0,p.props.attributes.title)+"...":L(e.title))):"",wp.element.createElement("div",{className:"rss_content"},"no"!==p.props.attributes.metafields&&wp.element.createElement("small",{className:"meta"},function(e,t){var r="";""===t&&(t="author, date, time");for(var a=t.replace(/\s/g,"").split(","),n=0;n<a.length;n++)void 0!==e[a[n]]&&(r=r+" "+e[a[n]]);return r}(l,p.props.attributes.metafields)),p.props.attributes.summary&&wp.element.createElement("p",{className:"description"},p.props.attributes.summarylength&&L(e.description).length>p.props.attributes.summarylength?L(e.description).substring(0,p.props.attributes.summarylength)+" [...]":L(e.description)),feedzyjs.isPro&&e.media&&e.media.src&&wp.element.createElement("audio",{controls:!0,controlsList:"nodownload"},wp.element.createElement("source",{src:e.media.src,type:e.media.type}),W("Your browser does not support the audio element. But you can check this for the original link: "),wp.element.createElement("a",{href:e.media.src},e.media.src)),feedzyjs.isPro&&p.props.attributes.price&&e.price&&"default"!==p.props.attributes.template&&wp.element.createElement("div",{className:"price-wrap"},wp.element.createElement("a",null,wp.element.createElement("button",{className:"price"},e.price))))))}))))]}}])&&K(t.prototype,r),a&&K(t,a),l}(G)),se=wp.i18n.__,ie=wp.blocks.registerBlockType;t.default=ie("feedzy-rss-feeds/feedzy-block",{title:se("Feedzy RSS Feeds"),category:"common",icon:"rss",keywords:[se("Feedzy RSS Feeds"),se("RSS"),se("Feeds")],supports:{html:!1},attributes:a,edit:oe,save:function(){return null}})}]);
includes/gutenberg/feedzy-rss-feeds-gutenberg-block.php CHANGED
@@ -57,7 +57,7 @@ class Feedzy_Rss_Feeds_Gutenberg_Block {
57
  }
58
 
59
  // Dependent WordPress core libraries.
60
- $depends = array( 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-editor', 'wp-api', 'lodash' );
61
 
62
  // Remove "wp-editor" script for widget block.
63
  if ( wp_use_widgets_block_editor() && wp_script_is( 'wp-edit-widgets' ) ) {
57
  }
58
 
59
  // Dependent WordPress core libraries.
60
+ $depends = array( 'wp-i18n', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-editor', 'wp-api', 'lodash', 'wp-hooks' );
61
 
62
  // Remove "wp-editor" script for widget block.
63
  if ( wp_use_widgets_block_editor() && wp_script_is( 'wp-edit-widgets' ) ) {
includes/views/import-metabox-edit.php CHANGED
@@ -440,6 +440,37 @@
440
  </div>
441
  </div>
442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
 
444
  <div class="custom_fields <?php echo esc_attr( apply_filters( 'feedzy_upsell_class', '' ) ); ?>">
445
  <?php echo wp_kses_post( apply_filters( 'feedzy_upsell_content', '' ) ); ?>
440
  </div>
441
  </div>
442
 
443
+ <div class="feedzy-row">
444
+ <div class="label_description">
445
+ <label class="feedzy-sr-only" for="f1-post-title"><?php esc_html_e( 'Post Excerpt', 'feedzy-rss-feeds' ); ?></label><br/>
446
+ <small>
447
+ <?php
448
+ esc_html_e( 'The post excerpt for the generated post. Leave blank, if unsure.', 'feedzy-rss-feeds' );
449
+ ?>
450
+ </small>
451
+ <p class="feedzy-highlight"><i class="dashicons dashicons-megaphone"></i>
452
+ <?php
453
+ if ( apply_filters( 'feedzy_is_license_of_type', false, 'business' ) ) {
454
+ echo wp_kses_post( sprintf( __( 'You can add custom magic tags to extract custom elements from your feed as explained %1$shere%2$s. This will work only for single-feeds (i.e. not if you have specified a feed category that contains multiple feeds or using comma-separated feeds in the source).', 'feedzy-rss-feeds' ), '<a href="https://docs.themeisle.com/article/977-how-do-i-extract-values-from-custom-tags-in-feedzy" target="_blank">', '</a>' ) );
455
+ } else {
456
+ echo wp_kses_post( sprintf( __( 'Want to extract custom elements from your feed as explained %1$shere%2$s? Upgrade your %3$slicense%4$s today!', 'feedzy-rss-feeds' ), '<a href="https://docs.themeisle.com/article/977-how-do-i-extract-values-from-custom-tags-in-feedzy" target="_blank">', '</a>', '<a href="' . FEEDZY_UPSELL_LINK . '" target="_blank">', '</a>' ) );
457
+ }
458
+ ?>
459
+ </p>
460
+ </div>
461
+ <div class="feedzy-separator dashicons dashicons-leftright"></div>
462
+ <div class="form-group input-group form_item">
463
+ <input type="text" name="feedzy_meta_data[import_post_excerpt]" placeholder="<?php esc_html_e( 'Post Excerpt', 'feedzy-rss-feeds' ); ?>" class="form-control" value="<?php echo esc_attr( $post_excerpt ); ?>"/>
464
+ <div class="input-group-btn">
465
+ <button type="button" class="btn btn-add-fields dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
466
+ <?php esc_html_e( 'Insert Tag', 'feedzy-rss-feeds' ); ?> <span class="dashicons dashicons-arrow-down-alt2"></span>
467
+ </button>
468
+ <div class="dropdown-menu dropdown-menu-right">
469
+ <?php echo wp_kses_post( apply_filters( 'feedzy_render_magic_tags', '', apply_filters( 'feedzy_magic_tags_post_excerpt', array() ), 'import_post_excerpt' ) ); ?>
470
+ </div>
471
+ </div>
472
+ </div>
473
+ </div>
474
 
475
  <div class="custom_fields <?php echo esc_attr( apply_filters( 'feedzy_upsell_class', '' ) ); ?>">
476
  <?php echo wp_kses_post( apply_filters( 'feedzy_upsell_content', '' ) ); ?>
readme.txt CHANGED
@@ -462,6 +462,18 @@ You have to check first if your feed is valid. Please test it here: https://vali
462
 
463
  == Changelog ==
464
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  ##### [Version 3.8.1](https://github.com/Codeinwp/feedzy-rss-feeds/compare/v3.8.0...v3.8.1) (2021-12-20)
466
 
467
  - Show the import job title in post row action
462
 
463
  == Changelog ==
464
 
465
+ ##### [Version 3.8.2](https://github.com/Codeinwp/feedzy-rss-feeds/compare/v3.8.1...v3.8.2) (2022-01-28)
466
+
467
+ - Add a new filter to add the custom refresh time
468
+ - Remove elementor hidden WP widget feature so feedzy widget can be used
469
+ - Fix keyword filter issue with date filter
470
+ - Fix cURL timeout error
471
+ - Add new import job setting field and manipulate custom tag data
472
+ - Fix trimming title issue for Elementor & Gutenberg
473
+
474
+
475
+
476
+
477
  ##### [Version 3.8.1](https://github.com/Codeinwp/feedzy-rss-feeds/compare/v3.8.0...v3.8.1) (2021-12-20)
478
 
479
  - Show the import job title in post row action
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInita9c749f9da03845131d489286f3e8f70::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitf1ab4dbab42db338bfe296cdda021f14::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -149,7 +149,7 @@ class ClassLoader
149
 
150
  /**
151
  * @return string[] Array of classname => path
152
- * @psalm-var array<string, string>
153
  */
154
  public function getClassMap()
155
  {
149
 
150
  /**
151
  * @return string[] Array of classname => path
152
+ * @psalm-return array<string, string>
153
  */
154
  public function getClassMap()
155
  {
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInita9c749f9da03845131d489286f3e8f70
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInita9c749f9da03845131d489286f3e8f70
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInita9c749f9da03845131d489286f3e8f70', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
- spl_autoload_unregister(array('ComposerAutoloaderInita9c749f9da03845131d489286f3e8f70', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInita9c749f9da03845131d489286f3e8f70::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
@@ -51,23 +51,28 @@ class ComposerAutoloaderInita9c749f9da03845131d489286f3e8f70
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
- $includeFiles = Composer\Autoload\ComposerStaticInita9c749f9da03845131d489286f3e8f70::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
- composerRequirea9c749f9da03845131d489286f3e8f70($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
- function composerRequirea9c749f9da03845131d489286f3e8f70($fileIdentifier, $file)
 
 
 
 
 
67
  {
68
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
69
- require $file;
70
-
71
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
 
 
72
  }
73
  }
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitf1ab4dbab42db338bfe296cdda021f14
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitf1ab4dbab42db338bfe296cdda021f14', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitf1ab4dbab42db338bfe296cdda021f14', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitf1ab4dbab42db338bfe296cdda021f14::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
51
  $loader->register(true);
52
 
53
  if ($useStaticLoader) {
54
+ $includeFiles = Composer\Autoload\ComposerStaticInitf1ab4dbab42db338bfe296cdda021f14::$files;
55
  } else {
56
  $includeFiles = require __DIR__ . '/autoload_files.php';
57
  }
58
  foreach ($includeFiles as $fileIdentifier => $file) {
59
+ composerRequiref1ab4dbab42db338bfe296cdda021f14($fileIdentifier, $file);
60
  }
61
 
62
  return $loader;
63
  }
64
  }
65
 
66
+ /**
67
+ * @param string $fileIdentifier
68
+ * @param string $file
69
+ * @return void
70
+ */
71
+ function composerRequiref1ab4dbab42db338bfe296cdda021f14($fileIdentifier, $file)
72
  {
73
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
 
 
74
  $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
75
+
76
+ require $file;
77
  }
78
  }
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInita9c749f9da03845131d489286f3e8f70
8
  {
9
  public static $files = array (
10
  '3df8ee254224091c21b9aebb792d2f8b' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
@@ -17,7 +17,7 @@ class ComposerStaticInita9c749f9da03845131d489286f3e8f70
17
  public static function getInitializer(ClassLoader $loader)
18
  {
19
  return \Closure::bind(function () use ($loader) {
20
- $loader->classMap = ComposerStaticInita9c749f9da03845131d489286f3e8f70::$classMap;
21
 
22
  }, null, ClassLoader::class);
23
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitf1ab4dbab42db338bfe296cdda021f14
8
  {
9
  public static $files = array (
10
  '3df8ee254224091c21b9aebb792d2f8b' => __DIR__ . '/..' . '/codeinwp/themeisle-sdk/load.php',
17
  public static function getInitializer(ClassLoader $loader)
18
  {
19
  return \Closure::bind(function () use ($loader) {
20
+ $loader->classMap = ComposerStaticInitf1ab4dbab42db338bfe296cdda021f14::$classMap;
21
 
22
  }, null, ClassLoader::class);
23
  }
vendor/composer/installed.php CHANGED
@@ -1,22 +1,22 @@
1
  <?php return array(
2
  'root' => array(
3
- 'pretty_version' => 'v3.8.1',
4
- 'version' => '3.8.1.0',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
- 'reference' => 'b1569fcf42a5962fb5163b9721dbcdda49227f0e',
9
  'name' => 'codeinwp/feedzy-rss-feeds',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'codeinwp/feedzy-rss-feeds' => array(
14
- 'pretty_version' => 'v3.8.1',
15
- 'version' => '3.8.1.0',
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
- 'reference' => 'b1569fcf42a5962fb5163b9721dbcdda49227f0e',
20
  'dev_requirement' => false,
21
  ),
22
  'codeinwp/themeisle-sdk' => array(
1
  <?php return array(
2
  'root' => array(
3
+ 'pretty_version' => 'v3.8.2',
4
+ 'version' => '3.8.2.0',
5
  'type' => 'wordpress-plugin',
6
  'install_path' => __DIR__ . '/../../',
7
  'aliases' => array(),
8
+ 'reference' => 'b61a032e75985f281cf766523d5f405e64aa8625',
9
  'name' => 'codeinwp/feedzy-rss-feeds',
10
  'dev' => false,
11
  ),
12
  'versions' => array(
13
  'codeinwp/feedzy-rss-feeds' => array(
14
+ 'pretty_version' => 'v3.8.2',
15
+ 'version' => '3.8.2.0',
16
  'type' => 'wordpress-plugin',
17
  'install_path' => __DIR__ . '/../../',
18
  'aliases' => array(),
19
+ 'reference' => 'b61a032e75985f281cf766523d5f405e64aa8625',
20
  'dev_requirement' => false,
21
  ),
22
  'codeinwp/themeisle-sdk' => array(