first commit
This commit is contained in:
11
wp-content/plugins/brizy/parser/dom-node.php
Normal file
11
wp-content/plugins/brizy/parser/dom-node.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Parser_DomNode extends pQuery\DomNode {
|
||||
/**
|
||||
* Similar to JavaScript innerText, will return (html formatted) content
|
||||
* @return string
|
||||
*/
|
||||
function getInnerText() {
|
||||
return $this->toString( true, true, 1 );
|
||||
}
|
||||
}
|
||||
17
wp-content/plugins/brizy/parser/pquery.php
Normal file
17
wp-content/plugins/brizy/parser/pquery.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class Brizy_Parser_Pquery extends pQuery {
|
||||
|
||||
/**
|
||||
* Query a string of html.
|
||||
*
|
||||
* @param string $html
|
||||
*
|
||||
* @return pQuery\DomNode Returns the root dom node for the html string.
|
||||
*/
|
||||
public static function parseStr( $html ) {
|
||||
$parser = new pQuery\Html5Parser( $html, 0, new Brizy_Parser_DomNode( '~root~', null ) );
|
||||
|
||||
return $parser->root;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user