-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.php
executable file
·53 lines (42 loc) · 1.33 KB
/
start.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
<?php
/*
Plugin Name: Political Profiler by ElectNext
Plugin URI: http://www.electnext.com/
Description: A plugin for automatically displaying profiles for U.S. politicians mentioned in posts.
Author: ElectNext
Version: 1.1
Author URI: http://www.electnext.com
License: GPLv2 or later
*/
require_once 'ElectNext.php';
add_action('wpmu_new_blog', 'electnext_activate_for_new_network_site');
register_activation_hook(__FILE__, 'electnext_activate');
load_plugin_textdomain('electnext', false, basename(dirname(__FILE__)) . '/languages/');
$electnext = new ElectNext();
$electnext->run();
function electnext_activate_for_new_network_site($blog_id) {
global $wpdb;
if (is_plugin_active_for_network(__FILE__)) {
$old_blog = $wpdb->blogid;
switch_to_blog($blog_id);
electnext_activate();
switch_to_blog($old_blog);
}
}
function electnext_activate() {
$status = electnext_activation_checks();
if (is_string($status)) {
electnext_cancel_activation($status);
}
return null;
}
function electnext_activation_checks() {
if (version_compare(get_bloginfo('version'), '3.0', '<')) {
return __('Political Profiler plugin not activated. You must have at least WordPress 3.0 to use it.', 'electnext');
}
return true;
}
function electnext_cancel_activation($message) {
deactivate_plugins(__FILE__);
wp_die($message);
}