Changeset 3462195
- Timestamp:
- 02/16/2026 05:25:04 AM (7 weeks ago)
- Location:
- podcast-player
- Files:
-
- 188 added
- 15 edited
-
tags/8.0.0 (added)
-
tags/8.0.0/LICENSE (added)
-
tags/8.0.0/README.txt (added)
-
tags/8.0.0/backend (added)
-
tags/8.0.0/backend/admin (added)
-
tags/8.0.0/backend/admin/admin-icons.svg (added)
-
tags/8.0.0/backend/admin/class-options.php (added)
-
tags/8.0.0/backend/admin/class-shortcodegen.php (added)
-
tags/8.0.0/backend/admin/templates (added)
-
tags/8.0.0/backend/admin/templates/help.php (added)
-
tags/8.0.0/backend/admin/templates/home.php (added)
-
tags/8.0.0/backend/admin/templates/main.php (added)
-
tags/8.0.0/backend/admin/templates/products.php (added)
-
tags/8.0.0/backend/admin/templates/settings.php (added)
-
tags/8.0.0/backend/admin/templates/shortcode.php (added)
-
tags/8.0.0/backend/admin/templates/sidebar.php (added)
-
tags/8.0.0/backend/admin/templates/toolkit (added)
-
tags/8.0.0/backend/admin/templates/toolkit.php (added)
-
tags/8.0.0/backend/admin/templates/toolkit/feed-review.php (added)
-
tags/8.0.0/backend/admin/templates/toolkit/feed-update.php (added)
-
tags/8.0.0/backend/class-register.php (added)
-
tags/8.0.0/backend/css (added)
-
tags/8.0.0/backend/css/admin-options-rtl.css (added)
-
tags/8.0.0/backend/css/admin-options.css (added)
-
tags/8.0.0/backend/css/partials (added)
-
tags/8.0.0/backend/css/podcast-player-admin-rtl.css (added)
-
tags/8.0.0/backend/css/podcast-player-admin.css (added)
-
tags/8.0.0/backend/inc (added)
-
tags/8.0.0/backend/inc/class-background-tasks.php (added)
-
tags/8.0.0/backend/inc/class-block.php (added)
-
tags/8.0.0/backend/inc/class-dashboard-widget.php (added)
-
tags/8.0.0/backend/inc/class-loader.php (added)
-
tags/8.0.0/backend/inc/class-misc.php (added)
-
tags/8.0.0/backend/inc/class-shortcode.php (added)
-
tags/8.0.0/backend/inc/class-widget.php (added)
-
tags/8.0.0/backend/js (added)
-
tags/8.0.0/backend/js/admin-options.build.js (added)
-
tags/8.0.0/backend/js/admin-options.js (added)
-
tags/8.0.0/backend/js/admin.build.js (added)
-
tags/8.0.0/backend/js/admin.js (added)
-
tags/8.0.0/backend/js/blocks.build.js (added)
-
tags/8.0.0/backend/js/blocks.js (added)
-
tags/8.0.0/backend/js/partials (added)
-
tags/8.0.0/backend/js/partials/blocks (added)
-
tags/8.0.0/backend/js/partials/blocks/ecc.js (added)
-
tags/8.0.0/backend/js/partials/blocks/edit.js (added)
-
tags/8.0.0/backend/js/partials/blocks/index.js (added)
-
tags/8.0.0/backend/js/partials/blocks/mcc.js (added)
-
tags/8.0.0/backend/js/partials/options (added)
-
tags/8.0.0/backend/js/partials/options/changeDetect.js (added)
-
tags/8.0.0/backend/js/partials/options/colorpicker.js (added)
-
tags/8.0.0/backend/js/partials/options/dom.js (added)
-
tags/8.0.0/backend/js/partials/options/feededit.js (added)
-
tags/8.0.0/backend/js/partials/options/feedmigrate.js (added)
-
tags/8.0.0/backend/js/partials/options/fetchMethod.js (added)
-
tags/8.0.0/backend/js/partials/options/reviews.js (added)
-
tags/8.0.0/backend/js/partials/options/shortgen.js (added)
-
tags/8.0.0/backend/js/partials/options/variables.js (added)
-
tags/8.0.0/backend/js/partials/widgets (added)
-
tags/8.0.0/backend/js/partials/widgets/changeDetect.js (added)
-
tags/8.0.0/backend/js/partials/widgets/colorpicker.js (added)
-
tags/8.0.0/backend/js/partials/widgets/fetchFilters.js (added)
-
tags/8.0.0/backend/js/partials/widgets/fetchMethod.js (added)
-
tags/8.0.0/backend/js/partials/widgets/imageupload.js (added)
-
tags/8.0.0/backend/js/partials/widgets/variables.js (added)
-
tags/8.0.0/backend/partials (added)
-
tags/8.0.0/backend/partials/pp-notifications.php (added)
-
tags/8.0.0/credits.txt (added)
-
tags/8.0.0/frontend (added)
-
tags/8.0.0/frontend/class-register.php (added)
-
tags/8.0.0/frontend/css (added)
-
tags/8.0.0/frontend/css/podcast-player-editor-rtl.css (added)
-
tags/8.0.0/frontend/css/podcast-player-editor.css (added)
-
tags/8.0.0/frontend/css/podcast-player-public-rtl.css (added)
-
tags/8.0.0/frontend/css/podcast-player-public.css (added)
-
tags/8.0.0/frontend/images (added)
-
tags/8.0.0/frontend/images/icons.svg (added)
-
tags/8.0.0/frontend/inc (added)
-
tags/8.0.0/frontend/inc/class-display.php (added)
-
tags/8.0.0/frontend/inc/class-feed.php (added)
-
tags/8.0.0/frontend/inc/class-general.php (added)
-
tags/8.0.0/frontend/inc/class-icon-loader.php (added)
-
tags/8.0.0/frontend/inc/class-icons-extend.php (added)
-
tags/8.0.0/frontend/inc/class-instance-counter.php (added)
-
tags/8.0.0/frontend/inc/class-loader.php (added)
-
tags/8.0.0/frontend/inc/class-render.php (added)
-
tags/8.0.0/frontend/js (added)
-
tags/8.0.0/frontend/js/mmerrorfix.js (added)
-
tags/8.0.0/frontend/js/partials (added)
-
tags/8.0.0/frontend/js/partials/editor.js (added)
-
tags/8.0.0/frontend/js/partials/header.js (added)
-
tags/8.0.0/frontend/js/partials/load.js (added)
-
tags/8.0.0/frontend/js/partials/main.js (added)
-
tags/8.0.0/frontend/js/partials/media.js (added)
-
tags/8.0.0/frontend/js/partials/mediaelem.js (added)
-
tags/8.0.0/frontend/js/partials/modal.js (added)
-
tags/8.0.0/frontend/js/partials/play.js (added)
-
tags/8.0.0/frontend/js/partials/podcast.js (added)
-
tags/8.0.0/frontend/js/partials/pplib.js (added)
-
tags/8.0.0/frontend/js/partials/search.js (added)
-
tags/8.0.0/frontend/js/partials/variables.js (added)
-
tags/8.0.0/frontend/js/ppeditor.build.js (added)
-
tags/8.0.0/frontend/js/ppeditor.js (added)
-
tags/8.0.0/frontend/js/public.build.js (added)
-
tags/8.0.0/frontend/js/public.js (added)
-
tags/8.0.0/frontend/js/templates (added)
-
tags/8.0.0/frontend/js/templates/audioplayer.js (added)
-
tags/8.0.0/frontend/templates (added)
-
tags/8.0.0/frontend/templates/episode (added)
-
tags/8.0.0/frontend/templates/episode/featured.php (added)
-
tags/8.0.0/frontend/templates/episode/single.php (added)
-
tags/8.0.0/frontend/templates/header (added)
-
tags/8.0.0/frontend/templates/header/image.php (added)
-
tags/8.0.0/frontend/templates/header/menu (added)
-
tags/8.0.0/frontend/templates/header/menu/default-links.php (added)
-
tags/8.0.0/frontend/templates/header/menu/podcast-menu.php (added)
-
tags/8.0.0/frontend/templates/header/subscribe-buttons.php (added)
-
tags/8.0.0/frontend/templates/list (added)
-
tags/8.0.0/frontend/templates/list/entry-modern.php (added)
-
tags/8.0.0/frontend/templates/list/entry.php (added)
-
tags/8.0.0/frontend/templates/list/search-field.php (added)
-
tags/8.0.0/frontend/templates/misc (added)
-
tags/8.0.0/frontend/templates/misc/buttons (added)
-
tags/8.0.0/frontend/templates/misc/buttons/clear-search.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/launch.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/list.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/load-more.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/next.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/playpause.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/pod-menu.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/previous.php (added)
-
tags/8.0.0/frontend/templates/misc/buttons/single-close.php (added)
-
tags/8.0.0/frontend/templates/misc/js (added)
-
tags/8.0.0/frontend/templates/misc/js/addcontrols.php (added)
-
tags/8.0.0/frontend/templates/misc/js/auxmodal.php (added)
-
tags/8.0.0/frontend/templates/misc/js/controls.php (added)
-
tags/8.0.0/frontend/templates/misc/js/vshare.php (added)
-
tags/8.0.0/frontend/templates/subscribe (added)
-
tags/8.0.0/frontend/templates/subscribe/amazon.php (added)
-
tags/8.0.0/frontend/templates/subscribe/apple.php (added)
-
tags/8.0.0/frontend/templates/subscribe/breaker.php (added)
-
tags/8.0.0/frontend/templates/subscribe/bullhorn.php (added)
-
tags/8.0.0/frontend/templates/subscribe/castbox.php (added)
-
tags/8.0.0/frontend/templates/subscribe/castro.php (added)
-
tags/8.0.0/frontend/templates/subscribe/deezer.php (added)
-
tags/8.0.0/frontend/templates/subscribe/external.php (added)
-
tags/8.0.0/frontend/templates/subscribe/google.php (added)
-
tags/8.0.0/frontend/templates/subscribe/iheart.php (added)
-
tags/8.0.0/frontend/templates/subscribe/overcast.php (added)
-
tags/8.0.0/frontend/templates/subscribe/pandora.php (added)
-
tags/8.0.0/frontend/templates/subscribe/playerfm.php (added)
-
tags/8.0.0/frontend/templates/subscribe/pocketcasts.php (added)
-
tags/8.0.0/frontend/templates/subscribe/podbean.php (added)
-
tags/8.0.0/frontend/templates/subscribe/podcastaddict.php (added)
-
tags/8.0.0/frontend/templates/subscribe/podchaser.php (added)
-
tags/8.0.0/frontend/templates/subscribe/radiopublic.php (added)
-
tags/8.0.0/frontend/templates/subscribe/soundcloud.php (added)
-
tags/8.0.0/frontend/templates/subscribe/spotify.php (added)
-
tags/8.0.0/frontend/templates/subscribe/stitcher.php (added)
-
tags/8.0.0/frontend/templates/subscribe/tunein.php (added)
-
tags/8.0.0/frontend/templates/subscribe/youtube.php (added)
-
tags/8.0.0/helper (added)
-
tags/8.0.0/helper/core (added)
-
tags/8.0.0/helper/core/class-background-jobs.php (added)
-
tags/8.0.0/helper/core/class-singleton.php (added)
-
tags/8.0.0/helper/feed (added)
-
tags/8.0.0/helper/feed/class-add-external-link-attr.php (added)
-
tags/8.0.0/helper/feed/class-fetch-feed.php (added)
-
tags/8.0.0/helper/feed/class-get-feed.php (added)
-
tags/8.0.0/helper/feed/class-modify-feed-data.php (added)
-
tags/8.0.0/helper/feed/class-prepare-front-new.php (added)
-
tags/8.0.0/helper/feed/class-prepare-storage.php (added)
-
tags/8.0.0/helper/functions (added)
-
tags/8.0.0/helper/functions/class-country-codes.php (added)
-
tags/8.0.0/helper/functions/class-date-parser.php (added)
-
tags/8.0.0/helper/functions/class-getters.php (added)
-
tags/8.0.0/helper/functions/class-markup.php (added)
-
tags/8.0.0/helper/functions/class-utility.php (added)
-
tags/8.0.0/helper/functions/class-validation.php (added)
-
tags/8.0.0/helper/store (added)
-
tags/8.0.0/helper/store/class-feeddata.php (added)
-
tags/8.0.0/helper/store/class-itemdata.php (added)
-
tags/8.0.0/helper/store/class-storageregister.php (added)
-
tags/8.0.0/helper/store/class-storebase.php (added)
-
tags/8.0.0/helper/store/class-storemanager.php (added)
-
tags/8.0.0/lang (added)
-
tags/8.0.0/lang/podcast-player.pot (added)
-
tags/8.0.0/podcast-player.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/backend/admin/class-options.php (modified) (5 diffs)
-
trunk/backend/admin/class-shortcodegen.php (modified) (1 diff)
-
trunk/backend/inc/class-background-tasks.php (modified) (4 diffs)
-
trunk/backend/inc/class-loader.php (modified) (1 diff)
-
trunk/backend/inc/class-shortcode.php (modified) (8 diffs)
-
trunk/backend/js/admin-options.build.js (modified) (1 diff)
-
trunk/backend/js/partials/options/shortgen.js (modified) (5 diffs)
-
trunk/frontend/class-register.php (modified) (1 diff)
-
trunk/frontend/inc/class-loader.php (modified) (2 diffs)
-
trunk/helper/core/class-background-jobs.php (modified) (10 diffs)
-
trunk/helper/feed/class-fetch-feed.php (modified) (4 diffs)
-
trunk/helper/feed/class-modify-feed-data.php (modified) (1 diff)
-
trunk/helper/functions/class-utility.php (modified) (2 diffs)
-
trunk/podcast-player.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
podcast-player/trunk/README.txt
r3442200 r3462195 5 5 Tested up to: 6.9 6 6 Requires PHP: 5.6 7 Stable tag: 7.9.147 Stable tag: 8.0.0 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html -
podcast-player/trunk/backend/admin/class-options.php
r3442200 r3462195 90 90 add_action( 'podcast_player_options_page_content', array( $inst, 'display_content' ) ); 91 91 add_action( 'wp_ajax_pp_feed_editor', array( $inst, 'feed_editor_new' ) ); 92 add_action( 'wp_ajax_nopriv_pp_feed_editor', array( $inst, 'feed_editor_new' ) );92 // add_action( 'wp_ajax_nopriv_pp_feed_editor', array( $inst, 'feed_editor_new' ) ); 93 93 add_action( 'wp_ajax_pp_migrate_podcast', array( $inst, 'migrate_podcast_source' ) ); 94 94 add_action( 'wp_ajax_pp_delete_source', array( $inst, 'delete_podcast_source' ) ); … … 191 191 ), 192 192 'check_cache_headers' => array( 193 'name' => esc_html__( 'Ver tify cache headers for feed update.', 'podcast-player' ),193 'name' => esc_html__( 'Verify cache headers for feed update.', 'podcast-player' ), 194 194 'id' => 'check_cache_headers', 195 195 'description' => esc_html__( 'We vertify cache headers to quickly check if feed has been updated or not. It is recommended to enable this option. However, if your podcast is not updating, disable this option and check again.', 'podcast-player' ), … … 584 584 public function feed_editor_new() { 585 585 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 586 Utility_Fn::require_capabilities( 'manage_options', 'pp_feed_editor' ); 586 587 587 588 $type = isset( $_POST['atype'] ) ? sanitize_text_field( wp_unslash( $_POST['atype'] ) ) : 'refresh'; … … 645 646 public function migrate_podcast_source() { 646 647 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 648 Utility_Fn::require_capabilities( 'manage_options', 'pp_migrate_podcast' ); 647 649 648 650 $podcast_id = isset( $_POST['podcast_id'] ) ? sanitize_text_field( wp_unslash( $_POST['podcast_id'] ) ) : false; … … 717 719 public function delete_podcast_source() { 718 720 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 721 Utility_Fn::require_capabilities( 'manage_options', 'pp_delete_source' ); 719 722 720 723 $podcast_id = isset( $_POST['podcast_id'] ) ? sanitize_text_field( wp_unslash( $_POST['podcast_id'] ) ) : false; -
podcast-player/trunk/backend/admin/class-shortcodegen.php
r3339440 r3462195 1439 1439 1440 1440 /** 1441 * Get a unique shortcode instance ID. 1442 * 1443 * @since 7.9.1 1444 * 1445 * @return int 1446 */ 1447 public function get_next_instance_id() { 1448 $shortcode_list = $this->shortcode_settings; 1449 1450 if ( empty( $shortcode_list ) || ! is_array( $shortcode_list ) ) { 1451 return 1; 1452 } 1453 1454 $keys = array_map( 'absint', array_keys( $shortcode_list ) ); 1455 $max = ! empty( $keys ) ? max( $keys ) : 0; 1456 1457 $candidate = $max + 1; 1458 if ( ! isset( $shortcode_list[ $candidate ] ) ) { 1459 return $candidate; 1460 } 1461 1462 // Fallback: randomize to avoid collisions in concurrent requests. 1463 for ( $i = 0; $i < 5; $i++ ) { 1464 $candidate = wp_rand( 1000, 999999999 ); 1465 if ( ! isset( $shortcode_list[ $candidate ] ) ) { 1466 return $candidate; 1467 } 1468 } 1469 1470 // Final fallback: increment until a free ID is found. 1471 $candidate = $max + 1; 1472 while ( isset( $shortcode_list[ $candidate ] ) ) { 1473 $candidate++; 1474 } 1475 return $candidate; 1476 } 1477 1478 /** 1441 1479 * Save shortcode settings to the database. 1442 1480 * -
podcast-player/trunk/backend/inc/class-background-tasks.php
r3442200 r3462195 73 73 74 74 // Process maximum 50 items at a time. 75 $items = array_slice( $items, 0, 50 ); 76 $in_clause = implode( ',', array_filter( array_map( function ( $item ) use ( $wpdb ) { 77 if ( ! empty( $item['featured'] ) ) { 78 return $wpdb->prepare( '%s', md5( $item['featured'] ) ); 79 } 80 return false; 81 }, $items ) ) ); 75 $items = array_slice( $items, 0, 50 ); 76 $hashes = array(); 77 $item_hashes = array(); 78 foreach ( $items as $key => $item ) { 79 if ( empty( $item['featured'] ) ) { 80 continue; 81 } 82 $raw_hash = md5( $item['featured'] ); 83 $norm_url = Utility_Fn::normalize_media_url( $item['featured'] ); 84 $norm_hash = md5( $norm_url ); 85 86 $item_hashes[ $key ] = array( 87 'raw' => $raw_hash, 88 'norm' => $norm_hash, 89 ); 90 $hashes[] = $raw_hash; 91 $hashes[] = $norm_hash; 92 } 93 $hashes = array_unique( array_filter( $hashes ) ); 94 $in_clause = implode( ',', array_map( function ( $hash ) use ( $wpdb ) { 95 return $wpdb->prepare( '%s', $hash ); 96 }, $hashes ) ); 82 97 83 98 if ( empty( $in_clause ) ) { … … 86 101 } 87 102 88 $sql = "SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key = 'pp_featured_key'AND meta_value IN ( $in_clause )";103 $sql = "SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key IN ( 'pp_featured_key', 'pp_featured_key_norm' ) AND meta_value IN ( $in_clause )"; 89 104 $results = $wpdb->get_results( $sql, ARRAY_A ); 90 105 $featured_keys = array_column( $results, 'post_id', 'meta_value' ); … … 92 107 $pending = array(); 93 108 foreach ( $items as $key => $item ) { 94 $item_image_key = isset( $item['featured'] ) ? md5( $item['featured'] ) : ''; 95 if ( ! empty( $item_image_key ) && isset( $featured_keys[ $item_image_key ] ) ) { 96 $completed[ $key ] = array_merge( $item, array( 'post_id' => $featured_keys[ $item_image_key ] ) ); 97 continue; 98 } 99 100 $pending[ $key ] = $item; 109 $hash_pair = isset( $item_hashes[ $key ] ) ? $item_hashes[ $key ] : array(); 110 $raw_hash = isset( $hash_pair['raw'] ) ? $hash_pair['raw'] : ''; 111 $norm_hash = isset( $hash_pair['norm'] ) ? $hash_pair['norm'] : ''; 112 113 $matched_post_id = false; 114 if ( $raw_hash && isset( $featured_keys[ $raw_hash ] ) ) { 115 $matched_post_id = $featured_keys[ $raw_hash ]; 116 } elseif ( $norm_hash && isset( $featured_keys[ $norm_hash ] ) ) { 117 $matched_post_id = $featured_keys[ $norm_hash ]; 118 } 119 120 if ( $matched_post_id ) { 121 // Backfill normalized hash for future de-dupes if missing. 122 if ( $norm_hash ) { 123 add_post_meta( $matched_post_id, 'pp_featured_key_norm', $norm_hash, true ); 124 } 125 $completed[ $key ] = array_merge( $item, array( 'post_id' => $matched_post_id ) ); 126 } else { 127 $pending[ $key ] = $item; 128 } 101 129 } 102 130 … … 166 194 167 195 add_post_meta( $attachment_id, 'pp_featured_key', md5( $image_url ), true ); 196 $normalized_url = Utility_Fn::normalize_media_url( $image_url ); 197 add_post_meta( $attachment_id, 'pp_featured_key_norm', md5( $normalized_url ), true ); 168 198 169 199 // Let's do post_meta verification to see if data is getting saved correctly. -
podcast-player/trunk/backend/inc/class-loader.php
r3418338 r3462195 231 231 } 232 232 233 if ( defined( 'PP_PRO_VERSION' ) && version_compare( PP_PRO_VERSION, '5.8. 5', '<' ) ) {233 if ( defined( 'PP_PRO_VERSION' ) && version_compare( PP_PRO_VERSION, '5.8.6', '<' ) ) { 234 234 ?> 235 235 <div class="notice-warning notice is-dismissible pp-welcome-notice"> 236 <p><?php esc_html_e( 'There is an update available to Podcast Player Pro. Please update to Podcast Player Pro v5.8. 5. If you have not received an automated update notice, please login to our website and download latest version.', 'podcast-player' ); ?></p>236 <p><?php esc_html_e( 'There is an update available to Podcast Player Pro. Please update to Podcast Player Pro v5.8.6. If you have not received an automated update notice, please login to our website and download latest version.', 'podcast-player' ); ?></p> 237 237 </div> 238 238 <?php -
podcast-player/trunk/backend/inc/class-shortcode.php
r3407648 r3462195 15 15 use Podcast_Player\Helper\Core\Singleton; 16 16 use Podcast_Player\Backend\Admin\ShortCodeGen; 17 use Podcast_Player\Helper\Functions\Utility as Utility_Fn; 17 18 18 19 /** … … 232 233 public function get_pp_preview() { 233 234 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 235 Utility_Fn::require_capabilities( 'manage_options', 'pp_render_preview' ); 234 236 $shortcodegen = new ShortCodeGen(); 235 237 $args = isset( $_POST['data'] ) ? $shortcodegen->escape( wp_unslash( $_POST['data'] ) ) : false; … … 259 261 public function get_shortcode_form() { 260 262 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 261 $shortcodegen = new ShortCodeGen();262 $shortcode _list = $shortcodegen->shortcode_settings;263 $instance = empty( $shortcode_list ) || ! is_array( $shortcode_list ) ? 0 : max( array_keys( $shortcode_list ) ) + 1;263 Utility_Fn::require_capabilities( 'manage_options', 'pp_blank_shortcode_template' ); 264 $shortcodegen = new ShortCodeGen(); 265 $instance = $shortcodegen->get_next_instance_id(); 264 266 ob_start(); 265 267 $shortcodegen->form( $instance ); … … 279 281 public function create_new_shortcode() { 280 282 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 283 Utility_Fn::require_capabilities( 'manage_options', 'pp_create_new_shortcode' ); 281 284 $shortcodegen = new ShortCodeGen(); 282 285 $args = isset( $_POST['data'] ) ? $shortcodegen->sanitize( wp_unslash( $_POST['data'] ) ) : false; … … 289 292 } 290 293 $shortcode_list = $shortcodegen->shortcode_settings; 294 if ( isset( $shortcode_list[ $inst ] ) ) { 295 $inst = $shortcodegen->get_next_instance_id(); 296 } 291 297 $shortcode_list[ $inst ] = $args; 292 298 $shortcodegen->shortcode_settings = $shortcode_list; 293 299 $shortcodegen->save(); 294 300 echo wp_json_encode( array( 295 'success' => __( 'Shortcode created successfully.', 'podcast-player' ), 301 'success' => __( 'Shortcode created successfully.', 'podcast-player' ), 302 'instance' => $inst, 296 303 ) ); 297 304 wp_die(); … … 305 312 public function load_shortcode() { 306 313 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 314 Utility_Fn::require_capabilities( 'manage_options', 'pp_load_shortcode' ); 307 315 $instance = isset( $_POST['instance'] ) ? absint( wp_unslash( $_POST['instance'] ) ) : false; 308 316 if ( false === $instance ) { … … 337 345 public function delete_shortcode() { 338 346 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 347 Utility_Fn::require_capabilities( 'manage_options', 'pp_delete_shortcode' ); 339 348 $instance = isset( $_POST['instance'] ) ? absint( wp_unslash( $_POST['instance'] ) ) : false; 340 349 if ( false === $instance ) { … … 364 373 public function update_shortcode() { 365 374 check_ajax_referer( 'podcast-player-admin-options-ajax-nonce', 'security' ); 375 Utility_Fn::require_capabilities( 'manage_options', 'pp_update_shortcode' ); 366 376 $shortcodegen = new ShortCodeGen(); 367 377 $args = isset( $_POST['data'] ) ? $shortcodegen->sanitize( wp_unslash( $_POST['data'] ) ) : false; -
podcast-player/trunk/backend/js/admin-options.build.js
r3381875 r3462195 1 (()=>{"use strict";function e(t){return e="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(t)}function t(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function o(e,o,n){return o&&t(e.prototype,o),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var o=function(t){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(o)?o:o+""}const r=o((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),jQuery("#pp-options-module-help .pp-docs-hide").hide(),jQuery("#pp-options-module-help .pp-docs-title").on("click",(function(){jQuery(this).toggleClass("pp-toggle"),jQuery(this).next().slideToggle("fast")})),jQuery("#pp-options-module-toolkit .pp-toolkit-content").hide(),jQuery("#pp-options-module-toolkit .pp-toolkit-title").on("click",(function(){jQuery(this).toggleClass("pp-toggle"),jQuery(this).next().slideToggle("fast")})),jQuery(".pp-hidden-settings").hide(),jQuery(".pp-hidden-settings-title").on("click",(function(){jQuery(this).toggleClass("pp-toggle"),jQuery(this).next().slideToggle("fast")}))}));function i(e){return i="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},i(e)}function s(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}const a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=window.ppjsAdminOpt||{},this.adminPage=jQuery("#pp-options-page"),this.index=jQuery(".select-pp-feed-index").first(),this.refresh=jQuery(".pp-feed-refresh"),this.reset=jQuery(".pp-feed-reset"),this.feedback=jQuery(".pp-toolkit-feedback").first(),this.newFeedback=jQuery("#pp-action-feedback"),this.managePodcastList=this.adminPage.find(".pp-podcasts-list"),this.events()},t=[{key:"events",value:function(){var e=this,t=this;this.refresh.on("click",function(){this.ajaxFeedEditor("refresh")}.bind(this)),this.reset.on("click",function(){this.ajaxFeedEditor("reset")}.bind(this)),jQuery(".pp-feed-del").on("click",(function(){t.index.val()?(jQuery(this).next(".pp-toolkit-del-confirm").slideDown("fast"),t.response()):t.response(t.data.messages.nourl,"pp-error")})),jQuery(".pp-feed-cancel").on("click",(function(){jQuery(this).parents(".pp-toolkit-del-confirm").hide()})),this.managePodcastList.on("click",".pp-podcast-refresh-btn",(function(t){var o=jQuery(t.currentTarget);e.feedRefreshDelete("refresh",o)})),this.managePodcastList.on("click",".pp-podcast-delete-btn",(function(t){var o=jQuery(t.currentTarget);e.feedRefreshDelete("reset",o)})),this.newFeedback.on("click",".pp-error-close",(function(t){e.newFeedback.removeClass("pp-error")}))}},{key:"ajaxFeedEditor",value:function(e){var t=this,o=this.getAjaxConfig(e);this.response(this.data.messages.running,"pp-running"),o?jQuery.ajax({url:this.data.ajaxurl,data:o,type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)||(void 0!==o.error?t.response(o.error,"pp-error"):void 0!==o.message&&t.response(o.message,"pp-success"))},error:function(e,o,n){t.response(n,"pp-error")}}):this.response(this.data.messages.nourl,"pp-error")}},{key:"feedRefreshDelete",value:function(e,t){var o=this,n=t.closest(".pp-podcast-list-item"),r=n.data("podcast"),i={action:"pp_feed_editor",security:this.data.security,atype:e,feedUrl:r};t.addClass("pp-wip"),this.managePodcastList.find(".pp-toolkit-buttons").prop("disabled",!0),jQuery.ajax({url:this.data.ajaxurl,data:i,type:"POST",timeout:6e4,success:function(r){var i=JSON.parse(r);jQuery.isEmptyObject(i)||(void 0!==i.error?o.newResponse(i.error,"pp-error"):void 0!==i.message&&(o.newResponse(i.message,"pp-success"),"reset"==e&&n.fadeOut(200,(function(){jQuery(this).remove()}))),t.removeClass("pp-wip"),setTimeout((function(){o.managePodcastList.find(".pp-toolkit-buttons").prop("disabled",!1)}),1500))},error:function(e,n,r){o.newResponse(r,"pp-error"),t.removeClass("pp-wip"),o.managePodcastList.find(".pp-toolkit-buttons").prop("disabled",!1)}})}},{key:"getAjaxConfig",value:function(e){var t=this.index.val();return!!t&&{action:"pp_feed_editor",security:this.data.security,atype:e,feedUrl:t}}},{key:"response",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.feedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.feedback.addClass(t),this.feedback.find(".pp-feedback").text(e))}},{key:"newResponse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.newFeedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.newFeedback.addClass(t),this.newFeedback.find(".pp-feedback").text(e)),setTimeout(function(){this.newFeedback.removeClass("pp-success pp-running")}.bind(this),1500)}}],t&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function c(e){return c="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},c(e)}function u(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=c(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}const l=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=window.ppjsAdminOpt||{},this.adminPage=jQuery("#pp-options-page"),this.openSourceUrlBtn=this.adminPage.find(".pp-podcast-source-btn"),this.addSourceUrlBtn=this.adminPage.find(".pp-podcast-new-source-btn"),this.delSourceBtn=this.adminPage.find(".pp-podcast-delete-source-url"),this.newFeedback=jQuery("#pp-action-feedback"),this.events()},t=[{key:"events",value:function(){var e=this;this.openSourceUrlBtn.on("click",(function(e){jQuery(this).closest(".pp-podcast-info").find(".pp-podcast-source-container").slideToggle("fast")})),this.addSourceUrlBtn.on("click",(function(t){var o=jQuery(this),n=o.closest(".pp-podcast-source-container"),r=n.find(".pp-podcast-existing-source"),i=r.find(".pp-podcast-existing-source-url"),s=n.find(".pp-podcast-new-source"),p=s.find(".pp-podcast-new-source-url"),a=p.val();if(a){var c=s.closest(".pp-podcast-list-item").data("podcast"),u={action:"pp_migrate_podcast",security:e.data.security,podcast_id:c,source_url:a};p.attr("disabled",!0),o.attr("disabled",!0),jQuery.ajax({url:e.data.ajaxurl,data:u,type:"POST",timeout:6e4,success:function(t){var n=JSON.parse(t);jQuery.isEmptyObject(n)||(void 0!==n.error?e.newResponse(n.error,"pp-error"):void 0!==n.message&&(i.html(a),r.show(),p.val(""),e.newResponse(n.message,"pp-success"))),p.attr("disabled",!1),o.attr("disabled",!1)},error:function(t,n,r){p.attr("disabled",!1),o.attr("disabled",!1),e.newResponse(r,"pp-error")}})}else e.newResponse(e.data.messages.nosource,"pp-error")})),this.delSourceBtn.on("click",(function(t){t.preventDefault();var o=jQuery(this),n=o.closest(".pp-podcast-existing-source"),r=n.find(".pp-podcast-existing-source-url"),i={action:"pp_delete_source",podcast_id:o.closest(".pp-podcast-list-item").data("podcast"),security:e.data.security};o.attr("disabled",!0),jQuery.ajax({url:e.data.ajaxurl,data:i,type:"POST",timeout:6e4,success:function(t){var i=JSON.parse(t);jQuery.isEmptyObject(i)||(void 0!==i.error?e.newResponse(i.error,"pp-error"):void 0!==i.message&&(r.empty(),n.hide(),e.newResponse(i.message,"pp-success"))),o.attr("disabled",!1)},error:function(t,n,r){o.attr("disabled",!1),e.newResponse(r,"pp-error")}})}))}},{key:"newResponse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.newFeedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.newFeedback.addClass(t),this.newFeedback.find(".pp-feedback").text(e)),setTimeout(function(){this.newFeedback.removeClass("pp-success pp-running")}.bind(this),1500)}}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,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},f(e)}function h(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function y(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=f(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}const v=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=window.ppjsAdminOpt||{},this.newFeedback=jQuery("#pp-action-feedback"),this.serverTimeOut=null,this.events()},t=[{key:"events",value:function(){var e=this,t=jQuery("#pp-options-module-shortcode");jQuery(document),t.on("change",".pp-getval",(function(){clearTimeout(e.serverTimeOut),e.serverTimeOut=setTimeout((function(){e.updatePreview(jQuery(this))}),100)})),t.on("click","#pp-shortcode-generator-btn",(function(){e.blankShortcodeTemplate(jQuery(this))})),t.on("click","#pp-shortcode-generator-submit-btn",(function(){e.createNewShortcode(jQuery(this))})),t.on("click","#pp-shortcode-generator-delete-btn",(function(){t.find("#pp-shortcode-action-modal").removeClass("podcast-player-hidden")})),t.on("click","#pp-shortcode-deletion-btn",(function(){e.deleteShortcode(jQuery(this))})),t.on("click","#pp-shortcode-deletion-cancel",(function(){t.find("#pp-shortcode-action-modal").addClass("podcast-player-hidden")})),t.on("click","#pp-shortcode-generator-update-btn",(function(){e.updateShortcode(jQuery(this))})),t.on("change","select.pp-shortcode-dropdown",(function(){e.loadShortcode(jQuery(this))})),t.on("click",".pp-collapse-sidebar",(function(t){t.preventDefault(),e.toggleSidebar(jQuery(this))})),t.on("click",".pp-copy-shortcode-text",(function(t){t.preventDefault(),e.copyShortcodeText(jQuery(this))}))}},{key:"getShortcodeFormValues",value:function(){var e=jQuery("#pp-shortcode-form"),t=e.find(".pp-getval"),o=e.data("instance"),n={};return t.each((function(){var e=this.name.replace(/^pp_field_name_/,"");e.endsWith("[]")?(e=e.replace(/\[\]$/,""),Array.isArray(n[e])||(n[e]=[]),"checkbox"===this.type?n[e].push(this.checked?this.value:""):n[e].push(this.value)):"checkbox"===this.type?n[e]=this.checked?this.value:"":n[e]=this.value})), console.log(o),{instance:o,values:n}}},{key:"updatePreview",value:function(e){var t=this,o=this,n=this.getShortcodeFormValues(),r=(n.instance,n.values);jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_render_preview",security:this.data.security,data:r},type:"POST",timeout:6e4,success:function(e){var n=JSON.parse(e);jQuery.isEmptyObject(n)||(void 0!==n.error?t.newResponse(n.error,"pp-error"):void 0!==n.markup&&(jQuery("#pp-shortcode-preview").html(n.markup),o.updateFont()))},error:function(e,o,n){t.newResponse(n,"dpt-error")}})}},{key:"blankShortcodeTemplate",value:function(e){var t=this;e.siblings("select.pp-shortcode-dropdown").val(""),jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_blank_shortcode_template",security:this.data.security},type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);if(!jQuery.isEmptyObject(o))if(void 0!==o.error)t.newResponse(o.error,"dpt-error");else if(void 0!==o.form&&void 0!==o.instance){var n='\n\t\t\t\t\t\t<div class="pp-shortcode-form-wrapper">'.concat(o.form,'</div>\n\t\t\t\t\t\t<div class="pp-shortcode-form-submit">\n\t\t\t\t\t\t\t<button id="pp-shortcode-generator-submit-btn" class="button button-secondary" style="width: 100%;">Generate Shortcode</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t'),r=jQuery("#pp-shortcode-form"),i=jQuery("#pp-shortcode-preview");jQuery(".pp-shortcode-result").html(""),r.html(n).data("instance",o.instance),i.html('\n\t\t\t\t\t\t<div style="padding: 20px; font-size: 20px; color: #aaa;">\n\t\t\t\t\t\t\t<span>Shortcode</span>\n\t\t\t\t\t\t\t<span style="color: #333;">Preview</span>\n\t\t\t\t\t\t\t<span> will be displayed here.</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t'),jQuery(document).trigger("pp-widget-added"),t.newResponse("Shortcode template created successfully","pp-success")}},error:function(e,o,n){t.newResponse(n,"pp-error")}})}},{key:"createNewShortcode",value:function(){var e=this,t=this.getShortcodeFormValues(),o=t.instance,n=t.values,r=n.title||"Podcast Player Shortcode "+(o+1);jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_create_new_shortcode",security:this.data.security,data:n,instance:o},type:"POST",timeout:6e4,success:function(t){var n=JSON.parse(t);if(!jQuery.isEmptyObject(n))if(void 0!==n.error)e.newResponse(n.error,"pp-error");else if(void 0!==n.success){var i=jQuery("#pp-options-module-shortcode"),s=i.find(".pp-shortcode-action"),p=i.find("select.pp-shortcode-dropdown");0===p.length&&(s.append('\n\t\t\t\t\t\t\t\t<span class="pp-separator">or</span>\n\t\t\t\t\t\t\t\t<select class="pp-shortcode-dropdown">\n\t\t\t\t\t\t\t\t\t<option value="" selected="selected">Select a Shortcode to Edit</option>\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t'),p=i.find("select.pp-shortcode-dropdown")),p.append('<option value="'.concat(o,'">').concat(r,"</option>")),p.val(o),p.trigger("change"),e.newResponse("New shortcode created successfully","pp-success")}},error:function(t,o,n){e.newResponse(n,"pp-error")}})}},{key:"loadShortcode",value:function(e){var t=this,o=this,n=e.val();if(!n)return jQuery("#pp-shortcode-form").html(""),jQuery("#pp-shortcode-preview").html('\n\t\t\t\t<div style="padding: 20px; font-size: 20px; color: #aaa;">\n\t\t\t\t\t<span>Create a </span>\n\t\t\t\t\t<span style="color: #333;">New Shortcode</span>\n\t\t\t\t\t<span> or </span>\n\t\t\t\t\t<span style="color: #333;">Edit an Existing</span>\n\t\t\t\t\t<span> Shortcode using the menu above.</span>\n\t\t\t\t</div>\n\t\t\t'),void jQuery(".pp-shortcode-result").html("");jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_load_shortcode",security:this.data.security,instance:n},type:"POST",timeout:6e4,success:function(e){var n=JSON.parse(e);if(!jQuery.isEmptyObject(n))if(void 0!==n.error)t.newResponse(n.error,"pp-error");else if(void 0!==n.form&&void 0!==n.preview){var r='\n\t\t\t\t\t\t<div class="pp-shortcode-form-wrapper">'.concat(n.form,'</div>\n\t\t\t\t\t\t<div class="pp-shortcode-form-update pp-button-wrapper">\n\t\t\t\t\t\t\t<button id="pp-shortcode-generator-update-btn" class="button button-secondary" style="width: 100%;">Update Shortcode</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="pp-shortcode-form-delete pp-button-wrapper">\n\t\t\t\t\t\t\t<button id="pp-shortcode-generator-delete-btn" class="button button-secondary" style="width: 100%;">Delete Shortcode</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t'),i="\n\t\t\t\t\t\t".concat(n.preview,"\n\t\t\t\t\t\t"),s=jQuery(".pp-shortcode-result"),p=jQuery("#pp-shortcode-form"),a=jQuery("#pp-shortcode-preview");p.html(r).data("instance",n.instance),a.html(i),s.html('\n\t\t\t\t\t\t\t<div class="pp-shortcode-sidebar-collapse">\n\t\t\t\t\t\t\t\t<a href="#" class="pp-collapse-sidebar">\n\t\t\t\t\t\t\t\t\t<span class="dashicons dashicons-arrow-left-alt2"></span>\n\t\t\t\t\t\t\t\t\t<span class="pp-collapse-side">Collapse</span>\n\t\t\t\t\t\t\t\t\t<span class="pp-expand-side" style="display: none;">Expand</span>\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class="pp-shortcode-copy">\n\t\t\t\t\t\t\t\t<span>Your shortcode is </span>\n\t\t\t\t\t\t\t\t<pre class="pp-shortcode-text"><code>[showpodcastplayer instance="'.concat(n.instance,'"]</code></pre>\n\t\t\t\t\t\t\t\t<a href="#" class="pp-copy-shortcode-text">(Copy shortcode)</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t')),o.updateFont(),jQuery(document).trigger("pp-widget-added")}},error:function(e,o,n){t.newResponse(n,"pp-error")}})}},{key:"updateFont",value:function(){var e=jQuery("#pp-options-module-shortcode .podcast-player-pp-fonts");if(e.length){var t=e.val(),o=this.data.gfonts,n=!(!t||!o[t])&&o[t];if(n){var r=n.split(" ").join("+");if(0===jQuery("link#podcast-player-fonts-css-temp").length){var i=jQuery("<link>",{id:"podcast-player-fonts-css-temp",href:"//fonts.googleapis.com/css?family="+r,rel:"stylesheet",type:"text/css"});jQuery("link:last").after(i)}else{var s=jQuery("link#podcast-player-fonts-css-temp"),p=s.attr("href");s.attr("href",p+"%7C"+r)}}}}},{key:"deleteShortcode",value:function(e){var t=this,o=jQuery("#pp-options-module-shortcode"),n=o.find("#pp-shortcode-form").data("instance"),r=o.find("select.pp-shortcode-dropdown");o.find("#pp-shortcode-action-modal").addClass("podcast-player-hidden"),void 0!==n&&(o.find(".pp-shortcode-result").html(""),jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_delete_shortcode",security:this.data.security,instance:n},type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)||(void 0!==o.error?t.newResponse(o.error,"pp-error"):void 0!==o.success&&(r.val(""),r.find('option[value="'.concat(n,'"]')).remove(),0===r.find("option").length?r.remove():r.trigger("change"),t.newResponse("Shortcode deleted successfully","pp-success",!0)))},error:function(e,o,n){t.newResponse(n,"pp-error")}}))}},{key:"updateShortcode",value:function(e){var t=this,o=this.getShortcodeFormValues(),n=o.instance,r=o.values;r.title&&jQuery(".pp-shortcode-dropdown option:selected").text(r.title),jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_update_shortcode",security:this.data.security,data:r,instance:n},type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)||(void 0!==o.error?t.newResponse(o.error,"pp-error"):void 0!==o.success&&t.newResponse("Shortcode updated successfully","pp-success"))},error:function(e,o,n){t.newResponse(n,"pp-error")}})}},{key:"newResponse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.newFeedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.newFeedback.addClass(t),this.newFeedback.find(".pp-feedback").text(e)),setTimeout(function(){this.newFeedback.removeClass("pp-success pp-running"),o&&window.location.reload()}.bind(this),1e3)}},{key:"toggleSidebar",value:function(e){jQuery("#pp-shortcode-form").toggleClass("pp-sidebar-close"),e.toggleClass("pp-sidebar-close"),window.dispatchEvent(new Event("resize"))}},{key:"copyShortcodeText",value:function(e){var t=e.closest(".pp-shortcode-copy").find(".pp-shortcode-text code").text(),o=jQuery("<textarea>");jQuery("body").append(o),o.val(t).select(),document.execCommand("copy"),o.remove(),this.newResponse("Shortcode copied to clipboard","pp-success")}}],t&&h(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function m(e){return m="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},m(e)}function g(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function b(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=m(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}const j=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events()},t=[{key:"events",value:function(){var e=this;jQuery((function(){e.colorPicker()})),jQuery(document).on("pp-widget-added",(function(){e.colorPicker()}))}},{key:"colorPicker",value:function(){var e={change:function(e,t){jQuery(e.target).val(t.color.toString()),jQuery(e.target).trigger("change")}},t=jQuery(".pp-color-picker").not('[id*="__i__"]');t.wpColorPicker(e),t.each((function(){var e=jQuery(this);e.closest(".wp-picker-container").find(".wp-picker-clear").on("click",(function(){e.val("").trigger("change")}))}))}}],t&&g(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function k(e){return k="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},k(e)}function w(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_(n.key),n)}}function _(e){var t=function(e){if("object"!=k(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=k(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==k(t)?t:t+""}var x=function(){return e=function e(t,o,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.adminData=window.ppjsAdmin||{},this.wrapper=t,this.fetchMethod=o,this.isReset=n,this.adminData.ispremium&&this.runFetchAction()},(t=[{key:"runFetchAction",value:function(){var e=this.getAjaxData();!1===e?this.runFalseAction():(this.hideLists(),this.makeAjaxRequest(e))}},{key:"runFalseAction",value:function(e){this.hideLists(),e&&console.log(e)}},{key:"hideLists",value:function(){this.wrapper.find(".pp-episodes-list").hide(),"feed"===this.fetchMethod&&this.isReset&&(this.wrapper.find(".pp-categories-list").hide(),this.wrapper.find(".pp-seasons-list").hide())}},{key:"getAjaxData",value:function(){return"feed"===this.fetchMethod?this.getFeedAjaxData():"post"===this.fetchMethod?this.getPostAjaxData():void 0}},{key:"getFeedAjaxData",value:function(){var e=this.wrapper.find(".feed_url input").val();if(!(e="string"==typeof e&&e.trim()))return!1;var t=this.adminData.security,o=this.isReset?"true":"false",n=this.wrapper.find('.pp_slist-checklist input[type="checkbox"]:checked'),r=this.wrapper.find('.pp_catlist-checklist input[type="checkbox"]:checked'),i=[],s=[];return this.isReset||(jQuery.each(n,(function(){i.push(jQuery(this).val())})),jQuery.each(r,(function(){s.push(jQuery(this).val())}))),{action:"pp_feed_data_list",security:t,getAll:o,feedUrl:e,seasons:i,categories:s}}},{key:"getPostAjaxData",value:function(){var e=this.adminData.security,t=this.wrapper.find("select.podcast-player-pp-post-type").val(),o=this.wrapper.find("select.podcast-player-pp-taxonomy").val(),n=this.wrapper.find("select.podcast-player-sortby").val(),r=this.wrapper.find(".filterby input").val(),i=this.wrapper.find('.pp_terms-checklist input[type="checkbox"]:checked'),s=[];return jQuery.each(i,(function(){s.push(jQuery(this).val())})),{action:"pp_post_episodes_list",security:e,postType:t,taxonomy:o,sortby:n,filterby:r,terms:s}}},{key:"makeAjaxRequest",value:function(e){var t=this,o=this.adminData.ajaxurl;jQuery.ajax({url:o,data:e,type:"POST",timeout:1e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)?t.runFalseAction("PP Error: Empty object received"):o.items?t.createMarkup(o):o.error&&t.runFalseAction(o.error)},error:function(e,o,n){t.runFalseAction(n)}})}},{key:"createMarkup",value:function(e){e.items&&(this.template("episode","elist",e.items),this.wrapper.find(".pp-episodes-list").show()),e.seasons&&(this.template("season","slist",e.seasons),this.wrapper.find(".pp-seasons-list").show()),e.categories&&(this.template("cat","catlist",e.categories),this.wrapper.find(".pp-categories-list").show())}},{key:"template",value:function(e,t,o){this.wrapper.find(".d-".concat(e,' input[type="checkbox"]')).prop("checked",!0);var n=this.wrapper.find(".pp_".concat(t,"-checklist ul")),r=n.find("li.d-".concat(e)).clone();n.empty().append(r.clone()),r.removeClass("d-".concat(e)).addClass("pp-".concat(e,"s")),r.find('input[type="checkbox"]').prop("checked",!1).attr("disabled",!0),jQuery.each(o,(function(e,t){var o=r.clone();o.find('input[type="checkbox"]').val(e),o.find(".cblabel").html(t),n.append(o)}))}}])&&w(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const Q=x,S={ajaxtimeout:null};function P(e){return P="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},P(e)}function O(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function T(e){var t=function(e){if("object"!=P(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}var C=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events()},t=[{key:"events",value:function(){var e=this;jQuery("#pp-options-module-shortcode").on("change",".podcast-player-pp-fetch-method",(function(){e.changeFetchMethod(jQuery(this))}))}},{key:"changeFetchMethod",value:function(e){var t=e.closest(".pp-shortcode-form, .pp-shortcode-form"),o=e.val(),n=t.find(".podcast-player-pp-aspect-ratio"),r=["lv1","gv1",""],i=""===t.find(".podcast-player-pp-teaser-text").val(),s=["lv1","lv2","gv1","gv2"],p=t.find("select.podcast-player-pp-display-style").val(),a=[".feed_url",".pp_hide_content",".pp_slist",".pp_catlist",".pp-feedback-toggle"],c=[".pp_post_type",".pp_taxonomy",".pp_podtitle"],u=[".pp_audiosrc",".pp_audiotitle",".pp_audiolink",".pp_ahide_download",".pp_ahide_social",".pp-lshow-toggle",".pp-linfo-toggle"],d=[".pp_elist",".pp-filter-toggle",".pp-show-toggle",".pp_txtcolor",".number.pp-widget-option",".offset.pp-widget-option",".pp_grid_columns",".pp_crop_method",".pp_aspect_ratio"];t.find("select.podcast-player-pp-taxonomy").val(""),t.find(".toggle-active").removeClass("toggle-active"),t.find([".pp_settings-content",".pp_terms"].join(",")).hide(),"feed"===o?(t.find(a.join(",")).show(),t.find(c.join(",")).hide(),t.find(u.join(",")).hide(),t.find(d.join(",")).show()):"post"===o?(t.find(a.join(",")).hide(),t.find(c.join(",")).show(),t.find(u.join(",")).hide(),t.find(d.join(",")).show()):"link"===o&&(t.find(a.join(",")).hide(),t.find(c.join(",")).hide(),t.find(u.join(",")).show(),t.find(d.join(",")).hide()),"feed"!==o&&"post"!==o||(clearTimeout(S.ajaxtimeout),S.ajaxtimeout=setTimeout((function(){new Q(t,o,!0)}),500)),"feed"===o||"post"===o?(t.find(".pp_teaser_text").toggle(r.includes(p)),t.find(".pp_excerpt_length").toggle(r.includes(p)&&i),t.find(".pp_excerpt_unit").toggle(r.includes(p)&&i),t.find(".pp_txtcolor").toggle(["lv1","lv2","lv3","gv1"].includes(p)),t.find(".pp_grid_columns").toggle(["gv1","gv2"].includes(p)),t.find(".pp_crop_method").toggle(s.includes(p)&&!!n.val()),t.find(".pp_aspect_ratio").toggle(s.includes(p))):t.find(".pp_teaser_text, .pp_excerpt_length, .pp_excerpt_unit").hide()}}],t&&O(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const F=C;function R(e){return R="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},R(e)}function E(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function A(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=R(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}var D=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events()},t=[{key:"events",value:function(){var e=this,t=jQuery("#pp-options-module-shortcode");jQuery(document),t.on("change",".podcast-player-pp-post-type",(function(){e.postType(jQuery(this))})),t.on("change",".podcast-player-pp-taxonomy",(function(){e.taxonomy(jQuery(this))})),t.on("change",".podcast-player-pp-furl-select",(function(){var e=jQuery(this),t=e.val();e.siblings(".pp_feed-url").val(t).trigger("change").trigger("input")})),t.on("input",".feed_url input",(function(){e.feedUrl(jQuery(this))})),t.on("change",".podcast-player-pp-display-style",(function(){e.displayStyle(jQuery(this))})),t.on("change",".podcast-player-pp-aspect-ratio",(function(){e.aspectRatio(jQuery(this))})),t.on("change",".podcast-player-pp-start-when",(function(){e.startWhen(jQuery(this))})),t.on("change",'.d-episode input[type="checkbox"]',(function(){var t=jQuery(this),o=t.closest(".pp_elist").next(".pp_edisplay");e.filterCheckboxes(t,"episode"),t.is(":checked")?o.hide():o.show()})),t.on("change",'.d-season input[type="checkbox"]',(function(){e.filterCheckboxes(jQuery(this),"season")})),t.on("change",'.d-cat input[type="checkbox"]',(function(){e.filterCheckboxes(jQuery(this),"cat")})),t.on("change",'.pp_hide_header input[type="checkbox"]',(function(){e.hideHeader(jQuery(this))})),t.on("change",'.pp_terms-checklist input[type="checkbox"], .filterby input',(function(){e.postFetch(jQuery(this))})),t.on("change",'.pp_slist-checklist input[type="checkbox"], .pp_catlist-checklist input[type="checkbox"]',(function(){e.feedFetch(jQuery(this),!1)})),t.on("change","select.podcast-player-podcast-menu",(function(){e.toggleMenuItems(jQuery(this))})),t.on("change",'.main_menu_items input[type="number"]',(function(){e.toggleDepricatedSub(jQuery(this))})),t.on("change",".podcast-player-pp-teaser-text",(function(){e.toggleExcerptOptions(jQuery(this))})),t.on("change",'.pp_collect_feedback input[type="checkbox"]',(function(){e.toggleFeedbackOptions(jQuery(this))}))}},{key:"widgetAdded",value:function(e){if(e.hasClass("pp-filter-toggle")){var t=e.next(".pp_settings-content");t.find('.d-episode input[type="checkbox"]').is(":checked")&&t.find('.pp-episodes input[type="checkbox"]').attr("disabled",!0),t.find('.d-cat input[type="checkbox"]').is(":checked")&&t.find('.pp-cats input[type="checkbox"]').attr("disabled",!0),t.find('.d-season input[type="checkbox"]').is(":checked")&&t.find('.pp-seasons input[type="checkbox"]').attr("disabled",!0)}}},{key:"settingsToggle",value:function(e){e.next(".pp_settings-content").slideToggle("fast"),e.toggleClass("toggle-active")}},{key:"postType",value:function(e){var t=e.val(),o=e.closest(".pp-shortcode-form").find(".podcast-player-pp-taxonomy");o.find("option").hide(),o.find(".always-visible, ."+t).show(),o.val(""),this.postFetch(e)}},{key:"taxonomy",value:function(e){var t=e.val(),o=e.closest(".pp-shortcode-form").find(".pp_terms");o.find(".pp_terms-checklist input:checkbox").removeAttr("checked"),o.hide(),t&&(o.find(".pp_terms-checklist li").hide(),o.find(".pp_terms-checklist ."+t).show(),o.show()),this.postFetch(e)}},{key:"feedUrl",value:function(e){this.resetAutoFilters(),e.val()&&this.feedFetch(e,!0)}},{key:"aspectRatio",value:function(e){e.val()?e.closest(".pp-shortcode-form").find(".pp_crop_method").show():e.closest(".pp-shortcode-form").find(".pp_crop_method").hide()}},{key:"toggleExcerptOptions",value:function(e){e.val()?e.closest(".pp-shortcode-form").find(".pp_excerpt_length, .pp_excerpt_unit").hide():e.closest(".pp-shortcode-form").find(".pp_excerpt_length, .pp_excerpt_unit").show()}},{key:"startWhen",value:function(e){var t=e.val();t&&"custom"===t?e.closest(".pp-shortcode-form").find(".pp_start_time").show():e.closest(".pp-shortcode-form").find(".pp_start_time").hide()}},{key:"resetAutoFilters",value:function(){this.filterCheckboxes(jQuery('.d-episode input[type="checkbox"]'),"episode"),this.filterCheckboxes(jQuery('.d-season input[type="checkbox"]'),"season"),this.filterCheckboxes(jQuery('.d-cat input[type="checkbox"]'),"cat")}},{key:"filterCheckboxes",value:function(e,t){var o=e.closest(".pp-shortcode-form"),n=".pp-".concat(t,"s");e.is(":checked")?o.find(n+' input[type="checkbox"]').attr("disabled",!0).prop("checked",!1):o.find(n+' input[type="checkbox"]').attr("disabled",!1)}},{key:"hideHeader",value:function(e){var t=e.closest(".pp-shortcode-form");e.is(":checked")?t.find(".pp_hide_cover, .pp_hide_title, .pp_hide_description, .pp_hide_subscribe").hide():t.find(".pp_hide_cover, .pp_hide_title, .pp_hide_description, .pp_hide_subscribe").show()}},{key:"displayStyle",value:function(e){var t=e.val(),o=e.closest(".pp-shortcode-form"),n=o.find(".podcast-player-pp-aspect-ratio"),r=["lv1","gv1",""],i=["lv1","lv2","gv1","gv2"],s=""===o.find(".podcast-player-pp-teaser-text").val();o.find(".pp_no_scroll").toggle(!t||"modern"===t),o.find(".pp_header_default").toggle(!t||"legacy"===t||"modern"===t),o.find(".pp_list_default").toggle(!t||"legacy"===t||"modern"===t),o.find(".pp_teaser_text").toggle(r.includes(t)),o.find(".pp_excerpt_length").toggle(r.includes(t)&&s),o.find(".pp_excerpt_unit").toggle(r.includes(t)&&s),o.find(".pp_grid_columns").toggle(["gv1","gv2"].includes(t)),o.find(".pp_txtcolor").toggle(["lv1","lv2","lv3","gv1"].includes(t)),o.find(".pp_crop_method").toggle(i.includes(t)&&!!n.val()),o.find(".pp_aspect_ratio").toggle(i.includes(t))}},{key:"postFetch",value:function(e){this.fetch(e.closest(".pp-shortcode-form"),"post")}},{key:"feedFetch",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.fetch(e.closest(".pp-shortcode-form"),"feed",t)}},{key:"fetch",value:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"feed"!==t&&"post"!==t||(clearTimeout(S.ajaxtimeout),S.ajaxtimeout=setTimeout((function(){new Q(e,t,o)}),500))}},{key:"toggleMenuItems",value:function(e){var t=e.val(),o=e.closest(".podcast_menu").next(".main_menu_items");t||o.hide()}},{key:"toggleDepricatedSub",value:function(e){var t=e.val(),o=e.closest(".main_menu_items").siblings(".pp_apple_sub, .pp_google_sub, .pp_spotify_sub");t>0?o.hide():o.show()}},{key:"toggleFeedbackOptions",value:function(e){var t=e.closest(".pp-shortcode-form");e.is(":checked")?t.find(".pp_show_form_time, .pp_feedback_text, .pp_positive_text, .pp_positive_url, .pp_negative_text, .pp_negative_form").show():t.find(".pp_show_form_time, .pp_feedback_text, .pp_positive_text, .pp_positive_url, .pp_negative_text, .pp_negative_form").hide()}}],t&&E(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const N=D;new r,new a,new l,new v,jQuery((function(){new j,new F,new N}))})();1 (()=>{"use strict";function e(t){return e="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(t)}function t(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function o(e,o,n){return o&&t(e.prototype,o),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(t){var o=function(t){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,"string");if("object"!=e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(o)?o:o+""}const r=o((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),jQuery("#pp-options-module-help .pp-docs-hide").hide(),jQuery("#pp-options-module-help .pp-docs-title").on("click",(function(){jQuery(this).toggleClass("pp-toggle"),jQuery(this).next().slideToggle("fast")})),jQuery("#pp-options-module-toolkit .pp-toolkit-content").hide(),jQuery("#pp-options-module-toolkit .pp-toolkit-title").on("click",(function(){jQuery(this).toggleClass("pp-toggle"),jQuery(this).next().slideToggle("fast")})),jQuery(".pp-hidden-settings").hide(),jQuery(".pp-hidden-settings-title").on("click",(function(){jQuery(this).toggleClass("pp-toggle"),jQuery(this).next().slideToggle("fast")}))}));function i(e){return i="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},i(e)}function s(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}const a=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=window.ppjsAdminOpt||{},this.adminPage=jQuery("#pp-options-page"),this.index=jQuery(".select-pp-feed-index").first(),this.refresh=jQuery(".pp-feed-refresh"),this.reset=jQuery(".pp-feed-reset"),this.feedback=jQuery(".pp-toolkit-feedback").first(),this.newFeedback=jQuery("#pp-action-feedback"),this.managePodcastList=this.adminPage.find(".pp-podcasts-list"),this.events()},t=[{key:"events",value:function(){var e=this,t=this;this.refresh.on("click",function(){this.ajaxFeedEditor("refresh")}.bind(this)),this.reset.on("click",function(){this.ajaxFeedEditor("reset")}.bind(this)),jQuery(".pp-feed-del").on("click",(function(){t.index.val()?(jQuery(this).next(".pp-toolkit-del-confirm").slideDown("fast"),t.response()):t.response(t.data.messages.nourl,"pp-error")})),jQuery(".pp-feed-cancel").on("click",(function(){jQuery(this).parents(".pp-toolkit-del-confirm").hide()})),this.managePodcastList.on("click",".pp-podcast-refresh-btn",(function(t){var o=jQuery(t.currentTarget);e.feedRefreshDelete("refresh",o)})),this.managePodcastList.on("click",".pp-podcast-delete-btn",(function(t){var o=jQuery(t.currentTarget);e.feedRefreshDelete("reset",o)})),this.newFeedback.on("click",".pp-error-close",(function(t){e.newFeedback.removeClass("pp-error")}))}},{key:"ajaxFeedEditor",value:function(e){var t=this,o=this.getAjaxConfig(e);this.response(this.data.messages.running,"pp-running"),o?jQuery.ajax({url:this.data.ajaxurl,data:o,type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)||(void 0!==o.error?t.response(o.error,"pp-error"):void 0!==o.message&&t.response(o.message,"pp-success"))},error:function(e,o,n){t.response(n,"pp-error")}}):this.response(this.data.messages.nourl,"pp-error")}},{key:"feedRefreshDelete",value:function(e,t){var o=this,n=t.closest(".pp-podcast-list-item"),r=n.data("podcast"),i={action:"pp_feed_editor",security:this.data.security,atype:e,feedUrl:r};t.addClass("pp-wip"),this.managePodcastList.find(".pp-toolkit-buttons").prop("disabled",!0),jQuery.ajax({url:this.data.ajaxurl,data:i,type:"POST",timeout:6e4,success:function(r){var i=JSON.parse(r);jQuery.isEmptyObject(i)||(void 0!==i.error?o.newResponse(i.error,"pp-error"):void 0!==i.message&&(o.newResponse(i.message,"pp-success"),"reset"==e&&n.fadeOut(200,(function(){jQuery(this).remove()}))),t.removeClass("pp-wip"),setTimeout((function(){o.managePodcastList.find(".pp-toolkit-buttons").prop("disabled",!1)}),1500))},error:function(e,n,r){o.newResponse(r,"pp-error"),t.removeClass("pp-wip"),o.managePodcastList.find(".pp-toolkit-buttons").prop("disabled",!1)}})}},{key:"getAjaxConfig",value:function(e){var t=this.index.val();return!!t&&{action:"pp_feed_editor",security:this.data.security,atype:e,feedUrl:t}}},{key:"response",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.feedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.feedback.addClass(t),this.feedback.find(".pp-feedback").text(e))}},{key:"newResponse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.newFeedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.newFeedback.addClass(t),this.newFeedback.find(".pp-feedback").text(e)),setTimeout(function(){this.newFeedback.removeClass("pp-success pp-running")}.bind(this),1500)}}],t&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function c(e){return c="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},c(e)}function u(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=c(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}const l=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=window.ppjsAdminOpt||{},this.adminPage=jQuery("#pp-options-page"),this.openSourceUrlBtn=this.adminPage.find(".pp-podcast-source-btn"),this.addSourceUrlBtn=this.adminPage.find(".pp-podcast-new-source-btn"),this.delSourceBtn=this.adminPage.find(".pp-podcast-delete-source-url"),this.newFeedback=jQuery("#pp-action-feedback"),this.events()},t=[{key:"events",value:function(){var e=this;this.openSourceUrlBtn.on("click",(function(e){jQuery(this).closest(".pp-podcast-info").find(".pp-podcast-source-container").slideToggle("fast")})),this.addSourceUrlBtn.on("click",(function(t){var o=jQuery(this),n=o.closest(".pp-podcast-source-container"),r=n.find(".pp-podcast-existing-source"),i=r.find(".pp-podcast-existing-source-url"),s=n.find(".pp-podcast-new-source"),p=s.find(".pp-podcast-new-source-url"),a=p.val();if(a){var c=s.closest(".pp-podcast-list-item").data("podcast"),u={action:"pp_migrate_podcast",security:e.data.security,podcast_id:c,source_url:a};p.attr("disabled",!0),o.attr("disabled",!0),jQuery.ajax({url:e.data.ajaxurl,data:u,type:"POST",timeout:6e4,success:function(t){var n=JSON.parse(t);jQuery.isEmptyObject(n)||(void 0!==n.error?e.newResponse(n.error,"pp-error"):void 0!==n.message&&(i.html(a),r.show(),p.val(""),e.newResponse(n.message,"pp-success"))),p.attr("disabled",!1),o.attr("disabled",!1)},error:function(t,n,r){p.attr("disabled",!1),o.attr("disabled",!1),e.newResponse(r,"pp-error")}})}else e.newResponse(e.data.messages.nosource,"pp-error")})),this.delSourceBtn.on("click",(function(t){t.preventDefault();var o=jQuery(this),n=o.closest(".pp-podcast-existing-source"),r=n.find(".pp-podcast-existing-source-url"),i={action:"pp_delete_source",podcast_id:o.closest(".pp-podcast-list-item").data("podcast"),security:e.data.security};o.attr("disabled",!0),jQuery.ajax({url:e.data.ajaxurl,data:i,type:"POST",timeout:6e4,success:function(t){var i=JSON.parse(t);jQuery.isEmptyObject(i)||(void 0!==i.error?e.newResponse(i.error,"pp-error"):void 0!==i.message&&(r.empty(),n.hide(),e.newResponse(i.message,"pp-success"))),o.attr("disabled",!1)},error:function(t,n,r){o.attr("disabled",!1),e.newResponse(r,"pp-error")}})}))}},{key:"newResponse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.newFeedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.newFeedback.addClass(t),this.newFeedback.find(".pp-feedback").text(e)),setTimeout(function(){this.newFeedback.removeClass("pp-success pp-running")}.bind(this),1500)}}],t&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,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},f(e)}function h(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function y(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=f(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}const v=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=window.ppjsAdminOpt||{},this.newFeedback=jQuery("#pp-action-feedback"),this.serverTimeOut=null,this.events()},t=[{key:"events",value:function(){var e=this,t=jQuery("#pp-options-module-shortcode");jQuery(document),t.on("change",".pp-getval",(function(){clearTimeout(e.serverTimeOut),e.serverTimeOut=setTimeout((function(){e.updatePreview(jQuery(this))}),100)})),t.on("click","#pp-shortcode-generator-btn",(function(){e.blankShortcodeTemplate(jQuery(this))})),t.on("click","#pp-shortcode-generator-submit-btn",(function(){e.createNewShortcode(jQuery(this))})),t.on("click","#pp-shortcode-generator-delete-btn",(function(){t.find("#pp-shortcode-action-modal").removeClass("podcast-player-hidden")})),t.on("click","#pp-shortcode-deletion-btn",(function(){e.deleteShortcode(jQuery(this))})),t.on("click","#pp-shortcode-deletion-cancel",(function(){t.find("#pp-shortcode-action-modal").addClass("podcast-player-hidden")})),t.on("click","#pp-shortcode-generator-update-btn",(function(){e.updateShortcode(jQuery(this))})),t.on("change","select.pp-shortcode-dropdown",(function(){e.loadShortcode(jQuery(this))})),t.on("click",".pp-collapse-sidebar",(function(t){t.preventDefault(),e.toggleSidebar(jQuery(this))})),t.on("click",".pp-copy-shortcode-text",(function(t){t.preventDefault(),e.copyShortcodeText(jQuery(this))}))}},{key:"getShortcodeFormValues",value:function(){var e=jQuery("#pp-shortcode-form"),t=e.find(".pp-getval"),o=e.data("instance"),n={};return t.each((function(){var e=this.name.replace(/^pp_field_name_/,"");e.endsWith("[]")?(e=e.replace(/\[\]$/,""),Array.isArray(n[e])||(n[e]=[]),"checkbox"===this.type?n[e].push(this.checked?this.value:""):n[e].push(this.value)):"checkbox"===this.type?n[e]=this.checked?this.value:"":n[e]=this.value})),{instance:o,values:n}}},{key:"updatePreview",value:function(e){var t=this,o=this,n=this.getShortcodeFormValues(),r=(n.instance,n.values);jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_render_preview",security:this.data.security,data:r},type:"POST",timeout:6e4,success:function(e){var n=JSON.parse(e);jQuery.isEmptyObject(n)||(void 0!==n.error?t.newResponse(n.error,"pp-error"):void 0!==n.markup&&(jQuery("#pp-shortcode-preview").html(n.markup),o.updateFont()))},error:function(e,o,n){t.newResponse(n,"dpt-error")}})}},{key:"blankShortcodeTemplate",value:function(e){var t=this;e.siblings("select.pp-shortcode-dropdown").val(""),jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_blank_shortcode_template",security:this.data.security},type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);if(!jQuery.isEmptyObject(o))if(void 0!==o.error)t.newResponse(o.error,"dpt-error");else if(void 0!==o.form&&void 0!==o.instance){var n='\n\t\t\t\t\t\t<div class="pp-shortcode-form-wrapper">'.concat(o.form,'</div>\n\t\t\t\t\t\t<div class="pp-shortcode-form-submit">\n\t\t\t\t\t\t\t<button id="pp-shortcode-generator-submit-btn" class="button button-secondary" style="width: 100%;">Generate Shortcode</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t'),r=jQuery("#pp-shortcode-form"),i=jQuery("#pp-shortcode-preview");jQuery(".pp-shortcode-result").html(""),r.html(n).attr("data-instance",o.instance),i.html('\n\t\t\t\t\t\t<div style="padding: 20px; font-size: 20px; color: #aaa;">\n\t\t\t\t\t\t\t<span>Shortcode</span>\n\t\t\t\t\t\t\t<span style="color: #333;">Preview</span>\n\t\t\t\t\t\t\t<span> will be displayed here.</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t'),jQuery(document).trigger("pp-widget-added"),t.newResponse("Shortcode template created successfully","pp-success")}},error:function(e,o,n){t.newResponse(n,"pp-error")}})}},{key:"createNewShortcode",value:function(){var e=this,t=this.getShortcodeFormValues(),o=t.instance,n=t.values;jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_create_new_shortcode",security:this.data.security,data:n,instance:o},type:"POST",timeout:6e4,success:function(t){var r=JSON.parse(t);if(!jQuery.isEmptyObject(r))if(void 0!==r.error)e.newResponse(r.error,"pp-error");else if(void 0!==r.success){var i=void 0!==r.instance?r.instance:o,s=n.title||"Podcast Player Shortcode "+i,p=jQuery("#pp-options-module-shortcode"),a=p.find(".pp-shortcode-action"),c=p.find("select.pp-shortcode-dropdown");0===c.length&&(a.append('\n\t\t\t\t\t\t\t\t<span class="pp-separator">or</span>\n\t\t\t\t\t\t\t\t<select class="pp-shortcode-dropdown">\n\t\t\t\t\t\t\t\t\t<option value="" selected="selected">Select a Shortcode to Edit</option>\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t'),c=p.find("select.pp-shortcode-dropdown")),c.append('<option value="'.concat(i,'">').concat(s,"</option>")),c.val(i),c.trigger("change"),e.newResponse("New shortcode created successfully","pp-success")}},error:function(t,o,n){e.newResponse(n,"pp-error")}})}},{key:"loadShortcode",value:function(e){var t=this,o=this,n=e.val();if(!n)return jQuery("#pp-shortcode-form").html(""),jQuery("#pp-shortcode-preview").html('\n\t\t\t\t<div style="padding: 20px; font-size: 20px; color: #aaa;">\n\t\t\t\t\t<span>Create a </span>\n\t\t\t\t\t<span style="color: #333;">New Shortcode</span>\n\t\t\t\t\t<span> or </span>\n\t\t\t\t\t<span style="color: #333;">Edit an Existing</span>\n\t\t\t\t\t<span> Shortcode using the menu above.</span>\n\t\t\t\t</div>\n\t\t\t'),void jQuery(".pp-shortcode-result").html("");jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_load_shortcode",security:this.data.security,instance:n},type:"POST",timeout:6e4,success:function(e){var n=JSON.parse(e);if(!jQuery.isEmptyObject(n))if(void 0!==n.error)t.newResponse(n.error,"pp-error");else if(void 0!==n.form&&void 0!==n.preview){var r='\n\t\t\t\t\t\t<div class="pp-shortcode-form-wrapper">'.concat(n.form,'</div>\n\t\t\t\t\t\t<div class="pp-shortcode-form-update pp-button-wrapper">\n\t\t\t\t\t\t\t<button id="pp-shortcode-generator-update-btn" class="button button-secondary" style="width: 100%;">Update Shortcode</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="pp-shortcode-form-delete pp-button-wrapper">\n\t\t\t\t\t\t\t<button id="pp-shortcode-generator-delete-btn" class="button button-secondary" style="width: 100%;">Delete Shortcode</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t'),i="\n\t\t\t\t\t\t".concat(n.preview,"\n\t\t\t\t\t\t"),s=jQuery(".pp-shortcode-result"),p=jQuery("#pp-shortcode-form"),a=jQuery("#pp-shortcode-preview");p.html(r).data("instance",n.instance),a.html(i),s.html('\n\t\t\t\t\t\t\t<div class="pp-shortcode-sidebar-collapse">\n\t\t\t\t\t\t\t\t<a href="#" class="pp-collapse-sidebar">\n\t\t\t\t\t\t\t\t\t<span class="dashicons dashicons-arrow-left-alt2"></span>\n\t\t\t\t\t\t\t\t\t<span class="pp-collapse-side">Collapse</span>\n\t\t\t\t\t\t\t\t\t<span class="pp-expand-side" style="display: none;">Expand</span>\n\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class="pp-shortcode-copy">\n\t\t\t\t\t\t\t\t<span>Your shortcode is </span>\n\t\t\t\t\t\t\t\t<pre class="pp-shortcode-text"><code>[showpodcastplayer instance="'.concat(n.instance,'"]</code></pre>\n\t\t\t\t\t\t\t\t<a href="#" class="pp-copy-shortcode-text">(Copy shortcode)</a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t')),o.updateFont(),jQuery(document).trigger("pp-widget-added")}},error:function(e,o,n){t.newResponse(n,"pp-error")}})}},{key:"updateFont",value:function(){var e=jQuery("#pp-options-module-shortcode .podcast-player-pp-fonts");if(e.length){var t=e.val(),o=this.data.gfonts,n=!(!t||!o[t])&&o[t];if(n){var r=n.split(" ").join("+");if(0===jQuery("link#podcast-player-fonts-css-temp").length){var i=jQuery("<link>",{id:"podcast-player-fonts-css-temp",href:"//fonts.googleapis.com/css?family="+r,rel:"stylesheet",type:"text/css"});jQuery("link:last").after(i)}else{var s=jQuery("link#podcast-player-fonts-css-temp"),p=s.attr("href");s.attr("href",p+"%7C"+r)}}}}},{key:"deleteShortcode",value:function(e){var t=this,o=jQuery("#pp-options-module-shortcode"),n=o.find("#pp-shortcode-form").data("instance"),r=o.find("select.pp-shortcode-dropdown");o.find("#pp-shortcode-action-modal").addClass("podcast-player-hidden"),void 0!==n&&(o.find(".pp-shortcode-result").html(""),jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_delete_shortcode",security:this.data.security,instance:n},type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)||(void 0!==o.error?t.newResponse(o.error,"pp-error"):void 0!==o.success&&(r.val(""),r.find('option[value="'.concat(n,'"]')).remove(),0===r.find("option").length?r.remove():r.trigger("change"),t.newResponse("Shortcode deleted successfully","pp-success",!0)))},error:function(e,o,n){t.newResponse(n,"pp-error")}}))}},{key:"updateShortcode",value:function(e){var t=this,o=this.getShortcodeFormValues(),n=o.instance,r=o.values;r.title&&jQuery(".pp-shortcode-dropdown option:selected").text(r.title),jQuery.ajax({url:this.data.ajaxurl,data:{action:"pp_update_shortcode",security:this.data.security,data:r,instance:n},type:"POST",timeout:6e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)||(void 0!==o.error?t.newResponse(o.error,"pp-error"):void 0!==o.success&&t.newResponse("Shortcode updated successfully","pp-success"))},error:function(e,o,n){t.newResponse(n,"pp-error")}})}},{key:"newResponse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.newFeedback.removeClass("pp-error pp-success pp-running"),!1!==t&&(this.newFeedback.addClass(t),this.newFeedback.find(".pp-feedback").text(e)),setTimeout(function(){this.newFeedback.removeClass("pp-success pp-running"),o&&window.location.reload()}.bind(this),1e3)}},{key:"toggleSidebar",value:function(e){jQuery("#pp-shortcode-form").toggleClass("pp-sidebar-close"),e.toggleClass("pp-sidebar-close"),window.dispatchEvent(new Event("resize"))}},{key:"copyShortcodeText",value:function(e){var t=e.closest(".pp-shortcode-copy").find(".pp-shortcode-text code").text(),o=jQuery("<textarea>");jQuery("body").append(o),o.val(t).select(),document.execCommand("copy"),o.remove(),this.newResponse("Shortcode copied to clipboard","pp-success")}}],t&&h(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function m(e){return m="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},m(e)}function g(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,b(n.key),n)}}function b(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=m(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}const j=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events()},t=[{key:"events",value:function(){var e=this;jQuery((function(){e.colorPicker()})),jQuery(document).on("pp-widget-added",(function(){e.colorPicker()}))}},{key:"colorPicker",value:function(){var e={change:function(e,t){jQuery(e.target).val(t.color.toString()),jQuery(e.target).trigger("change")}},t=jQuery(".pp-color-picker").not('[id*="__i__"]');t.wpColorPicker(e),t.each((function(){var e=jQuery(this);e.closest(".wp-picker-container").find(".wp-picker-clear").on("click",(function(){e.val("").trigger("change")}))}))}}],t&&g(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function k(e){return k="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},k(e)}function w(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_(n.key),n)}}function _(e){var t=function(e){if("object"!=k(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=k(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==k(t)?t:t+""}var x=function(){return e=function e(t,o,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.adminData=window.ppjsAdmin||{},this.wrapper=t,this.fetchMethod=o,this.isReset=n,this.adminData.ispremium&&this.runFetchAction()},(t=[{key:"runFetchAction",value:function(){var e=this.getAjaxData();!1===e?this.runFalseAction():(this.hideLists(),this.makeAjaxRequest(e))}},{key:"runFalseAction",value:function(e){this.hideLists(),e&&console.log(e)}},{key:"hideLists",value:function(){this.wrapper.find(".pp-episodes-list").hide(),"feed"===this.fetchMethod&&this.isReset&&(this.wrapper.find(".pp-categories-list").hide(),this.wrapper.find(".pp-seasons-list").hide())}},{key:"getAjaxData",value:function(){return"feed"===this.fetchMethod?this.getFeedAjaxData():"post"===this.fetchMethod?this.getPostAjaxData():void 0}},{key:"getFeedAjaxData",value:function(){var e=this.wrapper.find(".feed_url input").val();if(!(e="string"==typeof e&&e.trim()))return!1;var t=this.adminData.security,o=this.isReset?"true":"false",n=this.wrapper.find('.pp_slist-checklist input[type="checkbox"]:checked'),r=this.wrapper.find('.pp_catlist-checklist input[type="checkbox"]:checked'),i=[],s=[];return this.isReset||(jQuery.each(n,(function(){i.push(jQuery(this).val())})),jQuery.each(r,(function(){s.push(jQuery(this).val())}))),{action:"pp_feed_data_list",security:t,getAll:o,feedUrl:e,seasons:i,categories:s}}},{key:"getPostAjaxData",value:function(){var e=this.adminData.security,t=this.wrapper.find("select.podcast-player-pp-post-type").val(),o=this.wrapper.find("select.podcast-player-pp-taxonomy").val(),n=this.wrapper.find("select.podcast-player-sortby").val(),r=this.wrapper.find(".filterby input").val(),i=this.wrapper.find('.pp_terms-checklist input[type="checkbox"]:checked'),s=[];return jQuery.each(i,(function(){s.push(jQuery(this).val())})),{action:"pp_post_episodes_list",security:e,postType:t,taxonomy:o,sortby:n,filterby:r,terms:s}}},{key:"makeAjaxRequest",value:function(e){var t=this,o=this.adminData.ajaxurl;jQuery.ajax({url:o,data:e,type:"POST",timeout:1e4,success:function(e){var o=JSON.parse(e);jQuery.isEmptyObject(o)?t.runFalseAction("PP Error: Empty object received"):o.items?t.createMarkup(o):o.error&&t.runFalseAction(o.error)},error:function(e,o,n){t.runFalseAction(n)}})}},{key:"createMarkup",value:function(e){e.items&&(this.template("episode","elist",e.items),this.wrapper.find(".pp-episodes-list").show()),e.seasons&&(this.template("season","slist",e.seasons),this.wrapper.find(".pp-seasons-list").show()),e.categories&&(this.template("cat","catlist",e.categories),this.wrapper.find(".pp-categories-list").show())}},{key:"template",value:function(e,t,o){this.wrapper.find(".d-".concat(e,' input[type="checkbox"]')).prop("checked",!0);var n=this.wrapper.find(".pp_".concat(t,"-checklist ul")),r=n.find("li.d-".concat(e)).clone();n.empty().append(r.clone()),r.removeClass("d-".concat(e)).addClass("pp-".concat(e,"s")),r.find('input[type="checkbox"]').prop("checked",!1).attr("disabled",!0),jQuery.each(o,(function(e,t){var o=r.clone();o.find('input[type="checkbox"]').val(e),o.find(".cblabel").html(t),n.append(o)}))}}])&&w(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const Q=x,S={ajaxtimeout:null};function P(e){return P="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},P(e)}function O(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function T(e){var t=function(e){if("object"!=P(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==P(t)?t:t+""}var C=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events()},t=[{key:"events",value:function(){var e=this;jQuery("#pp-options-module-shortcode").on("change",".podcast-player-pp-fetch-method",(function(){e.changeFetchMethod(jQuery(this))}))}},{key:"changeFetchMethod",value:function(e){var t=e.closest(".pp-shortcode-form, .pp-shortcode-form"),o=e.val(),n=t.find(".podcast-player-pp-aspect-ratio"),r=["lv1","gv1",""],i=""===t.find(".podcast-player-pp-teaser-text").val(),s=["lv1","lv2","gv1","gv2"],p=t.find("select.podcast-player-pp-display-style").val(),a=[".feed_url",".pp_hide_content",".pp_slist",".pp_catlist",".pp-feedback-toggle"],c=[".pp_post_type",".pp_taxonomy",".pp_podtitle"],u=[".pp_audiosrc",".pp_audiotitle",".pp_audiolink",".pp_ahide_download",".pp_ahide_social",".pp-lshow-toggle",".pp-linfo-toggle"],d=[".pp_elist",".pp-filter-toggle",".pp-show-toggle",".pp_txtcolor",".number.pp-widget-option",".offset.pp-widget-option",".pp_grid_columns",".pp_crop_method",".pp_aspect_ratio"];t.find("select.podcast-player-pp-taxonomy").val(""),t.find(".toggle-active").removeClass("toggle-active"),t.find([".pp_settings-content",".pp_terms"].join(",")).hide(),"feed"===o?(t.find(a.join(",")).show(),t.find(c.join(",")).hide(),t.find(u.join(",")).hide(),t.find(d.join(",")).show()):"post"===o?(t.find(a.join(",")).hide(),t.find(c.join(",")).show(),t.find(u.join(",")).hide(),t.find(d.join(",")).show()):"link"===o&&(t.find(a.join(",")).hide(),t.find(c.join(",")).hide(),t.find(u.join(",")).show(),t.find(d.join(",")).hide()),"feed"!==o&&"post"!==o||(clearTimeout(S.ajaxtimeout),S.ajaxtimeout=setTimeout((function(){new Q(t,o,!0)}),500)),"feed"===o||"post"===o?(t.find(".pp_teaser_text").toggle(r.includes(p)),t.find(".pp_excerpt_length").toggle(r.includes(p)&&i),t.find(".pp_excerpt_unit").toggle(r.includes(p)&&i),t.find(".pp_txtcolor").toggle(["lv1","lv2","lv3","gv1"].includes(p)),t.find(".pp_grid_columns").toggle(["gv1","gv2"].includes(p)),t.find(".pp_crop_method").toggle(s.includes(p)&&!!n.val()),t.find(".pp_aspect_ratio").toggle(s.includes(p))):t.find(".pp_teaser_text, .pp_excerpt_length, .pp_excerpt_unit").hide()}}],t&&O(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const F=C;function R(e){return R="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},R(e)}function E(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,A(n.key),n)}}function A(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,"string");if("object"!=R(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}var D=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events()},t=[{key:"events",value:function(){var e=this,t=jQuery("#pp-options-module-shortcode");jQuery(document),t.on("change",".podcast-player-pp-post-type",(function(){e.postType(jQuery(this))})),t.on("change",".podcast-player-pp-taxonomy",(function(){e.taxonomy(jQuery(this))})),t.on("change",".podcast-player-pp-furl-select",(function(){var e=jQuery(this),t=e.val();e.siblings(".pp_feed-url").val(t).trigger("change").trigger("input")})),t.on("input",".feed_url input",(function(){e.feedUrl(jQuery(this))})),t.on("change",".podcast-player-pp-display-style",(function(){e.displayStyle(jQuery(this))})),t.on("change",".podcast-player-pp-aspect-ratio",(function(){e.aspectRatio(jQuery(this))})),t.on("change",".podcast-player-pp-start-when",(function(){e.startWhen(jQuery(this))})),t.on("change",'.d-episode input[type="checkbox"]',(function(){var t=jQuery(this),o=t.closest(".pp_elist").next(".pp_edisplay");e.filterCheckboxes(t,"episode"),t.is(":checked")?o.hide():o.show()})),t.on("change",'.d-season input[type="checkbox"]',(function(){e.filterCheckboxes(jQuery(this),"season")})),t.on("change",'.d-cat input[type="checkbox"]',(function(){e.filterCheckboxes(jQuery(this),"cat")})),t.on("change",'.pp_hide_header input[type="checkbox"]',(function(){e.hideHeader(jQuery(this))})),t.on("change",'.pp_terms-checklist input[type="checkbox"], .filterby input',(function(){e.postFetch(jQuery(this))})),t.on("change",'.pp_slist-checklist input[type="checkbox"], .pp_catlist-checklist input[type="checkbox"]',(function(){e.feedFetch(jQuery(this),!1)})),t.on("change","select.podcast-player-podcast-menu",(function(){e.toggleMenuItems(jQuery(this))})),t.on("change",'.main_menu_items input[type="number"]',(function(){e.toggleDepricatedSub(jQuery(this))})),t.on("change",".podcast-player-pp-teaser-text",(function(){e.toggleExcerptOptions(jQuery(this))})),t.on("change",'.pp_collect_feedback input[type="checkbox"]',(function(){e.toggleFeedbackOptions(jQuery(this))}))}},{key:"widgetAdded",value:function(e){if(e.hasClass("pp-filter-toggle")){var t=e.next(".pp_settings-content");t.find('.d-episode input[type="checkbox"]').is(":checked")&&t.find('.pp-episodes input[type="checkbox"]').attr("disabled",!0),t.find('.d-cat input[type="checkbox"]').is(":checked")&&t.find('.pp-cats input[type="checkbox"]').attr("disabled",!0),t.find('.d-season input[type="checkbox"]').is(":checked")&&t.find('.pp-seasons input[type="checkbox"]').attr("disabled",!0)}}},{key:"settingsToggle",value:function(e){e.next(".pp_settings-content").slideToggle("fast"),e.toggleClass("toggle-active")}},{key:"postType",value:function(e){var t=e.val(),o=e.closest(".pp-shortcode-form").find(".podcast-player-pp-taxonomy");o.find("option").hide(),o.find(".always-visible, ."+t).show(),o.val(""),this.postFetch(e)}},{key:"taxonomy",value:function(e){var t=e.val(),o=e.closest(".pp-shortcode-form").find(".pp_terms");o.find(".pp_terms-checklist input:checkbox").removeAttr("checked"),o.hide(),t&&(o.find(".pp_terms-checklist li").hide(),o.find(".pp_terms-checklist ."+t).show(),o.show()),this.postFetch(e)}},{key:"feedUrl",value:function(e){this.resetAutoFilters(),e.val()&&this.feedFetch(e,!0)}},{key:"aspectRatio",value:function(e){e.val()?e.closest(".pp-shortcode-form").find(".pp_crop_method").show():e.closest(".pp-shortcode-form").find(".pp_crop_method").hide()}},{key:"toggleExcerptOptions",value:function(e){e.val()?e.closest(".pp-shortcode-form").find(".pp_excerpt_length, .pp_excerpt_unit").hide():e.closest(".pp-shortcode-form").find(".pp_excerpt_length, .pp_excerpt_unit").show()}},{key:"startWhen",value:function(e){var t=e.val();t&&"custom"===t?e.closest(".pp-shortcode-form").find(".pp_start_time").show():e.closest(".pp-shortcode-form").find(".pp_start_time").hide()}},{key:"resetAutoFilters",value:function(){this.filterCheckboxes(jQuery('.d-episode input[type="checkbox"]'),"episode"),this.filterCheckboxes(jQuery('.d-season input[type="checkbox"]'),"season"),this.filterCheckboxes(jQuery('.d-cat input[type="checkbox"]'),"cat")}},{key:"filterCheckboxes",value:function(e,t){var o=e.closest(".pp-shortcode-form"),n=".pp-".concat(t,"s");e.is(":checked")?o.find(n+' input[type="checkbox"]').attr("disabled",!0).prop("checked",!1):o.find(n+' input[type="checkbox"]').attr("disabled",!1)}},{key:"hideHeader",value:function(e){var t=e.closest(".pp-shortcode-form");e.is(":checked")?t.find(".pp_hide_cover, .pp_hide_title, .pp_hide_description, .pp_hide_subscribe").hide():t.find(".pp_hide_cover, .pp_hide_title, .pp_hide_description, .pp_hide_subscribe").show()}},{key:"displayStyle",value:function(e){var t=e.val(),o=e.closest(".pp-shortcode-form"),n=o.find(".podcast-player-pp-aspect-ratio"),r=["lv1","gv1",""],i=["lv1","lv2","gv1","gv2"],s=""===o.find(".podcast-player-pp-teaser-text").val();o.find(".pp_no_scroll").toggle(!t||"modern"===t),o.find(".pp_header_default").toggle(!t||"legacy"===t||"modern"===t),o.find(".pp_list_default").toggle(!t||"legacy"===t||"modern"===t),o.find(".pp_teaser_text").toggle(r.includes(t)),o.find(".pp_excerpt_length").toggle(r.includes(t)&&s),o.find(".pp_excerpt_unit").toggle(r.includes(t)&&s),o.find(".pp_grid_columns").toggle(["gv1","gv2"].includes(t)),o.find(".pp_txtcolor").toggle(["lv1","lv2","lv3","gv1"].includes(t)),o.find(".pp_crop_method").toggle(i.includes(t)&&!!n.val()),o.find(".pp_aspect_ratio").toggle(i.includes(t))}},{key:"postFetch",value:function(e){this.fetch(e.closest(".pp-shortcode-form"),"post")}},{key:"feedFetch",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.fetch(e.closest(".pp-shortcode-form"),"feed",t)}},{key:"fetch",value:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"feed"!==t&&"post"!==t||(clearTimeout(S.ajaxtimeout),S.ajaxtimeout=setTimeout((function(){new Q(e,t,o)}),500))}},{key:"toggleMenuItems",value:function(e){var t=e.val(),o=e.closest(".podcast_menu").next(".main_menu_items");t||o.hide()}},{key:"toggleDepricatedSub",value:function(e){var t=e.val(),o=e.closest(".main_menu_items").siblings(".pp_apple_sub, .pp_google_sub, .pp_spotify_sub");t>0?o.hide():o.show()}},{key:"toggleFeedbackOptions",value:function(e){var t=e.closest(".pp-shortcode-form");e.is(":checked")?t.find(".pp_show_form_time, .pp_feedback_text, .pp_positive_text, .pp_positive_url, .pp_negative_text, .pp_negative_form").show():t.find(".pp_show_form_time, .pp_feedback_text, .pp_positive_text, .pp_positive_url, .pp_negative_text, .pp_negative_form").hide()}}],t&&E(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const N=D;new r,new a,new l,new v,jQuery((function(){new j,new F,new N}))})(); -
podcast-player/trunk/backend/js/partials/options/shortgen.js
r3381875 r3462195 97 97 } 98 98 ); 99 console.log(instance);100 99 return { instance, values }; 101 100 } … … 167 166 const previewWrapper = jQuery('#pp-shortcode-preview'); 168 167 jQuery('.pp-shortcode-result').html( '' ); 169 formWrapper.html( form ). data('instance', details.instance);168 formWrapper.html( form ).attr('data-instance', details.instance); 170 169 previewWrapper.html( preview ); 171 170 jQuery(document).trigger('pp-widget-added'); … … 182 181 createNewShortcode() { 183 182 const { instance, values } = this.getShortcodeFormValues(); 184 const title = values.title || 'Podcast Player Shortcode' + ' ' + (instance + 1);185 183 // Let's get next set of episodes. 186 184 jQuery.ajax( { … … 200 198 this.newResponse(details.error, 'pp-error'); 201 199 } else if ('undefined' !== typeof details.success) { 200 const savedInstance = 'undefined' !== typeof details.instance ? details.instance : instance; 201 const title = values.title || 'Podcast Player Shortcode' + ' ' + savedInstance; 202 202 const widget = jQuery('#pp-options-module-shortcode'); 203 203 const wrapper = widget.find('.pp-shortcode-action'); … … 212 212 dropdown = widget.find('select.pp-shortcode-dropdown'); 213 213 } 214 dropdown.append(`<option value="${ instance}">${title}</option>`);215 dropdown.val( instance);214 dropdown.append(`<option value="${savedInstance}">${title}</option>`); 215 dropdown.val(savedInstance); 216 216 dropdown.trigger('change'); 217 217 this.newResponse('New shortcode created successfully', 'pp-success'); -
podcast-player/trunk/frontend/class-register.php
r3442200 r3462195 107 107 */ 108 108 public static function load_resources( $instance ) { 109 // Register and conditionally enqueue styles in head when detectable. 110 add_action( 'wp_enqueue_scripts', array( $instance, 'register_styles' ), 1 ); 111 add_action( 'wp_enqueue_scripts', array( $instance, 'maybe_enqueue_styles_early' ), 20 ); 109 112 110 113 // The script must be loaded before mediaelement-migrate script. -
podcast-player/trunk/frontend/inc/class-loader.php
r3245675 r3462195 150 150 151 151 /** 152 * Enqueue podcast player front-end styles and scripts in footer. 153 * 154 * @since 1.0.0 155 */ 156 public function enqueue_resources() { 157 158 // Return if podcast player is not available on the page. 159 if ( ! $this->has_podcast_player() ) { 160 return; 161 } 162 163 // Enqueue podcast player styles. 164 $this->enqueue_styles(); 165 166 // Load mm error fix script if not already loaded. 167 if ( ! wp_script_is( 'podcast-player-mmerrorfix' ) && $this->has_mediaelement() ) { 168 $this->enqueue_mm_error_fix( true ); 169 $this->move_mm_errorfix_to_top(); 170 } 171 172 // Enqueue podcast player scripts. 173 $this->enqueue_scripts(); 174 } 175 176 /** 177 * Enqueue front-end styles and scripts in elementor preview screen. 178 * 179 * @since 1.0.0 180 */ 181 public function enqueue_elementor_resources() { 182 183 // TODO: This is mostly the same function as the enqueue_resources() function. Refactor and unify. 184 // Enqueue podcast player styles. 185 $this->enqueue_styles(); 186 187 // Load mm error fix script if not already loaded. 188 if ( ! wp_script_is( 'podcast-player-mmerrorfix' ) && $this->has_mediaelement() ) { 189 $this->enqueue_mm_error_fix( true ); 190 $this->move_mm_errorfix_to_top(); 191 } 192 193 // Enqueue podcast player scripts. 194 $this->enqueue_scripts(); 195 } 196 197 /** 198 * Register the stylesheets for the public-facing side of the site. 199 * 200 * @since 1.0.0 201 */ 202 public function enqueue_styles() { 203 wp_enqueue_style( 152 * Register podcast player front-end stylesheet. 153 * 154 * @since 8.0.0 155 */ 156 public function register_styles() { 157 wp_register_style( 204 158 'pppublic', 205 159 PODCAST_PLAYER_URL . 'frontend/css/podcast-player-public.css', … … 209 163 ); 210 164 wp_style_add_data( 'pppublic', 'rtl', 'replace' ); 165 } 166 167 /** 168 * Attempt to enqueue podcast player styles in head. 169 * 170 * @since 8.0.0 171 */ 172 public function maybe_enqueue_styles_early() { 173 if ( ! $this->should_enqueue_styles_early() ) { 174 return; 175 } 176 177 $this->enqueue_styles(); 178 } 179 180 /** 181 * Check whether podcast player styles can be enqueued early. 182 * 183 * @since 8.0.0 184 * 185 * @return bool 186 */ 187 private function should_enqueue_styles_early() { 188 189 // Never run this in admin pages. 190 if ( is_admin() ) { 191 return false; 192 } 193 194 // Respect existing customizer/Ajax conditions. 195 if ( $this->has_podcast_player() ) { 196 return true; 197 } 198 199 // Check known frontend render markers in singular content. 200 if ( is_singular() ) { 201 $post = get_queried_object(); 202 if ( $post instanceof \WP_Post && $this->has_podcast_markup( $post->post_content ) ) { 203 return true; 204 } 205 } 206 207 return false; 208 } 209 210 /** 211 * Check if content includes known podcast player markers. 212 * 213 * @since 8.0.0 214 * 215 * @param string $content Post content. 216 * @return bool 217 */ 218 private function has_podcast_markup( $content ) { 219 if ( ! is_string( $content ) || '' === $content ) { 220 return false; 221 } 222 223 // Podcast player shortcodes. 224 if ( has_shortcode( $content, 'podcastplayer' ) || has_shortcode( $content, 'showpodcastplayer' ) ) { 225 return true; 226 } 227 228 // Podcast player dynamic block. 229 if ( function_exists( 'has_block' ) && has_block( 'podcast-player/podcast-player', $content ) ) { 230 return true; 231 } 232 233 return false; 234 } 235 236 /** 237 * Enqueue podcast player front-end styles and scripts in footer. 238 * 239 * @since 1.0.0 240 */ 241 public function enqueue_resources() { 242 243 // Return if podcast player is not available on the page. 244 if ( ! $this->has_podcast_player() ) { 245 return; 246 } 247 248 // Enqueue podcast player styles. 249 $this->enqueue_styles(); 250 251 // Load mm error fix script if not already loaded. 252 if ( ! wp_script_is( 'podcast-player-mmerrorfix' ) && $this->has_mediaelement() ) { 253 $this->enqueue_mm_error_fix( true ); 254 $this->move_mm_errorfix_to_top(); 255 } 256 257 // Enqueue podcast player scripts. 258 $this->enqueue_scripts(); 259 } 260 261 /** 262 * Enqueue front-end styles and scripts in elementor preview screen. 263 * 264 * @since 1.0.0 265 */ 266 public function enqueue_elementor_resources() { 267 268 // TODO: This is mostly the same function as the enqueue_resources() function. Refactor and unify. 269 // Enqueue podcast player styles. 270 $this->enqueue_styles(); 271 272 // Load mm error fix script if not already loaded. 273 if ( ! wp_script_is( 'podcast-player-mmerrorfix' ) && $this->has_mediaelement() ) { 274 $this->enqueue_mm_error_fix( true ); 275 $this->move_mm_errorfix_to_top(); 276 } 277 278 // Enqueue podcast player scripts. 279 $this->enqueue_scripts(); 280 } 281 282 /** 283 * Register the stylesheets for the public-facing side of the site. 284 * 285 * @since 1.0.0 286 */ 287 public function enqueue_styles() { 288 if ( ! wp_style_is( 'pppublic', 'registered' ) ) { 289 $this->register_styles(); 290 } 291 wp_enqueue_style( 'pppublic' ); 211 292 } 212 293 -
podcast-player/trunk/helper/core/class-background-jobs.php
r3442200 r3462195 63 63 $identifier = wp_http_validate_url( $identifier ) ? md5( $identifier ) : $identifier; 64 64 $unique_id = substr( md5( $identifier . $task_type ), 0, 12 ); 65 $lock_token = $instance->acquire_queue_lock(); 65 66 $queue = $instance->get_tasks_queue( false ); 66 67 … … 69 70 $queue = array_slice( $queue, 0, 50 ); 70 71 $instance->set_tasks_queue( $queue ); 72 $instance->release_queue_lock( $lock_token ); 71 73 return $instance; 72 74 } … … 85 87 $instance->set_tasks_queue( $queue ); 86 88 } 89 $instance->release_queue_lock( $lock_token ); 87 90 return $instance; 88 91 } … … 94 97 */ 95 98 public function dispatch() { 99 return $this->dispatch_internal( false ); 100 } 101 102 /** 103 * Dispatch an async request to start processing the queue. 104 * 105 * @since 7.9.15 106 * 107 * @param bool $force Skip recent dispatch throttle. 108 */ 109 private function dispatch_internal( $force = false ) { 96 110 $instance = self::get_instance(); 97 if ( $ this->is_processing() || $this->is_queue_empty() || $this->recently_dispatched() ) {111 if ( $force && $this->force_dispatch_throttled() ) { 98 112 return; 99 113 } 114 if ( $this->is_processing() || $this->is_queue_empty() || ( ! $force && $this->recently_dispatched() ) ) { 115 return; 116 } 100 117 101 118 $this->set_recent_dispatch(); 119 if ( $force ) { 120 $this->set_force_dispatch(); 121 } 102 122 103 123 $url = add_query_arg( $instance->get_query_args(), $instance->get_query_url() ); … … 113 133 private function set_recent_dispatch() { 114 134 set_transient( $this->identifier . '_recent_dispatch', 1, 60 ); // 60 seconds 135 } 136 137 private function force_dispatch_throttled() { 138 return get_transient( $this->identifier . '_force_dispatch' ); 139 } 140 141 private function set_force_dispatch() { 142 $interval = apply_filters( $this->identifier . '_force_dispatch_interval', 30 ); 143 set_transient( $this->identifier . '_force_dispatch', 1, $interval ); 115 144 } 116 145 … … 236 265 sleep( 5 ); 237 266 $this->unlock_process(); 267 268 // If import tasks are pending and current task didn't error, re-dispatch to prioritize completion. 269 if ( ! $error && $this->has_pending_type( 'import_episodes' ) ) { 270 $this->dispatch_internal( true ); 271 } 238 272 } 239 273 … … 270 304 */ 271 305 private function update_tasks_queue( $task_id, $data ) { 272 $queue = $this->get_tasks_queue(); 306 $lock_token = $this->acquire_queue_lock(); 307 $queue = $this->get_tasks_queue(); 273 308 if ( ! isset( $queue[ $task_id ] ) ) { 309 $this->release_queue_lock( $lock_token ); 274 310 return; 275 311 } … … 293 329 } 294 330 $this->set_tasks_queue( $queue ); 331 $this->release_queue_lock( $lock_token ); 295 332 } 296 333 … … 304 341 private function set_tasks_queue( $tasks ) { 305 342 update_option( $this->identifier, $tasks, 'no' ); 343 } 344 345 /** 346 * Check if queue has pending task of a specific type. 347 * 348 * @param string $type Task type. 349 * @return bool 350 */ 351 private function has_pending_type( $type ) { 352 $queue = $this->get_tasks_queue( false ); 353 foreach ( $queue as $task ) { 354 if ( isset( $task['type'] ) && $type === $task['type'] ) { 355 return true; 356 } 357 } 358 return false; 306 359 } 307 360 … … 428 481 429 482 /** 483 * Acquire a short-lived queue lock to reduce race conditions. 484 * 485 * @return string|false Lock token or false if not acquired. 486 */ 487 private function acquire_queue_lock() { 488 $lock_key = $this->identifier . '_queue_lock'; 489 $token = wp_generate_uuid4(); 490 $start = microtime( true ); 491 $ttl = apply_filters( $this->identifier . '_queue_lock_ttl', 10 ); 492 493 do { 494 $current = get_transient( $lock_key ); 495 if ( empty( $current ) ) { 496 set_transient( $lock_key, $token, $ttl ); 497 if ( get_transient( $lock_key ) === $token ) { 498 return $token; 499 } 500 } 501 usleep( 20000 ); // 20ms 502 } while ( ( microtime( true ) - $start ) < 2 ); 503 504 return false; 505 } 506 507 /** 508 * Release the queue lock if owned. 509 * 510 * @param string|false $token Lock token. 511 */ 512 private function release_queue_lock( $token ) { 513 if ( ! $token ) { 514 return; 515 } 516 $lock_key = $this->identifier . '_queue_lock'; 517 $stored_t = get_transient( $lock_key ); 518 if ( $stored_t === $token ) { 519 delete_transient( $lock_key ); 520 } 521 } 522 523 /** 430 524 * Log Error Message. 431 525 * -
podcast-player/trunk/helper/feed/class-fetch-feed.php
r3300373 r3462195 510 510 $content = $link_mod->init( $content ); 511 511 } 512 return $content;512 return apply_filters( 'podcast_player_feed_episode_content', $content ); 513 513 } else { 514 514 return ''; … … 862 862 } 863 863 } else { 864 trim( (string) $links );864 return trim( (string) $links ); 865 865 } 866 866 } … … 1097 1097 */ 1098 1098 private function get_podcast_analysis( $episodes ) { 1099 if ( empty( $episodes ) ) { 1100 return array( false, 0, 0, 7 * DAY_IN_SECONDS ); 1101 } 1102 1103 $episodes = array_filter( 1104 $episodes, 1105 function ( $episode ) { 1106 return $episode instanceof ItemData; 1107 } 1108 ); 1109 if ( empty( $episodes ) ) { 1110 return array( false, 0, 0, 7 * DAY_IN_SECONDS ); 1111 } 1112 1099 1113 // Step 1: Sort episodes according to their release date. 1100 1114 usort( $episodes, function( $a, $b ) { … … 1145 1159 1146 1160 // Step 6: Calculate when the last episode was released 1147 $last_episode_release_date = end( $episodes )->get( 'date' )['date']; 1161 $last_episode = end( $episodes ); 1162 $last_episode_release_date = $last_episode ? $last_episode->get( 'date' )['date'] : 0; 1148 1163 1149 1164 // Step 7: Calculate how mamy days ago last episode was released 1150 $days_since_last_episode = ( time() - $last_episode_release_date ) / (60 * 60 * 24);1165 $days_since_last_episode = $last_episode_release_date ? ( time() - $last_episode_release_date ) / (60 * 60 * 24) : 0; 1151 1166 1152 1167 // Step 8: Check if podcast is active ( Release an episode in last 3 months ) -
podcast-player/trunk/helper/feed/class-modify-feed-data.php
r3381875 r3462195 101 101 // Get cumulative array of all available categories. 102 102 $cats = array_column( $new_items, 'categories' ); 103 $cats = array_unique( call_user_func_array( 'array_merge', $cats ) ); 103 $cats = array_filter( 104 array_map( 105 function ( $val ) { 106 return is_array( $val ) ? $val : array(); 107 }, 108 $cats 109 ) 110 ); 111 $cats = empty( $cats ) ? array() : array_unique( call_user_func_array( 'array_merge', $cats ) ); 104 112 105 113 // Sort filtered items by data or title. -
podcast-player/trunk/helper/functions/class-utility.php
r3407648 r3462195 33 33 */ 34 34 public function __construct() {} 35 36 /** 37 * Require a capability for admin-ajax actions. 38 * 39 * Call this after nonce verification in admin-ajax handlers. 40 * 41 * @since 7.9.1 42 * 43 * @param string $cap Capability required to proceed. 44 * @param string $context Optional context string for filters/logs. 45 */ 46 public static function require_capabilities( $cap = 'manage_options', $context = '' ) { 47 $cap = apply_filters( 'podcast_player_ajax_capability', $cap, $context ); 48 49 if ( ! wp_doing_ajax() ) { 50 wp_send_json_error( 51 array( 'message' => esc_html__( 'Invalid request context.', 'podcast-player' ) ), 52 400 53 ); 54 } 55 56 if ( ! is_user_logged_in() || ! current_user_can( $cap ) ) { 57 wp_send_json_error( 58 array( 'message' => esc_html__( 'Unauthorized', 'podcast-player' ) ), 59 403 60 ); 61 } 62 } 35 63 36 64 /** … … 111 139 } 112 140 141 /** 142 * Normalize a media URL for stable hashing. 143 * 144 * Strips query and fragment to reduce cache-busting noise. 145 * 146 * @since 7.9.15 147 * 148 * @param string $url Media URL. 149 * @return string Normalized URL or original if parsing fails. 150 */ 151 public static function normalize_media_url( $url ) { 152 $url = trim( (string) $url ); 153 $parts = wp_parse_url( $url ); 154 155 if ( empty( $parts ) || empty( $parts['host'] ) || empty( $parts['path'] ) ) { 156 return $url; 157 } 158 159 $scheme = isset( $parts['scheme'] ) ? $parts['scheme'] : 'https'; 160 return $scheme . '://' . $parts['host'] . $parts['path']; 161 } 113 162 114 163 /** -
podcast-player/trunk/podcast-player.php
r3442200 r3462195 15 15 * Plugin URI: https://easypodcastpro.com 16 16 * Description: Host your podcast episodes anywhere, display them only using podcast feed url. Use custom widget or shortcode to display podcast player anywhere on your site. 17 * Version: 7.9.1417 * Version: 8.0.0 18 18 * Author: vedathemes 19 19 * Author URI: https://easypodcastpro.com … … 30 30 31 31 // Currently plugin version. 32 define( 'PODCAST_PLAYER_VERSION', ' 7.9.14' );32 define( 'PODCAST_PLAYER_VERSION', '8.0.0' ); 33 33 34 34 // Define plugin constants.
Note: See TracChangeset
for help on using the changeset viewer.