⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cli.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 2 页
字号:
            );        $this->params['table_data'][] = $new_row;    }    // }}}    // {{{ endTable()    function endTable()    {        trigger_error("PEAR_Frontend_CLI::endTable deprecated", E_USER_ERROR);    }    function _endTable()    {        extract($this->params);        if (!empty($caption)) {            $this->_displayHeading($caption);        }        if (count($table_data) == 0) {            return;        }        if (!isset($width)) {            $width = $widest;        } else {            for ($i = 0; $i < $ncols; $i++) {                if (!isset($width[$i])) {                    $width[$i] = $widest[$i];                }            }        }        $border = false;        if (empty($border)) {            $cellstart = '';            $cellend = ' ';            $rowend = '';            $padrowend = false;            $borderline = '';        } else {            $cellstart = '| ';            $cellend = ' ';            $rowend = '|';            $padrowend = true;            $borderline = '+';            foreach ($width as $w) {                $borderline .= str_repeat('-', $w + strlen($cellstart) + strlen($cellend) - 1);                $borderline .= '+';            }        }        if ($borderline) {            $this->_displayLine($borderline);        }        for ($i = 0; $i < sizeof($table_data); $i++) {            extract($table_data[$i]);            if (!is_array($rowparams)) {                $rowparams = array();            }            if (!is_array($colparams)) {                $colparams = array();            }            $rowlines = array();            if ($height > 1) {                for ($c = 0; $c < sizeof($data); $c++) {                    $rowlines[$c] = preg_split('/(\r?\n|\r)/', $data[$c]);                    if (sizeof($rowlines[$c]) < $height) {                        $rowlines[$c] = array_pad($rowlines[$c], $height, '');                    }                }            } else {                for ($c = 0; $c < sizeof($data); $c++) {                    $rowlines[$c] = array($data[$c]);                }            }            for ($r = 0; $r < $height; $r++) {                $rowtext = '';                for ($c = 0; $c < sizeof($data); $c++) {                    if (isset($colparams[$c])) {                        $attribs = array_merge($rowparams, $colparams);                    } else {                        $attribs = $rowparams;                    }                    $w = isset($width[$c]) ? $width[$c] : 0;                    //$cell = $data[$c];                    $cell = $rowlines[$c][$r];                    $l = strlen($cell);                    if ($l > $w) {                        $cell = substr($cell, 0, $w);                    }                    if (isset($attribs['bold'])) {                        $cell = $this->bold($cell);                    }                    if ($l < $w) {                        // not using str_pad here because we may                        // add bold escape characters to $cell                        $cell .= str_repeat(' ', $w - $l);                    }                    $rowtext .= $cellstart . $cell . $cellend;                }                if (!$border) {                    $rowtext = rtrim($rowtext);                }                $rowtext .= $rowend;                $this->_displayLine($rowtext);            }        }        if ($borderline) {            $this->_displayLine($borderline);        }    }    // }}}    // {{{ outputData()    function outputData($data, $command = '_default')    {        switch ($command) {            case 'install':            case 'upgrade':            case 'upgrade-all':                if (isset($data['release_warnings'])) {                    $this->_displayLine('');                    $this->_startTable(array(                        'border' => false,                        'caption' => 'Release Warnings'                        ));                    $this->_tableRow(array($data['release_warnings']), null, array(1 => array('wrap' => 55)));                    $this->_endTable();                    $this->_displayLine('');                }                $this->_displayLine($data['data']);                break;            case 'search':                $this->_startTable($data);                if (isset($data['headline']) && is_array($data['headline'])) {                    $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));                }                foreach($data['data'] as $category) {                    foreach($category as $pkg) {                        $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));                    }                };                $this->_endTable();                break;            case 'list-all':                $this->_startTable($data);                if (isset($data['headline']) && is_array($data['headline'])) {                    $this->_tableRow($data['headline'], array('bold' => true), array(1 => array('wrap' => 55)));                }                foreach($data['data'] as $category) {                    foreach($category as $pkg) {                        unset($pkg[3]);                        unset($pkg[4]);                        $this->_tableRow($pkg, null, array(1 => array('wrap' => 55)));                    }                };                $this->_endTable();                break;            case 'config-show':                $data['border'] = false;                $opts = array(0 => array('wrap' => 30),                              1 => array('wrap' => 20),                              2 => array('wrap' => 35));                $this->_startTable($data);                if (isset($data['headline']) && is_array($data['headline'])) {                    $this->_tableRow($data['headline'],                                     array('bold' => true),                                     $opts);                }                foreach($data['data'] as $group) {                    foreach($group as $value) {                        if ($value[2] == '') {                            $value[2] = "<not set>";                        }                        $this->_tableRow($value, null, $opts);                    }                }                $this->_endTable();                break;            case 'remote-info':                $data = array(                    'caption' => 'Package details:',                    'border' => false,                    'data' => array(                        array("Latest",    $data['stable']),                        array("Installed", $data['installed']),                        array("Package",   $data['name']),                        array("License",   $data['license']),                        array("Category",  $data['category']),                        array("Summary",   $data['summary']),                        array("Description", $data['description']),                        ),                    );            default: {                if (is_array($data)) {                    $this->_startTable($data);                    $count = count($data['data'][0]);                    if ($count == 2) {                        $opts = array(0 => array('wrap' => 25),                                      1 => array('wrap' => 48)                        );                    } elseif ($count == 3) {                        $opts = array(0 => array('wrap' => 30),                                      1 => array('wrap' => 20),                                      2 => array('wrap' => 35)                        );                    } else {                        $opts = null;                    }                    if (isset($data['headline']) && is_array($data['headline'])) {                        $this->_tableRow($data['headline'],                                         array('bold' => true),                                         $opts);                    }                    foreach($data['data'] as $row) {                        $this->_tableRow($row, null, $opts);                    }                    $this->_endTable();                } else {                    $this->_displayLine($data);                }            }        }    }    // }}}    // {{{ log(text)    function log($text, $append_crlf = true)    {        if ($append_crlf) {            return $this->_displayLine($text);        }        return $this->_display($text);    }    // }}}    // {{{ bold($text)    function bold($text)    {        if (empty($this->term['bold'])) {            return strtoupper($text);        }        return $this->term['bold'] . $text . $this->term['normal'];    }    // }}}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -