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


PHP category::listAll方法代码示例

本文整理汇总了PHP中category::listAll方法的典型用法代码示例。如果您正苦于以下问题:PHP category::listAll方法的具体用法?PHP category::listAll怎么用?PHP category::listAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在category的用法示例。


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

示例1: saveAllCategoriesREST

    function saveAllCategoriesREST()
    {
        require_once 'System.php';
        $extra = '/rest/';
        $cdir = $this->_restdir . DIRECTORY_SEPARATOR . 'c';
        if (!is_dir($cdir)) {
            System::mkdir(array('-p', $cdir));
            @chmod($cdir, 0777);
        }
        $categories = category::listAll();
        $info = '<?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="http://pear.php.net/dtd/rest.allcategories"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://pear.php.net/dtd/rest.allcategories
    http://pear.php.net/dtd/rest.allcategories.xsd">
<ch>' . PEAR_CHANNELNAME . '</ch>
';
        foreach ($categories as $category) {
            $info .= ' <c xlink:href="' . $extra . 'c/' . urlencode(urlencode($category['name'])) . '/info.xml">' . htmlspecialchars(utf8_encode($category['name'])) . '</c>
';
        }
        $info .= '</a>';
        file_put_contents($cdir . DIRECTORY_SEPARATOR . 'categories.xml', $info);
        @chmod($cdir . DIRECTORY_SEPARATOR . 'categories.xml', 0666);
    }
开发者ID:ThaDafinser,项目名称:web-pecl,代码行数:26,代码来源:pear-rest.php

示例2: saveAllCategoriesREST

    public function saveAllCategoriesREST()
    {
        include_once 'pear-database-category.php';
        $categories = category::listAll();
        if (PEAR::isError($categories)) {
            return $categories;
        }
        $info = '<?xml version="1.0" encoding="UTF-8" ?>
<a xmlns="http://pear.php.net/dtd/rest.allcategories"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xsi:schemaLocation="http://pear.php.net/dtd/rest.allcategories
    http://pear.php.net/dtd/rest.allcategories.xsd">
<ch>' . $this->channel . '</ch>
';
        foreach ($categories as $category) {
            $info .= ' <c xlink:href="' . $this->extra . 'c/' . urlencode(urlencode($category['name'])) . '/info.xml">' . htmlspecialchars(utf8_encode($category['name'])) . '</c>
';
        }
        $info .= '</a>';
        $cdir = $this->getCategoryDirectory();
        if (!is_dir($cdir)) {
            if (!mkdir($cdir, 0777, true)) {
                return PEAR::raiseError('Creating directory ' . $cdir . ' failed - Check the permissions');
            }
            @chmod($cdir, 0777);
        }
        $file = $cdir . 'categories.xml';
        if (!file_put_contents($file, $info)) {
            return PEAR::raiseError('Writing to file ' . $file . ' failed - Check the permissions');
        }
        @chmod($file, 0666);
    }
开发者ID:stof,项目名称:pearweb,代码行数:33,代码来源:pear-rest.php

示例3: foreach

        $pear_rest->saveAllReleasesREST($package);
        echo "done\n";
        foreach ($releases as $version => $blah) {
            $sql = 'SELECT fullpath FROM files WHERE `release` = ?';
            $fileinfo = $dbh->getOne($sql, array($blah['id']));
            $tar =& new Archive_Tar($fileinfo);
            if ($pxml = $tar->extractInString('package2.xml')) {
            } elseif ($pxml = $tar->extractInString('package.xml')) {
            }
            PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
            $pf = $pkg->fromAnyFile($fileinfo, PEAR_VALIDATE_NORMAL);
            PEAR::popErrorHandling();
            if (!PEAR::isError($pf)) {
                echo "     Version {$version}...";
                $pear_rest->saveReleaseREST($fileinfo, $pxml, $pf, $blah['doneby'], $blah['id']);
                echo "done\n";
            } else {
                echo "     Skipping INVALID Version {$version}\n";
            }
        }
        echo "\n";
    } else {
        echo "  done\n";
    }
}
echo "Generating Category Package REST...\n";
foreach (category::listAll() as $category) {
    echo "  {$category['name']}...";
    $pear_rest->savePackagesCategoryREST($category['name']);
    echo "done\n";
}
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:generateREST.php

示例4:

