Ejemplo n.º 1
0
 public static function render($htmlresult, &$videolist_row, &$theme_row, $gallery_list, $width, $height, $videoid, $total_number_of_rows, $custom_itemid = 0)
 {
     if (!isset($theme_row)) {
         return 'Theme not selected';
     }
     if (!isset($videolist_row)) {
         return 'Video List not selected';
     }
     if (strpos($htmlresult, '[pagination') === false) {
         $AllowPagination = false;
     } else {
         $AllowPagination = true;
     }
     $fields_generated = array('link', 'cols', 'width', 'height', 'video', 'videolist', 'listname', 'videotitle', 'videodescription', 'videoplayer', 'navigationbar', 'thumbnails', 'count', 'pagination', 'instanceid', 'videoid', 'mediafolder', 'social');
     $fields_theme = array('bgcolor', 'cssstyle', 'navbarstyle', 'thumbnailstyle', 'linestyle', 'listnamestyle', 'activevideotitlestyle', 'color1', 'color2', 'descr_style', 'rel', 'hrefaddon');
     $fields_all = array_merge($fields_generated, $fields_theme);
     foreach ($fields_all as $fld) {
         $isEmpty = YoutubeGalleryLayoutRenderer::isEmpty($fld, $videolist_row, $theme_row, $gallery_list, $videoid, $AllowPagination, $total_number_of_rows);
         $ValueOptions = array();
         $ValueList = YoutubeGalleryLayoutRenderer::getListToReplace($fld, $ValueOptions, $htmlresult, '[]');
         $ifname = '[if:' . $fld . ']';
         $endifname = '[endif:' . $fld . ']';
         if ($isEmpty) {
             foreach ($ValueList as $ValueListItem) {
                 $htmlresult = str_replace($ValueListItem, '', $htmlresult);
             }
             do {
                 $textlength = strlen($htmlresult);
                 $startif_ = strpos($htmlresult, $ifname);
                 if ($startif_ === false) {
                     break;
                 }
                 if (!($startif_ === false)) {
                     $endif_ = strpos($htmlresult, $endifname);
                     if (!($endif_ === false)) {
                         $p = $endif_ + strlen($endifname);
                         $htmlresult = substr($htmlresult, 0, $startif_) . substr($htmlresult, $p);
                     }
                 }
             } while (1 == 1);
         } else {
             $htmlresult = str_replace($ifname, '', $htmlresult);
             $htmlresult = str_replace($endifname, '', $htmlresult);
             $i = 0;
             foreach ($ValueOptions as $ValueOption) {
                 $vlu = YoutubeGalleryLayoutRenderer::getValue($fld, $ValueOption, $videolist_row, $theme_row, $gallery_list, $width, $height, $videoid, $AllowPagination, $total_number_of_rows, $custom_itemid);
                 $htmlresult = str_replace($ValueList[$i], $vlu, $htmlresult);
                 $i++;
             }
         }
         // IF NOT
         $ifname = '[ifnot:' . $fld . ']';
         $endifname = '[endifnot:' . $fld . ']';
         if (!$isEmpty) {
             foreach ($ValueList as $ValueListItem) {
                 $htmlresult = str_replace($ValueListItem, '', $htmlresult);
             }
             do {
                 $textlength = strlen($htmlresult);
                 $startif_ = strpos($htmlresult, $ifname);
                 if ($startif_ === false) {
                     break;
                 }
                 if (!($startif_ === false)) {
                     $endif_ = strpos($htmlresult, $endifname);
                     if (!($endif_ === false)) {
                         $p = $endif_ + strlen($endifname);
                         $htmlresult = substr($htmlresult, 0, $startif_) . substr($htmlresult, $p);
                     }
                 }
             } while (1 == 1);
         } else {
             $htmlresult = str_replace($ifname, '', $htmlresult);
             $htmlresult = str_replace($endifname, '', $htmlresult);
             $vlu = '';
             $i = 0;
             foreach ($ValueOptions as $ValueOption) {
                 $htmlresult = str_replace($ValueList[$i], $vlu, $htmlresult);
                 $i++;
             }
         }
     }
     //foreach($fields as $fld)
     return $htmlresult;
 }