-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathapple-news.php
60 lines (53 loc) · 1.57 KB
/
apple-news.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
<?php
/**
* Entry point for the plugin.
*
* This file is read by WordPress to generate the plugin information in the
* admin panel.
*
* @link http://beezwax.net
* @since 0.2.0
* @package WP_Plugin
*
* Plugin Name: Apple News
* Plugin URI: http://github.com/alleyinteractive/apple-news
* Description: Export and sync posts to Apple format.
* Version: 0.9.0
* Author: Beezwax, Alley Interactive
* Author URI: http://beezwax.net, http://alleyinteractive.com
* Text Domain: apple-news
* Domain Path: lang/
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Activate the plugin.
*/
function activate_wp_plugin() {
// Check for PHP version
if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) {
deactivate_plugins( basename( __FILE__ ) );
wp_die( __( 'This plugin requires at least PHP 5.3.0', 'apple-news' ) );
}
}
require plugin_dir_path( __FILE__ ) . 'includes/exporter/class-settings.php';
/**
* Deactivate the plugin.
*/
function deactivate_wp_plugin() {
// Do something
$settings = new Exporter\Settings;
foreach ( $settings->all() as $name => $value ) {
delete_option( $name );
}
}
// WordPress VIP plugins do not execute these hooks, so ignore in that environment.
if ( ! defined( 'WPCOM_IS_VIP_ENV' ) || ! WPCOM_IS_VIP_ENV ) {
register_activation_hook( __FILE__, 'activate_wp_plugin' );
register_deactivation_hook( __FILE__, 'deactivate_wp_plugin' );
}
// Initialize plugin class
require plugin_dir_path( __FILE__ ) . 'includes/class-apple-news.php';
require plugin_dir_path( __FILE__ ) . 'admin/class-admin-apple-news.php';
new Admin_Apple_News();