-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
73 lines (52 loc) · 2.03 KB
/
index.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
<?php
/*
Plugin Name: WP Robocrop
Plugin URI: https://github.com/mcguffin/wp-robocrop
Description: Focus point based image cropping in WordPress
Author: Jörn Lund
Version: 1.2.7
Github Plugin URI: mcguffin/wp-robocrop
Requires WP: 4.8
Requires PHP: 5.6
Author URI: https://github.com/mcguffin/
License: GPL3
Text Domain: wp-robocrop
Domain Path: /languages/
Update URI: https://github.com/mcguffin/wp-robocrop/raw/master/.wp-release-info.json
*/
/* Copyright 2017 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
*/
/*
Plugin was generated by WP Plugin Scaffold
https://github.com/mcguffin/wp-plugin-scaffold
Command line args were: `"WP Robocrop" core+css+js admin+css+js settings:media gulp git --force`
*/
namespace Robocrop;
require_once __DIR__ . DIRECTORY_SEPARATOR . 'include/autoload.php';
Core\Core::instance( __FILE__ );
Core\MediaHelper::instance();
if ( is_admin() ) {
Settings\SettingsMedia::instance();
Admin\Admin::instance();
}
// 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 );