WD Google Analytics - Version 1.0.8

Version Description

Added: Google Analytics reports for custom post types
Added: New icon in the menu
Added: New header on WordPress.org
Fixed: JS error on creating new pages/posts

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 WD Google Analytics
Version 1.0.8
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.8

admin/gawd_google_class.php CHANGED
@@ -207,11 +207,11 @@ class GAWD_google_client {
207
  }
208
 
209
  $web_properties = $this->analytics_member->management_webproperties->listManagementWebproperties($accountId)->getItems();
210
-
211
  foreach ($web_properties as $web_property) {
212
  if ($web_property['name'] == $name) {
213
  $profile = new Google_Service_Analytics_Profile();
214
  $profile->setName('All Web Site Data');
 
215
  try {
216
  $analytics->management_profiles->insert($accountId, $web_property['id'], $profile);
217
  } catch (apiServiceException $e) {
@@ -221,8 +221,29 @@ class GAWD_google_client {
221
  print 'There was a general API error '
222
  . $e->getCode() . ':' . $e->getMessage();
223
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
  }
 
226
  }
227
 
228
  /**
@@ -1431,7 +1452,7 @@ class GAWD_google_client {
1431
  'Avg Time On Page' => $time_on_page,
1432
  'Entrances' => intval($row[4]),
1433
  'Bounce Rate' => floatval($row[5]),
1434
- 'Exit Rate' => intval($row[6]),
1435
  'Page Value' => intval($row[7]),
1436
  'Avg Page Load Time' => intval($row[8])
1437
  );
@@ -1441,9 +1462,9 @@ class GAWD_google_client {
1441
  'No' => floatval($key + 1),
1442
  'Landing Page' => $row[0],
1443
  'Sessions' => intval($row[1]),
1444
- 'Percent New Sessions' => intval($row[2]),
1445
  'New Users' => intval($row[3]),
1446
- 'Bounce Rate' => intval($row[4]),
1447
  'Pageviews Per Session' => floatval($row[5]),
1448
  'Avg Session Duration' => intval($row[6]),
1449
  'Transactions' => intval($row[7]),
207
  }
208
 
209
  $web_properties = $this->analytics_member->management_webproperties->listManagementWebproperties($accountId)->getItems();
 
210
  foreach ($web_properties as $web_property) {
211
  if ($web_property['name'] == $name) {
212
  $profile = new Google_Service_Analytics_Profile();
213
  $profile->setName('All Web Site Data');
214
+
215
  try {
216
  $analytics->management_profiles->insert($accountId, $web_property['id'], $profile);
217
  } catch (apiServiceException $e) {
221
  print 'There was a general API error '
222
  . $e->getCode() . ':' . $e->getMessage();
223
  }
224
+ $current_profiles = $this->analytics_member->management_profiles->listManagementProfiles($accountId,$web_property['id'])->getItems();
225
+ try {
226
+ $property = new Google_Service_Analytics_Webproperty();
227
+ $property->setName($name);
228
+ $property->setWebsiteUrl($websiteUrl);
229
+ $property->setDefaultProfileId($current_profiles[0]['id']);
230
+ $analytics->management_webproperties->update($accountId, $web_property['id'], $property);
231
+ } catch (apiServiceException $e) {
232
+ print 'There was an Analytics API service error '
233
+ . $e->getCode() . ':' . $e->getMessage();
234
+ } catch (apiException $e) {
235
+ print 'There was a general API error '
236
+ . $e->getCode() . ':' . $e->getMessage();
237
+ }
238
+ catch (Google_Service_Exception $e) {
239
+ return 'There was a general API error '
240
+ . $e->getCode() . ':' . $e->getMessage();
241
+ }catch (Exception $e) {
242
+ echo $e->getCode() . ':' . $e->getMessage();
243
+ }
244
  }
245
  }
246
+
247
  }
248
 
249
  /**
1452
  'Avg Time On Page' => $time_on_page,
1453
  'Entrances' => intval($row[4]),
1454
  'Bounce Rate' => floatval($row[5]),
1455
+ 'Exit Rate' => ($row[6]),
1456
  'Page Value' => intval($row[7]),
1457
  'Avg Page Load Time' => intval($row[8])
1458
  );
1462
  'No' => floatval($key + 1),
1463
  'Landing Page' => $row[0],
1464
  'Sessions' => intval($row[1]),
1465
+ 'Percent New Sessions' => ($row[2]),
1466
  'New Users' => intval($row[3]),
1467
+ 'Bounce Rate' => ($row[4]),
1468
  'Pageviews Per Session' => floatval($row[5]),
1469
  'Avg Session Duration' => intval($row[6]),
1470
  'Transactions' => intval($row[7]),
admin/pages/dashboard.php CHANGED
@@ -672,4 +672,19 @@ if($current_user != 1 && isset($saved_user_menues[$current_user])){
672
  <input id="first_data_sum" class="" type="hidden" value="">
673
  <input id="second_data_sum" class="" type="hidden" value="">
674
  <input id="second_start_date" class="" type="hidden" value="">
675
- <input id="second_end_date" class="" type="hidden" value="">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
672
  <input id="first_data_sum" class="" type="hidden" value="">
673
  <input id="second_data_sum" class="" type="hidden" value="">
674
  <input id="second_start_date" class="" type="hidden" value="">
675
+ <input id="second_end_date" class="" type="hidden" value="">
676
+ <div class="gawd_pro_popup_overlay">
677
+ </div>
678
+ <div class="gawd_pro_popup">
679
+ <div class="close_btn_cont">
680
+ <div href="#" class="gawd_pro_popup_btn"></div>
681
+ </div>
682
+ <h3>Hi There!</h3>
683
+ <div class="img_wrap">
684
+ <img src="<?php echo GAWD_URL . '/assets/Report_icon.png';?>"/>
685
+ </div>
686
+ <div class="gawd_pro_text">These reports are available in the pro version.</div>
687
+ <div style="font-size:16px;margin-bottom:20px">Check out our Demo to see these amazing reports in action. </div>
688
+ <span style="display: inline-block; margin-right: 15px;"><a id="gawd_buy_now" class="gawd_pro_buttons" target="_blank" href="https://web-dorado.com/products/wordpress-google-analytics-plugin.html">Buy Now</a></span>
689
+ <span style="display: inline-block;"><a id="gawd_try_demo" class="gawd_pro_buttons" target="_blank" href="http://wpdemo.web-dorado.com/wp-admin/admin.php?page=gawd_reports">Try Demo</a></span>
690
+ </div>
admin/pages/dashboard_menu.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
 
2
  function gawd_write_menu($tabs, $title = true){
 
3
  $sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
4
  foreach ($tabs as $tab_key => $tab_data){
5
  if(!$title){
@@ -8,73 +10,93 @@ function gawd_write_menu($tabs, $title = true){
8
  }
9
  if($tab_data["childs"] == array()){
10
  $active_tab = $_GET['tab'] == $tab_key ? 'gawd_active_li' : '';
11
- if($tab_key == 'customReport'){
12
- echo ' <li class="gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'">
13
- <a class="gawd_menu_item gawd_pro_menu" href="#">'.$tab_data["title"].'
14
- <span class="gawd_pro_flag">Paid</span>
15
- </a>
16
- </li><span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>';
17
- }
18
- elseif($tab_key == 'custom'){
19
- echo ' <li class="gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'" >
20
- <a class="gawd_menu_item gawd_pro_menu" href="#">'.$tab_data["title"].'
21
- <span class="gawd_pro_flag">Paid</span>
22
- </a>
23
- <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
24
  </li>';
25
- }
26
- elseif($tab_key == 'adsense' || $tab_key == 'adWords'){
27
- echo ' <li class="gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'" >
28
- <a class="gawd_pro_menu gawd_menu_item " href="#">'.$tab_data["title"].
29
- '<span class="gawd_pro_flag">Paid</span>
30
- </a>
31
- <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
32
  </li>';
 
33
  }
34
  else{
35
- echo ' <li class="gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'" >
36
- <a class="gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$tab_key.'">'.$tab_data["title"].'</a>
37
- <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
38
- </li>';
39
- }
40
- }
41
- else{
42
- if($tab_key == 'customReport'){
43
- echo ' <li class="gawd_menu_li " id="gawd_'.$tab_key.'_li">
44
- <span id="gawd_'.$tab_key.'s" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
45
  </span>
46
  <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
47
- <ul id="gawd_'.$tab_key.'_ul">';
 
 
 
 
 
 
 
 
 
 
48
  }
49
- elseif($tab_key == 'ecommerce'){
50
- echo ' <li class="gawd_menu_li " id="gawd_'.$tab_key.'_li" >
51
- <span id="gawd_'.$tab_key.'" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
52
- <span class="gawd_pro_flag">Paid</span>
53
- </span>
54
- <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
55
- <ul id="gawd_'.$tab_key.'_ul">';
 
56
  }
57
  else{
58
- echo ' <li class="gawd_menu_li " id="gawd_'.$tab_key.'_li" >
59
- <span id="gawd_'.$tab_key.'" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
60
- </span>
61
- <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
62
- <ul id="gawd_'.$tab_key.'_ul">';
 
 
 
 
 
 
 
 
 
 
63
  }
 
64
  foreach($tab_data["childs"] as $child_key => $child_title) {
65
  if(!$title){
66
  $child_title = "";
67
  }
68
  $active_tab = $_GET['tab'] == $child_key ? 'gawd_active_li' : '';
69
- if($child_key == 'productCategory' || $child_key == 'productName' || $child_key == 'productSku' || $child_key == 'transactionId' || $child_key == 'sales_performance' || $child_key == 'daysToTransaction'){
70
- echo ' <li class="gawd_menu_ul_li '.$active_tab.'">
71
- <a class="gawd_menu_item " href="#">'.$child_title.'</a>
72
- </li> ';
73
  }
74
  else{
75
- echo ' <li class="gawd_menu_ul_li '.$active_tab.'">
76
- <a class="gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$child_key.'">'.$child_title.'</a>
77
- </li> ';
 
 
 
 
 
 
 
78
  }
79
  }
80
  echo '</ul>
@@ -83,6 +105,8 @@ function gawd_write_menu($tabs, $title = true){
83
  }
84
  }
85
  function gawd_write_menu_collapse($tabs, $title = true){
 
 
86
  $sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
87
  foreach ($tabs as $tab_key => $tab_data){
88
  if(!$title){
@@ -91,15 +115,26 @@ function gawd_write_menu_collapse($tabs, $title = true){
91
  }
92
  if($tab_data["childs"] == array()){
93
  $active_tab = $_GET['tab'] == $tab_key ? 'gawd_active_li' : '';
94
- if($tab_key == 'customReport'){
95
- echo '<a id="gawd_'.$tab_key.'" class="'.$active_tab.' gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_custom_reports">'.$tab_data["title"].'</a>';
 
 
 
 
 
96
  }
97
  else{
98
- echo '<a id="gawd_'.$tab_key.'" class="'.$active_tab.' gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$tab_key.'">'.$tab_data["title"].'</a>';
 
 
 
 
 
99
  }
 
100
  }
101
  else{
102
- if($tab_key == 'customReport'){
103
  echo '<span id="gawd_'.$tab_key.'_li" id="gawd_'.$tab_key.'s" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
104
  <div class="collapse_ul" id="gawd_'.$tab_key.'_ul">';
105
  }
@@ -109,7 +144,18 @@ function gawd_write_menu_collapse($tabs, $title = true){
109
  }
110
  foreach($tab_data["childs"] as $child_key => $child_title) {
111
  $active_tab = $_GET['tab'] == $child_key ? 'gawd_active_li_text' : '';
112
- echo '<a class="'.$active_tab.' gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$child_key.'">'.$child_title.'</a>';
 
 
 
 
 
 
 
 
 
 
 
113
  }
114
  echo '</div></span>';
115
  }
@@ -129,7 +175,7 @@ function gawd_write_menu_collapse($tabs, $title = true){
129
  </div>
130
  <div class="gawd_menu_coteiner">
131
  <input style="width: 100%; margin-bottom: 5px;" onkeyup="gawd_search()" type="text" class='gawd_search_input'/>
132
- <ul class="gawd_menu_ul">
133
  <?php
134
 
135
  gawd_write_menu($tabs);
1
  <?php
2
+
3
  function gawd_write_menu($tabs, $title = true){
4
+ $gawd_settings = get_option('gawd_settings');
5
  $sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
6
  foreach ($tabs as $tab_key => $tab_data){
7
  if(!$title){
10
  }
11
  if($tab_data["childs"] == array()){
12
  $active_tab = $_GET['tab'] == $tab_key ? 'gawd_active_li' : '';
13
+
14
+ if(isset($gawd_settings['show_report_page']) && $gawd_settings['show_report_page'] == 'off'){
15
+ if($tab_key == 'general' || $tab_key == 'realtime'){
16
+ echo ' <li class=" gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'" >
17
+ <a class="gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$tab_key.'">'.$tab_data["title"].'</a>
18
+ <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
19
+ </li>';
20
+ }
21
+ elseif($tab_key == 'Pro'){
22
+ echo ' <li class="gawd_inactive_pro gawd_menu_li '.$active_tab.' " id="gawd_'.$tab_key.'">
23
+ <span class="gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'</span>
 
 
24
  </li>';
25
+ }
26
+ else{
27
+ echo ' <li class="gawd_inactive gawd_menu_li '.$active_tab.' " id="gawd_'.$tab_key.'">
28
+ <span class=" gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'
29
+ </span><span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
 
 
30
  </li>';
31
+ }
32
  }
33
  else{
34
+ if($tab_key == 'customReport' || $tab_key == 'custom' || $tab_key == 'adsense' || $tab_key == 'adWords'){
35
+ echo ' <li class="gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'">
36
+ <span class="gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'
37
+ <span class="gawd_pro_flag">Paid</span>
 
 
 
 
 
 
38
  </span>
39
  <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
40
+ </li>';
41
+ }
42
+ elseif($tab_key == 'Pro'){
43
+ continue;
44
+ }
45
+ else{
46
+ echo ' <li class="gawd_menu_li '.$active_tab.'" id="gawd_'.$tab_key.'" >
47
+ <a class="gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$tab_key.'">'.$tab_data["title"].'</a>
48
+ <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
49
+ </li>';
50
+ }
51
  }
52
+ }
53
+ else{
54
+ if(isset($gawd_settings['show_report_page']) && $gawd_settings['show_report_page'] == 'off'){
55
+ echo ' <li class="gawd_inactive gawd_menu_li " id="gawd_'.$tab_key.'_li">
56
+ <span id="gawd_'.$tab_key.'s" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
57
+ </span>
58
+ <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
59
+ <ul id="gawd_'.$tab_key.'_ul">';
60
  }
61
  else{
62
+ if($tab_key == 'customReport' || $tab_key == 'ecommerce'){
63
+ echo ' <li class="gawd_menu_li " id="gawd_'.$tab_key.'_li">
64
+ <span id="gawd_'.$tab_key.'s" class="gawd_pro_menu gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
65
+ <span class="gawd_pro_flag">Paid</span>
66
+ </span>
67
+ <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
68
+ <ul id="gawd_'.$tab_key.'_ul">';
69
+ }
70
+ else{
71
+ echo ' <li class="gawd_menu_li " id="gawd_'.$tab_key.'_li" >
72
+ <span id="gawd_'.$tab_key.'" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
73
+ </span>
74
+ <span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
75
+ <ul id="gawd_'.$tab_key.'_ul">';
76
+ }
77
  }
78
+
79
  foreach($tab_data["childs"] as $child_key => $child_title) {
80
  if(!$title){
81
  $child_title = "";
82
  }
83
  $active_tab = $_GET['tab'] == $child_key ? 'gawd_active_li' : '';
84
+ if(isset($gawd_settings['show_report_page']) && $gawd_settings['show_report_page'] == 'off'){
85
+ echo ' <li class=" gawd_menu_ul_li '.$active_tab.'">
86
+ <span class="gawd_menu_item " >'.$child_title.'</span>
87
+ </li> ';
88
  }
89
  else{
90
+ if($child_key == 'productCategory' || $child_key == 'productName' || $child_key == 'productSku' || $child_key == 'transactionId' || $child_key == 'sales_performance' || $child_key == 'daysToTransaction'){
91
+ echo ' <li class="gawd_menu_ul_li '.$active_tab.'">
92
+ <span class="gawd_menu_item " >'.$child_title.'</span>
93
+ </li> ';
94
+ }
95
+ else{
96
+ echo ' <li class="gawd_menu_ul_li '.$active_tab.'">
97
+ <a class="gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$child_key.'">'.$child_title.'</a>
98
+ </li> ';
99
+ }
100
  }
101
  }
102
  echo '</ul>
105
  }
106
  }
107
  function gawd_write_menu_collapse($tabs, $title = true){
108
+ $gawd_settings = get_option('gawd_settings');
109
+
110
  $sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
111
  foreach ($tabs as $tab_key => $tab_data){
112
  if(!$title){
115
  }
116
  if($tab_data["childs"] == array()){
117
  $active_tab = $_GET['tab'] == $tab_key ? 'gawd_active_li' : '';
118
+ if(isset($gawd_settings['show_report_page']) && $gawd_settings['show_report_page'] == 'off'){
119
+ if($tab_key == 'general' || $tab_key == 'realtime'){
120
+ echo '<a id="gawd_'.$tab_key.'" class="'.$active_tab.' gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$tab_key.'">'.$tab_data["title"].'</a>';
121
+ }
122
+ else{
123
+ echo '<span id="gawd_'.$tab_key.'" class="'.$active_tab.' gawd_menu_item " >'.$tab_data["title"].'</span>';
124
+ }
125
  }
126
  else{
127
+ if($tab_key == 'customReport' || $tab_key == 'custom' || $tab_key == 'adsense' || $tab_key == 'adWords'){
128
+ echo '<span id="gawd_'.$tab_key.'" class="'.$active_tab.' gawd_menu_item " >'.$tab_data["title"].'</span>';
129
+ }
130
+ else{
131
+ echo '<a id="gawd_'.$tab_key.'" class="'.$active_tab.' gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$tab_key.'">'.$tab_data["title"].'</a>';
132
+ }
133
  }
134
+
135
  }
136
  else{
137
+ if($tab_key == 'customReport' || $tab_key == 'ecommerce'){
138
  echo '<span id="gawd_'.$tab_key.'_li" id="gawd_'.$tab_key.'s" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
139
  <div class="collapse_ul" id="gawd_'.$tab_key.'_ul">';
140
  }
144
  }
145
  foreach($tab_data["childs"] as $child_key => $child_title) {
146
  $active_tab = $_GET['tab'] == $child_key ? 'gawd_active_li_text' : '';
147
+ if(isset($gawd_settings['show_report_page']) && $gawd_settings['show_report_page'] == 'off'){
148
+ if($child_key == 'productCategory' || $child_key == 'productName' || $child_key == 'productSku' || $child_key == 'transactionId' || $child_key == 'sales_performance' || $child_key == 'daysToTransaction'){
149
+ echo '<span class="'.$active_tab.' gawd_menu_item " >'.$child_title.'</span>';
150
+ }
151
+ else{
152
+ echo '<a class="'.$active_tab.' gawd_menu_item " href="'.admin_url().'admin.php?page=gawd_reports&tab='.$child_key.'">'.$child_title.'</a>';
153
+ }
154
+ }
155
+ else{
156
+ echo '<span class="'.$active_tab.' gawd_menu_item " >'.$child_title.'</span>';
157
+ }
158
+
159
  }
160
  echo '</div></span>';
161
  }
175
  </div>
176
  <div class="gawd_menu_coteiner">
177
  <input style="width: 100%; margin-bottom: 5px;" onkeyup="gawd_search()" type="text" class='gawd_search_input'/>
178
+ <ul class="gawd_menu_ul" >
179
  <?php
180
 
181
  gawd_write_menu($tabs);
assets/Report_icon.png ADDED
Binary file
assets/bg.png ADDED
Binary file
assets/close.png ADDED
Binary file
assets/freePages/reports.png ADDED
Binary file
assets/main_icon.png CHANGED
Binary file
featured/featured.php CHANGED
@@ -1,171 +1,171 @@
1
- <?php
2
- function gawd_featured_plugins($current_plugin = '') {
3
- $plugins = array(
4
- "form-maker" => array(
5
- 'title' => 'Form Maker',
6
- 'text' => 'Wordpress form builder plugin',
7
- 'content' => 'Form Maker is a modern and advanced tool for creating WordPress forms easily and fast.',
8
- 'href' => 'https://web-dorado.com/products/wordpress-form.html'
9
- ),
10
- "photo-gallery" => array(
11
- 'title' => 'Photo Gallery',
12
- 'text' => 'WordPress Photo Gallery plugin',
13
- 'content' => 'Photo Gallery is a fully responsive WordPress Gallery plugin with advanced functionality.',
14
- 'href' => 'https://web-dorado.com/products/wordpress-photo-gallery-plugin.html'
15
- ),
16
- "contact_form_bulder" => array(
17
- 'title' => 'Contact Form Builder',
18
- 'text' => 'WordPress contact form builder plugin',
19
- 'content' => 'Contact Form Builder is the best tool for quickly arranging a contact form for your clients and visitors.',
20
- 'href' => 'https://web-dorado.com/products/wordpress-contact-form-builder.html'
21
- ),
22
- "slider_wd" => array(
23
- 'title' => 'Slider WD',
24
- 'text' => 'WordPress slider plugin',
25
- 'content' => 'Create responsive, highly configurable sliders with various effects for your WordPress site.',
26
- 'href' => 'https://web-dorado.com/products/wordpress-slider-plugin.html'
27
- ),
28
- "events-wd" => array(
29
- 'title' => 'Event Calendar WD',
30
- 'text' => 'WordPress calendar plugin',
31
- 'content' => 'Organize and publish your events in an easy and elegant way using Event Calendar WD.',
32
- 'href' => 'https://web-dorado.com/products/wordpress-event-calendar-wd.html'
33
- ),
34
- "contact-maker" => array(
35
- 'title' => 'Contact Form Maker',
36
- 'text' => 'WordPress contact form maker plugin',
37
- 'content' => 'WordPress Contact Form Maker is an advanced and easy-to-use tool for creating forms.',
38
- 'href' => 'https://web-dorado.com/products/wordpress-contact-form-maker-plugin.html'
39
- ),
40
- "spider-calendar" => array(
41
- 'title' => 'Spider Calendar',
42
- 'text' => 'WordPress event calendar plugin',
43
- 'content' => 'Spider Event Calendar is a highly configurable product which allows you to have multiple organized events.',
44
- 'href' => 'https://web-dorado.com/products/wordpress-calendar.html'
45
- ),
46
- "catalog" => array(
47
- 'title' => 'Spider Catalog',
48
- 'text' => 'WordPress product catalog plugin',
49
- 'content' => 'Spider Catalog for WordPress is a convenient tool for organizing the products represented on your website into catalogs.',
50
- 'href' => 'https://web-dorado.com/products/wordpress-catalog.html'
51
- ),
52
- "player" => array(
53
- 'title' => 'Video Player',
54
- 'text' => 'WordPress Video player plugin',
55
- 'content' => 'Spider Video Player for WordPress is a Flash & HTML5 video player plugin that allows you to easily add videos to your website with the possibility.',
56
- 'href' => 'https://web-dorado.com/products/wordpress-player.html'
57
- ),
58
- "contacts" => array(
59
- 'title' => 'Spider Contacts',
60
- 'text' => 'Wordpress staff list plugin',
61
- 'content' => 'Spider Contacts helps you to display information about the group of people more intelligible, effective and convenient.',
62
- 'href' => 'https://web-dorado.com/products/wordpress-contacts-plugin.html'
63
- ),
64
- "facebook" => array(
65
- 'title' => 'Spider Facebook',
66
- 'text' => 'WordPress Facebook plugin',
67
- 'content' => 'Spider Facebook is a WordPress integration tool for Facebook.It includes all the available Facebook social plugins and widgets.',
68
- 'href' => 'https://web-dorado.com/products/wordpress-facebook.html'
69
- ),
70
- "twitter-widget" => array(
71
- 'title' => 'Widget Twitter',
72
- 'text' => 'WordPress Widget Twitter plugin',
73
- 'content' => 'The Widget Twitter plugin lets you to fully integrate your WordPress site with your Twitter account.',
74
- 'href' => 'https://web-dorado.com/products/wordpress-twitter-integration-plugin.html'
75
- ),
76
- "faq" => array(
77
- 'title' => 'Spider FAQ',
78
- 'text' => 'WordPress FAQ Plugin',
79
- 'content' => 'The Spider FAQ WordPress plugin is for creating an FAQ (Frequently Asked Questions) section for your website.',
80
- 'href' => 'https://web-dorado.com/products/wordpress-faq-plugin.html'
81
- ),
82
- "zoom" => array(
83
- 'title' => 'Zoom',
84
- 'text' => 'WordPress text zoom plugin',
85
- 'content' => 'Zoom enables site users to resize the predefined areas of the web site.',
86
- 'href' => 'https://web-dorado.com/products/wordpress-zoom.html'
87
- ),
88
- "flash-calendar" => array(
89
- 'title' => 'Flash Calendar',
90
- 'text' => 'WordPress flash calendar plugin',
91
- 'content' => 'Spider Flash Calendar is a highly configurable Flash calendar plugin which allows you to have multiple organized events.',
92
- 'href' => 'https://web-dorado.com/products/wordpress-events-calendar.html'
93
- ),
94
- "folder_menu" => array(
95
- 'title' => 'Folder Menu',
96
- 'text' => 'WordPress folder menu plugin',
97
- 'content' => 'Folder Menu Vertical is a WordPress Flash menu module for your website, designed to meet your needs and preferences.',
98
- 'href' => 'https://web-dorado.com/products/wordpress-menu-vertical.html'
99
- ),
100
- "random_post" => array(
101
- 'title' => 'Random post',
102
- 'text' => 'WordPress random post plugin',
103
- 'content' => 'Spider Random Post is a small but very smart solution for your WordPress web site.',
104
- 'href' => 'https://web-dorado.com/products/wordpress-random-post.html'
105
- ),
106
- "faq_wd" => array(
107
- 'title' => 'FAQ WD',
108
- 'text' => 'WordPress FAQ plugin',
109
- 'content' => 'Organize and publish your FAQs in an easy and elegant way using FAQ WD.',
110
- 'href' => 'https://web-dorado.com/products/wordpress-faq-wd.html'
111
- ),
112
- "instagram_feed" => array(
113
- 'title' => 'Instagram Feed WD',
114
- 'text' => 'WordPress Instagram Feed plugin',
115
- 'content' => 'WD Instagram Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website.',
116
- 'href' => 'https://web-dorado.com/products/wordpress-instagram-feed-wd.html'
117
- ),
118
- "post-slider" => array(
119
- 'title' => 'Post Slider',
120
- 'text' => 'WordPress Post Slider plugin',
121
- 'content' => 'Post Slider WD is designed to show off the selected posts of your website in a slider.',
122
- 'href' => 'https://web-dorado.com/products/wordpress-post-slider-plugin.html'
123
- ),
124
- "google-maps" => array(
125
- 'title' => 'Google Map',
126
- 'text' => 'WordPress Google Maps Plugin',
127
- 'content' => 'Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.',
128
- 'href' => 'https://web-dorado.com/products/wordpress-google-maps-plugin.html'
129
- ),
130
- "wd-google-analytics" => array(
131
- 'title' => 'Wd Google Analytics',
132
- 'text' => 'WordPress Google Analytics Plugin',
133
- 'content' => 'WD Google Analytics is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.',
134
- 'href' => 'https://web-dorado.com/products/wordpress-google-analytics-plugin.html'
135
- )
136
- );
137
- ?>
138
- <div id="main_featured_plugins_page">
139
- <h3>Featured Plugins</h3>
140
- <div class="featured_header">
141
- <a target="_blank" href="https://web-dorado.com/wordpress-plugins.html?source=<?php echo $current_plugin; ?>">
142
- <h1>GET <?php echo $plugins[$current_plugin]["title"]; ?> +23 PLUGINS</h1>
143
- <h1 class="get_plugins">FOR $100 ONLY <span>- SAVE 70%</span></h1>
144
- <div class="try-now">
145
- <span>TRY NOW</span>
146
- </div>
147
- </a>
148
- </div>
149
- <ul id="featured-plugins-list">
150
- <?php
151
- foreach ($plugins as $key => $plugins) {
152
- if ($current_plugin != $key) {
153
- ?>
154
- <li class="<?php echo $key; ?>">
155
- <div class="product"></div>
156
- <div class="title">
157
- <strong class="heading"><?php echo $plugins['title']; ?></strong>
158
- </div>
159
- <div class="description">
160
- <p><?php echo $plugins['content']; ?></p>
161
- </div>
162
- <a target="_blank" href="<?php echo $plugins['href']; ?>?source=<?php echo $current_plugin; ?>" class="download">Download Plugin &#9658;</a>
163
- </li>
164
- <?php
165
- }
166
- }
167
- ?>
168
- </ul>
169
- </div>
170
- <?php
171
  }
1
+ <?php
2
+ function gawd_featured_plugins($current_plugin = '') {
3
+ $plugins = array(
4
+ "form-maker" => array(
5
+ 'title' => 'Form Maker',
6
+ 'text' => 'Wordpress form builder plugin',
7
+ 'content' => 'Form Maker is a modern and advanced tool for creating WordPress forms easily and fast.',
8
+ 'href' => 'https://web-dorado.com/products/wordpress-form.html'
9
+ ),
10
+ "photo-gallery" => array(
11
+ 'title' => 'Photo Gallery',
12
+ 'text' => 'WordPress Photo Gallery plugin',
13
+ 'content' => 'Photo Gallery is a fully responsive WordPress Gallery plugin with advanced functionality.',
14
+ 'href' => 'https://web-dorado.com/products/wordpress-photo-gallery-plugin.html'
15
+ ),
16
+ "contact_form_bulder" => array(
17
+ 'title' => 'Contact Form Builder',
18
+ 'text' => 'WordPress contact form builder plugin',
19
+ 'content' => 'Contact Form Builder is the best tool for quickly arranging a contact form for your clients and visitors.',
20
+ 'href' => 'https://web-dorado.com/products/wordpress-contact-form-builder.html'
21
+ ),
22
+ "slider_wd" => array(
23
+ 'title' => 'Slider WD',
24
+ 'text' => 'WordPress slider plugin',
25
+ 'content' => 'Create responsive, highly configurable sliders with various effects for your WordPress site.',
26
+ 'href' => 'https://web-dorado.com/products/wordpress-slider-plugin.html'
27
+ ),
28
+ "events-wd" => array(
29
+ 'title' => 'Event Calendar WD',
30
+ 'text' => 'WordPress calendar plugin',
31
+ 'content' => 'Organize and publish your events in an easy and elegant way using Event Calendar WD.',
32
+ 'href' => 'https://web-dorado.com/products/wordpress-event-calendar-wd.html'
33
+ ),
34
+ "contact-maker" => array(
35
+ 'title' => 'Contact Form Maker',
36
+ 'text' => 'WordPress contact form maker plugin',
37
+ 'content' => 'WordPress Contact Form Maker is an advanced and easy-to-use tool for creating forms.',
38
+ 'href' => 'https://web-dorado.com/products/wordpress-contact-form-maker-plugin.html'
39
+ ),
40
+ "spider-calendar" => array(
41
+ 'title' => 'Spider Calendar',
42
+ 'text' => 'WordPress event calendar plugin',
43
+ 'content' => 'Spider Event Calendar is a highly configurable product which allows you to have multiple organized events.',
44
+ 'href' => 'https://web-dorado.com/products/wordpress-calendar.html'
45
+ ),
46
+ "catalog" => array(
47
+ 'title' => 'Spider Catalog',
48
+ 'text' => 'WordPress product catalog plugin',
49
+ 'content' => 'Spider Catalog for WordPress is a convenient tool for organizing the products represented on your website into catalogs.',
50
+ 'href' => 'https://web-dorado.com/products/wordpress-catalog.html'
51
+ ),
52
+ "player" => array(
53
+ 'title' => 'Video Player',
54
+ 'text' => 'WordPress Video player plugin',
55
+ 'content' => 'Spider Video Player for WordPress is a Flash & HTML5 video player plugin that allows you to easily add videos to your website with the possibility.',
56
+ 'href' => 'https://web-dorado.com/products/wordpress-player.html'
57
+ ),
58
+ "contacts" => array(
59
+ 'title' => 'Spider Contacts',
60
+ 'text' => 'Wordpress staff list plugin',
61
+ 'content' => 'Spider Contacts helps you to display information about the group of people more intelligible, effective and convenient.',
62
+ 'href' => 'https://web-dorado.com/products/wordpress-contacts-plugin.html'
63
+ ),
64
+ "facebook" => array(
65
+ 'title' => 'Spider Facebook',
66
+ 'text' => 'WordPress Facebook plugin',
67
+ 'content' => 'Spider Facebook is a WordPress integration tool for Facebook.It includes all the available Facebook social plugins and widgets.',
68
+ 'href' => 'https://web-dorado.com/products/wordpress-facebook.html'
69
+ ),
70
+ "twitter-widget" => array(
71
+ 'title' => 'Widget Twitter',
72
+ 'text' => 'WordPress Widget Twitter plugin',
73
+ 'content' => 'The Widget Twitter plugin lets you to fully integrate your WordPress site with your Twitter account.',
74
+ 'href' => 'https://web-dorado.com/products/wordpress-twitter-integration-plugin.html'
75
+ ),
76
+ "faq" => array(
77
+ 'title' => 'Spider FAQ',
78
+ 'text' => 'WordPress FAQ Plugin',
79
+ 'content' => 'The Spider FAQ WordPress plugin is for creating an FAQ (Frequently Asked Questions) section for your website.',
80
+ 'href' => 'https://web-dorado.com/products/wordpress-faq-plugin.html'
81
+ ),
82
+ "zoom" => array(
83
+ 'title' => 'Zoom',
84
+ 'text' => 'WordPress text zoom plugin',
85
+ 'content' => 'Zoom enables site users to resize the predefined areas of the web site.',
86
+ 'href' => 'https://web-dorado.com/products/wordpress-zoom.html'
87
+ ),
88
+ "flash-calendar" => array(
89
+ 'title' => 'Flash Calendar',
90
+ 'text' => 'WordPress flash calendar plugin',
91
+ 'content' => 'Spider Flash Calendar is a highly configurable Flash calendar plugin which allows you to have multiple organized events.',
92
+ 'href' => 'https://web-dorado.com/products/wordpress-events-calendar.html'
93
+ ),
94
+ "folder_menu" => array(
95
+ 'title' => 'Folder Menu',
96
+ 'text' => 'WordPress folder menu plugin',
97
+ 'content' => 'Folder Menu Vertical is a WordPress Flash menu module for your website, designed to meet your needs and preferences.',
98
+ 'href' => 'https://web-dorado.com/products/wordpress-menu-vertical.html'
99
+ ),
100
+ "random_post" => array(
101
+ 'title' => 'Random post',
102
+ 'text' => 'WordPress random post plugin',
103
+ 'content' => 'Spider Random Post is a small but very smart solution for your WordPress web site.',
104
+ 'href' => 'https://web-dorado.com/products/wordpress-random-post.html'
105
+ ),
106
+ "faq_wd" => array(
107
+ 'title' => 'FAQ WD',
108
+ 'text' => 'WordPress FAQ plugin',
109
+ 'content' => 'Organize and publish your FAQs in an easy and elegant way using FAQ WD.',
110
+ 'href' => 'https://web-dorado.com/products/wordpress-faq-wd.html'
111
+ ),
112
+ "instagram_feed" => array(
113
+ 'title' => 'Instagram Feed WD',
114
+ 'text' => 'WordPress Instagram Feed plugin',
115
+ 'content' => 'WD Instagram Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website.',
116
+ 'href' => 'https://web-dorado.com/products/wordpress-instagram-feed-wd.html'
117
+ ),
118
+ "post-slider" => array(
119
+ 'title' => 'Post Slider',
120
+ 'text' => 'WordPress Post Slider plugin',
121
+ 'content' => 'Post Slider WD is designed to show off the selected posts of your website in a slider.',
122
+ 'href' => 'https://web-dorado.com/products/wordpress-post-slider-plugin.html'
123
+ ),
124
+ "google-maps" => array(
125
+ 'title' => 'Google Map',
126
+ 'text' => 'WordPress Google Maps Plugin',
127
+ 'content' => 'Google Maps WD is an intuitive tool for creating Google maps with advanced markers, custom layers and overlays for your website.',
128
+ 'href' => 'https://web-dorado.com/products/wordpress-google-maps-plugin.html'
129
+ ),
130
+ "wd-google-analytics" => array(
131
+ 'title' => 'Wd Google Analytics',
132
+ 'text' => 'WordPress Google Analytics Plugin',
133
+ 'content' => 'WD Google Analytics is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.',
134
+ 'href' => 'https://web-dorado.com/products/wordpress-google-analytics-plugin.html'
135
+ )
136
+ );
137
+ ?>
138
+ <div id="main_featured_plugins_page">
139
+ <h3>Featured Plugins</h3>
140
+ <div class="featured_header">
141
+ <a target="_blank" href="https://web-dorado.com/wordpress-plugins-bundle.html?source=<?php echo $current_plugin; ?>">
142
+ <h1>GET <?php echo $plugins[$current_plugin]["title"]; ?> +23 PLUGINS</h1>
143
+ <h1 class="get_plugins">FOR $100 ONLY <span>- SAVE 70%</span></h1>
144
+ <div class="try-now">
145
+ <span>TRY NOW</span>
146
+ </div>
147
+ </a>
148
+ </div>
149
+ <ul id="featured-plugins-list">
150
+ <?php
151
+ foreach ($plugins as $key => $plugins) {
152
+ if ($current_plugin != $key) {
153
+ ?>
154
+ <li class="<?php echo $key; ?>">
155
+ <div class="product"></div>
156
+ <div class="title">
157
+ <strong class="heading"><?php echo $plugins['title']; ?></strong>
158
+ </div>
159
+ <div class="description">
160
+ <p><?php echo $plugins['content']; ?></p>
161
+ </div>
162
+ <a target="_blank" href="<?php echo $plugins['href']; ?>?source=<?php echo $current_plugin; ?>" class="download">Download Plugin &#9658;</a>
163
+ </li>
164
+ <?php
165
+ }
166
+ }
167
+ ?>
168
+ </ul>
169
+ </div>
170
+ <?php
171
  }
featured/featured_themes.php CHANGED
@@ -1,302 +1,302 @@
1
- <?php
2
-
3
- class gawd_featured_themes {
4
-
5
-
6
- private $slug = 'wd-google-analytics';
7
- private $lang_slug = 'gawd';
8
-
9
- private $image_url = '';
10
- private $demo_url = 'http://themedemo.web-dorado.com/';
11
- private $site_url = 'https://web-dorado.com/wordpress-themes/';
12
-
13
- public function __construct() {
14
- $this->image_url = GAWD_URL . "/featured/images/";
15
-
16
- }
17
-
18
- ////////////////////////////////////////////////////////////////////////////////////////
19
- // Public Methods //
20
- ////////////////////////////////////////////////////////////////////////////////////////
21
-
22
- public function display() {
23
- ?>
24
-
25
- <style>
26
- @import url(https://fonts.googleapis.com/css?family=Oswald);
27
-
28
- #main_featured_themes_page #featured-themes-list {
29
- position:relative;
30
- margin:0px auto;
31
- height:auto;
32
- display:table;
33
- list-style:none;
34
- text-align: center;
35
- width: 100%;
36
- }
37
- #main_featured_themes_page #featured-themes-list li {
38
- display: inline-table;
39
- width: 300px;
40
- margin: 20px 10px 0px 10px;
41
- background: #FFFFFF;
42
- border-right: 3px solid #E5E5E5;
43
- border-bottom: 3px solid #E5E5E5;
44
- position: relative;
45
- }
46
- @media screen and (min-width: 1600px) {
47
- #main_featured_themes_page #featured-themes-list li {
48
- width:400px;
49
- }
50
-
51
- }
52
- #main_featured_themes_page .theme_img img {
53
- max-width: 100%;
54
- }
55
- #main_featured_themes_page .theme_img {
56
- display: inline-block;
57
- overflow: hidden;
58
- outline: 1px solid #D6D1D1;
59
- position:relative;
60
- /*height: 168px; */
61
- }
62
- #main_featured_themes_page #featured-themes-list li .title {
63
- width: 91%;
64
- text-align: center;
65
- margin: 0 auto;
66
- }
67
- #main_featured_themes_page {
68
- font-family: Oswald;
69
- }
70
- #main_featured_themes_page #featured-themes-list li .title .heading {
71
- display: block;
72
- position: relative;
73
- font-size: 17px;
74
- color: #666666;
75
- margin: 13px 0px 13px 0px;
76
- text-transform: uppercase;
77
- }
78
- #main_featured_themes_page #featured-themes-list li .title p {
79
- font-size:14px;
80
- color:#444;
81
- margin-left:20px;
82
- }
83
- #main_featured_themes_page #featured-themes-list li .description {
84
- height:130px;
85
- width: 90%;
86
- margin: 0 auto;
87
- }
88
- #main_featured_themes_page #featured-themes-list li .description p {
89
- text-align: center;
90
- width: 100%;
91
- color: #666666;
92
- font-family: "Open Sans",sans-serif;
93
- font-size: 14px;
94
- }
95
- #main_featured_themes_page #featured-themes-list li .links {
96
- border-top: 1px solid #d8d8d8;
97
- width: 90%;
98
- margin: 0 auto;
99
- font-size: 14px;
100
- line-height: 40px;
101
- font-weight: bolder;
102
- text-align: center;
103
- padding-top: 9px;
104
- padding-bottom: 12px;
105
- }
106
- #main_featured_themes_page .page_header h1 {
107
- margin: 0px;
108
- font-family: Segoe UI;
109
- padding-bottom: 15px;
110
- color: rgb(111, 111, 111);
111
- font-size: 24px;
112
- text-align:center;
113
- }
114
- #main_featured_themes_page .page_header {
115
- height: 40px;
116
- padding: 22px 0px 0px 0px;
117
- margin-bottom: 15px;
118
- /*border-bottom: rgb(111, 111, 111) solid 1px;*/
119
- }
120
- #main_featured_themes_page #featured-themes-list li a {
121
- outline: none;
122
- line-height: 29px;
123
- text-decoration: none;
124
- color: #134d68;
125
- font-family: "Open Sans",sans-serif;
126
- text-shadow: 1px 0;
127
- display: inline-block;
128
- font-size: 15px;
129
- }
130
- #main_featured_themes_page #featured-themes-list li a.demo {
131
- color: #ffffff;
132
- background: #F47629;
133
- border-radius: 3px;
134
- width: 76px;
135
- text-align:center;
136
- margin-right: 12px;
137
- }
138
- #main_featured_themes_page #featured-themes-list li a.download {
139
- padding-right: 30px;
140
- background:url(<?php echo $this->image_url; ?>down.png) no-repeat right;
141
- }
142
- #main_featured_themes_page .featured_header{
143
- background: #11465F;
144
- border-right: 3px solid #E5E5E5;
145
- border-bottom: 3px solid #E5E5E5;
146
- position: relative;
147
- padding: 20px 0;
148
- }
149
- #main_featured_themes_page .featured_header .try-now {
150
- text-align: center;
151
- }
152
- #main_featured_themes_page .featured_header .try-now span {
153
- display: inline-block;
154
- padding: 7px 16px;
155
- background: #F47629;
156
- border-radius: 10px;
157
- color: #ffffff;
158
- font-size: 23px;
159
- }
160
- #main_featured_themes_page .featured_container {
161
- position: relative;
162
- width: 90%;
163
- margin: 15px auto 0px auto;
164
- }
165
- #main_featured_themes_page .featured_container .old_price{
166
- color: rgba(180, 180, 180, 0.3);
167
- text-decoration: line-through;
168
- font-family: Oswald;
169
- }
170
- #main_featured_themes_page .featured_container .get_themes{
171
- color: #FFFFFF;
172
- height: 85px;
173
- margin: 0;
174
- background-size: 95% 100%;
175
- background-position: center;
176
- line-height: 60px;
177
- font-size: 45px;
178
- text-align: center;
179
- letter-spacing: 3px;
180
- }
181
- #main_featured_themes_page .featured_header h1{
182
- font-size: 45px;
183
- text-align: center;
184
- color: #ffffff;
185
- letter-spacing: 3px;
186
- line-height: 10px;
187
- }
188
- #main_featured_themes_page .featured_header a{
189
- text-decoration: none;
190
- }
191
- @media screen and (max-width: 1035px) {
192
- #main_featured_themes_page .featured_header h1{
193
- font-size: 37px;
194
- line-height: 0;
195
- }
196
- }
197
- @media screen and (max-width: 835px) {
198
- #main_featured_themes_page .get_themes span{
199
- display: none;
200
- }
201
- }
202
- @media screen and (max-width: 435px) {
203
- #main_featured_themes_page .featured_header h1 {
204
- font-size: 20px;
205
- line-height: 17px;
206
- }
207
- }
208
- </style>
209
-
210
- <?php
211
- $WDWThemes = array(
212
- "business_elite" => array(
213
- "title" => "Business Elite",
214
- "description" => __("Business Elite is a robust parallax theme for business websites. The theme uses smooth transitions and many functional sections.",$this->lang_slug),
215
- "link" => "business-elite.html",
216
- "demo" => "theme-businesselite",
217
- "image" => "business_elite.jpg"
218
- ),
219
- "portfolio" => array(
220
- "title" => "Portfolio Gallery",
221
- "description" => __("Portfolio Gallery helps to display images using various color schemes and layouts combined with elegant fonts and content parts.",$this->lang_slug),
222
- "link" => "portfolio-gallery.html",
223
- "demo" => "theme-portfoliogallery",
224
- "image" => "portfolio_gallery.jpg"
225
- ),
226
- "sauron" => array(
227
- "title" => "Sauron",
228
- "description" => __("Sauron is a multipurpose parallax theme, which uses multiple interactive sections designed for the client-engagement.",$this->lang_slug),
229
- "link" => "sauron.html",
230
- "demo" => "theme-sauron",
231
- "image" => "sauron.jpg"
232
- ),
233
- "business_world" => array(
234
- "title" => "Business World",
235
- "description" => __("Business World is an innovative WordPress theme great for Business websites.",$this->lang_slug),
236
- "link" => "business-world.html",
237
- "demo" => "theme-businessworld",
238
- "image" => "business_world.jpg"
239
- ),
240
- "best_magazine" => array(
241
- "title" => "Best Magazine",
242
- "description" => __("Best Magazine is an ultimate selection when you are dealing with multi-category news websites.",$this->lang_slug),
243
- "link" => "best-magazine.html",
244
- "demo" => "theme-bestmagazine",
245
- "image" => "best_magazine.jpg"
246
- ),
247
- "magazine" => array(
248
- "title" => "News Magazine",
249
- "description" => __("Magazine theme is a perfect solution when creating news and informational websites. It comes with a wide range of layout options.",$this->lang_slug),
250
- "link" => "news-magazine.html",
251
- "demo" => "theme-newsmagazine",
252
- "image" => "news_magazine.jpg"
253
- )
254
- );
255
- ?>
256
- <div id="main_featured_themes_page">
257
- <div class="featured_container">
258
- <div class="page_header">
259
- <h1><?php echo __("Featured Themes",$this->lang_slug); ?></h1>
260
- </div>
261
- <div class="featured_header">
262
- <a target="_blank" href="https://web-dorado.com/wordpress-themes.html?source=<?php echo $this->slug; ?>">
263
- <h1><?php echo __("WORDPRESS THEMES",$this->lang_slug); ?></h1>
264
- <h2 class="get_themes"><?php echo __("ALL FOR $40 ONLY ",$this->lang_slug); ?><span>- <?php echo __("SAVE 80%",$this->lang_slug); ?></span></h2>
265
- <div class="try-now">
266
- <span><?php echo __("TRY NOW",$this->lang_slug); ?></span>
267
- </div>
268
- </a>
269
- </div>
270
- <ul id="featured-themes-list">
271
- <?php foreach($WDWThemes as $key=>$WDWTheme) : ?>
272
- <li class="<?php echo $key; ?>">
273
- <div class="theme_img">
274
- <img src="<?php echo $this->image_url . $WDWTheme["image"]; ?>">
275
- </div>
276
- <div class="title">
277
- <h3 class="heading"><?php echo $WDWTheme["title"]; ?></h3>
278
- </div>
279
- <div class="description">
280
- <p><?php echo $WDWTheme["description"]; ?></p>
281
- </div>
282
- <div class="links">
283
- <a target="_blank" href="<?php echo $this->demo_url . $WDWTheme["demo"]."?source=".$this->slug; ?>" class="demo"><?php echo __("Demo",$this->lang_slug); ?></a>
284
- <a target="_blank" href="<?php echo $this->site_url . $WDWTheme["link"]."?source=".$this->slug; ?>" class="download"><?php echo __("Free Download",$this->lang_slug); ?></a>
285
- </div>
286
- </li>
287
- <?php endforeach; ?>
288
- </ul>
289
- </div>
290
- </div>
291
- <?php }
292
-
293
- ////////////////////////////////////////////////////////////////////////////////////////
294
- // Getters & Setters //
295
- ////////////////////////////////////////////////////////////////////////////////////////
296
- ////////////////////////////////////////////////////////////////////////////////////////
297
- // Private Methods //
298
- ////////////////////////////////////////////////////////////////////////////////////////
299
- ////////////////////////////////////////////////////////////////////////////////////////
300
- // Listeners //
301
- ////////////////////////////////////////////////////////////////////////////////////////
302
  }
