当前位置: 首页>>代码示例>>PHP>>正文


PHP History::clear方法代码示例

本文整理汇总了PHP中History::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP History::clear方法的具体用法?PHP History::clear怎么用?PHP History::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在History的用法示例。


在下文中一共展示了History::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clear

 public function clear()
 {
     $this->autoRender = false;
     if ($this->request->is('post')) {
         return json_encode(History::clear($this->Session));
     }
 }
开发者ID:rjawor,项目名称:tagging,代码行数:7,代码来源:HistoryController.php

示例2: testGetLength

 public function testGetLength()
 {
     $instance = new History();
     $this->assertEquals(0, $instance->getLength());
     $instance->add('foo');
     $this->assertEquals(1, $instance->getLength());
     $instance->add('bar');
     $this->assertEquals(2, $instance->getLength());
     $instance->clear();
     $this->assertEquals(0, $instance->getLength());
 }
开发者ID:mlessnau,项目名称:pry,代码行数:11,代码来源:HistoryTest.php

示例3: index

 public function index($documentId = -1, $offset = -1, $gridX = 0, $editMode = 0)
 {
     $contextSize = 1;
     $userModel = ClassRegistry::init('User');
     $currentUser = $userModel->findById($this->Auth->user('id'));
     if ($documentId < 0) {
         $documentId = $currentUser['User']['current_document_id'];
         $offset = $currentUser['User']['current_document_offset'];
         if (!$offset) {
             $offset = 0;
         }
         History::clear($this->Session);
     }
     if (!$documentId) {
         $this->Session->setFlash(__('Select a document in the Documents view'));
     } else {
         $sentenceModel = ClassRegistry::init('Sentence');
         $sentencesCount = $sentenceModel->find('count', array('conditions' => array('document_id' => $documentId), 'recursive' => -1));
         if ($offset < $contextSize) {
             $computedOffset = 0;
             $limit = $contextSize - $offset + 1;
         } else {
             $computedOffset = $offset - $contextSize;
             $limit = 2 * $contextSize + 1;
         }
         $sentencesWindow = $sentenceModel->find('all', array('conditions' => array('document_id' => $documentId), 'recursive' => 1, 'offset' => $computedOffset, 'order' => 'position', 'limit' => $limit));
         if ($offset < $contextSize) {
             $currentSentenceIndex = $offset;
         } else {
             $currentSentenceIndex = $contextSize;
         }
         $sentenceData = Utils::getSentenceData($sentencesWindow[$currentSentenceIndex]['Sentence']['id']);
         $this->set('sentence', $sentenceData['sentence']);
         $this->set('wordAnnotationCount', $sentenceData['wordAnnotationCount']);
         $this->set('wordAnnotationTypes', $sentenceData['wordAnnotationTypes']);
         $this->set('sentenceAnnotationCount', $sentenceData['sentenceAnnotationCount']);
         $this->set('sentencesCount', $sentencesCount);
         $this->set('sentencesWindow', $sentencesWindow);
         $this->set('currentSentenceIndex', $currentSentenceIndex);
         $this->set('offset', $offset);
         $this->set('gridX', $gridX);
         $this->set('editMode', $editMode);
         $this->set('documentId', $documentId);
         $this->set('userRoleId', $currentUser['User']['role_id']);
         $this->set('hotKeys', array('q', 'w', 'e', 'r', 'a', 's', 'd', 'f', 'z', 'x', 'c', 'v', 't', 'y', 'u', 'i', 'o', 'g', 'h', 'j', 'k', 'l', 'b', 'n', 'm'));
     }
 }
开发者ID:rjawor,项目名称:tagging,代码行数:47,代码来源:DashboardController.php

