Esempio n. 1
0
 function __construct($yellow, $page)
 {
     $this->yellow = $yellow;
     $this->page = $page;
     $this->idAttributes = array();
     $this->no_markup = $page->parserSafeMode;
     $this->url_filter_func = function ($url) use($yellow, $page) {
         return $yellow->lookup->normaliseLocation($url, $page->base, $page->location, $yellow->config->get("serverBase") . $yellow->config->get("imageLocation"), $page->parserSafeMode && $page->statusCode == 200);
     };
     parent::__construct();
 }
Esempio n. 2
0
    /**
     * Create a new instance and enable or disable features.
     * @param array $features   enabled or disabled features
     *
     * You can pass an array of features to disable some of them for performance improvement.
     * E.g.
     * $features = array(
     *     'table' => false,
     *     'definition_list' => false
     * )
     */
    public function __construct(array $features = array())
    {
        parent::__construct();

        $this->features = array_merge($this->features, $features);

        if (!$this->features['header']) {
            unset($this->block_gamut['doHeaders']);
        }
        if (!$this->features['list']) {
            unset($this->block_gamut['doLists']);
        }
        if (!$this->features['horizontal_rule']) {
            unset($this->block_gamut['doHorizontalRules']);
        }
        if (!$this->features['table']) {
            unset($this->block_gamut['doTables']);
        }
        if (!$this->features['foot_note']) {
            unset($this->document_gamut['stripFootnotes']);
            unset($this->document_gamut['appendFootnotes']);
            unset($this->span_gamut['doFootnotes']);
        }
        if (!$this->features['fenced_code_block']) {
            unset($this->document_gamut['doFencedCodeBlocks']);
            unset($this->block_gamut['doFencedCodeBlocks']);
        }
        if (!$this->features['abbreviation']) {
            unset($this->document_gamut['stripAbbreviations']);
            unset($this->span_gamut['doAbbreviations']);
        }
        if (!$this->features['definition_list']) {
            unset($this->block_gamut['doDefLists']);
        }
        if (!$this->features['reference_link']) {
            unset($this->document_gamut['stripLinkDefinitions']);
        }
        if(!$this->features['block_quote']) {
            unset($this->block_gamut['doBlockQuotes']);
        }
        if(!$this->features['code_block']) {
            unset($this->block_gamut['doCodeBlocks']);
        }
        if(!$this->features['auto_link']) {
            unset($this->span_gamut['doAutoLinks']);
        }
        if(!$this->features['entities']) {
            $this->no_entities = true;
        }
    }