PluginProbe
Statify / 1.4.1
Statify v1.4.1
2.0.2 2.0.1 trunk 0.7 0.8 0.9 1.0 1.2.8 1.3.0 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 All 32 releases
statify / inc / statify_install.class.php

statify_install.class.php in Statify 1.4.1, at inc/statify_install.class.php

108 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 /* Quit */
5 defined('ABSPATH') OR exit;
6
7
8 /**
9 * Statify_Install
10 *
11 * @since 0.1
12 */
13
14 class Statify_Install
15 {
16
17
18 /**
19 * Installation auch für MU-Blog
20 *
21 * @since 0.1.0
22 * @change 0.1.0
23 *
24 * @param integer ID des Blogs [optional]
25 */
26
27 public static function init($id)
28 {
29 /* Global */
30 global $wpdb;
31
32 /* Neuer MU-Blog */
33 if ( ! empty($id) ) {
34 /* Im Netzwerk? */
35 if ( ! is_plugin_active_for_network(STATIFY_BASE) ) {
36 return;
37 }
38
39 /* Wechsel */
40 switch_to_blog( (int)$id );
41
42 /* Installieren */
43 self::_apply();
44
45 /* Wechsel zurück */
46 restore_current_blog();
47
48 /* Raus */
49 return;
50 }
51
52 /* Multisite & Network */
53 if ( is_multisite() && ! empty($_GET['networkwide']) ) {
54 /* Blog-IDs */
55 $ids = $wpdb->get_col("SELECT blog_id FROM `$wpdb->blogs`");
56
57 /* Loopen */
58 foreach ($ids as $id) {
59 switch_to_blog($id);
60 self::_apply();
61 }
62
63 /* Wechsel zurück */
64 restore_current_blog();
65
66 /* Raus */
67 return;
68 }
69
70 /* Single-Blog */
71 self::_apply();
72 }
73
74
75 /**
76 * Anlegen der Daten
77 *
78 * @since 0.1.0
79 * @change 1.4.0
80 */
81
82 private static function _apply()
83 {
84 /* Options */
85 add_option(
86 'statify',
87 array()
88 );
89
90 /* Transients */
91 delete_transient('statify_data');
92
93 /* Cron */
94 if ( ! wp_next_scheduled('statify_cleanup') ) {
95 wp_schedule_event(
96 time(),
97 'daily',
98 'statify_cleanup'
99 );
100 }
101
102 /* Tabelle setzen */
103 Statify_Table::init();
104
105 /* Tabelle anlegen */
106 Statify_Table::create();
107 }
108 }