示例#1
0
    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__, 'simple_favorites_check_versions');
define('FAVORITES_PLUGIN_FILE', __FILE__);
function simple_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')) {
    simple_favorites_check_versions();
    require_once __DIR__ . '/vendor/autoload.php';
    require_once __DIR__ . '/app/SimpleFavorites.php';
    require_once __DIR__ . '/app/API/functions.php';
    SimpleFavorites::init();
}