-
-
Notifications
You must be signed in to change notification settings - Fork 462
/
git-updater.php
75 lines (65 loc) · 1.95 KB
/
git-updater.php
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
<?php
/**
* Git Updater
*
* @author Andy Fragen
* @license MIT
* @link https://github.com/afragen/git-updater
* @package git-updater
*/
/**
* Plugin Name: Git Updater
* Plugin URI: https://git-updater.com
* Description: A plugin to automatically update GitHub hosted plugins, themes, and language packs. Additional API plugins available for Bitbucket, GitLab, Gitea, and Gist.
* Version: 12.6.0.5
* Author: Andy Fragen
* License: MIT
* Domain Path: /languages
* Text Domain: git-updater
* Network: true
* GitHub Plugin URI: https://github.com/afragen/git-updater
* GitHub Languages: https://github.com/afragen/git-updater-translations
* Requires at least: 5.9
* Requires PHP: 7.4
*/
namespace Fragen\Git_Updater;
use Fragen\Git_Updater\API\Zipfile_API;
use Fragen\Git_Updater\Additions\Additions;
/*
* Exit if called directly.
* PHP version check and exit.
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
// Load the Composer autoloader.
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
// Avoids a redeclaration error for move_dir() from Shim.php.
require_once ABSPATH . 'wp-admin/includes/file.php';
require __DIR__ . '/vendor/autoload.php';
}
// Check for composer autoloader.
if ( ! class_exists( 'Fragen\Git_Updater\Bootstrap' ) ) {
require_once __DIR__ . '/src/Git_Updater/Bootstrap.php';
( new Bootstrap( __FILE__ ) )->deactivate_die();
}
register_activation_hook( __FILE__, [ new Bootstrap( __FILE__ ), 'rename_on_activation' ] );
( new Zipfile_API() )->load_hooks();
add_action(
'plugins_loaded',
function () {
( new Bootstrap( __FILE__ ) )->run();
}
);
// Initiate Additions.
add_filter(
'gu_additions',
static function ( $listing, $repos, $type ) {
$config = get_site_option( 'git_updater_additions', [] );
$additions = new Additions();
$additions->register( $config, $repos, $type );
return $additions->add_to_git_updater;
},
10,
3
);