Changeset 1400942
- Timestamp:
- 04/21/2016 05:32:21 AM (10 years ago)
- Location:
- wp-voice-recorder/trunk
- Files:
-
- 5 edited
-
js/jRecorder.js (modified) (2 diffs)
-
js/wpvr-audio-recorder.js (modified) (2 diffs)
-
lib/wpvr-voice-meta.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
wpvr-recorder.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-voice-recorder/trunk/js/jRecorder.js
r1355188 r1400942 53 53 element = $("body"); 54 54 } 55 55 if ( typeof wpvr_variables == 'undefined' && typeof wpvr_cmt_variables !='undefined' ) { 56 var plugins_url = wpvr_cmt_variables.plugins_url; 57 var host_url = wpvr_cmt_variables.ajaxurl + '/filename=comment_file' + wpvr_cmt_variables.comment_id + '?action=wpvr_upload_cmt_file'; 58 } 59 else { 60 var plugins_url = wpvr_variables.plugins_url; 61 var host_url = wpvr_variables.ajaxurl + '/filename=recorded_file' + wpvr_variables.post_id + '?action=wpvr_upload_file'; 62 } 56 63 //default settings 57 64 var settings = { … … 65 72 'wmode' : 'transparent', 66 73 'bgcolor': '#ff0000', 67 'swf_path': wpvr_variables.plugins_url + '/wp-voice-recorder/js/jRecorder.swf',68 'host' : wpvr_variables.ajaxurl + '/filename=recorded_file' + wpvr_variables.post_id + '?action=wpvr_upload_file',74 'swf_path': plugins_url + '/wp-voice-recorder/js/jRecorder.swf', 75 'host' : host_url, 69 76 'callback_started_recording' : function(){}, 70 77 'callback_finished_recording' : function(){}, -
wp-voice-recorder/trunk/js/wpvr-audio-recorder.js
r1358133 r1400942 1 1 var $ = jQuery.noConflict(); 2 2 $(document).ready(function(){ 3 var host_url = wpvr_audio.ajaxurl + '/filename=recorded_file' + wpvr_audio.post_id + '?action=wpvr_upload_file'; 3 if ( typeof wpvr_audio == 'undefined' && typeof wpvr_cmt_audio !='undefined' ) { 4 var host_url = wpvr_cmt_audio.ajaxurl + '/filename=comment_file' + wpvr_cmt_audio.comment_id + '?action=wpvr_upload_cmt_file'; 5 var plugin_url = wpvr_cmt_audio.plugins_url; 6 } 7 else { 8 var host_url = wpvr_audio.ajaxurl + '/filename=recorded_file' + wpvr_audio.post_id + '?action=wpvr_upload_file'; 9 var plugin_url = wpvr_audio.plugins_url; 10 } 4 11 $.jRecorder( 5 12 { … … 10 17 callback_activityTime: function(time){callback_activityTime(time); }, 11 18 callback_finished_sending: function(time){ callback_finished_sending(); }, 12 swf_path : wpvr_audio.plugins_url + '/wp-voice-recorder/js/jRecorder.swf',19 swf_path : plugin_url + '/wp-voice-recorder/js/jRecorder.swf', 13 20 } 14 21 ); -
wp-voice-recorder/trunk/lib/wpvr-voice-meta.php
r1355188 r1400942 10 10 *@return none 11 11 */ 12 function add_audio_recorder () {12 function add_audio_recorder_for_posts( $post ) { 13 13 add_meta_box( 14 14 'wpvr_post_recorder', … … 18 18 ); 19 19 } 20 add_action( 'add_meta_boxes', 'add_audio_recorder' ); 20 add_action( 'add_meta_boxes_post', 'add_audio_recorder_for_posts' ); 21 22 /*add a meta box to record the voice post 23 *@param none 24 *@return none 25 */ 26 function add_audio_recorder_for_page( $post ) { 27 add_meta_box( 28 'wpvr_post_recorder', 29 __( 'WP Post Recorder', 'myplugin_textdomain' ), 30 'wpvr_record_box', 31 'page','side' 32 ); 33 } 34 add_action( 'add_meta_boxes_page', 'add_audio_recorder_for_page' ); 21 35 /* Function to add metabox for the recorder 22 36 * @param none -
wp-voice-recorder/trunk/readme.txt
r1355188 r1400942 1 1 === WP Voice Recorder === 2 2 Contributors: Kumar Parth 3 Tags: WordPress,Voice Recorder, posts record 3 Tags: WordPress,Voice Recorder, posts record, comment record, audio recording for pages 4 4 Requires at least: 3.1 5 5 Tested up to: 4.1 … … 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 9 10 WP Voice Recorder can help us to record the posts and p lay them in the front end.10 WP Voice Recorder can help us to record the posts and pages and play them in the front end and also record comments too. 11 11 12 12 == Description == 13 13 14 WP Voice Recorder can help us to record the posts and play them in the front end. It allows us to save the recorded audios into your uploads folder in wordpress install.14 WP Voice Recorder can help us to record the posts, pages and play them in the front end. It also let us record comments too. It allows us to save the recorded audios into your uploads folder in wordpress install. 15 15 16 16 … … 19 19 1. Download and extract `wp-voice-recorder.zip` to `wp-content/plugins/` 20 20 2. Activate the plugin through the 'Plugins' menu in WordPress. 21 3. It will create a recorder in each posts editor and there you can record your voice and publish or update your posts .21 3. It will create a recorder in each posts editor and there you can record your voice and publish or update your posts as well as pages. And a recorder appears for the comments too. 22 22 23 23 Special Thanks to … … 35 35 == Changelog == 36 36 # 1.1 - Removed the dropbox account feature. 37 # 1.2 - Added comment recording and audio recording in pages too. 37 38 38 39 39 40 = Version 1.1 = 40 41 41 * Initial public release.42 * New version updated. 42 43 43 44 44 45 == Upgrade Notice == 46 - Upgrade to new version to record comments and pages too. 45 47 46 48 == Screenshots == 47 49 2. screenshot-1.png 48 50 3. screenshot-2.png 51 4. screenshot-3.png 52 5. screenshot-4.png -
wp-voice-recorder/trunk/wpvr-recorder.php
r1355188 r1400942 50 50 */ 51 51 function wpvr_admin_scripts( $hook_suffix ) { 52 if ( 'post.php' == $hook_suffix || 'post-new.php' == $hook_suffix) {52 //if ( 'post.php' == $hook_suffix || 'post-new.php' == $hook_suffix || is_single() || is_page() ) { 53 53 wp_enqueue_script( 'jrecorder', plugins_url( 'js/jRecorder.js' , __FILE__ ), array('jquery') ); 54 54 wp_enqueue_script( 'audiorec', plugins_url( 'js/wpvr-audio-recorder.js' , __FILE__ ), array( 'jrecorder' ) ); … … 60 60 wp_localize_script( 'audiorec', 'wpvr_audio', $site_parameters ); 61 61 wp_localize_script( 'jrecorder', 'wpvr_variables', $site_parameters ); 62 }62 //} 63 63 } 64 64 add_action( 'admin_enqueue_scripts', 'wpvr_admin_scripts' ); … … 75 75 $url_filename = $split_url[1]; 76 76 $filename = rtrim( $url_filename, '?action=wpvr_upload_file' ); 77 $fp = fopen( $upload_path.'/'.$filename.'.wav', 'wb' ); 78 fwrite( $fp, file_get_contents( 'php://input' ) ); 79 fclose( $fp ); 80 } 81 82 add_action( 'wp_ajax_wpvr_upload_cmt_file', 'wpvr_upload_cmt_file' ); 83 add_action( 'wp_ajax_nopriv_wpvr_upload_cmt_file', 'wpvr_upload_cmt_file' ); 84 function wpvr_upload_cmt_file() { 85 $upload_dir = wp_upload_dir(); 86 //save the path in the uploads folder 87 $upload_path = $upload_dir['basedir'] . '/recorded_files'; 88 $url = wp_get_referer(); 89 $host = parse_url($url, PHP_URL_QUERY); 90 $split_url = explode( 'filename=',$host ); 91 $url_filename = $split_url[1]; 92 $filename = rtrim( $url_filename, '?action=wpvr_upload_cmt_file' ); 77 93 $fp = fopen( $upload_path.'/'.$filename.'.wav', 'wb' ); 78 94 fwrite( $fp, file_get_contents( 'php://input' ) ); … … 95 111 else 96 112 $file_url = ''; 97 if ( ! empty ( $file_url ) && is_single() )113 if ( ! empty ( $file_url ) && (is_single() || is_page()) ) 98 114 require( 'lib/wpvr-jplayer-interface.php' ); 99 115 return $content; … … 114 130 add_action( 'wp_footer' , 'wpvr_run_script' ); 115 131 132 add_action( 'comment_form_logged_in_after', 'additional_fields' ); 133 add_action( 'comment_form_after_fields', 'additional_fields' ); 116 134 135 function additional_fields () { 136 // global $post; 137 // Add an nonce field so we can check for it later. 138 wp_nonce_field( 'save_audio', 'save_audio_nonce' ); 139 wp_enqueue_script( 'jrecorder', plugins_url( 'js/jRecorder.js' , __FILE__ ), array('jquery') ); 140 wp_enqueue_script( 'audiorec', plugins_url( 'js/wpvr-audio-recorder.js' , __FILE__ ), array( 'jrecorder' ) ); 141 $site_parameters = array( 142 'plugins_url' => plugins_url(), 143 'comment_id' => get_comment_ID() + 1, 144 'ajaxurl' => admin_url( 'admin-ajax.php' ), 145 ); 146 wp_localize_script( 'audiorec', 'wpvr_cmt_audio', $site_parameters ); 147 wp_localize_script( 'jrecorder', 'wpvr_cmt_variables', $site_parameters ); 148 $html = '<div style="background-color: #eeeeee;border:1px solid #cccccc"> 149 Time: <span id="time">00:00</span> 150 </div>'; 151 $html .= '<label for="record">'; 152 $html .= _e( 'record your voice', 'myplugin_textdomain' ); 153 $html .= '</label> '; 154 $html .= '<div> 155 Level: <span id="level"></span> 156 </div> '; 157 $html .= '<div id="levelbase" style="width:200px;height:20px;background-color:#ffff00"> 158 <div id="levelbar" style="height:19px; width:2px;background-color:red"></div> 159 </div>'; 160 $html .= '<div> Status: <span id="status"></span></div>'; 161 $html .= '<input type="button" id="record" name="record" value="record" />'; 162 $html .= '<input type="button" id="stop" name="stop" value="Save/Stop"/>'; 163 $html .= '<input type="hidden" name="record_file" id="record_file" value="recorded_file'.get_comment_ID().'"/>'; 164 echo $html; 165 } 166 167 add_action( 'comment_post', 'save_comment_meta_data' ); 168 function save_comment_meta_data( $comment_id ) { 169 $rec_upload_file = wp_upload_dir(); 170 $rec_path = $rec_upload_file['baseurl']; 171 $record_file = 'comment_file'.$comment_id; 172 add_comment_meta( $comment_id,'record_file', $rec_path . '/recorded_files/'. $record_file . '.wav' ); 173 } 174 175 add_filter( 'comment_text', 'modify_comment', 0, 3 ); 176 function modify_comment( $comment_text, $comment, $args ){ 177 wp_enqueue_script( 'cmt-player', plugins_url( 'js/cmt-player.js',__FILE__ ), array( 'jquery' ), '', true ); 178 $comment_id = absint( $comment->comment_ID ); 179 error_log("Comment ID in this func" . $comment_id); 180 $file_url = get_comment_meta( $comment_id, 'record_file', true ); 181 $site_parameters = array( 182 'plugin_url' => plugins_url(), 183 ); 184 wp_localize_script( 'cmt-player', 'wpvr_cmtvar', $site_parameters ); 185 require( 'lib/cmtplayer-interface.php' ); 186 echo '<br/>'; 187 echo $comment_text; 188 }
Note: See TracChangeset
for help on using the changeset viewer.