-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.php
More file actions
60 lines (45 loc) · 1.76 KB
/
index.php
File metadata and controls
60 lines (45 loc) · 1.76 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
<?php
/*
Plugin Name: ACF Customizer
Plugin URI: https://github.com/mcguffin/acf-customizer
Github Plugin URI: mcguffin/acf-customizer
Description: Use ACF Fields in customizer.
Author: Jörn Lund
Version: 0.3.2
Tested up to: 6.2
Requires PHP: 7.4
Author URI: https://github.com/mcguffin
License: GPL3
Text Domain: acf-customizer
Domain Path: /languages/
Update URI: https://github.com/mcguffin/acf-customizer/raw/master/.wp-release-info.json
*/
/* Copyright 2018 Jörn Lund
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
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
namespace ACFCustomizer;
if ( ! defined('ABSPATH') ) {
die('FU!');
}
require_once dirname(__FILE__) . '/include/autoload.php';
Core\Core::instance( __FILE__ );
// Enable WP auto update
add_filter( 'update_plugins_github.com', function( $update, $plugin_data, $plugin_file, $locales ) {
if ( ! preg_match( "@{$plugin_file}$@", __FILE__ ) ) { // not our plugin
return $update;
}
$response = wp_remote_get( $plugin_data['UpdateURI'] );
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) > 200 ) { // response error
return $update;
}
return json_decode( wp_remote_retrieve_body( $response ), true, 512 );
}, 10, 4 );