scarwu / Pointless

A Static Blog Generator
MIT License
18 stars 3 forks source link

fixed issue #8 #9

Closed zither closed 10 years ago

zither commented 10 years ago

简单修正了一下 issue #8 的问题,考虑到半角双引号应该只允许出现在 title 中,所以只针对标题添加了一个方法过滤。

scarwu commented 10 years ago

直接用json_encode()去作escape,像是下面哪樣。

$json = json_encode([
    'type' => 'article',
    'title' => $info['title'],
    'url' => $info['url'],
    'tag' => $info['tag'],
    'category' => $info['category'],
    'keywords' => null,
    'date' => date("Y-m-d", $time),
    'time' => date("H:i:s", $time),
    'message' => true,
    'publish' => false
], JSON_PRETTY_PRINT);
zither commented 10 years ago

这个我也考虑过,还有就是htmlspecialchars之类的转义,不过昨天我修改的时候考虑到你把 Pointless 的 PHP 版本要求设为 5.3+ 所以就没有使用这个 5.4 的新特性。 其实我看过 Pointless 的 server 命令也是使用的 5.4 的新功能,也许要把 Pointless 的版本需求改为 5.4+ 更好一点。

scarwu commented 10 years ago

升級5.4已著手進行,為了更好特性是必須的。 至於這個修改我會參考並使用在experiment branch上,但我還是會先merge到master。