public static function renderThumbnailLayout($thumbnail_layout, $listitem, $aHrefLink, $aLink, $videoid, &$theme_row, $item_index, &$gallery_list, &$videolist_row) { $fields = array('width', 'height', 'image', 'link', 'a', '/a', 'link', 'title', 'description', 'imageurl', 'videoid', 'videosource', 'publisheddate', 'duration', 'rating_average', 'rating_max', 'rating_min', 'rating_numRaters', 'statistics_favoriteCount', 'viewcount', 'favcount', 'keywords', 'isactive', 'commentcount', 'likes', 'dislikes', 'channel', 'social', 'odd', 'even', 'videolist', 'inwatchgroup'); $tableFields = array('title', 'description', 'imageurl', 'videoid', 'videosource', 'publisheddate', 'duration', 'rating_average', 'rating_max', 'rating_min', 'rating_numRaters', 'keywords', 'commentcount', 'likes', 'dislikes'); //echo '$item_index='.$item_index.'<br/>'; foreach ($fields as $fld) { $imageFound = strlen($listitem['imageurl']) > 0; // or strlen($listitem['custom_imageurl'])>0); $isEmpty = YoutubeGalleryLayoutRenderer::isThumbnailDataEmpty($fld, $listitem, $tableFields, $imageFound, $videoid, $item_index, $videolist_row); $ValueOptions = array(); $ValueList = YoutubeGalleryLayoutRenderer::getListToReplace($fld, $ValueOptions, $thumbnail_layout, '[]'); $ifname = '[if:' . $fld . ']'; $endifname = '[endif:' . $fld . ']'; if ($isEmpty) { foreach ($ValueList as $ValueListItem) { $thumbnail_layout = str_replace($ValueListItem, '', $thumbnail_layout); } do { $textlength = strlen($thumbnail_layout); $startif_ = strpos($thumbnail_layout, $ifname); if ($startif_ === false) { break; } if (!($startif_ === false)) { $endif_ = strpos($thumbnail_layout, $endifname); if (!($endif_ === false)) { $p = $endif_ + strlen($endifname); $thumbnail_layout = substr($thumbnail_layout, 0, $startif_) . substr($thumbnail_layout, $p); } } } while (1 == 1); } else { $thumbnail_layout = str_replace($ifname, '', $thumbnail_layout); $thumbnail_layout = str_replace($endifname, '', $thumbnail_layout); $i = 0; foreach ($ValueOptions as $ValueOption) { $options = $ValueOptions[$i]; $vlu = YoutubeGalleryLayoutRenderer::getTumbnailData($fld, $aHrefLink, $aLink, $listitem, $tableFields, $options, $theme_row, $gallery_list, $videolist_row); //NEW $thumbnail_layout = str_replace($ValueList[$i], $vlu, $thumbnail_layout); $i++; } } // IF NOT $ifname = '[ifnot:' . $fld . ']'; $endifname = '[endifnot:' . $fld . ']'; if (!$isEmpty) { foreach ($ValueList as $ValueListItem) { $thumbnail_layout = str_replace($ValueListItem, '', $thumbnail_layout); } do { $textlength = strlen($thumbnail_layout); $startif_ = strpos($thumbnail_layout, $ifname); if ($startif_ === false) { break; } if (!($startif_ === false)) { $endif_ = strpos($thumbnail_layout, $endifname); if (!($endif_ === false)) { $p = $endif_ + strlen($endifname); $thumbnail_layout = substr($thumbnail_layout, 0, $startif_) . substr($thumbnail_layout, $p); } } } while (1 == 1); } else { $thumbnail_layout = str_replace($ifname, '', $thumbnail_layout); $thumbnail_layout = str_replace($endifname, '', $thumbnail_layout); $vlu = ''; $i = 0; foreach ($ValueOptions as $ValueOption) { $thumbnail_layout = str_replace($ValueList[$i], $vlu, $thumbnail_layout); $i++; } } } //foreach($fields as $fld) return $thumbnail_layout; }