Config by mal obsahovat xpath upmiestnenie tabulky a pocet tr ktore preskocit

@param unknown_type $config
@param unknown_type $text
@param unknown_type $time
483840
public function spracuj($config, $text, $time) {
        $text = '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>' . $text;
        $from_enc = "ISO-8859-2";
        if ($config["from_encoding"]) $from_enc = $config["from_encoding"];
        $text = str_replace($from_enc, "utf-8", $text);
        $this->text = iconv($from_enc, "utf-8", $text);
        $this->config = $config;
        $this->time = Time::get($time);
        $this->doc = @\DOMDocument::loadHtml($this->text);
        if (!$this->doc) {
            file_put_contents("test002.html", $text);
            exit;
        }
        //		var_dump($this->doc);
        $this->xpath = new \DOMXPath($this->doc);
        return $data = $this->createData();
    }
124484
public function configureHooks(Config $config) : void
    {
        foreach (HookUtil::getHooks() as $hook) {
            $this->configureHook($config->getHookConfig($hook), $hook);
        }
    }
236965
protected function cookie($config)
    {
        $minutes = (!$config['expire_on_close']) ? $config['lifetime'] : 0;

        Cookie::put($config['cookie'], $this->session['id'], $minutes, $config['path'], $config['domain'],
            $config['secure']);
    }
908981
public function handle(Document $document, array $config)
    {
        $this->parsedown->setConfig($config);
        $document->setContent($this->parsedown->text($document->getContent()));
    }
927858
public function parse($text, array $config, $purgePlaceholders = true)
    {
        $parser = call_user_func($this->parserCreator, $text);

        list($infile, $outfile) = $this->inFileAndOutFile($config);

        $tokens = $parser->getTokens();

        $string = '';

        foreach ($tokens as $token) {
            if ($token instanceof CssToken) {
                $this->replaceWithCorrectedPath($token, $infile, $outfile);
            }
            $string .= "$token";
        }

        return $string;
    }
508794
public function config($config, $val = ""){

            if(is_array($config)){
                $this->config = array_merge($this->config, $config);
            }else{
                $this->config[$config] = $val;
            }

            return $this;

        }
136925
public function setContent($text, $type = 'text')
    {
        $this->setType($type);
        $this->getDomElement()->nodeValue = $text;
        $this->setCachedProperty('content', $this->parseContent());
    }
1033198
public static function inPast($date, $time = null)
    {
        if (is_null($time)) {
            $time = self::time();
        }
        if (!is_int($date)) {
            $date = self::strtotime($date);
        }

        return $time > $date;
    }
964145
public function timeEventAdded(Span $span, TimeEvent $timeEvent)
    {
        if ($span->attached()) {
            if ($timeEvent instanceof Annotation) {
                $this->addAnnotation($timeEvent->description(), [
                    'time' => $timeEvent->time(),
                    'attributes' => $timeEvent->attributes(),
                    'span' => $span
                ]);
            } elseif ($timeEvent instanceof MessageEvent) {
                $this->addMessageEvent($timeEvent->type(), $timeEvent->id(), [
                    'time' => $timeEvent->time(),
                    'uncompressedSize' => $timeEvent->uncompressedSize(),
                    'compressedSize' => $timeEvent->compressedSize(),
                    'span' => $span
                ]);
            }
        }
    }
1307084
public function parse($text)
	{
		// Reset the parser and save the uid
		$this->reset($text);
		$uid = $this->uid;

		// Do the heavy lifting
		$this->executePluginParsers();
		$this->processTags();

		// Finalize the document
		$this->finalizeOutput();

		// Check the uid in case a plugin or a filter reset the parser mid-execution
		if ($this->uid !== $uid)
		{
			throw new RuntimeException('The parser has been reset during execution');
		}

		// Log a warning if the fixing cost limit was exceeded
		if ($this->currentFixingCost > $this->maxFixingCost)
		{
			$this->logger->warn('Fixing cost limit exceeded');
		}

		return $this->output;
	}
