-
Notifications
You must be signed in to change notification settings - Fork 16
/
shared-counts.php
106 lines (89 loc) · 2.64 KB
/
shared-counts.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
<?php
/**
* Plugin Name: Shared Counts
* Plugin URI: https://sharedcountsplugin.com
* Description: Social sharing buttons that look great and keep your site loading fast.
* Author: Bill Erickson & Jared Atchison
* Version: 1.5.0
*
* Shared Counts 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
* any later version.
*
* Shared Counts 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 Shared Counts. If not, see <http://www.gnu.org/licenses/>.
*
* @package SharedCounts
* @author Bill Erickson & Jared Atchison
* @since 1.0.0
* @license GPL-2.0+
* @copyright Copyright (c) 2019
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Basic plugin constants.
*/
// Version.
define( 'SHARED_COUNTS_VERSION', '1.5.0' );
// Directory path.
define( 'SHARED_COUNTS_DIR', plugin_dir_path( __FILE__ ) );
// Directory URL.
define( 'SHARED_COUNTS_URL', plugin_dir_url( __FILE__ ) );
// Base name.
define( 'SHARED_COUNTS_BASE', plugin_basename( __FILE__ ) );
// Plugin root file.
define( 'SHARED_COUNTS_FILE', __FILE__ );
/**
* We require a modern supported version of PHP (5.6+).
*/
if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
/**
* Deactivate plugin.
*
* @since 1.0.0
*/
function shared_counts_deactivate() {
deactivate_plugins( plugin_basename( __FILE__ ) );
}
add_action( 'admin_init', 'shared_counts_deactivate' );
/**
* Display notice after deactivation.
*
* @since 1.0.0
*/
function shared_counts_deactivate_notice() {
echo '<div class="notice notice-warning"><p>' . esc_html__( 'Shared Counts requires PHP 5.6+. Contact your web host to update.', 'shared-counts' ) . '</p></div>';
if ( isset( $_GET['activate'] ) ) { // phpcs:ignore
unset( $_GET['activate'] ); // phpcs:ignore
}
}
add_action( 'admin_notices', 'shared_counts_deactivate_notice' );
} else {
/**
* Load the primary.
*/
require_once SHARED_COUNTS_DIR . 'includes/class-shared-counts.php';
/**
* The function provides access to the sharing methods.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* @since 1.0.0
*
* @return object
*/
function shared_counts() {
return Shared_Counts::instance();
}
shared_counts();
}