Beispiel #1
0
    /**
     * Retrieves and formats the PEAR Credits
     *
     * @return string
     * @access private
     * @since  version 1.0.1 (2003-04-24)
     */
    function getCredits()
    {
        $html_pear_credits = '<h1>PEAR Credits</h1>';
        $teams = PEAR_Info::getMembers();
        if ($this->options['resume'] & PEAR_INFO_CREDITS_GROUP || isset($_GET['credits'])) {
            $html_pear_credits .= '
<table>
    <tr class="hc">
        <td colspan="2">
            PEAR Group
        </td>
    </tr>
    <tr class="v">
        <td class="e">
            President
        </td>
        <td>
            {president}
        </td>
    </tr>
    <tr class="v">
        <td colspan="2">
';
            foreach ($teams['president'] as $handle => $name) {
                $html_member = '<a href="http://pear.php.net/account-info.php?handle=' . $handle . '">' . $name . '</a>,';
                $html_pear_credits = str_replace('{president}', $html_member, $html_pear_credits);
            }
            foreach ($teams['group'] as $handle => $name) {
                $html_member = '<a href="http://pear.php.net/account-info.php?handle=' . $handle . '">' . $name . '</a>,';
                $html_pear_credits .= $html_member;
            }
            $html_pear_credits .= '
        </td>
    </tr>
</table>
<br />
';
        }
        if ($this->options['resume'] & PEAR_INFO_CREDITS_DOCS || isset($_GET['credits'])) {
            if (count($teams['docs']) > 0) {
                $html_pear_credits .= '
<table>
    <tr class="hc">
        <td>
            PEAR Documentation Team
        </td>
    </tr>
    <tr class="v">
        <td>
';
                foreach ($teams['docs'] as $handle => $name) {
                    $html_member = '<a href="http://pear.php.net/account-info.php?handle=' . $handle . '">' . $name . '</a>,';
                    $html_pear_credits .= $html_member;
                }
                $html_pear_credits .= '
        </td>
    </tr>
</table>
<br />
';
            }
        }
        if ($this->options['resume'] & PEAR_INFO_CREDITS_WEBSITE || isset($_GET['credits'])) {
            if (count($teams['website']) > 0) {
                $html_pear_credits .= '
<table>
    <tr class="hc">
        <td>
            PEAR Website Team
        </td>
    </tr>
    <tr class="v">
        <td>
';
                foreach ($teams['website'] as $handle => $name) {
                    $html_member = '<a href="http://pear.php.net/account-info.php?handle=' . $handle . '">' . $name . '</a>,';
                    $html_pear_credits .= $html_member;
                }
                $html_pear_credits .= '
        </td>
    </tr>
</table>
<br />
';
            }
        }
        if (!($this->options['resume'] & PEAR_INFO_CREDITS_PACKAGES) && !isset($_GET['credits'])) {
            return $html_pear_credits;
        }
        // Credits authors of packages group by channels
        $channel_allowed = $this->options['channels'];
        $available = $this->reg->listAllPackages();
        if (PEAR::isError($available)) {
            $e = '<p class="error">An Error occured while fetching the credits' . ' from the remote server. Please try again.</p>';
            return $e;
        }
        if (!is_array($available)) {
            $e = '<p class="error">The credits could not be fetched' . ' from the remote server. Please try again.</p>';
            return $e;
        }
        foreach ($available as $channel => $pkg) {
            if (!in_array($channel, $channel_allowed)) {
                continue;
            }
            if (count($pkg) == 0) {
                // improve render and did not display channel without package
                continue;
            }
            $html_pear_credits .= '
<br />
<table border="0" cellpadding="3" width="600">
<tr class="hc"><td colspan="2">Channel {channel}</td></tr>
<tr class="h"><td>Package</td><td>Maintainers</td></tr>';
            $html_pear_credits = str_replace('{channel}', $channel, $html_pear_credits);
            // sort package by alphabetic order
            sort($pkg);
            //
            foreach ($pkg as $name) {
                $info =& $this->reg->getPackage($name, $channel);
                if (is_object($info)) {
                    $installed['package'] = $info->getPackage();
                    $installed['maintainers'] = $info->getMaintainers();
                } else {
                    $installed = $info;
                }
                $ptpl = '
<tr>
    <td class="e">
        <a href="http://{channel}/{packageURI}">{package}</a>
    </td>
    <td class="v">
        {maintainers}
    </td>
</tr>';
                $maintainers = array();
                foreach ($installed['maintainers'] as $i) {
                    $maintainers[] = '<a href="http://pear.php.net/account-info.php?handle=' . $i['handle'] . '">' . htmlentities(html_entity_decode(utf8_decode($i['name']))) . '</a>' . ' (' . $i['role'] . (isset($i['active']) && $i['active'] === 'no' ? ', inactive' : '') . ')';
                }
                $maintainers = implode(', ', $maintainers);
                $html_pear_credits .= str_replace(array('{packageURI}', '{package}', '{channel}', '{maintainers}'), array(trim(strtolower($installed['package'])), trim($installed['package']), $channel, $maintainers), $ptpl);
            }
            $html_pear_credits .= '
</table>
';
        }
        return $html_pear_credits;
    }