Changeset 1477386
- Timestamp:
- 08/17/2016 11:40:25 PM (10 years ago)
- Location:
- video-capture/trunk
- Files:
-
- 5 edited
-
js/record_video.js (modified) (6 diffs)
-
lib/swf/recorder.swf (modified) (previous)
-
settings.php (modified) (3 diffs)
-
templates/record-video.php (modified) (1 diff)
-
wp-video-capture.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
video-capture/trunk/js/record_video.js
r1477375 r1477386 7 7 var record_btn_element = ''; 8 8 var record_type = ''; 9 var configure_options = {'email' :VideoCapture.collect_email, 10 'birthday' : VideoCapture.collect_birthday, 11 'location' : VideoCapture.collect_location, 12 'additional_data' : VideoCapture.collect_additional_data, 13 'language' : VideoCapture.collect_language 9 var configure_options = { 'name' : VideoCapture.collect_name, 10 'email' :VideoCapture.collect_email, 11 'phone' : VideoCapture.collect_phone, 12 'birthday' : VideoCapture.collect_birthday, 13 'location' : VideoCapture.collect_location, 14 'additional_data' : VideoCapture.collect_additional_data, 15 'language' : VideoCapture.collect_language 14 16 }; 15 17 var required_options = required_options(); 18 var name = ''; 16 19 var email = ''; 20 var phone = ''; 17 21 var birthday = ''; 18 22 var location = ''; … … 108 112 var input_name = jQuery(this).attr('name'); 109 113 switch(input_name){ 114 case 'vidrack-capture-name': 115 name = jQuery(this).val() 116 break; 110 117 case 'vidrack-capture-email': 111 118 email = jQuery(this).val() 112 119 break; 120 case 'vidrack-capture-phone': 121 phone = jQuery(this).val() 122 break; 113 123 case 'vidrack-capture-birthday': 114 124 birthday = jQuery(this).val() 115 125 break; 116 126 case 'vidrack-capture-location': 117 location = jQuery(this).val()118 break;127 location = jQuery(this).val() 128 break; 119 129 case 'vidrack-capture-additional-data': 120 additional_data = jQuery(this).val();121 break;130 additional_data = jQuery(this).val(); 131 break; 122 132 case 'vidrack-capture-language': 123 language = jQuery(this).val();124 break;133 language = jQuery(this).val(); 134 break; 125 135 default : 126 136 return; 127 137 break; 128 138 } 139 jQuery(this).next('.wp-video-capture-collect-error').hide(); 129 140 } 130 141 }) … … 153 164 return isEmail(input_val); 154 165 break; 166 case 'vidrack-capture-phone': 167 return isPhone(input_val); 168 break; 155 169 default : 156 170 return true; … … 197 211 } 198 212 213 // Check correct phone number. 214 function isPhone(phone){ 215 var pattern = new RegExp(/^[\s()+-]*([0-9][\s()+-]*){6,20}(?:[\-\.\ \\\/]?(?:#|ext\.?|extension|x)[\-\.\ \\\/]?(\d+))?$/i); 216 return pattern.test(phone); 217 } 218 199 219 function renderSWF(element) { 200 220 // Pass SWF Video Player params … … 204 224 ip: VideoCapture.ip, 205 225 email: email, 226 name: name, 227 phone: phone, 206 228 birthday: birthday, 207 229 location: location, … … 331 353 ip: ip, 332 354 email: email, 355 name: name, 356 phone: phone, 333 357 birthday: birthday, 334 358 additional_data: additional_data, -
video-capture/trunk/settings.php
r1477380 r1477386 131 131 // Register collect options. 132 132 register_setting( 'wp_video_capture-group', 'vidrack_collect_email' ); 133 register_setting( 'wp_video_capture-group', 'vidrack_collect_name' ); 134 register_setting( 'wp_video_capture-group', 'vidrack_collect_phone' ); 133 135 register_setting( 'wp_video_capture-group', 'vidrack_collect_birthday' ); 134 136 register_setting( 'wp_video_capture-group', 'vidrack_collect_additional_data' ); … … 173 175 array( 174 176 'field' => 'vidrack_youtube_api_secret', 177 ) 178 ); 179 180 // Add name collect settings field. 181 add_settings_field( 182 'wp_video_capture-collect_name_options', 183 'Collect Name', 184 array( &$this, 'settings_field_select_collect_data' ), 185 'wp_video_capture-collect', 186 'wp_video_capture-section-collect', 187 array( 188 'field' => 'vidrack_collect_name', 175 189 ) 176 190 ); … … 187 201 ) 188 202 ); 203 204 // Add phone collect settings field. 205 add_settings_field( 206 'wp_video_capture-collect_phone_options', 207 'Collect Phone', 208 array( &$this, 'settings_field_select_collect_data' ), 209 'wp_video_capture-collect', 210 'wp_video_capture-section-collect', 211 array( 212 'field' => 'vidrack_collect_phone', 213 ) 214 ); 189 215 190 216 // Add date of birth collect settings field. -
video-capture/trunk/templates/record-video.php
r1477375 r1477386 89 89 <div class="wp-video-collect-data"> 90 90 <form class="wp-video-collect-data-form" method="post" action="#"> 91 <div class="wp-video-collect-data-block" data-collect="name"> 92 <label>Your name <span class="required">*</span>:</label> 93 <input type="text" class="wp-video-collect-data-input" name='vidrack-capture-name' autocomplete="off"> 94 <div class="wp-video-capture-collect-error">Please paste correct name</div> 95 </div> 91 96 <div class="wp-video-collect-data-block" data-collect="email"> 92 97 <label>Your email <span class="required">*</span>:</label> 93 98 <input type="text" class="wp-video-collect-data-input" name='vidrack-capture-email' autocomplete="off"> 94 99 <div class="wp-video-capture-collect-error">Please paste correct email</div> 100 </div> 101 <div class="wp-video-collect-data-block" data-collect="phone"> 102 <label>Your phone<span class="required">*</span>:</label> 103 <input type="tel" class="wp-video-collect-data-input" name='vidrack-capture-phone' autocomplete="off"> 104 <div class="wp-video-capture-collect-error">Please paste correct phone number</div> 95 105 </div> 96 106 <div class="wp-video-collect-data-block" data-collect="birthday"> -
video-capture/trunk/wp-video-capture.php
r1477384 r1477386 234 234 add_option( 'vidrack_desktop_upload' ); 235 235 add_option( 'vidrack_collect_email', 'no' ); 236 add_option( 'vidrack_collect_name', 'no' ); 237 add_option( 'vidrack_collect_phone', 'no' ); 236 238 add_option( 'vidrack_collect_birthday', 'no' ); 237 239 add_option( 'vidrack_collect_location', 'no' ); … … 339 341 $configure_options_array = array( ); 340 342 $configure_options_array[ 'email' ] = esc_html( get_post_meta( get_the_ID(), '_vidrack_email', true ) ); 343 $configure_options_array[ 'name' ] = esc_html( get_post_meta( get_the_ID(), '_vidrack_name', true ) ); 344 $configure_options_array[ 'phone' ] = esc_html( get_post_meta( get_the_ID(), '_vidrack_phone', true ) ); 341 345 $configure_options_array[ 'birthday' ] = esc_html( get_post_meta( get_the_ID(), '_vidrack_birthday', true ) ); 342 346 $configure_options_array[ 'location' ] = esc_html( get_post_meta( get_the_ID(), '_vidrack_location', true ) ); … … 484 488 'desktop_upload' => get_option( 'vidrack_desktop_upload' ), 485 489 'collect_email' => get_option( 'vidrack_collect_email' ), 490 'collect_name' => get_option( 'vidrack_collect_name' ), 491 'collect_phone' => get_option( 'vidrack_collect_phone' ), 486 492 'collect_birthday' => get_option( 'vidrack_collect_birthday' ), 487 493 'collect_location' => get_option( 'vidrack_collect_location' ), … … 618 624 } 619 625 620 if ( ! $r1 || ! $r2 || ! $r3 || ! $r4 || ! $r5 || ! $r6 || ! $r7 || ! $r8 || ! $r9 ) { 626 if ( isset( $_POST['name'] ) ) { // Input var "name" is set? 627 $r10 = add_post_meta( $post_id, '_vidrack_name', sanitize_text_field( wp_unslash( $_POST['name'] ), true ) ); // Input var "name" is set. 628 } else { 629 $r10 = true; 630 } 631 632 if ( isset( $_POST['phone'] ) ) { // Input var "phone" is set? 633 $r11 = add_post_meta( $post_id, '_vidrack_phone', sanitize_text_field( wp_unslash( $_POST['phone'] ), true ) ); // Input var "phone" is set. 634 } else { 635 $r11 = true; 636 } 637 638 if ( ! $r1 || ! $r2 || ! $r3 || ! $r4 || ! $r5 || ! $r6 || ! $r7 || ! $r8 || ! $r9 || ! $r10|| ! $r11 ) { 621 639 echo wp_json_encode( array( 'status' => 'error', 'message' => 'Cannot add post attributes.' ) ); 622 640 } else {
Note: See TracChangeset
for help on using the changeset viewer.