PluginProbe
Page & Post Notes / 1.2.0
Page & Post Notes v1.2.0
trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5
page-post-notes / include / install.php

install.php in Page & Post Notes 1.2.0, at include/install.php

26 lines 916 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2 <?php
3
4 global $wpdb;
5 $charset_collate = $wpdb->get_charset_collate();
6 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); // Require to use dbDelta
7 include('settings.php'); // Load the files to get the databse info
8
9 // ==============================================================
10 // install the plugin for the first time
11 // ==============================================================
12
13 // Making sure the table we want to create don't exists
14 if( $wpdb->get_var("SHOW TABLES LIKE '{$table_name}' ") != $table_name ) {
15
16 $sql = "CREATE TABLE " . $table_name . "(
17 id INTEGER(11) UNSIGNED AUTO_INCREMENT,
18 page_post_id INTEGER(11),
19 notes TEXT,
20 PRIMARY KEY (id)
21 ) $charset_collate;";
22
23 dbDelta($sql);
24
25 } // if( $wpdb->get_var("SHOW TABLES LIKE '{$table_name}' ") != $table_name ) {
26