Microweber\Utils\Parser::isolate_content_field PHP Метод

isolate_content_field() публичный Метод

public isolate_content_field ( $l, $strict = false )
    public function isolate_content_field($l, $strict = false)
    {
        require_once __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'phpQuery.php';
        $pq = \phpQuery::newDocument($l);
        $found = false;
        foreach ($pq['[data-mw=main]'] as $elem) {
            if ($found == false) {
                $l = pq($elem)->htmlOuter();
                $found = true;
            }
        }
        if ($found == false) {
            foreach ($pq['[field=content]'] as $elem) {
                $l = pq($elem)->htmlOuter();
                $found = true;
            }
        }
        if ($found == false) {
            foreach ($pq['[field=content_body]'] as $elem) {
                $l = pq($elem)->htmlOuter();
                $found = true;
            }
        }
        if ($strict == true and $found == false) {
            return false;
        }
        return $l;
    }