Plugin Directory

Changeset 791973


Ignore:
Timestamp:
10/22/2013 07:41:05 PM (12 years ago)
Author:
nandasunil
Message:

Version 1.0.2

Location:
blue-wrench-videos-widget/trunk
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • blue-wrench-videos-widget/trunk/bluewrench-video-controller.php

    r791356 r791973  
    199199                        $visibility = "Hidden";
    200200                    }
    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>";
    203203                    $sortorder = $result->sortorder;
    204204                    if ($visibility=='Shown'){
     
    222222                 <td><?php echo $rowCount; ?></td>
    223223                 <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>
    225225                 <td><?php echo $visibility; ?></td>
    226226
     
    280280            $results = $wpdb->get_results($sql);
    281281            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.') );
    286282                return -2;
    287283            }else{
  • blue-wrench-videos-widget/trunk/bluewrench-video-widget.php

    r791356 r791973  
    33Plugin Name:  Blue Wrench Video Widget
    44Plugin 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 MeFeedia
    6 Version: 1.0.0
     5Description: 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
     6Version: 1.0.2
    77Author: Sunil Nanda
    88Author URI: http://www.sunilnanda.com/
     
    1616define('BW_DIR_NAME', basename(BW_FILE_PATH));
    1717if (!defined('BW_VERSION_NUM'))
    18     define('BW_VERSION_NUM', '1.0.0');
     18    define('BW_VERSION_NUM', '1.0.2');
    1919
    2020global $wpdb;
     
    4747    if (is_admin()) {
    4848        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' );
    4952        wp_register_style ( 'bw-plugin-jquery-ui', plugin_dir_url( __FILE__ ) . 'jquery-ui.css' );
    5053        wp_enqueue_style( 'bw-plugin-jquery-ui' );
     
    8285}
    8386
     87function 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
    84105register_activation_hook(__FILE__,'bw_install');
    85106register_deactivation_hook(__FILE__ , 'bw_uninstall' );
     
    87108add_action('admin_menu', 'bw_admin_menu');
    88109add_action('widgets_init', 'load_bw_video_widgets');        //action to initiate widgets
     110add_action('wp_ajax_fetch_video_embedd_html', 'fetch_video_embedd_html'); // Call when user logged in
    89111   
    90112?>
  • blue-wrench-videos-widget/trunk/class-bluewrench-video-controller.php

    r791356 r791973  
    77        $this->videowidth = $videowidth;
    88        $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;
    932    }
    1033    function generateEmbeddHTML($video_url=''){
     
    2447                        if ($url_chunks['host']=="player.vimeo.com"){
    2548                            $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                            }
    2661                        }else{
    2762                            $video_url = $url_chunks['scheme'].'://player.vimeo.com/video'.$url_chunks['path'];
     
    88123                        $network = 'veoh';
    89124                        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;
    90147                    default:
    91                         p($url_chunks);
     148                        echo "<pre>";
     149                        print_r($url_chunks);
     150                        echo "</pre>";
    92151                        //$video_url = $url;
    93152                        break;
     
    97156        switch ($network){
    98157            case 'vimeo':
     158                $video_preview = '<iframe src="'.$video_url.'" width="'.$this->videowidth.'" height="'.$this->videoheight.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
     159                break;
    99160            case 'metacafe':
     161            case 'break':
     162            case 'yahoo':
    100163                $video_preview = '<iframe src="'.$video_url.'" width="'.$this->videowidth.'" height="'.$this->videoheight.'" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>';
    101164                break;
  • blue-wrench-videos-widget/trunk/readme.txt

    r791435 r791973  
    66Requires at least: 2.8.1
    77Tested up to: 3.6
    8 Stable tag: 1.0.1
     8Stable tag: 1.0.2
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3030
    3131   1. Visit Plugins > Add New > Upload in WordPress admin
    32    2. Upload blue-wrench-videos-widget.1.0.1.zip file
     32   2. Upload blue-wrench-videos-widget.1.0.2.zip file
    3333   3. Once uploaded, click Activate Plugin link
    3434
    3535
     36== Screenshots ==
     37
     381. The Add video screen.
     392. 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.
     403. 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.
     414. Blue Wrench Video Widget added to sidebar.
     42
     43
    3644== Changelog ==
     45
     46= 1.0.2 =
     47* Fixed Vimeo video embedd code issues
     48* Added Screenshots
    3749
    3850= 1.0.1 =
Note: See TracChangeset for help on using the changeset viewer.