1090951
protected function parseConfig($config)
    {
        $parsed = [];

        foreach ($config as $key=>$value) {
            if ($value instanceof XType) {
                $parsed[$key] = $value;
                continue;
            }
            $parsed[$key] = $this->stringToType($value);
        }

        return $parsed;
    }
177734
private void setDefaultFonts(BrowserConfig config) {
		config.setDefaultFont(Font.SERIF, "Times New Roman");
		config.setDefaultFont(Font.SANS_SERIF, "Arial");
		config.setDefaultFont(Font.MONOSPACED, "Courier New");
	}
1142173
public function setCommand($date, $time)
    {
        $arguments = $this->arguments->getValues();
        if (count($arguments) === 1) {
            $str = trim(strtr($arguments[0], 'Tt', '  '));
            if (strpos($str, ' ') === false) {
                if (strpos($str, ':') !== false) {
                    $date = '';
                    $time = $str;
                } else {
                    $date = $str;
                    $time = '';
                }
            } else {
                list($date, $time) = explode(' ', $str);
            }
        }

        $date = $date ? strtr($date, '/', '-') : (string)date('Y-m-d');
        $date = trim(trim($date), '-');

        switch (substr_count($date, '-')) {
            case 0:
                $date = date('Y-m-') . $date;
                break;
            case 1:
                $date = date('Y-') . $date;
                break;
        }
        $parts = explode('-', $date);
        $parts[0] = substr(date('Y'), 0, 4 - strlen($parts[0])) . $parts[0];
        $date = $parts[0] . '-' . str_pad($parts[1], 2, '0', STR_PAD_LEFT) . '-' . str_pad($parts[2], 2, '0', STR_PAD_LEFT);

        $time = $time ? trim($time) : (string)date('H:i:s');
        if ($time[0] === ':') {
            $time = date('H') . $time;
        }
        switch (substr_count($time, ':')) {
            case 0:
                $time .= date(':i:s');
                break;
            case 1:
                $time .= date(':s');
                break;
        }
        $parts = explode(':', $time);

        $time = str_pad($parts[0], 2, '0', STR_PAD_LEFT) . ':' . str_pad($parts[1], 2, '0', STR_PAD_LEFT) . ':' . str_pad($parts[2], 2, '0', STR_PAD_LEFT);

        $str = $date . ' ' . $time;
        $timestamp = strtotime($str);
        if ($timestamp === false || preg_match('#^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$#', $str) !== 1) {
            return $this->console->error(['`:time` time format is invalid', 'time' => $str]);
        } else {
            $this->_updateDate($timestamp);
            $this->console->writeLn(date('Y-m-d H:i:s'));

            return 0;
        }
    }
640510
public static function isWithinNext($time, $span) {
        $span = static::factory($span);
        $time = static::factory($time);
        $now = static::factory();

        return ($time <= $span && $time >= $now);
    }
951880
protected function assureContentsByProvider(MailConfig $config, array &$data, DateTime $plannedSendDate = null)
    {
        if (isset($data[self::SUBJECT]) && isset($data[self::BODY]) && !$this->preferConfiguredData) {
            return;
        }

        $content = $this->contentProvider->contentsFor($config, $plannedSendDate);

        if (isset($data[self::SUBJECT]) && !$content) {
            return;
        }

        if (!$config && !isset($data[self::SUBJECT])) {
            throw new UnderflowException('No subject passed and no contents found by provider');
        }

        if (!$content) {
            throw new UnderflowException('No content found and nothing passed for config #'.$config->getId());
        }

        if ($originator = $content->originator()) {
            $data[self::ORIGINATOR] = $originator;
        }

        if (!isset($data[self::SUBJECT]) || $this->preferConfiguredData) {
            $data[self::SUBJECT] = $content->subject();
        }

        if (!isset($data[self::BODY]) || $this->preferConfiguredData) {
            $data[self::BODY] = $content->body();
        }
    }
332447
public function addText(string $text)
    {
        $contentConfig = [
            'text' => $text
        ];

        $contentItem = new ContentItem($contentConfig);

        $this->contentItems->addContentItemToCollection($contentItem);
    }
