Skip to content

Commit

Permalink
Escape dash literals in regex patterns for php 7.3 usage
Browse files Browse the repository at this point in the history
  • Loading branch information
HammenWS committed Sep 23, 2019
1 parent 6b6bc80 commit fc9841f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Simply Static

Simply Static is a static site generator for WordPress that helps you create a static site that you can serve separately from your WordPress installation.

This repository is a fork of version 2.1.0 of the Simply Static plugin found in the WordPress Subversion repository.

## Why did we fork the plugin

The original plugin is not compatible with PHP 7.3. This fork will support it.
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ protected function parse_selector($selector_string) {
// This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression.
// farther study is required to determine of this should be documented or removed.
// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
$pattern = "/([\w\-:\*]*)(?:\#([\w\-]+)|\.([\w\-]+))?(?:\[@?(!?[\w\-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
if (is_object($debugObject)) {$debugObject->debugLog(2, "Matches Array: ", $matches);}

Expand Down Expand Up @@ -1375,7 +1375,7 @@ protected function read_tag()
return true;
}

if (!preg_match("/^[\w-:]+$/", $tag)) {
if (!preg_match("/^[\w\-:]+$/", $tag)) {
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
if ($this->char==='<') {
$this->link_nodes($node, false);
Expand Down
2 changes: 1 addition & 1 deletion simply-static.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Plugin Name: Simply Static
* Plugin URI: http://simplystatic.co/
* Description: Produces a static HTML version of your WordPress install and adjusts URLs accordingly.
* Version: 2.1.0
* Version: 3.0.0
* Author: Code of Conduct LLC
* Author URI: http://codeofconduct.co/
* License: GPL-2.0+
Expand Down

0 comments on commit fc9841f

Please sign in to comment.