This repository was archived by the owner on Aug 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwp-tally.php
More file actions
110 lines (90 loc) · 2.22 KB
/
wp-tally.php
File metadata and controls
110 lines (90 loc) · 2.22 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* Plugin Name: WP Tally
* Plugin URI: http://wptally.com
* Description: Track your total WordPress plugin and theme downloads
* Version: 1.2.1
* Author: Pippin Williamson, Daniel J Griffiths & Sean Davis
* Author URI: http://easydigitaldownloads.com
*
* @package WPTally
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'WPTally' ) ) {
/**
* Main WPTally class
*
* @since 1.0.0
*/
class WPTally {
/**
* @access private
* @since 1.0.0
* @var WPTally $instance The one true WPTally
*/
private static $instance;
/**
* @access public
* @since 1.0.0
* @var object $api The WPTally API object
*/
public $api;
/**
* Get active instance
*
* @access public
* @since 1.0.0
* @return self::$instance The one true WPTally
*/
public static function instance() {
if ( ! self::$instance ) {
self::$instance = new WPTally();
self::$instance->setup_constants();
self::$instance->includes();
self::$instance->api = new WPTally_API();
}
return self::$instance;
}
/**
* Setup plugin constants
*
* @access public
* @since 1.0.0
* @return void
*/
private function setup_constants() {
// Plugin path
define( 'WPTALLY_DIR', plugin_dir_path( __FILE__ ) );
// Plugin URL
define( 'WPTALLY_URL', plugin_dir_url( __FILE__ ) );
}
/**
* Include required files
*
* @access private
* @since 1.0.0
* @return void
*/
private function includes() {
require_once WPTALLY_DIR . 'includes/scripts.php';
require_once WPTALLY_DIR . 'includes/functions.php';
require_once WPTALLY_DIR . 'includes/shortcodes.php';
require_once WPTALLY_DIR . 'includes/class.wptally-api.php';
require_once WPTALLY_DIR . 'includes/dashboard-widgets.php';
}
}
}
/**
* The main function responsible for returning the one true WPTally
* instance to functions everywhere
*
* @since 1.0.0
* @return WPTally The one true WPTally
*/
function wptally_load() {
return WPTally::instance();
}
add_action( 'plugins_loaded', 'wptally_load' );