| 1 |
<?php |
| 2 |
|
| 3 |
function xyz_ips_network_install($networkwide) { |
| 4 |
global $wpdb; |
| 5 |
|
| 6 |
if (function_exists('is_multisite') && is_multisite()) { |
| 7 |
// check if it is a network activation - if so, run the activation function for each blog id |
| 8 |
if ($networkwide) { |
| 9 |
$old_blog = $wpdb->blogid; |
| 10 |
// Get all blog ids |
| 11 |
$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
| 12 |
foreach ($blogids as $blog_id) { |
| 13 |
switch_to_blog($blog_id); |
| 14 |
xyz_ips_install(); |
| 15 |
} |
| 16 |
switch_to_blog($old_blog); |
| 17 |
return; |
| 18 |
} |
| 19 |
} |
| 20 |
xyz_ips_install(); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
function xyz_ips_install(){ |
| 25 |
|
| 26 |
global $wpdb; |
| 27 |
//global $current_user; get_currentuserinfo(); |
| 28 |
|
| 29 |
|
| 30 |
if(get_option('xyz_credit_link') == "") |
| 31 |
{ |
| 32 |
add_option("xyz_credit_link",0); |
| 33 |
} |
| 34 |
|
| 35 |
add_option('xyz_ips_limit',20); |
| 36 |
$queryInsertPhp = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ips_short_code ( |
| 37 |
`id` int NOT NULL AUTO_INCREMENT, |
| 38 |
`title` varchar(1000) COLLATE utf8_unicode_ci NOT NULL, |
| 39 |
`content` longtext COLLATE utf8_unicode_ci NOT NULL, |
| 40 |
`short_code` varchar(2000) COLLATE utf8_unicode_ci NOT NULL, |
| 41 |
`status` int NOT NULL, |
| 42 |
PRIMARY KEY (`id`) |
| 43 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1"; |
| 44 |
$wpdb->query($queryInsertPhp); |
| 45 |
} |
| 46 |
|
| 47 |
register_activation_hook( XYZ_INSERT_PHP_PLUGIN_FILE ,'xyz_ips_network_install'); |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|