Plugin Directory

Changeset 201420


Ignore:
Timestamp:
02/03/2010 03:06:42 PM (16 years ago)
Author:
fairweb
Message:
 
Location:
fw-vimeo-videowall/trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • fw-vimeo-videowall/trunk/fw-vimeo-videowall-ajax-handler.php

    r195350 r201420  
    1111        echo '<img src="'.FWVVW_URL.'/images/cross.png" class="closewindow" alt="'.__("Close window","fwvvw").'" title="'.__("Close window","fwvvw").'" />';
    1212        break;
     13    case 'show_page' :
     14        fw_vimeowall_display('paginate=0&id='.$_POST['id'].'&source='.$_POST['source'].'&type='.$_POST['type'].'&width='.$_POST['width'].'&height='.$_POST['height'].'&number='.$_POST['number'].'&page='.$_POST['page'], false);
     15        break;
     16    default: break;
    1317}
    1418?>
  • fw-vimeo-videowall/trunk/fw-vimeo-videowall-widget.class.php

    r198637 r201420  
    33 * @package fw-vimeo-videowall
    44 * @author fairweb
    5  * @version 1.1
    65 */
    76
    8 /**
    9  * Description of fwvimeovideowallwidgetclass
    10  *
    11  * @author Fairweb
    12  */
    137class FW_widget_vimeowall extends WP_Widget {
    148   
  • fw-vimeo-videowall/trunk/fw-vimeo-videowall.class.php

    r198637 r201420  
    33 * @package fw-vimeo-videowall
    44 * @author fairweb
    5  * @version 1.1
    65 */
    76
    8 /**
    9  * Description of fwvimeovideowallclass
    10  *
    11  * @author Fairweb
    12  */
    137class FW_vimeo_videowall {
    148    public $id;
     
    1711    public $vcall;
    1812    public $api_endpoint;
     13    public $info_endpoint;
    1914    public $vwidth;
    2015    public $vheight;
    2116    public $vnumber;
     17    public $vperpage = 20;
    2218    public $vecho;
     19    public $vpage = 1;
     20    public $vpagination = true;
    2321
    2422    function FW_vimeo_videowall() {
     
    3230        global $fwvvw_user_name;
    3331        switch ($this->vsource) {
    34             case 'user' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/'.$this->id.'/videos.json'; break;
    35             case 'group' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/group/'.$this->id.'/videos.json'; break;
    36             case 'album' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/album/'.$this->id.'/videos.json'; break;
    37             case 'channel' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/channel/'.$this->id.'/videos.json'; break;
     32            case 'user' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/'.$this->id.'/videos.json?page='.$this->vpage;
     33                            $this->info_endpoint = 'http://vimeo.com/api/v2/'.$this->id.'/info.json'; break;
     34            case 'group' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/group/'.$this->id.'/videos.json?page='.$this->vpage;
     35                            $this->info_endpoint = 'http://vimeo.com/api/v2/group/'.$this->id.'/info.json'; break;
     36            case 'album' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/album/'.$this->id.'/videos.json?page='.$this->vpage;
     37                            $this->info_endpoint = 'http://vimeo.com/api/v2/album/'.$this->id.'/info.json'; break;
     38            case 'channel' : $this->api_endpoint = 'http://www.vimeo.com/api/v2/channel/'.$this->id.'/videos.json?page='.$this->vpage;
     39                                $this->info_endpoint = 'http://vimeo.com/api/v2/channel/'.$this->id.'/info.json'; break;
    3840            case 'video' : $this->api_endpoint = 'http://www.vimeo.com/api/oembed.json'; break;
    3941            default : $this->api_endpoint = 'http://www.vimeo.com/api/v2/'.$this->id.'/videos.json'; break;
     
    4143    }
    4244
    43     public function video_wall($args) {
     45    public function video_wall($args, $wrapper) {
    4446        $this->id = $args['id'];
    4547        $this->vsource = $args['source'];
     
    4850        $this->vheight = $args['height'];
    4951        $this->vtype = $args['type'];
     52        $this->vpage = $args['page'];
     53       // $this->vperpage = $args['perpage'];
     54        // $this->vpaginate = $args['paginate'];
     55
     56        $html = '';
     57       
    5058        $this->choose_endpoint ();
     59        if ($this->vnumber == 0) {
     60            $this->vnumber = $this->get_total_videos();
     61            $this->vpagination == true;       
     62        }
     63        // echo $this->vnumber;
     64       /* $this->vperpage = $this->vperpage > $this->vnumber ? $this->vnumber : $this->vperpage;
     65        $this->vperpage = $this->vperpage > 20 ? 20 : $this->vperpage;*/
     66        if ($this->vnumber > 20) {
     67            $this->vpagination == true;
     68        }
    5169        $video_details = $this->get_datas();
    5270
    53         if ($this->vtype == 'title' && $video_details) {
    54             $html ='<ul class="fwvvw-'.$this->vsource.'">';
    55         } else {
    56             $html='<div class="fwvvw-'.$this->vsource.'">';
    57         }
     71        if ($wrapper == true) {
     72            $html .='<div id="wall-fwvvw-'.$this->vsource.'-'.$this->id.'" class="fwvvw-'.$this->vsource.'">';
     73        }
     74            if ($this->vtype == 'title' && $video_details) {
     75                $html .='<ul id="walllist-fwvvw-'.$this->vsource.'-'.$this->id.'">';
     76            }
     77       
    5878       
    5979        if (!$video_details) {
     
    6585        }
    6686         $html .= $this->get_html($video_details);
    67          if ($this->vtype == 'title' && $video_details) {
     87          if ($this->vtype == 'title' && $video_details) {
     88
    6889            $html .='</ul>';
    69         } else {
    70             $html .='<div class="fwclear"></div></div>';
     90
     91
     92            }
     93
     94            $html .= $this->paginate();
     95         if ($wrapper == true) {
     96
     97            $html .='<div class="fwclear"></div>';         
     98            $html.= '</div>';
     99           
    71100         }
     101
     102
     103   
    72104         if ($args['echo'] == false) {
    73105                 return $html;
     
    111143        }
    112144        }
     145       
    113146        return $full_html;
    114147    }
     
    119152        $oembed_req = wp_remote_retrieve_body( wp_remote_get($oembed_url));
    120153        $oembed = json_decode($oembed_req);
    121         $html_code = '<div id="'.$video->id.'" class="fwvvw_vthumb">';
     154        $html_code = '<div id="video_'.$video->id.'" class="fwvvw_vthumb">';
    122155        $html_code .= html_entity_decode($oembed->html);
    123156        $html_code .= '</div>';
     
    126159
    127160    public function get_image_html ($video) {
    128          $html_code = '<div id="'.$video->id.'" class="fwvvw_vthumb">';
     161         $html_code = '<div id="video_'.$video->id.'" class="fwvvw_vthumb">';
    129162         $html_code .= '<img src="'.$video->thumbnail_small.'" alt="'.$video->title.'" title="'.$video->title.'" width="'.$this->vwidth.'" />';
    130163         $html_code .= '</div>';
     
    133166
    134167    public function get_title_html ($video) {
    135         $html_code = '<li id="'.$video->id.'" class="fwvvw_vthumb">';
     168        $html_code = '<li id="video_'.$video->id.'" class="fwvvw_vthumb">';
    136169         $html_code .= '<a href="#" title="'.$video->title.'">'.$video->title.'</a>';
    137170         $html_code .= '</li>';
     
    139172    }
    140173
     174    public function get_total_videos () {
     175        $info_req = wp_remote_retrieve_body( wp_remote_get($this->info_endpoint));
     176        $infos = json_decode($info_req );
     177       
     178        if (!$infos) { return false; }
     179        if ($this->vsource == 'user') {
     180            $total_videos = $infos->total_videos_uploaded;
     181        } else {
     182            $total_videos = $infos->total_videos;
     183        }
     184        return $total_videos;
     185    }
     186
     187    public function paginate() {
     188         $html = '';
     189        if ($this->vpagination == false ) { return; }
     190   
     191            if ($this->vnumber > 20) {
     192                $nb_pages = ceil($this->vnumber / 20);
     193                //echo $nb_pages;
     194                if ($nb_pages > 1) {
     195                    $html .= '<div id="fwvvw-paginate-'.$this->vsource.'-'.$this->id.'" class="fwvvw-pagination">';
     196                    $pagelinkid = 'fwvvw_'.$this->vsource.'_'.$this->id.'_'.$this->vtype.'_'.$this->vwidth.'_'.$this->vheight.'_'.$this->vnumber;
     197                    for ($i = 1; $i <= $nb_pages; $i++) {
     198                        $selected = '';
     199                       if ($this->vpage == $i) {
     200                           $selected = 'fwvvw_current_page';
     201                       }
     202                       $html .= '<a id="'.$pagelinkid.'_'.$i.'" class="fwvvw_pagelink '.$selected.'" href="#wall-fwvvw-'.$this->vsource.'-'.$this->id.'">'.$i.'</a> ';
     203                    }
     204                    $html .= '</div>';
     205                   
     206                }
     207            }
     208            return $html;
     209    }
     210
    141211    public function get_datas() {
    142 
     212//echo $this->api_endpoint;
    143213        $endpoint_req = wp_remote_retrieve_body( wp_remote_get($this->api_endpoint));
    144214        $videos = json_decode($endpoint_req );
    145        
     215        //print_r($videos);
    146216        $video_details = array();
    147         $nb = count($videos);
    148         $this->vnumber = $this->vnumber == 0 ? $nb : $this->vnumber;
    149         for ($i=0; $i < $this->vnumber; $i++) {
     217
     218        //$nb = $this->vsource == 'video' ? 1 : $this->vperpage;
     219        //$this->vnumber = $this->vnumber == 0 ? $nb : $this->vnumber;
     220        if ($this->vnumber != false ) {
     221       /* for ($i=0; $i < $this->vperpage; $i++) {
    150222            if ($i == $nb) { break; }
    151223            $videos_details [] = $videos[$i];
     224        }*/
     225            $i=0;
     226             do {
     227                $videos_details [] = $videos[$i];
     228                $i++;
     229            }
     230            while (isset($videos[$i]));
    152231        }
    153232        return $videos_details;
  • fw-vimeo-videowall/trunk/fw-vimeo-videowall.css

    r198637 r201420  
    6161    cursor:pointer;
    6262}
     63
     64/* added in v 1.2 */
     65.fwvvw-pagination {
     66    clear:both;
     67}
     68
     69.fwvvw-pagination a.fwvvw_current_page {
     70    border:#ebebeb 1px solid;
     71    font-weight:bold;
     72}
  • fw-vimeo-videowall/trunk/fw-vimeo-videowall.js

    r198637 r201420  
    11jQuery(document).ready( function() {
    22        jQuery(".fwvvw_vthumb").livequery('click',
    3         function() {
     3        function() {
     4
    45            var idreq = jQuery(this).attr('id');
     6                        var expl_idreq = idreq.split('_');
     7                        var idvideo = expl_idreq[1];
    58                         jQuery("#fwvvw_full_video").remove();
    69                         jQuery("#fwvvw_bg_video").remove();
     
    2124               
    2225                action: 'show_video',
    23                 'id': idreq
     26                'id': idvideo
    2427
    2528                },
     
    3841
    3942
     43         jQuery(".fwvvw_pagelink").livequery('click',
     44        function() {
    4045
     46            var idreq = jQuery(this).attr('id');
     47                        var expl_idreq = idreq.split('_');
     48                        var source = expl_idreq[1];
     49                        var idsrc = expl_idreq[2];
     50                        var typesrc = expl_idreq[3];
     51                        var w = expl_idreq[4];
     52                        var h = expl_idreq[5];
     53                        var number = expl_idreq[6];
     54                       
     55                        var page = expl_idreq[7];
     56                       
     57                       
     58
     59            var responsediv = '#wall-fwvvw-'+source+'-'+idsrc;
     60
     61            jQuery.post( fwvvw_ajax_handler, {
     62
     63                action: 'show_page',
     64                'id': idsrc,
     65                                'source' : source,
     66                                'type' : typesrc,
     67                                'width' : w,
     68                                'height' : h,
     69                                'number' : number,
     70                               
     71                                'page' : page
     72
     73                },
     74
     75                function(response) {
     76                    jQuery(responsediv).html(response);
     77                });
     78    });
    4179
    4280}
  • fw-vimeo-videowall/trunk/fw-vimeo-videowall.php

    r198637 r201420  
    22 * @package fw-vimeo-videowall
    33 * @author fairweb
    4  * @version 1.1
    54 */
    65/*
    76Plugin Name: fw-vimeo-videowall
    87Plugin URI: http://www.fairweb.fr/en/my-wordpress-plugins/fw-vimeo-videowall/
    9 Description: Displays a user, group, album or channel vimeo videowall with thumbnails or small videos in sidebar or content.
     8Description: Displays a user, group, album or channel vimeo videowall with thumbnails or small videos in sidebar or content with pagination if needed.
    109Author: fairweb
    11 Version: 1.1
     10Version: 1.2
    1211Author URI: http://www.fairweb.fr/
    1312*/
     
    3837}
    3938
    40 function fw_vimeowall_display($args='') {
     39function fw_vimeowall_display($args='', $wrapper = true) {
    4140    $defaults = array('id' => 'petole',
    4241        'number' => 4, 'width' => 100,
    4342        'height' => 100, 'type' => 'image',
    44         'source' => 'user', 'echo' => true
     43        'source' => 'user', 'paginate' => true, 'page' => 1, 'echo' => true
    4544    );
    4645
    4746    $args = wp_parse_args( $args, $defaults );
     47    $paginate = '';
    4848    $wall = new FW_vimeo_videowall();
    49     $thewall = $wall->video_wall($args);
     49    $thewall = $wall->video_wall($args, $wrapper);
     50   
    5051    if ($args['echo'] == false ) {
    5152        return $thewall;
    52     }
     53    } 
    5354}
    5455
  • fw-vimeo-videowall/trunk/languages/fwvvw-fr_FR.po

    r198637 r201420  
    33"Project-Id-Version: fwvvw\n"
    44"Report-Msgid-Bugs-To: \n"
    5 "POT-Creation-Date: 2010-01-27 06:46+0100\n"
     5"POT-Creation-Date: 2010-02-03 15:58+0100\n"
    66"PO-Revision-Date: \n"
    77"Last-Translator: Myriam Faulkner <[email protected]>\n"
     
    2020msgstr "Fermer la fenêtre"
    2121
    22 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:18
     22#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:12
    2323msgid "Adds a Vimeo Videowall in your sidebar. The videowall may contain a user's, a group's, an album's or channel's Vimeo videos"
    2424msgstr "Ajoute un mur de vidéos Vimeo dans votre sidebar. Le mur de vidéos peut contenir des vidéos d'un utilisateur, d'un groupe, d'un album ou d'un canal."
    2525
    26 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:24
     26#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:18
    2727msgid "Vimeo Videowall"
    2828msgstr "Videowall Vimeo"
    2929
    30 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:79
     30#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:73
    3131msgid "Videos"
    3232msgstr "Vidéos"
    3333
    34 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:83
     34#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:77
    3535msgid "Title"
    3636msgstr "Titre"
    3737
    38 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:88
     38#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:82
    3939msgid "Vimeo source type"
    4040msgstr "Type de source Vimeo"
    4141
    42 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:90
     42#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:84
    4343msgid "Vimeo User"
    4444msgstr "Utilisateur Vimeo"
    4545
    46 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:91
     46#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:85
    4747msgid "Vimeo Group"
    4848msgstr "Groupe Vimeo"
    4949
    50 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:92
     50#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:86
    5151msgid "Vimeo Album"
    5252msgstr "Album Vimeo"
    5353
    54 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:93
     54#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:87
    5555msgid "Vimeo Channel"
    5656msgstr "Canal Vimeo"
    5757
    58 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:98
     58#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:92
    5959msgid "Vimeo ID"
    6060msgstr "ID Vimeo"
    6161
    62 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:98
     62#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:92
    6363msgid "user, group, album or channel ID"
    6464msgstr "ID de l'utilisateur, du groupe, de l'album ou du canal"
    6565
    66 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:103
     66#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:97
    6767msgid "Display"
    6868msgstr "Afficher"
    6969
    70 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:105
     70#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:99
    7171msgid "clickable video thumbnails"
    7272msgstr "des miniatures cliquables"
    7373
    74 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:106
     74#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:100
    7575msgid "playable videos"
    7676msgstr "des vidéos jouables"
    7777
    78 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:107
     78#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:101
    7979msgid "list of video titles"
    8080msgstr "Liste de titres"
    8181
    82 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:112
     82#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:106
    8383msgid "Number of videos"
    8484msgstr "Nombre de vidéos"
    8585
    86 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:117
     86#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:111
    8787msgid "Max video width"
    8888msgstr "Largeur max de la vidéo"
    8989
    90 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:122
     90#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall-widget.class.php:116
    9191msgid "Max video height"
    9292msgstr "Hauteur max de la vidéo"
    9393
    94 #: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall.class.php:61
     94#: wp-content\plugins\fw-vimeo-videowall/fw-vimeo-videowall.class.php:81
    9595msgid "No video"
    9696msgstr "Aucune vidéo"
  • fw-vimeo-videowall/trunk/readme.txt

    r198637 r201420  
    5454== Screenshots ==
    55551. Here are the different ways to use the plugin.
     562. If number of views is greater than 20, the plugin uses pagination
    5657
    5758== Changelog ==
     59= 1.2 =
     60* Corrected W3C issues with id attributes
     61* Added pagination feature when number of videos is greater than 20. This is limited by the Vimeo API (Issue reported by weremoose).
    5862= 1.1 =
    5963* Added an option to display a list of clickable titles instead of thumbnails or videos (as requested by Tim Johnson)
Note: See TracChangeset for help on using the changeset viewer.