1
+ <?php
2
+
3
+ class gawd_featured_themes {
4
+
5
+
6
+ private $slug = 'wd-google-analytics';
7
+ private $lang_slug = 'gawd';
8
+
9
+ private $image_url = '';
10
+ private $demo_url = 'http://themedemo.web-dorado.com/';
11
+ private $site_url = 'https://web-dorado.com/wordpress-themes/';
12
+
13
+ public function __construct() {
14
+ $this->image_url = GAWD_URL . "/featured/images/";
15
+
16
+ }
17
+
18
+ ////////////////////////////////////////////////////////////////////////////////////////
19
+ // Public Methods //
20
+ ////////////////////////////////////////////////////////////////////////////////////////
21
+
22
+ public function display() {
23
+ ?>
24
+
25
+ <style>
26
+ @import url(https://fonts.googleapis.com/css?family=Oswald);
27
+
28
+ #main_featured_themes_page #featured-themes-list {
29
+ position:relative;
30
+ margin:0px auto;
31
+ height:auto;
32
+ display:table;
33
+ list-style:none;
34
+ text-align: center;
35
+ width: 100%;
36
+ }
37
+ #main_featured_themes_page #featured-themes-list li {
38
+ display: inline-table;
39
+ width: 300px;
40
+ margin: 20px 10px 0px 10px;
41
+ background: #FFFFFF;
42
+ border-right: 3px solid #E5E5E5;
43
+ border-bottom: 3px solid #E5E5E5;
44
+ position: relative;
45
+ }
46
+ @media screen and (min-width: 1600px) {
47
+ #main_featured_themes_page #featured-themes-list li {
48
+ width:400px;
49
+ }
50
+
51
+ }
52
+ #main_featured_themes_page .theme_img img {
53
+ max-width: 100%;
54
+ }
55
+ #main_featured_themes_page .theme_img {
56
+ display: inline-block;
57
+ overflow: hidden;
58
+ outline: 1px solid #D6D1D1;
59
+ position:relative;
60
+ /*height: 168px; */
61
+ }
62
+ #main_featured_themes_page #featured-themes-list li .title {
63
+ width: 91%;
64
+ text-align: center;
65
+ margin: 0 auto;
66
+ }
67
+ #main_featured_themes_page {
68
+ font-family: Oswald;
69
+ }
70
+ #main_featured_themes_page #featured-themes-list li .title .heading {
71
+ display: block;
72
+ position: relative;
73
+ font-size: 17px;
74
+ color: #666666;
75
+ margin: 13px 0px 13px 0px;
76
+ text-transform: uppercase;
77
+ }
78
+ #main_featured_themes_page #featured-themes-list li .title p {
79
+ font-size:14px;
80
+ color:#444;
81
+ margin-left:20px;
82
+ }
83
+ #main_featured_themes_page #featured-themes-list li .description {
84
+ height:130px;
85
+ width: 90%;
86
+ margin: 0 auto;
87
+ }
88
+ #main_featured_themes_page #featured-themes-list li .description p {
89
+ text-align: center;
90
+ width: 100%;
91
+ color: #666666;
92
+ font-family: "Open Sans",sans-serif;
93
+ font-size: 14px;
94
+ }
95
+ #main_featured_themes_page #featured-themes-list li .links {
96
+ border-top: 1px solid #d8d8d8;
97
+ width: 90%;
98
+ margin: 0 auto;
99
+ font-size: 14px;
100
+ line-height: 40px;
101
+ font-weight: bolder;
102
+ text-align: center;
103
+ padding-top: 9px;
104
+ padding-bottom: 12px;
105
+ }
106
+ #main_featured_themes_page .page_header h1 {
107
+ margin: 0px;
108
+ font-family: Segoe UI;
109
+ padding-bottom: 15px;
110
+ color: rgb(111, 111, 111);
111
+ font-size: 24px;
112
+ text-align:center;
113
+ }
114
+ #main_featured_themes_page .page_header {
115
+ height: 40px;
116
+ padding: 22px 0px 0px 0px;
117
+ margin-bottom: 15px;
118
+ /*border-bottom: rgb(111, 111, 111) solid 1px;*/
119
+ }
120
+ #main_featured_themes_page #featured-themes-list li a {
121
+ outline: none;
122
+ line-height: 29px;
123
+ text-decoration: none;
124
+ color: #134d68;
125
+ font-family: "Open Sans",sans-serif;
126
+ text-shadow: 1px 0;
127
+ display: inline-block;
128
+ font-size: 15px;
129
+ }
130
+ #main_featured_themes_page #featured-themes-list li a.demo {
131
+ color: #ffffff;
132
+ background: #F47629;
133
+ border-radius: 3px;
134
+ width: 76px;
135
+ text-align:center;
136
+ margin-right: 12px;
137
+ }
138
+ #main_featured_themes_page #featured-themes-list li a.download {
139
+ padding-right: 30px;
140
+ background:url(<?php echo $this->image_url; ?>down.png) no-repeat right;
141
+ }
142
+ #main_featured_themes_page .featured_header{
143
+ background: #11465F;
144
+ border-right: 3px solid #E5E5E5;
145
+ border-bottom: 3px solid #E5E5E5;
146
+ position: relative;
147
+ padding: 20px 0;
148
+ }
149
+ #main_featured_themes_page .featured_header .try-now {
150
+ text-align: center;
151
+ }
152
+ #main_featured_themes_page .featured_header .try-now span {
153
+ display: inline-block;
154
+ padding: 7px 16px;
155
+ background: #F47629;
156
+ border-radius: 10px;
157
+ color: #ffffff;
158
+ font-size: 23px;
159
+ }
160
+ #main_featured_themes_page .featured_container {
161
+ position: relative;
162
+ width: 90%;
163
+ margin: 15px auto 0px auto;
164
+ }
165
+ #main_featured_themes_page .featured_container .old_price{
166
+ color: rgba(180, 180, 180, 0.3);
167
+ text-decoration: line-through;
168
+ font-family: Oswald;
169
+ }
170
+ #main_featured_themes_page .featured_container .get_themes{
171
+ color: #FFFFFF;
172
+ height: 85px;
173
+ margin: 0;
174
+ background-size: 95% 100%;
175
+ background-position: center;
176
+ line-height: 60px;
177
+ font-size: 45px;
178
+ text-align: center;
179
+ letter-spacing: 3px;
180
+ }
181
+ #main_featured_themes_page .featured_header h1{
182
+ font-size: 45px;
183
+ text-align: center;
184
+ color: #ffffff;
185
+ letter-spacing: 3px;
186
+ line-height: 10px;
187
+ }
188
+ #main_featured_themes_page .featured_header a{
189
+ text-decoration: none;
190
+ }
191
+ @media screen and (max-width: 1035px) {
192
+ #main_featured_themes_page .featured_header h1{
193
+ font-size: 37px;
194
+ line-height: 0;
195
+ }
196
+ }
197
+ @media screen and (max-width: 835px) {
198
+ #main_featured_themes_page .get_themes span{
199
+ display: none;
200
+ }
201
+ }
202
+ @media screen and (max-width: 435px) {
203
+ #main_featured_themes_page .featured_header h1 {
204
+ font-size: 20px;
205
+ line-height: 17px;
206
+ }
207
+ }
208
+ </style>
209
+
210
+ <?php
211
+ $WDWThemes = array(
212
+ "business_elite" => array(
213
+ "title" => "Business Elite",
214
+ "description" => __("Business Elite is a robust parallax theme for business websites. The theme uses smooth transitions and many functional sections.",$this->lang_slug),
215
+ "link" => "business-elite.html",
216
+ "demo" => "theme-businesselite",
217
+ "image" => "business_elite.jpg"
218
+ ),
219
+ "portfolio" => array(
220
+ "title" => "Portfolio Gallery",
221
+ "description" => __("Portfolio Gallery helps to display images using various color schemes and layouts combined with elegant fonts and content parts.",$this->lang_slug),
222
+ "link" => "portfolio-gallery.html",
223
+ "demo" => "theme-portfoliogallery",
224
+ "image" => "portfolio_gallery.jpg"
225
+ ),
226
+ "sauron" => array(
227
+ "title" => "Sauron",
228
+ "description" => __("Sauron is a multipurpose parallax theme, which uses multiple interactive sections designed for the client-engagement.",$this->lang_slug),
229
+ "link" => "sauron.html",
230
+ "demo" => "theme-sauron",
231
+ "image" => "sauron.jpg"
232
+ ),
233
+ "business_world" => array(
234
+ "title" => "Business World",
235
+ "description" => __("Business World is an innovative WordPress theme great for Business websites.",$this->lang_slug),
236
+ "link" => "business-world.html",
237
+ "demo" => "theme-businessworld",
238
+ "image" => "business_world.jpg"
239
+ ),
240
+ "best_magazine" => array(
241
+ "title" => "Best Magazine",
242
+ "description" => __("Best Magazine is an ultimate selection when you are dealing with multi-category news websites.",$this->lang_slug),
243
+ "link" => "best-magazine.html",
244
+ "demo" => "theme-bestmagazine",
245
+ "image" => "best_magazine.jpg"
246
+ ),
247
+ "magazine" => array(
248
+ "title" => "News Magazine",
249
+ "description" => __("Magazine theme is a perfect solution when creating news and informational websites. It comes with a wide range of layout options.",$this->lang_slug),
250
+ "link" => "news-magazine.html",
251
+ "demo" => "theme-newsmagazine",
252
+ "image" => "news_magazine.jpg"
253
+ )
254
+ );
255
+ ?>
256
+ <div id="main_featured_themes_page">
257
+ <div class="featured_container">
258
+ <div class="page_header">
259
+ <h1><?php echo __("Featured Themes",$this->lang_slug); ?></h1>
260
+ </div>
261
+ <div class="featured_header">
262
+ <a target="_blank" href="https://web-dorado.com/wordpress-themes-bundle.html?source=<?php echo $this->slug; ?>">
263
+ <h1><?php echo __("WORDPRESS THEMES",$this->lang_slug); ?></h1>
264
+ <h2 class="get_themes"><?php echo __("ALL FOR $40 ONLY ",$this->lang_slug); ?><span>- <?php echo __("SAVE 80%",$this->lang_slug); ?></span></h2>
265
+ <div class="try-now">
266
+ <span><?php echo __("TRY NOW",$this->lang_slug); ?></span>
267
+ </div>
268
+ </a>
269
+ </div>
270
+ <ul id="featured-themes-list">
271
+ <?php foreach($WDWThemes as $key=>$WDWTheme) : ?>
272
+ <li class="<?php echo $key; ?>">
273
+ <div class="theme_img">
274
+ <img src="<?php echo $this->image_url . $WDWTheme["image"]; ?>">
275
+ </div>
276
+ <div class="title">
277
+ <h3 class="heading"><?php echo $WDWTheme["title"]; ?></h3>
278
+ </div>
279
+ <div class="description">
280
+ <p><?php echo $WDWTheme["description"]; ?></p>
281
+ </div>
282
+ <div class="links">
283
+ <a target="_blank" href="<?php echo $this->demo_url . $WDWTheme["demo"]."?source=".$this->slug; ?>" class="demo"><?php echo __("Demo",$this->lang_slug); ?></a>
284
+ <a target="_blank" href="<?php echo $this->site_url . $WDWTheme["link"]."?source=".$this->slug; ?>" class="download"><?php echo __("Free Download",$this->lang_slug); ?></a>
285
+ </div>
286
+ </li>
287
+ <?php endforeach; ?>
288
+ </ul>
289
+ </div>
290
+ </div>
291
+ <?php }
292
+
293
+ ////////////////////////////////////////////////////////////////////////////////////////
294
+ // Getters & Setters //
295
+ ////////////////////////////////////////////////////////////////////////////////////////
296
+ ////////////////////////////////////////////////////////////////////////////////////////
297
+ // Private Methods //
298
+ ////////////////////////////////////////////////////////////////////////////////////////
299
+ ////////////////////////////////////////////////////////////////////////////////////////
300
+ // Listeners //
301
+ ////////////////////////////////////////////////////////////////////////////////////////
302
  }
