Changeset 982953
- Timestamp:
- 09/06/2014 11:54:48 AM (10 years ago)
- Location:
- featured-video-plus/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
featured-video-plus/trunk/featured-video-plus.php
r831827 r982953 5 5 Description: Add Featured Videos to your posts and pages. 6 6 Author: Alexander Höreth 7 Version: 1.9 7 Version: 1.9 8 8 Author URI: http://yrnxt.com 9 9 License: GPL2 … … 28 28 29 29 if (!defined('FVP_VERSION')) 30 define('FVP_VERSION', '1.9 ');30 define('FVP_VERSION', '1.9'); 31 31 32 32 // symlink proof … … 61 61 62 62 // admin meta box 63 add_action('admin_menu', 64 add_action('save_post', array( &$featured_video_plus_backend, 'metabox_save') );63 add_action('admin_menu', array( &$featured_video_plus_backend, 'metabox_register' ) ); 64 add_action('save_post', ) ); 65 65 66 66 // enqueue admin scripts and styles … … 68 68 69 69 // link to media settings on plugins overview 70 add_filter('plugin_action_links', 70 add_filter('plugin_action_links', array( &$featured_video_plus_backend, 'plugin_action_link' ), 10, 2); 71 71 72 72 // add upload mime types for HTML5 videos 73 add_filter('upload_mimes', 73 add_filter('upload_mimes', array( &$featured_video_plus_backend, 'add_upload_mimes' ) ); 74 74 75 75 // post edit help 76 add_action('admin_init', 77 add_action( 'load-post.php', 76 add_action('admin_init', array( &$featured_video_plus_backend, 'help' ) ); 77 add_action( 'load-post.php', array( &$featured_video_plus_backend, 'tabs' ), 20 ); // $GLOBALS['pagenow'] 78 78 if( get_bloginfo('version') < 3.3 ) 79 79 add_filter( 'contextual_help', array( &$featured_video_plus_backend, 'help_pre_33' ), 10, 3 ); … … 85 85 86 86 // media settings help 87 add_action('admin_init', 87 add_action('admin_init', array( &$featured_video_plus_settings, 'help' ) ); 88 88 add_action( 'load-options-media.php', array( &$featured_video_plus_settings, 'tabs' ), 20 ); // $GLOBALS['pagenow'] 89 89 if( get_bloginfo('version') < 3.3 ) 90 add_filter( 'contextual_help', 90 add_filter( 'contextual_help', array( &$featured_video_plus_settings, 'help_pre_33' ), 10, 3 ); 91 91 92 92 if (defined('DOING_AJAX')&&DOING_AJAX){ 93 add_action( 'wp_ajax_fvp_ajax', array( &$featured_video_plus_backend, 'ajax') );94 add_action( 'wp_ajax_fvp_get_embed', 93 add_action( 'wp_ajax_fvp_ajax', ) ); 94 add_action( 'wp_ajax_fvp_get_embed', array( &$featured_video_plus_backend, 'ajax_get_embed' )); 95 95 add_action( 'wp_ajax_nopriv_fvp_get_embed', array( &$featured_video_plus_backend, 'ajax_get_embed' )); 96 96 } … … 108 108 109 109 // filter get_post_thumbnail output 110 add_filter( 110 add_filter('post_thumbnail_html', array( &$featured_video_plus_frontend, 'filter_post_thumbnail'), 99, 5); 111 111 112 112 // shortcode 113 add_shortcode( 113 add_shortcode( 'featured-video-plus', array( &$featured_video_plus_frontend, 'shortcode' ) ); 114 114 } -
featured-video-plus/trunk/js/backend.js
r831827 r982953 180 180 title: $control.data('title'), 181 181 library: { 182 type: ' video'182 type: '' 183 183 }, 184 184 button: { -
featured-video-plus/trunk/php/backend.php
r831827 r982953 29 29 30 30 $this->featured_video_plus = $featured_video_plus_instance; 31 $this->default_value 32 $this->default_value_sec 31 $this->default_value = __('Video URL', 'featured-video-plus'); 32 $this->default_value_sec = __('Fallback: same video, different format', 'featured-video-plus'); 33 33 } 34 34 … … 70 70 $upload_dir = wp_upload_dir(); 71 71 wp_localize_script( 'fvp_backend', 'fvp_backend_data', array( 72 'wp_upload_dir' 73 'loading_gif' 74 'default_value' 72 'wp_upload_dir' => $upload_dir['baseurl'], 73 'loading_gif' => get_admin_url(null,'images/loading.gif'), 74 'default_value' => $this->default_value, 75 75 'default_value_sec' => $this->default_value_sec, 76 'wp_35' 76 'wp_35' => get_bloginfo('version') >= 3.5 77 77 ) ); 78 78 } … … 165 165 166 166 // current theme does not support Featured Images 167 if( !current_theme_supports('post-thumbnails') && $options[' overwrite'] != 'manual' )167 if( !current_theme_supports('post-thumbnails') && $options['e'] != 'manual' ) 168 168 echo '<p class="fvp_warning description"><span style="font-weight: bold;">'.__('The current theme does not support Featured Images', 'featured-video-plus').':</span> '.sprintf(__('To display Featured Videos you need to use the <code>Shortcode</code> or <code>PHP functions</code>. To hide this notice deactivate "<em>Replace Featured Images</em>" in the %sMedia Settings%s.', 'featured-video-plus'), '<a href="'.get_admin_url(null, '/options-media.php').'">', '</a>' )."</p>\n\n"; 169 169 … … 180 180 public function metabox_save($post_id){ 181 181 182 if (( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ||// Autosave, do nothing183 ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ||// AJAX? Not used here184 ( !current_user_can( 'edit_post', $post_id ) ) ||// Check user permissions185 ( false !== wp_is_post_revision( $post_id ) ) 182 if (( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) // Autosave, do nothing 183 ( defined( 'DOING_AJAX' ) && DOING_AJAX ) // AJAX? Not used here 184 ( !current_user_can( 'edit_post', $post_id ) ) // Check user permissions 185 ( false !== wp_is_post_revision( $post_id ) ) // Return if it's a post revision 186 186 ) return; 187 187 188 188 $post = array( 189 'id' 190 'fvp_nonce' => isset($_POST['fvp_nonce']) ? $_POST['fvp_nonce']: '',191 'fvp_set_featimg' 192 'fvp_video' => isset($_POST['fvp_video']) ? $_POST['fvp_video']: '',193 'fvp_sec' => isset($_POST['fvp_sec']) ? $_POST['fvp_sec']: ''189 'id' => $post_id, 190 'fvp_nonce' : '', 191 'fvp_set_featimg' => isset($_POST['fvp_set_featimg']) ? $_POST['fvp_set_featimg'] : '', 192 'fvp_video' : '', 193 'fvp_sec' : '' 194 194 ); 195 195 $this->save($post); … … 200 200 public function ajax() { 201 201 $post = array( 202 'id' 203 'fvp_nonce' => isset($_POST['fvp_nonce']) ? $_POST['fvp_nonce']: '',202 'id' => $_POST['id'], 203 'fvp_nonce' : '', 204 204 'fvp_set_featimg' => isset($_POST['fvp_set_featimg']) ? $_POST['fvp_set_featimg'] : '', 205 'fvp_video' => isset($_POST['fvp_video']) ? $_POST['fvp_video']: '',206 'fvp_sec' => isset($_POST['fvp_sec']) ? $_POST['fvp_sec']: ''205 'fvp_video' : '', 206 'fvp_sec' : '' 207 207 ); 208 208 $meta = $this->save($post); … … 226 226 */ 227 227 function save($post) { 228 if( ( isset($post['fvp_nonce']) && 228 if( ( isset($post['fvp_nonce']) && // WP Form submitted.. 229 229 !wp_verify_nonce( $post['fvp_nonce'], FVP_NAME ) ) ) 230 230 return false; … … 234 234 235 235 // video is empty or default value 236 if( !isset($post['fvp_video']) || empty($post['fvp_video']) || $post['fvp_video'] == $this->default_value)236 if( !isset($post['fvp_video']) ) 237 237 $url = ''; 238 238 else $url = trim($post['fvp_video']); 239 239 240 240 // fallback video is empty or default value 241 if( !isset($post['fvp_sec']) || empty($post['fvp_sec']) || $post['fvp_sec']== $this->default_value_sec )241 if( !isset($post['fvp_sec']) == $this->default_value_sec ) 242 242 $sec = ''; 243 243 else $sec = trim($post['fvp_sec']); … … 259 259 $data = $this->get_video_data($url, $sec); 260 260 261 $url = isset($data['url']) && !empty($data['url']) ? $data['url'] 261 $url = isset($data['url']) && !empty($data['url']) ? $data['url'] : $url; 262 262 // Do we have a screen capture to pull? 263 263 if( isset($data['img']) && !empty($data['img']) ) { … … 267 267 268 268 $meta = array( 269 'full' => $url, 270 'id' => isset($data['id']) ? $data['id'] : '', 271 'sec' => isset($data['sec']) ? $data['sec'] : '', 272 'img' => isset($img) ? $img : '', 273 'prov' => isset($data['provider']) ? $data['provider'] : '', 274 'time' => isset($data['time']) ? $data['time'] : '', 275 'valid' => isset($data['valid']) ? $data['valid'] : true 269 'full' => $url, 270 'id' => isset($data['id']) ? $data['id'] : '', 271 'sec' => isset($data['sec']) ? $data['sec'] : '', 272 'img' => isset($img) ? $img : '', 273 'prov' => isset($data['provider']) ? $data['provider'] : '', 274 'time' => isset($data['time']) ? $data['time'] : '', 275 'end_time' => isset($data['end_time']) ? $data['end_time'] : '', 276 'valid' => isset($data['valid']) ? $data['valid'] : true 276 277 ); 277 278 278 update_post_meta( $post['id'], '_fvp_video', $meta);279 update_post_meta(); 279 280 return $meta; 280 281 } … … 312 313 $provider = 'youtube'; 313 314 case 'youtube': 314 // domain 11 char ID time-link parameter315 315 $pattern = '#(?:https?\:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/watch\?.+&v=))([\w-]{11})#x'; 316 316 preg_match($pattern, $url, $url_data); … … 327 327 if (isset($result['status']) && $result['status'] == 'fail'){ 328 328 $data = array( 329 'id' 329 'id' => $video_id, 330 330 'provider' => $provider, 331 'url' 332 'api' 331 'url' => $url, 332 'api' => false 333 333 ); 334 334 break; … … 338 338 preg_match('/t=(?:(\d+)m)?(?:(\d+)s)?/', $url, $attr); 339 339 if( !empty($attr[1] ) || !empty($attr[2]) ) { 340 $min = !empty($attr[1]) ? $attr[1]*60 : 0; 341 $sek = !empty($attr[2]) ? $attr[2] : 0; 340 $min = !empty($attr[1]) ? $attr[1]*60 : 0; 341 $sek = !empty($attr[2]) ? $attr[2] : 0; 342 $start_time = $min + $sek; 343 } else { 344 preg_match('/start=(\d+)/', $url, $attr); 345 if( !empty($attr[1] ) ) $start_time = $attr[1]; 346 else $start_time = 0; 347 348 preg_match('/end=(\d+)/', $url, $attr); 349 if( !empty($attr[1] ) ) $end_time = $attr[1]; 350 else $end_time = 0; 351 } 352 353 // generate video metadata 354 $data = array( 355 'id' => $video_id, 356 'provider' => $provider, 357 'time' => $start_time, 358 'end_time' => $end_time, 359 'title' => $result['title'], 360 'description' => $result['keywords'], 361 'filename' => sanitize_file_name($result['title']), 362 'timestamp' => $result['timestamp'], 363 'author' => $result['author'], 364 'tags' => $result['keywords'], 365 'img' => ( isset($result['iurlmaxres']) && !empty($result['iurlmaxres']) ) ? $result['iurlmaxres'] : 'http://img.youtube.com/vi/' . $video_id . '/0.jpg', 366 'url' => ( $start_time > 0 ) ? $url : 'http://youtu.be/'.$video_id 367 ); 368 369 break; 370 371 // vimeo.com 372 case 'vimeo': 373 // domain video ID 374 $pattern = '#(?:https?://)?(?:\w+.)?vimeo.com/(?:video/|moogaloop\.swf\?clip_id=)?(\w+)#x'; 375 preg_match($pattern, $url, $url_data); 376 $video_id = $url_data[1]; 377 378 // access API: http://developer.vimeo.com/apis/simple 379 $response = wp_remote_get( 'http://vimeo.com/api/v2/video/' . $video_id . '.php' ); 380 if( is_wp_error( $response ) || (isset($response['response']['code']) && $response['response']['code'] == '404') ) 381 break; 382 // title, description, upload_date, thumbnail_large, user_name, tags 383 $result = unserialize( $response['body'] ); 384 385 // extract info of a time-link 386 /*preg_match('/#t=((?:\d+m)?(?:\d+s)?)/', $video, $attr); 387 if( !empty($attr[1] ) ) 388 $video_attr = $attr[1];*/ 389 390 // generate video metadata 391 $data = array( 392 'id' => $video_id, 393 'provider' => $provider, 394 'title' => $result[0]['title'], 395 'description' => $result[0]['description'], 396 'filename' => sanitize_file_name( $result[0]['title'] ), 397 'timestamp' => strtotime( $result[0]['upload_date'] ), 398 'author' => $result[0]['user_name'], 399 'tags' => $result[0]['tags'], 400 'img' => $result[0]['thumbnail_large'], 401 'url' => $result[0]['url'] 402 ); 403 404 break; 405 406 // dailymotion.com 407 case 'dailymotion': 408 // domain video ID 409 preg_match('/dailymotion.com\/(?:embed\/)?video\/([^_#\?]+)/', $url, $url_data); 410 if( !isset($url_data[1]) ) 411 break; 412 413 $video_id = $url_data[1]; 414 415 // access API: http://www.dailymotion.com/doc/api/obj-video.html 416 $url = 'https://api.dailymotion.com/video/'.$video_id.'?fields=title,description,created_time,owner.screenname,tags,thumbnail_url,thumbnail_large_url,url,aspect_ratio'; 417 $request = new WP_Http; 418 $response = $request->request( $url, array( 'method' => 'GET', 'sslverify' => false) ); 419 if( is_wp_error($response) ) 420 break; 421 $result = json_decode($response['body'], true); 422 if( !isset($result) || (isset($result['error']['code']) && ($result['error']['code'] == 501 || $result['error']['code'] == 400) ) ) 423 break; 424 425 // extract info of a time-link 426 preg_match('/t=(?:(\d+)m)?(?:(\d+)s)?/', $url, $attr); 427 if( !empty($attr[1] ) || !empty($attr[2]) ) { 428 $min = !empty($attr[1]) ? $attr[1]*60 : 0; 429 $sek = !empty($attr[2]) ? $attr[2] : 0; 342 430 $video_time = $min + $sek; 343 431 } else { … … 351 439 // generate video metadata 352 440 $data = array( 353 'id' => $video_id, 354 'provider' => $provider, 355 'time' => $video_time, 356 'title' => $result['title'], 357 'description' => $result['keywords'], 358 'filename' => sanitize_file_name($result['title']), 359 'timestamp' => $result['timestamp'], 360 'author' => $result['author'], 361 'tags' => $result['keywords'], 362 'img' => ( isset($result['iurlmaxres']) && !empty($result['iurlmaxres']) ) ? $result['iurlmaxres'] : 'http://img.youtube.com/vi/' . $video_id . '/0.jpg', 363 'url' => ( $video_time > 0 ) ? 'http://youtu.be/'.$video_id.'#t='.floor($video_time/60).'m'.($video_time%60).'s' : 'http://youtu.be/'.$video_id 364 ); 365 366 break; 367 368 // vimeo.com 369 case 'vimeo': 370 // domain video ID 371 $pattern = '#(?:https?://)?(?:\w+.)?vimeo.com/(?:video/|moogaloop\.swf\?clip_id=)?(\w+)#x'; 372 preg_match($pattern, $url, $url_data); 373 $video_id = $url_data[1]; 374 375 // access API: http://developer.vimeo.com/apis/simple 376 $response = wp_remote_get( 'http://vimeo.com/api/v2/video/' . $video_id . '.php' ); 377 if( is_wp_error( $response ) || (isset($response['response']['code']) && $response['response']['code'] == '404') ) 378 break; 379 // title, description, upload_date, thumbnail_large, user_name, tags 380 $result = unserialize( $response['body'] ); 381 382 // extract info of a time-link 383 /*preg_match('/#t=((?:\d+m)?(?:\d+s)?)/', $video, $attr); 384 if( !empty($attr[1] ) ) 385 $video_attr = $attr[1];*/ 386 387 // generate video metadata 388 $data = array( 389 'id' => $video_id, 390 'provider' => $provider, 391 'title' => $result[0]['title'], 392 'description' => $result[0]['description'], 393 'filename' => sanitize_file_name( $result[0]['title'] ), 394 'timestamp' => strtotime( $result[0]['upload_date'] ), 395 'author' => $result[0]['user_name'], 396 'tags' => $result[0]['tags'], 397 'img' => $result[0]['thumbnail_large'], 398 'url' => $result[0]['url'] 399 ); 400 401 break; 402 403 // dailymotion.com 404 case 'dailymotion': 405 // domain video ID 406 preg_match('/dailymotion.com\/(?:embed\/)?video\/([^_#\?]+)/', $url, $url_data); 407 if( !isset($url_data[1]) ) 408 break; 409 410 $video_id = $url_data[1]; 411 412 // access API: http://www.dailymotion.com/doc/api/obj-video.html 413 $url = 'https://api.dailymotion.com/video/'.$video_id.'?fields=title,description,created_time,owner.screenname,tags,thumbnail_url,thumbnail_large_url,url,aspect_ratio'; 414 $request = new WP_Http; 415 $response = $request->request( $url, array( 'method' => 'GET', 'sslverify' => false) ); 416 if( is_wp_error($response) ) 417 break; 418 $result = json_decode($response['body'], true); 419 if( !isset($result) || (isset($result['error']['code']) && ($result['error']['code'] == 501 || $result['error']['code'] == 400) ) ) 420 break; 421 422 // extract info of a time-link 423 preg_match('/t=(?:(\d+)m)?(?:(\d+)s)?/', $url, $attr); 424 if( !empty($attr[1] ) || !empty($attr[2]) ) { 425 $min = !empty($attr[1]) ? $attr[1]*60 : 0; 426 $sek = !empty($attr[2]) ? $attr[2] : 0; 427 $video_time = $min + $sek; 428 } else { 429 preg_match('/start=(\d+)/', $url, $attr); 430 if( !empty($attr[1] ) ) 431 $video_time = $attr[1]; 432 else 433 $video_time = 0; 434 } 435 436 // generate video metadata 437 $data = array( 438 'id' => $video_id, 439 'provider' => $provider, 440 'time' => $video_time, 441 'title' => $result['title'], 442 'description' => $result['description'], 443 'filename' => sanitize_file_name($result['title']), 444 'timestamp' => $result['created_time'], 445 'author' => $result['owner.screenname'], 446 'tags' => implode(', ', $result['tags']), 447 'img' => ( isset($result['thumbnail_url']) && !empty($result['thumbnail_url']) ) ? $result['thumbnail_url'] : $result['thumbnail_large_url'], 448 'url' => 'http://dailymotion.com/video/'.$video_id. ( $video_time>0 ? '#t='.floor($video_time/60).'m'.($video_time%60).'s' : '') 441 'id' => $video_id, 442 'provider' => $provider, 443 'time' => $video_time, 444 'title' => $result['title'], 445 'description' => $result['description'], 446 'filename' => sanitize_file_name($result['title']), 447 'timestamp' => $result['created_time'], 448 'author' => $result['owner.screenname'], 449 'tags' => implode(', ', $result['tags']), 450 'img' => ( isset($result['thumbnail_url']) && !empty($result['thumbnail_url']) ) ? $result['thumbnail_url'] : $result['thumbnail_large_url'], 451 'url' => 'http://dailymotion.com/video/'.$video_id. ( $video_time>0 ? '#t='.floor($video_time/60).'m'.($video_time%60).'s' : '') 449 452 ); 450 453 … … 467 470 // source url and other metadata from the source code. 468 471 case 'liveleak': // view-source:http://www.liveleak.com/view?i=45f_1358105976&ajax=1 469 // domainvideo ID472 // video ID 470 473 preg_match('/(?:http:\/\/)?(?:www\.)?liveleak.com\/view\?i=([\d\w]{3}_\d{10})/', $url, $url_data); 471 474 if( !isset($url_data[1]) ) … … 493 496 494 497 $data = array( 495 'id' 496 'provider' 497 'title' 498 'id' => $video_id, 499 'provider' => $provider, 500 'title' => $result['title'], 498 501 'description' => isset($desc[1]) ? $desc[1] : '', 499 'filename' 500 'timestamp' 501 //'author' 502 //'tags' 503 'img' 504 'url' 502 'filename' => sanitize_file_name($result['title']), 503 'timestamp' => time(), 504 //'author' => '', // <strong>By:</strong> <a href="http://www.liveleak.com/c/k-doe">k-doe</a> 505 //'tags' => '', // <strong>Tags:</strong> <a href="browse?q=Drive By">Drive By</a>, <a href="browse?q=Fire Extinguisher">Fire Extinguisher</a><br /> 506 'img' => isset($result['image']) ? trim($result['image'],"\"") : '', 507 'url' => 'http://liveleak.com/view?i='.$video_data[1] 505 508 ); 506 509 break; … … 543 546 // Generate attachment post metadata 544 547 $img_data = array( 545 'post_content' => $data['description'],546 'post_title' 547 'post_name' 548 'post_content'=> $data['description'], 549 'post_title' => $data['title'], 550 'post_name' => $data['filename'] 548 551 ); 549 552 … … 555 558 $img_meta = wp_get_attachment_metadata( $img ); 556 559 $img_meta['image_meta'] = array( 557 'aperture' 558 'credit' 559 'camera' 560 'caption' 560 'aperture' => 0, 561 'credit' => $data['id'], 562 'camera' => $data['provider'], 563 'caption' => $data['description'], 561 564 'created_timestamp' => $data['timestamp'], 562 'copyright' 563 'focal_length' 564 'iso' 565 'shutter_speed' 566 'title' 565 'copyright' => $data['author'], 566 'focal_length' => 0, 567 'iso' => 0, 568 'shutter_speed' => 0, 569 'title' => $data['title'] 567 570 ); 568 571 … … 572 575 } 573 576 574 if( (get_bloginfo('version') >= 3.1) 577 if( (get_bloginfo('version') >= 3.1) && // set_post_thumbnail was added in 3.1 575 578 ( (!has_post_thumbnail( $post_id )) || 576 579 ($set_featimg) ) ) … … 587 590 */ 588 591 function delete_featured_video_image($post_id, $meta) { 589 if(!isset($meta['img'])||empty($meta['img'])) return false; 592 if( !isset($meta['img']) || empty($meta['img']) ) 593 return false; 590 594 591 595 // Unset featured image if it is from this video … … 607 611 header( "Content-Type: application/json" ); 608 612 609 if (!isset( $_POST['nonce'] ) || 610 !wp_verify_nonce( $_POST['nonce'], 'featured-video-plus-nonce' )){ 611 json_encode(array('success' => false, 'html' => 'invalid nonce')); 613 if ( !isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'featured-video-plus-nonce') ){ 614 echo json_encode(array('success' => false, 'html' => 'invalid nonce')); 612 615 exit(); 613 616 } … … 631 634 */ 632 635 public function help() { 633 $mediahref 634 $general 635 636 $mediahref = (get_bloginfo('version') >= 3.5) ? '<a href="#" class="insert-media" title="Add Media">' : '<a href="media-upload.php?post_id=4&type=video&TB_iframe=1&width=640&height=207" id="add_video" class="thickbox" title="Add Video">'; 637 $general = (get_bloginfo('version') >= 3.6) ? sprintf( __('To use local videos, copy the <code>Link To Media File</code> from your %sMedia Library%s and paste it into the text field.', 'featured-video-plus'), $mediahref, '</a>' ) : 638 sprintf( __('To use local videos as Featured Videos WordPress 3.6 or higher is required.', 'featured-video-plus'), $mediahref, '</a>' ); 636 639 637 640 $this->help_localmedia = ' … … 680 683 // LOCALVIDEOS HELP TAB 681 684 $screen->add_help_tab( array( 682 'id' => 'fvp_help_localvideos',685 'id' => 'fvp_help_localvideos', 683 686 'title' => __('Featured Video','featured-video-plus').': '.__('Local Media', 'featured-video-plus'), 684 687 'content' => $this->help_localmedia … … 687 690 // LEGAL URLs HELP TAB 688 691 $screen->add_help_tab( array( 689 'id' => 'fvp_help_urls',692 'id' => 'fvp_help_urls', 690 693 'title' => __('Featured Video','featured-video-plus').': '.__('Valid URLs', 'featured-video-plus'), 691 694 'content' => $this->help_urls -
featured-video-plus/trunk/php/frontend.php
r831827 r982953 22 22 */ 23 23 function __construct( $featured_video_plus_instance ) { 24 25 24 if ( !isset($featured_video_plus_instance) ) 25 wp_die( 'featured_video_plus general instance required!', 'Error!' ); 26 26 27 27 $this->featured_video_plus = $featured_video_plus_instance; … … 86 86 $options = get_option( 'fvp-settings' ); 87 87 88 if (($options['usage']=='manual') || !has_post_video($post_id)) 88 if ( ( isset($options['issingle']) && $options['issingle'] && ! is_single()) || 89 ( $options['usage']=='manual' || !has_post_video($post_id) ) ) 89 90 return $html; 90 91 -
featured-video-plus/trunk/php/general.php
r831827 r982953 27 27 return false; 28 28 29 $meta 30 $options = get_option( 'fvp-settings' );31 32 $size 33 $size 29 $meta = get_post_meta($post_id, '_fvp_video', true); 30 $options= get_option( 'fvp-settings' ); 31 32 $size = $this->get_size($size); 33 $size = array( 'width' => $size[0], 'height' => $size[1] ); 34 34 35 35 if( ! is_admin() ) { … … 80 80 81 81 case 'vimeo': 82 $options = get_option( 'fvp-settings' ); 83 $src = 'http://player.vimeo.com/video/'.$meta['id'].'?badge=0&portrait='.$options['vimeo']['portrait'].'&title='.$options['vimeo']['title'].'&byline='.$options['vimeo']['byline'].'&color='.$options['vimeo']['color'].'&autoplay='.$autoplay; 82 $option = $options['vimeo']; 83 $params = array( 84 'badge' => 0, 85 'portrait' => $option['portrait'], 86 'title' => $option['title'], 87 'byline' => $option['byline'], 88 'color' => $option['color'], 89 'autoplay' => $autoplay 90 ); 91 92 $src = '//player.vimeo.com/video/'.$meta['id'].'?'.http_build_query($params); 84 93 $embed = "\n\t" . '<iframe src="'.$src.'" width="'.$size['width'].'" height="'.$size['height'].'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>' . "\n"; 85 94 break; 86 95 87 96 case 'youtube': 88 $theme = isset($options['youtube']['theme']) ? $options['youtube']['theme'] : 'dark'; 89 $color = isset($options['youtube']['color']) ? $options['youtube']['color'] : 'red'; 90 $jsapi = isset($options['youtube']['jsapi']) ? $options['youtube']['jsapi'] : '0&playerapiid=fvpyt'.$post_id; 91 $info = isset($options['youtube']['info']) ? $options['youtube']['info'] : 1; 92 $logo = isset($options['youtube']['logo']) ? $options['youtube']['logo'] : 1; 93 $rel = isset($options['youtube']['rel']) ? $options['youtube']['rel'] : 1; 94 $fs = isset($options['youtube']['fs']) ? $options['youtube']['fs'] : 1; 95 $wmode = isset($options['youtube']['wmode'])&& $options['youtube']['wmode'] != 'auto' ? '&wmode='.$options['youtube']['wmode'] : ''; 96 97 $src = 'http://www.youtube.com/embed/'.$meta['id'].'?theme='.$theme.$wmode.'&color='.$color.'&showinfo='.$info.'&modestbranding='.$logo.'&enablejsapi='.$jsapi.'&origin='.esc_attr(home_url()).'&rel='.$rel.'&fs='.$fs.'&start='.$meta['time'].'&autoplay='.$autoplay; 97 $option = $options['youtube']; 98 $params = array( 99 'origin' => esc_attr(home_url()), 100 'theme' => isset($option['theme']) ? $option['theme'] : 'dark', 101 'color' => isset($option['color']) ? $option['color'] : 'red', 102 'enablejsapi' => isset($option['jsapi']) ? $option['jsapi'] : null, 103 'showinfo' => isset($option['info']) ? $option['info'] : 1, 104 'modestbranding' => isset($option['logo']) ? $option['logo'] : 1, 105 'rel' => isset($option['rel']) ? $option['rel'] : 1, 106 'fs' => isset($option['fs']) ? $option['fs'] : 1, 107 'start' => isset($meta['time']) ? $meta['time'] : null, 108 'end' => isset($meta['end_time']) ? $meta['end_time'] : null, 109 'autoplay' => $autoplay, 110 'wmode' => isset($option['wmode']) && $option['wmode'] != 'auto' ? $option['wmode'] : null, 111 'playerapiid' => isset($option['jsapi']) && $option['jsapi'] == 1 ? 'fvpyt'.$post_id : null, 112 ); 113 114 $src = '//www.youtube.com/embed/'.$meta['id'].'?'.http_build_query($params); 98 115 $embed = "\n\t" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src="'.$src.'" type="text/html" frameborder="0" id="fvpyt'.$post_id.'"></iframe>' . "\n"; 99 116 break; 100 117 101 118 case 'dailymotion': 102 $foreground = isset($options['dailymotion']['foreground']) ? $options['dailymotion']['foreground'] : 'F7FFFD'; 103 $highlight = isset($options['dailymotion']['highlight']) ? $options['dailymotion']['highlight'] : 'FFC300'; 104 $background = isset($options['dailymotion']['background']) ? $options['dailymotion']['background'] : '171D1B'; 105 $logo = isset($options['dailymotion']['logo']) ? $options['dailymotion']['logo'] : 1; 106 $hideinfo = isset($options['dailymotion']['info']) ?1-$options['dailymotion']['info'] : 0; 107 $syndication = empty($options['dailymotion']['syndication']) ? '' : '&syndication='.$options['dailymotion']['syndication']; 108 109 $dm['src'] = 'http://www.dailymotion.com/embed/video/'.$meta['id'].'?logo='.$logo.'&hideInfos='.$hideinfo.'&foreground=%23'.$foreground.'&highlight=%23'.$highlight.'&background=%23'.$background.$syndication.'&start='.$meta['time'].'&autoplay='.$autoplay; 110 $embed = "\n" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src="'.$dm['src'].'" frameborder="0"></iframe>' . "\n"; 119 $option = $options['dailymotion']; 120 $params = array( 121 'foreground' => isset($option['foreground']) ? $option['foreground'] : null, 122 'highlight' => isset($option['highlight']) ? $option['highlight'] : null, 123 'background' => isset($option['background']) ? $option['background'] : null, 124 'logo' => isset($option['logo']) ? $option['logo'] : 1, 125 'hideInfos' => isset($option['info']) ? 1-$option['info'] : 0, 126 'syndication' => empty($option['syndication']) ? null : $option['syndication'], 127 'start' => $meta['time'] 128 ); 129 $src = '//www.dailymotion.com/embed/video/'.$meta['id'].'?'.http_build_query($params); 130 $embed = "\n" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src="'.$src.'" frameborder="0"></iframe>' . "\n"; 111 131 break; 112 132 113 133 case 'liveleak': 114 $embed = "\n" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src=" http://www.liveleak.com/ll_embed?f='.$meta['id'].'" frameborder="0" allowfullscreen></iframe>';134 $embed = "\n" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src="//www.liveleak.com/ll_embed?f='.$meta['id'].'" frameborder="0" allowfullscreen></iframe>'; 115 135 break; 116 136 117 137 case 'prochan': 118 $embed = "\n" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src=" http://www.prochan.com/embed?f='.$meta['id'].'" frameborder="0" allowfullscreen></iframe>';138 $embed = "\n" . '<iframe width="'.$size['width'].'" height="'.$size['height'].'" src="//www.prochan.com/embed?f='.$meta['id'].'" frameborder="0" allowfullscreen></iframe>'; 119 139 break; 120 140 -
featured-video-plus/trunk/php/settings.php
r831827 r982953 19 19 */ 20 20 function settings_init() { 21 add_settings_section('fvp-settings-section', __('Featured Videos', 'featured-video-plus'), array( &$this, 'settings_content' ),'media');22 23 add_settings_field('fvp-settings-usage', __('Usage', 'featured-video-plus'), array( &$this, 'settings_usage' ),'media', 'fvp-settings-section');24 add_settings_field('fvp-settings-autoplay', __('Autoplay', 'featured-video-plus'), array( &$this, 'settings_autoplay' ),'media', 'fvp-settings-section');25 add_settings_field('fvp-settings-sizing', __('Video Sizing', 'featured-video-plus'), array( &$this, 'settings_sizing' ),'media', 'fvp-settings-section');26 add_settings_field('fvp-settings-align', __('Video Align', 'featured-video-plus'), array( &$this, 'settings_align' ),'media', 'fvp-settings-section');27 add_settings_field('fvp-settings-local', __('Local Video Options', 'featured-video-plus'), array( &$this, 'settings_local' ),'media', 'fvp-settings-section');28 add_settings_field('fvp-settings-youtube', __('YouTube Options', 'featured-video-plus'), array( &$this, 'settings_youtube' ),'media', 'fvp-settings-section');29 add_settings_field('fvp-settings-vimeo', __('Vimeo Options', 'featured-video-plus'), array( &$this, 'settings_vimeo' ),'media', 'fvp-settings-section');30 add_settings_field('fvp-settings-dailymotion',__('Dailymotion Options', 'featured-video-plus'), 31 add_settings_field('fvp-settings-rate', __('Support', 'featured-video-plus'), array( &$this, 'settings_rate' ),'media', 'fvp-settings-section');21 add_settings_section('fvp-settings-section', 'media'); 22 23 add_settings_field('fvp-settings-usage', 'media', 'fvp-settings-section'); 24 add_settings_field('fvp-settings-autoplay', 'media', 'fvp-settings-section'); 25 add_settings_field('fvp-settings-sizing', 'media', 'fvp-settings-section'); 26 add_settings_field('fvp-settings-align', 'media', 'fvp-settings-section'); 27 add_settings_field('fvp-settings-local', 'media', 'fvp-settings-section'); 28 add_settings_field('fvp-settings-youtube', 'media', 'fvp-settings-section'); 29 add_settings_field('fvp-settings-vimeo', 'media', 'fvp-settings-section'); 30 add_settings_field('fvp-settings-dailymotion',__('Dailymotion Options', 'featured-video-plus'),array( &$this, 'settings_dailymotion' ),'media', 'fvp-settings-section'); 31 add_settings_field('fvp-settings-rate', 'media', 'fvp-settings-section'); 32 32 33 33 register_setting('media', 'fvp-settings', array( &$this, 'settings_save' )); … … 55 55 */ 56 56 function settings_usage() { 57 $options = get_option( 'fvp-settings' ); 58 $usage = isset($options['usage']) ? $options['usage'] : 'replace'; 57 $options = get_option( 'fvp-settings' ); 58 $usage = isset($options['usage']) ? $options['usage'] : 'replace'; 59 $issingle = isset($options['issingle']) ? $options['issingle'] : false; 59 60 ?> 60 61 62 63 64 61 65 62 66 <input type="radio" name="fvp-settings[usage]" id="fvp-settings-usage-1" value="replace" <?php checked( 'replace', $usage ) ?>/><label for="fvp-settings-usage-1"> <?php _e('Replace featured image automatically if possible', 'featured-video-plus'); ?> <span style="font-style: italic;">(<?php _e('default', 'featured-video-plus'); ?>)</span></label><br /> … … 79 83 */ 80 84 function settings_autoplay() { 81 $options 85 $options = get_option( 'fvp-settings' ); 82 86 $autoplay = isset($options['autoplay']) ? $options['autoplay'] : 'no'; 83 87 ?> 84 88 85 <input type="radio" name="fvp-settings[autoplay]" id="fvp-settings-autoplay-1" value="yes" <?php checked( 'yes', $autoplay) ?>/>89 <input type="radio" name="fvp-settings[autoplay]" id="fvp-settings-autoplay-1" value="yes" <?php checked() ?>/> 86 90 <label for="fvp-settings-autoplay-1"> <?php _e('yes', 'featured-video-plus'); ?></label> 87 <input type="radio" name="fvp-settings[autoplay]" id="fvp-settings-autoplay-2" value="auto" <?php checked( 'auto', $autoplay) ?>/>91 <input type="radio" name="fvp-settings[autoplay]" id="fvp-settings-autoplay-2" value="auto" <?php checked() ?>/> 88 92 <label for="fvp-settings-autoplay-2"> <?php _e('auto', 'featured-video-plus'); ?></label> 89 <input type="radio" name="fvp-settings[autoplay]" id="fvp-settings-autoplay-3" value="no" <?php checked( 'no', $autoplay) ?>/>93 <input type="radio" name="fvp-settings[autoplay]" id="fvp-settings-autoplay-3" value="no" <?php checked() ?>/> 90 94 <label for="fvp-settings-autoplay-2"> <?php _e('no', 'featured-video-plus'); ?> <span style="font-style: italic;">(<?php _e('default', 'featured-video-plus'); ?>)</span></label> 91 95 … … 140 144 $align = isset($options['align']) ? $options['align'] : 'center'; ?> 141 145 142 <input type="radio" name="fvp-settings[align]" id="fvp-settings-align-1" value="left" <?php checked( 'left', $align, true) ?>/><label for="fvp-settings-align-1"> <?php _e('left', 'featured-video-plus'); ?></label> 143 <input type="radio" name="fvp-settings[align]" id="fvp-settings-align-2" value="center" <?php checked( 'center',$align, true) ?>/><label for="fvp-settings-align-2"> <?php _e('center', 'featured-video-plus'); ?> <span style="font-style: italic;">(<?php _e('default', 'featured-video-plus'); ?>)</span></label> 144 <input type="radio" name="fvp-settings[align]" id="fvp-settings-align-3" value="right" <?php checked( 'right', $align, true) ?>/><label for="fvp-settings-align-3"> <?php _e('right', 'featured-video-plus'); ?></label>146 <input type="radio" name="fvp-settings[align]" id="fvp-settings-align-1" value="left" ) ?>/><label for="fvp-settings-align-1"> <?php _e('left', 'featured-video-plus'); ?></label> 147 <input type="radio" name="fvp-settings[align]" id="fvp-settings-align-2" value="center" <?php checked() ?>/><label for="fvp-settings-align-2"> <?php _e('center', 'featured-video-plus'); ?> <span style="font-style: italic;">(<?php _e('default', 'featured-video-plus'); ?>)</span></label> 148 <input type="radio" name="fvp-settings[align]" id="fvp-settings-align-3" value="right") ?>/><label for="fvp-settings-align-3"> <?php _e('right', 'featured-video-plus'); ?></label> 145 149 146 150 <?php } … … 152 156 function settings_local() { 153 157 $options = get_option( 'fvp-settings' ); 154 $local['poster'] = isset($options['local']['poster'])? $options['local']['poster'] : false;155 $local['loop'] = isset($options['local']['loop'])? $options['local']['loop'] : false; ?>156 157 <input type="checkbox" name="fvp-settings[local][poster]" id="fvp-settings-local-poster" value="true" <?php checked( true, $local['poster'], 1) ?>/><label for="fvp-settings-local-poster"> <?php _e('Use featured image as video thumbnail', 'featured-video-plus'); ?></label> 158 <input type="checkbox" name="fvp-settings[local][loop]" id="fvp-settings-local-loop" value="true" <?php checked( true, $local['loop'], 1 ) ?>/><label for="fvp-settings-local-loop"> <?php _e('Loop videos', 'featured-video-plus'); ?></label> 158 $local['poster'] ? $options['local']['poster'] : false; 159 $local['loop'] ? $options['local']['loop'] : false; ?> 160 161 <input type="checkbox" name="fvp-settings[local][poster]" ) ?>/><label for="fvp-settings-local-poster"> <?php _e('Use featured image as video thumbnail', 'featured-video-plus'); ?></label> 162 <input type="checkbox" name="fvp-settings[local][loop]" 159 163 160 164 <?php } … … 168 172 function settings_youtube() { 169 173 $options = get_option( 'fvp-settings' ); 170 $youtube['theme'] = isset($options['youtube']['theme']) ? $options['youtube']['theme'] 171 $youtube['color'] = isset($options['youtube']['color']) ? $options['youtube']['color'] 172 $youtube['wmode'] = isset($options['youtube']['wmode']) ? $options['youtube']['wmode'] 173 $youtube['jsapi'] = isset($options['youtube']['jsapi']) ? $options['youtube']['jsapi'] 174 $youtube['info'] = isset($options['youtube']['info']) ? $options['youtube']['info']: 1;175 $youtube['logo'] = isset($options['youtube']['logo']) ? $options['youtube']['logo']: 1;176 $youtube['rel'] = isset($options['youtube']['rel']) ? $options['youtube']['rel']: 1;177 $youtube['fs'] = isset($options['youtube']['fs']) ? $options['youtube']['fs']: 1; ?>178 179 <input type="checkbox" name="fvp-settings[youtube][theme]" id="fvp-settings-youtube-theme" value="light" <?php checked( 'light', $youtube['theme'],1 ) ?>/><label for="fvp-settings-youtube-theme"> <?php _e('Light Theme','featured-video-plus'); ?></label> 180 <input type="checkbox" name="fvp-settings[youtube][fs]" id="fvp-settings-youtube-fs" value="true" <?php checked( 1, $youtube['fs'], 1 ) ?>/><label for="fvp-settings-youtube-fs"> <?php_e('Fullscreen Button', 'featured-video-plus'); ?></label> 174 $youtube['theme'] = isset($options['youtube']['theme']) ? $options['youtube']['theme'] : 'dark'; 175 $youtube['color'] = isset($options['youtube']['color']) ? $options['youtube']['color'] : 'red'; 176 $youtube['wmode'] = isset($options['youtube']['wmode']) ? $options['youtube']['wmode'] : 'auto'; 177 $youtube['jsapi'] = isset($options['youtube']['jsapi']) ? $options['youtube']['jsapi'] : 0; 178 $youtube['info'] : 1; 179 $youtube['logo'] : 1; 180 $youtube['rel'] : 1; 181 $youtube['fs'] : 1; ?> 182 183 <input type="checkbox" name="fvp-settings[youtube][theme]" id="fvp-settings-youtube-theme" value="light" 'featured-video-plus'); ?></label> 184 <input type="checkbox" name="fvp-settings[youtube][fs]" _e('Fullscreen Button', 'featured-video-plus'); ?></label> 181 185 <select name="fvp-settings[youtube][wmode]" id="fvp-settings-youtube-wmode" size="1"> 182 <option<?php selected($youtube['wmode'],'auto'); 186 <option<?php selected($youtube['wmode'],'auto'); ?>>auto</option> 183 187 <option<?php selected($youtube['wmode'],'transparent'); ?>>transparent</option> 184 <option<?php selected($youtube['wmode'],'opaque'); 188 <option<?php selected($youtube['wmode'],'opaque'); ?>>opaque</option> 185 189 </select> 186 190 <label for="fvp-settings-youtube-wmode">"wmode"</label> 187 191 <br /> 188 <input type="checkbox" name="fvp-settings[youtube][info]" id="fvp-settings-youtube-info" value="true" <?php checked( 1, $youtube['info'], 1 ) ?>/><label for="fvp-settings-youtube-info"> <?php _e('Info','featured-video-plus'); ?></label> 189 190 <input type="checkbox" name="fvp-settings[youtube][rel]" id="fvp-settings-youtube-rel" value="true" <?php checked( 1, $youtube['rel'], 1 ) ?>/><label for="fvp-settings-youtube-rel"> <?php _e('Related Videos','featured-video-plus'); ?></label> 191 <input type="checkbox" name="fvp-settings[youtube][jsapi]" id="fvp-settings-youtube-jsapi" value="true" <?php checked( 1, $youtube['jsapi'],1 ) ?>/><label for="fvp-settings-youtube-jsapi"> <?php _e('Javascript API','featured-video-plus'); ?></label> 192 <input type="checkbox" name="fvp-settings[youtube][color]" id="fvp-settings-youtube-color" value="white" <?php checked( 'white',$youtube['color'],1 ) ?>/><label for="fvp-settings-youtube-color"> <?php _e('White Progressbar','featured-video-plus'); ?></label> 192 <input type="checkbox" name="fvp-settings[youtube][info]" 'featured-video-plus'); ?></label> 193 194 <input type="checkbox" name="fvp-settings[youtube][rel]" 'featured-video-plus'); ?></label> 195 <input type="checkbox" name="fvp-settings[youtube][jsapi]" 'featured-video-plus'); ?></label> 196 <input type="checkbox" name="fvp-settings[youtube][color]" 'featured-video-plus'); ?></label> 193 197 <span id="youtube_logoinput_wrapper"<?php if($youtube['color'] != 'red') echo ' class="fvp_hidden"'; ?>> 194 <input type="checkbox" name="fvp-settings[youtube][logo]" id="fvp-settings-youtube-logo" value="true" <?php checked( 1, $youtube['logo'], 1) ?>/><label for="fvp-settings-youtube-logo"> <?php _e('Logo', 'featured-video-plus'); ?></label>198 <input type="checkbox" name="fvp-settings[youtube][logo]" id="fvp-settings-youtube-logo" ) ?>/><label for="fvp-settings-youtube-logo"> <?php _e('Logo', 'featured-video-plus'); ?></label> 195 199 </span> 196 200 … … 208 212 function settings_vimeo() { 209 213 $options = get_option( 'fvp-settings' ); 210 $vimeo['portrait'] = isset($options['vimeo']['portrait'])? $options['vimeo']['portrait'] : 0;211 $vimeo['title' ] = isset($options['vimeo']['title' ]) ? $options['vimeo']['title' ]: 1;212 $vimeo['byline'] = isset($options['vimeo']['byline']) ? $options['vimeo']['byline']: 1;213 $vimeo['color' ] = isset($options['vimeo']['color' ]) ? $options['vimeo']['color' ]: '00adef'; ?>214 $vimeo['portrait']? $options['vimeo']['portrait'] : 0; 215 $vimeo['title' ] : 1; 216 $vimeo['byline'] : 1; 217 $vimeo['color' ] : '00adef'; ?> 214 218 215 219 <div style="position: relative; bottom: .6em;"> 216 <input type="checkbox" name="fvp-settings[vimeo][portrait]" id="fvp-settings-vimeo-1" value="display" <?php checked( 1, $vimeo['portrait'], 1) ?>/><label for="fvp-settings-vimeo-1"> <?php _e('Portrait', 'featured-video-plus'); ?></label> 217 <input type="checkbox" name="fvp-settings[vimeo][title]" id="fvp-settings-vimeo-2" value="display" <?php checked( 1, $vimeo['title'], 1) ?>/><label for="fvp-settings-vimeo-2"> <?php _e('Title', 'featured-video-plus'); ?></label> 218 <input type="checkbox" name="fvp-settings[vimeo][byline]" id="fvp-settings-vimeo-3" value="display" <?php checked( 1, $vimeo['byline'], 1) ?>/><label for="fvp-settings-vimeo-3"> <?php _e('Byline', 'featured-video-plus'); ?></label> 219 <span class="color-picker" style="position: relative;<?php if( wp_style_is( 'wp-color-picker', 'done') ) echo ' top: .6em;'; ?>" >220 <input type="checkbox" name="fvp-settings[vimeo][portrait]" id="fvp-settings-vimeo-1" value="display" <?php checked() ?>/><label for="fvp-settings-vimeo-1"> <?php _e('Portrait', 'featured-video-plus'); ?></label> 221 <input type="checkbox" name="fvp-settings[vimeo][title]" ) ?>/><label for="fvp-settings-vimeo-2"> <?php _e('Title', 'featured-video-plus'); ?></label> 222 <input type="checkbox" name="fvp-settings[vimeo][byline]" ) ?>/><label for="fvp-settings-vimeo-3"> <?php _e('Byline', 'featured-video-plus'); ?></label> 223 <span class="color-picker" style="position: relative;<?php if( wp_style_is() ) echo ' top: .6em;'; ?>" > 220 224 <input type="text" name="fvp-settings[vimeo][color]" id="fvp-settings-vimeo-color" class="fvp_colorpicker_input" value="#<?php echo $vimeo['color'] ?>" data-default-color="#00adef" /> 221 225 <label for="fvp-settings-vimeo-color" style="display: none;"> <?php _e('Color', 'featured-video-plus'); ?></label> 222 <?php if( ! wp_style_is('wp-color-picker', 'registered') ) { ?><div class="fvp_colorpicker" id="fvp-settings-vimeo-colorpicker"></div><?php } ?>226 <?php if( !) ) { ?><div class="fvp_colorpicker" id="fvp-settings-vimeo-colorpicker"></div><?php } ?> 223 227 </span> 224 228 </div> … … 238 242 function settings_dailymotion() { 239 243 $options = get_option( 'fvp-settings' ); 240 $dailymotion['logo'] = isset($options['dailymotion']['logo']) ? $options['dailymotion']['logo']: 1;241 $dailymotion['info'] = isset($options['dailymotion']['info']) ? $options['dailymotion']['info']: 1;242 $dailymotion['synd'] = isset($options['dailymotion']['synd'])? $options['dailymotion']['syndication']: '';243 $dailymotion['foreground'] = isset($options['dailymotion']['foreground'])? $options['dailymotion']['foreground'] : 'f7fffd';244 $dailymotion['highlight' ] = isset($options['dailymotion']['highlight' ])? $options['dailymotion']['highlight' ] : 'ffc300';245 $dailymotion['background'] = isset($options['dailymotion']['background'])? $options['dailymotion']['background'] : '171d1b'; ?>246 247 <input type="checkbox" name="fvp-settings[dailymotion][logo]" id="fvp-settings-dailymotion-logo" value="display" <?php checked( 1, $dailymotion['logo'], 1 ) ?>/><label for="fvp-settings-dailymotion-logo"> <?php _e('Logo', 'featured-video-plus'); ?></label> 248 <input type="checkbox" name="fvp-settings[dailymotion][info]" id="fvp-settings-dailymotion-info" value="display" <?php checked( 1, $dailymotion['info'], 1 ) ?>/><label for="fvp-settings-dailymotion-info"> <?php _e('Videoinfo', 'featured-video-plus'); ?></label> 249 <input type="text" name="fvp-settings[dailymotion][synd]" id="fvp-settings-dailymotion-synd" value="<?php echo $dailymotion['synd']; ?>" size="6" /><label for="fvp-settings-dailymotion-synd"> <?php _e('Syndication Key', 'featured-video-plus'); ?></label>244 $dailymotion['logo'] : 1; 245 $dailymotion['info'] : 1; 246 $dailymotion['synd'] ? $options['dailymotion']['syndication']: ''; 247 $dailymotion['foreground']= isset($options['dailymotion']['foreground'])? $options['dailymotion']['foreground'] : 'f7fffd'; 248 $dailymotion['highlight' ]= isset($options['dailymotion']['highlight' ])? $options['dailymotion']['highlight' ] : 'ffc300'; 249 $dailymotion['background']= isset($options['dailymotion']['background'])? $options['dailymotion']['background'] : '171d1b'; ?> 250 251 <input type="checkbox" <label for="fvp-settings-dailymotion-logo"> <?php _e('Logo', 'featured-video-plus'); ?></label> 252 <input type="checkbox" <label for="fvp-settings-dailymotion-info"> <?php _e('Videoinfo', 'featured-video-plus'); ?></label> 253 <input type="text" <label for="fvp-settings-dailymotion-synd"> <?php _e('Syndication Key', 'featured-video-plus'); ?></label> 250 254 <br /> 251 <span class="color-picker" style="position: relative;<?php if( wp_style_is( 'wp-color-picker', 'done') ) echo ' top: .6em;'; ?>" >255 <span class="color-picker" style="position: relative;<?php if( wp_style_is() ) echo ' top: .6em;'; ?>" > 252 256 <input type="text" name="fvp-settings[dailymotion][foreground]" id="fvp-settings-dailymotion-foreground" class="fvp_colorpicker_input" value="#<?php echo $dailymotion['foreground'] ?>" data-default-color="#f7fffd" /> 253 257 <label for="fvp-settings-dailymotion-foreground" style="display: none;"> <?php _e('Foreground', 'featured-video-plus'); ?></label> 254 258 <?php if( !wp_style_is('wp-color-picker', 'registered' ) ) { ?><div class="fvp_colorpicker" id="fvp-settings-dailymotion-foreground-colorpicker"></div><?php } ?> 255 259 </span> 256 <span class="color-picker" style="position: relative;<?php if( wp_style_is( 'wp-color-picker', 'done') ) echo ' top: .6em;'; ?>" >260 <span class="color-picker" style="position: relative;<?php if( wp_style_is() ) echo ' top: .6em;'; ?>" > 257 261 <input type="text" name="fvp-settings[dailymotion][highlight]" id="fvp-settings-dailymotion-highlight" class="fvp_colorpicker_input" value="#<?php echo $dailymotion['highlight'] ?>" data-default-color="#ffc300" /> 258 262 <label for="fvp-settings-dailymotion-highlight" style="display: none;"> <?php _e('Highlight', 'featured-video-plus'); ?></label> 259 263 <?php if( !wp_style_is('wp-color-picker', 'registered' ) ) { ?><div class="fvp_colorpicker" id="fvp-settings-dailymotion-highlight-colorpicker"></div><?php } ?> 260 264 </span> 261 <span class="color-picker" style="position: relative;<?php if( wp_style_is( 'wp-color-picker', 'done') ) echo ' top: .6em;'; ?>" >265 <span class="color-picker" style="position: relative;<?php if( wp_style_is() ) echo ' top: .6em;'; ?>" > 262 266 <input type="text" name="fvp-settings[dailymotion][background]" id="fvp-settings-dailymotion-background" class="fvp_colorpicker_input" value="#<?php echo $dailymotion['background'] ?>" data-default-color="#171d1b" /> 263 267 <label for="fvp-settings-dailymotion-background" style="display: none;"> <?php _e('Background', 'featured-video-plus'); ?></label> … … 279 283 printf( 280 284 __('If you have found a bug or are missing a specific video service, please %slet me know%s in the support forum. Elsewise, if you like the plugin: Please %srate it!%s', 'featured-video-plus'), 281 '<a href="http://wordpress.org/support/plugin/featured-video-plus#plugin-title" title="Featured Video Plus Support Forum on WordPress.org"target="_blank" style="font-weight: bold;">', '</a>',282 '<a href="http://wordpress.org/support/view/plugin-reviews/featured-video-plus#plugin-title" title="Rate Featured Video Plus on WordPress.org"target="_blank" style="font-weight: bold;">', '</a>'285 '<a href="http://wordpress.org/support/plugin/featured-video-plus#plugin-title" target="_blank" style="font-weight: bold;">', '</a>', 286 '<a href="http://wordpress.org/support/view/plugin-reviews/featured-video-plus#plugin-title" target="_blank" style="font-weight: bold;">', '</a>' 283 287 ); 284 288 echo '</p>'; … … 296 300 297 301 // Usage 298 $options['usage'] = isset($input['usage']) ? $input['usage'] : 'replace'; 302 $options['usage'] = isset($input['usage']) ? $input['usage'] : 'replace'; 303 $options['issingle'] = ! empty($input['issingle']) ? true : false; 299 304 300 305 // Sizing 301 306 if(isset($input['sizing']['width' ]['fixed'])) { 302 preg_match($numbers, $input['sizing']['width' ]['fixed'], $width);303 $options['sizing']['width' ] = isset($width[ 307 preg_match($numbers, $input['sizing']['width'); 308 $options['sizing']['width' ] = isset($width[0]) ? $width[ 0] : 560; 304 309 } 305 310 if(isset($input['sizing']['height' ]['fixed'])) { … … 307 312 $options['sizing']['height'] = isset($height[0]) ? $height[0] : 315; 308 313 } 309 $options['sizing']['wmode' ] = isset($input['sizing']['width' ]['auto']) ? 'auto': 'fixed';310 $options['sizing']['hmode' ] = isset($input['sizing']['height' ]['auto'])? 'auto': 'fixed';314 $options['sizing']['wmode' ] = isset($input['sizing']['width' ]['auto']): 'fixed'; 315 $options['sizing']['hmode' ] = isset($input['sizing']['height': 'fixed'; 311 316 312 317 // Align … … 314 319 315 320 // Autoplay 316 $options['autoplay'] = isset( $input['autoplay'] ) 321 $options['autoplay'] = isset( $input['autoplay'] ) ? $input['autoplay'] : 'no'; //yes/auto/no 317 322 318 323 // Local 319 $options['local']['poster'] = isset( $input['local']['poster'] )? true : false;320 $options['local']['loop'] = isset( $input['local']['loop'] )? true : false;324 $options['local']['poster']? true : false; 325 $options['local']['loop']? true : false; 321 326 322 327 // YouTube 323 $options['youtube'][' theme'] = isset($input['youtube']['theme']) && ( $input['youtube']['theme'] == 'light') ? 'light' : 'dark';324 $options['youtube'][' color'] = isset($input['youtube']['color']) && ( $input['youtube']['color'] == 'white') ? 'white' : 'red';325 $options['youtube'][' wmode'] = isset($input['youtube']['wmode']) ? $input['youtube']['wmode'] : 'auto';326 $options['youtube']['jsapi'] 327 $options['youtube']['info'] = isset($input['youtube']['info']) && ( $input['youtube']['info']== 'true' ) ? 1 : 0;328 $options['youtube']['logo'] = isset($input['youtube']['logo']) && ( $input['youtube']['logo']== 'true' ) ? 1 : 0;329 $options['youtube']['rel'] = isset($input['youtube']['rel']) && ( $input['youtube']['rel']== 'true' ) ? 1 : 0;330 $options['youtube']['fs'] = isset($input['youtube']['fs']) && ( $input['youtube']['fs']== 'true' ) ? 1 : 0;328 $options['youtube'][''; 329 $options['youtube'][''; 330 $options['youtube'][''; 331 $options['youtube']['jsapi'] = isset($input['youtube']['jsapi']) && ( $input['youtube']['jsapi'] == 'true' ) ? 1 : 0; 332 $options['youtube']['info'] == 'true' ) ? 1 : 0; 333 $options['youtube']['logo'] == 'true' ) ? 1 : 0; 334 $options['youtube']['rel'] == 'true' ) ? 1 : 0; 335 $options['youtube']['fs'] == 'true' ) ? 1 : 0; 331 336 332 337 // Vimeo 333 $options['vimeo']['portrait'] = isset($input['vimeo']['portrait']) && ( $input['vimeo']['portrait'] == 'display' ) ? 1 : 0;334 $options['vimeo']['title'] = isset($input['vimeo']['title']) && ( $input['vimeo']['title']== 'display' ) ? 1 : 0;335 $options['vimeo']['byline'] = isset($input['vimeo']['byline']) && ( $input['vimeo']['byline']== 'display' ) ? 1 : 0;338 $options['vimeo']['portrait'] = isset($input['vimeo']['portrait'])&& ( $input['vimeo']['portrait'] == 'display' ) ? 1 : 0; 339 $options['vimeo']['title'] == 'display' ) ? 1 : 0; 340 $options['vimeo']['byline'] == 'display' ) ? 1 : 0; 336 341 337 342 if( isset($options['vimeo']['color']) ) preg_match($hexcolor, $input['vimeo']['color'], $vimeocolor); … … 339 344 340 345 // Dailymotion 341 $options['dailymotion']['logo'] 342 $options['dailymotion']['info'] 343 $options['dailymotion']['syndication'] = isset($input['dailymotion']['synd']) && !empty($input['dailymotion']['synd']) ? $input['dailymotion']['synd'] : '';346 $options['dailymotion']['logo'] = isset($input['dailymotion']['logo']) && ( $input['dailymotion']['logo'] == 'display' ) ? 1 : 0; 347 $options['dailymotion']['info'] = isset($input['dailymotion']['info']) && ( $input['dailymotion']['info'] == 'display' ) ? 1 : 0; 348 $options['dailymotion']['syndication']= isset($input['dailymotion']['synd']) && !empty($input['dailymotion']['synd']) ? $input['dailymotion']['synd'] : ''; 344 349 345 350 if( isset($options['dailymotion']['foreground']) ) preg_match($hexcolor, $input['dailymotion']['foreground'], $dm_foreground); … … 347 352 if( isset($options['dailymotion']['background']) ) preg_match($hexcolor, $input['dailymotion']['background'], $dm_background); 348 353 $options['dailymotion']['foreground'] = isset($dm_foreground[1]) && !empty($dm_foreground[1])? $dm_foreground[1] : 'f7fffd'; 349 $options['dailymotion']['highlight'] 354 $options['dailymotion']['highlight'] = isset($dm_highlight[ 1]) && !empty($dm_highlight[ 1])? $dm_highlight[ 1] : 'ffc300'; 350 355 $options['dailymotion']['background'] = isset($dm_background[1]) && !empty($dm_background[1])? $dm_background[1] : '171d1b'; 351 356 … … 410 415 // PHP FUNCTIONS HELP TAB 411 416 $screen->add_help_tab( array( 412 'id' 417 'id' => 'fvp_help_functions', 413 418 'title' => 'Featured Video Plus: '.__('PHP-Functions','featured-video-plus'), 414 419 'content' => $this->help_functions -
featured-video-plus/trunk/php/upgrade.php
r831827 r982953 117 117 118 118 case '1.8': 119 unset( 120 $options['local']['cdn'], 121 $options['local']['enabled'], 122 $options['local']['foreground'], 123 $options['local']['background'], 119 unset( 120 $options['local']['cdn'], 121 $options['local']['enabled'], 122 $options['local']['foreground'], 123 $options['local']['background'], 124 124 $options['local']['controls'] 125 125 ); … … 142 142 } 143 143 144 145 144 146 145 // ************************************************************* 147 148 // ************************************************************* 146 149 default: 147 150 $options['version'] = FVP_VERSION; -
featured-video-plus/trunk/readme.txt
r831827 r982953 2 2 Contributors: a.hoereth 3 3 Plugin Name: Featured Video Plus 4 Plugin URI: http://yrnxt.com/ category/wordpress/featured-video-plus/4 Plugin URI: http://yrnxt.com/wordpress/featured-video-plus/ 5 5 Tags: featured, post, video, image, thumbnail, html5, flash, youtube, vimeo, dailymotion, mp4, webm, ogg, embed, ajax 6 6 Author: Alexander Höreth 7 7 Author URI: http://yrnxt.com/ 8 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_ donations&business=a%2ehoereth%40gmail%2ecom8 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_ 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 11 Requires at least: 3.2 12 Tested up to: 3.913 Stable tag: 1.9 12 Tested up to: 13 Stable tag: 1.9 14 14 15 15 Add Featured Videos to your posts and pages. Works like magic with most themes which use Featured Images. Local Media, YouTube, Vimeo, Dailymotion. … … 65 65 == Changelog == 66 66 67 68 69 70 71 72 67 73 68 74 = 1.9: 2014-01-02 = … … 196 202 197 203 = How can I translate the plugin? = 198 Gra p the [featured-video-plus.pot](https://github.com/ahoereth/featured-video-plus/blob/master/lng/featured-video-plus.pot) file, [translate it](http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/) and post it in the [Support Forum](http://wordpress.org/support/plugin/featured-video-plus). It will very likbe shipped with the next version.204 Gra be shipped with the next version.
Note: See TracChangeset
for help on using the changeset viewer.