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

📄 v2.php

📁 php-4.4.7学习linux时下载的源代码
💻 PHP
📖 第 1 页 / 共 5 页
字号:
                        $deps[$needed][$type] = array($deps[$needed][$type]);                    }                    foreach ($deps[$needed][$type] as $dep) {                        $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';                        if (strtolower($dep['name']) == strtolower($package) &&                              $depchannel == $channel) {                            return true;                        }                      }                }            }            if (isset($deps['group'])) {                if (!isset($deps['group'][0])) {                    $dep['group'] = array($deps['group']);                }                foreach ($deps['group'] as $group) {                    if (isset($group[$type])) {                        if (!is_array($group[$type])) {                            $group[$type] = array($group[$type]);                        }                        foreach ($group[$type] as $dep) {                            $depchannel = isset($dep['channel']) ? $dep['channel'] : '__uri';                            if (strtolower($dep['name']) == strtolower($package) &&                                  $depchannel == $channel) {                                return true;                            }                          }                    }                }            }        }        return false;    }    /**     * Get the contents of a dependency group     * @param string     * @return array|false     */    function getDependencyGroup($name)    {        $name = strtolower($name);        if (!isset($this->_packageInfo['dependencies']['group'])) {            return false;        }        $groups = $this->_packageInfo['dependencies']['group'];        if (!isset($groups[0])) {            $groups = array($groups);        }        foreach ($groups as $group) {            if (strtolower($group['attribs']['name']) == $name) {                return $group;            }        }        return false;    }    /**     * Retrieve a partial package.xml 1.0 representation of dependencies     *     * a very limited representation of dependencies is returned by this method.     * The <exclude> tag for excluding certain versions of a dependency is     * completely ignored.  In addition, dependency groups are ignored, with the     * assumption that all dependencies in dependency groups are also listed in     * the optional group that work with all dependency groups     * @param boolean return package.xml 2.0 <dependencies> tag     * @return array|false     */    function getDeps($raw = false, $nopearinstaller = false)    {        if (isset($this->_packageInfo['dependencies'])) {            if ($raw) {                return $this->_packageInfo['dependencies'];            }            $ret = array();            $map = array(                'php' => 'php',                'package' => 'pkg',                'subpackage' => 'pkg',                'extension' => 'ext',                'os' => 'os',                'pearinstaller' => 'pkg',                );            foreach (array('required', 'optional') as $type) {                $optional = ($type == 'optional') ? 'yes' : 'no';                if (!isset($this->_packageInfo['dependencies'][$type])) {                    continue;                }                foreach ($this->_packageInfo['dependencies'][$type] as $dtype => $deps) {                    if ($dtype == 'pearinstaller' && $nopearinstaller) {                        continue;                    }                    if (!isset($deps[0])) {                        $deps = array($deps);                    }                    foreach ($deps as $dep) {                        if (!isset($map[$dtype])) {                            // no support for arch type                            continue;                        }                        if ($dtype == 'pearinstaller') {                            $dep['name'] = 'PEAR';                            $dep['channel'] = 'pear.php.net';                        }                        $s = array('type' => $map[$dtype]);                        if (isset($dep['channel'])) {                            $s['channel'] = $dep['channel'];                        }                        if (isset($dep['uri'])) {                            $s['uri'] = $dep['uri'];                        }                        if (isset($dep['name'])) {                            $s['name'] = $dep['name'];                        }                        if (isset($dep['conflicts'])) {                            $s['rel'] = 'not';                        } else {                            if (!isset($dep['min']) &&                                  !isset($dep['max'])) {                                $s['rel'] = 'has';                                $s['optional'] = $optional;                            } elseif (isset($dep['min']) &&                                  isset($dep['max'])) {                                $s['rel'] = 'ge';                                $s1 = $s;                                $s1['rel'] = 'le';                                $s['version'] = $dep['min'];                                $s1['version'] = $dep['max'];                                if (isset($dep['channel'])) {                                    $s1['channel'] = $dep['channel'];                                }                                if ($dtype != 'php') {                                    $s['name'] = $dep['name'];                                    $s1['name'] = $dep['name'];                                }                                $s['optional'] = $optional;                                $s1['optional'] = $optional;                                $ret[] = $s1;                            } elseif (isset($dep['min'])) {                                if (isset($dep['exclude']) &&                                      $dep['exclude'] == $dep['min']) {                                    $s['rel'] = 'gt';                                } else {                                    $s['rel'] = 'ge';                                }                                $s['version'] = $dep['min'];                                $s['optional'] = $optional;                                if ($dtype != 'php') {                                    $s['name'] = $dep['name'];                                }                            } elseif (isset($dep['max'])) {                                if (isset($dep['exclude']) &&                                      $dep['exclude'] == $dep['max']) {                                    $s['rel'] = 'lt';                                } else {                                    $s['rel'] = 'le';                                }                                $s['version'] = $dep['max'];                                $s['optional'] = $optional;                                if ($dtype != 'php') {                                    $s['name'] = $dep['name'];                                }                            }                        }                        $ret[] = $s;                    }                }            }            if (count($ret)) {                return $ret;            }        }        return false;    }    /**     * @return php|extsrc|extbin|bundle|false     */    function getPackageType()    {        if (isset($this->_packageInfo['phprelease'])) {            return 'php';        }        if (isset($this->_packageInfo['extsrcrelease'])) {            return 'extsrc';        }        if (isset($this->_packageInfo['extbinrelease'])) {            return 'extbin';        }        if (isset($this->_packageInfo['bundle'])) {            return 'bundle';        }        return false;    }    /**     * @return array|false     */    function getReleases()    {        $type = $this->getPackageType();        if ($type != 'bundle') {            $type .= 'release';        }        if ($this->getPackageType() && isset($this->_packageInfo[$type])) {            return $this->_packageInfo[$type];        }        return false;    }    /**     * @return array     */    function getChangelog()    {        if (isset($this->_packageInfo['changelog'])) {            return $this->_packageInfo['changelog'];        }        return false;    }    function hasDeps()    {        return isset($this->_packageInfo['dependencies']);    }    function getPackagexmlVersion()    {        return '2.0';    }    /**     * @return array|false     */    function getSourcePackage()    {        if (isset($this->_packageInfo['extbinrelease'])) {            return array('channel' => $this->_packageInfo['srcchannel'],                         'package' => $this->_packageInfo['srcpackage']);        }        return false;    }    function getBundledPackages()    {        if (isset($this->_packageInfo['bundle'])) {            return $this->_packageInfo['contents']['bundledpackage'];        }        return false;    }    function getLastModified()    {        if (isset($this->_packageInfo['_lastmodified'])) {            return $this->_packageInfo['_lastmodified'];        }        return false;    }    /**     * Get the contents of a file listed within the package.xml     * @param string     * @return string     */    function getFileContents($file)    {        if ($this->_archiveFile == $this->_packageFile) { // unpacked            $dir = dirname($this->_packageFile);            $file = $dir . DIRECTORY_SEPARATOR . $file;            $file = str_replace(array('/', '\\'),                array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);            if (file_exists($file) && is_readable($file)) {                return implode('', file($file));            }        } else { // tgz            $tar = &new Archive_Tar($this->_archiveFile);            $tar->pushErrorHandling(PEAR_ERROR_RETURN);            if ($file != 'package.xml' && $file != 'package2.xml') {                $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;            }            $file = $tar->extractInString($file);            $tar->popErrorHandling();            if (PEAR::isError($file)) {                return PEAR::raiseError("Cannot locate file '$file' in archive");            }            return $file;        }    }    function &getRW()    {        if (!class_exists('PEAR_PackageFile_v2_rw')) {            require_once 'PEAR/PackageFile/v2/rw.php';        }        $a = new PEAR_PackageFile_v2_rw;        foreach (get_object_vars($this) as $name => $unused) {            if (!isset($this->$name)) {                continue;            }            if ($name == '_config' || $name == '_logger'|| $name == '_registry' ||                  $name == '_stack') {                $a->$name = &$this->$name;            } else {                $a->$name = $this->$name;            }        }        return $a;    }    function &getDefaultGenerator()    {        if (!class_exists('PEAR_PackageFile_Generator_v2')) {            require_once 'PEAR/PackageFile/Generator/v2.php';        }        $a = &new PEAR_PackageFile_Generator_v2($this);        return $a;    }    function analyzeSourceCode($file, $string = false)    {        if (!isset($this->_v2Validator) ||              !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {            if (!class_exists('PEAR_PackageFile_v2_Validator')) {                require_once 'PEAR/PackageFile/v2/Validator.php';            }            $this->_v2Validator = new PEAR_PackageFile_v2_Validator;        }        return $this->_v2Validator->analyzeSourceCode($file, $string);    }    function validate($state = PEAR_VALIDATE_NORMAL)    {        if (!isset($this->_packageInfo) || !is_array($this->_packageInfo)) {            return false;        }        if (!isset($this->_v2Validator) ||              !is_a($this->_v2Validator, 'PEAR_PackageFile_v2_Validator')) {            if (!class_exists('PEAR_PackageFile_v2_Validator')) {                require_once 'PEAR/PackageFile/v2/Validator.php';            }            $this->_v2Validator = new PEAR_PackageFile_v2_Validator;        }        if (isset($this->_packageInfo['xsdversion'])) {            unset($this->_packageInfo['xsdversion']);        }        return $this->_v2Validator->validate($this, $state);    }    function getTasksNs()    {        if (!isset($this->_tasksNs)) {            if (isset($this->_packageInfo['attribs'])) {                foreach ($this->_packageInfo['attribs'] as $name => $value) {                    if ($value == 'http://pear.php.net/dtd/tasks-1.0') {                        $this->_tasksNs = str_replace('xmlns:', '', $name);                        break;                    }                }            }        }        return $this->_tasksNs;    }    /**     * Determine whether a task name is a valid task.  Custom tasks may be defined     * using subdirectories by putting a "-" in the name, as in <tasks:mycustom-task>     *     * Note that this method will auto-load the task class file and test for the existence     * of the name with "-" replaced by "_" as in PEAR/Task/mycustom/task.php makes class     * PEAR_Task_mycustom_task     * @param string     * @return boolean     */    function getTask($task)    {        $this->getTasksNs();        // transform all '-' to '/' and 'tasks:' to '' so tasks:replace becomes replace        $task = str_replace(array($this->_tasksNs . ':', '-'), array('', ' '), $task);        $task = str_replace(' ', '/', ucwords($task));        $ps = (strtolower(substr(PHP_OS, 0, 3)) == 'win') ? ';' : ':';     

⌨️ 快捷键说明

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