Skip to content

Commit a744911

Browse files
authored
update to php7.3
Reference sunra#83
1 parent fa1052a commit a744911

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

Src/Sunra/PhpSimple/simplehtmldom_1_5/simple_html_dom.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
// -----------------------------------------------------------------------------
7474
// get html dom from file
7575
// $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1.
76-
function file_get_html($url, $use_include_path = false, $context=null, $offset=0, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
76+
function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
7777
{
7878
// We DO force the tags to be terminated.
7979
$dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText);
@@ -693,7 +693,7 @@ protected function parse_selector($selector_string) {
693693
// This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression.
694694
// farther study is required to determine of this should be documented or removed.
695695
// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
696-
$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
696+
$pattern = "/([\w\-:\*]*)(?:\#([\w\-]+)|\.([\w\-]+))?(?:\[@?(!?[\w\-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
697697
preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
698698
if (is_object($debugObject)) {$debugObject->debugLog(2, "Matches Array: ", $matches);}
699699

@@ -821,11 +821,11 @@ function convert_text($text)
821821
}
822822

823823
/**
824-
* Returns true if $string is valid UTF-8 and false otherwise.
825-
*
826-
* @param mixed $str String to be tested
827-
* @return boolean
828-
*/
824+
* Returns true if $string is valid UTF-8 and false otherwise.
825+
*
826+
* @param mixed $str String to be tested
827+
* @return boolean
828+
*/
829829
static function is_utf8($str)
830830
{
831831
$c=0; $b=0;
@@ -899,9 +899,9 @@ function get_display_size()
899899
{
900900
// Thanks to user gnarf from stackoverflow for this regular expression.
901901
$attributes = array();
902-
preg_match_all("/([\w-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER);
902+
preg_match_all("/([\w\-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER);
903903
foreach ($matches as $match) {
904-
$attributes[$match[1]] = $match[2];
904+
$attributes[$match[1]] = $match[2];
905905
}
906906

907907
// If there is a width in the style attributes:
@@ -947,13 +947,13 @@ function get_display_size()
947947
// If the class or id is specified in a SEPARATE css file thats not on the page, go get it and do what we were just doing for the ones on the page.
948948

949949
$result = array('height' => $height,
950-
'width' => $width);
950+
'width' => $width);
951951
return $result;
952952
}
953953

954954
// camel naming conventions
955-
function getAllAttributes() {return array_map('html_entity_decode', $this->attr);}
956-
function getAttribute($name) {return html_entity_decode($this->__get($name));}
955+
function getAllAttributes() {return $this->attr;}
956+
function getAttribute($name) {return $this->__get($name);}
957957
function setAttribute($name, $value) {$this->__set($name, $value);}
958958
function hasAttribute($name) {return $this->__isset($name);}
959959
function removeAttribute($name) {$this->__set($name, null);}
@@ -1023,7 +1023,7 @@ class simple_html_dom
10231023
'p'=>array('p'=>1),
10241024
'nobr'=>array('nobr'=>1),
10251025
'b'=>array('b'=>1),
1026-
'option'=>array('option'=>1),
1026+
'option'=>array('option'=>1),
10271027
);
10281028

10291029
function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT)
@@ -1245,7 +1245,7 @@ protected function parse_charset()
12451245
if (empty($charset))
12461246
{
12471247
// Have php try to detect the encoding from the text given to us.
1248-
$charset = (function_exists('mb_detect_encoding')) ? mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ) : false;
1248+
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
12491249
if (is_object($debugObject)) {$debugObject->debugLog(2, 'mb_detect found: ' . $charset);}
12501250

12511251
// and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...
@@ -1375,7 +1375,7 @@ protected function read_tag()
13751375
return true;
13761376
}
13771377

1378-
if (!preg_match("/^[\w-:]+$/", $tag)) {
1378+
if (!preg_match("/^[\w\-:]+$/", $tag)) {
13791379
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
13801380
if ($this->char==='<') {
13811381
$this->link_nodes($node, false);

0 commit comments

Comments
 (0)