如果指令所在的行没有其他内容，那么将两边的空白内容删除。

@author subchen@gmail.com
338923
private List<Statement> trim(List<Statement> nodes) throws ParseException {
        if (!removeDirectiveBlankLine) {
            return nodes;
        }

        // 待移除的空的 Text Node (主要是 Text Node 不允许为空的内容，只能在循环外把它delete了)
        List<Integer> empty_text_index_list = new ArrayList<Integer>();

        for (int i = 0; i < nodes.size(); i++) {
            Statement node = nodes.get(i);

            if (isTrimableDirective(node)) {
                if (i > 0) {
                    int prev_index = i - 1;
                    Statement prev = nodes.get(prev_index);

                    if (isNoLiteralText(prev)
                            && !empty_text_index_list.contains(prev_index)) {
                        // 删除上一个文本节点最后一个\n之后的所有空白符
                        String text = ((Text) prev).getContent();
                        int pos = text.lastIndexOf('\n');
                        if (pos >= 0) {
                            String tail = text.substring(pos + 1);
                            if (tail.length() > 0 && tail.trim().length() == 0) {
                                text = text.substring(0, pos + 1);
                                if (text.length() == 0) {
                                    empty_text_index_list.add(prev_index); // 将会是空节点，加入到待删除队列
                                } else {
                                    nodes.set(prev_index, new Text(text, false,
                                            prev.getOffset())); // 修改
                                }
                            }
                        }
                    }
                } // prev text node

                if (i + 1 < nodes.size()) {
                    int next_index = i + 1;
                    Statement next = nodes.get(next_index);

                    if (isNoLiteralText(next)) {
                        // 删除下一个文本节点地一个\n之前的所有空白符
                        String text = ((Text) next).getContent();
                        int pos = text.indexOf('\n');
                        if (pos >= 0) {
                            String head = text.substring(0, pos);
                            if (head.trim().length() == 0) {
                                text = text.substring(pos + 1);
                                boolean isEmptyNode = false;
                                if (text.length() == 0) {
                                    empty_text_index_list.add(next_index); // 将会是空节点，加入到待删除队列
                                    isEmptyNode = true;
                                } else if (text.indexOf('\n') == -1
                                        && text.trim().length() == 0) {
                                    // 看看下面是不是还是个指令，是不是可以全部丢掉
                                    if (next_index + 1 < nodes.size()) {
                                        Statement next_next = nodes
                                                .get(next_index + 1);
                                        if (isTrimableDirective(next_next)) {
                                            empty_text_index_list
                                                    .add(next_index); // 将会是空节点，加入到待删除队列
                                            isEmptyNode = true;
                                        }
                                    }
                                }
                                if (!isEmptyNode) {
                                    nodes.set(next_index, new Text(text, false,
                                            next.getOffset())); // 修改
                                }
                            }
                        }
                        i++; // skip next
                    }
                } // next text node
            } // not Directive
        }

        // 删除需要删掉的空节点。
        if (empty_text_index_list.size() > 0) {
            // 必须先删除后面的node
            for (int i = empty_text_index_list.size() - 1; i >= 0; i--) {
                int index = empty_text_index_list.get(i); // 必须转成小 int,
                // 否则就是删除对象，不是删除指定的index
                nodes.remove(index);
            }
        }
        return nodes;
    }
172866
function lightcode(buffer, count) {
    var len = buffer.length.toString().length;
    var lines = buffer.slice(-count);
    for (var i = lines.length - 1; i >= 0; i--) {
      var l = (buffer.length + i - lines.length + 1).toString();
      l = (new Array(len - l.length + 1)).join(' ') + l; // 前面补空格
      lines[i] = l + (i === lines.length - 1 ? ' > ' : '   ') + '| ' + lines[i];
    }
    console.log(lines.join('\n'));
  }
159133
public function renderEmptyText()
	{
		$emptyText=$this->emptyText===null ? Yii::t('zii','No results found.') : $this->emptyText;
		echo CHtml::tag($this->emptyTagName, array('class'=>$this->emptyCssClass), $emptyText);
	}
