-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpf_stats.php
140 lines (99 loc) · 3.97 KB
/
pf_stats.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/*
Plugin Name: PressForward Stats
Plugin URI: http://pressforward.org/
Description: A plugin that generates shortcodes to calculate stats about use of the PressForward plugin.
Version: 0.0.1
GitHub Plugin URI: https://github.com/PressForward/pressforward
Author: Aram Zucker-Scharff, Boone B Gorges, Jeremy Boggs
Author URI: http://pressforward.org/about/team/
License: GPL2
*/
/* Developed for the Roy Rosenzweig Center for History and New Media
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class PF_Stats {
var $slug;
var $title;
var $root;
var $file_path;
var $url;
var $ver;
var $feed_post_type;
var $meta_key;
var $base;
var $access;
var $shortcodes;
var $gender_checker;
public static function init() {
static $instance;
if ( ! is_a( $instance, 'PF_Stats' ) ) {
$instance = new self();
}
return $instance;
}
private function __construct() {
$this->define_constants();
$this->base();
$this->includes();
$this->access();
$this->shortcodes();
$this->gender_checker();
}
private function define_constants(){
$this->slug = 'pf_stats';
$this->title = 'PressForward Stats';
$this->root = dirname(__FILE__);
$this->file_path = $this->root . '/' . basename(__FILE__);
$this->url = plugins_url( '/', __FILE__ );
$this->ver = 1.0;
$this->feed_post_type = 'pf_feed_item';
$this->meta_key = 'item_id';
$this->meta_author_key = 'item_author';
}
private function includes(){
require_once( $this->root . '/lib/enumeration/src/Eloquent/Enumeration/Multiton.php' );
require_once( $this->root . '/lib/enumeration/src/Eloquent/Enumeration/Enumeration.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Gender.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/Traits/NameList.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/Interfaces/Matcher.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/BabyNamesWSMatch.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/RestNamesWSMatch.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/RegExpV1Match.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/RegExpV2Match.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/MetaphoneWeightedMatch.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/MetaphoneMatch.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/ListWeightedMatch.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/Matchers/ListMatch.php' );
require_once( $this->root . '/lib/gender-checker/src/GenderEngine/GenderEngine.php' );
require_once( $this->root . '/lib/text-stats/src/DaveChild/TextStatistics/TextStatistics.php' );
require_once( $this->root . '/includes/shortcodes.php' );
}
public function base(){
}
public function access(){
}
public function shortcodes(){
if ( empty( $this->shortcodes ) ) {
$this->shortcodes = PF_Stats_Shortcodes::init();
}
}
public function gender_checker(){
if (empty( $this->gender_checker ) ) {
$this->gender_checker = new GenderEngine\GenderEngine();
}
}
}
function pressforward_stats(){
return PF_Stats::init();
}
add_action( 'pressforward_init', 'pressforward_stats' );