當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Typecho_Cookie::get方法代碼示例

本文整理匯總了PHP中Typecho_Cookie::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Typecho_Cookie::get方法的具體用法?PHP Typecho_Cookie::get怎麽用?PHP Typecho_Cookie::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Typecho_Cookie的用法示例。


在下文中一共展示了Typecho_Cookie::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action

 public function action()
 {
     $this->db = Typecho_Db::get();
     $this->prefix = $this->db->getPrefix();
     $this->options = Typecho_Widget::widget('Widget_Options');
     $cid = $this->request->cid;
     if (!$cid) {
         $this->response->throwJson(array('status' => 0, 'msg' => '請選擇喜歡的文章!'));
     }
     $likes = Typecho_Cookie::get('__post_likes');
     if (empty($likes)) {
         $likes = array();
     } else {
         $likes = explode(',', $likes);
     }
     if (!in_array($cid, $likes)) {
         $row = $this->db->fetchRow($this->db->select('likesNum')->from('table.contents')->where('cid = ?', $cid)->limit(1));
         $this->db->query($this->db->update('table.contents')->rows(array('likesNum' => (int) $row['likesNum'] + 1))->where('cid = ?', $cid));
         array_push($likes, $cid);
         $likes = implode(',', $likes);
         Typecho_Cookie::set('__post_likes', $likes);
         //記錄查看cookie
         $this->response->throwJson(array('status' => 1, 'msg' => '成功點讚!'));
     }
     $this->response->throwJson(array('status' => 0, 'msg' => '你已經點讚過了!'));
 }
開發者ID:jiangmuzi,項目名稱:TeStat,代碼行數:26,代碼來源:Action.php

示例2: setTheme

 /**
  * 插件實現方法
  *
  * @access public
  * @return void
  */
 public static function setTheme($widget)
 {
     $cookie = array('name' => '__typecho_theme', 'expire' => 86400);
     $options = Typecho_Widget::widget('Widget_Options');
     if (isset($widget->request->theme) && $widget->request->isGet()) {
         if ($widget->request->theme) {
             $theme = $widget->request->theme;
             if (static::check($theme)) {
                 Typecho_Cookie::set($cookie['name'], $widget->request->theme, $options->gmtTime + $cookie['expire'], $options->siteUrl);
             } else {
                 $widget->response->redirect(Typecho_Common::url($widget->request->getPathInfo(), $options->siteUrl));
             }
         } else {
             Typecho_Cookie::delete($cookie['name']);
             //直接提交?theme將刪除cookie,恢複默認主題
             return;
         }
     } else {
         $theme = Typecho_Cookie::get($cookie['name']);
         if (!$theme) {
             return;
         }
         if (!static::check($theme)) {
             Typecho_Cookie::delete($cookie['name']);
             return;
         }
     }
     /** 刪除舊主題的相關設置 */
     $themeRow = 'theme:' . $options->theme;
     if (isset($options->{$themeRow})) {
         $config = unserialize($options->{$themeRow});
         $options->{$themeRow} = '';
         foreach ($config as $row => $value) {
             $options->{$row} = '';
         }
     }
     /** 載入新主題的相關設置 參考var/Widget/Themes/Edit.php */
     $themeDir = __TYPECHO_ROOT_DIR__ . __TYPECHO_THEME_DIR__ . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR;
     $configFile = $themeDir . 'functions.php';
     if (file_exists($configFile)) {
         require_once $configFile;
         if (function_exists('themeConfig')) {
             $form = new Typecho_Widget_Helper_Form();
             themeConfig($form);
             $config = $form->getValues();
             if ($config) {
                 $options->{'theme:' . $theme} = serialize($config);
                 foreach ($config as $row => $value) {
                     $options->{$row} = $value;
                 }
             }
         }
     }
     /** 修改$this->options->theme */
     $options->theme = $theme;
     /** 修改$this->_themeDir */
     $widget->setThemeDir($themeDir);
 }
開發者ID:duxiangfei,項目名稱:plugins,代碼行數:64,代碼來源:Plugin.php

