当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_REST类代码示例

本文整理汇总了PHP中PEAR_REST的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_REST类的具体用法?PHP PEAR_REST怎么用?PHP PEAR_REST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PEAR_REST类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _checkChannelForStatus

 function _checkChannelForStatus($channel, $chan)
 {
     $rest = new PEAR_REST($this->config);
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $a = $rest->downloadHttp('http://' . $channel . '/channel.xml', $chan->lastModified());
     PEAR::staticPopErrorHandling();
     if (!PEAR::isError($a) && $a) {
         $this->ui->outputData('WARNING: channel "' . $channel . '" has ' . 'updated its protocols, use "channel-update ' . $channel . '" to update');
     }
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:10,代码来源:Remote.php

示例2: _checkChannelForStatus

 function _checkChannelForStatus($channel, $chan)
 {
     if (PEAR::isError($chan)) {
         $this->raiseError($chan);
     }
     if (!is_a($chan, 'PEAR_ChannelFile')) {
         return $this->raiseError('Internal corruption error: invalid channel "' . $channel . '"');
     }
     $rest = new PEAR_REST($this->config);
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $a = $rest->downloadHttp('http://' . $channel . '/channel.xml', $chan->lastModified());
     PEAR::staticPopErrorHandling();
     if (!PEAR::isError($a) && $a) {
         $this->ui->outputData('WARNING: channel "' . $channel . '" has ' . 'updated its protocols, use "channel-update ' . $channel . '" to update');
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:16,代码来源:Remote.php

示例3: downloadHttp

 /**
  * @see PEAR_REST::downloadHttp()
  */
 public function downloadHttp($url, $lastmodified = null, $accept = false)
 {
     return parent::downloadHttp($url, $lastmodified, array_merge(false !== $accept ? $accept : array(), array("\r\nX-SYMFONY-VERSION: " . SYMFONY_VERSION)));
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:7,代码来源:sfPearRest.class.php

示例4: downloadHttp

 /**
  * @see PEAR_REST::downloadHttp()
  */
 public function downloadHttp($url, $lastmodified = null, $accept = false)
 {
     return parent::downloadHttp($url, $lastmodified, $accept);
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:7,代码来源:sfPearRest.class.php

示例5: listCategory

 /**
  * List packages in a category of a REST server
  *
  * @param string $base base URL of the server
  * @param string $category name of the category
  * @param boolean $info also download full package info
  * @return array of packagenames
  */
 function listCategory($base, $category, $info = false, $channel = false)
 {
     if ($info == false) {
         $url = '%s' . 'c/%s/packages.xml';
     } else {
         $url = '%s' . 'c/%s/packagesinfo.xml';
     }
     $url = sprintf($url, $base, urlencode($category));
     // gives '404 Not Found' error when category doesn't exist
     $packagelist = $this->_rest->retrieveData($url, false, false, $channel);
     if (PEAR::isError($packagelist)) {
         return $packagelist;
     }
     if (!is_array($packagelist)) {
         return array();
     }
     if ($info == false) {
         if (!isset($packagelist['p'])) {
             return array();
         }
         if (!is_array($packagelist['p']) || !isset($packagelist['p'][0])) {
             // only 1 pkg
             $packagelist = array($packagelist['p']);
         } else {
             $packagelist = $packagelist['p'];
         }
         return $packagelist;
     } else {
         // info == true
         if (!isset($packagelist['pi'])) {
             return array();
         }
         if (!is_array($packagelist['pi']) || !isset($packagelist['pi'][0])) {
             // only 1 pkg
             $packagelist_pre = array($packagelist['pi']);
         } else {
             $packagelist_pre = $packagelist['pi'];
         }
         $packagelist = array();
         foreach ($packagelist_pre as $i => $item) {
             // compatibility with r/<latest.txt>.xml
             if (isset($item['a']['r'][0])) {
                 // multiple releases
                 $item['p']['v'] = $item['a']['r'][0]['v'];
                 $item['p']['st'] = $item['a']['r'][0]['s'];
             } elseif (isset($item['a'])) {
                 // first and only release
                 $item['p']['v'] = $item['a']['r']['v'];
                 $item['p']['st'] = $item['a']['r']['s'];
             }
             $packagelist[$i] = array('attribs' => $item['p']['r'], '_content' => $item['p']['n'], 'info' => $item['p']);
         }
     }
     return $packagelist;
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:63,代码来源:11.php

示例6: packageInfo

 function packageInfo($base, $package, $channel = false)
 {
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     $pinfo = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
     if (PEAR::isError($pinfo)) {
         PEAR::popErrorHandling();
         return PEAR::raiseError('Unknown package: "' . $package . '" in channel "' . $channel . '"' . "\n" . 'Debug: ' . $pinfo->getMessage());
     }
     $releases = array();
     $allreleases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/allreleases.xml', false, false, $channel);
     if (!PEAR::isError($allreleases)) {
         if (!class_exists('PEAR_PackageFile_v2')) {
             require_once 'PEAR/PackageFile/v2.php';
         }
         if (!is_array($allreleases['r']) || !isset($allreleases['r'][0])) {
             $allreleases['r'] = array($allreleases['r']);
         }
         $pf = new PEAR_PackageFile_v2();
         foreach ($allreleases['r'] as $release) {
             $ds = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' . $release['v'] . '.txt', false, false, $channel);
             if (PEAR::isError($ds)) {
                 continue;
             }
             if (!isset($latest)) {
                 $latest = $release['v'];
             }
             $pf->setDeps(unserialize($ds));
             $ds = $pf->getDeps();
             $info = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' . $release['v'] . '.xml', false, false, $channel);
             if (PEAR::isError($info)) {
                 continue;
             }
             $releases[$release['v']] = array('doneby' => $info['m'], 'license' => $info['l'], 'summary' => $info['s'], 'description' => $info['d'], 'releasedate' => $info['da'], 'releasenotes' => $info['n'], 'state' => $release['s'], 'deps' => $ds ? $ds : array());
         }
     } else {
         $latest = '';
     }
     PEAR::popErrorHandling();
     if (isset($pinfo['dc']) && isset($pinfo['dp'])) {
         if (is_array($pinfo['dp'])) {
             $deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp']['_content']));
         } else {
             $deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp']));
         }
     } else {
         $deprecated = false;
     }
     if (!isset($latest)) {
         $latest = '';
     }
     return array('name' => $pinfo['n'], 'channel' => $pinfo['c'], 'category' => $pinfo['ca']['_content'], 'stable' => $latest, 'license' => $pinfo['l'], 'summary' => $pinfo['s'], 'description' => $pinfo['d'], 'releases' => $releases, 'deprecated' => $deprecated);
 }
开发者ID:kaz6120,项目名称:Loggix,代码行数:52,代码来源:10.php

示例7: listAll

 function listAll($base, $dostable, $basic = true)
 {
     $categorylist = $this->_rest->retrieveData($base . 'c/categories.xml');
     if (PEAR::isError($categorylist)) {
         return $categorylist;
     }
     $ret = array();
     if (!is_array($categorylist['c']) || !isset($categorylist['c'][0])) {
         $categorylist['c'] = array($categorylist['c']);
     }
     PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
     foreach ($categorylist['c'] as $progress => $category) {
         $category = $category['_content'];
         $packagesinfo = $this->_rest->retrieveData($base . 'c/' . urlencode($category) . '/packagesinfo.xml');
         if (PEAR::isError($packagesinfo)) {
             continue;
         }
         if (!is_array($packagesinfo) || !isset($packagesinfo['pi'])) {
             continue;
         }
         if (!is_array($packagesinfo['pi']) || !isset($packagesinfo['pi'][0])) {
             $packagesinfo['pi'] = array($packagesinfo['pi']);
         }
         foreach ($packagesinfo['pi'] as $packageinfo) {
             $info = $packageinfo['p'];
             $package = $info['n'];
             $releases = isset($packageinfo['a']) ? $packageinfo['a'] : false;
             unset($latest);
             unset($unstable);
             unset($stable);
             unset($state);
             if ($releases) {
                 if (!isset($releases['r'][0])) {
                     $releases['r'] = array($releases['r']);
                 }
                 foreach ($releases['r'] as $release) {
                     if (!isset($latest)) {
                         if ($dostable && $release['s'] == 'stable') {
                             $latest = $release['v'];
                             $state = 'stable';
                         }
                         if (!$dostable) {
                             $latest = $release['v'];
                             $state = $release['s'];
                         }
                     }
                     if (!isset($stable) && $release['s'] == 'stable') {
                         $stable = $release['v'];
                         if (!isset($unstable)) {
                             $unstable = $stable;
                         }
                     }
                     if (!isset($unstable) && $release['s'] != 'stable') {
                         $latest = $unstable = $release['v'];
                         $state = $release['s'];
                     }
                     if (isset($latest) && !isset($state)) {
                         $state = $release['s'];
                     }
                     if (isset($latest) && isset($stable) && isset($unstable)) {
                         break;
                     }
                 }
             }
             if ($basic) {
                 // remote-list command
                 if (!isset($latest)) {
                     $latest = false;
                 }
                 if ($dostable) {
                     if ($state == 'stable') {
                         $ret[$package] = array('stable' => $latest);
                     } else {
                         $ret[$package] = array('stable' => '-n/a-');
                     }
                 } else {
                     $ret[$package] = array('stable' => $latest);
                 }
                 continue;
             }
             // list-all command
             $deps = array();
             if (!isset($unstable)) {
                 $unstable = false;
                 $state = 'stable';
                 if (isset($stable)) {
                     $latest = $unstable = $stable;
                 }
             } else {
                 $latest = $unstable;
             }
             if (!isset($latest)) {
                 $latest = false;
             }
             if ($latest && $packageinfo['deps'] !== null) {
                 if (isset($packageinfo['deps'])) {
                     if (!is_array($packageinfo['deps']) || !isset($packageinfo['deps'][0])) {
                         $packageinfo['deps'] = array($packageinfo['deps']);
                     }
                 }
//.........这里部分代码省略.........
开发者ID:kjy112,项目名称:TempestAlert,代码行数:101,代码来源:11.php


注:本文中的PEAR_REST类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。