Exemplo n.º 1
0
function LookupTypes($Parameters)
{
    $Types = [];
    $TypesToLookup = [];
    foreach ($Parameters as $Param) {
        $Type = NormalizeType($Param['type']);
        if (!IsDefaultType($Type)) {
            $TypesToLookup[$Type] = $Type;
        }
    }
    if (!empty($TypesToLookup)) {
        global $Database;
        // Enums
        $Query = 'select i.name as include_name, e.name ' . 'from spdoc_enum e ' . 'join spdoc_include i ' . ' on e.include_id = i.id ' . 'where e.name IN (' . ArrayToSql($TypesToLookup) . ')';
        $STH = $Database->query($Query);
        while ($Type = $STH->fetch()) {
            unset($TypesToLookup[$Type['name']]);
            $Types[$Type['name']] = $Type['include_name'];
        }
        // Types
        if (!empty($TypesToLookup)) {
            $Query = 'select i.name as include_name, t.name ' . 'from spdoc_type t ' . 'join spdoc_include i ' . ' on t.include_id = i.id ' . 'where t.name IN (' . ArrayToSql($TypesToLookup) . ')';
            $STH = $Database->query($Query);
            while ($Type = $STH->fetch()) {
                unset($TypesToLookup[$Type['name']]);
                $Types[$Type['name']] = $Type['include_name'];
            }
        }
        // Classes
        if (!empty($TypesToLookup)) {
            $Query = 'select i.name as include_name, c.name ' . 'from spdoc_class c ' . 'join spdoc_include i ' . ' on c.include_id = i.id ' . 'where c.name IN (' . ArrayToSql($TypesToLookup) . ')';
            $STH = $Database->query($Query);
            while ($Type = $STH->fetch()) {
                $Types[$Type['name']] = $Type['include_name'];
            }
        }
    }
    return $Types;
}
Exemplo n.º 2
0
<?php

// vim: set ts=4 sw=4 tw=99 et:
require __DIR__ . '/header.php';
require __DIR__ . '/type_helpers.php';
$Data = json_decode($PageProperty['data'], true);
$Types = LookupTypes([$PageProperty]);
$Type = NormalizeType($PageProperty['type']);
?>

<ol class="breadcrumb">
    <li><a href="<?php 
echo $BaseURL . $CurrentOpenFile;
?>
"><?php 
echo $CurrentOpenFile;
?>
.inc</a></li>
    <li>Classes</li>
    <li><a href="<?php 
echo htmlspecialchars($BaseURL . $CurrentOpenFile . '/' . $PageProperty['class_name']);
?>
"><?php 
echo htmlspecialchars($PageProperty['class_name']);
?>
</a></li>
    <li>Properties</li>
    <li class="active"><?php 
echo htmlspecialchars($PageProperty['name']);
?>
</li>
Exemplo n.º 3
0
    echo '</pre>';
} else {
    echo '<pre class="syntax">' . HighlightTypes($PageFunction['signature'], $Parameters, []) . '</pre>';
}
?>

<?php 
if (!empty($Parameters)) {
    ?>
<h4 class="sub-header2">Parameters</h4>

<dl>
<?php 
    foreach ($Parameters as $Param) {
        echo '<dt class="mono">';
        $Type = NormalizeType($Param['type']);
        if (isset($Types[$Type])) {
            echo '<a href="' . $BaseURL . $Types[$Type] . '/' . $Type . '" class="type">' . htmlspecialchars($Param['type']) . '</a> ';
        } else {
            echo '<span class="type">' . htmlspecialchars($Param['type']) . '</span> ';
        }
        echo htmlspecialchars($Param['name']);
        echo '</dt>';
        echo '<dd>';
        if (empty($Param['doc'])) {
            echo '<i class="text-muted">No description.</i>';
        } else {
            RenderDescription($Param['doc']);
        }
        echo '</dd>';
    }