示例3: callback

 /**
  * 授權回調地址
  */
 public function callback()
 {
     if (empty($_GET['code'])) {
         throw new Typecho_Exception(_t('無效請求!'));
     }
     //跳轉
     if (!class_exists('SaeTOAuthV2')) {
         require_once './saetv2.ex.class.php';
     }
     $saeto_client = new SaeTOAuthV2($this->config->client_id, $this->config->client_secret);
     //取access_token
     $access_token = $saeto_client->getAccessToken('code', array('code' => trim($_GET['code']), 'redirect_uri' => $this->config->callback_url));
     if (empty($access_token) || !is_array($access_token) || empty($access_token['uid'])) {
         throw new Typecho_Exception(_t('獲取access_token失敗,請返回重新授權!'));
     }
     $table = $this->db->getPrefix() . self::$tableName;
     $query = $this->db->query("SELECT * FROM {$table} WHERE openid='{$access_token['uid']}' AND plateform='sina'");
     $users_oauth = $this->db->fetchRow($query);
     if (!empty($users_oauth['uid'])) {
         //該新浪帳號已經綁定了用戶
         if (Typecho_Widget::widget('Widget_User')->hasLogin()) {
             /** 直接返回 */
             $this->response->redirect(Typecho_Widget::widget('Widget_Options')->index);
         } else {
             //讓其直接登陸
             $this->setUserLogin($users_oauth['uid']);
             if (!Typecho_Widget::widget('Widget_User')->pass('contributor', true)) {
                 /** 不允許普通用戶直接跳轉後台 */
                 $this->response->redirect(Typecho_Widget::widget('Widget_Options')->profileUrl);
             } else {
                 $this->response->redirect(Typecho_Widget::widget('Widget_Options')->adminUrl);
             }
         }
         exit;
     }
     //該新浪帳號未綁定過
     /** 如果已經登錄 */
     if (Typecho_Widget::widget('Widget_User')->hasLogin()) {
         /** 直接綁定 */
         $cookieUid = Typecho_Cookie::get('__typecho_uid');
         $this->bindOauthUser($cookieUid, $access_token['uid'], 'sina', $access_token['expires_in']);
         $this->response->redirect(Typecho_Widget::widget('Widget_Options')->index);
     } else {
         //取用戶信息
         $saetc_client = new SaeTClientV2($this->config->client_id, $this->config->client_secret, $access_token['access_token']);
         $weibo_user = $saetc_client->show_user_by_id($access_token['uid']);
         //創建用戶
         $uid = $this->registerFromWeiboUser($weibo_user);
         if (!$uid) {
             throw new Typecho_Exception(_t('創建帳號失敗,請聯係管理員!'));
         }
         $this->setUserLogin($uid);
         $this->bindOauthUser($uid, $access_token['uid'], 'sina', $access_token['expires_in']);
         $this->response->redirect(Typecho_Widget::widget('Widget_Options')->profileUrl);
     }
     //構造用戶帳號
     exit;
 }
開發者ID:duxiangfei,項目名稱:plugins,代碼行數:61,代碼來源:AuthorizeAction.php

示例4: getReadMode

function getReadMode($icon = false)
{
    $class = Typecho_Cookie::get('read-mode', 'day');
    if ($icon) {
        $class = $class == 'day' ? 'fa fa-sun-o' : 'fa fa-moon-o';
    } else {
        $class = 'day' == $class ? '' : 'night-mode';
    }
    echo $class;
}
開發者ID:hongweipeng,項目名稱:cool_blog,代碼行數:10,代碼來源:functions.php

