diff --git a/var/Widget/Ajax.php b/var/Widget/Ajax.php
index e5cfb4d4..4ebffdea 100644
--- a/var/Widget/Ajax.php
+++ b/var/Widget/Ajax.php
@@ -43,11 +43,11 @@ class Widget_Ajax extends Widget_Abstract_Options implements Widget_Interface_Do
$client = Typecho_Http_Client::get();
if ($client) {
$client->setHeader('User-Agent', $this->options->generator)
- ->send('http://code.google.com/feeds/p/typecho/downloads/basic');
+ ->send('https://github.com/typecho/typecho/releases.atom');
/** 匹配内容体 */
$response = $client->getResponseBody();
- preg_match_all("/]*href=\"([^>]*)\"\s*\/>\s*
([^>]*)<\/title>/is", $response, $matches);
+ preg_match_all("/]+href=\"([^>]*)\"\s*\/>/is", $response, $matches);
$result = array('available' => 0);
list($soft, $version) = explode(' ', $this->options->generator);
@@ -55,12 +55,16 @@ class Widget_Ajax extends Widget_Abstract_Options implements Widget_Interface_Do
if ($matches) {
foreach ($matches[0] as $key => $val) {
- $title = trim($matches[2][$key]);
- if (preg_match("/([0-9\.]+)\(([0-9\.]+)\)\-release/is", $title, $out)) {
+ $title = trim($matches[1][$key]);
+ if (preg_match("/v([0-9\.]+)\-([0-9\.]+)\-release$/is", $title, $out)) {
if (version_compare($out[1], $current[0], '>=')
&& version_compare($out[2], $current[1], '>')) {
- $result = array('available' => 1, 'latest' => $out[1] . '-' . $out[2],
- 'current' => $current[0] . '-' . $current[1], 'link' => $matches[1][$key]);
+ $result = array(
+ 'available' => 1,
+ 'latest' => $out[1] . '-' . $out[2],
+ 'current' => $current[0] . '-' . $current[1],
+ 'link' => 'https://github.com' . $matches[1][$key]
+ );
break;
}
}