featured/style.css CHANGED
@@ -1,205 +1,205 @@
1
- @import url(http://fonts.googleapis.com/css?family=Oswald);
2
- #main_featured_plugins_page {
3
- font-family: Oswald;
4
- width: 90%;
5
- margin: 15px auto 0px auto;
6
- }
7
-
8
- #main_featured_plugins_page h3 {
9
- border-bottom: 2px solid #CECECE;
10
- color: rgb(111, 111, 111);
11
- font-family: Segoe UI;
12
- font-size: 18px;
13
- margin: 0px auto 15px auto;
14
- padding: 20px 0;
15
- }
16
-
17
- #main_featured_plugins_page #featured-plugins-list {
18
- position:relative;
19
- margin:0px auto;
20
- height:auto;
21
- display:table;
22
- list-style:none;
23
- text-align: center;
24
- width: 100%;
25
- }
26
-
27
- #main_featured_plugins_page #featured-plugins-list li {
28
- display: inline-table;
29
- width: 200px;
30
- margin: 20px 10px 0px 10px;
31
- background: #FFFFFF;
32
- border-right: 3px solid #E5E5E5;
33
- height: 335px;
34
- border-bottom: 3px solid #E5E5E5;
35
- position: relative;
36
- }
37
-
38
- #main_featured_plugins_page #featured-plugins-list li .product {
39
- position:relative;
40
- height:113px;
41
- background-color: transparent !important;
42
- background-position-x: 50% !important;
43
- margin: 7px;
44
- border-radius: 3px;
45
- background-size: 115px !important;
46
- }
47
-
48
- #main_featured_plugins_page #featured-plugins-list li .title {
49
- width: 90%;
50
- text-align: center;
51
- margin: 0 auto;
52
- }
53
-
54
- #main_featured_plugins_page #featured-plugins-list li.form-maker .product {background:url("images/form.png") center center no-repeat;}
55
- #main_featured_plugins_page #featured-plugins-list li.catalog .product {background:url("images/catalog.png") center center no-repeat;}
56
- #main_featured_plugins_page #featured-plugins-list li.contact-maker .product {background:url("images/contact.maker.png") center center no-repeat;}
57
- #main_featured_plugins_page #featured-plugins-list li.contacts .product {background:url("images/contacts.png") center center no-repeat;}
58
- #main_featured_plugins_page #featured-plugins-list li.facebook .product {background:url("images/facebook.png") center center no-repeat;}
59
- #main_featured_plugins_page #featured-plugins-list li.faq .product {background:url("images/faq.png") center center no-repeat;}
60
- #main_featured_plugins_page #featured-plugins-list li.flash-calendar .product {background:url("images/flash.calendar.png") center center no-repeat;}
61
- #main_featured_plugins_page #featured-plugins-list li.player .product {background:url("images/player.png") center center no-repeat; }
62
- #main_featured_plugins_page #featured-plugins-list li.spider-calendar .product {background:url("images/spider.calendar.png") center center no-repeat;}
63
- #main_featured_plugins_page #featured-plugins-list li.contact_form_bulder .product {background:url("images/contact.builder.png") center center no-repeat;}
64
- #main_featured_plugins_page #featured-plugins-list li.random_post .product {background:url("images/random.post.png") center center no-repeat;}
65
- #main_featured_plugins_page #featured-plugins-list li.slider_wd .product {background:url("images/slider.png") center center no-repeat;}
66
- #main_featured_plugins_page #featured-plugins-list li.folder_menu .product {background:url("images/folder.menu.png") center center no-repeat;}
67
- #main_featured_plugins_page #featured-plugins-list li.zoom .product {background:url("images/zoom.png") center center no-repeat;}
68
- #main_featured_plugins_page #featured-plugins-list li.fm-import .product {background:url("images/fm-import.png") center center no-repeat;}
69
- #main_featured_plugins_page #featured-plugins-list li.photo-gallery .product {background:url("images/photo-gallery.png") center center no-repeat;}
70
- #main_featured_plugins_page #featured-plugins-list li.twitter-widget .product {background:url("images/twittertools.png") center center no-repeat;}
71
- #main_featured_plugins_page #featured-plugins-list li.events-wd .product {background:url("images/events-wd.png") center center no-repeat;}
72
- #main_featured_plugins_page #featured-plugins-list li.faq_wd .product {background:url("images/faq_wd.png") center center no-repeat;}
73
- #main_featured_plugins_page #featured-plugins-list li.instagram_feed .product {background:url("images/instagram_feed.png") center center no-repeat;}
74
- #main_featured_plugins_page #featured-plugins-list li.post-slider .product {background:url("images/post-slider.png") center center no-repeat;}
75
- #main_featured_plugins_page #featured-plugins-list li.google-maps .product {background:url("images/google-maps.png") center center no-repeat;}
76
-
77
- #main_featured_plugins_page #featured-plugins-list li .title .heading {
78
- display: block;
79
- position: relative;
80
- font-size: 17px;
81
- color: #767676;
82
- margin: 13px 0px 13px 0px;
83
- text-transform: uppercase;
84
- }
85
-
86
- #main_featured_plugins_page #featured-plugins-list li .title p {
87
- font-size:14px;
88
- color:#444;
89
- margin-left:20px;
90
- }
91
-
92
- #main_featured_plugins_page #featured-plugins-list li .description {
93
- height: 127px;
94
- width: 90%;
95
- margin: 0 auto;
96
- }
97
-
98
- #main_featured_plugins_page #featured-plugins-list li .description p {
99
- text-align: center;
100
- width: 100%;
101
- color: #9A9A9A;
102
- font-family: Segoe UI Light;
103
- }
104
-
105
- #featured-plugins-list li a.download {
106
- display: block;
107
- border-top: 1px solid #CACACA;
108
- outline: none;
109
- width: 90%;
110
- margin: 0 auto;
111
- font-size: 14px;
112
- line-height: 40px;
113
- text-decoration: none;
114
- font-weight: bolder;
115
- text-align: center;
116
- color: #134D68;
117
- position: absolute;
118
- text-transform: uppercase;
119
- bottom: 0;
120
- left: 10px;
121
- font-family: Segoe UI Black;
122
- text-shadow: 1px 0;
123
- }
124
-
125
- #featured-plugins-list li a.download:hover {
126
- color: #F47629;
127
- }
128
-
129
- .featured_header {
130
- background: #11465F;
131
- border-right: 3px solid #E5E5E5;
132
- border-bottom: 3px solid #E5E5E5;
133
- position: relative;
134
- padding: 20px 0;
135
- }
136
-
137
- .featured_header .old_price {
138
- color: rgba(180, 180, 180, 0.3);
139
- text-decoration: line-through;
140
- font-family: Oswald;
141
- }
142
-
143
- .featured_header h1.get_plugins {
144
- color: #FFFFFF;
145
- height: 85px;
146
- margin: 0;
147
- background-size: 85% 100%;
148
- background-position: center;
149
- line-height: 60px;
150
- }
151
-
152
- .featured_header .try-now {
153
- text-align: center;
154
- }
155
-
156
- .featured_header .try-now span {
157
- display: inline-block;
158
- padding: 7px 16px;
159
- background: #F47629;
160
- border-radius: 10px;
161
- color: #ffffff;
162
- font-size: 23px;
163
- }
164
-
165
- .featured_header h1 {
166
- font-size: 50px;
167
- text-align: center;
168
- color: #FFFFFF;
169
- letter-spacing: 3px;
170
- text-transform: uppercase;
171
- }
172
-
173
- .featured_header a {
174
- text-decoration: none;
175
- }
176
-
177
- .featured_header a:hover {
178
- text-decoration: none;
179
- }
180
-
181
- @media screen and (max-width: 1105px) {
182
- .featured_header h1 {
183
- font-size: 37px;
184
- line-height: 0;
185
- }
186
- }
187
-
188
- @media screen and (max-width: 835px) {
189
- .get_plugins span {
190
- display: none;
191
- }
192
- }
193
-
194
- @media screen and (max-width: 700px) {
195
- .featured_header h1 {
196
- line-height: 40px;
197
- }
198
- }
199
-
200
- @media screen and (max-width: 435px) {
201
- .featured_header h1 {
202
- font-size: 20px;
203
- line-height: 25px;
204
- }
205
  }
1
+ @import url(https://fonts.googleapis.com/css?family=Oswald);
2
+ #main_featured_plugins_page {
3
+ font-family: Oswald;
4
+ width: 90%;
5
+ margin: 15px auto 0px auto;
6
+ }
7
+
8
+ #main_featured_plugins_page h3 {
9
+ border-bottom: 2px solid #CECECE;
10
+ color: rgb(111, 111, 111);
11
+ font-family: Segoe UI;
12
+ font-size: 18px;
13
+ margin: 0px auto 15px auto;
14
+ padding: 20px 0;
15
+ }
16
+
17
+ #main_featured_plugins_page #featured-plugins-list {
18
+ position:relative;
19
+ margin:0px auto;
20
+ height:auto;
21
+ display:table;
22
+ list-style:none;
23
+ text-align: center;
24
+ width: 100%;
25
+ }
26
+
27
+ #main_featured_plugins_page #featured-plugins-list li {
28
+ display: inline-table;
29
+ width: 200px;
30
+ margin: 20px 10px 0px 10px;
31
+ background: #FFFFFF;
32
+ border-right: 3px solid #E5E5E5;
33
+ height: 335px;
34
+ border-bottom: 3px solid #E5E5E5;
35
+ position: relative;
36
+ }
37
+
38
+ #main_featured_plugins_page #featured-plugins-list li .product {
39
+ position:relative;
40
+ height:113px;
41
+ background-color: transparent !important;
42
+ background-position-x: 50% !important;
43
+ margin: 7px;
44
+ border-radius: 3px;
45
+ background-size: 115px !important;
46
+ }
47
+
48
+ #main_featured_plugins_page #featured-plugins-list li .title {
49
+ width: 90%;
50
+ text-align: center;
51
+ margin: 0 auto;
52
+ }
53
+
54
+ #main_featured_plugins_page #featured-plugins-list li.form-maker .product {background:url("images/form.png") center center no-repeat;}
55
+ #main_featured_plugins_page #featured-plugins-list li.catalog .product {background:url("images/catalog.png") center center no-repeat;}
56
+ #main_featured_plugins_page #featured-plugins-list li.contact-maker .product {background:url("images/contact.maker.png") center center no-repeat;}
57
+ #main_featured_plugins_page #featured-plugins-list li.contacts .product {background:url("images/contacts.png") center center no-repeat;}
58
+ #main_featured_plugins_page #featured-plugins-list li.facebook .product {background:url("images/facebook.png") center center no-repeat;}
59
+ #main_featured_plugins_page #featured-plugins-list li.faq .product {background:url("images/faq.png") center center no-repeat;}
60
+ #main_featured_plugins_page #featured-plugins-list li.flash-calendar .product {background:url("images/flash.calendar.png") center center no-repeat;}
61
+ #main_featured_plugins_page #featured-plugins-list li.player .product {background:url("images/player.png") center center no-repeat; }
62
+ #main_featured_plugins_page #featured-plugins-list li.spider-calendar .product {background:url("images/spider.calendar.png") center center no-repeat;}
63
+ #main_featured_plugins_page #featured-plugins-list li.contact_form_bulder .product {background:url("images/contact.builder.png") center center no-repeat;}
64
+ #main_featured_plugins_page #featured-plugins-list li.random_post .product {background:url("images/random.post.png") center center no-repeat;}
65
+ #main_featured_plugins_page #featured-plugins-list li.slider_wd .product {background:url("images/slider.png") center center no-repeat;}
66
+ #main_featured_plugins_page #featured-plugins-list li.folder_menu .product {background:url("images/folder.menu.png") center center no-repeat;}
67
+ #main_featured_plugins_page #featured-plugins-list li.zoom .product {background:url("images/zoom.png") center center no-repeat;}
68
+ #main_featured_plugins_page #featured-plugins-list li.fm-import .product {background:url("images/fm-import.png") center center no-repeat;}
69
+ #main_featured_plugins_page #featured-plugins-list li.photo-gallery .product {background:url("images/photo-gallery.png") center center no-repeat;}
70
+ #main_featured_plugins_page #featured-plugins-list li.twitter-widget .product {background:url("images/twittertools.png") center center no-repeat;}
71
+ #main_featured_plugins_page #featured-plugins-list li.events-wd .product {background:url("images/events-wd.png") center center no-repeat;}
72
+ #main_featured_plugins_page #featured-plugins-list li.faq_wd .product {background:url("images/faq_wd.png") center center no-repeat;}
73
+ #main_featured_plugins_page #featured-plugins-list li.instagram_feed .product {background:url("images/instagram_feed.png") center center no-repeat;}
74
+ #main_featured_plugins_page #featured-plugins-list li.post-slider .product {background:url("images/post-slider.png") center center no-repeat;}
75
+ #main_featured_plugins_page #featured-plugins-list li.google-maps .product {background:url("images/google-maps.png") center center no-repeat;}
76
+
77
+ #main_featured_plugins_page #featured-plugins-list li .title .heading {
78
+ display: block;
79
+ position: relative;
80
+ font-size: 17px;
81
+ color: #767676;
82
+ margin: 13px 0px 13px 0px;
83
+ text-transform: uppercase;
84
+ }
85
+
86
+ #main_featured_plugins_page #featured-plugins-list li .title p {
87
+ font-size:14px;
88
+ color:#444;
89
+ margin-left:20px;
90
+ }
91
+
92
+ #main_featured_plugins_page #featured-plugins-list li .description {
93
+ height: 127px;
94
+ width: 90%;
95
+ margin: 0 auto;
96
+ }
97
+
98
+ #main_featured_plugins_page #featured-plugins-list li .description p {
99
+ text-align: center;
100
+ width: 100%;
101
+ color: #9A9A9A;
102
+ font-family: Segoe UI Light;
103
+ }
104
+
105
+ #featured-plugins-list li a.download {
106
+ display: block;
107
+ border-top: 1px solid #CACACA;
108
+ outline: none;
109
+ width: 90%;
110
+ margin: 0 auto;
111
+ font-size: 14px;
112
+ line-height: 40px;
113
+ text-decoration: none;
114
+ font-weight: bolder;
115
+ text-align: center;
116
+ color: #134D68;
117
+ position: absolute;
118
+ text-transform: uppercase;
119
+ bottom: 0;
120
+ left: 10px;
121
+ font-family: Segoe UI Black;
122
+ text-shadow: 1px 0;
123
+ }
124
+
125
+ #featured-plugins-list li a.download:hover {
126
+ color: #F47629;
127
+ }
128
+
129
+ .featured_header {
130
+ background: #11465F;
131
+ border-right: 3px solid #E5E5E5;
132
+ border-bottom: 3px solid #E5E5E5;
133
+ position: relative;
134
+ padding: 20px 0;
135
+ }
136
+
137
+ .featured_header .old_price {
138
+ color: rgba(180, 180, 180, 0.3);
139
+ text-decoration: line-through;
140
+ font-family: Oswald;
141
+ }
142
+
143
+ .featured_header h1.get_plugins {
144
+ color: #FFFFFF;
145
+ height: 85px;
146
+ margin: 0;
147
+ background-size: 85% 100%;
148
+ background-position: center;
149
+ line-height: 60px;
150
+ }
151
+
152
+ .featured_header .try-now {
153
+ text-align: center;
154
+ }
155
+
156
+ .featured_header .try-now span {
157
+ display: inline-block;
158
+ padding: 7px 16px;
159
+ background: #F47629;
160
+ border-radius: 10px;
161
+ color: #ffffff;
162
+ font-size: 23px;
163
+ }
164
+
165
+ .featured_header h1 {
166
+ font-size: 50px;
167
+ text-align: center;
168
+ color: #FFFFFF;
169
+ letter-spacing: 3px;
170
+ text-transform: uppercase;
171
+ }
172
+
173
+ .featured_header a {
174
+ text-decoration: none;
175
+ }
176
+
177
+ .featured_header a:hover {
178
+ text-decoration: none;
179
+ }
180
+
181
+ @media screen and (max-width: 1105px) {
182
+ .featured_header h1 {
183
+ font-size: 37px;
184
+ line-height: 0;
185
+ }
186
+ }
187
+
188
+ @media screen and (max-width: 835px) {
189
+ .get_plugins span {
190
+ display: none;
191
+ }
192
+ }
193
+
194
+ @media screen and (max-width: 700px) {
195
+ .featured_header h1 {
196
+ line-height: 40px;
197
+ }
198
+ }
199
+
200
+ @media screen and (max-width: 435px) {
201
+ .featured_header h1 {
202
+ font-size: 20px;
203
+ line-height: 25px;
204
+ }
205
  }
gawd_class.php CHANGED
@@ -66,7 +66,7 @@ class GAWD {
66
  add_filter( 'manage_pages_columns', array( $this, 'gawd_add_columns' ) );
67
  // Populate custom column in Pages List
68
  add_action( 'manage_pages_custom_column', array( $this, 'gawd_add_icons' ), 10, 2 );
69
- add_action( 'add_meta_boxes', array( $this, 'gawd_add_custom_box' ) );
70
  }
71
  $gawd_frontend_roles = isset( $gawd_settings['gawd_frontend_roles'] ) ? $gawd_settings['gawd_frontend_roles'] : array();
72
  if ( ( isset( $gawd_settings['gawd_tracking_enable'] ) && $gawd_settings['gawd_tracking_enable'] == 'on' ) && ( in_array( $roles, $gawd_frontend_roles ) || current_user_can( 'manage_options' ) ) ) {
@@ -86,7 +86,6 @@ class GAWD {
86
  //send error
87
  return;
88
  }
89
-
90
  }
91
 
92
  function get_current_user_role() {
@@ -537,6 +536,8 @@ class GAWD {
537
  require_once( 'admin/pages/browser.php' );
538
  }
539
 
 
 
540
  /**
541
  * Activation function needed for the activation hook.
542
  */
@@ -546,8 +547,16 @@ class GAWD {
546
  if ( ! get_option( 'gawd_credentials' ) ) {
547
  update_option( 'gawd_credentials', $credentials );
548
  }
549
- self::gawd_settings_defaults();
 
 
 
 
 
 
 
550
  self::add_dashboard_menu();
 
551
  }
552
 
553
  /**
@@ -589,11 +598,12 @@ class GAWD {
589
 
590
  public function gawd_enqueue_scripts() {
591
  $options = get_option( 'gawd_settings' );
 
592
  $default_date = ( isset( $options['default_date'] ) && $options['default_date'] != '' ) ? $options['default_date'] : 'last_30days';
593
  $default_date_format = ( isset( $options['default_date_format'] ) && $options['default_date_format'] != '' ) ? $options['default_date_format'] : 'ymd_with_week';
594
  $enable_hover_tooltip = ( isset( $options['enable_hover_tooltip'] ) && $options['enable_hover_tooltip'] != '' ) ? $options['enable_hover_tooltip'] : '';
595
  $screen = get_current_screen();
596
- if ( strpos( $screen->base, 'gawd' ) !== false || strpos( $screen->post_type, 'page' ) !== false || strpos( $screen->post_type, 'post' ) !== false || strpos( $screen->base, 'dashboard' ) !== false ) {
597
  wp_enqueue_script( 'common' );
598
  wp_enqueue_script( 'wp-lists' );
599
  wp_enqueue_script( 'postbox' );
@@ -659,7 +669,8 @@ class GAWD {
659
  'date_this_month' => date( 'Y-m-01' ) . '/-/' . date( 'Y-m-d' ),
660
  'date_today' => date( 'Y-m-d' ) . '/-/' . date( 'Y-m-d' ),
661
  'date_yesterday' => date( 'Y-m-d', strtotime( '-1 day' ) ) . '/-/' . date( 'Y-m-d', strtotime( '-1 day' ) ),
662
- 'exportUrl' => add_query_arg( array( 'action' => 'gawd_export' ), admin_url( 'admin-ajax.php' ) )
 
663
  ) );
664
  }
665
  }
@@ -694,9 +705,7 @@ class GAWD {
694
  $permission, //$capability
695
  'gawd_analytics', //$menu_slug
696
  array( $this, $this->gawd_set_display( 'gawd_display_overview_page' ) ), //$function = '',
697
- GAWD_URL . '/assets/main_icon.png'
698
- //$position = null
699
- );
700
 
701
  add_submenu_page(
702
  'gawd_analytics', //$parent_slug
@@ -1037,6 +1046,7 @@ class GAWD {
1037
  $gawd_client = GAWD_google_client::get_instance();
1038
  $profiles = $gawd_client->get_profiles();
1039
  $gawd_user_data = get_option( 'gawd_user_data' );
 
1040
  if ( isset( $_POST['gawd_id'] ) ) {
1041
  $gawd_user_data['gawd_id'] = isset( $_POST['gawd_id'] ) ? $_POST['gawd_id'] : '';
1042
  foreach ( $gawd_user_data['gawd_profiles'] as $web_property_name => $web_property ) {
@@ -1165,6 +1175,7 @@ class GAWD {
1165
  $settings['enable_hover_tooltip'] = 'on';
1166
  $settings['gawd_show_in_dashboard'] = 'on';
1167
  $settings['post_page_chart'] = 'on';
 
1168
  update_option( 'gawd_settings', $settings );
1169
  }
1170
 
@@ -2118,6 +2129,11 @@ class GAWD {
2118
  "childs" => array(),
2119
  "desc" => "Real Time statistics show the number of active users currently visiting your website pages."
2120
  ),
 
 
 
 
 
2121
  "demographics" => array(
2122
  "title" => __( "Demographics", "gawd" ),
2123
  "childs" => array(
66
  add_filter( 'manage_pages_columns', array( $this, 'gawd_add_columns' ) );
67
  // Populate custom column in Pages List
68
  add_action( 'manage_pages_custom_column', array( $this, 'gawd_add_icons' ), 10, 2 );
69
+ add_action( 'load-post.php', array( $this, 'gawd_add_custom_box' ) );
70
  }
71
  $gawd_frontend_roles = isset( $gawd_settings['gawd_frontend_roles'] ) ? $gawd_settings['gawd_frontend_roles'] : array();
72
  if ( ( isset( $gawd_settings['gawd_tracking_enable'] ) && $gawd_settings['gawd_tracking_enable'] == 'on' ) && ( in_array( $roles, $gawd_frontend_roles ) || current_user_can( 'manage_options' ) ) ) {
86
  //send error
87
  return;
88
  }
 
89
  }
90
 
91
  function get_current_user_role() {
536
  require_once( 'admin/pages/browser.php' );
537
  }
538
 
539
+
540
+
541
  /**
542
  * Activation function needed for the activation hook.
543
  */
547
  if ( ! get_option( 'gawd_credentials' ) ) {
548
  update_option( 'gawd_credentials', $credentials );
549
  }
550
+ $gawd_settings = get_option('gawd_settings');
551
+ if($gawd_settings === false){
552
+ self::gawd_settings_defaults();
553
+ }
554
+ elseif($gawd_settings && !isset($gawd_settings['show_report_page'])){
555
+ $gawd_settings['show_report_page'] = 'on';
556
+ update_option('gawd_settings', $gawd_settings);
557
+ }
558
  self::add_dashboard_menu();
559
+
560
  }
561
 
