Version Description
- Added: New feature! Show Hits on the single posts/pages.
- Added: Pages Dropdown in the page stats.
- Fixed: Menu bar for both frontend & backend.
- Fixed: Issue to create the object of the main class.
- Fixed: Issue to get page title in empty search words option.
- Fixed: Issue to show date range in the charts.
Download this release
Release Info
Developer | mostafa.s1990 |
Plugin | WP Statistics |
Version | 12.3.2 |
Comparing to | |
See all releases |
Code changes from version 12.3.1 to 12.3.2
- assets/css/admin.css +70 -0
- assets/css/frontend.css +4 -0
- assets/css/log.css +2 -1
- assets/css/rtl.css +14 -0
- assets/images/logo-250-white.png +0 -0
- assets/images/welcome/add-on-advanced-reporting.png +0 -0
- assets/images/welcome/add-on-mini-chart.png +0 -0
- assets/images/welcome/add-on-realtime-stats.png +0 -0
- assets/images/welcome/add-on-widgets.png +0 -0
- assets/images/welcome/icon-love.png +0 -0
- assets/images/welcome/icon-question.png +0 -0
- assets/images/welcome/screenshots-1.png +0 -0
- assets/images/welcome/screenshots-2.png +0 -0
- assets/js/admin.js +14 -1
- composer.json +3 -2
- composer.lock +429 -384
- includes/classes/class-wp-statistics-admin-pages.php +3 -3
- includes/classes/class-wp-statistics-admin.php +8 -217
- includes/classes/class-wp-statistics-frontend.php +54 -1
- includes/classes/class-wp-statistics-welcome.php +81 -0
- includes/classes/class-wp-statistics.php +218 -1
- includes/functions/functions.php +1 -1
- includes/log/authors.php +1 -1
- includes/log/categories.php +3 -1
- includes/log/exclusions.php +1 -1
- includes/log/hit-statistics.php +2 -1
- includes/log/page-statistics.php +48 -35
- includes/log/search-statistics.php +1 -1
- includes/log/tags.php +1 -1
- includes/log/top-pages.php +1 -1
- includes/log/widgets/about.php +0 -9
- includes/settings/tabs/wps-general.php +57 -6
- includes/templates/plugins.php +2 -2
- includes/templates/welcome.php +137 -0
- includes/vendor/browscap/browscap-php/src/phpbrowscap/Browscap.php +2 -1
- includes/vendor/composer/autoload_namespaces.php +1 -0
- includes/vendor/composer/autoload_static.php +7 -0
- includes/vendor/composer/installed.json +47 -0
- includes/vendor/erusev/parsedown/LICENSE.txt +20 -0
- includes/vendor/erusev/parsedown/Parsedown.php +1548 -0
- includes/vendor/erusev/parsedown/README.md +61 -0
- includes/vendor/erusev/parsedown/composer.json +24 -0
- readme.txt +10 -2
- wp-statistics.php +4 -2
assets/css/admin.css
CHANGED
@@ -202,3 +202,73 @@
|
|
202 |
content: '\f184';
|
203 |
top: 2px;
|
204 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
content: '\f184';
|
203 |
top: 2px;
|
204 |
}
|
205 |
+
|
206 |
+
/** Welcome page **/
|
207 |
+
.wp-statistics-welcome .wp-badge {
|
208 |
+
background-image: url('../images/logo-250-white.png');
|
209 |
+
background-color: #1aabec;
|
210 |
+
}
|
211 |
+
|
212 |
+
.wp-statistics-welcome .tab-content {
|
213 |
+
display: none;
|
214 |
+
}
|
215 |
+
|
216 |
+
.wp-statistics-welcome .tab-content.current {
|
217 |
+
display: block;
|
218 |
+
}
|
219 |
+
|
220 |
+
.wp-statistics-welcome ul li {
|
221 |
+
margin: 0 31px;
|
222 |
+
}
|
223 |
+
|
224 |
+
.wp-statistics-welcome ul {
|
225 |
+
list-style-type: square;
|
226 |
+
line-height: 28px;
|
227 |
+
margin: 0 0 20px 0;
|
228 |
+
}
|
229 |
+
|
230 |
+
.wp-statistics-welcome .center-section {
|
231 |
+
padding: 41px 0 60px;
|
232 |
+
clear: both;
|
233 |
+
text-align: center;
|
234 |
+
}
|
235 |
+
|
236 |
+
.wp-statistics-welcome .normal-section .left {
|
237 |
+
float: left;
|
238 |
+
width: 50%;
|
239 |
+
text-align: left;
|
240 |
+
}
|
241 |
+
|
242 |
+
.wp-statistics-welcome .normal-section .right {
|
243 |
+
float: right;
|
244 |
+
width: 50%;
|
245 |
+
}
|
246 |
+
|
247 |
+
.wp-statistics-welcome .normal-section {
|
248 |
+
float: left;
|
249 |
+
width: 100%;
|
250 |
+
padding: 36px 0 44px;
|
251 |
+
border-bottom: 1px solid #dedede;
|
252 |
+
}
|
253 |
+
|
254 |
+
.wp-statistics-welcome .normal-section h2 {
|
255 |
+
text-align: left;
|
256 |
+
}
|
257 |
+
|
258 |
+
.wp-statistics-welcome .text-center {
|
259 |
+
text-align: center !important;
|
260 |
+
}
|
261 |
+
|
262 |
+
.wp-statistics-welcome .content-padding {
|
263 |
+
padding: 0 43px;
|
264 |
+
}
|
265 |
+
|
266 |
+
.wp-statistics-welcome .addons-item img {
|
267 |
+
width: 130px;
|
268 |
+
border-radius: 4px;
|
269 |
+
}
|
270 |
+
|
271 |
+
.wp-statistics-welcome .addons-item a {
|
272 |
+
display: inline-block;
|
273 |
+
margin: 0 5px;
|
274 |
+
}
|
assets/css/frontend.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
#wpadminbar #wp-admin-bar-wp-statistic-menu .ab-icon:before {
|
2 |
+
content: '\f184';
|
3 |
+
top: 2px;
|
4 |
+
}
|
assets/css/log.css
CHANGED
@@ -297,8 +297,9 @@
|
|
297 |
|
298 |
#about-links p {
|
299 |
display: inline;
|
300 |
-
font-size:
|
301 |
margin: 0 2px;
|
|
|
302 |
}
|
303 |
|
304 |
#about-links a {
|
297 |
|
298 |
#about-links p {
|
299 |
display: inline;
|
300 |
+
font-size: 12px;
|
301 |
margin: 0 2px;
|
302 |
+
font-style: italic;
|
303 |
}
|
304 |
|
305 |
#about-links a {
|
assets/css/rtl.css
CHANGED
@@ -53,3 +53,17 @@
|
|
53 |
.right-div {
|
54 |
float: left;
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
.right-div {
|
54 |
float: left;
|
55 |
}
|
56 |
+
|
57 |
+
/** Welcome page **/
|
58 |
+
.wp-statistics-welcome .normal-section .left {
|
59 |
+
float: right;
|
60 |
+
text-align: right;
|
61 |
+
}
|
62 |
+
|
63 |
+
.wp-statistics-welcome .normal-section h2 {
|
64 |
+
text-align: right;
|
65 |
+
}
|
66 |
+
|
67 |
+
.wp-statistics-welcome .normal-section .right {
|
68 |
+
float: left;
|
69 |
+
}
|
assets/images/logo-250-white.png
ADDED
Binary file
|
assets/images/welcome/add-on-advanced-reporting.png
ADDED
Binary file
|
assets/images/welcome/add-on-mini-chart.png
ADDED
Binary file
|
assets/images/welcome/add-on-realtime-stats.png
ADDED
Binary file
|
assets/images/welcome/add-on-widgets.png
ADDED
Binary file
|
assets/images/welcome/icon-love.png
ADDED
Binary file
|
assets/images/welcome/icon-question.png
ADDED
Binary file
|
assets/images/welcome/screenshots-1.png
ADDED
Binary file
|
assets/images/welcome/screenshots-2.png
ADDED
Binary file
|
assets/js/admin.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
jQuery(document).ready(function () {
|
2 |
// Check setting page
|
3 |
if (jQuery('.wp-statistics-settings').length) {
|
4 |
-
|
5 |
var current_tab = getParameterValue('tab');
|
6 |
if (current_tab) {
|
7 |
enableTab(current_tab);
|
@@ -13,6 +12,20 @@ jQuery(document).ready(function () {
|
|
13 |
});
|
14 |
}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/**
|
17 |
* Get Parameter value
|
18 |
* @param name
|
1 |
jQuery(document).ready(function () {
|
2 |
// Check setting page
|
3 |
if (jQuery('.wp-statistics-settings').length) {
|
|
|
4 |
var current_tab = getParameterValue('tab');
|
5 |
if (current_tab) {
|
6 |
enableTab(current_tab);
|
12 |
});
|
13 |
}
|
14 |
|
15 |
+
// Check about page
|
16 |
+
if (jQuery('.wp-statistics-welcome').length) {
|
17 |
+
jQuery('.nav-tab-wrapper a').click(function () {
|
18 |
+
jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
|
19 |
+
jQuery('.tab-content').removeClass('current');
|
20 |
+
|
21 |
+
var tab_id = jQuery(this).attr('data-tab');
|
22 |
+
jQuery("[data-tab=" + tab_id + "]").addClass('nav-tab-active');
|
23 |
+
jQuery("[data-content=" + tab_id + "]").addClass('current');
|
24 |
+
|
25 |
+
return false;
|
26 |
+
});
|
27 |
+
}
|
28 |
+
|
29 |
/**
|
30 |
* Get Parameter value
|
31 |
* @param name
|
composer.json
CHANGED
@@ -3,9 +3,10 @@
|
|
3 |
"geoip2/geoip2": "^2.7.0",
|
4 |
"s1lentium/iptools": "^1.1.0",
|
5 |
"donatj/phpuseragentparser": "^0.9.0",
|
6 |
-
"browscap/browscap-php": "2.1.1"
|
|
|
7 |
},
|
8 |
"config": {
|
9 |
"vendor-dir": "includes/vendor"
|
10 |
}
|
11 |
-
}
|
3 |
"geoip2/geoip2": "^2.7.0",
|
4 |
"s1lentium/iptools": "^1.1.0",
|
5 |
"donatj/phpuseragentparser": "^0.9.0",
|
6 |
+
"browscap/browscap-php": "2.1.1",
|
7 |
+
"erusev/parsedown": "^1.6"
|
8 |
},
|
9 |
"config": {
|
10 |
"vendor-dir": "includes/vendor"
|
11 |
}
|
12 |
+
}
|
composer.lock
CHANGED
@@ -1,384 +1,429 @@
|
|
1 |
-
{
|
2 |
-
"_readme": [
|
3 |
-
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
-
"This file is @generated automatically"
|
6 |
-
],
|
7 |
-
"content-hash": "
|
8 |
-
"packages": [
|
9 |
-
{
|
10 |
-
"name": "browscap/browscap-php",
|
11 |
-
"version": "2.1.1",
|
12 |
-
"source": {
|
13 |
-
"type": "git",
|
14 |
-
"url": "https://github.com/browscap/browscap-php.git",
|
15 |
-
"reference": "f17a326ebaf7878c2ae1d2d5ed7bc402160c0828"
|
16 |
-
},
|
17 |
-
"dist": {
|
18 |
-
"type": "zip",
|
19 |
-
"url": "https://api.github.com/repos/browscap/browscap-php/zipball/f17a326ebaf7878c2ae1d2d5ed7bc402160c0828",
|
20 |
-
"reference": "f17a326ebaf7878c2ae1d2d5ed7bc402160c0828",
|
21 |
-
"shasum": ""
|
22 |
-
},
|
23 |
-
"require": {
|
24 |
-
"php": ">=5.3.0"
|
25 |
-
},
|
26 |
-
"require-dev": {
|
27 |
-
"phpunit/phpunit": "*"
|
28 |
-
},
|
29 |
-
"type": "library",
|
30 |
-
"autoload": {
|
31 |
-
"psr-0": {
|
32 |
-
"phpbrowscap\\": "src/"
|
33 |
-
}
|
34 |
-
},
|
35 |
-
"notification-url": "https://packagist.org/downloads/",
|
36 |
-
"license": [
|
37 |
-
"MIT"
|
38 |
-
],
|
39 |
-
"authors": [
|
40 |
-
{
|
41 |
-
"name": "Jonathan Stoppani",
|
42 |
-
"email": "jonathan.stoppani@gmail.com"
|
43 |
-
},
|
44 |
-
{
|
45 |
-
"name": "Thomas Mueller",
|
46 |
-
"email": "t_mueller_stolzenhain@yahoo.de"
|
47 |
-
},
|
48 |
-
{
|
49 |
-
"name": "James Titcumb",
|
50 |
-
"email": "james@asgrim.com"
|
51 |
-
}
|
52 |
-
],
|
53 |
-
"description": "Standalone replacement for php's native get_browser() function",
|
54 |
-
"homepage": "https://github.com/browscap/browscap-php",
|
55 |
-
"keywords": [
|
56 |
-
"browser",
|
57 |
-
"capabilities",
|
58 |
-
"get_browser",
|
59 |
-
"user agent"
|
60 |
-
],
|
61 |
-
"time": "2015-11-24T17:24:06+00:00"
|
62 |
-
},
|
63 |
-
{
|
64 |
-
"name": "composer/ca-bundle",
|
65 |
-
"version": "1.1.0",
|
66 |
-
"source": {
|
67 |
-
"type": "git",
|
68 |
-
"url": "https://github.com/composer/ca-bundle.git",
|
69 |
-
"reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288"
|
70 |
-
},
|
71 |
-
"dist": {
|
72 |
-
"type": "zip",
|
73 |
-
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288",
|
74 |
-
"reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288",
|
75 |
-
"shasum": ""
|
76 |
-
},
|
77 |
-
"require": {
|
78 |
-
"ext-openssl": "*",
|
79 |
-
"ext-pcre": "*",
|
80 |
-
"php": "^5.3.2 || ^7.0"
|
81 |
-
},
|
82 |
-
"require-dev": {
|
83 |
-
"phpunit/phpunit": "^4.8.35",
|
84 |
-
"psr/log": "^1.0",
|
85 |
-
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
86 |
-
},
|
87 |
-
"type": "library",
|
88 |
-
"extra": {
|
89 |
-
"branch-alias": {
|
90 |
-
"dev-master": "1.x-dev"
|
91 |
-
}
|
92 |
-
},
|
93 |
-
"autoload": {
|
94 |
-
"psr-4": {
|
95 |
-
"Composer\\CaBundle\\": "src"
|
96 |
-
}
|
97 |
-
},
|
98 |
-
"notification-url": "https://packagist.org/downloads/",
|
99 |
-
"license": [
|
100 |
-
"MIT"
|
101 |
-
],
|
102 |
-
"authors": [
|
103 |
-
{
|
104 |
-
"name": "Jordi Boggiano",
|
105 |
-
"email": "j.boggiano@seld.be",
|
106 |
-
"homepage": "http://seld.be"
|
107 |
-
}
|
108 |
-
],
|
109 |
-
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
|
110 |
-
"keywords": [
|
111 |
-
"cabundle",
|
112 |
-
"cacert",
|
113 |
-
"certificate",
|
114 |
-
"ssl",
|
115 |
-
"tls"
|
116 |
-
],
|
117 |
-
"time": "2017-11-29T09:37:33+00:00"
|
118 |
-
},
|
119 |
-
{
|
120 |
-
"name": "donatj/phpuseragentparser",
|
121 |
-
"version": "v0.9.0",
|
122 |
-
"source": {
|
123 |
-
"type": "git",
|
124 |
-
"url": "https://github.com/donatj/PhpUserAgent.git",
|
125 |
-
"reference": "ea79de6a18e52285e62cd75cf1cebe276ecaf503"
|
126 |
-
},
|
127 |
-
"dist": {
|
128 |
-
"type": "zip",
|
129 |
-
"url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/ea79de6a18e52285e62cd75cf1cebe276ecaf503",
|
130 |
-
"reference": "ea79de6a18e52285e62cd75cf1cebe276ecaf503",
|
131 |
-
"shasum": ""
|
132 |
-
},
|
133 |
-
"require": {
|
134 |
-
"php": ">=5.3.0"
|
135 |
-
},
|
136 |
-
"require-dev": {
|
137 |
-
"camspiers/json-pretty": "0.1.*",
|
138 |
-
"donatj/drop": "*",
|
139 |
-
"phpunit/phpunit": "~4.8"
|
140 |
-
},
|
141 |
-
"type": "library",
|
142 |
-
"autoload": {
|
143 |
-
"files": [
|
144 |
-
"Source/UserAgentParser.php"
|
145 |
-
]
|
146 |
-
},
|
147 |
-
"notification-url": "https://packagist.org/downloads/",
|
148 |
-
"license": [
|
149 |
-
"MIT"
|
150 |
-
],
|
151 |
-
"authors": [
|
152 |
-
{
|
153 |
-
"name": "Jesse G. Donat",
|
154 |
-
"email": "donatj@gmail.com",
|
155 |
-
"homepage": "http://donatstudios.com",
|
156 |
-
"role": "Developer"
|
157 |
-
}
|
158 |
-
],
|
159 |
-
"description": "Simple, streamlined PHP user-agent parser",
|
160 |
-
"homepage": "http://donatstudios.com/PHP-Parser-HTTP_USER_AGENT",
|
161 |
-
"keywords": [
|
162 |
-
"browser",
|
163 |
-
"browser detection",
|
164 |
-
"parser",
|
165 |
-
"user agent",
|
166 |
-
"useragent"
|
167 |
-
],
|
168 |
-
"time": "2017-10-23T16:52:52+00:00"
|
169 |
-
},
|
170 |
-
{
|
171 |
-
"name": "
|
172 |
-
"version": "
|
173 |
-
"source": {
|
174 |
-
"type": "git",
|
175 |
-
"url": "https://github.com/
|
176 |
-
"reference": "
|
177 |
-
},
|
178 |
-
"dist": {
|
179 |
-
"type": "zip",
|
180 |
-
"url": "https://api.github.com/repos/
|
181 |
-
"reference": "
|
182 |
-
"shasum": ""
|
183 |
-
},
|
184 |
-
"require": {
|
185 |
-
"
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
"
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
"
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
"
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
"
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
"
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
"
|
233 |
-
|
234 |
-
|
235 |
-
"
|
236 |
-
|
237 |
-
|
238 |
-
"
|
239 |
-
},
|
240 |
-
"
|
241 |
-
|
242 |
-
"
|
243 |
-
|
244 |
-
|
245 |
-
},
|
246 |
-
"
|
247 |
-
|
248 |
-
"
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
"
|
255 |
-
}
|
256 |
-
|
257 |
-
"
|
258 |
-
"
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
"
|
270 |
-
"
|
271 |
-
|
272 |
-
"
|
273 |
-
"
|
274 |
-
"
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
"
|
283 |
-
"
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
"
|
289 |
-
"
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
"
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
"
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
"
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
"
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
"
|
327 |
-
"
|
328 |
-
|
329 |
-
"
|
330 |
-
"
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
"
|
335 |
-
"
|
336 |
-
"
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
"ext-
|
341 |
-
"
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
"
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
"
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"content-hash": "354d8d2ab00a3ef78ee47cb4b9a65cc9",
|
8 |
+
"packages": [
|
9 |
+
{
|
10 |
+
"name": "browscap/browscap-php",
|
11 |
+
"version": "2.1.1",
|
12 |
+
"source": {
|
13 |
+
"type": "git",
|
14 |
+
"url": "https://github.com/browscap/browscap-php.git",
|
15 |
+
"reference": "f17a326ebaf7878c2ae1d2d5ed7bc402160c0828"
|
16 |
+
},
|
17 |
+
"dist": {
|
18 |
+
"type": "zip",
|
19 |
+
"url": "https://api.github.com/repos/browscap/browscap-php/zipball/f17a326ebaf7878c2ae1d2d5ed7bc402160c0828",
|
20 |
+
"reference": "f17a326ebaf7878c2ae1d2d5ed7bc402160c0828",
|
21 |
+
"shasum": ""
|
22 |
+
},
|
23 |
+
"require": {
|
24 |
+
"php": ">=5.3.0"
|
25 |
+
},
|
26 |
+
"require-dev": {
|
27 |
+
"phpunit/phpunit": "*"
|
28 |
+
},
|
29 |
+
"type": "library",
|
30 |
+
"autoload": {
|
31 |
+
"psr-0": {
|
32 |
+
"phpbrowscap\\": "src/"
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"notification-url": "https://packagist.org/downloads/",
|
36 |
+
"license": [
|
37 |
+
"MIT"
|
38 |
+
],
|
39 |
+
"authors": [
|
40 |
+
{
|
41 |
+
"name": "Jonathan Stoppani",
|
42 |
+
"email": "jonathan.stoppani@gmail.com"
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"name": "Thomas Mueller",
|
46 |
+
"email": "t_mueller_stolzenhain@yahoo.de"
|
47 |
+
},
|
48 |
+
{
|
49 |
+
"name": "James Titcumb",
|
50 |
+
"email": "james@asgrim.com"
|
51 |
+
}
|
52 |
+
],
|
53 |
+
"description": "Standalone replacement for php's native get_browser() function",
|
54 |
+
"homepage": "https://github.com/browscap/browscap-php",
|
55 |
+
"keywords": [
|
56 |
+
"browser",
|
57 |
+
"capabilities",
|
58 |
+
"get_browser",
|
59 |
+
"user agent"
|
60 |
+
],
|
61 |
+
"time": "2015-11-24T17:24:06+00:00"
|
62 |
+
},
|
63 |
+
{
|
64 |
+
"name": "composer/ca-bundle",
|
65 |
+
"version": "1.1.0",
|
66 |
+
"source": {
|
67 |
+
"type": "git",
|
68 |
+
"url": "https://github.com/composer/ca-bundle.git",
|
69 |
+
"reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288"
|
70 |
+
},
|
71 |
+
"dist": {
|
72 |
+
"type": "zip",
|
73 |
+
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/943b2c4fcad1ef178d16a713c2468bf7e579c288",
|
74 |
+
"reference": "943b2c4fcad1ef178d16a713c2468bf7e579c288",
|
75 |
+
"shasum": ""
|
76 |
+
},
|
77 |
+
"require": {
|
78 |
+
"ext-openssl": "*",
|
79 |
+
"ext-pcre": "*",
|
80 |
+
"php": "^5.3.2 || ^7.0"
|
81 |
+
},
|
82 |
+
"require-dev": {
|
83 |
+
"phpunit/phpunit": "^4.8.35",
|
84 |
+
"psr/log": "^1.0",
|
85 |
+
"symfony/process": "^2.5 || ^3.0 || ^4.0"
|
86 |
+
},
|
87 |
+
"type": "library",
|
88 |
+
"extra": {
|
89 |
+
"branch-alias": {
|
90 |
+
"dev-master": "1.x-dev"
|
91 |
+
}
|
92 |
+
},
|
93 |
+
"autoload": {
|
94 |
+
"psr-4": {
|
95 |
+
"Composer\\CaBundle\\": "src"
|
96 |
+
}
|
97 |
+
},
|
98 |
+
"notification-url": "https://packagist.org/downloads/",
|
99 |
+
"license": [
|
100 |
+
"MIT"
|
101 |
+
],
|
102 |
+
"authors": [
|
103 |
+
{
|
104 |
+
"name": "Jordi Boggiano",
|
105 |
+
"email": "j.boggiano@seld.be",
|
106 |
+
"homepage": "http://seld.be"
|
107 |
+
}
|
108 |
+
],
|
109 |
+
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
|
110 |
+
"keywords": [
|
111 |
+
"cabundle",
|
112 |
+
"cacert",
|
113 |
+
"certificate",
|
114 |
+
"ssl",
|
115 |
+
"tls"
|
116 |
+
],
|
117 |
+
"time": "2017-11-29T09:37:33+00:00"
|
118 |
+
},
|
119 |
+
{
|
120 |
+
"name": "donatj/phpuseragentparser",
|
121 |
+
"version": "v0.9.0",
|
122 |
+
"source": {
|
123 |
+
"type": "git",
|
124 |
+
"url": "https://github.com/donatj/PhpUserAgent.git",
|
125 |
+
"reference": "ea79de6a18e52285e62cd75cf1cebe276ecaf503"
|
126 |
+
},
|
127 |
+
"dist": {
|
128 |
+
"type": "zip",
|
129 |
+
"url": "https://api.github.com/repos/donatj/PhpUserAgent/zipball/ea79de6a18e52285e62cd75cf1cebe276ecaf503",
|
130 |
+
"reference": "ea79de6a18e52285e62cd75cf1cebe276ecaf503",
|
131 |
+
"shasum": ""
|
132 |
+
},
|
133 |
+
"require": {
|
134 |
+
"php": ">=5.3.0"
|
135 |
+
},
|
136 |
+
"require-dev": {
|
137 |
+
"camspiers/json-pretty": "0.1.*",
|
138 |
+
"donatj/drop": "*",
|
139 |
+
"phpunit/phpunit": "~4.8"
|
140 |
+
},
|
141 |
+
"type": "library",
|
142 |
+
"autoload": {
|
143 |
+
"files": [
|
144 |
+
"Source/UserAgentParser.php"
|
145 |
+
]
|
146 |
+
},
|
147 |
+
"notification-url": "https://packagist.org/downloads/",
|
148 |
+
"license": [
|
149 |
+
"MIT"
|
150 |
+
],
|
151 |
+
"authors": [
|
152 |
+
{
|
153 |
+
"name": "Jesse G. Donat",
|
154 |
+
"email": "donatj@gmail.com",
|
155 |
+
"homepage": "http://donatstudios.com",
|
156 |
+
"role": "Developer"
|
157 |
+
}
|
158 |
+
],
|
159 |
+
"description": "Simple, streamlined PHP user-agent parser",
|
160 |
+
"homepage": "http://donatstudios.com/PHP-Parser-HTTP_USER_AGENT",
|
161 |
+
"keywords": [
|
162 |
+
"browser",
|
163 |
+
"browser detection",
|
164 |
+
"parser",
|
165 |
+
"user agent",
|
166 |
+
"useragent"
|
167 |
+
],
|
168 |
+
"time": "2017-10-23T16:52:52+00:00"
|
169 |
+
},
|
170 |
+
{
|
171 |
+
"name": "erusev/parsedown",
|
172 |
+
"version": "1.6.4",
|
173 |
+
"source": {
|
174 |
+
"type": "git",
|
175 |
+
"url": "https://github.com/erusev/parsedown.git",
|
176 |
+
"reference": "fbe3fe878f4fe69048bb8a52783a09802004f548"
|
177 |
+
},
|
178 |
+
"dist": {
|
179 |
+
"type": "zip",
|
180 |
+
"url": "https://api.github.com/repos/erusev/parsedown/zipball/fbe3fe878f4fe69048bb8a52783a09802004f548",
|
181 |
+
"reference": "fbe3fe878f4fe69048bb8a52783a09802004f548",
|
182 |
+
"shasum": ""
|
183 |
+
},
|
184 |
+
"require": {
|
185 |
+
"php": ">=5.3.0"
|
186 |
+
},
|
187 |
+
"require-dev": {
|
188 |
+
"phpunit/phpunit": "^4.8.35"
|
189 |
+
},
|
190 |
+
"type": "library",
|
191 |
+
"autoload": {
|
192 |
+
"psr-0": {
|
193 |
+
"Parsedown": ""
|
194 |
+
}
|
195 |
+
},
|
196 |
+
"notification-url": "https://packagist.org/downloads/",
|
197 |
+
"license": [
|
198 |
+
"MIT"
|
199 |
+
],
|
200 |
+
"authors": [
|
201 |
+
{
|
202 |
+
"name": "Emanuil Rusev",
|
203 |
+
"email": "hello@erusev.com",
|
204 |
+
"homepage": "http://erusev.com"
|
205 |
+
}
|
206 |
+
],
|
207 |
+
"description": "Parser for Markdown.",
|
208 |
+
"homepage": "http://parsedown.org",
|
209 |
+
"keywords": [
|
210 |
+
"markdown",
|
211 |
+
"parser"
|
212 |
+
],
|
213 |
+
"time": "2017-11-14T20:44:03+00:00"
|
214 |
+
},
|
215 |
+
{
|
216 |
+
"name": "geoip2/geoip2",
|
217 |
+
"version": "v2.7.0",
|
218 |
+
"source": {
|
219 |
+
"type": "git",
|
220 |
+
"url": "https://github.com/maxmind/GeoIP2-php.git",
|
221 |
+
"reference": "ca9f9a244474d97eac1ef542aaced7cc944bafbe"
|
222 |
+
},
|
223 |
+
"dist": {
|
224 |
+
"type": "zip",
|
225 |
+
"url": "https://api.github.com/repos/maxmind/GeoIP2-php/zipball/ca9f9a244474d97eac1ef542aaced7cc944bafbe",
|
226 |
+
"reference": "ca9f9a244474d97eac1ef542aaced7cc944bafbe",
|
227 |
+
"shasum": ""
|
228 |
+
},
|
229 |
+
"require": {
|
230 |
+
"maxmind-db/reader": "~1.0",
|
231 |
+
"maxmind/web-service-common": "~0.4",
|
232 |
+
"php": ">=5.4"
|
233 |
+
},
|
234 |
+
"require-dev": {
|
235 |
+
"apigen/apigen": "*",
|
236 |
+
"friendsofphp/php-cs-fixer": "2.*",
|
237 |
+
"phpunit/phpunit": "4.*",
|
238 |
+
"squizlabs/php_codesniffer": "3.*"
|
239 |
+
},
|
240 |
+
"type": "library",
|
241 |
+
"autoload": {
|
242 |
+
"psr-4": {
|
243 |
+
"GeoIp2\\": "src"
|
244 |
+
}
|
245 |
+
},
|
246 |
+
"notification-url": "https://packagist.org/downloads/",
|
247 |
+
"license": [
|
248 |
+
"Apache-2.0"
|
249 |
+
],
|
250 |
+
"authors": [
|
251 |
+
{
|
252 |
+
"name": "Gregory J. Oschwald",
|
253 |
+
"email": "goschwald@maxmind.com",
|
254 |
+
"homepage": "http://www.maxmind.com/"
|
255 |
+
}
|
256 |
+
],
|
257 |
+
"description": "MaxMind GeoIP2 PHP API",
|
258 |
+
"homepage": "https://github.com/maxmind/GeoIP2-php",
|
259 |
+
"keywords": [
|
260 |
+
"IP",
|
261 |
+
"geoip",
|
262 |
+
"geoip2",
|
263 |
+
"geolocation",
|
264 |
+
"maxmind"
|
265 |
+
],
|
266 |
+
"time": "2017-10-27T19:20:22+00:00"
|
267 |
+
},
|
268 |
+
{
|
269 |
+
"name": "maxmind-db/reader",
|
270 |
+
"version": "v1.2.0",
|
271 |
+
"source": {
|
272 |
+
"type": "git",
|
273 |
+
"url": "https://github.com/maxmind/MaxMind-DB-Reader-php.git",
|
274 |
+
"reference": "1647820dfbcb552222fb5feb3a8387e2636394c9"
|
275 |
+
},
|
276 |
+
"dist": {
|
277 |
+
"type": "zip",
|
278 |
+
"url": "https://api.github.com/repos/maxmind/MaxMind-DB-Reader-php/zipball/1647820dfbcb552222fb5feb3a8387e2636394c9",
|
279 |
+
"reference": "1647820dfbcb552222fb5feb3a8387e2636394c9",
|
280 |
+
"shasum": ""
|
281 |
+
},
|
282 |
+
"require": {
|
283 |
+
"php": ">=5.4"
|
284 |
+
},
|
285 |
+
"require-dev": {
|
286 |
+
"friendsofphp/php-cs-fixer": "2.*",
|
287 |
+
"phpunit/phpunit": "4.*",
|
288 |
+
"satooshi/php-coveralls": "1.0.*",
|
289 |
+
"squizlabs/php_codesniffer": "3.*"
|
290 |
+
},
|
291 |
+
"suggest": {
|
292 |
+
"ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
|
293 |
+
"ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder",
|
294 |
+
"ext-maxminddb": "A C-based database decoder that provides significantly faster lookups"
|
295 |
+
},
|
296 |
+
"type": "library",
|
297 |
+
"autoload": {
|
298 |
+
"psr-4": {
|
299 |
+
"MaxMind\\Db\\": "src/MaxMind/Db"
|
300 |
+
}
|
301 |
+
},
|
302 |
+
"notification-url": "https://packagist.org/downloads/",
|
303 |
+
"license": [
|
304 |
+
"Apache-2.0"
|
305 |
+
],
|
306 |
+
"authors": [
|
307 |
+
{
|
308 |
+
"name": "Gregory J. Oschwald",
|
309 |
+
"email": "goschwald@maxmind.com",
|
310 |
+
"homepage": "http://www.maxmind.com/"
|
311 |
+
}
|
312 |
+
],
|
313 |
+
"description": "MaxMind DB Reader API",
|
314 |
+
"homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php",
|
315 |
+
"keywords": [
|
316 |
+
"database",
|
317 |
+
"geoip",
|
318 |
+
"geoip2",
|
319 |
+
"geolocation",
|
320 |
+
"maxmind"
|
321 |
+
],
|
322 |
+
"time": "2017-10-27T19:15:33+00:00"
|
323 |
+
},
|
324 |
+
{
|
325 |
+
"name": "maxmind/web-service-common",
|
326 |
+
"version": "v0.4.0",
|
327 |
+
"source": {
|
328 |
+
"type": "git",
|
329 |
+
"url": "https://github.com/maxmind/web-service-common-php.git",
|
330 |
+
"reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88"
|
331 |
+
},
|
332 |
+
"dist": {
|
333 |
+
"type": "zip",
|
334 |
+
"url": "https://api.github.com/repos/maxmind/web-service-common-php/zipball/622f7c732a7f9c4c62497fc103939e042b6bdb88",
|
335 |
+
"reference": "622f7c732a7f9c4c62497fc103939e042b6bdb88",
|
336 |
+
"shasum": ""
|
337 |
+
},
|
338 |
+
"require": {
|
339 |
+
"composer/ca-bundle": "^1.0.3",
|
340 |
+
"ext-curl": "*",
|
341 |
+
"ext-json": "*",
|
342 |
+
"php": ">=5.4"
|
343 |
+
},
|
344 |
+
"require-dev": {
|
345 |
+
"friendsofphp/php-cs-fixer": "2.*",
|
346 |
+
"phpunit/phpunit": "4.*",
|
347 |
+
"squizlabs/php_codesniffer": "3.*"
|
348 |
+
},
|
349 |
+
"type": "library",
|
350 |
+
"autoload": {
|
351 |
+
"psr-4": {
|
352 |
+
"MaxMind\\Exception\\": "src/Exception",
|
353 |
+
"MaxMind\\WebService\\": "src/WebService"
|
354 |
+
}
|
355 |
+
},
|
356 |
+
"notification-url": "https://packagist.org/downloads/",
|
357 |
+
"license": [
|
358 |
+
"Apache-2.0"
|
359 |
+
],
|
360 |
+
"authors": [
|
361 |
+
{
|
362 |
+
"name": "Gregory Oschwald",
|
363 |
+
"email": "goschwald@maxmind.com"
|
364 |
+
}
|
365 |
+
],
|
366 |
+
"description": "Internal MaxMind Web Service API",
|
367 |
+
"homepage": "https://github.com/maxmind/web-service-common-php",
|
368 |
+
"time": "2017-07-06T17:48:21+00:00"
|
369 |
+
},
|
370 |
+
{
|
371 |
+
"name": "s1lentium/iptools",
|
372 |
+
"version": "v1.1.0",
|
373 |
+
"source": {
|
374 |
+
"type": "git",
|
375 |
+
"url": "https://github.com/S1lentium/IPTools.git",
|
376 |
+
"reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea"
|
377 |
+
},
|
378 |
+
"dist": {
|
379 |
+
"type": "zip",
|
380 |
+
"url": "https://api.github.com/repos/S1lentium/IPTools/zipball/cb4843d4077872643b5d38d18b8591b4aaf605ea",
|
381 |
+
"reference": "cb4843d4077872643b5d38d18b8591b4aaf605ea",
|
382 |
+
"shasum": ""
|
383 |
+
},
|
384 |
+
"require": {
|
385 |
+
"ext-bcmath": "*",
|
386 |
+
"php": ">=5.4.0"
|
387 |
+
},
|
388 |
+
"require-dev": {
|
389 |
+
"satooshi/php-coveralls": "~1.0"
|
390 |
+
},
|
391 |
+
"type": "library",
|
392 |
+
"autoload": {
|
393 |
+
"psr-4": {
|
394 |
+
"IPTools\\": "src/"
|
395 |
+
}
|
396 |
+
},
|
397 |
+
"notification-url": "https://packagist.org/downloads/",
|
398 |
+
"license": [
|
399 |
+
"MIT"
|
400 |
+
],
|
401 |
+
"authors": [
|
402 |
+
{
|
403 |
+
"name": "Safarov Alisher",
|
404 |
+
"email": "alisher.safarov@outlook.com",
|
405 |
+
"homepage": "https://github.com/S1lentium"
|
406 |
+
}
|
407 |
+
],
|
408 |
+
"description": "PHP Library for manipulating network addresses (IPv4 and IPv6)",
|
409 |
+
"keywords": [
|
410 |
+
"IP",
|
411 |
+
"IP-Tools",
|
412 |
+
"cidr",
|
413 |
+
"ipv4",
|
414 |
+
"ipv6",
|
415 |
+
"network",
|
416 |
+
"subnet"
|
417 |
+
],
|
418 |
+
"time": "2016-08-21T15:57:09+00:00"
|
419 |
+
}
|
420 |
+
],
|
421 |
+
"packages-dev": [],
|
422 |
+
"aliases": [],
|
423 |
+
"minimum-stability": "stable",
|
424 |
+
"stability-flags": [],
|
425 |
+
"prefer-stable": false,
|
426 |
+
"prefer-lowest": false,
|
427 |
+
"platform": [],
|
428 |
+
"platform-dev": []
|
429 |
+
}
|
includes/classes/class-wp-statistics-admin-pages.php
CHANGED
@@ -149,7 +149,7 @@ class WP_Statistics_Admin_Pages {
|
|
149 |
'wpstatistics-admin-css',
|
150 |
WP_Statistics::$reg['plugin-url'] . 'assets/css/admin.css',
|
151 |
true,
|
152 |
-
'
|
153 |
);
|
154 |
|
155 |
// Activate or deactivate the selected plugin
|
@@ -227,7 +227,7 @@ class WP_Statistics_Admin_Pages {
|
|
227 |
);
|
228 |
|
229 |
if ( is_rtl() ) {
|
230 |
-
wp_enqueue_style('rtl-css', WP_Statistics::$reg['plugin-url'] . 'assets/css/rtl.css', true, '
|
231 |
}
|
232 |
|
233 |
// Get the row count for each of the tables, we'll use this later on in the wps_optimization.php file.
|
@@ -504,7 +504,7 @@ class WP_Statistics_Admin_Pages {
|
|
504 |
break;
|
505 |
case 'top-pages':
|
506 |
// If we've been given a page id or uri to get statistics for, load the page stats, otherwise load the page stats overview page.
|
507 |
-
if ( array_key_exists('page-id', $_GET) || array_key_exists('page-uri', $_GET) ) {
|
508 |
include WP_Statistics::$reg['plugin-dir'] . 'includes/log/page-statistics.php';
|
509 |
} else {
|
510 |
include WP_Statistics::$reg['plugin-dir'] . 'includes/log/top-pages.php';
|
149 |
'wpstatistics-admin-css',
|
150 |
WP_Statistics::$reg['plugin-url'] . 'assets/css/admin.css',
|
151 |
true,
|
152 |
+
WP_Statistics::$reg['version']
|
153 |
);
|
154 |
|
155 |
// Activate or deactivate the selected plugin
|
227 |
);
|
228 |
|
229 |
if ( is_rtl() ) {
|
230 |
+
wp_enqueue_style('rtl-css', WP_Statistics::$reg['plugin-url'] . 'assets/css/rtl.css', true, WP_Statistics::$reg['version']);
|
231 |
}
|
232 |
|
233 |
// Get the row count for each of the tables, we'll use this later on in the wps_optimization.php file.
|
504 |
break;
|
505 |
case 'top-pages':
|
506 |
// If we've been given a page id or uri to get statistics for, load the page stats, otherwise load the page stats overview page.
|
507 |
+
if ( array_key_exists('page-id', $_GET) || array_key_exists('page-uri', $_GET) || array_key_exists('prepage', $_GET) ) {
|
508 |
include WP_Statistics::$reg['plugin-dir'] . 'includes/log/page-statistics.php';
|
509 |
} else {
|
510 |
include WP_Statistics::$reg['plugin-dir'] . 'includes/log/top-pages.php';
|
includes/classes/class-wp-statistics-admin.php
CHANGED
@@ -30,8 +30,6 @@ class WP_Statistics_Admin {
|
|
30 |
|
31 |
add_action('admin_init', 'WP_Statistics_Admin::export_data', 9);
|
32 |
|
33 |
-
WP_Statistics_Admin::set_pages();
|
34 |
-
|
35 |
add_action('wp_dashboard_setup', 'WP_Statistics_Dashboard::widget_load');
|
36 |
add_action('admin_footer', 'WP_Statistics_Dashboard::inline_javascript');
|
37 |
add_action('add_meta_boxes', 'WP_Statistics_Editor::add_meta_box');
|
@@ -65,120 +63,13 @@ class WP_Statistics_Admin {
|
|
65 |
add_action('network_admin_menu', 'WP_Statistics_Network_Admin::menu');
|
66 |
}
|
67 |
|
68 |
-
if ( $WP_Statistics->get_option('menu_bar') ) {
|
69 |
-
add_action('admin_bar_menu', 'WP_Statistics_Admin::menubar', 20);
|
70 |
-
}
|
71 |
-
|
72 |
add_action('admin_enqueue_scripts', 'WP_Statistics_Admin::enqueue_scripts');
|
73 |
add_action('admin_init', 'WP_Statistics_Shortcode::shortcake');
|
74 |
-
}
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
if ( ! isset( WP_Statistics::$page['overview'] ) ) {
|
81 |
-
/**
|
82 |
-
* Overview Page
|
83 |
-
*/
|
84 |
-
WP_Statistics::$page['overview'] = 'wps_overview_page';
|
85 |
-
//define('WP_STATISTICS_OVERVIEW_PAGE', 'wps_overview_page');
|
86 |
-
/**
|
87 |
-
* Browsers Page
|
88 |
-
*/
|
89 |
-
WP_Statistics::$page['browser'] = 'wps_browsers_page';
|
90 |
-
//define('WP_STATISTICS_BROWSERS_PAGE', 'wps_browsers_page');
|
91 |
-
/**
|
92 |
-
* Countries Page
|
93 |
-
*/
|
94 |
-
WP_Statistics::$page['countries'] = 'wps_countries_page';
|
95 |
-
//define('WP_STATISTICS_COUNTRIES_PAGE', 'wps_countries_page');
|
96 |
-
/**
|
97 |
-
* Exclusions Page
|
98 |
-
*/
|
99 |
-
WP_Statistics::$page['exclusions'] = 'wps_exclusions_page';
|
100 |
-
//define('WP_STATISTICS_EXCLUSIONS_PAGE', 'wps_exclusions_page');
|
101 |
-
/**
|
102 |
-
* Hits Page
|
103 |
-
*/
|
104 |
-
WP_Statistics::$page['hits'] = 'wps_hits_page';
|
105 |
-
//define('WP_STATISTICS_HITS_PAGE', 'wps_hits_page');
|
106 |
-
/**
|
107 |
-
* Online Page
|
108 |
-
*/
|
109 |
-
WP_Statistics::$page['online'] = 'wps_online_page';
|
110 |
-
//define('WP_STATISTICS_ONLINE_PAGE', 'wps_online_page');
|
111 |
-
/**
|
112 |
-
* Pages Page
|
113 |
-
*/
|
114 |
-
WP_Statistics::$page['pages'] = 'wps_pages_page';
|
115 |
-
//define('WP_STATISTICS_PAGES_PAGE', 'wps_pages_page');
|
116 |
-
/**
|
117 |
-
* Categories Page
|
118 |
-
*/
|
119 |
-
WP_Statistics::$page['categories'] = 'wps_categories_page';
|
120 |
-
//define('WP_STATISTICS_CATEGORIES_PAGE', 'wps_categories_page');
|
121 |
-
/**
|
122 |
-
* Authors Page
|
123 |
-
*/
|
124 |
-
WP_Statistics::$page['authors'] = 'wps_authors_page';
|
125 |
-
//define('WP_STATISTICS_AUTHORS_PAGE', 'wps_authors_page');
|
126 |
-
/**
|
127 |
-
* Tags Page
|
128 |
-
*/
|
129 |
-
WP_Statistics::$page['tags'] = 'wps_tags_page';
|
130 |
-
//define('WP_STATISTICS_TAGS_PAGE', 'wps_tags_page');
|
131 |
-
/**
|
132 |
-
* Referer Page
|
133 |
-
*/
|
134 |
-
WP_Statistics::$page['referrers'] = 'wps_referrers_page';
|
135 |
-
//define('WP_STATISTICS_REFERRERS_PAGE', 'wps_referrers_page');
|
136 |
-
/**
|
137 |
-
* Searched Phrases Page
|
138 |
-
*/
|
139 |
-
WP_Statistics::$page['searched-phrases'] = 'wps_searched_phrases_page';
|
140 |
-
//define('WP_STATISTICS_SEARCHED_PHRASES_PAGE', 'wps_searched_phrases_page');
|
141 |
-
/**
|
142 |
-
* Searches Page
|
143 |
-
*/
|
144 |
-
WP_Statistics::$page['searches'] = 'wps_searches_page';
|
145 |
-
//define('WP_STATISTICS_SEARCHES_PAGE', 'wps_searches_page');
|
146 |
-
/**
|
147 |
-
* Words Page
|
148 |
-
*/
|
149 |
-
WP_Statistics::$page['words'] = 'wps_words_page';
|
150 |
-
//define('WP_STATISTICS_WORDS_PAGE', 'wps_words_page');
|
151 |
-
/**
|
152 |
-
* Top Visitors Page
|
153 |
-
*/
|
154 |
-
WP_Statistics::$page['top-visitors'] = 'wps_top_visitors_page';
|
155 |
-
//define('WP_STATISTICS_TOP_VISITORS_PAGE', 'wps_top_visitors_page');
|
156 |
-
/**
|
157 |
-
* Visitors Page
|
158 |
-
*/
|
159 |
-
WP_Statistics::$page['visitors'] = 'wps_visitors_page';
|
160 |
-
//define('WP_STATISTICS_VISITORS_PAGE', 'wps_visitors_page');
|
161 |
-
/**
|
162 |
-
* Optimization Page
|
163 |
-
*/
|
164 |
-
WP_Statistics::$page['optimization'] = 'wps_optimization_page';
|
165 |
-
//define('WP_STATISTICS_OPTIMIZATION_PAGE', 'wps_optimization_page');
|
166 |
-
/**
|
167 |
-
* Settings Page
|
168 |
-
*/
|
169 |
-
WP_Statistics::$page['settings'] = 'wps_settings_page';
|
170 |
-
//define('WP_STATISTICS_SETTINGS_PAGE', 'wps_settings_page');
|
171 |
-
/**
|
172 |
-
* Plugins Page
|
173 |
-
*/
|
174 |
-
WP_Statistics::$page['plugins'] = 'wps_plugins_page';
|
175 |
-
//define('WP_STATISTICS_PLUGINS_PAGE', 'wps_plugins_page');
|
176 |
-
/**
|
177 |
-
* Donate Page
|
178 |
-
*/
|
179 |
-
WP_Statistics::$page['donate'] = 'wps_donate_page';
|
180 |
-
//define('WP_STATISTICS_DONATE_PAGE', 'wps_donate_page');
|
181 |
-
}
|
182 |
}
|
183 |
|
184 |
/**
|
@@ -217,7 +108,6 @@ class WP_Statistics_Admin {
|
|
217 |
<?php
|
218 |
}
|
219 |
|
220 |
-
|
221 |
/**
|
222 |
* This function outputs error messages in the admin interface
|
223 |
* if the primary components of WP Statistics are enabled.
|
@@ -672,109 +562,6 @@ class WP_Statistics_Admin {
|
|
672 |
|
673 |
}
|
674 |
|
675 |
-
/**
|
676 |
-
* Adds the admin bar menu if the user has selected it.
|
677 |
-
*/
|
678 |
-
static function menubar() {
|
679 |
-
GLOBAL $wp_admin_bar, $wp_version, $WP_Statistics;
|
680 |
-
|
681 |
-
// Find out if the user can read or manage statistics.
|
682 |
-
$read = current_user_can(
|
683 |
-
wp_statistics_validate_capability(
|
684 |
-
$WP_Statistics->get_option(
|
685 |
-
'read_capability',
|
686 |
-
'manage_options'
|
687 |
-
)
|
688 |
-
)
|
689 |
-
);
|
690 |
-
$manage = current_user_can(
|
691 |
-
wp_statistics_validate_capability(
|
692 |
-
$WP_Statistics->get_option(
|
693 |
-
'manage_capability',
|
694 |
-
'manage_options'
|
695 |
-
)
|
696 |
-
)
|
697 |
-
);
|
698 |
-
|
699 |
-
if ( is_admin_bar_showing() && ( $read || $manage ) ) {
|
700 |
-
|
701 |
-
$AdminURL = get_admin_url();
|
702 |
-
|
703 |
-
if ( version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=') ) {
|
704 |
-
$wp_admin_bar->add_menu(
|
705 |
-
array(
|
706 |
-
'id' => 'wp-statistic-menu',
|
707 |
-
'title' => '<span class="ab-icon"></span>',
|
708 |
-
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['overview'],
|
709 |
-
)
|
710 |
-
);
|
711 |
-
} else {
|
712 |
-
$wp_admin_bar->add_menu(
|
713 |
-
array(
|
714 |
-
'id' => 'wp-statistic-menu',
|
715 |
-
'title' => '<img src="' . WP_Statistics::$reg['plugin-url'] . 'assets/images/icon.png"/>',
|
716 |
-
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['overview'],
|
717 |
-
)
|
718 |
-
);
|
719 |
-
}
|
720 |
-
|
721 |
-
$wp_admin_bar->add_menu(
|
722 |
-
array(
|
723 |
-
'id' => 'wp-statistics-menu-useronline',
|
724 |
-
'parent' => 'wp-statistic-menu',
|
725 |
-
'title' => __(
|
726 |
-
'Online User',
|
727 |
-
'wp-statistics'
|
728 |
-
) . ": " . wp_statistics_useronline(),
|
729 |
-
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['online'],
|
730 |
-
)
|
731 |
-
);
|
732 |
-
|
733 |
-
$wp_admin_bar->add_menu(
|
734 |
-
array(
|
735 |
-
'id' => 'wp-statistics-menu-todayvisitor',
|
736 |
-
'parent' => 'wp-statistic-menu',
|
737 |
-
'title' => __('Today\'s Visitors', 'wp-statistics') . ": " . wp_statistics_visitor('today'),
|
738 |
-
)
|
739 |
-
);
|
740 |
-
|
741 |
-
$wp_admin_bar->add_menu(
|
742 |
-
array(
|
743 |
-
'id' => 'wp-statistics-menu-todayvisit',
|
744 |
-
'parent' => 'wp-statistic-menu',
|
745 |
-
'title' => __('Today\'s Visits', 'wp-statistics') . ": " . wp_statistics_visit('today'),
|
746 |
-
)
|
747 |
-
);
|
748 |
-
|
749 |
-
$wp_admin_bar->add_menu(
|
750 |
-
array(
|
751 |
-
'id' => 'wp-statistics-menu-yesterdayvisitor',
|
752 |
-
'parent' => 'wp-statistic-menu',
|
753 |
-
'title' => __('Yesterday\'s Visitors', 'wp-statistics') . ": " . wp_statistics_visitor(
|
754 |
-
'yesterday'
|
755 |
-
),
|
756 |
-
)
|
757 |
-
);
|
758 |
-
|
759 |
-
$wp_admin_bar->add_menu(
|
760 |
-
array(
|
761 |
-
'id' => 'wp-statistics-menu-yesterdayvisit',
|
762 |
-
'parent' => 'wp-statistic-menu',
|
763 |
-
'title' => __('Yesterday\'s Visits', 'wp-statistics') . ": " . wp_statistics_visit('yesterday'),
|
764 |
-
)
|
765 |
-
);
|
766 |
-
|
767 |
-
$wp_admin_bar->add_menu(
|
768 |
-
array(
|
769 |
-
'id' => 'wp-statistics-menu-viewstats',
|
770 |
-
'parent' => 'wp-statistic-menu',
|
771 |
-
'title' => __('View Stats', 'wp-statistics'),
|
772 |
-
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['overview'],
|
773 |
-
)
|
774 |
-
);
|
775 |
-
}
|
776 |
-
}
|
777 |
-
|
778 |
/**
|
779 |
* Enqueue Scripts
|
780 |
*
|
@@ -790,6 +577,10 @@ class WP_Statistics_Admin {
|
|
790 |
WP_Statistics::$reg['version']
|
791 |
);
|
792 |
|
|
|
|
|
|
|
|
|
793 |
if ( ! isset( $_GET['page'] ) ) {
|
794 |
return;
|
795 |
}
|
30 |
|
31 |
add_action('admin_init', 'WP_Statistics_Admin::export_data', 9);
|
32 |
|
|
|
|
|
33 |
add_action('wp_dashboard_setup', 'WP_Statistics_Dashboard::widget_load');
|
34 |
add_action('admin_footer', 'WP_Statistics_Dashboard::inline_javascript');
|
35 |
add_action('add_meta_boxes', 'WP_Statistics_Editor::add_meta_box');
|
63 |
add_action('network_admin_menu', 'WP_Statistics_Network_Admin::menu');
|
64 |
}
|
65 |
|
|
|
|
|
|
|
|
|
66 |
add_action('admin_enqueue_scripts', 'WP_Statistics_Admin::enqueue_scripts');
|
67 |
add_action('admin_init', 'WP_Statistics_Shortcode::shortcake');
|
|
|
68 |
|
69 |
+
// WP-Statistics welcome page hooks
|
70 |
+
add_action('admin_menu', 'WP_Statistics_Welcome::menu');
|
71 |
+
add_action('upgrader_process_complete', 'WP_Statistics_Welcome::do_welcome', 10, 2);
|
72 |
+
add_action('admin_init', 'WP_Statistics_Welcome::init');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
/**
|
108 |
<?php
|
109 |
}
|
110 |
|
|
|
111 |
/**
|
112 |
* This function outputs error messages in the admin interface
|
113 |
* if the primary components of WP Statistics are enabled.
|
562 |
|
563 |
}
|
564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
/**
|
566 |
* Enqueue Scripts
|
567 |
*
|
577 |
WP_Statistics::$reg['version']
|
578 |
);
|
579 |
|
580 |
+
if ( is_rtl() ) {
|
581 |
+
wp_enqueue_style('rtl-css', WP_Statistics::$reg['plugin-url'] . 'assets/css/rtl.css', true, WP_Statistics::$reg['version']);
|
582 |
+
}
|
583 |
+
|
584 |
if ( ! isset( $_GET['page'] ) ) {
|
585 |
return;
|
586 |
}
|
includes/classes/class-wp-statistics-frontend.php
CHANGED
@@ -15,6 +15,10 @@ class WP_Statistics_Frontend {
|
|
15 |
// Add the honey trap code in the footer.
|
16 |
add_action('wp_footer', 'WP_Statistics_Frontend::add_honeypot');
|
17 |
|
|
|
|
|
|
|
|
|
18 |
// We can wait until the very end of the page to process the statistics,
|
19 |
// that way the page loads and displays quickly.
|
20 |
add_action('wp', 'WP_Statistics_Frontend::init');
|
@@ -31,11 +35,25 @@ class WP_Statistics_Frontend {
|
|
31 |
}
|
32 |
}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
/**
|
35 |
* Shutdown Action
|
36 |
*/
|
37 |
static function init() {
|
38 |
-
|
39 |
global $WP_Statistics;
|
40 |
|
41 |
// If something has gone horribly wrong and $WP_Statistics isn't an object, bail out.
|
@@ -104,6 +122,41 @@ class WP_Statistics_Frontend {
|
|
104 |
$headers
|
105 |
);
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
}
|
15 |
// Add the honey trap code in the footer.
|
16 |
add_action('wp_footer', 'WP_Statistics_Frontend::add_honeypot');
|
17 |
|
18 |
+
if ( $WP_Statistics->get_option('menu_bar') ) {
|
19 |
+
add_action('wp_enqueue_scripts', 'WP_Statistics_Frontend::enqueue_scripts');
|
20 |
+
}
|
21 |
+
|
22 |
// We can wait until the very end of the page to process the statistics,
|
23 |
// that way the page loads and displays quickly.
|
24 |
add_action('wp', 'WP_Statistics_Frontend::init');
|
35 |
}
|
36 |
}
|
37 |
|
38 |
+
/**
|
39 |
+
* Enqueue Scripts
|
40 |
+
*
|
41 |
+
* @param string $hook Not Used
|
42 |
+
*/
|
43 |
+
static function enqueue_scripts( $hook ) {
|
44 |
+
// Load our CSS to be used.
|
45 |
+
wp_enqueue_style(
|
46 |
+
'wpstatistics-css',
|
47 |
+
WP_Statistics::$reg['plugin-url'] . 'assets/css/frontend.css',
|
48 |
+
true,
|
49 |
+
WP_Statistics::$reg['version']
|
50 |
+
);
|
51 |
+
}
|
52 |
+
|
53 |
/**
|
54 |
* Shutdown Action
|
55 |
*/
|
56 |
static function init() {
|
|
|
57 |
global $WP_Statistics;
|
58 |
|
59 |
// If something has gone horribly wrong and $WP_Statistics isn't an object, bail out.
|
122 |
$headers
|
123 |
);
|
124 |
}
|
125 |
+
|
126 |
+
// Check to show hits in posts/pages
|
127 |
+
if ( $WP_Statistics->get_option('show_hits') ) {
|
128 |
+
add_filter( 'the_content', 'WP_Statistics_Frontend::show_hits' );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* @param $content
|
134 |
+
*
|
135 |
+
* @return string
|
136 |
+
*/
|
137 |
+
public static function show_hits($content) {
|
138 |
+
global $WP_Statistics;
|
139 |
+
|
140 |
+
// Get post ID
|
141 |
+
$post_id = get_the_ID();
|
142 |
+
|
143 |
+
// Check post ID
|
144 |
+
if(!$post_id) {
|
145 |
+
return $content;
|
146 |
+
}
|
147 |
+
|
148 |
+
// Get post hits
|
149 |
+
$hits = wp_statistics_pages('total', "", $post_id);
|
150 |
+
$hits_html = sprintf(__('<p>Views: %s</p>', 'wp-statistics'), $hits);
|
151 |
+
|
152 |
+
// Check hits position
|
153 |
+
if ( $WP_Statistics->get_option('display_hits_position') == 'before_content' ) {
|
154 |
+
return $hits_html . $content;
|
155 |
+
} elseif ( $WP_Statistics->get_option('display_hits_position') == 'after_content' ) {
|
156 |
+
return $content . $hits_html;
|
157 |
+
} else {
|
158 |
+
return $content;
|
159 |
+
}
|
160 |
}
|
161 |
|
162 |
}
|
includes/classes/class-wp-statistics-welcome.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class WP_Statistics_Welcome
|
5 |
+
*/
|
6 |
+
class WP_Statistics_Welcome {
|
7 |
+
public static function init() {
|
8 |
+
global $WP_Statistics;
|
9 |
+
if ( $WP_Statistics->get_option( 'show_welcome_page', false ) and ( strpos( $_SERVER['REQUEST_URI'], '/wp-admin/index.php' ) !== false or ( isset( $_GET['page'] ) and $_GET['page'] == 'wps_overview_page' ) ) ) {
|
10 |
+
// Disable show welcome page
|
11 |
+
$WP_Statistics->update_option( 'first_show_welcome_page', true );
|
12 |
+
$WP_Statistics->update_option( 'show_welcome_page', false );
|
13 |
+
|
14 |
+
// Redirect to welcome page
|
15 |
+
wp_redirect( admin_url( 'admin.php?page=wps_welcome' ) );
|
16 |
+
}
|
17 |
+
|
18 |
+
if ( ! $WP_Statistics->get_option( 'first_show_welcome_page', false ) ) {
|
19 |
+
$WP_Statistics->update_option( 'show_welcome_page', true );
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Register menu
|
25 |
+
*/
|
26 |
+
public static function menu() {
|
27 |
+
add_submenu_page( null, 'WP-Statistics Welcome', 'WP-Statistics Welcome', 'administrator', 'wps_welcome', 'WP_Statistics_Welcome::page_callback' );
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Welcome page
|
32 |
+
*/
|
33 |
+
public static function page_callback() {
|
34 |
+
// Load our JS to be used.
|
35 |
+
wp_enqueue_script(
|
36 |
+
'wp-statistics-admin-js',
|
37 |
+
WP_Statistics::$reg['plugin-url'] . 'assets/js/admin.js',
|
38 |
+
array( 'jquery' ),
|
39 |
+
'1.0'
|
40 |
+
);
|
41 |
+
|
42 |
+
include( WP_Statistics::$reg['plugin-dir'] . "includes/templates/welcome.php" );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param $upgrader_object
|
47 |
+
* @param $options
|
48 |
+
*/
|
49 |
+
public static function do_welcome( $upgrader_object, $options ) {
|
50 |
+
$current_plugin_path_name = 'wp-statistics/wp-statistics.php';
|
51 |
+
|
52 |
+
if ( $options['action'] == 'update' && $options['type'] == 'plugin' ) {
|
53 |
+
foreach ( $options['plugins'] as $each_plugin ) {
|
54 |
+
if ( $each_plugin == $current_plugin_path_name ) {
|
55 |
+
global $WP_Statistics;
|
56 |
+
|
57 |
+
// Enable welcome page in database
|
58 |
+
$WP_Statistics->update_option( 'show_welcome_page', true );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
public static function show_change_log() {
|
65 |
+
$response = wp_remote_get( 'https://api.github.com/repos/wp-statistics/wp-statistics/releases/latest' );
|
66 |
+
|
67 |
+
// Check response
|
68 |
+
if ( is_wp_error( $response ) ) {
|
69 |
+
return;
|
70 |
+
}
|
71 |
+
|
72 |
+
$response_code = wp_remote_retrieve_response_code( $response );
|
73 |
+
|
74 |
+
if ( $response_code == '200' ) {
|
75 |
+
$data = json_decode( $response['body'] );
|
76 |
+
$Parsedown = new Parsedown();
|
77 |
+
|
78 |
+
echo $Parsedown->text( nl2br( $data->body ) );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
includes/classes/class-wp-statistics.php
CHANGED
@@ -178,6 +178,7 @@ class WP_Statistics {
|
|
178 |
$this->load_options();
|
179 |
$this->get_IP();
|
180 |
$this->set_ip_hash();
|
|
|
181 |
|
182 |
// Autoload composer
|
183 |
require( WP_Statistics::$reg['plugin-dir'] . 'includes/vendor/autoload.php' );
|
@@ -208,6 +209,10 @@ class WP_Statistics {
|
|
208 |
new WP_Statistics_Frontend;
|
209 |
}
|
210 |
|
|
|
|
|
|
|
|
|
211 |
add_action('widgets_init', 'WP_Statistics::widget');
|
212 |
add_shortcode('wpstatistics', 'WP_Statistics_Shortcode::shortcodes');
|
213 |
}
|
@@ -253,6 +258,114 @@ class WP_Statistics {
|
|
253 |
}
|
254 |
}
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
/**
|
257 |
* Set Coefficient
|
258 |
*/
|
@@ -798,7 +911,7 @@ class WP_Statistics {
|
|
798 |
|
799 |
// If there were no search words, let's add the page title
|
800 |
if ( $result == '' || $result == 'No search query found!' ) {
|
801 |
-
$result =
|
802 |
if ( $result != '' ) {
|
803 |
$this->referrer = esc_url(
|
804 |
add_query_arg(
|
@@ -1292,4 +1405,108 @@ class WP_Statistics {
|
|
1292 |
|
1293 |
<?php
|
1294 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1295 |
}
|
178 |
$this->load_options();
|
179 |
$this->get_IP();
|
180 |
$this->set_ip_hash();
|
181 |
+
$this->set_pages();
|
182 |
|
183 |
// Autoload composer
|
184 |
require( WP_Statistics::$reg['plugin-dir'] . 'includes/vendor/autoload.php' );
|
209 |
new WP_Statistics_Frontend;
|
210 |
}
|
211 |
|
212 |
+
if ( $WP_Statistics->get_option('menu_bar') ) {
|
213 |
+
add_action('admin_bar_menu', 'WP_Statistics::menubar', 20);
|
214 |
+
}
|
215 |
+
|
216 |
add_action('widgets_init', 'WP_Statistics::widget');
|
217 |
add_shortcode('wpstatistics', 'WP_Statistics_Shortcode::shortcodes');
|
218 |
}
|
258 |
}
|
259 |
}
|
260 |
|
261 |
+
/**
|
262 |
+
* Set pages slugs
|
263 |
+
*/
|
264 |
+
public function set_pages() {
|
265 |
+
if ( ! isset( WP_Statistics::$page['overview'] ) ) {
|
266 |
+
/**
|
267 |
+
* Overview Page
|
268 |
+
*/
|
269 |
+
WP_Statistics::$page['overview'] = 'wps_overview_page';
|
270 |
+
//define('WP_STATISTICS_OVERVIEW_PAGE', 'wps_overview_page');
|
271 |
+
/**
|
272 |
+
* Browsers Page
|
273 |
+
*/
|
274 |
+
WP_Statistics::$page['browser'] = 'wps_browsers_page';
|
275 |
+
//define('WP_STATISTICS_BROWSERS_PAGE', 'wps_browsers_page');
|
276 |
+
/**
|
277 |
+
* Countries Page
|
278 |
+
*/
|
279 |
+
WP_Statistics::$page['countries'] = 'wps_countries_page';
|
280 |
+
//define('WP_STATISTICS_COUNTRIES_PAGE', 'wps_countries_page');
|
281 |
+
/**
|
282 |
+
* Exclusions Page
|
283 |
+
*/
|
284 |
+
WP_Statistics::$page['exclusions'] = 'wps_exclusions_page';
|
285 |
+
//define('WP_STATISTICS_EXCLUSIONS_PAGE', 'wps_exclusions_page');
|
286 |
+
/**
|
287 |
+
* Hits Page
|
288 |
+
*/
|
289 |
+
WP_Statistics::$page['hits'] = 'wps_hits_page';
|
290 |
+
//define('WP_STATISTICS_HITS_PAGE', 'wps_hits_page');
|
291 |
+
/**
|
292 |
+
* Online Page
|
293 |
+
*/
|
294 |
+
WP_Statistics::$page['online'] = 'wps_online_page';
|
295 |
+
//define('WP_STATISTICS_ONLINE_PAGE', 'wps_online_page');
|
296 |
+
/**
|
297 |
+
* Pages Page
|
298 |
+
*/
|
299 |
+
WP_Statistics::$page['pages'] = 'wps_pages_page';
|
300 |
+
//define('WP_STATISTICS_PAGES_PAGE', 'wps_pages_page');
|
301 |
+
/**
|
302 |
+
* Categories Page
|
303 |
+
*/
|
304 |
+
WP_Statistics::$page['categories'] = 'wps_categories_page';
|
305 |
+
//define('WP_STATISTICS_CATEGORIES_PAGE', 'wps_categories_page');
|
306 |
+
/**
|
307 |
+
* Authors Page
|
308 |
+
*/
|
309 |
+
WP_Statistics::$page['authors'] = 'wps_authors_page';
|
310 |
+
//define('WP_STATISTICS_AUTHORS_PAGE', 'wps_authors_page');
|
311 |
+
/**
|
312 |
+
* Tags Page
|
313 |
+
*/
|
314 |
+
WP_Statistics::$page['tags'] = 'wps_tags_page';
|
315 |
+
//define('WP_STATISTICS_TAGS_PAGE', 'wps_tags_page');
|
316 |
+
/**
|
317 |
+
* Referer Page
|
318 |
+
*/
|
319 |
+
WP_Statistics::$page['referrers'] = 'wps_referrers_page';
|
320 |
+
//define('WP_STATISTICS_REFERRERS_PAGE', 'wps_referrers_page');
|
321 |
+
/**
|
322 |
+
* Searched Phrases Page
|
323 |
+
*/
|
324 |
+
WP_Statistics::$page['searched-phrases'] = 'wps_searched_phrases_page';
|
325 |
+
//define('WP_STATISTICS_SEARCHED_PHRASES_PAGE', 'wps_searched_phrases_page');
|
326 |
+
/**
|
327 |
+
* Searches Page
|
328 |
+
*/
|
329 |
+
WP_Statistics::$page['searches'] = 'wps_searches_page';
|
330 |
+
//define('WP_STATISTICS_SEARCHES_PAGE', 'wps_searches_page');
|
331 |
+
/**
|
332 |
+
* Words Page
|
333 |
+
*/
|
334 |
+
WP_Statistics::$page['words'] = 'wps_words_page';
|
335 |
+
//define('WP_STATISTICS_WORDS_PAGE', 'wps_words_page');
|
336 |
+
/**
|
337 |
+
* Top Visitors Page
|
338 |
+
*/
|
339 |
+
WP_Statistics::$page['top-visitors'] = 'wps_top_visitors_page';
|
340 |
+
//define('WP_STATISTICS_TOP_VISITORS_PAGE', 'wps_top_visitors_page');
|
341 |
+
/**
|
342 |
+
* Visitors Page
|
343 |
+
*/
|
344 |
+
WP_Statistics::$page['visitors'] = 'wps_visitors_page';
|
345 |
+
//define('WP_STATISTICS_VISITORS_PAGE', 'wps_visitors_page');
|
346 |
+
/**
|
347 |
+
* Optimization Page
|
348 |
+
*/
|
349 |
+
WP_Statistics::$page['optimization'] = 'wps_optimization_page';
|
350 |
+
//define('WP_STATISTICS_OPTIMIZATION_PAGE', 'wps_optimization_page');
|
351 |
+
/**
|
352 |
+
* Settings Page
|
353 |
+
*/
|
354 |
+
WP_Statistics::$page['settings'] = 'wps_settings_page';
|
355 |
+
//define('WP_STATISTICS_SETTINGS_PAGE', 'wps_settings_page');
|
356 |
+
/**
|
357 |
+
* Plugins Page
|
358 |
+
*/
|
359 |
+
WP_Statistics::$page['plugins'] = 'wps_plugins_page';
|
360 |
+
//define('WP_STATISTICS_PLUGINS_PAGE', 'wps_plugins_page');
|
361 |
+
/**
|
362 |
+
* Donate Page
|
363 |
+
*/
|
364 |
+
WP_Statistics::$page['donate'] = 'wps_donate_page';
|
365 |
+
//define('WP_STATISTICS_DONATE_PAGE', 'wps_donate_page');
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
/**
|
370 |
* Set Coefficient
|
371 |
*/
|
911 |
|
912 |
// If there were no search words, let's add the page title
|
913 |
if ( $result == '' || $result == 'No search query found!' ) {
|
914 |
+
$result = get_bloginfo('title');
|
915 |
if ( $result != '' ) {
|
916 |
$this->referrer = esc_url(
|
917 |
add_query_arg(
|
1405 |
|
1406 |
<?php
|
1407 |
}
|
1408 |
+
|
1409 |
+
/**
|
1410 |
+
* Adds the admin bar menu if the user has selected it.
|
1411 |
+
*/
|
1412 |
+
static function menubar() {
|
1413 |
+
GLOBAL $wp_admin_bar, $wp_version, $WP_Statistics;
|
1414 |
+
|
1415 |
+
// Find out if the user can read or manage statistics.
|
1416 |
+
$read = current_user_can(
|
1417 |
+
wp_statistics_validate_capability(
|
1418 |
+
$WP_Statistics->get_option(
|
1419 |
+
'read_capability',
|
1420 |
+
'manage_options'
|
1421 |
+
)
|
1422 |
+
)
|
1423 |
+
);
|
1424 |
+
$manage = current_user_can(
|
1425 |
+
wp_statistics_validate_capability(
|
1426 |
+
$WP_Statistics->get_option(
|
1427 |
+
'manage_capability',
|
1428 |
+
'manage_options'
|
1429 |
+
)
|
1430 |
+
)
|
1431 |
+
);
|
1432 |
+
|
1433 |
+
if ( is_admin_bar_showing() && ( $read || $manage ) ) {
|
1434 |
+
|
1435 |
+
$AdminURL = get_admin_url();
|
1436 |
+
|
1437 |
+
if ( version_compare($wp_version, '3.8-RC', '>=') || version_compare($wp_version, '3.8', '>=') ) {
|
1438 |
+
$wp_admin_bar->add_menu(
|
1439 |
+
array(
|
1440 |
+
'id' => 'wp-statistic-menu',
|
1441 |
+
'title' => '<span class="ab-icon"></span>',
|
1442 |
+
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['overview'],
|
1443 |
+
)
|
1444 |
+
);
|
1445 |
+
} else {
|
1446 |
+
$wp_admin_bar->add_menu(
|
1447 |
+
array(
|
1448 |
+
'id' => 'wp-statistic-menu',
|
1449 |
+
'title' => '<img src="' . WP_Statistics::$reg['plugin-url'] . 'assets/images/icon.png"/>',
|
1450 |
+
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['overview'],
|
1451 |
+
)
|
1452 |
+
);
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
$wp_admin_bar->add_menu(
|
1456 |
+
array(
|
1457 |
+
'id' => 'wp-statistics-menu-useronline',
|
1458 |
+
'parent' => 'wp-statistic-menu',
|
1459 |
+
'title' => __(
|
1460 |
+
'Online User',
|
1461 |
+
'wp-statistics'
|
1462 |
+
) . ": " . wp_statistics_useronline(),
|
1463 |
+
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['online'],
|
1464 |
+
)
|
1465 |
+
);
|
1466 |
+
|
1467 |
+
$wp_admin_bar->add_menu(
|
1468 |
+
array(
|
1469 |
+
'id' => 'wp-statistics-menu-todayvisitor',
|
1470 |
+
'parent' => 'wp-statistic-menu',
|
1471 |
+
'title' => __('Today\'s Visitors', 'wp-statistics') . ": " . wp_statistics_visitor('today'),
|
1472 |
+
)
|
1473 |
+
);
|
1474 |
+
|
1475 |
+
$wp_admin_bar->add_menu(
|
1476 |
+
array(
|
1477 |
+
'id' => 'wp-statistics-menu-todayvisit',
|
1478 |
+
'parent' => 'wp-statistic-menu',
|
1479 |
+
'title' => __('Today\'s Visits', 'wp-statistics') . ": " . wp_statistics_visit('today'),
|
1480 |
+
)
|
1481 |
+
);
|
1482 |
+
|
1483 |
+
$wp_admin_bar->add_menu(
|
1484 |
+
array(
|
1485 |
+
'id' => 'wp-statistics-menu-yesterdayvisitor',
|
1486 |
+
'parent' => 'wp-statistic-menu',
|
1487 |
+
'title' => __('Yesterday\'s Visitors', 'wp-statistics') . ": " . wp_statistics_visitor(
|
1488 |
+
'yesterday'
|
1489 |
+
),
|
1490 |
+
)
|
1491 |
+
);
|
1492 |
+
|
1493 |
+
$wp_admin_bar->add_menu(
|
1494 |
+
array(
|
1495 |
+
'id' => 'wp-statistics-menu-yesterdayvisit',
|
1496 |
+
'parent' => 'wp-statistic-menu',
|
1497 |
+
'title' => __('Yesterday\'s Visits', 'wp-statistics') . ": " . wp_statistics_visit('yesterday'),
|
1498 |
+
)
|
1499 |
+
);
|
1500 |
+
|
1501 |
+
$wp_admin_bar->add_menu(
|
1502 |
+
array(
|
1503 |
+
'id' => 'wp-statistics-menu-viewstats',
|
1504 |
+
'parent' => 'wp-statistic-menu',
|
1505 |
+
'title' => __('View Stats', 'wp-statistics'),
|
1506 |
+
'href' => $AdminURL . 'admin.php?page=' . WP_Statistics::$page['overview'],
|
1507 |
+
)
|
1508 |
+
);
|
1509 |
+
}
|
1510 |
+
}
|
1511 |
+
|
1512 |
}
|
includes/functions/functions.php
CHANGED
@@ -1274,7 +1274,7 @@ function wp_statistics_date_range_selector(
|
|
1274 |
parse_str($extrafields, $parse);
|
1275 |
|
1276 |
foreach ( $parse as $key => $value ) {
|
1277 |
-
echo '<input type="hidden" name="' . $key . '" value="' .
|
1278 |
}
|
1279 |
|
1280 |
if ( $bold ) {
|
1274 |
parse_str($extrafields, $parse);
|
1275 |
|
1276 |
foreach ( $parse as $key => $value ) {
|
1277 |
+
echo '<input type="hidden" name="' . $key . '" value="' . esc_sql($value) . '">';
|
1278 |
}
|
1279 |
|
1280 |
if ( $bold ) {
|
includes/log/authors.php
CHANGED
@@ -92,7 +92,7 @@
|
|
92 |
}
|
93 |
|
94 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
95 |
-
$date[] = "'" . $WP_Statistics->Real_Current_Date('M j', '-' .
|
96 |
|
97 |
$stat = 0;
|
98 |
foreach ( $posts as $post ) {
|
92 |
}
|
93 |
|
94 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
95 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
96 |
|
97 |
$stat = 0;
|
98 |
foreach ( $posts as $post ) {
|
includes/log/categories.php
CHANGED
@@ -17,11 +17,13 @@
|
|
17 |
} else {
|
18 |
$rangestart = '';
|
19 |
}
|
|
|
20 |
if ( array_key_exists('rangeend', $_GET) ) {
|
21 |
$rangeend = $_GET['rangeend'];
|
22 |
} else {
|
23 |
$rangeend = '';
|
24 |
}
|
|
|
25 |
if ( array_key_exists('cat', $_GET) ) {
|
26 |
$category = intval($_GET['cat']);
|
27 |
} else {
|
@@ -75,7 +77,7 @@
|
|
75 |
}
|
76 |
|
77 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
78 |
-
$date[] = "'" . $WP_Statistics->Real_Current_Date('M j', '-' .
|
79 |
|
80 |
$stat = 0;
|
81 |
foreach ( $posts as $post ) {
|
17 |
} else {
|
18 |
$rangestart = '';
|
19 |
}
|
20 |
+
|
21 |
if ( array_key_exists('rangeend', $_GET) ) {
|
22 |
$rangeend = $_GET['rangeend'];
|
23 |
} else {
|
24 |
$rangeend = '';
|
25 |
}
|
26 |
+
|
27 |
if ( array_key_exists('cat', $_GET) ) {
|
28 |
$category = intval($_GET['cat']);
|
29 |
} else {
|
77 |
}
|
78 |
|
79 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
80 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
81 |
|
82 |
$stat = 0;
|
83 |
foreach ( $posts as $post ) {
|
includes/log/exclusions.php
CHANGED
@@ -158,7 +158,7 @@ if ( $total_stats == 1 ) {
|
|
158 |
}
|
159 |
|
160 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
161 |
-
$date[] = "'" . $WP_Statistics->
|
162 |
}
|
163 |
|
164 |
$stats = array();
|
158 |
}
|
159 |
|
160 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
161 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
162 |
}
|
163 |
|
164 |
$stats = array();
|
includes/log/hit-statistics.php
CHANGED
@@ -27,6 +27,7 @@
|
|
27 |
$rangestart,
|
28 |
$rangeend
|
29 |
);
|
|
|
30 |
wp_statistics_date_range_selector(WP_Statistics::$page['hits'], $daysToDisplay);
|
31 |
|
32 |
$visit_total = 0;
|
@@ -48,7 +49,7 @@
|
|
48 |
}
|
49 |
|
50 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
51 |
-
$date[] = "'" . $WP_Statistics->
|
52 |
}
|
53 |
?>
|
54 |
<div class="postbox-container" id="last-log">
|
27 |
$rangestart,
|
28 |
$rangeend
|
29 |
);
|
30 |
+
|
31 |
wp_statistics_date_range_selector(WP_Statistics::$page['hits'], $daysToDisplay);
|
32 |
|
33 |
$visit_total = 0;
|
49 |
}
|
50 |
|
51 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
52 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
53 |
}
|
54 |
?>
|
55 |
<div class="postbox-container" id="last-log">
|
includes/log/page-statistics.php
CHANGED
@@ -1,70 +1,83 @@
|
|
1 |
<script type="text/javascript">
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
</script>
|
6 |
<?php
|
7 |
-
if ( array_key_exists('page-uri', $_GET) ) {
|
8 |
$pageuri = $_GET['page-uri'];
|
9 |
} else {
|
10 |
$pageuri = null;
|
11 |
}
|
12 |
-
if ( array_key_exists('page-id', $_GET) ) {
|
13 |
$pageid = (int) $_GET['page-id'];
|
|
|
|
|
14 |
} else {
|
15 |
$pageid = null;
|
16 |
}
|
17 |
|
18 |
if ( $pageuri && ! $pageid ) {
|
19 |
-
$pageid = wp_statistics_uri_to_id($pageuri);
|
20 |
}
|
21 |
|
22 |
-
$post = get_post($pageid);
|
23 |
-
if ( is_object($post) ) {
|
24 |
$title = $post->post_title;
|
25 |
} else {
|
26 |
$title = "";
|
27 |
}
|
28 |
|
29 |
-
$urlfields = "&page-id={$pageid}";
|
30 |
-
if ( $pageuri ) {
|
31 |
-
$urlfields .= "&page-uri={$pageuri}";
|
32 |
-
}
|
33 |
-
|
34 |
$daysToDisplay = 20;
|
35 |
-
if ( array_key_exists('hitdays', $_GET) ) {
|
36 |
-
$daysToDisplay = intval($_GET['hitdays']);
|
37 |
}
|
38 |
|
39 |
-
if ( array_key_exists('rangestart', $_GET) ) {
|
40 |
$rangestart = $_GET['rangestart'];
|
41 |
} else {
|
42 |
$rangestart = '';
|
43 |
}
|
44 |
-
if ( array_key_exists('rangeend', $_GET) ) {
|
45 |
$rangeend = $_GET['rangeend'];
|
46 |
} else {
|
47 |
$rangeend = '';
|
48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
?>
|
50 |
<div class="wrap">
|
51 |
-
|
52 |
-
<?php wp_statistics_date_range_selector(WP_Statistics::$page['pages'], $daysToDisplay, null, null, $urlfields); ?>
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
<?php $paneltitle = __('Page Trend', 'wp-statistics'); ?>
|
58 |
-
|
59 |
<span class="screen-reader-text"><?php printf(
|
60 |
-
__('Toggle panel: %s', 'wp-statistics'),
|
61 |
$paneltitle
|
62 |
); ?></span>
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
<?php
|
69 |
include( WP_Statistics::$reg['plugin-dir'] . 'includes/log/widgets/page.php' );
|
70 |
wp_statistics_generate_page_postbox_content(
|
@@ -75,9 +88,9 @@ if ( array_key_exists('rangeend', $_GET) ) {
|
|
75 |
$rangestart,
|
76 |
$rangeend
|
77 |
); ?>
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
</div>
|
1 |
<script type="text/javascript">
|
2 |
+
jQuery(document).ready(function () {
|
3 |
+
postboxes.add_postbox_toggles(pagenow);
|
4 |
+
});
|
5 |
</script>
|
6 |
<?php
|
7 |
+
if ( array_key_exists( 'page-uri', $_GET ) ) {
|
8 |
$pageuri = $_GET['page-uri'];
|
9 |
} else {
|
10 |
$pageuri = null;
|
11 |
}
|
12 |
+
if ( array_key_exists( 'page-id', $_GET ) ) {
|
13 |
$pageid = (int) $_GET['page-id'];
|
14 |
+
} else if ( array_key_exists( 'prepage', $_GET ) ) {
|
15 |
+
$pageid = (int) $_GET['prepage'];
|
16 |
} else {
|
17 |
$pageid = null;
|
18 |
}
|
19 |
|
20 |
if ( $pageuri && ! $pageid ) {
|
21 |
+
$pageid = wp_statistics_uri_to_id( $pageuri );
|
22 |
}
|
23 |
|
24 |
+
$post = get_post( $pageid );
|
25 |
+
if ( is_object( $post ) ) {
|
26 |
$title = $post->post_title;
|
27 |
} else {
|
28 |
$title = "";
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
$daysToDisplay = 20;
|
32 |
+
if ( array_key_exists( 'hitdays', $_GET ) ) {
|
33 |
+
$daysToDisplay = intval( $_GET['hitdays'] );
|
34 |
}
|
35 |
|
36 |
+
if ( array_key_exists( 'rangestart', $_GET ) ) {
|
37 |
$rangestart = $_GET['rangestart'];
|
38 |
} else {
|
39 |
$rangestart = '';
|
40 |
}
|
41 |
+
if ( array_key_exists( 'rangeend', $_GET ) ) {
|
42 |
$rangeend = $_GET['rangeend'];
|
43 |
} else {
|
44 |
$rangeend = '';
|
45 |
}
|
46 |
+
|
47 |
+
if ( array_key_exists( 'page-id', $_GET ) ) {
|
48 |
+
$page = intval( $_GET['page-id'] );
|
49 |
+
} else {
|
50 |
+
if ( array_key_exists( 'prepage', $_GET ) ) {
|
51 |
+
$page = intval( $_GET['prepage'] );
|
52 |
+
} else {
|
53 |
+
$page = 0;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
$urlfields = '&prepage=' . $pageid;
|
58 |
+
$html = __( 'Select Page', 'wp-statistics' ) . ': ';
|
59 |
+
$html .= wp_dropdown_pages( array( 'selected' => $pageid, 'echo' => 0, 'name' => 'page-id' ) );
|
60 |
+
$html .= '<input type="submit" value="' . __( 'Select', 'wp-statistics' ) . '" class="button-primary">';
|
61 |
+
$html .= '<br>';
|
62 |
?>
|
63 |
<div class="wrap">
|
64 |
+
<h2><?php echo sprintf( __( 'Page Trend for Post ID %s', 'wp-statistics' ), $pageid ) . ' - ' . $title; ?></h2>
|
65 |
+
<?php wp_statistics_date_range_selector( WP_Statistics::$page['pages'], $daysToDisplay, null, null, $urlfields, $html ); ?>
|
66 |
+
<div class="postbox-container" id="last-log">
|
67 |
+
<div class="metabox-holder">
|
68 |
+
<div class="meta-box-sortables">
|
69 |
+
<div class="postbox">
|
70 |
+
<?php $paneltitle = __( 'Page Trend', 'wp-statistics' ); ?>
|
71 |
+
<button class="handlediv" type="button" aria-expanded="true">
|
72 |
<span class="screen-reader-text"><?php printf(
|
73 |
+
__( 'Toggle panel: %s', 'wp-statistics' ),
|
74 |
$paneltitle
|
75 |
); ?></span>
|
76 |
+
<span class="toggle-indicator" aria-hidden="true"></span>
|
77 |
+
</button>
|
78 |
+
<h2 class="hndle"><span><?php echo $paneltitle; ?></span></h2>
|
79 |
|
80 |
+
<div class="inside">
|
81 |
<?php
|
82 |
include( WP_Statistics::$reg['plugin-dir'] . 'includes/log/widgets/page.php' );
|
83 |
wp_statistics_generate_page_postbox_content(
|
88 |
$rangestart,
|
89 |
$rangeend
|
90 |
); ?>
|
91 |
+
</div>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
</div>
|
includes/log/search-statistics.php
CHANGED
@@ -47,7 +47,7 @@ foreach ( $search_engines as $se ) {
|
|
47 |
}
|
48 |
|
49 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
50 |
-
$date[] = "'" . $WP_Statistics->Real_Current_Date('M j', '-' .
|
51 |
}
|
52 |
?>
|
53 |
<div class="wrap">
|
47 |
}
|
48 |
|
49 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
50 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
51 |
}
|
52 |
?>
|
53 |
<div class="wrap">
|
includes/log/tags.php
CHANGED
@@ -88,7 +88,7 @@
|
|
88 |
}
|
89 |
|
90 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
91 |
-
$date[] = "'" . $WP_Statistics->Real_Current_Date('M j', '-' .
|
92 |
|
93 |
$stat = 0;
|
94 |
foreach ( $posts as $post ) {
|
88 |
}
|
89 |
|
90 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
91 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
92 |
|
93 |
$stat = 0;
|
94 |
foreach ( $posts as $post ) {
|
includes/log/top-pages.php
CHANGED
@@ -46,7 +46,7 @@ foreach ( $uris as $uri ) {
|
|
46 |
}
|
47 |
|
48 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
49 |
-
$date[] = "'" . $WP_Statistics->
|
50 |
}
|
51 |
?>
|
52 |
<div class="wrap">
|
46 |
}
|
47 |
|
48 |
for ( $i = $daysToDisplay; $i >= 0; $i-- ) {
|
49 |
+
$date[] = "'" . $WP_Statistics->Real_Current_Date( 'M j', '-' . $i, $rangeend_utime ) . "'";
|
50 |
}
|
51 |
?>
|
52 |
<div class="wrap">
|
includes/log/widgets/about.php
CHANGED
@@ -31,15 +31,6 @@ function wp_statistics_generate_about_postbox_content() {
|
|
31 |
}
|
32 |
?>
|
33 |
</div>
|
34 |
-
|
35 |
-
<hr/>
|
36 |
-
|
37 |
-
<div>
|
38 |
-
<?php echo sprintf(
|
39 |
-
__('This product includes GeoLite2 data created by %s.', 'wp-statistics'),
|
40 |
-
'<a href="http://www.maxmind.com" target=_blank>MaxMind</a>'
|
41 |
-
); ?>
|
42 |
-
</div>
|
43 |
<?php
|
44 |
}
|
45 |
|
31 |
}
|
32 |
?>
|
33 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
<?php
|
35 |
}
|
36 |
|
includes/settings/tabs/wps-general.php
CHANGED
@@ -27,6 +27,8 @@ if ( $wps_nonce_valid ) {
|
|
27 |
'wps_pages',
|
28 |
'wps_track_all_pages',
|
29 |
'wps_disable_column',
|
|
|
|
|
30 |
'wps_check_online',
|
31 |
'wps_menu_bar',
|
32 |
'wps_coefficient',
|
@@ -61,8 +63,8 @@ if ( $wps_nonce_valid ) {
|
|
61 |
}
|
62 |
?>
|
63 |
<script type="text/javascript">
|
64 |
-
function
|
65 |
-
jQuery('[id^="
|
66 |
}
|
67 |
</script>
|
68 |
|
@@ -213,7 +215,7 @@ if ( $wps_nonce_valid ) {
|
|
213 |
</tr>
|
214 |
|
215 |
<tr valign="top">
|
216 |
-
<th scope="row" colspan="2"><h3><?php _e('Pages', 'wp-statistics'); ?></h3></th>
|
217 |
</tr>
|
218 |
|
219 |
<tr valign="top">
|
@@ -233,7 +235,7 @@ if ( $wps_nonce_valid ) {
|
|
233 |
|
234 |
<tr valign="top">
|
235 |
<th scope="row">
|
236 |
-
<label for="
|
237 |
</th>
|
238 |
|
239 |
<td>
|
@@ -251,7 +253,7 @@ if ( $wps_nonce_valid ) {
|
|
251 |
?>
|
252 |
<tr valign="top">
|
253 |
<th scope="row">
|
254 |
-
<label for="
|
255 |
</th>
|
256 |
|
257 |
<td>
|
@@ -272,7 +274,7 @@ if ( $wps_nonce_valid ) {
|
|
272 |
?>
|
273 |
<tr valign="top">
|
274 |
<th scope="row">
|
275 |
-
<label for="
|
276 |
</th>
|
277 |
|
278 |
<td>
|
@@ -285,6 +287,55 @@ if ( $wps_nonce_valid ) {
|
|
285 |
</td>
|
286 |
</tr>
|
287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
<tr valign="top">
|
289 |
<th scope="row" colspan="2"><h3><?php _e('Miscellaneous', 'wp-statistics'); ?></h3></th>
|
290 |
</tr>
|
27 |
'wps_pages',
|
28 |
'wps_track_all_pages',
|
29 |
'wps_disable_column',
|
30 |
+
'wps_show_hits',
|
31 |
+
'wps_display_hits_position',
|
32 |
'wps_check_online',
|
33 |
'wps_menu_bar',
|
34 |
'wps_coefficient',
|
63 |
}
|
64 |
?>
|
65 |
<script type="text/javascript">
|
66 |
+
function ToggleShowHitsOptions() {
|
67 |
+
jQuery('[id^="wps_show_hits_option"]').fadeToggle();
|
68 |
}
|
69 |
</script>
|
70 |
|
215 |
</tr>
|
216 |
|
217 |
<tr valign="top">
|
218 |
+
<th scope="row" colspan="2"><h3><?php _e('Pages and Posts', 'wp-statistics'); ?></h3></th>
|
219 |
</tr>
|
220 |
|
221 |
<tr valign="top">
|
235 |
|
236 |
<tr valign="top">
|
237 |
<th scope="row">
|
238 |
+
<label for="all_pages"><?php _e('Track all pages', 'wp-statistics'); ?>:</label>
|
239 |
</th>
|
240 |
|
241 |
<td>
|
253 |
?>
|
254 |
<tr valign="top">
|
255 |
<th scope="row">
|
256 |
+
<label for="strip_uri_parameters"><?php _e('Strip parameters from URI', 'wp-statistics'); ?>:</label>
|
257 |
</th>
|
258 |
|
259 |
<td>
|
274 |
?>
|
275 |
<tr valign="top">
|
276 |
<th scope="row">
|
277 |
+
<label for="disable_column"><?php _e('Disable hits column in post/pages list', 'wp-statistics'); ?>:</label>
|
278 |
</th>
|
279 |
|
280 |
<td>
|
287 |
</td>
|
288 |
</tr>
|
289 |
|
290 |
+
<tr valign="top">
|
291 |
+
<th scope="row">
|
292 |
+
<label for="show_hits"><?php _e('Show hits in posts/pages in the site', 'wp-statistics'); ?>:</label>
|
293 |
+
</th>
|
294 |
+
|
295 |
+
<td>
|
296 |
+
<input id="show_hits" type="checkbox" value="1"
|
297 |
+
name="wps_show_hits" <?php echo $WP_Statistics->get_option('show_hits') == true
|
298 |
+
? "checked='checked'" : ''; ?> onClick='ToggleShowHitsOptions();'>
|
299 |
+
<label for="show_hits"><?php _e('Enable', 'wp-statistics'); ?></label>
|
300 |
+
|
301 |
+
<p class="description"><?php _e('Enable or disable show hits after content', 'wp-statistics'); ?></p>
|
302 |
+
</td>
|
303 |
+
</tr>
|
304 |
+
|
305 |
+
<?php if ( $WP_Statistics->get_option('show_hits') ) {
|
306 |
+
$hidden = "";
|
307 |
+
} else {
|
308 |
+
$hidden = " style='display: none;'";
|
309 |
+
} ?>
|
310 |
+
<tr valign="top"<?php echo $hidden; ?> id='wps_show_hits_option'>
|
311 |
+
<td scope="row" style="vertical-align: top;">
|
312 |
+
<label for="display_hits_position"><?php _e('Display position', 'wp-statistics'); ?>:</label>
|
313 |
+
</td>
|
314 |
+
|
315 |
+
<td>
|
316 |
+
<select name="wps_display_hits_position" id="display_hits_position">
|
317 |
+
<option value="0" <?php selected($WP_Statistics->get_option('display_hits_position'), '0'); ?>><?php _e(
|
318 |
+
'Please select',
|
319 |
+
'wp-statistics'
|
320 |
+
); ?></option>
|
321 |
+
<option value="before_content" <?php selected($WP_Statistics->get_option('display_hits_position'), 'before_content'); ?>><?php _e(
|
322 |
+
'Before Content',
|
323 |
+
'wp-statistics'
|
324 |
+
); ?></option>
|
325 |
+
|
326 |
+
<option value="after_content" <?php selected($WP_Statistics->get_option('display_hits_position'), 'after_content'); ?>><?php _e(
|
327 |
+
'After Content',
|
328 |
+
'wp-statistics'
|
329 |
+
); ?></option>
|
330 |
+
</select>
|
331 |
+
|
332 |
+
<p class="description"><?php _e(
|
333 |
+
'Choose the position hits.',
|
334 |
+
'wp-statistics'
|
335 |
+
); ?></p>
|
336 |
+
</td>
|
337 |
+
</tr>
|
338 |
+
|
339 |
<tr valign="top">
|
340 |
<th scope="row" colspan="2"><h3><?php _e('Miscellaneous', 'wp-statistics'); ?></h3></th>
|
341 |
</tr>
|
includes/templates/plugins.php
CHANGED
@@ -10,9 +10,9 @@
|
|
10 |
<div id="the-list">
|
11 |
<?php foreach ( $plugins->items as $plugin ) : ?>
|
12 |
<div class="plugin-card">
|
13 |
-
<?php if ( $plugin->is_feature ) : ?>
|
14 |
<div class="cover-ribbon">
|
15 |
-
<div class="cover-ribbon-inside"><?php
|
16 |
</div>
|
17 |
<?php endif; ?>
|
18 |
|
10 |
<div id="the-list">
|
11 |
<?php foreach ( $plugins->items as $plugin ) : ?>
|
12 |
<div class="plugin-card">
|
13 |
+
<?php if ( $plugin->is_feature and $plugin->featured_label ) : ?>
|
14 |
<div class="cover-ribbon">
|
15 |
+
<div class="cover-ribbon-inside"><?php echo $plugin->featured_label; ?></div>
|
16 |
</div>
|
17 |
<?php endif; ?>
|
18 |
|
includes/templates/welcome.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap about-wrap full-width-layout">
|
2 |
+
<div class="wp-statistics-welcome">
|
3 |
+
<h1><?php printf( __( 'Welcome to WP-Statistics %s', 'wp-statistics' ), WP_Statistics::$reg['version'] ); ?></h1>
|
4 |
+
|
5 |
+
<p class="about-text"><?php _e( 'Thank you for updating to the latest version!', 'wp-statistics' ); ?></p>
|
6 |
+
<div class="wp-badge"><?php printf( __( 'Version %s', 'wp-statistics' ), WP_Statistics::$reg['version'] ); ?></div>
|
7 |
+
|
8 |
+
<h2 class="nav-tab-wrapper wp-clearfix">
|
9 |
+
<a href="#" class="nav-tab nav-tab-active"
|
10 |
+
data-tab="whats-news"><?php _e( 'What’s New', 'wp-statistics' ); ?></a>
|
11 |
+
<a href="#" class="nav-tab" data-tab="credit"><?php _e( 'Credits', 'wp-statistics' ); ?></a>
|
12 |
+
<a href="#" class="nav-tab" data-tab="changelog"><?php _e( 'Changelog', 'wp-statistics' ); ?></a>
|
13 |
+
</h2>
|
14 |
+
|
15 |
+
<div data-content="whats-news" class="tab-content current">
|
16 |
+
<section class="center-section">
|
17 |
+
<h2><?php _e( 'Welcome to the WP-Statistics!', 'wp-statistics' ); ?></h2>
|
18 |
+
<h4><?php _e( 'You can see the new changes of WP-Statistics on this page.', 'wp-statistics' ); ?></h4>
|
19 |
+
</section>
|
20 |
+
|
21 |
+
<section class="normal-section">
|
22 |
+
<div class="left">
|
23 |
+
<div class="content-padding">
|
24 |
+
<h2><?php _e( 'New Feature!<br>Show Hits on the single posts/pages.', 'wp-statistics' ); ?></h2>
|
25 |
+
<h4><?php _e( 'You can display the Hits of post or page on the site and specify that position.', 'wp-statistics' ); ?></h4>
|
26 |
+
</div>
|
27 |
+
</div>
|
28 |
+
|
29 |
+
<div class="right text-center">
|
30 |
+
<img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/screenshots-1.png' ); ?>"/>
|
31 |
+
</div>
|
32 |
+
</section>
|
33 |
+
|
34 |
+
<section class="normal-section">
|
35 |
+
<div class="right">
|
36 |
+
<div class="content-padding">
|
37 |
+
<h2><?php _e( 'Added Pages Dropdown in the page stats.', 'wp-statistics' ); ?></h2>
|
38 |
+
<h4><?php _e( 'Easily switch to pages for getting stats.', 'wp-statistics' ); ?></h4>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
|
42 |
+
<div class="left text-center">
|
43 |
+
<img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/screenshots-2.png' ); ?>"/>
|
44 |
+
</div>
|
45 |
+
</section>
|
46 |
+
|
47 |
+
<section class="normal-section">
|
48 |
+
<div class="left">
|
49 |
+
<div class="content-padding">
|
50 |
+
<h2><?php _e( 'New Add-Ons!', 'wp-statistics' ); ?></h2>
|
51 |
+
<h4><?php _e( 'These extensions add functionality to your WP-Statistics.', 'wp-statistics' ); ?></h4>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
|
55 |
+
<div class="right text-center addons-item">
|
56 |
+
<a href="https://wp-statistics.com/downloads/wp-statistics-widgets/" title="Widgets" target="_blank"><img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/add-on-widgets.png' ); ?>"/></a>
|
57 |
+
<a href="https://wp-statistics.com/downloads/wp-statistics-mini-chart/" title="Mini Chart" target="_blank"><img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/add-on-mini-chart.png' ); ?>"/></a>
|
58 |
+
<a href="https://wp-statistics.com/downloads/wp-statistics-advanced-reporting/" title="Advanced Reporting" target="_blank"><img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/add-on-advanced-reporting.png' ); ?>"/></a>
|
59 |
+
<a href="https://wp-statistics.com/downloads/wp-statistics-realtime-stats/" title="Realtime stats" target="_blank"><img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/add-on-realtime-stats.png' ); ?>"/></a>
|
60 |
+
</div>
|
61 |
+
</section>
|
62 |
+
|
63 |
+
<section class="normal-section">
|
64 |
+
<div class="right">
|
65 |
+
<div class="content-padding">
|
66 |
+
<h2><?php _e( 'And the following issues have been solved in this version:', 'wp-statistics' ); ?></h2>
|
67 |
+
<ul>
|
68 |
+
<li><?php _e( 'Fixed Issue to create the object of the main class.', 'wp-statistics' ); ?></li>
|
69 |
+
<li><?php _e( 'Fixed Issue to get page title in empty search words option.', 'wp-statistics' ); ?></li>
|
70 |
+
<li><?php _e( 'Fixed Issue to show date range in the charts.', 'wp-statistics' ); ?></li>
|
71 |
+
</ul>
|
72 |
+
<h4><?php echo sprintf( __( 'Please let us know about new problems by <a href="%s" target="_blank">contacting us</a>.', 'wp-statistics' ), 'https://wp-statistics.com/contact/' ); ?></h4>
|
73 |
+
</div>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<div class="left text-center">
|
77 |
+
<img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/icon-question.png' ); ?>"/>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
</section>
|
81 |
+
|
82 |
+
<section class="center-section">
|
83 |
+
<img src="<?php echo plugins_url( 'wp-statistics/assets/images/welcome/icon-love.png' ); ?>"/>
|
84 |
+
<h4><?php echo sprintf( __( 'To help us, you can make <a href="%s" target="_blank">donate</a> or <a href="%s" target="_blank">purchase</a> Add-Ons.', 'wp-statistics' ), 'https://wp-statistics.com/donate/', 'https://wp-statistics.com/add-ons/' ); ?></h4>
|
85 |
+
</section>
|
86 |
+
</div>
|
87 |
+
|
88 |
+
<div data-content="credit" class="tab-content">
|
89 |
+
<div class="about-wrap-content">
|
90 |
+
<p class="about-description"><?php echo sprintf( __( 'WP-Statistics is created by some peoples and is one of <a target="_blank" href="%s" target="_blank">VeronaLabs.com</a> projects.', 'wp-statistics' ), 'http://veronalabs.com' ); ?></p>
|
91 |
+
<h3 class="wp-people-group"><?php _e( 'Project Leaders', 'wp-statistics' ); ?></h3>
|
92 |
+
<ul class="wp-people-group ">
|
93 |
+
<li class="wp-person">
|
94 |
+
<a href="https://profiles.wordpress.org/mostafas1990/"
|
95 |
+
class="web"><?php echo get_avatar( 'mst404@gmail.com', 62, '', '', array( 'class' => 'gravatar' ) ); ?><?php _e( 'Mostafa Soufi', 'wp-statistics' ); ?></a>
|
96 |
+
<span class="title"><?php _e( 'Original Author', 'wp-statistics' ); ?></span>
|
97 |
+
</li>
|
98 |
+
</ul>
|
99 |
+
<h3 class="wp-people-group"><?php _e( 'Other Contributors', 'wp-statistics' ); ?></h3>
|
100 |
+
<ul class="wp-people-group">
|
101 |
+
<li class="wp-person">
|
102 |
+
<a href="https://profiles.wordpress.org/gregross/"
|
103 |
+
class="web"><?php echo get_avatar( 'greg@toolstack.com', 62, '', '', array( 'class' => 'gravatar' ) ); ?><?php _e( 'Greg Ross', 'wp-statistics' ); ?></a>
|
104 |
+
<span class="title"><?php _e( 'Core Contributor', 'wp-statistics' ); ?></span>
|
105 |
+
</li>
|
106 |
+
<li class="wp-person">
|
107 |
+
<a href="https://profiles.wordpress.org/dedidata/"
|
108 |
+
class="web"><?php echo get_avatar( 'dedidata.com@gmail.com', 62, '', '', array( 'class' => 'gravatar' ) ); ?><?php _e( 'Farhad Sakhaei', 'wp-statistics' ); ?></a>
|
109 |
+
<span class="title"><?php _e( 'Core Contributor', 'wp-statistics' ); ?></span>
|
110 |
+
</li>
|
111 |
+
<li class="wp-person">
|
112 |
+
<a href="https://profiles.wordpress.org/pedromendonca/"
|
113 |
+
class="web"><?php echo get_avatar( 'ped.gaspar@gmail.com', 62, '', '', array( 'class' => 'gravatar' ) ); ?><?php _e( 'Pedro Mendonça', 'wp-statistics' ); ?></a>
|
114 |
+
<span class="title"><?php _e( 'Language Contributor', 'wp-statistics' ); ?></span>
|
115 |
+
</li>
|
116 |
+
</ul>
|
117 |
+
|
118 |
+
<p class="clear"><?php echo sprintf( __( 'WP-Statistics is being developed on GitHub, If you’re interested in contributing to plugin, Please look at <a target="_blank" href="%s" target="_blank">Github page</a>.', 'wp-statistics' ), 'https://github.com/wp-statistics/wp-statistics' ); ?></p>
|
119 |
+
<h3 class="wp-people-group"><?php _e( 'External Libraries', 'wp-statistics' ); ?></h3>
|
120 |
+
<p class="wp-credits-list">
|
121 |
+
<a href="http://www.maxmind.com/"><?php _e( 'MaxMind', 'wp-statistics' ); ?></a>,
|
122 |
+
<a href="https://browscap.org/">Browscap</a>,
|
123 |
+
<a href="http://www.chartjs.org/"><?php _e( 'Chart.js', 'wp-statistics' ); ?></a>.</p>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
|
127 |
+
<div data-content="changelog" class="one-col tab-content">
|
128 |
+
<?php WP_Statistics_Welcome::show_change_log(); ?>
|
129 |
+
</div>
|
130 |
+
|
131 |
+
<hr>
|
132 |
+
|
133 |
+
<div class="return-to-dashboard">
|
134 |
+
<a href="<?php echo admin_url( 'admin.php?page=wps_overview_page' ); ?>"><?php _e( 'Go to Stats → Overview', 'wp-statistics' ); ?></a>
|
135 |
+
</div>
|
136 |
+
</div>
|
137 |
+
</div>
|
includes/vendor/browscap/browscap-php/src/phpbrowscap/Browscap.php
CHANGED
@@ -766,7 +766,8 @@ class Browscap
|
|
766 |
continue;
|
767 |
}
|
768 |
|
769 |
-
$
|
|
|
770 |
|
771 |
if (empty($properties['Comment'])
|
772 |
|| false !== strpos($userAgent, '*')
|
766 |
continue;
|
767 |
}
|
768 |
|
769 |
+
$position_index = $position + 1;
|
770 |
+
$properties = parse_ini_string($iniParts[$position_index], true, INI_SCANNER_RAW);
|
771 |
|
772 |
if (empty($properties['Comment'])
|
773 |
|| false !== strpos($userAgent, '*')
|
includes/vendor/composer/autoload_namespaces.php
CHANGED
@@ -7,4 +7,5 @@ $baseDir = dirname(dirname($vendorDir));
|
|
7 |
|
8 |
return array(
|
9 |
'phpbrowscap\\' => array($vendorDir . '/browscap/browscap-php/src'),
|
|
|
10 |
);
|
7 |
|
8 |
return array(
|
9 |
'phpbrowscap\\' => array($vendorDir . '/browscap/browscap-php/src'),
|
10 |
+
'Parsedown' => array($vendorDir . '/erusev/parsedown'),
|
11 |
);
|
includes/vendor/composer/autoload_static.php
CHANGED
@@ -66,6 +66,13 @@ class ComposerStaticInite38eff48d6e6d75cf438d3ef850d45a7
|
|
66 |
0 => __DIR__ . '/..' . '/browscap/browscap-php/src',
|
67 |
),
|
68 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
);
|
70 |
|
71 |
public static function getInitializer(ClassLoader $loader)
|
66 |
0 => __DIR__ . '/..' . '/browscap/browscap-php/src',
|
67 |
),
|
68 |
),
|
69 |
+
'P' =>
|
70 |
+
array (
|
71 |
+
'Parsedown' =>
|
72 |
+
array (
|
73 |
+
0 => __DIR__ . '/..' . '/erusev/parsedown',
|
74 |
+
),
|
75 |
+
),
|
76 |
);
|
77 |
|
78 |
public static function getInitializer(ClassLoader $loader)
|
includes/vendor/composer/installed.json
CHANGED
@@ -378,5 +378,52 @@
|
|
378 |
"get_browser",
|
379 |
"user agent"
|
380 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
]
|
378 |
"get_browser",
|
379 |
"user agent"
|
380 |
]
|
381 |
+
},
|
382 |
+
{
|
383 |
+
"name": "erusev/parsedown",
|
384 |
+
"version": "1.6.4",
|
385 |
+
"version_normalized": "1.6.4.0",
|
386 |
+
"source": {
|
387 |
+
"type": "git",
|
388 |
+
"url": "https://github.com/erusev/parsedown.git",
|
389 |
+
"reference": "fbe3fe878f4fe69048bb8a52783a09802004f548"
|
390 |
+
},
|
391 |
+
"dist": {
|
392 |
+
"type": "zip",
|
393 |
+
"url": "https://api.github.com/repos/erusev/parsedown/zipball/fbe3fe878f4fe69048bb8a52783a09802004f548",
|
394 |
+
"reference": "fbe3fe878f4fe69048bb8a52783a09802004f548",
|
395 |
+
"shasum": ""
|
396 |
+
},
|
397 |
+
"require": {
|
398 |
+
"php": ">=5.3.0"
|
399 |
+
},
|
400 |
+
"require-dev": {
|
401 |
+
"phpunit/phpunit": "^4.8.35"
|
402 |
+
},
|
403 |
+
"time": "2017-11-14T20:44:03+00:00",
|
404 |
+
"type": "library",
|
405 |
+
"installation-source": "dist",
|
406 |
+
"autoload": {
|
407 |
+
"psr-0": {
|
408 |
+
"Parsedown": ""
|
409 |
+
}
|
410 |
+
},
|
411 |
+
"notification-url": "https://packagist.org/downloads/",
|
412 |
+
"license": [
|
413 |
+
"MIT"
|
414 |
+
],
|
415 |
+
"authors": [
|
416 |
+
{
|
417 |
+
"name": "Emanuil Rusev",
|
418 |
+
"email": "hello@erusev.com",
|
419 |
+
"homepage": "http://erusev.com"
|
420 |
+
}
|
421 |
+
],
|
422 |
+
"description": "Parser for Markdown.",
|
423 |
+
"homepage": "http://parsedown.org",
|
424 |
+
"keywords": [
|
425 |
+
"markdown",
|
426 |
+
"parser"
|
427 |
+
]
|
428 |
}
|
429 |
]
|
includes/vendor/erusev/parsedown/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2013 Emanuil Rusev, erusev.com
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6 |
+
this software and associated documentation files (the "Software"), to deal in
|
7 |
+
the Software without restriction, including without limitation the rights to
|
8 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10 |
+
subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
includes/vendor/erusev/parsedown/Parsedown.php
ADDED
@@ -0,0 +1,1548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
#
|
4 |
+
#
|
5 |
+
# Parsedown
|
6 |
+
# http://parsedown.org
|
7 |
+
#
|
8 |
+
# (c) Emanuil Rusev
|
9 |
+
# http://erusev.com
|
10 |
+
#
|
11 |
+
# For the full license information, view the LICENSE file that was distributed
|
12 |
+
# with this source code.
|
13 |
+
#
|
14 |
+
#
|
15 |
+
|
16 |
+
class Parsedown
|
17 |
+
{
|
18 |
+
# ~
|
19 |
+
|
20 |
+
const version = '1.6.0';
|
21 |
+
|
22 |
+
# ~
|
23 |
+
|
24 |
+
function text($text)
|
25 |
+
{
|
26 |
+
# make sure no definitions are set
|
27 |
+
$this->DefinitionData = array();
|
28 |
+
|
29 |
+
# standardize line breaks
|
30 |
+
$text = str_replace(array("\r\n", "\r"), "\n", $text);
|
31 |
+
|
32 |
+
# remove surrounding line breaks
|
33 |
+
$text = trim($text, "\n");
|
34 |
+
|
35 |
+
# split text into lines
|
36 |
+
$lines = explode("\n", $text);
|
37 |
+
|
38 |
+
# iterate through lines to identify blocks
|
39 |
+
$markup = $this->lines($lines);
|
40 |
+
|
41 |
+
# trim line breaks
|
42 |
+
$markup = trim($markup, "\n");
|
43 |
+
|
44 |
+
return $markup;
|
45 |
+
}
|
46 |
+
|
47 |
+
#
|
48 |
+
# Setters
|
49 |
+
#
|
50 |
+
|
51 |
+
function setBreaksEnabled($breaksEnabled)
|
52 |
+
{
|
53 |
+
$this->breaksEnabled = $breaksEnabled;
|
54 |
+
|
55 |
+
return $this;
|
56 |
+
}
|
57 |
+
|
58 |
+
protected $breaksEnabled;
|
59 |
+
|
60 |
+
function setMarkupEscaped($markupEscaped)
|
61 |
+
{
|
62 |
+
$this->markupEscaped = $markupEscaped;
|
63 |
+
|
64 |
+
return $this;
|
65 |
+
}
|
66 |
+
|
67 |
+
protected $markupEscaped;
|
68 |
+
|
69 |
+
function setUrlsLinked($urlsLinked)
|
70 |
+
{
|
71 |
+
$this->urlsLinked = $urlsLinked;
|
72 |
+
|
73 |
+
return $this;
|
74 |
+
}
|
75 |
+
|
76 |
+
protected $urlsLinked = true;
|
77 |
+
|
78 |
+
#
|
79 |
+
# Lines
|
80 |
+
#
|
81 |
+
|
82 |
+
protected $BlockTypes = array(
|
83 |
+
'#' => array('Header'),
|
84 |
+
'*' => array('Rule', 'List'),
|
85 |
+
'+' => array('List'),
|
86 |
+
'-' => array('SetextHeader', 'Table', 'Rule', 'List'),
|
87 |
+
'0' => array('List'),
|
88 |
+
'1' => array('List'),
|
89 |
+
'2' => array('List'),
|
90 |
+
'3' => array('List'),
|
91 |
+
'4' => array('List'),
|
92 |
+
'5' => array('List'),
|
93 |
+
'6' => array('List'),
|
94 |
+
'7' => array('List'),
|
95 |
+
'8' => array('List'),
|
96 |
+
'9' => array('List'),
|
97 |
+
':' => array('Table'),
|
98 |
+
'<' => array('Comment', 'Markup'),
|
99 |
+
'=' => array('SetextHeader'),
|
100 |
+
'>' => array('Quote'),
|
101 |
+
'[' => array('Reference'),
|
102 |
+
'_' => array('Rule'),
|
103 |
+
'`' => array('FencedCode'),
|
104 |
+
'|' => array('Table'),
|
105 |
+
'~' => array('FencedCode'),
|
106 |
+
);
|
107 |
+
|
108 |
+
# ~
|
109 |
+
|
110 |
+
protected $unmarkedBlockTypes = array(
|
111 |
+
'Code',
|
112 |
+
);
|
113 |
+
|
114 |
+
#
|
115 |
+
# Blocks
|
116 |
+
#
|
117 |
+
|
118 |
+
protected function lines(array $lines)
|
119 |
+
{
|
120 |
+
$CurrentBlock = null;
|
121 |
+
|
122 |
+
foreach ($lines as $line)
|
123 |
+
{
|
124 |
+
if (chop($line) === '')
|
125 |
+
{
|
126 |
+
if (isset($CurrentBlock))
|
127 |
+
{
|
128 |
+
$CurrentBlock['interrupted'] = true;
|
129 |
+
}
|
130 |
+
|
131 |
+
continue;
|
132 |
+
}
|
133 |
+
|
134 |
+
if (strpos($line, "\t") !== false)
|
135 |
+
{
|
136 |
+
$parts = explode("\t", $line);
|
137 |
+
|
138 |
+
$line = $parts[0];
|
139 |
+
|
140 |
+
unset($parts[0]);
|
141 |
+
|
142 |
+
foreach ($parts as $part)
|
143 |
+
{
|
144 |
+
$shortage = 4 - mb_strlen($line, 'utf-8') % 4;
|
145 |
+
|
146 |
+
$line .= str_repeat(' ', $shortage);
|
147 |
+
$line .= $part;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
$indent = 0;
|
152 |
+
|
153 |
+
while (isset($line[$indent]) and $line[$indent] === ' ')
|
154 |
+
{
|
155 |
+
$indent ++;
|
156 |
+
}
|
157 |
+
|
158 |
+
$text = $indent > 0 ? substr($line, $indent) : $line;
|
159 |
+
|
160 |
+
# ~
|
161 |
+
|
162 |
+
$Line = array('body' => $line, 'indent' => $indent, 'text' => $text);
|
163 |
+
|
164 |
+
# ~
|
165 |
+
|
166 |
+
if (isset($CurrentBlock['continuable']))
|
167 |
+
{
|
168 |
+
$Block = $this->{'block'.$CurrentBlock['type'].'Continue'}($Line, $CurrentBlock);
|
169 |
+
|
170 |
+
if (isset($Block))
|
171 |
+
{
|
172 |
+
$CurrentBlock = $Block;
|
173 |
+
|
174 |
+
continue;
|
175 |
+
}
|
176 |
+
else
|
177 |
+
{
|
178 |
+
if ($this->isBlockCompletable($CurrentBlock['type']))
|
179 |
+
{
|
180 |
+
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
# ~
|
186 |
+
|
187 |
+
$marker = $text[0];
|
188 |
+
|
189 |
+
# ~
|
190 |
+
|
191 |
+
$blockTypes = $this->unmarkedBlockTypes;
|
192 |
+
|
193 |
+
if (isset($this->BlockTypes[$marker]))
|
194 |
+
{
|
195 |
+
foreach ($this->BlockTypes[$marker] as $blockType)
|
196 |
+
{
|
197 |
+
$blockTypes []= $blockType;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
#
|
202 |
+
# ~
|
203 |
+
|
204 |
+
foreach ($blockTypes as $blockType)
|
205 |
+
{
|
206 |
+
$Block = $this->{'block'.$blockType}($Line, $CurrentBlock);
|
207 |
+
|
208 |
+
if (isset($Block))
|
209 |
+
{
|
210 |
+
$Block['type'] = $blockType;
|
211 |
+
|
212 |
+
if ( ! isset($Block['identified']))
|
213 |
+
{
|
214 |
+
$Blocks []= $CurrentBlock;
|
215 |
+
|
216 |
+
$Block['identified'] = true;
|
217 |
+
}
|
218 |
+
|
219 |
+
if ($this->isBlockContinuable($blockType))
|
220 |
+
{
|
221 |
+
$Block['continuable'] = true;
|
222 |
+
}
|
223 |
+
|
224 |
+
$CurrentBlock = $Block;
|
225 |
+
|
226 |
+
continue 2;
|
227 |
+
}
|
228 |
+
}
|
229 |
+
|
230 |
+
# ~
|
231 |
+
|
232 |
+
if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted']))
|
233 |
+
{
|
234 |
+
$CurrentBlock['element']['text'] .= "\n".$text;
|
235 |
+
}
|
236 |
+
else
|
237 |
+
{
|
238 |
+
$Blocks []= $CurrentBlock;
|
239 |
+
|
240 |
+
$CurrentBlock = $this->paragraph($Line);
|
241 |
+
|
242 |
+
$CurrentBlock['identified'] = true;
|
243 |
+
}
|
244 |
+
}
|
245 |
+
|
246 |
+
# ~
|
247 |
+
|
248 |
+
if (isset($CurrentBlock['continuable']) and $this->isBlockCompletable($CurrentBlock['type']))
|
249 |
+
{
|
250 |
+
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
|
251 |
+
}
|
252 |
+
|
253 |
+
# ~
|
254 |
+
|
255 |
+
$Blocks []= $CurrentBlock;
|
256 |
+
|
257 |
+
unset($Blocks[0]);
|
258 |
+
|
259 |
+
# ~
|
260 |
+
|
261 |
+
$markup = '';
|
262 |
+
|
263 |
+
foreach ($Blocks as $Block)
|
264 |
+
{
|
265 |
+
if (isset($Block['hidden']))
|
266 |
+
{
|
267 |
+
continue;
|
268 |
+
}
|
269 |
+
|
270 |
+
$markup .= "\n";
|
271 |
+
$markup .= isset($Block['markup']) ? $Block['markup'] : $this->element($Block['element']);
|
272 |
+
}
|
273 |
+
|
274 |
+
$markup .= "\n";
|
275 |
+
|
276 |
+
# ~
|
277 |
+
|
278 |
+
return $markup;
|
279 |
+
}
|
280 |
+
|
281 |
+
protected function isBlockContinuable($Type)
|
282 |
+
{
|
283 |
+
return method_exists($this, 'block'.$Type.'Continue');
|
284 |
+
}
|
285 |
+
|
286 |
+
protected function isBlockCompletable($Type)
|
287 |
+
{
|
288 |
+
return method_exists($this, 'block'.$Type.'Complete');
|
289 |
+
}
|
290 |
+
|
291 |
+
#
|
292 |
+
# Code
|
293 |
+
|
294 |
+
protected function blockCode($Line, $Block = null)
|
295 |
+
{
|
296 |
+
if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted']))
|
297 |
+
{
|
298 |
+
return;
|
299 |
+
}
|
300 |
+
|
301 |
+
if ($Line['indent'] >= 4)
|
302 |
+
{
|
303 |
+
$text = substr($Line['body'], 4);
|
304 |
+
|
305 |
+
$Block = array(
|
306 |
+
'element' => array(
|
307 |
+
'name' => 'pre',
|
308 |
+
'handler' => 'element',
|
309 |
+
'text' => array(
|
310 |
+
'name' => 'code',
|
311 |
+
'text' => $text,
|
312 |
+
),
|
313 |
+
),
|
314 |
+
);
|
315 |
+
|
316 |
+
return $Block;
|
317 |
+
}
|
318 |
+
}
|
319 |
+
|
320 |
+
protected function blockCodeContinue($Line, $Block)
|
321 |
+
{
|
322 |
+
if ($Line['indent'] >= 4)
|
323 |
+
{
|
324 |
+
if (isset($Block['interrupted']))
|
325 |
+
{
|
326 |
+
$Block['element']['text']['text'] .= "\n";
|
327 |
+
|
328 |
+
unset($Block['interrupted']);
|
329 |
+
}
|
330 |
+
|
331 |
+
$Block['element']['text']['text'] .= "\n";
|
332 |
+
|
333 |
+
$text = substr($Line['body'], 4);
|
334 |
+
|
335 |
+
$Block['element']['text']['text'] .= $text;
|
336 |
+
|
337 |
+
return $Block;
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
protected function blockCodeComplete($Block)
|
342 |
+
{
|
343 |
+
$text = $Block['element']['text']['text'];
|
344 |
+
|
345 |
+
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
346 |
+
|
347 |
+
$Block['element']['text']['text'] = $text;
|
348 |
+
|
349 |
+
return $Block;
|
350 |
+
}
|
351 |
+
|
352 |
+
#
|
353 |
+
# Comment
|
354 |
+
|
355 |
+
protected function blockComment($Line)
|
356 |
+
{
|
357 |
+
if ($this->markupEscaped)
|
358 |
+
{
|
359 |
+
return;
|
360 |
+
}
|
361 |
+
|
362 |
+
if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!')
|
363 |
+
{
|
364 |
+
$Block = array(
|
365 |
+
'markup' => $Line['body'],
|
366 |
+
);
|
367 |
+
|
368 |
+
if (preg_match('/-->$/', $Line['text']))
|
369 |
+
{
|
370 |
+
$Block['closed'] = true;
|
371 |
+
}
|
372 |
+
|
373 |
+
return $Block;
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
protected function blockCommentContinue($Line, array $Block)
|
378 |
+
{
|
379 |
+
if (isset($Block['closed']))
|
380 |
+
{
|
381 |
+
return;
|
382 |
+
}
|
383 |
+
|
384 |
+
$Block['markup'] .= "\n" . $Line['body'];
|
385 |
+
|
386 |
+
if (preg_match('/-->$/', $Line['text']))
|
387 |
+
{
|
388 |
+
$Block['closed'] = true;
|
389 |
+
}
|
390 |
+
|
391 |
+
return $Block;
|
392 |
+
}
|
393 |
+
|
394 |
+
#
|
395 |
+
# Fenced Code
|
396 |
+
|
397 |
+
protected function blockFencedCode($Line)
|
398 |
+
{
|
399 |
+
if (preg_match('/^['.$Line['text'][0].']{3,}[ ]*([\w-]+)?[ ]*$/', $Line['text'], $matches))
|
400 |
+
{
|
401 |
+
$Element = array(
|
402 |
+
'name' => 'code',
|
403 |
+
'text' => '',
|
404 |
+
);
|
405 |
+
|
406 |
+
if (isset($matches[1]))
|
407 |
+
{
|
408 |
+
$class = 'language-'.$matches[1];
|
409 |
+
|
410 |
+
$Element['attributes'] = array(
|
411 |
+
'class' => $class,
|
412 |
+
);
|
413 |
+
}
|
414 |
+
|
415 |
+
$Block = array(
|
416 |
+
'char' => $Line['text'][0],
|
417 |
+
'element' => array(
|
418 |
+
'name' => 'pre',
|
419 |
+
'handler' => 'element',
|
420 |
+
'text' => $Element,
|
421 |
+
),
|
422 |
+
);
|
423 |
+
|
424 |
+
return $Block;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
protected function blockFencedCodeContinue($Line, $Block)
|
429 |
+
{
|
430 |
+
if (isset($Block['complete']))
|
431 |
+
{
|
432 |
+
return;
|
433 |
+
}
|
434 |
+
|
435 |
+
if (isset($Block['interrupted']))
|
436 |
+
{
|
437 |
+
$Block['element']['text']['text'] .= "\n";
|
438 |
+
|
439 |
+
unset($Block['interrupted']);
|
440 |
+
}
|
441 |
+
|
442 |
+
if (preg_match('/^'.$Block['char'].'{3,}[ ]*$/', $Line['text']))
|
443 |
+
{
|
444 |
+
$Block['element']['text']['text'] = substr($Block['element']['text']['text'], 1);
|
445 |
+
|
446 |
+
$Block['complete'] = true;
|
447 |
+
|
448 |
+
return $Block;
|
449 |
+
}
|
450 |
+
|
451 |
+
$Block['element']['text']['text'] .= "\n".$Line['body'];
|
452 |
+
|
453 |
+
return $Block;
|
454 |
+
}
|
455 |
+
|
456 |
+
protected function blockFencedCodeComplete($Block)
|
457 |
+
{
|
458 |
+
$text = $Block['element']['text']['text'];
|
459 |
+
|
460 |
+
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
461 |
+
|
462 |
+
$Block['element']['text']['text'] = $text;
|
463 |
+
|
464 |
+
return $Block;
|
465 |
+
}
|
466 |
+
|
467 |
+
#
|
468 |
+
# Header
|
469 |
+
|
470 |
+
protected function blockHeader($Line)
|
471 |
+
{
|
472 |
+
if (isset($Line['text'][1]))
|
473 |
+
{
|
474 |
+
$level = 1;
|
475 |
+
|
476 |
+
while (isset($Line['text'][$level]) and $Line['text'][$level] === '#')
|
477 |
+
{
|
478 |
+
$level ++;
|
479 |
+
}
|
480 |
+
|
481 |
+
if ($level > 6)
|
482 |
+
{
|
483 |
+
return;
|
484 |
+
}
|
485 |
+
|
486 |
+
$text = trim($Line['text'], '# ');
|
487 |
+
|
488 |
+
$Block = array(
|
489 |
+
'element' => array(
|
490 |
+
'name' => 'h' . min(6, $level),
|
491 |
+
'text' => $text,
|
492 |
+
'handler' => 'line',
|
493 |
+
),
|
494 |
+
);
|
495 |
+
|
496 |
+
return $Block;
|
497 |
+
}
|
498 |
+
}
|
499 |
+
|
500 |
+
#
|
501 |
+
# List
|
502 |
+
|
503 |
+
protected function blockList($Line)
|
504 |
+
{
|
505 |
+
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
|
506 |
+
|
507 |
+
if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches))
|
508 |
+
{
|
509 |
+
$Block = array(
|
510 |
+
'indent' => $Line['indent'],
|
511 |
+
'pattern' => $pattern,
|
512 |
+
'element' => array(
|
513 |
+
'name' => $name,
|
514 |
+
'handler' => 'elements',
|
515 |
+
),
|
516 |
+
);
|
517 |
+
|
518 |
+
if($name === 'ol')
|
519 |
+
{
|
520 |
+
$listStart = stristr($matches[0], '.', true);
|
521 |
+
|
522 |
+
if($listStart !== '1')
|
523 |
+
{
|
524 |
+
$Block['element']['attributes'] = array('start' => $listStart);
|
525 |
+
}
|
526 |
+
}
|
527 |
+
|
528 |
+
$Block['li'] = array(
|
529 |
+
'name' => 'li',
|
530 |
+
'handler' => 'li',
|
531 |
+
'text' => array(
|
532 |
+
$matches[2],
|
533 |
+
),
|
534 |
+
);
|
535 |
+
|
536 |
+
$Block['element']['text'] []= & $Block['li'];
|
537 |
+
|
538 |
+
return $Block;
|
539 |
+
}
|
540 |
+
}
|
541 |
+
|
542 |
+
protected function blockListContinue($Line, array $Block)
|
543 |
+
{
|
544 |
+
if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches))
|
545 |
+
{
|
546 |
+
if (isset($Block['interrupted']))
|
547 |
+
{
|
548 |
+
$Block['li']['text'] []= '';
|
549 |
+
|
550 |
+
unset($Block['interrupted']);
|
551 |
+
}
|
552 |
+
|
553 |
+
unset($Block['li']);
|
554 |
+
|
555 |
+
$text = isset($matches[1]) ? $matches[1] : '';
|
556 |
+
|
557 |
+
$Block['li'] = array(
|
558 |
+
'name' => 'li',
|
559 |
+
'handler' => 'li',
|
560 |
+
'text' => array(
|
561 |
+
$text,
|
562 |
+
),
|
563 |
+
);
|
564 |
+
|
565 |
+
$Block['element']['text'] []= & $Block['li'];
|
566 |
+
|
567 |
+
return $Block;
|
568 |
+
}
|
569 |
+
|
570 |
+
if ($Line['text'][0] === '[' and $this->blockReference($Line))
|
571 |
+
{
|
572 |
+
return $Block;
|
573 |
+
}
|
574 |
+
|
575 |
+
if ( ! isset($Block['interrupted']))
|
576 |
+
{
|
577 |
+
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
|
578 |
+
|
579 |
+
$Block['li']['text'] []= $text;
|
580 |
+
|
581 |
+
return $Block;
|
582 |
+
}
|
583 |
+
|
584 |
+
if ($Line['indent'] > 0)
|
585 |
+
{
|
586 |
+
$Block['li']['text'] []= '';
|
587 |
+
|
588 |
+
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
|
589 |
+
|
590 |
+
$Block['li']['text'] []= $text;
|
591 |
+
|
592 |
+
unset($Block['interrupted']);
|
593 |
+
|
594 |
+
return $Block;
|
595 |
+
}
|
596 |
+
}
|
597 |
+
|
598 |
+
#
|
599 |
+
# Quote
|
600 |
+
|
601 |
+
protected function blockQuote($Line)
|
602 |
+
{
|
603 |
+
if (preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))
|
604 |
+
{
|
605 |
+
$Block = array(
|
606 |
+
'element' => array(
|
607 |
+
'name' => 'blockquote',
|
608 |
+
'handler' => 'lines',
|
609 |
+
'text' => (array) $matches[1],
|
610 |
+
),
|
611 |
+
);
|
612 |
+
|
613 |
+
return $Block;
|
614 |
+
}
|
615 |
+
}
|
616 |
+
|
617 |
+
protected function blockQuoteContinue($Line, array $Block)
|
618 |
+
{
|
619 |
+
if ($Line['text'][0] === '>' and preg_match('/^>[ ]?(.*)/', $Line['text'], $matches))
|
620 |
+
{
|
621 |
+
if (isset($Block['interrupted']))
|
622 |
+
{
|
623 |
+
$Block['element']['text'] []= '';
|
624 |
+
|
625 |
+
unset($Block['interrupted']);
|
626 |
+
}
|
627 |
+
|
628 |
+
$Block['element']['text'] []= $matches[1];
|
629 |
+
|
630 |
+
return $Block;
|
631 |
+
}
|
632 |
+
|
633 |
+
if ( ! isset($Block['interrupted']))
|
634 |
+
{
|
635 |
+
$Block['element']['text'] []= $Line['text'];
|
636 |
+
|
637 |
+
return $Block;
|
638 |
+
}
|
639 |
+
}
|
640 |
+
|
641 |
+
#
|
642 |
+
# Rule
|
643 |
+
|
644 |
+
protected function blockRule($Line)
|
645 |
+
{
|
646 |
+
if (preg_match('/^(['.$Line['text'][0].'])([ ]*\1){2,}[ ]*$/', $Line['text']))
|
647 |
+
{
|
648 |
+
$Block = array(
|
649 |
+
'element' => array(
|
650 |
+
'name' => 'hr'
|
651 |
+
),
|
652 |
+
);
|
653 |
+
|
654 |
+
return $Block;
|
655 |
+
}
|
656 |
+
}
|
657 |
+
|
658 |
+
#
|
659 |
+
# Setext
|
660 |
+
|
661 |
+
protected function blockSetextHeader($Line, array $Block = null)
|
662 |
+
{
|
663 |
+
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
|
664 |
+
{
|
665 |
+
return;
|
666 |
+
}
|
667 |
+
|
668 |
+
if (chop($Line['text'], $Line['text'][0]) === '')
|
669 |
+
{
|
670 |
+
$Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2';
|
671 |
+
|
672 |
+
return $Block;
|
673 |
+
}
|
674 |
+
}
|
675 |
+
|
676 |
+
#
|
677 |
+
# Markup
|
678 |
+
|
679 |
+
protected function blockMarkup($Line)
|
680 |
+
{
|
681 |
+
if ($this->markupEscaped)
|
682 |
+
{
|
683 |
+
return;
|
684 |
+
}
|
685 |
+
|
686 |
+
if (preg_match('/^<(\w*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches))
|
687 |
+
{
|
688 |
+
$element = strtolower($matches[1]);
|
689 |
+
|
690 |
+
if (in_array($element, $this->textLevelElements))
|
691 |
+
{
|
692 |
+
return;
|
693 |
+
}
|
694 |
+
|
695 |
+
$Block = array(
|
696 |
+
'name' => $matches[1],
|
697 |
+
'depth' => 0,
|
698 |
+
'markup' => $Line['text'],
|
699 |
+
);
|
700 |
+
|
701 |
+
$length = strlen($matches[0]);
|
702 |
+
|
703 |
+
$remainder = substr($Line['text'], $length);
|
704 |
+
|
705 |
+
if (trim($remainder) === '')
|
706 |
+
{
|
707 |
+
if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
|
708 |
+
{
|
709 |
+
$Block['closed'] = true;
|
710 |
+
|
711 |
+
$Block['void'] = true;
|
712 |
+
}
|
713 |
+
}
|
714 |
+
else
|
715 |
+
{
|
716 |
+
if (isset($matches[2]) or in_array($matches[1], $this->voidElements))
|
717 |
+
{
|
718 |
+
return;
|
719 |
+
}
|
720 |
+
|
721 |
+
if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder))
|
722 |
+
{
|
723 |
+
$Block['closed'] = true;
|
724 |
+
}
|
725 |
+
}
|
726 |
+
|
727 |
+
return $Block;
|
728 |
+
}
|
729 |
+
}
|
730 |
+
|
731 |
+
protected function blockMarkupContinue($Line, array $Block)
|
732 |
+
{
|
733 |
+
if (isset($Block['closed']))
|
734 |
+
{
|
735 |
+
return;
|
736 |
+
}
|
737 |
+
|
738 |
+
if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open
|
739 |
+
{
|
740 |
+
$Block['depth'] ++;
|
741 |
+
}
|
742 |
+
|
743 |
+
if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close
|
744 |
+
{
|
745 |
+
if ($Block['depth'] > 0)
|
746 |
+
{
|
747 |
+
$Block['depth'] --;
|
748 |
+
}
|
749 |
+
else
|
750 |
+
{
|
751 |
+
$Block['closed'] = true;
|
752 |
+
}
|
753 |
+
}
|
754 |
+
|
755 |
+
if (isset($Block['interrupted']))
|
756 |
+
{
|
757 |
+
$Block['markup'] .= "\n";
|
758 |
+
|
759 |
+
unset($Block['interrupted']);
|
760 |
+
}
|
761 |
+
|
762 |
+
$Block['markup'] .= "\n".$Line['body'];
|
763 |
+
|
764 |
+
return $Block;
|
765 |
+
}
|
766 |
+
|
767 |
+
#
|
768 |
+
# Reference
|
769 |
+
|
770 |
+
protected function blockReference($Line)
|
771 |
+
{
|
772 |
+
if (preg_match('/^\[(.+?)\]:[ ]*<?(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*$/', $Line['text'], $matches))
|
773 |
+
{
|
774 |
+
$id = strtolower($matches[1]);
|
775 |
+
|
776 |
+
$Data = array(
|
777 |
+
'url' => $matches[2],
|
778 |
+
'title' => null,
|
779 |
+
);
|
780 |
+
|
781 |
+
if (isset($matches[3]))
|
782 |
+
{
|
783 |
+
$Data['title'] = $matches[3];
|
784 |
+
}
|
785 |
+
|
786 |
+
$this->DefinitionData['Reference'][$id] = $Data;
|
787 |
+
|
788 |
+
$Block = array(
|
789 |
+
'hidden' => true,
|
790 |
+
);
|
791 |
+
|
792 |
+
return $Block;
|
793 |
+
}
|
794 |
+
}
|
795 |
+
|
796 |
+
#
|
797 |
+
# Table
|
798 |
+
|
799 |
+
protected function blockTable($Line, array $Block = null)
|
800 |
+
{
|
801 |
+
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
|
802 |
+
{
|
803 |
+
return;
|
804 |
+
}
|
805 |
+
|
806 |
+
if (strpos($Block['element']['text'], '|') !== false and chop($Line['text'], ' -:|') === '')
|
807 |
+
{
|
808 |
+
$alignments = array();
|
809 |
+
|
810 |
+
$divider = $Line['text'];
|
811 |
+
|
812 |
+
$divider = trim($divider);
|
813 |
+
$divider = trim($divider, '|');
|
814 |
+
|
815 |
+
$dividerCells = explode('|', $divider);
|
816 |
+
|
817 |
+
foreach ($dividerCells as $dividerCell)
|
818 |
+
{
|
819 |
+
$dividerCell = trim($dividerCell);
|
820 |
+
|
821 |
+
if ($dividerCell === '')
|
822 |
+
{
|
823 |
+
continue;
|
824 |
+
}
|
825 |
+
|
826 |
+
$alignment = null;
|
827 |
+
|
828 |
+
if ($dividerCell[0] === ':')
|
829 |
+
{
|
830 |
+
$alignment = 'left';
|
831 |
+
}
|
832 |
+
|
833 |
+
if (substr($dividerCell, - 1) === ':')
|
834 |
+
{
|
835 |
+
$alignment = $alignment === 'left' ? 'center' : 'right';
|
836 |
+
}
|
837 |
+
|
838 |
+
$alignments []= $alignment;
|
839 |
+
}
|
840 |
+
|
841 |
+
# ~
|
842 |
+
|
843 |
+
$HeaderElements = array();
|
844 |
+
|
845 |
+
$header = $Block['element']['text'];
|
846 |
+
|
847 |
+
$header = trim($header);
|
848 |
+
$header = trim($header, '|');
|
849 |
+
|
850 |
+
$headerCells = explode('|', $header);
|
851 |
+
|
852 |
+
foreach ($headerCells as $index => $headerCell)
|
853 |
+
{
|
854 |
+
$headerCell = trim($headerCell);
|
855 |
+
|
856 |
+
$HeaderElement = array(
|
857 |
+
'name' => 'th',
|
858 |
+
'text' => $headerCell,
|
859 |
+
'handler' => 'line',
|
860 |
+
);
|
861 |
+
|
862 |
+
if (isset($alignments[$index]))
|
863 |
+
{
|
864 |
+
$alignment = $alignments[$index];
|
865 |
+
|
866 |
+
$HeaderElement['attributes'] = array(
|
867 |
+
'style' => 'text-align: '.$alignment.';',
|
868 |
+
);
|
869 |
+
}
|
870 |
+
|
871 |
+
$HeaderElements []= $HeaderElement;
|
872 |
+
}
|
873 |
+
|
874 |
+
# ~
|
875 |
+
|
876 |
+
$Block = array(
|
877 |
+
'alignments' => $alignments,
|
878 |
+
'identified' => true,
|
879 |
+
'element' => array(
|
880 |
+
'name' => 'table',
|
881 |
+
'handler' => 'elements',
|
882 |
+
),
|
883 |
+
);
|
884 |
+
|
885 |
+
$Block['element']['text'] []= array(
|
886 |
+
'name' => 'thead',
|
887 |
+
'handler' => 'elements',
|
888 |
+
);
|
889 |
+
|
890 |
+
$Block['element']['text'] []= array(
|
891 |
+
'name' => 'tbody',
|
892 |
+
'handler' => 'elements',
|
893 |
+
'text' => array(),
|
894 |
+
);
|
895 |
+
|
896 |
+
$Block['element']['text'][0]['text'] []= array(
|
897 |
+
'name' => 'tr',
|
898 |
+
'handler' => 'elements',
|
899 |
+
'text' => $HeaderElements,
|
900 |
+
);
|
901 |
+
|
902 |
+
return $Block;
|
903 |
+
}
|
904 |
+
}
|
905 |
+
|
906 |
+
protected function blockTableContinue($Line, array $Block)
|
907 |
+
{
|
908 |
+
if (isset($Block['interrupted']))
|
909 |
+
{
|
910 |
+
return;
|
911 |
+
}
|
912 |
+
|
913 |
+
if ($Line['text'][0] === '|' or strpos($Line['text'], '|'))
|
914 |
+
{
|
915 |
+
$Elements = array();
|
916 |
+
|
917 |
+
$row = $Line['text'];
|
918 |
+
|
919 |
+
$row = trim($row);
|
920 |
+
$row = trim($row, '|');
|
921 |
+
|
922 |
+
preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]+`|`)+/', $row, $matches);
|
923 |
+
|
924 |
+
foreach ($matches[0] as $index => $cell)
|
925 |
+
{
|
926 |
+
$cell = trim($cell);
|
927 |
+
|
928 |
+
$Element = array(
|
929 |
+
'name' => 'td',
|
930 |
+
'handler' => 'line',
|
931 |
+
'text' => $cell,
|
932 |
+
);
|
933 |
+
|
934 |
+
if (isset($Block['alignments'][$index]))
|
935 |
+
{
|
936 |
+
$Element['attributes'] = array(
|
937 |
+
'style' => 'text-align: '.$Block['alignments'][$index].';',
|
938 |
+
);
|
939 |
+
}
|
940 |
+
|
941 |
+
$Elements []= $Element;
|
942 |
+
}
|
943 |
+
|
944 |
+
$Element = array(
|
945 |
+
'name' => 'tr',
|
946 |
+
'handler' => 'elements',
|
947 |
+
'text' => $Elements,
|
948 |
+
);
|
949 |
+
|
950 |
+
$Block['element']['text'][1]['text'] []= $Element;
|
951 |
+
|
952 |
+
return $Block;
|
953 |
+
}
|
954 |
+
}
|
955 |
+
|
956 |
+
#
|
957 |
+
# ~
|
958 |
+
#
|
959 |
+
|
960 |
+
protected function paragraph($Line)
|
961 |
+
{
|
962 |
+
$Block = array(
|
963 |
+
'element' => array(
|
964 |
+
'name' => 'p',
|
965 |
+
'text' => $Line['text'],
|
966 |
+
'handler' => 'line',
|
967 |
+
),
|
968 |
+
);
|
969 |
+
|
970 |
+
return $Block;
|
971 |
+
}
|
972 |
+
|
973 |
+
#
|
974 |
+
# Inline Elements
|
975 |
+
#
|
976 |
+
|
977 |
+
protected $InlineTypes = array(
|
978 |
+
'"' => array('SpecialCharacter'),
|
979 |
+
'!' => array('Image'),
|
980 |
+
'&' => array('SpecialCharacter'),
|
981 |
+
'*' => array('Emphasis'),
|
982 |
+
':' => array('Url'),
|
983 |
+
'<' => array('UrlTag', 'EmailTag', 'Markup', 'SpecialCharacter'),
|
984 |
+
'>' => array('SpecialCharacter'),
|
985 |
+
'[' => array('Link'),
|
986 |
+
'_' => array('Emphasis'),
|
987 |
+
'`' => array('Code'),
|
988 |
+
'~' => array('Strikethrough'),
|
989 |
+
'\\' => array('EscapeSequence'),
|
990 |
+
);
|
991 |
+
|
992 |
+
# ~
|
993 |
+
|
994 |
+
protected $inlineMarkerList = '!"*_&[:<>`~\\';
|
995 |
+
|
996 |
+
#
|
997 |
+
# ~
|
998 |
+
#
|
999 |
+
|
1000 |
+
public function line($text)
|
1001 |
+
{
|
1002 |
+
$markup = '';
|
1003 |
+
|
1004 |
+
# $excerpt is based on the first occurrence of a marker
|
1005 |
+
|
1006 |
+
while ($excerpt = strpbrk($text, $this->inlineMarkerList))
|
1007 |
+
{
|
1008 |
+
$marker = $excerpt[0];
|
1009 |
+
|
1010 |
+
$markerPosition = strpos($text, $marker);
|
1011 |
+
|
1012 |
+
$Excerpt = array('text' => $excerpt, 'context' => $text);
|
1013 |
+
|
1014 |
+
foreach ($this->InlineTypes[$marker] as $inlineType)
|
1015 |
+
{
|
1016 |
+
$Inline = $this->{'inline'.$inlineType}($Excerpt);
|
1017 |
+
|
1018 |
+
if ( ! isset($Inline))
|
1019 |
+
{
|
1020 |
+
continue;
|
1021 |
+
}
|
1022 |
+
|
1023 |
+
# makes sure that the inline belongs to "our" marker
|
1024 |
+
|
1025 |
+
if (isset($Inline['position']) and $Inline['position'] > $markerPosition)
|
1026 |
+
{
|
1027 |
+
continue;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
# sets a default inline position
|
1031 |
+
|
1032 |
+
if ( ! isset($Inline['position']))
|
1033 |
+
{
|
1034 |
+
$Inline['position'] = $markerPosition;
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
# the text that comes before the inline
|
1038 |
+
$unmarkedText = substr($text, 0, $Inline['position']);
|
1039 |
+
|
1040 |
+
# compile the unmarked text
|
1041 |
+
$markup .= $this->unmarkedText($unmarkedText);
|
1042 |
+
|
1043 |
+
# compile the inline
|
1044 |
+
$markup .= isset($Inline['markup']) ? $Inline['markup'] : $this->element($Inline['element']);
|
1045 |
+
|
1046 |
+
# remove the examined text
|
1047 |
+
$text = substr($text, $Inline['position'] + $Inline['extent']);
|
1048 |
+
|
1049 |
+
continue 2;
|
1050 |
+
}
|
1051 |
+
|
1052 |
+
# the marker does not belong to an inline
|
1053 |
+
|
1054 |
+
$unmarkedText = substr($text, 0, $markerPosition + 1);
|
1055 |
+
|
1056 |
+
$markup .= $this->unmarkedText($unmarkedText);
|
1057 |
+
|
1058 |
+
$text = substr($text, $markerPosition + 1);
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
$markup .= $this->unmarkedText($text);
|
1062 |
+
|
1063 |
+
return $markup;
|
1064 |
+
}
|
1065 |
+
|
1066 |
+
#
|
1067 |
+
# ~
|
1068 |
+
#
|
1069 |
+
|
1070 |
+
protected function inlineCode($Excerpt)
|
1071 |
+
{
|
1072 |
+
$marker = $Excerpt['text'][0];
|
1073 |
+
|
1074 |
+
if (preg_match('/^('.$marker.'+)[ ]*(.+?)[ ]*(?<!'.$marker.')\1(?!'.$marker.')/s', $Excerpt['text'], $matches))
|
1075 |
+
{
|
1076 |
+
$text = $matches[2];
|
1077 |
+
$text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8');
|
1078 |
+
$text = preg_replace("/[ ]*\n/", ' ', $text);
|
1079 |
+
|
1080 |
+
return array(
|
1081 |
+
'extent' => strlen($matches[0]),
|
1082 |
+
'element' => array(
|
1083 |
+
'name' => 'code',
|
1084 |
+
'text' => $text,
|
1085 |
+
),
|
1086 |
+
);
|
1087 |
+
}
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
protected function inlineEmailTag($Excerpt)
|
1091 |
+
{
|
1092 |
+
if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<((mailto:)?\S+?@\S+?)>/i', $Excerpt['text'], $matches))
|
1093 |
+
{
|
1094 |
+
$url = $matches[1];
|
1095 |
+
|
1096 |
+
if ( ! isset($matches[2]))
|
1097 |
+
{
|
1098 |
+
$url = 'mailto:' . $url;
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
return array(
|
1102 |
+
'extent' => strlen($matches[0]),
|
1103 |
+
'element' => array(
|
1104 |
+
'name' => 'a',
|
1105 |
+
'text' => $matches[1],
|
1106 |
+
'attributes' => array(
|
1107 |
+
'href' => $url,
|
1108 |
+
),
|
1109 |
+
),
|
1110 |
+
);
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
protected function inlineEmphasis($Excerpt)
|
1115 |
+
{
|
1116 |
+
if ( ! isset($Excerpt['text'][1]))
|
1117 |
+
{
|
1118 |
+
return;
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
$marker = $Excerpt['text'][0];
|
1122 |
+
|
1123 |
+
if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches))
|
1124 |
+
{
|
1125 |
+
$emphasis = 'strong';
|
1126 |
+
}
|
1127 |
+
elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches))
|
1128 |
+
{
|
1129 |
+
$emphasis = 'em';
|
1130 |
+
}
|
1131 |
+
else
|
1132 |
+
{
|
1133 |
+
return;
|
1134 |
+
}
|
1135 |
+
|
1136 |
+
return array(
|
1137 |
+
'extent' => strlen($matches[0]),
|
1138 |
+
'element' => array(
|
1139 |
+
'name' => $emphasis,
|
1140 |
+
'handler' => 'line',
|
1141 |
+
'text' => $matches[1],
|
1142 |
+
),
|
1143 |
+
);
|
1144 |
+
}
|
1145 |
+
|
1146 |
+
protected function inlineEscapeSequence($Excerpt)
|
1147 |
+
{
|
1148 |
+
if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters))
|
1149 |
+
{
|
1150 |
+
return array(
|
1151 |
+
'markup' => $Excerpt['text'][1],
|
1152 |
+
'extent' => 2,
|
1153 |
+
);
|
1154 |
+
}
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
protected function inlineImage($Excerpt)
|
1158 |
+
{
|
1159 |
+
if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[')
|
1160 |
+
{
|
1161 |
+
return;
|
1162 |
+
}
|
1163 |
+
|
1164 |
+
$Excerpt['text']= substr($Excerpt['text'], 1);
|
1165 |
+
|
1166 |
+
$Link = $this->inlineLink($Excerpt);
|
1167 |
+
|
1168 |
+
if ($Link === null)
|
1169 |
+
{
|
1170 |
+
return;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
$Inline = array(
|
1174 |
+
'extent' => $Link['extent'] + 1,
|
1175 |
+
'element' => array(
|
1176 |
+
'name' => 'img',
|
1177 |
+
'attributes' => array(
|
1178 |
+
'src' => $Link['element']['attributes']['href'],
|
1179 |
+
'alt' => $Link['element']['text'],
|
1180 |
+
),
|
1181 |
+
),
|
1182 |
+
);
|
1183 |
+
|
1184 |
+
$Inline['element']['attributes'] += $Link['element']['attributes'];
|
1185 |
+
|
1186 |
+
unset($Inline['element']['attributes']['href']);
|
1187 |
+
|
1188 |
+
return $Inline;
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
protected function inlineLink($Excerpt)
|
1192 |
+
{
|
1193 |
+
$Element = array(
|
1194 |
+
'name' => 'a',
|
1195 |
+
'handler' => 'line',
|
1196 |
+
'text' => null,
|
1197 |
+
'attributes' => array(
|
1198 |
+
'href' => null,
|
1199 |
+
'title' => null,
|
1200 |
+
),
|
1201 |
+
);
|
1202 |
+
|
1203 |
+
$extent = 0;
|
1204 |
+
|
1205 |
+
$remainder = $Excerpt['text'];
|
1206 |
+
|
1207 |
+
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
|
1208 |
+
{
|
1209 |
+
$Element['text'] = $matches[1];
|
1210 |
+
|
1211 |
+
$extent += strlen($matches[0]);
|
1212 |
+
|
1213 |
+
$remainder = substr($remainder, $extent);
|
1214 |
+
}
|
1215 |
+
else
|
1216 |
+
{
|
1217 |
+
return;
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
if (preg_match('/^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?\s*[)]/', $remainder, $matches))
|
1221 |
+
{
|
1222 |
+
$Element['attributes']['href'] = $matches[1];
|
1223 |
+
|
1224 |
+
if (isset($matches[2]))
|
1225 |
+
{
|
1226 |
+
$Element['attributes']['title'] = substr($matches[2], 1, - 1);
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
$extent += strlen($matches[0]);
|
1230 |
+
}
|
1231 |
+
else
|
1232 |
+
{
|
1233 |
+
if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches))
|
1234 |
+
{
|
1235 |
+
$definition = strlen($matches[1]) ? $matches[1] : $Element['text'];
|
1236 |
+
$definition = strtolower($definition);
|
1237 |
+
|
1238 |
+
$extent += strlen($matches[0]);
|
1239 |
+
}
|
1240 |
+
else
|
1241 |
+
{
|
1242 |
+
$definition = strtolower($Element['text']);
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
if ( ! isset($this->DefinitionData['Reference'][$definition]))
|
1246 |
+
{
|
1247 |
+
return;
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
$Definition = $this->DefinitionData['Reference'][$definition];
|
1251 |
+
|
1252 |
+
$Element['attributes']['href'] = $Definition['url'];
|
1253 |
+
$Element['attributes']['title'] = $Definition['title'];
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
$Element['attributes']['href'] = str_replace(array('&', '<'), array('&', '<'), $Element['attributes']['href']);
|
1257 |
+
|
1258 |
+
return array(
|
1259 |
+
'extent' => $extent,
|
1260 |
+
'element' => $Element,
|
1261 |
+
);
|
1262 |
+
}
|
1263 |
+
|
1264 |
+
protected function inlineMarkup($Excerpt)
|
1265 |
+
{
|
1266 |
+
if ($this->markupEscaped or strpos($Excerpt['text'], '>') === false)
|
1267 |
+
{
|
1268 |
+
return;
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w*[ ]*>/s', $Excerpt['text'], $matches))
|
1272 |
+
{
|
1273 |
+
return array(
|
1274 |
+
'markup' => $matches[0],
|
1275 |
+
'extent' => strlen($matches[0]),
|
1276 |
+
);
|
1277 |
+
}
|
1278 |
+
|
1279 |
+
if ($Excerpt['text'][1] === '!' and preg_match('/^<!---?[^>-](?:-?[^-])*-->/s', $Excerpt['text'], $matches))
|
1280 |
+
{
|
1281 |
+
return array(
|
1282 |
+
'markup' => $matches[0],
|
1283 |
+
'extent' => strlen($matches[0]),
|
1284 |
+
);
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches))
|
1288 |
+
{
|
1289 |
+
return array(
|
1290 |
+
'markup' => $matches[0],
|
1291 |
+
'extent' => strlen($matches[0]),
|
1292 |
+
);
|
1293 |
+
}
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
protected function inlineSpecialCharacter($Excerpt)
|
1297 |
+
{
|
1298 |
+
if ($Excerpt['text'][0] === '&' and ! preg_match('/^&#?\w+;/', $Excerpt['text']))
|
1299 |
+
{
|
1300 |
+
return array(
|
1301 |
+
'markup' => '&',
|
1302 |
+
'extent' => 1,
|
1303 |
+
);
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
$SpecialCharacter = array('>' => 'gt', '<' => 'lt', '"' => 'quot');
|
1307 |
+
|
1308 |
+
if (isset($SpecialCharacter[$Excerpt['text'][0]]))
|
1309 |
+
{
|
1310 |
+
return array(
|
1311 |
+
'markup' => '&'.$SpecialCharacter[$Excerpt['text'][0]].';',
|
1312 |
+
'extent' => 1,
|
1313 |
+
);
|
1314 |
+
}
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
protected function inlineStrikethrough($Excerpt)
|
1318 |
+
{
|
1319 |
+
if ( ! isset($Excerpt['text'][1]))
|
1320 |
+
{
|
1321 |
+
return;
|
1322 |
+
}
|
1323 |
+
|
1324 |
+
if ($Excerpt['text'][1] === '~' and preg_match('/^~~(?=\S)(.+?)(?<=\S)~~/', $Excerpt['text'], $matches))
|
1325 |
+
{
|
1326 |
+
return array(
|
1327 |
+
'extent' => strlen($matches[0]),
|
1328 |
+
'element' => array(
|
1329 |
+
'name' => 'del',
|
1330 |
+
'text' => $matches[1],
|
1331 |
+
'handler' => 'line',
|
1332 |
+
),
|
1333 |
+
);
|
1334 |
+
}
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
protected function inlineUrl($Excerpt)
|
1338 |
+
{
|
1339 |
+
if ($this->urlsLinked !== true or ! isset($Excerpt['text'][2]) or $Excerpt['text'][2] !== '/')
|
1340 |
+
{
|
1341 |
+
return;
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE))
|
1345 |
+
{
|
1346 |
+
$Inline = array(
|
1347 |
+
'extent' => strlen($matches[0][0]),
|
1348 |
+
'position' => $matches[0][1],
|
1349 |
+
'element' => array(
|
1350 |
+
'name' => 'a',
|
1351 |
+
'text' => $matches[0][0],
|
1352 |
+
'attributes' => array(
|
1353 |
+
'href' => $matches[0][0],
|
1354 |
+
),
|
1355 |
+
),
|
1356 |
+
);
|
1357 |
+
|
1358 |
+
return $Inline;
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
protected function inlineUrlTag($Excerpt)
|
1363 |
+
{
|
1364 |
+
if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(\w+:\/{2}[^ >]+)>/i', $Excerpt['text'], $matches))
|
1365 |
+
{
|
1366 |
+
$url = str_replace(array('&', '<'), array('&', '<'), $matches[1]);
|
1367 |
+
|
1368 |
+
return array(
|
1369 |
+
'extent' => strlen($matches[0]),
|
1370 |
+
'element' => array(
|
1371 |
+
'name' => 'a',
|
1372 |
+
'text' => $url,
|
1373 |
+
'attributes' => array(
|
1374 |
+
'href' => $url,
|
1375 |
+
),
|
1376 |
+
),
|
1377 |
+
);
|
1378 |
+
}
|
1379 |
+
}
|
1380 |
+
|
1381 |
+
# ~
|
1382 |
+
|
1383 |
+
protected function unmarkedText($text)
|
1384 |
+
{
|
1385 |
+
if ($this->breaksEnabled)
|
1386 |
+
{
|
1387 |
+
$text = preg_replace('/[ ]*\n/', "<br />\n", $text);
|
1388 |
+
}
|
1389 |
+
else
|
1390 |
+
{
|
1391 |
+
$text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "<br />\n", $text);
|
1392 |
+
$text = str_replace(" \n", "\n", $text);
|
1393 |
+
}
|
1394 |
+
|
1395 |
+
return $text;
|
1396 |
+
}
|
1397 |
+
|
1398 |
+
#
|
1399 |
+
# Handlers
|
1400 |
+
#
|
1401 |
+
|
1402 |
+
protected function element(array $Element)
|
1403 |
+
{
|
1404 |
+
$markup = '<'.$Element['name'];
|
1405 |
+
|
1406 |
+
if (isset($Element['attributes']))
|
1407 |
+
{
|
1408 |
+
foreach ($Element['attributes'] as $name => $value)
|
1409 |
+
{
|
1410 |
+
if ($value === null)
|
1411 |
+
{
|
1412 |
+
continue;
|
1413 |
+
}
|
1414 |
+
|
1415 |
+
$markup .= ' '.$name.'="'.$value.'"';
|
1416 |
+
}
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
if (isset($Element['text']))
|
1420 |
+
{
|
1421 |
+
$markup .= '>';
|
1422 |
+
|
1423 |
+
if (isset($Element['handler']))
|
1424 |
+
{
|
1425 |
+
$markup .= $this->{$Element['handler']}($Element['text']);
|
1426 |
+
}
|
1427 |
+
else
|
1428 |
+
{
|
1429 |
+
$markup .= $Element['text'];
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
$markup .= '</'.$Element['name'].'>';
|
1433 |
+
}
|
1434 |
+
else
|
1435 |
+
{
|
1436 |
+
$markup .= ' />';
|
1437 |
+
}
|
1438 |
+
|
1439 |
+
return $markup;
|
1440 |
+
}
|
1441 |
+
|
1442 |
+
protected function elements(array $Elements)
|
1443 |
+
{
|
1444 |
+
$markup = '';
|
1445 |
+
|
1446 |
+
foreach ($Elements as $Element)
|
1447 |
+
{
|
1448 |
+
$markup .= "\n" . $this->element($Element);
|
1449 |
+
}
|
1450 |
+
|
1451 |
+
$markup .= "\n";
|
1452 |
+
|
1453 |
+
return $markup;
|
1454 |
+
}
|
1455 |
+
|
1456 |
+
# ~
|
1457 |
+
|
1458 |
+
protected function li($lines)
|
1459 |
+
{
|
1460 |
+
$markup = $this->lines($lines);
|
1461 |
+
|
1462 |
+
$trimmedMarkup = trim($markup);
|
1463 |
+
|
1464 |
+
if ( ! in_array('', $lines) and substr($trimmedMarkup, 0, 3) === '<p>')
|
1465 |
+
{
|
1466 |
+
$markup = $trimmedMarkup;
|
1467 |
+
$markup = substr($markup, 3);
|
1468 |
+
|
1469 |
+
$position = strpos($markup, "</p>");
|
1470 |
+
|
1471 |
+
$markup = substr_replace($markup, '', $position, 4);
|
1472 |
+
}
|
1473 |
+
|
1474 |
+
return $markup;
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
#
|
1478 |
+
# Deprecated Methods
|
1479 |
+
#
|
1480 |
+
|
1481 |
+
function parse($text)
|
1482 |
+
{
|
1483 |
+
$markup = $this->text($text);
|
1484 |
+
|
1485 |
+
return $markup;
|
1486 |
+
}
|
1487 |
+
|
1488 |
+
#
|
1489 |
+
# Static Methods
|
1490 |
+
#
|
1491 |
+
|
1492 |
+
static function instance($name = 'default')
|
1493 |
+
{
|
1494 |
+
if (isset(self::$instances[$name]))
|
1495 |
+
{
|
1496 |
+
return self::$instances[$name];
|
1497 |
+
}
|
1498 |
+
|
1499 |
+
$instance = new static();
|
1500 |
+
|
1501 |
+
self::$instances[$name] = $instance;
|
1502 |
+
|
1503 |
+
return $instance;
|
1504 |
+
}
|
1505 |
+
|
1506 |
+
private static $instances = array();
|
1507 |
+
|
1508 |
+
#
|
1509 |
+
# Fields
|
1510 |
+
#
|
1511 |
+
|
1512 |
+
protected $DefinitionData;
|
1513 |
+
|
1514 |
+
#
|
1515 |
+
# Read-Only
|
1516 |
+
|
1517 |
+
protected $specialCharacters = array(
|
1518 |
+
'\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!', '|',
|
1519 |
+
);
|
1520 |
+
|
1521 |
+
protected $StrongRegex = array(
|
1522 |
+
'*' => '/^[*]{2}((?:\\\\\*|[^*]|[*][^*]*[*])+?)[*]{2}(?![*])/s',
|
1523 |
+
'_' => '/^__((?:\\\\_|[^_]|_[^_]*_)+?)__(?!_)/us',
|
1524 |
+
);
|
1525 |
+
|
1526 |
+
protected $EmRegex = array(
|
1527 |
+
'*' => '/^[*]((?:\\\\\*|[^*]|[*][*][^*]+?[*][*])+?)[*](?![*])/s',
|
1528 |
+
'_' => '/^_((?:\\\\_|[^_]|__[^_]*__)+?)_(?!_)\b/us',
|
1529 |
+
);
|
1530 |
+
|
1531 |
+
protected $regexHtmlAttribute = '[a-zA-Z_:][\w:.-]*(?:\s*=\s*(?:[^"\'=<>`\s]+|"[^"]*"|\'[^\']*\'))?';
|
1532 |
+
|
1533 |
+
protected $voidElements = array(
|
1534 |
+
'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source',
|
1535 |
+
);
|
1536 |
+
|
1537 |
+
protected $textLevelElements = array(
|
1538 |
+
'a', 'br', 'bdo', 'abbr', 'blink', 'nextid', 'acronym', 'basefont',
|
1539 |
+
'b', 'em', 'big', 'cite', 'small', 'spacer', 'listing',
|
1540 |
+
'i', 'rp', 'del', 'code', 'strike', 'marquee',
|
1541 |
+
'q', 'rt', 'ins', 'font', 'strong',
|
1542 |
+
's', 'tt', 'kbd', 'mark',
|
1543 |
+
'u', 'xm', 'sub', 'nobr',
|
1544 |
+
'sup', 'ruby',
|
1545 |
+
'var', 'span',
|
1546 |
+
'wbr', 'time',
|
1547 |
+
);
|
1548 |
+
}
|
includes/vendor/erusev/parsedown/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
> You might also like [Caret](https://caret.io?ref=parsedown) - our Markdown editor for Mac / Windows / Linux.
|
2 |
+
|
3 |
+
## Parsedown
|
4 |
+
|
5 |
+
[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown)
|
6 |
+
<!--[![Total Downloads](http://img.shields.io/packagist/dt/erusev/parsedown.svg?style=flat-square)](https://packagist.org/packages/erusev/parsedown)-->
|
7 |
+
|
8 |
+
Better Markdown Parser in PHP
|
9 |
+
|
10 |
+
[Demo](http://parsedown.org/demo) |
|
11 |
+
[Benchmarks](http://parsedown.org/speed) |
|
12 |
+
[Tests](http://parsedown.org/tests/) |
|
13 |
+
[Documentation](https://github.com/erusev/parsedown/wiki/)
|
14 |
+
|
15 |
+
### Features
|
16 |
+
|
17 |
+
* One File
|
18 |
+
* No Dependencies
|
19 |
+
* Super Fast
|
20 |
+
* Extensible
|
21 |
+
* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
|
22 |
+
* Tested in 5.3 to 7.1 and in HHVM
|
23 |
+
* [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
|
24 |
+
|
25 |
+
### Installation
|
26 |
+
|
27 |
+
Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown).
|
28 |
+
|
29 |
+
### Example
|
30 |
+
|
31 |
+
``` php
|
32 |
+
$Parsedown = new Parsedown();
|
33 |
+
|
34 |
+
echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>
|
35 |
+
```
|
36 |
+
|
37 |
+
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
|
38 |
+
|
39 |
+
### Security
|
40 |
+
|
41 |
+
Parsedown does not sanitize the HTML that it generates. When you deal with untrusted content (ex: user commnets) you should also use a HTML sanitizer like [HTML Purifier](http://htmlpurifier.org/).
|
42 |
+
|
43 |
+
### Questions
|
44 |
+
|
45 |
+
**How does Parsedown work?**
|
46 |
+
|
47 |
+
It tries to read Markdown like a human. First, it looks at the lines. It’s interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines).
|
48 |
+
|
49 |
+
We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages.
|
50 |
+
|
51 |
+
**Is it compliant with CommonMark?**
|
52 |
+
|
53 |
+
It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve.
|
54 |
+
|
55 |
+
**Who uses it?**
|
56 |
+
|
57 |
+
[phpDocumentor](http://www.phpdoc.org/), [October CMS](http://octobercms.com/), [Bolt CMS](http://bolt.cm/), [Kirby CMS](http://getkirby.com/), [Grav CMS](http://getgrav.org/), [Statamic CMS](http://www.statamic.com/), [Herbie CMS](http://www.getherbie.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony demo](https://github.com/symfony/symfony-demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).
|
58 |
+
|
59 |
+
**How can I help?**
|
60 |
+
|
61 |
+
Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).
|
includes/vendor/erusev/parsedown/composer.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "erusev/parsedown",
|
3 |
+
"description": "Parser for Markdown.",
|
4 |
+
"keywords": ["markdown", "parser"],
|
5 |
+
"homepage": "http://parsedown.org",
|
6 |
+
"type": "library",
|
7 |
+
"license": "MIT",
|
8 |
+
"authors": [
|
9 |
+
{
|
10 |
+
"name": "Emanuil Rusev",
|
11 |
+
"email": "hello@erusev.com",
|
12 |
+
"homepage": "http://erusev.com"
|
13 |
+
}
|
14 |
+
],
|
15 |
+
"require": {
|
16 |
+
"php": ">=5.3.0"
|
17 |
+
},
|
18 |
+
"require-dev": {
|
19 |
+
"phpunit/phpunit": "^4.8.35"
|
20 |
+
},
|
21 |
+
"autoload": {
|
22 |
+
"psr-0": {"Parsedown": ""}
|
23 |
+
}
|
24 |
+
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wp-statistics.com/donate/
|
|
4 |
Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits, chart, browser, today, yesterday, week, month, year, total, post, page, sidebar, google, live visit, search word, agent, google analytics, webmasters, google webmasters, geoip, location
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.9
|
7 |
-
Stable tag: 12.3.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -287,6 +287,14 @@ You may also downgrade to WP Statistics 10.3 as a temporary measure, but no new
|
|
287 |
This is a security fix, please update immediately.
|
288 |
|
289 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
= 12.3.1 =
|
291 |
* We're sorry about last issues. Now you can update to new version to resolve the problems.
|
292 |
* Updated: Composer libraries.
|
@@ -295,7 +303,7 @@ This is a security fix, please update immediately.
|
|
295 |
* Fixed: Issue to get IP in Hits class.
|
296 |
* Fixed: Issue to get prefix table in searched phrases postbox.
|
297 |
* Fixed: Issue in Browscap, Used the original Browscap library in the plugin.
|
298 |
-
* If you have any problem, don't forget to send the report to
|
299 |
|
300 |
= 12.3 =
|
301 |
* The new version proves itself more than twice as faster because we had a lot of changes in the plugin.
|
4 |
Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits, chart, browser, today, yesterday, week, month, year, total, post, page, sidebar, google, live visit, search word, agent, google analytics, webmasters, google webmasters, geoip, location
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 4.9
|
7 |
+
Stable tag: 12.3.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
287 |
This is a security fix, please update immediately.
|
288 |
|
289 |
== Changelog ==
|
290 |
+
= 12.3.2 =
|
291 |
+
* Added: New feature! Show Hits on the single posts/pages.
|
292 |
+
* Added: Pages Dropdown in the page stats.
|
293 |
+
* Fixed: Menu bar for both frontend & backend.
|
294 |
+
* Fixed: Issue to create the object of the main class.
|
295 |
+
* Fixed: Issue to get page title in empty search words option.
|
296 |
+
* Fixed: Issue to show date range in the charts.
|
297 |
+
|
298 |
= 12.3.1 =
|
299 |
* We're sorry about last issues. Now you can update to new version to resolve the problems.
|
300 |
* Updated: Composer libraries.
|
303 |
* Fixed: Issue to get IP in Hits class.
|
304 |
* Fixed: Issue to get prefix table in searched phrases postbox.
|
305 |
* Fixed: Issue in Browscap, Used the original Browscap library in the plugin.
|
306 |
+
* If you have any problem, don't forget to send the report to our web site's [contact form](https://wp-statistics.com/contact/).
|
307 |
|
308 |
= 12.3 =
|
309 |
* The new version proves itself more than twice as faster because we had a lot of changes in the plugin.
|
wp-statistics.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: WP Statistics
|
4 |
* Plugin URI: https://wp-statistics.com/
|
5 |
* Description: Complete WordPress Analytics and Statistics for your site!
|
6 |
-
* Version: 12.3.
|
7 |
* Author: Verona Labs
|
8 |
* Author URI: http://veronalabs.com/
|
9 |
*
|
@@ -13,4 +13,6 @@
|
|
13 |
|
14 |
define('WP_STATISTICS_MAIN_FILE', __FILE__);
|
15 |
require plugin_dir_path(__FILE__) . 'includes/classes/class-wp-statistics.php';
|
16 |
-
|
|
|
|
3 |
* Plugin Name: WP Statistics
|
4 |
* Plugin URI: https://wp-statistics.com/
|
5 |
* Description: Complete WordPress Analytics and Statistics for your site!
|
6 |
+
* Version: 12.3.2
|
7 |
* Author: Verona Labs
|
8 |
* Author URI: http://veronalabs.com/
|
9 |
*
|
13 |
|
14 |
define('WP_STATISTICS_MAIN_FILE', __FILE__);
|
15 |
require plugin_dir_path(__FILE__) . 'includes/classes/class-wp-statistics.php';
|
16 |
+
|
17 |
+
$WP_Statistics = new WP_Statistics;
|
18 |
+
$WP_Statistics->run();
|