Changeset 3846887
- Timestamp:
- 12/05/2026 10:23:17 PM (less than one hour ago)
- Location:
- iradeo-audio-player
- Files:
-
- 4 edited
- 1 copied
-
tags/1.5.0 (copied) (copied from iradeo-audio-player/trunk )
-
tags/1.5.0/iradeo-player.php (modified) (5 diffs)
-
tags/1.5.0/readme.txt (modified) (5 diffs)
-
trunk/iradeo-player.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
iradeo-audio-player/tags/1.5.0/iradeo-player.php
r3834417 r3846887 4 4 * Plugin URI: https://www.iradeo.com/wordpress-plugin 5 5 * Description: Hosted audio player for WordPress sermons, radio shows, school updates, and playlists. Move audio off WordPress and keep listeners on your site. 6 * Version: 1. 4.16 * Version: 1.5.0 7 7 * Author: iRadeo 8 8 * Author URI: https://www.iradeo.com … … 14 14 if ( ! defined( 'ABSPATH' ) ) exit; 15 15 16 define( 'IRADEO_PLAYER_VERSION', '1. 4.1' );16 define( 'IRADEO_PLAYER_VERSION', '1.5.0' ); 17 17 18 18 function iradeo_setup_url( $medium = 'plugin_admin' ) { … … 209 209 210 210 // ─── Settings and onboarding ───────────────────────────────────────────────── 211 function iradeo_sanitize_api_key( $value ) { 212 $cleaned = is_scalar( $value ) ? sanitize_text_field( wp_unslash( (string) $value ) ) : ''; 213 $cleaned = trim( $cleaned ); 214 if ( $cleaned !== '' && get_option( 'iradeo_auto_audio_posts', null ) === null ) { 215 update_option( 'iradeo_auto_audio_posts', '1' ); 216 } 217 return $cleaned; 218 } 219 220 function iradeo_sanitize_checkbox( $value ) { 221 return ( ! empty( $value ) && (string) $value !== '0' ) ? '1' : '0'; 222 } 223 211 224 function iradeo_register_settings() { 212 225 register_setting( 'iradeo_player_settings', 'iradeo_default_station_id', 'iradeo_sanitize_default_station_id' ); 226 register_setting( 'iradeo_player_settings', 'iradeo_api_key', 'iradeo_sanitize_api_key' ); 227 register_setting( 'iradeo_player_settings', 'iradeo_auto_audio_posts', 'iradeo_sanitize_checkbox' ); 213 228 } 214 229 add_action( 'admin_init', 'iradeo_register_settings' ); … … 306 321 <input type="text" id="iradeo_default_station_id" name="iradeo_default_station_id" value="<?php echo esc_attr( $station_id ); ?>" class="regular-text" placeholder="Paste embed code, player link, or station number"> 307 322 <p class="description">Copy the embed code from the screen shown right after signup and paste it here. Once saved, you can use <code>[iradeo]</code> anywhere on your site.</p> 308 <?php submit_button( 'Save player' ); ?> 323 324 <hr style="margin:20px 0;"> 325 <h2 style="margin-top:0;">Audio for every post</h2> 326 <?php 327 $api_key = trim( (string) get_option( 'iradeo_api_key', '' ) ); 328 $auto_enabled = get_option( 'iradeo_auto_audio_posts', $api_key !== '' ? '1' : '0' ); 329 $ap_status = get_option( 'iradeo_audio_posts_status', array() ); 330 ?> 331 <label for="iradeo_api_key" style="display:block;font-weight:600;margin-bottom:6px;">API key</label> 332 <input type="password" id="iradeo_api_key" name="iradeo_api_key" value="<?php echo esc_attr( $api_key ); ?>" class="regular-text" placeholder="ir_ap_..." autocomplete="off"> 333 <p class="description">Create an API key under <a href="https://www.iradeo.com/account/audio-posts" target="_blank" rel="noopener">Account → Audio Posts</a>. Free includes 5 posts/month; Audio Pro is $12/month for 50 posts/month.</p> 334 335 <label style="display:block;margin-top:12px;"> 336 <input type="checkbox" name="iradeo_auto_audio_posts" value="1" <?php checked( $auto_enabled, '1' ); ?>> 337 Generate audio when I publish a post 338 </label> 339 340 <?php if ( is_array( $ap_status ) && ! empty( $ap_status['feed_url'] ) ) : ?> 341 <p style="margin-top:12px;"> 342 <strong>Podcast feed:</strong> <a href="<?php echo esc_url( $ap_status['feed_url'] ); ?>" target="_blank" rel="noopener"><?php echo esc_html( $ap_status['feed_url'] ); ?></a><br> 343 <?php if ( isset( $ap_status['used_this_month'] ) && isset( $ap_status['monthly_quota'] ) ) : ?> 344 <strong>Monthly usage:</strong> <?php echo esc_html( intval( $ap_status['used_this_month'] ) . ' / ' . intval( $ap_status['monthly_quota'] ) . ' posts' ); ?> 345 <?php endif; ?> 346 </p> 347 <?php endif; ?> 348 349 <?php submit_button( 'Save settings' ); ?> 309 350 </form> 310 351 … … 412 453 } 413 454 add_action( 'admin_init', 'iradeo_dismiss_notice' ); 455 456 457 // ─── Audio for every post (1.5.0) ───────────────────────────────────────────── 458 function iradeo_generate_audio_for_post( $post_id ) { 459 $api_key = trim( (string) get_option( 'iradeo_api_key', '' ) ); 460 if ( $api_key === '' ) { 461 return false; 462 } 463 464 $post = get_post( $post_id ); 465 if ( ! $post || $post->post_type !== 'post' ) { 466 return false; 467 } 468 469 $raw_content = isset( $post->post_content ) ? (string) $post->post_content : ''; 470 if ( function_exists( 'strip_shortcodes' ) ) { 471 $raw_content = strip_shortcodes( $raw_content ); 472 } 473 $clean_content = trim( preg_replace( '/\s+/u', ' ', wp_strip_all_tags( $raw_content ) ) ); 474 if ( $clean_content === '' ) { 475 return false; 476 } 477 478 $payload = array( 479 'title' => wp_strip_all_tags( (string) $post->post_title ), 480 'url' => get_permalink( $post_id ), 481 'content' => function_exists( 'mb_substr' ) ? mb_substr( $clean_content, 0, 6000, 'UTF-8' ) : substr( $clean_content, 0, 6000 ), 482 ); 483 484 $response = wp_remote_post( 485 'https://www.iradeo.com/api/audio-posts', 486 array( 487 'timeout' => 20, 488 'headers' => array( 489 'Authorization' => 'Bearer ' . $api_key, 490 'Content-Type' => 'application/json', 491 ), 492 'body' => wp_json_encode( $payload ), 493 ) 494 ); 495 496 if ( is_wp_error( $response ) ) { 497 error_log( 'iRadeo audio-posts error for post ' . intval( $post_id ) . ': ' . $response->get_error_message() ); 498 return false; 499 } 500 501 $code = (int) wp_remote_retrieve_response_code( $response ); 502 $body = json_decode( wp_remote_retrieve_body( $response ), true ); 503 if ( $code !== 200 || ! is_array( $body ) || empty( $body['audio_url'] ) ) { 504 error_log( 'iRadeo audio-posts HTTP ' . $code . ' for post ' . intval( $post_id ) ); 505 return false; 506 } 507 508 update_post_meta( $post_id, '_iradeo_audio_url', esc_url_raw( $body['audio_url'] ) ); 509 if ( ! empty( $body['player_url'] ) ) { 510 update_post_meta( $post_id, '_iradeo_player_url', esc_url_raw( $body['player_url'] ) ); 511 } 512 if ( isset( $body['duration_seconds'] ) ) { 513 update_post_meta( $post_id, '_iradeo_duration_seconds', intval( $body['duration_seconds'] ) ); 514 } 515 516 $status = array(); 517 if ( ! empty( $body['feed_url'] ) ) { 518 $status['feed_url'] = esc_url_raw( $body['feed_url'] ); 519 } 520 if ( isset( $body['used_this_month'] ) ) { 521 $status['used_this_month'] = intval( $body['used_this_month'] ); 522 } 523 if ( isset( $body['monthly_quota'] ) ) { 524 $status['monthly_quota'] = intval( $body['monthly_quota'] ); 525 } 526 if ( ! empty( $status ) ) { 527 update_option( 'iradeo_audio_posts_status', $status ); 528 } 529 530 return true; 531 } 532 533 function iradeo_on_publish_post( $post_id, $post ) { 534 if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) { 535 return; 536 } 537 if ( ! $post || $post->post_type !== 'post' ) { 538 return; 539 } 540 if ( trim( (string) get_option( 'iradeo_api_key', '' ) ) === '' ) { 541 return; 542 } 543 if ( get_option( 'iradeo_auto_audio_posts', '1' ) !== '1' ) { 544 return; 545 } 546 547 iradeo_generate_audio_for_post( $post_id ); 548 } 549 add_action( 'publish_post', 'iradeo_on_publish_post', 10, 2 ); 550 551 function iradeo_add_post_meta_box() { 552 if ( trim( (string) get_option( 'iradeo_api_key', '' ) ) === '' ) { 553 return; 554 } 555 add_meta_box( 556 'iradeo_audio_post_box', 557 'iRadeo Audio', 558 'iradeo_render_post_meta_box', 559 'post', 560 'side', 561 'default' 562 ); 563 } 564 add_action( 'add_meta_boxes', 'iradeo_add_post_meta_box' ); 565 566 function iradeo_render_post_meta_box( $post ) { 567 $audio_url = get_post_meta( $post->ID, '_iradeo_audio_url', true ); 568 $gen_url = wp_nonce_url( 569 admin_url( 'admin-post.php?action=iradeo_generate_audio&post_id=' . intval( $post->ID ) ), 570 'iradeo_generate_audio_' . intval( $post->ID ) 571 ); 572 if ( $audio_url ) { 573 echo '<p style="margin:0 0 8px;">Audio ready for this post.</p>'; 574 echo '<p style="margin:0 0 10px;"><audio controls preload="none" src="' . esc_url( $audio_url ) . '" style="width:100%;"></audio></p>'; 575 } else { 576 echo '<p style="margin:0 0 10px;">No audio generated yet for this post.</p>'; 577 } 578 echo '<a class="button button-secondary" href="' . esc_url( $gen_url ) . '">Generate audio</a>'; 579 } 580 581 function iradeo_handle_manual_generate_audio() { 582 $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; 583 if ( $post_id <= 0 || ! current_user_can( 'edit_post', $post_id ) ) { 584 wp_die( 'Permission denied.' ); 585 } 586 check_admin_referer( 'iradeo_generate_audio_' . $post_id ); 587 588 iradeo_generate_audio_for_post( $post_id ); 589 wp_safe_redirect( get_edit_post_link( $post_id, 'raw' ) ); 590 exit; 591 } 592 add_action( 'admin_post_iradeo_generate_audio', 'iradeo_handle_manual_generate_audio' ); 593 594 function iradeo_prepend_post_player( $content ) { 595 if ( is_admin() || ! is_singular( 'post' ) || ! in_the_loop() || ! is_main_query() ) { 596 return $content; 597 } 598 599 $post_id = get_the_ID(); 600 $player_url = $post_id ? get_post_meta( $post_id, '_iradeo_player_url', true ) : ''; 601 $audio_url = $post_id ? get_post_meta( $post_id, '_iradeo_audio_url', true ) : ''; 602 603 if ( empty( $player_url ) && empty( $audio_url ) ) { 604 return $content; 605 } 606 607 if ( ! empty( $player_url ) ) { 608 $player_html = sprintf( 609 '<div class="iradeo-post-audio" style="margin:0 0 20px;"><iframe width="100%%" height="106" src="%s" allow="autoplay" style="display:block;max-width:100%%;border:0;overflow:hidden;"></iframe></div>', 610 esc_url( $player_url ) 611 ); 612 } else { 613 $player_html = sprintf( 614 '<div class="iradeo-post-audio" style="margin:0 0 20px;"><audio controls preload="metadata" src="%s" style="width:100%%;"></audio></div>', 615 esc_url( $audio_url ) 616 ); 617 } 618 619 return $player_html . $content; 620 } 621 add_filter( 'the_content', 'iradeo_prepend_post_player', 8 ); -
iradeo-audio-player/tags/1.5.0/readme.txt
r3834417 r3846887 1 1 === iRadeo Audio Player === 2 2 Contributors: cakkineni 3 Tags: audio player, sermon player, church audio, embed audio, radio player, podcast player, audio hosting, radio streaming, mp3player3 Tags: sermon player, church audio, audio player, embed audio, radio player 4 4 Requires at least: 5.3 5 5 Tested up to: 7.1 6 Stable tag: 1. 4.16 Stable tag: 1.5.0 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 9 10 Hosted audio player for WordPress sermons, radio shows, school updates, and playlists. Move audio off WordPress and keep listeners on your site.10 Church sermon & hosted audio player for WordPress. Embed playlists, weekly messages, or radio shows without slowing down your site. 11 11 12 12 == Description == … … 106 106 == Frequently Asked Questions == 107 107 108 = Is iRadeo different from the built-in WordPress audio block? = 109 110 Yes — fundamentally. The built-in audio block plays one file that your server hosts and your hosting plan pays to deliver. iRadeo hosts the audio externally, serves a full playlist player, and tracks play counts — your server sees no audio load at all. It's the difference between attaching a file and embedding a hosted station. 111 112 = Does the player keep listeners on my website? = 113 114 Yes. The player loads inside an iframe on your own WordPress page — your visitors never navigate away to listen. Your site traffic stays accurate, your brand stays consistent, and your congregation or audience stays where you put them. 115 116 = Can I use this as a church sermon archive? = 117 118 Yes. Upload each sermon to iRadeo and the platform assembles them into a hosted, ordered playlist. Add `[iradeo]` to your church website's Sermons page and the full archive appears automatically — no manual list to maintain, no file management on your server. 119 120 = Where do I find my embed code or player link? = 121 122 After [signing up for a free trial](https://www.iradeo.com/signup-cc-v2/email?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_install_setup) (no credit card required), your embed code appears on the screen shown right after signup. Paste your embed code or player link under **Settings > iRadeo Player** and any editor on your site can use `[iradeo]` without needing to remember a number. 123 124 = What plans are available and what do they include? = 125 126 The plugin is free to install. Audio hosting plans: 108 = How do I add sermon audio to my church website in WordPress? = 109 110 Install and activate **iRadeo Audio Player**, create a free 14-day trial station at iRadeo (no credit card required), upload your Sunday sermons, and paste your embed code or player link under **Settings > iRadeo Player**. Then add `[iradeo]` (or the **iRadeo Audio Player** Gutenberg block) to your church's Sermons page. Whenever you upload a new sermon to iRadeo, your WordPress page updates automatically. 111 112 = How do I put an MP3 on a WordPress page without slowing it down? = 113 114 Uploading large MP3s into the WordPress Media Library makes your own web server deliver every listen, which uses hosting bandwidth and slows down page loads. With iRadeo, your MP3 files are hosted and streamed externally while only a lightweight player iframe loads on your WordPress page. 115 116 = Do I need an iRadeo account to use the plugin? = 117 118 Yes — the WordPress plugin connects to your hosted iRadeo audio station so iRadeo handles storage, streaming, playlists, and play analytics. You can [start a 14-day free trial with no credit card required](https://www.iradeo.com/signup-cc-v2/email?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_install_setup). 119 120 = How much does it cost? = 121 122 The WordPress plugin is free. Hosted audio plans start at **$10/month** after a **14-day free trial (no credit card required)**: 127 123 128 124 * **Plus ($10/month):** 1 station, 2GB audio storage, embeddable player, listener analytics. … … 130 126 * **Ultimate ($30/month):** Unlimited players, 100GB audio storage, white-label branding, priority support. 131 127 128 [See full plan details.](https://www.iradeo.com/pricing?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_pricing) 129 130 = Is iRadeo different from the built-in WordPress audio block? = 131 132 Yes — fundamentally. The built-in audio block plays one file that your server hosts and your hosting plan pays to deliver. iRadeo hosts the audio externally, serves a full playlist player, and tracks play counts — your server sees no audio load at all. It's the difference between attaching a file and embedding a hosted station. 133 134 = Does the player keep listeners on my website? = 135 136 Yes. The player loads inside an iframe on your own WordPress page — your visitors never navigate away to listen. Your site traffic stays accurate, your brand stays consistent, and your congregation or audience stays where you put them. 137 138 = Can I use this as a church sermon archive? = 139 140 Yes. Upload each sermon to iRadeo and the platform assembles them into a hosted, ordered playlist. Add `[iradeo]` to your church website's Sermons page and the full archive appears automatically — no manual list to maintain, no file management on your server. 141 142 = Where do I find my embed code or player link? = 143 144 After [signing up for a free trial](https://www.iradeo.com/signup-cc-v2/email?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_install_setup) (no credit card required), your embed code appears on the screen shown right after signup. Paste your embed code or player link under **Settings > iRadeo Player** and any editor on your site can use `[iradeo]` without needing to remember a number. 145 146 = What plans are available and what do they include? = 147 148 The plugin is free to install. Audio hosting plans: 149 150 * **Plus ($10/month):** 1 station, 2GB audio storage, embeddable player, listener analytics. 151 * **Premium ($20/month):** 10 embeddable players, 15GB audio storage, AI voice announcements, advanced analytics. 152 * **Ultimate ($30/month):** Unlimited players, 100GB audio storage, white-label branding, priority support. 153 132 154 All plans start with a free trial — no credit card required. [See full plan details.](https://www.iradeo.com/pricing?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_pricing) 133 155 … … 148 170 This plugin connects to **iRadeo** (https://www.iradeo.com), a third-party audio hosting and streaming service operated by iRadeo. 149 171 150 **What it does:** When a page containing the iRadeo shortcode or block is loaded, the plugin embeds an iframe that loads the iRadeo audio player from `https://www.iradeo.com/station/player/`. 151 152 **What data is sent:** The station ID you provide in the shortcode or block is included in the iframe URL. No visitor personal data (IP address, cookies, user account data) is sent by this plugin — any such data handling is governed by iRadeo's own privacy policy. 153 154 **When it is sent:** Every time a page or post containing the iRadeo player is rendered and viewed in a browser. 172 **1. Embedded audio player:** When a page containing the iRadeo shortcode, block, or post audio player is loaded, the plugin embeds an iframe that loads the iRadeo player from `https://www.iradeo.com/station/player/` or `https://www.iradeo.com/audio-posts/player/`. No visitor personal data is sent by this plugin — any such data handling is governed by iRadeo's own privacy policy. 173 174 **2. Audio for every post (optional, requires your API key):** When you save an API key under **Settings > iRadeo Player** and publish a post (or click **Generate audio** in the post editor), the plugin sends the post's title, permalink URL, and plain-text content (HTML stripped) to `https://www.iradeo.com/api/audio-posts` to generate a hosted MP3 and add the episode to your site's podcast RSS feed. Free accounts include 5 posts/month (with a small iRadeo player credit); Audio Pro is $12/month for 50 posts/month with no player credit, a hosted podcast feed, and play analytics. 155 175 156 176 **Service links:** … … 161 181 162 182 == Changelog == 183 184 = 1.5.0 = 185 * Added Audio for Every Post: enter your iRadeo API key in Settings > iRadeo Player to automatically generate spoken audio on post publish (and via a "Generate audio" button in the post editor) 186 * Prepends an inline audio player to the top of posts that have generated audio 187 * Displays your hosted podcast RSS feed URL and monthly post quota in Settings > iRadeo Player 163 188 164 189 = 1.4.1 = -
iradeo-audio-player/trunk/iradeo-player.php
r3834417 r3846887 4 4 * Plugin URI: https://www.iradeo.com/wordpress-plugin 5 5 * Description: Hosted audio player for WordPress sermons, radio shows, school updates, and playlists. Move audio off WordPress and keep listeners on your site. 6 * Version: 1. 4.16 * Version: 1.5.0 7 7 * Author: iRadeo 8 8 * Author URI: https://www.iradeo.com … … 14 14 if ( ! defined( 'ABSPATH' ) ) exit; 15 15 16 define( 'IRADEO_PLAYER_VERSION', '1. 4.1' );16 define( 'IRADEO_PLAYER_VERSION', '1.5.0' ); 17 17 18 18 function iradeo_setup_url( $medium = 'plugin_admin' ) { … … 209 209 210 210 // ─── Settings and onboarding ───────────────────────────────────────────────── 211 function iradeo_sanitize_api_key( $value ) { 212 $cleaned = is_scalar( $value ) ? sanitize_text_field( wp_unslash( (string) $value ) ) : ''; 213 $cleaned = trim( $cleaned ); 214 if ( $cleaned !== '' && get_option( 'iradeo_auto_audio_posts', null ) === null ) { 215 update_option( 'iradeo_auto_audio_posts', '1' ); 216 } 217 return $cleaned; 218 } 219 220 function iradeo_sanitize_checkbox( $value ) { 221 return ( ! empty( $value ) && (string) $value !== '0' ) ? '1' : '0'; 222 } 223 211 224 function iradeo_register_settings() { 212 225 register_setting( 'iradeo_player_settings', 'iradeo_default_station_id', 'iradeo_sanitize_default_station_id' ); 226 register_setting( 'iradeo_player_settings', 'iradeo_api_key', 'iradeo_sanitize_api_key' ); 227 register_setting( 'iradeo_player_settings', 'iradeo_auto_audio_posts', 'iradeo_sanitize_checkbox' ); 213 228 } 214 229 add_action( 'admin_init', 'iradeo_register_settings' ); … … 306 321 <input type="text" id="iradeo_default_station_id" name="iradeo_default_station_id" value="<?php echo esc_attr( $station_id ); ?>" class="regular-text" placeholder="Paste embed code, player link, or station number"> 307 322 <p class="description">Copy the embed code from the screen shown right after signup and paste it here. Once saved, you can use <code>[iradeo]</code> anywhere on your site.</p> 308 <?php submit_button( 'Save player' ); ?> 323 324 <hr style="margin:20px 0;"> 325 <h2 style="margin-top:0;">Audio for every post</h2> 326 <?php 327 $api_key = trim( (string) get_option( 'iradeo_api_key', '' ) ); 328 $auto_enabled = get_option( 'iradeo_auto_audio_posts', $api_key !== '' ? '1' : '0' ); 329 $ap_status = get_option( 'iradeo_audio_posts_status', array() ); 330 ?> 331 <label for="iradeo_api_key" style="display:block;font-weight:600;margin-bottom:6px;">API key</label> 332 <input type="password" id="iradeo_api_key" name="iradeo_api_key" value="<?php echo esc_attr( $api_key ); ?>" class="regular-text" placeholder="ir_ap_..." autocomplete="off"> 333 <p class="description">Create an API key under <a href="https://www.iradeo.com/account/audio-posts" target="_blank" rel="noopener">Account → Audio Posts</a>. Free includes 5 posts/month; Audio Pro is $12/month for 50 posts/month.</p> 334 335 <label style="display:block;margin-top:12px;"> 336 <input type="checkbox" name="iradeo_auto_audio_posts" value="1" <?php checked( $auto_enabled, '1' ); ?>> 337 Generate audio when I publish a post 338 </label> 339 340 <?php if ( is_array( $ap_status ) && ! empty( $ap_status['feed_url'] ) ) : ?> 341 <p style="margin-top:12px;"> 342 <strong>Podcast feed:</strong> <a href="<?php echo esc_url( $ap_status['feed_url'] ); ?>" target="_blank" rel="noopener"><?php echo esc_html( $ap_status['feed_url'] ); ?></a><br> 343 <?php if ( isset( $ap_status['used_this_month'] ) && isset( $ap_status['monthly_quota'] ) ) : ?> 344 <strong>Monthly usage:</strong> <?php echo esc_html( intval( $ap_status['used_this_month'] ) . ' / ' . intval( $ap_status['monthly_quota'] ) . ' posts' ); ?> 345 <?php endif; ?> 346 </p> 347 <?php endif; ?> 348 349 <?php submit_button( 'Save settings' ); ?> 309 350 </form> 310 351 … … 412 453 } 413 454 add_action( 'admin_init', 'iradeo_dismiss_notice' ); 455 456 457 // ─── Audio for every post (1.5.0) ───────────────────────────────────────────── 458 function iradeo_generate_audio_for_post( $post_id ) { 459 $api_key = trim( (string) get_option( 'iradeo_api_key', '' ) ); 460 if ( $api_key === '' ) { 461 return false; 462 } 463 464 $post = get_post( $post_id ); 465 if ( ! $post || $post->post_type !== 'post' ) { 466 return false; 467 } 468 469 $raw_content = isset( $post->post_content ) ? (string) $post->post_content : ''; 470 if ( function_exists( 'strip_shortcodes' ) ) { 471 $raw_content = strip_shortcodes( $raw_content ); 472 } 473 $clean_content = trim( preg_replace( '/\s+/u', ' ', wp_strip_all_tags( $raw_content ) ) ); 474 if ( $clean_content === '' ) { 475 return false; 476 } 477 478 $payload = array( 479 'title' => wp_strip_all_tags( (string) $post->post_title ), 480 'url' => get_permalink( $post_id ), 481 'content' => function_exists( 'mb_substr' ) ? mb_substr( $clean_content, 0, 6000, 'UTF-8' ) : substr( $clean_content, 0, 6000 ), 482 ); 483 484 $response = wp_remote_post( 485 'https://www.iradeo.com/api/audio-posts', 486 array( 487 'timeout' => 20, 488 'headers' => array( 489 'Authorization' => 'Bearer ' . $api_key, 490 'Content-Type' => 'application/json', 491 ), 492 'body' => wp_json_encode( $payload ), 493 ) 494 ); 495 496 if ( is_wp_error( $response ) ) { 497 error_log( 'iRadeo audio-posts error for post ' . intval( $post_id ) . ': ' . $response->get_error_message() ); 498 return false; 499 } 500 501 $code = (int) wp_remote_retrieve_response_code( $response ); 502 $body = json_decode( wp_remote_retrieve_body( $response ), true ); 503 if ( $code !== 200 || ! is_array( $body ) || empty( $body['audio_url'] ) ) { 504 error_log( 'iRadeo audio-posts HTTP ' . $code . ' for post ' . intval( $post_id ) ); 505 return false; 506 } 507 508 update_post_meta( $post_id, '_iradeo_audio_url', esc_url_raw( $body['audio_url'] ) ); 509 if ( ! empty( $body['player_url'] ) ) { 510 update_post_meta( $post_id, '_iradeo_player_url', esc_url_raw( $body['player_url'] ) ); 511 } 512 if ( isset( $body['duration_seconds'] ) ) { 513 update_post_meta( $post_id, '_iradeo_duration_seconds', intval( $body['duration_seconds'] ) ); 514 } 515 516 $status = array(); 517 if ( ! empty( $body['feed_url'] ) ) { 518 $status['feed_url'] = esc_url_raw( $body['feed_url'] ); 519 } 520 if ( isset( $body['used_this_month'] ) ) { 521 $status['used_this_month'] = intval( $body['used_this_month'] ); 522 } 523 if ( isset( $body['monthly_quota'] ) ) { 524 $status['monthly_quota'] = intval( $body['monthly_quota'] ); 525 } 526 if ( ! empty( $status ) ) { 527 update_option( 'iradeo_audio_posts_status', $status ); 528 } 529 530 return true; 531 } 532 533 function iradeo_on_publish_post( $post_id, $post ) { 534 if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) { 535 return; 536 } 537 if ( ! $post || $post->post_type !== 'post' ) { 538 return; 539 } 540 if ( trim( (string) get_option( 'iradeo_api_key', '' ) ) === '' ) { 541 return; 542 } 543 if ( get_option( 'iradeo_auto_audio_posts', '1' ) !== '1' ) { 544 return; 545 } 546 547 iradeo_generate_audio_for_post( $post_id ); 548 } 549 add_action( 'publish_post', 'iradeo_on_publish_post', 10, 2 ); 550 551 function iradeo_add_post_meta_box() { 552 if ( trim( (string) get_option( 'iradeo_api_key', '' ) ) === '' ) { 553 return; 554 } 555 add_meta_box( 556 'iradeo_audio_post_box', 557 'iRadeo Audio', 558 'iradeo_render_post_meta_box', 559 'post', 560 'side', 561 'default' 562 ); 563 } 564 add_action( 'add_meta_boxes', 'iradeo_add_post_meta_box' ); 565 566 function iradeo_render_post_meta_box( $post ) { 567 $audio_url = get_post_meta( $post->ID, '_iradeo_audio_url', true ); 568 $gen_url = wp_nonce_url( 569 admin_url( 'admin-post.php?action=iradeo_generate_audio&post_id=' . intval( $post->ID ) ), 570 'iradeo_generate_audio_' . intval( $post->ID ) 571 ); 572 if ( $audio_url ) { 573 echo '<p style="margin:0 0 8px;">Audio ready for this post.</p>'; 574 echo '<p style="margin:0 0 10px;"><audio controls preload="none" src="' . esc_url( $audio_url ) . '" style="width:100%;"></audio></p>'; 575 } else { 576 echo '<p style="margin:0 0 10px;">No audio generated yet for this post.</p>'; 577 } 578 echo '<a class="button button-secondary" href="' . esc_url( $gen_url ) . '">Generate audio</a>'; 579 } 580 581 function iradeo_handle_manual_generate_audio() { 582 $post_id = isset( $_GET['post_id'] ) ? intval( $_GET['post_id'] ) : 0; 583 if ( $post_id <= 0 || ! current_user_can( 'edit_post', $post_id ) ) { 584 wp_die( 'Permission denied.' ); 585 } 586 check_admin_referer( 'iradeo_generate_audio_' . $post_id ); 587 588 iradeo_generate_audio_for_post( $post_id ); 589 wp_safe_redirect( get_edit_post_link( $post_id, 'raw' ) ); 590 exit; 591 } 592 add_action( 'admin_post_iradeo_generate_audio', 'iradeo_handle_manual_generate_audio' ); 593 594 function iradeo_prepend_post_player( $content ) { 595 if ( is_admin() || ! is_singular( 'post' ) || ! in_the_loop() || ! is_main_query() ) { 596 return $content; 597 } 598 599 $post_id = get_the_ID(); 600 $player_url = $post_id ? get_post_meta( $post_id, '_iradeo_player_url', true ) : ''; 601 $audio_url = $post_id ? get_post_meta( $post_id, '_iradeo_audio_url', true ) : ''; 602 603 if ( empty( $player_url ) && empty( $audio_url ) ) { 604 return $content; 605 } 606 607 if ( ! empty( $player_url ) ) { 608 $player_html = sprintf( 609 '<div class="iradeo-post-audio" style="margin:0 0 20px;"><iframe width="100%%" height="106" src="%s" allow="autoplay" style="display:block;max-width:100%%;border:0;overflow:hidden;"></iframe></div>', 610 esc_url( $player_url ) 611 ); 612 } else { 613 $player_html = sprintf( 614 '<div class="iradeo-post-audio" style="margin:0 0 20px;"><audio controls preload="metadata" src="%s" style="width:100%%;"></audio></div>', 615 esc_url( $audio_url ) 616 ); 617 } 618 619 return $player_html . $content; 620 } 621 add_filter( 'the_content', 'iradeo_prepend_post_player', 8 ); -
iradeo-audio-player/trunk/readme.txt
r3834417 r3846887 1 1 === iRadeo Audio Player === 2 2 Contributors: cakkineni 3 Tags: audio player, sermon player, church audio, embed audio, radio player, podcast player, audio hosting, radio streaming, mp3player3 Tags: sermon player, church audio, audio player, embed audio, radio player 4 4 Requires at least: 5.3 5 5 Tested up to: 7.1 6 Stable tag: 1. 4.16 Stable tag: 1.5.0 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 9 10 Hosted audio player for WordPress sermons, radio shows, school updates, and playlists. Move audio off WordPress and keep listeners on your site.10 Church sermon & hosted audio player for WordPress. Embed playlists, weekly messages, or radio shows without slowing down your site. 11 11 12 12 == Description == … … 106 106 == Frequently Asked Questions == 107 107 108 = Is iRadeo different from the built-in WordPress audio block? = 109 110 Yes — fundamentally. The built-in audio block plays one file that your server hosts and your hosting plan pays to deliver. iRadeo hosts the audio externally, serves a full playlist player, and tracks play counts — your server sees no audio load at all. It's the difference between attaching a file and embedding a hosted station. 111 112 = Does the player keep listeners on my website? = 113 114 Yes. The player loads inside an iframe on your own WordPress page — your visitors never navigate away to listen. Your site traffic stays accurate, your brand stays consistent, and your congregation or audience stays where you put them. 115 116 = Can I use this as a church sermon archive? = 117 118 Yes. Upload each sermon to iRadeo and the platform assembles them into a hosted, ordered playlist. Add `[iradeo]` to your church website's Sermons page and the full archive appears automatically — no manual list to maintain, no file management on your server. 119 120 = Where do I find my embed code or player link? = 121 122 After [signing up for a free trial](https://www.iradeo.com/signup-cc-v2/email?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_install_setup) (no credit card required), your embed code appears on the screen shown right after signup. Paste your embed code or player link under **Settings > iRadeo Player** and any editor on your site can use `[iradeo]` without needing to remember a number. 123 124 = What plans are available and what do they include? = 125 126 The plugin is free to install. Audio hosting plans: 108 = How do I add sermon audio to my church website in WordPress? = 109 110 Install and activate **iRadeo Audio Player**, create a free 14-day trial station at iRadeo (no credit card required), upload your Sunday sermons, and paste your embed code or player link under **Settings > iRadeo Player**. Then add `[iradeo]` (or the **iRadeo Audio Player** Gutenberg block) to your church's Sermons page. Whenever you upload a new sermon to iRadeo, your WordPress page updates automatically. 111 112 = How do I put an MP3 on a WordPress page without slowing it down? = 113 114 Uploading large MP3s into the WordPress Media Library makes your own web server deliver every listen, which uses hosting bandwidth and slows down page loads. With iRadeo, your MP3 files are hosted and streamed externally while only a lightweight player iframe loads on your WordPress page. 115 116 = Do I need an iRadeo account to use the plugin? = 117 118 Yes — the WordPress plugin connects to your hosted iRadeo audio station so iRadeo handles storage, streaming, playlists, and play analytics. You can [start a 14-day free trial with no credit card required](https://www.iradeo.com/signup-cc-v2/email?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_install_setup). 119 120 = How much does it cost? = 121 122 The WordPress plugin is free. Hosted audio plans start at **$10/month** after a **14-day free trial (no credit card required)**: 127 123 128 124 * **Plus ($10/month):** 1 station, 2GB audio storage, embeddable player, listener analytics. … … 130 126 * **Ultimate ($30/month):** Unlimited players, 100GB audio storage, white-label branding, priority support. 131 127 128 [See full plan details.](https://www.iradeo.com/pricing?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_pricing) 129 130 = Is iRadeo different from the built-in WordPress audio block? = 131 132 Yes — fundamentally. The built-in audio block plays one file that your server hosts and your hosting plan pays to deliver. iRadeo hosts the audio externally, serves a full playlist player, and tracks play counts — your server sees no audio load at all. It's the difference between attaching a file and embedding a hosted station. 133 134 = Does the player keep listeners on my website? = 135 136 Yes. The player loads inside an iframe on your own WordPress page — your visitors never navigate away to listen. Your site traffic stays accurate, your brand stays consistent, and your congregation or audience stays where you put them. 137 138 = Can I use this as a church sermon archive? = 139 140 Yes. Upload each sermon to iRadeo and the platform assembles them into a hosted, ordered playlist. Add `[iradeo]` to your church website's Sermons page and the full archive appears automatically — no manual list to maintain, no file management on your server. 141 142 = Where do I find my embed code or player link? = 143 144 After [signing up for a free trial](https://www.iradeo.com/signup-cc-v2/email?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_install_setup) (no credit card required), your embed code appears on the screen shown right after signup. Paste your embed code or player link under **Settings > iRadeo Player** and any editor on your site can use `[iradeo]` without needing to remember a number. 145 146 = What plans are available and what do they include? = 147 148 The plugin is free to install. Audio hosting plans: 149 150 * **Plus ($10/month):** 1 station, 2GB audio storage, embeddable player, listener analytics. 151 * **Premium ($20/month):** 10 embeddable players, 15GB audio storage, AI voice announcements, advanced analytics. 152 * **Ultimate ($30/month):** Unlimited players, 100GB audio storage, white-label branding, priority support. 153 132 154 All plans start with a free trial — no credit card required. [See full plan details.](https://www.iradeo.com/pricing?utm_source=wordpress_plugin&utm_medium=readme_faq&utm_campaign=wp_pricing) 133 155 … … 148 170 This plugin connects to **iRadeo** (https://www.iradeo.com), a third-party audio hosting and streaming service operated by iRadeo. 149 171 150 **What it does:** When a page containing the iRadeo shortcode or block is loaded, the plugin embeds an iframe that loads the iRadeo audio player from `https://www.iradeo.com/station/player/`. 151 152 **What data is sent:** The station ID you provide in the shortcode or block is included in the iframe URL. No visitor personal data (IP address, cookies, user account data) is sent by this plugin — any such data handling is governed by iRadeo's own privacy policy. 153 154 **When it is sent:** Every time a page or post containing the iRadeo player is rendered and viewed in a browser. 172 **1. Embedded audio player:** When a page containing the iRadeo shortcode, block, or post audio player is loaded, the plugin embeds an iframe that loads the iRadeo player from `https://www.iradeo.com/station/player/` or `https://www.iradeo.com/audio-posts/player/`. No visitor personal data is sent by this plugin — any such data handling is governed by iRadeo's own privacy policy. 173 174 **2. Audio for every post (optional, requires your API key):** When you save an API key under **Settings > iRadeo Player** and publish a post (or click **Generate audio** in the post editor), the plugin sends the post's title, permalink URL, and plain-text content (HTML stripped) to `https://www.iradeo.com/api/audio-posts` to generate a hosted MP3 and add the episode to your site's podcast RSS feed. Free accounts include 5 posts/month (with a small iRadeo player credit); Audio Pro is $12/month for 50 posts/month with no player credit, a hosted podcast feed, and play analytics. 155 175 156 176 **Service links:** … … 161 181 162 182 == Changelog == 183 184 = 1.5.0 = 185 * Added Audio for Every Post: enter your iRadeo API key in Settings > iRadeo Player to automatically generate spoken audio on post publish (and via a "Generate audio" button in the post editor) 186 * Prepends an inline audio player to the top of posts that have generated audio 187 * Displays your hosted podcast RSS feed URL and monthly post quota in Settings > iRadeo Player 163 188 164 189 = 1.4.1 =
Note:
See TracChangeset
for help on using the changeset viewer.