$item) {
$ctimes[$id] = $item['fstat']['ctime'];
}
if ($way == 'desc') {
arsort($ctimes, SORT_NUMERIC);
}else {
asort($ctimes, SORT_NUMERIC);
}
$sorted = array();
foreach($ctimes as $id => $ctime) {
array_push($sorted, $files[$id]);
}
return $sorted;
}
//生成GA统计代码
public static function getGACode() {
if (!empty(FSC::$app['config']['debug'])) {return '';}
$msid = !empty(FSC::$app['config']['GA_MEASUREMENT_ID']) ? FSC::$app['config']['GA_MEASUREMENT_ID'] : '';
if (empty($msid)) {return '';}
$gacode = <<
eof;
return $gacode;
}
//根据收藏和分类,获取单个收藏视频的所在分类
public static function getFavsTags($filename, $tags) {
$fileTags = array();
foreach($tags as $tag_id => $item) {
if (in_array($filename, $item['files'])) {
array_push($fileTags, $item['name']);
}
}
return $fileTags;
}
//获取只包含分类名的数组
public static function getTagNames($tags) {
$tmp_arr = array();
foreach ($tags as $id => $tag) {
array_push($tmp_arr, $tag['name']);
}
return $tmp_arr;
}
//获取用户图片的cdn地址
public static function getCDNImageUrl($localImgUrl) {
if (!empty(FSC::$app['config']['debug'])) {return $localImgUrl;}
$cdn = FSC::$app['config']['img_cdn_budget_url'];
if (empty($cdn)) {return $localImgUrl;}
return "{$cdn}{$localImgUrl}";
}
}