fetchAll($db->select('value')->from('table.options')->where('name = %s', "theme:Miracles")->limit(1));
$load_image = explode("\";",explode("\"",explode("\"loading_image\";",$load_image[0]["value"],2)[1],2)[1],2)[0];
$text = empty($last) ? $data : $last;
if ($widget instanceof Widget_Archive) {
//ParseOther
$text = Contents::parsePicShadow(Contents::parseNotice(Contents::parseKbd(Contents::parseCode(Contents::parseImages(Contents::parseHeadings(Contents::parseTextColor(Contents::parseRuby(Contents::parseTip($text)))))))));
//LazyLoad
$text = preg_replace('//','
',$text);
//owo
$text = Contents::parseEmo($text);
//Links
$text = Contents::parseLink($text);
}
return $text;
}
/**
* 解析图片
*/
static public function parseImages($text){
//FancyBox & 图题
$text = preg_replace('/
/s','
';
}
/**
* 阿鲁表情回调函数
*
* @return string
*/
private static function parseAruBiaoqingCallback($match)
{
return '
';
}
/**
* 推特表情回调函数
*
* @return string
*/
private static function parseTweBiaoqingCallback($match)
{
return '
';
}
/**
* 解析代码块
*/
static public function parseCode($text) {
$text = preg_replace('//s','',$text);
return $text;
}
/**
* 解析键盘按键
*/
static public function parseKbd($text) {
$text = preg_replace('/\[\[(.*?)\]\]/s','${1}',$text);
return $text;
}
/**
* 解析章节链接
*/
static public function parseHeadings($text){
$reg='/\(.*?)\<\/h.*?\>/s';
$text = preg_replace_callback($reg, array('Contents', 'parseHeaderCallback'), $text);
return $text;
}
/**
* 为内容中的标题编号
*/
static private $CurrentTocID = 0;
static public function parseHeaderCallback($matchs)
{
// 增加单独标记,否则冲突
$id = $matchs[3];
$id = str_replace(' ','_',$id);
$id = str_replace('&','_',$id);
$id = str_replace('?','_',$id);
$id = str_replace("'",'_',$id);
$id = str_replace('"','_',$id);
$id = str_replace('’','_',$id);
$id = str_replace('“','_',$id);
$id = str_replace('?','_',$id);
return ''.$matchs[3].' ';
}
/**
* 解析自定义导航栏
*/
static public function paresNav($data, $type) {
$de_json = json_decode($data, true);
$count_json = count($de_json);
for ($i = 0; $i < $count_json; $i++) {
$title = $de_json[$i]['title'];
$link = $de_json[$i]['link'];
//输出导航
if($type=="top-nav") {
echo ''. $title .'';
}
elseif($type=="mobile") {
echo '';
}
elseif($type=="drawer") {
echo ''. $title .'';
}
}
}
/**
* 根据 id 返回对应的对象
* 此方法在 Typecho 1.2 以上可以直接调用 Helper::widgetById();
* 但是 1.1 版本尚有 bug,因此单独提出放在这里
*
* @param string $table 表名, 支持 contents, comments, metas, users
* @return Widget_Abstract
*/
public static function widgetById($table, $pkId)
{
$table = ucfirst($table);
if (!in_array($table, array('Contents', 'Comments', 'Metas', 'Users'))) {
return NULL;
}
$keys = array(
'Contents' => 'cid',
'Comments' => 'coid',
'Metas' => 'mid',
'Users' => 'uid'
);
$className = "Widget_Abstract_{$table}";
$key = $keys[$table];
$db = Typecho_Db::get();
$widget = new $className(Typecho_Request::getInstance(), Typecho_Widget_Helper_Empty::getInstance());
$db->fetchRow(
$widget->select()->where("{$key} = ?", $pkId)->limit(1),
array($widget, 'push'));
return $widget;
}
/**
* 输出完备的标题
*/
public static function title(Widget_Archive $archive)
{
$archive->archiveTitle(array(
'category' => '分类 %s 下的文章',
'search' => '包含关键字 %s 的文章',
'tag' => '标签 %s 下的文章',
'author' => '%s 发布的文章'
), '', ' - ');
Helper::options()->title();
}
}