PluginProbe
Insert Html Snippet / trunk
Insert Html Snippet vtrunk
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
← All changes | admin/install.php +39 -1 1.3.5trunk View file →
@@ -27,10 +27,19 @@
27 27 global $wpdb;
28 28
29 29 $pluginName = 'xyz-wp-insert-code-snippet/xyz-wp-insert-code-snippet.php';
30 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>." );
31 + wp_die( "The plugin Insert HTML Snippet cannot be activated unless the premium version of this plugin is deactivated. Back to <a href='".esc_url(admin_url())."plugins.php'>Plugin Installation</a>." );
32 32 }
33 + if ( version_compare( PHP_VERSION, '7.0.0', '<' ) ) {
34 + wp_die(
35 + sprintf(
36 + 'This plugin requires PHP version 7.0 or higher. You are using PHP %s. <a href="%s">Go back to Plugins page</a>.',
37 + PHP_VERSION,
38 + esc_url( admin_url( 'plugins.php' ) )
39 + )
40 + );
41 +}
33 42 if(get_option('xyz_ihs_sort_order')=='')
34 43 {
35 44 add_option('xyz_ihs_sort_order','desc');
36 45 }
@@ -59,8 +68,9 @@
59 68 add_option('xyz_ihs_premium_version_ads',1);
60 69 }
61 70
62 71 add_option('xyz_ihs_limit',20);
72 + add_option('xyz_ihs_exec_in_editor','0');
63 73
64 74
65 75 $charset_collate = $wpdb->get_charset_collate();
66 76 $queryInsertHtml = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ihs_short_code (
@@ -65,8 +75,9 @@
65 75 $charset_collate = $wpdb->get_charset_collate();
66 76 $queryInsertHtml = "CREATE TABLE IF NOT EXISTS ".$wpdb->prefix."xyz_ihs_short_code (
67 77 `id` int NOT NULL AUTO_INCREMENT,
68 78 `title` varchar(1000) NOT NULL,
79 + `description` TEXT NULL ,
69 80 `content` longtext NOT NULL,
70 81 `short_code` varchar(2000) NOT NULL,
71 82 `status` int NOT NULL,
72 83 PRIMARY KEY (`id`)
@@ -71,7 +82,34 @@
71 82 `status` int NOT NULL,
72 83 PRIMARY KEY (`id`)
73 84 )ENGINE=InnoDB ".$charset_collate." AUTO_INCREMENT=1";
74 85 $wpdb->query($queryInsertHtml);
86 + $tblcolums = $wpdb->get_col("SHOW COLUMNS FROM ".$wpdb->prefix."xyz_ihs_short_code");
87 + if(!(in_array("insertionMethod", $tblcolums)))
88 + $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD insertionMethod int NOT NULL default 2");
89 + if(!(in_array("insertionLocation", $tblcolums)))
90 + $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD insertionLocation int NOT NULL default 0");
91 + if(!(in_array("insertionLocationType", $tblcolums)))
92 + $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD insertionLocationType int NOT NULL default 0");
93 + if(!(in_array("description", $tblcolums)))
94 + $wpdb->query("ALTER TABLE ".$wpdb->prefix."xyz_ihs_short_code ADD description TEXT NULL ");
95 + $table_name = $wpdb->prefix . 'xyz_ihs_usage';
96 + $charset_collate = $wpdb->get_charset_collate();
97 + $sql = "CREATE TABLE {$table_name} (
98 + post_id BIGINT(20) UNSIGNED NOT NULL,
99 + snippet_id BIGINT(20) UNSIGNED NOT NULL,
100 + post_type VARCHAR(20) NOT NULL,
101 + PRIMARY KEY (post_id, snippet_id),
102 + KEY post_id (post_id),
103 + KEY snippet_id (snippet_id)
104 + ) {$charset_collate};";
105 + require_once ABSPATH . 'wp-admin/includes/upgrade.php';
106 + dbDelta($sql);
107 + // Set sync flag only if not already set
108 + if (get_option('xyz_ihs_sync_needed') === false) {
109 + add_option('xyz_ihs_sync_needed', 1);
110 + }
111 + //Show Snippet Usage Details
112 + add_option('xyz_ihs_show_snippet_usage',1);//default enable
75 113 }
76 114
77 115 register_activation_hook( XYZ_INSERT_HTML_PLUGIN_FILE ,'xyz_ihs_network_install');