Version Description
- Enhancement: Italian translation, updated by Leo
- Enhancement: Japanese translation, updated by Hinaloe
- Enhancement: Portuguese (Brazil) translation, updated by Treed Box
- Enhancement: introducing a manager class to keep track of all instances and their references
- Enhancement: push the tracking code at the end of head section, props by Caleb Evans
- Enhancement: better support for remove_action and wp_dequeue_script
- Enhancement: Ajax calls optimization
- Bug Fix: loading bar issues while not all frontend features are enabled
- Bug Fix: in-existent script enqueued in frontend component, reported by mmokrejs
- Bug Fix: i18n improvements, committed by Hinaloe
- Bug Fix: PHP notice when using bbPress, reported by sheridencharles
- Bug Fix: inexistent script enqueued in frontend component, reported by mmokrejs
- Bug Fix: improved URI detection in Pages and Posts backend reports
- Bug Fix: color picker and settings page tabs not working when per posts/pages reports are disabled
Download this release
Release Info
Developer | deconf |
Plugin | Google Analytics Dashboard for WP (GADWP) |
Version | 4.6 |
Comparing to | |
See all releases |
Code changes from version 4.5.1 to 4.6
- admin/ajax-actions.php +113 -97
- admin/css/gadwp.css +5 -2
- admin/item-reports.php +57 -54
- admin/settings.php +1249 -1436
- admin/setup.php +248 -244
- admin/widgets.php +271 -286
- config.php +302 -309
- front/ajax-actions.php +127 -118
- front/item-reports.php +79 -72
- front/tracking.php +54 -51
- front/tracking/code-classic.php +9 -4
- front/tracking/code-universal.php +51 -46
- front/tracking/events-classic.php +6 -1
- front/tracking/events-universal.php +20 -14
- front/widgets.php +107 -107
- gadwp.php +248 -73
- install/install.php +132 -127
- install/uninstall.php +36 -31
- languages/ga-dash-ar.mo +0 -0
- languages/ga-dash-ar.po +417 -349
- languages/ga-dash-de_DE.mo +0 -0
- languages/ga-dash-de_DE.po +396 -346
- languages/ga-dash-es_ES.mo +0 -0
- languages/ga-dash-es_ES.po +361 -343
- languages/ga-dash-fr_FR.mo +0 -0
- languages/ga-dash-fr_FR.po +413 -354
- languages/ga-dash-hu_HU.mo +0 -0
- languages/ga-dash-hu_HU.po +395 -345
- languages/ga-dash-it_IT.mo +0 -0
- languages/ga-dash-it_IT.po +468 -387
- languages/ga-dash-ja.mo +0 -0
- languages/ga-dash-ja.po +494 -596
- languages/ga-dash-nl_NL.mo +0 -0
- languages/ga-dash-nl_NL.po +338 -334
- languages/ga-dash-pl_PL.mo +0 -0
- languages/ga-dash-pl_PL.po +407 -350
- languages/ga-dash-pt_BR.mo +0 -0
- languages/ga-dash-pt_BR.po +505 -366
- languages/ga-dash.pot +435 -605
- readme.txt +24 -8
- tools/autoload.php +17 -12
- tools/gapi.php +943 -937
- tools/iso3166.php +244 -239
- tools/nprogress/nprogress.css +64 -48
- tools/src/Google/Auth/Abstract.php +11 -11
- tools/src/Google/Auth/AppIdentity.php +64 -59
- tools/src/Google/Auth/AssertionCredentials.php +112 -103
- tools/src/Google/Auth/LoginTicket.php +46 -45
- tools/src/Google/Auth/OAuth2.php +481 -473
- tools/src/Google/Auth/Simple.php +31 -29
- tools/src/Google/Cache/Abstract.php +29 -29
- tools/src/Google/Cache/Apc.php +72 -71
- tools/src/Google/Cache/File.php +146 -142
- tools/src/Google/Cache/Memcache.php +137 -132
- tools/src/Google/Cache/Null.php +25 -25
- tools/src/Google/Client.php +630 -721
admin/ajax-actions.php
CHANGED
@@ -5,107 +5,123 @@
|
|
5 |
* License: GPLv2 or later
|
6 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
*/
|
8 |
-
if (! class_exists('GADASH_Backend_Ajax')) {
|
9 |
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
{
|
15 |
-
// Admin Widget action
|
16 |
-
add_action('wp_ajax_gadash_get_widgetreports', array(
|
17 |
-
$this,
|
18 |
-
'ajax_widget_reports'
|
19 |
-
));
|
20 |
-
// Items action
|
21 |
-
add_action('wp_ajax_gadwp_get_ItemReports', array(
|
22 |
-
$this,
|
23 |
-
'ajax_item_reports'
|
24 |
-
));
|
25 |
-
}
|
26 |
|
27 |
-
|
28 |
-
* Ajax handler for Items (posts/pages)
|
29 |
-
*
|
30 |
-
* @return json|int
|
31 |
-
*/
|
32 |
-
function ajax_item_reports()
|
33 |
{
|
34 |
-
global $GADASH_Config;
|
35 |
-
if (! isset($_REQUEST['gadwp_security_item_reports']) or ! wp_verify_nonce($_REQUEST['gadwp_security_item_reports'], 'gadwp_get_itemreports')) {
|
36 |
-
wp_die(- 30);
|
37 |
-
}
|
38 |
-
$from = $_REQUEST['from'];
|
39 |
-
$to = $_REQUEST['to'];
|
40 |
-
$query = $_REQUEST['query'];
|
41 |
-
$filter_id = $_REQUEST['filter'];
|
42 |
-
if (ob_get_length()) {
|
43 |
-
ob_clean();
|
44 |
-
}
|
45 |
-
$tools = new GADASH_Tools();
|
46 |
-
if (! $tools->check_roles($GADASH_Config->options['ga_dash_access_back']) or 0 == $GADASH_Config->options['item_reports']) {
|
47 |
-
wp_die(- 31);
|
48 |
-
}
|
49 |
-
if ($GADASH_Config->options['ga_dash_token'] and $GADASH_Config->options['ga_dash_tableid_jail'] and $from and $to) {
|
50 |
-
include_once ($GADASH_Config->plugin_path . '/tools/gapi.php');
|
51 |
-
global $GADASH_GAPI;
|
52 |
-
} else {
|
53 |
-
wp_die(- 24);
|
54 |
-
}
|
55 |
-
$projectId = $GADASH_Config->options['ga_dash_tableid_jail'];
|
56 |
-
$profile_info = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $projectId);
|
57 |
-
if (isset($profile_info[4])) {
|
58 |
-
$GADASH_GAPI->timeshift = $profile_info[4];
|
59 |
-
} else {
|
60 |
-
$GADASH_GAPI->timeshift = (int) current_time('timestamp') - time();
|
61 |
-
}
|
62 |
-
// strip the protocol & domain
|
63 |
-
$uri = str_replace($tools->strip_protocol($profile_info[3]), '', $tools->strip_protocol(get_permalink($filter_id)));
|
64 |
-
// make sure the path starts with '/'
|
65 |
-
if ($uri) {
|
66 |
-
$uri = '/' . ltrim($uri, '/');
|
67 |
-
}
|
68 |
-
// allow URI correction before sending an API request
|
69 |
-
$filter = apply_filters('gadwp_backenditem_uri', $uri);
|
70 |
-
$GADASH_GAPI->get($projectId, $query, $from, $to, $filter);
|
71 |
-
}
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
-
}
|
110 |
}
|
111 |
-
$GADASH_Backend_Ajax = new GADASH_Backend_Ajax();
|
5 |
* License: GPLv2 or later
|
6 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
*/
|
|
|
8 |
|
9 |
+
// Exit if accessed directly
|
10 |
+
if (! defined('ABSPATH'))
|
11 |
+
exit();
|
12 |
|
13 |
+
if (! class_exists('GADWP_Backend_Ajax')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
final class GADWP_Backend_Ajax
|
|
|
|
|
|
|
|
|
|
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
private $gadwp;
|
19 |
+
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
$this->gadwp = GADWP();
|
23 |
+
|
24 |
+
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && (1 == $this->gadwp->config->options['dashboard_widget'])) {
|
25 |
+
// Admin Widget action
|
26 |
+
add_action('wp_ajax_gadash_get_widgetreports', array(
|
27 |
+
$this,
|
28 |
+
'ajax_widget_reports'
|
29 |
+
));
|
30 |
+
}
|
31 |
+
|
32 |
+
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && (1 == $this->gadwp->config->options['item_reports'])) {
|
33 |
+
// Items action
|
34 |
+
add_action('wp_ajax_gadwp_get_ItemReports', array(
|
35 |
+
$this,
|
36 |
+
'ajax_item_reports'
|
37 |
+
));
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Ajax handler for Items (posts/pages)
|
43 |
+
*
|
44 |
+
* @return json|int
|
45 |
+
*/
|
46 |
+
public function ajax_item_reports()
|
47 |
+
{
|
48 |
+
if (! isset($_REQUEST['gadwp_security_item_reports']) || ! wp_verify_nonce($_REQUEST['gadwp_security_item_reports'], 'gadwp_get_itemreports')) {
|
49 |
+
wp_die(- 30);
|
50 |
+
}
|
51 |
+
$from = $_REQUEST['from'];
|
52 |
+
$to = $_REQUEST['to'];
|
53 |
+
$query = $_REQUEST['query'];
|
54 |
+
$filter_id = $_REQUEST['filter'];
|
55 |
+
if (ob_get_length()) {
|
56 |
+
ob_clean();
|
57 |
+
}
|
58 |
+
|
59 |
+
if (! GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) || 0 == $this->gadwp->config->options['item_reports']) {
|
60 |
+
wp_die(- 31);
|
61 |
+
}
|
62 |
+
if ($this->gadwp->config->options['ga_dash_token'] && $this->gadwp->config->options['ga_dash_tableid_jail'] && $from && $to) {
|
63 |
+
if (null === $this->gadwp->gapi_controller) {
|
64 |
+
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
|
65 |
+
}
|
66 |
+
} else {
|
67 |
+
wp_die(- 24);
|
68 |
+
}
|
69 |
+
$projectId = $this->gadwp->config->options['ga_dash_tableid_jail'];
|
70 |
+
$profile_info = GADWP_Tools::get_selected_profile($this->gadwp->config->options['ga_dash_profile_list'], $projectId);
|
71 |
+
if (isset($profile_info[4])) {
|
72 |
+
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
|
73 |
+
} else {
|
74 |
+
$this->gadwp->gapi_controller->timeshift = (int) current_time('timestamp') - time();
|
75 |
+
}
|
76 |
+
|
77 |
+
$uri_parts = explode('/', get_permalink($filter_id), 4);
|
78 |
+
|
79 |
+
if (isset($uri_parts[3])) {
|
80 |
+
$uri = '/' . $uri_parts[3];
|
81 |
+
} else {
|
82 |
+
wp_die(- 25);
|
83 |
+
}
|
84 |
+
|
85 |
+
// allow URI correction before sending an API request
|
86 |
+
$filter = apply_filters('gadwp_backenditem_uri', $uri);
|
87 |
+
$this->gadwp->gapi_controller->get($projectId, $query, $from, $to, $filter);
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Ajax handler for Admin Widget
|
92 |
+
*
|
93 |
+
* @return json|int
|
94 |
+
*/
|
95 |
+
public function ajax_widget_reports()
|
96 |
+
{
|
97 |
+
if (! isset($_REQUEST['gadash_security_widget_reports']) || ! wp_verify_nonce($_REQUEST['gadash_security_widget_reports'], 'gadash_get_widgetreports')) {
|
98 |
+
wp_die(- 30);
|
99 |
+
}
|
100 |
+
$projectId = $_REQUEST['projectId'];
|
101 |
+
$from = $_REQUEST['from'];
|
102 |
+
$to = $_REQUEST['to'];
|
103 |
+
$query = $_REQUEST['query'];
|
104 |
+
if (ob_get_length()) {
|
105 |
+
ob_clean();
|
106 |
+
}
|
107 |
+
|
108 |
+
if (! GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) || 0 == $this->gadwp->config->options['dashboard_widget']) {
|
109 |
+
wp_die(- 31);
|
110 |
+
}
|
111 |
+
if ($this->gadwp->config->options['ga_dash_token'] && $projectId && $from && $to) {
|
112 |
+
if (null === $this->gadwp->gapi_controller) {
|
113 |
+
$this->gadwp->gapi_controller = new GADWP_GAPI_Controller();
|
114 |
+
}
|
115 |
+
} else {
|
116 |
+
wp_die(- 24);
|
117 |
+
}
|
118 |
+
$profile_info = GADWP_Tools::get_selected_profile($this->gadwp->config->options['ga_dash_profile_list'], $projectId);
|
119 |
+
if (isset($profile_info[4])) {
|
120 |
+
$this->gadwp->gapi_controller->timeshift = $profile_info[4];
|
121 |
+
} else {
|
122 |
+
$this->gadwp->gapi_controller->timeshift = (int) current_time('timestamp') - time();
|
123 |
+
}
|
124 |
+
$this->gadwp->gapi_controller->get($projectId, $query, $from, $to);
|
125 |
+
}
|
126 |
}
|
|
|
127 |
}
|
|
admin/css/gadwp.css
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
/* Tab navigation */
|
2 |
-
#gadwp-events, #gadwp-custom, #gadwp-advanced, #gadwp-exclude,
|
3 |
-
#gadwp-config {
|
4 |
display: none;
|
5 |
}
|
6 |
|
@@ -23,6 +22,10 @@ td.title-select {
|
|
23 |
width: 300px;
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
26 |
td.debugging {
|
27 |
width: 300px;
|
28 |
}
|
1 |
/* Tab navigation */
|
2 |
+
#gadwp-events, #gadwp-custom, #gadwp-advanced, #gadwp-exclude, #gadwp-config {
|
|
|
3 |
display: none;
|
4 |
}
|
5 |
|
22 |
width: 300px;
|
23 |
}
|
24 |
|
25 |
+
.gadwp-help{
|
26 |
+
padding-left:15px;
|
27 |
+
}
|
28 |
+
|
29 |
td.debugging {
|
30 |
width: 300px;
|
31 |
}
|
admin/item-reports.php
CHANGED
@@ -5,64 +5,67 @@
|
|
5 |
* License: GPLv2 or later
|
6 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
*/
|
8 |
-
if (! class_exists('GADASH_Back_Stats')) {
|
9 |
|
10 |
-
|
11 |
-
|
|
|
12 |
|
13 |
-
|
14 |
-
{
|
15 |
-
global $GADASH_Config;
|
16 |
-
$tools = new GADASH_Tools();
|
17 |
-
if (! $tools->check_roles($GADASH_Config->options['ga_dash_access_back']) or 0 == $GADASH_Config->options['item_reports']) {
|
18 |
-
return;
|
19 |
-
}
|
20 |
-
// Add custom column in Posts List
|
21 |
-
add_filter('manage_posts_columns', array(
|
22 |
-
$this,
|
23 |
-
'add_stats_column'
|
24 |
-
));
|
25 |
-
// Populate custom column in Posts List
|
26 |
-
add_action('manage_posts_custom_column', array(
|
27 |
-
$this,
|
28 |
-
'display_item_stats'
|
29 |
-
), 10, 2);
|
30 |
-
// Add custom column in Pages List
|
31 |
-
add_filter('manage_pages_columns', array(
|
32 |
-
$this,
|
33 |
-
'add_stats_column'
|
34 |
-
));
|
35 |
-
// Populate custom column in Pages List
|
36 |
-
add_action('manage_pages_custom_column', array(
|
37 |
-
$this,
|
38 |
-
'display_item_stats'
|
39 |
-
), 10, 2);
|
40 |
-
}
|
41 |
|
42 |
-
|
43 |
{
|
44 |
-
global $GADASH_Config, $wp_version;
|
45 |
-
|
46 |
-
if ($column != 'gadwp_stats'){
|
47 |
-
return;
|
48 |
-
}
|
49 |
-
|
50 |
-
if (version_compare($wp_version, '3.8.0', '>=')) {
|
51 |
-
echo '<a id="gadwp-' . $id . '" title="' . get_the_title($id) . '" href="#' . $id . '" class="gadwp-icon dashicons-before dashicons-chart-area"></a>';
|
52 |
-
} else {
|
53 |
-
echo '<a id="gadwp-' . $id . '" title="' . get_the_title($id) . '" href="#' . $id . '"><img class="gadwp-icon-oldwp" src="' . $GADASH_Config->plugin_url . '/admin/images/gadash-icon.png"</a>';
|
54 |
-
}
|
55 |
-
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
}
|
5 |
* License: GPLv2 or later
|
6 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
7 |
*/
|
|
|
8 |
|
9 |
+
// Exit if accessed directly
|
10 |
+
if (! defined('ABSPATH'))
|
11 |
+
exit();
|
12 |
|
13 |
+
if (! class_exists('GADWP_Backend_Item_Reports')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
+
final class GADWP_Backend_Item_Reports
|
16 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
private $gadwp;
|
19 |
+
|
20 |
+
public function __construct()
|
21 |
+
{
|
22 |
+
$this->gadwp = GADWP();
|
23 |
+
|
24 |
+
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_back']) && 1 == $this->gadwp->config->options['item_reports']) {
|
25 |
+
|
26 |
+
// Add custom column in Posts List
|
27 |
+
add_filter('manage_posts_columns', array(
|
28 |
+
$this,
|
29 |
+
'add_columns'
|
30 |
+
));
|
31 |
+
// Populate custom column in Posts List
|
32 |
+
add_action('manage_posts_custom_column', array(
|
33 |
+
$this,
|
34 |
+
'add_icons'
|
35 |
+
), 10, 2);
|
36 |
+
// Add custom column in Pages List
|
37 |
+
add_filter('manage_pages_columns', array(
|
38 |
+
$this,
|
39 |
+
'add_columns'
|
40 |
+
));
|
41 |
+
// Populate custom column in Pages List
|
42 |
+
add_action('manage_pages_custom_column', array(
|
43 |
+
$this,
|
44 |
+
'add_icons'
|
45 |
+
), 10, 2);
|
46 |
+
}
|
47 |
+
}
|
48 |
|
49 |
+
public function add_icons($column, $id)
|
50 |
+
{
|
51 |
+
global $wp_version;
|
52 |
+
|
53 |
+
if ($column != 'gadwp_stats') {
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
if (version_compare($wp_version, '3.8.0', '>=')) {
|
58 |
+
echo '<a id="gadwp-' . $id . '" title="' . get_the_title($id) . '" href="#' . $id . '" class="gadwp-icon dashicons-before dashicons-chart-area"></a>';
|
59 |
+
} else {
|
60 |
+
echo '<a id="gadwp-' . $id . '" title="' . get_the_title($id) . '" href="#' . $id . '"><img class="gadwp-icon-oldwp" src="' . GADWP_URL . 'admin/images/gadash-icon.png"</a>';
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
public function add_columns($columns)
|
65 |
+
{
|
66 |
+
return array_merge($columns, array(
|
67 |
+
'gadwp_stats' => __('Analytics', 'ga-dash')
|
68 |
+
));
|
69 |
+
}
|
70 |
+
}
|
71 |
}
|
admin/settings.php
CHANGED
@@ -6,1543 +6,1356 @@
|
|
6 |
* License: GPLv2 or later
|
7 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
*/
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
{
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
} else
|
36 |
-
if ($who == 'backend') {
|
37 |
-
$options['switch_profile'] = 0;
|
38 |
-
$options['item_reports'] = 0;
|
39 |
-
$options['dashboard_widget'] = 0;
|
40 |
-
if (empty($new_options['ga_dash_access_back'])) {
|
41 |
-
$new_options['ga_dash_access_back'][] = 'administrator';
|
42 |
-
}
|
43 |
-
} else
|
44 |
-
if ($who == 'frontend') {
|
45 |
-
$options['ga_dash_frontend_stats'] = 0;
|
46 |
-
$options['ga_dash_frontend_keywords'] = 0;
|
47 |
-
if (empty($new_options['ga_dash_access_front'])) {
|
48 |
-
$new_options['ga_dash_access_front'][] = 'administrator';
|
49 |
-
}
|
50 |
-
} else
|
51 |
-
if ($who == 'general') {
|
52 |
-
$options['ga_dash_userapi'] = 0;
|
53 |
-
if (!is_multisite()){
|
54 |
-
$options['automatic_updates_minorversion'] = 0;
|
55 |
-
}
|
56 |
} else
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
-
return $options;
|
69 |
-
}
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
|
|
|
|
77 |
}
|
78 |
-
echo '</h2>';
|
79 |
-
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
<form name="ga_dash_form" method="post"
|
99 |
-
|
100 |
-
<div class="wrap">
|
101 |
<?php echo "<h2>" . __( "Google Analytics Frontend Settings", 'ga-dash' ) . "</h2>"; ?><hr>
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
<?php if (isset($message)) echo $message; ?>
|
109 |
<table class="options">
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
116 |
<?php
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
<?php if (in_array($role,$options['ga_dash_access_front']) OR $role=='administrator') echo 'checked="checked"'; if ($role=='administrator') echo 'disabled="disabled"';?> />
|
132 |
-
<?php echo $name; ?>
|
133 |
-
</label></td>
|
134 |
<?php
|
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 |
-
</label>
|
174 |
-
</div>
|
175 |
-
<div class="switch-desc"><?php _e ( " show page searches (after each article)", 'ga-dash' );?></div>
|
176 |
-
</td>
|
177 |
-
</tr>
|
178 |
-
<tr>
|
179 |
-
<td colspan="2"><hr></td>
|
180 |
-
</tr>
|
181 |
-
<tr>
|
182 |
-
<td colspan="2" class="submit"><input type="submit"
|
183 |
-
name="Submit" class="button button-primary"
|
184 |
-
value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
|
185 |
-
</tr>
|
186 |
-
</table>
|
187 |
-
<input type="hidden" name="options[ga_dash_hidden]" value="Y">
|
188 |
-
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
|
189 |
-
<?php
|
190 |
-
self::output_sidebar();
|
191 |
-
}
|
192 |
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
$options = self::set_get_options('backend');
|
200 |
-
if (isset($_POST['options']['ga_dash_hidden'])) {
|
201 |
-
$message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
|
202 |
-
if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
|
203 |
-
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
204 |
-
}
|
205 |
-
}
|
206 |
-
if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
|
207 |
-
$message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash') . "</a> " . __('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('authorize the plugin', 'ga-dash') . "</a>.</p></div>";
|
208 |
}
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
<?php echo "<h2>" . __( "Google Analytics Backend Settings", 'ga-dash' ) . "</h2>"; ?><hr>
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
<?php if (isset($message)) echo $message; ?>
|
221 |
<table class="options">
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
?>
|
234 |
-
<table>
|
235 |
-
<tr>
|
236 |
<?php
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
<td><label> <input
|
242 |
-
type="checkbox" name="options[ga_dash_access_back][]"
|
243 |
-
value="<?php echo $role; ?>"
|
244 |
-
<?php if (in_array($role,$options['ga_dash_access_back']) OR $role=='administrator') echo 'checked="checked"'; if ($role=='administrator') echo 'disabled="disabled"';?> />
|
245 |
-
<?php echo $name; ?>
|
246 |
-
</label></td>
|
247 |
-
<?php
|
248 |
-
}
|
249 |
-
if ($i % 4 == 0) {
|
250 |
?>
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
<?php
|
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 |
-
<div class="switch-desc"><?php _e ( "enable the main Dashboard Widget", 'ga-dash' );?></div>
|
301 |
-
</td>
|
302 |
-
</tr>
|
303 |
-
<tr>
|
304 |
-
<td colspan="2"><hr><?php echo "<h2>" . __( "Real-Time Settings", 'ga-dash' ) . "</h2>"; ?></td>
|
305 |
-
</tr>
|
306 |
-
<tr>
|
307 |
-
<td colspan="2" class="title"> <?php _e("Maximum number of pages to display on real-time tab:", 'ga-dash'); ?>
|
308 |
-
<input type="number" name="options[ga_realtime_pages]"
|
309 |
-
id="ga_realtime_pages"
|
310 |
-
value="<?php echo (int)$options['ga_realtime_pages']; ?>"
|
311 |
-
size="3">
|
312 |
-
<?php echo '('.__("find out more", 'ga-dash')?> <a
|
313 |
-
href="https://deconf.com/google-analytics-dashboard-real-time-reports/"
|
314 |
-
target="_blank"><?php _e("about this feature", 'ga-dash') ?></a>
|
315 |
-
)
|
316 |
</td>
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
<?php echo __("Target Geo Map to country:", 'ga-dash'); ?>
|
324 |
-
<input type="text" style="text-align: center;"
|
325 |
-
name="options[ga_target_geomap]"
|
326 |
-
value="<?php echo esc_attr($options['ga_target_geomap']); ?>"
|
327 |
-
size="3">
|
328 |
-
<?php echo '('.__("find out more", 'ga-dash')?>
|
329 |
-
<a
|
330 |
-
href="https://deconf.com/country-codes-for-google-analytics-dashboard/"
|
331 |
-
target="_blank"><?php _e("about this feature", 'ga-dash') ?></a>
|
332 |
-
)
|
333 |
</td>
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
<input type="hidden" name="options[ga_dash_hidden]" value="Y">
|
345 |
-
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
|
346 |
-
<?php
|
347 |
-
self::output_sidebar();
|
348 |
-
}
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
$tools = new GADASH_Tools();
|
354 |
-
if (! current_user_can('manage_options')) {
|
355 |
-
return;
|
356 |
-
}
|
357 |
-
$options = self::set_get_options('tracking');
|
358 |
-
if (isset($_POST['options']['ga_dash_hidden'])) {
|
359 |
-
$message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
|
360 |
-
if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
|
361 |
-
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
362 |
-
}
|
363 |
-
}
|
364 |
-
if (! $GADASH_Config->options['ga_dash_tableid_jail']) {
|
365 |
-
$message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash') . "</a> " . __('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('authorize the plugin', 'ga-dash') . "</a>.</p></div>";
|
366 |
-
}
|
367 |
-
if (! $options['ga_dash_tracking']) {
|
368 |
-
$message = "<div class='error'><p>" . __("The tracking component is disabled. You should set", 'ga-dash') . " <strong>" . __("Tracking Options", 'ga-dash') . "</strong> " . __("to", 'ga-dash') . " <strong>" . __("Enabled", 'ga-dash') . "</strong>.</p></div>";
|
369 |
}
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
<?php echo "<h2>" . __( "Google Analytics Tracking Code", 'ga-dash' ) . "</h2>"; ?>
|
375 |
</div>
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
<?php
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
|
|
391 |
<?php if (isset($message)) echo $message; ?>
|
392 |
<div id="gadwp-basic">
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
<?php selected( $options['ga_dash_tracking'], 1 ); ?>><?php _e("Enabled", 'ga-dash');?></option>
|
405 |
-
</select></td>
|
406 |
-
</tr>
|
407 |
<?php if ($options['ga_dash_tracking']) {?>
|
408 |
<tr>
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
<?php }?>
|
416 |
<tr>
|
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 |
-
size="50"></td>
|
507 |
-
</tr>
|
508 |
-
<tr>
|
509 |
-
<td colspan="2" class="title">
|
510 |
-
<div class="onoffswitch">
|
511 |
-
<input type="checkbox" name="options[ga_hash_tracking]"
|
512 |
-
value="1" class="onoffswitch-checkbox" id="ga_hash_tracking"
|
513 |
-
<?php checked( $options['ga_hash_tracking'], 1 ); ?>> <label
|
514 |
-
class="onoffswitch-label" for="ga_hash_tracking">
|
515 |
-
<div class="onoffswitch-inner"></div>
|
516 |
-
<div class="onoffswitch-switch"></div>
|
517 |
-
</label>
|
518 |
-
</div>
|
519 |
-
<div class="switch-desc"><?php _e(" track fragment identifiers, hashmarks (#) in URI links", 'ga-dash' ); ?></div>
|
520 |
-
</td>
|
521 |
-
</tr>
|
522 |
-
</table>
|
523 |
-
</div>
|
524 |
-
<div id="gadwp-custom">
|
525 |
-
<table class="options">
|
526 |
-
<tr>
|
527 |
-
<td colspan="2"><?php echo "<h2>" . __( "Custom Definitions", 'ga-dash' ) . "</h2>"; ?></td>
|
528 |
-
</tr>
|
529 |
-
<tr>
|
530 |
-
<td class="title"><label for="ga_author_dimindex"><?php _e("Authors:", 'ga-dash' ); ?></label></td>
|
531 |
-
<td><select id="ga_author_dimindex"
|
532 |
-
name="options[ga_author_dimindex]">
|
533 |
<?php for ($i=0;$i<21;$i++){?>
|
534 |
-
<option value="<?php echo $i;?>"
|
535 |
-
|
536 |
-
<?php } ?>
|
537 |
</select></td>
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
name="options[ga_pubyear_dimindex]">
|
543 |
<?php for ($i=0;$i<21;$i++){?>
|
544 |
-
<option value="<?php echo $i;?>"
|
545 |
-
|
546 |
-
<?php } ?>
|
547 |
</select></td>
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
name="options[ga_category_dimindex]">
|
553 |
<?php for ($i=0;$i<21;$i++){?>
|
554 |
-
<option value="<?php echo $i;?>"
|
555 |
-
|
556 |
-
<?php } ?>
|
557 |
</select></td>
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
name="options[ga_user_dimindex]">
|
563 |
<?php for ($i=0;$i<21;$i++){?>
|
564 |
-
<option value="<?php echo $i;?>"
|
565 |
-
|
566 |
-
<?php } ?>
|
567 |
</select></td>
|
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 |
-
</label>
|
639 |
-
</div>
|
640 |
-
<div class="switch-desc"><?php _e(" enable cross domain tracking", 'ga-dash' ); ?></div>
|
641 |
-
</td>
|
642 |
-
</tr>
|
643 |
-
<tr>
|
644 |
-
<td class="title"><label for="ga_crossdomain_list"><?php _e("Cross Domains:", 'ga-dash'); ?></label></td>
|
645 |
-
<td><input type="text" id="ga_crossdomain_list"
|
646 |
-
name="options[ga_crossdomain_list]"
|
647 |
-
value="<?php echo esc_attr($options['ga_crossdomain_list']); ?>"
|
648 |
-
size="50"></td>
|
649 |
-
</tr>
|
650 |
-
</table>
|
651 |
-
</div>
|
652 |
-
<div id="gadwp-exclude">
|
653 |
-
<table class="options">
|
654 |
-
<tr>
|
655 |
-
<td colspan="2"><?php echo "<h2>" . __( "Exclude Tracking", 'ga-dash' ) . "</h2>"; ?></td>
|
656 |
-
</tr>
|
657 |
-
<tr>
|
658 |
-
<td class="roles title"><label for="ga_track_exclude"><?php _e("Exclude tracking for:", 'ga-dash' ); ?></label></td>
|
659 |
-
<td class="roles">
|
660 |
<?php
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
<?php
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
<td><label> <input type="checkbox"
|
672 |
-
name="options[ga_track_exclude][]"
|
673 |
-
value="<?php echo $role; ?>"
|
674 |
-
<?php if (in_array($role,$options['ga_track_exclude'])) echo 'checked="checked"'; ?> />
|
675 |
<?php echo $name; ?>
|
676 |
</label></td>
|
677 |
<?php
|
678 |
-
|
679 |
-
|
680 |
</tr>
|
681 |
-
|
682 |
<?php
|
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 |
-
global $wp_version;
|
711 |
-
if (! current_user_can('manage_options')) {
|
712 |
-
return;
|
713 |
-
}
|
714 |
-
$options = self::set_get_options('frontend');
|
715 |
-
if (! $GADASH_Config->options['ga_dash_tableid_jail'] or ! $GADASH_Config->options['ga_dash_token']) {
|
716 |
-
$message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash') . "</a> " . __('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('authorize the plugin', 'ga-dash') . "</a>.</p></div>";
|
717 |
}
|
718 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
719 |
<div class="wrap">
|
720 |
<?php echo "<h2>" . __( "Google Analytics Errors & Debugging", 'ga-dash' ) . "</h2>"; ?>
|
721 |
</div>
|
722 |
<div id="poststuff">
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
<?php if (isset($message)) echo $message; ?>
|
728 |
<?php
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
<div id="gadwp-errors">
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
</td>
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
|
|
|
|
747 |
<?php
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
<?php
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
$anonim['ga_dash_token'] = 'HIDDEN';
|
784 |
-
}
|
785 |
-
if ($anonim['ga_dash_refresh_token']) {
|
786 |
-
$anonim['ga_dash_refresh_token'] = 'HIDDEN';
|
787 |
-
}
|
788 |
-
if ($anonim['ga_dash_clientid']) {
|
789 |
-
$anonim['ga_dash_clientid'] = 'HIDDEN';
|
790 |
-
}
|
791 |
-
if ($anonim['ga_dash_clientsecret']) {
|
792 |
-
$anonim['ga_dash_clientsecret'] = 'HIDDEN';
|
793 |
-
}
|
794 |
-
if ($anonim['ga_dash_apikey']) {
|
795 |
-
$anonim['ga_dash_apikey'] = 'HIDDEN';
|
796 |
-
}
|
797 |
-
echo esc_html(print_r($anonim, true));
|
798 |
-
?></pre><br />
|
799 |
-
<hr></td>
|
800 |
-
</tr>
|
801 |
-
</table>
|
802 |
-
</div>
|
803 |
<?php
|
804 |
-
|
805 |
-
}
|
806 |
-
|
807 |
-
public static function general_settings()
|
808 |
-
{
|
809 |
-
global $GADASH_Config;
|
810 |
-
global $wp_version;
|
811 |
-
$tools = new GADASH_Tools();
|
812 |
-
if (! current_user_can('manage_options')) {
|
813 |
-
return;
|
814 |
}
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
if (! stripos('x' . $_POST['ga_dash_code'], 'UA-', 1) == 1) {
|
825 |
-
try {
|
826 |
-
$GADASH_GAPI->client->authenticate($_POST['ga_dash_code']);
|
827 |
-
$GADASH_Config->options['ga_dash_token'] = $GADASH_GAPI->client->getAccessToken();
|
828 |
-
$google_token = json_decode($GADASH_GAPI->client->getAccessToken());
|
829 |
-
$GADASH_Config->options['ga_dash_refresh_token'] = $google_token->refresh_token;
|
830 |
-
$GADASH_Config->set_plugin_options();
|
831 |
-
$message = "<div class='updated'><p>" . __("Plugin authorization succeeded.", 'ga-dash') . "</p></div>";
|
832 |
-
$options = self::set_get_options('general');
|
833 |
-
delete_transient('ga_dash_gapi_errors');
|
834 |
-
delete_transient('ga_dash_lasterror');
|
835 |
-
} catch (Google_IO_Exception $e) {
|
836 |
-
set_transient('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $GADASH_GAPI->error_timeout);
|
837 |
-
return false;
|
838 |
-
} catch (Google_Service_Exception $e) {
|
839 |
-
set_transient('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $GADASH_GAPI->error_timeout);
|
840 |
-
set_transient('ga_dash_gapi_errors', $e->getErrors(), $GADASH_GAPI->error_timeout);
|
841 |
-
return $e->getCode();
|
842 |
-
} catch (Exception $e) {
|
843 |
-
set_transient('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode(), $GADASH_GAPI->error_timeout);
|
844 |
-
$GADASH_GAPI->reset_token(false);
|
845 |
}
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
if ($GADASH_Config->options['ga_dash_token'] and $GADASH_GAPI->client->getAccessToken()) {
|
851 |
-
if ($GADASH_Config->options['ga_dash_profile_list']) {
|
852 |
-
$profiles = $GADASH_Config->options['ga_dash_profile_list'];
|
853 |
-
} else {
|
854 |
-
$profiles = $GADASH_GAPI->refresh_profiles();
|
855 |
-
}
|
856 |
-
if ($profiles) {
|
857 |
-
$GADASH_Config->options['ga_dash_profile_list'] = $profiles;
|
858 |
-
if (! $GADASH_Config->options['ga_dash_tableid_jail']) {
|
859 |
-
$profile = $tools->guess_default_domain($profiles);
|
860 |
-
$GADASH_Config->options['ga_dash_tableid_jail'] = $profile;
|
861 |
-
$GADASH_Config->options['ga_dash_tableid'] = $profile;
|
862 |
}
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
$message = "<div class='updated'><p>" . __("All errors reseted.", 'ga-dash') . "</p></div>";
|
890 |
-
} else {
|
891 |
-
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
892 |
-
}
|
893 |
-
}
|
894 |
-
if (isset($_POST['options']['ga_dash_hidden']) and ! isset($_POST['Clear']) and ! isset($_POST['Reset']) and ! isset($_POST['Reset_Err'])) {
|
895 |
-
$message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
|
896 |
-
if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
|
897 |
-
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
898 |
-
}
|
899 |
-
}
|
900 |
-
if (isset($_POST['Hide'])) {
|
901 |
-
if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) {
|
902 |
-
$message = "<div class='updated'><p>" . __("All other domains/properties were removed.", 'ga-dash') . "</p></div>";
|
903 |
-
$lock_profile = $tools->get_selected_profile($GADASH_Config->options['ga_dash_profile_list'], $GADASH_Config->options['ga_dash_tableid_jail']);
|
904 |
-
$GADASH_Config->options['ga_dash_profile_list'] = array(
|
905 |
-
$lock_profile
|
906 |
-
);
|
907 |
-
$options = self::set_get_options('general');
|
908 |
-
} else {
|
909 |
-
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
910 |
-
}
|
911 |
-
}
|
912 |
-
?>
|
913 |
-
<div class="wrap">
|
914 |
-
<?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
|
915 |
-
</div>
|
916 |
-
<div id="poststuff">
|
917 |
-
<div id="post-body" class="metabox-holder columns-2">
|
918 |
-
<div id="post-body-content">
|
919 |
-
<div class="settings-wrapper">
|
920 |
-
<div class="inside">
|
921 |
-
if ($GADASH_GAPI->gapi_errors_handler()) {
|
922 |
-
$message = "<div class='error'><p>" . __("Something went wrong, check", 'ga-dash') . " <a href='" . menu_page_url('gadash_errors_debugging', false) . "'>" . __('Errors & Debug', 'ga-dash') . "</a> " . __('or', 'ga-dash') . " <a href='" . menu_page_url('gadash_settings', false) . "'>" . __('authorize the plugin', 'ga-dash') . "</a>.</p></div>";
|
923 |
-
}
|
924 |
-
if (isset($_POST['Authorize'])) {
|
925 |
-
$tools->clear_cache();
|
926 |
-
$GADASH_GAPI->token_request();
|
927 |
-
echo "<div class='updated'><p>" . __("Use the red link (see below) to generate and get your access code!", 'ga-dash') . "</p></div>";
|
928 |
-
} else {
|
929 |
-
if (isset($message))
|
930 |
-
echo $message;
|
931 |
-
?>
|
932 |
-
<form name="ga_dash_form" method="post"
|
933 |
-
action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
|
934 |
-
<input type="hidden" name="options[ga_dash_hidden]" value="Y">
|
935 |
-
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
|
936 |
-
<table class="options">
|
937 |
-
<tr>
|
938 |
-
<td colspan="2"><?php echo "<h2>" . __( "Plugin Authorization", 'ga-dash' ) . "</h2>"; ?></td>
|
939 |
-
</tr>
|
940 |
-
<tr>
|
941 |
-
<td colspan="2" class="info">
|
942 |
-
<?php echo __("You should watch the",'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp' target='_blank'>". __("video",'ga-dash')."</a> ".__("and read this", 'ga-dash')." <a href='https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp' target='_blank'>". __("tutorial",'ga-dash')."</a> ".__("before proceeding to authorization. This plugin requires a properly configured Google Analytics account", 'ga-dash')."!";?>
|
943 |
-
</td>
|
944 |
-
</tr>
|
945 |
-
<?php
|
946 |
-
if (! $options['ga_dash_token'] or $options['ga_dash_userapi']) {
|
947 |
-
?>
|
948 |
-
<tr>
|
949 |
-
<td colspan="2" class="info"><input
|
950 |
-
name="options[ga_dash_userapi]" type="checkbox"
|
951 |
-
id="ga_dash_userapi" value="1"
|
952 |
-
<?php checked( $options['ga_dash_userapi'], 1 ); ?>
|
953 |
-
onchange="this.form.submit()"
|
954 |
-
<?php echo ($options['ga_dash_network'])?'disabled="disabled"':''; ?> /><?php _e ( " use your own API Project credentials", 'ga-dash' );?>
|
955 |
-
</td>
|
956 |
-
</tr>
|
957 |
-
}
|
958 |
-
if ($options['ga_dash_userapi']) {
|
959 |
-
?>
|
960 |
-
<tr>
|
961 |
-
<td class="title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'ga-dash'); ?></label>
|
962 |
-
</td>
|
963 |
-
<td><input type="text" name="options[ga_dash_apikey]"
|
964 |
-
value="<?php echo esc_attr($options['ga_dash_apikey']); ?>"
|
965 |
-
size="40" required="required"></td>
|
966 |
-
</tr>
|
967 |
-
<tr>
|
968 |
-
<td class="title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label>
|
969 |
-
</td>
|
970 |
-
<td><input type="text" name="options[ga_dash_clientid]"
|
971 |
-
value="<?php echo esc_attr($options['ga_dash_clientid']); ?>"
|
972 |
-
size="40" required="required"></td>
|
973 |
-
</tr>
|
974 |
-
<tr>
|
975 |
-
<td class="title"><label
|
976 |
-
for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label>
|
977 |
-
</td>
|
978 |
-
<td><input type="text" name="options[ga_dash_clientsecret]"
|
979 |
-
value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>"
|
980 |
-
size="40" required="required"> <input type="hidden"
|
981 |
-
name="options[ga_dash_hidden]" value="Y">
|
982 |
-
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
|
983 |
-
</td>
|
984 |
-
</tr>
|
985 |
-
<?php
|
986 |
-
}
|
987 |
-
?>
|
988 |
-
<?php
|
989 |
-
if ($options['ga_dash_token']) {
|
990 |
-
?>
|
991 |
-
<tr>
|
992 |
-
<td colspan="2"><input type="submit" name="Reset"
|
993 |
-
class="button button-secondary"
|
994 |
-
value="<?php _e( "Clear Authorization", 'ga-dash' ); ?>"
|
995 |
-
<?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> />
|
996 |
-
<input type="submit" name="Clear"
|
997 |
-
class="button button-secondary"
|
998 |
-
value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /> <input
|
999 |
-
type="submit" name="Reset_Err"
|
1000 |
-
class="button button-secondary"
|
1001 |
-
value="<?php _e( "Reset Errors", 'ga-dash' ); ?>" /></td>
|
1002 |
-
</tr>
|
1003 |
-
<tr>
|
1004 |
-
<td colspan="2"><hr></td>
|
1005 |
-
</tr>
|
1006 |
-
<tr>
|
1007 |
-
<td colspan="2"><?php echo "<h2>" . __( "General Settings", 'ga-dash' ) . "</h2>"; ?></td>
|
1008 |
-
</tr>
|
1009 |
-
<tr>
|
1010 |
-
<td class="title"><label for="ga_dash_tableid_jail"><?php _e("Select Domain:", 'ga-dash' ); ?></label></td>
|
1011 |
-
<td><select id="ga_dash_tableid_jail"
|
1012 |
-
<?php disabled(is_array($options['ga_dash_profile_list']), false); ?>
|
1013 |
-
name="options[ga_dash_tableid_jail]">
|
1014 |
-
<?php
|
1015 |
-
if (is_array($options['ga_dash_profile_list'])) {
|
1016 |
-
foreach ($options['ga_dash_profile_list'] as $items) {
|
1017 |
-
if ($items[3]) {
|
1018 |
-
echo '<option value="' . esc_attr($items[1]) . '" ' . selected($items[1], $options['ga_dash_tableid_jail']);
|
1019 |
-
echo ' title="' . __("View Name:", 'ga-dash') . ' ' . esc_attr($items[0]) . '">' . esc_html($tools->strip_protocol($items[3])) . ' ⇒ ' . esc_attr($items[0]) . '</option>';
|
1020 |
}
|
1021 |
-
}
|
1022 |
-
} else {
|
1023 |
-
echo '<option value="">' . __("Property not found", 'ga-dash') . '</option>';
|
1024 |
}
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1033 |
}
|
1034 |
?>
|
1035 |
-
|
1036 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1037 |
<?php } if ($options['ga_dash_userapi']) { ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1038 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1039 |
<?php
|
1040 |
-
|
1041 |
-
|
1042 |
<tr>
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
<?php
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
<td colspan="2"><hr></td>
|
1060 |
-
</tr>
|
1061 |
-
<?php if ( !is_multisite()) {?>
|
1062 |
<tr>
|
1063 |
-
|
1064 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1065 |
<tr>
|
1066 |
-
|
1067 |
-
|
1068 |
-
<input type="checkbox"
|
1069 |
-
name="options[automatic_updates_minorversion]" value="1"
|
1070 |
-
class="onoffswitch-checkbox"
|
1071 |
-
id="automatic_updates_minorversion"
|
1072 |
-
<?php checked( $options['automatic_updates_minorversion'], 1 ); ?>>
|
1073 |
-
<label class="onoffswitch-label"
|
1074 |
-
for="automatic_updates_minorversion">
|
1075 |
-
<div class="onoffswitch-inner"></div>
|
1076 |
-
<div class="onoffswitch-switch"></div>
|
1077 |
-
</label>
|
1078 |
-
</div>
|
1079 |
-
<div class="switch-desc"><?php echo " ".__( "automatic updates for minor versions (security and maintenance releases only)", 'ga-dash' );?></div>
|
1080 |
-
</td>
|
1081 |
-
</tr>
|
1082 |
<?php }?>
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
<td colspan="2"><input type="submit" name="Authorize"
|
1098 |
-
class="button button-secondary" id="authorize"
|
1099 |
-
value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>"
|
1100 |
-
<?php echo $options['ga_dash_network']?'disabled="disabled"':''; ?> />
|
1101 |
-
<input type="submit" name="Clear"
|
1102 |
-
class="button button-secondary"
|
1103 |
-
value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
|
1104 |
-
</tr>
|
1105 |
-
<tr>
|
1106 |
-
<td colspan="2"><hr></td>
|
1107 |
-
</tr>
|
1108 |
-
</table>
|
1109 |
-
</form>
|
1110 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
1111 |
self::output_sidebar();
|
1112 |
-
return;
|
1113 |
-
}
|
1114 |
-
?>
|
1115 |
-
</form>
|
1116 |
-
}
|
1117 |
-
self::output_sidebar();
|
1118 |
-
}
|
1119 |
-
// Network Settings
|
1120 |
-
public static function general_settings_network()
|
1121 |
-
{
|
1122 |
-
global $GADASH_Config;
|
1123 |
-
global $wp_version;
|
1124 |
-
$tools = new GADASH_Tools();
|
1125 |
-
if (! current_user_can('manage_network_options')) {
|
1126 |
-
return;
|
1127 |
}
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
|
1152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1153 |
}
|
1154 |
-
} else {
|
1155 |
-
delete_transient('ga_dash_gapi_errors');
|
1156 |
-
}
|
1157 |
-
} catch (Google_IO_Exception $e) {
|
1158 |
-
set_transient('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e), $GADASH_GAPI->error_timeout);
|
1159 |
-
return false;
|
1160 |
-
} catch (Google_Service_Exception $e) {
|
1161 |
-
set_transient('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $GADASH_GAPI->error_timeout);
|
1162 |
-
set_transient('ga_dash_gapi_errors', $e->getErrors(), $GADASH_GAPI->error_timeout);
|
1163 |
-
return $e->getCode();
|
1164 |
-
} catch (Exception $e) {
|
1165 |
-
set_transient('ga_dash_lasterror', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode(), $GADASH_GAPI->error_timeout);
|
1166 |
-
$GADASH_GAPI->reset_token(false);
|
1167 |
}
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
$options = self::set_get_options('network');
|
1177 |
-
} else {
|
1178 |
-
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
1179 |
-
}
|
1180 |
-
}
|
1181 |
-
if ($GADASH_Config->options['ga_dash_token'] and $GADASH_GAPI->client->getAccessToken()) {
|
1182 |
-
if ($GADASH_Config->options['ga_dash_profile_list']) {
|
1183 |
-
$profiles = $GADASH_Config->options['ga_dash_profile_list'];
|
1184 |
-
} else {
|
1185 |
-
$profiles = $GADASH_GAPI->refresh_profiles();
|
1186 |
-
}
|
1187 |
-
if ($profiles) {
|
1188 |
-
$GADASH_Config->options['ga_dash_profile_list'] = $profiles;
|
1189 |
-
if (isset($GADASH_Config->options['ga_dash_tableid_jail']) and ! $GADASH_Config->options['ga_dash_tableid_jail']) {
|
1190 |
-
$profile = $tools->guess_default_domain($profiles);
|
1191 |
-
$GADASH_Config->options['ga_dash_tableid_jail'] = $profile;
|
1192 |
-
$GADASH_Config->options['ga_dash_tableid'] = $profile;
|
1193 |
}
|
1194 |
-
$
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
$options
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1235 |
<div class="wrap">
|
1236 |
<?php echo "<h2>" . __( "Google Analytics Settings", 'ga-dash' ) . "</h2>"; ?><hr>
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
<form name="ga_dash_form" method="post"
|
1255 |
-
|
1256 |
-
<input type="hidden" name="options[ga_dash_hidden]"
|
1257 |
-
value="Y">
|
1258 |
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
|
1259 |
<table class="options">
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
</label>
|
1275 |
-
</div>
|
1276 |
-
<div class="switch-desc"><?php _e ( " use a single Google Analytics account for the entire network", 'ga-dash' );?></div>
|
1277 |
-
</td>
|
1278 |
-
</tr>
|
1279 |
<?php if ($options['ga_dash_network']){ //Network Mode check?>
|
1280 |
<tr>
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
<?php
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
<tr>
|
1313 |
-
<td class="title"><label
|
1314 |
-
for="options[ga_dash_clientid]"><?php _e("Client ID:", 'ga-dash'); ?></label>
|
1315 |
-
</td>
|
1316 |
-
<td><input type="text"
|
1317 |
-
name="options[ga_dash_clientid]"
|
1318 |
-
value="<?php echo esc_attr($options['ga_dash_clientid']); ?>"
|
1319 |
-
size="40" required="required"></td>
|
1320 |
-
</tr>
|
1321 |
-
<tr>
|
1322 |
-
<td class="title"><label
|
1323 |
-
for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'ga-dash'); ?></label>
|
1324 |
-
</td>
|
1325 |
-
<td><input type="text"
|
1326 |
-
name="options[ga_dash_clientsecret]"
|
1327 |
-
value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?>"
|
1328 |
-
size="40" required="required"> <input type="hidden"
|
1329 |
-
name="options[ga_dash_hidden]" value="Y">
|
1330 |
<?php wp_nonce_field('gadash_form','gadash_security'); ?>
|
1331 |
</td>
|
1332 |
-
|
1333 |
<?php
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
if ($options['ga_dash_token']) {
|
1338 |
-
?>
|
1339 |
<tr>
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
value="<?php _e( "Refresh Properties", 'ga-dash' ); ?>" /></td>
|
1349 |
-
</tr>
|
1350 |
-
<tr>
|
1351 |
-
<td colspan="2"><hr></td>
|
1352 |
-
</tr>
|
1353 |
-
<tr>
|
1354 |
-
<td colspan="2"><?php echo "<h2>" . __( "Properties/Views Settings", 'ga-dash' ) . "</h2>"; ?></td>
|
1355 |
-
</tr>
|
1356 |
<?php
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
|
1367 |
-
<td><select id="ga_dash_tableid_network"
|
1368 |
-
<?php disabled(is_array($options['ga_dash_profile_list']),false);?>
|
1369 |
-
name="options[ga_dash_tableid_network][<?php echo $blog['blog_id'];?>]">
|
1370 |
<?php
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
<?php
|
1385 |
-
|
1386 |
-
|
1387 |
<tr>
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
<tr>
|
1429 |
-
<td colspan="2" class="submit"><input type="submit"
|
1430 |
-
name="Submit" class="button button-primary"
|
1431 |
-
value="<?php _e('Save Changes', 'ga-dash' ) ?>" /></td>
|
1432 |
-
</tr>
|
1433 |
-
} else {
|
1434 |
-
?>
|
1435 |
-
<td colspan="2"><hr></td>
|
1436 |
-
</tr>
|
1437 |
-
<tr>
|
1438 |
-
<td colspan="2"><input type="submit" name="Authorize"
|
1439 |
-
class="button button-secondary" id="authorize"
|
1440 |
-
value="<?php _e( "Authorize Plugin", 'ga-dash' ); ?>" />
|
1441 |
-
<input type="submit" name="Clear"
|
1442 |
-
class="button button-secondary"
|
1443 |
-
value="<?php _e( "Clear Cache", 'ga-dash' ); ?>" /></td>
|
1444 |
-
</tr>
|
1445 |
<?php } //Network Mode check?>
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
<?php
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
</table>
|
1457 |
-
|
1458 |
<?php
|
|
|
|
|
1459 |
}
|
1460 |
-
self::output_sidebar();
|
1461 |
-
}
|
1462 |
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
</div>
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
</div>
|
1546 |
-
</div>
|
1547 |
-
</div>
|
1548 |
-
<?php
|
1549 |
-
}
|
1550 |
}
|
6 |
* License: GPLv2 or later
|
7 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if (! defined('ABSPATH'))
|
12 |
+
exit();
|
13 |
+
|
14 |
+
final class GADWP_Settings
|
15 |
{
|
16 |
|
17 |
+
private static function update_options($who)
|
18 |
+
{
|
19 |
+
$gadwp = GADWP();
|
20 |
+
$network_settings = false;
|
21 |
+
$options = $gadwp->config->options; // Get current options
|
22 |
+
if (isset($_POST['options']['ga_dash_hidden']) && isset($_POST['options']) && (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) && $who != 'Reset') {
|
23 |
+
$new_options = $_POST['options'];
|
24 |
+
if ($who == 'tracking') {
|
25 |
+
$options['ga_dash_anonim'] = 0;
|
26 |
+
$options['ga_event_tracking'] = 0;
|
27 |
+
$options['ga_enhanced_links'] = 0;
|
28 |
+
$options['ga_dash_remarketing'] = 0;
|
29 |
+
$options['ga_dash_adsense'] = 0;
|
30 |
+
$options['ga_event_bouncerate'] = 0;
|
31 |
+
$options['ga_crossdomain_tracking'] = 0;
|
32 |
+
$options['ga_aff_tracking'] = 0;
|
33 |
+
$options['ga_hash_tracking'] = 0;
|
34 |
+
if (isset($_POST['options']['ga_tracking_code'])) {
|
35 |
+
$new_options['ga_tracking_code'] = trim($new_options['ga_tracking_code'], "\t");
|
36 |
+
}
|
37 |
+
if (empty($new_options['ga_track_exclude'])) {
|
38 |
+
$new_options['ga_track_exclude'] = array();
|
39 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
} else
|
41 |
+
if ($who == 'backend') {
|
42 |
+
$options['switch_profile'] = 0;
|
43 |
+
$options['item_reports'] = 0;
|
44 |
+
$options['dashboard_widget'] = 0;
|
45 |
+
if (empty($new_options['ga_dash_access_back'])) {
|
46 |
+
$new_options['ga_dash_access_back'][] = 'administrator';
|
47 |
+
}
|
48 |
+
} else
|
49 |
+
if ($who == 'frontend') {
|
50 |
+
$options['ga_dash_frontend_stats'] = 0;
|
51 |
+
$options['ga_dash_frontend_keywords'] = 0;
|
52 |
+
if (empty($new_options['ga_dash_access_front'])) {
|
53 |
+
$new_options['ga_dash_access_front'][] = 'administrator';
|
54 |
+
}
|
55 |
+
} else
|
56 |
+
if ($who == 'general') {
|
57 |
+
$options['ga_dash_userapi'] = 0;
|
58 |
+
if (! is_multisite()) {
|
59 |
+
$options['automatic_updates_minorversion'] = 0;
|
60 |
+
}
|
61 |
+
} else
|
62 |
+
if ($who == 'network') {
|
63 |
+
$options['ga_dash_userapi'] = 0;
|
64 |
+
$options['ga_dash_network'] = 0;
|
65 |
+
$options['ga_dash_excludesa'] = 0;
|
66 |
+
$options['automatic_updates_minorversion'] = 0;
|
67 |
+
$network_settings = true;
|
68 |
+
}
|
69 |
+
$options = array_merge($options, $new_options);
|
70 |
+
$gadwp->config->options = $options;
|
71 |
+
$gadwp->config->set_plugin_options($network_settings);
|
72 |
+
}
|
73 |
+
return $options;
|
74 |
}
|
|
|
|
|
75 |
|
76 |
+
private static function navigation_tabs($tabs)
|
77 |
+
{
|
78 |
+
echo '<div id="icon-themes" class="icon32"><br></div>';
|
79 |
+
echo '<h2 class="nav-tab-wrapper">';
|
80 |
+
foreach ($tabs as $tab => $name) {
|
81 |
+
echo "<a class='nav-tab' id='tab-$tab' href='#top#gadwp-$tab'>$name</a>";
|
82 |
+
}
|
83 |
+
echo '</h2>';
|
84 |
}
|
|
|
|
|
85 |
|
86 |
+
public static function frontend_settings()
|
87 |
+
{
|
88 |
+
$gadwp = GADWP();
|
89 |
+
if (! current_user_can('manage_options')) {
|
90 |
+
return;
|
91 |
+
}
|
92 |
+
$options = self::update_options('frontend');
|
93 |
+
if (isset($_POST['options']['ga_dash_hidden'])) {
|
94 |
+
$message = "<div class='updated'><p>" . __("Settings saved.", 'ga-dash') . "</p></div>";
|
95 |
+
if (! (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) {
|
96 |
+
$message = "<div class='error'><p>" . __("Cheating Huh?", 'ga-dash') . "</p></div>";
|
97 |
+
}
|
98 |
+
}
|
99 |
+
if (! $gadwp->config->options['ga_dash_tableid_jail'] || ! $gadwp->config->options['ga_dash_token']) {
|
100 |
+
$message = sprintf('<div class="error"><p>%s</p></div>', sprintf(__('Something went wrong, check %1$s or %2$s.', 'ga-dash'), sprintf('<a href="%1$s">%2$s</a>', menu_page_url('gadash_errors_debugging', false), __('Errors & Debug', 'ga-dash')), sprintf('<a href="%1$s">%2$s</a>', menu_page_url('gadash_settings', false), __('authorize the plugin', 'ga-dash'))));
|
101 |
+
}
|
102 |
+
?>
|
103 |
+
<form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>">
|
104 |
+
<div class="wrap">
|
|
|
105 |
<?php echo "<h2>" . __( "Google Analytics Frontend Settings", 'ga-dash' ) . "</h2>"; ?><hr>
|
106 |
+
</div>
|
107 |
+
<div id="poststuff">
|
108 |
+
<div id="post-body" class="metabox-holder columns-2">
|
109 |
+
<div id="post-body-content">
|
110 |
+
<div class="settings-wrapper">
|
111 |
+
<div class="inside">
|
112 |
<?php if (isset($message)) echo $message; ?>
|
113 |
<table class="options">
|
114 |
+
<tr>
|
115 |
+
<td colspan="2">
|
116 |
+
<?php printf(__('Read %s for more information about Frontend Features and Options.', 'ga-dash'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=frontend_screen&utm_campaign=gadwp', __('this documentation page', 'ga-dash')))?>
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
<tr>
|
120 |
+
<td colspan="2"><?php echo "<h2>" . __( "Permissions", 'ga-dash' ) . "</h2>"; ?></td>
|
121 |
+
</tr>
|
122 |
+
<tr>
|
123 |
+
<td class="roles title"><label for="ga_dash_access_front"><?php _e("Show stats to:", 'ga-dash' ); ?></label></td>
|
124 |
+
<td class="roles">
|
125 |
<?php
|
126 |
+
if (! isset($wp_roles)) {
|
127 |
+
$wp_roles = new WP_Roles();
|
128 |
+
}
|
129 |
+
$i = 0;
|
130 |
+
?>
|
131 |
+
<table>
|
132 |
+
<tr>
|
133 |
+
<?php
|
134 |
+
foreach ($wp_roles->role_names as $role => $name) {
|
135 |
+
if ($role != 'subscriber') {
|
136 |
+
$i ++;
|
137 |
+
?>
|
138 |
+
<td><label> <input type="checkbox" name="options[ga_dash_access_front][]" value="<?php echo $role; ?>" <?php if (in_array($role,$options['ga_dash_access_front']) || $role=='administrator') echo 'checked="checked"'; if ($role=='administrator') echo 'disabled="disabled"';?> /><?php echo $name; ?>
|
139 |
+
</label></td>
|
|
|
|
|
|
|
140 |
<?php
|
141 |
+
}
|
142 |
+
if ($i % 4 == 0) {
|
143 |
+
?>
|
144 |
+
</tr>
|
145 |
+
<tr>
|
146 |
+
<?php
|
147 |
+
}
|
148 |
+
}
|
149 |
?>
|
150 |
+
|
151 |
+
</table>
|
152 |
+
</td>
|
153 |
+
</tr>
|
154 |
+
<tr>
|
155 |
+
<td colspan="2" class="title">
|
156 |
+
<div class="onoffswitch">
|
157 |
+
<input type="checkbox" name="options[ga_dash_frontend_stats]" value="1" class="onoffswitch-checkbox" id="ga_dash_frontend_stats" <?php checked( $options['ga_dash_frontend_stats'], 1 ); ?>> <label class="onoffswitch-label" for="ga_dash_frontend_stats">
|
158 |
+
<div class="onoffswitch-inner"></div>
|
159 |
+
<div class="onoffswitch-switch"></div>
|
160 |
+
</label>
|
161 |
+
</div>
|
162 |
+
<div class="switch-desc"><?php echo " ".__("show page sessions and users in frontend (after each article)", 'ga-dash' );?></div>
|
163 |
+
</td>
|
164 |
+
</tr>
|
165 |
+
<tr>
|
166 |
+
<td colspan="2" class="title">
|
167 |
+
<div class="onoffswitch">
|
168 |
+
<input type="checkbox" name="options[ga_dash_frontend_keywords]" value="1" class="onoffswitch-checkbox" id="ga_dash_frontend_keywords" <?php checked( $options['ga_dash_frontend_keywords'], 1 ); ?>> <label class="onoffswitch-label" for="ga_dash_frontend_keywords">
|
169 |
+
<div class="onoffswitch-inner"></div>
|
170 |
+
<div class="onoffswitch-switch"></div>
|
171 |