Changeset 3326414
- Timestamp:
- 07/11/2025 04:30:09 PM (9 months ago)
- Location:
- voice-feedback
- Files:
-
- 121 added
- 3 deleted
- 2 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/bplugins_sdk (added)
-
tags/1.0.1/bplugins_sdk/config.json (added)
-
tags/1.0.1/bplugins_sdk/config.php (added)
-
tags/1.0.1/bplugins_sdk/dist (added)
-
tags/1.0.1/bplugins_sdk/dist/admin-notice.js (added)
-
tags/1.0.1/bplugins_sdk/dist/admin-notice.js.map (added)
-
tags/1.0.1/bplugins_sdk/dist/opt-in-form.css (added)
-
tags/1.0.1/bplugins_sdk/dist/opt-in-form.css.map (added)
-
tags/1.0.1/bplugins_sdk/dist/opt-in-form.js (added)
-
tags/1.0.1/bplugins_sdk/dist/opt-in-form.js.map (added)
-
tags/1.0.1/bplugins_sdk/inc (added)
-
tags/1.0.1/bplugins_sdk/inc/Base (added)
-
tags/1.0.1/bplugins_sdk/inc/Base/FSActivate.php (added)
-
tags/1.0.1/bplugins_sdk/inc/Base/FS_Lite.php (added)
-
tags/1.0.1/bplugins_sdk/inc/Base/Freemius_Lite.php (added)
-
tags/1.0.1/bplugins_sdk/inc/Init.php (added)
-
tags/1.0.1/bplugins_sdk/index.php (added)
-
tags/1.0.1/bplugins_sdk/init.php (added)
-
tags/1.0.1/bplugins_sdk/languages (added)
-
tags/1.0.1/bplugins_sdk/languages/bPlugins-sdk-en_US.mo (added)
-
tags/1.0.1/bplugins_sdk/languages/bPlugins-sdk-en_US.po (added)
-
tags/1.0.1/bplugins_sdk/languages/bPlugins-sdk.pot (added)
-
tags/1.0.1/bplugins_sdk/readme.txt (added)
-
tags/1.0.1/bplugins_sdk/require.php (added)
-
tags/1.0.1/bplugins_sdk/todo.txt (added)
-
tags/1.0.1/bplvf-block.php (added)
-
tags/1.0.1/build (added)
-
tags/1.0.1/build/admin-dashboard.asset.php (added)
-
tags/1.0.1/build/admin-dashboard.css (added)
-
tags/1.0.1/build/admin-dashboard.js (added)
-
tags/1.0.1/build/admin-dashboard.js.LICENSE.txt (added)
-
tags/1.0.1/build/block.json (added)
-
tags/1.0.1/build/images (added)
-
tags/1.0.1/build/images/checkerboard.af0c7e5c.png (added)
-
tags/1.0.1/build/images/layers-2x.8f2c4d11.png (added)
-
tags/1.0.1/build/images/layers.416d9136.png (added)
-
tags/1.0.1/build/images/marker-icon.2b3e1faf.png (added)
-
tags/1.0.1/build/index.asset.php (added)
-
tags/1.0.1/build/index.css (added)
-
tags/1.0.1/build/index.js (added)
-
tags/1.0.1/build/index.js.LICENSE.txt (added)
-
tags/1.0.1/build/post-columns.asset.php (added)
-
tags/1.0.1/build/post-columns.css (added)
-
tags/1.0.1/build/post-columns.js (added)
-
tags/1.0.1/build/render.php (added)
-
tags/1.0.1/build/view.asset.php (added)
-
tags/1.0.1/build/view.css (added)
-
tags/1.0.1/build/view.js (added)
-
tags/1.0.1/includes (added)
-
tags/1.0.1/includes/admin (added)
-
tags/1.0.1/includes/admin/Settings.php (added)
-
tags/1.0.1/includes/admin/admin.php (added)
-
tags/1.0.1/includes/class-bplvfAdminMenu.php (added)
-
tags/1.0.1/includes/class-bplvfVoiceFeedback.php (added)
-
tags/1.0.1/includes/functions.php (added)
-
tags/1.0.1/languages (added)
-
tags/1.0.1/languages/h5ap-en_US.mo (added)
-
tags/1.0.1/languages/h5ap-en_US.po (added)
-
tags/1.0.1/languages/h5ap.pot (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/voice-feedback.php (added)
-
trunk/assets (deleted)
-
trunk/bplugins_sdk (added)
-
trunk/bplugins_sdk/config.json (added)
-
trunk/bplugins_sdk/config.php (added)
-
trunk/bplugins_sdk/dist (added)
-
trunk/bplugins_sdk/dist/admin-notice.js (added)
-
trunk/bplugins_sdk/dist/admin-notice.js.map (added)
-
trunk/bplugins_sdk/dist/opt-in-form.css (added)
-
trunk/bplugins_sdk/dist/opt-in-form.css.map (added)
-
trunk/bplugins_sdk/dist/opt-in-form.js (added)
-
trunk/bplugins_sdk/dist/opt-in-form.js.map (added)
-
trunk/bplugins_sdk/inc (added)
-
trunk/bplugins_sdk/inc/Base (added)
-
trunk/bplugins_sdk/inc/Base/FSActivate.php (added)
-
trunk/bplugins_sdk/inc/Base/FS_Lite.php (added)
-
trunk/bplugins_sdk/inc/Base/Freemius_Lite.php (added)
-
trunk/bplugins_sdk/inc/Init.php (added)
-
trunk/bplugins_sdk/index.php (added)
-
trunk/bplugins_sdk/init.php (added)
-
trunk/bplugins_sdk/languages (added)
-
trunk/bplugins_sdk/languages/bPlugins-sdk-en_US.mo (added)
-
trunk/bplugins_sdk/languages/bPlugins-sdk-en_US.po (added)
-
trunk/bplugins_sdk/languages/bPlugins-sdk.pot (added)
-
trunk/bplugins_sdk/readme.txt (added)
-
trunk/bplugins_sdk/require.php (added)
-
trunk/bplugins_sdk/todo.txt (added)
-
trunk/bplvf-block.php (added)
-
trunk/build (added)
-
trunk/build/admin-dashboard.asset.php (added)
-
trunk/build/admin-dashboard.css (added)
-
trunk/build/admin-dashboard.js (added)
-
trunk/build/admin-dashboard.js.LICENSE.txt (added)
-
trunk/build/block.json (added)
-
trunk/build/images (added)
-
trunk/build/images/checkerboard.af0c7e5c.png (added)
-
trunk/build/images/layers-2x.8f2c4d11.png (added)
-
trunk/build/images/layers.416d9136.png (added)
-
trunk/build/images/marker-icon.2b3e1faf.png (added)
-
trunk/build/index.asset.php (added)
-
trunk/build/index.css (added)
-
trunk/build/index.js (added)
-
trunk/build/index.js.LICENSE.txt (added)
-
trunk/build/post-columns.asset.php (added)
-
trunk/build/post-columns.css (added)
-
trunk/build/post-columns.js (added)
-
trunk/build/render.php (added)
-
trunk/build/view.asset.php (added)
-
trunk/build/view.css (added)
-
trunk/build/view.js (added)
-
trunk/includes (added)
-
trunk/includes/admin (added)
-
trunk/includes/admin/Settings.php (added)
-
trunk/includes/admin/admin.php (added)
-
trunk/includes/class-bplvfAdminMenu.php (added)
-
trunk/includes/class-bplvfVoiceFeedback.php (added)
-
trunk/includes/functions.php (added)
-
trunk/languages (added)
-
trunk/languages/h5ap-en_US.mo (added)
-
trunk/languages/h5ap-en_US.po (added)
-
trunk/languages/h5ap.pot (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/voice-feedback.php (modified) (1 diff)
-
trunk/voice-recorder.css (deleted)
-
trunk/voice-recorder.js (deleted)
Legend:
- Unmodified
- Added
- Removed
-
voice-feedback/trunk/readme.txt
r3325499 r3326414 1 === Voice Feedback – Voice Recorder Pluginfor Audio Feedback ===2 Contributors: bplugins, abuhayat, shehabulislam, freemius1 === Voice Feedback – Voice Recorder for Audio Feedback === 2 Contributors: bplugins, abuhayat, shehabulislam, taninrahman, freemius 3 3 Tags: voice message, voice recording, user feedback, audio feedback 4 4 Requires at least: 6.5+ 5 Tested up to: 6.8 .16 Stable tag: 1.0. 05 Tested up to: 6.8 6 Stable tag: 1.0.1 7 7 Requires PHP: 7.1 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html 10 10 11 Let users record and send voice feedback on your WordPress site. A simple voice recorder plugin with playback, re-record, and admin voice library. 12 11 13 == Description == 14 12 15 **Voice Feedback – #1 Voice Recorder Plugin for Collecting Audio Feedback in WordPress** 16 13 17 [Voice Feedback](https://bplugins.com/products/voice-feedback/) | [Pricing](https://bplugins.com/products/voice-feedback/#pricing) | [Support](https://bplugins.com/support/) 14 https://youtu.be/Z7yfMWb4jAI 18 19 https://youtu.be/1stL_ku63FM 20 15 21 [Voice Feedback](https://bplugins.com/products/voice-feedback/) makes it easy for visitors to leave audio feedback on your WordPress site. They can simply record their voice—no login or personal details needed. 22 16 23 The plugin adds a voice recording field to your site using a floating drawer, block, or shortcode. All voice messages are saved in the admin panel, where you can listen to them, manage, or delete as needed. 24 17 25 Perfect for blogs, portfolios, education sites, product pages, or any website where collecting user feedback matters. 26 18 27 === Key Features === 28 19 29 - **Voice Recording Field for Users** – Visitors can record their voice directly from your site without needing an account. 30 20 31 - **Review Before Submit** – Users can play back their message before sending and re-record if needed. 32 21 33 - **Voice Library (Admin Panel)** – All submitted voice messages are stored in an organized dashboard. 34 22 35 - **Playback and Management** – Admins can listen to each voice recording and delete them if necessary. 36 23 37 - **Customizable UI** – Modify drawer appearance with options for typography, padding, border radius, and more. 38 24 39 - **Multiple Display Options** – Automatically shows a voice feedback drawer site-wide, or add specific instances via block or shortcode. 40 25 41 - **Lightweight and Secure** – No personal data is collected; focused only on voice-based user interaction. 42 26 43 === Embed Options === 44 27 45 - **Global Drawer Button** – Appears on all pages by default. Easily toggle on/off via the settings page. 46 28 47 - **Gutenberg Block** – Add a “Voice Feedback” block to any post or page. 48 29 49 - **Shortcode Support** – Generate shortcodes for custom placement. Create and manage them from the Voice Library menu. 50 30 51 === Settings & Controls=== 52 31 53 - Drawer visibility toggle 54 32 55 - Drawer button customization (text, padding, typography) 56 33 57 - Responsive design for mobile and desktop 58 34 59 - Easy-to-use admin interface 60 35 61 === Ideal Use Cases === 62 36 63 - Collect **user voice feedback** and suggestions 64 37 65 - Add **audio comment** or **voice comments** capability to blog posts 66 38 67 - Enable clients to send **quick voice updates** 68 39 69 - Get spoken UX feedback or testimonials 70 40 71 - Use as a **voice feedback generator** tool 72 41 73 - Receive spoken suggestions or bug reports 74 42 75 === Upcoming Features === 76 43 77 - Contact form integration with voice field 44 78 - Integration with project/task management tools 79 45 80 === Check out our other WordPress Plugins === 46 81 - [HTML5 Audio Player](https://bplugins.com/products/html5-audio-player/) – Best audio player plugin for WordPress. 82 47 83 - [PDF Poster](https://bplugins.com/products/pdf-poster/) – A fully-featured PDF Viewer Plugin for WordPress. 84 48 85 - [StreamCast](https://bplugins.com/products/streamcast-radio-player/) – A fully-featured Radio Player Plugin for WordPress. 86 49 87 - [3D Viewer](https://bplugins.com/products/3d-viewer/) – Display interactive 3D models on the webs. 88 50 89 == Installation == 90 51 91 1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install from the Plugins directory. 92 52 93 2. Activate the plugin. 94 53 95 3. A voice feedback drawer will appear automatically on your site. 96 54 97 4. Visit **Voice Library → Settings** to customize or disable the drawer. 98 55 99 5. Use the **Gutenberg block** or generate a **shortcode** from the admin to place on specific pages. 100 56 101 == Frequently Asked Questions == 102 57 103 = Does this plugin collect personal data? = 58 104 No. It only records the voice message. No name, email, or contact information is collected. 105 59 106 = Where can I access submitted recordings? = 60 107 All voice recordings are stored in the **Voice Library** admin menu, where you can play or delete them. 108 61 109 = Can I turn off the floating voice drawer? = 62 110 Yes. Go to **Voice Library → Settings** and disable the drawer with a single toggle. 111 63 112 = How do I add the voice feedback to a specific post or page? = 64 113 Use the **Voice Feedback** block in Gutenberg or copy the shortcode from **Voice Library → Voice Feedbacks**. 114 65 115 = Is it compatible with all WordPress themes? = 66 116 Yes. It works with all modern, well-coded themes. 117 67 118 == Screenshots == 119 68 120 1. Voice Feedback drawer on frontend 69 121 2. User voice recording interface … … 71 123 4. Block editor showing Voice Feedback block 72 124 5. Settings panel for customization 125 73 126 == Changelog == 127 128 = 1.0.1 = 129 * Updated with new features 130 74 131 = 1.0.0 = 75 132 * Initial release with core features: drawer, block, shortcode, admin library, and basic customization. 133 76 134 == Upgrade Notice == 135 136 = 1.0.1 = 137 Updated with new features 138 77 139 = 1.0.0 = 78 140 First release. Enables site visitors to record and submit voice feedback. -
voice-feedback/trunk/voice-feedback.php
r3325491 r3326414 1 1 <?php 2 /*3 Plugin Name: Voice Feedback4 Description: Send Voice feedback to the site admin on the go. User can embed the voice feedback form in the contact form by shortcode.5 Version: 1.06 Author: bPlugins7 License: GPL v2 or later8 Text Domain: voice-feedback9 License URI: http://www.gnu.org/licenses/gpl-2.0.txt10 */11 2 12 if (! defined('ABSPATH')) exit; // Exit if accessed directly 13 14 define('VOICE_FEEDBACK_PLUGIN_DIR', plugin_dir_path(__FILE__)); 15 define('VOICE_FEEDBACK_PLUGIN_URL', plugin_dir_url(__FILE__)); 16 define('VOICE_FEEDBACK_PLUGIN_VERSION', time()); 17 18 // Register scripts and styles 19 add_action('wp_enqueue_scripts', function () { 20 wp_register_script('wavesurfer', VOICE_FEEDBACK_PLUGIN_URL . 'assets/js/wavesurfer.min.js', [], '7.9.4', true); 21 wp_register_script('voice-feedback', plugin_dir_url(__FILE__) . 'voice-recorder.js', ['wavesurfer'], VOICE_FEEDBACK_PLUGIN_VERSION, true); 22 wp_register_style('voice-feedback-css', plugin_dir_url(__FILE__) . 'voice-recorder.css', [], VOICE_FEEDBACK_PLUGIN_VERSION); 23 24 wp_localize_script('voice-feedback', 'voiceRecorder', [ 25 'ajaxUrl' => admin_url('admin-ajax.php'), 26 'nonce' => wp_create_nonce('voice_feedback_nonce') 27 ]); 28 }); 29 30 add_shortcode('voice_feedback', function () { 31 wp_enqueue_script('voice-feedback'); 32 wp_enqueue_style('voice-feedback-css'); 33 return ' 34 <div id="voice-feedback-wrapper"> 35 <div id="waveform"></div> 36 <div class="feedback-buttons"> 37 <button id="startBtn" class="rec-btn">🎙️ Tap to Record</button> 38 <button id="stopBtn" class="rec-btn" disabled>⏹️ Stop</button> 39 <button id="playBtn" class="rec-btn" disabled>▶️ Play</button> 40 <button id="sendBtn" class="rec-btn" disabled>📤 Send</button> 41 </div> 42 <audio id="audioPlayback" controls style="display:none;"></audio> 43 </div> 44 '; 45 }); 46 47 // Handle audio upload via AJAX 48 add_action('wp_ajax_nopriv_save_audio', 'voice_feedback_handle_upload'); 49 add_action('wp_ajax_save_audio', 'voice_feedback_handle_upload'); 50 51 function voice_feedback_handle_upload() 52 { 53 if ( 54 !isset($_POST['nonce']) || 55 !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['nonce'])), 'voice_feedback_nonce') 56 ) { 57 wp_send_json_error('Invalid nonce.'); 58 } 59 60 if (!isset($_FILES['audio']) || !isset($_FILES['audio']['error']) || $_FILES['audio']['error'] !== UPLOAD_ERR_OK) { 61 wp_send_json_error('No audio file uploaded or file error.'); // Send JSON error response and exit the functio 62 } 63 64 // Include WordPress file handling functions 65 require_once ABSPATH . 'wp-admin/includes/file.php'; 66 67 68 69 70 $file = [ 71 'name' => isset($_FILES['audio']['name']) ? sanitize_file_name($_FILES['audio']['name']) : '', 72 'type' => isset($_FILES['audio']['type']) ? sanitize_text_field($_FILES['audio']['type']) : '', 73 'tmp_name' => isset($_FILES['audio']['tmp_name']) ? sanitize_text_field($_FILES['audio']['tmp_name']) : '', 74 'error' => isset($_FILES['audio']['error']) ? sanitize_text_field($_FILES['audio']['error']) : '', 75 'size' => isset($_FILES['audio']['size']) ? (int) $_FILES['audio']['size'] : 0, 76 ]; 77 78 79 // Validate MIME type (optional for added security) 80 $allowed_types = array('audio/mpeg', 'audio/wav', 'audio/mp3', 'audio/x-wav', 'video/webm', 'audio/webm'); 81 $file_type = mime_content_type($file['tmp_name']); 82 83 // wp_send_json_error([$file, $file_type]); 84 85 if (!in_array($file_type, $allowed_types, true)) { 86 wp_send_json_error('Invalid audio file type.'); 87 } 88 89 // Handle upload using WordPress API 90 $upload_overrides = array( 91 'test_form' => false, 92 'mimes' => array( 93 'webm' => 'video/webm' 94 ), 95 ); 96 97 $uploaded = wp_handle_upload($file, $upload_overrides); 98 99 if (isset($uploaded['file'])) { 100 $file_url = esc_url($uploaded['url']); 101 102 // User info 103 if (is_user_logged_in()) { 104 $current_user = wp_get_current_user(); 105 $user_info = sprintf( 106 "Username: %s\nEmail: %s\nUser ID: %d\nDisplay Name: %s", 107 $current_user->user_login, 108 $current_user->user_email, 109 $current_user->ID, 110 $current_user->display_name 111 ); 112 } else { 113 $user_info = sprintf( 114 "Guest IP: %s\nUser Agent: %s", 115 sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'] ?? 'N/A')), 116 sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'] ?? 'N/A')) 117 ); 3 /** 4 * Plugin Name: Voice Feedback 5 * Description: Send Voice feedback to the site admin on the go. User can embed the voice feedback form in the contact form by shortcode. 6 * Version: 1.0.1 7 * Author: bPlugins 8 * Author URI: https://bplugins.com 9 * License: GPLv3 10 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt 11 * Text Domain: voice-feedback 12 * @fs_free_only, bsdk_config.json, /bplugins_sdk 13 */ 14 if ( !defined( 'ABSPATH' ) ) { 15 exit; 16 } 17 // Exit if accessed directly 18 if ( function_exists( 'vf_fs' ) ) { 19 register_activation_hook( __FILE__, function () { 20 if ( is_plugin_active( 'voice_feedback/voice_feedback.php' ) ) { 21 deactivate_plugins( 'voice_feedback/voice_feedback.php' ); 22 } 23 if ( is_plugin_active( 'voice_feedback-pro/voice_feedback.php' ) ) { 24 deactivate_plugins( 'voice_feedback-pro/voice_feedback.php' ); 25 } 26 } ); 27 } else { 28 define( 'BPLVF_DIR_PATH', plugin_dir_path( __FILE__ ) ); 29 define( 'BPLVF_DIR_URL', plugin_dir_url( __FILE__ ) ); 30 define( 'BPLVF_VERSION', "1.0.1" ); 31 define( 'BPLVF_HAS_FREE', 'voice-feedback/voice-feedback.php' === plugin_basename( __FILE__ ) ); 32 define( 'BPLVF_HAS_PRO', 'voice-feedback-pro/voice-feedback.php' === plugin_basename( __FILE__ ) ); 33 if ( !function_exists( 'vf_fs' ) ) { 34 // Create a helper function for easy SDK access. 35 function vf_fs() { 36 global $vf_fs; 37 if ( !isset( $vf_fs ) ) { 38 $fsStartPath = dirname( __FILE__ ) . '/freemius/start.php'; 39 $bSDKInitPath = dirname( __FILE__ ) . '/bplugins_sdk/init.php'; 40 if ( BPLVF_HAS_PRO && file_exists( $fsStartPath ) ) { 41 require_once $fsStartPath; 42 } else { 43 if ( BPLVF_HAS_FREE && file_exists( $bSDKInitPath ) ) { 44 require_once $bSDKInitPath; 45 } 46 } 47 $bplvfConfig = [ 48 'id' => '19712', 49 'slug' => 'voice-feedback', 50 'premium_slug' => 'voice-feedback-pro', 51 'type' => 'plugin', 52 'public_key' => 'pk_e2acd90aa2e40812def1d0880deae', 53 'is_premium' => true, 54 'premium_suffix' => 'Pro', 55 'has_premium_version' => true, 56 'has_addons' => false, 57 'has_paid_plans' => true, 58 'trial' => array( 59 'days' => 7, 60 'is_require_payment' => false, 61 ), 62 'menu' => array( 63 'slug' => 'edit.php?post_type=voice_recording&page=dashboard#/settings', 64 'first-path' => 'edit.php?post_type=voice_recording&page=dashboard#/settings', 65 'support' => false, 66 ), 67 ]; 68 $vf_fs = ( BPLVF_HAS_PRO && file_exists( $fsStartPath ) ? fs_dynamic_init( $bplvfConfig ) : fs_lite_dynamic_init( $bplvfConfig ) ); 69 } 70 return $vf_fs; 118 71 } 119 72 120 // Insert custom post 121 $post_id = wp_insert_post(array( 122 'post_title' => 'Voice Recording - ' . current_time('mysql'), 123 'post_type' => 'voice_recording', 124 'post_status' => 'publish', 125 )); 126 127 if (!is_wp_error($post_id)) { 128 update_post_meta($post_id, 'voice_file_url', $file_url); 129 update_post_meta($post_id, 'voice_user_info', sanitize_textarea_field($user_info)); 130 wp_send_json_success('Audio saved and added to voice library.'); 131 } else { 132 wp_send_json_error($post_id->get_error_message()); 133 } 134 } else { 135 wp_send_json_error('Failed to upload audio.'); 73 // Init Freemius. 74 vf_fs(); 75 // Signal that SDK was initiated. 76 do_action( 'vf_fs_loaded' ); 136 77 } 137 138 wp_die(); 78 // Load Main Plugin Class 79 require_once BPLVF_DIR_PATH . 'includes/class-bplvfVoiceFeedback.php'; 80 // Initialize the plugin 81 new BPLVFVoiceFeedback(); 139 82 } 140 141 // Register custom post type142 add_action('init', function () {143 register_post_type('voice_recording', [144 'labels' => [145 'name' => 'Voice Library',146 'singular_name' => 'Voice Recording'147 ],148 'public' => false,149 'show_ui' => true,150 'menu_icon' => 'dashicons-microphone',151 'supports' => ['title'],152 ]);153 });154 155 // Backend metaboxes156 add_action('add_meta_boxes', function () {157 add_meta_box('voice_recording_metabox', 'Voice Playback', 'voice_recording_metabox_callback', 'voice_recording', 'normal', 'default');158 add_meta_box('voice_recording_userinfo', 'User Info', 'voice_recording_userinfo_callback', 'voice_recording', 'side', 'default');159 });160 161 162 163 function voice_recording_metabox_callback($post)164 {165 $audio_url = get_post_meta($post->ID, 'voice_file_url', true);166 if ($audio_url) {167 echo '<audio controls style="width: 100%;"><source src="' . esc_url($audio_url) . '" type="audio/webm"></audio>';168 } else {169 echo '<p>No audio recording found for this entry.</p>';170 }171 }172 173 function voice_recording_userinfo_callback($post)174 {175 $info = get_post_meta($post->ID, 'voice_user_info', true);176 echo '<pre style="white-space: pre-wrap; word-wrap: break-word;">' . esc_html($info ?: 'No user info available.') . '</pre>';177 }
Note: See TracChangeset
for help on using the changeset viewer.