Version Description
Download this release
Release Info
Developer | chriscct7 |
Plugin | Google Analytics Dashboard for WP (GADWP) |
Version | 7.1.0 |
Comparing to | |
See all releases |
Code changes from version 6.8.0 to 7.1.0
- assets/css/admin-common.css +85 -85
- assets/css/admin-common.min.css +1 -1
- assets/css/images/index.php +3 -3
- assets/css/index.php +3 -3
- assets/fonts/README.md +17 -17
- assets/fonts/index.php +3 -3
- assets/gutenberg/css/editor.css +1 -1
- assets/gutenberg/js/editor.min.js +3 -3
- assets/images/index.php +3 -3
- assets/index.php +3 -3
- assets/js/admin-common.js +33 -33
- assets/js/frontend-gtag.js +178 -12
- assets/js/frontend-gtag.min.js +35 -35
- assets/js/frontend.js +643 -643
- assets/js/index.php +3 -3
- assets/lib/index.php +3 -3
- assets/lib/pandora/class-am-deactivation-survey.php +358 -358
- gadwp.php +786 -800
- includes/admin/admin.php +628 -578
- includes/admin/ajax.php +258 -258
- includes/admin/api-auth.php +670 -591
- includes/admin/common.php +964 -959
- includes/admin/index.php +3 -3
- includes/admin/licensing/autoupdate.php +208 -208
- includes/admin/licensing/plugin-upgrader-legacy.php +571 -571
- includes/admin/licensing/plugin-upgrader.php +573 -573
- includes/admin/licensing/skin-legacy.php +116 -116
- includes/admin/licensing/skin.php +116 -116
- includes/admin/notice.php +174 -235
assets/css/admin-common.css
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
.exactmetrics-wooedd-upsell-left {
|
2 |
-
width: 50%;
|
3 |
-
display: table-cell;
|
4 |
-
float: left;
|
5 |
-
}
|
6 |
-
|
7 |
-
.exactmetrics-wooedd-upsell-right {
|
8 |
-
width: 50%;
|
9 |
-
display: table-cell;
|
10 |
-
float: left;
|
11 |
-
}
|
12 |
-
|
13 |
-
.exactmetrics-wooedd-upsell-image {
|
14 |
-
width: 100%;
|
15 |
-
height: auto;
|
16 |
-
padding: 20px;
|
17 |
-
}
|
18 |
-
|
19 |
-
.exactmetrics-wooedd-upsell-image-small {
|
20 |
-
display: none;
|
21 |
-
}
|
22 |
-
|
23 |
-
.exactmetrics-wooedd-upsell-row {
|
24 |
-
display: table;
|
25 |
-
}
|
26 |
-
|
27 |
-
.exactmetrics-wooedd-upsell-left p {
|
28 |
-
margin: 1em 0;
|
29 |
-
font-size: 16px;
|
30 |
-
}
|
31 |
-
|
32 |
-
@media (max-width: 900px) {
|
33 |
-
.exactmetrics-wooedd-upsell-left {
|
34 |
-
width: 100%;
|
35 |
-
}
|
36 |
-
|
37 |
-
.exactmetrics-wooedd-upsell-right {
|
38 |
-
display: none;
|
39 |
-
}
|
40 |
-
|
41 |
-
.exactmetrics-wooedd-upsell-image-small {
|
42 |
-
display: block;
|
43 |
-
}
|
44 |
-
|
45 |
-
.exactmetrics-wooedd-upsell-image-large {
|
46 |
-
display: none;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
#wpadminbar .exactmetrics-menu-notification-indicator,
|
51 |
-
.exactmetrics-menu-notification-indicator {
|
52 |
-
min-width: 8px;
|
53 |
-
height: 18px;
|
54 |
-
border-radius: 9px;
|
55 |
-
background: #ca4a1f;
|
56 |
-
display: inline-block;
|
57 |
-
margin-left: 8px;
|
58 |
-
font-size: 11px;
|
59 |
-
font-weight: 400;
|
60 |
-
color: #fff;
|
61 |
-
text-align: center;
|
62 |
-
line-height: 1.6;
|
63 |
-
padding: 0 5px;
|
64 |
-
}
|
65 |
-
|
66 |
-
#adminmenu .exactmetrics-menu-notification-indicator.update-plugins {
|
67 |
-
margin-left: 8px;
|
68 |
-
}
|
69 |
-
|
70 |
-
@media (max-width: 782px) {
|
71 |
-
#wpadminbar .exactmetrics-menu-notification-indicator {
|
72 |
-
margin: 0 0 10px -13px;
|
73 |
-
z-index: 10;
|
74 |
-
position: relative;
|
75 |
-
}
|
76 |
-
}
|
77 |
-
|
78 |
-
.exactmetrics-submenu-highlight {
|
79 |
-
background: #
|
80 |
-
}
|
81 |
-
|
82 |
-
.exactmetrics-submenu-highlight a span {
|
83 |
-
color: #fff;
|
84 |
-
font-weight: 600;
|
85 |
-
}
|
1 |
+
.exactmetrics-wooedd-upsell-left {
|
2 |
+
width: 50%;
|
3 |
+
display: table-cell;
|
4 |
+
float: left;
|
5 |
+
}
|
6 |
+
|
7 |
+
.exactmetrics-wooedd-upsell-right {
|
8 |
+
width: 50%;
|
9 |
+
display: table-cell;
|
10 |
+
float: left;
|
11 |
+
}
|
12 |
+
|
13 |
+
.exactmetrics-wooedd-upsell-image {
|
14 |
+
width: 100%;
|
15 |
+
height: auto;
|
16 |
+
padding: 20px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.exactmetrics-wooedd-upsell-image-small {
|
20 |
+
display: none;
|
21 |
+
}
|
22 |
+
|
23 |
+
.exactmetrics-wooedd-upsell-row {
|
24 |
+
display: table;
|
25 |
+
}
|
26 |
+
|
27 |
+
.exactmetrics-wooedd-upsell-left p {
|
28 |
+
margin: 1em 0;
|
29 |
+
font-size: 16px;
|
30 |
+
}
|
31 |
+
|
32 |
+
@media (max-width: 900px) {
|
33 |
+
.exactmetrics-wooedd-upsell-left {
|
34 |
+
width: 100%;
|
35 |
+
}
|
36 |
+
|
37 |
+
.exactmetrics-wooedd-upsell-right {
|
38 |
+
display: none;
|
39 |
+
}
|
40 |
+
|
41 |
+
.exactmetrics-wooedd-upsell-image-small {
|
42 |
+
display: block;
|
43 |
+
}
|
44 |
+
|
45 |
+
.exactmetrics-wooedd-upsell-image-large {
|
46 |
+
display: none;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
#wpadminbar .exactmetrics-menu-notification-indicator,
|
51 |
+
.exactmetrics-menu-notification-indicator {
|
52 |
+
min-width: 8px;
|
53 |
+
height: 18px;
|
54 |
+
border-radius: 9px;
|
55 |
+
background: #ca4a1f;
|
56 |
+
display: inline-block;
|
57 |
+
margin-left: 8px;
|
58 |
+
font-size: 11px;
|
59 |
+
font-weight: 400;
|
60 |
+
color: #fff;
|
61 |
+
text-align: center;
|
62 |
+
line-height: 1.6;
|
63 |
+
padding: 0 5px;
|
64 |
+
}
|
65 |
+
|
66 |
+
#adminmenu .exactmetrics-menu-notification-indicator.update-plugins {
|
67 |
+
margin-left: 8px;
|
68 |
+
}
|
69 |
+
|
70 |
+
@media (max-width: 782px) {
|
71 |
+
#wpadminbar .exactmetrics-menu-notification-indicator {
|
72 |
+
margin: 0 0 10px -13px;
|
73 |
+
z-index: 10;
|
74 |
+
position: relative;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
.exactmetrics-submenu-highlight {
|
79 |
+
background: #1da867;
|
80 |
+
}
|
81 |
+
|
82 |
+
.exactmetrics-submenu-highlight a span {
|
83 |
+
color: #fff;
|
84 |
+
font-weight: 600;
|
85 |
+
}
|
assets/css/admin-common.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.exactmetrics-wooedd-upsell-left{width:50%;display:table-cell;float:left}.exactmetrics-wooedd-upsell-right{width:50%;display:table-cell;float:left}.exactmetrics-wooedd-upsell-image{width:100%;height:auto;padding:20px}.exactmetrics-wooedd-upsell-image-small{display:none}.exactmetrics-wooedd-upsell-row{display:table}.exactmetrics-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width: 900px){.exactmetrics-wooedd-upsell-left{width:100%}.exactmetrics-wooedd-upsell-right{display:none}.exactmetrics-wooedd-upsell-image-small{display:block}.exactmetrics-wooedd-upsell-image-large{display:none}}#wpadminbar .exactmetrics-menu-notification-indicator,.exactmetrics-menu-notification-indicator{min-width:8px;height:18px;border-radius:9px;background:#ca4a1f;display:inline-block;margin-left:8px;font-size:11px;font-weight:400;color:#fff;text-align:center;line-height:1.6;padding:0 5px}#adminmenu .exactmetrics-menu-notification-indicator.update-plugins{margin-left:8px}@media (max-width: 782px){#wpadminbar .exactmetrics-menu-notification-indicator{margin:0 0 10px -13px;z-index:10;position:relative}}.exactmetrics-submenu-highlight{background:#
|
1 |
+
.exactmetrics-wooedd-upsell-left{width:50%;display:table-cell;float:left}.exactmetrics-wooedd-upsell-right{width:50%;display:table-cell;float:left}.exactmetrics-wooedd-upsell-image{width:100%;height:auto;padding:20px}.exactmetrics-wooedd-upsell-image-small{display:none}.exactmetrics-wooedd-upsell-row{display:table}.exactmetrics-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width: 900px){.exactmetrics-wooedd-upsell-left{width:100%}.exactmetrics-wooedd-upsell-right{display:none}.exactmetrics-wooedd-upsell-image-small{display:block}.exactmetrics-wooedd-upsell-image-large{display:none}}#wpadminbar .exactmetrics-menu-notification-indicator,.exactmetrics-menu-notification-indicator{min-width:8px;height:18px;border-radius:9px;background:#ca4a1f;display:inline-block;margin-left:8px;font-size:11px;font-weight:400;color:#fff;text-align:center;line-height:1.6;padding:0 5px}#adminmenu .exactmetrics-menu-notification-indicator.update-plugins{margin-left:8px}@media (max-width: 782px){#wpadminbar .exactmetrics-menu-notification-indicator{margin:0 0 10px -13px;z-index:10;position:relative}}.exactmetrics-submenu-highlight{background:#1da867}.exactmetrics-submenu-highlight a span{color:#fff;font-weight:600}
|
assets/css/images/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/css/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/fonts/README.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
# Updating Icons
|
2 |
-
|
3 |
-
The main font used by MonsterInsights for icons has the font-family: 'Misettings'.
|
4 |
-
|
5 |
-
The files used by this font are
|
6 |
-
|
7 |
-
- assets/fonts/icons.eot
|
8 |
-
- assets/fonts/icons.otf
|
9 |
-
- assets/fonts/icons.ttf
|
10 |
-
- assets/fonts/icons.woff
|
11 |
-
- assets/fonts/icons.woff2
|
12 |
-
|
13 |
-
The font files are generated using [FortAwesome](https://fortawesome.com).
|
14 |
-
|
15 |
-
After generating new files, you'll need to update the files mentioned above & the css
|
16 |
-
used for the icons which can be found in assets/css/admin.css starting on line 135, look
|
17 |
-
for the class `.monstericon-`.
|
1 |
+
# Updating Icons
|
2 |
+
|
3 |
+
The main font used by MonsterInsights for icons has the font-family: 'Misettings'.
|
4 |
+
|
5 |
+
The files used by this font are
|
6 |
+
|
7 |
+
- assets/fonts/icons.eot
|
8 |
+
- assets/fonts/icons.otf
|
9 |
+
- assets/fonts/icons.ttf
|
10 |
+
- assets/fonts/icons.woff
|
11 |
+
- assets/fonts/icons.woff2
|
12 |
+
|
13 |
+
The font files are generated using [FortAwesome](https://fortawesome.com).
|
14 |
+
|
15 |
+
After generating new files, you'll need to update the files mentioned above & the css
|
16 |
+
used for the icons which can be found in assets/css/admin.css starting on line 135, look
|
17 |
+
for the class `.monstericon-`.
|
assets/fonts/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/gutenberg/css/editor.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");.exactmetrics-inline-buttons{display:-ms-grid;display:grid;-ms-grid-columns:(1fr)[2];grid-template-columns:repeat(2, 1fr)}.exactmetrics-switcher-button{border:0;border-radius:0;font-size:13px;font-weight:normal;color:#393F4C;padding:17px 15px;border-bottom:3px solid transparent;cursor:pointer;text-align:left;white-space:nowrap}.exactmetrics-switcher-button.active,.exactmetrics-switcher-button:hover,.exactmetrics-switcher-button:active,.exactmetrics-switcher-button:focus{outline:none;border-bottom:3px solid #117DB8}.exactmetrics-switcher-button.active{font-weight:bold}.exactmetrics-headline-analyzer-wrapper{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;position:relative}.exactmetrics-headline-analyzer-wrapper p{font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .green{color:#1EC185}.exactmetrics-headline-analyzer-wrapper .orange{color:#F2994A}.exactmetrics-headline-analyzer-wrapper .red{color:#EB5757}.exactmetrics-headline-analyzer-wrapper .green-bg{background:#1EC185}.exactmetrics-headline-analyzer-wrapper .orange-bg{background:#F2994A}.exactmetrics-headline-analyzer-wrapper .red-bg{background:#EB5757}.exactmetrics-headline-analyzer-wrapper .components-panel__body-toggle.components-button{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;font-weight:bold;font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-empty-title-warning{text-align:center;padding:0 20px;margin:20px 0;font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab p{text-align:center}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-current-title{text-align:center;font-size:16px;color:#393F4C;margin:0 0 28px 0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-current-score{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-current-score p{margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel h4{text-align:center;font-size:16px;color:#393F4C;margin:0 0 28px 0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-new-score{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-new-score p{margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .current-score{text-align:center}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .current-score h5{font-weight:bold;color:#393F4C;margin-top:0;margin-bottom:8px;text-align:center;font-size:13px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .current-score p{margin-top:8px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-tab{margin-bottom:6px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-input-field{margin-bottom:6px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-input-field .components-base-control__label{display:block;max-width:100%;font-size:12px;margin-bottom:8px;color:#626D83}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-input-field input{padding:11px 12px;font-size:13px;border:1px solid #E2E4E7;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-button{padding-right:11px;font-size:13px;border-radius:3px;padding-left:11px;height:29px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-score-difference{font-size:20px;font-weight:bold;display:block;text-align:center;margin-top:0;margin-bottom:40px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-previous-scores li{font-size:13px;line-height:24px;color:#393F4C;margin-bottom:20px;padding-left:36px;position:relative;cursor:pointer}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-previous-scores li:last-child{margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-previous-scores .exactmetrics-headline-analyzer-score{margin-left:-36px;position:absolute;top:0}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon .components-panel__body-toggle .components-panel__icon{position:absolute;right:40px;top:50%;margin-top:-8px}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon.red .components-panel__body-toggle .components-panel__icon path{fill:#EB5757}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon.orange .components-panel__body-toggle .components-panel__icon path{fill:#F2994A}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon.green .components-panel__body-toggle .components-panel__icon path{fill:#1EC185}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon-alternative{position:relative}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon-alternative .exactmetrics-headline-analyzer-panel-icon-alternative{position:absolute;top:14px;right:40px;font-weight:bold}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-balance .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-sentiment .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-types .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-character-count .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-count .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-beginning-ending-words .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row{display:block}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-balance .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-sentiment .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-types .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-character-count .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-count .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-beginning-ending-words .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row h4{font-size:16px;color:#393F4C;font-weight:bold;margin:0 0 8px 0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block{margin-top:28px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block h5{font-size:13px;color:#393F4C;margin-top:0;margin-bottom:12px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data{overflow:hidden}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span{display:block;float:left}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-percentage{width:30%;font-size:24px;font-weight:bold;line-height:20px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-goal{width:40%;font-size:12px;color:#9CA4B5}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-progressbar{width:30%;position:relative;height:8px;margin-top:4px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-progressbar .exactmetrics-headline-analyzer-progressbar-bg{width:100%;background:#EEF0F2;height:8px;z-index:9;position:absolute;top:0;left:0;border-radius:30px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-progressbar .exactmetrics-headline-analyzer-progressbar-part{position:absolute;height:8px;top:0;left:0;z-index:10;border-radius:30px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-tag-list{margin:0;padding:0;list-style:none;display:block;margin-top:12px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-tag-list li{display:inline-block;font-size:12px;color:#393F4C;background:#D6D9E0;border-radius:4px;font-family:'Roboto', sans-serif;padding:2px 9px;margin-right:8px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-guideline{margin-top:8px;color:#4F4F4F}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count p{text-align:left}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px;margin-left:-40px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-character-length{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-status-on-character-length{position:absolute;left:144px;top:50%;font-size:16px;color:#393F4C;margin:-9px 0 0 0;font-weight:bold;width:130px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count p{text-align:left}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px;margin-left:-40px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-word-length{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-status-on-word-length{position:absolute;left:144px;top:50%;font-size:16px;color:#393F4C;margin:-9px 0 0 0;font-weight:bold;width:130px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-beginning-ending-words .exactmetrics-headline-analyzer-words{display:block;margin-bottom:12px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-beginning-ending-words .exactmetrics-headline-analyzer-words span{font-size:14px;color:#fff;background:#7F899F;border-radius:6px;font-family:'Roboto', sans-serif;padding:6px 12px;display:inline-block}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-beginning-ending-words .exactmetrics-headline-analyzer-words-guideline{margin-top:20px;margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row h4{color:#4285F4;font-size:16px;margin:0;text-transform:none;margin-bottom:8px;margin-top:10px;font-family:Arial, Helvetica, sans-serif;font-weight:normal}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row .exactmetrics-headline-analyzer-post-url{margin-bottom:8px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row .exactmetrics-headline-analyzer-post-url a{color:#34A853;font-size:14px;font-family:Arial, Helvetica, sans-serif}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row .exactmetrics-headline-analyzer-post-url a:hover{opacity:0.8}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row p{font-family:Arial, Helvetica, sans-serif}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-types .exactmetrics-headline-analyzer-panel-types-title{display:block;width:100%;font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-types .exactmetrics-headline-analyzer-panel-types-title span{float:right;margin-right:25px;color:#393F4C;font-size:13px}.edit-post-header__settings button.components-button[exactmetrics-button-color]{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif}.edit-post-header__settings button.components-button[exactmetrics-button-color] svg{margin-right:8px}.edit-post-header__settings button.components-button[exactmetrics-button-color] span{font-size:14px;color:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']{background:#FAD1D1;border:1px solid #EB5757}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed{background:#EB5757 !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed svg path{fill:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'] svg path{fill:#EB5757}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'] span{color:#E73232}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']{background:#F8C9A0;border:1px solid #F2994A}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed{background:#F2994A !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed svg path{fill:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'] svg path{fill:#F08629}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'] span{color:#D66D0F}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']{background:#D3F8EA;border:1px solid #1EC185}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed{background:#1EC185 !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed svg path{fill:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'] svg path{fill:#1EC185}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'] span{color:#1BB17A}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed{box-shadow:none !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed svg path{fill:#fff !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed span{color:#fff}.edit-post-sidebar{scroll-behavior:smooth}.exactmetrics-headline-analyzer-score{color:#fff;font-size:11px;font-family:'Roboto', sans-serif;font-weight:bold;border-radius:50%;margin:0 auto;width:24px;height:24px;min-height:24px;display:inline-block;line-height:12px;padding-top:7px;text-align:center}.exactmetrics-headline-analyzer-bottom-notice{padding:15px 20px 0 15px;border-top:1px solid #e2e4e7}.exactmetrics-headline-analyzer-bottom-notice p{text-align:left}.exactmetrics-donut-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.exactmetrics-donut{height:auto;border-radius:50%;position:relative;overflow:hidden;-ms-flex-negative:0;flex-shrink:0}.exactmetrics-donut-overlay{opacity:1;position:absolute;border-radius:50%;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;overflow:hidden}.exactmetrics-donut-sections{position:absolute;height:auto;width:100%;padding-bottom:100%;border-radius:50%}.exactmetrics-donut-section{position:absolute;height:100%;width:50%;overflow:hidden;background-color:transparent;transform-origin:0% 50%;pointer-events:none}.exactmetrics-donut-filler{position:absolute;height:100%;width:100%;pointer-events:all}.exactmetrics-donut-section.exactmetrics-donut-section-right{left:50%}.exactmetrics-donut-section.exactmetrics-donut-section-right .exactmetrics-donut-filler{transform-origin:0% 50%}.exactmetrics-donut-section.exactmetrics-donut-section-left{left:0%;transform-origin:100% 50%}.exactmetrics-donut-section.exactmetrics-donut-section-left .exactmetrics-donut-filler{transform-origin:100% 50%}.exactmetrics-theme-picker-carousel{overflow:hidden}.exactmetrics-theme-picker-carousel .carousel__slide-focus-ring{display:none}.exactmetrics-theme-picker-slide{float:left;display:block;outline:none}.exactmetrics-theme-picker-slide .carousel__inner-slide{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-flow:wrap;flex-flow:wrap}.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-input{display:none}.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-option{width:calc(50% - 8px)}.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-option:nth-child(1),.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-option:nth-child(2){margin-bottom:28px}.exactmetrics-theme-picker-slide label{border:1px solid #B7C9D9;box-sizing:border-box;border-radius:5px;width:100%;height:124px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;position:relative;max-width:100%}.exactmetrics-theme-picker-slide label .exactmetrics-theme-picker-label-icon{display:block}.exactmetrics-theme-picker-slide label .exactmetrics-theme-picker-label-text{position:absolute;left:0;right:0;display:block;bottom:0;padding-bottom:12px;text-align:center;font-family:Helvetica Neue, serif;font-style:normal;font-weight:normal;font-size:14px;line-height:1;color:#393F4C}.exactmetrics-theme-picker-slide label.exactmetrics-theme-picker-label-selected{border:3px solid #6528f5}.exactmetrics-theme-picker-slide label.exactmetrics-theme-picker-label-disabled{opacity:0.6;pointer-events:none}.exactmetrics-theme-picker-slide label.exactmetrics-theme-picker-label-echo .exactmetrics-theme-picker-label-icon{margin-bottom:10px}.exactmetrics-theme-picker-slide .exactmetrics-theme-picker-check{position:absolute;right:10px;top:10px}.exactmetrics-carousel-navigation{clear:both;text-align:center;padding-top:12px}.exactmetrics-carousel-navigation button{background:none;padding:0;border:0;vertical-align:middle;cursor:pointer;height:12px}.exactmetrics-carousel-navigation button:hover svg path,.exactmetrics-carousel-navigation button:focus svg path{fill:#727272}.exactmetrics-carousel-navigation .carousel__back-button{margin-right:8px}.exactmetrics-carousel-navigation .carousel__dot-group{display:inline-block;vertical-align:middle}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot{border:3px solid #c4c4c4;box-sizing:border-box;width:12px;height:12px;margin-right:8px;border-radius:50%;vertical-align:middle}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot:hover,.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot:focus{border-color:#727272}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot.carousel__dot--selected{background:#c4c4c4}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot.carousel__dot--selected:hover,.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot.carousel__dot--selected:focus{background:#727272}.exactmetrics-inline-popular-posts-image{width:128px;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;margin-right:16px}.exactmetrics-inline-popular-posts-widget{margin-bottom:24px}.exactmetrics-inline-popular-posts-widget .exactmetrics-inline-popular-posts-title{box-shadow:none}.exactmetrics-inline-popular-posts-alpha{padding:24px 27px}.exactmetrics-inline-popular-posts-alpha .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1;display:block;margin-bottom:6px}.exactmetrics-inline-popular-posts-alpha .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:1;text-decoration:none}.exactmetrics-inline-popular-posts-beta{padding:14px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border:1px solid #D6E2ED}.exactmetrics-inline-popular-posts-beta .exactmetrics-inline-popular-posts-text{margin-left:19px}.exactmetrics-inline-popular-posts-beta .exactmetrics-inline-popular-posts-label{display:block;font-weight:bold;font-size:18px;line-height:18px}.exactmetrics-inline-popular-posts-beta .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:130%;text-decoration:none}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-border{display:block;border-bottom:1px solid;margin:16px 0}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:16px;line-height:1.1}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-list{list-style:disc inside none}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-list li{font-style:normal;font-weight:normal;font-size:16px;line-height:130%}.exactmetrics-inline-popular-posts-delta{border:1px solid #D6E2ED;padding:16px 18px;border-radius:5px}.exactmetrics-inline-popular-posts-delta .exactmetrics-inline-popular-posts-icon{margin-right:8px}.exactmetrics-inline-popular-posts-delta .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1.1;vertical-align:top}.exactmetrics-inline-popular-posts-delta .exactmetrics-inline-popular-posts-title{display:block;font-weight:bold;font-size:18px;line-height:1;text-decoration:none;margin-top:4px}.exactmetrics-inline-popular-posts-echo{padding:13px 16px}.exactmetrics-inline-popular-posts-echo .exactmetrics-inline-popular-posts-icon{margin-right:8px}.exactmetrics-inline-popular-posts-echo .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:16px;line-height:1.1;margin-right:8px}.exactmetrics-inline-popular-posts-echo .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:16px;line-height:130%;text-decoration:none}.exactmetrics-inline-popular-posts-foxtrot{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.exactmetrics-inline-popular-posts-foxtrot .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1.1;display:block}.exactmetrics-inline-popular-posts-foxtrot .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:125%;text-decoration:none}.exactmetrics-inline-popular-posts-golf{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:16px;line-height:1.1;float:left;background:#fff;padding-right:20px}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:16px;line-height:125%;text-decoration:none;display:block;clear:both;margin-top:14px}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-title:before{width:100%}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-border{display:block;border-width:2px 0 0 0;border-style:solid;margin-top:10px}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-border-2{border-top:1px solid #E2E4E9;margin-top:20px;display:block}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-text{width:100%}.exactmetrics-inline-popular-posts-hotel .exactmetrics-inline-popular-posts-icon{margin-right:10px;vertical-align:middle}.exactmetrics-inline-popular-posts-hotel .exactmetrics-inline-popular-posts-title{font-style:normal;font-weight:bold;font-size:18px;text-decoration:none;line-height:130%}.exactmetrics-inline-popular-posts-india{padding:13px 12px 13px 16px;position:relative}.exactmetrics-inline-popular-posts-india .exactmetrics-inline-popular-posts-border{border-width:0 0 0 4px;border-style:solid;position:absolute;left:0;top:0;bottom:0}.exactmetrics-inline-popular-posts-india .exactmetrics-inline-popular-posts-title{font-size:14px;text-decoration:none;font-weight:bold}.exactmetrics-inline-popular-posts-india .exactmetrics-inline-popular-posts-label{font-size:14px;text-decoration:none;font-weight:bold;margin-right:4px}.exactmetrics-inline-popular-posts-juliett{position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:100%}.exactmetrics-inline-popular-posts-juliett .exactmetrics-inline-popular-posts-border{border-width:1px 0 0 0;border-style:solid;position:absolute;left:0;top:0;right:0}.exactmetrics-inline-popular-posts-juliett .exactmetrics-inline-popular-posts-title{font-size:18px;text-decoration:none;font-weight:bold;max-width:400px;-ms-flex-positive:0;flex-grow:0;display:block;line-height:125%}.exactmetrics-inline-popular-posts-juliett .exactmetrics-inline-popular-posts-label{font-size:14px;line-height:18px;text-decoration:none;font-weight:bold;padding:4px 12px;position:absolute;right:0;top:0}.exactmetrics-inline-popular-posts-kilo{position:relative;padding:30px 0}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:130%;text-decoration:none;display:block;clear:both;margin-top:6px}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-title:before{width:100%}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-border-2,.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-border{display:block;position:absolute;left:0;right:0;top:0;border-bottom:4px dashed #E2E4E9}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-border-2{bottom:0;top:auto}.exactmetrics-inline-popular-posts-lima{padding:16px 19px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-text{margin-left:13px;-ms-flex-order:1;order:1}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-label{display:block;font-weight:bold;font-size:18px;line-height:18px}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:120%;text-decoration:none;display:block;max-width:420px;margin-top:7px}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-image{width:144px;-ms-flex-order:2;order:2;margin-right:0;margin-left:20px}.exactmetrics-inline-popular-posts-mike{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center}.exactmetrics-inline-popular-posts-mike .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:125%;text-decoration:none;display:block;max-width:380px}.exactmetrics-inline-popular-posts-mike .exactmetrics-inline-popular-posts-label{position:absolute;z-index:10;left:0;top:0;font-size:14px;font-weight:bold;padding:5px 8px;line-height:1.2}.exactmetrics-inline-popular-posts-mike .exactmetrics-inline-popular-posts-image{margin-right:20px}.exactmetrics-inline-popular-posts-november{display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;border-radius:5px;border-width:1px;border-style:solid;padding:16px}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-text{width:100%}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:16px;line-height:125%;text-decoration:none;display:block;margin-top:4px}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-label{display:block;font-size:16px;font-weight:bold}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-image{margin-right:20px}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-icon{width:32px;height:32px;display:inline-block;border-radius:50%;text-align:center;float:left;line-height:38px;margin-right:17px;margin-top:4px}.exactmetrics-widget-popular-posts-widget{margin-bottom:24px}.exactmetrics-widget-popular-posts-widget .exactmetrics-widget-popular-posts-list{padding:0}.exactmetrics-widget-popular-posts-widget .exactmetrics-widget-popular-posts-title{box-shadow:none}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-alpha .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-alpha .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:24px;background:#F0F2F4;border-radius:3px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-beta .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-beta .exactmetrics-widget-popular-posts-list li{display:inline-block;background:#fff;border-radius:3px;margin:0 6px 30px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700;border-left:4px solid #1EC185;padding-left:16px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-charlie .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-charlie .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:24px;background:#F0F2F4;border-radius:3px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700;border-top:4px solid #338EEF}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-image{width:121px;height:121px;padding:0;float:left;margin-right:16px;margin-bottom:12px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:16px 0 0;margin:0 6px 0 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700;border-top:2px solid #D3D7DE}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-image{margin-bottom:14px;width:100%}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list li{display:inline-block;margin:0 6px 24px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-comments{font-size:16px;font-weight:700;margin-top:14px;display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:16px;background:#F0F2F4;border-radius:5px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-comments{font-size:16px;font-weight:700;margin-top:14px;display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:16px;background:#F0F2F4;border-radius:5px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-comments{font-size:16px;font-weight:700;margin-top:14px;display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-label{font-weight:400;font-size:12px;display:inline-block;padding:4px 8px;border-radius:3px;line-height:1;margin-bottom:14px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-title{display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list li{display:inline-block;margin:0 6px 24px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;font-weight:700;position:relative}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-text{position:absolute;bottom:0;padding:0 14px 14px;left:0;z-index:15}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-bg-img{margin-bottom:0;padding-top:50%;width:100%}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-bg-img:after{z-index:5;border-radius:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-bg-img:before{background:linear-gradient(0deg, #000 -25.16%, rgba(0,0,0,0.1) 100%);content:'';top:0;bottom:0;left:0;right:0;position:absolute;z-index:10;border-radius:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-image{position:relative}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-image img{width:100%}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-image:before{background:linear-gradient(0deg, #000 -25.16%, rgba(0,0,0,0.1));content:"";top:0;bottom:0;left:0;right:0;position:absolute;z-index:10;border-radius:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-1 .exactmetrics-widget-popular-posts-list{margin:0}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-1 .exactmetrics-widget-popular-posts-list li{width:100%;margin-left:0;margin-right:0}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-3 .exactmetrics-widget-popular-posts-list{margin:0}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-3 .exactmetrics-widget-popular-posts-list li{width:calc(33.333333% - 12px)}.exactmetrics-wide-column-options input[type="radio"]{display:none}.exactmetrics-wide-column-options .components-radio-control__option{display:inline-block}.exactmetrics-wide-column-options .components-base-control__label{display:block}.exactmetrics-wide-column-options .exactmetrics-wide-column{display:-ms-flexbox;display:flex;border:1px solid #B7C9D9;border-radius:5px;width:40px;height:40px;padding:10px 5px;-ms-flex-flow:wrap;flex-flow:wrap;-ms-flex-pack:justify;justify-content:space-between}.exactmetrics-wide-column-options .exactmetrics-wide-column>span{background:#99A1B2;display:inline-block;width:8px;height:8px;border-radius:1px;margin-bottom:2px}.exactmetrics-wide-column-options .exactmetrics-wide-column.exactmetrics-wide-column-two>span{width:12px}.exactmetrics-wide-column-options .exactmetrics-wide-column.exactmetrics-wide-column-one>span{width:100%}.exactmetrics-wide-column-options input[type="radio"]:checked+label .exactmetrics-wide-column{border:2px solid #6528f5;background:#ECF4FE;padding:9px 4px}.exactmetrics-wide-column-options input[type="radio"]:checked+label .exactmetrics-wide-column>span{background:#6528f5}.block-editor-block-inspector .exactmetrics-hierarchical-terms .components-base-control{margin-bottom:0}.block-editor-block-inspector .exactmetrics-hierarchical-terms-disabled{opacity:0.6;pointer-events:none}.exactmetrics-popular-posts-products-theme-picker .exactmetrics-theme-picker-slide label{height:142px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-image{width:80px;height:80px;padding:0;float:left;margin-right:18px}.exactmetrics-products-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-products-popular-posts-image{margin-bottom:14px;width:100%}.exactmetrics-input-text-small{margin-top:24px}.exactmetrics-input-text-small .settings-input-text-input{max-width:350px}.exactmetrics-input-text-extra-small .settings-input-text{display:inline-block;margin-right:5px}.exactmetrics-input-text-extra-small .settings-input-text-input{max-width:80px}.exactmetrics-products-popular-posts-widget{margin-bottom:24px}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-title{box-shadow:none}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-list{padding:0}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-rating{display:block}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-rating svg{margin-right:2px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-list{margin:0 -12px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-list li{display:inline-block;margin:0 12px;width:calc(50% - 24px);vertical-align:top;font-size:16px;border-top:1px solid #D3D7DE;padding-top:15px;padding-bottom:30px;font-weight:bold;line-height:1.1}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-price{display:block;margin:10px 0 7px;font-weight:400}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-list,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list{margin:0 -6px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-list li,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list li{display:inline-block;width:calc(50% - 12px);vertical-align:top;font-size:16px;padding:10px 12px;font-weight:bold;line-height:1.1;margin:0 6px 24px;border-radius:3px;position:relative}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-price,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-price{display:block;font-weight:400;position:absolute;right:12px;bottom:10px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-title,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-title{margin-top:12px;display:block}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-rating,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-rating{margin-top:13px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-list{margin:0 -6px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-list li{display:inline-block;width:calc(50% - 12px);vertical-align:top;font-size:16px;padding:0;font-weight:bold;line-height:1.1;margin:0 6px 24px;border-radius:5px;position:relative}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-price{display:block;font-weight:400;-ms-flex-order:3;order:3;margin-top:4px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-title{-ms-flex-order:2;order:2;margin-top:4px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-text{position:absolute;bottom:0;z-index:10;left:0;right:0;padding:16px;display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-rating{margin-top:13px;-ms-flex-order:1;order:1}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-image{position:relative}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-image:before{background:linear-gradient(0deg, #000 -25.16%, rgba(0,0,0,0.1) 100%);content:'';top:0;bottom:0;left:0;right:0;position:absolute;z-index:10;border-radius:5px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-price{position:relative;margin-top:8px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list{margin:0 -6px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list li{padding:0}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-price{right:auto;bottom:auto;-ms-flex-order:3;order:3}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-rating{margin-top:8px;-ms-flex-order:1;order:1}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-title{-ms-flex-order:2;order:2}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-text{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-columns-1 .exactmetrics-products-popular-posts-list{margin:0}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-columns-1 .exactmetrics-products-popular-posts-list li{width:100%;margin-left:0;margin-right:0}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-columns-3 .exactmetrics-products-popular-posts-list li{width:calc(33.333333% - 24px)}.exactmetrics-post-picker .components-form-token-field__help{display:none}.exactmetrics-popular-posts-pro-pill{font-style:normal;font-weight:bold;font-size:11px;background:#1EC185;border-radius:5px;color:#fff;padding:3px 8px;margin-left:8px}.exactmetrics-popular-posts-no-woocoomerce{padding:44px 34px;text-align:center}.exactmetrics-popular-posts-no-woocoomerce h3{font-size:22px;line-height:1.4}.exactmetrics-popular-posts-no-woocoomerce p,.exactmetrics-popular-posts-no-woocoomerce a{font-size:16px;font-style:normal;font-weight:400;line-height:22px;color:#626D83}.exactmetrics-popular-posts-no-woocoomerce a{color:#1170D5;margin-top:24px}
|
1 |
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");.exactmetrics-inline-buttons{display:grid;grid-template-columns:repeat(2, 1fr)}.exactmetrics-switcher-button{border:0;border-radius:0;font-size:13px;font-weight:normal;color:#393F4C;padding:17px 15px;border-bottom:3px solid transparent;cursor:pointer;text-align:left;white-space:nowrap}.exactmetrics-switcher-button.active,.exactmetrics-switcher-button:hover,.exactmetrics-switcher-button:active,.exactmetrics-switcher-button:focus{outline:none;border-bottom:3px solid #117DB8}.exactmetrics-switcher-button.active{font-weight:bold}.exactmetrics-headline-analyzer-wrapper{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;position:relative}.exactmetrics-headline-analyzer-wrapper p{font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .green{color:#1EC185}.exactmetrics-headline-analyzer-wrapper .orange{color:#F2994A}.exactmetrics-headline-analyzer-wrapper .red{color:#EB5757}.exactmetrics-headline-analyzer-wrapper .green-bg{background:#1EC185}.exactmetrics-headline-analyzer-wrapper .orange-bg{background:#F2994A}.exactmetrics-headline-analyzer-wrapper .red-bg{background:#EB5757}.exactmetrics-headline-analyzer-wrapper .components-panel__body-toggle.components-button{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;font-weight:bold;font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-empty-title-warning{text-align:center;padding:0 20px;margin:20px 0;font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab p{text-align:center}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-current-title{text-align:center;font-size:16px;color:#393F4C;margin:0 0 28px 0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-current-score{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-current-score-tab .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-current-score p{margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel h4{text-align:center;font-size:16px;color:#393F4C;margin:0 0 28px 0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-new-score{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-new-score p{margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .current-score{text-align:center}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .current-score h5{font-weight:bold;color:#393F4C;margin-top:0;margin-bottom:8px;text-align:center;font-size:13px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-score-panel .current-score p{margin-top:8px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-new-tab{margin-bottom:6px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-input-field{margin-bottom:6px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-input-field .components-base-control__label{display:block;max-width:100%;font-size:12px;margin-bottom:8px;color:#626D83}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-input-field input{padding:11px 12px;font-size:13px;border:1px solid #E2E4E7;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-button{padding-right:11px;font-size:13px;border-radius:3px;padding-left:11px;height:29px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-score-difference{font-size:20px;font-weight:bold;display:block;text-align:center;margin-top:0;margin-bottom:40px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-previous-scores li{font-size:13px;line-height:24px;color:#393F4C;margin-bottom:20px;padding-left:36px;position:relative;cursor:pointer}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-previous-scores li:last-child{margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-previous-scores .exactmetrics-headline-analyzer-score{margin-left:-36px;position:absolute;top:0}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon .components-panel__body-toggle .components-panel__icon{position:absolute;right:40px;top:50%;margin-top:-8px}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon.red .components-panel__body-toggle .components-panel__icon path{fill:#EB5757}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon.orange .components-panel__body-toggle .components-panel__icon path{fill:#F2994A}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon.green .components-panel__body-toggle .components-panel__icon path{fill:#1EC185}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon-alternative{position:relative}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-has-icon-alternative .exactmetrics-headline-analyzer-panel-icon-alternative{position:absolute;top:14px;right:40px;font-weight:bold}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-balance .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-sentiment .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-types .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-character-count .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-count .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-beginning-ending-words .components-panel__row,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row{display:block}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-balance .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-sentiment .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-types .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-character-count .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-word-count .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-beginning-ending-words .components-panel__row h4,.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row h4{font-size:16px;color:#393F4C;font-weight:bold;margin:0 0 8px 0}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block{margin-top:28px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block h5{font-size:13px;color:#393F4C;margin-top:0;margin-bottom:12px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data{overflow:hidden}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span{display:block;float:left}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-percentage{width:30%;font-size:24px;font-weight:bold;line-height:20px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-goal{width:40%;font-size:12px;color:#9CA4B5}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-progressbar{width:30%;position:relative;height:8px;margin-top:4px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-progressbar .exactmetrics-headline-analyzer-progressbar-bg{width:100%;background:#EEF0F2;height:8px;z-index:9;position:absolute;top:0;left:0;border-radius:30px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-block-data span.exactmetrics-headline-analyzer-words-block-progressbar .exactmetrics-headline-analyzer-progressbar-part{position:absolute;height:8px;top:0;left:0;z-index:10;border-radius:30px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-tag-list{margin:0;padding:0;list-style:none;display:block;margin-top:12px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-tag-list li{display:inline-block;font-size:12px;color:#393F4C;background:#D6D9E0;border-radius:4px;font-family:'Roboto', sans-serif;padding:2px 9px;margin-right:8px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-words-block .exactmetrics-headline-analyzer-words-guideline{margin-top:8px;color:#4F4F4F}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count p{text-align:left}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px;margin-left:-40px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-character-length{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-character-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-status-on-character-length{position:absolute;left:144px;top:50%;font-size:16px;color:#393F4C;margin:-9px 0 0 0;font-weight:bold;width:130px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count p{text-align:left}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count .exactmetrics-headline-analyzer-pie-chart-container{position:relative;width:160px;height:80px;margin:0 auto;margin-bottom:18px;margin-left:-40px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-word-length{position:absolute;top:50%;left:0;right:0;text-align:center;font-size:30px;font-family:'Roboto', sans-serif;line-height:0%;z-index:10}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-word-count .exactmetrics-headline-analyzer-pie-chart-container .exactmetrics-headline-analyzer-status-on-word-length{position:absolute;left:144px;top:50%;font-size:16px;color:#393F4C;margin:-9px 0 0 0;font-weight:bold;width:130px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-beginning-ending-words .exactmetrics-headline-analyzer-words{display:block;margin-bottom:12px}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-beginning-ending-words .exactmetrics-headline-analyzer-words span{font-size:14px;color:#fff;background:#7F899F;border-radius:6px;font-family:'Roboto', sans-serif;padding:6px 12px;display:inline-block}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-beginning-ending-words .exactmetrics-headline-analyzer-words-guideline{margin-top:20px;margin-bottom:0}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row h4{color:#4285F4;font-size:16px;margin:0;text-transform:none;margin-bottom:8px;margin-top:10px;font-family:Arial, Helvetica, sans-serif;font-weight:normal}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row .exactmetrics-headline-analyzer-post-url{margin-bottom:8px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row .exactmetrics-headline-analyzer-post-url a{color:#34A853;font-size:14px;font-family:Arial, Helvetica, sans-serif}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row .exactmetrics-headline-analyzer-post-url a:hover{opacity:0.8}.exactmetrics-headline-analyzer-wrapper .components-panel__body.exactmetrics-headline-analyzer-panel-search-preview .components-panel__row p{font-family:Arial, Helvetica, sans-serif}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-types .exactmetrics-headline-analyzer-panel-types-title{display:block;width:100%;font-size:13px;color:#393F4C}.exactmetrics-headline-analyzer-wrapper .exactmetrics-headline-analyzer-panel-types .exactmetrics-headline-analyzer-panel-types-title span{float:right;margin-right:25px;color:#393F4C;font-size:13px}.edit-post-header__settings button.components-button[exactmetrics-button-color]{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif}.edit-post-header__settings button.components-button[exactmetrics-button-color] svg{margin-right:8px}.edit-post-header__settings button.components-button[exactmetrics-button-color] span{font-size:14px;color:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']{background:#FAD1D1;border:1px solid #EB5757}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed{background:#EB5757 !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed svg path{fill:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'] svg path{fill:#EB5757}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'] span{color:#E73232}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']{background:#F8C9A0;border:1px solid #F2994A}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed{background:#F2994A !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed svg path{fill:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'] svg path{fill:#F08629}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'] span{color:#D66D0F}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']{background:#D3F8EA;border:1px solid #1EC185}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed{background:#1EC185 !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed svg path{fill:#fff}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'] svg path{fill:#1EC185}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'] span{color:#1BB17A}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed{box-shadow:none !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus svg path,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed svg path{fill:#fff !important}.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:hover span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:active span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red']:focus span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='red'].is-pressed span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:hover span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:active span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green']:focus span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='green'].is-pressed span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:hover span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:active span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange']:focus span,.edit-post-header__settings button.components-button[exactmetrics-button-color][exactmetrics-button-color='orange'].is-pressed span{color:#fff}.edit-post-sidebar{scroll-behavior:smooth}.exactmetrics-headline-analyzer-score{color:#fff;font-size:11px;font-family:'Roboto', sans-serif;font-weight:bold;border-radius:50%;margin:0 auto;width:24px;height:24px;min-height:24px;display:inline-block;line-height:12px;padding-top:7px;text-align:center}.exactmetrics-headline-analyzer-bottom-notice{padding:15px 20px 0 15px;border-top:1px solid #e2e4e7}.exactmetrics-headline-analyzer-bottom-notice p{text-align:left}.exactmetrics-donut-container{display:flex;align-items:center;justify-content:center}.exactmetrics-donut{height:auto;border-radius:50%;position:relative;overflow:hidden;flex-shrink:0}.exactmetrics-donut-overlay{opacity:1;position:absolute;border-radius:50%;display:flex;align-items:center;justify-content:center;overflow:hidden}.exactmetrics-donut-sections{position:absolute;height:auto;width:100%;padding-bottom:100%;border-radius:50%}.exactmetrics-donut-section{position:absolute;height:100%;width:50%;overflow:hidden;background-color:transparent;transform-origin:0% 50%;pointer-events:none}.exactmetrics-donut-filler{position:absolute;height:100%;width:100%;pointer-events:all}.exactmetrics-donut-section.exactmetrics-donut-section-right{left:50%}.exactmetrics-donut-section.exactmetrics-donut-section-right .exactmetrics-donut-filler{transform-origin:0% 50%}.exactmetrics-donut-section.exactmetrics-donut-section-left{left:0%;transform-origin:100% 50%}.exactmetrics-donut-section.exactmetrics-donut-section-left .exactmetrics-donut-filler{transform-origin:100% 50%}.exactmetrics-theme-picker-carousel{overflow:hidden}.exactmetrics-theme-picker-carousel .carousel__slide-focus-ring{display:none}.exactmetrics-theme-picker-slide{float:left;display:block;outline:none}.exactmetrics-theme-picker-slide .carousel__inner-slide{display:flex;justify-content:space-between;flex-flow:wrap}.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-input{display:none}.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-option{width:calc(50% - 8px)}.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-option:nth-child(1),.exactmetrics-theme-picker-slide .exactmetrics-slider-theme-option:nth-child(2){margin-bottom:28px}.exactmetrics-theme-picker-slide label{border:1px solid #B7C9D9;box-sizing:border-box;border-radius:5px;width:100%;height:124px;display:flex;align-items:center;justify-content:center;position:relative;max-width:100%}.exactmetrics-theme-picker-slide label .exactmetrics-theme-picker-label-icon{display:block}.exactmetrics-theme-picker-slide label .exactmetrics-theme-picker-label-text{position:absolute;left:0;right:0;display:block;bottom:0;padding-bottom:12px;text-align:center;font-family:Helvetica Neue, serif;font-style:normal;font-weight:normal;font-size:14px;line-height:1;color:#393F4C}.exactmetrics-theme-picker-slide label.exactmetrics-theme-picker-label-selected{border:3px solid #6528f5}.exactmetrics-theme-picker-slide label.exactmetrics-theme-picker-label-disabled{opacity:0.6;pointer-events:none}.exactmetrics-theme-picker-slide label.exactmetrics-theme-picker-label-echo .exactmetrics-theme-picker-label-icon{margin-bottom:10px}.exactmetrics-theme-picker-slide .exactmetrics-theme-picker-check{position:absolute;right:10px;top:10px}.exactmetrics-carousel-navigation{clear:both;text-align:center;padding-top:12px}.exactmetrics-carousel-navigation button{background:none;padding:0;border:0;vertical-align:middle;cursor:pointer;height:12px}.exactmetrics-carousel-navigation button:hover svg path,.exactmetrics-carousel-navigation button:focus svg path{fill:#727272}.exactmetrics-carousel-navigation .carousel__back-button{margin-right:8px}.exactmetrics-carousel-navigation .carousel__dot-group{display:inline-block;vertical-align:middle}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot{border:3px solid #c4c4c4;box-sizing:border-box;width:12px;height:12px;margin-right:8px;border-radius:50%;vertical-align:middle}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot:hover,.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot:focus{border-color:#727272}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot.carousel__dot--selected{background:#c4c4c4}.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot.carousel__dot--selected:hover,.exactmetrics-carousel-navigation .exactmetrics-carousel-navigation-dots .carousel__dot.carousel__dot--selected:focus{background:#727272}.exactmetrics-inline-popular-posts-image{width:128px;flex-grow:0;flex-shrink:0;margin-right:16px}.exactmetrics-inline-popular-posts-widget{margin-bottom:24px}.exactmetrics-inline-popular-posts-widget .exactmetrics-inline-popular-posts-title{box-shadow:none}.exactmetrics-inline-popular-posts-alpha{padding:24px 27px}.exactmetrics-inline-popular-posts-alpha .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1;display:block;margin-bottom:6px}.exactmetrics-inline-popular-posts-alpha .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:1;text-decoration:none}.exactmetrics-inline-popular-posts-beta{padding:14px;display:flex;align-items:center;border:1px solid #D6E2ED}.exactmetrics-inline-popular-posts-beta .exactmetrics-inline-popular-posts-text{margin-left:19px}.exactmetrics-inline-popular-posts-beta .exactmetrics-inline-popular-posts-label{display:block;font-weight:bold;font-size:18px;line-height:18px}.exactmetrics-inline-popular-posts-beta .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:130%;text-decoration:none}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-border{display:block;border-bottom:1px solid;margin:16px 0}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:16px;line-height:1.1}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-list{list-style:disc inside none}.exactmetrics-inline-popular-posts-charlie .exactmetrics-inline-popular-posts-list li{font-style:normal;font-weight:normal;font-size:16px;line-height:130%}.exactmetrics-inline-popular-posts-delta{border:1px solid #D6E2ED;padding:16px 18px;border-radius:5px}.exactmetrics-inline-popular-posts-delta .exactmetrics-inline-popular-posts-icon{margin-right:8px}.exactmetrics-inline-popular-posts-delta .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1.1;vertical-align:top}.exactmetrics-inline-popular-posts-delta .exactmetrics-inline-popular-posts-title{display:block;font-weight:bold;font-size:18px;line-height:1;text-decoration:none;margin-top:4px}.exactmetrics-inline-popular-posts-echo{padding:13px 16px}.exactmetrics-inline-popular-posts-echo .exactmetrics-inline-popular-posts-icon{margin-right:8px}.exactmetrics-inline-popular-posts-echo .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:16px;line-height:1.1;margin-right:8px}.exactmetrics-inline-popular-posts-echo .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:16px;line-height:130%;text-decoration:none}.exactmetrics-inline-popular-posts-foxtrot{display:flex;align-items:center}.exactmetrics-inline-popular-posts-foxtrot .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1.1;display:block}.exactmetrics-inline-popular-posts-foxtrot .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:125%;text-decoration:none}.exactmetrics-inline-popular-posts-golf{display:flex;align-items:center}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:16px;line-height:1.1;float:left;background:#fff;padding-right:20px}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:16px;line-height:125%;text-decoration:none;display:block;clear:both;margin-top:14px}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-title:before{width:100%}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-border{display:block;border-width:2px 0 0 0;border-style:solid;margin-top:10px}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-border-2{border-top:1px solid #E2E4E9;margin-top:20px;display:block}.exactmetrics-inline-popular-posts-golf .exactmetrics-inline-popular-posts-text{width:100%}.exactmetrics-inline-popular-posts-hotel .exactmetrics-inline-popular-posts-icon{margin-right:10px;vertical-align:middle}.exactmetrics-inline-popular-posts-hotel .exactmetrics-inline-popular-posts-title{font-style:normal;font-weight:bold;font-size:18px;text-decoration:none;line-height:130%}.exactmetrics-inline-popular-posts-india{padding:13px 12px 13px 16px;position:relative}.exactmetrics-inline-popular-posts-india .exactmetrics-inline-popular-posts-border{border-width:0 0 0 4px;border-style:solid;position:absolute;left:0;top:0;bottom:0}.exactmetrics-inline-popular-posts-india .exactmetrics-inline-popular-posts-title{font-size:14px;text-decoration:none;font-weight:bold}.exactmetrics-inline-popular-posts-india .exactmetrics-inline-popular-posts-label{font-size:14px;text-decoration:none;font-weight:bold;margin-right:4px}.exactmetrics-inline-popular-posts-juliett{position:relative;display:flex;align-items:center;width:100%}.exactmetrics-inline-popular-posts-juliett .exactmetrics-inline-popular-posts-border{border-width:1px 0 0 0;border-style:solid;position:absolute;left:0;top:0;right:0}.exactmetrics-inline-popular-posts-juliett .exactmetrics-inline-popular-posts-title{font-size:18px;text-decoration:none;font-weight:bold;max-width:400px;flex-grow:0;display:block;line-height:125%}.exactmetrics-inline-popular-posts-juliett .exactmetrics-inline-popular-posts-label{font-size:14px;line-height:18px;text-decoration:none;font-weight:bold;padding:4px 12px;position:absolute;right:0;top:0}.exactmetrics-inline-popular-posts-kilo{position:relative;padding:30px 0}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-label{font-style:normal;font-weight:bold;font-size:18px;line-height:1}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:130%;text-decoration:none;display:block;clear:both;margin-top:6px}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-title:before{width:100%}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-border-2,.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-border{display:block;position:absolute;left:0;right:0;top:0;border-bottom:4px dashed #E2E4E9}.exactmetrics-inline-popular-posts-kilo .exactmetrics-inline-popular-posts-border-2{bottom:0;top:auto}.exactmetrics-inline-popular-posts-lima{padding:16px 19px;display:flex;align-items:center;justify-content:space-between}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-text{margin-left:13px;order:1}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-label{display:block;font-weight:bold;font-size:18px;line-height:18px}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:120%;text-decoration:none;display:block;max-width:420px;margin-top:7px}.exactmetrics-inline-popular-posts-lima .exactmetrics-inline-popular-posts-image{width:144px;order:2;margin-right:0;margin-left:20px}.exactmetrics-inline-popular-posts-mike{display:flex;position:relative;align-items:center}.exactmetrics-inline-popular-posts-mike .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:18px;line-height:125%;text-decoration:none;display:block;max-width:380px}.exactmetrics-inline-popular-posts-mike .exactmetrics-inline-popular-posts-label{position:absolute;z-index:10;left:0;top:0;font-size:14px;font-weight:bold;padding:5px 8px;line-height:1.2}.exactmetrics-inline-popular-posts-mike .exactmetrics-inline-popular-posts-image{margin-right:20px}.exactmetrics-inline-popular-posts-november{display:flex;position:relative;align-items:center;border-radius:5px;border-width:1px;border-style:solid;padding:16px}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-text{width:100%}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-title{font-weight:bold;font-size:16px;line-height:125%;text-decoration:none;display:block;margin-top:4px}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-label{display:block;font-size:16px;font-weight:bold}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-image{margin-right:20px}.exactmetrics-inline-popular-posts-november .exactmetrics-inline-popular-posts-icon{width:32px;height:32px;display:inline-block;border-radius:50%;text-align:center;float:left;line-height:38px;margin-right:17px;margin-top:4px}.exactmetrics-widget-popular-posts-widget{margin-bottom:24px}.exactmetrics-widget-popular-posts-widget .exactmetrics-widget-popular-posts-list{padding:0}.exactmetrics-widget-popular-posts-widget .exactmetrics-widget-popular-posts-title{box-shadow:none}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-alpha .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-alpha .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:24px;background:#F0F2F4;border-radius:3px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-beta .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-beta .exactmetrics-widget-popular-posts-list li{display:inline-block;background:#fff;border-radius:3px;margin:0 6px 30px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700;border-left:4px solid #1EC185;padding-left:16px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-charlie .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-charlie .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:24px;background:#F0F2F4;border-radius:3px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700;border-top:4px solid #338EEF}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-image{width:121px;height:121px;padding:0;float:left;margin-right:16px;margin-bottom:12px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:16px 0 0;margin:0 6px 0 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700;border-top:2px solid #D3D7DE}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-delta .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-image{margin-bottom:14px;width:100%}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list li{display:inline-block;margin:0 6px 24px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-comments{font-size:16px;font-weight:700;margin-top:14px;display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:16px;background:#F0F2F4;border-radius:5px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-comments{font-size:16px;font-weight:700;margin-top:14px;display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-foxtrot .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list li{display:inline-block;padding:16px;background:#F0F2F4;border-radius:5px;margin:0 6px 12px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;color:#393F4C;font-weight:700}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-comments{font-size:16px;font-weight:700;margin-top:14px;display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-label{font-weight:400;font-size:12px;display:inline-block;padding:4px 8px;border-radius:3px;line-height:1;margin-bottom:14px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-golf .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-title{display:block}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list{margin:0 -6px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list li{display:inline-block;margin:0 6px 24px 6px;width:calc(50% - 12px);vertical-align:top;font-size:16px;line-height:1.2;font-weight:700;position:relative}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-text{position:absolute;bottom:0;padding:0 14px 14px;left:0;z-index:15}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta{font-size:12px;margin-top:8px;font-weight:400}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-list .exactmetrics-widget-popular-posts-meta span{display:inline-block;margin-right:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-bg-img{margin-bottom:0;padding-top:50%;width:100%}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-bg-img:after{z-index:5;border-radius:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-bg-img:before{background:linear-gradient(0deg, #000 -25.16%, rgba(0,0,0,0.1) 100%);content:'';top:0;bottom:0;left:0;right:0;position:absolute;z-index:10;border-radius:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-image{position:relative}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-image img{width:100%}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-hotel .exactmetrics-widget-popular-posts-image:before{background:linear-gradient(0deg, #000 -25.16%, rgba(0,0,0,0.1));content:"";top:0;bottom:0;left:0;right:0;position:absolute;z-index:10;border-radius:5px}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-1 .exactmetrics-widget-popular-posts-list{margin:0}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-1 .exactmetrics-widget-popular-posts-list li{width:100%;margin-left:0;margin-right:0}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-3 .exactmetrics-widget-popular-posts-list{margin:0}.exactmetrics-widget-popular-posts-widget.exactmetrics-widget-popular-posts-columns-3 .exactmetrics-widget-popular-posts-list li{width:calc(33.333333% - 12px)}.exactmetrics-wide-column-options input[type="radio"]{display:none}.exactmetrics-wide-column-options .components-radio-control__option{display:inline-block}.exactmetrics-wide-column-options .components-base-control__label{display:block}.exactmetrics-wide-column-options .exactmetrics-wide-column{display:flex;border:1px solid #B7C9D9;border-radius:5px;width:40px;height:40px;padding:10px 5px;flex-flow:wrap;justify-content:space-between}.exactmetrics-wide-column-options .exactmetrics-wide-column>span{background:#99A1B2;display:inline-block;width:8px;height:8px;border-radius:1px;margin-bottom:2px}.exactmetrics-wide-column-options .exactmetrics-wide-column.exactmetrics-wide-column-two>span{width:12px}.exactmetrics-wide-column-options .exactmetrics-wide-column.exactmetrics-wide-column-one>span{width:100%}.exactmetrics-wide-column-options input[type="radio"]:checked+label .exactmetrics-wide-column{border:2px solid #6528f5;background:#ECF4FE;padding:9px 4px}.exactmetrics-wide-column-options input[type="radio"]:checked+label .exactmetrics-wide-column>span{background:#6528f5}.block-editor-block-inspector .exactmetrics-hierarchical-terms .components-base-control{margin-bottom:0}.block-editor-block-inspector .exactmetrics-hierarchical-terms-disabled{opacity:0.6;pointer-events:none}.exactmetrics-popular-posts-products-theme-picker .exactmetrics-theme-picker-slide label{height:142px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-image{width:80px;height:80px;padding:0;float:left;margin-right:18px}.exactmetrics-products-popular-posts-widget.exactmetrics-widget-popular-posts-echo .exactmetrics-products-popular-posts-image{margin-bottom:14px;width:100%}.exactmetrics-input-text-small{margin-top:24px}.exactmetrics-input-text-small .settings-input-text-input{max-width:350px}.exactmetrics-input-text-extra-small .settings-input-text{display:inline-block;margin-right:5px}.exactmetrics-input-text-extra-small .settings-input-text-input{max-width:80px}.exactmetrics-products-popular-posts-widget{margin-bottom:24px}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-title{box-shadow:none}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-list{padding:0}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-rating{display:block}.exactmetrics-products-popular-posts-widget .exactmetrics-products-popular-posts-rating svg{margin-right:2px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-list{margin:0 -12px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-list li{display:inline-block;margin:0 12px;width:calc(50% - 24px);vertical-align:top;font-size:16px;border-top:1px solid #D3D7DE;padding-top:15px;padding-bottom:30px;font-weight:bold;line-height:1.1}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-alpha .exactmetrics-products-popular-posts-price{display:block;margin:10px 0 7px;font-weight:400}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-list,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list{margin:0 -6px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-list li,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list li{display:inline-block;width:calc(50% - 12px);vertical-align:top;font-size:16px;padding:10px 12px;font-weight:bold;line-height:1.1;margin:0 6px 24px;border-radius:3px;position:relative}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-price,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-price{display:block;font-weight:400;position:absolute;right:12px;bottom:10px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-title,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-title{margin-top:12px;display:block}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-beta .exactmetrics-products-popular-posts-rating,.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-rating{margin-top:13px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-list{margin:0 -6px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-list li{display:inline-block;width:calc(50% - 12px);vertical-align:top;font-size:16px;padding:0;font-weight:bold;line-height:1.1;margin:0 6px 24px;border-radius:5px;position:relative}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-price{display:block;font-weight:400;order:3;margin-top:4px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-title{order:2;margin-top:4px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-text{position:absolute;bottom:0;z-index:10;left:0;right:0;padding:16px;display:flex;flex-flow:column}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-rating{margin-top:13px;order:1}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-image{position:relative}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-charlie .exactmetrics-products-popular-posts-image:before{background:linear-gradient(0deg, #000 -25.16%, rgba(0,0,0,0.1) 100%);content:'';top:0;bottom:0;left:0;right:0;position:absolute;z-index:10;border-radius:5px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-price{position:relative;margin-top:8px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list{margin:0 -6px}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-list li{padding:0}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-price{right:auto;bottom:auto;order:3}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-rating{margin-top:8px;order:1}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-title{order:2}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-delta .exactmetrics-products-popular-posts-text{display:flex;flex-flow:column}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-columns-1 .exactmetrics-products-popular-posts-list{margin:0}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-columns-1 .exactmetrics-products-popular-posts-list li{width:100%;margin-left:0;margin-right:0}.exactmetrics-products-popular-posts-widget.exactmetrics-products-popular-posts-columns-3 .exactmetrics-products-popular-posts-list li{width:calc(33.333333% - 24px)}.exactmetrics-post-picker .components-form-token-field__help{display:none}.exactmetrics-popular-posts-pro-pill{font-style:normal;font-weight:bold;font-size:11px;background:#1EC185;border-radius:5px;color:#fff;padding:3px 8px;margin-left:8px}.exactmetrics-popular-posts-no-woocoomerce{padding:44px 34px;text-align:center}.exactmetrics-popular-posts-no-woocoomerce h3{font-size:22px;line-height:1.4}.exactmetrics-popular-posts-no-woocoomerce p,.exactmetrics-popular-posts-no-woocoomerce a{font-size:16px;font-style:normal;font-weight:400;line-height:22px;color:#626D83}.exactmetrics-popular-posts-no-woocoomerce a{color:#1170D5;margin-top:24px}
|
assets/gutenberg/js/editor.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=
|
2 |
-
Copyright (c)
|
3 |
Licensed under the MIT License (MIT), see
|
4 |
http://jedwatson.github.io/classnames
|
5 |
*/
|
6 |
-
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=n.apply(null,r);a&&e.push(a)}else if("object"===i)for(var l in r)o.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}var o={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(i=function(){return n}.apply(t,r))&&(e.exports=i))}()},function(e,t,n){var r=n(5),i=n(0),o=n(29),a=n(10),l=n(9),s=function(e,t,n){var c,u,d,p=e&s.F,h=e&s.G,m=e&s.S,f=e&s.P,g=e&s.B,w=e&s.W,y=h?i:i[t]||(i[t]={}),v=y.prototype,b=h?r:m?r[t]:(r[t]||{}).prototype;h&&(n=t);for(c in n)(u=!p&&b&&void 0!==b[c])&&l(y,c)||(d=u?b[c]:n[c],y[c]=h&&"function"!=typeof b[c]?n[c]:g&&u?o(d,r):w&&b[c]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):f&&"function"==typeof d?o(Function.call,d):d,f&&((y.virtual||(y.virtual={}))[c]=d,e&s.R&&v&&!v[c]&&a(v,c,d)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(8),i=n(46),o=n(30),a=Object.defineProperty;t.f=n(7)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports=!n(12)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(11);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(6),i=n(15);e.exports=n(7)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports={}},function(e,t,n){var r=n(50),i=n(28);e.exports=function(e){return r(i(e))}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(28);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";var r={};r.headline=wp.element.createElement("svg",{width:"15",height:"14",viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M13.5 2V12H14.5C14.6458 12 14.7604 12.0521 14.8438 12.1562C14.9479 12.2396 15 12.3542 15 12.5V13.5C15 13.6458 14.9479 13.7604 14.8438 13.8438C14.7604 13.9479 14.6458 14 14.5 14H9.5C9.35417 14 9.22917 13.9479 9.125 13.8438C9.04167 13.7604 9 13.6458 9 13.5V12.5C9 12.3542 9.04167 12.2396 9.125 12.1562C9.22917 12.0521 9.35417 12 9.5 12H10.5V8H4.5V12H5.5C5.64583 12 5.76042 12.0521 5.84375 12.1562C5.94792 12.2396 6 12.3542 6 12.5V13.5C6 13.6458 5.94792 13.7604 5.84375 13.8438C5.76042 13.9479 5.64583 14 5.5 14H0.5C0.354167 14 0.229167 13.9479 0.125 13.8438C0.0416667 13.7604 0 13.6458 0 13.5V12.5C0 12.3542 0.0416667 12.2396 0.125 12.1562C0.229167 12.0521 0.354167 12 0.5 12H1.5V2H0.5C0.354167 2 0.229167 1.95833 0.125 1.875C0.0416667 1.77083 0 1.64583 0 1.5V0.5C0 0.354167 0.0416667 0.239583 0.125 0.15625C0.229167 0.0520833 0.354167 0 0.5 0H5.5C5.64583 0 5.76042 0.0520833 5.84375 0.15625C5.94792 0.239583 6 0.354167 6 0.5V1.5C6 1.64583 5.94792 1.77083 5.84375 1.875C5.76042 1.95833 5.64583 2 5.5 2H4.5V6H10.5V2H9.5C9.35417 2 9.22917 1.95833 9.125 1.875C9.04167 1.77083 9 1.64583 9 1.5V0.5C9 0.354167 9.04167 0.239583 9.125 0.15625C9.22917 0.0520833 9.35417 0 9.5 0H14.5C14.6458 0 14.7604 0.0520833 14.8438 0.15625C14.9479 0.239583 15 0.354167 15 0.5V1.5C15 1.64583 14.9479 1.77083 14.8438 1.875C14.7604 1.95833 14.6458 2 14.5 2H13.5Z",fill:"white"})),r.headlineBlack=wp.element.createElement("svg",{width:"15",height:"14",viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M13.5 2V12H14.5C14.6458 12 14.7604 12.0521 14.8438 12.1562C14.9479 12.2396 15 12.3542 15 12.5V13.5C15 13.6458 14.9479 13.7604 14.8438 13.8438C14.7604 13.9479 14.6458 14 14.5 14H9.5C9.35417 14 9.22917 13.9479 9.125 13.8438C9.04167 13.7604 9 13.6458 9 13.5V12.5C9 12.3542 9.04167 12.2396 9.125 12.1562C9.22917 12.0521 9.35417 12 9.5 12H10.5V8H4.5V12H5.5C5.64583 12 5.76042 12.0521 5.84375 12.1562C5.94792 12.2396 6 12.3542 6 12.5V13.5C6 13.6458 5.94792 13.7604 5.84375 13.8438C5.76042 13.9479 5.64583 14 5.5 14H0.5C0.354167 14 0.229167 13.9479 0.125 13.8438C0.0416667 13.7604 0 13.6458 0 13.5V12.5C0 12.3542 0.0416667 12.2396 0.125 12.1562C0.229167 12.0521 0.354167 12 0.5 12H1.5V2H0.5C0.354167 2 0.229167 1.95833 0.125 1.875C0.0416667 1.77083 0 1.64583 0 1.5V0.5C0 0.354167 0.0416667 0.239583 0.125 0.15625C0.229167 0.0520833 0.354167 0 0.5 0H5.5C5.64583 0 5.76042 0.0520833 5.84375 0.15625C5.94792 0.239583 6 0.354167 6 0.5V1.5C6 1.64583 5.94792 1.77083 5.84375 1.875C5.76042 1.95833 5.64583 2 5.5 2H4.5V6H10.5V2H9.5C9.35417 2 9.22917 1.95833 9.125 1.875C9.04167 1.77083 9 1.64583 9 1.5V0.5C9 0.354167 9.04167 0.239583 9.125 0.15625C9.22917 0.0520833 9.35417 0 9.5 0H14.5C14.6458 0 14.7604 0.0520833 14.8438 0.15625C14.9479 0.239583 15 0.354167 15 0.5V1.5C15 1.64583 14.9479 1.77083 14.8438 1.875C14.7604 1.95833 14.6458 2 14.5 2H13.5Z",fill:"#000"})),r.warning=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M16 8C16 6.58065 15.6129 5.22581 14.9032 4C14.1935 2.77419 13.2258 1.80645 12 1.09677C10.7742 0.387097 9.41936 0 8 0C6.54839 0 5.22581 0.387097 4 1.09677C2.77419 1.80645 1.77419 2.77419 1.06452 4C0.354839 5.22581 0 6.58065 0 8C0 9.45161 0.354839 10.7742 1.06452 12C1.77419 13.2258 2.77419 14.2258 4 14.9355C5.22581 15.6452 6.54839 16 8 16C9.41936 16 10.7742 15.6452 12 14.9355C13.2258 14.2258 14.1935 13.2258 14.9032 12C15.6129 10.7742 16 9.45161 16 8ZM8 9.6129C8.3871 9.6129 8.74194 9.77419 9.03226 10.0645C9.32258 10.3548 9.48387 10.7097 9.48387 11.0968C9.48387 11.5161 9.32258 11.871 9.03226 12.1613C8.74194 12.4516 8.3871 12.5806 8 12.5806C7.58065 12.5806 7.22581 12.4516 6.93548 12.1613C6.64516 11.871 6.51613 11.5161 6.51613 11.0968C6.51613 10.7097 6.64516 10.3548 6.93548 10.0645C7.22581 9.77419 7.58065 9.6129 8 9.6129ZM6.58065 4.29032C6.58065 4.16129 6.6129 4.06452 6.67742 4C6.74194 3.93548 6.83871 3.87097 6.96774 3.87097H9.03226C9.12903 3.87097 9.22581 3.93548 9.29032 4C9.35484 4.06452 9.41936 4.16129 9.41936 4.29032L9.16129 8.67742C9.16129 8.77419 9.09677 8.87097 9.03226 8.93548C8.96774 9 8.87097 9.03226 8.77419 9.03226H7.22581C7.09677 9.03226 7 9 6.93548 8.93548C6.87097 8.87097 6.83871 8.77419 6.83871 8.67742L6.58065 4.29032Z",fill:"#F2994A"})),r.smile=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484ZM11.2903 5.74194C11.0968 5.52688 10.8602 5.41935 10.5806 5.41935C10.3011 5.41935 10.0538 5.52688 9.83871 5.74194C9.64516 5.93548 9.54839 6.17204 9.54839 6.45161C9.54839 6.73118 9.64516 6.97849 9.83871 7.19355C10.0538 7.3871 10.3011 7.48387 10.5806 7.48387C10.8602 7.48387 11.0968 7.3871 11.2903 7.19355C11.5054 6.97849 11.6129 6.73118 11.6129 6.45161C11.6129 6.17204 11.5054 5.93548 11.2903 5.74194ZM6.12903 5.74194C5.93548 5.52688 5.69892 5.41935 5.41935 5.41935C5.13978 5.41935 4.89247 5.52688 4.67742 5.74194C4.48387 5.93548 4.3871 6.17204 4.3871 6.45161C4.3871 6.73118 4.48387 6.97849 4.67742 7.19355C4.89247 7.3871 5.13978 7.48387 5.41935 7.48387C5.69892 7.48387 5.93548 7.3871 6.12903 7.19355C6.34409 6.97849 6.45161 6.73118 6.45161 6.45161C6.45161 6.17204 6.34409 5.93548 6.12903 5.74194ZM11.7097 10.9032C11.7957 10.8172 11.8387 10.7204 11.8387 10.6129C11.8387 10.4839 11.8065 10.3871 11.7419 10.3226C11.6774 10.2366 11.5914 10.172 11.4839 10.129C11.3978 10.0645 11.3011 10.043 11.1935 10.0645C11.086 10.086 10.9892 10.1505 10.9032 10.2581C10.1505 11.1613 9.1828 11.6129 8 11.6129C6.8172 11.6129 5.84946 11.1613 5.09677 10.2581C5.01075 10.1505 4.91398 10.086 4.80645 10.0645C4.69892 10.043 4.5914 10.0645 4.48387 10.129C4.39785 10.172 4.32258 10.2366 4.25806 10.3226C4.19355 10.3871 4.16129 10.4839 4.16129 10.6129C4.16129 10.7204 4.2043 10.8172 4.29032 10.9032C5.25806 12.0645 6.49462 12.6452 8 12.6452C9.50538 12.6452 10.7419 12.0645 11.7097 10.9032Z",fill:"#1EC185"})),r.neutral=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484ZM6.12903 5.74194C5.93548 5.52688 5.69892 5.41935 5.41935 5.41935C5.13978 5.41935 4.89247 5.52688 4.67742 5.74194C4.48387 5.93548 4.3871 6.17204 4.3871 6.45161C4.3871 6.73118 4.48387 6.97849 4.67742 7.19355C4.89247 7.3871 5.13978 7.48387 5.41935 7.48387C5.69892 7.48387 5.93548 7.3871 6.12903 7.19355C6.34409 6.97849 6.45161 6.73118 6.45161 6.45161C6.45161 6.17204 6.34409 5.93548 6.12903 5.74194ZM11.0968 11.6129C11.4409 11.6129 11.6129 11.4409 11.6129 11.0968C11.6129 10.7527 11.4409 10.5806 11.0968 10.5806H4.90323C4.55914 10.5806 4.3871 10.7527 4.3871 11.0968C4.3871 11.4409 4.55914 11.6129 4.90323 11.6129H11.0968ZM9.83871 7.19355C10.0538 7.3871 10.3011 7.48387 10.5806 7.48387C10.8602 7.48387 11.0968 7.3871 11.2903 7.19355C11.5054 6.97849 11.6129 6.73118 11.6129 6.45161C11.6129 6.17204 11.5054 5.93548 11.2903 5.74194C11.0968 5.52688 10.8602 5.41935 10.5806 5.41935C10.3011 5.41935 10.0538 5.52688 9.83871 5.74194C9.64516 5.93548 9.54839 6.17204 9.54839 6.45161C9.54839 6.73118 9.64516 6.97849 9.83871 7.19355Z",fill:"#626D83"})),r.negative=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484ZM4.3871 7.48387C4.3871 7.76344 4.48387 8.01075 4.67742 8.22581C4.89247 8.41935 5.13978 8.51613 5.41935 8.51613C5.69892 8.51613 5.93548 8.41935 6.12903 8.22581C6.34409 8.01075 6.45161 7.76344 6.45161 7.48387C6.45161 7.44086 6.43011 7.35484 6.3871 7.22581C6.4086 7.22581 6.41935 7.22581 6.41935 7.22581C6.44086 7.22581 6.45161 7.22581 6.45161 7.22581C6.70968 7.22581 6.87097 7.10753 6.93548 6.87097C6.95699 6.78495 6.96774 6.70968 6.96774 6.64516C6.96774 6.58065 6.94624 6.52688 6.90323 6.48387C6.88172 6.41935 6.83871 6.36559 6.77419 6.32258C6.73118 6.27957 6.67742 6.24731 6.6129 6.22581L4.03226 5.45161C3.88172 5.4086 3.74194 5.41935 3.6129 5.48387C3.50538 5.54839 3.43011 5.64516 3.3871 5.77419C3.36559 5.86021 3.35484 5.93548 3.35484 6C3.37634 6.06452 3.39785 6.12903 3.41935 6.19355C3.44086 6.23656 3.47312 6.27957 3.51613 6.32258C3.58065 6.36559 3.65591 6.39785 3.74194 6.41935L4.70968 6.74194C4.49462 6.93548 4.3871 7.1828 4.3871 7.48387ZM9.80645 12.4516C9.93548 12.6237 10.0968 12.6882 10.2903 12.6452C10.4839 12.6021 10.6129 12.4946 10.6774 12.3226C10.7419 12.1505 10.7097 11.9785 10.5806 11.8065C9.91398 10.9892 9.05376 10.5806 8 10.5806C6.94624 10.5806 6.07527 10.9892 5.3871 11.8065C5.34409 11.871 5.31183 11.9462 5.29032 12.0323C5.26882 12.1183 5.26882 12.1935 5.29032 12.2581C5.31183 12.3226 5.34409 12.3871 5.3871 12.4516C5.43011 12.5161 5.48387 12.5699 5.54839 12.6129C5.6129 12.6344 5.67742 12.6559 5.74194 12.6774C5.82796 12.6774 5.90323 12.6667 5.96774 12.6452C6.05376 12.6021 6.12903 12.5376 6.19355 12.4516C6.64516 11.914 7.24731 11.6452 8 11.6452C8.75269 11.6452 9.35484 11.914 9.80645 12.4516ZM12.2903 6.41935C12.4194 6.37634 12.5161 6.30107 12.5806 6.19355C12.6452 6.06452 12.6559 5.92473 12.6129 5.77419C12.5914 5.68817 12.5484 5.6129 12.4839 5.54839C12.4194 5.48387 12.3441 5.45161 12.2581 5.45161C12.172 5.43011 12.086 5.43011 12 5.45161L9.41935 6.22581C9.26882 6.26882 9.16129 6.35484 9.09677 6.48387C9.03226 6.5914 9.02151 6.72043 9.06452 6.87097C9.12903 7.10753 9.29032 7.22581 9.54839 7.22581C9.56989 7.22581 9.5914 7.22581 9.6129 7.22581C9.56989 7.33333 9.54839 7.41935 9.54839 7.48387C9.54839 7.76344 9.64516 8.01075 9.83871 8.22581C10.0538 8.41935 10.3011 8.51613 10.5806 8.51613C10.8602 8.51613 11.0968 8.41935 11.2903 8.22581C11.5054 8.01075 11.6129 7.76344 11.6129 7.48387C11.6129 7.1828 11.5054 6.93548 11.2903 6.74194L12.2903 6.41935Z",fill:"#626D83"})),r.check=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484ZM7.06452 12.2258L13 6.29032C13.2581 6.05376 13.2581 5.8172 13 5.58065L12.2903 4.83871C12.0323 4.60215 11.7849 4.60215 11.5484 4.83871L6.70968 9.67742L4.45161 7.41935C4.21505 7.1828 3.96774 7.1828 3.70968 7.41935L3 8.16129C2.74194 8.39785 2.74194 8.63441 3 8.87097L6.35484 12.2258C6.5914 12.4839 6.82796 12.4839 7.06452 12.2258Z",fill:"#1EC185"})),t.a=r},function(e,t){e.exports=lodash},function(e,t,n){"use strict";var r=n(84)(!0);n(45)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){e.exports=!0},function(e,t,n){var r=n(49),i=n(35);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(96),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=i.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var r=wp.element.Fragment,i=function(e){var t=e.barScore,n=e.width?e.width+"px":"80px",i=t>50?0:180-3.6*t,o=e.barColor;return wp.element.createElement(r,null,wp.element.createElement("div",{className:"exactmetrics-donut-container",style:{flexDirection:"column"}},wp.element.createElement("div",{className:"exactmetrics-donut",style:{width:n,paddingBottom:n,backgroundColor:"#f2f2f2"}},wp.element.createElement("div",{className:"exactmetrics-donut-sections",style:{transform:"rotate(0deg)"}},wp.element.createElement("div",{className:"exactmetrics-donut-section exactmetrics-donut-section-right",style:{transform:"rotate(0deg)"}},wp.element.createElement("div",{className:"exactmetrics-donut-filler",style:{backgroundColor:o,transform:"rotate(-"+i+"deg)"}})),function(){if(t>50){var e=180+360*(t-50)/100;return wp.element.createElement("div",{className:"exactmetrics-donut-section exactmetrics-donut-section-left",style:{transform:"rotate(0deg)"}},wp.element.createElement("div",{className:"exactmetrics-donut-filler",style:{backgroundColor:o,transform:"rotate("+e+"deg)"}}))}}()),wp.element.createElement("div",{className:"exactmetrics-donut-overlay",style:{height:"70%",width:"70%",top:"calc(15%)",left:"calc(15%)",backgroundColor:"rgb(255, 255, 255)"}}))))};t.a=i},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=r},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(85);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(11);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(8),i=n(87),o=n(35),a=n(33)("IE_PROTO"),l=function(){},s=function(){var e,t=n(47)("iframe"),r=o.length;for(t.style.display="none",n(90).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),s=e.F;r--;)delete s.prototype[o[r]];return s()};e.exports=Object.create||function(e,t){var n;return null!==e?(l.prototype=r(e),n=new l,l.prototype=null,n[a]=e):n=s(),void 0===t?n:i(n,t)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(34)("keys"),i=n(22);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(0),i=n(5),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(20)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(6).f,i=n(9),o=n(2)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){n(102);for(var r=n(5),i=n(10),o=n(13),a=n(2)("toStringTag"),l="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),s=0;s<l.length;s++){var c=l[s],u=r[c],d=u&&u.prototype;d&&!d[a]&&i(d,a,c),o[c]=o.Array}},function(e,t){e.exports=React},function(e,t,n){t.f=n(2)},function(e,t,n){var r=n(5),i=n(0),o=n(20),a=n(40),l=n(6).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||l(t,e,{value:a.f(e)})}},function(e,t,n){"use strict";var r=(n(26),n(43),n(39)),i=(n.n(r),n(18));n.n(i);n.o(r,"Component")&&n.d(t,"a",function(){return r.Component}),n.o(r,"createContext")&&n.d(t,"d",function(){return r.createContext}),n.o(r,"createElement")&&n.d(t,"e",function(){return r.createElement}),n.o(r,"forwardRef")&&n.d(t,"f",function(){return r.forwardRef}),n.o(r,"Fragment")&&n.d(t,"b",function(){return r.Fragment}),n.o(r,"StrictMode")&&n.d(t,"c",function(){return r.StrictMode})},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o=Object(i.a)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}t.a=r;var i=n(199)},function(e,t,n){"use strict";t.__esModule=!0;var r=n(82),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return(0,i.default)(e)}},function(e,t,n){"use strict";var r=n(20),i=n(4),o=n(48),a=n(10),l=n(13),s=n(86),c=n(36),u=n(52),d=n(2)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,m,f,g,w){s(n,t,m);var y,v,b,S=function(e){if(!p&&e in _)return _[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",C="values"==f,x=!1,_=e.prototype,k=_[d]||_["@@iterator"]||f&&_[f],O=k||S(f),T=f?C?S("entries"):O:void 0,M="Array"==t?_.entries||k:k;if(M&&(b=u(M.call(new e)))!==Object.prototype&&b.next&&(c(b,E,!0),r||"function"==typeof b[d]||a(b,d,h)),C&&k&&"values"!==k.name&&(x=!0,O=function(){return k.call(this)}),r&&!w||!p&&!x&&_[d]||a(_,d,O),l[t]=O,l[E]=h,f)if(y={values:C?O:S("values"),keys:g?O:S("keys"),entries:T},w)for(v in y)v in _||o(_,v,y[v]);else i(i.P+i.F*(p||x),t,y);return y}},function(e,t,n){e.exports=!n(7)&&!n(12)(function(){return 7!=Object.defineProperty(n(47)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(11),i=n(5).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){e.exports=n(10)},function(e,t,n){var r=n(9),i=n(14),o=n(88)(!1),a=n(33)("IE_PROTO");e.exports=function(e,t){var n,l=i(e),s=0,c=[];for(n in l)n!=a&&r(l,n)&&c.push(n);for(;t.length>s;)r(l,n=t[s++])&&(~o(c,n)||c.push(n));return c}},function(e,t,n){var r=n(32);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(27),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(9),i=n(16),o=n(33)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var r=n(54),i=n(2)("iterator"),o=n(13);e.exports=n(0).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(32),i=n(2)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,l;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(l=r(t))&&"function"==typeof t.callee?"Arguments":l}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(100),o=r(i),a=n(106),l=r(a);t.default=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=(0,l.default)(e);!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if((0,o.default)(Object(t)))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t,n){e.exports=n(109)},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var i=n(1);e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(i.isURLSearchParams(t))o=t.toString();else{var a=[];i.forEach(t,function(e,t){null!==e&&void 0!==e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),a.push(r(t)+"="+r(e))}))}),o=a.join("&")}if(o){var l=e.indexOf("#");-1!==l&&(e=e.slice(0,l)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";(function(t){function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i=n(1),o=n(115),a={"Content-Type":"application/x-www-form-urlencoded"},l={adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(61):void 0!==t&&"[object process]"===Object.prototype.toString.call(t)&&(e=n(61)),e}(),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){l.headers[e]={}}),i.forEach(["post","put","patch"],function(e){l.headers[e]=i.merge(a)}),e.exports=l}).call(t,n(114))},function(e,t,n){"use strict";var r=n(1),i=n(116),o=n(58),a=n(118),l=n(121),s=n(122),c=n(62);e.exports=function(e){return new Promise(function(t,u){var d=e.data,p=e.headers;r.isFormData(d)&&delete p["Content-Type"];var h=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",f=e.auth.password||"";p.Authorization="Basic "+btoa(m+":"+f)}var g=a(e.baseURL,e.url);if(h.open(e.method.toUpperCase(),o(g,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,h.onreadystatechange=function(){if(h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?l(h.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?h.response:h.responseText,o={data:r,status:h.status,statusText:h.statusText,headers:n,config:e,request:h};i(t,u,o),h=null}},h.onabort=function(){h&&(u(c("Request aborted",e,"ECONNABORTED",h)),h=null)},h.onerror=function(){u(c("Network Error",e,null,h)),h=null},h.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),u(c(t,e,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var w=n(123),y=(e.withCredentials||s(g))&&e.xsrfCookieName?w.read(e.xsrfCookieName):void 0;y&&(p[e.xsrfHeaderName]=y)}if("setRequestHeader"in h&&r.forEach(p,function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete p[t]:h.setRequestHeader(t,e)}),r.isUndefined(e.withCredentials)||(h.withCredentials=!!e.withCredentials),e.responseType)try{h.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){h&&(h.abort(),u(e),h=null)}),void 0===d&&(d=null),h.send(d)})}},function(e,t,n){"use strict";var r=n(117);e.exports=function(e,t,n,i,o){var a=new Error(e);return r(a,t,n,i,o)}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t){t=t||{};var n={},i=["url","method","params","data"],o=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];r.forEach(i,function(e){void 0!==t[e]&&(n[e]=t[e])}),r.forEach(o,function(i){r.isObject(t[i])?n[i]=r.deepMerge(e[i],t[i]):void 0!==t[i]?n[i]=t[i]:r.isObject(e[i])?n[i]=r.deepMerge(e[i]):void 0!==e[i]&&(n[i]=e[i])}),r.forEach(a,function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])});var l=i.concat(o).concat(a),s=Object.keys(t).filter(function(e){return-1===l.indexOf(e)});return r.forEach(s,function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";t.__esModule=!0;var r=n(66),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){e.exports={default:n(141),__esModule:!0}},function(e,t,n){e.exports=n(143)},function(e,t,n){"use strict";function r(e){var t=e.className,n=e.selected,o=e.help,p=e.onChange,h=e.options,m=void 0===h?[]:h,f=e.icons,g=void 0===f?[]:f,w=u(r),y="inspector-exactmetrics-popular-posts-theme-control-"+w,v=function(e){return p(e.target.value)},b=[],S=0,E=0,C=0;for(var x in m)if(m.hasOwnProperty(x)){var _=m[x];void 0===b[S]&&(b[S]=[]),b[S][E]=_,_.value===n&&(C=S),3===E?(E=0,S++):E++}var k=function(){return wp.element.createElement("span",{className:"exactmetrics-theme-picker-check"},s.a.checkmark)},O=function(e){var t="exactmetrics-theme-picker-label-"+e.value;return e.value===n&&(t+=" exactmetrics-theme-picker-label-selected"),l.a.canaccess(e.level)||(t+=" exactmetrics-theme-picker-label-disabled"),t};return!Object(i.isEmpty)(m)&&wp.element.createElement(d,{id:y,help:o,className:a()(t,"exactmetrics-theme-picker")},wp.element.createElement(c.c,{naturalSlideWidth:250,totalSlides:b.length,className:"exactmetrics-theme-picker-carousel",currentSlide:C,dragEnabled:!1},wp.element.createElement(c.f,null,b.map(function(e,t){return wp.element.createElement(c.e,{className:"exactmetrics-theme-picker-slide",index:t,key:y+"-"+t},e.map(function(e,r){return wp.element.createElement("div",{key:y+"-"+t+"-"+r,className:"exactmetrics-slider-theme-option"},wp.element.createElement("input",{id:y+"-"+t+"-"+r,className:"exactmetrics-slider-theme-input",type:"radio",name:y,value:e.value,onChange:v,checked:e.value===n,"aria-describedby":o?y+"__help":void 0}),wp.element.createElement("label",{htmlFor:y+"-"+t+"-"+r,className:O(e)},e.value===n&&k(),wp.element.createElement("span",{className:"exactmetrics-theme-picker-label-icon"},g[e.value]?g[e.value]:""),wp.element.createElement("span",{className:"exactmetrics-theme-picker-label-text"},e.label)))}))})),function(){if(b.length>1)return wp.element.createElement("div",{className:"exactmetrics-carousel-navigation"},wp.element.createElement(c.a,null,s.a.chevronleft),wp.element.createElement(c.d,{className:"exactmetrics-carousel-navigation-dots"}),wp.element.createElement(c.b,null,s.a.chevronright))}()))}t.a=r;var i=n(18),o=(n.n(i),n(3)),a=n.n(o),l=n(146),s=n(147),c=n(148),u=wp.compose.useInstanceId,d=wp.components.BaseControl},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(159),o=r(i),a=n(161),l=r(a),s="function"==typeof l.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof l.default&&e.constructor===l.default&&e!==l.default.prototype?"symbol":typeof e};t.default="function"==typeof l.default&&"symbol"===s(o.default)?function(e){return void 0===e?"undefined":s(e)}:function(e){return e&&"function"==typeof l.default&&e.constructor===l.default&&e!==l.default.prototype?"symbol":void 0===e?"undefined":s(e)}},function(e,t,n){var r=n(49),i=n(35).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){var r=n(24),i=n(15),o=n(14),a=n(30),l=n(9),s=n(46),c=Object.getOwnPropertyDescriptor;t.f=n(7)?c:function(e,t){if(e=o(e),t=a(t,!0),s)try{return c(e,t)}catch(e){}if(l(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){Object(o.a)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}n.d(t,"a",function(){return s});var o=n(26),a=n(183),l={"":{plural_forms:function(e){return 1===e?0:1}}},s=function(e,t){var n=new a.a({}),r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";n.data[t]=i({},l,{},n.data[t],{},e),n.data[t][""]=i({},l[""],{},n.data[t][""])},o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return n.data[e]||r(void 0,e),n.dcnpgettext(e,t,i,o,a)},s=function(e,t){return o(t,void 0,e)},c=function(e,t,n){return o(n,t,e)},u=function(e,t,n,r){return o(r,void 0,e,t,n)},d=function(e,t,n,r,i){return o(i,r,e,t,n)},p=function(){return"rtl"===c("ltr","text direction")};return e&&r(e,t),{setLocaleData:r,__:s,_x:c,_n:u,_nx:d,isRTL:p}}},function(e,t,n){"use strict";function r(e,t){if(e){if("string"==typeof e)return Object(i.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(i.a)(e,t):void 0}}t.a=r;var i=n(74)},function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=r},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.a=r},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){Object(a.a)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e){var t=e.children,n=Object(l.a)(e,["children"]);return Object(s.e)("div",i({dangerouslySetInnerHTML:{__html:t}},n))}t.a=o;var a=n(26),l=n(43),s=n(42)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(78),i=(n.n(r),n(79)),o=(n.n(i),n(80),n(139),wp.i18n.setLocaleData);void 0!==window.exactmetrics_gutenberg_tool_vars.translations&&o(window.exactmetrics_gutenberg_tool_vars.translations,"google-analytics-dashboard-for-wp")},function(e,t){},function(e,t){},function(e,t,n){"use strict";n(81)},function(e,t,n){"use strict";var r=n(44),i=n.n(r),o=n(23),a=n.n(o),l=n(55),s=n.n(l),c=n(17),u=n(56),d=n.n(u),p=n(126),h=n(130),m=n(131),f=n(133),g=n(134),w=n(135),y=n(136),v=n(137),b=n(138),S=wp.i18n.__,E=wp.element,C=E.Fragment,x=E.useState,_=E.useEffect,k=wp.plugins.registerPlugin,O=wp.editPost,T=O.PluginSidebar,M=O.PluginSidebarMoreMenuItem,N=wp.data.select,F=function(e){var t=N("core/editor").getEditedPostAttribute("title"),n=S("Headline Analyzer","google-analytics-dashboard-for-wp"),r=S("Write your post title to see the analyzer data. This Headline Analyzer tool enables you to write irresistible SEO headlines that drive traffic, shares, and rank better in search results.","google-analytics-dashboard-for-wp"),o=x({}),l=s()(o,2),u=l[0],E=l[1],k=document.querySelector(".components-button[aria-label='"+n+"'] svg"),O=void 0!==u.previousHeadlinesData?u.previousHeadlinesData:[],F=sprintf(S("This headline analyzer is part of ExactMetrics to help you increase your traffic. See your %1swebsite traffic reports%2s.","google-analytics-dashboard-for-wp"),'<a href="'+exactmetrics_gutenberg_tool_vars.reports_url+'" className="exactmetrics-headline-analyzer-link">',"</a>"),P=document.querySelector(".exactmetrics-headline-analyzer-wrapper");if(k){var j=document.createElement("span");if(u.dataExist&&void 0!==u.currentHeadlineData.score){var D=u.currentHeadlineData.score,A=D<40?"red":D<=60?"orange":"green";k.parentNode.setAttribute("exactmetrics-button-color",A),k.nextElementSibling?k.nextElementSibling.innerHTML=D+"/100":(j.innerHTML=D+"/100",k.parentNode.insertBefore(j,k.nextSibling))}else k.parentNode.setAttribute("exactmetrics-button-color","red"),k.nextElementSibling?k.nextElementSibling.innerHTML="00/100":(j.innerHTML="00/100",k.parentNode.insertBefore(j,k.nextSibling))}if(P){var L=P.parentNode.querySelectorAll(".components-panel__header");L&&L.forEach(function(e){var t=e.querySelector('[aria-pressed="true"]');t&&null!==t&&t.remove()})}var B=function(e){E(a()({},u,e))};return _(function(){var e=new FormData;e.append("_ajax_nonce",exactmetrics_gutenberg_tool_vars.nonce),e.append("action","exactmetrics_gutenberg_headline_analyzer_get_results"),e.append("dataType","json"),e.append("q",t),d.a.post(exactmetrics_gutenberg_tool_vars.ajaxurl,e).then(function(e){var t={dataExist:!1};e.data.data.analysed&&(t.currentHeadlineData=e.data.data,t.headlineData=e.data.data,t.dataExist=!0,void 0!==u.headlineData&&(t.previousHeadlinesData=[u.headlineData].concat(i()(O)))),E(a()({},u,t))}).catch(function(e){var t={dataExist:!1};E(a()({},u,t)),console.log(e)})},[t]),wp.element.createElement(C,null,wp.element.createElement(M,{target:"exactmetrics-headline-analyzer"},n),wp.element.createElement(T,{name:"exactmetrics-headline-analyzer",title:n,className:"exactmetrics-headline-analyzer-wrapper",icon:c.a.headline},void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(p.a,{analyzer:u,setAnalyzer:B}):wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-empty-title-warning"},r),void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed&&O.length>0?wp.element.createElement(h.a,{analyzer:u,setAnalyzer:B}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(m.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(f.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(g.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(w.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(y.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(v.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(b.a,{data:u.headlineData}):"",wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-bottom-notice"},wp.element.createElement("p",{dangerouslySetInnerHTML:{__html:F}}))))};"undefined"!=typeof exactmetrics_gutenberg_tool_vars&&exactmetrics_gutenberg_tool_vars.allowed_post_types.includes(exactmetrics_gutenberg_tool_vars.current_post_type)&&exactmetrics_gutenberg_tool_vars.is_headline_analyzer_enabled&&k("exactmetrics-headline-analyzer",{icon:c.a.headlineBlack,render:F})},function(e,t,n){e.exports={default:n(83),__esModule:!0}},function(e,t,n){n(19),n(91),e.exports=n(0).Array.from},function(e,t,n){var r=n(27),i=n(28);e.exports=function(e){return function(t,n){var o,a,l=String(i(t)),s=r(n),c=l.length;return s<0||s>=c?e?"":void 0:(o=l.charCodeAt(s),o<55296||o>56319||s+1===c||(a=l.charCodeAt(s+1))<56320||a>57343?e?l.charAt(s):o:e?l.slice(s,s+2):a-56320+(o-55296<<10)+65536)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";var r=n(31),i=n(15),o=n(36),a={};n(10)(a,n(2)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(6),i=n(8),o=n(21);e.exports=n(7)?Object.defineProperties:function(e,t){i(e);for(var n,a=o(t),l=a.length,s=0;l>s;)r.f(e,n=a[s++],t[n]);return e}},function(e,t,n){var r=n(14),i=n(51),o=n(89);e.exports=function(e){return function(t,n,a){var l,s=r(t),c=i(s.length),u=o(a,c);if(e&&n!=n){for(;c>u;)if((l=s[u++])!=l)return!0}else for(;c>u;u++)if((e||u in s)&&s[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(27),i=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):o(e,t)}},function(e,t,n){var r=n(5).document;e.exports=r&&r.documentElement},function(e,t,n){"use strict";var r=n(29),i=n(4),o=n(16),a=n(92),l=n(93),s=n(51),c=n(94),u=n(53);i(i.S+i.F*!n(95)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,i,d,p=o(e),h="function"==typeof this?this:Array,m=arguments.length,f=m>1?arguments[1]:void 0,g=void 0!==f,w=0,y=u(p);if(g&&(f=r(f,m>2?arguments[2]:void 0,2)),void 0==y||h==Array&&l(y))for(t=s(p.length),n=new h(t);t>w;w++)c(n,w,g?f(p[w],w):p[w]);else for(d=y.call(p),n=new h;!(i=d.next()).done;w++)c(n,w,g?a(d,f,[i.value,w],!0):i.value);return n.length=w,n}})},function(e,t,n){var r=n(8);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){var r=n(13),i=n(2)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},function(e,t,n){"use strict";var r=n(6),i=n(15);e.exports=function(e,t,n){t in e?r.f(e,t,i(0,n)):e[t]=n}},function(e,t,n){var r=n(2)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},e(o)}catch(e){}return n}},function(e,t,n){e.exports={default:n(97),__esModule:!0}},function(e,t,n){n(98),e.exports=n(0).Object.assign},function(e,t,n){var r=n(4);r(r.S+r.F,"Object",{assign:n(99)})},function(e,t,n){"use strict";var r=n(7),i=n(21),o=n(37),a=n(24),l=n(16),s=n(50),c=Object.assign;e.exports=!c||n(12)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=r})?function(e,t){for(var n=l(e),c=arguments.length,u=1,d=o.f,p=a.f;c>u;)for(var h,m=s(arguments[u++]),f=d?i(m).concat(d(m)):i(m),g=f.length,w=0;g>w;)h=f[w++],r&&!p.call(m,h)||(n[h]=m[h]);return n}:c},function(e,t,n){e.exports={default:n(101),__esModule:!0}},function(e,t,n){n(38),n(19),e.exports=n(105)},function(e,t,n){"use strict";var r=n(103),i=n(104),o=n(13),a=n(14);e.exports=n(45)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(54),i=n(2)("iterator"),o=n(13);e.exports=n(0).isIterable=function(e){var t=Object(e);return void 0!==t[i]||"@@iterator"in t||o.hasOwnProperty(r(t))}},function(e,t,n){e.exports={default:n(107),__esModule:!0}},function(e,t,n){n(38),n(19),e.exports=n(108)},function(e,t,n){var r=n(8),i=n(53);e.exports=n(0).getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){"use strict";function r(e){var t=new a(e),n=o(a.prototype.request,t);return i.extend(n,a.prototype,t),i.extend(n,t),n}var i=n(1),o=n(57),a=n(110),l=n(63),s=n(60),c=r(s);c.Axios=a,c.create=function(e){return r(l(c.defaults,e))},c.Cancel=n(64),c.CancelToken=n(124),c.isCancel=n(59),c.all=function(e){return Promise.all(e)},c.spread=n(125),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new a,response:new a}}var i=n(1),o=n(58),a=n(111),l=n(112),s=n(63);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=s(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[l,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(){this.handlers=[]}var i=n(1);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){i.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var i=n(1),o=n(113),a=n(59),l=n(60);e.exports=function(e){return r(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||l.adapter)(e).then(function(t){return r(e),t.data=o(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(r(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function o(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){f&&h&&(f=!1,h.length?m=h.concat(m):g=-1,m.length&&l())}function l(){if(!f){var e=i(a);f=!0;for(var t=m.length;t;){for(h=m,m=[];++g<t;)h&&h[g].run();g=-1,t=m.length}h=null,f=!1,o(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var u,d,p=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(e){u=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var h,m=[],f=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new s(e,t)),1!==m.length||f||i(l)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(62);e.exports=function(e,t,n){var i=n.config.validateStatus;!i||i(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(119),i=n(120);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(1),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,a={};return e?(r.forEach(e.split("\n"),function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}}),a):a}},function(e,t,n){"use strict";var r=n(1);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(i.setAttribute("href",t),t=i.href),i.setAttribute("href",t),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");return t=e(window.location.href),function(n){var i=r.isString(n)?e(n):n;return i.protocol===t.protocol&&i.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(1);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,i,o,a){var l=[];l.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),r.isString(i)&&l.push("path="+i),r.isString(o)&&l.push("domain="+o),!0===a&&l.push("secure"),document.cookie=l.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new i(e),t(n.reason))})}var i=n(64);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(55),i=n.n(r),o=n(3),a=n.n(o),l=n(127),s=n(128),c=n(129),u=wp.i18n.__,d=wp.element,p=d.Fragment,h=d.useState,m=d.useEffect,f=function(e){var t=u("Current Score","google-analytics-dashboard-for-wp"),n=u("Try New Headline","google-analytics-dashboard-for-wp"),r=h("current-score"),o=i()(r,2),d=o[0],f=o[1],g=function(){return f("current-score")},w=function(){return f("new-headline")},y=void 0!==e.analyzer.isNewData&&e.analyzer.isNewData;return m(function(){e.setAnalyzer({activeTab:d})},[d]),wp.element.createElement(p,null,wp.element.createElement("div",{className:"exactmetrics-inline-buttons"},wp.element.createElement("button",{onClick:g,className:a()("exactmetrics-switcher-button",{active:"current-score"===d})},t),wp.element.createElement("button",{onClick:w,className:a()("exactmetrics-switcher-button",{active:"new-headline"===d})},n)),"new-headline"===d?wp.element.createElement(s.a,{analyzer:e.analyzer,setAnalyzer:e.setAnalyzer}):wp.element.createElement(l.a,{analyzer:e.analyzer}),y?wp.element.createElement(c.a,{analyzer:e.analyzer}):"")};t.a=f},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=n(25),a=wp.i18n.__,l=wp.element.Fragment,s=wp.components,c=s.PanelBody,u=s.PanelRow,d=function(e){var t=e.analyzer.currentHeadlineData.sentence,n=a("Score","google-analytics-dashboard-for-wp"),r=a("A good score is between 40 and 60. For best results, you should strive for 70 and above.","google-analytics-dashboard-for-wp"),s=e.analyzer.currentHeadlineData.score,d=s<40?"red":s<=60?"orange":"green",p="red"===d?"#EB5757":"orange"===d?"#F2994A":"#1EC185";return wp.element.createElement(l,null,wp.element.createElement(c,{title:n},wp.element.createElement(u,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-current-score-tab"},wp.element.createElement("h4",{className:"exactmetrics-headline-analyzer-current-title"},"“",t,"”"),wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-current-score",d)},s),wp.element.createElement(o.a,{barScore:s,barColor:p})),wp.element.createElement("p",null,r)))))};t.a=d},function(e,t,n){"use strict";var r=n(44),i=n.n(r),o=n(56),a=n.n(o),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=c.TextControl,h=c.Button,m=function(e){var t=l("Try New Headline","google-analytics-dashboard-for-wp"),n=l("Enter a different headline than your post title to see how it compares.","google-analytics-dashboard-for-wp"),r=l("Analyze","google-analytics-dashboard-for-wp"),o=void 0!==e.analyzer.newHeadline?e.analyzer.newHeadline:"",c=void 0!==e.analyzer.previousHeadlinesData?e.analyzer.previousHeadlinesData:[],m=!o,f=function(t){var n=t.trim();if(n){var r=new FormData;r.append("_ajax_nonce",exactmetrics_gutenberg_tool_vars.nonce),r.append("action","exactmetrics_gutenberg_headline_analyzer_get_results"),r.append("dataType","json"),r.append("q",n),a.a.post(exactmetrics_gutenberg_tool_vars.ajaxurl,r).then(function(t){e.setAnalyzer({newHeadlineData:t.data.data,headlineData:t.data.data,previousHeadlinesData:[e.analyzer.headlineData].concat(i()(c)),isNewData:!0})}).catch(function(t){e.setAnalyzer({isNewData:!1}),console.log(t)})}};return wp.element.createElement(s,null,wp.element.createElement(u,{title:t},wp.element.createElement(d,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-new-tab"},wp.element.createElement("form",{onSubmit:function(e){e.preventDefault(),f(o)}},wp.element.createElement(p,{label:n,value:o,onChange:function(t){" "!==t&&e.setAnalyzer({newHeadline:t})},className:"exactmetrics-headline-analyzer-input-field"}),wp.element.createElement(h,{className:"exactmetrics-headline-analyzer-button",isPrimary:!0,onClick:function(){f(o)},disabled:m},r))))))};t.a=m},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=n(25),a=wp.i18n.__,l=wp.element.Fragment,s=wp.components,c=s.PanelBody,u=s.PanelRow,d=function(e){var t=e.analyzer.currentHeadlineData.sentence,n=a("New Score","google-analytics-dashboard-for-wp"),r=a("A good score is between 40 and 60. For best results, you should strive for 70 and above.","google-analytics-dashboard-for-wp"),s=a("Current Score","google-analytics-dashboard-for-wp"),d=void 0!==e.analyzer.newHeadlineData?e.analyzer.newHeadlineData.sentence:"",p=void 0!==e.analyzer.newHeadlineData?e.analyzer.newHeadlineData.score:"",h=void 0!==e.analyzer.currentHeadlineData.score?e.analyzer.currentHeadlineData.score:"",m=p<40?"red":p<=60?"orange":"green",f="red"===m?"#EB5757":"orange"===m?"#F2994A":"#1EC185",g=h<40?"red-bg":h<=60?"orange-bg":"green-bg",w=Math.abs(p-h);return wp.element.createElement(l,null,wp.element.createElement(c,{title:n},wp.element.createElement(u,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-new-score-panel"},wp.element.createElement("p",null,r),wp.element.createElement("h4",null,"“",d,"”"),wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-new-score",m)},p),wp.element.createElement(o.a,{barScore:p,barColor:f})),wp.element.createElement("div",{className:"current-score"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-score-difference",m)},p>h?"+ ":p===h?"":"- ",w),wp.element.createElement("h5",null,s),wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-score",g)},h),wp.element.createElement("p",null,"“",t,"”"))))))};t.a=d},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=wp.i18n.__,a=wp.element.Fragment,l=wp.components,s=l.PanelBody,c=l.PanelRow,u=function(e){var t=o("Previous Scores","google-analytics-dashboard-for-wp"),n="undefined"!==e.analyzer.previousHeadlinesData?e.analyzer.previousHeadlinesData:[],r=document.querySelector(".edit-post-sidebar"),l="undefined"!==e.analyzer.activeTab?e.analyzer.activeTab:"current-score",u="current-score"===l?390:300,d=function(t){e.setAnalyzer({newHeadlineData:n[t],headlineData:n[t],newHeadline:n[t].sentence,isNewData:!0}),r&&(r.scrollTop=u)};return wp.element.createElement(a,null,wp.element.createElement(s,{title:t},wp.element.createElement(c,null,wp.element.createElement("ul",{className:"exactmetrics-headline-analyzer-previous-scores"},n.map(function(e,t){if(t<10&&(void 0!==e.sentence||void 0!==e.score)){var n=e.score<40?"red-bg":e.score<=60?"orange-bg":"green-bg";return wp.element.createElement("li",{key:t,onClick:function(){return d(t)}},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-score",n)},e.score),e.sentence)}})))))};t.a=u},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=n(132),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=function(e){var t=l("Word Balance","google-analytics-dashboard-for-wp"),n=l("Compare the percentages of your results to the goal for each category and adjust as necessary.","google-analytics-dashboard-for-wp"),i=e.data.score<40?"red":e.data.score<=60?"orange":"green",c=(e.data.score<40||e.data.score,0===e.data.result.common_words_per?"red":e.data.result.common_words_per<.2?"orange":"green"),p=0===e.data.result.common_words_per?"red-bg":e.data.result.common_words_per<.2?"orange-bg":"green-bg",h=l("Your headline would be more likely to get clicks if it had more uncommon words.","google-analytics-dashboard-for-wp"),m=e.data.result.common_words_per<.2?h:l("Headlines with 20-30% common words are more likely to get clicks.","google-analytics-dashboard-for-wp"),f=0===e.data.result.uncommon_words_per?"red":e.data.result.uncommon_words_per<.1?"orange":"green",g=0===e.data.result.uncommon_words_per?"red-bg":e.data.result.uncommon_words_per<.1?"orange-bg":"green-bg",w=e.data.result.uncommon_words_per<.1?h:l("Headlines with uncommon words are more likely to get clicks.","google-analytics-dashboard-for-wp"),y=0===e.data.result.emotion_words_per?"red":e.data.result.emotion_words_per<.1?"orange":"green",v=0===e.data.result.emotion_words_per?"red-bg":e.data.result.emotion_words_per<.1?"orange-bg":"green-bg",b=l("Emotionally triggered headlines are likely to drive more clicks.","google-analytics-dashboard-for-wp"),S=0===e.data.result.power_words.length?"orange":"green",E=0===e.data.result.power_words.length?"orange":"green-bg",C=l("Headlines with Power Words are more likely to get clicks.","google-analytics-dashboard-for-wp"),x=l("Common Words","google-analytics-dashboard-for-wp"),_=l("20-30%","google-analytics-dashboard-for-wp"),k=l("Uncommon Words","google-analytics-dashboard-for-wp"),O=l("10-20%","google-analytics-dashboard-for-wp"),T=l("Emotional Words","google-analytics-dashboard-for-wp"),M=l("10-15%","google-analytics-dashboard-for-wp"),N=l("Power Words","google-analytics-dashboard-for-wp"),F=l("At least one","google-analytics-dashboard-for-wp");return wp.element.createElement(s,null,wp.element.createElement(u,{title:t,className:o()("exactmetrics-headline-analyzer-panel-word-balance","exactmetrics-headline-analyzer-panel-has-icon",i),icon:"green"===i?r.a.check:r.a.warning},wp.element.createElement(d,null,wp.element.createElement("h4",null,e.data.result.word_balance),wp.element.createElement("p",null,n),wp.element.createElement(a.a,{title:x,value:Math.round(100*e.data.result.common_words_per),goalValue:_,words:e.data.result.common_words,guideLine:m,classOnScore:c,classOnScoreBg:p}),wp.element.createElement(a.a,{title:k,value:Math.round(100*e.data.result.uncommon_words_per),goalValue:O,words:e.data.result.uncommon_words,guideLine:w,classOnScore:f,classOnScoreBg:g}),wp.element.createElement(a.a,{title:T,value:Math.round(100*e.data.result.emotion_words_per),goalValue:M,words:e.data.result.emotion_words,guideLine:b,classOnScore:y,classOnScoreBg:v}),wp.element.createElement(a.a,{title:N,value:Math.round(100*e.data.result.power_words_per),goalValue:F,words:e.data.result.power_words,guideLine:C,classOnScore:S,classOnScoreBg:E}))))};t.a=p},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=wp.i18n.__,a=function(e){var t=o("Goal: ","google-analytics-dashboard-for-wp"),n={width:e.value+"%"};return wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words-block"},wp.element.createElement("h5",null,e.title),wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words-block-data"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-words-block-percentage",e.classOnScore)},e.value,"%"),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-words-block-goal"},wp.element.createElement("strong",null,t),e.goalValue),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-words-block-progressbar"},wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-progressbar-bg"}),wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-progressbar-part",e.classOnScoreBg),style:n}))),wp.element.createElement("ul",{className:"exactmetrics-headline-analyzer-words-tag-list"},e.words.length>0?e.words.map(function(e,t){return wp.element.createElement("li",{key:t},e)}):""),wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-words-guideline"},e.guideLine))};t.a=a},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=wp.i18n.__,l=wp.element.Fragment,s=wp.components,c=s.PanelBody,u=s.PanelRow,d=function(e){var t=a("Your headline has a neutral sentiment.","google-analytics-dashboard-for-wp"),n=a("Headlines that are strongly positive or negative tend to get more engagement then neutral ones.","google-analytics-dashboard-for-wp"),i=a("Your headline has a positive sentiment.","google-analytics-dashboard-for-wp"),s=a("Positive headlines tend to get better engagement than neutral or negative ones.","google-analytics-dashboard-for-wp"),d=a("Your headline has a negative sentiment.","google-analytics-dashboard-for-wp"),p=a("Negative headlines are attention-grabbing and tend to perform better than neutral ones.","google-analytics-dashboard-for-wp"),h=a("Sentiment","google-analytics-dashboard-for-wp"),m="neu"===e.data.result.sentiment?a("Neutral","google-analytics-dashboard-for-wp"):"pos"===e.data.result.sentiment?a("Positive","google-analytics-dashboard-for-wp"):a("Negative","google-analytics-dashboard-for-wp"),f="neu"===e.data.result.sentiment?r.a.neutral:"pos"===e.data.result.sentiment?r.a.smile:r.a.negative,g="neu"===e.data.result.sentiment?"orange":"pos"===e.data.result.sentiment?"green":"red";return wp.element.createElement(l,null,wp.element.createElement(c,{title:h,className:o()("exactmetrics-headline-analyzer-panel-sentiment","exactmetrics-headline-analyzer-panel-has-icon",g),icon:f},wp.element.createElement(u,null,wp.element.createElement("h4",null,m),"neu"===e.data.result.sentiment?wp.element.createElement("p",null,t," ",wp.element.createElement("br",null),wp.element.createElement("br",null)," ",n):"","pos"===e.data.result.sentiment?wp.element.createElement("p",null,i," ",wp.element.createElement("br",null),wp.element.createElement("br",null)," ",s):"","neg"===e.data.result.sentiment?wp.element.createElement("p",null,d," ",wp.element.createElement("br",null),wp.element.createElement("br",null)," ",p):"")))};t.a=d},function(e,t,n){"use strict";var r=wp.i18n,i=r.__,o=r.sprintf,a=wp.element.Fragment,l=wp.components,s=l.PanelBody,c=l.PanelRow,u=function(e){var t=e.data.result.headline_types.join(", "),n=i("Headline Type","google-analytics-dashboard-for-wp"),r=wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-panel-types-title"},n,wp.element.createElement("span",null,t)),l=o(i("Headlines that are lists and how-to get more engagement on average than other types of headlines. %1sRead more about %2sdifferent types of headlines here.%3s","google-analytics-dashboard-for-wp"),"<br/><br/>",'<a href="https://optinmonster.com/why-these-21-headlines-went-viral-and-how-you-can-copy-their-success/" target="_blank" className="exactmetrics-headline-analyzer-link">',"</a>");return wp.element.createElement(a,null,wp.element.createElement(s,{title:r,className:"exactmetrics-headline-analyzer-panel-types"},wp.element.createElement(c,null,wp.element.createElement("h4",null,t),wp.element.createElement("p",{dangerouslySetInnerHTML:{__html:l}}))))};t.a=u},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=n(25),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=function(e){var t=l("Character Count","google-analytics-dashboard-for-wp"),n=e.data.result.length,i=n>=66?100:Math.round(1.51*n),c="",p="",h="#1EC185",m="";return n<=19?(c="red",h="#EB5757"):n>=20&&n<=34?(c="orange",h="#F2994A"):n>=35&&n<=66?(c="green",h="#1EC185"):n>=67&&n<=79?(c="orange",h="#F2994A"):n>=80&&(c="red",h="#EB5757"),n<=34?(p=l("Too Short","google-analytics-dashboard-for-wp"),m=l("You have space to add more keywords and power words to boost your rankings and click-through rate.","google-analytics-dashboard-for-wp")):n>=35&&n<=66?(p=l("Good","google-analytics-dashboard-for-wp"),m=l("Headlines that are about 55 characters long will display fully in search results and tend to get more clicks.","google-analytics-dashboard-for-wp")):n>=67&&(p=l("Too Long","google-analytics-dashboard-for-wp"),m=l("At this length, it will get cut off in search results. Try reducing it to about 55 characters.","google-analytics-dashboard-for-wp")),wp.element.createElement(s,null,wp.element.createElement(u,{title:t,className:o()("exactmetrics-headline-analyzer-panel-character-count","exactmetrics-headline-analyzer-panel-has-icon",c),icon:"green"===c?r.a.check:r.a.warning},wp.element.createElement(d,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:o()("exactmetrics-headline-analyzer-character-length",c)},n),wp.element.createElement(a.a,{barScore:i,barColor:h}),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-status-on-character-length"},p)),wp.element.createElement("p",null,m))))};t.a=p},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=n(25),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=function(e){var t=l("Word Count","google-analytics-dashboard-for-wp"),n=e.data.result.word_count,i=n>=10?100:Math.round(10*n),c="",p="",h="#1EC185",m="";return n<=4?(c="red",h="#EB5757",p=l("Not Enough Words","google-analytics-dashboard-for-wp"),m=l("Your headline doesn’t use enough words. You have more space to add keywords and power words to improve your SEO and get more engagement.","google-analytics-dashboard-for-wp")):n>=5&&n<=9?(c="green",h="#1EC185",p=l("Good","google-analytics-dashboard-for-wp"),m=l("Your headline has the right amount of words. Headlines are more likely to be clicked on in search results if they have about 6 words.","google-analytics-dashboard-for-wp")):n>=10&&n<=11?(c="orange",h="#F2994A",p=l("Reduce Word Count","google-analytics-dashboard-for-wp")):(c="red",h="#EB5757",p=l("Too Many Words","google-analytics-dashboard-for-wp"),m=l("Your headline has too many words. Long headlines will get cut off in search results and won’t get as many clicks.","google-analytics-dashboard-for-wp")),wp.element.createElement(s,null,wp.element.createElement(u,{title:t,className:o()("exactmetrics-headline-analyzer-panel-word-count","exactmetrics-headline-analyzer-panel-has-icon",c),icon:"green"===c?r.a.check:r.a.warning},wp.element.createElement(d,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:o()("exactmetrics-headline-analyzer-word-length",c)},n),wp.element.createElement(a.a,{barScore:i,barColor:h}),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-status-on-word-length"},p)),wp.element.createElement("p",null,m))))};t.a=p},function(e,t,n){"use strict";var r=wp.i18n.__,i=wp.element.Fragment,o=wp.components,a=o.PanelBody,l=o.PanelRow,s=function(e){var t=r("Beginning & Ending Words","google-analytics-dashboard-for-wp"),n=e.data.result.input_array_orig,o=r("Most readers only look at the first and last 3 words of a headline before deciding whether to click.","google-analytics-dashboard-for-wp"),s="",c="";return n.length>=6?(s=n.slice(0,3).join(" "),c=n.slice(-3).join(" ")):n.length>3&&n.length<=5?(s=n.slice(0,3).join(" "),c=n.slice(3).join(" ")):s=n.slice(0,3).join(" "),wp.element.createElement(i,null,wp.element.createElement(a,{title:t,className:"exactmetrics-headline-analyzer-panel-beginning-ending-words"},wp.element.createElement(l,null,s?wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words beginning"},wp.element.createElement("span",null,s)):"",c?wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words ending"},wp.element.createElement("span",null,c)):"",wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-words-guideline"},o))))};t.a=s},function(e,t,n){"use strict";var r=n(23),i=n.n(r),o=wp.i18n.__,a=wp.element.Fragment,l=wp.components,s=l.PanelBody,c=l.PanelRow,u=wp.data.select,d=function(e){var t=o("Search Preview","google-analytics-dashboard-for-wp"),n=o("Here is how your headline will look like in google search results page.","google-analytics-dashboard-for-wp"),r=u("core/editor").getPermalink(),l={href:r};return wp.element.createElement(a,null,wp.element.createElement(s,{title:t,className:"exactmetrics-headline-analyzer-panel-search-preview"},wp.element.createElement(c,null,wp.element.createElement("h4",null,e.data.sentence),wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-post-url"},wp.element.createElement("a",i()({},l,{target:"_blank"}),r)),wp.element.createElement("p",null,n))))};t.a=d},function(e,t,n){"use strict";n(140),n(149)},function(e,t,n){"use strict";var r=n(65),i=n.n(r),o=n(67),a=n.n(o),l=n(23),s=n.n(l),c=n(145),u=n(68),d=wp.i18n.__,p=wp.blocks.registerBlockType,h=wp,m=h.apiFetch,f=wp.data,g=f.registerStore,w=f.withSelect,y=wp.blockEditor.InspectorControls,v=wp.components,b=v.PanelBody,S=v.PanelRow,E=v.TextControl,C=v.ColorPalette,x=window.exactmetrics_gutenberg_tool_vars,_={setThemes:function(e){return{type:"SET_THEMES",themes:e}},receiveThemes:function(e){return{type:"RECEIVE_THEMES",path:e}}};g("exactmetrics/v1/popular-posts/inline",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{themes:{}},t=arguments[1];switch(t.type){case"SET_THEMES":return s()({},e,{themes:t.themes})}return e},actions:_,selectors:{receiveThemes:function(e){return e.themes}},controls:{RECEIVE_THEMES:function(e){return m({path:e.path})}},resolvers:{receiveThemes:a.a.mark(function e(t){var n,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.receiveThemes("/exactmetrics/v1/popular-posts/themes/inline");case 2:if(n=e.sent,void 0===n.themes){e.next=6;break}for(r in n.themes)n.themes.hasOwnProperty(r)&&(n.themes[r].value=r);return e.abrupt("return",_.setThemes(n));case 6:case"end":return e.stop()}},e,this)})}}),p("exactmetrics/popular-posts-inline",{title:d("Inline Popular Posts","google-analytics-dashboard-for-wp"),description:d("Add inline popular posts from ExactMetrics","google-analytics-dashboard-for-wp"),category:"widgets",icon:c.a.inlinepop,keywords:[d("Popular","google-analytics-dashboard-for-wp"),d("Posts","google-analytics-dashboard-for-wp"),d("Inline","google-analytics-dashboard-for-wp"),"ExactMetrics"],example:{},attributes:{theme:{type:"string"},title_size:{type:"number"},title_color:{type:"string"},label_color:{type:"string"},label_text:{type:"string"},label_background:{type:"string"},background_color:{type:"string"},background_border:{type:"string"},icon_background:{type:"string"},icon_color:{type:"string"},border_color:{type:"string"},border_color2:{type:"string"}},edit:w(function(e){return{themes:e("exactmetrics/v1/popular-posts/inline").receiveThemes()}})(function(e){var t=e.attributes,n=t.theme,r=(t.title_size,t.title_color,t.label_color,t.label_text,t.label_background,t.background_color,t.background_border,t.icon_background,t.icon_color,t.border_color,t.border_color2,e.themes),o=e.setAttributes,a=[{name:"pink",color:"#F58EA8"},{name:"red",color:"#CD3034"},{name:"orange",color:"#FD6A21"},{name:"yellow",color:"#FBB82B"},{name:"green",color:"#7FDBB6"},{name:"green",color:"#21CF86"},{name:"blue",color:"#91D2FA"},{name:"blue",color:"#1B95E0"},{name:"purple",color:"#9A57DD"},{name:"gray",color:"#EEEEEE"},{name:"gray",color:"#ACB8C3"},{name:"black",color:"#000000"}],l=void 0!==r.themes?r.themes:{},s=void 0===e.attributes.theme?r.selected:n,p=void 0!==s&&void 0!==l[s]?l[s]:{},h=void 0!==p.styles?p.styles:{},m={};for(var f in h)if(h.hasOwnProperty(f))for(var g in h[f])if(h[f].hasOwnProperty(g)){var w=f+"_"+g;void 0===e.attributes[w]?m[w]=h[f][g]:m[w]=e.attributes[w]}var v=function(e,t){var n=m[t];return wp.element.createElement(E,{key:"exactmetrics-popular-posts-input"+t,label:e,type:"number",value:parseInt(n),min:1,max:100,onChange:function(e){return o(i()({},t,""===e?"":parseInt(e)))}})},_=function(e,t){var n=m[t];return wp.element.createElement(E,{key:"exactmetrics-popular-posts-input"+t,label:e,type:"text",value:n,onChange:function(e){return o(i()({},t,e))}})},k=function(e,t){var n=m[t];return[wp.element.createElement("label",{key:"exactmetrics-popular-posts-label"+t},e),wp.element.createElement(C,{key:"exactmetrics-popular-posts-input"+t,value:n,colors:a,onChange:function(e){o(i()({},t,e))}})]};return[wp.element.createElement(y,{key:"exactmetrics-popular-posts-inline-inspector-controls"},wp.element.createElement(b,{title:d("Theme","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-theme"},wp.element.createElement(S,{key:"exactmetrics-popular-posts-inline-theme-row"},wp.element.createElement(u.a,{id:"exactmetrics-popular-posts-inline-theme",options:l,selected:s,icons:c.a,onChange:function(e){o({theme:e})}}))),function(){if(void 0!==h.title){var e=[];return void 0!==h.title.size&&e.push(v(d("Title Font Size","google-analytics-dashboard-for-wp"),"title_size")),void 0!==h.title.color&&e.push(k(d("Title Color","google-analytics-dashboard-for-wp"),"title_color")),wp.element.createElement(b,{title:d("Title Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-title"},e)}}(),function(){if(void 0!==h.label){var e=[];return void 0!==h.label.text&&e.push(_(d("Label Text","google-analytics-dashboard-for-wp"),"label_text")),void 0!==h.label.color&&e.push(k(d("Label Color","google-analytics-dashboard-for-wp"),"label_color")),void 0!==h.label.background&&e.push(k(d("Label Background","google-analytics-dashboard-for-wp"),"label_background")),wp.element.createElement(b,{title:d("Label Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-label"}," ",e," ")}}(),function(){var e=[];if(void 0!==h.border&&void 0!==h.border.color&&e.push(k(d("Border Color","google-analytics-dashboard-for-wp"),"border_color")),void 0!==h.border&&void 0!==h.border.color2&&e.push(k(d("Bottom Border Color","google-analytics-dashboard-for-wp"),"border_color2")),void 0!==h.background&&void 0!==h.background.border&&e.push(k(d("Border Color","google-analytics-dashboard-for-wp"),"background_border")),0!==e.length)return wp.element.createElement(b,{title:d("Border Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-border"}," ",e," ")}(),function(){if(void 0!==h.background&&void 0!==h.background.color){var e=[];return void 0!==h.background.color&&e.push(k(d("Background Color","google-analytics-dashboard-for-wp"),"background_color")),wp.element.createElement(b,{title:d("Background Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-background"}," ",e," ")}}(),function(){if(void 0!==h.icon){var e=[];return void 0!==h.icon.color&&e.push(k(d("Icon Color","google-analytics-dashboard-for-wp"),"icon_color")),void 0!==h.icon.background&&e.push(k(d("Icon Background Color","google-analytics-dashboard-for-wp"),"icon_background")),wp.element.createElement(b,{title:d("Icon Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-icon"}," ",e," ")}}()),wp.element.createElement("div",{key:"exactmetrics-popular-posts-inline-preview"},wp.element.createElement("div",{className:"exactmetrics-inline-popular-posts-widget exactmetrics-inline-popular-posts-"+s,style:{backgroundColor:m.background_color,borderColor:m.background_border}},function(){if(void 0!==p.image&&p.image){var e=void 0!==h.image?h.image:"theme-preview-image.jpg";return wp.element.createElement("div",{className:"exactmetrics-inline-popular-posts-image"},wp.element.createElement("img",{src:x.vue_assets_path+"img/"+e}))}}(),wp.element.createElement("div",{className:"exactmetrics-inline-popular-posts-text"},function(){if(void 0!==h.icon)return wp.element.createElement("span",{className:"exactmetrics-inline-popular-posts-icon",style:{backgroundColor:m.icon_background}},c.a.themeIcon(m.icon_color))}(),function(){if(void 0!==h.label)return wp.element.createElement("span",{style:{color:m.label_color,backgroundColor:m.label_background},className:"exactmetrics-inline-popular-posts-label"},m.label_text)}(),function(){if(void 0!==h.border&&void 0!==h.border.color)return wp.element.createElement("span",{className:"exactmetrics-inline-popular-posts-border",style:{borderColor:m.border_color}})}(),function(){if(void 0!==h.title&&void 0===p.list&&void 0!==h.title.text)return wp.element.createElement("a",{href:"#",className:"exactmetrics-inline-popular-posts-title",style:{color:m.title_color,fontSize:m.title_size+"px"}},h.title.text)}(),function(){if(void 0!==p.list){var e=[];for(var t in p.list)e.push(wp.element.createElement("li",{key:"exactmetrics-popular-posts-preview-list-item-"+t,style:{color:m.title_color,fontSize:m.title_size+"px"}},p.list[t]));return wp.element.createElement("ul",{className:"exactmetrics-inline-popular-posts-list"},e)}}(),function(){if(void 0!==h.border&&void 0!==h.border.color2)return wp.element.createElement("span",{className:"exactmetrics-inline-popular-posts-border-2",style:{borderColor:m.border_color2}})}())))]}),save:function(e){return null}})},function(e,t,n){n(142);var r=n(0).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(4);r(r.S+r.F*!n(7),"Object",{defineProperty:n(6).f})},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(144),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),l=new h(r||[]);return a._invoke=c(e,n,l),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,i,o,a){var l=r(e[n],e,i);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"==typeof c&&y.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(c).then(function(e){s.value=e,o(s)},a)}a(l.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function c(e,t,n){var i=_;return function(o,a){if(i===O)throw new Error("Generator is already running");if(i===T){if("throw"===o)throw a;return f()}for(n.method=o,n.arg=a;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===M)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===_)throw i=T,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=O;var c=r(e,t,n);if("normal"===c.type){if(i=n.done?T:k,c.arg===M)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=T,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return M;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return M}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,M;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,M):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,M)}function d(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(d,this),this.reset(!0)}function m(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:f}}function f(){return{value:g,done:!0}}var g,w=Object.prototype,y=w.hasOwnProperty,v="function"==typeof Symbol?Symbol:{},b=v.iterator||"@@iterator",S=v.asyncIterator||"@@asyncIterator",E=v.toStringTag||"@@toStringTag",C="object"==typeof e,x=t.regeneratorRuntime;if(x)return void(C&&(e.exports=x));x=t.regeneratorRuntime=C?e.exports:{},x.wrap=n;var _="suspendedStart",k="suspendedYield",O="executing",T="completed",M={},N={};N[b]=function(){return this};var F=Object.getPrototypeOf,P=F&&F(F(m([])));P&&P!==w&&y.call(P,b)&&(N=P);var j=a.prototype=i.prototype=Object.create(N);o.prototype=j.constructor=a,a.constructor=o,a[E]=o.displayName="GeneratorFunction",x.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},x.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,E in e||(e[E]="GeneratorFunction")),e.prototype=Object.create(j),e},x.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[S]=function(){return this},x.AsyncIterator=s,x.async=function(e,t,r,i){var o=new s(n(e,t,r,i));return x.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(j),j[E]="Generator",j[b]=function(){return this},j.toString=function(){return"[object Generator]"},x.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},x.values=m,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(p),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),l=y.call(i,"finallyLoc");if(a&&l){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,M):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),M},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),p(n),M}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;p(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:m(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),M}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";var r={};r.inlinepop=wp.element.createElement("svg",{width:"20",height:"16",viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 0H20V2H0V0ZM20 14V16H0V14H20ZM2 4C0.895431 4 0 4.89543 0 6V10C0 11.1046 0.895431 12 2 12H6C7.10457 12 8 11.1046 8 10V6C8 4.89543 7.10457 4 6 4H2ZM10 5H20V7H10V5ZM18 9H10V11H18V9Z",fill:"#555D66"})),r.alpha=wp.element.createElement("svg",{width:"70",height:"38",viewBox:"0 0 70 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"37.8947",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"5.72728",y:"19.8947",width:"58.5455",height:"8.52632",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"5.72728",y:"7.57892",width:"17.1818",height:"8.52632",rx:"3",fill:"#8453F7"})),r.beta=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"31",y:"21",width:"32",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"31",y:"10",width:"18",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"7",y:"10",width:"20",height:"20",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"1.5",y:"1.5",width:"67",height:"37",rx:"1.5",stroke:"#F0EAFE",strokeWidth:"3"})),r.charlie=wp.element.createElement("svg",{width:"70",height:"28",viewBox:"0 0 70 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"16",y:"19",width:"54",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"11",width:"70",height:"3",rx:"1.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{width:"26",height:"7",rx:"3",fill:"#8453F7"}),wp.element.createElement("circle",{cx:"4.5",cy:"23.5",r:"4.5",fill:"#6528F5"})),r.delta=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"8",y:"21",width:"54",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"22",y:"9",width:"18",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("path",{d:"M12.0303 9.5625C12.4613 8.8125 13.5387 8.8125 13.9697 9.5625L17.8483 16.3125C18.2793 17.0625 17.7406 18 16.8787 18H9.12134C8.25942 18 7.72072 17.0625 8.15168 16.3125L12.0303 9.5625Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"1.5",y:"1.5",width:"67",height:"37",rx:"1.5",stroke:"#F0EAFE",strokeWidth:"3"})),r.echo=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"24.8182",y:"16",width:"39.4545",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"5.72728",y:"16",width:"15.2727",height:"9",rx:"3",fill:"#8453F7"})),r.foxtrot=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"26",y:"22",width:"44",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"26",y:"9",width:"28",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{y:"9",width:"22",height:"22",rx:"3",fill:"#8453F7"})),r.golf=wp.element.createElement("svg",{width:"70",height:"29",viewBox:"0 0 70 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"11",width:"70",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"26",width:"70",height:"3",rx:"1.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{width:"21",height:"7",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"25",y:"1",width:"45",height:"3",rx:"1.5",fill:"#D1BFFC"})),r.hotel=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"22",y:"16",width:"40",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("path",{d:"M12.0303 16.5625C12.4613 15.8125 13.5387 15.8125 13.9697 16.5625L17.8483 23.3125C18.2793 24.0625 17.7406 25 16.8787 25H9.12134C8.25942 25 7.72072 24.0625 8.15168 23.3125L12.0303 16.5625Z",fill:"#8453F7"})),r.india=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("g",{clipPath:"url(#clip0)"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"26",y:"16",width:"36",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"16",width:"14",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"41",width:"41",height:"4",transform:"rotate(-90 0 41)",fill:"#8453F7"})),wp.element.createElement("defs",null,wp.element.createElement("clipPath",{id:"clip0"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"white"})))),r.juliett=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"30",y:"20",width:"32",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("path",{d:"M50 14C50 12.3431 51.3431 11 53 11H60C61.1046 11 62 11.8954 62 13V15C62 16.6569 60.6569 18 59 18H53C51.3431 18 50 16.6569 50 15V14Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"30",y:"11",width:"32",height:"4",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"8",y:"11",width:"18",height:"18",rx:"3",fill:"#8453F7"})),r.kilo=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"22",width:"70",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"9",width:"26",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"12.7273",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"25.4545",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"38.1818",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"50.9091",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"63.6364",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"12.7273",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"25.4545",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"38.1818",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"50.9091",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"63.6364",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"})),r.lima=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"6",y:"22",width:"32",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"6",y:"8",width:"20",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"42",y:"9",width:"22",height:"22",rx:"3",fill:"#8453F7"})),r.mike=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"35",y:"15",width:"27",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M28.8438 28H10.1562C9.55729 28 9.04818 27.7934 8.62891 27.3802C8.20964 26.967 8 26.4653 8 25.875V22.3C8 21.0297 9.02974 20 10.3 20H21.7C22.9703 20 24 18.9703 24 17.7V13.3C24 12.0297 25.0297 11 26.3 11H28.8438C29.4427 11 29.9518 11.2066 30.3711 11.6198C30.7904 12.033 31 12.5347 31 13.125V25.875C31 26.4653 30.7904 26.967 30.3711 27.3802C29.9518 27.7934 29.4427 28 28.8438 28ZM10.3 11C9.02974 11 8 12.0297 8 13.3V15.7C8 16.9703 9.02974 18 10.3 18H19.7C20.9703 18 22 16.9703 22 15.7V13.3C22 12.0297 20.9703 11 19.7 11H10.3Z",fill:"#8453F7"})),r.november=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"29",y:"22",width:"33",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"29",y:"9",width:"18",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 28C21.4183 28 25 24.4183 25 20C25 15.5817 21.4183 12 17 12C12.5817 12 9 15.5817 9 20C9 24.4183 12.5817 28 17 28ZM20.544 21.8756L17.5907 16.7081C17.3281 16.2488 16.6719 16.2488 16.4093 16.7081L13.456 21.8756C13.1935 22.3349 13.5217 22.9091 14.0467 22.9091H19.9533C20.4783 22.9091 20.8065 22.3349 20.544 21.8756Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"1.5",y:"1.5",width:"67",height:"37",rx:"1.5",stroke:"#F0EAFE",strokeWidth:"3"})),r.themeIcon=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#EB5757";return wp.element.createElement("svg",{width:"14",height:"19",viewBox:"0 0 14 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M7.875 0.899463C7.875 1.59183 8.0816 2.24711 8.49479 2.8653C8.93229 3.48349 9.44271 4.06458 10.026 4.60859C10.6337 5.15259 11.2292 5.73369 11.8125 6.35188C12.4201 6.97007 12.9306 7.76135 13.3438 8.72572C13.7812 9.66537 14 10.7163 14 11.8785C14 13.832 13.3073 15.5011 11.9219 16.8858C10.5608 18.2953 8.92014 19 7 19C5.07986 19 3.42708 18.2953 2.04167 16.8858C0.680556 15.5011 0 13.832 0 11.8785C0 9.94973 0.668403 8.28062 2.00521 6.87116C2.27257 6.57443 2.58854 6.50024 2.95312 6.64861C3.31771 6.79697 3.5 7.08134 3.5 7.50171V10.6545C3.5 11.3221 3.71875 11.8908 4.15625 12.3607C4.61806 12.8305 5.16493 13.0654 5.79688 13.0654C6.45312 13.0654 7.01215 12.8428 7.47396 12.3978C7.93576 11.9279 8.16667 11.3592 8.16667 10.6916C8.16667 10.2712 8.04514 9.86318 7.80208 9.46754C7.58333 9.0719 7.31597 8.71336 7 8.3919C6.68403 8.07044 6.34375 7.73662 5.97917 7.39043C5.63889 7.04425 5.34722 6.66097 5.10417 6.2406C4.88542 5.82024 4.73958 5.35041 4.66667 4.83114C4.59375 4.31186 4.67882 3.68131 4.92188 2.93948C5.18924 2.17293 5.63889 1.33219 6.27083 0.417277C6.51389 0.0463641 6.84201 -0.0772735 7.25521 0.0463641C7.6684 0.170002 7.875 0.454368 7.875 0.899463Z",fill:e}))},t.a=r},function(e,t,n){"use strict";var r={};r.canaccess=function(e){return"lite"===e},t.a=r},function(e,t,n){"use strict";var r={};r.checkmark=wp.element.createElement("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M21.0565 2.94355C23.0188 4.87903 24 7.23118 24 10C24 12.7688 23.0188 15.1344 21.0565 17.0968C19.121 19.0323 16.7688 20 14 20C11.2312 20 8.86559 19.0323 6.90323 17.0968C4.96774 15.1344 4 12.7688 4 10C4 7.23118 4.96774 4.87903 6.90323 2.94355C8.86559 0.981183 11.2312 0 14 0C16.7688 0 19.121 0.981183 21.0565 2.94355ZM12.8306 15.2823L20.25 7.8629C20.5726 7.5672 20.5726 7.27151 20.25 6.97581L19.3629 6.04839C19.0403 5.75269 18.7312 5.75269 18.4355 6.04839L12.3871 12.0968L9.56452 9.27419C9.26882 8.97849 8.95968 8.97849 8.6371 9.27419L7.75 10.2016C7.42742 10.4973 7.42742 10.793 7.75 11.0887L11.9435 15.2823C12.2392 15.6048 12.5349 15.6048 12.8306 15.2823Z",fill:"#6528f5"})),r.chevronright=wp.element.createElement("svg",{width:"5",height:"8",viewBox:"0 0 5 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M4.84913 3.68807L1.19048 0.12844C1.10247 0.0428134 0.995599 -4.3519e-08 0.869873 -3.80233e-08C0.744146 -3.25276e-08 0.637278 0.0428134 0.549269 0.12844L0.134371 0.53211C0.0463618 0.617737 0.00235741 0.721713 0.00235742 0.844037C-0.0102153 0.966361 0.0275028 1.07034 0.115512 1.15596L3.03866 4L0.115512 6.84404C0.0275031 6.92966 -0.010215 7.03364 0.00235769 7.15596C0.0023577 7.27829 0.0463621 7.38226 0.134371 7.46789L0.549269 7.87156C0.637278 7.95719 0.744146 8 0.869873 8C0.9956 8 1.10247 7.95719 1.19048 7.87156L4.84913 4.31193C4.94971 4.2263 5 4.12232 5 4C5 3.87768 4.94971 3.7737 4.84913 3.68807Z",fill:"#C4C4C4"})),r.chevronleft=wp.element.createElement("svg",{width:"5",height:"8",viewBox:"0 0 5 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M0.150873 3.68807L3.80952 0.12844C3.89753 0.0428134 4.0044 -4.3519e-08 4.13013 -3.80233e-08C4.25585 -3.25276e-08 4.36272 0.0428134 4.45073 0.12844L4.86563 0.53211C4.95364 0.617737 4.99764 0.721713 4.99764 0.844037C5.01022 0.966361 4.9725 1.07034 4.88449 1.15596L1.96134 4L4.88449 6.84404C4.9725 6.92966 5.01021 7.03364 4.99764 7.15596C4.99764 7.27829 4.95364 7.38226 4.86563 7.46789L4.45073 7.87156C4.36272 7.95719 4.25585 8 4.13013 8C4.0044 8 3.89753 7.95719 3.80952 7.87156L0.150873 4.31193C0.0502914 4.2263 2.96645e-07 4.12232 3.01992e-07 4C3.07339e-07 3.87768 0.0502914 3.7737 0.150873 3.68807Z",fill:"#C4C4C4"})),t.a=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function m(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function f(e,t){if(null==e)return{};var n,r,i=m(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?g(e):t}function y(e){return function(){var t,n=d(e);if(h()){var r=d(this).constructor;t=Reflect.construct(n,arguments,r)}else t=n.apply(this,arguments);return w(this,t)}}function v(e){return b(e)||S(e)||E(e)||x()}function b(e){if(Array.isArray(e))return C(e)}function S(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function E(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _(e,t){return t={exports:{}},e(t,t.exports),t.exports}function k(){}function O(){}function T(e){return e.map(function(e){return!1===e?null:e}).join(" ").replace(/\s+/g," ").trim()}function M(e,t){return 100/e*t/t}function N(e,t){return 100*e/t}function F(e){return"".concat(e,"%")}function P(e,t,n){if(e===t)return!0;var r=re[ne(e)],i=re[ne(t)];return!(!r||r!==i)&&r(e,t,n)}function j(e){return function(t,n,r){if(!r)return e(t,n,[]);for(var i,o=r.length;i=r[--o];)if(i[0]===t&&i[1]===n)return!0;return e(t,n,r)}}function D(e,t,n){var r=e.length;if(r!==t.length)return!1;for(n.push([e,t]);r--;)if(!P(e[r],t[r],n))return!1;return!0}function A(e,t,n){if("function"==typeof e.equal)return n.push([e,t]),e.equal(t,n);var r=L(e),i=L(t),o=r.length;if(o!==i.length)return!1;for(r.sort(),i.sort();o--;)if(r[o]!==i[o])return!1;for(n.push([e,t]),o=r.length;o--;){var a=r[o];if(!P(e[a],t[a],n))return!1}return!0}function L(e){var t=[];for(var n in e)"constructor"!==n&&t.push(n);return t}function B(e){return!!e&&"object"==typeof e}function z(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||H(e)}function H(e){return e.$$typeof===le}function R(e){return Array.isArray(e)?[]:{}}function I(e,t){return!1!==t.clone&&t.isMergeableObject(e)?W(R(e),e,t):e}function q(e,t,n){return e.concat(t).map(function(e){return I(e,n)})}function V(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(t){r[t]=I(e[t],n)}),Object.keys(t).forEach(function(i){n.isMergeableObject(t[i])&&e[i]?r[i]=W(e[i],t[i],n):r[i]=I(t[i],n)}),r}function W(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||q,n.isMergeableObject=n.isMergeableObject||oe;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):V(e,t,n):I(t,n)}function Z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return{}},n=function(n){function i(e,n){var o;return r(this,i),o=a.call(this,e,n),o.state=t(c({},n.state)),o.updateStateProps=o.updateStateProps.bind(g(o)),o}u(i,n);var a=y(i);return o(i,[{key:"componentDidMount",value:function(){this.context.subscribe(this.updateStateProps)}},{key:"shouldComponentUpdate",value:function(e,t){return!ie(t,this.state)||!ie(e,this.props)}},{key:"componentWillUnmount",value:function(){this.context.unsubscribe(this.updateStateProps)}},{key:"updateStateProps",value:function(){this.setState(t(c({},this.context.state)))}},{key:"render",value:function(){var t=this,n=ue(this.state,this.props);return Y.a.createElement(e,l({ref:function(e){t.instance=e}},n,{carouselStore:{getStoreState:this.context.getStoreState,masterSpinnerError:this.context.masterSpinnerError,masterSpinnerSuccess:this.context.masterSpinnerSuccess,setStoreState:this.context.setStoreState,subscribeMasterSpinner:this.context.subscribeMasterSpinner,unsubscribeAllMasterSpinner:this.context.unsubscribeAllMasterSpinner,unsubscribeMasterSpinner:this.context.unsubscribeMasterSpinner}}),this.props.children)}}]),i}(Y.a.Component);return a(n,"contextType",de),a(n,"propTypes",{children:J.children}),a(n,"defaultProps",{children:null}),n}n.d(t,"a",function(){return Te}),n.d(t,"b",function(){return je}),n.d(t,"c",function(){return fe}),n.d(t,"d",function(){return Ve}),n.d(t,"e",function(){return lt}),n.d(t,"f",function(){return dt});var U=n(39),Y=n.n(U),X="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";O.resetWarningCache=k;var K=function(){function e(e,t,n,r,i,o){if(o!==X){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:O,resetWarningCache:k};return n.PropTypes=n,n},G=_(function(e){e.exports=K()}),$="loading",J={children:G.oneOfType([G.arrayOf(G.node),G.node]),direction:G.oneOf(["forward","backward"]),height:function(e,t){var n=e[t];return"vertical"!==e.orientation||null!==n&&"number"==typeof n?null:new Error("Missing required property '".concat(t,"' when orientation is vertical. You must supply a number representing the height in pixels"))},orientation:G.oneOf(["horizontal","vertical"]),isBgImage:function(e,t){return!0===e[t]&&"img"===e.tag?new Error("HTML img elements should not have a backgroundImage. Please use ".concat(t," for other block-level HTML tags, like div, a, section, etc...")):null}},Q=function(e){var t=e.min,n=e.max,r=e.x;return Math.min(n,Math.max(t,r))},ee={buttonBack:"buttonBack___1mlaL"},te=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,null,[{key:"setDisabled",value:function(e,t,n){return null!==e?e:0===t&&!n}}]),o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.currentSlide,i=t.onClick,o=t.step,a=t.infinite,l=t.visibleSlides,s=t.totalSlides-l,c=Math.max(r-o,0);a&&(c=0===r?s:c),n.setStoreState({currentSlide:c,isPlaying:!1},null!==i&&i.call(this,e))}},{key:"render",value:function(){var e=this.props,n=(e.carouselStore,e.className),r=(e.currentSlide,e.disabled,e.onClick,e.step,e.totalSlides,e.visibleSlides,e.infinite),i=f(e,["carouselStore","className","currentSlide","disabled","onClick","step","totalSlides","visibleSlides","infinite"]),o=T([ee.buttonBack,"carousel__back-button",n]),a=t.setDisabled(this.props.disabled,this.props.currentSlide,r);return Y.a.createElement("button",l({type:"button","aria-label":"previous",className:o,onClick:this.handleOnClick,disabled:a},i),this.props.children)}}]),t}(Y.a.Component);a(te,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,step:G.number.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,infinite:G.bool}),a(te,"defaultProps",{className:null,disabled:null,onClick:null,infinite:!1});var ne=_(function(e,t){var n={}.toString,r="undefined"!=typeof window?window.Node:Function;e.exports=t=function(e){var t=typeof e;if("object"!=t)return t;if("object"==(t=i[n.call(e)]))return e instanceof Map?"map":e instanceof Set?"set":"object";if(t)return t;if(e instanceof r)switch(e.nodeType){case 1:return"element";case 3:return"text-node";case 9:return"document";case 11:return"document-fragment";default:return"dom-node"}};var i=t.types={"[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Arguments]":"arguments","[object Array]":"array","[object Set]":"set","[object String]":"string","[object Null]":"null","[object Undefined]":"undefined","[object Number]":"number","[object Boolean]":"boolean","[object Object]":"object","[object Map]":"map","[object Text]":"text-node","[object Uint8Array]":"bit-array","[object Uint16Array]":"bit-array","[object Uint32Array]":"bit-array","[object Uint8ClampedArray]":"bit-array","[object Error]":"error","[object FormData]":"form-data","[object File]":"file","[object Blob]":"blob"}}),re=(ne.types,{});re.number=function(e,t){return e!==e&&t!==t},re.function=function(e,t,n){return e.toString()===t.toString()&&re.object(e,t,n)&&P(e.prototype,t.prototype)},re.date=function(e,t){return+e==+t},re.regexp=function(e,t){return e.toString()===t.toString()},re.element=function(e,t){return e.outerHTML===t.outerHTML},re.textnode=function(e,t){return e.textContent===t.textContent},re.arguments=re["bit-array"]=re.array=j(D),re.object=j(A);var ie=P,oe=function(e){return B(e)&&!z(e)},ae="function"==typeof Symbol&&Symbol.for,le=ae?Symbol.for("react.element"):60103;W.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return W(e,n,t)},{})};var se,ce,ue=W,de=Y.a.createContext(),pe=function e(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(n){!t.hasOwnProperty(n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||Object.isFrozen(t[n])||e(t[n])}),t},he={masterSpinnerFinished:!1},me=function(){function e(t){r(this,e),this.state=pe(ue(he,t)),this.subscriptions=[],this.masterSpinnerSubscriptions={},this.setStoreState=this.setStoreState.bind(this),this.getStoreState=this.getStoreState.bind(this),this.subscribe=this.subscribe.bind(this),this.unsubscribe=this.unsubscribe.bind(this),this.updateSubscribers=this.updateSubscribers.bind(this),this.subscribeMasterSpinner=this.subscribeMasterSpinner.bind(this),this.unsubscribeMasterSpinner=this.unsubscribeMasterSpinner.bind(this),this.unsubscribeAllMasterSpinner=this.unsubscribeAllMasterSpinner.bind(this),this.masterSpinnerSuccess=this.masterSpinnerSuccess.bind(this),this.masterSpinnerError=this.masterSpinnerError.bind(this)}return o(e,[{key:"setStoreState",value:function(e,t){this.state=pe(ue(this.state,e)),this.updateSubscribers(t)}},{key:"getStoreState",value:function(){return ue({},this.state)}},{key:"subscribe",value:function(e){this.subscriptions.push(e)}},{key:"unsubscribe",value:function(e){var t=this.subscriptions.indexOf(e);-1!==t&&this.subscriptions.splice(t,1)}},{key:"updateSubscribers",value:function(e){this.subscriptions.forEach(function(e){return e()}),"function"==typeof e&&e(this.getStoreState())}},{key:"subscribeMasterSpinner",value:function(e){-1===Object.keys(this.masterSpinnerSubscriptions).indexOf(e)&&(this.masterSpinnerSubscriptions[e]={success:!1,error:!1,complete:!1})}},{key:"unsubscribeMasterSpinner",value:function(e){return-1!==Object.keys(this.masterSpinnerSubscriptions).indexOf(e)&&(this.setMasterSpinnerFinished(),delete this.masterSpinnerSubscriptions[e])}},{key:"unsubscribeAllMasterSpinner",value:function(){this.masterSpinnerSubscriptions={},this.setMasterSpinnerFinished()}},{key:"masterSpinnerSuccess",value:function(e){this.masterSpinnerSubscriptions[e].success=!0,this.masterSpinnerSubscriptions[e].complete=!0,this.setMasterSpinnerFinished()}},{key:"masterSpinnerError",value:function(e){this.masterSpinnerSubscriptions[e].error=!0,this.masterSpinnerSubscriptions[e].complete=!0,this.setMasterSpinnerFinished()}},{key:"setMasterSpinnerFinished",value:function(){this.setStoreState({masterSpinnerFinished:this.isMasterSpinnerFinished()})}},{key:"isMasterSpinnerFinished",value:function(){var e=this;return!Object.keys(this.masterSpinnerSubscriptions).find(function(t){return!0!==e.masterSpinnerSubscriptions[t].complete})}}]),e}(),fe=(ce=se=function(e){function t(e){var i;if(r(this,t),i=n.call(this,e),e.isIntrinsicHeight&&"horizontal"!==e.orientation)throw Error('isIntrinsicHeight can only be used in "horizontal" orientation. See Readme for more information.');var o={currentSlide:e.currentSlide,disableAnimation:e.disableAnimation,disableKeyboard:e.disableKeyboard,hasMasterSpinner:e.hasMasterSpinner,imageErrorCount:0,imageSuccessCount:0,interval:e.interval,isPageScrollLocked:e.isPageScrollLocked,isPlaying:e.isPlaying,lockOnWindowScroll:e.lockOnWindowScroll,masterSpinnerThreshold:0,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,playDirection:e.playDirection,privateUnDisableAnimation:!1,slideSize:M(e.totalSlides,e.visibleSlides),slideTraySize:N(e.totalSlides,e.visibleSlides),step:e.step,dragStep:e.dragStep,totalSlides:e.totalSlides,touchEnabled:e.touchEnabled,dragEnabled:e.dragEnabled,visibleSlides:e.visibleSlides,infinite:e.infinite,isIntrinsicHeight:e.isIntrinsicHeight};return i.carouselStore=new me(o),i}u(t,e);var n=y(t);return o(t,[{key:"componentDidUpdate",value:function(e){var t=this,n={};["currentSlide","disableAnimation","disableKeyboard","hasMasterSpinner","interval","isPlaying","naturalSlideHeight","naturalSlideWidth","lockOnWindowScroll","orientation","playDirection","step","dragStep","totalSlides","touchEnabled","dragEnabled","visibleSlides"].forEach(function(r){e[r]!==t.props[r]&&(n[r]=t.props[r])}),this.props.currentSlide!==e.currentSlide&&!this.props.disableAnimation&&(n.disableAnimation=!0,n.privateUnDisableAnimation=!0),this.props.totalSlides===e.totalSlides&&this.props.visibleSlides===e.visibleSlides||(n.slideSize=M(this.props.totalSlides,this.props.visibleSlides),n.slideTraySize=N(this.props.totalSlides,this.props.visibleSlides)),this.carouselStore.state.currentSlide>=this.props.totalSlides&&(n.currentSlide=Math.max(this.props.totalSlides-1,0)),Object.keys(n).length>0&&this.carouselStore.setStoreState(n)}},{key:"componentWillUnmount",value:function(){this.carouselStore.unsubscribeAllMasterSpinner()}},{key:"getStore",value:function(){return this.carouselStore}},{key:"render",value:function(){var e=this.props,t=(e.children,e.className,e.currentSlide,e.disableAnimation,e.disableKeyboard,e.hasMasterSpinner,e.interval,e.isPageScrollLocked,e.isPlaying,e.lockOnWindowScroll,e.naturalSlideHeight,e.naturalSlideWidth,e.orientation,e.playDirection,e.step,e.dragStep,e.tag),n=(e.totalSlides,e.touchEnabled,e.dragEnabled,e.visibleSlides,e.infinite,e.isIntrinsicHeight,f(e,["children","className","currentSlide","disableAnimation","disableKeyboard","hasMasterSpinner","interval","isPageScrollLocked","isPlaying","lockOnWindowScroll","naturalSlideHeight","naturalSlideWidth","orientation","playDirection","step","dragStep","tag","totalSlides","touchEnabled","dragEnabled","visibleSlides","infinite","isIntrinsicHeight"])),r=T(["carousel",this.props.className]);return Y.a.createElement(t,l({className:r},n),Y.a.createElement(de.Provider,{value:this.carouselStore},this.props.children))}}]),t}(Y.a.Component),a(se,"propTypes",{children:J.children.isRequired,className:G.string,currentSlide:G.number,disableAnimation:G.bool,disableKeyboard:G.bool,hasMasterSpinner:G.bool,interval:G.number,isPageScrollLocked:G.bool,isPlaying:G.bool,lockOnWindowScroll:G.bool,naturalSlideHeight:G.number.isRequired,naturalSlideWidth:G.number.isRequired,orientation:J.orientation,playDirection:J.direction,step:G.number,dragStep:G.number,tag:G.string,totalSlides:G.number.isRequired,touchEnabled:G.bool,dragEnabled:G.bool,visibleSlides:G.number,infinite:G.bool,isIntrinsicHeight:G.bool}),a(se,"defaultProps",{className:null,currentSlide:0,disableAnimation:!1,disableKeyboard:!1,hasMasterSpinner:!1,interval:5e3,isPageScrollLocked:!1,isPlaying:!1,lockOnWindowScroll:!1,orientation:"horizontal",playDirection:"forward",step:1,dragStep:1,tag:"div",touchEnabled:!0,dragEnabled:!0,visibleSlides:1,infinite:!1,isIntrinsicHeight:!1}),ce);de.Consumer;var ge,we,ye,ve,be,Se,Ee,Ce,xe,_e,ke,Oe,Te=Z(te,function(e){return{currentSlide:e.currentSlide,step:e.step,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,infinite:e.infinite}}),Me={buttonFirst:"buttonFirst___2rhFr"},Ne=(we=ge=function(e){function t(){var e;return r(this,t),e=n.call(this),e.handleOnClick=e.handleOnClick.bind(g(e)),e}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.onClick;n.setStoreState({currentSlide:0,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.className),n=e.currentSlide,r=e.disabled,i=(e.onClick,e.totalSlides,f(e,["carouselStore","className","currentSlide","disabled","onClick","totalSlides"])),o=T([Me.buttonFirst,"carousel__first-button",t]),a=null!==r?r:0===n;return Y.a.createElement("button",l({type:"button","aria-label":"first",className:o,onClick:this.handleOnClick,disabled:a},i),this.props.children)}}]),t}(Y.a.Component),a(ge,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,totalSlides:G.number.isRequired}),a(ge,"defaultProps",{className:null,disabled:null,onClick:null}),we),Fe=(Z(Ne,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides}}),{buttonNext:"buttonNext___2mOCa"}),Pe=(ve=ye=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,null,[{key:"setDisabled",value:function(e,t,n,r,i){return null!==e?e:t>=r-n&&!i}}]),o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.currentSlide,r=t.onClick,i=t.step,o=t.carouselStore,a=t.infinite,l=t.totalSlides-t.visibleSlides,s=i+n,c=Math.min(s,l);a&&(c=l===n?0:c),o.setStoreState({currentSlide:c,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,n=(e.carouselStore,e.className),r=e.currentSlide,i=e.disabled,o=(e.onClick,e.step,e.totalSlides),a=e.visibleSlides,s=e.infinite,c=f(e,["carouselStore","className","currentSlide","disabled","onClick","step","totalSlides","visibleSlides","infinite"]),u=T([Fe.buttonNext,"carousel__next-button",n]),d=t.setDisabled(i,r,a,o,s);return Y.a.createElement("button",l({type:"button","aria-label":"next",className:u,onClick:this.handleOnClick,disabled:d},c),this.props.children)}}]),t}(Y.a.PureComponent),a(ye,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,step:G.number.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,infinite:G.bool}),a(ye,"defaultProps",{className:null,disabled:null,onClick:null,infinite:!1}),ve),je=Z(Pe,function(e){return{currentSlide:e.currentSlide,step:e.step,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,infinite:e.infinite}}),De={buttonLast:"buttonLast___2yuh0"},Ae=(Se=be=function(e){function t(){var e;return r(this,t),e=n.call(this),e.handleOnClick=e.handleOnClick.bind(g(e)),e}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.onClick,i=t.totalSlides,o=t.visibleSlides;n.setStoreState({currentSlide:i-o,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.className),n=e.currentSlide,r=e.disabled,i=(e.onClick,e.totalSlides),o=e.visibleSlides,a=f(e,["carouselStore","className","currentSlide","disabled","onClick","totalSlides","visibleSlides"]),s=T([De.buttonLast,"carousel__last-button",t]),c=null!==r?r:n>=i-o;return Y.a.createElement("button",l({type:"button","aria-label":"last",className:s,onClick:this.handleOnClick,disabled:c},a),this.props.children)}}]),t}(Y.a.Component),a(be,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired}),a(be,"defaultProps",{className:null,disabled:null,onClick:null}),Se),Le=(Z(Ae,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),{buttonNext:"buttonNext___3Lm3s"}),Be=(Ce=Ee=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props.onClick;this.props.carouselStore.setStoreState({isPlaying:!this.props.isPlaying},null!==t&&t.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.childrenPaused),n=e.childrenPlaying,r=e.className,i=e.isPlaying,o=(e.onClick,f(e,["carouselStore","children","childrenPaused","childrenPlaying","className","isPlaying","onClick"])),a=T([Le.buttonNext,"carousel__play-button",r]);return Y.a.createElement("button",l({type:"button","aria-label":"play",className:a,onClick:this.handleOnClick},o),i&&n,!i&&t,this.props.children)}}]),t}(Y.a.PureComponent),a(Ee,"propTypes",{carouselStore:G.object.isRequired,children:G.node,childrenPaused:G.node,childrenPlaying:G.node,className:G.string,isPlaying:G.bool.isRequired,onClick:G.func}),a(Ee,"defaultProps",{children:null,childrenPaused:null,childrenPlaying:null,className:null,onClick:null}),Ce),ze=(Z(Be,function(e){return{isPlaying:e.isPlaying}}),{dot:"dot___3c3SI"}),He=(_e=xe=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.onClick,i=t.slide,o=t.totalSlides,a=t.visibleSlides,l=i>=o-a?o-a:i;n.setStoreState({currentSlide:l,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.className),n=e.currentSlide,r=e.disabled,i=(e.onClick,e.selected),o=e.slide,a=(e.totalSlides,e.visibleSlides),s=f(e,["carouselStore","children","className","currentSlide","disabled","onClick","selected","slide","totalSlides","visibleSlides"]),c=o>=n&&o<n+a,u="boolean"==typeof i?i:c,d=!0===c,p="boolean"==typeof r?r:d,h=T([ze.dot,u&&ze.dotSelected,"carousel__dot","carousel__dot--".concat(o),u&&"carousel__dot--selected",t]);return Y.a.createElement("button",l({"aria-label":"slide dot",type:"button",onClick:this.handleOnClick,className:h,disabled:p},s),this.props.children)}}]),t}(Y.a.Component),a(xe,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,selected:G.bool,slide:G.number.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired}),a(xe,"defaultProps",{className:null,disabled:null,onClick:null,selected:null}),_e),Re=Z(He,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),Ie={},qe=(Oe=ke=function(e){function t(){return r(this,t),n.apply(this,arguments)}u(t,e);var n=y(t);return o(t,[{key:"renderDots",value:function(){var e=this.props,t=e.currentSlide,n=e.totalSlides,r=e.visibleSlides,i=e.disableActiveDots,o=e.showAsSelectedForCurrentSlideOnly,a=e.renderDots;if(a){var l=this.props;return l.renderDots,a(f(l,["renderDots"]))}for(var s=[],c=0;c<n;c+=1){var u=c>=t&&c<t+r,d=c===t,p=o?d:u,h=c>=n-r?n-r:c;s.push(Y.a.createElement(Re,{key:c,slide:h,selected:p,disabled:!!i&&p},Y.a.createElement("span",{className:T["carousel__dot-group-dot"]},this.props.dotNumbers&&c+1)))}return s}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children),n=e.className,r=(e.currentSlide,e.dotNumbers,e.totalSlides,e.visibleSlides,e.disableActiveDots,e.showAsSelectedForCurrentSlideOnly,e.renderDots,f(e,["carouselStore","children","className","currentSlide","dotNumbers","totalSlides","visibleSlides","disableActiveDots","showAsSelectedForCurrentSlideOnly","renderDots"])),i=T([Ie.DotGroup,"carousel__dot-group",n]);return Y.a.createElement("div",l({className:i},r),this.renderDots(),t)}}]),t}(Y.a.Component),a(ke,"propTypes",{children:J.children,className:G.string,currentSlide:G.number.isRequired,carouselStore:G.object.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,dotNumbers:G.bool,disableActiveDots:G.bool,showAsSelectedForCurrentSlideOnly:G.bool,renderDots:G.func}),a(ke,"defaultProps",{children:null,className:null,dotNumbers:!1,disableActiveDots:!0,showAsSelectedForCurrentSlideOnly:!1,renderDots:null}),Oe),Ve=Z(qe,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),We={image:"image___xtQGH"},Ze=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.state={imageStatus:$},i.handleImageLoad=i.handleImageLoad.bind(g(i)),i.handleImageError=i.handleImageError.bind(g(i)),i.image=null,i}u(t,e);var n=y(t);return o(t,null,[{key:"subscribeMasterSpinner",value:function(e){e.hasMasterSpinner&&e.carouselStore.subscribeMasterSpinner(e.src)}},{key:"unsubscribeMasterSpinner",value:function(e){e.hasMasterSpinner&&e.carouselStore.unsubscribeMasterSpinner(e.src)}}]),o(t,[{key:"componentDidMount",value:function(){t.subscribeMasterSpinner(this.props),this.initImage()}},{key:"componentDidUpdate",value:function(e){e.src!==this.props.src&&(t.unsubscribeMasterSpinner(e),t.subscribeMasterSpinner(this.props),this.initImage())}},{key:"componentWillUnmount",value:function(){t.unsubscribeMasterSpinner(this.props),this.image.removeEventListener("load",this.handleImageLoad),this.image.removeEventListener("error",this.handleImageError),this.image=null}},{key:"initImage",value:function(){if(this.setState({imageStatus:$}),this.image=document.createElement("img"),this.image.addEventListener("load",this.handleImageLoad,!1),this.image.addEventListener("error",this.handleImageError,!1),this.image.src=this.props.src,this.image.readyState||this.image.complete){var e=this.image.src;this.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",this.image.src=e}}},{key:"handleImageLoad",value:function(e){this.setState({imageStatus:"success"}),this.props.hasMasterSpinner&&this.props.carouselStore.masterSpinnerSuccess(this.props.src),this.props.onLoad&&this.props.onLoad(e)}},{key:"handleImageError",value:function(e){this.setState({imageStatus:"error"}),this.props.hasMasterSpinner&&this.props.carouselStore.masterSpinnerError(this.props.src),this.props.onError&&this.props.onError(e)}},{key:"tempTag",value:function(){return"img"===this.props.tag?"div":this.props.tag}},{key:"customRender",value:function(e){return"function"==typeof this.props[e]?this.props[e]():this.props.children}},{key:"renderLoading",value:function(e){var t=this.tempTag(),n=T([We.image,We.imageLoading,"carousel__image",this.props.isBgImage&&"carousel__image--with-background","carousel__image--loading",this.props.className]);return Y.a.createElement(t,l({className:n},e),this.customRender("renderLoading"))}},{key:"renderError",value:function(e){var t=this.tempTag(),n=T([We.image,We.imageError,"carousel__image",this.props.isBgImage&&"carousel__image--with-background","carousel__image--error",this.props.className]);return Y.a.createElement(t,l({className:n},e),this.customRender("renderError"))}},{key:"renderSuccess",value:function(e){var t=this.props,n=t.style,r=t.tag,i=T([We.image,"carousel__image",this.props.isBgImage&&"carousel__image--with-background","carousel__image--success",this.props.className]),o=l({},n),a=e;if("img"!==r){var s=e.src;e.alt,a=f(e,["src","alt"]),o=l({},n,{backgroundImage:'url("'.concat(s,'")'),backgroundSize:"cover"})}return Y.a.createElement(r,l({className:i,style:o},a),this.props.children)}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.className,e.hasMasterSpinner,e.isBgImage,e.onError,e.onLoad,e.renderError,e.renderLoading,e.style,e.tag,f(e,["carouselStore","children","className","hasMasterSpinner","isBgImage","onError","onLoad","renderError","renderLoading","style","tag"]));switch(this.state.imageStatus){case $:return this.renderLoading(t);case"success":return this.renderSuccess(t);case"error":return this.renderError(t);default:throw new Error("unknown value for this.state.imageStatus")}}}]),t}(Y.a.Component);a(Ze,"propTypes",{alt:G.string,carouselStore:G.object.isRequired,children:J.children,className:G.string,hasMasterSpinner:G.bool.isRequired,isBgImage:J.isBgImage,onError:G.func,onLoad:G.func,renderError:G.func,renderLoading:G.func,src:G.string.isRequired,style:G.object,tag:G.string}),a(Ze,"defaultProps",{alt:"",children:null,className:null,isBgImage:!1,onError:null,onLoad:null,renderError:null,renderLoading:null,style:null,tag:"img"});var Ue,Ye,Xe,Ke,Ge,$e,Je,Qe,et=Z(Ze,function(e){return{hasMasterSpinner:e.hasMasterSpinner,orientation:e.orientation}}),tt={spinner:"spinner___27VUp",spin:"spin___S3UuE"},nt=(Ye=Ue=function(e){function t(){return r(this,t),n.apply(this,arguments)}u(t,e);var n=y(t);return o(t,[{key:"render",value:function(){var e=this.props,t=e.className,n=f(e,["className"]),r=T([tt.spinner,"carousel__spinner",t]);return Y.a.createElement("div",l({className:r},n))}}]),t}(Y.a.PureComponent),a(Ue,"propTypes",{className:G.string}),a(Ue,"defaultProps",{className:null}),Ye),rt={container:"container___2O72F",overlay:"overlay___IV4qY",hover:"hover___MYy31",zoom:"zoom___3kqYk",loading:"loading___1pvNI",imageLoadingSpinnerContainer:"imageLoadingSpinnerContainer___3UIPD"},it=(Ke=Xe=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.state={isImageLoading:!0,isHovering:!1,isZooming:!1,x:null,y:null,scale:1},i.tpCache={},i.handleImageComplete=i.handleImageComplete.bind(g(i)),i.handleOnMouseMove=i.handleOnMouseMove.bind(g(i)),i.handleOnMouseOut=i.handleOnMouseOut.bind(g(i)),i.handleOnMouseOver=i.handleOnMouseOver.bind(g(i)),i.handleOnTouchEnd=i.handleOnTouchEnd.bind(g(i)),i.handleOnTouchMove=i.handleOnTouchMove.bind(g(i)),i.handleOnTouchStart=i.handleOnTouchStart.bind(g(i)),i}u(t,e);var n=y(t);return o(t,null,[{key:"midpointBetweenTwoTouches",value:function(e){var t=e.x1,n=e.y1;return{x:(t+e.x2)/2,y:(n+e.y2)/2}}},{key:"distanceBetweenTwoTouches",value:function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return Math.sqrt(Math.pow(r-t,2)+Math.pow(i-n,2))}}]),o(t,[{key:"componentDidUpdate",value:function(e,t){!1===t.isZooming&&!0===this.state.isZooming&&this.props.carouselStore.setStoreState({isPageScrollLocked:!0}),!0===t.isZooming&&!1===this.state.isZooming&&this.props.carouselStore.setStoreState({isPageScrollLocked:!1})}},{key:"handleImageComplete",value:function(){this.setState({isImageLoading:!1})}},{key:"handleOnMouseOver",value:function(){this.state.isZooming||this.setState({isHovering:!0,scale:2})}},{key:"handleOnMouseOut",value:function(){this.state.isZooming||this.setState({isHovering:!1,scale:1})}},{key:"handleOnMouseMove",value:function(e){if(!this.state.isZooming){var t=F(e.nativeEvent.offsetX/e.target.offsetWidth*100),n=F(e.nativeEvent.offsetY/e.target.offsetHeight*100);this.setState({x:t,y:n})}}},{key:"handleOnTouchStart",value:function(e){var t=this;this.props.isPinchZoomEnabled&&(v(e.targetTouches).forEach(function(e){t.tpCache[e.identifier]={clientX:e.clientX,clientY:e.clientY}}),this.setState(function(e){return{isZooming:e.isZooming||Object.keys(t.tpCache).length>1}}))}},{key:"handleOnTouchMove",value:function(e){var n=this;if(this.state.isZooming){e.persist();var r=v(e.targetTouches).filter(function(e){return n.tpCache[e.identifier]}).slice(0,2);if(2===r.length){e.stopPropagation();var i=e.target.getBoundingClientRect(),o=r[0].identifier,a=r[1].identifier,l={x1:this.tpCache[o].clientX,y1:this.tpCache[o].clientY,x2:this.tpCache[a].clientX,y2:this.tpCache[a].clientY};l.distance=t.distanceBetweenTwoTouches(c({},l));var s=t.midpointBetweenTwoTouches(c({},l));l.cx=s.x,l.cy=s.y;var u={x1:r[0].clientX,y1:r[0].clientY,x2:r[1].clientX,y2:r[1].clientY};u.distance=t.distanceBetweenTwoTouches(c({},u));var d=t.midpointBetweenTwoTouches(c({},u));u.cx=d.x,u.cy=d.y;var p=F(Q({min:0,max:100,x:(u.cx-i.left)/i.width*100})),h=F(Q({min:0,max:100,x:(u.cy-i.top)/i.height*100})),m=function(e){return Q({min:1,max:3,x:e.scale+(u.distance-l.distance)/100})};this.setState(function(e){return{isZooming:1!==m(e),scale:m(e),x:p,y:h}})}}}},{key:"handleOnTouchEnd",value:function(e){var t=this;this.props.isPinchZoomEnabled&&(v(e.changedTouches).forEach(function(e){delete t.tpCache[e.identifier]}),0===Object.keys(this.tpCache).length&&this.setState({isZooming:!1}))}},{key:"renderLoading",value:function(){if(this.state.isImageLoading){var e=this.props.spinner;return Y.a.createElement("div",{className:T([rt.imageLoadingSpinnerContainer,"carousel__image-loading-spinner-container"])},e&&e(),!e&&Y.a.createElement(nt,null))}return null}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.className),n=e.imageClassName,r=e.overlayClassName,i=(e.isPinchZoomEnabled,e.spinner,e.src),o=e.srcZoomed,a=e.tag,s=f(e,["carouselStore","className","imageClassName","overlayClassName","isPinchZoomEnabled","spinner","src","srcZoomed","tag"]),c=T([rt.container,t]),u=T([rt.image,"carousel__zoom-image",n]),d=T([rt.overlay,"carousel__zoom-image-overlay",this.state.isHovering&&rt.hover,this.state.isZooming&&rt.zoom,this.state.isHovering&&"carousel__zoom-image-overlay--hovering",this.state.isZooming&&"carousel__zoom-image-overlay--zooming",r]),p={};return(this.state.isHovering||this.state.isZooming)&&(p.transformOrigin="".concat(this.state.x," ").concat(this.state.y),p.transform="scale(".concat(this.state.scale,")")),Y.a.createElement(a,l({className:c},s),Y.a.createElement(et,{className:u,tag:"div",src:i,isBgImage:!0,onLoad:this.handleImageComplete,onError:this.handleImageComplete}),Y.a.createElement(et,{className:d,tag:"div",src:o||i,style:p,isBgImage:!0,onFocus:this.handleOnMouseOver,onMouseOver:this.handleOnMouseOver,onBlur:this.handleOnMouseOut,onMouseOut:this.handleOnMouseOut,onMouseMove:this.handleOnMouseMove,onTouchStart:this.handleOnTouchStart,onTouchEnd:this.handleOnTouchEnd,onTouchMove:this.handleOnTouchMove}),this.renderLoading())}}]),t}(Y.a.Component),a(Xe,"propTypes",{carouselStore:G.object.isRequired,className:G.string,imageClassName:G.string,overlayClassName:G.string,spinner:G.func,src:G.string.isRequired,srcZoomed:G.string,tag:G.string,isPinchZoomEnabled:G.bool}),a(Xe,"defaultProps",{className:null,imageClassName:null,overlayClassName:null,isPinchZoomEnabled:!0,spinner:null,srcZoomed:null,tag:"div"}),Ke),ot=(Z(it,function(){return{}}),{slide:"slide___3-Nqo",slideHorizontal:"slideHorizontal___1NzNV",slideInner:"slideInner___2mfX9",focusRing:"focusRing___1airF"}),at=($e=Ge=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnFocus=i.handleOnFocus.bind(g(i)),i.handleOnBlur=i.handleOnBlur.bind(g(i)),i.state={focused:!1},i}u(t,e);var n=y(t);return o(t,[{key:"isVisible",value:function(){var e=this.props,t=e.currentSlide,n=e.index,r=e.visibleSlides;return n>=t&&n<t+r}},{key:"handleOnFocus",value:function(e){var t=this,n=this.props.onFocus;this.setState({focused:!0},function(){null!==n&&n.call(t,e)})}},{key:"handleOnBlur",value:function(e){var t=this,n=this.props.onBlur;this.setState({focused:!1},function(){null!==n&&n.call(t,e)})}},{key:"renderFocusRing",value:function(){return this.state.focused?Y.a.createElement("div",{className:[ot.focusRing,"carousel__slide-focus-ring"].join(" ")}):null}},{key:"render",value:function(){var e=this,t=this.props,n=(t.carouselStore,t.children,t.className),r=t.classNameHidden,i=t.classNameVisible,o=(t.currentSlide,t.index,t.innerClassName),a=t.innerTag,s=t.naturalSlideHeight,c=t.naturalSlideWidth,u=(t.onBlur,t.onFocus,t.orientation),d=t.slideSize,p=t.style,h=t.tabIndex,m=t.tag,g=t.totalSlides,w=(t.visibleSlides,t.isIntrinsicHeight),y=f(t,["carouselStore","children","className","classNameHidden","classNameVisible","currentSlide","index","innerClassName","innerTag","naturalSlideHeight","naturalSlideWidth","onBlur","onFocus","orientation","slideSize","style","tabIndex","tag","totalSlides","visibleSlides","isIntrinsicHeight"]),v={};"horizontal"===u?(v.width=F(d),v.paddingBottom=F(100*s/(c*g))):(v.width=F(100),v.paddingBottom=F(100*s/c));var b={};w&&("horizontal"===u?v.height="unset":v.width="unset",v.position="unset",v.paddingBottom="unset",b.position="unset");var S=l({},v,p),E=this.isVisible(),C=T([ot.slide,"horizontal"===u&&ot.slideHorizontal,"carousel__slide",this.state.focused&&"carousel__slide--focused",E&&i,E&&"carousel__slide--visible",!E&&r,!E&&"carousel__slide--hidden",n]),x=T([ot.slideInner,"carousel__inner-slide",o]),_=this.isVisible()?0:-1,k="number"==typeof h?h:_;return Y.a.createElement(m,l({ref:function(t){e.tagRef=t},tabIndex:k,"aria-selected":this.isVisible(),role:"option",onFocus:this.handleOnFocus,onBlur:this.handleOnBlur,className:C,style:S},y),Y.a.createElement(a,{ref:function(t){e.innerTagRef=t},className:x,style:b},this.props.children,this.renderFocusRing()))}}]),t}(Y.a.PureComponent),a(Ge,"propTypes",{carouselStore:G.object,children:J.children,className:G.string,classNameHidden:G.string,classNameVisible:G.string,currentSlide:G.number.isRequired,index:G.number.isRequired,innerClassName:G.string,innerTag:G.string,naturalSlideHeight:G.number.isRequired,naturalSlideWidth:G.number.isRequired,onBlur:G.func,onFocus:G.func,orientation:J.orientation.isRequired,slideSize:G.number.isRequired,style:G.object,tabIndex:G.number,tag:G.string,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,isIntrinsicHeight:G.bool}),a(Ge,"defaultProps",{carouselStore:null,children:null,className:null,classNameHidden:null,classNameVisible:null,innerClassName:null,innerTag:"div",onBlur:null,onFocus:null,style:{},tabIndex:null,tag:"li",isIntrinsicHeight:!1}),$e),lt=Z(at,function(e){return{currentSlide:e.currentSlide,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,slideSize:e.slideSize,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,isIntrinsicHeight:e.isIntrinsicHeight}}),st=function(){function e(){r(this,e)}return o(e,[{key:"parents",value:function(e,t){return null===e.parentNode?t:this.parents(e.parentNode,t.concat([e]))}},{key:"scrollParent",value:function(t){for(var n=this.parents(t.parentNode,[]),r=0;r<n.length;r+=1)if(e.scroll(n[r]))return n[r];return document.scrollingElement||document.documentElement}},{key:"getScrollParent",value:function(t){return e.isNodeValid(t)?this.scrollParent(t):null}}],[{key:"style",value:function(e,t){return getComputedStyle(e,null).getPropertyValue(t)}},{key:"overflow",value:function(t){return e.style(t,"overflow")+e.style(t,"overflow-y")+e.style(t,"overflow-x")}},{key:"scroll",value:function(t){return/(auto|scroll)/.test(e.overflow(t))}},{key:"isNodeValid",value:function(e){return e instanceof HTMLElement||e instanceof SVGElement}}]),e}(),ct={horizontalSlider:"horizontalSlider___281Ls",horizontalSliderTray:"horizontalSliderTray___1L-0W",verticalSlider:"verticalSlider___34ZFD",verticalSliderTray:"verticalSliderTray___267D8",verticalTray:"verticalTray___12Key",verticalSlideTrayWrap:"verticalSlideTrayWrap___2nO7o",sliderTray:"sliderTray___-vHFQ",sliderAnimation:"sliderAnimation___300FY",masterSpinnerContainer:"masterSpinnerContainer___1Z6hB"},ut=(Qe=Je=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.getSliderRef=i.getSliderRef.bind(g(i)),i.handleDocumentScroll=i.handleDocumentScroll.bind(g(i)),i.handleOnClickCapture=i.handleOnClickCapture.bind(g(i)),i.handleOnKeyDown=i.handleOnKeyDown.bind(g(i)),i.handleOnMouseDown=i.handleOnMouseDown.bind(g(i)),i.handleOnMouseMove=i.handleOnMouseMove.bind(g(i)),i.handleOnMouseUp=i.handleOnMouseUp.bind(g(i)),i.handleOnTouchCancel=i.handleOnTouchCancel.bind(g(i)),i.handleOnTouchEnd=i.handleOnTouchEnd.bind(g(i)),i.handleOnTouchMove=i.handleOnTouchMove.bind(g(i)),i.handleOnTouchStart=i.handleOnTouchStart.bind(g(i)),i.playBackward=i.playBackward.bind(g(i)),i.playForward=i.playForward.bind(g(i)),i.callCallback=i.callCallback.bind(g(i)),i.state={cancelNextClick:!1,deltaX:0,deltaY:0,isBeingMouseDragged:!1,isBeingTouchDragged:!1,startX:0,startY:0},i.interval=null,i.isDocumentScrolling=null,i.moveTimer=null,i.originalOverflow=null,i.scrollParent=null,i.scrollStopTimer=null,i}u(t,e);var n=y(t);return o(t,null,[{key:"slideSizeInPx",value:function(e,t,n,r){return("horizontal"===e?t:n)/r}},{key:"slidesMoved",value:function(e,t,n,r,i,o){var a="horizontal"===t?n:r,l=Math.abs(Math.round(a/i)),s=Math.abs(a)>=i*e?o:0,c=Math.max(s,l);if(a<0)return c;var u=-c;return 0===u?0:u}}]),o(t,[{key:"componentDidMount",value:function(){this.props.lockOnWindowScroll&&window.addEventListener("scroll",this.handleDocumentScroll,!1),document.documentElement.addEventListener("mouseleave",this.handleOnMouseUp,!1),document.documentElement.addEventListener("mousemove",this.handleOnMouseMove,!1),document.documentElement.addEventListener("mouseup",this.handleOnMouseUp,!1),this.props.isPlaying&&this.play()}},{key:"componentDidUpdate",value:function(e){!e.isPlaying&&this.props.isPlaying&&this.play(),e.isPlaying&&!this.props.isPlaying&&this.stop(),!e.isPageScrollLocked&&this.props.isPageScrollLocked&&this.lockScroll(),e.isPageScrollLocked&&!this.props.isPageScrollLocked&&this.unlockScroll(),!1===e.privateUnDisableAnimation&&!0===this.props.privateUnDisableAnimation&&this.props.carouselStore.setStoreState({privateUnDisableAnimation:!1,disableAnimation:!1})}},{key:"componentWillUnmount",value:function(){document.documentElement.removeEventListener("mouseleave",this.handleOnMouseUp,!1),document.documentElement.removeEventListener("mousemove",this.handleOnMouseMove,!1),document.documentElement.removeEventListener("mouseup",this.handleOnMouseUp,!1),window.removeEventListener("scroll",this.handleDocumentScroll,!1),this.stop(),window.cancelAnimationFrame.call(window,this.moveTimer),window.clearTimeout(this.scrollStopTimer),this.isDocumentScrolling=null,this.moveTimer=null,this.scrollStopTimer=null}},{key:"getSliderRef",value:function(e){this.sliderTrayElement=e}},{key:"fakeOnDragStart",value:function(e){var t=e.screenX,n=e.screenY,r=e.touchDrag,i=void 0!==r&&r,o=e.mouseDrag,a=void 0!==o&&o;this.props.carouselStore.setStoreState({isPlaying:!1}),window.cancelAnimationFrame.call(window,this.moveTimer),"vertical"===this.props.orientation&&this.props.carouselStore.setStoreState({isPageScrollLocked:!0}),this.setState({isBeingTouchDragged:i,isBeingMouseDragged:a,startX:t,startY:n})}},{key:"fakeOnDragMove",value:function(e,t){var n=this;this.moveTimer=window.requestAnimationFrame.call(window,function(){n.setState(function(n){return{deltaX:e-n.startX,deltaY:t-n.startY}})})}},{key:"fakeOnDragEnd",value:function(){window.cancelAnimationFrame.call(window,this.moveTimer),this.computeCurrentSlide(),"vertical"===this.props.orientation&&this.props.carouselStore.setStoreState({isPageScrollLocked:!1}),this.setState({deltaX:0,deltaY:0,isBeingTouchDragged:!1,isBeingMouseDragged:!1}),this.isDocumentScrolling=!this.props.lockOnWindowScroll&&null}},{key:"callCallback",value:function(e,t){var n=this.props.trayProps;n&&"function"==typeof n[e]&&(t.persist(),n[e](t))}},{key:"handleOnMouseDown",value:function(e){if(!this.props.dragEnabled)return void this.callCallback("onMouseDown",e);e.preventDefault(),this.fakeOnDragStart({screenX:e.screenX,screenY:e.screenY,mouseDrag:!0}),this.callCallback("onMouseDown",e)}},{key:"handleOnMouseMove",value:function(e){this.state.isBeingMouseDragged&&(this.setState({cancelNextClick:!0}),e.preventDefault(),this.fakeOnDragMove(e.screenX,e.screenY))}},{key:"handleOnMouseUp",value:function(e){this.state.isBeingMouseDragged&&(e.preventDefault(),this.fakeOnDragEnd())}},{key:"handleOnClickCapture",value:function(e){if(!this.state.cancelNextClick)return void this.callCallback("onClickCapture",e);e.preventDefault(),this.setState({cancelNextClick:!1}),this.callCallback("onClickCapture",e)}},{key:"handleOnTouchStart",value:function(e){if(!this.props.touchEnabled)return void this.callCallback("onTouchStart",e);"vertical"===this.props.orientation&&e.preventDefault();var t=e.targetTouches[0];this.fakeOnDragStart({screenX:t.screenX,screenY:t.screenY,touchDrag:!0}),this.callCallback("onTouchStart",e)}},{key:"handleDocumentScroll",value:function(){var e=this;this.props.touchEnabled&&(this.isDocumentScrolling=!0,window.clearTimeout(this.scrollStopTimer),this.scrollStopTimer=window.setTimeout(function(){e.isDocumentScrolling=!1},66))}},{key:"handleOnTouchMove",value:function(e){if(!this.props.touchEnabled||this.props.lockOnWindowScroll&&this.isDocumentScrolling)return void this.callCallback("onTouchMove",e);window.cancelAnimationFrame.call(window,this.moveTimer);var t=e.targetTouches[0];t&&(this.fakeOnDragMove(t.screenX,t.screenY),this.callCallback("onTouchMove",e))}},{key:"forward",value:function(){var e=this.props,t=e.currentSlide,n=e.step,r=e.totalSlides,i=e.visibleSlides;return Math.min(t+n,r-i)}},{key:"backward",value:function(){var e=this.props,t=e.currentSlide,n=e.step;return Math.max(t-n,0)}},{key:"handleOnKeyDown",value:function(e){var t=e.keyCode,n=this.props,r=n.carouselStore,i=n.currentSlide,o=n.disableKeyboard,a=n.totalSlides,l=n.visibleSlides,s={};!0===o||a<=l||(37===t&&(e.preventDefault(),this.focus(),s.currentSlide=Math.max(0,i-1),s.isPlaying=!1),39===t&&(e.preventDefault(),this.focus(),s.currentSlide=Math.min(a-l,i+1),s.isPlaying=!1),r.setStoreState(s))}},{key:"playForward",value:function(){var e=this.props,t=e.carouselStore,n=e.currentSlide;t.setStoreState({currentSlide:this.forward()===n?0:this.forward()})}},{key:"playBackward",value:function(){var e=this.props,t=e.carouselStore,n=e.currentSlide,r=e.totalSlides,i=e.visibleSlides;t.setStoreState({currentSlide:this.backward()===n?r-i:this.backward()})}},{key:"play",value:function(){var e=this.props.playDirection;this.interval=setInterval("forward"===e?this.playForward:this.playBackward,this.props.interval)}},{key:"stop",value:function(){window.clearInterval(this.interval),this.interval=null}},{key:"lockScroll",value:function(){var e=new st;this.scrollParent=e.getScrollParent(this.sliderTrayElement),this.scrollParent&&(this.originalOverflow=this.originalOverflow||this.scrollParent.style.overflow,this.scrollParent.style.overflow="hidden")}},{key:"unlockScroll",value:function(){this.scrollParent&&(this.scrollParent.style.overflow=this.originalOverflow,this.originalOverflow=null,this.scrollParent=null)}},{key:"computeCurrentSlide",value:function(){var e=t.slideSizeInPx(this.props.orientation,this.sliderTrayElement.clientWidth,this.sliderTrayElement.clientHeight,this.props.totalSlides),n=t.slidesMoved(this.props.moveThreshold,this.props.orientation,this.state.deltaX,this.state.deltaY,e,this.props.dragStep),r=this.props.totalSlides-Math.min(this.props.totalSlides,this.props.visibleSlides),i=Q({min:0,max:r,x:this.props.currentSlide+n});this.props.infinite&&(this.props.currentSlide>=r&&n>0&&(i=0),0===this.props.currentSlide&&n<0&&(i=r)),this.props.carouselStore.setStoreState({currentSlide:i})}},{key:"focus",value:function(){this.sliderElement.focus()}},{key:"handleOnTouchEnd",value:function(e){this.endTouchMove(),this.callCallback("onTouchEnd",e)}},{key:"handleOnTouchCancel",value:function(e){this.endTouchMove(),this.callCallback("onTouchCancel",e)}},{key:"endTouchMove",value:function(){this.props.touchEnabled&&this.fakeOnDragEnd()}},{key:"renderMasterSpinner",value:function(){var e=this.props,t=e.hasMasterSpinner,n=e.masterSpinnerFinished,r=e.spinner;return t&&!n?("function"==typeof this.props.onMasterSpinner&&this.props.onMasterSpinner(),Y.a.createElement("div",{className:T([ct.masterSpinnerContainer,"carousel__master-spinner-container"])},r&&r(),!r&&Y.a.createElement(nt,null))):null}},{key:"render",value:function(){var e=this,t=this.props,n=(t.carouselStore,t.children),r=t.className,i=t.classNameAnimation,o=t.classNameTray,a=t.classNameTrayWrap,s=t.currentSlide,c=t.disableAnimation,u=(t.disableKeyboard,t.dragEnabled,t.hasMasterSpinner,t.interval,t.isPageScrollLocked,t.isPlaying,t.lockOnWindowScroll,t.masterSpinnerFinished,t.moveThreshold,t.naturalSlideHeight),d=t.naturalSlideWidth,p=(t.onMasterSpinner,t.orientation),h=(t.playDirection,t.privateUnDisableAnimation,t.slideSize),m=t.slideTraySize,g=(t.spinner,t.style),w=t.tabIndex,y=(t.totalSlides,t.touchEnabled,t.trayProps),v=t.trayTag,b=t.visibleSlides,S=t.isIntrinsicHeight,E=f(t,["carouselStore","children","className","classNameAnimation","classNameTray","classNameTrayWrap","currentSlide","disableAnimation","disableKeyboard","dragEnabled","hasMasterSpinner","interval","isPageScrollLocked","isPlaying","lockOnWindowScroll","masterSpinnerFinished","moveThreshold","naturalSlideHeight","naturalSlideWidth","onMasterSpinner","orientation","playDirection","privateUnDisableAnimation","slideSize","slideTraySize","spinner","style","tabIndex","totalSlides","touchEnabled","trayProps","trayTag","visibleSlides","isIntrinsicHeight"]),C=l({},g),x={};"vertical"===p&&(x.height=0,x.paddingBottom=F(100*u*b/d),x.width=F(100));var _={},k=F(h*s*-1);(this.state.isBeingTouchDragged||this.state.isBeingMouseDragged||c)&&(_.transition="none"),S&&(_.display="flex",_.alignItems="stretch"),"vertical"===p?(_.transform="translateY(".concat(k,") translateY(").concat(this.state.deltaY,"px)"),_.width=F(100),_.flexDirection="column"):(_.width=F(m),_.transform="translateX(".concat(k,") translateX(").concat(this.state.deltaX,"px)"),_.flexDirection="row");var O=T(["vertical"===p?ct.verticalSlider:ct.horizontalSlider,"carousel__slider","vertical"===p?"carousel__slider--vertical":"carousel__slider--horizontal",r]),M=T([ct.sliderTrayWrap,"carousel__slider-tray-wrapper","vertical"===p?ct.verticalSlideTrayWrap:ct.horizontalTrayWrap,"vertical"===p?"carousel__slider-tray-wrap--vertical":"carousel__slider-tray-wrap--horizontal",a]),N=T([ct.sliderTray,i||ct.sliderAnimation,"carousel__slider-tray","vertical"===p?ct.verticalTray:ct.horizontalTray,"vertical"===p?"carousel__slider-tray--vertical":"carousel__slider-tray--horizontal",o]),P=null!==w?w:0,j=(E.dragStep,E.step,E.infinite,f(E,["dragStep","step","infinite"])),D=(y.className,y.onClickCapture,y.onMouseDown,y.onTouchCancel,y.onTouchEnd,y.onTouchMove,y.onTouchStart,y.ref,y.style,f(y,["className","onClickCapture","onMouseDown","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","ref","style"]));return Y.a.createElement("div",l({ref:function(t){e.sliderElement=t},className:O,"aria-live":"polite",style:C,tabIndex:P,onKeyDown:this.handleOnKeyDown,role:"listbox"},j),Y.a.createElement("div",{className:M,style:x},Y.a.createElement(v,l({ref:this.getSliderRef,className:N,style:_,onTouchStart:this.handleOnTouchStart,onTouchMove:this.handleOnTouchMove,onTouchEnd:this.handleOnTouchEnd,onTouchCancel:this.handleOnTouchCancel,onMouseDown:this.handleOnMouseDown,onClickCapture:this.handleOnClickCapture},D),n),this.renderMasterSpinner()))}}]),t}(Y.a.Component),a(Je,"propTypes",{carouselStore:G.object.isRequired,children:G.node.isRequired,className:G.string,classNameAnimation:G.string,classNameTray:G.string,classNameTrayWrap:G.string,currentSlide:G.number.isRequired,disableAnimation:G.bool,disableKeyboard:G.bool,dragEnabled:G.bool.isRequired,dragStep:G.number,hasMasterSpinner:G.bool.isRequired,infinite:G.bool,interval:G.number.isRequired,isPageScrollLocked:G.bool.isRequired,isPlaying:G.bool.isRequired,lockOnWindowScroll:G.bool.isRequired,masterSpinnerFinished:G.bool.isRequired,moveThreshold:G.number,naturalSlideHeight:G.number.isRequired,naturalSlideWidth:G.number.isRequired,onMasterSpinner:G.func,orientation:J.orientation.isRequired,playDirection:J.direction.isRequired,privateUnDisableAnimation:G.bool,slideSize:G.number.isRequired,slideTraySize:G.number.isRequired,spinner:G.func,step:G.number.isRequired,style:G.object,tabIndex:G.number,totalSlides:G.number.isRequired,touchEnabled:G.bool.isRequired,trayProps:G.shape({className:G.string,onClickCapture:G.func,onMouseDown:G.func,onTouchCancel:G.func,onTouchEnd:G.func,onTouchMove:G.func,onTouchStart:G.func,ref:G.shape({}),style:G.string}),trayTag:G.string,visibleSlides:G.number,isIntrinsicHeight:G.bool}),a(Je,"defaultProps",{className:null,classNameAnimation:null,classNameTray:null,classNameTrayWrap:null,disableAnimation:!1,disableKeyboard:!1,dragStep:1,infinite:!1,moveThreshold:.1,onMasterSpinner:null,privateUnDisableAnimation:!1,spinner:null,style:{},tabIndex:null,trayProps:{},trayTag:"ul",visibleSlides:1,isIntrinsicHeight:!1}),Qe),dt=Z(ut,function(e){return{currentSlide:e.currentSlide,disableAnimation:e.disableAnimation,privateUnDisableAnimation:e.privateUnDisableAnimation,disableKeyboard:e.disableKeyboard,dragEnabled:e.dragEnabled,hasMasterSpinner:e.hasMasterSpinner,infinite:e.infinite,interval:e.interval,isPageScrollLocked:e.isPageScrollLocked,isPlaying:e.isPlaying,lockOnWindowScroll:e.lockOnWindowScroll,masterSpinnerFinished:e.masterSpinnerFinished,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,playDirection:e.playDirection,slideSize:e.slideSize,slideTraySize:e.slideTraySize,step:e.step,dragStep:e.dragStep,totalSlides:e.totalSlides,touchEnabled:e.touchEnabled,visibleSlides:e.visibleSlides,isIntrinsicHeight:e.isIntrinsicHeight}})},function(e,t,n){"use strict";var r=n(65),i=n.n(r),o=n(67),a=n.n(o),l=n(23),s=n.n(l),c=n(150),u=n(68),d=n(151),p=wp.i18n.__,h=wp.blocks.registerBlockType,m=wp,f=m.apiFetch,g=wp.data,w=g.registerStore,y=g.withSelect,v=wp.blockEditor.InspectorControls,b=wp.components,S=b.PanelBody,E=b.PanelRow,C=b.TextControl,x=b.ColorPalette,_=b.RadioControl,k=b.ToggleControl,O=b.SelectControl,T=window.exactmetrics_gutenberg_tool_vars,M={setThemes:function(e){return{type:"SET_THEMES",themes:e}},receiveThemes:function(e){return{type:"RECEIVE_THEMES",path:e}}};w("exactmetrics/v1/popular-posts/widget",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{themes:{}},t=arguments[1];switch(t.type){case"SET_THEMES":return s()({},e,{themes:t.themes})}return e},actions:M,selectors:{receiveThemes:function(e){return e.themes}},controls:{RECEIVE_THEMES:function(e){return f({path:e.path})}},resolvers:{receiveThemes:a.a.mark(function e(t){var n,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M.receiveThemes("/exactmetrics/v1/popular-posts/themes/widget");case 2:if(n=e.sent,void 0===n.themes){e.next=6;break}for(r in n.themes)n.themes.hasOwnProperty(r)&&(n.themes[r].value=r);return e.abrupt("return",M.setThemes(n));case 6:case"end":return e.stop()}},e,this)})}}),h("exactmetrics/popular-posts-widget",{title:p("Popular Posts","google-analytics-dashboard-for-wp"),description:p("Add popular posts from ExactMetrics","google-analytics-dashboard-for-wp"),category:"widgets",icon:c.a.widgetpop,keywords:[p("Popular","google-analytics-dashboard-for-wp"),p("Posts","google-analytics-dashboard-for-wp"),p("Widget","google-analytics-dashboard-for-wp"),"ExactMetrics"],example:{},attributes:{theme:{type:"string"},title_size:{type:"number"},title_color:{type:"string"},label_color:{type:"string"},label_text:{type:"string"},label_background:{type:"string"},background_color:{type:"string"},background_border:{type:"string"},meta_color:{type:"string"},meta_size:{type:"string"},meta_author:{type:"boolean"},meta_date:{type:"boolean"},meta_comments:{type:"boolean"},comments_color:{type:"string"},columns:{type:"number",default:1},widget_title:{type:"boolean"},widget_title_text:{type:"string"},post_count:{type:"number",default:5},categories:{type:"array",default:[]}},edit:y(function(e){return{themes:e("exactmetrics/v1/popular-posts/widget").receiveThemes()}})(function(e){var t=e.attributes,n=t.theme,r=(t.title_size,t.title_color,t.label_color,t.label_text,t.label_background,t.background_color,t.background_border,t.meta_color,t.meta_size,t.meta_author,t.meta_comments,t.meta_date,t.comments_color,t.columns),o=t.widget_title,a=t.widget_title_text,l=t.post_count,s=t.categories,h=e.themes,m=e.setAttributes,f=[{name:"pink",color:"#F58EA8"},{name:"red",color:"#CD3034"},{name:"orange",color:"#FD6A21"},{name:"yellow",color:"#FBB82B"},{name:"green",color:"#7FDBB6"},{name:"green",color:"#21CF86"},{name:"blue",color:"#91D2FA"},{name:"blue",color:"#1B95E0"},{name:"purple",color:"#9A57DD"},{name:"gray",color:"#EEEEEE"},{name:"gray",color:"#ACB8C3"},{name:"black",color:"#000000"}],g=void 0!==h.themes?h.themes:{},w=void 0===e.attributes.theme?h.selected:n,y=void 0!==w&&void 0!==g[w]?g[w]:{},b=void 0!==y.styles?y.styles:{},M={};for(var N in b)if(b.hasOwnProperty(N))for(var F in b[N])if(b[N].hasOwnProperty(F)){var P=N+"_"+F;void 0===e.attributes[P]?M[P]=b[N][F]:M[P]=e.attributes[P],"on"===M[P]&&(M[P]=!0),"off"===M[P]&&(M[P]=!1)}var j=function(e,t){var n=[1,2,3,4,5,6,7,8,9,10];return 2===e&&(n=[2,4,6,8,10]),3===e&&(n=[3,6,9]),t&&(n=n.map(function(e){return{value:e,label:e}})),n},D=function(){if(void 0!==b.meta.author)return wp.element.createElement(k,{label:p("Display Author","google-analytics-dashboard-for-wp"),checked:M.meta_author,onChange:function(e){m(i()({},"meta_author",e))}})},A=function(){if(void 0!==b.meta.date)return wp.element.createElement(k,{label:p("Display Date","google-analytics-dashboard-for-wp"),checked:M.meta_date,onChange:function(e){m(i()({},"meta_date",e))}})},L=function(){if(void 0!==b.meta.comments)return wp.element.createElement(k,{label:p("Display Comments","google-analytics-dashboard-for-wp"),checked:M.meta_comments,onChange:function(e){m(i()({},"meta_comments",e))}})},B=function(){return wp.element.createElement("span",{className:"exactmetrics-wide-column exactmetrics-wide-column-one"},wp.element.createElement("span",null),wp.element.createElement("span",null))},z=function(){return wp.element.createElement("span",{className:"exactmetrics-wide-column exactmetrics-wide-column-two"},wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null))},H=function(){return wp.element.createElement("span",{className:"exactmetrics-wide-column exactmetrics-wide-column-three"},wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null))},R=function(e,t){var n=M[t];return wp.element.createElement(C,{key:"exactmetrics-popular-posts-input"+t,label:e,type:"number",value:parseInt(n),min:1,max:100,onChange:function(e){return m(i()({},t,""===e?"":parseInt(e)))}})},I=function(e,t){var n=M[t];return wp.element.createElement(C,{key:"exactmetrics-popular-posts-input"+t,label:e,type:"text",value:n,onChange:function(e){return m(i()({},t,e))}})},q=function(e,t){var n=M[t];return[wp.element.createElement("label",{key:"exactmetrics-popular-posts-label"+t},e),wp.element.createElement(x,{key:"exactmetrics-popular-posts-input"+t,value:n,colors:f,onChange:function(e){m(i()({},t,e))}})]},V=function(e,t){if(e.length>0&&void 0!==e[t]){var n=e[t];return wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-image"},wp.element.createElement("img",{src:T.vue_assets_path+"img/"+n}))}},W=function(){if(void 0!==b.label)return wp.element.createElement("span",{style:{color:M.label_color,backgroundColor:M.label_background},className:"exactmetrics-widget-popular-posts-label"},M.label_text)},Z=function(){if(void 0!==b.meta)return[wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-meta",key:"exactmetrics-widget-popular-posts-meta-options",style:{color:M.meta_color,fontSize:M.meta_size+"px"}},U(),Y(),K()),wp.element.createElement("span",{key:"exactmetrics-widget-popular-posts-comments-options"},X())]},U=function(){if(M.meta_author)return wp.element.createElement("span",{className:"exactmetrics-widget-popular-posts-author"},"by Aazim Akhtar")},Y=function(){if(M.meta_author&&M.meta_date)return wp.element.createElement("span",{dangerouslySetInnerHTML:{__html:b.meta.separator}})},X=function(){if(void 0!==b.meta&&void 0!==b.meta.comments&&M.meta_comments){var e=void 0!==b.comments?M.comments_color:M.meta_color;return wp.element.createElement("span",{className:"exactmetrics-widget-popular-posts-comments",style:{color:e,fontSize:M.meta_size+"px"}},c.a.comments(e)," 24")}},K=function(){if(M.meta_date)return wp.element.createElement("span",{className:"exactmetrics-widget-popular-posts-date"},"Yesterday")},G=function(e){for(;e.length<=10;)e=e.concat(e);return e};return[wp.element.createElement(v,{key:"exactmetrics-popular-posts-widget-inspector-controls"},wp.element.createElement(S,{title:p("Theme","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-theme"},wp.element.createElement(E,{key:"exactmetrics-popular-posts-widget-theme-row"},wp.element.createElement(u.a,{id:"exactmetrics-popular-posts-widget-theme",options:g,selected:w,icons:c.a,onChange:function(e){m({theme:e})}}))),function(){if(void 0!==b.title){var e=[];return void 0!==b.title.size&&e.push(R(p("Title Font Size","google-analytics-dashboard-for-wp"),"title_size")),void 0!==b.title.color&&e.push(q(p("Title Color","google-analytics-dashboard-for-wp"),"title_color")),wp.element.createElement(S,{title:p("Title Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-title"},e)}}(),function(){if(void 0!==b.background&&void 0!==b.background.color){var e=[];return void 0!==b.background.color&&e.push(q(p("Background Color","google-analytics-dashboard-for-wp"),"background_color")),wp.element.createElement(S,{title:p("Background Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-background"}," ",e," ")}}(),function(){if(void 0!==b.label){var e=[];return void 0!==b.label.text&&e.push(I(p("Label Text","google-analytics-dashboard-for-wp"),"label_text")),void 0!==b.label.color&&e.push(q(p("Label Color","google-analytics-dashboard-for-wp"),"label_color")),void 0!==b.label.background&&e.push(q(p("Label Background","google-analytics-dashboard-for-wp"),"label_background")),wp.element.createElement(S,{title:p("Label Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-label"}," ",e," ")}}(),function(){var e=[];if(void 0!==b.border&&void 0!==b.border.color&&e.push(q(p("Border Color","google-analytics-dashboard-for-wp"),"borderColor")),void 0!==b.border&&void 0!==b.border.color2&&e.push(q(p("Bottom Border Color","google-analytics-dashboard-for-wp"),"borderColor2")),void 0!==b.background&&void 0!==b.background.border&&e.push(q(p("Border Color","google-analytics-dashboard-for-wp"),"background_border")),0!==e.length)return wp.element.createElement(S,{title:p("Border Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-border"}," ",e," ")}(),function(){if(void 0!==b.meta){var e=[];return void 0!==b.meta.size&&e.push(R(p("Meta Font Size","google-analytics-dashboard-for-wp"),"meta_size")),void 0!==b.meta.color&&e.push(q(p("Meta Color","google-analytics-dashboard-for-wp"),"meta_color")),wp.element.createElement(S,{title:p("Meta Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-meta-styles"},e)}}(),function(){if(void 0!==b.comments)return wp.element.createElement(S,{title:p("Comment Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-comment-styles"},q(p("Comment Color","google-analytics-dashboard-for-wp"),"comments_color"))}(),function(){return wp.element.createElement(S,{title:p("Wide-Layout Options","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-columns"},wp.element.createElement(_,{label:p("Choose Layout","google-analytics-dashboard-for-wp"),help:p("Adjust the number of columns displayed when the widget is placed in a wide container.","google-analytics-dashboard-for-wp"),className:"exactmetrics-wide-column-options",key:"exactmetrics-popular-posts-widget-columns-control",options:[{value:1,label:B()},{value:2,label:z()},{value:3,label:H()}],selected:r,onChange:function(e){m(i()({},"columns",""===e?"":parseInt(e)));var t=j(parseInt(e));-1===t.indexOf(l)&&m(i()({},"post_count",parseInt(t[0])))}}),wp.element.createElement(O,{label:p("Post Count","google-analytics-dashboard-for-wp"),help:p("Number of posts displayed.","google-analytics-dashboard-for-wp"),options:j(r,!0),value:l,key:"exactmetrics-popular-posts-widget-post-count",onChange:function(e){m(i()({},"post_count",parseInt(e)))}}))}(),function(){if(void 0!==b.meta)return wp.element.createElement(S,{title:p("Display Options","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-meta-options"},D(),A(),L())}(),function(){return wp.element.createElement(S,{title:p("Behavior Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-behavior-options"},wp.element.createElement(k,{label:p("Display Widget Title","google-analytics-dashboard-for-wp"),checked:o,onChange:function(e){m(i()({},"widget_title",e))}}),wp.element.createElement(C,{key:"exactmetrics-popular-posts-input-widget-title-text",label:p("Widget Title","google-analytics-dashboard-for-wp"),type:"text",value:a,onChange:function(e){return m(i()({},"widget_title_text",e))}}),wp.element.createElement(d.a,{label:p("Only Show Posts From These Categories","google-analytics-dashboard-for-wp"),slug:"category",onUpdateTerms:function(e){m(i()({},"categories",e))},terms:s}))}()),wp.element.createElement("div",{key:"exactmetrics-popular-posts-widget-preview"},wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-widget exactmetrics-widget-popular-posts-"+w+" exactmetrics-widget-popular-posts-columns-"+r},function(){if(o)return wp.element.createElement("h2",{className:"exactmetrics-widget-popular-posts-widget-title"},a)}(),wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-text"},function(){if(void 0!==y.list&&void 0!==y.list.items){var e=G(y.list.items),t=void 0!==y.list.images?G(y.list.images):[],n=[];for(var r in e){if(parseInt(r)===parseInt(l))break;n.push(wp.element.createElement("li",{key:"exactmetrics-popular-posts-preview-list-item-"+r,style:{backgroundColor:M.background_color,borderColor:M.background_border}},V(t,r),wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-text"},W(),wp.element.createElement("a",{className:"exactmetrics-widget-popular-posts-title",style:{color:M.title_color,fontSize:M.title_size+"px"}},e[r]),Z())))}return wp.element.createElement("ul",{className:"exactmetrics-widget-popular-posts-list"},n)}}())))]}),save:function(e){return null}})},function(e,t,n){"use strict";var r={};r.widgetpop=wp.element.createElement("svg",{width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 0C0.895431 0 0 0.895431 0 2V10C0 11.1046 0.895431 12 2 12H14C15.1046 12 16 11.1046 16 10V2C16 0.895431 15.1046 0 14 0H2ZM8.94046 4.70557L8 2L7.05954 4.70557L4.19577 4.76393L6.47831 6.49443L5.64886 9.23607L8 7.6L10.3511 9.23607L9.52169 6.49443L11.8042 4.76393L8.94046 4.70557ZM0 14H14V16H0V14ZM10 18H0V20H10V18Z",fill:"#555D66"})),r.alpha=wp.element.createElement("svg",{width:"74",height:"46",viewBox:"0 0 74 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"46",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"7.39999",y:"12",width:"59.2",height:"9",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"7.39999",y:"25",width:"51.8",height:"9",rx:"2",fill:"#6528F5"})),r.beta=wp.element.createElement("svg",{width:"74",height:"46",viewBox:"0 0 74 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M0 15C0 13.3431 1.34315 12 3 12H4V34H3C1.34315 34 0 32.6569 0 31V15Z",fill:"#6528F5"}),wp.element.createElement("rect",{x:"12",y:"12",width:"54",height:"9",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"12",y:"25",width:"44",height:"9",rx:"2",fill:"#8453F7"})),r.charlie=wp.element.createElement("svg",{width:"74",height:"46",viewBox:"0 0 74 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"46",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{width:"74",height:"4",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"14",width:"58",height:"9",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"8",y:"27",width:"40",height:"9",rx:"2",fill:"#8453F7"})),r.delta=wp.element.createElement("svg",{width:"74",height:"39",viewBox:"0 0 74 39",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"31",y:"12",width:"43",height:"7",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"31",y:"23",width:"32",height:"7",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"31",y:"34",width:"43",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{y:"12",width:"27",height:"27",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{width:"74",height:"4",fill:"#6528F5"})),r.echo=wp.element.createElement("svg",{width:"74",height:"76",viewBox:"0 0 74 76",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"76",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"41",width:"58",height:"7",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"61",width:"7",height:"7",rx:"3.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"8",y:"8",width:"58",height:"29",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"52",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"52",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.foxtrot=wp.element.createElement("svg",{width:"74",height:"43",viewBox:"0 0 74 43",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"43",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"8",width:"58",height:"7",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"28",width:"7",height:"7",rx:"3.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"8",y:"19",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"19",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.golf=wp.element.createElement("svg",{width:"74",height:"56",viewBox:"0 0 74 56",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"56",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"21",width:"58",height:"7",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"41",width:"7",height:"7",rx:"3.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"8",y:"8",width:"16",height:"9",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"32",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"32",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.hotel=wp.element.createElement("svg",{width:"74",height:"50",viewBox:"0 0 74 50",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"50",rx:"5",fill:"#6528F5"}),wp.element.createElement("path",{d:"M54.0625 42H19.9375C18.8438 42 17.9141 41.6111 17.1484 40.8333C16.3828 40.0556 16 39.1111 16 38V14C16 12.8889 16.3828 11.9444 17.1484 11.1667C17.9141 10.3889 18.8438 10 19.9375 10H54.0625C55.1562 10 56.0859 10.3889 56.8516 11.1667C57.6172 11.9444 58 12.8889 58 14V38C58 39.1111 57.6172 40.0556 56.8516 40.8333C56.0859 41.6111 55.1562 42 54.0625 42ZM28.3867 16.0833C27.5117 15.1389 26.4453 14.6667 25.1875 14.6667C23.9297 14.6667 22.8359 15.1389 21.9062 16.0833C21.0312 16.9722 20.5938 18.0556 20.5938 19.3333C20.5938 20.6111 21.0312 21.7222 21.9062 22.6667C22.8359 23.5556 23.9297 24 25.1875 24C26.4453 24 27.5117 23.5556 28.3867 22.6667C29.3164 21.7222 29.7812 20.6111 29.7812 19.3333C29.7812 18.0556 29.3164 16.9722 28.3867 16.0833ZM21.25 36.6667H52.75V27.3333L45.5312 20C45.0938 19.5556 44.6562 19.5556 44.2188 20L33.0625 31.3333L28.4688 26.6667C28.0312 26.2222 27.5938 26.2222 27.1562 26.6667L21.25 32.6667V36.6667Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"8",y:"26",width:"58",height:"7",rx:"2",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"37",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"37",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.comments=function(e){return wp.element.createElement("svg",{width:"13",height:"12",viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{fill:e}},wp.element.createElement("path",{d:"M7.8251 1.25893C8.70332 2.09821 9.14243 3.10714 9.14243 4.28571C9.14243 5.46429 8.70332 6.47321 7.8251 7.3125C6.94689 8.15179 5.8887 8.57143 4.65056 8.57143C3.78674 8.57143 2.98771 8.34821 2.25346 7.90179C1.63439 8.34821 0.993719 8.57143 0.331456 8.57143C0.302662 8.57143 0.273868 8.5625 0.245074 8.54464C0.216279 8.50893 0.194684 8.47321 0.180287 8.4375C0.151493 8.34821 0.158691 8.26786 0.201882 8.19643C0.50422 7.83929 0.763366 7.35714 0.979321 6.75C0.432235 6.01786 0.158691 5.19643 0.158691 4.28571C0.158691 3.10714 0.5978 2.09821 1.47602 1.25893C2.35424 0.419643 3.41242 0 4.65056 0C5.8887 0 6.94689 0.419643 7.8251 1.25893ZM11.7771 10.1786C11.993 10.7857 12.2522 11.2679 12.5545 11.625C12.5977 11.6964 12.6049 11.7768 12.5761 11.8661C12.5473 11.9554 12.4969 12 12.425 12C11.7627 12 11.122 11.7768 10.5029 11.3304C9.7687 11.7768 8.96967 12 8.10585 12C7.18444 12 6.34941 11.7589 5.60076 11.2768C4.85212 10.7946 4.30503 10.1607 3.9595 9.375C4.21865 9.41071 4.449 9.42857 4.65056 9.42857C6.07587 9.42857 7.29241 8.92857 8.30021 7.92857C9.32239 6.91071 9.83349 5.69643 9.83349 4.28571C9.83349 4.08929 9.82629 3.91071 9.81189 3.75C10.6325 4.07143 11.302 4.59821 11.8203 5.33036C12.3386 6.04464 12.5977 6.83929 12.5977 7.71429C12.5977 8.625 12.3242 9.44643 11.7771 10.1786Z"}))},t.a=r},function(e,t,n){"use strict";var r=n(152),i=n.n(r),o=n(156),a=n.n(o),l=n(157),s=n.n(l),c=n(158),u=n.n(c),d=n(171),p=n.n(d),h=n(18),m=(n.n(h),n(179),n(189)),f=wp.components.CheckboxControl,g=function(e){function t(){a()(this,t);var e=u()(this,(t.__proto__||i()(t)).call(this));return e.state={},e}return p()(t,e),s()(t,[{key:"renderTerms",value:function(e){return e.map(function(e){return wp.element.createElement("div",{key:e.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},wp.element.createElement(f,{checked:!0,label:Object(h.unescape)(e.name)}))})}},{key:"render",value:function(){return[wp.element.createElement("label",{key:"exactmetrics-hierarchical-term-list-label",className:"components-base-control__label"},this.props.label,wp.element.createElement("span",{className:"exactmetrics-popular-posts-pro-pill"},"PRO")),wp.element.createElement("div",{className:"editor-post-taxonomies__hierarchical-terms-list exactmetrics-hierarchical-terms exactmetrics-hierarchical-terms-disabled",key:"exactmetrics-hierarchical-term-list",tabIndex:"0",role:"group"},this.renderTerms([{name:"News",id:1},{name:"Technology",id:2}]))]}}]),t}(m.a);t.a=g},function(e,t,n){e.exports={default:n(153),__esModule:!0}},function(e,t,n){n(154),e.exports=n(0).Object.getPrototypeOf},function(e,t,n){var r=n(16),i=n(52);n(155)("getPrototypeOf",function(){return function(e){return i(r(e))}})},function(e,t,n){var r=n(4),i=n(0),o=n(12);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",a)}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(66),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,i.default)(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},function(e,t,n){"use strict";t.__esModule=!0;var r=n(69),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,i.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){e.exports={default:n(160),__esModule:!0}},function(e,t,n){n(19),n(38),e.exports=n(40).f("iterator")},function(e,t,n){e.exports={default:n(162),__esModule:!0}},function(e,t,n){n(163),n(168),n(169),n(170),e.exports=n(0).Symbol},function(e,t,n){"use strict";var r=n(5),i=n(9),o=n(7),a=n(4),l=n(48),s=n(164).KEY,c=n(12),u=n(34),d=n(36),p=n(22),h=n(2),m=n(40),f=n(41),g=n(165),w=n(166),y=n(8),v=n(11),b=n(16),S=n(14),E=n(30),C=n(15),x=n(31),_=n(167),k=n(71),O=n(37),T=n(6),M=n(21),N=k.f,F=T.f,P=_.f,j=r.Symbol,D=r.JSON,A=D&&D.stringify,L=h("_hidden"),B=h("toPrimitive"),z={}.propertyIsEnumerable,H=u("symbol-registry"),R=u("symbols"),I=u("op-symbols"),q=Object.prototype,V="function"==typeof j&&!!O.f,W=r.QObject,Z=!W||!W.prototype||!W.prototype.findChild,U=o&&c(function(){return 7!=x(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=N(q,t);r&&delete q[t],F(e,t,n),r&&e!==q&&F(q,t,r)}:F,Y=function(e){var t=R[e]=x(j.prototype);return t._k=e,t},X=V&&"symbol"==typeof j.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof j},K=function(e,t,n){return e===q&&K(I,t,n),y(e),t=E(t,!0),y(n),i(R,t)?(n.enumerable?(i(e,L)&&e[L][t]&&(e[L][t]=!1),n=x(n,{enumerable:C(0,!1)})):(i(e,L)||F(e,L,C(1,{})),e[L][t]=!0),U(e,t,n)):F(e,t,n)},G=function(e,t){y(e);for(var n,r=g(t=S(t)),i=0,o=r.length;o>i;)K(e,n=r[i++],t[n]);return e},$=function(e,t){return void 0===t?x(e):G(x(e),t)},J=function(e){var t=z.call(this,e=E(e,!0));return!(this===q&&i(R,e)&&!i(I,e))&&(!(t||!i(this,e)||!i(R,e)||i(this,L)&&this[L][e])||t)},Q=function(e,t){if(e=S(e),t=E(t,!0),e!==q||!i(R,t)||i(I,t)){var n=N(e,t);return!n||!i(R,t)||i(e,L)&&e[L][t]||(n.enumerable=!0),n}},ee=function(e){for(var t,n=P(S(e)),r=[],o=0;n.length>o;)i(R,t=n[o++])||t==L||t==s||r.push(t);return r},te=function(e){for(var t,n=e===q,r=P(n?I:S(e)),o=[],a=0;r.length>a;)!i(R,t=r[a++])||n&&!i(q,t)||o.push(R[t]);return o};V||(j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(n){this===q&&t.call(I,n),i(this,L)&&i(this[L],e)&&(this[L][e]=!1),U(this,e,C(1,n))};return o&&Z&&U(q,e,{configurable:!0,set:t}),Y(e)},l(j.prototype,"toString",function(){return this._k}),k.f=Q,T.f=K,n(70).f=_.f=ee,n(24).f=J,O.f=te,o&&!n(20)&&l(q,"propertyIsEnumerable",J,!0),m.f=function(e){return Y(h(e))}),a(a.G+a.W+a.F*!V,{Symbol:j});for(var ne="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;ne.length>re;)h(ne[re++]);for(var ie=M(h.store),oe=0;ie.length>oe;)f(ie[oe++]);a(a.S+a.F*!V,"Symbol",{for:function(e){return i(H,e+="")?H[e]:H[e]=j(e)},keyFor:function(e){if(!X(e))throw TypeError(e+" is not a symbol!");for(var t in H)if(H[t]===e)return t},useSetter:function(){Z=!0},useSimple:function(){Z=!1}}),a(a.S+a.F*!V,"Object",{create:$,defineProperty:K,defineProperties:G,getOwnPropertyDescriptor:Q,getOwnPropertyNames:ee,getOwnPropertySymbols:te});var ae=c(function(){O.f(1)});a(a.S+a.F*ae,"Object",{getOwnPropertySymbols:function(e){return O.f(b(e))}}),D&&a(a.S+a.F*(!V||c(function(){var e=j();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(v(t)||void 0!==e)&&!X(e))return w(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!X(t))return t}),r[1]=t,A.apply(D,r)}}),j.prototype[B]||n(10)(j.prototype,B,j.prototype.valueOf),d(j,"Symbol"),d(Math,"Math",!0),d(r.JSON,"JSON",!0)},function(e,t,n){var r=n(22)("meta"),i=n(11),o=n(9),a=n(6).f,l=0,s=Object.isExtensible||function(){return!0},c=!n(12)(function(){return s(Object.preventExtensions({}))}),u=function(e){a(e,r,{value:{i:"O"+ ++l,w:{}}})},d=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!s(e))return"F";if(!t)return"E";u(e)}return e[r].i},p=function(e,t){if(!o(e,r)){if(!s(e))return!0;if(!t)return!1;u(e)}return e[r].w},h=function(e){return c&&m.NEED&&s(e)&&!o(e,r)&&u(e),e},m=e.exports={KEY:r,NEED:!1,fastKey:d,getWeak:p,onFreeze:h}},function(e,t,n){var r=n(21),i=n(37),o=n(24);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var a,l=n(e),s=o.f,c=0;l.length>c;)s.call(e,a=l[c++])&&t.push(a);return t}},function(e,t,n){var r=n(32);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(14),i=n(70).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],l=function(e){try{return i(e)}catch(e){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?l(e):i(r(e))}},function(e,t){},function(e,t,n){n(41)("asyncIterator")},function(e,t,n){n(41)("observable")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(172),o=r(i),a=n(176),l=r(a),s=n(69),c=r(s);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,c.default)(t)));e.prototype=(0,l.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o.default?(0,o.default)(e,t):e.__proto__=t)}},function(e,t,n){e.exports={default:n(173),__esModule:!0}},function(e,t,n){n(174),e.exports=n(0).Object.setPrototypeOf},function(e,t,n){var r=n(4);r(r.S,"Object",{setPrototypeOf:n(175).set})},function(e,t,n){var r=n(11),i=n(8),o=function(e,t){if(i(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=n(29)(Function.call,n(71).f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){e.exports={default:n(177),__esModule:!0}},function(e,t,n){n(178);var r=n(0).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){var r=n(4);r(r.S,"Object",{create:n(31)})},function(e,t,n){"use strict";n(180),n(72),n(188)},function(e,t,n){"use strict";var r=n(181),i=n.n(r),o=n(182);n.n(o),i()(console.error)},function(e,t,n){function r(e,t){function n(){var n,a,l=r,s=arguments.length;e:for(;l;){if(l.args.length===arguments.length){for(a=0;a<s;a++)if(l.args[a]!==arguments[a]){l=l.next;continue e}return l!==r&&(l===i&&(i=l.prev),l.prev.next=l.next,l.next&&(l.next.prev=l.prev),l.next=r,l.prev=null,r.prev=l,r=l),l.val}l=l.next}for(n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];return l={args:n,val:e.apply(null,n)},r?(r.prev=l,l.next=r):i=l,o===t.maxSize?(i=i.prev,i.next=null):o++,r=l,l.val}var r,i,o=0;return t=t||{},n.clear=function(){r=null,i=null,o=0},n}e.exports=r},function(e,t,n){var r;!function(){"use strict";function i(e){return a(l(e),arguments)}function o(e,t){return i.apply(null,[e].concat(t||[]))}function a(e,t){var n,r,o,a,l,c,u,d,p,h=1,m=e.length,f="";for(r=0;r<m;r++)if("string"==typeof e[r])f+=e[r];else if("object"==typeof e[r]){if(a=e[r],a.keys)for(n=t[h],o=0;o<a.keys.length;o++){if(void 0==n)throw new Error(i('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));n=n[a.keys[o]]}else n=a.param_no?t[a.param_no]:t[h++];if(s.not_type.test(a.type)&&s.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),s.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(i("[sprintf] expecting number but found %T",n));switch(s.number.test(a.type)&&(d=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}s.json.test(a.type)?f+=n:(!s.number.test(a.type)||d&&!a.sign?p="":(p=d?"+":"-",n=n.toString().replace(s.sign,"")),c=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",u=a.width-(p+n).length,l=a.width&&u>0?c.repeat(u):"",f+=a.align?p+n+l:"0"===c?p+l+n:l+p+n)}return f}function l(e){if(c[e])return c[e];for(var t,n=e,r=[],i=0;n;){if(null!==(t=s.text.exec(n)))r.push(t[0]);else if(null!==(t=s.modulo.exec(n)))r.push("%");else{if(null===(t=s.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){i|=1;var o=[],a=t[2],l=[];if(null===(l=s.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(l[1]);""!==(a=a.substring(l[0].length));)if(null!==(l=s.key_access.exec(a)))o.push(l[1]);else{if(null===(l=s.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(l[1])}t[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return c[e]=r}var s={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/},c=Object.create(null);t.sprintf=i,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=i,window.vsprintf=o,void 0!==(r=function(){return{sprintf:i,vsprintf:o}}.call(t,n,t,e))&&(e.exports=r))}()},function(e,t,n){"use strict";function r(e){var t,n,r;for(t=e.split(";"),n=0;n<t.length;n++)if(r=t[n].trim(),0===r.indexOf("plural="))return r.substr(7)}function i(e,t){var n;this.data=e,this.pluralForms={},this.options={};for(n in a)this.options[n]=void 0!==t&&n in t?t[n]:a[n]}t.a=i;var o=n(184),a={contextDelimiter:"",onMissingKey:null};i.prototype.getPluralForm=function(e,t){var n,i,a,l=this.pluralForms[e];return l||(n=this.data[e][""],a=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,"function"!=typeof a&&(i=r(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),a=Object(o.a)(i)),l=this.pluralForms[e]=a),l(t)},i.prototype.dcnpgettext=function(e,t,n,r,i){var o,a,l;return o=void 0===i?0:this.getPluralForm(e,i),a=n,t&&(a=t+this.options.contextDelimiter+n),(l=this.data[e][a])&&l[o]?l[o]:(this.options.onMissingKey&&this.options.onMissingKey(n,e),0===o?n:r)}},function(e,t,n){"use strict";function r(e){var t=Object(i.a)(e);return function(e){return+t({n:e})}}t.a=r;var i=n(185)},function(e,t,n){"use strict";function r(e){var t=Object(i.a)(e);return function(e){return Object(o.a)(t,e)}}t.a=r;var i=n(186),o=n(187)},function(e,t,n){"use strict";function r(e){for(var t,n,r,s,c=[],u=[];t=e.match(l);){for(n=t[0],r=e.substr(0,t.index).trim(),r&&c.push(r);s=u.pop();){if(a[n]){if(a[n][0]===s){n=a[n][1]||n;break}}else if(o.indexOf(s)>=0||i[s]<i[n]){u.push(s);break}c.push(s)}a[n]||u.push(n),e=e.substr(t.index+n.length)}return e=e.trim(),e&&c.push(e),c.concat(u.reverse())}t.a=r;var i,o,a,l;i={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},o=["(","?"],a={")":["("],":":["?","?:"]},l=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/},function(e,t,n){"use strict";function r(e,t){var n,r,o,a,l,s,c=[];for(n=0;n<e.length;n++){if(l=e[n],a=i[l]){for(r=a.length,o=Array(r);r--;)o[r]=c.pop();try{s=a.apply(null,o)}catch(e){return e}}else s=t.hasOwnProperty(l)?t[l]:+l;c.push(s)}return c[0]}t.a=r;var i={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,n){if(e)throw t;return n}}},function(e,t,n){"use strict";var r=n(72),i=Object(r.a)();i.setLocaleData.bind(i),i.__.bind(i),i._x.bind(i),i._n.bind(i),i._nx.bind(i),i.isRTL.bind(i)},function(e,t,n){"use strict";var r=(n(190),n(42));n.d(t,"a",function(){return r.a});n(200),n(202),n(203),n(204),n(76)},function(e,t,n){"use strict";var r=(n(191),n(75),n(195),n(39));n.n(r)},function(e,t,n){"use strict";function r(e,t){return Object(i.a)(e)||Object(o.a)(e,t)||Object(a.a)(e,t)||Object(l.a)()}t.a=r;var i=n(192),o=n(193),a=n(73),l=n(194)},function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}t.a=r},function(e,t,n){"use strict";function r(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,l=e[Symbol.iterator]();!(r=(a=l.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw o}}return n}}t.a=r},function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}t.a=r},function(e,t,n){"use strict";function r(e){return Object(i.a)(e)||Object(o.a)(e)||Object(a.a)(e)||Object(l.a)()}t.a=r;var i=n(196),o=n(197),a=n(73),l=n(198)},function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return Object(i.a)(e)}t.a=r;var i=n(74)},function(e,t,n){"use strict";function r(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}t.a=r},function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}t.a=r},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}t.a=r},function(e,t,n){"use strict";var r=n(201);n.n(r)},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";var r=n(18);n.n(r)},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=(n(26),n(43),n(75),n(18)),i=(n.n(r),n(205),n(42)),o=(n(76),Object(i.d)(void 0));o.Provider,o.Consumer,Object(i.f)(function(){return null}),new Set(["string","boolean","number"]),new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),new Set(["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"]),new Set(["autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"]),new Set(["animation","animationIterationCount","baselineShift","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","cx","cy","fillOpacity","flexGrow","flexShrink","floodOpacity","fontWeight","gridColumnEnd","gridColumnStart","gridRowEnd","gridRowStart","lineHeight","opacity","order","orphans","r","rx","ry","shapeImageThreshold","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","x","y","zIndex","zoom"])},function(e,t,n){"use strict";function r(e){return e.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi,"&")}function i(e){return e.replace(/"/g,""")}function o(e){return e.replace(/</g,"<")}function a(e){return Object(c.a)(i(r(e)))}function l(e){return o(r(e))}function s(e){return!u.test(e)}t.a=a,t.b=l,t.c=s;var c=n(206),u=/[\u007F-\u009F "'>\/="\uFDD0-\uFDEF]/},function(e,t,n){"use strict";function r(e){return e.replace(/>/g,">")}t.a=r}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=80)}([function(e,t){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,n){"use strict";function r(e){return"[object Array]"===x.call(e)}function i(e){return void 0===e}function o(e){return null!==e&&!i(e)&&null!==e.constructor&&!i(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function a(e){return"[object ArrayBuffer]"===x.call(e)}function l(e){return"undefined"!=typeof FormData&&e instanceof FormData}function s(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function c(e){return"string"==typeof e}function u(e){return"number"==typeof e}function d(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===x.call(e)}function h(e){return"[object File]"===x.call(e)}function m(e){return"[object Blob]"===x.call(e)}function f(e){return"[object Function]"===x.call(e)}function g(e){return d(e)&&f(e.pipe)}function w(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function y(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function v(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}function S(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=S(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)b(arguments[n],e);return t}function E(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=E(t[n],e):t[n]="object"==typeof e?E({},e):e}for(var t={},n=0,r=arguments.length;n<r;n++)b(arguments[n],e);return t}function C(e,t,n){return b(t,function(t,r){e[r]=n&&"function"==typeof t?_(t,n):t}),e}var _=n(57),x=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:a,isBuffer:o,isFormData:l,isArrayBufferView:s,isString:c,isNumber:u,isObject:d,isUndefined:i,isDate:p,isFile:h,isBlob:m,isFunction:f,isStream:g,isURLSearchParams:w,isStandardBrowserEnv:v,forEach:b,merge:S,deepMerge:E,extend:C,trim:y}},function(e,t,n){var r=n(35)("wks"),i=n(22),o=n(5).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){var r,i;/*!
|
2 |
+
Copyright (c) 2018 Jed Watson.
|
3 |
Licensed under the MIT License (MIT), see
|
4 |
http://jedwatson.github.io/classnames
|
5 |
*/
|
6 |
+
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=n.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var l in r)o.call(r,l)&&r[l]&&e.push(l);else e.push(r.toString())}}return e.join(" ")}var o={}.hasOwnProperty;void 0!==e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(i=function(){return n}.apply(t,r))&&(e.exports=i))}()},function(e,t,n){var r=n(5),i=n(0),o=n(30),a=n(10),l=n(9),s=function(e,t,n){var c,u,d,p=e&s.F,h=e&s.G,m=e&s.S,f=e&s.P,g=e&s.B,w=e&s.W,y=h?i:i[t]||(i[t]={}),v=y.prototype,b=h?r:m?r[t]:(r[t]||{}).prototype;h&&(n=t);for(c in n)(u=!p&&b&&void 0!==b[c])&&l(y,c)||(d=u?b[c]:n[c],y[c]=h&&"function"!=typeof b[c]?n[c]:g&&u?o(d,r):w&&b[c]==d?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(d):f&&"function"==typeof d?o(Function.call,d):d,f&&((y.virtual||(y.virtual={}))[c]=d,e&s.R&&v&&!v[c]&&a(v,c,d)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var r=n(8),i=n(46),o=n(31),a=Object.defineProperty;t.f=n(7)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports=!n(12)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(11);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(6),i=n(15);e.exports=n(7)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports={}},function(e,t,n){var r=n(50),i=n(29);e.exports=function(e){return r(i(e))}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(29);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";var r={};r.headline=wp.element.createElement("svg",{width:"15",height:"14",viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M13.5 2V12H14.5C14.6458 12 14.7604 12.0521 14.8438 12.1562C14.9479 12.2396 15 12.3542 15 12.5V13.5C15 13.6458 14.9479 13.7604 14.8438 13.8438C14.7604 13.9479 14.6458 14 14.5 14H9.5C9.35417 14 9.22917 13.9479 9.125 13.8438C9.04167 13.7604 9 13.6458 9 13.5V12.5C9 12.3542 9.04167 12.2396 9.125 12.1562C9.22917 12.0521 9.35417 12 9.5 12H10.5V8H4.5V12H5.5C5.64583 12 5.76042 12.0521 5.84375 12.1562C5.94792 12.2396 6 12.3542 6 12.5V13.5C6 13.6458 5.94792 13.7604 5.84375 13.8438C5.76042 13.9479 5.64583 14 5.5 14H0.5C0.354167 14 0.229167 13.9479 0.125 13.8438C0.0416667 13.7604 0 13.6458 0 13.5V12.5C0 12.3542 0.0416667 12.2396 0.125 12.1562C0.229167 12.0521 0.354167 12 0.5 12H1.5V2H0.5C0.354167 2 0.229167 1.95833 0.125 1.875C0.0416667 1.77083 0 1.64583 0 1.5V0.5C0 0.354167 0.0416667 0.239583 0.125 0.15625C0.229167 0.0520833 0.354167 0 0.5 0H5.5C5.64583 0 5.76042 0.0520833 5.84375 0.15625C5.94792 0.239583 6 0.354167 6 0.5V1.5C6 1.64583 5.94792 1.77083 5.84375 1.875C5.76042 1.95833 5.64583 2 5.5 2H4.5V6H10.5V2H9.5C9.35417 2 9.22917 1.95833 9.125 1.875C9.04167 1.77083 9 1.64583 9 1.5V0.5C9 0.354167 9.04167 0.239583 9.125 0.15625C9.22917 0.0520833 9.35417 0 9.5 0H14.5C14.6458 0 14.7604 0.0520833 14.8438 0.15625C14.9479 0.239583 15 0.354167 15 0.5V1.5C15 1.64583 14.9479 1.77083 14.8438 1.875C14.7604 1.95833 14.6458 2 14.5 2H13.5Z",fill:"white"})),r.headlineBlack=wp.element.createElement("svg",{width:"15",height:"14",viewBox:"0 0 15 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M13.5 2V12H14.5C14.6458 12 14.7604 12.0521 14.8438 12.1562C14.9479 12.2396 15 12.3542 15 12.5V13.5C15 13.6458 14.9479 13.7604 14.8438 13.8438C14.7604 13.9479 14.6458 14 14.5 14H9.5C9.35417 14 9.22917 13.9479 9.125 13.8438C9.04167 13.7604 9 13.6458 9 13.5V12.5C9 12.3542 9.04167 12.2396 9.125 12.1562C9.22917 12.0521 9.35417 12 9.5 12H10.5V8H4.5V12H5.5C5.64583 12 5.76042 12.0521 5.84375 12.1562C5.94792 12.2396 6 12.3542 6 12.5V13.5C6 13.6458 5.94792 13.7604 5.84375 13.8438C5.76042 13.9479 5.64583 14 5.5 14H0.5C0.354167 14 0.229167 13.9479 0.125 13.8438C0.0416667 13.7604 0 13.6458 0 13.5V12.5C0 12.3542 0.0416667 12.2396 0.125 12.1562C0.229167 12.0521 0.354167 12 0.5 12H1.5V2H0.5C0.354167 2 0.229167 1.95833 0.125 1.875C0.0416667 1.77083 0 1.64583 0 1.5V0.5C0 0.354167 0.0416667 0.239583 0.125 0.15625C0.229167 0.0520833 0.354167 0 0.5 0H5.5C5.64583 0 5.76042 0.0520833 5.84375 0.15625C5.94792 0.239583 6 0.354167 6 0.5V1.5C6 1.64583 5.94792 1.77083 5.84375 1.875C5.76042 1.95833 5.64583 2 5.5 2H4.5V6H10.5V2H9.5C9.35417 2 9.22917 1.95833 9.125 1.875C9.04167 1.77083 9 1.64583 9 1.5V0.5C9 0.354167 9.04167 0.239583 9.125 0.15625C9.22917 0.0520833 9.35417 0 9.5 0H14.5C14.6458 0 14.7604 0.0520833 14.8438 0.15625C14.9479 0.239583 15 0.354167 15 0.5V1.5C15 1.64583 14.9479 1.77083 14.8438 1.875C14.7604 1.95833 14.6458 2 14.5 2H13.5Z",fill:"#000"})),r.warning=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M16 8C16 6.58065 15.6129 5.22581 14.9032 4C14.1935 2.77419 13.2258 1.80645 12 1.09677C10.7742 0.387097 9.41936 0 8 0C6.54839 0 5.22581 0.387097 4 1.09677C2.77419 1.80645 1.77419 2.77419 1.06452 4C0.354839 5.22581 0 6.58065 0 8C0 9.45161 0.354839 10.7742 1.06452 12C1.77419 13.2258 2.77419 14.2258 4 14.9355C5.22581 15.6452 6.54839 16 8 16C9.41936 16 10.7742 15.6452 12 14.9355C13.2258 14.2258 14.1935 13.2258 14.9032 12C15.6129 10.7742 16 9.45161 16 8ZM8 9.6129C8.3871 9.6129 8.74194 9.77419 9.03226 10.0645C9.32258 10.3548 9.48387 10.7097 9.48387 11.0968C9.48387 11.5161 9.32258 11.871 9.03226 12.1613C8.74194 12.4516 8.3871 12.5806 8 12.5806C7.58065 12.5806 7.22581 12.4516 6.93548 12.1613C6.64516 11.871 6.51613 11.5161 6.51613 11.0968C6.51613 10.7097 6.64516 10.3548 6.93548 10.0645C7.22581 9.77419 7.58065 9.6129 8 9.6129ZM6.58065 4.29032C6.58065 4.16129 6.6129 4.06452 6.67742 4C6.74194 3.93548 6.83871 3.87097 6.96774 3.87097H9.03226C9.12903 3.87097 9.22581 3.93548 9.29032 4C9.35484 4.06452 9.41936 4.16129 9.41936 4.29032L9.16129 8.67742C9.16129 8.77419 9.09677 8.87097 9.03226 8.93548C8.96774 9 8.87097 9.03226 8.77419 9.03226H7.22581C7.09677 9.03226 7 9 6.93548 8.93548C6.87097 8.87097 6.83871 8.77419 6.83871 8.67742L6.58065 4.29032Z",fill:"#F2994A"})),r.smile=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484ZM11.2903 5.74194C11.0968 5.52688 10.8602 5.41935 10.5806 5.41935C10.3011 5.41935 10.0538 5.52688 9.83871 5.74194C9.64516 5.93548 9.54839 6.17204 9.54839 6.45161C9.54839 6.73118 9.64516 6.97849 9.83871 7.19355C10.0538 7.3871 10.3011 7.48387 10.5806 7.48387C10.8602 7.48387 11.0968 7.3871 11.2903 7.19355C11.5054 6.97849 11.6129 6.73118 11.6129 6.45161C11.6129 6.17204 11.5054 5.93548 11.2903 5.74194ZM6.12903 5.74194C5.93548 5.52688 5.69892 5.41935 5.41935 5.41935C5.13978 5.41935 4.89247 5.52688 4.67742 5.74194C4.48387 5.93548 4.3871 6.17204 4.3871 6.45161C4.3871 6.73118 4.48387 6.97849 4.67742 7.19355C4.89247 7.3871 5.13978 7.48387 5.41935 7.48387C5.69892 7.48387 5.93548 7.3871 6.12903 7.19355C6.34409 6.97849 6.45161 6.73118 6.45161 6.45161C6.45161 6.17204 6.34409 5.93548 6.12903 5.74194ZM11.7097 10.9032C11.7957 10.8172 11.8387 10.7204 11.8387 10.6129C11.8387 10.4839 11.8065 10.3871 11.7419 10.3226C11.6774 10.2366 11.5914 10.172 11.4839 10.129C11.3978 10.0645 11.3011 10.043 11.1935 10.0645C11.086 10.086 10.9892 10.1505 10.9032 10.2581C10.1505 11.1613 9.1828 11.6129 8 11.6129C6.8172 11.6129 5.84946 11.1613 5.09677 10.2581C5.01075 10.1505 4.91398 10.086 4.80645 10.0645C4.69892 10.043 4.5914 10.0645 4.48387 10.129C4.39785 10.172 4.32258 10.2366 4.25806 10.3226C4.19355 10.3871 4.16129 10.4839 4.16129 10.6129C4.16129 10.7204 4.2043 10.8172 4.29032 10.9032C5.25806 12.0645 6.49462 12.6452 8 12.6452C9.50538 12.6452 10.7419 12.0645 11.7097 10.9032Z",fill:"#1EC185"})),r.neutral=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484ZM6.12903 5.74194C5.93548 5.52688 5.69892 5.41935 5.41935 5.41935C5.13978 5.41935 4.89247 5.52688 4.67742 5.74194C4.48387 5.93548 4.3871 6.17204 4.3871 6.45161C4.3871 6.73118 4.48387 6.97849 4.67742 7.19355C4.89247 7.3871 5.13978 7.48387 5.41935 7.48387C5.69892 7.48387 5.93548 7.3871 6.12903 7.19355C6.34409 6.97849 6.45161 6.73118 6.45161 6.45161C6.45161 6.17204 6.34409 5.93548 6.12903 5.74194ZM11.0968 11.6129C11.4409 11.6129 11.6129 11.4409 11.6129 11.0968C11.6129 10.7527 11.4409 10.5806 11.0968 10.5806H4.90323C4.55914 10.5806 4.3871 10.7527 4.3871 11.0968C4.3871 11.4409 4.55914 11.6129 4.90323 11.6129H11.0968ZM9.83871 7.19355C10.0538 7.3871 10.3011 7.48387 10.5806 7.48387C10.8602 7.48387 11.0968 7.3871 11.2903 7.19355C11.5054 6.97849 11.6129 6.73118 11.6129 6.45161C11.6129 6.17204 11.5054 5.93548 11.2903 5.74194C11.0968 5.52688 10.8602 5.41935 10.5806 5.41935C10.3011 5.41935 10.0538 5.52688 9.83871 5.74194C9.64516 5.93548 9.54839 6.17204 9.54839 6.45161C9.54839 6.73118 9.64516 6.97849 9.83871 7.19355Z",fill:"#626D83"})),r.negative=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484ZM4.3871 7.48387C4.3871 7.76344 4.48387 8.01075 4.67742 8.22581C4.89247 8.41935 5.13978 8.51613 5.41935 8.51613C5.69892 8.51613 5.93548 8.41935 6.12903 8.22581C6.34409 8.01075 6.45161 7.76344 6.45161 7.48387C6.45161 7.44086 6.43011 7.35484 6.3871 7.22581C6.4086 7.22581 6.41935 7.22581 6.41935 7.22581C6.44086 7.22581 6.45161 7.22581 6.45161 7.22581C6.70968 7.22581 6.87097 7.10753 6.93548 6.87097C6.95699 6.78495 6.96774 6.70968 6.96774 6.64516C6.96774 6.58065 6.94624 6.52688 6.90323 6.48387C6.88172 6.41935 6.83871 6.36559 6.77419 6.32258C6.73118 6.27957 6.67742 6.24731 6.6129 6.22581L4.03226 5.45161C3.88172 5.4086 3.74194 5.41935 3.6129 5.48387C3.50538 5.54839 3.43011 5.64516 3.3871 5.77419C3.36559 5.86021 3.35484 5.93548 3.35484 6C3.37634 6.06452 3.39785 6.12903 3.41935 6.19355C3.44086 6.23656 3.47312 6.27957 3.51613 6.32258C3.58065 6.36559 3.65591 6.39785 3.74194 6.41935L4.70968 6.74194C4.49462 6.93548 4.3871 7.1828 4.3871 7.48387ZM9.80645 12.4516C9.93548 12.6237 10.0968 12.6882 10.2903 12.6452C10.4839 12.6021 10.6129 12.4946 10.6774 12.3226C10.7419 12.1505 10.7097 11.9785 10.5806 11.8065C9.91398 10.9892 9.05376 10.5806 8 10.5806C6.94624 10.5806 6.07527 10.9892 5.3871 11.8065C5.34409 11.871 5.31183 11.9462 5.29032 12.0323C5.26882 12.1183 5.26882 12.1935 5.29032 12.2581C5.31183 12.3226 5.34409 12.3871 5.3871 12.4516C5.43011 12.5161 5.48387 12.5699 5.54839 12.6129C5.6129 12.6344 5.67742 12.6559 5.74194 12.6774C5.82796 12.6774 5.90323 12.6667 5.96774 12.6452C6.05376 12.6021 6.12903 12.5376 6.19355 12.4516C6.64516 11.914 7.24731 11.6452 8 11.6452C8.75269 11.6452 9.35484 11.914 9.80645 12.4516ZM12.2903 6.41935C12.4194 6.37634 12.5161 6.30107 12.5806 6.19355C12.6452 6.06452 12.6559 5.92473 12.6129 5.77419C12.5914 5.68817 12.5484 5.6129 12.4839 5.54839C12.4194 5.48387 12.3441 5.45161 12.2581 5.45161C12.172 5.43011 12.086 5.43011 12 5.45161L9.41935 6.22581C9.26882 6.26882 9.16129 6.35484 9.09677 6.48387C9.03226 6.5914 9.02151 6.72043 9.06452 6.87097C9.12903 7.10753 9.29032 7.22581 9.54839 7.22581C9.56989 7.22581 9.5914 7.22581 9.6129 7.22581C9.56989 7.33333 9.54839 7.41935 9.54839 7.48387C9.54839 7.76344 9.64516 8.01075 9.83871 8.22581C10.0538 8.41935 10.3011 8.51613 10.5806 8.51613C10.8602 8.51613 11.0968 8.41935 11.2903 8.22581C11.5054 8.01075 11.6129 7.76344 11.6129 7.48387C11.6129 7.1828 11.5054 6.93548 11.2903 6.74194L12.2903 6.41935Z",fill:"#626D83"})),r.check=wp.element.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M13.6452 2.35484C15.2151 3.90323 16 5.78495 16 8C16 10.2151 15.2151 12.1075 13.6452 13.6774C12.0968 15.2258 10.2151 16 8 16C5.78495 16 3.89247 15.2258 2.32258 13.6774C0.774194 12.1075 0 10.2151 0 8C0 5.78495 0.774194 3.90323 2.32258 2.35484C3.89247 0.784946 5.78495 0 8 0C10.2151 0 12.0968 0.784946 13.6452 2.35484ZM7.06452 12.2258L13 6.29032C13.2581 6.05376 13.2581 5.8172 13 5.58065L12.2903 4.83871C12.0323 4.60215 11.7849 4.60215 11.5484 4.83871L6.70968 9.67742L4.45161 7.41935C4.21505 7.1828 3.96774 7.1828 3.70968 7.41935L3 8.16129C2.74194 8.39785 2.74194 8.63441 3 8.87097L6.35484 12.2258C6.5914 12.4839 6.82796 12.4839 7.06452 12.2258Z",fill:"#1EC185"})),t.a=r},function(e,t){e.exports=lodash},function(e,t,n){"use strict";var r=n(87)(!0);n(45)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){e.exports=!0},function(e,t,n){var r=n(49),i=n(36);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(99),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=i.default||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var r=wp.element.Fragment,i=function(e){var t=e.barScore,n=e.width?e.width+"px":"80px",i=t>50?0:180-3.6*t,o=e.barColor;return wp.element.createElement(r,null,wp.element.createElement("div",{className:"exactmetrics-donut-container",style:{flexDirection:"column"}},wp.element.createElement("div",{className:"exactmetrics-donut",style:{width:n,paddingBottom:n,backgroundColor:"#f2f2f2"}},wp.element.createElement("div",{className:"exactmetrics-donut-sections",style:{transform:"rotate(0deg)"}},wp.element.createElement("div",{className:"exactmetrics-donut-section exactmetrics-donut-section-right",style:{transform:"rotate(0deg)"}},wp.element.createElement("div",{className:"exactmetrics-donut-filler",style:{backgroundColor:o,transform:"rotate(-"+i+"deg)"}})),function(){if(t>50){var e=180+360*(t-50)/100;return wp.element.createElement("div",{className:"exactmetrics-donut-section exactmetrics-donut-section-left",style:{transform:"rotate(0deg)"}},wp.element.createElement("div",{className:"exactmetrics-donut-filler",style:{backgroundColor:o,transform:"rotate("+e+"deg)"}}))}}()),wp.element.createElement("div",{className:"exactmetrics-donut-overlay",style:{height:"70%",width:"70%",top:"calc(15%)",left:"calc(15%)",backgroundColor:"rgb(255, 255, 255)"}}))))};t.a=i},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=r},function(e,t,n){"use strict";var r=(n(26),n(43),n(69)),i=(n.n(r),n(18));n.n(i);n.o(r,"cloneElement")&&n.d(t,"d",function(){return r.cloneElement}),n.o(r,"Component")&&n.d(t,"a",function(){return r.Component}),n.o(r,"createContext")&&n.d(t,"e",function(){return r.createContext}),n.o(r,"createElement")&&n.d(t,"f",function(){return r.createElement}),n.o(r,"forwardRef")&&n.d(t,"g",function(){return r.forwardRef}),n.o(r,"Fragment")&&n.d(t,"b",function(){return r.Fragment}),n.o(r,"isValidElement")&&n.d(t,"h",function(){return r.isValidElement}),n.o(r,"StrictMode")&&n.d(t,"c",function(){return r.StrictMode})},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(88);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(11);e.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var r=n(8),i=n(90),o=n(36),a=n(34)("IE_PROTO"),l=function(){},s=function(){var e,t=n(47)("iframe"),r=o.length;for(t.style.display="none",n(93).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object<\/script>"),e.close(),s=e.F;r--;)delete s.prototype[o[r]];return s()};e.exports=Object.create||function(e,t){var n;return null!==e?(l.prototype=r(e),n=new l,l.prototype=null,n[a]=e):n=s(),void 0===t?n:i(n,t)}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(35)("keys"),i=n(22);e.exports=function(e){return r[e]||(r[e]=i(e))}},function(e,t,n){var r=n(0),i=n(5),o=i["__core-js_shared__"]||(i["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n(20)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(6).f,i=n(9),o=n(2)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){n(105);for(var r=n(5),i=n(10),o=n(13),a=n(2)("toStringTag"),l="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),s=0;s<l.length;s++){var c=l[s],u=r[c],d=u&&u.prototype;d&&!d[a]&&i(d,a,c),o[c]=o.Array}},function(e,t,n){t.f=n(2)},function(e,t,n){var r=n(5),i=n(0),o=n(20),a=n(40),l=n(6).f;e.exports=function(e){var t=i.Symbol||(i.Symbol=o?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||l(t,e,{value:a.f(e)})}},function(e,t,n){"use strict";function r(e){return"string"!=typeof e||""===e?(console.error("The hook name must be a non-empty string."),!1):/^__/.test(e)?(console.error("The hook name cannot begin with `__`."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(e)||(console.error("The hook name can only contain numbers, letters, dashes, periods and underscores."),!1)}t.a=r},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o=Object(i.a)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}t.a=r;var i=n(211)},function(e,t,n){"use strict";t.__esModule=!0;var r=n(85),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return(0,i.default)(e)}},function(e,t,n){"use strict";var r=n(20),i=n(4),o=n(48),a=n(10),l=n(13),s=n(89),c=n(37),u=n(52),d=n(2)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};e.exports=function(e,t,n,m,f,g,w){s(n,t,m);var y,v,b,S=function(e){if(!p&&e in x)return x[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",C="values"==f,_=!1,x=e.prototype,k=x[d]||x["@@iterator"]||f&&x[f],O=k||S(f),T=f?C?S("entries"):O:void 0,F="Array"==t?x.entries||k:k;if(F&&(b=u(F.call(new e)))!==Object.prototype&&b.next&&(c(b,E,!0),r||"function"==typeof b[d]||a(b,d,h)),C&&k&&"values"!==k.name&&(_=!0,O=function(){return k.call(this)}),r&&!w||!p&&!_&&x[d]||a(x,d,O),l[t]=O,l[E]=h,f)if(y={values:C?O:S("values"),keys:g?O:S("keys"),entries:T},w)for(v in y)v in x||o(x,v,y[v]);else i(i.P+i.F*(p||_),t,y);return y}},function(e,t,n){e.exports=!n(7)&&!n(12)(function(){return 7!=Object.defineProperty(n(47)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(11),i=n(5).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t,n){e.exports=n(10)},function(e,t,n){var r=n(9),i=n(14),o=n(91)(!1),a=n(34)("IE_PROTO");e.exports=function(e,t){var n,l=i(e),s=0,c=[];for(n in l)n!=a&&r(l,n)&&c.push(n);for(;t.length>s;)r(l,n=t[s++])&&(~o(c,n)||c.push(n));return c}},function(e,t,n){var r=n(33);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(28),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t,n){var r=n(9),i=n(16),o=n(34)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=i(e),r(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var r=n(54),i=n(2)("iterator"),o=n(13);e.exports=n(0).getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||o[r(e)]}},function(e,t,n){var r=n(33),i=n(2)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,l;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(l=r(t))&&"function"==typeof t.callee?"Arguments":l}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(103),o=r(i),a=n(109),l=r(a);t.default=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=(0,l.default)(e);!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if((0,o.default)(Object(t)))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(e,t,n){e.exports=n(112)},function(e,t,n){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var i=n(1);e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else if(i.isURLSearchParams(t))o=t.toString();else{var a=[];i.forEach(t,function(e,t){null!==e&&void 0!==e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),a.push(r(t)+"="+r(e))}))}),o=a.join("&")}if(o){var l=e.indexOf("#");-1!==l&&(e=e.slice(0,l)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}},function(e,t,n){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";(function(t){function r(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var i=n(1),o=n(118),a={"Content-Type":"application/x-www-form-urlencoded"},l={adapter:function(){var e;return"undefined"!=typeof XMLHttpRequest?e=n(61):void 0!==t&&"[object process]"===Object.prototype.toString.call(t)&&(e=n(61)),e}(),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},i.forEach(["delete","get","head"],function(e){l.headers[e]={}}),i.forEach(["post","put","patch"],function(e){l.headers[e]=i.merge(a)}),e.exports=l}).call(t,n(117))},function(e,t,n){"use strict";var r=n(1),i=n(119),o=n(58),a=n(121),l=n(124),s=n(125),c=n(62);e.exports=function(e){return new Promise(function(t,u){var d=e.data,p=e.headers;r.isFormData(d)&&delete p["Content-Type"];var h=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",f=e.auth.password||"";p.Authorization="Basic "+btoa(m+":"+f)}var g=a(e.baseURL,e.url);if(h.open(e.method.toUpperCase(),o(g,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,h.onreadystatechange=function(){if(h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in h?l(h.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?h.response:h.responseText,o={data:r,status:h.status,statusText:h.statusText,headers:n,config:e,request:h};i(t,u,o),h=null}},h.onabort=function(){h&&(u(c("Request aborted",e,"ECONNABORTED",h)),h=null)},h.onerror=function(){u(c("Network Error",e,null,h)),h=null},h.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),u(c(t,e,"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var w=n(126),y=(e.withCredentials||s(g))&&e.xsrfCookieName?w.read(e.xsrfCookieName):void 0;y&&(p[e.xsrfHeaderName]=y)}if("setRequestHeader"in h&&r.forEach(p,function(e,t){void 0===d&&"content-type"===t.toLowerCase()?delete p[t]:h.setRequestHeader(t,e)}),r.isUndefined(e.withCredentials)||(h.withCredentials=!!e.withCredentials),e.responseType)try{h.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){h&&(h.abort(),u(e),h=null)}),void 0===d&&(d=null),h.send(d)})}},function(e,t,n){"use strict";var r=n(120);e.exports=function(e,t,n,i,o){var a=new Error(e);return r(a,t,n,i,o)}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t){t=t||{};var n={},i=["url","method","params","data"],o=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];r.forEach(i,function(e){void 0!==t[e]&&(n[e]=t[e])}),r.forEach(o,function(i){r.isObject(t[i])?n[i]=r.deepMerge(e[i],t[i]):void 0!==t[i]?n[i]=t[i]:r.isObject(e[i])?n[i]=r.deepMerge(e[i]):void 0!==e[i]&&(n[i]=e[i])}),r.forEach(a,function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])});var l=i.concat(o).concat(a),s=Object.keys(t).filter(function(e){return-1===l.indexOf(e)});return r.forEach(s,function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}),n}},function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},function(e,t,n){"use strict";t.__esModule=!0;var r=n(66),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){e.exports={default:n(144),__esModule:!0}},function(e,t,n){e.exports=n(146)},function(e,t,n){"use strict";function r(e){var t=e.className,n=e.selected,o=e.help,p=e.onChange,h=e.options,m=void 0===h?[]:h,f=e.icons,g=void 0===f?[]:f,w=u(r),y="inspector-exactmetrics-popular-posts-theme-control-"+w,v=function(e){return p(e.target.value)},b=[],S=0,E=0,C=0;for(var _ in m)if(m.hasOwnProperty(_)){var x=m[_];void 0===b[S]&&(b[S]=[]),b[S][E]=x,x.value===n&&(C=S),3===E?(E=0,S++):E++}var k=function(){return wp.element.createElement("span",{className:"exactmetrics-theme-picker-check"},s.a.checkmark)},O=function(e){var t="exactmetrics-theme-picker-label-"+e.value;return e.value===n&&(t+=" exactmetrics-theme-picker-label-selected"),l.a.canaccess(e.level)||(t+=" exactmetrics-theme-picker-label-disabled"),t};return!Object(i.isEmpty)(m)&&wp.element.createElement(d,{id:y,help:o,className:a()(t,"exactmetrics-theme-picker")},wp.element.createElement(c.c,{naturalSlideWidth:250,totalSlides:b.length,className:"exactmetrics-theme-picker-carousel",currentSlide:C,dragEnabled:!1},wp.element.createElement(c.f,null,b.map(function(e,t){return wp.element.createElement(c.e,{className:"exactmetrics-theme-picker-slide",index:t,key:y+"-"+t},e.map(function(e,r){return wp.element.createElement("div",{key:y+"-"+t+"-"+r,className:"exactmetrics-slider-theme-option"},wp.element.createElement("input",{id:y+"-"+t+"-"+r,className:"exactmetrics-slider-theme-input",type:"radio",name:y,value:e.value,onChange:v,checked:e.value===n,"aria-describedby":o?y+"__help":void 0}),wp.element.createElement("label",{htmlFor:y+"-"+t+"-"+r,className:O(e)},e.value===n&&k(),wp.element.createElement("span",{className:"exactmetrics-theme-picker-label-icon"},g[e.value]?g[e.value]:""),wp.element.createElement("span",{className:"exactmetrics-theme-picker-label-text"},e.label)))}))})),function(){if(b.length>1)return wp.element.createElement("div",{className:"exactmetrics-carousel-navigation"},wp.element.createElement(c.a,null,s.a.chevronleft),wp.element.createElement(c.d,{className:"exactmetrics-carousel-navigation-dots"}),wp.element.createElement(c.b,null,s.a.chevronright))}()))}t.a=r;var i=n(18),o=(n.n(i),n(3)),a=n.n(o),l=n(149),s=n(150),c=n(151),u=wp.compose.useInstanceId,d=wp.components.BaseControl},function(e,t){e.exports=React},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(162),o=r(i),a=n(164),l=r(a),s="function"==typeof l.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof l.default&&e.constructor===l.default&&e!==l.default.prototype?"symbol":typeof e};t.default="function"==typeof l.default&&"symbol"===s(o.default)?function(e){return void 0===e?"undefined":s(e)}:function(e){return e&&"function"==typeof l.default&&e.constructor===l.default&&e!==l.default.prototype?"symbol":void 0===e?"undefined":s(e)}},function(e,t,n){var r=n(49),i=n(36).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},function(e,t,n){var r=n(24),i=n(15),o=n(14),a=n(31),l=n(9),s=n(46),c=Object.getOwnPropertyDescriptor;t.f=n(7)?c:function(e,t){if(e=o(e),t=a(t,!0),s)try{return c(e,t)}catch(e){}if(l(e,t))return i(!r.f.call(e,t),e[t])}},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){Object(o.a)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}n.d(t,"a",function(){return c});var o=n(26),a=n(186),l={"":{plural_forms:function(e){return 1===e?0:1}}},s=/^i18n\.(n?gettext|has_translation)(_|$)/,c=function(e,t,n){var r=new a.a({}),o=new Set,c=function(){o.forEach(function(e){return e()})},u=function(e){return o.add(e),function(){return o.delete(e)}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return r.data[e]},p=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";r.data[t]=i(i(i({},l),r.data[t]),e),r.data[t][""]=i(i({},l[""]),r.data[t][""])},h=function(e,t){p(e,t),c()},m=function(e,t){r.data={},r.pluralForms={},h(e,t)},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;return r.data[e]||p(void 0,e),r.dcnpgettext(e,t,n,i,o)},g=function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default"},w=function(e,t){var r=f(t,void 0,e);return n?(r=n.applyFilters("i18n.gettext",r,e,t),n.applyFilters("i18n.gettext_"+g(t),r,e,t)):r},y=function(e,t,r){var i=f(r,t,e);return n?(i=n.applyFilters("i18n.gettext_with_context",i,e,t,r),n.applyFilters("i18n.gettext_with_context_"+g(r),i,e,t,r)):i},v=function(e,t,r,i){var o=f(i,void 0,e,t,r);return n?(o=n.applyFilters("i18n.ngettext",o,e,t,r,i),n.applyFilters("i18n.ngettext_"+g(i),o,e,t,r,i)):o},b=function(e,t,r,i,o){var a=f(o,i,e,t,r);return n?(a=n.applyFilters("i18n.ngettext_with_context",a,e,t,r,i,o),n.applyFilters("i18n.ngettext_with_context_"+g(o),a,e,t,r,i,o)):a},S=function(){return"rtl"===y("ltr","text direction")},E=function(e,t,i){var o,a,l=t?t+""+e:e,s=!(null===(o=r.data)||void 0===o||null===(a=o[null!==i&&void 0!==i?i:"default"])||void 0===a||!a[l]);return n&&(s=n.applyFilters("i18n.has_translation",s,e,t,i),s=n.applyFilters("i18n.has_translation_"+g(i),s,e,t,i)),s};if(e&&h(e,t),n){var C=function(e){s.test(e)&&c()};n.addAction("hookAdded","core/i18n",C),n.addAction("hookRemoved","core/i18n",C)}return{getLocaleData:d,setLocaleData:h,resetLocaleData:m,subscribe:u,__:w,_x:y,_n:v,_nx:b,isRTL:S,hasTranslation:E}}},function(e,t,n){"use strict";function r(e){return"string"!=typeof e||""===e?(console.error("The namespace must be a non-empty string."),!1):!!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(e)||(console.error("The namespace can only contain numbers, letters, dashes, periods, underscores and slashes."),!1)}t.a=r},function(e,t,n){"use strict";function r(e){return Object(i.a)(e)||Object(o.a)(e)||Object(a.a)(e)||Object(l.a)()}t.a=r;var i=n(199),o=n(200),a=n(77),l=n(201)},function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=r},function(e,t,n){"use strict";function r(e,t){if(e){if("string"==typeof e)return Object(i.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(i.a)(e,t):void 0}}t.a=r;var i=n(76)},function(e,t,n){"use strict";function r(e){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.a=r},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){Object(a.a)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e){var t=e.children,n=Object(l.a)(e,["children"]);return Object(s.f)("div",i({dangerouslySetInnerHTML:{__html:t}},n))}t.a=o;var a=n(26),l=n(43),s=n(27)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(81),i=(n.n(r),n(82)),o=(n.n(i),n(83),n(142),wp.i18n.setLocaleData);void 0!==window.exactmetrics_gutenberg_tool_vars.translations&&o(window.exactmetrics_gutenberg_tool_vars.translations,"google-analytics-dashboard-for-wp")},function(e,t){},function(e,t){},function(e,t,n){"use strict";n(84)},function(e,t,n){"use strict";var r=n(44),i=n.n(r),o=n(23),a=n.n(o),l=n(55),s=n.n(l),c=n(17),u=n(56),d=n.n(u),p=n(129),h=n(133),m=n(134),f=n(136),g=n(137),w=n(138),y=n(139),v=n(140),b=n(141),S=wp.i18n.__,E=wp.element,C=E.Fragment,_=E.useState,x=E.useEffect,k=wp.plugins.registerPlugin,O=wp.editPost,T=O.PluginSidebar,F=O.PluginSidebarMoreMenuItem,M=wp.data.select,N=function(e){var t=M("core/editor").getEditedPostAttribute("title"),n=S("Headline Analyzer","google-analytics-dashboard-for-wp"),r=S("Write your post title to see the analyzer data. This Headline Analyzer tool enables you to write irresistible SEO headlines that drive traffic, shares, and rank better in search results.","google-analytics-dashboard-for-wp"),o=_({}),l=s()(o,2),u=l[0],E=l[1],k=document.querySelector(".components-button[aria-label='"+n+"'] svg"),O=void 0!==u.previousHeadlinesData?u.previousHeadlinesData:[],N=sprintf(S("This headline analyzer is part of ExactMetrics to help you increase your traffic. See your %1swebsite traffic reports%2s.","google-analytics-dashboard-for-wp"),'<a href="'+exactmetrics_gutenberg_tool_vars.reports_url+'" className="exactmetrics-headline-analyzer-link">',"</a>"),j=document.querySelector(".exactmetrics-headline-analyzer-wrapper");if(k){var P=document.createElement("span");if(u.dataExist&&void 0!==u.currentHeadlineData.score){var D=u.currentHeadlineData.score,A=D<40?"red":D<=60?"orange":"green";k.parentNode.setAttribute("exactmetrics-button-color",A),k.nextElementSibling?k.nextElementSibling.innerHTML=D+"/100":(P.innerHTML=D+"/100",k.parentNode.insertBefore(P,k.nextSibling))}else k.parentNode.setAttribute("exactmetrics-button-color","red"),k.nextElementSibling?k.nextElementSibling.innerHTML="00/100":(P.innerHTML="00/100",k.parentNode.insertBefore(P,k.nextSibling))}if(j){var L=j.parentNode.querySelectorAll(".components-panel__header");L&&L.forEach(function(e){var t=e.querySelector('[aria-pressed="true"]');t&&null!==t&&(t.style.display="none")})}var B=function(e){E(a()({},u,e))};return x(function(){var e=new FormData;e.append("_ajax_nonce",exactmetrics_gutenberg_tool_vars.nonce),e.append("action","exactmetrics_gutenberg_headline_analyzer_get_results"),e.append("dataType","json"),e.append("q",t),d.a.post(exactmetrics_gutenberg_tool_vars.ajaxurl,e).then(function(e){var t={dataExist:!1};e.data.data.analysed&&(t.currentHeadlineData=e.data.data,t.headlineData=e.data.data,t.dataExist=!0,void 0!==u.headlineData&&(t.previousHeadlinesData=[u.headlineData].concat(i()(O)))),E(a()({},u,t))}).catch(function(e){var t={dataExist:!1};E(a()({},u,t)),console.log(e)})},[t]),wp.element.createElement(C,null,wp.element.createElement(F,{target:"exactmetrics-headline-analyzer"},n),wp.element.createElement(T,{name:"exactmetrics-headline-analyzer",title:n,className:"exactmetrics-headline-analyzer-wrapper",icon:c.a.headline},void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(p.a,{analyzer:u,setAnalyzer:B}):wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-empty-title-warning"},r),void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed&&O.length>0?wp.element.createElement(h.a,{analyzer:u,setAnalyzer:B}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(m.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(f.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(g.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(w.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(y.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(v.a,{data:u.headlineData}):"",void 0!==u.headlineData&&u.dataExist&&u.headlineData.analysed?wp.element.createElement(b.a,{data:u.headlineData}):"",wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-bottom-notice"},wp.element.createElement("p",{dangerouslySetInnerHTML:{__html:N}}))))};"undefined"!=typeof exactmetrics_gutenberg_tool_vars&&exactmetrics_gutenberg_tool_vars.allowed_post_types.includes(exactmetrics_gutenberg_tool_vars.current_post_type)&&exactmetrics_gutenberg_tool_vars.is_headline_analyzer_enabled&&k("exactmetrics-headline-analyzer",{icon:c.a.headlineBlack,render:N})},function(e,t,n){e.exports={default:n(86),__esModule:!0}},function(e,t,n){n(19),n(94),e.exports=n(0).Array.from},function(e,t,n){var r=n(28),i=n(29);e.exports=function(e){return function(t,n){var o,a,l=String(i(t)),s=r(n),c=l.length;return s<0||s>=c?e?"":void 0:(o=l.charCodeAt(s),o<55296||o>56319||s+1===c||(a=l.charCodeAt(s+1))<56320||a>57343?e?l.charAt(s):o:e?l.slice(s,s+2):a-56320+(o-55296<<10)+65536)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){"use strict";var r=n(32),i=n(15),o=n(37),a={};n(10)(a,n(2)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:i(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var r=n(6),i=n(8),o=n(21);e.exports=n(7)?Object.defineProperties:function(e,t){i(e);for(var n,a=o(t),l=a.length,s=0;l>s;)r.f(e,n=a[s++],t[n]);return e}},function(e,t,n){var r=n(14),i=n(51),o=n(92);e.exports=function(e){return function(t,n,a){var l,s=r(t),c=i(s.length),u=o(a,c);if(e&&n!=n){for(;c>u;)if((l=s[u++])!=l)return!0}else for(;c>u;u++)if((e||u in s)&&s[u]===n)return e||u||0;return!e&&-1}}},function(e,t,n){var r=n(28),i=Math.max,o=Math.min;e.exports=function(e,t){return e=r(e),e<0?i(e+t,0):o(e,t)}},function(e,t,n){var r=n(5).document;e.exports=r&&r.documentElement},function(e,t,n){"use strict";var r=n(30),i=n(4),o=n(16),a=n(95),l=n(96),s=n(51),c=n(97),u=n(53);i(i.S+i.F*!n(98)(function(e){Array.from(e)}),"Array",{from:function(e){var t,n,i,d,p=o(e),h="function"==typeof this?this:Array,m=arguments.length,f=m>1?arguments[1]:void 0,g=void 0!==f,w=0,y=u(p);if(g&&(f=r(f,m>2?arguments[2]:void 0,2)),void 0==y||h==Array&&l(y))for(t=s(p.length),n=new h(t);t>w;w++)c(n,w,g?f(p[w],w):p[w]);else for(d=y.call(p),n=new h;!(i=d.next()).done;w++)c(n,w,g?a(d,f,[i.value,w],!0):i.value);return n.length=w,n}})},function(e,t,n){var r=n(8);e.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&r(o.call(e)),t}}},function(e,t,n){var r=n(13),i=n(2)("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||o[i]===e)}},function(e,t,n){"use strict";var r=n(6),i=n(15);e.exports=function(e,t,n){t in e?r.f(e,t,i(0,n)):e[t]=n}},function(e,t,n){var r=n(2)("iterator"),i=!1;try{var o=[7][r]();o.return=function(){i=!0},Array.from(o,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var n=!1;try{var o=[7],a=o[r]();a.next=function(){return{done:n=!0}},o[r]=function(){return a},e(o)}catch(e){}return n}},function(e,t,n){e.exports={default:n(100),__esModule:!0}},function(e,t,n){n(101),e.exports=n(0).Object.assign},function(e,t,n){var r=n(4);r(r.S+r.F,"Object",{assign:n(102)})},function(e,t,n){"use strict";var r=n(7),i=n(21),o=n(38),a=n(24),l=n(16),s=n(50),c=Object.assign;e.exports=!c||n(12)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=c({},e)[n]||Object.keys(c({},t)).join("")!=r})?function(e,t){for(var n=l(e),c=arguments.length,u=1,d=o.f,p=a.f;c>u;)for(var h,m=s(arguments[u++]),f=d?i(m).concat(d(m)):i(m),g=f.length,w=0;g>w;)h=f[w++],r&&!p.call(m,h)||(n[h]=m[h]);return n}:c},function(e,t,n){e.exports={default:n(104),__esModule:!0}},function(e,t,n){n(39),n(19),e.exports=n(108)},function(e,t,n){"use strict";var r=n(106),i=n(107),o=n(13),a=n(14);e.exports=n(45)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,n):"values"==t?i(0,e[n]):i(0,[n,e[n]])},"values"),o.Arguments=o.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var r=n(54),i=n(2)("iterator"),o=n(13);e.exports=n(0).isIterable=function(e){var t=Object(e);return void 0!==t[i]||"@@iterator"in t||o.hasOwnProperty(r(t))}},function(e,t,n){e.exports={default:n(110),__esModule:!0}},function(e,t,n){n(39),n(19),e.exports=n(111)},function(e,t,n){var r=n(8),i=n(53);e.exports=n(0).getIterator=function(e){var t=i(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){"use strict";function r(e){var t=new a(e),n=o(a.prototype.request,t);return i.extend(n,a.prototype,t),i.extend(n,t),n}var i=n(1),o=n(57),a=n(113),l=n(63),s=n(60),c=r(s);c.Axios=a,c.create=function(e){return r(l(c.defaults,e))},c.Cancel=n(64),c.CancelToken=n(127),c.isCancel=n(59),c.all=function(e){return Promise.all(e)},c.spread=n(128),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new a,response:new a}}var i=n(1),o=n(58),a=n(114),l=n(115),s=n(63);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=s(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[l,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(i.merge(n||{},{method:e,url:t}))}}),i.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(i.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(){this.handlers=[]}var i=n(1);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){i.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var i=n(1),o=n(116),a=n(59),l=n(60);e.exports=function(e){return r(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||l.adapter)(e).then(function(t){return r(e),t.data=o(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(r(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(u===setTimeout)return setTimeout(e,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function o(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){f&&h&&(f=!1,h.length?m=h.concat(m):g=-1,m.length&&l())}function l(){if(!f){var e=i(a);f=!0;for(var t=m.length;t;){for(h=m,m=[];++g<t;)h&&h[g].run();g=-1,t=m.length}h=null,f=!1,o(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var u,d,p=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(e){u=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var h,m=[],f=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new s(e,t)),1!==m.length||f||i(l)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,n){"use strict";var r=n(1);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(62);e.exports=function(e,t,n){var i=n.config.validateStatus;!i||i(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(122),i=n(123);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},function(e,t,n){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t,n){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(1),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,o,a={};return e?(r.forEach(e.split("\n"),function(e){if(o=e.indexOf(":"),t=r.trim(e.substr(0,o)).toLowerCase(),n=r.trim(e.substr(o+1)),t){if(a[t]&&i.indexOf(t)>=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}}),a):a}},function(e,t,n){"use strict";var r=n(1);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(i.setAttribute("href",t),t=i.href),i.setAttribute("href",t),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");return t=e(window.location.href),function(n){var i=r.isString(n)?e(n):n;return i.protocol===t.protocol&&i.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(1);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,i,o,a){var l=[];l.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&l.push("expires="+new Date(n).toGMTString()),r.isString(i)&&l.push("path="+i),r.isString(o)&&l.push("domain="+o),!0===a&&l.push("secure"),document.cookie=l.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new i(e),t(n.reason))})}var i=n(64);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r(function(t){e=t}),cancel:e}},e.exports=r},function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";var r=n(55),i=n.n(r),o=n(3),a=n.n(o),l=n(130),s=n(131),c=n(132),u=wp.i18n.__,d=wp.element,p=d.Fragment,h=d.useState,m=d.useEffect,f=function(e){var t=u("Current Score","google-analytics-dashboard-for-wp"),n=u("Try New Headline","google-analytics-dashboard-for-wp"),r=h("current-score"),o=i()(r,2),d=o[0],f=o[1],g=function(){return f("current-score")},w=function(){return f("new-headline")},y=void 0!==e.analyzer.isNewData&&e.analyzer.isNewData;return m(function(){e.setAnalyzer({activeTab:d})},[d]),wp.element.createElement(p,null,wp.element.createElement("div",{className:"exactmetrics-inline-buttons"},wp.element.createElement("button",{onClick:g,className:a()("exactmetrics-switcher-button",{active:"current-score"===d})},t),wp.element.createElement("button",{onClick:w,className:a()("exactmetrics-switcher-button",{active:"new-headline"===d})},n)),"new-headline"===d?wp.element.createElement(s.a,{analyzer:e.analyzer,setAnalyzer:e.setAnalyzer}):wp.element.createElement(l.a,{analyzer:e.analyzer}),y?wp.element.createElement(c.a,{analyzer:e.analyzer}):"")};t.a=f},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=n(25),a=wp.i18n.__,l=wp.element.Fragment,s=wp.components,c=s.PanelBody,u=s.PanelRow,d=function(e){var t=e.analyzer.currentHeadlineData.sentence,n=a("Score","google-analytics-dashboard-for-wp"),r=a("A good score is between 40 and 60. For best results, you should strive for 70 and above.","google-analytics-dashboard-for-wp"),s=e.analyzer.currentHeadlineData.score,d=s<40?"red":s<=60?"orange":"green",p="red"===d?"#EB5757":"orange"===d?"#F2994A":"#1EC185";return wp.element.createElement(l,null,wp.element.createElement(c,{title:n},wp.element.createElement(u,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-current-score-tab"},wp.element.createElement("h4",{className:"exactmetrics-headline-analyzer-current-title"},"“",t,"”"),wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-current-score",d)},s),wp.element.createElement(o.a,{barScore:s,barColor:p})),wp.element.createElement("p",null,r)))))};t.a=d},function(e,t,n){"use strict";var r=n(44),i=n.n(r),o=n(56),a=n.n(o),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=c.TextControl,h=c.Button,m=function(e){var t=l("Try New Headline","google-analytics-dashboard-for-wp"),n=l("Enter a different headline than your post title to see how it compares.","google-analytics-dashboard-for-wp"),r=l("Analyze","google-analytics-dashboard-for-wp"),o=void 0!==e.analyzer.newHeadline?e.analyzer.newHeadline:"",c=void 0!==e.analyzer.previousHeadlinesData?e.analyzer.previousHeadlinesData:[],m=!o,f=function(t){var n=t.trim();if(n){var r=new FormData;r.append("_ajax_nonce",exactmetrics_gutenberg_tool_vars.nonce),r.append("action","exactmetrics_gutenberg_headline_analyzer_get_results"),r.append("dataType","json"),r.append("q",n),a.a.post(exactmetrics_gutenberg_tool_vars.ajaxurl,r).then(function(t){e.setAnalyzer({newHeadlineData:t.data.data,headlineData:t.data.data,previousHeadlinesData:[e.analyzer.headlineData].concat(i()(c)),isNewData:!0})}).catch(function(t){e.setAnalyzer({isNewData:!1}),console.log(t)})}};return wp.element.createElement(s,null,wp.element.createElement(u,{title:t},wp.element.createElement(d,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-new-tab"},wp.element.createElement("form",{onSubmit:function(e){e.preventDefault(),f(o)}},wp.element.createElement(p,{label:n,value:o,onChange:function(t){" "!==t&&e.setAnalyzer({newHeadline:t})},className:"exactmetrics-headline-analyzer-input-field"}),wp.element.createElement(h,{className:"exactmetrics-headline-analyzer-button",isPrimary:!0,onClick:function(){f(o)},disabled:m},r))))))};t.a=m},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=n(25),a=wp.i18n.__,l=wp.element.Fragment,s=wp.components,c=s.PanelBody,u=s.PanelRow,d=function(e){var t=e.analyzer.currentHeadlineData.sentence,n=a("New Score","google-analytics-dashboard-for-wp"),r=a("A good score is between 40 and 60. For best results, you should strive for 70 and above.","google-analytics-dashboard-for-wp"),s=a("Current Score","google-analytics-dashboard-for-wp"),d=void 0!==e.analyzer.newHeadlineData?e.analyzer.newHeadlineData.sentence:"",p=void 0!==e.analyzer.newHeadlineData?e.analyzer.newHeadlineData.score:"",h=void 0!==e.analyzer.currentHeadlineData.score?e.analyzer.currentHeadlineData.score:"",m=p<40?"red":p<=60?"orange":"green",f="red"===m?"#EB5757":"orange"===m?"#F2994A":"#1EC185",g=h<40?"red-bg":h<=60?"orange-bg":"green-bg",w=Math.abs(p-h);return wp.element.createElement(l,null,wp.element.createElement(c,{title:n},wp.element.createElement(u,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-new-score-panel"},wp.element.createElement("p",null,r),wp.element.createElement("h4",null,"“",d,"”"),wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-new-score",m)},p),wp.element.createElement(o.a,{barScore:p,barColor:f})),wp.element.createElement("div",{className:"current-score"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-score-difference",m)},p>h?"+ ":p===h?"":"- ",w),wp.element.createElement("h5",null,s),wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-score",g)},h),wp.element.createElement("p",null,"“",t,"”"))))))};t.a=d},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=wp.i18n.__,a=wp.element.Fragment,l=wp.components,s=l.PanelBody,c=l.PanelRow,u=function(e){var t=o("Previous Scores","google-analytics-dashboard-for-wp"),n="undefined"!==e.analyzer.previousHeadlinesData?e.analyzer.previousHeadlinesData:[],r=document.querySelector(".edit-post-sidebar"),l="undefined"!==e.analyzer.activeTab?e.analyzer.activeTab:"current-score",u="current-score"===l?390:300,d=function(t){e.setAnalyzer({newHeadlineData:n[t],headlineData:n[t],newHeadline:n[t].sentence,isNewData:!0}),r&&(r.scrollTop=u)};return wp.element.createElement(a,null,wp.element.createElement(s,{title:t},wp.element.createElement(c,null,wp.element.createElement("ul",{className:"exactmetrics-headline-analyzer-previous-scores"},n.map(function(e,t){if(t<10&&(void 0!==e.sentence||void 0!==e.score)){var n=e.score<40?"red-bg":e.score<=60?"orange-bg":"green-bg";return wp.element.createElement("li",{key:t,onClick:function(){return d(t)}},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-score",n)},e.score),e.sentence)}})))))};t.a=u},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=n(135),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=function(e){var t=l("Word Balance","google-analytics-dashboard-for-wp"),n=l("Compare the percentages of your results to the goal for each category and adjust as necessary.","google-analytics-dashboard-for-wp"),i=e.data.score<40?"red":e.data.score<=60?"orange":"green",c=(e.data.score<40||e.data.score,0===e.data.result.common_words_per?"red":e.data.result.common_words_per<.2?"orange":"green"),p=0===e.data.result.common_words_per?"red-bg":e.data.result.common_words_per<.2?"orange-bg":"green-bg",h=l("Your headline would be more likely to get clicks if it had more uncommon words.","google-analytics-dashboard-for-wp"),m=e.data.result.common_words_per<.2?h:l("Headlines with 20-30% common words are more likely to get clicks.","google-analytics-dashboard-for-wp"),f=0===e.data.result.uncommon_words_per?"red":e.data.result.uncommon_words_per<.1?"orange":"green",g=0===e.data.result.uncommon_words_per?"red-bg":e.data.result.uncommon_words_per<.1?"orange-bg":"green-bg",w=e.data.result.uncommon_words_per<.1?h:l("Headlines with uncommon words are more likely to get clicks.","google-analytics-dashboard-for-wp"),y=0===e.data.result.emotion_words_per?"red":e.data.result.emotion_words_per<.1?"orange":"green",v=0===e.data.result.emotion_words_per?"red-bg":e.data.result.emotion_words_per<.1?"orange-bg":"green-bg",b=l("Emotionally triggered headlines are likely to drive more clicks.","google-analytics-dashboard-for-wp"),S=0===e.data.result.power_words.length?"orange":"green",E=0===e.data.result.power_words.length?"orange":"green-bg",C=l("Headlines with Power Words are more likely to get clicks.","google-analytics-dashboard-for-wp"),_=l("Common Words","google-analytics-dashboard-for-wp"),x=l("20-30%","google-analytics-dashboard-for-wp"),k=l("Uncommon Words","google-analytics-dashboard-for-wp"),O=l("10-20%","google-analytics-dashboard-for-wp"),T=l("Emotional Words","google-analytics-dashboard-for-wp"),F=l("10-15%","google-analytics-dashboard-for-wp"),M=l("Power Words","google-analytics-dashboard-for-wp"),N=l("At least one","google-analytics-dashboard-for-wp");return wp.element.createElement(s,null,wp.element.createElement(u,{title:t,className:o()("exactmetrics-headline-analyzer-panel-word-balance","exactmetrics-headline-analyzer-panel-has-icon",i),icon:"green"===i?r.a.check:r.a.warning},wp.element.createElement(d,null,wp.element.createElement("h4",null,e.data.result.word_balance),wp.element.createElement("p",null,n),wp.element.createElement(a.a,{title:_,value:Math.round(100*e.data.result.common_words_per),goalValue:x,words:e.data.result.common_words,guideLine:m,classOnScore:c,classOnScoreBg:p}),wp.element.createElement(a.a,{title:k,value:Math.round(100*e.data.result.uncommon_words_per),goalValue:O,words:e.data.result.uncommon_words,guideLine:w,classOnScore:f,classOnScoreBg:g}),wp.element.createElement(a.a,{title:T,value:Math.round(100*e.data.result.emotion_words_per),goalValue:F,words:e.data.result.emotion_words,guideLine:b,classOnScore:y,classOnScoreBg:v}),wp.element.createElement(a.a,{title:M,value:Math.round(100*e.data.result.power_words_per),goalValue:N,words:e.data.result.power_words,guideLine:C,classOnScore:S,classOnScoreBg:E}))))};t.a=p},function(e,t,n){"use strict";var r=n(3),i=n.n(r),o=wp.i18n.__,a=function(e){var t=o("Goal: ","google-analytics-dashboard-for-wp"),n={width:e.value+"%"};return wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words-block"},wp.element.createElement("h5",null,e.title),wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words-block-data"},wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-words-block-percentage",e.classOnScore)},e.value,"%"),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-words-block-goal"},wp.element.createElement("strong",null,t),e.goalValue),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-words-block-progressbar"},wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-progressbar-bg"}),wp.element.createElement("span",{className:i()("exactmetrics-headline-analyzer-progressbar-part",e.classOnScoreBg),style:n}))),wp.element.createElement("ul",{className:"exactmetrics-headline-analyzer-words-tag-list"},e.words.length>0?e.words.map(function(e,t){return wp.element.createElement("li",{key:t},e)}):""),wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-words-guideline"},e.guideLine))};t.a=a},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=wp.i18n.__,l=wp.element.Fragment,s=wp.components,c=s.PanelBody,u=s.PanelRow,d=function(e){var t=a("Your headline has a neutral sentiment.","google-analytics-dashboard-for-wp"),n=a("Headlines that are strongly positive or negative tend to get more engagement then neutral ones.","google-analytics-dashboard-for-wp"),i=a("Your headline has a positive sentiment.","google-analytics-dashboard-for-wp"),s=a("Positive headlines tend to get better engagement than neutral or negative ones.","google-analytics-dashboard-for-wp"),d=a("Your headline has a negative sentiment.","google-analytics-dashboard-for-wp"),p=a("Negative headlines are attention-grabbing and tend to perform better than neutral ones.","google-analytics-dashboard-for-wp"),h=a("Sentiment","google-analytics-dashboard-for-wp"),m="neu"===e.data.result.sentiment?a("Neutral","google-analytics-dashboard-for-wp"):"pos"===e.data.result.sentiment?a("Positive","google-analytics-dashboard-for-wp"):a("Negative","google-analytics-dashboard-for-wp"),f="neu"===e.data.result.sentiment?r.a.neutral:"pos"===e.data.result.sentiment?r.a.smile:r.a.negative,g="neu"===e.data.result.sentiment?"orange":"pos"===e.data.result.sentiment?"green":"red";return wp.element.createElement(l,null,wp.element.createElement(c,{title:h,className:o()("exactmetrics-headline-analyzer-panel-sentiment","exactmetrics-headline-analyzer-panel-has-icon",g),icon:f},wp.element.createElement(u,null,wp.element.createElement("h4",null,m),"neu"===e.data.result.sentiment?wp.element.createElement("p",null,t," ",wp.element.createElement("br",null),wp.element.createElement("br",null)," ",n):"","pos"===e.data.result.sentiment?wp.element.createElement("p",null,i," ",wp.element.createElement("br",null),wp.element.createElement("br",null)," ",s):"","neg"===e.data.result.sentiment?wp.element.createElement("p",null,d," ",wp.element.createElement("br",null),wp.element.createElement("br",null)," ",p):"")))};t.a=d},function(e,t,n){"use strict";var r=wp.i18n,i=r.__,o=r.sprintf,a=wp.element.Fragment,l=wp.components,s=l.PanelBody,c=l.PanelRow,u=function(e){var t=e.data.result.headline_types.join(", "),n=i("Headline Type","google-analytics-dashboard-for-wp"),r=wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-panel-types-title"},n,wp.element.createElement("span",null,t)),l=o(i("Headlines that are lists and how-to get more engagement on average than other types of headlines. %1sRead more about %2sdifferent types of headlines here.%3s","google-analytics-dashboard-for-wp"),"<br/><br/>",'<a href="https://optinmonster.com/why-these-21-headlines-went-viral-and-how-you-can-copy-their-success/" target="_blank" className="exactmetrics-headline-analyzer-link">',"</a>");return wp.element.createElement(a,null,wp.element.createElement(s,{title:r,className:"exactmetrics-headline-analyzer-panel-types"},wp.element.createElement(c,null,wp.element.createElement("h4",null,t),wp.element.createElement("p",{dangerouslySetInnerHTML:{__html:l}}))))};t.a=u},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=n(25),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=function(e){var t=l("Character Count","google-analytics-dashboard-for-wp"),n=e.data.result.length,i=n>=66?100:Math.round(1.51*n),c="",p="",h="#1EC185",m="";return n<=19?(c="red",h="#EB5757"):n>=20&&n<=34?(c="orange",h="#F2994A"):n>=35&&n<=66?(c="green",h="#1EC185"):n>=67&&n<=79?(c="orange",h="#F2994A"):n>=80&&(c="red",h="#EB5757"),n<=34?(p=l("Too Short","google-analytics-dashboard-for-wp"),m=l("You have space to add more keywords and power words to boost your rankings and click-through rate.","google-analytics-dashboard-for-wp")):n>=35&&n<=66?(p=l("Good","google-analytics-dashboard-for-wp"),m=l("Headlines that are about 55 characters long will display fully in search results and tend to get more clicks.","google-analytics-dashboard-for-wp")):n>=67&&(p=l("Too Long","google-analytics-dashboard-for-wp"),m=l("At this length, it will get cut off in search results. Try reducing it to about 55 characters.","google-analytics-dashboard-for-wp")),wp.element.createElement(s,null,wp.element.createElement(u,{title:t,className:o()("exactmetrics-headline-analyzer-panel-character-count","exactmetrics-headline-analyzer-panel-has-icon",c),icon:"green"===c?r.a.check:r.a.warning},wp.element.createElement(d,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:o()("exactmetrics-headline-analyzer-character-length",c)},n),wp.element.createElement(a.a,{barScore:i,barColor:h}),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-status-on-character-length"},p)),wp.element.createElement("p",null,m))))};t.a=p},function(e,t,n){"use strict";var r=n(17),i=n(3),o=n.n(i),a=n(25),l=wp.i18n.__,s=wp.element.Fragment,c=wp.components,u=c.PanelBody,d=c.PanelRow,p=function(e){var t=l("Word Count","google-analytics-dashboard-for-wp"),n=e.data.result.word_count,i=n>=10?100:Math.round(10*n),c="",p="",h="#1EC185",m="";return n<=4?(c="red",h="#EB5757",p=l("Not Enough Words","google-analytics-dashboard-for-wp"),m=l("Your headline doesn’t use enough words. You have more space to add keywords and power words to improve your SEO and get more engagement.","google-analytics-dashboard-for-wp")):n>=5&&n<=9?(c="green",h="#1EC185",p=l("Good","google-analytics-dashboard-for-wp"),m=l("Your headline has the right amount of words. Headlines are more likely to be clicked on in search results if they have about 6 words.","google-analytics-dashboard-for-wp")):n>=10&&n<=11?(c="orange",h="#F2994A",p=l("Reduce Word Count","google-analytics-dashboard-for-wp")):(c="red",h="#EB5757",p=l("Too Many Words","google-analytics-dashboard-for-wp"),m=l("Your headline has too many words. Long headlines will get cut off in search results and won’t get as many clicks.","google-analytics-dashboard-for-wp")),wp.element.createElement(s,null,wp.element.createElement(u,{title:t,className:o()("exactmetrics-headline-analyzer-panel-word-count","exactmetrics-headline-analyzer-panel-has-icon",c),icon:"green"===c?r.a.check:r.a.warning},wp.element.createElement(d,null,wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-pie-chart-container"},wp.element.createElement("span",{className:o()("exactmetrics-headline-analyzer-word-length",c)},n),wp.element.createElement(a.a,{barScore:i,barColor:h}),wp.element.createElement("span",{className:"exactmetrics-headline-analyzer-status-on-word-length"},p)),wp.element.createElement("p",null,m))))};t.a=p},function(e,t,n){"use strict";var r=wp.i18n.__,i=wp.element.Fragment,o=wp.components,a=o.PanelBody,l=o.PanelRow,s=function(e){var t=r("Beginning & Ending Words","google-analytics-dashboard-for-wp"),n=e.data.result.input_array_orig,o=r("Most readers only look at the first and last 3 words of a headline before deciding whether to click.","google-analytics-dashboard-for-wp"),s="",c="";return n.length>=6?(s=n.slice(0,3).join(" "),c=n.slice(-3).join(" ")):n.length>3&&n.length<=5?(s=n.slice(0,3).join(" "),c=n.slice(3).join(" ")):s=n.slice(0,3).join(" "),wp.element.createElement(i,null,wp.element.createElement(a,{title:t,className:"exactmetrics-headline-analyzer-panel-beginning-ending-words"},wp.element.createElement(l,null,s?wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words beginning"},wp.element.createElement("span",null,s)):"",c?wp.element.createElement("div",{className:"exactmetrics-headline-analyzer-words ending"},wp.element.createElement("span",null,c)):"",wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-words-guideline"},o))))};t.a=s},function(e,t,n){"use strict";var r=n(23),i=n.n(r),o=wp.i18n.__,a=wp.element.Fragment,l=wp.components,s=l.PanelBody,c=l.PanelRow,u=wp.data.select,d=function(e){var t=o("Search Preview","google-analytics-dashboard-for-wp"),n=o("Here is how your headline will look like in google search results page.","google-analytics-dashboard-for-wp"),r=u("core/editor").getPermalink(),l={href:r};return wp.element.createElement(a,null,wp.element.createElement(s,{title:t,className:"exactmetrics-headline-analyzer-panel-search-preview"},wp.element.createElement(c,null,wp.element.createElement("h4",null,e.data.sentence),wp.element.createElement("p",{className:"exactmetrics-headline-analyzer-post-url"},wp.element.createElement("a",i()({},l,{target:"_blank"}),r)),wp.element.createElement("p",null,n))))};t.a=d},function(e,t,n){"use strict";n(143),n(152)},function(e,t,n){"use strict";var r=n(65),i=n.n(r),o=n(67),a=n.n(o),l=n(23),s=n.n(l),c=n(148),u=n(68),d=wp.i18n.__,p=wp.blocks.registerBlockType,h=wp,m=h.apiFetch,f=wp.data,g=f.registerStore,w=f.withSelect,y=wp.blockEditor.InspectorControls,v=wp.components,b=v.PanelBody,S=v.PanelRow,E=v.TextControl,C=v.ColorPalette,_=v.RangeControl,x=window.exactmetrics_gutenberg_tool_vars,k={setThemes:function(e){return{type:"SET_THEMES",themes:e}},receiveThemes:function(e){return{type:"RECEIVE_THEMES",path:e}}};g("exactmetrics/v1/popular-posts/inline",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{themes:{}},t=arguments[1];switch(t.type){case"SET_THEMES":return s()({},e,{themes:t.themes})}return e},actions:k,selectors:{receiveThemes:function(e){return e.themes}},controls:{RECEIVE_THEMES:function(e){return m({path:e.path})}},resolvers:{receiveThemes:a.a.mark(function e(t){var n,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.receiveThemes("/exactmetrics/v1/popular-posts/themes/inline");case 2:if(n=e.sent,void 0===n.themes){e.next=6;break}for(r in n.themes)n.themes.hasOwnProperty(r)&&(n.themes[r].value=r);return e.abrupt("return",k.setThemes(n));case 6:case"end":return e.stop()}},e,this)})}}),p("exactmetrics/popular-posts-inline",{title:d("Inline Popular Posts","google-analytics-dashboard-for-wp"),description:d("Add inline popular posts from ExactMetrics","google-analytics-dashboard-for-wp"),category:"widgets",icon:c.a.inlinepop,keywords:[d("Popular","google-analytics-dashboard-for-wp"),d("Posts","google-analytics-dashboard-for-wp"),d("Inline","google-analytics-dashboard-for-wp"),"ExactMetrics"],example:{},attributes:{theme:{type:"string"},title_size:{type:"number"},title_color:{type:"string"},label_color:{type:"string"},label_text:{type:"string"},label_background:{type:"string"},background_color:{type:"string"},background_border:{type:"string"},icon_background:{type:"string"},icon_color:{type:"string"},border_color:{type:"string"},border_color2:{type:"string"}},edit:w(function(e){return{themes:e("exactmetrics/v1/popular-posts/inline").receiveThemes()}})(function(e){var t=e.attributes,n=t.theme,r=(t.title_size,t.title_color,t.label_color,t.label_text,t.label_background,t.background_color,t.background_border,t.icon_background,t.icon_color,t.border_color,t.border_color2,e.themes),o=e.setAttributes,a=[{name:"pink",color:"#F58EA8"},{name:"red",color:"#CD3034"},{name:"orange",color:"#FD6A21"},{name:"yellow",color:"#FBB82B"},{name:"green",color:"#7FDBB6"},{name:"green",color:"#21CF86"},{name:"blue",color:"#91D2FA"},{name:"blue",color:"#1B95E0"},{name:"purple",color:"#9A57DD"},{name:"gray",color:"#EEEEEE"},{name:"gray",color:"#ACB8C3"},{name:"black",color:"#000000"}],l=void 0!==r.themes?r.themes:{},s=void 0===e.attributes.theme?r.selected:n,p=void 0!==s&&void 0!==l[s]?l[s]:{},h=void 0!==p.styles?p.styles:{},m={};for(var f in h)if(h.hasOwnProperty(f))for(var g in h[f])if(h[f].hasOwnProperty(g)){var w=f+"_"+g;void 0===e.attributes[w]?m[w]=h[f][g]:m[w]=e.attributes[w]}var v=function(e,t){var n=m[t];return wp.element.createElement(_,{key:"exactmetrics-popular-posts-input"+t,label:e,value:parseInt(n),min:1,max:100,onChange:function(e){return o(i()({},t,""===e?"":parseInt(e)))}})},k=function(e,t){var n=m[t];return wp.element.createElement(E,{key:"exactmetrics-popular-posts-input"+t,label:e,type:"text",value:n,onChange:function(e){return o(i()({},t,e))}})},O=function(e,t){var n=m[t];return[wp.element.createElement("label",{key:"exactmetrics-popular-posts-label"+t},e),wp.element.createElement(C,{key:"exactmetrics-popular-posts-input"+t,value:n,colors:a,onChange:function(e){o(i()({},t,e))}})]};return[wp.element.createElement(y,{key:"exactmetrics-popular-posts-inline-inspector-controls"},wp.element.createElement(b,{title:d("Theme","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-theme"},wp.element.createElement(S,{key:"exactmetrics-popular-posts-inline-theme-row"},wp.element.createElement(u.a,{id:"exactmetrics-popular-posts-inline-theme",options:l,selected:s,icons:c.a,onChange:function(e){o({theme:e})}}))),function(){if(void 0!==h.title){var e=[];return void 0!==h.title.size&&e.push(v(d("Title Font Size","google-analytics-dashboard-for-wp"),"title_size")),void 0!==h.title.color&&e.push(O(d("Title Color","google-analytics-dashboard-for-wp"),"title_color")),wp.element.createElement(b,{title:d("Title Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-title"},e)}}(),function(){if(void 0!==h.label){var e=[];return void 0!==h.label.text&&e.push(k(d("Label Text","google-analytics-dashboard-for-wp"),"label_text")),void 0!==h.label.color&&e.push(O(d("Label Color","google-analytics-dashboard-for-wp"),"label_color")),void 0!==h.label.background&&e.push(O(d("Label Background","google-analytics-dashboard-for-wp"),"label_background")),wp.element.createElement(b,{title:d("Label Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-label"}," ",e," ")}}(),function(){var e=[];if(void 0!==h.border&&void 0!==h.border.color&&e.push(O(d("Border Color","google-analytics-dashboard-for-wp"),"border_color")),void 0!==h.border&&void 0!==h.border.color2&&e.push(O(d("Bottom Border Color","google-analytics-dashboard-for-wp"),"border_color2")),void 0!==h.background&&void 0!==h.background.border&&e.push(O(d("Border Color","google-analytics-dashboard-for-wp"),"background_border")),0!==e.length)return wp.element.createElement(b,{title:d("Border Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-border"}," ",e," ")}(),function(){if(void 0!==h.background&&void 0!==h.background.color){var e=[];return void 0!==h.background.color&&e.push(O(d("Background Color","google-analytics-dashboard-for-wp"),"background_color")),wp.element.createElement(b,{title:d("Background Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-background"}," ",e," ")}}(),function(){if(void 0!==h.icon){var e=[];return void 0!==h.icon.color&&e.push(O(d("Icon Color","google-analytics-dashboard-for-wp"),"icon_color")),void 0!==h.icon.background&&e.push(O(d("Icon Background Color","google-analytics-dashboard-for-wp"),"icon_background")),wp.element.createElement(b,{title:d("Icon Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-icon"}," ",e," ")}}()),wp.element.createElement("div",{key:"exactmetrics-popular-posts-inline-preview"},wp.element.createElement("div",{className:"exactmetrics-inline-popular-posts-widget exactmetrics-inline-popular-posts-"+s,style:{backgroundColor:m.background_color,borderColor:m.background_border}},function(){if(void 0!==p.image&&p.image){var e=void 0!==h.image?h.image:"theme-preview-image.jpg";return wp.element.createElement("div",{className:"exactmetrics-inline-popular-posts-image"},wp.element.createElement("img",{src:x.vue_assets_path+"img/"+e}))}}(),wp.element.createElement("div",{className:"exactmetrics-inline-popular-posts-text"},function(){if(void 0!==h.icon)return wp.element.createElement("span",{className:"exactmetrics-inline-popular-posts-icon",style:{backgroundColor:m.icon_background}},c.a.themeIcon(m.icon_color))}(),function(){if(void 0!==h.label)return wp.element.createElement("span",{style:{color:m.label_color,backgroundColor:m.label_background},className:"exactmetrics-inline-popular-posts-label"},m.label_text)}(),function(){if(void 0!==h.border&&void 0!==h.border.color)return wp.element.createElement("span",{className:"exactmetrics-inline-popular-posts-border",style:{borderColor:m.border_color}})}(),function(){if(void 0!==h.title&&void 0===p.list&&void 0!==h.title.text)return wp.element.createElement("a",{href:"#",className:"exactmetrics-inline-popular-posts-title",style:{color:m.title_color,fontSize:m.title_size+"px"}},h.title.text)}(),function(){if(void 0!==p.list){var e=[];for(var t in p.list)e.push(wp.element.createElement("li",{key:"exactmetrics-popular-posts-preview-list-item-"+t,style:{color:m.title_color,fontSize:m.title_size+"px"}},p.list[t]));return wp.element.createElement("ul",{className:"exactmetrics-inline-popular-posts-list"},e)}}(),function(){if(void 0!==h.border&&void 0!==h.border.color2)return wp.element.createElement("span",{className:"exactmetrics-inline-popular-posts-border-2",style:{borderColor:m.border_color2}})}())))]}),save:function(e){return null}})},function(e,t,n){n(145);var r=n(0).Object;e.exports=function(e,t,n){return r.defineProperty(e,t,n)}},function(e,t,n){var r=n(4);r(r.S+r.F*!n(7),"Object",{defineProperty:n(6).f})},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(147),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),l=new h(r||[]);return a._invoke=c(e,n,l),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function s(e){function t(n,i,o,a){var l=r(e[n],e,i);if("throw"!==l.type){var s=l.arg,c=s.value;return c&&"object"==typeof c&&y.call(c,"__await")?Promise.resolve(c.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(c).then(function(e){s.value=e,o(s)},a)}a(l.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function c(e,t,n){var i=x;return function(o,a){if(i===O)throw new Error("Generator is already running");if(i===T){if("throw"===o)throw a;return f()}for(n.method=o,n.arg=a;;){var l=n.delegate;if(l){var s=u(l,n);if(s){if(s===F)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===x)throw i=T,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=O;var c=r(e,t,n);if("normal"===c.type){if(i=n.done?T:k,c.arg===F)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=T,n.method="throw",n.arg=c.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===g){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=g,u(e,t),"throw"===t.method))return F;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return F}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,F;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=g),t.delegate=null,F):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,F)}function d(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function p(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(d,this),this.reset(!0)}function m(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=g,t.done=!0,t};return r.next=r}}return{next:f}}function f(){return{value:g,done:!0}}var g,w=Object.prototype,y=w.hasOwnProperty,v="function"==typeof Symbol?Symbol:{},b=v.iterator||"@@iterator",S=v.asyncIterator||"@@asyncIterator",E=v.toStringTag||"@@toStringTag",C="object"==typeof e,_=t.regeneratorRuntime;if(_)return void(C&&(e.exports=_));_=t.regeneratorRuntime=C?e.exports:{},_.wrap=n;var x="suspendedStart",k="suspendedYield",O="executing",T="completed",F={},M={};M[b]=function(){return this};var N=Object.getPrototypeOf,j=N&&N(N(m([])));j&&j!==w&&y.call(j,b)&&(M=j);var P=a.prototype=i.prototype=Object.create(M);o.prototype=P.constructor=a,a.constructor=o,a[E]=o.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,E in e||(e[E]="GeneratorFunction")),e.prototype=Object.create(P),e},_.awrap=function(e){return{__await:e}},l(s.prototype),s.prototype[S]=function(){return this},_.AsyncIterator=s,_.async=function(e,t,r,i){var o=new s(n(e,t,r,i));return _.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(P),P[E]="Generator",P[b]=function(){return this},P.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=m,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.method="next",this.arg=g,this.tryEntries.forEach(p),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=g),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),l=y.call(i,"finallyLoc");if(a&&l){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,F):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),F},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),p(n),F}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;p(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:m(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=g),F}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";var r={};r.inlinepop=wp.element.createElement("svg",{width:"20",height:"16",viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 0H20V2H0V0ZM20 14V16H0V14H20ZM2 4C0.895431 4 0 4.89543 0 6V10C0 11.1046 0.895431 12 2 12H6C7.10457 12 8 11.1046 8 10V6C8 4.89543 7.10457 4 6 4H2ZM10 5H20V7H10V5ZM18 9H10V11H18V9Z",fill:"#555D66"})),r.alpha=wp.element.createElement("svg",{width:"70",height:"38",viewBox:"0 0 70 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"37.8947",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"5.72728",y:"19.8947",width:"58.5455",height:"8.52632",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"5.72728",y:"7.57892",width:"17.1818",height:"8.52632",rx:"3",fill:"#8453F7"})),r.beta=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"31",y:"21",width:"32",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"31",y:"10",width:"18",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"7",y:"10",width:"20",height:"20",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"1.5",y:"1.5",width:"67",height:"37",rx:"1.5",stroke:"#F0EAFE",strokeWidth:"3"})),r.charlie=wp.element.createElement("svg",{width:"70",height:"28",viewBox:"0 0 70 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"16",y:"19",width:"54",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"11",width:"70",height:"3",rx:"1.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{width:"26",height:"7",rx:"3",fill:"#8453F7"}),wp.element.createElement("circle",{cx:"4.5",cy:"23.5",r:"4.5",fill:"#6528F5"})),r.delta=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"8",y:"21",width:"54",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"22",y:"9",width:"18",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("path",{d:"M12.0303 9.5625C12.4613 8.8125 13.5387 8.8125 13.9697 9.5625L17.8483 16.3125C18.2793 17.0625 17.7406 18 16.8787 18H9.12134C8.25942 18 7.72072 17.0625 8.15168 16.3125L12.0303 9.5625Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"1.5",y:"1.5",width:"67",height:"37",rx:"1.5",stroke:"#F0EAFE",strokeWidth:"3"})),r.echo=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"24.8182",y:"16",width:"39.4545",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"5.72728",y:"16",width:"15.2727",height:"9",rx:"3",fill:"#8453F7"})),r.foxtrot=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"26",y:"22",width:"44",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"26",y:"9",width:"28",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{y:"9",width:"22",height:"22",rx:"3",fill:"#8453F7"})),r.golf=wp.element.createElement("svg",{width:"70",height:"29",viewBox:"0 0 70 29",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"11",width:"70",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"26",width:"70",height:"3",rx:"1.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{width:"21",height:"7",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"25",y:"1",width:"45",height:"3",rx:"1.5",fill:"#D1BFFC"})),r.hotel=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"22",y:"16",width:"40",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("path",{d:"M12.0303 16.5625C12.4613 15.8125 13.5387 15.8125 13.9697 16.5625L17.8483 23.3125C18.2793 24.0625 17.7406 25 16.8787 25H9.12134C8.25942 25 7.72072 24.0625 8.15168 23.3125L12.0303 16.5625Z",fill:"#8453F7"})),r.india=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("g",{clipPath:"url(#clip0)"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"26",y:"16",width:"36",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"16",width:"14",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"41",width:"41",height:"4",transform:"rotate(-90 0 41)",fill:"#8453F7"})),wp.element.createElement("defs",null,wp.element.createElement("clipPath",{id:"clip0"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"white"})))),r.juliett=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"30",y:"20",width:"32",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("path",{d:"M50 14C50 12.3431 51.3431 11 53 11H60C61.1046 11 62 11.8954 62 13V15C62 16.6569 60.6569 18 59 18H53C51.3431 18 50 16.6569 50 15V14Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"30",y:"11",width:"32",height:"4",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"8",y:"11",width:"18",height:"18",rx:"3",fill:"#8453F7"})),r.kilo=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{y:"22",width:"70",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{y:"9",width:"26",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"12.7273",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"25.4545",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"38.1818",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"50.9091",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"63.6364",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"12.7273",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"25.4545",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"38.1818",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"50.9091",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"63.6364",y:"37",width:"6.36364",height:"3",rx:"1",fill:"#D1BFFC"})),r.lima=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"6",y:"22",width:"32",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"6",y:"8",width:"20",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("rect",{x:"42",y:"9",width:"22",height:"22",rx:"3",fill:"#8453F7"})),r.mike=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"70",height:"40",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"35",y:"15",width:"27",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M28.8438 28H10.1562C9.55729 28 9.04818 27.7934 8.62891 27.3802C8.20964 26.967 8 26.4653 8 25.875V22.3C8 21.0297 9.02974 20 10.3 20H21.7C22.9703 20 24 18.9703 24 17.7V13.3C24 12.0297 25.0297 11 26.3 11H28.8438C29.4427 11 29.9518 11.2066 30.3711 11.6198C30.7904 12.033 31 12.5347 31 13.125V25.875C31 26.4653 30.7904 26.967 30.3711 27.3802C29.9518 27.7934 29.4427 28 28.8438 28ZM10.3 11C9.02974 11 8 12.0297 8 13.3V15.7C8 16.9703 9.02974 18 10.3 18H19.7C20.9703 18 22 16.9703 22 15.7V13.3C22 12.0297 20.9703 11 19.7 11H10.3Z",fill:"#8453F7"})),r.november=wp.element.createElement("svg",{width:"70",height:"40",viewBox:"0 0 70 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"29",y:"22",width:"33",height:"9",rx:"3",fill:"#6528F5"}),wp.element.createElement("rect",{x:"29",y:"9",width:"18",height:"9",rx:"3",fill:"#8453F7"}),wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17 28C21.4183 28 25 24.4183 25 20C25 15.5817 21.4183 12 17 12C12.5817 12 9 15.5817 9 20C9 24.4183 12.5817 28 17 28ZM20.544 21.8756L17.5907 16.7081C17.3281 16.2488 16.6719 16.2488 16.4093 16.7081L13.456 21.8756C13.1935 22.3349 13.5217 22.9091 14.0467 22.9091H19.9533C20.4783 22.9091 20.8065 22.3349 20.544 21.8756Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"1.5",y:"1.5",width:"67",height:"37",rx:"1.5",stroke:"#F0EAFE",strokeWidth:"3"})),r.themeIcon=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#EB5757";return wp.element.createElement("svg",{width:"14",height:"19",viewBox:"0 0 14 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M7.875 0.899463C7.875 1.59183 8.0816 2.24711 8.49479 2.8653C8.93229 3.48349 9.44271 4.06458 10.026 4.60859C10.6337 5.15259 11.2292 5.73369 11.8125 6.35188C12.4201 6.97007 12.9306 7.76135 13.3438 8.72572C13.7812 9.66537 14 10.7163 14 11.8785C14 13.832 13.3073 15.5011 11.9219 16.8858C10.5608 18.2953 8.92014 19 7 19C5.07986 19 3.42708 18.2953 2.04167 16.8858C0.680556 15.5011 0 13.832 0 11.8785C0 9.94973 0.668403 8.28062 2.00521 6.87116C2.27257 6.57443 2.58854 6.50024 2.95312 6.64861C3.31771 6.79697 3.5 7.08134 3.5 7.50171V10.6545C3.5 11.3221 3.71875 11.8908 4.15625 12.3607C4.61806 12.8305 5.16493 13.0654 5.79688 13.0654C6.45312 13.0654 7.01215 12.8428 7.47396 12.3978C7.93576 11.9279 8.16667 11.3592 8.16667 10.6916C8.16667 10.2712 8.04514 9.86318 7.80208 9.46754C7.58333 9.0719 7.31597 8.71336 7 8.3919C6.68403 8.07044 6.34375 7.73662 5.97917 7.39043C5.63889 7.04425 5.34722 6.66097 5.10417 6.2406C4.88542 5.82024 4.73958 5.35041 4.66667 4.83114C4.59375 4.31186 4.67882 3.68131 4.92188 2.93948C5.18924 2.17293 5.63889 1.33219 6.27083 0.417277C6.51389 0.0463641 6.84201 -0.0772735 7.25521 0.0463641C7.6684 0.170002 7.875 0.454368 7.875 0.899463Z",fill:e}))},t.a=r},function(e,t,n){"use strict";var r={};r.canaccess=function(e){return"lite"===e},t.a=r},function(e,t,n){"use strict";var r={};r.checkmark=wp.element.createElement("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M21.0565 2.94355C23.0188 4.87903 24 7.23118 24 10C24 12.7688 23.0188 15.1344 21.0565 17.0968C19.121 19.0323 16.7688 20 14 20C11.2312 20 8.86559 19.0323 6.90323 17.0968C4.96774 15.1344 4 12.7688 4 10C4 7.23118 4.96774 4.87903 6.90323 2.94355C8.86559 0.981183 11.2312 0 14 0C16.7688 0 19.121 0.981183 21.0565 2.94355ZM12.8306 15.2823L20.25 7.8629C20.5726 7.5672 20.5726 7.27151 20.25 6.97581L19.3629 6.04839C19.0403 5.75269 18.7312 5.75269 18.4355 6.04839L12.3871 12.0968L9.56452 9.27419C9.26882 8.97849 8.95968 8.97849 8.6371 9.27419L7.75 10.2016C7.42742 10.4973 7.42742 10.793 7.75 11.0887L11.9435 15.2823C12.2392 15.6048 12.5349 15.6048 12.8306 15.2823Z",fill:"#6528f5"})),r.chevronright=wp.element.createElement("svg",{width:"5",height:"8",viewBox:"0 0 5 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M4.84913 3.68807L1.19048 0.12844C1.10247 0.0428134 0.995599 -4.3519e-08 0.869873 -3.80233e-08C0.744146 -3.25276e-08 0.637278 0.0428134 0.549269 0.12844L0.134371 0.53211C0.0463618 0.617737 0.00235741 0.721713 0.00235742 0.844037C-0.0102153 0.966361 0.0275028 1.07034 0.115512 1.15596L3.03866 4L0.115512 6.84404C0.0275031 6.92966 -0.010215 7.03364 0.00235769 7.15596C0.0023577 7.27829 0.0463621 7.38226 0.134371 7.46789L0.549269 7.87156C0.637278 7.95719 0.744146 8 0.869873 8C0.9956 8 1.10247 7.95719 1.19048 7.87156L4.84913 4.31193C4.94971 4.2263 5 4.12232 5 4C5 3.87768 4.94971 3.7737 4.84913 3.68807Z",fill:"#C4C4C4"})),r.chevronleft=wp.element.createElement("svg",{width:"5",height:"8",viewBox:"0 0 5 8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M0.150873 3.68807L3.80952 0.12844C3.89753 0.0428134 4.0044 -4.3519e-08 4.13013 -3.80233e-08C4.25585 -3.25276e-08 4.36272 0.0428134 4.45073 0.12844L4.86563 0.53211C4.95364 0.617737 4.99764 0.721713 4.99764 0.844037C5.01022 0.966361 4.9725 1.07034 4.88449 1.15596L1.96134 4L4.88449 6.84404C4.9725 6.92966 5.01021 7.03364 4.99764 7.15596C4.99764 7.27829 4.95364 7.38226 4.86563 7.46789L4.45073 7.87156C4.36272 7.95719 4.25585 8 4.13013 8C4.0044 8 3.89753 7.95719 3.80952 7.87156L0.150873 4.31193C0.0502914 4.2263 2.96645e-07 4.12232 3.01992e-07 4C3.07339e-07 3.87768 0.0502914 3.7737 0.150873 3.68807Z",fill:"#C4C4C4"})),t.a=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}function m(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function f(e,t){if(null==e)return{};var n,r,i=m(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?g(e):t}function y(e){var t=h();return function(){var n,r=d(e);if(t){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w(this,n)}}function v(e){return b(e)||S(e)||E(e)||_()}function b(e){if(Array.isArray(e))return C(e)}function S(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function E(e,t){if(e){if("string"==typeof e)return C(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(e,t){return t={exports:{}},e(t,t.exports),t.exports}function k(){}function O(){}function T(e){return e.map(function(e){return!1===e?null:e}).join(" ").replace(/\s+/g," ").trim()}function F(e,t){return 100/e*t/t}function M(e,t){return 100*e/t}function N(e){return"".concat(e,"%")}function j(e,t,n){if(e===t)return!0;var r=re[ne(e)],i=re[ne(t)];return!(!r||r!==i)&&r(e,t,n)}function P(e){return function(t,n,r){if(!r)return e(t,n,[]);for(var i,o=r.length;i=r[--o];)if(i[0]===t&&i[1]===n)return!0;return e(t,n,r)}}function D(e,t,n){var r=e.length;if(r!==t.length)return!1;for(n.push([e,t]);r--;)if(!j(e[r],t[r],n))return!1;return!0}function A(e,t,n){if("function"==typeof e.equal)return n.push([e,t]),e.equal(t,n);var r=L(e),i=L(t),o=r.length;if(o!==i.length)return!1;for(r.sort(),i.sort();o--;)if(r[o]!==i[o])return!1;for(n.push([e,t]),o=r.length;o--;){var a=r[o];if(!j(e[a],t[a],n))return!1}return!0}function L(e){var t=[];for(var n in e)"constructor"!==n&&t.push(n);return t}function B(e){return!!e&&"object"==typeof e}function z(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||R(e)}function R(e){return e.$$typeof===le}function H(e){return Array.isArray(e)?[]:{}}function I(e,t){return!1!==t.clone&&t.isMergeableObject(e)?W(H(e),e,t):e}function q(e,t,n){return e.concat(t).map(function(e){return I(e,n)})}function V(e,t,n){var r={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(t){r[t]=I(e[t],n)}),Object.keys(t).forEach(function(i){n.isMergeableObject(t[i])&&e[i]?r[i]=W(e[i],t[i],n):r[i]=I(t[i],n)}),r}function W(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||q,n.isMergeableObject=n.isMergeableObject||oe;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):V(e,t,n):I(t,n)}function Z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return{}},n=function(n){function i(e,n){var o;return r(this,i),o=a.call(this,e,n),o.state=t(c({},n.state)),o.updateStateProps=o.updateStateProps.bind(g(o)),o}u(i,n);var a=y(i);return o(i,[{key:"componentDidMount",value:function(){this.context.subscribe(this.updateStateProps)}},{key:"shouldComponentUpdate",value:function(e,t){return!ie(t,this.state)||!ie(e,this.props)}},{key:"componentWillUnmount",value:function(){this.context.unsubscribe(this.updateStateProps)}},{key:"updateStateProps",value:function(){this.setState(t(c({},this.context.state)))}},{key:"render",value:function(){var t=this,n=ue(this.state,this.props);return Y.a.createElement(e,l({ref:function(e){t.instance=e}},n,{carouselStore:{getStoreState:this.context.getStoreState,masterSpinnerError:this.context.masterSpinnerError,masterSpinnerSuccess:this.context.masterSpinnerSuccess,setStoreState:this.context.setStoreState,subscribeMasterSpinner:this.context.subscribeMasterSpinner,unsubscribeAllMasterSpinner:this.context.unsubscribeAllMasterSpinner,unsubscribeMasterSpinner:this.context.unsubscribeMasterSpinner}}),this.props.children)}}]),i}(Y.a.Component);return a(n,"contextType",de),a(n,"propTypes",{children:J.children}),a(n,"defaultProps",{children:null}),n}n.d(t,"a",function(){return Te}),n.d(t,"b",function(){return Pe}),n.d(t,"c",function(){return fe}),n.d(t,"d",function(){return Ve}),n.d(t,"e",function(){return lt}),n.d(t,"f",function(){return dt});var U=n(69),Y=n.n(U),X="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";O.resetWarningCache=k;var K=function(){function e(e,t,n,r,i,o){if(o!==X){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:O,resetWarningCache:k};return n.PropTypes=n,n},G=x(function(e){e.exports=K()}),$="loading",J={children:G.oneOfType([G.arrayOf(G.node),G.node]),direction:G.oneOf(["forward","backward"]),height:function(e,t){var n=e[t];return"vertical"!==e.orientation||null!==n&&"number"==typeof n?null:new Error("Missing required property '".concat(t,"' when orientation is vertical. You must supply a number representing the height in pixels"))},orientation:G.oneOf(["horizontal","vertical"]),isBgImage:function(e,t){return!0===e[t]&&"img"===e.tag?new Error("HTML img elements should not have a backgroundImage. Please use ".concat(t," for other block-level HTML tags, like div, a, section, etc...")):null}},Q=function(e){var t=e.min,n=e.max,r=e.x;return Math.min(n,Math.max(t,r))},ee={buttonBack:"buttonBack___1mlaL"},te=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,null,[{key:"setDisabled",value:function(e,t,n){return null!==e?e:0===t&&!n}}]),o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.currentSlide,i=t.onClick,o=t.step,a=t.infinite,l=t.visibleSlides,s=t.totalSlides-l,c=Math.max(r-o,0);a&&(c=0===r?s:c),n.setStoreState({currentSlide:c,isPlaying:!1},null!==i&&i.call(this,e))}},{key:"render",value:function(){var e=this.props,n=(e.carouselStore,e.className),r=(e.currentSlide,e.disabled,e.onClick,e.step,e.totalSlides,e.visibleSlides,e.infinite),i=f(e,["carouselStore","className","currentSlide","disabled","onClick","step","totalSlides","visibleSlides","infinite"]),o=T([ee.buttonBack,"carousel__back-button",n]),a=t.setDisabled(this.props.disabled,this.props.currentSlide,r);return Y.a.createElement("button",l({type:"button","aria-label":"previous",className:o,onClick:this.handleOnClick,disabled:a},i),this.props.children)}}]),t}(Y.a.Component);a(te,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,step:G.number.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,infinite:G.bool}),a(te,"defaultProps",{className:null,disabled:null,onClick:null,infinite:!1});var ne=x(function(e,t){var n={}.toString,r="undefined"!=typeof window?window.Node:Function;e.exports=t=function(e){var t=typeof e;if("object"!=t)return t;if("object"==(t=i[n.call(e)]))return e instanceof Map?"map":e instanceof Set?"set":"object";if(t)return t;if(e instanceof r)switch(e.nodeType){case 1:return"element";case 3:return"text-node";case 9:return"document";case 11:return"document-fragment";default:return"dom-node"}};var i=t.types={"[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Arguments]":"arguments","[object Array]":"array","[object Set]":"set","[object String]":"string","[object Null]":"null","[object Undefined]":"undefined","[object Number]":"number","[object Boolean]":"boolean","[object Object]":"object","[object Map]":"map","[object Text]":"text-node","[object Uint8Array]":"bit-array","[object Uint16Array]":"bit-array","[object Uint32Array]":"bit-array","[object Uint8ClampedArray]":"bit-array","[object Error]":"error","[object FormData]":"form-data","[object File]":"file","[object Blob]":"blob"}}),re=(ne.types,{});re.number=function(e,t){return e!==e&&t!==t},re.function=function(e,t,n){return e.toString()===t.toString()&&re.object(e,t,n)&&j(e.prototype,t.prototype)},re.date=function(e,t){return+e==+t},re.regexp=function(e,t){return e.toString()===t.toString()},re.element=function(e,t){return e.outerHTML===t.outerHTML},re.textnode=function(e,t){return e.textContent===t.textContent},re.arguments=re["bit-array"]=re.array=P(D),re.object=P(A);var ie=j,oe=function(e){return B(e)&&!z(e)},ae="function"==typeof Symbol&&Symbol.for,le=ae?Symbol.for("react.element"):60103;W.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return W(e,n,t)},{})};var se,ce,ue=W,de=Y.a.createContext(),pe=function e(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(n){!t.hasOwnProperty(n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||Object.isFrozen(t[n])||e(t[n])}),t},he={masterSpinnerFinished:!1},me=function(){function e(t){r(this,e),this.state=pe(ue(he,t)),this.subscriptions=[],this.masterSpinnerSubscriptions={},this.setStoreState=this.setStoreState.bind(this),this.getStoreState=this.getStoreState.bind(this),this.subscribe=this.subscribe.bind(this),this.unsubscribe=this.unsubscribe.bind(this),this.updateSubscribers=this.updateSubscribers.bind(this),this.subscribeMasterSpinner=this.subscribeMasterSpinner.bind(this),this.unsubscribeMasterSpinner=this.unsubscribeMasterSpinner.bind(this),this.unsubscribeAllMasterSpinner=this.unsubscribeAllMasterSpinner.bind(this),this.masterSpinnerSuccess=this.masterSpinnerSuccess.bind(this),this.masterSpinnerError=this.masterSpinnerError.bind(this)}return o(e,[{key:"setStoreState",value:function(e,t){this.state=pe(ue(this.state,e)),this.updateSubscribers(t)}},{key:"getStoreState",value:function(){return ue({},this.state)}},{key:"subscribe",value:function(e){this.subscriptions.push(e)}},{key:"unsubscribe",value:function(e){var t=this.subscriptions.indexOf(e);-1!==t&&this.subscriptions.splice(t,1)}},{key:"updateSubscribers",value:function(e){this.subscriptions.forEach(function(e){return e()}),"function"==typeof e&&e(this.getStoreState())}},{key:"subscribeMasterSpinner",value:function(e){-1===Object.keys(this.masterSpinnerSubscriptions).indexOf(e)&&(this.masterSpinnerSubscriptions[e]={success:!1,error:!1,complete:!1})}},{key:"unsubscribeMasterSpinner",value:function(e){return-1!==Object.keys(this.masterSpinnerSubscriptions).indexOf(e)&&(this.setMasterSpinnerFinished(),delete this.masterSpinnerSubscriptions[e])}},{key:"unsubscribeAllMasterSpinner",value:function(){this.masterSpinnerSubscriptions={},this.setMasterSpinnerFinished()}},{key:"masterSpinnerSuccess",value:function(e){this.masterSpinnerSubscriptions[e].success=!0,this.masterSpinnerSubscriptions[e].complete=!0,this.setMasterSpinnerFinished()}},{key:"masterSpinnerError",value:function(e){this.masterSpinnerSubscriptions[e].error=!0,this.masterSpinnerSubscriptions[e].complete=!0,this.setMasterSpinnerFinished()}},{key:"setMasterSpinnerFinished",value:function(){this.setStoreState({masterSpinnerFinished:this.isMasterSpinnerFinished()})}},{key:"isMasterSpinnerFinished",value:function(){var e=this;return 0===Object.keys(this.masterSpinnerSubscriptions).filter(function(t){return!0!==e.masterSpinnerSubscriptions[t].complete}).length}}]),e}(),fe=(ce=se=function(e){function t(e){var i;if(r(this,t),i=n.call(this,e),e.isIntrinsicHeight&&"horizontal"!==e.orientation)throw Error('isIntrinsicHeight can only be used in "horizontal" orientation. See Readme for more information.');var o={currentSlide:e.currentSlide,disableAnimation:e.disableAnimation,disableKeyboard:e.disableKeyboard,hasMasterSpinner:e.hasMasterSpinner,imageErrorCount:0,imageSuccessCount:0,interval:e.interval,isPageScrollLocked:e.isPageScrollLocked,isPlaying:e.isPlaying,lockOnWindowScroll:e.lockOnWindowScroll,masterSpinnerThreshold:0,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,playDirection:e.playDirection,privateUnDisableAnimation:!1,slideSize:F(e.totalSlides,e.visibleSlides),slideTraySize:M(e.totalSlides,e.visibleSlides),step:e.step,dragStep:e.dragStep,totalSlides:e.totalSlides,touchEnabled:e.touchEnabled,dragEnabled:e.dragEnabled,visibleSlides:e.visibleSlides,infinite:e.infinite,isIntrinsicHeight:e.isIntrinsicHeight};return i.carouselStore=new me(o),i}u(t,e);var n=y(t);return o(t,[{key:"componentDidUpdate",value:function(e){var t=this,n={};["currentSlide","disableAnimation","disableKeyboard","hasMasterSpinner","interval","isPlaying","naturalSlideHeight","naturalSlideWidth","lockOnWindowScroll","orientation","playDirection","step","dragStep","totalSlides","touchEnabled","dragEnabled","visibleSlides"].forEach(function(r){e[r]!==t.props[r]&&(n[r]=t.props[r])}),this.props.currentSlide!==e.currentSlide&&!this.props.disableAnimation&&(n.disableAnimation=!0,n.privateUnDisableAnimation=!0),this.props.totalSlides===e.totalSlides&&this.props.visibleSlides===e.visibleSlides||(n.slideSize=F(this.props.totalSlides,this.props.visibleSlides),n.slideTraySize=M(this.props.totalSlides,this.props.visibleSlides)),this.carouselStore.state.currentSlide>=this.props.totalSlides&&(n.currentSlide=Math.max(this.props.totalSlides-1,0)),Object.keys(n).length>0&&this.carouselStore.setStoreState(n)}},{key:"componentWillUnmount",value:function(){this.carouselStore.unsubscribeAllMasterSpinner()}},{key:"getStore",value:function(){return this.carouselStore}},{key:"render",value:function(){var e=this.props,t=(e.children,e.className,e.currentSlide,e.disableAnimation,e.disableKeyboard,e.hasMasterSpinner,e.interval,e.isPageScrollLocked,e.isPlaying,e.lockOnWindowScroll,e.naturalSlideHeight,e.naturalSlideWidth,e.orientation,e.playDirection,e.step,e.dragStep,e.tag),n=(e.totalSlides,e.touchEnabled,e.dragEnabled,e.visibleSlides,e.infinite,e.isIntrinsicHeight,f(e,["children","className","currentSlide","disableAnimation","disableKeyboard","hasMasterSpinner","interval","isPageScrollLocked","isPlaying","lockOnWindowScroll","naturalSlideHeight","naturalSlideWidth","orientation","playDirection","step","dragStep","tag","totalSlides","touchEnabled","dragEnabled","visibleSlides","infinite","isIntrinsicHeight"])),r=T(["carousel",this.props.className]);return Y.a.createElement(t,l({className:r},n),Y.a.createElement(de.Provider,{value:this.carouselStore},this.props.children))}}]),t}(Y.a.Component),a(se,"propTypes",{children:J.children.isRequired,className:G.string,currentSlide:G.number,disableAnimation:G.bool,disableKeyboard:G.bool,hasMasterSpinner:G.bool,interval:G.number,isPageScrollLocked:G.bool,isPlaying:G.bool,lockOnWindowScroll:G.bool,naturalSlideHeight:G.number.isRequired,naturalSlideWidth:G.number.isRequired,orientation:J.orientation,playDirection:J.direction,step:G.number,dragStep:G.number,tag:G.string,totalSlides:G.number.isRequired,touchEnabled:G.bool,dragEnabled:G.bool,visibleSlides:G.number,infinite:G.bool,isIntrinsicHeight:G.bool}),a(se,"defaultProps",{className:null,currentSlide:0,disableAnimation:!1,disableKeyboard:!1,hasMasterSpinner:!1,interval:5e3,isPageScrollLocked:!1,isPlaying:!1,lockOnWindowScroll:!1,orientation:"horizontal",playDirection:"forward",step:1,dragStep:1,tag:"div",touchEnabled:!0,dragEnabled:!0,visibleSlides:1,infinite:!1,isIntrinsicHeight:!1}),ce);de.Consumer;var ge,we,ye,ve,be,Se,Ee,Ce,_e,xe,ke,Oe,Te=Z(te,function(e){return{currentSlide:e.currentSlide,step:e.step,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,infinite:e.infinite}}),Fe={buttonFirst:"buttonFirst___2rhFr"},Me=(we=ge=function(e){function t(){var e;return r(this,t),e=n.call(this),e.handleOnClick=e.handleOnClick.bind(g(e)),e}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.onClick;n.setStoreState({currentSlide:0,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.className),n=e.currentSlide,r=e.disabled,i=(e.onClick,e.totalSlides,f(e,["carouselStore","className","currentSlide","disabled","onClick","totalSlides"])),o=T([Fe.buttonFirst,"carousel__first-button",t]),a=null!==r?r:0===n;return Y.a.createElement("button",l({type:"button","aria-label":"first",className:o,onClick:this.handleOnClick,disabled:a},i),this.props.children)}}]),t}(Y.a.Component),a(ge,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,totalSlides:G.number.isRequired}),a(ge,"defaultProps",{className:null,disabled:null,onClick:null}),we),Ne=(Z(Me,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides}}),{buttonNext:"buttonNext___2mOCa"}),je=(ve=ye=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,null,[{key:"setDisabled",value:function(e,t,n,r,i){return null!==e?e:t>=r-n&&!i}}]),o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.currentSlide,r=t.onClick,i=t.step,o=t.carouselStore,a=t.infinite,l=t.totalSlides-t.visibleSlides,s=i+n,c=Math.min(s,l);a&&(c=l===n?0:c),o.setStoreState({currentSlide:c,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,n=(e.carouselStore,e.className),r=e.currentSlide,i=e.disabled,o=(e.onClick,e.step,e.totalSlides),a=e.visibleSlides,s=e.infinite,c=f(e,["carouselStore","className","currentSlide","disabled","onClick","step","totalSlides","visibleSlides","infinite"]),u=T([Ne.buttonNext,"carousel__next-button",n]),d=t.setDisabled(i,r,a,o,s);return Y.a.createElement("button",l({type:"button","aria-label":"next",className:u,onClick:this.handleOnClick,disabled:d},c),this.props.children)}}]),t}(Y.a.PureComponent),a(ye,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,step:G.number.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,infinite:G.bool}),a(ye,"defaultProps",{className:null,disabled:null,onClick:null,infinite:!1}),ve),Pe=Z(je,function(e){return{currentSlide:e.currentSlide,step:e.step,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,infinite:e.infinite}}),De={buttonLast:"buttonLast___2yuh0"},Ae=(Se=be=function(e){function t(){var e;return r(this,t),e=n.call(this),e.handleOnClick=e.handleOnClick.bind(g(e)),e}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.onClick,i=t.totalSlides,o=t.visibleSlides;n.setStoreState({currentSlide:i-o,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.className),n=e.currentSlide,r=e.disabled,i=(e.onClick,e.totalSlides),o=e.visibleSlides,a=f(e,["carouselStore","className","currentSlide","disabled","onClick","totalSlides","visibleSlides"]),s=T([De.buttonLast,"carousel__last-button",t]),c=null!==r?r:n>=i-o;return Y.a.createElement("button",l({type:"button","aria-label":"last",className:s,onClick:this.handleOnClick,disabled:c},a),this.props.children)}}]),t}(Y.a.Component),a(be,"propTypes",{carouselStore:G.object.isRequired,children:J.children.isRequired,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired}),a(be,"defaultProps",{className:null,disabled:null,onClick:null}),Se),Le=(Z(Ae,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),{buttonNext:"buttonNext___3Lm3s"}),Be=(Ce=Ee=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props.onClick;this.props.carouselStore.setStoreState({isPlaying:!this.props.isPlaying},null!==t&&t.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.childrenPaused),n=e.childrenPlaying,r=e.className,i=e.isPlaying,o=(e.onClick,f(e,["carouselStore","children","childrenPaused","childrenPlaying","className","isPlaying","onClick"])),a=T([Le.buttonNext,"carousel__play-button",r]);return Y.a.createElement("button",l({type:"button","aria-label":"play",className:a,onClick:this.handleOnClick},o),i&&n,!i&&t,this.props.children)}}]),t}(Y.a.PureComponent),a(Ee,"propTypes",{carouselStore:G.object.isRequired,children:G.node,childrenPaused:G.node,childrenPlaying:G.node,className:G.string,isPlaying:G.bool.isRequired,onClick:G.func}),a(Ee,"defaultProps",{children:null,childrenPaused:null,childrenPlaying:null,className:null,onClick:null}),Ce),ze=(Z(Be,function(e){return{isPlaying:e.isPlaying}}),{dot:"dot___3c3SI"}),Re=(xe=_e=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnClick=i.handleOnClick.bind(g(i)),i}u(t,e);var n=y(t);return o(t,[{key:"handleOnClick",value:function(e){var t=this.props,n=t.carouselStore,r=t.onClick,i=t.slide,o=t.totalSlides,a=t.visibleSlides,l=i>=o-a?o-a:i;n.setStoreState({currentSlide:l,isPlaying:!1},null!==r&&r.call(this,e))}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.className),n=e.currentSlide,r=e.disabled,i=(e.onClick,e.selected),o=e.slide,a=(e.totalSlides,e.visibleSlides),s=f(e,["carouselStore","children","className","currentSlide","disabled","onClick","selected","slide","totalSlides","visibleSlides"]),c=o>=n&&o<n+a,u="boolean"==typeof i?i:c,d=!0===c,p="boolean"==typeof r?r:d,h=T([ze.dot,u&&ze.dotSelected,"carousel__dot","carousel__dot--".concat(o),u&&"carousel__dot--selected",t]);return Y.a.createElement("button",l({"aria-label":"slide dot",type:"button",onClick:this.handleOnClick,className:h,disabled:p},s),this.props.children)}}]),t}(Y.a.Component),a(_e,"propTypes",{carouselStore:G.object.isRequired,children:J.children,className:G.string,currentSlide:G.number.isRequired,disabled:G.bool,onClick:G.func,selected:G.bool,slide:G.number.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired}),a(_e,"defaultProps",{children:null,className:null,disabled:null,onClick:null,selected:null}),xe),He=Z(Re,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),Ie={},qe=(Oe=ke=function(e){function t(){return r(this,t),n.apply(this,arguments)}u(t,e);var n=y(t);return o(t,[{key:"renderDots",value:function(){var e=this.props,t=e.currentSlide,n=e.totalSlides,r=e.visibleSlides,i=e.disableActiveDots,o=e.showAsSelectedForCurrentSlideOnly,a=e.renderDots;if(a){var l=this.props;return l.renderDots,a(f(l,["renderDots"]))}for(var s=[],c=0;c<n;c+=1){var u=c>=t&&c<t+r,d=c===t,p=o?d:u,h=c>=n-r?n-r:c;s.push(Y.a.createElement(He,{key:c,slide:h,selected:p,disabled:!!i&&p},Y.a.createElement("span",{className:T["carousel__dot-group-dot"]},this.props.dotNumbers&&c+1)))}return s}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children),n=e.className,r=(e.currentSlide,e.dotNumbers,e.totalSlides,e.visibleSlides,e.disableActiveDots,e.showAsSelectedForCurrentSlideOnly,e.renderDots,f(e,["carouselStore","children","className","currentSlide","dotNumbers","totalSlides","visibleSlides","disableActiveDots","showAsSelectedForCurrentSlideOnly","renderDots"])),i=T([Ie.DotGroup,"carousel__dot-group",n]);return Y.a.createElement("div",l({className:i},r),this.renderDots(),t)}}]),t}(Y.a.Component),a(ke,"propTypes",{children:J.children,className:G.string,currentSlide:G.number.isRequired,carouselStore:G.object.isRequired,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,dotNumbers:G.bool,disableActiveDots:G.bool,showAsSelectedForCurrentSlideOnly:G.bool,renderDots:G.func}),a(ke,"defaultProps",{children:null,className:null,dotNumbers:!1,disableActiveDots:!0,showAsSelectedForCurrentSlideOnly:!1,renderDots:null}),Oe),Ve=Z(qe,function(e){return{currentSlide:e.currentSlide,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides}}),We={image:"image___xtQGH"},Ze=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.state={imageStatus:$},i.handleImageLoad=i.handleImageLoad.bind(g(i)),i.handleImageError=i.handleImageError.bind(g(i)),i.image=null,i}u(t,e);var n=y(t);return o(t,null,[{key:"subscribeMasterSpinner",value:function(e){e.hasMasterSpinner&&e.carouselStore.subscribeMasterSpinner(e.src)}},{key:"unsubscribeMasterSpinner",value:function(e){e.hasMasterSpinner&&e.carouselStore.unsubscribeMasterSpinner(e.src)}}]),o(t,[{key:"componentDidMount",value:function(){t.subscribeMasterSpinner(this.props),this.initImage()}},{key:"componentDidUpdate",value:function(e){e.src!==this.props.src&&(t.unsubscribeMasterSpinner(e),t.subscribeMasterSpinner(this.props),this.initImage())}},{key:"componentWillUnmount",value:function(){t.unsubscribeMasterSpinner(this.props),this.image.removeEventListener("load",this.handleImageLoad),this.image.removeEventListener("error",this.handleImageError),this.image=null}},{key:"initImage",value:function(){if(this.setState({imageStatus:$}),this.image=document.createElement("img"),this.image.addEventListener("load",this.handleImageLoad,!1),this.image.addEventListener("error",this.handleImageError,!1),this.image.src=this.props.src,this.image.readyState||this.image.complete){var e=this.image.src;this.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",this.image.src=e}}},{key:"handleImageLoad",value:function(e){this.setState({imageStatus:"success"}),this.props.hasMasterSpinner&&this.props.carouselStore.masterSpinnerSuccess(this.props.src),this.props.onLoad&&this.props.onLoad(e)}},{key:"handleImageError",value:function(e){this.setState({imageStatus:"error"}),this.props.hasMasterSpinner&&this.props.carouselStore.masterSpinnerError(this.props.src),this.props.onError&&this.props.onError(e)}},{key:"tempTag",value:function(){return"img"===this.props.tag?"div":this.props.tag}},{key:"customRender",value:function(e){return"function"==typeof this.props[e]?this.props[e]():this.props.children}},{key:"renderLoading",value:function(e){var t=this.tempTag(),n=T([We.image,We.imageLoading,"carousel__image",this.props.isBgImage&&"carousel__image--with-background","carousel__image--loading",this.props.className]);return Y.a.createElement(t,l({className:n},e),this.customRender("renderLoading"))}},{key:"renderError",value:function(e){var t=this.tempTag(),n=T([We.image,We.imageError,"carousel__image",this.props.isBgImage&&"carousel__image--with-background","carousel__image--error",this.props.className]);return Y.a.createElement(t,l({className:n},e),this.customRender("renderError"))}},{key:"renderSuccess",value:function(e){var t=this.props,n=t.style,r=t.tag,i=T([We.image,"carousel__image",this.props.isBgImage&&"carousel__image--with-background","carousel__image--success",this.props.className]),o=l({},n),a=e;if("img"!==r){var s=e.src;e.alt,a=f(e,["src","alt"]),o=l({},n,{backgroundImage:'url("'.concat(s,'")'),backgroundSize:"cover"})}return Y.a.createElement(r,l({className:i,style:o},a),this.props.children)}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.children,e.className,e.hasMasterSpinner,e.isBgImage,e.onError,e.onLoad,e.renderError,e.renderLoading,e.style,e.tag,f(e,["carouselStore","children","className","hasMasterSpinner","isBgImage","onError","onLoad","renderError","renderLoading","style","tag"]));switch(this.state.imageStatus){case $:return this.renderLoading(t);case"success":return this.renderSuccess(t);case"error":return this.renderError(t);default:throw new Error("unknown value for this.state.imageStatus")}}}]),t}(Y.a.Component);a(Ze,"propTypes",{alt:G.string,carouselStore:G.object.isRequired,children:J.children,className:G.string,hasMasterSpinner:G.bool.isRequired,isBgImage:J.isBgImage,onError:G.func,onLoad:G.func,renderError:G.func,renderLoading:G.func,src:G.string.isRequired,style:G.object,tag:G.string}),a(Ze,"defaultProps",{alt:"",children:null,className:null,isBgImage:!1,onError:null,onLoad:null,renderError:null,renderLoading:null,style:null,tag:"img"});var Ue,Ye,Xe,Ke,Ge,$e,Je,Qe,et=Z(Ze,function(e){return{hasMasterSpinner:e.hasMasterSpinner,orientation:e.orientation}}),tt={spinner:"spinner___27VUp",spin:"spin___S3UuE"},nt=(Ye=Ue=function(e){function t(){return r(this,t),n.apply(this,arguments)}u(t,e);var n=y(t);return o(t,[{key:"render",value:function(){var e=this.props,t=e.className,n=f(e,["className"]),r=T([tt.spinner,"carousel__spinner",t]);return Y.a.createElement("div",l({className:r},n))}}]),t}(Y.a.PureComponent),a(Ue,"propTypes",{className:G.string}),a(Ue,"defaultProps",{className:null}),Ye),rt={container:"container___2O72F",overlay:"overlay___IV4qY",hover:"hover___MYy31",zoom:"zoom___3kqYk",loading:"loading___1pvNI",imageLoadingSpinnerContainer:"imageLoadingSpinnerContainer___3UIPD"},it=(Ke=Xe=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.state={isImageLoading:!0,isHovering:!1,isZooming:!1,x:null,y:null,scale:1},i.tpCache={},i.handleImageComplete=i.handleImageComplete.bind(g(i)),i.handleOnMouseMove=i.handleOnMouseMove.bind(g(i)),i.handleOnMouseOut=i.handleOnMouseOut.bind(g(i)),i.handleOnMouseOver=i.handleOnMouseOver.bind(g(i)),i.handleOnTouchEnd=i.handleOnTouchEnd.bind(g(i)),i.handleOnTouchMove=i.handleOnTouchMove.bind(g(i)),i.handleOnTouchStart=i.handleOnTouchStart.bind(g(i)),i}u(t,e);var n=y(t);return o(t,null,[{key:"midpointBetweenTwoTouches",value:function(e){var t=e.x1,n=e.y1;return{x:(t+e.x2)/2,y:(n+e.y2)/2}}},{key:"distanceBetweenTwoTouches",value:function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return Math.sqrt(Math.pow(r-t,2)+Math.pow(i-n,2))}}]),o(t,[{key:"componentDidUpdate",value:function(e,t){!1===t.isZooming&&!0===this.state.isZooming&&this.props.carouselStore.setStoreState({isPageScrollLocked:!0}),!0===t.isZooming&&!1===this.state.isZooming&&this.props.carouselStore.setStoreState({isPageScrollLocked:!1})}},{key:"handleImageComplete",value:function(){this.setState({isImageLoading:!1})}},{key:"handleOnMouseOver",value:function(){this.state.isZooming||this.setState({isHovering:!0,scale:2})}},{key:"handleOnMouseOut",value:function(){this.state.isZooming||this.setState({isHovering:!1,scale:1})}},{key:"handleOnMouseMove",value:function(e){if(!this.state.isZooming){var t=N(e.nativeEvent.offsetX/e.target.offsetWidth*100),n=N(e.nativeEvent.offsetY/e.target.offsetHeight*100);this.setState({x:t,y:n})}}},{key:"handleOnTouchStart",value:function(e){var t=this;this.props.isPinchZoomEnabled&&(v(e.targetTouches).forEach(function(e){t.tpCache[e.identifier]={clientX:e.clientX,clientY:e.clientY}}),this.setState(function(e){return{isZooming:e.isZooming||Object.keys(t.tpCache).length>1}}))}},{key:"handleOnTouchMove",value:function(e){var n=this;if(this.state.isZooming){e.persist();var r=v(e.targetTouches).filter(function(e){return n.tpCache[e.identifier]}).slice(0,2);if(2===r.length){e.stopPropagation();var i=e.target.getBoundingClientRect(),o=r[0].identifier,a=r[1].identifier,l={x1:this.tpCache[o].clientX,y1:this.tpCache[o].clientY,x2:this.tpCache[a].clientX,y2:this.tpCache[a].clientY};l.distance=t.distanceBetweenTwoTouches(c({},l));var s=t.midpointBetweenTwoTouches(c({},l));l.cx=s.x,l.cy=s.y;var u={x1:r[0].clientX,y1:r[0].clientY,x2:r[1].clientX,y2:r[1].clientY};u.distance=t.distanceBetweenTwoTouches(c({},u));var d=t.midpointBetweenTwoTouches(c({},u));u.cx=d.x,u.cy=d.y;var p=N(Q({min:0,max:100,x:(u.cx-i.left)/i.width*100})),h=N(Q({min:0,max:100,x:(u.cy-i.top)/i.height*100})),m=function(e){return Q({min:1,max:3,x:e.scale+(u.distance-l.distance)/100})};this.setState(function(e){return{isZooming:1!==m(e),scale:m(e),x:p,y:h}})}}}},{key:"handleOnTouchEnd",value:function(e){var t=this;this.props.isPinchZoomEnabled&&(v(e.changedTouches).forEach(function(e){delete t.tpCache[e.identifier]}),0===Object.keys(this.tpCache).length&&this.setState({isZooming:!1}))}},{key:"renderLoading",value:function(){if(this.state.isImageLoading){var e=this.props.spinner;return Y.a.createElement("div",{className:T([rt.imageLoadingSpinnerContainer,"carousel__image-loading-spinner-container"])},e&&e(),!e&&Y.a.createElement(nt,null))}return null}},{key:"render",value:function(){var e=this.props,t=(e.carouselStore,e.className),n=e.imageClassName,r=e.overlayClassName,i=(e.isPinchZoomEnabled,e.spinner,e.src),o=e.srcZoomed,a=e.tag,s=f(e,["carouselStore","className","imageClassName","overlayClassName","isPinchZoomEnabled","spinner","src","srcZoomed","tag"]),c=T([rt.container,t]),u=T([rt.image,"carousel__zoom-image",n]),d=T([rt.overlay,"carousel__zoom-image-overlay",this.state.isHovering&&rt.hover,this.state.isZooming&&rt.zoom,this.state.isHovering&&"carousel__zoom-image-overlay--hovering",this.state.isZooming&&"carousel__zoom-image-overlay--zooming",r]),p={};return(this.state.isHovering||this.state.isZooming)&&(p.transformOrigin="".concat(this.state.x," ").concat(this.state.y),p.transform="scale(".concat(this.state.scale,")")),Y.a.createElement(a,l({className:c},s),Y.a.createElement(et,{className:u,tag:"div",src:i,isBgImage:!0,onLoad:this.handleImageComplete,onError:this.handleImageComplete}),Y.a.createElement(et,{className:d,tag:"div",src:o||i,style:p,isBgImage:!0,onFocus:this.handleOnMouseOver,onMouseOver:this.handleOnMouseOver,onBlur:this.handleOnMouseOut,onMouseOut:this.handleOnMouseOut,onMouseMove:this.handleOnMouseMove,onTouchStart:this.handleOnTouchStart,onTouchEnd:this.handleOnTouchEnd,onTouchMove:this.handleOnTouchMove}),this.renderLoading())}}]),t}(Y.a.Component),a(Xe,"propTypes",{carouselStore:G.object.isRequired,className:G.string,imageClassName:G.string,overlayClassName:G.string,spinner:G.func,src:G.string.isRequired,srcZoomed:G.string,tag:G.string,isPinchZoomEnabled:G.bool}),a(Xe,"defaultProps",{className:null,imageClassName:null,overlayClassName:null,isPinchZoomEnabled:!0,spinner:null,srcZoomed:null,tag:"div"}),Ke),ot=(Z(it,function(){return{}}),{slide:"slide___3-Nqo",slideHorizontal:"slideHorizontal___1NzNV",slideInner:"slideInner___2mfX9",focusRing:"focusRing___1airF"}),at=($e=Ge=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.handleOnFocus=i.handleOnFocus.bind(g(i)),i.handleOnBlur=i.handleOnBlur.bind(g(i)),i.state={focused:!1},i}u(t,e);var n=y(t);return o(t,[{key:"isVisible",value:function(){var e=this.props,t=e.currentSlide,n=e.index,r=e.visibleSlides;return n>=t&&n<t+r}},{key:"handleOnFocus",value:function(e){var t=this,n=this.props.onFocus;this.setState({focused:!0},function(){null!==n&&n.call(t,e)})}},{key:"handleOnBlur",value:function(e){var t=this,n=this.props.onBlur;this.setState({focused:!1},function(){null!==n&&n.call(t,e)})}},{key:"renderFocusRing",value:function(){return this.state.focused?Y.a.createElement("div",{className:[ot.focusRing,"carousel__slide-focus-ring"].join(" ")}):null}},{key:"render",value:function(){var e=this,t=this.props,n=(t.carouselStore,t.children,t.className),r=t.classNameHidden,i=t.classNameVisible,o=(t.currentSlide,t.index,t.innerClassName),a=t.innerTag,s=t.naturalSlideHeight,c=t.naturalSlideWidth,u=(t.onBlur,t.onFocus,t.orientation),d=t.slideSize,p=t.style,h=t.tabIndex,m=t.tag,g=t.totalSlides,w=(t.visibleSlides,t.isIntrinsicHeight),y=f(t,["carouselStore","children","className","classNameHidden","classNameVisible","currentSlide","index","innerClassName","innerTag","naturalSlideHeight","naturalSlideWidth","onBlur","onFocus","orientation","slideSize","style","tabIndex","tag","totalSlides","visibleSlides","isIntrinsicHeight"]),v={};"horizontal"===u?(v.width=N(d),v.paddingBottom=N(100*s/(c*g))):(v.width=N(100),v.paddingBottom=N(100*s/c));var b={};w&&("horizontal"===u?v.height="unset":v.width="unset",v.position="unset",v.paddingBottom="unset",b.position="unset");var S=l({},v,p),E=this.isVisible(),C=T([ot.slide,"horizontal"===u&&ot.slideHorizontal,"carousel__slide",this.state.focused&&"carousel__slide--focused",E&&i,E&&"carousel__slide--visible",!E&&r,!E&&"carousel__slide--hidden",n]),_=T([ot.slideInner,"carousel__inner-slide",o]),x=this.isVisible()?0:-1,k="number"==typeof h?h:x;return Y.a.createElement(m,l({ref:function(t){e.tagRef=t},tabIndex:k,"aria-selected":this.isVisible(),role:"option",onFocus:this.handleOnFocus,onBlur:this.handleOnBlur,className:C,style:S},y),Y.a.createElement(a,{ref:function(t){e.innerTagRef=t},className:_,style:b},this.props.children,this.renderFocusRing()))}}]),t}(Y.a.PureComponent),a(Ge,"propTypes",{carouselStore:G.object,children:J.children,className:G.string,classNameHidden:G.string,classNameVisible:G.string,currentSlide:G.number.isRequired,index:G.number.isRequired,innerClassName:G.string,innerTag:G.string,naturalSlideHeight:G.number.isRequired,naturalSlideWidth:G.number.isRequired,onBlur:G.func,onFocus:G.func,orientation:J.orientation.isRequired,slideSize:G.number.isRequired,style:G.object,tabIndex:G.number,tag:G.string,totalSlides:G.number.isRequired,visibleSlides:G.number.isRequired,isIntrinsicHeight:G.bool}),a(Ge,"defaultProps",{carouselStore:null,children:null,className:null,classNameHidden:null,classNameVisible:null,innerClassName:null,innerTag:"div",onBlur:null,onFocus:null,style:{},tabIndex:null,tag:"li",isIntrinsicHeight:!1}),$e),lt=Z(at,function(e){return{currentSlide:e.currentSlide,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,slideSize:e.slideSize,totalSlides:e.totalSlides,visibleSlides:e.visibleSlides,isIntrinsicHeight:e.isIntrinsicHeight}}),st=function(){function e(){r(this,e)}return o(e,[{key:"parents",value:function(e,t){return null===e.parentNode?t:this.parents(e.parentNode,t.concat([e]))}},{key:"scrollParent",value:function(t){for(var n=this.parents(t.parentNode,[]),r=0;r<n.length;r+=1)if(e.scroll(n[r]))return n[r];return document.scrollingElement||document.documentElement}},{key:"getScrollParent",value:function(t){return e.isNodeValid(t)?this.scrollParent(t):null}}],[{key:"style",value:function(e,t){return getComputedStyle(e,null).getPropertyValue(t)}},{key:"overflow",value:function(t){return e.style(t,"overflow")+e.style(t,"overflow-y")+e.style(t,"overflow-x")}},{key:"scroll",value:function(t){return/(auto|scroll)/.test(e.overflow(t))}},{key:"isNodeValid",value:function(e){return e instanceof HTMLElement||e instanceof SVGElement}}]),e}(),ct={horizontalSlider:"horizontalSlider___281Ls",horizontalSliderTray:"horizontalSliderTray___1L-0W",verticalSlider:"verticalSlider___34ZFD",verticalSliderTray:"verticalSliderTray___267D8",verticalTray:"verticalTray___12Key",verticalSlideTrayWrap:"verticalSlideTrayWrap___2nO7o",sliderTray:"sliderTray___-vHFQ",sliderAnimation:"sliderAnimation___300FY",masterSpinnerContainer:"masterSpinnerContainer___1Z6hB"},ut=(Qe=Je=function(e){function t(e){var i;return r(this,t),i=n.call(this,e),i.getSliderRef=i.getSliderRef.bind(g(i)),i.handleDocumentScroll=i.handleDocumentScroll.bind(g(i)),i.handleOnClickCapture=i.handleOnClickCapture.bind(g(i)),i.handleOnKeyDown=i.handleOnKeyDown.bind(g(i)),i.handleOnMouseDown=i.handleOnMouseDown.bind(g(i)),i.handleOnMouseMove=i.handleOnMouseMove.bind(g(i)),i.handleOnMouseUp=i.handleOnMouseUp.bind(g(i)),i.handleOnTouchCancel=i.handleOnTouchCancel.bind(g(i)),i.handleOnTouchEnd=i.handleOnTouchEnd.bind(g(i)),i.handleOnTouchMove=i.handleOnTouchMove.bind(g(i)),i.handleOnTouchStart=i.handleOnTouchStart.bind(g(i)),i.playBackward=i.playBackward.bind(g(i)),i.playForward=i.playForward.bind(g(i)),i.callCallback=i.callCallback.bind(g(i)),i.state={cancelNextClick:!1,deltaX:0,deltaY:0,isBeingMouseDragged:!1,isBeingTouchDragged:!1,startX:0,startY:0},i.interval=null,i.isDocumentScrolling=null,i.moveTimer=null,i.originalOverflow=null,i.scrollParent=null,i.scrollStopTimer=null,i}u(t,e);var n=y(t);return o(t,null,[{key:"slideSizeInPx",value:function(e,t,n,r){return("horizontal"===e?t:n)/r}},{key:"slidesMoved",value:function(e,t,n,r,i,o){var a="horizontal"===t?n:r,l=Math.abs(Math.round(a/i)),s=Math.abs(a)>=i*e?o:0,c=Math.max(s,l);if(a<0)return c;var u=-c;return 0===u?0:u}}]),o(t,[{key:"componentDidMount",value:function(){this.props.lockOnWindowScroll&&window.addEventListener("scroll",this.handleDocumentScroll,!1),document.documentElement.addEventListener("mouseleave",this.handleOnMouseUp,!1),document.documentElement.addEventListener("mousemove",this.handleOnMouseMove,!1),document.documentElement.addEventListener("mouseup",this.handleOnMouseUp,!1),this.props.isPlaying&&this.play()}},{key:"componentDidUpdate",value:function(e){!e.isPlaying&&this.props.isPlaying&&this.play(),e.isPlaying&&!this.props.isPlaying&&this.stop(),!e.isPageScrollLocked&&this.props.isPageScrollLocked&&this.lockScroll(),e.isPageScrollLocked&&!this.props.isPageScrollLocked&&this.unlockScroll(),!1===e.privateUnDisableAnimation&&!0===this.props.privateUnDisableAnimation&&this.props.carouselStore.setStoreState({privateUnDisableAnimation:!1,disableAnimation:!1})}},{key:"componentWillUnmount",value:function(){document.documentElement.removeEventListener("mouseleave",this.handleOnMouseUp,!1),document.documentElement.removeEventListener("mousemove",this.handleOnMouseMove,!1),document.documentElement.removeEventListener("mouseup",this.handleOnMouseUp,!1),window.removeEventListener("scroll",this.handleDocumentScroll,!1),this.stop(),window.cancelAnimationFrame.call(window,this.moveTimer),window.clearTimeout(this.scrollStopTimer),this.isDocumentScrolling=null,this.moveTimer=null,this.scrollStopTimer=null}},{key:"getSliderRef",value:function(e){this.sliderTrayElement=e}},{key:"fakeOnDragStart",value:function(e){var t=e.screenX,n=e.screenY,r=e.touchDrag,i=void 0!==r&&r,o=e.mouseDrag,a=void 0!==o&&o;this.props.carouselStore.setStoreState({isPlaying:!1}),window.cancelAnimationFrame.call(window,this.moveTimer),"vertical"===this.props.orientation&&this.props.carouselStore.setStoreState({isPageScrollLocked:!0}),this.setState({isBeingTouchDragged:i,isBeingMouseDragged:a,startX:t,startY:n})}},{key:"fakeOnDragMove",value:function(e,t){var n=this;this.moveTimer=window.requestAnimationFrame.call(window,function(){n.setState(function(n){return{deltaX:e-n.startX,deltaY:t-n.startY}})})}},{key:"fakeOnDragEnd",value:function(){window.cancelAnimationFrame.call(window,this.moveTimer),this.computeCurrentSlide(),"vertical"===this.props.orientation&&this.props.carouselStore.setStoreState({isPageScrollLocked:!1}),this.setState({deltaX:0,deltaY:0,isBeingTouchDragged:!1,isBeingMouseDragged:!1}),this.isDocumentScrolling=!this.props.lockOnWindowScroll&&null}},{key:"callCallback",value:function(e,t){var n=this.props.trayProps;n&&"function"==typeof n[e]&&(t.persist(),n[e](t))}},{key:"handleOnMouseDown",value:function(e){if(!this.props.dragEnabled)return void this.callCallback("onMouseDown",e);e.preventDefault(),this.fakeOnDragStart({screenX:e.screenX,screenY:e.screenY,mouseDrag:!0}),this.callCallback("onMouseDown",e)}},{key:"handleOnMouseMove",value:function(e){this.state.isBeingMouseDragged&&(this.setState({cancelNextClick:!0}),e.preventDefault(),this.fakeOnDragMove(e.screenX,e.screenY))}},{key:"handleOnMouseUp",value:function(e){this.state.isBeingMouseDragged&&(e.preventDefault(),this.fakeOnDragEnd())}},{key:"handleOnClickCapture",value:function(e){if(!this.state.cancelNextClick)return void this.callCallback("onClickCapture",e);e.preventDefault(),this.setState({cancelNextClick:!1}),this.callCallback("onClickCapture",e)}},{key:"handleOnTouchStart",value:function(e){if(!this.props.touchEnabled)return void this.callCallback("onTouchStart",e);"vertical"===this.props.orientation&&e.preventDefault();var t=e.targetTouches[0];this.fakeOnDragStart({screenX:t.screenX,screenY:t.screenY,touchDrag:!0}),this.callCallback("onTouchStart",e)}},{key:"handleDocumentScroll",value:function(){var e=this;this.props.touchEnabled&&(this.isDocumentScrolling=!0,window.clearTimeout(this.scrollStopTimer),this.scrollStopTimer=window.setTimeout(function(){e.isDocumentScrolling=!1},66))}},{key:"handleOnTouchMove",value:function(e){if(!this.props.touchEnabled||this.props.lockOnWindowScroll&&this.isDocumentScrolling)return void this.callCallback("onTouchMove",e);window.cancelAnimationFrame.call(window,this.moveTimer);var t=e.targetTouches[0];t&&(this.fakeOnDragMove(t.screenX,t.screenY),this.callCallback("onTouchMove",e))}},{key:"forward",value:function(){var e=this.props,t=e.currentSlide,n=e.step,r=e.totalSlides,i=e.visibleSlides;return Math.min(t+n,r-i)}},{key:"backward",value:function(){var e=this.props,t=e.currentSlide,n=e.step;return Math.max(t-n,0)}},{key:"handleOnKeyDown",value:function(e){var t=e.keyCode,n=this.props,r=n.carouselStore,i=n.currentSlide,o=n.disableKeyboard,a=n.totalSlides,l=n.visibleSlides,s={};!0===o||a<=l||(37===t&&(e.preventDefault(),this.focus(),s.currentSlide=Math.max(0,i-1),s.isPlaying=!1),39===t&&(e.preventDefault(),this.focus(),s.currentSlide=Math.min(a-l,i+1),s.isPlaying=!1),r.setStoreState(s))}},{key:"playForward",value:function(){var e=this.props,t=e.carouselStore,n=e.currentSlide;t.setStoreState({currentSlide:this.forward()===n?0:this.forward()})}},{key:"playBackward",value:function(){var e=this.props,t=e.carouselStore,n=e.currentSlide,r=e.totalSlides,i=e.visibleSlides;t.setStoreState({currentSlide:this.backward()===n?r-i:this.backward()})}},{key:"play",value:function(){var e=this.props.playDirection;this.interval=setInterval("forward"===e?this.playForward:this.playBackward,this.props.interval)}},{key:"stop",value:function(){window.clearInterval(this.interval),this.interval=null}},{key:"lockScroll",value:function(){var e=new st;this.scrollParent=e.getScrollParent(this.sliderTrayElement),this.scrollParent&&(this.originalOverflow=this.originalOverflow||this.scrollParent.style.overflow,this.scrollParent.style.overflow="hidden")}},{key:"unlockScroll",value:function(){this.scrollParent&&(this.scrollParent.style.overflow=this.originalOverflow,this.originalOverflow=null,this.scrollParent=null)}},{key:"computeCurrentSlide",value:function(){var e=t.slideSizeInPx(this.props.orientation,this.sliderTrayElement.clientWidth,this.sliderTrayElement.clientHeight,this.props.totalSlides),n=t.slidesMoved(this.props.moveThreshold,this.props.orientation,this.state.deltaX,this.state.deltaY,e,this.props.dragStep),r=this.props.totalSlides-Math.min(this.props.totalSlides,this.props.visibleSlides),i=Q({min:0,max:r,x:this.props.currentSlide+n});this.props.infinite&&(this.props.currentSlide>=r&&n>0&&(i=0),0===this.props.currentSlide&&n<0&&(i=r)),this.props.carouselStore.setStoreState({currentSlide:i})}},{key:"focus",value:function(){this.sliderElement.focus()}},{key:"handleOnTouchEnd",value:function(e){this.endTouchMove(),this.callCallback("onTouchEnd",e)}},{key:"handleOnTouchCancel",value:function(e){this.endTouchMove(),this.callCallback("onTouchCancel",e)}},{key:"endTouchMove",value:function(){this.props.touchEnabled&&this.fakeOnDragEnd()}},{key:"renderMasterSpinner",value:function(){var e=this.props,t=e.hasMasterSpinner,n=e.masterSpinnerFinished,r=e.spinner;return t&&!n?("function"==typeof this.props.onMasterSpinner&&this.props.onMasterSpinner(),Y.a.createElement("div",{className:T([ct.masterSpinnerContainer,"carousel__master-spinner-container"])},r&&r(),!r&&Y.a.createElement(nt,null))):null}},{key:"render",value:function(){var e=this,t=this.props,n=(t.carouselStore,t.children),r=t.className,i=t.classNameAnimation,o=t.classNameTray,a=t.classNameTrayWrap,s=t.currentSlide,c=t.disableAnimation,u=(t.disableKeyboard,t.dragEnabled,t.hasMasterSpinner,t.interval,t.isPageScrollLocked,t.isPlaying,t.lockOnWindowScroll,t.masterSpinnerFinished,t.moveThreshold,t.naturalSlideHeight),d=t.naturalSlideWidth,p=(t.onMasterSpinner,t.orientation),h=(t.playDirection,t.privateUnDisableAnimation,t.slideSize),m=t.slideTraySize,g=(t.spinner,t.style),w=t.tabIndex,y=(t.totalSlides,t.touchEnabled,t.trayProps),v=t.trayTag,b=t.visibleSlides,S=t.isIntrinsicHeight,E=f(t,["carouselStore","children","className","classNameAnimation","classNameTray","classNameTrayWrap","currentSlide","disableAnimation","disableKeyboard","dragEnabled","hasMasterSpinner","interval","isPageScrollLocked","isPlaying","lockOnWindowScroll","masterSpinnerFinished","moveThreshold","naturalSlideHeight","naturalSlideWidth","onMasterSpinner","orientation","playDirection","privateUnDisableAnimation","slideSize","slideTraySize","spinner","style","tabIndex","totalSlides","touchEnabled","trayProps","trayTag","visibleSlides","isIntrinsicHeight"]),C=l({},g),_={};"vertical"===p&&(_.height=0,_.paddingBottom=N(100*u*b/d),_.width=N(100));var x={},k=N(h*s*-1);(this.state.isBeingTouchDragged||this.state.isBeingMouseDragged||c)&&(x.transition="none"),S&&(x.display="flex",x.alignItems="stretch"),"vertical"===p?(x.transform="translateY(".concat(k,") translateY(").concat(this.state.deltaY,"px)"),x.width=N(100),x.flexDirection="column"):(x.width=N(m),x.transform="translateX(".concat(k,") translateX(").concat(this.state.deltaX,"px)"),x.flexDirection="row");var O=T(["vertical"===p?ct.verticalSlider:ct.horizontalSlider,"carousel__slider","vertical"===p?"carousel__slider--vertical":"carousel__slider--horizontal",r]),F=T([ct.sliderTrayWrap,"carousel__slider-tray-wrapper","vertical"===p?ct.verticalSlideTrayWrap:ct.horizontalTrayWrap,"vertical"===p?"carousel__slider-tray-wrap--vertical":"carousel__slider-tray-wrap--horizontal",a]),M=T([ct.sliderTray,i||ct.sliderAnimation,"carousel__slider-tray","vertical"===p?ct.verticalTray:ct.horizontalTray,"vertical"===p?"carousel__slider-tray--vertical":"carousel__slider-tray--horizontal",o]),j=null!==w?w:0,P=(E.dragStep,E.step,E.infinite,f(E,["dragStep","step","infinite"])),D=(y.className,y.onClickCapture,y.onMouseDown,y.onTouchCancel,y.onTouchEnd,y.onTouchMove,y.onTouchStart,y.ref,y.style,f(y,["className","onClickCapture","onMouseDown","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","ref","style"]));return Y.a.createElement("div",l({ref:function(t){e.sliderElement=t},className:O,"aria-live":"polite",style:C,tabIndex:j,onKeyDown:this.handleOnKeyDown,role:"listbox"},P),Y.a.createElement("div",{className:F,style:_},Y.a.createElement(v,l({ref:this.getSliderRef,className:M,style:x,onTouchStart:this.handleOnTouchStart,onTouchMove:this.handleOnTouchMove,onTouchEnd:this.handleOnTouchEnd,onTouchCancel:this.handleOnTouchCancel,onMouseDown:this.handleOnMouseDown,onClickCapture:this.handleOnClickCapture},D),n),this.renderMasterSpinner()))}}]),t}(Y.a.Component),a(Je,"propTypes",{carouselStore:G.object.isRequired,children:G.node.isRequired,className:G.string,classNameAnimation:G.string,classNameTray:G.string,classNameTrayWrap:G.string,currentSlide:G.number.isRequired,disableAnimation:G.bool,disableKeyboard:G.bool,dragEnabled:G.bool.isRequired,dragStep:G.number,hasMasterSpinner:G.bool.isRequired,infinite:G.bool,interval:G.number.isRequired,isPageScrollLocked:G.bool.isRequired,isPlaying:G.bool.isRequired,lockOnWindowScroll:G.bool.isRequired,masterSpinnerFinished:G.bool.isRequired,moveThreshold:G.number,naturalSlideHeight:G.number.isRequired,naturalSlideWidth:G.number.isRequired,onMasterSpinner:G.func,orientation:J.orientation.isRequired,playDirection:J.direction.isRequired,privateUnDisableAnimation:G.bool,slideSize:G.number.isRequired,slideTraySize:G.number.isRequired,spinner:G.func,step:G.number.isRequired,style:G.object,tabIndex:G.number,totalSlides:G.number.isRequired,touchEnabled:G.bool.isRequired,trayProps:G.shape({className:G.string,onClickCapture:G.func,onMouseDown:G.func,onTouchCancel:G.func,onTouchEnd:G.func,onTouchMove:G.func,onTouchStart:G.func,ref:G.shape({}),style:G.string}),trayTag:G.string,visibleSlides:G.number,isIntrinsicHeight:G.bool}),a(Je,"defaultProps",{className:null,classNameAnimation:null,classNameTray:null,classNameTrayWrap:null,disableAnimation:!1,disableKeyboard:!1,dragStep:1,infinite:!1,moveThreshold:.1,onMasterSpinner:null,privateUnDisableAnimation:!1,spinner:null,style:{},tabIndex:null,trayProps:{},trayTag:"ul",visibleSlides:1,isIntrinsicHeight:!1}),Qe),dt=Z(ut,function(e){return{currentSlide:e.currentSlide,disableAnimation:e.disableAnimation,privateUnDisableAnimation:e.privateUnDisableAnimation,disableKeyboard:e.disableKeyboard,dragEnabled:e.dragEnabled,hasMasterSpinner:e.hasMasterSpinner,infinite:e.infinite,interval:e.interval,isPageScrollLocked:e.isPageScrollLocked,isPlaying:e.isPlaying,lockOnWindowScroll:e.lockOnWindowScroll,masterSpinnerFinished:e.masterSpinnerFinished,naturalSlideHeight:e.naturalSlideHeight,naturalSlideWidth:e.naturalSlideWidth,orientation:e.orientation,playDirection:e.playDirection,slideSize:e.slideSize,slideTraySize:e.slideTraySize,step:e.step,dragStep:e.dragStep,totalSlides:e.totalSlides,touchEnabled:e.touchEnabled,visibleSlides:e.visibleSlides,isIntrinsicHeight:e.isIntrinsicHeight}})},function(e,t,n){"use strict";var r=n(65),i=n.n(r),o=n(67),a=n.n(o),l=n(23),s=n.n(l),c=n(153),u=n(68),d=n(154),p=wp.i18n.__,h=wp.blocks.registerBlockType,m=wp,f=m.apiFetch,g=wp.data,w=g.registerStore,y=g.withSelect,v=wp.blockEditor.InspectorControls,b=wp.components,S=b.PanelBody,E=b.PanelRow,C=b.TextControl,_=b.ColorPalette,x=b.RadioControl,k=b.ToggleControl,O=b.SelectControl,T=b.RangeControl,F=window.exactmetrics_gutenberg_tool_vars,M={setThemes:function(e){return{type:"SET_THEMES",themes:e}},receiveThemes:function(e){return{type:"RECEIVE_THEMES",path:e}}};w("exactmetrics/v1/popular-posts/widget",{reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{themes:{}},t=arguments[1];switch(t.type){case"SET_THEMES":return s()({},e,{themes:t.themes})}return e},actions:M,selectors:{receiveThemes:function(e){return e.themes}},controls:{RECEIVE_THEMES:function(e){return f({path:e.path})}},resolvers:{receiveThemes:a.a.mark(function e(t){var n,r;return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M.receiveThemes("/exactmetrics/v1/popular-posts/themes/widget");case 2:if(n=e.sent,void 0===n.themes){e.next=6;break}for(r in n.themes)n.themes.hasOwnProperty(r)&&(n.themes[r].value=r);return e.abrupt("return",M.setThemes(n));case 6:case"end":return e.stop()}},e,this)})}}),h("exactmetrics/popular-posts-widget",{title:p("Popular Posts","google-analytics-dashboard-for-wp"),description:p("Add popular posts from ExactMetrics","google-analytics-dashboard-for-wp"),category:"widgets",icon:c.a.widgetpop,keywords:[p("Popular","google-analytics-dashboard-for-wp"),p("Posts","google-analytics-dashboard-for-wp"),p("Widget","google-analytics-dashboard-for-wp"),"ExactMetrics"],example:{},attributes:{theme:{type:"string"},title_size:{type:"number"},title_color:{type:"string"},label_color:{type:"string"},label_text:{type:"string"},label_background:{type:"string"},background_color:{type:"string"},background_border:{type:"string"},meta_color:{type:"string"},meta_size:{type:"string"},meta_author:{type:"boolean"},meta_date:{type:"boolean"},meta_comments:{type:"boolean"},comments_color:{type:"string"},columns:{type:"number",default:1},widget_title:{type:"boolean"},widget_title_text:{type:"string"},post_count:{type:"number",default:5},categories:{type:"array",default:[]}},edit:y(function(e){return{themes:e("exactmetrics/v1/popular-posts/widget").receiveThemes()}})(function(e){var t=e.attributes,n=t.theme,r=(t.title_size,t.title_color,t.label_color,t.label_text,t.label_background,t.background_color,t.background_border,t.meta_color,t.meta_size,t.meta_author,t.meta_comments,t.meta_date,t.comments_color,t.columns),o=t.widget_title,a=t.widget_title_text,l=t.post_count,s=t.categories,h=e.themes,m=e.setAttributes,f=[{name:"pink",color:"#F58EA8"},{name:"red",color:"#CD3034"},{name:"orange",color:"#FD6A21"},{name:"yellow",color:"#FBB82B"},{name:"green",color:"#7FDBB6"},{name:"green",color:"#21CF86"},{name:"blue",color:"#91D2FA"},{name:"blue",color:"#1B95E0"},{name:"purple",color:"#9A57DD"},{name:"gray",color:"#EEEEEE"},{name:"gray",color:"#ACB8C3"},{name:"black",color:"#000000"}],g=void 0!==h.themes?h.themes:{},w=void 0===e.attributes.theme?h.selected:n,y=void 0!==w&&void 0!==g[w]?g[w]:{},b=void 0!==y.styles?y.styles:{},M={};for(var N in b)if(b.hasOwnProperty(N))for(var j in b[N])if(b[N].hasOwnProperty(j)){var P=N+"_"+j;void 0===e.attributes[P]?M[P]=b[N][j]:M[P]=e.attributes[P],"on"===M[P]&&(M[P]=!0),"off"===M[P]&&(M[P]=!1)}var D=function(e,t){var n=[1,2,3,4,5,6,7,8,9,10];return 2===e&&(n=[2,4,6,8,10]),3===e&&(n=[3,6,9]),t&&(n=n.map(function(e){return{value:e,label:e}})),n},A=function(){if(void 0!==b.meta.author)return wp.element.createElement(k,{label:p("Display Author","google-analytics-dashboard-for-wp"),checked:M.meta_author,onChange:function(e){m(i()({},"meta_author",e))}})},L=function(){if(void 0!==b.meta.date)return wp.element.createElement(k,{label:p("Display Date","google-analytics-dashboard-for-wp"),checked:M.meta_date,onChange:function(e){m(i()({},"meta_date",e))}})},B=function(){if(void 0!==b.meta.comments)return wp.element.createElement(k,{label:p("Display Comments","google-analytics-dashboard-for-wp"),checked:M.meta_comments,onChange:function(e){m(i()({},"meta_comments",e))}})},z=function(){return wp.element.createElement("span",{className:"exactmetrics-wide-column exactmetrics-wide-column-one"},wp.element.createElement("span",null),wp.element.createElement("span",null))},R=function(){return wp.element.createElement("span",{className:"exactmetrics-wide-column exactmetrics-wide-column-two"},wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null))},H=function(){return wp.element.createElement("span",{className:"exactmetrics-wide-column exactmetrics-wide-column-three"},wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null),wp.element.createElement("span",null))},I=function(e,t){var n=M[t];return wp.element.createElement(T,{key:"exactmetrics-popular-posts-input"+t,label:e,value:parseInt(n),min:1,max:100,onChange:function(e){return m(i()({},t,""===e?"":parseInt(e)))}})},q=function(e,t){var n=M[t];return wp.element.createElement(C,{key:"exactmetrics-popular-posts-input"+t,label:e,type:"text",value:n,onChange:function(e){return m(i()({},t,e))}})},V=function(e,t){var n=M[t];return[wp.element.createElement("label",{key:"exactmetrics-popular-posts-label"+t},e),wp.element.createElement(_,{key:"exactmetrics-popular-posts-input"+t,value:n,colors:f,onChange:function(e){m(i()({},t,e))}})]},W=function(e,t){if(e.length>0&&void 0!==e[t]){var n=e[t];return wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-image"},wp.element.createElement("img",{src:F.vue_assets_path+"img/"+n}))}},Z=function(){if(void 0!==b.label)return wp.element.createElement("span",{style:{color:M.label_color,backgroundColor:M.label_background},className:"exactmetrics-widget-popular-posts-label"},M.label_text)},U=function(){if(void 0!==b.meta)return[wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-meta",key:"exactmetrics-widget-popular-posts-meta-options",style:{color:M.meta_color,fontSize:M.meta_size+"px"}},Y(),X(),G()),wp.element.createElement("span",{key:"exactmetrics-widget-popular-posts-comments-options"},K())]},Y=function(){if(M.meta_author)return wp.element.createElement("span",{className:"exactmetrics-widget-popular-posts-author"},"by Aazim Akhtar")},X=function(){if(M.meta_author&&M.meta_date)return wp.element.createElement("span",{dangerouslySetInnerHTML:{__html:b.meta.separator}})},K=function(){if(void 0!==b.meta&&void 0!==b.meta.comments&&M.meta_comments){var e=void 0!==b.comments?M.comments_color:M.meta_color;return wp.element.createElement("span",{className:"exactmetrics-widget-popular-posts-comments",style:{color:e,fontSize:M.meta_size+"px"}},c.a.comments(e)," 24")}},G=function(){if(M.meta_date)return wp.element.createElement("span",{className:"exactmetrics-widget-popular-posts-date"},"Yesterday")},$=function(e){for(;e.length<=10;)e=e.concat(e);return e};return[wp.element.createElement(v,{key:"exactmetrics-popular-posts-widget-inspector-controls"},wp.element.createElement(S,{title:p("Theme","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-theme"},wp.element.createElement(E,{key:"exactmetrics-popular-posts-widget-theme-row"},wp.element.createElement(u.a,{id:"exactmetrics-popular-posts-widget-theme",options:g,selected:w,icons:c.a,onChange:function(e){m({theme:e})}}))),function(){if(void 0!==b.title){var e=[];return void 0!==b.title.size&&e.push(I(p("Title Font Size","google-analytics-dashboard-for-wp"),"title_size")),void 0!==b.title.color&&e.push(V(p("Title Color","google-analytics-dashboard-for-wp"),"title_color")),wp.element.createElement(S,{title:p("Title Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-title"},e)}}(),function(){if(void 0!==b.background&&void 0!==b.background.color){var e=[];return void 0!==b.background.color&&e.push(V(p("Background Color","google-analytics-dashboard-for-wp"),"background_color")),wp.element.createElement(S,{title:p("Background Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-background"}," ",e," ")}}(),function(){if(void 0!==b.label){var e=[];return void 0!==b.label.text&&e.push(q(p("Label Text","google-analytics-dashboard-for-wp"),"label_text")),void 0!==b.label.color&&e.push(V(p("Label Color","google-analytics-dashboard-for-wp"),"label_color")),void 0!==b.label.background&&e.push(V(p("Label Background","google-analytics-dashboard-for-wp"),"label_background")),wp.element.createElement(S,{title:p("Label Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-label"}," ",e," ")}}(),function(){var e=[];if(void 0!==b.border&&void 0!==b.border.color&&e.push(V(p("Border Color","google-analytics-dashboard-for-wp"),"borderColor")),void 0!==b.border&&void 0!==b.border.color2&&e.push(V(p("Bottom Border Color","google-analytics-dashboard-for-wp"),"borderColor2")),void 0!==b.background&&void 0!==b.background.border&&e.push(V(p("Border Color","google-analytics-dashboard-for-wp"),"background_border")),0!==e.length)return wp.element.createElement(S,{title:p("Border Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-inline-border"}," ",e," ")}(),function(){if(void 0!==b.meta){var e=[];return void 0!==b.meta.size&&e.push(I(p("Meta Font Size","google-analytics-dashboard-for-wp"),"meta_size")),void 0!==b.meta.color&&e.push(V(p("Meta Color","google-analytics-dashboard-for-wp"),"meta_color")),wp.element.createElement(S,{title:p("Meta Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-meta-styles"},e)}}(),function(){if(void 0!==b.comments)return wp.element.createElement(S,{title:p("Comment Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-comment-styles"},V(p("Comment Color","google-analytics-dashboard-for-wp"),"comments_color"))}(),function(){return wp.element.createElement(S,{title:p("Wide-Layout Options","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-columns"},wp.element.createElement(x,{label:p("Choose Layout","google-analytics-dashboard-for-wp"),help:p("Adjust the number of columns displayed when the widget is placed in a wide container.","google-analytics-dashboard-for-wp"),className:"exactmetrics-wide-column-options",key:"exactmetrics-popular-posts-widget-columns-control",options:[{value:1,label:z()},{value:2,label:R()},{value:3,label:H()}],selected:r,onChange:function(e){m(i()({},"columns",""===e?"":parseInt(e)));var t=D(parseInt(e));-1===t.indexOf(l)&&m(i()({},"post_count",parseInt(t[0])))}}),wp.element.createElement(O,{label:p("Post Count","google-analytics-dashboard-for-wp"),help:p("Number of posts displayed.","google-analytics-dashboard-for-wp"),options:D(r,!0),value:l,key:"exactmetrics-popular-posts-widget-post-count",onChange:function(e){m(i()({},"post_count",parseInt(e)))}}))}(),function(){if(void 0!==b.meta)return wp.element.createElement(S,{title:p("Display Options","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-meta-options"},A(),L(),B())}(),function(){return wp.element.createElement(S,{title:p("Behavior Settings","google-analytics-dashboard-for-wp"),key:"exactmetrics-popular-posts-widget-behavior-options"},wp.element.createElement(k,{label:p("Display Widget Title","google-analytics-dashboard-for-wp"),checked:o,onChange:function(e){m(i()({},"widget_title",e))}}),wp.element.createElement(C,{key:"exactmetrics-popular-posts-input-widget-title-text",label:p("Widget Title","google-analytics-dashboard-for-wp"),type:"text",value:a,onChange:function(e){return m(i()({},"widget_title_text",e))}}),wp.element.createElement(d.a,{label:p("Only Show Posts From These Categories","google-analytics-dashboard-for-wp"),slug:"category",onUpdateTerms:function(e){m(i()({},"categories",e))},terms:s}))}()),wp.element.createElement("div",{key:"exactmetrics-popular-posts-widget-preview"},wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-widget exactmetrics-widget-popular-posts-"+w+" exactmetrics-widget-popular-posts-columns-"+r},function(){if(o)return wp.element.createElement("h2",{className:"exactmetrics-widget-popular-posts-widget-title"},a)}(),wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-text"},function(){if(void 0!==y.list&&void 0!==y.list.items){var e=$(y.list.items),t=void 0!==y.list.images?$(y.list.images):[],n=[];for(var r in e){if(parseInt(r)===parseInt(l))break;n.push(wp.element.createElement("li",{key:"exactmetrics-popular-posts-preview-list-item-"+r,style:{backgroundColor:M.background_color,borderColor:M.background_border}},W(t,r),wp.element.createElement("div",{className:"exactmetrics-widget-popular-posts-text"},Z(),wp.element.createElement("a",{className:"exactmetrics-widget-popular-posts-title",style:{color:M.title_color,fontSize:M.title_size+"px"}},e[r]),U())))}return wp.element.createElement("ul",{className:"exactmetrics-widget-popular-posts-list"},n)}}())))]}),save:function(e){return null}})},function(e,t,n){"use strict";var r={};r.widgetpop=wp.element.createElement("svg",{width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 0C0.895431 0 0 0.895431 0 2V10C0 11.1046 0.895431 12 2 12H14C15.1046 12 16 11.1046 16 10V2C16 0.895431 15.1046 0 14 0H2ZM8.94046 4.70557L8 2L7.05954 4.70557L4.19577 4.76393L6.47831 6.49443L5.64886 9.23607L8 7.6L10.3511 9.23607L9.52169 6.49443L11.8042 4.76393L8.94046 4.70557ZM0 14H14V16H0V14ZM10 18H0V20H10V18Z",fill:"#555D66"})),r.alpha=wp.element.createElement("svg",{width:"74",height:"46",viewBox:"0 0 74 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"46",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"7.39999",y:"12",width:"59.2",height:"9",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"7.39999",y:"25",width:"51.8",height:"9",rx:"2",fill:"#6528F5"})),r.beta=wp.element.createElement("svg",{width:"74",height:"46",viewBox:"0 0 74 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("path",{d:"M0 15C0 13.3431 1.34315 12 3 12H4V34H3C1.34315 34 0 32.6569 0 31V15Z",fill:"#6528F5"}),wp.element.createElement("rect",{x:"12",y:"12",width:"54",height:"9",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"12",y:"25",width:"44",height:"9",rx:"2",fill:"#8453F7"})),r.charlie=wp.element.createElement("svg",{width:"74",height:"46",viewBox:"0 0 74 46",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"46",rx:"3",fill:"#F0EAFE"}),wp.element.createElement("rect",{width:"74",height:"4",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"14",width:"58",height:"9",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"8",y:"27",width:"40",height:"9",rx:"2",fill:"#8453F7"})),r.delta=wp.element.createElement("svg",{width:"74",height:"39",viewBox:"0 0 74 39",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{x:"31",y:"12",width:"43",height:"7",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"31",y:"23",width:"32",height:"7",rx:"2",fill:"#8453F7"}),wp.element.createElement("rect",{x:"31",y:"34",width:"43",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{y:"12",width:"27",height:"27",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{width:"74",height:"4",fill:"#6528F5"})),r.echo=wp.element.createElement("svg",{width:"74",height:"76",viewBox:"0 0 74 76",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"76",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"41",width:"58",height:"7",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"61",width:"7",height:"7",rx:"3.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"8",y:"8",width:"58",height:"29",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"52",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"52",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.foxtrot=wp.element.createElement("svg",{width:"74",height:"43",viewBox:"0 0 74 43",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"43",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"8",width:"58",height:"7",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"28",width:"7",height:"7",rx:"3.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"8",y:"19",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"19",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.golf=wp.element.createElement("svg",{width:"74",height:"56",viewBox:"0 0 74 56",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"56",rx:"5",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"21",width:"58",height:"7",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"41",width:"7",height:"7",rx:"3.5",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"8",y:"8",width:"16",height:"9",rx:"2",fill:"#6528F5"}),wp.element.createElement("rect",{x:"8",y:"32",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"32",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.hotel=wp.element.createElement("svg",{width:"74",height:"50",viewBox:"0 0 74 50",fill:"none",xmlns:"http://www.w3.org/2000/svg"},wp.element.createElement("rect",{width:"74",height:"50",rx:"5",fill:"#6528F5"}),wp.element.createElement("path",{d:"M54.0625 42H19.9375C18.8438 42 17.9141 41.6111 17.1484 40.8333C16.3828 40.0556 16 39.1111 16 38V14C16 12.8889 16.3828 11.9444 17.1484 11.1667C17.9141 10.3889 18.8438 10 19.9375 10H54.0625C55.1562 10 56.0859 10.3889 56.8516 11.1667C57.6172 11.9444 58 12.8889 58 14V38C58 39.1111 57.6172 40.0556 56.8516 40.8333C56.0859 41.6111 55.1562 42 54.0625 42ZM28.3867 16.0833C27.5117 15.1389 26.4453 14.6667 25.1875 14.6667C23.9297 14.6667 22.8359 15.1389 21.9062 16.0833C21.0312 16.9722 20.5938 18.0556 20.5938 19.3333C20.5938 20.6111 21.0312 21.7222 21.9062 22.6667C22.8359 23.5556 23.9297 24 25.1875 24C26.4453 24 27.5117 23.5556 28.3867 22.6667C29.3164 21.7222 29.7812 20.6111 29.7812 19.3333C29.7812 18.0556 29.3164 16.9722 28.3867 16.0833ZM21.25 36.6667H52.75V27.3333L45.5312 20C45.0938 19.5556 44.6562 19.5556 44.2188 20L33.0625 31.3333L28.4688 26.6667C28.0312 26.2222 27.5938 26.2222 27.1562 26.6667L21.25 32.6667V36.6667Z",fill:"#8453F7"}),wp.element.createElement("rect",{x:"8",y:"26",width:"58",height:"7",rx:"2",fill:"#F0EAFE"}),wp.element.createElement("rect",{x:"8",y:"37",width:"34",height:"5",rx:"2",fill:"#D1BFFC"}),wp.element.createElement("rect",{x:"46",y:"37",width:"20",height:"5",rx:"2",fill:"#D1BFFC"})),r.comments=function(e){return wp.element.createElement("svg",{width:"13",height:"12",viewBox:"0 0 13 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{fill:e}},wp.element.createElement("path",{d:"M7.8251 1.25893C8.70332 2.09821 9.14243 3.10714 9.14243 4.28571C9.14243 5.46429 8.70332 6.47321 7.8251 7.3125C6.94689 8.15179 5.8887 8.57143 4.65056 8.57143C3.78674 8.57143 2.98771 8.34821 2.25346 7.90179C1.63439 8.34821 0.993719 8.57143 0.331456 8.57143C0.302662 8.57143 0.273868 8.5625 0.245074 8.54464C0.216279 8.50893 0.194684 8.47321 0.180287 8.4375C0.151493 8.34821 0.158691 8.26786 0.201882 8.19643C0.50422 7.83929 0.763366 7.35714 0.979321 6.75C0.432235 6.01786 0.158691 5.19643 0.158691 4.28571C0.158691 3.10714 0.5978 2.09821 1.47602 1.25893C2.35424 0.419643 3.41242 0 4.65056 0C5.8887 0 6.94689 0.419643 7.8251 1.25893ZM11.7771 10.1786C11.993 10.7857 12.2522 11.2679 12.5545 11.625C12.5977 11.6964 12.6049 11.7768 12.5761 11.8661C12.5473 11.9554 12.4969 12 12.425 12C11.7627 12 11.122 11.7768 10.5029 11.3304C9.7687 11.7768 8.96967 12 8.10585 12C7.18444 12 6.34941 11.7589 5.60076 11.2768C4.85212 10.7946 4.30503 10.1607 3.9595 9.375C4.21865 9.41071 4.449 9.42857 4.65056 9.42857C6.07587 9.42857 7.29241 8.92857 8.30021 7.92857C9.32239 6.91071 9.83349 5.69643 9.83349 4.28571C9.83349 4.08929 9.82629 3.91071 9.81189 3.75C10.6325 4.07143 11.302 4.59821 11.8203 5.33036C12.3386 6.04464 12.5977 6.83929 12.5977 7.71429C12.5977 8.625 12.3242 9.44643 11.7771 10.1786Z"}))},t.a=r},function(e,t,n){"use strict";var r=n(155),i=n.n(r),o=n(159),a=n.n(o),l=n(160),s=n.n(l),c=n(161),u=n.n(c),d=n(174),p=n.n(d),h=n(18),m=(n.n(h),n(182),n(205)),f=wp.components.CheckboxControl,g=function(e){function t(){a()(this,t);var e=u()(this,(t.__proto__||i()(t)).call(this));return e.state={},e}return p()(t,e),s()(t,[{key:"renderTerms",value:function(e){return e.map(function(e){return wp.element.createElement("div",{key:e.id,className:"editor-post-taxonomies__hierarchical-terms-choice"},wp.element.createElement(f,{checked:!0,label:Object(h.unescape)(e.name)}))})}},{key:"render",value:function(){return[wp.element.createElement("label",{key:"exactmetrics-hierarchical-term-list-label",className:"components-base-control__label"},this.props.label,wp.element.createElement("span",{className:"exactmetrics-popular-posts-pro-pill"},"PRO")),wp.element.createElement("div",{className:"editor-post-taxonomies__hierarchical-terms-list exactmetrics-hierarchical-terms exactmetrics-hierarchical-terms-disabled",key:"exactmetrics-hierarchical-term-list",tabIndex:"0",role:"group"},this.renderTerms([{name:"News",id:1},{name:"Technology",id:2}]))]}}]),t}(m.a);t.a=g},function(e,t,n){e.exports={default:n(156),__esModule:!0}},function(e,t,n){n(157),e.exports=n(0).Object.getPrototypeOf},function(e,t,n){var r=n(16),i=n(52);n(158)("getPrototypeOf",function(){return function(e){return i(r(e))}})},function(e,t,n){var r=n(4),i=n(0),o=n(12);e.exports=function(e,t){var n=(i.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*o(function(){n(1)}),"Object",a)}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(66),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,i.default)(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}()},function(e,t,n){"use strict";t.__esModule=!0;var r=n(70),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,i.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){e.exports={default:n(163),__esModule:!0}},function(e,t,n){n(19),n(39),e.exports=n(40).f("iterator")},function(e,t,n){e.exports={default:n(165),__esModule:!0}},function(e,t,n){n(166),n(171),n(172),n(173),e.exports=n(0).Symbol},function(e,t,n){"use strict";var r=n(5),i=n(9),o=n(7),a=n(4),l=n(48),s=n(167).KEY,c=n(12),u=n(35),d=n(37),p=n(22),h=n(2),m=n(40),f=n(41),g=n(168),w=n(169),y=n(8),v=n(11),b=n(16),S=n(14),E=n(31),C=n(15),_=n(32),x=n(170),k=n(72),O=n(38),T=n(6),F=n(21),M=k.f,N=T.f,j=x.f,P=r.Symbol,D=r.JSON,A=D&&D.stringify,L=h("_hidden"),B=h("toPrimitive"),z={}.propertyIsEnumerable,R=u("symbol-registry"),H=u("symbols"),I=u("op-symbols"),q=Object.prototype,V="function"==typeof P&&!!O.f,W=r.QObject,Z=!W||!W.prototype||!W.prototype.findChild,U=o&&c(function(){return 7!=_(N({},"a",{get:function(){return N(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=M(q,t);r&&delete q[t],N(e,t,n),r&&e!==q&&N(q,t,r)}:N,Y=function(e){var t=H[e]=_(P.prototype);return t._k=e,t},X=V&&"symbol"==typeof P.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof P},K=function(e,t,n){return e===q&&K(I,t,n),y(e),t=E(t,!0),y(n),i(H,t)?(n.enumerable?(i(e,L)&&e[L][t]&&(e[L][t]=!1),n=_(n,{enumerable:C(0,!1)})):(i(e,L)||N(e,L,C(1,{})),e[L][t]=!0),U(e,t,n)):N(e,t,n)},G=function(e,t){y(e);for(var n,r=g(t=S(t)),i=0,o=r.length;o>i;)K(e,n=r[i++],t[n]);return e},$=function(e,t){return void 0===t?_(e):G(_(e),t)},J=function(e){var t=z.call(this,e=E(e,!0));return!(this===q&&i(H,e)&&!i(I,e))&&(!(t||!i(this,e)||!i(H,e)||i(this,L)&&this[L][e])||t)},Q=function(e,t){if(e=S(e),t=E(t,!0),e!==q||!i(H,t)||i(I,t)){var n=M(e,t);return!n||!i(H,t)||i(e,L)&&e[L][t]||(n.enumerable=!0),n}},ee=function(e){for(var t,n=j(S(e)),r=[],o=0;n.length>o;)i(H,t=n[o++])||t==L||t==s||r.push(t);return r},te=function(e){for(var t,n=e===q,r=j(n?I:S(e)),o=[],a=0;r.length>a;)!i(H,t=r[a++])||n&&!i(q,t)||o.push(H[t]);return o};V||(P=function(){if(this instanceof P)throw TypeError("Symbol is not a constructor!");var e=p(arguments.length>0?arguments[0]:void 0),t=function(n){this===q&&t.call(I,n),i(this,L)&&i(this[L],e)&&(this[L][e]=!1),U(this,e,C(1,n))};return o&&Z&&U(q,e,{configurable:!0,set:t}),Y(e)},l(P.prototype,"toString",function(){return this._k}),k.f=Q,T.f=K,n(71).f=x.f=ee,n(24).f=J,O.f=te,o&&!n(20)&&l(q,"propertyIsEnumerable",J,!0),m.f=function(e){return Y(h(e))}),a(a.G+a.W+a.F*!V,{Symbol:P});for(var ne="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;ne.length>re;)h(ne[re++]);for(var ie=F(h.store),oe=0;ie.length>oe;)f(ie[oe++]);a(a.S+a.F*!V,"Symbol",{for:function(e){return i(R,e+="")?R[e]:R[e]=P(e)},keyFor:function(e){if(!X(e))throw TypeError(e+" is not a symbol!");for(var t in R)if(R[t]===e)return t},useSetter:function(){Z=!0},useSimple:function(){Z=!1}}),a(a.S+a.F*!V,"Object",{create:$,defineProperty:K,defineProperties:G,getOwnPropertyDescriptor:Q,getOwnPropertyNames:ee,getOwnPropertySymbols:te});var ae=c(function(){O.f(1)});a(a.S+a.F*ae,"Object",{getOwnPropertySymbols:function(e){return O.f(b(e))}}),D&&a(a.S+a.F*(!V||c(function(){var e=P();return"[null]"!=A([e])||"{}"!=A({a:e})||"{}"!=A(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=t=r[1],(v(t)||void 0!==e)&&!X(e))return w(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!X(t))return t}),r[1]=t,A.apply(D,r)}}),P.prototype[B]||n(10)(P.prototype,B,P.prototype.valueOf),d(P,"Symbol"),d(Math,"Math",!0),d(r.JSON,"JSON",!0)},function(e,t,n){var r=n(22)("meta"),i=n(11),o=n(9),a=n(6).f,l=0,s=Object.isExtensible||function(){return!0},c=!n(12)(function(){return s(Object.preventExtensions({}))}),u=function(e){a(e,r,{value:{i:"O"+ ++l,w:{}}})},d=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!s(e))return"F";if(!t)return"E";u(e)}return e[r].i},p=function(e,t){if(!o(e,r)){if(!s(e))return!0;if(!t)return!1;u(e)}return e[r].w},h=function(e){return c&&m.NEED&&s(e)&&!o(e,r)&&u(e),e},m=e.exports={KEY:r,NEED:!1,fastKey:d,getWeak:p,onFreeze:h}},function(e,t,n){var r=n(21),i=n(38),o=n(24);e.exports=function(e){var t=r(e),n=i.f;if(n)for(var a,l=n(e),s=o.f,c=0;l.length>c;)s.call(e,a=l[c++])&&t.push(a);return t}},function(e,t,n){var r=n(33);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(14),i=n(71).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],l=function(e){try{return i(e)}catch(e){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?l(e):i(r(e))}},function(e,t){},function(e,t,n){n(41)("asyncIterator")},function(e,t,n){n(41)("observable")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(175),o=r(i),a=n(179),l=r(a),s=n(70),c=r(s);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,c.default)(t)));e.prototype=(0,l.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o.default?(0,o.default)(e,t):e.__proto__=t)}},function(e,t,n){e.exports={default:n(176),__esModule:!0}},function(e,t,n){n(177),e.exports=n(0).Object.setPrototypeOf},function(e,t,n){var r=n(4);r(r.S,"Object",{setPrototypeOf:n(178).set})},function(e,t,n){var r=n(11),i=n(8),o=function(e,t){if(i(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{r=n(30)(Function.call,n(72).f(Object.prototype,"__proto__").set,2),r(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:r(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){e.exports={default:n(180),__esModule:!0}},function(e,t,n){n(181);var r=n(0).Object;e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){var r=n(4);r(r.S,"Object",{create:n(32)})},function(e,t,n){"use strict";n(183),n(73),n(191)},function(e,t,n){"use strict";var r=n(184),i=n.n(r),o=n(185);n.n(o),i()(console.error)},function(e,t,n){function r(e,t){function n(){var n,a,l=r,s=arguments.length;e:for(;l;){if(l.args.length===arguments.length){for(a=0;a<s;a++)if(l.args[a]!==arguments[a]){l=l.next;continue e}return l!==r&&(l===i&&(i=l.prev),l.prev.next=l.next,l.next&&(l.next.prev=l.prev),l.next=r,l.prev=null,r.prev=l,r=l),l.val}l=l.next}for(n=new Array(s),a=0;a<s;a++)n[a]=arguments[a];return l={args:n,val:e.apply(null,n)},r?(r.prev=l,l.next=r):i=l,o===t.maxSize?(i=i.prev,i.next=null):o++,r=l,l.val}var r,i,o=0;return t=t||{},n.clear=function(){r=null,i=null,o=0},n}e.exports=r},function(e,t,n){var r;!function(){"use strict";function i(e){return a(l(e),arguments)}function o(e,t){return i.apply(null,[e].concat(t||[]))}function a(e,t){var n,r,o,a,l,c,u,d,p,h=1,m=e.length,f="";for(r=0;r<m;r++)if("string"==typeof e[r])f+=e[r];else if("object"==typeof e[r]){if(a=e[r],a.keys)for(n=t[h],o=0;o<a.keys.length;o++){if(void 0==n)throw new Error(i('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));n=n[a.keys[o]]}else n=a.param_no?t[a.param_no]:t[h++];if(s.not_type.test(a.type)&&s.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),s.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(i("[sprintf] expecting number but found %T",n));switch(s.number.test(a.type)&&(d=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}s.json.test(a.type)?f+=n:(!s.number.test(a.type)||d&&!a.sign?p="":(p=d?"+":"-",n=n.toString().replace(s.sign,"")),c=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",u=a.width-(p+n).length,l=a.width&&u>0?c.repeat(u):"",f+=a.align?p+n+l:"0"===c?p+l+n:l+p+n)}return f}function l(e){if(c[e])return c[e];for(var t,n=e,r=[],i=0;n;){if(null!==(t=s.text.exec(n)))r.push(t[0]);else if(null!==(t=s.modulo.exec(n)))r.push("%");else{if(null===(t=s.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){i|=1;var o=[],a=t[2],l=[];if(null===(l=s.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(l[1]);""!==(a=a.substring(l[0].length));)if(null!==(l=s.key_access.exec(a)))o.push(l[1]);else{if(null===(l=s.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(l[1])}t[2]=o}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return c[e]=r}var s={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/},c=Object.create(null);t.sprintf=i,t.vsprintf=o,"undefined"!=typeof window&&(window.sprintf=i,window.vsprintf=o,void 0!==(r=function(){return{sprintf:i,vsprintf:o}}.call(t,n,t,e))&&(e.exports=r))}()},function(e,t,n){"use strict";function r(e){var t,n,r;for(t=e.split(";"),n=0;n<t.length;n++)if(r=t[n].trim(),0===r.indexOf("plural="))return r.substr(7)}function i(e,t){var n;this.data=e,this.pluralForms={},this.options={};for(n in a)this.options[n]=void 0!==t&&n in t?t[n]:a[n]}t.a=i;var o=n(187),a={contextDelimiter:"",onMissingKey:null};i.prototype.getPluralForm=function(e,t){var n,i,a,l=this.pluralForms[e];return l||(n=this.data[e][""],a=n["Plural-Forms"]||n["plural-forms"]||n.plural_forms,"function"!=typeof a&&(i=r(n["Plural-Forms"]||n["plural-forms"]||n.plural_forms),a=Object(o.a)(i)),l=this.pluralForms[e]=a),l(t)},i.prototype.dcnpgettext=function(e,t,n,r,i){var o,a,l;return o=void 0===i?0:this.getPluralForm(e,i),a=n,t&&(a=t+this.options.contextDelimiter+n),(l=this.data[e][a])&&l[o]?l[o]:(this.options.onMissingKey&&this.options.onMissingKey(n,e),0===o?n:r)}},function(e,t,n){"use strict";function r(e){var t=Object(i.a)(e);return function(e){return+t({n:e})}}t.a=r;var i=n(188)},function(e,t,n){"use strict";function r(e){var t=Object(i.a)(e);return function(e){return Object(o.a)(t,e)}}t.a=r;var i=n(189),o=n(190)},function(e,t,n){"use strict";function r(e){for(var t,n,r,s,c=[],u=[];t=e.match(l);){for(n=t[0],r=e.substr(0,t.index).trim(),r&&c.push(r);s=u.pop();){if(a[n]){if(a[n][0]===s){n=a[n][1]||n;break}}else if(o.indexOf(s)>=0||i[s]<i[n]){u.push(s);break}c.push(s)}a[n]||u.push(n),e=e.substr(t.index+n.length)}return e=e.trim(),e&&c.push(e),c.concat(u.reverse())}t.a=r;var i,o,a,l;i={"(":9,"!":8,"*":7,"/":7,"%":7,"+":6,"-":6,"<":5,"<=":5,">":5,">=":5,"==":4,"!=":4,"&&":3,"||":2,"?":1,"?:":1},o=["(","?"],a={")":["("],":":["?","?:"]},l=/<=|>=|==|!=|&&|\|\||\?:|\(|!|\*|\/|%|\+|-|<|>|\?|\)|:/},function(e,t,n){"use strict";function r(e,t){var n,r,o,a,l,s,c=[];for(n=0;n<e.length;n++){if(l=e[n],a=i[l]){for(r=a.length,o=Array(r);r--;)o[r]=c.pop();try{s=a.apply(null,o)}catch(e){return e}}else s=t.hasOwnProperty(l)?t[l]:+l;c.push(s)}return c[0]}t.a=r;var i={"!":function(e){return!e},"*":function(e,t){return e*t},"/":function(e,t){return e/t},"%":function(e,t){return e%t},"+":function(e,t){return e+t},"-":function(e,t){return e-t},"<":function(e,t){return e<t},"<=":function(e,t){return e<=t},">":function(e,t){return e>t},">=":function(e,t){return e>=t},"==":function(e,t){return e===t},"!=":function(e,t){return e!==t},"&&":function(e,t){return e&&t},"||":function(e,t){return e||t},"?:":function(e,t,n){if(e)throw t;return n}}},function(e,t,n){"use strict";var r=n(73),i=n(192),o=Object(r.a)(void 0,void 0,i.a);o.getLocaleData.bind(o),o.setLocaleData.bind(o),o.resetLocaleData.bind(o),o.subscribe.bind(o),o.__.bind(o),o._x.bind(o),o._n.bind(o),o._nx.bind(o),o.isRTL.bind(o),o.hasTranslation.bind(o)},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(193),i=Object(r.a)();i.addAction,i.addFilter,i.removeAction,i.removeFilter,i.hasAction,i.hasFilter,i.removeAllActions,i.removeAllFilters,i.doAction,i.applyFilters,i.currentAction,i.currentFilter,i.doingAction,i.doingFilter,i.didAction,i.didFilter,i.actions,i.filters},function(e,t,n){"use strict";function r(){return new p}var i=n(194),o=n(195),a=n(196),l=n(197),s=n(198),c=n(202),u=n(203),d=n(204),p=function e(){Object(i.a)(this,e),this.actions=Object.create(null),this.actions.__current=[],this.filters=Object.create(null),this.filters.__current=[],this.addAction=Object(o.a)(this,"actions"),this.addFilter=Object(o.a)(this,"filters"),this.removeAction=Object(a.a)(this,"actions"),this.removeFilter=Object(a.a)(this,"filters"),this.hasAction=Object(l.a)(this,"actions"),this.hasFilter=Object(l.a)(this,"filters"),this.removeAllActions=Object(a.a)(this,"actions",!0),this.removeAllFilters=Object(a.a)(this,"filters",!0),this.doAction=Object(s.a)(this,"actions"),this.applyFilters=Object(s.a)(this,"filters",!0),this.currentAction=Object(c.a)(this,"actions"),this.currentFilter=Object(c.a)(this,"filters"),this.doingAction=Object(u.a)(this,"actions"),this.doingFilter=Object(u.a)(this,"filters"),this.didAction=Object(d.a)(this,"actions"),this.didFilter=Object(d.a)(this,"filters")};t.a=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.a=r},function(e,t,n){"use strict";function r(e,t){return function(n,r,a){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,s=e[t];if(Object(o.a)(n)&&Object(i.a)(r)){if("function"!=typeof a)return void console.error("The hook callback must be a function.");if("number"!=typeof l)return void console.error("If specified, the hook priority must be a number.");var c={callback:a,priority:l,namespace:r};if(s[n]){var u,d=s[n].handlers;for(u=d.length;u>0&&!(l>=d[u-1].priority);u--);u===d.length?d[u]=c:d.splice(u,0,c),s.__current.forEach(function(e){e.name===n&&e.currentIndex>=u&&e.currentIndex++})}else s[n]={handlers:[c],runs:0};"hookAdded"!==n&&e.doAction("hookAdded",n,r,a,l)}}}var i=n(74),o=n(42);t.a=r},function(e,t,n){"use strict";function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r,a){var l=e[t];if(Object(o.a)(r)&&(n||Object(i.a)(a))){if(!l[r])return 0;var s=0;if(n)s=l[r].handlers.length,l[r]={runs:l[r].runs,handlers:[]};else for(var c=l[r].handlers,u=c.length-1;u>=0;u--)!function(e){c[e].namespace===a&&(c.splice(e,1),s++,l.__current.forEach(function(t){t.name===r&&t.currentIndex>=e&&t.currentIndex--}))}(u);return"hookRemoved"!==r&&e.doAction("hookRemoved",r,a),s}}}var i=n(74),o=n(42);t.a=r},function(e,t,n){"use strict";function r(e,t){return function(n,r){var i=e[t];return void 0!==r?n in i&&i[n].handlers.some(function(e){return e.namespace===r}):n in i}}t.a=r},function(e,t,n){"use strict";function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function(r){var i=e[t];i[r]||(i[r]={handlers:[],runs:0}),i[r].runs++;for(var o=i[r].handlers,a=arguments.length,l=new Array(a>1?a-1:0),s=1;s<a;s++)l[s-1]=arguments[s];if(!o||!o.length)return n?l[0]:void 0;var c={name:r,currentIndex:0};for(i.__current.push(c);c.currentIndex<o.length;){var u=o[c.currentIndex],d=u.callback.apply(null,l);n&&(l[0]=d),c.currentIndex++}return i.__current.pop(),n?l[0]:void 0}}n(75);t.a=r},function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return Object(i.a)(e)}t.a=r;var i=n(76)},function(e,t,n){"use strict";function r(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}t.a=r},function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}t.a=r},function(e,t,n){"use strict";function r(e,t){return function(){var n,r,i=e[t];return null!==(n=null===(r=i.__current[i.__current.length-1])||void 0===r?void 0:r.name)&&void 0!==n?n:null}}t.a=r},function(e,t,n){"use strict";function r(e,t){return function(n){var r=e[t];return void 0===n?void 0!==r.__current[0]:!!r.__current[0]&&n===r.__current[0].name}}t.a=r},function(e,t,n){"use strict";function r(e,t){return function(n){var r=e[t];if(Object(i.a)(n))return r[n]&&r[n].runs?r[n].runs:0}}var i=n(42);t.a=r},function(e,t,n){"use strict";var r=(n(206),n(27));n.d(t,"a",function(){return r.a});n(212),n(214),n(215),n(216),n(79)},function(e,t,n){"use strict";n(207),n(78),n(75),n(27)},function(e,t,n){"use strict";function r(e,t){return Object(i.a)(e)||Object(o.a)(e,t)||Object(a.a)(e,t)||Object(l.a)()}t.a=r;var i=n(208),o=n(209),a=n(77),l=n(210)},function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}t.a=r},function(e,t,n){"use strict";function r(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}}t.a=r},function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}t.a=r},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}t.a=r},function(e,t,n){"use strict";var r=n(213);n.n(r)},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";var r=n(18);n.n(r)},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=(n(26),n(43),n(78),n(18)),i=(n.n(r),n(217),n(27)),o=(n(79),Object(i.e)(void 0));o.Provider,o.Consumer,Object(i.g)(function(){return null}),new Set(["string","boolean","number"]),new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),new Set(["allowfullscreen","allowpaymentrequest","allowusermedia","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","typemustmatch"]),new Set(["autocapitalize","autocomplete","charset","contenteditable","crossorigin","decoding","dir","draggable","enctype","formenctype","formmethod","http-equiv","inputmode","kind","method","preload","scope","shape","spellcheck","translate","type","wrap"]),new Set(["animation","animationIterationCount","baselineShift","borderImageOutset","borderImageSlice","borderImageWidth","columnCount","cx","cy","fillOpacity","flexGrow","flexShrink","floodOpacity","fontWeight","gridColumnEnd","gridColumnStart","gridRowEnd","gridRowStart","lineHeight","opacity","order","orphans","r","rx","ry","shapeImageThreshold","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","tabSize","widows","x","y","zIndex","zoom"])},function(e,t,n){"use strict";function r(e){return e.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi,"&")}function i(e){return e.replace(/"/g,""")}function o(e){return e.replace(/</g,"<")}function a(e){return Object(c.a)(i(r(e)))}function l(e){return o(r(e))}function s(e){return!u.test(e)}t.a=a,t.b=l,t.c=s;var c=n(218),u=/[\u007F-\u009F "'>\/="\uFDD0-\uFDEF]/},function(e,t,n){"use strict";function r(e){return e.replace(/>/g,">")}t.a=r}]);
|
assets/images/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/js/admin-common.js
CHANGED
@@ -1,33 +1,33 @@
|
|
1 |
-
jQuery( document ).ready( function( $ ) {
|
2 |
-
/**
|
3 |
-
* Dismissable Notices
|
4 |
-
* - Sends an AJAX request to mark the notice as dismissed
|
5 |
-
*/
|
6 |
-
$( 'div.exactmetrics-notice' ).on( 'click', 'button.notice-dismiss', function( e ) {
|
7 |
-
e.preventDefault();
|
8 |
-
$( this ).closest( 'div.exactmetrics-notice' ).fadeOut();
|
9 |
-
|
10 |
-
// If this is a dismissible notice, it means we need to send an AJAX request
|
11 |
-
if ( $( this ).parent().hasClass( 'is-dismissible' ) ) {
|
12 |
-
$.post(
|
13 |
-
exactmetrics_admin_common.ajax,
|
14 |
-
{
|
15 |
-
action: 'exactmetrics_ajax_dismiss_notice',
|
16 |
-
nonce: exactmetrics_admin_common.dismiss_notice_nonce,
|
17 |
-
notice: $( this ).parent().data( 'notice' )
|
18 |
-
},
|
19 |
-
function( response ) {},
|
20 |
-
'json'
|
21 |
-
);
|
22 |
-
}
|
23 |
-
|
24 |
-
} );
|
25 |
-
});
|
26 |
-
|
27 |
-
var submenu_item = document.querySelector( '.exactmetrics-upgrade-submenu' );
|
28 |
-
if ( null !== submenu_item ) {
|
29 |
-
var li = submenu_item.parentNode.parentNode;
|
30 |
-
if ( li ) {
|
31 |
-
li.classList.add( 'exactmetrics-submenu-highlight' );
|
32 |
-
}
|
33 |
-
}
|
1 |
+
jQuery( document ).ready( function( $ ) {
|
2 |
+
/**
|
3 |
+
* Dismissable Notices
|
4 |
+
* - Sends an AJAX request to mark the notice as dismissed
|
5 |
+
*/
|
6 |
+
$( 'div.exactmetrics-notice' ).on( 'click', 'button.notice-dismiss', function( e ) {
|
7 |
+
e.preventDefault();
|
8 |
+
$( this ).closest( 'div.exactmetrics-notice' ).fadeOut();
|
9 |
+
|
10 |
+
// If this is a dismissible notice, it means we need to send an AJAX request
|
11 |
+
if ( $( this ).parent().hasClass( 'is-dismissible' ) ) {
|
12 |
+
$.post(
|
13 |
+
exactmetrics_admin_common.ajax,
|
14 |
+
{
|
15 |
+
action: 'exactmetrics_ajax_dismiss_notice',
|
16 |
+
nonce: exactmetrics_admin_common.dismiss_notice_nonce,
|
17 |
+
notice: $( this ).parent().data( 'notice' )
|
18 |
+
},
|
19 |
+
function( response ) {},
|
20 |
+
'json'
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
} );
|
25 |
+
});
|
26 |
+
|
27 |
+
var submenu_item = document.querySelector( '.exactmetrics-upgrade-submenu' );
|
28 |
+
if ( null !== submenu_item ) {
|
29 |
+
var li = submenu_item.parentNode.parentNode;
|
30 |
+
if ( li ) {
|
31 |
+
li.classList.add( 'exactmetrics-submenu-highlight' );
|
32 |
+
}
|
33 |
+
}
|
assets/js/frontend-gtag.js
CHANGED
@@ -52,6 +52,87 @@ var ExactMetrics = function () {
|
|
52 |
}
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* This attempts to be compatible with the gtag function.
|
57 |
*
|
@@ -329,6 +410,8 @@ var ExactMetrics = function () {
|
|
329 |
valuesArray.el_search = el.search; /* "?search=test" */
|
330 |
valuesArray.el_hash = el.hash; /* "#hash" */
|
331 |
valuesArray.el_host = el.host; /* "example.com:3000" */
|
|
|
|
|
332 |
|
333 |
/* Settings */
|
334 |
valuesArray.debug_mode = __gtagTrackerIsDebug(); /* "example.com:3000" */
|
@@ -383,45 +466,87 @@ var ExactMetrics = function () {
|
|
383 |
fieldsArray = {
|
384 |
event_category: 'download',
|
385 |
event_label: label || valuesArray.title,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
};
|
387 |
} else if ( type == 'tel' ) {
|
388 |
fieldsArray = {
|
389 |
event_category: 'tel',
|
390 |
event_label: label || valuesArray.title.replace( 'tel:', '' ),
|
|
|
|
|
|
|
|
|
|
|
391 |
};
|
392 |
} else if ( type == 'mailto' ) {
|
393 |
-
console.log( label || valuesArray.title.replace( 'mailto:', '' ) );
|
394 |
fieldsArray = {
|
395 |
event_category: 'mailto',
|
396 |
event_label: label || valuesArray.title.replace( 'mailto:', '' ),
|
|
|
|
|
|
|
|
|
|
|
397 |
};
|
398 |
} else if ( type == 'internal-as-outbound' ) {
|
399 |
fieldsArray = {
|
400 |
event_category: internalAsOutboundCategory,
|
401 |
event_label: label || valuesArray.title,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
402 |
};
|
403 |
} else if ( type == 'external' ) {
|
404 |
fieldsArray = {
|
405 |
event_category: 'outbound-link',
|
406 |
event_label: label || valuesArray.title,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
};
|
408 |
} else if ( type == 'cross-hostname' ) {
|
409 |
fieldsArray = {
|
410 |
event_category: 'cross-hostname',
|
411 |
event_label: label || valuesArray.title,
|
|
|
|
|
|
|
|
|
|
|
412 |
};
|
413 |
}
|
414 |
|
415 |
if ( fieldsArray ) {
|
416 |
-
|
417 |
} else {
|
418 |
if ( type && type != 'internal' ) {
|
419 |
fieldsArray = {
|
420 |
event_category: type,
|
421 |
event_label: label || valuesArray.title,
|
|
|
|
|
|
|
|
|
|
|
422 |
};
|
423 |
|
424 |
-
|
425 |
} else {
|
426 |
valuesArray.exit = 'type';
|
427 |
__gtagTrackerNotSend( valuesArray );
|
@@ -444,9 +569,16 @@ var ExactMetrics = function () {
|
|
444 |
event_category: 'download',
|
445 |
event_label: label || valuesArray.title,
|
446 |
event_callback: __gtagTrackerHitBack,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
};
|
448 |
|
449 |
-
|
450 |
} else if ( type == 'internal-as-outbound' ) {
|
451 |
beforeUnloadChanged = true;
|
452 |
window.onbeforeunload = function ( e ) {
|
@@ -462,13 +594,22 @@ var ExactMetrics = function () {
|
|
462 |
event_category: internalAsOutboundCategory,
|
463 |
event_label: label || valuesArray.title,
|
464 |
event_callback: __gtagTrackerHitBack,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
};
|
466 |
|
467 |
if ( navigator.sendBeacon ) {
|
468 |
fieldsArray.transport = 'beacon';
|
469 |
}
|
470 |
|
471 |
-
|
|
|
472 |
setTimeout( __gtagTrackerHitBack, 1000 );
|
473 |
};
|
474 |
} else if ( type == 'external' ) {
|
@@ -486,13 +627,20 @@ var ExactMetrics = function () {
|
|
486 |
event_category: 'outbound-link',
|
487 |
event_label: label || valuesArray.title,
|
488 |
event_callback: __gtagTrackerHitBack,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
};
|
490 |
|
491 |
if ( navigator.sendBeacon ) {
|
492 |
fieldsArray.transport = 'beacon';
|
493 |
}
|
494 |
|
495 |
-
|
496 |
setTimeout( __gtagTrackerHitBack, 1000 );
|
497 |
};
|
498 |
} else if ( type == 'cross-hostname' ) {
|
@@ -510,13 +658,18 @@ var ExactMetrics = function () {
|
|
510 |
event_category: 'cross-hostname',
|
511 |
event_label: label || valuesArray.title,
|
512 |
event_callback: __gtagTrackerHitBack,
|
|
|
|
|
|
|
|
|
|
|
513 |
};
|
514 |
|
515 |
if ( navigator.sendBeacon ) {
|
516 |
fieldsArray.transport = 'beacon';
|
517 |
}
|
518 |
|
519 |
-
|
520 |
setTimeout( __gtagTrackerHitBack, 1000 );
|
521 |
};
|
522 |
} else {
|
@@ -525,9 +678,14 @@ var ExactMetrics = function () {
|
|
525 |
event_category: type,
|
526 |
event_label: label || valuesArray.title,
|
527 |
event_callback: __gtagTrackerHitBack,
|
|
|
|
|
|
|
|
|
|
|
528 |
};
|
529 |
|
530 |
-
|
531 |
} else {
|
532 |
valuesArray.exit = 'type';
|
533 |
__gtagTrackerNotSend( valuesArray );
|
@@ -565,11 +723,19 @@ var ExactMetrics = function () {
|
|
565 |
|
566 |
function __gtagTrackerHashChangeEvent() {
|
567 |
/* Todo: Ready this section for JS unit testing */
|
568 |
-
if ( exactmetrics_frontend.hash_tracking === "true" && prevHash != window.location.hash && exactmetrics_frontend.ua ) {
|
569 |
prevHash = window.location.hash;
|
570 |
-
|
571 |
-
|
572 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
__gtagTrackerLog( "Hash change to: " + location.pathname + location.search + location.hash );
|
574 |
} else {
|
575 |
__gtagTrackerLog( "Hash change to (untracked): " + location.pathname + location.search + location.hash );
|
52 |
}
|
53 |
}
|
54 |
|
55 |
+
function cloneFields( fields, allowedKeys, disallowedKeys ) {
|
56 |
+
var clone = {};
|
57 |
+
|
58 |
+
for ( var key in fields ) {
|
59 |
+
if ( ! fields.hasOwnProperty( key ) ) {
|
60 |
+
continue
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( allowedKeys && allowedKeys.indexOf( key ) === -1 ) {
|
64 |
+
continue
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( disallowedKeys && disallowedKeys.indexOf( key ) > -1 ) {
|
68 |
+
continue
|
69 |
+
}
|
70 |
+
|
71 |
+
clone[ key ] = fields[ key ];
|
72 |
+
}
|
73 |
+
|
74 |
+
return clone;
|
75 |
+
}
|
76 |
+
|
77 |
+
function __gtagMaybeTrackerV4( type, action, fieldsArray ) {
|
78 |
+
if ( ! exactmetrics_frontend.v4_id || type !== 'event' ) {
|
79 |
+
return;
|
80 |
+
}
|
81 |
+
|
82 |
+
var eventCategory = fieldsArray.event_category || '';
|
83 |
+
|
84 |
+
var fieldsToRemove = [
|
85 |
+
'event_name',
|
86 |
+
'event_category',
|
87 |
+
'event_label',
|
88 |
+
'value',
|
89 |
+
];
|
90 |
+
|
91 |
+
var fields = cloneFields( fieldsArray, null, fieldsToRemove );
|
92 |
+
fields.action = action;
|
93 |
+
|
94 |
+
var eventMap = {
|
95 |
+
'outbound-link': 'click',
|
96 |
+
'download': 'file_download',
|
97 |
+
};
|
98 |
+
|
99 |
+
__gtagTracker( type, eventMap[ eventCategory ] || eventCategory.replace( '-', '_' ), fields );
|
100 |
+
}
|
101 |
+
|
102 |
+
function __gtagMaybeTrackerUA( type, action, fieldsArray ) {
|
103 |
+
if ( ! exactmetrics_frontend.ua ) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
var allowedFields = [
|
108 |
+
'event_category',
|
109 |
+
'event_label',
|
110 |
+
'value',
|
111 |
+
];
|
112 |
+
|
113 |
+
var uaFields = cloneFields(fieldsArray, allowedFields);
|
114 |
+
uaFields.send_to = exactmetrics_frontend.ua
|
115 |
+
|
116 |
+
__gtagTracker( type, action, uaFields );
|
117 |
+
}
|
118 |
+
|
119 |
+
function __gtagTrackerSendDual( type, action, fieldsArray, valuesArray ) {
|
120 |
+
type = typeof type !== 'undefined' ? type : 'event';
|
121 |
+
action = typeof action !== 'undefined' ? action : '';
|
122 |
+
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
123 |
+
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : {};
|
124 |
+
|
125 |
+
__gtagMaybeTrackerUA( type, action, fieldsArray );
|
126 |
+
__gtagMaybeTrackerV4( type, action, fieldsArray );
|
127 |
+
|
128 |
+
lastClicked.valuesArray = valuesArray;
|
129 |
+
lastClicked.fieldsArray = fieldsArray;
|
130 |
+
lastClicked.fieldsArray.event_action = action;
|
131 |
+
lastClicked.tracked = true;
|
132 |
+
__gtagTrackerLog( 'Tracked: ' + valuesArray.type );
|
133 |
+
__gtagTrackerLog( lastClicked );
|
134 |
+
}
|
135 |
+
|
136 |
/**
|
137 |
* This attempts to be compatible with the gtag function.
|
138 |
*
|
410 |
valuesArray.el_search = el.search; /* "?search=test" */
|
411 |
valuesArray.el_hash = el.hash; /* "#hash" */
|
412 |
valuesArray.el_host = el.host; /* "example.com:3000" */
|
413 |
+
valuesArray.el_classes = el.getAttribute('class')
|
414 |
+
valuesArray.el_id = el.id
|
415 |
|
416 |
/* Settings */
|
417 |
valuesArray.debug_mode = __gtagTrackerIsDebug(); /* "example.com:3000" */
|
466 |
fieldsArray = {
|
467 |
event_category: 'download',
|
468 |
event_label: label || valuesArray.title,
|
469 |
+
file_extension: valuesArray.extension,
|
470 |
+
file_name: valuesArray.link.replace(/^.*\//g, ''),
|
471 |
+
link_text: label || valuesArray.title,
|
472 |
+
link_url: link,
|
473 |
+
link_domain: valuesArray.el_hostname,
|
474 |
+
link_classes: valuesArray.el_classes,
|
475 |
+
link_id: valuesArray.el_id,
|
476 |
};
|
477 |
} else if ( type == 'tel' ) {
|
478 |
fieldsArray = {
|
479 |
event_category: 'tel',
|
480 |
event_label: label || valuesArray.title.replace( 'tel:', '' ),
|
481 |
+
tel_number: link.replace( 'tel:', '' ),
|
482 |
+
link_text: label || valuesArray.title,
|
483 |
+
link_url: link,
|
484 |
+
link_classes: valuesArray.el_classes,
|
485 |
+
link_id: valuesArray.el_id,
|
486 |
};
|
487 |
} else if ( type == 'mailto' ) {
|
|
|
488 |
fieldsArray = {
|
489 |
event_category: 'mailto',
|
490 |
event_label: label || valuesArray.title.replace( 'mailto:', '' ),
|
491 |
+
email_address: link.replace( 'mailto:', '' ),
|
492 |
+
link_text: label || valuesArray.title.replace( 'mailto:', ''),
|
493 |
+
link_url: link,
|
494 |
+
link_classes: valuesArray.el_classes,
|
495 |
+
link_id: valuesArray.el_id,
|
496 |
};
|
497 |
} else if ( type == 'internal-as-outbound' ) {
|
498 |
fieldsArray = {
|
499 |
event_category: internalAsOutboundCategory,
|
500 |
event_label: label || valuesArray.title,
|
501 |
+
event_name: 'click',
|
502 |
+
is_affiliate_link: true,
|
503 |
+
affiliate_label: internalAsOutboundCategory.replace('outbound-link-', ''),
|
504 |
+
link_text: label || valuesArray.title,
|
505 |
+
link_url: link,
|
506 |
+
link_domain: valuesArray.el_hostname,
|
507 |
+
link_classes: valuesArray.el_classes,
|
508 |
+
link_id: valuesArray.el_id,
|
509 |
+
outbound: true,
|
510 |
};
|
511 |
} else if ( type == 'external' ) {
|
512 |
fieldsArray = {
|
513 |
event_category: 'outbound-link',
|
514 |
event_label: label || valuesArray.title,
|
515 |
+
is_affiliate_link: false,
|
516 |
+
link_text: label || valuesArray.title,
|
517 |
+
link_url: link,
|
518 |
+
link_domain: valuesArray.el_hostname,
|
519 |
+
link_classes: valuesArray.el_classes,
|
520 |
+
link_id: valuesArray.el_id,
|
521 |
+
outbound: true,
|
522 |
};
|
523 |
} else if ( type == 'cross-hostname' ) {
|
524 |
fieldsArray = {
|
525 |
event_category: 'cross-hostname',
|
526 |
event_label: label || valuesArray.title,
|
527 |
+
link_text: label || valuesArray.title,
|
528 |
+
link_url: link,
|
529 |
+
link_domain: valuesArray.el_hostname,
|
530 |
+
link_classes: valuesArray.el_classes,
|
531 |
+
link_id: valuesArray.el_id,
|
532 |
};
|
533 |
}
|
534 |
|
535 |
if ( fieldsArray ) {
|
536 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
537 |
} else {
|
538 |
if ( type && type != 'internal' ) {
|
539 |
fieldsArray = {
|
540 |
event_category: type,
|
541 |
event_label: label || valuesArray.title,
|
542 |
+
link_text: label || valuesArray.title,
|
543 |
+
link_url: link,
|
544 |
+
link_domain: valuesArray.el_hostname,
|
545 |
+
link_classes: valuesArray.el_classes,
|
546 |
+
link_id: valuesArray.el_id,
|
547 |
};
|
548 |
|
549 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
550 |
} else {
|
551 |
valuesArray.exit = 'type';
|
552 |
__gtagTrackerNotSend( valuesArray );
|
569 |
event_category: 'download',
|
570 |
event_label: label || valuesArray.title,
|
571 |
event_callback: __gtagTrackerHitBack,
|
572 |
+
file_extension: valuesArray.extension,
|
573 |
+
file_name: valuesArray.link.replace(/^.*\//g, ''),
|
574 |
+
link_text: label || valuesArray.title,
|
575 |
+
link_url: link,
|
576 |
+
link_domain: valuesArray.el_hostname,
|
577 |
+
link_classes: valuesArray.el_classes,
|
578 |
+
link_id: valuesArray.el_id,
|
579 |
};
|
580 |
|
581 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
582 |
} else if ( type == 'internal-as-outbound' ) {
|
583 |
beforeUnloadChanged = true;
|
584 |
window.onbeforeunload = function ( e ) {
|
594 |
event_category: internalAsOutboundCategory,
|
595 |
event_label: label || valuesArray.title,
|
596 |
event_callback: __gtagTrackerHitBack,
|
597 |
+
is_affiliate_link: true,
|
598 |
+
affiliate_label: internalAsOutboundCategory.replace('outbound-link-', ''),
|
599 |
+
link_text: label || valuesArray.title,
|
600 |
+
link_url: link,
|
601 |
+
link_domain: valuesArray.el_hostname,
|
602 |
+
link_classes: valuesArray.el_classes,
|
603 |
+
link_id: valuesArray.el_id,
|
604 |
+
outbound: true,
|
605 |
};
|
606 |
|
607 |
if ( navigator.sendBeacon ) {
|
608 |
fieldsArray.transport = 'beacon';
|
609 |
}
|
610 |
|
611 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
612 |
+
|
613 |
setTimeout( __gtagTrackerHitBack, 1000 );
|
614 |
};
|
615 |
} else if ( type == 'external' ) {
|
627 |
event_category: 'outbound-link',
|
628 |
event_label: label || valuesArray.title,
|
629 |
event_callback: __gtagTrackerHitBack,
|
630 |
+
is_affiliate_link: false,
|
631 |
+
link_text: label || valuesArray.title,
|
632 |
+
link_url: link,
|
633 |
+
link_domain: valuesArray.el_hostname,
|
634 |
+
link_classes: valuesArray.el_classes,
|
635 |
+
link_id: valuesArray.el_id,
|
636 |
+
outbound: true,
|
637 |
};
|
638 |
|
639 |
if ( navigator.sendBeacon ) {
|
640 |
fieldsArray.transport = 'beacon';
|
641 |
}
|
642 |
|
643 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
644 |
setTimeout( __gtagTrackerHitBack, 1000 );
|
645 |
};
|
646 |
} else if ( type == 'cross-hostname' ) {
|
658 |
event_category: 'cross-hostname',
|
659 |
event_label: label || valuesArray.title,
|
660 |
event_callback: __gtagTrackerHitBack,
|
661 |
+
link_text: label || valuesArray.title,
|
662 |
+
link_url: link,
|
663 |
+
link_domain: valuesArray.el_hostname,
|
664 |
+
link_classes: valuesArray.el_classes,
|
665 |
+
link_id: valuesArray.el_id,
|
666 |
};
|
667 |
|
668 |
if ( navigator.sendBeacon ) {
|
669 |
fieldsArray.transport = 'beacon';
|
670 |
}
|
671 |
|
672 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
673 |
setTimeout( __gtagTrackerHitBack, 1000 );
|
674 |
};
|
675 |
} else {
|
678 |
event_category: type,
|
679 |
event_label: label || valuesArray.title,
|
680 |
event_callback: __gtagTrackerHitBack,
|
681 |
+
link_text: label || valuesArray.title,
|
682 |
+
link_url: link,
|
683 |
+
link_domain: valuesArray.el_hostname,
|
684 |
+
link_classes: valuesArray.el_classes,
|
685 |
+
link_id: valuesArray.el_id,
|
686 |
};
|
687 |
|
688 |
+
__gtagTrackerSendDual( 'event', action || link, fieldsArray, valuesArray );
|
689 |
} else {
|
690 |
valuesArray.exit = 'type';
|
691 |
__gtagTrackerNotSend( valuesArray );
|
723 |
|
724 |
function __gtagTrackerHashChangeEvent() {
|
725 |
/* Todo: Ready this section for JS unit testing */
|
726 |
+
if ( exactmetrics_frontend.hash_tracking === "true" && prevHash != window.location.hash && ( exactmetrics_frontend.ua || exactmetrics_frontend.v4_id ) ) {
|
727 |
prevHash = window.location.hash;
|
728 |
+
if ( exactmetrics_frontend.ua ) {
|
729 |
+
__gtagTracker( 'config', exactmetrics_frontend.ua, {
|
730 |
+
page_path: location.pathname + location.search + location.hash,
|
731 |
+
} );
|
732 |
+
}
|
733 |
+
|
734 |
+
if ( exactmetrics_frontend.v4_id ) {
|
735 |
+
__gtagTracker( 'config', exactmetrics_frontend.v4_id, {
|
736 |
+
page_path: location.pathname + location.search + location.hash,
|
737 |
+
} );
|
738 |
+
}
|
739 |
__gtagTrackerLog( "Hash change to: " + location.pathname + location.search + location.hash );
|
740 |
} else {
|
741 |
__gtagTrackerLog( "Hash change to (untracked): " + location.pathname + location.search + location.hash );
|
assets/js/frontend-gtag.min.js
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
-
;var ExactMetrics=function(){var e=[],
|
2 |
-
else{return!1}};function t(t,n,
|
3 |
-
else{return''}};function
|
4 |
else if(e.which==2){return'event.which=2'}
|
5 |
else if(e.metaKey){return'metaKey'}
|
6 |
else if(e.ctrlKey){return'ctrlKey'}
|
7 |
else if(e.shiftKey){return'shiftKey'}
|
8 |
else if(e.altKey){return'altKey'}
|
9 |
-
else{return''}};function
|
10 |
-
else if(
|
11 |
-
else if(
|
12 |
-
else if(
|
13 |
-
else if(
|
14 |
-
else if(
|
15 |
else if(e.title&&e.title.replace(/\n/ig,'')){return e.title.replace(/\n/ig,'')}
|
16 |
else if(e.innerText&&e.innerText.replace(/\n/ig,'')){return e.innerText.replace(/\n/ig,'')}
|
17 |
else if(e.getAttribute('aria-label')&&e.getAttribute('aria-label').replace(/\n/ig,'')){return e.getAttribute('aria-label').replace(/\n/ig,'')}
|
18 |
else if(e.alt&&e.alt.replace(/\n/ig,'')){return e.alt.replace(/\n/ig,'')}
|
19 |
else if(e.textContent&&e.textContent.replace(/\n/ig,'')){return e.textContent.replace(/\n/ig,'')}
|
20 |
-
else{return undefined}};function
|
21 |
-
while(
|
22 |
-
else if(
|
23 |
-
else if(
|
24 |
-
else if(
|
25 |
-
else if(
|
26 |
-
else if(
|
27 |
-
else{if(
|
28 |
-
else{e.exit='type';
|
29 |
-
else{if(
|
30 |
-
else{
|
31 |
-
else if(
|
32 |
-
else{
|
33 |
-
else if(
|
34 |
-
else{
|
35 |
-
else if(
|
36 |
-
else{
|
37 |
-
else{if(
|
38 |
-
else{e.exit='type';
|
39 |
-
else{if(
|
40 |
-
else if(
|
41 |
else{setTimeout(D,1100)}};setTimeout(s,100)}}
|
42 |
-
else{s();e.exit='internal';
|
43 |
-
else{e.exit='notlink';
|
44 |
-
else{
|
45 |
-
else{if(
|
46 |
-
else if(t!=0&&t!=(1/0)&&t!=-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}};for(n=t>=0?Math.min(t,i-1):i-Math.abs(t);n>=0;n--){if(n in
|
1 |
+
;var ExactMetrics=function(){var e=[],i='',r=!1;this.setLastClicked=function(t,n,i){t=typeof t!=='undefined'?t:[];n=typeof n!=='undefined'?n:[];i=typeof i!=='undefined'?i:!1;e.valuesArray=t;e.fieldsArray=n};this.getLastClicked=function(){return e};this.setInternalAsOutboundCategory=function(e){i=e};this.getInternalAsOutboundCategory=function(){return i};this.sendEvent=function(e,t,n){x(e,t,n,[])};function u(){if(window.exactmetrics_debug_mode){return!0}
|
2 |
+
else{return!1}};function d(e,t,n){var l={};for(var i in e){if(!e.hasOwnProperty(i)){continue};if(t&&t.indexOf(i)===-1){continue};if(n&&n.indexOf(i)>-1){continue};l[i]=e[i]};return l};function b(e,t,n){if(!exactmetrics_frontend.v4_id||e!=='event'){return};var i=n.event_category||'',r=['event_name','event_category','event_label','value',],l=d(n,null,r);l.action=t;var a={'outbound-link':'click','download':'file_download',};__gtagTracker(e,a[i]||i.replace('-','_'),l)};function y(e,t,n){if(!exactmetrics_frontend.ua){return};var l=['event_category','event_label','value',],i=d(n,l);i.send_to=exactmetrics_frontend.ua;__gtagTracker(e,t,i)};function l(t,i,l,a){t=typeof t!=='undefined'?t:'event';i=typeof i!=='undefined'?i:'';a=typeof a!=='undefined'?a:[];l=typeof l!=='undefined'?l:{};y(t,i,l);b(t,i,l);e.valuesArray=a;e.fieldsArray=l;e.fieldsArray.event_action=i;e.tracked=!0;n('Tracked: '+a.type);n(e)};function x(t,i,l,a){t=typeof t!=='undefined'?t:'event';i=typeof i!=='undefined'?i:'';a=typeof a!=='undefined'?a:[];l=typeof l!=='undefined'?l:{};__gtagTracker(t,i,l);e.valuesArray=a;e.fieldsArray=l;e.fieldsArray.event_action=i;e.tracked=!0;n('Tracked: '+a.type);n(e)};function t(t){t=typeof t!=='undefined'?t:[];e.valuesArray=t;e.fieldsArray=[];e.tracked=!1;n('Not Tracked: '+t.exit);n(e)};function n(e){if(u()){console.dir(e)}};function o(e){return e.replace(/^\s+|\s+$/gm,'')};function c(){var n=0,e=document.domain,i=e.split('.'),t='_gd'+(new Date()).getTime();while(n<(i.length-1)&&document.cookie.indexOf(t+'='+t)==-1){e=i.slice(-1-(++n)).join('.');document.cookie=t+'='+t+';domain='+e+';'};document.cookie=t+'=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain='+e+';';return e};function h(e){e=e.toString();e=e.substring(0,(e.indexOf('#')==-1)?e.length:e.indexOf('#'));e=e.substring(0,(e.indexOf('?')==-1)?e.length:e.indexOf('?'));e=e.substring(e.lastIndexOf('/')+1,e.length);if(e.length>0&&e.indexOf('.')!==-1){e=e.substring(e.indexOf('.')+1);return e}
|
3 |
+
else{return''}};function w(e){return e.which==1||e.which==2||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey};function g(){var e=[];if(typeof exactmetrics_frontend.download_extensions=='string'){e=exactmetrics_frontend.download_extensions.split(',')};return e};function v(){var e=[];if(typeof exactmetrics_frontend.inbound_paths=='string'){e=JSON.parse(exactmetrics_frontend.inbound_paths)};return e};function A(e){if(e.which==1){return'event.which=1'}
|
4 |
else if(e.which==2){return'event.which=2'}
|
5 |
else if(e.metaKey){return'metaKey'}
|
6 |
else if(e.ctrlKey){return'ctrlKey'}
|
7 |
else if(e.shiftKey){return'shiftKey'}
|
8 |
else if(e.altKey){return'altKey'}
|
9 |
+
else{return''}};function T(e){var f=g(),l=v(),t='unknown',u=e.href,m=h(e.href),d=c(),r=e.hostname,a=e.protocol,k=e.pathname;u=u.toString();var s,p,b=e.getAttribute('data-vars-ga-category');if(b){return b};if(u.match(/^javascript\:/i)){t='internal'}
|
10 |
+
else if(a&&a.length>0&&(o(a)=='tel'||o(a)=='tel:')){t='tel'}
|
11 |
+
else if(a&&a.length>0&&(o(a)=='mailto'||o(a)=='mailto:')){t='mailto'}
|
12 |
+
else if(r&&d&&r.length>0&&d.length>0&&!r.endsWith('.'+d)&&r!==d){t='external'}
|
13 |
+
else if(k&&JSON.stringify(l)!='{}'&&k.length>0){var y=l.length;for(var n=0;n<y;n++){if(l[n].path&&l[n].label&&l[n].path.length>0&&l[n].label.length>0&&k.startsWith(l[n].path)){t='internal-as-outbound';i='outbound-link-'+l[n].label;break}}}
|
14 |
+
else if(r&&window.exactmetrics_experimental_mode&&r.length>0&&document.domain.length>0&&r!==document.domain){t='cross-hostname'};if(m&&(t==='unknown'||'external'===t)&&f.length>0&&m.length>0){for(s=0,p=f.length;s<p;++s){if(f[s].length>0&&(u.endsWith(f[s])||f[s]==m)){t='download';break}}};if(t==='unknown'){t='internal'};return t};function O(e,t){var n=(e.target&&!e.target.match(/^_(self|parent|top)$/i))?e.target:!1;if(t.ctrlKey||t.shiftKey||t.metaKey||t.which==2){n='_blank'};return n};function m(e){if(e.getAttribute('data-vars-ga-label')&&e.getAttribute('data-vars-ga-label').replace(/\n/ig,'')){return e.getAttribute('data-vars-ga-label').replace(/\n/ig,'')}
|
15 |
else if(e.title&&e.title.replace(/\n/ig,'')){return e.title.replace(/\n/ig,'')}
|
16 |
else if(e.innerText&&e.innerText.replace(/\n/ig,'')){return e.innerText.replace(/\n/ig,'')}
|
17 |
else if(e.getAttribute('aria-label')&&e.getAttribute('aria-label').replace(/\n/ig,'')){return e.getAttribute('aria-label').replace(/\n/ig,'')}
|
18 |
else if(e.alt&&e.alt.replace(/\n/ig,'')){return e.alt.replace(/\n/ig,'')}
|
19 |
else if(e.textContent&&e.textContent.replace(/\n/ig,'')){return e.textContent.replace(/\n/ig,'')}
|
20 |
+
else{return undefined}};function K(e){var i=e.children,l=0,a,n;for(var t=0;t<i.length;t++){a=i[t];n=m(a);if(n){return n};if(l==99){return undefined};l++};return undefined};function k(n){var o=n.srcElement||n.target,e=[],k;e.el=o;e.click_type=A(n);if('undefined'===typeof __gtagTracker||!w(n)){e.exit='loaded';t(e);return}
|
21 |
+
while(o&&(typeof o.tagName=='undefined'||o.tagName.toLowerCase()!='a'||!o.href)){o=o.parentNode};if(o&&o.href&&!o.hasAttribute('xlink:href')){var d=o.href,I=h(o.href),M=g(),S=v(),L=exactmetrics_frontend.home_url,N=c(),a=T(o),x=O(o,n),b=o.getAttribute('data-vars-ga-action'),f=o.getAttribute('data-vars-ga-label');e.el=o;e.el_href=o.href;e.el_protocol=o.protocol;e.el_hostname=o.hostname;e.el_port=o.port;e.el_pathname=o.pathname;e.el_search=o.search;e.el_hash=o.hash;e.el_host=o.host;e.el_classes=o.getAttribute('class');e.el_id=o.id;e.debug_mode=u();e.download_extensions=M;e.inbound_paths=S;e.home_url=L;e.link=d;e.extension=I;e.type=a;e.target=x;e.title=m(o);if(!e.label&&!e.title){e.title=K(o)};if(a!=='internal'&&a!=='javascript'){var y=!1,p=function(){if(y){return};s();y=!0;window.location.href=d},E=function(){e.exit='external';t(e)},D=function(){e.exit='internal-as-outbound';t(e)},C=function(){e.exit='cross-hostname';t(e)};if(x||a=='mailto'||a=='tel'){if(a=='download'){k={event_category:'download',event_label:f||e.title,file_extension:e.extension,file_name:e.link.replace(/^.*\//g,''),link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,}}
|
22 |
+
else if(a=='tel'){k={event_category:'tel',event_label:f||e.title.replace('tel:',''),tel_number:d.replace('tel:',''),link_text:f||e.title,link_url:d,link_classes:e.el_classes,link_id:e.el_id,}}
|
23 |
+
else if(a=='mailto'){k={event_category:'mailto',event_label:f||e.title.replace('mailto:',''),email_address:d.replace('mailto:',''),link_text:f||e.title.replace('mailto:',''),link_url:d,link_classes:e.el_classes,link_id:e.el_id,}}
|
24 |
+
else if(a=='internal-as-outbound'){k={event_category:i,event_label:f||e.title,event_name:'click',is_affiliate_link:!0,affiliate_label:i.replace('outbound-link-',''),link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,outbound:!0,}}
|
25 |
+
else if(a=='external'){k={event_category:'outbound-link',event_label:f||e.title,is_affiliate_link:!1,link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,outbound:!0,}}
|
26 |
+
else if(a=='cross-hostname'){k={event_category:'cross-hostname',event_label:f||e.title,link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,}};if(k){l('event',b||d,k,e)}
|
27 |
+
else{if(a&&a!='internal'){k={event_category:a,event_label:f||e.title,link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,};l('event',b||d,k,e)}
|
28 |
+
else{e.exit='type';t(e)}}}
|
29 |
+
else{if(a!='cross-hostname'&&a!='external'&&a!='internal-as-outbound'){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
30 |
+
else{n.returnValue=!1}}};if(a=='download'){k={event_category:'download',event_label:f||e.title,event_callback:p,file_extension:e.extension,file_name:e.link.replace(/^.*\//g,''),link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,};l('event',b||d,k,e)}
|
31 |
+
else if(a=='internal-as-outbound'){r=!0;window.onbeforeunload=function(t){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
32 |
+
else{n.returnValue=!1}};k={event_category:i,event_label:f||e.title,event_callback:p,is_affiliate_link:!0,affiliate_label:i.replace('outbound-link-',''),link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,outbound:!0,};if(navigator.sendBeacon){k.transport='beacon'};l('event',b||d,k,e);setTimeout(p,1000)}}
|
33 |
+
else if(a=='external'){r=!0;window.onbeforeunload=function(t){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
34 |
+
else{n.returnValue=!1}};k={event_category:'outbound-link',event_label:f||e.title,event_callback:p,is_affiliate_link:!1,link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,outbound:!0,};if(navigator.sendBeacon){k.transport='beacon'};l('event',b||d,k,e);setTimeout(p,1000)}}
|
35 |
+
else if(a=='cross-hostname'){r=!0;window.onbeforeunload=function(t){if(!n.defaultPrevented){if(n.preventDefault){n.preventDefault()}
|
36 |
+
else{n.returnValue=!1}};k={event_category:'cross-hostname',event_label:f||e.title,event_callback:p,link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,};if(navigator.sendBeacon){k.transport='beacon'};l('event',b||d,k,e);setTimeout(p,1000)}}
|
37 |
+
else{if(a&&a!=='internal'){k={event_category:a,event_label:f||e.title,event_callback:p,link_text:f||e.title,link_url:d,link_domain:e.el_hostname,link_classes:e.el_classes,link_id:e.el_id,};l('event',b||d,k,e)}
|
38 |
+
else{e.exit='type';t(e)}};if(a!='external'&&a!='cross-hostname'&&a!='internal-as-outbound'){setTimeout(p,1000)}
|
39 |
+
else{if(a=='external'){setTimeout(E,1100)}
|
40 |
+
else if(a=='cross-hostname'){setTimeout(C,1100)}
|
41 |
else{setTimeout(D,1100)}};setTimeout(s,100)}}
|
42 |
+
else{s();e.exit='internal';t(e)}}
|
43 |
+
else{e.exit='notlink';t(e)}};var f=window.location.hash;function p(){if(exactmetrics_frontend.hash_tracking==='true'&&f!=window.location.hash&&(exactmetrics_frontend.ua||exactmetrics_frontend.v4_id)){f=window.location.hash;if(exactmetrics_frontend.ua){__gtagTracker('config',exactmetrics_frontend.ua,{page_path:location.pathname+location.search+location.hash,})};if(exactmetrics_frontend.v4_id){__gtagTracker('config',exactmetrics_frontend.v4_id,{page_path:location.pathname+location.search+location.hash,})};n('Hash change to: '+location.pathname+location.search+location.hash)}
|
44 |
+
else{n('Hash change to (untracked): '+location.pathname+location.search+location.hash)}};function s(){if(r){window.onbeforeunload=null}};var a=window;if(a.addEventListener){a.addEventListener('load',function(){document.body.addEventListener('click',k,!1)},!1);window.addEventListener('hashchange',p,!1)}
|
45 |
+
else{if(a.attachEvent){a.attachEvent('onload',function(){document.body.attachEvent('onclick',k)});window.attachEvent('onhashchange',p)}};if(typeof String.prototype.endsWith!=='function'){String.prototype.endsWith=function(e){return this.indexOf(e,this.length-e.length)!==-1}};if(typeof String.prototype.startsWith!=='function'){String.prototype.startsWith=function(e){return this.indexOf(e)===0}};if(typeof Array.prototype.lastIndexOf!=='function'){Array.prototype.lastIndexOf=function(e){'use strict';if(this===void 0||this===null){throw new TypeError()};var t,n,l=Object(this),i=l.length>>>0;if(i===0){return-1};t=i-1;if(arguments.length>1){t=Number(arguments[1]);if(t!=t){t=0}
|
46 |
+
else if(t!=0&&t!=(1/0)&&t!=-(1/0)){t=(t>0||-1)*Math.floor(Math.abs(t))}};for(n=t>=0?Math.min(t,i-1):i-Math.abs(t);n>=0;n--){if(n in l&&l[n]===e){return n}};return-1}}},ExactMetricsObject=new ExactMetrics();
|
assets/js/frontend.js
CHANGED
@@ -1,643 +1,643 @@
|
|
1 |
-
/**
|
2 |
-
* Developer's Notice:
|
3 |
-
*
|
4 |
-
* Note: JS in this file (and this file itself) is not garunteed backwards compatibility. JS can be added, changed or removed at any time without notice.
|
5 |
-
* For more information see the `Backwards Compatibility Guidelines for Developers` section of the README.md file.
|
6 |
-
*/
|
7 |
-
/**
|
8 |
-
* Handles:
|
9 |
-
* - JS Events handling
|
10 |
-
*
|
11 |
-
* @since 6.0.12
|
12 |
-
*/
|
13 |
-
var ExactMetrics = function(){
|
14 |
-
/* ExactMetrics JS events tracking works on all major browsers, including IE starting at IE 7, via polyfills for any major JS function used that
|
15 |
-
is not supported by at least 95% of the global and/or US browser marketshare. Currently, IE 7 & 8 which as of 2/14/17 have under 0.25% global marketshare, require
|
16 |
-
us to polyfill Array.prototype.lastIndexOf, and if they continue to drop, we might remove this polyfill at some point. In that case note that events tracking
|
17 |
-
for IE 7/8 will continue to work, with the exception of events tracking of downloads. */
|
18 |
-
var lastClicked = [];
|
19 |
-
var internalAsOutboundCategory = '';
|
20 |
-
|
21 |
-
this.setLastClicked = function(valuesArray,fieldsArray,tracked){
|
22 |
-
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
23 |
-
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : [];
|
24 |
-
tracked = typeof tracked !== 'undefined' ? tracked : false;
|
25 |
-
|
26 |
-
lastClicked.valuesArray = valuesArray;
|
27 |
-
lastClicked.fieldsArray = fieldsArray;
|
28 |
-
};
|
29 |
-
|
30 |
-
this.getLastClicked = function () {
|
31 |
-
return lastClicked;
|
32 |
-
};
|
33 |
-
|
34 |
-
this.setInternalAsOutboundCategory = function( category ){
|
35 |
-
internalAsOutboundCategory = category;
|
36 |
-
};
|
37 |
-
|
38 |
-
this.getInternalAsOutboundCategory = function () {
|
39 |
-
return internalAsOutboundCategory;
|
40 |
-
};
|
41 |
-
|
42 |
-
this.sendEvent = function ( fieldsArray ) {
|
43 |
-
__gaTrackerSend( [], fieldsArray );
|
44 |
-
};
|
45 |
-
|
46 |
-
function __gaTrackerIsDebug () {
|
47 |
-
if ( window.exactmetrics_debug_mode ) {
|
48 |
-
return true;
|
49 |
-
} else {
|
50 |
-
return false;
|
51 |
-
}
|
52 |
-
}
|
53 |
-
|
54 |
-
function __gaTrackerSend ( valuesArray, fieldsArray ) {
|
55 |
-
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
56 |
-
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : {};
|
57 |
-
|
58 |
-
__gaTracker( 'send', fieldsArray );
|
59 |
-
|
60 |
-
lastClicked.valuesArray = valuesArray;
|
61 |
-
lastClicked.fieldsArray = fieldsArray;
|
62 |
-
lastClicked.tracked = true;
|
63 |
-
__gaTrackerLog( 'Tracked: ' + valuesArray.type );
|
64 |
-
__gaTrackerLog( lastClicked );
|
65 |
-
}
|
66 |
-
|
67 |
-
function __gaTrackerNotSend ( valuesArray ) {
|
68 |
-
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
69 |
-
|
70 |
-
lastClicked.valuesArray = valuesArray;
|
71 |
-
lastClicked.fieldsArray = [];
|
72 |
-
lastClicked.tracked = false;
|
73 |
-
__gaTrackerLog( 'Not Tracked: ' + valuesArray.exit );
|
74 |
-
__gaTrackerLog( lastClicked );
|
75 |
-
}
|
76 |
-
|
77 |
-
function __gaTrackerLog ( message ) {
|
78 |
-
if ( __gaTrackerIsDebug() ) {
|
79 |
-
console.dir( message );
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
function __gaTrackerStringTrim( x ) {
|
84 |
-
return x.replace(/^\s+|\s+$/gm,'');
|
85 |
-
}
|
86 |
-
|
87 |
-
function __gaTrackerGetDomain() {
|
88 |
-
var i=0,currentdomain=document.domain,p=currentdomain.split('.'),s='_gd'+(new Date()).getTime();
|
89 |
-
while(i<(p.length-1) && document.cookie.indexOf(s+'='+s)==-1){
|
90 |
-
currentdomain = p.slice(-1-(++i)).join('.');
|
91 |
-
document.cookie = s+"="+s+";domain="+currentdomain+";";
|
92 |
-
}
|
93 |
-
document.cookie = s+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain="+currentdomain+";";
|
94 |
-
return currentdomain;
|
95 |
-
}
|
96 |
-
|
97 |
-
function __gaTrackerGetExtension( extension ) {
|
98 |
-
extension = extension.toString();
|
99 |
-
extension = extension.substring( 0, (extension.indexOf( "#" ) == -1 ) ? extension.length : extension.indexOf( "#" ) ); /* Remove the anchor at the end, if there is one */
|
100 |
-
extension = extension.substring( 0, (extension.indexOf( "?" ) == -1 ) ? extension.length : extension.indexOf( "?" ) ); /* Remove the query after the file name, if there is one */
|
101 |
-
extension = extension.substring( extension.lastIndexOf( "/" ) + 1, extension.length ); /* Remove everything before the last slash in the path */
|
102 |
-
if ( extension.length > 0 && extension.indexOf('.') !== -1 ) { /* If there's a period left in the URL, then there's a extension. Else it is not a extension. */
|
103 |
-
extension = extension.substring( extension.indexOf( "." ) + 1 ); /* Remove everything but what's after the first period */
|
104 |
-
return extension;
|
105 |
-
} else {
|
106 |
-
return "";
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
function __gaTrackerLoaded() {
|
111 |
-
return typeof(__gaTracker) !== 'undefined' && __gaTracker && __gaTracker.hasOwnProperty( "loaded" ) && __gaTracker.loaded == true; /* jshint ignore:line */
|
112 |
-
}
|
113 |
-
|
114 |
-
function __gaTrackerTrackedClick( event ) {
|
115 |
-
return event.which == 1 || event.which == 2 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
116 |
-
}
|
117 |
-
|
118 |
-
function __gaTrackerGetDownloadExtensions() {
|
119 |
-
var download_extensions = [];
|
120 |
-
if ( typeof exactmetrics_frontend.download_extensions == 'string' ) {
|
121 |
-
download_extensions = exactmetrics_frontend.download_extensions.split(",");
|
122 |
-
}
|
123 |
-
return download_extensions;
|
124 |
-
}
|
125 |
-
|
126 |
-
function __gaTrackerGetInboundPaths() {
|
127 |
-
var inbound_paths = [];
|
128 |
-
if ( typeof exactmetrics_frontend.inbound_paths == 'string' ) {
|
129 |
-
inbound_paths = JSON.parse( exactmetrics_frontend.inbound_paths );
|
130 |
-
}
|
131 |
-
|
132 |
-
return inbound_paths;
|
133 |
-
}
|
134 |
-
|
135 |
-
function __gaTrackerTrackedClickType( event ) {
|
136 |
-
if ( event.which == 1 ) {
|
137 |
-
return 'event.which=1';
|
138 |
-
} else if ( event.which == 2 ) {
|
139 |
-
return 'event.which=2';
|
140 |
-
} else if ( event.metaKey ){
|
141 |
-
return 'metaKey';
|
142 |
-
} else if ( event.ctrlKey ) {
|
143 |
-
return 'ctrlKey';
|
144 |
-
} else if ( event.shiftKey ) {
|
145 |
-
return 'shiftKey';
|
146 |
-
} else if ( event.altKey ) {
|
147 |
-
return 'altKey';
|
148 |
-
} else {
|
149 |
-
return '';
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
function __gaTrackerLinkType( el ) {
|
154 |
-
var download_extensions = __gaTrackerGetDownloadExtensions();
|
155 |
-
var inbound_paths = __gaTrackerGetInboundPaths();
|
156 |
-
var type = 'unknown';
|
157 |
-
var link = el.href;
|
158 |
-
var extension = __gaTrackerGetExtension( el.href );
|
159 |
-
var currentdomain = __gaTrackerGetDomain();
|
160 |
-
var hostname = el.hostname;
|
161 |
-
var protocol = el.protocol;
|
162 |
-
var pathname = el.pathname;
|
163 |
-
link = link.toString();
|
164 |
-
var index, len;
|
165 |
-
var category = el.getAttribute("data-vars-ga-category");
|
166 |
-
|
167 |
-
if ( category ) {
|
168 |
-
return category;
|
169 |
-
}
|
170 |
-
|
171 |
-
if ( link.match( /^javascript\:/i ) ) {
|
172 |
-
type = 'internal'; /* if it's a JS link, it's internal */
|
173 |
-
} else if ( protocol && protocol.length > 0 && ( __gaTrackerStringTrim( protocol ) == 'tel' || __gaTrackerStringTrim( protocol ) == 'tel:' ) ) { /* If it's a telephone link */
|
174 |
-
type = "tel";
|
175 |
-
} else if ( protocol && protocol.length > 0 && ( __gaTrackerStringTrim( protocol ) == 'mailto' || __gaTrackerStringTrim( protocol ) == 'mailto:' ) ) { /* If it's a email */
|
176 |
-
type = "mailto";
|
177 |
-
} else if ( hostname && currentdomain && hostname.length > 0 && currentdomain.length > 0 && ! hostname.endsWith( '.' + currentdomain) && hostname !== currentdomain ) { /* If it's a outbound */
|
178 |
-
type = "external";
|
179 |
-
} else if ( pathname && JSON.stringify( inbound_paths ) != "{}" && pathname.length > 0 ) { /* If it's an internal as outbound */
|
180 |
-
var inbound_paths_length = inbound_paths.length;
|
181 |
-
for ( var inbound_paths_index = 0; inbound_paths_index < inbound_paths_length; inbound_paths_index ++ ) {
|
182 |
-
if ( inbound_paths[ inbound_paths_index ].path && inbound_paths[ inbound_paths_index ].label && inbound_paths[ inbound_paths_index ].path.length > 0 && inbound_paths[ inbound_paths_index ].label.length > 0 && pathname.startsWith( inbound_paths[ inbound_paths_index ].path ) ) {
|
183 |
-
type = "internal-as-outbound";
|
184 |
-
internalAsOutboundCategory = "outbound-link-" + inbound_paths[ inbound_paths_index ].label;
|
185 |
-
break;
|
186 |
-
}
|
187 |
-
}
|
188 |
-
/* Enable window.exactmetrics_experimental_mode at your own risk. We might eventually remove it. Also you may/can/will burn through GA quota for your property quickly. */
|
189 |
-
} else if ( hostname && window.exactmetrics_experimental_mode && hostname.length > 0 && document.domain.length > 0 && hostname !== document.domain ) { /* If it's a cross-hostname link */
|
190 |
-
type = "cross-hostname";
|
191 |
-
}
|
192 |
-
|
193 |
-
if ( extension && ( type === 'unknown' || 'external' === type ) && download_extensions.length > 0 && extension.length > 0 ) { /* If it's a download */
|
194 |
-
for ( index = 0, len = download_extensions.length; index < len; ++index ) {
|
195 |
-
if ( download_extensions[ index ].length > 0 && ( link.endsWith( download_extensions[ index ] ) || download_extensions[ index ] == extension ) ) {
|
196 |
-
type = "download";
|
197 |
-
break;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
}
|
201 |
-
|
202 |
-
if ( type === 'unknown' ) {
|
203 |
-
type = 'internal';
|
204 |
-
}
|
205 |
-
return type;
|
206 |
-
}
|
207 |
-
|
208 |
-
function __gaTrackerLinkTarget( el, event ) {
|
209 |
-
|
210 |
-
/* Is actual target set and not _(self|parent|top)? */
|
211 |
-
var target = ( el.target && !el.target.match( /^_(self|parent|top)$/i ) ) ? el.target : false;
|
212 |
-
|
213 |
-
/* Assume a target if Ctrl|shift|meta-click */
|
214 |
-
if ( event.ctrlKey || event.shiftKey || event.metaKey || event.which == 2 ) {
|
215 |
-
target = "_blank";
|
216 |
-
}
|
217 |
-
return target;
|
218 |
-
}
|
219 |
-
|
220 |
-
function __gaTrackerGetTitle( el ) {
|
221 |
-
if ( el.getAttribute("data-vars-ga-label") && el.getAttribute("data-vars-ga-label").replace(/\n/ig, '') ) {
|
222 |
-
return el.getAttribute("data-vars-ga-label").replace(/\n/ig, '');
|
223 |
-
} else if ( el.title && el.title.replace(/\n/ig, '') ) {
|
224 |
-
return el.title.replace(/\n/ig, '');
|
225 |
-
} else if ( el.innerText && el.innerText.replace(/\n/ig, '') ) {
|
226 |
-
return el.innerText.replace(/\n/ig, '');
|
227 |
-
} else if ( el.getAttribute('aria-label') && el.getAttribute('aria-label').replace(/\n/ig, '') ) {
|
228 |
-
return el.getAttribute('aria-label').replace(/\n/ig, '');
|
229 |
-
} else if ( el.alt && el.alt.replace(/\n/ig, '') ) {
|
230 |
-
return el.alt.replace(/\n/ig, '');
|
231 |
-
} else if ( el.textContent && el.textContent.replace(/\n/ig, '') ) {
|
232 |
-
return el.textContent.replace(/\n/ig, '');
|
233 |
-
} else {
|
234 |
-
return undefined;
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
function __gaTrackerGetInnerTitle( el ) {
|
239 |
-
var children = el.children;
|
240 |
-
var count = 0;
|
241 |
-
var child;
|
242 |
-
var value;
|
243 |
-
for (var i = 0; i < children.length; i++) {
|
244 |
-
child = children[i];
|
245 |
-
value = __gaTrackerGetTitle( child );
|
246 |
-
if ( value ) {
|
247 |
-
return value;
|
248 |
-
}
|
249 |
-
/* max search 100 elements to ensure performance */
|
250 |
-
if ( count == 99 ) {
|
251 |
-
return undefined;
|
252 |
-
}
|
253 |
-
count++;
|
254 |
-
}
|
255 |
-
return undefined;
|
256 |
-
}
|
257 |
-
|
258 |
-
function __gaTrackerClickEvent( event ) {
|
259 |
-
var el = event.srcElement || event.target;
|
260 |
-
var valuesArray = [];
|
261 |
-
var fieldsArray;
|
262 |
-
|
263 |
-
/* Start Values Array */
|
264 |
-
valuesArray.el = el;
|
265 |
-
valuesArray.ga_loaded = __gaTrackerLoaded();
|
266 |
-
valuesArray.click_type = __gaTrackerTrackedClickType( event );
|
267 |
-
|
268 |
-
/* If GA is blocked or not loaded, or not main|middle|touch click then don't track */
|
269 |
-
if ( ! __gaTrackerLoaded() || ! __gaTrackerTrackedClick( event ) ) {
|
270 |
-
valuesArray.exit = 'loaded';
|
271 |
-
__gaTrackerNotSend( valuesArray );
|
272 |
-
return;
|
273 |
-
}
|
274 |
-
|
275 |
-
/* Loop up the DOM tree through parent elements if clicked element is not a link (eg: an image inside a link) */
|
276 |
-
while ( el && (typeof el.tagName == 'undefined' || el.tagName.toLowerCase() != 'a' || ! el.href ) ) {
|
277 |
-
el = el.parentNode;
|
278 |
-
}
|
279 |
-
|
280 |
-
/* if a link with valid href has been clicked */
|
281 |
-
if ( el && el.href && ! el.hasAttribute('xlink:href') ) {
|
282 |
-
var link = el.href; /* What link are we tracking */
|
283 |
-
var extension = __gaTrackerGetExtension( el.href ); /* What extension is this link */
|
284 |
-
var download_extensions = __gaTrackerGetDownloadExtensions(); /* Let's get the extensions to track */
|
285 |
-
var inbound_paths = __gaTrackerGetInboundPaths(); /* Let's get the internal paths to track */
|
286 |
-
var home_url = exactmetrics_frontend.home_url; /* Let's get the url to compare for external/internal use */
|
287 |
-
var currentdomain = __gaTrackerGetDomain(); /* What domain are we on? */
|
288 |
-
var type = __gaTrackerLinkType( el ); /* What type of link is this? */
|
289 |
-
var target = __gaTrackerLinkTarget( el, event ); /* Is a new tab/window being opened? */
|
290 |
-
var action = el.getAttribute("data-vars-ga-action");
|
291 |
-
var label = el.getAttribute("data-vars-ga-label");
|
292 |
-
|
293 |
-
/* Element */
|
294 |
-
valuesArray.el = el; /* el is an a element so we can parse it */
|
295 |
-
valuesArray.el_href = el.href; /* "http://example.com:3000/pathname/?search=test#hash" */
|
296 |
-
valuesArray.el_protocol = el.protocol; /* "http:" */
|
297 |
-
valuesArray.el_hostname = el.hostname; /* "example.com" */
|
298 |
-
valuesArray.el_port = el.port; /* "3000" */
|
299 |
-
valuesArray.el_pathname = el.pathname; /* "/pathname/" */
|
300 |
-
valuesArray.el_search = el.search; /* "?search=test" */
|
301 |
-
valuesArray.el_hash = el.hash; /* "#hash" */
|
302 |
-
valuesArray.el_host = el.host; /* "example.com:3000" */
|
303 |
-
|
304 |
-
/* Settings */
|
305 |
-
valuesArray.debug_mode = __gaTrackerIsDebug(); /* "example.com:3000" */
|
306 |
-
valuesArray.download_extensions = download_extensions; /* Let's get the extensions to track */
|
307 |
-
valuesArray.inbound_paths = inbound_paths; /* Let's get the internal paths to track */
|
308 |
-
valuesArray.home_url = home_url; /* Let's get the url to compare for external/internal use */
|
309 |
-
|
310 |
-
/* Parsed/Logic */
|
311 |
-
valuesArray.link = link; /* What link are we tracking */
|
312 |
-
valuesArray.extension = extension; /* What extension is this link */
|
313 |
-
valuesArray.type = type; /* What type of link is this */
|
314 |
-
valuesArray.target = target; /* Is a new tab/window being opened? */
|
315 |
-
valuesArray.title = __gaTrackerGetTitle( el ); /* Try link title, then text content */
|
316 |
-
|
317 |
-
/* only find innerTitle if we need one */
|
318 |
-
if ( ! valuesArray.label && ! valuesArray.title ) {
|
319 |
-
valuesArray.title = __gaTrackerGetInnerTitle( el );
|
320 |
-
}
|
321 |
-
|
322 |
-
/* Let's track everything but internals (that aren't internal-as-externals) and javascript */
|
323 |
-
if ( type !== 'internal' && type !== 'javascript' ) {
|
324 |
-
|
325 |
-
var __gaTrackerHitBackRun = false; /* Tracker has not yet run */
|
326 |
-
|
327 |
-
/* HitCallback to open link in same window after tracker */
|
328 |
-
var __gaTrackerHitBack = function() {
|
329 |
-
/* Run the hitback only once */
|
330 |
-
if ( __gaTrackerHitBackRun ){
|
331 |
-
return;
|
332 |
-
}
|
333 |
-
__gaTrackerHitBackRun = true;
|
334 |
-
window.location.href = link;
|
335 |
-
};
|
336 |
-
|
337 |
-
var __gaTrackerNoRedirectExternal = function() {
|
338 |
-
valuesArray.exit = 'external';
|
339 |
-
__gaTrackerNotSend( valuesArray );
|
340 |
-
};
|
341 |
-
|
342 |
-
var __gaTrackerNoRedirectInboundAsExternal = function() {
|
343 |
-
valuesArray.exit = 'internal-as-outbound';
|
344 |
-
__gaTrackerNotSend( valuesArray );
|
345 |
-
};
|
346 |
-
var __gaTrackerNoRedirectCrossHostname = function() {
|
347 |
-
valuesArray.exit = 'cross-hostname';
|
348 |
-
__gaTrackerNotSend( valuesArray );
|
349 |
-
};
|
350 |
-
|
351 |
-
if ( target || type == 'mailto' || type == 'tel' ) { /* If target opens a new window then just track */
|
352 |
-
if ( type == 'download' ) {
|
353 |
-
fieldsArray = {
|
354 |
-
hitType : 'event',
|
355 |
-
eventCategory : 'download',
|
356 |
-
eventAction : action || link,
|
357 |
-
eventLabel : label || valuesArray.title,
|
358 |
-
};
|
359 |
-
|
360 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
361 |
-
} else if ( type == 'tel' ) {
|
362 |
-
fieldsArray = {
|
363 |
-
hitType : 'event',
|
364 |
-
eventCategory : 'tel',
|
365 |
-
eventAction : action || link,
|
366 |
-
eventLabel : label || valuesArray.title.replace('tel:', ''),
|
367 |
-
};
|
368 |
-
|
369 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
370 |
-
} else if ( type == 'mailto' ) {
|
371 |
-
fieldsArray = {
|
372 |
-
hitType : 'event',
|
373 |
-
eventCategory : 'mailto',
|
374 |
-
eventAction : action || link,
|
375 |
-
eventLabel : label || valuesArray.title.replace('mailto:', ''),
|
376 |
-
};
|
377 |
-
|
378 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
379 |
-
} else if ( type == 'internal-as-outbound' ) {
|
380 |
-
fieldsArray = {
|
381 |
-
hitType : 'event',
|
382 |
-
eventCategory : internalAsOutboundCategory,
|
383 |
-
eventAction : action || link,
|
384 |
-
eventLabel : label || valuesArray.title,
|
385 |
-
};
|
386 |
-
|
387 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
388 |
-
} else if ( type == 'external' ) {
|
389 |
-
fieldsArray = {
|
390 |
-
hitType: 'event',
|
391 |
-
eventCategory:'outbound-link',
|
392 |
-
eventAction: action || link,
|
393 |
-
eventLabel: label || valuesArray.title,
|
394 |
-
};
|
395 |
-
|
396 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
397 |
-
} else if ( type == 'cross-hostname' ) {
|
398 |
-
fieldsArray = {
|
399 |
-
hitType: 'event',
|
400 |
-
eventCategory:'cross-hostname',
|
401 |
-
eventAction: action || link,
|
402 |
-
eventLabel: label || valuesArray.title,
|
403 |
-
};
|
404 |
-
|
405 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
406 |
-
} else {
|
407 |
-
if ( type && type != 'internal' ) {
|
408 |
-
fieldsArray = {
|
409 |
-
hitType: 'event',
|
410 |
-
eventCategory: type,
|
411 |
-
eventAction: action || link,
|
412 |
-
eventLabel: label || valuesArray.title,
|
413 |
-
};
|
414 |
-
|
415 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
416 |
-
} else {
|
417 |
-
valuesArray.exit = 'type';
|
418 |
-
__gaTrackerNotSend( valuesArray );
|
419 |
-
}
|
420 |
-
}
|
421 |
-
} else {
|
422 |
-
/* Prevent standard click, track then open */
|
423 |
-
if ( type != 'cross-hostname' && type != 'external' && type != 'internal-as-outbound' ) {
|
424 |
-
if (! event.defaultPrevented ) {
|
425 |
-
if ( event.preventDefault ) {
|
426 |
-
event.preventDefault();
|
427 |
-
} else {
|
428 |
-
event.returnValue = false;
|
429 |
-
}
|
430 |
-
}
|
431 |
-
}
|
432 |
-
|
433 |
-
if ( type == 'download' ) {
|
434 |
-
fieldsArray = {
|
435 |
-
hitType : 'event',
|
436 |
-
eventCategory : 'download',
|
437 |
-
eventAction : action || link,
|
438 |
-
eventLabel : label || valuesArray.title,
|
439 |
-
hitCallback : __gaTrackerHitBack,
|
440 |
-
};
|
441 |
-
|
442 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
443 |
-
} else if ( type == 'internal-as-outbound' ) {
|
444 |
-
window.onbeforeunload = function(e) {
|
445 |
-
if (! event.defaultPrevented ) {
|
446 |
-
if ( event.preventDefault ) {
|
447 |
-
event.preventDefault();
|
448 |
-
} else {
|
449 |
-
event.returnValue = false;
|
450 |
-
}
|
451 |
-
}
|
452 |
-
|
453 |
-
fieldsArray = {
|
454 |
-
hitType : 'event',
|
455 |
-
eventCategory : internalAsOutboundCategory,
|
456 |
-
eventAction : action || link,
|
457 |
-
eventLabel : label || valuesArray.title,
|
458 |
-
hitCallback : __gaTrackerHitBack,
|
459 |
-
};
|
460 |
-
|
461 |
-
if ( navigator.sendBeacon ) {
|
462 |
-
fieldsArray.transport = 'beacon';
|
463 |
-
}
|
464 |
-
|
465 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
466 |
-
setTimeout( __gaTrackerHitBack, 1000 );
|
467 |
-
};
|
468 |
-
} else if ( type == 'external' ) {
|
469 |
-
window.onbeforeunload = function(e) {
|
470 |
-
if (! event.defaultPrevented ) {
|
471 |
-
if ( event.preventDefault ) {
|
472 |
-
event.preventDefault();
|
473 |
-
} else {
|
474 |
-
event.returnValue = false;
|
475 |
-
}
|
476 |
-
}
|
477 |
-
|
478 |
-
fieldsArray = {
|
479 |
-
hitType : 'event',
|
480 |
-
eventCategory : 'outbound-link',
|
481 |
-
eventAction : action || link,
|
482 |
-
eventLabel : label || valuesArray.title,
|
483 |
-
hitCallback : __gaTrackerHitBack,
|
484 |
-
};
|
485 |
-
|
486 |
-
if ( navigator.sendBeacon ) {
|
487 |
-
fieldsArray.transport = 'beacon';
|
488 |
-
}
|
489 |
-
|
490 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
491 |
-
setTimeout( __gaTrackerHitBack, 1000 );
|
492 |
-
};
|
493 |
-
} else if ( type == 'cross-hostname' ) {
|
494 |
-
window.onbeforeunload = function(e) {
|
495 |
-
if (! event.defaultPrevented ) {
|
496 |
-
if ( event.preventDefault ) {
|
497 |
-
event.preventDefault();
|
498 |
-
} else {
|
499 |
-
event.returnValue = false;
|
500 |
-
}
|
501 |
-
}
|
502 |
-
|
503 |
-
fieldsArray = {
|
504 |
-
hitType : 'event',
|
505 |
-
eventCategory : 'cross-hostname',
|
506 |
-
eventAction : action || link,
|
507 |
-
eventLabel : label || valuesArray.title,
|
508 |
-
hitCallback : __gaTrackerHitBack,
|
509 |
-
};
|
510 |
-
|
511 |
-
if ( navigator.sendBeacon ) {
|
512 |
-
fieldsArray.transport = 'beacon';
|
513 |
-
}
|
514 |
-
|
515 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
516 |
-
setTimeout( __gaTrackerHitBack, 1000 );
|
517 |
-
};
|
518 |
-
} else {
|
519 |
-
if ( type && type !== 'internal' ) {
|
520 |
-
fieldsArray = {
|
521 |
-
hitType: 'event',
|
522 |
-
eventCategory: type,
|
523 |
-
eventAction: action || link,
|
524 |
-
eventLabel: label || valuesArray.title,
|
525 |
-
hitCallback : __gaTrackerHitBack,
|
526 |
-
};
|
527 |
-
|
528 |
-
__gaTrackerSend( valuesArray, fieldsArray );
|
529 |
-
} else {
|
530 |
-
valuesArray.exit = 'type';
|
531 |
-
__gaTrackerNotSend( valuesArray );
|
532 |
-
}
|
533 |
-
}
|
534 |
-
|
535 |
-
if ( type != 'external' && type != 'cross-hostname' && type != 'internal-as-outbound' ) {
|
536 |
-
/* Run hitCallback again if GA takes longer than 1 second */
|
537 |
-
setTimeout( __gaTrackerHitBack, 1000 );
|
538 |
-
} else {
|
539 |
-
if ( type == 'external' ) {
|
540 |
-
setTimeout( __gaTrackerNoRedirectExternal, 1100 );
|
541 |
-
} else if ( type == 'cross-hostname' ) {
|
542 |
-
setTimeout( __gaTrackerNoRedirectCrossHostname, 1100 );
|
543 |
-
} else {
|
544 |
-
setTimeout( __gaTrackerNoRedirectInboundAsExternal, 1100 );
|
545 |
-
}
|
546 |
-
}
|
547 |
-
}
|
548 |
-
} else {
|
549 |
-
valuesArray.exit = 'internal';
|
550 |
-
__gaTrackerNotSend( valuesArray );
|
551 |
-
}
|
552 |
-
} else {
|
553 |
-
valuesArray.exit = 'notlink';
|
554 |
-
__gaTrackerNotSend( valuesArray );
|
555 |
-
}
|
556 |
-
}
|
557 |
-
var prevHash = window.location.hash;
|
558 |
-
function __gaTrackerHashChangeEvent() {
|
559 |
-
/* Todo: Ready this section for JS unit testing */
|
560 |
-
if ( exactmetrics_frontend.hash_tracking === "true" && prevHash != window.location.hash ) {
|
561 |
-
prevHash = window.location.hash;
|
562 |
-
__gaTracker('set', 'page', location.pathname + location.search + location.hash );
|
563 |
-
__gaTracker('send', 'pageview' );
|
564 |
-
__gaTrackerLog( "Hash change to: " + location.pathname + location.search + location.hash );
|
565 |
-
} else {
|
566 |
-
__gaTrackerLog( "Hash change to (untracked): " + location.pathname + location.search + location.hash );
|
567 |
-
}
|
568 |
-
}
|
569 |
-
|
570 |
-
/* Attach the event to all clicks in the document after page has loaded */
|
571 |
-
var __gaTrackerWindow = window;
|
572 |
-
if ( __gaTrackerWindow.addEventListener ) {
|
573 |
-
__gaTrackerWindow.addEventListener(
|
574 |
-
"load",
|
575 |
-
function() {
|
576 |
-
document.body.addEventListener(
|
577 |
-
"click",
|
578 |
-
__gaTrackerClickEvent,
|
579 |
-
false
|
580 |
-
);
|
581 |
-
},
|
582 |
-
false
|
583 |
-
);
|
584 |
-
window.addEventListener("hashchange", __gaTrackerHashChangeEvent, false );
|
585 |
-
} else {
|
586 |
-
if ( __gaTrackerWindow.attachEvent ) {
|
587 |
-
__gaTrackerWindow.attachEvent(
|
588 |
-
"onload",
|
589 |
-
function() {
|
590 |
-
document.body.attachEvent( "onclick", __gaTrackerClickEvent);
|
591 |
-
}
|
592 |
-
);
|
593 |
-
window.attachEvent( "onhashchange", __gaTrackerHashChangeEvent);
|
594 |
-
}
|
595 |
-
}
|
596 |
-
|
597 |
-
if (typeof String.prototype.endsWith !== 'function') {
|
598 |
-
String.prototype.endsWith = function(suffix) {
|
599 |
-
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
600 |
-
};
|
601 |
-
}
|
602 |
-
if (typeof String.prototype.startsWith !== 'function') {
|
603 |
-
String.prototype.startsWith = function(prefix) {
|
604 |
-
return this.indexOf(prefix) === 0;
|
605 |
-
};
|
606 |
-
}
|
607 |
-
|
608 |
-
if ( typeof Array.prototype.lastIndexOf !== 'function' ) {
|
609 |
-
Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {
|
610 |
-
'use strict';
|
611 |
-
|
612 |
-
if (this === void 0 || this === null) {
|
613 |
-
throw new TypeError();
|
614 |
-
}
|
615 |
-
|
616 |
-
var n, k,
|
617 |
-
t = Object(this),
|
618 |
-
len = t.length >>> 0; /* jshint ignore:line */
|
619 |
-
if (len === 0) {
|
620 |
-
return -1;
|
621 |
-
}
|
622 |
-
|
623 |
-
n = len - 1;
|
624 |
-
if (arguments.length > 1) {
|
625 |
-
n = Number(arguments[1]);
|
626 |
-
if (n != n) {
|
627 |
-
n = 0;
|
628 |
-
}
|
629 |
-
else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { /* jshint ignore:line */
|
630 |
-
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
631 |
-
}
|
632 |
-
}
|
633 |
-
|
634 |
-
for (k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); k >= 0; k--) {
|
635 |
-
if (k in t && t[k] === searchElement) {
|
636 |
-
return k;
|
637 |
-
}
|
638 |
-
}
|
639 |
-
return -1;
|
640 |
-
};
|
641 |
-
}
|
642 |
-
};
|
643 |
-
var ExactMetricsObject = new ExactMetrics();
|
1 |
+
/**
|
2 |
+
* Developer's Notice:
|
3 |
+
*
|
4 |
+
* Note: JS in this file (and this file itself) is not garunteed backwards compatibility. JS can be added, changed or removed at any time without notice.
|
5 |
+
* For more information see the `Backwards Compatibility Guidelines for Developers` section of the README.md file.
|
6 |
+
*/
|
7 |
+
/**
|
8 |
+
* Handles:
|
9 |
+
* - JS Events handling
|
10 |
+
*
|
11 |
+
* @since 6.0.12
|
12 |
+
*/
|
13 |
+
var ExactMetrics = function(){
|
14 |
+
/* ExactMetrics JS events tracking works on all major browsers, including IE starting at IE 7, via polyfills for any major JS function used that
|
15 |
+
is not supported by at least 95% of the global and/or US browser marketshare. Currently, IE 7 & 8 which as of 2/14/17 have under 0.25% global marketshare, require
|
16 |
+
us to polyfill Array.prototype.lastIndexOf, and if they continue to drop, we might remove this polyfill at some point. In that case note that events tracking
|
17 |
+
for IE 7/8 will continue to work, with the exception of events tracking of downloads. */
|
18 |
+
var lastClicked = [];
|
19 |
+
var internalAsOutboundCategory = '';
|
20 |
+
|
21 |
+
this.setLastClicked = function(valuesArray,fieldsArray,tracked){
|
22 |
+
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
23 |
+
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : [];
|
24 |
+
tracked = typeof tracked !== 'undefined' ? tracked : false;
|
25 |
+
|
26 |
+
lastClicked.valuesArray = valuesArray;
|
27 |
+
lastClicked.fieldsArray = fieldsArray;
|
28 |
+
};
|
29 |
+
|
30 |
+
this.getLastClicked = function () {
|
31 |
+
return lastClicked;
|
32 |
+
};
|
33 |
+
|
34 |
+
this.setInternalAsOutboundCategory = function( category ){
|
35 |
+
internalAsOutboundCategory = category;
|
36 |
+
};
|
37 |
+
|
38 |
+
this.getInternalAsOutboundCategory = function () {
|
39 |
+
return internalAsOutboundCategory;
|
40 |
+
};
|
41 |
+
|
42 |
+
this.sendEvent = function ( fieldsArray ) {
|
43 |
+
__gaTrackerSend( [], fieldsArray );
|
44 |
+
};
|
45 |
+
|
46 |
+
function __gaTrackerIsDebug () {
|
47 |
+
if ( window.exactmetrics_debug_mode ) {
|
48 |
+
return true;
|
49 |
+
} else {
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
function __gaTrackerSend ( valuesArray, fieldsArray ) {
|
55 |
+
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
56 |
+
fieldsArray = typeof fieldsArray !== 'undefined' ? fieldsArray : {};
|
57 |
+
|
58 |
+
__gaTracker( 'send', fieldsArray );
|
59 |
+
|
60 |
+
lastClicked.valuesArray = valuesArray;
|
61 |
+
lastClicked.fieldsArray = fieldsArray;
|
62 |
+
lastClicked.tracked = true;
|
63 |
+
__gaTrackerLog( 'Tracked: ' + valuesArray.type );
|
64 |
+
__gaTrackerLog( lastClicked );
|
65 |
+
}
|
66 |
+
|
67 |
+
function __gaTrackerNotSend ( valuesArray ) {
|
68 |
+
valuesArray = typeof valuesArray !== 'undefined' ? valuesArray : [];
|
69 |
+
|
70 |
+
lastClicked.valuesArray = valuesArray;
|
71 |
+
lastClicked.fieldsArray = [];
|
72 |
+
lastClicked.tracked = false;
|
73 |
+
__gaTrackerLog( 'Not Tracked: ' + valuesArray.exit );
|
74 |
+
__gaTrackerLog( lastClicked );
|
75 |
+
}
|
76 |
+
|
77 |
+
function __gaTrackerLog ( message ) {
|
78 |
+
if ( __gaTrackerIsDebug() ) {
|
79 |
+
console.dir( message );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
function __gaTrackerStringTrim( x ) {
|
84 |
+
return x.replace(/^\s+|\s+$/gm,'');
|
85 |
+
}
|
86 |
+
|
87 |
+
function __gaTrackerGetDomain() {
|
88 |
+
var i=0,currentdomain=document.domain,p=currentdomain.split('.'),s='_gd'+(new Date()).getTime();
|
89 |
+
while(i<(p.length-1) && document.cookie.indexOf(s+'='+s)==-1){
|
90 |
+
currentdomain = p.slice(-1-(++i)).join('.');
|
91 |
+
document.cookie = s+"="+s+";domain="+currentdomain+";";
|
92 |
+
}
|
93 |
+
document.cookie = s+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain="+currentdomain+";";
|
94 |
+
return currentdomain;
|
95 |
+
}
|
96 |
+
|
97 |
+
function __gaTrackerGetExtension( extension ) {
|
98 |
+
extension = extension.toString();
|
99 |
+
extension = extension.substring( 0, (extension.indexOf( "#" ) == -1 ) ? extension.length : extension.indexOf( "#" ) ); /* Remove the anchor at the end, if there is one */
|
100 |
+
extension = extension.substring( 0, (extension.indexOf( "?" ) == -1 ) ? extension.length : extension.indexOf( "?" ) ); /* Remove the query after the file name, if there is one */
|
101 |
+
extension = extension.substring( extension.lastIndexOf( "/" ) + 1, extension.length ); /* Remove everything before the last slash in the path */
|
102 |
+
if ( extension.length > 0 && extension.indexOf('.') !== -1 ) { /* If there's a period left in the URL, then there's a extension. Else it is not a extension. */
|
103 |
+
extension = extension.substring( extension.indexOf( "." ) + 1 ); /* Remove everything but what's after the first period */
|
104 |
+
return extension;
|
105 |
+
} else {
|
106 |
+
return "";
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
function __gaTrackerLoaded() {
|
111 |
+
return typeof(__gaTracker) !== 'undefined' && __gaTracker && __gaTracker.hasOwnProperty( "loaded" ) && __gaTracker.loaded == true; /* jshint ignore:line */
|
112 |
+
}
|
113 |
+
|
114 |
+
function __gaTrackerTrackedClick( event ) {
|
115 |
+
return event.which == 1 || event.which == 2 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
116 |
+
}
|
117 |
+
|
118 |
+
function __gaTrackerGetDownloadExtensions() {
|
119 |
+
var download_extensions = [];
|
120 |
+
if ( typeof exactmetrics_frontend.download_extensions == 'string' ) {
|
121 |
+
download_extensions = exactmetrics_frontend.download_extensions.split(",");
|
122 |
+
}
|
123 |
+
return download_extensions;
|
124 |
+
}
|
125 |
+
|
126 |
+
function __gaTrackerGetInboundPaths() {
|
127 |
+
var inbound_paths = [];
|
128 |
+
if ( typeof exactmetrics_frontend.inbound_paths == 'string' ) {
|
129 |
+
inbound_paths = JSON.parse( exactmetrics_frontend.inbound_paths );
|
130 |
+
}
|
131 |
+
|
132 |
+
return inbound_paths;
|
133 |
+
}
|
134 |
+
|
135 |
+
function __gaTrackerTrackedClickType( event ) {
|
136 |
+
if ( event.which == 1 ) {
|
137 |
+
return 'event.which=1';
|
138 |
+
} else if ( event.which == 2 ) {
|
139 |
+
return 'event.which=2';
|
140 |
+
} else if ( event.metaKey ){
|
141 |
+
return 'metaKey';
|
142 |
+
} else if ( event.ctrlKey ) {
|
143 |
+
return 'ctrlKey';
|
144 |
+
} else if ( event.shiftKey ) {
|
145 |
+
return 'shiftKey';
|
146 |
+
} else if ( event.altKey ) {
|
147 |
+
return 'altKey';
|
148 |
+
} else {
|
149 |
+
return '';
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
function __gaTrackerLinkType( el ) {
|
154 |
+
var download_extensions = __gaTrackerGetDownloadExtensions();
|
155 |
+
var inbound_paths = __gaTrackerGetInboundPaths();
|
156 |
+
var type = 'unknown';
|
157 |
+
var link = el.href;
|
158 |
+
var extension = __gaTrackerGetExtension( el.href );
|
159 |
+
var currentdomain = __gaTrackerGetDomain();
|
160 |
+
var hostname = el.hostname;
|
161 |
+
var protocol = el.protocol;
|
162 |
+
var pathname = el.pathname;
|
163 |
+
link = link.toString();
|
164 |
+
var index, len;
|
165 |
+
var category = el.getAttribute("data-vars-ga-category");
|
166 |
+
|
167 |
+
if ( category ) {
|
168 |
+
return category;
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( link.match( /^javascript\:/i ) ) {
|
172 |
+
type = 'internal'; /* if it's a JS link, it's internal */
|
173 |
+
} else if ( protocol && protocol.length > 0 && ( __gaTrackerStringTrim( protocol ) == 'tel' || __gaTrackerStringTrim( protocol ) == 'tel:' ) ) { /* If it's a telephone link */
|
174 |
+
type = "tel";
|
175 |
+
} else if ( protocol && protocol.length > 0 && ( __gaTrackerStringTrim( protocol ) == 'mailto' || __gaTrackerStringTrim( protocol ) == 'mailto:' ) ) { /* If it's a email */
|
176 |
+
type = "mailto";
|
177 |
+
} else if ( hostname && currentdomain && hostname.length > 0 && currentdomain.length > 0 && ! hostname.endsWith( '.' + currentdomain) && hostname !== currentdomain ) { /* If it's a outbound */
|
178 |
+
type = "external";
|
179 |
+
} else if ( pathname && JSON.stringify( inbound_paths ) != "{}" && pathname.length > 0 ) { /* If it's an internal as outbound */
|
180 |
+
var inbound_paths_length = inbound_paths.length;
|
181 |
+
for ( var inbound_paths_index = 0; inbound_paths_index < inbound_paths_length; inbound_paths_index ++ ) {
|
182 |
+
if ( inbound_paths[ inbound_paths_index ].path && inbound_paths[ inbound_paths_index ].label && inbound_paths[ inbound_paths_index ].path.length > 0 && inbound_paths[ inbound_paths_index ].label.length > 0 && pathname.startsWith( inbound_paths[ inbound_paths_index ].path ) ) {
|
183 |
+
type = "internal-as-outbound";
|
184 |
+
internalAsOutboundCategory = "outbound-link-" + inbound_paths[ inbound_paths_index ].label;
|
185 |
+
break;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
/* Enable window.exactmetrics_experimental_mode at your own risk. We might eventually remove it. Also you may/can/will burn through GA quota for your property quickly. */
|
189 |
+
} else if ( hostname && window.exactmetrics_experimental_mode && hostname.length > 0 && document.domain.length > 0 && hostname !== document.domain ) { /* If it's a cross-hostname link */
|
190 |
+
type = "cross-hostname";
|
191 |
+
}
|
192 |
+
|
193 |
+
if ( extension && ( type === 'unknown' || 'external' === type ) && download_extensions.length > 0 && extension.length > 0 ) { /* If it's a download */
|
194 |
+
for ( index = 0, len = download_extensions.length; index < len; ++index ) {
|
195 |
+
if ( download_extensions[ index ].length > 0 && ( link.endsWith( download_extensions[ index ] ) || download_extensions[ index ] == extension ) ) {
|
196 |
+
type = "download";
|
197 |
+
break;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( type === 'unknown' ) {
|
203 |
+
type = 'internal';
|
204 |
+
}
|
205 |
+
return type;
|
206 |
+
}
|
207 |
+
|
208 |
+
function __gaTrackerLinkTarget( el, event ) {
|
209 |
+
|
210 |
+
/* Is actual target set and not _(self|parent|top)? */
|
211 |
+
var target = ( el.target && !el.target.match( /^_(self|parent|top)$/i ) ) ? el.target : false;
|
212 |
+
|
213 |
+
/* Assume a target if Ctrl|shift|meta-click */
|
214 |
+
if ( event.ctrlKey || event.shiftKey || event.metaKey || event.which == 2 ) {
|
215 |
+
target = "_blank";
|
216 |
+
}
|
217 |
+
return target;
|
218 |
+
}
|
219 |
+
|
220 |
+
function __gaTrackerGetTitle( el ) {
|
221 |
+
if ( el.getAttribute("data-vars-ga-label") && el.getAttribute("data-vars-ga-label").replace(/\n/ig, '') ) {
|
222 |
+
return el.getAttribute("data-vars-ga-label").replace(/\n/ig, '');
|
223 |
+
} else if ( el.title && el.title.replace(/\n/ig, '') ) {
|
224 |
+
return el.title.replace(/\n/ig, '');
|
225 |
+
} else if ( el.innerText && el.innerText.replace(/\n/ig, '') ) {
|
226 |
+
return el.innerText.replace(/\n/ig, '');
|
227 |
+
} else if ( el.getAttribute('aria-label') && el.getAttribute('aria-label').replace(/\n/ig, '') ) {
|
228 |
+
return el.getAttribute('aria-label').replace(/\n/ig, '');
|
229 |
+
} else if ( el.alt && el.alt.replace(/\n/ig, '') ) {
|
230 |
+
return el.alt.replace(/\n/ig, '');
|
231 |
+
} else if ( el.textContent && el.textContent.replace(/\n/ig, '') ) {
|
232 |
+
return el.textContent.replace(/\n/ig, '');
|
233 |
+
} else {
|
234 |
+
return undefined;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
function __gaTrackerGetInnerTitle( el ) {
|
239 |
+
var children = el.children;
|
240 |
+
var count = 0;
|
241 |
+
var child;
|
242 |
+
var value;
|
243 |
+
for (var i = 0; i < children.length; i++) {
|
244 |
+
child = children[i];
|
245 |
+
value = __gaTrackerGetTitle( child );
|
246 |
+
if ( value ) {
|
247 |
+
return value;
|
248 |
+
}
|
249 |
+
/* max search 100 elements to ensure performance */
|
250 |
+
if ( count == 99 ) {
|
251 |
+
return undefined;
|
252 |
+
}
|
253 |
+
count++;
|
254 |
+
}
|
255 |
+
return undefined;
|
256 |
+
}
|
257 |
+
|
258 |
+
function __gaTrackerClickEvent( event ) {
|
259 |
+
var el = event.srcElement || event.target;
|
260 |
+
var valuesArray = [];
|
261 |
+
var fieldsArray;
|
262 |
+
|
263 |
+
/* Start Values Array */
|
264 |
+
valuesArray.el = el;
|
265 |
+
valuesArray.ga_loaded = __gaTrackerLoaded();
|
266 |
+
valuesArray.click_type = __gaTrackerTrackedClickType( event );
|
267 |
+
|
268 |
+
/* If GA is blocked or not loaded, or not main|middle|touch click then don't track */
|
269 |
+
if ( ! __gaTrackerLoaded() || ! __gaTrackerTrackedClick( event ) ) {
|
270 |
+
valuesArray.exit = 'loaded';
|
271 |
+
__gaTrackerNotSend( valuesArray );
|
272 |
+
return;
|
273 |
+
}
|
274 |
+
|
275 |
+
/* Loop up the DOM tree through parent elements if clicked element is not a link (eg: an image inside a link) */
|
276 |
+
while ( el && (typeof el.tagName == 'undefined' || el.tagName.toLowerCase() != 'a' || ! el.href ) ) {
|
277 |
+
el = el.parentNode;
|
278 |
+
}
|
279 |
+
|
280 |
+
/* if a link with valid href has been clicked */
|
281 |
+
if ( el && el.href && ! el.hasAttribute('xlink:href') ) {
|
282 |
+
var link = el.href; /* What link are we tracking */
|
283 |
+
var extension = __gaTrackerGetExtension( el.href ); /* What extension is this link */
|
284 |
+
var download_extensions = __gaTrackerGetDownloadExtensions(); /* Let's get the extensions to track */
|
285 |
+
var inbound_paths = __gaTrackerGetInboundPaths(); /* Let's get the internal paths to track */
|
286 |
+
var home_url = exactmetrics_frontend.home_url; /* Let's get the url to compare for external/internal use */
|
287 |
+
var currentdomain = __gaTrackerGetDomain(); /* What domain are we on? */
|
288 |
+
var type = __gaTrackerLinkType( el ); /* What type of link is this? */
|
289 |
+
var target = __gaTrackerLinkTarget( el, event ); /* Is a new tab/window being opened? */
|
290 |
+
var action = el.getAttribute("data-vars-ga-action");
|
291 |
+
var label = el.getAttribute("data-vars-ga-label");
|
292 |
+
|
293 |
+
/* Element */
|
294 |
+
valuesArray.el = el; /* el is an a element so we can parse it */
|
295 |
+
valuesArray.el_href = el.href; /* "http://example.com:3000/pathname/?search=test#hash" */
|
296 |
+
valuesArray.el_protocol = el.protocol; /* "http:" */
|
297 |
+
valuesArray.el_hostname = el.hostname; /* "example.com" */
|
298 |
+
valuesArray.el_port = el.port; /* "3000" */
|
299 |
+
valuesArray.el_pathname = el.pathname; /* "/pathname/" */
|
300 |
+
valuesArray.el_search = el.search; /* "?search=test" */
|
301 |
+
valuesArray.el_hash = el.hash; /* "#hash" */
|
302 |
+
valuesArray.el_host = el.host; /* "example.com:3000" */
|
303 |
+
|
304 |
+
/* Settings */
|
305 |
+
valuesArray.debug_mode = __gaTrackerIsDebug(); /* "example.com:3000" */
|
306 |
+
valuesArray.download_extensions = download_extensions; /* Let's get the extensions to track */
|
307 |
+
valuesArray.inbound_paths = inbound_paths; /* Let's get the internal paths to track */
|
308 |
+
valuesArray.home_url = home_url; /* Let's get the url to compare for external/internal use */
|
309 |
+
|
310 |
+
/* Parsed/Logic */
|
311 |
+
valuesArray.link = link; /* What link are we tracking */
|
312 |
+
valuesArray.extension = extension; /* What extension is this link */
|
313 |
+
valuesArray.type = type; /* What type of link is this */
|
314 |
+
valuesArray.target = target; /* Is a new tab/window being opened? */
|
315 |
+
valuesArray.title = __gaTrackerGetTitle( el ); /* Try link title, then text content */
|
316 |
+
|
317 |
+
/* only find innerTitle if we need one */
|
318 |
+
if ( ! valuesArray.label && ! valuesArray.title ) {
|
319 |
+
valuesArray.title = __gaTrackerGetInnerTitle( el );
|
320 |
+
}
|
321 |
+
|
322 |
+
/* Let's track everything but internals (that aren't internal-as-externals) and javascript */
|
323 |
+
if ( type !== 'internal' && type !== 'javascript' ) {
|
324 |
+
|
325 |
+
var __gaTrackerHitBackRun = false; /* Tracker has not yet run */
|
326 |
+
|
327 |
+
/* HitCallback to open link in same window after tracker */
|
328 |
+
var __gaTrackerHitBack = function() {
|
329 |
+
/* Run the hitback only once */
|
330 |
+
if ( __gaTrackerHitBackRun ){
|
331 |
+
return;
|
332 |
+
}
|
333 |
+
__gaTrackerHitBackRun = true;
|
334 |
+
window.location.href = link;
|
335 |
+
};
|
336 |
+
|
337 |
+
var __gaTrackerNoRedirectExternal = function() {
|
338 |
+
valuesArray.exit = 'external';
|
339 |
+
__gaTrackerNotSend( valuesArray );
|
340 |
+
};
|
341 |
+
|
342 |
+
var __gaTrackerNoRedirectInboundAsExternal = function() {
|
343 |
+
valuesArray.exit = 'internal-as-outbound';
|
344 |
+
__gaTrackerNotSend( valuesArray );
|
345 |
+
};
|
346 |
+
var __gaTrackerNoRedirectCrossHostname = function() {
|
347 |
+
valuesArray.exit = 'cross-hostname';
|
348 |
+
__gaTrackerNotSend( valuesArray );
|
349 |
+
};
|
350 |
+
|
351 |
+
if ( target || type == 'mailto' || type == 'tel' ) { /* If target opens a new window then just track */
|
352 |
+
if ( type == 'download' ) {
|
353 |
+
fieldsArray = {
|
354 |
+
hitType : 'event',
|
355 |
+
eventCategory : 'download',
|
356 |
+
eventAction : action || link,
|
357 |
+
eventLabel : label || valuesArray.title,
|
358 |
+
};
|
359 |
+
|
360 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
361 |
+
} else if ( type == 'tel' ) {
|
362 |
+
fieldsArray = {
|
363 |
+
hitType : 'event',
|
364 |
+
eventCategory : 'tel',
|
365 |
+
eventAction : action || link,
|
366 |
+
eventLabel : label || valuesArray.title.replace('tel:', ''),
|
367 |
+
};
|
368 |
+
|
369 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
370 |
+
} else if ( type == 'mailto' ) {
|
371 |
+
fieldsArray = {
|
372 |
+
hitType : 'event',
|
373 |
+
eventCategory : 'mailto',
|
374 |
+
eventAction : action || link,
|
375 |
+
eventLabel : label || valuesArray.title.replace('mailto:', ''),
|
376 |
+
};
|
377 |
+
|
378 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
379 |
+
} else if ( type == 'internal-as-outbound' ) {
|
380 |
+
fieldsArray = {
|
381 |
+
hitType : 'event',
|
382 |
+
eventCategory : internalAsOutboundCategory,
|
383 |
+
eventAction : action || link,
|
384 |
+
eventLabel : label || valuesArray.title,
|
385 |
+
};
|
386 |
+
|
387 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
388 |
+
} else if ( type == 'external' ) {
|
389 |
+
fieldsArray = {
|
390 |
+
hitType: 'event',
|
391 |
+
eventCategory:'outbound-link',
|
392 |
+
eventAction: action || link,
|
393 |
+
eventLabel: label || valuesArray.title,
|
394 |
+
};
|
395 |
+
|
396 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
397 |
+
} else if ( type == 'cross-hostname' ) {
|
398 |
+
fieldsArray = {
|
399 |
+
hitType: 'event',
|
400 |
+
eventCategory:'cross-hostname',
|
401 |
+
eventAction: action || link,
|
402 |
+
eventLabel: label || valuesArray.title,
|
403 |
+
};
|
404 |
+
|
405 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
406 |
+
} else {
|
407 |
+
if ( type && type != 'internal' ) {
|
408 |
+
fieldsArray = {
|
409 |
+
hitType: 'event',
|
410 |
+
eventCategory: type,
|
411 |
+
eventAction: action || link,
|
412 |
+
eventLabel: label || valuesArray.title,
|
413 |
+
};
|
414 |
+
|
415 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
416 |
+
} else {
|
417 |
+
valuesArray.exit = 'type';
|
418 |
+
__gaTrackerNotSend( valuesArray );
|
419 |
+
}
|
420 |
+
}
|
421 |
+
} else {
|
422 |
+
/* Prevent standard click, track then open */
|
423 |
+
if ( type != 'cross-hostname' && type != 'external' && type != 'internal-as-outbound' ) {
|
424 |
+
if (! event.defaultPrevented ) {
|
425 |
+
if ( event.preventDefault ) {
|
426 |
+
event.preventDefault();
|
427 |
+
} else {
|
428 |
+
event.returnValue = false;
|
429 |
+
}
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
if ( type == 'download' ) {
|
434 |
+
fieldsArray = {
|
435 |
+
hitType : 'event',
|
436 |
+
eventCategory : 'download',
|
437 |
+
eventAction : action || link,
|
438 |
+
eventLabel : label || valuesArray.title,
|
439 |
+
hitCallback : __gaTrackerHitBack,
|
440 |
+
};
|
441 |
+
|
442 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
443 |
+
} else if ( type == 'internal-as-outbound' ) {
|
444 |
+
window.onbeforeunload = function(e) {
|
445 |
+
if (! event.defaultPrevented ) {
|
446 |
+
if ( event.preventDefault ) {
|
447 |
+
event.preventDefault();
|
448 |
+
} else {
|
449 |
+
event.returnValue = false;
|
450 |
+
}
|
451 |
+
}
|
452 |
+
|
453 |
+
fieldsArray = {
|
454 |
+
hitType : 'event',
|
455 |
+
eventCategory : internalAsOutboundCategory,
|
456 |
+
eventAction : action || link,
|
457 |
+
eventLabel : label || valuesArray.title,
|
458 |
+
hitCallback : __gaTrackerHitBack,
|
459 |
+
};
|
460 |
+
|
461 |
+
if ( navigator.sendBeacon ) {
|
462 |
+
fieldsArray.transport = 'beacon';
|
463 |
+
}
|
464 |
+
|
465 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
466 |
+
setTimeout( __gaTrackerHitBack, 1000 );
|
467 |
+
};
|
468 |
+
} else if ( type == 'external' ) {
|
469 |
+
window.onbeforeunload = function(e) {
|
470 |
+
if (! event.defaultPrevented ) {
|
471 |
+
if ( event.preventDefault ) {
|
472 |
+
event.preventDefault();
|
473 |
+
} else {
|
474 |
+
event.returnValue = false;
|
475 |
+
}
|
476 |
+
}
|
477 |
+
|
478 |
+
fieldsArray = {
|
479 |
+
hitType : 'event',
|
480 |
+
eventCategory : 'outbound-link',
|
481 |
+
eventAction : action || link,
|
482 |
+
eventLabel : label || valuesArray.title,
|
483 |
+
hitCallback : __gaTrackerHitBack,
|
484 |
+
};
|
485 |
+
|
486 |
+
if ( navigator.sendBeacon ) {
|
487 |
+
fieldsArray.transport = 'beacon';
|
488 |
+
}
|
489 |
+
|
490 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
491 |
+
setTimeout( __gaTrackerHitBack, 1000 );
|
492 |
+
};
|
493 |
+
} else if ( type == 'cross-hostname' ) {
|
494 |
+
window.onbeforeunload = function(e) {
|
495 |
+
if (! event.defaultPrevented ) {
|
496 |
+
if ( event.preventDefault ) {
|
497 |
+
event.preventDefault();
|
498 |
+
} else {
|
499 |
+
event.returnValue = false;
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
fieldsArray = {
|
504 |
+
hitType : 'event',
|
505 |
+
eventCategory : 'cross-hostname',
|
506 |
+
eventAction : action || link,
|
507 |
+
eventLabel : label || valuesArray.title,
|
508 |
+
hitCallback : __gaTrackerHitBack,
|
509 |
+
};
|
510 |
+
|
511 |
+
if ( navigator.sendBeacon ) {
|
512 |
+
fieldsArray.transport = 'beacon';
|
513 |
+
}
|
514 |
+
|
515 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
516 |
+
setTimeout( __gaTrackerHitBack, 1000 );
|
517 |
+
};
|
518 |
+
} else {
|
519 |
+
if ( type && type !== 'internal' ) {
|
520 |
+
fieldsArray = {
|
521 |
+
hitType: 'event',
|
522 |
+
eventCategory: type,
|
523 |
+
eventAction: action || link,
|
524 |
+
eventLabel: label || valuesArray.title,
|
525 |
+
hitCallback : __gaTrackerHitBack,
|
526 |
+
};
|
527 |
+
|
528 |
+
__gaTrackerSend( valuesArray, fieldsArray );
|
529 |
+
} else {
|
530 |
+
valuesArray.exit = 'type';
|
531 |
+
__gaTrackerNotSend( valuesArray );
|
532 |
+
}
|
533 |
+
}
|
534 |
+
|
535 |
+
if ( type != 'external' && type != 'cross-hostname' && type != 'internal-as-outbound' ) {
|
536 |
+
/* Run hitCallback again if GA takes longer than 1 second */
|
537 |
+
setTimeout( __gaTrackerHitBack, 1000 );
|
538 |
+
} else {
|
539 |
+
if ( type == 'external' ) {
|
540 |
+
setTimeout( __gaTrackerNoRedirectExternal, 1100 );
|
541 |
+
} else if ( type == 'cross-hostname' ) {
|
542 |
+
setTimeout( __gaTrackerNoRedirectCrossHostname, 1100 );
|
543 |
+
} else {
|
544 |
+
setTimeout( __gaTrackerNoRedirectInboundAsExternal, 1100 );
|
545 |
+
}
|
546 |
+
}
|
547 |
+
}
|
548 |
+
} else {
|
549 |
+
valuesArray.exit = 'internal';
|
550 |
+
__gaTrackerNotSend( valuesArray );
|
551 |
+
}
|
552 |
+
} else {
|
553 |
+
valuesArray.exit = 'notlink';
|
554 |
+
__gaTrackerNotSend( valuesArray );
|
555 |
+
}
|
556 |
+
}
|
557 |
+
var prevHash = window.location.hash;
|
558 |
+
function __gaTrackerHashChangeEvent() {
|
559 |
+
/* Todo: Ready this section for JS unit testing */
|
560 |
+
if ( exactmetrics_frontend.hash_tracking === "true" && prevHash != window.location.hash ) {
|
561 |
+
prevHash = window.location.hash;
|
562 |
+
__gaTracker('set', 'page', location.pathname + location.search + location.hash );
|
563 |
+
__gaTracker('send', 'pageview' );
|
564 |
+
__gaTrackerLog( "Hash change to: " + location.pathname + location.search + location.hash );
|
565 |
+
} else {
|
566 |
+
__gaTrackerLog( "Hash change to (untracked): " + location.pathname + location.search + location.hash );
|
567 |
+
}
|
568 |
+
}
|
569 |
+
|
570 |
+
/* Attach the event to all clicks in the document after page has loaded */
|
571 |
+
var __gaTrackerWindow = window;
|
572 |
+
if ( __gaTrackerWindow.addEventListener ) {
|
573 |
+
__gaTrackerWindow.addEventListener(
|
574 |
+
"load",
|
575 |
+
function() {
|
576 |
+
document.body.addEventListener(
|
577 |
+
"click",
|
578 |
+
__gaTrackerClickEvent,
|
579 |
+
false
|
580 |
+
);
|
581 |
+
},
|
582 |
+
false
|
583 |
+
);
|
584 |
+
window.addEventListener("hashchange", __gaTrackerHashChangeEvent, false );
|
585 |
+
} else {
|
586 |
+
if ( __gaTrackerWindow.attachEvent ) {
|
587 |
+
__gaTrackerWindow.attachEvent(
|
588 |
+
"onload",
|
589 |
+
function() {
|
590 |
+
document.body.attachEvent( "onclick", __gaTrackerClickEvent);
|
591 |
+
}
|
592 |
+
);
|
593 |
+
window.attachEvent( "onhashchange", __gaTrackerHashChangeEvent);
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
if (typeof String.prototype.endsWith !== 'function') {
|
598 |
+
String.prototype.endsWith = function(suffix) {
|
599 |
+
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
600 |
+
};
|
601 |
+
}
|
602 |
+
if (typeof String.prototype.startsWith !== 'function') {
|
603 |
+
String.prototype.startsWith = function(prefix) {
|
604 |
+
return this.indexOf(prefix) === 0;
|
605 |
+
};
|
606 |
+
}
|
607 |
+
|
608 |
+
if ( typeof Array.prototype.lastIndexOf !== 'function' ) {
|
609 |
+
Array.prototype.lastIndexOf = function(searchElement /*, fromIndex*/) {
|
610 |
+
'use strict';
|
611 |
+
|
612 |
+
if (this === void 0 || this === null) {
|
613 |
+
throw new TypeError();
|
614 |
+
}
|
615 |
+
|
616 |
+
var n, k,
|
617 |
+
t = Object(this),
|
618 |
+
len = t.length >>> 0; /* jshint ignore:line */
|
619 |
+
if (len === 0) {
|
620 |
+
return -1;
|
621 |
+
}
|
622 |
+
|
623 |
+
n = len - 1;
|
624 |
+
if (arguments.length > 1) {
|
625 |
+
n = Number(arguments[1]);
|
626 |
+
if (n != n) {
|
627 |
+
n = 0;
|
628 |
+
}
|
629 |
+
else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { /* jshint ignore:line */
|
630 |
+
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
for (k = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n); k >= 0; k--) {
|
635 |
+
if (k in t && t[k] === searchElement) {
|
636 |
+
return k;
|
637 |
+
}
|
638 |
+
}
|
639 |
+
return -1;
|
640 |
+
};
|
641 |
+
}
|
642 |
+
};
|
643 |
+
var ExactMetricsObject = new ExactMetrics();
|
assets/js/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/lib/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
assets/lib/pandora/class-am-deactivation-survey.php
CHANGED
@@ -1,358 +1,358 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! class_exists( 'AM_Deactivation_Survey' ) ) {
|
3 |
-
/**
|
4 |
-
* Awesome Motive Deactivation Survey.
|
5 |
-
*
|
6 |
-
* This prompts the user for more details when they deactivate the plugin.
|
7 |
-
*
|
8 |
-
* @version 1.2.1
|
9 |
-
* @package AwesomeMotive
|
10 |
-
* @author Jared Atchison and Chris Christoff
|
11 |
-
* @license GPL-2.0+
|
12 |
-
* @copyright Copyright (c) 2018
|
13 |
-
*/
|
14 |
-
class AM_Deactivation_Survey {
|
15 |
-
|
16 |
-
/**
|
17 |
-
* The API URL we are calling.
|
18 |
-
*
|
19 |
-
* @since 1.0.0
|
20 |
-
* @var string
|
21 |
-
*/
|
22 |
-
public $api_url = 'https://api.awesomemotive.com/v1/deactivation-survey/';
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Name for this plugin.
|
26 |
-
*
|
27 |
-
* @since 1.0.0
|
28 |
-
* @var string
|
29 |
-
*/
|
30 |
-
public $name;
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Unique slug for this plugin.
|
34 |
-
*
|
35 |
-
* @since 1.0.0
|
36 |
-
* @var string
|
37 |
-
*/
|
38 |
-
public $plugin;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Primary class constructor.
|
42 |
-
*
|
43 |
-
* @since 1.0.0
|
44 |
-
* @param string $name Plugin name.
|
45 |
-
* @param string $plugin Plugin slug.
|
46 |
-
*/
|
47 |
-
public function __construct( $name = '', $plugin = '' ) {
|
48 |
-
|
49 |
-
$this->name = $name;
|
50 |
-
$this->plugin = $plugin;
|
51 |
-
|
52 |
-
// Don't run deactivation survey on dev sites.
|
53 |
-
if ( $this->is_dev_url() ) {
|
54 |
-
return;
|
55 |
-
}
|
56 |
-
|
57 |
-
add_action( 'admin_print_scripts', array( $this, 'js' ), 20 );
|
58 |
-
add_action( 'admin_print_scripts', array( $this, 'css' ) );
|
59 |
-
add_action( 'admin_footer', array( $this, 'modal' ) );
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Checks if current site is a development one.
|
64 |
-
*
|
65 |
-
* @since 1.2.0
|
66 |
-
* @return bool
|
67 |
-
*/
|
68 |
-
public function is_dev_url() {
|
69 |
-
// If it is an AM dev site, return false, so we can see them on our dev sites.
|
70 |
-
if ( defined ('AWESOMEMOTIVE_DEV_MODE' ) && AWESOMEMOTIVE_DEV_MODE ) {
|
71 |
-
return false;
|
72 |
-
}
|
73 |
-
|
74 |
-
$url = network_site_url( '/' );
|
75 |
-
$is_local_url = false;
|
76 |
-
|
77 |
-
// Trim it up
|
78 |
-
$url = strtolower( trim( $url ) );
|
79 |
-
|
80 |
-
// Need to get the host...so let's add the scheme so we can use parse_url
|
81 |
-
if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) {
|
82 |
-
$url = 'http://' . $url;
|
83 |
-
}
|
84 |
-
$url_parts = parse_url( $url );
|
85 |
-
$host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false;
|
86 |
-
if ( ! empty( $url ) && ! empty( $host ) ) {
|
87 |
-
if ( false !== ip2long( $host ) ) {
|
88 |
-
if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) {
|
89 |
-
$is_local_url = true;
|
90 |
-
}
|
91 |
-
} else if ( 'localhost' === $host ) {
|
92 |
-
$is_local_url = true;
|
93 |
-
}
|
94 |
-
|
95 |
-
$tlds_to_check = array( '.dev', '.local', ':8888' );
|
96 |
-
foreach ( $tlds_to_check as $tld ) {
|
97 |
-
if ( false !== strpos( $host, $tld ) ) {
|
98 |
-
$is_local_url = true;
|
99 |
-
continue;
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
if ( substr_count( $host, '.' ) > 1 ) {
|
104 |
-
$subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
|
105 |
-
foreach ( $subdomains_to_check as $subdomain ) {
|
106 |
-
$subdomain = str_replace( '.', '(.)', $subdomain );
|
107 |
-
$subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain );
|
108 |
-
if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) {
|
109 |
-
$is_local_url = true;
|
110 |
-
continue;
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}
|
114 |
-
}
|
115 |
-
return $is_local_url;
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Checks if current admin screen is the plugins page.
|
120 |
-
*
|
121 |
-
* @since 1.0.0
|
122 |
-
* @return bool
|
123 |
-
*/
|
124 |
-
public function is_plugin_page() {
|
125 |
-
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
126 |
-
if ( empty( $screen ) ) {
|
127 |
-
return false;
|
128 |
-
}
|
129 |
-
return ( ! empty( $screen->id ) && in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) );
|
130 |
-
}
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Survey javascript.
|
134 |
-
*
|
135 |
-
* @since 1.0.0
|
136 |
-
*/
|
137 |
-
public function js() {
|
138 |
-
|
139 |
-
if ( ! $this->is_plugin_page() ) {
|
140 |
-
return;
|
141 |
-
}
|
142 |
-
?>
|
143 |
-
<script type="text/javascript">
|
144 |
-
jQuery(function($){
|
145 |
-
var $deactivateLink = $('#the-list').find('[data-slug="<?php echo $this->plugin; ?>"] span.deactivate a'),
|
146 |
-
$overlay = $('#am-deactivate-survey-<?php echo $this->plugin; ?>'),
|
147 |
-
$form = $overlay.find('form'),
|
148 |
-
formOpen = false;
|
149 |
-
// Plugin listing table deactivate link.
|
150 |
-
$deactivateLink.on('click', function(event) {
|
151 |
-
event.preventDefault();
|
152 |
-
$overlay.css('display', 'table');
|
153 |
-
formOpen = true;
|
154 |
-
$form.find('.am-deactivate-survey-option:first-of-type input[type=radio]').focus();
|
155 |
-
});
|
156 |
-
// Survey radio option selected.
|
157 |
-
$form.on('change', 'input[type=radio]', function(event) {
|
158 |
-
event.preventDefault();
|
159 |
-
$form.find('input[type=text], .error').hide();
|
160 |
-
$form.find('.am-deactivate-survey-option').removeClass('selected');
|
161 |
-
$(this).closest('.am-deactivate-survey-option').addClass('selected').find('input[type=text]').show();
|
162 |
-
});
|
163 |
-
// Survey Skip & Deactivate.
|
164 |
-
$form.on('click', '.am-deactivate-survey-deactivate', function(event) {
|
165 |
-
event.preventDefault();
|
166 |
-
location.href = $deactivateLink.attr('href');
|
167 |
-
});
|
168 |
-
// Survey submit.
|
169 |
-
$form.submit(function(event) {
|
170 |
-
event.preventDefault();
|
171 |
-
if (! $form.find('input[type=radio]:checked').val()) {
|
172 |
-
$form.find('.am-deactivate-survey-footer').prepend('<span class="error"><?php echo esc_js( __( 'Please select an option', 'google-analytics-dashboard-for-wp' ) ); ?></span>');
|
173 |
-
return;
|
174 |
-
}
|
175 |
-
var data = {
|
176 |
-
code: $form.find('.selected input[type=radio]').val(),
|
177 |
-
reason: $form.find('.selected .am-deactivate-survey-option-reason').text(),
|
178 |
-
details: $form.find('.selected input[type=text]').val(),
|
179 |
-
site: '<?php echo esc_url( home_url() ); ?>',
|
180 |
-
plugin: '<?php echo sanitize_key( $this->name ); ?>'
|
181 |
-
}
|
182 |
-
var submitSurvey = $.post('<?php echo $this->api_url; ?>', data);
|
183 |
-
submitSurvey.always(function() {
|
184 |
-
location.href = $deactivateLink.attr('href');
|
185 |
-
});
|
186 |
-
});
|
187 |
-
// Exit key closes survey when open.
|
188 |
-
$(document).keyup(function(event) {
|
189 |
-
if (27 === event.keyCode && formOpen) {
|
190 |
-
$overlay.hide();
|
191 |
-
formOpen = false;
|
192 |
-
$deactivateLink.focus();
|
193 |
-
}
|
194 |
-
});
|
195 |
-
});
|
196 |
-
</script>
|
197 |
-
<?php
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Survey CSS.
|
202 |
-
*
|
203 |
-
* @since 1.0.0
|
204 |
-
*/
|
205 |
-
public function css() {
|
206 |
-
|
207 |
-
if ( ! $this->is_plugin_page() ) {
|
208 |
-
return;
|
209 |
-
}
|
210 |
-
?>
|
211 |
-
<style type="text/css">
|
212 |
-
.am-deactivate-survey-modal {
|
213 |
-
display: none;
|
214 |
-
table-layout: fixed;
|
215 |
-
position: fixed;
|
216 |
-
z-index: 9999;
|
217 |
-
width: 100%;
|
218 |
-
height: 100%;
|
219 |
-
text-align: center;
|
220 |
-
font-size: 14px;
|
221 |
-
top: 0;
|
222 |
-
left: 0;
|
223 |
-
background: rgba(0,0,0,0.8);
|
224 |
-
}
|
225 |
-
.am-deactivate-survey-wrap {
|
226 |
-
display: table-cell;
|
227 |
-
vertical-align: middle;
|
228 |
-
}
|
229 |
-
.am-deactivate-survey {
|
230 |
-
background-color: #fff;
|
231 |
-
max-width: 550px;
|
232 |
-
margin: 0 auto;
|
233 |
-
padding: 30px;
|
234 |
-
text-align: left;
|
235 |
-
}
|
236 |
-
.am-deactivate-survey .error {
|
237 |
-
display: block;
|
238 |
-
color: red;
|
239 |
-
margin: 0 0 10px 0;
|
240 |
-
}
|
241 |
-
.am-deactivate-survey-title {
|
242 |
-
display: block;
|
243 |
-
font-size: 18px;
|
244 |
-
font-weight: 700;
|
245 |
-
text-transform: uppercase;
|
246 |
-
border-bottom: 1px solid #ddd;
|
247 |
-
padding: 0 0 18px 0;
|
248 |
-
margin: 0 0 18px 0;
|
249 |
-
}
|
250 |
-
.am-deactivate-survey-title span {
|
251 |
-
color: #999;
|
252 |
-
margin-right: 10px;
|
253 |
-
}
|
254 |
-
.am-deactivate-survey-desc {
|
255 |
-
display: block;
|
256 |
-
font-weight: 600;
|
257 |
-
margin: 0 0 18px 0;
|
258 |
-
}
|
259 |
-
.am-deactivate-survey-option {
|
260 |
-
margin: 0 0 10px 0;
|
261 |
-
}
|
262 |
-
.am-deactivate-survey-option-input {
|
263 |
-
margin-right: 10px !important;
|
264 |
-
}
|
265 |
-
.am-deactivate-survey-option-details {
|
266 |
-
display: none;
|
267 |
-
width: 90%;
|
268 |
-
margin: 10px 0 0 30px;
|
269 |
-
}
|
270 |
-
.am-deactivate-survey-footer {
|
271 |
-
margin-top: 18px;
|
272 |
-
}
|
273 |
-
.am-deactivate-survey-deactivate {
|
274 |
-
float: right;
|
275 |
-
font-size: 13px;
|
276 |
-
color: #ccc;
|
277 |
-
text-decoration: none;
|
278 |
-
padding-top: 7px;
|
279 |
-
}
|
280 |
-
</style>
|
281 |
-
<?php
|
282 |
-
}
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Survey modal.
|
286 |
-
*
|
287 |
-
* @since 1.0.0
|
288 |
-
*/
|
289 |
-
public function modal() {
|
290 |
-
|
291 |
-
if ( ! $this->is_plugin_page() ) {
|
292 |
-
return;
|
293 |
-
}
|
294 |
-
|
295 |
-
$options = array(
|
296 |
-
1 => array(
|
297 |
-
'title' => esc_html__( 'I no longer need the plugin', 'google-analytics-dashboard-for-wp' ),
|
298 |
-
),
|
299 |
-
2 => array(
|
300 |
-
'title' => esc_html__( 'I\'m switching to a different plugin', 'google-analytics-dashboard-for-wp' ),
|
301 |
-
'details' => esc_html__( 'Please share which plugin', 'google-analytics-dashboard-for-wp' ),
|
302 |
-
),
|
303 |
-
3 => array(
|
304 |
-
'title' => esc_html__( 'I couldn\'t get the plugin to work', 'google-analytics-dashboard-for-wp' ),
|
305 |
-
),
|
306 |
-
4 => array(
|
307 |
-
'title' => esc_html__( 'It\'s a temporary deactivation', 'google-analytics-dashboard-for-wp' ),
|
308 |
-
),
|
309 |
-
5 => array(
|
310 |
-
'title' => esc_html__( 'Other', 'google-analytics-dashboard-for-wp' ),
|
311 |
-
'details' => esc_html__( 'Please share the reason', 'google-analytics-dashboard-for-wp' ),
|
312 |
-
),
|
313 |
-
);
|
314 |
-
?>
|
315 |
-
<div class="am-deactivate-survey-modal" id="am-deactivate-survey-<?php echo $this->plugin; ?>">
|
316 |
-
<div class="am-deactivate-survey-wrap">
|
317 |
-
<form class="am-deactivate-survey" method="post">
|
318 |
-
<span class="am-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', 'google-analytics-dashboard-for-wp' ); ?></span>
|
319 |
-
<span class="am-deactivate-survey-desc">
|
320 |
-
<?php
|
321 |
-
// Translators: Placeholder for the plugin name.
|
322 |
-
echo sprintf( esc_html__('If you have a moment, please share why you are deactivating %s:', 'google-analytics-dashboard-for-wp' ), $this->name );
|
323 |
-
?>
|
324 |
-
</span>
|
325 |
-
<div class="am-deactivate-survey-options">
|
326 |
-
<?php foreach ( $options as $id => $option ) : ?>
|
327 |
-
<div class="am-deactivate-survey-option">
|
328 |
-
<label for="am-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="am-deactivate-survey-option-label">
|
329 |
-
<input id="am-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="am-deactivate-survey-option-input" type="radio" name="code" value="<?php echo $id; ?>" />
|
330 |
-
<span class="am-deactivate-survey-option-reason"><?php echo $option['title']; ?></span>
|
331 |
-
</label>
|
332 |
-
<?php if ( ! empty( $option['details'] ) ) : ?>
|
333 |
-
<input class="am-deactivate-survey-option-details" type="text" placeholder="<?php echo $option['details']; ?>" />
|
334 |
-
<?php endif; ?>
|
335 |
-
</div>
|
336 |
-
<?php endforeach; ?>
|
337 |
-
</div>
|
338 |
-
<div class="am-deactivate-survey-footer">
|
339 |
-
<button type="submit" class="am-deactivate-survey-submit button button-primary button-large">
|
340 |
-
<?php
|
341 |
-
// Translators: Adds an ampersand.
|
342 |
-
echo sprintf( esc_html__('Submit %s Deactivate', 'google-analytics-dashboard-for-wp' ), '&' );
|
343 |
-
?>
|
344 |
-
</button>
|
345 |
-
<a href="#" class="am-deactivate-survey-deactivate">
|
346 |
-
<?php
|
347 |
-
// Translators: Adds an ampersand.
|
348 |
-
echo sprintf( esc_html__('Skip %s Deactivate', 'google-analytics-dashboard-for-wp' ), '&' );
|
349 |
-
?>
|
350 |
-
</a>
|
351 |
-
</div>
|
352 |
-
</form>
|
353 |
-
</div>
|
354 |
-
</div>
|
355 |
-
<?php
|
356 |
-
}
|
357 |
-
}
|
358 |
-
} // End if().
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'AM_Deactivation_Survey' ) ) {
|
3 |
+
/**
|
4 |
+
* Awesome Motive Deactivation Survey.
|
5 |
+
*
|
6 |
+
* This prompts the user for more details when they deactivate the plugin.
|
7 |
+
*
|
8 |
+
* @version 1.2.1
|
9 |
+
* @package AwesomeMotive
|
10 |
+
* @author Jared Atchison and Chris Christoff
|
11 |
+
* @license GPL-2.0+
|
12 |
+
* @copyright Copyright (c) 2018
|
13 |
+
*/
|
14 |
+
class AM_Deactivation_Survey {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* The API URL we are calling.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
public $api_url = 'https://api.awesomemotive.com/v1/deactivation-survey/';
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Name for this plugin.
|
26 |
+
*
|
27 |
+
* @since 1.0.0
|
28 |
+
* @var string
|
29 |
+
*/
|
30 |
+
public $name;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Unique slug for this plugin.
|
34 |
+
*
|
35 |
+
* @since 1.0.0
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
public $plugin;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Primary class constructor.
|
42 |
+
*
|
43 |
+
* @since 1.0.0
|
44 |
+
* @param string $name Plugin name.
|
45 |
+
* @param string $plugin Plugin slug.
|
46 |
+
*/
|
47 |
+
public function __construct( $name = '', $plugin = '' ) {
|
48 |
+
|
49 |
+
$this->name = $name;
|
50 |
+
$this->plugin = $plugin;
|
51 |
+
|
52 |
+
// Don't run deactivation survey on dev sites.
|
53 |
+
if ( $this->is_dev_url() ) {
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
add_action( 'admin_print_scripts', array( $this, 'js' ), 20 );
|
58 |
+
add_action( 'admin_print_scripts', array( $this, 'css' ) );
|
59 |
+
add_action( 'admin_footer', array( $this, 'modal' ) );
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Checks if current site is a development one.
|
64 |
+
*
|
65 |
+
* @since 1.2.0
|
66 |
+
* @return bool
|
67 |
+
*/
|
68 |
+
public function is_dev_url() {
|
69 |
+
// If it is an AM dev site, return false, so we can see them on our dev sites.
|
70 |
+
if ( defined ('AWESOMEMOTIVE_DEV_MODE' ) && AWESOMEMOTIVE_DEV_MODE ) {
|
71 |
+
return false;
|
72 |
+
}
|
73 |
+
|
74 |
+
$url = network_site_url( '/' );
|
75 |
+
$is_local_url = false;
|
76 |
+
|
77 |
+
// Trim it up
|
78 |
+
$url = strtolower( trim( $url ) );
|
79 |
+
|
80 |
+
// Need to get the host...so let's add the scheme so we can use parse_url
|
81 |
+
if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) {
|
82 |
+
$url = 'http://' . $url;
|
83 |
+
}
|
84 |
+
$url_parts = parse_url( $url );
|
85 |
+
$host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false;
|
86 |
+
if ( ! empty( $url ) && ! empty( $host ) ) {
|
87 |
+
if ( false !== ip2long( $host ) ) {
|
88 |
+
if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) {
|
89 |
+
$is_local_url = true;
|
90 |
+
}
|
91 |
+
} else if ( 'localhost' === $host ) {
|
92 |
+
$is_local_url = true;
|
93 |
+
}
|
94 |
+
|
95 |
+
$tlds_to_check = array( '.dev', '.local', ':8888' );
|
96 |
+
foreach ( $tlds_to_check as $tld ) {
|
97 |
+
if ( false !== strpos( $host, $tld ) ) {
|
98 |
+
$is_local_url = true;
|
99 |
+
continue;
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
if ( substr_count( $host, '.' ) > 1 ) {
|
104 |
+
$subdomains_to_check = array( 'dev.', '*.staging.', 'beta.', 'test.' );
|
105 |
+
foreach ( $subdomains_to_check as $subdomain ) {
|
106 |
+
$subdomain = str_replace( '.', '(.)', $subdomain );
|
107 |
+
$subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain );
|
108 |
+
if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) {
|
109 |
+
$is_local_url = true;
|
110 |
+
continue;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
return $is_local_url;
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Checks if current admin screen is the plugins page.
|
120 |
+
*
|
121 |
+
* @since 1.0.0
|
122 |
+
* @return bool
|
123 |
+
*/
|
124 |
+
public function is_plugin_page() {
|
125 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
126 |
+
if ( empty( $screen ) ) {
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
return ( ! empty( $screen->id ) && in_array( $screen->id, array( 'plugins', 'plugins-network' ), true ) );
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Survey javascript.
|
134 |
+
*
|
135 |
+
* @since 1.0.0
|
136 |
+
*/
|
137 |
+
public function js() {
|
138 |
+
|
139 |
+
if ( ! $this->is_plugin_page() ) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
<script type="text/javascript">
|
144 |
+
jQuery(function($){
|
145 |
+
var $deactivateLink = $('#the-list').find('[data-slug="<?php echo $this->plugin; ?>"] span.deactivate a'),
|
146 |
+
$overlay = $('#am-deactivate-survey-<?php echo $this->plugin; ?>'),
|
147 |
+
$form = $overlay.find('form'),
|
148 |
+
formOpen = false;
|
149 |
+
// Plugin listing table deactivate link.
|
150 |
+
$deactivateLink.on('click', function(event) {
|
151 |
+
event.preventDefault();
|
152 |
+
$overlay.css('display', 'table');
|
153 |
+
formOpen = true;
|
154 |
+
$form.find('.am-deactivate-survey-option:first-of-type input[type=radio]').focus();
|
155 |
+
});
|
156 |
+
// Survey radio option selected.
|
157 |
+
$form.on('change', 'input[type=radio]', function(event) {
|
158 |
+
event.preventDefault();
|
159 |
+
$form.find('input[type=text], .error').hide();
|
160 |
+
$form.find('.am-deactivate-survey-option').removeClass('selected');
|
161 |
+
$(this).closest('.am-deactivate-survey-option').addClass('selected').find('input[type=text]').show();
|
162 |
+
});
|
163 |
+
// Survey Skip & Deactivate.
|
164 |
+
$form.on('click', '.am-deactivate-survey-deactivate', function(event) {
|
165 |
+
event.preventDefault();
|
166 |
+
location.href = $deactivateLink.attr('href');
|
167 |
+
});
|
168 |
+
// Survey submit.
|
169 |
+
$form.submit(function(event) {
|
170 |
+
event.preventDefault();
|
171 |
+
if (! $form.find('input[type=radio]:checked').val()) {
|
172 |
+
$form.find('.am-deactivate-survey-footer').prepend('<span class="error"><?php echo esc_js( __( 'Please select an option', 'google-analytics-dashboard-for-wp' ) ); ?></span>');
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
var data = {
|
176 |
+
code: $form.find('.selected input[type=radio]').val(),
|
177 |
+
reason: $form.find('.selected .am-deactivate-survey-option-reason').text(),
|
178 |
+
details: $form.find('.selected input[type=text]').val(),
|
179 |
+
site: '<?php echo esc_url( home_url() ); ?>',
|
180 |
+
plugin: '<?php echo sanitize_key( $this->name ); ?>'
|
181 |
+
}
|
182 |
+
var submitSurvey = $.post('<?php echo $this->api_url; ?>', data);
|
183 |
+
submitSurvey.always(function() {
|
184 |
+
location.href = $deactivateLink.attr('href');
|
185 |
+
});
|
186 |
+
});
|
187 |
+
// Exit key closes survey when open.
|
188 |
+
$(document).keyup(function(event) {
|
189 |
+
if (27 === event.keyCode && formOpen) {
|
190 |
+
$overlay.hide();
|
191 |
+
formOpen = false;
|
192 |
+
$deactivateLink.focus();
|
193 |
+
}
|
194 |
+
});
|
195 |
+
});
|
196 |
+
</script>
|
197 |
+
<?php
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Survey CSS.
|
202 |
+
*
|
203 |
+
* @since 1.0.0
|
204 |
+
*/
|
205 |
+
public function css() {
|
206 |
+
|
207 |
+
if ( ! $this->is_plugin_page() ) {
|
208 |
+
return;
|
209 |
+
}
|
210 |
+
?>
|
211 |
+
<style type="text/css">
|
212 |
+
.am-deactivate-survey-modal {
|
213 |
+
display: none;
|
214 |
+
table-layout: fixed;
|
215 |
+
position: fixed;
|
216 |
+
z-index: 9999;
|
217 |
+
width: 100%;
|
218 |
+
height: 100%;
|
219 |
+
text-align: center;
|
220 |
+
font-size: 14px;
|
221 |
+
top: 0;
|
222 |
+
left: 0;
|
223 |
+
background: rgba(0,0,0,0.8);
|
224 |
+
}
|
225 |
+
.am-deactivate-survey-wrap {
|
226 |
+
display: table-cell;
|
227 |
+
vertical-align: middle;
|
228 |
+
}
|
229 |
+
.am-deactivate-survey {
|
230 |
+
background-color: #fff;
|
231 |
+
max-width: 550px;
|
232 |
+
margin: 0 auto;
|
233 |
+
padding: 30px;
|
234 |
+
text-align: left;
|
235 |
+
}
|
236 |
+
.am-deactivate-survey .error {
|
237 |
+
display: block;
|
238 |
+
color: red;
|
239 |
+
margin: 0 0 10px 0;
|
240 |
+
}
|
241 |
+
.am-deactivate-survey-title {
|
242 |
+
display: block;
|
243 |
+
font-size: 18px;
|
244 |
+
font-weight: 700;
|
245 |
+
text-transform: uppercase;
|
246 |
+
border-bottom: 1px solid #ddd;
|
247 |
+
padding: 0 0 18px 0;
|
248 |
+
margin: 0 0 18px 0;
|
249 |
+
}
|
250 |
+
.am-deactivate-survey-title span {
|
251 |
+
color: #999;
|
252 |
+
margin-right: 10px;
|
253 |
+
}
|
254 |
+
.am-deactivate-survey-desc {
|
255 |
+
display: block;
|
256 |
+
font-weight: 600;
|
257 |
+
margin: 0 0 18px 0;
|
258 |
+
}
|
259 |
+
.am-deactivate-survey-option {
|
260 |
+
margin: 0 0 10px 0;
|
261 |
+
}
|
262 |
+
.am-deactivate-survey-option-input {
|
263 |
+
margin-right: 10px !important;
|
264 |
+
}
|
265 |
+
.am-deactivate-survey-option-details {
|
266 |
+
display: none;
|
267 |
+
width: 90%;
|
268 |
+
margin: 10px 0 0 30px;
|
269 |
+
}
|
270 |
+
.am-deactivate-survey-footer {
|
271 |
+
margin-top: 18px;
|
272 |
+
}
|
273 |
+
.am-deactivate-survey-deactivate {
|
274 |
+
float: right;
|
275 |
+
font-size: 13px;
|
276 |
+
color: #ccc;
|
277 |
+
text-decoration: none;
|
278 |
+
padding-top: 7px;
|
279 |
+
}
|
280 |
+
</style>
|
281 |
+
<?php
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Survey modal.
|
286 |
+
*
|
287 |
+
* @since 1.0.0
|
288 |
+
*/
|
289 |
+
public function modal() {
|
290 |
+
|
291 |
+
if ( ! $this->is_plugin_page() ) {
|
292 |
+
return;
|
293 |
+
}
|
294 |
+
|
295 |
+
$options = array(
|
296 |
+
1 => array(
|
297 |
+
'title' => esc_html__( 'I no longer need the plugin', 'google-analytics-dashboard-for-wp' ),
|
298 |
+
),
|
299 |
+
2 => array(
|
300 |
+
'title' => esc_html__( 'I\'m switching to a different plugin', 'google-analytics-dashboard-for-wp' ),
|
301 |
+
'details' => esc_html__( 'Please share which plugin', 'google-analytics-dashboard-for-wp' ),
|
302 |
+
),
|
303 |
+
3 => array(
|
304 |
+
'title' => esc_html__( 'I couldn\'t get the plugin to work', 'google-analytics-dashboard-for-wp' ),
|
305 |
+
),
|
306 |
+
4 => array(
|
307 |
+
'title' => esc_html__( 'It\'s a temporary deactivation', 'google-analytics-dashboard-for-wp' ),
|
308 |
+
),
|
309 |
+
5 => array(
|
310 |
+
'title' => esc_html__( 'Other', 'google-analytics-dashboard-for-wp' ),
|
311 |
+
'details' => esc_html__( 'Please share the reason', 'google-analytics-dashboard-for-wp' ),
|
312 |
+
),
|
313 |
+
);
|
314 |
+
?>
|
315 |
+
<div class="am-deactivate-survey-modal" id="am-deactivate-survey-<?php echo $this->plugin; ?>">
|
316 |
+
<div class="am-deactivate-survey-wrap">
|
317 |
+
<form class="am-deactivate-survey" method="post">
|
318 |
+
<span class="am-deactivate-survey-title"><span class="dashicons dashicons-testimonial"></span><?php echo ' ' . esc_html__( 'Quick Feedback', 'google-analytics-dashboard-for-wp' ); ?></span>
|
319 |
+
<span class="am-deactivate-survey-desc">
|
320 |
+
<?php
|
321 |
+
// Translators: Placeholder for the plugin name.
|
322 |
+
echo sprintf( esc_html__('If you have a moment, please share why you are deactivating %s:', 'google-analytics-dashboard-for-wp' ), $this->name );
|
323 |
+
?>
|
324 |
+
</span>
|
325 |
+
<div class="am-deactivate-survey-options">
|
326 |
+
<?php foreach ( $options as $id => $option ) : ?>
|
327 |
+
<div class="am-deactivate-survey-option">
|
328 |
+
<label for="am-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="am-deactivate-survey-option-label">
|
329 |
+
<input id="am-deactivate-survey-option-<?php echo $this->plugin; ?>-<?php echo $id; ?>" class="am-deactivate-survey-option-input" type="radio" name="code" value="<?php echo $id; ?>" />
|
330 |
+
<span class="am-deactivate-survey-option-reason"><?php echo $option['title']; ?></span>
|
331 |
+
</label>
|
332 |
+
<?php if ( ! empty( $option['details'] ) ) : ?>
|
333 |
+
<input class="am-deactivate-survey-option-details" type="text" placeholder="<?php echo $option['details']; ?>" />
|
334 |
+
<?php endif; ?>
|
335 |
+
</div>
|
336 |
+
<?php endforeach; ?>
|
337 |
+
</div>
|
338 |
+
<div class="am-deactivate-survey-footer">
|
339 |
+
<button type="submit" class="am-deactivate-survey-submit button button-primary button-large">
|
340 |
+
<?php
|
341 |
+
// Translators: Adds an ampersand.
|
342 |
+
echo sprintf( esc_html__('Submit %s Deactivate', 'google-analytics-dashboard-for-wp' ), '&' );
|
343 |
+
?>
|
344 |
+
</button>
|
345 |
+
<a href="#" class="am-deactivate-survey-deactivate">
|
346 |
+
<?php
|
347 |
+
// Translators: Adds an ampersand.
|
348 |
+
echo sprintf( esc_html__('Skip %s Deactivate', 'google-analytics-dashboard-for-wp' ), '&' );
|
349 |
+
?>
|
350 |
+
</a>
|
351 |
+
</div>
|
352 |
+
</form>
|
353 |
+
</div>
|
354 |
+
</div>
|
355 |
+
<?php
|
356 |
+
}
|
357 |
+
}
|
358 |
+
} // End if().
|
gadwp.php
CHANGED
@@ -1,800 +1,786 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Google Analytics Dashboard for WP (GADWP)
|
4 |
-
* Plugin URI: https://exactmetrics.com
|
5 |
-
* Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
|
6 |
-
* Author: ExactMetrics
|
7 |
-
* Version:
|
8 |
-
* Requires at least:
|
9 |
-
* Requires PHP: 5.
|
10 |
-
* Author URI: https://exactmetrics.com
|
11 |
-
* Text Domain: google-analytics-dashboard-for-wp
|
12 |
-
* Domain Path: /languages
|
13 |
-
*/
|
14 |
-
|
15 |
-
// Exit if accessed directly.
|
16 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
-
exit;
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Main plugin class.
|
22 |
-
*
|
23 |
-
* @since 6.0.0
|
24 |
-
*
|
25 |
-
* @package ExactMetrics
|
26 |
-
* @author Chris Christoff
|
27 |
-
* @access public
|
28 |
-
*/
|
29 |
-
final class ExactMetrics_Lite {
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Holds the class object.
|
33 |
-
*
|
34 |
-
* @since 6.0.0
|
35 |
-
* @access public
|
36 |
-
* @var object Instance of instantiated ExactMetrics class.
|
37 |
-
*/
|
38 |
-
public static $instance;
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Plugin version, used for cache-busting of style and script file references.
|
42 |
-
*
|
43 |
-
* @since 6.0.0
|
44 |
-
* @access public
|
45 |
-
* @var string $version Plugin version.
|
46 |
-
*/
|
47 |
-
public $version = '
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Plugin file.
|
51 |
-
*
|
52 |
-
* @since 6.0.0
|
53 |
-
* @access public
|
54 |
-
* @var string $file PHP File constant for main file.
|
55 |
-
*/
|
56 |
-
public $file;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* The name of the plugin.
|
60 |
-
*
|
61 |
-
* @since 6.0.0
|
62 |
-
* @access public
|
63 |
-
* @var string $plugin_name Plugin name.
|
64 |
-
*/
|
65 |
-
public $plugin_name = 'ExactMetrics Lite';
|
66 |
-
|
67 |
-
/**
|
68 |
-
* Unique plugin slug identifier.
|
69 |
-
*
|
70 |
-
* @since 6.0.0
|
71 |
-
* @access public
|
72 |
-
* @var string $plugin_slug Plugin slug.
|
73 |
-
*/
|
74 |
-
public $plugin_slug = 'exactmetrics-lite';
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Holds instance of ExactMetrics License class.
|
78 |
-
*
|
79 |
-
* @since 6.0.0
|
80 |
-
* @access public
|
81 |
-
* @var ExactMetrics_License $license Instance of License class.
|
82 |
-
*/
|
83 |
-
protected $license;
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Holds instance of ExactMetrics Admin Notice class.
|
87 |
-
*
|
88 |
-
* @since 6.0.0
|
89 |
-
* @access public
|
90 |
-
* @var ExactMetrics_Admin_Notice $notices Instance of Admin Notice class.
|
91 |
-
*/
|
92 |
-
public $notices;
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Holds instance of ExactMetrics Notifications class.
|
96 |
-
*
|
97 |
-
* @since 6.1
|
98 |
-
* @access public
|
99 |
-
* @var ExactMetrics_Notifications $notifications Instance of Notifications class.
|
100 |
-
*/
|
101 |
-
public $notifications;
|
102 |
-
|
103 |
-
/**
|
104 |
-
* Holds instance of ExactMetrics Notification Events
|
105 |
-
*
|
106 |
-
* @since 6.2.3
|
107 |
-
* @access public
|
108 |
-
* @var ExactMetrics_Notification_Event $notification_event Instance of ExactMetrics_Notification_Event class.
|
109 |
-
*/
|
110 |
-
public $notification_event;
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Holds instance of ExactMetrics Reporting class.
|
114 |
-
*
|
115 |
-
* @since 6.0.0
|
116 |
-
* @access public
|
117 |
-
* @var ExactMetrics_Reporting $reporting Instance of Reporting class.
|
118 |
-
*/
|
119 |
-
public $reporting;
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Holds instance of ExactMetrics Auth class.
|
123 |
-
*
|
124 |
-
* @since 6.0.0
|
125 |
-
* @access public
|
126 |
-
* @var ExactMetrics_Auth $auth Instance of Auth class.
|
127 |
-
*/
|
128 |
-
protected $auth;
|
129 |
-
|
130 |
-
/**
|
131 |
-
* Holds instance of ExactMetrics API Auth class.
|
132 |
-
*
|
133 |
-
* @since 6.0.0
|
134 |
-
* @access public
|
135 |
-
* @var ExactMetrics_Auth $api_auth Instance of APIAuth class.
|
136 |
-
*/
|
137 |
-
public $api_auth;
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Holds instance of ExactMetrics API Rest Routes class.
|
141 |
-
*
|
142 |
-
* @since 6.0.0
|
143 |
-
* @access public
|
144 |
-
* @var ExactMetrics_Rest_Routes $routes Instance of rest routes.
|
145 |
-
*/
|
146 |
-
public $routes;
|
147 |
-
|
148 |
-
/**
|
149 |
-
* The tracking mode used in the frontend.
|
150 |
-
*
|
151 |
-
* @since 7.15.0
|
152 |
-
* @accces public
|
153 |
-
* @var string
|
154 |
-
*/
|
155 |
-
public $tracking_mode;
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Primary class constructor.
|
159 |
-
*
|
160 |
-
* @since 6.0.0
|
161 |
-
* @access public
|
162 |
-
*/
|
163 |
-
public function __construct() {
|
164 |
-
// We don't use this
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Returns the singleton instance of the class.
|
169 |
-
*
|
170 |
-
* @access public
|
171 |
-
* @since 6.0.0
|
172 |
-
*
|
173 |
-
* @return object The ExactMetrics_Lite object.
|
174 |
-
*/
|
175 |
-
public static function get_instance() {
|
176 |
-
|
177 |
-
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof ExactMetrics_Lite ) ) {
|
178 |
-
self::$instance = new ExactMetrics_Lite();
|
179 |
-
self::$instance->file = __FILE__;
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
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 |
-
if (
|
213 |
-
|
214 |
-
}
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
self::$instance->
|
226 |
-
self::$instance->
|
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 |
-
|
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 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
*
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
*
|
465 |
-
*
|
466 |
-
*
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
*
|
482 |
-
*
|
483 |
-
* @
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
require_once EXACTMETRICS_PLUGIN_DIR . '
|
508 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
509 |
-
|
510 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
511 |
-
|
512 |
-
|
513 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
514 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
515 |
-
|
516 |
-
//
|
517 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
518 |
-
|
519 |
-
|
520 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/
|
527 |
-
|
528 |
-
//
|
529 |
-
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
//
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
//
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
*
|
692 |
-
*
|
693 |
-
*
|
694 |
-
*
|
695 |
-
*
|
696 |
-
*
|
697 |
-
* @
|
698 |
-
*
|
699 |
-
*
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
*
|
760 |
-
*
|
761 |
-
*
|
762 |
-
*
|
763 |
-
*
|
764 |
-
*
|
765 |
-
*
|
766 |
-
*
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
*
|
774 |
-
*
|
775 |
-
*
|
776 |
-
*
|
777 |
-
*
|
778 |
-
*
|
779 |
-
*
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
*
|
788 |
-
* @since 6.0.0
|
789 |
-
*
|
790 |
-
* @uses ExactMetrics::get_instance() Retrieve ExactMetrics Pro instance.
|
791 |
-
* @uses ExactMetrics_Lite::get_instance() Retrieve ExactMetrics Lite instance.
|
792 |
-
*
|
793 |
-
* @return ExactMetrics The singleton ExactMetrics instance.
|
794 |
-
*/
|
795 |
-
if ( ! function_exists( 'ExactMetrics' ) ) {
|
796 |
-
function ExactMetrics() {
|
797 |
-
return ( class_exists( 'ExactMetrics' ) ? ExactMetrics_Pro() : ExactMetrics_Lite() );
|
798 |
-
}
|
799 |
-
add_action( 'plugins_loaded', 'ExactMetrics' );
|
800 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Google Analytics Dashboard for WP (GADWP)
|
4 |
+
* Plugin URI: https://exactmetrics.com
|
5 |
+
* Description: Displays Google Analytics Reports and Real-Time Statistics in your Dashboard. Automatically inserts the tracking code in every page of your website.
|
6 |
+
* Author: ExactMetrics
|
7 |
+
* Version: 7.1.0
|
8 |
+
* Requires at least: 4.8.0
|
9 |
+
* Requires PHP: 5.5
|
10 |
+
* Author URI: https://exactmetrics.com
|
11 |
+
* Text Domain: google-analytics-dashboard-for-wp
|
12 |
+
* Domain Path: /languages
|
13 |
+
*/
|
14 |
+
|
15 |
+
// Exit if accessed directly.
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
+
exit;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Main plugin class.
|
22 |
+
*
|
23 |
+
* @since 6.0.0
|
24 |
+
*
|
25 |
+
* @package ExactMetrics
|
26 |
+
* @author Chris Christoff
|
27 |
+
* @access public
|
28 |
+
*/
|
29 |
+
final class ExactMetrics_Lite {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Holds the class object.
|
33 |
+
*
|
34 |
+
* @since 6.0.0
|
35 |
+
* @access public
|
36 |
+
* @var object Instance of instantiated ExactMetrics class.
|
37 |
+
*/
|
38 |
+
public static $instance;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Plugin version, used for cache-busting of style and script file references.
|
42 |
+
*
|
43 |
+
* @since 6.0.0
|
44 |
+
* @access public
|
45 |
+
* @var string $version Plugin version.
|
46 |
+
*/
|
47 |
+
public $version = '7.1.0';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Plugin file.
|
51 |
+
*
|
52 |
+
* @since 6.0.0
|
53 |
+
* @access public
|
54 |
+
* @var string $file PHP File constant for main file.
|
55 |
+
*/
|
56 |
+
public $file;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* The name of the plugin.
|
60 |
+
*
|
61 |
+
* @since 6.0.0
|
62 |
+
* @access public
|
63 |
+
* @var string $plugin_name Plugin name.
|
64 |
+
*/
|
65 |
+
public $plugin_name = 'ExactMetrics Lite';
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Unique plugin slug identifier.
|
69 |
+
*
|
70 |
+
* @since 6.0.0
|
71 |
+
* @access public
|
72 |
+
* @var string $plugin_slug Plugin slug.
|
73 |
+
*/
|
74 |
+
public $plugin_slug = 'exactmetrics-lite';
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Holds instance of ExactMetrics License class.
|
78 |
+
*
|
79 |
+
* @since 6.0.0
|
80 |
+
* @access public
|
81 |
+
* @var ExactMetrics_License $license Instance of License class.
|
82 |
+
*/
|
83 |
+
protected $license;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Holds instance of ExactMetrics Admin Notice class.
|
87 |
+
*
|
88 |
+
* @since 6.0.0
|
89 |
+
* @access public
|
90 |
+
* @var ExactMetrics_Admin_Notice $notices Instance of Admin Notice class.
|
91 |
+
*/
|
92 |
+
public $notices;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Holds instance of ExactMetrics Notifications class.
|
96 |
+
*
|
97 |
+
* @since 6.1
|
98 |
+
* @access public
|
99 |
+
* @var ExactMetrics_Notifications $notifications Instance of Notifications class.
|
100 |
+
*/
|
101 |
+
public $notifications;
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Holds instance of ExactMetrics Notification Events
|
105 |
+
*
|
106 |
+
* @since 6.2.3
|
107 |
+
* @access public
|
108 |
+
* @var ExactMetrics_Notification_Event $notification_event Instance of ExactMetrics_Notification_Event class.
|
109 |
+
*/
|
110 |
+
public $notification_event;
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Holds instance of ExactMetrics Reporting class.
|
114 |
+
*
|
115 |
+
* @since 6.0.0
|
116 |
+
* @access public
|
117 |
+
* @var ExactMetrics_Reporting $reporting Instance of Reporting class.
|
118 |
+
*/
|
119 |
+
public $reporting;
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Holds instance of ExactMetrics Auth class.
|
123 |
+
*
|
124 |
+
* @since 6.0.0
|
125 |
+
* @access public
|
126 |
+
* @var ExactMetrics_Auth $auth Instance of Auth class.
|
127 |
+
*/
|
128 |
+
protected $auth;
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Holds instance of ExactMetrics API Auth class.
|
132 |
+
*
|
133 |
+
* @since 6.0.0
|
134 |
+
* @access public
|
135 |
+
* @var ExactMetrics_Auth $api_auth Instance of APIAuth class.
|
136 |
+
*/
|
137 |
+
public $api_auth;
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Holds instance of ExactMetrics API Rest Routes class.
|
141 |
+
*
|
142 |
+
* @since 6.0.0
|
143 |
+
* @access public
|
144 |
+
* @var ExactMetrics_Rest_Routes $routes Instance of rest routes.
|
145 |
+
*/
|
146 |
+
public $routes;
|
147 |
+
|
148 |
+
/**
|
149 |
+
* The tracking mode used in the frontend.
|
150 |
+
*
|
151 |
+
* @since 7.15.0
|
152 |
+
* @accces public
|
153 |
+
* @var string
|
154 |
+
*/
|
155 |
+
public $tracking_mode;
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Primary class constructor.
|
159 |
+
*
|
160 |
+
* @since 6.0.0
|
161 |
+
* @access public
|
162 |
+
*/
|
163 |
+
public function __construct() {
|
164 |
+
// We don't use this
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* Returns the singleton instance of the class.
|
169 |
+
*
|
170 |
+
* @access public
|
171 |
+
* @since 6.0.0
|
172 |
+
*
|
173 |
+
* @return object The ExactMetrics_Lite object.
|
174 |
+
*/
|
175 |
+
public static function get_instance() {
|
176 |
+
|
177 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof ExactMetrics_Lite ) ) {
|
178 |
+
self::$instance = new ExactMetrics_Lite();
|
179 |
+
self::$instance->file = __FILE__;
|
180 |
+
|
181 |
+
// Detect Pro version and return early
|
182 |
+
if ( defined( 'EXACTMETRICS_PRO_VERSION' ) ) {
|
183 |
+
add_action( 'admin_notices', array( self::$instance, 'exactmetrics_pro_notice' ) );
|
184 |
+
return self::$instance;
|
185 |
+
}
|
186 |
+
|
187 |
+
if ( ! self::$instance->check_compatibility() ) {
|
188 |
+
return self::$instance;
|
189 |
+
}
|
190 |
+
|
191 |
+
// Define constants
|
192 |
+
self::$instance->define_globals();
|
193 |
+
|
194 |
+
// Load in settings
|
195 |
+
self::$instance->load_settings();
|
196 |
+
|
197 |
+
// Load in Licensing
|
198 |
+
self::$instance->load_licensing();
|
199 |
+
|
200 |
+
// Load in Auth
|
201 |
+
self::$instance->load_auth();
|
202 |
+
|
203 |
+
// Load files
|
204 |
+
self::$instance->require_files();
|
205 |
+
|
206 |
+
// This does the version to version background upgrade routines and initial install
|
207 |
+
$em_version = get_option( 'exactmetrics_current_version', '5.5.3' );
|
208 |
+
if ( version_compare( $em_version, '6.5.0', '<' ) ) {
|
209 |
+
exactmetrics_lite_call_install_and_upgrade();
|
210 |
+
}
|
211 |
+
|
212 |
+
if ( is_admin() ) {
|
213 |
+
new AM_Deactivation_Survey( 'ExactMetrics', 'google-analytics-dashboard-for-wp' );
|
214 |
+
}
|
215 |
+
|
216 |
+
// Load the plugin textdomain.
|
217 |
+
add_action( 'plugins_loaded', array( self::$instance, 'load_plugin_textdomain' ), 15 );
|
218 |
+
|
219 |
+
// Load admin only components.
|
220 |
+
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
221 |
+
self::$instance->notices = new ExactMetrics_Notice_Admin();
|
222 |
+
self::$instance->reporting = new ExactMetrics_Reporting();
|
223 |
+
self::$instance->api_auth = new ExactMetrics_API_Auth();
|
224 |
+
self::$instance->routes = new ExactMetrics_Rest_Routes();
|
225 |
+
self::$instance->notifications = new ExactMetrics_Notifications();
|
226 |
+
self::$instance->notification_event = new ExactMetrics_Notification_Event();
|
227 |
+
}
|
228 |
+
|
229 |
+
if ( exactmetrics_is_pro_version() ) {
|
230 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'pro/includes/load.php';
|
231 |
+
} else {
|
232 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'lite/includes/load.php';
|
233 |
+
}
|
234 |
+
|
235 |
+
// Run hook to load ExactMetrics addons.
|
236 |
+
do_action( 'exactmetrics_load_plugins' ); // the updater class for each addon needs to be instantiated via `exactmetrics_updater`
|
237 |
+
}
|
238 |
+
|
239 |
+
return self::$instance;
|
240 |
+
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Throw error on object clone
|
245 |
+
*
|
246 |
+
* The whole idea of the singleton design pattern is that there is a single
|
247 |
+
* object therefore, we don't want the object to be cloned.
|
248 |
+
*
|
249 |
+
* @since 6.0.0
|
250 |
+
* @access public
|
251 |
+
*
|
252 |
+
* @return void
|
253 |
+
*/
|
254 |
+
public function __clone() {
|
255 |
+
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'google-analytics-dashboard-for-wp' ), '6.0.0' );
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Disable unserializing of the class
|
260 |
+
*
|
261 |
+
* Attempting to wakeup an ExactMetrics instance will throw a doing it wrong notice.
|
262 |
+
*
|
263 |
+
* @since 6.0.0
|
264 |
+
* @access public
|
265 |
+
*
|
266 |
+
* @return void
|
267 |
+
*/
|
268 |
+
public function __wakeup() {
|
269 |
+
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'google-analytics-dashboard-for-wp' ), '6.0.0' );
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Magic get function.
|
274 |
+
*
|
275 |
+
* We use this to lazy load certain functionality. Right now used to lazyload
|
276 |
+
* the API & Auth frontend, so it's only loaded if user is using a plugin
|
277 |
+
* that requires it.
|
278 |
+
*
|
279 |
+
* @since 6.0.0
|
280 |
+
* @access public
|
281 |
+
*
|
282 |
+
* @return void
|
283 |
+
*/
|
284 |
+
public function __get( $key ) {
|
285 |
+
if ( $key === 'auth' ) {
|
286 |
+
if ( empty( self::$instance->auth ) ) {
|
287 |
+
// LazyLoad Auth for Frontend
|
288 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/auth.php';
|
289 |
+
self::$instance->auth = new ExactMetrics_Auth();
|
290 |
+
}
|
291 |
+
return self::$instance->$key;
|
292 |
+
} else {
|
293 |
+
return self::$instance->$key;
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Check compatibility with PHP and WP, and display notices if necessary
|
299 |
+
*
|
300 |
+
* @since 7.0.0
|
301 |
+
* @return bool
|
302 |
+
*/
|
303 |
+
private function check_compatibility() {
|
304 |
+
if ( defined( 'EXACTMETRICS_FORCE_ACTIVATION' ) && EXACTMETRICS_FORCE_ACTIVATION ) {
|
305 |
+
return true;
|
306 |
+
}
|
307 |
+
|
308 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/compatibility-check.php';
|
309 |
+
$compatibility = ExactMetrics_Compatibility_Check::get_instance();
|
310 |
+
$compatibility->maybe_display_notice();
|
311 |
+
|
312 |
+
return $compatibility->is_php_compatible() && $compatibility->is_wp_compatible();
|
313 |
+
}
|
314 |
+
|
315 |
+
/**
|
316 |
+
* Define ExactMetrics constants.
|
317 |
+
*
|
318 |
+
* This function defines all of the ExactMetrics PHP constants.
|
319 |
+
*
|
320 |
+
* @since 6.0.0
|
321 |
+
* @access public
|
322 |
+
*
|
323 |
+
* @return void
|
324 |
+
*/
|
325 |
+
public function define_globals() {
|
326 |
+
|
327 |
+
if ( ! defined( 'EXACTMETRICS_VERSION' ) ) {
|
328 |
+
define( 'EXACTMETRICS_VERSION', $this->version );
|
329 |
+
}
|
330 |
+
|
331 |
+
if ( ! defined( 'EXACTMETRICS_LITE_VERSION' ) ) {
|
332 |
+
define( 'EXACTMETRICS_LITE_VERSION', EXACTMETRICS_VERSION );
|
333 |
+
}
|
334 |
+
|
335 |
+
if ( ! defined( 'EXACTMETRICS_PLUGIN_NAME' ) ) {
|
336 |
+
define( 'EXACTMETRICS_PLUGIN_NAME', $this->plugin_name );
|
337 |
+
}
|
338 |
+
|
339 |
+
if ( ! defined( 'EXACTMETRICS_PLUGIN_SLUG' ) ) {
|
340 |
+
define( 'EXACTMETRICS_PLUGIN_SLUG', $this->plugin_slug );
|
341 |
+
}
|
342 |
+
|
343 |
+
if ( ! defined( 'EXACTMETRICS_PLUGIN_FILE' ) ) {
|
344 |
+
define( 'EXACTMETRICS_PLUGIN_FILE', $this->file );
|
345 |
+
}
|
346 |
+
|
347 |
+
if ( ! defined( 'EXACTMETRICS_PLUGIN_DIR' ) ) {
|
348 |
+
define( 'EXACTMETRICS_PLUGIN_DIR', plugin_dir_path( $this->file ) );
|
349 |
+
}
|
350 |
+
|
351 |
+
if ( ! defined( 'EXACTMETRICS_PLUGIN_URL' ) ) {
|
352 |
+
define( 'EXACTMETRICS_PLUGIN_URL', plugin_dir_url( $this->file ) );
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Loads the plugin textdomain for translation.
|
358 |
+
*
|
359 |
+
* @access public
|
360 |
+
* @since 6.0.0
|
361 |
+
*
|
362 |
+
* @return void
|
363 |
+
*/
|
364 |
+
public function load_plugin_textdomain() {
|
365 |
+
|
366 |
+
$mi_locale = get_locale();
|
367 |
+
if ( function_exists( 'get_user_locale' ) ) {
|
368 |
+
$mi_locale = get_user_locale();
|
369 |
+
}
|
370 |
+
|
371 |
+
// Traditional WordPress plugin locale filter.
|
372 |
+
$mi_locale = apply_filters( 'plugin_locale', $mi_locale, 'google-analytics-dashboard-for-wp' );
|
373 |
+
$mi_mofile = sprintf( '%1$s-%2$s.mo', 'google-analytics-dashboard-for-wp', $mi_locale );
|
374 |
+
|
375 |
+
// Look for wp-content/languages/google-analytics-dashboard-for-wp/google-analytics-dashboard-for-wp-{lang}_{country}.mo
|
376 |
+
$mi_mofile1 = WP_LANG_DIR . '/google-analytics-dashboard-for-wp/' . $mi_mofile;
|
377 |
+
|
378 |
+
// Look in wp-content/languages/plugins/google-analytics-dashboard-for-wp/google-analytics-dashboard-for-wp-{lang}_{country}.mo
|
379 |
+
$mi_mofile2 = WP_LANG_DIR . '/plugins/google-analytics-dashboard-for-wp/' . $mi_mofile;
|
380 |
+
|
381 |
+
// Look in wp-content/languages/plugins/google-analytics-dashboard-for-wp-{lang}_{country}.mo
|
382 |
+
$mi_mofile3 = WP_LANG_DIR . '/plugins/' . $mi_mofile;
|
383 |
+
|
384 |
+
// Look in wp-content/plugins/google-analytics-dashboard-for-wp/languages/google-analytics-dashboard-for-wp-{lang}_{country}.mo
|
385 |
+
$mi_mofile4 = dirname( plugin_basename( EXACTMETRICS_PLUGIN_FILE ) ) . '/languages/';
|
386 |
+
$mi_mofile4 = apply_filters( 'exactmetrics_lite_languages_directory', $mi_mofile4 );
|
387 |
+
|
388 |
+
if ( file_exists( $mi_mofile1 ) ) {
|
389 |
+
load_textdomain( 'google-analytics-dashboard-for-wp', $mi_mofile1 );
|
390 |
+
} elseif ( file_exists( $mi_mofile2 ) ) {
|
391 |
+
load_textdomain( 'google-analytics-dashboard-for-wp', $mi_mofile2 );
|
392 |
+
} elseif ( file_exists( $mi_mofile3 ) ) {
|
393 |
+
load_textdomain( 'google-analytics-dashboard-for-wp', $mi_mofile3 );
|
394 |
+
} else {
|
395 |
+
load_plugin_textdomain( 'google-analytics-dashboard-for-wp', false, $mi_mofile4 );
|
396 |
+
}
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
/**
|
401 |
+
* Output a nag notice if the user has both Lite and Pro activated
|
402 |
+
*
|
403 |
+
* @access public
|
404 |
+
* @since 6.0.0
|
405 |
+
*
|
406 |
+
* @return void
|
407 |
+
*/
|
408 |
+
public function exactmetrics_pro_notice() {
|
409 |
+
$url = admin_url( 'plugins.php' );
|
410 |
+
// Check for MS dashboard
|
411 |
+
if( is_network_admin() ) {
|
412 |
+
$url = network_admin_url( 'plugins.php' );
|
413 |
+
}
|
414 |
+
?>
|
415 |
+
<div class="error">
|
416 |
+
<p>
|
417 |
+
<?php
|
418 |
+
// Translators: Adds a link to the plugins page.
|
419 |
+
echo sprintf( esc_html__( 'Please %1$suninstall%2$s the ExactMetrics Lite Plugin. Your Pro version of ExactMetrics may not work as expected until the Lite version is uninstalled.', 'google-analytics-dashboard-for-wp' ), '<a href="' . $url . '">', '</a>' );
|
420 |
+
?>
|
421 |
+
</p>
|
422 |
+
</div>
|
423 |
+
<?php
|
424 |
+
|
425 |
+
}
|
426 |
+
|
427 |
+
/**
|
428 |
+
* Loads ExactMetrics settings
|
429 |
+
*
|
430 |
+
* Adds the items to the base object, and adds the helper functions.
|
431 |
+
*
|
432 |
+
* @since 6.0.0
|
433 |
+
* @access public
|
434 |
+
*
|
435 |
+
* @return void
|
436 |
+
*/
|
437 |
+
public function load_settings() {
|
438 |
+
global $exactmetrics_settings;
|
439 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/options.php';
|
440 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/helpers.php';
|
441 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/deprecated.php';
|
442 |
+
$exactmetrics_settings = exactmetrics_get_options();
|
443 |
+
}
|
444 |
+
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Loads ExactMetrics License
|
448 |
+
*
|
449 |
+
* Loads license class used by ExactMetrics
|
450 |
+
*
|
451 |
+
* @since 6.0.0
|
452 |
+
* @access public
|
453 |
+
*
|
454 |
+
* @return void
|
455 |
+
*/
|
456 |
+
public function load_licensing(){
|
457 |
+
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
458 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'lite/includes/license-compat.php';
|
459 |
+
self::$instance->license = new ExactMetrics_License_Compat();
|
460 |
+
}
|
461 |
+
}
|
462 |
+
|
463 |
+
/**
|
464 |
+
* Loads ExactMetrics Auth
|
465 |
+
*
|
466 |
+
* Loads auth used by ExactMetrics
|
467 |
+
*
|
468 |
+
* @since 6.0.0
|
469 |
+
* @access public
|
470 |
+
*
|
471 |
+
* @return void
|
472 |
+
*/
|
473 |
+
public function load_auth() {
|
474 |
+
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
475 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/auth.php';
|
476 |
+
self::$instance->auth = new ExactMetrics_Auth();
|
477 |
+
}
|
478 |
+
}
|
479 |
+
|
480 |
+
/**
|
481 |
+
* Loads all files into scope.
|
482 |
+
*
|
483 |
+
* @access public
|
484 |
+
* @since 6.0.0
|
485 |
+
*
|
486 |
+
* @return void
|
487 |
+
*/
|
488 |
+
public function require_files() {
|
489 |
+
|
490 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/capabilities.php';
|
491 |
+
|
492 |
+
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
493 |
+
|
494 |
+
// Lite and Pro files
|
495 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'assets/lib/pandora/class-am-deactivation-survey.php';
|
496 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/ajax.php';
|
497 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/admin.php';
|
498 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/em-admin.php';
|
499 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/common.php';
|
500 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/notice.php';
|
501 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/licensing/autoupdate.php';
|
502 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/review.php';
|
503 |
+
|
504 |
+
// Pages
|
505 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/pages/settings.php';
|
506 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/pages/tools.php';
|
507 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/pages/reports.php';
|
508 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/pages/addons.php';
|
509 |
+
|
510 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/api-auth.php';
|
511 |
+
|
512 |
+
// Reports
|
513 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/reports/abstract-report.php';
|
514 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/reports/overview.php';
|
515 |
+
|
516 |
+
// Reporting Functionality
|
517 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/reporting.php';
|
518 |
+
|
519 |
+
// Routes used by Vue
|
520 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/routes.php';
|
521 |
+
|
522 |
+
// Load gutenberg editor functions
|
523 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/gutenberg/gutenberg.php';
|
524 |
+
|
525 |
+
// Emails
|
526 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/emails/class-emails.php';
|
527 |
+
|
528 |
+
// Notifications class.
|
529 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/notifications.php';
|
530 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/notification-event.php';
|
531 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/notification-event-runner.php';
|
532 |
+
// Add notification manual events for lite version.
|
533 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/notifications/notification-events.php';
|
534 |
+
}
|
535 |
+
|
536 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/api-request.php';
|
537 |
+
|
538 |
+
if ( is_admin() || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
539 |
+
// Late loading classes (self instantiating)
|
540 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/admin/tracking.php';
|
541 |
+
}
|
542 |
+
|
543 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/frontend/frontend.php';
|
544 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/frontend/seedprod.php';
|
545 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/measurement-protocol.php';
|
546 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/measurement-protocol-v4.php';
|
547 |
+
}
|
548 |
+
|
549 |
+
/**
|
550 |
+
* Get the tracking mode for the frontend scripts.
|
551 |
+
*
|
552 |
+
* @return string
|
553 |
+
*/
|
554 |
+
public function get_tracking_mode() {
|
555 |
+
|
556 |
+
if ( ! isset( $this->tracking_mode ) ) {
|
557 |
+
// This will already be set to 'analytics' to anybody already using the plugin before 7.15.0.
|
558 |
+
$this->tracking_mode = exactmetrics_get_option( 'tracking_mode', 'gtag' );
|
559 |
+
}
|
560 |
+
|
561 |
+
return $this->tracking_mode;
|
562 |
+
}
|
563 |
+
}
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Fired when the plugin is activated.
|
567 |
+
*
|
568 |
+
* @access public
|
569 |
+
* @since 6.0.0
|
570 |
+
*
|
571 |
+
* @global int $wp_version The version of WordPress for this install.
|
572 |
+
* @global object $wpdb The WordPress database object.
|
573 |
+
* @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false otherwise.
|
574 |
+
*
|
575 |
+
* @return void
|
576 |
+
*/
|
577 |
+
function exactmetrics_lite_activation_hook( $network_wide ) {
|
578 |
+
$url = admin_url( 'plugins.php' );
|
579 |
+
// Check for MS dashboard
|
580 |
+
if ( is_network_admin() ) {
|
581 |
+
$url = network_admin_url( 'plugins.php' );
|
582 |
+
}
|
583 |
+
|
584 |
+
if ( class_exists( 'ExactMetrics' ) ) {
|
585 |
+
deactivate_plugins( plugin_basename( __FILE__ ) );
|
586 |
+
wp_die( sprintf( esc_html__( 'Please uninstall and remove ExactMetrics Pro before activating Google Analytics Dashboard for WP (GADWP). The Lite version has not been activated. %1$sClick here to return to the Dashboard%2$s.', 'google-analytics-by-wordpress' ), '<a href="' . $url . '">', '</a>' ) );
|
587 |
+
}
|
588 |
+
|
589 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/compatibility-check.php';
|
590 |
+
$compatibility = ExactMetrics_Compatibility_Check::get_instance();
|
591 |
+
$compatibility->maybe_deactivate_plugin( plugin_basename( __FILE__ ) );
|
592 |
+
|
593 |
+
// Add transient to trigger redirect.
|
594 |
+
set_transient( '_exactmetrics_activation_redirect', 1, 30 );
|
595 |
+
}
|
596 |
+
register_activation_hook( __FILE__, 'exactmetrics_lite_activation_hook' );
|
597 |
+
|
598 |
+
/**
|
599 |
+
* Fired when the plugin is uninstalled.
|
600 |
+
*
|
601 |
+
* @access public
|
602 |
+
* @since 6.0.0
|
603 |
+
*
|
604 |
+
* @return void
|
605 |
+
*/
|
606 |
+
function exactmetrics_lite_uninstall_hook() {
|
607 |
+
wp_cache_flush();
|
608 |
+
|
609 |
+
// Note, if both MI Pro and Lite are active, this is an MI Pro instance
|
610 |
+
// Therefore MI Lite can only use functions of the instance common to
|
611 |
+
// both plugins. If it needs to be pro specific, then include a file that
|
612 |
+
// has that method.
|
613 |
+
$instance = ExactMetrics();
|
614 |
+
|
615 |
+
// If uninstalling via wp-cli load admin-specific files only here.
|
616 |
+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
617 |
+
define( 'WP_ADMIN', true );
|
618 |
+
$instance->require_files();
|
619 |
+
$instance->load_auth();
|
620 |
+
$instance->notices = new ExactMetrics_Notice_Admin();
|
621 |
+
$instance->reporting = new ExactMetrics_Reporting();
|
622 |
+
$instance->api_auth = new ExactMetrics_API_Auth();
|
623 |
+
}
|
624 |
+
|
625 |
+
// Don't delete any data if the PRO version is already active.
|
626 |
+
if ( exactmetrics_is_pro_version() ) {
|
627 |
+
return;
|
628 |
+
}
|
629 |
+
|
630 |
+
if ( is_multisite() ) {
|
631 |
+
$site_list = get_sites();
|
632 |
+
foreach ( (array) $site_list as $site ) {
|
633 |
+
switch_to_blog( $site->blog_id );
|
634 |
+
|
635 |
+
// Delete auth
|
636 |
+
$instance->api_auth->delete_auth();
|
637 |
+
|
638 |
+
// Delete data
|
639 |
+
$instance->reporting->delete_aggregate_data('site');
|
640 |
+
|
641 |
+
restore_current_blog();
|
642 |
+
}
|
643 |
+
// Delete network auth using a custom function as some variables are not initiated.
|
644 |
+
$instance->api_auth->uninstall_network_auth();
|
645 |
+
|
646 |
+
// Delete network data
|
647 |
+
$instance->reporting->delete_aggregate_data('network');
|
648 |
+
} else {
|
649 |
+
// Delete auth
|
650 |
+
$instance->api_auth->delete_auth();
|
651 |
+
|
652 |
+
// Delete data
|
653 |
+
$instance->reporting->delete_aggregate_data('site');
|
654 |
+
}
|
655 |
+
|
656 |
+
// Clear notification cron schedules
|
657 |
+
$schedules = wp_get_schedules();
|
658 |
+
|
659 |
+
if ( is_array( $schedules ) && ! empty( $schedules ) ) {
|
660 |
+
foreach ( $schedules as $key => $value ) {
|
661 |
+
if ( 0 === strpos($key, "exactmetrics_notification_") ) {
|
662 |
+
$cron_hook = implode("_", explode( "_", $key, -2 ) ) . '_cron';
|
663 |
+
wp_clear_scheduled_hook( $cron_hook );
|
664 |
+
}
|
665 |
+
}
|
666 |
+
}
|
667 |
+
|
668 |
+
}
|
669 |
+
register_uninstall_hook( __FILE__, 'exactmetrics_lite_uninstall_hook' );
|
670 |
+
|
671 |
+
/**
|
672 |
+
* The main function responsible for returning the one true ExactMetrics_Lite
|
673 |
+
* Instance to functions everywhere.
|
674 |
+
*
|
675 |
+
* Use this function like you would a global variable, except without needing
|
676 |
+
* to declare the global.
|
677 |
+
*
|
678 |
+
* Example: <?php $exactmetrics = ExactMetrics_Lite(); ?>
|
679 |
+
*
|
680 |
+
* @since 6.0.0
|
681 |
+
*
|
682 |
+
* @uses ExactMetrics_Lite::get_instance() Retrieve ExactMetrics_Lite instance.
|
683 |
+
*
|
684 |
+
* @return ExactMetrics_Lite The singleton ExactMetrics_Lite instance.
|
685 |
+
*/
|
686 |
+
function ExactMetrics_Lite() {
|
687 |
+
return ExactMetrics_Lite::get_instance();
|
688 |
+
}
|
689 |
+
|
690 |
+
/**
|
691 |
+
* ExactMetrics Install and Updates.
|
692 |
+
*
|
693 |
+
* This function is used install and upgrade ExactMetrics. This is used for upgrade routines
|
694 |
+
* that can be done automatically, behind the scenes without the need for user interaction
|
695 |
+
* (for example pagination or user input required), as well as the initial install.
|
696 |
+
*
|
697 |
+
* @since 6.0.0
|
698 |
+
* @access public
|
699 |
+
*
|
700 |
+
* @global string $wp_version WordPress version (provided by WordPress core).
|
701 |
+
* @uses ExactMetrics_Lite::load_settings() Loads ExactMetrics settings
|
702 |
+
* @uses ExactMetrics_Install::init() Runs upgrade process
|
703 |
+
*
|
704 |
+
* @return void
|
705 |
+
*/
|
706 |
+
function exactmetrics_lite_install_and_upgrade() {
|
707 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/compatibility-check.php';
|
708 |
+
$compatibility = ExactMetrics_Compatibility_Check::get_instance();
|
709 |
+
|
710 |
+
// If the WordPress site doesn't meet the correct WP or PHP version requirements, don't activate ExactMetrics
|
711 |
+
if ( ! $compatibility->is_php_compatible() || ! $compatibility->is_wp_compatible() ) {
|
712 |
+
if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
|
713 |
+
return;
|
714 |
+
}
|
715 |
+
}
|
716 |
+
|
717 |
+
// Don't run if ExactMetrics Pro is installed
|
718 |
+
if ( class_exists( 'ExactMetrics' ) ) {
|
719 |
+
if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
|
720 |
+
return;
|
721 |
+
}
|
722 |
+
}
|
723 |
+
|
724 |
+
|
725 |
+
// Load settings and globals (so we can use/set them during the upgrade process)
|
726 |
+
ExactMetrics_Lite()->define_globals();
|
727 |
+
ExactMetrics_Lite()->load_settings();
|
728 |
+
|
729 |
+
// Load in Auth
|
730 |
+
ExactMetrics()->load_auth();
|
731 |
+
|
732 |
+
// Load upgrade file
|
733 |
+
require_once EXACTMETRICS_PLUGIN_DIR . 'includes/em-install.php';
|
734 |
+
|
735 |
+
// Run the ExactMetrics upgrade routines
|
736 |
+
$updates = new ExactMetrics_Install();
|
737 |
+
$updates->init();
|
738 |
+
}
|
739 |
+
|
740 |
+
/**
|
741 |
+
* ExactMetrics check for install and update processes.
|
742 |
+
*
|
743 |
+
* This function is used to call the ExactMetrics automatic upgrade class, which in turn
|
744 |
+
* checks to see if there are any update procedures to be run, and if
|
745 |
+
* so runs them. Also installs ExactMetrics for the first time.
|
746 |
+
*
|
747 |
+
* @since 6.0.0
|
748 |
+
* @access public
|
749 |
+
*
|
750 |
+
* @uses ExactMetrics_Install() Runs install and upgrade process.
|
751 |
+
*
|
752 |
+
* @return void
|
753 |
+
*/
|
754 |
+
function exactmetrics_lite_call_install_and_upgrade(){
|
755 |
+
add_action( 'wp_loaded', 'exactmetrics_lite_install_and_upgrade' );
|
756 |
+
}
|
757 |
+
|
758 |
+
/**
|
759 |
+
* Returns the ExactMetrics combined object that you can use for both
|
760 |
+
* ExactMetrics Lite and Pro Users. When both plugins active, defers to the
|
761 |
+
* more complete Pro object.
|
762 |
+
*
|
763 |
+
* Warning: Do not use this in Lite or Pro specific code (use the individual objects instead).
|
764 |
+
* Also do not use in the ExactMetrics Lite/Pro upgrade and install routines.
|
765 |
+
*
|
766 |
+
* Use this function like you would a global variable, except without needing
|
767 |
+
* to declare the global.
|
768 |
+
*
|
769 |
+
* Prevents the need to do conditional global object logic when you have code that you want to work with
|
770 |
+
* both Pro and Lite.
|
771 |
+
*
|
772 |
+
* Example: <?php $exactmetrics = ExactMetrics(); ?>
|
773 |
+
*
|
774 |
+
* @since 6.0.0
|
775 |
+
*
|
776 |
+
* @uses ExactMetrics::get_instance() Retrieve ExactMetrics Pro instance.
|
777 |
+
* @uses ExactMetrics_Lite::get_instance() Retrieve ExactMetrics Lite instance.
|
778 |
+
*
|
779 |
+
* @return ExactMetrics The singleton ExactMetrics instance.
|
780 |
+
*/
|
781 |
+
if ( ! function_exists( 'ExactMetrics' ) ) {
|
782 |
+
function ExactMetrics() {
|
783 |
+
return ( class_exists( 'ExactMetrics' ) ? ExactMetrics_Pro() : ExactMetrics_Lite() );
|
784 |
+
}
|
785 |
+
add_action( 'plugins_loaded', 'ExactMetrics' );
|
786 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/admin.php
CHANGED
@@ -1,578 +1,628 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin class.
|
4 |
-
*
|
5 |
-
* @since 6.0.0
|
6 |
-
*
|
7 |
-
* @package ExactMetrics
|
8 |
-
* @subpackage Admin
|
9 |
-
* @author Chris Christoff
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register menu items for ExactMetrics.
|
19 |
-
*
|
20 |
-
* @since 6.0.0
|
21 |
-
* @access public
|
22 |
-
*
|
23 |
-
* @return void
|
24 |
-
*/
|
25 |
-
function exactmetrics_admin_menu() {
|
26 |
-
$hook = exactmetrics_get_menu_hook();
|
27 |
-
$menu_icon_inline = exactmetrics_get_inline_menu_icon();
|
28 |
-
|
29 |
-
if ( $hook === 'exactmetrics_settings' ) {
|
30 |
-
// If dashboards disabled, first settings page
|
31 |
-
add_menu_page( __( 'ExactMetrics', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics' . ExactMetrics()->notifications->get_menu_count(), 'exactmetrics_save_settings', 'exactmetrics_settings', 'exactmetrics_settings_page', $menu_icon_inline, '100.00013467543' );
|
32 |
-
$hook = 'exactmetrics_settings';
|
33 |
-
|
34 |
-
add_submenu_page( $hook, __( 'ExactMetrics', 'google-analytics-dashboard-for-wp' ), __( 'Settings', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', 'exactmetrics_settings' );
|
35 |
-
} else {
|
36 |
-
// if dashboards enabled, first dashboard
|
37 |
-
add_menu_page( __( 'General:', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics' . ExactMetrics()->notifications->get_menu_count(), 'exactmetrics_view_dashboard', 'exactmetrics_reports', 'exactmetrics_reports_page', $menu_icon_inline, '100.00013467543' );
|
38 |
-
|
39 |
-
add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-dashboard-for-wp' ), __( 'Reports', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_view_dashboard', 'exactmetrics_reports', 'exactmetrics_reports_page' );
|
40 |
-
|
41 |
-
// then settings page
|
42 |
-
add_submenu_page( $hook, __( 'ExactMetrics', 'google-analytics-dashboard-for-wp' ), __( 'Settings', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', 'exactmetrics_settings', 'exactmetrics_settings_page' );
|
43 |
-
|
44 |
-
// Add dashboard submenu.
|
45 |
-
add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics', 'exactmetrics_view_dashboard', 'admin.php?page=exactmetrics_reports' );
|
46 |
-
}
|
47 |
-
|
48 |
-
$submenu_base = add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) );
|
49 |
-
|
50 |
-
// Add Popular Posts menu item.
|
51 |
-
add_submenu_page( $hook, __( 'Popular Posts:', 'google-analytics-dashboard-for-wp' ), __( 'Popular Posts', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', $submenu_base . '#/popular-posts' );
|
52 |
-
|
53 |
-
if ( function_exists( 'aioseo' ) ) {
|
54 |
-
$seo_url = exactmetrics_aioseo_dashboard_url();
|
55 |
-
} else {
|
56 |
-
$seo_url = $submenu_base . '#/seo';
|
57 |
-
}
|
58 |
-
// then SEO
|
59 |
-
add_submenu_page( $hook, __( 'SEO', 'google-analytics-dashboard-for-wp' ), __( 'SEO', 'google-analytics-dashboard-for-wp' ), 'manage_options', $seo_url );
|
60 |
-
|
61 |
-
// then tools
|
62 |
-
add_submenu_page( $hook, __( 'Tools:', 'google-analytics-dashboard-for-wp' ), __( 'Tools', 'google-analytics-dashboard-for-wp' ), 'manage_options', $submenu_base . '#/tools' );
|
63 |
-
|
64 |
-
// then addons
|
65 |
-
$network_key = exactmetrics_is_pro_version() ? ExactMetrics()->license->get_network_license_key() : '';
|
66 |
-
if ( ! exactmetrics_is_network_active() || ( exactmetrics_is_network_active() && empty( $network_key ) ) ) {
|
67 |
-
add_submenu_page( $hook, __( 'Addons:', 'google-analytics-dashboard-for-wp' ), '<span style="color:' . exactmetrics_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-dashboard-for-wp' ) . '</span>', 'exactmetrics_save_settings', $submenu_base . '#/addons' );
|
68 |
-
}
|
69 |
-
|
70 |
-
// Add About us page.
|
71 |
-
add_submenu_page( $hook, __( 'About Us:', 'google-analytics-dashboard-for-wp' ), __( 'About Us', 'google-analytics-dashboard-for-wp' ), 'manage_options', $submenu_base . '#/about' );
|
72 |
-
|
73 |
-
if ( ! exactmetrics_is_pro_version() ) {
|
74 |
-
add_submenu_page( $hook, __( 'Upgrade to Pro:', 'google-analytics-dashboard-for-wp' ), '<span class="exactmetrics-upgrade-submenu"> ' . __( 'Upgrade to Pro', 'google-analytics-dashboard-for-wp' ) . '</span>', 'exactmetrics_save_settings', exactmetrics_get_upgrade_link( 'admin-menu', 'submenu', "https://www.exactmetrics.com/lite/" ) );
|
75 |
-
}
|
76 |
-
|
77 |
-
}
|
78 |
-
add_action( 'admin_menu', 'exactmetrics_admin_menu' );
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Add this separately so all the Woo menu items are loaded and the position parameter works correctly.
|
82 |
-
*/
|
83 |
-
function exactmetrics_woocommerce_menu_item() {
|
84 |
-
// Add "Insights" sub menu item for WooCommerce Analytics menu
|
85 |
-
if ( class_exists( 'WooCommerce' ) && ! apply_filters( 'exactmetrics_disable_woo_analytics_menu', false ) ) {
|
86 |
-
if ( class_exists( 'ExactMetrics_eCommerce' ) ) {
|
87 |
-
add_submenu_page( 'wc-admin&path=/analytics/overview', 'ExactMetrics', 'ExactMetrics', 'exactmetrics_view_dashboard', admin_url( 'admin.php?page=exactmetrics_reports#/ecommerce' ), '', 2 );
|
88 |
-
} else {
|
89 |
-
$submenu_base = add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) );
|
90 |
-
add_submenu_page( 'wc-admin&path=/analytics/overview', 'ExactMetrics', 'ExactMetrics', 'manage_options', $submenu_base . '#/woocommerce-insights', '', 1 );
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
add_action( 'admin_menu', 'exactmetrics_woocommerce_menu_item', 11 );
|
96 |
-
|
97 |
-
function exactmetrics_get_menu_hook() {
|
98 |
-
$dashboards_disabled = exactmetrics_get_option( 'dashboards_disabled', false );
|
99 |
-
if ( $dashboards_disabled || ( current_user_can( 'exactmetrics_save_settings' ) && ! current_user_can( 'exactmetrics_view_dashboard' ) ) ) {
|
100 |
-
return 'exactmetrics_settings';
|
101 |
-
} else {
|
102 |
-
return 'exactmetrics_reports';
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
function exactmetrics_network_admin_menu() {
|
107 |
-
// Get the base class object.
|
108 |
-
$base = ExactMetrics();
|
109 |
-
|
110 |
-
// First, let's see if this is an MS network enabled plugin. If it is, we should load the license
|
111 |
-
// menu page and the updater on the network panel
|
112 |
-
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
113 |
-
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
114 |
-
}
|
115 |
-
|
116 |
-
$plugin = plugin_basename( EXACTMETRICS_PLUGIN_FILE );
|
117 |
-
if ( ! is_plugin_active_for_network( $plugin ) ) {
|
118 |
-
return;
|
119 |
-
}
|
120 |
-
|
121 |
-
$menu_icon_inline = exactmetrics_get_inline_menu_icon();
|
122 |
-
$hook = 'exactmetrics_network';
|
123 |
-
$submenu_base = add_query_arg( 'page', 'exactmetrics_network', network_admin_url( 'admin.php' ) );
|
124 |
-
add_menu_page( __( 'Network Settings:', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics' . ExactMetrics()->notifications->get_menu_count(), 'exactmetrics_save_settings', 'exactmetrics_network', 'exactmetrics_network_page', $menu_icon_inline, '100.00013467543' );
|
125 |
-
|
126 |
-
add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-dashboard-for-wp' ), __( 'Network Settings', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', 'exactmetrics_network', 'exactmetrics_network_page' );
|
127 |
-
|
128 |
-
add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-dashboard-for-wp' ), __( 'Reports', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_view_dashboard', 'exactmetrics_reports', 'exactmetrics_reports_page' );
|
129 |
-
|
130 |
-
if ( function_exists( 'aioseo' ) ) {
|
131 |
-
$seo_url = exactmetrics_aioseo_dashboard_url();
|
132 |
-
} else {
|
133 |
-
$seo_url = $submenu_base . '#/seo';
|
134 |
-
}
|
135 |
-
// then seo
|
136 |
-
add_submenu_page( $hook, __( 'SEO:', 'google-analytics-dashboard-for-wp' ), __( 'SEO', 'google-analytics-dashboard-for-wp' ), 'manage_options', $seo_url, 'exactmetrics_seo_page' );
|
137 |
-
|
138 |
-
// then addons
|
139 |
-
add_submenu_page( $hook, __( 'Addons:', 'google-analytics-dashboard-for-wp' ), '<span style="color:' . exactmetrics_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-dashboard-for-wp' ) . '</span>', 'exactmetrics_save_settings', $submenu_base . '#/addons' );
|
140 |
-
|
141 |
-
$submenu_base = add_query_arg( 'page', 'exactmetrics_network', network_admin_url( 'admin.php' ) );
|
142 |
-
|
143 |
-
// Add About us page.
|
144 |
-
add_submenu_page( $hook, __( 'About Us:', 'google-analytics-dashboard-for-wp' ), __( 'About Us', 'google-analytics-dashboard-for-wp' ), 'manage_options', $submenu_base . '#/about' );
|
145 |
-
}
|
146 |
-
add_action( 'network_admin_menu', 'exactmetrics_network_admin_menu', 5 );
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Adds one or more classes to the body tag in the dashboard.
|
150 |
-
*
|
151 |
-
* @param String $classes Current body classes.
|
152 |
-
* @return String Altered body classes.
|
153 |
-
*/
|
154 |
-
function exactmetrics_add_admin_body_class( $classes ) {
|
155 |
-
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
156 |
-
if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
157 |
-
return $classes;
|
158 |
-
}
|
159 |
-
|
160 |
-
return "$classes exactmetrics_page ";
|
161 |
-
}
|
162 |
-
add_filter( 'admin_body_class', 'exactmetrics_add_admin_body_class', 10, 1 );
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Adds one or more classes to the body tag in the dashboard.
|
166 |
-
*
|
167 |
-
* @param String $classes Current body classes.
|
168 |
-
* @return String Altered body classes.
|
169 |
-
*/
|
170 |
-
function exactmetrics_add_admin_body_class_tools_page( $classes ) {
|
171 |
-
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
172 |
-
|
173 |
-
if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'exactmetrics_tools' ) === false || 'insights_page_exactmetrics_tools' === $screen->id ) {
|
174 |
-
return $classes;
|
175 |
-
}
|
176 |
-
|
177 |
-
return "$classes insights_page_exactmetrics_tools ";
|
178 |
-
}
|
179 |
-
add_filter( 'admin_body_class', 'exactmetrics_add_admin_body_class_tools_page', 10, 1 );
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Adds one or more classes to the body tag in the dashboard.
|
183 |
-
*
|
184 |
-
* @param String $classes Current body classes.
|
185 |
-
* @return String Altered body classes.
|
186 |
-
*/
|
187 |
-
function exactmetrics_add_admin_body_class_addons_page( $classes ) {
|
188 |
-
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
189 |
-
if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'exactmetrics_addons' ) === false || 'insights_page_exactmetrics_addons' === $screen->id ) {
|
190 |
-
return $classes;
|
191 |
-
}
|
192 |
-
|
193 |
-
return "$classes insights_page_exactmetrics_addons ";
|
194 |
-
}
|
195 |
-
add_filter( 'admin_body_class', 'exactmetrics_add_admin_body_class_addons_page', 10, 1 );
|
196 |
-
|
197 |
-
/**
|
198 |
-
* Add a link to the settings page to the plugins list
|
199 |
-
*
|
200 |
-
* @param array $links array of links for the plugins, adapted when the current plugin is found.
|
201 |
-
*
|
202 |
-
* @return array $links
|
203 |
-
*/
|
204 |
-
function exactmetrics_add_action_links( $links ) {
|
205 |
-
$docs = '<a title="' . esc_html__( 'ExactMetrics Knowledge Base', 'google-analytics-dashboard-for-wp' ) . '" href="'. exactmetrics_get_url( 'all-plugins', 'kb-link', "https://www.exactmetrics.com/docs/" ) .'">' . esc_html__( 'Documentation', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
206 |
-
array_unshift( $links, $docs );
|
207 |
-
|
208 |
-
// If Lite, support goes to forum. If pro, it goes to our website
|
209 |
-
if ( exactmetrics_is_pro_version() ) {
|
210 |
-
$support = '<a title="ExactMetrics Pro Support" href="'. exactmetrics_get_url( 'all-plugins', 'pro-support-link', "https://www.exactmetrics.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
211 |
-
array_unshift( $links, $support );
|
212 |
-
} else {
|
213 |
-
$support = '<a title="ExactMetrics Lite Support" href="'. exactmetrics_get_url( 'all-plugins', 'lite-support-link', "https://www.exactmetrics.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
214 |
-
array_unshift( $links, $support );
|
215 |
-
}
|
216 |
-
|
217 |
-
if ( is_network_admin() ) {
|
218 |
-
$settings_link = '<a href="' . esc_url( network_admin_url( 'admin.php?page=exactmetrics_network' ) ) . '">' . esc_html__( 'Network Settings', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
219 |
-
} else {
|
220 |
-
$settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=exactmetrics_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
221 |
-
}
|
222 |
-
|
223 |
-
array_unshift( $links, $settings_link );
|
224 |
-
|
225 |
-
// If lite, show a link where they can get pro from
|
226 |
-
if ( ! exactmetrics_is_pro_version() ) {
|
227 |
-
$get_pro = '<a title="' . esc_html__( 'Get ExactMetrics Pro', 'google-analytics-dashboard-for-wp' ) .'" href="'. exactmetrics_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.exactmetrics.com/lite/" ) .'" style="font-weight:700">' . esc_html__( 'Get ExactMetrics Pro', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
228 |
-
array_unshift( $links, $get_pro );
|
229 |
-
}
|
230 |
-
|
231 |
-
return $links;
|
232 |
-
}
|
233 |
-
add_filter( 'plugin_action_links_' . plugin_basename( EXACTMETRICS_PLUGIN_FILE ), 'exactmetrics_add_action_links' );
|
234 |
-
add_filter( 'network_admin_plugin_action_links_' . plugin_basename( EXACTMETRICS_PLUGIN_FILE ), 'exactmetrics_add_action_links' );
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Loads a partial view for the Administration screen
|
238 |
-
*
|
239 |
-
* @access public
|
240 |
-
* @since 6.0.0
|
241 |
-
*
|
242 |
-
* @param string $template PHP file at includes/admin/partials, excluding file extension
|
243 |
-
* @param array $data Any data to pass to the view
|
244 |
-
* @return void
|
245 |
-
*/
|
246 |
-
function exactmetrics_load_admin_partial( $template, $data = array() ) {
|
247 |
-
|
248 |
-
if ( exactmetrics_is_pro_version() ) {
|
249 |
-
$dir = trailingslashit( plugin_dir_path( ExactMetrics()->file ) . 'pro/includes/admin/partials' );
|
250 |
-
|
251 |
-
if ( file_exists( $dir . $template . '.php' ) ) {
|
252 |
-
require_once( $dir . $template . '.php' );
|
253 |
-
return true;
|
254 |
-
}
|
255 |
-
} else {
|
256 |
-
$dir = trailingslashit( plugin_dir_path( ExactMetrics()->file ) . 'lite/includes/admin/partials' );
|
257 |
-
|
258 |
-
if ( file_exists( $dir . $template . '.php' ) ) {
|
259 |
-
require_once( $dir . $template . '.php' );
|
260 |
-
return true;
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
264 |
-
$dir = trailingslashit( plugin_dir_path( ExactMetrics()->file ) . 'includes/admin/partials' );
|
265 |
-
|
266 |
-
if ( file_exists( $dir . $template . '.php' ) ) {
|
267 |
-
require_once( $dir . $template . '.php' );
|
268 |
-
return true;
|
269 |
-
}
|
270 |
-
|
271 |
-
return false;
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* When user is on a ExactMetrics related admin page, display footer text
|
276 |
-
* that graciously asks them to rate us.
|
277 |
-
*
|
278 |
-
* @since 6.0.0
|
279 |
-
* @param string $text
|
280 |
-
* @return string
|
281 |
-
*/
|
282 |
-
function exactmetrics_admin_footer( $text ) {
|
283 |
-
global $current_screen;
|
284 |
-
if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'exactmetrics' ) !== false ) {
|
285 |
-
$url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp?filter=5';
|
286 |
-
// Translators: Placeholders add a link to the wordpress.org repository.
|
287 |
-
$text = sprintf( esc_html__( 'Please rate %1$sExactMetrics%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the ExactMetrics team!', 'google-analytics-dashboard-for-wp' ), '<strong>', '</strong>', '<a class="exactmetrics-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
|
288 |
-
}
|
289 |
-
return $text;
|
290 |
-
}
|
291 |
-
add_filter( 'admin_footer_text', 'exactmetrics_admin_footer', 1, 2 );
|
292 |
-
|
293 |
-
function exactmetrics_admin_setup_notices() {
|
294 |
-
|
295 |
-
// Don't show on ExactMetrics pages
|
296 |
-
$screen = get_current_screen();
|
297 |
-
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) !== false ) {
|
298 |
-
return;
|
299 |
-
}
|
300 |
-
|
301 |
-
// Make sure they have the permissions to do something
|
302 |
-
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
303 |
-
return;
|
304 |
-
}
|
305 |
-
|
306 |
-
// Priority:
|
307 |
-
// 1. Google Analytics not authenticated
|
308 |
-
// 2. License key not entered for pro
|
309 |
-
// 3. License key not valid/okay for pro
|
310 |
-
// 4. WordPress + PHP min versions
|
311 |
-
// 5. (old) Optin setting not configured
|
312 |
-
// 6. Manual UA code
|
313 |
-
// 7. Automatic updates not configured
|
314 |
-
// 8. Woo upsell
|
315 |
-
// 9. EDD upsell
|
316 |
-
|
317 |
-
|
318 |
-
// 1. Google Analytics not authenticated
|
319 |
-
if ( ! is_network_admin() && ! exactmetrics_get_ua() && ! defined( 'EXACTMETRICS_DISABLE_TRACKING' ) ) {
|
320 |
-
|
321 |
-
$submenu_base = is_network_admin() ? add_query_arg( 'page', 'exactmetrics_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) );
|
322 |
-
$title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-dashboard-for-wp' );
|
323 |
-
$primary = esc_html__( 'Connect ExactMetrics and Setup Website Analytics', 'google-analytics-dashboard-for-wp' );
|
324 |
-
$urlone = is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics-onboarding' ) : admin_url( 'admin.php?page=exactmetrics-onboarding' );
|
325 |
-
$secondary = esc_html__( 'Learn More', 'google-analytics-dashboard-for-wp' );
|
326 |
-
$urltwo = $submenu_base . '#/about/getting-started';
|
327 |
-
$message = esc_html__( 'ExactMetrics, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over
|
328 |
-
echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>';
|
329 |
-
return;
|
330 |
-
}
|
331 |
-
|
332 |
-
// 2. License key not entered for pro
|
333 |
-
$key = exactmetrics_is_pro_version() ? ExactMetrics()->license->get_license_key() : '';
|
334 |
-
if ( exactmetrics_is_pro_version() && empty( $key ) ) {
|
335 |
-
$page = is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' );
|
336 |
-
// Translators: Adds a link to retrieve the license.
|
337 |
-
$message = sprintf( esc_html__( 'Warning: No valid license key has been entered for ExactMetrics. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
|
338 |
-
echo '<div class="error"><p>'. $message.'</p></div>';
|
339 |
-
return;
|
340 |
-
}
|
341 |
-
|
342 |
-
// 3. License key not valid/okay for pro
|
343 |
-
if ( exactmetrics_is_pro_version() ) {
|
344 |
-
$message = '';
|
345 |
-
if ( ExactMetrics()->license->get_site_license_key() ){
|
346 |
-
if ( ExactMetrics()->license->site_license_expired() ) {
|
347 |
-
// Translators: Adds a link to the license renewal.
|
348 |
-
$message = sprintf( esc_html__( 'Your license key for ExactMetrics has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. exactmetrics_get_url( 'admin-notices', 'expired-license', "https://www.exactmetrics.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
|
349 |
-
} else if ( ExactMetrics()->license->site_license_disabled() ) {
|
350 |
-
$message = esc_html__( 'Your license key for ExactMetrics has been disabled. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
351 |
-
} else if ( ExactMetrics()->license->site_license_invalid() ) {
|
352 |
-
$message = esc_html__( 'Your license key for ExactMetrics is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
353 |
-
}
|
354 |
-
} else if ( ExactMetrics()->license->get_network_license_key() ) {
|
355 |
-
if ( ExactMetrics()->license->network_license_expired() ) {
|
356 |
-
// Translators: Adds a link to renew license.
|
357 |
-
$message = sprintf( esc_html__( 'Your network license key for ExactMetrics has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. exactmetrics_get_url( 'admin-notices', 'expired-license', "https://www.exactmetrics.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
|
358 |
-
} else if ( ExactMetrics()->license->network_license_disabled() ) {
|
359 |
-
$message = esc_html__( 'Your network license key for ExactMetrics has been disabled. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
360 |
-
} else if ( ExactMetrics()->license->network_license_invalid() ) {
|
361 |
-
$message = esc_html__( 'Your network license key for ExactMetrics is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
362 |
-
}
|
363 |
-
}
|
364 |
-
if ( ! empty( $message ) ) {
|
365 |
-
echo '<div class="error"><p>'. $message.'</p></div>';
|
366 |
-
return;
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
// 4. Notices for PHP/WP version deprecations
|
371 |
-
if ( current_user_can( 'update_core' ) ) {
|
372 |
-
global $wp_version;
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
//
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
//
|
421 |
-
//
|
422 |
-
//
|
423 |
-
//
|
424 |
-
//
|
425 |
-
//
|
426 |
-
//
|
427 |
-
//
|
428 |
-
//
|
429 |
-
//
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
//
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
//
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
echo
|
495 |
-
echo '
|
496 |
-
|
497 |
-
echo
|
498 |
-
echo '
|
499 |
-
|
500 |
-
echo '
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
echo
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
echo
|
528 |
-
echo '
|
529 |
-
echo
|
530 |
-
echo '
|
531 |
-
|
532 |
-
echo '
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin class.
|
4 |
+
*
|
5 |
+
* @since 6.0.0
|
6 |
+
*
|
7 |
+
* @package ExactMetrics
|
8 |
+
* @subpackage Admin
|
9 |
+
* @author Chris Christoff
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Register menu items for ExactMetrics.
|
19 |
+
*
|
20 |
+
* @since 6.0.0
|
21 |
+
* @access public
|
22 |
+
*
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
function exactmetrics_admin_menu() {
|
26 |
+
$hook = exactmetrics_get_menu_hook();
|
27 |
+
$menu_icon_inline = exactmetrics_get_inline_menu_icon();
|
28 |
+
|
29 |
+
if ( $hook === 'exactmetrics_settings' ) {
|
30 |
+
// If dashboards disabled, first settings page
|
31 |
+
add_menu_page( __( 'ExactMetrics', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics' . ExactMetrics()->notifications->get_menu_count(), 'exactmetrics_save_settings', 'exactmetrics_settings', 'exactmetrics_settings_page', $menu_icon_inline, '100.00013467543' );
|
32 |
+
$hook = 'exactmetrics_settings';
|
33 |
+
|
34 |
+
add_submenu_page( $hook, __( 'ExactMetrics', 'google-analytics-dashboard-for-wp' ), __( 'Settings', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', 'exactmetrics_settings' );
|
35 |
+
} else {
|
36 |
+
// if dashboards enabled, first dashboard
|
37 |
+
add_menu_page( __( 'General:', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics' . ExactMetrics()->notifications->get_menu_count(), 'exactmetrics_view_dashboard', 'exactmetrics_reports', 'exactmetrics_reports_page', $menu_icon_inline, '100.00013467543' );
|
38 |
+
|
39 |
+
add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-dashboard-for-wp' ), __( 'Reports', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_view_dashboard', 'exactmetrics_reports', 'exactmetrics_reports_page' );
|
40 |
+
|
41 |
+
// then settings page
|
42 |
+
add_submenu_page( $hook, __( 'ExactMetrics', 'google-analytics-dashboard-for-wp' ), __( 'Settings', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', 'exactmetrics_settings', 'exactmetrics_settings_page' );
|
43 |
+
|
44 |
+
// Add dashboard submenu.
|
45 |
+
add_submenu_page( 'index.php', __( 'General Reports:', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics', 'exactmetrics_view_dashboard', 'admin.php?page=exactmetrics_reports' );
|
46 |
+
}
|
47 |
+
|
48 |
+
$submenu_base = add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) );
|
49 |
+
|
50 |
+
// Add Popular Posts menu item.
|
51 |
+
add_submenu_page( $hook, __( 'Popular Posts:', 'google-analytics-dashboard-for-wp' ), __( 'Popular Posts', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', $submenu_base . '#/popular-posts' );
|
52 |
+
|
53 |
+
if ( function_exists( 'aioseo' ) ) {
|
54 |
+
$seo_url = exactmetrics_aioseo_dashboard_url();
|
55 |
+
} else {
|
56 |
+
$seo_url = $submenu_base . '#/seo';
|
57 |
+
}
|
58 |
+
// then SEO
|
59 |
+
add_submenu_page( $hook, __( 'SEO', 'google-analytics-dashboard-for-wp' ), __( 'SEO', 'google-analytics-dashboard-for-wp' ), 'manage_options', $seo_url );
|
60 |
+
|
61 |
+
// then tools
|
62 |
+
add_submenu_page( $hook, __( 'Tools:', 'google-analytics-dashboard-for-wp' ), __( 'Tools', 'google-analytics-dashboard-for-wp' ), 'manage_options', $submenu_base . '#/tools' );
|
63 |
+
|
64 |
+
// then addons
|
65 |
+
$network_key = exactmetrics_is_pro_version() ? ExactMetrics()->license->get_network_license_key() : '';
|
66 |
+
if ( ! exactmetrics_is_network_active() || ( exactmetrics_is_network_active() && empty( $network_key ) ) ) {
|
67 |
+
add_submenu_page( $hook, __( 'Addons:', 'google-analytics-dashboard-for-wp' ), '<span style="color:' . exactmetrics_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-dashboard-for-wp' ) . '</span>', 'exactmetrics_save_settings', $submenu_base . '#/addons' );
|
68 |
+
}
|
69 |
+
|
70 |
+
// Add About us page.
|
71 |
+
add_submenu_page( $hook, __( 'About Us:', 'google-analytics-dashboard-for-wp' ), __( 'About Us', 'google-analytics-dashboard-for-wp' ), 'manage_options', $submenu_base . '#/about' );
|
72 |
+
|
73 |
+
if ( ! exactmetrics_is_pro_version() ) {
|
74 |
+
add_submenu_page( $hook, __( 'Upgrade to Pro:', 'google-analytics-dashboard-for-wp' ), '<span class="exactmetrics-upgrade-submenu"> ' . __( 'Upgrade to Pro', 'google-analytics-dashboard-for-wp' ) . '</span>', 'exactmetrics_save_settings', exactmetrics_get_upgrade_link( 'admin-menu', 'submenu', "https://www.exactmetrics.com/lite/" ) );
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
add_action( 'admin_menu', 'exactmetrics_admin_menu' );
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Add this separately so all the Woo menu items are loaded and the position parameter works correctly.
|
82 |
+
*/
|
83 |
+
function exactmetrics_woocommerce_menu_item() {
|
84 |
+
// Add "Insights" sub menu item for WooCommerce Analytics menu
|
85 |
+
if ( class_exists( 'WooCommerce' ) && ! apply_filters( 'exactmetrics_disable_woo_analytics_menu', false ) ) {
|
86 |
+
if ( class_exists( 'ExactMetrics_eCommerce' ) ) {
|
87 |
+
add_submenu_page( 'wc-admin&path=/analytics/overview', 'ExactMetrics', 'ExactMetrics', 'exactmetrics_view_dashboard', admin_url( 'admin.php?page=exactmetrics_reports#/ecommerce' ), '', 2 );
|
88 |
+
} else {
|
89 |
+
$submenu_base = add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) );
|
90 |
+
add_submenu_page( 'wc-admin&path=/analytics/overview', 'ExactMetrics', 'ExactMetrics', 'manage_options', $submenu_base . '#/woocommerce-insights', '', 1 );
|
91 |
+
}
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
add_action( 'admin_menu', 'exactmetrics_woocommerce_menu_item', 11 );
|
96 |
+
|
97 |
+
function exactmetrics_get_menu_hook() {
|
98 |
+
$dashboards_disabled = exactmetrics_get_option( 'dashboards_disabled', false );
|
99 |
+
if ( $dashboards_disabled || ( current_user_can( 'exactmetrics_save_settings' ) && ! current_user_can( 'exactmetrics_view_dashboard' ) ) ) {
|
100 |
+
return 'exactmetrics_settings';
|
101 |
+
} else {
|
102 |
+
return 'exactmetrics_reports';
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
function exactmetrics_network_admin_menu() {
|
107 |
+
// Get the base class object.
|
108 |
+
$base = ExactMetrics();
|
109 |
+
|
110 |
+
// First, let's see if this is an MS network enabled plugin. If it is, we should load the license
|
111 |
+
// menu page and the updater on the network panel
|
112 |
+
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
|
113 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
114 |
+
}
|
115 |
+
|
116 |
+
$plugin = plugin_basename( EXACTMETRICS_PLUGIN_FILE );
|
117 |
+
if ( ! is_plugin_active_for_network( $plugin ) ) {
|
118 |
+
return;
|
119 |
+
}
|
120 |
+
|
121 |
+
$menu_icon_inline = exactmetrics_get_inline_menu_icon();
|
122 |
+
$hook = 'exactmetrics_network';
|
123 |
+
$submenu_base = add_query_arg( 'page', 'exactmetrics_network', network_admin_url( 'admin.php' ) );
|
124 |
+
add_menu_page( __( 'Network Settings:', 'google-analytics-dashboard-for-wp' ), 'ExactMetrics' . ExactMetrics()->notifications->get_menu_count(), 'exactmetrics_save_settings', 'exactmetrics_network', 'exactmetrics_network_page', $menu_icon_inline, '100.00013467543' );
|
125 |
+
|
126 |
+
add_submenu_page( $hook, __( 'Network Settings:', 'google-analytics-dashboard-for-wp' ), __( 'Network Settings', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_save_settings', 'exactmetrics_network', 'exactmetrics_network_page' );
|
127 |
+
|
128 |
+
add_submenu_page( $hook, __( 'General Reports:', 'google-analytics-dashboard-for-wp' ), __( 'Reports', 'google-analytics-dashboard-for-wp' ), 'exactmetrics_view_dashboard', 'exactmetrics_reports', 'exactmetrics_reports_page' );
|
129 |
+
|
130 |
+
if ( function_exists( 'aioseo' ) ) {
|
131 |
+
$seo_url = exactmetrics_aioseo_dashboard_url();
|
132 |
+
} else {
|
133 |
+
$seo_url = $submenu_base . '#/seo';
|
134 |
+
}
|
135 |
+
// then seo
|
136 |
+
add_submenu_page( $hook, __( 'SEO:', 'google-analytics-dashboard-for-wp' ), __( 'SEO', 'google-analytics-dashboard-for-wp' ), 'manage_options', $seo_url, 'exactmetrics_seo_page' );
|
137 |
+
|
138 |
+
// then addons
|
139 |
+
add_submenu_page( $hook, __( 'Addons:', 'google-analytics-dashboard-for-wp' ), '<span style="color:' . exactmetrics_menu_highlight_color() . '"> ' . __( 'Addons', 'google-analytics-dashboard-for-wp' ) . '</span>', 'exactmetrics_save_settings', $submenu_base . '#/addons' );
|
140 |
+
|
141 |
+
$submenu_base = add_query_arg( 'page', 'exactmetrics_network', network_admin_url( 'admin.php' ) );
|
142 |
+
|
143 |
+
// Add About us page.
|
144 |
+
add_submenu_page( $hook, __( 'About Us:', 'google-analytics-dashboard-for-wp' ), __( 'About Us', 'google-analytics-dashboard-for-wp' ), 'manage_options', $submenu_base . '#/about' );
|
145 |
+
}
|
146 |
+
add_action( 'network_admin_menu', 'exactmetrics_network_admin_menu', 5 );
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Adds one or more classes to the body tag in the dashboard.
|
150 |
+
*
|
151 |
+
* @param String $classes Current body classes.
|
152 |
+
* @return String Altered body classes.
|
153 |
+
*/
|
154 |
+
function exactmetrics_add_admin_body_class( $classes ) {
|
155 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
156 |
+
if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
157 |
+
return $classes;
|
158 |
+
}
|
159 |
+
|
160 |
+
return "$classes exactmetrics_page ";
|
161 |
+
}
|
162 |
+
add_filter( 'admin_body_class', 'exactmetrics_add_admin_body_class', 10, 1 );
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Adds one or more classes to the body tag in the dashboard.
|
166 |
+
*
|
167 |
+
* @param String $classes Current body classes.
|
168 |
+
* @return String Altered body classes.
|
169 |
+
*/
|
170 |
+
function exactmetrics_add_admin_body_class_tools_page( $classes ) {
|
171 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
172 |
+
|
173 |
+
if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'exactmetrics_tools' ) === false || 'insights_page_exactmetrics_tools' === $screen->id ) {
|
174 |
+
return $classes;
|
175 |
+
}
|
176 |
+
|
177 |
+
return "$classes insights_page_exactmetrics_tools ";
|
178 |
+
}
|
179 |
+
add_filter( 'admin_body_class', 'exactmetrics_add_admin_body_class_tools_page', 10, 1 );
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Adds one or more classes to the body tag in the dashboard.
|
183 |
+
*
|
184 |
+
* @param String $classes Current body classes.
|
185 |
+
* @return String Altered body classes.
|
186 |
+
*/
|
187 |
+
function exactmetrics_add_admin_body_class_addons_page( $classes ) {
|
188 |
+
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
189 |
+
if ( empty( $screen ) || empty( $screen->id ) || strpos( $screen->id, 'exactmetrics_addons' ) === false || 'insights_page_exactmetrics_addons' === $screen->id ) {
|
190 |
+
return $classes;
|
191 |
+
}
|
192 |
+
|
193 |
+
return "$classes insights_page_exactmetrics_addons ";
|
194 |
+
}
|
195 |
+
add_filter( 'admin_body_class', 'exactmetrics_add_admin_body_class_addons_page', 10, 1 );
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Add a link to the settings page to the plugins list
|
199 |
+
*
|
200 |
+
* @param array $links array of links for the plugins, adapted when the current plugin is found.
|
201 |
+
*
|
202 |
+
* @return array $links
|
203 |
+
*/
|
204 |
+
function exactmetrics_add_action_links( $links ) {
|
205 |
+
$docs = '<a title="' . esc_html__( 'ExactMetrics Knowledge Base', 'google-analytics-dashboard-for-wp' ) . '" href="'. exactmetrics_get_url( 'all-plugins', 'kb-link', "https://www.exactmetrics.com/docs/" ) .'">' . esc_html__( 'Documentation', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
206 |
+
array_unshift( $links, $docs );
|
207 |
+
|
208 |
+
// If Lite, support goes to forum. If pro, it goes to our website
|
209 |
+
if ( exactmetrics_is_pro_version() ) {
|
210 |
+
$support = '<a title="ExactMetrics Pro Support" href="'. exactmetrics_get_url( 'all-plugins', 'pro-support-link', "https://www.exactmetrics.com/my-account/support/" ) .'">' . esc_html__( 'Support', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
211 |
+
array_unshift( $links, $support );
|
212 |
+
} else {
|
213 |
+
$support = '<a title="ExactMetrics Lite Support" href="'. exactmetrics_get_url( 'all-plugins', 'lite-support-link', "https://www.exactmetrics.com/lite-support/" ) .'">' . esc_html__( 'Support', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
214 |
+
array_unshift( $links, $support );
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( is_network_admin() ) {
|
218 |
+
$settings_link = '<a href="' . esc_url( network_admin_url( 'admin.php?page=exactmetrics_network' ) ) . '">' . esc_html__( 'Network Settings', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
219 |
+
} else {
|
220 |
+
$settings_link = '<a href="' . esc_url( admin_url( 'admin.php?page=exactmetrics_settings' ) ) . '">' . esc_html__( 'Settings', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
221 |
+
}
|
222 |
+
|
223 |
+
array_unshift( $links, $settings_link );
|
224 |
+
|
225 |
+
// If lite, show a link where they can get pro from
|
226 |
+
if ( ! exactmetrics_is_pro_version() ) {
|
227 |
+
$get_pro = '<a title="' . esc_html__( 'Get ExactMetrics Pro', 'google-analytics-dashboard-for-wp' ) .'" href="'. exactmetrics_get_upgrade_link( 'all-plugins', 'upgrade-link', "https://www.exactmetrics.com/lite/" ) .'" style="font-weight:700; color: #1da867;">' . esc_html__( 'Get ExactMetrics Pro', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
228 |
+
array_unshift( $links, $get_pro );
|
229 |
+
}
|
230 |
+
|
231 |
+
return $links;
|
232 |
+
}
|
233 |
+
add_filter( 'plugin_action_links_' . plugin_basename( EXACTMETRICS_PLUGIN_FILE ), 'exactmetrics_add_action_links' );
|
234 |
+
add_filter( 'network_admin_plugin_action_links_' . plugin_basename( EXACTMETRICS_PLUGIN_FILE ), 'exactmetrics_add_action_links' );
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Loads a partial view for the Administration screen
|
238 |
+
*
|
239 |
+
* @access public
|
240 |
+
* @since 6.0.0
|
241 |
+
*
|
242 |
+
* @param string $template PHP file at includes/admin/partials, excluding file extension
|
243 |
+
* @param array $data Any data to pass to the view
|
244 |
+
* @return void
|
245 |
+
*/
|
246 |
+
function exactmetrics_load_admin_partial( $template, $data = array() ) {
|
247 |
+
|
248 |
+
if ( exactmetrics_is_pro_version() ) {
|
249 |
+
$dir = trailingslashit( plugin_dir_path( ExactMetrics()->file ) . 'pro/includes/admin/partials' );
|
250 |
+
|
251 |
+
if ( file_exists( $dir . $template . '.php' ) ) {
|
252 |
+
require_once( $dir . $template . '.php' );
|
253 |
+
return true;
|
254 |
+
}
|
255 |
+
} else {
|
256 |
+
$dir = trailingslashit( plugin_dir_path( ExactMetrics()->file ) . 'lite/includes/admin/partials' );
|
257 |
+
|
258 |
+
if ( file_exists( $dir . $template . '.php' ) ) {
|
259 |
+
require_once( $dir . $template . '.php' );
|
260 |
+
return true;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
$dir = trailingslashit( plugin_dir_path( ExactMetrics()->file ) . 'includes/admin/partials' );
|
265 |
+
|
266 |
+
if ( file_exists( $dir . $template . '.php' ) ) {
|
267 |
+
require_once( $dir . $template . '.php' );
|
268 |
+
return true;
|
269 |
+
}
|
270 |
+
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* When user is on a ExactMetrics related admin page, display footer text
|
276 |
+
* that graciously asks them to rate us.
|
277 |
+
*
|
278 |
+
* @since 6.0.0
|
279 |
+
* @param string $text
|
280 |
+
* @return string
|
281 |
+
*/
|
282 |
+
function exactmetrics_admin_footer( $text ) {
|
283 |
+
global $current_screen;
|
284 |
+
if ( ! empty( $current_screen->id ) && strpos( $current_screen->id, 'exactmetrics' ) !== false ) {
|
285 |
+
$url = 'https://wordpress.org/support/view/plugin-reviews/google-analytics-dashboard-for-wp?filter=5';
|
286 |
+
// Translators: Placeholders add a link to the wordpress.org repository.
|
287 |
+
$text = sprintf( esc_html__( 'Please rate %1$sExactMetrics%2$s on %3$s %4$sWordPress.org%5$s to help us spread the word. Thank you from the ExactMetrics team!', 'google-analytics-dashboard-for-wp' ), '<strong>', '</strong>', '<a class="exactmetrics-no-text-decoration" href="' . $url . '" target="_blank" rel="noopener noreferrer"><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i><i class="monstericon-star"></i></a>', '<a href="' . $url . '" target="_blank" rel="noopener noreferrer">', '</a>' );
|
288 |
+
}
|
289 |
+
return $text;
|
290 |
+
}
|
291 |
+
add_filter( 'admin_footer_text', 'exactmetrics_admin_footer', 1, 2 );
|
292 |
+
|
293 |
+
function exactmetrics_admin_setup_notices() {
|
294 |
+
|
295 |
+
// Don't show on ExactMetrics pages
|
296 |
+
$screen = get_current_screen();
|
297 |
+
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) !== false ) {
|
298 |
+
return;
|
299 |
+
}
|
300 |
+
|
301 |
+
// Make sure they have the permissions to do something
|
302 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
303 |
+
return;
|
304 |
+
}
|
305 |
+
|
306 |
+
// Priority:
|
307 |
+
// 1. Google Analytics not authenticated
|
308 |
+
// 2. License key not entered for pro
|
309 |
+
// 3. License key not valid/okay for pro
|
310 |
+
// 4. WordPress + PHP min versions
|
311 |
+
// 5. (old) Optin setting not configured
|
312 |
+
// 6. Manual UA code
|
313 |
+
// 7. Automatic updates not configured
|
314 |
+
// 8. Woo upsell
|
315 |
+
// 9. EDD upsell
|
316 |
+
|
317 |
+
|
318 |
+
// 1. Google Analytics not authenticated
|
319 |
+
if ( ! is_network_admin() && ! exactmetrics_get_ua() && ! exactmetrics_get_v4_id() && ! defined( 'EXACTMETRICS_DISABLE_TRACKING' ) ) {
|
320 |
+
|
321 |
+
$submenu_base = is_network_admin() ? add_query_arg( 'page', 'exactmetrics_network', network_admin_url( 'admin.php' ) ) : add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) );
|
322 |
+
$title = esc_html__( 'Please Setup Website Analytics to See Audience Insights', 'google-analytics-dashboard-for-wp' );
|
323 |
+
$primary = esc_html__( 'Connect ExactMetrics and Setup Website Analytics', 'google-analytics-dashboard-for-wp' );
|
324 |
+
$urlone = is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics-onboarding' ) : admin_url( 'admin.php?page=exactmetrics-onboarding' );
|
325 |
+
$secondary = esc_html__( 'Learn More', 'google-analytics-dashboard-for-wp' );
|
326 |
+
$urltwo = $submenu_base . '#/about/getting-started';
|
327 |
+
$message = esc_html__( 'ExactMetrics, WordPress analytics plugin, helps you connect your website with Google Analytics, so you can see how people find and use your website. Over 3 million website owners use ExactMetrics to see the stats that matter and grow their business.', 'google-analytics-dashboard-for-wp' );
|
328 |
+
echo '<div class="notice notice-info"><p style="font-weight:700">'. $title .'</p><p>'. $message.'</p><p><a href="'. $urlone .'" class="button-primary">'. $primary .'</a> <a href="'. $urltwo .'" class="button-secondary">'. $secondary .'</a></p></div>';
|
329 |
+
return;
|
330 |
+
}
|
331 |
+
|
332 |
+
// 2. License key not entered for pro
|
333 |
+
$key = exactmetrics_is_pro_version() ? ExactMetrics()->license->get_license_key() : '';
|
334 |
+
if ( exactmetrics_is_pro_version() && empty( $key ) ) {
|
335 |
+
$page = is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' );
|
336 |
+
// Translators: Adds a link to retrieve the license.
|
337 |
+
$message = sprintf( esc_html__( 'Warning: No valid license key has been entered for ExactMetrics. You are currently not getting updates, and are not able to view reports. %1$sPlease click here to enter your license key and begin receiving updates and reports.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
|
338 |
+
echo '<div class="error"><p>'. $message.'</p></div>';
|
339 |
+
return;
|
340 |
+
}
|
341 |
+
|
342 |
+
// 3. License key not valid/okay for pro
|
343 |
+
if ( exactmetrics_is_pro_version() ) {
|
344 |
+
$message = '';
|
345 |
+
if ( ExactMetrics()->license->get_site_license_key() ){
|
346 |
+
if ( ExactMetrics()->license->site_license_expired() ) {
|
347 |
+
// Translators: Adds a link to the license renewal.
|
348 |
+
$message = sprintf( esc_html__( 'Your license key for ExactMetrics has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. exactmetrics_get_url( 'admin-notices', 'expired-license', "https://www.exactmetrics.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
|
349 |
+
} else if ( ExactMetrics()->license->site_license_disabled() ) {
|
350 |
+
$message = esc_html__( 'Your license key for ExactMetrics has been disabled. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
351 |
+
} else if ( ExactMetrics()->license->site_license_invalid() ) {
|
352 |
+
$message = esc_html__( 'Your license key for ExactMetrics is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
353 |
+
}
|
354 |
+
} else if ( ExactMetrics()->license->get_network_license_key() ) {
|
355 |
+
if ( ExactMetrics()->license->network_license_expired() ) {
|
356 |
+
// Translators: Adds a link to renew license.
|
357 |
+
$message = sprintf( esc_html__( 'Your network license key for ExactMetrics has expired. %1$sPlease click here to renew your license key.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. exactmetrics_get_url( 'admin-notices', 'expired-license', "https://www.exactmetrics.com/login/" ) .'" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>' );
|
358 |
+
} else if ( ExactMetrics()->license->network_license_disabled() ) {
|
359 |
+
$message = esc_html__( 'Your network license key for ExactMetrics has been disabled. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
360 |
+
} else if ( ExactMetrics()->license->network_license_invalid() ) {
|
361 |
+
$message = esc_html__( 'Your network license key for ExactMetrics is invalid. The key no longer exists or the user associated with the key has been deleted. Please use a different key.', 'google-analytics-dashboard-for-wp' );
|
362 |
+
}
|
363 |
+
}
|
364 |
+
if ( ! empty( $message ) ) {
|
365 |
+
echo '<div class="error"><p>'. $message.'</p></div>';
|
366 |
+
return;
|
367 |
+
}
|
368 |
+
}
|
369 |
+
|
370 |
+
// 4. Notices for PHP/WP version deprecations
|
371 |
+
if ( current_user_can( 'update_core' ) ) {
|
372 |
+
global $wp_version;
|
373 |
+
|
374 |
+
$compatible_php_version = apply_filters( 'exactmetrics_compatible_php_version', false );
|
375 |
+
$compatible_wp_version = apply_filters( 'exactmetrics_compatible_wp_version', false );
|
376 |
+
|
377 |
+
$url = exactmetrics_get_url( 'global-notice', 'settings-page', 'https://www.exactmetrics.com/docs/update-php/' );
|
378 |
+
|
379 |
+
$message = false;
|
380 |
+
if ( version_compare( phpversion(), $compatible_php_version['required'], '<' ) ) {
|
381 |
+
// Translators: Placeholders add the PHP version, a link to the ExactMetrics blog and a line break.
|
382 |
+
$message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-dashboard-for-wp' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
|
383 |
+
} else if ( version_compare( phpversion(), $compatible_php_version['warning'], '<' ) ) {
|
384 |
+
// Translators: Placeholders add the PHP version, a link to the ExactMetrics blog and a line break.
|
385 |
+
$message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress stopped supporting your PHP version in November, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-dashboard-for-wp' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
|
386 |
+
} else if ( version_compare( phpversion(), $compatible_php_version['recommended'], '<' ) ) {
|
387 |
+
// Translators: Placeholders add the PHP version, a link to the ExactMetrics blog and a line break.
|
388 |
+
$message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress is working towards discontinuing support for your PHP version.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-dashboard-for-wp' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
|
389 |
+
}
|
390 |
+
|
391 |
+
if ( $message ) {
|
392 |
+
echo '<div class="error"><p>'. $message.'</p></div>';
|
393 |
+
return;
|
394 |
+
}
|
395 |
+
|
396 |
+
// WordPress 4.9
|
397 |
+
/* else if ( version_compare( $wp_version, '5.0', '<' ) ) {
|
398 |
+
$url = exactmetrics_get_url( 'global-notice', 'settings-page', 'https://www.exactmetrics.com/docs/update-wordpress/' );
|
399 |
+
// Translators: Placeholders add the current WordPress version and links to the ExactMetrics blog
|
400 |
+
$message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sExactMetrics will stop supporting WordPress versions lower than 5.0 in 2021.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-dashboard-for-wp' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
|
401 |
+
echo '<div class="error"><p>'. $message.'</p></div>';
|
402 |
+
return;
|
403 |
+
} */
|
404 |
+
// PHP 5.4/5.5
|
405 |
+
// else if ( version_compare( phpversion(), '5.6', '<' ) ) {
|
406 |
+
// $url = exactmetrics_get_url( 'global-notice', 'settings-page', 'https://www.exactmetrics.com/docs/update-php/' );
|
407 |
+
// $message = sprintf( esc_html__( 'Your site is running an outdated, insecure version of PHP (%1$s), which could be putting your site at risk for being hacked.%4$sWordPress will stop supporting your PHP version in April, 2019.%4$sUpdating PHP only takes a few minutes and will make your website significantly faster and more secure.%4$s%2$sLearn more about updating PHP%3$s', 'google-analytics-dashboard-for-wp' ), phpversion(), '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
|
408 |
+
// echo '<div class="error"><p>'. $message.'</p></div>';
|
409 |
+
// return;
|
410 |
+
// }
|
411 |
+
// // WordPress 4.6 - 4.8
|
412 |
+
// else if ( version_compare( $wp_version, '4.9', '<' ) ) {
|
413 |
+
// $url = exactmetrics_get_url( 'global-notice', 'settings-page', 'https://www.exactmetrics.com/docs/update-wordpress/' );
|
414 |
+
// $message = sprintf( esc_html__( 'Your site is running an outdated version of WordPress (%1$s).%4$sExactMetrics will stop supporting WordPress versions lower than 4.9 in October, 2019.%4$sUpdating WordPress takes just a few minutes and will also solve many bugs that exist in your WordPress install.%4$s%2$sLearn more about updating WordPress%3$s', 'google-analytics-dashboard-for-wp' ), $wp_version, '<a href="' . $url . '" target="_blank">', '</a>', '<br>' );
|
415 |
+
// echo '<div class="error"><p>'. $message.'</p></div>';
|
416 |
+
// return;
|
417 |
+
// }
|
418 |
+
}
|
419 |
+
|
420 |
+
// 5. Optin setting not configured
|
421 |
+
// if ( ! is_network_admin() ) {
|
422 |
+
// if ( ! get_option( 'exactmetrics_tracking_notice' ) ) {
|
423 |
+
// if ( ! exactmetrics_get_option( 'anonymous_data', false ) ) {
|
424 |
+
// if ( ! exactmetrics_is_dev_url( network_site_url( '/' ) ) ) {
|
425 |
+
// if ( exactmetrics_is_pro_version() ) {
|
426 |
+
// exactmetrics_update_option( 'anonymous_data', 1 );
|
427 |
+
// return;
|
428 |
+
// }
|
429 |
+
// $optin_url = add_query_arg( 'mi_action', 'opt_into_tracking' );
|
430 |
+
// $optout_url = add_query_arg( 'mi_action', 'opt_out_of_tracking' );
|
431 |
+
// echo '<div class="updated"><p>';
|
432 |
+
// echo esc_html__( 'Allow ExactMetrics to track plugin usage? Opt-in to tracking and our newsletter to stay informed of the latest changes to ExactMetrics and help us ensure compatibility.', 'google-analytics-dashboard-for-wp' );
|
433 |
+
// echo ' <a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
434 |
+
// echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'google-analytics-dashboard-for-wp' ) . '</a>';
|
435 |
+
// echo '</p></div>';
|
436 |
+
// return;
|
437 |
+
// } else {
|
438 |
+
// // is testing site
|
439 |
+
// update_option( 'exactmetrics_tracking_notice', '1' );
|
440 |
+
// }
|
441 |
+
// }
|
442 |
+
// }
|
443 |
+
// }
|
444 |
+
|
445 |
+
$notices = get_option( 'exactmetrics_notices' );
|
446 |
+
if ( ! is_array( $notices ) ) {
|
447 |
+
$notices = array();
|
448 |
+
}
|
449 |
+
|
450 |
+
// 6. Authenticate, not manual
|
451 |
+
$authed = ExactMetrics()->auth->is_authed() || ExactMetrics()->auth->is_network_authed();
|
452 |
+
$url = is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' );
|
453 |
+
$ua_code = exactmetrics_get_ua_to_output();
|
454 |
+
// Translators: Placeholders add links to the settings panel.
|
455 |
+
$manual_text = sprintf( esc_html__( 'Important: You are currently using manual UA code output. We highly recommend %1$sauthenticating with ExactMetrics%2$s so that you can access our new reporting area and take advantage of new ExactMetrics features.', 'google-analytics-dashboard-for-wp' ), '<a href="' . $url . '">', '</a>' );
|
456 |
+
$migrated = exactmetrics_get_option( 'gadwp_migrated', 0 );
|
457 |
+
if ( $migrated > 0 ) {
|
458 |
+
$url = admin_url( 'admin.php?page=exactmetrics-getting-started&exactmetrics-migration=1' );
|
459 |
+
// Translators: Placeholders add links to the settings panel.
|
460 |
+
$text = esc_html__( 'Click %1$shere%2$s to reauthenticate to be able to access reports. For more information why this is required, see our %3$sblog post%4$s.', 'google-analytics-dashboard-for-wp' );
|
461 |
+
$manual_text = sprintf( $text, '<a href="' . $url . '">', '</a>', '<a href="' . exactmetrics_get_url( 'notice', 'manual-ua', 'https://www.exactmetrics.com/why-did-we-implement-the-new-google-analytics-authentication-flow-challenges-explained/' ) . '" target="_blank">', '</a>' );
|
462 |
+
}
|
463 |
+
|
464 |
+
if ( empty( $authed ) && ! isset( $notices['exactmetrics_auth_not_manual'] ) && ! empty( $ua_code ) ) {
|
465 |
+
echo '<div class="notice notice-info is-dismissible exactmetrics-notice" data-notice="exactmetrics_auth_not_manual">';
|
466 |
+
echo '<p>';
|
467 |
+
echo $manual_text;
|
468 |
+
echo '</p>';
|
469 |
+
echo '</div>';
|
470 |
+
|
471 |
+
return;
|
472 |
+
}
|
473 |
+
|
474 |
+
// 7. Automatic updates not configured
|
475 |
+
// if ( ! is_network_admin() ) {
|
476 |
+
// $updates = exactmetrics_get_option( 'automatic_updates', false );
|
477 |
+
// $url = admin_url( 'admin.php?page=exactmetrics_settings' );
|
478 |
+
|
479 |
+
// if ( empty( $updates) && ! isset( $notices['exactmetrics_automatic_updates' ] ) ) {
|
480 |
+
// echo '<div class="notice notice-info is-dismissible exactmetrics-notice" data-notice="exactmetrics_automatic_updates">';
|
481 |
+
// echo '<p>';
|
482 |
+
// echo sprintf( esc_html__( 'Important: Please %1$sconfigure the Automatic Updates Settings%2$s in ExactMetrics.', 'google-analytics-dashboard-for-wp' ), '<a href="' . $url .'">', '</a>' );
|
483 |
+
// echo '</p>';
|
484 |
+
// echo '</div>';
|
485 |
+
// return;
|
486 |
+
// }
|
487 |
+
// }
|
488 |
+
|
489 |
+
// 8. WooUpsell
|
490 |
+
if ( ! exactmetrics_is_pro_version() && class_exists( 'WooCommerce' ) ) {
|
491 |
+
if ( ! isset( $notices['exactmetrics_woocommerce_tracking_available' ] ) ) {
|
492 |
+
echo '<div class="notice notice-success is-dismissible exactmetrics-notice exactmetrics-wooedd-upsell-row" data-notice="exactmetrics_woocommerce_tracking_available">';
|
493 |
+
echo '<div class="exactmetrics-wooedd-upsell-left">';
|
494 |
+
echo '<p><strong>';
|
495 |
+
echo esc_html( 'Enhanced Ecommerce Analytics for Your WooCommerce Store', 'google-analytics-dashboard-for-wp' );
|
496 |
+
echo '</strong></p>';
|
497 |
+
echo '<img class="exactmetrics-wooedd-upsell-image exactmetrics-wooedd-upsell-image-small" src="' . trailingslashit( EXACTMETRICS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
|
498 |
+
echo '<p>';
|
499 |
+
echo esc_html( 'ExactMetrics Pro gives you detailed stats and insights about your customers.', 'google-analytics-dashboard-for-wp' );
|
500 |
+
echo '</p>';
|
501 |
+
echo '<p>';
|
502 |
+
echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-dashboard-for-wp' );
|
503 |
+
echo '</p>';
|
504 |
+
echo '<p>';
|
505 |
+
echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-dashboard-for-wp' );
|
506 |
+
echo '</p>';
|
507 |
+
echo '<p>';
|
508 |
+
echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-dashboard-for-wp' );
|
509 |
+
echo '</p>';
|
510 |
+
// Translators: Placeholders add a link to the ExactMetrics website.
|
511 |
+
echo sprintf( esc_html__( '%1$sGet ExactMetrics Pro%2$s', 'google-analytics-dashboard-for-wp' ), '<a class="button button-primary button-hero" href="'. exactmetrics_get_upgrade_link( 'admin-notices', 'woocommerce-upgrade' ) .'">', ' »</a>' );
|
512 |
+
echo '</p>';
|
513 |
+
echo '</div><div class="exactmetrics-wooedd-upsell-right">';
|
514 |
+
echo '<img class="exactmetrics-wooedd-upsell-image exactmetrics-wooedd-upsell-image-large" src="' . trailingslashit( EXACTMETRICS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
|
515 |
+
echo '</div>';
|
516 |
+
echo '</div>';
|
517 |
+
echo '<style type="text/css">.exactmetrics-wooedd-upsell-left{width:50%;display:table-cell;float:left}.exactmetrics-wooedd-upsell-right{width:50%;display:table-cell;float:left}.exactmetrics-wooedd-upsell-image{width:100%;height:auto;padding:20px}.exactmetrics-wooedd-upsell-image-small{display:none}.exactmetrics-wooedd-upsell-row{display:table}.exactmetrics-wooedd-upsell-left p{margin:1em 0;font-size:16px}@media (max-width:900px){.exactmetrics-wooedd-upsell-left{width:100%}.exactmetrics-wooedd-upsell-right{display:none}.exactmetrics-wooedd-upsell-image-small{display:block}.exactmetrics-wooedd-upsell-image-large{display:none}}</style>';
|
518 |
+
return;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
// 9. EDDUpsell
|
523 |
+
if ( ! exactmetrics_is_pro_version() && class_exists( 'Easy_Digital_Downloads' ) ) {
|
524 |
+
if ( ! isset( $notices['exactmetrics_edd_tracking_available' ] ) ) {
|
525 |
+
echo '<div class="notice notice-success is-dismissible exactmetrics-notice exactmetrics-wooedd-upsell-row" data-notice="exactmetrics_edd_tracking_available">';
|
526 |
+
echo '<div class="exactmetrics-wooedd-upsell-left">';
|
527 |
+
echo '<p><strong>';
|
528 |
+
echo esc_html( 'Enhanced Ecommerce Analytics for Your Easy Digital Downloads Store', 'google-analytics-dashboard-for-wp' );
|
529 |
+
echo '</strong></p>';
|
530 |
+
echo '<img class="exactmetrics-wooedd-upsell-image exactmetrics-wooedd-upsell-image-small" src="' . trailingslashit( EXACTMETRICS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
|
531 |
+
echo '<p>';
|
532 |
+
echo esc_html( 'ExactMetrics Pro gives you detailed stats and insights about your customers.', 'google-analytics-dashboard-for-wp' );
|
533 |
+
echo '</p>';
|
534 |
+
echo '<p>';
|
535 |
+
echo esc_html( 'This helps you make data-driven decisions about your content, and marketing strategy so you can increase your website traffic, leads, and sales.', 'google-analytics-dashboard-for-wp' );
|
536 |
+
echo '</p>';
|
537 |
+
echo '<p>';
|
538 |
+
echo esc_html( 'Pro customers also get Form Tracking, Custom Dimensions Tracking, UserID Tracking and much more.', 'google-analytics-dashboard-for-wp' );
|
539 |
+
echo '</p>';
|
540 |
+
echo '<p>';
|
541 |
+
echo esc_html( 'Start making data-driven decisions to grow your business.', 'google-analytics-dashboard-for-wp' );
|
542 |
+
echo '</p>';
|
543 |
+
echo sprintf( esc_html__( '%1$sGet ExactMetrics Pro%2$s', 'google-analytics-dashboard-for-wp' ), '<a class="button button-primary button-hero" href="'. exactmetrics_get_upgrade_link( 'admin-notices', 'edd-upgrade' ) .'">', ' »</a>' );
|
544 |
+
echo '</p>';
|
545 |
+
echo '</div><div class="exactmetrics-wooedd-upsell-right">';
|
546 |
+
echo '<img class="exactmetrics-wooedd-upsell-image exactmetrics-wooedd-upsell-image-large" src="' . trailingslashit( EXACTMETRICS_PLUGIN_URL ) . 'assets/images/upsell/woo-edd-upsell.png">';
|
547 |
+
echo '</div>';
|
548 |
+
echo '</div>';
|
549 |
+
return;
|
550 |
+
}
|
551 |
+
}
|
552 |
+
|
553 |
+
if ( isset( $notices['exactmetrics_cross_domains_extracted'] ) && false === $notices['exactmetrics_cross_domains_extracted'] ) {
|
554 |
+
$page = is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' );
|
555 |
+
$page = $page . '#/advanced';
|
556 |
+
// Translators: Adds a link to the settings panel.
|
557 |
+
$message = sprintf( esc_html__( 'Warning: ExactMetrics found cross-domain settings in the custom code field and converted them to the new settings structure. %1$sPlease click here to review and remove the code no longer needed.%2$s', 'google-analytics-dashboard-for-wp' ), '<a href="'. esc_url( $page ) . '">', '</a>' );
|
558 |
+
echo '<div class="notice notice-success is-dismissible exactmetrics-notice" data-notice="exactmetrics_cross_domains_extracted"><p>'. $message.'</p></div>';
|
559 |
+
return;
|
560 |
+
}
|
561 |
+
}
|
562 |
+
add_action( 'admin_notices', 'exactmetrics_admin_setup_notices' );
|
563 |
+
add_action( 'network_admin_notices', 'exactmetrics_admin_setup_notices' );
|
564 |
+
|
565 |
+
|
566 |
+
// AM Notices
|
567 |
+
function exactmetrics_am_notice_optout( $super_admin ) {
|
568 |
+
if ( exactmetrics_get_option( 'hide_am_notices', false ) || exactmetrics_get_option( 'network_hide_am_notices', false ) ) {
|
569 |
+
return false;
|
570 |
+
}
|
571 |
+
return $super_admin;
|
572 |
+
}
|
573 |
+
add_filter( "am_notifications_display", 'exactmetrics_am_notice_optout', 10, 1 );
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Inline critical css for the menu to prevent breaking the layout when our scripts get blocked by browsers.
|
577 |
+
*/
|
578 |
+
function exactmetrics_admin_menu_inline_styles() {
|
579 |
+
?>
|
580 |
+
<style type="text/css">
|
581 |
+
#toplevel_page_exactmetrics_reports .wp-menu-image img,
|
582 |
+
#toplevel_page_exactmetrics_settings .wp-menu-image img,
|
583 |
+
#toplevel_page_exactmetrics_network .wp-menu-image img {
|
584 |
+
width: 18px;
|
585 |
+
height: auto;
|
586 |
+
padding-top: 7px;
|
587 |
+
}
|
588 |
+
</style>
|
589 |
+
<?php
|
590 |
+
}
|
591 |
+
|
592 |
+
add_action( 'admin_head', 'exactmetrics_admin_menu_inline_styles', 300 );
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Display notice in admin when measurement protocol is left blank
|
596 |
+
*/
|
597 |
+
function exactmetrics_empty_measurement_protocol_token() {
|
598 |
+
if ( ! class_exists( 'ExactMetrics_eCommerce' ) && ! class_exists( 'ExactMetrics_Forms' ) ) {
|
599 |
+
return;
|
600 |
+
}
|
601 |
+
|
602 |
+
$page = is_network_admin()
|
603 |
+
? network_admin_url( 'admin.php?page=exactmetrics_network' )
|
604 |
+
: admin_url( 'admin.php?page=exactmetrics_settings' );
|
605 |
+
|
606 |
+
$api_secret = is_network_admin()
|
607 |
+
? ExactMetrics()->auth->get_network_measurement_protocol_secret()
|
608 |
+
: ExactMetrics()->auth->get_measurement_protocol_secret();
|
609 |
+
|
610 |
+
$current_code = exactmetrics_get_v4_id_to_output();
|
611 |
+
|
612 |
+
if ( empty( $current_code ) || ! empty( $api_secret ) ) {
|
613 |
+
return;
|
614 |
+
}
|
615 |
+
|
616 |
+
$message = sprintf(
|
617 |
+
esc_html__(
|
618 |
+
'Your Measurement Protocol API Secret is currently left blank, so you won\'t be able to use some of the tracking features with your GA4 property. %1$sPlease enter your Measurement Protocol API Secret here.%2$s',
|
619 |
+
'google-analytics-dashboard-for-wp'
|
620 |
+
),
|
621 |
+
'<a href="' . esc_url( $page ). '">',
|
622 |
+
'</a>'
|
623 |
+
);
|
624 |
+
echo '<div class="error"><p>'. $message.'</p></div>';
|
625 |
+
}
|
626 |
+
|
627 |
+
add_action( 'admin_notices', 'exactmetrics_empty_measurement_protocol_token' );
|
628 |
+
add_action( 'network_admin_notices', 'exactmetrics_admin_setup_notices' );
|
includes/admin/ajax.php
CHANGED
@@ -1,258 +1,258 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Handles all admin ajax interactions for the ExactMetrics plugin.
|
4 |
-
*
|
5 |
-
* @since 6.0.0
|
6 |
-
*
|
7 |
-
* @package ExactMetrics
|
8 |
-
* @subpackage Ajax
|
9 |
-
* @author Chris Christoff
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Stores a user setting for the logged-in WordPress User
|
19 |
-
*
|
20 |
-
* @access public
|
21 |
-
* @since 6.0.0
|
22 |
-
*/
|
23 |
-
function exactmetrics_ajax_set_user_setting() {
|
24 |
-
|
25 |
-
// Run a security check first.
|
26 |
-
check_ajax_referer( 'exactmetrics-set-user-setting', 'nonce' );
|
27 |
-
|
28 |
-
// Prepare variables.
|
29 |
-
$name = stripslashes( $_POST['name'] );
|
30 |
-
$value = stripslashes( $_POST['value'] );
|
31 |
-
|
32 |
-
// Set user setting.
|
33 |
-
set_user_setting( $name, $value );
|
34 |
-
|
35 |
-
// Send back the response.
|
36 |
-
wp_send_json_success();
|
37 |
-
wp_die();
|
38 |
-
|
39 |
-
}
|
40 |
-
add_action( 'wp_ajax_exactmetrics_install_addon', 'exactmetrics_ajax_install_addon' );
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Installs a ExactMetrics addon.
|
44 |
-
*
|
45 |
-
* @access public
|
46 |
-
* @since 6.0.0
|
47 |
-
*/
|
48 |
-
function exactmetrics_ajax_install_addon() {
|
49 |
-
|
50 |
-
// Run a security check first.
|
51 |
-
check_ajax_referer( 'exactmetrics-install', 'nonce' );
|
52 |
-
|
53 |
-
if ( ! exactmetrics_can_install_plugins() ) {
|
54 |
-
wp_send_json( array(
|
55 |
-
'error' => esc_html__( 'You are not allowed to install plugins', 'google-analytics-dashboard-for-wp' ),
|
56 |
-
) );
|
57 |
-
}
|
58 |
-
|
59 |
-
// Install the addon.
|
60 |
-
if ( isset( $_POST['plugin'] ) ) {
|
61 |
-
$download_url = $_POST['plugin'];
|
62 |
-
global $hook_suffix;
|
63 |
-
|
64 |
-
// Set the current screen to avoid undefined notices.
|
65 |
-
set_current_screen();
|
66 |
-
|
67 |
-
// Prepare variables.
|
68 |
-
$method = '';
|
69 |
-
$url = add_query_arg(
|
70 |
-
array(
|
71 |
-
'page' => 'exactmetrics-settings'
|
72 |
-
),
|
73 |
-
admin_url( 'admin.php' )
|
74 |
-
);
|
75 |
-
$url = esc_url( $url );
|
76 |
-
|
77 |
-
// Start output bufferring to catch the filesystem form if credentials are needed.
|
78 |
-
ob_start();
|
79 |
-
if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
|
80 |
-
$form = ob_get_clean();
|
81 |
-
echo json_encode( array( 'form' => $form ) );
|
82 |
-
wp_die();
|
83 |
-
}
|
84 |
-
|
85 |
-
// If we are not authenticated, make it happen now.
|
86 |
-
if ( ! WP_Filesystem( $creds ) ) {
|
87 |
-
ob_start();
|
88 |
-
request_filesystem_credentials( $url, $method, true, false, null );
|
89 |
-
$form = ob_get_clean();
|
90 |
-
echo json_encode( array( 'form' => $form ) );
|
91 |
-
wp_die();
|
92 |
-
}
|
93 |
-
|
94 |
-
// We do not need any extra credentials if we have gotten this far, so let's install the plugin.
|
95 |
-
exactmetrics_require_upgrader( false );
|
96 |
-
|
97 |
-
// Create the plugin upgrader with our custom skin.
|
98 |
-
$installer = new Plugin_Upgrader( $skin = new ExactMetrics_Skin() );
|
99 |
-
$installer->install( $download_url );
|
100 |
-
|
101 |
-
// Flush the cache and return the newly installed plugin basename.
|
102 |
-
wp_cache_flush();
|
103 |
-
if ( $installer->plugin_info() ) {
|
104 |
-
$plugin_basename = $installer->plugin_info();
|
105 |
-
echo json_encode( array( 'plugin' => $plugin_basename ) );
|
106 |
-
wp_die();
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
// Send back a response.
|
111 |
-
echo json_encode( true );
|
112 |
-
wp_die();
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
add_action( 'wp_ajax_exactmetrics_activate_addon', 'exactmetrics_ajax_activate_addon' );
|
117 |
-
/**
|
118 |
-
* Activates a ExactMetrics addon.
|
119 |
-
*
|
120 |
-
* @access public
|
121 |
-
* @since 6.0.0
|
122 |
-
*/
|
123 |
-
function exactmetrics_ajax_activate_addon() {
|
124 |
-
|
125 |
-
// Run a security check first.
|
126 |
-
check_ajax_referer( 'exactmetrics-activate', 'nonce' );
|
127 |
-
|
128 |
-
if ( ! current_user_can( 'activate_plugins' ) ) {
|
129 |
-
wp_send_json( array(
|
130 |
-
'error' => esc_html__( 'You are not allowed to activate plugins', 'google-analytics-dashboard-for-wp' ),
|
131 |
-
) );
|
132 |
-
}
|
133 |
-
|
134 |
-
// Activate the addon.
|
135 |
-
if ( isset( $_POST['plugin'] ) ) {
|
136 |
-
if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
|
137 |
-
$activate = activate_plugin( $_POST['plugin'], NULL, true );
|
138 |
-
} else {
|
139 |
-
$activate = activate_plugin( $_POST['plugin'] );
|
140 |
-
}
|
141 |
-
|
142 |
-
if ( is_wp_error( $activate ) ) {
|
143 |
-
echo json_encode( array( 'error' => $activate->get_error_message() ) );
|
144 |
-
wp_die();
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
echo json_encode( true );
|
149 |
-
wp_die();
|
150 |
-
|
151 |
-
}
|
152 |
-
|
153 |
-
add_action( 'wp_ajax_exactmetrics_deactivate_addon', 'exactmetrics_ajax_deactivate_addon' );
|
154 |
-
/**
|
155 |
-
* Deactivates a ExactMetrics addon.
|
156 |
-
*
|
157 |
-
* @access public
|
158 |
-
* @since 6.0.0
|
159 |
-
*/
|
160 |
-
function exactmetrics_ajax_deactivate_addon() {
|
161 |
-
|
162 |
-
// Run a security check first.
|
163 |
-
check_ajax_referer( 'exactmetrics-deactivate', 'nonce' );
|
164 |
-
|
165 |
-
if ( ! current_user_can( 'deactivate_plugins' ) ) {
|
166 |
-
wp_send_json( array(
|
167 |
-
'error' => esc_html__( 'You are not allowed to deactivate plugins', 'google-analytics-dashboard-for-wp' ),
|
168 |
-
) );
|
169 |
-
}
|
170 |
-
|
171 |
-
// Deactivate the addon.
|
172 |
-
if ( isset( $_POST['plugin'] ) ) {
|
173 |
-
if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
|
174 |
-
$deactivate = deactivate_plugins( $_POST['plugin'], false, true );
|
175 |
-
} else {
|
176 |
-
$deactivate = deactivate_plugins( $_POST['plugin'] );
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
echo json_encode( true );
|
181 |
-
wp_die();
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Called whenever a notice is dismissed in ExactMetrics or its Addons.
|
186 |
-
*
|
187 |
-
* Updates a key's value in the options table to mark the notice as dismissed,
|
188 |
-
* preventing it from displaying again
|
189 |
-
*
|
190 |
-
* @access public
|
191 |
-
* @since 6.0.0
|
192 |
-
*/
|
193 |
-
function exactmetrics_ajax_dismiss_notice() {
|
194 |
-
|
195 |
-
// Run a security check first.
|
196 |
-
check_ajax_referer( 'exactmetrics-dismiss-notice', 'nonce' );
|
197 |
-
|
198 |
-
// Deactivate the notice
|
199 |
-
if ( isset( $_POST['notice'] ) ) {
|
200 |
-
// Init the notice class and mark notice as deactivated
|
201 |
-
ExactMetrics()->notices->dismiss( $_POST['notice'] );
|
202 |
-
|
203 |
-
// Return true
|
204 |
-
echo json_encode( true );
|
205 |
-
wp_die();
|
206 |
-
}
|
207 |
-
|
208 |
-
// If here, an error occurred
|
209 |
-
echo json_encode( false );
|
210 |
-
wp_die();
|
211 |
-
|
212 |
-
}
|
213 |
-
add_action( 'wp_ajax_exactmetrics_ajax_dismiss_notice', 'exactmetrics_ajax_dismiss_notice' );
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Dismiss SEMRush CTA
|
217 |
-
*
|
218 |
-
* @access public
|
219 |
-
* @since 7.12.3
|
220 |
-
*/
|
221 |
-
function exactmetrics_ajax_dismiss_semrush_cta() {
|
222 |
-
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
223 |
-
|
224 |
-
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
225 |
-
return;
|
226 |
-
}
|
227 |
-
|
228 |
-
// Deactivate the notice
|
229 |
-
if ( update_option( 'exactmetrics_dismiss_semrush_cta', 'yes' ) ) {
|
230 |
-
// Return true
|
231 |
-
wp_send_json( array(
|
232 |
-
'dismissed' => 'yes',
|
233 |
-
) );
|
234 |
-
wp_die();
|
235 |
-
}
|
236 |
-
|
237 |
-
// If here, an error occurred
|
238 |
-
wp_send_json( array(
|
239 |
-
'dismissed' => 'no',
|
240 |
-
) );
|
241 |
-
wp_die();
|
242 |
-
}
|
243 |
-
add_action( 'wp_ajax_exactmetrics_vue_dismiss_semrush_cta', 'exactmetrics_ajax_dismiss_semrush_cta' );
|
244 |
-
|
245 |
-
/**
|
246 |
-
* Get the sem rush cta dismiss status value
|
247 |
-
*/
|
248 |
-
function exactmetrics_get_sem_rush_cta_status() {
|
249 |
-
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
250 |
-
|
251 |
-
$dismissed_cta = get_option( 'exactmetrics_dismiss_semrush_cta', 'no' );
|
252 |
-
|
253 |
-
wp_send_json( array(
|
254 |
-
'dismissed' => $dismissed_cta,
|
255 |
-
) );
|
256 |
-
}
|
257 |
-
|
258 |
-
add_action( 'wp_ajax_exactmetrics_get_sem_rush_cta_status', 'exactmetrics_get_sem_rush_cta_status' );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles all admin ajax interactions for the ExactMetrics plugin.
|
4 |
+
*
|
5 |
+
* @since 6.0.0
|
6 |
+
*
|
7 |
+
* @package ExactMetrics
|
8 |
+
* @subpackage Ajax
|
9 |
+
* @author Chris Christoff
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Stores a user setting for the logged-in WordPress User
|
19 |
+
*
|
20 |
+
* @access public
|
21 |
+
* @since 6.0.0
|
22 |
+
*/
|
23 |
+
function exactmetrics_ajax_set_user_setting() {
|
24 |
+
|
25 |
+
// Run a security check first.
|
26 |
+
check_ajax_referer( 'exactmetrics-set-user-setting', 'nonce' );
|
27 |
+
|
28 |
+
// Prepare variables.
|
29 |
+
$name = stripslashes( $_POST['name'] );
|
30 |
+
$value = stripslashes( $_POST['value'] );
|
31 |
+
|
32 |
+
// Set user setting.
|
33 |
+
set_user_setting( $name, $value );
|
34 |
+
|
35 |
+
// Send back the response.
|
36 |
+
wp_send_json_success();
|
37 |
+
wp_die();
|
38 |
+
|
39 |
+
}
|
40 |
+
add_action( 'wp_ajax_exactmetrics_install_addon', 'exactmetrics_ajax_install_addon' );
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Installs a ExactMetrics addon.
|
44 |
+
*
|
45 |
+
* @access public
|
46 |
+
* @since 6.0.0
|
47 |
+
*/
|
48 |
+
function exactmetrics_ajax_install_addon() {
|
49 |
+
|
50 |
+
// Run a security check first.
|
51 |
+
check_ajax_referer( 'exactmetrics-install', 'nonce' );
|
52 |
+
|
53 |
+
if ( ! exactmetrics_can_install_plugins() ) {
|
54 |
+
wp_send_json( array(
|
55 |
+
'error' => esc_html__( 'You are not allowed to install plugins', 'google-analytics-dashboard-for-wp' ),
|
56 |
+
) );
|
57 |
+
}
|
58 |
+
|
59 |
+
// Install the addon.
|
60 |
+
if ( isset( $_POST['plugin'] ) ) {
|
61 |
+
$download_url = $_POST['plugin'];
|
62 |
+
global $hook_suffix;
|
63 |
+
|
64 |
+
// Set the current screen to avoid undefined notices.
|
65 |
+
set_current_screen();
|
66 |
+
|
67 |
+
// Prepare variables.
|
68 |
+
$method = '';
|
69 |
+
$url = add_query_arg(
|
70 |
+
array(
|
71 |
+
'page' => 'exactmetrics-settings'
|
72 |
+
),
|
73 |
+
admin_url( 'admin.php' )
|
74 |
+
);
|
75 |
+
$url = esc_url( $url );
|
76 |
+
|
77 |
+
// Start output bufferring to catch the filesystem form if credentials are needed.
|
78 |
+
ob_start();
|
79 |
+
if ( false === ( $creds = request_filesystem_credentials( $url, $method, false, false, null ) ) ) {
|
80 |
+
$form = ob_get_clean();
|
81 |
+
echo json_encode( array( 'form' => $form ) );
|
82 |
+
wp_die();
|
83 |
+
}
|
84 |
+
|
85 |
+
// If we are not authenticated, make it happen now.
|
86 |
+
if ( ! WP_Filesystem( $creds ) ) {
|
87 |
+
ob_start();
|
88 |
+
request_filesystem_credentials( $url, $method, true, false, null );
|
89 |
+
$form = ob_get_clean();
|
90 |
+
echo json_encode( array( 'form' => $form ) );
|
91 |
+
wp_die();
|
92 |
+
}
|
93 |
+
|
94 |
+
// We do not need any extra credentials if we have gotten this far, so let's install the plugin.
|
95 |
+
exactmetrics_require_upgrader( false );
|
96 |
+
|
97 |
+
// Create the plugin upgrader with our custom skin.
|
98 |
+
$installer = new Plugin_Upgrader( $skin = new ExactMetrics_Skin() );
|
99 |
+
$installer->install( $download_url );
|
100 |
+
|
101 |
+
// Flush the cache and return the newly installed plugin basename.
|
102 |
+
wp_cache_flush();
|
103 |
+
if ( $installer->plugin_info() ) {
|
104 |
+
$plugin_basename = $installer->plugin_info();
|
105 |
+
echo json_encode( array( 'plugin' => $plugin_basename ) );
|
106 |
+
wp_die();
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
// Send back a response.
|
111 |
+
echo json_encode( true );
|
112 |
+
wp_die();
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
add_action( 'wp_ajax_exactmetrics_activate_addon', 'exactmetrics_ajax_activate_addon' );
|
117 |
+
/**
|
118 |
+
* Activates a ExactMetrics addon.
|
119 |
+
*
|
120 |
+
* @access public
|
121 |
+
* @since 6.0.0
|
122 |
+
*/
|
123 |
+
function exactmetrics_ajax_activate_addon() {
|
124 |
+
|
125 |
+
// Run a security check first.
|
126 |
+
check_ajax_referer( 'exactmetrics-activate', 'nonce' );
|
127 |
+
|
128 |
+
if ( ! current_user_can( 'activate_plugins' ) ) {
|
129 |
+
wp_send_json( array(
|
130 |
+
'error' => esc_html__( 'You are not allowed to activate plugins', 'google-analytics-dashboard-for-wp' ),
|
131 |
+
) );
|
132 |
+
}
|
133 |
+
|
134 |
+
// Activate the addon.
|
135 |
+
if ( isset( $_POST['plugin'] ) ) {
|
136 |
+
if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
|
137 |
+
$activate = activate_plugin( $_POST['plugin'], NULL, true );
|
138 |
+
} else {
|
139 |
+
$activate = activate_plugin( $_POST['plugin'] );
|
140 |
+
}
|
141 |
+
|
142 |
+
if ( is_wp_error( $activate ) ) {
|
143 |
+
echo json_encode( array( 'error' => $activate->get_error_message() ) );
|
144 |
+
wp_die();
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
echo json_encode( true );
|
149 |
+
wp_die();
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
add_action( 'wp_ajax_exactmetrics_deactivate_addon', 'exactmetrics_ajax_deactivate_addon' );
|
154 |
+
/**
|
155 |
+
* Deactivates a ExactMetrics addon.
|
156 |
+
*
|
157 |
+
* @access public
|
158 |
+
* @since 6.0.0
|
159 |
+
*/
|
160 |
+
function exactmetrics_ajax_deactivate_addon() {
|
161 |
+
|
162 |
+
// Run a security check first.
|
163 |
+
check_ajax_referer( 'exactmetrics-deactivate', 'nonce' );
|
164 |
+
|
165 |
+
if ( ! current_user_can( 'deactivate_plugins' ) ) {
|
166 |
+
wp_send_json( array(
|
167 |
+
'error' => esc_html__( 'You are not allowed to deactivate plugins', 'google-analytics-dashboard-for-wp' ),
|
168 |
+
) );
|
169 |
+
}
|
170 |
+
|
171 |
+
// Deactivate the addon.
|
172 |
+
if ( isset( $_POST['plugin'] ) ) {
|
173 |
+
if ( isset( $_POST['isnetwork'] ) && $_POST['isnetwork'] ) {
|
174 |
+
$deactivate = deactivate_plugins( $_POST['plugin'], false, true );
|
175 |
+
} else {
|
176 |
+
$deactivate = deactivate_plugins( $_POST['plugin'] );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
echo json_encode( true );
|
181 |
+
wp_die();
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Called whenever a notice is dismissed in ExactMetrics or its Addons.
|
186 |
+
*
|
187 |
+
* Updates a key's value in the options table to mark the notice as dismissed,
|
188 |
+
* preventing it from displaying again
|
189 |
+
*
|
190 |
+
* @access public
|
191 |
+
* @since 6.0.0
|
192 |
+
*/
|
193 |
+
function exactmetrics_ajax_dismiss_notice() {
|
194 |
+
|
195 |
+
// Run a security check first.
|
196 |
+
check_ajax_referer( 'exactmetrics-dismiss-notice', 'nonce' );
|
197 |
+
|
198 |
+
// Deactivate the notice
|
199 |
+
if ( isset( $_POST['notice'] ) ) {
|
200 |
+
// Init the notice class and mark notice as deactivated
|
201 |
+
ExactMetrics()->notices->dismiss( $_POST['notice'] );
|
202 |
+
|
203 |
+
// Return true
|
204 |
+
echo json_encode( true );
|
205 |
+
wp_die();
|
206 |
+
}
|
207 |
+
|
208 |
+
// If here, an error occurred
|
209 |
+
echo json_encode( false );
|
210 |
+
wp_die();
|
211 |
+
|
212 |
+
}
|
213 |
+
add_action( 'wp_ajax_exactmetrics_ajax_dismiss_notice', 'exactmetrics_ajax_dismiss_notice' );
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Dismiss SEMRush CTA
|
217 |
+
*
|
218 |
+
* @access public
|
219 |
+
* @since 7.12.3
|
220 |
+
*/
|
221 |
+
function exactmetrics_ajax_dismiss_semrush_cta() {
|
222 |
+
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
223 |
+
|
224 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
225 |
+
return;
|
226 |
+
}
|
227 |
+
|
228 |
+
// Deactivate the notice
|
229 |
+
if ( update_option( 'exactmetrics_dismiss_semrush_cta', 'yes' ) ) {
|
230 |
+
// Return true
|
231 |
+
wp_send_json( array(
|
232 |
+
'dismissed' => 'yes',
|
233 |
+
) );
|
234 |
+
wp_die();
|
235 |
+
}
|
236 |
+
|
237 |
+
// If here, an error occurred
|
238 |
+
wp_send_json( array(
|
239 |
+
'dismissed' => 'no',
|
240 |
+
) );
|
241 |
+
wp_die();
|
242 |
+
}
|
243 |
+
add_action( 'wp_ajax_exactmetrics_vue_dismiss_semrush_cta', 'exactmetrics_ajax_dismiss_semrush_cta' );
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Get the sem rush cta dismiss status value
|
247 |
+
*/
|
248 |
+
function exactmetrics_get_sem_rush_cta_status() {
|
249 |
+
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
250 |
+
|
251 |
+
$dismissed_cta = get_option( 'exactmetrics_dismiss_semrush_cta', 'no' );
|
252 |
+
|
253 |
+
wp_send_json( array(
|
254 |
+
'dismissed' => $dismissed_cta,
|
255 |
+
) );
|
256 |
+
}
|
257 |
+
|
258 |
+
add_action( 'wp_ajax_exactmetrics_get_sem_rush_cta_status', 'exactmetrics_get_sem_rush_cta_status' );
|
includes/admin/api-auth.php
CHANGED
@@ -1,591 +1,670 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Google Client admin class.
|
4 |
-
*
|
5 |
-
* Handles retrieving whether a particular notice has been dismissed or not,
|
6 |
-
* as well as marking a notice as dismissed.
|
7 |
-
*
|
8 |
-
* @since 7.0.0
|
9 |
-
*
|
10 |
-
* @package ExactMetrics
|
11 |
-
* @subpackage GA Client
|
12 |
-
* @author Chris Christoff
|
13 |
-
*/
|
14 |
-
|
15 |
-
// Exit if accessed directly
|
16 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
-
exit;
|
18 |
-
}
|
19 |
-
|
20 |
-
final class ExactMetrics_API_Auth {
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Primary class constructor.
|
24 |
-
*
|
25 |
-
* @access public
|
26 |
-
* @since 7.0.0
|
27 |
-
*/
|
28 |
-
public function __construct() {
|
29 |
-
|
30 |
-
// Authentication Actions
|
31 |
-
add_action( 'wp_ajax_exactmetrics_maybe_authenticate', array( $this, 'maybe_authenticate' ) );
|
32 |
-
add_action( 'wp_ajax_exactmetrics_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) );
|
33 |
-
add_action( 'wp_ajax_exactmetrics_maybe_verify', array( $this, 'maybe_verify' ) );
|
34 |
-
add_action( 'wp_ajax_exactmetrics_maybe_delete', array( $this, 'maybe_delete' ) );
|
35 |
-
|
36 |
-
add_action( 'admin_init', array( $this, 'authenticate_listener' ) );
|
37 |
-
add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) );
|
38 |
-
|
39 |
-
add_action( 'wp_ajax_nopriv_exactmetrics_is_installed', array( $this, 'is_installed' ) );
|
40 |
-
add_action( 'wp_ajax_nopriv_exactmetrics_rauthenticate', array( $this, 'rauthenticate' ) );
|
41 |
-
|
42 |
-
add_filter( 'exactmetrics_maybe_authenticate_siteurl', array( $this, 'before_redirect' ) );
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
wp_send_json_error( array( 'message' => __( "Cannot
|
105 |
-
}
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
'
|
114 |
-
'
|
115 |
-
'
|
116 |
-
'
|
117 |
-
'
|
118 |
-
'
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
);
|
159 |
-
}
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
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 |
-
'ua'
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
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 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
if (
|
403 |
-
|
404 |
-
}
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
$
|
438 |
-
|
439 |
-
$
|
440 |
-
if (
|
441 |
-
|
442 |
-
} else {
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
if (
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
'
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
$api->
|
518 |
-
$ret
|
519 |
-
|
520 |
-
$this->rotate_tt();
|
521 |
-
if ( is_wp_error( $ret ) ) {
|
522 |
-
return false;
|
523 |
-
} else {
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
}
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
$
|
556 |
-
$
|
557 |
-
|
558 |
-
$
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Google Client admin class.
|
4 |
+
*
|
5 |
+
* Handles retrieving whether a particular notice has been dismissed or not,
|
6 |
+
* as well as marking a notice as dismissed.
|
7 |
+
*
|
8 |
+
* @since 7.0.0
|
9 |
+
*
|
10 |
+
* @package ExactMetrics
|
11 |
+
* @subpackage GA Client
|
12 |
+
* @author Chris Christoff
|
13 |
+
*/
|
14 |
+
|
15 |
+
// Exit if accessed directly
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
+
exit;
|
18 |
+
}
|
19 |
+
|
20 |
+
final class ExactMetrics_API_Auth {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Primary class constructor.
|
24 |
+
*
|
25 |
+
* @access public
|
26 |
+
* @since 7.0.0
|
27 |
+
*/
|
28 |
+
public function __construct() {
|
29 |
+
|
30 |
+
// Authentication Actions
|
31 |
+
add_action( 'wp_ajax_exactmetrics_maybe_authenticate', array( $this, 'maybe_authenticate' ) );
|
32 |
+
add_action( 'wp_ajax_exactmetrics_maybe_reauthenticate', array( $this, 'maybe_reauthenticate' ) );
|
33 |
+
add_action( 'wp_ajax_exactmetrics_maybe_verify', array( $this, 'maybe_verify' ) );
|
34 |
+
add_action( 'wp_ajax_exactmetrics_maybe_delete', array( $this, 'maybe_delete' ) );
|
35 |
+
|
36 |
+
add_action( 'admin_init', array( $this, 'authenticate_listener' ) );
|
37 |
+
add_action( 'admin_init', array( $this, 'reauthenticate_listener' ) );
|
38 |
+
|
39 |
+
add_action( 'wp_ajax_nopriv_exactmetrics_is_installed', array( $this, 'is_installed' ) );
|
40 |
+
add_action( 'wp_ajax_nopriv_exactmetrics_rauthenticate', array( $this, 'rauthenticate' ) );
|
41 |
+
|
42 |
+
add_filter( 'exactmetrics_maybe_authenticate_siteurl', array( $this, 'before_redirect' ) );
|
43 |
+
|
44 |
+
add_action( 'wp_ajax_nopriv_exactmetrics_push_mp_token', array( $this, 'handle_relay_mp_token_push' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
public function get_tt(){
|
48 |
+
$tt = is_network_admin() ? get_site_option( 'exactmetrics_network_tt', '' ) : get_option( 'exactmetrics_site_tt', '' );
|
49 |
+
if ( empty( $tt ) ) {
|
50 |
+
// if TT is empty, generate a new one, save it and then return it
|
51 |
+
$tt = $this->generate_tt();
|
52 |
+
$this->is_network_admin() ? update_site_option( 'exactmetrics_network_tt', $tt ) : update_option( 'exactmetrics_site_tt', $tt );
|
53 |
+
}
|
54 |
+
return $tt;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function rotate_tt(){
|
58 |
+
$tt = $this->generate_tt();
|
59 |
+
is_network_admin() ? update_site_option( 'exactmetrics_network_tt', $tt ) : update_option( 'exactmetrics_site_tt', $tt );
|
60 |
+
}
|
61 |
+
|
62 |
+
public function generate_tt(){
|
63 |
+
return hash( 'sha512', wp_generate_password( 128, true, true ) . AUTH_SALT . uniqid( "", true ) );
|
64 |
+
}
|
65 |
+
|
66 |
+
public function validate_tt( $passed_tt = '' ) {
|
67 |
+
$tt = $this->get_tt();
|
68 |
+
return hash_equals( $tt, $passed_tt );
|
69 |
+
}
|
70 |
+
|
71 |
+
public function is_installed() {
|
72 |
+
wp_send_json_success(
|
73 |
+
array(
|
74 |
+
'version' => EXACTMETRICS_VERSION,
|
75 |
+
'pro' => exactmetrics_is_pro_version(),
|
76 |
+
)
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
public function maybe_authenticate(){
|
81 |
+
|
82 |
+
// Check nonce
|
83 |
+
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
84 |
+
|
85 |
+
// current user can authenticate
|
86 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
87 |
+
wp_send_json_error( array( 'message' => __( "You don't have permission to authenticate ExactMetrics.", 'google-analytics-dashboard-for-wp' ) ) );
|
88 |
+
}
|
89 |
+
|
90 |
+
if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
|
91 |
+
define( 'WP_NETWORK_ADMIN', true );
|
92 |
+
}
|
93 |
+
|
94 |
+
// Only for Pro users, require a license key to be entered first so we can link to things.
|
95 |
+
if ( exactmetrics_is_pro_version() ) {
|
96 |
+
$valid = is_network_admin() ? ExactMetrics()->license->is_network_licensed() : ExactMetrics()->license->is_site_licensed();
|
97 |
+
if ( ! $valid ) {
|
98 |
+
wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please enter a valid, active license key for ExactMetrics Pro into the settings.", 'google-analytics-dashboard-for-wp' ) ) );
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
// we do not have a current auth
|
103 |
+
if ( ! $this->is_network_admin() && ExactMetrics()->auth->is_authed() ) {
|
104 |
+
wp_send_json_error( array( 'message' => __( "Cannot authenticate. Please re-authenticate.", 'google-analytics-dashboard-for-wp' ) ) );
|
105 |
+
} else if ( $this->is_network_admin() && ExactMetrics()->auth->is_network_authed() ) {
|
106 |
+
wp_send_json_error( array( 'message' => __( "Cannot network authenticate. Please re-authenticate on the network settings panel.", 'google-analytics-dashboard-for-wp' ) ) );
|
107 |
+
}
|
108 |
+
|
109 |
+
$sitei = $this->get_sitei();
|
110 |
+
//update_network_option( get_current_network_id(), 'exactmetrics_network_sitei', $sitei );
|
111 |
+
|
112 |
+
$siteurl = add_query_arg( array(
|
113 |
+
'tt' => $this->get_tt(),
|
114 |
+
'sitei' => $sitei,
|
115 |
+
'miversion' => EXACTMETRICS_VERSION,
|
116 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
117 |
+
'network' => is_network_admin() ? 'network' : 'site',
|
118 |
+
'siteurl' => is_network_admin() ? network_admin_url() : site_url(),
|
119 |
+
'return' => is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' ),
|
120 |
+
'testurl' => 'https://' . exactmetrics_get_api_url() . 'test/',
|
121 |
+
), $this->get_route( 'https://' . exactmetrics_get_api_url() . 'auth/new/{type}' ) );
|
122 |
+
|
123 |
+
if ( exactmetrics_is_pro_version() ) {
|
124 |
+
$key = is_network_admin() ? ExactMetrics()->license->get_network_license_key() : ExactMetrics()->license->get_site_license_key();
|
125 |
+
$siteurl = add_query_arg( 'license', $key, $siteurl );
|
126 |
+
}
|
127 |
+
|
128 |
+
$siteurl = apply_filters( 'exactmetrics_maybe_authenticate_siteurl', $siteurl );
|
129 |
+
wp_send_json_success( array( 'redirect' => $siteurl ) );
|
130 |
+
}
|
131 |
+
|
132 |
+
private function send_missing_args_error( $arg ) {
|
133 |
+
wp_send_json_error(
|
134 |
+
array(
|
135 |
+
'error' => 'authenticate_missing_arg',
|
136 |
+
'message' => 'Authenticate missing parameter: ' . $arg,
|
137 |
+
'version' => EXACTMETRICS_VERSION,
|
138 |
+
'pro' => exactmetrics_is_pro_version(),
|
139 |
+
)
|
140 |
+
);
|
141 |
+
}
|
142 |
+
|
143 |
+
public function rauthenticate() {
|
144 |
+
// Check for missing params
|
145 |
+
$reqd_args = array( 'key', 'token', 'miview', 'a', 'w', 'p', 'tt', 'network' );
|
146 |
+
|
147 |
+
if ( empty( $_REQUEST['ua'] ) && empty( $_REQUEST['v4'] ) ) {
|
148 |
+
$this->send_missing_args_error( 'ua/v4' );
|
149 |
+
}
|
150 |
+
|
151 |
+
foreach ( $reqd_args as $arg ) {
|
152 |
+
if ( empty( $_REQUEST[$arg] ) ) {
|
153 |
+
$this->send_missing_args_error( $arg );
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
if ( ! empty( $_REQUEST['network'] ) && 'network' === $_REQUEST['network'] ) {
|
158 |
+
define( 'WP_NETWORK_ADMIN', true );
|
159 |
+
}
|
160 |
+
|
161 |
+
if ( ! $this->validate_tt( $_REQUEST['tt'] ) ) {
|
162 |
+
wp_send_json_error(
|
163 |
+
array(
|
164 |
+
'error' => 'authenticate_invalid_tt',
|
165 |
+
'message' => 'Invalid TT sent',
|
166 |
+
'version' => EXACTMETRICS_VERSION,
|
167 |
+
'pro' => exactmetrics_is_pro_version(),
|
168 |
+
)
|
169 |
+
);
|
170 |
+
}
|
171 |
+
|
172 |
+
// If the tt is validated, send a success response to trigger the regular auth process.
|
173 |
+
wp_send_json_success();
|
174 |
+
}
|
175 |
+
|
176 |
+
public function authenticate_listener(){
|
177 |
+
// Make sure it's for us
|
178 |
+
if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'auth' ) {
|
179 |
+
return;
|
180 |
+
}
|
181 |
+
|
182 |
+
// User can authenticate
|
183 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
184 |
+
return;
|
185 |
+
}
|
186 |
+
|
187 |
+
// Invalid request
|
188 |
+
if ( empty( $_REQUEST['tt'] ) || ! $this->validate_tt( $_REQUEST['tt'] ) ) {
|
189 |
+
return;
|
190 |
+
}
|
191 |
+
|
192 |
+
// Make sure has required params
|
193 |
+
if (
|
194 |
+
empty( $_REQUEST['key'] ) ||
|
195 |
+
empty( $_REQUEST['token'] ) ||
|
196 |
+
empty( $_REQUEST['miview'] ) ||
|
197 |
+
empty( $_REQUEST['a'] ) ||
|
198 |
+
empty( $_REQUEST['w'] ) ||
|
199 |
+
empty( $_REQUEST['p'] ) ||
|
200 |
+
( empty( $_REQUEST['ua'] ) && empty( $_REQUEST['v4'] ) )
|
201 |
+
) {
|
202 |
+
return;
|
203 |
+
}
|
204 |
+
|
205 |
+
if ( ! empty( $_REQUEST['ua'] ) ) {
|
206 |
+
$code_key = 'ua';
|
207 |
+
$code_value = exactmetrics_is_valid_ua( $_REQUEST['ua'] );
|
208 |
+
} else if ( ! empty( $_REQUEST['v4'] ) ) {
|
209 |
+
$code_key = 'v4';
|
210 |
+
$code_value = exactmetrics_is_valid_v4_id( $_REQUEST['v4'] );
|
211 |
+
}
|
212 |
+
|
213 |
+
if ( empty( $code_value ) ) {
|
214 |
+
return;
|
215 |
+
}
|
216 |
+
|
217 |
+
$profile = array(
|
218 |
+
'key' => sanitize_text_field( $_REQUEST['key'] ),
|
219 |
+
'token' => sanitize_text_field( $_REQUEST['token'] ),
|
220 |
+
'viewname' => sanitize_text_field( $_REQUEST['miview'] ),
|
221 |
+
'a' => sanitize_text_field( $_REQUEST['a'] ), // AccountID
|
222 |
+
'w' => sanitize_text_field( $_REQUEST['w'] ), // PropertyID
|
223 |
+
'p' => sanitize_text_field( $_REQUEST['p'] ), // View ID
|
224 |
+
'siteurl' => site_url(),
|
225 |
+
'neturl' => network_admin_url(),
|
226 |
+
'connectedtype' => $code_key,
|
227 |
+
);
|
228 |
+
|
229 |
+
if ( ! empty( $_REQUEST['mp'] ) ) {
|
230 |
+
$profile['measurement_protocol_secret'] = sanitize_text_field( $_REQUEST['mp'] );
|
231 |
+
}
|
232 |
+
|
233 |
+
$profile[ $code_key ] = $code_value;
|
234 |
+
|
235 |
+
$worked = $this->verify_auth( $profile );
|
236 |
+
if ( ! $worked || is_wp_error( $worked ) ) {
|
237 |
+
return;
|
238 |
+
}
|
239 |
+
|
240 |
+
// Save Profile
|
241 |
+
$this->is_network_admin() ? ExactMetrics()->auth->set_network_analytics_profile( $profile ) : ExactMetrics()->auth->set_analytics_profile( $profile );
|
242 |
+
|
243 |
+
// Clear cache
|
244 |
+
$where = $this->is_network_admin() ? 'network' : 'site';
|
245 |
+
ExactMetrics()->reporting->delete_aggregate_data( $where );
|
246 |
+
|
247 |
+
$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' ) ;
|
248 |
+
$url = add_query_arg( array(
|
249 |
+
'mi_action' => 'auth',
|
250 |
+
'success' => 'true',
|
251 |
+
), $url );
|
252 |
+
$url = apply_filters( 'exactmetrics_auth_success_redirect_url', $url );
|
253 |
+
wp_safe_redirect( $url );
|
254 |
+
exit;
|
255 |
+
}
|
256 |
+
|
257 |
+
public function maybe_reauthenticate(){
|
258 |
+
|
259 |
+
// Check nonce
|
260 |
+
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
261 |
+
|
262 |
+
// current user can authenticate
|
263 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
264 |
+
wp_send_json_error( array( 'message' => __( "You don't have permission to re-authenticate ExactMetrics.", 'google-analytics-dashboard-for-wp' ) ) );
|
265 |
+
}
|
266 |
+
|
267 |
+
if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
|
268 |
+
define( 'WP_NETWORK_ADMIN', true );
|
269 |
+
}
|
270 |
+
|
271 |
+
// Only for Pro users, require a license key to be entered first so we can link to things.
|
272 |
+
if ( exactmetrics_is_pro_version() ) {
|
273 |
+
$valid = is_network_admin() ? ExactMetrics()->license->is_network_licensed() : ExactMetrics()->license->is_site_licensed();
|
274 |
+
if ( exactmetrics_is_pro_version() && ! $valid ) {
|
275 |
+
wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please enter a valid, active license key for ExactMetrics Pro into the settings.", 'google-analytics-dashboard-for-wp' ) ) );
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
// we do have a current auth
|
280 |
+
if ( ! $this->is_network_admin() && ! ExactMetrics()->auth->is_authed() ) {
|
281 |
+
wp_send_json_error( array( 'message' => __( "Cannot re-authenticate. Please authenticate.", 'google-analytics-dashboard-for-wp' ) ) );
|
282 |
+
} else if ( $this->is_network_admin() && ! ExactMetrics()->auth->is_network_authed() ) {
|
283 |
+
wp_send_json_error( array( 'message' => __( "Cannot re-authenticate the network. Please authenticate on the network settings panel.", 'google-analytics-dashboard-for-wp' ) ) );
|
284 |
+
}
|
285 |
+
|
286 |
+
$siteurl = add_query_arg( array(
|
287 |
+
'tt' => $this->get_tt(),
|
288 |
+
'sitei' => $this->get_sitei(),
|
289 |
+
'miversion' => EXACTMETRICS_VERSION,
|
290 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
291 |
+
'network' => is_network_admin() ? 'network' : 'site',
|
292 |
+
'siteurl' => is_network_admin() ? network_admin_url() : site_url(),
|
293 |
+
'key' => is_network_admin() ? ExactMetrics()->auth->get_network_key() : ExactMetrics()->auth->get_key(),
|
294 |
+
'token' => is_network_admin() ? ExactMetrics()->auth->get_network_token() : ExactMetrics()->auth->get_token(),
|
295 |
+
'return' => is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' ),
|
296 |
+
'testurl' => 'https://' . exactmetrics_get_api_url() . 'test/',
|
297 |
+
), $this->get_route( 'https://' . exactmetrics_get_api_url() . 'auth/reauth/{type}' ) );
|
298 |
+
|
299 |
+
if ( exactmetrics_is_pro_version() ) {
|
300 |
+
$key = is_network_admin() ? ExactMetrics()->license->get_network_license_key() : ExactMetrics()->license->get_site_license_key();
|
301 |
+
$siteurl = add_query_arg( 'license', $key, $siteurl );
|
302 |
+
}
|
303 |
+
|
304 |
+
$siteurl = apply_filters( 'exactmetrics_maybe_authenticate_siteurl', $siteurl );
|
305 |
+
|
306 |
+
wp_send_json_success( array( 'redirect' => $siteurl ) );
|
307 |
+
}
|
308 |
+
|
309 |
+
public function reauthenticate_listener(){
|
310 |
+
// Make sure it's for us
|
311 |
+
if ( empty( $_REQUEST['mi-oauth-action'] ) || $_REQUEST['mi-oauth-action'] !== 'reauth' ) {
|
312 |
+
return;
|
313 |
+
}
|
314 |
+
|
315 |
+
// User can authenticate
|
316 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
317 |
+
return;
|
318 |
+
}
|
319 |
+
|
320 |
+
// Invalid request
|
321 |
+
if ( empty( $_REQUEST['tt'] ) || ! $this->validate_tt( $_REQUEST['tt'] ) ) {
|
322 |
+
return;
|
323 |
+
}
|
324 |
+
|
325 |
+
// Make sure has required params
|
326 |
+
if (
|
327 |
+
( empty( $_REQUEST['ua'] ) && empty( $_REQUEST['v4'] ) ) ||
|
328 |
+
empty( $_REQUEST['miview'] ) ||
|
329 |
+
empty( $_REQUEST['a'] ) ||
|
330 |
+
empty( $_REQUEST['w'] ) ||
|
331 |
+
empty( $_REQUEST['p'] )
|
332 |
+
) {
|
333 |
+
return;
|
334 |
+
}
|
335 |
+
|
336 |
+
if ( ! empty( $_REQUEST['ua'] ) ) {
|
337 |
+
$code_key = 'ua';
|
338 |
+
$code_value = exactmetrics_is_valid_ua( $_REQUEST['ua'] );
|
339 |
+
} else if ( ! empty( $_REQUEST['v4'] ) ) {
|
340 |
+
$code_key = 'v4';
|
341 |
+
$code_value = exactmetrics_is_valid_v4_id( $_REQUEST['v4'] );
|
342 |
+
}
|
343 |
+
|
344 |
+
if ( empty( $code_value ) ) {
|
345 |
+
return;
|
346 |
+
}
|
347 |
+
|
348 |
+
// we do have a current auth
|
349 |
+
$existing = $this->is_network_admin() ? ExactMetrics()->auth->get_network_analytics_profile() : ExactMetrics()->auth->get_analytics_profile();
|
350 |
+
if ( empty( $existing['key'] ) || empty( $existing['token'] ) ) {
|
351 |
+
return;
|
352 |
+
}
|
353 |
+
|
354 |
+
$profile = array(
|
355 |
+
'key' => $existing['key'],
|
356 |
+
'token' => $existing['token'],
|
357 |
+
'viewname' => sanitize_text_field( $_REQUEST['miview'] ),
|
358 |
+
'a' => sanitize_text_field( $_REQUEST['a'] ),
|
359 |
+
'w' => sanitize_text_field( $_REQUEST['w'] ),
|
360 |
+
'p' => sanitize_text_field( $_REQUEST['p'] ),
|
361 |
+
'ua' => $existing['ua'],
|
362 |
+
'v4' => $existing['v4'],
|
363 |
+
'siteurl' => site_url(),
|
364 |
+
'neturl' => network_admin_url(),
|
365 |
+
'connectedtype' => $code_key,
|
366 |
+
);
|
367 |
+
|
368 |
+
if ( ! empty( $_REQUEST['mp'] ) ) {
|
369 |
+
$profile['measurement_protocol_secret'] = sanitize_text_field( $_REQUEST['mp'] );
|
370 |
+
}
|
371 |
+
|
372 |
+
$profile[ $code_key ] = $code_value;
|
373 |
+
|
374 |
+
// Save Profile
|
375 |
+
$this->is_network_admin() ? ExactMetrics()->auth->set_network_analytics_profile( $profile ) : ExactMetrics()->auth->set_analytics_profile( $profile );
|
376 |
+
|
377 |
+
// Clear cache
|
378 |
+
$where = $this->is_network_admin() ? 'network' : 'site';
|
379 |
+
ExactMetrics()->reporting->delete_aggregate_data( $where );
|
380 |
+
|
381 |
+
$url = $this->is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network' ) : admin_url( 'admin.php?page=exactmetrics_settings' ) ;
|
382 |
+
$url = add_query_arg( array(
|
383 |
+
'mi_action' => 'reauth',
|
384 |
+
'success' => 'true',
|
385 |
+
), $url );
|
386 |
+
$url = apply_filters( 'exactmetrics_reauth_success_redirect_url', $url );
|
387 |
+
|
388 |
+
wp_safe_redirect( $url );
|
389 |
+
exit;
|
390 |
+
}
|
391 |
+
|
392 |
+
public function maybe_verify(){
|
393 |
+
|
394 |
+
// Check nonce
|
395 |
+
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
396 |
+
|
397 |
+
// current user can verify
|
398 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
399 |
+
wp_send_json_error( array( 'message' => __( "You don't have permission to verify ExactMetrics.", 'google-analytics-dashboard-for-wp' ) ) );
|
400 |
+
}
|
401 |
+
|
402 |
+
if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
|
403 |
+
define( 'WP_NETWORK_ADMIN', true );
|
404 |
+
}
|
405 |
+
|
406 |
+
// we have an auth to verify
|
407 |
+
if ( $this->is_network_admin() && ! ExactMetrics()->auth->is_network_authed() ) {
|
408 |
+
wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-dashboard-for-wp' ) ) );
|
409 |
+
} else if ( ! $this->is_network_admin() && ! ExactMetrics()->auth->is_authed() ) {
|
410 |
+
wp_send_json_error( array( 'message' => __( "Cannot verify. Please authenticate.", 'google-analytics-dashboard-for-wp' ) ) );
|
411 |
+
}
|
412 |
+
|
413 |
+
if ( exactmetrics_is_pro_version() ) {
|
414 |
+
$valid = is_network_admin() ? ExactMetrics()->license->is_network_licensed() : ExactMetrics()->license->is_site_licensed();
|
415 |
+
if ( ! $valid ) {
|
416 |
+
wp_send_json_error( array( 'message' => __( "Cannot verify. Please enter a valid, active license key for ExactMetrics Pro into the settings.", 'google-analytics-dashboard-for-wp' ) ) );
|
417 |
+
}
|
418 |
+
}
|
419 |
+
|
420 |
+
$worked = $this->verify_auth();
|
421 |
+
if ( $worked && ! is_wp_error( $worked ) ) {
|
422 |
+
wp_send_json_success( array( 'message' => __( "Successfully verified.", 'google-analytics-dashboard-for-wp' ) ) );
|
423 |
+
} else {
|
424 |
+
wp_send_json_error( array( 'message' => __( "Could not verify.", 'google-analytics-dashboard-for-wp' ) ) );
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
public function verify_auth( $credentials = array() ){
|
429 |
+
$creds = ! empty( $credentials ) ? $credentials : ( $this->is_network_admin() ? ExactMetrics()->auth->get_network_analytics_profile( true ) : ExactMetrics()->auth->get_analytics_profile( true ) );
|
430 |
+
|
431 |
+
if ( empty( $creds['key'] ) ) {
|
432 |
+
return new WP_Error( 'validation-error', sprintf( __( 'Verify auth key not passed', 'google-analytics-dashboard-for-wp' ) ) );
|
433 |
+
}
|
434 |
+
|
435 |
+
$network = ! empty( $_REQUEST['network'] ) ? $_REQUEST['network'] === 'network' : $this->is_network_admin();
|
436 |
+
$api = new ExactMetrics_API_Request( $this->get_route( 'auth/verify/{type}/' ), array( 'network' => $network, 'tt' => $this->get_tt(), 'key' => $creds['key'], 'token' => $creds['token'], 'testurl' => 'https://' . exactmetrics_get_api_url() . 'test/' ) );
|
437 |
+
$ret = $api->request();
|
438 |
+
|
439 |
+
$this->rotate_tt();
|
440 |
+
if ( is_wp_error( $ret ) ) {
|
441 |
+
return $ret;
|
442 |
+
} else {
|
443 |
+
return true;
|
444 |
+
}
|
445 |
+
}
|
446 |
+
|
447 |
+
public function maybe_delete(){
|
448 |
+
|
449 |
+
// Check nonce
|
450 |
+
check_ajax_referer( 'mi-admin-nonce', 'nonce' );
|
451 |
+
|
452 |
+
// current user can delete
|
453 |
+
if ( ! current_user_can( 'exactmetrics_save_settings' ) ) {
|
454 |
+
wp_send_json_error( array( 'message' => __( "You don't have permission to deauthenticate ExactMetrics.", 'google-analytics-dashboard-for-wp' ) ) );
|
455 |
+
}
|
456 |
+
|
457 |
+
if ( ! empty( $_REQUEST['isnetwork'] ) && $_REQUEST['isnetwork'] ) {
|
458 |
+
define( 'WP_NETWORK_ADMIN', true );
|
459 |
+
}
|
460 |
+
|
461 |
+
// we have an auth to delete
|
462 |
+
if ( $this->is_network_admin() && ! ExactMetrics()->auth->is_network_authed() ) {
|
463 |
+
wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-dashboard-for-wp' ) ) );
|
464 |
+
} else if ( ! $this->is_network_admin() && ! ExactMetrics()->auth->is_authed() ) {
|
465 |
+
wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. You are not currently authed.", 'google-analytics-dashboard-for-wp' ) ) );
|
466 |
+
}
|
467 |
+
|
468 |
+
if ( exactmetrics_is_pro_version() ) {
|
469 |
+
$valid = is_network_admin() ? ExactMetrics()->license->is_network_licensed() : ExactMetrics()->license->is_site_licensed();
|
470 |
+
if ( ! $valid ) {
|
471 |
+
wp_send_json_error( array( 'message' => __( "Cannot deauthenticate. Please enter a valid, active license key for ExactMetrics Pro into the settings.", 'google-analytics-dashboard-for-wp' ) ) );
|
472 |
+
}
|
473 |
+
}
|
474 |
+
|
475 |
+
$force = ! empty( $_REQUEST['forcedelete'] ) && $_REQUEST['forcedelete'] === 'true';
|
476 |
+
|
477 |
+
$worked = $this->delete_auth( $force );
|
478 |
+
if ( $worked && ! is_wp_error( $worked ) ) {
|
479 |
+
wp_send_json_success( array( 'message' => __( "Successfully deauthenticated.", 'google-analytics-dashboard-for-wp' ) ) );
|
480 |
+
} else {
|
481 |
+
if ( $force ) {
|
482 |
+
wp_send_json_success( array( 'message' => __( "Successfully force deauthenticated.", 'google-analytics-dashboard-for-wp' ) ) );
|
483 |
+
} else {
|
484 |
+
wp_send_json_error( array( 'message' => __( "Could not deauthenticate.", 'google-analytics-dashboard-for-wp' ) ) );
|
485 |
+
}
|
486 |
+
}
|
487 |
+
}
|
488 |
+
|
489 |
+
public function delete_auth( $force = false ){
|
490 |
+
if ( $this->is_network_admin() && ! ExactMetrics()->auth->is_network_authed() ) {
|
491 |
+
return false;
|
492 |
+
} else if ( ! $this->is_network_admin() && ! ExactMetrics()->auth->is_authed() ) {
|
493 |
+
return false;
|
494 |
+
}
|
495 |
+
|
496 |
+
$creds = $this->is_network_admin() ? ExactMetrics()->auth->get_network_analytics_profile( true ) : ExactMetrics()->auth->get_analytics_profile( true );
|
497 |
+
|
498 |
+
if ( empty( $creds['key'] ) ) {
|
499 |
+
return false;
|
500 |
+
}
|
501 |
+
|
502 |
+
// If we have a new siteurl enabled option and the profile site doesn't match the current site, deactivate anyways
|
503 |
+
if ( is_network_admin() ) {
|
504 |
+
$siteurl = network_admin_url();
|
505 |
+
if ( ! empty( $creds['neturl' ] ) && $creds['neturl'] !== $siteurl ) {
|
506 |
+
ExactMetrics()->auth->delete_network_analytics_profile( true );
|
507 |
+
return true;
|
508 |
+
}
|
509 |
+
} else {
|
510 |
+
$siteurl = site_url();
|
511 |
+
if ( ! empty( $creds['siteurl' ] ) && $creds['siteurl'] !== $siteurl ) {
|
512 |
+
ExactMetrics()->auth->delete_analytics_profile( true );
|
513 |
+
return true;
|
514 |
+
}
|
515 |
+
}
|
516 |
+
|
517 |
+
$api = new ExactMetrics_API_Request( $this->get_route( 'auth/delete/{type}/' ), array( 'network' => $this->is_network_admin(), 'tt' => $this->get_tt(), 'key' => $creds['key'], 'token' => $creds['token'], 'testurl' => 'https://' . exactmetrics_get_api_url() . 'test/' ) );
|
518 |
+
$ret = $api->request();
|
519 |
+
|
520 |
+
$this->rotate_tt();
|
521 |
+
if ( is_wp_error( $ret ) && ! $force ) {
|
522 |
+
return false;
|
523 |
+
} else {
|
524 |
+
if ( $this->is_network_admin() ) {
|
525 |
+
ExactMetrics()->auth->delete_network_analytics_profile( true );
|
526 |
+
} else {
|
527 |
+
ExactMetrics()->auth->delete_analytics_profile( true );
|
528 |
+
|
529 |
+
}
|
530 |
+
return true;
|
531 |
+
}
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* Function to delete network auth in the uninstall process where we can't check if is network admin.
|
536 |
+
*
|
537 |
+
* @return bool
|
538 |
+
*/
|
539 |
+
public function uninstall_network_auth() {
|
540 |
+
|
541 |
+
if ( ! ExactMetrics()->auth->is_network_authed() ) {
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
|
545 |
+
$creds = ExactMetrics()->auth->get_network_analytics_profile( true );
|
546 |
+
|
547 |
+
$api = new ExactMetrics_API_Request( $this->get_route( 'auth/delete/{type}/' ), array(
|
548 |
+
'network' => true,
|
549 |
+
'tt' => $this->get_tt(),
|
550 |
+
'key' => $creds['key'],
|
551 |
+
'token' => $creds['token'],
|
552 |
+
'testurl' => 'https://' . exactmetrics_get_api_url() . 'test/'
|
553 |
+
) );
|
554 |
+
// Force the network admin url otherwise this will fail not finding the url in relay.
|
555 |
+
$api->site_url = network_admin_url();
|
556 |
+
$ret = $api->request();
|
557 |
+
|
558 |
+
$this->rotate_tt();
|
559 |
+
if ( is_wp_error( $ret ) ) {
|
560 |
+
return false;
|
561 |
+
} else {
|
562 |
+
ExactMetrics()->auth->delete_network_analytics_profile( true );
|
563 |
+
return true;
|
564 |
+
}
|
565 |
+
}
|
566 |
+
|
567 |
+
public function get_type() {
|
568 |
+
$base = exactmetrics_is_pro_version() ? 'pro' : 'lite';
|
569 |
+
return apply_filters( 'exactmetrics_api_auth_get_type', $base );
|
570 |
+
}
|
571 |
+
|
572 |
+
public function get_route( $route = '' ) {
|
573 |
+
$route = str_replace( '{type}', $this->get_type(), $route );
|
574 |
+
$route = trailingslashit( $route );
|
575 |
+
return $route;
|
576 |
+
}
|
577 |
+
|
578 |
+
public function is_network_admin() {
|
579 |
+
return is_multisite() && is_network_admin();
|
580 |
+
}
|
581 |
+
|
582 |
+
public function get_sitei() {
|
583 |
+
// $sitei = get_network_option( get_current_network_id(), 'exactmetrics_network_sitei', false );
|
584 |
+
// if ( ! empty( $sitei ) && strlen( $sitei ) >= 1 ) {
|
585 |
+
// return $sitei;
|
586 |
+
// }
|
587 |
+
|
588 |
+
$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
|
589 |
+
$secure_auth_key = defined( 'SECURE_AUTH_KEY' ) ? SECURE_AUTH_KEY : '';
|
590 |
+
$logged_in_key = defined( 'LOGGED_IN_KEY' ) ? LOGGED_IN_KEY : '';
|
591 |
+
|
592 |
+
$sitei = $auth_key . $secure_auth_key . $logged_in_key;
|
593 |
+
$sitei = preg_replace('/[^a-zA-Z0-9]/', '', $sitei );
|
594 |
+
$sitei = sanitize_text_field( $sitei );
|
595 |
+
$sitei = trim( $sitei );
|
596 |
+
$sitei = ( strlen($sitei) > 30 ) ? substr($sitei, 0, 30 ) : $sitei;
|
597 |
+
return $sitei;
|
598 |
+
}
|
599 |
+
|
600 |
+
/**
|
601 |
+
* Logic to run before serving the redirect url during auth.
|
602 |
+
*
|
603 |
+
* @param string $url
|
604 |
+
*
|
605 |
+
* @return string
|
606 |
+
*/
|
607 |
+
public function before_redirect( $url ) {
|
608 |
+
|
609 |
+
// If Bad Behavior plugin is installed.
|
610 |
+
if ( function_exists( 'bb2_read_settings' ) ) {
|
611 |
+
// Make sure the offsite_forms option is enabled to allow auth.
|
612 |
+
$bb_settings = get_option( 'bad_behavior_settings' );
|
613 |
+
if ( empty( $bb_settings['offsite_forms'] ) || false === $bb_settings['offsite_forms'] ) {
|
614 |
+
$bb_settings['offsite_forms'] = true;
|
615 |
+
update_option( 'bad_behavior_settings', $bb_settings );
|
616 |
+
}
|
617 |
+
}
|
618 |
+
|
619 |
+
return $url;
|
620 |
+
}
|
621 |
+
|
622 |
+
/**
|
623 |
+
* Delete auth-related options from the db - should be run at site level.
|
624 |
+
*/
|
625 |
+
public function uninstall_auth() {
|
626 |
+
delete_option( 'exactmetrics_site_profile' );
|
627 |
+
delete_option( 'exactmetrics_site_tt' );
|
628 |
+
}
|
629 |
+
|
630 |
+
/**
|
631 |
+
* Save the measurement protocol that Relay pushes to this site
|
632 |
+
*/
|
633 |
+
public function handle_relay_mp_token_push() {
|
634 |
+
$mp_token = sanitize_text_field( $_POST['mp_token'] );
|
635 |
+
$timestamp = (int) sanitize_text_field( $_POST['timestamp'] );
|
636 |
+
$signature = sanitize_text_field( $_POST['signature'] );
|
637 |
+
|
638 |
+
// check if expired
|
639 |
+
if ( time() > $timestamp + 1000 ) {
|
640 |
+
wp_send_json_error( new WP_Error( 'exactmetrics_mp_token_timestamp_expired' ) );
|
641 |
+
}
|
642 |
+
|
643 |
+
// Check hashed signature
|
644 |
+
$auth = ExactMetrics()->auth;
|
645 |
+
|
646 |
+
$is_network = is_multisite();
|
647 |
+
$public_key = $is_network
|
648 |
+
? $auth->get_network_key()
|
649 |
+
: $auth->get_key();
|
650 |
+
|
651 |
+
$hashed_data = array(
|
652 |
+
'mp_token' => $_POST['mp_token'],
|
653 |
+
'timestamp' => $timestamp,
|
654 |
+
);
|
655 |
+
|
656 |
+
// These `hash_` functions are polyfilled by WP in wp-includes/compat.php
|
657 |
+
$expected_signature = hash_hmac( 'md5', http_build_query( $hashed_data ), $public_key );
|
658 |
+
if ( ! hash_equals( $signature, $expected_signature ) ) {
|
659 |
+
wp_send_json_error( new WP_Error( 'exactmetrics_mp_token_invalid_signature' ) );
|
660 |
+
}
|
661 |
+
|
662 |
+
// Save measurement protocol token
|
663 |
+
if ( $is_network ) {
|
664 |
+
$auth->set_network_measurement_protocol_secret( $mp_token );
|
665 |
+
} else {
|
666 |
+
$auth->set_measurement_protocol_secret( $mp_token );
|
667 |
+
}
|
668 |
+
wp_send_json_success();
|
669 |
+
}
|
670 |
+
}
|
includes/admin/common.php
CHANGED
@@ -1,959 +1,964 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Common admin class.
|
4 |
-
*
|
5 |
-
* @since 6.0.0
|
6 |
-
*
|
7 |
-
* @package ExactMetrics
|
8 |
-
* @subpackage Common
|
9 |
-
* @author Chris Christoff
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
function exactmetrics_is_settings_page() {
|
18 |
-
$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
19 |
-
global $admin_page_hooks;
|
20 |
-
|
21 |
-
if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) {
|
22 |
-
return false;
|
23 |
-
}
|
24 |
-
|
25 |
-
$settings_page = false;
|
26 |
-
if ( ! empty( $admin_page_hooks['exactmetrics_settings'] ) && $current_screen->id === $admin_page_hooks['exactmetrics_settings'] ) {
|
27 |
-
$settings_page = true;
|
28 |
-
}
|
29 |
-
|
30 |
-
if ( $current_screen->id === 'toplevel_page_exactmetrics_settings' ) {
|
31 |
-
$settings_page = true;
|
32 |
-
}
|
33 |
-
|
34 |
-
if ( $current_screen->id === 'exactmetrics_page_exactmetrics_settings' ) {
|
35 |
-
$settings_page = true;
|
36 |
-
}
|
37 |
-
|
38 |
-
if ( strpos( $current_screen->id, 'exactmetrics_settings' ) !== false ) {
|
39 |
-
$settings_page = true;
|
40 |
-
}
|
41 |
-
|
42 |
-
if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'exactmetrics_network' ) !== false ) {
|
43 |
-
$settings_page = true;
|
44 |
-
}
|
45 |
-
|
46 |
-
return $settings_page;
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Determine if the current page is the Reports page.
|
51 |
-
*
|
52 |
-
* @return bool
|
53 |
-
*/
|
54 |
-
function exactmetrics_is_reports_page() {
|
55 |
-
$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
56 |
-
global $admin_page_hooks;
|
57 |
-
|
58 |
-
if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) {
|
59 |
-
return false;
|
60 |
-
}
|
61 |
-
|
62 |
-
$reports_page = false;
|
63 |
-
if ( ! empty( $admin_page_hooks['exactmetrics_reports'] ) && $current_screen->id === $admin_page_hooks['exactmetrics_reports'] ) {
|
64 |
-
$reports_page = true;
|
65 |
-
}
|
66 |
-
|
67 |
-
if ( 'toplevel_page_exactmetrics_reports' === $current_screen->id ) {
|
68 |
-
$reports_page = true;
|
69 |
-
}
|
70 |
-
|
71 |
-
if ( strpos( $current_screen->id, 'exactmetrics_reports' ) !== false ) {
|
72 |
-
$reports_page = true;
|
73 |
-
}
|
74 |
-
|
75 |
-
return $reports_page;
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Loads styles for all ExactMetrics-based Administration Screens.
|
80 |
-
*
|
81 |
-
* @return null Return early if not on the proper screen.
|
82 |
-
* @since 6.0.0
|
83 |
-
* @access public
|
84 |
-
*
|
85 |
-
*/
|
86 |
-
function exactmetrics_admin_styles() {
|
87 |
-
|
88 |
-
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
89 |
-
|
90 |
-
// Load Common admin styles.
|
91 |
-
wp_register_style( 'exactmetrics-admin-common-style', plugins_url( 'assets/css/admin-common' . $suffix . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
92 |
-
wp_enqueue_style( 'exactmetrics-admin-common-style' );
|
93 |
-
|
94 |
-
// Get current screen.
|
95 |
-
$screen = get_current_screen();
|
96 |
-
|
97 |
-
// Bail if we're not on a ExactMetrics screen.
|
98 |
-
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
99 |
-
return;
|
100 |
-
}
|
101 |
-
|
102 |
-
$version_path = exactmetrics_is_pro_version() ? 'pro' : 'lite';
|
103 |
-
$rtl = is_rtl() ? '.rtl' : '';
|
104 |
-
|
105 |
-
// For the settings page, load the Vue app styles.
|
106 |
-
if ( exactmetrics_is_settings_page() ) {
|
107 |
-
if ( ! defined( 'EXACTMETRICS_LOCAL_JS_URL' ) ) {
|
108 |
-
wp_enqueue_style( 'exactmetrics-vue-style-vendors', plugins_url( $version_path . '/assets/vue/css/chunk-vendors' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
109 |
-
wp_enqueue_style( 'exactmetrics-vue-style-common', plugins_url( $version_path . '/assets/vue/css/chunk-common' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
110 |
-
wp_enqueue_style( 'exactmetrics-vue-style', plugins_url( $version_path . '/assets/vue/css/settings' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
111 |
-
}
|
112 |
-
|
113 |
-
// Don't load other styles on the settings page.
|
114 |
-
return;
|
115 |
-
}
|
116 |
-
|
117 |
-
if ( exactmetrics_is_reports_page() ) {
|
118 |
-
if ( ! defined( 'EXACTMETRICS_LOCAL_REPORTS_JS_URL' ) ) {
|
119 |
-
wp_enqueue_style( 'exactmetrics-vue-style-vendors', plugins_url( $version_path . '/assets/vue/css/chunk-vendors' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
120 |
-
wp_enqueue_style( 'exactmetrics-vue-style-common', plugins_url( $version_path . '/assets/vue/css/chunk-common' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
121 |
-
wp_enqueue_style( 'exactmetrics-vue-style', plugins_url( $version_path . '/assets/vue/css/reports' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
122 |
-
}
|
123 |
-
|
124 |
-
return;
|
125 |
-
}
|
126 |
-
|
127 |
-
// Tooltips
|
128 |
-
wp_enqueue_script( 'jquery-ui-tooltip' );
|
129 |
-
}
|
130 |
-
|
131 |
-
add_action( 'admin_enqueue_scripts', 'exactmetrics_admin_styles' );
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Loads scripts for all ExactMetrics-based Administration Screens.
|
135 |
-
*
|
136 |
-
* @return null Return early if not on the proper screen.
|
137 |
-
* @since 6.0.0
|
138 |
-
* @access public
|
139 |
-
*
|
140 |
-
*/
|
141 |
-
function exactmetrics_admin_scripts() {
|
142 |
-
|
143 |
-
// Our Common Admin JS.
|
144 |
-
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
145 |
-
|
146 |
-
wp_register_script( 'exactmetrics-admin-common-script', plugins_url( 'assets/js/admin-common' . $suffix . '.js', EXACTMETRICS_PLUGIN_FILE ), array( 'jquery' ), exactmetrics_get_asset_version(), true );
|
147 |
-
|
148 |
-
wp_enqueue_script( 'exactmetrics-admin-common-script' );
|
149 |
-
|
150 |
-
wp_localize_script(
|
151 |
-
'exactmetrics-admin-common-script',
|
152 |
-
'exactmetrics_admin_common',
|
153 |
-
array(
|
154 |
-
'ajax' => admin_url( 'admin-ajax.php' ),
|
155 |
-
'dismiss_notice_nonce' => wp_create_nonce( 'exactmetrics-dismiss-notice' ),
|
156 |
-
)
|
157 |
-
);
|
158 |
-
|
159 |
-
// Get current screen.
|
160 |
-
$screen = get_current_screen();
|
161 |
-
|
162 |
-
// Bail if we're not on a ExactMetrics screen.
|
163 |
-
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
164 |
-
return;
|
165 |
-
}
|
166 |
-
|
167 |
-
$version_path = exactmetrics_is_pro_version() ? 'pro' : 'lite';
|
168 |
-
|
169 |
-
// For the settings page, load the Vue app.
|
170 |
-
if ( exactmetrics_is_settings_page() ) {
|
171 |
-
if ( ! defined( 'EXACTMETRICS_LOCAL_VENDORS_JS_URL' ) ) {
|
172 |
-
wp_enqueue_script( 'exactmetrics-vue-vendors', plugins_url( $version_path . '/assets/vue/js/chunk-vendors.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
173 |
-
wp_enqueue_script( 'exactmetrics-vue-common', plugins_url( $version_path . '/assets/vue/js/chunk-common.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
174 |
-
} else {
|
175 |
-
wp_enqueue_script( 'exactmetrics-vue-vendors', EXACTMETRICS_LOCAL_VENDORS_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
176 |
-
wp_enqueue_script( 'exactmetrics-vue-common', EXACTMETRICS_LOCAL_COMMON_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
177 |
-
}
|
178 |
-
$app_js_url = defined( 'EXACTMETRICS_LOCAL_JS_URL' ) && EXACTMETRICS_LOCAL_JS_URL ? EXACTMETRICS_LOCAL_JS_URL : plugins_url( $version_path . '/assets/vue/js/settings.js', EXACTMETRICS_PLUGIN_FILE );
|
179 |
-
wp_register_script( 'exactmetrics-vue-script', $app_js_url, array(), exactmetrics_get_asset_version(), true );
|
180 |
-
wp_enqueue_script( 'exactmetrics-vue-script' );
|
181 |
-
$plugins = get_plugins();
|
182 |
-
$install_amp_url = false;
|
183 |
-
if ( exactmetrics_can_install_plugins() ) {
|
184 |
-
$amp_key = 'amp/amp.php';
|
185 |
-
if ( array_key_exists( $amp_key, $plugins ) ) {
|
186 |
-
$install_amp_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $amp_key ), 'activate-plugin_' . $amp_key );
|
187 |
-
} else {
|
188 |
-
$install_amp_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=amp' ), 'install-plugin_amp' );
|
189 |
-
}
|
190 |
-
}
|
191 |
-
$install_woocommerce_url = false;
|
192 |
-
if ( exactmetrics_can_install_plugins() ) {
|
193 |
-
$woo_key = 'woocommerce/woocommerce.php';
|
194 |
-
if ( array_key_exists( $woo_key, $plugins ) ) {
|
195 |
-
$install_woocommerce_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $woo_key ), 'activate-plugin_' . $woo_key );
|
196 |
-
} else {
|
197 |
-
$install_woocommerce_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
|
198 |
-
}
|
199 |
-
}
|
200 |
-
$install_fbia_url = false;
|
201 |
-
if ( exactmetrics_can_install_plugins() ) {
|
202 |
-
$fbia_key = 'fb-instant-articles/facebook-instant-articles.php';
|
203 |
-
if ( array_key_exists( $fbia_key, $plugins ) ) {
|
204 |
-
$install_fbia_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $fbia_key ), 'activate-plugin_' . $fbia_key );
|
205 |
-
} else {
|
206 |
-
$install_fbia_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=fb-instant-articles' ), 'install-plugin_fb-instant-articles' );
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
$prepared_dimensions = array();
|
211 |
-
if ( class_exists( 'ExactMetrics_Admin_Custom_Dimensions' ) ) {
|
212 |
-
$dimensions = new ExactMetrics_Admin_Custom_Dimensions();
|
213 |
-
$dimensions = $dimensions->custom_dimensions();
|
214 |
-
$prepared_dimensions = array();
|
215 |
-
foreach ( $dimensions as $dimension_type => $dimension ) {
|
216 |
-
$dimension['type'] = $dimension_type;
|
217 |
-
$prepared_dimensions[] = $dimension;
|
218 |
-
}
|
219 |
-
}
|
220 |
-
$is_authed = ( ExactMetrics()->auth->is_authed() || ExactMetrics()->auth->is_network_authed() );
|
221 |
-
|
222 |
-
wp_localize_script(
|
223 |
-
'exactmetrics-vue-script',
|
224 |
-
'exactmetrics',
|
225 |
-
array(
|
226 |
-
'ajax' => admin_url( 'admin-ajax.php' ),
|
227 |
-
'nonce' => wp_create_nonce( 'mi-admin-nonce' ),
|
228 |
-
'network' => is_network_admin(),
|
229 |
-
'translations' => wp_get_jed_locale_data( exactmetrics_is_pro_version() ? 'exactmetrics-premium' : 'google-analytics-dashboard-for-wp' ),
|
230 |
-
'assets' => plugins_url( $version_path . '/assets/vue', EXACTMETRICS_PLUGIN_FILE ),
|
231 |
-
'roles' => exactmetrics_get_roles(),
|
232 |
-
'roles_manage_options' => exactmetrics_get_manage_options_roles(),
|
233 |
-
'shareasale_id' => exactmetrics_get_shareasale_id(),
|
234 |
-
'shareasale_url' => exactmetrics_get_shareasale_url( exactmetrics_get_shareasale_id(), '' ),
|
235 |
-
'addons_url' => is_multisite() ? network_admin_url( 'admin.php?page=exactmetrics_network#/addons' ) : admin_url( 'admin.php?page=exactmetrics_settings#/addons' ),
|
236 |
-
'seo_settings_page_url' => is_multisite() ? network_admin_url( 'admin.php?page=exactmetrics_network#/seo' ) : admin_url( 'admin.php?page=exactmetrics_settings#/seo' ),
|
237 |
-
'aioseo_dashboard_url' => is_multisite() ? network_admin_url( 'admin.php?page=aioseo' ) : admin_url( 'admin.php?page=aioseo' ),
|
238 |
-
'wp_plugins_page_url' => is_multisite() ? network_admin_url( 'plugins.php' ) : admin_url( 'plugins.php' ),
|
239 |
-
'email_summary_url' => admin_url( 'admin.php?exactmetrics_email_preview&exactmetrics_email_template=summary' ),
|
240 |
-
'install_amp_url' => $install_amp_url,
|
241 |
-
'install_fbia_url' => $install_fbia_url,
|
242 |
-
'install_woo_url' => $install_woocommerce_url,
|
243 |
-
'dimensions' => $prepared_dimensions,
|
244 |
-
'wizard_url' => is_network_admin() ? network_admin_url( 'index.php?page=exactmetrics-onboarding' ) : admin_url( 'index.php?page=exactmetrics-onboarding' ),
|
245 |
-
'install_plugins' => exactmetrics_can_install_plugins(),
|
246 |
-
'unfiltered_html' => current_user_can( 'unfiltered_html' ),
|
247 |
-
'activate_nonce' => wp_create_nonce( 'exactmetrics-activate' ),
|
248 |
-
'deactivate_nonce' => wp_create_nonce( 'exactmetrics-deactivate' ),
|
249 |
-
'install_nonce' => wp_create_nonce( 'exactmetrics-install' ),
|
250 |
-
// Used to add notices for future deprecations.
|
251 |
-
'versions' => exactmetrics_get_php_wp_version_warning_data(),
|
252 |
-
'plugin_version' => EXACTMETRICS_VERSION,
|
253 |
-
'is_admin' => true,
|
254 |
-
'admin_email' => get_option( 'admin_email' ),
|
255 |
-
'site_url' => get_site_url(),
|
256 |
-
'reports_url' => add_query_arg( 'page', 'exactmetrics_reports', admin_url( 'admin.php' ) ),
|
257 |
-
'ecommerce_report_url' => add_query_arg( 'page', 'exactmetrics_reports#/ecommerce', admin_url( 'admin.php' ) ),
|
258 |
-
'ecommerce_settings_tab_url' => add_query_arg( 'page', 'exactmetrics_settings#/ecommerce', admin_url( 'admin.php' ) ),
|
259 |
-
'first_run_notice' => apply_filters( 'exactmetrics_settings_first_time_notice_hide', exactmetrics_get_option( 'exactmetrics_first_run_notice' ) ),
|
260 |
-
'getting_started_url' => is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network#/about' ) : admin_url( 'admin.php?page=exactmetrics_settings#/about/getting-started' ),
|
261 |
-
'authed' => $is_authed,
|
262 |
-
'new_pretty_link_url' => admin_url( 'post-new.php?post_type=pretty-link' ),
|
263 |
-
'wpmailsmtp_admin_url' => admin_url( 'admin.php?page=wp-mail-smtp' ),
|
264 |
-
'load_headline_analyzer_settings' => exactmetrics_load_gutenberg_app() ? 'true' : 'false',
|
265 |
-
)
|
266 |
-
);
|
267 |
-
|
268 |
-
// Don't load other scripts on the settings page.
|
269 |
-
return;
|
270 |
-
}
|
271 |
-
|
272 |
-
if ( exactmetrics_is_reports_page() ) {
|
273 |
-
global $wp_version;
|
274 |
-
if ( ! defined( 'EXACTMETRICS_LOCAL_VENDORS_JS_URL' ) ) {
|
275 |
-
wp_enqueue_script( 'exactmetrics-vue-vendors', plugins_url( $version_path . '/assets/vue/js/chunk-vendors.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
276 |
-
wp_enqueue_script( 'exactmetrics-vue-common', plugins_url( $version_path . '/assets/vue/js/chunk-common.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
277 |
-
} else {
|
278 |
-
wp_enqueue_script( 'exactmetrics-vue-vendors', EXACTMETRICS_LOCAL_VENDORS_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
279 |
-
wp_enqueue_script( 'exactmetrics-vue-common', EXACTMETRICS_LOCAL_COMMON_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
280 |
-
}
|
281 |
-
$app_js_url = defined( 'EXACTMETRICS_LOCAL_REPORTS_JS_URL' ) && EXACTMETRICS_LOCAL_REPORTS_JS_URL ? EXACTMETRICS_LOCAL_REPORTS_JS_URL : plugins_url( $version_path . '/assets/vue/js/reports.js', EXACTMETRICS_PLUGIN_FILE );
|
282 |
-
wp_register_script( 'exactmetrics-vue-reports', $app_js_url, array(), exactmetrics_get_asset_version(), true );
|
283 |
-
wp_enqueue_script( 'exactmetrics-vue-reports' );
|
284 |
-
|
285 |
-
// We do not have a current auth.
|
286 |
-
$
|
287 |
-
$
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
'exactmetrics',
|
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 |
-
|
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 |
-
'
|
385 |
-
'
|
386 |
-
'
|
387 |
-
'
|
388 |
-
'
|
389 |
-
'
|
390 |
-
'imagify-
|
391 |
-
'
|
392 |
-
'
|
393 |
-
'
|
394 |
-
'
|
395 |
-
'jquery-
|
396 |
-
'
|
397 |
-
'
|
398 |
-
'
|
399 |
-
'rml-
|
400 |
-
'rml-
|
401 |
-
'rml-
|
402 |
-
'rml-
|
403 |
-
'rml-
|
404 |
-
'rml-
|
405 |
-
'rml-
|
406 |
-
'rml-
|
407 |
-
'rml-
|
408 |
-
'
|
409 |
-
'
|
410 |
-
'
|
411 |
-
'
|
412 |
-
'
|
413 |
-
'
|
414 |
-
'
|
415 |
-
'
|
416 |
-
'
|
417 |
-
'
|
418 |
-
'
|
419 |
-
'
|
420 |
-
'
|
421 |
-
'
|
422 |
-
'
|
423 |
-
'
|
424 |
-
'
|
425 |
-
'
|
426 |
-
'
|
427 |
-
'
|
428 |
-
'
|
429 |
-
'
|
430 |
-
'
|
431 |
-
'
|
432 |
-
'
|
433 |
-
'
|
434 |
-
'
|
435 |
-
'
|
436 |
-
'
|
437 |
-
'
|
438 |
-
'
|
439 |
-
'wpmf-
|
440 |
-
'wpmf-
|
441 |
-
'
|
442 |
-
'
|
443 |
-
'
|
444 |
-
'
|
445 |
-
'
|
446 |
-
'
|
447 |
-
'
|
448 |
-
'
|
449 |
-
'
|
450 |
-
'qodef-
|
451 |
-
'
|
452 |
-
'
|
453 |
-
'
|
454 |
-
'
|
455 |
-
'
|
456 |
-
'
|
457 |
-
'
|
458 |
-
'
|
459 |
-
'
|
460 |
-
'
|
461 |
-
'
|
462 |
-
'
|
463 |
-
'
|
464 |
-
'
|
465 |
-
'
|
466 |
-
'
|
467 |
-
'
|
468 |
-
'
|
469 |
-
'
|
470 |
-
'
|
471 |
-
'
|
472 |
-
'
|
473 |
-
'
|
474 |
-
'
|
475 |
-
'
|
476 |
-
'
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
'
|
496 |
-
'
|
497 |
-
'
|
498 |
-
'
|
499 |
-
'
|
500 |
-
'
|
501 |
-
'
|
502 |
-
'
|
503 |
-
'
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
remove_action( '
|
557 |
-
remove_action( '
|
558 |
-
remove_action( '
|
559 |
-
remove_action( '
|
560 |
-
remove_action( '
|
561 |
-
remove_action( '
|
562 |
-
remove_action( 'print_media_templates', '
|
563 |
-
remove_action( '
|
564 |
-
//
|
565 |
-
remove_action( 'admin_footer', '
|
566 |
-
|
567 |
-
remove_action( 'admin_footer', '
|
568 |
-
remove_action( 'admin_footer', '
|
569 |
-
remove_action( 'admin_footer', '
|
570 |
-
remove_action( 'admin_footer', '
|
571 |
-
remove_action( 'admin_footer', '
|
572 |
-
remove_action( 'admin_footer', '
|
573 |
-
remove_action( 'admin_footer', '
|
574 |
-
remove_action( 'admin_footer', '
|
575 |
-
remove_action( 'admin_footer', '
|
576 |
-
remove_action( 'admin_footer', '
|
577 |
-
remove_action( 'admin_footer', '
|
578 |
-
remove_action( 'admin_footer', '
|
579 |
-
remove_action( 'admin_footer', '
|
580 |
-
remove_action( 'admin_footer', '
|
581 |
-
remove_action( 'admin_footer', '
|
582 |
-
remove_action( 'admin_footer', '
|
583 |
-
remove_action( 'admin_footer', '
|
584 |
-
remove_action( 'admin_footer', '
|
585 |
-
remove_action( 'admin_footer', '
|
586 |
-
remove_action( 'admin_footer', '
|
587 |
-
remove_action( 'admin_footer', '
|
588 |
-
remove_action( 'admin_footer', '
|
589 |
-
remove_action( 'admin_footer', '
|
590 |
-
remove_action( 'admin_footer', '
|
591 |
-
remove_action( 'admin_footer', '
|
592 |
-
remove_action( 'admin_footer', '
|
593 |
-
remove_action( 'admin_footer', '
|
594 |
-
remove_action( 'admin_footer', '
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
*
|
603 |
-
*
|
604 |
-
* @
|
605 |
-
*
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
}
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
*
|
673 |
-
*
|
674 |
-
*
|
675 |
-
*
|
676 |
-
* -
|
677 |
-
*
|
678 |
-
*
|
679 |
-
*
|
680 |
-
*
|
681 |
-
*
|
682 |
-
*
|
683 |
-
*
|
684 |
-
*
|
685 |
-
* @
|
686 |
-
*
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
return esc_url( $url );
|
705 |
-
}
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
$
|
713 |
-
$
|
714 |
-
$
|
715 |
-
$
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
'
|
723 |
-
'
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
return $url;
|
732 |
-
}
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
$('
|
742 |
-
$('
|
743 |
-
$('
|
744 |
-
$('#exactmetrics-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
}
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
remove_action( 'print_media_templates', '
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
remove_action( 'admin_footer', '
|
783 |
-
remove_action( 'admin_footer', '
|
784 |
-
remove_action( 'admin_footer', '
|
785 |
-
remove_action( 'admin_footer', '
|
786 |
-
remove_action( 'admin_footer', '
|
787 |
-
remove_action( 'admin_footer', '
|
788 |
-
remove_action( 'admin_footer', '
|
789 |
-
remove_action( 'admin_footer', '
|
790 |
-
remove_action( 'admin_footer', '
|
791 |
-
remove_action( 'admin_footer', '
|
792 |
-
remove_action( 'admin_footer', '
|
793 |
-
remove_action( 'admin_footer', '
|
794 |
-
remove_action( 'admin_footer', '
|
795 |
-
remove_action( 'admin_footer', '
|
796 |
-
remove_action( 'admin_footer', '
|
797 |
-
remove_action( 'admin_footer', '
|
798 |
-
remove_action( 'admin_footer', '
|
799 |
-
remove_action( 'admin_footer', '
|
800 |
-
remove_action( 'admin_footer', '
|
801 |
-
remove_action( 'admin_footer', '
|
802 |
-
remove_action( 'admin_footer', '
|
803 |
-
remove_action( 'admin_footer', '
|
804 |
-
remove_action( 'admin_footer', '
|
805 |
-
remove_action( 'admin_footer', '
|
806 |
-
remove_action( 'admin_footer', '
|
807 |
-
remove_action( 'admin_footer', '
|
808 |
-
remove_action( 'admin_footer', '
|
809 |
-
remove_action( 'admin_footer', '
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
*
|
819 |
-
*
|
820 |
-
*
|
821 |
-
*
|
822 |
-
* @
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
'
|
854 |
-
'
|
855 |
-
'
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
$
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
$notification['
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
$
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
$
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
$notification['
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
$notification['
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
$notification['
|
947 |
-
$notification['
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Common admin class.
|
4 |
+
*
|
5 |
+
* @since 6.0.0
|
6 |
+
*
|
7 |
+
* @package ExactMetrics
|
8 |
+
* @subpackage Common
|
9 |
+
* @author Chris Christoff
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
function exactmetrics_is_settings_page() {
|
18 |
+
$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
19 |
+
global $admin_page_hooks;
|
20 |
+
|
21 |
+
if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) {
|
22 |
+
return false;
|
23 |
+
}
|
24 |
+
|
25 |
+
$settings_page = false;
|
26 |
+
if ( ! empty( $admin_page_hooks['exactmetrics_settings'] ) && $current_screen->id === $admin_page_hooks['exactmetrics_settings'] ) {
|
27 |
+
$settings_page = true;
|
28 |
+
}
|
29 |
+
|
30 |
+
if ( $current_screen->id === 'toplevel_page_exactmetrics_settings' ) {
|
31 |
+
$settings_page = true;
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( $current_screen->id === 'exactmetrics_page_exactmetrics_settings' ) {
|
35 |
+
$settings_page = true;
|
36 |
+
}
|
37 |
+
|
38 |
+
if ( strpos( $current_screen->id, 'exactmetrics_settings' ) !== false ) {
|
39 |
+
$settings_page = true;
|
40 |
+
}
|
41 |
+
|
42 |
+
if ( ! empty( $current_screen->base ) && strpos( $current_screen->base, 'exactmetrics_network' ) !== false ) {
|
43 |
+
$settings_page = true;
|
44 |
+
}
|
45 |
+
|
46 |
+
return $settings_page;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Determine if the current page is the Reports page.
|
51 |
+
*
|
52 |
+
* @return bool
|
53 |
+
*/
|
54 |
+
function exactmetrics_is_reports_page() {
|
55 |
+
$current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
|
56 |
+
global $admin_page_hooks;
|
57 |
+
|
58 |
+
if ( ! is_object( $current_screen ) || empty( $current_screen->id ) || empty( $admin_page_hooks ) ) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
|
62 |
+
$reports_page = false;
|
63 |
+
if ( ! empty( $admin_page_hooks['exactmetrics_reports'] ) && $current_screen->id === $admin_page_hooks['exactmetrics_reports'] ) {
|
64 |
+
$reports_page = true;
|
65 |
+
}
|
66 |
+
|
67 |
+
if ( 'toplevel_page_exactmetrics_reports' === $current_screen->id ) {
|
68 |
+
$reports_page = true;
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( strpos( $current_screen->id, 'exactmetrics_reports' ) !== false ) {
|
72 |
+
$reports_page = true;
|
73 |
+
}
|
74 |
+
|
75 |
+
return $reports_page;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Loads styles for all ExactMetrics-based Administration Screens.
|
80 |
+
*
|
81 |
+
* @return null Return early if not on the proper screen.
|
82 |
+
* @since 6.0.0
|
83 |
+
* @access public
|
84 |
+
*
|
85 |
+
*/
|
86 |
+
function exactmetrics_admin_styles() {
|
87 |
+
|
88 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
89 |
+
|
90 |
+
// Load Common admin styles.
|
91 |
+
wp_register_style( 'exactmetrics-admin-common-style', plugins_url( 'assets/css/admin-common' . $suffix . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
92 |
+
wp_enqueue_style( 'exactmetrics-admin-common-style' );
|
93 |
+
|
94 |
+
// Get current screen.
|
95 |
+
$screen = get_current_screen();
|
96 |
+
|
97 |
+
// Bail if we're not on a ExactMetrics screen.
|
98 |
+
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
|
102 |
+
$version_path = exactmetrics_is_pro_version() ? 'pro' : 'lite';
|
103 |
+
$rtl = is_rtl() ? '.rtl' : '';
|
104 |
+
|
105 |
+
// For the settings page, load the Vue app styles.
|
106 |
+
if ( exactmetrics_is_settings_page() ) {
|
107 |
+
if ( ! defined( 'EXACTMETRICS_LOCAL_JS_URL' ) ) {
|
108 |
+
wp_enqueue_style( 'exactmetrics-vue-style-vendors', plugins_url( $version_path . '/assets/vue/css/chunk-vendors' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
109 |
+
wp_enqueue_style( 'exactmetrics-vue-style-common', plugins_url( $version_path . '/assets/vue/css/chunk-common' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
110 |
+
wp_enqueue_style( 'exactmetrics-vue-style', plugins_url( $version_path . '/assets/vue/css/settings' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
111 |
+
}
|
112 |
+
|
113 |
+
// Don't load other styles on the settings page.
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
|
117 |
+
if ( exactmetrics_is_reports_page() ) {
|
118 |
+
if ( ! defined( 'EXACTMETRICS_LOCAL_REPORTS_JS_URL' ) ) {
|
119 |
+
wp_enqueue_style( 'exactmetrics-vue-style-vendors', plugins_url( $version_path . '/assets/vue/css/chunk-vendors' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
120 |
+
wp_enqueue_style( 'exactmetrics-vue-style-common', plugins_url( $version_path . '/assets/vue/css/chunk-common' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
121 |
+
wp_enqueue_style( 'exactmetrics-vue-style', plugins_url( $version_path . '/assets/vue/css/reports' . $rtl . '.css', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version() );
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
// Tooltips
|
128 |
+
wp_enqueue_script( 'jquery-ui-tooltip' );
|
129 |
+
}
|
130 |
+
|
131 |
+
add_action( 'admin_enqueue_scripts', 'exactmetrics_admin_styles' );
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Loads scripts for all ExactMetrics-based Administration Screens.
|
135 |
+
*
|
136 |
+
* @return null Return early if not on the proper screen.
|
137 |
+
* @since 6.0.0
|
138 |
+
* @access public
|
139 |
+
*
|
140 |
+
*/
|
141 |
+
function exactmetrics_admin_scripts() {
|
142 |
+
|
143 |
+
// Our Common Admin JS.
|
144 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
145 |
+
|
146 |
+
wp_register_script( 'exactmetrics-admin-common-script', plugins_url( 'assets/js/admin-common' . $suffix . '.js', EXACTMETRICS_PLUGIN_FILE ), array( 'jquery' ), exactmetrics_get_asset_version(), true );
|
147 |
+
|
148 |
+
wp_enqueue_script( 'exactmetrics-admin-common-script' );
|
149 |
+
|
150 |
+
wp_localize_script(
|
151 |
+
'exactmetrics-admin-common-script',
|
152 |
+
'exactmetrics_admin_common',
|
153 |
+
array(
|
154 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
155 |
+
'dismiss_notice_nonce' => wp_create_nonce( 'exactmetrics-dismiss-notice' ),
|
156 |
+
)
|
157 |
+
);
|
158 |
+
|
159 |
+
// Get current screen.
|
160 |
+
$screen = get_current_screen();
|
161 |
+
|
162 |
+
// Bail if we're not on a ExactMetrics screen.
|
163 |
+
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
164 |
+
return;
|
165 |
+
}
|
166 |
+
|
167 |
+
$version_path = exactmetrics_is_pro_version() ? 'pro' : 'lite';
|
168 |
+
|
169 |
+
// For the settings page, load the Vue app.
|
170 |
+
if ( exactmetrics_is_settings_page() ) {
|
171 |
+
if ( ! defined( 'EXACTMETRICS_LOCAL_VENDORS_JS_URL' ) ) {
|
172 |
+
wp_enqueue_script( 'exactmetrics-vue-vendors', plugins_url( $version_path . '/assets/vue/js/chunk-vendors.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
173 |
+
wp_enqueue_script( 'exactmetrics-vue-common', plugins_url( $version_path . '/assets/vue/js/chunk-common.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
174 |
+
} else {
|
175 |
+
wp_enqueue_script( 'exactmetrics-vue-vendors', EXACTMETRICS_LOCAL_VENDORS_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
176 |
+
wp_enqueue_script( 'exactmetrics-vue-common', EXACTMETRICS_LOCAL_COMMON_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
177 |
+
}
|
178 |
+
$app_js_url = defined( 'EXACTMETRICS_LOCAL_JS_URL' ) && EXACTMETRICS_LOCAL_JS_URL ? EXACTMETRICS_LOCAL_JS_URL : plugins_url( $version_path . '/assets/vue/js/settings.js', EXACTMETRICS_PLUGIN_FILE );
|
179 |
+
wp_register_script( 'exactmetrics-vue-script', $app_js_url, array(), exactmetrics_get_asset_version(), true );
|
180 |
+
wp_enqueue_script( 'exactmetrics-vue-script' );
|
181 |
+
$plugins = get_plugins();
|
182 |
+
$install_amp_url = false;
|
183 |
+
if ( exactmetrics_can_install_plugins() ) {
|
184 |
+
$amp_key = 'amp/amp.php';
|
185 |
+
if ( array_key_exists( $amp_key, $plugins ) ) {
|
186 |
+
$install_amp_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $amp_key ), 'activate-plugin_' . $amp_key );
|
187 |
+
} else {
|
188 |
+
$install_amp_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=amp' ), 'install-plugin_amp' );
|
189 |
+
}
|
190 |
+
}
|
191 |
+
$install_woocommerce_url = false;
|
192 |
+
if ( exactmetrics_can_install_plugins() ) {
|
193 |
+
$woo_key = 'woocommerce/woocommerce.php';
|
194 |
+
if ( array_key_exists( $woo_key, $plugins ) ) {
|
195 |
+
$install_woocommerce_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $woo_key ), 'activate-plugin_' . $woo_key );
|
196 |
+
} else {
|
197 |
+
$install_woocommerce_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
|
198 |
+
}
|
199 |
+
}
|
200 |
+
$install_fbia_url = false;
|
201 |
+
if ( exactmetrics_can_install_plugins() ) {
|
202 |
+
$fbia_key = 'fb-instant-articles/facebook-instant-articles.php';
|
203 |
+
if ( array_key_exists( $fbia_key, $plugins ) ) {
|
204 |
+
$install_fbia_url = wp_nonce_url( self_admin_url( 'plugins.php?action=activate&plugin=' . $fbia_key ), 'activate-plugin_' . $fbia_key );
|
205 |
+
} else {
|
206 |
+
$install_fbia_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=fb-instant-articles' ), 'install-plugin_fb-instant-articles' );
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
$prepared_dimensions = array();
|
211 |
+
if ( class_exists( 'ExactMetrics_Admin_Custom_Dimensions' ) ) {
|
212 |
+
$dimensions = new ExactMetrics_Admin_Custom_Dimensions();
|
213 |
+
$dimensions = $dimensions->custom_dimensions();
|
214 |
+
$prepared_dimensions = array();
|
215 |
+
foreach ( $dimensions as $dimension_type => $dimension ) {
|
216 |
+
$dimension['type'] = $dimension_type;
|
217 |
+
$prepared_dimensions[] = $dimension;
|
218 |
+
}
|
219 |
+
}
|
220 |
+
$is_authed = ( ExactMetrics()->auth->is_authed() || ExactMetrics()->auth->is_network_authed() );
|
221 |
+
|
222 |
+
wp_localize_script(
|
223 |
+
'exactmetrics-vue-script',
|
224 |
+
'exactmetrics',
|
225 |
+
array(
|
226 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
227 |
+
'nonce' => wp_create_nonce( 'mi-admin-nonce' ),
|
228 |
+
'network' => is_network_admin(),
|
229 |
+
'translations' => wp_get_jed_locale_data( exactmetrics_is_pro_version() ? 'exactmetrics-premium' : 'google-analytics-dashboard-for-wp' ),
|
230 |
+
'assets' => plugins_url( $version_path . '/assets/vue', EXACTMETRICS_PLUGIN_FILE ),
|
231 |
+
'roles' => exactmetrics_get_roles(),
|
232 |
+
'roles_manage_options' => exactmetrics_get_manage_options_roles(),
|
233 |
+
'shareasale_id' => exactmetrics_get_shareasale_id(),
|
234 |
+
'shareasale_url' => exactmetrics_get_shareasale_url( exactmetrics_get_shareasale_id(), '' ),
|
235 |
+
'addons_url' => is_multisite() ? network_admin_url( 'admin.php?page=exactmetrics_network#/addons' ) : admin_url( 'admin.php?page=exactmetrics_settings#/addons' ),
|
236 |
+
'seo_settings_page_url' => is_multisite() ? network_admin_url( 'admin.php?page=exactmetrics_network#/seo' ) : admin_url( 'admin.php?page=exactmetrics_settings#/seo' ),
|
237 |
+
'aioseo_dashboard_url' => is_multisite() ? network_admin_url( 'admin.php?page=aioseo' ) : admin_url( 'admin.php?page=aioseo' ),
|
238 |
+
'wp_plugins_page_url' => is_multisite() ? network_admin_url( 'plugins.php' ) : admin_url( 'plugins.php' ),
|
239 |
+
'email_summary_url' => admin_url( 'admin.php?exactmetrics_email_preview&exactmetrics_email_template=summary' ),
|
240 |
+
'install_amp_url' => $install_amp_url,
|
241 |
+
'install_fbia_url' => $install_fbia_url,
|
242 |
+
'install_woo_url' => $install_woocommerce_url,
|
243 |
+
'dimensions' => $prepared_dimensions,
|
244 |
+
'wizard_url' => is_network_admin() ? network_admin_url( 'index.php?page=exactmetrics-onboarding' ) : admin_url( 'index.php?page=exactmetrics-onboarding' ),
|
245 |
+
'install_plugins' => exactmetrics_can_install_plugins(),
|
246 |
+
'unfiltered_html' => current_user_can( 'unfiltered_html' ),
|
247 |
+
'activate_nonce' => wp_create_nonce( 'exactmetrics-activate' ),
|
248 |
+
'deactivate_nonce' => wp_create_nonce( 'exactmetrics-deactivate' ),
|
249 |
+
'install_nonce' => wp_create_nonce( 'exactmetrics-install' ),
|
250 |
+
// Used to add notices for future deprecations.
|
251 |
+
'versions' => exactmetrics_get_php_wp_version_warning_data(),
|
252 |
+
'plugin_version' => EXACTMETRICS_VERSION,
|
253 |
+
'is_admin' => true,
|
254 |
+
'admin_email' => get_option( 'admin_email' ),
|
255 |
+
'site_url' => get_site_url(),
|
256 |
+
'reports_url' => add_query_arg( 'page', 'exactmetrics_reports', admin_url( 'admin.php' ) ),
|
257 |
+
'ecommerce_report_url' => add_query_arg( 'page', 'exactmetrics_reports#/ecommerce', admin_url( 'admin.php' ) ),
|
258 |
+
'ecommerce_settings_tab_url' => add_query_arg( 'page', 'exactmetrics_settings#/ecommerce', admin_url( 'admin.php' ) ),
|
259 |
+
'first_run_notice' => apply_filters( 'exactmetrics_settings_first_time_notice_hide', exactmetrics_get_option( 'exactmetrics_first_run_notice' ) ),
|
260 |
+
'getting_started_url' => is_network_admin() ? network_admin_url( 'admin.php?page=exactmetrics_network#/about' ) : admin_url( 'admin.php?page=exactmetrics_settings#/about/getting-started' ),
|
261 |
+
'authed' => $is_authed,
|
262 |
+
'new_pretty_link_url' => admin_url( 'post-new.php?post_type=pretty-link' ),
|
263 |
+
'wpmailsmtp_admin_url' => admin_url( 'admin.php?page=wp-mail-smtp' ),
|
264 |
+
'load_headline_analyzer_settings' => exactmetrics_load_gutenberg_app() ? 'true' : 'false',
|
265 |
+
)
|
266 |
+
);
|
267 |
+
|
268 |
+
// Don't load other scripts on the settings page.
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( exactmetrics_is_reports_page() ) {
|
273 |
+
global $wp_version;
|
274 |
+
if ( ! defined( 'EXACTMETRICS_LOCAL_VENDORS_JS_URL' ) ) {
|
275 |
+
wp_enqueue_script( 'exactmetrics-vue-vendors', plugins_url( $version_path . '/assets/vue/js/chunk-vendors.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
276 |
+
wp_enqueue_script( 'exactmetrics-vue-common', plugins_url( $version_path . '/assets/vue/js/chunk-common.js', EXACTMETRICS_PLUGIN_FILE ), array(), exactmetrics_get_asset_version(), true );
|
277 |
+
} else {
|
278 |
+
wp_enqueue_script( 'exactmetrics-vue-vendors', EXACTMETRICS_LOCAL_VENDORS_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
279 |
+
wp_enqueue_script( 'exactmetrics-vue-common', EXACTMETRICS_LOCAL_COMMON_JS_URL, array(), exactmetrics_get_asset_version(), true );
|
280 |
+
}
|
281 |
+
$app_js_url = defined( 'EXACTMETRICS_LOCAL_REPORTS_JS_URL' ) && EXACTMETRICS_LOCAL_REPORTS_JS_URL ? EXACTMETRICS_LOCAL_REPORTS_JS_URL : plugins_url( $version_path . '/assets/vue/js/reports.js', EXACTMETRICS_PLUGIN_FILE );
|
282 |
+
wp_register_script( 'exactmetrics-vue-reports', $app_js_url, array(), exactmetrics_get_asset_version(), true );
|
283 |
+
wp_enqueue_script( 'exactmetrics-vue-reports' );
|
284 |
+
|
285 |
+
// We do not have a current auth.
|
286 |
+
$auth = ExactMetrics()->auth;
|
287 |
+
$site_auth = $auth->get_viewname();
|
288 |
+
$ms_auth = is_multisite() && $auth->get_network_viewname();
|
289 |
+
|
290 |
+
wp_localize_script(
|
291 |
+
'exactmetrics-vue-reports',
|
292 |
+
'exactmetrics',
|
293 |
+
array(
|
294 |
+
'ajax' => admin_url( 'admin-ajax.php' ),
|
295 |
+
'nonce' => wp_create_nonce( 'mi-admin-nonce' ),
|
296 |
+
'network' => is_network_admin(),
|
297 |
+
'translations' => wp_get_jed_locale_data( exactmetrics_is_pro_version() ? 'exactmetrics-premium' : 'google-analytics-dashboard-for-wp' ),
|
298 |
+
'assets' => plugins_url( $version_path . '/assets/vue', EXACTMETRICS_PLUGIN_FILE ),
|
299 |
+
'shareasale_id' => exactmetrics_get_shareasale_id(),
|
300 |
+
'shareasale_url' => exactmetrics_get_shareasale_url( exactmetrics_get_shareasale_id(), '' ),
|
301 |
+
'addons_url' => is_multisite() ? network_admin_url( 'admin.php?page=exactmetrics_network#/addons' ) : admin_url( 'admin.php?page=exactmetrics_settings#/addons' ),
|
302 |
+
'timezone' => date( 'e' ),
|
303 |
+
'authed' => $site_auth || $ms_auth,
|
304 |
+
'auth_connected_type' => $auth->get_connected_type(),
|
305 |
+
'settings_url' => add_query_arg( 'page', 'exactmetrics_settings', admin_url( 'admin.php' ) ),
|
306 |
+
// Used to add notices for future deprecations.
|
307 |
+
'versions' => exactmetrics_get_php_wp_version_warning_data(),
|
308 |
+
'plugin_version' => EXACTMETRICS_VERSION,
|
309 |
+
'is_admin' => true,
|
310 |
+
'admin_email' => get_option( 'admin_email' ),
|
311 |
+
'site_url' => get_site_url(),
|
312 |
+
'wizard_url' => is_network_admin() ? network_admin_url( 'index.php?page=exactmetrics-onboarding' ) : admin_url( 'index.php?page=exactmetrics-onboarding' ),
|
313 |
+
'install_nonce' => wp_create_nonce( 'exactmetrics-install' ),
|
314 |
+
'activate_nonce' => wp_create_nonce( 'exactmetrics-activate' ),
|
315 |
+
'deactivate_nonce' => wp_create_nonce( 'exactmetrics-deactivate' ),
|
316 |
+
'update_settings' => current_user_can( 'exactmetrics_save_settings' ),
|
317 |
+
'migrated' => exactmetrics_get_option( 'gadwp_migrated', 0 ),
|
318 |
+
)
|
319 |
+
);
|
320 |
+
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
|
324 |
+
// ublock notice
|
325 |
+
add_action( 'admin_print_footer_scripts', 'exactmetrics_settings_ublock_error_js', 9999999 );
|
326 |
+
}
|
327 |
+
|
328 |
+
add_action( 'admin_enqueue_scripts', 'exactmetrics_admin_scripts' );
|
329 |
+
|
330 |
+
/**
|
331 |
+
* Remove Assets that conflict with ours from our screens.
|
332 |
+
*
|
333 |
+
* @return null Return early if not on the proper screen.
|
334 |
+
* @since 6.0.4
|
335 |
+
* @access public
|
336 |
+
*
|
337 |
+
*/
|
338 |
+
function exactmetrics_remove_conflicting_asset_files() {
|
339 |
+
|
340 |
+
// Get current screen.
|
341 |
+
$screen = get_current_screen();
|
342 |
+
|
343 |
+
// Bail if we're not on a ExactMetrics screen.
|
344 |
+
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
345 |
+
return;
|
346 |
+
}
|
347 |
+
|
348 |
+
$styles = array(
|
349 |
+
'kt_admin_css', // Pinnacle theme
|
350 |
+
'select2-css', // Schema theme
|
351 |
+
'tweetshare_style', // TweetShare - Click To Tweet
|
352 |
+
'tweetshare_custom_style', // TweetShare - Click To Tweet
|
353 |
+
'tweeetshare_custome_style', // TweetShare - Click To Tweet
|
354 |
+
'tweeetshare_notice_style', // TweetShare - Click To Tweet
|
355 |
+
'tweeetshare_theme_style', // TweetShare - Click To Tweet
|
356 |
+
'tweeetshare_tweet_box_style', // TweetShare - Click To Tweet
|
357 |
+
'soultype2-admin', // SoulType Plugin
|
358 |
+
'thesis-options-stylesheet', // Thesis Options Stylesheet
|
359 |
+
'imagify-sweetalert-core', // Imagify
|
360 |
+
'imagify-sweetalert', // Imagify
|
361 |
+
'smls-backend-style', // Smart Logo Showcase Lite
|
362 |
+
'wp-reactjs-starter', // wp-real-media-library
|
363 |
+
'control-panel-modal-plugin', // Ken Theme
|
364 |
+
'theme-admin-css', // Vitrine Theme
|
365 |
+
'qi-framework-styles', // Artisan Nayma Theme
|
366 |
+
'artisan-pages-style', // Artisan Pages Plugin
|
367 |
+
'control-panel-modal-plugin', // Ken Theme
|
368 |
+
'sweetalert', // Church Suite Theme by Webnus
|
369 |
+
'woo_stock_alerts_admin_css', // WooCommerce bolder product alerts
|
370 |
+
'custom_wp_admin_css', // Fix for Add Social Share
|
371 |
+
'fo_css', // Fix for Add Social Share
|
372 |
+
'font_css', // Fix for Add Social Share
|
373 |
+
'font2_css', // Fix for Add Social Share
|
374 |
+
'font3_css', // Fix for Add Social Share
|
375 |
+
'hover_css', // Fix for Add Social Share
|
376 |
+
'fontend_styling', // Fix for Add Social Share
|
377 |
+
'datatable', // WP Todo
|
378 |
+
'bootstrap', // WP Todo
|
379 |
+
'flipclock', // WP Todo
|
380 |
+
'repuso_css_admin', // Social testimonials and reviews by Repuso
|
381 |
+
);
|
382 |
+
|
383 |
+
$scripts = array(
|
384 |
+
'kad_admin_js', // Pinnacle theme
|
385 |
+
'dt-chart', // DesignThemes core features plugin
|
386 |
+
'tweeetshare_font_script', // TweetShare - Click To Tweet
|
387 |
+
'tweeetshare_jquery_script', // TweetShare - Click To Tweet
|
388 |
+
'tweeetshare_jqueryui_script', // TweetShare - Click To Tweet
|
389 |
+
'tweeetshare_custom_script', // TweetShare - Click To Tweet
|
390 |
+
'imagify-promise-polyfill', // Imagify
|
391 |
+
'imagify-sweetalert', // Imagify
|
392 |
+
'imagify-chart', // Imagify
|
393 |
+
'chartjs', // Comet Cache Pro
|
394 |
+
'wp-reactjs-starter', // wp-real-media-library
|
395 |
+
'jquery-tooltipster', // WP Real Media Library
|
396 |
+
'jquery-nested-sortable', // WP Real Media Library
|
397 |
+
'jquery-aio-tree', // WP Real Media Library
|
398 |
+
'wp-media-picker', // WP Real Media Library
|
399 |
+
'rml-general', // WP Real Media Library
|
400 |
+
'rml-library', // WP Real Media Library
|
401 |
+
'rml-grid', // WP Real Media Library
|
402 |
+
'rml-list', // WP Real Media Library
|
403 |
+
'rml-modal', // WP Real Media Library
|
404 |
+
'rml-order', // WP Real Media Library
|
405 |
+
'rml-meta', // WP Real Media Library
|
406 |
+
'rml-uploader', // WP Real Media Library
|
407 |
+
'rml-options', // WP Real Media Library
|
408 |
+
'rml-usersettings', // WP Real Media Library
|
409 |
+
'rml-main', // WP Real Media Library
|
410 |
+
'control-panel-sweet-alert', // Ken Theme
|
411 |
+
'sweet-alert-js', // Vitrine Theme
|
412 |
+
'theme-admin-script', // Vitrine Theme
|
413 |
+
'sweetalert', // Church Suite Theme by Webnus
|
414 |
+
'be_alerts_charts', // WooCommerce bolder product alerts
|
415 |
+
'magayo-lottery-results', // Magayo Lottery Results
|
416 |
+
'control-panel-sweet-alert', // Ken Theme
|
417 |
+
'cpm_chart', // WP Project Manager
|
418 |
+
'adminscripts', // Artisan Nayma Theme
|
419 |
+
'artisan-pages-script', // Artisan Pages Plugin
|
420 |
+
'tooltipster', // Grand News Theme
|
421 |
+
'fancybox', // Grand News Theme
|
422 |
+
'grandnews-admin-cript', // Grand News Theme
|
423 |
+
'colorpicker', // Grand News Theme
|
424 |
+
'eye', // Grand News Theme
|
425 |
+
'icheck', // Grand News Theme
|
426 |
+
'learn-press-chart', // LearnPress
|
427 |
+
'theme-script-main', // My Listing Theme by 27collective
|
428 |
+
'selz', // Selz eCommerce
|
429 |
+
'tie-admin-scripts', // Tie Theme
|
430 |
+
'blossomthemes-toolkit', // BlossomThemes Toolkit
|
431 |
+
'illdy-widget-upload-image', // Illdy Companion By Colorlib
|
432 |
+
'moment.js', // WooCommerce Table Rate Shipping
|
433 |
+
'default', // Bridge Theme
|
434 |
+
'qode-tax-js', // Bridge Theme
|
435 |
+
'wc_smartship_moment_js', // WooCommerce Posti SmartShip by markup.fi
|
436 |
+
'ecwid-admin-js', // Fixes Conflict for Ecwid Shopping Cart
|
437 |
+
'td-wp-admin-js', // Newspaper by tagDiv
|
438 |
+
'moment', // Screets Live Chat
|
439 |
+
'wpmf-base', // WP Media Folder Fix
|
440 |
+
'wpmf-media-filters', // WP Media Folder Fix
|
441 |
+
'wpmf-folder-tree', // WP Media Folder Fix
|
442 |
+
'wpmf-assign-tree', // WP Media Folder Fix
|
443 |
+
'js_files_for_wp_admin', // TagDiv Composer Fix
|
444 |
+
'tdb_js_files_for_wp_admin_last', // TagDiv Composer Fix
|
445 |
+
'tdb_js_files_for_wp_admin', // TagDiv Composer Fix
|
446 |
+
'wd-functions', // affiliate boxes
|
447 |
+
'ellk-aliExpansion', // Ali Dropship Plugin
|
448 |
+
'ftmetajs', // Houzez Theme
|
449 |
+
'qode_admin_default', // Fix For Stockholm Theme
|
450 |
+
'qodef-tax-js', // Fix for Prowess Theme
|
451 |
+
'qodef-user-js', // Fix for Prowess Theme
|
452 |
+
'qodef-ui-admin', // Fix for Prowess Theme
|
453 |
+
'ssi_script', // Fix for Add Social Share
|
454 |
+
'live_templates', // Fix for Add Social Share
|
455 |
+
'default', // Fix for Add Social Share
|
456 |
+
'handsontable', // Fix WP Tables
|
457 |
+
'moment-js', // Magee Shortcodes
|
458 |
+
'postbox', // Scripts from wp-admin enqueued everywhere by WP Posts Filter
|
459 |
+
'link', // Scripts from wp-admin enqueued everywhere by WP Posts Filter
|
460 |
+
'wpvr_scripts', // WP Video Robot
|
461 |
+
'wpvr_scripts_loaded', // WP Video Robot
|
462 |
+
'wpvr_scripts_assets', // WP Video Robot
|
463 |
+
'writee_widget_admin', // Fix for the Writtee theme
|
464 |
+
'__ytprefs_admin__', // Fix for YouTube by EmbedPlus plugin
|
465 |
+
'momentjs', // Fix for Blog Time plugin
|
466 |
+
'c2c_BlogTime', // Fix for Blog Time plugin
|
467 |
+
'material-wp', // Fix for MaterialWP plugin
|
468 |
+
'wp-color-picker-alpha', // Fix for MaterialWP plugin
|
469 |
+
'grandtour-theme-script', // Grandtour Theme
|
470 |
+
'swifty-img-widget-admin-script', // Fix for Swifty Image Widget
|
471 |
+
'datatable', // WP Todo
|
472 |
+
'flipclock', // WP Todo
|
473 |
+
'bootstrap', // WP Todo
|
474 |
+
'repuso_js_admin', // Social testimonials and reviews by Repuso
|
475 |
+
'chart', // Video Mate Pro Theme
|
476 |
+
'reuse_vendor', // RedQ Reuse Form
|
477 |
+
'jetpack-onboarding-vendor', // Jetpack Onboarding Bluehost
|
478 |
+
'date-js', // Google Analytics by Web Dorado
|
479 |
+
);
|
480 |
+
|
481 |
+
if ( ! empty( $styles ) ) {
|
482 |
+
foreach ( $styles as $style ) {
|
483 |
+
wp_dequeue_style( $style ); // Remove CSS file from MI screen
|
484 |
+
wp_deregister_style( $style );
|
485 |
+
}
|
486 |
+
}
|
487 |
+
if ( ! empty( $scripts ) ) {
|
488 |
+
foreach ( $scripts as $script ) {
|
489 |
+
wp_dequeue_script( $script ); // Remove JS file from MI screen
|
490 |
+
wp_deregister_script( $script );
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
$third_party = array(
|
495 |
+
'select2',
|
496 |
+
'sweetalert',
|
497 |
+
'clipboard',
|
498 |
+
'matchHeight',
|
499 |
+
'inputmask',
|
500 |
+
'jquery-confirm',
|
501 |
+
'list',
|
502 |
+
'toastr',
|
503 |
+
'tooltipster',
|
504 |
+
'flag-icon',
|
505 |
+
'bootstrap',
|
506 |
+
);
|
507 |
+
|
508 |
+
global $wp_styles;
|
509 |
+
foreach ( $wp_styles->queue as $handle ) {
|
510 |
+
if ( strpos( $wp_styles->registered[ $handle ]->src, 'wp-content' ) === false ) {
|
511 |
+
return;
|
512 |
+
}
|
513 |
+
|
514 |
+
if ( strpos( $wp_styles->registered[ $handle ]->handle, 'exactmetrics' ) !== false ) {
|
515 |
+
return;
|
516 |
+
}
|
517 |
+
|
518 |
+
foreach ( $third_party as $partial ) {
|
519 |
+
if ( strpos( $wp_styles->registered[ $handle ]->handle, $partial ) !== false ) {
|
520 |
+
wp_dequeue_style( $handle ); // Remove css file from MI screen
|
521 |
+
wp_deregister_style( $handle );
|
522 |
+
break;
|
523 |
+
} else if ( strpos( $wp_styles->registered[ $handle ]->src, $partial ) !== false ) {
|
524 |
+
wp_dequeue_style( $handle ); // Remove css file from MI screen
|
525 |
+
wp_deregister_style( $handle );
|
526 |
+
break;
|
527 |
+
}
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
global $wp_scripts;
|
532 |
+
foreach ( $wp_scripts->queue as $handle ) {
|
533 |
+
if ( strpos( $wp_scripts->registered[ $handle ]->src, 'wp-content' ) === false ) {
|
534 |
+
return;
|
535 |
+
}
|
536 |
+
|
537 |
+
if ( strpos( $wp_scripts->registered[ $handle ]->handle, 'exactmetrics' ) !== false ) {
|
538 |
+
return;
|
539 |
+
}
|
540 |
+
|
541 |
+
foreach ( $third_party as $partial ) {
|
542 |
+
if ( strpos( $wp_scripts->registered[ $handle ]->handle, $partial ) !== false ) {
|
543 |
+
wp_dequeue_script( $handle ); // Remove JS file from MI screen
|
544 |
+
wp_deregister_script( $handle );
|
545 |
+
break;
|
546 |
+
} else if ( strpos( $wp_scripts->registered[ $handle ]->src, $partial ) !== false ) {
|
547 |
+
wp_dequeue_script( $handle ); // Remove JS file from MI screen
|
548 |
+
wp_deregister_script( $handle );
|
549 |
+
break;
|
550 |
+
}
|
551 |
+
}
|
552 |
+
}
|
553 |
+
|
554 |
+
// Remove actions from themes that are not following best practices and break the admin doing so
|
555 |
+
// Theme: Newspaper by tagDiv
|
556 |
+
remove_action( 'admin_enqueue_scripts', 'load_wp_admin_js' );
|
557 |
+
remove_action( 'admin_enqueue_scripts', 'load_wp_admin_css' );
|
558 |
+
remove_action( 'admin_print_scripts-widgets.php', 'td_on_admin_print_scripts_farbtastic' );
|
559 |
+
remove_action( 'admin_print_styles-widgets.php', 'td_on_admin_print_styles_farbtastic' );
|
560 |
+
remove_action( 'admin_print_footer_scripts', 'check_if_media_uploads_is_loaded', 9999 );
|
561 |
+
remove_action( 'print_media_templates', 'td_custom_gallery_settings_hook' );
|
562 |
+
remove_action( 'print_media_templates', 'td_change_backbone_js_hook' );
|
563 |
+
remove_action( 'admin_head', 'tdc_on_admin_head' ); // TagDiv Composer Fix
|
564 |
+
remove_action( 'print_media_templates', 'us_media_templates' ); // Impreza Theme Fix
|
565 |
+
remove_action( 'admin_footer', 'gt3pg_add_gallery_template' ); // GT3 Photo & Video Gallery By GT3 Themes Plugin Fix
|
566 |
+
// Plugin WP Booklist:
|
567 |
+
remove_action( 'admin_footer', 'wpbooklist_jre_dismiss_prem_notice_forever_action_javascript' );
|
568 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_add_book_action_javascript' );
|
569 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_show_form_action_javascript' );
|
570 |
+
remove_action( 'admin_footer', 'wpbooklist_show_book_in_colorbox_action_javascript' );
|
571 |
+
remove_action( 'admin_footer', 'wpbooklist_new_lib_shortcode_action_javascript' );
|
572 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_save_library_display_options_action_javascript' );
|
573 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_save_post_display_options_action_javascript' );
|
574 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_save_page_display_options_action_javascript' );
|
575 |
+
remove_action( 'admin_footer', 'wpbooklist_update_display_options_action_javascript' );
|
576 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_pagination_action_javascript' );
|
577 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_switch_lib_action_javascript' );
|
578 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_search_action_javascript' );
|
579 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_actual_action_javascript' );
|
580 |
+
remove_action( 'admin_footer', 'wpbooklist_delete_book_action_javascript' );
|
581 |
+
remove_action( 'admin_footer', 'wpbooklist_user_apis_action_javascript' );
|
582 |
+
remove_action( 'admin_footer', 'wpbooklist_upload_new_stylepak_action_javascript' );
|
583 |
+
remove_action( 'admin_footer', 'wpbooklist_upload_new_post_template_action_javascript' );
|
584 |
+
remove_action( 'admin_footer', 'wpbooklist_upload_new_page_template_action_javascript' );
|
585 |
+
remove_action( 'admin_footer', 'wpbooklist_create_db_library_backup_action_javascript' );
|
586 |
+
remove_action( 'admin_footer', 'wpbooklist_restore_db_library_backup_action_javascript' );
|
587 |
+
remove_action( 'admin_footer', 'wpbooklist_create_csv_action_javascript' );
|
588 |
+
remove_action( 'admin_footer', 'wpbooklist_amazon_localization_action_javascript' );
|
589 |
+
remove_action( 'admin_footer', 'wpbooklist_delete_book_bulk_action_javascript' );
|
590 |
+
remove_action( 'admin_footer', 'wpbooklist_reorder_action_javascript' );
|
591 |
+
remove_action( 'admin_footer', 'wpbooklist_exit_results_action_javascript' );
|
592 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_select_category_action_javascript' );
|
593 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_get_story_action_javascript' );
|
594 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_expand_browse_action_javascript' );
|
595 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_save_settings_action_javascript' );
|
596 |
+
remove_action( 'admin_footer', 'wpbooklist_delete_story_action_javascript' );
|
597 |
+
}
|
598 |
+
|
599 |
+
add_action( 'admin_enqueue_scripts', 'exactmetrics_remove_conflicting_asset_files', 9999 );
|
600 |
+
|
601 |
+
/**
|
602 |
+
* Remove non-MI notices from MI page.
|
603 |
+
*
|
604 |
+
* @return null Return early if not on the proper screen.
|
605 |
+
* @since 6.0.0
|
606 |
+
* @access public
|
607 |
+
*
|
608 |
+
*/
|
609 |
+
function hide_non_exactmetrics_warnings() {
|
610 |
+
// Bail if we're not on a ExactMetrics screen.
|
611 |
+
if ( empty( $_REQUEST['page'] ) || strpos( $_REQUEST['page'], 'exactmetrics' ) === false ) {
|
612 |
+
return;
|
613 |
+
}
|
614 |
+
|
615 |
+
global $wp_filter;
|
616 |
+
if ( ! empty( $wp_filter['user_admin_notices']->callbacks ) && is_array( $wp_filter['user_admin_notices']->callbacks ) ) {
|
617 |
+
foreach ( $wp_filter['user_admin_notices']->callbacks as $priority => $hooks ) {
|
618 |
+
foreach ( $hooks as $name => $arr ) {
|
619 |
+
if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
|
620 |
+
unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
|
621 |
+
continue;
|
622 |
+
}
|
623 |
+
if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'exactmetrics' ) !== false ) {
|
624 |
+
continue;
|
625 |
+
}
|
626 |
+
if ( ! empty( $name ) && strpos( $name, 'exactmetrics' ) === false ) {
|
627 |
+
unset( $wp_filter['user_admin_notices']->callbacks[ $priority ][ $name ] );
|
628 |
+
}
|
629 |
+
}
|
630 |
+
}
|
631 |
+
}
|
632 |
+
|
633 |
+
if ( ! empty( $wp_filter['admin_notices']->callbacks ) && is_array( $wp_filter['admin_notices']->callbacks ) ) {
|
634 |
+
foreach ( $wp_filter['admin_notices']->callbacks as $priority => $hooks ) {
|
635 |
+
foreach ( $hooks as $name => $arr ) {
|
636 |
+
if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
|
637 |
+
unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
|
638 |
+
continue;
|
639 |
+
}
|
640 |
+
if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'exactmetrics' ) !== false ) {
|
641 |
+
continue;
|
642 |
+
}
|
643 |
+
if ( ! empty( $name ) && strpos( $name, 'exactmetrics' ) === false ) {
|
644 |
+
unset( $wp_filter['admin_notices']->callbacks[ $priority ][ $name ] );
|
645 |
+
}
|
646 |
+
}
|
647 |
+
}
|
648 |
+
}
|
649 |
+
|
650 |
+
if ( ! empty( $wp_filter['all_admin_notices']->callbacks ) && is_array( $wp_filter['all_admin_notices']->callbacks ) ) {
|
651 |
+
foreach ( $wp_filter['all_admin_notices']->callbacks as $priority => $hooks ) {
|
652 |
+
foreach ( $hooks as $name => $arr ) {
|
653 |
+
if ( is_object( $arr['function'] ) && $arr['function'] instanceof Closure ) {
|
654 |
+
unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
|
655 |
+
continue;
|
656 |
+
}
|
657 |
+
if ( ! empty( $arr['function'][0] ) && is_object( $arr['function'][0] ) && strpos( strtolower( get_class( $arr['function'][0] ) ), 'exactmetrics' ) !== false ) {
|
658 |
+
continue;
|
659 |
+
}
|
660 |
+
if ( ! empty( $name ) && strpos( $name, 'exactmetrics' ) === false ) {
|
661 |
+
unset( $wp_filter['all_admin_notices']->callbacks[ $priority ][ $name ] );
|
662 |
+
}
|
663 |
+
}
|
664 |
+
}
|
665 |
+
}
|
666 |
+
}
|
667 |
+
|
668 |
+
add_action( 'admin_print_scripts', 'hide_non_exactmetrics_warnings' );
|
669 |
+
add_action( 'admin_head', 'hide_non_exactmetrics_warnings', PHP_INT_MAX );
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Called whenever an upgrade button / link is displayed in Lite, this function will
|
673 |
+
* check if there's a shareasale ID specified.
|
674 |
+
*
|
675 |
+
* There are three ways to specify an ID, ordered by highest to lowest priority
|
676 |
+
* - add_filter( 'exactmetrics_shareasale_id', function() { return 1234; } );
|
677 |
+
* - define( 'EXACTMETRICS_SHAREASALE_ID', 1234 );
|
678 |
+
* - get_option( 'exactmetrics_shareasale_id' ); (with the option being in the wp_options table)
|
679 |
+
*
|
680 |
+
* If an ID is present, returns the ShareASale link with the affiliate ID, and tells
|
681 |
+
* ShareASale to then redirect to exactmetrics.com/lite
|
682 |
+
*
|
683 |
+
* If no ID is present, just returns the exactmetrics.com/lite URL with UTM tracking.
|
684 |
+
*
|
685 |
+
* @return string Upgrade link.
|
686 |
+
* @since 6.0.0
|
687 |
+
* @access public
|
688 |
+
*
|
689 |
+
*/
|
690 |
+
function exactmetrics_get_upgrade_link( $medium = '', $campaign = '', $url = '' ) {
|
691 |
+
$url = exactmetrics_get_url( $medium, $campaign, $url, false );
|
692 |
+
|
693 |
+
if ( exactmetrics_is_pro_version() ) {
|
694 |
+
return esc_url( $url );
|
695 |
+
}
|
696 |
+
|
697 |
+
// Get the ShareASale ID
|
698 |
+
$shareasale_id = exactmetrics_get_shareasale_id();
|
699 |
+
|
700 |
+
// If we have a shareasale ID return the shareasale url
|
701 |
+
if ( ! empty( $shareasale_id ) ) {
|
702 |
+
$shareasale_id = absint( $shareasale_id );
|
703 |
+
|
704 |
+
return esc_url( exactmetrics_get_shareasale_url( $shareasale_id, $url ) );
|
705 |
+
} else {
|
706 |
+
return esc_url( $url );
|
707 |
+
}
|
708 |
+
}
|
709 |
+
|
710 |
+
function exactmetrics_get_url( $medium = '', $campaign = '', $url = '', $escape = true ) {
|
711 |
+
// Setup Campaign variables
|
712 |
+
$source = exactmetrics_is_pro_version() ? 'proplugin' : 'liteplugin';
|
713 |
+
$medium = ! empty( $medium ) ? $medium : 'defaultmedium';
|
714 |
+
$campaign = ! empty( $campaign ) ? $campaign : 'defaultcampaign';
|
715 |
+
$content = EXACTMETRICS_VERSION;
|
716 |
+
$default_url = exactmetrics_is_pro_version() ? '' : 'lite/';
|
717 |
+
$url = ! empty( $url ) ? $url : 'https://www.exactmetrics.com/' . $default_url;
|
718 |
+
|
719 |
+
// Put together redirect URL
|
720 |
+
$url = add_query_arg(
|
721 |
+
array(
|
722 |
+
'utm_source' => $source, // Pro/Lite Plugin
|
723 |
+
'utm_medium' => sanitize_key( $medium ), // Area of ExactMetrics (example Reports)
|
724 |
+
'utm_campaign' => sanitize_key( $campaign ), // Which link (example eCommerce Report)
|
725 |
+
'utm_content' => $content, // Version number of MI
|
726 |
+
),
|
727 |
+
trailingslashit( $url )
|
728 |
+
);
|
729 |
+
|
730 |
+
if ( $escape ) {
|
731 |
+
return esc_url( $url );
|
732 |
+
} else {
|
733 |
+
return $url;
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
function exactmetrics_settings_ublock_error_js() {
|
738 |
+
echo "<script type='text/javascript'>\n";
|
739 |
+
echo "jQuery( document ).ready( function( $ ) {
|
740 |
+
if ( window.uorigindetected == null){
|
741 |
+
$('#exactmetrics-ublock-origin-error').show();
|
742 |
+
$('.exactmetrics-nav-tabs').hide();
|
743 |
+
$('.exactmetrics-nav-container').hide();
|
744 |
+
$('#exactmetrics-addon-heading').hide();
|
745 |
+
$('#exactmetrics-addons').hide();
|
746 |
+
$('#exactmetrics-reports').hide();
|
747 |
+
}
|
748 |
+
});";
|
749 |
+
echo "\n</script>";
|
750 |
+
}
|
751 |
+
|
752 |
+
function exactmetrics_ublock_notice() {
|
753 |
+
ob_start(); ?>
|
754 |
+
<div id="exactmetrics-ublock-origin-error" class="error inline" style="display:none;">
|
755 |
+
<?php
|
756 |
+
// Translators: Placeholders are for links to fix the issue.
|
757 |
+
echo sprintf( esc_html__( 'ExactMetrics has detected that it\'s files are being blocked. This is usually caused by a adblock browser plugin (particularly uBlock Origin), or a conflicting WordPress theme or plugin. This issue only affects the admin side of ExactMetrics. To solve this, ensure ExactMetrics is whitelisted for your website URL in any adblock browser plugin you use. For step by step directions on how to do this, %1$sclick here%2$s. If this doesn\'t solve the issue (rare), send us a ticket %3$shere%2$s and we\'ll be happy to help diagnose the issue.', 'google-analytics-dashboard-for-wp' ), '<a href="https://exactmetrics.com/docs/exactmetrics-asset-files-blocked/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">', '</a>', '<a href="https://exactmetrics.com/contact/" target="_blank" rel="noopener noreferrer" referrer="no-referrer">' );
|
758 |
+
?>
|
759 |
+
</div>
|
760 |
+
<?php
|
761 |
+
return ob_get_clean();
|
762 |
+
}
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Some themes/plugins don't add proper checks and load JS code in all admin pages causing conflicts.
|
766 |
+
*/
|
767 |
+
function exactmetrics_remove_unnecessary_footer_hooks() {
|
768 |
+
|
769 |
+
$screen = get_current_screen();
|
770 |
+
// Bail if we're not on a ExactMetrics screen.
|
771 |
+
if ( empty( $screen->id ) || strpos( $screen->id, 'exactmetrics' ) === false ) {
|
772 |
+
return;
|
773 |
+
}
|
774 |
+
|
775 |
+
// Remove js code added by Newspaper theme - version 8.8.0.
|
776 |
+
remove_action( 'print_media_templates', 'td_custom_gallery_settings_hook' );
|
777 |
+
remove_action( 'print_media_templates', 'td_change_backbone_js_hook' );
|
778 |
+
// Remove js code added by the Brooklyn theme - version 4.5.3.1.
|
779 |
+
remove_action( 'print_media_templates', 'ut_create_gallery_options' );
|
780 |
+
|
781 |
+
// Remove js code added by WordPress Book List Plugin - version 5.8.1.
|
782 |
+
remove_action( 'admin_footer', 'wpbooklist_jre_dismiss_prem_notice_forever_action_javascript' );
|
783 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_add_book_action_javascript' );
|
784 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_show_form_action_javascript' );
|
785 |
+
remove_action( 'admin_footer', 'wpbooklist_show_book_in_colorbox_action_javascript' );
|
786 |
+
remove_action( 'admin_footer', 'wpbooklist_new_lib_shortcode_action_javascript' );
|
787 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_save_library_display_options_action_javascript' );
|
788 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_save_post_display_options_action_javascript' );
|
789 |
+
remove_action( 'admin_footer', 'wpbooklist_dashboard_save_page_display_options_action_javascript' );
|
790 |
+
remove_action( 'admin_footer', 'wpbooklist_update_display_options_action_javascript' );
|
791 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_pagination_action_javascript' );
|
792 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_switch_lib_action_javascript' );
|
793 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_search_action_javascript' );
|
794 |
+
remove_action( 'admin_footer', 'wpbooklist_edit_book_actual_action_javascript' );
|
795 |
+
remove_action( 'admin_footer', 'wpbooklist_delete_book_action_javascript' );
|
796 |
+
remove_action( 'admin_footer', 'wpbooklist_user_apis_action_javascript' );
|
797 |
+
remove_action( 'admin_footer', 'wpbooklist_upload_new_stylepak_action_javascript' );
|
798 |
+
remove_action( 'admin_footer', 'wpbooklist_upload_new_post_template_action_javascript' );
|
799 |
+
remove_action( 'admin_footer', 'wpbooklist_upload_new_page_template_action_javascript' );
|
800 |
+
remove_action( 'admin_footer', 'wpbooklist_create_db_library_backup_action_javascript' );
|
801 |
+
remove_action( 'admin_footer', 'wpbooklist_restore_db_library_backup_action_javascript' );
|
802 |
+
remove_action( 'admin_footer', 'wpbooklist_create_csv_action_javascript' );
|
803 |
+
remove_action( 'admin_footer', 'wpbooklist_amazon_localization_action_javascript' );
|
804 |
+
remove_action( 'admin_footer', 'wpbooklist_delete_book_bulk_action_javascript' );
|
805 |
+
remove_action( 'admin_footer', 'wpbooklist_reorder_action_javascript' );
|
806 |
+
remove_action( 'admin_footer', 'wpbooklist_exit_results_action_javascript' );
|
807 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_select_category_action_javascript' );
|
808 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_get_story_action_javascript' );
|
809 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_expand_browse_action_javascript' );
|
810 |
+
remove_action( 'admin_footer', 'wpbooklist_storytime_save_settings_action_javascript' );
|
811 |
+
remove_action( 'admin_footer', 'wpbooklist_delete_story_action_javascript' );
|
812 |
+
}
|
813 |
+
|
814 |
+
add_action( 'admin_head', 'exactmetrics_remove_unnecessary_footer_hooks', 15 );
|
815 |
+
|
816 |
+
|
817 |
+
/**
|
818 |
+
* Prevent plugins/themes from removing the version number from scripts loaded by our plugin.
|
819 |
+
* Ideally those plugins/themes would follow WordPress coding best practices, but in lieu of that
|
820 |
+
* we can at least attempt to prevent 99% of them from doing bad things.
|
821 |
+
*
|
822 |
+
* @param string $src The script source.
|
823 |
+
*
|
824 |
+
* @return string
|
825 |
+
*/
|
826 |
+
function exactmetrics_prevent_version_number_removal( $src ) {
|
827 |
+
// Apply this only to admin-side scripts.
|
828 |
+
if ( ! is_admin() ) {
|
829 |
+
return $src;
|
830 |
+
}
|
831 |
+
|
832 |
+
// Make sure are only changing our scripts and only if the version number is missing.
|
833 |
+
if ( ( false !== strpos( $src, 'exactmetrics' ) || false !== strpos( $src, 'google-analytics-dashboard-for-wp' ) || false !== strpos( $src, 'exactmetrics-premium' ) ) && false === strpos( $src, '?ver' ) ) {
|
834 |
+
$src = add_query_arg( 'ver', exactmetrics_get_asset_version(), $src );
|
835 |
+
}
|
836 |
+
|
837 |
+
return $src;
|
838 |
+
}
|
839 |
+
|
840 |
+
add_filter( 'script_loader_src', 'exactmetrics_prevent_version_number_removal', 9999, 1 );
|
841 |
+
add_filter( 'style_loader_src', 'exactmetrics_prevent_version_number_removal', 9999, 1 );
|
842 |
+
|
843 |
+
/**
|
844 |
+
* Data used for the Vue scripts to display old PHP and WP versions warnings.
|
845 |
+
*/
|
846 |
+
function exactmetrics_get_php_wp_version_warning_data() {
|
847 |
+
global $wp_version;
|
848 |
+
|
849 |
+
$compatible_php_version = apply_filters( 'exactmetrics_compatible_php_version', false );
|
850 |
+
$compatible_wp_version = apply_filters( 'exactmetrics_compatible_wp_version', false );
|
851 |
+
|
852 |
+
return array(
|
853 |
+
'php_version' => phpversion(),
|
854 |
+
'php_version_below_54' => apply_filters( 'exactmetrics_temporarily_hide_php_under_56_upgrade_warnings', version_compare( phpversion(), $compatible_php_version['warning'], '<' ) ),
|
855 |
+
'php_version_below_56' => apply_filters( 'exactmetrics_temporarily_hide_php_56_upgrade_warnings', version_compare( phpversion(), $compatible_php_version['warning'], '>=' ) && version_compare( phpversion(), $compatible_php_version['recommended'], '<' ) ),
|
856 |
+
'php_update_link' => exactmetrics_get_url( 'settings-notice', 'settings-page', 'https://www.exactmetrics.com/docs/update-php/' ),
|
857 |
+
'wp_version' => $wp_version,
|
858 |
+
'wp_version_below_46' => version_compare( $wp_version, $compatible_wp_version['warning'], '<' ),
|
859 |
+
'wp_version_below_49' => version_compare( $wp_version, $compatible_wp_version['recommended'], '<' ),
|
860 |
+
'wp_update_link' => exactmetrics_get_url( 'settings-notice', 'settings-page', 'https://www.exactmetrics.com/docs/update-wordpress/' ),
|
861 |
+
);
|
862 |
+
}
|
863 |
+
|
864 |
+
/**
|
865 |
+
* Check WP and PHP version and add contextual notifications for upgrades.
|
866 |
+
*/
|
867 |
+
function exactmetrics_maybe_add_wp_php_version_notification() {
|
868 |
+
global $wp_version;
|
869 |
+
|
870 |
+
$icon = '<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="16" fill="#FAD1D1"/><path d="M17.3634 19.0714C17.792 19.4821 18.0063 19.9821 18.0063 20.5714C18.0063 21.1607 17.792 21.6607 17.3634 22.0714C16.9527 22.5 16.4527 22.7143 15.8634 22.7143C15.2742 22.7143 14.7652 22.5 14.3367 22.0714C13.9259 21.6607 13.7206 21.1607 13.7206 20.5714C13.7206 19.9821 13.9259 19.4821 14.3367 19.0714C14.7652 18.6429 15.2742 18.4286 15.8634 18.4286C16.4527 18.4286 16.9527 18.6429 17.3634 19.0714ZM13.9617 9.66964C13.9617 9.49107 14.0242 9.33929 14.1492 9.21429C14.2742 9.07143 14.4259 9 14.6045 9H17.1224C17.3009 9 17.4527 9.07143 17.5777 9.21429C17.7027 9.33929 17.7652 9.49107 17.7652 9.66964L17.3902 16.9554C17.3902 17.1339 17.3277 17.2857 17.2027 17.4107C17.0777 17.5179 16.9259 17.5714 16.7474 17.5714H14.9795C14.8009 17.5714 14.6492 17.5179 14.5242 17.4107C14.3992 17.2857 14.3367 17.1339 14.3367 16.9554L13.9617 9.66964Z" fill="#EB5757"/></svg>';
|
871 |
+
$needs_php_warning = version_compare( phpversion(), '5.6', '<' );
|
872 |
+
$needs_wp_warning = version_compare( $wp_version, '4.9', '<' );
|
873 |
+
|
874 |
+
if ( $needs_php_warning ) {
|
875 |
+
$notification['id'] = 'upgrade_php_56_notification';
|
876 |
+
$notification['title'] = __( 'ACTION REQUIRED: Your PHP version is putting your site at risk!', 'google-analytics-dashboard-for-wp' );
|
877 |
+
if ( $needs_wp_warning ) {
|
878 |
+
$notification['title'] = __( 'ACTION REQUIRED: Speed your website up 400% with a single email!', 'google-analytics-dashboard-for-wp' );
|
879 |
+
}
|
880 |
+
|
881 |
+
$php_url = exactmetrics_get_url( 'notifications', 'upgrade-php', 'https://www.exactmetrics.com/docs/update-php' );
|
882 |
+
|
883 |
+
$notification['type'] = array( 'basic', 'lite', 'master', 'plus', 'pro' );
|
884 |
+
// Translators: Placeholder is for the current PHP version.
|
885 |
+
$notification['content'] = sprintf( esc_html__( 'In the next major release of ExactMetrics we are planning to remove support for the version of PHP you are using (%s). This insecure version is no longer supported by WordPress itself, so you are already missing out on the latest features of WordPress along with critical updates for security and performance (modern PHP versions make websites much faster).', 'google-analytics-dashboard-for-wp' ), phpversion() ) . "\n\n";
|
886 |
+
|
887 |
+
// Translators: Placeholders add a link to an article.
|
888 |
+
$notification['content'] .= sprintf( esc_html__( 'To ensure ExactMetrics and other plugins on your site continue to function properly, and avoid putting your site at risk, please take a few minutes to ask your website hosting provider to upgrade the version of PHP to a modern PHP version (7.2 or newer). We provide helpful templates for how to ask them %1$shere%2$s.', 'google-analytics-dashboard-for-wp' ), '<a target="_blank" href="' . $php_url . '">', '</a>' ) . "\n\n";
|
889 |
+
$notification['content'] .= esc_html__( 'Upgrading your PHP version will make sure you are able to continue using WordPress without issues in the future, keep your site secure, and will also make your website up to 400% faster!', 'google-analytics-dashboard-for-wp' );
|
890 |
+
|
891 |
+
$notification['icon'] = $icon;
|
892 |
+
$notification['btns'] = array(
|
893 |
+
'learn_more' => array(
|
894 |
+
'url' => $php_url,
|
895 |
+
'text' => esc_html__( 'Learn More', 'google-analytics-dashboard-for-wp' ),
|
896 |
+
),
|
897 |
+
);
|
898 |
+
|
899 |
+
// Add the notification.
|
900 |
+
ExactMetrics()->notifications->add( $notification );
|
901 |
+
}
|
902 |
+
|
903 |
+
if ( $needs_wp_warning ) {
|
904 |
+
|
905 |
+
$isitwp_url = 'https://www.isitwp.com/upgrading-wordpress-is-easier-than-you-think/?utm_source=exactmetrics&utm_medium=notifications&utm_campaign=upgradewp';
|
906 |
+
$wpbeginner_url = 'https://www.wpbeginner.com/beginners-guide/why-you-should-always-use-the-latest-version-of-wordpress/utm_source=exactmetrics&utm_medium=notifications&utm_campaign=upgradewp';
|
907 |
+
|
908 |
+
$notification['id'] = 'upgrade_wp_49_notification';
|
909 |
+
$notification['title'] = __( 'ACTION REQUIRED: Your WordPress version is putting your site at risk!', 'google-analytics-dashboard-for-wp' );
|
910 |
+
$notification['type'] = array( 'basic', 'lite', 'master', 'plus', 'pro' );
|
911 |
+
// Translators: Placeholder is for the current WordPress version.
|
912 |
+
$notification['content'] = sprintf( esc_html__( 'In the next major release of ExactMetrics we are planning to remove support for the version of WordPress you are using (version %s). This version is several years out of date, and most plugins do not support this version anymore, so you could be missing out on critical updates for performance and security already!', 'google-analytics-dashboard-for-wp' ), $wp_version ) . "\n\n";
|
913 |
+
|
914 |
+
$notification['content'] .= esc_html__( 'The good news: updating WordPress has never been easier and only takes a few moments.', 'google-analytics-dashboard-for-wp' );
|
915 |
+
// Translators: Placeholders add links to articles.
|
916 |
+
$notification['content'] .= sprintf( esc_html__( 'To update, we recommend following this %1$sstep by step guide for updating WordPress%2$s from IsItWP and afterwards check out %3$sWhy You Should Always Use the Latest Version of WordPress%4$s on WPBeginner.', 'google-analytics-dashboard-for-wp' ), '<a target="_blank" href="' . $isitwp_url . '">', '</a>', '<a target="_blank" href="' . $wpbeginner_url . '">', '</a>' ) . "\n\n";
|
917 |
+
|
918 |
+
$notification['icon'] = $icon;
|
919 |
+
$notification['btns'] = array(
|
920 |
+
'learn_more' => array(
|
921 |
+
'url' => $isitwp_url,
|
922 |
+
'text' => esc_html__( 'Learn More', 'google-analytics-dashboard-for-wp' ),
|
923 |
+
),
|
924 |
+
);
|
925 |
+
|
926 |
+
// Add the notification.
|
927 |
+
ExactMetrics()->notifications->add( $notification );
|
928 |
+
}
|
929 |
+
|
930 |
+
}
|
931 |
+
|
932 |
+
add_action( 'admin_init', 'exactmetrics_maybe_add_wp_php_version_notification' );
|
933 |
+
|
934 |
+
/**
|
935 |
+
* Add notification for Year In Review report for year 2021.
|
936 |
+
*
|
937 |
+
* @since 7.13.2
|
938 |
+
*
|
939 |
+
* @return void
|
940 |
+
*/
|
941 |
+
function exactmetrics_year_in_review_notification() {
|
942 |
+
|
943 |
+
// Check if dates are between Jan 1st 2021 & 13th Jan 2021.
|
944 |
+
if ( exactmetrics_date_is_between( '2021-01-01', '2021-01-14' ) ) {
|
945 |
+
|
946 |
+
$notification['id'] = 'exactmetrics_notification_year_in_review';
|
947 |
+
$notification['type'] = array( 'basic', 'lite', 'master', 'plus', 'pro' );
|
948 |
+
$notification['start'] = '2021-01-01';
|
949 |
+
$notification['end'] = '2021-01-14';
|
950 |
+
$notification['title'] = esc_html__( 'View 2020 Year in Review report!', 'google-analytics-dashboard-for-wp' );
|
951 |
+
$notification['content'] = esc_html__( 'See how your website performed this year and find tips along the way to help grow even more in 2021!', 'google-analytics-dashboard-for-wp' );
|
952 |
+
$notification['btns'] = array(
|
953 |
+
'learn_more' => array(
|
954 |
+
'url' => esc_url( admin_url( 'admin.php?page=exactmetrics_reports#/year-in-review' ) ),
|
955 |
+
'text' => esc_html__( 'Learn More', 'google-analytics-dashboard-for-wp' ),
|
956 |
+
),
|
957 |
+
);
|
958 |
+
|
959 |
+
// Add the notification.
|
960 |
+
ExactMetrics()->notifications->add( $notification );
|
961 |
+
}
|
962 |
+
}
|
963 |
+
|
964 |
+
add_action( 'admin_init', 'exactmetrics_year_in_review_notification' );
|
includes/admin/index.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
-
//Nothing to see here
|
3 |
-
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
1 |
+
<?php
|
2 |
+
//Nothing to see here
|
3 |
+
|
4 |
header( 'HTTP/1.0 403 Forbidden' );
|
includes/admin/licensing/autoupdate.php
CHANGED
@@ -1,208 +1,208 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Check to see if the plugin file path matches the main pro plugin or an add-on of ours
|
4 |
-
*
|
5 |
-
* @param $plugin_file
|
6 |
-
*
|
7 |
-
* @return bool
|
8 |
-
*/
|
9 |
-
function exactmetrics_is_plugin_our_addon( $plugin_file ) {
|
10 |
-
$addons_data = exactmetrics_get_addons();
|
11 |
-
|
12 |
-
if ( ! is_array( $addons_data ) ) {
|
13 |
-
return false;
|
14 |
-
}
|
15 |
-
|
16 |
-
foreach ( $addons_data as $type => $addons ) {
|
17 |
-
foreach ( $addons as $addon ) {
|
18 |
-
$slug = 'exactmetrics-' . $addon->slug;
|
19 |
-
$basename = exactmetrics_get_plugin_basename_from_slug( $slug );
|
20 |
-
|
21 |
-
// Our eCommerce plugin uses a different slug.
|
22 |
-
if ( 'm' === $slug[0] && $slug === $basename && 'exactmetrics-ecommerce' === $slug ) {
|
23 |
-
$basename = exactmetrics_get_plugin_basename_from_slug( 'ga-ecommerce' );
|
24 |
-
}
|
25 |
-
|
26 |
-
if ( $plugin_file === $basename ) {
|
27 |
-
return true;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
return false;
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Add Manage Auto-updates link for MI pro and its add-ons on Plugins page
|
37 |
-
*
|
38 |
-
* @param $html
|
39 |
-
* @param $plugin_file
|
40 |
-
*
|
41 |
-
* @return string
|
42 |
-
*/
|
43 |
-
function exactmetrics_modify_wordpress_autoupdater_setting( $html, $plugin_file, $plugin_data ) {
|
44 |
-
$is_pro = exactmetrics_is_pro_version();
|
45 |
-
$is_addon = exactmetrics_is_plugin_our_addon( $plugin_file );
|
46 |
-
$is_main_free = isset( $plugin_data['slug'] ) && 'google-analytics-dashboard-for-wp' === $plugin_data['slug'];
|
47 |
-
$is_main_pro = $is_pro && plugin_basename( EXACTMETRICS_PLUGIN_FILE ) === $plugin_file;
|
48 |
-
$has_permission = current_user_can( 'exactmetrics_save_settings' );
|
49 |
-
|
50 |
-
if ( $is_addon && ! $is_pro ) {
|
51 |
-
$html = sprintf(
|
52 |
-
'<a href="%s">%s</a>',
|
53 |
-
exactmetrics_get_url(
|
54 |
-
'plugins-autoupdate',
|
55 |
-
'upgrade-to-autoupdate',
|
56 |
-
'https://www.exactmetrics.com/docs/go-lite-pro'
|
57 |
-
),
|
58 |
-
__( 'Enable the ExactMetrics PRO plugin to manage auto-updates', 'google-analytics-dashboard-for-wp' )
|
59 |
-
);
|
60 |
-
add_filter( "exactmetrics_is_autoupdate_setting_html_filtered_${plugin_file}", '__return_true' );
|
61 |
-
} elseif ( $has_permission &&
|
62 |
-
( $is_main_free || $is_main_pro || ( $is_addon && $is_pro ) )
|
63 |
-
) {
|
64 |
-
$text = __( 'Manage auto-updates', 'google-analytics-dashboard-for-wp' );
|
65 |
-
$html .= '<br>' . sprintf( '<a href="%s"">%s</a>', admin_url( 'admin.php?page=exactmetrics_settings#/advanced' ), $text );
|
66 |
-
add_filter( "exactmetrics_is_autoupdate_setting_html_filtered_${plugin_file}", '__return_true' );
|
67 |
-
}
|
68 |
-
|
69 |
-
return $html;
|
70 |
-
}
|
71 |
-
|
72 |
-
add_filter( 'plugin_auto_update_setting_html', 'exactmetrics_modify_wordpress_autoupdater_setting', 10, 3 );
|
73 |
-
|
74 |
-
/**
|
75 |
-
* Filters the auto update plugin routine to allow ExactMetrics to be
|
76 |
-
* automatically updated.
|
77 |
-
*
|
78 |
-
* This function is hooked into `auto_update_plugin`. This hook is used in
|
79 |
-
* two places:
|
80 |
-
* - Automatic plugin update routine.
|
81 |
-
* - Display the enabled / disabled state on Plugins page.
|
82 |
-
*
|
83 |
-
* When used in the context of automatic plugin update, this function consult
|
84 |
-
* the MI auto-update opt-in setting to see if the latest update is minor / major,
|
85 |
-
* and returns true or false accordingly.
|
86 |
-
*
|
87 |
-
* When used in the context of Plugins page, it will always return true no matter
|
88 |
-
* whether the opt-in is set to minor or major. It will only return false if the
|
89 |
-
* opt-in setting is disabled completely. We need to do this so that it's not confusing
|
90 |
-
* to the user, because WordPress auto-update UI does not deal with the same granularity
|
91 |
-
* as our opt-in setting.
|
92 |
-
*
|
93 |
-
* @since 6.3.0
|
94 |
-
*
|
95 |
-
* @param bool $update Flag to update the plugin or not.
|
96 |
-
* @param array $item Update data about a specific plugin.
|
97 |
-
* @return bool $update The new update state.
|
98 |
-
*/
|
99 |
-
function exactmetrics_automatic_updates( $update, $item ) {
|
100 |
-
$item = (array) $item;
|
101 |
-
|
102 |
-
$is_free = isset( $item['slug'] ) && 'google-analytics-dashboard-for-wp' === $item['slug'];
|
103 |
-
$is_paid = isset( $item['exactmetrics_plugin'] ); // see updater class
|
104 |
-
|
105 |
-
$automatic_updates = exactmetrics_get_option( 'automatic_updates', false );
|
106 |
-
|
107 |
-
// When used in the context of Plugins page.
|
108 |
-
if ( function_exists( 'get_current_screen' ) ) {
|
109 |
-
$screen = get_current_screen();
|
110 |
-
if ( ! empty( $screen ) &&
|
111 |
-
! empty( $screen->id ) &&
|
112 |
-
in_array( $screen->id, array( 'plugins', 'plugins-network' ) )
|
113 |
-
) {
|
114 |
-
$is_pro = exactmetrics_is_pro_version();
|
115 |
-
$is_addon = exactmetrics_is_plugin_our_addon( $item['plugin'] );
|
116 |
-
$is_main_pro = $is_pro && plugin_basename( EXACTMETRICS_PLUGIN_FILE ) === $item['plugin'];
|
117 |
-
|
118 |
-
if ( $is_free ||
|
119 |
-
$is_main_pro ||
|
120 |
-
( $is_addon && $is_pro )
|
121 |
-
) {
|
122 |
-
return in_array( $automatic_updates, array( 'all', 'minor' ) );
|
123 |
-
} elseif ( $is_addon && ! $is_pro ) {
|
124 |
-
return false;
|
125 |
-
}
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
// If this is multisite and is not on the main site, return early.
|
130 |
-
if ( is_multisite() && ! is_main_site() ) {
|
131 |
-
return $update;
|
132 |
-
}
|
133 |
-
|
134 |
-
// When used in the context of automatic plugin update routine, the $item
|
135 |
-
// variable will have `new_version`, `slug` and `exactmetrics_plugin` filled out:
|
136 |
-
|
137 |
-
// If we don't have everything we need, return early.
|
138 |
-
if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) {
|
139 |
-
return $update;
|
140 |
-
}
|
141 |
-
|
142 |
-
// If the plugin isn't ours, return early.
|
143 |
-
if ( ( ! $is_free && ! $is_paid ) || ( $is_free && ! defined( 'EXACTMETRICS_LITE_VERSION' ) ) ) {
|
144 |
-
return $update;
|
145 |
-
}
|
146 |
-
|
147 |
-
$version = $is_free ? EXACTMETRICS_LITE_VERSION : $item['old_version'];
|
148 |
-
$current_major = exactmetrics_get_major_version( $version );
|
149 |
-
$new_major = exactmetrics_get_major_version( $item['new_version'] );
|
150 |
-
|
151 |
-
// If the opt in update allows major updates but there is no major version update, return early.
|
152 |
-
if ( $current_major < $new_major ) {
|
153 |
-
if ( $automatic_updates === 'all' ) {
|
154 |
-
return true;
|
155 |
-
} else {
|
156 |
-
return $update;
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
// If the opt in update allows minor updates but there is no minor version update, return early.
|
161 |
-
if ( $current_major == $new_major ) {
|
162 |
-
if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) {
|
163 |
-
return true;
|
164 |
-
} else {
|
165 |
-
return $update;
|
166 |
-
}
|
167 |
-
}
|
168 |
-
|
169 |
-
// All our checks have passed - this plugin can be updated!
|
170 |
-
return true;
|
171 |
-
}
|
172 |
-
|
173 |
-
add_filter( 'auto_update_plugin', 'exactmetrics_automatic_updates', 10, 2 );
|
174 |
-
/**
|
175 |
-
* Notes about autoupdater:
|
176 |
-
* This runs on the normal WordPress auto-update sequence:
|
177 |
-
* 1. In wp-includes/update.php, wp_version_check() is called by the WordPress update cron (every 8 or 12 hours; can be overriden to be faster/long or turned off by plugins)
|
178 |
-
* 2. In wp-includes/update.php, wp_version_check() ends with a action call to do_action( 'wp_maybe_auto_update' ) if cron is running
|
179 |
-
* 3. In wp-includes/update.php, wp_maybe_auto_update() hooks into wp_maybe_auto_update action, creates a new WP_Automatic_Updater instance and calls WP_Automatic_Updater->run
|
180 |
-
* 4. In wp-admin/includes/class-wp-automatic-updater.php $this->run() checks to make sure we're on the main site if on a network, and also if the autoupdates are disabled (by plugin, by being on a version controlled site, etc )
|
181 |
-
* 5. In wp-admin/includes/class-wp-automatic-updater.php $this->run() then checks to see which plugins have new versions (version/update check)
|
182 |
-
* 6. In wp-admin/includes/class-wp-automatic-updater.php $this->run() then calls $this->update() for each plugin installed who has an upgrade.
|
183 |
-
* 7 In wp-admin/includes/class-wp-automatic-updater.php $this->update() double checks filesystem access and then installs the plugin if able
|
184 |
-
*
|
185 |
-
* Notes:
|
186 |
-
* - This autoupdater only works if WordPress core detects no version control. If you want to test this, do it on a new WP site without any .git folders anywhere.
|
187 |
-
* - This autoupdater only works if the file access is able to be written to
|
188 |
-
* - This autoupdater only works if a new version has been detected, and will run not the second the update is released, but whenever the cron for wp_version_check is next released. This is generally run every 8-12 hours.
|
189 |
-
* - However, that cron can be disabled, the autoupdater can be turned off via constant or filter, version control or file lock can be detected, and other plugins can be installed (incl in functions of theme) that turn off all
|
190 |
-
* all automatic plugin updates.
|
191 |
-
* - If you want to test this is working, you have to manually run the wp_version_check cron. Install the WP Crontrol plugin or Core Control plugin, and run the cron manually using it.
|
192 |
-
* - Again, because you skimmed over it the first time, if you want to test this manually you need to test this on a new WP install without version control for core, plugins, etc, without file lock, with license key entered (for pro only)
|
193 |
-
* and use the WP Crontrol or Core Control plugin to run wp_version_check
|
194 |
-
* - You may have to manually remove an option called "auto_update.lock" from the WP options table
|
195 |
-
* - You may need to run wp_version_check multiple times (note though that they must be spaced at least 60 seconds apart)
|
196 |
-
* - Because WP's updater asks the OS if the file is writable, make sure you do not have any files/folders for the plugin you are trying to autoupdate open when testing.
|
197 |
-
* - You may need to delete the plugin info transient to get it to hard refresh the plugin info.
|
198 |
-
*/
|
199 |
-
|
200 |
-
|
201 |
-
function exactmetrics_get_major_version( $version ) {
|
202 |
-
$exploded_version = explode( '.', $version );
|
203 |
-
if ( isset( $exploded_version[2] ) ) {
|
204 |
-
return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2];
|
205 |
-
} else {
|
206 |
-
return $exploded_version[0] . '.' . $exploded_version[1] . '.0';
|
207 |
-
}
|
208 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Check to see if the plugin file path matches the main pro plugin or an add-on of ours
|
4 |
+
*
|
5 |
+
* @param $plugin_file
|
6 |
+
*
|
7 |
+
* @return bool
|
8 |
+
*/
|
9 |
+
function exactmetrics_is_plugin_our_addon( $plugin_file ) {
|
10 |
+
$addons_data = exactmetrics_get_addons();
|
11 |
+
|
12 |
+
if ( ! is_array( $addons_data ) ) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
foreach ( $addons_data as $type => $addons ) {
|
17 |
+
foreach ( $addons as $addon ) {
|
18 |
+
$slug = 'exactmetrics-' . $addon->slug;
|
19 |
+
$basename = exactmetrics_get_plugin_basename_from_slug( $slug );
|
20 |
+
|
21 |
+
// Our eCommerce plugin uses a different slug.
|
22 |
+
if ( 'm' === $slug[0] && $slug === $basename && 'exactmetrics-ecommerce' === $slug ) {
|
23 |
+
$basename = exactmetrics_get_plugin_basename_from_slug( 'ga-ecommerce' );
|
24 |
+
}
|
25 |
+
|
26 |
+
if ( $plugin_file === $basename ) {
|
27 |
+
return true;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Add Manage Auto-updates link for MI pro and its add-ons on Plugins page
|
37 |
+
*
|
38 |
+
* @param $html
|
39 |
+
* @param $plugin_file
|
40 |
+
*
|
41 |
+
* @return string
|
42 |
+
*/
|
43 |
+
function exactmetrics_modify_wordpress_autoupdater_setting( $html, $plugin_file, $plugin_data ) {
|
44 |
+
$is_pro = exactmetrics_is_pro_version();
|
45 |
+
$is_addon = exactmetrics_is_plugin_our_addon( $plugin_file );
|
46 |
+
$is_main_free = isset( $plugin_data['slug'] ) && 'google-analytics-dashboard-for-wp' === $plugin_data['slug'];
|
47 |
+
$is_main_pro = $is_pro && plugin_basename( EXACTMETRICS_PLUGIN_FILE ) === $plugin_file;
|
48 |
+
$has_permission = current_user_can( 'exactmetrics_save_settings' );
|
49 |
+
|
50 |
+
if ( $is_addon && ! $is_pro ) {
|
51 |
+
$html = sprintf(
|
52 |
+
'<a href="%s">%s</a>',
|
53 |
+
exactmetrics_get_url(
|
54 |
+
'plugins-autoupdate',
|
55 |
+
'upgrade-to-autoupdate',
|
56 |
+
'https://www.exactmetrics.com/docs/go-lite-pro'
|
57 |
+
),
|
58 |
+
__( 'Enable the ExactMetrics PRO plugin to manage auto-updates', 'google-analytics-dashboard-for-wp' )
|
59 |
+
);
|
60 |
+
add_filter( "exactmetrics_is_autoupdate_setting_html_filtered_${plugin_file}", '__return_true' );
|
61 |
+
} elseif ( $has_permission &&
|
62 |
+
( $is_main_free || $is_main_pro || ( $is_addon && $is_pro ) )
|
63 |
+
) {
|
64 |
+
$text = __( 'Manage auto-updates', 'google-analytics-dashboard-for-wp' );
|
65 |
+
$html .= '<br>' . sprintf( '<a href="%s"">%s</a>', admin_url( 'admin.php?page=exactmetrics_settings#/advanced' ), $text );
|
66 |
+
add_filter( "exactmetrics_is_autoupdate_setting_html_filtered_${plugin_file}", '__return_true' );
|
67 |
+
}
|
68 |
+
|
69 |
+
return $html;
|
70 |
+
}
|
71 |
+
|
72 |
+
add_filter( 'plugin_auto_update_setting_html', 'exactmetrics_modify_wordpress_autoupdater_setting', 10, 3 );
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Filters the auto update plugin routine to allow ExactMetrics to be
|
76 |
+
* automatically updated.
|
77 |
+
*
|
78 |
+
* This function is hooked into `auto_update_plugin`. This hook is used in
|
79 |
+
* two places:
|
80 |
+
* - Automatic plugin update routine.
|
81 |
+
* - Display the enabled / disabled state on Plugins page.
|
82 |
+
*
|
83 |
+
* When used in the context of automatic plugin update, this function consult
|
84 |
+
* the MI auto-update opt-in setting to see if the latest update is minor / major,
|
85 |
+
* and returns true or false accordingly.
|
86 |
+
*
|
87 |
+
* When used in the context of Plugins page, it will always return true no matter
|
88 |
+
* whether the opt-in is set to minor or major. It will only return false if the
|
89 |
+
* opt-in setting is disabled completely. We need to do this so that it's not confusing
|
90 |
+
* to the user, because WordPress auto-update UI does not deal with the same granularity
|
91 |
+
* as our opt-in setting.
|
92 |
+
*
|
93 |
+
* @since 6.3.0
|
94 |
+
*
|
95 |
+
* @param bool $update Flag to update the plugin or not.
|
96 |
+
* @param array $item Update data about a specific plugin.
|
97 |
+
* @return bool $update The new update state.
|
98 |
+
*/
|
99 |
+
function exactmetrics_automatic_updates( $update, $item ) {
|
100 |
+
$item = (array) $item;
|
101 |
+
|
102 |
+
$is_free = isset( $item['slug'] ) && 'google-analytics-dashboard-for-wp' === $item['slug'];
|
103 |
+
$is_paid = isset( $item['exactmetrics_plugin'] ); // see updater class
|
104 |
+
|
105 |
+
$automatic_updates = exactmetrics_get_option( 'automatic_updates', false );
|
106 |
+
|
107 |
+
// When used in the context of Plugins page.
|
108 |
+
if ( function_exists( 'get_current_screen' ) ) {
|
109 |
+
$screen = get_current_screen();
|
110 |
+
if ( ! empty( $screen ) &&
|
111 |
+
! empty( $screen->id ) &&
|
112 |
+
in_array( $screen->id, array( 'plugins', 'plugins-network' ) )
|
113 |
+
) {
|
114 |
+
$is_pro = exactmetrics_is_pro_version();
|
115 |
+
$is_addon = exactmetrics_is_plugin_our_addon( $item['plugin'] );
|
116 |
+
$is_main_pro = $is_pro && plugin_basename( EXACTMETRICS_PLUGIN_FILE ) === $item['plugin'];
|
117 |
+
|
118 |
+
if ( $is_free ||
|
119 |
+
$is_main_pro ||
|
120 |
+
( $is_addon && $is_pro )
|
121 |
+
) {
|
122 |
+
return in_array( $automatic_updates, array( 'all', 'minor' ) );
|
123 |
+
} elseif ( $is_addon && ! $is_pro ) {
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
// If this is multisite and is not on the main site, return early.
|
130 |
+
if ( is_multisite() && ! is_main_site() ) {
|
131 |
+
return $update;
|
132 |
+
}
|
133 |
+
|
134 |
+
// When used in the context of automatic plugin update routine, the $item
|
135 |
+
// variable will have `new_version`, `slug` and `exactmetrics_plugin` filled out:
|
136 |
+
|
137 |
+
// If we don't have everything we need, return early.
|
138 |
+
if ( ! isset( $item['new_version'] ) || ! isset( $item['slug'] ) ) {
|
139 |
+
return $update;
|
140 |
+
}
|
141 |
+
|
142 |
+
// If the plugin isn't ours, return early.
|
143 |
+
if ( ( ! $is_free && ! $is_paid ) || ( $is_free && ! defined( 'EXACTMETRICS_LITE_VERSION' ) ) ) {
|
144 |
+
return $update;
|
145 |
+
}
|
146 |
+
|
147 |
+
$version = $is_free ? EXACTMETRICS_LITE_VERSION : $item['old_version'];
|
148 |
+
$current_major = exactmetrics_get_major_version( $version );
|
149 |
+
$new_major = exactmetrics_get_major_version( $item['new_version'] );
|
150 |
+
|
151 |
+
// If the opt in update allows major updates but there is no major version update, return early.
|
152 |
+
if ( $current_major < $new_major ) {
|
153 |
+
if ( $automatic_updates === 'all' ) {
|
154 |
+
return true;
|
155 |
+
} else {
|
156 |
+
return $update;
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
// If the opt in update allows minor updates but there is no minor version update, return early.
|
161 |
+
if ( $current_major == $new_major ) {
|
162 |
+
if ( $automatic_updates === 'all' || $automatic_updates === 'minor' ) {
|
163 |
+
return true;
|
164 |
+
} else {
|
165 |
+
return $update;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
// All our checks have passed - this plugin can be updated!
|
170 |
+
return true;
|
171 |
+
}
|
172 |
+
|
173 |
+
add_filter( 'auto_update_plugin', 'exactmetrics_automatic_updates', 10, 2 );
|
174 |
+
/**
|
175 |
+
* Notes about autoupdater:
|
176 |
+
* This runs on the normal WordPress auto-update sequence:
|
177 |
+
* 1. In wp-includes/update.php, wp_version_check() is called by the WordPress update cron (every 8 or 12 hours; can be overriden to be faster/long or turned off by plugins)
|
178 |
+
* 2. In wp-includes/update.php, wp_version_check() ends with a action call to do_action( 'wp_maybe_auto_update' ) if cron is running
|
179 |
+
* 3. In wp-includes/update.php, wp_maybe_auto_update() hooks into wp_maybe_auto_update action, creates a new WP_Automatic_Updater instance and calls WP_Automatic_Updater->run
|
180 |
+
* 4. In wp-admin/includes/class-wp-automatic-updater.php $this->run() checks to make sure we're on the main site if on a network, and also if the autoupdates are disabled (by plugin, by being on a version controlled site, etc )
|
181 |
+
* 5. In wp-admin/includes/class-wp-automatic-updater.php $this->run() then checks to see which plugins have new versions (version/update check)
|
182 |
+
* 6. In wp-admin/includes/class-wp-automatic-updater.php $this->run() then calls $this->update() for each plugin installed who has an upgrade.
|
183 |
+
* 7 In wp-admin/includes/class-wp-automatic-updater.php $this->update() double checks filesystem access and then installs the plugin if able
|
184 |
+
*
|
185 |
+
* Notes:
|
186 |
+
* - This autoupdater only works if WordPress core detects no version control. If you want to test this, do it on a new WP site without any .git folders anywhere.
|
187 |
+
* - This autoupdater only works if the file access is able to be written to
|
188 |
+
* - This autoupdater only works if a new version has been detected, and will run not the second the update is released, but whenever the cron for wp_version_check is next released. This is generally run every 8-12 hours.
|
189 |
+
* - However, that cron can be disabled, the autoupdater can be turned off via constant or filter, version control or file lock can be detected, and other plugins can be installed (incl in functions of theme) that turn off all
|
190 |
+
* all automatic plugin updates.
|
191 |
+
* - If you want to test this is working, you have to manually run the wp_version_check cron. Install the WP Crontrol plugin or Core Control plugin, and run the cron manually using it.
|
192 |
+
* - Again, because you skimmed over it the first time, if you want to test this manually you need to test this on a new WP install without version control for core, plugins, etc, without file lock, with license key entered (for pro only)
|
193 |
+
* and use the WP Crontrol or Core Control plugin to run wp_version_check
|
194 |
+
* - You may have to manually remove an option called "auto_update.lock" from the WP options table
|
195 |
+
* - You may need to run wp_version_check multiple times (note though that they must be spaced at least 60 seconds apart)
|
196 |
+
* - Because WP's updater asks the OS if the file is writable, make sure you do not have any files/folders for the plugin you are trying to autoupdate open when testing.
|
197 |
+
* - You may need to delete the plugin info transient to get it to hard refresh the plugin info.
|
198 |
+
*/
|
199 |
+
|
200 |
+
|
201 |
+
function exactmetrics_get_major_version( $version ) {
|
202 |
+
$exploded_version = explode( '.', $version );
|
203 |
+
if ( isset( $exploded_version[2] ) ) {
|
204 |
+
return $exploded_version[0] . '.' . $exploded_version[1] . '.' . $exploded_version[2];
|
205 |
+
} else {
|
206 |
+
return $exploded_version[0] . '.' . $exploded_version[1] . '.0';
|
207 |
+
}
|
208 |
+
}
|
includes/admin/licensing/plugin-upgrader-legacy.php
CHANGED
@@ -1,571 +1,571 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/** WP_Upgrader class */
|
4 |
-
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
5 |
-
|
6 |
-
/** Plugin_Upgrader class */
|
7 |
-
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
8 |
-
|
9 |
-
|
10 |
-
/**
|
11 |
-
* In WP 5.3 a PHP 5.6 splat operator (...$args) was added to WP_Upgrader_Skin::feedback().
|
12 |
-
* We need to remove all calls to *Skin::feedback() method, as we can't override it in own Skins
|
13 |
-
* without breaking support for PHP 5.3-5.5.
|
14 |
-
*
|
15 |
-
* @internal Please do not use this class outside of core ExactMetrics development. May be removed at any time.
|
16 |
-
*
|
17 |
-
* @since 7.10.6
|
18 |
-
*/
|
19 |
-
class ExactMetrics_Plugin_Upgrader extends Plugin_Upgrader {
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Run an upgrade/installation.
|
23 |
-
*
|
24 |
-
* Attempt to download the package (if it is not a local file), unpack it, and
|
25 |
-
* install it in the destination folder.
|
26 |
-
*
|
27 |
-
* @since 1.5.6.1
|
28 |
-
*
|
29 |
-
* @param array $options {
|
30 |
-
* Array or string of arguments for upgrading/installing a package.
|
31 |
-
*
|
32 |
-
* @type string $package The full path or URI of the package to install.
|
33 |
-
* Default empty.
|
34 |
-
* @type string $destination The full path to the destination folder.
|
35 |
-
* Default empty.
|
36 |
-
* @type bool $clear_destination Whether to delete any files already in the
|
37 |
-
* destination folder. Default false.
|
38 |
-
* @type bool $clear_working Whether to delete the files form the working
|
39 |
-
* directory after copying to the destination.
|
40 |
-
* Default false.
|
41 |
-
* @type bool $abort_if_destination_exists Whether to abort the installation if the destination
|
42 |
-
* folder already exists. When true, `$clear_destination`
|
43 |
-
* should be false. Default true.
|
44 |
-
* @type bool $is_multi Whether this run is one of multiple upgrade/installation
|
45 |
-
* actions being performed in bulk. When true, the skin
|
46 |
-
* WP_Upgrader::header() and WP_Upgrader::footer()
|
47 |
-
* aren't called. Default false.
|
48 |
-
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
49 |
-
* WP_Upgrader::run().
|
50 |
-
* }
|
51 |
-
* @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error,
|
52 |
-
* or false if unable to connect to the filesystem.
|
53 |
-
*/
|
54 |
-
public function run( $options ) {
|
55 |
-
|
56 |
-
$defaults = array(
|
57 |
-
'package' => '', // Please always pass this.
|
58 |
-
'destination' => '', // And this
|
59 |
-
'clear_destination' => false,
|
60 |
-
'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
|
61 |
-
'clear_working' => true,
|
62 |
-
'is_multi' => false,
|
63 |
-
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
|
64 |
-
);
|
65 |
-
|
66 |
-
$options = wp_parse_args( $options, $defaults );
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Filter the package options before running an update.
|
70 |
-
*
|
71 |
-
* See also {@see 'upgrader_process_complete'}.
|
72 |
-
*
|
73 |
-
* @since 4.3.0
|
74 |
-
*
|
75 |
-
* @param array $options {
|
76 |
-
* Options used by the upgrader.
|
77 |
-
*
|
78 |
-
* @type string $package Package for update.
|
79 |
-
* @type string $destination Update location.
|
80 |
-
* @type bool $clear_destination Clear the destination resource.
|
81 |
-
* @type bool $clear_working Clear the working resource.
|
82 |
-
* @type bool $abort_if_destination_exists Abort if the Destination directory exists.
|
83 |
-
* @type bool $is_multi Whether the upgrader is running multiple times.
|
84 |
-
* @type array $hook_extra {
|
85 |
-
* Extra hook arguments.
|
86 |
-
*
|
87 |
-
* @type string $action Type of action. Default 'update'.
|
88 |
-
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
|
89 |
-
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
90 |
-
* @type string $plugin Path to the plugin file relative to the plugins directory.
|
91 |
-
* @type string $theme The stylesheet or template name of the theme.
|
92 |
-
* @type string $language_update_type The language pack update type. Accepts 'plugin', 'theme',
|
93 |
-
* or 'core'.
|
94 |
-
* @type object $language_update The language pack update offer.
|
95 |
-
* }
|
96 |
-
* }
|
97 |
-
*/
|
98 |
-
$options = apply_filters( 'upgrader_package_options', $options );
|
99 |
-
|
100 |
-
if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
|
101 |
-
$this->skin->header();
|
102 |
-
}
|
103 |
-
|
104 |
-
// Connect to the Filesystem first.
|
105 |
-
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
|
106 |
-
// Mainly for non-connected filesystem.
|
107 |
-
if ( ! $res ) {
|
108 |
-
if ( ! $options['is_multi'] ) {
|
109 |
-
$this->skin->footer();
|
110 |
-
}
|
111 |
-
return false;
|
112 |
-
}
|
113 |
-
|
114 |
-
$this->skin->before();
|
115 |
-
|
116 |
-
if ( is_wp_error( $res ) ) {
|
117 |
-
$this->skin->error( $res );
|
118 |
-
$this->skin->after();
|
119 |
-
if ( ! $options['is_multi'] ) {
|
120 |
-
$this->skin->footer();
|
121 |
-
}
|
122 |
-
return $res;
|
123 |
-
}
|
124 |
-
|
125 |
-
/*
|
126 |
-
* Download the package (Note, This just returns the filename
|
127 |
-
* of the file if the package is a local file)
|
128 |
-
*/
|
129 |
-
$download = $this->download_package( $options['package'], true );
|
130 |
-
|
131 |
-
// Allow for signature soft-fail.
|
132 |
-
// WARNING: This may be removed in the future.
|
133 |
-
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
|
134 |
-
|
135 |
-
// Don't output the 'no signature could be found' failure message for now.
|
136 |
-
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
|
137 |
-
// Outout the failure error as a normal feedback, and not as an error:
|
138 |
-
//$this->skin->feedback( $download->get_error_message() );
|
139 |
-
|
140 |
-
// Report this failure back to WordPress.org for debugging purposes.
|
141 |
-
wp_version_check(
|
142 |
-
array(
|
143 |
-
'signature_failure_code' => $download->get_error_code(),
|
144 |
-
'signature_failure_data' => $download->get_error_data(),
|
145 |
-
)
|
146 |
-
);
|
147 |
-
}
|
148 |
-
|
149 |
-
// Pretend this error didn't happen.
|
150 |
-
$download = $download->get_error_data( 'softfail-filename' );
|
151 |
-
}
|
152 |
-
|
153 |
-
if ( is_wp_error( $download ) ) {
|
154 |
-
$this->skin->error( $download );
|
155 |
-
$this->skin->after();
|
156 |
-
if ( ! $options['is_multi'] ) {
|
157 |
-
$this->skin->footer();
|
158 |
-
}
|
159 |
-
return $download;
|
160 |
-
}
|
161 |
-
|
162 |
-
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
|
163 |
-
|
164 |
-
// Unzips the file into a temporary directory.
|
165 |
-
$working_dir = $this->unpack_package( $download, $delete_package );
|
166 |
-
if ( is_wp_error( $working_dir ) ) {
|
167 |
-
$this->skin->error( $working_dir );
|
168 |
-
$this->skin->after();
|
169 |
-
if ( ! $options['is_multi'] ) {
|
170 |
-
$this->skin->footer();
|
171 |
-
}
|
172 |
-
return $working_dir;
|
173 |
-
}
|
174 |
-
|
175 |
-
// With the given options, this installs it to the destination directory.
|
176 |
-
$result = $this->install_package(
|
177 |
-
array(
|
178 |
-
'source' => $working_dir,
|
179 |
-
'destination' => $options['destination'],
|
180 |
-
'clear_destination' => $options['clear_destination'],
|
181 |
-
'abort_if_destination_exists' => $options['abort_if_destination_exists'],
|
182 |
-
'clear_working' => $options['clear_working'],
|
183 |
-
'hook_extra' => $options['hook_extra'],
|
184 |
-
)
|
185 |
-
);
|
186 |
-
|
187 |
-
$this->skin->set_result( $result );
|
188 |
-
if ( is_wp_error( $result ) ) {
|
189 |
-
$this->skin->error( $result );
|
190 |
-
//$this->skin->feedback( 'process_failed' );
|
191 |
-
} else {
|
192 |
-
// Installation succeeded.
|
193 |
-
//$this->skin->feedback( 'process_success' );
|
194 |
-
}
|
195 |
-
|
196 |
-
$this->skin->after();
|
197 |
-
|
198 |
-
if ( ! $options['is_multi'] ) {
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Fire when the upgrader process is complete.
|
202 |
-
*
|
203 |
-
* See also {@see 'upgrader_package_options'}.
|
204 |
-
*
|
205 |
-
* @since 3.6.0
|
206 |
-
* @since 3.7.0 Added to WP_Upgrader::run().
|
207 |
-
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
|
208 |
-
*
|
209 |
-
* @param WP_Upgrader $this WP_Upgrader instance. In other contexts, $this, might be a
|
210 |
-
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
|
211 |
-
* @param array $hook_extra {
|
212 |
-
* Array of bulk item update data.
|
213 |
-
*
|
214 |
-
* @type string $action Type of action. Default 'update'.
|
215 |
-
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
|
216 |
-
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
217 |
-
* @type array $plugins Array of the basename paths of the plugins' main files.
|
218 |
-
* @type array $themes The theme slugs.
|
219 |
-
* @type array $translations {
|
220 |
-
* Array of translations update data.
|
221 |
-
*
|
222 |
-
* @type string $language The locale the translation is for.
|
223 |
-
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
|
224 |
-
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
|
225 |
-
* 'default' for core translations.
|
226 |
-
* @type string $version The version of a theme, plugin, or core.
|
227 |
-
* }
|
228 |
-
* }
|
229 |
-
*/
|
230 |
-
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
|
231 |
-
|
232 |
-
$this->skin->footer();
|
233 |
-
}
|
234 |
-
|
235 |
-
return $result;
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Toggle maintenance mode for the site.
|
240 |
-
*
|
241 |
-
* Create/delete the maintenance file to enable/disable maintenance mode.
|
242 |
-
*
|
243 |
-
* @since 2.8.0
|
244 |
-
*
|
245 |
-
* @global WP_Filesystem_Base $wp_filesystem Subclass
|
246 |
-
*
|
247 |
-
* @param bool $enable True to enable maintenance mode, false to disable.
|
248 |
-
*/
|
249 |
-
public function maintenance_mode( $enable = false ) {
|
250 |
-
global $wp_filesystem;
|
251 |
-
$file = $wp_filesystem->abspath() . '.maintenance';
|
252 |
-
if ( $enable ) {
|
253 |
-
//$this->skin->feedback( 'maintenance_start' );
|
254 |
-
// Create maintenance file to signal that we are upgrading
|
255 |
-
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
|
256 |
-
$wp_filesystem->delete( $file );
|
257 |
-
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
|
258 |
-
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
|
259 |
-
//$this->skin->feedback( 'maintenance_end' );
|
260 |
-
$wp_filesystem->delete( $file );
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Download a package.
|
266 |
-
*
|
267 |
-
* @since 2.8.0
|
268 |
-
*
|
269 |
-
* @param string $package The URI of the package. If this is the full path to an
|
270 |
-
* existing local file, it will be returned untouched.
|
271 |
-
* @param bool $check_signatures Whether to validate file signatures. Default false.
|
272 |
-
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
|
273 |
-
*/
|
274 |
-
public function download_package( $package, $check_signatures = false ) {
|
275 |
-
|
276 |
-
/**
|
277 |
-
* Filter whether to return the package.
|
278 |
-
*
|
279 |
-
* @since 3.7.0
|
280 |
-
*
|
281 |
-
* @param bool $reply Whether to bail without returning the package.
|
282 |
-
* Default false.
|
283 |
-
* @param string $package The package file name.
|
284 |
-
* @param WP_Upgrader $this The WP_Upgrader instance.
|
285 |
-
*/
|
286 |
-
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
|
287 |
-
if ( false !== $reply ) {
|
288 |
-
return $reply;
|
289 |
-
}
|
290 |
-
|
291 |
-
if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote?
|
292 |
-
return $package; //must be a local file..
|
293 |
-
}
|
294 |
-
|
295 |
-
if ( empty( $package ) ) {
|
296 |
-
return new WP_Error( 'no_package', $this->strings['no_package'] );
|
297 |
-
}
|
298 |
-
|
299 |
-
//$this->skin->feedback( 'downloading_package', $package );
|
300 |
-
|
301 |
-
$download_file = download_url( $package, 300, $check_signatures );
|
302 |
-
|
303 |
-
if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) {
|
304 |
-
return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() );
|
305 |
-
}
|
306 |
-
|
307 |
-
return $download_file;
|
308 |
-
}
|
309 |
-
|
310 |
-
/**
|
311 |
-
* Unpack a compressed package file.
|
312 |
-
*
|
313 |
-
* @since 2.8.0
|
314 |
-
*
|
315 |
-
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
316 |
-
*
|
317 |
-
* @param string $package Full path to the package file.
|
318 |
-
* @param bool $delete_package Optional. Whether to delete the package file after attempting
|
319 |
-
* to unpack it. Default true.
|
320 |
-
* @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure.
|
321 |
-
*/
|
322 |
-
public function unpack_package( $package, $delete_package = true ) {
|
323 |
-
global $wp_filesystem;
|
324 |
-
|
325 |
-
//$this->skin->feedback( 'unpack_package' );
|
326 |
-
|
327 |
-
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
|
328 |
-
|
329 |
-
//Clean up contents of upgrade directory beforehand.
|
330 |
-
$upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );
|
331 |
-
if ( ! empty( $upgrade_files ) ) {
|
332 |
-
foreach ( $upgrade_files as $file ) {
|
333 |
-
$wp_filesystem->delete( $upgrade_folder . $file['name'], true );
|
334 |
-
}
|
335 |
-
}
|
336 |
-
|
337 |
-
// We need a working directory - Strip off any .tmp or .zip suffixes
|
338 |
-
$working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
|
339 |
-
|
340 |
-
// Clean up working directory
|
341 |
-
if ( $wp_filesystem->is_dir( $working_dir ) ) {
|
342 |
-
$wp_filesystem->delete( $working_dir, true );
|
343 |
-
}
|
344 |
-
|
345 |
-
// Unzip package to working directory
|
346 |
-
$result = unzip_file( $package, $working_dir );
|
347 |
-
|
348 |
-
// Once extracted, delete the package if required.
|
349 |
-
if ( $delete_package ) {
|
350 |
-
unlink( $package );
|
351 |
-
}
|
352 |
-
|
353 |
-
if ( is_wp_error( $result ) ) {
|
354 |
-
$wp_filesystem->delete( $working_dir, true );
|
355 |
-
if ( 'incompatible_archive' == $result->get_error_code() ) {
|
356 |
-
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
|
357 |
-
}
|
358 |
-
return $result;
|
359 |
-
}
|
360 |
-
|
361 |
-
return $working_dir;
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Install a package.
|
366 |
-
*
|
367 |
-
* Copies the contents of a package form a source directory, and installs them in
|
368 |
-
* a destination directory. Optionally removes the source. It can also optionally
|
369 |
-
* clear out the destination folder if it already exists.
|
370 |
-
*
|
371 |
-
* @since 2.8.0
|
372 |
-
*
|
373 |
-
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
374 |
-
* @global array $wp_theme_directories
|
375 |
-
*
|
376 |
-
* @param array|string $args {
|
377 |
-
* Optional. Array or string of arguments for installing a package. Default empty array.
|
378 |
-
*
|
379 |
-
* @type string $source Required path to the package source. Default empty.
|
380 |
-
* @type string $destination Required path to a folder to install the package in.
|
381 |
-
* Default empty.
|
382 |
-
* @type bool $clear_destination Whether to delete any files already in the destination
|
383 |
-
* folder. Default false.
|
384 |
-
* @type bool $clear_working Whether to delete the files form the working directory
|
385 |
-
* after copying to the destination. Default false.
|
386 |
-
* @type bool $abort_if_destination_exists Whether to abort the installation if
|
387 |
-
* the destination folder already exists. Default true.
|
388 |
-
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
389 |
-
* WP_Upgrader::install_package(). Default empty array.
|
390 |
-
* }
|
391 |
-
*
|
392 |
-
* @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
|
393 |
-
*/
|
394 |
-
public function install_package( $args = array() ) {
|
395 |
-
global $wp_filesystem, $wp_theme_directories;
|
396 |
-
|
397 |
-
$defaults = array(
|
398 |
-
'source' => '', // Please always pass this
|
399 |
-
'destination' => '', // and this
|
400 |
-
'clear_destination' => false,
|
401 |
-
'clear_working' => false,
|
402 |
-
'abort_if_destination_exists' => true,
|
403 |
-
'hook_extra' => array(),
|
404 |
-
);
|
405 |
-
|
406 |
-
$args = wp_parse_args( $args, $defaults );
|
407 |
-
|
408 |
-
// These were previously extract()'d.
|
409 |
-
$source = $args['source'];
|
410 |
-
$destination = $args['destination'];
|
411 |
-
$clear_destination = $args['clear_destination'];
|
412 |
-
|
413 |
-
set_time_limit( 300 );
|
414 |
-
|
415 |
-
if ( empty( $source ) || empty( $destination ) ) {
|
416 |
-
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
|
417 |
-
}
|
418 |
-
//$this->skin->feedback( 'installing_package' );
|
419 |
-
|
420 |
-
/**
|
421 |
-
* Filter the install response before the installation has started.
|
422 |
-
*
|
423 |
-
* Returning a truthy value, or one that could be evaluated as a WP_Error
|
424 |
-
* will effectively short-circuit the installation, returning that value
|
425 |
-
* instead.
|
426 |
-
*
|
427 |
-
* @since 2.8.0
|
428 |
-
*
|
429 |
-
* @param bool|WP_Error $response Response.
|
430 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
431 |
-
*/
|
432 |
-
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
|
433 |
-
|
434 |
-
if ( is_wp_error( $res ) ) {
|
435 |
-
return $res;
|
436 |
-
}
|
437 |
-
|
438 |
-
//Retain the Original source and destinations
|
439 |
-
$remote_source = $args['source'];
|
440 |
-
$local_destination = $destination;
|
441 |
-
|
442 |
-
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
|
443 |
-
$remote_destination = $wp_filesystem->find_folder( $local_destination );
|
444 |
-
|
445 |
-
//Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
|
446 |
-
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
|
447 |
-
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
|
448 |
-
} elseif ( count( $source_files ) == 0 ) {
|
449 |
-
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
|
450 |
-
} else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename.
|
451 |
-
$source = trailingslashit( $args['source'] );
|
452 |
-
}
|
453 |
-
|
454 |
-
/**
|
455 |
-
* Filter the source file location for the upgrade package.
|
456 |
-
*
|
457 |
-
* @since 2.8.0
|
458 |
-
* @since 4.4.0 The $hook_extra parameter became available.
|
459 |
-
*
|
460 |
-
* @param string $source File source location.
|
461 |
-
* @param string $remote_source Remote file source location.
|
462 |
-
* @param WP_Upgrader $this WP_Upgrader instance.
|
463 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
464 |
-
*/
|
465 |
-
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );
|
466 |
-
|
467 |
-
if ( is_wp_error( $source ) ) {
|
468 |
-
return $source;
|
469 |
-
}
|
470 |
-
|
471 |
-
// Has the source location changed? If so, we need a new source_files list.
|
472 |
-
if ( $source !== $remote_source ) {
|
473 |
-
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
|
474 |
-
}
|
475 |
-
|
476 |
-
/*
|
477 |
-
* Protection against deleting files in any important base directories.
|
478 |
-
* Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
|
479 |
-
* destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
|
480 |
-
* to copy the directory into the directory, whilst they pass the source
|
481 |
-
* as the actual files to copy.
|
482 |
-
*/
|
483 |
-
$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
|
484 |
-
|
485 |
-
if ( is_array( $wp_theme_directories ) ) {
|
486 |
-
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
|
487 |
-
}
|
488 |
-
|
489 |
-
if ( in_array( $destination, $protected_directories ) ) {
|
490 |
-
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
|
491 |
-
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
|
492 |
-
}
|
493 |
-
|
494 |
-
if ( $clear_destination ) {
|
495 |
-
// We're going to clear the destination if there's something there.
|
496 |
-
//$this->skin->feedback( 'remove_old' );
|
497 |
-
|
498 |
-
$removed = $this->clear_destination( $remote_destination );
|
499 |
-
|
500 |
-
/**
|
501 |
-
* Filter whether the upgrader cleared the destination.
|
502 |
-
*
|
503 |
-
* @since 2.8.0
|
504 |
-
*
|
505 |
-
* @param mixed $removed Whether the destination was cleared. true on success, WP_Error on failure
|
506 |
-
* @param string $local_destination The local package destination.
|
507 |
-
* @param string $remote_destination The remote package destination.
|
508 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
509 |
-
*/
|
510 |
-
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );
|
511 |
-
|
512 |
-
if ( is_wp_error( $removed ) ) {
|
513 |
-
return $removed;
|
514 |
-
}
|
515 |
-
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
|
516 |
-
//If we're not clearing the destination folder and something exists there already, Bail.
|
517 |
-
//But first check to see if there are actually any files in the folder.
|
518 |
-
$_files = $wp_filesystem->dirlist( $remote_destination );
|
519 |
-
if ( ! empty( $_files ) ) {
|
520 |
-
$wp_filesystem->delete( $remote_source, true ); //Clear out the source files.
|
521 |
-
return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination );
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
//Create destination if needed
|
526 |
-
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
|
527 |
-
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
|
528 |
-
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
|
529 |
-
}
|
530 |
-
}
|
531 |
-
// Copy new version of item into place.
|
532 |
-
$result = copy_dir( $source, $remote_destination );
|
533 |
-
if ( is_wp_error( $result ) ) {
|
534 |
-
if ( $args['clear_working'] ) {
|
535 |
-
$wp_filesystem->delete( $remote_source, true );
|
536 |
-
}
|
537 |
-
return $result;
|
538 |
-
}
|
539 |
-
|
540 |
-
//Clear the Working folder?
|
541 |
-
if ( $args['clear_working'] ) {
|
542 |
-
$wp_filesystem->delete( $remote_source, true );
|
543 |
-
}
|
544 |
-
|
545 |
-
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
|
546 |
-
if ( '.' == $destination_name ) {
|
547 |
-
$destination_name = '';
|
548 |
-
}
|
549 |
-
|
550 |
-
$this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' );
|
551 |
-
|
552 |
-
/**
|
553 |
-
* Filter the installation response after the installation has finished.
|
554 |
-
*
|
555 |
-
* @since 2.8.0
|
556 |
-
*
|
557 |
-
* @param bool $response Installation response.
|
558 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
559 |
-
* @param array $result Installation result data.
|
560 |
-
*/
|
561 |
-
$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );
|
562 |
-
|
563 |
-
if ( is_wp_error( $res ) ) {
|
564 |
-
$this->result = $res;
|
565 |
-
return $res;
|
566 |
-
}
|
567 |
-
|
568 |
-
//Bombard the calling function will all the info which we've just used.
|
569 |
-
return $this->result;
|
570 |
-
}
|
571 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** WP_Upgrader class */
|
4 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
5 |
+
|
6 |
+
/** Plugin_Upgrader class */
|
7 |
+
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
8 |
+
|
9 |
+
|
10 |
+
/**
|
11 |
+
* In WP 5.3 a PHP 5.6 splat operator (...$args) was added to WP_Upgrader_Skin::feedback().
|
12 |
+
* We need to remove all calls to *Skin::feedback() method, as we can't override it in own Skins
|
13 |
+
* without breaking support for PHP 5.3-5.5.
|
14 |
+
*
|
15 |
+
* @internal Please do not use this class outside of core ExactMetrics development. May be removed at any time.
|
16 |
+
*
|
17 |
+
* @since 7.10.6
|
18 |
+
*/
|
19 |
+
class ExactMetrics_Plugin_Upgrader extends Plugin_Upgrader {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Run an upgrade/installation.
|
23 |
+
*
|
24 |
+
* Attempt to download the package (if it is not a local file), unpack it, and
|
25 |
+
* install it in the destination folder.
|
26 |
+
*
|
27 |
+
* @since 1.5.6.1
|
28 |
+
*
|
29 |
+
* @param array $options {
|
30 |
+
* Array or string of arguments for upgrading/installing a package.
|
31 |
+
*
|
32 |
+
* @type string $package The full path or URI of the package to install.
|
33 |
+
* Default empty.
|
34 |
+
* @type string $destination The full path to the destination folder.
|
35 |
+
* Default empty.
|
36 |
+
* @type bool $clear_destination Whether to delete any files already in the
|
37 |
+
* destination folder. Default false.
|
38 |
+
* @type bool $clear_working Whether to delete the files form the working
|
39 |
+
* directory after copying to the destination.
|
40 |
+
* Default false.
|
41 |
+
* @type bool $abort_if_destination_exists Whether to abort the installation if the destination
|
42 |
+
* folder already exists. When true, `$clear_destination`
|
43 |
+
* should be false. Default true.
|
44 |
+
* @type bool $is_multi Whether this run is one of multiple upgrade/installation
|
45 |
+
* actions being performed in bulk. When true, the skin
|
46 |
+
* WP_Upgrader::header() and WP_Upgrader::footer()
|
47 |
+
* aren't called. Default false.
|
48 |
+
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
49 |
+
* WP_Upgrader::run().
|
50 |
+
* }
|
51 |
+
* @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error,
|
52 |
+
* or false if unable to connect to the filesystem.
|
53 |
+
*/
|
54 |
+
public function run( $options ) {
|
55 |
+
|
56 |
+
$defaults = array(
|
57 |
+
'package' => '', // Please always pass this.
|
58 |
+
'destination' => '', // And this
|
59 |
+
'clear_destination' => false,
|
60 |
+
'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
|
61 |
+
'clear_working' => true,
|
62 |
+
'is_multi' => false,
|
63 |
+
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
|
64 |
+
);
|
65 |
+
|
66 |
+
$options = wp_parse_args( $options, $defaults );
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Filter the package options before running an update.
|
70 |
+
*
|
71 |
+
* See also {@see 'upgrader_process_complete'}.
|
72 |
+
*
|
73 |
+
* @since 4.3.0
|
74 |
+
*
|
75 |
+
* @param array $options {
|
76 |
+
* Options used by the upgrader.
|
77 |
+
*
|
78 |
+
* @type string $package Package for update.
|
79 |
+
* @type string $destination Update location.
|
80 |
+
* @type bool $clear_destination Clear the destination resource.
|
81 |
+
* @type bool $clear_working Clear the working resource.
|
82 |
+
* @type bool $abort_if_destination_exists Abort if the Destination directory exists.
|
83 |
+
* @type bool $is_multi Whether the upgrader is running multiple times.
|
84 |
+
* @type array $hook_extra {
|
85 |
+
* Extra hook arguments.
|
86 |
+
*
|
87 |
+
* @type string $action Type of action. Default 'update'.
|
88 |
+
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
|
89 |
+
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
90 |
+
* @type string $plugin Path to the plugin file relative to the plugins directory.
|
91 |
+
* @type string $theme The stylesheet or template name of the theme.
|
92 |
+
* @type string $language_update_type The language pack update type. Accepts 'plugin', 'theme',
|
93 |
+
* or 'core'.
|
94 |
+
* @type object $language_update The language pack update offer.
|
95 |
+
* }
|
96 |
+
* }
|
97 |
+
*/
|
98 |
+
$options = apply_filters( 'upgrader_package_options', $options );
|
99 |
+
|
100 |
+
if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
|
101 |
+
$this->skin->header();
|
102 |
+
}
|
103 |
+
|
104 |
+
// Connect to the Filesystem first.
|
105 |
+
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
|
106 |
+
// Mainly for non-connected filesystem.
|
107 |
+
if ( ! $res ) {
|
108 |
+
if ( ! $options['is_multi'] ) {
|
109 |
+
$this->skin->footer();
|
110 |
+
}
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->skin->before();
|
115 |
+
|
116 |
+
if ( is_wp_error( $res ) ) {
|
117 |
+
$this->skin->error( $res );
|
118 |
+
$this->skin->after();
|
119 |
+
if ( ! $options['is_multi'] ) {
|
120 |
+
$this->skin->footer();
|
121 |
+
}
|
122 |
+
return $res;
|
123 |
+
}
|
124 |
+
|
125 |
+
/*
|
126 |
+
* Download the package (Note, This just returns the filename
|
127 |
+
* of the file if the package is a local file)
|
128 |
+
*/
|
129 |
+
$download = $this->download_package( $options['package'], true );
|
130 |
+
|
131 |
+
// Allow for signature soft-fail.
|
132 |
+
// WARNING: This may be removed in the future.
|
133 |
+
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
|
134 |
+
|
135 |
+
// Don't output the 'no signature could be found' failure message for now.
|
136 |
+
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
|
137 |
+
// Outout the failure error as a normal feedback, and not as an error:
|
138 |
+
//$this->skin->feedback( $download->get_error_message() );
|
139 |
+
|
140 |
+
// Report this failure back to WordPress.org for debugging purposes.
|
141 |
+
wp_version_check(
|
142 |
+
array(
|
143 |
+
'signature_failure_code' => $download->get_error_code(),
|
144 |
+
'signature_failure_data' => $download->get_error_data(),
|
145 |
+
)
|
146 |
+
);
|
147 |
+
}
|
148 |
+
|
149 |
+
// Pretend this error didn't happen.
|
150 |
+
$download = $download->get_error_data( 'softfail-filename' );
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( is_wp_error( $download ) ) {
|
154 |
+
$this->skin->error( $download );
|
155 |
+
$this->skin->after();
|
156 |
+
if ( ! $options['is_multi'] ) {
|
157 |
+
$this->skin->footer();
|
158 |
+
}
|
159 |
+
return $download;
|
160 |
+
}
|
161 |
+
|
162 |
+
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
|
163 |
+
|
164 |
+
// Unzips the file into a temporary directory.
|
165 |
+
$working_dir = $this->unpack_package( $download, $delete_package );
|
166 |
+
if ( is_wp_error( $working_dir ) ) {
|
167 |
+
$this->skin->error( $working_dir );
|
168 |
+
$this->skin->after();
|
169 |
+
if ( ! $options['is_multi'] ) {
|
170 |
+
$this->skin->footer();
|
171 |
+
}
|
172 |
+
return $working_dir;
|
173 |
+
}
|
174 |
+
|
175 |
+
// With the given options, this installs it to the destination directory.
|
176 |
+
$result = $this->install_package(
|
177 |
+
array(
|
178 |
+
'source' => $working_dir,
|
179 |
+
'destination' => $options['destination'],
|
180 |
+
'clear_destination' => $options['clear_destination'],
|
181 |
+
'abort_if_destination_exists' => $options['abort_if_destination_exists'],
|
182 |
+
'clear_working' => $options['clear_working'],
|
183 |
+
'hook_extra' => $options['hook_extra'],
|
184 |
+
)
|
185 |
+
);
|
186 |
+
|
187 |
+
$this->skin->set_result( $result );
|
188 |
+
if ( is_wp_error( $result ) ) {
|
189 |
+
$this->skin->error( $result );
|
190 |
+
//$this->skin->feedback( 'process_failed' );
|
191 |
+
} else {
|
192 |
+
// Installation succeeded.
|
193 |
+
//$this->skin->feedback( 'process_success' );
|
194 |
+
}
|
195 |
+
|
196 |
+
$this->skin->after();
|
197 |
+
|
198 |
+
if ( ! $options['is_multi'] ) {
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Fire when the upgrader process is complete.
|
202 |
+
*
|
203 |
+
* See also {@see 'upgrader_package_options'}.
|
204 |
+
*
|
205 |
+
* @since 3.6.0
|
206 |
+
* @since 3.7.0 Added to WP_Upgrader::run().
|
207 |
+
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
|
208 |
+
*
|
209 |
+
* @param WP_Upgrader $this WP_Upgrader instance. In other contexts, $this, might be a
|
210 |
+
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
|
211 |
+
* @param array $hook_extra {
|
212 |
+
* Array of bulk item update data.
|
213 |
+
*
|
214 |
+
* @type string $action Type of action. Default 'update'.
|
215 |
+
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
|
216 |
+
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
217 |
+
* @type array $plugins Array of the basename paths of the plugins' main files.
|
218 |
+
* @type array $themes The theme slugs.
|
219 |
+
* @type array $translations {
|
220 |
+
* Array of translations update data.
|
221 |
+
*
|
222 |
+
* @type string $language The locale the translation is for.
|
223 |
+
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
|
224 |
+
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
|
225 |
+
* 'default' for core translations.
|
226 |
+
* @type string $version The version of a theme, plugin, or core.
|
227 |
+
* }
|
228 |
+
* }
|
229 |
+
*/
|
230 |
+
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
|
231 |
+
|
232 |
+
$this->skin->footer();
|
233 |
+
}
|
234 |
+
|
235 |
+
return $result;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Toggle maintenance mode for the site.
|
240 |
+
*
|
241 |
+
* Create/delete the maintenance file to enable/disable maintenance mode.
|
242 |
+
*
|
243 |
+
* @since 2.8.0
|
244 |
+
*
|
245 |
+
* @global WP_Filesystem_Base $wp_filesystem Subclass
|
246 |
+
*
|
247 |
+
* @param bool $enable True to enable maintenance mode, false to disable.
|
248 |
+
*/
|
249 |
+
public function maintenance_mode( $enable = false ) {
|
250 |
+
global $wp_filesystem;
|
251 |
+
$file = $wp_filesystem->abspath() . '.maintenance';
|
252 |
+
if ( $enable ) {
|
253 |
+
//$this->skin->feedback( 'maintenance_start' );
|
254 |
+
// Create maintenance file to signal that we are upgrading
|
255 |
+
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
|
256 |
+
$wp_filesystem->delete( $file );
|
257 |
+
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
|
258 |
+
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
|
259 |
+
//$this->skin->feedback( 'maintenance_end' );
|
260 |
+
$wp_filesystem->delete( $file );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Download a package.
|
266 |
+
*
|
267 |
+
* @since 2.8.0
|
268 |
+
*
|
269 |
+
* @param string $package The URI of the package. If this is the full path to an
|
270 |
+
* existing local file, it will be returned untouched.
|
271 |
+
* @param bool $check_signatures Whether to validate file signatures. Default false.
|
272 |
+
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
|
273 |
+
*/
|
274 |
+
public function download_package( $package, $check_signatures = false ) {
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Filter whether to return the package.
|
278 |
+
*
|
279 |
+
* @since 3.7.0
|
280 |
+
*
|
281 |
+
* @param bool $reply Whether to bail without returning the package.
|
282 |
+
* Default false.
|
283 |
+
* @param string $package The package file name.
|
284 |
+
* @param WP_Upgrader $this The WP_Upgrader instance.
|
285 |
+
*/
|
286 |
+
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
|
287 |
+
if ( false !== $reply ) {
|
288 |
+
return $reply;
|
289 |
+
}
|
290 |
+
|
291 |
+
if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote?
|
292 |
+
return $package; //must be a local file..
|
293 |
+
}
|
294 |
+
|
295 |
+
if ( empty( $package ) ) {
|
296 |
+
return new WP_Error( 'no_package', $this->strings['no_package'] );
|
297 |
+
}
|
298 |
+
|
299 |
+
//$this->skin->feedback( 'downloading_package', $package );
|
300 |
+
|
301 |
+
$download_file = download_url( $package, 300, $check_signatures );
|
302 |
+
|
303 |
+
if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) {
|
304 |
+
return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() );
|
305 |
+
}
|
306 |
+
|
307 |
+
return $download_file;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Unpack a compressed package file.
|
312 |
+
*
|
313 |
+
* @since 2.8.0
|
314 |
+
*
|
315 |
+
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
316 |
+
*
|
317 |
+
* @param string $package Full path to the package file.
|
318 |
+
* @param bool $delete_package Optional. Whether to delete the package file after attempting
|
319 |
+
* to unpack it. Default true.
|
320 |
+
* @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure.
|
321 |
+
*/
|
322 |
+
public function unpack_package( $package, $delete_package = true ) {
|
323 |
+
global $wp_filesystem;
|
324 |
+
|
325 |
+
//$this->skin->feedback( 'unpack_package' );
|
326 |
+
|
327 |
+
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
|
328 |
+
|
329 |
+
//Clean up contents of upgrade directory beforehand.
|
330 |
+
$upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );
|
331 |
+
if ( ! empty( $upgrade_files ) ) {
|
332 |
+
foreach ( $upgrade_files as $file ) {
|
333 |
+
$wp_filesystem->delete( $upgrade_folder . $file['name'], true );
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
// We need a working directory - Strip off any .tmp or .zip suffixes
|
338 |
+
$working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
|
339 |
+
|
340 |
+
// Clean up working directory
|
341 |
+
if ( $wp_filesystem->is_dir( $working_dir ) ) {
|
342 |
+
$wp_filesystem->delete( $working_dir, true );
|
343 |
+
}
|
344 |
+
|
345 |
+
// Unzip package to working directory
|
346 |
+
$result = unzip_file( $package, $working_dir );
|
347 |
+
|
348 |
+
// Once extracted, delete the package if required.
|
349 |
+
if ( $delete_package ) {
|
350 |
+
unlink( $package );
|
351 |
+
}
|
352 |
+
|
353 |
+
if ( is_wp_error( $result ) ) {
|
354 |
+
$wp_filesystem->delete( $working_dir, true );
|
355 |
+
if ( 'incompatible_archive' == $result->get_error_code() ) {
|
356 |
+
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
|
357 |
+
}
|
358 |
+
return $result;
|
359 |
+
}
|
360 |
+
|
361 |
+
return $working_dir;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Install a package.
|
366 |
+
*
|
367 |
+
* Copies the contents of a package form a source directory, and installs them in
|
368 |
+
* a destination directory. Optionally removes the source. It can also optionally
|
369 |
+
* clear out the destination folder if it already exists.
|
370 |
+
*
|
371 |
+
* @since 2.8.0
|
372 |
+
*
|
373 |
+
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
374 |
+
* @global array $wp_theme_directories
|
375 |
+
*
|
376 |
+
* @param array|string $args {
|
377 |
+
* Optional. Array or string of arguments for installing a package. Default empty array.
|
378 |
+
*
|
379 |
+
* @type string $source Required path to the package source. Default empty.
|
380 |
+
* @type string $destination Required path to a folder to install the package in.
|
381 |
+
* Default empty.
|
382 |
+
* @type bool $clear_destination Whether to delete any files already in the destination
|
383 |
+
* folder. Default false.
|
384 |
+
* @type bool $clear_working Whether to delete the files form the working directory
|
385 |
+
* after copying to the destination. Default false.
|
386 |
+
* @type bool $abort_if_destination_exists Whether to abort the installation if
|
387 |
+
* the destination folder already exists. Default true.
|
388 |
+
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
389 |
+
* WP_Upgrader::install_package(). Default empty array.
|
390 |
+
* }
|
391 |
+
*
|
392 |
+
* @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
|
393 |
+
*/
|
394 |
+
public function install_package( $args = array() ) {
|
395 |
+
global $wp_filesystem, $wp_theme_directories;
|
396 |
+
|
397 |
+
$defaults = array(
|
398 |
+
'source' => '', // Please always pass this
|
399 |
+
'destination' => '', // and this
|
400 |
+
'clear_destination' => false,
|
401 |
+
'clear_working' => false,
|
402 |
+
'abort_if_destination_exists' => true,
|
403 |
+
'hook_extra' => array(),
|
404 |
+
);
|
405 |
+
|
406 |
+
$args = wp_parse_args( $args, $defaults );
|
407 |
+
|
408 |
+
// These were previously extract()'d.
|
409 |
+
$source = $args['source'];
|
410 |
+
$destination = $args['destination'];
|
411 |
+
$clear_destination = $args['clear_destination'];
|
412 |
+
|
413 |
+
set_time_limit( 300 );
|
414 |
+
|
415 |
+
if ( empty( $source ) || empty( $destination ) ) {
|
416 |
+
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
|
417 |
+
}
|
418 |
+
//$this->skin->feedback( 'installing_package' );
|
419 |
+
|
420 |
+
/**
|
421 |
+
* Filter the install response before the installation has started.
|
422 |
+
*
|
423 |
+
* Returning a truthy value, or one that could be evaluated as a WP_Error
|
424 |
+
* will effectively short-circuit the installation, returning that value
|
425 |
+
* instead.
|
426 |
+
*
|
427 |
+
* @since 2.8.0
|
428 |
+
*
|
429 |
+
* @param bool|WP_Error $response Response.
|
430 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
431 |
+
*/
|
432 |
+
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
|
433 |
+
|
434 |
+
if ( is_wp_error( $res ) ) {
|
435 |
+
return $res;
|
436 |
+
}
|
437 |
+
|
438 |
+
//Retain the Original source and destinations
|
439 |
+
$remote_source = $args['source'];
|
440 |
+
$local_destination = $destination;
|
441 |
+
|
442 |
+
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
|
443 |
+
$remote_destination = $wp_filesystem->find_folder( $local_destination );
|
444 |
+
|
445 |
+
//Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
|
446 |
+
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
|
447 |
+
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
|
448 |
+
} elseif ( count( $source_files ) == 0 ) {
|
449 |
+
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
|
450 |
+
} else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename.
|
451 |
+
$source = trailingslashit( $args['source'] );
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Filter the source file location for the upgrade package.
|
456 |
+
*
|
457 |
+
* @since 2.8.0
|
458 |
+
* @since 4.4.0 The $hook_extra parameter became available.
|
459 |
+
*
|
460 |
+
* @param string $source File source location.
|
461 |
+
* @param string $remote_source Remote file source location.
|
462 |
+
* @param WP_Upgrader $this WP_Upgrader instance.
|
463 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
464 |
+
*/
|
465 |
+
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );
|
466 |
+
|
467 |
+
if ( is_wp_error( $source ) ) {
|
468 |
+
return $source;
|
469 |
+
}
|
470 |
+
|
471 |
+
// Has the source location changed? If so, we need a new source_files list.
|
472 |
+
if ( $source !== $remote_source ) {
|
473 |
+
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
|
474 |
+
}
|
475 |
+
|
476 |
+
/*
|
477 |
+
* Protection against deleting files in any important base directories.
|
478 |
+
* Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
|
479 |
+
* destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
|
480 |
+
* to copy the directory into the directory, whilst they pass the source
|
481 |
+
* as the actual files to copy.
|
482 |
+
*/
|
483 |
+
$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
|
484 |
+
|
485 |
+
if ( is_array( $wp_theme_directories ) ) {
|
486 |
+
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
|
487 |
+
}
|
488 |
+
|
489 |
+
if ( in_array( $destination, $protected_directories ) ) {
|
490 |
+
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
|
491 |
+
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
|
492 |
+
}
|
493 |
+
|
494 |
+
if ( $clear_destination ) {
|
495 |
+
// We're going to clear the destination if there's something there.
|
496 |
+
//$this->skin->feedback( 'remove_old' );
|
497 |
+
|
498 |
+
$removed = $this->clear_destination( $remote_destination );
|
499 |
+
|
500 |
+
/**
|
501 |
+
* Filter whether the upgrader cleared the destination.
|
502 |
+
*
|
503 |
+
* @since 2.8.0
|
504 |
+
*
|
505 |
+
* @param mixed $removed Whether the destination was cleared. true on success, WP_Error on failure
|
506 |
+
* @param string $local_destination The local package destination.
|
507 |
+
* @param string $remote_destination The remote package destination.
|
508 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
509 |
+
*/
|
510 |
+
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );
|
511 |
+
|
512 |
+
if ( is_wp_error( $removed ) ) {
|
513 |
+
return $removed;
|
514 |
+
}
|
515 |
+
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
|
516 |
+
//If we're not clearing the destination folder and something exists there already, Bail.
|
517 |
+
//But first check to see if there are actually any files in the folder.
|
518 |
+
$_files = $wp_filesystem->dirlist( $remote_destination );
|
519 |
+
if ( ! empty( $_files ) ) {
|
520 |
+
$wp_filesystem->delete( $remote_source, true ); //Clear out the source files.
|
521 |
+
return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination );
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
//Create destination if needed
|
526 |
+
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
|
527 |
+
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
|
528 |
+
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
|
529 |
+
}
|
530 |
+
}
|
531 |
+
// Copy new version of item into place.
|
532 |
+
$result = copy_dir( $source, $remote_destination );
|
533 |
+
if ( is_wp_error( $result ) ) {
|
534 |
+
if ( $args['clear_working'] ) {
|
535 |
+
$wp_filesystem->delete( $remote_source, true );
|
536 |
+
}
|
537 |
+
return $result;
|
538 |
+
}
|
539 |
+
|
540 |
+
//Clear the Working folder?
|
541 |
+
if ( $args['clear_working'] ) {
|
542 |
+
$wp_filesystem->delete( $remote_source, true );
|
543 |
+
}
|
544 |
+
|
545 |
+
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
|
546 |
+
if ( '.' == $destination_name ) {
|
547 |
+
$destination_name = '';
|
548 |
+
}
|
549 |
+
|
550 |
+
$this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' );
|
551 |
+
|
552 |
+
/**
|
553 |
+
* Filter the installation response after the installation has finished.
|
554 |
+
*
|
555 |
+
* @since 2.8.0
|
556 |
+
*
|
557 |
+
* @param bool $response Installation response.
|
558 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
559 |
+
* @param array $result Installation result data.
|
560 |
+
*/
|
561 |
+
$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );
|
562 |
+
|
563 |
+
if ( is_wp_error( $res ) ) {
|
564 |
+
$this->result = $res;
|
565 |
+
return $res;
|
566 |
+
}
|
567 |
+
|
568 |
+
//Bombard the calling function will all the info which we've just used.
|
569 |
+
return $this->result;
|
570 |
+
}
|
571 |
+
}
|
includes/admin/licensing/plugin-upgrader.php
CHANGED
@@ -1,573 +1,573 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/** WP_Upgrader class */
|
4 |
-
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
5 |
-
|
6 |
-
/** Plugin_Upgrader class */
|
7 |
-
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
8 |
-
|
9 |
-
|
10 |
-
/**
|
11 |
-
* In WP 5.3 a PHP 5.6 splat operator (...$args) was added to WP_Upgrader_Skin::feedback().
|
12 |
-
* We need to remove all calls to *Skin::feedback() method, as we can't override it in own Skins
|
13 |
-
* without breaking support for PHP 5.3-5.5.
|
14 |
-
*
|
15 |
-
* @internal Please do not use this class outside of core ExactMetrics development. May be removed at any time.
|
16 |
-
*
|
17 |
-
* @since 7.10.6
|
18 |
-
*/
|
19 |
-
class ExactMetrics_Plugin_Upgrader extends Plugin_Upgrader {
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Run an upgrade/installation.
|
23 |
-
*
|
24 |
-
* Attempt to download the package (if it is not a local file), unpack it, and
|
25 |
-
* install it in the destination folder.
|
26 |
-
*
|
27 |
-
* @since 1.5.6.1
|
28 |
-
*
|
29 |
-
* @param array $options {
|
30 |
-
* Array or string of arguments for upgrading/installing a package.
|
31 |
-
*
|
32 |
-
* @type string $package The full path or URI of the package to install.
|
33 |
-
* Default empty.
|
34 |
-
* @type string $destination The full path to the destination folder.
|
35 |
-
* Default empty.
|
36 |
-
* @type bool $clear_destination Whether to delete any files already in the
|
37 |
-
* destination folder. Default false.
|
38 |
-
* @type bool $clear_working Whether to delete the files form the working
|
39 |
-
* directory after copying to the destination.
|
40 |
-
* Default false.
|
41 |
-
* @type bool $abort_if_destination_exists Whether to abort the installation if the destination
|
42 |
-
* folder already exists. When true, `$clear_destination`
|
43 |
-
* should be false. Default true.
|
44 |
-
* @type bool $is_multi Whether this run is one of multiple upgrade/installation
|
45 |
-
* actions being performed in bulk. When true, the skin
|
46 |
-
* WP_Upgrader::header() and WP_Upgrader::footer()
|
47 |
-
* aren't called. Default false.
|
48 |
-
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
49 |
-
* WP_Upgrader::run().
|
50 |
-
* }
|
51 |
-
* @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error,
|
52 |
-
* or false if unable to connect to the filesystem.
|
53 |
-
*/
|
54 |
-
public function run( $options ) {
|
55 |
-
|
56 |
-
$defaults = array(
|
57 |
-
'package' => '', // Please always pass this.
|
58 |
-
'destination' => '', // And this
|
59 |
-
'clear_destination' => false,
|
60 |
-
'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
|
61 |
-
'clear_working' => true,
|
62 |
-
'is_multi' => false,
|
63 |
-
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
|
64 |
-
);
|
65 |
-
|
66 |
-
$options = wp_parse_args( $options, $defaults );
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Filter the package options before running an update.
|
70 |
-
*
|
71 |
-
* See also {@see 'upgrader_process_complete'}.
|
72 |
-
*
|
73 |
-
* @since 4.3.0
|
74 |
-
*
|
75 |
-
* @param array $options {
|
76 |
-
* Options used by the upgrader.
|
77 |
-
*
|
78 |
-
* @type string $package Package for update.
|
79 |
-
* @type string $destination Update location.
|
80 |
-
* @type bool $clear_destination Clear the destination resource.
|
81 |
-
* @type bool $clear_working Clear the working resource.
|
82 |
-
* @type bool $abort_if_destination_exists Abort if the Destination directory exists.
|
83 |
-
* @type bool $is_multi Whether the upgrader is running multiple times.
|
84 |
-
* @type array $hook_extra {
|
85 |
-
* Extra hook arguments.
|
86 |
-
*
|
87 |
-
* @type string $action Type of action. Default 'update'.
|
88 |
-
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
|
89 |
-
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
90 |
-
* @type string $plugin Path to the plugin file relative to the plugins directory.
|
91 |
-
* @type string $theme The stylesheet or template name of the theme.
|
92 |
-
* @type string $language_update_type The language pack update type. Accepts 'plugin', 'theme',
|
93 |
-
* or 'core'.
|
94 |
-
* @type object $language_update The language pack update offer.
|
95 |
-
* }
|
96 |
-
* }
|
97 |
-
*/
|
98 |
-
$options = apply_filters( 'upgrader_package_options', $options );
|
99 |
-
|
100 |
-
if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
|
101 |
-
$this->skin->header();
|
102 |
-
}
|
103 |
-
|
104 |
-
// Connect to the Filesystem first.
|
105 |
-
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
|
106 |
-
// Mainly for non-connected filesystem.
|
107 |
-
if ( ! $res ) {
|
108 |
-
if ( ! $options['is_multi'] ) {
|
109 |
-
$this->skin->footer();
|
110 |
-
}
|
111 |
-
return false;
|
112 |
-
}
|
113 |
-
|
114 |
-
$this->skin->before();
|
115 |
-
|
116 |
-
if ( is_wp_error( $res ) ) {
|
117 |
-
$this->skin->error( $res );
|
118 |
-
$this->skin->after();
|
119 |
-
if ( ! $options['is_multi'] ) {
|
120 |
-
$this->skin->footer();
|
121 |
-
}
|
122 |
-
return $res;
|
123 |
-
}
|
124 |
-
|
125 |
-
/*
|
126 |
-
* Download the package (Note, This just returns the filename
|
127 |
-
* of the file if the package is a local file)
|
128 |
-
*/
|
129 |
-
$download = $this->download_package( $options['package'], true );
|
130 |
-
|
131 |
-
// Allow for signature soft-fail.
|
132 |
-
// WARNING: This may be removed in the future.
|
133 |
-
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
|
134 |
-
|
135 |
-
// Don't output the 'no signature could be found' failure message for now.
|
136 |
-
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
|
137 |
-
// Outout the failure error as a normal feedback, and not as an error:
|
138 |
-
//$this->skin->feedback( $download->get_error_message() );
|
139 |
-
|
140 |
-
// Report this failure back to WordPress.org for debugging purposes.
|
141 |
-
wp_version_check(
|
142 |
-
array(
|
143 |
-
'signature_failure_code' => $download->get_error_code(),
|
144 |
-
'signature_failure_data' => $download->get_error_data(),
|
145 |
-
)
|
146 |
-
);
|
147 |
-
}
|
148 |
-
|
149 |
-
// Pretend this error didn't happen.
|
150 |
-
$download = $download->get_error_data( 'softfail-filename' );
|
151 |
-
}
|
152 |
-
|
153 |
-
if ( is_wp_error( $download ) ) {
|
154 |
-
$this->skin->error( $download );
|
155 |
-
$this->skin->after();
|
156 |
-
if ( ! $options['is_multi'] ) {
|
157 |
-
$this->skin->footer();
|
158 |
-
}
|
159 |
-
return $download;
|
160 |
-
}
|
161 |
-
|
162 |
-
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
|
163 |
-
|
164 |
-
// Unzips the file into a temporary directory.
|
165 |
-
$working_dir = $this->unpack_package( $download, $delete_package );
|
166 |
-
if ( is_wp_error( $working_dir ) ) {
|
167 |
-
$this->skin->error( $working_dir );
|
168 |
-
$this->skin->after();
|
169 |
-
if ( ! $options['is_multi'] ) {
|
170 |
-
$this->skin->footer();
|
171 |
-
}
|
172 |
-
return $working_dir;
|
173 |
-
}
|
174 |
-
|
175 |
-
// With the given options, this installs it to the destination directory.
|
176 |
-
$result = $this->install_package(
|
177 |
-
array(
|
178 |
-
'source' => $working_dir,
|
179 |
-
'destination' => $options['destination'],
|
180 |
-
'clear_destination' => $options['clear_destination'],
|
181 |
-
'abort_if_destination_exists' => $options['abort_if_destination_exists'],
|
182 |
-
'clear_working' => $options['clear_working'],
|
183 |
-
'hook_extra' => $options['hook_extra'],
|
184 |
-
)
|
185 |
-
);
|
186 |
-
|
187 |
-
$this->skin->set_result( $result );
|
188 |
-
if ( is_wp_error( $result ) ) {
|
189 |
-
$this->skin->error( $result );
|
190 |
-
//$this->skin->feedback( 'process_failed' );
|
191 |
-
} else {
|
192 |
-
// Installation succeeded.
|
193 |
-
//$this->skin->feedback( 'process_success' );
|
194 |
-
}
|
195 |
-
|
196 |
-
$this->skin->after();
|
197 |
-
|
198 |
-
if ( ! $options['is_multi'] ) {
|
199 |
-
|
200 |
-
/**
|
201 |
-
* Fire when the upgrader process is complete.
|
202 |
-
*
|
203 |
-
* See also {@see 'upgrader_package_options'}.
|
204 |
-
*
|
205 |
-
* @since 3.6.0
|
206 |
-
* @since 3.7.0 Added to WP_Upgrader::run().
|
207 |
-
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
|
208 |
-
*
|
209 |
-
* @param WP_Upgrader $this WP_Upgrader instance. In other contexts, $this, might be a
|
210 |
-
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
|
211 |
-
* @param array $hook_extra {
|
212 |
-
* Array of bulk item update data.
|
213 |
-
*
|
214 |
-
* @type string $action Type of action. Default 'update'.
|
215 |
-
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
|
216 |
-
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
217 |
-
* @type array $plugins Array of the basename paths of the plugins' main files.
|
218 |
-
* @type array $themes The theme slugs.
|
219 |
-
* @type array $translations {
|
220 |
-
* Array of translations update data.
|
221 |
-
*
|
222 |
-
* @type string $language The locale the translation is for.
|
223 |
-
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
|
224 |
-
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
|
225 |
-
* 'default' for core translations.
|
226 |
-
* @type string $version The version of a theme, plugin, or core.
|
227 |
-
* }
|
228 |
-
* }
|
229 |
-
*/
|
230 |
-
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
|
231 |
-
|
232 |
-
$this->skin->footer();
|
233 |
-
}
|
234 |
-
|
235 |
-
return $result;
|
236 |
-
}
|
237 |
-
|
238 |
-
/**
|
239 |
-
* Toggle maintenance mode for the site.
|
240 |
-
*
|
241 |
-
* Create/delete the maintenance file to enable/disable maintenance mode.
|
242 |
-
*
|
243 |
-
* @since 2.8.0
|
244 |
-
*
|
245 |
-
* @global WP_Filesystem_Base $wp_filesystem Subclass
|
246 |
-
*
|
247 |
-
* @param bool $enable True to enable maintenance mode, false to disable.
|
248 |
-
*/
|
249 |
-
public function maintenance_mode( $enable = false ) {
|
250 |
-
global $wp_filesystem;
|
251 |
-
$file = $wp_filesystem->abspath() . '.maintenance';
|
252 |
-
if ( $enable ) {
|
253 |
-
//$this->skin->feedback( 'maintenance_start' );
|
254 |
-
// Create maintenance file to signal that we are upgrading
|
255 |
-
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
|
256 |
-
$wp_filesystem->delete( $file );
|
257 |
-
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
|
258 |
-
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
|
259 |
-
//$this->skin->feedback( 'maintenance_end' );
|
260 |
-
$wp_filesystem->delete( $file );
|
261 |
-
}
|
262 |
-
}
|
263 |
-
|
264 |
-
/**
|
265 |
-
* Download a package.
|
266 |
-
*
|
267 |
-
* @since 2.8.0
|
268 |
-
*
|
269 |
-
* @param string $package The URI of the package. If this is the full path to an
|
270 |
-
* existing local file, it will be returned untouched.
|
271 |
-
* @param bool $check_signatures Whether to validate file signatures. Default false.
|
272 |
-
* @param array $hook_extra Added in WP 5.5.
|
273 |
-
*
|
274 |
-
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
|
275 |
-
*/
|
276 |
-
public function download_package( $package, $check_signatures = false, $hook_extra = array() ) {
|
277 |
-
|
278 |
-
/**
|
279 |
-
* Filter whether to return the package.
|
280 |
-
*
|
281 |
-
* @since 3.7.0
|
282 |
-
*
|
283 |
-
* @param bool $reply Whether to bail without returning the package.
|
284 |
-
* Default false.
|
285 |
-
* @param string $package The package file name.
|
286 |
-
* @param WP_Upgrader $this The WP_Upgrader instance.
|
287 |
-
*/
|
288 |
-
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
|
289 |
-
if ( false !== $reply ) {
|
290 |
-
return $reply;
|
291 |
-
}
|
292 |
-
|
293 |
-
if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote?
|
294 |
-
return $package; //must be a local file..
|
295 |
-
}
|
296 |
-
|
297 |
-
if ( empty( $package ) ) {
|
298 |
-
return new WP_Error( 'no_package', $this->strings['no_package'] );
|
299 |
-
}
|
300 |
-
|
301 |
-
//$this->skin->feedback( 'downloading_package', $package );
|
302 |
-
|
303 |
-
$download_file = download_url( $package, 300, $check_signatures );
|
304 |
-
|
305 |
-
if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) {
|
306 |
-
return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() );
|
307 |
-
}
|
308 |
-
|
309 |
-
return $download_file;
|
310 |
-
}
|
311 |
-
|
312 |
-
/**
|
313 |
-
* Unpack a compressed package file.
|
314 |
-
*
|
315 |
-
* @since 2.8.0
|
316 |
-
*
|
317 |
-
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
318 |
-
*
|
319 |
-
* @param string $package Full path to the package file.
|
320 |
-
* @param bool $delete_package Optional. Whether to delete the package file after attempting
|
321 |
-
* to unpack it. Default true.
|
322 |
-
* @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure.
|
323 |
-
*/
|
324 |
-
public function unpack_package( $package, $delete_package = true ) {
|
325 |
-
global $wp_filesystem;
|
326 |
-
|
327 |
-
//$this->skin->feedback( 'unpack_package' );
|
328 |
-
|
329 |
-
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
|
330 |
-
|
331 |
-
//Clean up contents of upgrade directory beforehand.
|
332 |
-
$upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );
|
333 |
-
if ( ! empty( $upgrade_files ) ) {
|
334 |
-
foreach ( $upgrade_files as $file ) {
|
335 |
-
$wp_filesystem->delete( $upgrade_folder . $file['name'], true );
|
336 |
-
}
|
337 |
-
}
|
338 |
-
|
339 |
-
// We need a working directory - Strip off any .tmp or .zip suffixes
|
340 |
-
$working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
|
341 |
-
|
342 |
-
// Clean up working directory
|
343 |
-
if ( $wp_filesystem->is_dir( $working_dir ) ) {
|
344 |
-
$wp_filesystem->delete( $working_dir, true );
|
345 |
-
}
|
346 |
-
|
347 |
-
// Unzip package to working directory
|
348 |
-
$result = unzip_file( $package, $working_dir );
|
349 |
-
|
350 |
-
// Once extracted, delete the package if required.
|
351 |
-
if ( $delete_package ) {
|
352 |
-
unlink( $package );
|
353 |
-
}
|
354 |
-
|
355 |
-
if ( is_wp_error( $result ) ) {
|
356 |
-
$wp_filesystem->delete( $working_dir, true );
|
357 |
-
if ( 'incompatible_archive' == $result->get_error_code() ) {
|
358 |
-
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
|
359 |
-
}
|
360 |
-
return $result;
|
361 |
-
}
|
362 |
-
|
363 |
-
return $working_dir;
|
364 |
-
}
|
365 |
-
|
366 |
-
/**
|
367 |
-
* Install a package.
|
368 |
-
*
|
369 |
-
* Copies the contents of a package form a source directory, and installs them in
|
370 |
-
* a destination directory. Optionally removes the source. It can also optionally
|
371 |
-
* clear out the destination folder if it already exists.
|
372 |
-
*
|
373 |
-
* @since 2.8.0
|
374 |
-
*
|
375 |
-
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
376 |
-
* @global array $wp_theme_directories
|
377 |
-
*
|
378 |
-
* @param array|string $args {
|
379 |
-
* Optional. Array or string of arguments for installing a package. Default empty array.
|
380 |
-
*
|
381 |
-
* @type string $source Required path to the package source. Default empty.
|
382 |
-
* @type string $destination Required path to a folder to install the package in.
|
383 |
-
* Default empty.
|
384 |
-
* @type bool $clear_destination Whether to delete any files already in the destination
|
385 |
-
* folder. Default false.
|
386 |
-
* @type bool $clear_working Whether to delete the files form the working directory
|
387 |
-
* after copying to the destination. Default false.
|
388 |
-
* @type bool $abort_if_destination_exists Whether to abort the installation if
|
389 |
-
* the destination folder already exists. Default true.
|
390 |
-
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
391 |
-
* WP_Upgrader::install_package(). Default empty array.
|
392 |
-
* }
|
393 |
-
*
|
394 |
-
* @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
|
395 |
-
*/
|
396 |
-
public function install_package( $args = array() ) {
|
397 |
-
global $wp_filesystem, $wp_theme_directories;
|
398 |
-
|
399 |
-
$defaults = array(
|
400 |
-
'source' => '', // Please always pass this
|
401 |
-
'destination' => '', // and this
|
402 |
-
'clear_destination' => false,
|
403 |
-
'clear_working' => false,
|
404 |
-
'abort_if_destination_exists' => true,
|
405 |
-
'hook_extra' => array(),
|
406 |
-
);
|
407 |
-
|
408 |
-
$args = wp_parse_args( $args, $defaults );
|
409 |
-
|
410 |
-
// These were previously extract()'d.
|
411 |
-
$source = $args['source'];
|
412 |
-
$destination = $args['destination'];
|
413 |
-
$clear_destination = $args['clear_destination'];
|
414 |
-
|
415 |
-
set_time_limit( 300 );
|
416 |
-
|
417 |
-
if ( empty( $source ) || empty( $destination ) ) {
|
418 |
-
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
|
419 |
-
}
|
420 |
-
//$this->skin->feedback( 'installing_package' );
|
421 |
-
|
422 |
-
/**
|
423 |
-
* Filter the install response before the installation has started.
|
424 |
-
*
|
425 |
-
* Returning a truthy value, or one that could be evaluated as a WP_Error
|
426 |
-
* will effectively short-circuit the installation, returning that value
|
427 |
-
* instead.
|
428 |
-
*
|
429 |
-
* @since 2.8.0
|
430 |
-
*
|
431 |
-
* @param bool|WP_Error $response Response.
|
432 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
433 |
-
*/
|
434 |
-
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
|
435 |
-
|
436 |
-
if ( is_wp_error( $res ) ) {
|
437 |
-
return $res;
|
438 |
-
}
|
439 |
-
|
440 |
-
//Retain the Original source and destinations
|
441 |
-
$remote_source = $args['source'];
|
442 |
-
$local_destination = $destination;
|
443 |
-
|
444 |
-
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
|
445 |
-
$remote_destination = $wp_filesystem->find_folder( $local_destination );
|
446 |
-
|
447 |
-
//Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
|
448 |
-
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
|
449 |
-
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
|
450 |
-
} elseif ( count( $source_files ) == 0 ) {
|
451 |
-
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
|
452 |
-
} else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename.
|
453 |
-
$source = trailingslashit( $args['source'] );
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* Filter the source file location for the upgrade package.
|
458 |
-
*
|
459 |
-
* @since 2.8.0
|
460 |
-
* @since 4.4.0 The $hook_extra parameter became available.
|
461 |
-
*
|
462 |
-
* @param string $source File source location.
|
463 |
-
* @param string $remote_source Remote file source location.
|
464 |
-
* @param WP_Upgrader $this WP_Upgrader instance.
|
465 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
466 |
-
*/
|
467 |
-
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );
|
468 |
-
|
469 |
-
if ( is_wp_error( $source ) ) {
|
470 |
-
return $source;
|
471 |
-
}
|
472 |
-
|
473 |
-
// Has the source location changed? If so, we need a new source_files list.
|
474 |
-
if ( $source !== $remote_source ) {
|
475 |
-
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
|
476 |
-
}
|
477 |
-
|
478 |
-
/*
|
479 |
-
* Protection against deleting files in any important base directories.
|
480 |
-
* Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
|
481 |
-
* destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
|
482 |
-
* to copy the directory into the directory, whilst they pass the source
|
483 |
-
* as the actual files to copy.
|
484 |
-
*/
|
485 |
-
$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
|
486 |
-
|
487 |
-
if ( is_array( $wp_theme_directories ) ) {
|
488 |
-
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
|
489 |
-
}
|
490 |
-
|
491 |
-
if ( in_array( $destination, $protected_directories ) ) {
|
492 |
-
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
|
493 |
-
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
|
494 |
-
}
|
495 |
-
|
496 |
-
if ( $clear_destination ) {
|
497 |
-
// We're going to clear the destination if there's something there.
|
498 |
-
//$this->skin->feedback( 'remove_old' );
|
499 |
-
|
500 |
-
$removed = $this->clear_destination( $remote_destination );
|
501 |
-
|
502 |
-
/**
|
503 |
-
* Filter whether the upgrader cleared the destination.
|
504 |
-
*
|
505 |
-
* @since 2.8.0
|
506 |
-
*
|
507 |
-
* @param mixed $removed Whether the destination was cleared. true on success, WP_Error on failure
|
508 |
-
* @param string $local_destination The local package destination.
|
509 |
-
* @param string $remote_destination The remote package destination.
|
510 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
511 |
-
*/
|
512 |
-
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );
|
513 |
-
|
514 |
-
if ( is_wp_error( $removed ) ) {
|
515 |
-
return $removed;
|
516 |
-
}
|
517 |
-
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
|
518 |
-
//If we're not clearing the destination folder and something exists there already, Bail.
|
519 |
-
//But first check to see if there are actually any files in the folder.
|
520 |
-
$_files = $wp_filesystem->dirlist( $remote_destination );
|
521 |
-
if ( ! empty( $_files ) ) {
|
522 |
-
$wp_filesystem->delete( $remote_source, true ); //Clear out the source files.
|
523 |
-
return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination );
|
524 |
-
}
|
525 |
-
}
|
526 |
-
|
527 |
-
//Create destination if needed
|
528 |
-
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
|
529 |
-
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
|
530 |
-
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
|
531 |
-
}
|
532 |
-
}
|
533 |
-
// Copy new version of item into place.
|
534 |
-
$result = copy_dir( $source, $remote_destination );
|
535 |
-
if ( is_wp_error( $result ) ) {
|
536 |
-
if ( $args['clear_working'] ) {
|
537 |
-
$wp_filesystem->delete( $remote_source, true );
|
538 |
-
}
|
539 |
-
return $result;
|
540 |
-
}
|
541 |
-
|
542 |
-
//Clear the Working folder?
|
543 |
-
if ( $args['clear_working'] ) {
|
544 |
-
$wp_filesystem->delete( $remote_source, true );
|
545 |
-
}
|
546 |
-
|
547 |
-
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
|
548 |
-
if ( '.' == $destination_name ) {
|
549 |
-
$destination_name = '';
|
550 |
-
}
|
551 |
-
|
552 |
-
$this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' );
|
553 |
-
|
554 |
-
/**
|
555 |
-
* Filter the installation response after the installation has finished.
|
556 |
-
*
|
557 |
-
* @since 2.8.0
|
558 |
-
*
|
559 |
-
* @param bool $response Installation response.
|
560 |
-
* @param array $hook_extra Extra arguments passed to hooked filters.
|
561 |
-
* @param array $result Installation result data.
|
562 |
-
*/
|
563 |
-
$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );
|
564 |
-
|
565 |
-
if ( is_wp_error( $res ) ) {
|
566 |
-
$this->result = $res;
|
567 |
-
return $res;
|
568 |
-
}
|
569 |
-
|
570 |
-
//Bombard the calling function will all the info which we've just used.
|
571 |
-
return $this->result;
|
572 |
-
}
|
573 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/** WP_Upgrader class */
|
4 |
+
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
5 |
+
|
6 |
+
/** Plugin_Upgrader class */
|
7 |
+
require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php';
|
8 |
+
|
9 |
+
|
10 |
+
/**
|
11 |
+
* In WP 5.3 a PHP 5.6 splat operator (...$args) was added to WP_Upgrader_Skin::feedback().
|
12 |
+
* We need to remove all calls to *Skin::feedback() method, as we can't override it in own Skins
|
13 |
+
* without breaking support for PHP 5.3-5.5.
|
14 |
+
*
|
15 |
+
* @internal Please do not use this class outside of core ExactMetrics development. May be removed at any time.
|
16 |
+
*
|
17 |
+
* @since 7.10.6
|
18 |
+
*/
|
19 |
+
class ExactMetrics_Plugin_Upgrader extends Plugin_Upgrader {
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Run an upgrade/installation.
|
23 |
+
*
|
24 |
+
* Attempt to download the package (if it is not a local file), unpack it, and
|
25 |
+
* install it in the destination folder.
|
26 |
+
*
|
27 |
+
* @since 1.5.6.1
|
28 |
+
*
|
29 |
+
* @param array $options {
|
30 |
+
* Array or string of arguments for upgrading/installing a package.
|
31 |
+
*
|
32 |
+
* @type string $package The full path or URI of the package to install.
|
33 |
+
* Default empty.
|
34 |
+
* @type string $destination The full path to the destination folder.
|
35 |
+
* Default empty.
|
36 |
+
* @type bool $clear_destination Whether to delete any files already in the
|
37 |
+
* destination folder. Default false.
|
38 |
+
* @type bool $clear_working Whether to delete the files form the working
|
39 |
+
* directory after copying to the destination.
|
40 |
+
* Default false.
|
41 |
+
* @type bool $abort_if_destination_exists Whether to abort the installation if the destination
|
42 |
+
* folder already exists. When true, `$clear_destination`
|
43 |
+
* should be false. Default true.
|
44 |
+
* @type bool $is_multi Whether this run is one of multiple upgrade/installation
|
45 |
+
* actions being performed in bulk. When true, the skin
|
46 |
+
* WP_Upgrader::header() and WP_Upgrader::footer()
|
47 |
+
* aren't called. Default false.
|
48 |
+
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
49 |
+
* WP_Upgrader::run().
|
50 |
+
* }
|
51 |
+
* @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error,
|
52 |
+
* or false if unable to connect to the filesystem.
|
53 |
+
*/
|
54 |
+
public function run( $options ) {
|
55 |
+
|
56 |
+
$defaults = array(
|
57 |
+
'package' => '', // Please always pass this.
|
58 |
+
'destination' => '', // And this
|
59 |
+
'clear_destination' => false,
|
60 |
+
'abort_if_destination_exists' => true, // Abort if the Destination directory exists, Pass clear_destination as false please
|
61 |
+
'clear_working' => true,
|
62 |
+
'is_multi' => false,
|
63 |
+
'hook_extra' => array(), // Pass any extra $hook_extra args here, this will be passed to any hooked filters.
|
64 |
+
);
|
65 |
+
|
66 |
+
$options = wp_parse_args( $options, $defaults );
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Filter the package options before running an update.
|
70 |
+
*
|
71 |
+
* See also {@see 'upgrader_process_complete'}.
|
72 |
+
*
|
73 |
+
* @since 4.3.0
|
74 |
+
*
|
75 |
+
* @param array $options {
|
76 |
+
* Options used by the upgrader.
|
77 |
+
*
|
78 |
+
* @type string $package Package for update.
|
79 |
+
* @type string $destination Update location.
|
80 |
+
* @type bool $clear_destination Clear the destination resource.
|
81 |
+
* @type bool $clear_working Clear the working resource.
|
82 |
+
* @type bool $abort_if_destination_exists Abort if the Destination directory exists.
|
83 |
+
* @type bool $is_multi Whether the upgrader is running multiple times.
|
84 |
+
* @type array $hook_extra {
|
85 |
+
* Extra hook arguments.
|
86 |
+
*
|
87 |
+
* @type string $action Type of action. Default 'update'.
|
88 |
+
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
|
89 |
+
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
90 |
+
* @type string $plugin Path to the plugin file relative to the plugins directory.
|
91 |
+
* @type string $theme The stylesheet or template name of the theme.
|
92 |
+
* @type string $language_update_type The language pack update type. Accepts 'plugin', 'theme',
|
93 |
+
* or 'core'.
|
94 |
+
* @type object $language_update The language pack update offer.
|
95 |
+
* }
|
96 |
+
* }
|
97 |
+
*/
|
98 |
+
$options = apply_filters( 'upgrader_package_options', $options );
|
99 |
+
|
100 |
+
if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times
|
101 |
+
$this->skin->header();
|
102 |
+
}
|
103 |
+
|
104 |
+
// Connect to the Filesystem first.
|
105 |
+
$res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) );
|
106 |
+
// Mainly for non-connected filesystem.
|
107 |
+
if ( ! $res ) {
|
108 |
+
if ( ! $options['is_multi'] ) {
|
109 |
+
$this->skin->footer();
|
110 |
+
}
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->skin->before();
|
115 |
+
|
116 |
+
if ( is_wp_error( $res ) ) {
|
117 |
+
$this->skin->error( $res );
|
118 |
+
$this->skin->after();
|
119 |
+
if ( ! $options['is_multi'] ) {
|
120 |
+
$this->skin->footer();
|
121 |
+
}
|
122 |
+
return $res;
|
123 |
+
}
|
124 |
+
|
125 |
+
/*
|
126 |
+
* Download the package (Note, This just returns the filename
|
127 |
+
* of the file if the package is a local file)
|
128 |
+
*/
|
129 |
+
$download = $this->download_package( $options['package'], true );
|
130 |
+
|
131 |
+
// Allow for signature soft-fail.
|
132 |
+
// WARNING: This may be removed in the future.
|
133 |
+
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
|
134 |
+
|
135 |
+
// Don't output the 'no signature could be found' failure message for now.
|
136 |
+
if ( 'signature_verification_no_signature' != $download->get_error_code() || WP_DEBUG ) {
|
137 |
+
// Outout the failure error as a normal feedback, and not as an error:
|
138 |
+
//$this->skin->feedback( $download->get_error_message() );
|
139 |
+
|
140 |
+
// Report this failure back to WordPress.org for debugging purposes.
|
141 |
+
wp_version_check(
|
142 |
+
array(
|
143 |
+
'signature_failure_code' => $download->get_error_code(),
|
144 |
+
'signature_failure_data' => $download->get_error_data(),
|
145 |
+
)
|
146 |
+
);
|
147 |
+
}
|
148 |
+
|
149 |
+
// Pretend this error didn't happen.
|
150 |
+
$download = $download->get_error_data( 'softfail-filename' );
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( is_wp_error( $download ) ) {
|
154 |
+
$this->skin->error( $download );
|
155 |
+
$this->skin->after();
|
156 |
+
if ( ! $options['is_multi'] ) {
|
157 |
+
$this->skin->footer();
|
158 |
+
}
|
159 |
+
return $download;
|
160 |
+
}
|
161 |
+
|
162 |
+
$delete_package = ( $download != $options['package'] ); // Do not delete a "local" file
|
163 |
+
|
164 |
+
// Unzips the file into a temporary directory.
|
165 |
+
$working_dir = $this->unpack_package( $download, $delete_package );
|
166 |
+
if ( is_wp_error( $working_dir ) ) {
|
167 |
+
$this->skin->error( $working_dir );
|
168 |
+
$this->skin->after();
|
169 |
+
if ( ! $options['is_multi'] ) {
|
170 |
+
$this->skin->footer();
|
171 |
+
}
|
172 |
+
return $working_dir;
|
173 |
+
}
|
174 |
+
|
175 |
+
// With the given options, this installs it to the destination directory.
|
176 |
+
$result = $this->install_package(
|
177 |
+
array(
|
178 |
+
'source' => $working_dir,
|
179 |
+
'destination' => $options['destination'],
|
180 |
+
'clear_destination' => $options['clear_destination'],
|
181 |
+
'abort_if_destination_exists' => $options['abort_if_destination_exists'],
|
182 |
+
'clear_working' => $options['clear_working'],
|
183 |
+
'hook_extra' => $options['hook_extra'],
|
184 |
+
)
|
185 |
+
);
|
186 |
+
|
187 |
+
$this->skin->set_result( $result );
|
188 |
+
if ( is_wp_error( $result ) ) {
|
189 |
+
$this->skin->error( $result );
|
190 |
+
//$this->skin->feedback( 'process_failed' );
|
191 |
+
} else {
|
192 |
+
// Installation succeeded.
|
193 |
+
//$this->skin->feedback( 'process_success' );
|
194 |
+
}
|
195 |
+
|
196 |
+
$this->skin->after();
|
197 |
+
|
198 |
+
if ( ! $options['is_multi'] ) {
|
199 |
+
|
200 |
+
/**
|
201 |
+
* Fire when the upgrader process is complete.
|
202 |
+
*
|
203 |
+
* See also {@see 'upgrader_package_options'}.
|
204 |
+
*
|
205 |
+
* @since 3.6.0
|
206 |
+
* @since 3.7.0 Added to WP_Upgrader::run().
|
207 |
+
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
|
208 |
+
*
|
209 |
+
* @param WP_Upgrader $this WP_Upgrader instance. In other contexts, $this, might be a
|
210 |
+
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
|
211 |
+
* @param array $hook_extra {
|
212 |
+
* Array of bulk item update data.
|
213 |
+
*
|
214 |
+
* @type string $action Type of action. Default 'update'.
|
215 |
+
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
|
216 |
+
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
217 |
+
* @type array $plugins Array of the basename paths of the plugins' main files.
|
218 |
+
* @type array $themes The theme slugs.
|
219 |
+
* @type array $translations {
|
220 |
+
* Array of translations update data.
|
221 |
+
*
|
222 |
+
* @type string $language The locale the translation is for.
|
223 |
+
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
|
224 |
+
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
|
225 |
+
* 'default' for core translations.
|
226 |
+
* @type string $version The version of a theme, plugin, or core.
|
227 |
+
* }
|
228 |
+
* }
|
229 |
+
*/
|
230 |
+
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
|
231 |
+
|
232 |
+
$this->skin->footer();
|
233 |
+
}
|
234 |
+
|
235 |
+
return $result;
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* Toggle maintenance mode for the site.
|
240 |
+
*
|
241 |
+
* Create/delete the maintenance file to enable/disable maintenance mode.
|
242 |
+
*
|
243 |
+
* @since 2.8.0
|
244 |
+
*
|
245 |
+
* @global WP_Filesystem_Base $wp_filesystem Subclass
|
246 |
+
*
|
247 |
+
* @param bool $enable True to enable maintenance mode, false to disable.
|
248 |
+
*/
|
249 |
+
public function maintenance_mode( $enable = false ) {
|
250 |
+
global $wp_filesystem;
|
251 |
+
$file = $wp_filesystem->abspath() . '.maintenance';
|
252 |
+
if ( $enable ) {
|
253 |
+
//$this->skin->feedback( 'maintenance_start' );
|
254 |
+
// Create maintenance file to signal that we are upgrading
|
255 |
+
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
|
256 |
+
$wp_filesystem->delete( $file );
|
257 |
+
$wp_filesystem->put_contents( $file, $maintenance_string, FS_CHMOD_FILE );
|
258 |
+
} elseif ( ! $enable && $wp_filesystem->exists( $file ) ) {
|
259 |
+
//$this->skin->feedback( 'maintenance_end' );
|
260 |
+
$wp_filesystem->delete( $file );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Download a package.
|
266 |
+
*
|
267 |
+
* @since 2.8.0
|
268 |
+
*
|
269 |
+
* @param string $package The URI of the package. If this is the full path to an
|
270 |
+
* existing local file, it will be returned untouched.
|
271 |
+
* @param bool $check_signatures Whether to validate file signatures. Default false.
|
272 |
+
* @param array $hook_extra Added in WP 5.5.
|
273 |
+
*
|
274 |
+
* @return string|WP_Error The full path to the downloaded package file, or a WP_Error object.
|
275 |
+
*/
|
276 |
+
public function download_package( $package, $check_signatures = false, $hook_extra = array() ) {
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Filter whether to return the package.
|
280 |
+
*
|
281 |
+
* @since 3.7.0
|
282 |
+
*
|
283 |
+
* @param bool $reply Whether to bail without returning the package.
|
284 |
+
* Default false.
|
285 |
+
* @param string $package The package file name.
|
286 |
+
* @param WP_Upgrader $this The WP_Upgrader instance.
|
287 |
+
*/
|
288 |
+
$reply = apply_filters( 'upgrader_pre_download', false, $package, $this );
|
289 |
+
if ( false !== $reply ) {
|
290 |
+
return $reply;
|
291 |
+
}
|
292 |
+
|
293 |
+
if ( ! preg_match( '!^(http|https|ftp)://!i', $package ) && file_exists( $package ) ) { //Local file or remote?
|
294 |
+
return $package; //must be a local file..
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( empty( $package ) ) {
|
298 |
+
return new WP_Error( 'no_package', $this->strings['no_package'] );
|
299 |
+
}
|
300 |
+
|
301 |
+
//$this->skin->feedback( 'downloading_package', $package );
|
302 |
+
|
303 |
+
$download_file = download_url( $package, 300, $check_signatures );
|
304 |
+
|
305 |
+
if ( is_wp_error( $download_file ) && ! $download_file->get_error_data( 'softfail-filename' ) ) {
|
306 |
+
return new WP_Error( 'download_failed', $this->strings['download_failed'], $download_file->get_error_message() );
|
307 |
+
}
|
308 |
+
|
309 |
+
return $download_file;
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* Unpack a compressed package file.
|
314 |
+
*
|
315 |
+
* @since 2.8.0
|
316 |
+
*
|
317 |
+
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
318 |
+
*
|
319 |
+
* @param string $package Full path to the package file.
|
320 |
+
* @param bool $delete_package Optional. Whether to delete the package file after attempting
|
321 |
+
* to unpack it. Default true.
|
322 |
+
* @return string|WP_Error The path to the unpacked contents, or a WP_Error on failure.
|
323 |
+
*/
|
324 |
+
public function unpack_package( $package, $delete_package = true ) {
|
325 |
+
global $wp_filesystem;
|
326 |
+
|
327 |
+
//$this->skin->feedback( 'unpack_package' );
|
328 |
+
|
329 |
+
$upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/';
|
330 |
+
|
331 |
+
//Clean up contents of upgrade directory beforehand.
|
332 |
+
$upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );
|
333 |
+
if ( ! empty( $upgrade_files ) ) {
|
334 |
+
foreach ( $upgrade_files as $file ) {
|
335 |
+
$wp_filesystem->delete( $upgrade_folder . $file['name'], true );
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
// We need a working directory - Strip off any .tmp or .zip suffixes
|
340 |
+
$working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' );
|
341 |
+
|
342 |
+
// Clean up working directory
|
343 |
+
if ( $wp_filesystem->is_dir( $working_dir ) ) {
|
344 |
+
$wp_filesystem->delete( $working_dir, true );
|
345 |
+
}
|
346 |
+
|
347 |
+
// Unzip package to working directory
|
348 |
+
$result = unzip_file( $package, $working_dir );
|
349 |
+
|
350 |
+
// Once extracted, delete the package if required.
|
351 |
+
if ( $delete_package ) {
|
352 |
+
unlink( $package );
|
353 |
+
}
|
354 |
+
|
355 |
+
if ( is_wp_error( $result ) ) {
|
356 |
+
$wp_filesystem->delete( $working_dir, true );
|
357 |
+
if ( 'incompatible_archive' == $result->get_error_code() ) {
|
358 |
+
return new WP_Error( 'incompatible_archive', $this->strings['incompatible_archive'], $result->get_error_data() );
|
359 |
+
}
|
360 |
+
return $result;
|
361 |
+
}
|
362 |
+
|
363 |
+
return $working_dir;
|
364 |
+
}
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Install a package.
|
368 |
+
*
|
369 |
+
* Copies the contents of a package form a source directory, and installs them in
|
370 |
+
* a destination directory. Optionally removes the source. It can also optionally
|
371 |
+
* clear out the destination folder if it already exists.
|
372 |
+
*
|
373 |
+
* @since 2.8.0
|
374 |
+
*
|
375 |
+
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
|
376 |
+
* @global array $wp_theme_directories
|
377 |
+
*
|
378 |
+
* @param array|string $args {
|
379 |
+
* Optional. Array or string of arguments for installing a package. Default empty array.
|
380 |
+
*
|
381 |
+
* @type string $source Required path to the package source. Default empty.
|
382 |
+
* @type string $destination Required path to a folder to install the package in.
|
383 |
+
* Default empty.
|
384 |
+
* @type bool $clear_destination Whether to delete any files already in the destination
|
385 |
+
* folder. Default false.
|
386 |
+
* @type bool $clear_working Whether to delete the files form the working directory
|
387 |
+
* after copying to the destination. Default false.
|
388 |
+
* @type bool $abort_if_destination_exists Whether to abort the installation if
|
389 |
+
* the destination folder already exists. Default true.
|
390 |
+
* @type array $hook_extra Extra arguments to pass to the filter hooks called by
|
391 |
+
* WP_Upgrader::install_package(). Default empty array.
|
392 |
+
* }
|
393 |
+
*
|
394 |
+
* @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure.
|
395 |
+
*/
|
396 |
+
public function install_package( $args = array() ) {
|
397 |
+
global $wp_filesystem, $wp_theme_directories;
|
398 |
+
|
399 |
+
$defaults = array(
|
400 |
+
'source' => '', // Please always pass this
|
401 |
+
'destination' => '', // and this
|
402 |
+
'clear_destination' => false,
|
403 |
+
'clear_working' => false,
|
404 |
+
'abort_if_destination_exists' => true,
|
405 |
+
'hook_extra' => array(),
|
406 |
+
);
|
407 |
+
|
408 |
+
$args = wp_parse_args( $args, $defaults );
|
409 |
+
|
410 |
+
// These were previously extract()'d.
|
411 |
+
$source = $args['source'];
|
412 |
+
$destination = $args['destination'];
|
413 |
+
$clear_destination = $args['clear_destination'];
|
414 |
+
|
415 |
+
set_time_limit( 300 );
|
416 |
+
|
417 |
+
if ( empty( $source ) || empty( $destination ) ) {
|
418 |
+
return new WP_Error( 'bad_request', $this->strings['bad_request'] );
|
419 |
+
}
|
420 |
+
//$this->skin->feedback( 'installing_package' );
|
421 |
+
|
422 |
+
/**
|
423 |
+
* Filter the install response before the installation has started.
|
424 |
+
*
|
425 |
+
* Returning a truthy value, or one that could be evaluated as a WP_Error
|
426 |
+
* will effectively short-circuit the installation, returning that value
|
427 |
+
* instead.
|
428 |
+
*
|
429 |
+
* @since 2.8.0
|
430 |
+
*
|
431 |
+
* @param bool|WP_Error $response Response.
|
432 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
433 |
+
*/
|
434 |
+
$res = apply_filters( 'upgrader_pre_install', true, $args['hook_extra'] );
|
435 |
+
|
436 |
+
if ( is_wp_error( $res ) ) {
|
437 |
+
return $res;
|
438 |
+
}
|
439 |
+
|
440 |
+
//Retain the Original source and destinations
|
441 |
+
$remote_source = $args['source'];
|
442 |
+
$local_destination = $destination;
|
443 |
+
|
444 |
+
$source_files = array_keys( $wp_filesystem->dirlist( $remote_source ) );
|
445 |
+
$remote_destination = $wp_filesystem->find_folder( $local_destination );
|
446 |
+
|
447 |
+
//Locate which directory to copy to the new folder, This is based on the actual folder holding the files.
|
448 |
+
if ( 1 == count( $source_files ) && $wp_filesystem->is_dir( trailingslashit( $args['source'] ) . $source_files[0] . '/' ) ) { //Only one folder? Then we want its contents.
|
449 |
+
$source = trailingslashit( $args['source'] ) . trailingslashit( $source_files[0] );
|
450 |
+
} elseif ( count( $source_files ) == 0 ) {
|
451 |
+
return new WP_Error( 'incompatible_archive_empty', $this->strings['incompatible_archive'], $this->strings['no_files'] ); // There are no files?
|
452 |
+
} else { // It's only a single file, the upgrader will use the folder name of this file as the destination folder. Folder name is based on zip filename.
|
453 |
+
$source = trailingslashit( $args['source'] );
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Filter the source file location for the upgrade package.
|
458 |
+
*
|
459 |
+
* @since 2.8.0
|
460 |
+
* @since 4.4.0 The $hook_extra parameter became available.
|
461 |
+
*
|
462 |
+
* @param string $source File source location.
|
463 |
+
* @param string $remote_source Remote file source location.
|
464 |
+
* @param WP_Upgrader $this WP_Upgrader instance.
|
465 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
466 |
+
*/
|
467 |
+
$source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this, $args['hook_extra'] );
|
468 |
+
|
469 |
+
if ( is_wp_error( $source ) ) {
|
470 |
+
return $source;
|
471 |
+
}
|
472 |
+
|
473 |
+
// Has the source location changed? If so, we need a new source_files list.
|
474 |
+
if ( $source !== $remote_source ) {
|
475 |
+
$source_files = array_keys( $wp_filesystem->dirlist( $source ) );
|
476 |
+
}
|
477 |
+
|
478 |
+
/*
|
479 |
+
* Protection against deleting files in any important base directories.
|
480 |
+
* Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the
|
481 |
+
* destination directory (WP_PLUGIN_DIR / wp-content/themes) intending
|
482 |
+
* to copy the directory into the directory, whilst they pass the source
|
483 |
+
* as the actual files to copy.
|
484 |
+
*/
|
485 |
+
$protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' );
|
486 |
+
|
487 |
+
if ( is_array( $wp_theme_directories ) ) {
|
488 |
+
$protected_directories = array_merge( $protected_directories, $wp_theme_directories );
|
489 |
+
}
|
490 |
+
|
491 |
+
if ( in_array( $destination, $protected_directories ) ) {
|
492 |
+
$remote_destination = trailingslashit( $remote_destination ) . trailingslashit( basename( $source ) );
|
493 |
+
$destination = trailingslashit( $destination ) . trailingslashit( basename( $source ) );
|
494 |
+
}
|
495 |
+
|
496 |
+
if ( $clear_destination ) {
|
497 |
+
// We're going to clear the destination if there's something there.
|
498 |
+
//$this->skin->feedback( 'remove_old' );
|
499 |
+
|
500 |
+
$removed = $this->clear_destination( $remote_destination );
|
501 |
+
|
502 |
+
/**
|
503 |
+
* Filter whether the upgrader cleared the destination.
|
504 |
+
*
|
505 |
+
* @since 2.8.0
|
506 |
+
*
|
507 |
+
* @param mixed $removed Whether the destination was cleared. true on success, WP_Error on failure
|
508 |
+
* @param string $local_destination The local package destination.
|
509 |
+
* @param string $remote_destination The remote package destination.
|
510 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
511 |
+
*/
|
512 |
+
$removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $args['hook_extra'] );
|
513 |
+
|
514 |
+
if ( is_wp_error( $removed ) ) {
|
515 |
+
return $removed;
|
516 |
+
}
|
517 |
+
} elseif ( $args['abort_if_destination_exists'] && $wp_filesystem->exists( $remote_destination ) ) {
|
518 |
+
//If we're not clearing the destination folder and something exists there already, Bail.
|
519 |
+
//But first check to see if there are actually any files in the folder.
|
520 |
+
$_files = $wp_filesystem->dirlist( $remote_destination );
|
521 |
+
if ( ! empty( $_files ) ) {
|
522 |
+
$wp_filesystem->delete( $remote_source, true ); //Clear out the source files.
|
523 |
+
return new WP_Error( 'folder_exists', $this->strings['folder_exists'], $remote_destination );
|
524 |
+
}
|
525 |
+
}
|
526 |
+
|
527 |
+
//Create destination if needed
|
528 |
+
if ( ! $wp_filesystem->exists( $remote_destination ) ) {
|
529 |
+
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) ) {
|
530 |
+
return new WP_Error( 'mkdir_failed_destination', $this->strings['mkdir_failed'], $remote_destination );
|
531 |
+
}
|
532 |
+
}
|
533 |
+
// Copy new version of item into place.
|
534 |
+
$result = copy_dir( $source, $remote_destination );
|
535 |
+
if ( is_wp_error( $result ) ) {
|
536 |
+
if ( $args['clear_working'] ) {
|
537 |
+
$wp_filesystem->delete( $remote_source, true );
|
538 |
+
}
|
539 |
+
return $result;
|
540 |
+
}
|
541 |
+
|
542 |
+
//Clear the Working folder?
|
543 |
+
if ( $args['clear_working'] ) {
|
544 |
+
$wp_filesystem->delete( $remote_source, true );
|
545 |
+
}
|
546 |
+
|
547 |
+
$destination_name = basename( str_replace( $local_destination, '', $destination ) );
|
548 |
+
if ( '.' == $destination_name ) {
|
549 |
+
$destination_name = '';
|
550 |
+
}
|
551 |
+
|
552 |
+
$this->result = compact( 'source', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination' );
|
553 |
+
|
554 |
+
/**
|
555 |
+
* Filter the installation response after the installation has finished.
|
556 |
+
*
|
557 |
+
* @since 2.8.0
|
558 |
+
*
|
559 |
+
* @param bool $response Installation response.
|
560 |
+
* @param array $hook_extra Extra arguments passed to hooked filters.
|
561 |
+
* @param array $result Installation result data.
|
562 |
+
*/
|
563 |
+
$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );
|
564 |
+
|
565 |
+
if ( is_wp_error( $res ) ) {
|
566 |
+
$this->result = $res;
|
567 |
+
return $res;
|
568 |
+
}
|
569 |
+
|
570 |
+
//Bombard the calling function will all the info which we've just used.
|
571 |
+
return $this->result;
|
572 |
+
}
|
573 |
+
}
|
includes/admin/licensing/skin-legacy.php
CHANGED
@@ -1,116 +1,116 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skin class.
|
4 |
-
*
|
5 |
-
* @since 6.0.0
|
6 |
-
*
|
7 |
-
* @package ExactMetrics
|
8 |
-
* @subpackage Upgrader Skin
|
9 |
-
* @author Chris Christoff
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
class ExactMetrics_Skin extends WP_Upgrader_Skin {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Primary class constructor.
|
21 |
-
*
|
22 |
-
* @since 6.0.0
|
23 |
-
*
|
24 |
-
* @param array $args Empty array of args (we will use defaults).
|
25 |
-
*/
|
26 |
-
public function __construct( $args = array() ) {
|
27 |
-
|
28 |
-
parent::__construct();
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Set the upgrader object and store it as a property in the parent class.
|
34 |
-
*
|
35 |
-
* @since 6.0.0
|
36 |
-
*
|
37 |
-
* @param object $upgrader The upgrader object (passed by reference).
|
38 |
-
*/
|
39 |
-
public function set_upgrader( &$upgrader ) {
|
40 |
-
|
41 |
-
if ( is_object( $upgrader ) ) {
|
42 |
-
$this->upgrader =& $upgrader;
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Set the upgrader result and store it as a property in the parent class.
|
49 |
-
*
|
50 |
-
* @since 6.0.0
|
51 |
-
*
|
52 |
-
* @param object $result The result of the install process.
|
53 |
-
*/
|
54 |
-
public function set_result( $result ) {
|
55 |
-
|
56 |
-
$this->result = $result;
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Empty out the header of its HTML content and only check to see if it has
|
62 |
-
* been performed or not.
|
63 |
-
*
|
64 |
-
* @since 6.0.0
|
65 |
-
*/
|
66 |
-
public function header() {}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Empty out the footer of its HTML contents.
|
70 |
-
*
|
71 |
-
* @since 6.0.0
|
72 |
-
*/
|
73 |
-
function footer() {}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Instead of outputting HTML for errors, json_encode the errors and send them
|
77 |
-
* back to the Ajax script for processing.
|
78 |
-
*
|
79 |
-
* @since 6.0.0
|
80 |
-
*
|
81 |
-
* @param array $errors Array of errors with the install process.
|
82 |
-
*/
|
83 |
-
function error( $errors ) {
|
84 |
-
|
85 |
-
if ( ! empty( $errors ) ) {
|
86 |
-
$error_message = esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-dashboard-for-wp' );
|
87 |
-
if ( is_wp_error( $errors ) ) {
|
88 |
-
/**
|
89 |
-
* @var WP_Error $errors
|
90 |
-
*/
|
91 |
-
$message = $errors->get_error_message();
|
92 |
-
|
93 |
-
if ( ! empty( $message ) ) {
|
94 |
-
// Translators: The name of the addon that can't be installed.
|
95 |
-
$error_message = sprintf( esc_html__( 'There was an error installing the addon: %s', 'google-analytics-dashboard-for-wp' ), esc_html( $message ) );
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
wp_send_json( array( 'error' => $error_message ) );
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Empty out the feedback method to prevent outputting HTML strings as the install
|
106 |
-
* is progressing.
|
107 |
-
*
|
108 |
-
* @since 6.0.0
|
109 |
-
*
|
110 |
-
* @param string $string The feedback string.
|
111 |
-
*/
|
112 |
-
function feedback( $string ) {
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skin class.
|
4 |
+
*
|
5 |
+
* @since 6.0.0
|
6 |
+
*
|
7 |
+
* @package ExactMetrics
|
8 |
+
* @subpackage Upgrader Skin
|
9 |
+
* @author Chris Christoff
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
class ExactMetrics_Skin extends WP_Upgrader_Skin {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Primary class constructor.
|
21 |
+
*
|
22 |
+
* @since 6.0.0
|
23 |
+
*
|
24 |
+
* @param array $args Empty array of args (we will use defaults).
|
25 |
+
*/
|
26 |
+
public function __construct( $args = array() ) {
|
27 |
+
|
28 |
+
parent::__construct();
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Set the upgrader object and store it as a property in the parent class.
|
34 |
+
*
|
35 |
+
* @since 6.0.0
|
36 |
+
*
|
37 |
+
* @param object $upgrader The upgrader object (passed by reference).
|
38 |
+
*/
|
39 |
+
public function set_upgrader( &$upgrader ) {
|
40 |
+
|
41 |
+
if ( is_object( $upgrader ) ) {
|
42 |
+
$this->upgrader =& $upgrader;
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set the upgrader result and store it as a property in the parent class.
|
49 |
+
*
|
50 |
+
* @since 6.0.0
|
51 |
+
*
|
52 |
+
* @param object $result The result of the install process.
|
53 |
+
*/
|
54 |
+
public function set_result( $result ) {
|
55 |
+
|
56 |
+
$this->result = $result;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Empty out the header of its HTML content and only check to see if it has
|
62 |
+
* been performed or not.
|
63 |
+
*
|
64 |
+
* @since 6.0.0
|
65 |
+
*/
|
66 |
+
public function header() {}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Empty out the footer of its HTML contents.
|
70 |
+
*
|
71 |
+
* @since 6.0.0
|
72 |
+
*/
|
73 |
+
function footer() {}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Instead of outputting HTML for errors, json_encode the errors and send them
|
77 |
+
* back to the Ajax script for processing.
|
78 |
+
*
|
79 |
+
* @since 6.0.0
|
80 |
+
*
|
81 |
+
* @param array $errors Array of errors with the install process.
|
82 |
+
*/
|
83 |
+
function error( $errors ) {
|
84 |
+
|
85 |
+
if ( ! empty( $errors ) ) {
|
86 |
+
$error_message = esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-dashboard-for-wp' );
|
87 |
+
if ( is_wp_error( $errors ) ) {
|
88 |
+
/**
|
89 |
+
* @var WP_Error $errors
|
90 |
+
*/
|
91 |
+
$message = $errors->get_error_message();
|
92 |
+
|
93 |
+
if ( ! empty( $message ) ) {
|
94 |
+
// Translators: The name of the addon that can't be installed.
|
95 |
+
$error_message = sprintf( esc_html__( 'There was an error installing the addon: %s', 'google-analytics-dashboard-for-wp' ), esc_html( $message ) );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
wp_send_json( array( 'error' => $error_message ) );
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Empty out the feedback method to prevent outputting HTML strings as the install
|
106 |
+
* is progressing.
|
107 |
+
*
|
108 |
+
* @since 6.0.0
|
109 |
+
*
|
110 |
+
* @param string $string The feedback string.
|
111 |
+
*/
|
112 |
+
function feedback( $string ) {
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
includes/admin/licensing/skin.php
CHANGED
@@ -1,116 +1,116 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Skin class.
|
4 |
-
*
|
5 |
-
* @since 6.0.0
|
6 |
-
*
|
7 |
-
* @package ExactMetrics
|
8 |
-
* @subpackage Upgrader Skin
|
9 |
-
* @author Chris Christoff
|
10 |
-
*/
|
11 |
-
|
12 |
-
// Exit if accessed directly
|
13 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
-
exit;
|
15 |
-
}
|
16 |
-
|
17 |
-
class ExactMetrics_Skin extends WP_Upgrader_Skin {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Primary class constructor.
|
21 |
-
*
|
22 |
-
* @since 6.0.0
|
23 |
-
*
|
24 |
-
* @param array $args Empty array of args (we will use defaults).
|
25 |
-
*/
|
26 |
-
public function __construct( $args = array() ) {
|
27 |
-
|
28 |
-
parent::__construct();
|
29 |
-
|
30 |
-
}
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Set the upgrader object and store it as a property in the parent class.
|
34 |
-
*
|
35 |
-
* @since 6.0.0
|
36 |
-
*
|
37 |
-
* @param object $upgrader The upgrader object (passed by reference).
|
38 |
-
*/
|
39 |
-
public function set_upgrader( &$upgrader ) {
|
40 |
-
|
41 |
-
if ( is_object( $upgrader ) ) {
|
42 |
-
$this->upgrader =& $upgrader;
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Set the upgrader result and store it as a property in the parent class.
|
49 |
-
*
|
50 |
-
* @since 6.0.0
|
51 |
-
*
|
52 |
-
* @param object $result The result of the install process.
|
53 |
-
*/
|
54 |
-
public function set_result( $result ) {
|
55 |
-
|
56 |
-
$this->result = $result;
|
57 |
-
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Empty out the header of its HTML content and only check to see if it has
|
62 |
-
* been performed or not.
|
63 |
-
*
|
64 |
-
* @since 6.0.0
|
65 |
-
*/
|
66 |
-
public function header() {}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Empty out the footer of its HTML contents.
|
70 |
-
*
|
71 |
-
* @since 6.0.0
|
72 |
-
*/
|
73 |
-
function footer() {}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Instead of outputting HTML for errors, json_encode the errors and send them
|
77 |
-
* back to the Ajax script for processing.
|
78 |
-
*
|
79 |
-
* @since 6.0.0
|
80 |
-
*
|
81 |
-
* @param array $errors Array of errors with the install process.
|
82 |
-
*/
|
83 |
-
function error( $errors ) {
|
84 |
-
|
85 |
-
if ( ! empty( $errors ) ) {
|
86 |
-
$error_message = esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-dashboard-for-wp' );
|
87 |
-
if ( is_wp_error( $errors ) ) {
|
88 |
-
/**
|
89 |
-
* @var WP_Error $errors
|
90 |
-
*/
|
91 |
-
$message = $errors->get_error_message();
|
92 |
-
|
93 |
-
if ( ! empty( $message ) ) {
|
94 |
-
// Translators: The name of the addon that can't be installed.
|
95 |
-
$error_message = sprintf( esc_html__( 'There was an error installing the addon: %s', 'google-analytics-dashboard-for-wp' ), esc_html( $message ) );
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
wp_send_json( array( 'error' => $error_message ) );
|
100 |
-
}
|
101 |
-
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Empty out the feedback method to prevent outputting HTML strings as the install
|
106 |
-
* is progressing.
|
107 |
-
*
|
108 |
-
* @since 6.0.0
|
109 |
-
*
|
110 |
-
* @param string $string The feedback string.
|
111 |
-
*/
|
112 |
-
function feedback( $string, ...$args ) {
|
113 |
-
|
114 |
-
}
|
115 |
-
|
116 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Skin class.
|
4 |
+
*
|
5 |
+
* @since 6.0.0
|
6 |
+
*
|
7 |
+
* @package ExactMetrics
|
8 |
+
* @subpackage Upgrader Skin
|
9 |
+
* @author Chris Christoff
|
10 |
+
*/
|
11 |
+
|
12 |
+
// Exit if accessed directly
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit;
|
15 |
+
}
|
16 |
+
|
17 |
+
class ExactMetrics_Skin extends WP_Upgrader_Skin {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Primary class constructor.
|
21 |
+
*
|
22 |
+
* @since 6.0.0
|
23 |
+
*
|
24 |
+
* @param array $args Empty array of args (we will use defaults).
|
25 |
+
*/
|
26 |
+
public function __construct( $args = array() ) {
|
27 |
+
|
28 |
+
parent::__construct();
|
29 |
+
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Set the upgrader object and store it as a property in the parent class.
|
34 |
+
*
|
35 |
+
* @since 6.0.0
|
36 |
+
*
|
37 |
+
* @param object $upgrader The upgrader object (passed by reference).
|
38 |
+
*/
|
39 |
+
public function set_upgrader( &$upgrader ) {
|
40 |
+
|
41 |
+
if ( is_object( $upgrader ) ) {
|
42 |
+
$this->upgrader =& $upgrader;
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Set the upgrader result and store it as a property in the parent class.
|
49 |
+
*
|
50 |
+
* @since 6.0.0
|
51 |
+
*
|
52 |
+
* @param object $result The result of the install process.
|
53 |
+
*/
|
54 |
+
public function set_result( $result ) {
|
55 |
+
|
56 |
+
$this->result = $result;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Empty out the header of its HTML content and only check to see if it has
|
62 |
+
* been performed or not.
|
63 |
+
*
|
64 |
+
* @since 6.0.0
|
65 |
+
*/
|
66 |
+
public function header() {}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Empty out the footer of its HTML contents.
|
70 |
+
*
|
71 |
+
* @since 6.0.0
|
72 |
+
*/
|
73 |
+
function footer() {}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Instead of outputting HTML for errors, json_encode the errors and send them
|
77 |
+
* back to the Ajax script for processing.
|
78 |
+
*
|
79 |
+
* @since 6.0.0
|
80 |
+
*
|
81 |
+
* @param array $errors Array of errors with the install process.
|
82 |
+
*/
|
83 |
+
function error( $errors ) {
|
84 |
+
|
85 |
+
if ( ! empty( $errors ) ) {
|
86 |
+
$error_message = esc_html__( 'There was an error installing the addon. Please try again.', 'google-analytics-dashboard-for-wp' );
|
87 |
+
if ( is_wp_error( $errors ) ) {
|
88 |
+
/**
|
89 |
+
* @var WP_Error $errors
|
90 |
+
*/
|
91 |
+
$message = $errors->get_error_message();
|
92 |
+
|
93 |
+
if ( ! empty( $message ) ) {
|
94 |
+
// Translators: The name of the addon that can't be installed.
|
95 |
+
$error_message = sprintf( esc_html__( 'There was an error installing the addon: %s', 'google-analytics-dashboard-for-wp' ), esc_html( $message ) );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
wp_send_json( array( 'error' => $error_message ) );
|
100 |
+
}
|
101 |
+
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Empty out the feedback method to prevent outputting HTML strings as the install
|
106 |
+
* is progressing.
|
107 |
+
*
|
108 |
+
* @since 6.0.0
|
109 |
+
*
|
110 |
+
* @param string $string The feedback string.
|
111 |
+
*/
|
112 |
+
function feedback( $string, ...$args ) {
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
includes/admin/notice.php
CHANGED
@@ -1,236 +1,236 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Notices admin class.
|
4 |
-
*
|
5 |
-
* Handles retrieving whether a particular notice has been dismissed or not,
|
6 |
-
* as well as marking a notice as dismissed.
|
7 |
-
*
|
8 |
-
* @since 6.0.0
|
9 |
-
*
|
10 |
-
* @package ExactMetrics
|
11 |
-
* @subpackage Notices
|
12 |
-
* @author Chris Christoff
|
13 |
-
*/
|
14 |
-
|
15 |
-
// Exit if accessed directly
|
16 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
-
exit;
|
18 |
-
}
|
19 |
-
|
20 |
-
final class ExactMetrics_Notice_Admin {
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Holds all dismissed notices
|
24 |
-
*
|
25 |
-
* @access public
|
26 |
-
* @since 6.0.0
|
27 |
-
* @var array $notices Array of dismissed notices.
|
28 |
-
*/
|
29 |
-
public $notices;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Primary class constructor.
|
33 |
-
*
|
34 |
-
* @access public
|
35 |
-
* @since 6.0.0
|
36 |
-
*/
|
37 |
-
public function __construct() {
|
38 |
-
|
39 |
-
// Populate $notices
|
40 |
-
$this->notices = get_option( 'exactmetrics_notices' );
|
41 |
-
if ( ! is_array( $this->notices ) ) {
|
42 |
-
$this->notices = array();
|
43 |
-
}
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Checks if a given notice has been dismissed or not
|
49 |
-
*
|
50 |
-
* @access public
|
51 |
-
* @since 6.0.0
|
52 |
-
*
|
53 |
-
* @param string $notice Programmatic Notice Name
|
54 |
-
* @return bool Notice Dismissed
|
55 |
-
*/
|
56 |
-
|
57 |
-
public function is_dismissed( $notice ) {
|
58 |
-
if ( ! isset( $this->notices[ $notice ] ) ) {
|
59 |
-
return false;
|
60 |
-
}
|
61 |
-
return true;
|
62 |
-
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* Marks the given notice as dismissed
|
67 |
-
*
|
68 |
-
* @access public
|
69 |
-
* @since 6.0.0
|
70 |
-
*
|
71 |
-
* @param string $notice Programmatic Notice Name
|
72 |
-
* @return null
|
73 |
-
*/
|
74 |
-
public function dismiss( $notice ) {
|
75 |
-
$this->notices[ $notice ] = true;
|
76 |
-
update_option( 'exactmetrics_notices', $this->notices );
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
|
81 |
-
/**
|
82 |
-
* Marks a notice as not dismissed
|
83 |
-
*
|
84 |
-
* @access public
|
85 |
-
* @since 6.0.0
|
86 |
-
*
|
87 |
-
* @param string $notice Programmatic Notice Name
|
88 |
-
* @return null
|
89 |
-
*/
|
90 |
-
public function undismiss( $notice ) {
|
91 |
-
unset( $this->notices[ $notice ] );
|
92 |
-
update_option( 'exactmetrics_notices', $this->notices );
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Displays an inline notice with some ExactMetrics styling.
|
98 |
-
*
|
99 |
-
* @access public
|
100 |
-
* @since 6.0.0
|
101 |
-
*
|
102 |
-
* @param string $notice Programmatic Notice Name
|
103 |
-
* @param string $title Title
|
104 |
-
* @param string $message Message
|
105 |
-
* @param string $type Message Type (updated|warning|error) - green, yellow/orange and red respectively.
|
106 |
-
* @param string $button_text Button Text (optional)
|
107 |
-
* @param string $button_url Button URL (optional)
|
108 |
-
* @param bool $is_dismissible User can Dismiss Message (default: false)
|
109 |
-
*/
|
110 |
-
public function display_inline_notice( $name, $title, $message, $type = 'success', $is_dismissible = false, $args = array() ) {
|
111 |
-
/* Available/Planned $args options
|
112 |
-
* $args = array(
|
113 |
-
* 'primary' => array(
|
114 |
-
* 'text' => '',
|
115 |
-
* 'url' => '',
|
116 |
-
* 'target' => '',
|
117 |
-
* 'class' => 'button button-primary',
|
118 |
-
* ),
|
119 |
-
* 'secondary' => array(
|
120 |
-
* 'text' => '',
|
121 |
-
* 'url' => '',
|
122 |
-
* 'target' => '',
|
123 |
-
* 'class' => 'button button-secondary',
|
124 |
-
* ),
|
125 |
-
* 'skip_message_escape' => true // note: This param is for internal use only. Do not use as a developer.
|
126 |
-
* );
|
127 |
-
*/
|
128 |
-
|
129 |
-
|
130 |
-
// Check if the notice is dismissible, and if so has been dismissed.
|
131 |
-
if ( $is_dismissible && $this->is_dismissed( $name ) ) {
|
132 |
-
// Nothing to show here, return!
|
133 |
-
return '';
|
134 |
-
}
|
135 |
-
|
136 |
-
$dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
|
137 |
-
|
138 |
-
// Display inline notice
|
139 |
-
ob_start();
|
140 |
-
?>
|
141 |
-
<div class="exactmetrics-notice <?php echo 'exactmetrics-' . esc_attr( $type ) . '-notice' . $dismissible; ?>" data-notice="<?php echo esc_attr( $name ); ?>">
|
142 |
-
<div class="exactmetrics-notice-icon <?php echo 'exactmetrics-' . esc_attr( $type ) . '-notice-icon'?>">
|
143 |
-
</div>
|
144 |
-
<div class="exactmetrics-notice-text <?php echo 'exactmetrics-' . esc_attr( $type ) . '-notice-text'?>">
|
145 |
-
<?php
|
146 |
-
// Title
|
147 |
-
if ( ! empty ( $title ) ) {
|
148 |
-
?>
|
149 |
-
<p class="exactmetrics-notice-title"><?php echo esc_html( $title ); ?></p>
|
150 |
-
<?php
|
151 |
-
}
|
152 |
-
|
153 |
-
// Message
|
154 |
-
if ( ! empty( $message ) ) {
|
155 |
-
if ( empty( $args['skip_message_escape'] ) ) {
|
156 |
-
?>
|
157 |
-
<p class="exactmetrics-notice-message"><?php echo esc_html( $message ); ?></p>
|
158 |
-
<?php
|
159 |
-
} else {
|
160 |
-
?>
|
161 |
-
<p class="exactmetrics-notice-message"><?php echo $message; ?></p>
|
162 |
-
<?php
|
163 |
-
}
|
164 |
-
}
|
165 |
-
|
166 |
-
// Primary Button
|
167 |
-
if ( ! empty( $args['primary']['text'] ) ) {
|
168 |
-
|
169 |
-
$text = '';
|
170 |
-
if ( ! empty( $args['primary']['text'] ) ) {
|
171 |
-
$text = $args['primary']['text'];
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
if ( ! empty( $args['primary']['url'] ) ) {
|
176 |
-
$url = $args['primary']['url'];
|
177 |
-
}
|
178 |
-
|
179 |
-
$target = '';
|
180 |
-
if ( ! empty( $args['primary']['target'] ) && $args['primary']['target'] === 'blank') {
|
181 |
-
$target = ' target="_blank" rel="noopener noreferrer"';
|
182 |
-
}
|
183 |
-
|
184 |
-
$class = 'button button-primary';
|
185 |
-
if ( ! empty( $args['primary']['class'] ) ) {
|
186 |
-
$class = ' class="'. $args['primary']['class'] . '"';
|
187 |
-
}
|
188 |
-
?>
|
189 |
-
<a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
|
190 |
-
<?php
|
191 |
-
}
|
192 |
-
|
193 |
-
// Secondary Button
|
194 |
-
if ( ! empty( $args['secondary']['text'] ) ) {
|
195 |
-
|
196 |
-
$text = '';
|
197 |
-
if ( ! empty( $args['secondary']['text'] ) ) {
|
198 |
-
$text = $args['secondary']['text'];
|
199 |
-
}
|
200 |
-
|
201 |
-
$url = '#';
|
202 |
-
if ( ! empty( $args['secondary']['url'] ) ) {
|
203 |
-
$url = $args['secondary']['url'];
|
204 |
-
}
|
205 |
-
|
206 |
-
$target = '';
|
207 |
-
if ( ! empty( $args['secondary']['target'] ) && $args['secondary']['target'] === 'blank') {
|
208 |
-
$target = ' target="_blank" rel="noopener noreferrer"';
|
209 |
-
}
|
210 |
-
|
211 |
-
$class = 'button button-secondary';
|
212 |
-
if ( ! empty( $args['secondary']['class'] ) ) {
|
213 |
-
$class = ' class="'. $args['secondary']['class'] . '"';
|
214 |
-
}
|
215 |
-
?>
|
216 |
-
<a href="<?php echo esc_attr( $url ); ?>"<?php echo $target; ?><?php echo $class;?>><?php echo esc_html( $text ); ?></a>
|
217 |
-
<?php
|
218 |
-
}
|
219 |
-
|
220 |
-
// Dismiss Button
|
221 |
-
if ( $is_dismissible ) {
|
222 |
-
?>
|
223 |
-
<button type="button" class="notice-dismiss<?php echo $dismissible; ?>">
|
224 |
-
<span class="screen-reader-text">
|
225 |
-
<?php esc_html_e( 'Dismiss this notice', 'google-analytics-dashboard-for-wp' ); ?>
|
226 |
-
</span>
|
227 |
-
</button>
|
228 |
-
<?php
|
229 |
-
}
|
230 |
-
?>
|
231 |
-
</div>
|
232 |
-
</div>
|
233 |
-
<?php
|
234 |
-
return ob_get_clean();
|
235 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Notices admin class.
|
4 |
+
*
|
5 |
+
* Handles retrieving whether a particular notice has been dismissed or not,
|
6 |
+
* as well as marking a notice as dismissed.
|
7 |
+
*
|
8 |
+
* @since 6.0.0
|
9 |
+
*
|
10 |
+
* @package ExactMetrics
|
11 |
+
* @subpackage Notices
|
12 |
+
* @author Chris Christoff
|
13 |
+
*/
|
14 |
+
|
15 |
+
// Exit if accessed directly
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
17 |
+
exit;
|
18 |
+
}
|
19 |
+
|
20 |
+
final class ExactMetrics_Notice_Admin {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Holds all dismissed notices
|
24 |
+
*
|
25 |
+
* @access public
|
26 |
+
* @since 6.0.0
|
27 |
+
* @var array $notices Array of dismissed notices.
|
28 |
+
*/
|
29 |
+
public $notices;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Primary class constructor.
|
33 |
+
*
|
34 |
+
* @access public
|
35 |
+
* @since 6.0.0
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
+
|
39 |
+
// Populate $notices
|
40 |
+
$this->notices = get_option( 'exactmetrics_notices' );
|
41 |
+
if ( ! is_array( $this->notices ) ) {
|
42 |
+
$this->notices = array();
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Checks if a given notice has been dismissed or not
|
49 |
+
*
|
50 |
+
* @access public
|
51 |
+
* @since 6.0.0
|
52 |
+
*
|
53 |
+
* @param string $notice Programmatic Notice Name
|
54 |
+
* @return bool Notice Dismissed
|
55 |
+
*/
|
56 |
+
|
57 |
+
public function is_dismissed( $notice ) {
|
58 |
+
if ( ! isset( $this->notices[ $notice ] ) ) {
|
59 |
+
return false;
|
60 |
+
}
|
61 |
+
return true;
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Marks the given notice as dismissed
|
67 |
+
*
|
68 |
+
* @access public
|
69 |
+
* @since 6.0.0
|
70 |
+
*
|
71 |
+
* @param string $notice Programmatic Notice Name
|
72 |
+
* @return null
|
73 |
+
*/
|
74 |
+
public function dismiss( $notice ) {
|
75 |
+
$this->notices[ $notice ] = true;
|
76 |
+
update_option( 'exactmetrics_notices', $this->notices );
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Marks a notice as not dismissed
|
83 |
+
*
|
84 |
+
* @access public
|
85 |
+
* @since 6.0.0
|
86 |
+
*
|
87 |
+
* @param string $notice Programmatic Notice Name
|
88 |
+
* @return null
|
89 |
+
*/
|
90 |
+
public function undismiss( $notice ) {
|
91 |
+
unset( $this->notices[ $notice ] );
|
92 |
+
update_option( 'exactmetrics_notices', $this->notices );
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Displays an inline notice with some ExactMetrics styling.
|
98 |
+
*
|
99 |
+
* @access public
|
100 |
+
* @since 6.0.0
|
101 |
+
*
|
102 |
+
* @param string $notice Programmatic Notice Name
|
103 |
+
* @param string $title Title
|
104 |
+
* @param string $message Message
|
105 |
+
* @param string $type Message Type (updated|warning|error) - green, yellow/orange and red respectively.
|
106 |
+
* @param string $button_text Button Text (optional)
|
107 |
+
* @param string $button_url Button URL (optional)
|
108 |
+
* @param bool $is_dismissible User can Dismiss Message (default: false)
|
109 |
+
*/
|
110 |
+
public function display_inline_notice( $name, $title, $message, $type = 'success', $is_dismissible = false, $args = array() ) {
|
111 |
+
/* Available/Planned $args options
|
112 |
+
* $args = array(
|
113 |
+
* 'primary' => array(
|
114 |
+
* 'text' => '',
|
115 |
+
* 'url' => '',
|
116 |
+
* 'target' => '',
|
117 |
+
* 'class' => 'button button-primary',
|
118 |
+
* ),
|
119 |
+
* 'secondary' => array(
|
120 |
+
* 'text' => '',
|
121 |
+
* 'url' => '',
|
122 |
+
* 'target' => '',
|
123 |
+
* 'class' => 'button button-secondary',
|
124 |
+
* ),
|
125 |
+
* 'skip_message_escape' => true // note: This param is for internal use only. Do not use as a developer.
|
126 |
+
* );
|
127 |
+
*/
|
128 |
+
|
129 |
+
|
130 |
+
// Check if the notice is dismissible, and if so has been dismissed.
|
131 |
+
if ( $is_dismissible && $this->is_dismissed( $name ) ) {
|
132 |
+
// Nothing to show here, return!
|
133 |
+
return '';
|
134 |
+
}
|
135 |
+
|
136 |
+
$dismissible = ( $is_dismissible ) ? ' is-dismissible': '';
|
137 |
+
|
138 |
+
// Display inline notice
|
139 |
+
ob_start();
|
140 |
+
?>
|
141 |
+
<div class="exactmetrics-notice <?php echo 'exactmetrics-' . esc_attr( $type ) . '-notice' . $dismissible; ?>" data-notice="<?php echo esc_attr( $name ); ?>">
|
142 |
+
<div class="exactmetrics-notice-icon <?php echo 'exactmetrics-' . esc_attr( $type ) . '-notice-icon'?>">
|
143 |
+
</div>
|
144 |
+
<div class="exactmetrics-notice-text <?php echo 'exactmetrics-' . esc_attr( $type ) . '-notice-text'?>">
|
145 |
+
<?php
|
146 |
+
// Title
|
147 |
+
if ( ! empty ( $title ) ) {
|
148 |
+
?>
|
149 |
+
<p class="exactmetrics-notice-title"><?php echo esc_html( $title ); ?></p>
|
150 |
+
<?php
|
151 |
+
}
|
152 |
+
|
153 |
+
// Message
|
154 |
+
if ( ! empty( $message ) ) {
|
155 |
+
if ( empty( $args['skip_message_escape'] ) ) {
|
156 |
+
?>
|
157 |
+
<p class="exactmetrics-notice-message"><?php echo esc_html( $message ); ?></p>
|
158 |
+
<?php
|
159 |
+
} else {
|
160 |
+
?>
|
161 |
+
<p class="exactmetrics-notice-message"><?php echo $message; ?></p>
|
162 |
+
<?php
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
// Primary Button
|
167 |
+
if ( ! empty( $args['primary']['text'] ) ) {
|
168 |
+
|
169 |
+
$text = '';
|
170 |
+
if ( ! empty( $args['primary']['text'] ) ) {
|
171 |
+
$text = $args['primary']['text'];
|
172 |
+
}
|
173 |
+
|
174 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|