PluginProbe
Insert Html Snippet / 1.4.1
Insert Html Snippet v1.4.1
1.4.6 trunk 1.0 1.0.1 1.1 1.1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.4 1.4.1 1.4.2 1.4.3 All 27 releases
insert-html-snippet / admin / install.php

install.php in Insert Html Snippet 1.4.1, at admin/install.php

86 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) )
3 exit;
4 function xyz_ihs_network_install($networkwide) {
5 global $wpdb;
6
7 if (function_exists('is_multisite') && is_multisite()) {
8 // check if it is a network activation - if so, run the activation function for each blog id
9 if ($networkwide) {
10 $old_blog = $wpdb->blogid;
11 // Get all blog ids
12 $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
13 foreach ($blogids as $blog_id) {
14 switch_to_blog($blog_id);
15 xyz_ihs_install();
16 }
17 switch_to_blog($old_blog);
18 return;
19 }
20 }
21 xyz_ihs_install();
22 }
23
24
25 function xyz_ihs_install(){
26
27 global $wpdb;
28
29 $pluginName = 'xyz-wp-insert-code-snippet/xyz-wp-insert-code-snippet.php';
30 if (is_plugin_active($pluginName)) {
31 wp_die( "The plugin Insert HTML Snippet cannot be activated unless the premium version of this plugin is deactivated. Back to <a href='".admin_url()."plugins.php'>Plugin Installation</a>." );
32 }
33 if(get_option('xyz_ihs_sort_order')=='')
34 {
35 add_option('xyz_ihs_sort_order','desc');
36 }
37 if(get_option('xyz_ihs_sort_field_name')=='')
38 {
39 add_option('xyz_ihs_sort_field_name','id');
40 }
41
42 $xyz_ihs_installed_date = get_option('xyz_ihs_installed_date');
43 if ($xyz_ihs_installed_date=="") {
44 $xyz_ihs_installed_date = time();
45 update_option('xyz_ihs_installed_date', $xyz_ihs_installed_date);
46 }
47
48 if(get_option('xyz_credit_link') == "")
49 {
50 add_option("xyz_credit_link",0);
51 }
52
53 if(get_option('xyz_ihs_dismiss')=='')
54 {
55 add_option('xyz_ihs_dismiss',0);
56 }
57
58 if(get_option('xyz_ihs_premium_version_ads')==""){
59 add_option('xyz_ihs_premium_version_ads',1);
60 }
61
62 add_option('xyz_ihs_limit',20);
63 add_option('xyz_ihs_exec_in_editor','0');
64
65
66 $charset_collate = $wpdb->get_charset_collate();
67 $queryInsertHtml = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ihs_short_code (
68 `id` int NOT NULL AUTO_INCREMENT,
69 `title` varchar(1000) NOT NULL,
70 `content` longtext NOT NULL,
71 `short_code` varchar(2000) NOT NULL,
72 `status` int NOT NULL,
73 PRIMARY KEY (`id`)
74 )ENGINE=InnoDB ".$charset_collate." AUTO_INCREMENT=1";
75 $wpdb->query($queryInsertHtml);
76 $tblcolums = $wpdb->get_col("SHOW COLUMNS FROM ".$wpdb->prefix."xyz_ihs_short_code");
77 if(!(in_array("insertionMethod", $tblcolums)))
78 $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD insertionMethod int NOT NULL default 2");
79 if(!(in_array("insertionLocation", $tblcolums)))
80 $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD insertionLocation int NOT NULL default 0");
81 if(!(in_array("insertionLocationType", $tblcolums)))
82 $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD insertionLocationType int NOT NULL default 0");
83 }
84
85 register_activation_hook( XYZ_INSERT_HTML_PLUGIN_FILE ,'xyz_ihs_network_install');
86