-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-update.php
More file actions
94 lines (81 loc) · 2.13 KB
/
auto-update.php
File metadata and controls
94 lines (81 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Plugin Name: Auto Update
* Plugin URI: https://stylishwp.com
* Description: Keeps WordPress core, plugins, and themes updated automatically to reduce manual maintenance and improve security.
* Text Domain: auto-update
* Domain Path: /languages
* Version: 1.0.2
* Requires at least: 5.8
* Requires PHP: 7.4
* Author: Valeriu Tihai
* Author URI: http://valeriu.tihai.ca
* Contributors: valeriutihai
* Donate link: https://paypal.me/valeriu/5
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
* @package Auto_Update
*/
defined( 'ABSPATH' ) || die( 'Plugin file cannot be accessed directly.' );
// No direct access.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Main Class - AutoUpdate
*
* @package Auto_Update
*
* @since 1.0.0
*/
class AutoUpdate {
/**
* Constructor
*
* @since 1.0.0
* @access public
*/
public function __construct() {
// Enable update filters.
add_action( 'plugins_loaded', array( &$this, 'autoupdate_filters' ), 1 );
// Add the support link.
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( &$this, 'autoupdate_links' ), 1 );
}
/**
* Update function
*
* Update all themes, plugins and WordPress core (minor and major version).
*
* @since 1.0.0
* @access public
*
* @return void
*/
public function autoupdate_filters() {
// Enable major version updates.
add_filter( 'allow_major_auto_core_updates', '__return_true', 1 );
// Enable minor version updates.
add_filter( 'allow_minor_auto_core_updates', '__return_true', 1 );
// Enable plugin updates.
add_filter( 'auto_update_plugin', '__return_true', 1 );
// Enable theme updates.
add_filter( 'auto_update_theme', '__return_true', 1 );
}
/**
* Add settings links to plugin page.
*
* @param array $links The plugin action links.
*
* @since 1.0.0
* @access public
*
* @return array
*/
public function autoupdate_links( $links ) {
$links[] = '<a href="https://wordpress.org/support/plugin/auto-update" target="_blank">' . __( 'Support', 'auto-update' ) . '</a>';
return $links;
}
}
// Instantiate the main class.
new AutoUpdate();