From 4d62124a03d883786b1d1a66dcc9e879996d6035 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sun, 3 May 2020 10:13:11 +0200 Subject: [PATCH] PHP7 constructor syntax --- owark.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/owark.php b/owark.php index 80a5c54..6378fc6 100644 --- a/owark.php +++ b/owark.php @@ -43,7 +43,7 @@ if (!class_exists("Owark")) { * * */ - function Owark() { + public function __construct() { if (is_admin()) { @@ -75,6 +75,14 @@ if (!class_exists("Owark")) { } + function Owark() + { + // PHP4-style constructor. + // This will NOT be invoked, unless a sub-class that extends `foo` calls it. + // In that case, call the new-style constructor to keep compatibility. + self::__construct(); + } + /** * Check we have everything we need... * @@ -548,7 +556,7 @@ if (!class_exists("Owark")) { $output = array(); $status = 0; - exec("wget -t3 -E -H -k -K -p -nd -nv --timeout=60 --user-agent=\"Mozilla/5.0 (compatible; owark/0.1; http://owark.org/)\" -P $path {$url->final_url}", + exec("wget -t3 -E -H -k -K -p -nd -nv --timeout=60 --user-agent=\"Mozilla/5.0 (compatible; owark/0.2; http://owark.org/)\" -P $path {$url->final_url}", $output, $status); $q = $wpdb->insert("{$wpdb->prefix}owark", array(