示例5: execute

 /**
  * 執行函數
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     if (NULL !== Typecho_Cookie::get('__typecho_notice')) {
         $this->noticeType = Typecho_Cookie::get('__typecho_notice_type');
         $this->push(Typecho_Cookie::get('__typecho_notice'));
         Typecho_Cookie::delete('__typecho_notice', $this->widget('Widget_Options')->siteUrl);
         Typecho_Cookie::delete('__typecho_notice_type', $this->widget('Widget_Options')->siteUrl);
     }
     if (NULL !== Typecho_Cookie::get('__typecho_notice_highlight')) {
         $this->highlight = Typecho_Cookie::get('__typecho_notice_highlight');
         Typecho_Cookie::delete('__typecho_notice_highlight', $this->widget('Widget_Options')->siteUrl);
     }
 }
開發者ID:raindali,項目名稱:express,代碼行數:19,代碼來源:Notice.php

示例6: getNotice

/**
 * 獲取提示消息
 */
function getNotice()
{
    $notice = Typecho_Cookie::get('__typecho_notice');
    if (empty($notice)) {
        echo "''";
        return;
    }
    $notice = json_decode($notice, true);
    $rs = array('msg' => $notice[0], 'type' => Typecho_Cookie::get('__typecho_notice_type'));
    Typecho_Cookie::delete('__typecho_notice');
    Typecho_Cookie::delete('__typecho_notice_type');
    echo json_encode($rs);
}
開發者ID:rootml,項目名稱:jianshu,代碼行數:16,代碼來源:header.php

示例7: hasLogin

 public static function hasLogin()
 {
     $cookieUid = Typecho_Cookie::get('__typecho_uid');
     if (null !== $cookieUid) {
         $db = Typecho_Db::get();
         $user = $db->fetchRow($db->select()->from('table.users')->where('uid = ?', intval($cookieUid))->limit(1));
         $cookieAuthCode = Typecho_Cookie::get('__typecho_authCode');
         if ($user && Typecho_Common::hashValidate($user['authCode'], $cookieAuthCode)) {
             return true;
         }
         Typecho_Cookie::delete('__typecho_uid');
         Typecho_Cookie::delete('__typecho_authCode');
     }
     return false;
 }
開發者ID:kirainmoe,項目名稱:typecho-plugin-Access,代碼行數:15,代碼來源:Plugin.php

示例8: like

 protected function like()
 {
     $cid = $this->request->cid;
     if (!$cid) {
         $this->response->throwJson(array('status' => 0, 'msg' => '請選擇喜歡的文章!'));
     }
     $likes = Typecho_Cookie::get('__sis_pls');
     if (empty($likes)) {
         $likes = array();
     } else {
         $likes = explode(',', $likes);
     }
     if (!in_array($cid, $likes)) {
         $db = Typecho_Db::get();
         $row = $db->fetchRow($db->select('likesNum')->from('table.contents')->where('cid = ?', $cid)->limit(1));
         $db->query($db->update('table.contents')->rows(array('likesNum' => (int) $row['likesNum'] + 1))->where('cid = ?', $cid));
         array_push($likes, $cid);
         $likes = implode(',', $likes);
         Typecho_Cookie::set('__sis_pls', $likes);
         //記錄查看cookie
         $this->response->throwJson(array('status' => 1, 'msg' => '成功點讚!'));
     }
     $this->response->throwJson(array('status' => 0, 'msg' => '你已經點讚過了!'));
 }
開發者ID:hongweipeng,項目名稱:cool_blog,代碼行數:24,代碼來源:Action.php

示例9: _e

                    <?php 
    }
    ?>
                    <?php 
}
?>
                    <!--<li><a href="<?php 
$options->adminUrl('profile.php');
?>
"><?php 
_e('更新我的資料');
?>
</a></li>-->
                </ul>
                <?php 
$version = Typecho_Cookie::get('__typecho_check_version');
?>
                <?php 
