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

📄 common.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 5 页
字号:
    function _element_end($xp, $name)    {    }    // }}}    // Support for package DTD v1.0:    // {{{ _element_start_1_0()    /**     * XML parser callback for ending elements.  Used for version 1.0     * packages.     *     * @param resource  $xp    XML parser resource     * @param string    $name  name of ending element     *     * @return void     *     * @access private     */    function _element_start_1_0($xp, $name, $attribs)    {        array_push($this->element_stack, $name);        $this->current_element = $name;        $spos = sizeof($this->element_stack) - 2;        $this->prev_element = ($spos >= 0) ? $this->element_stack[$spos] : '';        $this->current_attributes = $attribs;        $this->cdata = '';        switch ($name) {            case 'dir':                if ($this->in_changelog) {                    break;                }                if ($attribs['name'] != '/') {                    $this->dir_names[] = $attribs['name'];                }                if (isset($attribs['baseinstalldir'])) {                    $this->dir_install = $attribs['baseinstalldir'];                }                if (isset($attribs['role'])) {                    $this->dir_role = $attribs['role'];                }                break;            case 'file':                if ($this->in_changelog) {                    break;                }                if (isset($attribs['name'])) {                    $path = '';                    if (count($this->dir_names)) {                        foreach ($this->dir_names as $dir) {                            $path .= $dir . DIRECTORY_SEPARATOR;                        }                    }                    $path .= $attribs['name'];                    unset($attribs['name']);                    $this->current_path = $path;                    $this->filelist[$path] = $attribs;                    // Set the baseinstalldir only if the file don't have this attrib                    if (!isset($this->filelist[$path]['baseinstalldir']) &&                        isset($this->dir_install))                    {                        $this->filelist[$path]['baseinstalldir'] = $this->dir_install;                    }                    // Set the Role                    if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {                        $this->filelist[$path]['role'] = $this->dir_role;                    }                }                break;            case 'replace':                if (!$this->in_changelog) {                    $this->filelist[$this->current_path]['replacements'][] = $attribs;                }                break;            case 'maintainers':                $this->pkginfo['maintainers'] = array();                $this->m_i = 0; // maintainers array index                break;            case 'maintainer':                // compatibility check                if (!isset($this->pkginfo['maintainers'])) {                    $this->pkginfo['maintainers'] = array();                    $this->m_i = 0;                }                $this->pkginfo['maintainers'][$this->m_i] = array();                $this->current_maintainer =& $this->pkginfo['maintainers'][$this->m_i];                break;            case 'changelog':                $this->pkginfo['changelog'] = array();                $this->c_i = 0; // changelog array index                $this->in_changelog = true;                break;            case 'release':                if ($this->in_changelog) {                    $this->pkginfo['changelog'][$this->c_i] = array();                    $this->current_release = &$this->pkginfo['changelog'][$this->c_i];                } else {                    $this->current_release = &$this->pkginfo;                }                break;            case 'deps':                if (!$this->in_changelog) {                    $this->pkginfo['release_deps'] = array();                }                break;            case 'dep':                // dependencies array index                if (!$this->in_changelog) {                    $this->d_i++;                    $this->pkginfo['release_deps'][$this->d_i] = $attribs;                }                break;            case 'configureoptions':                if (!$this->in_changelog) {                    $this->pkginfo['configure_options'] = array();                }                break;            case 'configureoption':                if (!$this->in_changelog) {                    $this->pkginfo['configure_options'][] = $attribs;                }                break;            case 'provides':                if (empty($attribs['type']) || empty($attribs['name'])) {                    break;                }                $attribs['explicit'] = true;                $this->pkginfo['provides']["$attribs[type];$attribs[name]"] = $attribs;                break;        }    }    // }}}    // {{{ _element_end_1_0()    /**     * XML parser callback for ending elements.  Used for version 1.0     * packages.     *     * @param resource  $xp    XML parser resource     * @param string    $name  name of ending element     *     * @return void     *     * @access private     */    function _element_end_1_0($xp, $name)    {        $data = trim($this->cdata);        switch ($name) {            case 'name':                switch ($this->prev_element) {                    case 'package':                        // XXX should we check the package name here?                        $this->pkginfo['package'] = ereg_replace('[^a-zA-Z0-9._]', '_', $data);                        break;                    case 'maintainer':                        $this->current_maintainer['name'] = $data;                        break;                }                break;            case 'summary':                $this->pkginfo['summary'] = $data;                break;            case 'description':                $data = $this->_unIndent($this->cdata);                $this->pkginfo['description'] = $data;                break;            case 'user':                $this->current_maintainer['handle'] = $data;                break;            case 'email':                $this->current_maintainer['email'] = $data;                break;            case 'role':                $this->current_maintainer['role'] = $data;                break;            case 'version':                $data = ereg_replace ('[^a-zA-Z0-9._\-]', '_', $data);                if ($this->in_changelog) {                    $this->current_release['version'] = $data;                } else {                    $this->pkginfo['version'] = $data;                }                break;            case 'date':                if ($this->in_changelog) {                    $this->current_release['release_date'] = $data;                } else {                    $this->pkginfo['release_date'] = $data;                }                break;            case 'notes':                // try to "de-indent" release notes in case someone                // has been over-indenting their xml ;-)                $data = $this->_unIndent($this->cdata);                if ($this->in_changelog) {                    $this->current_release['release_notes'] = $data;                } else {                    $this->pkginfo['release_notes'] = $data;                }                break;            case 'warnings':                if ($this->in_changelog) {                    $this->current_release['release_warnings'] = $data;                } else {                    $this->pkginfo['release_warnings'] = $data;                }                break;            case 'state':                if ($this->in_changelog) {                    $this->current_release['release_state'] = $data;                } else {                    $this->pkginfo['release_state'] = $data;                }                break;            case 'license':                if ($this->in_changelog) {                    $this->current_release['release_license'] = $data;                } else {                    $this->pkginfo['release_license'] = $data;                }                break;            case 'dep':                if ($data && !$this->in_changelog) {                    $this->pkginfo['release_deps'][$this->d_i]['name'] = $data;                }                break;            case 'dir':                if ($this->in_changelog) {                    break;                }                array_pop($this->dir_names);                break;            case 'file':                if ($this->in_changelog) {                    break;                }                if ($data) {                    $path = '';                    if (count($this->dir_names)) {                        foreach ($this->dir_names as $dir) {                            $path .= $dir . DIRECTORY_SEPARATOR;                        }                    }                    $path .= $data;                    $this->filelist[$path] = $this->current_attributes;                    // Set the baseinstalldir only if the file don't have this attrib                    if (!isset($this->filelist[$path]['baseinstalldir']) &&                        isset($this->dir_install))                    {                        $this->filelist[$path]['baseinstalldir'] = $this->dir_install;                    }                    // Set the Role                    if (!isset($this->filelist[$path]['role']) && isset($this->dir_role)) {                        $this->filelist[$path]['role'] = $this->dir_role;                    }                }                break;            case 'maintainer':                if (empty($this->pkginfo['maintainers'][$this->m_i]['role'])) {                    $this->pkginfo['maintainers'][$this->m_i]['role'] = 'lead';                }                $this->m_i++;                break;            case 'release':                if ($this->in_changelog) {                    $this->c_i++;                }                break;            case 'changelog':                $this->in_changelog = false;                break;        }        array_pop($this->element_stack);        $spos = sizeof($this->element_stack) - 1;        $this->current_element = ($spos > 0) ? $this->element_stack[$spos] : '';        $this->cdata = '';    }    // }}}    // {{{ _pkginfo_cdata_1_0()    /**     * XML parser callback for character data.  Used for version 1.0     * packages.     *     * @param resource  $xp    XML parser resource     * @param string    $name  character data     *     * @return void     *     * @access private     */    function _pkginfo_cdata_1_0($xp, $data)    {        if (isset($this->cdata)) {            $this->cdata .= $data;        }    }    // }}}    // {{{ infoFromTgzFile()    /**     * Returns information about a package file.  Expects the name of     * a gzipped tar file as input.     *     * @param string  $file  name of .tgz file     *     * @return array  array with package information     *     * @access public     *     */    function infoFromTgzFile($file)    {        if (!@is_file($file)) {            return $this->raiseError("could not open file \"$file\"");        }        $tar = new Archive_Tar($file);        if ($this->debug <= 1) {            $tar->pushErrorHandling(PEAR_ERROR_RETURN);        }        $content = $tar->listContent();        if ($this->debug <= 1) {            $tar->popErrorHandling();        }        if (!is_array($content)) {            $file = realpath($file);            return $this->raiseError("Could not get contents of package \"$file\"".                                     '. Invalid tgz file.');        }        $xml = null;        foreach ($content as $file) {            $name = $file['filename'];            if ($name == 'package.xml') {                $xml = $name;                break;            } elseif (ereg('package.xml$', $name, $match)) {                $xml = $match[0];                break;            }        }        $tmpdir = System::mkTemp(array('-d', 'pear'));        $this->addTempFile($tmpdir);        if (!$xml || !$tar->extractList(array($xml), $tmpdir)) {            return $this->raiseError('could not extract the package.xml file');        }        return $this->infoFromDescriptionFile("$tmpdir/$xml");    }    // }}}    // {{{ infoFromDescriptionFile()    /**     * Returns information about a package file.  Expects the name of     * a package xml file as input.     *     * @param string  $descfile  name of package xml file     *     * @return array  array with package information     *     * @access public     *     */    function infoFromDescriptionFile($descfile)    {        if (!@is_file($descfile) || !is_readable($descfile) ||             (!$fp = @fopen($descfile, 'r'))) {            return $this->raiseError("Unable to open $descfile");        }        // read the whole thing so we only get one cdata callback        // for each block of cdata        $data = fread($fp, filesize($descfile));        return $this->infoFromString($data);    }    // }}}    // {{{ infoFromString()

⌨️ 快捷键说明

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