562
  /**
598
 
599
  public function gawd_enqueue_scripts() {
600
  $options = get_option( 'gawd_settings' );
601
+ $show_report_page = (isset( $options['show_report_page'] ) && $options['show_report_page'] != '' ) ? $options['show_report_page'] : 'on';
602
  $default_date = ( isset( $options['default_date'] ) && $options['default_date'] != '' ) ? $options['default_date'] : 'last_30days';
603
  $default_date_format = ( isset( $options['default_date_format'] ) && $options['default_date_format'] != '' ) ? $options['default_date_format'] : 'ymd_with_week';
604
  $enable_hover_tooltip = ( isset( $options['enable_hover_tooltip'] ) && $options['enable_hover_tooltip'] != '' ) ? $options['enable_hover_tooltip'] : '';
605
  $screen = get_current_screen();
606
+ if ( strpos( $screen->base, 'gawd' ) !== false || strpos( $screen->post_type, 'page' ) !== false || strpos( $screen->post_type, 'post' ) !== false || strpos( $screen->base, 'dashboard' ) !== false || strpos( $screen->base, 'edit' ) !== false) {
607
  wp_enqueue_script( 'common' );
608
  wp_enqueue_script( 'wp-lists' );
609
  wp_enqueue_script( 'postbox' );
669
  'date_this_month' => date( 'Y-m-01' ) . '/-/' . date( 'Y-m-d' ),
670
  'date_today' => date( 'Y-m-d' ) . '/-/' . date( 'Y-m-d' ),
671
  'date_yesterday' => date( 'Y-m-d', strtotime( '-1 day' ) ) . '/-/' . date( 'Y-m-d', strtotime( '-1 day' ) ),
672
+ 'exportUrl' => add_query_arg( array( 'action' => 'gawd_export' ), admin_url( 'admin-ajax.php' ) ),
673
+ 'show_report_page' => $show_report_page
674
  ) );
675
  }
676
  }
705
  $permission, //$capability
706
  'gawd_analytics', //$menu_slug
707
  array( $this, $this->gawd_set_display( 'gawd_display_overview_page' ) ), //$function = '',
708
+ GAWD_URL . '/assets/main_icon.png',25,13 );
 
 
709
 
710
  add_submenu_page(
711
  'gawd_analytics', //$parent_slug
1046
  $gawd_client = GAWD_google_client::get_instance();
1047
  $profiles = $gawd_client->get_profiles();
1048
  $gawd_user_data = get_option( 'gawd_user_data' );
1049
+ $gawd_settings = get_option('gawd_settings');
1050
  if ( isset( $_POST['gawd_id'] ) ) {
1051
  $gawd_user_data['gawd_id'] = isset( $_POST['gawd_id'] ) ? $_POST['gawd_id'] : '';
1052
  foreach ( $gawd_user_data['gawd_profiles'] as $web_property_name => $web_property ) {
1175
  $settings['enable_hover_tooltip'] = 'on';
1176
  $settings['gawd_show_in_dashboard'] = 'on';
1177
  $settings['post_page_chart'] = 'on';
1178
+ $settings['show_report_page'] = 'off';
1179
  update_option( 'gawd_settings', $settings );
1180
  }
1181
 
2129
  "childs" => array(),
2130
  "desc" => "Real Time statistics show the number of active users currently visiting your website pages."
2131
  ),
2132
+ "Pro" => array(
2133
+ "title" => __( "Available in pro", "gawd" ),
2134
+ "childs" => array(),
2135
+ "desc" => ""
2136
+ ),
2137
  "demographics" => array(
2138
  "title" => __( "Demographics", "gawd" ),
2139
  "childs" => array(
google-analytics-wd.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: https://web-dorado.com/products/wordpress-google-analytics-plugin.html
6
  * Description: Google Analytics WD is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.
7
- * Version: 1.0.7
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -26,7 +26,7 @@ if (!defined('GAWD_INC')) {
26
  }
27
 
28
  if (!defined('GAWD_VERSION')) {
29
- define('GAWD_VERSION', '1.0.7');
30
  }
31
 
32
  require_once( 'gawd_class.php' );
4
  * Plugin Name: Google Analytics
5
  * Plugin URI: https://web-dorado.com/products/wordpress-google-analytics-plugin.html
6
  * Description: Google Analytics WD is a user-friendly all in one plugin, which allows to manage and monitor your website analytics from WordPress dashboard.
7
+ * Version: 1.0.8
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
26
  }
27
 
28
  if (!defined('GAWD_VERSION')) {
29
+ define('GAWD_VERSION', '1.0.8');
30
  }
31
 
32
  require_once( 'gawd_class.php' );
inc/css/gawd_admin.css CHANGED
@@ -155,7 +155,7 @@
155
  display:inline-block;
156
  }
157
  .gawd_menu_coteiner{
158
- width:20%;
159
  float:left;
160
  background-color:#F1F1F1;
161
  margin-right:15px;
@@ -1901,10 +1901,9 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
1901
  width:21%
1902
  }
1903
  .gawd_menu_coteiner_collapse{
1904
- width: 2.6%;
1905
  float: left;
1906
  display:none;
1907
- margin-right: 12px;
1908
  }
1909
 
1910
  .gawd_menu_coteiner_collapse .gawd_menu_li span {
@@ -1912,7 +1911,7 @@ Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
1912
  }
1913
  .gawd_collapse{
1914
  cursor:pointer;
1915
- padding: 7px 0 7px 0;
1916
  }
1917
  .gawd_collapsed{
1918
  cursor: pointer;
@@ -2446,4 +2445,103 @@ th.ui-th-column div{
2446
 
2447
  #gawd_settings_logout:hover{
2448
  background-color:#c9cdd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2449
  }
155
  display:inline-block;
156
  }
157
  .gawd_menu_coteiner{
158
+ width:22%;
159
  float:left;
160
  background-color:#F1F1F1;
161
  margin-right:15px;
1901
  width:21%
1902
  }
1903
  .gawd_menu_coteiner_collapse{
1904
+ width: 3.8%;
1905
  float: left;
1906
  display:none;
 
1907
  }
1908
 
1909
  .gawd_menu_coteiner_collapse .gawd_menu_li span {
1911
  }
1912
  .gawd_collapse{
1913
  cursor:pointer;
1914
+ padding: 7px 7px 7px 0;
1915
  }
1916
  .gawd_collapsed{
1917
  cursor: pointer;
2445
 
2446
  #gawd_settings_logout:hover{
2447
  background-color:#c9cdd0
2448
+ }
2449
+ .gawd_inactive{
2450
+ padding: 7px;
2451
+ opacity: 0.5;
2452
+ }
2453
+ .gawd_inactive_pro span{
2454
+ text-transform: uppercase;
2455
+ font-weight: bold;
2456
+ color: #FB8583;
2457
+ }
2458
+
2459
+ .gawd_pro_popup_overlay{
2460
+ display: none;
2461
+ background-color: rgba(0, 0, 0, 0.4);
2462
+ position: fixed;
2463
+ top: 0;
2464
+ left: 0;
2465
+ width: 100%;
2466
+ height: 100%;
2467
+ z-index: 99998;
2468
+ }
2469
+
2470
+ .gawd_pro_popup{
2471
+ display: none;
2472
+ text-align: center;
2473
+ position: fixed;
2474
+ top: 0;
2475
+ left: 0;
2476
+ right:0;
2477
+ bottom:0;
2478
+ margin:auto;
2479
+ width: 42%;
2480
+ height: 350px;
2481
+ z-index: 99999;
2482
+ padding: 20px;
2483
+ overflow:auto;
2484
+ background-image:url("../../assets/bg.png")
2485
+ }
2486
+ .close_btn_cont{
2487
+ position: relative;
2488
+ }
2489
+ .gawd_pro_popup_btn {
2490
+ color: #ffffff;
2491
+ padding: 10px 10px;
2492
+ text-decoration: none;
2493
+ position: absolute;
2494
+ right: -18px;
2495
+ top: -18px;
2496
+ z-index: 999999;
2497
+ background-repeat: no-repeat;
2498
+ cursor: pointer;
2499
+ background-position: 52% 25%;
2500
+ background-image: url(../../assets/close.png);
2501
+ }
2502
+ .gawd_pro_text{
2503
+ font-size:16px;
2504
+ margin:20px 0 10px
2505
+ }
2506
+ .gawd_pro_popup h3{
2507
+ color:#6C9BB4
2508
+ }
2509
+ .img_wrap{
2510
+ text-align:center;
2511
+ margin-top:20px
2512
+ }
2513
+ .img_wrap img{
2514
+ width:109px;
2515
+ height:133px;
2516
+ }
2517
+ .buttons_wrap{
2518
+ text-align:center;
2519
+ }
2520
+ #gawd_buy_now, #gawd_try_demo{
2521
+ background-color: rgb(125,181,216);
2522
+ color: #fff;
2523
+ font-size: 13px;
2524
+ line-height: 30px;
2525
+ width: 95px;
2526
+ height: 30px;
2527
+ display: table;
2528
+ padding: 0px 10px 2px;
2529
+ cursor: pointer;
2530
+ border-bottom:3px solid #6898b2;
2531
+ -webkit-appearance: none;
2532
+ white-space: nowrap;
2533
+ -webkit-box-sizing: border-box;
2534
+ -moz-box-sizing: border-box;
2535
+ box-sizing: border-box;
2536
+ border-radius: 2px;
2537
+ text-decoration:none;
2538
+ color: #FFFFFF;
2539
+ margin: 8px auto 5px auto;
2540
+
2541
+ }
2542
+ #gawd_buy_now:hover, #gawd_try_demo:hover{
2543
+ text-decoration:none;
2544
+ color: #fff;
2545
+ background-color: rgba(125,181,216,0.8);
2546
+ border:1px;
2547
  }
inc/js/gawd_admin.js CHANGED
@@ -803,13 +803,26 @@ function gawd_draw_analytics() {
803
  jQuery('#chartdiv').height(500);
804
  jQuery("#chartdiv").show();
805
  var dimension = jQuery("#gawd_tab").val();
806
- if(dimension == 'adsense' || dimension == 'adGroup' || dimension == 'productCategory' || dimension == 'productName' || dimension == 'productSku' || dimension == 'transactionId' || dimension == 'sales_performance' || dimension == 'daysToTransaction'){
807
- jQuery('#gawd_right_conteiner div').remove();
808
- var message = '<div><h4><a target="_blank" href="https://web-dorado.com/products/wordpress-google-analytics-plugin.html" class="gawd_pro"> This feature is available in Google Analytics WD Pro. </a></h4></div>';
809
- jQuery('#gawd_right_conteiner').append(message);
810
- dimension == 'pro';
811
- return;
 
 
 
812
  }
 
 
 
 
 
 
 
 
 
 
813
  var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
814
  var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
815
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
@@ -2427,6 +2440,13 @@ function show_hide(obj) {
2427
  jQuery('.gawd_menu_coteiner').removeClass("gawd_open");
2428
  }
2429
  jQuery(document).ready(function () {
 
 
 
 
 
 
 
2430
  jQuery('#gawd_add_property').on('click', function(){
2431
  var empty_name = false;
2432
  jQuery("#gawd_property_name").removeClass('gawd_invalid')
@@ -2438,11 +2458,29 @@ jQuery(document).ready(function () {
2438
  jQuery('#add_property').val('1');
2439
  jQuery('#gawd_property_add').submit();
2440
  }
2441
- })
2442
- jQuery('#gawd_ecommerce_ul li, #gawd_adWords, #gawd_adsense, #gawd_custom, #gawd_customReport').on('click', function(){
2443
- alert('This feature is available in WD Google Analytics Pro.');
2444
- return;
2445
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2446
  //show_hide(jQuery("#gawd_authenicate"));
2447
  jQuery('#gawd_page_title').text(jQuery('.gawd_active_li').text());
2448
  jQuery('#gawd_reset_button').on('click',function(){
@@ -2951,6 +2989,7 @@ function sec_to_normal(data){
2951
  var secs = (Math.ceil(data % 60)).toString().length < 2 ? '0' + Math.ceil(data % 60) : Math.ceil(data % 60);
2952
  return data = hours + ':' + mins + ':' + secs;
2953
  }
 
2954
  function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_sum,start_date, end_date){
2955
  _data = JSON.parse(_data);
2956
  data = JSON.parse(data);
@@ -2958,12 +2997,37 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
2958
  var all_pages = new Array();
2959
  var max_length_data = _data.length >= data.length ? _data : data;
2960
  var min_length_data = _data.length >= data.length ? data : _data;
 
 
 
2961
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2962
 
2963
- var max_length = _data.length >= data.length ? _data.length : data.length;
2964
-
2965
 
2966
- for(var i=0 ;i<max_length; i++){
2967
  all_pages[max_length_data[i][metrics[1]]] = new Array();
2968
  all_pages[max_length_data[i][metrics[1]]].push('no', 'no');
2969
  }
@@ -2985,6 +3049,7 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
2985
  all_pages[max_length_data[j][metrics[1]]][1] = data[j];
2986
  }
2987
  }
 
2988
  var table = '<table border="1" class="gawd_page_table">';
2989
  table += '<thead>';
2990
  table += '<tr>';
@@ -3074,7 +3139,7 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3074
  }
3075
  else{
3076
  var percentage_of_total = isNaN(parseFloat(line_value)/_data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/_data_sum[metrics[j]])*100).toFixed(2);
3077
- line_value = parseFloat(line_value).toFixed(2) + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
3078
  }
3079
  table += '<td style="text-align:right">' + line_value + '</td>';
3080
  }
@@ -3107,7 +3172,7 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3107
  }
3108
  else{
3109
  var percentage_of_total = isNaN(parseFloat(line_value)/data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/data_sum[metrics[j]])*100).toFixed(2);
3110
- line_value = parseFloat(line_value).toFixed(2) + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
3111
  }
3112
  table += '<td style="text-align:right">' + line_value + '</td>';
3113
  }
@@ -3138,7 +3203,9 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3138
  single_data = 0;
3139
  }
3140
  if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
 
3141
  _single_data = _single_data.toString().split(":");
 
3142
  if(_single_data[0].indexOf('0') == 0){
3143
  _single_data[0] = _single_data[0].substr(1);
3144
  _single_data[0] = _single_data[0];
@@ -3153,7 +3220,10 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3153
  _single_data[2] = _single_data[2];
3154
  }
3155
  }
3156
- _single_data = parseInt(_single_data[0] + typeof _single_data[1] == 'undefined' ? 0 : _single_data[1] + typeof _single_data[2] == 'undefined' ? 0 : _single_data[2]);
 
 
 
3157
  single_data = single_data.toString().split(":");
3158
  if(single_data[0].indexOf('0') == 0){
3159
  single_data[0] = single_data[0].substr(1);
@@ -3169,10 +3239,14 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3169
  single_data[2] = single_data[2];
3170
  }
3171
  }
3172
- single_data = parseInt(single_data[0] + typeof single_data[1] == 'undefined' ? 0 : single_data[1] + typeof single_data[2] == 'undefined' ? 0 : single_data[2]);
 
 
 
3173
  }
3174
  var single_percent = (((_single_data - single_data)/single_data) * 100).toFixed(2);
3175
- single_percent = isNaN(single_percent) ? 0 : isFinite(single_percent) ? single_percent : '&infin;';
 
3176
  table += '<td style="font-weight:bold;text-align:right">' + single_percent + '%</td>';
3177
  }
3178
  }
@@ -3187,6 +3261,7 @@ function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_s
3187
  jQuery('.gawd_chart_conteiner').append(table);
3188
  jQuery(".gawd_page_table").paging();
3189
  }
 
3190
  function gawd_draw_table(data, metric, metric_compare, dimension, dataSums) {
3191
  jQuery('.gawd_page_table').remove();
3192
  jQuery('.paging-nav').remove();
803
  jQuery('#chartdiv').height(500);
804
  jQuery("#chartdiv").show();
805
  var dimension = jQuery("#gawd_tab").val();
806
+
807
+ if(gawd_admin.show_report_page == 'on'){
808
+ if(dimension == 'adsense' || dimension == 'adGroup' || dimension == 'productCategory' || dimension == 'productName' || dimension == 'productSku' || dimension == 'transactionId' || dimension == 'sales_performance' || dimension == 'daysToTransaction'){
809
+ jQuery('#gawd_right_conteiner div').remove();
810
+ var message = '<div><h4><a target="_blank" href="https://web-dorado.com/products/wordpress-google-analytics-plugin.html" class="gawd_pro"> This feature is available in Google Analytics WD Pro. </a></h4></div>';
811
+ jQuery('#gawd_right_conteiner').append(message);
812
+ dimension == 'pro';
813
+ return;
814
+ }
815
  }
816
+ else{
817
+ if(dimension != 'date' && dimension != 'realTime'){
818
+ jQuery('#gawd_right_conteiner div').remove();
819
+ var message = '<div><h4><a target="_blank" href="https://web-dorado.com/products/wordpress-google-analytics-plugin.html" class="gawd_pro"> This feature is available in Google Analytics WD Pro. </a></h4></div>';
820
+ jQuery('#gawd_right_conteiner').append(message);
821
+ dimension == 'pro';
822
+ return;
823
+ }
824
+ }
825
+
826
  var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
827
  var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
828
  var start_end_date = typeof jQuery('#gawd_start_end_date').val() != 'undefined' ? jQuery('#gawd_start_end_date').val() : start_date_7 + '/-/' + _end_date;
2440
  jQuery('.gawd_menu_coteiner').removeClass("gawd_open");
2441
  }
2442
  jQuery(document).ready(function () {
2443
+ if(gawd_admin.show_report_page == 'on'){
2444
+ jQuery('#gawd_ecommerce_ul li, #gawd_adWords, #gawd_adsense, #gawd_custom, #gawd_customReport').on('click', function(){
2445
+ alert('This feature is available in WD Google Analytics Pro.');
2446
+ return;
2447
+ })
2448
+ }
2449
+ //jQuery('#gawd_email_time_input').timepicker({ 'scrollDefault': 'now','timeFormat': 'H:i' });
2450
  jQuery('#gawd_add_property').on('click', function(){
2451
  var empty_name = false;
2452
  jQuery("#gawd_property_name").removeClass('gawd_invalid')
2458
  jQuery('#add_property').val('1');
2459
  jQuery('#gawd_property_add').submit();
2460
  }
2461
+ });
2462
+ if(gawd_admin.show_report_page == 'off'){
2463
+ jQuery('.gawd_inactive').each(function () {
2464
+ if(jQuery(this).find('ul').length >0){
2465
+ jQuery(this).find('ul').find('li').on('click', function(){
2466
+ jQuery(".gawd_pro_popup").fadeIn('fast');
2467
+ jQuery(".gawd_pro_popup_overlay").fadeIn('fast');
2468
+ });
2469
+ }
2470
+ else{
2471
+ jQuery(this).on('click', function(){
2472
+ jQuery(".gawd_pro_popup").fadeIn('fast');
2473
+ jQuery(".gawd_pro_popup_overlay").fadeIn('fast');
2474
+ });
2475
+ }
2476
+ });
2477
+ jQuery(".gawd_pro_popup_overlay, .gawd_pro_popup_btn").on('click', function () {
2478
+ jQuery(".gawd_pro_popup").fadeOut('fast');
2479
+ jQuery(".gawd_pro_popup_overlay").fadeOut('fast');
2480
+ })
2481
+ }
2482
+
2483
+
2484
  //show_hide(jQuery("#gawd_authenicate"));
2485
  jQuery('#gawd_page_title').text(jQuery('.gawd_active_li').text());
2486
  jQuery('#gawd_reset_button').on('click',function(){
2989
  var secs = (Math.ceil(data % 60)).toString().length < 2 ? '0' + Math.ceil(data % 60) : Math.ceil(data % 60);
2990
  return data = hours + ':' + mins + ':' + secs;
2991
  }
2992
+
2993
  function gawd_draw_table_pages_compare(_data, data, dimension, data_sum, _data_sum,start_date, end_date){
2994
  _data = JSON.parse(_data);
2995
  data = JSON.parse(data);
2997
  var all_pages = new Array();
2998
  var max_length_data = _data.length >= data.length ? _data : data;
2999
  var min_length_data = _data.length >= data.length ? data : _data;
3000
+
3001
+ var max_length = max_length_data.length;
3002
+ var min_length = min_length_data.length;
3003
 
3004
+ var min_paths = [];
3005
+ for(var i=0 ;i<min_length; i++){
3006
+ min_paths.push(min_length_data[i][metrics[1]]);
3007
+ }
3008
+
3009
+ for(var i=0 ;i<max_length; i++){
3010
+ all_pages[max_length_data[i][metrics[1]]] = new Array();
3011
+ all_pages[max_length_data[i][metrics[1]]][0] = max_length_data[i];
3012
+ if(typeof min_length_data[i] == 'undefined' || min_paths.indexOf(max_length_data[i][metrics[1]]) == -1){
3013
+ all_pages[max_length_data[i][metrics[1]]][1] = 'no';
3014
+ }
3015
+ else{
3016
+ var key = i;
3017
+ for(var j=0; j<min_length; j++){
3018
+ if(min_length_data[j][metrics[1]] == max_length_data[i][metrics[1]]){
3019
+ key = j;
3020
+ break;
3021
+ }
3022
+ }
3023
+ all_pages[max_length_data[i][metrics[1]]][1] = min_length_data[key];
3024
+ }
3025
+ }
3026
+
3027
 
3028
+
 
3029
 
3030
+ /*for(var i=0 ;i<max_length; i++){
3031
  all_pages[max_length_data[i][metrics[1]]] = new Array();
3032
  all_pages[max_length_data[i][metrics[1]]].push('no', 'no');
3033
  }
3049
  all_pages[max_length_data[j][metrics[1]]][1] = data[j];
3050
  }
3051
  }
3052
+ */
3053
  var table = '<table border="1" class="gawd_page_table">';
3054
  table += '<thead>';
3055
  table += '<tr>';
3139
  }
3140
  else{
3141
  var percentage_of_total = isNaN(parseFloat(line_value)/_data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/_data_sum[metrics[j]])*100).toFixed(2);
3142
+ line_value = (line_value).toLocaleString() + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
3143
  }
3144
  table += '<td style="text-align:right">' + line_value + '</td>';
3145
  }
3172
  }
3173
  else{
3174
  var percentage_of_total = isNaN(parseFloat(line_value)/data_sum[metrics[j]]) ? 0 : ((parseFloat(line_value)/data_sum[metrics[j]])*100).toFixed(2);
3175
+ line_value = (line_value).toLocaleString() + ' <span class="row_percent">(' + percentage_of_total +'%)</span>';
3176
  }
3177
  table += '<td style="text-align:right">' + line_value + '</td>';
3178
  }
3203
  single_data = 0;
3204
  }
3205
  if(metrics[j] == 'Avg Time On Page' || metrics[j] == 'Avg Page Load Time' || metrics[j] == 'Avg Session Duration'){
3206
+
3207
  _single_data = _single_data.toString().split(":");
3208
+
3209
  if(_single_data[0].indexOf('0') == 0){
3210
  _single_data[0] = _single_data[0].substr(1);
3211
  _single_data[0] = _single_data[0];
3220
  _single_data[2] = _single_data[2];
3221
  }
3222
  }
3223
+ var a = typeof _single_data[0] == 'undefined' ? 0 : parseInt(_single_data[0]);
3224
+ var b = typeof _single_data[1] == 'undefined' ? 0 : parseInt(_single_data[1]);
3225
+ var c = typeof _single_data[2] == 'undefined' ? 0 : parseInt(_single_data[2]);
3226
+ _single_data = a + b + c;
3227
  single_data = single_data.toString().split(":");
3228
  if(single_data[0].indexOf('0') == 0){
3229
  single_data[0] = single_data[0].substr(1);
3239
  single_data[2] = single_data[2];
3240
  }
3241
  }
3242
+ var a = typeof single_data[0] == 'undefined' ? 0 : parseInt(single_data[0]);
3243
+ var b = typeof single_data[1] == 'undefined' ? 0 : parseInt(single_data[1]);
3244
+ var c = typeof single_data[2] == 'undefined' ? 0 : parseInt(single_data[2]);
3245
+ single_data = a + b + c;
3246
  }
3247
  var single_percent = (((_single_data - single_data)/single_data) * 100).toFixed(2);
3248
+ single_percent = isNaN(single_percent) ? '&infin;' : isFinite(single_percent) ? single_percent : '&infin;';
3249
+
3250
  table += '<td style="font-weight:bold;text-align:right">' + single_percent + '%</td>';
3251
  }
3252
  }
3261
  jQuery('.gawd_chart_conteiner').append(table);
3262
  jQuery(".gawd_page_table").paging();
3263
  }
3264
+
3265
  function gawd_draw_table(data, metric, metric_compare, dimension, dataSums) {
3266
  jQuery('.gawd_page_table').remove();
3267
  jQuery('.paging-nav').remove();
include/gawd-notices-class.php CHANGED
@@ -85,14 +85,14 @@ class GAWD_Notices {
85
  $admin_display_msg = (isset($admin_notices[$slug]['msg']) ? $admin_notices[$slug]['msg'] : '');
86
  $admin_display_title = (isset($admin_notices[$slug]['title']) ? $admin_notices[$slug]['title'] : '');
87
  $admin_display_link = (isset($admin_notices[$slug]['link']) ? $admin_notices[$slug]['link'] : '');
88
- $output_css = false;
89
-
90
  // Ensure the notice hasn't been hidden and that the current date is after the start date
91
- if ($admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date)) {
92
 
93
  // Get remaining query string
94
  $query_str = (isset($admin_notices[$slug]['later_link']) ? $admin_notices[$slug]['later_link'] : esc_url(add_query_arg($this->prefix . '_admin_notice_ignore', $slug)));
95
- if (strpos($slug, 'promo') === FALSE) {
96
  // Admin notice display output
97
  echo '<div class="update-nag wd-admin-notice">
98
  <div class="' . $this->prefix . '-notice-logo"></div>
@@ -112,14 +112,15 @@ class GAWD_Notices {
112
  echo '</div>';
113
  }
114
  $this->notice_spam += 1;
115
- $output_css = true;
116
- }
117
- if ($output_css) {
118
- wp_enqueue_style('gawd-admin-notices', GAWD_URL . '/inc/css/notices.css', array(), GAWD_VERSION);
119
- }
120
- }
121
- }
122
- }
 
123
 
124
  // Spam protection check
125
  public function anti_notice_spam() {
85
  $admin_display_msg = (isset($admin_notices[$slug]['msg']) ? $admin_notices[$slug]['msg'] : '');
86
  $admin_display_title = (isset($admin_notices[$slug]['title']) ? $admin_notices[$slug]['title'] : '');
87
  $admin_display_link = (isset($admin_notices[$slug]['link']) ? $admin_notices[$slug]['link'] : '');
88
+ $output_css = false;
89
+
90
  // Ensure the notice hasn't been hidden and that the current date is after the start date
91
+ if ($admin_display_check == 0 && strtotime($admin_display_start) <= strtotime($current_date)) {
92
 
93
  // Get remaining query string
94
  $query_str = (isset($admin_notices[$slug]['later_link']) ? $admin_notices[$slug]['later_link'] : esc_url(add_query_arg($this->prefix . '_admin_notice_ignore', $slug)));
95
+ if (strpos($slug, 'promo') === FALSE) {
96
  // Admin notice display output
97
  echo '<div class="update-nag wd-admin-notice">
98
  <div class="' . $this->prefix . '-notice-logo"></div>
112
  echo '</div>';
113
  }
114
  $this->notice_spam += 1;
115
+ $output_css = true;
116
+ $output_css = true;
117
+ }
118
+ if ($output_css) {
119
+ wp_enqueue_style('gawd-admin-notices', GAWD_URL . '/inc/css/notices.css', array(), GAWD_VERSION);
120
+ }
121
+ }
122
+ }
123
+ }
124
 
125
  // Spam protection check