510821
public static function parseCommand()
    {
        // 检查运行命令的参数
        global $argv;
        $startFile = $argv[0];
        if ( ! isset($argv[1]))
        {
            self::printUsage($startFile);
            exit;
        }

        // 命令
        $command = trim($argv[1]);

        // 子命令，目前只支持-d
        $command2 = isset($argv[2]) ? $argv[2] : '';

        // 记录日志
        $mode = '';
        if ($command === 'start')
        {
            if ($command2 === '-d')
            {
                $mode = 'in DAEMON mode';
            }
            else
            {
                $mode = 'in DEBUG mode';
            }
        }

        Base::getLog()->debug(__METHOD__ . ' parse and execute command', [
            'file'    => $startFile,
            'command' => $command,
            'mode'    => $mode,
        ]);

        // 检查主进程是否在运行
        $masterPid = @file_get_contents(self::$pidFile);
        Base::getLog()->debug(__METHOD__ . ' get master pid from pidFile', [
            'file' => self::$pidFile,
            'pid'  => $masterPid,
        ]);

        $masterIsAlive = $masterPid && @posix_kill($masterPid, 0);
        Base::getLog()->debug(__METHOD__ . ' if master is alive', [
            'alive' => $masterIsAlive,
        ]);

        if ($masterIsAlive)
        {
            if ($command === 'start')
            {
                Base::getLog()->debug(__METHOD__ . ' server is running', [
                    'file' => $startFile,
                ]);
            }
        }
        elseif ($command !== 'start' && $command !== 'restart')
        {
            Base::getLog()->debug(__METHOD__ . ' server is not running', [
                'file' => $startFile,
            ]);
        }

        // 根据命令做相应处理
        switch ($command)
        {
            // 启动 workerman
            case 'start':
                if ($command2 === '-d')
                {
                    Worker::$daemonize = true;
                }
                break;
            // 显示 workerman 运行状态
            case 'status':
                // 尝试删除统计文件，避免脏数据
                if (is_file(self::$statusFile))
                {
                    Base::getLog()->debug(__METHOD__ . ' delete old status file', [
                        'file' => self::$statusFile,
                    ]);
                    @unlink(self::$statusFile);
                }
                // 向主进程发送 SIGUSR2 信号 ，然后主进程会向所有子进程发送 SIGUSR2 信号
                // 所有进程收到 SIGUSR2 信号后会向 $statusFile 写入自己的状态
                posix_kill($masterPid, SIGUSR2);
                // 睡眠100毫秒，等待子进程将自己的状态写入 $statusFile 指定的文件
                usleep(100000);
                // 展示状态
                if ( ! is_file(self::$statusFile))
                {
                    exit("Status file is missing.\n");
                }
                readfile(self::$statusFile);
                exit(0);
            // 重启 workerman
            case 'restart':
                // 停止 workeran

            case 'stop':

                Base::getLog()->debug(__METHOD__ . ' stopping all services', [
                    'file' => $startFile,
                ]);

                // 想主进程发送SIGINT信号，主进程会向所有子进程发送SIGINT信号
                $masterPid && posix_kill($masterPid, SIGINT);
                // 如果 $timeout 秒后主进程没有退出则展示失败界面
                $timeout = 5;
                $startTime = time();
                while (1)
                {
                    // 检查主进程是否存活
                    $masterIsAlive = $masterPid && posix_kill($masterPid, 0);
                    if ($masterIsAlive)
                    {
                        // 检查是否超过$timeout时间
                        if (time() - $startTime >= $timeout)
                        {
                            self::log("Workerman[$startFile] stop fail");
                            exit;
                        }
                        usleep(10000);
                        continue;
                    }
                    self::log("Workerman[$startFile] stop success");
                    // 是restart命令
                    if ($command === 'stop')
                    {
                        exit(0);
                    }
                    // -d 说明是以守护进程的方式启动
                    if ($command2 === '-d')
                    {
                        Worker::$daemonize = true;
                    }
                    break;
                }
                break;
            // 平滑重启 workerman
            case 'reload':
                posix_kill($masterPid, SIGUSR1);
                self::log("Workerman[$startFile] reload");
                exit;
            // 未知命令
            default :
                self::printUsage($startFile);
                exit;
        }
    }
