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

📄 v1.php

📁 php-4.4.7学习linux时下载的源代码
💻 PHP
📖 第 1 页 / 共 4 页
字号:
        if (isset($pkginfo['filelist'])) {            $ret .= "$indent  <filelist>\n";            if ($state ^ PEAR_VALIDATE_PACKAGING) {                $ret .= $this->recursiveXmlFilelist($pkginfo['filelist']);            } else {                foreach ($pkginfo['filelist'] as $file => $fa) {                    @$ret .= "$indent   <file role=\"$fa[role]\"";                    if (isset($fa['baseinstalldir'])) {                        $ret .= ' baseinstalldir="' .                            $this->_fixXmlEncoding($fa['baseinstalldir']) . '"';                    }                    if (isset($fa['md5sum'])) {                        $ret .= " md5sum=\"$fa[md5sum]\"";                    }                    if (isset($fa['platform'])) {                        $ret .= " platform=\"$fa[platform]\"";                    }                    if (!empty($fa['install-as'])) {                        $ret .= ' install-as="' .                            $this->_fixXmlEncoding($fa['install-as']) . '"';                    }                    $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"';                    if (empty($fa['replacements'])) {                        $ret .= "/>\n";                    } else {                        $ret .= ">\n";                        foreach ($fa['replacements'] as $r) {                            $ret .= "$indent    <replace";                            foreach ($r as $k => $v) {                                $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"';                            }                            $ret .= "/>\n";                        }                        @$ret .= "$indent   </file>\n";                    }                }            }            $ret .= "$indent  </filelist>\n";        }        $ret .= "$indent </release>\n";        return $ret;    }    /**     * @param array     * @access protected     */    function recursiveXmlFilelist($list)    {        $this->_dirs = array();        foreach ($list as $file => $attributes) {            $this->_addDir($this->_dirs, explode('/', dirname($file)), $file, $attributes);        }        return $this->_formatDir($this->_dirs);    }    /**     * @param array     * @param array     * @param string|null     * @param array|null     * @access private     */    function _addDir(&$dirs, $dir, $file = null, $attributes = null)    {        if ($dir == array() || $dir == array('.')) {            $dirs['files'][basename($file)] = $attributes;            return;        }        $curdir = array_shift($dir);        if (!isset($dirs['dirs'][$curdir])) {            $dirs['dirs'][$curdir] = array();        }        $this->_addDir($dirs['dirs'][$curdir], $dir, $file, $attributes);    }    /**     * @param array     * @param string     * @param string     * @access private     */    function _formatDir($dirs, $indent = '', $curdir = '')    {        $ret = '';        if (!count($dirs)) {            return '';        }        if (isset($dirs['dirs'])) {            uksort($dirs['dirs'], 'strnatcasecmp');            foreach ($dirs['dirs'] as $dir => $contents) {                $usedir = "$curdir/$dir";                $ret .= "$indent   <dir name=\"$dir\">\n";                $ret .= $this->_formatDir($contents, "$indent ", $usedir);                $ret .= "$indent   </dir> <!-- $usedir -->\n";            }        }        if (isset($dirs['files'])) {            uksort($dirs['files'], 'strnatcasecmp');            foreach ($dirs['files'] as $file => $attribs) {                $ret .= $this->_formatFile($file, $attribs, $indent);            }        }        return $ret;    }    /**     * @param string     * @param array     * @param string     * @access private     */    function _formatFile($file, $attributes, $indent)    {        $ret = "$indent   <file role=\"$attributes[role]\"";        if (isset($attributes['baseinstalldir'])) {            $ret .= ' baseinstalldir="' .                $this->_fixXmlEncoding($attributes['baseinstalldir']) . '"';        }        if (isset($attributes['md5sum'])) {            $ret .= " md5sum=\"$attributes[md5sum]\"";        }        if (isset($attributes['platform'])) {            $ret .= " platform=\"$attributes[platform]\"";        }        if (!empty($attributes['install-as'])) {            $ret .= ' install-as="' .                $this->_fixXmlEncoding($attributes['install-as']) . '"';        }        $ret .= ' name="' . $this->_fixXmlEncoding($file) . '"';        if (empty($attributes['replacements'])) {            $ret .= "/>\n";        } else {            $ret .= ">\n";            foreach ($attributes['replacements'] as $r) {                $ret .= "$indent    <replace";                foreach ($r as $k => $v) {                    $ret .= " $k=\"" . $this->_fixXmlEncoding($v) .'"';                }                $ret .= "/>\n";            }            $ret .= "$indent   </file>\n";        }        return $ret;    }    // {{{ _unIndent()    /**     * Unindent given string (?)     *     * @param string $str The string that has to be unindented.     * @return string     * @access private     */    function _unIndent($str)    {        // remove leading newlines        $str = preg_replace('/^[\r\n]+/', '', $str);        // find whitespace at the beginning of the first line        $indent_len = strspn($str, " \t");        $indent = substr($str, 0, $indent_len);        $data = '';        // remove the same amount of whitespace from following lines        foreach (explode("\n", $str) as $line) {            if (substr($line, 0, $indent_len) == $indent) {                $data .= substr($line, $indent_len) . "\n";            }        }        return $data;    }    /**     * @return array     */    function dependenciesToV2()    {        $arr = array();        $this->_convertDependencies2_0($arr);        return $arr['dependencies'];    }    /**     * Convert a package.xml version 1.0 into version 2.0     *     * Note that this does a basic conversion, to allow more advanced     * features like bundles and multiple releases     * @param string the classname to instantiate and return.  This must be     *               PEAR_PackageFile_v2 or a descendant     * @param boolean if true, only valid, deterministic package.xml 1.0 as defined by the     *                strictest parameters will be converted     * @return PEAR_PackageFile_v2|PEAR_Error     */    function &toV2($class = 'PEAR_PackageFile_v2', $strict = false)    {        if ($strict) {            if (!$this->_packagefile->validate()) {                $a = PEAR::raiseError('invalid package.xml version 1.0 cannot be converted' .                    ' to version 2.0', null, null, null,                    $this->_packagefile->getValidationWarnings(true));                return $a;            }        }        $arr = array(            'attribs' => array(                             'version' => '2.0',                             'xmlns' => 'http://pear.php.net/dtd/package-2.0',                             'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',                             'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',                             'xsi:schemaLocation' => "http://pear.php.net/dtd/tasks-1.0\n" ."http://pear.php.net/dtd/tasks-1.0.xsd\n" ."http://pear.php.net/dtd/package-2.0\n" .'http://pear.php.net/dtd/package-2.0.xsd',                         ),            'name' => $this->_packagefile->getPackage(),            'channel' => 'pear.php.net',        );        $arr['summary'] = $this->_packagefile->getSummary();        $arr['description'] = $this->_packagefile->getDescription();        $maintainers = $this->_packagefile->getMaintainers();        foreach ($maintainers as $maintainer) {            if ($maintainer['role'] != 'lead') {                continue;            }            $new = array(                'name' => $maintainer['name'],                'user' => $maintainer['handle'],                'email' => $maintainer['email'],                'active' => 'yes',            );            $arr['lead'][] = $new;        }        if (!isset($arr['lead'])) { // some people... you know?            $arr['lead'] = array(                'name' => 'unknown',                'user' => 'unknown',                'email' => 'noleadmaintainer@example.com',                'active' => 'no',            );        }        if (count($arr['lead']) == 1) {            $arr['lead'] = $arr['lead'][0];        }        foreach ($maintainers as $maintainer) {            if ($maintainer['role'] == 'lead') {                continue;            }            $new = array(                'name' => $maintainer['name'],                'user' => $maintainer['handle'],                'email' => $maintainer['email'],                'active' => 'yes',            );            $arr[$maintainer['role']][] = $new;        }        if (isset($arr['developer']) && count($arr['developer']) == 1) {            $arr['developer'] = $arr['developer'][0];        }        if (isset($arr['contributor']) && count($arr['contributor']) == 1) {            $arr['contributor'] = $arr['contributor'][0];        }        if (isset($arr['helper']) && count($arr['helper']) == 1) {            $arr['helper'] = $arr['helper'][0];        }        $arr['date'] = $this->_packagefile->getDate();        $arr['version'] =            array(                'release' => $this->_packagefile->getVersion(),                'api' => $this->_packagefile->getVersion(),            );        $arr['stability'] =            array(                'release' => $this->_packagefile->getState(),                'api' => $this->_packagefile->getState(),            );        $licensemap =            array(                'php' => 'http://www.php.net/license',                'php license' => 'http://www.php.net/license',                'lgpl' => 'http://www.gnu.org/copyleft/lesser.html',                'bsd' => 'http://www.opensource.org/licenses/bsd-license.php',                'bsd style' => 'http://www.opensource.org/licenses/bsd-license.php',                'bsd-style' => 'http://www.opensource.org/licenses/bsd-license.php',                'mit' => 'http://www.opensource.org/licenses/mit-license.php',                'gpl' => 'http://www.gnu.org/copyleft/gpl.html',                'apache' => 'http://www.opensource.org/licenses/apache2.0.php'            );        if (isset($licensemap[strtolower($this->_packagefile->getLicense())])) {            $arr['license'] = array(                'attribs' => array('uri' =>                    $licensemap[strtolower($this->_packagefile->getLicense())]),                '_content' => $this->_packagefile->getLicense()                );        } else {            // don't use bogus uri            $arr['license'] = $this->_packagefile->getLicense();        }        $arr['notes'] = $this->_packagefile->getNotes();        $temp = array();        $arr['contents'] = $this->_convertFilelist2_0($temp);        $this->_convertDependencies2_0($arr);        $release = ($this->_packagefile->getConfigureOptions() || $this->_isExtension) ?            'extsrcrelease' : 'phprelease';        if ($release == 'extsrcrelease') {            $arr['channel'] = 'pecl.php.net';            $arr['providesextension'] = $arr['name']; // assumption        }        $arr[$release] = array();        if ($this->_packagefile->getConfigureOptions()) {            $arr[$release]['configureoption'] = $this->_packagefile->getConfigureOptions();            foreach ($arr[$release]['configureoption'] as $i => $opt) {                $arr[$release]['configureoption'][$i] = array('attribs' => $opt);            }            if (count($arr[$release]['configureoption']) == 1) {                $arr[$release]['configureoption'] = $arr[$release]['configureoption'][0];            }        }

⌨️ 快捷键说明

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