126
  public function anti_notice_spam() {
include/gawd_csv_file.php CHANGED
@@ -1,551 +1,558 @@
1
- <?php
2
-
3
- include_once GAWD_DIR . '/include/gawd_file.php';
4
-
5
- class GAWD_CSV_FILE extends GAWD_FILE {
6
-
7
- public $file_type = 'csv';
8
- private $file_dir_option = 'gawd_export_csv_url';
9
- public function __construct() {
10
-
11
- }
12
-
13
- public function export_file($flag=true) {
14
- $fullPath = get_option($this->file_dir_option);
15
- if ($fd = fopen($fullPath, "r")) {
16
-
17
- $fsize = filesize($fullPath);
18
- $path_parts = pathinfo($fullPath);
19
- $ext = strtolower($path_parts["extension"]);
20
- $this->file_name = $path_parts["basename"];
21
- $this->send_headers();
22
-
23
- while (!feof($fd)) {
24
- $buffer = fread($fd, 2048);
25
- echo $buffer;
26
- }
27
- }
28
- fclose($fd);
29
-
30
- /* //$this->set_file_dir();
31
- $this->send_headers();
32
- $this->output = fopen('php://output', 'w');
33
- $this->put_csv();
34
- @fclose($this->output);*/
35
- die;
36
- }
37
-
38
- public function create_file() {
39
- $this->set_file_dir();
40
- $this->output = fopen($this->file_dir, "w");
41
- $this->put_csv();
42
- chmod($this->file_dir, 0777);
43
- @fclose($this->output);
44
- update_option($this->file_dir_option, $this->file_dir);
45
- return $this->file_dir;
46
- }
47
-
48
- private function put_csv() {
49
- //
50
- if($this->first_data != ''){
51
- if($this->_data_compare != ""){
52
- $columns = $this->get_columns();
53
- }
54
- else{
55
- $columns = $this->get_columns_compared_pages();
56
- }
57
- }
58
- elseif($this->_data_compare != ""){
59
- $columns = $this->get_compared_data();
60
- }
61
- else{
62
- $columns = $this->get_columns();
63
- }
64
- echo "\xEF\xBB\xBF";
65
- fputcsv($this->output, array($this->site_title), ',');
66
- $date_text = ucfirst($this->name);
67
- if($this->_data_compare != ''){
68
- $date_text .= '(' . date('M d, Y', strtotime($this->start_date)) . ' - ' . date('M d, Y', strtotime($this->end_date)) . ') -compare- (' . date('M d, Y', strtotime($this->second_start_date)) . ' - ' . date('M d, Y', strtotime($this->second_end_date)) . ')';
69
- }
70
- else{
71
- $date_text .= ' (' . $this->start_date . ' - ' . $this->end_date . ')';
72
- }
73
- fputcsv($this->output, array($date_text), ',');
74
- foreach ($columns as $line) {
75
- fputcsv($this->output, $line, ',');
76
- }
77
- }
78
- private function get_compared_data(){
79
- $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
80
- $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
81
- $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
82
- //$this->column_names[] = $this->metric . ' compare';
83
- $columns = array($this->column_names);
84
- foreach ($this->_data_compare as $dat => $value) {
85
- $temp = array();
86
- foreach ($this->column_names as $cols) {
87
- $cols = trim($cols);
88
- $val = $value[$cols];
89
- if($cols == 'Bounce Rate' || $cols == 'Bounce Rate compare' || $cols == 'Exit Rate compare' || $cols == 'Exit Rate' || $cols == 'Ecommerce Conversion Rate' || $cols == 'Percent New Sessions' || $cols == 'Percent New Sessions compare' || $cols == 'Transactions Per Session'){
90
- $val = number_format(floatval($val),2, '.', ',') . '%';
91
- }
92
- else if($cols == 'Page Value' || $cols == 'Revenue' || $cols == 'Transaction Revenue'){
93
- $percentage_of_total = $this->data_sum[$cols] != '0' ? floatval($val)/$this->data_sum[$cols]*100 : 0;
94
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
95
- $val = '$' . number_format(floatval($val),2, '.', ',') . ' (' . $percentage_of_total .'%)';
96
- }
97
- else if($cols == 'Pageviews Per Session'){
98
- $val = number_format(floatval($val),2, '.', ',');
99
- }
100
- else if($cols == 'Avg Time On Page' || $cols == 'Avg Page Load Time' || $cols == 'Avg Session Duration' || $cols == 'Avg Page Load Time' || $cols == 'Avg Redirection Time' || $cols == 'Avg Server Response Time' || $cols == 'Avg Page Download Time' || $cols == 'Duration'){
101
- if(strpos(':',$val) == false){
102
- $val = $this->sec_to_normal(floatval($val));
103
- }
104
- }
105
- elseif($cols == 'No' || $cols == $_REQUEST['gawd_dimension'] || $cols == $dimension || $cols == 'Week' || $cols == 'Month' || $cols == 'Hour'){
106
- $val = $val;
107
- }
108
- else{
109
- if(strpos($cols, 'compare') !== false){
110
- $compare_cols = str_replace(' compare','',$cols);
111
- $percentage_of_total = $this->second_data_sum->$compare_cols != '0' ? floatval($val)/$this->second_data_sum->$compare_cols*100 : 0;
112
- }
113
- else{
114
- $percentage_of_total = $this->first_data_sum->$cols != '0' ? floatval($val)/$this->first_data_sum->$cols*100 : 0;
115
- }
116
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
117
- $val = number_format(floatval($val),2, '.', ',') . ' (' . $percentage_of_total .'%)';
118
- }
119
- $temp[] = $val;
120
- }
121
- $columns[] = $temp;
122
- }
123
- $row = array();
124
- foreach ($this->column_names as $cols) {
125
- $cols = trim($cols);
126
- if($cols == 'No' || $cols == $dimension || $cols == 'Hour' || $cols == 'Week' || $cols == 'Month'){
127
- $row[] = ' ';
128
- }
129
- else{
130
- $val = '';
131
- $val_second = '';
132
- if($cols != trim($this->metric.' compare')){
133
- $val = $this->first_data_sum->$cols;
134
- $val_second = $this->second_data_sum->$cols;
135
- }
136
- if($cols == 'Bounce Rate'){
137
- $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
138
- $val_second = 'Avg: '.number_format(floatval($val_second),2, '.', ',') . '%';
139
- }
140
- else if($cols == 'Pageviews Per Session'){
141
- $val = 'Total: '. number_format(floatval($val),2, '.', ',');
142
- $val_second = 'Total: '. number_format(floatval($val_second),2, '.', ',');
143
- }
144
- else if($cols == 'Avg Session Duration'){
145
- $val = 'Avg: '.$this->sec_to_normal(floatval($val));
146
- $val_second = 'Avg: '.$this->sec_to_normal(floatval($val_second));
147
- }
148
- elseif($cols == 'Percent New Sessions'){
149
- $val = 'Avg: '. number_format(floatval($val),2, '.', ',').'%';
150
- $val_second = 'Avg: '. number_format(floatval($val_second),2, '.', ',').'%';
151
- }
152
- else{
153
- $val_second = $val_second != '' ? 'Total: '. number_format(floatval($val_second),2, '.', ',') : '';
154
- $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
155
-
156
- }
157
- if($val != '' && $val_second != ''){
158
- $row[] = $val;
159
- $row[] = $val_second;
160
- }
161
- }
162
- }
163
- $columns[] = $row;
164
- return $columns;
165
- }
166
- private function get_columns_compared_pages() {
167
- $this->first_data = json_decode(stripslashes($this->first_data));
168
- $this->second_data = json_decode(stripslashes($this->second_data));
169
- $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
170
- $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
171
- $dimension = isset($_REQUEST["gawd_dimension"]) ? sanitize_text_field($_REQUEST["gawd_dimension"]) : 'Date';
172
- if ($dimension == 'Page Path' || $dimension == 'pagePath') {
173
- $metrics = array(
174
- 'No','Page Path','Pageviews','Unique Pageviews',
175
- 'Avg Time On Page','Entrances','Bounce Rate',
176
- 'Exit Rate','Page Value','Avg Page Load Time'
177
- );
178
- } elseif ($dimension == 'Landing Page Path' || $dimension == 'landingPagePath') {
179
- $metrics = array(
180
- 'No','Landing Page','Sessions','Percent New Sessions','New Users','Bounce Rate','Pageviews Per Session','Avg Session Duration','Transactions','Transaction Revenue','Transactions Per Session'
181
- );
182
- }
183
-
184
- $count = count($metrics) - 1;
185
- $margin = '';
186
- if($dimension == 'pagePath'){
187
- $margin = 'margin-left:18px;';
188
- $count = 9.5;
189
- }
190
- if ($count == 0) {
191
- $no_width = "100";
192
- $row_width = '0';
193
- } else {
194
- $no_width = "5";
195
- $row_width = (95 / $count);
196
- }
197
-
198
- $all_pages = array();
199
- $max_length_data = count($this->first_data) >= count($this->second_data) ? $this->first_data : $this->second_data;
200
-
201
- $max_length = count($this->first_data) >= count($this->second_data) ? count($this->first_data) : count($this->second_data);
202
-
203
-
204
- for($i=0 ;$i<$max_length; $i++){
205
- $all_pages[$max_length_data[$i]->$metrics[1]] = array();
206
- array_push($all_pages[$max_length_data[$i]->$metrics[1]], 'no', 'no');
207
- }
208
-
209
-
210
- for($i=0 ;$i<$max_length; $i++){
211
- if(isset($this->first_data[$i])){
212
- if(!isset($all_pages[$max_length_data[$i]->$metrics[1]])){
213
- $all_pages[$max_length_data[$i]->$metrics[1]] = array();
214
- array_push($all_pages[$max_length_data[$i]->$metrics[1]], 'no', 'no');
215
- }
216
- $all_pages[$max_length_data[$i]->$metrics[1]][0] = $this->first_data[$i];
217
- }
218
- }
219
-
220
- for($j=0 ;$j<$max_length; $j++){
221
- if(isset($this->second_data[$j])){
222
-
223
- if(!isset($all_pages[$max_length_data[$j]->$metrics[1]])){
224
- $all_pages[$max_length_data[$j]->$metrics[1]] = array();
225
- array_push($all_pages[$max_length_data[$j]->$metrics[1]], 'no', 'no');
226
- }
227
- $all_pages[$max_length_data[$j]->$metrics[1]][1] = $this->second_data[$j];
228
- }
229
- }
230
- $table = array();
231
- $row = array();
232
- for($j=0 ;$j<count($metrics); $j++){
233
- $row[] = $metrics[$j];
234
- }
235
- $table[] = $row;
236
-
237
- $row = array();
238
- for($j=0 ;$j<count($metrics); $j++){
239
- if($metrics[$j] == 'No' || $metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
240
- $row[] = ' ';
241
- }
242
- else{
243
- $this->first_data_sum->$metrics[$j] = floatval($this->first_data_sum->$metrics[$j]);
244
- $this->second_data_sum->$metrics[$j] = floatval($this->second_data_sum->$metrics[$j]);
245
- $percent = number_format((($this->first_data_sum->$metrics[$j] - $this->second_data_sum->$metrics[$j])/((($this->second_data_sum->$metrics[$j])!=0) ? $this->second_data_sum->$metrics[$j] : 1)) * 100, 2, '.', ',');
246
- if(!($percent)){
247
- $percent = 0;
248
- }
249
- else if(strpos($percent, '-') === 0){
250
- $percent = substr($percent,1);
251
- }
252
- $this->second_data_sum_value = number_format($this->second_data_sum->$metrics[$j],2, '.', ',');
253
- $this->first_data_sum_value = number_format($this->first_data_sum->$metrics[$j],2, '.', ',');
254
- if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
255
- $this->second_data_sum_value = $this->sec_to_normal($this->second_data_sum_value);
256
- $this->first_data_sum_value = $this->sec_to_normal($this->first_data_sum_value);
257
- }
258
- if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
259
- $this->first_data_sum_value = number_format(floatval($this->first_data_sum_value),2, '.', ',') . '%';
260
- $this->second_data_sum_value = number_format(floatval($this->second_data_sum_value),2, '.', ',') . '%';
261
- }
262
- else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue'){
263
- $this->first_data_sum_value = '$' . number_format(floatval($this->first_data_sum_value),2, '.', ',');
264
- $this->second_data_sum_value = '$' . number_format(floatval($this->second_data_sum_value),2, '.', ',');
265
- }
266
- $row[] = sanitize_text_field($percent) . '% ' . sanitize_text_field($this->first_data_sum_value).' vs '.sanitize_text_field($this->second_data_sum_value);
267
- }
268
- }
269
- $table[] = $row;
270
- $length = count($all_pages);
271
- $keys = array_keys($all_pages);
272
- for($i=0 ;$i<$length; $i++){
273
- $row = array();
274
- $row[] = intval($i+1);
275
- $row[] = $keys[$i];
276
- $table[] = $row;
277
- $row = array();
278
- for($j = 0; $j < count($metrics); $j++){
279
- if($metrics[$j] == 'No'){
280
- $row[] = ' ';
281
- }
282
- else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
283
- $row[] = date('M d, Y', strtotime($this->start_date)) . ' - ' . date('M d, Y', strtotime($this->end_date));
284
- }
285
- else{
286
- $keys[$i] = sanitize_text_field($keys[$i]);
287
- if($all_pages[$keys[$i]][0] != 'no'){
288
- $line_value = $all_pages[$keys[$i]][0]->$metrics[$j];
289
- if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
290
- $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
291
- }
292
- else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Item Revenue'){
293
- $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
294
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
295
- $line_value = '$' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
296
- }
297
- else if($metrics[$j] == 'Pageviews Per Session'){
298
- $line_value = number_format(floatval($line_value),2, '.', ',');
299
- }
300
- else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
301
- $line_value = $this->sec_to_normal(floatval($line_value));
302
- }
303
- else{
304
- $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
305
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
306
- $line_value = number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
307
- }
308
- $row[] = $line_value;
309
- }
310
- else{
311
- $row[] = '0';
312
- }
313
- }
314
- }
315
- $table[] = $row;
316
- $row = array();
317
- for($j = 0; $j < count($metrics); $j++){
318
- if($metrics[$j] == 'No'){
319
- $row[] = ' ';
320
- }
321
- else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
322
- $row[] = date('M d, Y', strtotime($this->second_start_date)) . ' - ' . date('M d, Y', strtotime($this->second_end_date));
323
- }
324
- else{
325
- $keys[$i] = sanitize_text_field($keys[$i]);
326
- if($all_pages[$keys[$i]][1] != 'no'){
327
- $line_value = $all_pages[$keys[$i]][1]->$metrics[$j];
328
- if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
329
- $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
330
- }
331
- else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Item Revenue'){
332
- $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
333
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
334
- $line_value = '$' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
335
- }
336
- else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
337
- $line_value = $this->sec_to_normal(floatval($line_value));
338
- }
339
- else if($metrics[$j] == 'Pageviews Per Session'){
340
- $line_value = number_format(floatval($line_value),2, '.', ',');
341
- }
342
- else{
343
- $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
344
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
345
- $line_value = number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
346
- }
347
- $row[] = $line_value;
348
- }
349
- else{
350
- $row[] = '0';
351
- }
352
- }
353
- }
354
- $table[] = $row;
355
- $row = array();
356
- for($j = 0; $j < count($metrics); $j++){
357
- if($metrics[$j] == 'No'){
358
- $row[] = ' ';
359
- }
360
- else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
361
- $row[] = '% Change';
362
- }
363
- else{
364
- if($all_pages[$keys[$i]][0] != 'no'){
365
- $_single_data = $all_pages[$keys[$i]][0]->$metrics[$j];
366
- }
367
- else{
368
- $_single_data = 0;
369
- }
370
- if($all_pages[$keys[$i]][1] != 'no'){
371
- $single_data = $all_pages[$keys[$i]][1]->$metrics[$j];
372
- }
373
- else{
374
- $single_data = 0;
375
- }
376
- if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
377
- $_single_data = explode(":",$_single_data);
378
- if(strpos($_single_data[0], '0') == 0){
379
- $_single_data[0] = substr($_single_data[0],0,1);
380
- $_single_data[0] = $_single_data[0];
381
- }
382
- if(count($_single_data) > 1){
383
- if(strpos($_single_data[1],'0') == 0){
384
- $_single_data[1] = substr($_single_data[1],0,1);
385
- $_single_data[1] = $_single_data[1]*60;
386
- }
387
- if(strpos($_single_data[2],'0') == 0){
388
- $_single_data[2] = substr($_single_data[2],0,1);
389
- $_single_data[2] = $_single_data[2];
390
- }
391
- }
392
- $_single_data = intval($_single_data[0] . ((!isset($_single_data[1])) ? 0 : $_single_data[1]) . ((!isset($_single_data[2])) ? 0 : $_single_data[2]));
393
- $single_data = explode(":",$single_data);
394
- if(strpos($single_data[0], '0') == 0){
395
- $single_data[0] = substr($single_data[0],0,1);
396
- $single_data[0] = $single_data[0];
397
- }
398
- if(count($single_data) > 1){
399
- if(strpos($single_data[1],'0') == 0){
400
- $single_data[1] = substr($single_data[1],0,1);
401
- $single_data[1] = $single_data[1]*60;
402
- }
403
- if(strpos($single_data[2],'0') == 0){
404
- $single_data[2] = substr($single_data[2],0,1);
405
- $single_data[2] = $single_data[2];
406
- }
407
- }
408
- $single_data = intval($single_data[0] . ((!isset($single_data[1])) ? 0 : $single_data[1]) . ((!isset($single_data[2])) ? 0 : $single_data[2]));
409
- }
410
-
411
- $single_percent = ($single_data != 0) ? number_format((($_single_data - $single_data)/$single_data) * 100,2, '.', ',').'%' :'infinity';
412
- $row[] = $single_percent;
413
- }
414
- }
415
- $table[] = $row;
416
- }
417
- return $table;
418
- }
419
- public function sec_to_normal($data){
420
- $hours = strlen(floor($data / 3600)) < 2 ? '0' . floor($data / 3600) : floor($data / 3600);
421
- $mins = strlen(floor($data / 60 % 60)) < 2 ? '0' . floor($data / 60 % 60) : floor($data / 60 % 60);
422
- $secs = strlen(ceil($data % 60)) < 2 ? '0' . ceil($data % 60) : ceil($data % 60);
423
- return $data = $hours . ':' . $mins . ':' . $secs;
424
- }
425
- private function get_columns() {
426
- $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
427
- $columns = array($this->column_names);
428
- $_REQUEST['gawd_dimension'] = isset($_REQUEST['gawd_dimension']) ? $_REQUEST['gawd_dimension'] : $dimension;
429
- if($_REQUEST['gawd_dimension'] == "Session Duration Bucket"){
430
- $_data = array();
431
- //$j = 1;
432
- foreach($this->data as $val){
433
- if(isset($_data[$val["Session Duration Bucket"]])){
434
- $_data[$val["Session Duration Bucket"]]["Users"] += floatval($val["Users"]);
435
- $_data[$val["Session Duration Bucket"]]["Sessions"] += floatval($val["Sessions"]);
436
- $_data[$val["Session Duration Bucket"]]["Percent New Sessions"] += floatval($val["Percent New Sessions"]);
437
- $_data[$val["Session Duration Bucket"]]["Bounce Rate"] += floatval($val["Bounce Rate"]);
438
- $_data[$val["Session Duration Bucket"]]["Pageviews"] += floatval($val["Pageviews"]);
439
- $_data[$val["Session Duration Bucket"]]["Avg Session Duration"] += $val["Avg Session Duration"];
440
- }
441
- else{
442
- // $val["No"] = $j;
443
- // $j++;
444
- $_data[$val["Session Duration Bucket"]] = $val;
445
- $_data[$val["Session Duration Bucket"]]["order"] = intval($val["Session Duration Bucket"]);
446
- }
447
- }
448
- $this->data = array_values($_data);
449
- foreach ($this->data as $key => $row) {
450
- $yyy[$key] = $row['order'];
451
- }
452
- array_multisort($yyy, SORT_ASC, $this->data);
453
- foreach($this->data as $j=>$val){
454
- $val["No"] = ($j+1);
455
- $this->data[$j] = $val;
456
- }
457
- }
458
- elseif($_REQUEST['gawd_dimension'] == "daysToTransaction"){
459
- foreach ($this->data as $key => $row) {
460
- $daysToTransaction[$key] = $row['Days To Transaction'];
461
- }
462
- array_multisort($daysToTransaction, SORT_ASC, $this->data);
463
- foreach($this->data as $j=>$val){
464
- $val["No"] = ($j+1);
465
- $this->data[$j] = $val;
466
- }
467
- }
468
-
469
- foreach ($this->data as $dat => $value) {
470
- $temp = array();
471
- foreach ($this->column_names as $cols) {
472
- $cols = preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $cols))));
473
- $val = $value[$cols];
474
- if($cols == 'Bounce Rate' || $cols == 'Exit Rate' || $cols == 'Ecommerce Conversion Rate'|| $cols == 'Percent New Sessions' || $cols == 'Transactions Per Session'){
475
- $val = number_format(floatval($val),2, '.', ',') . '%';
476
- }
477
- else if($cols == 'Page Value' || $cols == 'Revenue' || $cols == 'Transaction Revenue'){
478
- $percentage_of_total = $this->data_sum[$cols] != '0' ? floatval($val)/$this->data_sum[$cols]*100 : 0;
479
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
480
- $val = '$' . number_format(floatval($val),2, '.', ',') . ' (' . $percentage_of_total .'%)';
481
- }
482
- else if($cols == 'Pageviews Per Session'){
483
- $val = number_format(floatval($val),2, '.', ',');
484
- }
485
- else if($cols == 'Avg Time On Page' || $cols == 'Avg Page Load Time' || $cols == 'Avg Session Duration' || $cols == 'Avg Page Load Time' || $cols == 'Avg Redirection Time' || $cols == 'Avg Server Response Time' || $cols == 'Avg Page Download Time' || $cols == 'Duration'){
486
- if(strpos(':',$val) == false){
487
- $val = $this->sec_to_normal(floatval($val));
488
- }
489
- }
490
- elseif($cols == 'No' || $cols == $_REQUEST['gawd_dimension'] || $cols == $dimension){
491
- $val = $val;
492
- }
493
- else{
494
- if($cols != preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $_REQUEST['gawd_dimension']))))){
495
- $percentage_of_total = isset($this->data_sum[$cols]) ? $this->data_sum[$cols] != '0' ? floatval($val)/$this->data_sum[$cols]*100 : 0 : '';
496
- if($percentage_of_total != ''){
497
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
498
- if(strlen($val) > 3){
499
- $val = number_format(floatval($val),2, '.', ',');
500
- }
501
- $val = $val .' (' . $percentage_of_total .'%)';
502
- }
503
- }
504
- }
505
- $temp[] = $val;
506
- }
507
- $columns[] = $temp;
508
- }
509
- $row = array();
510
- foreach ($this->column_names as $cols) {
511
- $cols = preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $cols))));
512
- if($cols == 'No' || $cols == $dimension || $cols == preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $_REQUEST['gawd_dimension']))))){
513
- $row[] = ' ';
514
- }
515
- else{
516
- $val = isset($this->data_sum[$cols]) ? $this->data_sum[$cols] : '';
517
- if($cols == 'Bounce Rate' || $cols == 'Exit Rate' || $cols == 'Ecommerce Conversion Rate'|| $cols == 'Percent New Sessions' || $cols == 'Transactions Per Session'){
518
- $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
519
- }
520
- else if($cols == 'Page Value' || $cols == 'Revenue' || $cols == 'Transaction Revenue'){
521
- $val = 'Total: $'.number_format(floatval($val),2, '.', ',');
522
- }
523
- else if($cols == 'Pageviews Per Session'){
524
- $val = 'Total: '. number_format(floatval($val),2, '.', ',');
525
- }
526
- else if($cols == 'Avg Time On Page' || $cols == 'Avg Page Load Time' || $cols == 'Avg Session Duration' || $cols == 'Avg Page Load Time' || $cols == 'Avg Redirection Time' || $cols == 'Avg Server Response Time' || $cols == 'Avg Page Download Time' || $cols == 'Duration'){
527
- $val = 'Avg: '.$this->sec_to_normal(floatval($val));
528
- }
529
- else{
530
- $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
531
- }
532
- $row[] = $val;
533
- }
534
- }
535
- $columns[] = $row;
536
- return $columns;
537
- }
538
-
539
- private function send_headers() {
540
- header('Content-Description: File Transfer');
541
- header('Content-Type: application/octet-stream');
542
- header('Content-Transfer-Encoding: binary');
543
- header('Expires: 0');
544
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
545
- header('Pragma: public');
546
-
547
- header('Content-Type: text/csv; charset=utf-8');
548
- header('Content-Disposition: attachment; filename=' . $this->file_name . '.csv');
549
- }
550
-
551
- }
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once GAWD_DIR . '/include/gawd_file.php';
4
+
5
+ class GAWD_CSV_FILE extends GAWD_FILE {
6
+
7
+ public $file_type = 'csv';
8
+ private $file_dir_option = 'gawd_export_csv_url';
9
+ public function __construct() {
10
+
11
+ }
12
+
13
+ public function export_file($flag=true) {
14
+ $fullPath = get_option($this->file_dir_option);
15
+ if ($fd = fopen($fullPath, "r")) {
16
+
17
+ $fsize = filesize($fullPath);
18
+ $path_parts = pathinfo($fullPath);
19
+ $ext = strtolower($path_parts["extension"]);
20
+ $this->file_name = $path_parts["basename"];
21
+ $this->send_headers();
22
+
23
+ while (!feof($fd)) {
24
+ $buffer = fread($fd, 2048);
25
+ echo $buffer;
26
+ }
27
+ }
28
+ fclose($fd);
29
+
30
+ /* //$this->set_file_dir();
31
+ $this->send_headers();
32
+ $this->output = fopen('php://output', 'w');
33
+ $this->put_csv();
34
+ @fclose($this->output);*/
35
+ die;
36
+ }
37
+
38
+ public function create_file() {
39
+ $this->set_file_dir();
40
+ $this->output = fopen($this->file_dir, "w");
41
+ $this->put_csv();
42
+ chmod($this->file_dir, 0777);
43
+ @fclose($this->output);
44
+ update_option($this->file_dir_option, $this->file_dir);
45
+ return $this->file_dir;
46
+ }
47
+
48
+ private function put_csv() {
49
+ //
50
+ if($this->first_data != ''){
51
+ if($this->_data_compare != ""){
52
+ $columns = $this->get_columns();
53
+ }
54
+ else{
55
+ $columns = $this->get_columns_compared_pages();
56
+ }
57
+ }
58
+ elseif($this->_data_compare != ""){
59
+ $columns = $this->get_compared_data();
60
+ }
61
+ else{
62
+ $columns = $this->get_columns();
63
+ }
64
+ echo "\xEF\xBB\xBF";
65
+ fputcsv($this->output, array($this->site_title), ',');
66
+ $date_text = ucfirst($this->name);
67
+ if($this->_data_compare != ''){
68
+ $date_text .= '(' . date('M d, Y', strtotime($this->start_date)) . ' - ' . date('M d, Y', strtotime($this->end_date)) . ') -compare- (' . date('M d, Y', strtotime($this->second_start_date)) . ' - ' . date('M d, Y', strtotime($this->second_end_date)) . ')';
69
+ }
70
+ else{
71
+ $date_text .= ' (' . $this->start_date . ' - ' . $this->end_date . ')';
72
+ }
73
+ fputcsv($this->output, array($date_text), ',');
74
+ foreach ($columns as $line) {
75
+ fputcsv($this->output, $line, ',');
76
+ }
77
+ }
78
+ private function get_compared_data(){
79
+ $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
80
+ $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
81
+ $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
82
+ //$this->column_names[] = $this->metric . ' compare';
83
+ $columns = array($this->column_names);
84
+ foreach ($this->_data_compare as $dat => $value) {
85
+ $temp = array();
86
+ foreach ($this->column_names as $cols) {
87
+ $cols = trim($cols);
88
+ $val = $value[$cols];
89
+ if($cols == 'Bounce Rate' || $cols == 'Bounce Rate compare' || $cols == 'Exit Rate compare' || $cols == 'Exit Rate' || $cols == 'Ecommerce Conversion Rate' || $cols == 'Percent New Sessions' || $cols == 'Percent New Sessions compare' || $cols == 'Transactions Per Session'){
90
+ $val = number_format(floatval($val),2, '.', ',') . '%';
91
+ }
92
+ else if($cols == 'Page Value' || $cols == 'Revenue' || $cols == 'Transaction Revenue'){
93
+ $percentage_of_total = $this->data_sum[$cols] != '0' ? floatval($val)/$this->data_sum[$cols]*100 : 0;
94
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
95
+ $val = '$' . number_format(floatval($val),2, '.', ',') . ' (' . $percentage_of_total .'%)';
96
+ }
97
+ else if($cols == 'Pageviews Per Session'){
98
+ $val = number_format(floatval($val),2, '.', ',');
99
+ }
100
+ else if($cols == 'Avg Time On Page' || $cols == 'Avg Page Load Time' || $cols == 'Avg Session Duration' || $cols == 'Avg Page Load Time' || $cols == 'Avg Redirection Time' || $cols == 'Avg Server Response Time' || $cols == 'Avg Page Download Time' || $cols == 'Duration'){
101
+ if(strpos(':',$val) == false){
102
+ $val = $this->sec_to_normal(floatval($val));
103
+ }
104
+ }
105
+ elseif($cols == 'No' || $cols == $_REQUEST['gawd_dimension'] || $cols == $dimension || $cols == 'Week' || $cols == 'Month' || $cols == 'Hour'){
106
+ $val = $val;
107
+ }
108
+ else{
109
+ if(strpos($cols, 'compare') !== false){
110
+ $compare_cols = str_replace(' compare','',$cols);
111
+ $percentage_of_total = $this->second_data_sum->$compare_cols != '0' ? floatval($val)/$this->second_data_sum->$compare_cols*100 : 0;
112
+ }
113
+ else{
114
+ $percentage_of_total = $this->first_data_sum->$cols != '0' ? floatval($val)/$this->first_data_sum->$cols*100 : 0;
115
+ }
116
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
117
+ $val = number_format(floatval($val),2, '.', ',') . ' (' . $percentage_of_total .'%)';
118
+ }
119
+ $temp[] = $val;
120
+ }
121
+ $columns[] = $temp;
122
+ }
123
+ $row = array();
124
+ foreach ($this->column_names as $cols) {
125
+ $cols = trim($cols);
126
+ if($cols == 'No' || $cols == $dimension || $cols == 'Hour' || $cols == 'Week' || $cols == 'Month'){
127
+ $row[] = ' ';
128
+ }
129
+ else{
130
+ $val = '';
131
+ $val_second = '';
132
+ if($cols != trim($this->metric.' compare')){
133
+ $val = $this->first_data_sum->$cols;
134
+ $val_second = $this->second_data_sum->$cols;
135
+ }
136
+ if($cols == 'Bounce Rate'){
137
+ $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
138
+ $val_second = 'Avg: '.number_format(floatval($val_second),2, '.', ',') . '%';
139
+ }
140
+ else if($cols == 'Pageviews Per Session'){
141
+ $val = 'Total: '. number_format(floatval($val),2, '.', ',');
142
+ $val_second = 'Total: '. number_format(floatval($val_second),2, '.', ',');
143
+ }
144
+ else if($cols == 'Avg Session Duration'){
145
+ $val = 'Avg: '.$this->sec_to_normal(floatval($val));
146
+ $val_second = 'Avg: '.$this->sec_to_normal(floatval($val_second));
147
+ }
148
+ elseif($cols == 'Percent New Sessions'){
149
+ $val = 'Avg: '. number_format(floatval($val),2, '.', ',').'%';
150
+ $val_second = 'Avg: '. number_format(floatval($val_second),2, '.', ',').'%';
151
+ }
152
+ else{
153
+ $val_second = $val_second != '' ? 'Total: '. number_format(floatval($val_second),2, '.', ',') : '';
154
+ $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
155
+
156
+ }
157
+ if($val != '' && $val_second != ''){
158
+ $row[] = $val;
159
+ $row[] = $val_second;
160
+ }
161
+ }
162
+ }
163
+ $columns[] = $row;
164
+ return $columns;
165
+ }
166
+ private function get_columns_compared_pages() {
167
+ $this->first_data = json_decode(stripslashes($this->first_data));
168
+ $this->second_data = json_decode(stripslashes($this->second_data));
169
+ $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
170
+ $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
171
+ $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
172
+
173
+ if ($dimension == 'Page Path' || $dimension == 'pagePath') {
174
+ $metrics = array(
175
+ 'No','Page Path','Pageviews','Unique Pageviews',
176
+ 'Avg Time On Page','Entrances','Bounce Rate',
177
+ 'Exit Rate','Page Value','Avg Page Load Time'
178
+ );
179
+ } elseif ($dimension == 'Landing Page Path' || $dimension == 'landingPagePath') {
180
+ $metrics = array(
181
+ 'No','Landing Page','Sessions','Percent New Sessions','New Users','Bounce Rate','Pageviews Per Session','Avg Session Duration','Transactions','Transaction Revenue','Transactions Per Session'
182
+ );
183
+ }
184
+
185
+ $count = count($metrics) - 1;
186
+ $margin = '';
187
+ if($dimension == 'pagePath'){
188
+ $margin = 'margin-left:18px;';
189
+ $count = 9.5;
190
+ }
191
+ if ($count == 0) {
192
+ $no_width = "100";
193
+ $row_width = '0';
194
+ } else {
195
+ $no_width = "5";
196
+ $row_width = (95 / $count);
197
+ }
198
+
199
+ $all_pages = array();
200
+ $max_length_data = count($this->first_data) >= count($this->second_data) ? $this->first_data : $this->second_data;
201
+ $min_length_data = count($this->first_data) >= count($this->second_data) ? $this->second_data : $this->first_data;
202
+
203
+ $max_length = count($max_length_data);
204
+ $min_length = count($min_length_data);
205
+
206
+
207
+ $min_paths = array();
208
+
209
+ for($i=0 ;$i<$min_length; $i++){
210
+
211
+ $min_paths[] = $min_length_data[$i]->$metrics[1];
212
+ }
213
+
214
+ for($i=0 ;$i<$max_length; $i++){
215
+ $all_pages[$max_length_data[$i]->$metrics[1]] = Array();
216
+ $all_pages[$max_length_data[$i]->$metrics[1]][0] = $max_length_data[$i];
217
+ if(!isset($min_length_data[$i]) || in_array($max_length_data[$i]->$metrics[1],$min_paths) === false){
218
+ $all_pages[$max_length_data[$i]->$metrics[1]][1] = 'no';
219
+ }
220
+ else{
221
+ $key = $i;
222
+ for($j=0; $j<$min_length; $j++){
223
+ if($min_length_data[$j]->$metrics[1] == $max_length_data[$i]->$metrics[1]){
224
+ $key = $j;
225
+ break;
226
+ }
227
+ }
228
+ $all_pages[$max_length_data[$i]->$metrics[1]][1] = $min_length_data[$key];
229
+ }
230
+ }
231
+ $table = array();
232
+ $row = array();
233
+ for($j=0 ;$j<count($metrics); $j++){
234
+ $row[] = $metrics[$j];
235
+ }
236
+ $table[] = $row;
237
+
238
+ $row = array();
239
+ for($j=0 ;$j<count($metrics); $j++){
240
+ if($metrics[$j] == 'No' || $metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
241
+ $row[] = ' ';
242
+ }
243
+ else{
244
+ $this->first_data_sum->$metrics[$j] = floatval($this->first_data_sum->$metrics[$j]);
245
+ $this->second_data_sum->$metrics[$j] = floatval($this->second_data_sum->$metrics[$j]);
246
+ $percent = number_format((($this->first_data_sum->$metrics[$j] - $this->second_data_sum->$metrics[$j])/((($this->second_data_sum->$metrics[$j])!=0) ? $this->second_data_sum->$metrics[$j] : 1)) * 100, 2, '.', ',');
247
+ if(!($percent)){
248
+ $percent = 0;
249
+ }
250
+ else if(strpos($percent, '-') === 0){
251
+ $percent = substr($percent,1);
252
+ }
253
+ $this->second_data_sum_value = number_format($this->second_data_sum->$metrics[$j],2, '.', ',');
254
+ $this->first_data_sum_value = number_format($this->first_data_sum->$metrics[$j],2, '.', ',');
255
+ if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
256
+ $this->second_data_sum_value = $this->sec_to_normal($this->second_data_sum_value);
257
+ $this->first_data_sum_value = $this->sec_to_normal($this->first_data_sum_value);
258
+ }
259
+ if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
260
+ $this->first_data_sum_value = number_format(floatval($this->first_data_sum_value),2, '.', ',') . '%';
261
+ $this->second_data_sum_value = number_format(floatval($this->second_data_sum_value),2, '.', ',') . '%';
262
+ }
263
+ else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue'){
264
+ $this->first_data_sum_value = '$' . number_format(floatval($this->first_data_sum_value),2, '.', ',');
265
+ $this->second_data_sum_value = '$' . number_format(floatval($this->second_data_sum_value),2, '.', ',');
266
+ }
267
+ $row[] = sanitize_text_field($percent) . '% ' . sanitize_text_field($this->first_data_sum_value).' vs '.sanitize_text_field($this->second_data_sum_value);
268
+ }
269
+ }
270
+ $table[] = $row;
271
+ $length = count($all_pages);
272
+ $keys = array_keys($all_pages);
273
+ for($i=0 ;$i<$length; $i++){
274
+ $row = array();
275
+ $row[] = intval($i+1);
276
+ $row[] = $keys[$i];
277
+ $table[] = $row;
278
+ $row = array();
279
+ for($j = 0; $j < count($metrics); $j++){
280
+ if($metrics[$j] == 'No'){
281
+ $row[] = ' ';
282
+ }
283
+ else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
284
+ $row[] = date('M d, Y', strtotime($this->start_date)) . ' - ' . date('M d, Y', strtotime($this->end_date));
285
+ }
286
+ else{
287
+ $keys[$i] = sanitize_text_field($keys[$i]);
288
+ if($all_pages[$keys[$i]][0] != 'no'){
289
+ $line_value = $all_pages[$keys[$i]][0]->$metrics[$j];
290
+ if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
291
+ $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
292
+ }
293
+ else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Item Revenue'){
294
+ $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
295
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
296
+ $line_value = '$' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
297
+ }
298
+ else if($metrics[$j] == 'Pageviews Per Session'){
299
+ $line_value = number_format(floatval($line_value),2, '.', ',');
300
+ }
301
+ else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
302
+ $line_value = $this->sec_to_normal(floatval($line_value));
303
+ }
304
+ else{
305
+ $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
306
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
307
+ $line_value = number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
308
+ }
309
+ $row[] = $line_value;
310
+ }
311
+ else{
312
+ $row[] = '0';
313
+ }
314
+ }
315
+ }
316
+ $table[] = $row;
317
+ $row = array();
318
+ for($j = 0; $j < count($metrics); $j++){
319
+ if($metrics[$j] == 'No'){
320
+ $row[] = ' ';
321
+ }
322
+ else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
323
+ $row[] = date('M d, Y', strtotime($this->second_start_date)) . ' - ' . date('M d, Y', strtotime($this->second_end_date));
324
+ }
325
+ else{
326
+ $keys[$i] = sanitize_text_field($keys[$i]);
327
+ if($all_pages[$keys[$i]][1] != 'no'){
328
+ $line_value = $all_pages[$keys[$i]][1]->$metrics[$j];
329
+ if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
330
+ $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
331
+ }
332
+ else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Item Revenue'){
333
+ $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
334
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
335
+ $line_value = '$' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
336
+ }
337
+ else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
338
+ $line_value = $this->sec_to_normal(floatval($line_value));
339
+ }
340
+ else if($metrics[$j] == 'Pageviews Per Session'){
341
+ $line_value = number_format(floatval($line_value),2, '.', ',');
342
+ }
343
+ else{
344
+ $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
345
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
346
+ $line_value = number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)';
347
+ }
348
+ $row[] = $line_value;
349
+ }
350
+ else{
351
+ $row[] = '0';
352
+ }
353
+ }
354
+ }
355
+ $table[] = $row;
356
+ $row = array();
357
+ for($j = 0; $j < count($metrics); $j++){
358
+ if($metrics[$j] == 'No'){
359
+ $row[] = ' ';
360
+ }
361
+ else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
362
+ $row[] = '% Change';
363
+ }
364
+ else{
365
+ if($all_pages[$keys[$i]][0] != 'no'){
366
+ $_single_data = $all_pages[$keys[$i]][0]->$metrics[$j];
367
+ }
368
+ else{
369
+ $_single_data = 0;
370
+ }
371
+ if($all_pages[$keys[$i]][1] != 'no'){
372
+ $single_data = $all_pages[$keys[$i]][1]->$metrics[$j];
373
+ }
374
+ else{
375
+ $single_data = 0;
376
+ }
377
+ if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
378
+ $_single_data = explode(":",$_single_data);
379
+ if(strpos($_single_data[0], '0') === 0){
380
+ $_single_data[0] = substr($_single_data[0],0,1);
381
+ $_single_data[0] = $_single_data[0];
382
+ }
383
+ if(count($_single_data) > 1){
384
+ if(strpos($_single_data[1],'0') === 0){
385
+ $_single_data[1] = substr($_single_data[1],0,1);
386
+ $_single_data[1] = $_single_data[1]*60;
387
+ }
388
+ if(strpos($_single_data[2],'0') === 0){
389
+ $_single_data[2] = substr($_single_data[2],0,1);
390
+ $_single_data[2] = $_single_data[2];
391
+ }
392
+ }
393
+ $a = !isset($_single_data[0]) ? 0 : floatval($_single_data[0]);
394
+ $b = !isset($_single_data[1]) ? 0 : floatval($_single_data[1]);
395
+ $c = !isset($_single_data[2]) ? 0 : floatval($_single_data[2]);
396
+ $_single_data = $a + $b + $c;
397
+ $single_data = explode(":",$single_data);
398
+ if(strpos($single_data[0], '0') === 0){
399
+ $single_data[0] = substr($single_data[0],0,1);
400
+ $single_data[0] = $single_data[0];
401
+ }
402
+ if(count($single_data) > 1){
403
+ if(strpos($single_data[1],'0') === 0){
404
+ $single_data[1] = substr($single_data[1],0,1);
405
+ $single_data[1] = $single_data[1]*60;
406
+ }
407
+ if(strpos($single_data[2],'0') === 0){
408
+ $single_data[2] = substr($single_data[2],0,1);
409
+ $single_data[2] = $single_data[2];
410
+ }
411
+ }
412
+ $a = !isset($single_data[0]) ? 0 : floatval($single_data[0]);
413
+ $b = !isset($single_data[1]) ? 0 : floatval($single_data[1]);
414
+ $c = !isset($single_data[2]) ? 0 : floatval($single_data[2]);
415
+ $single_data = $a + $b + $c;
416
+ }
417
+
418
+ $single_percent = ($single_data != 0) ? number_format((($_single_data - $single_data)/$single_data) * 100,2, '.', ',').'%' :'infinity';
419
+ $row[] = $single_percent;
420
+ }
421
+ }
422
+ $table[] = $row;
423
+ }
424
+ return $table;
425
+ }
426
+ public function sec_to_normal($data){
427
+ $hours = strlen(floor($data / 3600)) < 2 ? '0' . floor($data / 3600) : floor($data / 3600);
428
+ $mins = strlen(floor($data / 60 % 60)) < 2 ? '0' . floor($data / 60 % 60) : floor($data / 60 % 60);
429
+ $secs = strlen(ceil($data % 60)) < 2 ? '0' . ceil($data % 60) : ceil($data % 60);
430
+ return $data = $hours . ':' . $mins . ':' . $secs;
431
+ }
432
+ private function get_columns() {
433
+ $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
434
+ $columns = array($this->column_names);
435
+ $_REQUEST['gawd_dimension'] = isset($_REQUEST['gawd_dimension']) ? $_REQUEST['gawd_dimension'] : $dimension;
436
+ if($_REQUEST['gawd_dimension'] == "Session Duration Bucket"){
437
+ $_data = array();
438
+ //$j = 1;
439
+ foreach($this->data as $val){
440
+ if(isset($_data[$val["Session Duration Bucket"]])){
441
+ $_data[$val["Session Duration Bucket"]]["Users"] += floatval($val["Users"]);
442
+ $_data[$val["Session Duration Bucket"]]["Sessions"] += floatval($val["Sessions"]);
443
+ $_data[$val["Session Duration Bucket"]]["Percent New Sessions"] += floatval($val["Percent New Sessions"]);
444
+ $_data[$val["Session Duration Bucket"]]["Bounce Rate"] += floatval($val["Bounce Rate"]);
445
+ $_data[$val["Session Duration Bucket"]]["Pageviews"] += floatval($val["Pageviews"]);
446
+ $_data[$val["Session Duration Bucket"]]["Avg Session Duration"] += $val["Avg Session Duration"];
447
+ }
448
+ else{
449
+ // $val["No"] = $j;
450
+ // $j++;
451
+ $_data[$val["Session Duration Bucket"]] = $val;
452
+ $_data[$val["Session Duration Bucket"]]["order"] = intval($val["Session Duration Bucket"]);
453
+ }
454
+ }
455
+ $this->data = array_values($_data);
456
+ foreach ($this->data as $key => $row) {
457
+ $yyy[$key] = $row['order'];
458
+ }
459
+ array_multisort($yyy, SORT_ASC, $this->data);
460
+ foreach($this->data as $j=>$val){
461
+ $val["No"] = ($j+1);
462
+ $this->data[$j] = $val;
463
+ }
464
+ }
465
+ elseif($_REQUEST['gawd_dimension'] == "daysToTransaction"){
466
+ foreach ($this->data as $key => $row) {
467
+ $daysToTransaction[$key] = $row['Days To Transaction'];
468
+ }
469
+ array_multisort($daysToTransaction, SORT_ASC, $this->data);
470
+ foreach($this->data as $j=>$val){
471
+ $val["No"] = ($j+1);
472
+ $this->data[$j] = $val;
473
+ }
474
+ }
475
+
476
+ foreach ($this->data as $dat => $value) {
477
+ $temp = array();
478
+ foreach ($this->column_names as $cols) {
479
+ $cols = preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $cols))));
480
+ $val = $value[$cols];
481
+ if($cols == 'Bounce Rate' || $cols == 'Exit Rate' || $cols == 'Ecommerce Conversion Rate'|| $cols == 'Percent New Sessions' || $cols == 'Transactions Per Session'){
482
+ $val = number_format(floatval($val),2, '.', ',') . '%';
483
+ }
484
+ else if($cols == 'Page Value' || $cols == 'Revenue' || $cols == 'Transaction Revenue'){
485
+ $percentage_of_total = $this->data_sum[$cols] != '0' ? floatval($val)/$this->data_sum[$cols]*100 : 0;
486
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
487
+ $val = '$' . number_format(floatval($val),2, '.', ',') . ' (' . $percentage_of_total .'%)';
488
+ }
489
+ else if($cols == 'Pageviews Per Session'){
490
+ $val = number_format(floatval($val),2, '.', ',');
491
+ }
492
+ else if($cols == 'Avg Time On Page' || $cols == 'Avg Page Load Time' || $cols == 'Avg Session Duration' || $cols == 'Avg Page Load Time' || $cols == 'Avg Redirection Time' || $cols == 'Avg Server Response Time' || $cols == 'Avg Page Download Time' || $cols == 'Duration'){
493
+ if(strpos(':',$val) == false){
494
+ $val = $this->sec_to_normal(floatval($val));
495
+ }
496
+ }
497
+ elseif($cols == 'No' || $cols == $_REQUEST['gawd_dimension'] || $cols == $dimension){
498
+ $val = $val;
499
+ }
500
+ else{
501
+ if($cols != preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $_REQUEST['gawd_dimension']))))){
502
+ $percentage_of_total = isset($this->data_sum[$cols]) ? $this->data_sum[$cols] != '0' ? floatval($val)/$this->data_sum[$cols]*100 : 0 : '';
503
+ if($percentage_of_total != ''){
504
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
505
+ if(strlen($val) > 3){
506
+ $val = number_format(floatval($val),2, '.', ',');
507
+ }
508
+ $val = $val .' (' . $percentage_of_total .'%)';
509
+ }
510
+ }
511
+ }
512
+ $temp[] = $val;
513
+ }
514
+ $columns[] = $temp;
515
+ }
516
+ $row = array();
517
+ foreach ($this->column_names as $cols) {
518
+ $cols = preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $cols))));
519
+ if($cols == 'No' || $cols == $dimension || $cols == preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $_REQUEST['gawd_dimension']))))){
520
+ $row[] = ' ';
521
+ }
522
+ else{
523
+ $val = isset($this->data_sum[$cols]) ? $this->data_sum[$cols] : '';
524
+ if($cols == 'Bounce Rate' || $cols == 'Exit Rate' || $cols == 'Ecommerce Conversion Rate'|| $cols == 'Percent New Sessions' || $cols == 'Transactions Per Session'){
525
+ $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
526
+ }
527
+ else if($cols == 'Page Value' || $cols == 'Revenue' || $cols == 'Transaction Revenue'){
528
+ $val = 'Total: $'.number_format(floatval($val),2, '.', ',');
529
+ }
530
+ else if($cols == 'Pageviews Per Session'){
531
+ $val = 'Total: '. number_format(floatval($val),2, '.', ',');
532
+ }
533
+ else if($cols == 'Avg Time On Page' || $cols == 'Avg Page Load Time' || $cols == 'Avg Session Duration' || $cols == 'Avg Page Load Time' || $cols == 'Avg Redirection Time' || $cols == 'Avg Server Response Time' || $cols == 'Avg Page Download Time' || $cols == 'Duration'){
534
+ $val = 'Avg: '.$this->sec_to_normal(floatval($val));
535
+ }
536
+ else{
537
+ $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
538
+ }
539
+ $row[] = $val;
540
+ }
541
+ }
542
+ $columns[] = $row;
543
+ return $columns;
544
+ }
545
+
546
+ private function send_headers() {
547
+ header('Content-Description: File Transfer');
548
+ header('Content-Type: application/octet-stream');
549
+ header('Content-Transfer-Encoding: binary');
550
+ header('Expires: 0');
551
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
552
+ header('Pragma: public');
553
+
554
+ header('Content-Type: text/csv; charset=utf-8');
555
+ header('Content-Disposition: attachment; filename=' . $this->file_name . '.csv');
556
+ }
557
+
558
+ }
include/gawd_pdf_file.php CHANGED
@@ -1,755 +1,789 @@
1
- <?php
2
-
3
- include_once GAWD_DIR . '/include/gawd_file.php';
4
-
5
- class gawd_pdf_file extends GAWD_file {
6
-
7
- private $img_url = '';
8
- public $file_type = 'pdf';
9
- private $file_dir_option = 'gawd_export_pdf_url';
10
-
11
- public function __construct() {
12
-
13
- }
14
-
15
- public function export_file() {
16
- $fullPath = get_option($this->file_dir_option);
17
- if ($fd = fopen($fullPath, "r")) {
18
-
19
- $fsize = filesize($fullPath);
20
- $path_parts = pathinfo($fullPath);
21
- $ext = strtolower($path_parts["extension"]);
22
- header("Content-type: application/pdf;charset=utf-8");
23
- header("Content-Disposition: attachment; filename=\"" . $path_parts["basename"] . "\""); // use 'attachment' to force a file download
24
-
25
- header("Content-length: $fsize");
26
- header("Cache-control: private"); //use this to open files directly
27
- while (!feof($fd)) {
28
- $buffer = fread($fd, 2048);
29
- echo $buffer;
30
- }
31
- }
32
- fclose($fd);
33
- exit;
34
- }
35
- public function export_reccuing(){
36
- require_once (GAWD_DIR . '/include/src/jpgraph.php');
37
- require_once (GAWD_DIR . '/include/src/jpgraph_line.php');
38
-
39
- $datay1 = array();
40
- $datay2 = array();
41
- $labels = array();
42
-
43
- foreach($this->data as $val){
44
- if(isset($val[$this->metric])){
45
- $datay1[] = $val[$this->metric];
46
- $labels[] = $val[trim(preg_replace('/([A-Z])/', ' $1', $this->dimension))];
47
- }
48
- if($this->metric_compare != '' && $this->metric_compare != 0){
49
- if(isset($val[$this->metric])){
50
- $datay2[] = $val[$this->metric_compare];
51
- }
52
- }
53
- }
54
- if(count($datay1) <2 ){
55
- return false;
56
- }
57
- if(count($datay2) <2 ){
58
- $datay2 = array();
59
- }
60
- // Setup the graph
61
- $graph = new Graph(800,400);
62
- $graph->SetScale("textlin");
63
-
64
- $theme_class=new UniversalTheme;
65
-
66
- $graph->SetTheme($theme_class);
67
- $graph->img->SetAntiAliasing(false);
68
- $graph->SetBox(false);
69
- $graph->img->SetAntiAliasing();
70
-
71
- $graph->yaxis->HideZeroLabel();
72
- $graph->yaxis->HideLine(false);
73
- $graph->yaxis->HideTicks(false,false);
74
-
75
- $graph->xgrid->Show();
76
- $graph->xgrid->SetLineStyle("solid");
77
- $graph->xaxis->SetTickLabels($labels);
78
- $graph->xgrid->SetColor('#E3E3E3');
79
-
80
- // Create the first line
81
- $p1 = new LinePlot($datay1);
82
- $graph->Add($p1);
83
- $p1->SetColor("#6495ED");
84
- $p1->SetLegend($this->metric);
85
- if($datay2 != array()){
86
- $p2 = new LinePlot($datay2);
87
- $graph->Add($p2);
88
- $p2->SetColor("#B22222");
89
- $p2->SetLegend($this->metric_compare);
90
- }
91
- $graph->legend->SetFrameWeight(1);
92
- // Output line
93
- $uplode_dir = wp_upload_dir();
94
- $image_dir = $uplode_dir['path'] . '/export_chart.png';
95
- //var_dump($image_dir);
96
- imagejpeg($graph->Stroke(),$image_dir,100);
97
- return true;
98
- }
99
- public function create_file($flag = true) {
100
-
101
- $this->create_image();
102
-
103
- $this->set_file_dir();
104
-
105
- $content = $this->get_file_content($flag);
106
-
107
- include_once GAWD_DIR . '/inc/html2pdf/html2pdf.class.php';
108
- try {
109
- $html2pdf = new HTML2PDF('L', 'A4', 'en', true, 'UTF-8', 0);
110
- $html2pdf->pdf->SetDisplayMode('fullpage');
111
- $html2pdf->setDefaultFont("freesans");
112
- //$html2pdf->setImageQuality(1);
113
- $html2pdf->pdf->addFont('freesans', 'B', GAWD_DIR . '/inc/html2pdf/_tcpdf_5.9.206/fonts/freesans.php');
114
-
115
- $html2pdf->writeHTML($content);
116
- $html2pdf->Output($this->file_dir, 'F');
117
- } catch (Exception $e) {
118
- echo $e;
119
- exit;
120
- }
121
- update_option($this->file_dir_option, $this->file_dir);
122
- }
123
-
124
- private function get_file_content($flag) {
125
- if($flag == false){
126
- $flag = true;
127
- }
128
- $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
129
- if($flag === true){
130
- $_REQUEST['gawd_dimension'] = isset($_REQUEST['gawd_dimension']) ? preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $_REQUEST['gawd_dimension'])))) : $dimension;
131
- $count = count($this->column_names) - 1;
132
- if($dimension == 'pagePath'){
133
- $count = 9.5;
134
- }
135
- if ($count == 0) {
136
- $no_width = "100";
137
- $row_width = '0';
138
- } else {
139
- $no_width = "5";
140
- $row_width = (95 / $count);
141
- }
142
- $html = '';
143
- if($this->img_url == '' && $this->dimension_recc != 'daysToTransaction' && $_REQUEST['gawd_dimension'] != 'Days To Transaction' ){
144
- $a = $this->export_reccuing();
145
- if($a){
146
- $uplode_dir = wp_upload_dir();
147
- $image_dir = $uplode_dir['path'] . '/export_chart.png';
148
- $this->img_url = $image_dir;
149
- }
150
- else{
151
- $this->img_url = '';
152
- }
153
-
154
- }
155
- $html .= '<h2 style="text-align:center; margin-bottom:5px; color:#949494">' . $this->site_title . ' </h2>';
156
- $html .= '<h4 style="text-align:center; margin-bottom:5px; color:#7DB5D8">' . $this->file_name . '</h4>';
157
- if ($this->img_url != '') {
158
- $html .= '<div style="width:100%;height:auto;">';
159
- $html .= '<img width="800" style="margin-left:200px;" src="' . $this->img_url . '"/>';
160
- $html .= '</div>';
161
- }
162
- $margin = 'margin-left:47px';
163
- $html .= '<table border=1 style="width:100%;border: 1px solid #DCDCDC;border-spacing: 0;border-collapse: collapse;">'
164
- . '<tr>';
165
- if($_REQUEST['gawd_dimension'] == "Session Duration Bucket"){
166
- $_data = array();
167
- //$j = 1;
168
- //var_dump($data);exit;
169
- foreach($this->data as $val){
170
- if(isset($_data[$val["Session Duration Bucket"]])){
171
- $_data[$val["Session Duration Bucket"]]["Users"] += floatval($val["Users"]);
172
- $_data[$val["Session Duration Bucket"]]["Sessions"] += floatval($val["Sessions"]);
173
- $_data[$val["Session Duration Bucket"]]["Percent New Sessions"] += floatval($val["Percent New Sessions"]);
174
- $_data[$val["Session Duration Bucket"]]["Bounce Rate"] += floatval($val["Bounce Rate"]);
175
- $_data[$val["Session Duration Bucket"]]["Pageviews"] += floatval($val["Pageviews"]);
176
- $_data[$val["Session Duration Bucket"]]["Avg Session Duration"] += $val["Avg Session Duration"];
177
- }
178
- else{
179
- // $val["No"] = $j;
180
- // $j++;
181
- $_data[$val["Session Duration Bucket"]] = $val;
182
- $_data[$val["Session Duration Bucket"]]["order"] = intval($val["Session Duration Bucket"]);
183
- }
184
-
185
-
186
- }
187
- $this->data = array_values($_data);
188
- foreach ($this->data as $key => $row) {
189
- $yyy[$key] = $row['order'];
190
- }
191
- array_multisort($yyy, SORT_ASC, $this->data);
192
- foreach($this->data as $j=>$val){
193
- $val["No"] = ($j+1);
194
- $this->data[$j] = $val;
195
- }
196
- }
197
- elseif($_REQUEST['gawd_dimension'] == "Days To Transaction"){
198
- foreach ($this->data as $key => $row) {
199
- $daysToTransaction[$key] = $row['Days To Transaction'];
200
- }
201
- array_multisort($daysToTransaction, SORT_ASC, $this->data);
202
- foreach($this->data as $j=>$val){
203
- $val["No"] = ($j+1);
204
- $this->data[$j] = $val;
205
- }
206
- }
207
- foreach ($this->column_names as $column) {
208
- $column = trim($column);
209
- $width = ($column == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
210
- $html .= '<th style="' . $width . ';background-color: #7DB5D8;color: #fff;">' . $column . '</th>';
211
- }
212
- $html .= '</tr>';
213
- $row_count = 0;
214
- foreach ($this->data as $dat => $value) {
215
- if ((strtolower($this->column_names[1]) == 'page path' || strtolower($this->column_names[1]) == 'landing page path') && $row_count >= 150) {
216
- break;
217
- }
218
- $html .= '<tr>';
219
-
220
- foreach ($this->column_names as $key => $column) {
221
- $column = trim(preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $column)))));
222
-
223
- $text = ucfirst($value[$column]);
224
- $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
225
- if($column == "Page Path" || $column == "Landing Page" || strlen($text)>20){
226
- if (strpos($text, ' ') === false) {
227
- $text = '<span>' . $text;
228
- $text = wordwrap($text, '10', '</span><span>', true);
229
- $text .= '</span>';
230
- }
231
- }
232
- elseif($column == 'Bounce Rate' || $column == 'Exit Rate' || $column == 'Ecommerce Conversion Rate'|| $column == 'Percent New Sessions' || $column == 'Transactions Per Session'){
233
- $text = number_format(floatval($text),2, '.', ',') . '%';
234
- }
235
- elseif($column == 'Page Value' || $column == 'Item Revenue' || $column == 'Revenue' || $column == 'Transaction Revenue'){
236
- $percentage_of_total = $this->data_sum[$column] != '0' ? floatval($text)/$this->data_sum[$column]*100 : 0;
237
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
238
- $text = '$' . number_format(floatval($text),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
239
- }
240
- elseif($column == 'Pageviews Per Session'){
241
- $text = number_format(floatval($text),2, '.', ',');
242
- }
243
- elseif($column == 'Avg Time On Page' || $column == 'Avg Page Load Time' || $column == 'Avg Session Duration' || $column =='Duration' || $column == 'Avg Page Load Time' || $column == 'Avg Redirection Time' || $column == 'Avg Server Response Time' || $column == 'Avg Page Download Time' || $column == 'Duration'){
244
- if(strpos(':',$text) == false){
245
- $text = $this->sec_to_normal(floatval($text));
246
-
247
- }
248
- }
249
- elseif($column == 'No' || $column == $_REQUEST['gawd_dimension'] || $column == $dimension){
250
- $text = $text;
251
- }
252
- else{
253
- $percentage_of_total = isset($this->data_sum[$column]) ? $this->data_sum[$column] != '0' ? floatval($text)/$this->data_sum[$column]*100 : 0 : '';
254
- if($percentage_of_total != ''){
255
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
256
- if(strlen($text) > 3){
257
- $text = number_format(floatval($text),2, '.', ',');
258
- }
259
- $text = $text .' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
260
- }
261
- }
262
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $text . '</td>';
263
-
264
- }
265
- $html .= '</tr>';
266
- $row_count++;
267
- }
268
- $html .= '<tr>';
269
- foreach ($this->column_names as $key => $column) {
270
- $column = preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $column))));
271
- $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
272
- if($column == 'No' || $column == $_REQUEST['gawd_dimension'] || $column == 'Week' || $column == 'Month' || $column == 'Hour' || $column == $dimension){
273
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; "></td>';
274
- }
275
- else{
276
- $val = isset($this->data_sum[$column]) ? $this->data_sum[$column] : '';
277
- if($column == 'Bounce Rate' || $column == 'Exit Rate' || $column == 'Ecommerce Conversion Rate'|| $column == 'Percent New Sessions' || $column == 'Transactions Per Session'){
278
- $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
279
- }
280
- else if($column == 'Page Value' || $column == 'Revenue' || $column == 'Item Revenue' || $column == 'Transaction Revenue'){
281
- $val = 'Total: $'.number_format(floatval($val),2, '.', ',');
282
- }
283
- else if($column == 'Pageviews Per Session'){
284
- $val = 'Total: '. number_format(floatval($val),2, '.', ',');
285
- }
286
- else if($column == 'Avg Time On Page' || $column == 'Avg Page Load Time' || $column == 'Avg Session Duration' || $column == 'Avg Session Duration' || $column == 'Avg Page Load Time' || $column == 'Avg Redirection Time' || $column == 'Avg Server Response Time' || $column == 'Avg Page Download Time' || $column == 'Duration'){
287
- $val = 'Avg: '.$this->sec_to_normal(floatval($val));
288
- }
289
- else{
290
- $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
291
- }
292
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $val . '</td>';
293
- }
294
- }
295
- $html .= '</tr>';
296
- $html .= '</table>';
297
- //die($html);
298
- }
299
- elseif($flag == 'pages'){
300
- $html = $this->compared_pages_html();
301
- }
302
-
303
- elseif($flag == 'compare'){
304
- $html = $this->compared_data_html();
305
- }
306
- return $html;
307
- }
308
- public function compared_data_html(){
309
- $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
310
- $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
311
- $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
312
- if($this->metric_compare == '0' || $this->metric_compare == ''){
313
- $this->column_names[] = $this->metric." compare";
314
- }
315
- $count = count($this->column_names) - 1;
316
- if($dimension == 'pagePath'){
317
- $count = 9.5;
318
- }
319
- if ($count == 0) {
320
- $no_width = "100";
321
- $row_width = '0';
322
- } else {
323
- $no_width = "5";
324
- $row_width = (95 / $count);
325
- }
326
- $html = '';
327
-
328
- $html .= '<h2 style="text-align:center; margin-bottom:5px; color:#949494">' . $this->site_title . ' </h2>';
329
- $html .= '<h4 style="text-align:center; margin-bottom:5px; color:#7DB5D8">' . $this->file_name . '</h4>';
330
- if ($this->img_url) {
331
- $html .= '<div style="width:100%;height:auto;">';
332
- $html .= '<img width="800" style="margin-left:200px;" src="' . $this->img_url . '"/>';
333
- $html .= '</div>';
334
- }
335
- $margin = 'margin-left:47px';
336
- $html .= '<table border=1 style="width:100%;border: 1px solid #DCDCDC;border-spacing: 0;border-collapse: collapse;">'
337
- . '<tr>';
338
-
339
- foreach ($this->column_names as $column) {
340
- $width = ($column == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
341
- $html .= '<th style="' . $width . ';background-color: #7DB5D8;color: #fff;">' . $column . '</th>';
342
- }
343
- $html .= '</tr>';
344
- $row_count = 0;
345
- foreach ($this->_data_compare as $dat => $value) {
346
- if ($this->column_names[1] == 'page Path' && $row_count >= 150) {
347
- break;
348
- }
349
- $html .= '<tr>';
350
- foreach ($this->column_names as $key => $column) {
351
- $column = trim($column);
352
- $text = ucfirst($value[$column]);
353
- $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
354
- if($column == "Page Path" || $column == "Landing Page" || $column == 'Hour' || $column == 'Week' || $column == 'Month' || strlen($text)>20){
355
- if (strpos($text, ' ') === false) {
356
- $text = '<span>' . $text;
357
- $text = wordwrap($text, '10', '</span><span>', true);
358
- $text .= '</span>';
359
- }
360
- }
361
- elseif($column == 'Bounce Rate' || $column == 'Bounce Rate compare' || $column == 'Exit Rate' || $column == 'Ecommerce Conversion Rate'|| $column == 'Percent New Sessions' || $column == 'Percent New Sessions compare' || $column == 'Transactions Per Session'){
362
- $text = number_format(floatval($text),2, '.', ',') . '%';
363
- }
364
- elseif($column == 'Page Value' || $column == 'Revenue' || $column == 'Transaction Revenue'){
365
- if(strpos($column, 'compare') !== false){
366
- $percentage_of_total = $this->second_data_sum->$column != '0' ? floatval($text)/$this->second_data_sum->$column*100 : 0;
367
- }
368
- else{
369
- $percentage_of_total = $this->first_data_sum->$column != '0' ? floatval($text)/$this->first_data_sum->$column*100 : 0;
370
- }
371
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
372
- $text = '$' . number_format(floatval($text),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
373
- }
374
- elseif($column == 'Pageviews Per Session' || $column == 'Pageviews Per Session compare'){
375
- $text = number_format(floatval($text),2, '.', ',');
376
- }
377
- elseif($column == 'Avg Time On Page' || $column == 'Avg Page Load Time' || $column == 'Avg Session Duration' || $column == 'Avg Session Duration compare'){
378
- $text = $this->sec_to_normal(floatval($text));
379
- }
380
- elseif($column == 'No' || $column == $_REQUEST['gawd_dimension'] || $column == $dimension){
381
- $text = $text;
382
- }
383
- else{
384
- if(strpos($column, 'compare') !== false){
385
- $column = str_replace(' compare','',$column);
386
- $percentage_of_total = $this->second_data_sum->$column != '0' ? floatval($text)/$this->second_data_sum->$column*100 : 0;
387
- }
388
- else{
389
- $percentage_of_total = $this->first_data_sum->$column != '0' ? floatval($text)/$this->first_data_sum->$column*100 : 0;
390
- }
391
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
392
- $text = number_format(floatval($text),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
393
- $text = $text;
394
- }
395
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $text . '</td>';
396
-
397
- }
398
- $html .= '</tr>';
399
- $row_count++;
400
- }
401
- $html .= '<tr>';
402
- foreach ($this->column_names as $key => $column) {
403
- $column = trim($column);
404
- $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
405
- if($column == 'No' || $column == $dimension || $column == 'Hour' || $column == 'Week' || $column == 'Month'){
406
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; "></td>';
407
- }
408
- else{
409
- $val = '';
410
- $val_second = '';
411
- if(trim($column) != trim($this->metric.' compare')){
412
- $column = trim($column);
413
- $val = $this->first_data_sum->$column;
414
- $val_second = $this->second_data_sum->$column;
415
- }
416
- if($column == 'Bounce Rate' || $column == 'Bounce Rate compare'){
417
- $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
418
- $val_second = 'Avg: '.number_format(floatval($val_second),2, '.', ',') . '%';
419
- }
420
- else if($column == 'Pageviews Per Session' || $column == 'Pageviews Per Session compare'){
421
- $val = 'Total: '. number_format(floatval($val),2, '.', ',');
422
- $val_second = 'Total: '. number_format(floatval($val_second),2, '.', ',');
423
- }
424
- else if($column == 'Avg Session Duration' || $column == 'Avg Session Duration compare'){
425
- $val = 'Avg: '.$this->sec_to_normal(floatval($val));
426
- $val_second = 'Avg: '.$this->sec_to_normal(floatval($val_second));
427
- }
428
- elseif($column == 'Percent New Sessions' || $column == 'Percent New Sessions compare'){
429
- $val = 'Avg: '. number_format(floatval($val),2, '.', ',').'%';
430
- $val_second = 'Avg: '. number_format(floatval($val_second),2, '.', ',').'%';
431
- }
432
- else{
433
- $val_second = $val_second != '' ? 'Total: '. number_format(floatval($val_second),2, '.', ',') : '';
434
- $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
435
-
436
- }
437
- if($val != '' && $val_second != ''){
438
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $val . '</td>';
439
- $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $val_second . '</td>';
440
- }
441
- }
442
- }
443
- $html .= '</tr>';
444
- $html .= '</table>';
445
- //die($html);
446
-
447
- return $html;
448
- }
449
- public function compared_pages_html(){
450
- $this->first_data = json_decode(stripslashes($this->first_data));
451
- $this->second_data = json_decode(stripslashes($this->second_data));
452
- $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
453
- $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
454
- $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
455
- if ($dimension == 'Page Path' || $dimension == 'pagePath') {
456
- $metrics = array(
457
- 'No','Page Path','Pageviews','Unique Pageviews',
458
- 'Avg Time On Page','Entrances','Bounce Rate',
459
- 'Exit Rate','Page Value','Avg Page Load Time'
460
- );
461
- } elseif ($dimension == 'Landing Page Path' || $dimension == 'landingPagePath') {
462
- $metrics = array(
463
- 'No','Landing Page','Sessions','Percent New Sessions','New Users','Bounce Rate','Pageviews Per Session','Avg Session Duration','Transactions','Transaction Revenue','Transactions Per Session'
464
- );
465
- }
466
-
467
- $count = count($metrics) - 1;
468
- $margin = '';
469
- if($dimension == 'pagePath'){
470
- $margin = 'margin-left:18px;';
471
- $count = 9.5;
472
- }
473
- if ($count == 0) {
474
- $no_width = "100";
475
- $row_width = '0';
476
- } else {
477
- $no_width = "5";
478
- $row_width = (95 / $count);
479
- }
480
-
481
- $all_pages = array();
482
- $max_length_data = count($this->first_data) >= count($this->second_data) ? $this->first_data : $this->second_data;
483
-
484
- $max_length = count($this->first_data) >= count($this->second_data) ? count($this->first_data) : count($this->second_data);
485
-
486
-
487
- for($i=0 ;$i<$max_length; $i++){
488
- $all_pages[$max_length_data[$i]->$metrics[1]] = array();
489
- array_push($all_pages[$max_length_data[$i]->$metrics[1]], 'no', 'no');
490
- }
491
-
492
-
493
- for($i=0 ;$i<$max_length; $i++){
494
- if(isset($this->first_data[$i])){
495
- if(!isset($all_pages[$max_length_data[$i]->$metrics[1]])){
496
- $all_pages[$max_length_data[$i]->$metrics[1]] = array();
497
- array_push($all_pages[$max_length_data[$i]->$metrics[1]], 'no', 'no');
498
- }
499
- $all_pages[$max_length_data[$i]->$metrics[1]][0] = $this->first_data[$i];
500
- }
501
- }
502
-
503
- for($j=0 ;$j<$max_length; $j++){
504
- if(isset($this->second_data[$j])){
505
-
506
- if(!isset($all_pages[$max_length_data[$j]->$metrics[1]])){
507
- $all_pages[$max_length_data[$j]->$metrics[1]] = array();
508
- array_push($all_pages[$max_length_data[$j]->$metrics[1]], 'no', 'no');
509
- }
510
- $all_pages[$max_length_data[$j]->$metrics[1]][1] = $this->second_data[$j];
511
- }
512
- }
513
-
514
- $table = '<h2 style="text-align:center; margin-bottom:5px; color:#949494">' . $this->site_title . ' </h2>';
515
- $table .= '<h4 style="text-align:center; margin-bottom:5px; color:#7DB5D8">' . $this->file_name . '</h4>';
516
- $table .= '<table border="1" style="' . $margin . 'width:100%;border-spacing: 0;border-collapse: collapse;">';
517
- //$table .= '<thead>';
518
- $table .= '<tr>';
519
- for($j=0 ;$j<count($metrics); $j++){
520
- $width = ($metrics[$j] == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
521
- $table .= '<th style="' . $width . ';background-color: #7DB5D8;color: #fff;">' . $metrics[$j] . '</th>';
522
- }
523
- $table .= '</tr>';
524
- $table .= '<tr>';
525
- for($j=0 ;$j<count($metrics); $j++){
526
- $width = $metrics[$j] == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
527
- if($metrics[$j] == 'No' || $metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
528
-
529
- $table .= '<td style="' . $width . '"></td>';
530
- }
531
- else{
532
- $this->first_data_sum->$metrics[$j] = floatval($this->first_data_sum->$metrics[$j]);
533
- $this->second_data_sum->$metrics[$j] = floatval($this->second_data_sum->$metrics[$j]);
534
- $arrow = '<img src=""/>';
535
- $percent = number_format((($this->first_data_sum->$metrics[$j] - $this->second_data_sum->$metrics[$j])/((($this->second_data_sum->$metrics[$j])!=0) ? $this->second_data_sum->$metrics[$j] : 1)) * 100, 2, '.', ',');
536
- if(!($percent)){
537
- $percent = 0;
538
- }
539
- else if(strpos($percent, '-') === 0){
540
- $percent = substr($percent,1);
541
- $arrow = '<img src="' . GAWD_URL . '/assets/arrow-down.png"/>';
542
- }
543
- else{
544
- $arrow = '<img src="' . GAWD_URL . '/assets/arrow-up.png"/>';
545
- }
546
- $table .= '<td style="' . $width . ' font-weight:bold;padding-top:5px;color:#828282;"><div>' . sanitize_text_field($percent) . '%' . $arrow . '</div>';
547
- $this->second_data_sum_value = number_format($this->second_data_sum->$metrics[$j],2, '.', ',');
548
- $this->first_data_sum_value = number_format($this->first_data_sum->$metrics[$j],2, '.', ',');
549
- if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
550
- $this->second_data_sum_value = $this->sec_to_normal($this->second_data_sum_value);
551
- $this->first_data_sum_value = $this->sec_to_normal($this->first_data_sum_value);
552
- }
553
- if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
554
- $this->first_data_sum_value = number_format(floatval($this->first_data_sum_value),2, '.', ',') . '%';
555
- $this->second_data_sum_value = number_format(floatval($this->second_data_sum_value),2, '.', ',') . '%';
556
- }
557
- else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue'){
558
- $this->first_data_sum_value = '$' . number_format(floatval($this->first_data_sum_value),2, '.', ',');
559
- $this->second_data_sum_value = '$' . number_format(floatval($this->second_data_sum_value),2, '.', ',');
560
- }
561
- $table .= '<div>' . sanitize_text_field($this->first_data_sum_value) . ' vs ' . sanitize_text_field($this->second_data_sum_value) . '</div>';
562
- $table .= '</td>';
563
- }
564
- }
565
- $table .= '</tr>';
566
- //$table .= '</thead>';
567
- //$table .= '<tbody>';
568
-
569
- $length = count($all_pages);
570
- $keys = array_keys($all_pages);
571
- for($i=0 ;$i<$length; $i++){
572
- if($i >= 50){
573
- break;
574
- }
575
- $width = 'width:' . $row_width . '%;';
576
- $table .= '<tr>';
577
- $table .= '<td style="width:5%">' . intval($i+1) .'</td>';
578
- $keys[$i] = '<span>' . $keys[$i];
579
- $keys[$i] = wordwrap($keys[$i], '10', '</span><span>', true);
580
- $keys[$i] .= '</span>';
581
- $table .= '<td style="' . $width . '">' . $keys[$i] .'</td>';
582
- $table .= '</tr>';
583
- $table .= '<tr>';
584
- for($j = 0; $j < count($metrics); $j++){
585
- if($metrics[$j] == 'No'){
586
- $table .= '<td ></td>';
587
- }
588
- else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
589
- $table .= '<td style="' . $width . '">' . date('M d, Y', strtotime($this->start_date)) . ' - ' . date('M d, Y', strtotime($this->end_date)) .'</td>';
590
- }
591
- else{
592
- $keys[$i] = sanitize_text_field($keys[$i]);
593
- //var_dump(array_keys($all_pages));
594
- if($all_pages[$keys[$i]][0] != 'no'){
595
- $line_value = $all_pages[$keys[$i]][0]->$metrics[$j];
596
- if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
597
- $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
598
- }
599
- else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Item Revenue'){
600
- $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
601
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
602
- $line_value = '$<span class="row_percent">' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)</span>';
603
- }
604
- else if($metrics[$j] == 'Pageviews Per Session'){
605
- $line_value = number_format(floatval($line_value),2, '.', ',');
606
- }
607
- else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
608
- $line_value = $this->sec_to_normal(floatval($line_value));
609
- }
610
- else{
611
- $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
612
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
613
- $line_value = number_format(floatval($line_value),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
614
- }
615
- if (strpos($line_value, ' ') === false) {
616
- $line_value = '<span>' . $line_value;
617
- $line_value = wordwrap($line_value, '10', '</span><span>', true);
618
- $line_value .= '</span>';
619
- }
620
- $table .= '<td style="' . $width . 'text-align:center">' . $line_value . '</td>';
621
- }
622
- else{
623
- $table .= '<td style="text-align:center">0</td>';
624
- }
625
- }
626
- }
627
- $table .= '</tr>';
628
- $table .= '<tr>';
629
- for($j = 0; $j < count($metrics); $j++){
630
- if($metrics[$j] == 'No'){
631
- $table .= '<td style="width:5%"></td>';
632
- }
633
- else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
634
- $width = ($metrics[$j] == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
635
- $table .= '<td style="' . $width . '">' . date('M d, Y', strtotime($this->second_start_date)) . ' - ' . date('M d, Y', strtotime($this->second_end_date)) .'</td>';
636
- }
637
- else{
638
- $keys[$i] = sanitize_text_field($keys[$i]);
639
- if($all_pages[$keys[$i]][1] != 'no'){
640
- $line_value = $all_pages[$keys[$i]][1]->$metrics[$j];
641
- if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
642
- $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
643
- }
644
- else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Item Revenue'){
645
- $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
646
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
647
- $line_value = '$<span class="row_percent">' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)</span>';
648
- }
649
- else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
650
- $line_value = $this->sec_to_normal(floatval($line_value));
651
- }
652
- else if($metrics[$j] == 'Pageviews Per Session'){
653
- $line_value = number_format(floatval($line_value),2, '.', ',');
654
- }
655
- else{
656
- $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
657
- $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
658
- $line_value = number_format(floatval($line_value),2, '.', ',') . '<span class="row_percent">(' . $percentage_of_total .'%)</span>';
659
- }
660
- $table .= '<td style="text-align:center">' . $line_value . '</td>';
661
- }
662
- else{
663
- $table .= '<td style="text-align:center">0</td>';
664
- }
665
- }
666
- }
667
- $table .= '</tr>';
668
- $table .= '<tr>';
669
- for($j = 0; $j < count($metrics); $j++){
670
- if($metrics[$j] == 'No'){
671
- $table .= '<td style="width:5%"></td>';
672
- }
673
- else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
674
- $table .= '<td style="font-weight:bold;">% Change</td>';
675
- }
676
- else{
677
- if($all_pages[$keys[$i]][0] != 'no'){
678
- $_single_data = $all_pages[$keys[$i]][0]->$metrics[$j];
679
- }
680
- else{
681
- $_single_data = 0;
682
- }
683
- if($all_pages[$keys[$i]][1] != 'no'){
684
- $single_data = $all_pages[$keys[$i]][1]->$metrics[$j];
685
- }
686
- else{
687
- $single_data = 0;
688
- }
689
- if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
690
- $_single_data = explode(":",$_single_data);
691
- if(strpos($_single_data[0], '0') == 0){
692
- $_single_data[0] = substr($_single_data[0],0,1);
693
- $_single_data[0] = $_single_data[0];
694
- }
695
- if(count($_single_data) > 1){
696
- if(strpos($_single_data[1],'0') == 0){
697
- $_single_data[1] = substr($_single_data[1],0,1);
698
- $_single_data[1] = $_single_data[1]*60;
699
- }
700
- if(strpos($_single_data[2],'0') == 0){
701
- $_single_data[2] = substr($_single_data[2],0,1);
702
- $_single_data[2] = $_single_data[2];
703
- }
704
- }
705
- $_single_data = intval($_single_data[0] . ((!isset($_single_data[1])) ? 0 : $_single_data[1]) . ((!isset($_single_data[2])) ? 0 : $_single_data[2]));
706
- $single_data = explode(":",$single_data);
707
- if(strpos($single_data[0], '0') == 0){
708
- $single_data[0] = substr($single_data[0],0,1);
709
- $single_data[0] = $single_data[0];
710
- }
711
- if(count($single_data) > 1){
712
- if(strpos($single_data[1],'0') == 0){
713
- $single_data[1] = substr($single_data[1],0,1);
714
- $single_data[1] = $single_data[1]*60;
715
- }
716
- if(strpos($single_data[2],'0') == 0){
717
- $single_data[2] = substr($single_data[2],0,1);
718
- $single_data[2] = $single_data[2];
719
- }
720
- }
721
- $single_data = intval($single_data[0] . ((!isset($single_data[1])) ? 0 : $single_data[1]) . ((!isset($single_data[2])) ? 0 : $single_data[2]));
722
- }
723
-
724
- $single_percent = ($single_data != 0) ? number_format((($_single_data - $single_data)/$single_data) * 100,2, '.', ',') :'<img src="' . GAWD_URL . '/assets/infinity.png" />';
725
- //$single_percent = is_nan($single_percent) ? 0 : is_infinite($single_percent) ? $single_percent : '&infin;';
726
- $table .= '<td style="font-weight:bold;text-align:center">' . $single_percent . '%</td>';
727
- }
728
- }
729
- $table .= '</tr>';
730
- }
731
- //$table .= '</tbody>';
732
- $table .= '</table>';
733
-
734
- //echo $table;die;
735
- return $table;
736
- }
737
- public function sec_to_normal($data){
738
- $hours = strlen(floor($data / 3600)) < 2 ? '0' . floor($data / 3600) : floor($data / 3600);
739
- $mins = strlen(floor($data / 60 % 60)) < 2 ? '0' . floor($data / 60 % 60) : floor($data / 60 % 60);
740
- $secs = strlen(ceil($data % 60)) < 2 ? '0' . ceil($data % 60) : ceil($data % 60);
741
- return $data = $hours . ':' . $mins . ':' . $secs;
742
- }
743
- public function create_image() {
744
- if ($this->img == '') {
745
- return;
746
- }
747
- $this->img = explode('image/png;base64,', $this->img);
748
- $uplode_dir = wp_upload_dir();
749
- $image_dir = $uplode_dir['path'] . '/export_chart.png';
750
- file_put_contents($image_dir, base64_decode($this->img[1]));
751
- chmod($image_dir, 0777);
752
- $this->img_url = $uplode_dir['url'] . '/export_chart.png';
753
- }
754
-
755
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once GAWD_DIR . '/include/gawd_file.php';
4
+
5
+ class gawd_pdf_file extends GAWD_file {
6
+
7
+ private $img_url = '';
8
+ public $file_type = 'pdf';
9
+ private $file_dir_option = 'gawd_export_pdf_url';
10
+
11
+ public function __construct() {
12
+
13
+ }
14
+
15
+ public function export_file() {
16
+ $fullPath = get_option($this->file_dir_option);
17
+ if ($fd = fopen($fullPath, "r")) {
18
+
19
+ $fsize = filesize($fullPath);
20
+ $path_parts = pathinfo($fullPath);
21
+ $ext = strtolower($path_parts["extension"]);
22
+ header("Content-type: application/pdf;charset=utf-8");
23
+ header("Content-Disposition: attachment; filename=\"" . $path_parts["basename"] . "\""); // use 'attachment' to force a file download
24
+
25
+ header("Content-length: $fsize");
26
+ header("Cache-control: private"); //use this to open files directly
27
+ while (!feof($fd)) {
28
+ $buffer = fread($fd, 2048);
29
+ echo $buffer;
30
+ }
31
+ }
32
+ fclose($fd);
33
+ exit;
34
+ }
35
+ public function export_reccuing(){
36
+ require_once (GAWD_DIR . '/include/src/jpgraph.php');
37
+ require_once (GAWD_DIR . '/include/src/jpgraph_line.php');
38
+
39
+ $datay1 = array();
40
+ $datay2 = array();
41
+ $labels = array();
42
+
43
+ foreach($this->data as $val){
44
+ if(isset($val[$this->metric])){
45
+ $datay1[] = $val[$this->metric];
46
+ $labels[] = $val[trim(preg_replace('/([A-Z])/', ' $1', $this->dimension))];
47
+ }
48
+ if($this->metric_compare != '' && $this->metric_compare != 0){
49
+ if(isset($val[$this->metric])){
50
+ $datay2[] = $val[$this->metric_compare];
51
+ }
52
+ }
53
+ }
54
+ if(count($datay1) <2 ){
55
+ return false;
56
+ }
57
+ if(count($datay2) <2 ){
58
+ $datay2 = array();
59
+ }
60
+ // Setup the graph
61
+ $graph = new Graph(800,400);
62
+ $graph->SetScale("textlin");
63
+
64
+ $theme_class=new UniversalTheme;
65
+
66
+ $graph->SetTheme($theme_class);
67
+ $graph->img->SetAntiAliasing(false);
68
+ $graph->SetBox(false);
69
+ $graph->img->SetAntiAliasing();
70
+
71
+ $graph->yaxis->HideZeroLabel();
72
+ $graph->yaxis->HideLine(false);
73
+ $graph->yaxis->HideTicks(false,false);
74
+
75
+ $graph->xgrid->Show();
76
+ $graph->xgrid->SetLineStyle("solid");
77
+ $graph->xaxis->SetTickLabels($labels);
78
+ $graph->xgrid->SetColor('#E3E3E3');
79
+
80
+ // Create the first line
81
+ $p1 = new LinePlot($datay1);
82
+ $graph->Add($p1);
83
+ $p1->SetColor("#6495ED");
84
+ $p1->SetLegend($this->metric);
85
+ if($datay2 != array()){
86
+ $p2 = new LinePlot($datay2);
87
+ $graph->Add($p2);
88
+ $p2->SetColor("#B22222");
89
+ $p2->SetLegend($this->metric_compare);
90
+ }
91
+ $graph->legend->SetFrameWeight(1);
92
+ // Output line
93
+ $uplode_dir = wp_upload_dir();
94
+ $image_dir = $uplode_dir['path'] . '/export_chart.png';
95
+ imagejpeg($graph->Stroke(),$image_dir,100);
96
+ return true;
97
+ }
98
+ public function create_file($flag = true) {
99
+
100
+ $this->create_image();
101
+
102
+ $this->set_file_dir();
103
+
104
+ $content = $this->get_file_content($flag);
105
+
106
+ include_once GAWD_DIR . '/inc/html2pdf/html2pdf.class.php';
107
+ try {
108
+ $html2pdf = new HTML2PDF('L', 'A4', 'en', true, 'UTF-8', 0);
109
+ $html2pdf->pdf->SetDisplayMode('fullpage');
110
+ $html2pdf->setDefaultFont("freesans");
111
+ //$html2pdf->setImageQuality(1);
112
+ $html2pdf->pdf->addFont('freesans', 'B', GAWD_DIR . '/inc/html2pdf/_tcpdf_5.9.206/fonts/freesans.php');
113
+
114
+ $html2pdf->writeHTML($content);
115
+ $html2pdf->Output($this->file_dir, 'F');
116
+ } catch (Exception $e) {
117
+ echo $e;
118
+ exit;
119
+ }
120
+ update_option($this->file_dir_option, $this->file_dir);
121
+ }
122
+
123
+ private function get_file_content($flag) {
124
+ if($flag == false){
125
+ $flag = true;
126
+ }
127
+ $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
128
+ if($flag === true){
129
+ $_REQUEST['gawd_dimension'] = isset($_REQUEST['gawd_dimension']) ? preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $_REQUEST['gawd_dimension'])))) : $dimension;
130
+ $count = count($this->column_names) - 1;
131
+ if($dimension == 'pagePath'){
132
+ $count = 9.5;
133
+ }
134
+ if ($count == 0) {
135
+ $no_width = "100";
136
+ $row_width = '0';
137
+ } else {
138
+ $no_width = "5";
139
+ $row_width = (95 / $count);
140
+ }
141
+ $html = '';
142
+ if($this->img_url == '' && $this->dimension_recc != 'daysToTransaction' && $_REQUEST['gawd_dimension'] != 'Days To Transaction' ){
143
+ $a = $this->export_reccuing();
144
+ if($a){
145
+ $uplode_dir = wp_upload_dir();
146
+ $image_dir = $uplode_dir['path'] . '/export_chart.png';
147
+ $this->img_url = $image_dir;
148
+ }
149
+ else{
150
+ $this->img_url = '';
151
+ }
152
+
153
+ }
154
+ $html .= '<h2 style="text-align:center; margin-bottom:5px; color:#949494">' . $this->site_title . ' </h2>';
155
+ $html .= '<h4 style="text-align:center; margin-bottom:5px; color:#7DB5D8">' . $this->file_name . '</h4>';
156
+ if ($this->img_url != '') {
157
+ $html .= '<div style="width:100%;height:auto;">';
158
+ $html .= '<img width="800" style="margin-left:200px;" src="' . $this->img_url . '"/>';
159
+ $html .= '</div>';
160
+ }
161
+ $margin = 'margin-left:47px';
162
+ $html .= '<table border=1 style="width:100%;border: 1px solid #DCDCDC;border-spacing: 0;border-collapse: collapse;">'
163
+ . '<tr>';
164
+ if($_REQUEST['gawd_dimension'] == "Session Duration Bucket"){
165
+ $_data = array();
166
+ //$j = 1;
167
+ foreach($this->data as $val){
168
+ if(isset($_data[$val["Session Duration Bucket"]])){
169
+ $_data[$val["Session Duration Bucket"]]["Users"] += floatval($val["Users"]);
170
+ $_data[$val["Session Duration Bucket"]]["Sessions"] += floatval($val["Sessions"]);
171
+ $_data[$val["Session Duration Bucket"]]["Percent New Sessions"] += floatval($val["Percent New Sessions"]);
172
+ $_data[$val["Session Duration Bucket"]]["Bounce Rate"] += floatval($val["Bounce Rate"]);
173
+ $_data[$val["Session Duration Bucket"]]["Pageviews"] += floatval($val["Pageviews"]);
174
+ $_data[$val["Session Duration Bucket"]]["Avg Session Duration"] += $val["Avg Session Duration"];
175
+ }
176
+ else{
177
+ // $val["No"] = $j;
178
+ // $j++;
179
+ $_data[$val["Session Duration Bucket"]] = $val;
180
+ $_data[$val["Session Duration Bucket"]]["order"] = intval($val["Session Duration Bucket"]);
181
+ }
182
+
183
+
184
+ }
185
+ $this->data = array_values($_data);
186
+ foreach ($this->data as $key => $row) {
187
+ $yyy[$key] = $row['order'];
188
+ }
189
+ array_multisort($yyy, SORT_ASC, $this->data);
190
+ foreach($this->data as $j=>$val){
191
+ $val["No"] = ($j+1);
192
+ $this->data[$j] = $val;
193
+ }
194
+ }
195
+ elseif($_REQUEST['gawd_dimension'] == "Days To Transaction"){
196
+ foreach ($this->data as $key => $row) {
197
+ $daysToTransaction[$key] = $row['Days To Transaction'];
198
+ }
199
+ array_multisort($daysToTransaction, SORT_ASC, $this->data);
200
+ foreach($this->data as $j=>$val){
201
+ $val["No"] = ($j+1);
202
+ $this->data[$j] = $val;
203
+ }
204
+ }
205
+ foreach ($this->column_names as $column) {
206
+ $column = trim($column);
207
+ $width = ($column == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
208
+ $html .= '<th style="' . $width . ';background-color: #7DB5D8;color: #fff;">' . $column . '</th>';
209
+ }
210
+ $html .= '</tr>';
211
+ $row_count = 0;
212
+ foreach ($this->data as $dat => $value) {
213
+ if ((strtolower($this->column_names[1]) == 'page path' || strtolower($this->column_names[1]) == 'landing page path') && $row_count >= 150) {
214
+ break;
215
+ }
216
+ $html .= '<tr>';
217
+
218
+ foreach ($this->column_names as $key => $column) {
219
+ $column = trim(preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $column)))));
220
+
221
+ $text = ucfirst($value[$column]);
222
+ $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
223
+ if($column == "Page Path" || $column == "Landing Page" || strlen($text)>20){
224
+ if (strpos($text, ' ') === false) {
225
+ $text = '<span>' . $text;
226
+ $text = wordwrap($text, '10', '</span><span>', true);
227
+ $text .= '</span>';
228
+ }
229
+ }
230
+ elseif($column == 'Bounce Rate' || $column == 'Exit Rate' || $column == 'Ecommerce Conversion Rate'|| $column == 'Percent New Sessions' || $column == 'Transactions Per Session'){
231
+ $text = number_format(floatval($text),2, '.', ',') . '%';
232
+ }
233
+ elseif($column == 'Page Value' || $column == 'Item Revenue' || $column == 'Revenue' || $column == 'Transaction Revenue'){
234
+ $percentage_of_total = $this->data_sum[$column] != '0' ? floatval($text)/$this->data_sum[$column]*100 : 0;
235
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
236
+ $text = '$' . number_format(floatval($text),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
237
+ }
238
+ elseif($column == 'Pageviews Per Session'){
239
+ $text = number_format(floatval($text),2, '.', ',');
240
+ }
241
+ elseif($column == 'Avg Time On Page' || $column == 'Avg Page Load Time' || $column == 'Avg Session Duration' || $column =='Duration' || $column == 'Avg Page Load Time' || $column == 'Avg Redirection Time' || $column == 'Avg Server Response Time' || $column == 'Avg Page Download Time' || $column == 'Duration'){
242
+ if(strpos(':',$text) == false){
243
+ $text = $this->sec_to_normal(floatval($text));
244
+
245
+ }
246
+ }
247
+ elseif($column == 'No' || $column == $_REQUEST['gawd_dimension'] || $column == $dimension){
248
+ $text = $text;
249
+ }
250
+ else{
251
+ $percentage_of_total = isset($this->data_sum[$column]) ? $this->data_sum[$column] != '0' ? floatval($text)/$this->data_sum[$column]*100 : 0 : '';
252
+ if($percentage_of_total != ''){
253
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
254
+ if(strlen($text) > 3){
255
+ $text = number_format(floatval($text),2, '.', ',');
256
+ }
257
+ $text = $text .' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
258
+ }
259
+ }
260
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $text . '</td>';
261
+
262
+ }
263
+ $html .= '</tr>';
264
+ $row_count++;
265
+ }
266
+ $html .= '<tr>';
267
+ foreach ($this->column_names as $key => $column) {
268
+ $column = preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $column))));
269
+ $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
270
+ if($column == 'No' || $column == $_REQUEST['gawd_dimension'] || $column == 'Week' || $column == 'Month' || $column == 'Hour' || $column == $dimension){
271
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; "></td>';
272
+ }
273
+ else{
274
+ $val = isset($this->data_sum[$column]) ? $this->data_sum[$column] : '';
275
+ if($column == 'Bounce Rate' || $column == 'Exit Rate' || $column == 'Ecommerce Conversion Rate'|| $column == 'Percent New Sessions' || $column == 'Transactions Per Session'){
276
+ $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
277
+ }
278
+ else if($column == 'Page Value' || $column == 'Revenue' || $column == 'Item Revenue' || $column == 'Transaction Revenue'){
279
+ $val = 'Total: $'.number_format(floatval($val),2, '.', ',');
280
+ }
281
+ else if($column == 'Pageviews Per Session'){
282
+ $val = 'Total: '. number_format(floatval($val),2, '.', ',');
283
+ }
284
+ else if($column == 'Avg Time On Page' || $column == 'Avg Page Load Time' || $column == 'Avg Session Duration' || $column == 'Avg Session Duration' || $column == 'Avg Page Load Time' || $column == 'Avg Redirection Time' || $column == 'Avg Server Response Time' || $column == 'Avg Page Download Time' || $column == 'Duration'){
285
+ $val = 'Avg: '.$this->sec_to_normal(floatval($val));
286
+ }
287
+ else{
288
+ $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
289
+ }
290
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $val . '</td>';
291
+ }
292
+ }
293
+ $html .= '</tr>';
294
+ $html .= '</table>';
295
+ //die($html);
296
+ }
297
+ elseif($flag == 'pages'){
298
+ $html = $this->compared_pages_html();
299
+ }
300
+
301
+ elseif($flag == 'compare'){
302
+ $html = $this->compared_data_html();
303
+ }
304
+ return $html;
305
+ }
306
+ public function compared_data_html(){
307
+ $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
308
+ $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
309
+ $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
310
+ if($this->metric_compare == '0' || $this->metric_compare == ''){
311
+ $this->column_names[] = $this->metric." compare";
312
+ }
313
+ $count = count($this->column_names) - 1;
314
+ if($dimension == 'pagePath'){
315
+ $count = 9.5;
316
+ }
317
+ if ($count == 0) {
318
+ $no_width = "100";
319
+ $row_width = '0';
320
+ } else {
321
+ $no_width = "5";
322
+ $row_width = (95 / $count);
323
+ }
324
+ $html = '';
325
+
326
+ $html .= '<h2 style="text-align:center; margin-bottom:5px; color:#949494">' . $this->site_title . ' </h2>';
327
+ $html .= '<h4 style="text-align:center; margin-bottom:5px; color:#7DB5D8">' . $this->file_name . '</h4>';
328
+ if ($this->img_url) {
329
+ $html .= '<div style="width:100%;height:auto;">';
330
+ $html .= '<img width="800" style="margin-left:200px;" src="' . $this->img_url . '"/>';
331
+ $html .= '</div>';
332
+ }
333
+ $margin = 'margin-left:47px';
334
+ $html .= '<table border=1 style="width:100%;border: 1px solid #DCDCDC;border-spacing: 0;border-collapse: collapse;">'
335
+ . '<tr>';
336
+
337
+ foreach ($this->column_names as $column) {
338
+ $width = ($column == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
339
+ $html .= '<th style="' . $width . ';background-color: #7DB5D8;color: #fff;">' . $column . '</th>';
340
+ }
341
+ $html .= '</tr>';
342
+ $row_count = 0;
343
+ foreach ($this->_data_compare as $dat => $value) {
344
+ if ($this->column_names[1] == 'page Path' && $row_count >= 150) {
345
+ break;
346
+ }
347
+ $html .= '<tr>';
348
+ foreach ($this->column_names as $key => $column) {
349
+ $column = trim($column);
350
+ $text = ucfirst($value[$column]);
351
+ $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
352
+ if($column == "Page Path" || $column == "Landing Page" || $column == 'Hour' || $column == 'Week' || $column == 'Month' || strlen($text)>20){
353
+ if (strpos($text, ' ') === false) {
354
+ $text = '<span>' . $text;
355
+ $text = wordwrap($text, '10', '</span><span>', true);
356
+ $text .= '</span>';
357
+ }
358
+ }
359
+ elseif($column == 'Bounce Rate' || $column == 'Bounce Rate compare' || $column == 'Exit Rate' || $column == 'Ecommerce Conversion Rate'|| $column == 'Percent New Sessions' || $column == 'Percent New Sessions compare' || $column == 'Transactions Per Session'){
360
+ $text = number_format(floatval($text),2, '.', ',') . '%';
361
+ }
362
+ elseif($column == 'Page Value' || $column == 'Revenue' || $column == 'Transaction Revenue'){
363
+ if(strpos($column, 'compare') !== false){
364
+ $percentage_of_total = $this->second_data_sum->$column != '0' ? floatval($text)/$this->second_data_sum->$column*100 : 0;
365
+ }
366
+ else{
367
+ $percentage_of_total = $this->first_data_sum->$column != '0' ? floatval($text)/$this->first_data_sum->$column*100 : 0;
368
+ }
369
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
370
+ $text = '$' . number_format(floatval($text),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
371
+ }
372
+ elseif($column == 'Pageviews Per Session' || $column == 'Pageviews Per Session compare'){
373
+ $text = number_format(floatval($text),2, '.', ',');
374
+ }
375
+ elseif($column == 'Avg Time On Page' || $column == 'Avg Page Load Time' || $column == 'Avg Session Duration' || $column == 'Avg Session Duration compare'){
376
+ $text = $this->sec_to_normal(floatval($text));
377
+ }
378
+ elseif($column == 'No' || $column == $_REQUEST['gawd_dimension'] || $column == $dimension){
379
+ $text = $text;
380
+ }
381
+ else{
382
+ if(strpos($column, 'compare') !== false){
383
+ $column = str_replace(' compare','',$column);
384
+ $percentage_of_total = $this->second_data_sum->$column != '0' ? floatval($text)/$this->second_data_sum->$column*100 : 0;
385
+ }
386
+ else{
387
+ $percentage_of_total = $this->first_data_sum->$column != '0' ? floatval($text)/$this->first_data_sum->$column*100 : 0;
388
+ }
389
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
390
+ $text = number_format(floatval($text),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
391
+ $text = $text;
392
+ }
393
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $text . '</td>';
394
+
395
+ }
396
+ $html .= '</tr>';
397
+ $row_count++;
398
+ }
399
+ $html .= '<tr>';
400
+ foreach ($this->column_names as $key => $column) {
401
+ $column = trim($column);
402
+ $width = $column == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
403
+ if($column == 'No' || $column == $dimension || $column == 'Hour' || $column == 'Week' || $column == 'Month'){
404
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; "></td>';
405
+ }
406
+ else{
407
+ $val = '';
408
+ $val_second = '';
409
+ if(trim($column) != trim($this->metric.' compare')){
410
+ $column = trim($column);
411
+ $val = $this->first_data_sum->$column;
412
+ $val_second = $this->second_data_sum->$column;
413
+ }
414
+ if($column == 'Bounce Rate' || $column == 'Bounce Rate compare'){
415
+ $val = 'Avg: '.number_format(floatval($val),2, '.', ',') . '%';
416
+ $val_second = 'Avg: '.number_format(floatval($val_second),2, '.', ',') . '%';
417
+ }
418
+ else if($column == 'Pageviews Per Session' || $column == 'Pageviews Per Session compare'){
419
+ $val = 'Total: '. number_format(floatval($val),2, '.', ',');
420
+ $val_second = 'Total: '. number_format(floatval($val_second),2, '.', ',');
421
+ }
422
+ else if($column == 'Avg Session Duration' || $column == 'Avg Session Duration compare'){
423
+ $val = 'Avg: '.$this->sec_to_normal(floatval($val));
424
+ $val_second = 'Avg: '.$this->sec_to_normal(floatval($val_second));
425
+ }
426
+ elseif($column == 'Percent New Sessions' || $column == 'Percent New Sessions compare'){
427
+ $val = 'Avg: '. number_format(floatval($val),2, '.', ',').'%';
428
+ $val_second = 'Avg: '. number_format(floatval($val_second),2, '.', ',').'%';
429
+ }
430
+ else{
431
+ $val_second = $val_second != '' ? 'Total: '. number_format(floatval($val_second),2, '.', ',') : '';
432
+ $val = $val != '' ? 'Total: '. number_format(floatval($val),2, '.', ',') : '';
433
+
434
+ }
435
+ if($val != '' && $val_second != ''){
436
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $val . '</td>';
437
+ $html .= '<td style="' . $width . ';border: 1px solid #DCDCDC;padding-top:5px;color:#828282; ">' . $val_second . '</td>';
438
+ }
439
+ }
440
+ }
441
+ $html .= '</tr>';
442
+ $html .= '</table>';
443
+ //die($html);
444
+
445
+ return $html;
446
+ }
447
+ public function compared_pages_html(){
448
+ $this->first_data = json_decode(stripslashes($this->first_data));
449
+ $this->second_data = json_decode(stripslashes($this->second_data));
450
+ $this->first_data_sum = json_decode(stripslashes($this->first_data_sum));
451
+ $this->second_data_sum = json_decode(stripslashes($this->second_data_sum));
452
+ $dimension = isset($_REQUEST["dimension"]) ? sanitize_text_field($_REQUEST["dimension"]) : 'Date';
453
+ if ($dimension == 'Page Path' || $dimension == 'pagePath') {
454
+ $metrics = array(
455
+ 'No','Page Path','Pageviews','Unique Pageviews',
456
+ 'Avg Time On Page','Entrances','Bounce Rate',
457
+ 'Exit Rate','Page Value','Avg Page Load Time'
458
+ );
459
+ } elseif ($dimension == 'Landing Page Path' || $dimension == 'landingPagePath') {
460
+ $metrics = array(
461
+ 'No','Landing Page','Sessions','Percent New Sessions','New Users','Bounce Rate','Pageviews Per Session','Avg Session Duration','Transactions','Transaction Revenue','Transactions Per Session'
462
+ );
463
+ }
464
+
465
+ $count = count($metrics) - 1;
466
+ $margin = '';
467
+ if($dimension == 'pagePath'){
468
+ $margin = 'margin-left:18px;';
469
+ $count = 9.5;
470
+ }
471
+ if ($count == 0) {
472
+ $no_width = "100";
473
+ $row_width = '0';
474
+ } else {
475
+ $no_width = "5";
476
+ $row_width = (95 / $count);
477
+ }
478
+
479
+ $all_pages = array();
480
+ $max_length_data = count($this->first_data) >= count($this->second_data) ? $this->first_data : $this->second_data;
481
+ $min_length_data = count($this->first_data) >= count($this->second_data) ? $this->second_data : $this->first_data;
482
+
483
+ $max_length = count($max_length_data);
484
+ $min_length = count($min_length_data);
485
+
486
+
487
+ $min_paths = array();
488
+
489
+ for($i=0 ;$i<$min_length; $i++){
490
+ $min_paths[] = $min_length_data[$i]->$metrics[1];
491
+ }
492
+
493
+ for($i=0 ;$i<$max_length; $i++){
494
+ $all_pages[$max_length_data[$i]->$metrics[1]] = Array();
495
+ $all_pages[$max_length_data[$i]->$metrics[1]][0] = $max_length_data[$i];
496
+ if(!isset($min_length_data[$i]) || in_array($max_length_data[$i]->$metrics[1],$min_paths) === false){
497
+ $all_pages[$max_length_data[$i]->$metrics[1]][1] = 'no';
498
+ }
499
+ else{
500
+ $key = $i;
501
+ for($j=0; $j<$min_length; $j++){
502
+ if($min_length_data[$j]->$metrics[1] == $max_length_data[$i]->$metrics[1]){
503
+ $key = $j;
504
+ break;
505
+ }
506
+ }
507
+ $all_pages[$max_length_data[$i]->$metrics[1]][1] = $min_length_data[$key];
508
+ }
509
+ }
510
+ /*
511
+ for($i=0 ;$i<$max_length; $i++){
512
+ $all_pages[$max_length_data[$i]->$metrics[1]] = array();
513
+ array_push($all_pages[$max_length_data[$i]->$metrics[1]], 'no', 'no');
514
+ }
515
+
516
+
517
+ for($i=0 ;$i<$max_length; $i++){
518
+ if(isset($this->first_data[$i])){
519
+ if(!isset($all_pages[$max_length_data[$i]->$metrics[1]])){
520
+ $all_pages[$max_length_data[$i]->$metrics[1]] = array();
521
+ array_push($all_pages[$max_length_data[$i]->$metrics[1]], 'no', 'no');
522
+ }
523
+ $all_pages[$max_length_data[$i]->$metrics[1]][0] = $this->first_data[$i];
524
+ }
525
+ }
526
+
527
+ for($j=0 ;$j<$max_length; $j++){
528
+ if(isset($this->second_data[$j])){
529
+
530
+ if(!isset($all_pages[$max_length_data[$j]->$metrics[1]])){
531
+ $all_pages[$max_length_data[$j]->$metrics[1]] = array();
532
+ array_push($all_pages[$max_length_data[$j]->$metrics[1]], 'no', 'no');
533
+ }
534
+ $all_pages[$max_length_data[$j]->$metrics[1]][1] = $this->second_data[$j];
535
+ }
536
+ }*/
537
+
538
+ $table = '<h2 style="text-align:center; margin-bottom:5px; color:#949494">' . $this->site_title . ' </h2>';
539
+ $table .= '<h4 style="text-align:center; margin-bottom:5px; color:#7DB5D8">' . $this->file_name . '</h4>';
540
+ $table .= '<table border="1" style="' . $margin . 'width:100%;border-spacing: 0;border-collapse: collapse;">';
541
+ //$table .= '<thead>';
542
+ $table .= '<tr>';
543
+ for($j=0 ;$j<count($metrics); $j++){
544
+ $width = ($metrics[$j] == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
545
+ $table .= '<th style="' . $width . ';background-color: #7DB5D8;color: #fff;">' . $metrics[$j] . '</th>';
546
+ }
547
+ $table .= '</tr>';
548
+ $table .= '<tr>';
549
+ for($j=0 ;$j<count($metrics); $j++){
550
+ $width = $metrics[$j] == 'No' ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
551
+ if($metrics[$j] == 'No' || $metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
552
+
553
+ $table .= '<td style="' . $width . '"></td>';
554
+ }
555
+ else{
556
+ $this->first_data_sum->$metrics[$j] = floatval($this->first_data_sum->$metrics[$j]);
557
+ $this->second_data_sum->$metrics[$j] = floatval($this->second_data_sum->$metrics[$j]);
558
+ $arrow = '<img src=""/>';
559
+ $percent = number_format((($this->first_data_sum->$metrics[$j] - $this->second_data_sum->$metrics[$j])/((($this->second_data_sum->$metrics[$j])!=0) ? $this->second_data_sum->$metrics[$j] : 1)) * 100, 2, '.', ',');
560
+ if(!($percent)){
561
+ $percent = 0;
562
+ }
563
+ else if(strpos($percent, '-') === 0){
564
+ $percent = substr($percent,1);
565
+ $arrow = '<img src="' . GAWD_URL . '/assets/arrow-down.png"/>';
566
+ }
567
+ else{
568
+ $arrow = '<img src="' . GAWD_URL . '/assets/arrow-up.png"/>';
569
+ }
570
+ $table .= '<td style="' . $width . ' font-weight:bold;padding-top:5px;color:#828282;"><div>' . sanitize_text_field($percent) . '%' . $arrow . '</div>';
571
+ $this->second_data_sum_value = number_format($this->second_data_sum->$metrics[$j],2, '.', ',');
572
+ $this->first_data_sum_value = number_format($this->first_data_sum->$metrics[$j],2, '.', ',');
573
+ if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
574
+ $this->second_data_sum_value = $this->sec_to_normal($this->second_data_sum_value);
575
+ $this->first_data_sum_value = $this->sec_to_normal($this->first_data_sum_value);
576
+ }
577
+ if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
578
+ $this->first_data_sum_value = number_format(floatval($this->first_data_sum_value),2, '.', ',') . '%';
579
+ $this->second_data_sum_value = number_format(floatval($this->second_data_sum_value),2, '.', ',') . '%';
580
+ }
581
+ else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue'){
582
+ $this->first_data_sum_value = '$' . number_format(floatval($this->first_data_sum_value),2, '.', ',');
583
+ $this->second_data_sum_value = '$' . number_format(floatval($this->second_data_sum_value),2, '.', ',');
584
+ }
585
+ $table .= '<div>' . sanitize_text_field($this->first_data_sum_value) . ' vs ' . sanitize_text_field($this->second_data_sum_value) . '</div>';
586
+ $table .= '</td>';
587
+ }
588
+ }
589
+ $table .= '</tr>';
590
+ //$table .= '</thead>';
591
+ //$table .= '<tbody>';
592
+
593
+ $length = count($all_pages);
594
+ $keys = array_keys($all_pages);
595
+ for($i=0 ;$i<$length; $i++){
596
+ if($i >= 50){
597
+ break;
598
+ }
599
+ $width = 'width:' . $row_width . '%;';
600
+ $table .= '<tr>';
601
+ $table .= '<td style="width:5%">' . intval($i+1) .'</td>';
602
+ $keys[$i] = '<span>' . $keys[$i];
603
+ $keys[$i] = wordwrap($keys[$i], '10', '</span><span>', true);
604
+ $keys[$i] .= '</span>';
605
+ $table .= '<td style="' . $width . '">' . $keys[$i] .'</td>';
606
+ $table .= '</tr>';
607
+ $table .= '<tr>';
608
+ for($j = 0; $j < count($metrics); $j++){
609
+ if($metrics[$j] == 'No'){
610
+ $table .= '<td ></td>';
611
+ }
612
+ else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
613
+ $table .= '<td style="' . $width . '">' . date('M d, Y', strtotime($this->start_date)) . ' - ' . date('M d, Y', strtotime($this->end_date)) .'</td>';
614
+ }
615
+ else{
616
+ $keys[$i] = sanitize_text_field($keys[$i]);
617
+ if($all_pages[$keys[$i]][0] != 'no'){
618
+ $line_value = $all_pages[$keys[$i]][0]->$metrics[$j];
619
+ if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
620
+ $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
621
+ }
622
+ else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Item Revenue'){
623
+ $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
624
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
625
+ $line_value = '$<span class="row_percent">' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)</span>';
626
+ }
627
+ else if($metrics[$j] == 'Pageviews Per Session'){
628
+ $line_value = number_format(floatval($line_value),2, '.', ',');
629
+ }
630
+ else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
631
+ $line_value = $this->sec_to_normal(floatval($line_value));
632
+ }
633
+ else{
634
+ $percentage_of_total = $this->first_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->first_data_sum->$metrics[$j]*100 : 0;
635
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
636
+ $line_value = number_format(floatval($line_value),2, '.', ',') . ' <span class="row_percent">(' . $percentage_of_total .'%)</span>';
637
+ }
638
+ if (strpos($line_value, ' ') === false) {
639
+ $line_value = '<span>' . $line_value;
640
+ $line_value = wordwrap($line_value, '10', '</span><span>', true);
641
+ $line_value .= '</span>';
642
+ }
643
+ $table .= '<td style="' . $width . 'text-align:center">' . $line_value . '</td>';
644
+ }
645
+ else{
646
+ $table .= '<td style="text-align:center">0</td>';
647
+ }
648
+ }
649
+ }
650
+ $table .= '</tr>';
651
+ $table .= '<tr>';
652
+ for($j = 0; $j < count($metrics); $j++){
653
+ if($metrics[$j] == 'No'){
654
+ $table .= '<td style="width:5%"></td>';
655
+ }
656
+ else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
657
+ $width = ($metrics[$j] == 'No') ? 'width:' . $no_width . '%;' : 'width:' . $row_width . '%;';
658
+ $table .= '<td style="' . $width . '">' . date('M d, Y', strtotime($this->second_start_date)) . ' - ' . date('M d, Y', strtotime($this->second_end_date)) .'</td>';
659
+ }
660
+ else{
661
+ $keys[$i] = sanitize_text_field($keys[$i]);
662
+ if($all_pages[$keys[$i]][1] != 'no'){
663
+ $line_value = $all_pages[$keys[$i]][1]->$metrics[$j];
664
+ if($metrics[$j] == 'Bounce Rate' || $metrics[$j] == 'Exit Rate' || $metrics[$j] == 'New Sessions' || $metrics[$j] == 'Ecommerce Conversion Rate'){
665
+ $line_value = number_format(floatval($line_value),2, '.', ',') . '%';
666
+ }
667
+ else if($metrics[$j] == 'Page Value' || $metrics[$j] == 'Transaction Revenue' || $metrics[$j] == 'Revenue' || $metrics[$j] == 'Item Revenue'){
668
+ $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
669
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
670
+ $line_value = '$<span class="row_percent">' . number_format(floatval($line_value),2, '.', ',') . ' (' . $percentage_of_total .'%)</span>';
671
+ }
672
+ else if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
673
+ $line_value = $this->sec_to_normal(floatval($line_value));
674
+ }
675
+ else if($metrics[$j] == 'Pageviews Per Session'){
676
+ $line_value = number_format(floatval($line_value),2, '.', ',');
677
+ }
678
+ else{
679
+ $percentage_of_total = $this->second_data_sum->$metrics[$j] != '0' ? floatval($line_value)/$this->second_data_sum->$metrics[$j]*100 : 0;
680
+ $percentage_of_total = number_format(floatval($percentage_of_total),2, '.', ',');
681
+ $line_value = number_format(floatval($line_value),2, '.', ',') . '<span class="row_percent">(' . $percentage_of_total .'%)</span>';
682
+ }
683
+ $table .= '<td style="text-align:center">' . $line_value . '</td>';
684
+ }
685
+ else{
686
+ $table .= '<td style="text-align:center">0</td>';
687
+ }
688
+ }
689
+ }
690
+ $table .= '</tr>';
691
+ $table .= '<tr>';
692
+ for($j = 0; $j < count($metrics); $j++){
693
+ if($metrics[$j] == 'No'){
694
+ $table .= '<td style="width:5%"></td>';
695
+ }
696
+ else if($metrics[$j] == 'Page Path' || $metrics[$j] == 'Landing Page'){
697
+ $table .= '<td style="font-weight:bold;">% Change</td>';
698
+ }
699
+ else{
700
+ if($all_pages[$keys[$i]][0] != 'no'){
701
+ $_single_data = $all_pages[$keys[$i]][0]->$metrics[$j];
702
+ }
703
+ else{
704
+ $_single_data = 0;
705
+ }
706
+ if($all_pages[$keys[$i]][1] != 'no'){
707
+ $single_data = $all_pages[$keys[$i]][1]->$metrics[$j];
708
+ }
709
+ else{
710
+ $single_data = 0;
711
+ }
712
+ if($metrics[$j] == 'Avg Time On Page' || $metrics[$j] == 'Avg Page Load Time' || $metrics[$j] == 'Avg Session Duration'){
713
+
714
+ $_single_data = explode(":",$_single_data);
715
+
716
+ if(strpos($_single_data[0], '0') === 0){
717
+ $_single_data[0] = substr($_single_data[0],0,1);
718
+ $_single_data[0] = $_single_data[0];
719
+ }
720
+ if(count($_single_data) > 1){
721
+ if(strpos($_single_data[1],'0') === 0){
722
+ $_single_data[1] = substr($_single_data[1],0,1);
723
+ $_single_data[1] = $_single_data[1]*60;
724
+ }
725
+ if(strpos($_single_data[2],'0') === 0){
726
+ $_single_data[2] = substr($_single_data[2],0,1);
727
+ $_single_data[2] = $_single_data[2];
728
+ }
729
+ }
730
+ $a = !isset($_single_data[0]) ? 0 : floatval($_single_data[0]);
731
+ $b = !isset($_single_data[1]) ? 0 : floatval($_single_data[1]);
732
+ $c = !isset($_single_data[2]) ? 0 : floatval($_single_data[2]);
733
+ $_single_data = $a + $b + $c;
734
+
735
+ //$_single_data = ($_single_data[0] . ((!isset($_single_data[1])) ? 0 : $_single_data[1]) . ((!isset($_single_data[2])) ? 0 : $_single_data[2]));
736
+ $single_data = explode(":",$single_data);
737
+ if(strpos($single_data[0], '0') === 0){
738
+ $single_data[0] = substr($single_data[0],0,1);
739
+ $single_data[0] = $single_data[0];
740
+ }
741
+ if(count($single_data) > 1){
742
+ if(strpos($single_data[1],'0') === 0){
743
+ $single_data[1] = substr($single_data[1],0,1);
744
+ $single_data[1] = $single_data[1]*60;
745
+ }
746
+ if(strpos($single_data[2],'0') === 0){
747
+ $single_data[2] = substr($single_data[2],0,1);
748
+ $single_data[2] = $single_data[2];
749
+ }
750
+ }
751
+ $a = !isset($single_data[0]) ? 0 : floatval($single_data[0]);
752
+ $b = !isset($single_data[1]) ? 0 : floatval($single_data[1]);
753
+ $c = !isset($single_data[2]) ? 0 : floatval($single_data[2]);
754
+ $single_data = $a + $b + $c;
755
+ }
756
+
757
+ $single_percent = ($single_data != 0) ? number_format((($_single_data - $single_data)/$single_data) * 100,2, '.', ',') :'<img src="' . GAWD_URL . '/assets/infinity.png" />';
758
+
759
+ //$single_percent = is_nan($single_percent) ? 0 : is_infinite($single_percent) ? $single_percent : '&infin;';
760
+ $table .= '<td style="font-weight:bold;text-align:center">' . $single_percent . '%</td>';
761
+ }
762
+ }
763
+ $table .= '</tr>';
764
+ }
765
+ //$table .= '</tbody>';
766
+ $table .= '</table>';
767
+
768
+ //echo $table;die;
769
+ return $table;
770
+ }
771
+ public function sec_to_normal($data){
772
+ $hours = strlen(floor($data / 3600)) < 2 ? '0' . floor($data / 3600) : floor($data / 3600);
773
+ $mins = strlen(floor($data / 60 % 60)) < 2 ? '0' . floor($data / 60 % 60) : floor($data / 60 % 60);
774
+ $secs = strlen(ceil($data % 60)) < 2 ? '0' . ceil($data % 60) : ceil($data % 60);
775
+ return $data = $hours . ':' . $mins . ':' . $secs;
776
+ }
777
+ public function create_image() {
778
+ if ($this->img == '') {
779
+ return;
780
+ }
781
+ $this->img = explode('image/png;base64,', $this->img);
782
+ $uplode_dir = wp_upload_dir();
783
+ $image_dir = $uplode_dir['path'] . '/export_chart.png';
784
+ file_put_contents($image_dir, base64_decode($this->img[1]));
785
+ chmod($image_dir, 0777);
786
+ $this->img_url = $uplode_dir['url'] . '/export_chart.png';
787
+ }
788
+
789
+ }
readme.txt CHANGED
@@ -4,11 +4,11 @@ Donate link: https://web-dorado.com/products/wordpress-google-analytics-plugin.h
4
  Tags: google analytics, google analytics dashboard, statistics, tracking, analytics, analytics dashboard, stats, ga, googleanalytics, ecommerce tracking, custom reports, custom dimensions