if ($version && $version['available']) {
    ?>
                <div class="update-check">
                    <p class="message notice">
                        <?php 
    _e('您當前使用的版本是');
    ?>
 <?php 
    echo $version['current'];
    ?>
 &rarr;
                        <strong><a href="<?php 
    echo $version['link'];
開發者ID:menmenweiwei,項目名稱:blog,代碼行數:31,代碼來源:index.php

示例10: execute

 /**
  * 執行函數
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     $select = $this->select();
     $this->parameter->setDefault('pageSize=20');
     $this->_currentPage = $this->request->get('page', 1);
     /** 過濾標題 */
     if (NULL != ($keywords = $this->request->filter('search')->keywords)) {
         $select->where('table.comments.text LIKE ?', '%' . $keywords . '%');
     }
     /** 如果具有貢獻者以上權限,可以查看所有評論,反之隻能查看自己的評論 */
     if (!$this->user->pass('editor', true)) {
         $select->where('table.comments.ownerId = ?', $this->user->uid);
     } else {
         if (!isset($this->request->cid)) {
             if ('on' == $this->request->__some_all_comments) {
                 Typecho_Cookie::set('__some_all_comments', 'on');
             } else {
                 if ('off' == $this->request->__some_all_comments) {
                     Typecho_Cookie::set('__some_all_comments', 'off');
                 }
                 if ('on' != Typecho_Cookie::get('__some_all_comments')) {
                     $select->where('table.comments.ownerId = ?', $this->user->uid);
                 }
             }
         }
     }
     if (in_array($this->request->status, array('approved', 'waiting', 'spam'))) {
         $select->where('table.comments.status = ?', $this->request->status);
     } else {
         if ('hold' == $this->request->status) {
             $select->where('table.comments.status <> ?', 'approved');
         } else {
             $select->where('table.comments.status = ?', 'approved');
         }
     }
     //增加按文章歸檔功能
     if (isset($this->request->cid)) {
         $select->where('table.comments.cid = ?', $this->request->filter('int')->cid);
     }
     $this->_countSql = clone $select;
     $select->order('table.comments.coid', Typecho_Db::SORT_DESC)->page($this->_currentPage, $this->parameter->pageSize);
     $this->db->fetchAll($select, array($this, 'push'));
 }
開發者ID:dccecc,項目名稱:typecho,代碼行數:49,代碼來源:Admin.php

示例11: execute

 /**
  * 執行函數
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     if (!$this->parameter->parentId) {
         return;
     }
     $commentsAuthor = Typecho_Cookie::get('__typecho_remember_author');
     $commentsMail = Typecho_Cookie::get('__typecho_remember_mail');
     $select = $this->select()->where('table.comments.cid = ?', $this->parameter->parentId)->where('table.comments.status = ? OR (table.comments.author = ? AND table.comments.mail = ? AND table.comments.status = ?)', 'approved', $commentsAuthor, $commentsMail, 'waiting');
     $threadedSelect = NULL;
     if ($this->options->commentsShowCommentOnly) {
         $select->where('table.comments.type = ?', 'comment');
     }
     $select->order('table.comments.coid', 'ASC');
     $this->db->fetchAll($select, array($this, 'push'));
     /** 需要輸出的評論列表 */
     $outputComments = array();
     /** 如果開啟評論回複 */
     if ($this->options->commentsThreaded) {
         foreach ($this->stack as $coid => &$comment) {
             /** 取出父節點 */
             $parent = $comment['parent'];
             /** 如果存在父節點 */
             if (0 != $parent && isset($this->stack[$parent])) {
                 /** 如果當前節點深度大於最大深度, 則將其掛接在父節點上 */
                 if ($comment['levels'] >= $this->options->commentsMaxNestingLevels) {
                     $comment['levels'] = $this->stack[$parent]['levels'];
                     $parent = $this->stack[$parent]['parent'];
                     // 上上層節點
                     $comment['parent'] = $parent;
                 }
                 /** 計算子節點順序 */
                 $comment['order'] = isset($this->_threadedComments[$parent]) ? count($this->_threadedComments[$parent]) + 1 : 1;
                 /** 如果是子節點 */
                 $this->_threadedComments[$parent][$coid] = $comment;
             } else {
                 $outputComments[$coid] = $comment;
             }
         }
         $this->stack = $outputComments;
     }
     /** 評論排序 */
     if ('DESC' == $this->options->commentsOrder) {
         $this->stack = array_reverse($this->stack, true);
         $this->_threadedComments = array_map('array_reverse', $this->_threadedComments);
     }
     /** 評論總數 */
     $this->_total = count($this->stack);
     /** 對評論進行分頁 */
     if ($this->options->commentsPageBreak) {
         if ('last' == $this->options->commentsPageDisplay && !$this->parameter->commentPage) {
             $this->_currentPage = ceil($this->_total / $this->options->commentsPageSize);
         } else {
             $this->_currentPage = $this->parameter->commentPage ? $this->parameter->commentPage : 1;
         }
         /** 截取評論 */
         $this->stack = array_slice($this->stack, ($this->_currentPage - 1) * $this->options->commentsPageSize, $this->options->commentsPageSize);
         /** 評論置位 */
         $this->row = current($this->stack);
         $this->length = count($this->stack);
     }
     reset($this->stack);
 }
