Removing "&" in function calls by reference (support of PHP 5.6+)

This commit is contained in:
Eric van der Vlist 2020-05-02 16:43:41 +02:00
parent 21807536ca
commit 885867e065
1 changed files with 16 additions and 15 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright 2011 Eric van der Vlist (vdv@dyomedea.com) /* Copyright 2011-2020 Eric van der Vlist (vdv@dyomedea.com)
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as it under the terms of the GNU General Public License, version 2, as
@ -19,7 +19,7 @@
Plugin Name: owark Plugin Name: owark
Plugin URI: http://owark.org Plugin URI: http://owark.org
Description: Tired of broken links? Archive yours with owark, the Open Web Archive! Description: Tired of broken links? Archive yours with owark, the Open Web Archive!
Version: 0.1 Version: 0.2
Author: Eric van der Vlist Author: Eric van der Vlist
Author URI: http://eric.van-der-vlist.com Author URI: http://eric.van-der-vlist.com
License: GLP2 License: GLP2
@ -67,7 +67,7 @@ if (!class_exists("Owark")) {
add_filter ( 'comment_text', array($this, 'comment_filter')); add_filter ( 'comment_text', array($this, 'comment_filter'));
add_filter ( 'get_comment_author_link', array($this, 'comment_filter')); add_filter ( 'get_comment_author_link', array($this, 'comment_filter'));
add_action('owark_schedule_event', array(Owark, 'schedule')); add_action('owark_schedule_event', array('Owark', 'schedule'));
if ( !wp_next_scheduled( 'owark_schedule_event', array('occurrences' => 30) ) ) { if ( !wp_next_scheduled( 'owark_schedule_event', array('occurrences' => 30) ) ) {
wp_schedule_event(time(), 'hourly', 'owark_schedule_event', array('occurrences' => 30)); wp_schedule_event(time(), 'hourly', 'owark_schedule_event', array('occurrences' => 30));
} }
@ -149,17 +149,18 @@ if (!class_exists("Owark")) {
// Check that wget is installed // Check that wget is installed
$output = array(); $output = array();
exec('/usr/bin/wget -V', &$output); exec('/usr/bin/wget -V', $output);
if ( empty($output) ) { if ( empty($output) ) {
$this->notices = $this->notices . "<div class=\"error fade\"><p><strong>The Open Web Archives is not able to run wget and retrieve the pages to archive. Please check that wget is installed and on the default path.</strong></p></div>"; $this->notices = $this->notices .
"<div class=\"error fade\"><p><strong>The Open Web Archives is not able to run GNU wget and retrieve the pages to archive. Please check that wget is installed and on the default path.</strong></p></div>";
} }
// We need as least version 1.11 or higher // We need as least version 1.11 or higher
$helper = preg_match('/GNU Wget ([0-9\.]+) /', $output[0], $wget_version); $helper = preg_match('/GNU Wget ([0-9\.]+) /', $output[0], $wget_version);
if ( $wget_version[1] < '1.11' ) { if ( $wget_version[0] < '1.11' ) {
$this->notices = $this->notices . "<div class=\"error fade\"><p><strong>The Open Web Archives needs wget version 1.11 or higher.</strong><br />Version read: {$wget_version[0]}</p></div>"; $this->notices = $this->notices . "<div class=\"error fade\"><p><strong>The Open Web Archives needs GNU wget version 1.11 or higher.</strong><br />Version read: {$wget_version[0]}</p></div>";
} }
if ($this->notices != '') { if ($this->notices != '') {
@ -480,7 +481,7 @@ if (!class_exists("Owark")) {
$matches = NULL; $matches = NULL;
// <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1"/> // <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1"/>
if (preg_match('/<meta\s*http-equiv\s*=\s*["\']Content-Type["\']\s+content\s*=\s*["\'][^"\'>]*charset\s*=\s*([^"\'>]+)\s*["\']/si', if (preg_match('/<meta\s*http-equiv\s*=\s*["\']Content-Type["\']\s+content\s*=\s*["\'][^"\'>]*charset\s*=\s*([^"\'>]+)\s*["\']/si',
$content, &$matches) > 0) { $content, $matches) > 0) {
$encoding = $matches[1]; $encoding = $matches[1];
} else { } else {
$encoding = mb_detect_encoding($content); $encoding = mb_detect_encoding($content);
@ -548,7 +549,7 @@ if (!class_exists("Owark")) {
$output = array(); $output = array();
$status = 0; $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.1; http://owark.org/)\" -P $path {$url->final_url}",
&$output, &$status); $output, $status);
$q = $wpdb->insert("{$wpdb->prefix}owark", array( $q = $wpdb->insert("{$wpdb->prefix}owark", array(
'url' => $url->final_url, 'url' => $url->final_url,