89977
private function getMdContent()
    {
        $tables = $this->initTablesData();
        $content = "## 数据字典\n";
        foreach ($tables as $table){
            $content .= $this->tableName($table);
        }
        $content .= "\n";
        foreach ($tables as $key => $table){
            $content .= $this->tableDetail($key, $table);
        }
        return $content;
    }
275034
public Iterable<MultiPart> parts() throws IOException {
        if (!isMultipart()) return emptyIterable;
        final String boundarystr = "--" + this.boundary;
        final Pattern fielnameReg = this.fielnamePattern;
        final String endboundary = boundarystr + "--";
        final byte[] boundarray = ("\n" + boundarystr).getBytes();
        final byte[] buffer = new byte[boundarray.length];
        final InputStream input = this.in;
        final DefaultAnyValue params = this.parameters;
        final AtomicBoolean finaled = new AtomicBoolean(false);
        return () -> new Iterator<MultiPart>() {

            private String boundaryline;

            private MultiPart lastentry;

            @Override
            public boolean hasNext() {
                try {
                    if (lastentry != null) {
                        lastentry.skip();
                        if (finaled.get()) return false;
                    }
                    if (boundaryline == null) boundaryline = readBoundary();
                    //if (debug) System.out.print("boundaryline=" + boundaryline + "  ");
                    if (endboundary.equals(boundaryline) || !boundarystr.equals(boundaryline)) { //结尾或异常
                        lastentry = null;
                        return false;
                    }
                    final String disposition = readLine();
                    //if (debug) System.out.println("disposition=" + disposition);
                    if (disposition.contains("; filename=\"")) { //是上传文件
                        String contentType = "";
                        //读掉HTTP Header和空白行 通常情况下Content-Type后面就是内容，但是有些特殊情况下后面会跟其他如Content-Length: xxx等HTTP header，所以需要循环读取
                        String rl;
                        while (!(rl = readLine()).isEmpty()) {
                            if (rl.startsWith("Content-Type:")) contentType = rl.substring(rl.indexOf(':') + 1).trim();
                        }
                        //if (debug) System.out.println("file.contentType=" + contentType);

                        String name = parseValue(disposition, "name");
                        String filename = parseValue(disposition, "filename");
                        if (filename == null || filename.isEmpty()) { //没有上传
                            readLine(); //读掉空白行
                            this.boundaryline = null;
                            this.lastentry = null;
                            return this.hasNext();
                        } else {
                            int p1 = filename.lastIndexOf('/');
                            if (p1 < 0) p1 = filename.lastIndexOf('\\');
                            if (p1 >= 0) filename = filename.substring(p1 + 1);
                        }
                        final AtomicLong counter = new AtomicLong(0);
                        InputStream source = new InputStream() {

                            private int bufposition = buffer.length;

                            private boolean end;

                            @Override
                            public int read() throws IOException {
                                if (end) return -1;
                                final byte[] buf = buffer;
                                int ch = (this.bufposition < buf.length) ? (buf[this.bufposition++] & 0xff) : input.read();
                                if ((ch == '\r' && readBuffer())) return -1;
                                counter.incrementAndGet();
                                return ch;
                            }

                            private boolean readBuffer() throws IOException {
                                final byte[] buf = buffer;
                                final int pos = this.bufposition;
                                int s = 0;
                                for (int i = pos; i < buf.length; i++) {
                                    buf[s++] = buf[i];
                                }
                                int readed = 0;
                                while ((readed += input.read(buf, s + readed, pos - readed)) != pos);
                                this.bufposition = 0;
                                if (Arrays.equals(boundarray, buf)) {
                                    this.end = true;
                                    int c1 = input.read();
                                    int c2 = input.read();
                                    finaled.set(c1 == '-' && c2 == '-');
                                    return true;
                                }
                                return false;
                            }

                            @Override
                            public long skip(long count) throws IOException {
                                if (end) return -1;
                                if (count <= 0) return 0;
                                long s = 0;
                                while (read() != -1) {
                                    s++;
                                    if (--count <= 0) break;
                                }
                                return s;
                            }
                        };
                        this.lastentry = new MultiPart(filename, name, contentType, counter, source);
                        if (fielnameReg != null && !fielnameReg.matcher(filename).matches()) {
                            return this.hasNext();
                        }
                        return true;
                    } else { //不是文件
                        readLine(); //读掉空白
                        params.addValue(parseValue(disposition, "name"), readLine());
                        this.boundaryline = null;
                        this.lastentry = null;
                        return this.hasNext();
                    }
                } catch (IOException ex) {
                    logger.log(Level.FINER, "list multiparts abort", ex);
                    return false;
                }
            }

            @Override
            public MultiPart next() {
                return lastentry;
            }

        };
    }
