/
votingtally.php
86 lines (75 loc) · 2.14 KB
/
votingtally.php
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
<?php // phpcs:ignore
/**
* Voting Tally Plugin
*
* @package votingtally
* @copyright Copyright(c) 2020, MediaRon LLC
* @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0)
*
* Plugin Name: Voting Tally
* Plugin URI: https://github.com/wpajax/votingtally
* Description: A way to up-and-down-vote posts including post types.
* Version: 1.0.0
* Author: MediaRon LLC
* Author URI: https://wpandajax.com
* License: GPL2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: votingtally
* Domain Path: languages
*/
define( 'VOTINGTALLY_VERSION', '1.0.0' );
define( 'VOTINGTALLY_TABLE_VERSION', '1.0.0' );
define( 'VOTINGTALLY_PLUGIN_NAME', 'Voting Tally' );
define( 'VOTINGTALLY_DIR', plugin_dir_path( __FILE__ ) );
define( 'VOTINGTALLY_URL', plugins_url( '/', __FILE__ ) );
define( 'VOTINGTALLY_SLUG', plugin_basename( __FILE__ ) );
define( 'VOTINGTALLY_FILE', __FILE__ );
// Setup the plugin auto loader.
require_once 'autoloader.php';
/**
* The Voting Tally base class.
*/
class Voting_Tally {
/**
* Voting_Tally instance.
*
* @var Voting_Tally $instance
*/
private static $instance = null;
/**
* Return a class instance.
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Class Constructor
*/
private function __construct() {
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ), 20 );
add_action( 'init', array( $this, 'init' ) );
}
/**
* Fired when the init action for WordPress is triggered.
*/
public function init() {
load_plugin_textdomain( 'votingtally', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/**
* Fired when the plugins for WordPress have finished loading.
*/
public function plugins_loaded() {
// Create the table.
new VotingTally\Includes\Create_Table();
// Output the Voting Talley interface.
new VotingTally\Includes\Output();
// Enqueue the necessary scripts/styles.
new VotingTally\Includes\Enqueue();
// Register Ajax Call.
new VotingTally\Includes\Ajax();
}
}
Voting_Tally::get_instance();