Пример #1
0
 /**
  * 模板替换
  * @param string $str
  * @param int $pid
  * @param string $type
  */
 private function rep_platform($str, $pid, $type)
 {
     $wt = new WTOpen();
     $ret = $wt->get($pid);
     $str = str_ireplace('{platform}', $ret['name'], $str);
     $str = str_ireplace('{weibo}', Config::get_name($type), $str);
     $str = str_ireplace('{pid}', $pid, $str);
     $str = str_ireplace('{type}', $type, $str);
     return $str;
 }
Пример #2
0
/**
 * 列表页获取 平台-博客 名称
 * @param string $type	类型
 * @param string $cat	类别 weibo|blog
 */
function get_name($type, $cat = 'weibo')
{
    global $platform_name_list;
    $arr = explode('|', $type);
    if (!isset($platform_name_list[$arr[1]])) {
        $wt_open = new WTOpen();
        $platform = $wt_open->get($arr[1]);
        if ($platform) {
            $platform_name_list[$arr[1]] = $platform['name'] . ' - ';
        }
    }
    if ($cat != 'weibo') {
        $name = Config::get_blog_name($arr[0]);
    } else {
        $name = Config::get_weibo_name($arr[0]);
    }
    return $platform_name_list[$arr[1]] . $name;
}