229249
public static List<String> split(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty){
		if(StrUtil.isEmpty(str)){
			return new ArrayList<String>(0);
		}
		if(limit == 1){
			return addToList(new ArrayList<String>(1), str, isTrim, ignoreEmpty);
		}
		
		if(null == separatorPattern){//分隔符为空时按照空白符切分
			return split(str, limit);
		}
		
		final Matcher matcher = separatorPattern.matcher(str);
		final ArrayList<String> list = new ArrayList<>();
		int len = str.length();
		int start = 0;
		while(matcher.find()){
			addToList(list, str.substring(start, matcher.start()), isTrim, ignoreEmpty);
			start = matcher.end();
			
			//检查是否超出范围（最大允许limit-1个，剩下一个留给末尾字符串）
			if(limit > 0 && list.size() > limit-2){
				break;
			}
		}
		return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
	}
866184
public static function dom(){
        $attr = self::$attr;
//        $attr['param'] = self::strToArray($attr['param']);
//        p($attr['param']);

        $label = explode('|',$attr['label']);
        $linkfield = explode('|',$attr['linkfield']);

        $str = '';
        foreach($label as $k => $v){

            $str .= <<<EOT
    <label class="layui-form-label">{$v}</label>
    <div class="layui-input-inline">
        <select name="{$linkfield[$k]}" lay-verify="{$attr['layVerify']}" >
            <option value="">请选择</option>
        </select>
    </div>
EOT;

        }

        $dom = <<<EOT
            <div class="layui-form-item {$attr['component_name']}" component-name="linkselect" id="{$attr['id']}">
                    {$str}
                    <div class="layui-form-mid layui-word-aux">{$attr['helpinfo']}</div>
                </div>
EOT;

        return $dom;
    }
472963
@Override
    public boolean hasNext(int startPosition, int contentLength) {
        char ch = nextGoodChar();
        if (ch == ',') return true;
        if (ch == '}' || ch == ']' || ch == 0) return false;
        backChar(ch); // { [ 交由 readObjectB 或 readMapB 或 readArrayB 读取
        return true;
    }
919318
private function regular() {
        /** 获取PATHINFO */
        $pathInfo = $this->pathInfo;//$this->getPathInfo();
        foreach ($this->routingTable as $key => $route) {
            if (!preg_match($route['regx'], $pathInfo, $matches)) {
                continue;
            }
            $this->current = $key;
            /** 载入参数 */
            $params = NULL;
            if (!empty($route['params'])) {
                unset($matches[0]);
                $params = array_combine($route['params'], $matches);
                $req = Request::driver();
                $req->get = array_merge($req->get,$params);
                $req->request = array_merge($req->request,$params);
            }
            $this->pathInfo = '/'.$route['action'];
            return true;
        }
        return false;
    }
