forked from kylephillips/favorites
-
Notifications
You must be signed in to change notification settings - Fork 0
/
favorites.php
58 lines (48 loc) · 2 KB
/
favorites.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
<?php
/*
Plugin Name: Favorites
Plugin URI: http://favoriteposts.com
Description: Simple and flexible favorite buttons for any post type.
Version: 2.3.2
Author: Kyle Phillips
Author URI: https://github.com/kylephillips
Text Domain: favorites
Domain Path: /languages/
License: GPLv2 or later.
Copyright: Kyle Phillips
*/
/* Copyright 2021 Kyle Phillips
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
*/
/**
* Check Wordpress and PHP versions before instantiating plugin
*/
register_activation_hook( __FILE__, 'favorites_check_versions' );
define( 'FAVORITES_PLUGIN_FILE', __FILE__ );
function favorites_check_versions( $wp = '3.9', $php = '5.3.2' ) {
global $wp_version;
if ( version_compare( PHP_VERSION, $php, '<' ) ) $flag = 'PHP';
elseif ( version_compare( $wp_version, $wp, '<' ) ) $flag = 'WordPress';
else return;
$version = 'PHP' == $flag ? $php : $wp;
if (function_exists('deactivate_plugins')){
deactivate_plugins( basename( __FILE__ ) );
}
wp_die('<p>The <strong>Favorites</strong> plugin requires'.$flag.' version '.$version.' or greater.</p>','Plugin Activation Error', array( 'response'=>200, 'back_link'=>TRUE ) );
}
if( !class_exists('Bootstrap') ) :
favorites_check_versions();
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/app/Favorites.php');
require_once(__DIR__ . '/app/API/functions.php');
Favorites::init();
endif;