5
  Requires at least: 3.9
6
  Tested up to: 4.6
7
- Stable tag: 1.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Google Analytics WD is a powerful plugin, which adds tracking code to your website, lets you view Google Analytics reports, manage goals, filters and more from your WordPress site.
12
 
13
  == Description ==
14
 
@@ -98,6 +98,12 @@ Upgrade to Google Analytics WD Pro for premium features:
98
 
99
  == Changelog ==
100
 
 
 
 
 
 
 
101
  = 1.0.7 =
102
  Fixed: Bug in Site Content reports
103
 
4
  Tags: google analytics, google analytics dashboard, statistics, tracking, analytics, analytics dashboard, stats, ga, googleanalytics, ecommerce tracking, custom reports, custom dimensions
5
  Requires at least: 3.9
6
  Tested up to: 4.6
7
+ Stable tag: 1.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Google Analytics WD is a powerful plugin, which adds tracking to your website, lets you view Analytics reports, manage goals, filters, etc.
12
 
13
  == Description ==
14
 
98
 
99
  == Changelog ==
100
 
101
+ = 1.0.8 =
102
+ Added: Google Analytics reports for custom post types
103
+ Added: New icon in the menu
104
+ Added: New header on WordPress.org
105
+ Fixed: JS error on creating new pages/posts
106
+
107
  = 1.0.7 =
108
  Fixed: Bug in Site Content reports
109