610471
private function routeCtrl()
    {
        if (PHP_SAPI !== "cli") {
            header('Content-type: text/html; charset=utf-8');
            // 禁止缓存
            header('Expires: 0');
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
            header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
            header('Pragma: no-cache');
        }

        // 自定义session处理
        $this->sessionHandler();

        try {
            // sql注入检查
            if ($this->enableFilterSqlInject) {
                $filterSqlInject = new FilterSqlInject($this->storagePath . '/log/sql_inject/');
                $filterSqlInject->filterInput();
            }
            $this->customRewrite();

            $ctrlArr = explode('.', $this->ctrl);
            $ctrl = is_array($ctrlArr) ? end($ctrlArr) : $this->ctrl;
            unset($ctrlArr);
            $ctrl = ucfirst($ctrl);
            $ctrl = $this->underlineToUppercase($ctrl);

            $ctrlClass = 'main\\' . $this->currentApp . '\\ctrl\\' . $ctrl;
            if (!empty($this->mod)) {
                $ctrlClass = 'main\\' . $this->currentApp . '\\ctrl\\' . $this->mod . '\\' . $ctrl;
            }
            //var_dump($ctrlClass);
            if (!class_exists($ctrlClass)) {
                throw new \Exception($ctrlClass . ' class  no found;', 500);
            }

            $ctrlObj = new $ctrlClass();
            $method = $this->method;
            $dataType = 'html';
            if (isset($_GET['data_type'])) {
                $dataType = $_GET['data_type'];
            }

            //var_dump($method);die;
            unset($ctrlClass);

            // 检查对象方法是否存在
            if (!method_exists($ctrlObj, $method)) {
                $method = $this->underlineToUppercase($method);
                if (!method_exists($ctrlObj, $method)) {
                    if (isset($this->ctrlMethodPrefix)) {
                        $method = $this->ctrlMethodPrefix . ucfirst($method);
                    }
                }
                if (!method_exists($ctrlObj, $method)) {
                    throw new \Exception($this->ctrl . '->' . $method . ' no found;', 404);
                }
            }

            // 是否启用安全映射机制
            $this->securityMapCheck('ctrl', $ctrl, $method);

            // 通过反射获取调用方法的参数列表
            if ($this->enableReflectMethod) {
                $reflectMethod = new \ReflectionMethod($ctrlObj, $method);
                $args = [];
                $defaults = [];
                foreach ($reflectMethod->getParameters() as $param) {
                    $args[] = $param->getName();
                    $defaults[] = $param->isDefaultValueAvailable() ? $param->getDefaultValue() : null;
                }
                if (empty($args)) {
                    // 开始执行业务逻辑流程
                    $ctrlRet = call_user_func_array([$ctrlObj, $method], []);
                } else {
                    $params = array();
                    foreach ($args as $ak => $arg) {
                        $params[$ak] = isset($_REQUEST[$arg]) ? $_REQUEST[$arg] : $defaults[$ak];
                    }
                    // 开始执行业务逻辑流程
                    $ctrlRet = call_user_func_array([$ctrlObj, $method], $params);
                }
            } else {
                $ctrlRet = call_user_func_array([$ctrlObj, $method], []);
            }

            $this->handleCtrlResult($ctrlRet);
            unset($ctrlObj, $method);
            register_shutdown_function("closeResources");
        } catch (HornetLogicException $e) {
            $this->handleCtrlException($e);
        } catch (\PDOException $e) {
            $this->handleCtrlException($e);
        } catch (\Exception $e) {
            $this->handleCtrlException($e);
        }
    }
709406
public function numberPageBtn()
    {
        $numBtnPage = '';
        $page = (int)$this->getOption('page', 1);

        for ($i = $this->firstNumBtn; $i <= $this->lastNumBtn; $i++) {
            if ($i === $page) {
                //给当前页按钮设置额外样式
                // $numBtnPage .='<a href="'.$this->getUrl($i).'" class="number current" title="'.$i.'">'.$i.'</a>';
                $a = Html::a($i, '', ['title' => $i]);
                $numBtnPage .= $this->hasListElement($a, ['class' => $this->elements['list']['currentClass']]);
            } else {
                // $numBtnPage .='<a href="'.$this->getUrl($i).'" class="number" title="'.$i.'">'.$i.'</a>';
                $a = Html::a($i, $this->getUrl($i), ['title' => $i]);
                $numBtnPage .= $this->hasListElement($a);
            }
        }

        $this->html['numbers'] = $numBtnPage;

        return $this;
    }