示例4: process

 public static function process($url, $history_call = false, $refresh = false)
 {
     if (MODULE_TIMES) {
         $time = microtime(true);
     }
     $url = str_replace('&amp;', '&', $url);
     //do we need this if we set arg_separator.output to &?
     if ($url) {
         $_POST = array();
         parse_str($url, $_POST);
         if (get_magic_quotes_gpc()) {
             $_POST = undoMagicQuotes($_POST);
         }
         $_GET = $_REQUEST =& $_POST;
     }
     ModuleManager::load_modules();
     self::check_firstrun();
     if ($history_call === '0') {
         History::clear();
     } elseif ($history_call) {
         History::set_id($history_call);
     }
     //on init call methods...
     $ret = on_init(null, null, null, true);
     foreach ($ret as $k) {
         call_user_func_array($k['func'], $k['args']);
     }
     $root =& ModuleManager::create_root();
     self::go($root);
     //go somewhere else?
     $loc = location(null, true);
     //on exit call methods...
     $ret = on_exit(null, null, null, true, $loc === false);
     foreach ($ret as $k) {
         call_user_func_array($k['func'], $k['args']);
     }
     if ($loc !== false) {
         if (isset($_REQUEST['__action_module__'])) {
             $loc['__action_module__'] = $_REQUEST['__action_module__'];
         }
         //clean up
         foreach (self::$content as $k => $v) {
             unset(self::$content[$k]);
         }
         foreach (self::$jses as $k => $v) {
             if ($v[1]) {
                 unset(self::$jses[$k]);
             }
         }
         //go
         $loc['__location'] = microtime(true);
         return self::process(http_build_query($loc), false, true);
     }
     $debug = '';
     if (DEBUG && ($debug_diff = @(include_once 'tools/Diff.php'))) {
         require_once 'tools/Text/Diff/Renderer/inline.php';
         $diff_renderer = new Text_Diff_Renderer_inline();
     }
     //clean up old modules
     if (isset($_SESSION['client']['__module_content__'])) {
         $to_cleanup = array_keys($_SESSION['client']['__module_content__']);
         foreach ($to_cleanup as $k) {
             $mod = ModuleManager::get_instance($k);
             if ($mod === null) {
                 $xx = explode('/', $k);
                 $yy = explode('|', $xx[count($xx) - 1]);
                 $mod = $yy[0];
                 if (is_callable(array($mod . 'Common', 'destroy'))) {
                     call_user_func(array($mod . 'Common', 'destroy'), $k, isset($_SESSION['client']['__module_vars__'][$k]) ? $_SESSION['client']['__module_vars__'][$k] : null);
                 }
                 if (DEBUG) {
                     $debug .= 'Clearing mod vars & module content ' . $k . '<br>';
                 }
                 unset($_SESSION['client']['__module_vars__'][$k]);
                 unset($_SESSION['client']['__module_content__'][$k]);
             }
         }
     }
     $reloaded = array();
     foreach (self::$content as $k => $v) {
         $reload = $v['module']->get_reload();
         $parent = $v['module']->get_parent_path();
         if (DEBUG && REDUCING_TRANSFER) {
             $debug .= '<hr style="height: 3px; background-color:black">';
             $debug .= '<b> Checking ' . $k . ', &nbsp;&nbsp;&nbsp; parent=' . $v['module']->get_parent_path() . '</b><ul>' . '<li>Force - ' . (isset($reload) ? print_r($reload, true) : 'not set') . '</li>' . '<li>First display - ' . (isset($_SESSION['client']['__module_content__'][$k]) ? 'no</li>' . '<li>Content changed - ' . ($_SESSION['client']['__module_content__'][$k]['value'] !== $v['value'] ? 'yes' : 'no') . '</li>' . '<li>JS changed - ' . ($_SESSION['client']['__module_content__'][$k]['js'] !== $v['js'] ? 'yes' : 'no') : 'yes') . '</li>' . '<li>Parent reloaded - ' . (isset($reloaded[$parent]) ? 'yes' : 'no') . '</li>' . '<li>History call - ' . ($history_call ? 'yes' : 'no') . '</li>' . '</ul>';
         }
         if (!REDUCING_TRANSFER || (!isset($reload) && (!isset($_SESSION['client']['__module_content__'][$k]) || $_SESSION['client']['__module_content__'][$k]['value'] !== $v['value'] || $_SESSION['client']['__module_content__'][$k]['js'] !== $v['js']) || $history_call || $reload == true || isset($reloaded[$parent]))) {
             //force reload or parent reloaded
             if (DEBUG && isset($_SESSION['client']['__module_content__'])) {
                 $debug .= '<b>Reloading: ' . (isset($v['span']) ? ';&nbsp;&nbsp;&nbsp;&nbsp;span=' . $v['span'] . ',' : '') . '&nbsp;&nbsp;&nbsp;&nbsp;triggered=' . ($reload == true ? 'force' : 'auto') . ',&nbsp;&nbsp;</b><hr><b>New value:</b><br><pre>' . htmlspecialchars($v['value']) . '</pre>' . (isset($_SESSION['client']['__module_content__'][$k]['value']) ? '<hr><b>Old value:</b><br><pre>' . htmlspecialchars($_SESSION['client']['__module_content__'][$k]['value']) . '</pre>' : '');
                 if ($debug_diff && isset($_SESSION['client']['__module_content__'][$k]['value'])) {
                     $xxx = new Text_Diff(explode("\n", $_SESSION['client']['__module_content__'][$k]['value']), explode("\n", $v['value']));
                     $debug .= '<hr><b>Diff:</b><br><pre>' . $diff_renderer->render($xxx) . '</pre>';
                 }
                 $debug .= '<hr style="height: 5px; background-color:black">';
             }
             if (isset($v['span'])) {
                 self::text($v['value'], $v['span']);
             }
             if ($v['js']) {
//.........这里部分代码省略.........
开发者ID:cretzu89,项目名称:EPESI,代码行数:101,代码来源:epesi.php


注:本文中的History::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。