開發者ID:Sunappnio,項目名稱:typecho,代碼行數:68,代碼來源:Archive.php

示例12:

<?php

include 'common.php';
include 'header.php';
$rememberName = Typecho_Cookie::get('__typecho_remember_name');
Typecho_Cookie::delete('__typecho_remember_name');
?>
<div class="body body-950">
    <div class="container">
        <div class="column-07 start-09 typecho-login">
            <h2 class="logo-dark">typecho</h2>
            <form action="<?php 
$options->loginAction();
?>
" method="post" name="login">
                <fieldset>
                    <?php 
if (!$user->hasLogin()) {
    ?>
                    <?php 
    if ($notice->have() && in_array($notice->noticeType, array('success', 'notice', 'error'))) {
        ?>
                    <div class="message <?php 
        $notice->noticeType();
        ?>
 typecho-radius-topleft typecho-radius-topright typecho-radius-bottomleft typecho-radius-bottomright">
                    <ul>
                        <?php 
        $notice->lists();
        ?>
                    </ul>
開發者ID:raindali,項目名稱:express,代碼行數:31,代碼來源:login.php

示例13: action

 public function action()
 {
     // protect
     $this->security->protect();
     /** 如果已經登錄 */
     if ($this->user->hasLogin()) {
         /** 直接返回 */
         $this->response->redirect($this->options->index);
     }
     /** 如果未開啟注冊 */
     if (!$this->options->allowRegister) {
         /** 直接返回 */
         $this->widget('Widget_Notice')->set('未開啟注冊!', 'error');
         $this->response->redirect($this->options->index);
     }
     /** 初始化驗證類 */
     $validator = new Typecho_Validate();
     $validator->addRule('captcha', 'required', _t('必須填寫驗證碼'));
     $validator->addRule('captcha', array($this, 'checkCaptcha'), _t('驗證碼錯誤'));
     $validator->addRule('name', 'required', _t('必須填寫用戶名稱'));
     $validator->addRule('name', 'minLength', _t('用戶名至少包含2個字符'), 2);
     $validator->addRule('name', 'maxLength', _t('用戶名最多包含32個字符'), 32);
     $validator->addRule('name', 'xssCheck', _t('請不要在用戶名中使用特殊字符'));
     $validator->addRule('name', array($this, 'nameExists'), _t('用戶名已經存在'));
     $validator->addRule('mail', 'required', _t('必須填寫電子郵箱'));
     $validator->addRule('mail', array($this, 'mailExists'), _t('電子郵箱地址已經存在'));
     $validator->addRule('mail', 'email', _t('電子郵箱格式錯誤'));
     $validator->addRule('mail', 'maxLength', _t('電子郵箱最多包含200個字符'), 200);
     /** 如果請求中有password */
     $validator->addRule('password', 'required', _t('必須填寫密碼'));
     $validator->addRule('password', 'minLength', _t('為了保證賬戶安全, 請輸入至少六位的密碼'), 6);
     $validator->addRule('password', 'maxLength', _t('為了便於記憶, 密碼長度請不要超過十八位'), 18);
     $validator->addRule('confirm', 'confirm', _t('兩次輸入的密碼不一致'), 'password');
     /** 截獲驗證異常 */
     if ($error = $validator->run($this->request->from('captcha', 'name', 'password', 'mail', 'confirm'))) {
         Typecho_Cookie::set('__typecho_remember_name', $this->request->name);
         Typecho_Cookie::set('__typecho_remember_mail', $this->request->mail);
         /** 設置提示信息 */
         $this->widget('Widget_Notice')->set($error, 'error');
         $this->response->goBack();
     }
     $hasher = new PasswordHash(8, true);
     //$generatedPassword = Typecho_Common::randString(7);
     $extend = array();
     $inviter = Typecho_Cookie::get('__typecho_inviter');
     if (!empty($inviter)) {
         $inviter = $this->widget('Widget_Users_Query@name_' . $inviter, 'name=' . $inviter);
         if ($inviter->have()) {
             $extend['inviter'] = $inviter->name;
         }
         Typecho_Cookie::delete('__typecho_inviter');
     }
     $dataStruct = array('name' => $this->request->name, 'mail' => $this->request->mail, 'screenName' => $this->request->name, 'password' => $hasher->HashPassword($this->request->password), 'created' => $this->options->gmtTime, 'group' => 'subscriber', 'extend' => empty($extend) ? '' : serialize($extend));
     $insertId = $this->insert($dataStruct);
     $this->db->fetchRow($this->select()->where('uid = ?', $insertId)->limit(1), array($this, 'push'));
     $this->user->login($this->request->name, $this->request->password);
     $params = array('uid' => $this->user->uid, 'confirm' => $this->user->mail, 'name' => $this->user->screenName, 'type' => 'register');
     //發送驗證信息
     Widget_Common::sendVerify($params);
     //注冊積分
     Widget_Common::credits('register');
     $this->widget('Widget_Notice')->set(_t('用戶 <strong>%s</strong> 已經成功注冊,請及時驗證郵件', $this->screenName), 'success');
     $this->response->redirect($this->options->index);
 }
開發者ID:ClayMoreBoy,項目名稱:sisome,代碼行數:64,代碼來源:Register.php

示例14: filter

 /**
  * 通用過濾器
  *
  * @access public
  * @param array $value 需要過濾的行數據
  * @return array
  * @throws Typecho_Widget_Exception
  */
 public function filter(array $value)
 {
     /** 取出所有分類 */
     $value['categories'] = $this->db->fetchAll($this->db->select()->from('table.metas')->join('table.relationships', 'table.relationships.mid = table.metas.mid')->where('table.relationships.cid = ?', $value['cid'])->where('table.metas.type = ?', 'category')->order('table.metas.order', Typecho_Db::SORT_ASC), array($this->widget('Widget_Metas_Category_List'), 'filter'));
     $value['category'] = NULL;
     $value['directory'] = array();
     /** 取出第一個分類作為slug條件 */
     if (!empty($value['categories'])) {
         $value['category'] = $value['categories'][0]['slug'];
         $value['directory'] = $this->widget('Widget_Metas_Category_List')->getAllParents($value['categories'][0]['mid']);
         $value['directory'][] = $value['category'];
     }
     $value['date'] = new Typecho_Date($value['created']);
     /** 生成日期 */
     $value['year'] = $value['date']->year;
     $value['month'] = $value['date']->month;
     $value['day'] = $value['date']->day;
     /** 生成訪問權限 */
     $value['hidden'] = false;
     /** 獲取路由類型並判斷此類型在路由表中是否存在 */
     $type = $value['type'];
     $routeExists = NULL != Typecho_Router::get($type);
     $tmpSlug = $value['slug'];
     $tmpCategory = $value['category'];
     $tmpDirectory = $value['directory'];
     $value['slug'] = urlencode($value['slug']);
     $value['category'] = urlencode($value['category']);
     $value['directory'] = implode('/', array_map('urlencode', $value['directory']));
     /** 生成靜態路徑 */
     $value['pathinfo'] = $routeExists ? Typecho_Router::url($type, $value) : '#';
     /** 生成靜態鏈接 */
     $value['permalink'] = Typecho_Common::url($value['pathinfo'], $this->options->index);
     /** 處理附件 */
     if ('attachment' == $type) {
         $content = @unserialize($value['text']);
         //增加數據信息
         $value['attachment'] = new Typecho_Config($content);
         $value['attachment']->isImage = in_array($content['type'], array('jpg', 'jpeg', 'gif', 'png', 'tiff', 'bmp'));
         $value['attachment']->url = Widget_Upload::attachmentHandle($value);
         if ($value['attachment']->isImage) {
             $value['text'] = '<img src="' . $value['attachment']->url . '" alt="' . $value['title'] . '" />';
         } else {
             $value['text'] = '<a href="' . $value['attachment']->url . '" title="' . $value['title'] . '">' . $value['title'] . '</a>';
         }
     }
     /** 處理Markdown **/
     $value['isMarkdown'] = 0 === strpos($value['text'], '<!--markdown-->');
     if ($value['isMarkdown']) {
         $value['text'] = substr($value['text'], 15);
     }
     /** 生成聚合鏈接 */
     /** RSS 2.0 */
     $value['feedUrl'] = $routeExists ? Typecho_Router::url($type, $value, $this->options->feedUrl) : '#';
     /** RSS 1.0 */
     $value['feedRssUrl'] = $routeExists ? Typecho_Router::url($type, $value, $this->options->feedRssUrl) : '#';
     /** ATOM 1.0 */
     $value['feedAtomUrl'] = $routeExists ? Typecho_Router::url($type, $value, $this->options->feedAtomUrl) : '#';
     $value['slug'] = $tmpSlug;
     $value['category'] = $tmpCategory;
     $value['directory'] = $tmpDirectory;
     /** 處理密碼保護流程 */
     if (!empty($value['password']) && $value['password'] !== Typecho_Cookie::get('protectPassword') && $value['authorId'] != $this->user->uid && !$this->user->pass('editor', true)) {
         $value['hidden'] = true;
         /** 拋出錯誤 */
         if ($this->request->isPost() && isset($this->request->protectPassword)) {
             throw new Typecho_Widget_Exception(_t('對不起,您輸入的密碼錯誤'), 403);
         }
     }
     $value = $this->pluginHandle(__CLASS__)->filter($value, $this);
     /** 如果訪問權限被禁止 */
     if ($value['hidden']) {
         $value['text'] = '<form class="protected" action="' . $this->security->getTokenUrl($value['permalink']) . '" method="post">' . '<p class="word">' . _t('請輸入密碼訪問') . '</p>' . '<p><input type="password" class="text" name="protectPassword" />
         <input type="submit" class="submit" value="' . _t('提交') . '" /></p>' . '</form>';
         $value['title'] = _t('此內容被密碼保護');
         $value['tags'] = array();
         $value['commentsNum'] = 0;
     }
     return $value;
 }
開發者ID:Jsechoo,項目名稱:sisome,代碼行數:87,代碼來源:Contents.php

示例15: htmlspecialchars

<?php

if (!defined('__TYPECHO_ROOT_DIR__')) {
    exit;
}
$this->need('header.php');
?>
<style>.user-page .page-title,.user-page footer{display:none;}</style>
<?php 
$rememberName = htmlspecialchars(Typecho_Cookie::get('__typecho_remember_name'));
$rememberMail = htmlspecialchars(Typecho_Cookie::get('__typecho_remember_mail'));
$notice = Typecho_Cookie::get('__typecho_notice');
if (!empty($notice)) {
    $notice = json_decode($notice, true);
}
Typecho_Cookie::delete('__typecho_remember_name');
Typecho_Cookie::delete('__typecho_remember_mail');
?>
<div id="sidebar">
    <?php 
$this->need('user/widget_login.php');
?>
</div>
<div class="box" id="main">
    <div class="head">
        <div class="location">
            <a href="<?php 
$this->options->siteUrl();
?>
"><?php 
$this->options->title();
開發者ID:ClayMoreBoy,項目名稱:sisome,代碼行數:31,代碼來源:register.php


注:本文中的Typecho_Cookie::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。