Exemplo n.º 1
0
 /**
  * Save REST xml information for all categories
  * 
  * This is not release-dependent
  * 
  * @return void
  */
 function saveAllCategories()
 {
     $categories     = PEAR2_SimpleChannelServer_Categories::getCategories();
     $xml            = $this->_getProlog('a', 'allcategories');
     $xml['a']['ch'] = $this->channel;
     $xml['a']['c']  = array();
     if (count($categories) == 1) {
         $xml['a']['c'] = array('attribs' =>
             array('xlink:href' =>
                 $this->getCategoryRESTLink(urlencode(key($categories))
                     . '/info.xml')),
             '_content' => key($categories));
             $this->saveInfo(key($categories),
                             $categories[key($categories)]['desc'],
                             $categories[key($categories)]['alias']);
     } else {
         foreach ($categories as $category => $data) {
             $xml['a']['c'] = array(
                 'attribs' => array(
                     'xlink:href' =>
                     $this->getCategoryRESTLink(urlencode($category) . '/info.xml')),
                 '_content' => $category,
             );
             $this->saveInfo($category, $data['desc'], $data['alias']);
         }
     }
     $this->saveCategoryREST('categories.xml', $xml);
 }
Exemplo n.º 2
0
 /**
  * List all packages, organized by category (unsorted)
  *
  * @return array
  */
 function listPackagesByCategory()
 {
     $ret = array();
     foreach (PEAR2_SimpleChannelServer_Categories::getCategories() as $cat) {
         $ret[$cat] = PEAR2_SimpleChannelServer_Categories::packagesInCategory($cat);
     }
     return $ret;
 }