-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.php
102 lines (87 loc) · 3.45 KB
/
plugin.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
<?php
/*
* Plugin Name: Popular
* Plugin URI: http://codeforthepeople.com/
* Description: Queries Analytic services for web traffic data
* Author: Tom J Nowell, Code For The People
* Version: 1.3
* Author URI: http://codeforthepeople.com/
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* This comment is added for compatibility with the null framework https://github.com/scottsweb/null
* Widget Name: Popular Widget
*
* Copyright © 2013 Code for the People ltd
*
* _____________
* / ____ \
* _____/ \ \ \
* /\ \ \___\ \
* / \ \ \
* / / / _______\
* / / / \ /
* / / / \ /
* \ \ \ _____ ___\ /
* \ \ /\ \ / \
* \ \ / \____\/ _____\
* \ \/ / / / \
* \ /____/ /___\
* \ /
* \______________________/
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*/
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
if ( defined( 'WP_CLI' ) && WP_CLI ) {
// Command line support for development
include __DIR__ . '/wp-cli.php';
}
require_once( 'php/cftp_analytics_factory.php' );
require_once( 'php/cftp_analytics_model.php' );
require_once( 'php/cftp_analytics_option_model.php' );
require_once( 'php/cftp_analytics.php' );
require_once( 'php/cftp_analytics_cron_task.php' );
require_once( 'php/cftp_analytics_settings_page.php' );
require_once( 'php/cftp_analytics_source.php' );
require_once( 'php/cftp_google_analytics_auth.php' );
require_once( 'php/cftp_google_analytics_source.php' );
require_once( 'php/cftp_facebook_likes_source.php' );
require_once( 'php/cftp_facebook_shares_source.php' );
require_once( 'php/cftp_twitter_source.php' );
require_once( 'php/cftp_linkedin_source.php' );
require_once( 'php/cftp_total_shares_source.php' );
require_once( 'php/cftp_decay_views_source.php' );
require_once( 'php/cftp_decay_shares_source.php' );
$factory = new cftp_analytics_factory();
$model = new cftp_analytics_option_model();
// Sources - order determines column order on Posts page.
$analytics = $factory->googleAnalyticsSource();
$model->addSource( $analytics );
$twitter = $factory->twitterSharesSource();
$model->addSource( $twitter );
$linkedin = $factory->linkedinSource();
$model->addSource( $linkedin );
// TODO: readd with GraphQL rather than the deprecated REST Server
//$fblikes = $factory->facebookLikesSource();
//$model->addSource( $fblikes );
$fbshares = $factory->facebookSharesSource();
$model->addSource( $fbshares );
$totalshares = $factory->totalSharesSource();
$model->addSource( $totalshares );
$decayviews = $factory->decayViewsSource();
$model->addSource( $decayviews );
$decayshares = $factory->decaySharesSource();
$model->addSource( $decayshares );
$popular = new cftp_analytics( $factory, $model );
$popular->run();