Version Description
- Changed: Remove deactivation popup.
- Fixed: Audience tab view.
Download this release
Release Info
Developer | 10web |
Plugin | WD Google Analytics |
Version | 1.2.11 |
Comparing to | |
See all releases |
Code changes from version 1.2.10 to 1.2.11
- admin/pages/add_web_property.php +79 -79
- admin/pages/authentication.php +50 -50
- admin/pages/custom_reports.php +1 -1
- admin/pages/dashboard.php +702 -702
- admin/pages/dashboard_menu.php +134 -134
- admin/pages/dashboard_widget.php +56 -56
- admin/pages/date.php +59 -59
- admin/pages/goals.php +312 -312
- admin/pages/licensing.php +78 -78
- admin/pages/location.php +10 -10
- admin/pages/logs.php +38 -38
- admin/pages/overview.php +77 -77
- admin/pages/settings.php +1097 -1097
- admin/pages/tracking.php +336 -336
- admin/pages/uninstall.php +131 -131
- admin/tracking.php +182 -182
- admin/updates.php +148 -148
- assets/search.svg +11 -11
- config.php +1 -1
- gawd_class.php +1741 -1741
- google-analytics-wd.php +2 -2
- google/.gitattributes +9 -9
- google/LICENSE +203 -203
- google/README.md +368 -368
- google/composer.json +41 -41
- google/composer.lock +1757 -1757
- google/src/Google/AccessToken/Revoke.php +78 -78
- google/src/Google/AccessToken/Verify.php +272 -272
- google/src/Google/AuthHandler/AuthHandlerFactory.php +42 -42
- google/src/Google/AuthHandler/Guzzle5AuthHandler.php +99 -99
- google/src/Google/AuthHandler/Guzzle6AuthHandler.php +106 -106
- google/src/Google/Client.php +1118 -1118
- google/src/Google/Collection.php +100 -100
- google/src/Google/Exception.php +20 -20
- google/src/Google/Http/Batch.php +249 -249
- google/src/Google/Http/MediaFileUpload.php +351 -351
- google/src/Google/Http/REST.php +182 -182
- google/src/Google/Model.php +317 -317
- google/src/Google/Service.php +56 -56
- google/src/Google/Service/Exception.php +68 -68
- google/src/Google/Service/README.md +5 -5
- google/src/Google/Service/Resource.php +296 -296
- google/src/Google/Task/Exception.php +20 -20
- google/src/Google/Task/Retryable.php +24 -24
- google/src/Google/Task/Runner.php +281 -281
- google/src/Google/Utils/UriTemplate.php +333 -333
- google/src/Google/autoload.php +21 -21
- google/vendor/autoload.php +7 -7
- google/vendor/composer/ClassLoader.php +445 -445
- google/vendor/composer/LICENSE +21 -21
- google/vendor/composer/autoload_classmap.php +39 -39
- google/vendor/composer/autoload_files.php +12 -12
- google/vendor/composer/autoload_namespaces.php +18 -18
- google/vendor/composer/autoload_psr4.php +17 -17
- google/vendor/composer/autoload_real.php +74 -74
- google/vendor/composer/autoload_static.php +176 -176
- google/vendor/composer/include_paths.php +10 -10
- google/vendor/composer/installed.json +720 -720
- google/vendor/firebase/php-jwt/Firebase/PHP-JWT/.gitignore +3 -3
- google/vendor/firebase/php-jwt/Firebase/PHP-JWT/.travis.yml +13 -13
- google/vendor/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php +0 -322
admin/pages/add_web_property.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by PhpStorm.
|
4 |
-
* User: mher
|
5 |
-
* Date: 1/31/18
|
6 |
-
* Time: 1:38 PM
|
7 |
-
*/
|
8 |
-
|
9 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
10 |
-
$properties = GAWD_helper::get_current_site_properties();
|
11 |
-
$accounts = GAWD_helper::get_management_accounts();
|
12 |
-
|
13 |
-
if(empty($properties)) { ?>
|
14 |
-
<p class='gawd_notice'>
|
15 |
-
Create <b>web property</b> on your Google Analytics account to enable tracking of this website. After
|
16 |
-
creating a <b>web property</b> Google Analytics tracking code automatically will beadded to your website.
|
17 |
-
</p>
|
18 |
-
<div class='gawd_settings_wrapper'>
|
19 |
-
<div class='gawd_goal_row'>
|
20 |
-
<span class='gawd_goal_label'>Account</span>
|
21 |
-
<span class='gawd_goal_input'>
|
22 |
-
<select class='gawd_account_select'
|
23 |
-
style='padding: 2px;width: 96%;line-height: 30px;height: 30px !important;'>";
|
24 |
-
<?php foreach($accounts as $account) { ?>
|
25 |
-
<option value="<?php echo $account['id']; ?>"><?php echo $account['name']; ?></option>
|
26 |
-
<?php } ?>
|
27 |
-
</select>
|
28 |
-
</span>
|
29 |
-
<div class='gawd_info'
|
30 |
-
title='Choose the Google Analytics account to connect this property to.'></div>
|
31 |
-
<div class='clear'></div>
|
32 |
-
</div>
|
33 |
-
<div class='gawd_goal_row'>
|
34 |
-
<span class='gawd_goal_label'>Name</span>
|
35 |
-
<span class='gawd_goal_input'>
|
36 |
-
<input id='gawd_property_name' name='gawd_property_name' type='text'>
|
37 |
-
</span>
|
38 |
-
<div class='gawd_info' title='Provide a name for the property.'></div>
|
39 |
-
<div class='clear'></div>
|
40 |
-
</div>
|
41 |
-
</div>
|
42 |
-
<div class='clear'></div>
|
43 |
-
<div class='gawd_add_prop gawd_submit'>
|
44 |
-
<input type='button' id='gawd_add_property' class='button_gawd' value='Add'/>
|
45 |
-
</div>
|
46 |
-
<?php
|
47 |
-
}
|
48 |
-
|
49 |
-
if(count($properties) > 1) { ?>
|
50 |
-
<p class='gawd_notice'>
|
51 |
-
You have multiple web-properties set with current site url. Please select the one that you want to use for
|
52 |
-
tracking from the list below.
|
53 |
-
</p>
|
54 |
-
<div class='gawd_settings_wrapper'>
|
55 |
-
<div class='gawd_goal_row'>
|
56 |
-
<span class='gawd_goal_label'>Web-property</span>
|
57 |
-
<span class='gawd_goal_input'>
|
58 |
-
<select class='gawd_property_select'
|
59 |
-
style='padding: 2px;width: 96%;line-height: 30px;height: 30px !important;'>
|
60 |
-
<option value="0">Select a web-property (required)</option>
|
61 |
-
<?php foreach($properties as $select_property) { ?>
|
62 |
-
<option value='<?php echo $select_property['id']; ?>'>
|
63 |
-
<?php echo $select_property['name'] . " (" . $select_property['id'] . ")"; ?>
|
64 |
-
</option>
|
65 |
-
<?php } ?>
|
66 |
-
</select>
|
67 |
-
</span>
|
68 |
-
<div class='gawd_info' title=''></div>
|
69 |
-
<div class='clear'></div>
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
-
<div class='clear'></div>
|
73 |
-
<div class='gawd_submit'>
|
74 |
-
<input type='button' id='gawd_choose_property' class='button_gawd gawd_disabled_button' value='Add'/>
|
75 |
-
</div>
|
76 |
-
<?php
|
77 |
-
}
|
78 |
-
|
79 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: mher
|
5 |
+
* Date: 1/31/18
|
6 |
+
* Time: 1:38 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
10 |
+
$properties = GAWD_helper::get_current_site_properties();
|
11 |
+
$accounts = GAWD_helper::get_management_accounts();
|
12 |
+
|
13 |
+
if(empty($properties)) { ?>
|
14 |
+
<p class='gawd_notice'>
|
15 |
+
Create <b>web property</b> on your Google Analytics account to enable tracking of this website. After
|
16 |
+
creating a <b>web property</b> Google Analytics tracking code automatically will beadded to your website.
|
17 |
+
</p>
|
18 |
+
<div class='gawd_settings_wrapper'>
|
19 |
+
<div class='gawd_goal_row'>
|
20 |
+
<span class='gawd_goal_label'>Account</span>
|
21 |
+
<span class='gawd_goal_input'>
|
22 |
+
<select class='gawd_account_select'
|
23 |
+
style='padding: 2px;width: 96%;line-height: 30px;height: 30px !important;'>";
|
24 |
+
<?php foreach($accounts as $account) { ?>
|
25 |
+
<option value="<?php echo $account['id']; ?>"><?php echo $account['name']; ?></option>
|
26 |
+
<?php } ?>
|
27 |
+
</select>
|
28 |
+
</span>
|
29 |
+
<div class='gawd_info'
|
30 |
+
title='Choose the Google Analytics account to connect this property to.'></div>
|
31 |
+
<div class='clear'></div>
|
32 |
+
</div>
|
33 |
+
<div class='gawd_goal_row'>
|
34 |
+
<span class='gawd_goal_label'>Name</span>
|
35 |
+
<span class='gawd_goal_input'>
|
36 |
+
<input id='gawd_property_name' name='gawd_property_name' type='text'>
|
37 |
+
</span>
|
38 |
+
<div class='gawd_info' title='Provide a name for the property.'></div>
|
39 |
+
<div class='clear'></div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<div class='clear'></div>
|
43 |
+
<div class='gawd_add_prop gawd_submit'>
|
44 |
+
<input type='button' id='gawd_add_property' class='button_gawd' value='Add'/>
|
45 |
+
</div>
|
46 |
+
<?php
|
47 |
+
}
|
48 |
+
|
49 |
+
if(count($properties) > 1) { ?>
|
50 |
+
<p class='gawd_notice'>
|
51 |
+
You have multiple web-properties set with current site url. Please select the one that you want to use for
|
52 |
+
tracking from the list below.
|
53 |
+
</p>
|
54 |
+
<div class='gawd_settings_wrapper'>
|
55 |
+
<div class='gawd_goal_row'>
|
56 |
+
<span class='gawd_goal_label'>Web-property</span>
|
57 |
+
<span class='gawd_goal_input'>
|
58 |
+
<select class='gawd_property_select'
|
59 |
+
style='padding: 2px;width: 96%;line-height: 30px;height: 30px !important;'>
|
60 |
+
<option value="0">Select a web-property (required)</option>
|
61 |
+
<?php foreach($properties as $select_property) { ?>
|
62 |
+
<option value='<?php echo $select_property['id']; ?>'>
|
63 |
+
<?php echo $select_property['name'] . " (" . $select_property['id'] . ")"; ?>
|
64 |
+
</option>
|
65 |
+
<?php } ?>
|
66 |
+
</select>
|
67 |
+
</span>
|
68 |
+
<div class='gawd_info' title=''></div>
|
69 |
+
<div class='clear'></div>
|
70 |
+
</div>
|
71 |
+
</div>
|
72 |
+
<div class='clear'></div>
|
73 |
+
<div class='gawd_submit'>
|
74 |
+
<input type='button' id='gawd_choose_property' class='button_gawd gawd_disabled_button' value='Add'/>
|
75 |
+
</div>
|
76 |
+
<?php
|
77 |
+
}
|
78 |
+
|
79 |
+
|
admin/pages/authentication.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Created by PhpStorm.
|
4 |
-
* User: mher
|
5 |
-
* Date: 2/7/18
|
6 |
-
* Time: 5:18 PM
|
7 |
-
*/
|
8 |
-
|
9 |
-
if(GAWD_helper::get_management_accounts() == false) { ?>
|
10 |
-
<div class="no_account_content clearfix <?php echo $hide_refresh_accounts; ?>">
|
11 |
-
<p style="color: red;">
|
12 |
-
You have Google account, but it does not have configured Analytics account. Click create button to create account and refresh afterwards.
|
13 |
-
</p>
|
14 |
-
<a id="gawd_refresh_management_accounts" class="gawd_account_button gwd_refresh_page gawd_hidden" href="">Refresh</a>
|
15 |
-
<div class="gawd_account_button gwd_another_account" onclick="gawd_show_authenticate_form()">
|
16 |
-
Authenticate with another account
|
17 |
-
</div>
|
18 |
-
<a class="gawd_auth_button gwd_create_account"
|
19 |
-
href="https://analytics.google.com/analytics/web/provision/?authuser=0#provision/SignUp/"
|
20 |
-
target="_blank" onclick="gawd_reload_account()">CREATE</a>
|
21 |
-
</div>
|
22 |
-
<?php } ?>
|
23 |
-
<div class="gawd_auth_wrap gawd_auth_authenticate <?php echo $hide_auth; ?>">
|
24 |
-
<p class="auth_description">
|
25 |
-
Click <b>Authenticate</b> button and login to your Google account. A window asking for relevant permissions will
|
26 |
-
appear. Click <b>Allow</b> and copy the authentication code from the text input.
|
27 |
-
</p>
|
28 |
-
<div id="gawd_auth_url" onclick="gawd_auth_popup(800,400)" style="cursor: pointer;">
|
29 |
-
<div class="gawd_auth_button">AUTHENTICATE</div>
|
30 |
-
<div class="clear"></div>
|
31 |
-
</div>
|
32 |
-
<div id="gawd_auth_code">
|
33 |
-
<form id="gawd_auth_code_paste" action="" method="post" onSubmit="return false;">
|
34 |
-
<p style="margin:0;color: #444;">Paste the authentication code from the popup to this input.</p>
|
35 |
-
<input id="gawd_token" type="text">
|
36 |
-
<?php wp_nonce_field("gawd_save_form", "gawd_save_form_fild"); ?>
|
37 |
-
</form>
|
38 |
-
<div id="gawd_auth_code_submit">SUBMIT</div>
|
39 |
-
</div>
|
40 |
-
<?php if($gawd_credentials['default'] === false) { ?>
|
41 |
-
<a class="gawd_reset_credentials" id="gawd_reset_credentials">Stop using own project</a>
|
42 |
-
<?php } ?>
|
43 |
-
</div>
|
44 |
-
<div id="opacity_div"
|
45 |
-
style="display: none; background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
|
46 |
-
<div id="loading_div"
|
47 |
-
style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
|
48 |
-
<img src="<?php echo GAWD_URL ?>/assets/ajax_loader.gif" style="margin-top: 200px; width:50px;">
|
49 |
-
</div>
|
50 |
-
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: mher
|
5 |
+
* Date: 2/7/18
|
6 |
+
* Time: 5:18 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
if(GAWD_helper::get_management_accounts() == false) { ?>
|
10 |
+
<div class="no_account_content clearfix <?php echo $hide_refresh_accounts; ?>">
|
11 |
+
<p style="color: red;">
|
12 |
+
You have Google account, but it does not have configured Analytics account. Click create button to create account and refresh afterwards.
|
13 |
+
</p>
|
14 |
+
<a id="gawd_refresh_management_accounts" class="gawd_account_button gwd_refresh_page gawd_hidden" href="">Refresh</a>
|
15 |
+
<div class="gawd_account_button gwd_another_account" onclick="gawd_show_authenticate_form()">
|
16 |
+
Authenticate with another account
|
17 |
+
</div>
|
18 |
+
<a class="gawd_auth_button gwd_create_account"
|
19 |
+
href="https://analytics.google.com/analytics/web/provision/?authuser=0#provision/SignUp/"
|
20 |
+
target="_blank" onclick="gawd_reload_account()">CREATE</a>
|
21 |
+
</div>
|
22 |
+
<?php } ?>
|
23 |
+
<div class="gawd_auth_wrap gawd_auth_authenticate <?php echo $hide_auth; ?>">
|
24 |
+
<p class="auth_description">
|
25 |
+
Click <b>Authenticate</b> button and login to your Google account. A window asking for relevant permissions will
|
26 |
+
appear. Click <b>Allow</b> and copy the authentication code from the text input.
|
27 |
+
</p>
|
28 |
+
<div id="gawd_auth_url" onclick="gawd_auth_popup(800,400)" style="cursor: pointer;">
|
29 |
+
<div class="gawd_auth_button">AUTHENTICATE</div>
|
30 |
+
<div class="clear"></div>
|
31 |
+
</div>
|
32 |
+
<div id="gawd_auth_code">
|
33 |
+
<form id="gawd_auth_code_paste" action="" method="post" onSubmit="return false;">
|
34 |
+
<p style="margin:0;color: #444;">Paste the authentication code from the popup to this input.</p>
|
35 |
+
<input id="gawd_token" type="text">
|
36 |
+
<?php wp_nonce_field("gawd_save_form", "gawd_save_form_fild"); ?>
|
37 |
+
</form>
|
38 |
+
<div id="gawd_auth_code_submit">SUBMIT</div>
|
39 |
+
</div>
|
40 |
+
<?php if($gawd_credentials['default'] === false) { ?>
|
41 |
+
<a class="gawd_reset_credentials" id="gawd_reset_credentials">Stop using own project</a>
|
42 |
+
<?php } ?>
|
43 |
+
</div>
|
44 |
+
<div id="opacity_div"
|
45 |
+
style="display: none; background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
|
46 |
+
<div id="loading_div"
|
47 |
+
style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
|
48 |
+
<img src="<?php echo GAWD_URL ?>/assets/ajax_loader.gif" style="margin-top: 200px; width:50px;">
|
49 |
+
</div>
|
50 |
+
|
admin/pages/custom_reports.php
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
<img class="gawd_pro_img" data-gawd-screenshot="custom_reports" src=<?php echo GAWD_URL.'/assets/free-pages/custom_reports.png' ?> />
|
2 |
<?php GAWD_helper::print_pro_popup(); ?>
|
1 |
+
<img class="gawd_pro_img" data-gawd-screenshot="custom_reports" src=<?php echo GAWD_URL.'/assets/free-pages/custom_reports.png' ?> />
|
2 |
<?php GAWD_helper::print_pro_popup(); ?>
|
admin/pages/dashboard.php
CHANGED
@@ -1,703 +1,703 @@
|
|
1 |
-
<?php
|
2 |
-
$get_custom_reports = get_option('gawd_custom_reports');
|
3 |
-
if(!isset($_GET['tab'])){
|
4 |
-
$_GET['tab'] = 'general';
|
5 |
-
}
|
6 |
-
/*FREE*/
|
7 |
-
if($_GET['tab'] !== 'general' && $_GET['tab'] !== 'realtime'){
|
8 |
-
$_GET['tab'] = 'general';
|
9 |
-
}
|
10 |
-
|
11 |
-
$tabs = get_option('gawd_menu_items');
|
12 |
-
$gawd_zoom_message = get_option('gawd_zoom_message');
|
13 |
-
$current_user = get_current_user_id();
|
14 |
-
$saved_user_menues = get_option('gawd_menu_for_user');
|
15 |
-
if($current_user != 1 && isset($saved_user_menues[$current_user])){
|
16 |
-
$tabs = array_intersect_key($tabs, $saved_user_menues[$current_user]);
|
17 |
-
}
|
18 |
-
|
19 |
-
$line_column = array('general', 'siteSpeed', 'goals');
|
20 |
-
$pie_column = array(
|
21 |
-
'userGender',
|
22 |
-
'inMarket',
|
23 |
-
'affinityCategory',
|
24 |
-
'otherCategory',
|
25 |
-
'location',
|
26 |
-
'language',
|
27 |
-
'behaviour',
|
28 |
-
'os',
|
29 |
-
'browser',
|
30 |
-
'device_overview',
|
31 |
-
'devices',
|
32 |
-
'trafficSource',
|
33 |
-
);
|
34 |
-
$column_pie = array('userAge', 'engagement', 'adWords','eventsLabel', 'eventsAction', 'eventsCategory', 'productSku', 'productCategory', 'productName', 'custom');
|
35 |
-
$column = array();
|
36 |
-
|
37 |
-
if(in_array($_GET['tab'], $line_column)) {
|
38 |
-
$chart_types = array('line' => 'Line Chart', 'column' => 'Columns');
|
39 |
-
} else if(in_array($_GET['tab'], $pie_column)) {
|
40 |
-
$chart_types = array('pie' => 'Pie Chart', 'column' => 'Columns');
|
41 |
-
} else if(in_array($_GET['tab'], $column_pie)) {
|
42 |
-
$chart_types = array('column' => 'Columns', 'pie' => 'Pie Chart');
|
43 |
-
} else if(in_array($_GET['tab'], $column)) {
|
44 |
-
$chart_types = array('column' => 'Columns');
|
45 |
-
} else {
|
46 |
-
$chart_types = array('line' => 'Line Chart', 'pie' => 'Pie Chart', 'column' => 'Columns');
|
47 |
-
}
|
48 |
-
|
49 |
-
?>
|
50 |
-
<form method="post" id="gawd_view">
|
51 |
-
|
52 |
-
<div class="gawd_profiles" id="gawd_profile_wrapper">
|
53 |
-
<?php if($gawd_zoom_message === false){
|
54 |
-
?>
|
55 |
-
<div class="gawd_zoom_message">
|
56 |
-
<span>You can zoom chart by dragging the mouse over it</span><input class="button_gawd" type="button" id="gawd_got_it" value="GOT IT"/>
|
57 |
-
</div>
|
58 |
-
<?php
|
59 |
-
}
|
60 |
-
?>
|
61 |
-
<select class="gawd_profile_select" id="gawd_id" name="gawd_id" onchange="change_account(this)">
|
62 |
-
<?php
|
63 |
-
$gawd_last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
64 |
-
foreach ($profiles as $property_name => $property): ?>
|
65 |
-
<optgroup label="<?php echo $property_name; ?>">
|
66 |
-
<?php foreach ($property as $profile):
|
67 |
-
$webPropertyId = $profile['webPropertyId'];
|
68 |
-
$id = $profile['id'];
|
69 |
-
$name = $profile['name'];
|
70 |
-
$selected = '';
|
71 |
-
if($id == $gawd_last_viewed_profile['profile_id']){
|
72 |
-
$selected = 'selected="selected"';
|
73 |
-
}
|
74 |
-
?>
|
75 |
-
<option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name.' - '.$name ; ?></option>
|
76 |
-
<?php endforeach ?>
|
77 |
-
</optgroup>
|
78 |
-
<?php endforeach ?>
|
79 |
-
</select>
|
80 |
-
<div class="clear"></div>
|
81 |
-
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
82 |
-
</div>
|
83 |
-
<div id="gawd_body" data-gawd-tab="<?php echo esc_attr(stripslashes($_GET['tab'])); ?>">
|
84 |
-
<?php
|
85 |
-
include_once('dashboard_menu.php');
|
86 |
-
$page = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'overview';
|
87 |
-
if(strpos($page,'custom_report')!==false){
|
88 |
-
$tab = $page;
|
89 |
-
}
|
90 |
-
else{
|
91 |
-
switch ($page) {
|
92 |
-
case 'general':
|
93 |
-
$tab = 'date';
|
94 |
-
break;
|
95 |
-
case 'location':
|
96 |
-
$tab = 'country';
|
97 |
-
break;
|
98 |
-
case 'behaviour':
|
99 |
-
$tab = 'userType';
|
100 |
-
break;
|
101 |
-
case 'engagement':
|
102 |
-
$tab = 'sessionDurationBucket';
|
103 |
-
break;
|
104 |
-
case 'pagePath':
|
105 |
-
$tab = 'pagePath';
|
106 |
-
break;
|
107 |
-
case 'landingPagePath':
|
108 |
-
$tab = 'landingPagePath';
|
109 |
-
break;
|
110 |
-
case 'language':
|
111 |
-
$tab = 'language';
|
112 |
-
break;
|
113 |
-
case 'browser':
|
114 |
-
$tab = 'browser';
|
115 |
-
break;
|
116 |
-
case 'os':
|
117 |
-
$tab = 'operatingSystem';
|
118 |
-
break;
|
119 |
-
case 'device_overview':
|
120 |
-
$tab = 'deviceCategory';
|
121 |
-
break;
|
122 |
-
case 'devices':
|
123 |
-
$tab = 'mobileDeviceInfo';
|
124 |
-
break;
|
125 |
-
case 'realtime':
|
126 |
-
$tab = 'realTime';
|
127 |
-
break;
|
128 |
-
case 'custom':
|
129 |
-
$tab = 'custom';
|
130 |
-
break;
|
131 |
-
case 'eventsCategory':
|
132 |
-
$tab = 'eventCategory';
|
133 |
-
break;
|
134 |
-
case 'eventsAction':
|
135 |
-
$tab = 'eventAction';
|
136 |
-
break;
|
137 |
-
case 'eventsLabel':
|
138 |
-
$tab = 'eventLabel';
|
139 |
-
break;
|
140 |
-
case 'goals':
|
141 |
-
$tab = 'goals';
|
142 |
-
break;
|
143 |
-
case 'userGender':
|
144 |
-
$tab = 'userGender';
|
145 |
-
break;
|
146 |
-
case 'userAge':
|
147 |
-
$tab = 'userAgeBracket';
|
148 |
-
break;
|
149 |
-
case 'adWords':
|
150 |
-
$tab = 'adGroup';
|
151 |
-
break;
|
152 |
-
case 'otherCategory':
|
153 |
-
$tab = 'interestOtherCategory';
|
154 |
-
break;
|
155 |
-
case 'affinityCategory':
|
156 |
-
$tab = 'interestAffinityCategory';
|
157 |
-
break;
|
158 |
-
case 'inMarket':
|
159 |
-
$tab = 'interestInMarketCategory';
|
160 |
-
break;
|
161 |
-
case 'trafficSource':
|
162 |
-
$tab = 'source';
|
163 |
-
break;
|
164 |
-
case 'siteSpeed':
|
165 |
-
$tab = 'siteSpeed';
|
166 |
-
break;
|
167 |
-
case 'adsense':
|
168 |
-
$tab = 'adsense';
|
169 |
-
break;
|
170 |
-
case 'productName':
|
171 |
-
$tab = 'productName';
|
172 |
-
break;
|
173 |
-
case 'productCategory':
|
174 |
-
$tab = 'productCategory';
|
175 |
-
break;
|
176 |
-
case 'productSku':
|
177 |
-
$tab = 'productSku';
|
178 |
-
break;
|
179 |
-
case 'transactionId':
|
180 |
-
$tab = 'transactionId';
|
181 |
-
break;
|
182 |
-
case 'daysToTransaction':
|
183 |
-
$tab = 'daysToTransaction';
|
184 |
-
break;
|
185 |
-
case 'sales_performance':
|
186 |
-
$tab = 'sales_performance';
|
187 |
-
break;
|
188 |
-
default:
|
189 |
-
if($tabs != ''){
|
190 |
-
$tab = key($tabs);
|
191 |
-
}
|
192 |
-
else{
|
193 |
-
$tab = 'date';
|
194 |
-
}
|
195 |
-
break;
|
196 |
-
}
|
197 |
-
}
|
198 |
-
?>
|
199 |
-
<input id="gawd_filter_val" type="hidden" value="">
|
200 |
-
<div class="resp_metrics_menu"><div class="menu_metrics_img"></div><div class="button_label">FILTERS</div><div class="clear"></div></div>
|
201 |
-
<div id="gawd_right_conteiner">
|
202 |
-
<h3 id="gawd_page_title">Audience</h3>
|
203 |
-
<div class="filter_conteiner">
|
204 |
-
<div id="metric_conteiner" class="float_conteiner">
|
205 |
-
<div class="gawd_metrics">
|
206 |
-
<?php
|
207 |
-
if($tab == 'date'){
|
208 |
-
?>
|
209 |
-
<div id="first_metric" >
|
210 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
211 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
212 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
213 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
214 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
215 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
216 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
217 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
218 |
-
</select>
|
219 |
-
</div>
|
220 |
-
<div id="metric_compare">
|
221 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
222 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
223 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
224 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
225 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
226 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
227 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
228 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
229 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
230 |
-
</select>
|
231 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
232 |
-
</div>
|
233 |
-
<?php
|
234 |
-
}
|
235 |
-
elseif($tab == 'inMarket' || $tab == 'affinityCategory' || $tab == 'otherCategory' || $tab == 'country' || $tab == 'language' || $tab == 'userType' || $tab == 'sessionDurationBucket' || $tab == 'userAgeBracket' || $tab == 'userGender' || $tab == 'mobileDeviceInfo' || $tab == 'deviceCategory' || $tab == 'operatingSystem' || $tab == 'browser' || $tab =='interestInMarketCategory' || $tab == 'interestAffinityCategory' || $tab == 'interestOtherCategory' || $tab == 'source'){
|
236 |
-
?>
|
237 |
-
<div id="first_metric" >
|
238 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
239 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
240 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
241 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
242 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
243 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
244 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
245 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
246 |
-
</select>
|
247 |
-
</div>
|
248 |
-
<div id="metric_compare">
|
249 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
250 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
251 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
252 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
253 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
254 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
255 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
256 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
257 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
258 |
-
</select>
|
259 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
260 |
-
</div>
|
261 |
-
<?php
|
262 |
-
}
|
263 |
-
elseif($tab == 'eventLabel' || $tab == 'eventAction' || $tab == 'eventCategory'){
|
264 |
-
?>
|
265 |
-
<div id="first_metric" >
|
266 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
267 |
-
<option value="totalEvents" ><?php echo __('Total Events', 'gawd'); ?></option>
|
268 |
-
<option value="uniqueEvents" ><?php echo __('Unique Events', 'gawd'); ?></option>
|
269 |
-
<option value="eventValue" ><?php echo __('Event Value', 'gawd'); ?></option>
|
270 |
-
<option value="avgEventValue" ><?php echo __('Average Event Value', 'gawd'); ?></option>
|
271 |
-
<option value="sessionsWithEvent" ><?php echo __('Session with Event', 'gawd'); ?></option>
|
272 |
-
<option value="eventsPerSessionWithEvent" ><?php echo __('Events per Session with Event ', 'gawd'); ?></option>
|
273 |
-
</select>
|
274 |
-
</div>
|
275 |
-
<div id="metric_compare">
|
276 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
277 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
278 |
-
<option value="totalEvents" ><?php echo __('Total Events', 'gawd'); ?></option>
|
279 |
-
<option value="uniqueEvents" ><?php echo __('Unique Events', 'gawd'); ?></option>
|
280 |
-
<option value="eventValue" ><?php echo __('Event Value', 'gawd'); ?></option>
|
281 |
-
<option value="avgEventValue" ><?php echo __('Average Event Value', 'gawd'); ?></option>
|
282 |
-
<option value="sessionsWithEvent" ><?php echo __('Session with Event', 'gawd'); ?></option>
|
283 |
-
<option value="eventsPerSessionWithEvent" ><?php echo __('Events per Session with Event ', 'gawd'); ?></option>
|
284 |
-
</select>
|
285 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
286 |
-
</div>
|
287 |
-
<?php
|
288 |
-
}
|
289 |
-
elseif($tab == 'goals'){
|
290 |
-
?>
|
291 |
-
<div id="first_metric" >
|
292 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
293 |
-
</select>
|
294 |
-
</div>
|
295 |
-
<div id="metric_compare">
|
296 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
297 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
298 |
-
<?php
|
299 |
-
/* if (!empty($goals)) {
|
300 |
-
foreach ($goals as $goal) {
|
301 |
-
echo '<option value="' . $goal['name'] . '">' . $goal['name'] . ' (Goal' . $goal['id'] . ' Completions)' . '</option>';
|
302 |
-
}
|
303 |
-
}*/
|
304 |
-
?>
|
305 |
-
</select>
|
306 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
307 |
-
</div>
|
308 |
-
<?php
|
309 |
-
}
|
310 |
-
elseif($tab == 'siteSpeed'){
|
311 |
-
?>
|
312 |
-
<div id="first_metric" >
|
313 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
314 |
-
<option value="avgPageLoadTime" ><?php echo __('Avg. Page Load Time', 'gawd'); ?></option>
|
315 |
-
<option value="avgRedirectionTime" ><?php echo __('Avg. Redirection Time', 'gawd'); ?></option>
|
316 |
-
<option value="avgServerResponseTime" ><?php echo __('Avg. Server Response Time', 'gawd'); ?></option>
|
317 |
-
<option value="avgPageDownloadTime" ><?php echo __('Avg. Page Download Time', 'gawd'); ?></option>
|
318 |
-
</select>
|
319 |
-
</div>
|
320 |
-
<div id="metric_compare">
|
321 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
322 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
323 |
-
<option value="avgPageLoadTime" ><?php echo __('Avg. Page Load Time', 'gawd'); ?></option>
|
324 |
-
<option value="avgRedirectionTime" ><?php echo __('Avg. Redirection Time', 'gawd'); ?></option>
|
325 |
-
<option value="avgServerResponseTime" ><?php echo __('Avg. Server Response Time', 'gawd'); ?></option>
|
326 |
-
<option value="avgPageDownloadTime" ><?php echo __('Avg. Page Download Time', 'gawd'); ?></option>
|
327 |
-
</select>
|
328 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
329 |
-
</div>
|
330 |
-
<?php
|
331 |
-
}
|
332 |
-
elseif($tab == 'adsense'){
|
333 |
-
?>
|
334 |
-
<div id="first_metric" >
|
335 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
336 |
-
<option value="adsenseRevenue" ><?php echo __('AdSense Revenue', 'gawd'); ?></option>
|
337 |
-
<option value="adsenseAdsClicks" ><?php echo __('AdSense Ads Clicked', 'gawd'); ?></option>
|
338 |
-
</select>
|
339 |
-
</div>
|
340 |
-
<div id="metric_compare">
|
341 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
342 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
343 |
-
<option value="adsenseRevenue" ><?php echo __('AdSense Revenue', 'gawd'); ?></option>
|
344 |
-
<option value="adsenseAdsClicks" ><?php echo __('AdSense Ads Clicked', 'gawd'); ?></option>
|
345 |
-
</select>
|
346 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
347 |
-
</div>
|
348 |
-
<?php
|
349 |
-
}
|
350 |
-
elseif($tab == 'socialActivityNetworkAction' || $tab == 'socialActivityAction' || $tab == 'socialActivityTagsSummary' || $tab == 'socialActivityPost' || $tab == 'socialActivityTimestamp' || $tab == 'socialActivityUserProfileUrl' || $tab == 'socialActivityContentUrl' || $tab == 'socialActivityUserPhotoUrl' || $tab == 'socialActivityUserHandle' || $tab == 'socialActivityEndorsingUrl' || $tab == 'socialEndorsingUrl' || $tab == 'socialActivityDisplayName'){
|
351 |
-
?>
|
352 |
-
<div id="first_metric" >
|
353 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
354 |
-
<option value="socialActivities" ><?php echo __('Social Activity', 'gawd'); ?></option>
|
355 |
-
</select>
|
356 |
-
</div>
|
357 |
-
<?php
|
358 |
-
}
|
359 |
-
elseif($tab == 'adGroup'){
|
360 |
-
?>
|
361 |
-
<div id="first_metric" >
|
362 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
363 |
-
<option value="adClicks" ><?php echo __('Clicks', 'gawd'); ?></option>
|
364 |
-
<option value="adCost" ><?php echo __('Cost', 'gawd'); ?></option>
|
365 |
-
</select>
|
366 |
-
</div>
|
367 |
-
<div id="metric_compare">
|
368 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
369 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
370 |
-
<option value="adClicks" ><?php echo __('Clicks', 'gawd'); ?></option>
|
371 |
-
<option value="adCost" ><?php echo __('Cost', 'gawd'); ?></option>
|
372 |
-
</select>
|
373 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
374 |
-
</div>
|
375 |
-
<?php
|
376 |
-
}
|
377 |
-
elseif($tab == 'productCategory' || $tab == 'productName' || $tab == 'productSku'){
|
378 |
-
?>
|
379 |
-
<div id="first_metric" >
|
380 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
381 |
-
<option value="itemRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
382 |
-
<option value="uniquePurchases" ><?php echo __('Unique Purchases', 'gawd'); ?></option>
|
383 |
-
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
384 |
-
<option value="itemsPerPurchase" ><?php echo __('Average QTY', 'gawd'); ?></option>
|
385 |
-
</select>
|
386 |
-
</div>
|
387 |
-
<div id="metric_compare">
|
388 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
389 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
390 |
-
<option value="itemRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
391 |
-
<option value="uniquePurchases" ><?php echo __('Unique Purchases', 'gawd'); ?></option>
|
392 |
-
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
393 |
-
<option value="itemsPerPurchase" ><?php echo __('Average QTY', 'gawd'); ?></option>
|
394 |
-
</select>
|
395 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
396 |
-
</div>
|
397 |
-
<?php
|
398 |
-
}
|
399 |
-
elseif($tab == 'transactionId'){
|
400 |
-
?>
|
401 |
-
<div id="first_metric" >
|
402 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
403 |
-
<option value="transactionRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
404 |
-
<option value="transactionTax" ><?php echo __('Tax', 'gawd'); ?></option>
|
405 |
-
<option value="transactionShipping" ><?php echo __('Shipping', 'gawd'); ?></option>
|
406 |
-
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
407 |
-
</select>
|
408 |
-
</div>
|
409 |
-
<div id="metric_compare">
|
410 |
-
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
411 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
412 |
-
<option value="transactionRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
413 |
-
<option value="transactionTax" ><?php echo __('Tax', 'gawd'); ?></option>
|
414 |
-
<option value="transactionShipping" ><?php echo __('Shipping', 'gawd'); ?></option>
|
415 |
-
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
416 |
-
</select>
|
417 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
418 |
-
</div>
|
419 |
-
<?php
|
420 |
-
}
|
421 |
-
elseif($tab == 'sales_performance'){
|
422 |
-
?>
|
423 |
-
<div id="first_metric" >
|
424 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
425 |
-
<option value="transactionRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
426 |
-
<option value="transactionsPerSession" ><?php echo __('Ecommerce Conversion Rate', 'gawd'); ?></option>
|
427 |
-
</select>
|
428 |
-
</div>
|
429 |
-
|
430 |
-
<?php
|
431 |
-
}
|
432 |
-
elseif($tab == 'daysToTransaction'){
|
433 |
-
?>
|
434 |
-
<div id="first_metric" >
|
435 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
436 |
-
<option value="transactions" ><?php echo __('Transactions', 'gawd'); ?></option>
|
437 |
-
</select>
|
438 |
-
</div>
|
439 |
-
|
440 |
-
<?php
|
441 |
-
}
|
442 |
-
elseif(strpos($tab,'custom_report')!==false){
|
443 |
-
$tab = substr($page,14);
|
444 |
-
|
445 |
-
?>
|
446 |
-
<div id="first_metric" >
|
447 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
448 |
-
<option value="<?php echo $get_custom_reports[$tab]['metric'];?>" ><?php echo __(preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $get_custom_reports[$tab]['metric'])))), 'gawd'); ?></option>
|
449 |
-
|
450 |
-
</select>
|
451 |
-
</div>
|
452 |
-
<?php
|
453 |
-
$tab = 'custom_' . $get_custom_reports[$tab]['dimension'];
|
454 |
-
}
|
455 |
-
elseif($tab == 'custom') { ?>
|
456 |
-
<div id="first_metric" >
|
457 |
-
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
458 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
459 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
460 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
461 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
462 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
463 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
464 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
465 |
-
</select>
|
466 |
-
</div>
|
467 |
-
<div id="metric_compare">
|
468 |
-
<select style="display: none;" id="wdi_no_custom_dimensions" class="load_tooltip" data-hint="Select the second metric to compare reports.">
|
469 |
-
<option value="0">There are no custom dimensions set for current profile.</option>
|
470 |
-
</select>
|
471 |
-
<select style="display: none;" name="gawd_custom_option" id="gawd_custom_option" class="gawd_draw_analytics">
|
472 |
-
|
473 |
-
</select>
|
474 |
-
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
475 |
-
</div>
|
476 |
-
<?php } ?>
|
477 |
-
</div>
|
478 |
-
|
479 |
-
<input id="gawd_tab" type="hidden" value="<?php echo $tab; ?>">
|
480 |
-
|
481 |
-
<?php if($tab != 'custom' && $tab != 'pagePath' && $tab != 'landingPagePath' && $tab != 'realTime' && $tab != 'daysToTransaction' && $tab != 'sales_performance' && strpos($_GET['tab'],'custom_report') === false) { ?>
|
482 |
-
<div class="vs_image" class="gawd_metrics">
|
483 |
-
<img width="30px" src="<?php echo GAWD_URL;?>/assets/vs.png">
|
484 |
-
</div>
|
485 |
-
<?php } ?>
|
486 |
-
<div class='clear'></div>
|
487 |
-
</div>
|
488 |
-
<?php if($tab != 'realTime') { ?>
|
489 |
-
<div id="date_chart_conteiner" class="float_conteiner">
|
490 |
-
<div class="gawd_row load_tooltip" data-hint="Choose Line, Pie or Column chart type to view your Google Analytics report with.">
|
491 |
-
<div id="gawd_text" class="gawd_text">
|
492 |
-
CHART
|
493 |
-
</div>
|
494 |
-
<div class="gawd_content" id="gawd_content_chart" >
|
495 |
-
<select name="gawd_chart_type" id="gawd_chart_type" class="gawd_draw_analytics">
|
496 |
-
<?php foreach($chart_types as $value => $title) { ?>
|
497 |
-
<option value="<?php echo $value; ?>"><?php echo $title; ?></option>
|
498 |
-
<?php } ?>
|
499 |
-
</select>
|
500 |
-
</div>
|
501 |
-
<div class='clear'></div>
|
502 |
-
</div >
|
503 |
-
<div class="gawd_row load_tooltip" data-hint="Select one of predefined date ranges or specify a custom period for your report.">
|
504 |
-
<div class="gawd_text" >
|
505 |
-
DATE
|
506 |
-
</div>
|
507 |
-
<div class="gawd_content" id="gawd_content_range" >
|
508 |
-
<div id="reportrange" class="pull-right" style="float:none !important">
|
509 |
-
<span></span> <b class="caret"></b>
|
510 |
-
</div>
|
511 |
-
<input type="hidden" id="gawd_start_end_date"/>
|
512 |
-
</div>
|
513 |
-
<div class='clear'></div>
|
514 |
-
</div>
|
515 |
-
<div class='clear'></div>
|
516 |
-
</div>
|
517 |
-
<?php } ?>
|
518 |
-
<div id="compare_time_conteiner" class="float_conteiner">
|
519 |
-
<?php if(($tab == 'date') || ($tab == 'adsense') || ($tab == 'siteSpeed') || $tab == 'sales_performance' || $tab == 'pagePath' || $tab == 'landingPagePath'){ ?>
|
520 |
-
<div class="gawd_date_filter_container load_tooltip" data-hint="Set the scale of your statistics graph. It will separate graph results hourly, daily, weekly and monthly.">
|
521 |
-
<ul class="gawd_list">
|
522 |
-
<li class="gawd_list_item" id="gawd_hour"><a href='#' class="gawd_filter_item" data-type="hour">Hourly</a></li>
|
523 |
-
<li class="gawd_list_item" id="gawd_day"><a href='#' class="gawd_filter_item" data-type="date">Day</a></li>
|
524 |
-
<li class="gawd_list_item" id="gawd_week"><a href='#' class="gawd_filter_item" data-type="week">Week</a></li>
|
525 |
-
<li class="gawd_list_item" id="gawd_month"><a href='#' class="gawd_filter_item" data-type="month">Month</a></li>
|
526 |
-
</ul>
|
527 |
-
</div>
|
528 |
-
<div id="compare_datepicker_wraper" class="load_tooltip" data-hint="Measure the results of Google Analytics tracking of two periods. Select Previous Period, Previous Year, or define a custom period using the datepicker.">COMPARE DATE</div>
|
529 |
-
<div id="" class="pull-right" style="float:none !important">
|
530 |
-
</div>
|
531 |
-
<input type="hidden" id="gawd_start_end_date_compare"/>
|
532 |
-
<div class='clear'></div>
|
533 |
-
<?php } ?>
|
534 |
-
</div>
|
535 |
-
<div class='clear'></div>
|
536 |
-
</div>
|
537 |
-
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_fild'); ?>
|
538 |
-
</form>
|
539 |
-
|
540 |
-
<div class="gawd_chart_conteiner">
|
541 |
-
<?php if($_GET['tab'] === 'adsense') { ?>
|
542 |
-
<h4>
|
543 |
-
AdSense reports are coming soon. View them
|
544 |
-
<a target="_blank" href="https://analytics.google.com/">
|
545 |
-
here.
|
546 |
-
</a>
|
547 |
-
</h4>
|
548 |
-
<?php } ?>
|
549 |
-
<div id="opacity_div" style="display: none; background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
|
550 |
-
<div id="loading_div" style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
|
551 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
552 |
-
</div>
|
553 |
-
<div id="chartdiv"></div>
|
554 |
-
<?php if($tab != 'realTime'){
|
555 |
-
?>
|
556 |
-
<div id="gawd_buttons">
|
557 |
-
<span id="country_filter_reset" class="button_gawd">Back</span>
|
558 |
-
<span class='clear'></span>
|
559 |
-
<input class="button_gawd" type="button" id="gawd_export_buttons" value="Export"/>
|
560 |
-
<input class="button_gawd load_tooltip" type="button" id="gawd_email_button" data-hint="Click to forward this report to selected email recipients, or schedule emails to be sent out periodically." value="Email"/>
|
561 |
-
<div class="gawd_exports">
|
562 |
-
<a class='button gawd_export_button_csv' href="">CSV</a>
|
563 |
-
<a class='button gawd_export_button_pdf' href="#">PDF</a>
|
564 |
-
</div>
|
565 |
-
</div>
|
566 |
-
<?php };?>
|
567 |
-
<div class="gawd_data_table">
|
568 |
-
<table class="display cell-border" style="width:100%">
|
569 |
-
|
570 |
-
</table>
|
571 |
-
</div>
|
572 |
-
</div>
|
573 |
-
</div>
|
574 |
-
<div class='clear'></div>
|
575 |
-
|
576 |
-
</div>
|
577 |
-
<?php //get parameters for export?>
|
578 |
-
|
579 |
-
<div class="gawd_email_popup_overlay">
|
580 |
-
</div>
|
581 |
-
<div class="gawd_email_popup">
|
582 |
-
<a href="#" class="gawd_btn">X</a>
|
583 |
-
<div class="gawd_email_body">
|
584 |
-
<form method="post" action="" id="gawd_email_form">
|
585 |
-
<div class="gawd_email_row load_tooltip" data-hint="E-mail to send reports from. You can change it from WordPress Settings > General > Email Address.">
|
586 |
-
<div class="gawd_email_label">From</div>
|
587 |
-
<div class="gawd_email_input gawd_email_input_from">
|
588 |
-
<?php echo get_option('admin_email'); ?>
|
589 |
-
</div>
|
590 |
-
<div class='clear'></div>
|
591 |
-
</div>
|
592 |
-
<div class="gawd_email_row load_tooltip" data-hint="Define one or more email report recipients separated by commas.">
|
593 |
-
<div class="gawd_email_label">To</div>
|
594 |
-
<div class="gawd_email_input">
|
595 |
-
<input id="gawd_email_to" name="gawd_email_to" class="" type="text" value="">
|
596 |
-
</div>
|
597 |
-
<div class='clear'></div>
|
598 |
-
</div>
|
599 |
-
<div class="gawd_email_row load_tooltip" data-hint="Set the subject for email reports.">
|
600 |
-
<div class="gawd_email_label">Subject</div>
|
601 |
-
<div class="gawd_email_input">
|
602 |
-
<input class="gawd_email_subject" name="gawd_email_subject" class="" type="text" value="">
|
603 |
-
</div>
|
604 |
-
<div class='clear'></div>
|
605 |
-
</div>
|
606 |
-
<div class="gawd_email_row">
|
607 |
-
<div class="gawd_email_attachemnt load_tooltip" data-hint="Select type for report attachments, CSV or PDF.">Attachment</div>
|
608 |
-
<div class="gawd_email_input_attachment" >
|
609 |
-
<select id="gawd_attachment_type" name="export_type">
|
610 |
-
<option value='csv'>CSV</option>
|
611 |
-
<!-- <option value='pdf'>PDF</option>-->
|
612 |
-
</select>
|
613 |
-
</div>
|
614 |
-
<div class="gawd_email_input gawd_email_month_day_div" id="gawd_email_month_day" data-hint="Select the day of month to send report on.">
|
615 |
-
<div class="gawd_email_day_of_week">Day of Month</div>
|
616 |
-
</div>
|
617 |
-
<div class="gawd_email_input gawd_email_week_day_div" data-hint="Click on weekday to choose email report sending day." id="gawd_email_week_day">
|
618 |
-
<div class="gawd_email_day_of_week">Day of Week</div>
|
619 |
-
<input type="hidden" name="gawd_email_week_day" id="gawd_email_week_day_hidden" >
|
620 |
-
</div>
|
621 |
-
<div class='clear'></div>
|
622 |
-
</div>
|
623 |
-
<div class="gawd_email_row">
|
624 |
-
<div class="gawd_email_frequency load_tooltip" data-hint="Send email report Once or set its frequency to Daily, Weekly or Monthly.">Frequency</div>
|
625 |
-
<div class="gawd_email_input_frequency " id="gawd_email_period">
|
626 |
-
<select name="gawd_email_period">
|
627 |
-
<option value="once">Once</option>
|
628 |
-
<option value="daily">Daily</option>
|
629 |
-
<option value="gawd_weekly">Weekly</option>
|
630 |
-
<option value="gawd_monthly">Monthly</option>
|
631 |
-
</select>
|
632 |
-
</div>
|
633 |
-
<div class="gawd_email_input gawd_email_month_day_div" id="gawd_email_month_day">
|
634 |
-
<div class="gawd_email_month_day">
|
635 |
-
<select id="gawd_email_month_day_select" name="gawd_email_month_day">
|
636 |
-
<?php
|
637 |
-
for($i=1; $i<29; $i++){
|
638 |
-
|
639 |
-
echo '<option value="'.$i.'">'.$i.'</option>';
|
640 |
-
}
|
641 |
-
?>
|
642 |
-
<option value="last">Last Day</option>
|
643 |
-
</select>
|
644 |
-
</div>
|
645 |
-
<div class='clear'></div>
|
646 |
-
</div>
|
647 |
-
<div class="gawd_email_input gawd_email_week_day_div" id="gawd_email_week_day">
|
648 |
-
<div class="gawd_email_week_days">
|
649 |
-
<ul class="gawd_email_week_day_ul">
|
650 |
-
<li class="gawd_email_week_day" data-atribute="sunday">Sun</li>
|
651 |
-
<li class="gawd_email_week_day" data-atribute="monday">Mon</li>
|
652 |
-
<li class="gawd_email_week_day" data-atribute="tuesday">Tue</li>
|
653 |
-
<li class="gawd_email_week_day" data-atribute="wednesday">Wed</li>
|
654 |
-
<li class="gawd_email_week_day" data-atribute="thursday">Thu</li>
|
655 |
-
<li class="gawd_email_week_day" data-atribute="friday">Fri</li>
|
656 |
-
<li class="gawd_email_week_day" data-atribute="saturday">Sat</li>
|
657 |
-
</ul>
|
658 |
-
</div>
|
659 |
-
<input type="hidden" name="gawd_email_week_day" id="gawd_email_week_day_hidden" >
|
660 |
-
</div>
|
661 |
-
<div class='clear'></div>
|
662 |
-
</div>
|
663 |
-
<div class="gawd_email_row gawd_email_time_row">
|
664 |
-
<div class="gawd_email_time load_tooltip" data-hint="Select the time, when you would like to receive this email.">Time</div>
|
665 |
-
<div class="gawd_email_input_time" id="gawd_email_time">
|
666 |
-
<input type="text" name="gawd_email_time_input" id="gawd_email_time_input" value="<?php echo date('H:i');?>"/>
|
667 |
-
</div>
|
668 |
-
|
669 |
-
<div class='clear'></div>
|
670 |
-
</div>
|
671 |
-
<div class="gawd_email_row gawd_email_message_label" data-hint="Compose email content to be sent with your report.">
|
672 |
-
Additional Message
|
673 |
-
</div>
|
674 |
-
<div class="gawd_email_row gawd_email_message">
|
675 |
-
<textarea name="gawd_email_body" id="gawd_email_body"></textarea>
|
676 |
-
</div>
|
677 |
-
<input name="gawd_email_from" id="gawd_email_from" class="" type="hidden" value="<?php echo get_option('admin_email'); ?>">
|
678 |
-
<input name="gawd_metric" id="gawd_email_metric" class="" type="hidden" value="">
|
679 |
-
<input name="gawd_metric_compare" id="gawd_metric_compare" class="" type="hidden" value="">
|
680 |
-
<input name="gawd_dimension" id="gawd_dimension" class="" type="hidden" value="<?php echo $tab; ?>">
|
681 |
-
<input name="gawd_start_date" id="gawd_start_date" class="" type="hidden" value="">
|
682 |
-
<input name="gawd_end_date" id="gawd_end_date" class="" type="hidden" value="">
|
683 |
-
<input name="action" id="" class="" type="hidden" value="gawd_export">
|
684 |
-
<input name="report_type" id="report_type" class="" type="hidden" value="email">
|
685 |
-
<div class="gawd_email_send" id="email_submit">
|
686 |
-
Send
|
687 |
-
</div>
|
688 |
-
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_fild'); ?>
|
689 |
-
</form>
|
690 |
-
</div>
|
691 |
-
<div class="email_message_cont"></div>
|
692 |
-
</div>
|
693 |
-
<canvas id='canvass' style="display:none"></canvas>
|
694 |
-
<input id="first_data" class="" type="hidden" value="">
|
695 |
-
<input id="second_data" class="" type="hidden" value="">
|
696 |
-
<input id="dimension" class="" type="hidden" value="">
|
697 |
-
<input id="first_data_sum" class="" type="hidden" value="">
|
698 |
-
<input id="second_data_sum" class="" type="hidden" value="">
|
699 |
-
<input id="second_start_date" class="" type="hidden" value="">
|
700 |
-
<input id="second_end_date" class="" type="hidden" value="">
|
701 |
-
<?php
|
702 |
-
GAWD_helper::print_pro_popup();
|
703 |
?>
|
1 |
+
<?php
|
2 |
+
$get_custom_reports = get_option('gawd_custom_reports');
|
3 |
+
if(!isset($_GET['tab'])){
|
4 |
+
$_GET['tab'] = 'general';
|
5 |
+
}
|
6 |
+
/*FREE*/
|
7 |
+
if($_GET['tab'] !== 'general' && $_GET['tab'] !== 'realtime'){
|
8 |
+
$_GET['tab'] = 'general';
|
9 |
+
}
|
10 |
+
|
11 |
+
$tabs = get_option('gawd_menu_items');
|
12 |
+
$gawd_zoom_message = get_option('gawd_zoom_message');
|
13 |
+
$current_user = get_current_user_id();
|
14 |
+
$saved_user_menues = get_option('gawd_menu_for_user');
|
15 |
+
if($current_user != 1 && isset($saved_user_menues[$current_user])){
|
16 |
+
$tabs = array_intersect_key($tabs, $saved_user_menues[$current_user]);
|
17 |
+
}
|
18 |
+
|
19 |
+
$line_column = array('general', 'siteSpeed', 'goals');
|
20 |
+
$pie_column = array(
|
21 |
+
'userGender',
|
22 |
+
'inMarket',
|
23 |
+
'affinityCategory',
|
24 |
+
'otherCategory',
|
25 |
+
'location',
|
26 |
+
'language',
|
27 |
+
'behaviour',
|
28 |
+
'os',
|
29 |
+
'browser',
|
30 |
+
'device_overview',
|
31 |
+
'devices',
|
32 |
+
'trafficSource',
|
33 |
+
);
|
34 |
+
$column_pie = array('userAge', 'engagement', 'adWords','eventsLabel', 'eventsAction', 'eventsCategory', 'productSku', 'productCategory', 'productName', 'custom');
|
35 |
+
$column = array();
|
36 |
+
|
37 |
+
if(in_array($_GET['tab'], $line_column)) {
|
38 |
+
$chart_types = array('line' => 'Line Chart', 'column' => 'Columns');
|
39 |
+
} else if(in_array($_GET['tab'], $pie_column)) {
|
40 |
+
$chart_types = array('pie' => 'Pie Chart', 'column' => 'Columns');
|
41 |
+
} else if(in_array($_GET['tab'], $column_pie)) {
|
42 |
+
$chart_types = array('column' => 'Columns', 'pie' => 'Pie Chart');
|
43 |
+
} else if(in_array($_GET['tab'], $column)) {
|
44 |
+
$chart_types = array('column' => 'Columns');
|
45 |
+
} else {
|
46 |
+
$chart_types = array('line' => 'Line Chart', 'pie' => 'Pie Chart', 'column' => 'Columns');
|
47 |
+
}
|
48 |
+
|
49 |
+
?>
|
50 |
+
<form method="post" id="gawd_view">
|
51 |
+
|
52 |
+
<div class="gawd_profiles" id="gawd_profile_wrapper">
|
53 |
+
<?php if($gawd_zoom_message === false){
|
54 |
+
?>
|
55 |
+
<div class="gawd_zoom_message">
|
56 |
+
<span>You can zoom chart by dragging the mouse over it</span><input class="button_gawd" type="button" id="gawd_got_it" value="GOT IT"/>
|
57 |
+
</div>
|
58 |
+
<?php
|
59 |
+
}
|
60 |
+
?>
|
61 |
+
<select class="gawd_profile_select" id="gawd_id" name="gawd_id" onchange="change_account(this)">
|
62 |
+
<?php
|
63 |
+
$gawd_last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
64 |
+
foreach ($profiles as $property_name => $property): ?>
|
65 |
+
<optgroup label="<?php echo $property_name; ?>">
|
66 |
+
<?php foreach ($property as $profile):
|
67 |
+
$webPropertyId = $profile['webPropertyId'];
|
68 |
+
$id = $profile['id'];
|
69 |
+
$name = $profile['name'];
|
70 |
+
$selected = '';
|
71 |
+
if($id == $gawd_last_viewed_profile['profile_id']){
|
72 |
+
$selected = 'selected="selected"';
|
73 |
+
}
|
74 |
+
?>
|
75 |
+
<option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name.' - '.$name ; ?></option>
|
76 |
+
<?php endforeach ?>
|
77 |
+
</optgroup>
|
78 |
+
<?php endforeach ?>
|
79 |
+
</select>
|
80 |
+
<div class="clear"></div>
|
81 |
+
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
82 |
+
</div>
|
83 |
+
<div id="gawd_body" data-gawd-tab="<?php echo esc_attr(stripslashes($_GET['tab'])); ?>">
|
84 |
+
<?php
|
85 |
+
include_once('dashboard_menu.php');
|
86 |
+
$page = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'overview';
|
87 |
+
if(strpos($page,'custom_report')!==false){
|
88 |
+
$tab = $page;
|
89 |
+
}
|
90 |
+
else{
|
91 |
+
switch ($page) {
|
92 |
+
case 'general':
|
93 |
+
$tab = 'date';
|
94 |
+
break;
|
95 |
+
case 'location':
|
96 |
+
$tab = 'country';
|
97 |
+
break;
|
98 |
+
case 'behaviour':
|
99 |
+
$tab = 'userType';
|
100 |
+
break;
|
101 |
+
case 'engagement':
|
102 |
+
$tab = 'sessionDurationBucket';
|
103 |
+
break;
|
104 |
+
case 'pagePath':
|
105 |
+
$tab = 'pagePath';
|
106 |
+
break;
|
107 |
+
case 'landingPagePath':
|
108 |
+
$tab = 'landingPagePath';
|
109 |
+
break;
|
110 |
+
case 'language':
|
111 |
+
$tab = 'language';
|
112 |
+
break;
|
113 |
+
case 'browser':
|
114 |
+
$tab = 'browser';
|
115 |
+
break;
|
116 |
+
case 'os':
|
117 |
+
$tab = 'operatingSystem';
|
118 |
+
break;
|
119 |
+
case 'device_overview':
|
120 |
+
$tab = 'deviceCategory';
|
121 |
+
break;
|
122 |
+
case 'devices':
|
123 |
+
$tab = 'mobileDeviceInfo';
|
124 |
+
break;
|
125 |
+
case 'realtime':
|
126 |
+
$tab = 'realTime';
|
127 |
+
break;
|
128 |
+
case 'custom':
|
129 |
+
$tab = 'custom';
|
130 |
+
break;
|
131 |
+
case 'eventsCategory':
|
132 |
+
$tab = 'eventCategory';
|
133 |
+
break;
|
134 |
+
case 'eventsAction':
|
135 |
+
$tab = 'eventAction';
|
136 |
+
break;
|
137 |
+
case 'eventsLabel':
|
138 |
+
$tab = 'eventLabel';
|
139 |
+
break;
|
140 |
+
case 'goals':
|
141 |
+
$tab = 'goals';
|
142 |
+
break;
|
143 |
+
case 'userGender':
|
144 |
+
$tab = 'userGender';
|
145 |
+
break;
|
146 |
+
case 'userAge':
|
147 |
+
$tab = 'userAgeBracket';
|
148 |
+
break;
|
149 |
+
case 'adWords':
|
150 |
+
$tab = 'adGroup';
|
151 |
+
break;
|
152 |
+
case 'otherCategory':
|
153 |
+
$tab = 'interestOtherCategory';
|
154 |
+
break;
|
155 |
+
case 'affinityCategory':
|
156 |
+
$tab = 'interestAffinityCategory';
|
157 |
+
break;
|
158 |
+
case 'inMarket':
|
159 |
+
$tab = 'interestInMarketCategory';
|
160 |
+
break;
|
161 |
+
case 'trafficSource':
|
162 |
+
$tab = 'source';
|
163 |
+
break;
|
164 |
+
case 'siteSpeed':
|
165 |
+
$tab = 'siteSpeed';
|
166 |
+
break;
|
167 |
+
case 'adsense':
|
168 |
+
$tab = 'adsense';
|
169 |
+
break;
|
170 |
+
case 'productName':
|
171 |
+
$tab = 'productName';
|
172 |
+
break;
|
173 |
+
case 'productCategory':
|
174 |
+
$tab = 'productCategory';
|
175 |
+
break;
|
176 |
+
case 'productSku':
|
177 |
+
$tab = 'productSku';
|
178 |
+
break;
|
179 |
+
case 'transactionId':
|
180 |
+
$tab = 'transactionId';
|
181 |
+
break;
|
182 |
+
case 'daysToTransaction':
|
183 |
+
$tab = 'daysToTransaction';
|
184 |
+
break;
|
185 |
+
case 'sales_performance':
|
186 |
+
$tab = 'sales_performance';
|
187 |
+
break;
|
188 |
+
default:
|
189 |
+
if($tabs != ''){
|
190 |
+
$tab = key($tabs);
|
191 |
+
}
|
192 |
+
else{
|
193 |
+
$tab = 'date';
|
194 |
+
}
|
195 |
+
break;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
?>
|
199 |
+
<input id="gawd_filter_val" type="hidden" value="">
|
200 |
+
<div class="resp_metrics_menu"><div class="menu_metrics_img"></div><div class="button_label">FILTERS</div><div class="clear"></div></div>
|
201 |
+
<div id="gawd_right_conteiner">
|
202 |
+
<h3 id="gawd_page_title">Audience</h3>
|
203 |
+
<div class="filter_conteiner">
|
204 |
+
<div id="metric_conteiner" class="float_conteiner">
|
205 |
+
<div class="gawd_metrics">
|
206 |
+
<?php
|
207 |
+
if($tab == 'date'){
|
208 |
+
?>
|
209 |
+
<div id="first_metric" >
|
210 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
211 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
212 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
213 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
214 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
215 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
216 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
217 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
218 |
+
</select>
|
219 |
+
</div>
|
220 |
+
<div id="metric_compare">
|
221 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
222 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
223 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
224 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
225 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
226 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
227 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
228 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
229 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
230 |
+
</select>
|
231 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
232 |
+
</div>
|
233 |
+
<?php
|
234 |
+
}
|
235 |
+
elseif($tab == 'inMarket' || $tab == 'affinityCategory' || $tab == 'otherCategory' || $tab == 'country' || $tab == 'language' || $tab == 'userType' || $tab == 'sessionDurationBucket' || $tab == 'userAgeBracket' || $tab == 'userGender' || $tab == 'mobileDeviceInfo' || $tab == 'deviceCategory' || $tab == 'operatingSystem' || $tab == 'browser' || $tab =='interestInMarketCategory' || $tab == 'interestAffinityCategory' || $tab == 'interestOtherCategory' || $tab == 'source'){
|
236 |
+
?>
|
237 |
+
<div id="first_metric" >
|
238 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
239 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
240 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
241 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
242 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
243 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
244 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
245 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
246 |
+
</select>
|
247 |
+
</div>
|
248 |
+
<div id="metric_compare">
|
249 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
250 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
251 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
252 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
253 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
254 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
255 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
256 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
257 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
258 |
+
</select>
|
259 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
260 |
+
</div>
|
261 |
+
<?php
|
262 |
+
}
|
263 |
+
elseif($tab == 'eventLabel' || $tab == 'eventAction' || $tab == 'eventCategory'){
|
264 |
+
?>
|
265 |
+
<div id="first_metric" >
|
266 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
267 |
+
<option value="totalEvents" ><?php echo __('Total Events', 'gawd'); ?></option>
|
268 |
+
<option value="uniqueEvents" ><?php echo __('Unique Events', 'gawd'); ?></option>
|
269 |
+
<option value="eventValue" ><?php echo __('Event Value', 'gawd'); ?></option>
|
270 |
+
<option value="avgEventValue" ><?php echo __('Average Event Value', 'gawd'); ?></option>
|
271 |
+
<option value="sessionsWithEvent" ><?php echo __('Session with Event', 'gawd'); ?></option>
|
272 |
+
<option value="eventsPerSessionWithEvent" ><?php echo __('Events per Session with Event ', 'gawd'); ?></option>
|
273 |
+
</select>
|
274 |
+
</div>
|
275 |
+
<div id="metric_compare">
|
276 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
277 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
278 |
+
<option value="totalEvents" ><?php echo __('Total Events', 'gawd'); ?></option>
|
279 |
+
<option value="uniqueEvents" ><?php echo __('Unique Events', 'gawd'); ?></option>
|
280 |
+
<option value="eventValue" ><?php echo __('Event Value', 'gawd'); ?></option>
|
281 |
+
<option value="avgEventValue" ><?php echo __('Average Event Value', 'gawd'); ?></option>
|
282 |
+
<option value="sessionsWithEvent" ><?php echo __('Session with Event', 'gawd'); ?></option>
|
283 |
+
<option value="eventsPerSessionWithEvent" ><?php echo __('Events per Session with Event ', 'gawd'); ?></option>
|
284 |
+
</select>
|
285 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
286 |
+
</div>
|
287 |
+
<?php
|
288 |
+
}
|
289 |
+
elseif($tab == 'goals'){
|
290 |
+
?>
|
291 |
+
<div id="first_metric" >
|
292 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
293 |
+
</select>
|
294 |
+
</div>
|
295 |
+
<div id="metric_compare">
|
296 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
297 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
298 |
+
<?php
|
299 |
+
/* if (!empty($goals)) {
|
300 |
+
foreach ($goals as $goal) {
|
301 |
+
echo '<option value="' . $goal['name'] . '">' . $goal['name'] . ' (Goal' . $goal['id'] . ' Completions)' . '</option>';
|
302 |
+
}
|
303 |
+
}*/
|
304 |
+
?>
|
305 |
+
</select>
|
306 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
307 |
+
</div>
|
308 |
+
<?php
|
309 |
+
}
|
310 |
+
elseif($tab == 'siteSpeed'){
|
311 |
+
?>
|
312 |
+
<div id="first_metric" >
|
313 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
314 |
+
<option value="avgPageLoadTime" ><?php echo __('Avg. Page Load Time', 'gawd'); ?></option>
|
315 |
+
<option value="avgRedirectionTime" ><?php echo __('Avg. Redirection Time', 'gawd'); ?></option>
|
316 |
+
<option value="avgServerResponseTime" ><?php echo __('Avg. Server Response Time', 'gawd'); ?></option>
|
317 |
+
<option value="avgPageDownloadTime" ><?php echo __('Avg. Page Download Time', 'gawd'); ?></option>
|
318 |
+
</select>
|
319 |
+
</div>
|
320 |
+
<div id="metric_compare">
|
321 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
322 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
323 |
+
<option value="avgPageLoadTime" ><?php echo __('Avg. Page Load Time', 'gawd'); ?></option>
|
324 |
+
<option value="avgRedirectionTime" ><?php echo __('Avg. Redirection Time', 'gawd'); ?></option>
|
325 |
+
<option value="avgServerResponseTime" ><?php echo __('Avg. Server Response Time', 'gawd'); ?></option>
|
326 |
+
<option value="avgPageDownloadTime" ><?php echo __('Avg. Page Download Time', 'gawd'); ?></option>
|
327 |
+
</select>
|
328 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
329 |
+
</div>
|
330 |
+
<?php
|
331 |
+
}
|
332 |
+
elseif($tab == 'adsense'){
|
333 |
+
?>
|
334 |
+
<div id="first_metric" >
|
335 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
336 |
+
<option value="adsenseRevenue" ><?php echo __('AdSense Revenue', 'gawd'); ?></option>
|
337 |
+
<option value="adsenseAdsClicks" ><?php echo __('AdSense Ads Clicked', 'gawd'); ?></option>
|
338 |
+
</select>
|
339 |
+
</div>
|
340 |
+
<div id="metric_compare">
|
341 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
342 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
343 |
+
<option value="adsenseRevenue" ><?php echo __('AdSense Revenue', 'gawd'); ?></option>
|
344 |
+
<option value="adsenseAdsClicks" ><?php echo __('AdSense Ads Clicked', 'gawd'); ?></option>
|
345 |
+
</select>
|
346 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
347 |
+
</div>
|
348 |
+
<?php
|
349 |
+
}
|
350 |
+
elseif($tab == 'socialActivityNetworkAction' || $tab == 'socialActivityAction' || $tab == 'socialActivityTagsSummary' || $tab == 'socialActivityPost' || $tab == 'socialActivityTimestamp' || $tab == 'socialActivityUserProfileUrl' || $tab == 'socialActivityContentUrl' || $tab == 'socialActivityUserPhotoUrl' || $tab == 'socialActivityUserHandle' || $tab == 'socialActivityEndorsingUrl' || $tab == 'socialEndorsingUrl' || $tab == 'socialActivityDisplayName'){
|
351 |
+
?>
|
352 |
+
<div id="first_metric" >
|
353 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
354 |
+
<option value="socialActivities" ><?php echo __('Social Activity', 'gawd'); ?></option>
|
355 |
+
</select>
|
356 |
+
</div>
|
357 |
+
<?php
|
358 |
+
}
|
359 |
+
elseif($tab == 'adGroup'){
|
360 |
+
?>
|
361 |
+
<div id="first_metric" >
|
362 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
363 |
+
<option value="adClicks" ><?php echo __('Clicks', 'gawd'); ?></option>
|
364 |
+
<option value="adCost" ><?php echo __('Cost', 'gawd'); ?></option>
|
365 |
+
</select>
|
366 |
+
</div>
|
367 |
+
<div id="metric_compare">
|
368 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
369 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
370 |
+
<option value="adClicks" ><?php echo __('Clicks', 'gawd'); ?></option>
|
371 |
+
<option value="adCost" ><?php echo __('Cost', 'gawd'); ?></option>
|
372 |
+
</select>
|
373 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
374 |
+
</div>
|
375 |
+
<?php
|
376 |
+
}
|
377 |
+
elseif($tab == 'productCategory' || $tab == 'productName' || $tab == 'productSku'){
|
378 |
+
?>
|
379 |
+
<div id="first_metric" >
|
380 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
381 |
+
<option value="itemRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
382 |
+
<option value="uniquePurchases" ><?php echo __('Unique Purchases', 'gawd'); ?></option>
|
383 |
+
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
384 |
+
<option value="itemsPerPurchase" ><?php echo __('Average QTY', 'gawd'); ?></option>
|
385 |
+
</select>
|
386 |
+
</div>
|
387 |
+
<div id="metric_compare">
|
388 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
389 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
390 |
+
<option value="itemRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
391 |
+
<option value="uniquePurchases" ><?php echo __('Unique Purchases', 'gawd'); ?></option>
|
392 |
+
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
393 |
+
<option value="itemsPerPurchase" ><?php echo __('Average QTY', 'gawd'); ?></option>
|
394 |
+
</select>
|
395 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
396 |
+
</div>
|
397 |
+
<?php
|
398 |
+
}
|
399 |
+
elseif($tab == 'transactionId'){
|
400 |
+
?>
|
401 |
+
<div id="first_metric" >
|
402 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
403 |
+
<option value="transactionRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
404 |
+
<option value="transactionTax" ><?php echo __('Tax', 'gawd'); ?></option>
|
405 |
+
<option value="transactionShipping" ><?php echo __('Shipping', 'gawd'); ?></option>
|
406 |
+
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
407 |
+
</select>
|
408 |
+
</div>
|
409 |
+
<div id="metric_compare">
|
410 |
+
<select name="gawd_metric_compare" id="gawd_metric_compare" class="gawd_draw_analytics load_tooltip" data-hint="Select the second metric to compare reports.">
|
411 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
412 |
+
<option value="transactionRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
413 |
+
<option value="transactionTax" ><?php echo __('Tax', 'gawd'); ?></option>
|
414 |
+
<option value="transactionShipping" ><?php echo __('Shipping', 'gawd'); ?></option>
|
415 |
+
<option value="itemQuantity" ><?php echo __('Quantity', 'gawd'); ?></option>
|
416 |
+
</select>
|
417 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
418 |
+
</div>
|
419 |
+
<?php
|
420 |
+
}
|
421 |
+
elseif($tab == 'sales_performance'){
|
422 |
+
?>
|
423 |
+
<div id="first_metric" >
|
424 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
425 |
+
<option value="transactionRevenue" ><?php echo __('Revenue', 'gawd'); ?></option>
|
426 |
+
<option value="transactionsPerSession" ><?php echo __('Ecommerce Conversion Rate', 'gawd'); ?></option>
|
427 |
+
</select>
|
428 |
+
</div>
|
429 |
+
|
430 |
+
<?php
|
431 |
+
}
|
432 |
+
elseif($tab == 'daysToTransaction'){
|
433 |
+
?>
|
434 |
+
<div id="first_metric" >
|
435 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
436 |
+
<option value="transactions" ><?php echo __('Transactions', 'gawd'); ?></option>
|
437 |
+
</select>
|
438 |
+
</div>
|
439 |
+
|
440 |
+
<?php
|
441 |
+
}
|
442 |
+
elseif(strpos($tab,'custom_report')!==false){
|
443 |
+
$tab = substr($page,14);
|
444 |
+
|
445 |
+
?>
|
446 |
+
<div id="first_metric" >
|
447 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
448 |
+
<option value="<?php echo $get_custom_reports[$tab]['metric'];?>" ><?php echo __(preg_replace('!\s+!',' ',trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $get_custom_reports[$tab]['metric'])))), 'gawd'); ?></option>
|
449 |
+
|
450 |
+
</select>
|
451 |
+
</div>
|
452 |
+
<?php
|
453 |
+
$tab = 'custom_' . $get_custom_reports[$tab]['dimension'];
|
454 |
+
}
|
455 |
+
elseif($tab == 'custom') { ?>
|
456 |
+
<div id="first_metric" >
|
457 |
+
<select name="gawd_metric" id="gawd_metric" class="gawd_draw_analytics load_tooltip" data-hint="Choose a metric to view overview graph.">
|
458 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
459 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
460 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
461 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
462 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
463 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
464 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
465 |
+
</select>
|
466 |
+
</div>
|
467 |
+
<div id="metric_compare">
|
468 |
+
<select style="display: none;" id="wdi_no_custom_dimensions" class="load_tooltip" data-hint="Select the second metric to compare reports.">
|
469 |
+
<option value="0">There are no custom dimensions set for current profile.</option>
|
470 |
+
</select>
|
471 |
+
<select style="display: none;" name="gawd_custom_option" id="gawd_custom_option" class="gawd_draw_analytics">
|
472 |
+
|
473 |
+
</select>
|
474 |
+
<img src="<?php echo GAWD_URL. '/assets/cleardot.gif';?>"/>
|
475 |
+
</div>
|
476 |
+
<?php } ?>
|
477 |
+
</div>
|
478 |
+
|
479 |
+
<input id="gawd_tab" type="hidden" value="<?php echo $tab; ?>">
|
480 |
+
|
481 |
+
<?php if($tab != 'custom' && $tab != 'pagePath' && $tab != 'landingPagePath' && $tab != 'realTime' && $tab != 'daysToTransaction' && $tab != 'sales_performance' && strpos($_GET['tab'],'custom_report') === false) { ?>
|
482 |
+
<div class="vs_image" class="gawd_metrics">
|
483 |
+
<img width="30px" src="<?php echo GAWD_URL;?>/assets/vs.png">
|
484 |
+
</div>
|
485 |
+
<?php } ?>
|
486 |
+
<div class='clear'></div>
|
487 |
+
</div>
|
488 |
+
<?php if($tab != 'realTime') { ?>
|
489 |
+
<div id="date_chart_conteiner" class="float_conteiner">
|
490 |
+
<div class="gawd_row load_tooltip" data-hint="Choose Line, Pie or Column chart type to view your Google Analytics report with.">
|
491 |
+
<div id="gawd_text" class="gawd_text">
|
492 |
+
CHART
|
493 |
+
</div>
|
494 |
+
<div class="gawd_content" id="gawd_content_chart" >
|
495 |
+
<select name="gawd_chart_type" id="gawd_chart_type" class="gawd_draw_analytics">
|
496 |
+
<?php foreach($chart_types as $value => $title) { ?>
|
497 |
+
<option value="<?php echo $value; ?>"><?php echo $title; ?></option>
|
498 |
+
<?php } ?>
|
499 |
+
</select>
|
500 |
+
</div>
|
501 |
+
<div class='clear'></div>
|
502 |
+
</div >
|
503 |
+
<div class="gawd_row load_tooltip" data-hint="Select one of predefined date ranges or specify a custom period for your report.">
|
504 |
+
<div class="gawd_text" >
|
505 |
+
DATE
|
506 |
+
</div>
|
507 |
+
<div class="gawd_content" id="gawd_content_range" >
|
508 |
+
<div id="reportrange" class="pull-right" style="float:none !important">
|
509 |
+
<span></span> <b class="caret"></b>
|
510 |
+
</div>
|
511 |
+
<input type="hidden" id="gawd_start_end_date"/>
|
512 |
+
</div>
|
513 |
+
<div class='clear'></div>
|
514 |
+
</div>
|
515 |
+
<div class='clear'></div>
|
516 |
+
</div>
|
517 |
+
<?php } ?>
|
518 |
+
<div id="compare_time_conteiner" class="float_conteiner">
|
519 |
+
<?php if(($tab == 'date') || ($tab == 'adsense') || ($tab == 'siteSpeed') || $tab == 'sales_performance' || $tab == 'pagePath' || $tab == 'landingPagePath'){ ?>
|
520 |
+
<div class="gawd_date_filter_container load_tooltip" data-hint="Set the scale of your statistics graph. It will separate graph results hourly, daily, weekly and monthly.">
|
521 |
+
<ul class="gawd_list">
|
522 |
+
<li class="gawd_list_item" id="gawd_hour"><a href='#' class="gawd_filter_item" data-type="hour">Hourly</a></li>
|
523 |
+
<li class="gawd_list_item" id="gawd_day"><a href='#' class="gawd_filter_item" data-type="date">Day</a></li>
|
524 |
+
<li class="gawd_list_item" id="gawd_week"><a href='#' class="gawd_filter_item" data-type="week">Week</a></li>
|
525 |
+
<li class="gawd_list_item" id="gawd_month"><a href='#' class="gawd_filter_item" data-type="month">Month</a></li>
|
526 |
+
</ul>
|
527 |
+
</div>
|
528 |
+
<div id="compare_datepicker_wraper" class="load_tooltip" data-hint="Measure the results of Google Analytics tracking of two periods. Select Previous Period, Previous Year, or define a custom period using the datepicker.">COMPARE DATE</div>
|
529 |
+
<div id="" class="pull-right" style="float:none !important">
|
530 |
+
</div>
|
531 |
+
<input type="hidden" id="gawd_start_end_date_compare"/>
|
532 |
+
<div class='clear'></div>
|
533 |
+
<?php } ?>
|
534 |
+
</div>
|
535 |
+
<div class='clear'></div>
|
536 |
+
</div>
|
537 |
+
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_fild'); ?>
|
538 |
+
</form>
|
539 |
+
|
540 |
+
<div class="gawd_chart_conteiner">
|
541 |
+
<?php if($_GET['tab'] === 'adsense') { ?>
|
542 |
+
<h4>
|
543 |
+
AdSense reports are coming soon. View them
|
544 |
+
<a target="_blank" href="https://analytics.google.com/">
|
545 |
+
here.
|
546 |
+
</a>
|
547 |
+
</h4>
|
548 |
+
<?php } ?>
|
549 |
+
<div id="opacity_div" style="display: none; background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
|
550 |
+
<div id="loading_div" style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
|
551 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
552 |
+
</div>
|
553 |
+
<div id="chartdiv"></div>
|
554 |
+
<?php if($tab != 'realTime'){
|
555 |
+
?>
|
556 |
+
<div id="gawd_buttons">
|
557 |
+
<span id="country_filter_reset" class="button_gawd">Back</span>
|
558 |
+
<span class='clear'></span>
|
559 |
+
<input class="button_gawd" type="button" id="gawd_export_buttons" value="Export"/>
|
560 |
+
<input class="button_gawd load_tooltip" type="button" id="gawd_email_button" data-hint="Click to forward this report to selected email recipients, or schedule emails to be sent out periodically." value="Email"/>
|
561 |
+
<div class="gawd_exports">
|
562 |
+
<a class='button gawd_export_button_csv' href="">CSV</a>
|
563 |
+
<a class='button gawd_export_button_pdf' href="#">PDF</a>
|
564 |
+
</div>
|
565 |
+
</div>
|
566 |
+
<?php };?>
|
567 |
+
<div class="gawd_data_table">
|
568 |
+
<table class="display cell-border" style="width:100%">
|
569 |
+
|
570 |
+
</table>
|
571 |
+
</div>
|
572 |
+
</div>
|
573 |
+
</div>
|
574 |
+
<div class='clear'></div>
|
575 |
+
|
576 |
+
</div>
|
577 |
+
<?php //get parameters for export?>
|
578 |
+
|
579 |
+
<div class="gawd_email_popup_overlay">
|
580 |
+
</div>
|
581 |
+
<div class="gawd_email_popup">
|
582 |
+
<a href="#" class="gawd_btn">X</a>
|
583 |
+
<div class="gawd_email_body">
|
584 |
+
<form method="post" action="" id="gawd_email_form">
|
585 |
+
<div class="gawd_email_row load_tooltip" data-hint="E-mail to send reports from. You can change it from WordPress Settings > General > Email Address.">
|
586 |
+
<div class="gawd_email_label">From</div>
|
587 |
+
<div class="gawd_email_input gawd_email_input_from">
|
588 |
+
<?php echo get_option('admin_email'); ?>
|
589 |
+
</div>
|
590 |
+
<div class='clear'></div>
|
591 |
+
</div>
|
592 |
+
<div class="gawd_email_row load_tooltip" data-hint="Define one or more email report recipients separated by commas.">
|
593 |
+
<div class="gawd_email_label">To</div>
|
594 |
+
<div class="gawd_email_input">
|
595 |
+
<input id="gawd_email_to" name="gawd_email_to" class="" type="text" value="">
|
596 |
+
</div>
|
597 |
+
<div class='clear'></div>
|
598 |
+
</div>
|
599 |
+
<div class="gawd_email_row load_tooltip" data-hint="Set the subject for email reports.">
|
600 |
+
<div class="gawd_email_label">Subject</div>
|
601 |
+
<div class="gawd_email_input">
|
602 |
+
<input class="gawd_email_subject" name="gawd_email_subject" class="" type="text" value="">
|
603 |
+
</div>
|
604 |
+
<div class='clear'></div>
|
605 |
+
</div>
|
606 |
+
<div class="gawd_email_row">
|
607 |
+
<div class="gawd_email_attachemnt load_tooltip" data-hint="Select type for report attachments, CSV or PDF.">Attachment</div>
|
608 |
+
<div class="gawd_email_input_attachment" >
|
609 |
+
<select id="gawd_attachment_type" name="export_type">
|
610 |
+
<option value='csv'>CSV</option>
|
611 |
+
<!-- <option value='pdf'>PDF</option>-->
|
612 |
+
</select>
|
613 |
+
</div>
|
614 |
+
<div class="gawd_email_input gawd_email_month_day_div" id="gawd_email_month_day" data-hint="Select the day of month to send report on.">
|
615 |
+
<div class="gawd_email_day_of_week">Day of Month</div>
|
616 |
+
</div>
|
617 |
+
<div class="gawd_email_input gawd_email_week_day_div" data-hint="Click on weekday to choose email report sending day." id="gawd_email_week_day">
|
618 |
+
<div class="gawd_email_day_of_week">Day of Week</div>
|
619 |
+
<input type="hidden" name="gawd_email_week_day" id="gawd_email_week_day_hidden" >
|
620 |
+
</div>
|
621 |
+
<div class='clear'></div>
|
622 |
+
</div>
|
623 |
+
<div class="gawd_email_row">
|
624 |
+
<div class="gawd_email_frequency load_tooltip" data-hint="Send email report Once or set its frequency to Daily, Weekly or Monthly.">Frequency</div>
|
625 |
+
<div class="gawd_email_input_frequency " id="gawd_email_period">
|
626 |
+
<select name="gawd_email_period">
|
627 |
+
<option value="once">Once</option>
|
628 |
+
<option value="daily">Daily</option>
|
629 |
+
<option value="gawd_weekly">Weekly</option>
|
630 |
+
<option value="gawd_monthly">Monthly</option>
|
631 |
+
</select>
|
632 |
+
</div>
|
633 |
+
<div class="gawd_email_input gawd_email_month_day_div" id="gawd_email_month_day">
|
634 |
+
<div class="gawd_email_month_day">
|
635 |
+
<select id="gawd_email_month_day_select" name="gawd_email_month_day">
|
636 |
+
<?php
|
637 |
+
for($i=1; $i<29; $i++){
|
638 |
+
|
639 |
+
echo '<option value="'.$i.'">'.$i.'</option>';
|
640 |
+
}
|
641 |
+
?>
|
642 |
+
<option value="last">Last Day</option>
|
643 |
+
</select>
|
644 |
+
</div>
|
645 |
+
<div class='clear'></div>
|
646 |
+
</div>
|
647 |
+
<div class="gawd_email_input gawd_email_week_day_div" id="gawd_email_week_day">
|
648 |
+
<div class="gawd_email_week_days">
|
649 |
+
<ul class="gawd_email_week_day_ul">
|
650 |
+
<li class="gawd_email_week_day" data-atribute="sunday">Sun</li>
|
651 |
+
<li class="gawd_email_week_day" data-atribute="monday">Mon</li>
|
652 |
+
<li class="gawd_email_week_day" data-atribute="tuesday">Tue</li>
|
653 |
+
<li class="gawd_email_week_day" data-atribute="wednesday">Wed</li>
|
654 |
+
<li class="gawd_email_week_day" data-atribute="thursday">Thu</li>
|
655 |
+
<li class="gawd_email_week_day" data-atribute="friday">Fri</li>
|
656 |
+
<li class="gawd_email_week_day" data-atribute="saturday">Sat</li>
|
657 |
+
</ul>
|
658 |
+
</div>
|
659 |
+
<input type="hidden" name="gawd_email_week_day" id="gawd_email_week_day_hidden" >
|
660 |
+
</div>
|
661 |
+
<div class='clear'></div>
|
662 |
+
</div>
|
663 |
+
<div class="gawd_email_row gawd_email_time_row">
|
664 |
+
<div class="gawd_email_time load_tooltip" data-hint="Select the time, when you would like to receive this email.">Time</div>
|
665 |
+
<div class="gawd_email_input_time" id="gawd_email_time">
|
666 |
+
<input type="text" name="gawd_email_time_input" id="gawd_email_time_input" value="<?php echo date('H:i');?>"/>
|
667 |
+
</div>
|
668 |
+
|
669 |
+
<div class='clear'></div>
|
670 |
+
</div>
|
671 |
+
<div class="gawd_email_row gawd_email_message_label" data-hint="Compose email content to be sent with your report.">
|
672 |
+
Additional Message
|
673 |
+
</div>
|
674 |
+
<div class="gawd_email_row gawd_email_message">
|
675 |
+
<textarea name="gawd_email_body" id="gawd_email_body"></textarea>
|
676 |
+
</div>
|
677 |
+
<input name="gawd_email_from" id="gawd_email_from" class="" type="hidden" value="<?php echo get_option('admin_email'); ?>">
|
678 |
+
<input name="gawd_metric" id="gawd_email_metric" class="" type="hidden" value="">
|
679 |
+
<input name="gawd_metric_compare" id="gawd_metric_compare" class="" type="hidden" value="">
|
680 |
+
<input name="gawd_dimension" id="gawd_dimension" class="" type="hidden" value="<?php echo $tab; ?>">
|
681 |
+
<input name="gawd_start_date" id="gawd_start_date" class="" type="hidden" value="">
|
682 |
+
<input name="gawd_end_date" id="gawd_end_date" class="" type="hidden" value="">
|
683 |
+
<input name="action" id="" class="" type="hidden" value="gawd_export">
|
684 |
+
<input name="report_type" id="report_type" class="" type="hidden" value="email">
|
685 |
+
<div class="gawd_email_send" id="email_submit">
|
686 |
+
Send
|
687 |
+
</div>
|
688 |
+
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_fild'); ?>
|
689 |
+
</form>
|
690 |
+
</div>
|
691 |
+
<div class="email_message_cont"></div>
|
692 |
+
</div>
|
693 |
+
<canvas id='canvass' style="display:none"></canvas>
|
694 |
+
<input id="first_data" class="" type="hidden" value="">
|
695 |
+
<input id="second_data" class="" type="hidden" value="">
|
696 |
+
<input id="dimension" class="" type="hidden" value="">
|
697 |
+
<input id="first_data_sum" class="" type="hidden" value="">
|
698 |
+
<input id="second_data_sum" class="" type="hidden" value="">
|
699 |
+
<input id="second_start_date" class="" type="hidden" value="">
|
700 |
+
<input id="second_end_date" class="" type="hidden" value="">
|
701 |
+
<?php
|
702 |
+
GAWD_helper::print_pro_popup();
|
703 |
?>
|
admin/pages/dashboard_menu.php
CHANGED
@@ -1,135 +1,135 @@
|
|
1 |
-
<?php
|
2 |
-
function gawd_write_menu($tabs, $title = true){
|
3 |
-
$sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
|
4 |
-
$free_tabs = array('general', 'realtime');
|
5 |
-
foreach($tabs as $tab_key => $tab_data) {
|
6 |
-
if(!$title) {
|
7 |
-
$tab_data["title"] = "";
|
8 |
-
$sub_arrow = '';
|
9 |
-
}
|
10 |
-
if($tab_data["childs"] == array()) {
|
11 |
-
$active_tab = sanitize_text_field($_GET['tab']) == $tab_key ? 'gawd_active_li' : '';
|
12 |
-
/** FREE **/
|
13 |
-
if($tab_key === "Pro"){
|
14 |
-
echo ' <li class="gawd_inactive_pro gawd_menu_li '.$active_tab.' " id="gawd_'.$tab_key.'">
|
15 |
-
<span class="gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'</span>
|
16 |
-
<div style="display: inline-block;float: right;margin-top: 6px;"><a href="https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin" target="_blank" class="gawd-topbar-upgrade-button">Upgrade</a></div>
|
17 |
-
</li>';
|
18 |
-
}else if(!in_array($tab_key, $free_tabs)){
|
19 |
-
echo ' <li class="gawd_inactive gawd_menu_li '.$active_tab.' " id="gawd_'.$tab_key.'">
|
20 |
-
<span class=" gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'
|
21 |
-
</span><span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
|
22 |
-
</li>';
|
23 |
-
}/** END FREE **/
|
24 |
-
else if($tab_key == 'customReport') {
|
25 |
-
echo ' <li class="gawd_menu_li ' . $active_tab . '" id="gawd_' . $tab_key . '" >
|
26 |
-
<a class="gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_custom_reports">' . $tab_data["title"] . '</a>
|
27 |
-
</li><span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>';
|
28 |
-
} else {
|
29 |
-
echo ' <li class="gawd_menu_li ' . $active_tab . '" id="gawd_' . $tab_key . '" >
|
30 |
-
<a class="gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_reports&tab=' . $tab_key . '">' . $tab_data["title"] . '</a>
|
31 |
-
<span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>
|
32 |
-
</li>';
|
33 |
-
}
|
34 |
-
} else {
|
35 |
-
/** FREE **/
|
36 |
-
if(!in_array($tab_key, $free_tabs)){
|
37 |
-
echo ' <li class="gawd_inactive gawd_menu_li " id="gawd_'.$tab_key.'_li">
|
38 |
-
<span id="gawd_'.$tab_key.'s" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
|
39 |
-
</span>
|
40 |
-
<span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
|
41 |
-
<ul id="gawd_'.$tab_key.'_ul">';
|
42 |
-
}/** END FREE **/
|
43 |
-
else if($tab_key == 'customReport') {
|
44 |
-
echo ' <li class="gawd_menu_li " id="gawd_' . $tab_key . '_li">
|
45 |
-
<span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>
|
46 |
-
<span id="gawd_' . $tab_key . 's" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
47 |
-
</span>
|
48 |
-
<ul id="gawd_' . $tab_key . '_ul">';
|
49 |
-
} else {
|
50 |
-
echo ' <li class="gawd_menu_li" id="gawd_' . $tab_key . '_li" ">
|
51 |
-
<span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>
|
52 |
-
<span id="gawd_' . $tab_key . '" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
53 |
-
</span>
|
54 |
-
<ul id="gawd_' . $tab_key . '_ul">';
|
55 |
-
}
|
56 |
-
foreach($tab_data["childs"] as $child_key => $child_title) {
|
57 |
-
if(!$title) {
|
58 |
-
$child_title = "";
|
59 |
-
}
|
60 |
-
$active_tab = sanitize_text_field($_GET['tab']) == $child_key ? 'gawd_active_li' : '';
|
61 |
-
if(!in_array($tab_key, $free_tabs)){
|
62 |
-
echo ' <li class=" gawd_menu_ul_li '.$active_tab.'">
|
63 |
-
<span class="gawd_menu_item " >'.$child_title.'</span>
|
64 |
-
</li> ';
|
65 |
-
|
66 |
-
}/** END FREE **/
|
67 |
-
else {
|
68 |
-
echo ' <li class="gawd_menu_ul_li ' . $active_tab . '">
|
69 |
-
<a class="gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_reports&tab=' . $child_key . '">' . $child_title . '</a>
|
70 |
-
</li> ';
|
71 |
-
}
|
72 |
-
}
|
73 |
-
echo '</ul>
|
74 |
-
</li>';
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
|
79 |
-
function gawd_write_menu_collapse($tabs, $title = true){
|
80 |
-
$sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
|
81 |
-
foreach($tabs as $tab_key => $tab_data) {
|
82 |
-
if(!$title) {
|
83 |
-
$tab_data["title"] = "";
|
84 |
-
$sub_arrow = '';
|
85 |
-
}
|
86 |
-
if($tab_data["childs"] == array()) {
|
87 |
-
$active_tab = sanitize_text_field($_GET['tab']) == $tab_key ? 'gawd_active_li' : '';
|
88 |
-
if($tab_key == 'customReport') {
|
89 |
-
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>';
|
90 |
-
} else {
|
91 |
-
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>';
|
92 |
-
}
|
93 |
-
} else {
|
94 |
-
if($tab_key == 'customReport') {
|
95 |
-
echo '<span id="gawd_' . $tab_key . '_li" id="gawd_' . $tab_key . 's" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
96 |
-
<div class="collapse_ul" id="gawd_' . $tab_key . '_ul">';
|
97 |
-
} else {
|
98 |
-
echo '<span id="gawd_' . $tab_key . '_li" id="gawd_' . $tab_key . '" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
99 |
-
<div class="collapse_ul" id="gawd_' . $tab_key . '_ul">';
|
100 |
-
}
|
101 |
-
foreach($tab_data["childs"] as $child_key => $child_title) {
|
102 |
-
$active_tab = sanitize_text_field($_GET['tab']) == $child_key ? 'gawd_active_li_text' : '';
|
103 |
-
echo '<a class="' . $active_tab . ' gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_reports&tab=' . $child_key . '">' . $child_title . '</a>';
|
104 |
-
}
|
105 |
-
echo '</div></span>';
|
106 |
-
}
|
107 |
-
}
|
108 |
-
|
109 |
-
}
|
110 |
-
|
111 |
-
?>
|
112 |
-
<div class="resp_menu">
|
113 |
-
<div class="menu_img"></div>
|
114 |
-
<div class="button_label">REPORTS</div>
|
115 |
-
<div class="clear"></div>
|
116 |
-
</div>
|
117 |
-
|
118 |
-
<div class="gawd_menu_coteiner_collapse">
|
119 |
-
<div class="gawd_menu_ul">
|
120 |
-
<?php
|
121 |
-
gawd_write_menu_collapse($tabs, false);
|
122 |
-
?>
|
123 |
-
<span class='gawd_collapsed'></span>
|
124 |
-
</div>
|
125 |
-
</div>
|
126 |
-
<div class="gawd_menu_coteiner">
|
127 |
-
<input onkeyup="gawd_search()" type="text" class='gawd_search_input' placeholder="<?php _e('Search', 'gawd'); ?>"
|
128 |
-
autofocus/>
|
129 |
-
<ul class="gawd_menu_ul">
|
130 |
-
<?php
|
131 |
-
gawd_write_menu($tabs);
|
132 |
-
?>
|
133 |
-
<li class='gawd_collapse'>Collapse menu</li>
|
134 |
-
</ul>
|
135 |
</div>
|
1 |
+
<?php
|
2 |
+
function gawd_write_menu($tabs, $title = true){
|
3 |
+
$sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
|
4 |
+
$free_tabs = array('general', 'realtime');
|
5 |
+
foreach($tabs as $tab_key => $tab_data) {
|
6 |
+
if(!$title) {
|
7 |
+
$tab_data["title"] = "";
|
8 |
+
$sub_arrow = '';
|
9 |
+
}
|
10 |
+
if($tab_data["childs"] == array()) {
|
11 |
+
$active_tab = sanitize_text_field($_GET['tab']) == $tab_key ? 'gawd_active_li' : '';
|
12 |
+
/** FREE **/
|
13 |
+
if($tab_key === "Pro"){
|
14 |
+
echo ' <li class="gawd_inactive_pro gawd_menu_li '.$active_tab.' " id="gawd_'.$tab_key.'">
|
15 |
+
<span class="gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'</span>
|
16 |
+
<div style="display: inline-block;float: right;margin-top: 6px;"><a href="https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin" target="_blank" class="gawd-topbar-upgrade-button">Upgrade</a></div>
|
17 |
+
</li>';
|
18 |
+
}else if(!in_array($tab_key, $free_tabs)){
|
19 |
+
echo ' <li class="gawd_inactive gawd_menu_li '.$active_tab.' " id="gawd_'.$tab_key.'">
|
20 |
+
<span class=" gawd_menu_item gawd_pro_menu" >'.$tab_data["title"].'
|
21 |
+
</span><span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
|
22 |
+
</li>';
|
23 |
+
}/** END FREE **/
|
24 |
+
else if($tab_key == 'customReport') {
|
25 |
+
echo ' <li class="gawd_menu_li ' . $active_tab . '" id="gawd_' . $tab_key . '" >
|
26 |
+
<a class="gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_custom_reports">' . $tab_data["title"] . '</a>
|
27 |
+
</li><span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>';
|
28 |
+
} else {
|
29 |
+
echo ' <li class="gawd_menu_li ' . $active_tab . '" id="gawd_' . $tab_key . '" >
|
30 |
+
<a class="gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_reports&tab=' . $tab_key . '">' . $tab_data["title"] . '</a>
|
31 |
+
<span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>
|
32 |
+
</li>';
|
33 |
+
}
|
34 |
+
} else {
|
35 |
+
/** FREE **/
|
36 |
+
if(!in_array($tab_key, $free_tabs)){
|
37 |
+
echo ' <li class="gawd_inactive gawd_menu_li " id="gawd_'.$tab_key.'_li">
|
38 |
+
<span id="gawd_'.$tab_key.'s" class="gawd_menu_li_sub">'.$tab_data["title"].$sub_arrow.'
|
39 |
+
</span>
|
40 |
+
<span class="gawd_description" data-hint="'.$tab_data["desc"].'"></span>
|
41 |
+
<ul id="gawd_'.$tab_key.'_ul">';
|
42 |
+
}/** END FREE **/
|
43 |
+
else if($tab_key == 'customReport') {
|
44 |
+
echo ' <li class="gawd_menu_li " id="gawd_' . $tab_key . '_li">
|
45 |
+
<span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>
|
46 |
+
<span id="gawd_' . $tab_key . 's" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
47 |
+
</span>
|
48 |
+
<ul id="gawd_' . $tab_key . '_ul">';
|
49 |
+
} else {
|
50 |
+
echo ' <li class="gawd_menu_li" id="gawd_' . $tab_key . '_li" ">
|
51 |
+
<span class="gawd_description" data-hint="' . $tab_data["desc"] . '"></span>
|
52 |
+
<span id="gawd_' . $tab_key . '" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
53 |
+
</span>
|
54 |
+
<ul id="gawd_' . $tab_key . '_ul">';
|
55 |
+
}
|
56 |
+
foreach($tab_data["childs"] as $child_key => $child_title) {
|
57 |
+
if(!$title) {
|
58 |
+
$child_title = "";
|
59 |
+
}
|
60 |
+
$active_tab = sanitize_text_field($_GET['tab']) == $child_key ? 'gawd_active_li' : '';
|
61 |
+
if(!in_array($tab_key, $free_tabs)){
|
62 |
+
echo ' <li class=" gawd_menu_ul_li '.$active_tab.'">
|
63 |
+
<span class="gawd_menu_item " >'.$child_title.'</span>
|
64 |
+
</li> ';
|
65 |
+
|
66 |
+
}/** END FREE **/
|
67 |
+
else {
|
68 |
+
echo ' <li class="gawd_menu_ul_li ' . $active_tab . '">
|
69 |
+
<a class="gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_reports&tab=' . $child_key . '">' . $child_title . '</a>
|
70 |
+
</li> ';
|
71 |
+
}
|
72 |
+
}
|
73 |
+
echo '</ul>
|
74 |
+
</li>';
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
function gawd_write_menu_collapse($tabs, $title = true){
|
80 |
+
$sub_arrow = '<span class="gawd_menu_li_sub_arrow"></span>';
|
81 |
+
foreach($tabs as $tab_key => $tab_data) {
|
82 |
+
if(!$title) {
|
83 |
+
$tab_data["title"] = "";
|
84 |
+
$sub_arrow = '';
|
85 |
+
}
|
86 |
+
if($tab_data["childs"] == array()) {
|
87 |
+
$active_tab = sanitize_text_field($_GET['tab']) == $tab_key ? 'gawd_active_li' : '';
|
88 |
+
if($tab_key == 'customReport') {
|
89 |
+
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>';
|
90 |
+
} else {
|
91 |
+
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>';
|
92 |
+
}
|
93 |
+
} else {
|
94 |
+
if($tab_key == 'customReport') {
|
95 |
+
echo '<span id="gawd_' . $tab_key . '_li" id="gawd_' . $tab_key . 's" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
96 |
+
<div class="collapse_ul" id="gawd_' . $tab_key . '_ul">';
|
97 |
+
} else {
|
98 |
+
echo '<span id="gawd_' . $tab_key . '_li" id="gawd_' . $tab_key . '" class="gawd_menu_li_sub">' . $tab_data["title"] . $sub_arrow . '
|
99 |
+
<div class="collapse_ul" id="gawd_' . $tab_key . '_ul">';
|
100 |
+
}
|
101 |
+
foreach($tab_data["childs"] as $child_key => $child_title) {
|
102 |
+
$active_tab = sanitize_text_field($_GET['tab']) == $child_key ? 'gawd_active_li_text' : '';
|
103 |
+
echo '<a class="' . $active_tab . ' gawd_menu_item " href="' . admin_url() . 'admin.php?page=gawd_reports&tab=' . $child_key . '">' . $child_title . '</a>';
|
104 |
+
}
|
105 |
+
echo '</div></span>';
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
}
|
110 |
+
|
111 |
+
?>
|
112 |
+
<div class="resp_menu">
|
113 |
+
<div class="menu_img"></div>
|
114 |
+
<div class="button_label">REPORTS</div>
|
115 |
+
<div class="clear"></div>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<div class="gawd_menu_coteiner_collapse">
|
119 |
+
<div class="gawd_menu_ul">
|
120 |
+
<?php
|
121 |
+
gawd_write_menu_collapse($tabs, false);
|
122 |
+
?>
|
123 |
+
<span class='gawd_collapsed'></span>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
<div class="gawd_menu_coteiner">
|
127 |
+
<input onkeyup="gawd_search()" type="text" class='gawd_search_input' placeholder="<?php _e('Search', 'gawd'); ?>"
|
128 |
+
autofocus/>
|
129 |
+
<ul class="gawd_menu_ul">
|
130 |
+
<?php
|
131 |
+
gawd_write_menu($tabs);
|
132 |
+
?>
|
133 |
+
<li class='gawd_collapse'>Collapse menu</li>
|
134 |
+
</ul>
|
135 |
</div>
|
admin/pages/dashboard_widget.php
CHANGED
@@ -1,57 +1,57 @@
|
|
1 |
-
<form method="post" id="gawd_dashboard_wp">
|
2 |
-
<select title="Click to pick the website, audience report of which you’d like to display."
|
3 |
-
style="width: 41%; margin-right: 20px;"
|
4 |
-
class="gawd_profile_select"
|
5 |
-
name="gawd_id"
|
6 |
-
onchange="gawd_wp_dashboard_change_account(this)">
|
7 |
-
<?php foreach($profiles as $property_name => $property): ?>
|
8 |
-
<optgroup label="<?php echo $property_name; ?>">
|
9 |
-
<?php foreach($property as $profile):
|
10 |
-
$webPropertyId = $profile['webPropertyId'];
|
11 |
-
$id = $profile['id'];
|
12 |
-
$name = $profile['name'];
|
13 |
-
$selected = '';
|
14 |
-
if($id == $gawd_last_viewed_profile['profile_id']) {
|
15 |
-
$selected = 'selected="selected"';
|
16 |
-
}
|
17 |
-
?>
|
18 |
-
<option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
19 |
-
<?php endforeach ?>
|
20 |
-
</optgroup>
|
21 |
-
<?php endforeach ?>
|
22 |
-
</select>
|
23 |
-
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
24 |
-
<select name="gawd_widget_date" id="gawd_widget_date">
|
25 |
-
<option value="<?php echo date('Y-m-d', strtotime('-7 days')); ?>"><?php echo __('Last 7 Days', 'gawd'); ?></option>
|
26 |
-
<option value="<?php echo date('Y-m-d', strtotime('-30 days')); ?>"><?php echo __('Last 30 Days', 'gawd'); ?></option>
|
27 |
-
<option value="realTime"><?php echo __('Real Time', 'gawd'); ?></option>
|
28 |
-
</select>
|
29 |
-
<select name="gawd_metric_widget" id="gawd_metric_widget">
|
30 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
31 |
-
<option value="users"><?php echo __('Users', 'gawd'); ?></option>
|
32 |
-
<option value="bounceRate"><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
33 |
-
<option value="pageviews"><?php echo __('Pageviews', 'gawd'); ?></option>
|
34 |
-
<option value="percentNewSessions">% New Sessions</option>
|
35 |
-
<option value="avgSessionDuration">Avg Session Duration</option>
|
36 |
-
<option value="pageviewsPerSession"><?php echo __('Pages/Session', 'gawd'); ?></option>
|
37 |
-
</select>
|
38 |
-
</form>
|
39 |
-
<div id="gawd_wp_dashboard_chart_container">
|
40 |
-
<div class="gawd_opacity_div_compact">
|
41 |
-
<div class="gawd_loading_div_compact">
|
42 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
<div id="gawd_wp_dashboard_chart_wrapper"></div>
|
46 |
-
</div>
|
47 |
-
<script>
|
48 |
-
function gawd_wp_dashboard_change_account(that) {
|
49 |
-
jQuery('#web_property_name').val(jQuery(that).find(':selected').closest('optgroup').attr('label'));
|
50 |
-
jQuery('#gawd_dashboard_wp').submit();
|
51 |
-
}
|
52 |
-
|
53 |
-
jQuery(document).ready(function () {
|
54 |
-
var wp_dashboard_chart = new gawd_wp_dashboard_charts();
|
55 |
-
wp_dashboard_chart.init();
|
56 |
-
});
|
57 |
</script>
|
1 |
+
<form method="post" id="gawd_dashboard_wp">
|
2 |
+
<select title="Click to pick the website, audience report of which you’d like to display."
|
3 |
+
style="width: 41%; margin-right: 20px;"
|
4 |
+
class="gawd_profile_select"
|
5 |
+
name="gawd_id"
|
6 |
+
onchange="gawd_wp_dashboard_change_account(this)">
|
7 |
+
<?php foreach($profiles as $property_name => $property): ?>
|
8 |
+
<optgroup label="<?php echo $property_name; ?>">
|
9 |
+
<?php foreach($property as $profile):
|
10 |
+
$webPropertyId = $profile['webPropertyId'];
|
11 |
+
$id = $profile['id'];
|
12 |
+
$name = $profile['name'];
|
13 |
+
$selected = '';
|
14 |
+
if($id == $gawd_last_viewed_profile['profile_id']) {
|
15 |
+
$selected = 'selected="selected"';
|
16 |
+
}
|
17 |
+
?>
|
18 |
+
<option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
19 |
+
<?php endforeach ?>
|
20 |
+
</optgroup>
|
21 |
+
<?php endforeach ?>
|
22 |
+
</select>
|
23 |
+
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
24 |
+
<select name="gawd_widget_date" id="gawd_widget_date">
|
25 |
+
<option value="<?php echo date('Y-m-d', strtotime('-7 days')); ?>"><?php echo __('Last 7 Days', 'gawd'); ?></option>
|
26 |
+
<option value="<?php echo date('Y-m-d', strtotime('-30 days')); ?>"><?php echo __('Last 30 Days', 'gawd'); ?></option>
|
27 |
+
<option value="realTime"><?php echo __('Real Time', 'gawd'); ?></option>
|
28 |
+
</select>
|
29 |
+
<select name="gawd_metric_widget" id="gawd_metric_widget">
|
30 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
31 |
+
<option value="users"><?php echo __('Users', 'gawd'); ?></option>
|
32 |
+
<option value="bounceRate"><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
33 |
+
<option value="pageviews"><?php echo __('Pageviews', 'gawd'); ?></option>
|
34 |
+
<option value="percentNewSessions">% New Sessions</option>
|
35 |
+
<option value="avgSessionDuration">Avg Session Duration</option>
|
36 |
+
<option value="pageviewsPerSession"><?php echo __('Pages/Session', 'gawd'); ?></option>
|
37 |
+
</select>
|
38 |
+
</form>
|
39 |
+
<div id="gawd_wp_dashboard_chart_container">
|
40 |
+
<div class="gawd_opacity_div_compact">
|
41 |
+
<div class="gawd_loading_div_compact">
|
42 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
43 |
+
</div>
|
44 |
+
</div>
|
45 |
+
<div id="gawd_wp_dashboard_chart_wrapper"></div>
|
46 |
+
</div>
|
47 |
+
<script>
|
48 |
+
function gawd_wp_dashboard_change_account(that) {
|
49 |
+
jQuery('#web_property_name').val(jQuery(that).find(':selected').closest('optgroup').attr('label'));
|
50 |
+
jQuery('#gawd_dashboard_wp').submit();
|
51 |
+
}
|
52 |
+
|
53 |
+
jQuery(document).ready(function () {
|
54 |
+
var wp_dashboard_chart = new gawd_wp_dashboard_charts();
|
55 |
+
wp_dashboard_chart.init();
|
56 |
+
});
|
57 |
</script>
|
admin/pages/date.php
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<div class="gawd_wrapper">
|
2 |
-
<div class="opacity_div_compact"> </div>
|
3 |
-
<div class="loading_div_compact">
|
4 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
5 |
-
</div>
|
6 |
-
<div style="float:left">
|
7 |
-
<div id="first_metric" >
|
8 |
-
<select class="gawd_compact_metric_change" name="gawd_metric_compact" id="gawd_metric_compact" >
|
9 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
10 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
11 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
12 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
13 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
14 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
15 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
16 |
-
</select>
|
17 |
-
</div>
|
18 |
-
<div id="metric_compare">
|
19 |
-
<select class="gawd_compact_metric_change" name="gawd_metric_compare" id="gawd_metric_compare_compact">
|
20 |
-
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
21 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
22 |
-
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
23 |
-
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
24 |
-
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
25 |
-
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
26 |
-
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
27 |
-
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
28 |
-
</select>
|
29 |
-
</div>
|
30 |
-
</div>
|
31 |
-
<div style="float:left;margin:16px 0 0 0 " class="vs_image" class="gawd_metrics">
|
32 |
-
<img width="30px" src="<?php echo GAWD_URL; ?>/assets/vs.png">
|
33 |
-
</div>
|
34 |
-
<div class="clear"></div>
|
35 |
-
|
36 |
-
<div id="gawd_date_meta"></div>
|
37 |
-
</div>
|
38 |
-
<script>
|
39 |
-
jQuery(document).ready(function(){
|
40 |
-
hide_same_metric(jQuery('#gawd_metric_compare_compact'));
|
41 |
-
hide_same_metric(jQuery('#gawd_metric_compact'));
|
42 |
-
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
43 |
-
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
44 |
-
var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
|
45 |
-
|
46 |
-
var start_end_date = start_end_date.split('/-/');
|
47 |
-
var start_date = start_end_date[0];
|
48 |
-
var end_date = start_end_date[1];
|
49 |
-
jQuery('#gawd_metric_compact').on('change', function () {
|
50 |
-
hide_same_metric(this);
|
51 |
-
gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
|
52 |
-
})
|
53 |
-
jQuery('#gawd_metric_compare_compact').on('change', function () {
|
54 |
-
hide_same_metric(this);
|
55 |
-
gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
|
56 |
-
})
|
57 |
-
//gawd_draw_analytics_compact('sessions', 'users', 'date', 'line', start_date, end_date, 'gawd_date_meta');
|
58 |
-
|
59 |
-
});
|
60 |
</script>
|
1 |
+
<div class="gawd_wrapper">
|
2 |
+
<div class="opacity_div_compact"> </div>
|
3 |
+
<div class="loading_div_compact">
|
4 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
5 |
+
</div>
|
6 |
+
<div style="float:left">
|
7 |
+
<div id="first_metric" >
|
8 |
+
<select class="gawd_compact_metric_change" name="gawd_metric_compact" id="gawd_metric_compact" >
|
9 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
10 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
11 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
12 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
13 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
14 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
15 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
16 |
+
</select>
|
17 |
+
</div>
|
18 |
+
<div id="metric_compare">
|
19 |
+
<select class="gawd_compact_metric_change" name="gawd_metric_compare" id="gawd_metric_compare_compact">
|
20 |
+
<option value="users" ><?php echo __('Users', 'gawd'); ?></option>
|
21 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
22 |
+
<option value="percentNewSessions"><?php echo __('% New Sessions', 'gawd'); ?></option>
|
23 |
+
<option value="bounceRate" ><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
24 |
+
<option value="avgSessionDuration" ><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
25 |
+
<option value="pageviews" ><?php echo __('Pageviews', 'gawd'); ?></option>
|
26 |
+
<option value="pageviewsPerSession" ><?php echo __('Pages/Session', 'gawd'); ?></option>
|
27 |
+
<option value="0"><?php echo __('None', 'gawd'); ?></option>
|
28 |
+
</select>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
<div style="float:left;margin:16px 0 0 0 " class="vs_image" class="gawd_metrics">
|
32 |
+
<img width="30px" src="<?php echo GAWD_URL; ?>/assets/vs.png">
|
33 |
+
</div>
|
34 |
+
<div class="clear"></div>
|
35 |
+
|
36 |
+
<div id="gawd_date_meta"></div>
|
37 |
+
</div>
|
38 |
+
<script>
|
39 |
+
jQuery(document).ready(function(){
|
40 |
+
hide_same_metric(jQuery('#gawd_metric_compare_compact'));
|
41 |
+
hide_same_metric(jQuery('#gawd_metric_compact'));
|
42 |
+
var _end_date = (Date.today().add(-1).days()).toString("yyyy-MM-dd");
|
43 |
+
var start_date_7 = (Date.today().add(-1).days()).add(-7).days().toString("yyyy-MM-dd");
|
44 |
+
var start_end_date = typeof jQuery('#gawd_start_end_date_compact').val() != 'undefined' ? jQuery('#gawd_start_end_date_compact').val() : start_date_7 + '/-/' + _end_date;
|
45 |
+
|
46 |
+
var start_end_date = start_end_date.split('/-/');
|
47 |
+
var start_date = start_end_date[0];
|
48 |
+
var end_date = start_end_date[1];
|
49 |
+
jQuery('#gawd_metric_compact').on('change', function () {
|
50 |
+
hide_same_metric(this);
|
51 |
+
gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
|
52 |
+
})
|
53 |
+
jQuery('#gawd_metric_compare_compact').on('change', function () {
|
54 |
+
hide_same_metric(this);
|
55 |
+
gawd_draw_analytics_compact(jQuery('#gawd_metric_compact').val(), jQuery('#gawd_metric_compare_compact').val(), 'date', 'line', 'gawd_date_meta');
|
56 |
+
})
|
57 |
+
//gawd_draw_analytics_compact('sessions', 'users', 'date', 'line', start_date, end_date, 'gawd_date_meta');
|
58 |
+
|
59 |
+
});
|
60 |
</script>
|
admin/pages/goals.php
CHANGED
@@ -1,312 +1,312 @@
|
|
1 |
-
<?php if ($display_goals_page === false) { ?>
|
2 |
-
<div>
|
3 |
-
<h4 style="margin-top: 30px;">
|
4 |
-
You cannot configure goals for this site, because there is no property chosen for it.
|
5 |
-
<a href="<?php echo admin_url('admin.php?page=gawd_settings#gawd_tracking_tab'); ?>"
|
6 |
-
style="cursor: pointer">
|
7 |
-
Click here
|
8 |
-
</a>
|
9 |
-
to set up a property.
|
10 |
-
</h4>
|
11 |
-
</div>
|
12 |
-
<?php
|
13 |
-
return;
|
14 |
-
} ?>
|
15 |
-
<div class="goal_wrap">
|
16 |
-
<div>
|
17 |
-
<h3 class="gawd_page_titles">Goal Management</h3>
|
18 |
-
<div class="gawd_refresh_button_wrapper">
|
19 |
-
<div class="gawd_info gawd_info_goal"
|
20 |
-
title="<?php esc_attr_e('Use this button to synchronize user data on this site with Google Analytics service. For example, after adding GA Account or changing web-properties.', 'gawd'); ?>">
|
21 |
-
</div>
|
22 |
-
<div class="gawd_account_button refresh_user_info refresh_user_info_goal" onclick="gawd_refresh_user_info(false,true)">
|
23 |
-
Refresh user info
|
24 |
-
</div>
|
25 |
-
</div>
|
26 |
-
</div>
|
27 |
-
<p style="width: 80%;">
|
28 |
-
You can set and manage goals for your website tracking. Select the View that you’re going to track and configure
|
29 |
-
these options based on the type of goal you would like to set.
|
30 |
-
</p>
|
31 |
-
<form method="post" id="gawd_goal_form">
|
32 |
-
<div class="gawd_goal_row">
|
33 |
-
<span class="gawd_goal_label">Website</span>
|
34 |
-
<span class="gawd_goal_input">
|
35 |
-
<select name="gawd_goal_profile" class="gawd_goal_profile">
|
36 |
-
<?php foreach ($profiles as $profile) {
|
37 |
-
$next_goal_id = (isset($next_goals_id[$profile['id']])) ? $next_goals_id[$profile['id']] : "1";
|
38 |
-
echo '<option data-next_id="' . $next_goal_id . '" value="' . $profile['id'] . '">' . $property['name'] . ' - ' . $profile['name'] . '</option>';
|
39 |
-
} ?>
|
40 |
-
</select>
|
41 |
-
</span>
|
42 |
-
<div class="gawd_info"
|
43 |
-
title="Choose the website, to which you would like to set Google Analytics Goals. "></div>
|
44 |
-
<div class='clear'></div>
|
45 |
-
</div>
|
46 |
-
<div class="gawd_goal_row">
|
47 |
-
<span class="gawd_goal_label">Name</span>
|
48 |
-
<span class="gawd_goal_input">
|
49 |
-
<input id="gawd_goal_name" name="gawd_goal_name" class="" type="text" value="">
|
50 |
-
</span>
|
51 |
-
<div class="gawd_info" title="Provide a name for this goal"></div>
|
52 |
-
<div class='clear'></div>
|
53 |
-
</div>
|
54 |
-
<div class="gawd_goal_row">
|
55 |
-
<span class="gawd_goal_label">Type</span>
|
56 |
-
<span class="gawd_goal_input">
|
57 |
-
<select name="gawd_goal_type" class="gawd_goal_type">
|
58 |
-
<option value="URL_DESTINATION">Destination</option>
|
59 |
-
<option value="VISIT_TIME_ON_SITE">Duration</option>
|
60 |
-
<option value="VISIT_NUM_PAGES">Pages/Screens per session</option>
|
61 |
-
<!-- <option value="EVENT">Event</option> -->
|
62 |
-
</select>
|
63 |
-
</span>
|
64 |
-
<div class="gawd_info"
|
65 |
-
title="Select its type (Destination, Duration, Pages/Screens per session or Event)."></div>
|
66 |
-
<div class='clear'></div>
|
67 |
-
</div>
|
68 |
-
<div class="gawd_goal_duration_wrap" id="gawd_goal_duration_wrap">
|
69 |
-
<div class="gawd_duration_label">Duration</div>
|
70 |
-
<div class="gawd_comparison_input">
|
71 |
-
<select name="gawd_goal_duration_comparison" class="gawd_goal_duration_comparison">
|
72 |
-
<option value="GREATER_THAN">Greater than</option>
|
73 |
-
</select>
|
74 |
-
</div>
|
75 |
-
<div class="gawd_duration">
|
76 |
-
<div class="time_wrap">
|
77 |
-
<!--<div class="time_label">Hour</div> -->
|
78 |
-
<div class="time_input"><input placeholder="hour" type="number" min='0' name="gawd_visit_hour"/>
|
79 |
-
</div>
|
80 |
-
</div>
|
81 |
-
<div class="time_wrap">
|
82 |
-
<!--<div class="time_label">Minute</div> -->
|
83 |
-
<div class="time_input"><input placeholder="min." type="number" min='0' name="gawd_visit_minute"/>
|
84 |
-
</div>
|
85 |
-
</div>
|
86 |
-
<div class="time_wrap" id="time_wrap">
|
87 |
-
<!--<div class="time_label">Second</div> -->
|
88 |
-
<div class="time_input"><input placeholder="sec." type="number" min='0' name="gawd_visit_second"/>
|
89 |
-
</div>
|
90 |
-
</div>
|
91 |
-
<div class='clear'></div>
|
92 |
-
</div>
|
93 |
-
<div class="gawd_info" style="margin-left: 15px"
|
94 |
-
title="Set a duration for this goal. For example, if you select 20 minutes, each time users spend 20 minutes or more on your site, it will be counted as goal completion."></div>
|
95 |
-
<div class='clear'></div>
|
96 |
-
</div>
|
97 |
-
<div class="gawd_page_sessions" id="gawd_page_sessions">
|
98 |
-
<div class="gawd_duration_label">Pages per session</div>
|
99 |
-
<div class="gawd_comparison_input">
|
100 |
-
<select name="gawd_goal_page_comparison" class="gawd_goal_duration_comparison">
|
101 |
-
<option value="GREATER_THAN">Greater than</option>
|
102 |
-
</select>
|
103 |
-
</div>
|
104 |
-
<div class="gawd_duration">
|
105 |
-
<div class="time_wrap">
|
106 |
-
<!--<div class="time_label">Hour</div> -->
|
107 |
-
<input type="number" min='0' name="gawd_page_sessions"/>
|
108 |
-
</div>
|
109 |
-
<div class='clear'></div>
|
110 |
-
</div>
|
111 |
-
<div class="gawd_info" style="margin-left: 15px"
|
112 |
-
title="Choose the number of pages/screens users should view to complete this goal."></div>
|
113 |
-
<div class='clear'></div>
|
114 |
-
</div>
|
115 |
-
<div class="gawd_page_destination" id="gawd_page_destination">
|
116 |
-
<div class="gawd_duration_label">Destination type</div>
|
117 |
-
<div class="gawd_url_comparison_input">
|
118 |
-
<select name="gawd_goal_page_destination_match" class="gawd_goal_duration_comparison">
|
119 |
-
<option value="EXACT">Equals to</option>
|
120 |
-
<option value="HEAD">Begins with</option>
|
121 |
-
<option value="REGEX">Regular expression</option>
|
122 |
-
</select>
|
123 |
-
</div>
|
124 |
-
<div class="gawd_info" style="margin-left: 8px;"
|
125 |
-
title="Set the destination of your goal. It can be equal to the specified value, as well as begin with it. You can also add a Regular Expression as destination value."></div>
|
126 |
-
<div class="gawd_destination_url">
|
127 |
-
<label for="gawd_case_sensitive" class="case_sensitive gawd_duration_label">URL</label>
|
128 |
-
<div class="time_wrap">
|
129 |
-
<div class="time_input"><input type="text" name="gawd_page_url"/></div>
|
130 |
-
</div>
|
131 |
-
<div class="gawd_info" title="Set the URL or Regular Expression of the destination."></div>
|
132 |
-
<div class='clear'></div>
|
133 |
-
</div>
|
134 |
-
<div class="gawd_destination_url">
|
135 |
-
<label for="gawd_case_sensitive" class="case_sensitive gawd_duration_label">Case-sensitive URL</label>
|
136 |
-
<div class="time_wrap">
|
137 |
-
<div class="onoffswitch" style="margin: 3px 0 0 6px;">
|
138 |
-
<input type="checkbox" name="url_case_sensitve" class="onoffswitch-checkbox"
|
139 |
-
id="gawd_case_sensitive">
|
140 |
-
<label class="onoffswitch-label" for="gawd_case_sensitive">
|
141 |
-
<span class="onoffswitch-inner"></span>
|
142 |
-
<span class="onoffswitch-switch"></span>
|
143 |
-
</label>
|
144 |
-
</div>
|
145 |
-
</div>
|
146 |
-
<div class="gawd_info" title="Enable this option to set destination URL to be case-sensitive."></div>
|
147 |
-
</div>
|
148 |
-
|
149 |
-
<div class='clear'></div>
|
150 |
-
</div>
|
151 |
-
<div class="gawd_buttons" id="goal_submit">
|
152 |
-
<input class="button_gawd" type="button" name="add_goal" value="Save"/>
|
153 |
-
</div>
|
154 |
-
<input type="hidden" name="gawd_next_goal_id" id="gawd_next_goal_id" value=""/>
|
155 |
-
</form>
|
156 |
-
<input type="hidden" id="gawd_refresh_user_info_transient"
|
157 |
-
value="<?php echo $refresh_user_info_transient; ?>"/>
|
158 |
-
<?php if (!empty($goals)) {
|
159 |
-
$counter = 0;
|
160 |
-
foreach ($goals as $profile_id => $profile_goals) { ?>
|
161 |
-
<table border="1" class="gawd_table" id="<?php echo $profile_id; ?>"
|
162 |
-
style="<?php echo(($counter != 0) ? 'display:none;' : ''); ?>">
|
163 |
-
<tr>
|
164 |
-
<th>ID</th>
|
165 |
-
<th>Name</th>
|
166 |
-
<th>Type</th>
|
167 |
-
<th>Match Type</th>
|
168 |
-
<th>Value</th>
|
169 |
-
</tr>
|
170 |
-
<?php
|
171 |
-
foreach ($profile_goals as $goal) {
|
172 |
-
$case_sensitive = $goal['caseSensitive'] ? ' - case sensitive' : '';
|
173 |
-
?>
|
174 |
-
<tr class="gawd_rows">
|
175 |
-
<td><?php echo $goal['id']; ?></td>
|
176 |
-
<td><?php echo $goal['name']; ?></td>
|
177 |
-
<td><?php echo $goal['type']; ?></td>
|
178 |
-
<td><?php echo ($goal['match_type'] !== 'GREATER_THAN') ? $goal['match_type'] : "Greater than"; ?></td>
|
179 |
-
<td><?php echo $goal['value'] . $case_sensitive; ?></td>
|
180 |
-
</tr>
|
181 |
-
<?php
|
182 |
-
}
|
183 |
-
?>
|
184 |
-
</table>
|
185 |
-
<?php $counter++;
|
186 |
-
}
|
187 |
-
} ?>
|
188 |
-
|
189 |
-
</div>
|
190 |
-
<script>
|
191 |
-
|
192 |
-
jQuery('.gawd_goal_type').on('change', function ()
|
193 |
-
{
|
194 |
-
if (jQuery('.gawd_goal_type :selected').val() == 'VISIT_TIME_ON_SITE') {
|
195 |
-
jQuery('.gawd_goal_duration_wrap').show();
|
196 |
-
jQuery('.gawd_page_sessions').hide();
|
197 |
-
jQuery('.gawd_page_destination').hide();
|
198 |
-
jQuery('.gawd_page_event').hide();
|
199 |
-
} else
|
200 |
-
if (jQuery('.gawd_goal_type :selected').val() == 'VISIT_NUM_PAGES') {
|
201 |
-
jQuery('.gawd_goal_duration_wrap').hide();
|
202 |
-
jQuery('.gawd_page_destination').hide();
|
203 |
-
jQuery('.gawd_page_event').hide();
|
204 |
-
jQuery('.gawd_page_sessions').show();
|
205 |
-
} else
|
206 |
-
if (jQuery('.gawd_goal_type :selected').val() == 'EVENT') {
|
207 |
-
jQuery('.gawd_goal_duration_wrap').hide();
|
208 |
-
jQuery('.gawd_page_sessions').hide();
|
209 |
-
jQuery('.gawd_page_destination').hide();
|
210 |
-
jQuery('.gawd_page_event').show();
|
211 |
-
} else {
|
212 |
-
jQuery('.gawd_goal_duration_wrap').hide();
|
213 |
-
jQuery('.gawd_page_sessions').hide();
|
214 |
-
jQuery('.gawd_page_event').hide();
|
215 |
-
jQuery('.gawd_page_destination').show();
|
216 |
-
}
|
217 |
-
});
|
218 |
-
|
219 |
-
jQuery('.button_gawd').on('click', function ()
|
220 |
-
{
|
221 |
-
var submit_form = true;
|
222 |
-
var gawd_goal_name = jQuery("#gawd_goal_name");
|
223 |
-
var gawd_goal_name = jQuery("#gawd_goal_name");
|
224 |
-
if (gawd_goal_name.val() === "") {
|
225 |
-
gawd_goal_name.addClass('gawd_invalid');
|
226 |
-
submit_form = false;
|
227 |
-
}
|
228 |
-
else
|
229 |
-
if (
|
230 |
-
(jQuery('input[name="gawd_page_sessions"]').val() === '' && jQuery('.gawd_goal_type :selected').val() == 'VISIT_NUM_PAGES') ||
|
231 |
-
(jQuery('input[name="gawd_page_url"]').val() === '' && jQuery('.gawd_goal_type :selected').val() == 'URL_DESTINATION') ||
|
232 |
-
((jQuery('input[name="gawd_visit_hour"]').val() === '' || jQuery('input[name="gawd_visit_minute"]').val() === '' || jQuery('input[name="gawd_visit_second"]').val() === '') && jQuery('.gawd_goal_type :selected').val() == 'VISIT_TIME_ON_SITE')) {
|
233 |
-
jQuery('input[name="gawd_page_url"]').addClass('gawd_invalid');
|
234 |
-
jQuery('input[name="gawd_page_sessions"]').addClass('gawd_invalid');
|
235 |
-
jQuery('input[name="gawd_visit_hour"]').addClass('gawd_invalid');
|
236 |
-
jQuery('input[name="gawd_visit_minute"]').addClass('gawd_invalid');
|
237 |
-
jQuery('input[name="gawd_visit_second"]').addClass('gawd_invalid');
|
238 |
-
submit_form = false;
|
239 |
-
}
|
240 |
-
else {
|
241 |
-
gawd_goal_name.removeClass('gawd_invalid');
|
242 |
-
jQuery('input[name="gawd_page_url"]').removeClass('gawd_invalid');
|
243 |
-
jQuery('input[name="gawd_page_sessions"]').removeClass('gawd_invalid');
|
244 |
-
jQuery('input[name="gawd_visit_hour"]').removeClass('gawd_invalid');
|
245 |
-
jQuery('input[name="gawd_visit_minute"]').removeClass('gawd_invalid');
|
246 |
-
jQuery('input[name="gawd_visit_second"]').removeClass('gawd_invalid');
|
247 |
-
}
|
248 |
-
|
249 |
-
var table_id = jQuery('.gawd_goal_profile').val();
|
250 |
-
var next_id = jQuery('.gawd_goal_profile').find('option:selected').data('next_id');
|
251 |
-
|
252 |
-
if (jQuery('#' + table_id + ' .gawd_table tr').length - 1 >= 20 || next_id === "") {
|
253 |
-
alert('You have reached the maximum number of goals.')
|
254 |
-
return;
|
255 |
-
}
|
256 |
-
|
257 |
-
jQuery('#gawd_next_goal_id').val(next_id);
|
258 |
-
if (submit_form) {
|
259 |
-
gawd_save_goals();
|
260 |
-
return false;
|
261 |
-
}
|
262 |
-
});
|
263 |
-
|
264 |
-
jQuery('.gawd_goal_profile').on('change', function ()
|
265 |
-
{
|
266 |
-
jQuery('.gawd_table').each(function ()
|
267 |
-
{
|
268 |
-
jQuery(this).hide();
|
269 |
-
});
|
270 |
-
var id = jQuery(this).val();
|
271 |
-
jQuery('#' + id).show();
|
272 |
-
});
|
273 |
-
|
274 |
-
function gawd_save_goals()
|
275 |
-
{
|
276 |
-
|
277 |
-
var serialized_form = jQuery("#gawd_goal_form").serializeArray();
|
278 |
-
var form_data = {};
|
279 |
-
for (var i = 0; i < serialized_form.length; i++) {
|
280 |
-
form_data[serialized_form[i].name] = serialized_form[i].value;
|
281 |
-
}
|
282 |
-
|
283 |
-
var args = gawd_custom_ajax_args();
|
284 |
-
args.type = 'POST';
|
285 |
-
args.async = true;
|
286 |
-
args.data.gawd_action = "save_goals";
|
287 |
-
args.data.gawd_data = {
|
288 |
-
'form': form_data
|
289 |
-
};
|
290 |
-
|
291 |
-
var $loader_container = jQuery("#gawd_goal_form");
|
292 |
-
args.beforeSend = function ()
|
293 |
-
{
|
294 |
-
gawd_add_loader($loader_container);
|
295 |
-
};
|
296 |
-
|
297 |
-
args.success = function (response)
|
298 |
-
{
|
299 |
-
window.location.reload();
|
300 |
-
};
|
301 |
-
|
302 |
-
args.error = function ()
|
303 |
-
{
|
304 |
-
window.location.reload();
|
305 |
-
};
|
306 |
-
|
307 |
-
jQuery.ajax(args).done(function ()
|
308 |
-
{
|
309 |
-
gawd_remove_loader($loader_container);
|
310 |
-
});
|
311 |
-
}
|
312 |
-
</script>
|
1 |
+
<?php if ($display_goals_page === false) { ?>
|
2 |
+
<div>
|
3 |
+
<h4 style="margin-top: 30px;">
|
4 |
+
You cannot configure goals for this site, because there is no property chosen for it.
|
5 |
+
<a href="<?php echo admin_url('admin.php?page=gawd_settings#gawd_tracking_tab'); ?>"
|
6 |
+
style="cursor: pointer">
|
7 |
+
Click here
|
8 |
+
</a>
|
9 |
+
to set up a property.
|
10 |
+
</h4>
|
11 |
+
</div>
|
12 |
+
<?php
|
13 |
+
return;
|
14 |
+
} ?>
|
15 |
+
<div class="goal_wrap">
|
16 |
+
<div>
|
17 |
+
<h3 class="gawd_page_titles">Goal Management</h3>
|
18 |
+
<div class="gawd_refresh_button_wrapper">
|
19 |
+
<div class="gawd_info gawd_info_goal"
|
20 |
+
title="<?php esc_attr_e('Use this button to synchronize user data on this site with Google Analytics service. For example, after adding GA Account or changing web-properties.', 'gawd'); ?>">
|
21 |
+
</div>
|
22 |
+
<div class="gawd_account_button refresh_user_info refresh_user_info_goal" onclick="gawd_refresh_user_info(false,true)">
|
23 |
+
Refresh user info
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
<p style="width: 80%;">
|
28 |
+
You can set and manage goals for your website tracking. Select the View that you’re going to track and configure
|
29 |
+
these options based on the type of goal you would like to set.
|
30 |
+
</p>
|
31 |
+
<form method="post" id="gawd_goal_form">
|
32 |
+
<div class="gawd_goal_row">
|
33 |
+
<span class="gawd_goal_label">Website</span>
|
34 |
+
<span class="gawd_goal_input">
|
35 |
+
<select name="gawd_goal_profile" class="gawd_goal_profile">
|
36 |
+
<?php foreach ($profiles as $profile) {
|
37 |
+
$next_goal_id = (isset($next_goals_id[$profile['id']])) ? $next_goals_id[$profile['id']] : "1";
|
38 |
+
echo '<option data-next_id="' . $next_goal_id . '" value="' . $profile['id'] . '">' . $property['name'] . ' - ' . $profile['name'] . '</option>';
|
39 |
+
} ?>
|
40 |
+
</select>
|
41 |
+
</span>
|
42 |
+
<div class="gawd_info"
|
43 |
+
title="Choose the website, to which you would like to set Google Analytics Goals. "></div>
|
44 |
+
<div class='clear'></div>
|
45 |
+
</div>
|
46 |
+
<div class="gawd_goal_row">
|
47 |
+
<span class="gawd_goal_label">Name</span>
|
48 |
+
<span class="gawd_goal_input">
|
49 |
+
<input id="gawd_goal_name" name="gawd_goal_name" class="" type="text" value="">
|
50 |
+
</span>
|
51 |
+
<div class="gawd_info" title="Provide a name for this goal"></div>
|
52 |
+
<div class='clear'></div>
|
53 |
+
</div>
|
54 |
+
<div class="gawd_goal_row">
|
55 |
+
<span class="gawd_goal_label">Type</span>
|
56 |
+
<span class="gawd_goal_input">
|
57 |
+
<select name="gawd_goal_type" class="gawd_goal_type">
|
58 |
+
<option value="URL_DESTINATION">Destination</option>
|
59 |
+
<option value="VISIT_TIME_ON_SITE">Duration</option>
|
60 |
+
<option value="VISIT_NUM_PAGES">Pages/Screens per session</option>
|
61 |
+
<!-- <option value="EVENT">Event</option> -->
|
62 |
+
</select>
|
63 |
+
</span>
|
64 |
+
<div class="gawd_info"
|
65 |
+
title="Select its type (Destination, Duration, Pages/Screens per session or Event)."></div>
|
66 |
+
<div class='clear'></div>
|
67 |
+
</div>
|
68 |
+
<div class="gawd_goal_duration_wrap" id="gawd_goal_duration_wrap">
|
69 |
+
<div class="gawd_duration_label">Duration</div>
|
70 |
+
<div class="gawd_comparison_input">
|
71 |
+
<select name="gawd_goal_duration_comparison" class="gawd_goal_duration_comparison">
|
72 |
+
<option value="GREATER_THAN">Greater than</option>
|
73 |
+
</select>
|
74 |
+
</div>
|
75 |
+
<div class="gawd_duration">
|
76 |
+
<div class="time_wrap">
|
77 |
+
<!--<div class="time_label">Hour</div> -->
|
78 |
+
<div class="time_input"><input placeholder="hour" type="number" min='0' name="gawd_visit_hour"/>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<div class="time_wrap">
|
82 |
+
<!--<div class="time_label">Minute</div> -->
|
83 |
+
<div class="time_input"><input placeholder="min." type="number" min='0' name="gawd_visit_minute"/>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
<div class="time_wrap" id="time_wrap">
|
87 |
+
<!--<div class="time_label">Second</div> -->
|
88 |
+
<div class="time_input"><input placeholder="sec." type="number" min='0' name="gawd_visit_second"/>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
<div class='clear'></div>
|
92 |
+
</div>
|
93 |
+
<div class="gawd_info" style="margin-left: 15px"
|
94 |
+
title="Set a duration for this goal. For example, if you select 20 minutes, each time users spend 20 minutes or more on your site, it will be counted as goal completion."></div>
|
95 |
+
<div class='clear'></div>
|
96 |
+
</div>
|
97 |
+
<div class="gawd_page_sessions" id="gawd_page_sessions">
|
98 |
+
<div class="gawd_duration_label">Pages per session</div>
|
99 |
+
<div class="gawd_comparison_input">
|
100 |
+
<select name="gawd_goal_page_comparison" class="gawd_goal_duration_comparison">
|
101 |
+
<option value="GREATER_THAN">Greater than</option>
|
102 |
+
</select>
|
103 |
+
</div>
|
104 |
+
<div class="gawd_duration">
|
105 |
+
<div class="time_wrap">
|
106 |
+
<!--<div class="time_label">Hour</div> -->
|
107 |
+
<input type="number" min='0' name="gawd_page_sessions"/>
|
108 |
+
</div>
|
109 |
+
<div class='clear'></div>
|
110 |
+
</div>
|
111 |
+
<div class="gawd_info" style="margin-left: 15px"
|
112 |
+
title="Choose the number of pages/screens users should view to complete this goal."></div>
|
113 |
+
<div class='clear'></div>
|
114 |
+
</div>
|
115 |
+
<div class="gawd_page_destination" id="gawd_page_destination">
|
116 |
+
<div class="gawd_duration_label">Destination type</div>
|
117 |
+
<div class="gawd_url_comparison_input">
|
118 |
+
<select name="gawd_goal_page_destination_match" class="gawd_goal_duration_comparison">
|
119 |
+
<option value="EXACT">Equals to</option>
|
120 |
+
<option value="HEAD">Begins with</option>
|
121 |
+
<option value="REGEX">Regular expression</option>
|
122 |
+
</select>
|
123 |
+
</div>
|
124 |
+
<div class="gawd_info" style="margin-left: 8px;"
|
125 |
+
title="Set the destination of your goal. It can be equal to the specified value, as well as begin with it. You can also add a Regular Expression as destination value."></div>
|
126 |
+
<div class="gawd_destination_url">
|
127 |
+
<label for="gawd_case_sensitive" class="case_sensitive gawd_duration_label">URL</label>
|
128 |
+
<div class="time_wrap">
|
129 |
+
<div class="time_input"><input type="text" name="gawd_page_url"/></div>
|
130 |
+
</div>
|
131 |
+
<div class="gawd_info" title="Set the URL or Regular Expression of the destination."></div>
|
132 |
+
<div class='clear'></div>
|
133 |
+
</div>
|
134 |
+
<div class="gawd_destination_url">
|
135 |
+
<label for="gawd_case_sensitive" class="case_sensitive gawd_duration_label">Case-sensitive URL</label>
|
136 |
+
<div class="time_wrap">
|
137 |
+
<div class="onoffswitch" style="margin: 3px 0 0 6px;">
|
138 |
+
<input type="checkbox" name="url_case_sensitve" class="onoffswitch-checkbox"
|
139 |
+
id="gawd_case_sensitive">
|
140 |
+
<label class="onoffswitch-label" for="gawd_case_sensitive">
|
141 |
+
<span class="onoffswitch-inner"></span>
|
142 |
+
<span class="onoffswitch-switch"></span>
|
143 |
+
</label>
|
144 |
+
</div>
|
145 |
+
</div>
|
146 |
+
<div class="gawd_info" title="Enable this option to set destination URL to be case-sensitive."></div>
|
147 |
+
</div>
|
148 |
+
|
149 |
+
<div class='clear'></div>
|
150 |
+
</div>
|
151 |
+
<div class="gawd_buttons" id="goal_submit">
|
152 |
+
<input class="button_gawd" type="button" name="add_goal" value="Save"/>
|
153 |
+
</div>
|
154 |
+
<input type="hidden" name="gawd_next_goal_id" id="gawd_next_goal_id" value=""/>
|
155 |
+
</form>
|
156 |
+
<input type="hidden" id="gawd_refresh_user_info_transient"
|
157 |
+
value="<?php echo $refresh_user_info_transient; ?>"/>
|
158 |
+
<?php if (!empty($goals)) {
|
159 |
+
$counter = 0;
|
160 |
+
foreach ($goals as $profile_id => $profile_goals) { ?>
|
161 |
+
<table border="1" class="gawd_table" id="<?php echo $profile_id; ?>"
|
162 |
+
style="<?php echo(($counter != 0) ? 'display:none;' : ''); ?>">
|
163 |
+
<tr>
|
164 |
+
<th>ID</th>
|
165 |
+
<th>Name</th>
|
166 |
+
<th>Type</th>
|
167 |
+
<th>Match Type</th>
|
168 |
+
<th>Value</th>
|
169 |
+
</tr>
|
170 |
+
<?php
|
171 |
+
foreach ($profile_goals as $goal) {
|
172 |
+
$case_sensitive = $goal['caseSensitive'] ? ' - case sensitive' : '';
|
173 |
+
?>
|
174 |
+
<tr class="gawd_rows">
|
175 |
+
<td><?php echo $goal['id']; ?></td>
|
176 |
+
<td><?php echo $goal['name']; ?></td>
|
177 |
+
<td><?php echo $goal['type']; ?></td>
|
178 |
+
<td><?php echo ($goal['match_type'] !== 'GREATER_THAN') ? $goal['match_type'] : "Greater than"; ?></td>
|
179 |
+
<td><?php echo $goal['value'] . $case_sensitive; ?></td>
|
180 |
+
</tr>
|
181 |
+
<?php
|
182 |
+
}
|
183 |
+
?>
|
184 |
+
</table>
|
185 |
+
<?php $counter++;
|
186 |
+
}
|
187 |
+
} ?>
|
188 |
+
|
189 |
+
</div>
|
190 |
+
<script>
|
191 |
+
|
192 |
+
jQuery('.gawd_goal_type').on('change', function ()
|
193 |
+
{
|
194 |
+
if (jQuery('.gawd_goal_type :selected').val() == 'VISIT_TIME_ON_SITE') {
|
195 |
+
jQuery('.gawd_goal_duration_wrap').show();
|
196 |
+
jQuery('.gawd_page_sessions').hide();
|
197 |
+
jQuery('.gawd_page_destination').hide();
|
198 |
+
jQuery('.gawd_page_event').hide();
|
199 |
+
} else
|
200 |
+
if (jQuery('.gawd_goal_type :selected').val() == 'VISIT_NUM_PAGES') {
|
201 |
+
jQuery('.gawd_goal_duration_wrap').hide();
|
202 |
+
jQuery('.gawd_page_destination').hide();
|
203 |
+
jQuery('.gawd_page_event').hide();
|
204 |
+
jQuery('.gawd_page_sessions').show();
|
205 |
+
} else
|
206 |
+
if (jQuery('.gawd_goal_type :selected').val() == 'EVENT') {
|
207 |
+
jQuery('.gawd_goal_duration_wrap').hide();
|
208 |
+
jQuery('.gawd_page_sessions').hide();
|
209 |
+
jQuery('.gawd_page_destination').hide();
|
210 |
+
jQuery('.gawd_page_event').show();
|
211 |
+
} else {
|
212 |
+
jQuery('.gawd_goal_duration_wrap').hide();
|
213 |
+
jQuery('.gawd_page_sessions').hide();
|
214 |
+
jQuery('.gawd_page_event').hide();
|
215 |
+
jQuery('.gawd_page_destination').show();
|
216 |
+
}
|
217 |
+
});
|
218 |
+
|
219 |
+
jQuery('.button_gawd').on('click', function ()
|
220 |
+
{
|
221 |
+
var submit_form = true;
|
222 |
+
var gawd_goal_name = jQuery("#gawd_goal_name");
|
223 |
+
var gawd_goal_name = jQuery("#gawd_goal_name");
|
224 |
+
if (gawd_goal_name.val() === "") {
|
225 |
+
gawd_goal_name.addClass('gawd_invalid');
|
226 |
+
submit_form = false;
|
227 |
+
}
|
228 |
+
else
|
229 |
+
if (
|
230 |
+
(jQuery('input[name="gawd_page_sessions"]').val() === '' && jQuery('.gawd_goal_type :selected').val() == 'VISIT_NUM_PAGES') ||
|
231 |
+
(jQuery('input[name="gawd_page_url"]').val() === '' && jQuery('.gawd_goal_type :selected').val() == 'URL_DESTINATION') ||
|
232 |
+
((jQuery('input[name="gawd_visit_hour"]').val() === '' || jQuery('input[name="gawd_visit_minute"]').val() === '' || jQuery('input[name="gawd_visit_second"]').val() === '') && jQuery('.gawd_goal_type :selected').val() == 'VISIT_TIME_ON_SITE')) {
|
233 |
+
jQuery('input[name="gawd_page_url"]').addClass('gawd_invalid');
|
234 |
+
jQuery('input[name="gawd_page_sessions"]').addClass('gawd_invalid');
|
235 |
+
jQuery('input[name="gawd_visit_hour"]').addClass('gawd_invalid');
|
236 |
+
jQuery('input[name="gawd_visit_minute"]').addClass('gawd_invalid');
|
237 |
+
jQuery('input[name="gawd_visit_second"]').addClass('gawd_invalid');
|
238 |
+
submit_form = false;
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
gawd_goal_name.removeClass('gawd_invalid');
|
242 |
+
jQuery('input[name="gawd_page_url"]').removeClass('gawd_invalid');
|
243 |
+
jQuery('input[name="gawd_page_sessions"]').removeClass('gawd_invalid');
|
244 |
+
jQuery('input[name="gawd_visit_hour"]').removeClass('gawd_invalid');
|
245 |
+
jQuery('input[name="gawd_visit_minute"]').removeClass('gawd_invalid');
|
246 |
+
jQuery('input[name="gawd_visit_second"]').removeClass('gawd_invalid');
|
247 |
+
}
|
248 |
+
|
249 |
+
var table_id = jQuery('.gawd_goal_profile').val();
|
250 |
+
var next_id = jQuery('.gawd_goal_profile').find('option:selected').data('next_id');
|
251 |
+
|
252 |
+
if (jQuery('#' + table_id + ' .gawd_table tr').length - 1 >= 20 || next_id === "") {
|
253 |
+
alert('You have reached the maximum number of goals.')
|
254 |
+
return;
|
255 |
+
}
|
256 |
+
|
257 |
+
jQuery('#gawd_next_goal_id').val(next_id);
|
258 |
+
if (submit_form) {
|
259 |
+
gawd_save_goals();
|
260 |
+
return false;
|
261 |
+
}
|
262 |
+
});
|
263 |
+
|
264 |
+
jQuery('.gawd_goal_profile').on('change', function ()
|
265 |
+
{
|
266 |
+
jQuery('.gawd_table').each(function ()
|
267 |
+
{
|
268 |
+
jQuery(this).hide();
|
269 |
+
});
|
270 |
+
var id = jQuery(this).val();
|
271 |
+
jQuery('#' + id).show();
|
272 |
+
});
|
273 |
+
|
274 |
+
function gawd_save_goals()
|
275 |
+
{
|
276 |
+
|
277 |
+
var serialized_form = jQuery("#gawd_goal_form").serializeArray();
|
278 |
+
var form_data = {};
|
279 |
+
for (var i = 0; i < serialized_form.length; i++) {
|
280 |
+
form_data[serialized_form[i].name] = serialized_form[i].value;
|
281 |
+
}
|
282 |
+
|
283 |
+
var args = gawd_custom_ajax_args();
|
284 |
+
args.type = 'POST';
|
285 |
+
args.async = true;
|
286 |
+
args.data.gawd_action = "save_goals";
|
287 |
+
args.data.gawd_data = {
|
288 |
+
'form': form_data
|
289 |
+
};
|
290 |
+
|
291 |
+
var $loader_container = jQuery("#gawd_goal_form");
|
292 |
+
args.beforeSend = function ()
|
293 |
+
{
|
294 |
+
gawd_add_loader($loader_container);
|
295 |
+
};
|
296 |
+
|
297 |
+
args.success = function (response)
|
298 |
+
{
|
299 |
+
window.location.reload();
|
300 |
+
};
|
301 |
+
|
302 |
+
args.error = function ()
|
303 |
+
{
|
304 |
+
window.location.reload();
|
305 |
+
};
|
306 |
+
|
307 |
+
jQuery.ajax(args).done(function ()
|
308 |
+
{
|
309 |
+
gawd_remove_loader($loader_container);
|
310 |
+
});
|
311 |
+
}
|
312 |
+
</script>
|
admin/pages/licensing.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
<div id="featurs_tables">
|
2 |
-
<div id="featurs_table1">
|
3 |
-
<span>WordPress 3.5+ <?php _e("ready", 'gawd'); ?></span>
|
4 |
-
<span><?php _e("Overview reports", 'gawd'); ?></span>
|
5 |
-
<span><?php _e("Analytics on WordPress dashboard", 'gawd'); ?></span>
|
6 |
-
<span><?php _e("All Analytics reports", 'gawd'); ?></span>
|
7 |
-
<span><?php _e("Metrics report comparison", 'gawd'); ?></span>
|
8 |
-
<span><?php _e("Date range report comparison", 'gawd'); ?></span>
|
9 |
-
<span><?php _e("Line, Pie and Column chart reports", 'gawd'); ?></span>
|
10 |
-
<span><?php _e("CSV and PDF export", 'gawd'); ?></span>
|
11 |
-
<span><?php _e("Scheduled email notifications", 'gawd'); ?></span>
|
12 |
-
<span><?php _e("Page and post reports", 'gawd'); ?></span>
|
13 |
-
<span><?php _e("Frontend reports", 'gawd'); ?></span>
|
14 |
-
<span><?php _e("Google Analytics tracking code and options", 'gawd'); ?></span>
|
15 |
-
<span><?php _e("Goal management", 'gawd'); ?></span>
|
16 |
-
<span><?php _e("Google Analytics Filters management", 'gawd'); ?></span>
|
17 |
-
<span><?php _e("User and Role permissions to access reports", 'gawd'); ?></span>
|
18 |
-
<span><?php _e("Custom Dimensions", 'gawd'); ?></span>
|
19 |
-
<span><?php _e("Custom Reports", 'gawd'); ?></span>
|
20 |
-
<span><?php _e("Ecommerce reports", 'gawd'); ?></span>
|
21 |
-
<span><?php _e("Google AdSense report", 'gawd'); ?></span>
|
22 |
-
<span><?php _e("Google AdWords report", 'gawd'); ?></span>
|
23 |
-
<span><?php _e("Tracking exclusions by roles and users", 'gawd'); ?></span>
|
24 |
-
<span><?php _e("Google Analytics alerts", 'gawd'); ?></span>
|
25 |
-
<span><?php _e("Pushover notifications", 'gawd'); ?></span>
|
26 |
-
</div>
|
27 |
-
<div id="featurs_table2">
|
28 |
-
<span style="padding-top: 18px;height: 39px;"><?php _e("Free", 'gawd'); ?></span>
|
29 |
-
<span class="yes"></span>
|
30 |
-
<span class="yes"></span>
|
31 |
-
<span class="yes"></span>
|
32 |
-
<span class="yes"></span>
|
33 |
-
<span class="yes"></span>
|
34 |
-
<span class="yes"></span>
|
35 |
-
<span class="yes"></span>
|
36 |
-
<span class="yes"></span>
|
37 |
-
<span class="yes"></span>
|
38 |
-
<span class="yes"></span>
|
39 |
-
<span class="yes"></span>
|
40 |
-
<span class="yes"></span>
|
41 |
-
<span class="yes"></span>
|
42 |
-
<span class="yes"></span>
|
43 |
-
<span class="yes"></span>
|
44 |
-
<span class="no"></span>
|
45 |
-
<span class="no"></span>
|
46 |
-
<span class="no"></span>
|
47 |
-
<span class="no"></span>
|
48 |
-
<span class="no"></span>
|
49 |
-
<span class="no"></span>
|
50 |
-
<span class="no"></span>
|
51 |
-
<span class="no"></span>
|
52 |
-
</div>
|
53 |
-
<div id="featurs_table3">
|
54 |
-
<span><?php _e("Pro Version", 'gawd'); ?></span>
|
55 |
-
<span class="yes"></span>
|
56 |
-
<span class="yes"></span>
|
57 |
-
<span class="yes"></span>
|
58 |
-
<span class="yes"></span>
|
59 |
-
<span class="yes"></span>
|
60 |
-
<span class="yes"></span>
|
61 |
-
<span class="yes"></span>
|
62 |
-
<span class="yes"></span>
|
63 |
-
<span class="yes"></span>
|
64 |
-
<span class="yes"></span>
|
65 |
-
<span class="yes"></span>
|
66 |
-
<span class="yes"></span>
|
67 |
-
<span class="yes"></span>
|
68 |
-
<span class="yes"></span>
|
69 |
-
<span class="yes"></span>
|
70 |
-
<span class="yes"></span>
|
71 |
-
<span class="yes"></span>
|
72 |
-
<span class="yes"></span>
|
73 |
-
<span class="yes"></span>
|
74 |
-
<span class="yes"></span>
|
75 |
-
<span class="yes"></span>
|
76 |
-
<span class="yes"></span>
|
77 |
-
<span class="yes"></span>
|
78 |
-
</div>
|
79 |
</div>
|
1 |
+
<div id="featurs_tables">
|
2 |
+
<div id="featurs_table1">
|
3 |
+
<span>WordPress 3.5+ <?php _e("ready", 'gawd'); ?></span>
|
4 |
+
<span><?php _e("Overview reports", 'gawd'); ?></span>
|
5 |
+
<span><?php _e("Analytics on WordPress dashboard", 'gawd'); ?></span>
|
6 |
+
<span><?php _e("All Analytics reports", 'gawd'); ?></span>
|
7 |
+
<span><?php _e("Metrics report comparison", 'gawd'); ?></span>
|
8 |
+
<span><?php _e("Date range report comparison", 'gawd'); ?></span>
|
9 |
+
<span><?php _e("Line, Pie and Column chart reports", 'gawd'); ?></span>
|
10 |
+
<span><?php _e("CSV and PDF export", 'gawd'); ?></span>
|
11 |
+
<span><?php _e("Scheduled email notifications", 'gawd'); ?></span>
|
12 |
+
<span><?php _e("Page and post reports", 'gawd'); ?></span>
|
13 |
+
<span><?php _e("Frontend reports", 'gawd'); ?></span>
|
14 |
+
<span><?php _e("Google Analytics tracking code and options", 'gawd'); ?></span>
|
15 |
+
<span><?php _e("Goal management", 'gawd'); ?></span>
|
16 |
+
<span><?php _e("Google Analytics Filters management", 'gawd'); ?></span>
|
17 |
+
<span><?php _e("User and Role permissions to access reports", 'gawd'); ?></span>
|
18 |
+
<span><?php _e("Custom Dimensions", 'gawd'); ?></span>
|
19 |
+
<span><?php _e("Custom Reports", 'gawd'); ?></span>
|
20 |
+
<span><?php _e("Ecommerce reports", 'gawd'); ?></span>
|
21 |
+
<span><?php _e("Google AdSense report", 'gawd'); ?></span>
|
22 |
+
<span><?php _e("Google AdWords report", 'gawd'); ?></span>
|
23 |
+
<span><?php _e("Tracking exclusions by roles and users", 'gawd'); ?></span>
|
24 |
+
<span><?php _e("Google Analytics alerts", 'gawd'); ?></span>
|
25 |
+
<span><?php _e("Pushover notifications", 'gawd'); ?></span>
|
26 |
+
</div>
|
27 |
+
<div id="featurs_table2">
|
28 |
+
<span style="padding-top: 18px;height: 39px;"><?php _e("Free", 'gawd'); ?></span>
|
29 |
+
<span class="yes"></span>
|
30 |
+
<span class="yes"></span>
|
31 |
+
<span class="yes"></span>
|
32 |
+
<span class="yes"></span>
|
33 |
+
<span class="yes"></span>
|
34 |
+
<span class="yes"></span>
|
35 |
+
<span class="yes"></span>
|
36 |
+
<span class="yes"></span>
|
37 |
+
<span class="yes"></span>
|
38 |
+
<span class="yes"></span>
|
39 |
+
<span class="yes"></span>
|
40 |
+
<span class="yes"></span>
|
41 |
+
<span class="yes"></span>
|
42 |
+
<span class="yes"></span>
|
43 |
+
<span class="yes"></span>
|
44 |
+
<span class="no"></span>
|
45 |
+
<span class="no"></span>
|
46 |
+
<span class="no"></span>
|
47 |
+
<span class="no"></span>
|
48 |
+
<span class="no"></span>
|
49 |
+
<span class="no"></span>
|
50 |
+
<span class="no"></span>
|
51 |
+
<span class="no"></span>
|
52 |
+
</div>
|
53 |
+
<div id="featurs_table3">
|
54 |
+
<span><?php _e("Pro Version", 'gawd'); ?></span>
|
55 |
+
<span class="yes"></span>
|
56 |
+
<span class="yes"></span>
|
57 |
+
<span class="yes"></span>
|
58 |
+
<span class="yes"></span>
|
59 |
+
<span class="yes"></span>
|
60 |
+
<span class="yes"></span>
|
61 |
+
<span class="yes"></span>
|
62 |
+
<span class="yes"></span>
|
63 |
+
<span class="yes"></span>
|
64 |
+
<span class="yes"></span>
|
65 |
+
<span class="yes"></span>
|
66 |
+
<span class="yes"></span>
|
67 |
+
<span class="yes"></span>
|
68 |
+
<span class="yes"></span>
|
69 |
+
<span class="yes"></span>
|
70 |
+
<span class="yes"></span>
|
71 |
+
<span class="yes"></span>
|
72 |
+
<span class="yes"></span>
|
73 |
+
<span class="yes"></span>
|
74 |
+
<span class="yes"></span>
|
75 |
+
<span class="yes"></span>
|
76 |
+
<span class="yes"></span>
|
77 |
+
<span class="yes"></span>
|
78 |
+
</div>
|
79 |
</div>
|
admin/pages/location.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
<div class="gawd_wrapper" id="gawd_overview_location">
|
4 |
-
<div class="opacity_div_compact">
|
5 |
-
<div class="loading_div_compact">
|
6 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
7 |
-
</div>
|
8 |
-
</div>
|
9 |
-
<div class="gawd_data_table"><table class="display cell-border" width="100%"></table></div>
|
10 |
-
</div>
|
1 |
+
|
2 |
+
|
3 |
+
<div class="gawd_wrapper" id="gawd_overview_location">
|
4 |
+
<div class="opacity_div_compact">
|
5 |
+
<div class="loading_div_compact">
|
6 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>" style="margin-top: 200px; width:50px;">
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
<div class="gawd_data_table"><table class="display cell-border" width="100%"></table></div>
|
10 |
+
</div>
|
admin/pages/logs.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<style>
|
2 |
-
#gawd_logs_tb {
|
3 |
-
width: 97%;
|
4 |
-
/*text-align: center;*/
|
5 |
-
}
|
6 |
-
|
7 |
-
#gawd_logs_tb td {
|
8 |
-
border: 1px solid;
|
9 |
-
padding: 2px 0px 2px 7px;
|
10 |
-
}
|
11 |
-
|
12 |
-
#gawd_logs_tb td:nth-child(1) {
|
13 |
-
width: 80%;
|
14 |
-
}
|
15 |
-
|
16 |
-
#gawd_logs_tb td:nth-child(2) {
|
17 |
-
width: 15%;
|
18 |
-
}
|
19 |
-
|
20 |
-
#gawd_logs_tb td:nth-child(3) {
|
21 |
-
width: 2%;
|
22 |
-
}
|
23 |
-
</style>
|
24 |
-
<table id="gawd_logs_tb">
|
25 |
-
<thead>
|
26 |
-
<th>Fail</th>
|
27 |
-
<th>Log</th>
|
28 |
-
<th>Date</th>
|
29 |
-
</thead>
|
30 |
-
<tbody>
|
31 |
-
<?php foreach($logs as $log) { ?>
|
32 |
-
<tr>
|
33 |
-
<td><?php echo $log['log']; ?></td>
|
34 |
-
<td><?php echo $log['date']; ?></td>
|
35 |
-
<td><?php echo $log['fail'] ? '1' : "0"; ?></td>
|
36 |
-
</tr>
|
37 |
-
<?php } ?>
|
38 |
-
</tbody>
|
39 |
</table>
|
1 |
+
<style>
|
2 |
+
#gawd_logs_tb {
|
3 |
+
width: 97%;
|
4 |
+
/*text-align: center;*/
|
5 |
+
}
|
6 |
+
|
7 |
+
#gawd_logs_tb td {
|
8 |
+
border: 1px solid;
|
9 |
+
padding: 2px 0px 2px 7px;
|
10 |
+
}
|
11 |
+
|
12 |
+
#gawd_logs_tb td:nth-child(1) {
|
13 |
+
width: 80%;
|
14 |
+
}
|
15 |
+
|
16 |
+
#gawd_logs_tb td:nth-child(2) {
|
17 |
+
width: 15%;
|
18 |
+
}
|
19 |
+
|
20 |
+
#gawd_logs_tb td:nth-child(3) {
|
21 |
+
width: 2%;
|
22 |
+
}
|
23 |
+
</style>
|
24 |
+
<table id="gawd_logs_tb">
|
25 |
+
<thead>
|
26 |
+
<th>Fail</th>
|
27 |
+
<th>Log</th>
|
28 |
+
<th>Date</th>
|
29 |
+
</thead>
|
30 |
+
<tbody>
|
31 |
+
<?php foreach($logs as $log) { ?>
|
32 |
+
<tr>
|
33 |
+
<td><?php echo $log['log']; ?></td>
|
34 |
+
<td><?php echo $log['date']; ?></td>
|
35 |
+
<td><?php echo $log['fail'] ? '1' : "0"; ?></td>
|
36 |
+
</tr>
|
37 |
+
<?php } ?>
|
38 |
+
</tbody>
|
39 |
</table>
|
admin/pages/overview.php
CHANGED
@@ -1,78 +1,78 @@
|
|
1 |
-
|
2 |
-
<?php
|
3 |
-
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false );
|
4 |
-
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
|
5 |
-
$new_buttons_refresh = '<button data-hint="Click to refresh this report block." class="handlediv load_tooltip button-link gawd-refresh" type="button" id="{{refreshid}}">' . gawd_icons( 'dashicons-update' ) . '</button>';
|
6 |
-
$new_buttons_full = '<button data-hint="Click to navigate to Real Time report on your Reports page." class="handlediv load_tooltip button-link gawd-more" type="button" id="{{moreid}}">' . gawd_icons( 'dashicons-migrate' ) . '</button>';
|
7 |
-
|
8 |
-
function gawd_icons($dashicons) {
|
9 |
-
|
10 |
-
return '<img src="' . GAWD_URL . '/assets/' . $dashicons . '.png"/>';
|
11 |
-
}
|
12 |
-
?>
|
13 |
-
|
14 |
-
<?php //screen_icon('options-general'); //todo deprecated?>
|
15 |
-
<h2 style="margin-top:10px" class="gawd_page_titles"><?php echo get_admin_page_title(); ?></h2>
|
16 |
-
<div class="gawd_wrap">
|
17 |
-
<div class="gawd_row" style="float:left;width:35%; margin-bottom:0">
|
18 |
-
<div class="gawd_text" style="width: 20%;padding: 9px 12px 9px 14px;">
|
19 |
-
DATE RANGE
|
20 |
-
</div>
|
21 |
-
<div class="gawd_content load_tooltip" style="width: 42%;height: 22px;line-height: 22px;" id="gawd_content_range" data-hint="Choose a date range to display Google Analytics report. Select a predefined or custom period and click Apply.">
|
22 |
-
<div id="reportrange" class="pull-right" style="float:none !important">
|
23 |
-
<span></span> <b class="caret"></b>
|
24 |
-
</div>
|
25 |
-
<input type="hidden" id="gawd_start_end_date_compact"/>
|
26 |
-
</div>
|
27 |
-
<div class='clear'></div>
|
28 |
-
</div>
|
29 |
-
<div class="gawd_profiles" id="gawd_profile_wrapper" style="float:right;width: 63%; margin:0">
|
30 |
-
<form method="post" id="gawd_overview">
|
31 |
-
<select data-hint="Click to pick the website, overview reports of which you’d like to display." style="width: 41%;" class="gawd_profile_select load_tooltip" name="gawd_id" onchange="change_account(this)">
|
32 |
-
<?php
|
33 |
-
$gawd_last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
34 |
-
foreach ($profiles as $property_name => $property): ?>
|
35 |
-
<optgroup label="<?php echo $property_name; ?>">
|
36 |
-
<?php foreach ($property as $profile):
|
37 |
-
$webPropertyId = $profile['webPropertyId'];
|
38 |
-
$id = $profile['id'];
|
39 |
-
$name = $profile['name'];
|
40 |
-
$selected = '';
|
41 |
-
if($id == $gawd_last_viewed_profile['profile_id']){
|
42 |
-
$selected = 'selected="selected"';
|
43 |
-
}
|
44 |
-
?>
|
45 |
-
<option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name.' - '.$name ; ?></option>
|
46 |
-
<?php endforeach ?>
|
47 |
-
</optgroup>
|
48 |
-
<?php endforeach ?>
|
49 |
-
</select>
|
50 |
-
<div class="clear"></div>
|
51 |
-
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
52 |
-
</form>
|
53 |
-
</div>
|
54 |
-
<div class="clear"></div>
|
55 |
-
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
56 |
-
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
|
57 |
-
<div class="metabox-holder" >
|
58 |
-
<div class="postbox-container gawd_normal_metabox_conteiner" >
|
59 |
-
<?php do_meta_boxes( 'gawd_analytics', 'normal', '' ); ?>
|
60 |
-
</div>
|
61 |
-
<div class="postbox-container gawd_side_metabox_conteiner" >
|
62 |
-
<?php do_meta_boxes( 'gawd_analytics', 'side', '' ); ?>
|
63 |
-
</div>
|
64 |
-
</div>
|
65 |
-
</div>
|
66 |
-
|
67 |
-
<script>
|
68 |
-
function change_account(that){
|
69 |
-
jQuery('#web_property_name').val(jQuery(that).find(':selected').closest('optgroup').attr('label'));
|
70 |
-
jQuery('#gawd_overview').submit();
|
71 |
-
}
|
72 |
-
var buttons_refresh = '<?php echo $new_buttons_refresh; ?>';
|
73 |
-
var buttons_full = '<?php echo $new_buttons_full; ?>';
|
74 |
-
datepicker_js_compact();
|
75 |
-
|
76 |
-
</script>
|
77 |
-
|
78 |
|
1 |
+
|
2 |
+
<?php
|
3 |
+
wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false );
|
4 |
+
wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
|
5 |
+
$new_buttons_refresh = '<button data-hint="Click to refresh this report block." class="handlediv load_tooltip button-link gawd-refresh" type="button" id="{{refreshid}}">' . gawd_icons( 'dashicons-update' ) . '</button>';
|
6 |
+
$new_buttons_full = '<button data-hint="Click to navigate to Real Time report on your Reports page." class="handlediv load_tooltip button-link gawd-more" type="button" id="{{moreid}}">' . gawd_icons( 'dashicons-migrate' ) . '</button>';
|
7 |
+
|
8 |
+
function gawd_icons($dashicons) {
|
9 |
+
|
10 |
+
return '<img src="' . GAWD_URL . '/assets/' . $dashicons . '.png"/>';
|
11 |
+
}
|
12 |
+
?>
|
13 |
+
|
14 |
+
<?php //screen_icon('options-general'); //todo deprecated?>
|
15 |
+
<h2 style="margin-top:10px" class="gawd_page_titles"><?php echo get_admin_page_title(); ?></h2>
|
16 |
+
<div class="gawd_wrap">
|
17 |
+
<div class="gawd_row" style="float:left;width:35%; margin-bottom:0">
|
18 |
+
<div class="gawd_text" style="width: 20%;padding: 9px 12px 9px 14px;">
|
19 |
+
DATE RANGE
|
20 |
+
</div>
|
21 |
+
<div class="gawd_content load_tooltip" style="width: 42%;height: 22px;line-height: 22px;" id="gawd_content_range" data-hint="Choose a date range to display Google Analytics report. Select a predefined or custom period and click Apply.">
|
22 |
+
<div id="reportrange" class="pull-right" style="float:none !important">
|
23 |
+
<span></span> <b class="caret"></b>
|
24 |
+
</div>
|
25 |
+
<input type="hidden" id="gawd_start_end_date_compact"/>
|
26 |
+
</div>
|
27 |
+
<div class='clear'></div>
|
28 |
+
</div>
|
29 |
+
<div class="gawd_profiles" id="gawd_profile_wrapper" style="float:right;width: 63%; margin:0">
|
30 |
+
<form method="post" id="gawd_overview">
|
31 |
+
<select data-hint="Click to pick the website, overview reports of which you’d like to display." style="width: 41%;" class="gawd_profile_select load_tooltip" name="gawd_id" onchange="change_account(this)">
|
32 |
+
<?php
|
33 |
+
$gawd_last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
34 |
+
foreach ($profiles as $property_name => $property): ?>
|
35 |
+
<optgroup label="<?php echo $property_name; ?>">
|
36 |
+
<?php foreach ($property as $profile):
|
37 |
+
$webPropertyId = $profile['webPropertyId'];
|
38 |
+
$id = $profile['id'];
|
39 |
+
$name = $profile['name'];
|
40 |
+
$selected = '';
|
41 |
+
if($id == $gawd_last_viewed_profile['profile_id']){
|
42 |
+
$selected = 'selected="selected"';
|
43 |
+
}
|
44 |
+
?>
|
45 |
+
<option value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name.' - '.$name ; ?></option>
|
46 |
+
<?php endforeach ?>
|
47 |
+
</optgroup>
|
48 |
+
<?php endforeach ?>
|
49 |
+
</select>
|
50 |
+
<div class="clear"></div>
|
51 |
+
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
52 |
+
</form>
|
53 |
+
</div>
|
54 |
+
<div class="clear"></div>
|
55 |
+
<?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
56 |
+
<?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false ); ?>
|
57 |
+
<div class="metabox-holder" >
|
58 |
+
<div class="postbox-container gawd_normal_metabox_conteiner" >
|
59 |
+
<?php do_meta_boxes( 'gawd_analytics', 'normal', '' ); ?>
|
60 |
+
</div>
|
61 |
+
<div class="postbox-container gawd_side_metabox_conteiner" >
|
62 |
+
<?php do_meta_boxes( 'gawd_analytics', 'side', '' ); ?>
|
63 |
+
</div>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<script>
|
68 |
+
function change_account(that){
|
69 |
+
jQuery('#web_property_name').val(jQuery(that).find(':selected').closest('optgroup').attr('label'));
|
70 |
+
jQuery('#gawd_overview').submit();
|
71 |
+
}
|
72 |
+
var buttons_refresh = '<?php echo $new_buttons_refresh; ?>';
|
73 |
+
var buttons_full = '<?php echo $new_buttons_full; ?>';
|
74 |
+
datepicker_js_compact();
|
75 |
+
|
76 |
+
</script>
|
77 |
+
|
78 |
|
admin/pages/settings.php
CHANGED
@@ -1,1097 +1,1097 @@
|
|
1 |
-
<?php
|
2 |
-
$gawd_settings = get_option('gawd_settings');
|
3 |
-
$profiles = GAWD_helper::get_profiles();
|
4 |
-
|
5 |
-
$tabs = get_option('gawd_menu_items');
|
6 |
-
$current_user = get_current_user_id();
|
7 |
-
$saved_user_menues = get_option('gawd_menu_for_user');
|
8 |
-
$refresh_user_info_transient = get_site_transient('gawd_refresh_user_info');
|
9 |
-
|
10 |
-
$credentials = GAWD_helper::get_project_credentials();
|
11 |
-
|
12 |
-
|
13 |
-
$filters = array();//todo
|
14 |
-
|
15 |
-
$gawd_permissions = isset($gawd_settings['gawd_permissions']) ? implode(',', $gawd_settings['gawd_permissions']) : 'manage_options';
|
16 |
-
$gawd_excluded_users = isset($gawd_settings['gawd_excluded_users']) ? $gawd_settings['gawd_excluded_users'] : array();
|
17 |
-
$gawd_excluded_roles = isset($gawd_settings['gawd_excluded_roles']) ? $gawd_settings['gawd_excluded_roles'] : array();
|
18 |
-
$gawd_backend_roles = isset($gawd_settings['gawd_backend_roles']) ? implode(',', $gawd_settings['gawd_backend_roles']) : 'administrator';
|
19 |
-
$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? implode(',', $gawd_settings['gawd_frontend_roles']) : 'administrator';
|
20 |
-
$gawd_post_page_roles = isset($gawd_settings['gawd_post_page_roles']) ? implode(',', $gawd_settings['gawd_post_page_roles']) : 'administrator';
|
21 |
-
$gawd_file_formats = isset($gawd_settings['gawd_file_formats']) ? $gawd_settings['gawd_file_formats'] : '';
|
22 |
-
$adsense_acc_linking = isset($gawd_settings['adsense_acc_linking']) ? $gawd_settings['adsense_acc_linking'] : '';
|
23 |
-
$enable_hover_tooltip = isset($gawd_settings['enable_hover_tooltip']) ? $gawd_settings['enable_hover_tooltip'] : 'on';
|
24 |
-
$exclude_events = isset($gawd_settings['exclude_events']) ? $gawd_settings['exclude_events'] : '';
|
25 |
-
$enable_cross_domain = isset($gawd_settings['enable_cross_domain']) ? $gawd_settings['enable_cross_domain'] : '';
|
26 |
-
$default_date = isset($gawd_settings['default_date']) ? $gawd_settings['default_date'] : '';
|
27 |
-
$default_date_format = isset($gawd_settings['default_date_format']) ? $gawd_settings['default_date_format'] : '';
|
28 |
-
$post_page_chart = isset($gawd_settings['post_page_chart']) ? $gawd_settings['post_page_chart'] : '';
|
29 |
-
$roles = new WP_Roles();
|
30 |
-
$roles_changed = array();
|
31 |
-
$_roles_changed = array();
|
32 |
-
foreach ($roles->role_names as $key => $name) {
|
33 |
-
$_roles_changed['role_names'][$name] = $key;
|
34 |
-
}
|
35 |
-
foreach ($roles->role_names as $key => $name) {
|
36 |
-
if ($name == 'Administrator') {
|
37 |
-
$key = 'manage_options';
|
38 |
-
}
|
39 |
-
elseif ($name == 'Editor') {
|
40 |
-
$key = 'moderate_comments';
|
41 |
-
}
|
42 |
-
elseif ($name == 'Author') {
|
43 |
-
$key = 'publish_posts';
|
44 |
-
}
|
45 |
-
elseif ($name == 'Contributor') {
|
46 |
-
$key = 'edit_posts';
|
47 |
-
}
|
48 |
-
else {
|
49 |
-
$key = 'read';
|
50 |
-
}
|
51 |
-
$roles_changed['role_names'][$name] = $key;
|
52 |
-
}
|
53 |
-
|
54 |
-
$gawd_emails = get_option('gawd_emails_info');
|
55 |
-
|
56 |
-
$alerts_list = array();
|
57 |
-
$email_list = array();
|
58 |
-
|
59 |
-
if(is_array($gawd_emails)) {
|
60 |
-
foreach($gawd_emails as $key=>$email_info) {
|
61 |
-
if(isset($email_info['email_info']['other_info']['alert_data'])) {
|
62 |
-
$alerts_list[$key] = $email_info;
|
63 |
-
} else {
|
64 |
-
$email_list[$key] = $email_info;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
?>
|
70 |
-
|
71 |
-
<div id="gawd_body">
|
72 |
-
<div class="resp_menu">
|
73 |
-
<div class="menu_img"></div>
|
74 |
-
<div class="button_label">SETTINGS</div>
|
75 |
-
<div class="clear"></div>
|
76 |
-
</div>
|
77 |
-
<div class="gawd_menu_coteiner gawd_settings_menu_coteiner">
|
78 |
-
<ul class="gawd_menu_ul">
|
79 |
-
<li class="gawd_menu_li" id="gawd_authenicate">Authenticate</li>
|
80 |
-
<li class="gawd_menu_li" id="gawd_tracking">Tracking</li>
|
81 |
-
<?php if (GAWD_helper::gawd_has_property()) { ?>
|
82 |
-
<li class="gawd_menu_li" id="gawd_alerts">Alerts</li>
|
83 |
-
<li class="gawd_menu_li" id="gawd_pushover">Pushover</li>
|
84 |
-
<li class="gawd_menu_li" id="gawd_filters">Filters</li>
|
85 |
-
<li class="gawd_menu_li" id="gawd_emails">Emails</li>
|
86 |
-
<li class=" gawd_menu_li" id="gawd_advanced">Advanced</li>
|
87 |
-
<?php } ?>
|
88 |
-
</ul>
|
89 |
-
</div>
|
90 |
-
<div id="gawd_right_conteiner">
|
91 |
-
<h3 class="gawd_page_titles">Settings</h3>
|
92 |
-
|
93 |
-
<form method="post" id="gawd_form">
|
94 |
-
<div class="gawd_authenicate">
|
95 |
-
<div id="opacity_div"
|
96 |
-
style="display: none; background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
|
97 |
-
<div id="loading_div"
|
98 |
-
style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
|
99 |
-
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>"
|
100 |
-
style="margin-top: 200px; width:50px;">
|
101 |
-
</div>
|
102 |
-
<div id="gawd_auth_url_wrapper">
|
103 |
-
<div id="gawd_auth_url" style="cursor: pointer; margin: -10px 0 20px 0;">
|
104 |
-
<div style="color:#444;padding:5px 5px 5px 0">Press <b>Reauthenticate</b> button to
|
105 |
-
change your Google account.
|
106 |
-
</div>
|
107 |
-
<div class="gawd_auth_button" onclick="gawd_auth_popup(800,400)">REAUTHENTICATE</div>
|
108 |
-
</div>
|
109 |
-
<div class="gawd_refresh_button_wrapper">
|
110 |
-
<div class="gawd_account_button refresh_user_info" onclick="gawd_refresh_user_info(false,true)">
|
111 |
-
Refresh user info
|
112 |
-
</div>
|
113 |
-
<div class="gawd_info"
|
114 |
-
title="<?php esc_attr_e('Use this button to synchronize user data on this site with Google Analytics service. For example, after adding GA Account or changing web-properties.', 'gawd'); ?>"></div>
|
115 |
-
</div>
|
116 |
-
<div class="clear"></div>
|
117 |
-
</div>
|
118 |
-
<div id="gawd_auth_code">
|
119 |
-
<p style="margin:0;color: #444;">Paste the authentication code from the popup to this input.</p>
|
120 |
-
<input id="gawd_token" type="text">
|
121 |
-
<div id="gawd_auth_code_submit">SUBMIT</div>
|
122 |
-
</div>
|
123 |
-
|
124 |
-
<div class="gawd_own_wrap">
|
125 |
-
<?php if ($credentials['default'] === false) { ?>
|
126 |
-
<span>Authenticated with own project</span>
|
127 |
-
<?php }
|
128 |
-
else { ?>
|
129 |
-
<label for="gawd_own_project">
|
130 |
-
<input type="checkbox" <?php echo $credentials['default'] === false ? 'checked disabled' : ''; ?>
|
131 |
-
name="gawd_own_project" id="gawd_own_project"/>
|
132 |
-
<!-- <span>Use your own project</span>-->
|
133 |
-
<span>Authenticated with own project</span>
|
134 |
-
<div class="gawd_info"
|
135 |
-
title="Mark as checked to use your project, which you created on console.developers.google.com"></div>
|
136 |
-
</label>
|
137 |
-
<?php } ?>
|
138 |
-
<div class="own_inputs" <?php echo $credentials['default'] === false ? '' : 'style="display:none"'; ?>>
|
139 |
-
<div class="gawd_goal_row">
|
140 |
-
<div class="gawd_goal_label">Client ID</div>
|
141 |
-
<div class="gawd_goal_input">
|
142 |
-
<input type="text"
|
143 |
-
value="<?php echo (isset($credentials['project_id']) && $credentials['default'] === false) ? $credentials['project_id'] : ''; ?>"
|
144 |
-
name="gawd_own_client_id"/>
|
145 |
-
</div>
|
146 |
-
<div class="gawd_info"
|
147 |
-
title="Paste Client ID key. For more information about getting project keys please check the plugin User Guide."></div>
|
148 |
-
<div class='clear'></div>
|
149 |
-
</div>
|
150 |
-
<div class="gawd_goal_row">
|
151 |
-
<div class="gawd_goal_label">Client Secret</div>
|
152 |
-
<div class="gawd_goal_input">
|
153 |
-
<input type="text"
|
154 |
-
value="<?php echo (isset($credentials['project_secret']) && $credentials['default'] === false) ? $credentials['project_secret'] : ''; ?>"
|
155 |
-
name="gawd_own_client_secret"/>
|
156 |
-
</div>
|
157 |
-
<div class="gawd_info"
|
158 |
-
title="Paste Client Secret key. For more information about getting project keys please check the User Guide."></div>
|
159 |
-
<div class='clear'></div>
|
160 |
-
</div>
|
161 |
-
</div>
|
162 |
-
<?php if ($credentials['default'] === false) { ?>
|
163 |
-
<a class="gawd_reset_credentials" id="gawd_reset_credentials">Stop using own project</a>
|
164 |
-
<?php } ?>
|
165 |
-
</div>
|
166 |
-
</div>
|
167 |
-
<div class="gawd_tracking">
|
168 |
-
<?php include_once 'tracking.php'; ?>
|
169 |
-
</div>
|
170 |
-
<?php if (GAWD_helper::gawd_has_property()) { ?>
|
171 |
-
<div class="gawd_alerts">
|
172 |
-
<div class="gawd_goal_row">
|
173 |
-
<span class="gawd_goal_label">View</span>
|
174 |
-
<span class="gawd_goal_input">
|
175 |
-
<select name="gawd_alert_view" id="gawd_alert_view">
|
176 |
-
<?php foreach ($profiles as $property_name => $property): ?>
|
177 |
-
<optgroup label="<?php echo $property_name; ?>">
|
178 |
-
<?php foreach ($property as $profile):
|
179 |
-
$webPropertyId = $profile['webPropertyId'];
|
180 |
-
$id = $profile['id'];
|
181 |
-
$name = $profile['name'];
|
182 |
-
$selected = '';
|
183 |
-
if ($id == $gawd_user_data['profile_id']) {
|
184 |
-
$selected = 'selected="selected"';
|
185 |
-
}
|
186 |
-
?>
|
187 |
-
<option
|
188 |
-
value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
189 |
-
<?php endforeach ?>
|
190 |
-
</optgroup>
|
191 |
-
<?php endforeach ?>
|
192 |
-
</select>
|
193 |
-
</span>
|
194 |
-
<div class="gawd_info"
|
195 |
-
title="Choose the website, to which you would like to set Google Analytics Alerts."></div>
|
196 |
-
<div class='clear'></div>
|
197 |
-
</div>
|
198 |
-
<div class="gawd_goal_row">
|
199 |
-
<span class="gawd_goal_label">Name</span>
|
200 |
-
<span class="gawd_goal_input">
|
201 |
-
<input id="gawd_goal_name" name="gawd_alert_name" class="" type="text" value="">
|
202 |
-
</span>
|
203 |
-
<div class="gawd_info" title="Provide a title for the alert notification."></div>
|
204 |
-
<div class='clear'></div>
|
205 |
-
</div>
|
206 |
-
<div class="gawd_goal_row">
|
207 |
-
<span class="gawd_goal_label">Period</span>
|
208 |
-
<span class="gawd_goal_input">
|
209 |
-
<select name="gawd_alert_period">
|
210 |
-
<option value="daily">Day</option>
|
211 |
-
<option value="gawd_weekly">Week</option>
|
212 |
-
<option value="gawd_monthly">Month</option>
|
213 |
-
</select>
|
214 |
-
</span>
|
215 |
-
<div class="gawd_info"
|
216 |
-
title="Select period (daily, weekly or monthly) for receiving alerts."></div>
|
217 |
-
<div class='clear'></div>
|
218 |
-
</div>
|
219 |
-
<div class="gawd_goal_row">
|
220 |
-
<span class="gawd_goal_label">Email</span>
|
221 |
-
<span class="gawd_goal_input">
|
222 |
-
<input type="text" id="gawd_alert_emails" name="gawd_alert_emails"/>
|
223 |
-
</span>
|
224 |
-
<div class="gawd_info"
|
225 |
-
title="Provide the email address, to which you’d like to receive alerts."></div>
|
226 |
-
<div class='clear'></div>
|
227 |
-
</div>
|
228 |
-
<div id="alert_condition"> ALERT CONDITIONS</div>
|
229 |
-
<div class="gawd_goal_row">
|
230 |
-
<span class="gawd_goal_label">When</span>
|
231 |
-
<span class="gawd_goal_input">
|
232 |
-
<select name="gawd_alert_metric" id="gawd_alert_metric" class="gawd_alert_metric">
|
233 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
234 |
-
<option value="users"><?php echo __('Users', 'gawd'); ?></option>
|
235 |
-
<option value="bounceRate"><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
236 |
-
<option value="avgSessionDuration"><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
237 |
-
</select>
|
238 |
-
</span>
|
239 |
-
<div class="gawd_info"
|
240 |
-
title="Pick a metric (Sessions, Users, Bounces or Session Duration) to evaluate for notification alerts."></div>
|
241 |
-
<div class='clear'></div>
|
242 |
-
</div>
|
243 |
-
<div class="gawd_goal_row">
|
244 |
-
<span class="gawd_goal_label">Condition</span>
|
245 |
-
<span class="gawd_goal_input">
|
246 |
-
<select name="gawd_alert_condition" id="gawd_alert_condition" class="gawd_alert_condition">
|
247 |
-
<option value="less"><?php echo __('Is less than', 'gawd'); ?></option>
|
248 |
-
<option value="greater"><?php echo __('Is greater than', 'gawd'); ?></option>
|
249 |
-
</select>
|
250 |
-
</span>
|
251 |
-
<div class="gawd_info"
|
252 |
-
title="Select a condition (Is less than or Is greater than) for alert emails."></div>
|
253 |
-
<div class='clear'></div>
|
254 |
-
</div>
|
255 |
-
<div class="gawd_goal_row">
|
256 |
-
<span class="gawd_goal_label">Value:</span>
|
257 |
-
<span class="gawd_goal_input">
|
258 |
-
<div class="time_input"><input type="number" min='0' value="0" name="gawd_alert_value"/></div>
|
259 |
-
</span>
|
260 |
-
<div class="gawd_info"
|
261 |
-
title="Define value for the metric, based on which notifications will be sent."></div>
|
262 |
-
<div class='clear'></div>
|
263 |
-
</div>
|
264 |
-
<?php
|
265 |
-
|
266 |
-
if ($alerts_list) {
|
267 |
-
?>
|
268 |
-
<table border="1" class="gawd_table">
|
269 |
-
<tr>
|
270 |
-
<th>Name</th>
|
271 |
-
<th>Period</th>
|
272 |
-
<th>Condition</th>
|
273 |
-
<th>View</th>
|
274 |
-
<th>Action</th>
|
275 |
-
</tr>
|
276 |
-
<?php
|
277 |
-
foreach ($alerts_list as $key => $alert_data) {
|
278 |
-
$alert = $alert_data['email_info']['other_info']['alert_data'];
|
279 |
-
$condition = $alert['condition'] == 'less' ? ' is less then ' : ' greater than ';
|
280 |
-
$metric = $alert['metric'];
|
281 |
-
|
282 |
-
if($metric == 'bounceRate'){
|
283 |
-
$metric = 'Bounce Rate';
|
284 |
-
}else if($metric == 'avgSessionDuration'){
|
285 |
-
$metric = 'Avg Session Duration';
|
286 |
-
}else {
|
287 |
-
$metric = ucfirst($metric);
|
288 |
-
}
|
289 |
-
|
290 |
-
$period = (strpos($alert['period'], 'gawd') > -1) ? substr($alert['period'], 5) : $alert['period'];
|
291 |
-
$period = ucfirst($period);
|
292 |
-
?>
|
293 |
-
<tr>
|
294 |
-
<td><?php echo $alert['name']; ?></td>
|
295 |
-
<td><?php echo $period; ?></td>
|
296 |
-
<td><?php echo $metric . $condition . $alert['value']; ?></td>
|
297 |
-
<td><?php echo $alert['alert_view_name']; ?></td>
|
298 |
-
<td><a href="" class="gawd_remove_emails"
|
299 |
-
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $key; ?>','gawd_email_remove');return false;} else {return false;}">remove</a>
|
300 |
-
</td>
|
301 |
-
</tr>
|
302 |
-
<?php
|
303 |
-
}
|
304 |
-
?>
|
305 |
-
</table>
|
306 |
-
<?php
|
307 |
-
}
|
308 |
-
?>
|
309 |
-
<input type="hidden" name="alert_view_name" id='alert_view_name'/>
|
310 |
-
</div>
|
311 |
-
<div class="gawd_pushover">
|
312 |
-
<div class="gawd_goal_row">
|
313 |
-
<span class="gawd_goal_label">View</span>
|
314 |
-
<span class="gawd_goal_input">
|
315 |
-
<select name="gawd_pushover_view" id="gawd_pushover_view">
|
316 |
-
<?php foreach ($profiles as $property_name => $property): ?>
|
317 |
-
<optgroup label="<?php echo $property_name; ?>">
|
318 |
-
<?php foreach ($property as $profile):
|
319 |
-
$webPropertyId = $profile['webPropertyId'];
|
320 |
-
$id = $profile['id'];
|
321 |
-
$name = $profile['name'];
|
322 |
-
$selected = '';
|
323 |
-
if ($id == $gawd_user_data['profile_id']) {
|
324 |
-
$selected = 'selected="selected"';
|
325 |
-
}
|
326 |
-
?>
|
327 |
-
<option
|
328 |
-
value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
329 |
-
<?php endforeach ?>
|
330 |
-
</optgroup>
|
331 |
-
<?php endforeach ?>
|
332 |
-
</select>
|
333 |
-
</span>
|
334 |
-
<div class="gawd_info"
|
335 |
-
title="Choose the website, to which you would like to set Pushover Notifications. "></div>
|
336 |
-
<div class='clear'></div>
|
337 |
-
</div>
|
338 |
-
<div class="gawd_goal_row">
|
339 |
-
<span class="gawd_goal_label">Name</span>
|
340 |
-
<span class="gawd_goal_input">
|
341 |
-
<input id="gawd_goal_name" name="gawd_pushover_name" class="gawd_pushover_name_fild" type="text" value="">
|
342 |
-
</span>
|
343 |
-
<div class="gawd_info" title="Provide a title for Pushover alert."></div>
|
344 |
-
<div class='clear'></div>
|
345 |
-
</div>
|
346 |
-
<div class="gawd_goal_row">
|
347 |
-
<span class="gawd_goal_label">Period</span>
|
348 |
-
<span class="gawd_goal_input">
|
349 |
-
<select name="gawd_pushover_period">
|
350 |
-
<option value="daily">Day</option>
|
351 |
-
<option value="gawd_weekly">Week</option>
|
352 |
-
<option value="gawd_monthly">Month</option>
|
353 |
-
</select>
|
354 |
-
</span>
|
355 |
-
<div class="gawd_info"
|
356 |
-
title="Select period (daily, weekly or monthly) for receiving Pushover notifications."></div>
|
357 |
-
<div class='clear'></div>
|
358 |
-
</div>
|
359 |
-
<div class="gawd_goal_row">
|
360 |
-
<span class="gawd_goal_label">User Key</span>
|
361 |
-
<span class="gawd_goal_input">
|
362 |
-
<input type="text" class="gawd_pushover_user_keys_fild" name="gawd_pushover_user_keys"/>
|
363 |
-
</span>
|
364 |
-
<div class="gawd_info"
|
365 |
-
title="Provide the User Key of your Pushover account, to which you’d like to get notification alerts."></div>
|
366 |
-
<div class='clear'></div>
|
367 |
-
</div>
|
368 |
-
<div id="pushover_condition">PUSHOVER CONDITIONS</div>
|
369 |
-
<div class="gawd_goal_row">
|
370 |
-
<span class="gawd_goal_label">When</span>
|
371 |
-
<span class="gawd_goal_input">
|
372 |
-
<select name="gawd_pushover_metric" id="gawd_pushover_metric" class="gawd_pushover_metric">
|
373 |
-
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
374 |
-
<option value="users"><?php echo __('Users', 'gawd'); ?></option>
|
375 |
-
<option value="bounceRate"><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
376 |
-
<option value="sessionDuration"><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
377 |
-
</select>
|
378 |
-
</span>
|
379 |
-
<div class="gawd_info"
|
380 |
-
title="Pick a metric (Sessions, Users, Bounces or Session Duration) to evaluate for Pushover notifications."></div>
|
381 |
-
<div class='clear'></div>
|
382 |
-
</div>
|
383 |
-
<div class="gawd_goal_row">
|
384 |
-
<span class="gawd_goal_label">Condition</span>
|
385 |
-
<span class="gawd_goal_input">
|
386 |
-
<select name="gawd_pushover_condition" id="gawd_pushover_condition" class="gawd_pushover_condition">
|
387 |
-
<option value="less"><?php echo __('Is less than', 'gawd'); ?></option>
|
388 |
-
<option value="greater"><?php echo __('Is greater than', 'gawd'); ?></option>
|
389 |
-
</select>
|
390 |
-
</span>
|
391 |
-
<div class="gawd_info"
|
392 |
-
title="Select a condition (Is less than or Is greater than) for the notifications."></div>
|
393 |
-
<div class='clear'></div>
|
394 |
-
</div>
|
395 |
-
<div class="gawd_goal_row">
|
396 |
-
<span class="gawd_goal_label">Value:</span>
|
397 |
-
<span class="gawd_goal_input">
|
398 |
-
<div class="time_input"><input type="number" min='0' value="0" name="gawd_pushover_value"/></div>
|
399 |
-
</span>
|
400 |
-
<div class="gawd_info"
|
401 |
-
title="Define value for the metric, based on which notifications will be sent."></div>
|
402 |
-
<div class='clear'></div>
|
403 |
-
</div>
|
404 |
-
<?php
|
405 |
-
$pushovers = get_option('gawd_pushovers');
|
406 |
-
|
407 |
-
if ($pushovers) {
|
408 |
-
?>
|
409 |
-
<table border="1" class="gawd_table">
|
410 |
-
<tr>
|
411 |
-
<th>Name</th>
|
412 |
-
<th>Period</th>
|
413 |
-
<th>Condition</th>
|
414 |
-
<th>View</th>
|
415 |
-
<th>Action</th>
|
416 |
-
</tr>
|
417 |
-
<?php
|
418 |
-
foreach ($pushovers as $key => $pushover) {
|
419 |
-
$condition = $pushover['condition'] == 'less' ? ' is less then ' : ' greater than ';
|
420 |
-
?>
|
421 |
-
<tr data-key="<?php echo $key + 1; ?>">
|
422 |
-
<td><?php echo $pushover['name']; ?></td>
|
423 |
-
<td><?php echo strpos($pushover['period'], 'gawd') > -1 ? substr($pushover['period'], 5) : $pushover['period']; ?></td>
|
424 |
-
<td><?php echo $pushover['metric'] . $condition . $pushover['value']; ?></td>
|
425 |
-
<td><?php echo $pushover['pushover_view_name']; ?></td>
|
426 |
-
<td><a href="" class="gawd_pushover_remove"
|
427 |
-
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $key + 1; ?>','gawd_pushover_remove');return false;} else {return false;}">remove</a>
|
428 |
-
</td>
|
429 |
-
</tr>
|
430 |
-
<?php
|
431 |
-
}
|
432 |
-
?>
|
433 |
-
</table>
|
434 |
-
<?php
|
435 |
-
}
|
436 |
-
?>
|
437 |
-
<input type="hidden" name="pushover_view_name" id='pushover_view_name'/>
|
438 |
-
</div>
|
439 |
-
<div class="gawd_filters">
|
440 |
-
<div class="gawd_goal_row">
|
441 |
-
<span class="gawd_goal_label">View</span>
|
442 |
-
<span class="gawd_goal_input">
|
443 |
-
|
444 |
-
<select title="Click to pick the website, filters of which you’d like to display." name="gawd_profile_id"
|
445 |
-
onchange="change_filter_account(this)">
|
446 |
-
<?php
|
447 |
-
foreach ($profiles as $property_name => $property): ?>
|
448 |
-
<optgroup label="<?php echo $property_name; ?>">
|
449 |
-
<?php foreach ($property as $profile):
|
450 |
-
$webPropertyId = $profile['webPropertyId'];
|
451 |
-
$id = $profile['id'];
|
452 |
-
$name = $profile['name'];
|
453 |
-
$selected = '';
|
454 |
-
if ($id == $gawd_user_data['profile_id']) {
|
455 |
-
$selected = 'selected="selected"';
|
456 |
-
$filter_account_name = $property_name;
|
457 |
-
}
|
458 |
-
?>
|
459 |
-
<option
|
460 |
-
value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
461 |
-
<?php endforeach ?>
|
462 |
-
</optgroup>
|
463 |
-
<?php endforeach ?>
|
464 |
-
</select>
|
465 |
-
<input type="hidden" name='account_name' id='account_name'/>
|
466 |
-
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
467 |
-
</span>
|
468 |
-
<div class="gawd_info"
|
469 |
-
title="Select the website, for which you would like to configure this filter."></div>
|
470 |
-
<div class='clear'></div>
|
471 |
-
</div>
|
472 |
-
<div class="gawd_goal_row">
|
473 |
-
<span class="gawd_goal_label">Name</span>
|
474 |
-
<span class="gawd_goal_input">
|
475 |
-
<input id="gawd_goal_name " class="gawd_filter_name_fild" name="gawd_filter_name" type="text">
|
476 |
-
</span>
|
477 |
-
<div class="gawd_info" title="Write a title for the filter."></div>
|
478 |
-
<div class='clear'></div>
|
479 |
-
</div>
|
480 |
-
<div class="gawd_goal_row">
|
481 |
-
<span class="gawd_goal_label">Type</span>
|
482 |
-
<span class="gawd_goal_input">
|
483 |
-
<select name="gawd_filter_type" id="gawd_filter_type">
|
484 |
-
<option data-name="IP" value="GEO_IP_ADDRESS">Exclude Traffic From IP Address</option>
|
485 |
-
<option data-name="Country" value="GEO_COUNTRY">Exclude Traffic From Country</option>
|
486 |
-
<option data-name="Region" value="GEO_REGION">Exclude Traffic From Region</option>
|
487 |
-
<option data-name="City" value="GEO_CITY">Exclude Traffic From City</option>
|
488 |
-
</select>
|
489 |
-
</span>
|
490 |
-
<div class="gawd_info"
|
491 |
-
title="Choose a type for tracking exclusions: IP address, Country, Region or City."></div>
|
492 |
-
<div class='clear'></div>
|
493 |
-
</div>
|
494 |
-
<div class="gawd_goal_row" id="gawd_filter_value_cont">
|
495 |
-
<span class="gawd_goal_label" id="gawd_filter_name">IP</span>
|
496 |
-
<span class="gawd_goal_input">
|
497 |
-
<div class="time_input"><input id="gawd_filter_value" type="text" name="gawd_filter_value"/></div>
|
498 |
-
</span>
|
499 |
-
<div class="gawd_info" title="Enter the IP address to filter from Google Analytics tracking."></div>
|
500 |
-
<div class='clear'></div>
|
501 |
-
</div>
|
502 |
-
<?php
|
503 |
-
if (!empty($filters)) {
|
504 |
-
?>
|
505 |
-
<table border="1" class="gawd_table">
|
506 |
-
<tr>
|
507 |
-
<th>Name</th>
|
508 |
-
<th>Type</th>
|
509 |
-
<th>Value</th>
|
510 |
-
<th>View</th>
|
511 |
-
<th>Action</th>
|
512 |
-
|
513 |
-
</tr>
|
514 |
-
<?php
|
515 |
-
foreach ($filters as $filter) {
|
516 |
-
$filter_type = 'Not Supported';
|
517 |
-
$filter_value = $filter['value'] != "" ? $filter['value'] : 'Not Suported';
|
518 |
-
if ($filter['type'] == "GEO_COUNTRY") {
|
519 |
-
$filter_type = 'Exclude Traffic From Country';
|
520 |
-
}
|
521 |
-
elseif ($filter['type'] == "GEO_REGION") {
|
522 |
-
$filter_type = 'Exclude Traffic From Region';
|
523 |
-
}
|
524 |
-
elseif ($filter['type'] == "GEO_CITY") {
|
525 |
-
$filter_type = 'Exclude Traffic From City';
|
526 |
-
}
|
527 |
-
elseif ($filter['type'] == "GEO_IP_ADDRESS") {
|
528 |
-
$filter_type = 'Exclude Traffic From IP Address';
|
529 |
-
}
|
530 |
-
?>
|
531 |
-
<tr data-key="<?php echo $filter['id']; ?>">
|
532 |
-
<td><?php echo $filter['name']; ?></td>
|
533 |
-
<td><?php echo $filter_type; ?></td>
|
534 |
-
<td><?php echo $filter_value; ?></td>
|
535 |
-
<td><?php echo $filter['view']; ?></td>
|
536 |
-
<td><a href="" class="gawd_filter_remove"
|
537 |
-
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $filter['id']; ?>','gawd_filter_remove');return false;} else {return false;}">remove</a>
|
538 |
-
</td>
|
539 |
-
</tr>
|
540 |
-
<?php
|
541 |
-
}
|
542 |
-
?>
|
543 |
-
</table>
|
544 |
-
<?php
|
545 |
-
}
|
546 |
-
else {
|
547 |
-
echo 'There is no data for this view.';
|
548 |
-
}
|
549 |
-
?>
|
550 |
-
</div>
|
551 |
-
<div class="gawd_emails">
|
552 |
-
<!-- FOR DEBUG -->
|
553 |
-
<div style="display: none !important;">
|
554 |
-
<?php echo 'Next :' . date('Y-m-d H:i:s', get_option('gawd_next_mail_date')); ?>
|
555 |
-
</div>
|
556 |
-
<?php
|
557 |
-
|
558 |
-
if ($email_list) {
|
559 |
-
?>
|
560 |
-
<table border="1" class="gawd_table">
|
561 |
-
<tr>
|
562 |
-
<th>Subject</th>
|
563 |
-
<th>Frequency</th>
|
564 |
-
<th>Next Date</th>
|
565 |
-
<th>Recipients</th>
|
566 |
-
<th>Website</th>
|
567 |
-
<th>Action</th>
|
568 |
-
</tr>
|
569 |
-
<?php
|
570 |
-
foreach ($email_list as $key => $email) {
|
571 |
-
$period = str_replace('gawd_', '', $email['email_info']['period']);
|
572 |
-
?>
|
573 |
-
<tr>
|
574 |
-
<td><?php echo $email['email_info']['subject']; ?></td>
|
575 |
-
<td><?php echo ucfirst($period); ?></td>
|
576 |
-
<td><?php echo date('Y-m-d H:i', $email['next_date']); ?></td>
|
577 |
-
<td><span class="gawd_break"><?php echo $email['email_info']['email_to']; ?></span></td>
|
578 |
-
<td><span class="gawd_break"><?php echo GAWD_helper::get_account_name_by_profile_id($email['email_info']['view_id']); ?></span></td>
|
579 |
-
<td><a href="" class="gawd_remove_emails"
|
580 |
-
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $key; ?>','gawd_email_remove');return false;} else {return false;}">remove</a>
|
581 |
-
</td>
|
582 |
-
</tr>
|
583 |
-
<?php
|
584 |
-
}
|
585 |
-
?>
|
586 |
-
</table>
|
587 |
-
<?php
|
588 |
-
}
|
589 |
-
else {
|
590 |
-
echo '<a href="' . admin_url() . 'admin.php?page=gawd_reports">You can setup sending e-mail to recipients for any report.</a>';
|
591 |
-
}
|
592 |
-
?>
|
593 |
-
</div>
|
594 |
-
<div class="gawd_advanced">
|
595 |
-
<div class="settings_row">
|
596 |
-
<div class="onoffswitch">
|
597 |
-
<input type="checkbox" name="gawd_show_in_dashboard" class="onoffswitch-checkbox"
|
598 |
-
id="gawd_show_in_dashboard" <?php echo isset($gawd_settings['gawd_show_in_dashboard']) && 'on' == $gawd_settings['gawd_show_in_dashboard'] ? 'checked' : ''; ?>>
|
599 |
-
<label class="onoffswitch-label" for="gawd_show_in_dashboard">
|
600 |
-
<span class="onoffswitch-inner"></span>
|
601 |
-
<span class="onoffswitch-switch"></span>
|
602 |
-
</label>
|
603 |
-
</div>
|
604 |
-
<div class="gawd_info"
|
605 |
-
title="Enable this option to display Google Analytics overview report on WordPress Dashboard."></div>
|
606 |
-
<div class="onoffswitch_text">
|
607 |
-
Analytics on WordPress Dashboard
|
608 |
-
</div>
|
609 |
-
<div class="clear"></div>
|
610 |
-
</div>
|
611 |
-
<div class="settings_row">
|
612 |
-
<div class="onoffswitch">
|
613 |
-
<input type="checkbox" name="enable_hover_tooltip" class="onoffswitch-checkbox"
|
614 |
-
id="enable_hover_tooltip" <?php echo $enable_hover_tooltip != '' ? 'checked' : ''; ?>>
|
615 |
-
<label class="onoffswitch-label" for="enable_hover_tooltip">
|
616 |
-
<span class="onoffswitch-inner"></span>
|
617 |
-
<span class="onoffswitch-switch"></span>
|
618 |
-
</label>
|
619 |
-
</div>
|
620 |
-
<div class="gawd_info"
|
621 |
-
title="Click to enable/disable help text for 10Web Analytics reports."></div>
|
622 |
-
<div class="onoffswitch_text">
|
623 |
-
Enable reports tooltips
|
624 |
-
</div>
|
625 |
-
<div class="clear"></div>
|
626 |
-
</div>
|
627 |
-
<div class="settings_row">
|
628 |
-
<div class="onoffswitch onoffswitch_disabled">
|
629 |
-
<input disabled type="checkbox" name="adsense_acc_linking" class="onoffswitch-checkbox"
|
630 |
-
id="adsense_acc_linking" <?php echo $adsense_acc_linking != '' ? 'checked' : ''; ?>>
|
631 |
-
<label class="onoffswitch-label" for="adsense_acc_linking">
|
632 |
-
<span class="onoffswitch-inner"></span>
|
633 |
-
<span class="onoffswitch-switch"></span>
|
634 |
-
</label>
|
635 |
-
</div>
|
636 |
-
<div class="gawd_info"
|
637 |
-
title="Turn this option on to get AdSense tracking reports. Make sure to link your Google AdSense to Google Analytics first (find out more in User Guide)"></div>
|
638 |
-
<div class="onoffswitch_text">
|
639 |
-
Enable AdSense link tracking
|
640 |
-
<a target="_blank" href="https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin" class="gawd_pro"> ( This feature is available in 10Web Analytics Premium. )</a>
|
641 |
-
</div>
|
642 |
-
<div class="clear"></div>
|
643 |
-
</div>
|
644 |
-
<div class="settings_row">
|
645 |
-
<div class="onoffswitch">
|
646 |
-
<input type="checkbox" name="post_page_chart" class="onoffswitch-checkbox"
|
647 |
-
id="post_page_chart" <?php echo $post_page_chart != '' ? 'checked' : ''; ?>>
|
648 |
-
<label class="onoffswitch-label" for="post_page_chart">
|
649 |
-
<span class="onoffswitch-inner"></span>
|
650 |
-
<span class="onoffswitch-switch"></span>
|
651 |
-
</label>
|
652 |
-
</div>
|
653 |
-
<div class="gawd_info"
|
654 |
-
title="Enable this option to display individual page and post reports on frontend and backend."></div>
|
655 |
-
<div class="onoffswitch_text">
|
656 |
-
Enable reports on posts/pages (frontend and backend)
|
657 |
-
</div>
|
658 |
-
<div class="clear"></div>
|
659 |
-
</div>
|
660 |
-
<div class="settings_row">
|
661 |
-
<div class="onoffswitch">
|
662 |
-
<input type="checkbox" name="exclude_events" class="onoffswitch-checkbox"
|
663 |
-
id="exclude_events" <?php echo $exclude_events != '' ? 'checked' : ''; ?>>
|
664 |
-
<label class="onoffswitch-label" for="exclude_events">
|
665 |
-
<span class="onoffswitch-inner"></span>
|
666 |
-
<span class="onoffswitch-switch"></span>
|
667 |
-
</label>
|
668 |
-
</div>
|
669 |
-
<div class="gawd_info"
|
670 |
-
title="For example, watching a video is a non-interactive event, whereas submitting a form is interactive. Enable this option to filter non-interactive events while calculating bounce-rate."></div>
|
671 |
-
<div class="onoffswitch_text">
|
672 |
-
Exclude non-interactive events from bounce-rate calculation
|
673 |
-
</div>
|
674 |
-
<div class="clear"></div>
|
675 |
-
</div>
|
676 |
-
<div class="settings_row">
|
677 |
-
<div class="onoffswitch">
|
678 |
-
<input type="checkbox" name="enable_cross_domain" class="onoffswitch-checkbox"
|
679 |
-
id="enable_cross_domain" <?php echo $enable_cross_domain != '' ? 'checked' : ''; ?>>
|
680 |
-
<label class="onoffswitch-label" for="enable_cross_domain">
|
681 |
-
<span class="onoffswitch-inner"></span>
|
682 |
-
<span class="onoffswitch-switch"></span>
|
683 |
-
</label>
|
684 |
-
</div>
|
685 |
-
<div class="gawd_info"
|
686 |
-
title="Enable Cross domain tracking to let Google Analytics see similar activities on two related websites as single session."></div>
|
687 |
-
<div class="onoffswitch_text">
|
688 |
-
Enable Cross Domain Tracking
|
689 |
-
</div>
|
690 |
-
<div class="clear"></div>
|
691 |
-
</div>
|
692 |
-
<?php
|
693 |
-
$cross_dom_show = $enable_cross_domain == '' ? 'style="display:none"' : '';
|
694 |
-
?>
|
695 |
-
<div id="cross_domains" class="gawd_goal_row" <?php echo $cross_dom_show; ?>>
|
696 |
-
<span class="gawd_goal_label">Cross Domains</span>
|
697 |
-
<span class="gawd_goal_input">
|
698 |
-
<div class="time_input">
|
699 |
-
<?php $gawd_settings_cross_domains = get_option("gawd_settings");
|
700 |
-
if (isset($gawd_settings_cross_domains) && isset($gawd_settings_cross_domains["cross_domains"])) {
|
701 |
-
$gawd_settings_cross_domains = $gawd_settings_cross_domains["cross_domains"];
|
702 |
-
}
|
703 |
-
else {
|
704 |
-
$gawd_settings_cross_domains = "";
|
705 |
-
}
|
706 |
-
?>
|
707 |
-
<input type="text" value="<?php echo $gawd_settings_cross_domains; ?>" name="cross_domains">
|
708 |
-
</div>
|
709 |
-
</span>
|
710 |
-
<div class="gawd_info"
|
711 |
-
title="Provide cross domain links separated by commas. The links should have the following format: http://example.com"></div>
|
712 |
-
<div class="clear"></div>
|
713 |
-
</div>
|
714 |
-
|
715 |
-
<div class="gawd_goal_row">
|
716 |
-
<?php $gawd_settings_site_speed_rate = get_option("gawd_settings");
|
717 |
-
if (isset($gawd_settings_site_speed_rate) && isset($gawd_settings_site_speed_rate["site_speed_rate"])) {
|
718 |
-
$gawd_settings_site_speed_rate = intval($gawd_settings_site_speed_rate["site_speed_rate"]);
|
719 |
-
}
|
720 |
-
else {
|
721 |
-
$gawd_settings_site_speed_rate = 1;
|
722 |
-
}
|
723 |
-
?>
|
724 |
-
<span class="gawd_goal_label">Site Speed SR (%)</span>
|
725 |
-
<span class="gawd_goal_input">
|
726 |
-
<div class="time_input"><input value="<?php echo $gawd_settings_site_speed_rate; ?>" type="number" min="1"
|
727 |
-
name="site_speed_rate"></div>
|
728 |
-
</span>
|
729 |
-
<div class="gawd_info"
|
730 |
-
title="Define the percentage of users, which activity should be evaluated for Site Speed report."></div>
|
731 |
-
<div class="clear"></div>
|
732 |
-
</div>
|
733 |
-
<div class="gawd_goal_row">
|
734 |
-
<div class="gawd_goal_label">Plugin settings permissions</div>
|
735 |
-
<div class="checkbox_wrap">
|
736 |
-
<div class="time_wrap gawd_permissions"><span data-attribute="manage_options"
|
737 |
-
class="gawd_permission">Administrator</span>
|
738 |
-
</div>
|
739 |
-
<?php
|
740 |
-
if ($gawd_permissions != '') {
|
741 |
-
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_permissions)) as $key => $_roles) {
|
742 |
-
if ($key == 'Administrator') {
|
743 |
-
continue;
|
744 |
-
}
|
745 |
-
?>
|
746 |
-
<div class="time_wrap gawd_permissions"><span data-attribute="<?php echo $_roles; ?>"
|
747 |
-
class="gawd_permission"><?php echo $key; ?></span><span
|
748 |
-
class="remove_gawd_permission gawd_remove">X</span></div>
|
749 |
-
<?php
|
750 |
-
}
|
751 |
-
}
|
752 |
-
?>
|
753 |
-
<input type="button" id="open_gawd_permissions" class="gawd_chose_btn button_gawd"
|
754 |
-
value="Choose"/>
|
755 |
-
<div class='clear'></div>
|
756 |
-
</div>
|
757 |
-
<div class="gawd_info"
|
758 |
-
title="Select user roles that have an access to change settings of the plugin. Only Administrator users can view it by default."></div>
|
759 |
-
<div class='clear'></div>
|
760 |
-
</div>
|
761 |
-
<div class="gawd_goal_row">
|
762 |
-
<div class="gawd_goal_label">Reports permissions</div>
|
763 |
-
<div class="checkbox_wrap">
|
764 |
-
<div class="time_wrap dashboard_report_permissions"><span data-attribute="administrator"
|
765 |
-
class="dashboard_report_permission">Administrator</span>
|
766 |
-
</div>
|
767 |
-
<?php
|
768 |
-
if ($gawd_backend_roles != '') {
|
769 |
-
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_backend_roles)) as $key => $roles) {
|
770 |
-
if ($roles == 'administrator') {
|
771 |
-
continue;
|
772 |
-
}
|
773 |
-
?>
|
774 |
-
<div class="time_wrap dashboard_report_permissions"><span
|
775 |
-
data-attribute="<?php echo $roles; ?>"
|
776 |
-
class="dashboard_report_permission"><?php echo $key; ?></span><span
|
777 |
-
class="remove_dashboard_report_permission gawd_remove">X</span></div>
|
778 |
-
<?php
|
779 |
-
}
|
780 |
-
}
|
781 |
-
?>
|
782 |
-
<input type="button" id="open_dashboard_report_permissions" class="gawd_chose_btn button_gawd"
|
783 |
-
value="Choose"/>
|
784 |
-
<div class='clear'></div>
|
785 |
-
</div>
|
786 |
-
<div class="gawd_info"
|
787 |
-
title="Select user roles, that have an access to view analytics reports in admin area."></div>
|
788 |
-
<div class='clear'></div>
|
789 |
-
</div>
|
790 |
-
<div class="gawd_goal_row">
|
791 |
-
<div class="gawd_goal_label">Post/Page report permissions</div>
|
792 |
-
<div class="checkbox_wrap">
|
793 |
-
<div class="time_wrap gawd_post_page_roles"><span data-attribute="administrator"
|
794 |
-
class="gawd_post_page_role">Administrator</span>
|
795 |
-
</div>
|
796 |
-
<?php
|
797 |
-
if ($gawd_post_page_roles != '') {
|
798 |
-
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_post_page_roles)) as $key => $roles) {
|
799 |
-
if ($roles == 'administrator') {
|
800 |
-
continue;
|
801 |
-
}
|
802 |
-
?>
|
803 |
-
<div class="time_wrap gawd_post_page_roles"><span data-attribute="<?php echo $roles; ?>"
|
804 |
-
class="gawd_post_page_role"><?php echo $key; ?></span><span
|
805 |
-
class="remove_post_page_role gawd_remove">X</span></div>
|
806 |
-
<?php
|
807 |
-
}
|
808 |
-
}
|
809 |
-
?>
|
810 |
-
<input type="button" id="post_page_report_permissions" class="gawd_chose_btn button_gawd"
|
811 |
-
value="Choose"/>
|
812 |
-
<div class='clear'></div>
|
813 |
-
</div>
|
814 |
-
<div class="gawd_info"
|
815 |
-
title="Select user roles, which will have access to view reports of posts and pages."></div>
|
816 |
-
<div class='clear'></div>
|
817 |
-
</div>
|
818 |
-
<div class="gawd_goal_row">
|
819 |
-
<div class="gawd_goal_label">Frontend report permissions</div>
|
820 |
-
<div class="checkbox_wrap">
|
821 |
-
<div class="time_wrap frontend_report_roles"><span data-attribute="administrator"
|
822 |
-
class="frontend_report_role">Administrator</span>
|
823 |
-
</div>
|
824 |
-
<?php
|
825 |
-
if ($gawd_frontend_roles != '') {
|
826 |
-
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_frontend_roles)) as $key => $roles) {
|
827 |
-
if ($roles == 'administrator') {
|
828 |
-
continue;
|
829 |
-
}
|
830 |
-
?>
|
831 |
-
<div class="time_wrap frontend_report_roles"><span data-attribute="<?php echo $roles; ?>"
|
832 |
-
class="frontend_report_role"><?php echo $key; ?></span><span
|
833 |
-
class="remove_frontend_report_role gawd_remove">X</span></div>
|
834 |
-
<?php
|
835 |
-
}
|
836 |
-
}
|
837 |
-
?>
|
838 |
-
<input type="button" id="open_frontend_report_permissions" class="gawd_chose_btn button_gawd"
|
839 |
-
value="Choose"/>
|
840 |
-
<div class='clear'></div>
|
841 |
-
</div>
|
842 |
-
<div class="gawd_info"
|
843 |
-
title="Select user roles, which will have access to view reports from frontend of your website."></div>
|
844 |
-
<div class='clear'></div>
|
845 |
-
</div>
|
846 |
-
<?php /*todo remove default_date_format*/ ?>
|
847 |
-
<div class="gawd_goal_row" style="display: none;">
|
848 |
-
<span class="gawd_goal_label">Date format</span>
|
849 |
-
<span class="gawd_goal_input">
|
850 |
-
<select name="default_date_format" id="default_date_format">
|
851 |
-
<option <?php selected($default_date_format, 'ymd_with_week'); ?> value="ymd_with_week">l, Y-m-d</option>
|
852 |
-
<option <?php selected($default_date_format, 'ymd_without_week'); ?>
|
853 |
-
value="ymd_without_week">Y-m-d</option>
|
854 |
-
<option <?php selected($default_date_format, 'month_name_with_week'); ?> value="month_name_with_week">l, F d, Y</option>
|
855 |
-
<option <?php selected($default_date_format, 'month_name_without_week'); ?>
|
856 |
-
value="month_name_without_week">F d, Y</option>
|
857 |
-
</select>
|
858 |
-
</span>
|
859 |
-
<div class="gawd_info" title="Choose the date format"></div>
|
860 |
-
<div class='clear'></div>
|
861 |
-
</div>
|
862 |
-
<div class="gawd_goal_row">
|
863 |
-
<span class="gawd_goal_label">Default date range</span>
|
864 |
-
<span class="gawd_goal_input">
|
865 |
-
<select name="default_date" id="default_date">
|
866 |
-
<option id='gawd_last_30days' <?php selected($default_date, 'last_30days'); ?> value="last_30days">Last 30 Days</option>
|
867 |
-
<option id='gawd_last_7days' <?php selected($default_date, 'last_7days'); ?> value="last_7days">Last 7 Days</option>
|
868 |
-
<option id='gawd_last_week' <?php selected($default_date, 'last_week'); ?>
|
869 |
-
value="last_week">Last Week</option>
|
870 |
-
<option id='gawd_this_month' <?php selected($default_date, 'this_month'); ?>
|
871 |
-
value="this_month">This Month</option>
|
872 |
-
<option id='gawd_last_month' <?php selected($default_date, 'last_month'); ?>
|
873 |
-
value="last_month">Last Month</option>
|
874 |
-
<option id='gawd_today' <?php selected($default_date, 'today'); ?> value="today">Today</option>
|
875 |
-
<option id='gawd_yesterday' <?php selected($default_date, 'yesterday'); ?>
|
876 |
-
value="yesterday">Yesterday</option>
|
877 |
-
</select>
|
878 |
-
</span>
|
879 |
-
<div class="gawd_info"
|
880 |
-
title="Choose the initial time period, which will be applied to all reports as their date range."></div>
|
881 |
-
<div class='clear'></div>
|
882 |
-
</div>
|
883 |
-
</div>
|
884 |
-
<?php } ?>
|
885 |
-
<div class="gawd_submit">
|
886 |
-
<input type="button" class="button_gawd" id="gawd_settings_button" value="Save"/>
|
887 |
-
<input type="button" style="display:none;" class="button_gawd" id="gawd_settings_logout"
|
888 |
-
value="Logout"/>
|
889 |
-
</div>
|
890 |
-
<input type='hidden' name="gawd_alert_remove" id="gawd_alert_remove"/>
|
891 |
-
<input type='hidden' name="gawd_menu_remove" id="gawd_menu_remove"/>
|
892 |
-
<input type='hidden' name="gawd_pushover_remove" id="gawd_pushover_remove"/>
|
893 |
-
<input type='hidden' name="gawd_email_remove" id="gawd_email_remove"/>
|
894 |
-
<input type='hidden' name="gawd_filter_remove" id="gawd_filter_remove"/>
|
895 |
-
<input type='hidden' name="gawd_settings_tab" id="gawd_settings_tab"/>
|
896 |
-
<input type='hidden' name="settings_submit" id="gawd_settings_submit"/>
|
897 |
-
<input type='hidden' name="gawd_settings_logout" id="gawd_settings_logout_val"/>
|
898 |
-
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_fild'); ?>
|
899 |
-
|
900 |
-
<div class="gawd_permissions_popup_overlay"></div>
|
901 |
-
<div class="gawd_permissions_popup">
|
902 |
-
<div class="close_btn_cont">
|
903 |
-
<div class="gawd_permission_popup_btn">X</div>
|
904 |
-
</div>
|
905 |
-
<div class="gawd_permissions_popup_content">
|
906 |
-
</div>
|
907 |
-
<div class="add_btn_cont">
|
908 |
-
<input type="button" class="button_gawd" id="add_roles" value="Add"/>
|
909 |
-
</div>
|
910 |
-
</div>
|
911 |
-
<input type='hidden' name="gawd_backend_roles" id="gawd_backend_roles"
|
912 |
-
value="<?php echo $gawd_backend_roles; ?>"/>
|
913 |
-
<input type='hidden' name="gawd_frontend_roles" id="gawd_frontend_roles"
|
914 |
-
value="<?php echo $gawd_frontend_roles; ?>"/>
|
915 |
-
<input type='hidden' name="gawd_post_page_roles" id="gawd_post_page_roles"
|
916 |
-
value="<?php echo $gawd_post_page_roles; ?>"/>
|
917 |
-
<input type='hidden' name="gawd_permissions" id="gawd_permissions"
|
918 |
-
value="<?php echo $gawd_permissions; ?>"/>
|
919 |
-
<input type="hidden" id="gawd_refresh_user_info_transient"
|
920 |
-
value="<?php echo $refresh_user_info_transient; ?>"/>
|
921 |
-
</form>
|
922 |
-
</div>
|
923 |
-
|
924 |
-
<div class="clear"></div>
|
925 |
-
</div>
|
926 |
-
<?php GAWD_helper::print_pro_popup(); ?>
|
927 |
-
<script>
|
928 |
-
jQuery('.gawd_chose_btn').on('click', function ()
|
929 |
-
{
|
930 |
-
permissions_popup_content(jQuery(this).attr('id'))
|
931 |
-
});
|
932 |
-
|
933 |
-
function permissions_popup_content(id)
|
934 |
-
{
|
935 |
-
var roles = <?php echo json_encode(new WP_Roles());?>;
|
936 |
-
var inp_id = 0;
|
937 |
-
var html = '';
|
938 |
-
var popup_overlay = 'gawd_permissions_popup_overlay';
|
939 |
-
var popup_body = 'gawd_permissions_popup';
|
940 |
-
var popup_btn = 'gawd_permission_popup_btn';
|
941 |
-
var add_role = 'add_roles';
|
942 |
-
var permissions_array = '';
|
943 |
-
jQuery("." + popup_body).fadeIn('fast');
|
944 |
-
jQuery("." + popup_overlay).fadeIn('fast');
|
945 |
-
|
946 |
-
if (id == "open_dashboard_report_permissions") {
|
947 |
-
permissions_array = 'gawd_backend_roles[]';
|
948 |
-
var permissions_for = 'gawd_backend_roles';
|
949 |
-
var open_popup_btn = 'open_dashboard_report_permissions';
|
950 |
-
var removed_roles = 'dashboard_report_permissions';
|
951 |
-
var remove_role = 'remove_dashboard_report_permission';
|
952 |
-
var role_value = 'dashboard_report_permission';
|
953 |
-
}
|
954 |
-
else
|
955 |
-
if (id == "open_frontend_report_permissions") {
|
956 |
-
permissions_array = 'gawd_frontend_roles[]';
|
957 |
-
var permissions_for = 'frontend_report_permissions';
|
958 |
-
var open_popup_btn = 'open_frontend_report_permissions';
|
959 |
-
var removed_roles = 'frontend_report_roles';
|
960 |
-
var remove_role = 'remove_frontend_report_role';
|
961 |
-
var role_value = 'frontend_report_role';
|
962 |
-
}
|
963 |
-
else
|
964 |
-
if (id == "post_page_report_permissions") {
|
965 |
-
permissions_array = 'gawd_post_page_roles[]';
|
966 |
-
var permissions_for = 'gawd_post_page_roles';
|
967 |
-
var open_popup_btn = 'post_page_report_permissions';
|
968 |
-
var removed_roles = 'gawd_post_page_roles';
|
969 |
-
var remove_role = 'remove_post_page_role';
|
970 |
-
var role_value = 'gawd_post_page_role';
|
971 |
-
}
|
972 |
-
else
|
973 |
-
if (id == "open_gawd_permissions") {
|
974 |
-
permissions_array = 'gawd_permissions[]';
|
975 |
-
var permissions_for = 'gawd_post_page_roles';
|
976 |
-
var open_popup_btn = 'open_gawd_permissions';
|
977 |
-
var removed_roles = 'gawd_permissions';
|
978 |
-
var remove_role = 'remove_gawd_permission';
|
979 |
-
var role_value = 'gawd_permission';
|
980 |
-
}
|
981 |
-
var check = [];
|
982 |
-
|
983 |
-
jQuery("." + role_value).each(function ()
|
984 |
-
{
|
985 |
-
check.push(jQuery(this).data('attribute'));
|
986 |
-
});
|
987 |
-
html += '<table border="1" class="gawd_table" id="' + id + '_table">';
|
988 |
-
html += '<tr><th>Name</th><th>Action</th></tr>';
|
989 |
-
for (key in roles.role_names) {
|
990 |
-
inp_id++;
|
991 |
-
var disabled = key == "administrator" || key == 'Administrator' ? "disabled" : "";
|
992 |
-
var checked = check.indexOf(key) > -1 || key == 'administrator' ? 'checked' : '';
|
993 |
-
var value = key;
|
994 |
-
var name = roles.role_names[key];
|
995 |
-
html += '<tr><td><label for="' + permissions_for + inp_id + '">' + name + '</label></td>';
|
996 |
-
html += '<td><input id="' + permissions_for + inp_id + '"' + disabled + ' class="gawd_perm" type="checkbox"' + checked + ' value="' + value + '"/></td></tr>';
|
997 |
-
}
|
998 |
-
html += '</table>';
|
999 |
-
jQuery('.gawd_permissions_popup_content').html(html);
|
1000 |
-
jQuery('.gawd_perm').on('click', function ()
|
1001 |
-
{
|
1002 |
-
if (jQuery(this).attr('checked') == 'checked') {
|
1003 |
-
jQuery(this).closest('tr').prevAll().find(".gawd_perm").attr('checked', true);
|
1004 |
-
}
|
1005 |
-
})
|
1006 |
-
popup_overlay = "." + popup_overlay;
|
1007 |
-
popup_btn = "." + popup_btn;
|
1008 |
-
popup_body = "." + popup_body;
|
1009 |
-
open_popup_btn = "#" + open_popup_btn;
|
1010 |
-
add_role = "#" + add_role;
|
1011 |
-
jQuery(popup_overlay + ', ' + popup_btn).on('click', function ()
|
1012 |
-
{
|
1013 |
-
jQuery(popup_body).fadeOut('fast');
|
1014 |
-
jQuery(popup_overlay).fadeOut('fast');
|
1015 |
-
});
|
1016 |
-
jQuery(add_role).unbind("click");
|
1017 |
-
jQuery(add_role).on('click', function (event)
|
1018 |
-
{
|
1019 |
-
event.preventDefault();
|
1020 |
-
jQuery(popup_body).fadeOut('fast');
|
1021 |
-
jQuery(popup_overlay).fadeOut('fast');
|
1022 |
-
var span = '';
|
1023 |
-
var display_name = "";
|
1024 |
-
var value = [];
|
1025 |
-
jQuery("#" + id + "_table input[type='checkbox']:checked").each(function ()
|
1026 |
-
{
|
1027 |
-
value.push(jQuery(this).val());
|
1028 |
-
display_name = jQuery(this).closest('tr').find('label').html();
|
1029 |
-
jQuery("." + removed_roles).remove();
|
1030 |
-
span += '<div class="time_wrap ' + removed_roles + '"><span data-attribute="' + jQuery(this).val() + '" class="' + role_value + '">' + display_name + '</span>';
|
1031 |
-
if (display_name.toLowerCase() != 'administrator') {
|
1032 |
-
span += '<span class="' + remove_role + '">X</span>'
|
1033 |
-
}
|
1034 |
-
span += '</div>';
|
1035 |
-
});
|
1036 |
-
|
1037 |
-
jQuery('#' + permissions_array.replace('[]', '')).val(value.join());
|
1038 |
-
jQuery(open_popup_btn).before(span);
|
1039 |
-
jQuery("." + remove_role).on('click', function ()
|
1040 |
-
{
|
1041 |
-
var find = jQuery(this).closest('.time_wrap').find("." + role_value).html();
|
1042 |
-
jQuery(this).closest('div').remove();
|
1043 |
-
|
1044 |
-
jQuery(popup_body + " .gawd_table input[type='checkbox']:checked").each(function ()
|
1045 |
-
{
|
1046 |
-
if (jQuery(this).val() == find) {
|
1047 |
-
jQuery(this).removeAttr('checked');
|
1048 |
-
}
|
1049 |
-
});
|
1050 |
-
var value = [];
|
1051 |
-
jQuery("." + role_value).each(function ()
|
1052 |
-
{
|
1053 |
-
value.push(jQuery(this).attr('data-attribute'));
|
1054 |
-
});
|
1055 |
-
jQuery('#' + permissions_array.replace('[]', '')).val(value.join());
|
1056 |
-
})
|
1057 |
-
});
|
1058 |
-
|
1059 |
-
jQuery("." + removed_roles).on('click', function ()
|
1060 |
-
{
|
1061 |
-
var find = jQuery(this).closest('.time_wrap').find(role_value).html();
|
1062 |
-
jQuery(this).closest('div').remove();
|
1063 |
-
|
1064 |
-
jQuery(popup_body + " .gawd_table input[type='checkbox']:checked").each(function ()
|
1065 |
-
{
|
1066 |
-
if (jQuery(this).val() == find) {
|
1067 |
-
jQuery(this).removeAttr('checked');
|
1068 |
-
}
|
1069 |
-
});
|
1070 |
-
var value = [];
|
1071 |
-
jQuery("." + role_value).each(function ()
|
1072 |
-
{
|
1073 |
-
value.push(jQuery(this).attr('data-attribute'));
|
1074 |
-
});
|
1075 |
-
jQuery('#' + permissions_array.replace('[]', '')).val(value.join());
|
1076 |
-
})
|
1077 |
-
}
|
1078 |
-
|
1079 |
-
jQuery(".gawd_remove").on('click', function ()
|
1080 |
-
{
|
1081 |
-
var id = jQuery(this).closest('.time_wrap').attr('class').split(' ')[1];
|
1082 |
-
jQuery(this).closest('div').remove();
|
1083 |
-
var value = [];
|
1084 |
-
jQuery('.' + id.substring(0, id.length - 1)).each(function ()
|
1085 |
-
{
|
1086 |
-
value.push(jQuery(this).attr('data-attribute'));
|
1087 |
-
});
|
1088 |
-
if (id == 'dashboard_report_permissions') {
|
1089 |
-
id = 'gawd_backend_roles';
|
1090 |
-
} else
|
1091 |
-
if (id == "frontend_report_roles") {
|
1092 |
-
id = "gawd_frontend_roles";
|
1093 |
-
}
|
1094 |
-
jQuery('#' + id).val(value.join());
|
1095 |
-
})
|
1096 |
-
</script>
|
1097 |
-
|
1 |
+
<?php
|
2 |
+
$gawd_settings = get_option('gawd_settings');
|
3 |
+
$profiles = GAWD_helper::get_profiles();
|
4 |
+
|
5 |
+
$tabs = get_option('gawd_menu_items');
|
6 |
+
$current_user = get_current_user_id();
|
7 |
+
$saved_user_menues = get_option('gawd_menu_for_user');
|
8 |
+
$refresh_user_info_transient = get_site_transient('gawd_refresh_user_info');
|
9 |
+
|
10 |
+
$credentials = GAWD_helper::get_project_credentials();
|
11 |
+
|
12 |
+
|
13 |
+
$filters = array();//todo
|
14 |
+
|
15 |
+
$gawd_permissions = isset($gawd_settings['gawd_permissions']) ? implode(',', $gawd_settings['gawd_permissions']) : 'manage_options';
|
16 |
+
$gawd_excluded_users = isset($gawd_settings['gawd_excluded_users']) ? $gawd_settings['gawd_excluded_users'] : array();
|
17 |
+
$gawd_excluded_roles = isset($gawd_settings['gawd_excluded_roles']) ? $gawd_settings['gawd_excluded_roles'] : array();
|
18 |
+
$gawd_backend_roles = isset($gawd_settings['gawd_backend_roles']) ? implode(',', $gawd_settings['gawd_backend_roles']) : 'administrator';
|
19 |
+
$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? implode(',', $gawd_settings['gawd_frontend_roles']) : 'administrator';
|
20 |
+
$gawd_post_page_roles = isset($gawd_settings['gawd_post_page_roles']) ? implode(',', $gawd_settings['gawd_post_page_roles']) : 'administrator';
|
21 |
+
$gawd_file_formats = isset($gawd_settings['gawd_file_formats']) ? $gawd_settings['gawd_file_formats'] : '';
|
22 |
+
$adsense_acc_linking = isset($gawd_settings['adsense_acc_linking']) ? $gawd_settings['adsense_acc_linking'] : '';
|
23 |
+
$enable_hover_tooltip = isset($gawd_settings['enable_hover_tooltip']) ? $gawd_settings['enable_hover_tooltip'] : 'on';
|
24 |
+
$exclude_events = isset($gawd_settings['exclude_events']) ? $gawd_settings['exclude_events'] : '';
|
25 |
+
$enable_cross_domain = isset($gawd_settings['enable_cross_domain']) ? $gawd_settings['enable_cross_domain'] : '';
|
26 |
+
$default_date = isset($gawd_settings['default_date']) ? $gawd_settings['default_date'] : '';
|
27 |
+
$default_date_format = isset($gawd_settings['default_date_format']) ? $gawd_settings['default_date_format'] : '';
|
28 |
+
$post_page_chart = isset($gawd_settings['post_page_chart']) ? $gawd_settings['post_page_chart'] : '';
|
29 |
+
$roles = new WP_Roles();
|
30 |
+
$roles_changed = array();
|
31 |
+
$_roles_changed = array();
|
32 |
+
foreach ($roles->role_names as $key => $name) {
|
33 |
+
$_roles_changed['role_names'][$name] = $key;
|
34 |
+
}
|
35 |
+
foreach ($roles->role_names as $key => $name) {
|
36 |
+
if ($name == 'Administrator') {
|
37 |
+
$key = 'manage_options';
|
38 |
+
}
|
39 |
+
elseif ($name == 'Editor') {
|
40 |
+
$key = 'moderate_comments';
|
41 |
+
}
|
42 |
+
elseif ($name == 'Author') {
|
43 |
+
$key = 'publish_posts';
|
44 |
+
}
|
45 |
+
elseif ($name == 'Contributor') {
|
46 |
+
$key = 'edit_posts';
|
47 |
+
}
|
48 |
+
else {
|
49 |
+
$key = 'read';
|
50 |
+
}
|
51 |
+
$roles_changed['role_names'][$name] = $key;
|
52 |
+
}
|
53 |
+
|
54 |
+
$gawd_emails = get_option('gawd_emails_info');
|
55 |
+
|
56 |
+
$alerts_list = array();
|
57 |
+
$email_list = array();
|
58 |
+
|
59 |
+
if(is_array($gawd_emails)) {
|
60 |
+
foreach($gawd_emails as $key=>$email_info) {
|
61 |
+
if(isset($email_info['email_info']['other_info']['alert_data'])) {
|
62 |
+
$alerts_list[$key] = $email_info;
|
63 |
+
} else {
|
64 |
+
$email_list[$key] = $email_info;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
?>
|
70 |
+
|
71 |
+
<div id="gawd_body">
|
72 |
+
<div class="resp_menu">
|
73 |
+
<div class="menu_img"></div>
|
74 |
+
<div class="button_label">SETTINGS</div>
|
75 |
+
<div class="clear"></div>
|
76 |
+
</div>
|
77 |
+
<div class="gawd_menu_coteiner gawd_settings_menu_coteiner">
|
78 |
+
<ul class="gawd_menu_ul">
|
79 |
+
<li class="gawd_menu_li" id="gawd_authenicate">Authenticate</li>
|
80 |
+
<li class="gawd_menu_li" id="gawd_tracking">Tracking</li>
|
81 |
+
<?php if (GAWD_helper::gawd_has_property()) { ?>
|
82 |
+
<li class="gawd_menu_li" id="gawd_alerts">Alerts</li>
|
83 |
+
<li class="gawd_menu_li" id="gawd_pushover">Pushover</li>
|
84 |
+
<li class="gawd_menu_li" id="gawd_filters">Filters</li>
|
85 |
+
<li class="gawd_menu_li" id="gawd_emails">Emails</li>
|
86 |
+
<li class=" gawd_menu_li" id="gawd_advanced">Advanced</li>
|
87 |
+
<?php } ?>
|
88 |
+
</ul>
|
89 |
+
</div>
|
90 |
+
<div id="gawd_right_conteiner">
|
91 |
+
<h3 class="gawd_page_titles">Settings</h3>
|
92 |
+
|
93 |
+
<form method="post" id="gawd_form">
|
94 |
+
<div class="gawd_authenicate">
|
95 |
+
<div id="opacity_div"
|
96 |
+
style="display: none; background-color: rgba(0, 0, 0, 0.2); position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99998;"></div>
|
97 |
+
<div id="loading_div"
|
98 |
+
style="display:none; text-align: center; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999;">
|
99 |
+
<img src="<?php echo GAWD_URL . '/assets/ajax_loader.gif'; ?>"
|
100 |
+
style="margin-top: 200px; width:50px;">
|
101 |
+
</div>
|
102 |
+
<div id="gawd_auth_url_wrapper">
|
103 |
+
<div id="gawd_auth_url" style="cursor: pointer; margin: -10px 0 20px 0;">
|
104 |
+
<div style="color:#444;padding:5px 5px 5px 0">Press <b>Reauthenticate</b> button to
|
105 |
+
change your Google account.
|
106 |
+
</div>
|
107 |
+
<div class="gawd_auth_button" onclick="gawd_auth_popup(800,400)">REAUTHENTICATE</div>
|
108 |
+
</div>
|
109 |
+
<div class="gawd_refresh_button_wrapper">
|
110 |
+
<div class="gawd_account_button refresh_user_info" onclick="gawd_refresh_user_info(false,true)">
|
111 |
+
Refresh user info
|
112 |
+
</div>
|
113 |
+
<div class="gawd_info"
|
114 |
+
title="<?php esc_attr_e('Use this button to synchronize user data on this site with Google Analytics service. For example, after adding GA Account or changing web-properties.', 'gawd'); ?>"></div>
|
115 |
+
</div>
|
116 |
+
<div class="clear"></div>
|
117 |
+
</div>
|
118 |
+
<div id="gawd_auth_code">
|
119 |
+
<p style="margin:0;color: #444;">Paste the authentication code from the popup to this input.</p>
|
120 |
+
<input id="gawd_token" type="text">
|
121 |
+
<div id="gawd_auth_code_submit">SUBMIT</div>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
<div class="gawd_own_wrap">
|
125 |
+
<?php if ($credentials['default'] === false) { ?>
|
126 |
+
<span>Authenticated with own project</span>
|
127 |
+
<?php }
|
128 |
+
else { ?>
|
129 |
+
<label for="gawd_own_project">
|
130 |
+
<input type="checkbox" <?php echo $credentials['default'] === false ? 'checked disabled' : ''; ?>
|
131 |
+
name="gawd_own_project" id="gawd_own_project"/>
|
132 |
+
<!-- <span>Use your own project</span>-->
|
133 |
+
<span>Authenticated with own project</span>
|
134 |
+
<div class="gawd_info"
|
135 |
+
title="Mark as checked to use your project, which you created on console.developers.google.com"></div>
|
136 |
+
</label>
|
137 |
+
<?php } ?>
|
138 |
+
<div class="own_inputs" <?php echo $credentials['default'] === false ? '' : 'style="display:none"'; ?>>
|
139 |
+
<div class="gawd_goal_row">
|
140 |
+
<div class="gawd_goal_label">Client ID</div>
|
141 |
+
<div class="gawd_goal_input">
|
142 |
+
<input type="text"
|
143 |
+
value="<?php echo (isset($credentials['project_id']) && $credentials['default'] === false) ? $credentials['project_id'] : ''; ?>"
|
144 |
+
name="gawd_own_client_id"/>
|
145 |
+
</div>
|
146 |
+
<div class="gawd_info"
|
147 |
+
title="Paste Client ID key. For more information about getting project keys please check the plugin User Guide."></div>
|
148 |
+
<div class='clear'></div>
|
149 |
+
</div>
|
150 |
+
<div class="gawd_goal_row">
|
151 |
+
<div class="gawd_goal_label">Client Secret</div>
|
152 |
+
<div class="gawd_goal_input">
|
153 |
+
<input type="text"
|
154 |
+
value="<?php echo (isset($credentials['project_secret']) && $credentials['default'] === false) ? $credentials['project_secret'] : ''; ?>"
|
155 |
+
name="gawd_own_client_secret"/>
|
156 |
+
</div>
|
157 |
+
<div class="gawd_info"
|
158 |
+
title="Paste Client Secret key. For more information about getting project keys please check the User Guide."></div>
|
159 |
+
<div class='clear'></div>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
<?php if ($credentials['default'] === false) { ?>
|
163 |
+
<a class="gawd_reset_credentials" id="gawd_reset_credentials">Stop using own project</a>
|
164 |
+
<?php } ?>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
<div class="gawd_tracking">
|
168 |
+
<?php include_once 'tracking.php'; ?>
|
169 |
+
</div>
|
170 |
+
<?php if (GAWD_helper::gawd_has_property()) { ?>
|
171 |
+
<div class="gawd_alerts">
|
172 |
+
<div class="gawd_goal_row">
|
173 |
+
<span class="gawd_goal_label">View</span>
|
174 |
+
<span class="gawd_goal_input">
|
175 |
+
<select name="gawd_alert_view" id="gawd_alert_view">
|
176 |
+
<?php foreach ($profiles as $property_name => $property): ?>
|
177 |
+
<optgroup label="<?php echo $property_name; ?>">
|
178 |
+
<?php foreach ($property as $profile):
|
179 |
+
$webPropertyId = $profile['webPropertyId'];
|
180 |
+
$id = $profile['id'];
|
181 |
+
$name = $profile['name'];
|
182 |
+
$selected = '';
|
183 |
+
if ($id == $gawd_user_data['profile_id']) {
|
184 |
+
$selected = 'selected="selected"';
|
185 |
+
}
|
186 |
+
?>
|
187 |
+
<option
|
188 |
+
value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
189 |
+
<?php endforeach ?>
|
190 |
+
</optgroup>
|
191 |
+
<?php endforeach ?>
|
192 |
+
</select>
|
193 |
+
</span>
|
194 |
+
<div class="gawd_info"
|
195 |
+
title="Choose the website, to which you would like to set Google Analytics Alerts."></div>
|
196 |
+
<div class='clear'></div>
|
197 |
+
</div>
|
198 |
+
<div class="gawd_goal_row">
|
199 |
+
<span class="gawd_goal_label">Name</span>
|
200 |
+
<span class="gawd_goal_input">
|
201 |
+
<input id="gawd_goal_name" name="gawd_alert_name" class="" type="text" value="">
|
202 |
+
</span>
|
203 |
+
<div class="gawd_info" title="Provide a title for the alert notification."></div>
|
204 |
+
<div class='clear'></div>
|
205 |
+
</div>
|
206 |
+
<div class="gawd_goal_row">
|
207 |
+
<span class="gawd_goal_label">Period</span>
|
208 |
+
<span class="gawd_goal_input">
|
209 |
+
<select name="gawd_alert_period">
|
210 |
+
<option value="daily">Day</option>
|
211 |
+
<option value="gawd_weekly">Week</option>
|
212 |
+
<option value="gawd_monthly">Month</option>
|
213 |
+
</select>
|
214 |
+
</span>
|
215 |
+
<div class="gawd_info"
|
216 |
+
title="Select period (daily, weekly or monthly) for receiving alerts."></div>
|
217 |
+
<div class='clear'></div>
|
218 |
+
</div>
|
219 |
+
<div class="gawd_goal_row">
|
220 |
+
<span class="gawd_goal_label">Email</span>
|
221 |
+
<span class="gawd_goal_input">
|
222 |
+
<input type="text" id="gawd_alert_emails" name="gawd_alert_emails"/>
|
223 |
+
</span>
|
224 |
+
<div class="gawd_info"
|
225 |
+
title="Provide the email address, to which you’d like to receive alerts."></div>
|
226 |
+
<div class='clear'></div>
|
227 |
+
</div>
|
228 |
+
<div id="alert_condition"> ALERT CONDITIONS</div>
|
229 |
+
<div class="gawd_goal_row">
|
230 |
+
<span class="gawd_goal_label">When</span>
|
231 |
+
<span class="gawd_goal_input">
|
232 |
+
<select name="gawd_alert_metric" id="gawd_alert_metric" class="gawd_alert_metric">
|
233 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
234 |
+
<option value="users"><?php echo __('Users', 'gawd'); ?></option>
|
235 |
+
<option value="bounceRate"><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
236 |
+
<option value="avgSessionDuration"><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
237 |
+
</select>
|
238 |
+
</span>
|
239 |
+
<div class="gawd_info"
|
240 |
+
title="Pick a metric (Sessions, Users, Bounces or Session Duration) to evaluate for notification alerts."></div>
|
241 |
+
<div class='clear'></div>
|
242 |
+
</div>
|
243 |
+
<div class="gawd_goal_row">
|
244 |
+
<span class="gawd_goal_label">Condition</span>
|
245 |
+
<span class="gawd_goal_input">
|
246 |
+
<select name="gawd_alert_condition" id="gawd_alert_condition" class="gawd_alert_condition">
|
247 |
+
<option value="less"><?php echo __('Is less than', 'gawd'); ?></option>
|
248 |
+
<option value="greater"><?php echo __('Is greater than', 'gawd'); ?></option>
|
249 |
+
</select>
|
250 |
+
</span>
|
251 |
+
<div class="gawd_info"
|
252 |
+
title="Select a condition (Is less than or Is greater than) for alert emails."></div>
|
253 |
+
<div class='clear'></div>
|
254 |
+
</div>
|
255 |
+
<div class="gawd_goal_row">
|
256 |
+
<span class="gawd_goal_label">Value:</span>
|
257 |
+
<span class="gawd_goal_input">
|
258 |
+
<div class="time_input"><input type="number" min='0' value="0" name="gawd_alert_value"/></div>
|
259 |
+
</span>
|
260 |
+
<div class="gawd_info"
|
261 |
+
title="Define value for the metric, based on which notifications will be sent."></div>
|
262 |
+
<div class='clear'></div>
|
263 |
+
</div>
|
264 |
+
<?php
|
265 |
+
|
266 |
+
if ($alerts_list) {
|
267 |
+
?>
|
268 |
+
<table border="1" class="gawd_table">
|
269 |
+
<tr>
|
270 |
+
<th>Name</th>
|
271 |
+
<th>Period</th>
|
272 |
+
<th>Condition</th>
|
273 |
+
<th>View</th>
|
274 |
+
<th>Action</th>
|
275 |
+
</tr>
|
276 |
+
<?php
|
277 |
+
foreach ($alerts_list as $key => $alert_data) {
|
278 |
+
$alert = $alert_data['email_info']['other_info']['alert_data'];
|
279 |
+
$condition = $alert['condition'] == 'less' ? ' is less then ' : ' greater than ';
|
280 |
+
$metric = $alert['metric'];
|
281 |
+
|
282 |
+
if($metric == 'bounceRate'){
|
283 |
+
$metric = 'Bounce Rate';
|
284 |
+
}else if($metric == 'avgSessionDuration'){
|
285 |
+
$metric = 'Avg Session Duration';
|
286 |
+
}else {
|
287 |
+
$metric = ucfirst($metric);
|
288 |
+
}
|
289 |
+
|
290 |
+
$period = (strpos($alert['period'], 'gawd') > -1) ? substr($alert['period'], 5) : $alert['period'];
|
291 |
+
$period = ucfirst($period);
|
292 |
+
?>
|
293 |
+
<tr>
|
294 |
+
<td><?php echo $alert['name']; ?></td>
|
295 |
+
<td><?php echo $period; ?></td>
|
296 |
+
<td><?php echo $metric . $condition . $alert['value']; ?></td>
|
297 |
+
<td><?php echo $alert['alert_view_name']; ?></td>
|
298 |
+
<td><a href="" class="gawd_remove_emails"
|
299 |
+
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $key; ?>','gawd_email_remove');return false;} else {return false;}">remove</a>
|
300 |
+
</td>
|
301 |
+
</tr>
|
302 |
+
<?php
|
303 |
+
}
|
304 |
+
?>
|
305 |
+
</table>
|
306 |
+
<?php
|
307 |
+
}
|
308 |
+
?>
|
309 |
+
<input type="hidden" name="alert_view_name" id='alert_view_name'/>
|
310 |
+
</div>
|
311 |
+
<div class="gawd_pushover">
|
312 |
+
<div class="gawd_goal_row">
|
313 |
+
<span class="gawd_goal_label">View</span>
|
314 |
+
<span class="gawd_goal_input">
|
315 |
+
<select name="gawd_pushover_view" id="gawd_pushover_view">
|
316 |
+
<?php foreach ($profiles as $property_name => $property): ?>
|
317 |
+
<optgroup label="<?php echo $property_name; ?>">
|
318 |
+
<?php foreach ($property as $profile):
|
319 |
+
$webPropertyId = $profile['webPropertyId'];
|
320 |
+
$id = $profile['id'];
|
321 |
+
$name = $profile['name'];
|
322 |
+
$selected = '';
|
323 |
+
if ($id == $gawd_user_data['profile_id']) {
|
324 |
+
$selected = 'selected="selected"';
|
325 |
+
}
|
326 |
+
?>
|
327 |
+
<option
|
328 |
+
value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
329 |
+
<?php endforeach ?>
|
330 |
+
</optgroup>
|
331 |
+
<?php endforeach ?>
|
332 |
+
</select>
|
333 |
+
</span>
|
334 |
+
<div class="gawd_info"
|
335 |
+
title="Choose the website, to which you would like to set Pushover Notifications. "></div>
|
336 |
+
<div class='clear'></div>
|
337 |
+
</div>
|
338 |
+
<div class="gawd_goal_row">
|
339 |
+
<span class="gawd_goal_label">Name</span>
|
340 |
+
<span class="gawd_goal_input">
|
341 |
+
<input id="gawd_goal_name" name="gawd_pushover_name" class="gawd_pushover_name_fild" type="text" value="">
|
342 |
+
</span>
|
343 |
+
<div class="gawd_info" title="Provide a title for Pushover alert."></div>
|
344 |
+
<div class='clear'></div>
|
345 |
+
</div>
|
346 |
+
<div class="gawd_goal_row">
|
347 |
+
<span class="gawd_goal_label">Period</span>
|
348 |
+
<span class="gawd_goal_input">
|
349 |
+
<select name="gawd_pushover_period">
|
350 |
+
<option value="daily">Day</option>
|
351 |
+
<option value="gawd_weekly">Week</option>
|
352 |
+
<option value="gawd_monthly">Month</option>
|
353 |
+
</select>
|
354 |
+
</span>
|
355 |
+
<div class="gawd_info"
|
356 |
+
title="Select period (daily, weekly or monthly) for receiving Pushover notifications."></div>
|
357 |
+
<div class='clear'></div>
|
358 |
+
</div>
|
359 |
+
<div class="gawd_goal_row">
|
360 |
+
<span class="gawd_goal_label">User Key</span>
|
361 |
+
<span class="gawd_goal_input">
|
362 |
+
<input type="text" class="gawd_pushover_user_keys_fild" name="gawd_pushover_user_keys"/>
|
363 |
+
</span>
|
364 |
+
<div class="gawd_info"
|
365 |
+
title="Provide the User Key of your Pushover account, to which you’d like to get notification alerts."></div>
|
366 |
+
<div class='clear'></div>
|
367 |
+
</div>
|
368 |
+
<div id="pushover_condition">PUSHOVER CONDITIONS</div>
|
369 |
+
<div class="gawd_goal_row">
|
370 |
+
<span class="gawd_goal_label">When</span>
|
371 |
+
<span class="gawd_goal_input">
|
372 |
+
<select name="gawd_pushover_metric" id="gawd_pushover_metric" class="gawd_pushover_metric">
|
373 |
+
<option value="sessions"><?php echo __('Sessions', 'gawd'); ?></option>
|
374 |
+
<option value="users"><?php echo __('Users', 'gawd'); ?></option>
|
375 |
+
<option value="bounceRate"><?php echo __('Bounce Rate', 'gawd'); ?></option>
|
376 |
+
<option value="sessionDuration"><?php echo __('Avg Session Duration', 'gawd'); ?></option>
|
377 |
+
</select>
|
378 |
+
</span>
|
379 |
+
<div class="gawd_info"
|
380 |
+
title="Pick a metric (Sessions, Users, Bounces or Session Duration) to evaluate for Pushover notifications."></div>
|
381 |
+
<div class='clear'></div>
|
382 |
+
</div>
|
383 |
+
<div class="gawd_goal_row">
|
384 |
+
<span class="gawd_goal_label">Condition</span>
|
385 |
+
<span class="gawd_goal_input">
|
386 |
+
<select name="gawd_pushover_condition" id="gawd_pushover_condition" class="gawd_pushover_condition">
|
387 |
+
<option value="less"><?php echo __('Is less than', 'gawd'); ?></option>
|
388 |
+
<option value="greater"><?php echo __('Is greater than', 'gawd'); ?></option>
|
389 |
+
</select>
|
390 |
+
</span>
|
391 |
+
<div class="gawd_info"
|
392 |
+
title="Select a condition (Is less than or Is greater than) for the notifications."></div>
|
393 |
+
<div class='clear'></div>
|
394 |
+
</div>
|
395 |
+
<div class="gawd_goal_row">
|
396 |
+
<span class="gawd_goal_label">Value:</span>
|
397 |
+
<span class="gawd_goal_input">
|
398 |
+
<div class="time_input"><input type="number" min='0' value="0" name="gawd_pushover_value"/></div>
|
399 |
+
</span>
|
400 |
+
<div class="gawd_info"
|
401 |
+
title="Define value for the metric, based on which notifications will be sent."></div>
|
402 |
+
<div class='clear'></div>
|
403 |
+
</div>
|
404 |
+
<?php
|
405 |
+
$pushovers = get_option('gawd_pushovers');
|
406 |
+
|
407 |
+
if ($pushovers) {
|
408 |
+
?>
|
409 |
+
<table border="1" class="gawd_table">
|
410 |
+
<tr>
|
411 |
+
<th>Name</th>
|
412 |
+
<th>Period</th>
|
413 |
+
<th>Condition</th>
|
414 |
+
<th>View</th>
|
415 |
+
<th>Action</th>
|
416 |
+
</tr>
|
417 |
+
<?php
|
418 |
+
foreach ($pushovers as $key => $pushover) {
|
419 |
+
$condition = $pushover['condition'] == 'less' ? ' is less then ' : ' greater than ';
|
420 |
+
?>
|
421 |
+
<tr data-key="<?php echo $key + 1; ?>">
|
422 |
+
<td><?php echo $pushover['name']; ?></td>
|
423 |
+
<td><?php echo strpos($pushover['period'], 'gawd') > -1 ? substr($pushover['period'], 5) : $pushover['period']; ?></td>
|
424 |
+
<td><?php echo $pushover['metric'] . $condition . $pushover['value']; ?></td>
|
425 |
+
<td><?php echo $pushover['pushover_view_name']; ?></td>
|
426 |
+
<td><a href="" class="gawd_pushover_remove"
|
427 |
+
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $key + 1; ?>','gawd_pushover_remove');return false;} else {return false;}">remove</a>
|
428 |
+
</td>
|
429 |
+
</tr>
|
430 |
+
<?php
|
431 |
+
}
|
432 |
+
?>
|
433 |
+
</table>
|
434 |
+
<?php
|
435 |
+
}
|
436 |
+
?>
|
437 |
+
<input type="hidden" name="pushover_view_name" id='pushover_view_name'/>
|
438 |
+
</div>
|
439 |
+
<div class="gawd_filters">
|
440 |
+
<div class="gawd_goal_row">
|
441 |
+
<span class="gawd_goal_label">View</span>
|
442 |
+
<span class="gawd_goal_input">
|
443 |
+
|
444 |
+
<select title="Click to pick the website, filters of which you’d like to display." name="gawd_profile_id"
|
445 |
+
onchange="change_filter_account(this)">
|
446 |
+
<?php
|
447 |
+
foreach ($profiles as $property_name => $property): ?>
|
448 |
+
<optgroup label="<?php echo $property_name; ?>">
|
449 |
+
<?php foreach ($property as $profile):
|
450 |
+
$webPropertyId = $profile['webPropertyId'];
|
451 |
+
$id = $profile['id'];
|
452 |
+
$name = $profile['name'];
|
453 |
+
$selected = '';
|
454 |
+
if ($id == $gawd_user_data['profile_id']) {
|
455 |
+
$selected = 'selected="selected"';
|
456 |
+
$filter_account_name = $property_name;
|
457 |
+
}
|
458 |
+
?>
|
459 |
+
<option
|
460 |
+
value="<?php echo $id; ?>" <?php echo $selected; ?>><?php echo $property_name . ' - ' . $name; ?></option>
|
461 |
+
<?php endforeach ?>
|
462 |
+
</optgroup>
|
463 |
+
<?php endforeach ?>
|
464 |
+
</select>
|
465 |
+
<input type="hidden" name='account_name' id='account_name'/>
|
466 |
+
<input type="hidden" name='web_property_name' id='web_property_name'/>
|
467 |
+
</span>
|
468 |
+
<div class="gawd_info"
|
469 |
+
title="Select the website, for which you would like to configure this filter."></div>
|
470 |
+
<div class='clear'></div>
|
471 |
+
</div>
|
472 |
+
<div class="gawd_goal_row">
|
473 |
+
<span class="gawd_goal_label">Name</span>
|
474 |
+
<span class="gawd_goal_input">
|
475 |
+
<input id="gawd_goal_name " class="gawd_filter_name_fild" name="gawd_filter_name" type="text">
|
476 |
+
</span>
|
477 |
+
<div class="gawd_info" title="Write a title for the filter."></div>
|
478 |
+
<div class='clear'></div>
|
479 |
+
</div>
|
480 |
+
<div class="gawd_goal_row">
|
481 |
+
<span class="gawd_goal_label">Type</span>
|
482 |
+
<span class="gawd_goal_input">
|
483 |
+
<select name="gawd_filter_type" id="gawd_filter_type">
|
484 |
+
<option data-name="IP" value="GEO_IP_ADDRESS">Exclude Traffic From IP Address</option>
|
485 |
+
<option data-name="Country" value="GEO_COUNTRY">Exclude Traffic From Country</option>
|
486 |
+
<option data-name="Region" value="GEO_REGION">Exclude Traffic From Region</option>
|
487 |
+
<option data-name="City" value="GEO_CITY">Exclude Traffic From City</option>
|
488 |
+
</select>
|
489 |
+
</span>
|
490 |
+
<div class="gawd_info"
|
491 |
+
title="Choose a type for tracking exclusions: IP address, Country, Region or City."></div>
|
492 |
+
<div class='clear'></div>
|
493 |
+
</div>
|
494 |
+
<div class="gawd_goal_row" id="gawd_filter_value_cont">
|
495 |
+
<span class="gawd_goal_label" id="gawd_filter_name">IP</span>
|
496 |
+
<span class="gawd_goal_input">
|
497 |
+
<div class="time_input"><input id="gawd_filter_value" type="text" name="gawd_filter_value"/></div>
|
498 |
+
</span>
|
499 |
+
<div class="gawd_info" title="Enter the IP address to filter from Google Analytics tracking."></div>
|
500 |
+
<div class='clear'></div>
|
501 |
+
</div>
|
502 |
+
<?php
|
503 |
+
if (!empty($filters)) {
|
504 |
+
?>
|
505 |
+
<table border="1" class="gawd_table">
|
506 |
+
<tr>
|
507 |
+
<th>Name</th>
|
508 |
+
<th>Type</th>
|
509 |
+
<th>Value</th>
|
510 |
+
<th>View</th>
|
511 |
+
<th>Action</th>
|
512 |
+
|
513 |
+
</tr>
|
514 |
+
<?php
|
515 |
+
foreach ($filters as $filter) {
|
516 |
+
$filter_type = 'Not Supported';
|
517 |
+
$filter_value = $filter['value'] != "" ? $filter['value'] : 'Not Suported';
|
518 |
+
if ($filter['type'] == "GEO_COUNTRY") {
|
519 |
+
$filter_type = 'Exclude Traffic From Country';
|
520 |
+
}
|
521 |
+
elseif ($filter['type'] == "GEO_REGION") {
|
522 |
+
$filter_type = 'Exclude Traffic From Region';
|
523 |
+
}
|
524 |
+
elseif ($filter['type'] == "GEO_CITY") {
|
525 |
+
$filter_type = 'Exclude Traffic From City';
|
526 |
+
}
|
527 |
+
elseif ($filter['type'] == "GEO_IP_ADDRESS") {
|
528 |
+
$filter_type = 'Exclude Traffic From IP Address';
|
529 |
+
}
|
530 |
+
?>
|
531 |
+
<tr data-key="<?php echo $filter['id']; ?>">
|
532 |
+
<td><?php echo $filter['name']; ?></td>
|
533 |
+
<td><?php echo $filter_type; ?></td>
|
534 |
+
<td><?php echo $filter_value; ?></td>
|
535 |
+
<td><?php echo $filter['view']; ?></td>
|
536 |
+
<td><a href="" class="gawd_filter_remove"
|
537 |
+
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $filter['id']; ?>','gawd_filter_remove');return false;} else {return false;}">remove</a>
|
538 |
+
</td>
|
539 |
+
</tr>
|
540 |
+
<?php
|
541 |
+
}
|
542 |
+
?>
|
543 |
+
</table>
|
544 |
+
<?php
|
545 |
+
}
|
546 |
+
else {
|
547 |
+
echo 'There is no data for this view.';
|
548 |
+
}
|
549 |
+
?>
|
550 |
+
</div>
|
551 |
+
<div class="gawd_emails">
|
552 |
+
<!-- FOR DEBUG -->
|
553 |
+
<div style="display: none !important;">
|
554 |
+
<?php echo 'Next :' . date('Y-m-d H:i:s', get_option('gawd_next_mail_date')); ?>
|
555 |
+
</div>
|
556 |
+
<?php
|
557 |
+
|
558 |
+
if ($email_list) {
|
559 |
+
?>
|
560 |
+
<table border="1" class="gawd_table">
|
561 |
+
<tr>
|
562 |
+
<th>Subject</th>
|
563 |
+
<th>Frequency</th>
|
564 |
+
<th>Next Date</th>
|
565 |
+
<th>Recipients</th>
|
566 |
+
<th>Website</th>
|
567 |
+
<th>Action</th>
|
568 |
+
</tr>
|
569 |
+
<?php
|
570 |
+
foreach ($email_list as $key => $email) {
|
571 |
+
$period = str_replace('gawd_', '', $email['email_info']['period']);
|
572 |
+
?>
|
573 |
+
<tr>
|
574 |
+
<td><?php echo $email['email_info']['subject']; ?></td>
|
575 |
+
<td><?php echo ucfirst($period); ?></td>
|
576 |
+
<td><?php echo date('Y-m-d H:i', $email['next_date']); ?></td>
|
577 |
+
<td><span class="gawd_break"><?php echo $email['email_info']['email_to']; ?></span></td>
|
578 |
+
<td><span class="gawd_break"><?php echo GAWD_helper::get_account_name_by_profile_id($email['email_info']['view_id']); ?></span></td>
|
579 |
+
<td><a href="" class="gawd_remove_emails"
|
580 |
+
onclick="if (confirm('<?php echo addslashes(__("Do you want to delete selected item?", 'gawd')); ?>')) {gawd_remove_item('<?php echo $key; ?>','gawd_email_remove');return false;} else {return false;}">remove</a>
|
581 |
+
</td>
|
582 |
+
</tr>
|
583 |
+
<?php
|
584 |
+
}
|
585 |
+
?>
|
586 |
+
</table>
|
587 |
+
<?php
|
588 |
+
}
|
589 |
+
else {
|
590 |
+
echo '<a href="' . admin_url() . 'admin.php?page=gawd_reports">You can setup sending e-mail to recipients for any report.</a>';
|
591 |
+
}
|
592 |
+
?>
|
593 |
+
</div>
|
594 |
+
<div class="gawd_advanced">
|
595 |
+
<div class="settings_row">
|
596 |
+
<div class="onoffswitch">
|
597 |
+
<input type="checkbox" name="gawd_show_in_dashboard" class="onoffswitch-checkbox"
|
598 |
+
id="gawd_show_in_dashboard" <?php echo isset($gawd_settings['gawd_show_in_dashboard']) && 'on' == $gawd_settings['gawd_show_in_dashboard'] ? 'checked' : ''; ?>>
|
599 |
+
<label class="onoffswitch-label" for="gawd_show_in_dashboard">
|
600 |
+
<span class="onoffswitch-inner"></span>
|
601 |
+
<span class="onoffswitch-switch"></span>
|
602 |
+
</label>
|
603 |
+
</div>
|
604 |
+
<div class="gawd_info"
|
605 |
+
title="Enable this option to display Google Analytics overview report on WordPress Dashboard."></div>
|
606 |
+
<div class="onoffswitch_text">
|
607 |
+
Analytics on WordPress Dashboard
|
608 |
+
</div>
|
609 |
+
<div class="clear"></div>
|
610 |
+
</div>
|
611 |
+
<div class="settings_row">
|
612 |
+
<div class="onoffswitch">
|
613 |
+
<input type="checkbox" name="enable_hover_tooltip" class="onoffswitch-checkbox"
|
614 |
+
id="enable_hover_tooltip" <?php echo $enable_hover_tooltip != '' ? 'checked' : ''; ?>>
|
615 |
+
<label class="onoffswitch-label" for="enable_hover_tooltip">
|
616 |
+
<span class="onoffswitch-inner"></span>
|
617 |
+
<span class="onoffswitch-switch"></span>
|
618 |
+
</label>
|
619 |
+
</div>
|
620 |
+
<div class="gawd_info"
|
621 |
+
title="Click to enable/disable help text for 10Web Analytics reports."></div>
|
622 |
+
<div class="onoffswitch_text">
|
623 |
+
Enable reports tooltips
|
624 |
+
</div>
|
625 |
+
<div class="clear"></div>
|
626 |
+
</div>
|
627 |
+
<div class="settings_row">
|
628 |
+
<div class="onoffswitch onoffswitch_disabled">
|
629 |
+
<input disabled type="checkbox" name="adsense_acc_linking" class="onoffswitch-checkbox"
|
630 |
+
id="adsense_acc_linking" <?php echo $adsense_acc_linking != '' ? 'checked' : ''; ?>>
|
631 |
+
<label class="onoffswitch-label" for="adsense_acc_linking">
|
632 |
+
<span class="onoffswitch-inner"></span>
|
633 |
+
<span class="onoffswitch-switch"></span>
|
634 |
+
</label>
|
635 |
+
</div>
|
636 |
+
<div class="gawd_info"
|
637 |
+
title="Turn this option on to get AdSense tracking reports. Make sure to link your Google AdSense to Google Analytics first (find out more in User Guide)"></div>
|
638 |
+
<div class="onoffswitch_text">
|
639 |
+
Enable AdSense link tracking
|
640 |
+
<a target="_blank" href="https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin" class="gawd_pro"> ( This feature is available in 10Web Analytics Premium. )</a>
|
641 |
+
</div>
|
642 |
+
<div class="clear"></div>
|
643 |
+
</div>
|
644 |
+
<div class="settings_row">
|
645 |
+
<div class="onoffswitch">
|
646 |
+
<input type="checkbox" name="post_page_chart" class="onoffswitch-checkbox"
|
647 |
+
id="post_page_chart" <?php echo $post_page_chart != '' ? 'checked' : ''; ?>>
|
648 |
+
<label class="onoffswitch-label" for="post_page_chart">
|
649 |
+
<span class="onoffswitch-inner"></span>
|
650 |
+
<span class="onoffswitch-switch"></span>
|
651 |
+
</label>
|
652 |
+
</div>
|
653 |
+
<div class="gawd_info"
|
654 |
+
title="Enable this option to display individual page and post reports on frontend and backend."></div>
|
655 |
+
<div class="onoffswitch_text">
|
656 |
+
Enable reports on posts/pages (frontend and backend)
|
657 |
+
</div>
|
658 |
+
<div class="clear"></div>
|
659 |
+
</div>
|
660 |
+
<div class="settings_row">
|
661 |
+
<div class="onoffswitch">
|
662 |
+
<input type="checkbox" name="exclude_events" class="onoffswitch-checkbox"
|
663 |
+
id="exclude_events" <?php echo $exclude_events != '' ? 'checked' : ''; ?>>
|
664 |
+
<label class="onoffswitch-label" for="exclude_events">
|
665 |
+
<span class="onoffswitch-inner"></span>
|
666 |
+
<span class="onoffswitch-switch"></span>
|
667 |
+
</label>
|
668 |
+
</div>
|
669 |
+
<div class="gawd_info"
|
670 |
+
title="For example, watching a video is a non-interactive event, whereas submitting a form is interactive. Enable this option to filter non-interactive events while calculating bounce-rate."></div>
|
671 |
+
<div class="onoffswitch_text">
|
672 |
+
Exclude non-interactive events from bounce-rate calculation
|
673 |
+
</div>
|
674 |
+
<div class="clear"></div>
|
675 |
+
</div>
|
676 |
+
<div class="settings_row">
|
677 |
+
<div class="onoffswitch">
|
678 |
+
<input type="checkbox" name="enable_cross_domain" class="onoffswitch-checkbox"
|
679 |
+
id="enable_cross_domain" <?php echo $enable_cross_domain != '' ? 'checked' : ''; ?>>
|
680 |
+
<label class="onoffswitch-label" for="enable_cross_domain">
|
681 |
+
<span class="onoffswitch-inner"></span>
|
682 |
+
<span class="onoffswitch-switch"></span>
|
683 |
+
</label>
|
684 |
+
</div>
|
685 |
+
<div class="gawd_info"
|
686 |
+
title="Enable Cross domain tracking to let Google Analytics see similar activities on two related websites as single session."></div>
|
687 |
+
<div class="onoffswitch_text">
|
688 |
+
Enable Cross Domain Tracking
|
689 |
+
</div>
|
690 |
+
<div class="clear"></div>
|
691 |
+
</div>
|
692 |
+
<?php
|
693 |
+
$cross_dom_show = $enable_cross_domain == '' ? 'style="display:none"' : '';
|
694 |
+
?>
|
695 |
+
<div id="cross_domains" class="gawd_goal_row" <?php echo $cross_dom_show; ?>>
|
696 |
+
<span class="gawd_goal_label">Cross Domains</span>
|
697 |
+
<span class="gawd_goal_input">
|
698 |
+
<div class="time_input">
|
699 |
+
<?php $gawd_settings_cross_domains = get_option("gawd_settings");
|
700 |
+
if (isset($gawd_settings_cross_domains) && isset($gawd_settings_cross_domains["cross_domains"])) {
|
701 |
+
$gawd_settings_cross_domains = $gawd_settings_cross_domains["cross_domains"];
|
702 |
+
}
|
703 |
+
else {
|
704 |
+
$gawd_settings_cross_domains = "";
|
705 |
+
}
|
706 |
+
?>
|
707 |
+
<input type="text" value="<?php echo $gawd_settings_cross_domains; ?>" name="cross_domains">
|
708 |
+
</div>
|
709 |
+
</span>
|
710 |
+
<div class="gawd_info"
|
711 |
+
title="Provide cross domain links separated by commas. The links should have the following format: http://example.com"></div>
|
712 |
+
<div class="clear"></div>
|
713 |
+
</div>
|
714 |
+
|
715 |
+
<div class="gawd_goal_row">
|
716 |
+
<?php $gawd_settings_site_speed_rate = get_option("gawd_settings");
|
717 |
+
if (isset($gawd_settings_site_speed_rate) && isset($gawd_settings_site_speed_rate["site_speed_rate"])) {
|
718 |
+
$gawd_settings_site_speed_rate = intval($gawd_settings_site_speed_rate["site_speed_rate"]);
|
719 |
+
}
|
720 |
+
else {
|
721 |
+
$gawd_settings_site_speed_rate = 1;
|
722 |
+
}
|
723 |
+
?>
|
724 |
+
<span class="gawd_goal_label">Site Speed SR (%)</span>
|
725 |
+
<span class="gawd_goal_input">
|
726 |
+
<div class="time_input"><input value="<?php echo $gawd_settings_site_speed_rate; ?>" type="number" min="1"
|
727 |
+
name="site_speed_rate"></div>
|
728 |
+
</span>
|
729 |
+
<div class="gawd_info"
|
730 |
+
title="Define the percentage of users, which activity should be evaluated for Site Speed report."></div>
|
731 |
+
<div class="clear"></div>
|
732 |
+
</div>
|
733 |
+
<div class="gawd_goal_row">
|
734 |
+
<div class="gawd_goal_label">Plugin settings permissions</div>
|
735 |
+
<div class="checkbox_wrap">
|
736 |
+
<div class="time_wrap gawd_permissions"><span data-attribute="manage_options"
|
737 |
+
class="gawd_permission">Administrator</span>
|
738 |
+
</div>
|
739 |
+
<?php
|
740 |
+
if ($gawd_permissions != '') {
|
741 |
+
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_permissions)) as $key => $_roles) {
|
742 |
+
if ($key == 'Administrator') {
|
743 |
+
continue;
|
744 |
+
}
|
745 |
+
?>
|
746 |
+
<div class="time_wrap gawd_permissions"><span data-attribute="<?php echo $_roles; ?>"
|
747 |
+
class="gawd_permission"><?php echo $key; ?></span><span
|
748 |
+
class="remove_gawd_permission gawd_remove">X</span></div>
|
749 |
+
<?php
|
750 |
+
}
|
751 |
+
}
|
752 |
+
?>
|
753 |
+
<input type="button" id="open_gawd_permissions" class="gawd_chose_btn button_gawd"
|
754 |
+
value="Choose"/>
|
755 |
+
<div class='clear'></div>
|
756 |
+
</div>
|
757 |
+
<div class="gawd_info"
|
758 |
+
title="Select user roles that have an access to change settings of the plugin. Only Administrator users can view it by default."></div>
|
759 |
+
<div class='clear'></div>
|
760 |
+
</div>
|
761 |
+
<div class="gawd_goal_row">
|
762 |
+
<div class="gawd_goal_label">Reports permissions</div>
|
763 |
+
<div class="checkbox_wrap">
|
764 |
+
<div class="time_wrap dashboard_report_permissions"><span data-attribute="administrator"
|
765 |
+
class="dashboard_report_permission">Administrator</span>
|
766 |
+
</div>
|
767 |
+
<?php
|
768 |
+
if ($gawd_backend_roles != '') {
|
769 |
+
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_backend_roles)) as $key => $roles) {
|
770 |
+
if ($roles == 'administrator') {
|
771 |
+
continue;
|
772 |
+
}
|
773 |
+
?>
|
774 |
+
<div class="time_wrap dashboard_report_permissions"><span
|
775 |
+
data-attribute="<?php echo $roles; ?>"
|
776 |
+
class="dashboard_report_permission"><?php echo $key; ?></span><span
|
777 |
+
class="remove_dashboard_report_permission gawd_remove">X</span></div>
|
778 |
+
<?php
|
779 |
+
}
|
780 |
+
}
|
781 |
+
?>
|
782 |
+
<input type="button" id="open_dashboard_report_permissions" class="gawd_chose_btn button_gawd"
|
783 |
+
value="Choose"/>
|
784 |
+
<div class='clear'></div>
|
785 |
+
</div>
|
786 |
+
<div class="gawd_info"
|
787 |
+
title="Select user roles, that have an access to view analytics reports in admin area."></div>
|
788 |
+
<div class='clear'></div>
|
789 |
+
</div>
|
790 |
+
<div class="gawd_goal_row">
|
791 |
+
<div class="gawd_goal_label">Post/Page report permissions</div>
|
792 |
+
<div class="checkbox_wrap">
|
793 |
+
<div class="time_wrap gawd_post_page_roles"><span data-attribute="administrator"
|
794 |
+
class="gawd_post_page_role">Administrator</span>
|
795 |
+
</div>
|
796 |
+
<?php
|
797 |
+
if ($gawd_post_page_roles != '') {
|
798 |
+
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_post_page_roles)) as $key => $roles) {
|
799 |
+
if ($roles == 'administrator') {
|
800 |
+
continue;
|
801 |
+
}
|
802 |
+
?>
|
803 |
+
<div class="time_wrap gawd_post_page_roles"><span data-attribute="<?php echo $roles; ?>"
|
804 |
+
class="gawd_post_page_role"><?php echo $key; ?></span><span
|
805 |
+
class="remove_post_page_role gawd_remove">X</span></div>
|
806 |
+
<?php
|
807 |
+
}
|
808 |
+
}
|
809 |
+
?>
|
810 |
+
<input type="button" id="post_page_report_permissions" class="gawd_chose_btn button_gawd"
|
811 |
+
value="Choose"/>
|
812 |
+
<div class='clear'></div>
|
813 |
+
</div>
|
814 |
+
<div class="gawd_info"
|
815 |
+
title="Select user roles, which will have access to view reports of posts and pages."></div>
|
816 |
+
<div class='clear'></div>
|
817 |
+
</div>
|
818 |
+
<div class="gawd_goal_row">
|
819 |
+
<div class="gawd_goal_label">Frontend report permissions</div>
|
820 |
+
<div class="checkbox_wrap">
|
821 |
+
<div class="time_wrap frontend_report_roles"><span data-attribute="administrator"
|
822 |
+
class="frontend_report_role">Administrator</span>
|
823 |
+
</div>
|
824 |
+
<?php
|
825 |
+
if ($gawd_frontend_roles != '') {
|
826 |
+
foreach (array_intersect($_roles_changed['role_names'], explode(',', $gawd_frontend_roles)) as $key => $roles) {
|
827 |
+
if ($roles == 'administrator') {
|
828 |
+
continue;
|
829 |
+
}
|
830 |
+
?>
|
831 |
+
<div class="time_wrap frontend_report_roles"><span data-attribute="<?php echo $roles; ?>"
|
832 |
+
class="frontend_report_role"><?php echo $key; ?></span><span
|
833 |
+
class="remove_frontend_report_role gawd_remove">X</span></div>
|
834 |
+
<?php
|
835 |
+
}
|
836 |
+
}
|
837 |
+
?>
|
838 |
+
<input type="button" id="open_frontend_report_permissions" class="gawd_chose_btn button_gawd"
|
839 |
+
value="Choose"/>
|
840 |
+
<div class='clear'></div>
|
841 |
+
</div>
|
842 |
+
<div class="gawd_info"
|
843 |
+
title="Select user roles, which will have access to view reports from frontend of your website."></div>
|
844 |
+
<div class='clear'></div>
|
845 |
+
</div>
|
846 |
+
<?php /*todo remove default_date_format*/ ?>
|
847 |
+
<div class="gawd_goal_row" style="display: none;">
|
848 |
+
<span class="gawd_goal_label">Date format</span>
|
849 |
+
<span class="gawd_goal_input">
|
850 |
+
<select name="default_date_format" id="default_date_format">
|
851 |
+
<option <?php selected($default_date_format, 'ymd_with_week'); ?> value="ymd_with_week">l, Y-m-d</option>
|
852 |
+
<option <?php selected($default_date_format, 'ymd_without_week'); ?>
|
853 |
+
value="ymd_without_week">Y-m-d</option>
|
854 |
+
<option <?php selected($default_date_format, 'month_name_with_week'); ?> value="month_name_with_week">l, F d, Y</option>
|
855 |
+
<option <?php selected($default_date_format, 'month_name_without_week'); ?>
|
856 |
+
value="month_name_without_week">F d, Y</option>
|
857 |
+
</select>
|
858 |
+
</span>
|
859 |
+
<div class="gawd_info" title="Choose the date format"></div>
|
860 |
+
<div class='clear'></div>
|
861 |
+
</div>
|
862 |
+
<div class="gawd_goal_row">
|
863 |
+
<span class="gawd_goal_label">Default date range</span>
|
864 |
+
<span class="gawd_goal_input">
|
865 |
+
<select name="default_date" id="default_date">
|
866 |
+
<option id='gawd_last_30days' <?php selected($default_date, 'last_30days'); ?> value="last_30days">Last 30 Days</option>
|
867 |
+
<option id='gawd_last_7days' <?php selected($default_date, 'last_7days'); ?> value="last_7days">Last 7 Days</option>
|
868 |
+
<option id='gawd_last_week' <?php selected($default_date, 'last_week'); ?>
|
869 |
+
value="last_week">Last Week</option>
|
870 |
+
<option id='gawd_this_month' <?php selected($default_date, 'this_month'); ?>
|
871 |
+
value="this_month">This Month</option>
|
872 |
+
<option id='gawd_last_month' <?php selected($default_date, 'last_month'); ?>
|
873 |
+
value="last_month">Last Month</option>
|
874 |
+
<option id='gawd_today' <?php selected($default_date, 'today'); ?> value="today">Today</option>
|
875 |
+
<option id='gawd_yesterday' <?php selected($default_date, 'yesterday'); ?>
|
876 |
+
value="yesterday">Yesterday</option>
|
877 |
+
</select>
|
878 |
+
</span>
|
879 |
+
<div class="gawd_info"
|
880 |
+
title="Choose the initial time period, which will be applied to all reports as their date range."></div>
|
881 |
+
<div class='clear'></div>
|
882 |
+
</div>
|
883 |
+
</div>
|
884 |
+
<?php } ?>
|
885 |
+
<div class="gawd_submit">
|
886 |
+
<input type="button" class="button_gawd" id="gawd_settings_button" value="Save"/>
|
887 |
+
<input type="button" style="display:none;" class="button_gawd" id="gawd_settings_logout"
|
888 |
+
value="Logout"/>
|
889 |
+
</div>
|
890 |
+
<input type='hidden' name="gawd_alert_remove" id="gawd_alert_remove"/>
|
891 |
+
<input type='hidden' name="gawd_menu_remove" id="gawd_menu_remove"/>
|
892 |
+
<input type='hidden' name="gawd_pushover_remove" id="gawd_pushover_remove"/>
|
893 |
+
<input type='hidden' name="gawd_email_remove" id="gawd_email_remove"/>
|
894 |
+
<input type='hidden' name="gawd_filter_remove" id="gawd_filter_remove"/>
|
895 |
+
<input type='hidden' name="gawd_settings_tab" id="gawd_settings_tab"/>
|
896 |
+
<input type='hidden' name="settings_submit" id="gawd_settings_submit"/>
|
897 |
+
<input type='hidden' name="gawd_settings_logout" id="gawd_settings_logout_val"/>
|
898 |
+
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_fild'); ?>
|
899 |
+
|
900 |
+
<div class="gawd_permissions_popup_overlay"></div>
|
901 |
+
<div class="gawd_permissions_popup">
|
902 |
+
<div class="close_btn_cont">
|
903 |
+
<div class="gawd_permission_popup_btn">X</div>
|
904 |
+
</div>
|
905 |
+
<div class="gawd_permissions_popup_content">
|
906 |
+
</div>
|
907 |
+
<div class="add_btn_cont">
|
908 |
+
<input type="button" class="button_gawd" id="add_roles" value="Add"/>
|
909 |
+
</div>
|
910 |
+
</div>
|
911 |
+
<input type='hidden' name="gawd_backend_roles" id="gawd_backend_roles"
|
912 |
+
value="<?php echo $gawd_backend_roles; ?>"/>
|
913 |
+
<input type='hidden' name="gawd_frontend_roles" id="gawd_frontend_roles"
|
914 |
+
value="<?php echo $gawd_frontend_roles; ?>"/>
|
915 |
+
<input type='hidden' name="gawd_post_page_roles" id="gawd_post_page_roles"
|
916 |
+
value="<?php echo $gawd_post_page_roles; ?>"/>
|
917 |
+
<input type='hidden' name="gawd_permissions" id="gawd_permissions"
|
918 |
+
value="<?php echo $gawd_permissions; ?>"/>
|
919 |
+
<input type="hidden" id="gawd_refresh_user_info_transient"
|
920 |
+
value="<?php echo $refresh_user_info_transient; ?>"/>
|
921 |
+
</form>
|
922 |
+
</div>
|
923 |
+
|
924 |
+
<div class="clear"></div>
|
925 |
+
</div>
|
926 |
+
<?php GAWD_helper::print_pro_popup(); ?>
|
927 |
+
<script>
|
928 |
+
jQuery('.gawd_chose_btn').on('click', function ()
|
929 |
+
{
|
930 |
+
permissions_popup_content(jQuery(this).attr('id'))
|
931 |
+
});
|
932 |
+
|
933 |
+
function permissions_popup_content(id)
|
934 |
+
{
|
935 |
+
var roles = <?php echo json_encode(new WP_Roles());?>;
|
936 |
+
var inp_id = 0;
|
937 |
+
var html = '';
|
938 |
+
var popup_overlay = 'gawd_permissions_popup_overlay';
|
939 |
+
var popup_body = 'gawd_permissions_popup';
|
940 |
+
var popup_btn = 'gawd_permission_popup_btn';
|
941 |
+
var add_role = 'add_roles';
|
942 |
+
var permissions_array = '';
|
943 |
+
jQuery("." + popup_body).fadeIn('fast');
|
944 |
+
jQuery("." + popup_overlay).fadeIn('fast');
|
945 |
+
|
946 |
+
if (id == "open_dashboard_report_permissions") {
|
947 |
+
permissions_array = 'gawd_backend_roles[]';
|
948 |
+
var permissions_for = 'gawd_backend_roles';
|
949 |
+
var open_popup_btn = 'open_dashboard_report_permissions';
|
950 |
+
var removed_roles = 'dashboard_report_permissions';
|
951 |
+
var remove_role = 'remove_dashboard_report_permission';
|
952 |
+
var role_value = 'dashboard_report_permission';
|
953 |
+
}
|
954 |
+
else
|
955 |
+
if (id == "open_frontend_report_permissions") {
|
956 |
+
permissions_array = 'gawd_frontend_roles[]';
|
957 |
+
var permissions_for = 'frontend_report_permissions';
|
958 |
+
var open_popup_btn = 'open_frontend_report_permissions';
|
959 |
+
var removed_roles = 'frontend_report_roles';
|
960 |
+
var remove_role = 'remove_frontend_report_role';
|
961 |
+
var role_value = 'frontend_report_role';
|
962 |
+
}
|
963 |
+
else
|
964 |
+
if (id == "post_page_report_permissions") {
|
965 |
+
permissions_array = 'gawd_post_page_roles[]';
|
966 |
+
var permissions_for = 'gawd_post_page_roles';
|
967 |
+
var open_popup_btn = 'post_page_report_permissions';
|
968 |
+
var removed_roles = 'gawd_post_page_roles';
|
969 |
+
var remove_role = 'remove_post_page_role';
|
970 |
+
var role_value = 'gawd_post_page_role';
|
971 |
+
}
|
972 |
+
else
|
973 |
+
if (id == "open_gawd_permissions") {
|
974 |
+
permissions_array = 'gawd_permissions[]';
|
975 |
+
var permissions_for = 'gawd_post_page_roles';
|
976 |
+
var open_popup_btn = 'open_gawd_permissions';
|
977 |
+
var removed_roles = 'gawd_permissions';
|
978 |
+
var remove_role = 'remove_gawd_permission';
|
979 |
+
var role_value = 'gawd_permission';
|
980 |
+
}
|
981 |
+
var check = [];
|
982 |
+
|
983 |
+
jQuery("." + role_value).each(function ()
|
984 |
+
{
|
985 |
+
check.push(jQuery(this).data('attribute'));
|
986 |
+
});
|
987 |
+
html += '<table border="1" class="gawd_table" id="' + id + '_table">';
|
988 |
+
html += '<tr><th>Name</th><th>Action</th></tr>';
|
989 |
+
for (key in roles.role_names) {
|
990 |
+
inp_id++;
|
991 |
+
var disabled = key == "administrator" || key == 'Administrator' ? "disabled" : "";
|
992 |
+
var checked = check.indexOf(key) > -1 || key == 'administrator' ? 'checked' : '';
|
993 |
+
var value = key;
|
994 |
+
var name = roles.role_names[key];
|
995 |
+
html += '<tr><td><label for="' + permissions_for + inp_id + '">' + name + '</label></td>';
|
996 |
+
html += '<td><input id="' + permissions_for + inp_id + '"' + disabled + ' class="gawd_perm" type="checkbox"' + checked + ' value="' + value + '"/></td></tr>';
|
997 |
+
}
|
998 |
+
html += '</table>';
|
999 |
+
jQuery('.gawd_permissions_popup_content').html(html);
|
1000 |
+
jQuery('.gawd_perm').on('click', function ()
|
1001 |
+
{
|
1002 |
+
if (jQuery(this).attr('checked') == 'checked') {
|
1003 |
+
jQuery(this).closest('tr').prevAll().find(".gawd_perm").attr('checked', true);
|
1004 |
+
}
|
1005 |
+
})
|
1006 |
+
popup_overlay = "." + popup_overlay;
|
1007 |
+
popup_btn = "." + popup_btn;
|
1008 |
+
popup_body = "." + popup_body;
|
1009 |
+
open_popup_btn = "#" + open_popup_btn;
|
1010 |
+
add_role = "#" + add_role;
|
1011 |
+
jQuery(popup_overlay + ', ' + popup_btn).on('click', function ()
|
1012 |
+
{
|
1013 |
+
jQuery(popup_body).fadeOut('fast');
|
1014 |
+
jQuery(popup_overlay).fadeOut('fast');
|
1015 |
+
});
|
1016 |
+
jQuery(add_role).unbind("click");
|
1017 |
+
jQuery(add_role).on('click', function (event)
|
1018 |
+
{
|
1019 |
+
event.preventDefault();
|
1020 |
+
jQuery(popup_body).fadeOut('fast');
|
1021 |
+
jQuery(popup_overlay).fadeOut('fast');
|
1022 |
+
var span = '';
|
1023 |
+
var display_name = "";
|
1024 |
+
var value = [];
|
1025 |
+
jQuery("#" + id + "_table input[type='checkbox']:checked").each(function ()
|
1026 |
+
{
|
1027 |
+
value.push(jQuery(this).val());
|
1028 |
+
display_name = jQuery(this).closest('tr').find('label').html();
|
1029 |
+
jQuery("." + removed_roles).remove();
|
1030 |
+
span += '<div class="time_wrap ' + removed_roles + '"><span data-attribute="' + jQuery(this).val() + '" class="' + role_value + '">' + display_name + '</span>';
|
1031 |
+
if (display_name.toLowerCase() != 'administrator') {
|
1032 |
+
span += '<span class="' + remove_role + '">X</span>'
|
1033 |
+
}
|
1034 |
+
span += '</div>';
|
1035 |
+
});
|
1036 |
+
|
1037 |
+
jQuery('#' + permissions_array.replace('[]', '')).val(value.join());
|
1038 |
+
jQuery(open_popup_btn).before(span);
|
1039 |
+
jQuery("." + remove_role).on('click', function ()
|
1040 |
+
{
|
1041 |
+
var find = jQuery(this).closest('.time_wrap').find("." + role_value).html();
|
1042 |
+
jQuery(this).closest('div').remove();
|
1043 |
+
|
1044 |
+
jQuery(popup_body + " .gawd_table input[type='checkbox']:checked").each(function ()
|
1045 |
+
{
|
1046 |
+
if (jQuery(this).val() == find) {
|
1047 |
+
jQuery(this).removeAttr('checked');
|
1048 |
+
}
|
1049 |
+
});
|
1050 |
+
var value = [];
|
1051 |
+
jQuery("." + role_value).each(function ()
|
1052 |
+
{
|
1053 |
+
value.push(jQuery(this).attr('data-attribute'));
|
1054 |
+
});
|
1055 |
+
jQuery('#' + permissions_array.replace('[]', '')).val(value.join());
|
1056 |
+
})
|
1057 |
+
});
|
1058 |
+
|
1059 |
+
jQuery("." + removed_roles).on('click', function ()
|
1060 |
+
{
|
1061 |
+
var find = jQuery(this).closest('.time_wrap').find(role_value).html();
|
1062 |
+
jQuery(this).closest('div').remove();
|
1063 |
+
|
1064 |
+
jQuery(popup_body + " .gawd_table input[type='checkbox']:checked").each(function ()
|
1065 |
+
{
|
1066 |
+
if (jQuery(this).val() == find) {
|
1067 |
+
jQuery(this).removeAttr('checked');
|
1068 |
+
}
|
1069 |
+
});
|
1070 |
+
var value = [];
|
1071 |
+
jQuery("." + role_value).each(function ()
|
1072 |
+
{
|
1073 |
+
value.push(jQuery(this).attr('data-attribute'));
|
1074 |
+
});
|
1075 |
+
jQuery('#' + permissions_array.replace('[]', '')).val(value.join());
|
1076 |
+
})
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
jQuery(".gawd_remove").on('click', function ()
|
1080 |
+
{
|
1081 |
+
var id = jQuery(this).closest('.time_wrap').attr('class').split(' ')[1];
|
1082 |
+
jQuery(this).closest('div').remove();
|
1083 |
+
var value = [];
|
1084 |
+
jQuery('.' + id.substring(0, id.length - 1)).each(function ()
|
1085 |
+
{
|
1086 |
+
value.push(jQuery(this).attr('data-attribute'));
|
1087 |
+
});
|
1088 |
+
if (id == 'dashboard_report_permissions') {
|
1089 |
+
id = 'gawd_backend_roles';
|
1090 |
+
} else
|
1091 |
+
if (id == "frontend_report_roles") {
|
1092 |
+
id = "gawd_frontend_roles";
|
1093 |
+
}
|
1094 |
+
jQuery('#' + id).val(value.join());
|
1095 |
+
})
|
1096 |
+
</script>
|
1097 |
+
|
admin/pages/tracking.php
CHANGED
@@ -1,336 +1,336 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (GAWD_helper::gawd_has_property() === false) {
|
4 |
-
require_once 'add_web_property.php';
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
8 |
-
|
9 |
-
$tracking_dimensions = array();
|
10 |
-
if (isset($gawd_user_data['property_id'])) {
|
11 |
-
$tracking_dimensions = GAWD_helper::get_custom_dimensions();
|
12 |
-
}
|
13 |
-
|
14 |
-
$supported_dimensions = GAWD_helper::get_supported_dimensions();
|
15 |
-
$ua_code = isset($gawd_user_data['property_id']) ? $gawd_user_data['property_id'] : '';
|
16 |
-
|
17 |
-
//$gawd_permissions = isset($gawd_settings['gawd_permissions']) ? $gawd_settings['gawd_permissions'] : array();
|
18 |
-
//$gawd_excluded_users = isset($gawd_settings['gawd_excluded_users']) ? $gawd_settings['gawd_excluded_users'] : array();
|
19 |
-
//$gawd_excluded_roles = isset($gawd_settings['gawd_excluded_roles']) ? $gawd_settings['gawd_excluded_roles'] : array();
|
20 |
-
//$gawd_backend_roles = isset($gawd_settings['gawd_backend_roles']) ? $gawd_settings['gawd_backend_roles'] : array();
|
21 |
-
//$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? $gawd_settings['gawd_frontend_roles'] : array();
|
22 |
-
$gawd_anonymize = isset($gawd_settings['gawd_anonymize']) ? $gawd_settings['gawd_anonymize'] : '';
|
23 |
-
$gawd_tracking_enable = isset($gawd_settings['gawd_tracking_enable']) ? $gawd_settings['gawd_tracking_enable'] : 'on';
|
24 |
-
$gawd_outbound = isset($gawd_settings['gawd_outbound']) ? $gawd_settings['gawd_outbound'] : '';
|
25 |
-
|
26 |
-
$gawd_enhanced = isset($gawd_settings['gawd_enhanced']) ? $gawd_settings['gawd_enhanced'] : '';
|
27 |
-
|
28 |
-
$enable_custom_code = isset($gawd_settings['enable_custom_code']) ? $gawd_settings['enable_custom_code'] : '';
|
29 |
-
$gawd_custom_code = isset($gawd_settings['gawd_custom_code']) ? $gawd_settings['gawd_custom_code'] : '';
|
30 |
-
|
31 |
-
//$gawd_file_formats = isset($gawd_settings['gawd_file_formats']) ? $gawd_settings['gawd_file_formats'] : '';
|
32 |
-
$gawd_tracking_enable = isset($_GET['enableTracking']) ? 'on' : $gawd_tracking_enable;
|
33 |
-
$domain = GAWD::get_domain(esc_html(get_option('siteurl')));
|
34 |
-
?>
|
35 |
-
|
36 |
-
|
37 |
-
<div class="gawd_tracking">
|
38 |
-
<div class="gawd_settings_wrapper">
|
39 |
-
<div class="settings_row">
|
40 |
-
<div class="onoffswitch">
|
41 |
-
<input type="checkbox" name="gawd_tracking_enable" class="onoffswitch-checkbox"
|
42 |
-
id="gawd_tracking_enable" <?php echo $gawd_tracking_enable != '' ? 'checked' : ''; ?>>
|
43 |
-
<label class="onoffswitch-label" for="gawd_tracking_enable">
|
44 |
-
<span class="onoffswitch-inner"></span>
|
45 |
-
<span class="onoffswitch-switch"></span>
|
46 |
-
</label>
|
47 |
-
</div>
|
48 |
-
<div class="gawd_info"
|
49 |
-
title="Enable this option to add Google Analytics tracking code into <head> tag of your website HTML."></div>
|
50 |
-
<div class="onoffswitch_text">
|
51 |
-
Enable Tracking
|
52 |
-
</div>
|
53 |
-
<div class="clear"></div>
|
54 |
-
</div>
|
55 |
-
<div class="settings_row independent_setting">
|
56 |
-
<div
|
57 |
-
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
58 |
-
<input type="checkbox" name="gawd_anonymize" class="onoffswitch-checkbox independent_input"
|
59 |
-
id="gawd_anonymize" <?php echo $gawd_anonymize != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
60 |
-
<label class="onoffswitch-label" for="gawd_anonymize">
|
61 |
-
<span class="onoffswitch-inner"></span>
|
62 |
-
<span class="onoffswitch-switch"></span>
|
63 |
-
</label>
|
64 |
-
</div>
|
65 |
-
<div class="gawd_info"
|
66 |
-
title="Turn this option on, in case you’d like to hide the last block of users’ IP addresses."></div>
|
67 |
-
<div class="onoffswitch_text">
|
68 |
-
Anonymize IP address
|
69 |
-
<span style="color:#dd0000;"> If disabled, you must inform website visitors according to GDPR.<span>
|
70 |
-
</div>
|
71 |
-
<div class="clear"></div>
|
72 |
-
</div>
|
73 |
-
<div class="settings_row independent_setting">
|
74 |
-
<div
|
75 |
-
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
76 |
-
<input type="checkbox" name="gawd_enhanced" class="onoffswitch-checkbox independent_input"
|
77 |
-
id="gawd_enhanced" <?php echo $gawd_enhanced != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
78 |
-
<label class="onoffswitch-label" for="gawd_enhanced">
|
79 |
-
<span class="onoffswitch-inner"></span>
|
80 |
-
<span class="onoffswitch-switch"></span>
|
81 |
-
</label>
|
82 |
-
</div>
|
83 |
-
<div class="gawd_info"
|
84 |
-
title="Enable this option to track multiple links with the same destination. Get information for buttons, menus, as well as elements with multiple destinations, e.g. search boxes."></div>
|
85 |
-
<div class="onoffswitch_text">
|
86 |
-
Enhanced Link Attribution
|
87 |
-
</div>
|
88 |
-
<div class="clear"></div>
|
89 |
-
</div>
|
90 |
-
<div class="settings_row independent_setting">
|
91 |
-
<div
|
92 |
-
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
93 |
-
<input type="checkbox" name="gawd_outbound" class="onoffswitch-checkbox independent_input"
|
94 |
-
id="gawd_outbound" <?php echo $gawd_outbound != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
95 |
-
<label class="onoffswitch-label" for="gawd_outbound">
|
96 |
-
<span class="onoffswitch-inner"></span>
|
97 |
-
<span class="onoffswitch-switch"></span>
|
98 |
-
</label>
|
99 |
-
</div>
|
100 |
-
<div class="gawd_info"
|
101 |
-
title="Turn outbound clicks tracking on to track the links users click to leave your website."></div>
|
102 |
-
<div class="onoffswitch_text">
|
103 |
-
Outbound clicks tracking
|
104 |
-
</div>
|
105 |
-
<div class="clear"></div>
|
106 |
-
</div>
|
107 |
-
<div class="settings_row independent_setting">
|
108 |
-
<div
|
109 |
-
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
110 |
-
<input type="checkbox" name="gawd_file_formats"
|
111 |
-
value="zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*"
|
112 |
-
class="onoffswitch-checkbox independent_input"
|
113 |
-
id="gawd_file_formats" <?php echo $gawd_file_formats != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
114 |
-
<label class="onoffswitch-label" for="gawd_file_formats">
|
115 |
-
<span class="onoffswitch-inner"></span>
|
116 |
-
<span class="onoffswitch-switch"></span>
|
117 |
-
</label>
|
118 |
-
</div>
|
119 |
-
<div class="gawd_info" title="Enable to track file downloads and mailing links."></div>
|
120 |
-
<div class="onoffswitch_text track_label">
|
121 |
-
Mailto, Download tracking (e.g. .doc, .pdf, .jpg)
|
122 |
-
</div>
|
123 |
-
<div class="clear"></div>
|
124 |
-
</div>
|
125 |
-
<div class="settings_row">
|
126 |
-
<div class="onoffswitch">
|
127 |
-
<input type="checkbox" name="enable_custom_code" class="onoffswitch-checkbox"
|
128 |
-
id="enable_custom_code" <?php echo $enable_custom_code != '' ? 'checked' : ''; ?>>
|
129 |
-
<label class="onoffswitch-label" for="enable_custom_code">
|
130 |
-
<span class="onoffswitch-inner"></span>
|
131 |
-
<span class="onoffswitch-switch"></span>
|
132 |
-
</label>
|
133 |
-
</div>
|
134 |
-
<div class="gawd_info" title="Enable adding custom code to tracking code."></div>
|
135 |
-
<div class="onoffswitch_text">
|
136 |
-
Enable custom code <span
|
137 |
-
style="color:#dd0000;"> Make sure the code is provided by a trustworthy source.<span>
|
138 |
-
</div>
|
139 |
-
<div class="clear"></div>
|
140 |
-
</div>
|
141 |
-
<?php
|
142 |
-
$custom_code_show = $enable_custom_code == '' ? 'style="display:none"' : '';
|
143 |
-
?>
|
144 |
-
<div id="gawd_custom_code" class="gawd_goal_row" <?php echo $custom_code_show; ?>>
|
145 |
-
<span class="gawd_goal_label">Custom Code</span>
|
146 |
-
<span class="gawd_goal_input">
|
147 |
-
<div class="time_input">
|
148 |
-
<textarea class="gawd_custom_code" name="gawd_custom_code"><?php echo $gawd_custom_code; ?></textarea>
|
149 |
-
</div>
|
150 |
-
</span>
|
151 |
-
<div class="gawd_info" title="Input the custom script to add to Google Analytics tracking code."></div>
|
152 |
-
<div class="clear"></div>
|
153 |
-
</div>
|
154 |
-
<div style="margin-top: 15px;">
|
155 |
-
<img class="gawd_pro_img" data-gawd-screenshot="custom_dimensions" src="<?php echo GAWD_URL . '/assets/free-pages/custom_dimensions.png'; ?>"/>
|
156 |
-
</div>
|
157 |
-
<div style="margin-top: 15px;">
|
158 |
-
<img class="gawd_pro_img" data-gawd-screenshot="exclude_tracking" src="<?php echo GAWD_URL . '/assets/free-pages/exclude_tracking.png'; ?>"/>
|
159 |
-
</div>
|
160 |
-
</div>
|
161 |
-
<input id="gawd_custom_dimension_id" name="gawd_custom_dimension_id" type="hidden"
|
162 |
-
value="<?php echo count($tracking_dimensions); ?>"/>
|
163 |
-
<div class="gawd_tracking_display">
|
164 |
-
<p>TRACKING CODE ADDED TO SITE:</p>
|
165 |
-
<div id="gawd_tracking_enable_code"
|
166 |
-
<?php if ('on' != $gawd_tracking_enable): ?>style="display: none;"<?php endif; ?>>
|
167 |
-
<code class="html"><script></code>
|
168 |
-
<code class="javascript">
|
169 |
-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
170 |
-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
171 |
-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
172 |
-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
173 |
-
<br/><br/>
|
174 |
-
ga('create', '<?php echo $ua_code ?>', 'auto');
|
175 |
-
</code>
|
176 |
-
<code id="enable_custom_code_code" class="javascript" <?php if ('on' != $enable_custom_code) {
|
177 |
-
; ?> style="display: none;"<?php }; ?>>
|
178 |
-
</br>
|
179 |
-
<?php echo "/*CUSTOM CODE START*/ </br>" . $gawd_custom_code . "</br>/*CUSTOM CODE END*/ </br>"; ?>
|
180 |
-
</code>
|
181 |
-
<code id="gawd_anonymize_code" class="javascript"
|
182 |
-
<?php if ('on' != $gawd_anonymize): ?>style="display: none;"<?php endif; ?>>
|
183 |
-
ga('set', 'anonymizeIp', true);
|
184 |
-
</code>
|
185 |
-
<code id="gawd_enhanced_code" class="javascript"
|
186 |
-
<?php if ('on' != $gawd_enhanced): ?>style="display: none;"<?php endif; ?>>
|
187 |
-
ga('require', 'linkid', 'linkid.js');
|
188 |
-
</code>
|
189 |
-
<code id="gawd_outbound_code"
|
190 |
-
class="javascript" <?php echo $gawd_outbound != '' && isset($domain) && $domain != '' ? '' : 'style="display: none;"'; ?>>
|
191 |
-
var links_out = document.querySelectorAll('a[href^="http"]');
|
192 |
-
links_out.forEach(function (link, key, listObj){
|
193 |
-
if (!link.href.match(/.*\.(zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*)(\?.*)?$/) {
|
194 |
-
if (link.href.indexOf('mysite.example') == -1) {
|
195 |
-
link.addEventListener('click', function (e){
|
196 |
-
ga('send', 'event', 'outbound', 'click', e.target.href, {'nonInteraction': 1});
|
197 |
-
});
|
198 |
-
});
|
199 |
-
}
|
200 |
-
}});
|
201 |
-
</code>
|
202 |
-
<code id="gawd_file_formats_code"
|
203 |
-
class="javascript" <?php echo isset($gawd_file_formats) && $gawd_file_formats != '' ? '' : 'style="display: none"'; ?>>
|
204 |
-
var links_download = document.querySelectorAll( 'a' );
|
205 |
-
links_download.forEach(function(link, key, listObj){
|
206 |
-
if (link.href.match(/.*\.(zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*)(\?.*)?$/)) {
|
207 |
-
link.addEventListener('click', function (e)
|
208 |
-
{
|
209 |
-
ga('send', 'event', 'download', 'click', e.target.href,{'nonInteraction': 1});
|
210 |
-
});
|
211 |
-
}
|
212 |
-
});
|
213 |
-
var links_mailto = document.querySelectorAll('a[href^="mailto"]');
|
214 |
-
links_mailto.forEach(function(link, key, listObj) {
|
215 |
-
link.addEventListener('click', function (e)
|
216 |
-
{
|
217 |
-
ga('send', 'event', 'email', 'send', e.target.href, {'nonInteraction': 1}";
|
218 |
-
});
|
219 |
-
});
|
220 |
-
});
|
221 |
-
</code>
|
222 |
-
<code class="javascript">
|
223 |
-
</br>
|
224 |
-
ga('send', 'pageview');
|
225 |
-
</code>
|
226 |
-
<code class="html"></script></code>
|
227 |
-
</div>
|
228 |
-
</div>
|
229 |
-
<div class="clear"></div>
|
230 |
-
</div>
|
231 |
-
|
232 |
-
<input type='hidden' name="gawd_settings_tab" id="gawd_settings_tab"/>
|
233 |
-
<input type='hidden' name="add_dimension_value" id="add_dimension_value"/>
|
234 |
-
<input type="hidden" id="gawd_excluded_roles_list" name="gawd_excluded_roles_list"
|
235 |
-
value="<?php echo implode(',', $gawd_excluded_roles); ?>"/>
|
236 |
-
<input type="hidden" id="gawd_excluded_users_list" name="gawd_excluded_users_list" value="<?php echo implode(',', $gawd_excluded_users); ?>" />
|
237 |
-
|
238 |
-
<div class="gawd_exclude_users_popup_overlay"></div>
|
239 |
-
<div class="gawd_exclude_users_popup">
|
240 |
-
<div class="close_btn_cont">
|
241 |
-
<div class="gawd_exclude_users_popup_btn">X</div>
|
242 |
-
</div>
|
243 |
-
<?php
|
244 |
-
$all_users = get_users();
|
245 |
-
|
246 |
-
if ($all_users) {
|
247 |
-
?>
|
248 |
-
<table border="1" class="gawd_table">
|
249 |
-
<tr>
|
250 |
-
<th>Name</th>
|
251 |
-
<th>Role</th>
|
252 |
-
<th>Action</th>
|
253 |
-
</tr>
|
254 |
-
<?php
|
255 |
-
$inp_id = 0;
|
256 |
-
foreach ($all_users as $user) {
|
257 |
-
$inp_id++;
|
258 |
-
?>
|
259 |
-
<tr>
|
260 |
-
<td>
|
261 |
-
<label for="gawd_excluded_users<?php echo $inp_id; ?>">
|
262 |
-
<?php echo $user->user_nicename; ?>
|
263 |
-
</label>
|
264 |
-
</td>
|
265 |
-
<td>
|
266 |
-
<?php
|
267 |
-
if(isset($user->roles[0])){
|
268 |
-
echo $user->roles[0];
|
269 |
-
}else{
|
270 |
-
echo "No role for this site";
|
271 |
-
}
|
272 |
-
?>
|
273 |
-
</td>
|
274 |
-
<td>
|
275 |
-
<input id="gawd_excluded_users<?php echo $inp_id; ?>" type="checkbox"
|
276 |
-
name="gawd_excluded_users[]" <?php echo in_array($user->user_nicename, $gawd_excluded_users) ? 'checked' : ''; ?>
|
277 |
-
value="<?php echo $user->user_nicename; ?>"/>
|
278 |
-
</td>
|
279 |
-
|
280 |
-
|
281 |
-
</tr>
|
282 |
-
<?php
|
283 |
-
}
|
284 |
-
?>
|
285 |
-
</table>
|
286 |
-
<div class="add_btn_cont">
|
287 |
-
<input type="button" class="button_gawd" id="gawd_add_users" value="Add"/>
|
288 |
-
</div>
|
289 |
-
<?php
|
290 |
-
}
|
291 |
-
?>
|
292 |
-
</div>
|
293 |
-
<div class="gawd_exclude_roles_popup_overlay"></div>
|
294 |
-
<div class="gawd_exclude_roles_popup">
|
295 |
-
<div class="close_btn_cont">
|
296 |
-
<div class="gawd_exclude_roles_popup_btn">X</div>
|
297 |
-
</div>
|
298 |
-
<?php
|
299 |
-
$roles = new WP_Roles();
|
300 |
-
if ($roles) {
|
301 |
-
?>
|
302 |
-
<table border="1" class="gawd_table">
|
303 |
-
<tr>
|
304 |
-
<th>Name</th>
|
305 |
-
<th>Action</th>
|
306 |
-
</tr>
|
307 |
-
<?php
|
308 |
-
$inp_id = 0;
|
309 |
-
foreach ($roles->role_names as $key => $name) {
|
310 |
-
$inp_id++;
|
311 |
-
?>
|
312 |
-
<tr>
|
313 |
-
<td>
|
314 |
-
<label for="user_type_inp<?php echo $inp_id; ?>">
|
315 |
-
<?php echo $name; ?>
|
316 |
-
</label>
|
317 |
-
</td>
|
318 |
-
|
319 |
-
<td>
|
320 |
-
<input id="user_type_inp<?php echo $inp_id; ?>" type="checkbox"
|
321 |
-
name="gawd_excluded_roles[]" <?php echo in_array($key, $gawd_excluded_roles) ? 'checked' : ''; ?>
|
322 |
-
value="<?php echo $key; ?>"/>
|
323 |
-
</td>
|
324 |
-
</tr>
|
325 |
-
<?php
|
326 |
-
}
|
327 |
-
?>
|
328 |
-
</table>
|
329 |
-
<div class="add_btn_cont">
|
330 |
-
<input type="button" class="button_gawd" id="gawd_add_roles" value="Add"/>
|
331 |
-
</div>
|
332 |
-
<?php
|
333 |
-
}
|
334 |
-
?>
|
335 |
-
</div>
|
336 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (GAWD_helper::gawd_has_property() === false) {
|
4 |
+
require_once 'add_web_property.php';
|
5 |
+
return;
|
6 |
+
}
|
7 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
8 |
+
|
9 |
+
$tracking_dimensions = array();
|
10 |
+
if (isset($gawd_user_data['property_id'])) {
|
11 |
+
$tracking_dimensions = GAWD_helper::get_custom_dimensions();
|
12 |
+
}
|
13 |
+
|
14 |
+
$supported_dimensions = GAWD_helper::get_supported_dimensions();
|
15 |
+
$ua_code = isset($gawd_user_data['property_id']) ? $gawd_user_data['property_id'] : '';
|
16 |
+
|
17 |
+
//$gawd_permissions = isset($gawd_settings['gawd_permissions']) ? $gawd_settings['gawd_permissions'] : array();
|
18 |
+
//$gawd_excluded_users = isset($gawd_settings['gawd_excluded_users']) ? $gawd_settings['gawd_excluded_users'] : array();
|
19 |
+
//$gawd_excluded_roles = isset($gawd_settings['gawd_excluded_roles']) ? $gawd_settings['gawd_excluded_roles'] : array();
|
20 |
+
//$gawd_backend_roles = isset($gawd_settings['gawd_backend_roles']) ? $gawd_settings['gawd_backend_roles'] : array();
|
21 |
+
//$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? $gawd_settings['gawd_frontend_roles'] : array();
|
22 |
+
$gawd_anonymize = isset($gawd_settings['gawd_anonymize']) ? $gawd_settings['gawd_anonymize'] : '';
|
23 |
+
$gawd_tracking_enable = isset($gawd_settings['gawd_tracking_enable']) ? $gawd_settings['gawd_tracking_enable'] : 'on';
|
24 |
+
$gawd_outbound = isset($gawd_settings['gawd_outbound']) ? $gawd_settings['gawd_outbound'] : '';
|
25 |
+
|
26 |
+
$gawd_enhanced = isset($gawd_settings['gawd_enhanced']) ? $gawd_settings['gawd_enhanced'] : '';
|
27 |
+
|
28 |
+
$enable_custom_code = isset($gawd_settings['enable_custom_code']) ? $gawd_settings['enable_custom_code'] : '';
|
29 |
+
$gawd_custom_code = isset($gawd_settings['gawd_custom_code']) ? $gawd_settings['gawd_custom_code'] : '';
|
30 |
+
|
31 |
+
//$gawd_file_formats = isset($gawd_settings['gawd_file_formats']) ? $gawd_settings['gawd_file_formats'] : '';
|
32 |
+
$gawd_tracking_enable = isset($_GET['enableTracking']) ? 'on' : $gawd_tracking_enable;
|
33 |
+
$domain = GAWD::get_domain(esc_html(get_option('siteurl')));
|
34 |
+
?>
|
35 |
+
|
36 |
+
|
37 |
+
<div class="gawd_tracking">
|
38 |
+
<div class="gawd_settings_wrapper">
|
39 |
+
<div class="settings_row">
|
40 |
+
<div class="onoffswitch">
|
41 |
+
<input type="checkbox" name="gawd_tracking_enable" class="onoffswitch-checkbox"
|
42 |
+
id="gawd_tracking_enable" <?php echo $gawd_tracking_enable != '' ? 'checked' : ''; ?>>
|
43 |
+
<label class="onoffswitch-label" for="gawd_tracking_enable">
|
44 |
+
<span class="onoffswitch-inner"></span>
|
45 |
+
<span class="onoffswitch-switch"></span>
|
46 |
+
</label>
|
47 |
+
</div>
|
48 |
+
<div class="gawd_info"
|
49 |
+
title="Enable this option to add Google Analytics tracking code into <head> tag of your website HTML."></div>
|
50 |
+
<div class="onoffswitch_text">
|
51 |
+
Enable Tracking
|
52 |
+
</div>
|
53 |
+
<div class="clear"></div>
|
54 |
+
</div>
|
55 |
+
<div class="settings_row independent_setting">
|
56 |
+
<div
|
57 |
+
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
58 |
+
<input type="checkbox" name="gawd_anonymize" class="onoffswitch-checkbox independent_input"
|
59 |
+
id="gawd_anonymize" <?php echo $gawd_anonymize != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
60 |
+
<label class="onoffswitch-label" for="gawd_anonymize">
|
61 |
+
<span class="onoffswitch-inner"></span>
|
62 |
+
<span class="onoffswitch-switch"></span>
|
63 |
+
</label>
|
64 |
+
</div>
|
65 |
+
<div class="gawd_info"
|
66 |
+
title="Turn this option on, in case you’d like to hide the last block of users’ IP addresses."></div>
|
67 |
+
<div class="onoffswitch_text">
|
68 |
+
Anonymize IP address
|
69 |
+
<span style="color:#dd0000;"> If disabled, you must inform website visitors according to GDPR.<span>
|
70 |
+
</div>
|
71 |
+
<div class="clear"></div>
|
72 |
+
</div>
|
73 |
+
<div class="settings_row independent_setting">
|
74 |
+
<div
|
75 |
+
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
76 |
+
<input type="checkbox" name="gawd_enhanced" class="onoffswitch-checkbox independent_input"
|
77 |
+
id="gawd_enhanced" <?php echo $gawd_enhanced != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
78 |
+
<label class="onoffswitch-label" for="gawd_enhanced">
|
79 |
+
<span class="onoffswitch-inner"></span>
|
80 |
+
<span class="onoffswitch-switch"></span>
|
81 |
+
</label>
|
82 |
+
</div>
|
83 |
+
<div class="gawd_info"
|
84 |
+
title="Enable this option to track multiple links with the same destination. Get information for buttons, menus, as well as elements with multiple destinations, e.g. search boxes."></div>
|
85 |
+
<div class="onoffswitch_text">
|
86 |
+
Enhanced Link Attribution
|
87 |
+
</div>
|
88 |
+
<div class="clear"></div>
|
89 |
+
</div>
|
90 |
+
<div class="settings_row independent_setting">
|
91 |
+
<div
|
92 |
+
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
93 |
+
<input type="checkbox" name="gawd_outbound" class="onoffswitch-checkbox independent_input"
|
94 |
+
id="gawd_outbound" <?php echo $gawd_outbound != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
95 |
+
<label class="onoffswitch-label" for="gawd_outbound">
|
96 |
+
<span class="onoffswitch-inner"></span>
|
97 |
+
<span class="onoffswitch-switch"></span>
|
98 |
+
</label>
|
99 |
+
</div>
|
100 |
+
<div class="gawd_info"
|
101 |
+
title="Turn outbound clicks tracking on to track the links users click to leave your website."></div>
|
102 |
+
<div class="onoffswitch_text">
|
103 |
+
Outbound clicks tracking
|
104 |
+
</div>
|
105 |
+
<div class="clear"></div>
|
106 |
+
</div>
|
107 |
+
<div class="settings_row independent_setting">
|
108 |
+
<div
|
109 |
+
class="onoffswitch <?php echo(($gawd_tracking_enable == '') ? 'onoffswitch_disabled' : ''); ?> independent_switch">
|
110 |
+
<input type="checkbox" name="gawd_file_formats"
|
111 |
+
value="zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*"
|
112 |
+
class="onoffswitch-checkbox independent_input"
|
113 |
+
id="gawd_file_formats" <?php echo $gawd_file_formats != '' ? 'checked' : ''; ?> <?php echo(($gawd_tracking_enable == '') ? 'disabled' : ''); ?>>
|
114 |
+
<label class="onoffswitch-label" for="gawd_file_formats">
|
115 |
+
<span class="onoffswitch-inner"></span>
|
116 |
+
<span class="onoffswitch-switch"></span>
|
117 |
+
</label>
|
118 |
+
</div>
|
119 |
+
<div class="gawd_info" title="Enable to track file downloads and mailing links."></div>
|
120 |
+
<div class="onoffswitch_text track_label">
|
121 |
+
Mailto, Download tracking (e.g. .doc, .pdf, .jpg)
|
122 |
+
</div>
|
123 |
+
<div class="clear"></div>
|
124 |
+
</div>
|
125 |
+
<div class="settings_row">
|
126 |
+
<div class="onoffswitch">
|
127 |
+
<input type="checkbox" name="enable_custom_code" class="onoffswitch-checkbox"
|
128 |
+
id="enable_custom_code" <?php echo $enable_custom_code != '' ? 'checked' : ''; ?>>
|
129 |
+
<label class="onoffswitch-label" for="enable_custom_code">
|
130 |
+
<span class="onoffswitch-inner"></span>
|
131 |
+
<span class="onoffswitch-switch"></span>
|
132 |
+
</label>
|
133 |
+
</div>
|
134 |
+
<div class="gawd_info" title="Enable adding custom code to tracking code."></div>
|
135 |
+
<div class="onoffswitch_text">
|
136 |
+
Enable custom code <span
|
137 |
+
style="color:#dd0000;"> Make sure the code is provided by a trustworthy source.<span>
|
138 |
+
</div>
|
139 |
+
<div class="clear"></div>
|
140 |
+
</div>
|
141 |
+
<?php
|
142 |
+
$custom_code_show = $enable_custom_code == '' ? 'style="display:none"' : '';
|
143 |
+
?>
|
144 |
+
<div id="gawd_custom_code" class="gawd_goal_row" <?php echo $custom_code_show; ?>>
|
145 |
+
<span class="gawd_goal_label">Custom Code</span>
|
146 |
+
<span class="gawd_goal_input">
|
147 |
+
<div class="time_input">
|
148 |
+
<textarea class="gawd_custom_code" name="gawd_custom_code"><?php echo $gawd_custom_code; ?></textarea>
|
149 |
+
</div>
|
150 |
+
</span>
|
151 |
+
<div class="gawd_info" title="Input the custom script to add to Google Analytics tracking code."></div>
|
152 |
+
<div class="clear"></div>
|
153 |
+
</div>
|
154 |
+
<div style="margin-top: 15px;">
|
155 |
+
<img class="gawd_pro_img" data-gawd-screenshot="custom_dimensions" src="<?php echo GAWD_URL . '/assets/free-pages/custom_dimensions.png'; ?>"/>
|
156 |
+
</div>
|
157 |
+
<div style="margin-top: 15px;">
|
158 |
+
<img class="gawd_pro_img" data-gawd-screenshot="exclude_tracking" src="<?php echo GAWD_URL . '/assets/free-pages/exclude_tracking.png'; ?>"/>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
<input id="gawd_custom_dimension_id" name="gawd_custom_dimension_id" type="hidden"
|
162 |
+
value="<?php echo count($tracking_dimensions); ?>"/>
|
163 |
+
<div class="gawd_tracking_display">
|
164 |
+
<p>TRACKING CODE ADDED TO SITE:</p>
|
165 |
+
<div id="gawd_tracking_enable_code"
|
166 |
+
<?php if ('on' != $gawd_tracking_enable): ?>style="display: none;"<?php endif; ?>>
|
167 |
+
<code class="html"><script></code>
|
168 |
+
<code class="javascript">
|
169 |
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
170 |
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
171 |
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
172 |
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
173 |
+
<br/><br/>
|
174 |
+
ga('create', '<?php echo $ua_code ?>', 'auto');
|
175 |
+
</code>
|
176 |
+
<code id="enable_custom_code_code" class="javascript" <?php if ('on' != $enable_custom_code) {
|
177 |
+
; ?> style="display: none;"<?php }; ?>>
|
178 |
+
</br>
|
179 |
+
<?php echo "/*CUSTOM CODE START*/ </br>" . $gawd_custom_code . "</br>/*CUSTOM CODE END*/ </br>"; ?>
|
180 |
+
</code>
|
181 |
+
<code id="gawd_anonymize_code" class="javascript"
|
182 |
+
<?php if ('on' != $gawd_anonymize): ?>style="display: none;"<?php endif; ?>>
|
183 |
+
ga('set', 'anonymizeIp', true);
|
184 |
+
</code>
|
185 |
+
<code id="gawd_enhanced_code" class="javascript"
|
186 |
+
<?php if ('on' != $gawd_enhanced): ?>style="display: none;"<?php endif; ?>>
|
187 |
+
ga('require', 'linkid', 'linkid.js');
|
188 |
+
</code>
|
189 |
+
<code id="gawd_outbound_code"
|
190 |
+
class="javascript" <?php echo $gawd_outbound != '' && isset($domain) && $domain != '' ? '' : 'style="display: none;"'; ?>>
|
191 |
+
var links_out = document.querySelectorAll('a[href^="http"]');
|
192 |
+
links_out.forEach(function (link, key, listObj){
|
193 |
+
if (!link.href.match(/.*\.(zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*)(\?.*)?$/) {
|
194 |
+
if (link.href.indexOf('mysite.example') == -1) {
|
195 |
+
link.addEventListener('click', function (e){
|
196 |
+
ga('send', 'event', 'outbound', 'click', e.target.href, {'nonInteraction': 1});
|
197 |
+
});
|
198 |
+
});
|
199 |
+
}
|
200 |
+
}});
|
201 |
+
</code>
|
202 |
+
<code id="gawd_file_formats_code"
|
203 |
+
class="javascript" <?php echo isset($gawd_file_formats) && $gawd_file_formats != '' ? '' : 'style="display: none"'; ?>>
|
204 |
+
var links_download = document.querySelectorAll( 'a' );
|
205 |
+
links_download.forEach(function(link, key, listObj){
|
206 |
+
if (link.href.match(/.*\.(zip|mp3*|mpe*g|pdf|docx*|pptx*|xlsx*|rar*)(\?.*)?$/)) {
|
207 |
+
link.addEventListener('click', function (e)
|
208 |
+
{
|
209 |
+
ga('send', 'event', 'download', 'click', e.target.href,{'nonInteraction': 1});
|
210 |
+
});
|
211 |
+
}
|
212 |
+
});
|
213 |
+
var links_mailto = document.querySelectorAll('a[href^="mailto"]');
|
214 |
+
links_mailto.forEach(function(link, key, listObj) {
|
215 |
+
link.addEventListener('click', function (e)
|
216 |
+
{
|
217 |
+
ga('send', 'event', 'email', 'send', e.target.href, {'nonInteraction': 1}";
|
218 |
+
});
|
219 |
+
});
|
220 |
+
});
|
221 |
+
</code>
|
222 |
+
<code class="javascript">
|
223 |
+
</br>
|
224 |
+
ga('send', 'pageview');
|
225 |
+
</code>
|
226 |
+
<code class="html"></script></code>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
<div class="clear"></div>
|
230 |
+
</div>
|
231 |
+
|
232 |
+
<input type='hidden' name="gawd_settings_tab" id="gawd_settings_tab"/>
|
233 |
+
<input type='hidden' name="add_dimension_value" id="add_dimension_value"/>
|
234 |
+
<input type="hidden" id="gawd_excluded_roles_list" name="gawd_excluded_roles_list"
|
235 |
+
value="<?php echo implode(',', $gawd_excluded_roles); ?>"/>
|
236 |
+
<input type="hidden" id="gawd_excluded_users_list" name="gawd_excluded_users_list" value="<?php echo implode(',', $gawd_excluded_users); ?>" />
|
237 |
+
|
238 |
+
<div class="gawd_exclude_users_popup_overlay"></div>
|
239 |
+
<div class="gawd_exclude_users_popup">
|
240 |
+
<div class="close_btn_cont">
|
241 |
+
<div class="gawd_exclude_users_popup_btn">X</div>
|
242 |
+
</div>
|
243 |
+
<?php
|
244 |
+
$all_users = get_users();
|
245 |
+
|
246 |
+
if ($all_users) {
|
247 |
+
?>
|
248 |
+
<table border="1" class="gawd_table">
|
249 |
+
<tr>
|
250 |
+
<th>Name</th>
|
251 |
+
<th>Role</th>
|
252 |
+
<th>Action</th>
|
253 |
+
</tr>
|
254 |
+
<?php
|
255 |
+
$inp_id = 0;
|
256 |
+
foreach ($all_users as $user) {
|
257 |
+
$inp_id++;
|
258 |
+
?>
|
259 |
+
<tr>
|
260 |
+
<td>
|
261 |
+
<label for="gawd_excluded_users<?php echo $inp_id; ?>">
|
262 |
+
<?php echo $user->user_nicename; ?>
|
263 |
+
</label>
|
264 |
+
</td>
|
265 |
+
<td>
|
266 |
+
<?php
|
267 |
+
if(isset($user->roles[0])){
|
268 |
+
echo $user->roles[0];
|
269 |
+
}else{
|
270 |
+
echo "No role for this site";
|
271 |
+
}
|
272 |
+
?>
|
273 |
+
</td>
|
274 |
+
<td>
|
275 |
+
<input id="gawd_excluded_users<?php echo $inp_id; ?>" type="checkbox"
|
276 |
+
name="gawd_excluded_users[]" <?php echo in_array($user->user_nicename, $gawd_excluded_users) ? 'checked' : ''; ?>
|
277 |
+
value="<?php echo $user->user_nicename; ?>"/>
|
278 |
+
</td>
|
279 |
+
|
280 |
+
|
281 |
+
</tr>
|
282 |
+
<?php
|
283 |
+
}
|
284 |
+
?>
|
285 |
+
</table>
|
286 |
+
<div class="add_btn_cont">
|
287 |
+
<input type="button" class="button_gawd" id="gawd_add_users" value="Add"/>
|
288 |
+
</div>
|
289 |
+
<?php
|
290 |
+
}
|
291 |
+
?>
|
292 |
+
</div>
|
293 |
+
<div class="gawd_exclude_roles_popup_overlay"></div>
|
294 |
+
<div class="gawd_exclude_roles_popup">
|
295 |
+
<div class="close_btn_cont">
|
296 |
+
<div class="gawd_exclude_roles_popup_btn">X</div>
|
297 |
+
</div>
|
298 |
+
<?php
|
299 |
+
$roles = new WP_Roles();
|
300 |
+
if ($roles) {
|
301 |
+
?>
|
302 |
+
<table border="1" class="gawd_table">
|
303 |
+
<tr>
|
304 |
+
<th>Name</th>
|
305 |
+
<th>Action</th>
|
306 |
+
</tr>
|
307 |
+
<?php
|
308 |
+
$inp_id = 0;
|
309 |
+
foreach ($roles->role_names as $key => $name) {
|
310 |
+
$inp_id++;
|
311 |
+
?>
|
312 |
+
<tr>
|
313 |
+
<td>
|
314 |
+
<label for="user_type_inp<?php echo $inp_id; ?>">
|
315 |
+
<?php echo $name; ?>
|
316 |
+
</label>
|
317 |
+
</td>
|
318 |
+
|
319 |
+
<td>
|
320 |
+
<input id="user_type_inp<?php echo $inp_id; ?>" type="checkbox"
|
321 |
+
name="gawd_excluded_roles[]" <?php echo in_array($key, $gawd_excluded_roles) ? 'checked' : ''; ?>
|
322 |
+
value="<?php echo $key; ?>"/>
|
323 |
+
</td>
|
324 |
+
</tr>
|
325 |
+
<?php
|
326 |
+
}
|
327 |
+
?>
|
328 |
+
</table>
|
329 |
+
<div class="add_btn_cont">
|
330 |
+
<input type="button" class="button_gawd" id="gawd_add_roles" value="Add"/>
|
331 |
+
</div>
|
332 |
+
<?php
|
333 |
+
}
|
334 |
+
?>
|
335 |
+
</div>
|
336 |
+
|
admin/pages/uninstall.php
CHANGED
@@ -1,132 +1,132 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class GAWDUninstall{
|
4 |
-
|
5 |
-
public function uninstall(){
|
6 |
-
?>
|
7 |
-
<form method="post" action="" id="adminForm">
|
8 |
-
<div class="gawd">
|
9 |
-
<h2>
|
10 |
-
<img src="<?php echo GAWD_URL . '/assets/uninstall-icon.png';?>" width="30" style="vertical-align:middle;">
|
11 |
-
<span><?php _e("Uninstall 10Web Analytics","gawd"); ?></span>
|
12 |
-
</h2>
|
13 |
-
<div class="goodbye-text">
|
14 |
-
<?php
|
15 |
-
$support_team = '<a href="https://help.10web.io/hc/en-us/requests/new" target="_blank">' . __('support team', 'gawd') . '</a>';
|
16 |
-
$contact_us = '<a href="https://help.10web.io/hc/en-us/requests/new" target="_blank">' . __('Contact us', 'gawd') . '</a>';
|
17 |
-
?>
|
18 |
-
Before uninstalling the plugin, please contact <?php echo $support_team; ?>. We'll do our best to assist you with your request.<br/>
|
19 |
-
However, if you have made a decision to uninstall Google Analytics plugin, we would be happy to hear your feedback and comments on further improvement of the product.
|
20 |
-
</div>
|
21 |
-
<p style="color: red;">
|
22 |
-
<strong><?php _e("WARNING:","gawd"); ?></strong>
|
23 |
-
Uninstalling Google Analytics will completely remove all its data. This includes deleting tracking code and resetting all options to their defaults.<br/>
|
24 |
-
Please make sure you don’t have any important information before you proceed.
|
25 |
-
</p>
|
26 |
-
<p style="color: red">
|
27 |
-
<strong><?php _e("The following database options will be deleted:","gawd"); ?></strong>
|
28 |
-
</p>
|
29 |
-
<table class="widefat">
|
30 |
-
<thead>
|
31 |
-
<tr>
|
32 |
-
<th><?php _e("Database options","gawd"); ?></th>
|
33 |
-
</tr>
|
34 |
-
</thead>
|
35 |
-
<tr>
|
36 |
-
<td valign="top">
|
37 |
-
<ol>
|
38 |
-
<li>gawd_menu_for_user</li>
|
39 |
-
<li>gawd_all_metrics</li>
|
40 |
-
<li>gawd_all_dimensions</li>
|
41 |
-
<li>gawd_custom_dimensions</li>
|
42 |
-
<li>gawd_settings</li>
|
43 |
-
<li>gawd_user_data</li>
|
44 |
-
<li>gawd_credentials</li>
|
45 |
-
<li>gawd_menu_items</li>
|
46 |
-
<li>gawd_export_chart_data</li>
|
47 |
-
<li>gawd_email</li>
|
48 |
-
<li>gawd_alerts</li>
|
49 |
-
<li>gawd_pushovers</li>
|
50 |
-
<li>gawd_menu_for_users</li>
|
51 |
-
<li>gawd_own_project</li>
|
52 |
-
<li>gawd_zoom_message</li>
|
53 |
-
</ol>
|
54 |
-
</td>
|
55 |
-
</tr>
|
56 |
-
|
57 |
-
</table>
|
58 |
-
<p style="text-align: center;"> <?php _e("Are you sure you want to uninstall Google Analytics plugin?","gawd"); ?></p>
|
59 |
-
<p style="text-align: center;">
|
60 |
-
<input type="checkbox" name="unistall_gawd" id="check_yes" value="yes" />
|
61 |
-
<label for="check_yes"><?php _e("Yes","gawd"); ?></label>
|
62 |
-
</p>
|
63 |
-
<p style="text-align: center;">
|
64 |
-
<input type="button" id="gawd_uninstall" value="<?php _e("UNINSTALL","gawd"); ?>" onclick="if (check_yes.checked) {
|
65 |
-
if (confirm('You are About to Uninstall 10Web Analytics from WordPress.\nThis Action Is Not Reversible.')) {
|
66 |
-
jQuery('#adminForm').submit();;
|
67 |
-
} else {
|
68 |
-
return false;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
else {
|
72 |
-
return false;
|
73 |
-
}" class="wd-btn wd-btn-primary" />
|
74 |
-
</p>
|
75 |
-
</div>
|
76 |
-
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_field'); ?>
|
77 |
-
</form>
|
78 |
-
<?php
|
79 |
-
}
|
80 |
-
|
81 |
-
public function delete_options(){
|
82 |
-
global $wpdb;
|
83 |
-
check_admin_referer('gawd_save_form', 'gawd_save_form_field');
|
84 |
-
$wpdb->query("DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE '%gawd%'");
|
85 |
-
|
86 |
-
$this->delete_upload_dir();
|
87 |
-
|
88 |
-
set_site_transient('gawd_uninstall', '1', 5 * 60);
|
89 |
-
}
|
90 |
-
|
91 |
-
public function delete_upload_dir(){
|
92 |
-
$upload_dir = wp_get_upload_dir();
|
93 |
-
if(empty($upload_dir['basedir'])){
|
94 |
-
return;
|
95 |
-
}
|
96 |
-
|
97 |
-
$upload_dir = $upload_dir['basedir'] . '/wd-google-analytics/';
|
98 |
-
$this->delete_dir($upload_dir);
|
99 |
-
}
|
100 |
-
|
101 |
-
private function delete_dir($dir){
|
102 |
-
|
103 |
-
if(empty($dir)) {
|
104 |
-
return;
|
105 |
-
}
|
106 |
-
|
107 |
-
if(substr($dir, -1) !== '/') {
|
108 |
-
$dir .= '/';
|
109 |
-
}
|
110 |
-
|
111 |
-
$dir_info = scandir($dir);
|
112 |
-
|
113 |
-
foreach($dir_info as $item) {
|
114 |
-
|
115 |
-
if($item == '.' || $item == '..') {
|
116 |
-
continue;
|
117 |
-
}
|
118 |
-
|
119 |
-
$new_dir = $dir . $item;
|
120 |
-
|
121 |
-
if(is_dir($new_dir)) {
|
122 |
-
$this->delete_dir($new_dir);
|
123 |
-
} else {
|
124 |
-
unlink($new_dir);
|
125 |
-
}
|
126 |
-
|
127 |
-
}
|
128 |
-
|
129 |
-
rmdir($dir);
|
130 |
-
}
|
131 |
-
|
132 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class GAWDUninstall{
|
4 |
+
|
5 |
+
public function uninstall(){
|
6 |
+
?>
|
7 |
+
<form method="post" action="" id="adminForm">
|
8 |
+
<div class="gawd">
|
9 |
+
<h2>
|
10 |
+
<img src="<?php echo GAWD_URL . '/assets/uninstall-icon.png';?>" width="30" style="vertical-align:middle;">
|
11 |
+
<span><?php _e("Uninstall 10Web Analytics","gawd"); ?></span>
|
12 |
+
</h2>
|
13 |
+
<div class="goodbye-text">
|
14 |
+
<?php
|
15 |
+
$support_team = '<a href="https://help.10web.io/hc/en-us/requests/new" target="_blank">' . __('support team', 'gawd') . '</a>';
|
16 |
+
$contact_us = '<a href="https://help.10web.io/hc/en-us/requests/new" target="_blank">' . __('Contact us', 'gawd') . '</a>';
|
17 |
+
?>
|
18 |
+
Before uninstalling the plugin, please contact <?php echo $support_team; ?>. We'll do our best to assist you with your request.<br/>
|
19 |
+
However, if you have made a decision to uninstall Google Analytics plugin, we would be happy to hear your feedback and comments on further improvement of the product.
|
20 |
+
</div>
|
21 |
+
<p style="color: red;">
|
22 |
+
<strong><?php _e("WARNING:","gawd"); ?></strong>
|
23 |
+
Uninstalling Google Analytics will completely remove all its data. This includes deleting tracking code and resetting all options to their defaults.<br/>
|
24 |
+
Please make sure you don’t have any important information before you proceed.
|
25 |
+
</p>
|
26 |
+
<p style="color: red">
|
27 |
+
<strong><?php _e("The following database options will be deleted:","gawd"); ?></strong>
|
28 |
+
</p>
|
29 |
+
<table class="widefat">
|
30 |
+
<thead>
|
31 |
+
<tr>
|
32 |
+
<th><?php _e("Database options","gawd"); ?></th>
|
33 |
+
</tr>
|
34 |
+
</thead>
|
35 |
+
<tr>
|
36 |
+
<td valign="top">
|
37 |
+
<ol>
|
38 |
+
<li>gawd_menu_for_user</li>
|
39 |
+
<li>gawd_all_metrics</li>
|
40 |
+
<li>gawd_all_dimensions</li>
|
41 |
+
<li>gawd_custom_dimensions</li>
|
42 |
+
<li>gawd_settings</li>
|
43 |
+
<li>gawd_user_data</li>
|
44 |
+
<li>gawd_credentials</li>
|
45 |
+
<li>gawd_menu_items</li>
|
46 |
+
<li>gawd_export_chart_data</li>
|
47 |
+
<li>gawd_email</li>
|
48 |
+
<li>gawd_alerts</li>
|
49 |
+
<li>gawd_pushovers</li>
|
50 |
+
<li>gawd_menu_for_users</li>
|
51 |
+
<li>gawd_own_project</li>
|
52 |
+
<li>gawd_zoom_message</li>
|
53 |
+
</ol>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
|
57 |
+
</table>
|
58 |
+
<p style="text-align: center;"> <?php _e("Are you sure you want to uninstall Google Analytics plugin?","gawd"); ?></p>
|
59 |
+
<p style="text-align: center;">
|
60 |
+
<input type="checkbox" name="unistall_gawd" id="check_yes" value="yes" />
|
61 |
+
<label for="check_yes"><?php _e("Yes","gawd"); ?></label>
|
62 |
+
</p>
|
63 |
+
<p style="text-align: center;">
|
64 |
+
<input type="button" id="gawd_uninstall" value="<?php _e("UNINSTALL","gawd"); ?>" onclick="if (check_yes.checked) {
|
65 |
+
if (confirm('You are About to Uninstall 10Web Analytics from WordPress.\nThis Action Is Not Reversible.')) {
|
66 |
+
jQuery('#adminForm').submit();;
|
67 |
+
} else {
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
else {
|
72 |
+
return false;
|
73 |
+
}" class="wd-btn wd-btn-primary" />
|
74 |
+
</p>
|
75 |
+
</div>
|
76 |
+
<?php wp_nonce_field('gawd_save_form', 'gawd_save_form_field'); ?>
|
77 |
+
</form>
|
78 |
+
<?php
|
79 |
+
}
|
80 |
+
|
81 |
+
public function delete_options(){
|
82 |
+
global $wpdb;
|
83 |
+
check_admin_referer('gawd_save_form', 'gawd_save_form_field');
|
84 |
+
$wpdb->query("DELETE FROM {$wpdb->prefix}options WHERE option_name LIKE '%gawd%'");
|
85 |
+
|
86 |
+
$this->delete_upload_dir();
|
87 |
+
|
88 |
+
set_site_transient('gawd_uninstall', '1', 5 * 60);
|
89 |
+
}
|
90 |
+
|
91 |
+
public function delete_upload_dir(){
|
92 |
+
$upload_dir = wp_get_upload_dir();
|
93 |
+
if(empty($upload_dir['basedir'])){
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
$upload_dir = $upload_dir['basedir'] . '/wd-google-analytics/';
|
98 |
+
$this->delete_dir($upload_dir);
|
99 |
+
}
|
100 |
+
|
101 |
+
private function delete_dir($dir){
|
102 |
+
|
103 |
+
if(empty($dir)) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
if(substr($dir, -1) !== '/') {
|
108 |
+
$dir .= '/';
|
109 |
+
}
|
110 |
+
|
111 |
+
$dir_info = scandir($dir);
|
112 |
+
|
113 |
+
foreach($dir_info as $item) {
|
114 |
+
|
115 |
+
if($item == '.' || $item == '..') {
|
116 |
+
continue;
|
117 |
+
}
|
118 |
+
|
119 |
+
$new_dir = $dir . $item;
|
120 |
+
|
121 |
+
if(is_dir($new_dir)) {
|
122 |
+
$this->delete_dir($new_dir);
|
123 |
+
} else {
|
124 |
+
unlink($new_dir);
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
128 |
+
|
129 |
+
rmdir($dir);
|
130 |
+
}
|
131 |
+
|
132 |
}
|
admin/tracking.php
CHANGED
@@ -1,183 +1,183 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
//todo change to class
|
4 |
-
$custom_dimensions = GAWD_helper::get_custom_dimensions();
|
5 |
-
|
6 |
-
$gawd_settings = get_option('gawd_settings');
|
7 |
-
$enable_custom_code = isset($gawd_settings['enable_custom_code']) ? $gawd_settings['enable_custom_code'] : '';
|
8 |
-
|
9 |
-
$gawd_custom_code = isset($gawd_settings["gawd_custom_code"]) ? $gawd_settings["gawd_custom_code"] : '';
|
10 |
-
$gawd_enhanced = isset($gawd_settings['gawd_enhanced']) ? $gawd_settings['gawd_enhanced'] : '';
|
11 |
-
|
12 |
-
$domain = GAWD::get_domain(esc_html(get_option('siteurl')));
|
13 |
-
$current_user = '';
|
14 |
-
if(get_current_user_id() != 0) {
|
15 |
-
$current_user = wp_get_current_user();
|
16 |
-
$current_user = $current_user->data->user_nicename;
|
17 |
-
}
|
18 |
-
|
19 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
20 |
-
$ua_code = isset($gawd_user_data['property_id']) ? $gawd_user_data['property_id'] : '';
|
21 |
-
if(!isset($gawd_settings['gawd_excluded_users'])) {
|
22 |
-
$gawd_settings['gawd_excluded_users'] = array();
|
23 |
-
}
|
24 |
-
/* TRACKING CODE ADD */
|
25 |
-
if(in_array($current_user, $gawd_settings['gawd_excluded_users'])) {
|
26 |
-
return;
|
27 |
-
}
|
28 |
-
if(isset($gawd_settings['gawd_excluded_roles'])) {
|
29 |
-
if(GAWD::gawd_roles($gawd_settings['gawd_excluded_roles'], true)) {
|
30 |
-
return;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
$cross_domain_list = '';
|
35 |
-
if(isset($gawd_settings['enable_cross_domain']) && isset($gawd_settings['cross_domains']) && $gawd_settings['cross_domains'] != '' && $gawd_settings['enable_cross_domain'] != '') {
|
36 |
-
$cross_domain_list = $gawd_settings['cross_domains'];
|
37 |
-
}
|
38 |
-
$gawd_outbound = isset($gawd_settings['gawd_outbound']) ? $gawd_settings['gawd_outbound'] : '';
|
39 |
-
|
40 |
-
?>
|
41 |
-
|
42 |
-
|
43 |
-
<script>
|
44 |
-
<?php if ('on' == $gawd_settings['gawd_tracking_enable']) {
|
45 |
-
?>
|
46 |
-
(function (i, s, o, g, r, a, m) {
|
47 |
-
i['GoogleAnalyticsObject'] = r;
|
48 |
-
i[r] = i[r] || function () {
|
49 |
-
(i[r].q = i[r].q || []).push(arguments)
|
50 |
-
}, i[r].l = 1 * new Date();
|
51 |
-
a = s.createElement(o),
|
52 |
-
m = s.getElementsByTagName(o)[0];
|
53 |
-
a.async = 1;
|
54 |
-
a.src = g;
|
55 |
-
m.parentNode.insertBefore(a, m)
|
56 |
-
})
|
57 |
-
(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
58 |
-
ga('create', '<?php echo $ua_code ?>', 'auto', {
|
59 |
-
'siteSpeedSampleRate': '<?php echo isset($gawd_settings['site_speed_rate']) ? $gawd_settings['site_speed_rate'] : 1; ?>' <?php echo $cross_domain_list != '' ? ",'allowLinker' : true" : ""; ?>
|
60 |
-
});
|
61 |
-
<?php if($gawd_enhanced === 'on'){ ?>
|
62 |
-
ga('require', 'linkid', 'linkid.js');
|
63 |
-
<?php }
|
64 |
-
if ($cross_domain_list != '') { ?>
|
65 |
-
ga('require', 'linker');
|
66 |
-
ga('linker:autoLink', [' <?php echo $cross_domain_list; ?>']);
|
67 |
-
<?php }
|
68 |
-
if (isset($gawd_settings['gawd_anonymize']) && 'on' == $gawd_settings['gawd_anonymize']){ ?>
|
69 |
-
ga('set', 'anonymizeIp', true);
|
70 |
-
<?php }
|
71 |
-
|
72 |
-
foreach($custom_dimensions as $custom_dimension) {
|
73 |
-
|
74 |
-
$optname = 'gawd_custom_dimension_' . str_replace(' ', '_', $custom_dimension['name']);
|
75 |
-
if($gawd_settings[$optname] !== 'on') {
|
76 |
-
continue;
|
77 |
-
}
|
78 |
-
|
79 |
-
$custom_dimension_value = "";
|
80 |
-
switch($custom_dimension['name']) {
|
81 |
-
case 'Logged in':
|
82 |
-
$custom_dimension_value = (is_user_logged_in()) ? "yes" : "no";
|
83 |
-
break;
|
84 |
-
case 'Post type':
|
85 |
-
$custom_dimension_value = GAWD_helper::get_post_type();
|
86 |
-
break;
|
87 |
-
case 'Author':
|
88 |
-
$custom_dimension_value = GAWD_helper::get_author_nickname();
|
89 |
-
break;
|
90 |
-
case 'Category':
|
91 |
-
$custom_dimension_value = GAWD_helper::get_categories();
|
92 |
-
break;
|
93 |
-
case 'Published Month':
|
94 |
-
$custom_dimension_value = GAWD_helper::get_published_month();
|
95 |
-
break;
|
96 |
-
case 'Published Year':
|
97 |
-
$custom_dimension_value = GAWD_helper::get_published_year();
|
98 |
-
break;
|
99 |
-
case 'Tags': {
|
100 |
-
$custom_dimension_value = GAWD_helper::get_tags();
|
101 |
-
break;
|
102 |
-
}
|
103 |
-
}
|
104 |
-
|
105 |
-
if(!empty($custom_dimension_value)) {
|
106 |
-
echo "ga('set', 'dimension" . $custom_dimension['id'] . "', '" . $custom_dimension_value . "');\n";
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
if($enable_custom_code == 'on') {
|
111 |
-
echo "/*CUSTOM CODE START*/" . $gawd_custom_code . "/*CUSTOM CODE END*/";
|
112 |
-
} ?>
|
113 |
-
ga('send', 'pageview');
|
114 |
-
<?php }
|
115 |
-
|
116 |
-
$download_script = (isset($gawd_settings['gawd_file_formats']) && $gawd_settings['gawd_file_formats'] != '');
|
117 |
-
$links_script = ($gawd_outbound != '' && isset($domain) && $domain);
|
118 |
-
$adsence_acc_linking = (isset($gawd_settings['adsense_acc_linking']) && $gawd_settings['adsense_acc_linking'] != '');
|
119 |
-
|
120 |
-
if($download_script || $links_script || $adsence_acc_linking){ ?>
|
121 |
-
document.addEventListener("DOMContentLoaded", function (event) {
|
122 |
-
window.addEventListener('load', function () {
|
123 |
-
|
124 |
-
|
125 |
-
<?php
|
126 |
-
if($download_script === true){ ?>
|
127 |
-
|
128 |
-
//Track Downloads
|
129 |
-
var links_download = document.querySelectorAll('a');
|
130 |
-
links_download.forEach(function (link, key, listObj) {
|
131 |
-
if (link.href.match(/.*\.(<?php echo esc_js($gawd_settings['gawd_file_formats']); ?>)(\?.*)?$/)) {
|
132 |
-
link.addEventListener('click', function (e) {
|
133 |
-
ga('send', 'event', 'download', 'click', e.target.href<?php
|
134 |
-
if(isset($gawd_settings['exclude_events']) && $gawd_settings['exclude_events']) {
|
135 |
-
echo ", {'nonInteraction': 1}";
|
136 |
-
}
|
137 |
-
?>);
|
138 |
-
});
|
139 |
-
}
|
140 |
-
});
|
141 |
-
|
142 |
-
|
143 |
-
//Track Mailto
|
144 |
-
var links_mailto = document.querySelectorAll('a[href^="mailto"]');
|
145 |
-
links_mailto.forEach(function (link, key, listObj) {
|
146 |
-
|
147 |
-
|
148 |
-
link.addEventListener('click', function (e) {
|
149 |
-
ga('send', 'event', 'email', 'send', e.target.href<?php
|
150 |
-
if(isset($gawd_settings['exclude_events']) && $gawd_settings['exclude_events']) {
|
151 |
-
echo ", {'nonInteraction': 1}";
|
152 |
-
}
|
153 |
-
?>);
|
154 |
-
});
|
155 |
-
});
|
156 |
-
<?php }
|
157 |
-
|
158 |
-
if($links_script === true){ ?>
|
159 |
-
//Track Outbound Links
|
160 |
-
var links_out = document.querySelectorAll('a[href^="http"]');
|
161 |
-
links_out.forEach(function (link, key, listObj) {
|
162 |
-
if (!link.href.match(/.*\.(<?php echo esc_js(isset($gawd_settings['gawd_file_formats']) && $gawd_settings['gawd_file_formats'] != ''); ?>)(\?.*)?$/)) {
|
163 |
-
if (link.href.indexOf('<?php echo $domain; ?>') == -1) {
|
164 |
-
link.addEventListener('click', function (e) {
|
165 |
-
ga('send', 'event', 'outbound', 'click', e.target.href<?php
|
166 |
-
if(isset($gawd_settings['exclude_events']) && $gawd_settings['exclude_events']) {
|
167 |
-
echo ", {'nonInteraction': 1}";
|
168 |
-
}
|
169 |
-
?>);
|
170 |
-
});
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
|
175 |
-
});
|
176 |
-
<?php }
|
177 |
-
if ($adsence_acc_linking) { ?>
|
178 |
-
window.google_analytics_uacct = "<?php echo esc_html($ua_code); ?>";
|
179 |
-
<?php }?>
|
180 |
-
});
|
181 |
-
});
|
182 |
-
<?php } ?>
|
183 |
</script>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//todo change to class
|
4 |
+
$custom_dimensions = GAWD_helper::get_custom_dimensions();
|
5 |
+
|
6 |
+
$gawd_settings = get_option('gawd_settings');
|
7 |
+
$enable_custom_code = isset($gawd_settings['enable_custom_code']) ? $gawd_settings['enable_custom_code'] : '';
|
8 |
+
|
9 |
+
$gawd_custom_code = isset($gawd_settings["gawd_custom_code"]) ? $gawd_settings["gawd_custom_code"] : '';
|
10 |
+
$gawd_enhanced = isset($gawd_settings['gawd_enhanced']) ? $gawd_settings['gawd_enhanced'] : '';
|
11 |
+
|
12 |
+
$domain = GAWD::get_domain(esc_html(get_option('siteurl')));
|
13 |
+
$current_user = '';
|
14 |
+
if(get_current_user_id() != 0) {
|
15 |
+
$current_user = wp_get_current_user();
|
16 |
+
$current_user = $current_user->data->user_nicename;
|
17 |
+
}
|
18 |
+
|
19 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
20 |
+
$ua_code = isset($gawd_user_data['property_id']) ? $gawd_user_data['property_id'] : '';
|
21 |
+
if(!isset($gawd_settings['gawd_excluded_users'])) {
|
22 |
+
$gawd_settings['gawd_excluded_users'] = array();
|
23 |
+
}
|
24 |
+
/* TRACKING CODE ADD */
|
25 |
+
if(in_array($current_user, $gawd_settings['gawd_excluded_users'])) {
|
26 |
+
return;
|
27 |
+
}
|
28 |
+
if(isset($gawd_settings['gawd_excluded_roles'])) {
|
29 |
+
if(GAWD::gawd_roles($gawd_settings['gawd_excluded_roles'], true)) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
$cross_domain_list = '';
|
35 |
+
if(isset($gawd_settings['enable_cross_domain']) && isset($gawd_settings['cross_domains']) && $gawd_settings['cross_domains'] != '' && $gawd_settings['enable_cross_domain'] != '') {
|
36 |
+
$cross_domain_list = $gawd_settings['cross_domains'];
|
37 |
+
}
|
38 |
+
$gawd_outbound = isset($gawd_settings['gawd_outbound']) ? $gawd_settings['gawd_outbound'] : '';
|
39 |
+
|
40 |
+
?>
|
41 |
+
|
42 |
+
|
43 |
+
<script>
|
44 |
+
<?php if ('on' == $gawd_settings['gawd_tracking_enable']) {
|
45 |
+
?>
|
46 |
+
(function (i, s, o, g, r, a, m) {
|
47 |
+
i['GoogleAnalyticsObject'] = r;
|
48 |
+
i[r] = i[r] || function () {
|
49 |
+
(i[r].q = i[r].q || []).push(arguments)
|
50 |
+
}, i[r].l = 1 * new Date();
|
51 |
+
a = s.createElement(o),
|
52 |
+
m = s.getElementsByTagName(o)[0];
|
53 |
+
a.async = 1;
|
54 |
+
a.src = g;
|
55 |
+
m.parentNode.insertBefore(a, m)
|
56 |
+
})
|
57 |
+
(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
|
58 |
+
ga('create', '<?php echo $ua_code ?>', 'auto', {
|
59 |
+
'siteSpeedSampleRate': '<?php echo isset($gawd_settings['site_speed_rate']) ? $gawd_settings['site_speed_rate'] : 1; ?>' <?php echo $cross_domain_list != '' ? ",'allowLinker' : true" : ""; ?>
|
60 |
+
});
|
61 |
+
<?php if($gawd_enhanced === 'on'){ ?>
|
62 |
+
ga('require', 'linkid', 'linkid.js');
|
63 |
+
<?php }
|
64 |
+
if ($cross_domain_list != '') { ?>
|
65 |
+
ga('require', 'linker');
|
66 |
+
ga('linker:autoLink', [' <?php echo $cross_domain_list; ?>']);
|
67 |
+
<?php }
|
68 |
+
if (isset($gawd_settings['gawd_anonymize']) && 'on' == $gawd_settings['gawd_anonymize']){ ?>
|
69 |
+
ga('set', 'anonymizeIp', true);
|
70 |
+
<?php }
|
71 |
+
|
72 |
+
foreach($custom_dimensions as $custom_dimension) {
|
73 |
+
|
74 |
+
$optname = 'gawd_custom_dimension_' . str_replace(' ', '_', $custom_dimension['name']);
|
75 |
+
if($gawd_settings[$optname] !== 'on') {
|
76 |
+
continue;
|
77 |
+
}
|
78 |
+
|
79 |
+
$custom_dimension_value = "";
|
80 |
+
switch($custom_dimension['name']) {
|
81 |
+
case 'Logged in':
|
82 |
+
$custom_dimension_value = (is_user_logged_in()) ? "yes" : "no";
|
83 |
+
break;
|
84 |
+
case 'Post type':
|
85 |
+
$custom_dimension_value = GAWD_helper::get_post_type();
|
86 |
+
break;
|
87 |
+
case 'Author':
|
88 |
+
$custom_dimension_value = GAWD_helper::get_author_nickname();
|
89 |
+
break;
|
90 |
+
case 'Category':
|
91 |
+
$custom_dimension_value = GAWD_helper::get_categories();
|
92 |
+
break;
|
93 |
+
case 'Published Month':
|
94 |
+
$custom_dimension_value = GAWD_helper::get_published_month();
|
95 |
+
break;
|
96 |
+
case 'Published Year':
|
97 |
+
$custom_dimension_value = GAWD_helper::get_published_year();
|
98 |
+
break;
|
99 |
+
case 'Tags': {
|
100 |
+
$custom_dimension_value = GAWD_helper::get_tags();
|
101 |
+
break;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
if(!empty($custom_dimension_value)) {
|
106 |
+
echo "ga('set', 'dimension" . $custom_dimension['id'] . "', '" . $custom_dimension_value . "');\n";
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
if($enable_custom_code == 'on') {
|
111 |
+
echo "/*CUSTOM CODE START*/" . $gawd_custom_code . "/*CUSTOM CODE END*/";
|
112 |
+
} ?>
|
113 |
+
ga('send', 'pageview');
|
114 |
+
<?php }
|
115 |
+
|
116 |
+
$download_script = (isset($gawd_settings['gawd_file_formats']) && $gawd_settings['gawd_file_formats'] != '');
|
117 |
+
$links_script = ($gawd_outbound != '' && isset($domain) && $domain);
|
118 |
+
$adsence_acc_linking = (isset($gawd_settings['adsense_acc_linking']) && $gawd_settings['adsense_acc_linking'] != '');
|
119 |
+
|
120 |
+
if($download_script || $links_script || $adsence_acc_linking){ ?>
|
121 |
+
document.addEventListener("DOMContentLoaded", function (event) {
|
122 |
+
window.addEventListener('load', function () {
|
123 |
+
|
124 |
+
|
125 |
+
<?php
|
126 |
+
if($download_script === true){ ?>
|
127 |
+
|
128 |
+
//Track Downloads
|
129 |
+
var links_download = document.querySelectorAll('a');
|
130 |
+
links_download.forEach(function (link, key, listObj) {
|
131 |
+
if (link.href.match(/.*\.(<?php echo esc_js($gawd_settings['gawd_file_formats']); ?>)(\?.*)?$/)) {
|
132 |
+
link.addEventListener('click', function (e) {
|
133 |
+
ga('send', 'event', 'download', 'click', e.target.href<?php
|
134 |
+
if(isset($gawd_settings['exclude_events']) && $gawd_settings['exclude_events']) {
|
135 |
+
echo ", {'nonInteraction': 1}";
|
136 |
+
}
|
137 |
+
?>);
|
138 |
+
});
|
139 |
+
}
|
140 |
+
});
|
141 |
+
|
142 |
+
|
143 |
+
//Track Mailto
|
144 |
+
var links_mailto = document.querySelectorAll('a[href^="mailto"]');
|
145 |
+
links_mailto.forEach(function (link, key, listObj) {
|
146 |
+
|
147 |
+
|
148 |
+
link.addEventListener('click', function (e) {
|
149 |
+
ga('send', 'event', 'email', 'send', e.target.href<?php
|
150 |
+
if(isset($gawd_settings['exclude_events']) && $gawd_settings['exclude_events']) {
|
151 |
+
echo ", {'nonInteraction': 1}";
|
152 |
+
}
|
153 |
+
?>);
|
154 |
+
});
|
155 |
+
});
|
156 |
+
<?php }
|
157 |
+
|
158 |
+
if($links_script === true){ ?>
|
159 |
+
//Track Outbound Links
|
160 |
+
var links_out = document.querySelectorAll('a[href^="http"]');
|
161 |
+
links_out.forEach(function (link, key, listObj) {
|
162 |
+
if (!link.href.match(/.*\.(<?php echo esc_js(isset($gawd_settings['gawd_file_formats']) && $gawd_settings['gawd_file_formats'] != ''); ?>)(\?.*)?$/)) {
|
163 |
+
if (link.href.indexOf('<?php echo $domain; ?>') == -1) {
|
164 |
+
link.addEventListener('click', function (e) {
|
165 |
+
ga('send', 'event', 'outbound', 'click', e.target.href<?php
|
166 |
+
if(isset($gawd_settings['exclude_events']) && $gawd_settings['exclude_events']) {
|
167 |
+
echo ", {'nonInteraction': 1}";
|
168 |
+
}
|
169 |
+
?>);
|
170 |
+
});
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
});
|
176 |
+
<?php }
|
177 |
+
if ($adsence_acc_linking) { ?>
|
178 |
+
window.google_analytics_uacct = "<?php echo esc_html($ua_code); ?>";
|
179 |
+
<?php }?>
|
180 |
+
});
|
181 |
+
});
|
182 |
+
<?php } ?>
|
183 |
</script>
|
admin/updates.php
CHANGED
@@ -1,148 +1,148 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin page
|
4 |
-
*/
|
5 |
-
// Exit if accessed directly.
|
6 |
-
if(!defined('ABSPATH')) {
|
7 |
-
exit;
|
8 |
-
}
|
9 |
-
|
10 |
-
//global $gawd_options;
|
11 |
-
?>
|
12 |
-
|
13 |
-
<div class="wrap">
|
14 |
-
<?php settings_errors(); ?>
|
15 |
-
<div id="settings">
|
16 |
-
<div id="settings-content">
|
17 |
-
<h2 id="add_on_title"><?php echo esc_html(get_admin_page_title()); ?></h2>
|
18 |
-
|
19 |
-
|
20 |
-
<div class="main-plugin_desc-cont">
|
21 |
-
You can download the latest version of your plugins from your <a href="https://10web.io"
|
22 |
-
target="_blank"> 10Web</a>
|
23 |
-
account. After deactivating and deleting the current version, install the downloaded version of the
|
24 |
-
plugin.
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<br/>
|
28 |
-
<br/>
|
29 |
-
|
30 |
-
<?php
|
31 |
-
if($gawd_plugins) {
|
32 |
-
$update = 0;
|
33 |
-
if(isset($gawd_plugins[158])) {
|
34 |
-
|
35 |
-
$project = $gawd_plugins[158];
|
36 |
-
unset($gawd_plugins[158]);
|
37 |
-
if(isset($updates[158])) {
|
38 |
-
$update = 1;
|
39 |
-
}
|
40 |
-
?>
|
41 |
-
<div class="main-plugin">
|
42 |
-
<div class="add-on">
|
43 |
-
<?php if($project['gawd_data']['image']) { ?>
|
44 |
-
<div class="figure-img">
|
45 |
-
<a href="<?php echo $project['gawd_data']['url'] ?>" target="_blank">
|
46 |
-
<img src="<?php echo $project['gawd_data']['image'] ?>"/>
|
47 |
-
</a>
|
48 |
-
</div>
|
49 |
-
<?php } ?>
|
50 |
-
|
51 |
-
</div>
|
52 |
-
<div class="main-plugin-info">
|
53 |
-
<h2>
|
54 |
-
<a href="<?php echo $project['gawd_data']['url'] ?>"
|
55 |
-
target="_blank"><?php echo $project['Title'] ?></a>
|
56 |
-
</h2>
|
57 |
-
|
58 |
-
<div class="main-plugin_desc-cont">
|
59 |
-
<div class="main-plugin-desc"><?php echo $project['gawd_data']['description'] ?></div>
|
60 |
-
<div class="main-plugin-desc main-plugin-desc-info">
|
61 |
-
<p><a href="<?php echo $project['gawd_data']['url'] ?>"
|
62 |
-
target="_blank">Version <?php echo $project['Version'] ?></a></p>
|
63 |
-
</div>
|
64 |
-
|
65 |
-
<?php if(isset($updates[158][0])) { ?>
|
66 |
-
<span class="update-info">There is an new <?php echo $updates[158][0]['version'] ?>
|
67 |
-
version</span>
|
68 |
-
<p><span>What's new:</span></p>
|
69 |
-
<div class="last_update"><b><?php echo $updates[158][0]['version'] ?></b>
|
70 |
-
<?php echo strip_tags(str_ireplace('Important', '', $updates[158][0]['note']), '<p>') ?>
|
71 |
-
</div>
|
72 |
-
<?php unset($updates[158][0]); ?>
|
73 |
-
<?php if(count($updates[158]) > 0) { ?>
|
74 |
-
|
75 |
-
<div class="more_updates">
|
76 |
-
<?php foreach($updates[158] as $update) {
|
77 |
-
?>
|
78 |
-
<div class="update"><b><?php echo $update['version'] ?></b>
|
79 |
-
<?php echo strip_tags(str_ireplace('Important', '', $update['note']), '<p>') ?>
|
80 |
-
</div>
|
81 |
-
<?php
|
82 |
-
}
|
83 |
-
?>
|
84 |
-
</div>
|
85 |
-
<a href="#" class="show_more_updates">More updates</a>
|
86 |
-
<?php
|
87 |
-
}
|
88 |
-
?>
|
89 |
-
|
90 |
-
|
91 |
-
<?php } ?>
|
92 |
-
|
93 |
-
</div>
|
94 |
-
</div>
|
95 |
-
</div>
|
96 |
-
<?php }
|
97 |
-
?>
|
98 |
-
<div class="addons_updates">
|
99 |
-
<?php
|
100 |
-
foreach($gawd_plugins as $id => $project) {
|
101 |
-
$last_index = 0;
|
102 |
-
if(isset($updates[$id]) && !empty($updates[$id])) {
|
103 |
-
$last_index = count($updates[$id]) - 1;
|
104 |
-
}
|
105 |
-
?>
|
106 |
-
<div class="add-on">
|
107 |
-
<figure class="figure">
|
108 |
-
<div class="figure-img">
|
109 |
-
<a href="<?php echo $project['gawd_data']['url'] ?>" target="_blank">
|
110 |
-
<?php if($project['gawd_data']['image']) { ?>
|
111 |
-
<img src="<?php echo $project['gawd_data']['image'] ?>"/>
|
112 |
-
<?php } ?>
|
113 |
-
</a>
|
114 |
-
</div>
|
115 |
-
<figcaption class="addon-descr figcaption">
|
116 |
-
<?php if(isset($updates[$id][$last_index])) { ?>
|
117 |
-
<p>What's new:</p>
|
118 |
-
<?php echo strip_tags($updates[$id][$last_index]['note'], '<p>') ?>
|
119 |
-
<?php } else { ?><?php echo $project['Title'] ?> is up to date
|
120 |
-
<?php } ?>
|
121 |
-
</figcaption>
|
122 |
-
</figure>
|
123 |
-
<h2><?php echo $project['Title'] ?></h2>
|
124 |
-
|
125 |
-
<div class="main-plugin-desc-info">
|
126 |
-
<p><a href="<?php echo $project['gawd_data']['url'] ?>"
|
127 |
-
target="_blank"><?php echo $project['Version'] ?></a> | 10Web</p>
|
128 |
-
</div>
|
129 |
-
<?php if(isset($updates[$id]) && isset($updates[$id][$last_index]['version'])) { ?>
|
130 |
-
<div class="addon-descr-update">
|
131 |
-
<span
|
132 |
-
class="update-info">There is an new <?php echo $updates[$id][$last_index]['version'] ?>
|
133 |
-
version</span><br/>
|
134 |
-
</div>
|
135 |
-
<?php } ?>
|
136 |
-
</div>
|
137 |
-
<?php }
|
138 |
-
?>
|
139 |
-
</div>
|
140 |
-
<?php
|
141 |
-
}
|
142 |
-
?>
|
143 |
-
|
144 |
-
</div>
|
145 |
-
<!-- #gawd-settings-content -->
|
146 |
-
</div>
|
147 |
-
<!-- #gawd-settings -->
|
148 |
-
</div><!-- .wrap -->
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin page
|
4 |
+
*/
|
5 |
+
// Exit if accessed directly.
|
6 |
+
if(!defined('ABSPATH')) {
|
7 |
+
exit;
|
8 |
+
}
|
9 |
+
|
10 |
+
//global $gawd_options;
|
11 |
+
?>
|
12 |
+
|
13 |
+
<div class="wrap">
|
14 |
+
<?php settings_errors(); ?>
|
15 |
+
<div id="settings">
|
16 |
+
<div id="settings-content">
|
17 |
+
<h2 id="add_on_title"><?php echo esc_html(get_admin_page_title()); ?></h2>
|
18 |
+
|
19 |
+
|
20 |
+
<div class="main-plugin_desc-cont">
|
21 |
+
You can download the latest version of your plugins from your <a href="https://10web.io"
|
22 |
+
target="_blank"> 10Web</a>
|
23 |
+
account. After deactivating and deleting the current version, install the downloaded version of the
|
24 |
+
plugin.
|
25 |
+
</div>
|
26 |
+
|
27 |
+
<br/>
|
28 |
+
<br/>
|
29 |
+
|
30 |
+
<?php
|
31 |
+
if($gawd_plugins) {
|
32 |
+
$update = 0;
|
33 |
+
if(isset($gawd_plugins[158])) {
|
34 |
+
|
35 |
+
$project = $gawd_plugins[158];
|
36 |
+
unset($gawd_plugins[158]);
|
37 |
+
if(isset($updates[158])) {
|
38 |
+
$update = 1;
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
<div class="main-plugin">
|
42 |
+
<div class="add-on">
|
43 |
+
<?php if($project['gawd_data']['image']) { ?>
|
44 |
+
<div class="figure-img">
|
45 |
+
<a href="<?php echo $project['gawd_data']['url'] ?>" target="_blank">
|
46 |
+
<img src="<?php echo $project['gawd_data']['image'] ?>"/>
|
47 |
+
</a>
|
48 |
+
</div>
|
49 |
+
<?php } ?>
|
50 |
+
|
51 |
+
</div>
|
52 |
+
<div class="main-plugin-info">
|
53 |
+
<h2>
|
54 |
+
<a href="<?php echo $project['gawd_data']['url'] ?>"
|
55 |
+
target="_blank"><?php echo $project['Title'] ?></a>
|
56 |
+
</h2>
|
57 |
+
|
58 |
+
<div class="main-plugin_desc-cont">
|
59 |
+
<div class="main-plugin-desc"><?php echo $project['gawd_data']['description'] ?></div>
|
60 |
+
<div class="main-plugin-desc main-plugin-desc-info">
|
61 |
+
<p><a href="<?php echo $project['gawd_data']['url'] ?>"
|
62 |
+
target="_blank">Version <?php echo $project['Version'] ?></a></p>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
<?php if(isset($updates[158][0])) { ?>
|
66 |
+
<span class="update-info">There is an new <?php echo $updates[158][0]['version'] ?>
|
67 |
+
version</span>
|
68 |
+
<p><span>What's new:</span></p>
|
69 |
+
<div class="last_update"><b><?php echo $updates[158][0]['version'] ?></b>
|
70 |
+
<?php echo strip_tags(str_ireplace('Important', '', $updates[158][0]['note']), '<p>') ?>
|
71 |
+
</div>
|
72 |
+
<?php unset($updates[158][0]); ?>
|
73 |
+
<?php if(count($updates[158]) > 0) { ?>
|
74 |
+
|
75 |
+
<div class="more_updates">
|
76 |
+
<?php foreach($updates[158] as $update) {
|
77 |
+
?>
|
78 |
+
<div class="update"><b><?php echo $update['version'] ?></b>
|
79 |
+
<?php echo strip_tags(str_ireplace('Important', '', $update['note']), '<p>') ?>
|
80 |
+
</div>
|
81 |
+
<?php
|
82 |
+
}
|
83 |
+
?>
|
84 |
+
</div>
|
85 |
+
<a href="#" class="show_more_updates">More updates</a>
|
86 |
+
<?php
|
87 |
+
}
|
88 |
+
?>
|
89 |
+
|
90 |
+
|
91 |
+
<?php } ?>
|
92 |
+
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
<?php }
|
97 |
+
?>
|
98 |
+
<div class="addons_updates">
|
99 |
+
<?php
|
100 |
+
foreach($gawd_plugins as $id => $project) {
|
101 |
+
$last_index = 0;
|
102 |
+
if(isset($updates[$id]) && !empty($updates[$id])) {
|
103 |
+
$last_index = count($updates[$id]) - 1;
|
104 |
+
}
|
105 |
+
?>
|
106 |
+
<div class="add-on">
|
107 |
+
<figure class="figure">
|
108 |
+
<div class="figure-img">
|
109 |
+
<a href="<?php echo $project['gawd_data']['url'] ?>" target="_blank">
|
110 |
+
<?php if($project['gawd_data']['image']) { ?>
|
111 |
+
<img src="<?php echo $project['gawd_data']['image'] ?>"/>
|
112 |
+
<?php } ?>
|
113 |
+
</a>
|
114 |
+
</div>
|
115 |
+
<figcaption class="addon-descr figcaption">
|
116 |
+
<?php if(isset($updates[$id][$last_index])) { ?>
|
117 |
+
<p>What's new:</p>
|
118 |
+
<?php echo strip_tags($updates[$id][$last_index]['note'], '<p>') ?>
|
119 |
+
<?php } else { ?><?php echo $project['Title'] ?> is up to date
|
120 |
+
<?php } ?>
|
121 |
+
</figcaption>
|
122 |
+
</figure>
|
123 |
+
<h2><?php echo $project['Title'] ?></h2>
|
124 |
+
|
125 |
+
<div class="main-plugin-desc-info">
|
126 |
+
<p><a href="<?php echo $project['gawd_data']['url'] ?>"
|
127 |
+
target="_blank"><?php echo $project['Version'] ?></a> | 10Web</p>
|
128 |
+
</div>
|
129 |
+
<?php if(isset($updates[$id]) && isset($updates[$id][$last_index]['version'])) { ?>
|
130 |
+
<div class="addon-descr-update">
|
131 |
+
<span
|
132 |
+
class="update-info">There is an new <?php echo $updates[$id][$last_index]['version'] ?>
|
133 |
+
version</span><br/>
|
134 |
+
</div>
|
135 |
+
<?php } ?>
|
136 |
+
</div>
|
137 |
+
<?php }
|
138 |
+
?>
|
139 |
+
</div>
|
140 |
+
<?php
|
141 |
+
}
|
142 |
+
?>
|
143 |
+
|
144 |
+
</div>
|
145 |
+
<!-- #gawd-settings-content -->
|
146 |
+
</div>
|
147 |
+
<!-- #gawd-settings -->
|
148 |
+
</div><!-- .wrap -->
|
assets/search.svg
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
<?xml version="1.0" encoding="utf-8"?>
|
2 |
-
<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
-
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
-
width="16.1px" height="16.5px" viewBox="0 0 16.1 16.5" style="enable-background:new 0 0 16.1 16.5;" xml:space="preserve">
|
5 |
-
<style type="text/css">
|
6 |
-
.st0{opacity:0.62;fill:#323A45;}
|
7 |
-
</style>
|
8 |
-
<path class="st0" d="M11.4,10.4c0.9-1.1,1.4-2.6,1.4-4C12.8,2.9,9.9,0,6.4,0C2.9,0,0,2.9,0,6.4s2.9,6.4,6.4,6.4
|
9 |
-
c1.3,0,2.5-0.4,3.6-1.1l4.8,4.8l1.3-1.3L11.4,10.4z M11.7,6.4c0,2.9-2.4,5.3-5.3,5.3S1.1,9.3,1.1,6.4s2.4-5.3,5.3-5.3
|
10 |
-
S11.7,3.5,11.7,6.4z"/>
|
11 |
-
</svg>
|
1 |
+
<?xml version="1.0" encoding="utf-8"?>
|
2 |
+
<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
3 |
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
4 |
+
width="16.1px" height="16.5px" viewBox="0 0 16.1 16.5" style="enable-background:new 0 0 16.1 16.5;" xml:space="preserve">
|
5 |
+
<style type="text/css">
|
6 |
+
.st0{opacity:0.62;fill:#323A45;}
|
7 |
+
</style>
|
8 |
+
<path class="st0" d="M11.4,10.4c0.9-1.1,1.4-2.6,1.4-4C12.8,2.9,9.9,0,6.4,0C2.9,0,0,2.9,0,6.4s2.9,6.4,6.4,6.4
|
9 |
+
c1.3,0,2.5-0.4,3.6-1.1l4.8,4.8l1.3-1.3L11.4,10.4z M11.7,6.4c0,2.9-2.4,5.3-5.3,5.3S1.1,9.3,1.1,6.4s2.4-5.3,5.3-5.3
|
10 |
+
S11.7,3.5,11.7,6.4z"/>
|
11 |
+
</svg>
|
config.php
CHANGED
@@ -13,7 +13,7 @@ if(!defined('GAWD_DIR')) {
|
|
13 |
define('GWD_NAME', plugin_basename(dirname(__FILE__)));
|
14 |
define('GAWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
15 |
define('GAWD_INC', GAWD_URL . '/inc');
|
16 |
-
define('GAWD_VERSION', '1.2.
|
17 |
|
18 |
$upload_dir = wp_upload_dir();
|
19 |
define('GAWD_UPLOAD_DIR', $upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__)));
|
13 |
define('GWD_NAME', plugin_basename(dirname(__FILE__)));
|
14 |
define('GAWD_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
15 |
define('GAWD_INC', GAWD_URL . '/inc');
|
16 |
+
define('GAWD_VERSION', '1.2.11');
|
17 |
|
18 |
$upload_dir = wp_upload_dir();
|
19 |
define('GAWD_UPLOAD_DIR', $upload_dir['basedir'] . '/' . plugin_basename(dirname(__FILE__)));
|
gawd_class.php
CHANGED
@@ -1,1741 +1,1741 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class GAWD {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* @var GAWD The reference to Singleton instance of this class
|
7 |
-
*/
|
8 |
-
private static $instance;
|
9 |
-
private $gawd_pages = array();
|
10 |
-
private $view_permission = false;
|
11 |
-
private $settings_permission = false;
|
12 |
-
public $redirect_uri = "urn:ietf:wg:oauth:2.0:oob";
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Protected constructor to prevent creating a new instance of the
|
16 |
-
* Singleton via the `new` operator from outside of this class.
|
17 |
-
*/
|
18 |
-
protected function __construct(){
|
19 |
-
if(get_site_transient('gawd_uninstall') === '1'){
|
20 |
-
return;
|
21 |
-
}
|
22 |
-
|
23 |
-
if(!extension_loaded('openssl')) {
|
24 |
-
add_action('admin_notices', array($this, 'nossl_message'), 1);
|
25 |
-
return;
|
26 |
-
}
|
27 |
-
|
28 |
-
if(!is_dir(GAWD_UPLOAD_DIR)) {
|
29 |
-
mkdir(GAWD_UPLOAD_DIR, 0777);
|
30 |
-
}
|
31 |
-
|
32 |
-
if(get_option('gawd_version') !== GAWD_VERSION){
|
33 |
-
self::activate();
|
34 |
-
}
|
35 |
-
|
36 |
-
add_action('init', array($this, 'register_hooks'), 1);
|
37 |
-
|
38 |
-
add_action('wp_head', array($this, 'gawd_tracking_code'), 99);
|
39 |
-
$gawd_settings = GAWD_helper::get_settings();
|
40 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
41 |
-
$gawd_user_status = GAWD_helper::get_user_status();
|
42 |
-
|
43 |
-
if(
|
44 |
-
isset($gawd_user_data['refresh_token']) &&
|
45 |
-
($gawd_user_data['refresh_token'] != '') &&
|
46 |
-
(isset($gawd_settings['gawd_tracking_enable']) &&
|
47 |
-
$gawd_settings['gawd_tracking_enable'] == 'on')
|
48 |
-
) {
|
49 |
-
require_once(GAWD_DIR . '/widgets.php');
|
50 |
-
}
|
51 |
-
|
52 |
-
$gawd_post_page_roles = isset($gawd_settings['gawd_post_page_roles']) ? $gawd_settings['gawd_post_page_roles'] : array();
|
53 |
-
|
54 |
-
if(
|
55 |
-
GAWD_helper::gawd_is_ready() &&
|
56 |
-
(isset($gawd_settings['gawd_tracking_enable']) && $gawd_settings['gawd_tracking_enable'] == 'on') &&
|
57 |
-
(isset($gawd_settings['post_page_chart']) && $gawd_settings['post_page_chart'] != '') &&
|
58 |
-
GAWD_helper::check_permission($gawd_post_page_roles) &&
|
59 |
-
(isset($gawd_user_data['refresh_token']) && ($gawd_user_data['refresh_token'] != ''))
|
60 |
-
&& !empty($gawd_user_data['property_id'])) {
|
61 |
-
|
62 |
-
add_filter('manage_posts_columns', array($this, 'gawd_add_columns'));
|
63 |
-
// Populate custom column in Posts List
|
64 |
-
add_action('manage_posts_custom_column', array($this, 'gawd_add_icons'), 10, 2);
|
65 |
-
// Add custom column in Pages List
|
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 |
-
}
|
70 |
-
|
71 |
-
$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? $gawd_settings['gawd_frontend_roles'] : array();
|
72 |
-
|
73 |
-
if(
|
74 |
-
GAWD_helper::gawd_is_ready() &&
|
75 |
-
(isset($gawd_settings['gawd_tracking_enable']) && $gawd_settings['gawd_tracking_enable'] == 'on') &&
|
76 |
-
GAWD_helper::check_permission($gawd_frontend_roles) &&
|
77 |
-
(isset($gawd_user_data['refresh_token']) && ($gawd_user_data['refresh_token'] != '')) &&
|
78 |
-
GAWD_helper::get_user_status() &&
|
79 |
-
!empty($gawd_user_data['property_id'])
|
80 |
-
) {
|
81 |
-
add_action('wp_enqueue_scripts', array($this, 'gawd_front_scripts'));
|
82 |
-
add_action('admin_bar_menu', array($this, 'report_adminbar'), 999);
|
83 |
-
}
|
84 |
-
|
85 |
-
}
|
86 |
-
|
87 |
-
public function admin_notices(){
|
88 |
-
$notices = GAWD_helper::get_notices();
|
89 |
-
|
90 |
-
foreach($notices as $notice) {
|
91 |
-
$this->gawd_admin_notice($notice['msg'], $notice['status'], $notice['class']);
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
$user_data = GAWD_helper::get_user_data();
|
96 |
-
$web_property_id = (isset($user_data['property_id'])) ? $user_data['property_id'] : "";
|
97 |
-
$screen = get_current_screen();
|
98 |
-
$accounts = GAWD_helper::get_management_accounts();
|
99 |
-
$gawd_props = GAWD_helper::get_current_site_properties();
|
100 |
-
|
101 |
-
if(count($gawd_props) === 0 && empty($web_property_id) && strpos($screen->base, 'gawd') !== false && !empty($accounts)) {
|
102 |
-
$msg = "10Web Analytics: You haven't created a web-property with current site URL, or it has been deleted. Please <a href='" . admin_url() . "admin.php?page=gawd_settings#gawd_tracking_tab'>create </a> one.";
|
103 |
-
$this->gawd_admin_notice($msg, "error", 'gawd_tracking_notice_link');
|
104 |
-
}
|
105 |
-
}
|
106 |
-
|
107 |
-
function get_current_user_role(){
|
108 |
-
global $wp_roles;
|
109 |
-
if(is_user_logged_in()) {
|
110 |
-
$current_user = wp_get_current_user();
|
111 |
-
$roles = $current_user->roles;
|
112 |
-
$role = array_shift($roles);
|
113 |
-
|
114 |
-
return $role;
|
115 |
-
} else {
|
116 |
-
return "";
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
function report_adminbar($wp_admin_bar){
|
121 |
-
/* @formatter:off */
|
122 |
-
$gawd_settings = get_option('gawd_settings');
|
123 |
-
$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? $gawd_settings['gawd_frontend_roles'] : array();
|
124 |
-
$roles = $this->get_current_user_role();
|
125 |
-
$id = intval(get_the_ID());
|
126 |
-
if(((in_array($roles, $gawd_frontend_roles) || current_user_can('manage_options')) && !is_admin()) && $gawd_settings['post_page_chart'] != '' && $id > 0) {
|
127 |
-
|
128 |
-
$uri_parts = get_post($id);
|
129 |
-
$uri = '/' . $uri_parts->post_name;
|
130 |
-
|
131 |
-
$filter = rawurlencode(rawurldecode($uri));
|
132 |
-
|
133 |
-
$args = array(
|
134 |
-
'id' => 'gawd',
|
135 |
-
'title' => '<span data-url="' . $filter . '" class="ab-icon"></span><span class="">' . __("Analytics by 10Web", 'gawd') . '</span>',
|
136 |
-
//'href' => '#1',
|
137 |
-
);
|
138 |
-
/* @formatter:on */
|
139 |
-
$wp_admin_bar->add_node($args);
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
function register_hooks(){
|
144 |
-
|
145 |
-
if(is_admin() && get_option('gawd_upgrade_plugin') === '1'){
|
146 |
-
add_action('admin_footer', array($this,'upgrade_plugin'));
|
147 |
-
}
|
148 |
-
|
149 |
-
$this->gawd_last_viewed_profile();
|
150 |
-
|
151 |
-
$gawd_settings = GAWD_helper::get_settings();
|
152 |
-
|
153 |
-
$gawd_permissions = isset($gawd_settings['gawd_permissions']) ? $gawd_settings['gawd_permissions'] : array();
|
154 |
-
$gawd_overview_permissions = isset($gawd_settings['gawd_backend_roles']) ? $gawd_settings['gawd_backend_roles'] : array();
|
155 |
-
$this->view_permission = GAWD_helper::check_permission($gawd_overview_permissions);
|
156 |
-
$this->settings_permission = GAWD_helper::check_permission($gawd_permissions);
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
if($this->view_permission || $this->settings_permission) {
|
162 |
-
add_action('admin_menu', array($this, 'gawd_add_menu'), 9);
|
163 |
-
add_action('admin_menu', array($this, 'remove_first_menu'), 10);
|
164 |
-
}
|
165 |
-
|
166 |
-
add_action('admin_enqueue_scripts', array($this, 'gawd_enqueue_scripts'));
|
167 |
-
|
168 |
-
|
169 |
-
//todo add_action('wp_ajax_create_pdf_file', array($this, 'create_pdf_file'));
|
170 |
-
add_action('wp_ajax_gawd_create_csv_file', array($this, 'create_csv_file'));
|
171 |
-
add_action('wp_ajax_gawd_send_email', array($this, 'send_email'));
|
172 |
-
|
173 |
-
add_action('wp_ajax_show_data', array($this, 'show_data'));
|
174 |
-
add_action('wp_ajax_remove_zoom_message', array($this, 'remove_zoom_message'));
|
175 |
-
add_action('wp_ajax_show_data_compact', array($this, 'show_data_compact'));
|
176 |
-
if(GAWD_helper::gawd_is_ready()){
|
177 |
-
add_action('wp_dashboard_setup', array($this, 'google_analytics_wd_dashboard_widget'));
|
178 |
-
}
|
179 |
-
add_action('admin_menu', array($this, 'overview_date_meta'));
|
180 |
-
//todo add_action('admin_init', array($this, 'gawd_export'));
|
181 |
-
// add_action( 'gawd_pushover_daily', array( $this, 'gawd_pushover_daily' ) );
|
182 |
-
// add_action( 'gawd_pushover_gawd_weekly', array( $this, 'gawd_pushover_weekly' ) );
|
183 |
-
// add_action( 'gawd_pushover_gawd_monthly', array( $this, 'gawd_pushover_monthly' ) );
|
184 |
-
// add_action('gawd_alert_daily', array($this, 'gawd_alert_daily'));
|
185 |
-
// add_action('gawd_alert_gawd_monthly', array($this, 'gawd_alert_monthly'));
|
186 |
-
// add_action('gawd_alert_gawd_weekly', array($this, 'gawd_alert_weekly'));
|
187 |
-
add_action('admin_notices', array($this, 'admin_notices'), 9999);
|
188 |
-
|
189 |
-
if(!wp_next_scheduled("gawd_email_scheduled")) {
|
190 |
-
wp_schedule_single_event( time(), 'gawd_email_scheduled' );
|
191 |
-
}
|
192 |
-
add_action('gawd_email_scheduled', array($this, 'gawd_email_scheduled'));
|
193 |
-
}
|
194 |
-
|
195 |
-
public function gawd_last_viewed_profile(){
|
196 |
-
$gawd_profile_data = array();
|
197 |
-
if(isset($_POST['gawd_id'])) {
|
198 |
-
$profiles = GAWD_helper::get_profiles();
|
199 |
-
if(is_array($profiles)) {
|
200 |
-
foreach($profiles as $profile) {
|
201 |
-
if(!empty($profile)) {
|
202 |
-
foreach($profile as $item) {
|
203 |
-
|
204 |
-
if($item["id"] === $_POST['gawd_id']) {
|
205 |
-
$gawd_profile_data['profile_id'] = isset($_POST['gawd_id']) ? sanitize_text_field($_POST['gawd_id']) : '';
|
206 |
-
$gawd_profile_data['web_property_name'] = isset($_POST['web_property_name']) ? sanitize_text_field($_POST['web_property_name']) : '';
|
207 |
-
$gawd_profile_data['web_property_id'] = isset($item["webPropertyId"]) ? $item["webPropertyId"] : '';
|
208 |
-
$gawd_profile_data['account_id'] = isset($item["accountId"]) ? $item["accountId"] : '';
|
209 |
-
update_option('gawd_last_viewed_profile', $gawd_profile_data);
|
210 |
-
break;
|
211 |
-
}
|
212 |
-
|
213 |
-
}
|
214 |
-
}
|
215 |
-
}
|
216 |
-
}
|
217 |
-
}
|
218 |
-
}
|
219 |
-
|
220 |
-
public function gawd_add_icons($column, $id){
|
221 |
-
if($column != 'gawd_stats') {
|
222 |
-
return;
|
223 |
-
}
|
224 |
-
$uri_parts = get_post($id);
|
225 |
-
$uri = '/' . $uri_parts->post_name;
|
226 |
-
|
227 |
-
$filter = rawurlencode(rawurldecode($uri));
|
228 |
-
$permalink = get_permalink($id, false);
|
229 |
-
echo '<a id="gawd-' . $id . '" class="gawd_page_post_stats" title="' . get_the_title($id) . '" href="#' . $filter . '" data-permalink="' . $permalink . '"><img src="' . GAWD_URL . '/assets/back_logo.png"</a>';
|
230 |
-
}
|
231 |
-
|
232 |
-
public function gawd_add_columns($columns){
|
233 |
-
return array_merge($columns, array('gawd_stats' => __('Analytics by 10Web', 'gawd')));
|
234 |
-
}
|
235 |
-
|
236 |
-
public static function gawd_roles($access_level, $tracking = false){
|
237 |
-
if(is_user_logged_in() && isset($access_level)) {
|
238 |
-
$current_user = wp_get_current_user();
|
239 |
-
$roles = (array)$current_user->roles;
|
240 |
-
if((current_user_can('manage_options')) && !$tracking) {
|
241 |
-
return true;
|
242 |
-
}
|
243 |
-
if(count(array_intersect($roles, $access_level)) > 0) {
|
244 |
-
return true;
|
245 |
-
} else {
|
246 |
-
return false;
|
247 |
-
}
|
248 |
-
}
|
249 |
-
|
250 |
-
return false;
|
251 |
-
}
|
252 |
-
|
253 |
-
public function gawd_tracking_code(){
|
254 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
255 |
-
if(empty($gawd_user_data['property_id'])) {
|
256 |
-
return;
|
257 |
-
}
|
258 |
-
|
259 |
-
require_once(GAWD_DIR . '/admin/tracking.php');
|
260 |
-
}
|
261 |
-
|
262 |
-
public function create_pdf_file($ajax = true, $data = null, $dimension = null, $start_date = null, $end_date = null, $metric_compare_recc = null, $metric_recc = null){
|
263 |
-
$first_data = isset($_REQUEST["first_data"]) ? sanitize_text_field($_REQUEST["first_data"]) : '';
|
264 |
-
$_data_compare = isset($_REQUEST["_data_compare"]) ? sanitize_text_field($_REQUEST["_data_compare"]) : '';
|
265 |
-
if($ajax == true) {
|
266 |
-
$export_type = isset($_REQUEST["export_type"]) ? sanitize_text_field($_REQUEST["export_type"]) : '';
|
267 |
-
if($export_type != 'pdf') {
|
268 |
-
return;
|
269 |
-
}
|
270 |
-
|
271 |
-
$report_type = isset($_REQUEST["report_type"]) ? sanitize_text_field($_REQUEST["report_type"]) : '';
|
272 |
-
|
273 |
-
|
274 |
-
if($report_type !== 'alert') {
|
275 |
-
return;
|
276 |
-
}
|
277 |
-
|
278 |
-
}
|
279 |
-
|
280 |
-
include_once GAWD_DIR . '/include/gawd_pdf_file.php';
|
281 |
-
$file = new GAWD_PDF_FILE();
|
282 |
-
|
283 |
-
/*
|
284 |
-
require_once(GAWD_DIR . '/admin/gawd_google_class.php');
|
285 |
-
$this->gawd_google_client = GAWD_google_client::get_instance();
|
286 |
-
*/
|
287 |
-
$file->get_request_data($this, $ajax, $data, $dimension, $start_date, $end_date, $metric_compare_recc, $metric_recc);
|
288 |
-
|
289 |
-
$file->sort_data();
|
290 |
-
if($first_data != '') {
|
291 |
-
$file->create_file('pages');
|
292 |
-
} elseif(($_data_compare) != '') {
|
293 |
-
$file->create_file('compare');
|
294 |
-
} else {
|
295 |
-
$file->create_file(true);
|
296 |
-
}
|
297 |
-
if($ajax == true) {
|
298 |
-
die();
|
299 |
-
} else {
|
300 |
-
return $file->file_dir;
|
301 |
-
}
|
302 |
-
}
|
303 |
-
|
304 |
-
public function create_csv_file(){
|
305 |
-
$response = array();
|
306 |
-
if(!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'gawd_admin_page_nonce')) {
|
307 |
-
$response['error']['code'] = 'wrong_nonce';
|
308 |
-
$response['error']['msg'] = 'wrong_nonce';
|
309 |
-
}
|
310 |
-
else {
|
311 |
-
$csv_response = $this->generate_csv_file();
|
312 |
-
$response['error'] = (!empty($csv_response['error'])) ? $csv_response['error'] : '';
|
313 |
-
$response['success'] = (!empty($csv_response['success'])) ? $csv_response['success'] : '';
|
314 |
-
$response['data'] = (!empty($csv_response['data'])) ? $csv_response['data'] : '';
|
315 |
-
}
|
316 |
-
die(json_encode($response));
|
317 |
-
}
|
318 |
-
|
319 |
-
|
320 |
-
public function save_alert($alert_data){
|
321 |
-
|
322 |
-
include_once 'library/gawd-alert-class.php';
|
323 |
-
$alert = new GAWD_alert($alert_data);
|
324 |
-
$alert->add_email_data_to_POST();
|
325 |
-
|
326 |
-
$this->send_email(false);
|
327 |
-
}
|
328 |
-
|
329 |
-
|
330 |
-
public function send_email($die = true){
|
331 |
-
if($die !== false) {
|
332 |
-
$die = true;
|
333 |
-
}
|
334 |
-
|
335 |
-
$response = array(
|
336 |
-
'success' => false,
|
337 |
-
'error' => array('code' => '', 'msg' => ''),
|
338 |
-
'data' => array('msg' => 'Something went wrong')
|
339 |
-
);
|
340 |
-
|
341 |
-
if(!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'gawd_admin_page_nonce')) {
|
342 |
-
$response['error']['code'] = 'wrong_nonce';
|
343 |
-
$response['error']['msg'] = 'wrong_nonce';
|
344 |
-
|
345 |
-
if($die == true) {
|
346 |
-
die(json_encode($response));
|
347 |
-
} else {
|
348 |
-
return $response;
|
349 |
-
}
|
350 |
-
}
|
351 |
-
else {
|
352 |
-
include_once 'library/gawd-email-class.php';
|
353 |
-
$email = new GAWD_email();
|
354 |
-
if($email->parse_ajax_data() === false) {
|
355 |
-
$response['error'] = $email->get_error();
|
356 |
-
if($die == true) {
|
357 |
-
die(json_encode($response));
|
358 |
-
} else {
|
359 |
-
return $response;
|
360 |
-
}
|
361 |
-
}
|
362 |
-
|
363 |
-
$file_response = $this->generate_csv_file();
|
364 |
-
if($file_response['success'] === false) {
|
365 |
-
|
366 |
-
$response = array(
|
367 |
-
'success'=> $file_response['success'],
|
368 |
-
'error' => $file_response['error'],
|
369 |
-
'data' => $file_response['data']
|
370 |
-
);
|
371 |
-
|
372 |
-
if($die == true) {
|
373 |
-
die(json_encode($response));
|
374 |
-
} else {
|
375 |
-
return $response;
|
376 |
-
}
|
377 |
-
}
|
378 |
-
|
379 |
-
|
380 |
-
if($email->get_period() !== 'once') {
|
381 |
-
$email->save_email_info($file_response['ajax_args'], $file_response['csv_generator']);
|
382 |
-
|
383 |
-
$response['success'] = true;
|
384 |
-
$response['data']['msg'] = 'Email successfully Scheduled </br> Go to <a href="admin.php?page=gawd_settings#gawd_emails_tab">Settings page</a> to delete scheduled e-mails.';
|
385 |
-
if($die == true) {
|
386 |
-
die(json_encode($response));
|
387 |
-
} else {
|
388 |
-
return $response;
|
389 |
-
}
|
390 |
-
}
|
391 |
-
|
392 |
-
$email->attach_file($file_response['csv_generator']);
|
393 |
-
if($email->send_mail() === true){
|
394 |
-
$response['success'] = true;
|
395 |
-
$response['data']['msg'] = 'Email successfully sent.';
|
396 |
-
if($die == true) {
|
397 |
-
die(json_encode($response));
|
398 |
-
} else {
|
399 |
-
return $response;
|
400 |
-
}
|
401 |
-
}else{
|
402 |
-
$response['error']['code'] = 'fail_to_sent_email';
|
403 |
-
$response['error']['code'] = 'Fail to sent email.';
|
404 |
-
|
405 |
-
if($die == true) {
|
406 |
-
die(json_encode($response));
|
407 |
-
} else {
|
408 |
-
return $response;
|
409 |
-
}
|
410 |
-
}
|
411 |
-
}
|
412 |
-
}
|
413 |
-
|
414 |
-
private function generate_csv_file($data = array(), $view_id = null, $ajax_response = array()){
|
415 |
-
$response = array(
|
416 |
-
'success' => false,
|
417 |
-
'error' => array('code' => 'something_went_wrong', 'msg' => 'something went wrong.'),
|
418 |
-
'data' => ''
|
419 |
-
);
|
420 |
-
|
421 |
-
if(!empty($data)) {
|
422 |
-
$gawd_request_last_args = $data['last_args'];
|
423 |
-
$compare_by = $data['compare_by'];
|
424 |
-
$gawd_compare_request_last_args = $data['compare_last_args'];
|
425 |
-
$menu_name = $data['menu_name'];
|
426 |
-
$info = $data['info'];
|
427 |
-
} else {
|
428 |
-
$gawd_request_last_args = GAWD_helper::validate_string('gawd_request_last_args', array());
|
429 |
-
$compare_by = sanitize_text_field($_POST['compare_by']);
|
430 |
-
$gawd_compare_request_last_args = (!empty($_POST['gawd_compare_request_last_args'])) ? sanitize_text_field($_POST['gawd_compare_request_last_args']) : null;
|
431 |
-
$info = GAWD_helper::validate_string("info", array());
|
432 |
-
$menu_name = sanitize_text_field($_POST['menu_name']);
|
433 |
-
}//else set defaults
|
434 |
-
|
435 |
-
if(is_array($ajax_response) && !empty($ajax_response)) {
|
436 |
-
$data = $ajax_response;
|
437 |
-
} else {
|
438 |
-
$data = GAWD_helper::ajax_request($gawd_request_last_args, $view_id);
|
439 |
-
if($data === false) {
|
440 |
-
return $response;
|
441 |
-
}
|
442 |
-
}
|
443 |
-
|
444 |
-
if($gawd_compare_request_last_args !== null) {
|
445 |
-
|
446 |
-
$compare_data = GAWD_helper::ajax_request($gawd_compare_request_last_args, $view_id);
|
447 |
-
|
448 |
-
if($compare_data === false) {
|
449 |
-
return $response;
|
450 |
-
}
|
451 |
-
|
452 |
-
} else {
|
453 |
-
$compare_data = null;
|
454 |
-
}
|
455 |
-
|
456 |
-
include_once 'library/file-generators/gawd-csv-generator-class.php';
|
457 |
-
$csv = new GAWD_csv_file_generator();
|
458 |
-
$csv->parse_data($data, $gawd_request_last_args, $compare_data, $gawd_compare_request_last_args, $compare_by);
|
459 |
-
if(!empty($menu_name)) {
|
460 |
-
$csv->set_menu_name(sanitize_text_field($menu_name));
|
461 |
-
}
|
462 |
-
|
463 |
-
$site_title = "";
|
464 |
-
if($view_id !== null) {
|
465 |
-
$site_title = GAWD_helper::get_account_name_by_profile_id($view_id);
|
466 |
-
} else {
|
467 |
-
$last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
468 |
-
if(isset($last_viewed_profile['web_property_name'])) {
|
469 |
-
$site_title = $last_viewed_profile['web_property_name'];
|
470 |
-
}
|
471 |
-
}
|
472 |
-
|
473 |
-
if(!empty($site_title)) {
|
474 |
-
$csv->set_site_title($site_title);
|
475 |
-
}
|
476 |
-
|
477 |
-
$csv->generate();
|
478 |
-
|
479 |
-
$response['success'] = true;
|
480 |
-
$response['error'] = array();
|
481 |
-
$response['data'] = array('download_url' => $csv->get_file_url());
|
482 |
-
$response['csv_generator'] = $csv;
|
483 |
-
$response['ajax_args'] = array(
|
484 |
-
'last_args' => $gawd_request_last_args,
|
485 |
-
'compare_last_args' => $gawd_compare_request_last_args,
|
486 |
-
'compare_by' => $compare_by,
|
487 |
-
'menu_name' => $menu_name,
|
488 |
-
'info' => $info
|
489 |
-
);
|
490 |
-
|
491 |
-
return $response;
|
492 |
-
}
|
493 |
-
|
494 |
-
public function gawd_email_scheduled(){
|
495 |
-
|
496 |
-
$gawd_emails_info = get_option('gawd_emails_info');
|
497 |
-
if(empty($gawd_emails_info)) {
|
498 |
-
return;
|
499 |
-
}
|
500 |
-
|
501 |
-
include_once 'library/gawd-email-class.php';
|
502 |
-
|
503 |
-
$now = time();
|
504 |
-
$new_dates = array();
|
505 |
-
|
506 |
-
foreach($gawd_emails_info as $i => $email_info) {
|
507 |
-
|
508 |
-
if($now < $email_info['next_date']) {
|
509 |
-
continue;
|
510 |
-
}
|
511 |
-
|
512 |
-
$new_dates[] = $i;
|
513 |
-
|
514 |
-
$email = new GAWD_email();
|
515 |
-
$email->set_email_info($email_info['email_info']);
|
516 |
-
|
517 |
-
if($email->check_condition($email_info) === false) {
|
518 |
-
continue;
|
519 |
-
}
|
520 |
-
|
521 |
-
$email->add_content();
|
522 |
-
|
523 |
-
$file_response = $this->generate_csv_file($email_info['ajax_args'], $email_info['email_info']['view_id'], $email->get_ajax_response());
|
524 |
-
|
525 |
-
if($file_response['success'] === false) {
|
526 |
-
continue;
|
527 |
-
}
|
528 |
-
|
529 |
-
$email->attach_file($file_response['csv_generator']);
|
530 |
-
$email->send_mail();
|
531 |
-
}
|
532 |
-
|
533 |
-
if(!empty($new_dates)) {
|
534 |
-
|
535 |
-
foreach($new_dates as $i => $index) {
|
536 |
-
$info = GAWD_email::calc_next_date($gawd_emails_info[$index]);
|
537 |
-
$info = GAWD_email::calc_date_range($info);
|
538 |
-
$gawd_emails_info[$index] = $info;
|
539 |
-
}
|
540 |
-
|
541 |
-
update_option('gawd_emails_info', $gawd_emails_info);
|
542 |
-
|
543 |
-
$this->gawd_email_scheduled();
|
544 |
-
return;
|
545 |
-
} else {
|
546 |
-
GAWD_email::set_new_scheduled();
|
547 |
-
}
|
548 |
-
|
549 |
-
}
|
550 |
-
|
551 |
-
public static function get_domain($domain){
|
552 |
-
$root = explode('/', $domain);
|
553 |
-
$ret_domain = str_ireplace('www', '', isset($root[2]) ? $root[2] : $domain);
|
554 |
-
|
555 |
-
return $ret_domain;
|
556 |
-
}
|
557 |
-
|
558 |
-
public static function error_message($type, $message){
|
559 |
-
echo '<div style="width:99%"><div class="' . $type . '"><p><strong>' . $message . '</strong></p></div></div>';
|
560 |
-
}
|
561 |
-
|
562 |
-
public function gawd_export(){
|
563 |
-
if(!isset($_REQUEST['action']) || (isset($_REQUEST['action']) && $_REQUEST['action'] !== 'gawd_export')) {
|
564 |
-
return;
|
565 |
-
}
|
566 |
-
|
567 |
-
$export_type = isset($_REQUEST["export_type"]) ? sanitize_text_field($_REQUEST["export_type"]) : '';
|
568 |
-
if($export_type != 'pdf' && $export_type != 'csv') {
|
569 |
-
return;
|
570 |
-
}
|
571 |
-
|
572 |
-
$report_type = isset($_REQUEST["report_type"]) ? sanitize_text_field($_REQUEST["report_type"]) : '';
|
573 |
-
|
574 |
-
require_once(GAWD_DIR . '/admin/gawd_google_class.php');
|
575 |
-
$this->gawd_google_client = GAWD_google_client::get_instance();
|
576 |
-
|
577 |
-
if($export_type == 'pdf') {
|
578 |
-
include_once GAWD_DIR . '/include/gawd_pdf_file.php';
|
579 |
-
$file = new GAWD_PDF_FILE();
|
580 |
-
} else {
|
581 |
-
include_once GAWD_DIR . '/include/gawd_csv_file.php';
|
582 |
-
$file = new GAWD_CSV_FILE();
|
583 |
-
}
|
584 |
-
|
585 |
-
if($report_type == 'alert') {
|
586 |
-
if($export_type == 'pdf') {
|
587 |
-
$file->export_file();
|
588 |
-
} else {
|
589 |
-
$file->export_file();
|
590 |
-
}
|
591 |
-
} else {
|
592 |
-
$metric = isset($_REQUEST["gawd_metric"]) ? sanitize_text_field($_REQUEST["gawd_metric"]) : '';
|
593 |
-
$_data_compare = isset($_REQUEST["_data_compare"]) ? sanitize_text_field($_REQUEST["_data_compare"]) : '';
|
594 |
-
$first_data = isset($_REQUEST["first_data"]) ? sanitize_text_field($_REQUEST["first_data"]) : '';
|
595 |
-
$view_id = isset($_REQUEST["view_id"]) ? sanitize_text_field($_REQUEST["view_id"]) : '';
|
596 |
-
$metric_compare = isset($_REQUEST["gawd_metric_compare"]) ? sanitize_text_field($_REQUEST["gawd_metric_compare"]) : '';
|
597 |
-
$dimension = isset($_REQUEST["gawd_dimension"]) ? sanitize_text_field($_REQUEST["gawd_dimension"]) : '';
|
598 |
-
$tab_name = isset($_REQUEST["tab_name"]) ? sanitize_text_field($_REQUEST["tab_name"]) : '';
|
599 |
-
$img = isset($_REQUEST["img"]) ? sanitize_text_field($_REQUEST["img"]) : '';
|
600 |
-
$gawd_email_subject = isset($_REQUEST["gawd_email_subject"]) ? sanitize_text_field($_REQUEST["gawd_email_subject"]) : '';
|
601 |
-
$gawd_email_body = isset($_REQUEST["gawd_email_body"]) && $_REQUEST["gawd_email_body"] != '' ? sanitize_text_field($_REQUEST["gawd_email_body"]) : ' ';
|
602 |
-
$email_from = isset($_REQUEST["gawd_email_from"]) ? sanitize_email($_REQUEST["gawd_email_from"]) : '';
|
603 |
-
$email_to = isset($_REQUEST["gawd_email_to"]) ? sanitize_email($_REQUEST["gawd_email_to"]) : '';
|
604 |
-
$email_period = isset($_REQUEST["gawd_email_period"]) ? sanitize_text_field($_REQUEST["gawd_email_period"]) : '';
|
605 |
-
$week_day = isset($_REQUEST["gawd_email_week_day"]) ? sanitize_text_field($_REQUEST["gawd_email_week_day"]) : '';
|
606 |
-
$month_day = isset($_REQUEST["gawd_email_month_day"]) ? sanitize_text_field($_REQUEST["gawd_email_month_day"]) : '';
|
607 |
-
$email_time = isset($_REQUEST["email_time"]) ? sanitize_text_field($_REQUEST["email_time"]) : '';
|
608 |
-
$emails = array();
|
609 |
-
$invalid_email = false;
|
610 |
-
$email_to = explode(',', $email_to);
|
611 |
-
foreach($email_to as $email) {
|
612 |
-
if(is_email($email) == false) {
|
613 |
-
$emails = $email;
|
614 |
-
}
|
615 |
-
}
|
616 |
-
if(count($emails) > 0) {
|
617 |
-
$invalid_email = true;
|
618 |
-
}
|
619 |
-
if(($invalid_email != true) && is_email($email_from) && $gawd_email_subject != '') {
|
620 |
-
if($email_period == "once") {
|
621 |
-
$file->get_request_data($this);
|
622 |
-
$file->sort_data();
|
623 |
-
if($export_type == 'csv') {
|
624 |
-
if($first_data != '') {
|
625 |
-
$file->create_file(false);
|
626 |
-
} else {
|
627 |
-
$file->create_file();
|
628 |
-
}
|
629 |
-
} else {
|
630 |
-
if($first_data != '') {
|
631 |
-
$file->create_file('pages');
|
632 |
-
} elseif(($_data_compare) != '') {
|
633 |
-
$file->create_file('compare');
|
634 |
-
} else {
|
635 |
-
$file->create_file(false);
|
636 |
-
}
|
637 |
-
}
|
638 |
-
$attachment = $file->file_dir;
|
639 |
-
|
640 |
-
if($report_type == 'email') {
|
641 |
-
$headers = 'From: <' . $email_from . '>';
|
642 |
-
wp_mail($email_to, $gawd_email_subject, $gawd_email_body, $headers, $attachment);
|
643 |
-
}
|
644 |
-
echo json_encode(array('status' => 'success', 'msg' => 'Email successfuly sent'));
|
645 |
-
} else {
|
646 |
-
if($email_period == 'gawd_weekly') {
|
647 |
-
$period_day = $week_day;
|
648 |
-
$timestamp = strtotime('this ' . $period_day . ' ' . $email_time);
|
649 |
-
} elseif($email_period == 'gawd_monthly') {
|
650 |
-
$period_day = $month_day;
|
651 |
-
$timestamp = strtotime(date('Y-m-' . $period_day . ' ' . $email_time));
|
652 |
-
} else {
|
653 |
-
$period_day = '';
|
654 |
-
$timestamp = strtotime(date('Y-m-d ' . $email_time));
|
655 |
-
}
|
656 |
-
$saved_email = get_option('gawd_email');
|
657 |
-
if($saved_email) {
|
658 |
-
$gawd_email_options = array(
|
659 |
-
'name' => $gawd_email_subject,
|
660 |
-
'period' => $email_period,
|
661 |
-
'metric' => $metric,
|
662 |
-
'metric_compare' => $metric_compare,
|
663 |
-
'dimension' => $dimension,
|
664 |
-
'creation_date' => date('Y-m-d') . ' ' . $email_time,
|
665 |
-
'emails' => $email_to,
|
666 |
-
'email_from' => $email_from,
|
667 |
-
'email_subject' => $gawd_email_subject,
|
668 |
-
'email_body' => $gawd_email_body,
|
669 |
-
'period_day' => $period_day,
|
670 |
-
'period_time' => $email_time,
|
671 |
-
'img' => $img,
|
672 |
-
'tab_name' => $tab_name,
|
673 |
-
'view_id' => $view_id,
|
674 |
-
'export_type' => $export_type
|
675 |
-
);
|
676 |
-
$saved_email[] = $gawd_email_options;
|
677 |
-
update_option('gawd_email', $saved_email);
|
678 |
-
} else {
|
679 |
-
$gawd_email_options = array(
|
680 |
-
0 => array(
|
681 |
-
'name' => $gawd_email_subject,
|
682 |
-
'period' => $email_period,
|
683 |
-
'metric' => $metric,
|
684 |
-
'metric_compare' => $metric_compare,
|
685 |
-
'dimension' => $dimension,
|
686 |
-
'creation_date' => date('Y-m-d') . ' ' . $email_time,
|
687 |
-
'emails' => $email_to,
|
688 |
-
'email_from' => $email_from,
|
689 |
-
'email_subject' => $gawd_email_subject,
|
690 |
-
'email_body' => $gawd_email_body,
|
691 |
-
'period_day' => $period_day,
|
692 |
-
'period_time' => $email_time,
|
693 |
-
'img' => $img,
|
694 |
-
'tab_name' => $tab_name,
|
695 |
-
'view_id' => $view_id,
|
696 |
-
'export_type' => $export_type
|
697 |
-
)
|
698 |
-
);
|
699 |
-
update_option('gawd_email', $gawd_email_options);
|
700 |
-
}
|
701 |
-
$saved_email = get_option('gawd_email');
|
702 |
-
if($saved_email) {
|
703 |
-
foreach($saved_email as $email) {
|
704 |
-
if(!wp_next_scheduled('gawd_email_' . $email['period'])) {
|
705 |
-
wp_schedule_event($timestamp, $email['period'], 'gawd_email_' . $email['period']);
|
706 |
-
}
|
707 |
-
}
|
708 |
-
}
|
709 |
-
$success_message = 'Email successfuly Scheduled </br> Go to <a href="' . admin_url() . 'admin.php?page=gawd_settings#gawd_emails_tab">Settings page</a> to delete scheduled e-mails.';
|
710 |
-
echo json_encode(array('status' => 'success', 'msg' => $success_message));
|
711 |
-
}
|
712 |
-
|
713 |
-
die;
|
714 |
-
} else {
|
715 |
-
if($invalid_email == true) {
|
716 |
-
echo json_encode('Invalid email');
|
717 |
-
die;
|
718 |
-
} else if($gawd_email_subject == '') {
|
719 |
-
echo json_encode("Can't send email with empty subject");
|
720 |
-
die;
|
721 |
-
}
|
722 |
-
}
|
723 |
-
}
|
724 |
-
}
|
725 |
-
|
726 |
-
public function overview_date_meta($screen = null, $context = 'advanced'){
|
727 |
-
//righ side wide meta..
|
728 |
-
$orintation = wp_is_mobile() ? 'side' : 'normal';
|
729 |
-
add_meta_box('gawd-real-time', __('Real Time', 'gawd'), array(
|
730 |
-
$this,
|
731 |
-
'gawd_real_time'
|
732 |
-
), 'gawd_analytics', 'side', 'high');
|
733 |
-
add_meta_box('gawd-date-meta', __('Audience', 'gawd'), array(
|
734 |
-
$this,
|
735 |
-
'gawd_date_box'
|
736 |
-
), 'gawd_analytics', $orintation, null);
|
737 |
-
add_meta_box('gawd-country-box', __('Location', 'gawd'), array(
|
738 |
-
$this,
|
739 |
-
'gawd_country_box'
|
740 |
-
), 'gawd_analytics', $orintation, null);
|
741 |
-
//left side thin meta.
|
742 |
-
add_meta_box('gawd-visitors-meta', __('Visitors', 'gawd'), array(
|
743 |
-
$this,
|
744 |
-
'gawd_visitors'
|
745 |
-
), 'gawd_analytics', 'side', null);
|
746 |
-
add_meta_box('gawd-browser-meta', __('Browsers', 'gawd'), array(
|
747 |
-
$this,
|
748 |
-
'gawd_browser'
|
749 |
-
), 'gawd_analytics', 'side', null);
|
750 |
-
}
|
751 |
-
|
752 |
-
public function gawd_date_box(){
|
753 |
-
require_once('admin/pages/date.php');
|
754 |
-
}
|
755 |
-
|
756 |
-
public function gawd_country_box(){
|
757 |
-
require_once('admin/pages/location.php');
|
758 |
-
}
|
759 |
-
|
760 |
-
public function gawd_real_time(){
|
761 |
-
require_once('admin/pages/real_time.php');
|
762 |
-
}
|
763 |
-
|
764 |
-
public function gawd_visitors(){
|
765 |
-
require_once('admin/pages/visitors.php');
|
766 |
-
}
|
767 |
-
|
768 |
-
public function gawd_browser(){
|
769 |
-
require_once('admin/pages/browser.php');
|
770 |
-
}
|
771 |
-
|
772 |
-
|
773 |
-
/**
|
774 |
-
* Enqueues the required styles and scripts, localizes some js variables.
|
775 |
-
*/
|
776 |
-
public function gawd_front_scripts(){
|
777 |
-
wp_enqueue_style('admin_css', GAWD_URL . '/inc/css/gawd_admin.css', false, GAWD_VERSION);
|
778 |
-
/*wp_enqueue_script( 'date-js', GAWD_URL . '/inc/js/date.js', array( 'jquery' ), GAWD_VERSION );*/
|
779 |
-
wp_enqueue_script('gawd_front_js', GAWD_URL . '/inc/js/gawd_front.js', array('jquery'), GAWD_VERSION);
|
780 |
-
|
781 |
-
wp_enqueue_script('gawd_charts', GAWD_URL . '/inc/js/gawd_charts.js', array('gawd_plotly_basic'), GAWD_VERSION);
|
782 |
-
wp_enqueue_script('gawd_plotly_basic', GAWD_URL . '/inc/js/plotly-basic.min.js', array('jquery'), GAWD_VERSION);
|
783 |
-
|
784 |
-
wp_localize_script('gawd_front_js', 'gawd_front', array(
|
785 |
-
'ajaxurl' => admin_url('admin-ajax.php'),
|
786 |
-
'ajaxnonce' => wp_create_nonce('gawd_admin_page_nonce'),
|
787 |
-
'gawd_plugin_url' => GAWD_URL,
|
788 |
-
'date_30' => date('Y-m-d', strtotime('-31 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
789 |
-
'date_7' => date('Y-m-d', strtotime('-8 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
790 |
-
'date_last_week' => date('Y-m-d', strtotime('last week -1day')) . '/-/' . date('Y-m-d', strtotime('last week +5day')),
|
791 |
-
'date_last_month' => date('Y-m-01', strtotime('last month')) . '/-/' . date('Y-m-t', strtotime('last month')),
|
792 |
-
'date_this_month' => date('Y-m-01') . '/-/' . date('Y-m-d'),
|
793 |
-
'date_today' => date('Y-m-d') . '/-/' . date('Y-m-d'),
|
794 |
-
'date_yesterday' => date('Y-m-d', strtotime('-1 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
795 |
-
'wp_admin_url' => admin_url(),
|
796 |
-
'gawd_custom_ajax_nonce' => wp_create_nonce('gawd_custom_ajax'),
|
797 |
-
'gawd_custom_ajax_nonce_data' => array(
|
798 |
-
'action' => 'gawd_ajax_front',
|
799 |
-
'nonce' => wp_create_nonce('gawd_ajax_front'),
|
800 |
-
),
|
801 |
-
'exportUrl' => add_query_arg(array('action' => 'gawd_export'), admin_url('admin-ajax.php'))
|
802 |
-
));
|
803 |
-
}
|
804 |
-
|
805 |
-
public function gawd_enqueue_scripts(){
|
806 |
-
$options = get_option('gawd_settings');
|
807 |
-
$default_date = (isset($options['default_date']) && $options['default_date'] != '') ? $options['default_date'] : 'last_30days';
|
808 |
-
$default_date_format = (isset($options['default_date_format']) && $options['default_date_format'] != '') ? $options['default_date_format'] : 'ymd_with_week';
|
809 |
-
$enable_hover_tooltip = (isset($options['enable_hover_tooltip']) && $options['enable_hover_tooltip'] != '') ? $options['enable_hover_tooltip'] : '';
|
810 |
-
$screen = get_current_screen();
|
811 |
-
|
812 |
-
$gawd_user_status = get_option('gawd_user_status');
|
813 |
-
|
814 |
-
$is_gawd_page = in_array($screen->id, $this->gawd_pages);
|
815 |
-
$is_dashboard = (strpos($screen->id, 'dashboard') !== false);
|
816 |
-
$is_post_page = ($screen->base === "edit" && !empty($screen->post_type));
|
817 |
-
$include_scripts_in_wp_admin_pages = (($is_post_page || strpos($screen->base, 'dashboard') !== false || strpos($screen->base, 'edit') !== false) && $gawd_user_status == '1');
|
818 |
-
|
819 |
-
if(strpos($screen->base, 'gawd') !== false || $include_scripts_in_wp_admin_pages) {
|
820 |
-
|
821 |
-
|
822 |
-
wp_enqueue_script('jquery');
|
823 |
-
wp_enqueue_script('jquery-ui-widget');
|
824 |
-
|
825 |
-
wp_enqueue_script('common');
|
826 |
-
wp_enqueue_script('wp-lists');
|
827 |
-
wp_enqueue_script('postbox');
|
828 |
-
wp_enqueue_script('jquery-ui-tooltip');
|
829 |
-
wp_enqueue_script('gawd_paging', GAWD_URL . '/inc/js/paging.js', array('jquery-ui-widget'), GAWD_VERSION);
|
830 |
-
wp_enqueue_script('jquery.cookie', GAWD_URL . '/inc/js/jquery.cookie.js', false, GAWD_VERSION);
|
831 |
-
wp_enqueue_style('timepicker_css', GAWD_URL . '/inc/css/jquery.timepicker.css', false, GAWD_VERSION);
|
832 |
-
wp_enqueue_style('admin_css', GAWD_URL . '/inc/css/gawd_admin.css', false, GAWD_VERSION);
|
833 |
-
wp_enqueue_style('gawd_dataTables_responsive_css', GAWD_URL . '/inc/css/responsive.dataTables.min.css', false, GAWD_VERSION);
|
834 |
-
wp_enqueue_style('gawd_dataTables_ui_css', GAWD_URL . '/inc/css/dataTables.jqueryui.min.css', false, GAWD_VERSION);
|
835 |
-
wp_enqueue_style('gawd_dataTables_base_ui_css', GAWD_URL . '/inc/css/dataTables-jquery-ui-base.css', false, GAWD_VERSION);
|
836 |
-
wp_enqueue_style('font-awesome', GAWD_URL . '/inc/css/font_awesome.css', false, GAWD_VERSION);
|
837 |
-
//wp_enqueue_style('jquery-ui.css', GAWD_URL . '/inc/css/jquery-ui.css', false, GAWD_VERSION);
|
838 |
-
if(strpos($screen->post_type, 'page') === false && strpos($screen->post_type, 'post') === false && strpos($screen->base, 'edit') === false) {
|
839 |
-
wp_enqueue_style('gawd_bootstrap', GAWD_URL . '/inc/css/bootstrap.css', false, GAWD_VERSION);
|
840 |
-
wp_enqueue_style('gawd_bootstrap-chosen', GAWD_URL . '/inc/css/bootstrap-chosen.css', false, GAWD_VERSION);
|
841 |
-
wp_enqueue_style('gawd_bootstrap-select', GAWD_URL . '/inc/css/bootstrap-select.css', false, GAWD_VERSION);
|
842 |
-
}
|
843 |
-
wp_enqueue_style('gawd_datepicker', GAWD_URL . '/inc/css/daterangepicker.css', false, GAWD_VERSION);
|
844 |
-
wp_enqueue_script('gawd_moment', GAWD_URL . '/inc/js/moment.min.js', false, GAWD_VERSION);
|
845 |
-
wp_enqueue_script('gawd_daterangepicker', GAWD_URL . '/inc/js/daterangepicker.js', false, GAWD_VERSION);
|
846 |
-
/*Map*/
|
847 |
-
wp_enqueue_script('gawd_map_chart', GAWD_URL . '/inc/js/gawd_map_chart.js', false, GAWD_VERSION);
|
848 |
-
/*End Map*/
|
849 |
-
wp_enqueue_script('rgbcolor.js', GAWD_URL . '/inc/js/rgbcolor.js', array('jquery'), GAWD_VERSION);
|
850 |
-
wp_enqueue_script('StackBlur.js', GAWD_URL . '/inc/js/StackBlur.js', array('jquery'), GAWD_VERSION);
|
851 |
-
wp_enqueue_script('canvg.js', GAWD_URL . '/inc/js/canvg.js', array('jquery'), GAWD_VERSION);
|
852 |
-
wp_enqueue_script('gawd_tables', GAWD_URL . '/inc/js/loader.js', array('jquery'), GAWD_VERSION);
|
853 |
-
wp_enqueue_script('date-js', GAWD_URL . '/inc/js/date.js', array('jquery'), GAWD_VERSION);
|
854 |
-
wp_enqueue_script('timepicker_js', GAWD_URL . '/inc/js/jquery.timepicker.min.js', array('jquery'), GAWD_VERSION);
|
855 |
-
wp_enqueue_script('admin_js', GAWD_URL . '/inc/js/gawd_admin.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
856 |
-
wp_enqueue_script('gawd_datatables_js', GAWD_URL . '/inc/js/jquery.dataTables.min.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
857 |
-
wp_enqueue_script('chosen.jquery.js', GAWD_URL . '/inc/js/chosen.jquery.js', array('jquery'), GAWD_VERSION);
|
858 |
-
wp_enqueue_script('gawd_datatables_responsive_js', GAWD_URL . '/inc/js/dataTables.responsive.min.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
859 |
-
wp_enqueue_script('gawd_datatables_ui_js', GAWD_URL . '/inc/js/dataTables.jqueryui.min.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
860 |
-
|
861 |
-
if(strpos($screen->post_type, 'page') === false && strpos($screen->post_type, 'post') === false && strpos($screen->base, 'edit') === false) {
|
862 |
-
wp_enqueue_script('bootstrap_js', GAWD_URL . '/inc/js/bootstrap.min.js', array('jquery'), '4.3.1');
|
863 |
-
wp_enqueue_script('bootstrap-select', GAWD_URL . '/inc/js/bootstrap-select.js', array('jquery'), GAWD_VERSION);
|
864 |
-
}
|
865 |
-
wp_enqueue_script('highlight_js', GAWD_URL . '/inc/js/js_highlight.js', array('jquery'), GAWD_VERSION);
|
866 |
-
wp_enqueue_script('settings_js', GAWD_URL . '/inc/js/gawd_settings.js', array('jquery'), GAWD_VERSION);
|
867 |
-
wp_enqueue_script('overview', GAWD_URL . '/inc/js/gawd_overview.js', array('jquery'), GAWD_VERSION);
|
868 |
-
wp_localize_script('overview', 'gawd_overview', array(
|
869 |
-
'ajaxurl' => admin_url('admin-ajax.php'),
|
870 |
-
'ajaxnonce' => wp_create_nonce('gawd_admin_page_nonce'),
|
871 |
-
'gawd_plugin_url' => GAWD_URL,
|
872 |
-
'default_date' => $default_date,
|
873 |
-
'enableHoverTooltip' => $enable_hover_tooltip,
|
874 |
-
'wp_admin_url' => admin_url()
|
875 |
-
));
|
876 |
-
|
877 |
-
if($is_gawd_page){
|
878 |
-
$gawd_custom_ajax_nonce_data = array(
|
879 |
-
'action' => 'gawd_analytics_pages',
|
880 |
-
'nonce' => wp_create_nonce('gawd_analytics_pages'),
|
881 |
-
);
|
882 |
-
}else if($is_post_page){
|
883 |
-
$gawd_custom_ajax_nonce_data = array(
|
884 |
-
'action' => 'gawd_post_pages',
|
885 |
-
'nonce' => wp_create_nonce('gawd_post_pages'),
|
886 |
-
);
|
887 |
-
}else if($is_dashboard){
|
888 |
-
$gawd_custom_ajax_nonce_data = array(
|
889 |
-
'action' => 'gawd_dashboard',
|
890 |
-
'nonce' => wp_create_nonce('gawd_dashboard'),
|
891 |
-
);
|
892 |
-
}else{
|
893 |
-
$gawd_custom_ajax_nonce_data = array(
|
894 |
-
'action' => '',
|
895 |
-
'nonce' => ''
|
896 |
-
);
|
897 |
-
}
|
898 |
-
|
899 |
-
|
900 |
-
wp_localize_script('admin_js', 'gawd_admin', array(
|
901 |
-
'ajaxurl' => admin_url('admin-ajax.php'),
|
902 |
-
'ajaxnonce' => wp_create_nonce('gawd_admin_page_nonce'),
|
903 |
-
'gawd_plugin_url' => GAWD_URL,
|
904 |
-
'wp_admin_url' => admin_url(),
|
905 |
-
'enableHoverTooltip' => $enable_hover_tooltip,
|
906 |
-
'default_date' => $default_date,
|
907 |
-
'default_date_format' => $default_date_format,
|
908 |
-
'date_30' => date('Y-m-d', strtotime('-31 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
909 |
-
'date_7' => date('Y-m-d', strtotime('-8 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
910 |
-
'date_last_week' => date('Y-m-d', strtotime('last week -1day')) . '/-/' . date('Y-m-d', strtotime('last week +5day')),
|
911 |
-
'date_last_month' => date('Y-m-01', strtotime('last month')) . '/-/' . date('Y-m-t', strtotime('last month')),
|
912 |
-
'date_this_month' => date('Y-m-01') . '/-/' . date('Y-m-d'),
|
913 |
-
'date_today' => date('Y-m-d') . '/-/' . date('Y-m-d'),
|
914 |
-
'date_yesterday' => date('Y-m-d', strtotime('-1 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
915 |
-
'exportUrl' => add_query_arg(array('action' => 'gawd_export'), admin_url('admin-ajax.php')),
|
916 |
-
'gawd_custom_ajax_nonce' => wp_create_nonce('gawd_custom_ajax'),
|
917 |
-
'gawd_custom_ajax_nonce_data' => $gawd_custom_ajax_nonce_data,
|
918 |
-
'gawd_has_property' => (GAWD_helper::gawd_has_property() ? '1' : '0'),
|
919 |
-
));
|
920 |
-
}
|
921 |
-
if(strpos($screen->base, 'gawd_uninstall') !== false) {
|
922 |
-
wp_enqueue_style('gawd_deactivate-css', GAWD_URL . '/wd/assets/css/deactivate_popup.css', array(), GAWD_VERSION);
|
923 |
-
wp_enqueue_script('gawd-deactivate-popup', GAWD_URL . '/wd/assets/js/deactivate_popup.js', array(), GAWD_VERSION, true);
|
924 |
-
$admin_data = wp_get_current_user();
|
925 |
-
|
926 |
-
wp_localize_script('gawd-deactivate-popup', 'gawdWDDeactivateVars', array(
|
927 |
-
"prefix" => "gawd",
|
928 |
-
"deactivate_class" => 'gawd_deactivate_link',
|
929 |
-
"email" => $admin_data->data->user_email,
|
930 |
-
"plugin_wd_url" => "https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin",
|
931 |
-
));
|
932 |
-
}
|
933 |
-
wp_enqueue_script('gawd_common_js', GAWD_URL . '/inc/js/gawd_common.js', array('jquery'), GAWD_VERSION);
|
934 |
-
|
935 |
-
wp_enqueue_script('gawd_charts', GAWD_URL . '/inc/js/gawd_charts.js', array('gawd_plotly_basic'), GAWD_VERSION);
|
936 |
-
wp_enqueue_script('gawd_plotly_basic', GAWD_URL . '/inc/js/plotly-basic.min.js', array('jquery'), GAWD_VERSION);
|
937 |
-
}
|
938 |
-
|
939 |
-
/**
|
940 |
-
* Adds the menu page with its submenus.
|
941 |
-
*/
|
942 |
-
public function gawd_add_menu(){
|
943 |
-
$permission = 'read';
|
944 |
-
$parent_slug = "gawd_analytics";
|
945 |
-
|
946 |
-
/*Free*/
|
947 |
-
if(get_option("gawd_subscribe_done") !== '1') {
|
948 |
-
return;
|
949 |
-
}
|
950 |
-
|
951 |
-
if(GAWD_helper::gawd_is_ready()) {
|
952 |
-
|
953 |
-
$this->gawd_pages[] = add_menu_page(
|
954 |
-
__('Analytics', 'gawd'), //$page_title
|
955 |
-
__('Analytics', 'gawd'), //$menu_title
|
956 |
-
$permission, //$capability
|
957 |
-
$parent_slug, //$menu_slug
|
958 |
-
array($this, ($this->view_permission) ? 'gawd_display_overview_page' : 'gawd_display_settings_page'), //$function = '',
|
959 |
-
GAWD_URL . '/assets/main_icon.png', "25");
|
960 |
-
|
961 |
-
if($this->view_permission === true) {
|
962 |
-
$this->gawd_pages[] = add_submenu_page(
|
963 |
-
$parent_slug, //$parent_slug
|
964 |
-
__('Analytics Dashboard', 'gawd'), //$page_title
|
965 |
-
__('Analytics Dashboard', 'gawd'), //$menu_title
|
966 |
-
$permission, //$capability
|
967 |
-
'gawd_analytics', //$menu_slug
|
968 |
-
array($this, 'gawd_display_overview_page') //$function = '',
|
969 |
-
);
|
970 |
-
|
971 |
-
$this->gawd_pages[] = add_submenu_page(
|
972 |
-
$parent_slug, //$parent_slug
|
973 |
-
__('Reports', 'gawd'), //$page_title
|
974 |
-
__('Reports', 'gawd'), //$menu_title
|
975 |
-
$permission, //$capability
|
976 |
-
'gawd_reports', //$menu_slug
|
977 |
-
array($this, 'gawd_display_reports_page') //$function = '',
|
978 |
-
);
|
979 |
-
}
|
980 |
-
|
981 |
-
if($this->settings_permission === true) {
|
982 |
-
$this->gawd_pages[] = add_submenu_page(
|
983 |
-
$parent_slug, //$parent_slug
|
984 |
-
__('Settings', 'gawd'), //$page_title
|
985 |
-
__('Settings', 'gawd'), //$menu_title
|
986 |
-
$permission, //$capability
|
987 |
-
($this->view_permission) ? 'gawd_settings' : 'gawd_analytics', //$menu_slug
|
988 |
-
array($this, 'gawd_display_settings_page') //$function = '',
|
989 |
-
);
|
990 |
-
|
991 |
-
$this->gawd_pages[] = add_submenu_page(
|
992 |
-
$parent_slug, //$parent_slug
|
993 |
-
__('Goal Management', 'gawd'), //$page_title
|
994 |
-
__('Goal Management', 'gawd'), //$menu_title
|
995 |
-
$permission, //$capability
|
996 |
-
'gawd_goals', //$menu_slug
|
997 |
-
array($this, 'gawd_display_goals_page') //$function = '',
|
998 |
-
);
|
999 |
-
|
1000 |
-
$this->gawd_pages[] = add_submenu_page(
|
1001 |
-
$parent_slug, //$parent_slug
|
1002 |
-
__('Custom Reports', 'gawd'), //$page_title
|
1003 |
-
__('Custom Reports', 'gawd'), //$menu_title
|
1004 |
-
$permission, //$capability
|
1005 |
-
'gawd_custom_reports', //$menu_slug
|
1006 |
-
array($this, 'gawd_display_custom_reports_page') //$function = '',
|
1007 |
-
);
|
1008 |
-
|
1009 |
-
// $this->gawd_pages[] = add_submenu_page(
|
1010 |
-
// $parent_slug, //$parent_slug
|
1011 |
-
// __('Get Paid', 'gawd'), //$page_title
|
1012 |
-
// __('Get Paid', 'gawd'), //$menu_title
|
1013 |
-
// $permission, //$capability
|
1014 |
-
// 'gawd_licensing', //$menu_slug
|
1015 |
-
// array($this, 'gawd_display_licensing_page') //$function = '',
|
1016 |
-
// );
|
1017 |
-
|
1018 |
-
$this->gawd_pages[] = add_submenu_page(
|
1019 |
-
$parent_slug, //$parent_slug
|
1020 |
-
__('Uninstall', 'gawd'), //$page_title
|
1021 |
-
__('Uninstall', 'gawd'), //$menu_title
|
1022 |
-
$permission, //$capability
|
1023 |
-
'gawd_uninstall', //$menu_slug
|
1024 |
-
array($this, 'gawd_display_uninstall_page') //$function = '',
|
1025 |
-
);
|
1026 |
-
}
|
1027 |
-
} else {
|
1028 |
-
|
1029 |
-
if($this->settings_permission) {
|
1030 |
-
$this->gawd_pages[] = add_menu_page(
|
1031 |
-
__('Analytics', 'gawd'), //$page_title
|
1032 |
-
__('Analytics', 'gawd'), //$menu_title
|
1033 |
-
$permission, //$capability
|
1034 |
-
$parent_slug, //$menu_slug
|
1035 |
-
array($this, 'gawd_display_settings_page_for_auth'), //$function = '',
|
1036 |
-
GAWD_URL . '/assets/main_icon.png', "25");
|
1037 |
-
|
1038 |
-
$this->gawd_pages[] = add_submenu_page(
|
1039 |
-
$parent_slug, //$parent_slug
|
1040 |
-
__('Settings', 'gawd'), //$page_title
|
1041 |
-
__('Settings', 'gawd'), //$menu_title
|
1042 |
-
$permission, //$capability
|
1043 |
-
'gawd_settings', //$menu_slug
|
1044 |
-
array($this, 'gawd_display_settings_page_for_auth') //$function = '',
|
1045 |
-
);
|
1046 |
-
}
|
1047 |
-
}
|
1048 |
-
|
1049 |
-
$this->gawd_pages[] = add_submenu_page(
|
1050 |
-
null, //$parent_slug
|
1051 |
-
__('Logs', 'gawd'), //$page_title
|
1052 |
-
__('Logs', 'gawd'), //$menu_title
|
1053 |
-
$permission, //$capability
|
1054 |
-
'gawd_logs', //$menu_slug
|
1055 |
-
array("GAWD_logs", "print_logs") //$function = '',
|
1056 |
-
);
|
1057 |
-
}
|
1058 |
-
|
1059 |
-
public function remove_first_menu(){
|
1060 |
-
if(!GAWD_helper::gawd_is_ready()) {
|
1061 |
-
remove_submenu_page('gawd_analytics', 'gawd_analytics');
|
1062 |
-
}
|
1063 |
-
}
|
1064 |
-
|
1065 |
-
public function gawd_display_licensing_page(){
|
1066 |
-
wp_enqueue_style('gawd_licensing', GAWD_URL . '/inc/css/gawd_licensing.css', false, GAWD_VERSION);
|
1067 |
-
require_once(GAWD_DIR . '/admin/pages/licensing.php');
|
1068 |
-
}
|
1069 |
-
|
1070 |
-
public function gawd_display_uninstall_page(){
|
1071 |
-
|
1072 |
-
require_once('admin/pages/uninstall.php');
|
1073 |
-
if(
|
1074 |
-
(isset($_POST['unistall_gawd']) && $_POST['unistall_gawd'] === 'yes') &&
|
1075 |
-
check_admin_referer('gawd_save_form', 'gawd_save_form_field') !== false
|
1076 |
-
) {
|
1077 |
-
|
1078 |
-
$deactivate_url = wp_nonce_url('plugins.php?action=deactivate&plugin=' . GWD_NAME . '/google-analytics-wd.php', 'deactivate-plugin_' . GWD_NAME . '/google-analytics-wd.php');
|
1079 |
-
$deactivate_url = str_replace('&', '&', $deactivate_url);
|
1080 |
-
|
1081 |
-
$gawd_uninstall = new GAWDUninstall();
|
1082 |
-
$gawd_uninstall->delete_options();
|
1083 |
-
|
1084 |
-
echo '<script>window.location.href="' . $deactivate_url . '";</script>';
|
1085 |
-
die;
|
1086 |
-
|
1087 |
-
}
|
1088 |
-
|
1089 |
-
if(get_option('gawd_credentials')) {
|
1090 |
-
|
1091 |
-
$gawd_uninstall = new GAWDUninstall();
|
1092 |
-
$gawd_uninstall->uninstall();
|
1093 |
-
|
1094 |
-
}
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
public function gawd_display_goals_page(){
|
1098 |
-
$this->premium_bar('gawd_goals');
|
1099 |
-
|
1100 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
1101 |
-
$property_id = $gawd_user_data['property_id'];
|
1102 |
-
$profiles = GAWD_helper::get_property_profiles($property_id);
|
1103 |
-
$property = GAWD_helper::get_property($property_id);
|
1104 |
-
$goals = get_option('gawd_goals_data');
|
1105 |
-
if(!is_array($goals)) {
|
1106 |
-
$goals = array();
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
$next_goals_id = GAWD_helper::get_next_goal_id($goals);
|
1110 |
-
$refresh_user_info_transient = get_site_transient('gawd_refresh_user_info');
|
1111 |
-
$display_goals_page = (!empty($gawd_user_data['property_id']));
|
1112 |
-
|
1113 |
-
require_once('admin/pages/goals.php');
|
1114 |
-
}
|
1115 |
-
|
1116 |
-
public function gawd_display_custom_reports_page(){
|
1117 |
-
$this->premium_bar('gawd_custom_reports');
|
1118 |
-
require_once('admin/pages/custom_reports.php');
|
1119 |
-
}
|
1120 |
-
|
1121 |
-
public function gawd_display_overview_page(){
|
1122 |
-
$this->premium_bar('gawd_analytics');
|
1123 |
-
$profiles = GAWD_helper::get_profiles();
|
1124 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
1125 |
-
require_once('admin/pages/overview.php');
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
public function gawd_display_reports_page(){
|
1129 |
-
$this->premium_bar('gawd_reports');
|
1130 |
-
$profiles = GAWD_helper::get_profiles();
|
1131 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
1132 |
-
require_once('admin/pages/dashboard.php');
|
1133 |
-
}
|
1134 |
-
|
1135 |
-
/**
|
1136 |
-
* Prepares the settings to be displayed then displays the settings page.
|
1137 |
-
*/
|
1138 |
-
public static function gawd_settings_defaults(){
|
1139 |
-
$settings = get_option('gawd_settings');
|
1140 |
-
$settings['gawd_tracking_enable'] = 'on';
|
1141 |
-
$settings['gawd_custom_dimension_Logged_in'] = 'on';
|
1142 |
-
$settings['gawd_custom_dimension_Post_type'] = 'on';
|
1143 |
-
$settings['gawd_custom_dimension_Author'] = 'on';
|
1144 |
-
$settings['gawd_custom_dimension_Category'] = 'on';
|
1145 |
-
$settings['gawd_custom_dimension_Published_Month'] = 'on';
|
1146 |
-
$settings['gawd_custom_dimension_Published_Year'] = 'on';
|
1147 |
-
$settings['gawd_custom_dimension_Tags'] = 'on';
|
1148 |
-
$settings['enable_hover_tooltip'] = 'on';
|
1149 |
-
$settings['gawd_show_in_dashboard'] = 'on';
|
1150 |
-
$settings['post_page_chart'] = 'on';
|
1151 |
-
$settings['gawd_anonymize'] = 'on';
|
1152 |
-
update_option('gawd_settings', $settings);
|
1153 |
-
}
|
1154 |
-
|
1155 |
-
public function gawd_admin_notice($message, $type, $class = ""){
|
1156 |
-
$class = 'notice notice-' . $type . ' ' . $class;
|
1157 |
-
echo '<div class="' . $class . '"><p>' . $message . '</p></div>';
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
public function gawd_display_settings_page(){
|
1161 |
-
|
1162 |
-
$this->premium_bar('gawd_settings');
|
1163 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
1164 |
-
|
1165 |
-
if(isset($_POST['gawd_settings_logout']) && $_POST['gawd_settings_logout'] == 1) {
|
1166 |
-
check_admin_referer('gawd_save_form', 'gawd_save_form_fild');
|
1167 |
-
GAWD_helper::delete_user_data();
|
1168 |
-
$redirect_url = admin_url() . 'admin.php?page=gawd_settings';
|
1169 |
-
echo '<script>window.location.href="' . $redirect_url . '";</script>';
|
1170 |
-
die;
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
$selected_account_data = $gawd_user_data;
|
1174 |
-
if(!empty($_POST['web_property_name']) && !empty($_POST['gawd_profile_id'])) {
|
1175 |
-
$selected_account_data['profile_id'] = sanitize_text_field($_POST['gawd_profile_id']);
|
1176 |
-
}
|
1177 |
-
|
1178 |
-
if(isset($_POST['web_property_name']) && $_POST['web_property_name'] != '') {
|
1179 |
-
|
1180 |
-
//todo filters
|
1181 |
-
// $gawd_user_data['gawd_id'] = isset($_POST['gawd_id']) ? $_POST['gawd_id'] : '';
|
1182 |
-
//
|
1183 |
-
// foreach($gawd_user_data['gawd_profiles'] as $web_property_name => $web_property) {
|
1184 |
-
// foreach($web_property as $profile) {
|
1185 |
-
// if($profile['id'] == $gawd_user_data['gawd_id']) {
|
1186 |
-
// $gawd_user_data['web_property_name'] = $web_property_name;
|
1187 |
-
// $gawd_user_data['webPropertyId'] = $profile['webPropertyId'];
|
1188 |
-
// $gawd_user_data['accountId'] = $profile['accountId'];
|
1189 |
-
// }
|
1190 |
-
// }
|
1191 |
-
// }
|
1192 |
-
// $gawd_user_data['web_property_name'] = isset($_POST['web_property_name']) ? $_POST['web_property_name'] : '';
|
1193 |
-
// update_option('gawd_user_data', $gawd_user_data);
|
1194 |
-
// $redirect_url = admin_url() . 'admin.php?page=gawd_settings';
|
1195 |
-
//echo '<script>window.location.href="'.$redirect_url.'";</script>';
|
1196 |
-
}
|
1197 |
-
|
1198 |
-
|
1199 |
-
if(empty($gawd_user_data['property_id']) && count(GAWD_helper::get_current_site_properties()) > 1) {
|
1200 |
-
$this->gawd_admin_notice(
|
1201 |
-
"You have two or more web-properties configured with current site url. Please go with <a class='gawd_tracking_notice_link' href='" . admin_url('admin.php?page=gawd_settings#gawd_tracking_tab') . "'>this</a> link to select the proper one.",
|
1202 |
-
'error');
|
1203 |
-
}
|
1204 |
-
|
1205 |
-
if(isset($_POST['gawd_email_remove'])){
|
1206 |
-
if(isset($_POST['gawd_save_form_fild']) && wp_verify_nonce($_POST['gawd_save_form_fild'], 'gawd_save_form')){
|
1207 |
-
include_once 'library/gawd-email-class.php';
|
1208 |
-
GAWD_email::delete_email(sanitize_text_field($_POST['gawd_email_remove']));
|
1209 |
-
}
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
require_once('admin/pages/settings.php');
|
1213 |
-
}
|
1214 |
-
|
1215 |
-
public function gawd_display_settings_page_for_auth(){
|
1216 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
1217 |
-
$gawd_credentials = GAWD_helper::get_project_credentials();
|
1218 |
-
|
1219 |
-
if(GAWD_helper::get_user_status() === "1") {
|
1220 |
-
$hide_auth = "gawd_hidden";
|
1221 |
-
$hide_refresh_accounts = "";
|
1222 |
-
} else {
|
1223 |
-
$hide_auth = "";
|
1224 |
-
$hide_refresh_accounts = "gawd_hidden";
|
1225 |
-
}
|
1226 |
-
|
1227 |
-
require_once('admin/pages/authentication.php');
|
1228 |
-
}
|
1229 |
-
|
1230 |
-
public function gawd_pushover_api($user_key, $metric, $condition, $value){
|
1231 |
-
$url = 'https://api.pushover.net/1/messages.json';
|
1232 |
-
$args = array(
|
1233 |
-
'timeout' => 45,
|
1234 |
-
'redirection' => 5,
|
1235 |
-
'blocking' => true,
|
1236 |
-
'headers' => array(),
|
1237 |
-
'body' => array(
|
1238 |
-
"token" => "aJBDhTfhR87EaTzs7wpx1MMKwboBjB",
|
1239 |
-
"user" => $user_key,
|
1240 |
-
"message" => 'The ' . $metric . ' less ' . $value
|
1241 |
-
),
|
1242 |
-
'cookies' => array()
|
1243 |
-
);
|
1244 |
-
wp_remote_post( $url, $args );
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
public function gawd_pushover_daily(){
|
1248 |
-
return;//todo
|
1249 |
-
$pushovers = get_option('gawd_pushovers');
|
1250 |
-
$data = '';
|
1251 |
-
$condition = '';
|
1252 |
-
|
1253 |
-
foreach($pushovers as $pushover) {
|
1254 |
-
if(isset($pushover['period']) && $pushover['period'] == 'daily') {
|
1255 |
-
//pls send email if ....
|
1256 |
-
$date = date('Y-m-d', strtotime('yesterday'));
|
1257 |
-
//todo get $data from wp options
|
1258 |
-
// $data = $gawd_client->get_data_alert('ga:' . $pushover['metric'], 'date', $date, $date, $pushover['pushover_view']);
|
1259 |
-
$pushover_condition = $pushover['condition'] == 'greater' ? '>' : '<';
|
1260 |
-
if(!eval($data . $pushover_condition . $pushover['value'] . ';')) {
|
1261 |
-
$cond = ' ' . $pushover['condition'] . ' than';
|
1262 |
-
$this->gawd_pushover_api($pushover['user_key'], $pushover['metric'], $pushover['condition'], $pushover['value']);
|
1263 |
-
}
|
1264 |
-
}
|
1265 |
-
}
|
1266 |
-
}
|
1267 |
-
|
1268 |
-
public function gawd_pushover_weekly(){
|
1269 |
-
return;//todo
|
1270 |
-
$pushovers = get_option('gawd_pushovers');
|
1271 |
-
$data = '';
|
1272 |
-
$condition = '';
|
1273 |
-
foreach($pushovers as $pushover) {
|
1274 |
-
if(isset($pushover['period']) && $pushover['period'] == 'gawd_weekly') {
|
1275 |
-
//pls send email if ....
|
1276 |
-
$start_date = date('Y-m-d', strtotime('last week -1 day'));
|
1277 |
-
$end_date = date('l') != 'Sunday' ? date('Y-m-d', strtotime('last sunday -1 day')) : date('Y-m-d', strtotime('-1 day'));
|
1278 |
-
//todo get $data from wp options
|
1279 |
-
// $data = $gawd_client->get_data_alert('ga:' . $pushover['metric'], 'date', $start_date, $end_date, $pushover['pushover_view']);
|
1280 |
-
$pushover_condition = $pushover['condition'] == 'greater' ? '>' : '<';
|
1281 |
-
if(!eval($data . $pushover_condition . $pushover['value'] . ';')) {
|
1282 |
-
$cond = ' ' . $pushover['condition'] . ' than';
|
1283 |
-
$this->gawd_pushover_api($pushover['user_key'], $pushover['metric'], $pushover['condition'], $pushover['value']);
|
1284 |
-
}
|
1285 |
-
}
|
1286 |
-
}
|
1287 |
-
}
|
1288 |
-
|
1289 |
-
public function gawd_pushover_monthly(){
|
1290 |
-
return;//todo
|
1291 |
-
$pushovers = get_option('gawd_pushovers');
|
1292 |
-
$data = '';
|
1293 |
-
$condition = '';
|
1294 |
-
foreach($pushovers as $pushover) {
|
1295 |
-
if(isset($pushover['period']) && $pushover['period'] == 'gawd_monthly') {
|
1296 |
-
//pls send email if ....
|
1297 |
-
$end_date = date('Y-m-t', strtotime('last month'));
|
1298 |
-
$start_date = date('Y-m-01', strtotime('last month'));
|
1299 |
-
//todo get $data from wp options
|
1300 |
-
// $data = $gawd_client->get_data_alert('ga:' . $pushover['metric'], 'date', $start_date, $end_date, $pushover['pushover_view']);
|
1301 |
-
$pushover_condition = $pushover['condition'] == 'greater' ? '>' : '<';
|
1302 |
-
if(!eval($data . $pushover_condition . $pushover['value'] . ';')) {
|
1303 |
-
$cond = ' ' . $pushover['condition'] . ' than';
|
1304 |
-
$this->gawd_pushover_api($pushover['user_key'], $pushover['metric'], $pushover['condition'], $pushover['value']);
|
1305 |
-
}
|
1306 |
-
}
|
1307 |
-
}
|
1308 |
-
}
|
1309 |
-
|
1310 |
-
public function gawd_alert_daily(){
|
1311 |
-
return;//todo
|
1312 |
-
$alerts = get_option('gawd_alerts');
|
1313 |
-
$data = '';
|
1314 |
-
$condition = '';
|
1315 |
-
$email_from = get_option('admin_email');
|
1316 |
-
foreach($alerts as $alert) {
|
1317 |
-
if(isset($alert['period']) && $alert['period'] == 'daily') {
|
1318 |
-
//pls send email if ....
|
1319 |
-
$date = date('Y-m-d', strtotime('yesterday'));
|
1320 |
-
//todo get $data from wp options
|
1321 |
-
// $data = $gawd_client->get_data_alert('ga:' . $alert['metric'], 'date', $date, $date, $alert['alert_view']);
|
1322 |
-
$alert_condition = $alert['condition'] == 'greater' ? '>' : '<';
|
1323 |
-
$color_condition = $alert['condition'] == 'greater' ? 'rgb(157, 207, 172)' : 'rgb(251, 133, 131)';
|
1324 |
-
if(!eval($data . $alert_condition . $alert['value'] . ';')) {
|
1325 |
-
$cond = ' ' . $alert['condition'] . ' than';
|
1326 |
-
$headers = array();
|
1327 |
-
$headers[] = 'From: <' . $email_from . '>';
|
1328 |
-
$headers[] = 'Content-Type: text/html';
|
1329 |
-
$content = '<div style="font-family: sans-serif;width:100%;height:50px;background-color:#FB8583;font-size:20px;color:#fff;margin-bottom:20px;text-align:center;line-height:50px">10Web Analytics Alert!</div><p style="color:#808080;text-align: center;font-size: 26px;font-family: sans-serif;">' . preg_replace('!\s+!', ' ', trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $alert['metric'])))) . ' in <a style="text-decoration:none;color:rgba(124,181,216,1);font-family: sans-serif;" href="' . $alert["alert_view_name"] . '" target="_blank">' . $alert["alert_view_name"] . '</a> are <span style="color:' . $color_condition . '">' . $cond . '</span></p><p style="color:rgba(124,181,216,1);font-size: 26px;font-family: sans-serif; text-align: center;">' . $alert['value'] . '</p>';
|
1330 |
-
wp_mail($alert['emails'], 'Analytics Alert', $content, $headers);
|
1331 |
-
}
|
1332 |
-
}
|
1333 |
-
}
|
1334 |
-
}
|
1335 |
-
|
1336 |
-
public function gawd_alert_weekly(){
|
1337 |
-
return;//todo
|
1338 |
-
$alerts = get_option('gawd_alerts');
|
1339 |
-
$data = '';
|
1340 |
-
$condition = '';
|
1341 |
-
$email_from = get_option('admin_email');
|
1342 |
-
foreach($alerts as $alert) {
|
1343 |
-
if(isset($alert['period']) && $alert['period'] == 'gawd_weekly') {
|
1344 |
-
//pls send email if ....
|
1345 |
-
$start_date = date('Y-m-d', strtotime('last week -1 day'));
|
1346 |
-
$end_date = date('l') != 'Sunday' ? date('Y-m-d', strtotime('last sunday -1 day')) : date('Y-m-d', strtotime('-1 day'));
|
1347 |
-
//todo get $data
|
1348 |
-
//$data = $gawd_client->get_data_alert('ga:' . $alert['metric'], 'date', $start_date, $end_date, $alert['alert_view']);
|
1349 |
-
$alert_condition = $alert['condition'] == 'greater' ? '>' : '<';
|
1350 |
-
if(!eval($data . $alert_condition . $alert['value'] . ';')) {
|
1351 |
-
$cond = ' ' . $alert['condition'] . ' than';
|
1352 |
-
$headers = array();
|
1353 |
-
$headers[] = 'From: <' . $email_from . '>';
|
1354 |
-
$headers[] = 'Content-Type: text/html';
|
1355 |
-
$content = '<div style="font-family: sans-serif;width:100%;height:50px;background-color:#FB8583;font-size:20px;color:#fff;margin-bottom:20px;text-align:center;line-height:50px">10Web Analytics Alert!</div><p style="color:#808080;text-align: center;font-size: 26px;font-family: sans-serif;">' . preg_replace('!\s+!', ' ', trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $alert['metric'])))) . ' in <a style="text-decoration:none;color:rgba(124,181,216,1);font-family: sans-serif;" href="' . $alert["alert_view_name"] . '" target="_blank">' . $alert["alert_view_name"] . '</a> are <span style="color:' . $color_condition . '">' . $cond . '</span></p><p style="color:rgba(124,181,216,1);font-size: 26px;font-family: sans-serif; text-align: center;">' . $alert['value'] . '</p>';
|
1356 |
-
wp_mail($alert['emails'], 'Analytics Alert', $content, $headers);
|
1357 |
-
}
|
1358 |
-
}
|
1359 |
-
}
|
1360 |
-
}
|
1361 |
-
|
1362 |
-
public function gawd_alert_monthly(){
|
1363 |
-
return;
|
1364 |
-
$alerts = get_option('gawd_alerts');
|
1365 |
-
$data = '';
|
1366 |
-
$email_from = get_option('admin_email');
|
1367 |
-
foreach($alerts as $alert) {
|
1368 |
-
if(isset($alert['period']) && $alert['period'] == 'gawd_monthly') {
|
1369 |
-
//pls send email if ....
|
1370 |
-
$end_date = date('Y-m-t', strtotime('last month'));
|
1371 |
-
$start_date = date('Y-m-01', strtotime('last month'));
|
1372 |
-
//todo get $data
|
1373 |
-
//$data = $gawd_client->get_data_alert('ga:' . $alert['metric'], 'date', $start_date, $end_date, $alert['alert_view']);
|
1374 |
-
$alert_condition = $alert['condition'] == 'greater' ? '>' : '<';
|
1375 |
-
if(!eval($data . $alert_condition . $alert['value'] . ';')) {
|
1376 |
-
$cond = ' ' . $alert['condition'] . ' than';
|
1377 |
-
$headers = array();
|
1378 |
-
$headers[] = 'From: <' . $email_from . '>';
|
1379 |
-
$headers[] = 'Content-Type: text/html';
|
1380 |
-
$content = '<div style="font-family: sans-serif;width:100%;height:50px;background-color:#FB8583;font-size:20px;color:#fff;margin-bottom:20px;text-align:center;line-height:50px">10Web Analytics Alert!</div><p style="color:#808080;text-align: center;font-size: 26px;font-family: sans-serif;">' . preg_replace('!\s+!', ' ', trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $alert['metric'])))) . ' in <a style="text-decoration:none;color:rgba(124,181,216,1);font-family: sans-serif;" href="' . $alert["alert_view_name"] . '" target="_blank">' . $alert["alert_view_name"] . '</a> are <span style="color:' . $color_condition . '">' . $cond . '</span></p><p style="color:rgba(124,181,216,1);font-size: 26px;font-family: sans-serif; text-align: center;">' . $alert['value'] . '</p>';
|
1381 |
-
wp_mail($alert['emails'], 'Analytics Alert', $content, $headers);
|
1382 |
-
}
|
1383 |
-
}
|
1384 |
-
}
|
1385 |
-
}
|
1386 |
-
|
1387 |
-
public function wd_dashboard_widget(){
|
1388 |
-
$profiles = get_option('gawd_user_profiles');
|
1389 |
-
$gawd_user_data = GAWD_helper::get_user_data();
|
1390 |
-
$gawd_last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
1391 |
-
require_once('admin/pages/dashboard_widget.php');
|
1392 |
-
}
|
1393 |
-
|
1394 |
-
public function google_analytics_wd_dashboard_widget(){
|
1395 |
-
$gawd_settings = GAWD_helper::get_settings();
|
1396 |
-
$gawd_backend_roles = isset($gawd_settings['gawd_backend_roles']) ? $gawd_settings['gawd_backend_roles'] : array();
|
1397 |
-
|
1398 |
-
if(
|
1399 |
-
isset($gawd_settings['gawd_show_in_dashboard']) &&
|
1400 |
-
$gawd_settings['gawd_show_in_dashboard'] == 'on' &&
|
1401 |
-
GAWD_helper::check_permission($gawd_backend_roles)
|
1402 |
-
) {
|
1403 |
-
|
1404 |
-
wp_add_dashboard_widget('wd_dashboard_widget', '10Web Analytics', array(
|
1405 |
-
$this,
|
1406 |
-
'wd_dashboard_widget'
|
1407 |
-
));
|
1408 |
-
}
|
1409 |
-
}
|
1410 |
-
|
1411 |
-
public static function add_dashboard_menu(){
|
1412 |
-
$get_custom_reports = get_option('gawd_custom_reports');
|
1413 |
-
if(!$get_custom_reports) {
|
1414 |
-
$custom_report = array();
|
1415 |
-
} else {
|
1416 |
-
foreach($get_custom_reports as $name => $report) {
|
1417 |
-
$custom_report['custom_report_' . $name] = __($name, "gawd");
|
1418 |
-
}
|
1419 |
-
}
|
1420 |
-
$tabs = array(
|
1421 |
-
"general" => array(
|
1422 |
-
"title" => __("Audience", "gawd"),
|
1423 |
-
"childs" => array(),
|
1424 |
-
"desc" => "Report of your website audience. Provides details about new and returning users of your website, sessions, bounces, pageviews and session durations."
|
1425 |
-
),
|
1426 |
-
"realtime" => array(
|
1427 |
-
"title" => __("Real Time", "gawd"),
|
1428 |
-
"childs" => array(),
|
1429 |
-
"desc" => "Real Time statistics show the number of active users currently visiting your website pages."
|
1430 |
-
),
|
1431 |
-
/** FREE **/
|
1432 |
-
"Pro" => array(
|
1433 |
-
"title" => __("Available in premium", "gawd"),
|
1434 |
-
"childs" => array(),
|
1435 |
-
"desc" => ""
|
1436 |
-
),
|
1437 |
-
/** END FREE **/
|
1438 |
-
"demographics" => array(
|
1439 |
-
"title" => __("Demographics", "gawd"),
|
1440 |
-
"childs" => array(
|
1441 |
-
"userGender" => __("User Gender", "gawd"),
|
1442 |
-
"userAge" => __("User Age", "gawd")
|
1443 |
-
),
|
1444 |
-
"desc" => "Demographics display tracking statistics of your website users based on their age and gender. "
|
1445 |
-
|
1446 |
-
),
|
1447 |
-
"interests" => array(
|
1448 |
-
"title" => __("Interests", "gawd"),
|
1449 |
-
"childs" => array(
|
1450 |
-
"inMarket" => __("In-Market Segment", "gawd"),
|
1451 |
-
"affinityCategory" => __("Affinity Category", "gawd"),
|
1452 |
-
"otherCategory" => __("Other Category", "gawd")
|
1453 |
-
),
|
1454 |
-
"desc" => "Provides tracking information about site users depending on Affinity Categories (e.g. Music Lovers or Mobile Enthusiasts), In-Market Segments (based on online product purchase interests) and Other Categories (most specific identification, for example, tennis lovers among Sports Fans)."
|
1455 |
-
),
|
1456 |
-
"geo" => array(
|
1457 |
-
"title" => __("GEO", "gawd"),
|
1458 |
-
"childs" => array(
|
1459 |
-
"location" => __("Location", "gawd"),
|
1460 |
-
"language" => __("Language", "gawd")
|
1461 |
-
),
|
1462 |
-
"desc" => "Geo-identifier report is built from interactions of location (countries, cities) and language of your website users."
|
1463 |
-
),
|
1464 |
-
"behavior" => array(
|
1465 |
-
"title" => __("Behavior", "gawd"),
|
1466 |
-
"childs" => array(
|
1467 |
-
"behaviour" => __("New vs Returning", "gawd"),
|
1468 |
-
"engagement" => __("Engagement", "gawd")
|
1469 |
-
),
|
1470 |
-
"desc" => "Compares number of New visitors and Returning users of your website in percents. You can check the duration of sessions with Engagement report."
|
1471 |
-
),
|
1472 |
-
"technology" => array(
|
1473 |
-
"title" => __("Technology", "gawd"),
|
1474 |
-
"childs" => array(
|
1475 |
-
"os" => __("OS", "gawd"),
|
1476 |
-
"browser" => __("Browser", "gawd")
|
1477 |
-
),
|
1478 |
-
"desc" => "Identifies tracking of the site based on operating systems and browsers visitors use."
|
1479 |
-
),
|
1480 |
-
"mobile" => array(
|
1481 |
-
"title" => __("Mobile", "gawd"),
|
1482 |
-
"childs" => array(
|
1483 |
-
"device_overview" => __("Overview", "gawd"),
|
1484 |
-
"devices" => __("Devices", "gawd")
|
1485 |
-
),
|
1486 |
-
"desc" => "Shows statistics of mobile and desktop devices visitors have used while interacting with your website."
|
1487 |
-
),
|
1488 |
-
"custom" => array(
|
1489 |
-
"title" => __("Custom Dimensions", "gawd"),
|
1490 |
-
"childs" => array(),
|
1491 |
-
"desc" => "Set up Custom Dimensions based on Users, Post type, Author, Category, Publication date and Tags in Custom Dimensions page, and view their report in this tab."
|
1492 |
-
),
|
1493 |
-
"trafficSource" => array(
|
1494 |
-
"title" => __("Traffic Source", "gawd"),
|
1495 |
-
"childs" => array(),
|
1496 |
-
"desc" => "Displays overall graph of traffic sources directing to your website."
|
1497 |
-
),
|
1498 |
-
"adWords" => array(
|
1499 |
-
"title" => __("AdWords", "gawd"),
|
1500 |
-
"childs" => array(),
|
1501 |
-
"desc" => "If your website is registered on Google AdWords, you can link its Google Analytics to AdWords, and gather relevant tracking information with this report."
|
1502 |
-
),
|
1503 |
-
/* "pagePath" => array(
|
1504 |
-
"title" => __("Pages", "gawd"),
|
1505 |
-
"childs" => array(),
|
1506 |
-
"desc" => "Pages report table will provide you information about Bounces, Entrances, Pageviews, Unique Pageviews, time spent on pages, Exits and Average page loading time."
|
1507 |
-
), */
|
1508 |
-
"siteContent" => array(
|
1509 |
-
"title" => __("Site Content", "gawd"),
|
1510 |
-
"childs" => array(
|
1511 |
-
"pagePath" => __("All Pages", "gawd"),
|
1512 |
-
"landingPagePath" => __("Landing Pages", "gawd"),
|
1513 |
-
),
|
1514 |
-
"desc" => "Pages report table will provide you information about Bounces, Entrances, Pageviews, Unique Pageviews, time spent on pages, Exits and Average page loading time."
|
1515 |
-
),
|
1516 |
-
"siteSpeed" => array(
|
1517 |
-
"title" => __("Site Speed", "gawd"),
|
1518 |
-
"childs" => array(),
|
1519 |
-
"desc" => "Shows the average load time of your website users experienced during specified date range."
|
1520 |
-
),
|
1521 |
-
"events" => array(
|
1522 |
-
"title" => __("Events", "gawd"),
|
1523 |
-
"childs" => array(
|
1524 |
-
"eventsLabel" => __("Events by Label", "gawd"),
|
1525 |
-
"eventsAction" => __("Events by Action", "gawd"),
|
1526 |
-
"eventsCategory" => __("Events by Category", "gawd")
|
1527 |
-
),
|
1528 |
-
"desc" => "Displays the report based on Events you set up on Google Analytics of your website. Graphs are built based on Event Labels, Categories and Actions."
|
1529 |
-
),
|
1530 |
-
"goals" => array(
|
1531 |
-
"title" => __("Goals", "gawd"),
|
1532 |
-
"childs" => array(),
|
1533 |
-
"desc" => "Set Goals from Goal Management and review their Google Analytics reports under this tab."
|
1534 |
-
),
|
1535 |
-
"ecommerce" => array(
|
1536 |
-
"title" => __("Ecommerce", "gawd"),
|
1537 |
-
"childs" => array(
|
1538 |
-
"daysToTransaction" => __("TIme to Purchase", "gawd"),
|
1539 |
-
"transactionId" => __("Transaction ID", "gawd"),
|
1540 |
-
"sales_performance" => __("Sales Performance", "gawd"),
|
1541 |
-
"productSku" => __("Product Sku", "gawd"),
|
1542 |
-
"productCategory" => __("Product Category ", "gawd"),
|
1543 |
-
"productName" => __("Product Name", "gawd"),
|
1544 |
-
),
|
1545 |
-
"desc" => "Check sales statistics of your website identified by revenues, transactions, products and performance."
|
1546 |
-
),
|
1547 |
-
"adsense" => array(
|
1548 |
-
"title" => __("AdSense", "gawd"),
|
1549 |
-
"childs" => array(),
|
1550 |
-
"desc" => "Link your Google Analytics and AdSense accounts from Google Analytics Admin setting and keep track of AdSense tracking under this report."
|
1551 |
-
),
|
1552 |
-
"customReport" => array(
|
1553 |
-
"title" => __("Custom Report", "gawd"),
|
1554 |
-
"childs" => $custom_report,
|
1555 |
-
"desc" => "Add Custom Reports from any metric and dimension in Custom Reports page, and view relevant Google Analytics tracking information in this tab."
|
1556 |
-
),
|
1557 |
-
);
|
1558 |
-
update_option('gawd_menu_items', $tabs);
|
1559 |
-
}
|
1560 |
-
|
1561 |
-
public function remove_zoom_message(){
|
1562 |
-
check_ajax_referer('gawd_admin_page_nonce', 'security');
|
1563 |
-
$got_it = isset($_REQUEST["got_it"]) ? sanitize_text_field($_REQUEST["got_it"]) : '';
|
1564 |
-
if($got_it != '') {
|
1565 |
-
add_option('gawd_zoom_message', $got_it);
|
1566 |
-
}
|
1567 |
-
}
|
1568 |
-
|
1569 |
-
public function nossl_message(){
|
1570 |
-
$this->gawd_admin_notice(
|
1571 |
-
__('ERROR: 10Web Analytics cannot make insecure requests to Google API. Please enable PHP OpenSSL extension', 'gawd'),
|
1572 |
-
'error'
|
1573 |
-
);
|
1574 |
-
}
|
1575 |
-
|
1576 |
-
protected function premium_bar($page){
|
1577 |
-
$text = 'See advanced and custom reports, ecommerce reports and customize tracking settings.';
|
1578 |
-
|
1579 |
-
switch($page) {
|
1580 |
-
case 'gawd_analytics':
|
1581 |
-
$manual_link = 'https://help.10web.io/hc/en-us/articles/360017502592-Introducing-WordPress-Google-Analytics';
|
1582 |
-
break;
|
1583 |
-
case 'gawd_reports':
|
1584 |
-
$manual_link = 'https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports';
|
1585 |
-
break;
|
1586 |
-
case 'gawd_settings':
|
1587 |
-
$manual_link = 'https://help.10web.io/hc/en-us/articles/360018132671-Google-Analytics-Settings';
|
1588 |
-
break;
|
1589 |
-
case 'gawd_goals':
|
1590 |
-
$manual_link = 'https://help.10web.io/hc/en-us/articles/360018133231-Configuring-Google-Analytics-Goals';
|
1591 |
-
break;
|
1592 |
-
case 'gawd_custom_reports':
|
1593 |
-
$manual_link = 'https://help.10web.io/hc/en-us/articles/360018133271-Custom-Reports';
|
1594 |
-
break;
|
1595 |
-
}
|
1596 |
-
?>
|
1597 |
-
<div class="gawd-topbar-container">
|
1598 |
-
<div class="gawd-topbar gawd-topbar-content">
|
1599 |
-
<div class="gawd-topbar-content-container">
|
1600 |
-
<div class="gawd-topbar-content-title">
|
1601 |
-
Google Analytics Premium
|
1602 |
-
</div>
|
1603 |
-
<div class="gawd-topbar-content-body"><?php echo $text; ?></div>
|
1604 |
-
</div>
|
1605 |
-
<div class="gawd-topbar-content-button-container">
|
1606 |
-
<a href="https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin" target="_blank"
|
1607 |
-
class="gawd-topbar-upgrade-button">Upgrade</a>
|
1608 |
-
</div>
|
1609 |
-
</div>
|
1610 |
-
<div class="gawd-topbar gawd-topbar-links">
|
1611 |
-
<div class="gawd-topbar-links-container">
|
1612 |
-
<a href="<?php echo $manual_link; ?>"
|
1613 |
-
target="_blank">
|
1614 |
-
<div class="gawd-topbar-links-item">User Manual</div>
|
1615 |
-
</a>
|
1616 |
-
<span class="gawd-topbar-separator"></span>
|
1617 |
-
<a href="https://wordpress.org/support/plugin/wd-google-analytics" target="_blank">
|
1618 |
-
<div class="gawd-topbar-links-item">Support Forum</div>
|
1619 |
-
</a>
|
1620 |
-
</div>
|
1621 |
-
</div>
|
1622 |
-
</div>
|
1623 |
-
<?php
|
1624 |
-
}
|
1625 |
-
|
1626 |
-
|
1627 |
-
/************STATIC METHODS************/
|
1628 |
-
|
1629 |
-
public static function deactivate(){
|
1630 |
-
delete_site_transient('gawd_uninstall');
|
1631 |
-
}
|
1632 |
-
|
1633 |
-
/**
|
1634 |
-
* Activation function needed for the activation hook.
|
1635 |
-
*/
|
1636 |
-
public static function global_activate($networkwide){
|
1637 |
-
|
1638 |
-
if(function_exists('is_multisite') && is_multisite()) {
|
1639 |
-
// Check if it is a network activation - if so, run the activation function for each blog id.
|
1640 |
-
if($networkwide) {
|
1641 |
-
global $wpdb;
|
1642 |
-
// Get all blog ids.
|
1643 |
-
$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
1644 |
-
foreach($blogids as $blog_id) {
|
1645 |
-
switch_to_blog($blog_id);
|
1646 |
-
self::activate();
|
1647 |
-
restore_current_blog();
|
1648 |
-
}
|
1649 |
-
return;
|
1650 |
-
}
|
1651 |
-
}
|
1652 |
-
self::activate();
|
1653 |
-
}
|
1654 |
-
|
1655 |
-
public static function activate(){
|
1656 |
-
|
1657 |
-
delete_site_transient('gawd_uninstall');
|
1658 |
-
$gawd_credentials = get_option('gawd_credentials');
|
1659 |
-
if(empty($gawd_credentials)) {
|
1660 |
-
update_option('gawd_credentials', GAWD_helper::get_project_default_credentials());
|
1661 |
-
}
|
1662 |
-
|
1663 |
-
|
1664 |
-
$gawd_settings = get_option('gawd_settings');
|
1665 |
-
if($gawd_settings === false) {
|
1666 |
-
self::gawd_settings_defaults();
|
1667 |
-
}
|
1668 |
-
|
1669 |
-
//logout issue
|
1670 |
-
if(GAWD_VERSION == '1.1.2' || GAWD_VERSION == '5.1.2') {
|
1671 |
-
|
1672 |
-
if(get_option('gawd_user_data') == false) {
|
1673 |
-
delete_option('gawd_user_status');
|
1674 |
-
delete_option('gawd_account_status');
|
1675 |
-
}
|
1676 |
-
|
1677 |
-
}
|
1678 |
-
|
1679 |
-
self::add_dashboard_menu();
|
1680 |
-
|
1681 |
-
$old_version = get_option('gawd_version');
|
1682 |
-
$settings = get_option('gawd_settings');
|
1683 |
-
if($old_version === false){
|
1684 |
-
$old_version = 'x.1.6';
|
1685 |
-
}
|
1686 |
-
|
1687 |
-
$old_version_for_compare = substr($old_version, 2);
|
1688 |
-
$new_version_for_compare = substr(GAWD_VERSION, 2);
|
1689 |
-
|
1690 |
-
if($old_version === false || version_compare($old_version_for_compare, '1.9','<')) {
|
1691 |
-
if(!empty($settings['gawd_permissions'])) {
|
1692 |
-
$new_permissions = array();
|
1693 |
-
$permissions = $settings['gawd_permissions'];
|
1694 |
-
$roles = new WP_Roles();
|
1695 |
-
foreach($roles->roles as $key => $role) {
|
1696 |
-
foreach($permissions as $permission) {
|
1697 |
-
if(isset($role['capabilities'][$permission]) && $role['capabilities'][$permission]) {
|
1698 |
-
$new_permissions[] = $key;
|
1699 |
-
break;
|
1700 |
-
}
|
1701 |
-
}
|
1702 |
-
}
|
1703 |
-
$new_permissions = array_unique($new_permissions);
|
1704 |
-
$settings['gawd_permissions'] = $new_permissions;
|
1705 |
-
}
|
1706 |
-
|
1707 |
-
if(get_option('gawd_user_data') !== false){
|
1708 |
-
update_option('gawd_upgrade_plugin', '1');
|
1709 |
-
}
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
update_option('gawd_settings', $settings);
|
1713 |
-
update_option('gawd_version', GAWD_VERSION);
|
1714 |
-
}
|
1715 |
-
|
1716 |
-
public function upgrade_plugin(){
|
1717 |
-
?>
|
1718 |
-
|
1719 |
-
<script>
|
1720 |
-
gawd_upgrade_plugin(
|
1721 |
-
"<?php echo admin_url('admin-ajax.php'); ?>",
|
1722 |
-
"<?php echo wp_create_nonce('gawd_custom_ajax'); ?>",
|
1723 |
-
);
|
1724 |
-
</script>
|
1725 |
-
|
1726 |
-
<?php }
|
1727 |
-
|
1728 |
-
/**
|
1729 |
-
* Returns the Singleton instance of this class.
|
1730 |
-
*
|
1731 |
-
* @return GAWD The Singleton instance.
|
1732 |
-
*/
|
1733 |
-
public static function get_instance(){
|
1734 |
-
if(null === self::$instance) {
|
1735 |
-
self::$instance = new self();
|
1736 |
-
}
|
1737 |
-
|
1738 |
-
return self::$instance;
|
1739 |
-
}
|
1740 |
-
|
1741 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class GAWD {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @var GAWD The reference to Singleton instance of this class
|
7 |
+
*/
|
8 |
+
private static $instance;
|
9 |
+
private $gawd_pages = array();
|
10 |
+
private $view_permission = false;
|
11 |
+
private $settings_permission = false;
|
12 |
+
public $redirect_uri = "urn:ietf:wg:oauth:2.0:oob";
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Protected constructor to prevent creating a new instance of the
|
16 |
+
* Singleton via the `new` operator from outside of this class.
|
17 |
+
*/
|
18 |
+
protected function __construct(){
|
19 |
+
if(get_site_transient('gawd_uninstall') === '1'){
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
if(!extension_loaded('openssl')) {
|
24 |
+
add_action('admin_notices', array($this, 'nossl_message'), 1);
|
25 |
+
return;
|
26 |
+
}
|
27 |
+
|
28 |
+
if(!is_dir(GAWD_UPLOAD_DIR)) {
|
29 |
+
mkdir(GAWD_UPLOAD_DIR, 0777);
|
30 |
+
}
|
31 |
+
|
32 |
+
if(get_option('gawd_version') !== GAWD_VERSION){
|
33 |
+
self::activate();
|
34 |
+
}
|
35 |
+
|
36 |
+
add_action('init', array($this, 'register_hooks'), 1);
|
37 |
+
|
38 |
+
add_action('wp_head', array($this, 'gawd_tracking_code'), 99);
|
39 |
+
$gawd_settings = GAWD_helper::get_settings();
|
40 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
41 |
+
$gawd_user_status = GAWD_helper::get_user_status();
|
42 |
+
|
43 |
+
if(
|
44 |
+
isset($gawd_user_data['refresh_token']) &&
|
45 |
+
($gawd_user_data['refresh_token'] != '') &&
|
46 |
+
(isset($gawd_settings['gawd_tracking_enable']) &&
|
47 |
+
$gawd_settings['gawd_tracking_enable'] == 'on')
|
48 |
+
) {
|
49 |
+
require_once(GAWD_DIR . '/widgets.php');
|
50 |
+
}
|
51 |
+
|
52 |
+
$gawd_post_page_roles = isset($gawd_settings['gawd_post_page_roles']) ? $gawd_settings['gawd_post_page_roles'] : array();
|
53 |
+
|
54 |
+
if(
|
55 |
+
GAWD_helper::gawd_is_ready() &&
|
56 |
+
(isset($gawd_settings['gawd_tracking_enable']) && $gawd_settings['gawd_tracking_enable'] == 'on') &&
|
57 |
+
(isset($gawd_settings['post_page_chart']) && $gawd_settings['post_page_chart'] != '') &&
|
58 |
+
GAWD_helper::check_permission($gawd_post_page_roles) &&
|
59 |
+
(isset($gawd_user_data['refresh_token']) && ($gawd_user_data['refresh_token'] != ''))
|
60 |
+
&& !empty($gawd_user_data['property_id'])) {
|
61 |
+
|
62 |
+
add_filter('manage_posts_columns', array($this, 'gawd_add_columns'));
|
63 |
+
// Populate custom column in Posts List
|
64 |
+
add_action('manage_posts_custom_column', array($this, 'gawd_add_icons'), 10, 2);
|
65 |
+
// Add custom column in Pages List
|
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 |
+
}
|
70 |
+
|
71 |
+
$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? $gawd_settings['gawd_frontend_roles'] : array();
|
72 |
+
|
73 |
+
if(
|
74 |
+
GAWD_helper::gawd_is_ready() &&
|
75 |
+
(isset($gawd_settings['gawd_tracking_enable']) && $gawd_settings['gawd_tracking_enable'] == 'on') &&
|
76 |
+
GAWD_helper::check_permission($gawd_frontend_roles) &&
|
77 |
+
(isset($gawd_user_data['refresh_token']) && ($gawd_user_data['refresh_token'] != '')) &&
|
78 |
+
GAWD_helper::get_user_status() &&
|
79 |
+
!empty($gawd_user_data['property_id'])
|
80 |
+
) {
|
81 |
+
add_action('wp_enqueue_scripts', array($this, 'gawd_front_scripts'));
|
82 |
+
add_action('admin_bar_menu', array($this, 'report_adminbar'), 999);
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
public function admin_notices(){
|
88 |
+
$notices = GAWD_helper::get_notices();
|
89 |
+
|
90 |
+
foreach($notices as $notice) {
|
91 |
+
$this->gawd_admin_notice($notice['msg'], $notice['status'], $notice['class']);
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
$user_data = GAWD_helper::get_user_data();
|
96 |
+
$web_property_id = (isset($user_data['property_id'])) ? $user_data['property_id'] : "";
|
97 |
+
$screen = get_current_screen();
|
98 |
+
$accounts = GAWD_helper::get_management_accounts();
|
99 |
+
$gawd_props = GAWD_helper::get_current_site_properties();
|
100 |
+
|
101 |
+
if(count($gawd_props) === 0 && empty($web_property_id) && strpos($screen->base, 'gawd') !== false && !empty($accounts)) {
|
102 |
+
$msg = "10Web Analytics: You haven't created a web-property with current site URL, or it has been deleted. Please <a href='" . admin_url() . "admin.php?page=gawd_settings#gawd_tracking_tab'>create </a> one.";
|
103 |
+
$this->gawd_admin_notice($msg, "error", 'gawd_tracking_notice_link');
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
function get_current_user_role(){
|
108 |
+
global $wp_roles;
|
109 |
+
if(is_user_logged_in()) {
|
110 |
+
$current_user = wp_get_current_user();
|
111 |
+
$roles = $current_user->roles;
|
112 |
+
$role = array_shift($roles);
|
113 |
+
|
114 |
+
return $role;
|
115 |
+
} else {
|
116 |
+
return "";
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
function report_adminbar($wp_admin_bar){
|
121 |
+
/* @formatter:off */
|
122 |
+
$gawd_settings = get_option('gawd_settings');
|
123 |
+
$gawd_frontend_roles = isset($gawd_settings['gawd_frontend_roles']) ? $gawd_settings['gawd_frontend_roles'] : array();
|
124 |
+
$roles = $this->get_current_user_role();
|
125 |
+
$id = intval(get_the_ID());
|
126 |
+
if(((in_array($roles, $gawd_frontend_roles) || current_user_can('manage_options')) && !is_admin()) && $gawd_settings['post_page_chart'] != '' && $id > 0) {
|
127 |
+
|
128 |
+
$uri_parts = get_post($id);
|
129 |
+
$uri = '/' . $uri_parts->post_name;
|
130 |
+
|
131 |
+
$filter = rawurlencode(rawurldecode($uri));
|
132 |
+
|
133 |
+
$args = array(
|
134 |
+
'id' => 'gawd',
|
135 |
+
'title' => '<span data-url="' . $filter . '" class="ab-icon"></span><span class="">' . __("Analytics by 10Web", 'gawd') . '</span>',
|
136 |
+
//'href' => '#1',
|
137 |
+
);
|
138 |
+
/* @formatter:on */
|
139 |
+
$wp_admin_bar->add_node($args);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
function register_hooks(){
|
144 |
+
|
145 |
+
if(is_admin() && get_option('gawd_upgrade_plugin') === '1'){
|
146 |
+
add_action('admin_footer', array($this,'upgrade_plugin'));
|
147 |
+
}
|
148 |
+
|
149 |
+
$this->gawd_last_viewed_profile();
|
150 |
+
|
151 |
+
$gawd_settings = GAWD_helper::get_settings();
|
152 |
+
|
153 |
+
$gawd_permissions = isset($gawd_settings['gawd_permissions']) ? $gawd_settings['gawd_permissions'] : array();
|
154 |
+
$gawd_overview_permissions = isset($gawd_settings['gawd_backend_roles']) ? $gawd_settings['gawd_backend_roles'] : array();
|
155 |
+
$this->view_permission = GAWD_helper::check_permission($gawd_overview_permissions);
|
156 |
+
$this->settings_permission = GAWD_helper::check_permission($gawd_permissions);
|
157 |
+
|
158 |
+
|
159 |
+
|
160 |
+
|
161 |
+
if($this->view_permission || $this->settings_permission) {
|
162 |
+
add_action('admin_menu', array($this, 'gawd_add_menu'), 9);
|
163 |
+
add_action('admin_menu', array($this, 'remove_first_menu'), 10);
|
164 |
+
}
|
165 |
+
|
166 |
+
add_action('admin_enqueue_scripts', array($this, 'gawd_enqueue_scripts'));
|
167 |
+
|
168 |
+
|
169 |
+
//todo add_action('wp_ajax_create_pdf_file', array($this, 'create_pdf_file'));
|
170 |
+
add_action('wp_ajax_gawd_create_csv_file', array($this, 'create_csv_file'));
|
171 |
+
add_action('wp_ajax_gawd_send_email', array($this, 'send_email'));
|
172 |
+
|
173 |
+
add_action('wp_ajax_show_data', array($this, 'show_data'));
|
174 |
+
add_action('wp_ajax_remove_zoom_message', array($this, 'remove_zoom_message'));
|
175 |
+
add_action('wp_ajax_show_data_compact', array($this, 'show_data_compact'));
|
176 |
+
if(GAWD_helper::gawd_is_ready()){
|
177 |
+
add_action('wp_dashboard_setup', array($this, 'google_analytics_wd_dashboard_widget'));
|
178 |
+
}
|
179 |
+
add_action('admin_menu', array($this, 'overview_date_meta'));
|
180 |
+
//todo add_action('admin_init', array($this, 'gawd_export'));
|
181 |
+
// add_action( 'gawd_pushover_daily', array( $this, 'gawd_pushover_daily' ) );
|
182 |
+
// add_action( 'gawd_pushover_gawd_weekly', array( $this, 'gawd_pushover_weekly' ) );
|
183 |
+
// add_action( 'gawd_pushover_gawd_monthly', array( $this, 'gawd_pushover_monthly' ) );
|
184 |
+
// add_action('gawd_alert_daily', array($this, 'gawd_alert_daily'));
|
185 |
+
// add_action('gawd_alert_gawd_monthly', array($this, 'gawd_alert_monthly'));
|
186 |
+
// add_action('gawd_alert_gawd_weekly', array($this, 'gawd_alert_weekly'));
|
187 |
+
add_action('admin_notices', array($this, 'admin_notices'), 9999);
|
188 |
+
|
189 |
+
if(!wp_next_scheduled("gawd_email_scheduled")) {
|
190 |
+
wp_schedule_single_event( time(), 'gawd_email_scheduled' );
|
191 |
+
}
|
192 |
+
add_action('gawd_email_scheduled', array($this, 'gawd_email_scheduled'));
|
193 |
+
}
|
194 |
+
|
195 |
+
public function gawd_last_viewed_profile(){
|
196 |
+
$gawd_profile_data = array();
|
197 |
+
if(isset($_POST['gawd_id'])) {
|
198 |
+
$profiles = GAWD_helper::get_profiles();
|
199 |
+
if(is_array($profiles)) {
|
200 |
+
foreach($profiles as $profile) {
|
201 |
+
if(!empty($profile)) {
|
202 |
+
foreach($profile as $item) {
|
203 |
+
|
204 |
+
if($item["id"] === $_POST['gawd_id']) {
|
205 |
+
$gawd_profile_data['profile_id'] = isset($_POST['gawd_id']) ? sanitize_text_field($_POST['gawd_id']) : '';
|
206 |
+
$gawd_profile_data['web_property_name'] = isset($_POST['web_property_name']) ? sanitize_text_field($_POST['web_property_name']) : '';
|
207 |
+
$gawd_profile_data['web_property_id'] = isset($item["webPropertyId"]) ? $item["webPropertyId"] : '';
|
208 |
+
$gawd_profile_data['account_id'] = isset($item["accountId"]) ? $item["accountId"] : '';
|
209 |
+
update_option('gawd_last_viewed_profile', $gawd_profile_data);
|
210 |
+
break;
|
211 |
+
}
|
212 |
+
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
|
220 |
+
public function gawd_add_icons($column, $id){
|
221 |
+
if($column != 'gawd_stats') {
|
222 |
+
return;
|
223 |
+
}
|
224 |
+
$uri_parts = get_post($id);
|
225 |
+
$uri = '/' . $uri_parts->post_name;
|
226 |
+
|
227 |
+
$filter = rawurlencode(rawurldecode($uri));
|
228 |
+
$permalink = get_permalink($id, false);
|
229 |
+
echo '<a id="gawd-' . $id . '" class="gawd_page_post_stats" title="' . get_the_title($id) . '" href="#' . $filter . '" data-permalink="' . $permalink . '"><img src="' . GAWD_URL . '/assets/back_logo.png"</a>';
|
230 |
+
}
|
231 |
+
|
232 |
+
public function gawd_add_columns($columns){
|
233 |
+
return array_merge($columns, array('gawd_stats' => __('Analytics by 10Web', 'gawd')));
|
234 |
+
}
|
235 |
+
|
236 |
+
public static function gawd_roles($access_level, $tracking = false){
|
237 |
+
if(is_user_logged_in() && isset($access_level)) {
|
238 |
+
$current_user = wp_get_current_user();
|
239 |
+
$roles = (array)$current_user->roles;
|
240 |
+
if((current_user_can('manage_options')) && !$tracking) {
|
241 |
+
return true;
|
242 |
+
}
|
243 |
+
if(count(array_intersect($roles, $access_level)) > 0) {
|
244 |
+
return true;
|
245 |
+
} else {
|
246 |
+
return false;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
return false;
|
251 |
+
}
|
252 |
+
|
253 |
+
public function gawd_tracking_code(){
|
254 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
255 |
+
if(empty($gawd_user_data['property_id'])) {
|
256 |
+
return;
|
257 |
+
}
|
258 |
+
|
259 |
+
require_once(GAWD_DIR . '/admin/tracking.php');
|
260 |
+
}
|
261 |
+
|
262 |
+
public function create_pdf_file($ajax = true, $data = null, $dimension = null, $start_date = null, $end_date = null, $metric_compare_recc = null, $metric_recc = null){
|
263 |
+
$first_data = isset($_REQUEST["first_data"]) ? sanitize_text_field($_REQUEST["first_data"]) : '';
|
264 |
+
$_data_compare = isset($_REQUEST["_data_compare"]) ? sanitize_text_field($_REQUEST["_data_compare"]) : '';
|
265 |
+
if($ajax == true) {
|
266 |
+
$export_type = isset($_REQUEST["export_type"]) ? sanitize_text_field($_REQUEST["export_type"]) : '';
|
267 |
+
if($export_type != 'pdf') {
|
268 |
+
return;
|
269 |
+
}
|
270 |
+
|
271 |
+
$report_type = isset($_REQUEST["report_type"]) ? sanitize_text_field($_REQUEST["report_type"]) : '';
|
272 |
+
|
273 |
+
|
274 |
+
if($report_type !== 'alert') {
|
275 |
+
return;
|
276 |
+
}
|
277 |
+
|
278 |
+
}
|
279 |
+
|
280 |
+
include_once GAWD_DIR . '/include/gawd_pdf_file.php';
|
281 |
+
$file = new GAWD_PDF_FILE();
|
282 |
+
|
283 |
+
/*
|
284 |
+
require_once(GAWD_DIR . '/admin/gawd_google_class.php');
|
285 |
+
$this->gawd_google_client = GAWD_google_client::get_instance();
|
286 |
+
*/
|
287 |
+
$file->get_request_data($this, $ajax, $data, $dimension, $start_date, $end_date, $metric_compare_recc, $metric_recc);
|
288 |
+
|
289 |
+
$file->sort_data();
|
290 |
+
if($first_data != '') {
|
291 |
+
$file->create_file('pages');
|
292 |
+
} elseif(($_data_compare) != '') {
|
293 |
+
$file->create_file('compare');
|
294 |
+
} else {
|
295 |
+
$file->create_file(true);
|
296 |
+
}
|
297 |
+
if($ajax == true) {
|
298 |
+
die();
|
299 |
+
} else {
|
300 |
+
return $file->file_dir;
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
public function create_csv_file(){
|
305 |
+
$response = array();
|
306 |
+
if(!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'gawd_admin_page_nonce')) {
|
307 |
+
$response['error']['code'] = 'wrong_nonce';
|
308 |
+
$response['error']['msg'] = 'wrong_nonce';
|
309 |
+
}
|
310 |
+
else {
|
311 |
+
$csv_response = $this->generate_csv_file();
|
312 |
+
$response['error'] = (!empty($csv_response['error'])) ? $csv_response['error'] : '';
|
313 |
+
$response['success'] = (!empty($csv_response['success'])) ? $csv_response['success'] : '';
|
314 |
+
$response['data'] = (!empty($csv_response['data'])) ? $csv_response['data'] : '';
|
315 |
+
}
|
316 |
+
die(json_encode($response));
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
+
public function save_alert($alert_data){
|
321 |
+
|
322 |
+
include_once 'library/gawd-alert-class.php';
|
323 |
+
$alert = new GAWD_alert($alert_data);
|
324 |
+
$alert->add_email_data_to_POST();
|
325 |
+
|
326 |
+
$this->send_email(false);
|
327 |
+
}
|
328 |
+
|
329 |
+
|
330 |
+
public function send_email($die = true){
|
331 |
+
if($die !== false) {
|
332 |
+
$die = true;
|
333 |
+
}
|
334 |
+
|
335 |
+
$response = array(
|
336 |
+
'success' => false,
|
337 |
+
'error' => array('code' => '', 'msg' => ''),
|
338 |
+
'data' => array('msg' => 'Something went wrong')
|
339 |
+
);
|
340 |
+
|
341 |
+
if(!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'gawd_admin_page_nonce')) {
|
342 |
+
$response['error']['code'] = 'wrong_nonce';
|
343 |
+
$response['error']['msg'] = 'wrong_nonce';
|
344 |
+
|
345 |
+
if($die == true) {
|
346 |
+
die(json_encode($response));
|
347 |
+
} else {
|
348 |
+
return $response;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
else {
|
352 |
+
include_once 'library/gawd-email-class.php';
|
353 |
+
$email = new GAWD_email();
|
354 |
+
if($email->parse_ajax_data() === false) {
|
355 |
+
$response['error'] = $email->get_error();
|
356 |
+
if($die == true) {
|
357 |
+
die(json_encode($response));
|
358 |
+
} else {
|
359 |
+
return $response;
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
$file_response = $this->generate_csv_file();
|
364 |
+
if($file_response['success'] === false) {
|
365 |
+
|
366 |
+
$response = array(
|
367 |
+
'success'=> $file_response['success'],
|
368 |
+
'error' => $file_response['error'],
|
369 |
+
'data' => $file_response['data']
|
370 |
+
);
|
371 |
+
|
372 |
+
if($die == true) {
|
373 |
+
die(json_encode($response));
|
374 |
+
} else {
|
375 |
+
return $response;
|
376 |
+
}
|
377 |
+
}
|
378 |
+
|
379 |
+
|
380 |
+
if($email->get_period() !== 'once') {
|
381 |
+
$email->save_email_info($file_response['ajax_args'], $file_response['csv_generator']);
|
382 |
+
|
383 |
+
$response['success'] = true;
|
384 |
+
$response['data']['msg'] = 'Email successfully Scheduled </br> Go to <a href="admin.php?page=gawd_settings#gawd_emails_tab">Settings page</a> to delete scheduled e-mails.';
|
385 |
+
if($die == true) {
|
386 |
+
die(json_encode($response));
|
387 |
+
} else {
|
388 |
+
return $response;
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
$email->attach_file($file_response['csv_generator']);
|
393 |
+
if($email->send_mail() === true){
|
394 |
+
$response['success'] = true;
|
395 |
+
$response['data']['msg'] = 'Email successfully sent.';
|
396 |
+
if($die == true) {
|
397 |
+
die(json_encode($response));
|
398 |
+
} else {
|
399 |
+
return $response;
|
400 |
+
}
|
401 |
+
}else{
|
402 |
+
$response['error']['code'] = 'fail_to_sent_email';
|
403 |
+
$response['error']['code'] = 'Fail to sent email.';
|
404 |
+
|
405 |
+
if($die == true) {
|
406 |
+
die(json_encode($response));
|
407 |
+
} else {
|
408 |
+
return $response;
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
private function generate_csv_file($data = array(), $view_id = null, $ajax_response = array()){
|
415 |
+
$response = array(
|
416 |
+
'success' => false,
|
417 |
+
'error' => array('code' => 'something_went_wrong', 'msg' => 'something went wrong.'),
|
418 |
+
'data' => ''
|
419 |
+
);
|
420 |
+
|
421 |
+
if(!empty($data)) {
|
422 |
+
$gawd_request_last_args = $data['last_args'];
|
423 |
+
$compare_by = $data['compare_by'];
|
424 |
+
$gawd_compare_request_last_args = $data['compare_last_args'];
|
425 |
+
$menu_name = $data['menu_name'];
|
426 |
+
$info = $data['info'];
|
427 |
+
} else {
|
428 |
+
$gawd_request_last_args = GAWD_helper::validate_string('gawd_request_last_args', array());
|
429 |
+
$compare_by = sanitize_text_field($_POST['compare_by']);
|
430 |
+
$gawd_compare_request_last_args = (!empty($_POST['gawd_compare_request_last_args'])) ? sanitize_text_field($_POST['gawd_compare_request_last_args']) : null;
|
431 |
+
$info = GAWD_helper::validate_string("info", array());
|
432 |
+
$menu_name = sanitize_text_field($_POST['menu_name']);
|
433 |
+
}//else set defaults
|
434 |
+
|
435 |
+
if(is_array($ajax_response) && !empty($ajax_response)) {
|
436 |
+
$data = $ajax_response;
|
437 |
+
} else {
|
438 |
+
$data = GAWD_helper::ajax_request($gawd_request_last_args, $view_id);
|
439 |
+
if($data === false) {
|
440 |
+
return $response;
|
441 |
+
}
|
442 |
+
}
|
443 |
+
|
444 |
+
if($gawd_compare_request_last_args !== null) {
|
445 |
+
|
446 |
+
$compare_data = GAWD_helper::ajax_request($gawd_compare_request_last_args, $view_id);
|
447 |
+
|
448 |
+
if($compare_data === false) {
|
449 |
+
return $response;
|
450 |
+
}
|
451 |
+
|
452 |
+
} else {
|
453 |
+
$compare_data = null;
|
454 |
+
}
|
455 |
+
|
456 |
+
include_once 'library/file-generators/gawd-csv-generator-class.php';
|
457 |
+
$csv = new GAWD_csv_file_generator();
|
458 |
+
$csv->parse_data($data, $gawd_request_last_args, $compare_data, $gawd_compare_request_last_args, $compare_by);
|
459 |
+
if(!empty($menu_name)) {
|
460 |
+
$csv->set_menu_name(sanitize_text_field($menu_name));
|
461 |
+
}
|
462 |
+
|
463 |
+
$site_title = "";
|
464 |
+
if($view_id !== null) {
|
465 |
+
$site_title = GAWD_helper::get_account_name_by_profile_id($view_id);
|
466 |
+
} else {
|
467 |
+
$last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
468 |
+
if(isset($last_viewed_profile['web_property_name'])) {
|
469 |
+
$site_title = $last_viewed_profile['web_property_name'];
|
470 |
+
}
|
471 |
+
}
|
472 |
+
|
473 |
+
if(!empty($site_title)) {
|
474 |
+
$csv->set_site_title($site_title);
|
475 |
+
}
|
476 |
+
|
477 |
+
$csv->generate();
|
478 |
+
|
479 |
+
$response['success'] = true;
|
480 |
+
$response['error'] = array();
|
481 |
+
$response['data'] = array('download_url' => $csv->get_file_url());
|
482 |
+
$response['csv_generator'] = $csv;
|
483 |
+
$response['ajax_args'] = array(
|
484 |
+
'last_args' => $gawd_request_last_args,
|
485 |
+
'compare_last_args' => $gawd_compare_request_last_args,
|
486 |
+
'compare_by' => $compare_by,
|
487 |
+
'menu_name' => $menu_name,
|
488 |
+
'info' => $info
|
489 |
+
);
|
490 |
+
|
491 |
+
return $response;
|
492 |
+
}
|
493 |
+
|
494 |
+
public function gawd_email_scheduled(){
|
495 |
+
|
496 |
+
$gawd_emails_info = get_option('gawd_emails_info');
|
497 |
+
if(empty($gawd_emails_info)) {
|
498 |
+
return;
|
499 |
+
}
|
500 |
+
|
501 |
+
include_once 'library/gawd-email-class.php';
|
502 |
+
|
503 |
+
$now = time();
|
504 |
+
$new_dates = array();
|
505 |
+
|
506 |
+
foreach($gawd_emails_info as $i => $email_info) {
|
507 |
+
|
508 |
+
if($now < $email_info['next_date']) {
|
509 |
+
continue;
|
510 |
+
}
|
511 |
+
|
512 |
+
$new_dates[] = $i;
|
513 |
+
|
514 |
+
$email = new GAWD_email();
|
515 |
+
$email->set_email_info($email_info['email_info']);
|
516 |
+
|
517 |
+
if($email->check_condition($email_info) === false) {
|
518 |
+
continue;
|
519 |
+
}
|
520 |
+
|
521 |
+
$email->add_content();
|
522 |
+
|
523 |
+
$file_response = $this->generate_csv_file($email_info['ajax_args'], $email_info['email_info']['view_id'], $email->get_ajax_response());
|
524 |
+
|
525 |
+
if($file_response['success'] === false) {
|
526 |
+
continue;
|
527 |
+
}
|
528 |
+
|
529 |
+
$email->attach_file($file_response['csv_generator']);
|
530 |
+
$email->send_mail();
|
531 |
+
}
|
532 |
+
|
533 |
+
if(!empty($new_dates)) {
|
534 |
+
|
535 |
+
foreach($new_dates as $i => $index) {
|
536 |
+
$info = GAWD_email::calc_next_date($gawd_emails_info[$index]);
|
537 |
+
$info = GAWD_email::calc_date_range($info);
|
538 |
+
$gawd_emails_info[$index] = $info;
|
539 |
+
}
|
540 |
+
|
541 |
+
update_option('gawd_emails_info', $gawd_emails_info);
|
542 |
+
|
543 |
+
$this->gawd_email_scheduled();
|
544 |
+
return;
|
545 |
+
} else {
|
546 |
+
GAWD_email::set_new_scheduled();
|
547 |
+
}
|
548 |
+
|
549 |
+
}
|
550 |
+
|
551 |
+
public static function get_domain($domain){
|
552 |
+
$root = explode('/', $domain);
|
553 |
+
$ret_domain = str_ireplace('www', '', isset($root[2]) ? $root[2] : $domain);
|
554 |
+
|
555 |
+
return $ret_domain;
|
556 |
+
}
|
557 |
+
|
558 |
+
public static function error_message($type, $message){
|
559 |
+
echo '<div style="width:99%"><div class="' . $type . '"><p><strong>' . $message . '</strong></p></div></div>';
|
560 |
+
}
|
561 |
+
|
562 |
+
public function gawd_export(){
|
563 |
+
if(!isset($_REQUEST['action']) || (isset($_REQUEST['action']) && $_REQUEST['action'] !== 'gawd_export')) {
|
564 |
+
return;
|
565 |
+
}
|
566 |
+
|
567 |
+
$export_type = isset($_REQUEST["export_type"]) ? sanitize_text_field($_REQUEST["export_type"]) : '';
|
568 |
+
if($export_type != 'pdf' && $export_type != 'csv') {
|
569 |
+
return;
|
570 |
+
}
|
571 |
+
|
572 |
+
$report_type = isset($_REQUEST["report_type"]) ? sanitize_text_field($_REQUEST["report_type"]) : '';
|
573 |
+
|
574 |
+
require_once(GAWD_DIR . '/admin/gawd_google_class.php');
|
575 |
+
$this->gawd_google_client = GAWD_google_client::get_instance();
|
576 |
+
|
577 |
+
if($export_type == 'pdf') {
|
578 |
+
include_once GAWD_DIR . '/include/gawd_pdf_file.php';
|
579 |
+
$file = new GAWD_PDF_FILE();
|
580 |
+
} else {
|
581 |
+
include_once GAWD_DIR . '/include/gawd_csv_file.php';
|
582 |
+
$file = new GAWD_CSV_FILE();
|
583 |
+
}
|
584 |
+
|
585 |
+
if($report_type == 'alert') {
|
586 |
+
if($export_type == 'pdf') {
|
587 |
+
$file->export_file();
|
588 |
+
} else {
|
589 |
+
$file->export_file();
|
590 |
+
}
|
591 |
+
} else {
|
592 |
+
$metric = isset($_REQUEST["gawd_metric"]) ? sanitize_text_field($_REQUEST["gawd_metric"]) : '';
|
593 |
+
$_data_compare = isset($_REQUEST["_data_compare"]) ? sanitize_text_field($_REQUEST["_data_compare"]) : '';
|
594 |
+
$first_data = isset($_REQUEST["first_data"]) ? sanitize_text_field($_REQUEST["first_data"]) : '';
|
595 |
+
$view_id = isset($_REQUEST["view_id"]) ? sanitize_text_field($_REQUEST["view_id"]) : '';
|
596 |
+
$metric_compare = isset($_REQUEST["gawd_metric_compare"]) ? sanitize_text_field($_REQUEST["gawd_metric_compare"]) : '';
|
597 |
+
$dimension = isset($_REQUEST["gawd_dimension"]) ? sanitize_text_field($_REQUEST["gawd_dimension"]) : '';
|
598 |
+
$tab_name = isset($_REQUEST["tab_name"]) ? sanitize_text_field($_REQUEST["tab_name"]) : '';
|
599 |
+
$img = isset($_REQUEST["img"]) ? sanitize_text_field($_REQUEST["img"]) : '';
|
600 |
+
$gawd_email_subject = isset($_REQUEST["gawd_email_subject"]) ? sanitize_text_field($_REQUEST["gawd_email_subject"]) : '';
|
601 |
+
$gawd_email_body = isset($_REQUEST["gawd_email_body"]) && $_REQUEST["gawd_email_body"] != '' ? sanitize_text_field($_REQUEST["gawd_email_body"]) : ' ';
|
602 |
+
$email_from = isset($_REQUEST["gawd_email_from"]) ? sanitize_email($_REQUEST["gawd_email_from"]) : '';
|
603 |
+
$email_to = isset($_REQUEST["gawd_email_to"]) ? sanitize_email($_REQUEST["gawd_email_to"]) : '';
|
604 |
+
$email_period = isset($_REQUEST["gawd_email_period"]) ? sanitize_text_field($_REQUEST["gawd_email_period"]) : '';
|
605 |
+
$week_day = isset($_REQUEST["gawd_email_week_day"]) ? sanitize_text_field($_REQUEST["gawd_email_week_day"]) : '';
|
606 |
+
$month_day = isset($_REQUEST["gawd_email_month_day"]) ? sanitize_text_field($_REQUEST["gawd_email_month_day"]) : '';
|
607 |
+
$email_time = isset($_REQUEST["email_time"]) ? sanitize_text_field($_REQUEST["email_time"]) : '';
|
608 |
+
$emails = array();
|
609 |
+
$invalid_email = false;
|
610 |
+
$email_to = explode(',', $email_to);
|
611 |
+
foreach($email_to as $email) {
|
612 |
+
if(is_email($email) == false) {
|
613 |
+
$emails = $email;
|
614 |
+
}
|
615 |
+
}
|
616 |
+
if(count($emails) > 0) {
|
617 |
+
$invalid_email = true;
|
618 |
+
}
|
619 |
+
if(($invalid_email != true) && is_email($email_from) && $gawd_email_subject != '') {
|
620 |
+
if($email_period == "once") {
|
621 |
+
$file->get_request_data($this);
|
622 |
+
$file->sort_data();
|
623 |
+
if($export_type == 'csv') {
|
624 |
+
if($first_data != '') {
|
625 |
+
$file->create_file(false);
|
626 |
+
} else {
|
627 |
+
$file->create_file();
|
628 |
+
}
|
629 |
+
} else {
|
630 |
+
if($first_data != '') {
|
631 |
+
$file->create_file('pages');
|
632 |
+
} elseif(($_data_compare) != '') {
|
633 |
+
$file->create_file('compare');
|
634 |
+
} else {
|
635 |
+
$file->create_file(false);
|
636 |
+
}
|
637 |
+
}
|
638 |
+
$attachment = $file->file_dir;
|
639 |
+
|
640 |
+
if($report_type == 'email') {
|
641 |
+
$headers = 'From: <' . $email_from . '>';
|
642 |
+
wp_mail($email_to, $gawd_email_subject, $gawd_email_body, $headers, $attachment);
|
643 |
+
}
|
644 |
+
echo json_encode(array('status' => 'success', 'msg' => 'Email successfuly sent'));
|
645 |
+
} else {
|
646 |
+
if($email_period == 'gawd_weekly') {
|
647 |
+
$period_day = $week_day;
|
648 |
+
$timestamp = strtotime('this ' . $period_day . ' ' . $email_time);
|
649 |
+
} elseif($email_period == 'gawd_monthly') {
|
650 |
+
$period_day = $month_day;
|
651 |
+
$timestamp = strtotime(date('Y-m-' . $period_day . ' ' . $email_time));
|
652 |
+
} else {
|
653 |
+
$period_day = '';
|
654 |
+
$timestamp = strtotime(date('Y-m-d ' . $email_time));
|
655 |
+
}
|
656 |
+
$saved_email = get_option('gawd_email');
|
657 |
+
if($saved_email) {
|
658 |
+
$gawd_email_options = array(
|
659 |
+
'name' => $gawd_email_subject,
|
660 |
+
'period' => $email_period,
|
661 |
+
'metric' => $metric,
|
662 |
+
'metric_compare' => $metric_compare,
|
663 |
+
'dimension' => $dimension,
|
664 |
+
'creation_date' => date('Y-m-d') . ' ' . $email_time,
|
665 |
+
'emails' => $email_to,
|
666 |
+
'email_from' => $email_from,
|
667 |
+
'email_subject' => $gawd_email_subject,
|
668 |
+
'email_body' => $gawd_email_body,
|
669 |
+
'period_day' => $period_day,
|
670 |
+
'period_time' => $email_time,
|
671 |
+
'img' => $img,
|
672 |
+
'tab_name' => $tab_name,
|
673 |
+
'view_id' => $view_id,
|
674 |
+
'export_type' => $export_type
|
675 |
+
);
|
676 |
+
$saved_email[] = $gawd_email_options;
|
677 |
+
update_option('gawd_email', $saved_email);
|
678 |
+
} else {
|
679 |
+
$gawd_email_options = array(
|
680 |
+
0 => array(
|
681 |
+
'name' => $gawd_email_subject,
|
682 |
+
'period' => $email_period,
|
683 |
+
'metric' => $metric,
|
684 |
+
'metric_compare' => $metric_compare,
|
685 |
+
'dimension' => $dimension,
|
686 |
+
'creation_date' => date('Y-m-d') . ' ' . $email_time,
|
687 |
+
'emails' => $email_to,
|
688 |
+
'email_from' => $email_from,
|
689 |
+
'email_subject' => $gawd_email_subject,
|
690 |
+
'email_body' => $gawd_email_body,
|
691 |
+
'period_day' => $period_day,
|
692 |
+
'period_time' => $email_time,
|
693 |
+
'img' => $img,
|
694 |
+
'tab_name' => $tab_name,
|
695 |
+
'view_id' => $view_id,
|
696 |
+
'export_type' => $export_type
|
697 |
+
)
|
698 |
+
);
|
699 |
+
update_option('gawd_email', $gawd_email_options);
|
700 |
+
}
|
701 |
+
$saved_email = get_option('gawd_email');
|
702 |
+
if($saved_email) {
|
703 |
+
foreach($saved_email as $email) {
|
704 |
+
if(!wp_next_scheduled('gawd_email_' . $email['period'])) {
|
705 |
+
wp_schedule_event($timestamp, $email['period'], 'gawd_email_' . $email['period']);
|
706 |
+
}
|
707 |
+
}
|
708 |
+
}
|
709 |
+
$success_message = 'Email successfuly Scheduled </br> Go to <a href="' . admin_url() . 'admin.php?page=gawd_settings#gawd_emails_tab">Settings page</a> to delete scheduled e-mails.';
|
710 |
+
echo json_encode(array('status' => 'success', 'msg' => $success_message));
|
711 |
+
}
|
712 |
+
|
713 |
+
die;
|
714 |
+
} else {
|
715 |
+
if($invalid_email == true) {
|
716 |
+
echo json_encode('Invalid email');
|
717 |
+
die;
|
718 |
+
} else if($gawd_email_subject == '') {
|
719 |
+
echo json_encode("Can't send email with empty subject");
|
720 |
+
die;
|
721 |
+
}
|
722 |
+
}
|
723 |
+
}
|
724 |
+
}
|
725 |
+
|
726 |
+
public function overview_date_meta($screen = null, $context = 'advanced'){
|
727 |
+
//righ side wide meta..
|
728 |
+
$orintation = wp_is_mobile() ? 'side' : 'normal';
|
729 |
+
add_meta_box('gawd-real-time', __('Real Time', 'gawd'), array(
|
730 |
+
$this,
|
731 |
+
'gawd_real_time'
|
732 |
+
), 'gawd_analytics', 'side', 'high');
|
733 |
+
add_meta_box('gawd-date-meta', __('Audience', 'gawd'), array(
|
734 |
+
$this,
|
735 |
+
'gawd_date_box'
|
736 |
+
), 'gawd_analytics', $orintation, null);
|
737 |
+
add_meta_box('gawd-country-box', __('Location', 'gawd'), array(
|
738 |
+
$this,
|
739 |
+
'gawd_country_box'
|
740 |
+
), 'gawd_analytics', $orintation, null);
|
741 |
+
//left side thin meta.
|
742 |
+
add_meta_box('gawd-visitors-meta', __('Visitors', 'gawd'), array(
|
743 |
+
$this,
|
744 |
+
'gawd_visitors'
|
745 |
+
), 'gawd_analytics', 'side', null);
|
746 |
+
add_meta_box('gawd-browser-meta', __('Browsers', 'gawd'), array(
|
747 |
+
$this,
|
748 |
+
'gawd_browser'
|
749 |
+
), 'gawd_analytics', 'side', null);
|
750 |
+
}
|
751 |
+
|
752 |
+
public function gawd_date_box(){
|
753 |
+
require_once('admin/pages/date.php');
|
754 |
+
}
|
755 |
+
|
756 |
+
public function gawd_country_box(){
|
757 |
+
require_once('admin/pages/location.php');
|
758 |
+
}
|
759 |
+
|
760 |
+
public function gawd_real_time(){
|
761 |
+
require_once('admin/pages/real_time.php');
|
762 |
+
}
|
763 |
+
|
764 |
+
public function gawd_visitors(){
|
765 |
+
require_once('admin/pages/visitors.php');
|
766 |
+
}
|
767 |
+
|
768 |
+
public function gawd_browser(){
|
769 |
+
require_once('admin/pages/browser.php');
|
770 |
+
}
|
771 |
+
|
772 |
+
|
773 |
+
/**
|
774 |
+
* Enqueues the required styles and scripts, localizes some js variables.
|
775 |
+
*/
|
776 |
+
public function gawd_front_scripts(){
|
777 |
+
wp_enqueue_style('admin_css', GAWD_URL . '/inc/css/gawd_admin.css', false, GAWD_VERSION);
|
778 |
+
/*wp_enqueue_script( 'date-js', GAWD_URL . '/inc/js/date.js', array( 'jquery' ), GAWD_VERSION );*/
|
779 |
+
wp_enqueue_script('gawd_front_js', GAWD_URL . '/inc/js/gawd_front.js', array('jquery'), GAWD_VERSION);
|
780 |
+
|
781 |
+
wp_enqueue_script('gawd_charts', GAWD_URL . '/inc/js/gawd_charts.js', array('gawd_plotly_basic'), GAWD_VERSION);
|
782 |
+
wp_enqueue_script('gawd_plotly_basic', GAWD_URL . '/inc/js/plotly-basic.min.js', array('jquery'), GAWD_VERSION);
|
783 |
+
|
784 |
+
wp_localize_script('gawd_front_js', 'gawd_front', array(
|
785 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
786 |
+
'ajaxnonce' => wp_create_nonce('gawd_admin_page_nonce'),
|
787 |
+
'gawd_plugin_url' => GAWD_URL,
|
788 |
+
'date_30' => date('Y-m-d', strtotime('-31 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
789 |
+
'date_7' => date('Y-m-d', strtotime('-8 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
790 |
+
'date_last_week' => date('Y-m-d', strtotime('last week -1day')) . '/-/' . date('Y-m-d', strtotime('last week +5day')),
|
791 |
+
'date_last_month' => date('Y-m-01', strtotime('last month')) . '/-/' . date('Y-m-t', strtotime('last month')),
|
792 |
+
'date_this_month' => date('Y-m-01') . '/-/' . date('Y-m-d'),
|
793 |
+
'date_today' => date('Y-m-d') . '/-/' . date('Y-m-d'),
|
794 |
+
'date_yesterday' => date('Y-m-d', strtotime('-1 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
795 |
+
'wp_admin_url' => admin_url(),
|
796 |
+
'gawd_custom_ajax_nonce' => wp_create_nonce('gawd_custom_ajax'),
|
797 |
+
'gawd_custom_ajax_nonce_data' => array(
|
798 |
+
'action' => 'gawd_ajax_front',
|
799 |
+
'nonce' => wp_create_nonce('gawd_ajax_front'),
|
800 |
+
),
|
801 |
+
'exportUrl' => add_query_arg(array('action' => 'gawd_export'), admin_url('admin-ajax.php'))
|
802 |
+
));
|
803 |
+
}
|
804 |
+
|
805 |
+
public function gawd_enqueue_scripts(){
|
806 |
+
$options = get_option('gawd_settings');
|
807 |
+
$default_date = (isset($options['default_date']) && $options['default_date'] != '') ? $options['default_date'] : 'last_30days';
|
808 |
+
$default_date_format = (isset($options['default_date_format']) && $options['default_date_format'] != '') ? $options['default_date_format'] : 'ymd_with_week';
|
809 |
+
$enable_hover_tooltip = (isset($options['enable_hover_tooltip']) && $options['enable_hover_tooltip'] != '') ? $options['enable_hover_tooltip'] : '';
|
810 |
+
$screen = get_current_screen();
|
811 |
+
|
812 |
+
$gawd_user_status = get_option('gawd_user_status');
|
813 |
+
|
814 |
+
$is_gawd_page = in_array($screen->id, $this->gawd_pages);
|
815 |
+
$is_dashboard = (strpos($screen->id, 'dashboard') !== false);
|
816 |
+
$is_post_page = ($screen->base === "edit" && !empty($screen->post_type));
|
817 |
+
$include_scripts_in_wp_admin_pages = (($is_post_page || strpos($screen->base, 'dashboard') !== false || strpos($screen->base, 'edit') !== false) && $gawd_user_status == '1');
|
818 |
+
|
819 |
+
if(strpos($screen->base, 'gawd') !== false || $include_scripts_in_wp_admin_pages) {
|
820 |
+
|
821 |
+
|
822 |
+
wp_enqueue_script('jquery');
|
823 |
+
wp_enqueue_script('jquery-ui-widget');
|
824 |
+
|
825 |
+
wp_enqueue_script('common');
|
826 |
+
wp_enqueue_script('wp-lists');
|
827 |
+
wp_enqueue_script('postbox');
|
828 |
+
wp_enqueue_script('jquery-ui-tooltip');
|
829 |
+
wp_enqueue_script('gawd_paging', GAWD_URL . '/inc/js/paging.js', array('jquery-ui-widget'), GAWD_VERSION);
|
830 |
+
wp_enqueue_script('jquery.cookie', GAWD_URL . '/inc/js/jquery.cookie.js', false, GAWD_VERSION);
|
831 |
+
wp_enqueue_style('timepicker_css', GAWD_URL . '/inc/css/jquery.timepicker.css', false, GAWD_VERSION);
|
832 |
+
wp_enqueue_style('admin_css', GAWD_URL . '/inc/css/gawd_admin.css', false, GAWD_VERSION);
|
833 |
+
wp_enqueue_style('gawd_dataTables_responsive_css', GAWD_URL . '/inc/css/responsive.dataTables.min.css', false, GAWD_VERSION);
|
834 |
+
wp_enqueue_style('gawd_dataTables_ui_css', GAWD_URL . '/inc/css/dataTables.jqueryui.min.css', false, GAWD_VERSION);
|
835 |
+
wp_enqueue_style('gawd_dataTables_base_ui_css', GAWD_URL . '/inc/css/dataTables-jquery-ui-base.css', false, GAWD_VERSION);
|
836 |
+
wp_enqueue_style('font-awesome', GAWD_URL . '/inc/css/font_awesome.css', false, GAWD_VERSION);
|
837 |
+
//wp_enqueue_style('jquery-ui.css', GAWD_URL . '/inc/css/jquery-ui.css', false, GAWD_VERSION);
|
838 |
+
if(strpos($screen->post_type, 'page') === false && strpos($screen->post_type, 'post') === false && strpos($screen->base, 'edit') === false) {
|
839 |
+
wp_enqueue_style('gawd_bootstrap', GAWD_URL . '/inc/css/bootstrap.css', false, GAWD_VERSION);
|
840 |
+
wp_enqueue_style('gawd_bootstrap-chosen', GAWD_URL . '/inc/css/bootstrap-chosen.css', false, GAWD_VERSION);
|
841 |
+
wp_enqueue_style('gawd_bootstrap-select', GAWD_URL . '/inc/css/bootstrap-select.css', false, GAWD_VERSION);
|
842 |
+
}
|
843 |
+
wp_enqueue_style('gawd_datepicker', GAWD_URL . '/inc/css/daterangepicker.css', false, GAWD_VERSION);
|
844 |
+
wp_enqueue_script('gawd_moment', GAWD_URL . '/inc/js/moment.min.js', false, GAWD_VERSION);
|
845 |
+
wp_enqueue_script('gawd_daterangepicker', GAWD_URL . '/inc/js/daterangepicker.js', false, GAWD_VERSION);
|
846 |
+
/*Map*/
|
847 |
+
wp_enqueue_script('gawd_map_chart', GAWD_URL . '/inc/js/gawd_map_chart.js', false, GAWD_VERSION);
|
848 |
+
/*End Map*/
|
849 |
+
wp_enqueue_script('rgbcolor.js', GAWD_URL . '/inc/js/rgbcolor.js', array('jquery'), GAWD_VERSION);
|
850 |
+
wp_enqueue_script('StackBlur.js', GAWD_URL . '/inc/js/StackBlur.js', array('jquery'), GAWD_VERSION);
|
851 |
+
wp_enqueue_script('canvg.js', GAWD_URL . '/inc/js/canvg.js', array('jquery'), GAWD_VERSION);
|
852 |
+
wp_enqueue_script('gawd_tables', GAWD_URL . '/inc/js/loader.js', array('jquery'), GAWD_VERSION);
|
853 |
+
wp_enqueue_script('date-js', GAWD_URL . '/inc/js/date.js', array('jquery'), GAWD_VERSION);
|
854 |
+
wp_enqueue_script('timepicker_js', GAWD_URL . '/inc/js/jquery.timepicker.min.js', array('jquery'), GAWD_VERSION);
|
855 |
+
wp_enqueue_script('admin_js', GAWD_URL . '/inc/js/gawd_admin.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
856 |
+
wp_enqueue_script('gawd_datatables_js', GAWD_URL . '/inc/js/jquery.dataTables.min.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
857 |
+
wp_enqueue_script('chosen.jquery.js', GAWD_URL . '/inc/js/chosen.jquery.js', array('jquery'), GAWD_VERSION);
|
858 |
+
wp_enqueue_script('gawd_datatables_responsive_js', GAWD_URL . '/inc/js/dataTables.responsive.min.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
859 |
+
wp_enqueue_script('gawd_datatables_ui_js', GAWD_URL . '/inc/js/dataTables.jqueryui.min.js', array('jquery','gawd_charts'), GAWD_VERSION);
|
860 |
+
|
861 |
+
if(strpos($screen->post_type, 'page') === false && strpos($screen->post_type, 'post') === false && strpos($screen->base, 'edit') === false) {
|
862 |
+
wp_enqueue_script('bootstrap_js', GAWD_URL . '/inc/js/bootstrap.min.js', array('jquery'), '4.3.1');
|
863 |
+
wp_enqueue_script('bootstrap-select', GAWD_URL . '/inc/js/bootstrap-select.js', array('jquery'), GAWD_VERSION);
|
864 |
+
}
|
865 |
+
wp_enqueue_script('highlight_js', GAWD_URL . '/inc/js/js_highlight.js', array('jquery'), GAWD_VERSION);
|
866 |
+
wp_enqueue_script('settings_js', GAWD_URL . '/inc/js/gawd_settings.js', array('jquery'), GAWD_VERSION);
|
867 |
+
wp_enqueue_script('overview', GAWD_URL . '/inc/js/gawd_overview.js', array('jquery'), GAWD_VERSION);
|
868 |
+
wp_localize_script('overview', 'gawd_overview', array(
|
869 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
870 |
+
'ajaxnonce' => wp_create_nonce('gawd_admin_page_nonce'),
|
871 |
+
'gawd_plugin_url' => GAWD_URL,
|
872 |
+
'default_date' => $default_date,
|
873 |
+
'enableHoverTooltip' => $enable_hover_tooltip,
|
874 |
+
'wp_admin_url' => admin_url()
|
875 |
+
));
|
876 |
+
|
877 |
+
if($is_gawd_page){
|
878 |
+
$gawd_custom_ajax_nonce_data = array(
|
879 |
+
'action' => 'gawd_analytics_pages',
|
880 |
+
'nonce' => wp_create_nonce('gawd_analytics_pages'),
|
881 |
+
);
|
882 |
+
}else if($is_post_page){
|
883 |
+
$gawd_custom_ajax_nonce_data = array(
|
884 |
+
'action' => 'gawd_post_pages',
|
885 |
+
'nonce' => wp_create_nonce('gawd_post_pages'),
|
886 |
+
);
|
887 |
+
}else if($is_dashboard){
|
888 |
+
$gawd_custom_ajax_nonce_data = array(
|
889 |
+
'action' => 'gawd_dashboard',
|
890 |
+
'nonce' => wp_create_nonce('gawd_dashboard'),
|
891 |
+
);
|
892 |
+
}else{
|
893 |
+
$gawd_custom_ajax_nonce_data = array(
|
894 |
+
'action' => '',
|
895 |
+
'nonce' => ''
|
896 |
+
);
|
897 |
+
}
|
898 |
+
|
899 |
+
|
900 |
+
wp_localize_script('admin_js', 'gawd_admin', array(
|
901 |
+
'ajaxurl' => admin_url('admin-ajax.php'),
|
902 |
+
'ajaxnonce' => wp_create_nonce('gawd_admin_page_nonce'),
|
903 |
+
'gawd_plugin_url' => GAWD_URL,
|
904 |
+
'wp_admin_url' => admin_url(),
|
905 |
+
'enableHoverTooltip' => $enable_hover_tooltip,
|
906 |
+
'default_date' => $default_date,
|
907 |
+
'default_date_format' => $default_date_format,
|
908 |
+
'date_30' => date('Y-m-d', strtotime('-31 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
909 |
+
'date_7' => date('Y-m-d', strtotime('-8 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
910 |
+
'date_last_week' => date('Y-m-d', strtotime('last week -1day')) . '/-/' . date('Y-m-d', strtotime('last week +5day')),
|
911 |
+
'date_last_month' => date('Y-m-01', strtotime('last month')) . '/-/' . date('Y-m-t', strtotime('last month')),
|
912 |
+
'date_this_month' => date('Y-m-01') . '/-/' . date('Y-m-d'),
|
913 |
+
'date_today' => date('Y-m-d') . '/-/' . date('Y-m-d'),
|
914 |
+
'date_yesterday' => date('Y-m-d', strtotime('-1 day')) . '/-/' . date('Y-m-d', strtotime('-1 day')),
|
915 |
+
'exportUrl' => add_query_arg(array('action' => 'gawd_export'), admin_url('admin-ajax.php')),
|
916 |
+
'gawd_custom_ajax_nonce' => wp_create_nonce('gawd_custom_ajax'),
|
917 |
+
'gawd_custom_ajax_nonce_data' => $gawd_custom_ajax_nonce_data,
|
918 |
+
'gawd_has_property' => (GAWD_helper::gawd_has_property() ? '1' : '0'),
|
919 |
+
));
|
920 |
+
}
|
921 |
+
if(strpos($screen->base, 'gawd_uninstall') !== false) {
|
922 |
+
wp_enqueue_style('gawd_deactivate-css', GAWD_URL . '/wd/assets/css/deactivate_popup.css', array(), GAWD_VERSION);
|
923 |
+
wp_enqueue_script('gawd-deactivate-popup', GAWD_URL . '/wd/assets/js/deactivate_popup.js', array(), GAWD_VERSION, true);
|
924 |
+
$admin_data = wp_get_current_user();
|
925 |
+
|
926 |
+
wp_localize_script('gawd-deactivate-popup', 'gawdWDDeactivateVars', array(
|
927 |
+
"prefix" => "gawd",
|
928 |
+
"deactivate_class" => 'gawd_deactivate_link',
|
929 |
+
"email" => $admin_data->data->user_email,
|
930 |
+
"plugin_wd_url" => "https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin",
|
931 |
+
));
|
932 |
+
}
|
933 |
+
wp_enqueue_script('gawd_common_js', GAWD_URL . '/inc/js/gawd_common.js', array('jquery'), GAWD_VERSION);
|
934 |
+
|
935 |
+
wp_enqueue_script('gawd_charts', GAWD_URL . '/inc/js/gawd_charts.js', array('gawd_plotly_basic'), GAWD_VERSION);
|
936 |
+
wp_enqueue_script('gawd_plotly_basic', GAWD_URL . '/inc/js/plotly-basic.min.js', array('jquery'), GAWD_VERSION);
|
937 |
+
}
|
938 |
+
|
939 |
+
/**
|
940 |
+
* Adds the menu page with its submenus.
|
941 |
+
*/
|
942 |
+
public function gawd_add_menu(){
|
943 |
+
$permission = 'read';
|
944 |
+
$parent_slug = "gawd_analytics";
|
945 |
+
|
946 |
+
/*Free*/
|
947 |
+
if(get_option("gawd_subscribe_done") !== '1') {
|
948 |
+
return;
|
949 |
+
}
|
950 |
+
|
951 |
+
if(GAWD_helper::gawd_is_ready()) {
|
952 |
+
|
953 |
+
$this->gawd_pages[] = add_menu_page(
|
954 |
+
__('Analytics', 'gawd'), //$page_title
|
955 |
+
__('Analytics', 'gawd'), //$menu_title
|
956 |
+
$permission, //$capability
|
957 |
+
$parent_slug, //$menu_slug
|
958 |
+
array($this, ($this->view_permission) ? 'gawd_display_overview_page' : 'gawd_display_settings_page'), //$function = '',
|
959 |
+
GAWD_URL . '/assets/main_icon.png', "25");
|
960 |
+
|
961 |
+
if($this->view_permission === true) {
|
962 |
+
$this->gawd_pages[] = add_submenu_page(
|
963 |
+
$parent_slug, //$parent_slug
|
964 |
+
__('Analytics Dashboard', 'gawd'), //$page_title
|
965 |
+
__('Analytics Dashboard', 'gawd'), //$menu_title
|
966 |
+
$permission, //$capability
|
967 |
+
'gawd_analytics', //$menu_slug
|
968 |
+
array($this, 'gawd_display_overview_page') //$function = '',
|
969 |
+
);
|
970 |
+
|
971 |
+
$this->gawd_pages[] = add_submenu_page(
|
972 |
+
$parent_slug, //$parent_slug
|
973 |
+
__('Reports', 'gawd'), //$page_title
|
974 |
+
__('Reports', 'gawd'), //$menu_title
|
975 |
+
$permission, //$capability
|
976 |
+
'gawd_reports', //$menu_slug
|
977 |
+
array($this, 'gawd_display_reports_page') //$function = '',
|
978 |
+
);
|
979 |
+
}
|
980 |
+
|
981 |
+
if($this->settings_permission === true) {
|
982 |
+
$this->gawd_pages[] = add_submenu_page(
|
983 |
+
$parent_slug, //$parent_slug
|
984 |
+
__('Settings', 'gawd'), //$page_title
|
985 |
+
__('Settings', 'gawd'), //$menu_title
|
986 |
+
$permission, //$capability
|
987 |
+
($this->view_permission) ? 'gawd_settings' : 'gawd_analytics', //$menu_slug
|
988 |
+
array($this, 'gawd_display_settings_page') //$function = '',
|
989 |
+
);
|
990 |
+
|
991 |
+
$this->gawd_pages[] = add_submenu_page(
|
992 |
+
$parent_slug, //$parent_slug
|
993 |
+
__('Goal Management', 'gawd'), //$page_title
|
994 |
+
__('Goal Management', 'gawd'), //$menu_title
|
995 |
+
$permission, //$capability
|
996 |
+
'gawd_goals', //$menu_slug
|
997 |
+
array($this, 'gawd_display_goals_page') //$function = '',
|
998 |
+
);
|
999 |
+
|
1000 |
+
$this->gawd_pages[] = add_submenu_page(
|
1001 |
+
$parent_slug, //$parent_slug
|
1002 |
+
__('Custom Reports', 'gawd'), //$page_title
|
1003 |
+
__('Custom Reports', 'gawd'), //$menu_title
|
1004 |
+
$permission, //$capability
|
1005 |
+
'gawd_custom_reports', //$menu_slug
|
1006 |
+
array($this, 'gawd_display_custom_reports_page') //$function = '',
|
1007 |
+
);
|
1008 |
+
|
1009 |
+
// $this->gawd_pages[] = add_submenu_page(
|
1010 |
+
// $parent_slug, //$parent_slug
|
1011 |
+
// __('Get Paid', 'gawd'), //$page_title
|
1012 |
+
// __('Get Paid', 'gawd'), //$menu_title
|
1013 |
+
// $permission, //$capability
|
1014 |
+
// 'gawd_licensing', //$menu_slug
|
1015 |
+
// array($this, 'gawd_display_licensing_page') //$function = '',
|
1016 |
+
// );
|
1017 |
+
|
1018 |
+
$this->gawd_pages[] = add_submenu_page(
|
1019 |
+
$parent_slug, //$parent_slug
|
1020 |
+
__('Uninstall', 'gawd'), //$page_title
|
1021 |
+
__('Uninstall', 'gawd'), //$menu_title
|
1022 |
+
$permission, //$capability
|
1023 |
+
'gawd_uninstall', //$menu_slug
|
1024 |
+
array($this, 'gawd_display_uninstall_page') //$function = '',
|
1025 |
+
);
|
1026 |
+
}
|
1027 |
+
} else {
|
1028 |
+
|
1029 |
+
if($this->settings_permission) {
|
1030 |
+
$this->gawd_pages[] = add_menu_page(
|
1031 |
+
__('Analytics', 'gawd'), //$page_title
|
1032 |
+
__('Analytics', 'gawd'), //$menu_title
|
1033 |
+
$permission, //$capability
|
1034 |
+
$parent_slug, //$menu_slug
|
1035 |
+
array($this, 'gawd_display_settings_page_for_auth'), //$function = '',
|
1036 |
+
GAWD_URL . '/assets/main_icon.png', "25");
|
1037 |
+
|
1038 |
+
$this->gawd_pages[] = add_submenu_page(
|
1039 |
+
$parent_slug, //$parent_slug
|
1040 |
+
__('Settings', 'gawd'), //$page_title
|
1041 |
+
__('Settings', 'gawd'), //$menu_title
|
1042 |
+
$permission, //$capability
|
1043 |
+
'gawd_settings', //$menu_slug
|
1044 |
+
array($this, 'gawd_display_settings_page_for_auth') //$function = '',
|
1045 |
+
);
|
1046 |
+
}
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
$this->gawd_pages[] = add_submenu_page(
|
1050 |
+
null, //$parent_slug
|
1051 |
+
__('Logs', 'gawd'), //$page_title
|
1052 |
+
__('Logs', 'gawd'), //$menu_title
|
1053 |
+
$permission, //$capability
|
1054 |
+
'gawd_logs', //$menu_slug
|
1055 |
+
array("GAWD_logs", "print_logs") //$function = '',
|
1056 |
+
);
|
1057 |
+
}
|
1058 |
+
|
1059 |
+
public function remove_first_menu(){
|
1060 |
+
if(!GAWD_helper::gawd_is_ready()) {
|
1061 |
+
remove_submenu_page('gawd_analytics', 'gawd_analytics');
|
1062 |
+
}
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
public function gawd_display_licensing_page(){
|
1066 |
+
wp_enqueue_style('gawd_licensing', GAWD_URL . '/inc/css/gawd_licensing.css', false, GAWD_VERSION);
|
1067 |
+
require_once(GAWD_DIR . '/admin/pages/licensing.php');
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
public function gawd_display_uninstall_page(){
|
1071 |
+
|
1072 |
+
require_once('admin/pages/uninstall.php');
|
1073 |
+
if(
|
1074 |
+
(isset($_POST['unistall_gawd']) && $_POST['unistall_gawd'] === 'yes') &&
|
1075 |
+
check_admin_referer('gawd_save_form', 'gawd_save_form_field') !== false
|
1076 |
+
) {
|
1077 |
+
|
1078 |
+
$deactivate_url = wp_nonce_url('plugins.php?action=deactivate&plugin=' . GWD_NAME . '/google-analytics-wd.php', 'deactivate-plugin_' . GWD_NAME . '/google-analytics-wd.php');
|
1079 |
+
$deactivate_url = str_replace('&', '&', $deactivate_url);
|
1080 |
+
|
1081 |
+
$gawd_uninstall = new GAWDUninstall();
|
1082 |
+
$gawd_uninstall->delete_options();
|
1083 |
+
|
1084 |
+
echo '<script>window.location.href="' . $deactivate_url . '";</script>';
|
1085 |
+
die;
|
1086 |
+
|
1087 |
+
}
|
1088 |
+
|
1089 |
+
if(get_option('gawd_credentials')) {
|
1090 |
+
|
1091 |
+
$gawd_uninstall = new GAWDUninstall();
|
1092 |
+
$gawd_uninstall->uninstall();
|
1093 |
+
|
1094 |
+
}
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
public function gawd_display_goals_page(){
|
1098 |
+
$this->premium_bar('gawd_goals');
|
1099 |
+
|
1100 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
1101 |
+
$property_id = $gawd_user_data['property_id'];
|
1102 |
+
$profiles = GAWD_helper::get_property_profiles($property_id);
|
1103 |
+
$property = GAWD_helper::get_property($property_id);
|
1104 |
+
$goals = get_option('gawd_goals_data');
|
1105 |
+
if(!is_array($goals)) {
|
1106 |
+
$goals = array();
|
1107 |
+
}
|
1108 |
+
|
1109 |
+
$next_goals_id = GAWD_helper::get_next_goal_id($goals);
|
1110 |
+
$refresh_user_info_transient = get_site_transient('gawd_refresh_user_info');
|
1111 |
+
$display_goals_page = (!empty($gawd_user_data['property_id']));
|
1112 |
+
|
1113 |
+
require_once('admin/pages/goals.php');
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
public function gawd_display_custom_reports_page(){
|
1117 |
+
$this->premium_bar('gawd_custom_reports');
|
1118 |
+
require_once('admin/pages/custom_reports.php');
|
1119 |
+
}
|
1120 |
+
|
1121 |
+
public function gawd_display_overview_page(){
|
1122 |
+
$this->premium_bar('gawd_analytics');
|
1123 |
+
$profiles = GAWD_helper::get_profiles();
|
1124 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
1125 |
+
require_once('admin/pages/overview.php');
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
public function gawd_display_reports_page(){
|
1129 |
+
$this->premium_bar('gawd_reports');
|
1130 |
+
$profiles = GAWD_helper::get_profiles();
|
1131 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
1132 |
+
require_once('admin/pages/dashboard.php');
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
/**
|
1136 |
+
* Prepares the settings to be displayed then displays the settings page.
|
1137 |
+
*/
|
1138 |
+
public static function gawd_settings_defaults(){
|
1139 |
+
$settings = get_option('gawd_settings');
|
1140 |
+
$settings['gawd_tracking_enable'] = 'on';
|
1141 |
+
$settings['gawd_custom_dimension_Logged_in'] = 'on';
|
1142 |
+
$settings['gawd_custom_dimension_Post_type'] = 'on';
|
1143 |
+
$settings['gawd_custom_dimension_Author'] = 'on';
|
1144 |
+
$settings['gawd_custom_dimension_Category'] = 'on';
|
1145 |
+
$settings['gawd_custom_dimension_Published_Month'] = 'on';
|
1146 |
+
$settings['gawd_custom_dimension_Published_Year'] = 'on';
|
1147 |
+
$settings['gawd_custom_dimension_Tags'] = 'on';
|
1148 |
+
$settings['enable_hover_tooltip'] = 'on';
|
1149 |
+
$settings['gawd_show_in_dashboard'] = 'on';
|
1150 |
+
$settings['post_page_chart'] = 'on';
|
1151 |
+
$settings['gawd_anonymize'] = 'on';
|
1152 |
+
update_option('gawd_settings', $settings);
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
public function gawd_admin_notice($message, $type, $class = ""){
|
1156 |
+
$class = 'notice notice-' . $type . ' ' . $class;
|
1157 |
+
echo '<div class="' . $class . '"><p>' . $message . '</p></div>';
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
public function gawd_display_settings_page(){
|
1161 |
+
|
1162 |
+
$this->premium_bar('gawd_settings');
|
1163 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
1164 |
+
|
1165 |
+
if(isset($_POST['gawd_settings_logout']) && $_POST['gawd_settings_logout'] == 1) {
|
1166 |
+
check_admin_referer('gawd_save_form', 'gawd_save_form_fild');
|
1167 |
+
GAWD_helper::delete_user_data();
|
1168 |
+
$redirect_url = admin_url() . 'admin.php?page=gawd_settings';
|
1169 |
+
echo '<script>window.location.href="' . $redirect_url . '";</script>';
|
1170 |
+
die;
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
$selected_account_data = $gawd_user_data;
|
1174 |
+
if(!empty($_POST['web_property_name']) && !empty($_POST['gawd_profile_id'])) {
|
1175 |
+
$selected_account_data['profile_id'] = sanitize_text_field($_POST['gawd_profile_id']);
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
if(isset($_POST['web_property_name']) && $_POST['web_property_name'] != '') {
|
1179 |
+
|
1180 |
+
//todo filters
|
1181 |
+
// $gawd_user_data['gawd_id'] = isset($_POST['gawd_id']) ? $_POST['gawd_id'] : '';
|
1182 |
+
//
|
1183 |
+
// foreach($gawd_user_data['gawd_profiles'] as $web_property_name => $web_property) {
|
1184 |
+
// foreach($web_property as $profile) {
|
1185 |
+
// if($profile['id'] == $gawd_user_data['gawd_id']) {
|
1186 |
+
// $gawd_user_data['web_property_name'] = $web_property_name;
|
1187 |
+
// $gawd_user_data['webPropertyId'] = $profile['webPropertyId'];
|
1188 |
+
// $gawd_user_data['accountId'] = $profile['accountId'];
|
1189 |
+
// }
|
1190 |
+
// }
|
1191 |
+
// }
|
1192 |
+
// $gawd_user_data['web_property_name'] = isset($_POST['web_property_name']) ? $_POST['web_property_name'] : '';
|
1193 |
+
// update_option('gawd_user_data', $gawd_user_data);
|
1194 |
+
// $redirect_url = admin_url() . 'admin.php?page=gawd_settings';
|
1195 |
+
//echo '<script>window.location.href="'.$redirect_url.'";</script>';
|
1196 |
+
}
|
1197 |
+
|
1198 |
+
|
1199 |
+
if(empty($gawd_user_data['property_id']) && count(GAWD_helper::get_current_site_properties()) > 1) {
|
1200 |
+
$this->gawd_admin_notice(
|
1201 |
+
"You have two or more web-properties configured with current site url. Please go with <a class='gawd_tracking_notice_link' href='" . admin_url('admin.php?page=gawd_settings#gawd_tracking_tab') . "'>this</a> link to select the proper one.",
|
1202 |
+
'error');
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
if(isset($_POST['gawd_email_remove'])){
|
1206 |
+
if(isset($_POST['gawd_save_form_fild']) && wp_verify_nonce($_POST['gawd_save_form_fild'], 'gawd_save_form')){
|
1207 |
+
include_once 'library/gawd-email-class.php';
|
1208 |
+
GAWD_email::delete_email(sanitize_text_field($_POST['gawd_email_remove']));
|
1209 |
+
}
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
require_once('admin/pages/settings.php');
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
public function gawd_display_settings_page_for_auth(){
|
1216 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
1217 |
+
$gawd_credentials = GAWD_helper::get_project_credentials();
|
1218 |
+
|
1219 |
+
if(GAWD_helper::get_user_status() === "1") {
|
1220 |
+
$hide_auth = "gawd_hidden";
|
1221 |
+
$hide_refresh_accounts = "";
|
1222 |
+
} else {
|
1223 |
+
$hide_auth = "";
|
1224 |
+
$hide_refresh_accounts = "gawd_hidden";
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
require_once('admin/pages/authentication.php');
|
1228 |
+
}
|
1229 |
+
|
1230 |
+
public function gawd_pushover_api($user_key, $metric, $condition, $value){
|
1231 |
+
$url = 'https://api.pushover.net/1/messages.json';
|
1232 |
+
$args = array(
|
1233 |
+
'timeout' => 45,
|
1234 |
+
'redirection' => 5,
|
1235 |
+
'blocking' => true,
|
1236 |
+
'headers' => array(),
|
1237 |
+
'body' => array(
|
1238 |
+
"token" => "aJBDhTfhR87EaTzs7wpx1MMKwboBjB",
|
1239 |
+
"user" => $user_key,
|
1240 |
+
"message" => 'The ' . $metric . ' less ' . $value
|
1241 |
+
),
|
1242 |
+
'cookies' => array()
|
1243 |
+
);
|
1244 |
+
wp_remote_post( $url, $args );
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
public function gawd_pushover_daily(){
|
1248 |
+
return;//todo
|
1249 |
+
$pushovers = get_option('gawd_pushovers');
|
1250 |
+
$data = '';
|
1251 |
+
$condition = '';
|
1252 |
+
|
1253 |
+
foreach($pushovers as $pushover) {
|
1254 |
+
if(isset($pushover['period']) && $pushover['period'] == 'daily') {
|
1255 |
+
//pls send email if ....
|
1256 |
+
$date = date('Y-m-d', strtotime('yesterday'));
|
1257 |
+
//todo get $data from wp options
|
1258 |
+
// $data = $gawd_client->get_data_alert('ga:' . $pushover['metric'], 'date', $date, $date, $pushover['pushover_view']);
|
1259 |
+
$pushover_condition = $pushover['condition'] == 'greater' ? '>' : '<';
|
1260 |
+
if(!eval($data . $pushover_condition . $pushover['value'] . ';')) {
|
1261 |
+
$cond = ' ' . $pushover['condition'] . ' than';
|
1262 |
+
$this->gawd_pushover_api($pushover['user_key'], $pushover['metric'], $pushover['condition'], $pushover['value']);
|
1263 |
+
}
|
1264 |
+
}
|
1265 |
+
}
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
public function gawd_pushover_weekly(){
|
1269 |
+
return;//todo
|
1270 |
+
$pushovers = get_option('gawd_pushovers');
|
1271 |
+
$data = '';
|
1272 |
+
$condition = '';
|
1273 |
+
foreach($pushovers as $pushover) {
|
1274 |
+
if(isset($pushover['period']) && $pushover['period'] == 'gawd_weekly') {
|
1275 |
+
//pls send email if ....
|
1276 |
+
$start_date = date('Y-m-d', strtotime('last week -1 day'));
|
1277 |
+
$end_date = date('l') != 'Sunday' ? date('Y-m-d', strtotime('last sunday -1 day')) : date('Y-m-d', strtotime('-1 day'));
|
1278 |
+
//todo get $data from wp options
|
1279 |
+
// $data = $gawd_client->get_data_alert('ga:' . $pushover['metric'], 'date', $start_date, $end_date, $pushover['pushover_view']);
|
1280 |
+
$pushover_condition = $pushover['condition'] == 'greater' ? '>' : '<';
|
1281 |
+
if(!eval($data . $pushover_condition . $pushover['value'] . ';')) {
|
1282 |
+
$cond = ' ' . $pushover['condition'] . ' than';
|
1283 |
+
$this->gawd_pushover_api($pushover['user_key'], $pushover['metric'], $pushover['condition'], $pushover['value']);
|
1284 |
+
}
|
1285 |
+
}
|
1286 |
+
}
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
public function gawd_pushover_monthly(){
|
1290 |
+
return;//todo
|
1291 |
+
$pushovers = get_option('gawd_pushovers');
|
1292 |
+
$data = '';
|
1293 |
+
$condition = '';
|
1294 |
+
foreach($pushovers as $pushover) {
|
1295 |
+
if(isset($pushover['period']) && $pushover['period'] == 'gawd_monthly') {
|
1296 |
+
//pls send email if ....
|
1297 |
+
$end_date = date('Y-m-t', strtotime('last month'));
|
1298 |
+
$start_date = date('Y-m-01', strtotime('last month'));
|
1299 |
+
//todo get $data from wp options
|
1300 |
+
// $data = $gawd_client->get_data_alert('ga:' . $pushover['metric'], 'date', $start_date, $end_date, $pushover['pushover_view']);
|
1301 |
+
$pushover_condition = $pushover['condition'] == 'greater' ? '>' : '<';
|
1302 |
+
if(!eval($data . $pushover_condition . $pushover['value'] . ';')) {
|
1303 |
+
$cond = ' ' . $pushover['condition'] . ' than';
|
1304 |
+
$this->gawd_pushover_api($pushover['user_key'], $pushover['metric'], $pushover['condition'], $pushover['value']);
|
1305 |
+
}
|
1306 |
+
}
|
1307 |
+
}
|
1308 |
+
}
|
1309 |
+
|
1310 |
+
public function gawd_alert_daily(){
|
1311 |
+
return;//todo
|
1312 |
+
$alerts = get_option('gawd_alerts');
|
1313 |
+
$data = '';
|
1314 |
+
$condition = '';
|
1315 |
+
$email_from = get_option('admin_email');
|
1316 |
+
foreach($alerts as $alert) {
|
1317 |
+
if(isset($alert['period']) && $alert['period'] == 'daily') {
|
1318 |
+
//pls send email if ....
|
1319 |
+
$date = date('Y-m-d', strtotime('yesterday'));
|
1320 |
+
//todo get $data from wp options
|
1321 |
+
// $data = $gawd_client->get_data_alert('ga:' . $alert['metric'], 'date', $date, $date, $alert['alert_view']);
|
1322 |
+
$alert_condition = $alert['condition'] == 'greater' ? '>' : '<';
|
1323 |
+
$color_condition = $alert['condition'] == 'greater' ? 'rgb(157, 207, 172)' : 'rgb(251, 133, 131)';
|
1324 |
+
if(!eval($data . $alert_condition . $alert['value'] . ';')) {
|
1325 |
+
$cond = ' ' . $alert['condition'] . ' than';
|
1326 |
+
$headers = array();
|
1327 |
+
$headers[] = 'From: <' . $email_from . '>';
|
1328 |
+
$headers[] = 'Content-Type: text/html';
|
1329 |
+
$content = '<div style="font-family: sans-serif;width:100%;height:50px;background-color:#FB8583;font-size:20px;color:#fff;margin-bottom:20px;text-align:center;line-height:50px">10Web Analytics Alert!</div><p style="color:#808080;text-align: center;font-size: 26px;font-family: sans-serif;">' . preg_replace('!\s+!', ' ', trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $alert['metric'])))) . ' in <a style="text-decoration:none;color:rgba(124,181,216,1);font-family: sans-serif;" href="' . $alert["alert_view_name"] . '" target="_blank">' . $alert["alert_view_name"] . '</a> are <span style="color:' . $color_condition . '">' . $cond . '</span></p><p style="color:rgba(124,181,216,1);font-size: 26px;font-family: sans-serif; text-align: center;">' . $alert['value'] . '</p>';
|
1330 |
+
wp_mail($alert['emails'], 'Analytics Alert', $content, $headers);
|
1331 |
+
}
|
1332 |
+
}
|
1333 |
+
}
|
1334 |
+
}
|
1335 |
+
|
1336 |
+
public function gawd_alert_weekly(){
|
1337 |
+
return;//todo
|
1338 |
+
$alerts = get_option('gawd_alerts');
|
1339 |
+
$data = '';
|
1340 |
+
$condition = '';
|
1341 |
+
$email_from = get_option('admin_email');
|
1342 |
+
foreach($alerts as $alert) {
|
1343 |
+
if(isset($alert['period']) && $alert['period'] == 'gawd_weekly') {
|
1344 |
+
//pls send email if ....
|
1345 |
+
$start_date = date('Y-m-d', strtotime('last week -1 day'));
|
1346 |
+
$end_date = date('l') != 'Sunday' ? date('Y-m-d', strtotime('last sunday -1 day')) : date('Y-m-d', strtotime('-1 day'));
|
1347 |
+
//todo get $data
|
1348 |
+
//$data = $gawd_client->get_data_alert('ga:' . $alert['metric'], 'date', $start_date, $end_date, $alert['alert_view']);
|
1349 |
+
$alert_condition = $alert['condition'] == 'greater' ? '>' : '<';
|
1350 |
+
if(!eval($data . $alert_condition . $alert['value'] . ';')) {
|
1351 |
+
$cond = ' ' . $alert['condition'] . ' than';
|
1352 |
+
$headers = array();
|
1353 |
+
$headers[] = 'From: <' . $email_from . '>';
|
1354 |
+
$headers[] = 'Content-Type: text/html';
|
1355 |
+
$content = '<div style="font-family: sans-serif;width:100%;height:50px;background-color:#FB8583;font-size:20px;color:#fff;margin-bottom:20px;text-align:center;line-height:50px">10Web Analytics Alert!</div><p style="color:#808080;text-align: center;font-size: 26px;font-family: sans-serif;">' . preg_replace('!\s+!', ' ', trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $alert['metric'])))) . ' in <a style="text-decoration:none;color:rgba(124,181,216,1);font-family: sans-serif;" href="' . $alert["alert_view_name"] . '" target="_blank">' . $alert["alert_view_name"] . '</a> are <span style="color:' . $color_condition . '">' . $cond . '</span></p><p style="color:rgba(124,181,216,1);font-size: 26px;font-family: sans-serif; text-align: center;">' . $alert['value'] . '</p>';
|
1356 |
+
wp_mail($alert['emails'], 'Analytics Alert', $content, $headers);
|
1357 |
+
}
|
1358 |
+
}
|
1359 |
+
}
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
public function gawd_alert_monthly(){
|
1363 |
+
return;
|
1364 |
+
$alerts = get_option('gawd_alerts');
|
1365 |
+
$data = '';
|
1366 |
+
$email_from = get_option('admin_email');
|
1367 |
+
foreach($alerts as $alert) {
|
1368 |
+
if(isset($alert['period']) && $alert['period'] == 'gawd_monthly') {
|
1369 |
+
//pls send email if ....
|
1370 |
+
$end_date = date('Y-m-t', strtotime('last month'));
|
1371 |
+
$start_date = date('Y-m-01', strtotime('last month'));
|
1372 |
+
//todo get $data
|
1373 |
+
//$data = $gawd_client->get_data_alert('ga:' . $alert['metric'], 'date', $start_date, $end_date, $alert['alert_view']);
|
1374 |
+
$alert_condition = $alert['condition'] == 'greater' ? '>' : '<';
|
1375 |
+
if(!eval($data . $alert_condition . $alert['value'] . ';')) {
|
1376 |
+
$cond = ' ' . $alert['condition'] . ' than';
|
1377 |
+
$headers = array();
|
1378 |
+
$headers[] = 'From: <' . $email_from . '>';
|
1379 |
+
$headers[] = 'Content-Type: text/html';
|
1380 |
+
$content = '<div style="font-family: sans-serif;width:100%;height:50px;background-color:#FB8583;font-size:20px;color:#fff;margin-bottom:20px;text-align:center;line-height:50px">10Web Analytics Alert!</div><p style="color:#808080;text-align: center;font-size: 26px;font-family: sans-serif;">' . preg_replace('!\s+!', ' ', trim(ucfirst(preg_replace('/([A-Z])/', ' $1', $alert['metric'])))) . ' in <a style="text-decoration:none;color:rgba(124,181,216,1);font-family: sans-serif;" href="' . $alert["alert_view_name"] . '" target="_blank">' . $alert["alert_view_name"] . '</a> are <span style="color:' . $color_condition . '">' . $cond . '</span></p><p style="color:rgba(124,181,216,1);font-size: 26px;font-family: sans-serif; text-align: center;">' . $alert['value'] . '</p>';
|
1381 |
+
wp_mail($alert['emails'], 'Analytics Alert', $content, $headers);
|
1382 |
+
}
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
public function wd_dashboard_widget(){
|
1388 |
+
$profiles = get_option('gawd_user_profiles');
|
1389 |
+
$gawd_user_data = GAWD_helper::get_user_data();
|
1390 |
+
$gawd_last_viewed_profile = GAWD_helper::get_last_viewed_profile();
|
1391 |
+
require_once('admin/pages/dashboard_widget.php');
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
public function google_analytics_wd_dashboard_widget(){
|
1395 |
+
$gawd_settings = GAWD_helper::get_settings();
|
1396 |
+
$gawd_backend_roles = isset($gawd_settings['gawd_backend_roles']) ? $gawd_settings['gawd_backend_roles'] : array();
|
1397 |
+
|
1398 |
+
if(
|
1399 |
+
isset($gawd_settings['gawd_show_in_dashboard']) &&
|
1400 |
+
$gawd_settings['gawd_show_in_dashboard'] == 'on' &&
|
1401 |
+
GAWD_helper::check_permission($gawd_backend_roles)
|
1402 |
+
) {
|
1403 |
+
|
1404 |
+
wp_add_dashboard_widget('wd_dashboard_widget', '10Web Analytics', array(
|
1405 |
+
$this,
|
1406 |
+
'wd_dashboard_widget'
|
1407 |
+
));
|
1408 |
+
}
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
public static function add_dashboard_menu(){
|
1412 |
+
$get_custom_reports = get_option('gawd_custom_reports');
|
1413 |
+
if(!$get_custom_reports) {
|
1414 |
+
$custom_report = array();
|
1415 |
+
} else {
|
1416 |
+
foreach($get_custom_reports as $name => $report) {
|
1417 |
+
$custom_report['custom_report_' . $name] = __($name, "gawd");
|
1418 |
+
}
|
1419 |
+
}
|
1420 |
+
$tabs = array(
|
1421 |
+
"general" => array(
|
1422 |
+
"title" => __("Audience", "gawd"),
|
1423 |
+
"childs" => array(),
|
1424 |
+
"desc" => "Report of your website audience. Provides details about new and returning users of your website, sessions, bounces, pageviews and session durations."
|
1425 |
+
),
|
1426 |
+
"realtime" => array(
|
1427 |
+
"title" => __("Real Time", "gawd"),
|
1428 |
+
"childs" => array(),
|
1429 |
+
"desc" => "Real Time statistics show the number of active users currently visiting your website pages."
|
1430 |
+
),
|
1431 |
+
/** FREE **/
|
1432 |
+
"Pro" => array(
|
1433 |
+
"title" => __("Available in premium", "gawd"),
|
1434 |
+
"childs" => array(),
|
1435 |
+
"desc" => ""
|
1436 |
+
),
|
1437 |
+
/** END FREE **/
|
1438 |
+
"demographics" => array(
|
1439 |
+
"title" => __("Demographics", "gawd"),
|
1440 |
+
"childs" => array(
|
1441 |
+
"userGender" => __("User Gender", "gawd"),
|
1442 |
+
"userAge" => __("User Age", "gawd")
|
1443 |
+
),
|
1444 |
+
"desc" => "Demographics display tracking statistics of your website users based on their age and gender. "
|
1445 |
+
|
1446 |
+
),
|
1447 |
+
"interests" => array(
|
1448 |
+
"title" => __("Interests", "gawd"),
|
1449 |
+
"childs" => array(
|
1450 |
+
"inMarket" => __("In-Market Segment", "gawd"),
|
1451 |
+
"affinityCategory" => __("Affinity Category", "gawd"),
|
1452 |
+
"otherCategory" => __("Other Category", "gawd")
|
1453 |
+
),
|
1454 |
+
"desc" => "Provides tracking information about site users depending on Affinity Categories (e.g. Music Lovers or Mobile Enthusiasts), In-Market Segments (based on online product purchase interests) and Other Categories (most specific identification, for example, tennis lovers among Sports Fans)."
|
1455 |
+
),
|
1456 |
+
"geo" => array(
|
1457 |
+
"title" => __("GEO", "gawd"),
|
1458 |
+
"childs" => array(
|
1459 |
+
"location" => __("Location", "gawd"),
|
1460 |
+
"language" => __("Language", "gawd")
|
1461 |
+
),
|
1462 |
+
"desc" => "Geo-identifier report is built from interactions of location (countries, cities) and language of your website users."
|
1463 |
+
),
|
1464 |
+
"behavior" => array(
|
1465 |
+
"title" => __("Behavior", "gawd"),
|
1466 |
+
"childs" => array(
|
1467 |
+
"behaviour" => __("New vs Returning", "gawd"),
|
1468 |
+
"engagement" => __("Engagement", "gawd")
|
1469 |
+
),
|
1470 |
+
"desc" => "Compares number of New visitors and Returning users of your website in percents. You can check the duration of sessions with Engagement report."
|
1471 |
+
),
|
1472 |
+
"technology" => array(
|
1473 |
+
"title" => __("Technology", "gawd"),
|
1474 |
+
"childs" => array(
|
1475 |
+
"os" => __("OS", "gawd"),
|
1476 |
+
"browser" => __("Browser", "gawd")
|
1477 |
+
),
|
1478 |
+
"desc" => "Identifies tracking of the site based on operating systems and browsers visitors use."
|
1479 |
+
),
|
1480 |
+
"mobile" => array(
|
1481 |
+
"title" => __("Mobile", "gawd"),
|
1482 |
+
"childs" => array(
|
1483 |
+
"device_overview" => __("Overview", "gawd"),
|
1484 |
+
"devices" => __("Devices", "gawd")
|
1485 |
+
),
|
1486 |
+
"desc" => "Shows statistics of mobile and desktop devices visitors have used while interacting with your website."
|
1487 |
+
),
|
1488 |
+
"custom" => array(
|
1489 |
+
"title" => __("Custom Dimensions", "gawd"),
|
1490 |
+
"childs" => array(),
|
1491 |
+
"desc" => "Set up Custom Dimensions based on Users, Post type, Author, Category, Publication date and Tags in Custom Dimensions page, and view their report in this tab."
|
1492 |
+
),
|
1493 |
+
"trafficSource" => array(
|
1494 |
+
"title" => __("Traffic Source", "gawd"),
|
1495 |
+
"childs" => array(),
|
1496 |
+
"desc" => "Displays overall graph of traffic sources directing to your website."
|
1497 |
+
),
|
1498 |
+
"adWords" => array(
|
1499 |
+
"title" => __("AdWords", "gawd"),
|
1500 |
+
"childs" => array(),
|
1501 |
+
"desc" => "If your website is registered on Google AdWords, you can link its Google Analytics to AdWords, and gather relevant tracking information with this report."
|
1502 |
+
),
|
1503 |
+
/* "pagePath" => array(
|
1504 |
+
"title" => __("Pages", "gawd"),
|
1505 |
+
"childs" => array(),
|
1506 |
+
"desc" => "Pages report table will provide you information about Bounces, Entrances, Pageviews, Unique Pageviews, time spent on pages, Exits and Average page loading time."
|
1507 |
+
), */
|
1508 |
+
"siteContent" => array(
|
1509 |
+
"title" => __("Site Content", "gawd"),
|
1510 |
+
"childs" => array(
|
1511 |
+
"pagePath" => __("All Pages", "gawd"),
|
1512 |
+
"landingPagePath" => __("Landing Pages", "gawd"),
|
1513 |
+
),
|
1514 |
+
"desc" => "Pages report table will provide you information about Bounces, Entrances, Pageviews, Unique Pageviews, time spent on pages, Exits and Average page loading time."
|
1515 |
+
),
|
1516 |
+
"siteSpeed" => array(
|
1517 |
+
"title" => __("Site Speed", "gawd"),
|
1518 |
+
"childs" => array(),
|
1519 |
+
"desc" => "Shows the average load time of your website users experienced during specified date range."
|
1520 |
+
),
|
1521 |
+
"events" => array(
|
1522 |
+
"title" => __("Events", "gawd"),
|
1523 |
+
"childs" => array(
|
1524 |
+
"eventsLabel" => __("Events by Label", "gawd"),
|
1525 |
+
"eventsAction" => __("Events by Action", "gawd"),
|
1526 |
+
"eventsCategory" => __("Events by Category", "gawd")
|
1527 |
+
),
|
1528 |
+
"desc" => "Displays the report based on Events you set up on Google Analytics of your website. Graphs are built based on Event Labels, Categories and Actions."
|
1529 |
+
),
|
1530 |
+
"goals" => array(
|
1531 |
+
"title" => __("Goals", "gawd"),
|
1532 |
+
"childs" => array(),
|
1533 |
+
"desc" => "Set Goals from Goal Management and review their Google Analytics reports under this tab."
|
1534 |
+
),
|
1535 |
+
"ecommerce" => array(
|
1536 |
+
"title" => __("Ecommerce", "gawd"),
|
1537 |
+
"childs" => array(
|
1538 |
+
"daysToTransaction" => __("TIme to Purchase", "gawd"),
|
1539 |
+
"transactionId" => __("Transaction ID", "gawd"),
|
1540 |
+
"sales_performance" => __("Sales Performance", "gawd"),
|
1541 |
+
"productSku" => __("Product Sku", "gawd"),
|
1542 |
+
"productCategory" => __("Product Category ", "gawd"),
|
1543 |
+
"productName" => __("Product Name", "gawd"),
|
1544 |
+
),
|
1545 |
+
"desc" => "Check sales statistics of your website identified by revenues, transactions, products and performance."
|
1546 |
+
),
|
1547 |
+
"adsense" => array(
|
1548 |
+
"title" => __("AdSense", "gawd"),
|
1549 |
+
"childs" => array(),
|
1550 |
+
"desc" => "Link your Google Analytics and AdSense accounts from Google Analytics Admin setting and keep track of AdSense tracking under this report."
|
1551 |
+
),
|
1552 |
+
"customReport" => array(
|
1553 |
+
"title" => __("Custom Report", "gawd"),
|
1554 |
+
"childs" => $custom_report,
|
1555 |
+
"desc" => "Add Custom Reports from any metric and dimension in Custom Reports page, and view relevant Google Analytics tracking information in this tab."
|
1556 |
+
),
|
1557 |
+
);
|
1558 |
+
update_option('gawd_menu_items', $tabs);
|
1559 |
+
}
|
1560 |
+
|
1561 |
+
public function remove_zoom_message(){
|
1562 |
+
check_ajax_referer('gawd_admin_page_nonce', 'security');
|
1563 |
+
$got_it = isset($_REQUEST["got_it"]) ? sanitize_text_field($_REQUEST["got_it"]) : '';
|
1564 |
+
if($got_it != '') {
|
1565 |
+
add_option('gawd_zoom_message', $got_it);
|
1566 |
+
}
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
public function nossl_message(){
|
1570 |
+
$this->gawd_admin_notice(
|
1571 |
+
__('ERROR: 10Web Analytics cannot make insecure requests to Google API. Please enable PHP OpenSSL extension', 'gawd'),
|
1572 |
+
'error'
|
1573 |
+
);
|
1574 |
+
}
|
1575 |
+
|
1576 |
+
protected function premium_bar($page){
|
1577 |
+
$text = 'See advanced and custom reports, ecommerce reports and customize tracking settings.';
|
1578 |
+
|
1579 |
+
switch($page) {
|
1580 |
+
case 'gawd_analytics':
|
1581 |
+
$manual_link = 'https://help.10web.io/hc/en-us/articles/360017502592-Introducing-WordPress-Google-Analytics';
|
1582 |
+
break;
|
1583 |
+
case 'gawd_reports':
|
1584 |
+
$manual_link = 'https://help.10web.io/hc/en-us/articles/360017506312-Google-Analytics-Reports';
|
1585 |
+
break;
|
1586 |
+
case 'gawd_settings':
|
1587 |
+
$manual_link = 'https://help.10web.io/hc/en-us/articles/360018132671-Google-Analytics-Settings';
|
1588 |
+
break;
|
1589 |
+
case 'gawd_goals':
|
1590 |
+
$manual_link = 'https://help.10web.io/hc/en-us/articles/360018133231-Configuring-Google-Analytics-Goals';
|
1591 |
+
break;
|
1592 |
+
case 'gawd_custom_reports':
|
1593 |
+
$manual_link = 'https://help.10web.io/hc/en-us/articles/360018133271-Custom-Reports';
|
1594 |
+
break;
|
1595 |
+
}
|
1596 |
+
?>
|
1597 |
+
<div class="gawd-topbar-container">
|
1598 |
+
<div class="gawd-topbar gawd-topbar-content">
|
1599 |
+
<div class="gawd-topbar-content-container">
|
1600 |
+
<div class="gawd-topbar-content-title">
|
1601 |
+
Google Analytics Premium
|
1602 |
+
</div>
|
1603 |
+
<div class="gawd-topbar-content-body"><?php echo $text; ?></div>
|
1604 |
+
</div>
|
1605 |
+
<div class="gawd-topbar-content-button-container">
|
1606 |
+
<a href="https://10web.io/plugins/wordpress-google-analytics/?utm_source=10web_analytics&utm_medium=free_plugin" target="_blank"
|
1607 |
+
class="gawd-topbar-upgrade-button">Upgrade</a>
|
1608 |
+
</div>
|
1609 |
+
</div>
|
1610 |
+
<div class="gawd-topbar gawd-topbar-links">
|
1611 |
+
<div class="gawd-topbar-links-container">
|
1612 |
+
<a href="<?php echo $manual_link; ?>"
|
1613 |
+
target="_blank">
|
1614 |
+
<div class="gawd-topbar-links-item">User Manual</div>
|
1615 |
+
</a>
|
1616 |
+
<span class="gawd-topbar-separator"></span>
|
1617 |
+
<a href="https://wordpress.org/support/plugin/wd-google-analytics" target="_blank">
|
1618 |
+
<div class="gawd-topbar-links-item">Support Forum</div>
|
1619 |
+
</a>
|
1620 |
+
</div>
|
1621 |
+
</div>
|
1622 |
+
</div>
|
1623 |
+
<?php
|
1624 |
+
}
|
1625 |
+
|
1626 |
+
|
1627 |
+
/************STATIC METHODS************/
|
1628 |
+
|
1629 |
+
public static function deactivate(){
|
1630 |
+
delete_site_transient('gawd_uninstall');
|
1631 |
+
}
|
1632 |
+
|
1633 |
+
/**
|
1634 |
+
* Activation function needed for the activation hook.
|
1635 |
+
*/
|
1636 |
+
public static function global_activate($networkwide){
|
1637 |
+
|
1638 |
+
if(function_exists('is_multisite') && is_multisite()) {
|
1639 |
+
// Check if it is a network activation - if so, run the activation function for each blog id.
|
1640 |
+
if($networkwide) {
|
1641 |
+
global $wpdb;
|
1642 |
+
// Get all blog ids.
|
1643 |
+
$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
1644 |
+
foreach($blogids as $blog_id) {
|
1645 |
+
switch_to_blog($blog_id);
|
1646 |
+
self::activate();
|
1647 |
+
restore_current_blog();
|
1648 |
+
}
|
1649 |
+
return;
|
1650 |
+
}
|
1651 |
+
}
|
1652 |
+
self::activate();
|
1653 |
+
}
|
1654 |
+
|
1655 |
+
public static function activate(){
|
1656 |
+
|
1657 |
+
delete_site_transient('gawd_uninstall');
|
1658 |
+
$gawd_credentials = get_option('gawd_credentials');
|
1659 |
+
if(empty($gawd_credentials)) {
|
1660 |
+
update_option('gawd_credentials', GAWD_helper::get_project_default_credentials());
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
|
1664 |
+
$gawd_settings = get_option('gawd_settings');
|
1665 |
+
if($gawd_settings === false) {
|
1666 |
+
self::gawd_settings_defaults();
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
//logout issue
|
1670 |
+
if(GAWD_VERSION == '1.1.2' || GAWD_VERSION == '5.1.2') {
|
1671 |
+
|
1672 |
+
if(get_option('gawd_user_data') == false) {
|
1673 |
+
delete_option('gawd_user_status');
|
1674 |
+
delete_option('gawd_account_status');
|
1675 |
+
}
|
1676 |
+
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
self::add_dashboard_menu();
|
1680 |
+
|
1681 |
+
$old_version = get_option('gawd_version');
|
1682 |
+
$settings = get_option('gawd_settings');
|
1683 |
+
if($old_version === false){
|
1684 |
+
$old_version = 'x.1.6';
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
$old_version_for_compare = substr($old_version, 2);
|
1688 |
+
$new_version_for_compare = substr(GAWD_VERSION, 2);
|
1689 |
+
|
1690 |
+
if($old_version === false || version_compare($old_version_for_compare, '1.9','<')) {
|
1691 |
+
if(!empty($settings['gawd_permissions'])) {
|
1692 |
+
$new_permissions = array();
|
1693 |
+
$permissions = $settings['gawd_permissions'];
|
1694 |
+
$roles = new WP_Roles();
|
1695 |
+
foreach($roles->roles as $key => $role) {
|
1696 |
+
foreach($permissions as $permission) {
|
1697 |
+
if(isset($role['capabilities'][$permission]) && $role['capabilities'][$permission]) {
|
1698 |
+
$new_permissions[] = $key;
|
1699 |
+
break;
|
1700 |
+
}
|
1701 |
+
}
|
1702 |
+
}
|
1703 |
+
$new_permissions = array_unique($new_permissions);
|
1704 |
+
$settings['gawd_permissions'] = $new_permissions;
|
1705 |
+
}
|
1706 |
+
|
1707 |
+
if(get_option('gawd_user_data') !== false){
|
1708 |
+
update_option('gawd_upgrade_plugin', '1');
|
1709 |
+
}
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
update_option('gawd_settings', $settings);
|
1713 |
+
update_option('gawd_version', GAWD_VERSION);
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
public function upgrade_plugin(){
|
1717 |
+
?>
|
1718 |
+
|
1719 |
+
<script>
|
1720 |
+
gawd_upgrade_plugin(
|
1721 |
+
"<?php echo admin_url('admin-ajax.php'); ?>",
|
1722 |
+
"<?php echo wp_create_nonce('gawd_custom_ajax'); ?>",
|
1723 |
+
);
|
1724 |
+
</script>
|
1725 |
+
|
1726 |
+
<?php }
|
1727 |
+
|
1728 |
+
/**
|
1729 |
+
* Returns the Singleton instance of this class.
|
1730 |
+
*
|
1731 |
+
* @return GAWD The Singleton instance.
|
1732 |
+
*/
|
1733 |
+
public static function get_instance(){
|
1734 |
+
if(null === self::$instance) {
|
1735 |
+
self::$instance = new self();
|
1736 |
+
}
|
1737 |
+
|
1738 |
+
return self::$instance;
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
}
|
google-analytics-wd.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: 10WebAnalytics
|
4 |
* Plugin URI: https://10web.io/plugins/wordpress-google-analytics/
|
5 |
-
* Version: 1.2.
|
6 |
* Author: 10Web
|
7 |
* Author URI: https://10web.io/plugins/
|
8 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -209,7 +209,7 @@ With a large number of detailed and user-friendly reports, 10Web Analytics plugi
|
|
209 |
"menu_position" => "25, 13",
|
210 |
"custom_post" => "gawd_analytics",
|
211 |
"menu_capability" => "read",
|
212 |
-
"deactivate" =>
|
213 |
"subscribe" => TRUE,
|
214 |
"display_overview" => FALSE,
|
215 |
);
|
2 |
/**
|
3 |
* Plugin Name: 10WebAnalytics
|
4 |
* Plugin URI: https://10web.io/plugins/wordpress-google-analytics/
|
5 |
+
* Version: 1.2.11
|
6 |
* Author: 10Web
|
7 |
* Author URI: https://10web.io/plugins/
|
8 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
209 |
"menu_position" => "25, 13",
|
210 |
"custom_post" => "gawd_analytics",
|
211 |
"menu_capability" => "read",
|
212 |
+
"deactivate" => FALSE,
|
213 |
"subscribe" => TRUE,
|
214 |
"display_overview" => FALSE,
|
215 |
);
|
google/.gitattributes
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
/.github export-ignore
|
2 |
-
/.gitignore export-ignore
|
3 |
-
/.travis.yml export-ignore
|
4 |
-
/CONTRIBUTING.md export-ignore
|
5 |
-
/examples export-ignore
|
6 |
-
/phpunit.xml.dist export-ignore
|
7 |
-
/style export-ignore
|
8 |
-
/tests export-ignore
|
9 |
-
/UPGRADING.md export-ignore
|
1 |
+
/.github export-ignore
|
2 |
+
/.gitignore export-ignore
|
3 |
+
/.travis.yml export-ignore
|
4 |
+
/CONTRIBUTING.md export-ignore
|
5 |
+
/examples export-ignore
|
6 |
+
/phpunit.xml.dist export-ignore
|
7 |
+
/style export-ignore
|
8 |
+
/tests export-ignore
|
9 |
+
/UPGRADING.md export-ignore
|
google/LICENSE
CHANGED
@@ -1,203 +1,203 @@
|
|
1 |
-
Apache License
|
2 |
-
Version 2.0, January 2004
|
3 |
-
http://www.apache.org/licenses/
|
4 |
-
|
5 |
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
-
|
7 |
-
1. Definitions.
|
8 |
-
|
9 |
-
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
-
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
-
|
12 |
-
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
-
the copyright owner that is granting the License.
|
14 |
-
|
15 |
-
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
-
other entities that control, are controlled by, or are under common
|
17 |
-
control with that entity. For the purposes of this definition,
|
18 |
-
"control" means (i) the power, direct or indirect, to cause the
|
19 |
-
direction or management of such entity, whether by contract or
|
20 |
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
-
|
23 |
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
-
exercising permissions granted by this License.
|
25 |
-
|
26 |
-
"Source" form shall mean the preferred form for making modifications,
|
27 |
-
including but not limited to software source code, documentation
|
28 |
-
source, and configuration files.
|
29 |
-
|
30 |
-
"Object" form shall mean any form resulting from mechanical
|
31 |
-
transformation or translation of a Source form, including but
|
32 |
-
not limited to compiled object code, generated documentation,
|
33 |
-
and conversions to other media types.
|
34 |
-
|
35 |
-
"Work" shall mean the work of authorship, whether in Source or
|
36 |
-
Object form, made available under the License, as indicated by a
|
37 |
-
copyright notice that is included in or attached to the work
|
38 |
-
(an example is provided in the Appendix below).
|
39 |
-
|
40 |
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
-
form, that is based on (or derived from) the Work and for which the
|
42 |
-
editorial revisions, annotations, elaborations, or other modifications
|
43 |
-
represent, as a whole, an original work of authorship. For the purposes
|
44 |
-
of this License, Derivative Works shall not include works that remain
|
45 |
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
-
the Work and Derivative Works thereof.
|
47 |
-
|
48 |
-
"Contribution" shall mean any work of authorship, including
|
49 |
-
the original version of the Work and any modifications or additions
|
50 |
-
to that Work or Derivative Works thereof, that is intentionally
|
51 |
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
-
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
-
means any form of electronic, verbal, or written communication sent
|
55 |
-
to the Licensor or its representatives, including but not limited to
|
56 |
-
communication on electronic mailing lists, source code control systems,
|
57 |
-
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
-
Licensor for the purpose of discussing and improving the Work, but
|
59 |
-
excluding communication that is conspicuously marked or otherwise
|
60 |
-
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
-
|
62 |
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
-
on behalf of whom a Contribution has been received by Licensor and
|
64 |
-
subsequently incorporated within the Work.
|
65 |
-
|
66 |
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
-
this License, each Contributor hereby grants to You a perpetual,
|
68 |
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
-
copyright license to reproduce, prepare Derivative Works of,
|
70 |
-
publicly display, publicly perform, sublicense, and distribute the
|
71 |
-
Work and such Derivative Works in Source or Object form.
|
72 |
-
|
73 |
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
-
this License, each Contributor hereby grants to You a perpetual,
|
75 |
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
-
(except as stated in this section) patent license to make, have made,
|
77 |
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
-
where such license applies only to those patent claims licensable
|
79 |
-
by such Contributor that are necessarily infringed by their
|
80 |
-
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
-
with the Work to which such Contribution(s) was submitted. If You
|
82 |
-
institute patent litigation against any entity (including a
|
83 |
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
-
or a Contribution incorporated within the Work constitutes direct
|
85 |
-
or contributory patent infringement, then any patent licenses
|
86 |
-
granted to You under this License for that Work shall terminate
|
87 |
-
as of the date such litigation is filed.
|
88 |
-
|
89 |
-
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
-
Work or Derivative Works thereof in any medium, with or without
|
91 |
-
modifications, and in Source or Object form, provided that You
|
92 |
-
meet the following conditions:
|
93 |
-
|
94 |
-
(a) You must give any other recipients of the Work or
|
95 |
-
Derivative Works a copy of this License; and
|
96 |
-
|
97 |
-
(b) You must cause any modified files to carry prominent notices
|
98 |
-
stating that You changed the files; and
|
99 |
-
|
100 |
-
(c) You must retain, in the Source form of any Derivative Works
|
101 |
-
that You distribute, all copyright, patent, trademark, and
|
102 |
-
attribution notices from the Source form of the Work,
|
103 |
-
excluding those notices that do not pertain to any part of
|
104 |
-
the Derivative Works; and
|
105 |
-
|
106 |
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
-
distribution, then any Derivative Works that You distribute must
|
108 |
-
include a readable copy of the attribution notices contained
|
109 |
-
within such NOTICE file, excluding those notices that do not
|
110 |
-
pertain to any part of the Derivative Works, in at least one
|
111 |
-
of the following places: within a NOTICE text file distributed
|
112 |
-
as part of the Derivative Works; within the Source form or
|
113 |
-
documentation, if provided along with the Derivative Works; or,
|
114 |
-
within a display generated by the Derivative Works, if and
|
115 |
-
wherever such third-party notices normally appear. The contents
|
116 |
-
of the NOTICE file are for informational purposes only and
|
117 |
-
do not modify the License. You may add Your own attribution
|
118 |
-
notices within Derivative Works that You distribute, alongside
|
119 |
-
or as an addendum to the NOTICE text from the Work, provided
|
120 |
-
that such additional attribution notices cannot be construed
|
121 |
-
as modifying the License.
|
122 |
-
|
123 |
-
You may add Your own copyright statement to Your modifications and
|
124 |
-
may provide additional or different license terms and conditions
|
125 |
-
for use, reproduction, or distribution of Your modifications, or
|
126 |
-
for any such Derivative Works as a whole, provided Your use,
|
127 |
-
reproduction, and distribution of the Work otherwise complies with
|
128 |
-
the conditions stated in this License.
|
129 |
-
|
130 |
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
-
any Contribution intentionally submitted for inclusion in the Work
|
132 |
-
by You to the Licensor shall be under the terms and conditions of
|
133 |
-
this License, without any additional terms or conditions.
|
134 |
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
-
the terms of any separate license agreement you may have executed
|
136 |
-
with Licensor regarding such Contributions.
|
137 |
-
|
138 |
-
6. Trademarks. This License does not grant permission to use the trade
|
139 |
-
names, trademarks, service marks, or product names of the Licensor,
|
140 |
-
except as required for reasonable and customary use in describing the
|
141 |
-
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
-
|
143 |
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
-
agreed to in writing, Licensor provides the Work (and each
|
145 |
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
-
implied, including, without limitation, any warranties or conditions
|
148 |
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
-
appropriateness of using or redistributing the Work and assume any
|
151 |
-
risks associated with Your exercise of permissions under this License.
|
152 |
-
|
153 |
-
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
-
whether in tort (including negligence), contract, or otherwise,
|
155 |
-
unless required by applicable law (such as deliberate and grossly
|
156 |
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
-
liable to You for damages, including any direct, indirect, special,
|
158 |
-
incidental, or consequential damages of any character arising as a
|
159 |
-
result of this License or out of the use or inability to use the
|
160 |
-
Work (including but not limited to damages for loss of goodwill,
|
161 |
-
work stoppage, computer failure or malfunction, or any and all
|
162 |
-
other commercial damages or losses), even if such Contributor
|
163 |
-
has been advised of the possibility of such damages.
|
164 |
-
|
165 |
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
-
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
-
or other liability obligations and/or rights consistent with this
|
169 |
-
License. However, in accepting such obligations, You may act only
|
170 |
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
-
of any other Contributor, and only if You agree to indemnify,
|
172 |
-
defend, and hold each Contributor harmless for any liability
|
173 |
-
incurred by, or claims asserted against, such Contributor by reason
|
174 |
-
of your accepting any such warranty or additional liability.
|
175 |
-
|
176 |
-
END OF TERMS AND CONDITIONS
|
177 |
-
|
178 |
-
APPENDIX: How to apply the Apache License to your work.
|
179 |
-
|
180 |
-
To apply the Apache License to your work, attach the following
|
181 |
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
-
replaced with your own identifying information. (Don't include
|
183 |
-
the brackets!) The text should be enclosed in the appropriate
|
184 |
-
comment syntax for the file format. We also recommend that a
|
185 |
-
file or class name and description of purpose be included on the
|
186 |
-
same "printed page" as the copyright notice for easier
|
187 |
-
identification within third-party archives.
|
188 |
-
|
189 |
-
Copyright [yyyy] [name of copyright owner]
|
190 |
-
|
191 |
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
-
you may not use this file except in compliance with the License.
|
193 |
-
You may obtain a copy of the License at
|
194 |
-
|
195 |
-
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
-
|
197 |
-
Unless required by applicable law or agreed to in writing, software
|
198 |
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
-
See the License for the specific language governing permissions and
|
201 |
-
limitations under the License.
|
202 |
-
|
203 |
-
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|
202 |
+
|
203 |
+
|
google/README.md
CHANGED
@@ -1,368 +1,368 @@
|
|
1 |
-
[![Build Status](https://travis-ci.org/google/google-api-php-client.svg?branch=master)](https://travis-ci.org/google/google-api-php-client)
|
2 |
-
|
3 |
-
# Google APIs Client Library for PHP #
|
4 |
-
|
5 |
-
## Library maintenance
|
6 |
-
This client library is supported but in maintenance mode only. We are fixing necessary bugs and adding essential features to ensure this library continues to meet your needs for accessing Google APIs. Non-critical issues will be closed. Any issue may be reopened if it is causing ongoing problems.
|
7 |
-
|
8 |
-
## Description ##
|
9 |
-
The Google API Client Library enables you to work with Google APIs such as Google+, Drive, or YouTube on your server.
|
10 |
-
|
11 |
-
## Beta ##
|
12 |
-
This library is in Beta. We're comfortable enough with the stability and features of the library that we want you to build real production applications on it. We will make an effort to support the public and protected surface of the library and maintain backwards compatibility in the future. While we are still in Beta, we reserve the right to make incompatible changes.
|
13 |
-
|
14 |
-
## Requirements ##
|
15 |
-
* [PHP 5.4.0 or higher](http://www.php.net/)
|
16 |
-
|
17 |
-
## Google Cloud Platform APIs
|
18 |
-
If you're looking to call the **Google Cloud Platform** APIs, you will want to use the [Google Cloud PHP](https://github.com/googlecloudplatform/google-cloud-php) library instead of this one.
|
19 |
-
|
20 |
-
## Developer Documentation ##
|
21 |
-
http://developers.google.com/api-client-library/php
|
22 |
-
|
23 |
-
## Installation ##
|
24 |
-
|
25 |
-
You can use **Composer** or simply **Download the Release**
|
26 |
-
|
27 |
-
### Composer
|
28 |
-
|
29 |
-
The preferred method is via [composer](https://getcomposer.org). Follow the
|
30 |
-
[installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have
|
31 |
-
composer installed.
|
32 |
-
|
33 |
-
Once composer is installed, execute the following command in your project root to install this library:
|
34 |
-
|
35 |
-
```sh
|
36 |
-
composer require google/apiclient:^2.0
|
37 |
-
```
|
38 |
-
|
39 |
-
Finally, be sure to include the autoloader:
|
40 |
-
|
41 |
-
```php
|
42 |
-
require_once '/path/to/your-project/vendor/autoload.php';
|
43 |
-
```
|
44 |
-
|
45 |
-
### Download the Release
|
46 |
-
|
47 |
-
If you abhor using composer, you can download the package in its entirety. The [Releases](https://github.com/google/google-api-php-client/releases) page lists all stable versions. Download any file
|
48 |
-
with the name `google-api-php-client-[RELEASE_NAME].zip` for a package including this library and its dependencies.
|
49 |
-
|
50 |
-
Uncompress the zip file you download, and include the autoloader in your project:
|
51 |
-
|
52 |
-
```php
|
53 |
-
require_once '/path/to/google-api-php-client/vendor/autoload.php';
|
54 |
-
```
|
55 |
-
|
56 |
-
For additional installation and setup instructions, see [the documentation](https://developers.google.com/api-client-library/php/start/installation).
|
57 |
-
|
58 |
-
## Examples ##
|
59 |
-
See the [`examples/`](examples) directory for examples of the key client features. You can
|
60 |
-
view them in your browser by running the php built-in web server.
|
61 |
-
|
62 |
-
```
|
63 |
-
$ php -S localhost:8000 -t examples/
|
64 |
-
```
|
65 |
-
|
66 |
-
And then browsing to the host and port you specified
|
67 |
-
(in the above example, `http://localhost:8000`).
|
68 |
-
|
69 |
-
### Basic Example ###
|
70 |
-
|
71 |
-
```php
|
72 |
-
// include your composer dependencies
|
73 |
-
require_once 'vendor/autoload.php';
|
74 |
-
|
75 |
-
$client = new Google_Client();
|
76 |
-
$client->setApplicationName("Client_Library_Examples");
|
77 |
-
$client->setDeveloperKey("YOUR_APP_KEY");
|
78 |
-
|
79 |
-
$service = new Google_Service_Books($client);
|
80 |
-
$optParams = array('filter' => 'free-ebooks');
|
81 |
-
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
|
82 |
-
|
83 |
-
foreach ($results as $item) {
|
84 |
-
echo $item['volumeInfo']['title'], "<br /> \n";
|
85 |
-
}
|
86 |
-
```
|
87 |
-
|
88 |
-
### Authentication with OAuth ###
|
89 |
-
|
90 |
-
> An example of this can be seen in [`examples/simple-file-upload.php`](examples/simple-file-upload.php).
|
91 |
-
|
92 |
-
1. Follow the instructions to [Create Web Application Credentials](https://developers.google.com/api-client-library/php/auth/web-app#creatingcred)
|
93 |
-
1. Download the JSON credentials
|
94 |
-
1. Set the path to these credentials using `Google_Client::setAuthConfig`:
|
95 |
-
|
96 |
-
```php
|
97 |
-
$client = new Google_Client();
|
98 |
-
$client->setAuthConfig('/path/to/client_credentials.json');
|
99 |
-
```
|
100 |
-
|
101 |
-
1. Set the scopes required for the API you are going to call
|
102 |
-
|
103 |
-
```php
|
104 |
-
$client->addScope(Google_Service_Drive::DRIVE);
|
105 |
-
```
|
106 |
-
|
107 |
-
1. Set your application's redirect URI
|
108 |
-
|
109 |
-
```php
|
110 |
-
// Your redirect URI can be any registered URI, but in this example
|
111 |
-
// we redirect back to this same page
|
112 |
-
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
113 |
-
$client->setRedirectUri($redirect_uri);
|
114 |
-
```
|
115 |
-
|
116 |
-
1. In the script handling the redirect URI, exchange the authorization code for an access token:
|
117 |
-
|
118 |
-
```php
|
119 |
-
if (isset($_GET['code'])) {
|
120 |
-
$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
|
121 |
-
}
|
122 |
-
```
|
123 |
-
|
124 |
-
### Authentication with Service Accounts ###
|
125 |
-
|
126 |
-
> An example of this can be seen in [`examples/service-account.php`](examples/service-account.php).
|
127 |
-
|
128 |
-
1. Follow the instructions to [Create a Service Account](https://developers.google.com/api-client-library/php/auth/service-accounts#creatinganaccount)
|
129 |
-
1. Download the JSON credentials
|
130 |
-
1. Set the path to these credentials using the `GOOGLE_APPLICATION_CREDENTIALS` environment variable:
|
131 |
-
|
132 |
-
```php
|
133 |
-
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
|
134 |
-
```
|
135 |
-
|
136 |
-
1. Tell the Google client to use your service account credentials to authenticate:
|
137 |
-
|
138 |
-
```php
|
139 |
-
$client = new Google_Client();
|
140 |
-
$client->useApplicationDefaultCredentials();
|
141 |
-
```
|
142 |
-
|
143 |
-
1. Set the scopes required for the API you are going to call
|
144 |
-
|
145 |
-
```php
|
146 |
-
$client->addScope(Google_Service_Drive::DRIVE);
|
147 |
-
```
|
148 |
-
|
149 |
-
1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject:
|
150 |
-
|
151 |
-
```php
|
152 |
-
$client->setSubject($user_to_impersonate);
|
153 |
-
```
|
154 |
-
|
155 |
-
### Making Requests ###
|
156 |
-
|
157 |
-
The classes used to call the API in [google-api-php-client-services](https://github.com/Google/google-api-php-client-services) are autogenerated. They map directly to the JSON requests and responses found in the [APIs Explorer](https://developers.google.com/apis-explorer/#p/).
|
158 |
-
|
159 |
-
A JSON request to the [Datastore API](https://developers.google.com/apis-explorer/#p/datastore/v1beta3/datastore.projects.runQuery) would look like this:
|
160 |
-
|
161 |
-
```json
|
162 |
-
POST https://datastore.googleapis.com/v1beta3/projects/YOUR_PROJECT_ID:runQuery?key=YOUR_API_KEY
|
163 |
-
|
164 |
-
{
|
165 |
-
"query": {
|
166 |
-
"kind": [{
|
167 |
-
"name": "Book"
|
168 |
-
}],
|
169 |
-
"order": [{
|
170 |
-
"property": {
|
171 |
-
"name": "title"
|
172 |
-
},
|
173 |
-
"direction": "descending"
|
174 |
-
}],
|
175 |
-
"limit": 10
|
176 |
-
}
|
177 |
-
}
|
178 |
-
```
|
179 |
-
|
180 |
-
Using this library, the same call would look something like this:
|
181 |
-
|
182 |
-
```php
|
183 |
-
// create the datastore service class
|
184 |
-
$datastore = new Google_Service_Datastore($client);
|
185 |
-
|
186 |
-
// build the query - this maps directly to the JSON
|
187 |
-
$query = new Google_Service_Datastore_Query([
|
188 |
-
'kind' => [
|
189 |
-
[
|
190 |
-
'name' => 'Book',
|
191 |
-
],
|
192 |
-
],
|
193 |
-
'order' => [
|
194 |
-
'property' => [
|
195 |
-
'name' => 'title',
|
196 |
-
],
|
197 |
-
'direction' => 'descending',
|
198 |
-
],
|
199 |
-
'limit' => 10,
|
200 |
-
]);
|
201 |
-
|
202 |
-
// build the request and response
|
203 |
-
$request = new Google_Service_Datastore_RunQueryRequest(['query' => $query]);
|
204 |
-
$response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
|
205 |
-
```
|
206 |
-
|
207 |
-
However, as each property of the JSON API has a corresponding generated class, the above code could also be written like this:
|
208 |
-
|
209 |
-
```php
|
210 |
-
// create the datastore service class
|
211 |
-
$datastore = new Google_Service_Datastore($client);
|
212 |
-
|
213 |
-
// build the query
|
214 |
-
$request = new Google_Service_Datastore_RunQueryRequest();
|
215 |
-
$query = new Google_Service_Datastore_Query();
|
216 |
-
// - set the order
|
217 |
-
$order = new Google_Service_Datastore_PropertyOrder();
|
218 |
-
$order->setDirection('descending');
|
219 |
-
$property = new Google_Service_Datastore_PropertyReference();
|
220 |
-
$property->setName('title');
|
221 |
-
$order->setProperty($property);
|
222 |
-
$query->setOrder([$order]);
|
223 |
-
// - set the kinds
|
224 |
-
$kind = new Google_Service_Datastore_KindExpression();
|
225 |
-
$kind->setName('Book');
|
226 |
-
$query->setKinds([$kind]);
|
227 |
-
// - set the limit
|
228 |
-
$query->setLimit(10);
|
229 |
-
|
230 |
-
// add the query to the request and make the request
|
231 |
-
$request->setQuery($query);
|
232 |
-
$response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
|
233 |
-
```
|
234 |
-
|
235 |
-
The method used is a matter of preference, but *it will be very difficult to use this library without first understanding the JSON syntax for the API*, so it is recommended to look at the [APIs Explorer](https://developers.google.com/apis-explorer/#p/) before using any of the services here.
|
236 |
-
|
237 |
-
### Making HTTP Requests Directly ###
|
238 |
-
|
239 |
-
If Google Authentication is desired for external applications, or a Google API is not available yet in this library, HTTP requests can be made directly.
|
240 |
-
|
241 |
-
The `authorize` method returns an authorized [Guzzle Client](http://docs.guzzlephp.org/), so any request made using the client will contain the corresponding authorization.
|
242 |
-
|
243 |
-
```php
|
244 |
-
// create the Google client
|
245 |
-
$client = new Google_Client();
|
246 |
-
|
247 |
-
/**
|
248 |
-
* Set your method for authentication. Depending on the API, This could be
|
249 |
-
* directly with an access token, API key, or (recommended) using
|
250 |
-
* Application Default Credentials.
|
251 |
-
*/
|
252 |
-
$client->useApplicationDefaultCredentials();
|
253 |
-
$client->addScope(Google_Service_Plus::PLUS_ME);
|
254 |
-
|
255 |
-
// returns a Guzzle HTTP Client
|
256 |
-
$httpClient = $client->authorize();
|
257 |
-
|
258 |
-
// make an HTTP request
|
259 |
-
$response = $httpClient->get('https://www.googleapis.com/plus/v1/people/me');
|
260 |
-
```
|
261 |
-
|
262 |
-
### Caching ###
|
263 |
-
|
264 |
-
It is recommended to use another caching library to improve performance. This can be done by passing a [PSR-6](http://www.php-fig.org/psr/psr-6/) compatible library to the client:
|
265 |
-
|
266 |
-
```php
|
267 |
-
$cache = new Stash\Pool(new Stash\Driver\FileSystem);
|
268 |
-
$client->setCache($cache);
|
269 |
-
```
|
270 |
-
|
271 |
-
In this example we use [StashPHP](http://www.stashphp.com/). Add this to your project with composer:
|
272 |
-
|
273 |
-
```
|
274 |
-
composer require tedivm/stash
|
275 |
-
```
|
276 |
-
|
277 |
-
### Updating Tokens ###
|
278 |
-
|
279 |
-
When using [Refresh Tokens](https://developers.google.com/identity/protocols/OAuth2InstalledApp#refresh) or [Service Account Credentials](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#overview), it may be useful to perform some action when a new access token is granted. To do this, pass a callable to the `setTokenCallback` method on the client:
|
280 |
-
|
281 |
-
```php
|
282 |
-
$logger = new Monolog\Logger;
|
283 |
-
$tokenCallback = function ($cacheKey, $accessToken) use ($logger) {
|
284 |
-
$logger->debug(sprintf('new access token received at cache key %s', $cacheKey));
|
285 |
-
};
|
286 |
-
$client->setTokenCallback($tokenCallback);
|
287 |
-
```
|
288 |
-
|
289 |
-
### Debugging Your HTTP Request using Charles ###
|
290 |
-
|
291 |
-
It is often very useful to debug your API calls by viewing the raw HTTP request. This library supports the use of [Charles Web Proxy](https://www.charlesproxy.com/documentation/getting-started/). Download and run Charles, and then capture all HTTP traffic through Charles with the following code:
|
292 |
-
|
293 |
-
```php
|
294 |
-
// FOR DEBUGGING ONLY
|
295 |
-
$httpClient = new GuzzleHttp\Client([
|
296 |
-
'proxy' => 'localhost:8888', // by default, Charles runs on localhost port 8888
|
297 |
-
'verify' => false, // otherwise HTTPS requests will fail.
|
298 |
-
]);
|
299 |
-
|
300 |
-
$client = new Google_Client();
|
301 |
-
$client->setHttpClient($httpClient);
|
302 |
-
```
|
303 |
-
|
304 |
-
Now all calls made by this library will appear in the Charles UI.
|
305 |
-
|
306 |
-
One additional step is required in Charles to view SSL requests. Go to **Charles > Proxy > SSL Proxying Settings** and add the domain you'd like captured. In the case of the Google APIs, this is usually `*.googleapis.com`.
|
307 |
-
|
308 |
-
### Service Specific Examples ###
|
309 |
-
|
310 |
-
YouTube: https://github.com/youtube/api-samples/tree/master/php
|
311 |
-
|
312 |
-
## How Do I Contribute? ##
|
313 |
-
|
314 |
-
Please see the [contributing](CONTRIBUTING.md) page for more information. In particular, we love pull requests - but please make sure to sign the [contributor license agreement](https://developers.google.com/api-client-library/php/contribute).
|
315 |
-
|
316 |
-
## Frequently Asked Questions ##
|
317 |
-
|
318 |
-
### What do I do if something isn't working? ###
|
319 |
-
|
320 |
-
For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: http://stackoverflow.com/questions/tagged/google-api-php-client
|
321 |
-
|
322 |
-
If there is a specific bug with the library, please [file a issue](https://github.com/google/google-api-php-client/issues) in the Github issues tracker, including an example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
|
323 |
-
|
324 |
-
### I want an example of X! ###
|
325 |
-
|
326 |
-
If X is a feature of the library, file away! If X is an example of using a specific service, the best place to go is to the teams for those specific APIs - our preference is to link to their examples rather than add them to the library, as they can then pin to specific versions of the library. If you have any examples for other APIs, let us know and we will happily add a link to the README above!
|
327 |
-
|
328 |
-
### Why do you still support 5.2? ###
|
329 |
-
|
330 |
-
When we started working on the 1.0.0 branch we knew there were several fundamental issues to fix with the 0.6 releases of the library. At that time we looked at the usage of the library, and other related projects, and determined that there was still a large and active base of PHP 5.2 installs. You can see this in statistics such as the PHP versions chart in the WordPress stats: http://wordpress.org/about/stats/. We will keep looking at the types of usage we see, and try to take advantage of newer PHP features where possible.
|
331 |
-
|
332 |
-
### Why does Google_..._Service have weird names? ###
|
333 |
-
|
334 |
-
The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.
|
335 |
-
|
336 |
-
### How do I deal with non-JSON response types? ###
|
337 |
-
|
338 |
-
Some services return XML or similar by default, rather than JSON, which is what the library supports. You can request a JSON response by adding an 'alt' argument to optional params that is normally the last argument to a method call:
|
339 |
-
|
340 |
-
```
|
341 |
-
$opt_params = array(
|
342 |
-
'alt' => "json"
|
343 |
-
);
|
344 |
-
```
|
345 |
-
|
346 |
-
### How do I set a field to null? ###
|
347 |
-
|
348 |
-
The library strips out nulls from the objects sent to the Google APIs as its the default value of all of the uninitialized properties. To work around this, set the field you want to null to `Google_Model::NULL_VALUE`. This is a placeholder that will be replaced with a true null when sent over the wire.
|
349 |
-
|
350 |
-
## Code Quality ##
|
351 |
-
|
352 |
-
Run the PHPUnit tests with PHPUnit. You can configure an API key and token in BaseTest.php to run all calls, but this will require some setup on the Google Developer Console.
|
353 |
-
|
354 |
-
phpunit tests/
|
355 |
-
|
356 |
-
### Coding Style
|
357 |
-
|
358 |
-
To check for coding style violations, run
|
359 |
-
|
360 |
-
```
|
361 |
-
vendor/bin/phpcs src --standard=style/ruleset.xml -np
|
362 |
-
```
|
363 |
-
|
364 |
-
To automatically fix (fixable) coding style violations, run
|
365 |
-
|
366 |
-
```
|
367 |
-
vendor/bin/phpcbf src --standard=style/ruleset.xml
|
368 |
-
```
|
1 |
+
[![Build Status](https://travis-ci.org/google/google-api-php-client.svg?branch=master)](https://travis-ci.org/google/google-api-php-client)
|
2 |
+
|
3 |
+
# Google APIs Client Library for PHP #
|
4 |
+
|
5 |
+
## Library maintenance
|
6 |
+
This client library is supported but in maintenance mode only. We are fixing necessary bugs and adding essential features to ensure this library continues to meet your needs for accessing Google APIs. Non-critical issues will be closed. Any issue may be reopened if it is causing ongoing problems.
|
7 |
+
|
8 |
+
## Description ##
|
9 |
+
The Google API Client Library enables you to work with Google APIs such as Google+, Drive, or YouTube on your server.
|
10 |
+
|
11 |
+
## Beta ##
|
12 |
+
This library is in Beta. We're comfortable enough with the stability and features of the library that we want you to build real production applications on it. We will make an effort to support the public and protected surface of the library and maintain backwards compatibility in the future. While we are still in Beta, we reserve the right to make incompatible changes.
|
13 |
+
|
14 |
+
## Requirements ##
|
15 |
+
* [PHP 5.4.0 or higher](http://www.php.net/)
|
16 |
+
|
17 |
+
## Google Cloud Platform APIs
|
18 |
+
If you're looking to call the **Google Cloud Platform** APIs, you will want to use the [Google Cloud PHP](https://github.com/googlecloudplatform/google-cloud-php) library instead of this one.
|
19 |
+
|
20 |
+
## Developer Documentation ##
|
21 |
+
http://developers.google.com/api-client-library/php
|
22 |
+
|
23 |
+
## Installation ##
|
24 |
+
|
25 |
+
You can use **Composer** or simply **Download the Release**
|
26 |
+
|
27 |
+
### Composer
|
28 |
+
|
29 |
+
The preferred method is via [composer](https://getcomposer.org). Follow the
|
30 |
+
[installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have
|
31 |
+
composer installed.
|
32 |
+
|
33 |
+
Once composer is installed, execute the following command in your project root to install this library:
|
34 |
+
|
35 |
+
```sh
|
36 |
+
composer require google/apiclient:^2.0
|
37 |
+
```
|
38 |
+
|
39 |
+
Finally, be sure to include the autoloader:
|
40 |
+
|
41 |
+
```php
|
42 |
+
require_once '/path/to/your-project/vendor/autoload.php';
|
43 |
+
```
|
44 |
+
|
45 |
+
### Download the Release
|
46 |
+
|
47 |
+
If you abhor using composer, you can download the package in its entirety. The [Releases](https://github.com/google/google-api-php-client/releases) page lists all stable versions. Download any file
|
48 |
+
with the name `google-api-php-client-[RELEASE_NAME].zip` for a package including this library and its dependencies.
|
49 |
+
|
50 |
+
Uncompress the zip file you download, and include the autoloader in your project:
|
51 |
+
|
52 |
+
```php
|
53 |
+
require_once '/path/to/google-api-php-client/vendor/autoload.php';
|
54 |
+
```
|
55 |
+
|
56 |
+
For additional installation and setup instructions, see [the documentation](https://developers.google.com/api-client-library/php/start/installation).
|
57 |
+
|
58 |
+
## Examples ##
|
59 |
+
See the [`examples/`](examples) directory for examples of the key client features. You can
|
60 |
+
view them in your browser by running the php built-in web server.
|
61 |
+
|
62 |
+
```
|
63 |
+
$ php -S localhost:8000 -t examples/
|
64 |
+
```
|
65 |
+
|
66 |
+
And then browsing to the host and port you specified
|
67 |
+
(in the above example, `http://localhost:8000`).
|
68 |
+
|
69 |
+
### Basic Example ###
|
70 |
+
|
71 |
+
```php
|
72 |
+
// include your composer dependencies
|
73 |
+
require_once 'vendor/autoload.php';
|
74 |
+
|
75 |
+
$client = new Google_Client();
|
76 |
+
$client->setApplicationName("Client_Library_Examples");
|
77 |
+
$client->setDeveloperKey("YOUR_APP_KEY");
|
78 |
+
|
79 |
+
$service = new Google_Service_Books($client);
|
80 |
+
$optParams = array('filter' => 'free-ebooks');
|
81 |
+
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
|
82 |
+
|
83 |
+
foreach ($results as $item) {
|
84 |
+
echo $item['volumeInfo']['title'], "<br /> \n";
|
85 |
+
}
|
86 |
+
```
|
87 |
+
|
88 |
+
### Authentication with OAuth ###
|
89 |
+
|
90 |
+
> An example of this can be seen in [`examples/simple-file-upload.php`](examples/simple-file-upload.php).
|
91 |
+
|
92 |
+
1. Follow the instructions to [Create Web Application Credentials](https://developers.google.com/api-client-library/php/auth/web-app#creatingcred)
|
93 |
+
1. Download the JSON credentials
|
94 |
+
1. Set the path to these credentials using `Google_Client::setAuthConfig`:
|
95 |
+
|
96 |
+
```php
|
97 |
+
$client = new Google_Client();
|
98 |
+
$client->setAuthConfig('/path/to/client_credentials.json');
|
99 |
+
```
|
100 |
+
|
101 |
+
1. Set the scopes required for the API you are going to call
|
102 |
+
|
103 |
+
```php
|
104 |
+
$client->addScope(Google_Service_Drive::DRIVE);
|
105 |
+
```
|
106 |
+
|
107 |
+
1. Set your application's redirect URI
|
108 |
+
|
109 |
+
```php
|
110 |
+
// Your redirect URI can be any registered URI, but in this example
|
111 |
+
// we redirect back to this same page
|
112 |
+
$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
113 |
+
$client->setRedirectUri($redirect_uri);
|
114 |
+
```
|
115 |
+
|
116 |
+
1. In the script handling the redirect URI, exchange the authorization code for an access token:
|
117 |
+
|
118 |
+
```php
|
119 |
+
if (isset($_GET['code'])) {
|
120 |
+
$token = $client->fetchAccessTokenWithAuthCode($_GET['code']);
|
121 |
+
}
|
122 |
+
```
|
123 |
+
|
124 |
+
### Authentication with Service Accounts ###
|
125 |
+
|
126 |
+
> An example of this can be seen in [`examples/service-account.php`](examples/service-account.php).
|
127 |
+
|
128 |
+
1. Follow the instructions to [Create a Service Account](https://developers.google.com/api-client-library/php/auth/service-accounts#creatinganaccount)
|
129 |
+
1. Download the JSON credentials
|
130 |
+
1. Set the path to these credentials using the `GOOGLE_APPLICATION_CREDENTIALS` environment variable:
|
131 |
+
|
132 |
+
```php
|
133 |
+
putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');
|
134 |
+
```
|
135 |
+
|
136 |
+
1. Tell the Google client to use your service account credentials to authenticate:
|
137 |
+
|
138 |
+
```php
|
139 |
+
$client = new Google_Client();
|
140 |
+
$client->useApplicationDefaultCredentials();
|
141 |
+
```
|
142 |
+
|
143 |
+
1. Set the scopes required for the API you are going to call
|
144 |
+
|
145 |
+
```php
|
146 |
+
$client->addScope(Google_Service_Drive::DRIVE);
|
147 |
+
```
|
148 |
+
|
149 |
+
1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject:
|
150 |
+
|
151 |
+
```php
|
152 |
+
$client->setSubject($user_to_impersonate);
|
153 |
+
```
|
154 |
+
|
155 |
+
### Making Requests ###
|
156 |
+
|
157 |
+
The classes used to call the API in [google-api-php-client-services](https://github.com/Google/google-api-php-client-services) are autogenerated. They map directly to the JSON requests and responses found in the [APIs Explorer](https://developers.google.com/apis-explorer/#p/).
|
158 |
+
|
159 |
+
A JSON request to the [Datastore API](https://developers.google.com/apis-explorer/#p/datastore/v1beta3/datastore.projects.runQuery) would look like this:
|
160 |
+
|
161 |
+
```json
|
162 |
+
POST https://datastore.googleapis.com/v1beta3/projects/YOUR_PROJECT_ID:runQuery?key=YOUR_API_KEY
|
163 |
+
|
164 |
+
{
|
165 |
+
"query": {
|
166 |
+
"kind": [{
|
167 |
+
"name": "Book"
|
168 |
+
}],
|
169 |
+
"order": [{
|
170 |
+
"property": {
|
171 |
+
"name": "title"
|
172 |
+
},
|
173 |
+
"direction": "descending"
|
174 |
+
}],
|
175 |
+
"limit": 10
|
176 |
+
}
|
177 |
+
}
|
178 |
+
```
|
179 |
+
|
180 |
+
Using this library, the same call would look something like this:
|
181 |
+
|
182 |
+
```php
|
183 |
+
// create the datastore service class
|
184 |
+
$datastore = new Google_Service_Datastore($client);
|
185 |
+
|
186 |
+
// build the query - this maps directly to the JSON
|
187 |
+
$query = new Google_Service_Datastore_Query([
|
188 |
+
'kind' => [
|
189 |
+
[
|
190 |
+
'name' => 'Book',
|
191 |
+
],
|
192 |
+
],
|
193 |
+
'order' => [
|
194 |
+
'property' => [
|
195 |
+
'name' => 'title',
|
196 |
+
],
|
197 |
+
'direction' => 'descending',
|
198 |
+
],
|
199 |
+
'limit' => 10,
|
200 |
+
]);
|
201 |
+
|
202 |
+
// build the request and response
|
203 |
+
$request = new Google_Service_Datastore_RunQueryRequest(['query' => $query]);
|
204 |
+
$response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
|
205 |
+
```
|
206 |
+
|
207 |
+
However, as each property of the JSON API has a corresponding generated class, the above code could also be written like this:
|
208 |
+
|
209 |
+
```php
|
210 |
+
// create the datastore service class
|
211 |
+
$datastore = new Google_Service_Datastore($client);
|
212 |
+
|
213 |
+
// build the query
|
214 |
+
$request = new Google_Service_Datastore_RunQueryRequest();
|
215 |
+
$query = new Google_Service_Datastore_Query();
|
216 |
+
// - set the order
|
217 |
+
$order = new Google_Service_Datastore_PropertyOrder();
|
218 |
+
$order->setDirection('descending');
|
219 |
+
$property = new Google_Service_Datastore_PropertyReference();
|
220 |
+
$property->setName('title');
|
221 |
+
$order->setProperty($property);
|
222 |
+
$query->setOrder([$order]);
|
223 |
+
// - set the kinds
|
224 |
+
$kind = new Google_Service_Datastore_KindExpression();
|
225 |
+
$kind->setName('Book');
|
226 |
+
$query->setKinds([$kind]);
|
227 |
+
// - set the limit
|
228 |
+
$query->setLimit(10);
|
229 |
+
|
230 |
+
// add the query to the request and make the request
|
231 |
+
$request->setQuery($query);
|
232 |
+
$response = $datastore->projects->runQuery('YOUR_DATASET_ID', $request);
|
233 |
+
```
|
234 |
+
|
235 |
+
The method used is a matter of preference, but *it will be very difficult to use this library without first understanding the JSON syntax for the API*, so it is recommended to look at the [APIs Explorer](https://developers.google.com/apis-explorer/#p/) before using any of the services here.
|
236 |
+
|
237 |
+
### Making HTTP Requests Directly ###
|
238 |
+
|
239 |
+
If Google Authentication is desired for external applications, or a Google API is not available yet in this library, HTTP requests can be made directly.
|
240 |
+
|
241 |
+
The `authorize` method returns an authorized [Guzzle Client](http://docs.guzzlephp.org/), so any request made using the client will contain the corresponding authorization.
|
242 |
+
|
243 |
+
```php
|
244 |
+
// create the Google client
|
245 |
+
$client = new Google_Client();
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Set your method for authentication. Depending on the API, This could be
|
249 |
+
* directly with an access token, API key, or (recommended) using
|
250 |
+
* Application Default Credentials.
|
251 |
+
*/
|
252 |
+
$client->useApplicationDefaultCredentials();
|
253 |
+
$client->addScope(Google_Service_Plus::PLUS_ME);
|
254 |
+
|
255 |
+
// returns a Guzzle HTTP Client
|
256 |
+
$httpClient = $client->authorize();
|
257 |
+
|
258 |
+
// make an HTTP request
|
259 |
+
$response = $httpClient->get('https://www.googleapis.com/plus/v1/people/me');
|
260 |
+
```
|
261 |
+
|
262 |
+
### Caching ###
|
263 |
+
|
264 |
+
It is recommended to use another caching library to improve performance. This can be done by passing a [PSR-6](http://www.php-fig.org/psr/psr-6/) compatible library to the client:
|
265 |
+
|
266 |
+
```php
|
267 |
+
$cache = new Stash\Pool(new Stash\Driver\FileSystem);
|
268 |
+
$client->setCache($cache);
|
269 |
+
```
|
270 |
+
|
271 |
+
In this example we use [StashPHP](http://www.stashphp.com/). Add this to your project with composer:
|
272 |
+
|
273 |
+
```
|
274 |
+
composer require tedivm/stash
|
275 |
+
```
|
276 |
+
|
277 |
+
### Updating Tokens ###
|
278 |
+
|
279 |
+
When using [Refresh Tokens](https://developers.google.com/identity/protocols/OAuth2InstalledApp#refresh) or [Service Account Credentials](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#overview), it may be useful to perform some action when a new access token is granted. To do this, pass a callable to the `setTokenCallback` method on the client:
|
280 |
+
|
281 |
+
```php
|
282 |
+
$logger = new Monolog\Logger;
|
283 |
+
$tokenCallback = function ($cacheKey, $accessToken) use ($logger) {
|
284 |
+
$logger->debug(sprintf('new access token received at cache key %s', $cacheKey));
|
285 |
+
};
|
286 |
+
$client->setTokenCallback($tokenCallback);
|
287 |
+
```
|
288 |
+
|
289 |
+
### Debugging Your HTTP Request using Charles ###
|
290 |
+
|
291 |
+
It is often very useful to debug your API calls by viewing the raw HTTP request. This library supports the use of [Charles Web Proxy](https://www.charlesproxy.com/documentation/getting-started/). Download and run Charles, and then capture all HTTP traffic through Charles with the following code:
|
292 |
+
|
293 |
+
```php
|
294 |
+
// FOR DEBUGGING ONLY
|
295 |
+
$httpClient = new GuzzleHttp\Client([
|
296 |
+
'proxy' => 'localhost:8888', // by default, Charles runs on localhost port 8888
|
297 |
+
'verify' => false, // otherwise HTTPS requests will fail.
|
298 |
+
]);
|
299 |
+
|
300 |
+
$client = new Google_Client();
|
301 |
+
$client->setHttpClient($httpClient);
|
302 |
+
```
|
303 |
+
|
304 |
+
Now all calls made by this library will appear in the Charles UI.
|
305 |
+
|
306 |
+
One additional step is required in Charles to view SSL requests. Go to **Charles > Proxy > SSL Proxying Settings** and add the domain you'd like captured. In the case of the Google APIs, this is usually `*.googleapis.com`.
|
307 |
+
|
308 |
+
### Service Specific Examples ###
|
309 |
+
|
310 |
+
YouTube: https://github.com/youtube/api-samples/tree/master/php
|
311 |
+
|
312 |
+
## How Do I Contribute? ##
|
313 |
+
|
314 |
+
Please see the [contributing](CONTRIBUTING.md) page for more information. In particular, we love pull requests - but please make sure to sign the [contributor license agreement](https://developers.google.com/api-client-library/php/contribute).
|
315 |
+
|
316 |
+
## Frequently Asked Questions ##
|
317 |
+
|
318 |
+
### What do I do if something isn't working? ###
|
319 |
+
|
320 |
+
For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: http://stackoverflow.com/questions/tagged/google-api-php-client
|
321 |
+
|
322 |
+
If there is a specific bug with the library, please [file a issue](https://github.com/google/google-api-php-client/issues) in the Github issues tracker, including an example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
|
323 |
+
|
324 |
+
### I want an example of X! ###
|
325 |
+
|
326 |
+
If X is a feature of the library, file away! If X is an example of using a specific service, the best place to go is to the teams for those specific APIs - our preference is to link to their examples rather than add them to the library, as they can then pin to specific versions of the library. If you have any examples for other APIs, let us know and we will happily add a link to the README above!
|
327 |
+
|
328 |
+
### Why do you still support 5.2? ###
|
329 |
+
|
330 |
+
When we started working on the 1.0.0 branch we knew there were several fundamental issues to fix with the 0.6 releases of the library. At that time we looked at the usage of the library, and other related projects, and determined that there was still a large and active base of PHP 5.2 installs. You can see this in statistics such as the PHP versions chart in the WordPress stats: http://wordpress.org/about/stats/. We will keep looking at the types of usage we see, and try to take advantage of newer PHP features where possible.
|
331 |
+
|
332 |
+
### Why does Google_..._Service have weird names? ###
|
333 |
+
|
334 |
+
The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.
|
335 |
+
|
336 |
+
### How do I deal with non-JSON response types? ###
|
337 |
+
|
338 |
+
Some services return XML or similar by default, rather than JSON, which is what the library supports. You can request a JSON response by adding an 'alt' argument to optional params that is normally the last argument to a method call:
|
339 |
+
|
340 |
+
```
|
341 |
+
$opt_params = array(
|
342 |
+
'alt' => "json"
|
343 |
+
);
|
344 |
+
```
|
345 |
+
|
346 |
+
### How do I set a field to null? ###
|
347 |
+
|
348 |
+
The library strips out nulls from the objects sent to the Google APIs as its the default value of all of the uninitialized properties. To work around this, set the field you want to null to `Google_Model::NULL_VALUE`. This is a placeholder that will be replaced with a true null when sent over the wire.
|
349 |
+
|
350 |
+
## Code Quality ##
|
351 |
+
|
352 |
+
Run the PHPUnit tests with PHPUnit. You can configure an API key and token in BaseTest.php to run all calls, but this will require some setup on the Google Developer Console.
|
353 |
+
|
354 |
+
phpunit tests/
|
355 |
+
|
356 |
+
### Coding Style
|
357 |
+
|
358 |
+
To check for coding style violations, run
|
359 |
+
|
360 |
+
```
|
361 |
+
vendor/bin/phpcs src --standard=style/ruleset.xml -np
|
362 |
+
```
|
363 |
+
|
364 |
+
To automatically fix (fixable) coding style violations, run
|
365 |
+
|
366 |
+
```
|
367 |
+
vendor/bin/phpcbf src --standard=style/ruleset.xml
|
368 |
+
```
|
google/composer.json
CHANGED
@@ -1,41 +1,41 @@
|
|
1 |
-
{
|
2 |
-
"name": "google/apiclient",
|
3 |
-
"type": "library",
|
4 |
-
"description": "Client library for Google APIs",
|
5 |
-
"keywords": ["google"],
|
6 |
-
"homepage": "http://developers.google.com/api-client-library/php",
|
7 |
-
"license": "Apache-2.0",
|
8 |
-
"require": {
|
9 |
-
"php": ">=5.4",
|
10 |
-
"google/auth": "^1.0",
|
11 |
-
"google/apiclient-services": "~0.13",
|
12 |
-
"firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
|
13 |
-
"monolog/monolog": "^1.17",
|
14 |
-
"phpseclib/phpseclib": "~0.3.10|~2.0",
|
15 |
-
"guzzlehttp/guzzle": "~5.3.1|~6.0",
|
16 |
-
"guzzlehttp/psr7": "^1.2"
|
17 |
-
},
|
18 |
-
"require-dev": {
|
19 |
-
"phpunit/phpunit": "~4",
|
20 |
-
"squizlabs/php_codesniffer": "~2.3",
|
21 |
-
"symfony/dom-crawler": "~2.1",
|
22 |
-
"symfony/css-selector": "~2.1",
|
23 |
-
"cache/filesystem-adapter": "^0.3.2"
|
24 |
-
},
|
25 |
-
"suggest": {
|
26 |
-
"cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)"
|
27 |
-
},
|
28 |
-
"autoload": {
|
29 |
-
"psr-0": {
|
30 |
-
"Google_": "src/"
|
31 |
-
},
|
32 |
-
"classmap": [
|
33 |
-
"src/Google/Service/"
|
34 |
-
]
|
35 |
-
},
|
36 |
-
"extra": {
|
37 |
-
"branch-alias": {
|
38 |
-
"dev-master": "2.x-dev"
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
1 |
+
{
|
2 |
+
"name": "google/apiclient",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Client library for Google APIs",
|
5 |
+
"keywords": ["google"],
|
6 |
+
"homepage": "http://developers.google.com/api-client-library/php",
|
7 |
+
"license": "Apache-2.0",
|
8 |
+
"require": {
|
9 |
+
"php": ">=5.4",
|
10 |
+
"google/auth": "^1.0",
|
11 |
+
"google/apiclient-services": "~0.13",
|
12 |
+
"firebase/php-jwt": "~2.0|~3.0|~4.0|~5.0",
|
13 |
+
"monolog/monolog": "^1.17",
|
14 |
+
"phpseclib/phpseclib": "~0.3.10|~2.0",
|
15 |
+
"guzzlehttp/guzzle": "~5.3.1|~6.0",
|
16 |
+
"guzzlehttp/psr7": "^1.2"
|
17 |
+
},
|
18 |
+
"require-dev": {
|
19 |
+
"phpunit/phpunit": "~4",
|
20 |
+
"squizlabs/php_codesniffer": "~2.3",
|
21 |
+
"symfony/dom-crawler": "~2.1",
|
22 |
+
"symfony/css-selector": "~2.1",
|
23 |
+
"cache/filesystem-adapter": "^0.3.2"
|
24 |
+
},
|
25 |
+
"suggest": {
|
26 |
+
"cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)"
|
27 |
+
},
|
28 |
+
"autoload": {
|
29 |
+
"psr-0": {
|
30 |
+
"Google_": "src/"
|
31 |
+
},
|
32 |
+
"classmap": [
|
33 |
+
"src/Google/Service/"
|
34 |
+
]
|
35 |
+
},
|
36 |
+
"extra": {
|
37 |
+
"branch-alias": {
|
38 |
+
"dev-master": "2.x-dev"
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
google/composer.lock
CHANGED
@@ -1,1757 +1,1757 @@
|
|
1 |
-
{
|
2 |
-
"_readme": [
|
3 |
-
"This file locks the dependencies of your project to a known state",
|
4 |
-
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
-
"This file is @generated automatically"
|
6 |
-
],
|
7 |
-
"content-hash": "23b0abc9b27af814f8b9ede0c901191b",
|
8 |
-
"packages": [
|
9 |
-
{
|
10 |
-
"name": "firebase/php-jwt",
|
11 |
-
"version": "2.0.0",
|
12 |
-
"target-dir": "Firebase/PHP-JWT",
|
13 |
-
"source": {
|
14 |
-
"type": "git",
|
15 |
-
"url": "https://github.com/firebase/php-jwt.git",
|
16 |
-
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57"
|
17 |
-
},
|
18 |
-
"dist": {
|
19 |
-
"type": "zip",
|
20 |
-
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
21 |
-
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
22 |
-
"shasum": ""
|
23 |
-
},
|
24 |
-
"require": {
|
25 |
-
"php": ">=5.2.0"
|
26 |
-
},
|
27 |
-
"type": "library",
|
28 |
-
"autoload": {
|
29 |
-
"classmap": [
|
30 |
-
"Authentication/",
|
31 |
-
"Exceptions/"
|
32 |
-
]
|
33 |
-
},
|
34 |
-
"notification-url": "https://packagist.org/downloads/",
|
35 |
-
"license": [
|
36 |
-
"BSD-3-Clause"
|
37 |
-
],
|
38 |
-
"authors": [
|
39 |
-
{
|
40 |
-
"name": "Neuman Vong",
|
41 |
-
"email": "neuman+pear@twilio.com",
|
42 |
-
"role": "Developer"
|
43 |
-
},
|
44 |
-
{
|
45 |
-
"name": "Anant Narayanan",
|
46 |
-
"email": "anant@php.net",
|
47 |
-
"role": "Developer"
|
48 |
-
}
|
49 |
-
],
|
50 |
-
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
51 |
-
"homepage": "https://github.com/firebase/php-jwt",
|
52 |
-
"time": "2015-04-01T18:46:38+00:00"
|
53 |
-
},
|
54 |
-
{
|
55 |
-
"name": "google/apiclient-services",
|
56 |
-
"version": "v0.13",
|
57 |
-
"source": {
|
58 |
-
"type": "git",
|
59 |
-
"url": "https://github.com/google/google-api-php-client-services.git",
|
60 |
-
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171"
|
61 |
-
},
|
62 |
-
"dist": {
|
63 |
-
"type": "zip",
|
64 |
-
"url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/0805897f3435f9eea73ce21da9d55f51c69c1171",
|
65 |
-
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171",
|
66 |
-
"shasum": ""
|
67 |
-
},
|
68 |
-
"require": {
|
69 |
-
"php": ">=5.4"
|
70 |
-
},
|
71 |
-
"require-dev": {
|
72 |
-
"phpunit/phpunit": "~4.8"
|
73 |
-
},
|
74 |
-
"type": "library",
|
75 |
-
"autoload": {
|
76 |
-
"psr-0": {
|
77 |
-
"Google_Service_": "src"
|
78 |
-
}
|
79 |
-
},
|
80 |
-
"notification-url": "https://packagist.org/downloads/",
|
81 |
-
"license": [
|
82 |
-
"Apache-2.0"
|
83 |
-
],
|
84 |
-
"description": "Client library for Google APIs",
|
85 |
-
"homepage": "http://developers.google.com/api-client-library/php",
|
86 |
-
"keywords": [
|
87 |
-
"google"
|
88 |
-
],
|
89 |
-
"time": "2017-07-07T16:01:27+00:00"
|
90 |
-
},
|
91 |
-
{
|
92 |
-
"name": "google/auth",
|
93 |
-
"version": "v1.0",
|
94 |
-
"source": {
|
95 |
-
"type": "git",
|
96 |
-
"url": "https://github.com/google/google-auth-library-php.git",
|
97 |
-
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df"
|
98 |
-
},
|
99 |
-
"dist": {
|
100 |
-
"type": "zip",
|
101 |
-
"url": "https://api.github.com/repos/google/google-auth-library-php/zipball/db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
102 |
-
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
103 |
-
"shasum": ""
|
104 |
-
},
|
105 |
-
"require": {
|
106 |
-
"firebase/php-jwt": "~2.0|~3.0|~4.0",
|
107 |
-
"guzzlehttp/guzzle": "~5.3.1|~6.0",
|
108 |
-
"guzzlehttp/psr7": "~1.2",
|
109 |
-
"php": ">=5.4",
|
110 |
-
"psr/cache": "^1.0",
|
111 |
-
"psr/http-message": "^1.0"
|
112 |
-
},
|
113 |
-
"require-dev": {
|
114 |
-
"friendsofphp/php-cs-fixer": "^1.11",
|
115 |
-
"phpunit/phpunit": "3.7.*"
|
116 |
-
},
|
117 |
-
"type": "library",
|
118 |
-
"autoload": {
|
119 |
-
"classmap": [
|
120 |
-
"src/"
|
121 |
-
],
|
122 |
-
"psr-4": {
|
123 |
-
"Google\\Auth\\": "src"
|
124 |
-
}
|
125 |
-
},
|
126 |
-
"notification-url": "https://packagist.org/downloads/",
|
127 |
-
"license": [
|
128 |
-
"Apache-2.0"
|
129 |
-
],
|
130 |
-
"description": "Google Auth Library for PHP",
|
131 |
-
"homepage": "http://github.com/google/google-auth-library-php",
|
132 |
-
"keywords": [
|
133 |
-
"Authentication",
|
134 |
-
"google",
|
135 |
-
"oauth2"
|
136 |
-
],
|
137 |
-
"time": "2017-06-13T18:00:07+00:00"
|
138 |
-
},
|
139 |
-
{
|
140 |
-
"name": "guzzlehttp/guzzle",
|
141 |
-
"version": "5.3.1",
|
142 |
-
"source": {
|
143 |
-
"type": "git",
|
144 |
-
"url": "https://github.com/guzzle/guzzle.git",
|
145 |
-
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8"
|
146 |
-
},
|
147 |
-
"dist": {
|
148 |
-
"type": "zip",
|
149 |
-
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
150 |
-
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
151 |
-
"shasum": ""
|
152 |
-
},
|
153 |
-
"require": {
|
154 |
-
"guzzlehttp/ringphp": "^1.1",
|
155 |
-
"php": ">=5.4.0"
|
156 |
-
},
|
157 |
-
"require-dev": {
|
158 |
-
"ext-curl": "*",
|
159 |
-
"phpunit/phpunit": "^4.0"
|
160 |
-
},
|
161 |
-
"type": "library",
|
162 |
-
"autoload": {
|
163 |
-
"psr-4": {
|
164 |
-
"GuzzleHttp\\": "src/"
|
165 |
-
}
|
166 |
-
},
|
167 |
-
"notification-url": "https://packagist.org/downloads/",
|
168 |
-
"license": [
|
169 |
-
"MIT"
|
170 |
-
],
|
171 |
-
"authors": [
|
172 |
-
{
|
173 |
-
"name": "Michael Dowling",
|
174 |
-
"email": "mtdowling@gmail.com",
|
175 |
-
"homepage": "https://github.com/mtdowling"
|
176 |
-
}
|
177 |
-
],
|
178 |
-
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
179 |
-
"homepage": "http://guzzlephp.org/",
|
180 |
-
"keywords": [
|
181 |
-
"client",
|
182 |
-
"curl",
|
183 |
-
"framework",
|
184 |
-
"http",
|
185 |
-
"http client",
|
186 |
-
"rest",
|
187 |
-
"web service"
|
188 |
-
],
|
189 |
-
"time": "2016-07-15T19:28:39+00:00"
|
190 |
-
},
|
191 |
-
{
|
192 |
-
"name": "guzzlehttp/psr7",
|
193 |
-
"version": "1.2.0",
|
194 |
-
"source": {
|
195 |
-
"type": "git",
|
196 |
-
"url": "https://github.com/guzzle/psr7.git",
|
197 |
-
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e"
|
198 |
-
},
|
199 |
-
"dist": {
|
200 |
-
"type": "zip",
|
201 |
-
"url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
202 |
-
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
203 |
-
"shasum": ""
|
204 |
-
},
|
205 |
-
"require": {
|
206 |
-
"php": ">=5.4.0",
|
207 |
-
"psr/http-message": "~1.0"
|
208 |
-
},
|
209 |
-
"provide": {
|
210 |
-
"psr/http-message-implementation": "1.0"
|
211 |
-
},
|
212 |
-
"require-dev": {
|
213 |
-
"phpunit/phpunit": "~4.0"
|
214 |
-
},
|
215 |
-
"type": "library",
|
216 |
-
"extra": {
|
217 |
-
"branch-alias": {
|
218 |
-
"dev-master": "1.0-dev"
|
219 |
-
}
|
220 |
-
},
|
221 |
-
"autoload": {
|
222 |
-
"psr-4": {
|
223 |
-
"GuzzleHttp\\Psr7\\": "src/"
|
224 |
-
},
|
225 |
-
"files": [
|
226 |
-
"src/functions_include.php"
|
227 |
-
]
|
228 |
-
},
|
229 |
-
"notification-url": "https://packagist.org/downloads/",
|
230 |
-
"license": [
|
231 |
-
"MIT"
|
232 |
-
],
|
233 |
-
"authors": [
|
234 |
-
{
|
235 |
-
"name": "Michael Dowling",
|
236 |
-
"email": "mtdowling@gmail.com",
|
237 |
-
"homepage": "https://github.com/mtdowling"
|
238 |
-
}
|
239 |
-
],
|
240 |
-
"description": "PSR-7 message implementation",
|
241 |
-
"keywords": [
|
242 |
-
"http",
|
243 |
-
"message",
|
244 |
-
"stream",
|
245 |
-
"uri"
|
246 |
-
],
|
247 |
-
"time": "2015-08-15T19:32:36+00:00"
|
248 |
-
},
|
249 |
-
{
|
250 |
-
"name": "guzzlehttp/ringphp",
|
251 |
-
"version": "1.1.0",
|
252 |
-
"source": {
|
253 |
-
"type": "git",
|
254 |
-
"url": "https://github.com/guzzle/RingPHP.git",
|
255 |
-
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
|
256 |
-
},
|
257 |
-
"dist": {
|
258 |
-
"type": "zip",
|
259 |
-
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
260 |
-
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
261 |
-
"shasum": ""
|
262 |
-
},
|
263 |
-
"require": {
|
264 |
-
"guzzlehttp/streams": "~3.0",
|
265 |
-
"php": ">=5.4.0",
|
266 |
-
"react/promise": "~2.0"
|
267 |
-
},
|
268 |
-
"require-dev": {
|
269 |
-
"ext-curl": "*",
|
270 |
-
"phpunit/phpunit": "~4.0"
|
271 |
-
},
|
272 |
-
"suggest": {
|
273 |
-
"ext-curl": "Guzzle will use specific adapters if cURL is present"
|
274 |
-
},
|
275 |
-
"type": "library",
|
276 |
-
"extra": {
|
277 |
-
"branch-alias": {
|
278 |
-
"dev-master": "1.1-dev"
|
279 |
-
}
|
280 |
-
},
|
281 |
-
"autoload": {
|
282 |
-
"psr-4": {
|
283 |
-
"GuzzleHttp\\Ring\\": "src/"
|
284 |
-
}
|
285 |
-
},
|
286 |
-
"notification-url": "https://packagist.org/downloads/",
|
287 |
-
"license": [
|
288 |
-
"MIT"
|
289 |
-
],
|
290 |
-
"authors": [
|
291 |
-
{
|
292 |
-
"name": "Michael Dowling",
|
293 |
-
"email": "mtdowling@gmail.com",
|
294 |
-
"homepage": "https://github.com/mtdowling"
|
295 |
-
}
|
296 |
-
],
|
297 |
-
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
|
298 |
-
"time": "2015-05-20T03:37:09+00:00"
|
299 |
-
},
|
300 |
-
{
|
301 |
-
"name": "guzzlehttp/streams",
|
302 |
-
"version": "3.0.0",
|
303 |
-
"source": {
|
304 |
-
"type": "git",
|
305 |
-
"url": "https://github.com/guzzle/streams.git",
|
306 |
-
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
|
307 |
-
},
|
308 |
-
"dist": {
|
309 |
-
"type": "zip",
|
310 |
-
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
311 |
-
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
312 |
-
"shasum": ""
|
313 |
-
},
|
314 |
-
"require": {
|
315 |
-
"php": ">=5.4.0"
|
316 |
-
},
|
317 |
-
"require-dev": {
|
318 |
-
"phpunit/phpunit": "~4.0"
|
319 |
-
},
|
320 |
-
"type": "library",
|
321 |
-
"extra": {
|
322 |
-
"branch-alias": {
|
323 |
-
"dev-master": "3.0-dev"
|
324 |
-
}
|
325 |
-
},
|
326 |
-
"autoload": {
|
327 |
-
"psr-4": {
|
328 |
-
"GuzzleHttp\\Stream\\": "src/"
|
329 |
-
}
|
330 |
-
},
|
331 |
-
"notification-url": "https://packagist.org/downloads/",
|
332 |
-
"license": [
|
333 |
-
"MIT"
|
334 |
-
],
|
335 |
-
"authors": [
|
336 |
-
{
|
337 |
-
"name": "Michael Dowling",
|
338 |
-
"email": "mtdowling@gmail.com",
|
339 |
-
"homepage": "https://github.com/mtdowling"
|
340 |
-
}
|
341 |
-
],
|
342 |
-
"description": "Provides a simple abstraction over streams of data",
|
343 |
-
"homepage": "http://guzzlephp.org/",
|
344 |
-
"keywords": [
|
345 |
-
"Guzzle",
|
346 |
-
"stream"
|
347 |
-
],
|
348 |
-
"time": "2014-10-12T19:18:40+00:00"
|
349 |
-
},
|
350 |
-
{
|
351 |
-
"name": "monolog/monolog",
|
352 |
-
"version": "1.17.0",
|
353 |
-
"source": {
|
354 |
-
"type": "git",
|
355 |
-
"url": "https://github.com/Seldaek/monolog.git",
|
356 |
-
"reference": "877ae631713cc961952df713ae785735b90df682"
|
357 |
-
},
|
358 |
-
"dist": {
|
359 |
-
"type": "zip",
|
360 |
-
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/877ae631713cc961952df713ae785735b90df682",
|
361 |
-
"reference": "877ae631713cc961952df713ae785735b90df682",
|
362 |
-
"shasum": ""
|
363 |
-
},
|
364 |
-
"require": {
|
365 |
-
"php": ">=5.3.0",
|
366 |
-
"psr/log": "~1.0"
|
367 |
-
},
|
368 |
-
"provide": {
|
369 |
-
"psr/log-implementation": "1.0.0"
|
370 |
-
},
|
371 |
-
"require-dev": {
|
372 |
-
"aws/aws-sdk-php": "^2.4.9",
|
373 |
-
"doctrine/couchdb": "~1.0@dev",
|
374 |
-
"graylog2/gelf-php": "~1.0",
|
375 |
-
"php-console/php-console": "^3.1.3",
|
376 |
-
"phpunit/phpunit": "~4.5",
|
377 |
-
"phpunit/phpunit-mock-objects": "2.3.0",
|
378 |
-
"raven/raven": "~0.11",
|
379 |
-
"ruflin/elastica": ">=0.90 <3.0",
|
380 |
-
"swiftmailer/swiftmailer": "~5.3",
|
381 |
-
"videlalvaro/php-amqplib": "~2.4"
|
382 |
-
},
|
383 |
-
"suggest": {
|
384 |
-
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
385 |
-
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
386 |
-
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
387 |
-
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
388 |
-
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
389 |
-
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
390 |
-
"raven/raven": "Allow sending log messages to a Sentry server",
|
391 |
-
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
392 |
-
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
393 |
-
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
|
394 |
-
},
|
395 |
-
"type": "library",
|
396 |
-
"extra": {
|
397 |
-
"branch-alias": {
|
398 |
-
"dev-master": "1.16.x-dev"
|
399 |
-
}
|
400 |
-
},
|
401 |
-
"autoload": {
|
402 |
-
"psr-4": {
|
403 |
-
"Monolog\\": "src/Monolog"
|
404 |
-
}
|
405 |
-
},
|
406 |
-
"notification-url": "https://packagist.org/downloads/",
|
407 |
-
"license": [
|
408 |
-
"MIT"
|
409 |
-
],
|
410 |
-
"authors": [
|
411 |
-
{
|
412 |
-
"name": "Jordi Boggiano",
|
413 |
-
"email": "j.boggiano@seld.be",
|
414 |
-
"homepage": "http://seld.be"
|
415 |
-
}
|
416 |
-
],
|
417 |
-
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
418 |
-
"homepage": "http://github.com/Seldaek/monolog",
|
419 |
-
"keywords": [
|
420 |
-
"log",
|
421 |
-
"logging",
|
422 |
-
"psr-3"
|
423 |
-
],
|
424 |
-
"time": "2015-08-30T11:40:25+00:00"
|
425 |
-
},
|
426 |
-
{
|
427 |
-
"name": "phpseclib/phpseclib",
|
428 |
-
"version": "0.3.10",
|
429 |
-
"source": {
|
430 |
-
"type": "git",
|
431 |
-
"url": "https://github.com/phpseclib/phpseclib.git",
|
432 |
-
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
|
433 |
-
},
|
434 |
-
"dist": {
|
435 |
-
"type": "zip",
|
436 |
-
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
437 |
-
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
438 |
-
"shasum": ""
|
439 |
-
},
|
440 |
-
"require": {
|
441 |
-
"php": ">=5.0.0"
|
442 |
-
},
|
443 |
-
"require-dev": {
|
444 |
-
"phing/phing": "~2.7",
|
445 |
-
"phpunit/phpunit": "~4.0",
|
446 |
-
"sami/sami": "~2.0",
|
447 |
-
"squizlabs/php_codesniffer": "~1.5"
|
448 |
-
},
|
449 |
-
"suggest": {
|
450 |
-
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
|
451 |
-
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.",
|
452 |
-
"pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3."
|
453 |
-
},
|
454 |
-
"type": "library",
|
455 |
-
"extra": {
|
456 |
-
"branch-alias": {
|
457 |
-
"dev-master": "0.3-dev"
|
458 |
-
}
|
459 |
-
},
|
460 |
-
"autoload": {
|
461 |
-
"psr-0": {
|
462 |
-
"Crypt": "phpseclib/",
|
463 |
-
"File": "phpseclib/",
|
464 |
-
"Math": "phpseclib/",
|
465 |
-
"Net": "phpseclib/",
|
466 |
-
"System": "phpseclib/"
|
467 |
-
},
|
468 |
-
"files": [
|
469 |
-
"phpseclib/Crypt/Random.php"
|
470 |
-
]
|
471 |
-
},
|
472 |
-
"notification-url": "https://packagist.org/downloads/",
|
473 |
-
"include-path": [
|
474 |
-
"phpseclib/"
|
475 |
-
],
|
476 |
-
"license": [
|
477 |
-
"MIT"
|
478 |
-
],
|
479 |
-
"authors": [
|
480 |
-
{
|
481 |
-
"name": "Jim Wigginton",
|
482 |
-
"email": "terrafrost@php.net",
|
483 |
-
"role": "Lead Developer"
|
484 |
-
},
|
485 |
-
{
|
486 |
-
"name": "Patrick Monnerat",
|
487 |
-
"email": "pm@datasphere.ch",
|
488 |
-
"role": "Developer"
|
489 |
-
},
|
490 |
-
{
|
491 |
-
"name": "Andreas Fischer",
|
492 |
-
"email": "bantu@phpbb.com",
|
493 |
-
"role": "Developer"
|
494 |
-
},
|
495 |
-
{
|
496 |
-
"name": "Hans-Jürgen Petrich",
|
497 |
-
"email": "petrich@tronic-media.com",
|
498 |
-
"role": "Developer"
|
499 |
-
}
|
500 |
-
],
|
501 |
-
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
|
502 |
-
"homepage": "http://phpseclib.sourceforge.net",
|
503 |
-
"keywords": [
|
504 |
-
"BigInteger",
|
505 |
-
"aes",
|
506 |
-
"asn.1",
|
507 |
-
"asn1",
|
508 |
-
"blowfish",
|
509 |
-
"crypto",
|
510 |
-
"cryptography",
|
511 |
-
"encryption",
|
512 |
-
"rsa",
|
513 |
-
"security",
|
514 |
-
"sftp",
|
515 |
-
"signature",
|
516 |
-
"signing",
|
517 |
-
"ssh",
|
518 |
-
"twofish",
|
519 |
-
"x.509",
|
520 |
-
"x509"
|
521 |
-
],
|
522 |
-
"time": "2015-01-28T21:50:33+00:00"
|
523 |
-
},
|
524 |
-
{
|
525 |
-
"name": "psr/cache",
|
526 |
-
"version": "1.0.0",
|
527 |
-
"source": {
|
528 |
-
"type": "git",
|
529 |
-
"url": "https://github.com/php-fig/cache.git",
|
530 |
-
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3"
|
531 |
-
},
|
532 |
-
"dist": {
|
533 |
-
"type": "zip",
|
534 |
-
"url": "https://api.github.com/repos/php-fig/cache/zipball/9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
535 |
-
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
536 |
-
"shasum": ""
|
537 |
-
},
|
538 |
-
"require": {
|
539 |
-
"php": ">=5.3.0"
|
540 |
-
},
|
541 |
-
"type": "library",
|
542 |
-
"extra": {
|
543 |
-
"branch-alias": {
|
544 |
-
"dev-master": "1.0.x-dev"
|
545 |
-
}
|
546 |
-
},
|
547 |
-
"autoload": {
|
548 |
-
"psr-4": {
|
549 |
-
"Psr\\Cache\\": "src/"
|
550 |
-
}
|
551 |
-
},
|
552 |
-
"notification-url": "https://packagist.org/downloads/",
|
553 |
-
"license": [
|
554 |
-
"MIT"
|
555 |
-
],
|
556 |
-
"authors": [
|
557 |
-
{
|
558 |
-
"name": "PHP-FIG",
|
559 |
-
"homepage": "http://www.php-fig.org/"
|
560 |
-
}
|
561 |
-
],
|
562 |
-
"description": "Common interface for caching libraries",
|
563 |
-
"keywords": [
|
564 |
-
"cache",
|
565 |
-
"psr",
|
566 |
-
"psr-6"
|
567 |
-
],
|
568 |
-
"time": "2015-12-11T02:52:07+00:00"
|
569 |
-
},
|
570 |
-
{
|
571 |
-
"name": "psr/http-message",
|
572 |
-
"version": "1.0",
|
573 |
-
"source": {
|
574 |
-
"type": "git",
|
575 |
-
"url": "https://github.com/php-fig/http-message.git",
|
576 |
-
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
|
577 |
-
},
|
578 |
-
"dist": {
|
579 |
-
"type": "zip",
|
580 |
-
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
581 |
-
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
582 |
-
"shasum": ""
|
583 |
-
},
|
584 |
-
"require": {
|
585 |
-
"php": ">=5.3.0"
|
586 |
-
},
|
587 |
-
"type": "library",
|
588 |
-
"extra": {
|
589 |
-
"branch-alias": {
|
590 |
-
"dev-master": "1.0.x-dev"
|
591 |
-
}
|
592 |
-
},
|
593 |
-
"autoload": {
|
594 |
-
"psr-4": {
|
595 |
-
"Psr\\Http\\Message\\": "src/"
|
596 |
-
}
|
597 |
-
},
|
598 |
-
"notification-url": "https://packagist.org/downloads/",
|
599 |
-
"license": [
|
600 |
-
"MIT"
|
601 |
-
],
|
602 |
-
"authors": [
|
603 |
-
{
|
604 |
-
"name": "PHP-FIG",
|
605 |
-
"homepage": "http://www.php-fig.org/"
|
606 |
-
}
|
607 |
-
],
|
608 |
-
"description": "Common interface for HTTP messages",
|
609 |
-
"keywords": [
|
610 |
-
"http",
|
611 |
-
"http-message",
|
612 |
-
"psr",
|
613 |
-
"psr-7",
|
614 |
-
"request",
|
615 |
-
"response"
|
616 |
-
],
|
617 |
-
"time": "2015-05-04T20:22:00+00:00"
|
618 |
-
},
|
619 |
-
{
|
620 |
-
"name": "psr/log",
|
621 |
-
"version": "1.0.0",
|
622 |
-
"source": {
|
623 |
-
"type": "git",
|
624 |
-
"url": "https://github.com/php-fig/log.git",
|
625 |
-
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
626 |
-
},
|
627 |
-
"dist": {
|
628 |
-
"type": "zip",
|
629 |
-
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
630 |
-
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
631 |
-
"shasum": ""
|
632 |
-
},
|
633 |
-
"type": "library",
|
634 |
-
"autoload": {
|
635 |
-
"psr-0": {
|
636 |
-
"Psr\\Log\\": ""
|
637 |
-
}
|
638 |
-
},
|
639 |
-
"notification-url": "https://packagist.org/downloads/",
|
640 |
-
"license": [
|
641 |
-
"MIT"
|
642 |
-
],
|
643 |
-
"authors": [
|
644 |
-
{
|
645 |
-
"name": "PHP-FIG",
|
646 |
-
"homepage": "http://www.php-fig.org/"
|
647 |
-
}
|
648 |
-
],
|
649 |
-
"description": "Common interface for logging libraries",
|
650 |
-
"keywords": [
|
651 |
-
"log",
|
652 |
-
"psr",
|
653 |
-
"psr-3"
|
654 |
-
],
|
655 |
-
"time": "2012-12-21T11:40:51+00:00"
|
656 |
-
},
|
657 |
-
{
|
658 |
-
"name": "react/promise",
|
659 |
-
"version": "v2.0.0",
|
660 |
-
"source": {
|
661 |
-
"type": "git",
|
662 |
-
"url": "https://github.com/reactphp/promise.git",
|
663 |
-
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0"
|
664 |
-
},
|
665 |
-
"dist": {
|
666 |
-
"type": "zip",
|
667 |
-
"url": "https://api.github.com/repos/reactphp/promise/zipball/58129a9cb9da88f2055309a805e2696b06928bb0",
|
668 |
-
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0",
|
669 |
-
"shasum": ""
|
670 |
-
},
|
671 |
-
"require": {
|
672 |
-
"php": ">=5.4.0"
|
673 |
-
},
|
674 |
-
"type": "library",
|
675 |
-
"extra": {
|
676 |
-
"branch-alias": {
|
677 |
-
"dev-master": "2.0-dev"
|
678 |
-
}
|
679 |
-
},
|
680 |
-
"autoload": {
|
681 |
-
"psr-0": {
|
682 |
-
"React\\Promise": "src/"
|
683 |
-
},
|
684 |
-
"files": [
|
685 |
-
"src/React/Promise/functions.php"
|
686 |
-
]
|
687 |
-
},
|
688 |
-
"notification-url": "https://packagist.org/downloads/",
|
689 |
-
"license": [
|
690 |
-
"MIT"
|
691 |
-
],
|
692 |
-
"authors": [
|
693 |
-
{
|
694 |
-
"name": "Jan Sorgalla",
|
695 |
-
"email": "jsorgalla@googlemail.com"
|
696 |
-
}
|
697 |
-
],
|
698 |
-
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
|
699 |
-
"time": "2013-12-10T15:40:36+00:00"
|
700 |
-
}
|
701 |
-
],
|
702 |
-
"packages-dev": [
|
703 |
-
{
|
704 |
-
"name": "cache/adapter-common",
|
705 |
-
"version": "0.3.0",
|
706 |
-
"source": {
|
707 |
-
"type": "git",
|
708 |
-
"url": "https://github.com/php-cache/adapter-common.git",
|
709 |
-
"reference": "56c9c9af1b6389f6aa2c26df23a1c058249c384a"
|
710 |
-
},
|
711 |
-
"dist": {
|
712 |
-
"type": "zip",
|
713 |
-
"url": "https://api.github.com/repos/php-cache/adapter-common/zipball/56c9c9af1b6389f6aa2c26df23a1c058249c384a",
|
714 |
-
"reference": "56c9c9af1b6389f6aa2c26df23a1c058249c384a",
|
715 |
-
"shasum": ""
|
716 |
-
},
|
717 |
-
"require": {
|
718 |
-
"cache/taggable-cache": "^0.4",
|
719 |
-
"php": "^5.5|^7.0",
|
720 |
-
"psr/cache": "^1.0"
|
721 |
-
},
|
722 |
-
"require-dev": {
|
723 |
-
"cache/integration-tests": "^0.9",
|
724 |
-
"phpunit/phpunit": "^4.0|^5.1"
|
725 |
-
},
|
726 |
-
"type": "library",
|
727 |
-
"autoload": {
|
728 |
-
"psr-4": {
|
729 |
-
"Cache\\Adapter\\Common\\": ""
|
730 |
-
}
|
731 |
-
},
|
732 |
-
"notification-url": "https://packagist.org/downloads/",
|
733 |
-
"license": [
|
734 |
-
"MIT"
|
735 |
-
],
|
736 |
-
"authors": [
|
737 |
-
{
|
738 |
-
"name": "Aaron Scherer",
|
739 |
-
"email": "aequasi@gmail.com",
|
740 |
-
"homepage": "https://github.com/aequasi"
|
741 |
-
},
|
742 |
-
{
|
743 |
-
"name": "Tobias Nyholm",
|
744 |
-
"email": "tobias.nyholm@gmail.com",
|
745 |
-
"homepage": "https://github.com/nyholm"
|
746 |
-
}
|
747 |
-
],
|
748 |
-
"description": "Common classes for PSR-6 adapters",
|
749 |
-
"homepage": "https://github.com/php-cache/adapter-common",
|
750 |
-
"keywords": [
|
751 |
-
"cache",
|
752 |
-
"psr-6",
|
753 |
-
"tag"
|
754 |
-
],
|
755 |
-
"time": "2016-02-25T08:03:59+00:00"
|
756 |
-
},
|
757 |
-
{
|
758 |
-
"name": "cache/filesystem-adapter",
|
759 |
-
"version": "0.3.2",
|
760 |
-
"source": {
|
761 |
-
"type": "git",
|
762 |
-
"url": "https://github.com/php-cache/filesystem-adapter.git",
|
763 |
-
"reference": "eeb6a2b60fdcb4984c90113fd37f17a36c13ac02"
|
764 |
-
},
|
765 |
-
"dist": {
|
766 |
-
"type": "zip",
|
767 |
-
"url": "https://api.github.com/repos/php-cache/filesystem-adapter/zipball/eeb6a2b60fdcb4984c90113fd37f17a36c13ac02",
|
768 |
-
"reference": "eeb6a2b60fdcb4984c90113fd37f17a36c13ac02",
|
769 |
-
"shasum": ""
|
770 |
-
},
|
771 |
-
"require": {
|
772 |
-
"cache/adapter-common": "^0.3",
|
773 |
-
"cache/taggable-cache": "^0.4",
|
774 |
-
"league/flysystem": "^1.0",
|
775 |
-
"php": "^5.5 || ^7.0",
|
776 |
-
"psr/cache": "^1.0"
|
777 |
-
},
|
778 |
-
"provide": {
|
779 |
-
"psr/cache-implementation": "^1.0"
|
780 |
-
},
|
781 |
-
"require-dev": {
|
782 |
-
"cache/integration-tests": "^0.11",
|
783 |
-
"phpunit/phpunit": "^4.0 || ^5.1"
|
784 |
-
},
|
785 |
-
"type": "library",
|
786 |
-
"autoload": {
|
787 |
-
"psr-4": {
|
788 |
-
"Cache\\Adapter\\Filesystem\\": ""
|
789 |
-
},
|
790 |
-
"exclude-from-classmap": [
|
791 |
-
"/Tests/"
|
792 |
-
]
|
793 |
-
},
|
794 |
-
"notification-url": "https://packagist.org/downloads/",
|
795 |
-
"license": [
|
796 |
-
"MIT"
|
797 |
-
],
|
798 |
-
"authors": [
|
799 |
-
{
|
800 |
-
"name": "Aaron Scherer",
|
801 |
-
"email": "aequasi@gmail.com",
|
802 |
-
"homepage": "https://github.com/aequasi"
|
803 |
-
},
|
804 |
-
{
|
805 |
-
"name": "Tobias Nyholm",
|
806 |
-
"email": "tobias.nyholm@gmail.com",
|
807 |
-
"homepage": "https://github.com/nyholm"
|
808 |
-
}
|
809 |
-
],
|
810 |
-
"description": "A PSR-6 cache implementation using filesystem. This implementation supports tags",
|
811 |
-
"homepage": "http://www.php-cache.com/en/latest/",
|
812 |
-
"keywords": [
|
813 |
-
"cache",
|
814 |
-
"filesystem",
|
815 |
-
"psr-6",
|
816 |
-
"tag"
|
817 |
-
],
|
818 |
-
"time": "2016-10-19T18:54:43+00:00"
|
819 |
-
},
|
820 |
-
{
|
821 |
-
"name": "cache/taggable-cache",
|
822 |
-
"version": "0.4.0",
|
823 |
-
"source": {
|
824 |
-
"type": "git",
|
825 |
-
"url": "https://github.com/php-cache/taggable-cache.git",
|
826 |
-
"reference": "ad9276e372043e17aa386d63e85272c35b2ebfe7"
|
827 |
-
},
|
828 |
-
"dist": {
|
829 |
-
"type": "zip",
|
830 |
-
"url": "https://api.github.com/repos/php-cache/taggable-cache/zipball/ad9276e372043e17aa386d63e85272c35b2ebfe7",
|
831 |
-
"reference": "ad9276e372043e17aa386d63e85272c35b2ebfe7",
|
832 |
-
"shasum": ""
|
833 |
-
},
|
834 |
-
"require": {
|
835 |
-
"php": "^5.5|^7.0",
|
836 |
-
"psr/cache": "^1.0"
|
837 |
-
},
|
838 |
-
"require-dev": {
|
839 |
-
"cache/integration-tests": "^0.9",
|
840 |
-
"phpunit/phpunit": "^4.1|^5.1"
|
841 |
-
},
|
842 |
-
"type": "library",
|
843 |
-
"autoload": {
|
844 |
-
"psr-4": {
|
845 |
-
"Cache\\Taggable\\": ""
|
846 |
-
},
|
847 |
-
"exclude-from-classmap": [
|
848 |
-
"/Tests/"
|
849 |
-
]
|
850 |
-
},
|
851 |
-
"notification-url": "https://packagist.org/downloads/",
|
852 |
-
"license": [
|
853 |
-
"MIT"
|
854 |
-
],
|
855 |
-
"authors": [
|
856 |
-
{
|
857 |
-
"name": "Aaron Scherer",
|
858 |
-
"email": "aequasi@gmail.com",
|
859 |
-
"homepage": "https://github.com/aequasi"
|
860 |
-
},
|
861 |
-
{
|
862 |
-
"name": "Tobias Nyholm",
|
863 |
-
"email": "tobias.nyholm@gmail.com",
|
864 |
-
"homepage": "https://github.com/nyholm"
|
865 |
-
}
|
866 |
-
],
|
867 |
-
"description": "Add tag support to your PSR-6 cache implementation",
|
868 |
-
"homepage": "https://github.com/php-cache/taggable-cache",
|
869 |
-
"keywords": [
|
870 |
-
"Taggable",
|
871 |
-
"cache",
|
872 |
-
"psr6",
|
873 |
-
"tag"
|
874 |
-
],
|
875 |
-
"time": "2016-02-28T16:35:05+00:00"
|
876 |
-
},
|
877 |
-
{
|
878 |
-
"name": "league/flysystem",
|
879 |
-
"version": "1.0.0",
|
880 |
-
"source": {
|
881 |
-
"type": "git",
|
882 |
-
"url": "https://github.com/thephpleague/flysystem.git",
|
883 |
-
"reference": "0ba6b6dfd6f456905ee8d6b0bcaab7ec89419b93"
|
884 |
-
},
|
885 |
-
"dist": {
|
886 |
-
"type": "zip",
|
887 |
-
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0ba6b6dfd6f456905ee8d6b0bcaab7ec89419b93",
|
888 |
-
"reference": "0ba6b6dfd6f456905ee8d6b0bcaab7ec89419b93",
|
889 |
-
"shasum": ""
|
890 |
-
},
|
891 |
-
"require": {
|
892 |
-
"php": ">=5.4.0"
|
893 |
-
},
|
894 |
-
"require-dev": {
|
895 |
-
"ext-fileinfo": "*",
|
896 |
-
"league/phpunit-coverage-listener": "~1.1",
|
897 |
-
"mockery/mockery": "~0.9",
|
898 |
-
"phpspec/phpspec": "~2.0.0",
|
899 |
-
"phpspec/prophecy-phpunit": "~1.0",
|
900 |
-
"phpunit/phpunit": "~4.0",
|
901 |
-
"predis/predis": "~1.0",
|
902 |
-
"tedivm/stash": "~0.12.0"
|
903 |
-
},
|
904 |
-
"suggest": {
|
905 |
-
"ext-fileinfo": "Required for MimeType",
|
906 |
-
"league/flysystem-aws-s3-v2": "Use S3 storage with AWS SDK v2",
|
907 |
-
"league/flysystem-aws-s3-v3": "Use S3 storage with AWS SDK v3",
|
908 |
-
"league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
|
909 |
-
"league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
|
910 |
-
"league/flysystem-copy": "Allows you to use Copy.com storage",
|
911 |
-
"league/flysystem-dropbox": "Use Dropbox storage",
|
912 |
-
"league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
|
913 |
-
"league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
|
914 |
-
"league/flysystem-sftp": "Allows SFTP server storage via phpseclib",
|
915 |
-
"league/flysystem-webdav": "Allows you to use WebDAV storage",
|
916 |
-
"league/flysystem-ziparchive": "Allows you to use ZipArchive adapter",
|
917 |
-
"predis/predis": "Allows you to use Predis for caching"
|
918 |
-
},
|
919 |
-
"type": "library",
|
920 |
-
"extra": {
|
921 |
-
"branch-alias": {
|
922 |
-
"dev-master": "1.0-dev"
|
923 |
-
}
|
924 |
-
},
|
925 |
-
"autoload": {
|
926 |
-
"psr-4": {
|
927 |
-
"League\\Flysystem\\": "src/"
|
928 |
-
}
|
929 |
-
},
|
930 |
-
"notification-url": "https://packagist.org/downloads/",
|
931 |
-
"license": [
|
932 |
-
"MIT"
|
933 |
-
],
|
934 |
-
"authors": [
|
935 |
-
{
|
936 |
-
"name": "Frank de Jonge",
|
937 |
-
"email": "info@frenky.net"
|
938 |
-
}
|
939 |
-
],
|
940 |
-
"description": "Many filesystems, one API.",
|
941 |
-
"keywords": [
|
942 |
-
"Cloud Files",
|
943 |
-
"WebDAV",
|
944 |
-
"aws",
|
945 |
-
"cloud",
|
946 |
-
"copy.com",
|
947 |
-
"dropbox",
|
948 |
-
"file systems",
|
949 |
-
"files",
|
950 |
-
"filesystem",
|
951 |
-
"ftp",
|
952 |
-
"rackspace",
|
953 |
-
"remote",
|
954 |
-
"s3",
|
955 |
-
"sftp",
|
956 |
-
"storage"
|
957 |
-
],
|
958 |
-
"time": "2015-01-19T19:19:07+00:00"
|
959 |
-
},
|
960 |
-
{
|
961 |
-
"name": "phpunit/php-code-coverage",
|
962 |
-
"version": "2.0.0",
|
963 |
-
"source": {
|
964 |
-
"type": "git",
|
965 |
-
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
966 |
-
"reference": "cbdd64d012c9b8c2e30850abd125001ed5db1eed"
|
967 |
-
},
|
968 |
-
"dist": {
|
969 |
-
"type": "zip",
|
970 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cbdd64d012c9b8c2e30850abd125001ed5db1eed",
|
971 |
-
"reference": "cbdd64d012c9b8c2e30850abd125001ed5db1eed",
|
972 |
-
"shasum": ""
|
973 |
-
},
|
974 |
-
"require": {
|
975 |
-
"php": ">=5.3.3",
|
976 |
-
"phpunit/php-file-iterator": "~1.3.1",
|
977 |
-
"phpunit/php-text-template": "~1.2",
|
978 |
-
"phpunit/php-token-stream": "~1.1.3",
|
979 |
-
"sebastian/environment": "~1.0",
|
980 |
-
"sebastian/version": "~1.0"
|
981 |
-
},
|
982 |
-
"require-dev": {
|
983 |
-
"ext-xdebug": ">=2.1.4",
|
984 |
-
"phpunit/phpunit": ">=4.0.0,<4.1.0"
|
985 |
-
},
|
986 |
-
"suggest": {
|
987 |
-
"ext-dom": "*",
|
988 |
-
"ext-xdebug": ">=2.2.1"
|
989 |
-
},
|
990 |
-
"type": "library",
|
991 |
-
"extra": {
|
992 |
-
"branch-alias": {
|
993 |
-
"dev-master": "2.0.x-dev"
|
994 |
-
}
|
995 |
-
},
|
996 |
-
"autoload": {
|
997 |
-
"classmap": [
|
998 |
-
"src/"
|
999 |
-
]
|
1000 |
-
},
|
1001 |
-
"notification-url": "https://packagist.org/downloads/",
|
1002 |
-
"include-path": [
|
1003 |
-
""
|
1004 |
-
],
|
1005 |
-
"license": [
|
1006 |
-
"BSD-3-Clause"
|
1007 |
-
],
|
1008 |
-
"authors": [
|
1009 |
-
{
|
1010 |
-
"name": "Sebastian Bergmann",
|
1011 |
-
"email": "sb@sebastian-bergmann.de",
|
1012 |
-
"role": "lead"
|
1013 |
-
}
|
1014 |
-
],
|
1015 |
-
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
1016 |
-
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
1017 |
-
"keywords": [
|
1018 |
-
"coverage",
|
1019 |
-
"testing",
|
1020 |
-
"xunit"
|
1021 |
-
],
|
1022 |
-
"time": "2014-03-07T06:40:32+00:00"
|
1023 |
-
},
|
1024 |
-
{
|
1025 |
-
"name": "phpunit/php-file-iterator",
|
1026 |
-
"version": "1.3.2",
|
1027 |
-
"source": {
|
1028 |
-
"type": "git",
|
1029 |
-
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
1030 |
-
"reference": "46b0610951db3a918ee7842bc0d471e72c1d0d46"
|
1031 |
-
},
|
1032 |
-
"dist": {
|
1033 |
-
"type": "zip",
|
1034 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/46b0610951db3a918ee7842bc0d471e72c1d0d46",
|
1035 |
-
"reference": "46b0610951db3a918ee7842bc0d471e72c1d0d46",
|
1036 |
-
"shasum": ""
|
1037 |
-
},
|
1038 |
-
"require": {
|
1039 |
-
"php": ">=5.2.7"
|
1040 |
-
},
|
1041 |
-
"type": "library",
|
1042 |
-
"autoload": {
|
1043 |
-
"files": [
|
1044 |
-
"File/Iterator/Autoload.php"
|
1045 |
-
]
|
1046 |
-
},
|
1047 |
-
"notification-url": "https://packagist.org/downloads/",
|
1048 |
-
"include-path": [
|
1049 |
-
""
|
1050 |
-
],
|
1051 |
-
"license": [
|
1052 |
-
"BSD-3-Clause"
|
1053 |
-
],
|
1054 |
-
"authors": [
|
1055 |
-
{
|
1056 |
-
"name": "Sebastian Bergmann",
|
1057 |
-
"email": "sb@sebastian-bergmann.de",
|
1058 |
-
"role": "lead"
|
1059 |
-
}
|
1060 |
-
],
|
1061 |
-
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
1062 |
-
"homepage": "http://www.phpunit.de/",
|
1063 |
-
"keywords": [
|
1064 |
-
"filesystem",
|
1065 |
-
"iterator"
|
1066 |
-
],
|
1067 |
-
"time": "2012-09-22T00:00:00+00:00"
|
1068 |
-
},
|
1069 |
-
{
|
1070 |
-
"name": "phpunit/php-text-template",
|
1071 |
-
"version": "1.2.0",
|
1072 |
-
"source": {
|
1073 |
-
"type": "git",
|
1074 |
-
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
1075 |
-
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
|
1076 |
-
},
|
1077 |
-
"dist": {
|
1078 |
-
"type": "zip",
|
1079 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
1080 |
-
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
1081 |
-
"shasum": ""
|
1082 |
-
},
|
1083 |
-
"require": {
|
1084 |
-
"php": ">=5.3.3"
|
1085 |
-
},
|
1086 |
-
"type": "library",
|
1087 |
-
"autoload": {
|
1088 |
-
"classmap": [
|
1089 |
-
"Text/"
|
1090 |
-
]
|
1091 |
-
},
|
1092 |
-
"notification-url": "https://packagist.org/downloads/",
|
1093 |
-
"include-path": [
|
1094 |
-
""
|
1095 |
-
],
|
1096 |
-
"license": [
|
1097 |
-
"BSD-3-Clause"
|
1098 |
-
],
|
1099 |
-
"authors": [
|
1100 |
-
{
|
1101 |
-
"name": "Sebastian Bergmann",
|
1102 |
-
"email": "sb@sebastian-bergmann.de",
|
1103 |
-
"role": "lead"
|
1104 |
-
}
|
1105 |
-
],
|
1106 |
-
"description": "Simple template engine.",
|
1107 |
-
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
1108 |
-
"keywords": [
|
1109 |
-
"template"
|
1110 |
-
],
|
1111 |
-
"time": "2014-01-30T17:20:04+00:00"
|
1112 |
-
},
|
1113 |
-
{
|
1114 |
-
"name": "phpunit/php-timer",
|
1115 |
-
"version": "1.0.3",
|
1116 |
-
"source": {
|
1117 |
-
"type": "git",
|
1118 |
-
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
1119 |
-
"reference": "5175e9bb35fc9cc430973ed83a3d62531c3c8698"
|
1120 |
-
},
|
1121 |
-
"dist": {
|
1122 |
-
"type": "zip",
|
1123 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5175e9bb35fc9cc430973ed83a3d62531c3c8698",
|
1124 |
-
"reference": "5175e9bb35fc9cc430973ed83a3d62531c3c8698",
|
1125 |
-
"shasum": ""
|
1126 |
-
},
|
1127 |
-
"require": {
|
1128 |
-
"php": ">=5.2.7"
|
1129 |
-
},
|
1130 |
-
"type": "library",
|
1131 |
-
"autoload": {
|
1132 |
-
"files": [
|
1133 |
-
"PHP/Timer/Autoload.php"
|
1134 |
-
]
|
1135 |
-
},
|
1136 |
-
"notification-url": "https://packagist.org/downloads/",
|
1137 |
-
"include-path": [
|
1138 |
-
""
|
1139 |
-
],
|
1140 |
-
"license": [
|
1141 |
-
"BSD-3-Clause"
|
1142 |
-
],
|
1143 |
-
"authors": [
|
1144 |
-
{
|
1145 |
-
"name": "Sebastian Bergmann",
|
1146 |
-
"email": "sb@sebastian-bergmann.de",
|
1147 |
-
"role": "lead"
|
1148 |
-
}
|
1149 |
-
],
|
1150 |
-
"description": "Utility class for timing",
|
1151 |
-
"homepage": "http://www.phpunit.de/",
|
1152 |
-
"keywords": [
|
1153 |
-
"timer"
|
1154 |
-
],
|
1155 |
-
"time": "2012-09-23T00:00:00+00:00"
|
1156 |
-
},
|
1157 |
-
{
|
1158 |
-
"name": "phpunit/php-token-stream",
|
1159 |
-
"version": "1.1.4",
|
1160 |
-
"source": {
|
1161 |
-
"type": "git",
|
1162 |
-
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
1163 |
-
"reference": "dd11f1b0c071dc46fe711a7dd331db1b2179b9be"
|
1164 |
-
},
|
1165 |
-
"dist": {
|
1166 |
-
"type": "zip",
|
1167 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/dd11f1b0c071dc46fe711a7dd331db1b2179b9be",
|
1168 |
-
"reference": "dd11f1b0c071dc46fe711a7dd331db1b2179b9be",
|
1169 |
-
"shasum": ""
|
1170 |
-
},
|
1171 |
-
"require": {
|
1172 |
-
"ext-tokenizer": "*",
|
1173 |
-
"php": ">=5.2.7"
|
1174 |
-
},
|
1175 |
-
"type": "library",
|
1176 |
-
"autoload": {
|
1177 |
-
"files": [
|
1178 |
-
"PHP/Token/Stream/Autoload.php"
|
1179 |
-
]
|
1180 |
-
},
|
1181 |
-
"notification-url": "https://packagist.org/downloads/",
|
1182 |
-
"include-path": [
|
1183 |
-
""
|
1184 |
-
],
|
1185 |
-
"license": [
|
1186 |
-
"BSD-3-Clause"
|
1187 |
-
],
|
1188 |
-
"authors": [
|
1189 |
-
{
|
1190 |
-
"name": "Sebastian Bergmann",
|
1191 |
-
"email": "sb@sebastian-bergmann.de",
|
1192 |
-
"role": "lead"
|
1193 |
-
}
|
1194 |
-
],
|
1195 |
-
"description": "Wrapper around PHP's tokenizer extension.",
|
1196 |
-
"homepage": "http://www.phpunit.de/",
|
1197 |
-
"keywords": [
|
1198 |
-
"tokenizer"
|
1199 |
-
],
|
1200 |
-
"time": "2012-09-23T00:00:00+00:00"
|
1201 |
-
},
|
1202 |
-
{
|
1203 |
-
"name": "phpunit/phpunit",
|
1204 |
-
"version": "4.0.0",
|
1205 |
-
"source": {
|
1206 |
-
"type": "git",
|
1207 |
-
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
1208 |
-
"reference": "b3a7c58bc39f01577f89d63da1ec578e1e993f1a"
|
1209 |
-
},
|
1210 |
-
"dist": {
|
1211 |
-
"type": "zip",
|
1212 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b3a7c58bc39f01577f89d63da1ec578e1e993f1a",
|
1213 |
-
"reference": "b3a7c58bc39f01577f89d63da1ec578e1e993f1a",
|
1214 |
-
"shasum": ""
|
1215 |
-
},
|
1216 |
-
"require": {
|
1217 |
-
"ext-dom": "*",
|
1218 |
-
"ext-pcre": "*",
|
1219 |
-
"ext-reflection": "*",
|
1220 |
-
"ext-spl": "*",
|
1221 |
-
"php": ">=5.3.3",
|
1222 |
-
"phpunit/php-code-coverage": ">=2.0.0,<2.1.0",
|
1223 |
-
"phpunit/php-file-iterator": "~1.3.1",
|
1224 |
-
"phpunit/php-text-template": "~1.2",
|
1225 |
-
"phpunit/php-timer": "~1.0.2",
|
1226 |
-
"phpunit/phpunit-mock-objects": ">=2.0.0,<2.1.0",
|
1227 |
-
"sebastian/diff": "~1.1",
|
1228 |
-
"sebastian/environment": "~1.0",
|
1229 |
-
"sebastian/exporter": "~1.0.1",
|
1230 |
-
"sebastian/version": "~1.0",
|
1231 |
-
"symfony/yaml": "~2.0"
|
1232 |
-
},
|
1233 |
-
"suggest": {
|
1234 |
-
"ext-json": "*",
|
1235 |
-
"ext-simplexml": "*",
|
1236 |
-
"ext-tokenizer": "*",
|
1237 |
-
"phpunit/php-invoker": "~1.1"
|
1238 |
-
},
|
1239 |
-
"bin": [
|
1240 |
-
"phpunit"
|
1241 |
-
],
|
1242 |
-
"type": "library",
|
1243 |
-
"extra": {
|
1244 |
-
"branch-alias": {
|
1245 |
-
"dev-master": "4.0.x-dev"
|
1246 |
-
}
|
1247 |
-
},
|
1248 |
-
"autoload": {
|
1249 |
-
"classmap": [
|
1250 |
-
"src/"
|
1251 |
-
]
|
1252 |
-
},
|
1253 |
-
"notification-url": "https://packagist.org/downloads/",
|
1254 |
-
"include-path": [
|
1255 |
-
"",
|
1256 |
-
"../../symfony/yaml/"
|
1257 |
-
],
|
1258 |
-
"license": [
|
1259 |
-
"BSD-3-Clause"
|
1260 |
-
],
|
1261 |
-
"authors": [
|
1262 |
-
{
|
1263 |
-
"name": "Sebastian Bergmann",
|
1264 |
-
"email": "sebastian@phpunit.de",
|
1265 |
-
"role": "lead"
|
1266 |
-
}
|
1267 |
-
],
|
1268 |
-
"description": "The PHP Unit Testing framework.",
|
1269 |
-
"homepage": "http://www.phpunit.de/",
|
1270 |
-
"keywords": [
|
1271 |
-
"phpunit",
|
1272 |
-
"testing",
|
1273 |
-
"xunit"
|
1274 |
-
],
|
1275 |
-
"time": "2014-03-07T07:00:44+00:00"
|
1276 |
-
},
|
1277 |
-
{
|
1278 |
-
"name": "phpunit/phpunit-mock-objects",
|
1279 |
-
"version": "2.0.0",
|
1280 |
-
"source": {
|
1281 |
-
"type": "git",
|
1282 |
-
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
1283 |
-
"reference": "f055539b22449034af4d232549c53b6cd49b9cff"
|
1284 |
-
},
|
1285 |
-
"dist": {
|
1286 |
-
"type": "zip",
|
1287 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/f055539b22449034af4d232549c53b6cd49b9cff",
|
1288 |
-
"reference": "f055539b22449034af4d232549c53b6cd49b9cff",
|
1289 |
-
"shasum": ""
|
1290 |
-
},
|
1291 |
-
"require": {
|
1292 |
-
"php": ">=5.3.3",
|
1293 |
-
"phpunit/php-text-template": "~1.2"
|
1294 |
-
},
|
1295 |
-
"require-dev": {
|
1296 |
-
"phpunit/phpunit": ">=4.0.0,<4.1.0"
|
1297 |
-
},
|
1298 |
-
"suggest": {
|
1299 |
-
"ext-soap": "*"
|
1300 |
-
},
|
1301 |
-
"type": "library",
|
1302 |
-
"extra": {
|
1303 |
-
"branch-alias": {
|
1304 |
-
"dev-master": "2.0.x-dev"
|
1305 |
-
}
|
1306 |
-
},
|
1307 |
-
"autoload": {
|
1308 |
-
"classmap": [
|
1309 |
-
"src/"
|
1310 |
-
]
|
1311 |
-
},
|
1312 |
-
"notification-url": "https://packagist.org/downloads/",
|
1313 |
-
"include-path": [
|
1314 |
-
""
|
1315 |
-
],
|
1316 |
-
"license": [
|
1317 |
-
"BSD-3-Clause"
|
1318 |
-
],
|
1319 |
-
"authors": [
|
1320 |
-
{
|
1321 |
-
"name": "Sebastian Bergmann",
|
1322 |
-
"email": "sb@sebastian-bergmann.de",
|
1323 |
-
"role": "lead"
|
1324 |
-
}
|
1325 |
-
],
|
1326 |
-
"description": "Mock Object library for PHPUnit",
|
1327 |
-
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
1328 |
-
"keywords": [
|
1329 |
-
"mock",
|
1330 |
-
"xunit"
|
1331 |
-
],
|
1332 |
-
"time": "2014-03-07T06:53:16+00:00"
|
1333 |
-
},
|
1334 |
-
{
|
1335 |
-
"name": "sebastian/diff",
|
1336 |
-
"version": "1.1.0",
|
1337 |
-
"source": {
|
1338 |
-
"type": "git",
|
1339 |
-
"url": "https://github.com/sebastianbergmann/diff.git",
|
1340 |
-
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d"
|
1341 |
-
},
|
1342 |
-
"dist": {
|
1343 |
-
"type": "zip",
|
1344 |
-
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
|
1345 |
-
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
|
1346 |
-
"shasum": ""
|
1347 |
-
},
|
1348 |
-
"require": {
|
1349 |
-
"php": ">=5.3.3"
|
1350 |
-
},
|
1351 |
-
"type": "library",
|
1352 |
-
"extra": {
|
1353 |
-
"branch-alias": {
|
1354 |
-
"dev-master": "1.1-dev"
|
1355 |
-
}
|
1356 |
-
},
|
1357 |
-
"autoload": {
|
1358 |
-
"classmap": [
|
1359 |
-
"src/"
|
1360 |
-
]
|
1361 |
-
},
|
1362 |
-
"notification-url": "https://packagist.org/downloads/",
|
1363 |
-
"license": [
|
1364 |
-
"BSD-3-Clause"
|
1365 |
-
],
|
1366 |
-
"authors": [
|
1367 |
-
{
|
1368 |
-
"name": "Sebastian Bergmann",
|
1369 |
-
"email": "sebastian@phpunit.de",
|
1370 |
-
"role": "lead"
|
1371 |
-
},
|
1372 |
-
{
|
1373 |
-
"name": "Kore Nordmann",
|
1374 |
-
"email": "mail@kore-nordmann.de"
|
1375 |
-
}
|
1376 |
-
],
|
1377 |
-
"description": "Diff implementation",
|
1378 |
-
"homepage": "http://www.github.com/sebastianbergmann/diff",
|
1379 |
-
"keywords": [
|
1380 |
-
"diff"
|
1381 |
-
],
|
1382 |
-
"time": "2013-08-03T16:46:33+00:00"
|
1383 |
-
},
|
1384 |
-
{
|
1385 |
-
"name": "sebastian/environment",
|
1386 |
-
"version": "1.0.0",
|
1387 |
-
"source": {
|
1388 |
-
"type": "git",
|
1389 |
-
"url": "https://github.com/sebastianbergmann/environment.git",
|
1390 |
-
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a"
|
1391 |
-
},
|
1392 |
-
"dist": {
|
1393 |
-
"type": "zip",
|
1394 |
-
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a",
|
1395 |
-
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a",
|
1396 |
-
"shasum": ""
|
1397 |
-
},
|
1398 |
-
"require": {
|
1399 |
-
"php": ">=5.3.3"
|
1400 |
-
},
|
1401 |
-
"require-dev": {
|
1402 |
-
"phpunit/phpunit": "4.0.*@dev"
|
1403 |
-
},
|
1404 |
-
"type": "library",
|
1405 |
-
"extra": {
|
1406 |
-
"branch-alias": {
|
1407 |
-
"dev-master": "1.0.x-dev"
|
1408 |
-
}
|
1409 |
-
},
|
1410 |
-
"autoload": {
|
1411 |
-
"classmap": [
|
1412 |
-
"src/"
|
1413 |
-
]
|
1414 |
-
},
|
1415 |
-
"notification-url": "https://packagist.org/downloads/",
|
1416 |
-
"license": [
|
1417 |
-
"BSD-3-Clause"
|
1418 |
-
],
|
1419 |
-
"authors": [
|
1420 |
-
{
|
1421 |
-
"name": "Sebastian Bergmann",
|
1422 |
-
"email": "sebastian@phpunit.de",
|
1423 |
-
"role": "lead"
|
1424 |
-
}
|
1425 |
-
],
|
1426 |
-
"description": "Provides functionality to handle HHVM/PHP environments",
|
1427 |
-
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
1428 |
-
"keywords": [
|
1429 |
-
"Xdebug",
|
1430 |
-
"environment",
|
1431 |
-
"hhvm"
|
1432 |
-
],
|
1433 |
-
"time": "2014-02-18T16:17:19+00:00"
|
1434 |
-
},
|
1435 |
-
{
|
1436 |
-
"name": "sebastian/exporter",
|
1437 |
-
"version": "1.0.1",
|
1438 |
-
"source": {
|
1439 |
-
"type": "git",
|
1440 |
-
"url": "https://github.com/sebastianbergmann/exporter.git",
|
1441 |
-
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529"
|
1442 |
-
},
|
1443 |
-
"dist": {
|
1444 |
-
"type": "zip",
|
1445 |
-
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
|
1446 |
-
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
|
1447 |
-
"shasum": ""
|
1448 |
-
},
|
1449 |
-
"require": {
|
1450 |
-
"php": ">=5.3.3"
|
1451 |
-
},
|
1452 |
-
"require-dev": {
|
1453 |
-
"phpunit/phpunit": "4.0.*@dev"
|
1454 |
-
},
|
1455 |
-
"type": "library",
|
1456 |
-
"extra": {
|
1457 |
-
"branch-alias": {
|
1458 |
-
"dev-master": "1.0.x-dev"
|
1459 |
-
}
|
1460 |
-
},
|
1461 |
-
"autoload": {
|
1462 |
-
"classmap": [
|
1463 |
-
"src/"
|
1464 |
-
]
|
1465 |
-
},
|
1466 |
-
"notification-url": "https://packagist.org/downloads/",
|
1467 |
-
"license": [
|
1468 |
-
"BSD-3-Clause"
|
1469 |
-
],
|
1470 |
-
"authors": [
|
1471 |
-
{
|
1472 |
-
"name": "Sebastian Bergmann",
|
1473 |
-
"email": "sebastian@phpunit.de",
|
1474 |
-
"role": "lead"
|
1475 |
-
},
|
1476 |
-
{
|
1477 |
-
"name": "Jeff Welch",
|
1478 |
-
"email": "whatthejeff@gmail.com"
|
1479 |
-
},
|
1480 |
-
{
|
1481 |
-
"name": "Volker Dusch",
|
1482 |
-
"email": "github@wallbash.com"
|
1483 |
-
},
|
1484 |
-
{
|
1485 |
-
"name": "Adam Harvey",
|
1486 |
-
"email": "aharvey@php.net",
|
1487 |
-
"role": "Lead"
|
1488 |
-
},
|
1489 |
-
{
|
1490 |
-
"name": "Bernhard Schussek",
|
1491 |
-
"email": "bschussek@2bepublished.at"
|
1492 |
-
}
|
1493 |
-
],
|
1494 |
-
"description": "Provides the functionality to export PHP variables for visualization",
|
1495 |
-
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
1496 |
-
"keywords": [
|
1497 |
-
"export",
|
1498 |
-
"exporter"
|
1499 |
-
],
|
1500 |
-
"time": "2014-02-16T08:26:31+00:00"
|
1501 |
-
},
|
1502 |
-
{
|
1503 |
-
"name": "sebastian/version",
|
1504 |
-
"version": "1.0.0",
|
1505 |
-
"source": {
|
1506 |
-
"type": "git",
|
1507 |
-
"url": "https://github.com/sebastianbergmann/version.git",
|
1508 |
-
"reference": "16b021aed448b654ae05846e394e057e9a6f04cb"
|
1509 |
-
},
|
1510 |
-
"dist": {
|
1511 |
-
"type": "zip",
|
1512 |
-
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/16b021aed448b654ae05846e394e057e9a6f04cb",
|
1513 |
-
"reference": "16b021aed448b654ae05846e394e057e9a6f04cb",
|
1514 |
-
"shasum": ""
|
1515 |
-
},
|
1516 |
-
"type": "library",
|
1517 |
-
"autoload": {
|
1518 |
-
"classmap": [
|
1519 |
-
"src/"
|
1520 |
-
]
|
1521 |
-
},
|
1522 |
-
"notification-url": "https://packagist.org/downloads/",
|
1523 |
-
"license": [
|
1524 |
-
"BSD-3-Clause"
|
1525 |
-
],
|
1526 |
-
"authors": [
|
1527 |
-
{
|
1528 |
-
"name": "Sebastian Bergmann",
|
1529 |
-
"email": "sebastian@phpunit.de",
|
1530 |
-
"role": "lead"
|
1531 |
-
}
|
1532 |
-
],
|
1533 |
-
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1534 |
-
"homepage": "https://github.com/sebastianbergmann/version",
|
1535 |
-
"time": "2013-01-05T14:27:32+00:00"
|
1536 |
-
},
|
1537 |
-
{
|
1538 |
-
"name": "squizlabs/php_codesniffer",
|
1539 |
-
"version": "2.3.0",
|
1540 |
-
"source": {
|
1541 |
-
"type": "git",
|
1542 |
-
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1543 |
-
"reference": "5046b0e01c416fc2b06df961d0673c85bcdc896c"
|
1544 |
-
},
|
1545 |
-
"dist": {
|
1546 |
-
"type": "zip",
|
1547 |
-
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5046b0e01c416fc2b06df961d0673c85bcdc896c",
|
1548 |
-
"reference": "5046b0e01c416fc2b06df961d0673c85bcdc896c",
|
1549 |
-
"shasum": ""
|
1550 |
-
},
|
1551 |
-
"require": {
|
1552 |
-
"ext-tokenizer": "*",
|
1553 |
-
"ext-xmlwriter": "*",
|
1554 |
-
"php": ">=5.1.2"
|
1555 |
-
},
|
1556 |
-
"bin": [
|
1557 |
-
"scripts/phpcs",
|
1558 |
-
"scripts/phpcbf"
|
1559 |
-
],
|
1560 |
-
"type": "library",
|
1561 |
-
"extra": {
|
1562 |
-
"branch-alias": {
|
1563 |
-
"dev-master": "2.0.x-dev"
|
1564 |
-
}
|
1565 |
-
},
|
1566 |
-
"autoload": {
|
1567 |
-
"classmap": [
|
1568 |
-
"CodeSniffer.php",
|
1569 |
-
"CodeSniffer/CLI.php",
|
1570 |
-
"CodeSniffer/Exception.php",
|
1571 |
-
"CodeSniffer/File.php",
|
1572 |
-
"CodeSniffer/Fixer.php",
|
1573 |
-
"CodeSniffer/Report.php",
|
1574 |
-
"CodeSniffer/Reporting.php",
|
1575 |
-
"CodeSniffer/Sniff.php",
|
1576 |
-
"CodeSniffer/Tokens.php",
|
1577 |
-
"CodeSniffer/Reports/",
|
1578 |
-
"CodeSniffer/Tokenizers/",
|
1579 |
-
"CodeSniffer/DocGenerators/",
|
1580 |
-
"CodeSniffer/Standards/AbstractPatternSniff.php",
|
1581 |
-
"CodeSniffer/Standards/AbstractScopeSniff.php",
|
1582 |
-
"CodeSniffer/Standards/AbstractVariableSniff.php",
|
1583 |
-
"CodeSniffer/Standards/IncorrectPatternException.php",
|
1584 |
-
"CodeSniffer/Standards/Generic/Sniffs/",
|
1585 |
-
"CodeSniffer/Standards/MySource/Sniffs/",
|
1586 |
-
"CodeSniffer/Standards/PEAR/Sniffs/",
|
1587 |
-
"CodeSniffer/Standards/PSR1/Sniffs/",
|
1588 |
-
"CodeSniffer/Standards/PSR2/Sniffs/",
|
1589 |
-
"CodeSniffer/Standards/Squiz/Sniffs/",
|
1590 |
-
"CodeSniffer/Standards/Zend/Sniffs/"
|
1591 |
-
]
|
1592 |
-
},
|
1593 |
-
"notification-url": "https://packagist.org/downloads/",
|
1594 |
-
"license": [
|
1595 |
-
"BSD-3-Clause"
|
1596 |
-
],
|
1597 |
-
"authors": [
|
1598 |
-
{
|
1599 |
-
"name": "Greg Sherwood",
|
1600 |
-
"role": "lead"
|
1601 |
-
}
|
1602 |
-
],
|
1603 |
-
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
1604 |
-
"homepage": "http://www.squizlabs.com/php-codesniffer",
|
1605 |
-
"keywords": [
|
1606 |
-
"phpcs",
|
1607 |
-
"standards"
|
1608 |
-
],
|
1609 |
-
"time": "2015-03-04T02:07:03+00:00"
|
1610 |
-
},
|
1611 |
-
{
|
1612 |
-
"name": "symfony/css-selector",
|
1613 |
-
"version": "v2.1.0",
|
1614 |
-
"target-dir": "Symfony/Component/CssSelector",
|
1615 |
-
"source": {
|
1616 |
-
"type": "git",
|
1617 |
-
"url": "https://github.com/symfony/css-selector.git",
|
1618 |
-
"reference": "676a7fd9b5027da85b58dd11db5561fef01c6271"
|
1619 |
-
},
|
1620 |
-
"dist": {
|
1621 |
-
"type": "zip",
|
1622 |
-
"url": "https://api.github.com/repos/symfony/css-selector/zipball/676a7fd9b5027da85b58dd11db5561fef01c6271",
|
1623 |
-
"reference": "676a7fd9b5027da85b58dd11db5561fef01c6271",
|
1624 |
-
"shasum": ""
|
1625 |
-
},
|
1626 |
-
"require": {
|
1627 |
-
"php": ">=5.3.3"
|
1628 |
-
},
|
1629 |
-
"type": "library",
|
1630 |
-
"extra": {
|
1631 |
-
"branch-alias": {
|
1632 |
-
"dev-master": "2.1-dev"
|
1633 |
-
}
|
1634 |
-
},
|
1635 |
-
"autoload": {
|
1636 |
-
"psr-0": {
|
1637 |
-
"Symfony\\Component\\CssSelector": ""
|
1638 |
-
}
|
1639 |
-
},
|
1640 |
-
"notification-url": "https://packagist.org/downloads/",
|
1641 |
-
"license": [
|
1642 |
-
"MIT"
|
1643 |
-
],
|
1644 |
-
"authors": [
|
1645 |
-
{
|
1646 |
-
"name": "Symfony Community",
|
1647 |
-
"homepage": "http://symfony.com/contributors"
|
1648 |
-
},
|
1649 |
-
{
|
1650 |
-
"name": "Fabien Potencier",
|
1651 |
-
"email": "fabien@symfony.com"
|
1652 |
-
}
|
1653 |
-
],
|
1654 |
-
"description": "Symfony CssSelector Component",
|
1655 |
-
"homepage": "http://symfony.com",
|
1656 |
-
"time": "2012-08-22T13:48:41+00:00"
|
1657 |
-
},
|
1658 |
-
{
|
1659 |
-
"name": "symfony/dom-crawler",
|
1660 |
-
"version": "v2.1.0",
|
1661 |
-
"target-dir": "Symfony/Component/DomCrawler",
|
1662 |
-
"source": {
|
1663 |
-
"type": "git",
|
1664 |
-
"url": "https://github.com/symfony/dom-crawler.git",
|
1665 |
-
"reference": "4a2af1b8f83341b637e47a66c6b6798730038edc"
|
1666 |
-
},
|
1667 |
-
"dist": {
|
1668 |
-
"type": "zip",
|
1669 |
-
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4a2af1b8f83341b637e47a66c6b6798730038edc",
|
1670 |
-
"reference": "4a2af1b8f83341b637e47a66c6b6798730038edc",
|
1671 |
-
"shasum": ""
|
1672 |
-
},
|
1673 |
-
"require": {
|
1674 |
-
"php": ">=5.3.3"
|
1675 |
-
},
|
1676 |
-
"require-dev": {
|
1677 |
-
"symfony/css-selector": "2.1.*"
|
1678 |
-
},
|
1679 |
-
"suggest": {
|
1680 |
-
"symfony/css-selector": "v2.1.0"
|
1681 |
-
},
|
1682 |
-
"type": "library",
|
1683 |
-
"extra": {
|
1684 |
-
"branch-alias": {
|
1685 |
-
"dev-master": "2.1-dev"
|
1686 |
-
}
|
1687 |
-
},
|
1688 |
-
"autoload": {
|
1689 |
-
"psr-0": {
|
1690 |
-
"Symfony\\Component\\DomCrawler": ""
|
1691 |
-
}
|
1692 |
-
},
|
1693 |
-
"notification-url": "https://packagist.org/downloads/",
|
1694 |
-
"license": [
|
1695 |
-
"MIT"
|
1696 |
-
],
|
1697 |
-
"authors": [
|
1698 |
-
{
|
1699 |
-
"name": "Symfony Community",
|
1700 |
-
"homepage": "http://symfony.com/contributors"
|
1701 |
-
},
|
1702 |
-
{
|
1703 |
-
"name": "Fabien Potencier",
|
1704 |
-
"email": "fabien@symfony.com"
|
1705 |
-
}
|
1706 |
-
],
|
1707 |
-
"description": "Symfony DomCrawler Component",
|
1708 |
-
"homepage": "http://symfony.com",
|
1709 |
-
"time": "2012-08-28T07:54:42+00:00"
|
1710 |
-
},
|
1711 |
-
{
|
1712 |
-
"name": "symfony/yaml",
|
1713 |
-
"version": "2.0.4",
|
1714 |
-
"source": {
|
1715 |
-
"type": "git",
|
1716 |
-
"url": "https://github.com/symfony/yaml.git",
|
1717 |
-
"reference": "e60c0d68640e662e88d879f0df139e022335a92a"
|
1718 |
-
},
|
1719 |
-
"dist": {
|
1720 |
-
"type": "zip",
|
1721 |
-
"url": "https://api.github.com/repos/symfony/yaml/zipball/e60c0d68640e662e88d879f0df139e022335a92a",
|
1722 |
-
"reference": "e60c0d68640e662e88d879f0df139e022335a92a",
|
1723 |
-
"shasum": ""
|
1724 |
-
},
|
1725 |
-
"require": {
|
1726 |
-
"php": ">=5.3.2"
|
1727 |
-
},
|
1728 |
-
"type": "library",
|
1729 |
-
"notification-url": "https://packagist.org/downloads/",
|
1730 |
-
"license": [
|
1731 |
-
"MIT"
|
1732 |
-
],
|
1733 |
-
"authors": [
|
1734 |
-
{
|
1735 |
-
"name": "Symfony Community",
|
1736 |
-
"homepage": "http://symfony.com/contributors"
|
1737 |
-
},
|
1738 |
-
{
|
1739 |
-
"name": "Fabien Potencier",
|
1740 |
-
"email": "fabien@symfony.com"
|
1741 |
-
}
|
1742 |
-
],
|
1743 |
-
"description": "Symfony Yaml Component",
|
1744 |
-
"homepage": "http://symfony.com",
|
1745 |
-
"time": "2011-09-26T22:55:43+00:00"
|
1746 |
-
}
|
1747 |
-
],
|
1748 |
-
"aliases": [],
|
1749 |
-
"minimum-stability": "stable",
|
1750 |
-
"stability-flags": [],
|
1751 |
-
"prefer-stable": false,
|
1752 |
-
"prefer-lowest": true,
|
1753 |
-
"platform": {
|
1754 |
-
"php": ">=5.4"
|
1755 |
-
},
|
1756 |
-
"platform-dev": []
|
1757 |
-
}
|
1 |
+
{
|
2 |
+
"_readme": [
|
3 |
+
"This file locks the dependencies of your project to a known state",
|
4 |
+
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
5 |
+
"This file is @generated automatically"
|
6 |
+
],
|
7 |
+
"content-hash": "23b0abc9b27af814f8b9ede0c901191b",
|
8 |
+
"packages": [
|
9 |
+
{
|
10 |
+
"name": "firebase/php-jwt",
|
11 |
+
"version": "2.0.0",
|
12 |
+
"target-dir": "Firebase/PHP-JWT",
|
13 |
+
"source": {
|
14 |
+
"type": "git",
|
15 |
+
"url": "https://github.com/firebase/php-jwt.git",
|
16 |
+
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57"
|
17 |
+
},
|
18 |
+
"dist": {
|
19 |
+
"type": "zip",
|
20 |
+
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
21 |
+
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
22 |
+
"shasum": ""
|
23 |
+
},
|
24 |
+
"require": {
|
25 |
+
"php": ">=5.2.0"
|
26 |
+
},
|
27 |
+
"type": "library",
|
28 |
+
"autoload": {
|
29 |
+
"classmap": [
|
30 |
+
"Authentication/",
|
31 |
+
"Exceptions/"
|
32 |
+
]
|
33 |
+
},
|
34 |
+
"notification-url": "https://packagist.org/downloads/",
|
35 |
+
"license": [
|
36 |
+
"BSD-3-Clause"
|
37 |
+
],
|
38 |
+
"authors": [
|
39 |
+
{
|
40 |
+
"name": "Neuman Vong",
|
41 |
+
"email": "neuman+pear@twilio.com",
|
42 |
+
"role": "Developer"
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"name": "Anant Narayanan",
|
46 |
+
"email": "anant@php.net",
|
47 |
+
"role": "Developer"
|
48 |
+
}
|
49 |
+
],
|
50 |
+
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
51 |
+
"homepage": "https://github.com/firebase/php-jwt",
|
52 |
+
"time": "2015-04-01T18:46:38+00:00"
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"name": "google/apiclient-services",
|
56 |
+
"version": "v0.13",
|
57 |
+
"source": {
|
58 |
+
"type": "git",
|
59 |
+
"url": "https://github.com/google/google-api-php-client-services.git",
|
60 |
+
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171"
|
61 |
+
},
|
62 |
+
"dist": {
|
63 |
+
"type": "zip",
|
64 |
+
"url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/0805897f3435f9eea73ce21da9d55f51c69c1171",
|
65 |
+
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171",
|
66 |
+
"shasum": ""
|
67 |
+
},
|
68 |
+
"require": {
|
69 |
+
"php": ">=5.4"
|
70 |
+
},
|
71 |
+
"require-dev": {
|
72 |
+
"phpunit/phpunit": "~4.8"
|
73 |
+
},
|
74 |
+
"type": "library",
|
75 |
+
"autoload": {
|
76 |
+
"psr-0": {
|
77 |
+
"Google_Service_": "src"
|
78 |
+
}
|
79 |
+
},
|
80 |
+
"notification-url": "https://packagist.org/downloads/",
|
81 |
+
"license": [
|
82 |
+
"Apache-2.0"
|
83 |
+
],
|
84 |
+
"description": "Client library for Google APIs",
|
85 |
+
"homepage": "http://developers.google.com/api-client-library/php",
|
86 |
+
"keywords": [
|
87 |
+
"google"
|
88 |
+
],
|
89 |
+
"time": "2017-07-07T16:01:27+00:00"
|
90 |
+
},
|
91 |
+
{
|
92 |
+
"name": "google/auth",
|
93 |
+
"version": "v1.0",
|
94 |
+
"source": {
|
95 |
+
"type": "git",
|
96 |
+
"url": "https://github.com/google/google-auth-library-php.git",
|
97 |
+
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df"
|
98 |
+
},
|
99 |
+
"dist": {
|
100 |
+
"type": "zip",
|
101 |
+
"url": "https://api.github.com/repos/google/google-auth-library-php/zipball/db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
102 |
+
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
103 |
+
"shasum": ""
|
104 |
+
},
|
105 |
+
"require": {
|
106 |
+
"firebase/php-jwt": "~2.0|~3.0|~4.0",
|
107 |
+
"guzzlehttp/guzzle": "~5.3.1|~6.0",
|
108 |
+
"guzzlehttp/psr7": "~1.2",
|
109 |
+
"php": ">=5.4",
|
110 |
+
"psr/cache": "^1.0",
|
111 |
+
"psr/http-message": "^1.0"
|
112 |
+
},
|
113 |
+
"require-dev": {
|
114 |
+
"friendsofphp/php-cs-fixer": "^1.11",
|
115 |
+
"phpunit/phpunit": "3.7.*"
|
116 |
+
},
|
117 |
+
"type": "library",
|
118 |
+
"autoload": {
|
119 |
+
"classmap": [
|
120 |
+
"src/"
|
121 |
+
],
|
122 |
+
"psr-4": {
|
123 |
+
"Google\\Auth\\": "src"
|
124 |
+
}
|
125 |
+
},
|
126 |
+
"notification-url": "https://packagist.org/downloads/",
|
127 |
+
"license": [
|
128 |
+
"Apache-2.0"
|
129 |
+
],
|
130 |
+
"description": "Google Auth Library for PHP",
|
131 |
+
"homepage": "http://github.com/google/google-auth-library-php",
|
132 |
+
"keywords": [
|
133 |
+
"Authentication",
|
134 |
+
"google",
|
135 |
+
"oauth2"
|
136 |
+
],
|
137 |
+
"time": "2017-06-13T18:00:07+00:00"
|
138 |
+
},
|
139 |
+
{
|
140 |
+
"name": "guzzlehttp/guzzle",
|
141 |
+
"version": "5.3.1",
|
142 |
+
"source": {
|
143 |
+
"type": "git",
|
144 |
+
"url": "https://github.com/guzzle/guzzle.git",
|
145 |
+
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8"
|
146 |
+
},
|
147 |
+
"dist": {
|
148 |
+
"type": "zip",
|
149 |
+
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
150 |
+
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
151 |
+
"shasum": ""
|
152 |
+
},
|
153 |
+
"require": {
|
154 |
+
"guzzlehttp/ringphp": "^1.1",
|
155 |
+
"php": ">=5.4.0"
|
156 |
+
},
|
157 |
+
"require-dev": {
|
158 |
+
"ext-curl": "*",
|
159 |
+
"phpunit/phpunit": "^4.0"
|
160 |
+
},
|
161 |
+
"type": "library",
|
162 |
+
"autoload": {
|
163 |
+
"psr-4": {
|
164 |
+
"GuzzleHttp\\": "src/"
|
165 |
+
}
|
166 |
+
},
|
167 |
+
"notification-url": "https://packagist.org/downloads/",
|
168 |
+
"license": [
|
169 |
+
"MIT"
|
170 |
+
],
|
171 |
+
"authors": [
|
172 |
+
{
|
173 |
+
"name": "Michael Dowling",
|
174 |
+
"email": "mtdowling@gmail.com",
|
175 |
+
"homepage": "https://github.com/mtdowling"
|
176 |
+
}
|
177 |
+
],
|
178 |
+
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
179 |
+
"homepage": "http://guzzlephp.org/",
|
180 |
+
"keywords": [
|
181 |
+
"client",
|
182 |
+
"curl",
|
183 |
+
"framework",
|
184 |
+
"http",
|
185 |
+
"http client",
|
186 |
+
"rest",
|
187 |
+
"web service"
|
188 |
+
],
|
189 |
+
"time": "2016-07-15T19:28:39+00:00"
|
190 |
+
},
|
191 |
+
{
|
192 |
+
"name": "guzzlehttp/psr7",
|
193 |
+
"version": "1.2.0",
|
194 |
+
"source": {
|
195 |
+
"type": "git",
|
196 |
+
"url": "https://github.com/guzzle/psr7.git",
|
197 |
+
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e"
|
198 |
+
},
|
199 |
+
"dist": {
|
200 |
+
"type": "zip",
|
201 |
+
"url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
202 |
+
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
203 |
+
"shasum": ""
|
204 |
+
},
|
205 |
+
"require": {
|
206 |
+
"php": ">=5.4.0",
|
207 |
+
"psr/http-message": "~1.0"
|
208 |
+
},
|
209 |
+
"provide": {
|
210 |
+
"psr/http-message-implementation": "1.0"
|
211 |
+
},
|
212 |
+
"require-dev": {
|
213 |
+
"phpunit/phpunit": "~4.0"
|
214 |
+
},
|
215 |
+
"type": "library",
|
216 |
+
"extra": {
|
217 |
+
"branch-alias": {
|
218 |
+
"dev-master": "1.0-dev"
|
219 |
+
}
|
220 |
+
},
|
221 |
+
"autoload": {
|
222 |
+
"psr-4": {
|
223 |
+
"GuzzleHttp\\Psr7\\": "src/"
|
224 |
+
},
|
225 |
+
"files": [
|
226 |
+
"src/functions_include.php"
|
227 |
+
]
|
228 |
+
},
|
229 |
+
"notification-url": "https://packagist.org/downloads/",
|
230 |
+
"license": [
|
231 |
+
"MIT"
|
232 |
+
],
|
233 |
+
"authors": [
|
234 |
+
{
|
235 |
+
"name": "Michael Dowling",
|
236 |
+
"email": "mtdowling@gmail.com",
|
237 |
+
"homepage": "https://github.com/mtdowling"
|
238 |
+
}
|
239 |
+
],
|
240 |
+
"description": "PSR-7 message implementation",
|
241 |
+
"keywords": [
|
242 |
+
"http",
|
243 |
+
"message",
|
244 |
+
"stream",
|
245 |
+
"uri"
|
246 |
+
],
|
247 |
+
"time": "2015-08-15T19:32:36+00:00"
|
248 |
+
},
|
249 |
+
{
|
250 |
+
"name": "guzzlehttp/ringphp",
|
251 |
+
"version": "1.1.0",
|
252 |
+
"source": {
|
253 |
+
"type": "git",
|
254 |
+
"url": "https://github.com/guzzle/RingPHP.git",
|
255 |
+
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
|
256 |
+
},
|
257 |
+
"dist": {
|
258 |
+
"type": "zip",
|
259 |
+
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
260 |
+
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
261 |
+
"shasum": ""
|
262 |
+
},
|
263 |
+
"require": {
|
264 |
+
"guzzlehttp/streams": "~3.0",
|
265 |
+
"php": ">=5.4.0",
|
266 |
+
"react/promise": "~2.0"
|
267 |
+
},
|
268 |
+
"require-dev": {
|
269 |
+
"ext-curl": "*",
|
270 |
+
"phpunit/phpunit": "~4.0"
|
271 |
+
},
|
272 |
+
"suggest": {
|
273 |
+
"ext-curl": "Guzzle will use specific adapters if cURL is present"
|
274 |
+
},
|
275 |
+
"type": "library",
|
276 |
+
"extra": {
|
277 |
+
"branch-alias": {
|
278 |
+
"dev-master": "1.1-dev"
|
279 |
+
}
|
280 |
+
},
|
281 |
+
"autoload": {
|
282 |
+
"psr-4": {
|
283 |
+
"GuzzleHttp\\Ring\\": "src/"
|
284 |
+
}
|
285 |
+
},
|
286 |
+
"notification-url": "https://packagist.org/downloads/",
|
287 |
+
"license": [
|
288 |
+
"MIT"
|
289 |
+
],
|
290 |
+
"authors": [
|
291 |
+
{
|
292 |
+
"name": "Michael Dowling",
|
293 |
+
"email": "mtdowling@gmail.com",
|
294 |
+
"homepage": "https://github.com/mtdowling"
|
295 |
+
}
|
296 |
+
],
|
297 |
+
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
|
298 |
+
"time": "2015-05-20T03:37:09+00:00"
|
299 |
+
},
|
300 |
+
{
|
301 |
+
"name": "guzzlehttp/streams",
|
302 |
+
"version": "3.0.0",
|
303 |
+
"source": {
|
304 |
+
"type": "git",
|
305 |
+
"url": "https://github.com/guzzle/streams.git",
|
306 |
+
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
|
307 |
+
},
|
308 |
+
"dist": {
|
309 |
+
"type": "zip",
|
310 |
+
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
311 |
+
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
312 |
+
"shasum": ""
|
313 |
+
},
|
314 |
+
"require": {
|
315 |
+
"php": ">=5.4.0"
|
316 |
+
},
|
317 |
+
"require-dev": {
|
318 |
+
"phpunit/phpunit": "~4.0"
|
319 |
+
},
|
320 |
+
"type": "library",
|
321 |
+
"extra": {
|
322 |
+
"branch-alias": {
|
323 |
+
"dev-master": "3.0-dev"
|
324 |
+
}
|
325 |
+
},
|
326 |
+
"autoload": {
|
327 |
+
"psr-4": {
|
328 |
+
"GuzzleHttp\\Stream\\": "src/"
|
329 |
+
}
|
330 |
+
},
|
331 |
+
"notification-url": "https://packagist.org/downloads/",
|
332 |
+
"license": [
|
333 |
+
"MIT"
|
334 |
+
],
|
335 |
+
"authors": [
|
336 |
+
{
|
337 |
+
"name": "Michael Dowling",
|
338 |
+
"email": "mtdowling@gmail.com",
|
339 |
+
"homepage": "https://github.com/mtdowling"
|
340 |
+
}
|
341 |
+
],
|
342 |
+
"description": "Provides a simple abstraction over streams of data",
|
343 |
+
"homepage": "http://guzzlephp.org/",
|
344 |
+
"keywords": [
|
345 |
+
"Guzzle",
|
346 |
+
"stream"
|
347 |
+
],
|
348 |
+
"time": "2014-10-12T19:18:40+00:00"
|
349 |
+
},
|
350 |
+
{
|
351 |
+
"name": "monolog/monolog",
|
352 |
+
"version": "1.17.0",
|
353 |
+
"source": {
|
354 |
+
"type": "git",
|
355 |
+
"url": "https://github.com/Seldaek/monolog.git",
|
356 |
+
"reference": "877ae631713cc961952df713ae785735b90df682"
|
357 |
+
},
|
358 |
+
"dist": {
|
359 |
+
"type": "zip",
|
360 |
+
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/877ae631713cc961952df713ae785735b90df682",
|
361 |
+
"reference": "877ae631713cc961952df713ae785735b90df682",
|
362 |
+
"shasum": ""
|
363 |
+
},
|
364 |
+
"require": {
|
365 |
+
"php": ">=5.3.0",
|
366 |
+
"psr/log": "~1.0"
|
367 |
+
},
|
368 |
+
"provide": {
|
369 |
+
"psr/log-implementation": "1.0.0"
|
370 |
+
},
|
371 |
+
"require-dev": {
|
372 |
+
"aws/aws-sdk-php": "^2.4.9",
|
373 |
+
"doctrine/couchdb": "~1.0@dev",
|
374 |
+
"graylog2/gelf-php": "~1.0",
|
375 |
+
"php-console/php-console": "^3.1.3",
|
376 |
+
"phpunit/phpunit": "~4.5",
|
377 |
+
"phpunit/phpunit-mock-objects": "2.3.0",
|
378 |
+
"raven/raven": "~0.11",
|
379 |
+
"ruflin/elastica": ">=0.90 <3.0",
|
380 |
+
"swiftmailer/swiftmailer": "~5.3",
|
381 |
+
"videlalvaro/php-amqplib": "~2.4"
|
382 |
+
},
|
383 |
+
"suggest": {
|
384 |
+
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
385 |
+
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
386 |
+
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
387 |
+
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
388 |
+
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
389 |
+
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
390 |
+
"raven/raven": "Allow sending log messages to a Sentry server",
|
391 |
+
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
392 |
+
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
393 |
+
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
|
394 |
+
},
|
395 |
+
"type": "library",
|
396 |
+
"extra": {
|
397 |
+
"branch-alias": {
|
398 |
+
"dev-master": "1.16.x-dev"
|
399 |
+
}
|
400 |
+
},
|
401 |
+
"autoload": {
|
402 |
+
"psr-4": {
|
403 |
+
"Monolog\\": "src/Monolog"
|
404 |
+
}
|
405 |
+
},
|
406 |
+
"notification-url": "https://packagist.org/downloads/",
|
407 |
+
"license": [
|
408 |
+
"MIT"
|
409 |
+
],
|
410 |
+
"authors": [
|
411 |
+
{
|
412 |
+
"name": "Jordi Boggiano",
|
413 |
+
"email": "j.boggiano@seld.be",
|
414 |
+
"homepage": "http://seld.be"
|
415 |
+
}
|
416 |
+
],
|
417 |
+
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
418 |
+
"homepage": "http://github.com/Seldaek/monolog",
|
419 |
+
"keywords": [
|
420 |
+
"log",
|
421 |
+
"logging",
|
422 |
+
"psr-3"
|
423 |
+
],
|
424 |
+
"time": "2015-08-30T11:40:25+00:00"
|
425 |
+
},
|
426 |
+
{
|
427 |
+
"name": "phpseclib/phpseclib",
|
428 |
+
"version": "0.3.10",
|
429 |
+
"source": {
|
430 |
+
"type": "git",
|
431 |
+
"url": "https://github.com/phpseclib/phpseclib.git",
|
432 |
+
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
|
433 |
+
},
|
434 |
+
"dist": {
|
435 |
+
"type": "zip",
|
436 |
+
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
437 |
+
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
438 |
+
"shasum": ""
|
439 |
+
},
|
440 |
+
"require": {
|
441 |
+
"php": ">=5.0.0"
|
442 |
+
},
|
443 |
+
"require-dev": {
|
444 |
+
"phing/phing": "~2.7",
|
445 |
+
"phpunit/phpunit": "~4.0",
|
446 |
+
"sami/sami": "~2.0",
|
447 |
+
"squizlabs/php_codesniffer": "~1.5"
|
448 |
+
},
|
449 |
+
"suggest": {
|
450 |
+
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
|
451 |
+
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.",
|
452 |
+
"pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3."
|
453 |
+
},
|
454 |
+
"type": "library",
|
455 |
+
"extra": {
|
456 |
+
"branch-alias": {
|
457 |
+
"dev-master": "0.3-dev"
|
458 |
+
}
|
459 |
+
},
|
460 |
+
"autoload": {
|
461 |
+
"psr-0": {
|
462 |
+
"Crypt": "phpseclib/",
|
463 |
+
"File": "phpseclib/",
|
464 |
+
"Math": "phpseclib/",
|
465 |
+
"Net": "phpseclib/",
|
466 |
+
"System": "phpseclib/"
|
467 |
+
},
|
468 |
+
"files": [
|
469 |
+
"phpseclib/Crypt/Random.php"
|
470 |
+
]
|
471 |
+
},
|
472 |
+
"notification-url": "https://packagist.org/downloads/",
|
473 |
+
"include-path": [
|
474 |
+
"phpseclib/"
|
475 |
+
],
|
476 |
+
"license": [
|
477 |
+
"MIT"
|
478 |
+
],
|
479 |
+
"authors": [
|
480 |
+
{
|
481 |
+
"name": "Jim Wigginton",
|
482 |
+
"email": "terrafrost@php.net",
|
483 |
+
"role": "Lead Developer"
|
484 |
+
},
|
485 |
+
{
|
486 |
+
"name": "Patrick Monnerat",
|
487 |
+
"email": "pm@datasphere.ch",
|
488 |
+
"role": "Developer"
|
489 |
+
},
|
490 |
+
{
|
491 |
+
"name": "Andreas Fischer",
|
492 |
+
"email": "bantu@phpbb.com",
|
493 |
+
"role": "Developer"
|
494 |
+
},
|
495 |
+
{
|
496 |
+
"name": "Hans-Jürgen Petrich",
|
497 |
+
"email": "petrich@tronic-media.com",
|
498 |
+
"role": "Developer"
|
499 |
+
}
|
500 |
+
],
|
501 |
+
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
|
502 |
+
"homepage": "http://phpseclib.sourceforge.net",
|
503 |
+
"keywords": [
|
504 |
+
"BigInteger",
|
505 |
+
"aes",
|
506 |
+
"asn.1",
|
507 |
+
"asn1",
|
508 |
+
"blowfish",
|
509 |
+
"crypto",
|
510 |
+
"cryptography",
|
511 |
+
"encryption",
|
512 |
+
"rsa",
|
513 |
+
"security",
|
514 |
+
"sftp",
|
515 |
+
"signature",
|
516 |
+
"signing",
|
517 |
+
"ssh",
|
518 |
+
"twofish",
|
519 |
+
"x.509",
|
520 |
+
"x509"
|
521 |
+
],
|
522 |
+
"time": "2015-01-28T21:50:33+00:00"
|
523 |
+
},
|
524 |
+
{
|
525 |
+
"name": "psr/cache",
|
526 |
+
"version": "1.0.0",
|
527 |
+
"source": {
|
528 |
+
"type": "git",
|
529 |
+
"url": "https://github.com/php-fig/cache.git",
|
530 |
+
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3"
|
531 |
+
},
|
532 |
+
"dist": {
|
533 |
+
"type": "zip",
|
534 |
+
"url": "https://api.github.com/repos/php-fig/cache/zipball/9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
535 |
+
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
536 |
+
"shasum": ""
|
537 |
+
},
|
538 |
+
"require": {
|
539 |
+
"php": ">=5.3.0"
|
540 |
+
},
|
541 |
+
"type": "library",
|
542 |
+
"extra": {
|
543 |
+
"branch-alias": {
|
544 |
+
"dev-master": "1.0.x-dev"
|
545 |
+
}
|
546 |
+
},
|
547 |
+
"autoload": {
|
548 |
+
"psr-4": {
|
549 |
+
"Psr\\Cache\\": "src/"
|
550 |
+
}
|
551 |
+
},
|
552 |
+
"notification-url": "https://packagist.org/downloads/",
|
553 |
+
"license": [
|
554 |
+
"MIT"
|
555 |
+
],
|
556 |
+
"authors": [
|
557 |
+
{
|
558 |
+
"name": "PHP-FIG",
|
559 |
+
"homepage": "http://www.php-fig.org/"
|
560 |
+
}
|
561 |
+
],
|
562 |
+
"description": "Common interface for caching libraries",
|
563 |
+
"keywords": [
|
564 |
+
"cache",
|
565 |
+
"psr",
|
566 |
+
"psr-6"
|
567 |
+
],
|
568 |
+
"time": "2015-12-11T02:52:07+00:00"
|
569 |
+
},
|
570 |
+
{
|
571 |
+
"name": "psr/http-message",
|
572 |
+
"version": "1.0",
|
573 |
+
"source": {
|
574 |
+
"type": "git",
|
575 |
+
"url": "https://github.com/php-fig/http-message.git",
|
576 |
+
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
|
577 |
+
},
|
578 |
+
"dist": {
|
579 |
+
"type": "zip",
|
580 |
+
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
581 |
+
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
582 |
+
"shasum": ""
|
583 |
+
},
|
584 |
+
"require": {
|
585 |
+
"php": ">=5.3.0"
|
586 |
+
},
|
587 |
+
"type": "library",
|
588 |
+
"extra": {
|
589 |
+
"branch-alias": {
|
590 |
+
"dev-master": "1.0.x-dev"
|
591 |
+
}
|
592 |
+
},
|
593 |
+
"autoload": {
|
594 |
+
"psr-4": {
|
595 |
+
"Psr\\Http\\Message\\": "src/"
|
596 |
+
}
|
597 |
+
},
|
598 |
+
"notification-url": "https://packagist.org/downloads/",
|
599 |
+
"license": [
|
600 |
+
"MIT"
|
601 |
+
],
|
602 |
+
"authors": [
|
603 |
+
{
|
604 |
+
"name": "PHP-FIG",
|
605 |
+
"homepage": "http://www.php-fig.org/"
|
606 |
+
}
|
607 |
+
],
|
608 |
+
"description": "Common interface for HTTP messages",
|
609 |
+
"keywords": [
|
610 |
+
"http",
|
611 |
+
"http-message",
|
612 |
+
"psr",
|
613 |
+
"psr-7",
|
614 |
+
"request",
|
615 |
+
"response"
|
616 |
+
],
|
617 |
+
"time": "2015-05-04T20:22:00+00:00"
|
618 |
+
},
|
619 |
+
{
|
620 |
+
"name": "psr/log",
|
621 |
+
"version": "1.0.0",
|
622 |
+
"source": {
|
623 |
+
"type": "git",
|
624 |
+
"url": "https://github.com/php-fig/log.git",
|
625 |
+
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
626 |
+
},
|
627 |
+
"dist": {
|
628 |
+
"type": "zip",
|
629 |
+
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
630 |
+
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
631 |
+
"shasum": ""
|
632 |
+
},
|
633 |
+
"type": "library",
|
634 |
+
"autoload": {
|
635 |
+
"psr-0": {
|
636 |
+
"Psr\\Log\\": ""
|
637 |
+
}
|
638 |
+
},
|
639 |
+
"notification-url": "https://packagist.org/downloads/",
|
640 |
+
"license": [
|
641 |
+
"MIT"
|
642 |
+
],
|
643 |
+
"authors": [
|
644 |
+
{
|
645 |
+
"name": "PHP-FIG",
|
646 |
+
"homepage": "http://www.php-fig.org/"
|
647 |
+
}
|
648 |
+
],
|
649 |
+
"description": "Common interface for logging libraries",
|
650 |
+
"keywords": [
|
651 |
+
"log",
|
652 |
+
"psr",
|
653 |
+
"psr-3"
|
654 |
+
],
|
655 |
+
"time": "2012-12-21T11:40:51+00:00"
|
656 |
+
},
|
657 |
+
{
|
658 |
+
"name": "react/promise",
|
659 |
+
"version": "v2.0.0",
|
660 |
+
"source": {
|
661 |
+
"type": "git",
|
662 |
+
"url": "https://github.com/reactphp/promise.git",
|
663 |
+
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0"
|
664 |
+
},
|
665 |
+
"dist": {
|
666 |
+
"type": "zip",
|
667 |
+
"url": "https://api.github.com/repos/reactphp/promise/zipball/58129a9cb9da88f2055309a805e2696b06928bb0",
|
668 |
+
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0",
|
669 |
+
"shasum": ""
|
670 |
+
},
|
671 |
+
"require": {
|
672 |
+
"php": ">=5.4.0"
|
673 |
+
},
|
674 |
+
"type": "library",
|
675 |
+
"extra": {
|
676 |
+
"branch-alias": {
|
677 |
+
"dev-master": "2.0-dev"
|
678 |
+
}
|
679 |
+
},
|
680 |
+
"autoload": {
|
681 |
+
"psr-0": {
|
682 |
+
"React\\Promise": "src/"
|
683 |
+
},
|
684 |
+
"files": [
|
685 |
+
"src/React/Promise/functions.php"
|
686 |
+
]
|
687 |
+
},
|
688 |
+
"notification-url": "https://packagist.org/downloads/",
|
689 |
+
"license": [
|
690 |
+
"MIT"
|
691 |
+
],
|
692 |
+
"authors": [
|
693 |
+
{
|
694 |
+
"name": "Jan Sorgalla",
|
695 |
+
"email": "jsorgalla@googlemail.com"
|
696 |
+
}
|
697 |
+
],
|
698 |
+
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
|
699 |
+
"time": "2013-12-10T15:40:36+00:00"
|
700 |
+
}
|
701 |
+
],
|
702 |
+
"packages-dev": [
|
703 |
+
{
|
704 |
+
"name": "cache/adapter-common",
|
705 |
+
"version": "0.3.0",
|
706 |
+
"source": {
|
707 |
+
"type": "git",
|
708 |
+
"url": "https://github.com/php-cache/adapter-common.git",
|
709 |
+
"reference": "56c9c9af1b6389f6aa2c26df23a1c058249c384a"
|
710 |
+
},
|
711 |
+
"dist": {
|
712 |
+
"type": "zip",
|
713 |
+
"url": "https://api.github.com/repos/php-cache/adapter-common/zipball/56c9c9af1b6389f6aa2c26df23a1c058249c384a",
|
714 |
+
"reference": "56c9c9af1b6389f6aa2c26df23a1c058249c384a",
|
715 |
+
"shasum": ""
|
716 |
+
},
|
717 |
+
"require": {
|
718 |
+
"cache/taggable-cache": "^0.4",
|
719 |
+
"php": "^5.5|^7.0",
|
720 |
+
"psr/cache": "^1.0"
|
721 |
+
},
|
722 |
+
"require-dev": {
|
723 |
+
"cache/integration-tests": "^0.9",
|
724 |
+
"phpunit/phpunit": "^4.0|^5.1"
|
725 |
+
},
|
726 |
+
"type": "library",
|
727 |
+
"autoload": {
|
728 |
+
"psr-4": {
|
729 |
+
"Cache\\Adapter\\Common\\": ""
|
730 |
+
}
|
731 |
+
},
|
732 |
+
"notification-url": "https://packagist.org/downloads/",
|
733 |
+
"license": [
|
734 |
+
"MIT"
|
735 |
+
],
|
736 |
+
"authors": [
|
737 |
+
{
|
738 |
+
"name": "Aaron Scherer",
|
739 |
+
"email": "aequasi@gmail.com",
|
740 |
+
"homepage": "https://github.com/aequasi"
|
741 |
+
},
|
742 |
+
{
|
743 |
+
"name": "Tobias Nyholm",
|
744 |
+
"email": "tobias.nyholm@gmail.com",
|
745 |
+
"homepage": "https://github.com/nyholm"
|
746 |
+
}
|
747 |
+
],
|
748 |
+
"description": "Common classes for PSR-6 adapters",
|
749 |
+
"homepage": "https://github.com/php-cache/adapter-common",
|
750 |
+
"keywords": [
|
751 |
+
"cache",
|
752 |
+
"psr-6",
|
753 |
+
"tag"
|
754 |
+
],
|
755 |
+
"time": "2016-02-25T08:03:59+00:00"
|
756 |
+
},
|
757 |
+
{
|
758 |
+
"name": "cache/filesystem-adapter",
|
759 |
+
"version": "0.3.2",
|
760 |
+
"source": {
|
761 |
+
"type": "git",
|
762 |
+
"url": "https://github.com/php-cache/filesystem-adapter.git",
|
763 |
+
"reference": "eeb6a2b60fdcb4984c90113fd37f17a36c13ac02"
|
764 |
+
},
|
765 |
+
"dist": {
|
766 |
+
"type": "zip",
|
767 |
+
"url": "https://api.github.com/repos/php-cache/filesystem-adapter/zipball/eeb6a2b60fdcb4984c90113fd37f17a36c13ac02",
|
768 |
+
"reference": "eeb6a2b60fdcb4984c90113fd37f17a36c13ac02",
|
769 |
+
"shasum": ""
|
770 |
+
},
|
771 |
+
"require": {
|
772 |
+
"cache/adapter-common": "^0.3",
|
773 |
+
"cache/taggable-cache": "^0.4",
|
774 |
+
"league/flysystem": "^1.0",
|
775 |
+
"php": "^5.5 || ^7.0",
|
776 |
+
"psr/cache": "^1.0"
|
777 |
+
},
|
778 |
+
"provide": {
|
779 |
+
"psr/cache-implementation": "^1.0"
|
780 |
+
},
|
781 |
+
"require-dev": {
|
782 |
+
"cache/integration-tests": "^0.11",
|
783 |
+
"phpunit/phpunit": "^4.0 || ^5.1"
|
784 |
+
},
|
785 |
+
"type": "library",
|
786 |
+
"autoload": {
|
787 |
+
"psr-4": {
|
788 |
+
"Cache\\Adapter\\Filesystem\\": ""
|
789 |
+
},
|
790 |
+
"exclude-from-classmap": [
|
791 |
+
"/Tests/"
|
792 |
+
]
|
793 |
+
},
|
794 |
+
"notification-url": "https://packagist.org/downloads/",
|
795 |
+
"license": [
|
796 |
+
"MIT"
|
797 |
+
],
|
798 |
+
"authors": [
|
799 |
+
{
|
800 |
+
"name": "Aaron Scherer",
|
801 |
+
"email": "aequasi@gmail.com",
|
802 |
+
"homepage": "https://github.com/aequasi"
|
803 |
+
},
|
804 |
+
{
|
805 |
+
"name": "Tobias Nyholm",
|
806 |
+
"email": "tobias.nyholm@gmail.com",
|
807 |
+
"homepage": "https://github.com/nyholm"
|
808 |
+
}
|
809 |
+
],
|
810 |
+
"description": "A PSR-6 cache implementation using filesystem. This implementation supports tags",
|
811 |
+
"homepage": "http://www.php-cache.com/en/latest/",
|
812 |
+
"keywords": [
|
813 |
+
"cache",
|
814 |
+
"filesystem",
|
815 |
+
"psr-6",
|
816 |
+
"tag"
|
817 |
+
],
|
818 |
+
"time": "2016-10-19T18:54:43+00:00"
|
819 |
+
},
|
820 |
+
{
|
821 |
+
"name": "cache/taggable-cache",
|
822 |
+
"version": "0.4.0",
|
823 |
+
"source": {
|
824 |
+
"type": "git",
|
825 |
+
"url": "https://github.com/php-cache/taggable-cache.git",
|
826 |
+
"reference": "ad9276e372043e17aa386d63e85272c35b2ebfe7"
|
827 |
+
},
|
828 |
+
"dist": {
|
829 |
+
"type": "zip",
|
830 |
+
"url": "https://api.github.com/repos/php-cache/taggable-cache/zipball/ad9276e372043e17aa386d63e85272c35b2ebfe7",
|
831 |
+
"reference": "ad9276e372043e17aa386d63e85272c35b2ebfe7",
|
832 |
+
"shasum": ""
|
833 |
+
},
|
834 |
+
"require": {
|
835 |
+
"php": "^5.5|^7.0",
|
836 |
+
"psr/cache": "^1.0"
|
837 |
+
},
|
838 |
+
"require-dev": {
|
839 |
+
"cache/integration-tests": "^0.9",
|
840 |
+
"phpunit/phpunit": "^4.1|^5.1"
|
841 |
+
},
|
842 |
+
"type": "library",
|
843 |
+
"autoload": {
|
844 |
+
"psr-4": {
|
845 |
+
"Cache\\Taggable\\": ""
|
846 |
+
},
|
847 |
+
"exclude-from-classmap": [
|
848 |
+
"/Tests/"
|
849 |
+
]
|
850 |
+
},
|
851 |
+
"notification-url": "https://packagist.org/downloads/",
|
852 |
+
"license": [
|
853 |
+
"MIT"
|
854 |
+
],
|
855 |
+
"authors": [
|
856 |
+
{
|
857 |
+
"name": "Aaron Scherer",
|
858 |
+
"email": "aequasi@gmail.com",
|
859 |
+
"homepage": "https://github.com/aequasi"
|
860 |
+
},
|
861 |
+
{
|
862 |
+
"name": "Tobias Nyholm",
|
863 |
+
"email": "tobias.nyholm@gmail.com",
|
864 |
+
"homepage": "https://github.com/nyholm"
|
865 |
+
}
|
866 |
+
],
|
867 |
+
"description": "Add tag support to your PSR-6 cache implementation",
|
868 |
+
"homepage": "https://github.com/php-cache/taggable-cache",
|
869 |
+
"keywords": [
|
870 |
+
"Taggable",
|
871 |
+
"cache",
|
872 |
+
"psr6",
|
873 |
+
"tag"
|
874 |
+
],
|
875 |
+
"time": "2016-02-28T16:35:05+00:00"
|
876 |
+
},
|
877 |
+
{
|
878 |
+
"name": "league/flysystem",
|
879 |
+
"version": "1.0.0",
|
880 |
+
"source": {
|
881 |
+
"type": "git",
|
882 |
+
"url": "https://github.com/thephpleague/flysystem.git",
|
883 |
+
"reference": "0ba6b6dfd6f456905ee8d6b0bcaab7ec89419b93"
|
884 |
+
},
|
885 |
+
"dist": {
|
886 |
+
"type": "zip",
|
887 |
+
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0ba6b6dfd6f456905ee8d6b0bcaab7ec89419b93",
|
888 |
+
"reference": "0ba6b6dfd6f456905ee8d6b0bcaab7ec89419b93",
|
889 |
+
"shasum": ""
|
890 |
+
},
|
891 |
+
"require": {
|
892 |
+
"php": ">=5.4.0"
|
893 |
+
},
|
894 |
+
"require-dev": {
|
895 |
+
"ext-fileinfo": "*",
|
896 |
+
"league/phpunit-coverage-listener": "~1.1",
|
897 |
+
"mockery/mockery": "~0.9",
|
898 |
+
"phpspec/phpspec": "~2.0.0",
|
899 |
+
"phpspec/prophecy-phpunit": "~1.0",
|
900 |
+
"phpunit/phpunit": "~4.0",
|
901 |
+
"predis/predis": "~1.0",
|
902 |
+
"tedivm/stash": "~0.12.0"
|
903 |
+
},
|
904 |
+
"suggest": {
|
905 |
+
"ext-fileinfo": "Required for MimeType",
|
906 |
+
"league/flysystem-aws-s3-v2": "Use S3 storage with AWS SDK v2",
|
907 |
+
"league/flysystem-aws-s3-v3": "Use S3 storage with AWS SDK v3",
|
908 |
+
"league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
|
909 |
+
"league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
|
910 |
+
"league/flysystem-copy": "Allows you to use Copy.com storage",
|
911 |
+
"league/flysystem-dropbox": "Use Dropbox storage",
|
912 |
+
"league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
|
913 |
+
"league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
|
914 |
+
"league/flysystem-sftp": "Allows SFTP server storage via phpseclib",
|
915 |
+
"league/flysystem-webdav": "Allows you to use WebDAV storage",
|
916 |
+
"league/flysystem-ziparchive": "Allows you to use ZipArchive adapter",
|
917 |
+
"predis/predis": "Allows you to use Predis for caching"
|
918 |
+
},
|
919 |
+
"type": "library",
|
920 |
+
"extra": {
|
921 |
+
"branch-alias": {
|
922 |
+
"dev-master": "1.0-dev"
|
923 |
+
}
|
924 |
+
},
|
925 |
+
"autoload": {
|
926 |
+
"psr-4": {
|
927 |
+
"League\\Flysystem\\": "src/"
|
928 |
+
}
|
929 |
+
},
|
930 |
+
"notification-url": "https://packagist.org/downloads/",
|
931 |
+
"license": [
|
932 |
+
"MIT"
|
933 |
+
],
|
934 |
+
"authors": [
|
935 |
+
{
|
936 |
+
"name": "Frank de Jonge",
|
937 |
+
"email": "info@frenky.net"
|
938 |
+
}
|
939 |
+
],
|
940 |
+
"description": "Many filesystems, one API.",
|
941 |
+
"keywords": [
|
942 |
+
"Cloud Files",
|
943 |
+
"WebDAV",
|
944 |
+
"aws",
|
945 |
+
"cloud",
|
946 |
+
"copy.com",
|
947 |
+
"dropbox",
|
948 |
+
"file systems",
|
949 |
+
"files",
|
950 |
+
"filesystem",
|
951 |
+
"ftp",
|
952 |
+
"rackspace",
|
953 |
+
"remote",
|
954 |
+
"s3",
|
955 |
+
"sftp",
|
956 |
+
"storage"
|
957 |
+
],
|
958 |
+
"time": "2015-01-19T19:19:07+00:00"
|
959 |
+
},
|
960 |
+
{
|
961 |
+
"name": "phpunit/php-code-coverage",
|
962 |
+
"version": "2.0.0",
|
963 |
+
"source": {
|
964 |
+
"type": "git",
|
965 |
+
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
966 |
+
"reference": "cbdd64d012c9b8c2e30850abd125001ed5db1eed"
|
967 |
+
},
|
968 |
+
"dist": {
|
969 |
+
"type": "zip",
|
970 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cbdd64d012c9b8c2e30850abd125001ed5db1eed",
|
971 |
+
"reference": "cbdd64d012c9b8c2e30850abd125001ed5db1eed",
|
972 |
+
"shasum": ""
|
973 |
+
},
|
974 |
+
"require": {
|
975 |
+
"php": ">=5.3.3",
|
976 |
+
"phpunit/php-file-iterator": "~1.3.1",
|
977 |
+
"phpunit/php-text-template": "~1.2",
|
978 |
+
"phpunit/php-token-stream": "~1.1.3",
|
979 |
+
"sebastian/environment": "~1.0",
|
980 |
+
"sebastian/version": "~1.0"
|
981 |
+
},
|
982 |
+
"require-dev": {
|
983 |
+
"ext-xdebug": ">=2.1.4",
|
984 |
+
"phpunit/phpunit": ">=4.0.0,<4.1.0"
|
985 |
+
},
|
986 |
+
"suggest": {
|
987 |
+
"ext-dom": "*",
|
988 |
+
"ext-xdebug": ">=2.2.1"
|
989 |
+
},
|
990 |
+
"type": "library",
|
991 |
+
"extra": {
|
992 |
+
"branch-alias": {
|
993 |
+
"dev-master": "2.0.x-dev"
|
994 |
+
}
|
995 |
+
},
|
996 |
+
"autoload": {
|
997 |
+
"classmap": [
|
998 |
+
"src/"
|
999 |
+
]
|
1000 |
+
},
|
1001 |
+
"notification-url": "https://packagist.org/downloads/",
|
1002 |
+
"include-path": [
|
1003 |
+
""
|
1004 |
+
],
|
1005 |
+
"license": [
|
1006 |
+
"BSD-3-Clause"
|
1007 |
+
],
|
1008 |
+
"authors": [
|
1009 |
+
{
|
1010 |
+
"name": "Sebastian Bergmann",
|
1011 |
+
"email": "sb@sebastian-bergmann.de",
|
1012 |
+
"role": "lead"
|
1013 |
+
}
|
1014 |
+
],
|
1015 |
+
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
|
1016 |
+
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
|
1017 |
+
"keywords": [
|
1018 |
+
"coverage",
|
1019 |
+
"testing",
|
1020 |
+
"xunit"
|
1021 |
+
],
|
1022 |
+
"time": "2014-03-07T06:40:32+00:00"
|
1023 |
+
},
|
1024 |
+
{
|
1025 |
+
"name": "phpunit/php-file-iterator",
|
1026 |
+
"version": "1.3.2",
|
1027 |
+
"source": {
|
1028 |
+
"type": "git",
|
1029 |
+
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
|
1030 |
+
"reference": "46b0610951db3a918ee7842bc0d471e72c1d0d46"
|
1031 |
+
},
|
1032 |
+
"dist": {
|
1033 |
+
"type": "zip",
|
1034 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/46b0610951db3a918ee7842bc0d471e72c1d0d46",
|
1035 |
+
"reference": "46b0610951db3a918ee7842bc0d471e72c1d0d46",
|
1036 |
+
"shasum": ""
|
1037 |
+
},
|
1038 |
+
"require": {
|
1039 |
+
"php": ">=5.2.7"
|
1040 |
+
},
|
1041 |
+
"type": "library",
|
1042 |
+
"autoload": {
|
1043 |
+
"files": [
|
1044 |
+
"File/Iterator/Autoload.php"
|
1045 |
+
]
|
1046 |
+
},
|
1047 |
+
"notification-url": "https://packagist.org/downloads/",
|
1048 |
+
"include-path": [
|
1049 |
+
""
|
1050 |
+
],
|
1051 |
+
"license": [
|
1052 |
+
"BSD-3-Clause"
|
1053 |
+
],
|
1054 |
+
"authors": [
|
1055 |
+
{
|
1056 |
+
"name": "Sebastian Bergmann",
|
1057 |
+
"email": "sb@sebastian-bergmann.de",
|
1058 |
+
"role": "lead"
|
1059 |
+
}
|
1060 |
+
],
|
1061 |
+
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
|
1062 |
+
"homepage": "http://www.phpunit.de/",
|
1063 |
+
"keywords": [
|
1064 |
+
"filesystem",
|
1065 |
+
"iterator"
|
1066 |
+
],
|
1067 |
+
"time": "2012-09-22T00:00:00+00:00"
|
1068 |
+
},
|
1069 |
+
{
|
1070 |
+
"name": "phpunit/php-text-template",
|
1071 |
+
"version": "1.2.0",
|
1072 |
+
"source": {
|
1073 |
+
"type": "git",
|
1074 |
+
"url": "https://github.com/sebastianbergmann/php-text-template.git",
|
1075 |
+
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
|
1076 |
+
},
|
1077 |
+
"dist": {
|
1078 |
+
"type": "zip",
|
1079 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
1080 |
+
"reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
|
1081 |
+
"shasum": ""
|
1082 |
+
},
|
1083 |
+
"require": {
|
1084 |
+
"php": ">=5.3.3"
|
1085 |
+
},
|
1086 |
+
"type": "library",
|
1087 |
+
"autoload": {
|
1088 |
+
"classmap": [
|
1089 |
+
"Text/"
|
1090 |
+
]
|
1091 |
+
},
|
1092 |
+
"notification-url": "https://packagist.org/downloads/",
|
1093 |
+
"include-path": [
|
1094 |
+
""
|
1095 |
+
],
|
1096 |
+
"license": [
|
1097 |
+
"BSD-3-Clause"
|
1098 |
+
],
|
1099 |
+
"authors": [
|
1100 |
+
{
|
1101 |
+
"name": "Sebastian Bergmann",
|
1102 |
+
"email": "sb@sebastian-bergmann.de",
|
1103 |
+
"role": "lead"
|
1104 |
+
}
|
1105 |
+
],
|
1106 |
+
"description": "Simple template engine.",
|
1107 |
+
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
|
1108 |
+
"keywords": [
|
1109 |
+
"template"
|
1110 |
+
],
|
1111 |
+
"time": "2014-01-30T17:20:04+00:00"
|
1112 |
+
},
|
1113 |
+
{
|
1114 |
+
"name": "phpunit/php-timer",
|
1115 |
+
"version": "1.0.3",
|
1116 |
+
"source": {
|
1117 |
+
"type": "git",
|
1118 |
+
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
1119 |
+
"reference": "5175e9bb35fc9cc430973ed83a3d62531c3c8698"
|
1120 |
+
},
|
1121 |
+
"dist": {
|
1122 |
+
"type": "zip",
|
1123 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5175e9bb35fc9cc430973ed83a3d62531c3c8698",
|
1124 |
+
"reference": "5175e9bb35fc9cc430973ed83a3d62531c3c8698",
|
1125 |
+
"shasum": ""
|
1126 |
+
},
|
1127 |
+
"require": {
|
1128 |
+
"php": ">=5.2.7"
|
1129 |
+
},
|
1130 |
+
"type": "library",
|
1131 |
+
"autoload": {
|
1132 |
+
"files": [
|
1133 |
+
"PHP/Timer/Autoload.php"
|
1134 |
+
]
|
1135 |
+
},
|
1136 |
+
"notification-url": "https://packagist.org/downloads/",
|
1137 |
+
"include-path": [
|
1138 |
+
""
|
1139 |
+
],
|
1140 |
+
"license": [
|
1141 |
+
"BSD-3-Clause"
|
1142 |
+
],
|
1143 |
+
"authors": [
|
1144 |
+
{
|
1145 |
+
"name": "Sebastian Bergmann",
|
1146 |
+
"email": "sb@sebastian-bergmann.de",
|
1147 |
+
"role": "lead"
|
1148 |
+
}
|
1149 |
+
],
|
1150 |
+
"description": "Utility class for timing",
|
1151 |
+
"homepage": "http://www.phpunit.de/",
|
1152 |
+
"keywords": [
|
1153 |
+
"timer"
|
1154 |
+
],
|
1155 |
+
"time": "2012-09-23T00:00:00+00:00"
|
1156 |
+
},
|
1157 |
+
{
|
1158 |
+
"name": "phpunit/php-token-stream",
|
1159 |
+
"version": "1.1.4",
|
1160 |
+
"source": {
|
1161 |
+
"type": "git",
|
1162 |
+
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
|
1163 |
+
"reference": "dd11f1b0c071dc46fe711a7dd331db1b2179b9be"
|
1164 |
+
},
|
1165 |
+
"dist": {
|
1166 |
+
"type": "zip",
|
1167 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/dd11f1b0c071dc46fe711a7dd331db1b2179b9be",
|
1168 |
+
"reference": "dd11f1b0c071dc46fe711a7dd331db1b2179b9be",
|
1169 |
+
"shasum": ""
|
1170 |
+
},
|
1171 |
+
"require": {
|
1172 |
+
"ext-tokenizer": "*",
|
1173 |
+
"php": ">=5.2.7"
|
1174 |
+
},
|
1175 |
+
"type": "library",
|
1176 |
+
"autoload": {
|
1177 |
+
"files": [
|
1178 |
+
"PHP/Token/Stream/Autoload.php"
|
1179 |
+
]
|
1180 |
+
},
|
1181 |
+
"notification-url": "https://packagist.org/downloads/",
|
1182 |
+
"include-path": [
|
1183 |
+
""
|
1184 |
+
],
|
1185 |
+
"license": [
|
1186 |
+
"BSD-3-Clause"
|
1187 |
+
],
|
1188 |
+
"authors": [
|
1189 |
+
{
|
1190 |
+
"name": "Sebastian Bergmann",
|
1191 |
+
"email": "sb@sebastian-bergmann.de",
|
1192 |
+
"role": "lead"
|
1193 |
+
}
|
1194 |
+
],
|
1195 |
+
"description": "Wrapper around PHP's tokenizer extension.",
|
1196 |
+
"homepage": "http://www.phpunit.de/",
|
1197 |
+
"keywords": [
|
1198 |
+
"tokenizer"
|
1199 |
+
],
|
1200 |
+
"time": "2012-09-23T00:00:00+00:00"
|
1201 |
+
},
|
1202 |
+
{
|
1203 |
+
"name": "phpunit/phpunit",
|
1204 |
+
"version": "4.0.0",
|
1205 |
+
"source": {
|
1206 |
+
"type": "git",
|
1207 |
+
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
1208 |
+
"reference": "b3a7c58bc39f01577f89d63da1ec578e1e993f1a"
|
1209 |
+
},
|
1210 |
+
"dist": {
|
1211 |
+
"type": "zip",
|
1212 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b3a7c58bc39f01577f89d63da1ec578e1e993f1a",
|
1213 |
+
"reference": "b3a7c58bc39f01577f89d63da1ec578e1e993f1a",
|
1214 |
+
"shasum": ""
|
1215 |
+
},
|
1216 |
+
"require": {
|
1217 |
+
"ext-dom": "*",
|
1218 |
+
"ext-pcre": "*",
|
1219 |
+
"ext-reflection": "*",
|
1220 |
+
"ext-spl": "*",
|
1221 |
+
"php": ">=5.3.3",
|
1222 |
+
"phpunit/php-code-coverage": ">=2.0.0,<2.1.0",
|
1223 |
+
"phpunit/php-file-iterator": "~1.3.1",
|
1224 |
+
"phpunit/php-text-template": "~1.2",
|
1225 |
+
"phpunit/php-timer": "~1.0.2",
|
1226 |
+
"phpunit/phpunit-mock-objects": ">=2.0.0,<2.1.0",
|
1227 |
+
"sebastian/diff": "~1.1",
|
1228 |
+
"sebastian/environment": "~1.0",
|
1229 |
+
"sebastian/exporter": "~1.0.1",
|
1230 |
+
"sebastian/version": "~1.0",
|
1231 |
+
"symfony/yaml": "~2.0"
|
1232 |
+
},
|
1233 |
+
"suggest": {
|
1234 |
+
"ext-json": "*",
|
1235 |
+
"ext-simplexml": "*",
|
1236 |
+
"ext-tokenizer": "*",
|
1237 |
+
"phpunit/php-invoker": "~1.1"
|
1238 |
+
},
|
1239 |
+
"bin": [
|
1240 |
+
"phpunit"
|
1241 |
+
],
|
1242 |
+
"type": "library",
|
1243 |
+
"extra": {
|
1244 |
+
"branch-alias": {
|
1245 |
+
"dev-master": "4.0.x-dev"
|
1246 |
+
}
|
1247 |
+
},
|
1248 |
+
"autoload": {
|
1249 |
+
"classmap": [
|
1250 |
+
"src/"
|
1251 |
+
]
|
1252 |
+
},
|
1253 |
+
"notification-url": "https://packagist.org/downloads/",
|
1254 |
+
"include-path": [
|
1255 |
+
"",
|
1256 |
+
"../../symfony/yaml/"
|
1257 |
+
],
|
1258 |
+
"license": [
|
1259 |
+
"BSD-3-Clause"
|
1260 |
+
],
|
1261 |
+
"authors": [
|
1262 |
+
{
|
1263 |
+
"name": "Sebastian Bergmann",
|
1264 |
+
"email": "sebastian@phpunit.de",
|
1265 |
+
"role": "lead"
|
1266 |
+
}
|
1267 |
+
],
|
1268 |
+
"description": "The PHP Unit Testing framework.",
|
1269 |
+
"homepage": "http://www.phpunit.de/",
|
1270 |
+
"keywords": [
|
1271 |
+
"phpunit",
|
1272 |
+
"testing",
|
1273 |
+
"xunit"
|
1274 |
+
],
|
1275 |
+
"time": "2014-03-07T07:00:44+00:00"
|
1276 |
+
},
|
1277 |
+
{
|
1278 |
+
"name": "phpunit/phpunit-mock-objects",
|
1279 |
+
"version": "2.0.0",
|
1280 |
+
"source": {
|
1281 |
+
"type": "git",
|
1282 |
+
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
|
1283 |
+
"reference": "f055539b22449034af4d232549c53b6cd49b9cff"
|
1284 |
+
},
|
1285 |
+
"dist": {
|
1286 |
+
"type": "zip",
|
1287 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/f055539b22449034af4d232549c53b6cd49b9cff",
|
1288 |
+
"reference": "f055539b22449034af4d232549c53b6cd49b9cff",
|
1289 |
+
"shasum": ""
|
1290 |
+
},
|
1291 |
+
"require": {
|
1292 |
+
"php": ">=5.3.3",
|
1293 |
+
"phpunit/php-text-template": "~1.2"
|
1294 |
+
},
|
1295 |
+
"require-dev": {
|
1296 |
+
"phpunit/phpunit": ">=4.0.0,<4.1.0"
|
1297 |
+
},
|
1298 |
+
"suggest": {
|
1299 |
+
"ext-soap": "*"
|
1300 |
+
},
|
1301 |
+
"type": "library",
|
1302 |
+
"extra": {
|
1303 |
+
"branch-alias": {
|
1304 |
+
"dev-master": "2.0.x-dev"
|
1305 |
+
}
|
1306 |
+
},
|
1307 |
+
"autoload": {
|
1308 |
+
"classmap": [
|
1309 |
+
"src/"
|
1310 |
+
]
|
1311 |
+
},
|
1312 |
+
"notification-url": "https://packagist.org/downloads/",
|
1313 |
+
"include-path": [
|
1314 |
+
""
|
1315 |
+
],
|
1316 |
+
"license": [
|
1317 |
+
"BSD-3-Clause"
|
1318 |
+
],
|
1319 |
+
"authors": [
|
1320 |
+
{
|
1321 |
+
"name": "Sebastian Bergmann",
|
1322 |
+
"email": "sb@sebastian-bergmann.de",
|
1323 |
+
"role": "lead"
|
1324 |
+
}
|
1325 |
+
],
|
1326 |
+
"description": "Mock Object library for PHPUnit",
|
1327 |
+
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
|
1328 |
+
"keywords": [
|
1329 |
+
"mock",
|
1330 |
+
"xunit"
|
1331 |
+
],
|
1332 |
+
"time": "2014-03-07T06:53:16+00:00"
|
1333 |
+
},
|
1334 |
+
{
|
1335 |
+
"name": "sebastian/diff",
|
1336 |
+
"version": "1.1.0",
|
1337 |
+
"source": {
|
1338 |
+
"type": "git",
|
1339 |
+
"url": "https://github.com/sebastianbergmann/diff.git",
|
1340 |
+
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d"
|
1341 |
+
},
|
1342 |
+
"dist": {
|
1343 |
+
"type": "zip",
|
1344 |
+
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
|
1345 |
+
"reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d",
|
1346 |
+
"shasum": ""
|
1347 |
+
},
|
1348 |
+
"require": {
|
1349 |
+
"php": ">=5.3.3"
|
1350 |
+
},
|
1351 |
+
"type": "library",
|
1352 |
+
"extra": {
|
1353 |
+
"branch-alias": {
|
1354 |
+
"dev-master": "1.1-dev"
|
1355 |
+
}
|
1356 |
+
},
|
1357 |
+
"autoload": {
|
1358 |
+
"classmap": [
|
1359 |
+
"src/"
|
1360 |
+
]
|
1361 |
+
},
|
1362 |
+
"notification-url": "https://packagist.org/downloads/",
|
1363 |
+
"license": [
|
1364 |
+
"BSD-3-Clause"
|
1365 |
+
],
|
1366 |
+
"authors": [
|
1367 |
+
{
|
1368 |
+
"name": "Sebastian Bergmann",
|
1369 |
+
"email": "sebastian@phpunit.de",
|
1370 |
+
"role": "lead"
|
1371 |
+
},
|
1372 |
+
{
|
1373 |
+
"name": "Kore Nordmann",
|
1374 |
+
"email": "mail@kore-nordmann.de"
|
1375 |
+
}
|
1376 |
+
],
|
1377 |
+
"description": "Diff implementation",
|
1378 |
+
"homepage": "http://www.github.com/sebastianbergmann/diff",
|
1379 |
+
"keywords": [
|
1380 |
+
"diff"
|
1381 |
+
],
|
1382 |
+
"time": "2013-08-03T16:46:33+00:00"
|
1383 |
+
},
|
1384 |
+
{
|
1385 |
+
"name": "sebastian/environment",
|
1386 |
+
"version": "1.0.0",
|
1387 |
+
"source": {
|
1388 |
+
"type": "git",
|
1389 |
+
"url": "https://github.com/sebastianbergmann/environment.git",
|
1390 |
+
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a"
|
1391 |
+
},
|
1392 |
+
"dist": {
|
1393 |
+
"type": "zip",
|
1394 |
+
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a",
|
1395 |
+
"reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a",
|
1396 |
+
"shasum": ""
|
1397 |
+
},
|
1398 |
+
"require": {
|
1399 |
+
"php": ">=5.3.3"
|
1400 |
+
},
|
1401 |
+
"require-dev": {
|
1402 |
+
"phpunit/phpunit": "4.0.*@dev"
|
1403 |
+
},
|
1404 |
+
"type": "library",
|
1405 |
+
"extra": {
|
1406 |
+
"branch-alias": {
|
1407 |
+
"dev-master": "1.0.x-dev"
|
1408 |
+
}
|
1409 |
+
},
|
1410 |
+
"autoload": {
|
1411 |
+
"classmap": [
|
1412 |
+
"src/"
|
1413 |
+
]
|
1414 |
+
},
|
1415 |
+
"notification-url": "https://packagist.org/downloads/",
|
1416 |
+
"license": [
|
1417 |
+
"BSD-3-Clause"
|
1418 |
+
],
|
1419 |
+
"authors": [
|
1420 |
+
{
|
1421 |
+
"name": "Sebastian Bergmann",
|
1422 |
+
"email": "sebastian@phpunit.de",
|
1423 |
+
"role": "lead"
|
1424 |
+
}
|
1425 |
+
],
|
1426 |
+
"description": "Provides functionality to handle HHVM/PHP environments",
|
1427 |
+
"homepage": "http://www.github.com/sebastianbergmann/environment",
|
1428 |
+
"keywords": [
|
1429 |
+
"Xdebug",
|
1430 |
+
"environment",
|
1431 |
+
"hhvm"
|
1432 |
+
],
|
1433 |
+
"time": "2014-02-18T16:17:19+00:00"
|
1434 |
+
},
|
1435 |
+
{
|
1436 |
+
"name": "sebastian/exporter",
|
1437 |
+
"version": "1.0.1",
|
1438 |
+
"source": {
|
1439 |
+
"type": "git",
|
1440 |
+
"url": "https://github.com/sebastianbergmann/exporter.git",
|
1441 |
+
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529"
|
1442 |
+
},
|
1443 |
+
"dist": {
|
1444 |
+
"type": "zip",
|
1445 |
+
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
|
1446 |
+
"reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529",
|
1447 |
+
"shasum": ""
|
1448 |
+
},
|
1449 |
+
"require": {
|
1450 |
+
"php": ">=5.3.3"
|
1451 |
+
},
|
1452 |
+
"require-dev": {
|
1453 |
+
"phpunit/phpunit": "4.0.*@dev"
|
1454 |
+
},
|
1455 |
+
"type": "library",
|
1456 |
+
"extra": {
|
1457 |
+
"branch-alias": {
|
1458 |
+
"dev-master": "1.0.x-dev"
|
1459 |
+
}
|
1460 |
+
},
|
1461 |
+
"autoload": {
|
1462 |
+
"classmap": [
|
1463 |
+
"src/"
|
1464 |
+
]
|
1465 |
+
},
|
1466 |
+
"notification-url": "https://packagist.org/downloads/",
|
1467 |
+
"license": [
|
1468 |
+
"BSD-3-Clause"
|
1469 |
+
],
|
1470 |
+
"authors": [
|
1471 |
+
{
|
1472 |
+
"name": "Sebastian Bergmann",
|
1473 |
+
"email": "sebastian@phpunit.de",
|
1474 |
+
"role": "lead"
|
1475 |
+
},
|
1476 |
+
{
|
1477 |
+
"name": "Jeff Welch",
|
1478 |
+
"email": "whatthejeff@gmail.com"
|
1479 |
+
},
|
1480 |
+
{
|
1481 |
+
"name": "Volker Dusch",
|
1482 |
+
"email": "github@wallbash.com"
|
1483 |
+
},
|
1484 |
+
{
|
1485 |
+
"name": "Adam Harvey",
|
1486 |
+
"email": "aharvey@php.net",
|
1487 |
+
"role": "Lead"
|
1488 |
+
},
|
1489 |
+
{
|
1490 |
+
"name": "Bernhard Schussek",
|
1491 |
+
"email": "bschussek@2bepublished.at"
|
1492 |
+
}
|
1493 |
+
],
|
1494 |
+
"description": "Provides the functionality to export PHP variables for visualization",
|
1495 |
+
"homepage": "http://www.github.com/sebastianbergmann/exporter",
|
1496 |
+
"keywords": [
|
1497 |
+
"export",
|
1498 |
+
"exporter"
|
1499 |
+
],
|
1500 |
+
"time": "2014-02-16T08:26:31+00:00"
|
1501 |
+
},
|
1502 |
+
{
|
1503 |
+
"name": "sebastian/version",
|
1504 |
+
"version": "1.0.0",
|
1505 |
+
"source": {
|
1506 |
+
"type": "git",
|
1507 |
+
"url": "https://github.com/sebastianbergmann/version.git",
|
1508 |
+
"reference": "16b021aed448b654ae05846e394e057e9a6f04cb"
|
1509 |
+
},
|
1510 |
+
"dist": {
|
1511 |
+
"type": "zip",
|
1512 |
+
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/16b021aed448b654ae05846e394e057e9a6f04cb",
|
1513 |
+
"reference": "16b021aed448b654ae05846e394e057e9a6f04cb",
|
1514 |
+
"shasum": ""
|
1515 |
+
},
|
1516 |
+
"type": "library",
|
1517 |
+
"autoload": {
|
1518 |
+
"classmap": [
|
1519 |
+
"src/"
|
1520 |
+
]
|
1521 |
+
},
|
1522 |
+
"notification-url": "https://packagist.org/downloads/",
|
1523 |
+
"license": [
|
1524 |
+
"BSD-3-Clause"
|
1525 |
+
],
|
1526 |
+
"authors": [
|
1527 |
+
{
|
1528 |
+
"name": "Sebastian Bergmann",
|
1529 |
+
"email": "sebastian@phpunit.de",
|
1530 |
+
"role": "lead"
|
1531 |
+
}
|
1532 |
+
],
|
1533 |
+
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
1534 |
+
"homepage": "https://github.com/sebastianbergmann/version",
|
1535 |
+
"time": "2013-01-05T14:27:32+00:00"
|
1536 |
+
},
|
1537 |
+
{
|
1538 |
+
"name": "squizlabs/php_codesniffer",
|
1539 |
+
"version": "2.3.0",
|
1540 |
+
"source": {
|
1541 |
+
"type": "git",
|
1542 |
+
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
1543 |
+
"reference": "5046b0e01c416fc2b06df961d0673c85bcdc896c"
|
1544 |
+
},
|
1545 |
+
"dist": {
|
1546 |
+
"type": "zip",
|
1547 |
+
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5046b0e01c416fc2b06df961d0673c85bcdc896c",
|
1548 |
+
"reference": "5046b0e01c416fc2b06df961d0673c85bcdc896c",
|
1549 |
+
"shasum": ""
|
1550 |
+
},
|
1551 |
+
"require": {
|
1552 |
+
"ext-tokenizer": "*",
|
1553 |
+
"ext-xmlwriter": "*",
|
1554 |
+
"php": ">=5.1.2"
|
1555 |
+
},
|
1556 |
+
"bin": [
|
1557 |
+
"scripts/phpcs",
|
1558 |
+
"scripts/phpcbf"
|
1559 |
+
],
|
1560 |
+
"type": "library",
|
1561 |
+
"extra": {
|
1562 |
+
"branch-alias": {
|
1563 |
+
"dev-master": "2.0.x-dev"
|
1564 |
+
}
|
1565 |
+
},
|
1566 |
+
"autoload": {
|
1567 |
+
"classmap": [
|
1568 |
+
"CodeSniffer.php",
|
1569 |
+
"CodeSniffer/CLI.php",
|
1570 |
+
"CodeSniffer/Exception.php",
|
1571 |
+
"CodeSniffer/File.php",
|
1572 |
+
"CodeSniffer/Fixer.php",
|
1573 |
+
"CodeSniffer/Report.php",
|
1574 |
+
"CodeSniffer/Reporting.php",
|
1575 |
+
"CodeSniffer/Sniff.php",
|
1576 |
+
"CodeSniffer/Tokens.php",
|
1577 |
+
"CodeSniffer/Reports/",
|
1578 |
+
"CodeSniffer/Tokenizers/",
|
1579 |
+
"CodeSniffer/DocGenerators/",
|
1580 |
+
"CodeSniffer/Standards/AbstractPatternSniff.php",
|
1581 |
+
"CodeSniffer/Standards/AbstractScopeSniff.php",
|
1582 |
+
"CodeSniffer/Standards/AbstractVariableSniff.php",
|
1583 |
+
"CodeSniffer/Standards/IncorrectPatternException.php",
|
1584 |
+
"CodeSniffer/Standards/Generic/Sniffs/",
|
1585 |
+
"CodeSniffer/Standards/MySource/Sniffs/",
|
1586 |
+
"CodeSniffer/Standards/PEAR/Sniffs/",
|
1587 |
+
"CodeSniffer/Standards/PSR1/Sniffs/",
|
1588 |
+
"CodeSniffer/Standards/PSR2/Sniffs/",
|
1589 |
+
"CodeSniffer/Standards/Squiz/Sniffs/",
|
1590 |
+
"CodeSniffer/Standards/Zend/Sniffs/"
|
1591 |
+
]
|
1592 |
+
},
|
1593 |
+
"notification-url": "https://packagist.org/downloads/",
|
1594 |
+
"license": [
|
1595 |
+
"BSD-3-Clause"
|
1596 |
+
],
|
1597 |
+
"authors": [
|
1598 |
+
{
|
1599 |
+
"name": "Greg Sherwood",
|
1600 |
+
"role": "lead"
|
1601 |
+
}
|
1602 |
+
],
|
1603 |
+
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
1604 |
+
"homepage": "http://www.squizlabs.com/php-codesniffer",
|
1605 |
+
"keywords": [
|
1606 |
+
"phpcs",
|
1607 |
+
"standards"
|
1608 |
+
],
|
1609 |
+
"time": "2015-03-04T02:07:03+00:00"
|
1610 |
+
},
|
1611 |
+
{
|
1612 |
+
"name": "symfony/css-selector",
|
1613 |
+
"version": "v2.1.0",
|
1614 |
+
"target-dir": "Symfony/Component/CssSelector",
|
1615 |
+
"source": {
|
1616 |
+
"type": "git",
|
1617 |
+
"url": "https://github.com/symfony/css-selector.git",
|
1618 |
+
"reference": "676a7fd9b5027da85b58dd11db5561fef01c6271"
|
1619 |
+
},
|
1620 |
+
"dist": {
|
1621 |
+
"type": "zip",
|
1622 |
+
"url": "https://api.github.com/repos/symfony/css-selector/zipball/676a7fd9b5027da85b58dd11db5561fef01c6271",
|
1623 |
+
"reference": "676a7fd9b5027da85b58dd11db5561fef01c6271",
|
1624 |
+
"shasum": ""
|
1625 |
+
},
|
1626 |
+
"require": {
|
1627 |
+
"php": ">=5.3.3"
|
1628 |
+
},
|
1629 |
+
"type": "library",
|
1630 |
+
"extra": {
|
1631 |
+
"branch-alias": {
|
1632 |
+
"dev-master": "2.1-dev"
|
1633 |
+
}
|
1634 |
+
},
|
1635 |
+
"autoload": {
|
1636 |
+
"psr-0": {
|
1637 |
+
"Symfony\\Component\\CssSelector": ""
|
1638 |
+
}
|
1639 |
+
},
|
1640 |
+
"notification-url": "https://packagist.org/downloads/",
|
1641 |
+
"license": [
|
1642 |
+
"MIT"
|
1643 |
+
],
|
1644 |
+
"authors": [
|
1645 |
+
{
|
1646 |
+
"name": "Symfony Community",
|
1647 |
+
"homepage": "http://symfony.com/contributors"
|
1648 |
+
},
|
1649 |
+
{
|
1650 |
+
"name": "Fabien Potencier",
|
1651 |
+
"email": "fabien@symfony.com"
|
1652 |
+
}
|
1653 |
+
],
|
1654 |
+
"description": "Symfony CssSelector Component",
|
1655 |
+
"homepage": "http://symfony.com",
|
1656 |
+
"time": "2012-08-22T13:48:41+00:00"
|
1657 |
+
},
|
1658 |
+
{
|
1659 |
+
"name": "symfony/dom-crawler",
|
1660 |
+
"version": "v2.1.0",
|
1661 |
+
"target-dir": "Symfony/Component/DomCrawler",
|
1662 |
+
"source": {
|
1663 |
+
"type": "git",
|
1664 |
+
"url": "https://github.com/symfony/dom-crawler.git",
|
1665 |
+
"reference": "4a2af1b8f83341b637e47a66c6b6798730038edc"
|
1666 |
+
},
|
1667 |
+
"dist": {
|
1668 |
+
"type": "zip",
|
1669 |
+
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4a2af1b8f83341b637e47a66c6b6798730038edc",
|
1670 |
+
"reference": "4a2af1b8f83341b637e47a66c6b6798730038edc",
|
1671 |
+
"shasum": ""
|
1672 |
+
},
|
1673 |
+
"require": {
|
1674 |
+
"php": ">=5.3.3"
|
1675 |
+
},
|
1676 |
+
"require-dev": {
|
1677 |
+
"symfony/css-selector": "2.1.*"
|
1678 |
+
},
|
1679 |
+
"suggest": {
|
1680 |
+
"symfony/css-selector": "v2.1.0"
|
1681 |
+
},
|
1682 |
+
"type": "library",
|
1683 |
+
"extra": {
|
1684 |
+
"branch-alias": {
|
1685 |
+
"dev-master": "2.1-dev"
|
1686 |
+
}
|
1687 |
+
},
|
1688 |
+
"autoload": {
|
1689 |
+
"psr-0": {
|
1690 |
+
"Symfony\\Component\\DomCrawler": ""
|
1691 |
+
}
|
1692 |
+
},
|
1693 |
+
"notification-url": "https://packagist.org/downloads/",
|
1694 |
+
"license": [
|
1695 |
+
"MIT"
|
1696 |
+
],
|
1697 |
+
"authors": [
|
1698 |
+
{
|
1699 |
+
"name": "Symfony Community",
|
1700 |
+
"homepage": "http://symfony.com/contributors"
|
1701 |
+
},
|
1702 |
+
{
|
1703 |
+
"name": "Fabien Potencier",
|
1704 |
+
"email": "fabien@symfony.com"
|
1705 |
+
}
|
1706 |
+
],
|
1707 |
+
"description": "Symfony DomCrawler Component",
|
1708 |
+
"homepage": "http://symfony.com",
|
1709 |
+
"time": "2012-08-28T07:54:42+00:00"
|
1710 |
+
},
|
1711 |
+
{
|
1712 |
+
"name": "symfony/yaml",
|
1713 |
+
"version": "2.0.4",
|
1714 |
+
"source": {
|
1715 |
+
"type": "git",
|
1716 |
+
"url": "https://github.com/symfony/yaml.git",
|
1717 |
+
"reference": "e60c0d68640e662e88d879f0df139e022335a92a"
|
1718 |
+
},
|
1719 |
+
"dist": {
|
1720 |
+
"type": "zip",
|
1721 |
+
"url": "https://api.github.com/repos/symfony/yaml/zipball/e60c0d68640e662e88d879f0df139e022335a92a",
|
1722 |
+
"reference": "e60c0d68640e662e88d879f0df139e022335a92a",
|
1723 |
+
"shasum": ""
|
1724 |
+
},
|
1725 |
+
"require": {
|
1726 |
+
"php": ">=5.3.2"
|
1727 |
+
},
|
1728 |
+
"type": "library",
|
1729 |
+
"notification-url": "https://packagist.org/downloads/",
|
1730 |
+
"license": [
|
1731 |
+
"MIT"
|
1732 |
+
],
|
1733 |
+
"authors": [
|
1734 |
+
{
|
1735 |
+
"name": "Symfony Community",
|
1736 |
+
"homepage": "http://symfony.com/contributors"
|
1737 |
+
},
|
1738 |
+
{
|
1739 |
+
"name": "Fabien Potencier",
|
1740 |
+
"email": "fabien@symfony.com"
|
1741 |
+
}
|
1742 |
+
],
|
1743 |
+
"description": "Symfony Yaml Component",
|
1744 |
+
"homepage": "http://symfony.com",
|
1745 |
+
"time": "2011-09-26T22:55:43+00:00"
|
1746 |
+
}
|
1747 |
+
],
|
1748 |
+
"aliases": [],
|
1749 |
+
"minimum-stability": "stable",
|
1750 |
+
"stability-flags": [],
|
1751 |
+
"prefer-stable": false,
|
1752 |
+
"prefer-lowest": true,
|
1753 |
+
"platform": {
|
1754 |
+
"php": ">=5.4"
|
1755 |
+
},
|
1756 |
+
"platform-dev": []
|
1757 |
+
}
|
google/src/Google/AccessToken/Revoke.php
CHANGED
@@ -1,78 +1,78 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* Copyright 2008 Google Inc.
|
5 |
-
*
|
6 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
-
* you may not use this file except in compliance with the License.
|
8 |
-
* You may obtain a copy of the License at
|
9 |
-
*
|
10 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
-
*
|
12 |
-
* Unless required by applicable law or agreed to in writing, software
|
13 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
-
* See the License for the specific language governing permissions and
|
16 |
-
* limitations under the License.
|
17 |
-
*/
|
18 |
-
|
19 |
-
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
20 |
-
use GuzzleHttp\ClientInterface;
|
21 |
-
use GuzzleHttp\Psr7;
|
22 |
-
use GuzzleHttp\Psr7\Request;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Wrapper around Google Access Tokens which provides convenience functions
|
26 |
-
*
|
27 |
-
*/
|
28 |
-
class Google_AccessToken_Revoke
|
29 |
-
{
|
30 |
-
/**
|
31 |
-
* @var GuzzleHttp\ClientInterface The http client
|
32 |
-
*/
|
33 |
-
private $http;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Instantiates the class, but does not initiate the login flow, leaving it
|
37 |
-
* to the discretion of the caller.
|
38 |
-
*/
|
39 |
-
public function __construct(ClientInterface $http = null)
|
40 |
-
{
|
41 |
-
$this->http = $http;
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
46 |
-
* token, if a token isn't provided.
|
47 |
-
*
|
48 |
-
* @param string|array $token The token (access token or a refresh token) that should be revoked.
|
49 |
-
* @return boolean Returns True if the revocation was successful, otherwise False.
|
50 |
-
*/
|
51 |
-
public function revokeToken($token)
|
52 |
-
{
|
53 |
-
if (is_array($token)) {
|
54 |
-
if (isset($token['refresh_token'])) {
|
55 |
-
$token = $token['refresh_token'];
|
56 |
-
} else {
|
57 |
-
$token = $token['access_token'];
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
$body = Psr7\stream_for(http_build_query(array('token' => $token)));
|
62 |
-
$request = new Request(
|
63 |
-
'POST',
|
64 |
-
Google_Client::OAUTH2_REVOKE_URI,
|
65 |
-
[
|
66 |
-
'Cache-Control' => 'no-store',
|
67 |
-
'Content-Type' => 'application/x-www-form-urlencoded',
|
68 |
-
],
|
69 |
-
$body
|
70 |
-
);
|
71 |
-
|
72 |
-
$httpHandler = HttpHandlerFactory::build($this->http);
|
73 |
-
|
74 |
-
$response = $httpHandler($request);
|
75 |
-
|
76 |
-
return $response->getStatusCode() == 200;
|
77 |
-
}
|
78 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Copyright 2008 Google Inc.
|
5 |
+
*
|
6 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
+
* you may not use this file except in compliance with the License.
|
8 |
+
* You may obtain a copy of the License at
|
9 |
+
*
|
10 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
+
*
|
12 |
+
* Unless required by applicable law or agreed to in writing, software
|
13 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
+
* See the License for the specific language governing permissions and
|
16 |
+
* limitations under the License.
|
17 |
+
*/
|
18 |
+
|
19 |
+
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
20 |
+
use GuzzleHttp\ClientInterface;
|
21 |
+
use GuzzleHttp\Psr7;
|
22 |
+
use GuzzleHttp\Psr7\Request;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Wrapper around Google Access Tokens which provides convenience functions
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
class Google_AccessToken_Revoke
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @var GuzzleHttp\ClientInterface The http client
|
32 |
+
*/
|
33 |
+
private $http;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Instantiates the class, but does not initiate the login flow, leaving it
|
37 |
+
* to the discretion of the caller.
|
38 |
+
*/
|
39 |
+
public function __construct(ClientInterface $http = null)
|
40 |
+
{
|
41 |
+
$this->http = $http;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
46 |
+
* token, if a token isn't provided.
|
47 |
+
*
|
48 |
+
* @param string|array $token The token (access token or a refresh token) that should be revoked.
|
49 |
+
* @return boolean Returns True if the revocation was successful, otherwise False.
|
50 |
+
*/
|
51 |
+
public function revokeToken($token)
|
52 |
+
{
|
53 |
+
if (is_array($token)) {
|
54 |
+
if (isset($token['refresh_token'])) {
|
55 |
+
$token = $token['refresh_token'];
|
56 |
+
} else {
|
57 |
+
$token = $token['access_token'];
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
$body = Psr7\stream_for(http_build_query(array('token' => $token)));
|
62 |
+
$request = new Request(
|
63 |
+
'POST',
|
64 |
+
Google_Client::OAUTH2_REVOKE_URI,
|
65 |
+
[
|
66 |
+
'Cache-Control' => 'no-store',
|
67 |
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
68 |
+
],
|
69 |
+
$body
|
70 |
+
);
|
71 |
+
|
72 |
+
$httpHandler = HttpHandlerFactory::build($this->http);
|
73 |
+
|
74 |
+
$response = $httpHandler($request);
|
75 |
+
|
76 |
+
return $response->getStatusCode() == 200;
|
77 |
+
}
|
78 |
+
}
|
google/src/Google/AccessToken/Verify.php
CHANGED
@@ -1,272 +1,272 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* Copyright 2008 Google Inc.
|
5 |
-
*
|
6 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
-
* you may not use this file except in compliance with the License.
|
8 |
-
* You may obtain a copy of the License at
|
9 |
-
*
|
10 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
-
*
|
12 |
-
* Unless required by applicable law or agreed to in writing, software
|
13 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
-
* See the License for the specific language governing permissions and
|
16 |
-
* limitations under the License.
|
17 |
-
*/
|
18 |
-
|
19 |
-
use Firebase\JWT\ExpiredException as ExpiredExceptionV3;
|
20 |
-
use Firebase\JWT\SignatureInvalidException;
|
21 |
-
use GuzzleHttp\Client;
|
22 |
-
use GuzzleHttp\ClientInterface;
|
23 |
-
use Psr\Cache\CacheItemPoolInterface;
|
24 |
-
use Google\Auth\Cache\MemoryCacheItemPool;
|
25 |
-
use Stash\Driver\FileSystem;
|
26 |
-
use Stash\Pool;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Wrapper around Google Access Tokens which provides convenience functions
|
30 |
-
*
|
31 |
-
*/
|
32 |
-
class Google_AccessToken_Verify
|
33 |
-
{
|
34 |
-
const FEDERATED_SIGNON_CERT_URL = 'https://www.googleapis.com/oauth2/v3/certs';
|
35 |
-
const OAUTH2_ISSUER = 'accounts.google.com';
|
36 |
-
const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var GuzzleHttp\ClientInterface The http client
|
40 |
-
*/
|
41 |
-
private $http;
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @var Psr\Cache\CacheItemPoolInterface cache class
|
45 |
-
*/
|
46 |
-
private $cache;
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Instantiates the class, but does not initiate the login flow, leaving it
|
50 |
-
* to the discretion of the caller.
|
51 |
-
*/
|
52 |
-
public function __construct(
|
53 |
-
ClientInterface $http = null,
|
54 |
-
CacheItemPoolInterface $cache = null,
|
55 |
-
$jwt = null
|
56 |
-
) {
|
57 |
-
if (null === $http) {
|
58 |
-
$http = new Client();
|
59 |
-
}
|
60 |
-
|
61 |
-
if (null === $cache) {
|
62 |
-
$cache = new MemoryCacheItemPool;
|
63 |
-
}
|
64 |
-
|
65 |
-
$this->http = $http;
|
66 |
-
$this->cache = $cache;
|
67 |
-
$this->jwt = $jwt ?: $this->getJwtService();
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Verifies an id token and returns the authenticated apiLoginTicket.
|
72 |
-
* Throws an exception if the id token is not valid.
|
73 |
-
* The audience parameter can be used to control which id tokens are
|
74 |
-
* accepted. By default, the id token must have been issued to this OAuth2 client.
|
75 |
-
*
|
76 |
-
* @param $audience
|
77 |
-
* @return array the token payload, if successful
|
78 |
-
*/
|
79 |
-
public function verifyIdToken($idToken, $audience = null)
|
80 |
-
{
|
81 |
-
if (empty($idToken)) {
|
82 |
-
throw new LogicException('id_token cannot be null');
|
83 |
-
}
|
84 |
-
|
85 |
-
// set phpseclib constants if applicable
|
86 |
-
$this->setPhpsecConstants();
|
87 |
-
|
88 |
-
// Check signature
|
89 |
-
$certs = $this->getFederatedSignOnCerts();
|
90 |
-
foreach ($certs as $cert) {
|
91 |
-
$bigIntClass = $this->getBigIntClass();
|
92 |
-
$rsaClass = $this->getRsaClass();
|
93 |
-
$modulus = new $bigIntClass($this->jwt->urlsafeB64Decode($cert['n']), 256);
|
94 |
-
$exponent = new $bigIntClass($this->jwt->urlsafeB64Decode($cert['e']), 256);
|
95 |
-
|
96 |
-
$rsa = new $rsaClass();
|
97 |
-
$rsa->loadKey(array('n' => $modulus, 'e' => $exponent));
|
98 |
-
|
99 |
-
try {
|
100 |
-
$payload = $this->jwt->decode(
|
101 |
-
$idToken,
|
102 |
-
$rsa->getPublicKey(),
|
103 |
-
array('RS256')
|
104 |
-
);
|
105 |
-
|
106 |
-
if (property_exists($payload, 'aud')) {
|
107 |
-
if ($audience && $payload->aud != $audience) {
|
108 |
-
return false;
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
// support HTTP and HTTPS issuers
|
113 |
-
// @see https://developers.google.com/identity/sign-in/web/backend-auth
|
114 |
-
$issuers = array(self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS);
|
115 |
-
if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
|
116 |
-
return false;
|
117 |
-
}
|
118 |
-
|
119 |
-
return (array) $payload;
|
120 |
-
} catch (ExpiredException $e) {
|
121 |
-
return false;
|
122 |
-
} catch (ExpiredExceptionV3 $e) {
|
123 |
-
return false;
|
124 |
-
} catch (SignatureInvalidException $e) {
|
125 |
-
// continue
|
126 |
-
} catch (DomainException $e) {
|
127 |
-
// continue
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
return false;
|
132 |
-
}
|
133 |
-
|
134 |
-
private function getCache()
|
135 |
-
{
|
136 |
-
return $this->cache;
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Retrieve and cache a certificates file.
|
141 |
-
*
|
142 |
-
* @param $url string location
|
143 |
-
* @throws Google_Exception
|
144 |
-
* @return array certificates
|
145 |
-
*/
|
146 |
-
private function retrieveCertsFromLocation($url)
|
147 |
-
{
|
148 |
-
// If we're retrieving a local file, just grab it.
|
149 |
-
if (0 !== strpos($url, 'http')) {
|
150 |
-
if (!$file = file_get_contents($url)) {
|
151 |
-
throw new Google_Exception(
|
152 |
-
"Failed to retrieve verification certificates: '" .
|
153 |
-
$url . "'."
|
154 |
-
);
|
155 |
-
}
|
156 |
-
|
157 |
-
return json_decode($file, true);
|
158 |
-
}
|
159 |
-
|
160 |
-
$response = $this->http->get($url);
|
161 |
-
|
162 |
-
if ($response->getStatusCode() == 200) {
|
163 |
-
return json_decode((string) $response->getBody(), true);
|
164 |
-
}
|
165 |
-
throw new Google_Exception(
|
166 |
-
sprintf(
|
167 |
-
'Failed to retrieve verification certificates: "%s".',
|
168 |
-
$response->getBody()->getContents()
|
169 |
-
),
|
170 |
-
$response->getStatusCode()
|
171 |
-
);
|
172 |
-
}
|
173 |
-
|
174 |
-
// Gets federated sign-on certificates to use for verifying identity tokens.
|
175 |
-
// Returns certs as array structure, where keys are key ids, and values
|
176 |
-
// are PEM encoded certificates.
|
177 |
-
private function getFederatedSignOnCerts()
|
178 |
-
{
|
179 |
-
$certs = null;
|
180 |
-
if ($cache = $this->getCache()) {
|
181 |
-
$cacheItem = $cache->getItem('federated_signon_certs_v3', 3600);
|
182 |
-
$certs = $cacheItem->get();
|
183 |
-
}
|
184 |
-
|
185 |
-
|
186 |
-
if (!$certs) {
|
187 |
-
$certs = $this->retrieveCertsFromLocation(
|
188 |
-
self::FEDERATED_SIGNON_CERT_URL
|
189 |
-
);
|
190 |
-
|
191 |
-
if ($cache) {
|
192 |
-
$cacheItem->set($certs);
|
193 |
-
$cache->save($cacheItem);
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
if (!isset($certs['keys'])) {
|
198 |
-
throw new InvalidArgumentException(
|
199 |
-
'federated sign-on certs expects "keys" to be set'
|
200 |
-
);
|
201 |
-
}
|
202 |
-
|
203 |
-
return $certs['keys'];
|
204 |
-
}
|
205 |
-
|
206 |
-
private function getJwtService()
|
207 |
-
{
|
208 |
-
$jwtClass = 'JWT';
|
209 |
-
if (class_exists('\Firebase\JWT\JWT')) {
|
210 |
-
$jwtClass = 'Firebase\JWT\JWT';
|
211 |
-
}
|
212 |
-
|
213 |
-
if (property_exists($jwtClass, 'leeway')) {
|
214 |
-
// adds 1 second to JWT leeway
|
215 |
-
// @see https://github.com/google/google-api-php-client/issues/827
|
216 |
-
$jwtClass::$leeway = 1;
|
217 |
-
}
|
218 |
-
|
219 |
-
return new $jwtClass;
|
220 |
-
}
|
221 |
-
|
222 |
-
private function getRsaClass()
|
223 |
-
{
|
224 |
-
if (class_exists('phpseclib\Crypt\RSA')) {
|
225 |
-
return 'phpseclib\Crypt\RSA';
|
226 |
-
}
|
227 |
-
|
228 |
-
return 'Crypt_RSA';
|
229 |
-
}
|
230 |
-
|
231 |
-
private function getBigIntClass()
|
232 |
-
{
|
233 |
-
if (class_exists('phpseclib\Math\BigInteger')) {
|
234 |
-
return 'phpseclib\Math\BigInteger';
|
235 |
-
}
|
236 |
-
|
237 |
-
return 'Math_BigInteger';
|
238 |
-
}
|
239 |
-
|
240 |
-
private function getOpenSslConstant()
|
241 |
-
{
|
242 |
-
if (class_exists('phpseclib\Crypt\RSA')) {
|
243 |
-
return 'phpseclib\Crypt\RSA::MODE_OPENSSL';
|
244 |
-
}
|
245 |
-
|
246 |
-
if (class_exists('Crypt_RSA')) {
|
247 |
-
return 'CRYPT_RSA_MODE_OPENSSL';
|
248 |
-
}
|
249 |
-
|
250 |
-
throw new \Exception('Cannot find RSA class');
|
251 |
-
}
|
252 |
-
|
253 |
-
/**
|
254 |
-
* phpseclib calls "phpinfo" by default, which requires special
|
255 |
-
* whitelisting in the AppEngine VM environment. This function
|
256 |
-
* sets constants to bypass the need for phpseclib to check phpinfo
|
257 |
-
*
|
258 |
-
* @see phpseclib/Math/BigInteger
|
259 |
-
* @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85
|
260 |
-
*/
|
261 |
-
private function setPhpsecConstants()
|
262 |
-
{
|
263 |
-
if (filter_var(getenv('GAE_VM'), FILTER_VALIDATE_BOOLEAN)) {
|
264 |
-
if (!defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
|
265 |
-
define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
|
266 |
-
}
|
267 |
-
if (!defined('CRYPT_RSA_MODE')) {
|
268 |
-
define('CRYPT_RSA_MODE', constant($this->getOpenSslConstant()));
|
269 |
-
}
|
270 |
-
}
|
271 |
-
}
|
272 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Copyright 2008 Google Inc.
|
5 |
+
*
|
6 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
+
* you may not use this file except in compliance with the License.
|
8 |
+
* You may obtain a copy of the License at
|
9 |
+
*
|
10 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
+
*
|
12 |
+
* Unless required by applicable law or agreed to in writing, software
|
13 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
+
* See the License for the specific language governing permissions and
|
16 |
+
* limitations under the License.
|
17 |
+
*/
|
18 |
+
|
19 |
+
use Firebase\JWT\ExpiredException as ExpiredExceptionV3;
|
20 |
+
use Firebase\JWT\SignatureInvalidException;
|
21 |
+
use GuzzleHttp\Client;
|
22 |
+
use GuzzleHttp\ClientInterface;
|
23 |
+
use Psr\Cache\CacheItemPoolInterface;
|
24 |
+
use Google\Auth\Cache\MemoryCacheItemPool;
|
25 |
+
use Stash\Driver\FileSystem;
|
26 |
+
use Stash\Pool;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Wrapper around Google Access Tokens which provides convenience functions
|
30 |
+
*
|
31 |
+
*/
|
32 |
+
class Google_AccessToken_Verify
|
33 |
+
{
|
34 |
+
const FEDERATED_SIGNON_CERT_URL = 'https://www.googleapis.com/oauth2/v3/certs';
|
35 |
+
const OAUTH2_ISSUER = 'accounts.google.com';
|
36 |
+
const OAUTH2_ISSUER_HTTPS = 'https://accounts.google.com';
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var GuzzleHttp\ClientInterface The http client
|
40 |
+
*/
|
41 |
+
private $http;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var Psr\Cache\CacheItemPoolInterface cache class
|
45 |
+
*/
|
46 |
+
private $cache;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Instantiates the class, but does not initiate the login flow, leaving it
|
50 |
+
* to the discretion of the caller.
|
51 |
+
*/
|
52 |
+
public function __construct(
|
53 |
+
ClientInterface $http = null,
|
54 |
+
CacheItemPoolInterface $cache = null,
|
55 |
+
$jwt = null
|
56 |
+
) {
|
57 |
+
if (null === $http) {
|
58 |
+
$http = new Client();
|
59 |
+
}
|
60 |
+
|
61 |
+
if (null === $cache) {
|
62 |
+
$cache = new MemoryCacheItemPool;
|
63 |
+
}
|
64 |
+
|
65 |
+
$this->http = $http;
|
66 |
+
$this->cache = $cache;
|
67 |
+
$this->jwt = $jwt ?: $this->getJwtService();
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Verifies an id token and returns the authenticated apiLoginTicket.
|
72 |
+
* Throws an exception if the id token is not valid.
|
73 |
+
* The audience parameter can be used to control which id tokens are
|
74 |
+
* accepted. By default, the id token must have been issued to this OAuth2 client.
|
75 |
+
*
|
76 |
+
* @param $audience
|
77 |
+
* @return array the token payload, if successful
|
78 |
+
*/
|
79 |
+
public function verifyIdToken($idToken, $audience = null)
|
80 |
+
{
|
81 |
+
if (empty($idToken)) {
|
82 |
+
throw new LogicException('id_token cannot be null');
|
83 |
+
}
|
84 |
+
|
85 |
+
// set phpseclib constants if applicable
|
86 |
+
$this->setPhpsecConstants();
|
87 |
+
|
88 |
+
// Check signature
|
89 |
+
$certs = $this->getFederatedSignOnCerts();
|
90 |
+
foreach ($certs as $cert) {
|
91 |
+
$bigIntClass = $this->getBigIntClass();
|
92 |
+
$rsaClass = $this->getRsaClass();
|
93 |
+
$modulus = new $bigIntClass($this->jwt->urlsafeB64Decode($cert['n']), 256);
|
94 |
+
$exponent = new $bigIntClass($this->jwt->urlsafeB64Decode($cert['e']), 256);
|
95 |
+
|
96 |
+
$rsa = new $rsaClass();
|
97 |
+
$rsa->loadKey(array('n' => $modulus, 'e' => $exponent));
|
98 |
+
|
99 |
+
try {
|
100 |
+
$payload = $this->jwt->decode(
|
101 |
+
$idToken,
|
102 |
+
$rsa->getPublicKey(),
|
103 |
+
array('RS256')
|
104 |
+
);
|
105 |
+
|
106 |
+
if (property_exists($payload, 'aud')) {
|
107 |
+
if ($audience && $payload->aud != $audience) {
|
108 |
+
return false;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
// support HTTP and HTTPS issuers
|
113 |
+
// @see https://developers.google.com/identity/sign-in/web/backend-auth
|
114 |
+
$issuers = array(self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS);
|
115 |
+
if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) {
|
116 |
+
return false;
|
117 |
+
}
|
118 |
+
|
119 |
+
return (array) $payload;
|
120 |
+
} catch (ExpiredException $e) {
|
121 |
+
return false;
|
122 |
+
} catch (ExpiredExceptionV3 $e) {
|
123 |
+
return false;
|
124 |
+
} catch (SignatureInvalidException $e) {
|
125 |
+
// continue
|
126 |
+
} catch (DomainException $e) {
|
127 |
+
// continue
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
return false;
|
132 |
+
}
|
133 |
+
|
134 |
+
private function getCache()
|
135 |
+
{
|
136 |
+
return $this->cache;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Retrieve and cache a certificates file.
|
141 |
+
*
|
142 |
+
* @param $url string location
|
143 |
+
* @throws Google_Exception
|
144 |
+
* @return array certificates
|
145 |
+
*/
|
146 |
+
private function retrieveCertsFromLocation($url)
|
147 |
+
{
|
148 |
+
// If we're retrieving a local file, just grab it.
|
149 |
+
if (0 !== strpos($url, 'http')) {
|
150 |
+
if (!$file = file_get_contents($url)) {
|
151 |
+
throw new Google_Exception(
|
152 |
+
"Failed to retrieve verification certificates: '" .
|
153 |
+
$url . "'."
|
154 |
+
);
|
155 |
+
}
|
156 |
+
|
157 |
+
return json_decode($file, true);
|
158 |
+
}
|
159 |
+
|
160 |
+
$response = $this->http->get($url);
|
161 |
+
|
162 |
+
if ($response->getStatusCode() == 200) {
|
163 |
+
return json_decode((string) $response->getBody(), true);
|
164 |
+
}
|
165 |
+
throw new Google_Exception(
|
166 |
+
sprintf(
|
167 |
+
'Failed to retrieve verification certificates: "%s".',
|
168 |
+
$response->getBody()->getContents()
|
169 |
+
),
|
170 |
+
$response->getStatusCode()
|
171 |
+
);
|
172 |
+
}
|
173 |
+
|
174 |
+
// Gets federated sign-on certificates to use for verifying identity tokens.
|
175 |
+
// Returns certs as array structure, where keys are key ids, and values
|
176 |
+
// are PEM encoded certificates.
|
177 |
+
private function getFederatedSignOnCerts()
|
178 |
+
{
|
179 |
+
$certs = null;
|
180 |
+
if ($cache = $this->getCache()) {
|
181 |
+
$cacheItem = $cache->getItem('federated_signon_certs_v3', 3600);
|
182 |
+
$certs = $cacheItem->get();
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
if (!$certs) {
|
187 |
+
$certs = $this->retrieveCertsFromLocation(
|
188 |
+
self::FEDERATED_SIGNON_CERT_URL
|
189 |
+
);
|
190 |
+
|
191 |
+
if ($cache) {
|
192 |
+
$cacheItem->set($certs);
|
193 |
+
$cache->save($cacheItem);
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
if (!isset($certs['keys'])) {
|
198 |
+
throw new InvalidArgumentException(
|
199 |
+
'federated sign-on certs expects "keys" to be set'
|
200 |
+
);
|
201 |
+
}
|
202 |
+
|
203 |
+
return $certs['keys'];
|
204 |
+
}
|
205 |
+
|
206 |
+
private function getJwtService()
|
207 |
+
{
|
208 |
+
$jwtClass = 'JWT';
|
209 |
+
if (class_exists('\Firebase\JWT\JWT')) {
|
210 |
+
$jwtClass = 'Firebase\JWT\JWT';
|
211 |
+
}
|
212 |
+
|
213 |
+
if (property_exists($jwtClass, 'leeway')) {
|
214 |
+
// adds 1 second to JWT leeway
|
215 |
+
// @see https://github.com/google/google-api-php-client/issues/827
|
216 |
+
$jwtClass::$leeway = 1;
|
217 |
+
}
|
218 |
+
|
219 |
+
return new $jwtClass;
|
220 |
+
}
|
221 |
+
|
222 |
+
private function getRsaClass()
|
223 |
+
{
|
224 |
+
if (class_exists('phpseclib\Crypt\RSA')) {
|
225 |
+
return 'phpseclib\Crypt\RSA';
|
226 |
+
}
|
227 |
+
|
228 |
+
return 'Crypt_RSA';
|
229 |
+
}
|
230 |
+
|
231 |
+
private function getBigIntClass()
|
232 |
+
{
|
233 |
+
if (class_exists('phpseclib\Math\BigInteger')) {
|
234 |
+
return 'phpseclib\Math\BigInteger';
|
235 |
+
}
|
236 |
+
|
237 |
+
return 'Math_BigInteger';
|
238 |
+
}
|
239 |
+
|
240 |
+
private function getOpenSslConstant()
|
241 |
+
{
|
242 |
+
if (class_exists('phpseclib\Crypt\RSA')) {
|
243 |
+
return 'phpseclib\Crypt\RSA::MODE_OPENSSL';
|
244 |
+
}
|
245 |
+
|
246 |
+
if (class_exists('Crypt_RSA')) {
|
247 |
+
return 'CRYPT_RSA_MODE_OPENSSL';
|
248 |
+
}
|
249 |
+
|
250 |
+
throw new \Exception('Cannot find RSA class');
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* phpseclib calls "phpinfo" by default, which requires special
|
255 |
+
* whitelisting in the AppEngine VM environment. This function
|
256 |
+
* sets constants to bypass the need for phpseclib to check phpinfo
|
257 |
+
*
|
258 |
+
* @see phpseclib/Math/BigInteger
|
259 |
+
* @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85
|
260 |
+
*/
|
261 |
+
private function setPhpsecConstants()
|
262 |
+
{
|
263 |
+
if (filter_var(getenv('GAE_VM'), FILTER_VALIDATE_BOOLEAN)) {
|
264 |
+
if (!defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
|
265 |
+
define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
|
266 |
+
}
|
267 |
+
if (!defined('CRYPT_RSA_MODE')) {
|
268 |
+
define('CRYPT_RSA_MODE', constant($this->getOpenSslConstant()));
|
269 |
+
}
|
270 |
+
}
|
271 |
+
}
|
272 |
+
}
|
google/src/Google/AuthHandler/AuthHandlerFactory.php
CHANGED
@@ -1,42 +1,42 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2015 Google Inc. All Rights Reserved.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
use GuzzleHttp\Client;
|
19 |
-
use GuzzleHttp\ClientInterface;
|
20 |
-
|
21 |
-
class Google_AuthHandler_AuthHandlerFactory
|
22 |
-
{
|
23 |
-
/**
|
24 |
-
* Builds out a default http handler for the installed version of guzzle.
|
25 |
-
*
|
26 |
-
* @return Google_AuthHandler_Guzzle5AuthHandler|Google_AuthHandler_Guzzle6AuthHandler
|
27 |
-
* @throws Exception
|
28 |
-
*/
|
29 |
-
public static function build($cache = null, array $cacheConfig = [])
|
30 |
-
{
|
31 |
-
$version = ClientInterface::VERSION;
|
32 |
-
|
33 |
-
switch ($version[0]) {
|
34 |
-
case '5':
|
35 |
-
return new Google_AuthHandler_Guzzle5AuthHandler($cache, $cacheConfig);
|
36 |
-
case '6':
|
37 |
-
return new Google_AuthHandler_Guzzle6AuthHandler($cache, $cacheConfig);
|
38 |
-
default:
|
39 |
-
throw new Exception('Version not supported');
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright 2015 Google Inc. All Rights Reserved.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
use GuzzleHttp\Client;
|
19 |
+
use GuzzleHttp\ClientInterface;
|
20 |
+
|
21 |
+
class Google_AuthHandler_AuthHandlerFactory
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Builds out a default http handler for the installed version of guzzle.
|
25 |
+
*
|
26 |
+
* @return Google_AuthHandler_Guzzle5AuthHandler|Google_AuthHandler_Guzzle6AuthHandler
|
27 |
+
* @throws Exception
|
28 |
+
*/
|
29 |
+
public static function build($cache = null, array $cacheConfig = [])
|
30 |
+
{
|
31 |
+
$version = ClientInterface::VERSION;
|
32 |
+
|
33 |
+
switch ($version[0]) {
|
34 |
+
case '5':
|
35 |
+
return new Google_AuthHandler_Guzzle5AuthHandler($cache, $cacheConfig);
|
36 |
+
case '6':
|
37 |
+
return new Google_AuthHandler_Guzzle6AuthHandler($cache, $cacheConfig);
|
38 |
+
default:
|
39 |
+
throw new Exception('Version not supported');
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
google/src/Google/AuthHandler/Guzzle5AuthHandler.php
CHANGED
@@ -1,99 +1,99 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use Google\Auth\CredentialsLoader;
|
4 |
-
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
5 |
-
use Google\Auth\FetchAuthTokenCache;
|
6 |
-
use Google\Auth\Subscriber\AuthTokenSubscriber;
|
7 |
-
use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
|
8 |
-
use Google\Auth\Subscriber\SimpleSubscriber;
|
9 |
-
use GuzzleHttp\Client;
|
10 |
-
use GuzzleHttp\ClientInterface;
|
11 |
-
use Psr\Cache\CacheItemPoolInterface;
|
12 |
-
|
13 |
-
/**
|
14 |
-
*
|
15 |
-
*/
|
16 |
-
class Google_AuthHandler_Guzzle5AuthHandler
|
17 |
-
{
|
18 |
-
protected $cache;
|
19 |
-
protected $cacheConfig;
|
20 |
-
|
21 |
-
public function __construct(CacheItemPoolInterface $cache = null, array $cacheConfig = [])
|
22 |
-
{
|
23 |
-
$this->cache = $cache;
|
24 |
-
$this->cacheConfig = $cacheConfig;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function attachCredentials(
|
28 |
-
ClientInterface $http,
|
29 |
-
CredentialsLoader $credentials,
|
30 |
-
callable $tokenCallback = null
|
31 |
-
) {
|
32 |
-
// use the provided cache
|
33 |
-
if ($this->cache) {
|
34 |
-
$credentials = new FetchAuthTokenCache(
|
35 |
-
$credentials,
|
36 |
-
$this->cacheConfig,
|
37 |
-
$this->cache
|
38 |
-
);
|
39 |
-
}
|
40 |
-
// if we end up needing to make an HTTP request to retrieve credentials, we
|
41 |
-
// can use our existing one, but we need to throw exceptions so the error
|
42 |
-
// bubbles up.
|
43 |
-
$authHttp = $this->createAuthHttp($http);
|
44 |
-
$authHttpHandler = HttpHandlerFactory::build($authHttp);
|
45 |
-
$subscriber = new AuthTokenSubscriber(
|
46 |
-
$credentials,
|
47 |
-
$authHttpHandler,
|
48 |
-
$tokenCallback
|
49 |
-
);
|
50 |
-
|
51 |
-
$http->setDefaultOption('auth', 'google_auth');
|
52 |
-
$http->getEmitter()->attach($subscriber);
|
53 |
-
|
54 |
-
return $http;
|
55 |
-
}
|
56 |
-
|
57 |
-
public function attachToken(ClientInterface $http, array $token, array $scopes)
|
58 |
-
{
|
59 |
-
$tokenFunc = function ($scopes) use ($token) {
|
60 |
-
return $token['access_token'];
|
61 |
-
};
|
62 |
-
|
63 |
-
$subscriber = new ScopedAccessTokenSubscriber(
|
64 |
-
$tokenFunc,
|
65 |
-
$scopes,
|
66 |
-
$this->cacheConfig,
|
67 |
-
$this->cache
|
68 |
-
);
|
69 |
-
|
70 |
-
$http->setDefaultOption('auth', 'scoped');
|
71 |
-
$http->getEmitter()->attach($subscriber);
|
72 |
-
|
73 |
-
return $http;
|
74 |
-
}
|
75 |
-
|
76 |
-
public function attachKey(ClientInterface $http, $key)
|
77 |
-
{
|
78 |
-
$subscriber = new SimpleSubscriber(['key' => $key]);
|
79 |
-
|
80 |
-
$http->setDefaultOption('auth', 'simple');
|
81 |
-
$http->getEmitter()->attach($subscriber);
|
82 |
-
|
83 |
-
return $http;
|
84 |
-
}
|
85 |
-
|
86 |
-
private function createAuthHttp(ClientInterface $http)
|
87 |
-
{
|
88 |
-
return new Client(
|
89 |
-
[
|
90 |
-
'base_url' => $http->getBaseUrl(),
|
91 |
-
'defaults' => [
|
92 |
-
'exceptions' => true,
|
93 |
-
'verify' => $http->getDefaultOption('verify'),
|
94 |
-
'proxy' => $http->getDefaultOption('proxy'),
|
95 |
-
]
|
96 |
-
]
|
97 |
-
);
|
98 |
-
}
|
99 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Google\Auth\CredentialsLoader;
|
4 |
+
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
5 |
+
use Google\Auth\FetchAuthTokenCache;
|
6 |
+
use Google\Auth\Subscriber\AuthTokenSubscriber;
|
7 |
+
use Google\Auth\Subscriber\ScopedAccessTokenSubscriber;
|
8 |
+
use Google\Auth\Subscriber\SimpleSubscriber;
|
9 |
+
use GuzzleHttp\Client;
|
10 |
+
use GuzzleHttp\ClientInterface;
|
11 |
+
use Psr\Cache\CacheItemPoolInterface;
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Google_AuthHandler_Guzzle5AuthHandler
|
17 |
+
{
|
18 |
+
protected $cache;
|
19 |
+
protected $cacheConfig;
|
20 |
+
|
21 |
+
public function __construct(CacheItemPoolInterface $cache = null, array $cacheConfig = [])
|
22 |
+
{
|
23 |
+
$this->cache = $cache;
|
24 |
+
$this->cacheConfig = $cacheConfig;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function attachCredentials(
|
28 |
+
ClientInterface $http,
|
29 |
+
CredentialsLoader $credentials,
|
30 |
+
callable $tokenCallback = null
|
31 |
+
) {
|
32 |
+
// use the provided cache
|
33 |
+
if ($this->cache) {
|
34 |
+
$credentials = new FetchAuthTokenCache(
|
35 |
+
$credentials,
|
36 |
+
$this->cacheConfig,
|
37 |
+
$this->cache
|
38 |
+
);
|
39 |
+
}
|
40 |
+
// if we end up needing to make an HTTP request to retrieve credentials, we
|
41 |
+
// can use our existing one, but we need to throw exceptions so the error
|
42 |
+
// bubbles up.
|
43 |
+
$authHttp = $this->createAuthHttp($http);
|
44 |
+
$authHttpHandler = HttpHandlerFactory::build($authHttp);
|
45 |
+
$subscriber = new AuthTokenSubscriber(
|
46 |
+
$credentials,
|
47 |
+
$authHttpHandler,
|
48 |
+
$tokenCallback
|
49 |
+
);
|
50 |
+
|
51 |
+
$http->setDefaultOption('auth', 'google_auth');
|
52 |
+
$http->getEmitter()->attach($subscriber);
|
53 |
+
|
54 |
+
return $http;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function attachToken(ClientInterface $http, array $token, array $scopes)
|
58 |
+
{
|
59 |
+
$tokenFunc = function ($scopes) use ($token) {
|
60 |
+
return $token['access_token'];
|
61 |
+
};
|
62 |
+
|
63 |
+
$subscriber = new ScopedAccessTokenSubscriber(
|
64 |
+
$tokenFunc,
|
65 |
+
$scopes,
|
66 |
+
$this->cacheConfig,
|
67 |
+
$this->cache
|
68 |
+
);
|
69 |
+
|
70 |
+
$http->setDefaultOption('auth', 'scoped');
|
71 |
+
$http->getEmitter()->attach($subscriber);
|
72 |
+
|
73 |
+
return $http;
|
74 |
+
}
|
75 |
+
|
76 |
+
public function attachKey(ClientInterface $http, $key)
|
77 |
+
{
|
78 |
+
$subscriber = new SimpleSubscriber(['key' => $key]);
|
79 |
+
|
80 |
+
$http->setDefaultOption('auth', 'simple');
|
81 |
+
$http->getEmitter()->attach($subscriber);
|
82 |
+
|
83 |
+
return $http;
|
84 |
+
}
|
85 |
+
|
86 |
+
private function createAuthHttp(ClientInterface $http)
|
87 |
+
{
|
88 |
+
return new Client(
|
89 |
+
[
|
90 |
+
'base_url' => $http->getBaseUrl(),
|
91 |
+
'defaults' => [
|
92 |
+
'exceptions' => true,
|
93 |
+
'verify' => $http->getDefaultOption('verify'),
|
94 |
+
'proxy' => $http->getDefaultOption('proxy'),
|
95 |
+
]
|
96 |
+
]
|
97 |
+
);
|
98 |
+
}
|
99 |
+
}
|
google/src/Google/AuthHandler/Guzzle6AuthHandler.php
CHANGED
@@ -1,106 +1,106 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
use Google\Auth\CredentialsLoader;
|
4 |
-
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
5 |
-
use Google\Auth\FetchAuthTokenCache;
|
6 |
-
use Google\Auth\Middleware\AuthTokenMiddleware;
|
7 |
-
use Google\Auth\Middleware\ScopedAccessTokenMiddleware;
|
8 |
-
use Google\Auth\Middleware\SimpleMiddleware;
|
9 |
-
use GuzzleHttp\Client;
|
10 |
-
use GuzzleHttp\ClientInterface;
|
11 |
-
use Psr\Cache\CacheItemPoolInterface;
|
12 |
-
|
13 |
-
/**
|
14 |
-
*
|
15 |
-
*/
|
16 |
-
class Google_AuthHandler_Guzzle6AuthHandler
|
17 |
-
{
|
18 |
-
protected $cache;
|
19 |
-
protected $cacheConfig;
|
20 |
-
|
21 |
-
public function __construct(CacheItemPoolInterface $cache = null, array $cacheConfig = [])
|
22 |
-
{
|
23 |
-
$this->cache = $cache;
|
24 |
-
$this->cacheConfig = $cacheConfig;
|
25 |
-
}
|
26 |
-
|
27 |
-
public function attachCredentials(
|
28 |
-
ClientInterface $http,
|
29 |
-
CredentialsLoader $credentials,
|
30 |
-
callable $tokenCallback = null
|
31 |
-
) {
|
32 |
-
// use the provided cache
|
33 |
-
if ($this->cache) {
|
34 |
-
$credentials = new FetchAuthTokenCache(
|
35 |
-
$credentials,
|
36 |
-
$this->cacheConfig,
|
37 |
-
$this->cache
|
38 |
-
);
|
39 |
-
}
|
40 |
-
// if we end up needing to make an HTTP request to retrieve credentials, we
|
41 |
-
// can use our existing one, but we need to throw exceptions so the error
|
42 |
-
// bubbles up.
|
43 |
-
$authHttp = $this->createAuthHttp($http);
|
44 |
-
$authHttpHandler = HttpHandlerFactory::build($authHttp);
|
45 |
-
$middleware = new AuthTokenMiddleware(
|
46 |
-
$credentials,
|
47 |
-
$authHttpHandler,
|
48 |
-
$tokenCallback
|
49 |
-
);
|
50 |
-
|
51 |
-
$config = $http->getConfig();
|
52 |
-
$config['handler']->remove('google_auth');
|
53 |
-
$config['handler']->push($middleware, 'google_auth');
|
54 |
-
$config['auth'] = 'google_auth';
|
55 |
-
$http = new Client($config);
|
56 |
-
|
57 |
-
return $http;
|
58 |
-
}
|
59 |
-
|
60 |
-
public function attachToken(ClientInterface $http, array $token, array $scopes)
|
61 |
-
{
|
62 |
-
$tokenFunc = function ($scopes) use ($token) {
|
63 |
-
return $token['access_token'];
|
64 |
-
};
|
65 |
-
|
66 |
-
$middleware = new ScopedAccessTokenMiddleware(
|
67 |
-
$tokenFunc,
|
68 |
-
$scopes,
|
69 |
-
$this->cacheConfig,
|
70 |
-
$this->cache
|
71 |
-
);
|
72 |
-
|
73 |
-
$config = $http->getConfig();
|
74 |
-
$config['handler']->remove('google_auth');
|
75 |
-
$config['handler']->push($middleware, 'google_auth');
|
76 |
-
$config['auth'] = 'scoped';
|
77 |
-
$http = new Client($config);
|
78 |
-
|
79 |
-
return $http;
|
80 |
-
}
|
81 |
-
|
82 |
-
public function attachKey(ClientInterface $http, $key)
|
83 |
-
{
|
84 |
-
$middleware = new SimpleMiddleware(['key' => $key]);
|
85 |
-
|
86 |
-
$config = $http->getConfig();
|
87 |
-
$config['handler']->remove('google_auth');
|
88 |
-
$config['handler']->push($middleware, 'google_auth');
|
89 |
-
$config['auth'] = 'simple';
|
90 |
-
$http = new Client($config);
|
91 |
-
|
92 |
-
return $http;
|
93 |
-
}
|
94 |
-
|
95 |
-
private function createAuthHttp(ClientInterface $http)
|
96 |
-
{
|
97 |
-
return new Client(
|
98 |
-
[
|
99 |
-
'base_uri' => $http->getConfig('base_uri'),
|
100 |
-
'exceptions' => true,
|
101 |
-
'verify' => $http->getConfig('verify'),
|
102 |
-
'proxy' => $http->getConfig('proxy'),
|
103 |
-
]
|
104 |
-
);
|
105 |
-
}
|
106 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Google\Auth\CredentialsLoader;
|
4 |
+
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
5 |
+
use Google\Auth\FetchAuthTokenCache;
|
6 |
+
use Google\Auth\Middleware\AuthTokenMiddleware;
|
7 |
+
use Google\Auth\Middleware\ScopedAccessTokenMiddleware;
|
8 |
+
use Google\Auth\Middleware\SimpleMiddleware;
|
9 |
+
use GuzzleHttp\Client;
|
10 |
+
use GuzzleHttp\ClientInterface;
|
11 |
+
use Psr\Cache\CacheItemPoolInterface;
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Google_AuthHandler_Guzzle6AuthHandler
|
17 |
+
{
|
18 |
+
protected $cache;
|
19 |
+
protected $cacheConfig;
|
20 |
+
|
21 |
+
public function __construct(CacheItemPoolInterface $cache = null, array $cacheConfig = [])
|
22 |
+
{
|
23 |
+
$this->cache = $cache;
|
24 |
+
$this->cacheConfig = $cacheConfig;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function attachCredentials(
|
28 |
+
ClientInterface $http,
|
29 |
+
CredentialsLoader $credentials,
|
30 |
+
callable $tokenCallback = null
|
31 |
+
) {
|
32 |
+
// use the provided cache
|
33 |
+
if ($this->cache) {
|
34 |
+
$credentials = new FetchAuthTokenCache(
|
35 |
+
$credentials,
|
36 |
+
$this->cacheConfig,
|
37 |
+
$this->cache
|
38 |
+
);
|
39 |
+
}
|
40 |
+
// if we end up needing to make an HTTP request to retrieve credentials, we
|
41 |
+
// can use our existing one, but we need to throw exceptions so the error
|
42 |
+
// bubbles up.
|
43 |
+
$authHttp = $this->createAuthHttp($http);
|
44 |
+
$authHttpHandler = HttpHandlerFactory::build($authHttp);
|
45 |
+
$middleware = new AuthTokenMiddleware(
|
46 |
+
$credentials,
|
47 |
+
$authHttpHandler,
|
48 |
+
$tokenCallback
|
49 |
+
);
|
50 |
+
|
51 |
+
$config = $http->getConfig();
|
52 |
+
$config['handler']->remove('google_auth');
|
53 |
+
$config['handler']->push($middleware, 'google_auth');
|
54 |
+
$config['auth'] = 'google_auth';
|
55 |
+
$http = new Client($config);
|
56 |
+
|
57 |
+
return $http;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function attachToken(ClientInterface $http, array $token, array $scopes)
|
61 |
+
{
|
62 |
+
$tokenFunc = function ($scopes) use ($token) {
|
63 |
+
return $token['access_token'];
|
64 |
+
};
|
65 |
+
|
66 |
+
$middleware = new ScopedAccessTokenMiddleware(
|
67 |
+
$tokenFunc,
|
68 |
+
$scopes,
|
69 |
+
$this->cacheConfig,
|
70 |
+
$this->cache
|
71 |
+
);
|
72 |
+
|
73 |
+
$config = $http->getConfig();
|
74 |
+
$config['handler']->remove('google_auth');
|
75 |
+
$config['handler']->push($middleware, 'google_auth');
|
76 |
+
$config['auth'] = 'scoped';
|
77 |
+
$http = new Client($config);
|
78 |
+
|
79 |
+
return $http;
|
80 |
+
}
|
81 |
+
|
82 |
+
public function attachKey(ClientInterface $http, $key)
|
83 |
+
{
|
84 |
+
$middleware = new SimpleMiddleware(['key' => $key]);
|
85 |
+
|
86 |
+
$config = $http->getConfig();
|
87 |
+
$config['handler']->remove('google_auth');
|
88 |
+
$config['handler']->push($middleware, 'google_auth');
|
89 |
+
$config['auth'] = 'simple';
|
90 |
+
$http = new Client($config);
|
91 |
+
|
92 |
+
return $http;
|
93 |
+
}
|
94 |
+
|
95 |
+
private function createAuthHttp(ClientInterface $http)
|
96 |
+
{
|
97 |
+
return new Client(
|
98 |
+
[
|
99 |
+
'base_uri' => $http->getConfig('base_uri'),
|
100 |
+
'exceptions' => true,
|
101 |
+
'verify' => $http->getConfig('verify'),
|
102 |
+
'proxy' => $http->getConfig('proxy'),
|
103 |
+
]
|
104 |
+
);
|
105 |
+
}
|
106 |
+
}
|
google/src/Google/Client.php
CHANGED
@@ -1,1118 +1,1118 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2010 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
use Google\Auth\ApplicationDefaultCredentials;
|
19 |
-
use Google\Auth\Cache\MemoryCacheItemPool;
|
20 |
-
use Google\Auth\CredentialsLoader;
|
21 |
-
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
22 |
-
use Google\Auth\OAuth2;
|
23 |
-
use Google\Auth\Credentials\ServiceAccountCredentials;
|
24 |
-
use Google\Auth\Credentials\UserRefreshCredentials;
|
25 |
-
use GuzzleHttp\Client;
|
26 |
-
use GuzzleHttp\ClientInterface;
|
27 |
-
use GuzzleHttp\Ring\Client\StreamHandler;
|
28 |
-
use GuzzleHttp\Psr7;
|
29 |
-
use Psr\Cache\CacheItemPoolInterface;
|
30 |
-
use Psr\Http\Message\RequestInterface;
|
31 |
-
use Psr\Log\LoggerInterface;
|
32 |
-
use Monolog\Logger;
|
33 |
-
use Monolog\Handler\StreamHandler as MonologStreamHandler;
|
34 |
-
use Monolog\Handler\SyslogHandler as MonologSyslogHandler;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* The Google API Client
|
38 |
-
* https://github.com/google/google-api-php-client
|
39 |
-
*/
|
40 |
-
class Google_Client
|
41 |
-
{
|
42 |
-
const LIBVER = "2.2.1";
|
43 |
-
const USER_AGENT_SUFFIX = "google-api-php-client/";
|
44 |
-
const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
|
45 |
-
const OAUTH2_TOKEN_URI = 'https://www.googleapis.com/oauth2/v4/token';
|
46 |
-
const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
|
47 |
-
const API_BASE_PATH = 'https://www.googleapis.com';
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @var Google\Auth\OAuth2 $auth
|
51 |
-
*/
|
52 |
-
private $auth;
|
53 |
-
|
54 |
-
/**
|
55 |
-
* @var GuzzleHttp\ClientInterface $http
|
56 |
-
*/
|
57 |
-
private $http;
|
58 |
-
|
59 |
-
/**
|
60 |
-
* @var Psr\Cache\CacheItemPoolInterface $cache
|
61 |
-
*/
|
62 |
-
private $cache;
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @var array access token
|
66 |
-
*/
|
67 |
-
private $token;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @var array $config
|
71 |
-
*/
|
72 |
-
private $config;
|
73 |
-
|
74 |
-
/**
|
75 |
-
* @var Psr\Log\LoggerInterface $logger
|
76 |
-
*/
|
77 |
-
private $logger;
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @var boolean $deferExecution
|
81 |
-
*/
|
82 |
-
private $deferExecution = false;
|
83 |
-
|
84 |
-
/** @var array $scopes */
|
85 |
-
// Scopes requested by the client
|
86 |
-
protected $requestedScopes = [];
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Construct the Google Client.
|
90 |
-
*
|
91 |
-
* @param array $config
|
92 |
-
*/
|
93 |
-
public function __construct(array $config = array())
|
94 |
-
{
|
95 |
-
$this->config = array_merge(
|
96 |
-
[
|
97 |
-
'application_name' => '',
|
98 |
-
|
99 |
-
// Don't change these unless you're working against a special development
|
100 |
-
// or testing environment.
|
101 |
-
'base_path' => self::API_BASE_PATH,
|
102 |
-
|
103 |
-
// https://developers.google.com/console
|
104 |
-
'client_id' => '',
|
105 |
-
'client_secret' => '',
|
106 |
-
'redirect_uri' => null,
|
107 |
-
'state' => null,
|
108 |
-
|
109 |
-
// Simple API access key, also from the API console. Ensure you get
|
110 |
-
// a Server key, and not a Browser key.
|
111 |
-
'developer_key' => '',
|
112 |
-
|
113 |
-
// For use with Google Cloud Platform
|
114 |
-
// fetch the ApplicationDefaultCredentials, if applicable
|
115 |
-
// @see https://developers.google.com/identity/protocols/application-default-credentials
|
116 |
-
'use_application_default_credentials' => false,
|
117 |
-
'signing_key' => null,
|
118 |
-
'signing_algorithm' => null,
|
119 |
-
'subject' => null,
|
120 |
-
|
121 |
-
// Other OAuth2 parameters.
|
122 |
-
'hd' => '',
|
123 |
-
'prompt' => '',
|
124 |
-
'openid.realm' => '',
|
125 |
-
'include_granted_scopes' => null,
|
126 |
-
'login_hint' => '',
|
127 |
-
'request_visible_actions' => '',
|
128 |
-
'access_type' => 'online',
|
129 |
-
'approval_prompt' => 'auto',
|
130 |
-
|
131 |
-
// Task Runner retry configuration
|
132 |
-
// @see Google_Task_Runner
|
133 |
-
'retry' => array(),
|
134 |
-
|
135 |
-
// cache config for downstream auth caching
|
136 |
-
'cache_config' => [],
|
137 |
-
|
138 |
-
// function to be called when an access token is fetched
|
139 |
-
// follows the signature function ($cacheKey, $accessToken)
|
140 |
-
'token_callback' => null,
|
141 |
-
|
142 |
-
// Service class used in Google_Client::verifyIdToken.
|
143 |
-
// Explicitly pass this in to avoid setting JWT::$leeway
|
144 |
-
'jwt' => null,
|
145 |
-
],
|
146 |
-
$config
|
147 |
-
);
|
148 |
-
}
|
149 |
-
|
150 |
-
/**
|
151 |
-
* Get a string containing the version of the library.
|
152 |
-
*
|
153 |
-
* @return string
|
154 |
-
*/
|
155 |
-
public function getLibraryVersion()
|
156 |
-
{
|
157 |
-
return self::LIBVER;
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* For backwards compatibility
|
162 |
-
* alias for fetchAccessTokenWithAuthCode
|
163 |
-
*
|
164 |
-
* @param $code string code from accounts.google.com
|
165 |
-
* @return array access token
|
166 |
-
* @deprecated
|
167 |
-
*/
|
168 |
-
public function authenticate($code)
|
169 |
-
{
|
170 |
-
return $this->fetchAccessTokenWithAuthCode($code);
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Attempt to exchange a code for an valid authentication token.
|
175 |
-
* Helper wrapped around the OAuth 2.0 implementation.
|
176 |
-
*
|
177 |
-
* @param $code string code from accounts.google.com
|
178 |
-
* @return array access token
|
179 |
-
*/
|
180 |
-
public function fetchAccessTokenWithAuthCode($code)
|
181 |
-
{
|
182 |
-
if (strlen($code) == 0) {
|
183 |
-
throw new InvalidArgumentException("Invalid code");
|
184 |
-
}
|
185 |
-
|
186 |
-
$auth = $this->getOAuth2Service();
|
187 |
-
$auth->setCode($code);
|
188 |
-
$auth->setRedirectUri($this->getRedirectUri());
|
189 |
-
|
190 |
-
$httpHandler = HttpHandlerFactory::build($this->getHttpClient());
|
191 |
-
$creds = $auth->fetchAuthToken($httpHandler);
|
192 |
-
if ($creds && isset($creds['access_token'])) {
|
193 |
-
$creds['created'] = time();
|
194 |
-
$this->setAccessToken($creds);
|
195 |
-
}
|
196 |
-
|
197 |
-
return $creds;
|
198 |
-
}
|
199 |
-
|
200 |
-
/**
|
201 |
-
* For backwards compatibility
|
202 |
-
* alias for fetchAccessTokenWithAssertion
|
203 |
-
*
|
204 |
-
* @return array access token
|
205 |
-
* @deprecated
|
206 |
-
*/
|
207 |
-
public function refreshTokenWithAssertion()
|
208 |
-
{
|
209 |
-
return $this->fetchAccessTokenWithAssertion();
|
210 |
-
}
|
211 |
-
|
212 |
-
/**
|
213 |
-
* Fetches a fresh access token with a given assertion token.
|
214 |
-
* @param $assertionCredentials optional.
|
215 |
-
* @return array access token
|
216 |
-
*/
|
217 |
-
public function fetchAccessTokenWithAssertion(ClientInterface $authHttp = null)
|
218 |
-
{
|
219 |
-
if (!$this->isUsingApplicationDefaultCredentials()) {
|
220 |
-
throw new DomainException(
|
221 |
-
'set the JSON service account credentials using'
|
222 |
-
. ' Google_Client::setAuthConfig or set the path to your JSON file'
|
223 |
-
. ' with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable'
|
224 |
-
. ' and call Google_Client::useApplicationDefaultCredentials to'
|
225 |
-
. ' refresh a token with assertion.'
|
226 |
-
);
|
227 |
-
}
|
228 |
-
|
229 |
-
$this->getLogger()->log(
|
230 |
-
'info',
|
231 |
-
'OAuth2 access token refresh with Signed JWT assertion grants.'
|
232 |
-
);
|
233 |
-
|
234 |
-
$credentials = $this->createApplicationDefaultCredentials();
|
235 |
-
|
236 |
-
$httpHandler = HttpHandlerFactory::build($authHttp);
|
237 |
-
$creds = $credentials->fetchAuthToken($httpHandler);
|
238 |
-
if ($creds && isset($creds['access_token'])) {
|
239 |
-
$creds['created'] = time();
|
240 |
-
$this->setAccessToken($creds);
|
241 |
-
}
|
242 |
-
|
243 |
-
return $creds;
|
244 |
-
}
|
245 |
-
|
246 |
-
/**
|
247 |
-
* For backwards compatibility
|
248 |
-
* alias for fetchAccessTokenWithRefreshToken
|
249 |
-
*
|
250 |
-
* @param string $refreshToken
|
251 |
-
* @return array access token
|
252 |
-
*/
|
253 |
-
public function refreshToken($refreshToken)
|
254 |
-
{
|
255 |
-
return $this->fetchAccessTokenWithRefreshToken($refreshToken);
|
256 |
-
}
|
257 |
-
|
258 |
-
/**
|
259 |
-
* Fetches a fresh OAuth 2.0 access token with the given refresh token.
|
260 |
-
* @param string $refreshToken
|
261 |
-
* @return array access token
|
262 |
-
*/
|
263 |
-
public function fetchAccessTokenWithRefreshToken($refreshToken = null)
|
264 |
-
{
|
265 |
-
if (null === $refreshToken) {
|
266 |
-
if (!isset($this->token['refresh_token'])) {
|
267 |
-
throw new LogicException(
|
268 |
-
'refresh token must be passed in or set as part of setAccessToken'
|
269 |
-
);
|
270 |
-
}
|
271 |
-
$refreshToken = $this->token['refresh_token'];
|
272 |
-
}
|
273 |
-
$this->getLogger()->info('OAuth2 access token refresh');
|
274 |
-
$auth = $this->getOAuth2Service();
|
275 |
-
$auth->setRefreshToken($refreshToken);
|
276 |
-
|
277 |
-
$httpHandler = HttpHandlerFactory::build($this->getHttpClient());
|
278 |
-
$creds = $auth->fetchAuthToken($httpHandler);
|
279 |
-
if ($creds && isset($creds['access_token'])) {
|
280 |
-
$creds['created'] = time();
|
281 |
-
if (!isset($creds['refresh_token'])) {
|
282 |
-
$creds['refresh_token'] = $refreshToken;
|
283 |
-
}
|
284 |
-
$this->setAccessToken($creds);
|
285 |
-
}
|
286 |
-
|
287 |
-
return $creds;
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Create a URL to obtain user authorization.
|
292 |
-
* The authorization endpoint allows the user to first
|
293 |
-
* authenticate, and then grant/deny the access request.
|
294 |
-
* @param string|array $scope The scope is expressed as an array or list of space-delimited strings.
|
295 |
-
* @return string
|
296 |
-
*/
|
297 |
-
public function createAuthUrl($scope = null)
|
298 |
-
{
|
299 |
-
if (empty($scope)) {
|
300 |
-
$scope = $this->prepareScopes();
|
301 |
-
}
|
302 |
-
if (is_array($scope)) {
|
303 |
-
$scope = implode(' ', $scope);
|
304 |
-
}
|
305 |
-
|
306 |
-
// only accept one of prompt or approval_prompt
|
307 |
-
$approvalPrompt = $this->config['prompt']
|
308 |
-
? null
|
309 |
-
: $this->config['approval_prompt'];
|
310 |
-
|
311 |
-
// include_granted_scopes should be string "true", string "false", or null
|
312 |
-
$includeGrantedScopes = $this->config['include_granted_scopes'] === null
|
313 |
-
? null
|
314 |
-
: var_export($this->config['include_granted_scopes'], true);
|
315 |
-
|
316 |
-
$params = array_filter(
|
317 |
-
[
|
318 |
-
'access_type' => $this->config['access_type'],
|
319 |
-
'approval_prompt' => $approvalPrompt,
|
320 |
-
'hd' => $this->config['hd'],
|
321 |
-
'include_granted_scopes' => $includeGrantedScopes,
|
322 |
-
'login_hint' => $this->config['login_hint'],
|
323 |
-
'openid.realm' => $this->config['openid.realm'],
|
324 |
-
'prompt' => $this->config['prompt'],
|
325 |
-
'response_type' => 'code',
|
326 |
-
'scope' => $scope,
|
327 |
-
'state' => $this->config['state'],
|
328 |
-
]
|
329 |
-
);
|
330 |
-
|
331 |
-
// If the list of scopes contains plus.login, add request_visible_actions
|
332 |
-
// to auth URL.
|
333 |
-
$rva = $this->config['request_visible_actions'];
|
334 |
-
if (strlen($rva) > 0 && false !== strpos($scope, 'plus.login')) {
|
335 |
-
$params['request_visible_actions'] = $rva;
|
336 |
-
}
|
337 |
-
|
338 |
-
$auth = $this->getOAuth2Service();
|
339 |
-
|
340 |
-
return (string) $auth->buildFullAuthorizationUri($params);
|
341 |
-
}
|
342 |
-
|
343 |
-
/**
|
344 |
-
* Adds auth listeners to the HTTP client based on the credentials
|
345 |
-
* set in the Google API Client object
|
346 |
-
*
|
347 |
-
* @param GuzzleHttp\ClientInterface $http the http client object.
|
348 |
-
* @return GuzzleHttp\ClientInterface the http client object
|
349 |
-
*/
|
350 |
-
public function authorize(ClientInterface $http = null)
|
351 |
-
{
|
352 |
-
$credentials = null;
|
353 |
-
$token = null;
|
354 |
-
$scopes = null;
|
355 |
-
if (null === $http) {
|
356 |
-
$http = $this->getHttpClient();
|
357 |
-
}
|
358 |
-
|
359 |
-
// These conditionals represent the decision tree for authentication
|
360 |
-
// 1. Check for Application Default Credentials
|
361 |
-
// 2. Check for API Key
|
362 |
-
// 3a. Check for an Access Token
|
363 |
-
// 3b. If access token exists but is expired, try to refresh it
|
364 |
-
if ($this->isUsingApplicationDefaultCredentials()) {
|
365 |
-
$credentials = $this->createApplicationDefaultCredentials();
|
366 |
-
} elseif ($token = $this->getAccessToken()) {
|
367 |
-
$scopes = $this->prepareScopes();
|
368 |
-
// add refresh subscriber to request a new token
|
369 |
-
if (isset($token['refresh_token']) && $this->isAccessTokenExpired()) {
|
370 |
-
$credentials = $this->createUserRefreshCredentials(
|
371 |
-
$scopes,
|
372 |
-
$token['refresh_token']
|
373 |
-
);
|
374 |
-
}
|
375 |
-
}
|
376 |
-
|
377 |
-
$authHandler = $this->getAuthHandler();
|
378 |
-
|
379 |
-
if ($credentials) {
|
380 |
-
$callback = $this->config['token_callback'];
|
381 |
-
$http = $authHandler->attachCredentials($http, $credentials, $callback);
|
382 |
-
} elseif ($token) {
|
383 |
-
$http = $authHandler->attachToken($http, $token, (array) $scopes);
|
384 |
-
} elseif ($key = $this->config['developer_key']) {
|
385 |
-
$http = $authHandler->attachKey($http, $key);
|
386 |
-
}
|
387 |
-
|
388 |
-
return $http;
|
389 |
-
}
|
390 |
-
|
391 |
-
/**
|
392 |
-
* Set the configuration to use application default credentials for
|
393 |
-
* authentication
|
394 |
-
*
|
395 |
-
* @see https://developers.google.com/identity/protocols/application-default-credentials
|
396 |
-
* @param boolean $useAppCreds
|
397 |
-
*/
|
398 |
-
public function useApplicationDefaultCredentials($useAppCreds = true)
|
399 |
-
{
|
400 |
-
$this->config['use_application_default_credentials'] = $useAppCreds;
|
401 |
-
}
|
402 |
-
|
403 |
-
/**
|
404 |
-
* To prevent useApplicationDefaultCredentials from inappropriately being
|
405 |
-
* called in a conditional
|
406 |
-
*
|
407 |
-
* @see https://developers.google.com/identity/protocols/application-default-credentials
|
408 |
-
*/
|
409 |
-
public function isUsingApplicationDefaultCredentials()
|
410 |
-
{
|
411 |
-
return $this->config['use_application_default_credentials'];
|
412 |
-
}
|
413 |
-
|
414 |
-
/**
|
415 |
-
* @param string|array $token
|
416 |
-
* @throws InvalidArgumentException
|
417 |
-
*/
|
418 |
-
public function setAccessToken($token)
|
419 |
-
{
|
420 |
-
if (is_string($token)) {
|
421 |
-
if ($json = json_decode($token, true)) {
|
422 |
-
$token = $json;
|
423 |
-
} else {
|
424 |
-
// assume $token is just the token string
|
425 |
-
$token = array(
|
426 |
-
'access_token' => $token,
|
427 |
-
);
|
428 |
-
}
|
429 |
-
}
|
430 |
-
if ($token == null) {
|
431 |
-
throw new InvalidArgumentException('invalid json token');
|
432 |
-
}
|
433 |
-
if (!isset($token['access_token'])) {
|
434 |
-
throw new InvalidArgumentException("Invalid token format");
|
435 |
-
}
|
436 |
-
$this->token = $token;
|
437 |
-
}
|
438 |
-
|
439 |
-
public function getAccessToken()
|
440 |
-
{
|
441 |
-
return $this->token;
|
442 |
-
}
|
443 |
-
|
444 |
-
public function getRefreshToken()
|
445 |
-
{
|
446 |
-
if (isset($this->token['refresh_token'])) {
|
447 |
-
return $this->token['refresh_token'];
|
448 |
-
}
|
449 |
-
}
|
450 |
-
|
451 |
-
/**
|
452 |
-
* Returns if the access_token is expired.
|
453 |
-
* @return bool Returns True if the access_token is expired.
|
454 |
-
*/
|
455 |
-
public function isAccessTokenExpired()
|
456 |
-
{
|
457 |
-
if (!$this->token) {
|
458 |
-
return true;
|
459 |
-
}
|
460 |
-
|
461 |
-
$created = 0;
|
462 |
-
if (isset($this->token['created'])) {
|
463 |
-
$created = $this->token['created'];
|
464 |
-
} elseif (isset($this->token['id_token'])) {
|
465 |
-
// check the ID token for "iat"
|
466 |
-
// signature verification is not required here, as we are just
|
467 |
-
// using this for convenience to save a round trip request
|
468 |
-
// to the Google API server
|
469 |
-
$idToken = $this->token['id_token'];
|
470 |
-
if (substr_count($idToken, '.') == 2) {
|
471 |
-
$parts = explode('.', $idToken);
|
472 |
-
$payload = json_decode(base64_decode($parts[1]), true);
|
473 |
-
if ($payload && isset($payload['iat'])) {
|
474 |
-
$created = $payload['iat'];
|
475 |
-
}
|
476 |
-
}
|
477 |
-
}
|
478 |
-
|
479 |
-
// If the token is set to expire in the next 30 seconds.
|
480 |
-
return ($created + ($this->token['expires_in'] - 30)) < time();
|
481 |
-
}
|
482 |
-
|
483 |
-
public function getAuth()
|
484 |
-
{
|
485 |
-
throw new BadMethodCallException(
|
486 |
-
'This function no longer exists. See UPGRADING.md for more information'
|
487 |
-
);
|
488 |
-
}
|
489 |
-
|
490 |
-
public function setAuth($auth)
|
491 |
-
{
|
492 |
-
throw new BadMethodCallException(
|
493 |
-
'This function no longer exists. See UPGRADING.md for more information'
|
494 |
-
);
|
495 |
-
}
|
496 |
-
|
497 |
-
/**
|
498 |
-
* Set the OAuth 2.0 Client ID.
|
499 |
-
* @param string $clientId
|
500 |
-
*/
|
501 |
-
public function setClientId($clientId)
|
502 |
-
{
|
503 |
-
$this->config['client_id'] = $clientId;
|
504 |
-
}
|
505 |
-
|
506 |
-
public function getClientId()
|
507 |
-
{
|
508 |
-
return $this->config['client_id'];
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* Set the OAuth 2.0 Client Secret.
|
513 |
-
* @param string $clientSecret
|
514 |
-
*/
|
515 |
-
public function setClientSecret($clientSecret)
|
516 |
-
{
|
517 |
-
$this->config['client_secret'] = $clientSecret;
|
518 |
-
}
|
519 |
-
|
520 |
-
public function getClientSecret()
|
521 |
-
{
|
522 |
-
return $this->config['client_secret'];
|
523 |
-
}
|
524 |
-
|
525 |
-
/**
|
526 |
-
* Set the OAuth 2.0 Redirect URI.
|
527 |
-
* @param string $redirectUri
|
528 |
-
*/
|
529 |
-
public function setRedirectUri($redirectUri)
|
530 |
-
{
|
531 |
-
$this->config['redirect_uri'] = $redirectUri;
|
532 |
-
}
|
533 |
-
|
534 |
-
public function getRedirectUri()
|
535 |
-
{
|
536 |
-
return $this->config['redirect_uri'];
|
537 |
-
}
|
538 |
-
|
539 |
-
/**
|
540 |
-
* Set OAuth 2.0 "state" parameter to achieve per-request customization.
|
541 |
-
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
|
542 |
-
* @param string $state
|
543 |
-
*/
|
544 |
-
public function setState($state)
|
545 |
-
{
|
546 |
-
$this->config['state'] = $state;
|
547 |
-
}
|
548 |
-
|
549 |
-
/**
|
550 |
-
* @param string $accessType Possible values for access_type include:
|
551 |
-
* {@code "offline"} to request offline access from the user.
|
552 |
-
* {@code "online"} to request online access from the user.
|
553 |
-
*/
|
554 |
-
public function setAccessType($accessType)
|
555 |
-
{
|
556 |
-
$this->config['access_type'] = $accessType;
|
557 |
-
}
|
558 |
-
|
559 |
-
/**
|
560 |
-
* @param string $approvalPrompt Possible values for approval_prompt include:
|
561 |
-
* {@code "force"} to force the approval UI to appear.
|
562 |
-
* {@code "auto"} to request auto-approval when possible. (This is the default value)
|
563 |
-
*/
|
564 |
-
public function setApprovalPrompt($approvalPrompt)
|
565 |
-
{
|
566 |
-
$this->config['approval_prompt'] = $approvalPrompt;
|
567 |
-
}
|
568 |
-
|
569 |
-
/**
|
570 |
-
* Set the login hint, email address or sub id.
|
571 |
-
* @param string $loginHint
|
572 |
-
*/
|
573 |
-
public function setLoginHint($loginHint)
|
574 |
-
{
|
575 |
-
$this->config['login_hint'] = $loginHint;
|
576 |
-
}
|
577 |
-
|
578 |
-
/**
|
579 |
-
* Set the application name, this is included in the User-Agent HTTP header.
|
580 |
-
* @param string $applicationName
|
581 |
-
*/
|
582 |
-
public function setApplicationName($applicationName)
|
583 |
-
{
|
584 |
-
$this->config['application_name'] = $applicationName;
|
585 |
-
}
|
586 |
-
|
587 |
-
/**
|
588 |
-
* If 'plus.login' is included in the list of requested scopes, you can use
|
589 |
-
* this method to define types of app activities that your app will write.
|
590 |
-
* You can find a list of available types here:
|
591 |
-
* @link https://developers.google.com/+/api/moment-types
|
592 |
-
*
|
593 |
-
* @param array $requestVisibleActions Array of app activity types
|
594 |
-
*/
|
595 |
-
public function setRequestVisibleActions($requestVisibleActions)
|
596 |
-
{
|
597 |
-
if (is_array($requestVisibleActions)) {
|
598 |
-
$requestVisibleActions = implode(" ", $requestVisibleActions);
|
599 |
-
}
|
600 |
-
$this->config['request_visible_actions'] = $requestVisibleActions;
|
601 |
-
}
|
602 |
-
|
603 |
-
/**
|
604 |
-
* Set the developer key to use, these are obtained through the API Console.
|
605 |
-
* @see http://code.google.com/apis/console-help/#generatingdevkeys
|
606 |
-
* @param string $developerKey
|
607 |
-
*/
|
608 |
-
public function setDeveloperKey($developerKey)
|
609 |
-
{
|
610 |
-
$this->config['developer_key'] = $developerKey;
|
611 |
-
}
|
612 |
-
|
613 |
-
/**
|
614 |
-
* Set the hd (hosted domain) parameter streamlines the login process for
|
615 |
-
* Google Apps hosted accounts. By including the domain of the user, you
|
616 |
-
* restrict sign-in to accounts at that domain.
|
617 |
-
* @param $hd string - the domain to use.
|
618 |
-
*/
|
619 |
-
public function setHostedDomain($hd)
|
620 |
-
{
|
621 |
-
$this->config['hd'] = $hd;
|
622 |
-
}
|
623 |
-
|
624 |
-
/**
|
625 |
-
* Set the prompt hint. Valid values are none, consent and select_account.
|
626 |
-
* If no value is specified and the user has not previously authorized
|
627 |
-
* access, then the user is shown a consent screen.
|
628 |
-
* @param $prompt string
|
629 |
-
*/
|
630 |
-
public function setPrompt($prompt)
|
631 |
-
{
|
632 |
-
$this->config['prompt'] = $prompt;
|
633 |
-
}
|
634 |
-
|
635 |
-
/**
|
636 |
-
* openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
|
637 |
-
* 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
|
638 |
-
* an authentication request is valid.
|
639 |
-
* @param $realm string - the URL-space to use.
|
640 |
-
*/
|
641 |
-
public function setOpenidRealm($realm)
|
642 |
-
{
|
643 |
-
$this->config['openid.realm'] = $realm;
|
644 |
-
}
|
645 |
-
|
646 |
-
/**
|
647 |
-
* If this is provided with the value true, and the authorization request is
|
648 |
-
* granted, the authorization will include any previous authorizations
|
649 |
-
* granted to this user/application combination for other scopes.
|
650 |
-
* @param $include boolean - the URL-space to use.
|
651 |
-
*/
|
652 |
-
public function setIncludeGrantedScopes($include)
|
653 |
-
{
|
654 |
-
$this->config['include_granted_scopes'] = $include;
|
655 |
-
}
|
656 |
-
|
657 |
-
/**
|
658 |
-
* sets function to be called when an access token is fetched
|
659 |
-
* @param callable $tokenCallback - function ($cacheKey, $accessToken)
|
660 |
-
*/
|
661 |
-
public function setTokenCallback(callable $tokenCallback)
|
662 |
-
{
|
663 |
-
$this->config['token_callback'] = $tokenCallback;
|
664 |
-
}
|
665 |
-
|
666 |
-
/**
|
667 |
-
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
668 |
-
* token, if a token isn't provided.
|
669 |
-
*
|
670 |
-
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
671 |
-
* @return boolean Returns True if the revocation was successful, otherwise False.
|
672 |
-
*/
|
673 |
-
public function revokeToken($token = null)
|
674 |
-
{
|
675 |
-
$tokenRevoker = new Google_AccessToken_Revoke(
|
676 |
-
$this->getHttpClient()
|
677 |
-
);
|
678 |
-
|
679 |
-
return $tokenRevoker->revokeToken($token ?: $this->getAccessToken());
|
680 |
-
}
|
681 |
-
|
682 |
-
/**
|
683 |
-
* Verify an id_token. This method will verify the current id_token, if one
|
684 |
-
* isn't provided.
|
685 |
-
*
|
686 |
-
* @throws LogicException
|
687 |
-
* @param string|null $idToken The token (id_token) that should be verified.
|
688 |
-
* @return array|false Returns the token payload as an array if the verification was
|
689 |
-
* successful, false otherwise.
|
690 |
-
*/
|
691 |
-
public function verifyIdToken($idToken = null)
|
692 |
-
{
|
693 |
-
$tokenVerifier = new Google_AccessToken_Verify(
|
694 |
-
$this->getHttpClient(),
|
695 |
-
$this->getCache(),
|
696 |
-
$this->config['jwt']
|
697 |
-
);
|
698 |
-
|
699 |
-
if (null === $idToken) {
|
700 |
-
$token = $this->getAccessToken();
|
701 |
-
if (!isset($token['id_token'])) {
|
702 |
-
throw new LogicException(
|
703 |
-
'id_token must be passed in or set as part of setAccessToken'
|
704 |
-
);
|
705 |
-
}
|
706 |
-
$idToken = $token['id_token'];
|
707 |
-
}
|
708 |
-
|
709 |
-
return $tokenVerifier->verifyIdToken(
|
710 |
-
$idToken,
|
711 |
-
$this->getClientId()
|
712 |
-
);
|
713 |
-
}
|
714 |
-
|
715 |
-
/**
|
716 |
-
* Set the scopes to be requested. Must be called before createAuthUrl().
|
717 |
-
* Will remove any previously configured scopes.
|
718 |
-
* @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login',
|
719 |
-
* 'https://www.googleapis.com/auth/moderator')
|
720 |
-
*/
|
721 |
-
public function setScopes($scopes)
|
722 |
-
{
|
723 |
-
$this->requestedScopes = array();
|
724 |
-
$this->addScope($scopes);
|
725 |
-
}
|
726 |
-
|
727 |
-
/**
|
728 |
-
* This functions adds a scope to be requested as part of the OAuth2.0 flow.
|
729 |
-
* Will append any scopes not previously requested to the scope parameter.
|
730 |
-
* A single string will be treated as a scope to request. An array of strings
|
731 |
-
* will each be appended.
|
732 |
-
* @param $scope_or_scopes string|array e.g. "profile"
|
733 |
-
*/
|
734 |
-
public function addScope($scope_or_scopes)
|
735 |
-
{
|
736 |
-
if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
|
737 |
-
$this->requestedScopes[] = $scope_or_scopes;
|
738 |
-
} else if (is_array($scope_or_scopes)) {
|
739 |
-
foreach ($scope_or_scopes as $scope) {
|
740 |
-
$this->addScope($scope);
|
741 |
-
}
|
742 |
-
}
|
743 |
-
}
|
744 |
-
|
745 |
-
/**
|
746 |
-
* Returns the list of scopes requested by the client
|
747 |
-
* @return array the list of scopes
|
748 |
-
*
|
749 |
-
*/
|
750 |
-
public function getScopes()
|
751 |
-
{
|
752 |
-
return $this->requestedScopes;
|
753 |
-
}
|
754 |
-
|
755 |
-
/**
|
756 |
-
* @return array
|
757 |
-
* @visible For Testing
|
758 |
-
*/
|
759 |
-
public function prepareScopes()
|
760 |
-
{
|
761 |
-
if (empty($this->requestedScopes)) {
|
762 |
-
return null;
|
763 |
-
}
|
764 |
-
|
765 |
-
return implode(' ', $this->requestedScopes);
|
766 |
-
}
|
767 |
-
|
768 |
-
/**
|
769 |
-
* Helper method to execute deferred HTTP requests.
|
770 |
-
*
|
771 |
-
* @param $request Psr\Http\Message\RequestInterface|Google_Http_Batch
|
772 |
-
* @throws Google_Exception
|
773 |
-
* @return object of the type of the expected class or Psr\Http\Message\ResponseInterface.
|
774 |
-
*/
|
775 |
-
public function execute(RequestInterface $request, $expectedClass = null)
|
776 |
-
{
|
777 |
-
$request = $request->withHeader(
|
778 |
-
'User-Agent',
|
779 |
-
$this->config['application_name']
|
780 |
-
. " " . self::USER_AGENT_SUFFIX
|
781 |
-
. $this->getLibraryVersion()
|
782 |
-
);
|
783 |
-
|
784 |
-
// call the authorize method
|
785 |
-
// this is where most of the grunt work is done
|
786 |
-
$http = $this->authorize();
|
787 |
-
|
788 |
-
return Google_Http_REST::execute($http, $request, $expectedClass, $this->config['retry']);
|
789 |
-
}
|
790 |
-
|
791 |
-
/**
|
792 |
-
* Declare whether batch calls should be used. This may increase throughput
|
793 |
-
* by making multiple requests in one connection.
|
794 |
-
*
|
795 |
-
* @param boolean $useBatch True if the batch support should
|
796 |
-
* be enabled. Defaults to False.
|
797 |
-
*/
|
798 |
-
public function setUseBatch($useBatch)
|
799 |
-
{
|
800 |
-
// This is actually an alias for setDefer.
|
801 |
-
$this->setDefer($useBatch);
|
802 |
-
}
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Are we running in Google AppEngine?
|
806 |
-
* return bool
|
807 |
-
*/
|
808 |
-
public function isAppEngine()
|
809 |
-
{
|
810 |
-
return (isset($_SERVER['SERVER_SOFTWARE']) &&
|
811 |
-
strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
|
812 |
-
}
|
813 |
-
|
814 |
-
public function setConfig($name, $value)
|
815 |
-
{
|
816 |
-
$this->config[$name] = $value;
|
817 |
-
}
|
818 |
-
|
819 |
-
public function getConfig($name, $default = null)
|
820 |
-
{
|
821 |
-
return isset($this->config[$name]) ? $this->config[$name] : $default;
|
822 |
-
}
|
823 |
-
|
824 |
-
/**
|
825 |
-
* For backwards compatibility
|
826 |
-
* alias for setAuthConfig
|
827 |
-
*
|
828 |
-
* @param string $file the configuration file
|
829 |
-
* @throws Google_Exception
|
830 |
-
* @deprecated
|
831 |
-
*/
|
832 |
-
public function setAuthConfigFile($file)
|
833 |
-
{
|
834 |
-
$this->setAuthConfig($file);
|
835 |
-
}
|
836 |
-
|
837 |
-
/**
|
838 |
-
* Set the auth config from new or deprecated JSON config.
|
839 |
-
* This structure should match the file downloaded from
|
840 |
-
* the "Download JSON" button on in the Google Developer
|
841 |
-
* Console.
|
842 |
-
* @param string|array $config the configuration json
|
843 |
-
* @throws Google_Exception
|
844 |
-
*/
|
845 |
-
public function setAuthConfig($config)
|
846 |
-
{
|
847 |
-
if (is_string($config)) {
|
848 |
-
if (!file_exists($config)) {
|
849 |
-
throw new InvalidArgumentException('file does not exist');
|
850 |
-
}
|
851 |
-
|
852 |
-
$json = file_get_contents($config);
|
853 |
-
|
854 |
-
if (!$config = json_decode($json, true)) {
|
855 |
-
throw new LogicException('invalid json for auth config');
|
856 |
-
}
|
857 |
-
}
|
858 |
-
|
859 |
-
$key = isset($config['installed']) ? 'installed' : 'web';
|
860 |
-
if (isset($config['type']) && $config['type'] == 'service_account') {
|
861 |
-
// application default credentials
|
862 |
-
$this->useApplicationDefaultCredentials();
|
863 |
-
|
864 |
-
// set the information from the config
|
865 |
-
$this->setClientId($config['client_id']);
|
866 |
-
$this->config['client_email'] = $config['client_email'];
|
867 |
-
$this->config['signing_key'] = $config['private_key'];
|
868 |
-
$this->config['signing_algorithm'] = 'HS256';
|
869 |
-
} elseif (isset($config[$key])) {
|
870 |
-
// old-style
|
871 |
-
$this->setClientId($config[$key]['client_id']);
|
872 |
-
$this->setClientSecret($config[$key]['client_secret']);
|
873 |
-
if (isset($config[$key]['redirect_uris'])) {
|
874 |
-
$this->setRedirectUri($config[$key]['redirect_uris'][0]);
|
875 |
-
}
|
876 |
-
} else {
|
877 |
-
// new-style
|
878 |
-
$this->setClientId($config['client_id']);
|
879 |
-
$this->setClientSecret($config['client_secret']);
|
880 |
-
if (isset($config['redirect_uris'])) {
|
881 |
-
$this->setRedirectUri($config['redirect_uris'][0]);
|
882 |
-
}
|
883 |
-
}
|
884 |
-
}
|
885 |
-
|
886 |
-
/**
|
887 |
-
* Use when the service account has been delegated domain wide access.
|
888 |
-
*
|
889 |
-
* @param string subject an email address account to impersonate
|
890 |
-
*/
|
891 |
-
public function setSubject($subject)
|
892 |
-
{
|
893 |
-
$this->config['subject'] = $subject;
|
894 |
-
}
|
895 |
-
|
896 |
-
/**
|
897 |
-
* Declare whether making API calls should make the call immediately, or
|
898 |
-
* return a request which can be called with ->execute();
|
899 |
-
*
|
900 |
-
* @param boolean $defer True if calls should not be executed right away.
|
901 |
-
*/
|
902 |
-
public function setDefer($defer)
|
903 |
-
{
|
904 |
-
$this->deferExecution = $defer;
|
905 |
-
}
|
906 |
-
|
907 |
-
/**
|
908 |
-
* Whether or not to return raw requests
|
909 |
-
* @return boolean
|
910 |
-
*/
|
911 |
-
public function shouldDefer()
|
912 |
-
{
|
913 |
-
return $this->deferExecution;
|
914 |
-
}
|
915 |
-
|
916 |
-
/**
|
917 |
-
* @return Google\Auth\OAuth2 implementation
|
918 |
-
*/
|
919 |
-
public function getOAuth2Service()
|
920 |
-
{
|
921 |
-
if (!isset($this->auth)) {
|
922 |
-
$this->auth = $this->createOAuth2Service();
|
923 |
-
}
|
924 |
-
|
925 |
-
return $this->auth;
|
926 |
-
}
|
927 |
-
|
928 |
-
/**
|
929 |
-
* create a default google auth object
|
930 |
-
*/
|
931 |
-
protected function createOAuth2Service()
|
932 |
-
{
|
933 |
-
$auth = new OAuth2(
|
934 |
-
[
|
935 |
-
'clientId' => $this->getClientId(),
|
936 |
-
'clientSecret' => $this->getClientSecret(),
|
937 |
-
'authorizationUri' => self::OAUTH2_AUTH_URL,
|
938 |
-
'tokenCredentialUri' => self::OAUTH2_TOKEN_URI,
|
939 |
-
'redirectUri' => $this->getRedirectUri(),
|
940 |
-
'issuer' => $this->config['client_id'],
|
941 |
-
'signingKey' => $this->config['signing_key'],
|
942 |
-
'signingAlgorithm' => $this->config['signing_algorithm'],
|
943 |
-
]
|
944 |
-
);
|
945 |
-
|
946 |
-
return $auth;
|
947 |
-
}
|
948 |
-
|
949 |
-
/**
|
950 |
-
* Set the Cache object
|
951 |
-
* @param Psr\Cache\CacheItemPoolInterface $cache
|
952 |
-
*/
|
953 |
-
public function setCache(CacheItemPoolInterface $cache)
|
954 |
-
{
|
955 |
-
$this->cache = $cache;
|
956 |
-
}
|
957 |
-
|
958 |
-
/**
|
959 |
-
* @return Psr\Cache\CacheItemPoolInterface Cache implementation
|
960 |
-
*/
|
961 |
-
public function getCache()
|
962 |
-
{
|
963 |
-
if (!$this->cache) {
|
964 |
-
$this->cache = $this->createDefaultCache();
|
965 |
-
}
|
966 |
-
|
967 |
-
return $this->cache;
|
968 |
-
}
|
969 |
-
|
970 |
-
/**
|
971 |
-
* @return Google\Auth\CacheInterface Cache implementation
|
972 |
-
*/
|
973 |
-
public function setCacheConfig(array $cacheConfig)
|
974 |
-
{
|
975 |
-
$this->config['cache_config'] = $cacheConfig;
|
976 |
-
}
|
977 |
-
|
978 |
-
/**
|
979 |
-
* Set the Logger object
|
980 |
-
* @param Psr\Log\LoggerInterface $logger
|
981 |
-
*/
|
982 |
-
public function setLogger(LoggerInterface $logger)
|
983 |
-
{
|
984 |
-
$this->logger = $logger;
|
985 |
-
}
|
986 |
-
|
987 |
-
/**
|
988 |
-
* @return Psr\Log\LoggerInterface implementation
|
989 |
-
*/
|
990 |
-
public function getLogger()
|
991 |
-
{
|
992 |
-
if (!isset($this->logger)) {
|
993 |
-
$this->logger = $this->createDefaultLogger();
|
994 |
-
}
|
995 |
-
|
996 |
-
return $this->logger;
|
997 |
-
}
|
998 |
-
|
999 |
-
protected function createDefaultLogger()
|
1000 |
-
{
|
1001 |
-
$logger = new Logger('google-api-php-client');
|
1002 |
-
if ($this->isAppEngine()) {
|
1003 |
-
$handler = new MonologSyslogHandler('app', LOG_USER, Logger::NOTICE);
|
1004 |
-
} else {
|
1005 |
-
$handler = new MonologStreamHandler('php://stderr', Logger::NOTICE);
|
1006 |
-
}
|
1007 |
-
$logger->pushHandler($handler);
|
1008 |
-
|
1009 |
-
return $logger;
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
protected function createDefaultCache()
|
1013 |
-
{
|
1014 |
-
return new MemoryCacheItemPool;
|
1015 |
-
}
|
1016 |
-
|
1017 |
-
/**
|
1018 |
-
* Set the Http Client object
|
1019 |
-
* @param GuzzleHttp\ClientInterface $http
|
1020 |
-
*/
|
1021 |
-
public function setHttpClient(ClientInterface $http)
|
1022 |
-
{
|
1023 |
-
$this->http = $http;
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
/**
|
1027 |
-
* @return GuzzleHttp\ClientInterface implementation
|
1028 |
-
*/
|
1029 |
-
public function getHttpClient()
|
1030 |
-
{
|
1031 |
-
if (null === $this->http) {
|
1032 |
-
$this->http = $this->createDefaultHttpClient();
|
1033 |
-
}
|
1034 |
-
|
1035 |
-
return $this->http;
|
1036 |
-
}
|
1037 |
-
|
1038 |
-
protected function createDefaultHttpClient()
|
1039 |
-
{
|
1040 |
-
$options = ['exceptions' => false];
|
1041 |
-
|
1042 |
-
$version = ClientInterface::VERSION;
|
1043 |
-
if ('5' === $version[0]) {
|
1044 |
-
$options = [
|
1045 |
-
'base_url' => $this->config['base_path'],
|
1046 |
-
'defaults' => $options,
|
1047 |
-
];
|
1048 |
-
if ($this->isAppEngine()) {
|
1049 |
-
// set StreamHandler on AppEngine by default
|
1050 |
-
$options['handler'] = new StreamHandler();
|
1051 |
-
$options['defaults']['verify'] = '/etc/ca-certificates.crt';
|
1052 |
-
}
|
1053 |
-
} else {
|
1054 |
-
// guzzle 6
|
1055 |
-
$options['base_uri'] = $this->config['base_path'];
|
1056 |
-
}
|
1057 |
-
|
1058 |
-
return new Client($options);
|
1059 |
-
}
|
1060 |
-
|
1061 |
-
private function createApplicationDefaultCredentials()
|
1062 |
-
{
|
1063 |
-
$scopes = $this->prepareScopes();
|
1064 |
-
$sub = $this->config['subject'];
|
1065 |
-
$signingKey = $this->config['signing_key'];
|
1066 |
-
|
1067 |
-
// create credentials using values supplied in setAuthConfig
|
1068 |
-
if ($signingKey) {
|
1069 |
-
$serviceAccountCredentials = array(
|
1070 |
-
'client_id' => $this->config['client_id'],
|
1071 |
-
'client_email' => $this->config['client_email'],
|
1072 |
-
'private_key' => $signingKey,
|
1073 |
-
'type' => 'service_account',
|
1074 |
-
);
|
1075 |
-
$credentials = CredentialsLoader::makeCredentials($scopes, $serviceAccountCredentials);
|
1076 |
-
} else {
|
1077 |
-
$credentials = ApplicationDefaultCredentials::getCredentials($scopes);
|
1078 |
-
}
|
1079 |
-
|
1080 |
-
// for service account domain-wide authority (impersonating a user)
|
1081 |
-
// @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
|
1082 |
-
if ($sub) {
|
1083 |
-
if (!$credentials instanceof ServiceAccountCredentials) {
|
1084 |
-
throw new DomainException('domain-wide authority requires service account credentials');
|
1085 |
-
}
|
1086 |
-
|
1087 |
-
$credentials->setSub($sub);
|
1088 |
-
}
|
1089 |
-
|
1090 |
-
return $credentials;
|
1091 |
-
}
|
1092 |
-
|
1093 |
-
protected function getAuthHandler()
|
1094 |
-
{
|
1095 |
-
// Be very careful using the cache, as the underlying auth library's cache
|
1096 |
-
// implementation is naive, and the cache keys do not account for user
|
1097 |
-
// sessions.
|
1098 |
-
//
|
1099 |
-
// @see https://github.com/google/google-api-php-client/issues/821
|
1100 |
-
return Google_AuthHandler_AuthHandlerFactory::build(
|
1101 |
-
$this->getCache(),
|
1102 |
-
$this->config['cache_config']
|
1103 |
-
);
|
1104 |
-
}
|
1105 |
-
|
1106 |
-
private function createUserRefreshCredentials($scope, $refreshToken)
|
1107 |
-
{
|
1108 |
-
$creds = array_filter(
|
1109 |
-
array(
|
1110 |
-
'client_id' => $this->getClientId(),
|
1111 |
-
'client_secret' => $this->getClientSecret(),
|
1112 |
-
'refresh_token' => $refreshToken,
|
1113 |
-
)
|
1114 |
-
);
|
1115 |
-
|
1116 |
-
return new UserRefreshCredentials($scope, $creds);
|
1117 |
-
}
|
1118 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2010 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
use Google\Auth\ApplicationDefaultCredentials;
|
19 |
+
use Google\Auth\Cache\MemoryCacheItemPool;
|
20 |
+
use Google\Auth\CredentialsLoader;
|
21 |
+
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
22 |
+
use Google\Auth\OAuth2;
|
23 |
+
use Google\Auth\Credentials\ServiceAccountCredentials;
|
24 |
+
use Google\Auth\Credentials\UserRefreshCredentials;
|
25 |
+
use GuzzleHttp\Client;
|
26 |
+
use GuzzleHttp\ClientInterface;
|
27 |
+
use GuzzleHttp\Ring\Client\StreamHandler;
|
28 |
+
use GuzzleHttp\Psr7;
|
29 |
+
use Psr\Cache\CacheItemPoolInterface;
|
30 |
+
use Psr\Http\Message\RequestInterface;
|
31 |
+
use Psr\Log\LoggerInterface;
|
32 |
+
use Monolog\Logger;
|
33 |
+
use Monolog\Handler\StreamHandler as MonologStreamHandler;
|
34 |
+
use Monolog\Handler\SyslogHandler as MonologSyslogHandler;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* The Google API Client
|
38 |
+
* https://github.com/google/google-api-php-client
|
39 |
+
*/
|
40 |
+
class Google_Client
|
41 |
+
{
|
42 |
+
const LIBVER = "2.2.1";
|
43 |
+
const USER_AGENT_SUFFIX = "google-api-php-client/";
|
44 |
+
const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
|
45 |
+
const OAUTH2_TOKEN_URI = 'https://www.googleapis.com/oauth2/v4/token';
|
46 |
+
const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
|
47 |
+
const API_BASE_PATH = 'https://www.googleapis.com';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var Google\Auth\OAuth2 $auth
|
51 |
+
*/
|
52 |
+
private $auth;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @var GuzzleHttp\ClientInterface $http
|
56 |
+
*/
|
57 |
+
private $http;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @var Psr\Cache\CacheItemPoolInterface $cache
|
61 |
+
*/
|
62 |
+
private $cache;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @var array access token
|
66 |
+
*/
|
67 |
+
private $token;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @var array $config
|
71 |
+
*/
|
72 |
+
private $config;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @var Psr\Log\LoggerInterface $logger
|
76 |
+
*/
|
77 |
+
private $logger;
|
78 |
+
|
79 |
+
/**
|
80 |
+
* @var boolean $deferExecution
|
81 |
+
*/
|
82 |
+
private $deferExecution = false;
|
83 |
+
|
84 |
+
/** @var array $scopes */
|
85 |
+
// Scopes requested by the client
|
86 |
+
protected $requestedScopes = [];
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Construct the Google Client.
|
90 |
+
*
|
91 |
+
* @param array $config
|
92 |
+
*/
|
93 |
+
public function __construct(array $config = array())
|
94 |
+
{
|
95 |
+
$this->config = array_merge(
|
96 |
+
[
|
97 |
+
'application_name' => '',
|
98 |
+
|
99 |
+
// Don't change these unless you're working against a special development
|
100 |
+
// or testing environment.
|
101 |
+
'base_path' => self::API_BASE_PATH,
|
102 |
+
|
103 |
+
// https://developers.google.com/console
|
104 |
+
'client_id' => '',
|
105 |
+
'client_secret' => '',
|
106 |
+
'redirect_uri' => null,
|
107 |
+
'state' => null,
|
108 |
+
|
109 |
+
// Simple API access key, also from the API console. Ensure you get
|
110 |
+
// a Server key, and not a Browser key.
|
111 |
+
'developer_key' => '',
|
112 |
+
|
113 |
+
// For use with Google Cloud Platform
|
114 |
+
// fetch the ApplicationDefaultCredentials, if applicable
|
115 |
+
// @see https://developers.google.com/identity/protocols/application-default-credentials
|
116 |
+
'use_application_default_credentials' => false,
|
117 |
+
'signing_key' => null,
|
118 |
+
'signing_algorithm' => null,
|
119 |
+
'subject' => null,
|
120 |
+
|
121 |
+
// Other OAuth2 parameters.
|
122 |
+
'hd' => '',
|
123 |
+
'prompt' => '',
|
124 |
+
'openid.realm' => '',
|
125 |
+
'include_granted_scopes' => null,
|
126 |
+
'login_hint' => '',
|
127 |
+
'request_visible_actions' => '',
|
128 |
+
'access_type' => 'online',
|
129 |
+
'approval_prompt' => 'auto',
|
130 |
+
|
131 |
+
// Task Runner retry configuration
|
132 |
+
// @see Google_Task_Runner
|
133 |
+
'retry' => array(),
|
134 |
+
|
135 |
+
// cache config for downstream auth caching
|
136 |
+
'cache_config' => [],
|
137 |
+
|
138 |
+
// function to be called when an access token is fetched
|
139 |
+
// follows the signature function ($cacheKey, $accessToken)
|
140 |
+
'token_callback' => null,
|
141 |
+
|
142 |
+
// Service class used in Google_Client::verifyIdToken.
|
143 |
+
// Explicitly pass this in to avoid setting JWT::$leeway
|
144 |
+
'jwt' => null,
|
145 |
+
],
|
146 |
+
$config
|
147 |
+
);
|
148 |
+
}
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Get a string containing the version of the library.
|
152 |
+
*
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
public function getLibraryVersion()
|
156 |
+
{
|
157 |
+
return self::LIBVER;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* For backwards compatibility
|
162 |
+
* alias for fetchAccessTokenWithAuthCode
|
163 |
+
*
|
164 |
+
* @param $code string code from accounts.google.com
|
165 |
+
* @return array access token
|
166 |
+
* @deprecated
|
167 |
+
*/
|
168 |
+
public function authenticate($code)
|
169 |
+
{
|
170 |
+
return $this->fetchAccessTokenWithAuthCode($code);
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Attempt to exchange a code for an valid authentication token.
|
175 |
+
* Helper wrapped around the OAuth 2.0 implementation.
|
176 |
+
*
|
177 |
+
* @param $code string code from accounts.google.com
|
178 |
+
* @return array access token
|
179 |
+
*/
|
180 |
+
public function fetchAccessTokenWithAuthCode($code)
|
181 |
+
{
|
182 |
+
if (strlen($code) == 0) {
|
183 |
+
throw new InvalidArgumentException("Invalid code");
|
184 |
+
}
|
185 |
+
|
186 |
+
$auth = $this->getOAuth2Service();
|
187 |
+
$auth->setCode($code);
|
188 |
+
$auth->setRedirectUri($this->getRedirectUri());
|
189 |
+
|
190 |
+
$httpHandler = HttpHandlerFactory::build($this->getHttpClient());
|
191 |
+
$creds = $auth->fetchAuthToken($httpHandler);
|
192 |
+
if ($creds && isset($creds['access_token'])) {
|
193 |
+
$creds['created'] = time();
|
194 |
+
$this->setAccessToken($creds);
|
195 |
+
}
|
196 |
+
|
197 |
+
return $creds;
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* For backwards compatibility
|
202 |
+
* alias for fetchAccessTokenWithAssertion
|
203 |
+
*
|
204 |
+
* @return array access token
|
205 |
+
* @deprecated
|
206 |
+
*/
|
207 |
+
public function refreshTokenWithAssertion()
|
208 |
+
{
|
209 |
+
return $this->fetchAccessTokenWithAssertion();
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Fetches a fresh access token with a given assertion token.
|
214 |
+
* @param $assertionCredentials optional.
|
215 |
+
* @return array access token
|
216 |
+
*/
|
217 |
+
public function fetchAccessTokenWithAssertion(ClientInterface $authHttp = null)
|
218 |
+
{
|
219 |
+
if (!$this->isUsingApplicationDefaultCredentials()) {
|
220 |
+
throw new DomainException(
|
221 |
+
'set the JSON service account credentials using'
|
222 |
+
. ' Google_Client::setAuthConfig or set the path to your JSON file'
|
223 |
+
. ' with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable'
|
224 |
+
. ' and call Google_Client::useApplicationDefaultCredentials to'
|
225 |
+
. ' refresh a token with assertion.'
|
226 |
+
);
|
227 |
+
}
|
228 |
+
|
229 |
+
$this->getLogger()->log(
|
230 |
+
'info',
|
231 |
+
'OAuth2 access token refresh with Signed JWT assertion grants.'
|
232 |
+
);
|
233 |
+
|
234 |
+
$credentials = $this->createApplicationDefaultCredentials();
|
235 |
+
|
236 |
+
$httpHandler = HttpHandlerFactory::build($authHttp);
|
237 |
+
$creds = $credentials->fetchAuthToken($httpHandler);
|
238 |
+
if ($creds && isset($creds['access_token'])) {
|
239 |
+
$creds['created'] = time();
|
240 |
+
$this->setAccessToken($creds);
|
241 |
+
}
|
242 |
+
|
243 |
+
return $creds;
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* For backwards compatibility
|
248 |
+
* alias for fetchAccessTokenWithRefreshToken
|
249 |
+
*
|
250 |
+
* @param string $refreshToken
|
251 |
+
* @return array access token
|
252 |
+
*/
|
253 |
+
public function refreshToken($refreshToken)
|
254 |
+
{
|
255 |
+
return $this->fetchAccessTokenWithRefreshToken($refreshToken);
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Fetches a fresh OAuth 2.0 access token with the given refresh token.
|
260 |
+
* @param string $refreshToken
|
261 |
+
* @return array access token
|
262 |
+
*/
|
263 |
+
public function fetchAccessTokenWithRefreshToken($refreshToken = null)
|
264 |
+
{
|
265 |
+
if (null === $refreshToken) {
|
266 |
+
if (!isset($this->token['refresh_token'])) {
|
267 |
+
throw new LogicException(
|
268 |
+
'refresh token must be passed in or set as part of setAccessToken'
|
269 |
+
);
|
270 |
+
}
|
271 |
+
$refreshToken = $this->token['refresh_token'];
|
272 |
+
}
|
273 |
+
$this->getLogger()->info('OAuth2 access token refresh');
|
274 |
+
$auth = $this->getOAuth2Service();
|
275 |
+
$auth->setRefreshToken($refreshToken);
|
276 |
+
|
277 |
+
$httpHandler = HttpHandlerFactory::build($this->getHttpClient());
|
278 |
+
$creds = $auth->fetchAuthToken($httpHandler);
|
279 |
+
if ($creds && isset($creds['access_token'])) {
|
280 |
+
$creds['created'] = time();
|
281 |
+
if (!isset($creds['refresh_token'])) {
|
282 |
+
$creds['refresh_token'] = $refreshToken;
|
283 |
+
}
|
284 |
+
$this->setAccessToken($creds);
|
285 |
+
}
|
286 |
+
|
287 |
+
return $creds;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Create a URL to obtain user authorization.
|
292 |
+
* The authorization endpoint allows the user to first
|
293 |
+
* authenticate, and then grant/deny the access request.
|
294 |
+
* @param string|array $scope The scope is expressed as an array or list of space-delimited strings.
|
295 |
+
* @return string
|
296 |
+
*/
|
297 |
+
public function createAuthUrl($scope = null)
|
298 |
+
{
|
299 |
+
if (empty($scope)) {
|
300 |
+
$scope = $this->prepareScopes();
|
301 |
+
}
|
302 |
+
if (is_array($scope)) {
|
303 |
+
$scope = implode(' ', $scope);
|
304 |
+
}
|
305 |
+
|
306 |
+
// only accept one of prompt or approval_prompt
|
307 |
+
$approvalPrompt = $this->config['prompt']
|
308 |
+
? null
|
309 |
+
: $this->config['approval_prompt'];
|
310 |
+
|
311 |
+
// include_granted_scopes should be string "true", string "false", or null
|
312 |
+
$includeGrantedScopes = $this->config['include_granted_scopes'] === null
|
313 |
+
? null
|
314 |
+
: var_export($this->config['include_granted_scopes'], true);
|
315 |
+
|
316 |
+
$params = array_filter(
|
317 |
+
[
|
318 |
+
'access_type' => $this->config['access_type'],
|
319 |
+
'approval_prompt' => $approvalPrompt,
|
320 |
+
'hd' => $this->config['hd'],
|
321 |
+
'include_granted_scopes' => $includeGrantedScopes,
|
322 |
+
'login_hint' => $this->config['login_hint'],
|
323 |
+
'openid.realm' => $this->config['openid.realm'],
|
324 |
+
'prompt' => $this->config['prompt'],
|
325 |
+
'response_type' => 'code',
|
326 |
+
'scope' => $scope,
|
327 |
+
'state' => $this->config['state'],
|
328 |
+
]
|
329 |
+
);
|
330 |
+
|
331 |
+
// If the list of scopes contains plus.login, add request_visible_actions
|
332 |
+
// to auth URL.
|
333 |
+
$rva = $this->config['request_visible_actions'];
|
334 |
+
if (strlen($rva) > 0 && false !== strpos($scope, 'plus.login')) {
|
335 |
+
$params['request_visible_actions'] = $rva;
|
336 |
+
}
|
337 |
+
|
338 |
+
$auth = $this->getOAuth2Service();
|
339 |
+
|
340 |
+
return (string) $auth->buildFullAuthorizationUri($params);
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* Adds auth listeners to the HTTP client based on the credentials
|
345 |
+
* set in the Google API Client object
|
346 |
+
*
|
347 |
+
* @param GuzzleHttp\ClientInterface $http the http client object.
|
348 |
+
* @return GuzzleHttp\ClientInterface the http client object
|
349 |
+
*/
|
350 |
+
public function authorize(ClientInterface $http = null)
|
351 |
+
{
|
352 |
+
$credentials = null;
|
353 |
+
$token = null;
|
354 |
+
$scopes = null;
|
355 |
+
if (null === $http) {
|
356 |
+
$http = $this->getHttpClient();
|
357 |
+
}
|
358 |
+
|
359 |
+
// These conditionals represent the decision tree for authentication
|
360 |
+
// 1. Check for Application Default Credentials
|
361 |
+
// 2. Check for API Key
|
362 |
+
// 3a. Check for an Access Token
|
363 |
+
// 3b. If access token exists but is expired, try to refresh it
|
364 |
+
if ($this->isUsingApplicationDefaultCredentials()) {
|
365 |
+
$credentials = $this->createApplicationDefaultCredentials();
|
366 |
+
} elseif ($token = $this->getAccessToken()) {
|
367 |
+
$scopes = $this->prepareScopes();
|
368 |
+
// add refresh subscriber to request a new token
|
369 |
+
if (isset($token['refresh_token']) && $this->isAccessTokenExpired()) {
|
370 |
+
$credentials = $this->createUserRefreshCredentials(
|
371 |
+
$scopes,
|
372 |
+
$token['refresh_token']
|
373 |
+
);
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
$authHandler = $this->getAuthHandler();
|
378 |
+
|
379 |
+
if ($credentials) {
|
380 |
+
$callback = $this->config['token_callback'];
|
381 |
+
$http = $authHandler->attachCredentials($http, $credentials, $callback);
|
382 |
+
} elseif ($token) {
|
383 |
+
$http = $authHandler->attachToken($http, $token, (array) $scopes);
|
384 |
+
} elseif ($key = $this->config['developer_key']) {
|
385 |
+
$http = $authHandler->attachKey($http, $key);
|
386 |
+
}
|
387 |
+
|
388 |
+
return $http;
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Set the configuration to use application default credentials for
|
393 |
+
* authentication
|
394 |
+
*
|
395 |
+
* @see https://developers.google.com/identity/protocols/application-default-credentials
|
396 |
+
* @param boolean $useAppCreds
|
397 |
+
*/
|
398 |
+
public function useApplicationDefaultCredentials($useAppCreds = true)
|
399 |
+
{
|
400 |
+
$this->config['use_application_default_credentials'] = $useAppCreds;
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* To prevent useApplicationDefaultCredentials from inappropriately being
|
405 |
+
* called in a conditional
|
406 |
+
*
|
407 |
+
* @see https://developers.google.com/identity/protocols/application-default-credentials
|
408 |
+
*/
|
409 |
+
public function isUsingApplicationDefaultCredentials()
|
410 |
+
{
|
411 |
+
return $this->config['use_application_default_credentials'];
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* @param string|array $token
|
416 |
+
* @throws InvalidArgumentException
|
417 |
+
*/
|
418 |
+
public function setAccessToken($token)
|
419 |
+
{
|
420 |
+
if (is_string($token)) {
|
421 |
+
if ($json = json_decode($token, true)) {
|
422 |
+
$token = $json;
|
423 |
+
} else {
|
424 |
+
// assume $token is just the token string
|
425 |
+
$token = array(
|
426 |
+
'access_token' => $token,
|
427 |
+
);
|
428 |
+
}
|
429 |
+
}
|
430 |
+
if ($token == null) {
|
431 |
+
throw new InvalidArgumentException('invalid json token');
|
432 |
+
}
|
433 |
+
if (!isset($token['access_token'])) {
|
434 |
+
throw new InvalidArgumentException("Invalid token format");
|
435 |
+
}
|
436 |
+
$this->token = $token;
|
437 |
+
}
|
438 |
+
|
439 |
+
public function getAccessToken()
|
440 |
+
{
|
441 |
+
return $this->token;
|
442 |
+
}
|
443 |
+
|
444 |
+
public function getRefreshToken()
|
445 |
+
{
|
446 |
+
if (isset($this->token['refresh_token'])) {
|
447 |
+
return $this->token['refresh_token'];
|
448 |
+
}
|
449 |
+
}
|
450 |
+
|
451 |
+
/**
|
452 |
+
* Returns if the access_token is expired.
|
453 |
+
* @return bool Returns True if the access_token is expired.
|
454 |
+
*/
|
455 |
+
public function isAccessTokenExpired()
|
456 |
+
{
|
457 |
+
if (!$this->token) {
|
458 |
+
return true;
|
459 |
+
}
|
460 |
+
|
461 |
+
$created = 0;
|
462 |
+
if (isset($this->token['created'])) {
|
463 |
+
$created = $this->token['created'];
|
464 |
+
} elseif (isset($this->token['id_token'])) {
|
465 |
+
// check the ID token for "iat"
|
466 |
+
// signature verification is not required here, as we are just
|
467 |
+
// using this for convenience to save a round trip request
|
468 |
+
// to the Google API server
|
469 |
+
$idToken = $this->token['id_token'];
|
470 |
+
if (substr_count($idToken, '.') == 2) {
|
471 |
+
$parts = explode('.', $idToken);
|
472 |
+
$payload = json_decode(base64_decode($parts[1]), true);
|
473 |
+
if ($payload && isset($payload['iat'])) {
|
474 |
+
$created = $payload['iat'];
|
475 |
+
}
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
// If the token is set to expire in the next 30 seconds.
|
480 |
+
return ($created + ($this->token['expires_in'] - 30)) < time();
|
481 |
+
}
|
482 |
+
|
483 |
+
public function getAuth()
|
484 |
+
{
|
485 |
+
throw new BadMethodCallException(
|
486 |
+
'This function no longer exists. See UPGRADING.md for more information'
|
487 |
+
);
|
488 |
+
}
|
489 |
+
|
490 |
+
public function setAuth($auth)
|
491 |
+
{
|
492 |
+
throw new BadMethodCallException(
|
493 |
+
'This function no longer exists. See UPGRADING.md for more information'
|
494 |
+
);
|
495 |
+
}
|
496 |
+
|
497 |
+
/**
|
498 |
+
* Set the OAuth 2.0 Client ID.
|
499 |
+
* @param string $clientId
|
500 |
+
*/
|
501 |
+
public function setClientId($clientId)
|
502 |
+
{
|
503 |
+
$this->config['client_id'] = $clientId;
|
504 |
+
}
|
505 |
+
|
506 |
+
public function getClientId()
|
507 |
+
{
|
508 |
+
return $this->config['client_id'];
|
509 |
+
}
|
510 |
+
|
511 |
+
/**
|
512 |
+
* Set the OAuth 2.0 Client Secret.
|
513 |
+
* @param string $clientSecret
|
514 |
+
*/
|
515 |
+
public function setClientSecret($clientSecret)
|
516 |
+
{
|
517 |
+
$this->config['client_secret'] = $clientSecret;
|
518 |
+
}
|
519 |
+
|
520 |
+
public function getClientSecret()
|
521 |
+
{
|
522 |
+
return $this->config['client_secret'];
|
523 |
+
}
|
524 |
+
|
525 |
+
/**
|
526 |
+
* Set the OAuth 2.0 Redirect URI.
|
527 |
+
* @param string $redirectUri
|
528 |
+
*/
|
529 |
+
public function setRedirectUri($redirectUri)
|
530 |
+
{
|
531 |
+
$this->config['redirect_uri'] = $redirectUri;
|
532 |
+
}
|
533 |
+
|
534 |
+
public function getRedirectUri()
|
535 |
+
{
|
536 |
+
return $this->config['redirect_uri'];
|
537 |
+
}
|
538 |
+
|
539 |
+
/**
|
540 |
+
* Set OAuth 2.0 "state" parameter to achieve per-request customization.
|
541 |
+
* @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
|
542 |
+
* @param string $state
|
543 |
+
*/
|
544 |
+
public function setState($state)
|
545 |
+
{
|
546 |
+
$this->config['state'] = $state;
|
547 |
+
}
|
548 |
+
|
549 |
+
/**
|
550 |
+
* @param string $accessType Possible values for access_type include:
|
551 |
+
* {@code "offline"} to request offline access from the user.
|
552 |
+
* {@code "online"} to request online access from the user.
|
553 |
+
*/
|
554 |
+
public function setAccessType($accessType)
|
555 |
+
{
|
556 |
+
$this->config['access_type'] = $accessType;
|
557 |
+
}
|
558 |
+
|
559 |
+
/**
|
560 |
+
* @param string $approvalPrompt Possible values for approval_prompt include:
|
561 |
+
* {@code "force"} to force the approval UI to appear.
|
562 |
+
* {@code "auto"} to request auto-approval when possible. (This is the default value)
|
563 |
+
*/
|
564 |
+
public function setApprovalPrompt($approvalPrompt)
|
565 |
+
{
|
566 |
+
$this->config['approval_prompt'] = $approvalPrompt;
|
567 |
+
}
|
568 |
+
|
569 |
+
/**
|
570 |
+
* Set the login hint, email address or sub id.
|
571 |
+
* @param string $loginHint
|
572 |
+
*/
|
573 |
+
public function setLoginHint($loginHint)
|
574 |
+
{
|
575 |
+
$this->config['login_hint'] = $loginHint;
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Set the application name, this is included in the User-Agent HTTP header.
|
580 |
+
* @param string $applicationName
|
581 |
+
*/
|
582 |
+
public function setApplicationName($applicationName)
|
583 |
+
{
|
584 |
+
$this->config['application_name'] = $applicationName;
|
585 |
+
}
|
586 |
+
|
587 |
+
/**
|
588 |
+
* If 'plus.login' is included in the list of requested scopes, you can use
|
589 |
+
* this method to define types of app activities that your app will write.
|
590 |
+
* You can find a list of available types here:
|
591 |
+
* @link https://developers.google.com/+/api/moment-types
|
592 |
+
*
|
593 |
+
* @param array $requestVisibleActions Array of app activity types
|
594 |
+
*/
|
595 |
+
public function setRequestVisibleActions($requestVisibleActions)
|
596 |
+
{
|
597 |
+
if (is_array($requestVisibleActions)) {
|
598 |
+
$requestVisibleActions = implode(" ", $requestVisibleActions);
|
599 |
+
}
|
600 |
+
$this->config['request_visible_actions'] = $requestVisibleActions;
|
601 |
+
}
|
602 |
+
|
603 |
+
/**
|
604 |
+
* Set the developer key to use, these are obtained through the API Console.
|
605 |
+
* @see http://code.google.com/apis/console-help/#generatingdevkeys
|
606 |
+
* @param string $developerKey
|
607 |
+
*/
|
608 |
+
public function setDeveloperKey($developerKey)
|
609 |
+
{
|
610 |
+
$this->config['developer_key'] = $developerKey;
|
611 |
+
}
|
612 |
+
|
613 |
+
/**
|
614 |
+
* Set the hd (hosted domain) parameter streamlines the login process for
|
615 |
+
* Google Apps hosted accounts. By including the domain of the user, you
|
616 |
+
* restrict sign-in to accounts at that domain.
|
617 |
+
* @param $hd string - the domain to use.
|
618 |
+
*/
|
619 |
+
public function setHostedDomain($hd)
|
620 |
+
{
|
621 |
+
$this->config['hd'] = $hd;
|
622 |
+
}
|
623 |
+
|
624 |
+
/**
|
625 |
+
* Set the prompt hint. Valid values are none, consent and select_account.
|
626 |
+
* If no value is specified and the user has not previously authorized
|
627 |
+
* access, then the user is shown a consent screen.
|
628 |
+
* @param $prompt string
|
629 |
+
*/
|
630 |
+
public function setPrompt($prompt)
|
631 |
+
{
|
632 |
+
$this->config['prompt'] = $prompt;
|
633 |
+
}
|
634 |
+
|
635 |
+
/**
|
636 |
+
* openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth
|
637 |
+
* 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which
|
638 |
+
* an authentication request is valid.
|
639 |
+
* @param $realm string - the URL-space to use.
|
640 |
+
*/
|
641 |
+
public function setOpenidRealm($realm)
|
642 |
+
{
|
643 |
+
$this->config['openid.realm'] = $realm;
|
644 |
+
}
|
645 |
+
|
646 |
+
/**
|
647 |
+
* If this is provided with the value true, and the authorization request is
|
648 |
+
* granted, the authorization will include any previous authorizations
|
649 |
+
* granted to this user/application combination for other scopes.
|
650 |
+
* @param $include boolean - the URL-space to use.
|
651 |
+
*/
|
652 |
+
public function setIncludeGrantedScopes($include)
|
653 |
+
{
|
654 |
+
$this->config['include_granted_scopes'] = $include;
|
655 |
+
}
|
656 |
+
|
657 |
+
/**
|
658 |
+
* sets function to be called when an access token is fetched
|
659 |
+
* @param callable $tokenCallback - function ($cacheKey, $accessToken)
|
660 |
+
*/
|
661 |
+
public function setTokenCallback(callable $tokenCallback)
|
662 |
+
{
|
663 |
+
$this->config['token_callback'] = $tokenCallback;
|
664 |
+
}
|
665 |
+
|
666 |
+
/**
|
667 |
+
* Revoke an OAuth2 access token or refresh token. This method will revoke the current access
|
668 |
+
* token, if a token isn't provided.
|
669 |
+
*
|
670 |
+
* @param string|null $token The token (access token or a refresh token) that should be revoked.
|
671 |
+
* @return boolean Returns True if the revocation was successful, otherwise False.
|
672 |
+
*/
|
673 |
+
public function revokeToken($token = null)
|
674 |
+
{
|
675 |
+
$tokenRevoker = new Google_AccessToken_Revoke(
|
676 |
+
$this->getHttpClient()
|
677 |
+
);
|
678 |
+
|
679 |
+
return $tokenRevoker->revokeToken($token ?: $this->getAccessToken());
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Verify an id_token. This method will verify the current id_token, if one
|
684 |
+
* isn't provided.
|
685 |
+
*
|
686 |
+
* @throws LogicException
|
687 |
+
* @param string|null $idToken The token (id_token) that should be verified.
|
688 |
+
* @return array|false Returns the token payload as an array if the verification was
|
689 |
+
* successful, false otherwise.
|
690 |
+
*/
|
691 |
+
public function verifyIdToken($idToken = null)
|
692 |
+
{
|
693 |
+
$tokenVerifier = new Google_AccessToken_Verify(
|
694 |
+
$this->getHttpClient(),
|
695 |
+
$this->getCache(),
|
696 |
+
$this->config['jwt']
|
697 |
+
);
|
698 |
+
|
699 |
+
if (null === $idToken) {
|
700 |
+
$token = $this->getAccessToken();
|
701 |
+
if (!isset($token['id_token'])) {
|
702 |
+
throw new LogicException(
|
703 |
+
'id_token must be passed in or set as part of setAccessToken'
|
704 |
+
);
|
705 |
+
}
|
706 |
+
$idToken = $token['id_token'];
|
707 |
+
}
|
708 |
+
|
709 |
+
return $tokenVerifier->verifyIdToken(
|
710 |
+
$idToken,
|
711 |
+
$this->getClientId()
|
712 |
+
);
|
713 |
+
}
|
714 |
+
|
715 |
+
/**
|
716 |
+
* Set the scopes to be requested. Must be called before createAuthUrl().
|
717 |
+
* Will remove any previously configured scopes.
|
718 |
+
* @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.login',
|
719 |
+
* 'https://www.googleapis.com/auth/moderator')
|
720 |
+
*/
|
721 |
+
public function setScopes($scopes)
|
722 |
+
{
|
723 |
+
$this->requestedScopes = array();
|
724 |
+
$this->addScope($scopes);
|
725 |
+
}
|
726 |
+
|
727 |
+
/**
|
728 |
+
* This functions adds a scope to be requested as part of the OAuth2.0 flow.
|
729 |
+
* Will append any scopes not previously requested to the scope parameter.
|
730 |
+
* A single string will be treated as a scope to request. An array of strings
|
731 |
+
* will each be appended.
|
732 |
+
* @param $scope_or_scopes string|array e.g. "profile"
|
733 |
+
*/
|
734 |
+
public function addScope($scope_or_scopes)
|
735 |
+
{
|
736 |
+
if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) {
|
737 |
+
$this->requestedScopes[] = $scope_or_scopes;
|
738 |
+
} else if (is_array($scope_or_scopes)) {
|
739 |
+
foreach ($scope_or_scopes as $scope) {
|
740 |
+
$this->addScope($scope);
|
741 |
+
}
|
742 |
+
}
|
743 |
+
}
|
744 |
+
|
745 |
+
/**
|
746 |
+
* Returns the list of scopes requested by the client
|
747 |
+
* @return array the list of scopes
|
748 |
+
*
|
749 |
+
*/
|
750 |
+
public function getScopes()
|
751 |
+
{
|
752 |
+
return $this->requestedScopes;
|
753 |
+
}
|
754 |
+
|
755 |
+
/**
|
756 |
+
* @return array
|
757 |
+
* @visible For Testing
|
758 |
+
*/
|
759 |
+
public function prepareScopes()
|
760 |
+
{
|
761 |
+
if (empty($this->requestedScopes)) {
|
762 |
+
return null;
|
763 |
+
}
|
764 |
+
|
765 |
+
return implode(' ', $this->requestedScopes);
|
766 |
+
}
|
767 |
+
|
768 |
+
/**
|
769 |
+
* Helper method to execute deferred HTTP requests.
|
770 |
+
*
|
771 |
+
* @param $request Psr\Http\Message\RequestInterface|Google_Http_Batch
|
772 |
+
* @throws Google_Exception
|
773 |
+
* @return object of the type of the expected class or Psr\Http\Message\ResponseInterface.
|
774 |
+
*/
|
775 |
+
public function execute(RequestInterface $request, $expectedClass = null)
|
776 |
+
{
|
777 |
+
$request = $request->withHeader(
|
778 |
+
'User-Agent',
|
779 |
+
$this->config['application_name']
|
780 |
+
. " " . self::USER_AGENT_SUFFIX
|
781 |
+
. $this->getLibraryVersion()
|
782 |
+
);
|
783 |
+
|
784 |
+
// call the authorize method
|
785 |
+
// this is where most of the grunt work is done
|
786 |
+
$http = $this->authorize();
|
787 |
+
|
788 |
+
return Google_Http_REST::execute($http, $request, $expectedClass, $this->config['retry']);
|
789 |
+
}
|
790 |
+
|
791 |
+
/**
|
792 |
+
* Declare whether batch calls should be used. This may increase throughput
|
793 |
+
* by making multiple requests in one connection.
|
794 |
+
*
|
795 |
+
* @param boolean $useBatch True if the batch support should
|
796 |
+
* be enabled. Defaults to False.
|
797 |
+
*/
|
798 |
+
public function setUseBatch($useBatch)
|
799 |
+
{
|
800 |
+
// This is actually an alias for setDefer.
|
801 |
+
$this->setDefer($useBatch);
|
802 |
+
}
|
803 |
+
|
804 |
+
/**
|
805 |
+
* Are we running in Google AppEngine?
|
806 |
+
* return bool
|
807 |
+
*/
|
808 |
+
public function isAppEngine()
|
809 |
+
{
|
810 |
+
return (isset($_SERVER['SERVER_SOFTWARE']) &&
|
811 |
+
strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== false);
|
812 |
+
}
|
813 |
+
|
814 |
+
public function setConfig($name, $value)
|
815 |
+
{
|
816 |
+
$this->config[$name] = $value;
|
817 |
+
}
|
818 |
+
|
819 |
+
public function getConfig($name, $default = null)
|
820 |
+
{
|
821 |
+
return isset($this->config[$name]) ? $this->config[$name] : $default;
|
822 |
+
}
|
823 |
+
|
824 |
+
/**
|
825 |
+
* For backwards compatibility
|
826 |
+
* alias for setAuthConfig
|
827 |
+
*
|
828 |
+
* @param string $file the configuration file
|
829 |
+
* @throws Google_Exception
|
830 |
+
* @deprecated
|
831 |
+
*/
|
832 |
+
public function setAuthConfigFile($file)
|
833 |
+
{
|
834 |
+
$this->setAuthConfig($file);
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* Set the auth config from new or deprecated JSON config.
|
839 |
+
* This structure should match the file downloaded from
|
840 |
+
* the "Download JSON" button on in the Google Developer
|
841 |
+
* Console.
|
842 |
+
* @param string|array $config the configuration json
|
843 |
+
* @throws Google_Exception
|
844 |
+
*/
|
845 |
+
public function setAuthConfig($config)
|
846 |
+
{
|
847 |
+
if (is_string($config)) {
|
848 |
+
if (!file_exists($config)) {
|
849 |
+
throw new InvalidArgumentException('file does not exist');
|
850 |
+
}
|
851 |
+
|
852 |
+
$json = file_get_contents($config);
|
853 |
+
|
854 |
+
if (!$config = json_decode($json, true)) {
|
855 |
+
throw new LogicException('invalid json for auth config');
|
856 |
+
}
|
857 |
+
}
|
858 |
+
|
859 |
+
$key = isset($config['installed']) ? 'installed' : 'web';
|
860 |
+
if (isset($config['type']) && $config['type'] == 'service_account') {
|
861 |
+
// application default credentials
|
862 |
+
$this->useApplicationDefaultCredentials();
|
863 |
+
|
864 |
+
// set the information from the config
|
865 |
+
$this->setClientId($config['client_id']);
|
866 |
+
$this->config['client_email'] = $config['client_email'];
|
867 |
+
$this->config['signing_key'] = $config['private_key'];
|
868 |
+
$this->config['signing_algorithm'] = 'HS256';
|
869 |
+
} elseif (isset($config[$key])) {
|
870 |
+
// old-style
|
871 |
+
$this->setClientId($config[$key]['client_id']);
|
872 |
+
$this->setClientSecret($config[$key]['client_secret']);
|
873 |
+
if (isset($config[$key]['redirect_uris'])) {
|
874 |
+
$this->setRedirectUri($config[$key]['redirect_uris'][0]);
|
875 |
+
}
|
876 |
+
} else {
|
877 |
+
// new-style
|
878 |
+
$this->setClientId($config['client_id']);
|
879 |
+
$this->setClientSecret($config['client_secret']);
|
880 |
+
if (isset($config['redirect_uris'])) {
|
881 |
+
$this->setRedirectUri($config['redirect_uris'][0]);
|
882 |
+
}
|
883 |
+
}
|
884 |
+
}
|
885 |
+
|
886 |
+
/**
|
887 |
+
* Use when the service account has been delegated domain wide access.
|
888 |
+
*
|
889 |
+
* @param string subject an email address account to impersonate
|
890 |
+
*/
|
891 |
+
public function setSubject($subject)
|
892 |
+
{
|
893 |
+
$this->config['subject'] = $subject;
|
894 |
+
}
|
895 |
+
|
896 |
+
/**
|
897 |
+
* Declare whether making API calls should make the call immediately, or
|
898 |
+
* return a request which can be called with ->execute();
|
899 |
+
*
|
900 |
+
* @param boolean $defer True if calls should not be executed right away.
|
901 |
+
*/
|
902 |
+
public function setDefer($defer)
|
903 |
+
{
|
904 |
+
$this->deferExecution = $defer;
|
905 |
+
}
|
906 |
+
|
907 |
+
/**
|
908 |
+
* Whether or not to return raw requests
|
909 |
+
* @return boolean
|
910 |
+
*/
|
911 |
+
public function shouldDefer()
|
912 |
+
{
|
913 |
+
return $this->deferExecution;
|
914 |
+
}
|
915 |
+
|
916 |
+
/**
|
917 |
+
* @return Google\Auth\OAuth2 implementation
|
918 |
+
*/
|
919 |
+
public function getOAuth2Service()
|
920 |
+
{
|
921 |
+
if (!isset($this->auth)) {
|
922 |
+
$this->auth = $this->createOAuth2Service();
|
923 |
+
}
|
924 |
+
|
925 |
+
return $this->auth;
|
926 |
+
}
|
927 |
+
|
928 |
+
/**
|
929 |
+
* create a default google auth object
|
930 |
+
*/
|
931 |
+
protected function createOAuth2Service()
|
932 |
+
{
|
933 |
+
$auth = new OAuth2(
|
934 |
+
[
|
935 |
+
'clientId' => $this->getClientId(),
|
936 |
+
'clientSecret' => $this->getClientSecret(),
|
937 |
+
'authorizationUri' => self::OAUTH2_AUTH_URL,
|
938 |
+
'tokenCredentialUri' => self::OAUTH2_TOKEN_URI,
|
939 |
+
'redirectUri' => $this->getRedirectUri(),
|
940 |
+
'issuer' => $this->config['client_id'],
|
941 |
+
'signingKey' => $this->config['signing_key'],
|
942 |
+
'signingAlgorithm' => $this->config['signing_algorithm'],
|
943 |
+
]
|
944 |
+
);
|
945 |
+
|
946 |
+
return $auth;
|
947 |
+
}
|
948 |
+
|
949 |
+
/**
|
950 |
+
* Set the Cache object
|
951 |
+
* @param Psr\Cache\CacheItemPoolInterface $cache
|
952 |
+
*/
|
953 |
+
public function setCache(CacheItemPoolInterface $cache)
|
954 |
+
{
|
955 |
+
$this->cache = $cache;
|
956 |
+
}
|
957 |
+
|
958 |
+
/**
|
959 |
+
* @return Psr\Cache\CacheItemPoolInterface Cache implementation
|
960 |
+
*/
|
961 |
+
public function getCache()
|
962 |
+
{
|
963 |
+
if (!$this->cache) {
|
964 |
+
$this->cache = $this->createDefaultCache();
|
965 |
+
}
|
966 |
+
|
967 |
+
return $this->cache;
|
968 |
+
}
|
969 |
+
|
970 |
+
/**
|
971 |
+
* @return Google\Auth\CacheInterface Cache implementation
|
972 |
+
*/
|
973 |
+
public function setCacheConfig(array $cacheConfig)
|
974 |
+
{
|
975 |
+
$this->config['cache_config'] = $cacheConfig;
|
976 |
+
}
|
977 |
+
|
978 |
+
/**
|
979 |
+
* Set the Logger object
|
980 |
+
* @param Psr\Log\LoggerInterface $logger
|
981 |
+
*/
|
982 |
+
public function setLogger(LoggerInterface $logger)
|
983 |
+
{
|
984 |
+
$this->logger = $logger;
|
985 |
+
}
|
986 |
+
|
987 |
+
/**
|
988 |
+
* @return Psr\Log\LoggerInterface implementation
|
989 |
+
*/
|
990 |
+
public function getLogger()
|
991 |
+
{
|
992 |
+
if (!isset($this->logger)) {
|
993 |
+
$this->logger = $this->createDefaultLogger();
|
994 |
+
}
|
995 |
+
|
996 |
+
return $this->logger;
|
997 |
+
}
|
998 |
+
|
999 |
+
protected function createDefaultLogger()
|
1000 |
+
{
|
1001 |
+
$logger = new Logger('google-api-php-client');
|
1002 |
+
if ($this->isAppEngine()) {
|
1003 |
+
$handler = new MonologSyslogHandler('app', LOG_USER, Logger::NOTICE);
|
1004 |
+
} else {
|
1005 |
+
$handler = new MonologStreamHandler('php://stderr', Logger::NOTICE);
|
1006 |
+
}
|
1007 |
+
$logger->pushHandler($handler);
|
1008 |
+
|
1009 |
+
return $logger;
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
protected function createDefaultCache()
|
1013 |
+
{
|
1014 |
+
return new MemoryCacheItemPool;
|
1015 |
+
}
|
1016 |
+
|
1017 |
+
/**
|
1018 |
+
* Set the Http Client object
|
1019 |
+
* @param GuzzleHttp\ClientInterface $http
|
1020 |
+
*/
|
1021 |
+
public function setHttpClient(ClientInterface $http)
|
1022 |
+
{
|
1023 |
+
$this->http = $http;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
/**
|
1027 |
+
* @return GuzzleHttp\ClientInterface implementation
|
1028 |
+
*/
|
1029 |
+
public function getHttpClient()
|
1030 |
+
{
|
1031 |
+
if (null === $this->http) {
|
1032 |
+
$this->http = $this->createDefaultHttpClient();
|
1033 |
+
}
|
1034 |
+
|
1035 |
+
return $this->http;
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
protected function createDefaultHttpClient()
|
1039 |
+
{
|
1040 |
+
$options = ['exceptions' => false];
|
1041 |
+
|
1042 |
+
$version = ClientInterface::VERSION;
|
1043 |
+
if ('5' === $version[0]) {
|
1044 |
+
$options = [
|
1045 |
+
'base_url' => $this->config['base_path'],
|
1046 |
+
'defaults' => $options,
|
1047 |
+
];
|
1048 |
+
if ($this->isAppEngine()) {
|
1049 |
+
// set StreamHandler on AppEngine by default
|
1050 |
+
$options['handler'] = new StreamHandler();
|
1051 |
+
$options['defaults']['verify'] = '/etc/ca-certificates.crt';
|
1052 |
+
}
|
1053 |
+
} else {
|
1054 |
+
// guzzle 6
|
1055 |
+
$options['base_uri'] = $this->config['base_path'];
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
return new Client($options);
|
1059 |
+
}
|
1060 |
+
|
1061 |
+
private function createApplicationDefaultCredentials()
|
1062 |
+
{
|
1063 |
+
$scopes = $this->prepareScopes();
|
1064 |
+
$sub = $this->config['subject'];
|
1065 |
+
$signingKey = $this->config['signing_key'];
|
1066 |
+
|
1067 |
+
// create credentials using values supplied in setAuthConfig
|
1068 |
+
if ($signingKey) {
|
1069 |
+
$serviceAccountCredentials = array(
|
1070 |
+
'client_id' => $this->config['client_id'],
|
1071 |
+
'client_email' => $this->config['client_email'],
|
1072 |
+
'private_key' => $signingKey,
|
1073 |
+
'type' => 'service_account',
|
1074 |
+
);
|
1075 |
+
$credentials = CredentialsLoader::makeCredentials($scopes, $serviceAccountCredentials);
|
1076 |
+
} else {
|
1077 |
+
$credentials = ApplicationDefaultCredentials::getCredentials($scopes);
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
// for service account domain-wide authority (impersonating a user)
|
1081 |
+
// @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
|
1082 |
+
if ($sub) {
|
1083 |
+
if (!$credentials instanceof ServiceAccountCredentials) {
|
1084 |
+
throw new DomainException('domain-wide authority requires service account credentials');
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
$credentials->setSub($sub);
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
return $credentials;
|
1091 |
+
}
|
1092 |
+
|
1093 |
+
protected function getAuthHandler()
|
1094 |
+
{
|
1095 |
+
// Be very careful using the cache, as the underlying auth library's cache
|
1096 |
+
// implementation is naive, and the cache keys do not account for user
|
1097 |
+
// sessions.
|
1098 |
+
//
|
1099 |
+
// @see https://github.com/google/google-api-php-client/issues/821
|
1100 |
+
return Google_AuthHandler_AuthHandlerFactory::build(
|
1101 |
+
$this->getCache(),
|
1102 |
+
$this->config['cache_config']
|
1103 |
+
);
|
1104 |
+
}
|
1105 |
+
|
1106 |
+
private function createUserRefreshCredentials($scope, $refreshToken)
|
1107 |
+
{
|
1108 |
+
$creds = array_filter(
|
1109 |
+
array(
|
1110 |
+
'client_id' => $this->getClientId(),
|
1111 |
+
'client_secret' => $this->getClientSecret(),
|
1112 |
+
'refresh_token' => $refreshToken,
|
1113 |
+
)
|
1114 |
+
);
|
1115 |
+
|
1116 |
+
return new UserRefreshCredentials($scope, $creds);
|
1117 |
+
}
|
1118 |
+
}
|
google/src/Google/Collection.php
CHANGED
@@ -1,100 +1,100 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if (!class_exists('Google_Client')) {
|
4 |
-
require_once __DIR__ . '/autoload.php';
|
5 |
-
}
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Extension to the regular Google_Model that automatically
|
9 |
-
* exposes the items array for iteration, so you can just
|
10 |
-
* iterate over the object rather than a reference inside.
|
11 |
-
*/
|
12 |
-
class Google_Collection extends Google_Model implements Iterator, Countable
|
13 |
-
{
|
14 |
-
protected $collection_key = 'items';
|
15 |
-
|
16 |
-
public function rewind()
|
17 |
-
{
|
18 |
-
if (isset($this->{$this->collection_key})
|
19 |
-
&& is_array($this->{$this->collection_key})) {
|
20 |
-
reset($this->{$this->collection_key});
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
public function current()
|
25 |
-
{
|
26 |
-
$this->coerceType($this->key());
|
27 |
-
if (is_array($this->{$this->collection_key})) {
|
28 |
-
return current($this->{$this->collection_key});
|
29 |
-
}
|
30 |
-
}
|
31 |
-
|
32 |
-
public function key()
|
33 |
-
{
|
34 |
-
if (isset($this->{$this->collection_key})
|
35 |
-
&& is_array($this->{$this->collection_key})) {
|
36 |
-
return key($this->{$this->collection_key});
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
public function next()
|
41 |
-
{
|
42 |
-
return next($this->{$this->collection_key});
|
43 |
-
}
|
44 |
-
|
45 |
-
public function valid()
|
46 |
-
{
|
47 |
-
$key = $this->key();
|
48 |
-
return $key !== null && $key !== false;
|
49 |
-
}
|
50 |
-
|
51 |
-
public function count()
|
52 |
-
{
|
53 |
-
if (!isset($this->{$this->collection_key})) {
|
54 |
-
return 0;
|
55 |
-
}
|
56 |
-
return count($this->{$this->collection_key});
|
57 |
-
}
|
58 |
-
|
59 |
-
public function offsetExists($offset)
|
60 |
-
{
|
61 |
-
if (!is_numeric($offset)) {
|
62 |
-
return parent::offsetExists($offset);
|
63 |
-
}
|
64 |
-
return isset($this->{$this->collection_key}[$offset]);
|
65 |
-
}
|
66 |
-
|
67 |
-
public function offsetGet($offset)
|
68 |
-
{
|
69 |
-
if (!is_numeric($offset)) {
|
70 |
-
return parent::offsetGet($offset);
|
71 |
-
}
|
72 |
-
$this->coerceType($offset);
|
73 |
-
return $this->{$this->collection_key}[$offset];
|
74 |
-
}
|
75 |
-
|
76 |
-
public function offsetSet($offset, $value)
|
77 |
-
{
|
78 |
-
if (!is_numeric($offset)) {
|
79 |
-
return parent::offsetSet($offset, $value);
|
80 |
-
}
|
81 |
-
$this->{$this->collection_key}[$offset] = $value;
|
82 |
-
}
|
83 |
-
|
84 |
-
public function offsetUnset($offset)
|
85 |
-
{
|
86 |
-
if (!is_numeric($offset)) {
|
87 |
-
return parent::offsetUnset($offset);
|
88 |
-
}
|
89 |
-
unset($this->{$this->collection_key}[$offset]);
|
90 |
-
}
|
91 |
-
|
92 |
-
private function coerceType($offset)
|
93 |
-
{
|
94 |
-
$keyType = $this->keyType($this->collection_key);
|
95 |
-
if ($keyType && !is_object($this->{$this->collection_key}[$offset])) {
|
96 |
-
$this->{$this->collection_key}[$offset] =
|
97 |
-
new $keyType($this->{$this->collection_key}[$offset]);
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!class_exists('Google_Client')) {
|
4 |
+
require_once __DIR__ . '/autoload.php';
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Extension to the regular Google_Model that automatically
|
9 |
+
* exposes the items array for iteration, so you can just
|
10 |
+
* iterate over the object rather than a reference inside.
|
11 |
+
*/
|
12 |
+
class Google_Collection extends Google_Model implements Iterator, Countable
|
13 |
+
{
|
14 |
+
protected $collection_key = 'items';
|
15 |
+
|
16 |
+
public function rewind()
|
17 |
+
{
|
18 |
+
if (isset($this->{$this->collection_key})
|
19 |
+
&& is_array($this->{$this->collection_key})) {
|
20 |
+
reset($this->{$this->collection_key});
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
public function current()
|
25 |
+
{
|
26 |
+
$this->coerceType($this->key());
|
27 |
+
if (is_array($this->{$this->collection_key})) {
|
28 |
+
return current($this->{$this->collection_key});
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
public function key()
|
33 |
+
{
|
34 |
+
if (isset($this->{$this->collection_key})
|
35 |
+
&& is_array($this->{$this->collection_key})) {
|
36 |
+
return key($this->{$this->collection_key});
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
public function next()
|
41 |
+
{
|
42 |
+
return next($this->{$this->collection_key});
|
43 |
+
}
|
44 |
+
|
45 |
+
public function valid()
|
46 |
+
{
|
47 |
+
$key = $this->key();
|
48 |
+
return $key !== null && $key !== false;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function count()
|
52 |
+
{
|
53 |
+
if (!isset($this->{$this->collection_key})) {
|
54 |
+
return 0;
|
55 |
+
}
|
56 |
+
return count($this->{$this->collection_key});
|
57 |
+
}
|
58 |
+
|
59 |
+
public function offsetExists($offset)
|
60 |
+
{
|
61 |
+
if (!is_numeric($offset)) {
|
62 |
+
return parent::offsetExists($offset);
|
63 |
+
}
|
64 |
+
return isset($this->{$this->collection_key}[$offset]);
|
65 |
+
}
|
66 |
+
|
67 |
+
public function offsetGet($offset)
|
68 |
+
{
|
69 |
+
if (!is_numeric($offset)) {
|
70 |
+
return parent::offsetGet($offset);
|
71 |
+
}
|
72 |
+
$this->coerceType($offset);
|
73 |
+
return $this->{$this->collection_key}[$offset];
|
74 |
+
}
|
75 |
+
|
76 |
+
public function offsetSet($offset, $value)
|
77 |
+
{
|
78 |
+
if (!is_numeric($offset)) {
|
79 |
+
return parent::offsetSet($offset, $value);
|
80 |
+
}
|
81 |
+
$this->{$this->collection_key}[$offset] = $value;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function offsetUnset($offset)
|
85 |
+
{
|
86 |
+
if (!is_numeric($offset)) {
|
87 |
+
return parent::offsetUnset($offset);
|
88 |
+
}
|
89 |
+
unset($this->{$this->collection_key}[$offset]);
|
90 |
+
}
|
91 |
+
|
92 |
+
private function coerceType($offset)
|
93 |
+
{
|
94 |
+
$keyType = $this->keyType($this->collection_key);
|
95 |
+
if ($keyType && !is_object($this->{$this->collection_key}[$offset])) {
|
96 |
+
$this->{$this->collection_key}[$offset] =
|
97 |
+
new $keyType($this->{$this->collection_key}[$offset]);
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
google/src/Google/Exception.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2013 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
class Google_Exception extends Exception
|
19 |
-
{
|
20 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2013 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Google_Exception extends Exception
|
19 |
+
{
|
20 |
+
}
|
google/src/Google/Http/Batch.php
CHANGED
@@ -1,249 +1,249 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2012 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
use GuzzleHttp\Psr7;
|
19 |
-
use GuzzleHttp\Psr7\Request;
|
20 |
-
use GuzzleHttp\Psr7\Response;
|
21 |
-
use Psr\Http\Message\RequestInterface;
|
22 |
-
use Psr\Http\Message\ResponseInterface;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Class to handle batched requests to the Google API service.
|
26 |
-
*/
|
27 |
-
class Google_Http_Batch
|
28 |
-
{
|
29 |
-
const BATCH_PATH = 'batch';
|
30 |
-
|
31 |
-
private static $CONNECTION_ESTABLISHED_HEADERS = array(
|
32 |
-
"HTTP/1.0 200 Connection established\r\n\r\n",
|
33 |
-
"HTTP/1.1 200 Connection established\r\n\r\n",
|
34 |
-
);
|
35 |
-
|
36 |
-
/** @var string Multipart Boundary. */
|
37 |
-
private $boundary;
|
38 |
-
|
39 |
-
/** @var array service requests to be executed. */
|
40 |
-
private $requests = array();
|
41 |
-
|
42 |
-
/** @var Google_Client */
|
43 |
-
private $client;
|
44 |
-
|
45 |
-
private $rootUrl;
|
46 |
-
|
47 |
-
private $batchPath;
|
48 |
-
|
49 |
-
public function __construct(
|
50 |
-
Google_Client $client,
|
51 |
-
$boundary = false,
|
52 |
-
$rootUrl = null,
|
53 |
-
$batchPath = null
|
54 |
-
) {
|
55 |
-
$this->client = $client;
|
56 |
-
$this->boundary = $boundary ?: mt_rand();
|
57 |
-
$this->rootUrl = rtrim($rootUrl ?: $this->client->getConfig('base_path'), '/');
|
58 |
-
$this->batchPath = $batchPath ?: self::BATCH_PATH;
|
59 |
-
}
|
60 |
-
|
61 |
-
public function add(RequestInterface $request, $key = false)
|
62 |
-
{
|
63 |
-
if (false == $key) {
|
64 |
-
$key = mt_rand();
|
65 |
-
}
|
66 |
-
|
67 |
-
$this->requests[$key] = $request;
|
68 |
-
}
|
69 |
-
|
70 |
-
public function execute()
|
71 |
-
{
|
72 |
-
$body = '';
|
73 |
-
$classes = array();
|
74 |
-
$batchHttpTemplate = <<<EOF
|
75 |
-
--%s
|
76 |
-
Content-Type: application/http
|
77 |
-
Content-Transfer-Encoding: binary
|
78 |
-
MIME-Version: 1.0
|
79 |
-
Content-ID: %s
|
80 |
-
|
81 |
-
%s
|
82 |
-
%s%s
|
83 |
-
|
84 |
-
|
85 |
-
EOF;
|
86 |
-
|
87 |
-
/** @var Google_Http_Request $req */
|
88 |
-
foreach ($this->requests as $key => $request) {
|
89 |
-
$firstLine = sprintf(
|
90 |
-
'%s %s HTTP/%s',
|
91 |
-
$request->getMethod(),
|
92 |
-
$request->getRequestTarget(),
|
93 |
-
$request->getProtocolVersion()
|
94 |
-
);
|
95 |
-
|
96 |
-
$content = (string) $request->getBody();
|
97 |
-
|
98 |
-
$headers = '';
|
99 |
-
foreach ($request->getHeaders() as $name => $values) {
|
100 |
-
$headers .= sprintf("%s:%s\r\n", $name, implode(', ', $values));
|
101 |
-
}
|
102 |
-
|
103 |
-
$body .= sprintf(
|
104 |
-
$batchHttpTemplate,
|
105 |
-
$this->boundary,
|
106 |
-
$key,
|
107 |
-
$firstLine,
|
108 |
-
$headers,
|
109 |
-
$content ? "\n".$content : ''
|
110 |
-
);
|
111 |
-
|
112 |
-
$classes['response-' . $key] = $request->getHeaderLine('X-Php-Expected-Class');
|
113 |
-
}
|
114 |
-
|
115 |
-
$body .= "--{$this->boundary}--";
|
116 |
-
$body = trim($body);
|
117 |
-
$url = $this->rootUrl . '/' . $this->batchPath;
|
118 |
-
$headers = array(
|
119 |
-
'Content-Type' => sprintf('multipart/mixed; boundary=%s', $this->boundary),
|
120 |
-
'Content-Length' => strlen($body),
|
121 |
-
);
|
122 |
-
|
123 |
-
$request = new Request(
|
124 |
-
'POST',
|
125 |
-
$url,
|
126 |
-
$headers,
|
127 |
-
$body
|
128 |
-
);
|
129 |
-
|
130 |
-
$response = $this->client->execute($request);
|
131 |
-
|
132 |
-
return $this->parseResponse($response, $classes);
|
133 |
-
}
|
134 |
-
|
135 |
-
public function parseResponse(ResponseInterface $response, $classes = array())
|
136 |
-
{
|
137 |
-
$contentType = $response->getHeaderLine('content-type');
|
138 |
-
$contentType = explode(';', $contentType);
|
139 |
-
$boundary = false;
|
140 |
-
foreach ($contentType as $part) {
|
141 |
-
$part = explode('=', $part, 2);
|
142 |
-
if (isset($part[0]) && 'boundary' == trim($part[0])) {
|
143 |
-
$boundary = $part[1];
|
144 |
-
}
|
145 |
-
}
|
146 |
-
|
147 |
-
$body = (string) $response->getBody();
|
148 |
-
if (!empty($body)) {
|
149 |
-
$body = str_replace("--$boundary--", "--$boundary", $body);
|
150 |
-
$parts = explode("--$boundary", $body);
|
151 |
-
$responses = array();
|
152 |
-
$requests = array_values($this->requests);
|
153 |
-
|
154 |
-
foreach ($parts as $i => $part) {
|
155 |
-
$part = trim($part);
|
156 |
-
if (!empty($part)) {
|
157 |
-
list($rawHeaders, $part) = explode("\r\n\r\n", $part, 2);
|
158 |
-
$headers = $this->parseRawHeaders($rawHeaders);
|
159 |
-
|
160 |
-
$status = substr($part, 0, strpos($part, "\n"));
|
161 |
-
$status = explode(" ", $status);
|
162 |
-
$status = $status[1];
|
163 |
-
|
164 |
-
list($partHeaders, $partBody) = $this->parseHttpResponse($part, false);
|
165 |
-
$response = new Response(
|
166 |
-
$status,
|
167 |
-
$partHeaders,
|
168 |
-
Psr7\stream_for($partBody)
|
169 |
-
);
|
170 |
-
|
171 |
-
// Need content id.
|
172 |
-
$key = $headers['content-id'];
|
173 |
-
|
174 |
-
try {
|
175 |
-
$response = Google_Http_REST::decodeHttpResponse($response, $requests[$i-1]);
|
176 |
-
} catch (Google_Service_Exception $e) {
|
177 |
-
// Store the exception as the response, so successful responses
|
178 |
-
// can be processed.
|
179 |
-
$response = $e;
|
180 |
-
}
|
181 |
-
|
182 |
-
$responses[$key] = $response;
|
183 |
-
}
|
184 |
-
}
|
185 |
-
|
186 |
-
return $responses;
|
187 |
-
}
|
188 |
-
|
189 |
-
return null;
|
190 |
-
}
|
191 |
-
|
192 |
-
private function parseRawHeaders($rawHeaders)
|
193 |
-
{
|
194 |
-
$headers = array();
|
195 |
-
$responseHeaderLines = explode("\r\n", $rawHeaders);
|
196 |
-
foreach ($responseHeaderLines as $headerLine) {
|
197 |
-
if ($headerLine && strpos($headerLine, ':') !== false) {
|
198 |
-
list($header, $value) = explode(': ', $headerLine, 2);
|
199 |
-
$header = strtolower($header);
|
200 |
-
if (isset($headers[$header])) {
|
201 |
-
$headers[$header] .= "\n" . $value;
|
202 |
-
} else {
|
203 |
-
$headers[$header] = $value;
|
204 |
-
}
|
205 |
-
}
|
206 |
-
}
|
207 |
-
return $headers;
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Used by the IO lib and also the batch processing.
|
212 |
-
*
|
213 |
-
* @param $respData
|
214 |
-
* @param $headerSize
|
215 |
-
* @return array
|
216 |
-
*/
|
217 |
-
private function parseHttpResponse($respData, $headerSize)
|
218 |
-
{
|
219 |
-
// check proxy header
|
220 |
-
foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
|
221 |
-
if (stripos($respData, $established_header) !== false) {
|
222 |
-
// existed, remove it
|
223 |
-
$respData = str_ireplace($established_header, '', $respData);
|
224 |
-
// Subtract the proxy header size unless the cURL bug prior to 7.30.0
|
225 |
-
// is present which prevented the proxy header size from being taken into
|
226 |
-
// account.
|
227 |
-
// @TODO look into this
|
228 |
-
// if (!$this->needsQuirk()) {
|
229 |
-
// $headerSize -= strlen($established_header);
|
230 |
-
// }
|
231 |
-
break;
|
232 |
-
}
|
233 |
-
}
|
234 |
-
|
235 |
-
if ($headerSize) {
|
236 |
-
$responseBody = substr($respData, $headerSize);
|
237 |
-
$responseHeaders = substr($respData, 0, $headerSize);
|
238 |
-
} else {
|
239 |
-
$responseSegments = explode("\r\n\r\n", $respData, 2);
|
240 |
-
$responseHeaders = $responseSegments[0];
|
241 |
-
$responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
|
242 |
-
null;
|
243 |
-
}
|
244 |
-
|
245 |
-
$responseHeaders = $this->parseRawHeaders($responseHeaders);
|
246 |
-
|
247 |
-
return array($responseHeaders, $responseBody);
|
248 |
-
}
|
249 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2012 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
use GuzzleHttp\Psr7;
|
19 |
+
use GuzzleHttp\Psr7\Request;
|
20 |
+
use GuzzleHttp\Psr7\Response;
|
21 |
+
use Psr\Http\Message\RequestInterface;
|
22 |
+
use Psr\Http\Message\ResponseInterface;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Class to handle batched requests to the Google API service.
|
26 |
+
*/
|
27 |
+
class Google_Http_Batch
|
28 |
+
{
|
29 |
+
const BATCH_PATH = 'batch';
|
30 |
+
|
31 |
+
private static $CONNECTION_ESTABLISHED_HEADERS = array(
|
32 |
+
"HTTP/1.0 200 Connection established\r\n\r\n",
|
33 |
+
"HTTP/1.1 200 Connection established\r\n\r\n",
|
34 |
+
);
|
35 |
+
|
36 |
+
/** @var string Multipart Boundary. */
|
37 |
+
private $boundary;
|
38 |
+
|
39 |
+
/** @var array service requests to be executed. */
|
40 |
+
private $requests = array();
|
41 |
+
|
42 |
+
/** @var Google_Client */
|
43 |
+
private $client;
|
44 |
+
|
45 |
+
private $rootUrl;
|
46 |
+
|
47 |
+
private $batchPath;
|
48 |
+
|
49 |
+
public function __construct(
|
50 |
+
Google_Client $client,
|
51 |
+
$boundary = false,
|
52 |
+
$rootUrl = null,
|
53 |
+
$batchPath = null
|
54 |
+
) {
|
55 |
+
$this->client = $client;
|
56 |
+
$this->boundary = $boundary ?: mt_rand();
|
57 |
+
$this->rootUrl = rtrim($rootUrl ?: $this->client->getConfig('base_path'), '/');
|
58 |
+
$this->batchPath = $batchPath ?: self::BATCH_PATH;
|
59 |
+
}
|
60 |
+
|
61 |
+
public function add(RequestInterface $request, $key = false)
|
62 |
+
{
|
63 |
+
if (false == $key) {
|
64 |
+
$key = mt_rand();
|
65 |
+
}
|
66 |
+
|
67 |
+
$this->requests[$key] = $request;
|
68 |
+
}
|
69 |
+
|
70 |
+
public function execute()
|
71 |
+
{
|
72 |
+
$body = '';
|
73 |
+
$classes = array();
|
74 |
+
$batchHttpTemplate = <<<EOF
|
75 |
+
--%s
|
76 |
+
Content-Type: application/http
|
77 |
+
Content-Transfer-Encoding: binary
|
78 |
+
MIME-Version: 1.0
|
79 |
+
Content-ID: %s
|
80 |
+
|
81 |
+
%s
|
82 |
+
%s%s
|
83 |
+
|
84 |
+
|
85 |
+
EOF;
|
86 |
+
|
87 |
+
/** @var Google_Http_Request $req */
|
88 |
+
foreach ($this->requests as $key => $request) {
|
89 |
+
$firstLine = sprintf(
|
90 |
+
'%s %s HTTP/%s',
|
91 |
+
$request->getMethod(),
|
92 |
+
$request->getRequestTarget(),
|
93 |
+
$request->getProtocolVersion()
|
94 |
+
);
|
95 |
+
|
96 |
+
$content = (string) $request->getBody();
|
97 |
+
|
98 |
+
$headers = '';
|
99 |
+
foreach ($request->getHeaders() as $name => $values) {
|
100 |
+
$headers .= sprintf("%s:%s\r\n", $name, implode(', ', $values));
|
101 |
+
}
|
102 |
+
|
103 |
+
$body .= sprintf(
|
104 |
+
$batchHttpTemplate,
|
105 |
+
$this->boundary,
|
106 |
+
$key,
|
107 |
+
$firstLine,
|
108 |
+
$headers,
|
109 |
+
$content ? "\n".$content : ''
|
110 |
+
);
|
111 |
+
|
112 |
+
$classes['response-' . $key] = $request->getHeaderLine('X-Php-Expected-Class');
|
113 |
+
}
|
114 |
+
|
115 |
+
$body .= "--{$this->boundary}--";
|
116 |
+
$body = trim($body);
|
117 |
+
$url = $this->rootUrl . '/' . $this->batchPath;
|
118 |
+
$headers = array(
|
119 |
+
'Content-Type' => sprintf('multipart/mixed; boundary=%s', $this->boundary),
|
120 |
+
'Content-Length' => strlen($body),
|
121 |
+
);
|
122 |
+
|
123 |
+
$request = new Request(
|
124 |
+
'POST',
|
125 |
+
$url,
|
126 |
+
$headers,
|
127 |
+
$body
|
128 |
+
);
|
129 |
+
|
130 |
+
$response = $this->client->execute($request);
|
131 |
+
|
132 |
+
return $this->parseResponse($response, $classes);
|
133 |
+
}
|
134 |
+
|
135 |
+
public function parseResponse(ResponseInterface $response, $classes = array())
|
136 |
+
{
|
137 |
+
$contentType = $response->getHeaderLine('content-type');
|
138 |
+
$contentType = explode(';', $contentType);
|
139 |
+
$boundary = false;
|
140 |
+
foreach ($contentType as $part) {
|
141 |
+
$part = explode('=', $part, 2);
|
142 |
+
if (isset($part[0]) && 'boundary' == trim($part[0])) {
|
143 |
+
$boundary = $part[1];
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
$body = (string) $response->getBody();
|
148 |
+
if (!empty($body)) {
|
149 |
+
$body = str_replace("--$boundary--", "--$boundary", $body);
|
150 |
+
$parts = explode("--$boundary", $body);
|
151 |
+
$responses = array();
|
152 |
+
$requests = array_values($this->requests);
|
153 |
+
|
154 |
+
foreach ($parts as $i => $part) {
|
155 |
+
$part = trim($part);
|
156 |
+
if (!empty($part)) {
|
157 |
+
list($rawHeaders, $part) = explode("\r\n\r\n", $part, 2);
|
158 |
+
$headers = $this->parseRawHeaders($rawHeaders);
|
159 |
+
|
160 |
+
$status = substr($part, 0, strpos($part, "\n"));
|
161 |
+
$status = explode(" ", $status);
|
162 |
+
$status = $status[1];
|
163 |
+
|
164 |
+
list($partHeaders, $partBody) = $this->parseHttpResponse($part, false);
|
165 |
+
$response = new Response(
|
166 |
+
$status,
|
167 |
+
$partHeaders,
|
168 |
+
Psr7\stream_for($partBody)
|
169 |
+
);
|
170 |
+
|
171 |
+
// Need content id.
|
172 |
+
$key = $headers['content-id'];
|
173 |
+
|
174 |
+
try {
|
175 |
+
$response = Google_Http_REST::decodeHttpResponse($response, $requests[$i-1]);
|
176 |
+
} catch (Google_Service_Exception $e) {
|
177 |
+
// Store the exception as the response, so successful responses
|
178 |
+
// can be processed.
|
179 |
+
$response = $e;
|
180 |
+
}
|
181 |
+
|
182 |
+
$responses[$key] = $response;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
|
186 |
+
return $responses;
|
187 |
+
}
|
188 |
+
|
189 |
+
return null;
|
190 |
+
}
|
191 |
+
|
192 |
+
private function parseRawHeaders($rawHeaders)
|
193 |
+
{
|
194 |
+
$headers = array();
|
195 |
+
$responseHeaderLines = explode("\r\n", $rawHeaders);
|
196 |
+
foreach ($responseHeaderLines as $headerLine) {
|
197 |
+
if ($headerLine && strpos($headerLine, ':') !== false) {
|
198 |
+
list($header, $value) = explode(': ', $headerLine, 2);
|
199 |
+
$header = strtolower($header);
|
200 |
+
if (isset($headers[$header])) {
|
201 |
+
$headers[$header] .= "\n" . $value;
|
202 |
+
} else {
|
203 |
+
$headers[$header] = $value;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
return $headers;
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Used by the IO lib and also the batch processing.
|
212 |
+
*
|
213 |
+
* @param $respData
|
214 |
+
* @param $headerSize
|
215 |
+
* @return array
|
216 |
+
*/
|
217 |
+
private function parseHttpResponse($respData, $headerSize)
|
218 |
+
{
|
219 |
+
// check proxy header
|
220 |
+
foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) {
|
221 |
+
if (stripos($respData, $established_header) !== false) {
|
222 |
+
// existed, remove it
|
223 |
+
$respData = str_ireplace($established_header, '', $respData);
|
224 |
+
// Subtract the proxy header size unless the cURL bug prior to 7.30.0
|
225 |
+
// is present which prevented the proxy header size from being taken into
|
226 |
+
// account.
|
227 |
+
// @TODO look into this
|
228 |
+
// if (!$this->needsQuirk()) {
|
229 |
+
// $headerSize -= strlen($established_header);
|
230 |
+
// }
|
231 |
+
break;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
if ($headerSize) {
|
236 |
+
$responseBody = substr($respData, $headerSize);
|
237 |
+
$responseHeaders = substr($respData, 0, $headerSize);
|
238 |
+
} else {
|
239 |
+
$responseSegments = explode("\r\n\r\n", $respData, 2);
|
240 |
+
$responseHeaders = $responseSegments[0];
|
241 |
+
$responseBody = isset($responseSegments[1]) ? $responseSegments[1] :
|
242 |
+
null;
|
243 |
+
}
|
244 |
+
|
245 |
+
$responseHeaders = $this->parseRawHeaders($responseHeaders);
|
246 |
+
|
247 |
+
return array($responseHeaders, $responseBody);
|
248 |
+
}
|
249 |
+
}
|
google/src/Google/Http/MediaFileUpload.php
CHANGED
@@ -1,351 +1,351 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2012 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
use GuzzleHttp\Psr7;
|
19 |
-
use GuzzleHttp\Psr7\Request;
|
20 |
-
use GuzzleHttp\Psr7\Uri;
|
21 |
-
use Psr\Http\Message\RequestInterface;
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Manage large file uploads, which may be media but can be any type
|
25 |
-
* of sizable data.
|
26 |
-
*/
|
27 |
-
class Google_Http_MediaFileUpload
|
28 |
-
{
|
29 |
-
const UPLOAD_MEDIA_TYPE = 'media';
|
30 |
-
const UPLOAD_MULTIPART_TYPE = 'multipart';
|
31 |
-
const UPLOAD_RESUMABLE_TYPE = 'resumable';
|
32 |
-
|
33 |
-
/** @var string $mimeType */
|
34 |
-
private $mimeType;
|
35 |
-
|
36 |
-
/** @var string $data */
|
37 |
-
private $data;
|
38 |
-
|
39 |
-
/** @var bool $resumable */
|
40 |
-
private $resumable;
|
41 |
-
|
42 |
-
/** @var int $chunkSize */
|
43 |
-
private $chunkSize;
|
44 |
-
|
45 |
-
/** @var int $size */
|
46 |
-
private $size;
|
47 |
-
|
48 |
-
/** @var string $resumeUri */
|
49 |
-
private $resumeUri;
|
50 |
-
|
51 |
-
/** @var int $progress */
|
52 |
-
private $progress;
|
53 |
-
|
54 |
-
/** @var Google_Client */
|
55 |
-
private $client;
|
56 |
-
|
57 |
-
/** @var Psr\Http\Message\RequestInterface */
|
58 |
-
private $request;
|
59 |
-
|
60 |
-
/** @var string */
|
61 |
-
private $boundary;
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Result code from last HTTP call
|
65 |
-
* @var int
|
66 |
-
*/
|
67 |
-
private $httpResultCode;
|
68 |
-
|
69 |
-
/**
|
70 |
-
* @param $mimeType string
|
71 |
-
* @param $data string The bytes you want to upload.
|
72 |
-
* @param $resumable bool
|
73 |
-
* @param bool $chunkSize File will be uploaded in chunks of this many bytes.
|
74 |
-
* only used if resumable=True
|
75 |
-
*/
|
76 |
-
public function __construct(
|
77 |
-
Google_Client $client,
|
78 |
-
RequestInterface $request,
|
79 |
-
$mimeType,
|
80 |
-
$data,
|
81 |
-
$resumable = false,
|
82 |
-
$chunkSize = false
|
83 |
-
) {
|
84 |
-
$this->client = $client;
|
85 |
-
$this->request = $request;
|
86 |
-
$this->mimeType = $mimeType;
|
87 |
-
$this->data = $data;
|
88 |
-
$this->resumable = $resumable;
|
89 |
-
$this->chunkSize = $chunkSize;
|
90 |
-
$this->progress = 0;
|
91 |
-
|
92 |
-
$this->process();
|
93 |
-
}
|
94 |
-
|
95 |
-
/**
|
96 |
-
* Set the size of the file that is being uploaded.
|
97 |
-
* @param $size - int file size in bytes
|
98 |
-
*/
|
99 |
-
public function setFileSize($size)
|
100 |
-
{
|
101 |
-
$this->size = $size;
|
102 |
-
}
|
103 |
-
|
104 |
-
/**
|
105 |
-
* Return the progress on the upload
|
106 |
-
* @return int progress in bytes uploaded.
|
107 |
-
*/
|
108 |
-
public function getProgress()
|
109 |
-
{
|
110 |
-
return $this->progress;
|
111 |
-
}
|
112 |
-
|
113 |
-
/**
|
114 |
-
* Send the next part of the file to upload.
|
115 |
-
* @param [$chunk] the next set of bytes to send. If false will used $data passed
|
116 |
-
* at construct time.
|
117 |
-
*/
|
118 |
-
public function nextChunk($chunk = false)
|
119 |
-
{
|
120 |
-
$resumeUri = $this->getResumeUri();
|
121 |
-
|
122 |
-
if (false == $chunk) {
|
123 |
-
$chunk = substr($this->data, $this->progress, $this->chunkSize);
|
124 |
-
}
|
125 |
-
|
126 |
-
$lastBytePos = $this->progress + strlen($chunk) - 1;
|
127 |
-
$headers = array(
|
128 |
-
'content-range' => "bytes $this->progress-$lastBytePos/$this->size",
|
129 |
-
'content-length' => strlen($chunk),
|
130 |
-
'expect' => '',
|
131 |
-
);
|
132 |
-
|
133 |
-
$request = new Request(
|
134 |
-
'PUT',
|
135 |
-
$resumeUri,
|
136 |
-
$headers,
|
137 |
-
Psr7\stream_for($chunk)
|
138 |
-
);
|
139 |
-
|
140 |
-
return $this->makePutRequest($request);
|
141 |
-
}
|
142 |
-
|
143 |
-
/**
|
144 |
-
* Return the HTTP result code from the last call made.
|
145 |
-
* @return int code
|
146 |
-
*/
|
147 |
-
public function getHttpResultCode()
|
148 |
-
{
|
149 |
-
return $this->httpResultCode;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Sends a PUT-Request to google drive and parses the response,
|
154 |
-
* setting the appropiate variables from the response()
|
155 |
-
*
|
156 |
-
* @param Google_Http_Request $httpRequest the Reuqest which will be send
|
157 |
-
*
|
158 |
-
* @return false|mixed false when the upload is unfinished or the decoded http response
|
159 |
-
*
|
160 |
-
*/
|
161 |
-
private function makePutRequest(RequestInterface $request)
|
162 |
-
{
|
163 |
-
$response = $this->client->execute($request);
|
164 |
-
$this->httpResultCode = $response->getStatusCode();
|
165 |
-
|
166 |
-
if (308 == $this->httpResultCode) {
|
167 |
-
// Track the amount uploaded.
|
168 |
-
$range = $response->getHeaderLine('range');
|
169 |
-
if ($range) {
|
170 |
-
$range_array = explode('-', $range);
|
171 |
-
$this->progress = $range_array[1] + 1;
|
172 |
-
}
|
173 |
-
|
174 |
-
// Allow for changing upload URLs.
|
175 |
-
$location = $response->getHeaderLine('location');
|
176 |
-
if ($location) {
|
177 |
-
$this->resumeUri = $location;
|
178 |
-
}
|
179 |
-
|
180 |
-
// No problems, but upload not complete.
|
181 |
-
return false;
|
182 |
-
}
|
183 |
-
|
184 |
-
return Google_Http_REST::decodeHttpResponse($response, $this->request);
|
185 |
-
}
|
186 |
-
|
187 |
-
/**
|
188 |
-
* Resume a previously unfinished upload
|
189 |
-
* @param $resumeUri the resume-URI of the unfinished, resumable upload.
|
190 |
-
*/
|
191 |
-
public function resume($resumeUri)
|
192 |
-
{
|
193 |
-
$this->resumeUri = $resumeUri;
|
194 |
-
$headers = array(
|
195 |
-
'content-range' => "bytes */$this->size",
|
196 |
-
'content-length' => 0,
|
197 |
-
);
|
198 |
-
$httpRequest = new Request(
|
199 |
-
'PUT',
|
200 |
-
$this->resumeUri,
|
201 |
-
$headers
|
202 |
-
);
|
203 |
-
|
204 |
-
return $this->makePutRequest($httpRequest);
|
205 |
-
}
|
206 |
-
|
207 |
-
/**
|
208 |
-
* @return Psr\Http\Message\RequestInterface $request
|
209 |
-
* @visible for testing
|
210 |
-
*/
|
211 |
-
private function process()
|
212 |
-
{
|
213 |
-
$this->transformToUploadUrl();
|
214 |
-
$request = $this->request;
|
215 |
-
|
216 |
-
$postBody = '';
|
217 |
-
$contentType = false;
|
218 |
-
|
219 |
-
$meta = (string) $request->getBody();
|
220 |
-
$meta = is_string($meta) ? json_decode($meta, true) : $meta;
|
221 |
-
|
222 |
-
$uploadType = $this->getUploadType($meta);
|
223 |
-
$request = $request->withUri(
|
224 |
-
Uri::withQueryValue($request->getUri(), 'uploadType', $uploadType)
|
225 |
-
);
|
226 |
-
|
227 |
-
$mimeType = $this->mimeType ?: $request->getHeaderLine('content-type');
|
228 |
-
|
229 |
-
if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
|
230 |
-
$contentType = $mimeType;
|
231 |
-
$postBody = is_string($meta) ? $meta : json_encode($meta);
|
232 |
-
} else if (self::UPLOAD_MEDIA_TYPE == $uploadType) {
|
233 |
-
$contentType = $mimeType;
|
234 |
-
$postBody = $this->data;
|
235 |
-
} else if (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
|
236 |
-
// This is a multipart/related upload.
|
237 |
-
$boundary = $this->boundary ?: mt_rand();
|
238 |
-
$boundary = str_replace('"', '', $boundary);
|
239 |
-
$contentType = 'multipart/related; boundary=' . $boundary;
|
240 |
-
$related = "--$boundary\r\n";
|
241 |
-
$related .= "Content-Type: application/json; charset=UTF-8\r\n";
|
242 |
-
$related .= "\r\n" . json_encode($meta) . "\r\n";
|
243 |
-
$related .= "--$boundary\r\n";
|
244 |
-
$related .= "Content-Type: $mimeType\r\n";
|
245 |
-
$related .= "Content-Transfer-Encoding: base64\r\n";
|
246 |
-
$related .= "\r\n" . base64_encode($this->data) . "\r\n";
|
247 |
-
$related .= "--$boundary--";
|
248 |
-
$postBody = $related;
|
249 |
-
}
|
250 |
-
|
251 |
-
$request = $request->withBody(Psr7\stream_for($postBody));
|
252 |
-
|
253 |
-
if (isset($contentType) && $contentType) {
|
254 |
-
$request = $request->withHeader('content-type', $contentType);
|
255 |
-
}
|
256 |
-
|
257 |
-
return $this->request = $request;
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Valid upload types:
|
262 |
-
* - resumable (UPLOAD_RESUMABLE_TYPE)
|
263 |
-
* - media (UPLOAD_MEDIA_TYPE)
|
264 |
-
* - multipart (UPLOAD_MULTIPART_TYPE)
|
265 |
-
* @param $meta
|
266 |
-
* @return string
|
267 |
-
* @visible for testing
|
268 |
-
*/
|
269 |
-
public function getUploadType($meta)
|
270 |
-
{
|
271 |
-
if ($this->resumable) {
|
272 |
-
return self::UPLOAD_RESUMABLE_TYPE;
|
273 |
-
}
|
274 |
-
|
275 |
-
if (false == $meta && $this->data) {
|
276 |
-
return self::UPLOAD_MEDIA_TYPE;
|
277 |
-
}
|
278 |
-
|
279 |
-
return self::UPLOAD_MULTIPART_TYPE;
|
280 |
-
}
|
281 |
-
|
282 |
-
public function getResumeUri()
|
283 |
-
{
|
284 |
-
if (null === $this->resumeUri) {
|
285 |
-
$this->resumeUri = $this->fetchResumeUri();
|
286 |
-
}
|
287 |
-
|
288 |
-
return $this->resumeUri;
|
289 |
-
}
|
290 |
-
|
291 |
-
private function fetchResumeUri()
|
292 |
-
{
|
293 |
-
$body = $this->request->getBody();
|
294 |
-
if ($body) {
|
295 |
-
$headers = array(
|
296 |
-
'content-type' => 'application/json; charset=UTF-8',
|
297 |
-
'content-length' => $body->getSize(),
|
298 |
-
'x-upload-content-type' => $this->mimeType,
|
299 |
-
'x-upload-content-length' => $this->size,
|
300 |
-
'expect' => '',
|
301 |
-
);
|
302 |
-
foreach ($headers as $key => $value) {
|
303 |
-
$this->request = $this->request->withHeader($key, $value);
|
304 |
-
}
|
305 |
-
}
|
306 |
-
|
307 |
-
$response = $this->client->execute($this->request, false);
|
308 |
-
$location = $response->getHeaderLine('location');
|
309 |
-
$code = $response->getStatusCode();
|
310 |
-
|
311 |
-
if (200 == $code && true == $location) {
|
312 |
-
return $location;
|
313 |
-
}
|
314 |
-
|
315 |
-
$message = $code;
|
316 |
-
$body = json_decode((string) $this->request->getBody(), true);
|
317 |
-
if (isset($body['error']['errors'])) {
|
318 |
-
$message .= ': ';
|
319 |
-
foreach ($body['error']['errors'] as $error) {
|
320 |
-
$message .= "{$error[domain]}, {$error[message]};";
|
321 |
-
}
|
322 |
-
$message = rtrim($message, ';');
|
323 |
-
}
|
324 |
-
|
325 |
-
$error = "Failed to start the resumable upload (HTTP {$message})";
|
326 |
-
$this->client->getLogger()->error($error);
|
327 |
-
|
328 |
-
throw new Google_Exception($error);
|
329 |
-
}
|
330 |
-
|
331 |
-
private function transformToUploadUrl()
|
332 |
-
{
|
333 |
-
$parts = parse_url((string) $this->request->getUri());
|
334 |
-
if (!isset($parts['path'])) {
|
335 |
-
$parts['path'] = '';
|
336 |
-
}
|
337 |
-
$parts['path'] = '/upload' . $parts['path'];
|
338 |
-
$uri = Uri::fromParts($parts);
|
339 |
-
$this->request = $this->request->withUri($uri);
|
340 |
-
}
|
341 |
-
|
342 |
-
public function setChunkSize($chunkSize)
|
343 |
-
{
|
344 |
-
$this->chunkSize = $chunkSize;
|
345 |
-
}
|
346 |
-
|
347 |
-
public function getRequest()
|
348 |
-
{
|
349 |
-
return $this->request;
|
350 |
-
}
|
351 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright 2012 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
use GuzzleHttp\Psr7;
|
19 |
+
use GuzzleHttp\Psr7\Request;
|
20 |
+
use GuzzleHttp\Psr7\Uri;
|
21 |
+
use Psr\Http\Message\RequestInterface;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Manage large file uploads, which may be media but can be any type
|
25 |
+
* of sizable data.
|
26 |
+
*/
|
27 |
+
class Google_Http_MediaFileUpload
|
28 |
+
{
|
29 |
+
const UPLOAD_MEDIA_TYPE = 'media';
|
30 |
+
const UPLOAD_MULTIPART_TYPE = 'multipart';
|
31 |
+
const UPLOAD_RESUMABLE_TYPE = 'resumable';
|
32 |
+
|
33 |
+
/** @var string $mimeType */
|
34 |
+
private $mimeType;
|
35 |
+
|
36 |
+
/** @var string $data */
|
37 |
+
private $data;
|
38 |
+
|
39 |
+
/** @var bool $resumable */
|
40 |
+
private $resumable;
|
41 |
+
|
42 |
+
/** @var int $chunkSize */
|
43 |
+
private $chunkSize;
|
44 |
+
|
45 |
+
/** @var int $size */
|
46 |
+
private $size;
|
47 |
+
|
48 |
+
/** @var string $resumeUri */
|
49 |
+
private $resumeUri;
|
50 |
+
|
51 |
+
/** @var int $progress */
|
52 |
+
private $progress;
|
53 |
+
|
54 |
+
/** @var Google_Client */
|
55 |
+
private $client;
|
56 |
+
|
57 |
+
/** @var Psr\Http\Message\RequestInterface */
|
58 |
+
private $request;
|
59 |
+
|
60 |
+
/** @var string */
|
61 |
+
private $boundary;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Result code from last HTTP call
|
65 |
+
* @var int
|
66 |
+
*/
|
67 |
+
private $httpResultCode;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param $mimeType string
|
71 |
+
* @param $data string The bytes you want to upload.
|
72 |
+
* @param $resumable bool
|
73 |
+
* @param bool $chunkSize File will be uploaded in chunks of this many bytes.
|
74 |
+
* only used if resumable=True
|
75 |
+
*/
|
76 |
+
public function __construct(
|
77 |
+
Google_Client $client,
|
78 |
+
RequestInterface $request,
|
79 |
+
$mimeType,
|
80 |
+
$data,
|
81 |
+
$resumable = false,
|
82 |
+
$chunkSize = false
|
83 |
+
) {
|
84 |
+
$this->client = $client;
|
85 |
+
$this->request = $request;
|
86 |
+
$this->mimeType = $mimeType;
|
87 |
+
$this->data = $data;
|
88 |
+
$this->resumable = $resumable;
|
89 |
+
$this->chunkSize = $chunkSize;
|
90 |
+
$this->progress = 0;
|
91 |
+
|
92 |
+
$this->process();
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Set the size of the file that is being uploaded.
|
97 |
+
* @param $size - int file size in bytes
|
98 |
+
*/
|
99 |
+
public function setFileSize($size)
|
100 |
+
{
|
101 |
+
$this->size = $size;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Return the progress on the upload
|
106 |
+
* @return int progress in bytes uploaded.
|
107 |
+
*/
|
108 |
+
public function getProgress()
|
109 |
+
{
|
110 |
+
return $this->progress;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Send the next part of the file to upload.
|
115 |
+
* @param [$chunk] the next set of bytes to send. If false will used $data passed
|
116 |
+
* at construct time.
|
117 |
+
*/
|
118 |
+
public function nextChunk($chunk = false)
|
119 |
+
{
|
120 |
+
$resumeUri = $this->getResumeUri();
|
121 |
+
|
122 |
+
if (false == $chunk) {
|
123 |
+
$chunk = substr($this->data, $this->progress, $this->chunkSize);
|
124 |
+
}
|
125 |
+
|
126 |
+
$lastBytePos = $this->progress + strlen($chunk) - 1;
|
127 |
+
$headers = array(
|
128 |
+
'content-range' => "bytes $this->progress-$lastBytePos/$this->size",
|
129 |
+
'content-length' => strlen($chunk),
|
130 |
+
'expect' => '',
|
131 |
+
);
|
132 |
+
|
133 |
+
$request = new Request(
|
134 |
+
'PUT',
|
135 |
+
$resumeUri,
|
136 |
+
$headers,
|
137 |
+
Psr7\stream_for($chunk)
|
138 |
+
);
|
139 |
+
|
140 |
+
return $this->makePutRequest($request);
|
141 |
+
}
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Return the HTTP result code from the last call made.
|
145 |
+
* @return int code
|
146 |
+
*/
|
147 |
+
public function getHttpResultCode()
|
148 |
+
{
|
149 |
+
return $this->httpResultCode;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Sends a PUT-Request to google drive and parses the response,
|
154 |
+
* setting the appropiate variables from the response()
|
155 |
+
*
|
156 |
+
* @param Google_Http_Request $httpRequest the Reuqest which will be send
|
157 |
+
*
|
158 |
+
* @return false|mixed false when the upload is unfinished or the decoded http response
|
159 |
+
*
|
160 |
+
*/
|
161 |
+
private function makePutRequest(RequestInterface $request)
|
162 |
+
{
|
163 |
+
$response = $this->client->execute($request);
|
164 |
+
$this->httpResultCode = $response->getStatusCode();
|
165 |
+
|
166 |
+
if (308 == $this->httpResultCode) {
|
167 |
+
// Track the amount uploaded.
|
168 |
+
$range = $response->getHeaderLine('range');
|
169 |
+
if ($range) {
|
170 |
+
$range_array = explode('-', $range);
|
171 |
+
$this->progress = $range_array[1] + 1;
|
172 |
+
}
|
173 |
+
|
174 |
+
// Allow for changing upload URLs.
|
175 |
+
$location = $response->getHeaderLine('location');
|
176 |
+
if ($location) {
|
177 |
+
$this->resumeUri = $location;
|
178 |
+
}
|
179 |
+
|
180 |
+
// No problems, but upload not complete.
|
181 |
+
return false;
|
182 |
+
}
|
183 |
+
|
184 |
+
return Google_Http_REST::decodeHttpResponse($response, $this->request);
|
185 |
+
}
|
186 |
+
|
187 |
+
/**
|
188 |
+
* Resume a previously unfinished upload
|
189 |
+
* @param $resumeUri the resume-URI of the unfinished, resumable upload.
|
190 |
+
*/
|
191 |
+
public function resume($resumeUri)
|
192 |
+
{
|
193 |
+
$this->resumeUri = $resumeUri;
|
194 |
+
$headers = array(
|
195 |
+
'content-range' => "bytes */$this->size",
|
196 |
+
'content-length' => 0,
|
197 |
+
);
|
198 |
+
$httpRequest = new Request(
|
199 |
+
'PUT',
|
200 |
+
$this->resumeUri,
|
201 |
+
$headers
|
202 |
+
);
|
203 |
+
|
204 |
+
return $this->makePutRequest($httpRequest);
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* @return Psr\Http\Message\RequestInterface $request
|
209 |
+
* @visible for testing
|
210 |
+
*/
|
211 |
+
private function process()
|
212 |
+
{
|
213 |
+
$this->transformToUploadUrl();
|
214 |
+
$request = $this->request;
|
215 |
+
|
216 |
+
$postBody = '';
|
217 |
+
$contentType = false;
|
218 |
+
|
219 |
+
$meta = (string) $request->getBody();
|
220 |
+
$meta = is_string($meta) ? json_decode($meta, true) : $meta;
|
221 |
+
|
222 |
+
$uploadType = $this->getUploadType($meta);
|
223 |
+
$request = $request->withUri(
|
224 |
+
Uri::withQueryValue($request->getUri(), 'uploadType', $uploadType)
|
225 |
+
);
|
226 |
+
|
227 |
+
$mimeType = $this->mimeType ?: $request->getHeaderLine('content-type');
|
228 |
+
|
229 |
+
if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) {
|
230 |
+
$contentType = $mimeType;
|
231 |
+
$postBody = is_string($meta) ? $meta : json_encode($meta);
|
232 |
+
} else if (self::UPLOAD_MEDIA_TYPE == $uploadType) {
|
233 |
+
$contentType = $mimeType;
|
234 |
+
$postBody = $this->data;
|
235 |
+
} else if (self::UPLOAD_MULTIPART_TYPE == $uploadType) {
|
236 |
+
// This is a multipart/related upload.
|
237 |
+
$boundary = $this->boundary ?: mt_rand();
|
238 |
+
$boundary = str_replace('"', '', $boundary);
|
239 |
+
$contentType = 'multipart/related; boundary=' . $boundary;
|
240 |
+
$related = "--$boundary\r\n";
|
241 |
+
$related .= "Content-Type: application/json; charset=UTF-8\r\n";
|
242 |
+
$related .= "\r\n" . json_encode($meta) . "\r\n";
|
243 |
+
$related .= "--$boundary\r\n";
|
244 |
+
$related .= "Content-Type: $mimeType\r\n";
|
245 |
+
$related .= "Content-Transfer-Encoding: base64\r\n";
|
246 |
+
$related .= "\r\n" . base64_encode($this->data) . "\r\n";
|
247 |
+
$related .= "--$boundary--";
|
248 |
+
$postBody = $related;
|
249 |
+
}
|
250 |
+
|
251 |
+
$request = $request->withBody(Psr7\stream_for($postBody));
|
252 |
+
|
253 |
+
if (isset($contentType) && $contentType) {
|
254 |
+
$request = $request->withHeader('content-type', $contentType);
|
255 |
+
}
|
256 |
+
|
257 |
+
return $this->request = $request;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Valid upload types:
|
262 |
+
* - resumable (UPLOAD_RESUMABLE_TYPE)
|
263 |
+
* - media (UPLOAD_MEDIA_TYPE)
|
264 |
+
* - multipart (UPLOAD_MULTIPART_TYPE)
|
265 |
+
* @param $meta
|
266 |
+
* @return string
|
267 |
+
* @visible for testing
|
268 |
+
*/
|
269 |
+
public function getUploadType($meta)
|
270 |
+
{
|
271 |
+
if ($this->resumable) {
|
272 |
+
return self::UPLOAD_RESUMABLE_TYPE;
|
273 |
+
}
|
274 |
+
|
275 |
+
if (false == $meta && $this->data) {
|
276 |
+
return self::UPLOAD_MEDIA_TYPE;
|
277 |
+
}
|
278 |
+
|
279 |
+
return self::UPLOAD_MULTIPART_TYPE;
|
280 |
+
}
|
281 |
+
|
282 |
+
public function getResumeUri()
|
283 |
+
{
|
284 |
+
if (null === $this->resumeUri) {
|
285 |
+
$this->resumeUri = $this->fetchResumeUri();
|
286 |
+
}
|
287 |
+
|
288 |
+
return $this->resumeUri;
|
289 |
+
}
|
290 |
+
|
291 |
+
private function fetchResumeUri()
|
292 |
+
{
|
293 |
+
$body = $this->request->getBody();
|
294 |
+
if ($body) {
|
295 |
+
$headers = array(
|
296 |
+
'content-type' => 'application/json; charset=UTF-8',
|
297 |
+
'content-length' => $body->getSize(),
|
298 |
+
'x-upload-content-type' => $this->mimeType,
|
299 |
+
'x-upload-content-length' => $this->size,
|
300 |
+
'expect' => '',
|
301 |
+
);
|
302 |
+
foreach ($headers as $key => $value) {
|
303 |
+
$this->request = $this->request->withHeader($key, $value);
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
$response = $this->client->execute($this->request, false);
|
308 |
+
$location = $response->getHeaderLine('location');
|
309 |
+
$code = $response->getStatusCode();
|
310 |
+
|
311 |
+
if (200 == $code && true == $location) {
|
312 |
+
return $location;
|
313 |
+
}
|
314 |
+
|
315 |
+
$message = $code;
|
316 |
+
$body = json_decode((string) $this->request->getBody(), true);
|
317 |
+
if (isset($body['error']['errors'])) {
|
318 |
+
$message .= ': ';
|
319 |
+
foreach ($body['error']['errors'] as $error) {
|
320 |
+
$message .= "{$error[domain]}, {$error[message]};";
|
321 |
+
}
|
322 |
+
$message = rtrim($message, ';');
|
323 |
+
}
|
324 |
+
|
325 |
+
$error = "Failed to start the resumable upload (HTTP {$message})";
|
326 |
+
$this->client->getLogger()->error($error);
|
327 |
+
|
328 |
+
throw new Google_Exception($error);
|
329 |
+
}
|
330 |
+
|
331 |
+
private function transformToUploadUrl()
|
332 |
+
{
|
333 |
+
$parts = parse_url((string) $this->request->getUri());
|
334 |
+
if (!isset($parts['path'])) {
|
335 |
+
$parts['path'] = '';
|
336 |
+
}
|
337 |
+
$parts['path'] = '/upload' . $parts['path'];
|
338 |
+
$uri = Uri::fromParts($parts);
|
339 |
+
$this->request = $this->request->withUri($uri);
|
340 |
+
}
|
341 |
+
|
342 |
+
public function setChunkSize($chunkSize)
|
343 |
+
{
|
344 |
+
$this->chunkSize = $chunkSize;
|
345 |
+
}
|
346 |
+
|
347 |
+
public function getRequest()
|
348 |
+
{
|
349 |
+
return $this->request;
|
350 |
+
}
|
351 |
+
}
|
google/src/Google/Http/REST.php
CHANGED
@@ -1,182 +1,182 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2010 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
19 |
-
use GuzzleHttp\ClientInterface;
|
20 |
-
use GuzzleHttp\Exception\RequestException;
|
21 |
-
use GuzzleHttp\Psr7\Response;
|
22 |
-
use Psr\Http\Message\RequestInterface;
|
23 |
-
use Psr\Http\Message\ResponseInterface;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* This class implements the RESTful transport of apiServiceRequest()'s
|
27 |
-
*/
|
28 |
-
class Google_Http_REST
|
29 |
-
{
|
30 |
-
/**
|
31 |
-
* Executes a Psr\Http\Message\RequestInterface and (if applicable) automatically retries
|
32 |
-
* when errors occur.
|
33 |
-
*
|
34 |
-
* @param Google_Client $client
|
35 |
-
* @param Psr\Http\Message\RequestInterface $req
|
36 |
-
* @return array decoded result
|
37 |
-
* @throws Google_Service_Exception on server side error (ie: not authenticated,
|
38 |
-
* invalid or malformed post body, invalid url)
|
39 |
-
*/
|
40 |
-
public static function execute(
|
41 |
-
ClientInterface $client,
|
42 |
-
RequestInterface $request,
|
43 |
-
$expectedClass = null,
|
44 |
-
$config = array(),
|
45 |
-
$retryMap = null
|
46 |
-
) {
|
47 |
-
$runner = new Google_Task_Runner(
|
48 |
-
$config,
|
49 |
-
sprintf('%s %s', $request->getMethod(), (string) $request->getUri()),
|
50 |
-
array(get_class(), 'doExecute'),
|
51 |
-
array($client, $request, $expectedClass)
|
52 |
-
);
|
53 |
-
|
54 |
-
if (null !== $retryMap) {
|
55 |
-
$runner->setRetryMap($retryMap);
|
56 |
-
}
|
57 |
-
|
58 |
-
return $runner->run();
|
59 |
-
}
|
60 |
-
|
61 |
-
/**
|
62 |
-
* Executes a Psr\Http\Message\RequestInterface
|
63 |
-
*
|
64 |
-
* @param Google_Client $client
|
65 |
-
* @param Psr\Http\Message\RequestInterface $request
|
66 |
-
* @return array decoded result
|
67 |
-
* @throws Google_Service_Exception on server side error (ie: not authenticated,
|
68 |
-
* invalid or malformed post body, invalid url)
|
69 |
-
*/
|
70 |
-
public static function doExecute(ClientInterface $client, RequestInterface $request, $expectedClass = null)
|
71 |
-
{
|
72 |
-
try {
|
73 |
-
$httpHandler = HttpHandlerFactory::build($client);
|
74 |
-
$response = $httpHandler($request);
|
75 |
-
} catch (RequestException $e) {
|
76 |
-
// if Guzzle throws an exception, catch it and handle the response
|
77 |
-
if (!$e->hasResponse()) {
|
78 |
-
throw $e;
|
79 |
-
}
|
80 |
-
|
81 |
-
$response = $e->getResponse();
|
82 |
-
// specific checking for Guzzle 5: convert to PSR7 response
|
83 |
-
if ($response instanceof \GuzzleHttp\Message\ResponseInterface) {
|
84 |
-
$response = new Response(
|
85 |
-
$response->getStatusCode(),
|
86 |
-
$response->getHeaders() ?: [],
|
87 |
-
$response->getBody(),
|
88 |
-
$response->getProtocolVersion(),
|
89 |
-
$response->getReasonPhrase()
|
90 |
-
);
|
91 |
-
}
|
92 |
-
}
|
93 |
-
|
94 |
-
return self::decodeHttpResponse($response, $request, $expectedClass);
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Decode an HTTP Response.
|
99 |
-
* @static
|
100 |
-
* @throws Google_Service_Exception
|
101 |
-
* @param Psr\Http\Message\RequestInterface $response The http response to be decoded.
|
102 |
-
* @param Psr\Http\Message\ResponseInterface $response
|
103 |
-
* @return mixed|null
|
104 |
-
*/
|
105 |
-
public static function decodeHttpResponse(
|
106 |
-
ResponseInterface $response,
|
107 |
-
RequestInterface $request = null,
|
108 |
-
$expectedClass = null
|
109 |
-
) {
|
110 |
-
$code = $response->getStatusCode();
|
111 |
-
|
112 |
-
// retry strategy
|
113 |
-
if (intVal($code) >= 400) {
|
114 |
-
// if we errored out, it should be safe to grab the response body
|
115 |
-
$body = (string) $response->getBody();
|
116 |
-
|
117 |
-
// Check if we received errors, and add those to the Exception for convenience
|
118 |
-
throw new Google_Service_Exception($body, $code, null, self::getResponseErrors($body));
|
119 |
-
}
|
120 |
-
|
121 |
-
// Ensure we only pull the entire body into memory if the request is not
|
122 |
-
// of media type
|
123 |
-
$body = self::decodeBody($response, $request);
|
124 |
-
|
125 |
-
if ($expectedClass = self::determineExpectedClass($expectedClass, $request)) {
|
126 |
-
$json = json_decode($body, true);
|
127 |
-
|
128 |
-
return new $expectedClass($json);
|
129 |
-
}
|
130 |
-
|
131 |
-
return $response;
|
132 |
-
}
|
133 |
-
|
134 |
-
private static function decodeBody(ResponseInterface $response, RequestInterface $request = null)
|
135 |
-
{
|
136 |
-
if (self::isAltMedia($request)) {
|
137 |
-
// don't decode the body, it's probably a really long string
|
138 |
-
return '';
|
139 |
-
}
|
140 |
-
|
141 |
-
return (string) $response->getBody();
|
142 |
-
}
|
143 |
-
|
144 |
-
private static function determineExpectedClass($expectedClass, RequestInterface $request = null)
|
145 |
-
{
|
146 |
-
// "false" is used to explicitly prevent an expected class from being returned
|
147 |
-
if (false === $expectedClass) {
|
148 |
-
return null;
|
149 |
-
}
|
150 |
-
|
151 |
-
// if we don't have a request, we just use what's passed in
|
152 |
-
if (null === $request) {
|
153 |
-
return $expectedClass;
|
154 |
-
}
|
155 |
-
|
156 |
-
// return what we have in the request header if one was not supplied
|
157 |
-
return $expectedClass ?: $request->getHeaderLine('X-Php-Expected-Class');
|
158 |
-
}
|
159 |
-
|
160 |
-
private static function getResponseErrors($body)
|
161 |
-
{
|
162 |
-
$json = json_decode($body, true);
|
163 |
-
|
164 |
-
if (isset($json['error']['errors'])) {
|
165 |
-
return $json['error']['errors'];
|
166 |
-
}
|
167 |
-
|
168 |
-
return null;
|
169 |
-
}
|
170 |
-
|
171 |
-
private static function isAltMedia(RequestInterface $request = null)
|
172 |
-
{
|
173 |
-
if ($request && $qs = $request->getUri()->getQuery()) {
|
174 |
-
parse_str($qs, $query);
|
175 |
-
if (isset($query['alt']) && $query['alt'] == 'media') {
|
176 |
-
return true;
|
177 |
-
}
|
178 |
-
}
|
179 |
-
|
180 |
-
return false;
|
181 |
-
}
|
182 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2010 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
use Google\Auth\HttpHandler\HttpHandlerFactory;
|
19 |
+
use GuzzleHttp\ClientInterface;
|
20 |
+
use GuzzleHttp\Exception\RequestException;
|
21 |
+
use GuzzleHttp\Psr7\Response;
|
22 |
+
use Psr\Http\Message\RequestInterface;
|
23 |
+
use Psr\Http\Message\ResponseInterface;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* This class implements the RESTful transport of apiServiceRequest()'s
|
27 |
+
*/
|
28 |
+
class Google_Http_REST
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Executes a Psr\Http\Message\RequestInterface and (if applicable) automatically retries
|
32 |
+
* when errors occur.
|
33 |
+
*
|
34 |
+
* @param Google_Client $client
|
35 |
+
* @param Psr\Http\Message\RequestInterface $req
|
36 |
+
* @return array decoded result
|
37 |
+
* @throws Google_Service_Exception on server side error (ie: not authenticated,
|
38 |
+
* invalid or malformed post body, invalid url)
|
39 |
+
*/
|
40 |
+
public static function execute(
|
41 |
+
ClientInterface $client,
|
42 |
+
RequestInterface $request,
|
43 |
+
$expectedClass = null,
|
44 |
+
$config = array(),
|
45 |
+
$retryMap = null
|
46 |
+
) {
|
47 |
+
$runner = new Google_Task_Runner(
|
48 |
+
$config,
|
49 |
+
sprintf('%s %s', $request->getMethod(), (string) $request->getUri()),
|
50 |
+
array(get_class(), 'doExecute'),
|
51 |
+
array($client, $request, $expectedClass)
|
52 |
+
);
|
53 |
+
|
54 |
+
if (null !== $retryMap) {
|
55 |
+
$runner->setRetryMap($retryMap);
|
56 |
+
}
|
57 |
+
|
58 |
+
return $runner->run();
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Executes a Psr\Http\Message\RequestInterface
|
63 |
+
*
|
64 |
+
* @param Google_Client $client
|
65 |
+
* @param Psr\Http\Message\RequestInterface $request
|
66 |
+
* @return array decoded result
|
67 |
+
* @throws Google_Service_Exception on server side error (ie: not authenticated,
|
68 |
+
* invalid or malformed post body, invalid url)
|
69 |
+
*/
|
70 |
+
public static function doExecute(ClientInterface $client, RequestInterface $request, $expectedClass = null)
|
71 |
+
{
|
72 |
+
try {
|
73 |
+
$httpHandler = HttpHandlerFactory::build($client);
|
74 |
+
$response = $httpHandler($request);
|
75 |
+
} catch (RequestException $e) {
|
76 |
+
// if Guzzle throws an exception, catch it and handle the response
|
77 |
+
if (!$e->hasResponse()) {
|
78 |
+
throw $e;
|
79 |
+
}
|
80 |
+
|
81 |
+
$response = $e->getResponse();
|
82 |
+
// specific checking for Guzzle 5: convert to PSR7 response
|
83 |
+
if ($response instanceof \GuzzleHttp\Message\ResponseInterface) {
|
84 |
+
$response = new Response(
|
85 |
+
$response->getStatusCode(),
|
86 |
+
$response->getHeaders() ?: [],
|
87 |
+
$response->getBody(),
|
88 |
+
$response->getProtocolVersion(),
|
89 |
+
$response->getReasonPhrase()
|
90 |
+
);
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
return self::decodeHttpResponse($response, $request, $expectedClass);
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Decode an HTTP Response.
|
99 |
+
* @static
|
100 |
+
* @throws Google_Service_Exception
|
101 |
+
* @param Psr\Http\Message\RequestInterface $response The http response to be decoded.
|
102 |
+
* @param Psr\Http\Message\ResponseInterface $response
|
103 |
+
* @return mixed|null
|
104 |
+
*/
|
105 |
+
public static function decodeHttpResponse(
|
106 |
+
ResponseInterface $response,
|
107 |
+
RequestInterface $request = null,
|
108 |
+
$expectedClass = null
|
109 |
+
) {
|
110 |
+
$code = $response->getStatusCode();
|
111 |
+
|
112 |
+
// retry strategy
|
113 |
+
if (intVal($code) >= 400) {
|
114 |
+
// if we errored out, it should be safe to grab the response body
|
115 |
+
$body = (string) $response->getBody();
|
116 |
+
|
117 |
+
// Check if we received errors, and add those to the Exception for convenience
|
118 |
+
throw new Google_Service_Exception($body, $code, null, self::getResponseErrors($body));
|
119 |
+
}
|
120 |
+
|
121 |
+
// Ensure we only pull the entire body into memory if the request is not
|
122 |
+
// of media type
|
123 |
+
$body = self::decodeBody($response, $request);
|
124 |
+
|
125 |
+
if ($expectedClass = self::determineExpectedClass($expectedClass, $request)) {
|
126 |
+
$json = json_decode($body, true);
|
127 |
+
|
128 |
+
return new $expectedClass($json);
|
129 |
+
}
|
130 |
+
|
131 |
+
return $response;
|
132 |
+
}
|
133 |
+
|
134 |
+
private static function decodeBody(ResponseInterface $response, RequestInterface $request = null)
|
135 |
+
{
|
136 |
+
if (self::isAltMedia($request)) {
|
137 |
+
// don't decode the body, it's probably a really long string
|
138 |
+
return '';
|
139 |
+
}
|
140 |
+
|
141 |
+
return (string) $response->getBody();
|
142 |
+
}
|
143 |
+
|
144 |
+
private static function determineExpectedClass($expectedClass, RequestInterface $request = null)
|
145 |
+
{
|
146 |
+
// "false" is used to explicitly prevent an expected class from being returned
|
147 |
+
if (false === $expectedClass) {
|
148 |
+
return null;
|
149 |
+
}
|
150 |
+
|
151 |
+
// if we don't have a request, we just use what's passed in
|
152 |
+
if (null === $request) {
|
153 |
+
return $expectedClass;
|
154 |
+
}
|
155 |
+
|
156 |
+
// return what we have in the request header if one was not supplied
|
157 |
+
return $expectedClass ?: $request->getHeaderLine('X-Php-Expected-Class');
|
158 |
+
}
|
159 |
+
|
160 |
+
private static function getResponseErrors($body)
|
161 |
+
{
|
162 |
+
$json = json_decode($body, true);
|
163 |
+
|
164 |
+
if (isset($json['error']['errors'])) {
|
165 |
+
return $json['error']['errors'];
|
166 |
+
}
|
167 |
+
|
168 |
+
return null;
|
169 |
+
}
|
170 |
+
|
171 |
+
private static function isAltMedia(RequestInterface $request = null)
|
172 |
+
{
|
173 |
+
if ($request && $qs = $request->getUri()->getQuery()) {
|
174 |
+
parse_str($qs, $query);
|
175 |
+
if (isset($query['alt']) && $query['alt'] == 'media') {
|
176 |
+
return true;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
return false;
|
181 |
+
}
|
182 |
+
}
|
google/src/Google/Model.php
CHANGED
@@ -1,317 +1,317 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2011 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* This class defines attributes, valid values, and usage which is generated
|
20 |
-
* from a given json schema.
|
21 |
-
* http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
|
22 |
-
*
|
23 |
-
*/
|
24 |
-
class Google_Model implements ArrayAccess
|
25 |
-
{
|
26 |
-
/**
|
27 |
-
* If you need to specify a NULL JSON value, use Google_Model::NULL_VALUE
|
28 |
-
* instead - it will be replaced when converting to JSON with a real null.
|
29 |
-
*/
|
30 |
-
const NULL_VALUE = "{}gapi-php-null";
|
31 |
-
protected $internal_gapi_mappings = array();
|
32 |
-
protected $modelData = array();
|
33 |
-
protected $processed = array();
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Polymorphic - accepts a variable number of arguments dependent
|
37 |
-
* on the type of the model subclass.
|
38 |
-
*/
|
39 |
-
final public function __construct()
|
40 |
-
{
|
41 |
-
if (func_num_args() == 1 && is_array(func_get_arg(0))) {
|
42 |
-
// Initialize the model with the array's contents.
|
43 |
-
$array = func_get_arg(0);
|
44 |
-
$this->mapTypes($array);
|
45 |
-
}
|
46 |
-
$this->gapiInit();
|
47 |
-
}
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Getter that handles passthrough access to the data array, and lazy object creation.
|
51 |
-
* @param string $key Property name.
|
52 |
-
* @return mixed The value if any, or null.
|
53 |
-
*/
|
54 |
-
public function __get($key)
|
55 |
-
{
|
56 |
-
$keyType = $this->keyType($key);
|
57 |
-
$keyDataType = $this->dataType($key);
|
58 |
-
if ($keyType && !isset($this->processed[$key])) {
|
59 |
-
if (isset($this->modelData[$key])) {
|
60 |
-
$val = $this->modelData[$key];
|
61 |
-
} elseif ($keyDataType == 'array' || $keyDataType == 'map') {
|
62 |
-
$val = array();
|
63 |
-
} else {
|
64 |
-
$val = null;
|
65 |
-
}
|
66 |
-
|
67 |
-
if ($this->isAssociativeArray($val)) {
|
68 |
-
if ($keyDataType && 'map' == $keyDataType) {
|
69 |
-
foreach ($val as $arrayKey => $arrayItem) {
|
70 |
-
$this->modelData[$key][$arrayKey] =
|
71 |
-
new $keyType($arrayItem);
|
72 |
-
}
|
73 |
-
} else {
|
74 |
-
$this->modelData[$key] = new $keyType($val);
|
75 |
-
}
|
76 |
-
} else if (is_array($val)) {
|
77 |
-
$arrayObject = array();
|
78 |
-
foreach ($val as $arrayIndex => $arrayItem) {
|
79 |
-
$arrayObject[$arrayIndex] = new $keyType($arrayItem);
|
80 |
-
}
|
81 |
-
$this->modelData[$key] = $arrayObject;
|
82 |
-
}
|
83 |
-
$this->processed[$key] = true;
|
84 |
-
}
|
85 |
-
|
86 |
-
return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Initialize this object's properties from an array.
|
91 |
-
*
|
92 |
-
* @param array $array Used to seed this object's properties.
|
93 |
-
* @return void
|
94 |
-
*/
|
95 |
-
protected function mapTypes($array)
|
96 |
-
{
|
97 |
-
// Hard initialise simple types, lazy load more complex ones.
|
98 |
-
foreach ($array as $key => $val) {
|
99 |
-
if ($keyType = $this->keyType($key)) {
|
100 |
-
$dataType = $this->dataType($key);
|
101 |
-
if ($dataType == 'array' || $dataType == 'map') {
|
102 |
-
$this->$key = array();
|
103 |
-
foreach ($val as $itemKey => $itemVal) {
|
104 |
-
if ($itemVal instanceof $keyType) {
|
105 |
-
$this->{$key}[$itemKey] = $itemVal;
|
106 |
-
} else {
|
107 |
-
$this->{$key}[$itemKey] = new $keyType($itemVal);
|
108 |
-
}
|
109 |
-
}
|
110 |
-
} elseif ($val instanceof $keyType) {
|
111 |
-
$this->$key = $val;
|
112 |
-
} else {
|
113 |
-
$this->$key = new $keyType($val);
|
114 |
-
}
|
115 |
-
unset($array[$key]);
|
116 |
-
} elseif (property_exists($this, $key)) {
|
117 |
-
$this->$key = $val;
|
118 |
-
unset($array[$key]);
|
119 |
-
} elseif (property_exists($this, $camelKey = $this->camelCase($key))) {
|
120 |
-
// This checks if property exists as camelCase, leaving it in array as snake_case
|
121 |
-
// in case of backwards compatibility issues.
|
122 |
-
$this->$camelKey = $val;
|
123 |
-
}
|
124 |
-
}
|
125 |
-
$this->modelData = $array;
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Blank initialiser to be used in subclasses to do post-construction initialisation - this
|
130 |
-
* avoids the need for subclasses to have to implement the variadics handling in their
|
131 |
-
* constructors.
|
132 |
-
*/
|
133 |
-
protected function gapiInit()
|
134 |
-
{
|
135 |
-
return;
|
136 |
-
}
|
137 |
-
|
138 |
-
/**
|
139 |
-
* Create a simplified object suitable for straightforward
|
140 |
-
* conversion to JSON. This is relatively expensive
|
141 |
-
* due to the usage of reflection, but shouldn't be called
|
142 |
-
* a whole lot, and is the most straightforward way to filter.
|
143 |
-
*/
|
144 |
-
public function toSimpleObject()
|
145 |
-
{
|
146 |
-
$object = new stdClass();
|
147 |
-
|
148 |
-
// Process all other data.
|
149 |
-
foreach ($this->modelData as $key => $val) {
|
150 |
-
$result = $this->getSimpleValue($val);
|
151 |
-
if ($result !== null) {
|
152 |
-
$object->$key = $this->nullPlaceholderCheck($result);
|
153 |
-
}
|
154 |
-
}
|
155 |
-
|
156 |
-
// Process all public properties.
|
157 |
-
$reflect = new ReflectionObject($this);
|
158 |
-
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
|
159 |
-
foreach ($props as $member) {
|
160 |
-
$name = $member->getName();
|
161 |
-
$result = $this->getSimpleValue($this->$name);
|
162 |
-
if ($result !== null) {
|
163 |
-
$name = $this->getMappedName($name);
|
164 |
-
$object->$name = $this->nullPlaceholderCheck($result);
|
165 |
-
}
|
166 |
-
}
|
167 |
-
|
168 |
-
return $object;
|
169 |
-
}
|
170 |
-
|
171 |
-
/**
|
172 |
-
* Handle different types of values, primarily
|
173 |
-
* other objects and map and array data types.
|
174 |
-
*/
|
175 |
-
private function getSimpleValue($value)
|
176 |
-
{
|
177 |
-
if ($value instanceof Google_Model) {
|
178 |
-
return $value->toSimpleObject();
|
179 |
-
} else if (is_array($value)) {
|
180 |
-
$return = array();
|
181 |
-
foreach ($value as $key => $a_value) {
|
182 |
-
$a_value = $this->getSimpleValue($a_value);
|
183 |
-
if ($a_value !== null) {
|
184 |
-
$key = $this->getMappedName($key);
|
185 |
-
$return[$key] = $this->nullPlaceholderCheck($a_value);
|
186 |
-
}
|
187 |
-
}
|
188 |
-
return $return;
|
189 |
-
}
|
190 |
-
return $value;
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Check whether the value is the null placeholder and return true null.
|
195 |
-
*/
|
196 |
-
private function nullPlaceholderCheck($value)
|
197 |
-
{
|
198 |
-
if ($value === self::NULL_VALUE) {
|
199 |
-
return null;
|
200 |
-
}
|
201 |
-
return $value;
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* If there is an internal name mapping, use that.
|
206 |
-
*/
|
207 |
-
private function getMappedName($key)
|
208 |
-
{
|
209 |
-
if (isset($this->internal_gapi_mappings, $this->internal_gapi_mappings[$key])) {
|
210 |
-
$key = $this->internal_gapi_mappings[$key];
|
211 |
-
}
|
212 |
-
return $key;
|
213 |
-
}
|
214 |
-
|
215 |
-
/**
|
216 |
-
* Returns true only if the array is associative.
|
217 |
-
* @param array $array
|
218 |
-
* @return bool True if the array is associative.
|
219 |
-
*/
|
220 |
-
protected function isAssociativeArray($array)
|
221 |
-
{
|
222 |
-
if (!is_array($array)) {
|
223 |
-
return false;
|
224 |
-
}
|
225 |
-
$keys = array_keys($array);
|
226 |
-
foreach ($keys as $key) {
|
227 |
-
if (is_string($key)) {
|
228 |
-
return true;
|
229 |
-
}
|
230 |
-
}
|
231 |
-
return false;
|
232 |
-
}
|
233 |
-
|
234 |
-
/**
|
235 |
-
* Verify if $obj is an array.
|
236 |
-
* @throws Google_Exception Thrown if $obj isn't an array.
|
237 |
-
* @param array $obj Items that should be validated.
|
238 |
-
* @param string $method Method expecting an array as an argument.
|
239 |
-
*/
|
240 |
-
public function assertIsArray($obj, $method)
|
241 |
-
{
|
242 |
-
if ($obj && !is_array($obj)) {
|
243 |
-
throw new Google_Exception(
|
244 |
-
"Incorrect parameter type passed to $method(). Expected an array."
|
245 |
-
);
|
246 |
-
}
|
247 |
-
}
|
248 |
-
|
249 |
-
public function offsetExists($offset)
|
250 |
-
{
|
251 |
-
return isset($this->$offset) || isset($this->modelData[$offset]);
|
252 |
-
}
|
253 |
-
|
254 |
-
public function offsetGet($offset)
|
255 |
-
{
|
256 |
-
return isset($this->$offset) ?
|
257 |
-
$this->$offset :
|
258 |
-
$this->__get($offset);
|
259 |
-
}
|
260 |
-
|
261 |
-
public function offsetSet($offset, $value)
|
262 |
-
{
|
263 |
-
if (property_exists($this, $offset)) {
|
264 |
-
$this->$offset = $value;
|
265 |
-
} else {
|
266 |
-
$this->modelData[$offset] = $value;
|
267 |
-
$this->processed[$offset] = true;
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
public function offsetUnset($offset)
|
272 |
-
{
|
273 |
-
unset($this->modelData[$offset]);
|
274 |
-
}
|
275 |
-
|
276 |
-
protected function keyType($key)
|
277 |
-
{
|
278 |
-
$keyType = $key . "Type";
|
279 |
-
|
280 |
-
// ensure keyType is a valid class
|
281 |
-
if (property_exists($this, $keyType) && class_exists($this->$keyType)) {
|
282 |
-
return $this->$keyType;
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
-
protected function dataType($key)
|
287 |
-
{
|
288 |
-
$dataType = $key . "DataType";
|
289 |
-
|
290 |
-
if (property_exists($this, $dataType)) {
|
291 |
-
return $this->$dataType;
|
292 |
-
}
|
293 |
-
}
|
294 |
-
|
295 |
-
public function __isset($key)
|
296 |
-
{
|
297 |
-
return isset($this->modelData[$key]);
|
298 |
-
}
|
299 |
-
|
300 |
-
public function __unset($key)
|
301 |
-
{
|
302 |
-
unset($this->modelData[$key]);
|
303 |
-
}
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Convert a string to camelCase
|
307 |
-
* @param string $value
|
308 |
-
* @return string
|
309 |
-
*/
|
310 |
-
private function camelCase($value)
|
311 |
-
{
|
312 |
-
$value = ucwords(str_replace(array('-', '_'), ' ', $value));
|
313 |
-
$value = str_replace(' ', '', $value);
|
314 |
-
$value[0] = strtolower($value[0]);
|
315 |
-
return $value;
|
316 |
-
}
|
317 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2011 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* This class defines attributes, valid values, and usage which is generated
|
20 |
+
* from a given json schema.
|
21 |
+
* http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5
|
22 |
+
*
|
23 |
+
*/
|
24 |
+
class Google_Model implements ArrayAccess
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* If you need to specify a NULL JSON value, use Google_Model::NULL_VALUE
|
28 |
+
* instead - it will be replaced when converting to JSON with a real null.
|
29 |
+
*/
|
30 |
+
const NULL_VALUE = "{}gapi-php-null";
|
31 |
+
protected $internal_gapi_mappings = array();
|
32 |
+
protected $modelData = array();
|
33 |
+
protected $processed = array();
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Polymorphic - accepts a variable number of arguments dependent
|
37 |
+
* on the type of the model subclass.
|
38 |
+
*/
|
39 |
+
final public function __construct()
|
40 |
+
{
|
41 |
+
if (func_num_args() == 1 && is_array(func_get_arg(0))) {
|
42 |
+
// Initialize the model with the array's contents.
|
43 |
+
$array = func_get_arg(0);
|
44 |
+
$this->mapTypes($array);
|
45 |
+
}
|
46 |
+
$this->gapiInit();
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Getter that handles passthrough access to the data array, and lazy object creation.
|
51 |
+
* @param string $key Property name.
|
52 |
+
* @return mixed The value if any, or null.
|
53 |
+
*/
|
54 |
+
public function __get($key)
|
55 |
+
{
|
56 |
+
$keyType = $this->keyType($key);
|
57 |
+
$keyDataType = $this->dataType($key);
|
58 |
+
if ($keyType && !isset($this->processed[$key])) {
|
59 |
+
if (isset($this->modelData[$key])) {
|
60 |
+
$val = $this->modelData[$key];
|
61 |
+
} elseif ($keyDataType == 'array' || $keyDataType == 'map') {
|
62 |
+
$val = array();
|
63 |
+
} else {
|
64 |
+
$val = null;
|
65 |
+
}
|
66 |
+
|
67 |
+
if ($this->isAssociativeArray($val)) {
|
68 |
+
if ($keyDataType && 'map' == $keyDataType) {
|
69 |
+
foreach ($val as $arrayKey => $arrayItem) {
|
70 |
+
$this->modelData[$key][$arrayKey] =
|
71 |
+
new $keyType($arrayItem);
|
72 |
+
}
|
73 |
+
} else {
|
74 |
+
$this->modelData[$key] = new $keyType($val);
|
75 |
+
}
|
76 |
+
} else if (is_array($val)) {
|
77 |
+
$arrayObject = array();
|
78 |
+
foreach ($val as $arrayIndex => $arrayItem) {
|
79 |
+
$arrayObject[$arrayIndex] = new $keyType($arrayItem);
|
80 |
+
}
|
81 |
+
$this->modelData[$key] = $arrayObject;
|
82 |
+
}
|
83 |
+
$this->processed[$key] = true;
|
84 |
+
}
|
85 |
+
|
86 |
+
return isset($this->modelData[$key]) ? $this->modelData[$key] : null;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Initialize this object's properties from an array.
|
91 |
+
*
|
92 |
+
* @param array $array Used to seed this object's properties.
|
93 |
+
* @return void
|
94 |
+
*/
|
95 |
+
protected function mapTypes($array)
|
96 |
+
{
|
97 |
+
// Hard initialise simple types, lazy load more complex ones.
|
98 |
+
foreach ($array as $key => $val) {
|
99 |
+
if ($keyType = $this->keyType($key)) {
|
100 |
+
$dataType = $this->dataType($key);
|
101 |
+
if ($dataType == 'array' || $dataType == 'map') {
|
102 |
+
$this->$key = array();
|
103 |
+
foreach ($val as $itemKey => $itemVal) {
|
104 |
+
if ($itemVal instanceof $keyType) {
|
105 |
+
$this->{$key}[$itemKey] = $itemVal;
|
106 |
+
} else {
|
107 |
+
$this->{$key}[$itemKey] = new $keyType($itemVal);
|
108 |
+
}
|
109 |
+
}
|
110 |
+
} elseif ($val instanceof $keyType) {
|
111 |
+
$this->$key = $val;
|
112 |
+
} else {
|
113 |
+
$this->$key = new $keyType($val);
|
114 |
+
}
|
115 |
+
unset($array[$key]);
|
116 |
+
} elseif (property_exists($this, $key)) {
|
117 |
+
$this->$key = $val;
|
118 |
+
unset($array[$key]);
|
119 |
+
} elseif (property_exists($this, $camelKey = $this->camelCase($key))) {
|
120 |
+
// This checks if property exists as camelCase, leaving it in array as snake_case
|
121 |
+
// in case of backwards compatibility issues.
|
122 |
+
$this->$camelKey = $val;
|
123 |
+
}
|
124 |
+
}
|
125 |
+
$this->modelData = $array;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Blank initialiser to be used in subclasses to do post-construction initialisation - this
|
130 |
+
* avoids the need for subclasses to have to implement the variadics handling in their
|
131 |
+
* constructors.
|
132 |
+
*/
|
133 |
+
protected function gapiInit()
|
134 |
+
{
|
135 |
+
return;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Create a simplified object suitable for straightforward
|
140 |
+
* conversion to JSON. This is relatively expensive
|
141 |
+
* due to the usage of reflection, but shouldn't be called
|
142 |
+
* a whole lot, and is the most straightforward way to filter.
|
143 |
+
*/
|
144 |
+
public function toSimpleObject()
|
145 |
+
{
|
146 |
+
$object = new stdClass();
|
147 |
+
|
148 |
+
// Process all other data.
|
149 |
+
foreach ($this->modelData as $key => $val) {
|
150 |
+
$result = $this->getSimpleValue($val);
|
151 |
+
if ($result !== null) {
|
152 |
+
$object->$key = $this->nullPlaceholderCheck($result);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
// Process all public properties.
|
157 |
+
$reflect = new ReflectionObject($this);
|
158 |
+
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC);
|
159 |
+
foreach ($props as $member) {
|
160 |
+
$name = $member->getName();
|
161 |
+
$result = $this->getSimpleValue($this->$name);
|
162 |
+
if ($result !== null) {
|
163 |
+
$name = $this->getMappedName($name);
|
164 |
+
$object->$name = $this->nullPlaceholderCheck($result);
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
return $object;
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Handle different types of values, primarily
|
173 |
+
* other objects and map and array data types.
|
174 |
+
*/
|
175 |
+
private function getSimpleValue($value)
|
176 |
+
{
|
177 |
+
if ($value instanceof Google_Model) {
|
178 |
+
return $value->toSimpleObject();
|
179 |
+
} else if (is_array($value)) {
|
180 |
+
$return = array();
|
181 |
+
foreach ($value as $key => $a_value) {
|
182 |
+
$a_value = $this->getSimpleValue($a_value);
|
183 |
+
if ($a_value !== null) {
|
184 |
+
$key = $this->getMappedName($key);
|
185 |
+
$return[$key] = $this->nullPlaceholderCheck($a_value);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
return $return;
|
189 |
+
}
|
190 |
+
return $value;
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Check whether the value is the null placeholder and return true null.
|
195 |
+
*/
|
196 |
+
private function nullPlaceholderCheck($value)
|
197 |
+
{
|
198 |
+
if ($value === self::NULL_VALUE) {
|
199 |
+
return null;
|
200 |
+
}
|
201 |
+
return $value;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* If there is an internal name mapping, use that.
|
206 |
+
*/
|
207 |
+
private function getMappedName($key)
|
208 |
+
{
|
209 |
+
if (isset($this->internal_gapi_mappings, $this->internal_gapi_mappings[$key])) {
|
210 |
+
$key = $this->internal_gapi_mappings[$key];
|
211 |
+
}
|
212 |
+
return $key;
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Returns true only if the array is associative.
|
217 |
+
* @param array $array
|
218 |
+
* @return bool True if the array is associative.
|
219 |
+
*/
|
220 |
+
protected function isAssociativeArray($array)
|
221 |
+
{
|
222 |
+
if (!is_array($array)) {
|
223 |
+
return false;
|
224 |
+
}
|
225 |
+
$keys = array_keys($array);
|
226 |
+
foreach ($keys as $key) {
|
227 |
+
if (is_string($key)) {
|
228 |
+
return true;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
return false;
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Verify if $obj is an array.
|
236 |
+
* @throws Google_Exception Thrown if $obj isn't an array.
|
237 |
+
* @param array $obj Items that should be validated.
|
238 |
+
* @param string $method Method expecting an array as an argument.
|
239 |
+
*/
|
240 |
+
public function assertIsArray($obj, $method)
|
241 |
+
{
|
242 |
+
if ($obj && !is_array($obj)) {
|
243 |
+
throw new Google_Exception(
|
244 |
+
"Incorrect parameter type passed to $method(). Expected an array."
|
245 |
+
);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
public function offsetExists($offset)
|
250 |
+
{
|
251 |
+
return isset($this->$offset) || isset($this->modelData[$offset]);
|
252 |
+
}
|
253 |
+
|
254 |
+
public function offsetGet($offset)
|
255 |
+
{
|
256 |
+
return isset($this->$offset) ?
|
257 |
+
$this->$offset :
|
258 |
+
$this->__get($offset);
|
259 |
+
}
|
260 |
+
|
261 |
+
public function offsetSet($offset, $value)
|
262 |
+
{
|
263 |
+
if (property_exists($this, $offset)) {
|
264 |
+
$this->$offset = $value;
|
265 |
+
} else {
|
266 |
+
$this->modelData[$offset] = $value;
|
267 |
+
$this->processed[$offset] = true;
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
public function offsetUnset($offset)
|
272 |
+
{
|
273 |
+
unset($this->modelData[$offset]);
|
274 |
+
}
|
275 |
+
|
276 |
+
protected function keyType($key)
|
277 |
+
{
|
278 |
+
$keyType = $key . "Type";
|
279 |
+
|
280 |
+
// ensure keyType is a valid class
|
281 |
+
if (property_exists($this, $keyType) && class_exists($this->$keyType)) {
|
282 |
+
return $this->$keyType;
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
protected function dataType($key)
|
287 |
+
{
|
288 |
+
$dataType = $key . "DataType";
|
289 |
+
|
290 |
+
if (property_exists($this, $dataType)) {
|
291 |
+
return $this->$dataType;
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
public function __isset($key)
|
296 |
+
{
|
297 |
+
return isset($this->modelData[$key]);
|
298 |
+
}
|
299 |
+
|
300 |
+
public function __unset($key)
|
301 |
+
{
|
302 |
+
unset($this->modelData[$key]);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Convert a string to camelCase
|
307 |
+
* @param string $value
|
308 |
+
* @return string
|
309 |
+
*/
|
310 |
+
private function camelCase($value)
|
311 |
+
{
|
312 |
+
$value = ucwords(str_replace(array('-', '_'), ' ', $value));
|
313 |
+
$value = str_replace(' ', '', $value);
|
314 |
+
$value[0] = strtolower($value[0]);
|
315 |
+
return $value;
|
316 |
+
}
|
317 |
+
}
|
google/src/Google/Service.php
CHANGED
@@ -1,56 +1,56 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2010 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
class Google_Service
|
19 |
-
{
|
20 |
-
public $batchPath;
|
21 |
-
public $rootUrl;
|
22 |
-
public $version;
|
23 |
-
public $servicePath;
|
24 |
-
public $availableScopes;
|
25 |
-
public $resource;
|
26 |
-
private $client;
|
27 |
-
|
28 |
-
public function __construct(Google_Client $client)
|
29 |
-
{
|
30 |
-
$this->client = $client;
|
31 |
-
}
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Return the associated Google_Client class.
|
35 |
-
* @return Google_Client
|
36 |
-
*/
|
37 |
-
public function getClient()
|
38 |
-
{
|
39 |
-
return $this->client;
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Create a new HTTP Batch handler for this service
|
44 |
-
*
|
45 |
-
* @return Google_Http_Batch
|
46 |
-
*/
|
47 |
-
public function createBatch()
|
48 |
-
{
|
49 |
-
return new Google_Http_Batch(
|
50 |
-
$this->client,
|
51 |
-
false,
|
52 |
-
$this->rootUrl,
|
53 |
-
$this->batchPath
|
54 |
-
);
|
55 |
-
}
|
56 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2010 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Google_Service
|
19 |
+
{
|
20 |
+
public $batchPath;
|
21 |
+
public $rootUrl;
|
22 |
+
public $version;
|
23 |
+
public $servicePath;
|
24 |
+
public $availableScopes;
|
25 |
+
public $resource;
|
26 |
+
private $client;
|
27 |
+
|
28 |
+
public function __construct(Google_Client $client)
|
29 |
+
{
|
30 |
+
$this->client = $client;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Return the associated Google_Client class.
|
35 |
+
* @return Google_Client
|
36 |
+
*/
|
37 |
+
public function getClient()
|
38 |
+
{
|
39 |
+
return $this->client;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Create a new HTTP Batch handler for this service
|
44 |
+
*
|
45 |
+
* @return Google_Http_Batch
|
46 |
+
*/
|
47 |
+
public function createBatch()
|
48 |
+
{
|
49 |
+
return new Google_Http_Batch(
|
50 |
+
$this->client,
|
51 |
+
false,
|
52 |
+
$this->rootUrl,
|
53 |
+
$this->batchPath
|
54 |
+
);
|
55 |
+
}
|
56 |
+
}
|
google/src/Google/Service/Exception.php
CHANGED
@@ -1,68 +1,68 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2014 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
class Google_Service_Exception extends Google_Exception
|
19 |
-
{
|
20 |
-
/**
|
21 |
-
* Optional list of errors returned in a JSON body of an HTTP error response.
|
22 |
-
*/
|
23 |
-
protected $errors = array();
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Override default constructor to add the ability to set $errors and a retry
|
27 |
-
* map.
|
28 |
-
*
|
29 |
-
* @param string $message
|
30 |
-
* @param int $code
|
31 |
-
* @param Exception|null $previous
|
32 |
-
* @param [{string, string}] errors List of errors returned in an HTTP
|
33 |
-
* response. Defaults to [].
|
34 |
-
* @param array|null $retryMap Map of errors with retry counts.
|
35 |
-
*/
|
36 |
-
public function __construct(
|
37 |
-
$message,
|
38 |
-
$code = 0,
|
39 |
-
Exception $previous = null,
|
40 |
-
$errors = array()
|
41 |
-
) {
|
42 |
-
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
43 |
-
parent::__construct($message, $code, $previous);
|
44 |
-
} else {
|
45 |
-
parent::__construct($message, $code);
|
46 |
-
}
|
47 |
-
|
48 |
-
$this->errors = $errors;
|
49 |
-
}
|
50 |
-
|
51 |
-
/**
|
52 |
-
* An example of the possible errors returned.
|
53 |
-
*
|
54 |
-
* {
|
55 |
-
* "domain": "global",
|
56 |
-
* "reason": "authError",
|
57 |
-
* "message": "Invalid Credentials",
|
58 |
-
* "locationType": "header",
|
59 |
-
* "location": "Authorization",
|
60 |
-
* }
|
61 |
-
*
|
62 |
-
* @return [{string, string}] List of errors return in an HTTP response or [].
|
63 |
-
*/
|
64 |
-
public function getErrors()
|
65 |
-
{
|
66 |
-
return $this->errors;
|
67 |
-
}
|
68 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2014 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Google_Service_Exception extends Google_Exception
|
19 |
+
{
|
20 |
+
/**
|
21 |
+
* Optional list of errors returned in a JSON body of an HTTP error response.
|
22 |
+
*/
|
23 |
+
protected $errors = array();
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Override default constructor to add the ability to set $errors and a retry
|
27 |
+
* map.
|
28 |
+
*
|
29 |
+
* @param string $message
|
30 |
+
* @param int $code
|
31 |
+
* @param Exception|null $previous
|
32 |
+
* @param [{string, string}] errors List of errors returned in an HTTP
|
33 |
+
* response. Defaults to [].
|
34 |
+
* @param array|null $retryMap Map of errors with retry counts.
|
35 |
+
*/
|
36 |
+
public function __construct(
|
37 |
+
$message,
|
38 |
+
$code = 0,
|
39 |
+
Exception $previous = null,
|
40 |
+
$errors = array()
|
41 |
+
) {
|
42 |
+
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
43 |
+
parent::__construct($message, $code, $previous);
|
44 |
+
} else {
|
45 |
+
parent::__construct($message, $code);
|
46 |
+
}
|
47 |
+
|
48 |
+
$this->errors = $errors;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* An example of the possible errors returned.
|
53 |
+
*
|
54 |
+
* {
|
55 |
+
* "domain": "global",
|
56 |
+
* "reason": "authError",
|
57 |
+
* "message": "Invalid Credentials",
|
58 |
+
* "locationType": "header",
|
59 |
+
* "location": "Authorization",
|
60 |
+
* }
|
61 |
+
*
|
62 |
+
* @return [{string, string}] List of errors return in an HTTP response or [].
|
63 |
+
*/
|
64 |
+
public function getErrors()
|
65 |
+
{
|
66 |
+
return $this->errors;
|
67 |
+
}
|
68 |
+
}
|
google/src/Google/Service/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
# Google API Client Services
|
2 |
-
|
3 |
-
Google API Client Service classes have been moved to the
|
4 |
-
[google-api-php-client-services](https://github.com/google/google-api-php-client-services)
|
5 |
-
repository.
|
1 |
+
# Google API Client Services
|
2 |
+
|
3 |
+
Google API Client Service classes have been moved to the
|
4 |
+
[google-api-php-client-services](https://github.com/google/google-api-php-client-services)
|
5 |
+
repository.
|
google/src/Google/Service/Resource.php
CHANGED
@@ -1,296 +1,296 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Copyright 2010 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
use GuzzleHttp\Psr7\Request;
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Implements the actual methods/resources of the discovered Google API using magic function
|
22 |
-
* calling overloading (__call()), which on call will see if the method name (plus.activities.list)
|
23 |
-
* is available in this service, and if so construct an apiHttpRequest representing it.
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
class Google_Service_Resource
|
27 |
-
{
|
28 |
-
// Valid query parameters that work, but don't appear in discovery.
|
29 |
-
private $stackParameters = array(
|
30 |
-
'alt' => array('type' => 'string', 'location' => 'query'),
|
31 |
-
'fields' => array('type' => 'string', 'location' => 'query'),
|
32 |
-
'trace' => array('type' => 'string', 'location' => 'query'),
|
33 |
-
'userIp' => array('type' => 'string', 'location' => 'query'),
|
34 |
-
'quotaUser' => array('type' => 'string', 'location' => 'query'),
|
35 |
-
'data' => array('type' => 'string', 'location' => 'body'),
|
36 |
-
'mimeType' => array('type' => 'string', 'location' => 'header'),
|
37 |
-
'uploadType' => array('type' => 'string', 'location' => 'query'),
|
38 |
-
'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
|
39 |
-
'prettyPrint' => array('type' => 'string', 'location' => 'query'),
|
40 |
-
);
|
41 |
-
|
42 |
-
/** @var string $rootUrl */
|
43 |
-
private $rootUrl;
|
44 |
-
|
45 |
-
/** @var Google_Client $client */
|
46 |
-
private $client;
|
47 |
-
|
48 |
-
/** @var string $serviceName */
|
49 |
-
private $serviceName;
|
50 |
-
|
51 |
-
/** @var string $servicePath */
|
52 |
-
private $servicePath;
|
53 |
-
|
54 |
-
/** @var string $resourceName */
|
55 |
-
private $resourceName;
|
56 |
-
|
57 |
-
/** @var array $methods */
|
58 |
-
private $methods;
|
59 |
-
|
60 |
-
public function __construct($service, $serviceName, $resourceName, $resource)
|
61 |
-
{
|
62 |
-
$this->rootUrl = $service->rootUrl;
|
63 |
-
$this->client = $service->getClient();
|
64 |
-
$this->servicePath = $service->servicePath;
|
65 |
-
$this->serviceName = $serviceName;
|
66 |
-
$this->resourceName = $resourceName;
|
67 |
-
$this->methods = is_array($resource) && isset($resource['methods']) ?
|
68 |
-
$resource['methods'] :
|
69 |
-
array($resourceName => $resource);
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* TODO: This function needs simplifying.
|
74 |
-
* @param $name
|
75 |
-
* @param $arguments
|
76 |
-
* @param $expectedClass - optional, the expected class name
|
77 |
-
* @return Google_Http_Request|expectedClass
|
78 |
-
* @throws Google_Exception
|
79 |
-
*/
|
80 |
-
public function call($name, $arguments, $expectedClass = null)
|
81 |
-
{
|
82 |
-
if (! isset($this->methods[$name])) {
|
83 |
-
$this->client->getLogger()->error(
|
84 |
-
'Service method unknown',
|
85 |
-
array(
|
86 |
-
'service' => $this->serviceName,
|
87 |
-
'resource' => $this->resourceName,
|
88 |
-
'method' => $name
|
89 |
-
)
|
90 |
-
);
|
91 |
-
|
92 |
-
throw new Google_Exception(
|
93 |
-
"Unknown function: " .
|
94 |
-
"{$this->serviceName}->{$this->resourceName}->{$name}()"
|
95 |
-
);
|
96 |
-
}
|
97 |
-
$method = $this->methods[$name];
|
98 |
-
$parameters = $arguments[0];
|
99 |
-
|
100 |
-
// postBody is a special case since it's not defined in the discovery
|
101 |
-
// document as parameter, but we abuse the param entry for storing it.
|
102 |
-
$postBody = null;
|
103 |
-
if (isset($parameters['postBody'])) {
|
104 |
-
if ($parameters['postBody'] instanceof Google_Model) {
|
105 |
-
// In the cases the post body is an existing object, we want
|
106 |
-
// to use the smart method to create a simple object for
|
107 |
-
// for JSONification.
|
108 |
-
$parameters['postBody'] = $parameters['postBody']->toSimpleObject();
|
109 |
-
} else if (is_object($parameters['postBody'])) {
|
110 |
-
// If the post body is another kind of object, we will try and
|
111 |
-
// wrangle it into a sensible format.
|
112 |
-
$parameters['postBody'] =
|
113 |
-
$this->convertToArrayAndStripNulls($parameters['postBody']);
|
114 |
-
}
|
115 |
-
$postBody = (array) $parameters['postBody'];
|
116 |
-
unset($parameters['postBody']);
|
117 |
-
}
|
118 |
-
|
119 |
-
// TODO: optParams here probably should have been
|
120 |
-
// handled already - this may well be redundant code.
|
121 |
-
if (isset($parameters['optParams'])) {
|
122 |
-
$optParams = $parameters['optParams'];
|
123 |
-
unset($parameters['optParams']);
|
124 |
-
$parameters = array_merge($parameters, $optParams);
|
125 |
-
}
|
126 |
-
|
127 |
-
if (!isset($method['parameters'])) {
|
128 |
-
$method['parameters'] = array();
|
129 |
-
}
|
130 |
-
|
131 |
-
$method['parameters'] = array_merge(
|
132 |
-
$this->stackParameters,
|
133 |
-
$method['parameters']
|
134 |
-
);
|
135 |
-
|
136 |
-
foreach ($parameters as $key => $val) {
|
137 |
-
if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
|
138 |
-
$this->client->getLogger()->error(
|
139 |
-
'Service parameter unknown',
|
140 |
-
array(
|
141 |
-
'service' => $this->serviceName,
|
142 |
-
'resource' => $this->resourceName,
|
143 |
-
'method' => $name,
|
144 |
-
'parameter' => $key
|
145 |
-
)
|
146 |
-
);
|
147 |
-
throw new Google_Exception("($name) unknown parameter: '$key'");
|
148 |
-
}
|
149 |
-
}
|
150 |
-
|
151 |
-
foreach ($method['parameters'] as $paramName => $paramSpec) {
|
152 |
-
if (isset($paramSpec['required']) &&
|
153 |
-
$paramSpec['required'] &&
|
154 |
-
! isset($parameters[$paramName])
|
155 |
-
) {
|
156 |
-
$this->client->getLogger()->error(
|
157 |
-
'Service parameter missing',
|
158 |
-
array(
|
159 |
-
'service' => $this->serviceName,
|
160 |
-
'resource' => $this->resourceName,
|
161 |
-
'method' => $name,
|
162 |
-
'parameter' => $paramName
|
163 |
-
)
|
164 |
-
);
|
165 |
-
throw new Google_Exception("($name) missing required param: '$paramName'");
|
166 |
-
}
|
167 |
-
if (isset($parameters[$paramName])) {
|
168 |
-
$value = $parameters[$paramName];
|
169 |
-
$parameters[$paramName] = $paramSpec;
|
170 |
-
$parameters[$paramName]['value'] = $value;
|
171 |
-
unset($parameters[$paramName]['required']);
|
172 |
-
} else {
|
173 |
-
// Ensure we don't pass nulls.
|
174 |
-
unset($parameters[$paramName]);
|
175 |
-
}
|
176 |
-
}
|
177 |
-
|
178 |
-
$this->client->getLogger()->info(
|
179 |
-
'Service Call',
|
180 |
-
array(
|
181 |
-
'service' => $this->serviceName,
|
182 |
-
'resource' => $this->resourceName,
|
183 |
-
'method' => $name,
|
184 |
-
'arguments' => $parameters,
|
185 |
-
)
|
186 |
-
);
|
187 |
-
|
188 |
-
// build the service uri
|
189 |
-
$url = $this->createRequestUri(
|
190 |
-
$method['path'],
|
191 |
-
$parameters
|
192 |
-
);
|
193 |
-
|
194 |
-
// NOTE: because we're creating the request by hand,
|
195 |
-
// and because the service has a rootUrl property
|
196 |
-
// the "base_uri" of the Http Client is not accounted for
|
197 |
-
$request = new Request(
|
198 |
-
$method['httpMethod'],
|
199 |
-
$url,
|
200 |
-
['content-type' => 'application/json'],
|
201 |
-
$postBody ? json_encode($postBody) : ''
|
202 |
-
);
|
203 |
-
|
204 |
-
// support uploads
|
205 |
-
if (isset($parameters['data'])) {
|
206 |
-
$mimeType = isset($parameters['mimeType'])
|
207 |
-
? $parameters['mimeType']['value']
|
208 |
-
: 'application/octet-stream';
|
209 |
-
$data = $parameters['data']['value'];
|
210 |
-
$upload = new Google_Http_MediaFileUpload($this->client, $request, $mimeType, $data);
|
211 |
-
|
212 |
-
// pull down the modified request
|
213 |
-
$request = $upload->getRequest();
|
214 |
-
}
|
215 |
-
|
216 |
-
// if this is a media type, we will return the raw response
|
217 |
-
// rather than using an expected class
|
218 |
-
if (isset($parameters['alt']) && $parameters['alt']['value'] == 'media') {
|
219 |
-
$expectedClass = null;
|
220 |
-
}
|
221 |
-
|
222 |
-
// if the client is marked for deferring, rather than
|
223 |
-
// execute the request, return the response
|
224 |
-
if ($this->client->shouldDefer()) {
|
225 |
-
// @TODO find a better way to do this
|
226 |
-
$request = $request
|
227 |
-
->withHeader('X-Php-Expected-Class', $expectedClass);
|
228 |
-
|
229 |
-
return $request;
|
230 |
-
}
|
231 |
-
|
232 |
-
return $this->client->execute($request, $expectedClass);
|
233 |
-
}
|
234 |
-
|
235 |
-
protected function convertToArrayAndStripNulls($o)
|
236 |
-
{
|
237 |
-
$o = (array) $o;
|
238 |
-
foreach ($o as $k => $v) {
|
239 |
-
if ($v === null) {
|
240 |
-
unset($o[$k]);
|
241 |
-
} elseif (is_object($v) || is_array($v)) {
|
242 |
-
$o[$k] = $this->convertToArrayAndStripNulls($o[$k]);
|
243 |
-
}
|
244 |
-
}
|
245 |
-
return $o;
|
246 |
-
}
|
247 |
-
|
248 |
-
/**
|
249 |
-
* Parse/expand request parameters and create a fully qualified
|
250 |
-
* request uri.
|
251 |
-
* @static
|
252 |
-
* @param string $restPath
|
253 |
-
* @param array $params
|
254 |
-
* @return string $requestUrl
|
255 |
-
*/
|
256 |
-
public function createRequestUri($restPath, $params)
|
257 |
-
{
|
258 |
-
// code for leading slash
|
259 |
-
$requestUrl = $this->servicePath . $restPath;
|
260 |
-
if ($this->rootUrl) {
|
261 |
-
if ('/' !== substr($this->rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) {
|
262 |
-
$requestUrl = '/' . $requestUrl;
|
263 |
-
}
|
264 |
-
$requestUrl = $this->rootUrl . $requestUrl;
|
265 |
-
}
|
266 |
-
$uriTemplateVars = array();
|
267 |
-
$queryVars = array();
|
268 |
-
foreach ($params as $paramName => $paramSpec) {
|
269 |
-
if ($paramSpec['type'] == 'boolean') {
|
270 |
-
$paramSpec['value'] = $paramSpec['value'] ? 'true' : 'false';
|
271 |
-
}
|
272 |
-
if ($paramSpec['location'] == 'path') {
|
273 |
-
$uriTemplateVars[$paramName] = $paramSpec['value'];
|
274 |
-
} else if ($paramSpec['location'] == 'query') {
|
275 |
-
if (is_array($paramSpec['value'])) {
|
276 |
-
foreach ($paramSpec['value'] as $value) {
|
277 |
-
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
|
278 |
-
}
|
279 |
-
} else {
|
280 |
-
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
|
281 |
-
}
|
282 |
-
}
|
283 |
-
}
|
284 |
-
|
285 |
-
if (count($uriTemplateVars)) {
|
286 |
-
$uriTemplateParser = new Google_Utils_UriTemplate();
|
287 |
-
$requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
|
288 |
-
}
|
289 |
-
|
290 |
-
if (count($queryVars)) {
|
291 |
-
$requestUrl .= '?' . implode($queryVars, '&');
|
292 |
-
}
|
293 |
-
|
294 |
-
return $requestUrl;
|
295 |
-
}
|
296 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright 2010 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
use GuzzleHttp\Psr7\Request;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Implements the actual methods/resources of the discovered Google API using magic function
|
22 |
+
* calling overloading (__call()), which on call will see if the method name (plus.activities.list)
|
23 |
+
* is available in this service, and if so construct an apiHttpRequest representing it.
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
class Google_Service_Resource
|
27 |
+
{
|
28 |
+
// Valid query parameters that work, but don't appear in discovery.
|
29 |
+
private $stackParameters = array(
|
30 |
+
'alt' => array('type' => 'string', 'location' => 'query'),
|
31 |
+
'fields' => array('type' => 'string', 'location' => 'query'),
|
32 |
+
'trace' => array('type' => 'string', 'location' => 'query'),
|
33 |
+
'userIp' => array('type' => 'string', 'location' => 'query'),
|
34 |
+
'quotaUser' => array('type' => 'string', 'location' => 'query'),
|
35 |
+
'data' => array('type' => 'string', 'location' => 'body'),
|
36 |
+
'mimeType' => array('type' => 'string', 'location' => 'header'),
|
37 |
+
'uploadType' => array('type' => 'string', 'location' => 'query'),
|
38 |
+
'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
|
39 |
+
'prettyPrint' => array('type' => 'string', 'location' => 'query'),
|
40 |
+
);
|
41 |
+
|
42 |
+
/** @var string $rootUrl */
|
43 |
+
private $rootUrl;
|
44 |
+
|
45 |
+
/** @var Google_Client $client */
|
46 |
+
private $client;
|
47 |
+
|
48 |
+
/** @var string $serviceName */
|
49 |
+
private $serviceName;
|
50 |
+
|
51 |
+
/** @var string $servicePath */
|
52 |
+
private $servicePath;
|
53 |
+
|
54 |
+
/** @var string $resourceName */
|
55 |
+
private $resourceName;
|
56 |
+
|
57 |
+
/** @var array $methods */
|
58 |
+
private $methods;
|
59 |
+
|
60 |
+
public function __construct($service, $serviceName, $resourceName, $resource)
|
61 |
+
{
|
62 |
+
$this->rootUrl = $service->rootUrl;
|
63 |
+
$this->client = $service->getClient();
|
64 |
+
$this->servicePath = $service->servicePath;
|
65 |
+
$this->serviceName = $serviceName;
|
66 |
+
$this->resourceName = $resourceName;
|
67 |
+
$this->methods = is_array($resource) && isset($resource['methods']) ?
|
68 |
+
$resource['methods'] :
|
69 |
+
array($resourceName => $resource);
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* TODO: This function needs simplifying.
|
74 |
+
* @param $name
|
75 |
+
* @param $arguments
|
76 |
+
* @param $expectedClass - optional, the expected class name
|
77 |
+
* @return Google_Http_Request|expectedClass
|
78 |
+
* @throws Google_Exception
|
79 |
+
*/
|
80 |
+
public function call($name, $arguments, $expectedClass = null)
|
81 |
+
{
|
82 |
+
if (! isset($this->methods[$name])) {
|
83 |
+
$this->client->getLogger()->error(
|
84 |
+
'Service method unknown',
|
85 |
+
array(
|
86 |
+
'service' => $this->serviceName,
|
87 |
+
'resource' => $this->resourceName,
|
88 |
+
'method' => $name
|
89 |
+
)
|
90 |
+
);
|
91 |
+
|
92 |
+
throw new Google_Exception(
|
93 |
+
"Unknown function: " .
|
94 |
+
"{$this->serviceName}->{$this->resourceName}->{$name}()"
|
95 |
+
);
|
96 |
+
}
|
97 |
+
$method = $this->methods[$name];
|
98 |
+
$parameters = $arguments[0];
|
99 |
+
|
100 |
+
// postBody is a special case since it's not defined in the discovery
|
101 |
+
// document as parameter, but we abuse the param entry for storing it.
|
102 |
+
$postBody = null;
|
103 |
+
if (isset($parameters['postBody'])) {
|
104 |
+
if ($parameters['postBody'] instanceof Google_Model) {
|
105 |
+
// In the cases the post body is an existing object, we want
|
106 |
+
// to use the smart method to create a simple object for
|
107 |
+
// for JSONification.
|
108 |
+
$parameters['postBody'] = $parameters['postBody']->toSimpleObject();
|
109 |
+
} else if (is_object($parameters['postBody'])) {
|
110 |
+
// If the post body is another kind of object, we will try and
|
111 |
+
// wrangle it into a sensible format.
|
112 |
+
$parameters['postBody'] =
|
113 |
+
$this->convertToArrayAndStripNulls($parameters['postBody']);
|
114 |
+
}
|
115 |
+
$postBody = (array) $parameters['postBody'];
|
116 |
+
unset($parameters['postBody']);
|
117 |
+
}
|
118 |
+
|
119 |
+
// TODO: optParams here probably should have been
|
120 |
+
// handled already - this may well be redundant code.
|
121 |
+
if (isset($parameters['optParams'])) {
|
122 |
+
$optParams = $parameters['optParams'];
|
123 |
+
unset($parameters['optParams']);
|
124 |
+
$parameters = array_merge($parameters, $optParams);
|
125 |
+
}
|
126 |
+
|
127 |
+
if (!isset($method['parameters'])) {
|
128 |
+
$method['parameters'] = array();
|
129 |
+
}
|
130 |
+
|
131 |
+
$method['parameters'] = array_merge(
|
132 |
+
$this->stackParameters,
|
133 |
+
$method['parameters']
|
134 |
+
);
|
135 |
+
|
136 |
+
foreach ($parameters as $key => $val) {
|
137 |
+
if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
|
138 |
+
$this->client->getLogger()->error(
|
139 |
+
'Service parameter unknown',
|
140 |
+
array(
|
141 |
+
'service' => $this->serviceName,
|
142 |
+
'resource' => $this->resourceName,
|
143 |
+
'method' => $name,
|
144 |
+
'parameter' => $key
|
145 |
+
)
|
146 |
+
);
|
147 |
+
throw new Google_Exception("($name) unknown parameter: '$key'");
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
foreach ($method['parameters'] as $paramName => $paramSpec) {
|
152 |
+
if (isset($paramSpec['required']) &&
|
153 |
+
$paramSpec['required'] &&
|
154 |
+
! isset($parameters[$paramName])
|
155 |
+
) {
|
156 |
+
$this->client->getLogger()->error(
|
157 |
+
'Service parameter missing',
|
158 |
+
array(
|
159 |
+
'service' => $this->serviceName,
|
160 |
+
'resource' => $this->resourceName,
|
161 |
+
'method' => $name,
|
162 |
+
'parameter' => $paramName
|
163 |
+
)
|
164 |
+
);
|
165 |
+
throw new Google_Exception("($name) missing required param: '$paramName'");
|
166 |
+
}
|
167 |
+
if (isset($parameters[$paramName])) {
|
168 |
+
$value = $parameters[$paramName];
|
169 |
+
$parameters[$paramName] = $paramSpec;
|
170 |
+
$parameters[$paramName]['value'] = $value;
|
171 |
+
unset($parameters[$paramName]['required']);
|
172 |
+
} else {
|
173 |
+
// Ensure we don't pass nulls.
|
174 |
+
unset($parameters[$paramName]);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
$this->client->getLogger()->info(
|
179 |
+
'Service Call',
|
180 |
+
array(
|
181 |
+
'service' => $this->serviceName,
|
182 |
+
'resource' => $this->resourceName,
|
183 |
+
'method' => $name,
|
184 |
+
'arguments' => $parameters,
|
185 |
+
)
|
186 |
+
);
|
187 |
+
|
188 |
+
// build the service uri
|
189 |
+
$url = $this->createRequestUri(
|
190 |
+
$method['path'],
|
191 |
+
$parameters
|
192 |
+
);
|
193 |
+
|
194 |
+
// NOTE: because we're creating the request by hand,
|
195 |
+
// and because the service has a rootUrl property
|
196 |
+
// the "base_uri" of the Http Client is not accounted for
|
197 |
+
$request = new Request(
|
198 |
+
$method['httpMethod'],
|
199 |
+
$url,
|
200 |
+
['content-type' => 'application/json'],
|
201 |
+
$postBody ? json_encode($postBody) : ''
|
202 |
+
);
|
203 |
+
|
204 |
+
// support uploads
|
205 |
+
if (isset($parameters['data'])) {
|
206 |
+
$mimeType = isset($parameters['mimeType'])
|
207 |
+
? $parameters['mimeType']['value']
|
208 |
+
: 'application/octet-stream';
|
209 |
+
$data = $parameters['data']['value'];
|
210 |
+
$upload = new Google_Http_MediaFileUpload($this->client, $request, $mimeType, $data);
|
211 |
+
|
212 |
+
// pull down the modified request
|
213 |
+
$request = $upload->getRequest();
|
214 |
+
}
|
215 |
+
|
216 |
+
// if this is a media type, we will return the raw response
|
217 |
+
// rather than using an expected class
|
218 |
+
if (isset($parameters['alt']) && $parameters['alt']['value'] == 'media') {
|
219 |
+
$expectedClass = null;
|
220 |
+
}
|
221 |
+
|
222 |
+
// if the client is marked for deferring, rather than
|
223 |
+
// execute the request, return the response
|
224 |
+
if ($this->client->shouldDefer()) {
|
225 |
+
// @TODO find a better way to do this
|
226 |
+
$request = $request
|
227 |
+
->withHeader('X-Php-Expected-Class', $expectedClass);
|
228 |
+
|
229 |
+
return $request;
|
230 |
+
}
|
231 |
+
|
232 |
+
return $this->client->execute($request, $expectedClass);
|
233 |
+
}
|
234 |
+
|
235 |
+
protected function convertToArrayAndStripNulls($o)
|
236 |
+
{
|
237 |
+
$o = (array) $o;
|
238 |
+
foreach ($o as $k => $v) {
|
239 |
+
if ($v === null) {
|
240 |
+
unset($o[$k]);
|
241 |
+
} elseif (is_object($v) || is_array($v)) {
|
242 |
+
$o[$k] = $this->convertToArrayAndStripNulls($o[$k]);
|
243 |
+
}
|
244 |
+
}
|
245 |
+
return $o;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Parse/expand request parameters and create a fully qualified
|
250 |
+
* request uri.
|
251 |
+
* @static
|
252 |
+
* @param string $restPath
|
253 |
+
* @param array $params
|
254 |
+
* @return string $requestUrl
|
255 |
+
*/
|
256 |
+
public function createRequestUri($restPath, $params)
|
257 |
+
{
|
258 |
+
// code for leading slash
|
259 |
+
$requestUrl = $this->servicePath . $restPath;
|
260 |
+
if ($this->rootUrl) {
|
261 |
+
if ('/' !== substr($this->rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) {
|
262 |
+
$requestUrl = '/' . $requestUrl;
|
263 |
+
}
|
264 |
+
$requestUrl = $this->rootUrl . $requestUrl;
|
265 |
+
}
|
266 |
+
$uriTemplateVars = array();
|
267 |
+
$queryVars = array();
|
268 |
+
foreach ($params as $paramName => $paramSpec) {
|
269 |
+
if ($paramSpec['type'] == 'boolean') {
|
270 |
+
$paramSpec['value'] = $paramSpec['value'] ? 'true' : 'false';
|
271 |
+
}
|
272 |
+
if ($paramSpec['location'] == 'path') {
|
273 |
+
$uriTemplateVars[$paramName] = $paramSpec['value'];
|
274 |
+
} else if ($paramSpec['location'] == 'query') {
|
275 |
+
if (is_array($paramSpec['value'])) {
|
276 |
+
foreach ($paramSpec['value'] as $value) {
|
277 |
+
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
|
278 |
+
}
|
279 |
+
} else {
|
280 |
+
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
if (count($uriTemplateVars)) {
|
286 |
+
$uriTemplateParser = new Google_Utils_UriTemplate();
|
287 |
+
$requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
|
288 |
+
}
|
289 |
+
|
290 |
+
if (count($queryVars)) {
|
291 |
+
$requestUrl .= '?' . implode($queryVars, '&');
|
292 |
+
}
|
293 |
+
|
294 |
+
return $requestUrl;
|
295 |
+
}
|
296 |
+
}
|
google/src/Google/Task/Exception.php
CHANGED
@@ -1,20 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2014 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
class Google_Task_Exception extends Google_Exception
|
19 |
-
{
|
20 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2014 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
class Google_Task_Exception extends Google_Exception
|
19 |
+
{
|
20 |
+
}
|
google/src/Google/Task/Retryable.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2014 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Interface for checking how many times a given task can be retried following
|
20 |
-
* a failure.
|
21 |
-
*/
|
22 |
-
interface Google_Task_Retryable
|
23 |
-
{
|
24 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2014 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Interface for checking how many times a given task can be retried following
|
20 |
+
* a failure.
|
21 |
+
*/
|
22 |
+
interface Google_Task_Retryable
|
23 |
+
{
|
24 |
+
}
|
google/src/Google/Task/Runner.php
CHANGED
@@ -1,281 +1,281 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2014 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* A task runner with exponential backoff support.
|
20 |
-
*
|
21 |
-
* @see https://developers.google.com/drive/web/handle-errors#implementing_exponential_backoff
|
22 |
-
*/
|
23 |
-
class Google_Task_Runner
|
24 |
-
{
|
25 |
-
const TASK_RETRY_NEVER = 0;
|
26 |
-
const TASK_RETRY_ONCE = 1;
|
27 |
-
const TASK_RETRY_ALWAYS = -1;
|
28 |
-
|
29 |
-
/**
|
30 |
-
* @var integer $maxDelay The max time (in seconds) to wait before a retry.
|
31 |
-
*/
|
32 |
-
private $maxDelay = 60;
|
33 |
-
/**
|
34 |
-
* @var integer $delay The previous delay from which the next is calculated.
|
35 |
-
*/
|
36 |
-
private $delay = 1;
|
37 |
-
|
38 |
-
/**
|
39 |
-
* @var integer $factor The base number for the exponential back off.
|
40 |
-
*/
|
41 |
-
private $factor = 2;
|
42 |
-
/**
|
43 |
-
* @var float $jitter A random number between -$jitter and $jitter will be
|
44 |
-
* added to $factor on each iteration to allow for a better distribution of
|
45 |
-
* retries.
|
46 |
-
*/
|
47 |
-
private $jitter = 0.5;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* @var integer $attempts The number of attempts that have been tried so far.
|
51 |
-
*/
|
52 |
-
private $attempts = 0;
|
53 |
-
/**
|
54 |
-
* @var integer $maxAttempts The max number of attempts allowed.
|
55 |
-
*/
|
56 |
-
private $maxAttempts = 1;
|
57 |
-
|
58 |
-
/**
|
59 |
-
* @var callable $action The task to run and possibly retry.
|
60 |
-
*/
|
61 |
-
private $action;
|
62 |
-
/**
|
63 |
-
* @var array $arguments The task arguments.
|
64 |
-
*/
|
65 |
-
private $arguments;
|
66 |
-
|
67 |
-
/**
|
68 |
-
* @var array $retryMap Map of errors with retry counts.
|
69 |
-
*/
|
70 |
-
protected $retryMap = [
|
71 |
-
'500' => self::TASK_RETRY_ALWAYS,
|
72 |
-
'503' => self::TASK_RETRY_ALWAYS,
|
73 |
-
'rateLimitExceeded' => self::TASK_RETRY_ALWAYS,
|
74 |
-
'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS,
|
75 |
-
6 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_RESOLVE_HOST
|
76 |
-
7 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_CONNECT
|
77 |
-
28 => self::TASK_RETRY_ALWAYS, // CURLE_OPERATION_TIMEOUTED
|
78 |
-
35 => self::TASK_RETRY_ALWAYS, // CURLE_SSL_CONNECT_ERROR
|
79 |
-
52 => self::TASK_RETRY_ALWAYS // CURLE_GOT_NOTHING
|
80 |
-
];
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Creates a new task runner with exponential backoff support.
|
84 |
-
*
|
85 |
-
* @param array $config The task runner config
|
86 |
-
* @param string $name The name of the current task (used for logging)
|
87 |
-
* @param callable $action The task to run and possibly retry
|
88 |
-
* @param array $arguments The task arguments
|
89 |
-
* @throws Google_Task_Exception when misconfigured
|
90 |
-
*/
|
91 |
-
public function __construct(
|
92 |
-
$config,
|
93 |
-
$name,
|
94 |
-
$action,
|
95 |
-
array $arguments = array()
|
96 |
-
) {
|
97 |
-
if (isset($config['initial_delay'])) {
|
98 |
-
if ($config['initial_delay'] < 0) {
|
99 |
-
throw new Google_Task_Exception(
|
100 |
-
'Task configuration `initial_delay` must not be negative.'
|
101 |
-
);
|
102 |
-
}
|
103 |
-
|
104 |
-
$this->delay = $config['initial_delay'];
|
105 |
-
}
|
106 |
-
|
107 |
-
if (isset($config['max_delay'])) {
|
108 |
-
if ($config['max_delay'] <= 0) {
|
109 |
-
throw new Google_Task_Exception(
|
110 |
-
'Task configuration `max_delay` must be greater than 0.'
|
111 |
-
);
|
112 |
-
}
|
113 |
-
|
114 |
-
$this->maxDelay = $config['max_delay'];
|
115 |
-
}
|
116 |
-
|
117 |
-
if (isset($config['factor'])) {
|
118 |
-
if ($config['factor'] <= 0) {
|
119 |
-
throw new Google_Task_Exception(
|
120 |
-
'Task configuration `factor` must be greater than 0.'
|
121 |
-
);
|
122 |
-
}
|
123 |
-
|
124 |
-
$this->factor = $config['factor'];
|
125 |
-
}
|
126 |
-
|
127 |
-
if (isset($config['jitter'])) {
|
128 |
-
if ($config['jitter'] <= 0) {
|
129 |
-
throw new Google_Task_Exception(
|
130 |
-
'Task configuration `jitter` must be greater than 0.'
|
131 |
-
);
|
132 |
-
}
|
133 |
-
|
134 |
-
$this->jitter = $config['jitter'];
|
135 |
-
}
|
136 |
-
|
137 |
-
if (isset($config['retries'])) {
|
138 |
-
if ($config['retries'] < 0) {
|
139 |
-
throw new Google_Task_Exception(
|
140 |
-
'Task configuration `retries` must not be negative.'
|
141 |
-
);
|
142 |
-
}
|
143 |
-
$this->maxAttempts += $config['retries'];
|
144 |
-
}
|
145 |
-
|
146 |
-
if (!is_callable($action)) {
|
147 |
-
throw new Google_Task_Exception(
|
148 |
-
'Task argument `$action` must be a valid callable.'
|
149 |
-
);
|
150 |
-
}
|
151 |
-
|
152 |
-
$this->action = $action;
|
153 |
-
$this->arguments = $arguments;
|
154 |
-
}
|
155 |
-
|
156 |
-
/**
|
157 |
-
* Checks if a retry can be attempted.
|
158 |
-
*
|
159 |
-
* @return boolean
|
160 |
-
*/
|
161 |
-
public function canAttempt()
|
162 |
-
{
|
163 |
-
return $this->attempts < $this->maxAttempts;
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Runs the task and (if applicable) automatically retries when errors occur.
|
168 |
-
*
|
169 |
-
* @return mixed
|
170 |
-
* @throws Google_Task_Retryable on failure when no retries are available.
|
171 |
-
*/
|
172 |
-
public function run()
|
173 |
-
{
|
174 |
-
while ($this->attempt()) {
|
175 |
-
try {
|
176 |
-
return call_user_func_array($this->action, $this->arguments);
|
177 |
-
} catch (Google_Service_Exception $exception) {
|
178 |
-
$allowedRetries = $this->allowedRetries(
|
179 |
-
$exception->getCode(),
|
180 |
-
$exception->getErrors()
|
181 |
-
);
|
182 |
-
|
183 |
-
if (!$this->canAttempt() || !$allowedRetries) {
|
184 |
-
throw $exception;
|
185 |
-
}
|
186 |
-
|
187 |
-
if ($allowedRetries > 0) {
|
188 |
-
$this->maxAttempts = min(
|
189 |
-
$this->maxAttempts,
|
190 |
-
$this->attempts + $allowedRetries
|
191 |
-
);
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
/**
|
198 |
-
* Runs a task once, if possible. This is useful for bypassing the `run()`
|
199 |
-
* loop.
|
200 |
-
*
|
201 |
-
* NOTE: If this is not the first attempt, this function will sleep in
|
202 |
-
* accordance to the backoff configurations before running the task.
|
203 |
-
*
|
204 |
-
* @return boolean
|
205 |
-
*/
|
206 |
-
public function attempt()
|
207 |
-
{
|
208 |
-
if (!$this->canAttempt()) {
|
209 |
-
return false;
|
210 |
-
}
|
211 |
-
|
212 |
-
if ($this->attempts > 0) {
|
213 |
-
$this->backOff();
|
214 |
-
}
|
215 |
-
|
216 |
-
$this->attempts++;
|
217 |
-
return true;
|
218 |
-
}
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Sleeps in accordance to the backoff configurations.
|
222 |
-
*/
|
223 |
-
private function backOff()
|
224 |
-
{
|
225 |
-
$delay = $this->getDelay();
|
226 |
-
|
227 |
-
usleep($delay * 1000000);
|
228 |
-
}
|
229 |
-
|
230 |
-
/**
|
231 |
-
* Gets the delay (in seconds) for the current backoff period.
|
232 |
-
*
|
233 |
-
* @return float
|
234 |
-
*/
|
235 |
-
private function getDelay()
|
236 |
-
{
|
237 |
-
$jitter = $this->getJitter();
|
238 |
-
$factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter);
|
239 |
-
|
240 |
-
return $this->delay = min($this->maxDelay, $this->delay * $factor);
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Gets the current jitter (random number between -$this->jitter and
|
245 |
-
* $this->jitter).
|
246 |
-
*
|
247 |
-
* @return float
|
248 |
-
*/
|
249 |
-
private function getJitter()
|
250 |
-
{
|
251 |
-
return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Gets the number of times the associated task can be retried.
|
256 |
-
*
|
257 |
-
* NOTE: -1 is returned if the task can be retried indefinitely
|
258 |
-
*
|
259 |
-
* @return integer
|
260 |
-
*/
|
261 |
-
public function allowedRetries($code, $errors = array())
|
262 |
-
{
|
263 |
-
if (isset($this->retryMap[$code])) {
|
264 |
-
return $this->retryMap[$code];
|
265 |
-
}
|
266 |
-
|
267 |
-
if (
|
268 |
-
!empty($errors) &&
|
269 |
-
isset($errors[0]['reason'], $this->retryMap[$errors[0]['reason']])
|
270 |
-
) {
|
271 |
-
return $this->retryMap[$errors[0]['reason']];
|
272 |
-
}
|
273 |
-
|
274 |
-
return 0;
|
275 |
-
}
|
276 |
-
|
277 |
-
public function setRetryMap($retryMap)
|
278 |
-
{
|
279 |
-
$this->retryMap = $retryMap;
|
280 |
-
}
|
281 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2014 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* A task runner with exponential backoff support.
|
20 |
+
*
|
21 |
+
* @see https://developers.google.com/drive/web/handle-errors#implementing_exponential_backoff
|
22 |
+
*/
|
23 |
+
class Google_Task_Runner
|
24 |
+
{
|
25 |
+
const TASK_RETRY_NEVER = 0;
|
26 |
+
const TASK_RETRY_ONCE = 1;
|
27 |
+
const TASK_RETRY_ALWAYS = -1;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var integer $maxDelay The max time (in seconds) to wait before a retry.
|
31 |
+
*/
|
32 |
+
private $maxDelay = 60;
|
33 |
+
/**
|
34 |
+
* @var integer $delay The previous delay from which the next is calculated.
|
35 |
+
*/
|
36 |
+
private $delay = 1;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var integer $factor The base number for the exponential back off.
|
40 |
+
*/
|
41 |
+
private $factor = 2;
|
42 |
+
/**
|
43 |
+
* @var float $jitter A random number between -$jitter and $jitter will be
|
44 |
+
* added to $factor on each iteration to allow for a better distribution of
|
45 |
+
* retries.
|
46 |
+
*/
|
47 |
+
private $jitter = 0.5;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var integer $attempts The number of attempts that have been tried so far.
|
51 |
+
*/
|
52 |
+
private $attempts = 0;
|
53 |
+
/**
|
54 |
+
* @var integer $maxAttempts The max number of attempts allowed.
|
55 |
+
*/
|
56 |
+
private $maxAttempts = 1;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @var callable $action The task to run and possibly retry.
|
60 |
+
*/
|
61 |
+
private $action;
|
62 |
+
/**
|
63 |
+
* @var array $arguments The task arguments.
|
64 |
+
*/
|
65 |
+
private $arguments;
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @var array $retryMap Map of errors with retry counts.
|
69 |
+
*/
|
70 |
+
protected $retryMap = [
|
71 |
+
'500' => self::TASK_RETRY_ALWAYS,
|
72 |
+
'503' => self::TASK_RETRY_ALWAYS,
|
73 |
+
'rateLimitExceeded' => self::TASK_RETRY_ALWAYS,
|
74 |
+
'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS,
|
75 |
+
6 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_RESOLVE_HOST
|
76 |
+
7 => self::TASK_RETRY_ALWAYS, // CURLE_COULDNT_CONNECT
|
77 |
+
28 => self::TASK_RETRY_ALWAYS, // CURLE_OPERATION_TIMEOUTED
|
78 |
+
35 => self::TASK_RETRY_ALWAYS, // CURLE_SSL_CONNECT_ERROR
|
79 |
+
52 => self::TASK_RETRY_ALWAYS // CURLE_GOT_NOTHING
|
80 |
+
];
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Creates a new task runner with exponential backoff support.
|
84 |
+
*
|
85 |
+
* @param array $config The task runner config
|
86 |
+
* @param string $name The name of the current task (used for logging)
|
87 |
+
* @param callable $action The task to run and possibly retry
|
88 |
+
* @param array $arguments The task arguments
|
89 |
+
* @throws Google_Task_Exception when misconfigured
|
90 |
+
*/
|
91 |
+
public function __construct(
|
92 |
+
$config,
|
93 |
+
$name,
|
94 |
+
$action,
|
95 |
+
array $arguments = array()
|
96 |
+
) {
|
97 |
+
if (isset($config['initial_delay'])) {
|
98 |
+
if ($config['initial_delay'] < 0) {
|
99 |
+
throw new Google_Task_Exception(
|
100 |
+
'Task configuration `initial_delay` must not be negative.'
|
101 |
+
);
|
102 |
+
}
|
103 |
+
|
104 |
+
$this->delay = $config['initial_delay'];
|
105 |
+
}
|
106 |
+
|
107 |
+
if (isset($config['max_delay'])) {
|
108 |
+
if ($config['max_delay'] <= 0) {
|
109 |
+
throw new Google_Task_Exception(
|
110 |
+
'Task configuration `max_delay` must be greater than 0.'
|
111 |
+
);
|
112 |
+
}
|
113 |
+
|
114 |
+
$this->maxDelay = $config['max_delay'];
|
115 |
+
}
|
116 |
+
|
117 |
+
if (isset($config['factor'])) {
|
118 |
+
if ($config['factor'] <= 0) {
|
119 |
+
throw new Google_Task_Exception(
|
120 |
+
'Task configuration `factor` must be greater than 0.'
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
$this->factor = $config['factor'];
|
125 |
+
}
|
126 |
+
|
127 |
+
if (isset($config['jitter'])) {
|
128 |
+
if ($config['jitter'] <= 0) {
|
129 |
+
throw new Google_Task_Exception(
|
130 |
+
'Task configuration `jitter` must be greater than 0.'
|
131 |
+
);
|
132 |
+
}
|
133 |
+
|
134 |
+
$this->jitter = $config['jitter'];
|
135 |
+
}
|
136 |
+
|
137 |
+
if (isset($config['retries'])) {
|
138 |
+
if ($config['retries'] < 0) {
|
139 |
+
throw new Google_Task_Exception(
|
140 |
+
'Task configuration `retries` must not be negative.'
|
141 |
+
);
|
142 |
+
}
|
143 |
+
$this->maxAttempts += $config['retries'];
|
144 |
+
}
|
145 |
+
|
146 |
+
if (!is_callable($action)) {
|
147 |
+
throw new Google_Task_Exception(
|
148 |
+
'Task argument `$action` must be a valid callable.'
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
$this->action = $action;
|
153 |
+
$this->arguments = $arguments;
|
154 |
+
}
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Checks if a retry can be attempted.
|
158 |
+
*
|
159 |
+
* @return boolean
|
160 |
+
*/
|
161 |
+
public function canAttempt()
|
162 |
+
{
|
163 |
+
return $this->attempts < $this->maxAttempts;
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Runs the task and (if applicable) automatically retries when errors occur.
|
168 |
+
*
|
169 |
+
* @return mixed
|
170 |
+
* @throws Google_Task_Retryable on failure when no retries are available.
|
171 |
+
*/
|
172 |
+
public function run()
|
173 |
+
{
|
174 |
+
while ($this->attempt()) {
|
175 |
+
try {
|
176 |
+
return call_user_func_array($this->action, $this->arguments);
|
177 |
+
} catch (Google_Service_Exception $exception) {
|
178 |
+
$allowedRetries = $this->allowedRetries(
|
179 |
+
$exception->getCode(),
|
180 |
+
$exception->getErrors()
|
181 |
+
);
|
182 |
+
|
183 |
+
if (!$this->canAttempt() || !$allowedRetries) {
|
184 |
+
throw $exception;
|
185 |
+
}
|
186 |
+
|
187 |
+
if ($allowedRetries > 0) {
|
188 |
+
$this->maxAttempts = min(
|
189 |
+
$this->maxAttempts,
|
190 |
+
$this->attempts + $allowedRetries
|
191 |
+
);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Runs a task once, if possible. This is useful for bypassing the `run()`
|
199 |
+
* loop.
|
200 |
+
*
|
201 |
+
* NOTE: If this is not the first attempt, this function will sleep in
|
202 |
+
* accordance to the backoff configurations before running the task.
|
203 |
+
*
|
204 |
+
* @return boolean
|
205 |
+
*/
|
206 |
+
public function attempt()
|
207 |
+
{
|
208 |
+
if (!$this->canAttempt()) {
|
209 |
+
return false;
|
210 |
+
}
|
211 |
+
|
212 |
+
if ($this->attempts > 0) {
|
213 |
+
$this->backOff();
|
214 |
+
}
|
215 |
+
|
216 |
+
$this->attempts++;
|
217 |
+
return true;
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Sleeps in accordance to the backoff configurations.
|
222 |
+
*/
|
223 |
+
private function backOff()
|
224 |
+
{
|
225 |
+
$delay = $this->getDelay();
|
226 |
+
|
227 |
+
usleep($delay * 1000000);
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Gets the delay (in seconds) for the current backoff period.
|
232 |
+
*
|
233 |
+
* @return float
|
234 |
+
*/
|
235 |
+
private function getDelay()
|
236 |
+
{
|
237 |
+
$jitter = $this->getJitter();
|
238 |
+
$factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter);
|
239 |
+
|
240 |
+
return $this->delay = min($this->maxDelay, $this->delay * $factor);
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Gets the current jitter (random number between -$this->jitter and
|
245 |
+
* $this->jitter).
|
246 |
+
*
|
247 |
+
* @return float
|
248 |
+
*/
|
249 |
+
private function getJitter()
|
250 |
+
{
|
251 |
+
return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Gets the number of times the associated task can be retried.
|
256 |
+
*
|
257 |
+
* NOTE: -1 is returned if the task can be retried indefinitely
|
258 |
+
*
|
259 |
+
* @return integer
|
260 |
+
*/
|
261 |
+
public function allowedRetries($code, $errors = array())
|
262 |
+
{
|
263 |
+
if (isset($this->retryMap[$code])) {
|
264 |
+
return $this->retryMap[$code];
|
265 |
+
}
|
266 |
+
|
267 |
+
if (
|
268 |
+
!empty($errors) &&
|
269 |
+
isset($errors[0]['reason'], $this->retryMap[$errors[0]['reason']])
|
270 |
+
) {
|
271 |
+
return $this->retryMap[$errors[0]['reason']];
|
272 |
+
}
|
273 |
+
|
274 |
+
return 0;
|
275 |
+
}
|
276 |
+
|
277 |
+
public function setRetryMap($retryMap)
|
278 |
+
{
|
279 |
+
$this->retryMap = $retryMap;
|
280 |
+
}
|
281 |
+
}
|
google/src/Google/Utils/UriTemplate.php
CHANGED
@@ -1,333 +1,333 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* Copyright 2013 Google Inc.
|
4 |
-
*
|
5 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
-
* you may not use this file except in compliance with the License.
|
7 |
-
* You may obtain a copy of the License at
|
8 |
-
*
|
9 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
-
*
|
11 |
-
* Unless required by applicable law or agreed to in writing, software
|
12 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
-
* See the License for the specific language governing permissions and
|
15 |
-
* limitations under the License.
|
16 |
-
*/
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Implementation of levels 1-3 of the URI Template spec.
|
20 |
-
* @see http://tools.ietf.org/html/rfc6570
|
21 |
-
*/
|
22 |
-
class Google_Utils_UriTemplate
|
23 |
-
{
|
24 |
-
const TYPE_MAP = "1";
|
25 |
-
const TYPE_LIST = "2";
|
26 |
-
const TYPE_SCALAR = "4";
|
27 |
-
|
28 |
-
/**
|
29 |
-
* @var $operators array
|
30 |
-
* These are valid at the start of a template block to
|
31 |
-
* modify the way in which the variables inside are
|
32 |
-
* processed.
|
33 |
-
*/
|
34 |
-
private $operators = array(
|
35 |
-
"+" => "reserved",
|
36 |
-
"/" => "segments",
|
37 |
-
"." => "dotprefix",
|
38 |
-
"#" => "fragment",
|
39 |
-
";" => "semicolon",
|
40 |
-
"?" => "form",
|
41 |
-
"&" => "continuation"
|
42 |
-
);
|
43 |
-
|
44 |
-
/**
|
45 |
-
* @var reserved array
|
46 |
-
* These are the characters which should not be URL encoded in reserved
|
47 |
-
* strings.
|
48 |
-
*/
|
49 |
-
private $reserved = array(
|
50 |
-
"=", ",", "!", "@", "|", ":", "/", "?", "#",
|
51 |
-
"[", "]",'$', "&", "'", "(", ")", "*", "+", ";"
|
52 |
-
);
|
53 |
-
private $reservedEncoded = array(
|
54 |
-
"%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F",
|
55 |
-
"%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29",
|
56 |
-
"%2A", "%2B", "%3B"
|
57 |
-
);
|
58 |
-
|
59 |
-
public function parse($string, array $parameters)
|
60 |
-
{
|
61 |
-
return $this->resolveNextSection($string, $parameters);
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* This function finds the first matching {...} block and
|
66 |
-
* executes the replacement. It then calls itself to find
|
67 |
-
* subsequent blocks, if any.
|
68 |
-
*/
|
69 |
-
private function resolveNextSection($string, $parameters)
|
70 |
-
{
|
71 |
-
$start = strpos($string, "{");
|
72 |
-
if ($start === false) {
|
73 |
-
return $string;
|
74 |
-
}
|
75 |
-
$end = strpos($string, "}");
|
76 |
-
if ($end === false) {
|
77 |
-
return $string;
|
78 |
-
}
|
79 |
-
$string = $this->replace($string, $start, $end, $parameters);
|
80 |
-
return $this->resolveNextSection($string, $parameters);
|
81 |
-
}
|
82 |
-
|
83 |
-
private function replace($string, $start, $end, $parameters)
|
84 |
-
{
|
85 |
-
// We know a data block will have {} round it, so we can strip that.
|
86 |
-
$data = substr($string, $start + 1, $end - $start - 1);
|
87 |
-
|
88 |
-
// If the first character is one of the reserved operators, it effects
|
89 |
-
// the processing of the stream.
|
90 |
-
if (isset($this->operators[$data[0]])) {
|
91 |
-
$op = $this->operators[$data[0]];
|
92 |
-
$data = substr($data, 1);
|
93 |
-
$prefix = "";
|
94 |
-
$prefix_on_missing = false;
|
95 |
-
|
96 |
-
switch ($op) {
|
97 |
-
case "reserved":
|
98 |
-
// Reserved means certain characters should not be URL encoded
|
99 |
-
$data = $this->replaceVars($data, $parameters, ",", null, true);
|
100 |
-
break;
|
101 |
-
case "fragment":
|
102 |
-
// Comma separated with fragment prefix. Bare values only.
|
103 |
-
$prefix = "#";
|
104 |
-
$prefix_on_missing = true;
|
105 |
-
$data = $this->replaceVars($data, $parameters, ",", null, true);
|
106 |
-
break;
|
107 |
-
case "segments":
|
108 |
-
// Slash separated data. Bare values only.
|
109 |
-
$prefix = "/";
|
110 |
-
$data =$this->replaceVars($data, $parameters, "/");
|
111 |
-
break;
|
112 |
-
case "dotprefix":
|
113 |
-
// Dot separated data. Bare values only.
|
114 |
-
$prefix = ".";
|
115 |
-
$prefix_on_missing = true;
|
116 |
-
$data = $this->replaceVars($data, $parameters, ".");
|
117 |
-
break;
|
118 |
-
case "semicolon":
|
119 |
-
// Semicolon prefixed and separated. Uses the key name
|
120 |
-
$prefix = ";";
|
121 |
-
$data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
|
122 |
-
break;
|
123 |
-
case "form":
|
124 |
-
// Standard URL format. Uses the key name
|
125 |
-
$prefix = "?";
|
126 |
-
$data = $this->replaceVars($data, $parameters, "&", "=");
|
127 |
-
break;
|
128 |
-
case "continuation":
|
129 |
-
// Standard URL, but with leading ampersand. Uses key name.
|
130 |
-
$prefix = "&";
|
131 |
-
$data = $this->replaceVars($data, $parameters, "&", "=");
|
132 |
-
break;
|
133 |
-
}
|
134 |
-
|
135 |
-
// Add the initial prefix character if data is valid.
|
136 |
-
if ($data || ($data !== false && $prefix_on_missing)) {
|
137 |
-
$data = $prefix . $data;
|
138 |
-
}
|
139 |
-
|
140 |
-
} else {
|
141 |
-
// If no operator we replace with the defaults.
|
142 |
-
$data = $this->replaceVars($data, $parameters);
|
143 |
-
}
|
144 |
-
// This is chops out the {...} and replaces with the new section.
|
145 |
-
return substr($string, 0, $start) . $data . substr($string, $end + 1);
|
146 |
-
}
|
147 |
-
|
148 |
-
private function replaceVars(
|
149 |
-
$section,
|
150 |
-
$parameters,
|
151 |
-
$sep = ",",
|
152 |
-
$combine = null,
|
153 |
-
$reserved = false,
|
154 |
-
$tag_empty = false,
|
155 |
-
$combine_on_empty = true
|
156 |
-
) {
|
157 |
-
if (strpos($section, ",") === false) {
|
158 |
-
// If we only have a single value, we can immediately process.
|
159 |
-
return $this->combine(
|
160 |
-
$section,
|
161 |
-
$parameters,
|
162 |
-
$sep,
|
163 |
-
$combine,
|
164 |
-
$reserved,
|
165 |
-
$tag_empty,
|
166 |
-
$combine_on_empty
|
167 |
-
);
|
168 |
-
} else {
|
169 |
-
// If we have multiple values, we need to split and loop over them.
|
170 |
-
// Each is treated individually, then glued together with the
|
171 |
-
// separator character.
|
172 |
-
$vars = explode(",", $section);
|
173 |
-
return $this->combineList(
|
174 |
-
$vars,
|
175 |
-
$sep,
|
176 |
-
$parameters,
|
177 |
-
$combine,
|
178 |
-
$reserved,
|
179 |
-
false, // Never emit empty strings in multi-param replacements
|
180 |
-
$combine_on_empty
|
181 |
-
);
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
public function combine(
|
186 |
-
$key,
|
187 |
-
$parameters,
|
188 |
-
$sep,
|
189 |
-
$combine,
|
190 |
-
$reserved,
|
191 |
-
$tag_empty,
|
192 |
-
$combine_on_empty
|
193 |
-
) {
|
194 |
-
$length = false;
|
195 |
-
$explode = false;
|
196 |
-
$skip_final_combine = false;
|
197 |
-
$value = false;
|
198 |
-
|
199 |
-
// Check for length restriction.
|
200 |
-
if (strpos($key, ":") !== false) {
|
201 |
-
list($key, $length) = explode(":", $key);
|
202 |
-
}
|
203 |
-
|
204 |
-
// Check for explode parameter.
|
205 |
-
if ($key[strlen($key) - 1] == "*") {
|
206 |
-
$explode = true;
|
207 |
-
$key = substr($key, 0, -1);
|
208 |
-
$skip_final_combine = true;
|
209 |
-
}
|
210 |
-
|
211 |
-
// Define the list separator.
|
212 |
-
$list_sep = $explode ? $sep : ",";
|
213 |
-
|
214 |
-
if (isset($parameters[$key])) {
|
215 |
-
$data_type = $this->getDataType($parameters[$key]);
|
216 |
-
switch ($data_type) {
|
217 |
-
case self::TYPE_SCALAR:
|
218 |
-
$value = $this->getValue($parameters[$key], $length);
|
219 |
-
break;
|
220 |
-
case self::TYPE_LIST:
|
221 |
-
$values = array();
|
222 |
-
foreach ($parameters[$key] as $pkey => $pvalue) {
|
223 |
-
$pvalue = $this->getValue($pvalue, $length);
|
224 |
-
if ($combine && $explode) {
|
225 |
-
$values[$pkey] = $key . $combine . $pvalue;
|
226 |
-
} else {
|
227 |
-
$values[$pkey] = $pvalue;
|
228 |
-
}
|
229 |
-
}
|
230 |
-
$value = implode($list_sep, $values);
|
231 |
-
if ($value == '') {
|
232 |
-
return '';
|
233 |
-
}
|
234 |
-
break;
|
235 |
-
case self::TYPE_MAP:
|
236 |
-
$values = array();
|
237 |
-
foreach ($parameters[$key] as $pkey => $pvalue) {
|
238 |
-
$pvalue = $this->getValue($pvalue, $length);
|
239 |
-
if ($explode) {
|
240 |
-
$pkey = $this->getValue($pkey, $length);
|
241 |
-
$values[] = $pkey . "=" . $pvalue; // Explode triggers = combine.
|
242 |
-
} else {
|
243 |
-
$values[] = $pkey;
|
244 |
-
$values[] = $pvalue;
|
245 |
-
}
|
246 |
-
}
|
247 |
-
$value = implode($list_sep, $values);
|
248 |
-
if ($value == '') {
|
249 |
-
return false;
|
250 |
-
}
|
251 |
-
break;
|
252 |
-
}
|
253 |
-
} else if ($tag_empty) {
|
254 |
-
// If we are just indicating empty values with their key name, return that.
|
255 |
-
return $key;
|
256 |
-
} else {
|
257 |
-
// Otherwise we can skip this variable due to not being defined.
|
258 |
-
return false;
|
259 |
-
}
|
260 |
-
|
261 |
-
if ($reserved) {
|
262 |
-
$value = str_replace($this->reservedEncoded, $this->reserved, $value);
|
263 |
-
}
|
264 |
-
|
265 |
-
// If we do not need to include the key name, we just return the raw
|
266 |
-
// value.
|
267 |
-
if (!$combine || $skip_final_combine) {
|
268 |
-
return $value;
|
269 |
-
}
|
270 |
-
|
271 |
-
// Else we combine the key name: foo=bar, if value is not the empty string.
|
272 |
-
return $key . ($value != '' || $combine_on_empty ? $combine . $value : '');
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Return the type of a passed in value
|
277 |
-
*/
|
278 |
-
private function getDataType($data)
|
279 |
-
{
|
280 |
-
if (is_array($data)) {
|
281 |
-
reset($data);
|
282 |
-
if (key($data) !== 0) {
|
283 |
-
return self::TYPE_MAP;
|
284 |
-
}
|
285 |
-
return self::TYPE_LIST;
|
286 |
-
}
|
287 |
-
return self::TYPE_SCALAR;
|
288 |
-
}
|
289 |
-
|
290 |
-
/**
|
291 |
-
* Utility function that merges multiple combine calls
|
292 |
-
* for multi-key templates.
|
293 |
-
*/
|
294 |
-
private function combineList(
|
295 |
-
$vars,
|
296 |
-
$sep,
|
297 |
-
$parameters,
|
298 |
-
$combine,
|
299 |
-
$reserved,
|
300 |
-
$tag_empty,
|
301 |
-
$combine_on_empty
|
302 |
-
) {
|
303 |
-
$ret = array();
|
304 |
-
foreach ($vars as $var) {
|
305 |
-
$response = $this->combine(
|
306 |
-
$var,
|
307 |
-
$parameters,
|
308 |
-
$sep,
|
309 |
-
$combine,
|
310 |
-
$reserved,
|
311 |
-
$tag_empty,
|
312 |
-
$combine_on_empty
|
313 |
-
);
|
314 |
-
if ($response === false) {
|
315 |
-
continue;
|
316 |
-
}
|
317 |
-
$ret[] = $response;
|
318 |
-
}
|
319 |
-
return implode($sep, $ret);
|
320 |
-
}
|
321 |
-
|
322 |
-
/**
|
323 |
-
* Utility function to encode and trim values
|
324 |
-
*/
|
325 |
-
private function getValue($value, $length)
|
326 |
-
{
|
327 |
-
if ($length) {
|
328 |
-
$value = substr($value, 0, $length);
|
329 |
-
}
|
330 |
-
$value = rawurlencode($value);
|
331 |
-
return $value;
|
332 |
-
}
|
333 |
-
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright 2013 Google Inc.
|
4 |
+
*
|
5 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6 |
+
* you may not use this file except in compliance with the License.
|
7 |
+
* You may obtain a copy of the License at
|
8 |
+
*
|
9 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10 |
+
*
|
11 |
+
* Unless required by applicable law or agreed to in writing, software
|
12 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14 |
+
* See the License for the specific language governing permissions and
|
15 |
+
* limitations under the License.
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Implementation of levels 1-3 of the URI Template spec.
|
20 |
+
* @see http://tools.ietf.org/html/rfc6570
|
21 |
+
*/
|
22 |
+
class Google_Utils_UriTemplate
|
23 |
+
{
|
24 |
+
const TYPE_MAP = "1";
|
25 |
+
const TYPE_LIST = "2";
|
26 |
+
const TYPE_SCALAR = "4";
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var $operators array
|
30 |
+
* These are valid at the start of a template block to
|
31 |
+
* modify the way in which the variables inside are
|
32 |
+
* processed.
|
33 |
+
*/
|
34 |
+
private $operators = array(
|
35 |
+
"+" => "reserved",
|
36 |
+
"/" => "segments",
|
37 |
+
"." => "dotprefix",
|
38 |
+
"#" => "fragment",
|
39 |
+
";" => "semicolon",
|
40 |
+
"?" => "form",
|
41 |
+
"&" => "continuation"
|
42 |
+
);
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var reserved array
|
46 |
+
* These are the characters which should not be URL encoded in reserved
|
47 |
+
* strings.
|
48 |
+
*/
|
49 |
+
private $reserved = array(
|
50 |
+
"=", ",", "!", "@", "|", ":", "/", "?", "#",
|
51 |
+
"[", "]",'$', "&", "'", "(", ")", "*", "+", ";"
|
52 |
+
);
|
53 |
+
private $reservedEncoded = array(
|
54 |
+
"%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F",
|
55 |
+
"%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29",
|
56 |
+
"%2A", "%2B", "%3B"
|
57 |
+
);
|
58 |
+
|
59 |
+
public function parse($string, array $parameters)
|
60 |
+
{
|
61 |
+
return $this->resolveNextSection($string, $parameters);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* This function finds the first matching {...} block and
|
66 |
+
* executes the replacement. It then calls itself to find
|
67 |
+
* subsequent blocks, if any.
|
68 |
+
*/
|
69 |
+
private function resolveNextSection($string, $parameters)
|
70 |
+
{
|
71 |
+
$start = strpos($string, "{");
|
72 |
+
if ($start === false) {
|
73 |
+
return $string;
|
74 |
+
}
|
75 |
+
$end = strpos($string, "}");
|
76 |
+
if ($end === false) {
|
77 |
+
return $string;
|
78 |
+
}
|
79 |
+
$string = $this->replace($string, $start, $end, $parameters);
|
80 |
+
return $this->resolveNextSection($string, $parameters);
|
81 |
+
}
|
82 |
+
|
83 |
+
private function replace($string, $start, $end, $parameters)
|
84 |
+
{
|
85 |
+
// We know a data block will have {} round it, so we can strip that.
|
86 |
+
$data = substr($string, $start + 1, $end - $start - 1);
|
87 |
+
|
88 |
+
// If the first character is one of the reserved operators, it effects
|
89 |
+
// the processing of the stream.
|
90 |
+
if (isset($this->operators[$data[0]])) {
|
91 |
+
$op = $this->operators[$data[0]];
|
92 |
+
$data = substr($data, 1);
|
93 |
+
$prefix = "";
|
94 |
+
$prefix_on_missing = false;
|
95 |
+
|
96 |
+
switch ($op) {
|
97 |
+
case "reserved":
|
98 |
+
// Reserved means certain characters should not be URL encoded
|
99 |
+
$data = $this->replaceVars($data, $parameters, ",", null, true);
|
100 |
+
break;
|
101 |
+
case "fragment":
|
102 |
+
// Comma separated with fragment prefix. Bare values only.
|
103 |
+
$prefix = "#";
|
104 |
+
$prefix_on_missing = true;
|
105 |
+
$data = $this->replaceVars($data, $parameters, ",", null, true);
|
106 |
+
break;
|
107 |
+
case "segments":
|
108 |
+
// Slash separated data. Bare values only.
|
109 |
+
$prefix = "/";
|
110 |
+
$data =$this->replaceVars($data, $parameters, "/");
|
111 |
+
break;
|
112 |
+
case "dotprefix":
|
113 |
+
// Dot separated data. Bare values only.
|
114 |
+
$prefix = ".";
|
115 |
+
$prefix_on_missing = true;
|
116 |
+
$data = $this->replaceVars($data, $parameters, ".");
|
117 |
+
break;
|
118 |
+
case "semicolon":
|
119 |
+
// Semicolon prefixed and separated. Uses the key name
|
120 |
+
$prefix = ";";
|
121 |
+
$data = $this->replaceVars($data, $parameters, ";", "=", false, true, false);
|
122 |
+
break;
|
123 |
+
case "form":
|
124 |
+
// Standard URL format. Uses the key name
|
125 |
+
$prefix = "?";
|
126 |
+
$data = $this->replaceVars($data, $parameters, "&", "=");
|
127 |
+
break;
|
128 |
+
case "continuation":
|
129 |
+
// Standard URL, but with leading ampersand. Uses key name.
|
130 |
+
$prefix = "&";
|
131 |
+
$data = $this->replaceVars($data, $parameters, "&", "=");
|
132 |
+
break;
|
133 |
+
}
|
134 |
+
|
135 |
+
// Add the initial prefix character if data is valid.
|
136 |
+
if ($data || ($data !== false && $prefix_on_missing)) {
|
137 |
+
$data = $prefix . $data;
|
138 |
+
}
|
139 |
+
|
140 |
+
} else {
|
141 |
+
// If no operator we replace with the defaults.
|
142 |
+
$data = $this->replaceVars($data, $parameters);
|
143 |
+
}
|
144 |
+
// This is chops out the {...} and replaces with the new section.
|
145 |
+
return substr($string, 0, $start) . $data . substr($string, $end + 1);
|
146 |
+
}
|
147 |
+
|
148 |
+
private function replaceVars(
|
149 |
+
$section,
|
150 |
+
$parameters,
|
151 |
+
$sep = ",",
|
152 |
+
$combine = null,
|
153 |
+
$reserved = false,
|
154 |
+
$tag_empty = false,
|
155 |
+
$combine_on_empty = true
|
156 |
+
) {
|
157 |
+
if (strpos($section, ",") === false) {
|
158 |
+
// If we only have a single value, we can immediately process.
|
159 |
+
return $this->combine(
|
160 |
+
$section,
|
161 |
+
$parameters,
|
162 |
+
$sep,
|
163 |
+
$combine,
|
164 |
+
$reserved,
|
165 |
+
$tag_empty,
|
166 |
+
$combine_on_empty
|
167 |
+
);
|
168 |
+
} else {
|
169 |
+
// If we have multiple values, we need to split and loop over them.
|
170 |
+
// Each is treated individually, then glued together with the
|
171 |
+
// separator character.
|
172 |
+
$vars = explode(",", $section);
|
173 |
+
return $this->combineList(
|
174 |
+
$vars,
|
175 |
+
$sep,
|
176 |
+
$parameters,
|
177 |
+
$combine,
|
178 |
+
$reserved,
|
179 |
+
false, // Never emit empty strings in multi-param replacements
|
180 |
+
$combine_on_empty
|
181 |
+
);
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
public function combine(
|
186 |
+
$key,
|
187 |
+
$parameters,
|
188 |
+
$sep,
|
189 |
+
$combine,
|
190 |
+
$reserved,
|
191 |
+
$tag_empty,
|
192 |
+
$combine_on_empty
|
193 |
+
) {
|
194 |
+
$length = false;
|
195 |
+
$explode = false;
|
196 |
+
$skip_final_combine = false;
|
197 |
+
$value = false;
|
198 |
+
|
199 |
+
// Check for length restriction.
|
200 |
+
if (strpos($key, ":") !== false) {
|
201 |
+
list($key, $length) = explode(":", $key);
|
202 |
+
}
|
203 |
+
|
204 |
+
// Check for explode parameter.
|
205 |
+
if ($key[strlen($key) - 1] == "*") {
|
206 |
+
$explode = true;
|
207 |
+
$key = substr($key, 0, -1);
|
208 |
+
$skip_final_combine = true;
|
209 |
+
}
|
210 |
+
|
211 |
+
// Define the list separator.
|
212 |
+
$list_sep = $explode ? $sep : ",";
|
213 |
+
|
214 |
+
if (isset($parameters[$key])) {
|
215 |
+
$data_type = $this->getDataType($parameters[$key]);
|
216 |
+
switch ($data_type) {
|
217 |
+
case self::TYPE_SCALAR:
|
218 |
+
$value = $this->getValue($parameters[$key], $length);
|
219 |
+
break;
|
220 |
+
case self::TYPE_LIST:
|
221 |
+
$values = array();
|
222 |
+
foreach ($parameters[$key] as $pkey => $pvalue) {
|
223 |
+
$pvalue = $this->getValue($pvalue, $length);
|
224 |
+
if ($combine && $explode) {
|
225 |
+
$values[$pkey] = $key . $combine . $pvalue;
|
226 |
+
} else {
|
227 |
+
$values[$pkey] = $pvalue;
|
228 |
+
}
|
229 |
+
}
|
230 |
+
$value = implode($list_sep, $values);
|
231 |
+
if ($value == '') {
|
232 |
+
return '';
|
233 |
+
}
|
234 |
+
break;
|
235 |
+
case self::TYPE_MAP:
|
236 |
+
$values = array();
|
237 |
+
foreach ($parameters[$key] as $pkey => $pvalue) {
|
238 |
+
$pvalue = $this->getValue($pvalue, $length);
|
239 |
+
if ($explode) {
|
240 |
+
$pkey = $this->getValue($pkey, $length);
|
241 |
+
$values[] = $pkey . "=" . $pvalue; // Explode triggers = combine.
|
242 |
+
} else {
|
243 |
+
$values[] = $pkey;
|
244 |
+
$values[] = $pvalue;
|
245 |
+
}
|
246 |
+
}
|
247 |
+
$value = implode($list_sep, $values);
|
248 |
+
if ($value == '') {
|
249 |
+
return false;
|
250 |
+
}
|
251 |
+
break;
|
252 |
+
}
|
253 |
+
} else if ($tag_empty) {
|
254 |
+
// If we are just indicating empty values with their key name, return that.
|
255 |
+
return $key;
|
256 |
+
} else {
|
257 |
+
// Otherwise we can skip this variable due to not being defined.
|
258 |
+
return false;
|
259 |
+
}
|
260 |
+
|
261 |
+
if ($reserved) {
|
262 |
+
$value = str_replace($this->reservedEncoded, $this->reserved, $value);
|
263 |
+
}
|
264 |
+
|
265 |
+
// If we do not need to include the key name, we just return the raw
|
266 |
+
// value.
|
267 |
+
if (!$combine || $skip_final_combine) {
|
268 |
+
return $value;
|
269 |
+
}
|
270 |
+
|
271 |
+
// Else we combine the key name: foo=bar, if value is not the empty string.
|
272 |
+
return $key . ($value != '' || $combine_on_empty ? $combine . $value : '');
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Return the type of a passed in value
|
277 |
+
*/
|
278 |
+
private function getDataType($data)
|
279 |
+
{
|
280 |
+
if (is_array($data)) {
|
281 |
+
reset($data);
|
282 |
+
if (key($data) !== 0) {
|
283 |
+
return self::TYPE_MAP;
|
284 |
+
}
|
285 |
+
return self::TYPE_LIST;
|
286 |
+
}
|
287 |
+
return self::TYPE_SCALAR;
|
288 |
+
}
|
289 |
+
|
290 |
+
/**
|
291 |
+
* Utility function that merges multiple combine calls
|
292 |
+
* for multi-key templates.
|
293 |
+
*/
|
294 |
+
private function combineList(
|
295 |
+
$vars,
|
296 |
+
$sep,
|
297 |
+
$parameters,
|
298 |
+
$combine,
|
299 |
+
$reserved,
|
300 |
+
$tag_empty,
|
301 |
+
$combine_on_empty
|
302 |
+
) {
|
303 |
+
$ret = array();
|
304 |
+
foreach ($vars as $var) {
|
305 |
+
$response = $this->combine(
|
306 |
+
$var,
|
307 |
+
$parameters,
|
308 |
+
$sep,
|
309 |
+
$combine,
|
310 |
+
$reserved,
|
311 |
+
$tag_empty,
|
312 |
+
$combine_on_empty
|
313 |
+
);
|
314 |
+
if ($response === false) {
|
315 |
+
continue;
|
316 |
+
}
|
317 |
+
$ret[] = $response;
|
318 |
+
}
|
319 |
+
return implode($sep, $ret);
|
320 |
+
}
|
321 |
+
|
322 |
+
/**
|
323 |
+
* Utility function to encode and trim values
|
324 |
+
*/
|
325 |
+
private function getValue($value, $length)
|
326 |
+
{
|
327 |
+
if ($length) {
|
328 |
+
$value = substr($value, 0, $length);
|
329 |
+
}
|
330 |
+
$value = rawurlencode($value);
|
331 |
+
return $value;
|
332 |
+
}
|
333 |
+
}
|
google/src/Google/autoload.php
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* THIS FILE IS FOR BACKWARDS COMPATIBLITY ONLY
|
5 |
-
*
|
6 |
-
* If you were not already including this file in your project, please ignore it
|
7 |
-
*/
|
8 |
-
|
9 |
-
$file = __DIR__ . '/../../vendor/autoload.php';
|
10 |
-
|
11 |
-
if (!file_exists($file)) {
|
12 |
-
$exception = 'This library must be installed via composer or by downloading the full package.';
|
13 |
-
$exception .= ' See the instructions at https://github.com/google/google-api-php-client#installation.';
|
14 |
-
throw new Exception($exception);
|
15 |
-
}
|
16 |
-
|
17 |
-
$error = 'google-api-php-client\'s autoloader was moved to vendor/autoload.php in 2.0.0. This ';
|
18 |
-
$error .= 'redirect will be removed in 2.1. Please adjust your code to use the new location.';
|
19 |
-
trigger_error($error, E_USER_DEPRECATED);
|
20 |
-
|
21 |
-
require_once $file;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* THIS FILE IS FOR BACKWARDS COMPATIBLITY ONLY
|
5 |
+
*
|
6 |
+
* If you were not already including this file in your project, please ignore it
|
7 |
+
*/
|
8 |
+
|
9 |
+
$file = __DIR__ . '/../../vendor/autoload.php';
|
10 |
+
|
11 |
+
if (!file_exists($file)) {
|
12 |
+
$exception = 'This library must be installed via composer or by downloading the full package.';
|
13 |
+
$exception .= ' See the instructions at https://github.com/google/google-api-php-client#installation.';
|
14 |
+
throw new Exception($exception);
|
15 |
+
}
|
16 |
+
|
17 |
+
$error = 'google-api-php-client\'s autoloader was moved to vendor/autoload.php in 2.0.0. This ';
|
18 |
+
$error .= 'redirect will be removed in 2.1. Please adjust your code to use the new location.';
|
19 |
+
trigger_error($error, E_USER_DEPRECATED);
|
20 |
+
|
21 |
+
require_once $file;
|
google/vendor/autoload.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload.php @generated by Composer
|
4 |
-
|
5 |
-
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
-
|
7 |
-
return ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1::getLoader();
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1::getLoader();
|
google/vendor/composer/ClassLoader.php
CHANGED
@@ -1,445 +1,445 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* This file is part of Composer.
|
5 |
-
*
|
6 |
-
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
-
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
-
*
|
9 |
-
* For the full copyright and license information, please view the LICENSE
|
10 |
-
* file that was distributed with this source code.
|
11 |
-
*/
|
12 |
-
|
13 |
-
namespace Composer\Autoload;
|
14 |
-
|
15 |
-
/**
|
16 |
-
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
-
*
|
18 |
-
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
-
*
|
20 |
-
* // register classes with namespaces
|
21 |
-
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
-
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
-
*
|
24 |
-
* // activate the autoloader
|
25 |
-
* $loader->register();
|
26 |
-
*
|
27 |
-
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
-
* $loader->setUseIncludePath(true);
|
29 |
-
*
|
30 |
-
* In this example, if you try to use a class in the Symfony\Component
|
31 |
-
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
-
* the autoloader will first look for the class under the component/
|
33 |
-
* directory, and it will then fallback to the framework/ directory if not
|
34 |
-
* found before giving up.
|
35 |
-
*
|
36 |
-
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
-
*
|
38 |
-
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
-
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
-
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
-
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
-
*/
|
43 |
-
class ClassLoader
|
44 |
-
{
|
45 |
-
// PSR-4
|
46 |
-
private $prefixLengthsPsr4 = array();
|
47 |
-
private $prefixDirsPsr4 = array();
|
48 |
-
private $fallbackDirsPsr4 = array();
|
49 |
-
|
50 |
-
// PSR-0
|
51 |
-
private $prefixesPsr0 = array();
|
52 |
-
private $fallbackDirsPsr0 = array();
|
53 |
-
|
54 |
-
private $useIncludePath = false;
|
55 |
-
private $classMap = array();
|
56 |
-
private $classMapAuthoritative = false;
|
57 |
-
private $missingClasses = array();
|
58 |
-
private $apcuPrefix;
|
59 |
-
|
60 |
-
public function getPrefixes()
|
61 |
-
{
|
62 |
-
if (!empty($this->prefixesPsr0)) {
|
63 |
-
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
-
}
|
65 |
-
|
66 |
-
return array();
|
67 |
-
}
|
68 |
-
|
69 |
-
public function getPrefixesPsr4()
|
70 |
-
{
|
71 |
-
return $this->prefixDirsPsr4;
|
72 |
-
}
|
73 |
-
|
74 |
-
public function getFallbackDirs()
|
75 |
-
{
|
76 |
-
return $this->fallbackDirsPsr0;
|
77 |
-
}
|
78 |
-
|
79 |
-
public function getFallbackDirsPsr4()
|
80 |
-
{
|
81 |
-
return $this->fallbackDirsPsr4;
|
82 |
-
}
|
83 |
-
|
84 |
-
public function getClassMap()
|
85 |
-
{
|
86 |
-
return $this->classMap;
|
87 |
-
}
|
88 |
-
|
89 |
-
/**
|
90 |
-
* @param array $classMap Class to filename map
|
91 |
-
*/
|
92 |
-
public function addClassMap(array $classMap)
|
93 |
-
{
|
94 |
-
if ($this->classMap) {
|
95 |
-
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
-
} else {
|
97 |
-
$this->classMap = $classMap;
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
-
* appending or prepending to the ones previously set for this prefix.
|
104 |
-
*
|
105 |
-
* @param string $prefix The prefix
|
106 |
-
* @param array|string $paths The PSR-0 root directories
|
107 |
-
* @param bool $prepend Whether to prepend the directories
|
108 |
-
*/
|
109 |
-
public function add($prefix, $paths, $prepend = false)
|
110 |
-
{
|
111 |
-
if (!$prefix) {
|
112 |
-
if ($prepend) {
|
113 |
-
$this->fallbackDirsPsr0 = array_merge(
|
114 |
-
(array) $paths,
|
115 |
-
$this->fallbackDirsPsr0
|
116 |
-
);
|
117 |
-
} else {
|
118 |
-
$this->fallbackDirsPsr0 = array_merge(
|
119 |
-
$this->fallbackDirsPsr0,
|
120 |
-
(array) $paths
|
121 |
-
);
|
122 |
-
}
|
123 |
-
|
124 |
-
return;
|
125 |
-
}
|
126 |
-
|
127 |
-
$first = $prefix[0];
|
128 |
-
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
-
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
-
|
131 |
-
return;
|
132 |
-
}
|
133 |
-
if ($prepend) {
|
134 |
-
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
-
(array) $paths,
|
136 |
-
$this->prefixesPsr0[$first][$prefix]
|
137 |
-
);
|
138 |
-
} else {
|
139 |
-
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
-
$this->prefixesPsr0[$first][$prefix],
|
141 |
-
(array) $paths
|
142 |
-
);
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
-
* appending or prepending to the ones previously set for this namespace.
|
149 |
-
*
|
150 |
-
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
-
* @param array|string $paths The PSR-4 base directories
|
152 |
-
* @param bool $prepend Whether to prepend the directories
|
153 |
-
*
|
154 |
-
* @throws \InvalidArgumentException
|
155 |
-
*/
|
156 |
-
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
-
{
|
158 |
-
if (!$prefix) {
|
159 |
-
// Register directories for the root namespace.
|
160 |
-
if ($prepend) {
|
161 |
-
$this->fallbackDirsPsr4 = array_merge(
|
162 |
-
(array) $paths,
|
163 |
-
$this->fallbackDirsPsr4
|
164 |
-
);
|
165 |
-
} else {
|
166 |
-
$this->fallbackDirsPsr4 = array_merge(
|
167 |
-
$this->fallbackDirsPsr4,
|
168 |
-
(array) $paths
|
169 |
-
);
|
170 |
-
}
|
171 |
-
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
-
// Register directories for a new namespace.
|
173 |
-
$length = strlen($prefix);
|
174 |
-
if ('\\' !== $prefix[$length - 1]) {
|
175 |
-
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
-
}
|
177 |
-
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
-
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
-
} elseif ($prepend) {
|
180 |
-
// Prepend directories for an already registered namespace.
|
181 |
-
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
-
(array) $paths,
|
183 |
-
$this->prefixDirsPsr4[$prefix]
|
184 |
-
);
|
185 |
-
} else {
|
186 |
-
// Append directories for an already registered namespace.
|
187 |
-
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
-
$this->prefixDirsPsr4[$prefix],
|
189 |
-
(array) $paths
|
190 |
-
);
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
/**
|
195 |
-
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
-
* replacing any others previously set for this prefix.
|
197 |
-
*
|
198 |
-
* @param string $prefix The prefix
|
199 |
-
* @param array|string $paths The PSR-0 base directories
|
200 |
-
*/
|
201 |
-
public function set($prefix, $paths)
|
202 |
-
{
|
203 |
-
if (!$prefix) {
|
204 |
-
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
-
} else {
|
206 |
-
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
-
* replacing any others previously set for this namespace.
|
213 |
-
*
|
214 |
-
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
-
* @param array|string $paths The PSR-4 base directories
|
216 |
-
*
|
217 |
-
* @throws \InvalidArgumentException
|
218 |
-
*/
|
219 |
-
public function setPsr4($prefix, $paths)
|
220 |
-
{
|
221 |
-
if (!$prefix) {
|
222 |
-
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
-
} else {
|
224 |
-
$length = strlen($prefix);
|
225 |
-
if ('\\' !== $prefix[$length - 1]) {
|
226 |
-
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
-
}
|
228 |
-
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
-
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
-
}
|
231 |
-
}
|
232 |
-
|
233 |
-
/**
|
234 |
-
* Turns on searching the include path for class files.
|
235 |
-
*
|
236 |
-
* @param bool $useIncludePath
|
237 |
-
*/
|
238 |
-
public function setUseIncludePath($useIncludePath)
|
239 |
-
{
|
240 |
-
$this->useIncludePath = $useIncludePath;
|
241 |
-
}
|
242 |
-
|
243 |
-
/**
|
244 |
-
* Can be used to check if the autoloader uses the include path to check
|
245 |
-
* for classes.
|
246 |
-
*
|
247 |
-
* @return bool
|
248 |
-
*/
|
249 |
-
public function getUseIncludePath()
|
250 |
-
{
|
251 |
-
return $this->useIncludePath;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Turns off searching the prefix and fallback directories for classes
|
256 |
-
* that have not been registered with the class map.
|
257 |
-
*
|
258 |
-
* @param bool $classMapAuthoritative
|
259 |
-
*/
|
260 |
-
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
-
{
|
262 |
-
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
-
}
|
264 |
-
|
265 |
-
/**
|
266 |
-
* Should class lookup fail if not found in the current class map?
|
267 |
-
*
|
268 |
-
* @return bool
|
269 |
-
*/
|
270 |
-
public function isClassMapAuthoritative()
|
271 |
-
{
|
272 |
-
return $this->classMapAuthoritative;
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
-
*
|
278 |
-
* @param string|null $apcuPrefix
|
279 |
-
*/
|
280 |
-
public function setApcuPrefix($apcuPrefix)
|
281 |
-
{
|
282 |
-
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
-
*
|
288 |
-
* @return string|null
|
289 |
-
*/
|
290 |
-
public function getApcuPrefix()
|
291 |
-
{
|
292 |
-
return $this->apcuPrefix;
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* Registers this instance as an autoloader.
|
297 |
-
*
|
298 |
-
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
-
*/
|
300 |
-
public function register($prepend = false)
|
301 |
-
{
|
302 |
-
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
-
}
|
304 |
-
|
305 |
-
/**
|
306 |
-
* Unregisters this instance as an autoloader.
|
307 |
-
*/
|
308 |
-
public function unregister()
|
309 |
-
{
|
310 |
-
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Loads the given class or interface.
|
315 |
-
*
|
316 |
-
* @param string $class The name of the class
|
317 |
-
* @return bool|null True if loaded, null otherwise
|
318 |
-
*/
|
319 |
-
public function loadClass($class)
|
320 |
-
{
|
321 |
-
if ($file = $this->findFile($class)) {
|
322 |
-
includeFile($file);
|
323 |
-
|
324 |
-
return true;
|
325 |
-
}
|
326 |
-
}
|
327 |
-
|
328 |
-
/**
|
329 |
-
* Finds the path to the file where the class is defined.
|
330 |
-
*
|
331 |
-
* @param string $class The name of the class
|
332 |
-
*
|
333 |
-
* @return string|false The path if found, false otherwise
|
334 |
-
*/
|
335 |
-
public function findFile($class)
|
336 |
-
{
|
337 |
-
// class map lookup
|
338 |
-
if (isset($this->classMap[$class])) {
|
339 |
-
return $this->classMap[$class];
|
340 |
-
}
|
341 |
-
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
-
return false;
|
343 |
-
}
|
344 |
-
if (null !== $this->apcuPrefix) {
|
345 |
-
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
-
if ($hit) {
|
347 |
-
return $file;
|
348 |
-
}
|
349 |
-
}
|
350 |
-
|
351 |
-
$file = $this->findFileWithExtension($class, '.php');
|
352 |
-
|
353 |
-
// Search for Hack files if we are running on HHVM
|
354 |
-
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
-
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
-
}
|
357 |
-
|
358 |
-
if (null !== $this->apcuPrefix) {
|
359 |
-
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
-
}
|
361 |
-
|
362 |
-
if (false === $file) {
|
363 |
-
// Remember that this class does not exist.
|
364 |
-
$this->missingClasses[$class] = true;
|
365 |
-
}
|
366 |
-
|
367 |
-
return $file;
|
368 |
-
}
|
369 |
-
|
370 |
-
private function findFileWithExtension($class, $ext)
|
371 |
-
{
|
372 |
-
// PSR-4 lookup
|
373 |
-
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
-
|
375 |
-
$first = $class[0];
|
376 |
-
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
-
$subPath = $class;
|
378 |
-
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
-
$subPath = substr($subPath, 0, $lastPos);
|
380 |
-
$search = $subPath.'\\';
|
381 |
-
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
-
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
383 |
-
$length = $this->prefixLengthsPsr4[$first][$search];
|
384 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
385 |
-
return $file;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
}
|
389 |
-
}
|
390 |
-
}
|
391 |
-
|
392 |
-
// PSR-4 fallback dirs
|
393 |
-
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
-
return $file;
|
396 |
-
}
|
397 |
-
}
|
398 |
-
|
399 |
-
// PSR-0 lookup
|
400 |
-
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
-
// namespaced class name
|
402 |
-
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
-
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
-
} else {
|
405 |
-
// PEAR-like class name
|
406 |
-
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
-
}
|
408 |
-
|
409 |
-
if (isset($this->prefixesPsr0[$first])) {
|
410 |
-
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
-
if (0 === strpos($class, $prefix)) {
|
412 |
-
foreach ($dirs as $dir) {
|
413 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
-
return $file;
|
415 |
-
}
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
}
|
420 |
-
|
421 |
-
// PSR-0 fallback dirs
|
422 |
-
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
-
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
-
return $file;
|
425 |
-
}
|
426 |
-
}
|
427 |
-
|
428 |
-
// PSR-0 include paths.
|
429 |
-
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
-
return $file;
|
431 |
-
}
|
432 |
-
|
433 |
-
return false;
|
434 |
-
}
|
435 |
-
}
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Scope isolated include.
|
439 |
-
*
|
440 |
-
* Prevents access to $this/self from included files.
|
441 |
-
*/
|
442 |
-
function includeFile($file)
|
443 |
-
{
|
444 |
-
include $file;
|
445 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
private $classMapAuthoritative = false;
|
57 |
+
private $missingClasses = array();
|
58 |
+
private $apcuPrefix;
|
59 |
+
|
60 |
+
public function getPrefixes()
|
61 |
+
{
|
62 |
+
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
+
}
|
65 |
+
|
66 |
+
return array();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixesPsr4()
|
70 |
+
{
|
71 |
+
return $this->prefixDirsPsr4;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFallbackDirs()
|
75 |
+
{
|
76 |
+
return $this->fallbackDirsPsr0;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getFallbackDirsPsr4()
|
80 |
+
{
|
81 |
+
return $this->fallbackDirsPsr4;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getClassMap()
|
85 |
+
{
|
86 |
+
return $this->classMap;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $classMap Class to filename map
|
91 |
+
*/
|
92 |
+
public function addClassMap(array $classMap)
|
93 |
+
{
|
94 |
+
if ($this->classMap) {
|
95 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
+
} else {
|
97 |
+
$this->classMap = $classMap;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
+
* appending or prepending to the ones previously set for this prefix.
|
104 |
+
*
|
105 |
+
* @param string $prefix The prefix
|
106 |
+
* @param array|string $paths The PSR-0 root directories
|
107 |
+
* @param bool $prepend Whether to prepend the directories
|
108 |
+
*/
|
109 |
+
public function add($prefix, $paths, $prepend = false)
|
110 |
+
{
|
111 |
+
if (!$prefix) {
|
112 |
+
if ($prepend) {
|
113 |
+
$this->fallbackDirsPsr0 = array_merge(
|
114 |
+
(array) $paths,
|
115 |
+
$this->fallbackDirsPsr0
|
116 |
+
);
|
117 |
+
} else {
|
118 |
+
$this->fallbackDirsPsr0 = array_merge(
|
119 |
+
$this->fallbackDirsPsr0,
|
120 |
+
(array) $paths
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$first = $prefix[0];
|
128 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
+
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
if ($prepend) {
|
134 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
+
(array) $paths,
|
136 |
+
$this->prefixesPsr0[$first][$prefix]
|
137 |
+
);
|
138 |
+
} else {
|
139 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
+
$this->prefixesPsr0[$first][$prefix],
|
141 |
+
(array) $paths
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
+
* appending or prepending to the ones previously set for this namespace.
|
149 |
+
*
|
150 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
+
* @param array|string $paths The PSR-4 base directories
|
152 |
+
* @param bool $prepend Whether to prepend the directories
|
153 |
+
*
|
154 |
+
* @throws \InvalidArgumentException
|
155 |
+
*/
|
156 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
+
{
|
158 |
+
if (!$prefix) {
|
159 |
+
// Register directories for the root namespace.
|
160 |
+
if ($prepend) {
|
161 |
+
$this->fallbackDirsPsr4 = array_merge(
|
162 |
+
(array) $paths,
|
163 |
+
$this->fallbackDirsPsr4
|
164 |
+
);
|
165 |
+
} else {
|
166 |
+
$this->fallbackDirsPsr4 = array_merge(
|
167 |
+
$this->fallbackDirsPsr4,
|
168 |
+
(array) $paths
|
169 |
+
);
|
170 |
+
}
|
171 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
+
// Register directories for a new namespace.
|
173 |
+
$length = strlen($prefix);
|
174 |
+
if ('\\' !== $prefix[$length - 1]) {
|
175 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
+
}
|
177 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
+
} elseif ($prepend) {
|
180 |
+
// Prepend directories for an already registered namespace.
|
181 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
+
(array) $paths,
|
183 |
+
$this->prefixDirsPsr4[$prefix]
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
// Append directories for an already registered namespace.
|
187 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
+
$this->prefixDirsPsr4[$prefix],
|
189 |
+
(array) $paths
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
+
* replacing any others previously set for this prefix.
|
197 |
+
*
|
198 |
+
* @param string $prefix The prefix
|
199 |
+
* @param array|string $paths The PSR-0 base directories
|
200 |
+
*/
|
201 |
+
public function set($prefix, $paths)
|
202 |
+
{
|
203 |
+
if (!$prefix) {
|
204 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
+
} else {
|
206 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
+
* replacing any others previously set for this namespace.
|
213 |
+
*
|
214 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
+
* @param array|string $paths The PSR-4 base directories
|
216 |
+
*
|
217 |
+
* @throws \InvalidArgumentException
|
218 |
+
*/
|
219 |
+
public function setPsr4($prefix, $paths)
|
220 |
+
{
|
221 |
+
if (!$prefix) {
|
222 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
+
} else {
|
224 |
+
$length = strlen($prefix);
|
225 |
+
if ('\\' !== $prefix[$length - 1]) {
|
226 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
+
}
|
228 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Turns on searching the include path for class files.
|
235 |
+
*
|
236 |
+
* @param bool $useIncludePath
|
237 |
+
*/
|
238 |
+
public function setUseIncludePath($useIncludePath)
|
239 |
+
{
|
240 |
+
$this->useIncludePath = $useIncludePath;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Can be used to check if the autoloader uses the include path to check
|
245 |
+
* for classes.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function getUseIncludePath()
|
250 |
+
{
|
251 |
+
return $this->useIncludePath;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Turns off searching the prefix and fallback directories for classes
|
256 |
+
* that have not been registered with the class map.
|
257 |
+
*
|
258 |
+
* @param bool $classMapAuthoritative
|
259 |
+
*/
|
260 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
+
{
|
262 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Should class lookup fail if not found in the current class map?
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
public function isClassMapAuthoritative()
|
271 |
+
{
|
272 |
+
return $this->classMapAuthoritative;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
+
*
|
278 |
+
* @param string|null $apcuPrefix
|
279 |
+
*/
|
280 |
+
public function setApcuPrefix($apcuPrefix)
|
281 |
+
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
+
*
|
288 |
+
* @return string|null
|
289 |
+
*/
|
290 |
+
public function getApcuPrefix()
|
291 |
+
{
|
292 |
+
return $this->apcuPrefix;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Registers this instance as an autoloader.
|
297 |
+
*
|
298 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
+
*/
|
300 |
+
public function register($prepend = false)
|
301 |
+
{
|
302 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Unregisters this instance as an autoloader.
|
307 |
+
*/
|
308 |
+
public function unregister()
|
309 |
+
{
|
310 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads the given class or interface.
|
315 |
+
*
|
316 |
+
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
+
*/
|
319 |
+
public function loadClass($class)
|
320 |
+
{
|
321 |
+
if ($file = $this->findFile($class)) {
|
322 |
+
includeFile($file);
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Finds the path to the file where the class is defined.
|
330 |
+
*
|
331 |
+
* @param string $class The name of the class
|
332 |
+
*
|
333 |
+
* @return string|false The path if found, false otherwise
|
334 |
+
*/
|
335 |
+
public function findFile($class)
|
336 |
+
{
|
337 |
+
// class map lookup
|
338 |
+
if (isset($this->classMap[$class])) {
|
339 |
+
return $this->classMap[$class];
|
340 |
+
}
|
341 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (null !== $this->apcuPrefix) {
|
345 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
+
if ($hit) {
|
347 |
+
return $file;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
$file = $this->findFileWithExtension($class, '.php');
|
352 |
+
|
353 |
+
// Search for Hack files if we are running on HHVM
|
354 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
+
}
|
357 |
+
|
358 |
+
if (null !== $this->apcuPrefix) {
|
359 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
+
}
|
361 |
+
|
362 |
+
if (false === $file) {
|
363 |
+
// Remember that this class does not exist.
|
364 |
+
$this->missingClasses[$class] = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
return $file;
|
368 |
+
}
|
369 |
+
|
370 |
+
private function findFileWithExtension($class, $ext)
|
371 |
+
{
|
372 |
+
// PSR-4 lookup
|
373 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
+
|
375 |
+
$first = $class[0];
|
376 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
+
$subPath = $class;
|
378 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
+
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath.'\\';
|
381 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
383 |
+
$length = $this->prefixLengthsPsr4[$first][$search];
|
384 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
385 |
+
return $file;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// PSR-4 fallback dirs
|
393 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
+
return $file;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// PSR-0 lookup
|
400 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
+
// namespaced class name
|
402 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
+
} else {
|
405 |
+
// PEAR-like class name
|
406 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (isset($this->prefixesPsr0[$first])) {
|
410 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
+
if (0 === strpos($class, $prefix)) {
|
412 |
+
foreach ($dirs as $dir) {
|
413 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
+
return $file;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
// PSR-0 fallback dirs
|
422 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
+
return $file;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-0 include paths.
|
429 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
+
return $file;
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Scope isolated include.
|
439 |
+
*
|
440 |
+
* Prevents access to $this/self from included files.
|
441 |
+
*/
|
442 |
+
function includeFile($file)
|
443 |
+
{
|
444 |
+
include $file;
|
445 |
+
}
|
google/vendor/composer/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
|
2 |
-
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
-
|
4 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
-
of this software and associated documentation files (the "Software"), to deal
|
6 |
-
in the Software without restriction, including without limitation the rights
|
7 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
-
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
-
to do so, subject to the following conditions:
|
10 |
-
|
11 |
-
The above copyright notice and this permission notice shall be included in all
|
12 |
-
copies or substantial portions of the Software.
|
13 |
-
|
14 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
-
THE SOFTWARE.
|
21 |
-
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
google/vendor/composer/autoload_classmap.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_classmap.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'BeforeValidException' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/BeforeValidException.php',
|
10 |
-
'ExpiredException' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/ExpiredException.php',
|
11 |
-
'Google\\Auth\\ApplicationDefaultCredentials' => $vendorDir . '/google/auth/src/ApplicationDefaultCredentials.php',
|
12 |
-
'Google\\Auth\\CacheTrait' => $vendorDir . '/google/auth/src/CacheTrait.php',
|
13 |
-
'Google\\Auth\\Cache\\InvalidArgumentException' => $vendorDir . '/google/auth/src/Cache/InvalidArgumentException.php',
|
14 |
-
'Google\\Auth\\Cache\\Item' => $vendorDir . '/google/auth/src/Cache/Item.php',
|
15 |
-
'Google\\Auth\\Cache\\MemoryCacheItemPool' => $vendorDir . '/google/auth/src/Cache/MemoryCacheItemPool.php',
|
16 |
-
'Google\\Auth\\CredentialsLoader' => $vendorDir . '/google/auth/src/CredentialsLoader.php',
|
17 |
-
'Google\\Auth\\Credentials\\AppIdentityCredentials' => $vendorDir . '/google/auth/src/Credentials/AppIdentityCredentials.php',
|
18 |
-
'Google\\Auth\\Credentials\\GCECredentials' => $vendorDir . '/google/auth/src/Credentials/GCECredentials.php',
|
19 |
-
'Google\\Auth\\Credentials\\IAMCredentials' => $vendorDir . '/google/auth/src/Credentials/IAMCredentials.php',
|
20 |
-
'Google\\Auth\\Credentials\\ServiceAccountCredentials' => $vendorDir . '/google/auth/src/Credentials/ServiceAccountCredentials.php',
|
21 |
-
'Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => $vendorDir . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php',
|
22 |
-
'Google\\Auth\\Credentials\\UserRefreshCredentials' => $vendorDir . '/google/auth/src/Credentials/UserRefreshCredentials.php',
|
23 |
-
'Google\\Auth\\FetchAuthTokenCache' => $vendorDir . '/google/auth/src/FetchAuthTokenCache.php',
|
24 |
-
'Google\\Auth\\FetchAuthTokenInterface' => $vendorDir . '/google/auth/src/FetchAuthTokenInterface.php',
|
25 |
-
'Google\\Auth\\HttpHandler\\Guzzle5HttpHandler' => $vendorDir . '/google/auth/src/HttpHandler/Guzzle5HttpHandler.php',
|
26 |
-
'Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => $vendorDir . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php',
|
27 |
-
'Google\\Auth\\HttpHandler\\HttpHandlerFactory' => $vendorDir . '/google/auth/src/HttpHandler/HttpHandlerFactory.php',
|
28 |
-
'Google\\Auth\\Middleware\\AuthTokenMiddleware' => $vendorDir . '/google/auth/src/Middleware/AuthTokenMiddleware.php',
|
29 |
-
'Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => $vendorDir . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php',
|
30 |
-
'Google\\Auth\\Middleware\\SimpleMiddleware' => $vendorDir . '/google/auth/src/Middleware/SimpleMiddleware.php',
|
31 |
-
'Google\\Auth\\OAuth2' => $vendorDir . '/google/auth/src/OAuth2.php',
|
32 |
-
'Google\\Auth\\Subscriber\\AuthTokenSubscriber' => $vendorDir . '/google/auth/src/Subscriber/AuthTokenSubscriber.php',
|
33 |
-
'Google\\Auth\\Subscriber\\ScopedAccessTokenSubscriber' => $vendorDir . '/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php',
|
34 |
-
'Google\\Auth\\Subscriber\\SimpleSubscriber' => $vendorDir . '/google/auth/src/Subscriber/SimpleSubscriber.php',
|
35 |
-
'Google_Service_Exception' => $baseDir . '/src/Google/Service/Exception.php',
|
36 |
-
'Google_Service_Resource' => $baseDir . '/src/Google/Service/Resource.php',
|
37 |
-
'JWT' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php',
|
38 |
-
'SignatureInvalidException' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/SignatureInvalidException.php',
|
39 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'BeforeValidException' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/BeforeValidException.php',
|
10 |
+
'ExpiredException' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/ExpiredException.php',
|
11 |
+
'Google\\Auth\\ApplicationDefaultCredentials' => $vendorDir . '/google/auth/src/ApplicationDefaultCredentials.php',
|
12 |
+
'Google\\Auth\\CacheTrait' => $vendorDir . '/google/auth/src/CacheTrait.php',
|
13 |
+
'Google\\Auth\\Cache\\InvalidArgumentException' => $vendorDir . '/google/auth/src/Cache/InvalidArgumentException.php',
|
14 |
+
'Google\\Auth\\Cache\\Item' => $vendorDir . '/google/auth/src/Cache/Item.php',
|
15 |
+
'Google\\Auth\\Cache\\MemoryCacheItemPool' => $vendorDir . '/google/auth/src/Cache/MemoryCacheItemPool.php',
|
16 |
+
'Google\\Auth\\CredentialsLoader' => $vendorDir . '/google/auth/src/CredentialsLoader.php',
|
17 |
+
'Google\\Auth\\Credentials\\AppIdentityCredentials' => $vendorDir . '/google/auth/src/Credentials/AppIdentityCredentials.php',
|
18 |
+
'Google\\Auth\\Credentials\\GCECredentials' => $vendorDir . '/google/auth/src/Credentials/GCECredentials.php',
|
19 |
+
'Google\\Auth\\Credentials\\IAMCredentials' => $vendorDir . '/google/auth/src/Credentials/IAMCredentials.php',
|
20 |
+
'Google\\Auth\\Credentials\\ServiceAccountCredentials' => $vendorDir . '/google/auth/src/Credentials/ServiceAccountCredentials.php',
|
21 |
+
'Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => $vendorDir . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php',
|
22 |
+
'Google\\Auth\\Credentials\\UserRefreshCredentials' => $vendorDir . '/google/auth/src/Credentials/UserRefreshCredentials.php',
|
23 |
+
'Google\\Auth\\FetchAuthTokenCache' => $vendorDir . '/google/auth/src/FetchAuthTokenCache.php',
|
24 |
+
'Google\\Auth\\FetchAuthTokenInterface' => $vendorDir . '/google/auth/src/FetchAuthTokenInterface.php',
|
25 |
+
'Google\\Auth\\HttpHandler\\Guzzle5HttpHandler' => $vendorDir . '/google/auth/src/HttpHandler/Guzzle5HttpHandler.php',
|
26 |
+
'Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => $vendorDir . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php',
|
27 |
+
'Google\\Auth\\HttpHandler\\HttpHandlerFactory' => $vendorDir . '/google/auth/src/HttpHandler/HttpHandlerFactory.php',
|
28 |
+
'Google\\Auth\\Middleware\\AuthTokenMiddleware' => $vendorDir . '/google/auth/src/Middleware/AuthTokenMiddleware.php',
|
29 |
+
'Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => $vendorDir . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php',
|
30 |
+
'Google\\Auth\\Middleware\\SimpleMiddleware' => $vendorDir . '/google/auth/src/Middleware/SimpleMiddleware.php',
|
31 |
+
'Google\\Auth\\OAuth2' => $vendorDir . '/google/auth/src/OAuth2.php',
|
32 |
+
'Google\\Auth\\Subscriber\\AuthTokenSubscriber' => $vendorDir . '/google/auth/src/Subscriber/AuthTokenSubscriber.php',
|
33 |
+
'Google\\Auth\\Subscriber\\ScopedAccessTokenSubscriber' => $vendorDir . '/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php',
|
34 |
+
'Google\\Auth\\Subscriber\\SimpleSubscriber' => $vendorDir . '/google/auth/src/Subscriber/SimpleSubscriber.php',
|
35 |
+
'Google_Service_Exception' => $baseDir . '/src/Google/Service/Exception.php',
|
36 |
+
'Google_Service_Resource' => $baseDir . '/src/Google/Service/Resource.php',
|
37 |
+
'JWT' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php',
|
38 |
+
'SignatureInvalidException' => $vendorDir . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/SignatureInvalidException.php',
|
39 |
+
);
|
google/vendor/composer/autoload_files.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_files.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'e7ef766f7bcc15ba09cd6308370a95d7' => $vendorDir . '/react/promise/src/React/Promise/functions.php',
|
10 |
-
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
|
11 |
-
'3919eeb97e98d4648304477f8ef734ba' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
|
12 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_files.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'e7ef766f7bcc15ba09cd6308370a95d7' => $vendorDir . '/react/promise/src/React/Promise/functions.php',
|
10 |
+
'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
|
11 |
+
'3919eeb97e98d4648304477f8ef734ba' => $vendorDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
|
12 |
+
);
|
google/vendor/composer/autoload_namespaces.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_namespaces.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'System' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
10 |
-
'React\\Promise' => array($vendorDir . '/react/promise/src'),
|
11 |
-
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
|
12 |
-
'Net' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
13 |
-
'Math' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
14 |
-
'Google_Service_' => array($vendorDir . '/google/apiclient-services/src'),
|
15 |
-
'Google_' => array($baseDir . '/src'),
|
16 |
-
'File' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
17 |
-
'Crypt' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
18 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'System' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
10 |
+
'React\\Promise' => array($vendorDir . '/react/promise/src'),
|
11 |
+
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
|
12 |
+
'Net' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
13 |
+
'Math' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
14 |
+
'Google_Service_' => array($vendorDir . '/google/apiclient-services/src'),
|
15 |
+
'Google_' => array($baseDir . '/src'),
|
16 |
+
'File' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
17 |
+
'Crypt' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'),
|
18 |
+
);
|
google/vendor/composer/autoload_psr4.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_psr4.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
|
10 |
-
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
11 |
-
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
|
12 |
-
'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'),
|
13 |
-
'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'),
|
14 |
-
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
15 |
-
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
16 |
-
'Google\\Auth\\' => array($vendorDir . '/google/auth/src'),
|
17 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
|
10 |
+
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
11 |
+
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
|
12 |
+
'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'),
|
13 |
+
'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'),
|
14 |
+
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
15 |
+
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
16 |
+
'Google\\Auth\\' => array($vendorDir . '/google/auth/src'),
|
17 |
+
);
|
google/vendor/composer/autoload_real.php
CHANGED
@@ -1,74 +1,74 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_real.php @generated by Composer
|
4 |
-
|
5 |
-
class ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1
|
6 |
-
{
|
7 |
-
private static $loader;
|
8 |
-
|
9 |
-
public static function loadClassLoader($class)
|
10 |
-
{
|
11 |
-
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
-
require __DIR__ . '/ClassLoader.php';
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
public static function getLoader()
|
17 |
-
{
|
18 |
-
if (null !== self::$loader) {
|
19 |
-
return self::$loader;
|
20 |
-
}
|
21 |
-
|
22 |
-
spl_autoload_register(array('ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1', 'loadClassLoader'), true, true);
|
23 |
-
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1', 'loadClassLoader'));
|
25 |
-
|
26 |
-
$includePaths = require __DIR__ . '/include_paths.php';
|
27 |
-
array_push($includePaths, get_include_path());
|
28 |
-
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
29 |
-
|
30 |
-
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
31 |
-
if ($useStaticLoader) {
|
32 |
-
require_once __DIR__ . '/autoload_static.php';
|
33 |
-
|
34 |
-
call_user_func(\Composer\Autoload\ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::getInitializer($loader));
|
35 |
-
} else {
|
36 |
-
$map = require __DIR__ . '/autoload_namespaces.php';
|
37 |
-
foreach ($map as $namespace => $path) {
|
38 |
-
$loader->set($namespace, $path);
|
39 |
-
}
|
40 |
-
|
41 |
-
$map = require __DIR__ . '/autoload_psr4.php';
|
42 |
-
foreach ($map as $namespace => $path) {
|
43 |
-
$loader->setPsr4($namespace, $path);
|
44 |
-
}
|
45 |
-
|
46 |
-
$classMap = require __DIR__ . '/autoload_classmap.php';
|
47 |
-
if ($classMap) {
|
48 |
-
$loader->addClassMap($classMap);
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
$loader->register(true);
|
53 |
-
|
54 |
-
if ($useStaticLoader) {
|
55 |
-
$includeFiles = Composer\Autoload\ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$files;
|
56 |
-
} else {
|
57 |
-
$includeFiles = require __DIR__ . '/autoload_files.php';
|
58 |
-
}
|
59 |
-
foreach ($includeFiles as $fileIdentifier => $file) {
|
60 |
-
composerRequire4bcd804d35cc650d1fb52c557725a2a1($fileIdentifier, $file);
|
61 |
-
}
|
62 |
-
|
63 |
-
return $loader;
|
64 |
-
}
|
65 |
-
}
|
66 |
-
|
67 |
-
function composerRequire4bcd804d35cc650d1fb52c557725a2a1($fileIdentifier, $file)
|
68 |
-
{
|
69 |
-
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
70 |
-
require $file;
|
71 |
-
|
72 |
-
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
73 |
-
}
|
74 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit4bcd804d35cc650d1fb52c557725a2a1', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$includePaths = require __DIR__ . '/include_paths.php';
|
27 |
+
array_push($includePaths, get_include_path());
|
28 |
+
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
29 |
+
|
30 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
31 |
+
if ($useStaticLoader) {
|
32 |
+
require_once __DIR__ . '/autoload_static.php';
|
33 |
+
|
34 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::getInitializer($loader));
|
35 |
+
} else {
|
36 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
37 |
+
foreach ($map as $namespace => $path) {
|
38 |
+
$loader->set($namespace, $path);
|
39 |
+
}
|
40 |
+
|
41 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
42 |
+
foreach ($map as $namespace => $path) {
|
43 |
+
$loader->setPsr4($namespace, $path);
|
44 |
+
}
|
45 |
+
|
46 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
47 |
+
if ($classMap) {
|
48 |
+
$loader->addClassMap($classMap);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
$loader->register(true);
|
53 |
+
|
54 |
+
if ($useStaticLoader) {
|
55 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$files;
|
56 |
+
} else {
|
57 |
+
$includeFiles = require __DIR__ . '/autoload_files.php';
|
58 |
+
}
|
59 |
+
foreach ($includeFiles as $fileIdentifier => $file) {
|
60 |
+
composerRequire4bcd804d35cc650d1fb52c557725a2a1($fileIdentifier, $file);
|
61 |
+
}
|
62 |
+
|
63 |
+
return $loader;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
|
67 |
+
function composerRequire4bcd804d35cc650d1fb52c557725a2a1($fileIdentifier, $file)
|
68 |
+
{
|
69 |
+
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
70 |
+
require $file;
|
71 |
+
|
72 |
+
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
73 |
+
}
|
74 |
+
}
|
google/vendor/composer/autoload_static.php
CHANGED
@@ -1,176 +1,176 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// autoload_static.php @generated by Composer
|
4 |
-
|
5 |
-
namespace Composer\Autoload;
|
6 |
-
|
7 |
-
class ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1
|
8 |
-
{
|
9 |
-
public static $files = array (
|
10 |
-
'e7ef766f7bcc15ba09cd6308370a95d7' => __DIR__ . '/..' . '/react/promise/src/React/Promise/functions.php',
|
11 |
-
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
12 |
-
'3919eeb97e98d4648304477f8ef734ba' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
|
13 |
-
);
|
14 |
-
|
15 |
-
public static $prefixLengthsPsr4 = array (
|
16 |
-
'P' =>
|
17 |
-
array (
|
18 |
-
'Psr\\Http\\Message\\' => 17,
|
19 |
-
'Psr\\Cache\\' => 10,
|
20 |
-
),
|
21 |
-
'M' =>
|
22 |
-
array (
|
23 |
-
'Monolog\\' => 8,
|
24 |
-
),
|
25 |
-
'G' =>
|
26 |
-
array (
|
27 |
-
'GuzzleHttp\\Stream\\' => 18,
|
28 |
-
'GuzzleHttp\\Ring\\' => 16,
|
29 |
-
'GuzzleHttp\\Psr7\\' => 16,
|
30 |
-
'GuzzleHttp\\' => 11,
|
31 |
-
'Google\\Auth\\' => 12,
|
32 |
-
),
|
33 |
-
);
|
34 |
-
|
35 |
-
public static $prefixDirsPsr4 = array (
|
36 |
-
'Psr\\Http\\Message\\' =>
|
37 |
-
array (
|
38 |
-
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
39 |
-
),
|
40 |
-
'Psr\\Cache\\' =>
|
41 |
-
array (
|
42 |
-
0 => __DIR__ . '/..' . '/psr/cache/src',
|
43 |
-
),
|
44 |
-
'Monolog\\' =>
|
45 |
-
array (
|
46 |
-
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
|
47 |
-
),
|
48 |
-
'GuzzleHttp\\Stream\\' =>
|
49 |
-
array (
|
50 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/streams/src',
|
51 |
-
),
|
52 |
-
'GuzzleHttp\\Ring\\' =>
|
53 |
-
array (
|
54 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/ringphp/src',
|
55 |
-
),
|
56 |
-
'GuzzleHttp\\Psr7\\' =>
|
57 |
-
array (
|
58 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
|
59 |
-
),
|
60 |
-
'GuzzleHttp\\' =>
|
61 |
-
array (
|
62 |
-
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
|
63 |
-
),
|
64 |
-
'Google\\Auth\\' =>
|
65 |
-
array (
|
66 |
-
0 => __DIR__ . '/..' . '/google/auth/src',
|
67 |
-
),
|
68 |
-
);
|
69 |
-
|
70 |
-
public static $prefixesPsr0 = array (
|
71 |
-
'S' =>
|
72 |
-
array (
|
73 |
-
'System' =>
|
74 |
-
array (
|
75 |
-
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
76 |
-
),
|
77 |
-
),
|
78 |
-
'R' =>
|
79 |
-
array (
|
80 |
-
'React\\Promise' =>
|
81 |
-
array (
|
82 |
-
0 => __DIR__ . '/..' . '/react/promise/src',
|
83 |
-
),
|
84 |
-
),
|
85 |
-
'P' =>
|
86 |
-
array (
|
87 |
-
'Psr\\Log\\' =>
|
88 |
-
array (
|
89 |
-
0 => __DIR__ . '/..' . '/psr/log',
|
90 |
-
),
|
91 |
-
),
|
92 |
-
'N' =>
|
93 |
-
array (
|
94 |
-
'Net' =>
|
95 |
-
array (
|
96 |
-
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
97 |
-
),
|
98 |
-
),
|
99 |
-
'M' =>
|
100 |
-
array (
|
101 |
-
'Math' =>
|
102 |
-
array (
|
103 |
-
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
104 |
-
),
|
105 |
-
),
|
106 |
-
'G' =>
|
107 |
-
array (
|
108 |
-
'Google_Service_' =>
|
109 |
-
array (
|
110 |
-
0 => __DIR__ . '/..' . '/google/apiclient-services/src',
|
111 |
-
),
|
112 |
-
'Google_' =>
|
113 |
-
array (
|
114 |
-
0 => __DIR__ . '/../..' . '/src',
|
115 |
-
),
|
116 |
-
),
|
117 |
-
'F' =>
|
118 |
-
array (
|
119 |
-
'File' =>
|
120 |
-
array (
|
121 |
-
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
122 |
-
),
|
123 |
-
),
|
124 |
-
'C' =>
|
125 |
-
array (
|
126 |
-
'Crypt' =>
|
127 |
-
array (
|
128 |
-
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
129 |
-
),
|
130 |
-
),
|
131 |
-
);
|
132 |
-
|
133 |
-
public static $classMap = array (
|
134 |
-
'BeforeValidException' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/BeforeValidException.php',
|
135 |
-
'ExpiredException' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/ExpiredException.php',
|
136 |
-
'Google\\Auth\\ApplicationDefaultCredentials' => __DIR__ . '/..' . '/google/auth/src/ApplicationDefaultCredentials.php',
|
137 |
-
'Google\\Auth\\CacheTrait' => __DIR__ . '/..' . '/google/auth/src/CacheTrait.php',
|
138 |
-
'Google\\Auth\\Cache\\InvalidArgumentException' => __DIR__ . '/..' . '/google/auth/src/Cache/InvalidArgumentException.php',
|
139 |
-
'Google\\Auth\\Cache\\Item' => __DIR__ . '/..' . '/google/auth/src/Cache/Item.php',
|
140 |
-
'Google\\Auth\\Cache\\MemoryCacheItemPool' => __DIR__ . '/..' . '/google/auth/src/Cache/MemoryCacheItemPool.php',
|
141 |
-
'Google\\Auth\\CredentialsLoader' => __DIR__ . '/..' . '/google/auth/src/CredentialsLoader.php',
|
142 |
-
'Google\\Auth\\Credentials\\AppIdentityCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/AppIdentityCredentials.php',
|
143 |
-
'Google\\Auth\\Credentials\\GCECredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/GCECredentials.php',
|
144 |
-
'Google\\Auth\\Credentials\\IAMCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/IAMCredentials.php',
|
145 |
-
'Google\\Auth\\Credentials\\ServiceAccountCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/ServiceAccountCredentials.php',
|
146 |
-
'Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php',
|
147 |
-
'Google\\Auth\\Credentials\\UserRefreshCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/UserRefreshCredentials.php',
|
148 |
-
'Google\\Auth\\FetchAuthTokenCache' => __DIR__ . '/..' . '/google/auth/src/FetchAuthTokenCache.php',
|
149 |
-
'Google\\Auth\\FetchAuthTokenInterface' => __DIR__ . '/..' . '/google/auth/src/FetchAuthTokenInterface.php',
|
150 |
-
'Google\\Auth\\HttpHandler\\Guzzle5HttpHandler' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/Guzzle5HttpHandler.php',
|
151 |
-
'Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php',
|
152 |
-
'Google\\Auth\\HttpHandler\\HttpHandlerFactory' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/HttpHandlerFactory.php',
|
153 |
-
'Google\\Auth\\Middleware\\AuthTokenMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/AuthTokenMiddleware.php',
|
154 |
-
'Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php',
|
155 |
-
'Google\\Auth\\Middleware\\SimpleMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/SimpleMiddleware.php',
|
156 |
-
'Google\\Auth\\OAuth2' => __DIR__ . '/..' . '/google/auth/src/OAuth2.php',
|
157 |
-
'Google\\Auth\\Subscriber\\AuthTokenSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/AuthTokenSubscriber.php',
|
158 |
-
'Google\\Auth\\Subscriber\\ScopedAccessTokenSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php',
|
159 |
-
'Google\\Auth\\Subscriber\\SimpleSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/SimpleSubscriber.php',
|
160 |
-
'Google_Service_Exception' => __DIR__ . '/../..' . '/src/Google/Service/Exception.php',
|
161 |
-
'Google_Service_Resource' => __DIR__ . '/../..' . '/src/Google/Service/Resource.php',
|
162 |
-
'JWT' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php',
|
163 |
-
'SignatureInvalidException' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/SignatureInvalidException.php',
|
164 |
-
);
|
165 |
-
|
166 |
-
public static function getInitializer(ClassLoader $loader)
|
167 |
-
{
|
168 |
-
return \Closure::bind(function () use ($loader) {
|
169 |
-
$loader->prefixLengthsPsr4 = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$prefixLengthsPsr4;
|
170 |
-
$loader->prefixDirsPsr4 = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$prefixDirsPsr4;
|
171 |
-
$loader->prefixesPsr0 = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$prefixesPsr0;
|
172 |
-
$loader->classMap = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$classMap;
|
173 |
-
|
174 |
-
}, null, ClassLoader::class);
|
175 |
-
}
|
176 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1
|
8 |
+
{
|
9 |
+
public static $files = array (
|
10 |
+
'e7ef766f7bcc15ba09cd6308370a95d7' => __DIR__ . '/..' . '/react/promise/src/React/Promise/functions.php',
|
11 |
+
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
12 |
+
'3919eeb97e98d4648304477f8ef734ba' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php',
|
13 |
+
);
|
14 |
+
|
15 |
+
public static $prefixLengthsPsr4 = array (
|
16 |
+
'P' =>
|
17 |
+
array (
|
18 |
+
'Psr\\Http\\Message\\' => 17,
|
19 |
+
'Psr\\Cache\\' => 10,
|
20 |
+
),
|
21 |
+
'M' =>
|
22 |
+
array (
|
23 |
+
'Monolog\\' => 8,
|
24 |
+
),
|
25 |
+
'G' =>
|
26 |
+
array (
|
27 |
+
'GuzzleHttp\\Stream\\' => 18,
|
28 |
+
'GuzzleHttp\\Ring\\' => 16,
|
29 |
+
'GuzzleHttp\\Psr7\\' => 16,
|
30 |
+
'GuzzleHttp\\' => 11,
|
31 |
+
'Google\\Auth\\' => 12,
|
32 |
+
),
|
33 |
+
);
|
34 |
+
|
35 |
+
public static $prefixDirsPsr4 = array (
|
36 |
+
'Psr\\Http\\Message\\' =>
|
37 |
+
array (
|
38 |
+
0 => __DIR__ . '/..' . '/psr/http-message/src',
|
39 |
+
),
|
40 |
+
'Psr\\Cache\\' =>
|
41 |
+
array (
|
42 |
+
0 => __DIR__ . '/..' . '/psr/cache/src',
|
43 |
+
),
|
44 |
+
'Monolog\\' =>
|
45 |
+
array (
|
46 |
+
0 => __DIR__ . '/..' . '/monolog/monolog/src/Monolog',
|
47 |
+
),
|
48 |
+
'GuzzleHttp\\Stream\\' =>
|
49 |
+
array (
|
50 |
+
0 => __DIR__ . '/..' . '/guzzlehttp/streams/src',
|
51 |
+
),
|
52 |
+
'GuzzleHttp\\Ring\\' =>
|
53 |
+
array (
|
54 |
+
0 => __DIR__ . '/..' . '/guzzlehttp/ringphp/src',
|
55 |
+
),
|
56 |
+
'GuzzleHttp\\Psr7\\' =>
|
57 |
+
array (
|
58 |
+
0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src',
|
59 |
+
),
|
60 |
+
'GuzzleHttp\\' =>
|
61 |
+
array (
|
62 |
+
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
|
63 |
+
),
|
64 |
+
'Google\\Auth\\' =>
|
65 |
+
array (
|
66 |
+
0 => __DIR__ . '/..' . '/google/auth/src',
|
67 |
+
),
|
68 |
+
);
|
69 |
+
|
70 |
+
public static $prefixesPsr0 = array (
|
71 |
+
'S' =>
|
72 |
+
array (
|
73 |
+
'System' =>
|
74 |
+
array (
|
75 |
+
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
76 |
+
),
|
77 |
+
),
|
78 |
+
'R' =>
|
79 |
+
array (
|
80 |
+
'React\\Promise' =>
|
81 |
+
array (
|
82 |
+
0 => __DIR__ . '/..' . '/react/promise/src',
|
83 |
+
),
|
84 |
+
),
|
85 |
+
'P' =>
|
86 |
+
array (
|
87 |
+
'Psr\\Log\\' =>
|
88 |
+
array (
|
89 |
+
0 => __DIR__ . '/..' . '/psr/log',
|
90 |
+
),
|
91 |
+
),
|
92 |
+
'N' =>
|
93 |
+
array (
|
94 |
+
'Net' =>
|
95 |
+
array (
|
96 |
+
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
97 |
+
),
|
98 |
+
),
|
99 |
+
'M' =>
|
100 |
+
array (
|
101 |
+
'Math' =>
|
102 |
+
array (
|
103 |
+
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
104 |
+
),
|
105 |
+
),
|
106 |
+
'G' =>
|
107 |
+
array (
|
108 |
+
'Google_Service_' =>
|
109 |
+
array (
|
110 |
+
0 => __DIR__ . '/..' . '/google/apiclient-services/src',
|
111 |
+
),
|
112 |
+
'Google_' =>
|
113 |
+
array (
|
114 |
+
0 => __DIR__ . '/../..' . '/src',
|
115 |
+
),
|
116 |
+
),
|
117 |
+
'F' =>
|
118 |
+
array (
|
119 |
+
'File' =>
|
120 |
+
array (
|
121 |
+
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
122 |
+
),
|
123 |
+
),
|
124 |
+
'C' =>
|
125 |
+
array (
|
126 |
+
'Crypt' =>
|
127 |
+
array (
|
128 |
+
0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib',
|
129 |
+
),
|
130 |
+
),
|
131 |
+
);
|
132 |
+
|
133 |
+
public static $classMap = array (
|
134 |
+
'BeforeValidException' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/BeforeValidException.php',
|
135 |
+
'ExpiredException' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/ExpiredException.php',
|
136 |
+
'Google\\Auth\\ApplicationDefaultCredentials' => __DIR__ . '/..' . '/google/auth/src/ApplicationDefaultCredentials.php',
|
137 |
+
'Google\\Auth\\CacheTrait' => __DIR__ . '/..' . '/google/auth/src/CacheTrait.php',
|
138 |
+
'Google\\Auth\\Cache\\InvalidArgumentException' => __DIR__ . '/..' . '/google/auth/src/Cache/InvalidArgumentException.php',
|
139 |
+
'Google\\Auth\\Cache\\Item' => __DIR__ . '/..' . '/google/auth/src/Cache/Item.php',
|
140 |
+
'Google\\Auth\\Cache\\MemoryCacheItemPool' => __DIR__ . '/..' . '/google/auth/src/Cache/MemoryCacheItemPool.php',
|
141 |
+
'Google\\Auth\\CredentialsLoader' => __DIR__ . '/..' . '/google/auth/src/CredentialsLoader.php',
|
142 |
+
'Google\\Auth\\Credentials\\AppIdentityCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/AppIdentityCredentials.php',
|
143 |
+
'Google\\Auth\\Credentials\\GCECredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/GCECredentials.php',
|
144 |
+
'Google\\Auth\\Credentials\\IAMCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/IAMCredentials.php',
|
145 |
+
'Google\\Auth\\Credentials\\ServiceAccountCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/ServiceAccountCredentials.php',
|
146 |
+
'Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php',
|
147 |
+
'Google\\Auth\\Credentials\\UserRefreshCredentials' => __DIR__ . '/..' . '/google/auth/src/Credentials/UserRefreshCredentials.php',
|
148 |
+
'Google\\Auth\\FetchAuthTokenCache' => __DIR__ . '/..' . '/google/auth/src/FetchAuthTokenCache.php',
|
149 |
+
'Google\\Auth\\FetchAuthTokenInterface' => __DIR__ . '/..' . '/google/auth/src/FetchAuthTokenInterface.php',
|
150 |
+
'Google\\Auth\\HttpHandler\\Guzzle5HttpHandler' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/Guzzle5HttpHandler.php',
|
151 |
+
'Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php',
|
152 |
+
'Google\\Auth\\HttpHandler\\HttpHandlerFactory' => __DIR__ . '/..' . '/google/auth/src/HttpHandler/HttpHandlerFactory.php',
|
153 |
+
'Google\\Auth\\Middleware\\AuthTokenMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/AuthTokenMiddleware.php',
|
154 |
+
'Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php',
|
155 |
+
'Google\\Auth\\Middleware\\SimpleMiddleware' => __DIR__ . '/..' . '/google/auth/src/Middleware/SimpleMiddleware.php',
|
156 |
+
'Google\\Auth\\OAuth2' => __DIR__ . '/..' . '/google/auth/src/OAuth2.php',
|
157 |
+
'Google\\Auth\\Subscriber\\AuthTokenSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/AuthTokenSubscriber.php',
|
158 |
+
'Google\\Auth\\Subscriber\\ScopedAccessTokenSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/ScopedAccessTokenSubscriber.php',
|
159 |
+
'Google\\Auth\\Subscriber\\SimpleSubscriber' => __DIR__ . '/..' . '/google/auth/src/Subscriber/SimpleSubscriber.php',
|
160 |
+
'Google_Service_Exception' => __DIR__ . '/../..' . '/src/Google/Service/Exception.php',
|
161 |
+
'Google_Service_Resource' => __DIR__ . '/../..' . '/src/Google/Service/Resource.php',
|
162 |
+
'JWT' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php',
|
163 |
+
'SignatureInvalidException' => __DIR__ . '/..' . '/firebase/php-jwt/Firebase/PHP-JWT/Exceptions/SignatureInvalidException.php',
|
164 |
+
);
|
165 |
+
|
166 |
+
public static function getInitializer(ClassLoader $loader)
|
167 |
+
{
|
168 |
+
return \Closure::bind(function () use ($loader) {
|
169 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$prefixLengthsPsr4;
|
170 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$prefixDirsPsr4;
|
171 |
+
$loader->prefixesPsr0 = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$prefixesPsr0;
|
172 |
+
$loader->classMap = ComposerStaticInit4bcd804d35cc650d1fb52c557725a2a1::$classMap;
|
173 |
+
|
174 |
+
}, null, ClassLoader::class);
|
175 |
+
}
|
176 |
+
}
|
google/vendor/composer/include_paths.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// include_paths.php @generated by Composer
|
4 |
-
|
5 |
-
$vendorDir = dirname(dirname(__FILE__));
|
6 |
-
$baseDir = dirname($vendorDir);
|
7 |
-
|
8 |
-
return array(
|
9 |
-
$vendorDir . '/phpseclib/phpseclib/phpseclib',
|
10 |
-
);
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// include_paths.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
$vendorDir . '/phpseclib/phpseclib/phpseclib',
|
10 |
+
);
|
google/vendor/composer/installed.json
CHANGED
@@ -1,720 +1,720 @@
|
|
1 |
-
[
|
2 |
-
{
|
3 |
-
"name": "psr/cache",
|
4 |
-
"version": "1.0.0",
|
5 |
-
"version_normalized": "1.0.0.0",
|
6 |
-
"source": {
|
7 |
-
"type": "git",
|
8 |
-
"url": "https://github.com/php-fig/cache.git",
|
9 |
-
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3"
|
10 |
-
},
|
11 |
-
"dist": {
|
12 |
-
"type": "zip",
|
13 |
-
"url": "https://api.github.com/repos/php-fig/cache/zipball/9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
14 |
-
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
15 |
-
"shasum": ""
|
16 |
-
},
|
17 |
-
"require": {
|
18 |
-
"php": ">=5.3.0"
|
19 |
-
},
|
20 |
-
"time": "2015-12-11T02:52:07+00:00",
|
21 |
-
"type": "library",
|
22 |
-
"extra": {
|
23 |
-
"branch-alias": {
|
24 |
-
"dev-master": "1.0.x-dev"
|
25 |
-
}
|
26 |
-
},
|
27 |
-
"installation-source": "dist",
|
28 |
-
"autoload": {
|
29 |
-
"psr-4": {
|
30 |
-
"Psr\\Cache\\": "src/"
|
31 |
-
}
|
32 |
-
},
|
33 |
-
"notification-url": "https://packagist.org/downloads/",
|
34 |
-
"license": [
|
35 |
-
"MIT"
|
36 |
-
],
|
37 |
-
"authors": [
|
38 |
-
{
|
39 |
-
"name": "PHP-FIG",
|
40 |
-
"homepage": "http://www.php-fig.org/"
|
41 |
-
}
|
42 |
-
],
|
43 |
-
"description": "Common interface for caching libraries",
|
44 |
-
"keywords": [
|
45 |
-
"cache",
|
46 |
-
"psr",
|
47 |
-
"psr-6"
|
48 |
-
]
|
49 |
-
},
|
50 |
-
{
|
51 |
-
"name": "psr/http-message",
|
52 |
-
"version": "1.0",
|
53 |
-
"version_normalized": "1.0.0.0",
|
54 |
-
"source": {
|
55 |
-
"type": "git",
|
56 |
-
"url": "https://github.com/php-fig/http-message.git",
|
57 |
-
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
|
58 |
-
},
|
59 |
-
"dist": {
|
60 |
-
"type": "zip",
|
61 |
-
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
62 |
-
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
63 |
-
"shasum": ""
|
64 |
-
},
|
65 |
-
"require": {
|
66 |
-
"php": ">=5.3.0"
|
67 |
-
},
|
68 |
-
"time": "2015-05-04T20:22:00+00:00",
|
69 |
-
"type": "library",
|
70 |
-
"extra": {
|
71 |
-
"branch-alias": {
|
72 |
-
"dev-master": "1.0.x-dev"
|
73 |
-
}
|
74 |
-
},
|
75 |
-
"installation-source": "dist",
|
76 |
-
"autoload": {
|
77 |
-
"psr-4": {
|
78 |
-
"Psr\\Http\\Message\\": "src/"
|
79 |
-
}
|
80 |
-
},
|
81 |
-
"notification-url": "https://packagist.org/downloads/",
|
82 |
-
"license": [
|
83 |
-
"MIT"
|
84 |
-
],
|
85 |
-
"authors": [
|
86 |
-
{
|
87 |
-
"name": "PHP-FIG",
|
88 |
-
"homepage": "http://www.php-fig.org/"
|
89 |
-
}
|
90 |
-
],
|
91 |
-
"description": "Common interface for HTTP messages",
|
92 |
-
"keywords": [
|
93 |
-
"http",
|
94 |
-
"http-message",
|
95 |
-
"psr",
|
96 |
-
"psr-7",
|
97 |
-
"request",
|
98 |
-
"response"
|
99 |
-
]
|
100 |
-
},
|
101 |
-
{
|
102 |
-
"name": "guzzlehttp/psr7",
|
103 |
-
"version": "1.2.0",
|
104 |
-
"version_normalized": "1.2.0.0",
|
105 |
-
"source": {
|
106 |
-
"type": "git",
|
107 |
-
"url": "https://github.com/guzzle/psr7.git",
|
108 |
-
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e"
|
109 |
-
},
|
110 |
-
"dist": {
|
111 |
-
"type": "zip",
|
112 |
-
"url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
113 |
-
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
114 |
-
"shasum": ""
|
115 |
-
},
|
116 |
-
"require": {
|
117 |
-
"php": ">=5.4.0",
|
118 |
-
"psr/http-message": "~1.0"
|
119 |
-
},
|
120 |
-
"provide": {
|
121 |
-
"psr/http-message-implementation": "1.0"
|
122 |
-
},
|
123 |
-
"require-dev": {
|
124 |
-
"phpunit/phpunit": "~4.0"
|
125 |
-
},
|
126 |
-
"time": "2015-08-15T19:32:36+00:00",
|
127 |
-
"type": "library",
|
128 |
-
"extra": {
|
129 |
-
"branch-alias": {
|
130 |
-
"dev-master": "1.0-dev"
|
131 |
-
}
|
132 |
-
},
|
133 |
-
"installation-source": "dist",
|
134 |
-
"autoload": {
|
135 |
-
"psr-4": {
|
136 |
-
"GuzzleHttp\\Psr7\\": "src/"
|
137 |
-
},
|
138 |
-
"files": [
|
139 |
-
"src/functions_include.php"
|
140 |
-
]
|
141 |
-
},
|
142 |
-
"notification-url": "https://packagist.org/downloads/",
|
143 |
-
"license": [
|
144 |
-
"MIT"
|
145 |
-
],
|
146 |
-
"authors": [
|
147 |
-
{
|
148 |
-
"name": "Michael Dowling",
|
149 |
-
"email": "mtdowling@gmail.com",
|
150 |
-
"homepage": "https://github.com/mtdowling"
|
151 |
-
}
|
152 |
-
],
|
153 |
-
"description": "PSR-7 message implementation",
|
154 |
-
"keywords": [
|
155 |
-
"http",
|
156 |
-
"message",
|
157 |
-
"stream",
|
158 |
-
"uri"
|
159 |
-
]
|
160 |
-
},
|
161 |
-
{
|
162 |
-
"name": "react/promise",
|
163 |
-
"version": "v2.0.0",
|
164 |
-
"version_normalized": "2.0.0.0",
|
165 |
-
"source": {
|
166 |
-
"type": "git",
|
167 |
-
"url": "https://github.com/reactphp/promise.git",
|
168 |
-
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0"
|
169 |
-
},
|
170 |
-
"dist": {
|
171 |
-
"type": "zip",
|
172 |
-
"url": "https://api.github.com/repos/reactphp/promise/zipball/58129a9cb9da88f2055309a805e2696b06928bb0",
|
173 |
-
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0",
|
174 |
-
"shasum": ""
|
175 |
-
},
|
176 |
-
"require": {
|
177 |
-
"php": ">=5.4.0"
|
178 |
-
},
|
179 |
-
"time": "2013-12-10T15:40:36+00:00",
|
180 |
-
"type": "library",
|
181 |
-
"extra": {
|
182 |
-
"branch-alias": {
|
183 |
-
"dev-master": "2.0-dev"
|
184 |
-
}
|
185 |
-
},
|
186 |
-
"installation-source": "dist",
|
187 |
-
"autoload": {
|
188 |
-
"psr-0": {
|
189 |
-
"React\\Promise": "src/"
|
190 |
-
},
|
191 |
-
"files": [
|
192 |
-
"src/React/Promise/functions.php"
|
193 |
-
]
|
194 |
-
},
|
195 |
-
"notification-url": "https://packagist.org/downloads/",
|
196 |
-
"license": [
|
197 |
-
"MIT"
|
198 |
-
],
|
199 |
-
"authors": [
|
200 |
-
{
|
201 |
-
"name": "Jan Sorgalla",
|
202 |
-
"email": "jsorgalla@googlemail.com"
|
203 |
-
}
|
204 |
-
],
|
205 |
-
"description": "A lightweight implementation of CommonJS Promises/A for PHP"
|
206 |
-
},
|
207 |
-
{
|
208 |
-
"name": "guzzlehttp/streams",
|
209 |
-
"version": "3.0.0",
|
210 |
-
"version_normalized": "3.0.0.0",
|
211 |
-
"source": {
|
212 |
-
"type": "git",
|
213 |
-
"url": "https://github.com/guzzle/streams.git",
|
214 |
-
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
|
215 |
-
},
|
216 |
-
"dist": {
|
217 |
-
"type": "zip",
|
218 |
-
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
219 |
-
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
220 |
-
"shasum": ""
|
221 |
-
},
|
222 |
-
"require": {
|
223 |
-
"php": ">=5.4.0"
|
224 |
-
},
|
225 |
-
"require-dev": {
|
226 |
-
"phpunit/phpunit": "~4.0"
|
227 |
-
},
|
228 |
-
"time": "2014-10-12T19:18:40+00:00",
|
229 |
-
"type": "library",
|
230 |
-
"extra": {
|
231 |
-
"branch-alias": {
|
232 |
-
"dev-master": "3.0-dev"
|
233 |
-
}
|
234 |
-
},
|
235 |
-
"installation-source": "dist",
|
236 |
-
"autoload": {
|
237 |
-
"psr-4": {
|
238 |
-
"GuzzleHttp\\Stream\\": "src/"
|
239 |
-
}
|
240 |
-
},
|
241 |
-
"notification-url": "https://packagist.org/downloads/",
|
242 |
-
"license": [
|
243 |
-
"MIT"
|
244 |
-
],
|
245 |
-
"authors": [
|
246 |
-
{
|
247 |
-
"name": "Michael Dowling",
|
248 |
-
"email": "mtdowling@gmail.com",
|
249 |
-
"homepage": "https://github.com/mtdowling"
|
250 |
-
}
|
251 |
-
],
|
252 |
-
"description": "Provides a simple abstraction over streams of data",
|
253 |
-
"homepage": "http://guzzlephp.org/",
|
254 |
-
"keywords": [
|
255 |
-
"Guzzle",
|
256 |
-
"stream"
|
257 |
-
]
|
258 |
-
},
|
259 |
-
{
|
260 |
-
"name": "guzzlehttp/ringphp",
|
261 |
-
"version": "1.1.0",
|
262 |
-
"version_normalized": "1.1.0.0",
|
263 |
-
"source": {
|
264 |
-
"type": "git",
|
265 |
-
"url": "https://github.com/guzzle/RingPHP.git",
|
266 |
-
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
|
267 |
-
},
|
268 |
-
"dist": {
|
269 |
-
"type": "zip",
|
270 |
-
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
271 |
-
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
272 |
-
"shasum": ""
|
273 |
-
},
|
274 |
-
"require": {
|
275 |
-
"guzzlehttp/streams": "~3.0",
|
276 |
-
"php": ">=5.4.0",
|
277 |
-
"react/promise": "~2.0"
|
278 |
-
},
|
279 |
-
"require-dev": {
|
280 |
-
"ext-curl": "*",
|
281 |
-
"phpunit/phpunit": "~4.0"
|
282 |
-
},
|
283 |
-
"suggest": {
|
284 |
-
"ext-curl": "Guzzle will use specific adapters if cURL is present"
|
285 |
-
},
|
286 |
-
"time": "2015-05-20T03:37:09+00:00",
|
287 |
-
"type": "library",
|
288 |
-
"extra": {
|
289 |
-
"branch-alias": {
|
290 |
-
"dev-master": "1.1-dev"
|
291 |
-
}
|
292 |
-
},
|
293 |
-
"installation-source": "dist",
|
294 |
-
"autoload": {
|
295 |
-
"psr-4": {
|
296 |
-
"GuzzleHttp\\Ring\\": "src/"
|
297 |
-
}
|
298 |
-
},
|
299 |
-
"notification-url": "https://packagist.org/downloads/",
|
300 |
-
"license": [
|
301 |
-
"MIT"
|
302 |
-
],
|
303 |
-
"authors": [
|
304 |
-
{
|
305 |
-
"name": "Michael Dowling",
|
306 |
-
"email": "mtdowling@gmail.com",
|
307 |
-
"homepage": "https://github.com/mtdowling"
|
308 |
-
}
|
309 |
-
],
|
310 |
-
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function."
|
311 |
-
},
|
312 |
-
{
|
313 |
-
"name": "guzzlehttp/guzzle",
|
314 |
-
"version": "5.3.1",
|
315 |
-
"version_normalized": "5.3.1.0",
|
316 |
-
"source": {
|
317 |
-
"type": "git",
|
318 |
-
"url": "https://github.com/guzzle/guzzle.git",
|
319 |
-
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8"
|
320 |
-
},
|
321 |
-
"dist": {
|
322 |
-
"type": "zip",
|
323 |
-
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
324 |
-
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
325 |
-
"shasum": ""
|
326 |
-
},
|
327 |
-
"require": {
|
328 |
-
"guzzlehttp/ringphp": "^1.1",
|
329 |
-
"php": ">=5.4.0"
|
330 |
-
},
|
331 |
-
"require-dev": {
|
332 |
-
"ext-curl": "*",
|
333 |
-
"phpunit/phpunit": "^4.0"
|
334 |
-
},
|
335 |
-
"time": "2016-07-15T19:28:39+00:00",
|
336 |
-
"type": "library",
|
337 |
-
"installation-source": "dist",
|
338 |
-
"autoload": {
|
339 |
-
"psr-4": {
|
340 |
-
"GuzzleHttp\\": "src/"
|
341 |
-
}
|
342 |
-
},
|
343 |
-
"notification-url": "https://packagist.org/downloads/",
|
344 |
-
"license": [
|
345 |
-
"MIT"
|
346 |
-
],
|
347 |
-
"authors": [
|
348 |
-
{
|
349 |
-
"name": "Michael Dowling",
|
350 |
-
"email": "mtdowling@gmail.com",
|
351 |
-
"homepage": "https://github.com/mtdowling"
|
352 |
-
}
|
353 |
-
],
|
354 |
-
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
355 |
-
"homepage": "http://guzzlephp.org/",
|
356 |
-
"keywords": [
|
357 |
-
"client",
|
358 |
-
"curl",
|
359 |
-
"framework",
|
360 |
-
"http",
|
361 |
-
"http client",
|
362 |
-
"rest",
|
363 |
-
"web service"
|
364 |
-
]
|
365 |
-
},
|
366 |
-
{
|
367 |
-
"name": "firebase/php-jwt",
|
368 |
-
"version": "2.0.0",
|
369 |
-
"version_normalized": "2.0.0.0",
|
370 |
-
"target-dir": "Firebase/PHP-JWT",
|
371 |
-
"source": {
|
372 |
-
"type": "git",
|
373 |
-
"url": "https://github.com/firebase/php-jwt.git",
|
374 |
-
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57"
|
375 |
-
},
|
376 |
-
"dist": {
|
377 |
-
"type": "zip",
|
378 |
-
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
379 |
-
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
380 |
-
"shasum": ""
|
381 |
-
},
|
382 |
-
"require": {
|
383 |
-
"php": ">=5.2.0"
|
384 |
-
},
|
385 |
-
"time": "2015-04-01T18:46:38+00:00",
|
386 |
-
"type": "library",
|
387 |
-
"installation-source": "dist",
|
388 |
-
"autoload": {
|
389 |
-
"classmap": [
|
390 |
-
"Authentication/",
|
391 |
-
"Exceptions/"
|
392 |
-
]
|
393 |
-
},
|
394 |
-
"notification-url": "https://packagist.org/downloads/",
|
395 |
-
"license": [
|
396 |
-
"BSD-3-Clause"
|
397 |
-
],
|
398 |
-
"authors": [
|
399 |
-
{
|
400 |
-
"name": "Neuman Vong",
|
401 |
-
"email": "neuman+pear@twilio.com",
|
402 |
-
"role": "Developer"
|
403 |
-
},
|
404 |
-
{
|
405 |
-
"name": "Anant Narayanan",
|
406 |
-
"email": "anant@php.net",
|
407 |
-
"role": "Developer"
|
408 |
-
}
|
409 |
-
],
|
410 |
-
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
411 |
-
"homepage": "https://github.com/firebase/php-jwt"
|
412 |
-
},
|
413 |
-
{
|
414 |
-
"name": "google/auth",
|
415 |
-
"version": "v1.0",
|
416 |
-
"version_normalized": "1.0.0.0",
|
417 |
-
"source": {
|
418 |
-
"type": "git",
|
419 |
-
"url": "https://github.com/google/google-auth-library-php.git",
|
420 |
-
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df"
|
421 |
-
},
|
422 |
-
"dist": {
|
423 |
-
"type": "zip",
|
424 |
-
"url": "https://api.github.com/repos/google/google-auth-library-php/zipball/db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
425 |
-
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
426 |
-
"shasum": ""
|
427 |
-
},
|
428 |
-
"require": {
|
429 |
-
"firebase/php-jwt": "~2.0|~3.0|~4.0",
|
430 |
-
"guzzlehttp/guzzle": "~5.3.1|~6.0",
|
431 |
-
"guzzlehttp/psr7": "~1.2",
|
432 |
-
"php": ">=5.4",
|
433 |
-
"psr/cache": "^1.0",
|
434 |
-
"psr/http-message": "^1.0"
|
435 |
-
},
|
436 |
-
"require-dev": {
|
437 |
-
"friendsofphp/php-cs-fixer": "^1.11",
|
438 |
-
"phpunit/phpunit": "3.7.*"
|
439 |
-
},
|
440 |
-
"time": "2017-06-13T18:00:07+00:00",
|
441 |
-
"type": "library",
|
442 |
-
"installation-source": "dist",
|
443 |
-
"autoload": {
|
444 |
-
"classmap": [
|
445 |
-
"src/"
|
446 |
-
],
|
447 |
-
"psr-4": {
|
448 |
-
"Google\\Auth\\": "src"
|
449 |
-
}
|
450 |
-
},
|
451 |
-
"notification-url": "https://packagist.org/downloads/",
|
452 |
-
"license": [
|
453 |
-
"Apache-2.0"
|
454 |
-
],
|
455 |
-
"description": "Google Auth Library for PHP",
|
456 |
-
"homepage": "http://github.com/google/google-auth-library-php",
|
457 |
-
"keywords": [
|
458 |
-
"Authentication",
|
459 |
-
"google",
|
460 |
-
"oauth2"
|
461 |
-
]
|
462 |
-
},
|
463 |
-
{
|
464 |
-
"name": "google/apiclient-services",
|
465 |
-
"version": "v0.13",
|
466 |
-
"version_normalized": "0.13.0.0",
|
467 |
-
"source": {
|
468 |
-
"type": "git",
|
469 |
-
"url": "https://github.com/google/google-api-php-client-services.git",
|
470 |
-
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171"
|
471 |
-
},
|
472 |
-
"dist": {
|
473 |
-
"type": "zip",
|
474 |
-
"url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/0805897f3435f9eea73ce21da9d55f51c69c1171",
|
475 |
-
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171",
|
476 |
-
"shasum": ""
|
477 |
-
},
|
478 |
-
"require": {
|
479 |
-
"php": ">=5.4"
|
480 |
-
},
|
481 |
-
"require-dev": {
|
482 |
-
"phpunit/phpunit": "~4.8"
|
483 |
-
},
|
484 |
-
"time": "2017-07-07T16:01:27+00:00",
|
485 |
-
"type": "library",
|
486 |
-
"installation-source": "dist",
|
487 |
-
"autoload": {
|
488 |
-
"psr-0": {
|
489 |
-
"Google_Service_": "src"
|
490 |
-
}
|
491 |
-
},
|
492 |
-
"notification-url": "https://packagist.org/downloads/",
|
493 |
-
"license": [
|
494 |
-
"Apache-2.0"
|
495 |
-
],
|
496 |
-
"description": "Client library for Google APIs",
|
497 |
-
"homepage": "http://developers.google.com/api-client-library/php",
|
498 |
-
"keywords": [
|
499 |
-
"google"
|
500 |
-
]
|
501 |
-
},
|
502 |
-
{
|
503 |
-
"name": "psr/log",
|
504 |
-
"version": "1.0.0",
|
505 |
-
"version_normalized": "1.0.0.0",
|
506 |
-
"source": {
|
507 |
-
"type": "git",
|
508 |
-
"url": "https://github.com/php-fig/log.git",
|
509 |
-
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
510 |
-
},
|
511 |
-
"dist": {
|
512 |
-
"type": "zip",
|
513 |
-
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
514 |
-
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
515 |
-
"shasum": ""
|
516 |
-
},
|
517 |
-
"time": "2012-12-21T11:40:51+00:00",
|
518 |
-
"type": "library",
|
519 |
-
"installation-source": "dist",
|
520 |
-
"autoload": {
|
521 |
-
"psr-0": {
|
522 |
-
"Psr\\Log\\": ""
|
523 |
-
}
|
524 |
-
},
|
525 |
-
"notification-url": "https://packagist.org/downloads/",
|
526 |
-
"license": [
|
527 |
-
"MIT"
|
528 |
-
],
|
529 |
-
"authors": [
|
530 |
-
{
|
531 |
-
"name": "PHP-FIG",
|
532 |
-
"homepage": "http://www.php-fig.org/"
|
533 |
-
}
|
534 |
-
],
|
535 |
-
"description": "Common interface for logging libraries",
|
536 |
-
"keywords": [
|
537 |
-
"log",
|
538 |
-
"psr",
|
539 |
-
"psr-3"
|
540 |
-
]
|
541 |
-
},
|
542 |
-
{
|
543 |
-
"name": "monolog/monolog",
|
544 |
-
"version": "1.17.0",
|
545 |
-
"version_normalized": "1.17.0.0",
|
546 |
-
"source": {
|
547 |
-
"type": "git",
|
548 |
-
"url": "https://github.com/Seldaek/monolog.git",
|
549 |
-
"reference": "877ae631713cc961952df713ae785735b90df682"
|
550 |
-
},
|
551 |
-
"dist": {
|
552 |
-
"type": "zip",
|
553 |
-
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/877ae631713cc961952df713ae785735b90df682",
|
554 |
-
"reference": "877ae631713cc961952df713ae785735b90df682",
|
555 |
-
"shasum": ""
|
556 |
-
},
|
557 |
-
"require": {
|
558 |
-
"php": ">=5.3.0",
|
559 |
-
"psr/log": "~1.0"
|
560 |
-
},
|
561 |
-
"provide": {
|
562 |
-
"psr/log-implementation": "1.0.0"
|
563 |
-
},
|
564 |
-
"require-dev": {
|
565 |
-
"aws/aws-sdk-php": "^2.4.9",
|
566 |
-
"doctrine/couchdb": "~1.0@dev",
|
567 |
-
"graylog2/gelf-php": "~1.0",
|
568 |
-
"php-console/php-console": "^3.1.3",
|
569 |
-
"phpunit/phpunit": "~4.5",
|
570 |
-
"phpunit/phpunit-mock-objects": "2.3.0",
|
571 |
-
"raven/raven": "~0.11",
|
572 |
-
"ruflin/elastica": ">=0.90 <3.0",
|
573 |
-
"swiftmailer/swiftmailer": "~5.3",
|
574 |
-
"videlalvaro/php-amqplib": "~2.4"
|
575 |
-
},
|
576 |
-
"suggest": {
|
577 |
-
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
578 |
-
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
579 |
-
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
580 |
-
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
581 |
-
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
582 |
-
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
583 |
-
"raven/raven": "Allow sending log messages to a Sentry server",
|
584 |
-
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
585 |
-
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
586 |
-
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
|
587 |
-
},
|
588 |
-
"time": "2015-08-30T11:40:25+00:00",
|
589 |
-
"type": "library",
|
590 |
-
"extra": {
|
591 |
-
"branch-alias": {
|
592 |
-
"dev-master": "1.16.x-dev"
|
593 |
-
}
|
594 |
-
},
|
595 |
-
"installation-source": "dist",
|
596 |
-
"autoload": {
|
597 |
-
"psr-4": {
|
598 |
-
"Monolog\\": "src/Monolog"
|
599 |
-
}
|
600 |
-
},
|
601 |
-
"notification-url": "https://packagist.org/downloads/",
|
602 |
-
"license": [
|
603 |
-
"MIT"
|
604 |
-
],
|
605 |
-
"authors": [
|
606 |
-
{
|
607 |
-
"name": "Jordi Boggiano",
|
608 |
-
"email": "j.boggiano@seld.be",
|
609 |
-
"homepage": "http://seld.be"
|
610 |
-
}
|
611 |
-
],
|
612 |
-
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
613 |
-
"homepage": "http://github.com/Seldaek/monolog",
|
614 |
-
"keywords": [
|
615 |
-
"log",
|
616 |
-
"logging",
|
617 |
-
"psr-3"
|
618 |
-
]
|
619 |
-
},
|
620 |
-
{
|
621 |
-
"name": "phpseclib/phpseclib",
|
622 |
-
"version": "0.3.10",
|
623 |
-
"version_normalized": "0.3.10.0",
|
624 |
-
"source": {
|
625 |
-
"type": "git",
|
626 |
-
"url": "https://github.com/phpseclib/phpseclib.git",
|
627 |
-
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
|
628 |
-
},
|
629 |
-
"dist": {
|
630 |
-
"type": "zip",
|
631 |
-
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
632 |
-
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
633 |
-
"shasum": ""
|
634 |
-
},
|
635 |
-
"require": {
|
636 |
-
"php": ">=5.0.0"
|
637 |
-
},
|
638 |
-
"require-dev": {
|
639 |
-
"phing/phing": "~2.7",
|
640 |
-
"phpunit/phpunit": "~4.0",
|
641 |
-
"sami/sami": "~2.0",
|
642 |
-
"squizlabs/php_codesniffer": "~1.5"
|
643 |
-
},
|
644 |
-
"suggest": {
|
645 |
-
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
|
646 |
-
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.",
|
647 |
-
"pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3."
|
648 |
-
},
|
649 |
-
"time": "2015-01-28T21:50:33+00:00",
|
650 |
-
"type": "library",
|
651 |
-
"extra": {
|
652 |
-
"branch-alias": {
|
653 |
-
"dev-master": "0.3-dev"
|
654 |
-
}
|
655 |
-
},
|
656 |
-
"installation-source": "dist",
|
657 |
-
"autoload": {
|
658 |
-
"psr-0": {
|
659 |
-
"Crypt": "phpseclib/",
|
660 |
-
"File": "phpseclib/",
|
661 |
-
"Math": "phpseclib/",
|
662 |
-
"Net": "phpseclib/",
|
663 |
-
"System": "phpseclib/"
|
664 |
-
},
|
665 |
-
"files": [
|
666 |
-
"phpseclib/Crypt/Random.php"
|
667 |
-
]
|
668 |
-
},
|
669 |
-
"notification-url": "https://packagist.org/downloads/",
|
670 |
-
"include-path": [
|
671 |
-
"phpseclib/"
|
672 |
-
],
|
673 |
-
"license": [
|
674 |
-
"MIT"
|
675 |
-
],
|
676 |
-
"authors": [
|
677 |
-
{
|
678 |
-
"name": "Jim Wigginton",
|
679 |
-
"email": "terrafrost@php.net",
|
680 |
-
"role": "Lead Developer"
|
681 |
-
},
|
682 |
-
{
|
683 |
-
"name": "Patrick Monnerat",
|
684 |
-
"email": "pm@datasphere.ch",
|
685 |
-
"role": "Developer"
|
686 |
-
},
|
687 |
-
{
|
688 |
-
"name": "Andreas Fischer",
|
689 |
-
"email": "bantu@phpbb.com",
|
690 |
-
"role": "Developer"
|
691 |
-
},
|
692 |
-
{
|
693 |
-
"name": "Hans-Jürgen Petrich",
|
694 |
-
"email": "petrich@tronic-media.com",
|
695 |
-
"role": "Developer"
|
696 |
-
}
|
697 |
-
],
|
698 |
-
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
|
699 |
-
"homepage": "http://phpseclib.sourceforge.net",
|
700 |
-
"keywords": [
|
701 |
-
"BigInteger",
|
702 |
-
"aes",
|
703 |
-
"asn.1",
|
704 |
-
"asn1",
|
705 |
-
"blowfish",
|
706 |
-
"crypto",
|
707 |
-
"cryptography",
|
708 |
-
"encryption",
|
709 |
-
"rsa",
|
710 |
-
"security",
|
711 |
-
"sftp",
|
712 |
-
"signature",
|
713 |
-
"signing",
|
714 |
-
"ssh",
|
715 |
-
"twofish",
|
716 |
-
"x.509",
|
717 |
-
"x509"
|
718 |
-
]
|
719 |
-
}
|
720 |
-
]
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "psr/cache",
|
4 |
+
"version": "1.0.0",
|
5 |
+
"version_normalized": "1.0.0.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/php-fig/cache.git",
|
9 |
+
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/php-fig/cache/zipball/9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
14 |
+
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.3.0"
|
19 |
+
},
|
20 |
+
"time": "2015-12-11T02:52:07+00:00",
|
21 |
+
"type": "library",
|
22 |
+
"extra": {
|
23 |
+
"branch-alias": {
|
24 |
+
"dev-master": "1.0.x-dev"
|
25 |
+
}
|
26 |
+
},
|
27 |
+
"installation-source": "dist",
|
28 |
+
"autoload": {
|
29 |
+
"psr-4": {
|
30 |
+
"Psr\\Cache\\": "src/"
|
31 |
+
}
|
32 |
+
},
|
33 |
+
"notification-url": "https://packagist.org/downloads/",
|
34 |
+
"license": [
|
35 |
+
"MIT"
|
36 |
+
],
|
37 |
+
"authors": [
|
38 |
+
{
|
39 |
+
"name": "PHP-FIG",
|
40 |
+
"homepage": "http://www.php-fig.org/"
|
41 |
+
}
|
42 |
+
],
|
43 |
+
"description": "Common interface for caching libraries",
|
44 |
+
"keywords": [
|
45 |
+
"cache",
|
46 |
+
"psr",
|
47 |
+
"psr-6"
|
48 |
+
]
|
49 |
+
},
|
50 |
+
{
|
51 |
+
"name": "psr/http-message",
|
52 |
+
"version": "1.0",
|
53 |
+
"version_normalized": "1.0.0.0",
|
54 |
+
"source": {
|
55 |
+
"type": "git",
|
56 |
+
"url": "https://github.com/php-fig/http-message.git",
|
57 |
+
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298"
|
58 |
+
},
|
59 |
+
"dist": {
|
60 |
+
"type": "zip",
|
61 |
+
"url": "https://api.github.com/repos/php-fig/http-message/zipball/85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
62 |
+
"reference": "85d63699f0dbedb190bbd4b0d2b9dc707ea4c298",
|
63 |
+
"shasum": ""
|
64 |
+
},
|
65 |
+
"require": {
|
66 |
+
"php": ">=5.3.0"
|
67 |
+
},
|
68 |
+
"time": "2015-05-04T20:22:00+00:00",
|
69 |
+
"type": "library",
|
70 |
+
"extra": {
|
71 |
+
"branch-alias": {
|
72 |
+
"dev-master": "1.0.x-dev"
|
73 |
+
}
|
74 |
+
},
|
75 |
+
"installation-source": "dist",
|
76 |
+
"autoload": {
|
77 |
+
"psr-4": {
|
78 |
+
"Psr\\Http\\Message\\": "src/"
|
79 |
+
}
|
80 |
+
},
|
81 |
+
"notification-url": "https://packagist.org/downloads/",
|
82 |
+
"license": [
|
83 |
+
"MIT"
|
84 |
+
],
|
85 |
+
"authors": [
|
86 |
+
{
|
87 |
+
"name": "PHP-FIG",
|
88 |
+
"homepage": "http://www.php-fig.org/"
|
89 |
+
}
|
90 |
+
],
|
91 |
+
"description": "Common interface for HTTP messages",
|
92 |
+
"keywords": [
|
93 |
+
"http",
|
94 |
+
"http-message",
|
95 |
+
"psr",
|
96 |
+
"psr-7",
|
97 |
+
"request",
|
98 |
+
"response"
|
99 |
+
]
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"name": "guzzlehttp/psr7",
|
103 |
+
"version": "1.2.0",
|
104 |
+
"version_normalized": "1.2.0.0",
|
105 |
+
"source": {
|
106 |
+
"type": "git",
|
107 |
+
"url": "https://github.com/guzzle/psr7.git",
|
108 |
+
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e"
|
109 |
+
},
|
110 |
+
"dist": {
|
111 |
+
"type": "zip",
|
112 |
+
"url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
113 |
+
"reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
|
114 |
+
"shasum": ""
|
115 |
+
},
|
116 |
+
"require": {
|
117 |
+
"php": ">=5.4.0",
|
118 |
+
"psr/http-message": "~1.0"
|
119 |
+
},
|
120 |
+
"provide": {
|
121 |
+
"psr/http-message-implementation": "1.0"
|
122 |
+
},
|
123 |
+
"require-dev": {
|
124 |
+
"phpunit/phpunit": "~4.0"
|
125 |
+
},
|
126 |
+
"time": "2015-08-15T19:32:36+00:00",
|
127 |
+
"type": "library",
|
128 |
+
"extra": {
|
129 |
+
"branch-alias": {
|
130 |
+
"dev-master": "1.0-dev"
|
131 |
+
}
|
132 |
+
},
|
133 |
+
"installation-source": "dist",
|
134 |
+
"autoload": {
|
135 |
+
"psr-4": {
|
136 |
+
"GuzzleHttp\\Psr7\\": "src/"
|
137 |
+
},
|
138 |
+
"files": [
|
139 |
+
"src/functions_include.php"
|
140 |
+
]
|
141 |
+
},
|
142 |
+
"notification-url": "https://packagist.org/downloads/",
|
143 |
+
"license": [
|
144 |
+
"MIT"
|
145 |
+
],
|
146 |
+
"authors": [
|
147 |
+
{
|
148 |
+
"name": "Michael Dowling",
|
149 |
+
"email": "mtdowling@gmail.com",
|
150 |
+
"homepage": "https://github.com/mtdowling"
|
151 |
+
}
|
152 |
+
],
|
153 |
+
"description": "PSR-7 message implementation",
|
154 |
+
"keywords": [
|
155 |
+
"http",
|
156 |
+
"message",
|
157 |
+
"stream",
|
158 |
+
"uri"
|
159 |
+
]
|
160 |
+
},
|
161 |
+
{
|
162 |
+
"name": "react/promise",
|
163 |
+
"version": "v2.0.0",
|
164 |
+
"version_normalized": "2.0.0.0",
|
165 |
+
"source": {
|
166 |
+
"type": "git",
|
167 |
+
"url": "https://github.com/reactphp/promise.git",
|
168 |
+
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0"
|
169 |
+
},
|
170 |
+
"dist": {
|
171 |
+
"type": "zip",
|
172 |
+
"url": "https://api.github.com/repos/reactphp/promise/zipball/58129a9cb9da88f2055309a805e2696b06928bb0",
|
173 |
+
"reference": "58129a9cb9da88f2055309a805e2696b06928bb0",
|
174 |
+
"shasum": ""
|
175 |
+
},
|
176 |
+
"require": {
|
177 |
+
"php": ">=5.4.0"
|
178 |
+
},
|
179 |
+
"time": "2013-12-10T15:40:36+00:00",
|
180 |
+
"type": "library",
|
181 |
+
"extra": {
|
182 |
+
"branch-alias": {
|
183 |
+
"dev-master": "2.0-dev"
|
184 |
+
}
|
185 |
+
},
|
186 |
+
"installation-source": "dist",
|
187 |
+
"autoload": {
|
188 |
+
"psr-0": {
|
189 |
+
"React\\Promise": "src/"
|
190 |
+
},
|
191 |
+
"files": [
|
192 |
+
"src/React/Promise/functions.php"
|
193 |
+
]
|
194 |
+
},
|
195 |
+
"notification-url": "https://packagist.org/downloads/",
|
196 |
+
"license": [
|
197 |
+
"MIT"
|
198 |
+
],
|
199 |
+
"authors": [
|
200 |
+
{
|
201 |
+
"name": "Jan Sorgalla",
|
202 |
+
"email": "jsorgalla@googlemail.com"
|
203 |
+
}
|
204 |
+
],
|
205 |
+
"description": "A lightweight implementation of CommonJS Promises/A for PHP"
|
206 |
+
},
|
207 |
+
{
|
208 |
+
"name": "guzzlehttp/streams",
|
209 |
+
"version": "3.0.0",
|
210 |
+
"version_normalized": "3.0.0.0",
|
211 |
+
"source": {
|
212 |
+
"type": "git",
|
213 |
+
"url": "https://github.com/guzzle/streams.git",
|
214 |
+
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5"
|
215 |
+
},
|
216 |
+
"dist": {
|
217 |
+
"type": "zip",
|
218 |
+
"url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
219 |
+
"reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5",
|
220 |
+
"shasum": ""
|
221 |
+
},
|
222 |
+
"require": {
|
223 |
+
"php": ">=5.4.0"
|
224 |
+
},
|
225 |
+
"require-dev": {
|
226 |
+
"phpunit/phpunit": "~4.0"
|
227 |
+
},
|
228 |
+
"time": "2014-10-12T19:18:40+00:00",
|
229 |
+
"type": "library",
|
230 |
+
"extra": {
|
231 |
+
"branch-alias": {
|
232 |
+
"dev-master": "3.0-dev"
|
233 |
+
}
|
234 |
+
},
|
235 |
+
"installation-source": "dist",
|
236 |
+
"autoload": {
|
237 |
+
"psr-4": {
|
238 |
+
"GuzzleHttp\\Stream\\": "src/"
|
239 |
+
}
|
240 |
+
},
|
241 |
+
"notification-url": "https://packagist.org/downloads/",
|
242 |
+
"license": [
|
243 |
+
"MIT"
|
244 |
+
],
|
245 |
+
"authors": [
|
246 |
+
{
|
247 |
+
"name": "Michael Dowling",
|
248 |
+
"email": "mtdowling@gmail.com",
|
249 |
+
"homepage": "https://github.com/mtdowling"
|
250 |
+
}
|
251 |
+
],
|
252 |
+
"description": "Provides a simple abstraction over streams of data",
|
253 |
+
"homepage": "http://guzzlephp.org/",
|
254 |
+
"keywords": [
|
255 |
+
"Guzzle",
|
256 |
+
"stream"
|
257 |
+
]
|
258 |
+
},
|
259 |
+
{
|
260 |
+
"name": "guzzlehttp/ringphp",
|
261 |
+
"version": "1.1.0",
|
262 |
+
"version_normalized": "1.1.0.0",
|
263 |
+
"source": {
|
264 |
+
"type": "git",
|
265 |
+
"url": "https://github.com/guzzle/RingPHP.git",
|
266 |
+
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b"
|
267 |
+
},
|
268 |
+
"dist": {
|
269 |
+
"type": "zip",
|
270 |
+
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
271 |
+
"reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b",
|
272 |
+
"shasum": ""
|
273 |
+
},
|
274 |
+
"require": {
|
275 |
+
"guzzlehttp/streams": "~3.0",
|
276 |
+
"php": ">=5.4.0",
|
277 |
+
"react/promise": "~2.0"
|
278 |
+
},
|
279 |
+
"require-dev": {
|
280 |
+
"ext-curl": "*",
|
281 |
+
"phpunit/phpunit": "~4.0"
|
282 |
+
},
|
283 |
+
"suggest": {
|
284 |
+
"ext-curl": "Guzzle will use specific adapters if cURL is present"
|
285 |
+
},
|
286 |
+
"time": "2015-05-20T03:37:09+00:00",
|
287 |
+
"type": "library",
|
288 |
+
"extra": {
|
289 |
+
"branch-alias": {
|
290 |
+
"dev-master": "1.1-dev"
|
291 |
+
}
|
292 |
+
},
|
293 |
+
"installation-source": "dist",
|
294 |
+
"autoload": {
|
295 |
+
"psr-4": {
|
296 |
+
"GuzzleHttp\\Ring\\": "src/"
|
297 |
+
}
|
298 |
+
},
|
299 |
+
"notification-url": "https://packagist.org/downloads/",
|
300 |
+
"license": [
|
301 |
+
"MIT"
|
302 |
+
],
|
303 |
+
"authors": [
|
304 |
+
{
|
305 |
+
"name": "Michael Dowling",
|
306 |
+
"email": "mtdowling@gmail.com",
|
307 |
+
"homepage": "https://github.com/mtdowling"
|
308 |
+
}
|
309 |
+
],
|
310 |
+
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function."
|
311 |
+
},
|
312 |
+
{
|
313 |
+
"name": "guzzlehttp/guzzle",
|
314 |
+
"version": "5.3.1",
|
315 |
+
"version_normalized": "5.3.1.0",
|
316 |
+
"source": {
|
317 |
+
"type": "git",
|
318 |
+
"url": "https://github.com/guzzle/guzzle.git",
|
319 |
+
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8"
|
320 |
+
},
|
321 |
+
"dist": {
|
322 |
+
"type": "zip",
|
323 |
+
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
324 |
+
"reference": "70f1fa53b71c4647bf2762c09068a95f77e12fb8",
|
325 |
+
"shasum": ""
|
326 |
+
},
|
327 |
+
"require": {
|
328 |
+
"guzzlehttp/ringphp": "^1.1",
|
329 |
+
"php": ">=5.4.0"
|
330 |
+
},
|
331 |
+
"require-dev": {
|
332 |
+
"ext-curl": "*",
|
333 |
+
"phpunit/phpunit": "^4.0"
|
334 |
+
},
|
335 |
+
"time": "2016-07-15T19:28:39+00:00",
|
336 |
+
"type": "library",
|
337 |
+
"installation-source": "dist",
|
338 |
+
"autoload": {
|
339 |
+
"psr-4": {
|
340 |
+
"GuzzleHttp\\": "src/"
|
341 |
+
}
|
342 |
+
},
|
343 |
+
"notification-url": "https://packagist.org/downloads/",
|
344 |
+
"license": [
|
345 |
+
"MIT"
|
346 |
+
],
|
347 |
+
"authors": [
|
348 |
+
{
|
349 |
+
"name": "Michael Dowling",
|
350 |
+
"email": "mtdowling@gmail.com",
|
351 |
+
"homepage": "https://github.com/mtdowling"
|
352 |
+
}
|
353 |
+
],
|
354 |
+
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
355 |
+
"homepage": "http://guzzlephp.org/",
|
356 |
+
"keywords": [
|
357 |
+
"client",
|
358 |
+
"curl",
|
359 |
+
"framework",
|
360 |
+
"http",
|
361 |
+
"http client",
|
362 |
+
"rest",
|
363 |
+
"web service"
|
364 |
+
]
|
365 |
+
},
|
366 |
+
{
|
367 |
+
"name": "firebase/php-jwt",
|
368 |
+
"version": "2.0.0",
|
369 |
+
"version_normalized": "2.0.0.0",
|
370 |
+
"target-dir": "Firebase/PHP-JWT",
|
371 |
+
"source": {
|
372 |
+
"type": "git",
|
373 |
+
"url": "https://github.com/firebase/php-jwt.git",
|
374 |
+
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57"
|
375 |
+
},
|
376 |
+
"dist": {
|
377 |
+
"type": "zip",
|
378 |
+
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
379 |
+
"reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57",
|
380 |
+
"shasum": ""
|
381 |
+
},
|
382 |
+
"require": {
|
383 |
+
"php": ">=5.2.0"
|
384 |
+
},
|
385 |
+
"time": "2015-04-01T18:46:38+00:00",
|
386 |
+
"type": "library",
|
387 |
+
"installation-source": "dist",
|
388 |
+
"autoload": {
|
389 |
+
"classmap": [
|
390 |
+
"Authentication/",
|
391 |
+
"Exceptions/"
|
392 |
+
]
|
393 |
+
},
|
394 |
+
"notification-url": "https://packagist.org/downloads/",
|
395 |
+
"license": [
|
396 |
+
"BSD-3-Clause"
|
397 |
+
],
|
398 |
+
"authors": [
|
399 |
+
{
|
400 |
+
"name": "Neuman Vong",
|
401 |
+
"email": "neuman+pear@twilio.com",
|
402 |
+
"role": "Developer"
|
403 |
+
},
|
404 |
+
{
|
405 |
+
"name": "Anant Narayanan",
|
406 |
+
"email": "anant@php.net",
|
407 |
+
"role": "Developer"
|
408 |
+
}
|
409 |
+
],
|
410 |
+
"description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
|
411 |
+
"homepage": "https://github.com/firebase/php-jwt"
|
412 |
+
},
|
413 |
+
{
|
414 |
+
"name": "google/auth",
|
415 |
+
"version": "v1.0",
|
416 |
+
"version_normalized": "1.0.0.0",
|
417 |
+
"source": {
|
418 |
+
"type": "git",
|
419 |
+
"url": "https://github.com/google/google-auth-library-php.git",
|
420 |
+
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df"
|
421 |
+
},
|
422 |
+
"dist": {
|
423 |
+
"type": "zip",
|
424 |
+
"url": "https://api.github.com/repos/google/google-auth-library-php/zipball/db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
425 |
+
"reference": "db77bd2de0bcc40bf50ebe851e9eed332aeaa4df",
|
426 |
+
"shasum": ""
|
427 |
+
},
|
428 |
+
"require": {
|
429 |
+
"firebase/php-jwt": "~2.0|~3.0|~4.0",
|
430 |
+
"guzzlehttp/guzzle": "~5.3.1|~6.0",
|
431 |
+
"guzzlehttp/psr7": "~1.2",
|
432 |
+
"php": ">=5.4",
|
433 |
+
"psr/cache": "^1.0",
|
434 |
+
"psr/http-message": "^1.0"
|
435 |
+
},
|
436 |
+
"require-dev": {
|
437 |
+
"friendsofphp/php-cs-fixer": "^1.11",
|
438 |
+
"phpunit/phpunit": "3.7.*"
|
439 |
+
},
|
440 |
+
"time": "2017-06-13T18:00:07+00:00",
|
441 |
+
"type": "library",
|
442 |
+
"installation-source": "dist",
|
443 |
+
"autoload": {
|
444 |
+
"classmap": [
|
445 |
+
"src/"
|
446 |
+
],
|
447 |
+
"psr-4": {
|
448 |
+
"Google\\Auth\\": "src"
|
449 |
+
}
|
450 |
+
},
|
451 |
+
"notification-url": "https://packagist.org/downloads/",
|
452 |
+
"license": [
|
453 |
+
"Apache-2.0"
|
454 |
+
],
|
455 |
+
"description": "Google Auth Library for PHP",
|
456 |
+
"homepage": "http://github.com/google/google-auth-library-php",
|
457 |
+
"keywords": [
|
458 |
+
"Authentication",
|
459 |
+
"google",
|
460 |
+
"oauth2"
|
461 |
+
]
|
462 |
+
},
|
463 |
+
{
|
464 |
+
"name": "google/apiclient-services",
|
465 |
+
"version": "v0.13",
|
466 |
+
"version_normalized": "0.13.0.0",
|
467 |
+
"source": {
|
468 |
+
"type": "git",
|
469 |
+
"url": "https://github.com/google/google-api-php-client-services.git",
|
470 |
+
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171"
|
471 |
+
},
|
472 |
+
"dist": {
|
473 |
+
"type": "zip",
|
474 |
+
"url": "https://api.github.com/repos/google/google-api-php-client-services/zipball/0805897f3435f9eea73ce21da9d55f51c69c1171",
|
475 |
+
"reference": "0805897f3435f9eea73ce21da9d55f51c69c1171",
|
476 |
+
"shasum": ""
|
477 |
+
},
|
478 |
+
"require": {
|
479 |
+
"php": ">=5.4"
|
480 |
+
},
|
481 |
+
"require-dev": {
|
482 |
+
"phpunit/phpunit": "~4.8"
|
483 |
+
},
|
484 |
+
"time": "2017-07-07T16:01:27+00:00",
|
485 |
+
"type": "library",
|
486 |
+
"installation-source": "dist",
|
487 |
+
"autoload": {
|
488 |
+
"psr-0": {
|
489 |
+
"Google_Service_": "src"
|
490 |
+
}
|
491 |
+
},
|
492 |
+
"notification-url": "https://packagist.org/downloads/",
|
493 |
+
"license": [
|
494 |
+
"Apache-2.0"
|
495 |
+
],
|
496 |
+
"description": "Client library for Google APIs",
|
497 |
+
"homepage": "http://developers.google.com/api-client-library/php",
|
498 |
+
"keywords": [
|
499 |
+
"google"
|
500 |
+
]
|
501 |
+
},
|
502 |
+
{
|
503 |
+
"name": "psr/log",
|
504 |
+
"version": "1.0.0",
|
505 |
+
"version_normalized": "1.0.0.0",
|
506 |
+
"source": {
|
507 |
+
"type": "git",
|
508 |
+
"url": "https://github.com/php-fig/log.git",
|
509 |
+
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
510 |
+
},
|
511 |
+
"dist": {
|
512 |
+
"type": "zip",
|
513 |
+
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
514 |
+
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
515 |
+
"shasum": ""
|
516 |
+
},
|
517 |
+
"time": "2012-12-21T11:40:51+00:00",
|
518 |
+
"type": "library",
|
519 |
+
"installation-source": "dist",
|
520 |
+
"autoload": {
|
521 |
+
"psr-0": {
|
522 |
+
"Psr\\Log\\": ""
|
523 |
+
}
|
524 |
+
},
|
525 |
+
"notification-url": "https://packagist.org/downloads/",
|
526 |
+
"license": [
|
527 |
+
"MIT"
|
528 |
+
],
|
529 |
+
"authors": [
|
530 |
+
{
|
531 |
+
"name": "PHP-FIG",
|
532 |
+
"homepage": "http://www.php-fig.org/"
|
533 |
+
}
|
534 |
+
],
|
535 |
+
"description": "Common interface for logging libraries",
|
536 |
+
"keywords": [
|
537 |
+
"log",
|
538 |
+
"psr",
|
539 |
+
"psr-3"
|
540 |
+
]
|
541 |
+
},
|
542 |
+
{
|
543 |
+
"name": "monolog/monolog",
|
544 |
+
"version": "1.17.0",
|
545 |
+
"version_normalized": "1.17.0.0",
|
546 |
+
"source": {
|
547 |
+
"type": "git",
|
548 |
+
"url": "https://github.com/Seldaek/monolog.git",
|
549 |
+
"reference": "877ae631713cc961952df713ae785735b90df682"
|
550 |
+
},
|
551 |
+
"dist": {
|
552 |
+
"type": "zip",
|
553 |
+
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/877ae631713cc961952df713ae785735b90df682",
|
554 |
+
"reference": "877ae631713cc961952df713ae785735b90df682",
|
555 |
+
"shasum": ""
|
556 |
+
},
|
557 |
+
"require": {
|
558 |
+
"php": ">=5.3.0",
|
559 |
+
"psr/log": "~1.0"
|
560 |
+
},
|
561 |
+
"provide": {
|
562 |
+
"psr/log-implementation": "1.0.0"
|
563 |
+
},
|
564 |
+
"require-dev": {
|
565 |
+
"aws/aws-sdk-php": "^2.4.9",
|
566 |
+
"doctrine/couchdb": "~1.0@dev",
|
567 |
+
"graylog2/gelf-php": "~1.0",
|
568 |
+
"php-console/php-console": "^3.1.3",
|
569 |
+
"phpunit/phpunit": "~4.5",
|
570 |
+
"phpunit/phpunit-mock-objects": "2.3.0",
|
571 |
+
"raven/raven": "~0.11",
|
572 |
+
"ruflin/elastica": ">=0.90 <3.0",
|
573 |
+
"swiftmailer/swiftmailer": "~5.3",
|
574 |
+
"videlalvaro/php-amqplib": "~2.4"
|
575 |
+
},
|
576 |
+
"suggest": {
|
577 |
+
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
578 |
+
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
579 |
+
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
580 |
+
"ext-mongo": "Allow sending log messages to a MongoDB server",
|
581 |
+
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
582 |
+
"php-console/php-console": "Allow sending log messages to Google Chrome",
|
583 |
+
"raven/raven": "Allow sending log messages to a Sentry server",
|
584 |
+
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
585 |
+
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
|
586 |
+
"videlalvaro/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib"
|
587 |
+
},
|
588 |
+
"time": "2015-08-30T11:40:25+00:00",
|
589 |
+
"type": "library",
|
590 |
+
"extra": {
|
591 |
+
"branch-alias": {
|
592 |
+
"dev-master": "1.16.x-dev"
|
593 |
+
}
|
594 |
+
},
|
595 |
+
"installation-source": "dist",
|
596 |
+
"autoload": {
|
597 |
+
"psr-4": {
|
598 |
+
"Monolog\\": "src/Monolog"
|
599 |
+
}
|
600 |
+
},
|
601 |
+
"notification-url": "https://packagist.org/downloads/",
|
602 |
+
"license": [
|
603 |
+
"MIT"
|
604 |
+
],
|
605 |
+
"authors": [
|
606 |
+
{
|
607 |
+
"name": "Jordi Boggiano",
|
608 |
+
"email": "j.boggiano@seld.be",
|
609 |
+
"homepage": "http://seld.be"
|
610 |
+
}
|
611 |
+
],
|
612 |
+
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
613 |
+
"homepage": "http://github.com/Seldaek/monolog",
|
614 |
+
"keywords": [
|
615 |
+
"log",
|
616 |
+
"logging",
|
617 |
+
"psr-3"
|
618 |
+
]
|
619 |
+
},
|
620 |
+
{
|
621 |
+
"name": "phpseclib/phpseclib",
|
622 |
+
"version": "0.3.10",
|
623 |
+
"version_normalized": "0.3.10.0",
|
624 |
+
"source": {
|
625 |
+
"type": "git",
|
626 |
+
"url": "https://github.com/phpseclib/phpseclib.git",
|
627 |
+
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4"
|
628 |
+
},
|
629 |
+
"dist": {
|
630 |
+
"type": "zip",
|
631 |
+
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
632 |
+
"reference": "d15bba1edcc7c89e09cc74c5d961317a8b947bf4",
|
633 |
+
"shasum": ""
|
634 |
+
},
|
635 |
+
"require": {
|
636 |
+
"php": ">=5.0.0"
|
637 |
+
},
|
638 |
+
"require-dev": {
|
639 |
+
"phing/phing": "~2.7",
|
640 |
+
"phpunit/phpunit": "~4.0",
|
641 |
+
"sami/sami": "~2.0",
|
642 |
+
"squizlabs/php_codesniffer": "~1.5"
|
643 |
+
},
|
644 |
+
"suggest": {
|
645 |
+
"ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
|
646 |
+
"ext-mcrypt": "Install the Mcrypt extension in order to speed up a wide variety of cryptographic operations.",
|
647 |
+
"pear-pear/PHP_Compat": "Install PHP_Compat to get phpseclib working on PHP < 4.3.3."
|
648 |
+
},
|
649 |
+
"time": "2015-01-28T21:50:33+00:00",
|
650 |
+
"type": "library",
|
651 |
+
"extra": {
|
652 |
+
"branch-alias": {
|
653 |
+
"dev-master": "0.3-dev"
|
654 |
+
}
|
655 |
+
},
|
656 |
+
"installation-source": "dist",
|
657 |
+
"autoload": {
|
658 |
+
"psr-0": {
|
659 |
+
"Crypt": "phpseclib/",
|
660 |
+
"File": "phpseclib/",
|
661 |
+
"Math": "phpseclib/",
|
662 |
+
"Net": "phpseclib/",
|
663 |
+
"System": "phpseclib/"
|
664 |
+
},
|
665 |
+
"files": [
|
666 |
+
"phpseclib/Crypt/Random.php"
|
667 |
+
]
|
668 |
+
},
|
669 |
+
"notification-url": "https://packagist.org/downloads/",
|
670 |
+
"include-path": [
|
671 |
+
"phpseclib/"
|
672 |
+
],
|
673 |
+
"license": [
|
674 |
+
"MIT"
|
675 |
+
],
|
676 |
+
"authors": [
|
677 |
+
{
|
678 |
+
"name": "Jim Wigginton",
|
679 |
+
"email": "terrafrost@php.net",
|
680 |
+
"role": "Lead Developer"
|
681 |
+
},
|
682 |
+
{
|
683 |
+
"name": "Patrick Monnerat",
|
684 |
+
"email": "pm@datasphere.ch",
|
685 |
+
"role": "Developer"
|
686 |
+
},
|
687 |
+
{
|
688 |
+
"name": "Andreas Fischer",
|
689 |
+
"email": "bantu@phpbb.com",
|
690 |
+
"role": "Developer"
|
691 |
+
},
|
692 |
+
{
|
693 |
+
"name": "Hans-Jürgen Petrich",
|
694 |
+
"email": "petrich@tronic-media.com",
|
695 |
+
"role": "Developer"
|
696 |
+
}
|
697 |
+
],
|
698 |
+
"description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
|
699 |
+
"homepage": "http://phpseclib.sourceforge.net",
|
700 |
+
"keywords": [
|
701 |
+
"BigInteger",
|
702 |
+
"aes",
|
703 |
+
"asn.1",
|
704 |
+
"asn1",
|
705 |
+
"blowfish",
|
706 |
+
"crypto",
|
707 |
+
"cryptography",
|
708 |
+
"encryption",
|
709 |
+
"rsa",
|
710 |
+
"security",
|
711 |
+
"sftp",
|
712 |
+
"signature",
|
713 |
+
"signing",
|
714 |
+
"ssh",
|
715 |
+
"twofish",
|
716 |
+
"x.509",
|
717 |
+
"x509"
|
718 |
+
]
|
719 |
+
}
|
720 |
+
]
|
google/vendor/firebase/php-jwt/Firebase/PHP-JWT/.gitignore
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
vendor
|
2 |
-
phpunit.phar
|
3 |
-
phpunit.phar.asc
|
1 |
+
vendor
|
2 |
+
phpunit.phar
|
3 |
+
phpunit.phar.asc
|
google/vendor/firebase/php-jwt/Firebase/PHP-JWT/.travis.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
language: php
|
2 |
-
|
3 |
-
php:
|
4 |
-
- 5.3
|
5 |
-
- 5.4
|
6 |
-
- 5.5
|
7 |
-
- hhvm
|
8 |
-
|
9 |
-
before_script:
|
10 |
-
- wget -nc http://getcomposer.org/composer.phar
|
11 |
-
- php composer.phar install
|
12 |
-
|
13 |
-
script: phpunit --configuration phpunit.xml.dist
|
1 |
+
language: php
|
2 |
+
|
3 |
+
php:
|
4 |
+
- 5.3
|
5 |
+
- 5.4
|
6 |
+
- 5.5
|
7 |
+
- hhvm
|
8 |
+
|
9 |
+
before_script:
|
10 |
+
- wget -nc http://getcomposer.org/composer.phar
|
11 |
+
- php composer.phar install
|
12 |
+
|
13 |
+
script: phpunit --configuration phpunit.xml.dist
|
google/vendor/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php
CHANGED
@@ -1,326 +1,326 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* JSON Web Token implementation, based on this spec:
|
5 |
-
* http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
|
6 |
-
*
|
7 |
-
* PHP version 5
|
8 |
-
*
|
9 |
-
* @category Authentication
|
10 |
-
* @package Authentication_JWT
|
11 |
-
* @author Neuman Vong <neuman@twilio.com>
|
12 |
-
* @author Anant Narayanan <anant@php.net>
|
13 |
-
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
|
14 |
-
* @link https://github.com/firebase/php-jwt
|
15 |
-
*/
|
16 |
-
class JWT
|
17 |
-
{
|
18 |
-
public static $supported_algs = array(
|
19 |
-
'HS256' => array('hash_hmac', 'SHA256'),
|
20 |
-
'HS512' => array('hash_hmac', 'SHA512'),
|
21 |
-
'HS384' => array('hash_hmac', 'SHA384'),
|
22 |
-
'RS256' => array('openssl', 'SHA256'),
|
23 |
-
);
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Decodes a JWT string into a PHP object.
|
27 |
-
*
|
28 |
-
* @param string $jwt The JWT
|
29 |
-
* @param string|Array|null $key The secret key, or map of keys
|
30 |
-
* @param Array $allowed_algs List of supported verification algorithms
|
31 |
-
*
|
32 |
-
* @return object The JWT's payload as a PHP object
|
33 |
-
*
|
34 |
-
* @throws DomainException Algorithm was not provided
|
35 |
-
* @throws UnexpectedValueException Provided JWT was invalid
|
36 |
-
* @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed
|
37 |
-
* @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf'
|
38 |
-
* @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat'
|
39 |
-
* @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim
|
40 |
-
*
|
41 |
-
* @uses jsonDecode
|
42 |
-
* @uses urlsafeB64Decode
|
43 |
-
*/
|
44 |
-
public static function decode($jwt, $key = null, $allowed_algs = array())
|
45 |
-
{
|
46 |
-
$tks = explode('.', $jwt);
|
47 |
-
if (count($tks) != 3) {
|
48 |
-
throw new UnexpectedValueException('Wrong number of segments');
|
49 |
-
}
|
50 |
-
list($headb64, $bodyb64, $cryptob64) = $tks;
|
51 |
-
if (null === ($header = JWT::jsonDecode(JWT::urlsafeB64Decode($headb64)))) {
|
52 |
-
throw new UnexpectedValueException('Invalid header encoding');
|
53 |
-
}
|
54 |
-
if (null === $payload = JWT::jsonDecode(JWT::urlsafeB64Decode($bodyb64))) {
|
55 |
-
throw new UnexpectedValueException('Invalid claims encoding');
|
56 |
-
}
|
57 |
-
$sig = JWT::urlsafeB64Decode($cryptob64);
|
58 |
-
if (isset($key)) {
|
59 |
-
if (empty($header->alg)) {
|
60 |
-
throw new DomainException('Empty algorithm');
|
61 |
-
}
|
62 |
-
if (empty(self::$supported_algs[$header->alg])) {
|
63 |
-
throw new DomainException('Algorithm not supported');
|
64 |
-
}
|
65 |
-
if (!is_array($allowed_algs) || !in_array($header->alg, $allowed_algs)) {
|
66 |
-
throw new DomainException('Algorithm not allowed');
|
67 |
-
}
|
68 |
-
if (is_array($key)) {
|
69 |
-
if (isset($header->kid)) {
|
70 |
-
$key = $key[$header->kid];
|
71 |
-
} else {
|
72 |
-
throw new DomainException('"kid" empty, unable to lookup correct key');
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
// Check the signature
|
77 |
-
if (!JWT::verify("$headb64.$bodyb64", $sig, $key, $header->alg)) {
|
78 |
-
throw new SignatureInvalidException('Signature verification failed');
|
79 |
-
}
|
80 |
-
|
81 |
-
// Check if the nbf if it is defined. This is the time that the
|
82 |
-
// token can actually be used. If it's not yet that time, abort.
|
83 |
-
if (isset($payload->nbf) && $payload->nbf > time()) {
|
84 |
-
throw new BeforeValidException(
|
85 |
-
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->nbf)
|
86 |
-
);
|
87 |
-
}
|
88 |
-
|
89 |
-
// Check that this token has been created before 'now'. This prevents
|
90 |
-
// using tokens that have been created for later use (and haven't
|
91 |
-
// correctly used the nbf claim).
|
92 |
-
if (isset($payload->iat) && $payload->iat > time()) {
|
93 |
-
throw new BeforeValidException(
|
94 |
-
'Cannot handle token prior to ' . date(DateTime::ISO8601, $payload->iat)
|
95 |
-
);
|
96 |
-
}
|
97 |
-
|
98 |
-
// Check if this token has expired.
|
99 |
-
if (isset($payload->exp) && time() >= $payload->exp) {
|
100 |
-
throw new ExpiredException('Expired token');
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
return $payload;
|
105 |
-
}
|
106 |
-
|
107 |
-
/**
|
108 |
-
* Converts and signs a PHP object or array into a JWT string.
|
109 |
-
*
|
110 |
-
* @param object|array $payload PHP object or array
|
111 |
-
* @param string $key The secret key
|
112 |
-
* @param string $alg The signing algorithm. Supported
|
113 |
-
* algorithms are 'HS256', 'HS384' and 'HS512'
|
114 |
-
*
|
115 |
-
* @return string A signed JWT
|
116 |
-
* @uses jsonEncode
|
117 |
-
* @uses urlsafeB64Encode
|
118 |
-
*/
|
119 |
-
public static function encode($payload, $key, $alg = 'HS256', $keyId = null)
|
120 |
-
{
|
121 |
-
$header = array('typ' => 'JWT', 'alg' => $alg);
|
122 |
-
if ($keyId !== null) {
|
123 |
-
$header['kid'] = $keyId;
|
124 |
-
}
|
125 |
-
$segments = array();
|
126 |
-
$segments[] = JWT::urlsafeB64Encode(JWT::jsonEncode($header));
|
127 |
-
$segments[] = JWT::urlsafeB64Encode(JWT::jsonEncode($payload));
|
128 |
-
$signing_input = implode('.', $segments);
|
129 |
-
|
130 |
-
$signature = JWT::sign($signing_input, $key, $alg);
|
131 |
-
$segments[] = JWT::urlsafeB64Encode($signature);
|
132 |
-
|
133 |
-
return implode('.', $segments);
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Sign a string with a given key and algorithm.
|
138 |
-
*
|
139 |
-
* @param string $msg The message to sign
|
140 |
-
* @param string|resource $key The secret key
|
141 |
-
* @param string $alg The signing algorithm. Supported algorithms
|
142 |
-
* are 'HS256', 'HS384', 'HS512' and 'RS256'
|
143 |
-
*
|
144 |
-
* @return string An encrypted message
|
145 |
-
* @throws DomainException Unsupported algorithm was specified
|
146 |
-
*/
|
147 |
-
public static function sign($msg, $key, $alg = 'HS256')
|
148 |
-
{
|
149 |
-
if (empty(self::$supported_algs[$alg])) {
|
150 |
-
throw new DomainException('Algorithm not supported');
|
151 |
-
}
|
152 |
-
list($function, $algorithm) = self::$supported_algs[$alg];
|
153 |
-
switch($function) {
|
154 |
-
case 'hash_hmac':
|
155 |
-
return hash_hmac($algorithm, $msg, $key, true);
|
156 |
-
case 'openssl':
|
157 |
-
$signature = '';
|
158 |
-
$success = openssl_sign($msg, $signature, $key, $algorithm);
|
159 |
-
if (!$success) {
|
160 |
-
throw new DomainException("OpenSSL unable to sign data");
|
161 |
-
} else {
|
162 |
-
return $signature;
|
163 |
-
}
|
164 |
-
}
|
165 |
-
}
|
166 |
-
|
167 |
-
/**
|
168 |
-
* Verify a signature with the mesage, key and method. Not all methods
|
169 |
-
* are symmetric, so we must have a separate verify and sign method.
|
170 |
-
* @param string $msg the original message
|
171 |
-
* @param string $signature
|
172 |
-
* @param string|resource $key for HS*, a string key works. for RS*, must be a resource of an openssl public key
|
173 |
-
* @param string $alg
|
174 |
-
* @return bool
|
175 |
-
* @throws DomainException Invalid Algorithm or OpenSSL failure
|
176 |
-
*/
|
177 |
-
private static function verify($msg, $signature, $key, $alg)
|
178 |
-
{
|
179 |
-
if (empty(self::$supported_algs[$alg])) {
|
180 |
-
throw new DomainException('Algorithm not supported');
|
181 |
-
}
|
182 |
-
|
183 |
-
list($function, $algorithm) = self::$supported_algs[$alg];
|
184 |
-
switch($function) {
|
185 |
-
case 'openssl':
|
186 |
-
$success = openssl_verify($msg, $signature, $key, $algorithm);
|
187 |
-
if (!$success) {
|
188 |
-
throw new DomainException("OpenSSL unable to verify data: " . openssl_error_string());
|
189 |
-
} else {
|
190 |
-
return $signature;
|
191 |
-
}
|
192 |
-
case 'hash_hmac':
|
193 |
-
default:
|
194 |
-
$hash = hash_hmac($algorithm, $msg, $key, true);
|
195 |
-
if (function_exists('hash_equals')) {
|
196 |
-
return hash_equals($signature, $hash);
|
197 |
-
}
|
198 |
-
$len = min(self::safeStrlen($signature), self::safeStrlen($hash));
|
199 |
-
|
200 |
-
$status = 0;
|
201 |
-
for ($i = 0; $i < $len; $i++) {
|
202 |
-
$status |= (ord($signature[$i]) ^ ord($hash[$i]));
|
203 |
-
}
|
204 |
-
$status |= (self::safeStrlen($signature) ^ self::safeStrlen($hash));
|
205 |
-
|
206 |
-
return ($status === 0);
|
207 |
-
}
|
208 |
-
}
|
209 |
-
|
210 |
-
/**
|
211 |
-
* Decode a JSON string into a PHP object.
|
212 |
-
*
|
213 |
-
* @param string $input JSON string
|
214 |
-
*
|
215 |
-
* @return object Object representation of JSON string
|
216 |
-
* @throws DomainException Provided string was invalid JSON
|
217 |
-
*/
|
218 |
-
public static function jsonDecode($input)
|
219 |
-
{
|
220 |
-
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
221 |
-
/** In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you
|
222 |
-
* to specify that large ints (like Steam Transaction IDs) should be treated as
|
223 |
-
* strings, rather than the PHP default behaviour of converting them to floats.
|
224 |
-
*/
|
225 |
-
$obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
|
226 |
-
} else {
|
227 |
-
/** Not all servers will support that, however, so for older versions we must
|
228 |
-
* manually detect large ints in the JSON string and quote them (thus converting
|
229 |
-
*them to strings) before decoding, hence the preg_replace() call.
|
230 |
-
*/
|
231 |
-
$max_int_length = strlen((string) PHP_INT_MAX) - 1;
|
232 |
-
$json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
|
233 |
-
$obj = json_decode($json_without_bigints);
|
234 |
-
}
|
235 |
-
|
236 |
-
if (function_exists('json_last_error') && $errno = json_last_error()) {
|
237 |
-
JWT::handleJsonError($errno);
|
238 |
-
} elseif ($obj === null && $input !== 'null') {
|
239 |
-
throw new DomainException('Null result with non-null input');
|
240 |
-
}
|
241 |
-
return $obj;
|
242 |
-
}
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Encode a PHP object into a JSON string.
|
246 |
-
*
|
247 |
-
* @param object|array $input A PHP object or array
|
248 |
-
*
|
249 |
-
* @return string JSON representation of the PHP object or array
|
250 |
-
* @throws DomainException Provided object could not be encoded to valid JSON
|
251 |
-
*/
|
252 |
-
public static function jsonEncode($input)
|
253 |
-
{
|
254 |
-
$json = json_encode($input);
|
255 |
-
if (function_exists('json_last_error') && $errno = json_last_error()) {
|
256 |
-
JWT::handleJsonError($errno);
|
257 |
-
} elseif ($json === 'null' && $input !== null) {
|
258 |
-
throw new DomainException('Null result with non-null input');
|
259 |
-
}
|
260 |
-
return $json;
|
261 |
-
}
|
262 |
-
|
263 |
-
/**
|
264 |
-
* Decode a string with URL-safe Base64.
|
265 |
-
*
|
266 |
-
* @param string $input A Base64 encoded string
|
267 |
-
*
|
268 |
-
* @return string A decoded string
|
269 |
-
*/
|
270 |
-
public static function urlsafeB64Decode($input)
|
271 |
-
{
|
272 |
-
$remainder = strlen($input) % 4;
|
273 |
-
if ($remainder) {
|
274 |
-
$padlen = 4 - $remainder;
|
275 |
-
$input .= str_repeat('=', $padlen);
|
276 |
-
}
|
277 |
-
return base64_decode(strtr($input, '-_', '+/'));
|
278 |
-
}
|
279 |
-
|
280 |
-
/**
|
281 |
-
* Encode a string with URL-safe Base64.
|
282 |
-
*
|
283 |
-
* @param string $input The string you want encoded
|
284 |
-
*
|
285 |
-
* @return string The base64 encode of what you passed in
|
286 |
-
*/
|
287 |
-
public static function urlsafeB64Encode($input)
|
288 |
-
{
|
289 |
-
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
|
290 |
-
}
|
291 |
-
|
292 |
-
/**
|
293 |
-
* Helper method to create a JSON error.
|
294 |
-
*
|
295 |
-
* @param int $errno An error number from json_last_error()
|
296 |
-
*
|
297 |
-
* @return void
|
298 |
-
*/
|
299 |
-
private static function handleJsonError($errno)
|
300 |
-
{
|
301 |
-
$messages = array(
|
302 |
-
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
|
303 |
-
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
|
304 |
-
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
|
305 |
-
);
|
306 |
-
throw new DomainException(
|
307 |
-
isset($messages[$errno])
|
308 |
-
? $messages[$errno]
|
309 |
-
: 'Unknown JSON error: ' . $errno
|
310 |
-
);
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Get the number of bytes in cryptographic strings.
|
315 |
-
*
|
316 |
-
* @param string
|
317 |
-
* @return int
|
318 |
-
*/
|
319 |
-
private static function safeStrlen($str)
|
320 |
-
{
|
321 |
-
if (function_exists('mb_strlen')) {
|
322 |
-
return mb_strlen($str, '8bit');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|