129977
public function runScriptCommand(): void
    {
        /*$script = '<?php echo "foo"; ?>';*/
        $script = '<?php print_r($_SERVER); ?>';

        // $tmpDir = CliUtil::getTempDir();
        // $tmpFile = $tmpDir . '/' . md5($script) . '.php';
        // file_put_contents($tmpFile, $script);

        $descriptorSpec = [
            0 => ['pipe', 'r'],  // 标准输入，子进程从此管道中读取数据
            1 => ['pipe', 'w'],  // 标准输出，子进程向此管道中写入数据
            2 => ['file', $this->app->getRootPath() . '/examples/tmp/error-output.log', 'a'] // 标准错误，写入到一个文件
        ];

        $process = proc_open('php', $descriptorSpec, $pipes);

        if (\is_resource($process)) {
            // $pipes 现在看起来是这样的：
            // 0 => 可以向子进程标准输入写入的句柄
            // 1 => 可以从子进程标准输出读取的句柄
            // 错误输出将被追加到文件 error-output.txt

            fwrite($pipes[0], $script);
            fclose($pipes[0]);

            $result = stream_get_contents($pipes[1]);

            fclose($pipes[1]);

            $this->write("RESULT:\n" . $result);

            // 切记：在调用 proc_close 之前关闭所有的管道以避免死锁。
            $retVal = proc_close($process);

            echo "command returned $retVal\n";
        }

    }
1167886
function _ssegment($end) {
        $start = $this->_off;
        $wlen = $end - $start;
        // check special words (need strtoupper)
        if ($wlen > 1) {
            $txt = strtoupper(substr($this->_txt, $start, $wlen));
            if ($this->_rule_checkbit($txt, PSCWS4_RULE_SPECIAL)) {
                $this->_put_res($start, 9.5, $wlen, 'nz');
                return;
            }
        }
        $txt = $this->_txt;
        // check brief words such as S.H.E M.R.
        if ($this->_is_ualpha(ord($txt[$start])) && $txt[$start + 1] == '.') {
            for ($ch = $start + 2; $ch < $end; $ch++) {
                if (!$this->_is_ualpha(ord($txt[$ch]))) break;
                $ch++;
                if ($ch == $end || $txt[$ch] != '.') break;
            }
            if ($ch == $end) {
                $this->_put_res($start, 7.5, $wlen, 'nz');
                return;
            }
        }
        // 取出单词及标点. 数字允许一个点且下一个为数字,不连续的. 字母允许一个不连续的'
        while ($start < $end) {
            $ch = $txt[$start++];
            $cx = ord($ch);
            if ($this->_is_alnum($cx)) {
                $pflag = $this->_is_digit($cx) ? PSCWS4_PFLAG_DIGIT : 0;
                $wlen = 1;
                while ($start < $end) {
                    $ch = $txt[$start];
                    $cx = ord($ch);
                    if ($pflag & PSCWS4_PFLAG_DIGIT) {
                        if (!$this->_is_digit($cx)) {
                            if (($pflag & PSCWS4_PFLAG_ADDSYM) || $cx != 0x2e || !$this->_is_digit(ord($txt[$start + 1])))
                                break;
                            $pflag |= PSCWS4_PFLAG_ADDSYM;
                        }
                    } else {
                        if (!$this->_is_alpha($cx)) {
                            if (($pflag & PSCWS4_PFLAG_ADDSYM) || $cx != 0x27 || !$this->_is_alpha(ord($txt[$start + 1])))
                                break;
                            $pflag |= PSCWS4_PFLAG_ADDSYM;
                        }
                    }
                    $start++;
                    if (++$wlen >= PSCWS4_MAX_EWLEN) break;
                }
                $this->_put_res($start - $wlen, 2.5 * log($wlen), $wlen, 'en');
            } else if (!($this->_mode & PSCWS4_IGN_SYMBOL)) {
                $this->_put_res($start - 1, 0, 1, 'un');
            }
        }
    }
205757
function(input) {
      // 清理input数据、因为parsed数据最终会被缓存，
      // 我们要尽量让相同的选择器只对应一份parsed数据
      input = clean(input);
      // 先检查缓存中是否有数据
      if (parsed = this.cache.get(input)) return parsed;
      // 如果没有: 初始化参数
      var parsed = this.parsed = [
        [null]
      ];
      var remain = this.input = input;
      var TRUNK = this.TRUNK;
      var prevRemain;
        // 将remain进行this._process这里每匹配一个字符串都会进行一次reduce
      while (prevRemain != (remain = remain.replace(TRUNK, this._process.bind(this)))) {
        prevRemain = remain;
      }
      // 如果没有被解析完 证明选择器字符串有不能被解析的部分
      if (remain !== '') this.error(remain);
      // 返回数据并推入cache
      return this.cache.set(input, parsed);
    }
