-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwp-plugin-su.php
More file actions
83 lines (74 loc) · 1.76 KB
/
Copy pathwp-plugin-su.php
File metadata and controls
83 lines (74 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Plugin Name: Artiskool WP SU Test
* Plugin URI: http://wp.artiskool.com/su-test
* Description: Artiskool Wordpress Software Update plugin test
* Version: 0.1.0
* Author: Art Layese
* Author URI: http://artiskool.com
*/
if (! defined('ABSPATH'))
exit; //Exit if accessed directly
/**
* Artiskool_Plugin_Su main class
* @class Artiskool_Plugin_Su
*/
class Artiskool_Plugin_Su
{
/**
* Instance object holder
* @access private static
* @var $instance;
*/
private static $instance = null;
/**
* Constructor
*/
public function __construct()
{
register_activation_hook(__FILE__, array($this, 'install'));
}
/**
* Returns singleton instance of this class
* @access public static
* @return self
*/
public static function getInstance()
{
if (self::$instance === null)
self::$instance = new self();
return self::$instance;
}
/**
* Activation Hook
* create custom table wp_hub_messages
*/
public function install()
{
global $wpdb;
$table_name = $wpdb->prefix . 'test';
$sql = "CREATE TABLE IF NOT EXISTS $table_name("
. " id bigint(20) NOT NULL AUTO_INCREMENT,"
. " parent_id bigint(20) NOT NULL,"
. " post_id bigint(20) NOT NULL,"
. " sender bigint(20) NOT NULL,"
. " recipient bigint(20) NOT NULL,"
. " UNIQUE KEY id (id)"
. " );";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
}
/**
* Make it private so that it will not be cloned
* @access private
*/
private function __clone()
{
_doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'Artiskool_Plugin_Su'), '1.0.0');
}
}
Artiskool_Plugin_Su::getInstance();
if (is_admin()) {
require_once 'classes/artiskool-updater-github.php';
new Artiskool_Updater_GitHub (__FILE__, 'artiskool', 'wp-plugin-su');
}