} function cbURL($articleId) { return 'http://www.cnbeta.com/articles/' . $articleId . '.htm'; } function postWeiboBySAE($content) { return file_get_contents('http://cnbeta1.sinaapp.com/post_weibo.php?cnbeta1=true&text=' . urlencode($content)); } function replaceImgURL($content) { return str_replace('static.cnbetacdn.com', 'cnbeta1.sinaapp.com', $content); } # App shutdown App::shutdown(function () { Cacher::close(); }); # Constants const ARTICLE_CACHE_TIME = 1814400; // 3600 * 24 * 21, 21 days const ARTICLE_REFRESH_TIME = 300; // 5min const ARTICLE_RECENT_DAY = 2; // article in 1 day is 'recent' # For cache keys const ARTICLE_CACHE_KEY_PREFIX = 'A:'; const UPTODATE_KEY_PREFIX = 'U:'; const LATEST_ARTICLE_ID_KEY = 'LatestArticle'; const INDEX_CACHE_KEY = 'IndexData'; const FEED_CACHE_KEY = 'FeedData'; # Index Page