/** * 远程请求代理 * * @access public * @return void */ public function feed() { $this->user->pass('subscriber'); $client = Typecho_Http_Client::get(); if ($client) { $client->setHeader('User-Agent', $this->options->generator)->send('http://typecho.org/feed/'); /** 匹配内容体 */ $response = $client->getResponseBody(); preg_match_all("/<item>\\s*<title>([^>]*)<\\/title>\\s*<link>([^>]*)<\\/link>\\s*<guid>[^>]*<\\/guid>\\s*<pubDate>([^>]*)<\\/pubDate>/is", $response, $matches); $data = array(); if ($matches) { foreach ($matches[0] as $key => $val) { $data[] = array('title' => $matches[1][$key], 'link' => $matches[2][$key], 'date' => Typecho_I18n::dateWord(strtotime($matches[3][$key]), $this->options->gmtTime + $this->options->timezone)); if ($key > 3) { break; } } } if (!empty($data)) { Typecho_Cookie::set('__typecho_feed', Typecho_Json::encode($data)); } $this->response->throwJson($data); return; } throw new Typecho_Widget_Exception(_t('禁止访问'), 403); }
/** * 导入语言项 * * @access public * @param string $domain * @return void */ public static function lang($domain) { $currentLang = Typecho_I18n::getLang(); if ($currentLang) { $currentLang = basename($currentLang); $fileName = dirname(__FILE__) . '/' . $domain . '/lang/' . $currentLang; if (file_exists($fileName)) { Typecho_I18n::addLang($fileName); } } }
/** * 入口函数,初始化路由器 * * @access public * @return void */ public function execute() { /** 对变量赋值 */ $options = $this->widget('Widget_Options'); /** 语言包初始化 */ if ($options->lang && $options->lang != 'zh_CN') { $dir = defined('__TYPECHO_LANG_DIR__') ? __TYPECHO_LANG_DIR__ : __TYPECHO_ROOT_DIR__ . '/usr/langs'; Typecho_I18n::setLang($dir . '/' . $options->lang . '.mo'); } /** cookie初始化 */ Typecho_Cookie::setPrefix($options->rootUrl); /** 初始化charset */ Typecho_Common::$charset = $options->charset; /** 初始化exception */ Typecho_Common::$exceptionHandle = 'Widget_ExceptionHandle'; /** 设置路径 */ if (defined('__TYPECHO_PATHINFO_ENCODING__')) { $pathInfo = $this->request->getPathInfo(__TYPECHO_PATHINFO_ENCODING__, $options->charset); } else { $pathInfo = $this->request->getPathInfo(); } Typecho_Router::setPathInfo($pathInfo); /** 初始化路由器 */ Typecho_Router::setRoutes($options->routingTable); /** 初始化插件 */ Typecho_Plugin::init($options->plugins); /** 初始化回执 */ $this->response->setCharset($options->charset); $this->response->setContentType($options->contentType); /** 默认时区 */ if (function_exists("ini_get") && !ini_get("date.timezone") && function_exists("date_default_timezone_set")) { @date_default_timezone_set('UTC'); } /** 初始化时区 */ Typecho_Date::setTimezoneOffset($options->timezone); /** 开始会话, 减小负载只针对后台打开session支持 */ // modified_by_jiangmuzi 2015.09.23 // 开始会话 @session_start(); // end modified /** 监听缓冲区 */ ob_start(); }
/** * 设置语言项 * * @access public * @param string $lang 配置信息 * @return void */ public static function setLang($lang) { self::$_lang = $lang; }
</a></p> <h2><?php $user->screenName(); ?> </h2> <p><?php $user->name(); ?> </p> <p><?php _e('目前有 <em>%s</em> 篇日志, 并有 <em>%s</em> 条关于你的评论在 <em>%s</em> 个分类中.', $stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum); ?> </p> <p><?php if ($user->logged > 0) { _e('最后登录: %s', Typecho_I18n::dateWord($user->logged + $options->timezone, $options->gmtTime + $options->timezone)); } ?> </p> </div> <div class="col-mb-12 col-tb-6 col-tb-offset-1 typecho-content-panel" role="form"> <section> <h3><?php _e('个人资料'); ?> </h3> <?php Typecho_Widget::widget('Widget_Users_Profile')->profileForm()->render(); ?> </section>
/** * 获取国际化偏移时间 * * @access public * @return string */ public function word() { return Typecho_I18n::dateWord($this->timeStamp, self::gmtTime() + (self::$timezoneOffset - self::$serverTimezoneOffset)); }
/** 获取语言 */ $lang = _r('lang', Typecho_Cookie::get('__typecho_lang')); $langs = Widget_Options_General::getLangs(); if (empty($lang) && count($langs) > 1) { foreach ($langs as $lang) { if ('zh_CN' != $lang) { break; } } } if (empty($lang)) { $lang = 'zh_CN'; } if ('zh_CN' != $lang) { $dir = defined('__TYPECHO_LANG_DIR__') ? __TYPECHO_LANG_DIR__ : __TYPECHO_ROOT_DIR__ . '/usr/langs'; Typecho_I18n::setLang($dir . '/' . $lang . '.mo'); } Typecho_Cookie::set('__typecho_lang', $lang); ?> <!DOCTYPE HTML> <html xmlns="http://www.w3.org/1999/xhtml"> <head lang="zh-CN"> <meta charset="<?php _e('UTF-8'); ?> " /> <title><?php _e('Typecho 安装程序'); ?> </title> <link rel="stylesheet" type="text/css" href="admin/css/normalize.css" />
?> " name="id[]"/></td> <td><?php echo htmlspecialchars($log['try_username'], ENT_QUOTES); ?> </td> <td><?php echo htmlspecialchars($log['try_password'], ENT_QUOTES); ?> </td> <td><?php echo htmlspecialchars($log['ip'], ENT_QUOTES); ?> </td> <td><?php echo Typecho_I18n::dateWord($log['add_time'], $_SERVER['REQUEST_TIME']); ?> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan="5"><h6 class="typecho-list-table-title"><?php _e('没有任何登录失败的记录'); ?> </h6></td> </tr>
if ($this->_user->sign) { ?> <p class="m0"><strong><?php $this->_user->sign(); ?> </strong></p><?php } ?> <div> <?php $this->options->title(); _e(_t('第 %s 位会员,', $this->_user->uid)); _e('加入于:' . date('Y-m-d H:i:s', $this->_user->created)); if ($this->user->uid == $this->_user->uid) { if ($this->_user->logged != 0) { _e(',最后登录: %s', Typecho_I18n::dateWord($this->_user->logged + $this->options->timezone, $this->options->gmtTime + $this->options->timezone)); } else { _e(',第一次登录'); } } ?> </div> </div> <div class="cell"> <?php if ($this->_user->url) { ?> <a class="tag" href="<?php $this->_user->url(); ?> " target="_blank"><i class="fa fa-home"></i> <?php