Ejemplo n.º 1
0
 public static function getTumbnailData($fld, $aHrefLink, $aLink, $listitem, &$tableFields, $options, &$theme_row, &$gallery_list, &$videolist_row)
 {
     $vlu = '';
     switch ($fld) {
         case 'width':
             $vlu = (int) $theme_row->width;
             if ($vlu == 0) {
                 $vlu = 400;
             }
             break;
         case 'height':
             $vlu = (int) $theme_row->height;
             if ($vlu == 0) {
                 $vlu = 300;
             }
             break;
         case 'image':
             $vlu = YoutubeGalleryLayoutRenderer::PrepareImageTag($listitem, $options, $theme_row, true);
             break;
         case 'imageurl':
             $vlu = YoutubeGalleryLayoutRenderer::PrepareImageTag($listitem, $options, $theme_row, false);
             break;
         case 'title':
             $vlu = str_replace('"', '"', $listitem['title']);
             if ($options != '') {
                 $pair = explode(',', $options);
                 $words = (int) $pair[0];
                 if (isset($pair[1])) {
                     $chars = (int) $pair[1];
                 } else {
                     $chars = 0;
                 }
                 $vlu = YoutubeGalleryLayoutRenderer::PrepareDescription($vlu, $words, $chars);
             }
             break;
         case 'description':
             $vlu = str_replace('"', '"', $listitem['description']);
             if ($options != '') {
                 $pair = explode(',', $options);
                 $words = (int) $pair[0];
                 if (isset($pair[1])) {
                     $chars = (int) $pair[1];
                 } else {
                     $chars = 0;
                 }
                 $vlu = YoutubeGalleryLayoutRenderer::PrepareDescription($vlu, $words, $chars);
             }
             break;
         case 'a':
             $vlu = $aHrefLink;
             break;
         case '/a':
             $vlu = '</a>';
             break;
         case 'link':
             if ($options == '') {
                 $vlu = $aLink;
             } elseif ($options == 'full') {
                 if (strpos($aLink, 'http://') !== false or strpos($aLink, 'https://') !== false or strpos($aLink, 'javascript:') !== false) {
                     $vlu = YoutubeGalleryLayoutRenderer::curPageURL(false) . $aLink;
                 }
                 //NEW
             }
             break;
         case 'viewcount':
             $vlu = (int) $listitem['statistics_viewCount'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'likes':
             $vlu = (int) $listitem['likes'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'dislikes':
             $vlu = (int) $listitem['dislikes'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'channel':
             if ($options != '') {
                 $pair = explode(',', $options);
                 $f = 'channel_' . $pair[0];
                 $vlu = $listitem[$f];
                 if (isset($pair[1])) {
                     if ($pair[0] == 'subscribers' or $pair[0] == 'subscribed' or $pair[0] == 'commentcount' or $pair[0] == 'viewcount' or $pair[0] == 'videocount') {
                         $vlu = number_format($vlu, 0, '.', $pair[1]);
                     }
                 }
             } else {
                 $vlu = 'Tag "[channel:<i>parameter</i>]" must have a parameter. Example: [channel:viewcount]';
             }
             break;
         case 'commentcount':
             $vlu = (int) $listitem['commentcount'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'favcount':
             $vlu = $listitem['statistics_favoriteCount'];
             break;
         case 'duration':
             if ($options == '') {
                 $vlu = $listitem['duration'];
             } else {
                 $secs = (int) $listitem['duration'];
                 $vlu = date($options, mktime(0, 0, $secs));
             }
             break;
         case 'publisheddate':
             if ($options == '') {
                 $vlu = $listitem['publisheddate'];
             } else {
                 $vlu = date($options, strtotime($listitem['publisheddate']));
             }
             break;
         case 'social':
             $l = '';
             if (strpos($aLink, 'javascript:') === false) {
                 $a = YoutubeGalleryLayoutRenderer::curPageURL(false);
                 if (strpos($aLink, $a) === false) {
                     $l = '"' . $a . $aLink . '"';
                 } else {
                     $l = '"' . $aLink . '"';
                 }
             } else {
                 $l = '(window.location.href.indexOf("?")==-1 ?  window.location.href+"?videoid=' . $listitem['videoid'] . '" : window.location.href+"&videoid=' . $listitem['videoid'] . '" )';
             }
             $vlu = YoutubeGalleryLayoutRenderer::SocialButtons($l, 'ygt', $options, $listitem['id'], $listitem['videoid']);
             break;
         case 'videolist':
             if ($options != '') {
                 $pair = explode(',', $options);
                 switch ($pair[0]) {
                     case 'title':
                         return $videolist_row->listname;
                         break;
                     case 'description':
                         return $videolist_row->description;
                         break;
                     case 'author':
                         return $videolist_row->author;
                         break;
                     case 'playlist':
                         $pl = YoutubeGalleryLayoutRenderer::getPlaylistIdsOnly($gallery_list);
                         $vlu = implode(',', $pl);
                         break;
                     case 'watchgroup':
                         return $videolist_row->watchusergroup;
                         break;
                     case 'authorurl':
                         return $videolist_row->authorurl;
                         break;
                     case 'image':
                         return $videolist_row->image;
                         break;
                     case 'note':
                         return $videolist_row->note;
                         break;
                 }
             }
             break;
         default:
             if (in_array($fld, $tableFields)) {
                 $vlu = $listitem[$fld];
             }
             break;
     }
     return $vlu;
 }
Ejemplo n.º 2
0
 public static function getTumbnailData($fld, $aHrefLink, $aLink, $listitem, &$tableFields, $options, &$theme_row)
 {
     $vlu = '';
     switch ($fld) {
         case 'image':
             $vlu = YoutubeGalleryLayoutRenderer::PrepareImageTag($listitem, $options, $theme_row, true);
             break;
         case 'imageurl':
             $vlu = YoutubeGalleryLayoutRenderer::PrepareImageTag($listitem, $options, $theme_row, false);
             break;
         case 'title':
             $vlu = str_replace('"', '&quot;', $listitem['title']);
             break;
         case 'description':
             if ($options != '') {
                 $pair = explode(',', $options);
                 $words = (int) $pair[0];
                 if (isset($pair[1])) {
                     $chars = (int) $pair[1];
                 } else {
                     $chars = 0;
                 }
                 $description = YoutubeGalleryLayoutRenderer::PrepareDescription($listitem['description'], $words, $chars);
             } else {
                 $description = $listitem['description'];
             }
             $vlu = str_replace('"', '&quot;', $description);
             break;
         case 'a':
             $vlu = $aHrefLink;
             break;
         case '/a':
             $vlu = '</a>';
             break;
         case 'link':
             if ($options == '') {
                 $vlu = $aLink;
             } elseif ($options == 'full') {
                 $vlu = YoutubeGalleryLayoutRenderer::curPageURL(false) . $aLink;
             }
             //NEW
             break;
         case 'viewcount':
             $vlu = (int) $listitem['statistics_viewCount'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'likes':
             $vlu = (int) $listitem['likes'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'dislikes':
             $vlu = (int) $listitem['dislikes'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'channel':
             if ($options != '') {
                 $pair = explode(',', $options);
                 $f = 'channel_' . $pair[0];
                 $vlu = $listitem[$f];
                 if (isset($pair[1])) {
                     if ($pair[0] == 'subscribers' or $pair[0] == 'subscribed' or $pair[0] == 'commentcount' or $pair[0] == 'viewcount' or $pair[0] == 'videocount') {
                         $vlu = number_format($vlu, 0, '.', $pair[1]);
                     }
                 }
             } else {
                 $vlu = 'Tag "[channel:<i>parameter</i>]" must have a parameter. Example: [channel:viewcount]';
             }
             break;
         case 'commentcount':
             $vlu = (int) $listitem['commentcount'];
             if ($options != '') {
                 $vlu = number_format($vlu, 0, '.', $options);
             }
             break;
         case 'favcount':
             $vlu = $listitem['statistics_favoriteCount'];
             break;
         case 'duration':
             if ($options == '') {
                 $vlu = $listitem['duration'];
             } else {
                 $secs = (int) $listitem['duration'];
                 $vlu = date($options, mktime(0, 0, $secs));
             }
             break;
         case 'publisheddate':
             if ($options == '') {
                 //alteracao projeto portal padrao (inclusao de @)
                 $vlu = @$listitem['publisheddate'];
             } else {
                 $vlu = date($options, strtotime(@$listitem['publisheddate']));
             }
             //fim alteracao projeto portal padrao (inclusao de @)
             break;
         case 'social':
             //print_r ($listitem);
             $vlu = YoutubeGalleryLayoutRenderer::SocialButtons('"' . YoutubeGalleryLayoutRenderer::curPageURL(false) . $aLink . '"', 'ygt', $options, $listitem['id'], $listitem['videoid']);
             break;
         default:
             if (in_array($fld, $tableFields)) {
                 $vlu = $listitem[$fld];
             }
             break;
     }
     return $vlu;
 }