262104
public function show() {
        if(0 == $this->totalRows) return '';

        /* 生成URL */
        $this->parameter[$this->p] = '[PAGE]';
        $this->url = U(ACTION_NAME, $this->parameter);
        /* 计算分页信息 */
        $this->totalPages = ceil($this->totalRows / $this->listRows); //总页数
        if(!empty($this->totalPages) && $this->nowPage > $this->totalPages) {
            $this->nowPage = $this->totalPages;
        }

        /* 计算分页临时变量 */
        $now_cool_page      = $this->rollPage/2;
		$now_cool_page_ceil = ceil($now_cool_page);
		$this->lastSuffix && $this->config['last'] = $this->totalPages;

        //上一页
        $up_row  = $this->nowPage - 1;
        $up_page = $up_row > 0 ? '<a class="prev" href="' . $this->url($up_row) . '">' . $this->config['prev'] . '</a>' : '';

        //下一页
        $down_row  = $this->nowPage + 1;
        $down_page = ($down_row <= $this->totalPages) ? '<a class="next" href="' . $this->url($down_row) . '">' . $this->config['next'] . '</a>' : '';

        //第一页
        $the_first = '';
        if($this->totalPages > $this->rollPage && ($this->nowPage - $now_cool_page) >= 1){
            $the_first = '<a class="first" href="' . $this->url(1) . '">' . $this->config['first'] . '</a>';
        }

        //最后一页
        $the_end = '';
        if($this->totalPages > $this->rollPage && ($this->nowPage + $now_cool_page) < $this->totalPages){
            $the_end = '<a class="end" href="' . $this->url($this->totalPages) . '">' . $this->config['last'] . '</a>';
        }

        //数字连接
        $link_page = "";
        for($i = 1; $i <= $this->rollPage; $i++){
			if(($this->nowPage - $now_cool_page) <= 0 ){
				$page = $i;
			}elseif(($this->nowPage + $now_cool_page - 1) >= $this->totalPages){
				$page = $this->totalPages - $this->rollPage + $i;
			}else{
				$page = $this->nowPage - $now_cool_page_ceil + $i;
			}
            if($page > 0 && $page != $this->nowPage){

                if($page <= $this->totalPages){
                    $link_page .= '<a class="num" href="' . $this->url($page) . '">' . $page . '</a>';
                }else{
                    break;
                }
            }else{
                if($page > 0 && $this->totalPages != 1){
                    $link_page .= '<span class="current">' . $page . '</span>';
                }
            }
        }

        //替换分页内容
        $page_str = str_replace(
            array('%HEADER%', '%NOW_PAGE%', '%UP_PAGE%', '%DOWN_PAGE%', '%FIRST%', '%LINK_PAGE%', '%END%', '%TOTAL_ROW%', '%TOTAL_PAGE%'),
            array($this->config['header'], $this->nowPage, $up_page, $down_page, $the_first, $link_page, $the_end, $this->totalRows, $this->totalPages),
            $this->config['theme']);
        return "<div>{$page_str}</div>";
    }
391811
function () {
            var me = this, range;
            if (me.body.contentEditable == 'false') {
                me.body.contentEditable = true;
                range = me.selection.getRange();
                //有可能内容丢失了
                try {
                    range.moveToBookmark(me.lastBk);
                    delete me.lastBk
                } catch (e) {
                    range.setStartAtFirst(me.body).collapse(true)
                }
                range.select(true);
                if (me.bkqueryCommandState) {
                    me.queryCommandState = me.bkqueryCommandState;
                    delete me.bkqueryCommandState;
                }
                if (me.bkqueryCommandValue) {
                    me.queryCommandValue = me.bkqueryCommandValue;
                    delete me.bkqueryCommandValue;
                }
                me.fireEvent('selectionchange');
            }
        }