docs/core/src/AKlump/LoftDocs/SearchHtml.php
public function getData($url = '')
    {
        $url = empty($url) ? $this->url : $url;
        $title = $tags = '';
        $contents = $this->html;

        if (preg_match('/(<h.+?>(.+?)<\/h.>)/si', $this->html, $matches)) {
            $title = $matches[2];

            // Pull out the meta data section.
            $tags = substr($contents, 0, strpos($contents, $matches[1]));
            $contents = substr($contents, strpos($contents, $matches[1]));

            // Remove the title from the contents.
            $contents = str_replace($matches[0], '', $contents);
        }

        if ($tags && preg_match('/tags\s*:(.*?)</si', $tags, $matches)) {
            $tags = explode(' ', $matches[1]);
        }
        else {
            $tags = array();
        }

        // Insert spaces for new lines to help format the strip_tags.
        $contents = implode(' ', explode(PHP_EOL, $contents));
        $contents = strip_tags($contents);

        return new SearchPageData($url, $title, $contents, $tags);
    }
public function getData($url = '')
    {
        $url = empty($url) ? $this->url : $url;
        $title = $tags = '';
        $contents = $this->html;

        if (preg_match('/(<h.+?>(.+?)<\/h.>)/si', $this->html, $matches)) {
            $title = $matches[2];

            // Pull out the meta data section.
            $tags = substr($contents, 0, strpos($contents, $matches[1]));
            $contents = substr($contents, strpos($contents, $matches[1]));

            // Remove the title from the contents.
            $contents = str_replace($matches[0], '', $contents);
        }

        if ($tags && preg_match('/tags\s*:(.*?)</si', $tags, $matches)) {
            $tags = explode(' ', $matches[1]);
        }
        else {
            $tags = array();
        }

        // Insert spaces for new lines to help format the strip_tags.
        $contents = implode(' ', explode(PHP_EOL, $contents));
        $contents = strip_tags($contents);

        return new SearchPageData($url, $title, $contents, $tags);
    }
public function getData ( $ url = '' ) { $ url = empty ( $ url ) ? $ this -> url : $ url ; $ title = $ tags = '' ; $ contents = $ this -> html ; if ( preg_match ( '/(<h.+?>(.+?)<\/h.>)/si' , $ this -> html , $ matches ) ) { $ title = $ matches [ 2 ] ; // Pull out the meta data section. $ tags = substr ( $ contents , 0 , strpos ( $ contents , $ matches [ 1 ] ) ) ; $ contents = substr ( $ contents , strpos ( $ contents , $ matches [ 1 ] ) ) ; // Remove the title from the contents. $ contents = str_replace ( $ matches [ 0 ] , '' , $ contents ) ; } if ( $ tags && preg_match ( '/tags\s*:(.*?)</si' , $ tags , $ matches ) ) { $ tags = explode ( ' ' , $ matches [ 1 ] ) ; } else { $ tags = array ( ) ; } // Insert spaces for new lines to help format the strip_tags. $ contents = implode ( ' ' , explode ( PHP_EOL , $ contents ) ) ; $ contents = strip_tags ( $ contents ) ; return new SearchPageData ( $ url , $ title , $ contents , $ tags ) ; }
Returns the parsed data from the html

@param  string $url This should be provided if you did not instantiate
with a file, if you did the url will be parsed from
that.  You may provide an url that would override a
parsed one to0.

@return SearchPageData
Returns the parsed data from the html