phpQuery::newDocumentHTML PHP Method

newDocumentHTML() public static method

Chainable.
public static newDocumentHTML ( unknown_type $markup = null, $charset = null ) : phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
$markup unknown_type
return phpQueryObject | QueryTemplatesSource | QueryTemplatesParse | QueryTemplatesSourceQuery
    public static function newDocumentHTML($markup = null, $charset = null)
    {
        $contentType = $charset ? ";charset={$charset}" : '';
        return self::newDocument($markup, "text/html{$contentType}");
    }

Usage Example

 public static function hyphenate($strBuffer)
 {
     global $objPage;
     $arrSkipPages = \Config::get('hyphenator_skipPages');
     if (is_array($arrSkipPages) && in_array($objPage->id, $arrSkipPages)) {
         return $strBuffer;
     }
     $o = new \Org\Heigl\Hyphenator\Options();
     $o->setHyphen(\Config::get('hyphenator_hyphen'))->setDefaultLocale(static::getLocaleFromLanguage($objPage->language))->setRightMin(\Config::get('hyphenator_rightMin'))->setLeftMin(\Config::get('hyphenator_leftMin'))->setWordMin(\Config::get('hyphenator_wordMin'))->setFilters(\Config::get('hyphenator_filter'))->setQuality(\Config::get('hyphenator_quality'))->setTokenizers(\Config::get('hyphenator_tokenizers'));
     $h = new \Org\Heigl\Hyphenator\Hyphenator();
     $h->setOptions($o);
     $doc = \phpQuery::newDocumentHTML($strBuffer);
     foreach (pq('body')->find(\Config::get('hyphenator_tags')) as $n => $item) {
         $strText = pq($item)->html();
         // ignore html tags, otherwise ­ will be added to links for example
         if ($strText != strip_tags($strText)) {
             continue;
         }
         $strText = str_replace('­', '', $strText);
         // remove manual ­ html entities before
         $strText = $h->hyphenate($strText);
         if (is_array($strText)) {
             $strText = current($strText);
         }
         pq($item)->html($strText);
     }
     return $doc->htmlOuter();
 }
All Usage Examples Of phpQuery::newDocumentHTML