Changeset 791973
- Timestamp:
- 10/22/2013 07:41:05 PM (12 years ago)
- Location:
- blue-wrench-videos-widget/trunk
- Files:
-
- 6 added
- 4 edited
-
bluewrench-video-controller.php (modified) (3 diffs)
-
bluewrench-video-widget.php (modified) (5 diffs)
-
bw_script.js (added)
-
class-bluewrench-video-controller.php (modified) (4 diffs)
-
images/ajax-loader.gif (added)
-
readme.txt (modified) (2 diffs)
-
screenshot-1.png (added)
-
screenshot-2.png (added)
-
screenshot-3.png (added)
-
screenshot-4.png (added)
Legend:
- Unmodified
- Added
- Removed
-
blue-wrench-videos-widget/trunk/bluewrench-video-controller.php
r791356 r791973 199 199 $visibility = "Hidden"; 200 200 } 201 $video_preview = $bwMediaController->generateEmbeddHTML($value);202 //p($video_preview);201 //$video_preview = $bwMediaController->generateEmbeddHTML($value); 202 $video_preview = "<div style='height:".$bwMediaController->videoheight."px; width:".$bwMediaController->videowidth."px'><img style='margin-top:".intval($bwMediaController->videoheight/2-11)."px; margin-left:".intval($bwMediaController->videowidth/2-11)."px;' src='".plugin_dir_url( __FILE__ ) . '/images/ajax-loader.gif'."'></div>"; 203 203 $sortorder = $result->sortorder; 204 204 if ($visibility=='Shown'){ … … 222 222 <td><?php echo $rowCount; ?></td> 223 223 <td><?php echo $sName; ?></td> 224 <td><a href="javascript: void(0);" onclick='javascript: jQuery("#prev_<?php echo $id;?>").slideToggle();'><?php echo $value; ?></a><div class="bw_preview_container" id='prev_<?php echo $id;?>' style="display:none;"><?php echo $video_preview;?></div></td>224 <td><a href="javascript: void(0);" onclick='javascript: bw_slideToggle(<?php echo $id;?>);'><?php echo $value; ?></a><div class="bw_preview_container" id='prev_<?php echo $id;?>' style="display:none;"><?php echo $video_preview;?></div></td> 225 225 <td><?php echo $visibility; ?></td> 226 226 … … 280 280 $results = $wpdb->get_results($sql); 281 281 if(count($results) > 0){ 282 //$err = new WP_Error('broke', __('ERROR: Video URL already found in the database.'));283 //p($err);284 285 //echo ( __('ERROR: Video URL already found in the database.') );286 282 return -2; 287 283 }else{ -
blue-wrench-videos-widget/trunk/bluewrench-video-widget.php
r791356 r791973 3 3 Plugin Name: Blue Wrench Video Widget 4 4 Plugin URI: http://bluewrenchsoftware.com/wordpress-plugins/bluewrench-video-widget/ 5 Description: Blue Wrench Video Widget to display videos from various video sharing networks such as Vimeo, YouTube, Metacafe etc into your widget box. Simply copy the video's URL from your web browser's address bar and paste it in 'Add new video' page and add 'Blue Wrench Video Widget' from WP-Admin >> Appearance >> Widgets to desired area. Supported Networks: Vimeo, YouTube, BlipTV, Dailymotion, Veoh, Metacafe and MeFeedia6 Version: 1.0. 05 Description: Blue Wrench Video Widget to display videos from various video sharing networks such as Vimeo, YouTube, Metacafe etc into your widget box. Simply copy the video's URL from your web browser's address bar and paste it in 'Add new video' page and add 'Blue Wrench Video Widget' from WP-Admin >> Appearance >> Widgets to desired area. Supported Networks: Vimeo, YouTube, BlipTV, Dailymotion, Veoh, Metacafe, MeFeedia and Break 6 Version: 1.0.2 7 7 Author: Sunil Nanda 8 8 Author URI: http://www.sunilnanda.com/ … … 16 16 define('BW_DIR_NAME', basename(BW_FILE_PATH)); 17 17 if (!defined('BW_VERSION_NUM')) 18 define('BW_VERSION_NUM', '1.0. 0');18 define('BW_VERSION_NUM', '1.0.2'); 19 19 20 20 global $wpdb; … … 47 47 if (is_admin()) { 48 48 wp_enqueue_script('jquery'); 49 wp_register_script( 'bw_ajax_script', plugins_url( '/bw_script.js', __FILE__ ), array('jquery')); 50 wp_localize_script( 'bw_ajax_script', 'bwAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php'))); 51 wp_enqueue_script( 'bw_ajax_script' ); 49 52 wp_register_style ( 'bw-plugin-jquery-ui', plugin_dir_url( __FILE__ ) . 'jquery-ui.css' ); 50 53 wp_enqueue_style( 'bw-plugin-jquery-ui' ); … … 82 85 } 83 86 87 function fetch_video_embedd_html(){ 88 if (isset($_REQUEST['vid']) && $_REQUEST['vid']!=""){ 89 $vid = $_REQUEST['vid']; 90 global $wpdb; 91 $sql = "SELECT * FROM ".BW_TABLE_PREFIX."videos where id='".$vid."' limit 1"; 92 $results = $wpdb->get_results($sql); 93 if (is_array($results) && count($results)>0){ 94 $bwMediaController = new BlueWrenchMediaController(); 95 $video_row = array_pop($results); 96 $video_url = $video_row->value; 97 $video_preview = $bwMediaController->generateEmbeddHTML($video_url); 98 //bw_filter_allowed_http_origins(); 99 echo $video_preview; 100 die(); 101 } 102 } 103 } 104 84 105 register_activation_hook(__FILE__,'bw_install'); 85 106 register_deactivation_hook(__FILE__ , 'bw_uninstall' ); … … 87 108 add_action('admin_menu', 'bw_admin_menu'); 88 109 add_action('widgets_init', 'load_bw_video_widgets'); //action to initiate widgets 110 add_action('wp_ajax_fetch_video_embedd_html', 'fetch_video_embedd_html'); // Call when user logged in 89 111 90 112 ?> -
blue-wrench-videos-widget/trunk/class-bluewrench-video-controller.php
r791356 r791973 7 7 $this->videowidth = $videowidth; 8 8 $this->videoheight = $videoheight; 9 $this->videoid = 0; 10 } 11 function wp_get_http_headers( $url, $deprecated = false ) { 12 if ( !empty( $deprecated ) ) 13 _deprecated_argument( __FUNCTION__, '2.7' ); 14 15 $response = wp_safe_remote_head( $url ); 16 17 if ( is_wp_error( $response ) ) 18 return false; 19 20 return wp_remote_retrieve_headers( $response ); 21 } 22 function fetch_vimeo_id($url) { 23 $headers = $this->wp_get_http_headers($url, array('timeout' => 10, 'sslverify' => false) ); 24 if (is_array($headers) && count($headers) > 0){ 25 if (array_key_exists("location",$headers)){ 26 $location = $headers["location"]; 27 return str_replace("/","",$location); 28 } 29 } 30 # Could not find id 31 return null; 9 32 } 10 33 function generateEmbeddHTML($video_url=''){ … … 24 47 if ($url_chunks['host']=="player.vimeo.com"){ 25 48 $video_url = $url_chunks['scheme'].'://player.vimeo.com'.$url_chunks['path']; 49 }else if ($url_chunks['host']=="vimeo.com"){ 50 $video_url = $url_chunks['scheme']."://".$url_chunks['host'].$url_chunks['path']; 51 $video_id = $this->fetch_vimeo_id($video_url); 52 if ($video_id){ 53 $video_url = $url_chunks['scheme'].'://player.vimeo.com/video/'.$video_id; 54 }else{ 55 $location = $url_chunks['path']; 56 $video_id = str_replace("/","",$location); 57 if ($video_id){ 58 $video_url = $url_chunks['scheme'].'://player.vimeo.com/video/'.$video_id; 59 } 60 } 26 61 }else{ 27 62 $video_url = $url_chunks['scheme'].'://player.vimeo.com/video'.$url_chunks['path']; … … 88 123 $network = 'veoh'; 89 124 break; 125 case 'www.break.com': 126 $path = $url_chunks['path']; 127 $pos = strpos($path, "/video/"); 128 if ($pos !== false){ 129 $v_arr = preg_split("/[\/]+/",$path); 130 if (is_array($v_arr) && count($v_arr)>0){ 131 $v_id = array_pop($v_arr); 132 if ($v_id!=""){ 133 $v_arr = preg_split("/[\-]+/",$path); 134 if (is_array($v_arr) && count($v_arr)>0){ 135 $video_id = array_pop($v_arr); 136 $video_url = "http://www.break.com/embed/".$video_id; 137 } 138 } 139 } 140 } 141 $network = 'break'; 142 break; 143 case 'screen.yahoo.com': 144 case 'news.yahoo.com': 145 $network = 'yahoo'; 146 break; 90 147 default: 91 p($url_chunks); 148 echo "<pre>"; 149 print_r($url_chunks); 150 echo "</pre>"; 92 151 //$video_url = $url; 93 152 break; … … 97 156 switch ($network){ 98 157 case 'vimeo': 158 $video_preview = '<iframe src="'.$video_url.'" width="'.$this->videowidth.'" height="'.$this->videoheight.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'; 159 break; 99 160 case 'metacafe': 161 case 'break': 162 case 'yahoo': 100 163 $video_preview = '<iframe src="'.$video_url.'" width="'.$this->videowidth.'" height="'.$this->videoheight.'" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>'; 101 164 break; -
blue-wrench-videos-widget/trunk/readme.txt
r791435 r791973 6 6 Requires at least: 2.8.1 7 7 Tested up to: 3.6 8 Stable tag: 1.0. 18 Stable tag: 1.0.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 31 31 1. Visit Plugins > Add New > Upload in WordPress admin 32 2. Upload blue-wrench-videos-widget.1.0. 1.zip file32 2. Upload blue-wrench-videos-widget.1.0.2.zip file 33 33 3. Once uploaded, click Activate Plugin link 34 34 35 35 36 == Screenshots == 37 38 1. The Add video screen. 39 2. List of added videos. Click on video url to see preview of your video. Use arrows to re-arrange the display order. You can hide any video in the widget area. 40 3. Insert Blue Wrench Video Widget to any available Widget area, for example, in Main sidebar. You can set video iframe width and height. Display or hide video captions in widget area. 41 4. Blue Wrench Video Widget added to sidebar. 42 43 36 44 == Changelog == 45 46 = 1.0.2 = 47 * Fixed Vimeo video embedd code issues 48 * Added Screenshots 37 49 38 50 = 1.0.1 =
Note: See TracChangeset
for help on using the changeset viewer.