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_table.class.php

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

92 lines 1.3 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 Table
10 *
11 * @since 0.6
12 */
13
14 class Statify_Table
15 {
16
17
18 /**
19 * Definition der Tabelle
20 *
21 * @since 0.6.0
22 * @change 1.2.4
23 */
24
25 public static function init()
26 {
27 /* Global */
28 global $wpdb;
29
30 /* Name */
31 $table = 'statify';
32
33 /* Als Array */
34 $wpdb->tables[] = $table;
35
36 /* Mit Prefix */
37 $wpdb->$table = $wpdb->get_blog_prefix() . $table;
38 }
39
40
41 /**
42 * Anlegen der Tabelle
43 *
44 * @since 0.6.0
45 * @change 1.2.4
46 */
47
48 public static function create()
49 {
50 /* Global */
51 global $wpdb;
52
53 /* Existenz prüfen */
54 if ( $wpdb->get_var("SHOW TABLES LIKE '$wpdb->statify'") == $wpdb->statify ) {
55 return;
56 }
57
58 /* Einbinden */
59 require_once(ABSPATH. 'wp-admin/includes/upgrade.php');
60
61 /* Anlegen */
62 dbDelta(
63 "CREATE TABLE `$wpdb->statify` (
64 `id` bigint(20) unsigned NOT NULL auto_increment,
65 `created` date NOT NULL default '0000-00-00',
66 `referrer` varchar(255) NOT NULL default '',
67 `target` varchar(255) NOT NULL default '',
68 PRIMARY KEY (`id`),
69 KEY `referrer` (`referrer`),
70 KEY `target` (`target`),
71 KEY `created` (`created`)
72 );"
73 );
74 }
75
76
77 /**
78 * Löschung der Tabelle
79 *
80 * @since 0.6.0
81 * @change 1.2.4
82 */
83
84 public static function drop()
85 {
86 /* Global */
87 global $wpdb;
88
89 /* Remove */
90 $wpdb->query("DROP TABLE IF EXISTS `$wpdb->statify`");
91 }
92 }