297950
protected function doSetup($config) {

        $this->info['text-align'] = new HTMLPurifier_AttrDef_Enum(
            array('left', 'right', 'center', 'justify'), false);

        $border_style =
        $this->info['border-bottom-style'] =
        $this->info['border-right-style'] =
        $this->info['border-left-style'] =
        $this->info['border-top-style'] =  new HTMLPurifier_AttrDef_Enum(
            array('none', 'hidden', 'dotted', 'dashed', 'solid', 'double',
            'groove', 'ridge', 'inset', 'outset'), false);

        $this->info['border-style'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_style);

        $this->info['clear'] = new HTMLPurifier_AttrDef_Enum(
            array('none', 'left', 'right', 'both'), false);
        $this->info['float'] = new HTMLPurifier_AttrDef_Enum(
            array('none', 'left', 'right'), false);
        $this->info['font-style'] = new HTMLPurifier_AttrDef_Enum(
            array('normal', 'italic', 'oblique'), false);
        $this->info['font-variant'] = new HTMLPurifier_AttrDef_Enum(
            array('normal', 'small-caps'), false);

        $uri_or_none = new HTMLPurifier_AttrDef_CSS_Composite(
            array(
                new HTMLPurifier_AttrDef_Enum(array('none')),
                new HTMLPurifier_AttrDef_CSS_URI()
            )
        );

        $this->info['list-style-position'] = new HTMLPurifier_AttrDef_Enum(
            array('inside', 'outside'), false);
        $this->info['list-style-type'] = new HTMLPurifier_AttrDef_Enum(
            array('disc', 'circle', 'square', 'decimal', 'lower-roman',
            'upper-roman', 'lower-alpha', 'upper-alpha', 'none'), false);
        $this->info['list-style-image'] = $uri_or_none;

        $this->info['list-style'] = new HTMLPurifier_AttrDef_CSS_ListStyle($config);

        $this->info['text-transform'] = new HTMLPurifier_AttrDef_Enum(
            array('capitalize', 'uppercase', 'lowercase', 'none'), false);
        $this->info['color'] = new HTMLPurifier_AttrDef_CSS_Color();

        $this->info['background-image'] = $uri_or_none;
        $this->info['background-repeat'] = new HTMLPurifier_AttrDef_Enum(
            array('repeat', 'repeat-x', 'repeat-y', 'no-repeat')
        );
        $this->info['background-attachment'] = new HTMLPurifier_AttrDef_Enum(
            array('scroll', 'fixed')
        );
        $this->info['background-position'] = new HTMLPurifier_AttrDef_CSS_BackgroundPosition();

        $border_color =
        $this->info['border-top-color'] =
        $this->info['border-bottom-color'] =
        $this->info['border-left-color'] =
        $this->info['border-right-color'] =
        $this->info['background-color'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('transparent')),
            new HTMLPurifier_AttrDef_CSS_Color()
        ));

        $this->info['background'] = new HTMLPurifier_AttrDef_CSS_Background($config);

        $this->info['border-color'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_color);

        $border_width =
        $this->info['border-top-width'] =
        $this->info['border-bottom-width'] =
        $this->info['border-left-width'] =
        $this->info['border-right-width'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('thin', 'medium', 'thick')),
            new HTMLPurifier_AttrDef_CSS_Length('0') //disallow negative
        ));

        $this->info['border-width'] = new HTMLPurifier_AttrDef_CSS_Multiple($border_width);

        $this->info['letter-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('normal')),
            new HTMLPurifier_AttrDef_CSS_Length()
        ));

        $this->info['word-spacing'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('normal')),
            new HTMLPurifier_AttrDef_CSS_Length()
        ));

        $this->info['font-size'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('xx-small', 'x-small',
                'small', 'medium', 'large', 'x-large', 'xx-large',
                'larger', 'smaller')),
            new HTMLPurifier_AttrDef_CSS_Percentage(),
            new HTMLPurifier_AttrDef_CSS_Length()
        ));

        $this->info['line-height'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('normal')),
            new HTMLPurifier_AttrDef_CSS_Number(true), // no negatives
            new HTMLPurifier_AttrDef_CSS_Length('0'),
            new HTMLPurifier_AttrDef_CSS_Percentage(true)
        ));

        $margin =
        $this->info['margin-top'] =
        $this->info['margin-bottom'] =
        $this->info['margin-left'] =
        $this->info['margin-right'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_CSS_Length(),
            new HTMLPurifier_AttrDef_CSS_Percentage(),
            new HTMLPurifier_AttrDef_Enum(array('auto'))
        ));

        $this->info['margin'] = new HTMLPurifier_AttrDef_CSS_Multiple($margin);

        // non-negative
        $padding =
        $this->info['padding-top'] =
        $this->info['padding-bottom'] =
        $this->info['padding-left'] =
        $this->info['padding-right'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_CSS_Length('0'),
            new HTMLPurifier_AttrDef_CSS_Percentage(true)
        ));

        $this->info['padding'] = new HTMLPurifier_AttrDef_CSS_Multiple($padding);

        $this->info['text-indent'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_CSS_Length(),
            new HTMLPurifier_AttrDef_CSS_Percentage()
        ));

        $trusted_wh = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_CSS_Length('0'),
            new HTMLPurifier_AttrDef_CSS_Percentage(true),
            new HTMLPurifier_AttrDef_Enum(array('auto'))
        ));
        $max = $config->get('CSS.MaxImgLength');

        $this->info['width'] =
        $this->info['height'] =
            $max === null ?
            $trusted_wh :
            new HTMLPurifier_AttrDef_Switch('img',
                // For img tags:
                new HTMLPurifier_AttrDef_CSS_Composite(array(
                    new HTMLPurifier_AttrDef_CSS_Length('0', $max),
                    new HTMLPurifier_AttrDef_Enum(array('auto'))
                )),
                // For everyone else:
                $trusted_wh
            );

        $this->info['text-decoration'] = new HTMLPurifier_AttrDef_CSS_TextDecoration();

        $this->info['font-family'] = new HTMLPurifier_AttrDef_CSS_FontFamily();

        // this could use specialized code
        $this->info['font-weight'] = new HTMLPurifier_AttrDef_Enum(
            array('normal', 'bold', 'bolder', 'lighter', '100', '200', '300',
            '400', '500', '600', '700', '800', '900'), false);

        // MUST be called after other font properties, as it references
        // a CSSDefinition object
        $this->info['font'] = new HTMLPurifier_AttrDef_CSS_Font($config);

        // same here
        $this->info['border'] =
        $this->info['border-bottom'] =
        $this->info['border-top'] =
        $this->info['border-left'] =
        $this->info['border-right'] = new HTMLPurifier_AttrDef_CSS_Border($config);

        $this->info['border-collapse'] = new HTMLPurifier_AttrDef_Enum(array(
            'collapse', 'separate'));

        $this->info['caption-side'] = new HTMLPurifier_AttrDef_Enum(array(
            'top', 'bottom'));

        $this->info['table-layout'] = new HTMLPurifier_AttrDef_Enum(array(
            'auto', 'fixed'));

        $this->info['vertical-align'] = new HTMLPurifier_AttrDef_CSS_Composite(array(
            new HTMLPurifier_AttrDef_Enum(array('baseline', 'sub', 'super',
                'top', 'text-top', 'middle', 'bottom', 'text-bottom')),
            new HTMLPurifier_AttrDef_CSS_Length(),
            new HTMLPurifier_AttrDef_CSS_Percentage()
        ));

        $this->info['border-spacing'] = new HTMLPurifier_AttrDef_CSS_Multiple(new HTMLPurifier_AttrDef_CSS_Length(), 2);

        // partial support
        $this->info['white-space'] = new HTMLPurifier_AttrDef_Enum(array('nowrap'));

        if ($config->get('CSS.Proprietary')) {
            $this->doSetupProprietary($config);
        }

        if ($config->get('CSS.AllowTricky')) {
            $this->doSetupTricky($config);
        }

        $allow_important = $config->get('CSS.AllowImportant');
        // wrap all attr-defs with decorator that handles !important
        foreach ($this->info as $k => $v) {
            $this->info[$k] = new HTMLPurifier_AttrDef_CSS_ImportantDecorator($v, $allow_important);
        }

        $this->setupConfigStuff($config);
    }