Reformating
This commit is contained in:
parent
0d4af6419a
commit
b7c70cfd10
34
owark.php
34
owark.php
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/* Copyright 2011-2020 Eric van der Vlist (vdv@dyomedea.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
@ -19,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
Plugin Name: owark
|
||||
Plugin URI: http://owark.org
|
||||
Description: Tired of broken links? Archive yours with owark, the Open Web Archive!
|
||||
Version: 0.2
|
||||
Version: 1.0
|
||||
Author: Eric van der Vlist
|
||||
Author URI: http://eric.van-der-vlist.com
|
||||
License: GLP2
|
||||
|
@ -29,6 +30,7 @@ License: GLP2
|
|||
Log
|
||||
*/
|
||||
if (!function_exists('print_r_log')) {
|
||||
|
||||
function print_r_log($log) {
|
||||
$caller_strace = debug_backtrace()[1];
|
||||
if (is_array($log) || is_object($log)) {
|
||||
|
@ -38,9 +40,11 @@ if ( ! function_exists('print_r_log')) {
|
|||
error_log($caller_strace['file'] . '/#' . $caller_strace['line'] . ': ' . $log);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('log_function_call')) {
|
||||
|
||||
function log_function_call() {
|
||||
$caller_strace = debug_backtrace()[1];
|
||||
error_log((isset($caller_strace['file']) ? $caller_strace['file'] : '<undefined>') . '/#' . (isset($caller_strace['line']) ? $caller_strace['line'] : '<undefined>') . ' function: ' . (isset($caller_strace['function']) ? $caller_strace['function'] : '<undefined>') . '(');
|
||||
|
@ -48,9 +52,11 @@ if ( ! function_exists('log_function_call')) {
|
|||
error_log(' * ' . gettype($arg) . ': ' . print_r($arg, true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('archives_dir')) {
|
||||
|
||||
function archives_dir() {
|
||||
if (defined('OWARK_ARCHIVES_REL_PATH')) {
|
||||
return WP_CONTENT_DIR . '/' . OWARK_ARCHIVES_REL_PATH;
|
||||
|
@ -58,9 +64,11 @@ if ( ! function_exists('archives_dir')) {
|
|||
return WP_PLUGIN_DIR . '/archives';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!function_exists('archives_url')) {
|
||||
|
||||
function archives_url() {
|
||||
if (defined('OWARK_ARCHIVES_REL_PATH')) {
|
||||
return WP_CONTENT_URL . '/' . OWARK_ARCHIVES_REL_PATH;
|
||||
|
@ -68,9 +76,11 @@ if ( ! function_exists('archives_url')) {
|
|||
return WP_PLUGIN_URL . '/archives';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!class_exists("Owark")) {
|
||||
|
||||
class Owark {
|
||||
|
||||
private $broken_links = array();
|
||||
|
@ -116,12 +126,9 @@ if (!class_exists("Owark")) {
|
|||
if (!wp_next_scheduled('owark_schedule_event', array('occurrences' => 30, 'version' => $this->version))) {
|
||||
wp_schedule_event(time(), 'hourly', 'owark_schedule_event', array('occurrences' => 30, 'version' => $this->version));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function 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.
|
||||
|
@ -173,7 +180,6 @@ if (!class_exists("Owark")) {
|
|||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
dbDelta($sql);
|
||||
update_option("owark_db_version", $this->db_version);
|
||||
|
||||
}
|
||||
|
||||
if ($update_required) {
|
||||
|
@ -224,7 +230,6 @@ if (!class_exists("Owark")) {
|
|||
$wpdb->query($sql);
|
||||
|
||||
$this->notices = "<div class=\"updated fade\"><p><strong>The owark table has been installed or upgraded to version {$this->db_version}</strong></p></div>";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,7 +295,6 @@ if (!class_exists("Owark")) {
|
|||
if ($this->notices != '') {
|
||||
add_action('admin_notices', array($this, 'admin_notices'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -304,7 +308,6 @@ if (!class_exists("Owark")) {
|
|||
function admin_notices() {
|
||||
|
||||
echo $this->notices;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -380,8 +383,6 @@ if (!class_exists("Owark")) {
|
|||
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -529,7 +530,6 @@ if (!class_exists("Owark")) {
|
|||
foreach ($results as $link) {
|
||||
$this->broken_links[$link->url] = $link->id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -560,7 +560,6 @@ if (!class_exists("Owark")) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display an archive page
|
||||
*
|
||||
|
@ -662,7 +661,6 @@ if (!class_exists("Owark")) {
|
|||
$f = fopen($file_location, "r");
|
||||
echo $content;
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -717,24 +715,16 @@ if (!class_exists("Owark")) {
|
|||
if ($occurrences > 0) {
|
||||
wp_schedule_single_event(time() + 90, 'owark_schedule_event', array('occurrences' => $occurrences - 1, 'version' => $version));
|
||||
}
|
||||
|
||||
}
|
||||
delete_option('owark_archiving');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (class_exists("Owark")) {
|
||||
$owark = new Owark();
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue