| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Website: http://sourceforge.net/projects/simplehtmldom/ | |
| 4 | - * Additional projects that may be used: http://sourceforge.net/projects/debugobject/ | |
| 3 | + * Website: https://sourceforge.net/projects/simplehtmldom/ | |
| 4 | + * Additional projects that may be used: https://sourceforge.net/projects/debugobject/ | |
| 5 | 5 | * Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/) |
| 6 | 6 | * Contributions by: |
| 7 | 7 | * Yousuke Kumakura (Attribute filters) |
| 8 | 8 | * Vadim Voituk (Negative indexes supports of "find" method) |
| @@ -685,9 +685,10 @@ | ||
| 685 | 685 | // Notice the \[ starting the attbute? and the @? following? This implies that an attribute can begin with an @ sign that is not captured. |
| 686 | 686 | // This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression. |
| 687 | 687 | // farther study is required to determine of this should be documented or removed. |
| 688 | 688 | // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; |
| 689 | - $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; | |
| 689 | +// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; | |
| 690 | + $pattern = "/([\w\-:\*]*)(?:\#([\w\-]+)|\.([\w\-]+))?(?:\[@?(!?[\w\-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; | |
| 690 | 691 | preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); |
| 691 | 692 | if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);} |
| 692 | 693 | |
| 693 | 694 | $selectors = array(); |
| @@ -1063,9 +1064,9 @@ | ||
| 1063 | 1064 | // strip out cdata |
| 1064 | 1065 | $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true); |
| 1065 | 1066 | // strip out comments |
| 1066 | 1067 | $this->remove_noise("'<!--(.*?)-->'is"); |
| 1067 | - // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 | |
| 1068 | + // Per sourceforge https://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 | |
| 1068 | 1069 | // Script tags removal now preceeds style tag removal. |
| 1069 | 1070 | // strip out <script> tags |
| 1070 | 1071 | $this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is"); |
| 1071 | 1072 | $this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is"); |
| @@ -1381,9 +1382,11 @@ | ||
| 1381 | 1382 | $this->char = $this->doc[--$this->pos]; // prev |
| 1382 | 1383 | return true; |
| 1383 | 1384 | } |
| 1384 | 1385 | |
| 1385 | - if (!preg_match("/^[\w-:]+$/", $tag)) { | |
| 1386 | +// /^[\w-:]+$/ | |
| 1387 | + | |
| 1388 | + if (!preg_match("/^[\w\-:]+$/", $tag)) { | |
| 1386 | 1389 | $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>'); |
| 1387 | 1390 | if ($this->char==='<') { |
| 1388 | 1391 | $this->link_nodes($node, false); |
| 1389 | 1392 | return true; |
| @@ -1502,9 +1505,9 @@ | ||
| 1502 | 1505 | |
| 1503 | 1506 | // parse attributes |
| 1504 | 1507 | protected function parse_attr($node, $name, &$space) |
| 1505 | 1508 | { |
| 1506 | - // Per sourceforge: http://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037 | |
| 1509 | + // Per sourceforge: https://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037 | |
| 1507 | 1510 | // If the attribute is already defined inside a tag, only pay atetntion to the first one as opposed to the last one. |
| 1508 | 1511 | if (isset($node->attr[$name])) |
| 1509 | 1512 | { |
| 1510 | 1513 | return; |
| @@ -1738,5 +1741,5 @@ | ||
| 1738 | 1741 | function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);} |
| 1739 | 1742 | function loadFile() {$args = func_get_args();$this->load_file($args);} |
| 1740 | 1743 | } |
| 1741 | 1744 | |
| 1742 | -?> | |
| 1745 | +?> | |