$months[1] = 'January';
$months[2] = 'February';
$months[3] = 'March';
$months[4] = 'April';
$months[5] = 'May';
$months[6] = 'June';
$months[7] = 'July';
$months[8] = 'August';
$months[9] = 'September';
$months[10] = 'October';
$months[11] = 'November';
$months[12] = 'December';
/**
* Code to fetch the current category list
*/
$category_rows = category::listAll();
if (!empty($_GET['pkg_category'])) {
    for ($i = 0; $i < count($category_rows); $i++) {
        if ($_GET['pkg_category'] == $category_rows[$i]['id']) {
            $category_rows[$i]['selected'] = 'selected="selected"';
        }
    }
}
/**
* Fetch list of users/maintainers
*/
$users = $dbh->getAll('SELECT u.handle, u.name FROM users u, maintains m WHERE u.handle = m.handle GROUP BY handle ORDER BY u.name', DB_FETCHMODE_ASSOC);
for ($i = 0; $i < count($users); $i++) {
    if (empty($users[$i]['name'])) {
        $users[$i]['name'] = $users[$i]['handle'];
    }
开发者ID:phpsource,项目名称:web-pecl,代码行数:31,代码来源:package-search.php

示例5: array_merge

        $pkg[$key] = array_merge($pkg_names, $pkg_tmp[$key]);
    } else {
        $pkg[$key] = $pkg_names;
    }
}
if ($total > 0) {
    if ($rev == 1) {
        arsort($pkg[$sort_by]);
    } else {
        asort($pkg[$sort_by]);
    }
}
$query_string = $_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : '';
// Fetch list of all categories
include_once 'pear-database-category.php';
$res = category::listAll();
?>

<table class="bugstats">
 <tr>
  <td style="white-space: nowrap">
   <form method="get" action="stats.php<?php 
echo htmlspecialchars($query_string);
?>
">
   <p><span class="filter">
    <label for="category" accesskey="o">
     Categ<span class="accesskey">o</span>ry:
    </label>
   <select class="small" name="category" id="category" onchange="this.form.submit(); return false;">
<?php 
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:stats.php

示例6: isset

$_GET['rid'] = isset($_GET['rid']) ? (int) $_GET['rid'] : 0;
$query = "SELECT * FROM packages" . (!empty($_GET['cid']) ? " WHERE category = '" . $_GET['cid'] . "' AND " : " WHERE ") . " packages.package_type = '" . SITE . "'" . " ORDER BY name";
$sth = $dbh->query($query);
$packages = array();
while ($row = $sth->fetchRow(DB_FETCHMODE_ASSOC)) {
    $packages[$row['id']] = $row['name'];
}
echo ' <form action="package-stats.php" method="get">' . "\n";
echo ' <table>' . "\n";
echo '  <caption style="background-color: #CCCCCC;">Select Package</caption>' . "\n";
echo '  <tr>' . "\n";
echo '  <td>' . "\n";
echo '   <select name="cid" onchange="javascript:reloadMe();">' . "\n";
echo '    <option value="">Select category ...</option>' . "\n";
include_once 'pear-database-category.php';
foreach (category::listAll() as $value) {
    $selected = '';
    if (isset($_GET['cid']) && $_GET['cid'] == $value['id']) {
        $selected = ' selected="selected"';
    }
    echo '    <option value="' . $value['id'] . '"' . $selected . '>' . $value['name'] . "</option>\n";
}
echo "  </select>\n";
echo "  </td>\n";
echo "  <td>\n";
if (isset($_GET['cid']) && $_GET['cid'] != '') {
    echo "  <select name=\"pid\" onchange=\"javascript:reloadMe();\">\n";
    echo '    <option value="">Select package ...</option>' . "\n";
    foreach ($packages as $value => $name) {
        $selected = '';
        if (isset($_GET['pid']) && $_GET['pid'] == $value) {
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:package-stats.php

示例7: array

$form->removeAttribute('name');
$renderer =& $form->defaultRenderer();
$renderer->setElementTemplate('
 <tr>
  <th class="form-label_left">
   <!-- BEGIN required --><span style="color: #ff0000">*</span><!-- END required -->
   {label}
  </th>
  <td class="form-input">
   <!-- BEGIN error --><span style="color: #ff0000">{error}</span><br /><!-- END error -->
   {element}
  </td>
 </tr>
');
include_once 'pear-database-category.php';
$categories = category::listAll();
$mapCategories['RFC'] = 'RFC (No package category!)';
foreach ($categories as $categorie) {
    $mapCategories[$categorie['name']] = $categorie['name'];
}
$form->addElement('select', 'pkg_category', '<label for="pkg_category" accesskey="o">Categ<span class="accesskey">o</span>ry:</label>', $mapCategories, 'id="pkg_category"');
$field_desc = 'New category:<br /><p style="font-size: 75%; padding: 4px; margin: 0;">
    Only fill this out if you don\'t find a category that fits your package</p>';
$form->addElement('text', 'pkg_category_new', $field_desc);
$form->addElement('text', 'pkg_name', 'Package name:');
// Dropdown possible licenses, less confusing for users
$possibleLicenses = array('Apache License' => 'Apache License', 'LGPL' => 'LGPL', 'BSD Style' => 'BSD Style', 'MIT License' => 'MIT License');
$form->addElement('select', 'pkg_license', 'License:', $possibleLicenses);
/**
 * @desc Easy codes. makes it easier for people to put bb codes
 *       Since 2011-03-18 these helpers are Text_Wiki examples.
开发者ID:stof,项目名称:pearweb,代码行数:31,代码来源:pepr-proposal-edit.php


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