-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathclicky.php
More file actions
79 lines (68 loc) · 1.99 KB
/
clicky.php
File metadata and controls
79 lines (68 loc) · 1.99 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
<?php
/**
* Clicky for WordPress Plugin.
*
* @package Yoast/Clicky
* @copyright Copyright (C) 2012-2019 Yoast BV - support@yoast.com
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 or higher
*
* @wordpress-plugin
* Plugin Name: Clicky for WordPress
* Version: 2.0
* Plugin URI: https://yoast.com/wordpress/plugins/clicky/
* Description: The Clicky for WordPress plugin by Yoast makes it easy for you to add your Clicky analytics tracking code to your WordPress install, while also giving you some advanced tracking options.
* Author: Team Yoast
* Requires PHP: 5.6
* Requires at least: 5.9
* Author URI: https://yoast.com/
* Text Domain: clicky
*/
if ( ! function_exists( 'add_filter' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit();
}
define( 'CLICKY_PLUGIN_FILE', __FILE__ );
define( 'CLICKY_PLUGIN_VERSION', '2.0' );
define( 'CLICKY_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
define( 'CLICKY_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) );
/**
* Class Yoast Clicky base class.
*/
class Yoast_Clicky {
/**
* Initialize the plugin settings.
*/
public function __construct() {
if (
( defined( 'DOING_AJAX' ) && DOING_AJAX )
|| ( defined( 'WP_CLI' ) && WP_CLI )
|| ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
return;
}
if ( file_exists( CLICKY_PLUGIN_DIR_PATH . 'vendor/autoload.php' ) ) {
require_once CLICKY_PLUGIN_DIR_PATH . 'vendor/autoload.php';
}
add_action( 'init', [ $this, 'init' ] );
}
/**
* Initialize the whole plugin.
*/
public function init() {
load_plugin_textdomain( 'clicky', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
if ( is_admin() ) {
new Clicky_Admin();
return;
}
new Clicky_Frontend();
if ( current_user_can( 'manage_options' ) ) {
new Clicky_Visitor_Graph();
}
}
}
add_action(
'plugins_loaded',
static function () {
new Yoast_Clicky();
}
);