rw.php

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,603 行 · 第 1/5 页

PHP
1,603
字号
            'release' => array('api')));        $this->_isValid = 0;    }    function setAPIVersion($version)    {        if (isset($this->_packageInfo['version']) &&              isset($this->_packageInfo['version']['api'])) {            unset($this->_packageInfo['version']['api']);        }        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(            'version' => array('stability', 'license', 'notes', 'contents', 'compatible',                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',                'extbinrelease', 'bundle', 'changelog'),            'api' => array()));        $this->_isValid = 0;    }    /**     * snapshot|devel|alpha|beta|stable     */    function setReleaseStability($state)    {        if (isset($this->_packageInfo['stability']) &&              isset($this->_packageInfo['stability']['release'])) {            unset($this->_packageInfo['stability']['release']);        }        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(            'stability' => array('license', 'notes', 'contents', 'compatible',                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',                'extbinrelease', 'bundle', 'changelog'),            'release' => array('api')));        $this->_isValid = 0;    }    /**     * @param devel|alpha|beta|stable     */    function setAPIStability($state)    {        if (isset($this->_packageInfo['stability']) &&              isset($this->_packageInfo['stability']['api'])) {            unset($this->_packageInfo['stability']['api']);        }        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(            'stability' => array('license', 'notes', 'contents', 'compatible',                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',                'extbinrelease', 'bundle', 'changelog'),            'api' => array()));        $this->_isValid = 0;    }    function setLicense($license, $uri = false, $filesource = false)    {        if (!isset($this->_packageInfo['license'])) {            // ensure that the license tag is set up in the right location            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,                array('notes', 'contents', 'compatible',                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',                'extbinrelease', 'bundle', 'changelog'), 0, 'license');        }        if ($uri || $filesource) {            $attribs = array();            if ($uri) {                $attribs['uri'] = $uri;            }            $uri = true; // for test below            if ($filesource) {                $attribs['filesource'] = $filesource;            }        }        $license = $uri ? array('attribs' => $attribs, '_content' => $license) : $license;        $this->_packageInfo['license'] = $license;        $this->_isValid = 0;    }    function setNotes($notes)    {        $this->_isValid = 0;        if (!isset($this->_packageInfo['notes'])) {            // ensure that the notes tag is set up in the right location            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,                array('contents', 'compatible',                'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',                'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',                'extbinrelease', 'bundle', 'changelog'), $notes, 'notes');        }        $this->_packageInfo['notes'] = $notes;    }    /**     * This is only used at install-time, after all serialization     * is over.     * @param string file name     * @param string installed path     */    function setInstalledAs($file, $path)    {        if ($path) {            return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;        }        unset($this->_packageInfo['filelist'][$file]['installed_as']);    }    /**     * This is only used at install-time, after all serialization     * is over.     */    function installedFile($file, $atts)    {        if (isset($this->_packageInfo['filelist'][$file])) {            $this->_packageInfo['filelist'][$file] =                array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);        } else {            $this->_packageInfo['filelist'][$file] = $atts['attribs'];        }    }    /**     * Reset the listing of package contents     * @param string base installation dir for the whole package, if any     */    function clearContents($baseinstall = false)    {        $this->_filesValid = false;        $this->_isValid = 0;        if (!isset($this->_packageInfo['contents'])) {            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,                array('compatible',                    'dependencies', 'providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',                    'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',                    'bundle', 'changelog'), array(), 'contents');        }        if ($this->getPackageType() != 'bundle') {            $this->_packageInfo['contents'] =                 array('dir' => array('attribs' => array('name' => '/')));            if ($baseinstall) {                $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall;            }        } else {            $this->_packageInfo['contents'] = array('bundledpackage' => array());        }    }    /**     * @param string relative path of the bundled package.     */    function addBundledPackage($path)    {        if ($this->getPackageType() != 'bundle') {            return false;        }        $this->_filesValid = false;        $this->_isValid = 0;        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array(                'contents' => array('compatible', 'dependencies', 'providesextension',                'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',                'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',                'bundle', 'changelog'),                'bundledpackage' => array()));    }    /**     * @param string file name     * @param PEAR_Task_Common a read/write task     */    function addTaskToFile($filename, $task)    {        if (!method_exists($task, 'getXml')) {            return false;        }        if (!method_exists($task, 'getName')) {            return false;        }        if (!method_exists($task, 'validate')) {            return false;        }        if (!$task->validate()) {            return false;        }        if (!isset($this->_packageInfo['contents']['dir']['file'])) {            return false;        }        $this->getTasksNs(); // discover the tasks namespace if not done already        $files = $this->_packageInfo['contents']['dir']['file'];        if (!isset($files[0])) {            $files = array($files);            $ind = false;        } else {            $ind = true;        }        foreach ($files as $i => $file) {            if (isset($file['attribs'])) {                if ($file['attribs']['name'] == $filename) {                    if ($ind) {                        $t = isset($this->_packageInfo['contents']['dir']['file'][$i]                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()]) ?                              $this->_packageInfo['contents']['dir']['file'][$i]                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()] : false;                        if ($t && !isset($t[0])) {                            $this->_packageInfo['contents']['dir']['file'][$i]                                [$this->_tasksNs . ':' . $task->getName()] = array($t);                        }                        $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs .                            ':' . $task->getName()][] = $task->getXml();                    } else {                        $t = isset($this->_packageInfo['contents']['dir']['file']                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file']                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()] : false;                        if ($t && !isset($t[0])) {                            $this->_packageInfo['contents']['dir']['file']                                [$this->_tasksNs . ':' . $task->getName()] = array($t);                        }                        $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs .                            ':' . $task->getName()][] = $task->getXml();                    }                    return true;                }            }        }        return false;    }    /**     * @param string path to the file     * @param string filename     * @param array extra attributes     */    function addFile($dir, $file, $attrs)    {        if ($this->getPackageType() == 'bundle') {            return false;        }        $this->_filesValid = false;        $this->_isValid = 0;        $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);        if ($dir == '/' || $dir == '') {            $dir = '';        } else {            $dir .= '/';        }        $attrs['name'] = $dir . $file;        if (!isset($this->_packageInfo['contents'])) {            // ensure that the contents tag is set up            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,                array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask',                'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',                'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',                'bundle', 'changelog'), array(), 'contents');        }        if (isset($this->_packageInfo['contents']['dir']['file'])) {            if (!isset($this->_packageInfo['contents']['dir']['file'][0])) {                $this->_packageInfo['contents']['dir']['file'] =                    array($this->_packageInfo['contents']['dir']['file']);            }            $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs;        } else {            $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs;        }    }    /**     * @param string Dependent package name     * @param string Dependent package's channel name     * @param string minimum version of specified package that this release is guaranteed to be     *               compatible with     * @param string maximum version of specified package that this release is guaranteed to be     *               compatible with     * @param string versions of specified package that this release is not compatible with     */    function addCompatiblePackage($name, $channel, $min, $max, $exclude = false)    {        $this->_isValid = 0;        $set = array(            'name' => $name,            'channel' => $channel,            'min' => $min,            'max' => $max,        );        if ($exclude) {            $set['exclude'] = $exclude;        }        $this->_isValid = 0;        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(                'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',                    'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')            ));    }    /**     * Removes the <usesrole> tag entirely     */    function resetUsesrole()    {        if (isset($this->_packageInfo['usesrole'])) {            unset($this->_packageInfo['usesrole']);        }    }    /**     * @param string     * @param string package name or uri     * @param string channel name if non-uri     */    function addUsesrole($role, $packageOrUri, $channel = false) {        $set = array('role' => $role);        if ($channel) {            $set['package'] = $packageOrUri;            $set['channel'] = $channel;        } else {            $set['uri'] = $packageOrUri;

⌨️ 快捷键说明

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