Example #1
0
function ouvrante($parser, $name, $attrs)
{
    static $labels = array();
    global $tr;
    // La ligne suivante concerne la Question 4 + declaration global
    //une nouvelle table dont la premiere ligne n'est pas encore rencontrée
    if ($name == 'table') {
        $tr = 0;
    }
    if ($name == 'tr') {
        $tr++;
    }
    if ($name == 'td' and $tr == 1) {
        $name = 'th';
    }
    if ($name == 'input' and isset($attrs['name'])) {
        $id = isset($attrs['id']) ? $attrs['id'] : $attrs['name'];
        $attrs['id'] = $id;
        if (!isset($labels[$id]) and isset($attrs['value'])) {
            echo "<label for='{$id}'>", $attrs['value'], "</label>\n";
        }
    } elseif ($name == 'label') {
        $labels[$attrs['for']] = true;
    }
    echo "<{$name}";
    foreach (ouvrante_attrs($name, $attrs) as $k => $v) {
        echo " {$k}='", htmlspecialchars($v), "'";
    }
    echo ">";
}
Example #2
0
function ouvrante($parser, $name, $attrs)
{
    echo "<{$name}";
    foreach (ouvrante_attrs($name, $attrs) as $k => $v) {
        echo " {$k}='", htmlspecialchars($v), "'";
    }
    echo ">";
}
Example #3
0
function ouvrante($parser, $name, $attrs)
{
    static $labels = array();
    global $tr;
    global $ferme;
    global $depth, $contenu;
    if ($ferme) {
        echo '>';
    }
    $t = $contenu[$depth];
    echo preg_replace("%[\n\t ]+\$%", "", $t), $depth ? "\n{$depth}" : '';
    $contenu[$depth] = "";
    // La ligne suivante concerne la Question 4 + declaration global
    //une nouvelle table dont la premiere ligne n'est pas encore rencontrée
    if ($name == 'table') {
        $tr = 0;
    }
    if ($name == 'tr') {
        $tr++;
    }
    if ($name == 'td' and $tr == 1) {
        $name = 'th';
    }
    if ($name == 'input' and isset($attrs['name'])) {
        $id = isset($attrs['id']) ? $attrs['id'] : $attrs['name'];
        $attrs['id'] = $id;
        if (!isset($labels[$id]) and isset($attrs['value'])) {
            echo "<label for='{$id}'>", $attrs['value'], "\n{$depth}</label>\n{$depth}";
        }
    } elseif ($name == 'label') {
        $labels[$attrs['for']] = true;
    }
    echo "<{$name}";
    foreach (ouvrante_attrs($name, $attrs) as $k => $v) {
        echo "\n{$depth} {$k}='", htmlspecialchars($v), "'";
    }
    $ferme = true;
    $depth .= '  ';
    $contenu[$depth] = "";
}
Example #4
0
function ouvrante($parser, $name, $attrs)
{
    static $labels = array();
    if ($name == 'input' and isset($attrs['name'])) {
        $id = isset($attrs['id']) ? $attrs['id'] : $attrs['name'];
        $attrs['id'] = $id;
        if (!isset($labels[$id])) {
            if (isset($attrs['value'])) {
                echo "<label for='{$id}'>", $attrs['value'], "</label>\n";
            } else {
                echo "<label for='{$id}'>", $attrs['id'], "</label>\n";
            }
        }
    } elseif ($name == 'label' and isset($attrs['for'])) {
        $labels[$attrs['for']] = true;
    }
    echo "<{$name}";
    foreach (ouvrante_attrs($name, $attrs) as $k => $v) {
        echo " {$k}='", htmlspecialchars($v), "'";
    }
    echo ">";
}