BackupGuardFree - Version 1.0.0

Version Notes

Fully functional stable version

Download this release

Release Info

Developer Backup Guard
Extension BackupGuardFree
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (107) hide show
  1. app/code/community/BackupGuard/BackupGuardFree/.DS_Store +0 -0
  2. app/code/community/BackupGuard/BackupGuardFree/Helper/.DS_Store +0 -0
  3. app/code/community/BackupGuard/BackupGuardFree/Helper/Data.php +6 -0
  4. app/code/community/BackupGuard/BackupGuardFree/Model/.DS_Store +0 -0
  5. app/code/community/BackupGuard/BackupGuardFree/Model/Resource/.DS_Store +0 -0
  6. app/code/community/BackupGuard/BackupGuardFree/Model/Resource/Mysql4/.DS_Store +0 -0
  7. app/code/community/BackupGuard/BackupGuardFree/Model/Resource/Mysql4/Setup.php +6 -0
  8. app/code/community/BackupGuard/BackupGuardFree/com/.DS_Store +0 -0
  9. app/code/community/BackupGuard/BackupGuardFree/com/boot.php +6 -0
  10. app/code/community/BackupGuard/BackupGuardFree/com/config/.DS_Store +0 -0
  11. app/code/community/BackupGuard/BackupGuardFree/com/config/config.magento.free.php +9 -0
  12. app/code/community/BackupGuard/BackupGuardFree/com/config/config.magento.php +48 -0
  13. app/code/community/BackupGuard/BackupGuardFree/com/config/config.php +70 -0
  14. app/code/community/BackupGuard/BackupGuardFree/com/core/.DS_Store +0 -0
  15. app/code/community/BackupGuard/BackupGuardFree/com/core/SGBoot.php +194 -0
  16. app/code/community/BackupGuard/BackupGuardFree/com/core/SGConfig.php +67 -0
  17. app/code/community/BackupGuard/BackupGuardFree/com/core/backup/.DS_Store +0 -0
  18. app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackup.php +741 -0
  19. app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackupDatabase.php +238 -0
  20. app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackupFiles.php +336 -0
  21. app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackupLog.php +58 -0
  22. app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGIBackupDelegate.php +8 -0
  23. app/code/community/BackupGuard/BackupGuardFree/com/core/database/.DS_Store +0 -0
  24. app/code/community/BackupGuard/BackupGuardFree/com/core/database/SGDatabase.php +34 -0
  25. app/code/community/BackupGuard/BackupGuardFree/com/core/database/SGDatabaseAdapterMagento.php +64 -0
  26. app/code/community/BackupGuard/BackupGuardFree/com/core/database/SGIDatabaseAdapter.php +31 -0
  27. app/code/community/BackupGuard/BackupGuardFree/com/core/exception/SGException.php +65 -0
  28. app/code/community/BackupGuard/BackupGuardFree/com/core/exception/SGExceptionHandler.php +22 -0
  29. app/code/community/BackupGuard/BackupGuardFree/com/core/functions.php +137 -0
  30. app/code/community/BackupGuard/BackupGuardFree/com/core/log/.DS_Store +0 -0
  31. app/code/community/BackupGuard/BackupGuardFree/com/core/log/SGFileLogHandler.php +70 -0
  32. app/code/community/BackupGuard/BackupGuardFree/com/core/log/SGILogHandler.php +10 -0
  33. app/code/community/BackupGuard/BackupGuardFree/com/core/log/SGLog.php +94 -0
  34. app/code/community/BackupGuard/BackupGuardFree/com/lib/.DS_Store +0 -0
  35. app/code/community/BackupGuard/BackupGuardFree/com/lib/BigInteger.php +3758 -0
  36. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/.DS_Store +0 -0
  37. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AppInfo.php +238 -0
  38. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AppInfoLoadException.php +18 -0
  39. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/ArrayEntryStore.php +61 -0
  40. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AuthBase.php +75 -0
  41. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AuthInfo.php +85 -0
  42. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AuthInfoLoadException.php +18 -0
  43. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Checker.php +94 -0
  44. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Client.php +1509 -0
  45. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Curl.php +126 -0
  46. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/CurlStreamRelay.php +45 -0
  47. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/DeserializeException.php +19 -0
  48. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/DropboxMetadataHeaderCatcher.php +83 -0
  49. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception.php +16 -0
  50. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/BadRequest.php +17 -0
  51. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/BadResponse.php +17 -0
  52. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/BadResponseCode.php +33 -0
  53. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/InvalidAccessToken.php +18 -0
  54. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/NetworkIO.php +16 -0
  55. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/ProtocolError.php +17 -0
  56. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/RetryLater.php +17 -0
  57. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/ServerError.php +15 -0
  58. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Host.php +99 -0
  59. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/HttpResponse.php +17 -0
  60. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/OAuth1AccessToken.php +61 -0
  61. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/OAuth1Upgrader.php +104 -0
  62. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Path.php +171 -0
  63. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/RequestUtil.php +301 -0
  64. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/RootCertificates.php +144 -0
  65. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/SSLTester.php +128 -0
  66. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Security.php +67 -0
  67. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/StreamReadException.php +16 -0
  68. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Util.php +33 -0
  69. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/ValueStore.php +61 -0
  70. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuth.php +273 -0
  71. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthBase.php +63 -0
  72. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/BadRequest.php +20 -0
  73. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/BadState.php +19 -0
  74. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/Csrf.php +21 -0
  75. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/NotApproved.php +18 -0
  76. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/Provider.php +18 -0
  77. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthNoRedirect.php +82 -0
  78. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WriteMode.php +116 -0
  79. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/autoload.php +31 -0
  80. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/certs/trusted-certs.crt +1396 -0
  81. app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/strict.php +13 -0
  82. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/.DS_Store +0 -0
  83. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/Google_Client.php +471 -0
  84. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_AssertionCredentials.php +103 -0
  85. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_Auth.php +36 -0
  86. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_AuthNone.php +48 -0
  87. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_LoginTicket.php +63 -0
  88. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_OAuth2.php +453 -0
  89. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_P12Signer.php +70 -0
  90. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_PemVerifier.php +66 -0
  91. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_Signer.php +30 -0
  92. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_Verifier.php +31 -0
  93. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_ApcCache.php +98 -0
  94. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_Cache.php +55 -0
  95. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_FileCache.php +137 -0
  96. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_MemcacheCache.php +130 -0
  97. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/config.php +81 -0
  98. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdExchangeSellerService.php +1262 -0
  99. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdSenseService.php +2054 -0
  100. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdexchangebuyerService.php +867 -0
  101. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdsensehostService.php +1376 -0
  102. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AnalyticsService.php +4336 -0
  103. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AndroidpublisherService.php +198 -0
  104. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AppstateService.php +253 -0
  105. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AuditService.php +274 -0
  106. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_BigqueryService.php +2011 -0
  107. app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_BloggerService.php +318 -0
app/code/community/BackupGuard/BackupGuardFree/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/Helper/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BackupGuard_BackupGuardFree_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/community/BackupGuard/BackupGuardFree/Model/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/Model/Resource/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/Model/Resource/Mysql4/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/Model/Resource/Mysql4/Setup.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class BackupGuard_BackupGuardFree_Model_Resource_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
4
+ {
5
+
6
+ }
app/code/community/BackupGuard/BackupGuardFree/com/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/boot.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/config/config.magento.free.php');
3
+ require_once(dirname(__FILE__).'/config/config.magento.php');
4
+ require_once(SG_CORE_PATH.'SGBoot.php');
5
+
6
+ SGBoot::init();
app/code/community/BackupGuard/BackupGuardFree/com/config/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/config/config.magento.free.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ define('SG_FEATURE_NOTIFICATIONS', 0);
4
+ define('SG_FEATURE_SCHEDULE', 0);
5
+ define('SG_FEATURE_STORAGE', 0);
6
+ define('SG_FEATURE_FTP', 0);
7
+ define('SG_FEATURE_DROPBOX', 0);
8
+ define('SG_FEATURE_GOOGLE_DRIVE', 0);
9
+ define('SG_FEATURE_BACKGROUND_MODE', 0);
app/code/community/BackupGuard/BackupGuardFree/com/config/config.magento.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $m = new Mage();
3
+ $version = $m->getVersion();
4
+
5
+ define('SG_ENV_VERSION', $version);
6
+ define('SG_ENV_ADAPTER', 'Magento');
7
+ define('SG_ENV_DB_PREFIX', (string)Mage::getConfig()->getTablePrefix());
8
+
9
+ require_once(dirname(__FILE__).'/config.php');
10
+
11
+ //Database
12
+ define('SG_DB_ADAPTER', SG_ENV_ADAPTER);
13
+ define('SG_DB_NAME', (string)Mage::getConfig()->getNode('global/resources/default_setup/connection/dbname'));
14
+ define('SG_BACKUP_DATABASE_EXCLUDE', SG_ACTION_TABLE_NAME.','.SG_CONFIG_TABLE_NAME);
15
+
16
+ //Mail
17
+ define('SG_MAIL_BACKUP_TEMPLATE', 'backupguard_backup');
18
+ define('SG_MAIL_RESTORE_TEMPLATE', 'backupguard_restore');
19
+
20
+ //Backup
21
+ define('SG_APP_ROOT_DIRECTORY', Mage::getBaseDir().'/');
22
+ $excludes = array(
23
+ 'app/code/community/BackupGuard/',
24
+ 'app/etc/modules/BackupGuard_BackupGuardFree.xml',
25
+ 'app/etc/modules/BackupGuard_BackupGuard.xml',
26
+ 'app/design/adminhtml/default/default/layout/backupguardfree.xml',
27
+ 'app/design/adminhtml/default/default/layout/backupguard.xml',
28
+ 'app/design/adminhtml/default/default/template/backupguardfree/',
29
+ 'app/design/adminhtml/default/default/template/backupguard/',
30
+ 'app/locale/en_US/template/email/backupguard_backup_fail.html',
31
+ 'app/locale/en_US/template/email/backupguard_backup_success.html',
32
+ 'app/locale/en_US/template/email/backupguard_restore_fail.html',
33
+ 'app/locale/en_US/template/email/backupguard_restore_success.html',
34
+ 'skin/adminhtml/base/default/css/BackupGuardFree/',
35
+ 'skin/adminhtml/base/default/css/BackupGuard/',
36
+ 'skin/adminhtml/base/default/js/BackupGuardFree/',
37
+ 'skin/adminhtml/base/default/js/BackupGuard/',
38
+ 'skin/adminhtml/base/default/media/BackupGuardFree/',
39
+ 'skin/adminhtml/base/default/media/BackupGuard/'
40
+ );
41
+ define('SG_BACKUP_FILE_PATHS_EXCLUDE', implode(',', $excludes));
42
+ define('SG_BACKUP_DIRECTORY', SG_APP_PATH.'../sg_backups/'); //backups will be stored here
43
+
44
+ //Storage
45
+ define('SG_STORAGE_UPLOAD_CRON', '');
46
+
47
+ //The following constants can be modified at run-time
48
+ define('SG_BACKUP_FILE_PATHS', 'app,js,lib,media,skin,var'); //fix this after development
app/code/community/BackupGuard/BackupGuardFree/com/config/config.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //Version
3
+ define('SG_VERSION', '1.0.0');
4
+
5
+ //Paths
6
+ define('SG_APP_PATH', realpath(dirname(__FILE__).'/../').'/');
7
+ define('SG_CONFIG_PATH', SG_APP_PATH.'config/');
8
+ define('SG_CORE_PATH', SG_APP_PATH.'core/');
9
+ define('SG_DATABASE_PATH', SG_CORE_PATH.'database/');
10
+ define('SG_LOG_PATH', SG_CORE_PATH.'log/');
11
+ define('SG_STORAGE_PATH', SG_CORE_PATH.'storage/');
12
+ define('SG_EXCEPTION_PATH', SG_CORE_PATH.'exception/');
13
+ define('SG_BACKUP_PATH', SG_CORE_PATH.'backup/');
14
+ define('SG_LIB_PATH', SG_APP_PATH.'lib/');
15
+ define('SG_MAIL_PATH', SG_CORE_PATH.'mail/');
16
+ define('SG_SCHEDULE_PATH', SG_CORE_PATH.'schedule/');
17
+
18
+ //Log
19
+ define('SG_LOG_LEVEL_ALL', 0);
20
+ define('SG_LOG_LEVEL_HIGH', 1);
21
+ define('SG_LOG_LEVEL_MEDIUM', 2);
22
+ define('SG_LOG_LEVEL_LOW', 4);
23
+ define('SG_BACKUP_LOG_POS_START', 1);
24
+ define('SG_BACKUP_LOG_POS_END', 2);
25
+
26
+ //Backup
27
+ define('SG_ACTION_STATUS_CREATED', 0);
28
+ define('SG_ACTION_STATUS_IN_PROGRESS_DB', 1);
29
+ define('SG_ACTION_STATUS_IN_PROGRESS_FILES', 2);
30
+ define('SG_ACTION_STATUS_FINISHED', 3);
31
+ define('SG_ACTION_STATUS_FINISHED_WARNINGS', 4);
32
+ define('SG_ACTION_STATUS_CANCELLING', 5);
33
+ define('SG_ACTION_STATUS_CANCELLED', 6);
34
+ define('SG_ACTION_STATUS_ERROR', 7);
35
+ define('SG_ACTION_TYPE_BACKUP', 1);
36
+ define('SG_ACTION_TYPE_RESTORE', 2);
37
+ define('SG_ACTION_TYPE_UPLOAD', 3);
38
+ define('SG_ACTION_PROGRESS_UPDATE_INTERVAL', 1); //in %
39
+ define('SG_BACKUP_DATABASE_INSERT_LIMIT', 10000);
40
+ define('SG_BACKUP_DWONLOAD_TYPE_SGBP', 1);
41
+ define('SG_BACKUP_DWONLOAD_TYPE_BACKUP_LOG', 2);
42
+ define('SG_BACKUP_DWONLOAD_TYPE_RESTORE_LOG', 3);
43
+
44
+ //Mail
45
+ define('SG_MAIL_BACKUP_SUCCESS_SUBJECT', 'Backup Succeeded');
46
+ define('SG_MAIL_BACKUP_FAIL_SUBJECT', 'Backup Failed');
47
+ define('SG_MAIL_RESTORE_SUCCESS_SUBJECT', 'Restore Succeeded');
48
+ define('SG_MAIL_RESTORE_FAIL_SUBJECT', 'Restore Failed');
49
+
50
+ //Storage
51
+ define('SG_STORAGE_FTP', 1);
52
+ define('SG_STORAGE_DROPBOX', 2);
53
+ define('SG_STORAGE_GOOGLE_DRIVE', 3);
54
+ define('SG_STORAGE_GOOGLE_DRIVE_CLIENT_ID', '1030123017859-vfdlqkjhiuuu5n36pbov93v9ruo6jpj5.apps.googleusercontent.com');
55
+ define('SG_STORAGE_GOOGLE_DRIVE_SECRET', 'oUcZwC17q5ZSbYahnQkGYpyH');
56
+ define('SG_STORAGE_GOOGLE_DRIVE_REDIRECT_URI', 'https://backup-guard.com/gdrive/');
57
+ define('SG_STORAGE_DROPBOX_KEY', 'n3yhajm64h88m9t');
58
+ define('SG_STORAGE_DROPBOX_SECRET', 's8crjkls7f9wqtd');
59
+ define('SG_STORAGE_DROPBOX_CLIENT_ID', 'backup-guard');
60
+ define('SG_STORAGE_DROPBOX_REDIRECT_URI', 'https://backup-guard.com/dropbox/');
61
+
62
+ //The following constants can be modified at run-time
63
+ define('SG_ACTION_BACKUP_FILES_AVAILABLE', 1);
64
+ define('SG_ACTION_BACKUP_DATABASE_AVAILABLE', 1);
65
+ define('SG_BACKUP_IN_BACKGROUND_MODE', 0);
66
+ define('SG_BACKUP_UPLOAD_TO_STORAGES', ''); //list of storage ids separated by commas
67
+
68
+ //Database tables
69
+ define('SG_ACTION_TABLE_NAME', SG_ENV_DB_PREFIX.'sg_action');
70
+ define('SG_CONFIG_TABLE_NAME', SG_ENV_DB_PREFIX.'sg_config');
app/code/community/BackupGuard/BackupGuardFree/com/core/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/core/SGBoot.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_CORE_PATH.'functions.php');
3
+ require_once(SG_DATABASE_PATH.'SGDatabase.php');
4
+ require_once(SG_EXCEPTION_PATH.'SGExceptionHandler.php');
5
+ require_once(SG_CORE_PATH.'SGConfig.php');
6
+ @include_once(SG_SCHEDULE_PATH.'SGSchedule.php');
7
+
8
+ class SGBoot
9
+ {
10
+ public static function init()
11
+ {
12
+ //remove execution time limit
13
+ set_time_limit(0);
14
+
15
+ //set default exception handler
16
+ SGExceptionHandler::init();
17
+
18
+ //load all config variables from database
19
+ SGConfig::getAll();
20
+
21
+ try
22
+ {
23
+ //check minimum requirements
24
+ self::checkMinimumRequirements();
25
+
26
+ //prepare directory for backups
27
+ self::prepare();
28
+ }
29
+ catch (SGException $exception)
30
+ {
31
+ die($exception);
32
+ }
33
+ }
34
+
35
+ public static function install()
36
+ {
37
+ try
38
+ {
39
+ $sgdb = SGDatabase::getInstance();
40
+
41
+ //create config table
42
+ $res = $sgdb->query('DROP TABLE IF EXISTS `'.SG_CONFIG_TABLE_NAME.'`;');
43
+ if ($res===false)
44
+ {
45
+ throw new SGExceptionDatabaseError('Could not execute query');
46
+ }
47
+ $res = $sgdb->query('CREATE TABLE `'.SG_CONFIG_TABLE_NAME.'` (
48
+ `ckey` varchar(255) NOT NULL,
49
+ `cvalue` varchar(255) NOT NULL,
50
+ PRIMARY KEY (`ckey`)
51
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
52
+ if ($res===false)
53
+ {
54
+ throw new SGExceptionDatabaseError('Could not execute query');
55
+ }
56
+
57
+ //populate config table
58
+ $res = $sgdb->query("INSERT INTO `".SG_CONFIG_TABLE_NAME."` VALUES
59
+ ('SG_BACKUP_SYNCHRONOUS_STORAGE_UPLOAD','1'),
60
+ ('SG_NOTIFICATIONS_ENABLED','0'),
61
+ ('SG_NOTIFICATIONS_EMAIL_ADDRESS',''),
62
+ ('SG_STORAGE_BACKUPS_FOLDER_NAME','sg_backups');");
63
+ if ($res===false)
64
+ {
65
+ throw new SGExceptionDatabaseError('Could not execute query');
66
+ }
67
+
68
+ //create action table
69
+ $res = $sgdb->query('DROP TABLE IF EXISTS `'.SG_ACTION_TABLE_NAME.'`;');
70
+ if ($res===false)
71
+ {
72
+ throw new SGExceptionDatabaseError('Could not execute query');
73
+ }
74
+ $res = $sgdb->query("CREATE TABLE `".SG_ACTION_TABLE_NAME."` (
75
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
76
+ `name` varchar(255) NOT NULL,
77
+ `type` tinyint(3) unsigned NOT NULL,
78
+ `subtype` tinyint(3) unsigned NOT NULL DEFAULT '0',
79
+ `status` tinyint(3) unsigned NOT NULL,
80
+ `progress` tinyint(3) unsigned NOT NULL DEFAULT '0',
81
+ `start_date` datetime NOT NULL,
82
+ `update_date` datetime DEFAULT NULL,
83
+ PRIMARY KEY (`id`)
84
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
85
+ if ($res===false)
86
+ {
87
+ throw new SGExceptionDatabaseError('Could not execute query');
88
+ }
89
+
90
+ //try to create cron job for storage uploadings
91
+ /*if (self::isFeatureAvailable('SCHEDULE'))
92
+ {
93
+ if (SGSchedule::isCronAvailable() && SGSchedule::create(SG_STORAGE_UPLOAD_CRON))
94
+ {
95
+ SGConfig::set('SG_BACKUP_SYNCHRONOUS_STORAGE_UPLOAD', 0);
96
+ }
97
+ }*/
98
+ }
99
+ catch (SGException $exception)
100
+ {
101
+ die($exception);
102
+ }
103
+ }
104
+
105
+ public static function uninstall($deleteBackups = false)
106
+ {
107
+ try
108
+ {
109
+ $sgdb = SGDatabase::getInstance();
110
+
111
+ //drop config table
112
+ $res = $sgdb->query('DROP TABLE IF EXISTS `'.SG_CONFIG_TABLE_NAME.'`;');
113
+ if ($res===false)
114
+ {
115
+ throw new SGExceptionDatabaseError('Could not execute query');
116
+ }
117
+
118
+ //drop action table
119
+ $res = $sgdb->query('DROP TABLE IF EXISTS `'.SG_ACTION_TABLE_NAME.'`;');
120
+ if ($res===false)
121
+ {
122
+ throw new SGExceptionDatabaseError('Could not execute query');
123
+ }
124
+
125
+ //delete directory of backups
126
+ if ($deleteBackups)
127
+ {
128
+ $backupPath = SGConfig::get('SG_BACKUP_DIRECTORY');
129
+ deleteDirectory($backupPath);
130
+ }
131
+ }
132
+ catch (SGException $exception)
133
+ {
134
+ die($exception);
135
+ }
136
+ }
137
+
138
+ public static function checkRequirement($requirement)
139
+ {
140
+ if ($requirement=='ftp' && !extension_loaded('ftp'))
141
+ {
142
+ throw new SGExceptionNotFound('FTP extension is not loaded.');
143
+ }
144
+ else if ($requirement=='curl' && !function_exists('curl_version'))
145
+ {
146
+ throw new SGExceptionNotFound('cURL extension is not loaded.');
147
+ }
148
+ }
149
+
150
+ public static function isFeatureAvailable($feature)
151
+ {
152
+ return (SGConfig::get('SG_FEATURE_'.strtoupper($feature))===1?true:false);
153
+ }
154
+
155
+ private static function prepare()
156
+ {
157
+ $backupPath = SGConfig::get('SG_BACKUP_DIRECTORY');
158
+
159
+ //create directory for backups
160
+ if (!is_dir($backupPath))
161
+ {
162
+ if (!@mkdir($backupPath))
163
+ {
164
+ throw new SGExceptionMethodNotAllowed('Cannot create folder: '.$backupPath);
165
+ }
166
+
167
+ if (!@file_put_contents($backupPath.'.htaccess', 'deny from all'))
168
+ {
169
+ throw new SGExceptionMethodNotAllowed('Cannot create htaccess file');
170
+ }
171
+ }
172
+
173
+ //check permissions of backups directory
174
+ if (!is_writable($backupPath))
175
+ {
176
+ throw new SGExceptionForbidden('Permission denied. Directory is not writable: '.$backupPath);
177
+ }
178
+ }
179
+
180
+ private static function checkMinimumRequirements()
181
+ {
182
+ //check PHP version
183
+ if (version_compare(PHP_VERSION, '5.3.0', '<'))
184
+ {
185
+ throw new SGExceptionNotFound('PHP >=5.3.0 version required.');
186
+ }
187
+
188
+ //check ZLib library
189
+ if (!function_exists('gzdeflate'))
190
+ {
191
+ throw new SGExceptionNotFound('ZLib extension is not loaded.');
192
+ }
193
+ }
194
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/SGConfig.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SGConfig
4
+ {
5
+ private static $values = array();
6
+
7
+ public static function set($key, $value, $forced = true)
8
+ {
9
+ self::$values[$key] = $value;
10
+
11
+ if ($forced)
12
+ {
13
+ $sgdb = SGDatabase::getInstance();
14
+ $res = $sgdb->query('INSERT INTO '.SG_CONFIG_TABLE_NAME.' (ckey, cvalue) VALUES (%s, %s) ON DUPLICATE KEY UPDATE cvalue = %s', array($key, $value, $value));
15
+ return $res;
16
+ }
17
+
18
+ return true;
19
+ }
20
+
21
+ public static function get($key, $forced = false)
22
+ {
23
+ if (!$forced)
24
+ {
25
+ if (isset(self::$values[$key]))
26
+ {
27
+ return self::$values[$key];
28
+ }
29
+
30
+ if (defined($key))
31
+ {
32
+ return constant($key);
33
+ }
34
+ }
35
+
36
+ $sgdb = SGDatabase::getInstance();
37
+ $data = $sgdb->query('SELECT cvalue, NOW() FROM '.SG_CONFIG_TABLE_NAME.' WHERE ckey = %s', array($key));
38
+
39
+ if (!$data)
40
+ {
41
+ return null;
42
+ }
43
+
44
+ self::$values[$key] = $data[0]['cvalue'];
45
+ return $data[0]['cvalue'];
46
+ }
47
+
48
+ public static function getAll()
49
+ {
50
+ $sgdb = SGDatabase::getInstance();
51
+ $configs = $sgdb->query('SELECT * FROM '.SG_CONFIG_TABLE_NAME);
52
+
53
+ if (!$configs)
54
+ {
55
+ return null;
56
+ }
57
+
58
+ $currentConfigs = array();
59
+ foreach ($configs as $config)
60
+ {
61
+ self::$values[$config['ckey']] = $config['cvalue'];
62
+ $currentConfigs[$config['ckey']] = $config['cvalue'];
63
+ }
64
+
65
+ return $currentConfigs;
66
+ }
67
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/backup/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackup.php ADDED
@@ -0,0 +1,741 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_BACKUP_PATH.'SGBackupLog.php');
3
+ @include_once(SG_LIB_PATH.'SGBackgroundMode.php');
4
+ require_once(SG_BACKUP_PATH.'SGBackupFiles.php');
5
+ require_once(SG_BACKUP_PATH.'SGBackupDatabase.php');
6
+ @include_once(SG_BACKUP_PATH.'SGBackupStorage.php');
7
+ @include_once(SG_BACKUP_PATH.'SGBackupMailNotification.php');
8
+ require_once(SG_LOG_PATH.'SGFileLogHandler.php');
9
+
10
+ //close session for writing
11
+ session_write_close();
12
+
13
+ class SGBackup implements SGIBackupDelegate
14
+ {
15
+ private $backupFiles = null;
16
+ private $backupDatabase = null;
17
+ private $actionId = null;
18
+ private $filesBackupAvailable = false;
19
+ private $databaseBackupAvailable = false;
20
+ private $actionStartTs = 0;
21
+ private $fileName = '';
22
+ private $filesBackupPath = '';
23
+ private $databaseBackupPath = '';
24
+ private $backupLogPath = '';
25
+ private $restoreLogPath = '';
26
+ private $backgroundMode = false;
27
+ private $queuedStorageUploads = array();
28
+
29
+ public function __construct()
30
+ {
31
+ $this->filesBackupAvailable = SGConfig::get('SG_ACTION_BACKUP_FILES_AVAILABLE');
32
+ $this->databaseBackupAvailable = SGConfig::get('SG_ACTION_BACKUP_DATABASE_AVAILABLE');
33
+ $this->backgroundMode = SGConfig::get('SG_BACKUP_IN_BACKGROUND_MODE');
34
+
35
+ $this->backupFiles = new SGBackupFiles();
36
+ $this->backupFiles->setDelegate($this);
37
+
38
+ if ($this->databaseBackupAvailable)
39
+ {
40
+ $this->backupDatabase = new SGBackupDatabase();
41
+ $this->backupDatabase->setDelegate($this);
42
+ }
43
+ }
44
+
45
+ /* Backup implementation */
46
+
47
+ public function backup()
48
+ {
49
+ $this->fileName = self::getBackupFileName();
50
+ $this->prepareBackupFolder(SG_BACKUP_DIRECTORY.$this->fileName);
51
+
52
+ try
53
+ {
54
+ $this->prepareForBackup();
55
+
56
+ if (!$this->filesBackupAvailable)
57
+ {
58
+ SGConfig::set('SG_BACKUP_FILE_PATHS', '', false);
59
+ }
60
+
61
+ if ($this->databaseBackupAvailable)
62
+ {
63
+ $this->backupDatabase->backup($this->databaseBackupPath);
64
+
65
+ $rootDirectory = realpath(SGConfig::get('SG_APP_ROOT_DIRECTORY')).'/';
66
+ $path = substr(realpath($this->databaseBackupPath), strlen($rootDirectory));
67
+ $this->backupFiles->addDontExclude(realpath($this->databaseBackupPath));
68
+ $backupItems = SGConfig::get('SG_BACKUP_FILE_PATHS');
69
+ $allItems = $backupItems?explode(',', $backupItems):array();
70
+ $allItems[] = $path;
71
+ SGConfig::set('SG_BACKUP_FILE_PATHS', implode(',', $allItems), false);
72
+
73
+ $currentStatus = $this->getCurrentActionStatus();
74
+ if ($currentStatus==SG_ACTION_STATUS_CANCELLING || $currentStatus==SG_ACTION_STATUS_CANCELLED)
75
+ {
76
+ $this->cancel();
77
+ }
78
+
79
+ self::changeActionStatus($this->actionId, SG_ACTION_STATUS_IN_PROGRESS_FILES);
80
+ }
81
+
82
+ $this->backupFiles->backup($this->filesBackupPath);
83
+ $this->didFinishBackup();
84
+ }
85
+ catch (SGException $exception)
86
+ {
87
+ if (!$exception instanceof SGExceptionSkip)
88
+ {
89
+ SGBackupLog::writeExceptionObject($exception);
90
+
91
+ if ($this->databaseBackupAvailable)
92
+ {
93
+ $this->backupDatabase->cancel();
94
+ }
95
+
96
+ $this->backupFiles->cancel();
97
+
98
+ if (SGBoot::isFeatureAvailable('NOTIFICATIONS'))
99
+ {
100
+ SGBackupMailNotification::sendBackupNotification(false);
101
+ }
102
+
103
+ self::changeActionStatus($this->actionId, SG_ACTION_STATUS_ERROR);
104
+ }
105
+ else
106
+ {
107
+ $this->setCurrentActionStatusCancelled();
108
+ }
109
+
110
+ return;
111
+ }
112
+
113
+ $this->backupUploadToStorages();
114
+ }
115
+
116
+ private function backupUploadToStorages()
117
+ {
118
+ //check list of storages to upload if any
119
+ $uploadToStorages = SGConfig::get('SG_BACKUP_SYNCHRONOUS_STORAGE_UPLOAD');
120
+ if (SGBoot::isFeatureAvailable('STORAGE') && $uploadToStorages)
121
+ {
122
+ foreach ($this->queuedStorageUploads as $actionId)
123
+ {
124
+ SGBackupStorage::getInstance()->startUploadByActionId($actionId);
125
+ }
126
+ }
127
+ }
128
+
129
+ private function cleanUp()
130
+ {
131
+ //delete sql file
132
+ if ($this->databaseBackupAvailable)
133
+ {
134
+ $this->backupDatabase->cancel();
135
+ }
136
+ }
137
+
138
+ private static function getBackupFileName()
139
+ {
140
+ return 'sg_backup_'.(@date('YmdHis'));
141
+ }
142
+
143
+ private function prepareBackupFolder($backupPath)
144
+ {
145
+ //create backup folder
146
+ if (!@mkdir($backupPath))
147
+ {
148
+ throw new SGExceptionMethodNotAllowed('Cannot create folder: '.$backupPath);
149
+ }
150
+
151
+ if (!is_writable($backupPath))
152
+ {
153
+ throw new SGExceptionForbidden('Permission denied. Directory is not writable: '.$backupPath);
154
+ }
155
+
156
+ //create backup log file
157
+ $this->prepareBackupLogFile($backupPath);
158
+ }
159
+
160
+ private function prepareBackupLogFile($backupPath)
161
+ {
162
+ $file = $backupPath.'/'.$this->fileName.'_backup.log';
163
+ $this->backupLogPath = $file;
164
+
165
+ $content = $this->getLogFileHeader();
166
+
167
+ $types = array();
168
+ if ($this->filesBackupAvailable)
169
+ {
170
+ $types[] = 'files';
171
+ }
172
+ if ($this->databaseBackupAvailable)
173
+ {
174
+ $types[] = 'database';
175
+ }
176
+
177
+ $content .= 'Backup type: '.implode(',', $types).PHP_EOL.PHP_EOL;
178
+
179
+ if (!file_put_contents($file, $content))
180
+ {
181
+ throw new SGExceptionMethodNotAllowed('Cannot create backup log file: '.$file);
182
+ }
183
+
184
+ //create file log handler
185
+ $fileLogHandler = new SGFileLogHandler($file);
186
+ SGLog::registerLogHandler($fileLogHandler, SG_LOG_LEVEL_LOW, true);
187
+ }
188
+
189
+ private function prepareForBackup()
190
+ {
191
+ //start logging
192
+ SGBackupLog::writeAction('backup', SG_BACKUP_LOG_POS_START);
193
+
194
+ //save timestamp for future use
195
+ $this->actionStartTs = time();
196
+
197
+ //create action inside db
198
+ $status = $this->databaseBackupAvailable?SG_ACTION_STATUS_IN_PROGRESS_DB:SG_ACTION_STATUS_IN_PROGRESS_FILES;
199
+ $this->actionId = self::createAction($this->fileName, SG_ACTION_TYPE_BACKUP, $status);
200
+
201
+ //set paths
202
+ $this->filesBackupPath = SG_BACKUP_DIRECTORY.$this->fileName.'/'.$this->fileName.'.sgbp';
203
+ $this->databaseBackupPath = SG_BACKUP_DIRECTORY.$this->fileName.'/'.$this->fileName.'.sql';
204
+
205
+ //prepare sgbp file
206
+ @file_put_contents($this->filesBackupPath, '');
207
+
208
+ if (!is_writable($this->filesBackupPath))
209
+ {
210
+ throw new SGExceptionForbidden('Could not create backup file: '.$filePath);
211
+ }
212
+
213
+ $this->backupFiles->setFilePath($this->filesBackupPath);
214
+ SGConfig::set('SG_RUNNING_ACTION', 1, true);
215
+
216
+ //check if upload to storages is needed
217
+ $uploadToStorages = SGConfig::get('SG_BACKUP_UPLOAD_TO_STORAGES');
218
+ if (SGBoot::isFeatureAvailable('STORAGE') && $uploadToStorages)
219
+ {
220
+ $storages = explode(',', $uploadToStorages);
221
+ $arr = array();
222
+ foreach ($storages as $storageId)
223
+ {
224
+ $actionId = SGBackupStorage::queueBackupForUpload($this->fileName, $storageId);
225
+ $arr[] = $actionId;
226
+ }
227
+ $this->queuedStorageUploads = $arr;
228
+ }
229
+
230
+ //register shutdown function (used for handling execution time limits)
231
+ register_shutdown_function('shutdownAction', $this->actionId, SG_ACTION_TYPE_BACKUP, $this->filesBackupPath, $this->databaseBackupPath);
232
+ }
233
+
234
+ public function cancel()
235
+ {
236
+ if ($this->databaseBackupAvailable)
237
+ {
238
+ $this->backupDatabase->cancel();
239
+ }
240
+
241
+ $this->backupFiles->cancel();
242
+
243
+ SGBackupLog::write('Backup cancelled');
244
+
245
+ throw new SGExceptionSkip();
246
+ }
247
+
248
+ private function didFinishBackup()
249
+ {
250
+ $action = $this->didFindWarnings()?SG_ACTION_STATUS_FINISHED_WARNINGS:SG_ACTION_STATUS_FINISHED;
251
+ self::changeActionStatus($this->actionId, $action);
252
+
253
+ SGBackupLog::writeAction('backup', SG_BACKUP_LOG_POS_END);
254
+
255
+ if (SGBoot::isFeatureAvailable('NOTIFICATIONS'))
256
+ {
257
+ SGBackupMailNotification::sendBackupNotification(true);
258
+ }
259
+
260
+ SGBackupLog::write('Total duration: '.formattedDuration($this->actionStartTs, time()));
261
+ SGBackupLog::write('Memory usage (peak): '.number_format(memory_get_peak_usage()/1024.0/1024.0, 2, '.', '').' MB');
262
+
263
+ $this->cleanUp();
264
+ }
265
+
266
+ /* Restore implementation */
267
+
268
+ public function restore($backupName)
269
+ {
270
+ $this->prepareForRestore($backupName);
271
+
272
+ try
273
+ {
274
+ $this->backupFiles->restore($this->filesBackupPath);
275
+ $this->didFinishFilesRestore();
276
+ }
277
+ catch (SGException $exception)
278
+ {
279
+ if (!$exception instanceof SGExceptionSkip)
280
+ {
281
+ SGBackupLog::writeExceptionObject($exception);
282
+
283
+ if (SGBoot::isFeatureAvailable('NOTIFICATIONS'))
284
+ {
285
+ SGBackupMailNotification::sendRestoreNotification(false);
286
+ }
287
+
288
+ self::changeActionStatus($this->actionId, SG_ACTION_STATUS_ERROR);
289
+ }
290
+ else
291
+ {
292
+ self::changeActionStatus($this->actionId, SG_ACTION_STATUS_CANCELLED);
293
+ }
294
+ }
295
+ }
296
+
297
+ private function prepareForRestore($backupName)
298
+ {
299
+ //prepare file name
300
+ $this->fileName = $backupName;
301
+
302
+ //set paths
303
+ $restorePath = SG_BACKUP_DIRECTORY.$this->fileName;
304
+ $this->filesBackupPath = $restorePath.'/'.$this->fileName.'.sgbp';
305
+ $this->databaseBackupPath = $restorePath.'/'.$this->fileName.'.sql';
306
+
307
+ //prepare folder
308
+ $this->prepareRestoreFolder($restorePath);
309
+
310
+ //start logging
311
+ SGBackupLog::writeAction('restore', SG_BACKUP_LOG_POS_START);
312
+
313
+ SGConfig::set('SG_RUNNING_ACTION', 1, true);
314
+
315
+ //save timestamp for future use
316
+ $this->actionStartTs = time();
317
+
318
+ //create action inside db
319
+ $this->actionId = self::createAction($this->fileName, SG_ACTION_TYPE_RESTORE, SG_ACTION_STATUS_IN_PROGRESS_FILES);
320
+
321
+ //register shutdown function (used for handling execution time limits)
322
+ register_shutdown_function('shutdownAction', $this->actionId, SG_ACTION_TYPE_RESTORE, $this->filesBackupPath, $this->databaseBackupPath);
323
+ }
324
+
325
+ private function prepareRestoreFolder($restorePath)
326
+ {
327
+ if (!is_writable($restorePath))
328
+ {
329
+ throw new SGExceptionForbidden('Permission denied. Directory is not writable: '.$restorePath);
330
+ }
331
+
332
+ $this->filesBackupAvailable = file_exists($this->filesBackupPath);
333
+
334
+ //create restore log file
335
+ $this->prepareRestoreLogFile($restorePath);
336
+ }
337
+
338
+ private function prepareRestoreLogFile($backupPath)
339
+ {
340
+ $file = $backupPath.'/'.$this->fileName.'_restore.log';
341
+ $this->restoreLogPath = $file;
342
+
343
+ $content = $this->getLogFileHeader();
344
+
345
+ $content .= PHP_EOL;
346
+
347
+ if (!file_put_contents($file, $content))
348
+ {
349
+ throw new SGExceptionMethodNotAllowed('Cannot create restore log file: '.$file);
350
+ }
351
+
352
+ //create file log handler
353
+ $fileLogHandler = new SGFileLogHandler($file);
354
+ SGLog::registerLogHandler($fileLogHandler, SG_LOG_LEVEL_LOW, true);
355
+ }
356
+
357
+ private function didFinishRestore()
358
+ {
359
+ $action = $this->didFindWarnings()?SG_ACTION_STATUS_FINISHED_WARNINGS:SG_ACTION_STATUS_FINISHED;
360
+ self::changeActionStatus($this->actionId, $action);
361
+
362
+ SGBackupLog::writeAction('restore', SG_BACKUP_LOG_POS_END);
363
+
364
+ if (SGBoot::isFeatureAvailable('NOTIFICATIONS'))
365
+ {
366
+ SGBackupMailNotification::sendRestoreNotification(true);
367
+ }
368
+
369
+ SGBackupLog::write('Total duration: '.formattedDuration($this->actionStartTs, time()));
370
+ SGBackupLog::write('Memory usage (peak): '.number_format(memory_get_peak_usage()/1024.0/1024.0, 2, '.', '').' MB');
371
+
372
+ $this->cleanUp();
373
+ }
374
+
375
+ private function didFinishFilesRestore()
376
+ {
377
+ $this->databaseBackupAvailable = file_exists($this->databaseBackupPath);
378
+
379
+ if ($this->databaseBackupAvailable)
380
+ {
381
+ self::changeActionStatus($this->actionId, SG_ACTION_STATUS_IN_PROGRESS_DB);
382
+ $this->backupDatabase->restore($this->databaseBackupPath);
383
+ }
384
+
385
+ $this->didFinishRestore();
386
+ }
387
+
388
+ /* General methods */
389
+
390
+ private function getLogFileHeader()
391
+ {
392
+ $content = '';
393
+ $content .= 'Date: '.@date('Y-m-d H:i').PHP_EOL;
394
+ $content .= 'SG Backup version: '.SG_VERSION.PHP_EOL;
395
+ $content .= 'OS: '.PHP_OS.PHP_EOL;
396
+ $content .= 'Server: '.@$_SERVER['SERVER_SOFTWARE'].PHP_EOL;
397
+ $content .= 'User agent: '.@$_SERVER['HTTP_USER_AGENT'].PHP_EOL;
398
+ $content .= 'PHP version: '.PHP_VERSION.PHP_EOL;
399
+ $content .= 'SAPI: '.PHP_SAPI.PHP_EOL;
400
+ $content .= 'Codepage: '.setlocale(LC_CTYPE, '').PHP_EOL;
401
+ $content .= 'Int size: '.PHP_INT_SIZE.PHP_EOL;
402
+ if (extension_loaded('gmp')) $lib = 'gmp';
403
+ else if (extension_loaded('bcmath')) $lib = 'bcmath';
404
+ else $lib = 'BigInteger';
405
+ $content .= 'Int lib: '.$lib.PHP_EOL;
406
+ $content .= 'Memory limit: '.ini_get('memory_limit').PHP_EOL;
407
+ $content .= 'Max execution time: '.ini_get('max_execution_time').PHP_EOL;
408
+ $content .= 'Environment: '.SG_ENV_ADAPTER.' '.SG_ENV_VERSION.PHP_EOL;
409
+
410
+ return $content;
411
+ }
412
+
413
+ private function didFindWarnings()
414
+ {
415
+ $warningsDatabase = $this->databaseBackupAvailable?$this->backupDatabase->didFindWarnings():false;
416
+ $warningsFiles = $this->backupFiles->didFindWarnings();
417
+ return ($warningsFiles||$warningsDatabase);
418
+ }
419
+
420
+ public static function createAction($name, $type, $status, $subtype = 0)
421
+ {
422
+ $sgdb = SGDatabase::getInstance();
423
+ $res = $sgdb->query('INSERT INTO '.SG_ACTION_TABLE_NAME.' (name, type, subtype, status, start_date) VALUES (%s, %d, %d, %d, %s)', array($name, $type, $subtype, $status, @date('Y-m-d H:i:s')));
424
+ if (!$res)
425
+ {
426
+ throw new SGExceptionDatabaseError('Could not create action');
427
+ }
428
+ return $sgdb->lastInsertId();
429
+ }
430
+
431
+ private function getCurrentActionStatus()
432
+ {
433
+ return self::getActionStatus($this->actionId);
434
+ }
435
+
436
+ private function setCurrentActionStatusCancelled()
437
+ {
438
+ $sgdb = SGDatabase::getInstance();
439
+ $sgdb->query('UPDATE '.SG_ACTION_TABLE_NAME.' SET status=%d, update_date=%s WHERE name=%s', array(SG_ACTION_STATUS_CANCELLED, @date('Y-m-d H:i:s'), $this->fileName));
440
+ }
441
+
442
+ public static function changeActionStatus($actionId, $status)
443
+ {
444
+ $sgdb = SGDatabase::getInstance();
445
+
446
+ $progress = '';
447
+ if ($status==SG_ACTION_STATUS_FINISHED || $status==SG_ACTION_STATUS_FINISHED_WARNINGS)
448
+ {
449
+ $progress = 100;
450
+ }
451
+ else if ($status==SG_ACTION_STATUS_CREATED || $status==SG_ACTION_STATUS_IN_PROGRESS_FILES || $status==SG_ACTION_STATUS_IN_PROGRESS_DB)
452
+ {
453
+ $progress = 0;
454
+ }
455
+
456
+ if ($progress!=='')
457
+ {
458
+ $progress = ' progress='.$progress.',';
459
+ }
460
+
461
+ $res = $sgdb->query('UPDATE '.SG_ACTION_TABLE_NAME.' SET status=%d,'.$progress.' update_date=%s WHERE id=%d', array($status, @date('Y-m-d H:i:s'), $actionId));
462
+ if (!$res)
463
+ {
464
+ throw new SGExceptionDatabaseError('Could not update action status');
465
+ }
466
+ }
467
+
468
+ public static function changeActionProgress($actionId, $progress)
469
+ {
470
+ $sgdb = SGDatabase::getInstance();
471
+ $sgdb->query('UPDATE '.SG_ACTION_TABLE_NAME.' SET progress=%d, update_date=%s WHERE id=%d', array($progress, @date('Y-m-d H:i:s'), $actionId));
472
+ }
473
+
474
+ /* Methods for frontend use */
475
+
476
+ public static function getAction($actionId)
477
+ {
478
+ $sgdb = SGDatabase::getInstance();
479
+ $res = $sgdb->query('SELECT * FROM '.SG_ACTION_TABLE_NAME.' WHERE id=%d', array($actionId));
480
+ if (empty($res))
481
+ {
482
+ return false;
483
+ }
484
+ return $res[0];
485
+ }
486
+
487
+ public static function getActionProgress($actionId)
488
+ {
489
+ $sgdb = SGDatabase::getInstance();
490
+ $res = $sgdb->query('SELECT progress FROM '.SG_ACTION_TABLE_NAME.' WHERE id=%d', array($actionId));
491
+ if (empty($res))
492
+ {
493
+ return false;
494
+ }
495
+ return (int)$res[0]['progress'];
496
+ }
497
+
498
+ public static function getActionStatus($actionId)
499
+ {
500
+ $sgdb = SGDatabase::getInstance();
501
+ $res = $sgdb->query('SELECT status FROM '.SG_ACTION_TABLE_NAME.' WHERE id=%d', array($actionId));
502
+ if (empty($res))
503
+ {
504
+ return false;
505
+ }
506
+ return (int)$res[0]['status'];
507
+ }
508
+
509
+ public static function getRunningActions()
510
+ {
511
+ $sgdb = SGDatabase::getInstance();
512
+ $res = $sgdb->query('SELECT * FROM '.SG_ACTION_TABLE_NAME.' WHERE status=%d OR status=%d OR status=%d ORDER BY status DESC', array(SG_ACTION_STATUS_IN_PROGRESS_FILES, SG_ACTION_STATUS_IN_PROGRESS_DB, SG_ACTION_STATUS_CREATED));
513
+ return $res;
514
+ }
515
+
516
+ public static function getAllBackups()
517
+ {
518
+ $backups = array();
519
+
520
+ $path = SG_BACKUP_DIRECTORY;
521
+
522
+ clearstatcache();
523
+
524
+ if ($handle = @opendir($path))
525
+ {
526
+ $sgdb = SGDatabase::getInstance();
527
+ $data = $sgdb->query('SELECT id, name, type, subtype, status, progress, update_date FROM '.SG_ACTION_TABLE_NAME);
528
+ $allBackups = array();
529
+ foreach ($data as $row)
530
+ {
531
+ $allBackups[$row['name']][] = $row;
532
+ }
533
+
534
+ $i = 0;
535
+ while (($file = readdir($handle)) !== false)
536
+ {
537
+ if ($file === '.')
538
+ {
539
+ continue;
540
+ }
541
+ if ($file === '..')
542
+ {
543
+ continue;
544
+ }
545
+
546
+ if (substr($file, 0, 10)=='sg_backup_')
547
+ {
548
+ $backup = array();
549
+ $backup['name'] = $file;
550
+ $backup['files'] = file_exists($path.$file.'/'.$file.'.sgbp')?1:0;
551
+ $backup['backup_log'] = file_exists($path.$file.'/'.$file.'_backup.log')?1:0;
552
+ $backup['restore_log'] = file_exists($path.$file.'/'.$file.'_restore.log')?1:0;
553
+ if (!$backup['files'] && !$backup['backup_log'] && !$backup['restore_log'])
554
+ {
555
+ continue;
556
+ }
557
+ $backupRow = null;
558
+ if (isset($allBackups[$file]))
559
+ {
560
+ $skip = false;
561
+ foreach ($allBackups[$file] as $row)
562
+ {
563
+ if ($row['status']==SG_ACTION_STATUS_IN_PROGRESS_FILES || $backupRow['status']==SG_ACTION_STATUS_IN_PROGRESS_DB)
564
+ {
565
+ $backupRow = $row;
566
+ break;
567
+ }
568
+ else if (($row['status']==SG_ACTION_STATUS_CANCELLING || $row['status']==SG_ACTION_STATUS_CANCELLED) && $row['type']!=SG_ACTION_TYPE_UPLOAD)
569
+ {
570
+ $skip = true;
571
+ break;
572
+ }
573
+
574
+ $backupRow = $row;
575
+
576
+ if ($row['status']==SG_ACTION_STATUS_FINISHED_WARNINGS && $row['type']!=SG_ACTION_TYPE_UPLOAD)
577
+ {
578
+ $key = $row['type']==SG_ACTION_TYPE_BACKUP?'backup_warning':'restore_warning';
579
+ $backupRow[$key] = 1;
580
+ }
581
+ else if ($row['status']==SG_ACTION_STATUS_ERROR && $row['type']==SG_ACTION_TYPE_BACKUP)
582
+ {
583
+ $backupRow['backup_error'] = 1;
584
+ break;
585
+ }
586
+ else if ($row['status']==SG_ACTION_STATUS_ERROR && $row['type']==SG_ACTION_TYPE_RESTORE)
587
+ {
588
+ $backupRow['restore_error'] = 1;
589
+ }
590
+ }
591
+
592
+ if ($skip===true)
593
+ {
594
+ continue;
595
+ }
596
+ }
597
+
598
+ if ($backupRow)
599
+ {
600
+ $backup['active'] = ($backupRow['status']==SG_ACTION_STATUS_IN_PROGRESS_FILES||
601
+ $backupRow['status']==SG_ACTION_STATUS_IN_PROGRESS_DB||
602
+ $backupRow['status']==SG_ACTION_STATUS_CREATED)?1:0; $backup['type'] = (int)$backupRow['type'];
603
+ $backup['type'] = (int)$backupRow['type'];
604
+ $backup['subtype'] = (int)$backupRow['subtype'];
605
+ $backup['progress'] = (int)$backupRow['progress'];
606
+ $backup['id'] = (int)$backupRow['id'];
607
+ }
608
+ else
609
+ {
610
+ $backup['active'] = 0;
611
+ }
612
+
613
+ if ($backup['active']==0)
614
+ {
615
+ $backup['backup_warning'] = (int)@$backupRow['backup_warning'];
616
+ $backup['restore_warning'] = (int)@$backupRow['restore_warning'];
617
+
618
+ $backup['backup_error'] = (int)@$backupRow['backup_error'];
619
+ $backup['restore_error'] = (int)@$backupRow['restore_error'];
620
+ }
621
+ else
622
+ {
623
+ $backup['backup_warning'] = 0;
624
+ $backup['restore_warning'] = 0;
625
+
626
+ $backup['backup_error'] = 0;
627
+ $backup['restore_error'] = 0;
628
+ }
629
+
630
+ $modifiedTime = filemtime($path.$file.'/.');
631
+ $backup['date'] = @date('Y-m-d H:i', $modifiedTime);
632
+ $backups[$modifiedTime.($i++)] = $backup;
633
+ }
634
+ }
635
+ closedir($handle);
636
+ }
637
+
638
+ krsort($backups);
639
+ return array_values($backups);
640
+ }
641
+
642
+ public static function deleteBackup($backupName, $deleteAction = true)
643
+ {
644
+ deleteDirectory(SG_BACKUP_DIRECTORY.$backupName);
645
+
646
+ if ($deleteAction)
647
+ {
648
+ $sgdb = SGDatabase::getInstance();
649
+ $sgdb->query('DELETE FROM '.SG_ACTION_TABLE_NAME.' WHERE name=%s', array($backupName));
650
+ }
651
+ }
652
+
653
+ public static function cancelAction($actionId)
654
+ {
655
+ self::changeActionStatus($actionId, SG_ACTION_STATUS_CANCELLING);
656
+ }
657
+
658
+ public static function upload($filesUploadSgbp)
659
+ {
660
+ $filename = self::getBackupFileName();
661
+ $backupDirectory = $filename.'/';
662
+ $uploadPath = SG_BACKUP_DIRECTORY.$backupDirectory;
663
+ $filename = $uploadPath.$filename;
664
+
665
+ if (!@file_exists($uploadPath))
666
+ {
667
+ if (!@mkdir($uploadPath))
668
+ {
669
+ throw new SGExceptionForbidden('Upload folder is not accessible');
670
+ }
671
+ }
672
+
673
+ if (!empty($filesUploadSgbp) && $filesUploadSgbp['name'] != '')
674
+ {
675
+ if ($filesUploadSgbp['type'] != 'application/octet-stream')
676
+ {
677
+ throw new SGExceptionBadRequest('Not a valid backup file');
678
+ }
679
+ if (!@move_uploaded_file($filesUploadSgbp['tmp_name'], $filename.'.sgbp'))
680
+ {
681
+ throw new SGExceptionForbidden('Error while uploading file');
682
+ }
683
+ }
684
+ }
685
+
686
+ public static function download($backupName, $type)
687
+ {
688
+ $backupDirectory = $backupName.'/';
689
+ $fileType = 'text/plain';
690
+ $fileName = SG_BACKUP_DIRECTORY.$backupDirectory.$backupName;
691
+
692
+ if ($type == SG_BACKUP_DWONLOAD_TYPE_SGBP)
693
+ {
694
+ $fileName .= '.sgbp';
695
+ $fileType = 'application/octet-stream';
696
+ }
697
+ else if ($type == SG_BACKUP_DWONLOAD_TYPE_BACKUP_LOG)
698
+ {
699
+ $fileName .= '_backup.log';
700
+ }
701
+ else if ($type == SG_BACKUP_DWONLOAD_TYPE_RESTORE_LOG)
702
+ {
703
+ $fileName .= '_restore.log';
704
+ }
705
+ else
706
+ {
707
+ header("HTTP/1.1 400 Invalid Request");
708
+ exit;
709
+ }
710
+
711
+ downloadFile($fileName, $fileType);
712
+ }
713
+
714
+ /* SGIBackupDelegate implementation */
715
+
716
+ public function isCancelled()
717
+ {
718
+ $status = $this->getCurrentActionStatus();
719
+
720
+ if ($status==SG_ACTION_STATUS_CANCELLING)
721
+ {
722
+ $this->cancel();
723
+ return true;
724
+ }
725
+
726
+ return false;
727
+ }
728
+
729
+ public function didUpdateProgress($progress)
730
+ {
731
+ $progress = max($progress, 0);
732
+ $progress = min($progress, 100);
733
+
734
+ self::changeActionProgress($this->actionId, $progress);
735
+ }
736
+
737
+ public function isBackgroundMode()
738
+ {
739
+ return $this->backgroundMode;
740
+ }
741
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackupDatabase.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_BACKUP_PATH.'SGIBackupDelegate.php');
3
+ require_once(SG_LIB_PATH.'SGMysqldump.php');
4
+
5
+ class SGBackupDatabase implements SGIMysqldumpDelegate
6
+ {
7
+ private $sgdb = null;
8
+ private $backupFilePath = '';
9
+ private $delegate = null;
10
+ private $cancelled = false;
11
+ private $nextProgressUpdate = 0;
12
+ private $totalRowCount = 0;
13
+ private $currentRowCount = 0;
14
+ private $warningsFound = false;
15
+
16
+ public function __construct()
17
+ {
18
+ $this->sgdb = SGDatabase::getInstance();
19
+ }
20
+
21
+ public function setDelegate(SGIBackupDelegate $delegate)
22
+ {
23
+ $this->delegate = $delegate;
24
+ }
25
+
26
+ public function didFindWarnings()
27
+ {
28
+ return $this->warningsFound;
29
+ }
30
+
31
+ public function backup($filePath)
32
+ {
33
+ SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_START);
34
+ $this->backupFilePath = $filePath;
35
+ $this->resetBackupProgress();
36
+ $this->export();
37
+ SGBackupLog::writeAction('backup database', SG_BACKUP_LOG_POS_END);
38
+ }
39
+
40
+ public function restore($filePath)
41
+ {
42
+ SGBackupLog::writeAction('restore database', SG_BACKUP_LOG_POS_START);
43
+ $this->backupFilePath = $filePath;
44
+ $this->resetRestoreProgress();
45
+ $this->import();
46
+ SGBackupLog::writeAction('restore database', SG_BACKUP_LOG_POS_END);
47
+ }
48
+
49
+ private function export()
50
+ {
51
+ if (!$this->isWritable($this->backupFilePath))
52
+ {
53
+ throw new SGExceptionForbidden('Permission denied. File is not writable: '.$this->backupFilePath);
54
+ }
55
+
56
+ $tablesToExclude = explode(',', SGConfig::get('SG_BACKUP_DATABASE_EXCLUDE'));
57
+
58
+ $dump = new SGMysqldump($this->sgdb, SG_DB_NAME, 'mysql', array(
59
+ 'exclude-tables'=>$tablesToExclude,
60
+ 'skip-dump-date'=>true,
61
+ 'skip-comments'=>true,
62
+ 'skip-tz-utz'=>true,
63
+ 'add-drop-table'=>true,
64
+ 'no-autocommit'=>false,
65
+ 'single-transaction'=>false,
66
+ 'lock-tables'=>false,
67
+ 'add-locks'=>false
68
+ ));
69
+ $dump->setDelegate($this);
70
+ $dump->start($this->backupFilePath);
71
+ }
72
+
73
+ private function import()
74
+ {
75
+ $fileHandle = @fopen($this->backupFilePath, 'r');
76
+ if (!is_resource($fileHandle))
77
+ {
78
+ throw new SGExceptionForbidden('Could not open file: '.$this->backupFilePath);
79
+ }
80
+ $importQuery = '';
81
+ while (($row = @fgets($fileHandle)) !== false)
82
+ {
83
+ $importQuery .= $row;
84
+ $trimmedRow = trim($row);
85
+
86
+ if (strpos($trimmedRow, 'CREATE TABLE') !== false)
87
+ {
88
+ $strLength = strlen($trimmedRow);
89
+ $strCtLength = strlen('CREATE TABLE ');
90
+ $length = $strLength - $strCtLength - 2;
91
+ $tableName = substr($trimmedRow, $strCtLength, $length);
92
+ SGBackupLog::write('Importing table: '.$tableName);
93
+ }
94
+
95
+ if ($trimmedRow && $trimmedRow[strlen($trimmedRow)-1]==';')
96
+ {
97
+ $res = $this->sgdb->exec($importQuery);
98
+ if ($res===false)
99
+ {
100
+ throw new SGExceptionDatabaseError('Could not execute query: '.$importQuery);
101
+ }
102
+ $importQuery = '';
103
+ }
104
+ $this->currentRowCount++;
105
+ $this->updateProgress();
106
+ }
107
+ @fclose($fileHandle);
108
+ }
109
+
110
+ public function didExportRow()
111
+ {
112
+ $this->currentRowCount++;
113
+
114
+ if ($this->updateProgress())
115
+ {
116
+ if ($this->delegate && $this->delegate->isCancelled())
117
+ {
118
+ $this->cancelled = true;
119
+ return;
120
+ }
121
+ }
122
+
123
+ if (SGBoot::isFeatureAvailable('BACKGROUND_MODE') && $this->delegate->isBackgroundMode())
124
+ {
125
+ SGBackgroundMode::next();
126
+ }
127
+ }
128
+
129
+ public function cancel()
130
+ {
131
+ @unlink($this->backupFilePath);
132
+ }
133
+
134
+ private function resetBackupProgress()
135
+ {
136
+ $this->totalRowCount = 0;
137
+ $this->currentRowCount = 0;
138
+ $this->progressUpdateInterval = SGConfig::get('SG_ACTION_PROGRESS_UPDATE_INTERVAL');
139
+ $tableNames = $this->getTables();
140
+ foreach ($tableNames as $table)
141
+ {
142
+ $this->totalRowCount += $this->getTableRowsCount($table);
143
+ }
144
+ $this->nextProgressUpdate = $this->progressUpdateInterval;
145
+ SGBackupLog::write('Total tables to backup: '.count($tableNames));
146
+ SGBackupLog::write('Total rows to backup: '.$this->totalRowCount);
147
+ }
148
+
149
+ private function resetRestoreProgress()
150
+ {
151
+ $this->totalRowCount = $this->getFileLinesCount($this->backupFilePath);
152
+ $this->currentRowCount = 0;
153
+ $this->progressUpdateInterval = SGConfig::get('SG_ACTION_PROGRESS_UPDATE_INTERVAL');
154
+ $this->nextProgressUpdate = $this->progressUpdateInterval;
155
+ }
156
+
157
+ private function getTables()
158
+ {
159
+ $tableNames = array();
160
+ $tables = $this->sgdb->query('SHOW TABLES FROM '.SG_DB_NAME);
161
+ if (!$tables)
162
+ {
163
+ throw new SGExceptionDatabaseError('Could not get tables of database: '.SG_DB_NAME);
164
+ }
165
+ foreach ($tables as $table)
166
+ {
167
+ $tableName = $table['Tables_in_'.SG_DB_NAME];
168
+ $tablesToExclude = explode(',', SGConfig::get('SG_BACKUP_DATABASE_EXCLUDE'));
169
+ if (in_array($tableName, $tablesToExclude))
170
+ {
171
+ continue;
172
+ }
173
+ $tableNames[] = $tableName;
174
+ }
175
+ return $tableNames;
176
+ }
177
+
178
+ private function getTableRowsCount($tableName)
179
+ {
180
+ $count = 0;
181
+ $tableRowsNum = $this->sgdb->query('SELECT COUNT(*) AS total FROM '.$tableName);
182
+ $count = @$tableRowsNum[0]['total'];
183
+ return $count;
184
+ }
185
+
186
+ private function getFileLinesCount($filePath)
187
+ {
188
+ $fileHandle = @fopen($filePath, 'rb');
189
+ if (!is_resource($fileHandle))
190
+ {
191
+ throw new SGExceptionForbidden('Could not open file: '.$filePath);
192
+ }
193
+
194
+ $linecount = 0;
195
+ while (!feof($fileHandle))
196
+ {
197
+ $linecount += substr_count(fread($fileHandle, 8192), "\n");
198
+ }
199
+
200
+ @fclose($fileHandle);
201
+ return $linecount;
202
+ }
203
+
204
+ private function updateProgress()
205
+ {
206
+ $progress = round($this->currentRowCount*100.0/$this->totalRowCount);
207
+
208
+ if ($progress>=$this->nextProgressUpdate)
209
+ {
210
+ $this->nextProgressUpdate += $this->progressUpdateInterval;
211
+
212
+ if ($this->delegate)
213
+ {
214
+ $this->delegate->didUpdateProgress($progress);
215
+ }
216
+
217
+ return true;
218
+ }
219
+
220
+ return false;
221
+ }
222
+
223
+ /* Helper Functions */
224
+
225
+ private function isWritable($filePath)
226
+ {
227
+ if (!file_exists($filePath))
228
+ {
229
+ $fp = @fopen($filePath, 'wb');
230
+ if (!$fp)
231
+ {
232
+ throw new SGExceptionForbidden('Could not open file: '.$filePath);
233
+ }
234
+ @fclose($fp);
235
+ }
236
+ return is_writable($filePath);
237
+ }
238
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackupFiles.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_BACKUP_PATH.'SGIBackupDelegate.php');
3
+ require_once(SG_LIB_PATH.'SGArchive.php');
4
+
5
+ class SGBackupFiles implements SGArchiveDelegate
6
+ {
7
+ private $rootDirectory = '';
8
+ private $excludeFilePaths = array();
9
+ private $filePath = '';
10
+ private $sgbp = null;
11
+ private $delegate = null;
12
+ private $nextProgressUpdate = 0;
13
+ private $totalBackupFilesCount = 0;
14
+ private $currentBackupFileCount = 0;
15
+ private $progressUpdateInterval = 0;
16
+ private $warningsFound = false;
17
+ private $dontExclude = array();
18
+
19
+ public function __construct()
20
+ {
21
+ $this->rootDirectory = realpath(SGConfig::get('SG_APP_ROOT_DIRECTORY')).'/';
22
+ }
23
+
24
+ public function setDelegate(SGIBackupDelegate $delegate)
25
+ {
26
+ $this->delegate = $delegate;
27
+ }
28
+
29
+ public function setFilePath($filePath)
30
+ {
31
+ $this->filePath = $filePath;
32
+ }
33
+
34
+ public function addDontExclude($ex)
35
+ {
36
+ $this->dontExclude[] = $ex;
37
+ }
38
+
39
+ public function didFindWarnings()
40
+ {
41
+ return $this->warningsFound;
42
+ }
43
+
44
+ public function backup($filePath)
45
+ {
46
+ SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_START);
47
+
48
+ $excludeFilePaths = SGConfig::get('SG_BACKUP_FILE_PATHS_EXCLUDE');
49
+ $this->excludeFilePaths = explode(',', $excludeFilePaths);
50
+
51
+ $this->filePath = $filePath;
52
+ $backupItems = SGConfig::get('SG_BACKUP_FILE_PATHS');
53
+ $allItems = explode(',', $backupItems);
54
+
55
+ SGBackupLog::write('Backup files: '.$backupItems);
56
+
57
+ $this->sgbp = new SGArchive($filePath, 'w');
58
+
59
+ if (!is_writable($filePath))
60
+ {
61
+ throw new SGExceptionForbidden('Could not create backup file: '.$filePath);
62
+ }
63
+
64
+ $this->resetBackupProgress($allItems);
65
+ $this->warningsFound = false;
66
+
67
+ SGBackupLog::write('Number of files to backup: '.$this->totalBackupFilesCount);
68
+
69
+ foreach ($allItems as $item)
70
+ {
71
+ SGBackupLog::writeAction('backup file: '.$item, SG_BACKUP_LOG_POS_START);
72
+
73
+ $path = $this->rootDirectory.$item;
74
+ $this->addFileToArchive($path);
75
+
76
+ SGBackupLog::writeAction('backup file: '.$item, SG_BACKUP_LOG_POS_END);
77
+ }
78
+
79
+ $this->sgbp->finalize();
80
+
81
+ SGBackupLog::writeAction('backup files', SG_BACKUP_LOG_POS_END);
82
+ }
83
+
84
+ public function restore($filePath)
85
+ {
86
+ SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_START);
87
+
88
+ $this->filePath = $filePath;
89
+
90
+ $this->resetRestoreProgress(dirname($filePath));
91
+ $this->warningsFound = false;
92
+
93
+ $this->extractArchive($filePath);
94
+
95
+ SGBackupLog::writeAction('restore files', SG_BACKUP_LOG_POS_END);
96
+ }
97
+
98
+ private function extractArchive($filePath)
99
+ {
100
+ $restorePath = $this->rootDirectory;
101
+
102
+ $sgbp = new SGArchive($filePath, 'r');
103
+ $sgbp->setDelegate($this);
104
+ $sgbp->extractTo($restorePath);
105
+ }
106
+
107
+ public function getCorrectCdrFilename($filename)
108
+ {
109
+ $backupsPath = $this->pathWithoutRootDirectory(realpath(SG_BACKUP_DIRECTORY));
110
+
111
+ if (strpos($filename, $backupsPath)===0)
112
+ {
113
+ $newPath = dirname($this->pathWithoutRootDirectory(realpath($this->filePath)));
114
+ $filename = substr(basename(trim($this->filePath)), 0, -4); //remove sgbp extension
115
+ return $newPath.'/'.$filename.'sql';
116
+ }
117
+
118
+ return $filename;
119
+ }
120
+
121
+ public function didExtractFile($filePath)
122
+ {
123
+ //update progress
124
+ $this->currentBackupFileCount++;
125
+ $this->updateProgress();
126
+ }
127
+
128
+ public function didFindExtractError($error)
129
+ {
130
+ $this->warn($error);
131
+ }
132
+
133
+ public function didCountFilesInsideArchive($count)
134
+ {
135
+ $this->totalBackupFilesCount = $count;
136
+ SGBackupLog::write('Number of files to restore: '.$count);
137
+ }
138
+
139
+ private function resetBackupProgress($allItems)
140
+ {
141
+ $this->currentBackupFileCount = 0;
142
+ $this->progressUpdateInterval = SGConfig::get('SG_ACTION_PROGRESS_UPDATE_INTERVAL');
143
+
144
+ //get number of files to backup
145
+ $this->totalBackupFilesCount = $this->getTotalCountOfBackupFiles($allItems);
146
+ $this->nextProgressUpdate = $this->progressUpdateInterval;
147
+ }
148
+
149
+ private function resetRestoreProgress($restorePath)
150
+ {
151
+ $this->currentBackupFileCount = 0;
152
+ $this->progressUpdateInterval = SGConfig::get('SG_ACTION_PROGRESS_UPDATE_INTERVAL');
153
+ $this->nextProgressUpdate = $this->progressUpdateInterval;
154
+ }
155
+
156
+ private function getTotalCountOfBackupFiles($allItems)
157
+ {
158
+ $totalCount = 0;
159
+
160
+ foreach ($allItems as $item)
161
+ {
162
+ $path = $this->rootDirectory.$item;
163
+
164
+ $count = 0;
165
+ $this->numberOfFilesInDirectory($path, $count);
166
+
167
+ $totalCount += $count;
168
+ }
169
+
170
+ return $totalCount;
171
+ }
172
+
173
+ private function pathWithoutRootDirectory($path)
174
+ {
175
+ return substr($path, strlen($this->rootDirectory));
176
+ }
177
+
178
+ private function shouldExcludeFile($path)
179
+ {
180
+ if (in_array($path, $this->dontExclude))
181
+ {
182
+ return false;
183
+ }
184
+
185
+ //get the name of the file/directory removing the root directory
186
+ $file = $this->pathWithoutRootDirectory($path);
187
+
188
+ //check if file/directory must be excluded
189
+ foreach ($this->excludeFilePaths as $exPath)
190
+ {
191
+ if (strpos($file, $exPath)===0)
192
+ {
193
+ return true;
194
+ }
195
+ }
196
+
197
+ return false;
198
+ }
199
+
200
+ private function numberOfFilesInDirectory($path, &$count = 0)
201
+ {
202
+ if ($this->shouldExcludeFile($path)) return;
203
+
204
+ if (is_dir($path))
205
+ {
206
+ if ($handle = @opendir($path))
207
+ {
208
+ while (($file = readdir($handle)) !== false)
209
+ {
210
+ if ($file === '.')
211
+ {
212
+ continue;
213
+ }
214
+ if ($file === '..')
215
+ {
216
+ continue;
217
+ }
218
+
219
+ $this->numberOfFilesInDirectory($path.'/'.$file, $count);
220
+ }
221
+ closedir($handle);
222
+ }
223
+ }
224
+ else
225
+ {
226
+ if (is_readable($path))
227
+ {
228
+ $count++;
229
+ }
230
+ }
231
+ }
232
+
233
+ public function cancel()
234
+ {
235
+ @unlink($this->filePath);
236
+ }
237
+
238
+ private function addFileToArchive($path)
239
+ {
240
+ if ($this->shouldExcludeFile($path)) return;
241
+
242
+ //check if it is a directory
243
+ if (is_dir($path))
244
+ {
245
+ $this->backupDirectory($path);
246
+ return;
247
+ }
248
+
249
+ //it is a file, try to add it to archive
250
+ if (is_readable($path))
251
+ {
252
+ $file = substr($path, strlen($this->rootDirectory));
253
+ $file = str_replace('\\', '/', $file);
254
+ $this->sgbp->addFileFromPath($file, $path);
255
+ }
256
+ else
257
+ {
258
+ $this->warn('Could not read file (skipping): '.$path);
259
+ }
260
+
261
+ //update progress and check cancellation
262
+ $this->currentBackupFileCount++;
263
+ if ($this->updateProgress())
264
+ {
265
+ if ($this->delegate && $this->delegate->isCancelled())
266
+ {
267
+ return;
268
+ }
269
+ }
270
+
271
+ if (SGBoot::isFeatureAvailable('BACKGROUND_MODE') && $this->delegate->isBackgroundMode())
272
+ {
273
+ SGBackgroundMode::next();
274
+ }
275
+ }
276
+
277
+ private function warn($message)
278
+ {
279
+ $this->warningsFound = true;
280
+ SGBackupLog::writeWarning($message);
281
+ }
282
+
283
+ private function backupDirectory($path)
284
+ {
285
+ if ($handle = @opendir($path))
286
+ {
287
+ $filesFound = false;
288
+ while (($file = readdir($handle)) !== false)
289
+ {
290
+ if ($file === '.')
291
+ {
292
+ continue;
293
+ }
294
+ if ($file === '..')
295
+ {
296
+ continue;
297
+ }
298
+
299
+ $filesFound = true;
300
+ $this->addFileToArchive($path.'/'.$file);
301
+ }
302
+
303
+ if (!$filesFound)
304
+ {
305
+ $file = substr($path, strlen($this->rootDirectory));
306
+ $file = str_replace('\\', '/', $file);
307
+ $this->sgbp->addFile($file.'/', ''); //create empty directory
308
+ }
309
+
310
+ closedir($handle);
311
+ }
312
+ else
313
+ {
314
+ $this->warn('Could not read directory (skipping): '.$path);
315
+ }
316
+ }
317
+
318
+ private function updateProgress()
319
+ {
320
+ $progress = round($this->currentBackupFileCount*100.0/$this->totalBackupFilesCount);
321
+
322
+ if ($progress>=$this->nextProgressUpdate)
323
+ {
324
+ $this->nextProgressUpdate += $this->progressUpdateInterval;
325
+
326
+ if ($this->delegate)
327
+ {
328
+ $this->delegate->didUpdateProgress($progress);
329
+ }
330
+
331
+ return true;
332
+ }
333
+
334
+ return false;
335
+ }
336
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGBackupLog.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_LOG_PATH.'SGLog.php');
3
+
4
+ class SGBackupLog
5
+ {
6
+ public static function writeAction($action, $position = SG_BACKUP_LOG_POS_START, $level = SG_LOG_LEVEL_LOW)
7
+ {
8
+ $logPos = 'Start';
9
+ if ($position == SG_BACKUP_LOG_POS_END)
10
+ {
11
+ $logPos = 'End';
12
+ }
13
+ $logMsg = $logPos.' '.$action;
14
+ $res = self::write($logMsg, $level);
15
+ return $res;
16
+ }
17
+
18
+ public static function writeException($exception, $message, $file, $line, $level = SG_LOG_LEVEL_LOW)
19
+ {
20
+ $logMsg = $exception.': '.$message.' ';
21
+ $logMsg .= '[File: '.$file.', Line: '.$line;
22
+ if (isset($_SERVER['REQUEST_URI']))
23
+ {
24
+ $logMsg .= ', URL: '.$_SERVER['REQUEST_URI'];
25
+ }
26
+ $logMsg .= ']';
27
+ $res = self::write($logMsg, $level);
28
+ return $res;
29
+ }
30
+
31
+ public static function writeExceptionObject($exception, $level = SG_LOG_LEVEL_LOW)
32
+ {
33
+ return self::writeException(get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine(), $level);
34
+ }
35
+
36
+ public static function writeWarning($message, $level = SG_LOG_LEVEL_LOW)
37
+ {
38
+ $logMsg = 'Warning: '.$message;
39
+ $res = self::write($logMsg, $level);
40
+ return $res;
41
+ }
42
+
43
+ public static function write($message, $level = SG_LOG_LEVEL_LOW)
44
+ {
45
+ $res = SGLog::write($message, $level);
46
+ return $res;
47
+ }
48
+
49
+ public static function readAll()
50
+ {
51
+ return SGLog::readAll();
52
+ }
53
+
54
+ public static function clear($level = SG_LOG_LEVEL_LOW)
55
+ {
56
+ SGLog::clear($level);
57
+ }
58
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/backup/SGIBackupDelegate.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface SGIBackupDelegate
4
+ {
5
+ public function isCancelled();
6
+ public function didUpdateProgress($progress);
7
+ public function isBackgroundMode();
8
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/database/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/core/database/SGDatabase.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SGDatabase
4
+ {
5
+ private static $instance = null;
6
+
7
+ public static function getInstance()
8
+ {
9
+ if (!self::$instance)
10
+ {
11
+ self::$instance = self::createAdapterInstance();
12
+ }
13
+
14
+ return self::$instance;
15
+ }
16
+
17
+ private static function createAdapterInstance()
18
+ {
19
+ $className = 'SGDatabaseAdapter'.SG_DB_ADAPTER;
20
+ require_once(SG_DATABASE_PATH.$className.'.php');
21
+ $adapter = new $className();
22
+ return $adapter;
23
+ }
24
+
25
+ private function __construct()
26
+ {
27
+
28
+ }
29
+
30
+ private function __clone()
31
+ {
32
+
33
+ }
34
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/database/SGDatabaseAdapterMagento.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_DATABASE_PATH.'SGIDatabaseAdapter.php');
3
+
4
+ class SGDatabaseAdapterMagento implements SGIDatabaseAdapter
5
+ {
6
+ private $link = null;
7
+
8
+ public function __construct()
9
+ {
10
+ $resource = Mage::getSingleton('core/resource');
11
+ $this->link = $resource->getConnection('core_write');
12
+ }
13
+
14
+ public function query($query, $params=array())
15
+ {
16
+ $st = $this->exec($query, $params);
17
+ if (!$st)
18
+ {
19
+ return false;
20
+ }
21
+
22
+ $op = strtoupper(substr(trim($query), 0, 6));
23
+ if ($op!='INSERT' && $op!='UPDATE' && $op!='DELETE' && $op!='SET NA')
24
+ {
25
+ return $st->fetchAll();
26
+ }
27
+
28
+ return true;
29
+ }
30
+
31
+ public function exec($query, $params=array())
32
+ {
33
+ $query = str_replace("%d", "?", $query);
34
+ $query = str_replace("%s", "?", $query);
35
+ $query = str_replace("%f", "?", $query);
36
+
37
+ $st = $this->link->prepare($query);
38
+ $res = $st->execute($params);
39
+ if (!$res)
40
+ {
41
+ return false;
42
+ }
43
+
44
+ return $st;
45
+ }
46
+
47
+ public function fetch($st)
48
+ {
49
+ if ($st)
50
+ {
51
+ return $st->fetch();
52
+ }
53
+ }
54
+
55
+ public function lastInsertId()
56
+ {
57
+ return $this->link->lastInsertId();
58
+ }
59
+
60
+ public function printLastError()
61
+ {
62
+ print_r($this->link->errorInfo());
63
+ }
64
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/database/SGIDatabaseAdapter.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface SGIDatabaseAdapter
4
+ {
5
+ /*
6
+ The query may contain any of the following placeholders: %s, %d and %f
7
+ The number of given parameters must be equal to the number of placeholders.
8
+ This method must return the fetched results if the query is fetchable.
9
+ */
10
+ public function query($query, $params=array());
11
+
12
+ /*
13
+ Execute a query and return the statement object.
14
+ */
15
+ public function exec($query, $params=array());
16
+
17
+ /*
18
+ Fetch a row from a previously executed query.
19
+ */
20
+ public function fetch($st);
21
+
22
+ /*
23
+ Return the last insert id.
24
+ */
25
+ public function lastInsertId();
26
+
27
+ /*
28
+ Print the error (if any) generated by the most recent query.
29
+ */
30
+ public function printLastError();
31
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/exception/SGException.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SGException extends Exception
4
+ {
5
+ public function __toString()
6
+ {
7
+ return get_class($this).": {$this->message}";
8
+ }
9
+ }
10
+
11
+ class SGExceptionNotFound extends SGException
12
+ {
13
+ public function __construct($msg = 'Not found')
14
+ {
15
+ parent::__construct($msg, 404, null);
16
+ }
17
+ }
18
+
19
+ class SGExceptionForbidden extends SGException
20
+ {
21
+ public function __construct($msg = 'Forbidden')
22
+ {
23
+ parent::__construct($msg, 403, null);
24
+ }
25
+ }
26
+
27
+ class SGExceptionBadRequest extends SGException
28
+ {
29
+ public function __construct($msg = 'Bad request')
30
+ {
31
+ parent::__construct($msg, 400, null);
32
+ }
33
+ }
34
+
35
+ class SGExceptionMethodNotAllowed extends SGException
36
+ {
37
+ public function __construct($msg = 'Method not allowed')
38
+ {
39
+ parent::__construct($msg, 405, null);
40
+ }
41
+ }
42
+
43
+ class SGExceptionDatabaseError extends SGException
44
+ {
45
+ public function __construct($msg = 'Database error')
46
+ {
47
+ parent::__construct($msg, 500, null);
48
+ }
49
+ }
50
+
51
+ class SGExceptionServerError extends SGException
52
+ {
53
+ public function __construct($msg = 'Internal server error')
54
+ {
55
+ parent::__construct($msg, 500, null);
56
+ }
57
+ }
58
+
59
+ class SGExceptionSkip extends SGException
60
+ {
61
+ public function __construct($msg = 'Skip exception')
62
+ {
63
+ parent::__construct($msg, 1, null);
64
+ }
65
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/exception/SGExceptionHandler.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__).'/SGException.php');
3
+
4
+ class SGExceptionHandler
5
+ {
6
+ public static function init()
7
+ {
8
+ set_exception_handler('SGExceptionHandler::exceptionHandler');
9
+ }
10
+
11
+ public static function log($exception)
12
+ {
13
+ echo $exception;
14
+ //Sns_Log::log_exception( get_class( $ex ) , $ex->getMessage() , $ex->getFile() , $ex->getLine() );
15
+ }
16
+
17
+ public static function exceptionHandler($exception)
18
+ {
19
+ self::log($exception);
20
+ return true;
21
+ }
22
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/functions.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function realFilesize($filename)
3
+ {
4
+ $fp = fopen($filename, 'r');
5
+ $return = false;
6
+ if (is_resource($fp))
7
+ {
8
+ if (PHP_INT_SIZE < 8) // 32 bit
9
+ {
10
+ if (0 === fseek($fp, 0, SEEK_END))
11
+ {
12
+ $return = 0.0;
13
+ $step = 0x7FFFFFFF;
14
+ while ($step > 0)
15
+ {
16
+ if (0 === fseek($fp, - $step, SEEK_CUR))
17
+ {
18
+ $return += floatval($step);
19
+ }
20
+ else
21
+ {
22
+ $step >>= 1;
23
+ }
24
+ }
25
+ }
26
+ }
27
+ else if (0 === fseek($fp, 0, SEEK_END)) // 64 bit
28
+ {
29
+ $return = ftell($fp);
30
+ }
31
+ }
32
+
33
+ return $return;
34
+ }
35
+
36
+ function formattedDuration($startTs, $endTs)
37
+ {
38
+ $unit = 'seconds';
39
+ $duration = $endTs-$startTs;
40
+ if ($duration>=60 && $duration<3600)
41
+ {
42
+ $duration /= 60.0;
43
+ $unit = 'minutes';
44
+ }
45
+ else if ($duration>=3600)
46
+ {
47
+ $duration /= 3600.0;
48
+ $unit = 'hours';
49
+ }
50
+ $duration = number_format($duration, 2, '.', '');
51
+
52
+ return $duration.' '.$unit;
53
+ }
54
+
55
+ function deleteDirectory($dirName)
56
+ {
57
+ $dirHandle = null;
58
+ if (is_dir($dirName))
59
+ {
60
+ $dirHandle = opendir($dirName);
61
+ }
62
+
63
+ if (!$dirHandle)
64
+ {
65
+ return false;
66
+ }
67
+
68
+ while ($file = readdir($dirHandle))
69
+ {
70
+ if ($file != "." && $file != "..")
71
+ {
72
+ if (!is_dir($dirName."/".$file))
73
+ {
74
+ @unlink($dirName."/".$file);
75
+ }
76
+ else
77
+ {
78
+ deleteDirectory($dirName.'/'.$file);
79
+ }
80
+ }
81
+ }
82
+
83
+ closedir($dirHandle);
84
+ return @rmdir($dirName);
85
+ }
86
+
87
+ function downloadFile($file, $type = 'application/octet-stream')
88
+ {
89
+ // Make sure the files exists, otherwise we are wasting our time
90
+ if (!file_exists($file))
91
+ {
92
+ header("HTTP/1.1 404 Not Found");
93
+ exit;
94
+ }
95
+
96
+ $size = realFilesize($file);
97
+
98
+ $name = basename($file);
99
+ header('Pragma: public');
100
+ header('Expires: 0');
101
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
102
+ header('Cache-Control: private', false);
103
+ header('Content-Transfer-Encoding: binary');
104
+ header('Content-Disposition: attachment; filename="'.$name.'";');
105
+ header('Content-Type: ' . $type);
106
+ header('Content-Length: ' . $size);
107
+
108
+ $chunkSize = 1024 * 1024 * 8;
109
+ $handle = fopen($file, 'rb');
110
+ while (!feof($handle))
111
+ {
112
+ $buffer = fread($handle, $chunkSize);
113
+ echo $buffer;
114
+ ob_flush();
115
+ flush();
116
+ }
117
+ fclose($handle);
118
+
119
+ exit;
120
+ }
121
+
122
+ function shutdownAction($actionId, $actionType, $filePath, $dbFilePath)
123
+ {
124
+ $action = SGBackup::getAction($actionId);
125
+ if ($action && ($action['status']==SG_ACTION_STATUS_IN_PROGRESS_DB || $action['status']==SG_ACTION_STATUS_IN_PROGRESS_FILES))
126
+ {
127
+ SGBackupLog::writeExceptionObject(new SGExceptionServerError('Execution time abort'));
128
+
129
+ SGBackup::changeActionStatus($actionId, SG_ACTION_STATUS_ERROR);
130
+
131
+ if ($actionType==SG_ACTION_TYPE_BACKUP)
132
+ {
133
+ @unlink($filePath);
134
+ @unlink($dbFilePath);
135
+ }
136
+ }
137
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/log/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/core/log/SGFileLogHandler.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(SG_LOG_PATH.'SGILogHandler.php');
3
+
4
+ class SGFileLogHandler implements SGILogHandler
5
+ {
6
+ protected $filePath = '';
7
+
8
+ public function __construct($filePath)
9
+ {
10
+ $this->filePath = $filePath;
11
+ }
12
+
13
+ public function canBeCleared()
14
+ {
15
+ return true;
16
+ }
17
+
18
+ public function isWritable()
19
+ {
20
+ if (!file_exists($this->filePath))
21
+ {
22
+ $fp = fopen($this->filePath, 'wb');
23
+ if (!$fp)
24
+ {
25
+ return false;
26
+ }
27
+
28
+ fclose($fp);
29
+ }
30
+
31
+ return is_writable($this->filePath);
32
+ }
33
+
34
+ public function write($message)
35
+ {
36
+ if (!self::isWritable())
37
+ {
38
+ return false;
39
+ }
40
+
41
+ $content = @date('Y-m-d H:i').': '.$message.PHP_EOL;
42
+ if (file_put_contents($this->filePath, $content, FILE_APPEND))
43
+ {
44
+ return true;
45
+ }
46
+
47
+ return false;
48
+ }
49
+
50
+ public function readAll()
51
+ {
52
+ if (!is_readable($this->filePath))
53
+ {
54
+ return false;
55
+ }
56
+
57
+ $content = file_get_contents($this->filePath);
58
+ return $content;
59
+ }
60
+
61
+ public function clear()
62
+ {
63
+ if (!self::isWritable())
64
+ {
65
+ return false;
66
+ }
67
+
68
+ return @unlink($this->filePath);
69
+ }
70
+ }
app/code/community/BackupGuard/BackupGuardFree/com/core/log/SGILogHandler.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ interface SGILogHandler {
4
+ public function canBeCleared();
5
+ public function isWritable();
6
+ public function write($message);
7
+ public function readAll();
8
+ public function clear();
9
+ }
10
+ ?>
app/code/community/BackupGuard/BackupGuardFree/com/core/log/SGLog.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SGLog
4
+ {
5
+ private static $logHandlers = array();
6
+
7
+ public static function registerLogHandler(SGILogHandler $logHandler, $level = 0, $mainHandler = false)
8
+ {
9
+ if ($logHandler instanceof SGILogHandler)
10
+ {
11
+ self::$logHandlers[] = array('logHandler' => $logHandler, 'level' => $level, 'mainHandler' => $mainHandler);
12
+ return true;
13
+ }
14
+ return false;
15
+ }
16
+
17
+ public static function removeAllHandlers($level = 0)
18
+ {
19
+ if ($level == 0)
20
+ {
21
+ self::$logHandlers = array();
22
+ return;
23
+ }
24
+
25
+ $handlers = array();
26
+ foreach (self::$logHandlers as $logHandler)
27
+ {
28
+ if (!self::levelBelongsToLevel($level, $logHandler['level']))
29
+ {
30
+ $handlers[] = $logHandler;
31
+ }
32
+ }
33
+ self::$logHandlers = $handlers;
34
+ }
35
+
36
+ private static function levelBelongsToLevel($level, $levelToBelong)
37
+ {
38
+ if ((($levelToBelong|SG_LOG_LEVEL_HIGH) == $level) ||
39
+ (($levelToBelong|SG_LOG_LEVEL_LOW) == $level) ||
40
+ (($levelToBelong|SG_LOG_LEVEL_MEDIUM) == $level) ||
41
+ (($levelToBelong|SG_LOG_LEVEL_MEDIUM|SG_LOG_LEVEL_LOW) == $level) ||
42
+ (($levelToBelong|SG_LOG_LEVEL_MEDIUM|SG_LOG_LEVEL_HIGH) == $level) ||
43
+ (($levelToBelong|SG_LOG_LEVEL_LOW|SG_LOG_LEVEL_HIGH) == $level))
44
+ {
45
+ return true;
46
+ }
47
+
48
+ return false;
49
+ }
50
+
51
+ public static function write($message, $level = 0)
52
+ {
53
+ foreach(self::$logHandlers as $logHandler)
54
+ {
55
+ if ($level)
56
+ {
57
+ if (self::levelBelongsToLevel($level, $logHandler['level']))
58
+ {
59
+ $logHandler['logHandler']->write($message);
60
+ }
61
+ continue;
62
+ }
63
+ $logHandler['logHandler']->write($message);
64
+ }
65
+ }
66
+
67
+ public static function readAll()
68
+ {
69
+ foreach(self::$logHandlers as $logHandler)
70
+ {
71
+ if ($logHandler['mainHandler'])
72
+ {
73
+ return $logHandler['logHandler']->readAll();
74
+ }
75
+ }
76
+ return array();
77
+ }
78
+
79
+ public static function clear($level = 0)
80
+ {
81
+ foreach(self::$logHandlers as $logHandler)
82
+ {
83
+ if ($level)
84
+ {
85
+ if (self::levelBelongsToLevel($level, $logHandler['level']))
86
+ {
87
+ $logHandler['logHandler']->clear();
88
+ }
89
+ continue;
90
+ }
91
+ $logHandler['logHandler']->clear();
92
+ }
93
+ }
94
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/lib/BigInteger.php ADDED
@@ -0,0 +1,3758 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Pure-PHP arbitrary precision integer arithmetic library.
5
+ *
6
+ * Supports base-2, base-10, base-16, and base-256 numbers. Uses the GMP or BCMath extensions, if available,
7
+ * and an internal implementation, otherwise.
8
+ *
9
+ * PHP versions 4 and 5
10
+ *
11
+ * {@internal (all DocBlock comments regarding implementation - such as the one that follows - refer to the
12
+ * {@link MATH_BIGINTEGER_MODE_INTERNAL MATH_BIGINTEGER_MODE_INTERNAL} mode)
13
+ *
14
+ * Math_BigInteger uses base-2**26 to perform operations such as multiplication and division and
15
+ * base-2**52 (ie. two base 2**26 digits) to perform addition and subtraction. Because the largest possible
16
+ * value when multiplying two base-2**26 numbers together is a base-2**52 number, double precision floating
17
+ * point numbers - numbers that should be supported on most hardware and whose significand is 53 bits - are
18
+ * used. As a consequence, bitwise operators such as >> and << cannot be used, nor can the modulo operator %,
19
+ * which only supports integers. Although this fact will slow this library down, the fact that such a high
20
+ * base is being used should more than compensate.
21
+ *
22
+ * Numbers are stored in {@link http://en.wikipedia.org/wiki/Endianness little endian} format. ie.
23
+ * (new Math_BigInteger(pow(2, 26)))->value = array(0, 1)
24
+ *
25
+ * Useful resources are as follows:
26
+ *
27
+ * - {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf Handbook of Applied Cryptography (HAC)}
28
+ * - {@link http://math.libtomcrypt.com/files/tommath.pdf Multi-Precision Math (MPM)}
29
+ * - Java's BigInteger classes. See /j2se/src/share/classes/java/math in jdk-1_5_0-src-jrl.zip
30
+ *
31
+ * Here's an example of how to use this library:
32
+ * <code>
33
+ * <?php
34
+ * include 'Math/BigInteger.php';
35
+ *
36
+ * $a = new Math_BigInteger(2);
37
+ * $b = new Math_BigInteger(3);
38
+ *
39
+ * $c = $a->add($b);
40
+ *
41
+ * echo $c->toString(); // outputs 5
42
+ * ?>
43
+ * </code>
44
+ *
45
+ * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
46
+ * of this software and associated documentation files (the "Software"), to deal
47
+ * in the Software without restriction, including without limitation the rights
48
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49
+ * copies of the Software, and to permit persons to whom the Software is
50
+ * furnished to do so, subject to the following conditions:
51
+ *
52
+ * The above copyright notice and this permission notice shall be included in
53
+ * all copies or substantial portions of the Software.
54
+ *
55
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
61
+ * THE SOFTWARE.
62
+ *
63
+ * @category Math
64
+ * @package Math_BigInteger
65
+ * @author Jim Wigginton <terrafrost@php.net>
66
+ * @copyright 2006 Jim Wigginton
67
+ * @license http://www.opensource.org/licenses/mit-license.html MIT License
68
+ * @link http://pear.php.net/package/Math_BigInteger
69
+ */
70
+
71
+ /**#@+
72
+ * Reduction constants
73
+ *
74
+ * @access private
75
+ * @see Math_BigInteger::_reduce()
76
+ */
77
+ /**
78
+ * @see Math_BigInteger::_montgomery()
79
+ * @see Math_BigInteger::_prepMontgomery()
80
+ */
81
+ define('MATH_BIGINTEGER_MONTGOMERY', 0);
82
+ /**
83
+ * @see Math_BigInteger::_barrett()
84
+ */
85
+ define('MATH_BIGINTEGER_BARRETT', 1);
86
+ /**
87
+ * @see Math_BigInteger::_mod2()
88
+ */
89
+ define('MATH_BIGINTEGER_POWEROF2', 2);
90
+ /**
91
+ * @see Math_BigInteger::_remainder()
92
+ */
93
+ define('MATH_BIGINTEGER_CLASSIC', 3);
94
+ /**
95
+ * @see Math_BigInteger::__clone()
96
+ */
97
+ define('MATH_BIGINTEGER_NONE', 4);
98
+ /**#@-*/
99
+
100
+ /**#@+
101
+ * Array constants
102
+ *
103
+ * Rather than create a thousands and thousands of new Math_BigInteger objects in repeated function calls to add() and
104
+ * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them.
105
+ *
106
+ * @access private
107
+ */
108
+ /**
109
+ * $result[MATH_BIGINTEGER_VALUE] contains the value.
110
+ */
111
+ define('MATH_BIGINTEGER_VALUE', 0);
112
+ /**
113
+ * $result[MATH_BIGINTEGER_SIGN] contains the sign.
114
+ */
115
+ define('MATH_BIGINTEGER_SIGN', 1);
116
+ /**#@-*/
117
+
118
+ /**#@+
119
+ * @access private
120
+ * @see Math_BigInteger::_montgomery()
121
+ * @see Math_BigInteger::_barrett()
122
+ */
123
+ /**
124
+ * Cache constants
125
+ *
126
+ * $cache[MATH_BIGINTEGER_VARIABLE] tells us whether or not the cached data is still valid.
127
+ */
128
+ define('MATH_BIGINTEGER_VARIABLE', 0);
129
+ /**
130
+ * $cache[MATH_BIGINTEGER_DATA] contains the cached data.
131
+ */
132
+ define('MATH_BIGINTEGER_DATA', 1);
133
+ /**#@-*/
134
+
135
+ /**#@+
136
+ * Mode constants.
137
+ *
138
+ * @access private
139
+ * @see Math_BigInteger::Math_BigInteger()
140
+ */
141
+ /**
142
+ * To use the pure-PHP implementation
143
+ */
144
+ define('MATH_BIGINTEGER_MODE_INTERNAL', 1);
145
+ /**
146
+ * To use the BCMath library
147
+ *
148
+ * (if enabled; otherwise, the internal implementation will be used)
149
+ */
150
+ define('MATH_BIGINTEGER_MODE_BCMATH', 2);
151
+ /**
152
+ * To use the GMP library
153
+ *
154
+ * (if present; otherwise, either the BCMath or the internal implementation will be used)
155
+ */
156
+ define('MATH_BIGINTEGER_MODE_GMP', 3);
157
+ /**#@-*/
158
+
159
+ /**
160
+ * Karatsuba Cutoff
161
+ *
162
+ * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication?
163
+ *
164
+ * @access private
165
+ */
166
+ define('MATH_BIGINTEGER_KARATSUBA_CUTOFF', 25);
167
+
168
+ /**
169
+ * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256
170
+ * numbers.
171
+ *
172
+ * @package Math_BigInteger
173
+ * @author Jim Wigginton <terrafrost@php.net>
174
+ * @access public
175
+ */
176
+ class Math_BigInteger
177
+ {
178
+ /**
179
+ * Holds the BigInteger's value.
180
+ *
181
+ * @var Array
182
+ * @access private
183
+ */
184
+ var $value;
185
+
186
+ /**
187
+ * Holds the BigInteger's magnitude.
188
+ *
189
+ * @var Boolean
190
+ * @access private
191
+ */
192
+ var $is_negative = false;
193
+
194
+ /**
195
+ * Random number generator function
196
+ *
197
+ * @see setRandomGenerator()
198
+ * @access private
199
+ */
200
+ var $generator = 'mt_rand';
201
+
202
+ /**
203
+ * Precision
204
+ *
205
+ * @see setPrecision()
206
+ * @access private
207
+ */
208
+ var $precision = -1;
209
+
210
+ /**
211
+ * Precision Bitmask
212
+ *
213
+ * @see setPrecision()
214
+ * @access private
215
+ */
216
+ var $bitmask = false;
217
+
218
+ /**
219
+ * Mode independent value used for serialization.
220
+ *
221
+ * If the bcmath or gmp extensions are installed $this->value will be a non-serializable resource, hence the need for
222
+ * a variable that'll be serializable regardless of whether or not extensions are being used. Unlike $this->value,
223
+ * however, $this->hex is only calculated when $this->__sleep() is called.
224
+ *
225
+ * @see __sleep()
226
+ * @see __wakeup()
227
+ * @var String
228
+ * @access private
229
+ */
230
+ var $hex;
231
+
232
+ /**
233
+ * Converts base-2, base-10, base-16, and binary strings (base-256) to BigIntegers.
234
+ *
235
+ * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using
236
+ * two's compliment. The sole exception to this is -10, which is treated the same as 10 is.
237
+ *
238
+ * Here's an example:
239
+ * <code>
240
+ * <?php
241
+ * include 'Math/BigInteger.php';
242
+ *
243
+ * $a = new Math_BigInteger('0x32', 16); // 50 in base-16
244
+ *
245
+ * echo $a->toString(); // outputs 50
246
+ * ?>
247
+ * </code>
248
+ *
249
+ * @param optional $x base-10 number or base-$base number if $base set.
250
+ * @param optional integer $base
251
+ * @return Math_BigInteger
252
+ * @access public
253
+ */
254
+ function Math_BigInteger($x = 0, $base = 10)
255
+ {
256
+ if ( !defined('MATH_BIGINTEGER_MODE') ) {
257
+ switch (true) {
258
+ case extension_loaded('gmp'):
259
+ define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP);
260
+ break;
261
+ case extension_loaded('bcmath'):
262
+ define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH);
263
+ break;
264
+ default:
265
+ define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL);
266
+ }
267
+ }
268
+
269
+ if (function_exists('openssl_public_encrypt') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
270
+ // some versions of XAMPP have mismatched versions of OpenSSL which causes it not to work
271
+ ob_start();
272
+ @phpinfo();
273
+ $content = ob_get_contents();
274
+ ob_end_clean();
275
+
276
+ preg_match_all('#OpenSSL (Header|Library) Version(.*)#im', $content, $matches);
277
+
278
+ $versions = array();
279
+ if (!empty($matches[1])) {
280
+ for ($i = 0; $i < count($matches[1]); $i++) {
281
+ $fullVersion = trim(str_replace('=>', '', strip_tags($matches[2][$i])));
282
+
283
+ // Remove letter part in OpenSSL version
284
+ if (!preg_match('/(\d+\.\d+\.\d+)/i', $fullVersion, $m)) {
285
+ $versions[$matches[1][$i]] = $fullVersion;
286
+ } else {
287
+ $versions[$matches[1][$i]] = $m[0];
288
+ }
289
+ }
290
+ }
291
+
292
+ // it doesn't appear that OpenSSL versions were reported upon until PHP 5.3+
293
+ switch (true) {
294
+ case !isset($versions['Header']):
295
+ case !isset($versions['Library']):
296
+ case $versions['Header'] == $versions['Library']:
297
+ define('MATH_BIGINTEGER_OPENSSL_ENABLED', true);
298
+ break;
299
+ default:
300
+ define('MATH_BIGINTEGER_OPENSSL_DISABLE', true);
301
+ }
302
+ }
303
+
304
+ if (!defined('PHP_INT_SIZE')) {
305
+ define('PHP_INT_SIZE', 4);
306
+ }
307
+
308
+ if (!defined('MATH_BIGINTEGER_BASE') && MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_INTERNAL) {
309
+ switch (PHP_INT_SIZE) {
310
+ case 8: // use 64-bit integers if int size is 8 bytes
311
+ define('MATH_BIGINTEGER_BASE', 31);
312
+ define('MATH_BIGINTEGER_BASE_FULL', 0x80000000);
313
+ define('MATH_BIGINTEGER_MAX_DIGIT', 0x7FFFFFFF);
314
+ define('MATH_BIGINTEGER_MSB', 0x40000000);
315
+ // 10**9 is the closest we can get to 2**31 without passing it
316
+ define('MATH_BIGINTEGER_MAX10', 1000000000);
317
+ define('MATH_BIGINTEGER_MAX10_LEN', 9);
318
+ // the largest digit that may be used in addition / subtraction
319
+ define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 62));
320
+ break;
321
+ //case 4: // use 64-bit floats if int size is 4 bytes
322
+ default:
323
+ define('MATH_BIGINTEGER_BASE', 26);
324
+ define('MATH_BIGINTEGER_BASE_FULL', 0x4000000);
325
+ define('MATH_BIGINTEGER_MAX_DIGIT', 0x3FFFFFF);
326
+ define('MATH_BIGINTEGER_MSB', 0x2000000);
327
+ // 10**7 is the closest to 2**26 without passing it
328
+ define('MATH_BIGINTEGER_MAX10', 10000000);
329
+ define('MATH_BIGINTEGER_MAX10_LEN', 7);
330
+ // the largest digit that may be used in addition / subtraction
331
+ // we do pow(2, 52) instead of using 4503599627370496 directly because some
332
+ // PHP installations will truncate 4503599627370496.
333
+ define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 52));
334
+ }
335
+ }
336
+
337
+ switch ( MATH_BIGINTEGER_MODE ) {
338
+ case MATH_BIGINTEGER_MODE_GMP:
339
+ switch (true) {
340
+ case is_resource($x) && get_resource_type($x) == 'GMP integer':
341
+ // PHP 5.6 switched GMP from using resources to objects
342
+ case is_object($x) && get_class($x) == 'GMP':
343
+ $this->value = $x;
344
+ return;
345
+ }
346
+ $this->value = gmp_init(0);
347
+ break;
348
+ case MATH_BIGINTEGER_MODE_BCMATH:
349
+ $this->value = '0';
350
+ break;
351
+ default:
352
+ $this->value = array();
353
+ }
354
+
355
+ // '0' counts as empty() but when the base is 256 '0' is equal to ord('0') or 48
356
+ // '0' is the only value like this per http://php.net/empty
357
+ if (empty($x) && (abs($base) != 256 || $x !== '0')) {
358
+ return;
359
+ }
360
+
361
+ switch ($base) {
362
+ case -256:
363
+ if (ord($x[0]) & 0x80) {
364
+ $x = ~$x;
365
+ $this->is_negative = true;
366
+ }
367
+ case 256:
368
+ switch ( MATH_BIGINTEGER_MODE ) {
369
+ case MATH_BIGINTEGER_MODE_GMP:
370
+ $sign = $this->is_negative ? '-' : '';
371
+ $this->value = gmp_init($sign . '0x' . bin2hex($x));
372
+ break;
373
+ case MATH_BIGINTEGER_MODE_BCMATH:
374
+ // round $len to the nearest 4 (thanks, DavidMJ!)
375
+ $len = (strlen($x) + 3) & 0xFFFFFFFC;
376
+
377
+ $x = str_pad($x, $len, chr(0), STR_PAD_LEFT);
378
+
379
+ for ($i = 0; $i < $len; $i+= 4) {
380
+ $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32
381
+ $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0);
382
+ }
383
+
384
+ if ($this->is_negative) {
385
+ $this->value = '-' . $this->value;
386
+ }
387
+
388
+ break;
389
+ // converts a base-2**8 (big endian / msb) number to base-2**26 (little endian / lsb)
390
+ default:
391
+ while (strlen($x)) {
392
+ $this->value[] = $this->_bytes2int($this->_base256_rshift($x, MATH_BIGINTEGER_BASE));
393
+ }
394
+ }
395
+
396
+ if ($this->is_negative) {
397
+ if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) {
398
+ $this->is_negative = false;
399
+ }
400
+ $temp = $this->add(new Math_BigInteger('-1'));
401
+ $this->value = $temp->value;
402
+ }
403
+ break;
404
+ case 16:
405
+ case -16:
406
+ if ($base > 0 && $x[0] == '-') {
407
+ $this->is_negative = true;
408
+ $x = substr($x, 1);
409
+ }
410
+
411
+ $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x);
412
+
413
+ $is_negative = false;
414
+ if ($base < 0 && hexdec($x[0]) >= 8) {
415
+ $this->is_negative = $is_negative = true;
416
+ $x = bin2hex(~pack('H*', $x));
417
+ }
418
+
419
+ switch ( MATH_BIGINTEGER_MODE ) {
420
+ case MATH_BIGINTEGER_MODE_GMP:
421
+ $temp = $this->is_negative ? '-0x' . $x : '0x' . $x;
422
+ $this->value = gmp_init($temp);
423
+ $this->is_negative = false;
424
+ break;
425
+ case MATH_BIGINTEGER_MODE_BCMATH:
426
+ $x = ( strlen($x) & 1 ) ? '0' . $x : $x;
427
+ $temp = new Math_BigInteger(pack('H*', $x), 256);
428
+ $this->value = $this->is_negative ? '-' . $temp->value : $temp->value;
429
+ $this->is_negative = false;
430
+ break;
431
+ default:
432
+ $x = ( strlen($x) & 1 ) ? '0' . $x : $x;
433
+ $temp = new Math_BigInteger(pack('H*', $x), 256);
434
+ $this->value = $temp->value;
435
+ }
436
+
437
+ if ($is_negative) {
438
+ $temp = $this->add(new Math_BigInteger('-1'));
439
+ $this->value = $temp->value;
440
+ }
441
+ break;
442
+ case 10:
443
+ case -10:
444
+ // (?<!^)(?:-).*: find any -'s that aren't at the beginning and then any characters that follow that
445
+ // (?<=^|-)0*: find any 0's that are preceded by the start of the string or by a - (ie. octals)
446
+ // [^-0-9].*: find any non-numeric characters and then any characters that follow that
447
+ $x = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x);
448
+
449
+ switch ( MATH_BIGINTEGER_MODE ) {
450
+ case MATH_BIGINTEGER_MODE_GMP:
451
+ $this->value = gmp_init($x);
452
+ break;
453
+ case MATH_BIGINTEGER_MODE_BCMATH:
454
+ // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different
455
+ // results then doing it on '-1' does (modInverse does $x[0])
456
+ $this->value = $x === '-' ? '0' : (string) $x;
457
+ break;
458
+ default:
459
+ $temp = new Math_BigInteger();
460
+
461
+ $multiplier = new Math_BigInteger();
462
+ $multiplier->value = array(MATH_BIGINTEGER_MAX10);
463
+
464
+ if ($x[0] == '-') {
465
+ $this->is_negative = true;
466
+ $x = substr($x, 1);
467
+ }
468
+
469
+ $x = str_pad($x, strlen($x) + ((MATH_BIGINTEGER_MAX10_LEN - 1) * strlen($x)) % MATH_BIGINTEGER_MAX10_LEN, 0, STR_PAD_LEFT);
470
+ while (strlen($x)) {
471
+ $temp = $temp->multiply($multiplier);
472
+ $temp = $temp->add(new Math_BigInteger($this->_int2bytes(substr($x, 0, MATH_BIGINTEGER_MAX10_LEN)), 256));
473
+ $x = substr($x, MATH_BIGINTEGER_MAX10_LEN);
474
+ }
475
+
476
+ $this->value = $temp->value;
477
+ }
478
+ break;
479
+ case 2: // base-2 support originally implemented by Lluis Pamies - thanks!
480
+ case -2:
481
+ if ($base > 0 && $x[0] == '-') {
482
+ $this->is_negative = true;
483
+ $x = substr($x, 1);
484
+ }
485
+
486
+ $x = preg_replace('#^([01]*).*#', '$1', $x);
487
+ $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT);
488
+
489
+ $str = '0x';
490
+ while (strlen($x)) {
491
+ $part = substr($x, 0, 4);
492
+ $str.= dechex(bindec($part));
493
+ $x = substr($x, 4);
494
+ }
495
+
496
+ if ($this->is_negative) {
497
+ $str = '-' . $str;
498
+ }
499
+
500
+ $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16
501
+ $this->value = $temp->value;
502
+ $this->is_negative = $temp->is_negative;
503
+
504
+ break;
505
+ default:
506
+ // base not supported, so we'll let $this == 0
507
+ }
508
+ }
509
+
510
+ /**
511
+ * Converts a BigInteger to a byte string (eg. base-256).
512
+ *
513
+ * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're
514
+ * saved as two's compliment.
515
+ *
516
+ * Here's an example:
517
+ * <code>
518
+ * <?php
519
+ * include 'Math/BigInteger.php';
520
+ *
521
+ * $a = new Math_BigInteger('65');
522
+ *
523
+ * echo $a->toBytes(); // outputs chr(65)
524
+ * ?>
525
+ * </code>
526
+ *
527
+ * @param Boolean $twos_compliment
528
+ * @return String
529
+ * @access public
530
+ * @internal Converts a base-2**26 number to base-2**8
531
+ */
532
+ function toBytes($twos_compliment = false)
533
+ {
534
+ if ($twos_compliment) {
535
+ $comparison = $this->compare(new Math_BigInteger());
536
+ if ($comparison == 0) {
537
+ return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : '';
538
+ }
539
+
540
+ $temp = $comparison < 0 ? $this->add(new Math_BigInteger(1)) : $this->copy();
541
+ $bytes = $temp->toBytes();
542
+
543
+ if (empty($bytes)) { // eg. if the number we're trying to convert is -1
544
+ $bytes = chr(0);
545
+ }
546
+
547
+ if (ord($bytes[0]) & 0x80) {
548
+ $bytes = chr(0) . $bytes;
549
+ }
550
+
551
+ return $comparison < 0 ? ~$bytes : $bytes;
552
+ }
553
+
554
+ switch ( MATH_BIGINTEGER_MODE ) {
555
+ case MATH_BIGINTEGER_MODE_GMP:
556
+ if (gmp_cmp($this->value, gmp_init(0)) == 0) {
557
+ return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : '';
558
+ }
559
+
560
+ $temp = gmp_strval(gmp_abs($this->value), 16);
561
+ $temp = ( strlen($temp) & 1 ) ? '0' . $temp : $temp;
562
+ $temp = pack('H*', $temp);
563
+
564
+ return $this->precision > 0 ?
565
+ substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) :
566
+ ltrim($temp, chr(0));
567
+ case MATH_BIGINTEGER_MODE_BCMATH:
568
+ if ($this->value === '0') {
569
+ return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : '';
570
+ }
571
+
572
+ $value = '';
573
+ $current = $this->value;
574
+
575
+ if ($current[0] == '-') {
576
+ $current = substr($current, 1);
577
+ }
578
+
579
+ while (bccomp($current, '0', 0) > 0) {
580
+ $temp = bcmod($current, '16777216');
581
+ $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value;
582
+ $current = bcdiv($current, '16777216', 0);
583
+ }
584
+
585
+ return $this->precision > 0 ?
586
+ substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) :
587
+ ltrim($value, chr(0));
588
+ }
589
+
590
+ if (!count($this->value)) {
591
+ return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : '';
592
+ }
593
+ $result = $this->_int2bytes($this->value[count($this->value) - 1]);
594
+
595
+ $temp = $this->copy();
596
+
597
+ for ($i = count($temp->value) - 2; $i >= 0; --$i) {
598
+ $temp->_base256_lshift($result, MATH_BIGINTEGER_BASE);
599
+ $result = $result | str_pad($temp->_int2bytes($temp->value[$i]), strlen($result), chr(0), STR_PAD_LEFT);
600
+ }
601
+
602
+ return $this->precision > 0 ?
603
+ str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) :
604
+ $result;
605
+ }
606
+
607
+ /**
608
+ * Converts a BigInteger to a hex string (eg. base-16)).
609
+ *
610
+ * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're
611
+ * saved as two's compliment.
612
+ *
613
+ * Here's an example:
614
+ * <code>
615
+ * <?php
616
+ * include 'Math/BigInteger.php';
617
+ *
618
+ * $a = new Math_BigInteger('65');
619
+ *
620
+ * echo $a->toHex(); // outputs '41'
621
+ * ?>
622
+ * </code>
623
+ *
624
+ * @param Boolean $twos_compliment
625
+ * @return String
626
+ * @access public
627
+ * @internal Converts a base-2**26 number to base-2**8
628
+ */
629
+ function toHex($twos_compliment = false)
630
+ {
631
+ return bin2hex($this->toBytes($twos_compliment));
632
+ }
633
+
634
+ /**
635
+ * Converts a BigInteger to a bit string (eg. base-2).
636
+ *
637
+ * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're
638
+ * saved as two's compliment.
639
+ *
640
+ * Here's an example:
641
+ * <code>
642
+ * <?php
643
+ * include 'Math/BigInteger.php';
644
+ *
645
+ * $a = new Math_BigInteger('65');
646
+ *
647
+ * echo $a->toBits(); // outputs '1000001'
648
+ * ?>
649
+ * </code>
650
+ *
651
+ * @param Boolean $twos_compliment
652
+ * @return String
653
+ * @access public
654
+ * @internal Converts a base-2**26 number to base-2**2
655
+ */
656
+ function toBits($twos_compliment = false)
657
+ {
658
+ $hex = $this->toHex($twos_compliment);
659
+ $bits = '';
660
+ for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i-=8) {
661
+ $bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT) . $bits;
662
+ }
663
+ if ($start) { // hexdec('') == 0
664
+ $bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT) . $bits;
665
+ }
666
+ $result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0');
667
+
668
+ if ($twos_compliment && $this->compare(new Math_BigInteger()) > 0 && $this->precision <= 0) {
669
+ return '0' . $result;
670
+ }
671
+
672
+ return $result;
673
+ }
674
+
675
+ /**
676
+ * Converts a BigInteger to a base-10 number.
677
+ *
678
+ * Here's an example:
679
+ * <code>
680
+ * <?php
681
+ * include 'Math/BigInteger.php';
682
+ *
683
+ * $a = new Math_BigInteger('50');
684
+ *
685
+ * echo $a->toString(); // outputs 50
686
+ * ?>
687
+ * </code>
688
+ *
689
+ * @return String
690
+ * @access public
691
+ * @internal Converts a base-2**26 number to base-10**7 (which is pretty much base-10)
692
+ */
693
+ function toString()
694
+ {
695
+ switch ( MATH_BIGINTEGER_MODE ) {
696
+ case MATH_BIGINTEGER_MODE_GMP:
697
+ return gmp_strval($this->value);
698
+ case MATH_BIGINTEGER_MODE_BCMATH:
699
+ if ($this->value === '0') {
700
+ return '0';
701
+ }
702
+
703
+ return ltrim($this->value, '0');
704
+ }
705
+
706
+ if (!count($this->value)) {
707
+ return '0';
708
+ }
709
+
710
+ $temp = $this->copy();
711
+ $temp->is_negative = false;
712
+
713
+ $divisor = new Math_BigInteger();
714
+ $divisor->value = array(MATH_BIGINTEGER_MAX10);
715
+ $result = '';
716
+ while (count($temp->value)) {
717
+ list($temp, $mod) = $temp->divide($divisor);
718
+ $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', MATH_BIGINTEGER_MAX10_LEN, '0', STR_PAD_LEFT) . $result;
719
+ }
720
+ $result = ltrim($result, '0');
721
+ if (empty($result)) {
722
+ $result = '0';
723
+ }
724
+
725
+ if ($this->is_negative) {
726
+ $result = '-' . $result;
727
+ }
728
+
729
+ return $result;
730
+ }
731
+
732
+ /**
733
+ * Copy an object
734
+ *
735
+ * PHP5 passes objects by reference while PHP4 passes by value. As such, we need a function to guarantee
736
+ * that all objects are passed by value, when appropriate. More information can be found here:
737
+ *
738
+ * {@link http://php.net/language.oop5.basic#51624}
739
+ *
740
+ * @access public
741
+ * @see __clone()
742
+ * @return Math_BigInteger
743
+ */
744
+ function copy()
745
+ {
746
+ $temp = new Math_BigInteger();
747
+ $temp->value = $this->value;
748
+ $temp->is_negative = $this->is_negative;
749
+ $temp->generator = $this->generator;
750
+ $temp->precision = $this->precision;
751
+ $temp->bitmask = $this->bitmask;
752
+ return $temp;
753
+ }
754
+
755
+ /**
756
+ * __toString() magic method
757
+ *
758
+ * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call
759
+ * toString().
760
+ *
761
+ * @access public
762
+ * @internal Implemented per a suggestion by Techie-Michael - thanks!
763
+ */
764
+ function __toString()
765
+ {
766
+ return $this->toString();
767
+ }
768
+
769
+ /**
770
+ * __clone() magic method
771
+ *
772
+ * Although you can call Math_BigInteger::__toString() directly in PHP5, you cannot call Math_BigInteger::__clone()
773
+ * directly in PHP5. You can in PHP4 since it's not a magic method, but in PHP5, you have to call it by using the PHP5
774
+ * only syntax of $y = clone $x. As such, if you're trying to write an application that works on both PHP4 and PHP5,
775
+ * call Math_BigInteger::copy(), instead.
776
+ *
777
+ * @access public
778
+ * @see copy()
779
+ * @return Math_BigInteger
780
+ */
781
+ function __clone()
782
+ {
783
+ return $this->copy();
784
+ }
785
+
786
+ /**
787
+ * __sleep() magic method
788
+ *
789
+ * Will be called, automatically, when serialize() is called on a Math_BigInteger object.
790
+ *
791
+ * @see __wakeup()
792
+ * @access public
793
+ */
794
+ function __sleep()
795
+ {
796
+ $this->hex = $this->toHex(true);
797
+ $vars = array('hex');
798
+ if ($this->generator != 'mt_rand') {
799
+ $vars[] = 'generator';
800
+ }
801
+ if ($this->precision > 0) {
802
+ $vars[] = 'precision';
803
+ }
804
+ return $vars;
805
+
806
+ }
807
+
808
+ /**
809
+ * __wakeup() magic method
810
+ *
811
+ * Will be called, automatically, when unserialize() is called on a Math_BigInteger object.
812
+ *
813
+ * @see __sleep()
814
+ * @access public
815
+ */
816
+ function __wakeup()
817
+ {
818
+ $temp = new Math_BigInteger($this->hex, -16);
819
+ $this->value = $temp->value;
820
+ $this->is_negative = $temp->is_negative;
821
+ $this->setRandomGenerator($this->generator);
822
+ if ($this->precision > 0) {
823
+ // recalculate $this->bitmask
824
+ $this->setPrecision($this->precision);
825
+ }
826
+ }
827
+
828
+ /**
829
+ * Adds two BigIntegers.
830
+ *
831
+ * Here's an example:
832
+ * <code>
833
+ * <?php
834
+ * include 'Math/BigInteger.php';
835
+ *
836
+ * $a = new Math_BigInteger('10');
837
+ * $b = new Math_BigInteger('20');
838
+ *
839
+ * $c = $a->add($b);
840
+ *
841
+ * echo $c->toString(); // outputs 30
842
+ * ?>
843
+ * </code>
844
+ *
845
+ * @param Math_BigInteger $y
846
+ * @return Math_BigInteger
847
+ * @access public
848
+ * @internal Performs base-2**52 addition
849
+ */
850
+ function add($y)
851
+ {
852
+ switch ( MATH_BIGINTEGER_MODE ) {
853
+ case MATH_BIGINTEGER_MODE_GMP:
854
+ $temp = new Math_BigInteger();
855
+ $temp->value = gmp_add($this->value, $y->value);
856
+
857
+ return $this->_normalize($temp);
858
+ case MATH_BIGINTEGER_MODE_BCMATH:
859
+ $temp = new Math_BigInteger();
860
+ $temp->value = bcadd($this->value, $y->value, 0);
861
+
862
+ return $this->_normalize($temp);
863
+ }
864
+
865
+ $temp = $this->_add($this->value, $this->is_negative, $y->value, $y->is_negative);
866
+
867
+ $result = new Math_BigInteger();
868
+ $result->value = $temp[MATH_BIGINTEGER_VALUE];
869
+ $result->is_negative = $temp[MATH_BIGINTEGER_SIGN];
870
+
871
+ return $this->_normalize($result);
872
+ }
873
+
874
+ /**
875
+ * Performs addition.
876
+ *
877
+ * @param Array $x_value
878
+ * @param Boolean $x_negative
879
+ * @param Array $y_value
880
+ * @param Boolean $y_negative
881
+ * @return Array
882
+ * @access private
883
+ */
884
+ function _add($x_value, $x_negative, $y_value, $y_negative)
885
+ {
886
+ $x_size = count($x_value);
887
+ $y_size = count($y_value);
888
+
889
+ if ($x_size == 0) {
890
+ return array(
891
+ MATH_BIGINTEGER_VALUE => $y_value,
892
+ MATH_BIGINTEGER_SIGN => $y_negative
893
+ );
894
+ } else if ($y_size == 0) {
895
+ return array(
896
+ MATH_BIGINTEGER_VALUE => $x_value,
897
+ MATH_BIGINTEGER_SIGN => $x_negative
898
+ );
899
+ }
900
+
901
+ // subtract, if appropriate
902
+ if ( $x_negative != $y_negative ) {
903
+ if ( $x_value == $y_value ) {
904
+ return array(
905
+ MATH_BIGINTEGER_VALUE => array(),
906
+ MATH_BIGINTEGER_SIGN => false
907
+ );
908
+ }
909
+
910
+ $temp = $this->_subtract($x_value, false, $y_value, false);
911
+ $temp[MATH_BIGINTEGER_SIGN] = $this->_compare($x_value, false, $y_value, false) > 0 ?
912
+ $x_negative : $y_negative;
913
+
914
+ return $temp;
915
+ }
916
+
917
+ if ($x_size < $y_size) {
918
+ $size = $x_size;
919
+ $value = $y_value;
920
+ } else {
921
+ $size = $y_size;
922
+ $value = $x_value;
923
+ }
924
+
925
+ $value[count($value)] = 0; // just in case the carry adds an extra digit
926
+
927
+ $carry = 0;
928
+ for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) {
929
+ $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] + $y_value[$j] * MATH_BIGINTEGER_BASE_FULL + $y_value[$i] + $carry;
930
+ $carry = $sum >= MATH_BIGINTEGER_MAX_DIGIT2; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1
931
+ $sum = $carry ? $sum - MATH_BIGINTEGER_MAX_DIGIT2 : $sum;
932
+
933
+ $temp = MATH_BIGINTEGER_BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31);
934
+
935
+ $value[$i] = (int) ($sum - MATH_BIGINTEGER_BASE_FULL * $temp); // eg. a faster alternative to fmod($sum, 0x4000000)
936
+ $value[$j] = $temp;
937
+ }
938
+
939
+ if ($j == $size) { // ie. if $y_size is odd
940
+ $sum = $x_value[$i] + $y_value[$i] + $carry;
941
+ $carry = $sum >= MATH_BIGINTEGER_BASE_FULL;
942
+ $value[$i] = $carry ? $sum - MATH_BIGINTEGER_BASE_FULL : $sum;
943
+ ++$i; // ie. let $i = $j since we've just done $value[$i]
944
+ }
945
+
946
+ if ($carry) {
947
+ for (; $value[$i] == MATH_BIGINTEGER_MAX_DIGIT; ++$i) {
948
+ $value[$i] = 0;
949
+ }
950
+ ++$value[$i];
951
+ }
952
+
953
+ return array(
954
+ MATH_BIGINTEGER_VALUE => $this->_trim($value),
955
+ MATH_BIGINTEGER_SIGN => $x_negative
956
+ );
957
+ }
958
+
959
+ /**
960
+ * Subtracts two BigIntegers.
961
+ *
962
+ * Here's an example:
963
+ * <code>
964
+ * <?php
965
+ * include 'Math/BigInteger.php';
966
+ *
967
+ * $a = new Math_BigInteger('10');
968
+ * $b = new Math_BigInteger('20');
969
+ *
970
+ * $c = $a->subtract($b);
971
+ *
972
+ * echo $c->toString(); // outputs -10
973
+ * ?>
974
+ * </code>
975
+ *
976
+ * @param Math_BigInteger $y
977
+ * @return Math_BigInteger
978
+ * @access public
979
+ * @internal Performs base-2**52 subtraction
980
+ */
981
+ function subtract($y)
982
+ {
983
+ switch ( MATH_BIGINTEGER_MODE ) {
984
+ case MATH_BIGINTEGER_MODE_GMP:
985
+ $temp = new Math_BigInteger();
986
+ $temp->value = gmp_sub($this->value, $y->value);
987
+
988
+ return $this->_normalize($temp);
989
+ case MATH_BIGINTEGER_MODE_BCMATH:
990
+ $temp = new Math_BigInteger();
991
+ $temp->value = bcsub($this->value, $y->value, 0);
992
+
993
+ return $this->_normalize($temp);
994
+ }
995
+
996
+ $temp = $this->_subtract($this->value, $this->is_negative, $y->value, $y->is_negative);
997
+
998
+ $result = new Math_BigInteger();
999
+ $result->value = $temp[MATH_BIGINTEGER_VALUE];
1000
+ $result->is_negative = $temp[MATH_BIGINTEGER_SIGN];
1001
+
1002
+ return $this->_normalize($result);
1003
+ }
1004
+
1005
+ /**
1006
+ * Performs subtraction.
1007
+ *
1008
+ * @param Array $x_value
1009
+ * @param Boolean $x_negative
1010
+ * @param Array $y_value
1011
+ * @param Boolean $y_negative
1012
+ * @return Array
1013
+ * @access private
1014
+ */
1015
+ function _subtract($x_value, $x_negative, $y_value, $y_negative)
1016
+ {
1017
+ $x_size = count($x_value);
1018
+ $y_size = count($y_value);
1019
+
1020
+ if ($x_size == 0) {
1021
+ return array(
1022
+ MATH_BIGINTEGER_VALUE => $y_value,
1023
+ MATH_BIGINTEGER_SIGN => !$y_negative
1024
+ );
1025
+ } else if ($y_size == 0) {
1026
+ return array(
1027
+ MATH_BIGINTEGER_VALUE => $x_value,
1028
+ MATH_BIGINTEGER_SIGN => $x_negative
1029
+ );
1030
+ }
1031
+
1032
+ // add, if appropriate (ie. -$x - +$y or +$x - -$y)
1033
+ if ( $x_negative != $y_negative ) {
1034
+ $temp = $this->_add($x_value, false, $y_value, false);
1035
+ $temp[MATH_BIGINTEGER_SIGN] = $x_negative;
1036
+
1037
+ return $temp;
1038
+ }
1039
+
1040
+ $diff = $this->_compare($x_value, $x_negative, $y_value, $y_negative);
1041
+
1042
+ if ( !$diff ) {
1043
+ return array(
1044
+ MATH_BIGINTEGER_VALUE => array(),
1045
+ MATH_BIGINTEGER_SIGN => false
1046
+ );
1047
+ }
1048
+
1049
+ // switch $x and $y around, if appropriate.
1050
+ if ( (!$x_negative && $diff < 0) || ($x_negative && $diff > 0) ) {
1051
+ $temp = $x_value;
1052
+ $x_value = $y_value;
1053
+ $y_value = $temp;
1054
+
1055
+ $x_negative = !$x_negative;
1056
+
1057
+ $x_size = count($x_value);
1058
+ $y_size = count($y_value);
1059
+ }
1060
+
1061
+ // at this point, $x_value should be at least as big as - if not bigger than - $y_value
1062
+
1063
+ $carry = 0;
1064
+ for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) {
1065
+ $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] - $y_value[$j] * MATH_BIGINTEGER_BASE_FULL - $y_value[$i] - $carry;
1066
+ $carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1
1067
+ $sum = $carry ? $sum + MATH_BIGINTEGER_MAX_DIGIT2 : $sum;
1068
+
1069
+ $temp = MATH_BIGINTEGER_BASE === 26 ? intval($sum / 0x4000000) : ($sum >> 31);
1070
+
1071
+ $x_value[$i] = (int) ($sum - MATH_BIGINTEGER_BASE_FULL * $temp);
1072
+ $x_value[$j] = $temp;
1073
+ }
1074
+
1075
+ if ($j == $y_size) { // ie. if $y_size is odd
1076
+ $sum = $x_value[$i] - $y_value[$i] - $carry;
1077
+ $carry = $sum < 0;
1078
+ $x_value[$i] = $carry ? $sum + MATH_BIGINTEGER_BASE_FULL : $sum;
1079
+ ++$i;
1080
+ }
1081
+
1082
+ if ($carry) {
1083
+ for (; !$x_value[$i]; ++$i) {
1084
+ $x_value[$i] = MATH_BIGINTEGER_MAX_DIGIT;
1085
+ }
1086
+ --$x_value[$i];
1087
+ }
1088
+
1089
+ return array(
1090
+ MATH_BIGINTEGER_VALUE => $this->_trim($x_value),
1091
+ MATH_BIGINTEGER_SIGN => $x_negative
1092
+ );
1093
+ }
1094
+
1095
+ /**
1096
+ * Multiplies two BigIntegers
1097
+ *
1098
+ * Here's an example:
1099
+ * <code>
1100
+ * <?php
1101
+ * include 'Math/BigInteger.php';
1102
+ *
1103
+ * $a = new Math_BigInteger('10');
1104
+ * $b = new Math_BigInteger('20');
1105
+ *
1106
+ * $c = $a->multiply($b);
1107
+ *
1108
+ * echo $c->toString(); // outputs 200
1109
+ * ?>
1110
+ * </code>
1111
+ *
1112
+ * @param Math_BigInteger $x
1113
+ * @return Math_BigInteger
1114
+ * @access public
1115
+ */
1116
+ function multiply($x)
1117
+ {
1118
+ switch ( MATH_BIGINTEGER_MODE ) {
1119
+ case MATH_BIGINTEGER_MODE_GMP:
1120
+ $temp = new Math_BigInteger();
1121
+ $temp->value = gmp_mul($this->value, $x->value);
1122
+
1123
+ return $this->_normalize($temp);
1124
+ case MATH_BIGINTEGER_MODE_BCMATH:
1125
+ $temp = new Math_BigInteger();
1126
+ $temp->value = bcmul($this->value, $x->value, 0);
1127
+
1128
+ return $this->_normalize($temp);
1129
+ }
1130
+
1131
+ $temp = $this->_multiply($this->value, $this->is_negative, $x->value, $x->is_negative);
1132
+
1133
+ $product = new Math_BigInteger();
1134
+ $product->value = $temp[MATH_BIGINTEGER_VALUE];
1135
+ $product->is_negative = $temp[MATH_BIGINTEGER_SIGN];
1136
+
1137
+ return $this->_normalize($product);
1138
+ }
1139
+
1140
+ /**
1141
+ * Performs multiplication.
1142
+ *
1143
+ * @param Array $x_value
1144
+ * @param Boolean $x_negative
1145
+ * @param Array $y_value
1146
+ * @param Boolean $y_negative
1147
+ * @return Array
1148
+ * @access private
1149
+ */
1150
+ function _multiply($x_value, $x_negative, $y_value, $y_negative)
1151
+ {
1152
+ //if ( $x_value == $y_value ) {
1153
+ // return array(
1154
+ // MATH_BIGINTEGER_VALUE => $this->_square($x_value),
1155
+ // MATH_BIGINTEGER_SIGN => $x_sign != $y_value
1156
+ // );
1157
+ //}
1158
+
1159
+ $x_length = count($x_value);
1160
+ $y_length = count($y_value);
1161
+
1162
+ if ( !$x_length || !$y_length ) { // a 0 is being multiplied
1163
+ return array(
1164
+ MATH_BIGINTEGER_VALUE => array(),
1165
+ MATH_BIGINTEGER_SIGN => false
1166
+ );
1167
+ }
1168
+
1169
+ return array(
1170
+ MATH_BIGINTEGER_VALUE => min($x_length, $y_length) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ?
1171
+ $this->_trim($this->_regularMultiply($x_value, $y_value)) :
1172
+ $this->_trim($this->_karatsuba($x_value, $y_value)),
1173
+ MATH_BIGINTEGER_SIGN => $x_negative != $y_negative
1174
+ );
1175
+ }
1176
+
1177
+ /**
1178
+ * Performs long multiplication on two BigIntegers
1179
+ *
1180
+ * Modeled after 'multiply' in MutableBigInteger.java.
1181
+ *
1182
+ * @param Array $x_value
1183
+ * @param Array $y_value
1184
+ * @return Array
1185
+ * @access private
1186
+ */
1187
+ function _regularMultiply($x_value, $y_value)
1188
+ {
1189
+ $x_length = count($x_value);
1190
+ $y_length = count($y_value);
1191
+
1192
+ if ( !$x_length || !$y_length ) { // a 0 is being multiplied
1193
+ return array();
1194
+ }
1195
+
1196
+ if ( $x_length < $y_length ) {
1197
+ $temp = $x_value;
1198
+ $x_value = $y_value;
1199
+ $y_value = $temp;
1200
+
1201
+ $x_length = count($x_value);
1202
+ $y_length = count($y_value);
1203
+ }
1204
+
1205
+ $product_value = $this->_array_repeat(0, $x_length + $y_length);
1206
+
1207
+ // the following for loop could be removed if the for loop following it
1208
+ // (the one with nested for loops) initially set $i to 0, but
1209
+ // doing so would also make the result in one set of unnecessary adds,
1210
+ // since on the outermost loops first pass, $product->value[$k] is going
1211
+ // to always be 0
1212
+
1213
+ $carry = 0;
1214
+
1215
+ for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0
1216
+ $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0
1217
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
1218
+ $product_value[$j] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry);
1219
+ }
1220
+
1221
+ $product_value[$j] = $carry;
1222
+
1223
+ // the above for loop is what the previous comment was talking about. the
1224
+ // following for loop is the "one with nested for loops"
1225
+ for ($i = 1; $i < $y_length; ++$i) {
1226
+ $carry = 0;
1227
+
1228
+ for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) {
1229
+ $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry;
1230
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
1231
+ $product_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry);
1232
+ }
1233
+
1234
+ $product_value[$k] = $carry;
1235
+ }
1236
+
1237
+ return $product_value;
1238
+ }
1239
+
1240
+ /**
1241
+ * Performs Karatsuba multiplication on two BigIntegers
1242
+ *
1243
+ * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and
1244
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=120 MPM 5.2.3}.
1245
+ *
1246
+ * @param Array $x_value
1247
+ * @param Array $y_value
1248
+ * @return Array
1249
+ * @access private
1250
+ */
1251
+ function _karatsuba($x_value, $y_value)
1252
+ {
1253
+ $m = min(count($x_value) >> 1, count($y_value) >> 1);
1254
+
1255
+ if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) {
1256
+ return $this->_regularMultiply($x_value, $y_value);
1257
+ }
1258
+
1259
+ $x1 = array_slice($x_value, $m);
1260
+ $x0 = array_slice($x_value, 0, $m);
1261
+ $y1 = array_slice($y_value, $m);
1262
+ $y0 = array_slice($y_value, 0, $m);
1263
+
1264
+ $z2 = $this->_karatsuba($x1, $y1);
1265
+ $z0 = $this->_karatsuba($x0, $y0);
1266
+
1267
+ $z1 = $this->_add($x1, false, $x0, false);
1268
+ $temp = $this->_add($y1, false, $y0, false);
1269
+ $z1 = $this->_karatsuba($z1[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_VALUE]);
1270
+ $temp = $this->_add($z2, false, $z0, false);
1271
+ $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false);
1272
+
1273
+ $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2);
1274
+ $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]);
1275
+
1276
+ $xy = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]);
1277
+ $xy = $this->_add($xy[MATH_BIGINTEGER_VALUE], $xy[MATH_BIGINTEGER_SIGN], $z0, false);
1278
+
1279
+ return $xy[MATH_BIGINTEGER_VALUE];
1280
+ }
1281
+
1282
+ /**
1283
+ * Performs squaring
1284
+ *
1285
+ * @param Array $x
1286
+ * @return Array
1287
+ * @access private
1288
+ */
1289
+ function _square($x = false)
1290
+ {
1291
+ return count($x) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ?
1292
+ $this->_trim($this->_baseSquare($x)) :
1293
+ $this->_trim($this->_karatsubaSquare($x));
1294
+ }
1295
+
1296
+ /**
1297
+ * Performs traditional squaring on two BigIntegers
1298
+ *
1299
+ * Squaring can be done faster than multiplying a number by itself can be. See
1300
+ * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=7 HAC 14.2.4} /
1301
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=141 MPM 5.3} for more information.
1302
+ *
1303
+ * @param Array $value
1304
+ * @return Array
1305
+ * @access private
1306
+ */
1307
+ function _baseSquare($value)
1308
+ {
1309
+ if ( empty($value) ) {
1310
+ return array();
1311
+ }
1312
+ $square_value = $this->_array_repeat(0, 2 * count($value));
1313
+
1314
+ for ($i = 0, $max_index = count($value) - 1; $i <= $max_index; ++$i) {
1315
+ $i2 = $i << 1;
1316
+
1317
+ $temp = $square_value[$i2] + $value[$i] * $value[$i];
1318
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
1319
+ $square_value[$i2] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry);
1320
+
1321
+ // note how we start from $i+1 instead of 0 as we do in multiplication.
1322
+ for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) {
1323
+ $temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry;
1324
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
1325
+ $square_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry);
1326
+ }
1327
+
1328
+ // the following line can yield values larger 2**15. at this point, PHP should switch
1329
+ // over to floats.
1330
+ $square_value[$i + $max_index + 1] = $carry;
1331
+ }
1332
+
1333
+ return $square_value;
1334
+ }
1335
+
1336
+ /**
1337
+ * Performs Karatsuba "squaring" on two BigIntegers
1338
+ *
1339
+ * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and
1340
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=151 MPM 5.3.4}.
1341
+ *
1342
+ * @param Array $value
1343
+ * @return Array
1344
+ * @access private
1345
+ */
1346
+ function _karatsubaSquare($value)
1347
+ {
1348
+ $m = count($value) >> 1;
1349
+
1350
+ if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) {
1351
+ return $this->_baseSquare($value);
1352
+ }
1353
+
1354
+ $x1 = array_slice($value, $m);
1355
+ $x0 = array_slice($value, 0, $m);
1356
+
1357
+ $z2 = $this->_karatsubaSquare($x1);
1358
+ $z0 = $this->_karatsubaSquare($x0);
1359
+
1360
+ $z1 = $this->_add($x1, false, $x0, false);
1361
+ $z1 = $this->_karatsubaSquare($z1[MATH_BIGINTEGER_VALUE]);
1362
+ $temp = $this->_add($z2, false, $z0, false);
1363
+ $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false);
1364
+
1365
+ $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2);
1366
+ $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]);
1367
+
1368
+ $xx = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]);
1369
+ $xx = $this->_add($xx[MATH_BIGINTEGER_VALUE], $xx[MATH_BIGINTEGER_SIGN], $z0, false);
1370
+
1371
+ return $xx[MATH_BIGINTEGER_VALUE];
1372
+ }
1373
+
1374
+ /**
1375
+ * Divides two BigIntegers.
1376
+ *
1377
+ * Returns an array whose first element contains the quotient and whose second element contains the
1378
+ * "common residue". If the remainder would be positive, the "common residue" and the remainder are the
1379
+ * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder
1380
+ * and the divisor (basically, the "common residue" is the first positive modulo).
1381
+ *
1382
+ * Here's an example:
1383
+ * <code>
1384
+ * <?php
1385
+ * include 'Math/BigInteger.php';
1386
+ *
1387
+ * $a = new Math_BigInteger('10');
1388
+ * $b = new Math_BigInteger('20');
1389
+ *
1390
+ * list($quotient, $remainder) = $a->divide($b);
1391
+ *
1392
+ * echo $quotient->toString(); // outputs 0
1393
+ * echo "\r\n";
1394
+ * echo $remainder->toString(); // outputs 10
1395
+ * ?>
1396
+ * </code>
1397
+ *
1398
+ * @param Math_BigInteger $y
1399
+ * @return Array
1400
+ * @access public
1401
+ * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}.
1402
+ */
1403
+ function divide($y)
1404
+ {
1405
+ switch ( MATH_BIGINTEGER_MODE ) {
1406
+ case MATH_BIGINTEGER_MODE_GMP:
1407
+ $quotient = new Math_BigInteger();
1408
+ $remainder = new Math_BigInteger();
1409
+
1410
+ list($quotient->value, $remainder->value) = gmp_div_qr($this->value, $y->value);
1411
+
1412
+ if (gmp_sign($remainder->value) < 0) {
1413
+ $remainder->value = gmp_add($remainder->value, gmp_abs($y->value));
1414
+ }
1415
+
1416
+ return array($this->_normalize($quotient), $this->_normalize($remainder));
1417
+ case MATH_BIGINTEGER_MODE_BCMATH:
1418
+ $quotient = new Math_BigInteger();
1419
+ $remainder = new Math_BigInteger();
1420
+
1421
+ $quotient->value = bcdiv($this->value, $y->value, 0);
1422
+ $remainder->value = bcmod($this->value, $y->value);
1423
+
1424
+ if ($remainder->value[0] == '-') {
1425
+ $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0);
1426
+ }
1427
+
1428
+ return array($this->_normalize($quotient), $this->_normalize($remainder));
1429
+ }
1430
+
1431
+ if (count($y->value) == 1) {
1432
+ list($q, $r) = $this->_divide_digit($this->value, $y->value[0]);
1433
+ $quotient = new Math_BigInteger();
1434
+ $remainder = new Math_BigInteger();
1435
+ $quotient->value = $q;
1436
+ $remainder->value = array($r);
1437
+ $quotient->is_negative = $this->is_negative != $y->is_negative;
1438
+ return array($this->_normalize($quotient), $this->_normalize($remainder));
1439
+ }
1440
+
1441
+ static $zero;
1442
+ if ( !isset($zero) ) {
1443
+ $zero = new Math_BigInteger();
1444
+ }
1445
+
1446
+ $x = $this->copy();
1447
+ $y = $y->copy();
1448
+
1449
+ $x_sign = $x->is_negative;
1450
+ $y_sign = $y->is_negative;
1451
+
1452
+ $x->is_negative = $y->is_negative = false;
1453
+
1454
+ $diff = $x->compare($y);
1455
+
1456
+ if ( !$diff ) {
1457
+ $temp = new Math_BigInteger();
1458
+ $temp->value = array(1);
1459
+ $temp->is_negative = $x_sign != $y_sign;
1460
+ return array($this->_normalize($temp), $this->_normalize(new Math_BigInteger()));
1461
+ }
1462
+
1463
+ if ( $diff < 0 ) {
1464
+ // if $x is negative, "add" $y.
1465
+ if ( $x_sign ) {
1466
+ $x = $y->subtract($x);
1467
+ }
1468
+ return array($this->_normalize(new Math_BigInteger()), $this->_normalize($x));
1469
+ }
1470
+
1471
+ // normalize $x and $y as described in HAC 14.23 / 14.24
1472
+ $msb = $y->value[count($y->value) - 1];
1473
+ for ($shift = 0; !($msb & MATH_BIGINTEGER_MSB); ++$shift) {
1474
+ $msb <<= 1;
1475
+ }
1476
+ $x->_lshift($shift);
1477
+ $y->_lshift($shift);
1478
+ $y_value = &$y->value;
1479
+
1480
+ $x_max = count($x->value) - 1;
1481
+ $y_max = count($y->value) - 1;
1482
+
1483
+ $quotient = new Math_BigInteger();
1484
+ $quotient_value = &$quotient->value;
1485
+ $quotient_value = $this->_array_repeat(0, $x_max - $y_max + 1);
1486
+
1487
+ static $temp, $lhs, $rhs;
1488
+ if (!isset($temp)) {
1489
+ $temp = new Math_BigInteger();
1490
+ $lhs = new Math_BigInteger();
1491
+ $rhs = new Math_BigInteger();
1492
+ }
1493
+ $temp_value = &$temp->value;
1494
+ $rhs_value = &$rhs->value;
1495
+
1496
+ // $temp = $y << ($x_max - $y_max-1) in base 2**26
1497
+ $temp_value = array_merge($this->_array_repeat(0, $x_max - $y_max), $y_value);
1498
+
1499
+ while ( $x->compare($temp) >= 0 ) {
1500
+ // calculate the "common residue"
1501
+ ++$quotient_value[$x_max - $y_max];
1502
+ $x = $x->subtract($temp);
1503
+ $x_max = count($x->value) - 1;
1504
+ }
1505
+
1506
+ for ($i = $x_max; $i >= $y_max + 1; --$i) {
1507
+ $x_value = &$x->value;
1508
+ $x_window = array(
1509
+ isset($x_value[$i]) ? $x_value[$i] : 0,
1510
+ isset($x_value[$i - 1]) ? $x_value[$i - 1] : 0,
1511
+ isset($x_value[$i - 2]) ? $x_value[$i - 2] : 0
1512
+ );
1513
+ $y_window = array(
1514
+ $y_value[$y_max],
1515
+ ( $y_max > 0 ) ? $y_value[$y_max - 1] : 0
1516
+ );
1517
+
1518
+ $q_index = $i - $y_max - 1;
1519
+ if ($x_window[0] == $y_window[0]) {
1520
+ $quotient_value[$q_index] = MATH_BIGINTEGER_MAX_DIGIT;
1521
+ } else {
1522
+ $quotient_value[$q_index] = $this->_safe_divide(
1523
+ $x_window[0] * MATH_BIGINTEGER_BASE_FULL + $x_window[1],
1524
+ $y_window[0]
1525
+ );
1526
+ }
1527
+
1528
+ $temp_value = array($y_window[1], $y_window[0]);
1529
+
1530
+ $lhs->value = array($quotient_value[$q_index]);
1531
+ $lhs = $lhs->multiply($temp);
1532
+
1533
+ $rhs_value = array($x_window[2], $x_window[1], $x_window[0]);
1534
+
1535
+ while ( $lhs->compare($rhs) > 0 ) {
1536
+ --$quotient_value[$q_index];
1537
+
1538
+ $lhs->value = array($quotient_value[$q_index]);
1539
+ $lhs = $lhs->multiply($temp);
1540
+ }
1541
+
1542
+ $adjust = $this->_array_repeat(0, $q_index);
1543
+ $temp_value = array($quotient_value[$q_index]);
1544
+ $temp = $temp->multiply($y);
1545
+ $temp_value = &$temp->value;
1546
+ $temp_value = array_merge($adjust, $temp_value);
1547
+
1548
+ $x = $x->subtract($temp);
1549
+
1550
+ if ($x->compare($zero) < 0) {
1551
+ $temp_value = array_merge($adjust, $y_value);
1552
+ $x = $x->add($temp);
1553
+
1554
+ --$quotient_value[$q_index];
1555
+ }
1556
+
1557
+ $x_max = count($x_value) - 1;
1558
+ }
1559
+
1560
+ // unnormalize the remainder
1561
+ $x->_rshift($shift);
1562
+
1563
+ $quotient->is_negative = $x_sign != $y_sign;
1564
+
1565
+ // calculate the "common residue", if appropriate
1566
+ if ( $x_sign ) {
1567
+ $y->_rshift($shift);
1568
+ $x = $y->subtract($x);
1569
+ }
1570
+
1571
+ return array($this->_normalize($quotient), $this->_normalize($x));
1572
+ }
1573
+
1574
+ /**
1575
+ * Divides a BigInteger by a regular integer
1576
+ *
1577
+ * abc / x = a00 / x + b0 / x + c / x
1578
+ *
1579
+ * @param Array $dividend
1580
+ * @param Array $divisor
1581
+ * @return Array
1582
+ * @access private
1583
+ */
1584
+ function _divide_digit($dividend, $divisor)
1585
+ {
1586
+ $carry = 0;
1587
+ $result = array();
1588
+
1589
+ for ($i = count($dividend) - 1; $i >= 0; --$i) {
1590
+ $temp = MATH_BIGINTEGER_BASE_FULL * $carry + $dividend[$i];
1591
+ $result[$i] = $this->_safe_divide($temp, $divisor);
1592
+ $carry = (int) ($temp - $divisor * $result[$i]);
1593
+ }
1594
+
1595
+ return array($result, $carry);
1596
+ }
1597
+
1598
+ /**
1599
+ * Performs modular exponentiation.
1600
+ *
1601
+ * Here's an example:
1602
+ * <code>
1603
+ * <?php
1604
+ * include 'Math/BigInteger.php';
1605
+ *
1606
+ * $a = new Math_BigInteger('10');
1607
+ * $b = new Math_BigInteger('20');
1608
+ * $c = new Math_BigInteger('30');
1609
+ *
1610
+ * $c = $a->modPow($b, $c);
1611
+ *
1612
+ * echo $c->toString(); // outputs 10
1613
+ * ?>
1614
+ * </code>
1615
+ *
1616
+ * @param Math_BigInteger $e
1617
+ * @param Math_BigInteger $n
1618
+ * @return Math_BigInteger
1619
+ * @access public
1620
+ * @internal The most naive approach to modular exponentiation has very unreasonable requirements, and
1621
+ * and although the approach involving repeated squaring does vastly better, it, too, is impractical
1622
+ * for our purposes. The reason being that division - by far the most complicated and time-consuming
1623
+ * of the basic operations (eg. +,-,*,/) - occurs multiple times within it.
1624
+ *
1625
+ * Modular reductions resolve this issue. Although an individual modular reduction takes more time
1626
+ * then an individual division, when performed in succession (with the same modulo), they're a lot faster.
1627
+ *
1628
+ * The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction,
1629
+ * although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the
1630
+ * base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because
1631
+ * the product of two odd numbers is odd), but what about when RSA isn't used?
1632
+ *
1633
+ * In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a
1634
+ * Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the
1635
+ * modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however,
1636
+ * uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and
1637
+ * the other, a power of two - and recombine them, later. This is the method that this modPow function uses.
1638
+ * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates.
1639
+ */
1640
+ function modPow($e, $n)
1641
+ {
1642
+ $n = $this->bitmask !== false && $this->bitmask->compare($n) < 0 ? $this->bitmask : $n->abs();
1643
+
1644
+ if ($e->compare(new Math_BigInteger()) < 0) {
1645
+ $e = $e->abs();
1646
+
1647
+ $temp = $this->modInverse($n);
1648
+ if ($temp === false) {
1649
+ return false;
1650
+ }
1651
+
1652
+ return $this->_normalize($temp->modPow($e, $n));
1653
+ }
1654
+
1655
+ if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP ) {
1656
+ $temp = new Math_BigInteger();
1657
+ $temp->value = gmp_powm($this->value, $e->value, $n->value);
1658
+
1659
+ return $this->_normalize($temp);
1660
+ }
1661
+
1662
+ if ($this->compare(new Math_BigInteger()) < 0 || $this->compare($n) > 0) {
1663
+ list(, $temp) = $this->divide($n);
1664
+ return $temp->modPow($e, $n);
1665
+ }
1666
+
1667
+ if (defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) {
1668
+ $components = array(
1669
+ 'modulus' => $n->toBytes(true),
1670
+ 'publicExponent' => $e->toBytes(true)
1671
+ );
1672
+
1673
+ $components = array(
1674
+ 'modulus' => pack('Ca*a*', 2, $this->_encodeASN1Length(strlen($components['modulus'])), $components['modulus']),
1675
+ 'publicExponent' => pack('Ca*a*', 2, $this->_encodeASN1Length(strlen($components['publicExponent'])), $components['publicExponent'])
1676
+ );
1677
+
1678
+ $RSAPublicKey = pack('Ca*a*a*',
1679
+ 48, $this->_encodeASN1Length(strlen($components['modulus']) + strlen($components['publicExponent'])),
1680
+ $components['modulus'], $components['publicExponent']
1681
+ );
1682
+
1683
+ $rsaOID = pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA
1684
+ $RSAPublicKey = chr(0) . $RSAPublicKey;
1685
+ $RSAPublicKey = chr(3) . $this->_encodeASN1Length(strlen($RSAPublicKey)) . $RSAPublicKey;
1686
+
1687
+ $encapsulated = pack('Ca*a*',
1688
+ 48, $this->_encodeASN1Length(strlen($rsaOID . $RSAPublicKey)), $rsaOID . $RSAPublicKey
1689
+ );
1690
+
1691
+ $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" .
1692
+ chunk_split(base64_encode($encapsulated)) .
1693
+ '-----END PUBLIC KEY-----';
1694
+
1695
+ $plaintext = str_pad($this->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT);
1696
+
1697
+ if (openssl_public_encrypt($plaintext, $result, $RSAPublicKey, OPENSSL_NO_PADDING)) {
1698
+ return new Math_BigInteger($result, 256);
1699
+ }
1700
+ }
1701
+
1702
+ if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) {
1703
+ $temp = new Math_BigInteger();
1704
+ $temp->value = bcpowmod($this->value, $e->value, $n->value, 0);
1705
+
1706
+ return $this->_normalize($temp);
1707
+ }
1708
+
1709
+ if ( empty($e->value) ) {
1710
+ $temp = new Math_BigInteger();
1711
+ $temp->value = array(1);
1712
+ return $this->_normalize($temp);
1713
+ }
1714
+
1715
+ if ( $e->value == array(1) ) {
1716
+ list(, $temp) = $this->divide($n);
1717
+ return $this->_normalize($temp);
1718
+ }
1719
+
1720
+ if ( $e->value == array(2) ) {
1721
+ $temp = new Math_BigInteger();
1722
+ $temp->value = $this->_square($this->value);
1723
+ list(, $temp) = $temp->divide($n);
1724
+ return $this->_normalize($temp);
1725
+ }
1726
+
1727
+ return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_BARRETT));
1728
+
1729
+ // the following code, although not callable, can be run independently of the above code
1730
+ // although the above code performed better in my benchmarks the following could might
1731
+ // perform better under different circumstances. in lieu of deleting it it's just been
1732
+ // made uncallable
1733
+
1734
+ // is the modulo odd?
1735
+ if ( $n->value[0] & 1 ) {
1736
+ return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_MONTGOMERY));
1737
+ }
1738
+ // if it's not, it's even
1739
+
1740
+ // find the lowest set bit (eg. the max pow of 2 that divides $n)
1741
+ for ($i = 0; $i < count($n->value); ++$i) {
1742
+ if ( $n->value[$i] ) {
1743
+ $temp = decbin($n->value[$i]);
1744
+ $j = strlen($temp) - strrpos($temp, '1') - 1;
1745
+ $j+= 26 * $i;
1746
+ break;
1747
+ }
1748
+ }
1749
+ // at this point, 2^$j * $n/(2^$j) == $n
1750
+
1751
+ $mod1 = $n->copy();
1752
+ $mod1->_rshift($j);
1753
+ $mod2 = new Math_BigInteger();
1754
+ $mod2->value = array(1);
1755
+ $mod2->_lshift($j);
1756
+
1757
+ $part1 = ( $mod1->value != array(1) ) ? $this->_slidingWindow($e, $mod1, MATH_BIGINTEGER_MONTGOMERY) : new Math_BigInteger();
1758
+ $part2 = $this->_slidingWindow($e, $mod2, MATH_BIGINTEGER_POWEROF2);
1759
+
1760
+ $y1 = $mod2->modInverse($mod1);
1761
+ $y2 = $mod1->modInverse($mod2);
1762
+
1763
+ $result = $part1->multiply($mod2);
1764
+ $result = $result->multiply($y1);
1765
+
1766
+ $temp = $part2->multiply($mod1);
1767
+ $temp = $temp->multiply($y2);
1768
+
1769
+ $result = $result->add($temp);
1770
+ list(, $result) = $result->divide($n);
1771
+
1772
+ return $this->_normalize($result);
1773
+ }
1774
+
1775
+ /**
1776
+ * Performs modular exponentiation.
1777
+ *
1778
+ * Alias for Math_BigInteger::modPow()
1779
+ *
1780
+ * @param Math_BigInteger $e
1781
+ * @param Math_BigInteger $n
1782
+ * @return Math_BigInteger
1783
+ * @access public
1784
+ */
1785
+ function powMod($e, $n)
1786
+ {
1787
+ return $this->modPow($e, $n);
1788
+ }
1789
+
1790
+ /**
1791
+ * Sliding Window k-ary Modular Exponentiation
1792
+ *
1793
+ * Based on {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=27 HAC 14.85} /
1794
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=210 MPM 7.7}. In a departure from those algorithims,
1795
+ * however, this function performs a modular reduction after every multiplication and squaring operation.
1796
+ * As such, this function has the same preconditions that the reductions being used do.
1797
+ *
1798
+ * @param Math_BigInteger $e
1799
+ * @param Math_BigInteger $n
1800
+ * @param Integer $mode
1801
+ * @return Math_BigInteger
1802
+ * @access private
1803
+ */
1804
+ function _slidingWindow($e, $n, $mode)
1805
+ {
1806
+ static $window_ranges = array(7, 25, 81, 241, 673, 1793); // from BigInteger.java's oddModPow function
1807
+ //static $window_ranges = array(0, 7, 36, 140, 450, 1303, 3529); // from MPM 7.3.1
1808
+
1809
+ $e_value = $e->value;
1810
+ $e_length = count($e_value) - 1;
1811
+ $e_bits = decbin($e_value[$e_length]);
1812
+ for ($i = $e_length - 1; $i >= 0; --$i) {
1813
+ $e_bits.= str_pad(decbin($e_value[$i]), MATH_BIGINTEGER_BASE, '0', STR_PAD_LEFT);
1814
+ }
1815
+
1816
+ $e_length = strlen($e_bits);
1817
+
1818
+ // calculate the appropriate window size.
1819
+ // $window_size == 3 if $window_ranges is between 25 and 81, for example.
1820
+ for ($i = 0, $window_size = 1; $e_length > $window_ranges[$i] && $i < count($window_ranges); ++$window_size, ++$i);
1821
+
1822
+ $n_value = $n->value;
1823
+
1824
+ // precompute $this^0 through $this^$window_size
1825
+ $powers = array();
1826
+ $powers[1] = $this->_prepareReduce($this->value, $n_value, $mode);
1827
+ $powers[2] = $this->_squareReduce($powers[1], $n_value, $mode);
1828
+
1829
+ // we do every other number since substr($e_bits, $i, $j+1) (see below) is supposed to end
1830
+ // in a 1. ie. it's supposed to be odd.
1831
+ $temp = 1 << ($window_size - 1);
1832
+ for ($i = 1; $i < $temp; ++$i) {
1833
+ $i2 = $i << 1;
1834
+ $powers[$i2 + 1] = $this->_multiplyReduce($powers[$i2 - 1], $powers[2], $n_value, $mode);
1835
+ }
1836
+
1837
+ $result = array(1);
1838
+ $result = $this->_prepareReduce($result, $n_value, $mode);
1839
+
1840
+ for ($i = 0; $i < $e_length; ) {
1841
+ if ( !$e_bits[$i] ) {
1842
+ $result = $this->_squareReduce($result, $n_value, $mode);
1843
+ ++$i;
1844
+ } else {
1845
+ for ($j = $window_size - 1; $j > 0; --$j) {
1846
+ if ( !empty($e_bits[$i + $j]) ) {
1847
+ break;
1848
+ }
1849
+ }
1850
+
1851
+ for ($k = 0; $k <= $j; ++$k) {// eg. the length of substr($e_bits, $i, $j+1)
1852
+ $result = $this->_squareReduce($result, $n_value, $mode);
1853
+ }
1854
+
1855
+ $result = $this->_multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $mode);
1856
+
1857
+ $i+=$j + 1;
1858
+ }
1859
+ }
1860
+
1861
+ $temp = new Math_BigInteger();
1862
+ $temp->value = $this->_reduce($result, $n_value, $mode);
1863
+
1864
+ return $temp;
1865
+ }
1866
+
1867
+ /**
1868
+ * Modular reduction
1869
+ *
1870
+ * For most $modes this will return the remainder.
1871
+ *
1872
+ * @see _slidingWindow()
1873
+ * @access private
1874
+ * @param Array $x
1875
+ * @param Array $n
1876
+ * @param Integer $mode
1877
+ * @return Array
1878
+ */
1879
+ function _reduce($x, $n, $mode)
1880
+ {
1881
+ switch ($mode) {
1882
+ case MATH_BIGINTEGER_MONTGOMERY:
1883
+ return $this->_montgomery($x, $n);
1884
+ case MATH_BIGINTEGER_BARRETT:
1885
+ return $this->_barrett($x, $n);
1886
+ case MATH_BIGINTEGER_POWEROF2:
1887
+ $lhs = new Math_BigInteger();
1888
+ $lhs->value = $x;
1889
+ $rhs = new Math_BigInteger();
1890
+ $rhs->value = $n;
1891
+ return $x->_mod2($n);
1892
+ case MATH_BIGINTEGER_CLASSIC:
1893
+ $lhs = new Math_BigInteger();
1894
+ $lhs->value = $x;
1895
+ $rhs = new Math_BigInteger();
1896
+ $rhs->value = $n;
1897
+ list(, $temp) = $lhs->divide($rhs);
1898
+ return $temp->value;
1899
+ case MATH_BIGINTEGER_NONE:
1900
+ return $x;
1901
+ default:
1902
+ // an invalid $mode was provided
1903
+ }
1904
+ }
1905
+
1906
+ /**
1907
+ * Modular reduction preperation
1908
+ *
1909
+ * @see _slidingWindow()
1910
+ * @access private
1911
+ * @param Array $x
1912
+ * @param Array $n
1913
+ * @param Integer $mode
1914
+ * @return Array
1915
+ */
1916
+ function _prepareReduce($x, $n, $mode)
1917
+ {
1918
+ if ($mode == MATH_BIGINTEGER_MONTGOMERY) {
1919
+ return $this->_prepMontgomery($x, $n);
1920
+ }
1921
+ return $this->_reduce($x, $n, $mode);
1922
+ }
1923
+
1924
+ /**
1925
+ * Modular multiply
1926
+ *
1927
+ * @see _slidingWindow()
1928
+ * @access private
1929
+ * @param Array $x
1930
+ * @param Array $y
1931
+ * @param Array $n
1932
+ * @param Integer $mode
1933
+ * @return Array
1934
+ */
1935
+ function _multiplyReduce($x, $y, $n, $mode)
1936
+ {
1937
+ if ($mode == MATH_BIGINTEGER_MONTGOMERY) {
1938
+ return $this->_montgomeryMultiply($x, $y, $n);
1939
+ }
1940
+ $temp = $this->_multiply($x, false, $y, false);
1941
+ return $this->_reduce($temp[MATH_BIGINTEGER_VALUE], $n, $mode);
1942
+ }
1943
+
1944
+ /**
1945
+ * Modular square
1946
+ *
1947
+ * @see _slidingWindow()
1948
+ * @access private
1949
+ * @param Array $x
1950
+ * @param Array $n
1951
+ * @param Integer $mode
1952
+ * @return Array
1953
+ */
1954
+ function _squareReduce($x, $n, $mode)
1955
+ {
1956
+ if ($mode == MATH_BIGINTEGER_MONTGOMERY) {
1957
+ return $this->_montgomeryMultiply($x, $x, $n);
1958
+ }
1959
+ return $this->_reduce($this->_square($x), $n, $mode);
1960
+ }
1961
+
1962
+ /**
1963
+ * Modulos for Powers of Two
1964
+ *
1965
+ * Calculates $x%$n, where $n = 2**$e, for some $e. Since this is basically the same as doing $x & ($n-1),
1966
+ * we'll just use this function as a wrapper for doing that.
1967
+ *
1968
+ * @see _slidingWindow()
1969
+ * @access private
1970
+ * @param Math_BigInteger
1971
+ * @return Math_BigInteger
1972
+ */
1973
+ function _mod2($n)
1974
+ {
1975
+ $temp = new Math_BigInteger();
1976
+ $temp->value = array(1);
1977
+ return $this->bitwise_and($n->subtract($temp));
1978
+ }
1979
+
1980
+ /**
1981
+ * Barrett Modular Reduction
1982
+ *
1983
+ * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} /
1984
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly,
1985
+ * so as not to require negative numbers (initially, this script didn't support negative numbers).
1986
+ *
1987
+ * Employs "folding", as described at
1988
+ * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from
1989
+ * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x."
1990
+ *
1991
+ * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that
1992
+ * usable on account of (1) its not using reasonable radix points as discussed in
1993
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable
1994
+ * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that
1995
+ * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line
1996
+ * comments for details.
1997
+ *
1998
+ * @see _slidingWindow()
1999
+ * @access private
2000
+ * @param Array $n
2001
+ * @param Array $m
2002
+ * @return Array
2003
+ */
2004
+ function _barrett($n, $m)
2005
+ {
2006
+ static $cache = array(
2007
+ MATH_BIGINTEGER_VARIABLE => array(),
2008
+ MATH_BIGINTEGER_DATA => array()
2009
+ );
2010
+
2011
+ $m_length = count($m);
2012
+
2013
+ // if ($this->_compare($n, $this->_square($m)) >= 0) {
2014
+ if (count($n) > 2 * $m_length) {
2015
+ $lhs = new Math_BigInteger();
2016
+ $rhs = new Math_BigInteger();
2017
+ $lhs->value = $n;
2018
+ $rhs->value = $m;
2019
+ list(, $temp) = $lhs->divide($rhs);
2020
+ return $temp->value;
2021
+ }
2022
+
2023
+ // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced
2024
+ if ($m_length < 5) {
2025
+ return $this->_regularBarrett($n, $m);
2026
+ }
2027
+
2028
+ // n = 2 * m.length
2029
+
2030
+ if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2031
+ $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2032
+ $cache[MATH_BIGINTEGER_VARIABLE][] = $m;
2033
+
2034
+ $lhs = new Math_BigInteger();
2035
+ $lhs_value = &$lhs->value;
2036
+ $lhs_value = $this->_array_repeat(0, $m_length + ($m_length >> 1));
2037
+ $lhs_value[] = 1;
2038
+ $rhs = new Math_BigInteger();
2039
+ $rhs->value = $m;
2040
+
2041
+ list($u, $m1) = $lhs->divide($rhs);
2042
+ $u = $u->value;
2043
+ $m1 = $m1->value;
2044
+
2045
+ $cache[MATH_BIGINTEGER_DATA][] = array(
2046
+ 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1)
2047
+ 'm1'=> $m1 // m.length
2048
+ );
2049
+ } else {
2050
+ extract($cache[MATH_BIGINTEGER_DATA][$key]);
2051
+ }
2052
+
2053
+ $cutoff = $m_length + ($m_length >> 1);
2054
+ $lsd = array_slice($n, 0, $cutoff); // m.length + (m.length >> 1)
2055
+ $msd = array_slice($n, $cutoff); // m.length >> 1
2056
+ $lsd = $this->_trim($lsd);
2057
+ $temp = $this->_multiply($msd, false, $m1, false);
2058
+ $n = $this->_add($lsd, false, $temp[MATH_BIGINTEGER_VALUE], false); // m.length + (m.length >> 1) + 1
2059
+
2060
+ if ($m_length & 1) {
2061
+ return $this->_regularBarrett($n[MATH_BIGINTEGER_VALUE], $m);
2062
+ }
2063
+
2064
+ // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2
2065
+ $temp = array_slice($n[MATH_BIGINTEGER_VALUE], $m_length - 1);
2066
+ // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2
2067
+ // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1
2068
+ $temp = $this->_multiply($temp, false, $u, false);
2069
+ // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1
2070
+ // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1)
2071
+ $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], ($m_length >> 1) + 1);
2072
+ // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1
2073
+ // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1)
2074
+ $temp = $this->_multiply($temp, false, $m, false);
2075
+
2076
+ // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit
2077
+ // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop
2078
+ // following this comment would loop a lot (hence our calling _regularBarrett() in that situation).
2079
+
2080
+ $result = $this->_subtract($n[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false);
2081
+
2082
+ while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false) >= 0) {
2083
+ $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false);
2084
+ }
2085
+
2086
+ return $result[MATH_BIGINTEGER_VALUE];
2087
+ }
2088
+
2089
+ /**
2090
+ * (Regular) Barrett Modular Reduction
2091
+ *
2092
+ * For numbers with more than four digits Math_BigInteger::_barrett() is faster. The difference between that and this
2093
+ * is that this function does not fold the denominator into a smaller form.
2094
+ *
2095
+ * @see _slidingWindow()
2096
+ * @access private
2097
+ * @param Array $x
2098
+ * @param Array $n
2099
+ * @return Array
2100
+ */
2101
+ function _regularBarrett($x, $n)
2102
+ {
2103
+ static $cache = array(
2104
+ MATH_BIGINTEGER_VARIABLE => array(),
2105
+ MATH_BIGINTEGER_DATA => array()
2106
+ );
2107
+
2108
+ $n_length = count($n);
2109
+
2110
+ if (count($x) > 2 * $n_length) {
2111
+ $lhs = new Math_BigInteger();
2112
+ $rhs = new Math_BigInteger();
2113
+ $lhs->value = $x;
2114
+ $rhs->value = $n;
2115
+ list(, $temp) = $lhs->divide($rhs);
2116
+ return $temp->value;
2117
+ }
2118
+
2119
+ if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2120
+ $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2121
+ $cache[MATH_BIGINTEGER_VARIABLE][] = $n;
2122
+ $lhs = new Math_BigInteger();
2123
+ $lhs_value = &$lhs->value;
2124
+ $lhs_value = $this->_array_repeat(0, 2 * $n_length);
2125
+ $lhs_value[] = 1;
2126
+ $rhs = new Math_BigInteger();
2127
+ $rhs->value = $n;
2128
+ list($temp, ) = $lhs->divide($rhs); // m.length
2129
+ $cache[MATH_BIGINTEGER_DATA][] = $temp->value;
2130
+ }
2131
+
2132
+ // 2 * m.length - (m.length - 1) = m.length + 1
2133
+ $temp = array_slice($x, $n_length - 1);
2134
+ // (m.length + 1) + m.length = 2 * m.length + 1
2135
+ $temp = $this->_multiply($temp, false, $cache[MATH_BIGINTEGER_DATA][$key], false);
2136
+ // (2 * m.length + 1) - (m.length - 1) = m.length + 2
2137
+ $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], $n_length + 1);
2138
+
2139
+ // m.length + 1
2140
+ $result = array_slice($x, 0, $n_length + 1);
2141
+ // m.length + 1
2142
+ $temp = $this->_multiplyLower($temp, false, $n, false, $n_length + 1);
2143
+ // $temp == array_slice($temp->_multiply($temp, false, $n, false)->value, 0, $n_length + 1)
2144
+
2145
+ if ($this->_compare($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]) < 0) {
2146
+ $corrector_value = $this->_array_repeat(0, $n_length + 1);
2147
+ $corrector_value[count($corrector_value)] = 1;
2148
+ $result = $this->_add($result, false, $corrector_value, false);
2149
+ $result = $result[MATH_BIGINTEGER_VALUE];
2150
+ }
2151
+
2152
+ // at this point, we're subtracting a number with m.length + 1 digits from another number with m.length + 1 digits
2153
+ $result = $this->_subtract($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]);
2154
+ while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false) > 0) {
2155
+ $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false);
2156
+ }
2157
+
2158
+ return $result[MATH_BIGINTEGER_VALUE];
2159
+ }
2160
+
2161
+ /**
2162
+ * Performs long multiplication up to $stop digits
2163
+ *
2164
+ * If you're going to be doing array_slice($product->value, 0, $stop), some cycles can be saved.
2165
+ *
2166
+ * @see _regularBarrett()
2167
+ * @param Array $x_value
2168
+ * @param Boolean $x_negative
2169
+ * @param Array $y_value
2170
+ * @param Boolean $y_negative
2171
+ * @param Integer $stop
2172
+ * @return Array
2173
+ * @access private
2174
+ */
2175
+ function _multiplyLower($x_value, $x_negative, $y_value, $y_negative, $stop)
2176
+ {
2177
+ $x_length = count($x_value);
2178
+ $y_length = count($y_value);
2179
+
2180
+ if ( !$x_length || !$y_length ) { // a 0 is being multiplied
2181
+ return array(
2182
+ MATH_BIGINTEGER_VALUE => array(),
2183
+ MATH_BIGINTEGER_SIGN => false
2184
+ );
2185
+ }
2186
+
2187
+ if ( $x_length < $y_length ) {
2188
+ $temp = $x_value;
2189
+ $x_value = $y_value;
2190
+ $y_value = $temp;
2191
+
2192
+ $x_length = count($x_value);
2193
+ $y_length = count($y_value);
2194
+ }
2195
+
2196
+ $product_value = $this->_array_repeat(0, $x_length + $y_length);
2197
+
2198
+ // the following for loop could be removed if the for loop following it
2199
+ // (the one with nested for loops) initially set $i to 0, but
2200
+ // doing so would also make the result in one set of unnecessary adds,
2201
+ // since on the outermost loops first pass, $product->value[$k] is going
2202
+ // to always be 0
2203
+
2204
+ $carry = 0;
2205
+
2206
+ for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0, $k = $i
2207
+ $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0
2208
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
2209
+ $product_value[$j] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry);
2210
+ }
2211
+
2212
+ if ($j < $stop) {
2213
+ $product_value[$j] = $carry;
2214
+ }
2215
+
2216
+ // the above for loop is what the previous comment was talking about. the
2217
+ // following for loop is the "one with nested for loops"
2218
+
2219
+ for ($i = 1; $i < $y_length; ++$i) {
2220
+ $carry = 0;
2221
+
2222
+ for ($j = 0, $k = $i; $j < $x_length && $k < $stop; ++$j, ++$k) {
2223
+ $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry;
2224
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
2225
+ $product_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry);
2226
+ }
2227
+
2228
+ if ($k < $stop) {
2229
+ $product_value[$k] = $carry;
2230
+ }
2231
+ }
2232
+
2233
+ return array(
2234
+ MATH_BIGINTEGER_VALUE => $this->_trim($product_value),
2235
+ MATH_BIGINTEGER_SIGN => $x_negative != $y_negative
2236
+ );
2237
+ }
2238
+
2239
+ /**
2240
+ * Montgomery Modular Reduction
2241
+ *
2242
+ * ($x->_prepMontgomery($n))->_montgomery($n) yields $x % $n.
2243
+ * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=170 MPM 6.3} provides insights on how this can be
2244
+ * improved upon (basically, by using the comba method). gcd($n, 2) must be equal to one for this function
2245
+ * to work correctly.
2246
+ *
2247
+ * @see _prepMontgomery()
2248
+ * @see _slidingWindow()
2249
+ * @access private
2250
+ * @param Array $x
2251
+ * @param Array $n
2252
+ * @return Array
2253
+ */
2254
+ function _montgomery($x, $n)
2255
+ {
2256
+ static $cache = array(
2257
+ MATH_BIGINTEGER_VARIABLE => array(),
2258
+ MATH_BIGINTEGER_DATA => array()
2259
+ );
2260
+
2261
+ if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2262
+ $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2263
+ $cache[MATH_BIGINTEGER_VARIABLE][] = $x;
2264
+ $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($n);
2265
+ }
2266
+
2267
+ $k = count($n);
2268
+
2269
+ $result = array(MATH_BIGINTEGER_VALUE => $x);
2270
+
2271
+ for ($i = 0; $i < $k; ++$i) {
2272
+ $temp = $result[MATH_BIGINTEGER_VALUE][$i] * $cache[MATH_BIGINTEGER_DATA][$key];
2273
+ $temp = $temp - MATH_BIGINTEGER_BASE_FULL * (MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31));
2274
+ $temp = $this->_regularMultiply(array($temp), $n);
2275
+ $temp = array_merge($this->_array_repeat(0, $i), $temp);
2276
+ $result = $this->_add($result[MATH_BIGINTEGER_VALUE], false, $temp, false);
2277
+ }
2278
+
2279
+ $result[MATH_BIGINTEGER_VALUE] = array_slice($result[MATH_BIGINTEGER_VALUE], $k);
2280
+
2281
+ if ($this->_compare($result, false, $n, false) >= 0) {
2282
+ $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], false, $n, false);
2283
+ }
2284
+
2285
+ return $result[MATH_BIGINTEGER_VALUE];
2286
+ }
2287
+
2288
+ /**
2289
+ * Montgomery Multiply
2290
+ *
2291
+ * Interleaves the montgomery reduction and long multiplication algorithms together as described in
2292
+ * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36}
2293
+ *
2294
+ * @see _prepMontgomery()
2295
+ * @see _montgomery()
2296
+ * @access private
2297
+ * @param Array $x
2298
+ * @param Array $y
2299
+ * @param Array $m
2300
+ * @return Array
2301
+ */
2302
+ function _montgomeryMultiply($x, $y, $m)
2303
+ {
2304
+ $temp = $this->_multiply($x, false, $y, false);
2305
+ return $this->_montgomery($temp[MATH_BIGINTEGER_VALUE], $m);
2306
+
2307
+ // the following code, although not callable, can be run independently of the above code
2308
+ // although the above code performed better in my benchmarks the following could might
2309
+ // perform better under different circumstances. in lieu of deleting it it's just been
2310
+ // made uncallable
2311
+
2312
+ static $cache = array(
2313
+ MATH_BIGINTEGER_VARIABLE => array(),
2314
+ MATH_BIGINTEGER_DATA => array()
2315
+ );
2316
+
2317
+ if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) {
2318
+ $key = count($cache[MATH_BIGINTEGER_VARIABLE]);
2319
+ $cache[MATH_BIGINTEGER_VARIABLE][] = $m;
2320
+ $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($m);
2321
+ }
2322
+
2323
+ $n = max(count($x), count($y), count($m));
2324
+ $x = array_pad($x, $n, 0);
2325
+ $y = array_pad($y, $n, 0);
2326
+ $m = array_pad($m, $n, 0);
2327
+ $a = array(MATH_BIGINTEGER_VALUE => $this->_array_repeat(0, $n + 1));
2328
+ for ($i = 0; $i < $n; ++$i) {
2329
+ $temp = $a[MATH_BIGINTEGER_VALUE][0] + $x[$i] * $y[0];
2330
+ $temp = $temp - MATH_BIGINTEGER_BASE_FULL * (MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31));
2331
+ $temp = $temp * $cache[MATH_BIGINTEGER_DATA][$key];
2332
+ $temp = $temp - MATH_BIGINTEGER_BASE_FULL * (MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31));
2333
+ $temp = $this->_add($this->_regularMultiply(array($x[$i]), $y), false, $this->_regularMultiply(array($temp), $m), false);
2334
+ $a = $this->_add($a[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false);
2335
+ $a[MATH_BIGINTEGER_VALUE] = array_slice($a[MATH_BIGINTEGER_VALUE], 1);
2336
+ }
2337
+ if ($this->_compare($a[MATH_BIGINTEGER_VALUE], false, $m, false) >= 0) {
2338
+ $a = $this->_subtract($a[MATH_BIGINTEGER_VALUE], false, $m, false);
2339
+ }
2340
+ return $a[MATH_BIGINTEGER_VALUE];
2341
+ }
2342
+
2343
+ /**
2344
+ * Prepare a number for use in Montgomery Modular Reductions
2345
+ *
2346
+ * @see _montgomery()
2347
+ * @see _slidingWindow()
2348
+ * @access private
2349
+ * @param Array $x
2350
+ * @param Array $n
2351
+ * @return Array
2352
+ */
2353
+ function _prepMontgomery($x, $n)
2354
+ {
2355
+ $lhs = new Math_BigInteger();
2356
+ $lhs->value = array_merge($this->_array_repeat(0, count($n)), $x);
2357
+ $rhs = new Math_BigInteger();
2358
+ $rhs->value = $n;
2359
+
2360
+ list(, $temp) = $lhs->divide($rhs);
2361
+ return $temp->value;
2362
+ }
2363
+
2364
+ /**
2365
+ * Modular Inverse of a number mod 2**26 (eg. 67108864)
2366
+ *
2367
+ * Based off of the bnpInvDigit function implemented and justified in the following URL:
2368
+ *
2369
+ * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js}
2370
+ *
2371
+ * The following URL provides more info:
2372
+ *
2373
+ * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85}
2374
+ *
2375
+ * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For
2376
+ * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields
2377
+ * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't
2378
+ * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that
2379
+ * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the
2380
+ * maximum possible $x is 26 bits and the maximum $result is 16 bits. Thus, we have to be able to handle up to
2381
+ * 40 bits, which only 64-bit floating points will support.
2382
+ *
2383
+ * Thanks to Pedro Gimeno Fortea for input!
2384
+ *
2385
+ * @see _montgomery()
2386
+ * @access private
2387
+ * @param Array $x
2388
+ * @return Integer
2389
+ */
2390
+ function _modInverse67108864($x) // 2**26 == 67,108,864
2391
+ {
2392
+ $x = -$x[0];
2393
+ $result = $x & 0x3; // x**-1 mod 2**2
2394
+ $result = ($result * (2 - $x * $result)) & 0xF; // x**-1 mod 2**4
2395
+ $result = ($result * (2 - ($x & 0xFF) * $result)) & 0xFF; // x**-1 mod 2**8
2396
+ $result = ($result * ((2 - ($x & 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF; // x**-1 mod 2**16
2397
+ $result = fmod($result * (2 - fmod($x * $result, MATH_BIGINTEGER_BASE_FULL)), MATH_BIGINTEGER_BASE_FULL); // x**-1 mod 2**26
2398
+ return $result & MATH_BIGINTEGER_MAX_DIGIT;
2399
+ }
2400
+
2401
+ /**
2402
+ * Calculates modular inverses.
2403
+ *
2404
+ * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses.
2405
+ *
2406
+ * Here's an example:
2407
+ * <code>
2408
+ * <?php
2409
+ * include 'Math/BigInteger.php';
2410
+ *
2411
+ * $a = new Math_BigInteger(30);
2412
+ * $b = new Math_BigInteger(17);
2413
+ *
2414
+ * $c = $a->modInverse($b);
2415
+ * echo $c->toString(); // outputs 4
2416
+ *
2417
+ * echo "\r\n";
2418
+ *
2419
+ * $d = $a->multiply($c);
2420
+ * list(, $d) = $d->divide($b);
2421
+ * echo $d; // outputs 1 (as per the definition of modular inverse)
2422
+ * ?>
2423
+ * </code>
2424
+ *
2425
+ * @param Math_BigInteger $n
2426
+ * @return mixed false, if no modular inverse exists, Math_BigInteger, otherwise.
2427
+ * @access public
2428
+ * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information.
2429
+ */
2430
+ function modInverse($n)
2431
+ {
2432
+ switch ( MATH_BIGINTEGER_MODE ) {
2433
+ case MATH_BIGINTEGER_MODE_GMP:
2434
+ $temp = new Math_BigInteger();
2435
+ $temp->value = gmp_invert($this->value, $n->value);
2436
+
2437
+ return ( $temp->value === false ) ? false : $this->_normalize($temp);
2438
+ }
2439
+
2440
+ static $zero, $one;
2441
+ if (!isset($zero)) {
2442
+ $zero = new Math_BigInteger();
2443
+ $one = new Math_BigInteger(1);
2444
+ }
2445
+
2446
+ // $x mod -$n == $x mod $n.
2447
+ $n = $n->abs();
2448
+
2449
+ if ($this->compare($zero) < 0) {
2450
+ $temp = $this->abs();
2451
+ $temp = $temp->modInverse($n);
2452
+ return $this->_normalize($n->subtract($temp));
2453
+ }
2454
+
2455
+ extract($this->extendedGCD($n));
2456
+
2457
+ if (!$gcd->equals($one)) {
2458
+ return false;
2459
+ }
2460
+
2461
+ $x = $x->compare($zero) < 0 ? $x->add($n) : $x;
2462
+
2463
+ return $this->compare($zero) < 0 ? $this->_normalize($n->subtract($x)) : $this->_normalize($x);
2464
+ }
2465
+
2466
+ /**
2467
+ * Calculates the greatest common divisor and Bezout's identity.
2468
+ *
2469
+ * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that
2470
+ * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which
2471
+ * combination is returned is dependant upon which mode is in use. See
2472
+ * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information.
2473
+ *
2474
+ * Here's an example:
2475
+ * <code>
2476
+ * <?php
2477
+ * include 'Math/BigInteger.php';
2478
+ *
2479
+ * $a = new Math_BigInteger(693);
2480
+ * $b = new Math_BigInteger(609);
2481
+ *
2482
+ * extract($a->extendedGCD($b));
2483
+ *
2484
+ * echo $gcd->toString() . "\r\n"; // outputs 21
2485
+ * echo $a->toString() * $x->toString() + $b->toString() * $y->toString(); // outputs 21
2486
+ * ?>
2487
+ * </code>
2488
+ *
2489
+ * @param Math_BigInteger $n
2490
+ * @return Math_BigInteger
2491
+ * @access public
2492
+ * @internal Calculates the GCD using the binary xGCD algorithim described in
2493
+ * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=19 HAC 14.61}. As the text above 14.61 notes,
2494
+ * the more traditional algorithim requires "relatively costly multiple-precision divisions".
2495
+ */
2496
+ function extendedGCD($n)
2497
+ {
2498
+ switch ( MATH_BIGINTEGER_MODE ) {
2499
+ case MATH_BIGINTEGER_MODE_GMP:
2500
+ extract(gmp_gcdext($this->value, $n->value));
2501
+
2502
+ return array(
2503
+ 'gcd' => $this->_normalize(new Math_BigInteger($g)),
2504
+ 'x' => $this->_normalize(new Math_BigInteger($s)),
2505
+ 'y' => $this->_normalize(new Math_BigInteger($t))
2506
+ );
2507
+ case MATH_BIGINTEGER_MODE_BCMATH:
2508
+ // it might be faster to use the binary xGCD algorithim here, as well, but (1) that algorithim works
2509
+ // best when the base is a power of 2 and (2) i don't think it'd make much difference, anyway. as is,
2510
+ // the basic extended euclidean algorithim is what we're using.
2511
+
2512
+ $u = $this->value;
2513
+ $v = $n->value;
2514
+
2515
+ $a = '1';
2516
+ $b = '0';
2517
+ $c = '0';
2518
+ $d = '1';
2519
+
2520
+ while (bccomp($v, '0', 0) != 0) {
2521
+ $q = bcdiv($u, $v, 0);
2522
+
2523
+ $temp = $u;
2524
+ $u = $v;
2525
+ $v = bcsub($temp, bcmul($v, $q, 0), 0);
2526
+
2527
+ $temp = $a;
2528
+ $a = $c;
2529
+ $c = bcsub($temp, bcmul($a, $q, 0), 0);
2530
+
2531
+ $temp = $b;
2532
+ $b = $d;
2533
+ $d = bcsub($temp, bcmul($b, $q, 0), 0);
2534
+ }
2535
+
2536
+ return array(
2537
+ 'gcd' => $this->_normalize(new Math_BigInteger($u)),
2538
+ 'x' => $this->_normalize(new Math_BigInteger($a)),
2539
+ 'y' => $this->_normalize(new Math_BigInteger($b))
2540
+ );
2541
+ }
2542
+
2543
+ $y = $n->copy();
2544
+ $x = $this->copy();
2545
+ $g = new Math_BigInteger();
2546
+ $g->value = array(1);
2547
+
2548
+ while ( !(($x->value[0] & 1)|| ($y->value[0] & 1)) ) {
2549
+ $x->_rshift(1);
2550
+ $y->_rshift(1);
2551
+ $g->_lshift(1);
2552
+ }
2553
+
2554
+ $u = $x->copy();
2555
+ $v = $y->copy();
2556
+
2557
+ $a = new Math_BigInteger();
2558
+ $b = new Math_BigInteger();
2559
+ $c = new Math_BigInteger();
2560
+ $d = new Math_BigInteger();
2561
+
2562
+ $a->value = $d->value = $g->value = array(1);
2563
+ $b->value = $c->value = array();
2564
+
2565
+ while ( !empty($u->value) ) {
2566
+ while ( !($u->value[0] & 1) ) {
2567
+ $u->_rshift(1);
2568
+ if ( (!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1)) ) {
2569
+ $a = $a->add($y);
2570
+ $b = $b->subtract($x);
2571
+ }
2572
+ $a->_rshift(1);
2573
+ $b->_rshift(1);
2574
+ }
2575
+
2576
+ while ( !($v->value[0] & 1) ) {
2577
+ $v->_rshift(1);
2578
+ if ( (!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1)) ) {
2579
+ $c = $c->add($y);
2580
+ $d = $d->subtract($x);
2581
+ }
2582
+ $c->_rshift(1);
2583
+ $d->_rshift(1);
2584
+ }
2585
+
2586
+ if ($u->compare($v) >= 0) {
2587
+ $u = $u->subtract($v);
2588
+ $a = $a->subtract($c);
2589
+ $b = $b->subtract($d);
2590
+ } else {
2591
+ $v = $v->subtract($u);
2592
+ $c = $c->subtract($a);
2593
+ $d = $d->subtract($b);
2594
+ }
2595
+ }
2596
+
2597
+ return array(
2598
+ 'gcd' => $this->_normalize($g->multiply($v)),
2599
+ 'x' => $this->_normalize($c),
2600
+ 'y' => $this->_normalize($d)
2601
+ );
2602
+ }
2603
+
2604
+ /**
2605
+ * Calculates the greatest common divisor
2606
+ *
2607
+ * Say you have 693 and 609. The GCD is 21.
2608
+ *
2609
+ * Here's an example:
2610
+ * <code>
2611
+ * <?php
2612
+ * include 'Math/BigInteger.php';
2613
+ *
2614
+ * $a = new Math_BigInteger(693);
2615
+ * $b = new Math_BigInteger(609);
2616
+ *
2617
+ * $gcd = a->extendedGCD($b);
2618
+ *
2619
+ * echo $gcd->toString() . "\r\n"; // outputs 21
2620
+ * ?>
2621
+ * </code>
2622
+ *
2623
+ * @param Math_BigInteger $n
2624
+ * @return Math_BigInteger
2625
+ * @access public
2626
+ */
2627
+ function gcd($n)
2628
+ {
2629
+ extract($this->extendedGCD($n));
2630
+ return $gcd;
2631
+ }
2632
+
2633
+ /**
2634
+ * Absolute value.
2635
+ *
2636
+ * @return Math_BigInteger
2637
+ * @access public
2638
+ */
2639
+ function abs()
2640
+ {
2641
+ $temp = new Math_BigInteger();
2642
+
2643
+ switch ( MATH_BIGINTEGER_MODE ) {
2644
+ case MATH_BIGINTEGER_MODE_GMP:
2645
+ $temp->value = gmp_abs($this->value);
2646
+ break;
2647
+ case MATH_BIGINTEGER_MODE_BCMATH:
2648
+ $temp->value = (bccomp($this->value, '0', 0) < 0) ? substr($this->value, 1) : $this->value;
2649
+ break;
2650
+ default:
2651
+ $temp->value = $this->value;
2652
+ }
2653
+
2654
+ return $temp;
2655
+ }
2656
+
2657
+ /**
2658
+ * Compares two numbers.
2659
+ *
2660
+ * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is
2661
+ * demonstrated thusly:
2662
+ *
2663
+ * $x > $y: $x->compare($y) > 0
2664
+ * $x < $y: $x->compare($y) < 0
2665
+ * $x == $y: $x->compare($y) == 0
2666
+ *
2667
+ * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y).
2668
+ *
2669
+ * @param Math_BigInteger $y
2670
+ * @return Integer < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal.
2671
+ * @access public
2672
+ * @see equals()
2673
+ * @internal Could return $this->subtract($x), but that's not as fast as what we do do.
2674
+ */
2675
+ function compare($y)
2676
+ {
2677
+ switch ( MATH_BIGINTEGER_MODE ) {
2678
+ case MATH_BIGINTEGER_MODE_GMP:
2679
+ return gmp_cmp($this->value, $y->value);
2680
+ case MATH_BIGINTEGER_MODE_BCMATH:
2681
+ return bccomp($this->value, $y->value, 0);
2682
+ }
2683
+
2684
+ return $this->_compare($this->value, $this->is_negative, $y->value, $y->is_negative);
2685
+ }
2686
+
2687
+ /**
2688
+ * Compares two numbers.
2689
+ *
2690
+ * @param Array $x_value
2691
+ * @param Boolean $x_negative
2692
+ * @param Array $y_value
2693
+ * @param Boolean $y_negative
2694
+ * @return Integer
2695
+ * @see compare()
2696
+ * @access private
2697
+ */
2698
+ function _compare($x_value, $x_negative, $y_value, $y_negative)
2699
+ {
2700
+ if ( $x_negative != $y_negative ) {
2701
+ return ( !$x_negative && $y_negative ) ? 1 : -1;
2702
+ }
2703
+
2704
+ $result = $x_negative ? -1 : 1;
2705
+
2706
+ if ( count($x_value) != count($y_value) ) {
2707
+ return ( count($x_value) > count($y_value) ) ? $result : -$result;
2708
+ }
2709
+ $size = max(count($x_value), count($y_value));
2710
+
2711
+ $x_value = array_pad($x_value, $size, 0);
2712
+ $y_value = array_pad($y_value, $size, 0);
2713
+
2714
+ for ($i = count($x_value) - 1; $i >= 0; --$i) {
2715
+ if ($x_value[$i] != $y_value[$i]) {
2716
+ return ( $x_value[$i] > $y_value[$i] ) ? $result : -$result;
2717
+ }
2718
+ }
2719
+
2720
+ return 0;
2721
+ }
2722
+
2723
+ /**
2724
+ * Tests the equality of two numbers.
2725
+ *
2726
+ * If you need to see if one number is greater than or less than another number, use Math_BigInteger::compare()
2727
+ *
2728
+ * @param Math_BigInteger $x
2729
+ * @return Boolean
2730
+ * @access public
2731
+ * @see compare()
2732
+ */
2733
+ function equals($x)
2734
+ {
2735
+ switch ( MATH_BIGINTEGER_MODE ) {
2736
+ case MATH_BIGINTEGER_MODE_GMP:
2737
+ return gmp_cmp($this->value, $x->value) == 0;
2738
+ default:
2739
+ return $this->value === $x->value && $this->is_negative == $x->is_negative;
2740
+ }
2741
+ }
2742
+
2743
+ /**
2744
+ * Set Precision
2745
+ *
2746
+ * Some bitwise operations give different results depending on the precision being used. Examples include left
2747
+ * shift, not, and rotates.
2748
+ *
2749
+ * @param Integer $bits
2750
+ * @access public
2751
+ */
2752
+ function setPrecision($bits)
2753
+ {
2754
+ $this->precision = $bits;
2755
+ if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ) {
2756
+ $this->bitmask = new Math_BigInteger(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xFF), $bits >> 3), 256);
2757
+ } else {
2758
+ $this->bitmask = new Math_BigInteger(bcpow('2', $bits, 0));
2759
+ }
2760
+
2761
+ $temp = $this->_normalize($this);
2762
+ $this->value = $temp->value;
2763
+ }
2764
+
2765
+ /**
2766
+ * Logical And
2767
+ *
2768
+ * @param Math_BigInteger $x
2769
+ * @access public
2770
+ * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat>
2771
+ * @return Math_BigInteger
2772
+ */
2773
+ function bitwise_and($x)
2774
+ {
2775
+ switch ( MATH_BIGINTEGER_MODE ) {
2776
+ case MATH_BIGINTEGER_MODE_GMP:
2777
+ $temp = new Math_BigInteger();
2778
+ $temp->value = gmp_and($this->value, $x->value);
2779
+
2780
+ return $this->_normalize($temp);
2781
+ case MATH_BIGINTEGER_MODE_BCMATH:
2782
+ $left = $this->toBytes();
2783
+ $right = $x->toBytes();
2784
+
2785
+ $length = max(strlen($left), strlen($right));
2786
+
2787
+ $left = str_pad($left, $length, chr(0), STR_PAD_LEFT);
2788
+ $right = str_pad($right, $length, chr(0), STR_PAD_LEFT);
2789
+
2790
+ return $this->_normalize(new Math_BigInteger($left & $right, 256));
2791
+ }
2792
+
2793
+ $result = $this->copy();
2794
+
2795
+ $length = min(count($x->value), count($this->value));
2796
+
2797
+ $result->value = array_slice($result->value, 0, $length);
2798
+
2799
+ for ($i = 0; $i < $length; ++$i) {
2800
+ $result->value[$i]&= $x->value[$i];
2801
+ }
2802
+
2803
+ return $this->_normalize($result);
2804
+ }
2805
+
2806
+ /**
2807
+ * Logical Or
2808
+ *
2809
+ * @param Math_BigInteger $x
2810
+ * @access public
2811
+ * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat>
2812
+ * @return Math_BigInteger
2813
+ */
2814
+ function bitwise_or($x)
2815
+ {
2816
+ switch ( MATH_BIGINTEGER_MODE ) {
2817
+ case MATH_BIGINTEGER_MODE_GMP:
2818
+ $temp = new Math_BigInteger();
2819
+ $temp->value = gmp_or($this->value, $x->value);
2820
+
2821
+ return $this->_normalize($temp);
2822
+ case MATH_BIGINTEGER_MODE_BCMATH:
2823
+ $left = $this->toBytes();
2824
+ $right = $x->toBytes();
2825
+
2826
+ $length = max(strlen($left), strlen($right));
2827
+
2828
+ $left = str_pad($left, $length, chr(0), STR_PAD_LEFT);
2829
+ $right = str_pad($right, $length, chr(0), STR_PAD_LEFT);
2830
+
2831
+ return $this->_normalize(new Math_BigInteger($left | $right, 256));
2832
+ }
2833
+
2834
+ $length = max(count($this->value), count($x->value));
2835
+ $result = $this->copy();
2836
+ $result->value = array_pad($result->value, $length, 0);
2837
+ $x->value = array_pad($x->value, $length, 0);
2838
+
2839
+ for ($i = 0; $i < $length; ++$i) {
2840
+ $result->value[$i]|= $x->value[$i];
2841
+ }
2842
+
2843
+ return $this->_normalize($result);
2844
+ }
2845
+
2846
+ /**
2847
+ * Logical Exclusive-Or
2848
+ *
2849
+ * @param Math_BigInteger $x
2850
+ * @access public
2851
+ * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat>
2852
+ * @return Math_BigInteger
2853
+ */
2854
+ function bitwise_xor($x)
2855
+ {
2856
+ switch ( MATH_BIGINTEGER_MODE ) {
2857
+ case MATH_BIGINTEGER_MODE_GMP:
2858
+ $temp = new Math_BigInteger();
2859
+ $temp->value = gmp_xor($this->value, $x->value);
2860
+
2861
+ return $this->_normalize($temp);
2862
+ case MATH_BIGINTEGER_MODE_BCMATH:
2863
+ $left = $this->toBytes();
2864
+ $right = $x->toBytes();
2865
+
2866
+ $length = max(strlen($left), strlen($right));
2867
+
2868
+ $left = str_pad($left, $length, chr(0), STR_PAD_LEFT);
2869
+ $right = str_pad($right, $length, chr(0), STR_PAD_LEFT);
2870
+
2871
+ return $this->_normalize(new Math_BigInteger($left ^ $right, 256));
2872
+ }
2873
+
2874
+ $length = max(count($this->value), count($x->value));
2875
+ $result = $this->copy();
2876
+ $result->value = array_pad($result->value, $length, 0);
2877
+ $x->value = array_pad($x->value, $length, 0);
2878
+
2879
+ for ($i = 0; $i < $length; ++$i) {
2880
+ $result->value[$i]^= $x->value[$i];
2881
+ }
2882
+
2883
+ return $this->_normalize($result);
2884
+ }
2885
+
2886
+ /**
2887
+ * Logical Not
2888
+ *
2889
+ * @access public
2890
+ * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat>
2891
+ * @return Math_BigInteger
2892
+ */
2893
+ function bitwise_not()
2894
+ {
2895
+ // calculuate "not" without regard to $this->precision
2896
+ // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0)
2897
+ $temp = $this->toBytes();
2898
+ $pre_msb = decbin(ord($temp[0]));
2899
+ $temp = ~$temp;
2900
+ $msb = decbin(ord($temp[0]));
2901
+ if (strlen($msb) == 8) {
2902
+ $msb = substr($msb, strpos($msb, '0'));
2903
+ }
2904
+ $temp[0] = chr(bindec($msb));
2905
+
2906
+ // see if we need to add extra leading 1's
2907
+ $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8;
2908
+ $new_bits = $this->precision - $current_bits;
2909
+ if ($new_bits <= 0) {
2910
+ return $this->_normalize(new Math_BigInteger($temp, 256));
2911
+ }
2912
+
2913
+ // generate as many leading 1's as we need to.
2914
+ $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3);
2915
+ $this->_base256_lshift($leading_ones, $current_bits);
2916
+
2917
+ $temp = str_pad($temp, strlen($leading_ones), chr(0), STR_PAD_LEFT);
2918
+
2919
+ return $this->_normalize(new Math_BigInteger($leading_ones | $temp, 256));
2920
+ }
2921
+
2922
+ /**
2923
+ * Logical Right Shift
2924
+ *
2925
+ * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift.
2926
+ *
2927
+ * @param Integer $shift
2928
+ * @return Math_BigInteger
2929
+ * @access public
2930
+ * @internal The only version that yields any speed increases is the internal version.
2931
+ */
2932
+ function bitwise_rightShift($shift)
2933
+ {
2934
+ $temp = new Math_BigInteger();
2935
+
2936
+ switch ( MATH_BIGINTEGER_MODE ) {
2937
+ case MATH_BIGINTEGER_MODE_GMP:
2938
+ static $two;
2939
+
2940
+ if (!isset($two)) {
2941
+ $two = gmp_init('2');
2942
+ }
2943
+
2944
+ $temp->value = gmp_div_q($this->value, gmp_pow($two, $shift));
2945
+
2946
+ break;
2947
+ case MATH_BIGINTEGER_MODE_BCMATH:
2948
+ $temp->value = bcdiv($this->value, bcpow('2', $shift, 0), 0);
2949
+
2950
+ break;
2951
+ default: // could just replace _lshift with this, but then all _lshift() calls would need to be rewritten
2952
+ // and I don't want to do that...
2953
+ $temp->value = $this->value;
2954
+ $temp->_rshift($shift);
2955
+ }
2956
+
2957
+ return $this->_normalize($temp);
2958
+ }
2959
+
2960
+ /**
2961
+ * Logical Left Shift
2962
+ *
2963
+ * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift.
2964
+ *
2965
+ * @param Integer $shift
2966
+ * @return Math_BigInteger
2967
+ * @access public
2968
+ * @internal The only version that yields any speed increases is the internal version.
2969
+ */
2970
+ function bitwise_leftShift($shift)
2971
+ {
2972
+ $temp = new Math_BigInteger();
2973
+
2974
+ switch ( MATH_BIGINTEGER_MODE ) {
2975
+ case MATH_BIGINTEGER_MODE_GMP:
2976
+ static $two;
2977
+
2978
+ if (!isset($two)) {
2979
+ $two = gmp_init('2');
2980
+ }
2981
+
2982
+ $temp->value = gmp_mul($this->value, gmp_pow($two, $shift));
2983
+
2984
+ break;
2985
+ case MATH_BIGINTEGER_MODE_BCMATH:
2986
+ $temp->value = bcmul($this->value, bcpow('2', $shift, 0), 0);
2987
+
2988
+ break;
2989
+ default: // could just replace _rshift with this, but then all _lshift() calls would need to be rewritten
2990
+ // and I don't want to do that...
2991
+ $temp->value = $this->value;
2992
+ $temp->_lshift($shift);
2993
+ }
2994
+
2995
+ return $this->_normalize($temp);
2996
+ }
2997
+
2998
+ /**
2999
+ * Logical Left Rotate
3000
+ *
3001
+ * Instead of the top x bits being dropped they're appended to the shifted bit string.
3002
+ *
3003
+ * @param Integer $shift
3004
+ * @return Math_BigInteger
3005
+ * @access public
3006
+ */
3007
+ function bitwise_leftRotate($shift)
3008
+ {
3009
+ $bits = $this->toBytes();
3010
+
3011
+ if ($this->precision > 0) {
3012
+ $precision = $this->precision;
3013
+ if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) {
3014
+ $mask = $this->bitmask->subtract(new Math_BigInteger(1));
3015
+ $mask = $mask->toBytes();
3016
+ } else {
3017
+ $mask = $this->bitmask->toBytes();
3018
+ }
3019
+ } else {
3020
+ $temp = ord($bits[0]);
3021
+ for ($i = 0; $temp >> $i; ++$i);
3022
+ $precision = 8 * strlen($bits) - 8 + $i;
3023
+ $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xFF), $precision >> 3);
3024
+ }
3025
+
3026
+ if ($shift < 0) {
3027
+ $shift+= $precision;
3028
+ }
3029
+ $shift%= $precision;
3030
+
3031
+ if (!$shift) {
3032
+ return $this->copy();
3033
+ }
3034
+
3035
+ $left = $this->bitwise_leftShift($shift);
3036
+ $left = $left->bitwise_and(new Math_BigInteger($mask, 256));
3037
+ $right = $this->bitwise_rightShift($precision - $shift);
3038
+ $result = MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ? $left->bitwise_or($right) : $left->add($right);
3039
+ return $this->_normalize($result);
3040
+ }
3041
+
3042
+ /**
3043
+ * Logical Right Rotate
3044
+ *
3045
+ * Instead of the bottom x bits being dropped they're prepended to the shifted bit string.
3046
+ *
3047
+ * @param Integer $shift
3048
+ * @return Math_BigInteger
3049
+ * @access public
3050
+ */
3051
+ function bitwise_rightRotate($shift)
3052
+ {
3053
+ return $this->bitwise_leftRotate(-$shift);
3054
+ }
3055
+
3056
+ /**
3057
+ * Set random number generator function
3058
+ *
3059
+ * This function is deprecated.
3060
+ *
3061
+ * @param String $generator
3062
+ * @access public
3063
+ */
3064
+ function setRandomGenerator($generator)
3065
+ {
3066
+ }
3067
+
3068
+ /**
3069
+ * Generates a random BigInteger
3070
+ *
3071
+ * Byte length is equal to $length. Uses crypt_random if it's loaded and mt_rand if it's not.
3072
+ *
3073
+ * @param Integer $length
3074
+ * @return Math_BigInteger
3075
+ * @access private
3076
+ */
3077
+ function _random_number_helper($size)
3078
+ {
3079
+ if (function_exists('crypt_random_string')) {
3080
+ $random = crypt_random_string($size);
3081
+ } else {
3082
+ $random = '';
3083
+
3084
+ if ($size & 1) {
3085
+ $random.= chr(mt_rand(0, 255));
3086
+ }
3087
+
3088
+ $blocks = $size >> 1;
3089
+ for ($i = 0; $i < $blocks; ++$i) {
3090
+ // mt_rand(-2147483648, 0x7FFFFFFF) always produces -2147483648 on some systems
3091
+ $random.= pack('n', mt_rand(0, 0xFFFF));
3092
+ }
3093
+ }
3094
+
3095
+ return new Math_BigInteger($random, 256);
3096
+ }
3097
+
3098
+ /**
3099
+ * Generate a random number
3100
+ *
3101
+ * Returns a random number between $min and $max where $min and $max
3102
+ * can be defined using one of the two methods:
3103
+ *
3104
+ * $min->random($max)
3105
+ * $max->random($min)
3106
+ *
3107
+ * @param Math_BigInteger $arg1
3108
+ * @param optional Math_BigInteger $arg2
3109
+ * @return Math_BigInteger
3110
+ * @access public
3111
+ * @internal The API for creating random numbers used to be $a->random($min, $max), where $a was a Math_BigInteger object.
3112
+ * That method is still supported for BC purposes.
3113
+ */
3114
+ function random($arg1, $arg2 = false)
3115
+ {
3116
+ if ($arg1 === false) {
3117
+ return false;
3118
+ }
3119
+
3120
+ if ($arg2 === false) {
3121
+ $max = $arg1;
3122
+ $min = $this;
3123
+ } else {
3124
+ $min = $arg1;
3125
+ $max = $arg2;
3126
+ }
3127
+
3128
+ $compare = $max->compare($min);
3129
+
3130
+ if (!$compare) {
3131
+ return $this->_normalize($min);
3132
+ } else if ($compare < 0) {
3133
+ // if $min is bigger then $max, swap $min and $max
3134
+ $temp = $max;
3135
+ $max = $min;
3136
+ $min = $temp;
3137
+ }
3138
+
3139
+ static $one;
3140
+ if (!isset($one)) {
3141
+ $one = new Math_BigInteger(1);
3142
+ }
3143
+
3144
+ $max = $max->subtract($min->subtract($one));
3145
+ $size = strlen(ltrim($max->toBytes(), chr(0)));
3146
+
3147
+ /*
3148
+ doing $random % $max doesn't work because some numbers will be more likely to occur than others.
3149
+ eg. if $max is 140 and $random's max is 255 then that'd mean both $random = 5 and $random = 145
3150
+ would produce 5 whereas the only value of random that could produce 139 would be 139. ie.
3151
+ not all numbers would be equally likely. some would be more likely than others.
3152
+
3153
+ creating a whole new random number until you find one that is within the range doesn't work
3154
+ because, for sufficiently small ranges, the likelihood that you'd get a number within that range
3155
+ would be pretty small. eg. with $random's max being 255 and if your $max being 1 the probability
3156
+ would be pretty high that $random would be greater than $max.
3157
+
3158
+ phpseclib works around this using the technique described here:
3159
+
3160
+ http://crypto.stackexchange.com/questions/5708/creating-a-small-number-from-a-cryptographically-secure-random-string
3161
+ */
3162
+ $random_max = new Math_BigInteger(chr(1) . str_repeat("\0", $size), 256);
3163
+ $random = $this->_random_number_helper($size);
3164
+
3165
+ list($max_multiple) = $random_max->divide($max);
3166
+ $max_multiple = $max_multiple->multiply($max);
3167
+
3168
+ while ($random->compare($max_multiple) >= 0) {
3169
+ $random = $random->subtract($max_multiple);
3170
+ $random_max = $random_max->subtract($max_multiple);
3171
+ $random = $random->bitwise_leftShift(8);
3172
+ $random = $random->add($this->_random_number_helper(1));
3173
+ $random_max = $random_max->bitwise_leftShift(8);
3174
+ list($max_multiple) = $random_max->divide($max);
3175
+ $max_multiple = $max_multiple->multiply($max);
3176
+ }
3177
+ list(, $random) = $random->divide($max);
3178
+
3179
+ return $this->_normalize($random->add($min));
3180
+ }
3181
+
3182
+ /**
3183
+ * Generate a random prime number.
3184
+ *
3185
+ * If there's not a prime within the given range, false will be returned. If more than $timeout seconds have elapsed,
3186
+ * give up and return false.
3187
+ *
3188
+ * @param Math_BigInteger $arg1
3189
+ * @param optional Math_BigInteger $arg2
3190
+ * @param optional Integer $timeout
3191
+ * @return Mixed
3192
+ * @access public
3193
+ * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}.
3194
+ */
3195
+ function randomPrime($arg1, $arg2 = false, $timeout = false)
3196
+ {
3197
+ if ($arg1 === false) {
3198
+ return false;
3199
+ }
3200
+
3201
+ if ($arg2 === false) {
3202
+ $max = $arg1;
3203
+ $min = $this;
3204
+ } else {
3205
+ $min = $arg1;
3206
+ $max = $arg2;
3207
+ }
3208
+
3209
+ $compare = $max->compare($min);
3210
+
3211
+ if (!$compare) {
3212
+ return $min->isPrime() ? $min : false;
3213
+ } else if ($compare < 0) {
3214
+ // if $min is bigger then $max, swap $min and $max
3215
+ $temp = $max;
3216
+ $max = $min;
3217
+ $min = $temp;
3218
+ }
3219
+
3220
+ static $one, $two;
3221
+ if (!isset($one)) {
3222
+ $one = new Math_BigInteger(1);
3223
+ $two = new Math_BigInteger(2);
3224
+ }
3225
+
3226
+ $start = time();
3227
+
3228
+ $x = $this->random($min, $max);
3229
+
3230
+ // gmp_nextprime() requires PHP 5 >= 5.2.0 per <http://php.net/gmp-nextprime>.
3231
+ if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP && function_exists('gmp_nextprime') ) {
3232
+ $p = new Math_BigInteger();
3233
+ $p->value = gmp_nextprime($x->value);
3234
+
3235
+ if ($p->compare($max) <= 0) {
3236
+ return $p;
3237
+ }
3238
+
3239
+ if (!$min->equals($x)) {
3240
+ $x = $x->subtract($one);
3241
+ }
3242
+
3243
+ return $x->randomPrime($min, $x);
3244
+ }
3245
+
3246
+ if ($x->equals($two)) {
3247
+ return $x;
3248
+ }
3249
+
3250
+ $x->_make_odd();
3251
+ if ($x->compare($max) > 0) {
3252
+ // if $x > $max then $max is even and if $min == $max then no prime number exists between the specified range
3253
+ if ($min->equals($max)) {
3254
+ return false;
3255
+ }
3256
+ $x = $min->copy();
3257
+ $x->_make_odd();
3258
+ }
3259
+
3260
+ $initial_x = $x->copy();
3261
+
3262
+ while (true) {
3263
+ if ($timeout !== false && time() - $start > $timeout) {
3264
+ return false;
3265
+ }
3266
+
3267
+ if ($x->isPrime()) {
3268
+ return $x;
3269
+ }
3270
+
3271
+ $x = $x->add($two);
3272
+
3273
+ if ($x->compare($max) > 0) {
3274
+ $x = $min->copy();
3275
+ if ($x->equals($two)) {
3276
+ return $x;
3277
+ }
3278
+ $x->_make_odd();
3279
+ }
3280
+
3281
+ if ($x->equals($initial_x)) {
3282
+ return false;
3283
+ }
3284
+ }
3285
+ }
3286
+
3287
+ /**
3288
+ * Make the current number odd
3289
+ *
3290
+ * If the current number is odd it'll be unchanged. If it's even, one will be added to it.
3291
+ *
3292
+ * @see randomPrime()
3293
+ * @access private
3294
+ */
3295
+ function _make_odd()
3296
+ {
3297
+ switch ( MATH_BIGINTEGER_MODE ) {
3298
+ case MATH_BIGINTEGER_MODE_GMP:
3299
+ gmp_setbit($this->value, 0);
3300
+ break;
3301
+ case MATH_BIGINTEGER_MODE_BCMATH:
3302
+ if ($this->value[strlen($this->value) - 1] % 2 == 0) {
3303
+ $this->value = bcadd($this->value, '1');
3304
+ }
3305
+ break;
3306
+ default:
3307
+ $this->value[0] |= 1;
3308
+ }
3309
+ }
3310
+
3311
+ /**
3312
+ * Checks a numer to see if it's prime
3313
+ *
3314
+ * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the
3315
+ * $t parameter is distributability. Math_BigInteger::randomPrime() can be distributed across multiple pageloads
3316
+ * on a website instead of just one.
3317
+ *
3318
+ * @param optional Math_BigInteger $t
3319
+ * @return Boolean
3320
+ * @access public
3321
+ * @internal Uses the
3322
+ * {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. See
3323
+ * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24}.
3324
+ */
3325
+ function isPrime($t = false)
3326
+ {
3327
+ $length = strlen($this->toBytes());
3328
+
3329
+ if (!$t) {
3330
+ // see HAC 4.49 "Note (controlling the error probability)"
3331
+ // @codingStandardsIgnoreStart
3332
+ if ($length >= 163) { $t = 2; } // floor(1300 / 8)
3333
+ else if ($length >= 106) { $t = 3; } // floor( 850 / 8)
3334
+ else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8)
3335
+ else if ($length >= 68 ) { $t = 5; } // floor( 550 / 8)
3336
+ else if ($length >= 56 ) { $t = 6; } // floor( 450 / 8)
3337
+ else if ($length >= 50 ) { $t = 7; } // floor( 400 / 8)
3338
+ else if ($length >= 43 ) { $t = 8; } // floor( 350 / 8)
3339
+ else if ($length >= 37 ) { $t = 9; } // floor( 300 / 8)
3340
+ else if ($length >= 31 ) { $t = 12; } // floor( 250 / 8)
3341
+ else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8)
3342
+ else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8)
3343
+ else { $t = 27; }
3344
+ // @codingStandardsIgnoreEnd
3345
+ }
3346
+
3347
+ // ie. gmp_testbit($this, 0)
3348
+ // ie. isEven() or !isOdd()
3349
+ switch ( MATH_BIGINTEGER_MODE ) {
3350
+ case MATH_BIGINTEGER_MODE_GMP:
3351
+ return gmp_prob_prime($this->value, $t) != 0;
3352
+ case MATH_BIGINTEGER_MODE_BCMATH:
3353
+ if ($this->value === '2') {
3354
+ return true;
3355
+ }
3356
+ if ($this->value[strlen($this->value) - 1] % 2 == 0) {
3357
+ return false;
3358
+ }
3359
+ break;
3360
+ default:
3361
+ if ($this->value == array(2)) {
3362
+ return true;
3363
+ }
3364
+ if (~$this->value[0] & 1) {
3365
+ return false;
3366
+ }
3367
+ }
3368
+
3369
+ static $primes, $zero, $one, $two;
3370
+
3371
+ if (!isset($primes)) {
3372
+ $primes = array(
3373
+ 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
3374
+ 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
3375
+ 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227,
3376
+ 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
3377
+ 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
3378
+ 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509,
3379
+ 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617,
3380
+ 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727,
3381
+ 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829,
3382
+ 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947,
3383
+ 953, 967, 971, 977, 983, 991, 997
3384
+ );
3385
+
3386
+ if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) {
3387
+ for ($i = 0; $i < count($primes); ++$i) {
3388
+ $primes[$i] = new Math_BigInteger($primes[$i]);
3389
+ }
3390
+ }
3391
+
3392
+ $zero = new Math_BigInteger();
3393
+ $one = new Math_BigInteger(1);
3394
+ $two = new Math_BigInteger(2);
3395
+ }
3396
+
3397
+ if ($this->equals($one)) {
3398
+ return false;
3399
+ }
3400
+
3401
+ // see HAC 4.4.1 "Random search for probable primes"
3402
+ if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) {
3403
+ foreach ($primes as $prime) {
3404
+ list(, $r) = $this->divide($prime);
3405
+ if ($r->equals($zero)) {
3406
+ return $this->equals($prime);
3407
+ }
3408
+ }
3409
+ } else {
3410
+ $value = $this->value;
3411
+ foreach ($primes as $prime) {
3412
+ list(, $r) = $this->_divide_digit($value, $prime);
3413
+ if (!$r) {
3414
+ return count($value) == 1 && $value[0] == $prime;
3415
+ }
3416
+ }
3417
+ }
3418
+
3419
+ $n = $this->copy();
3420
+ $n_1 = $n->subtract($one);
3421
+ $n_2 = $n->subtract($two);
3422
+
3423
+ $r = $n_1->copy();
3424
+ $r_value = $r->value;
3425
+ // ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s));
3426
+ if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) {
3427
+ $s = 0;
3428
+ // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals($one) check earlier
3429
+ while ($r->value[strlen($r->value) - 1] % 2 == 0) {
3430
+ $r->value = bcdiv($r->value, '2', 0);
3431
+ ++$s;
3432
+ }
3433
+ } else {
3434
+ for ($i = 0, $r_length = count($r_value); $i < $r_length; ++$i) {
3435
+ $temp = ~$r_value[$i] & 0xFFFFFF;
3436
+ for ($j = 1; ($temp >> $j) & 1; ++$j);
3437
+ if ($j != 25) {
3438
+ break;
3439
+ }
3440
+ }
3441
+ $s = 26 * $i + $j - 1;
3442
+ $r->_rshift($s);
3443
+ }
3444
+
3445
+ for ($i = 0; $i < $t; ++$i) {
3446
+ $a = $this->random($two, $n_2);
3447
+ $y = $a->modPow($r, $n);
3448
+
3449
+ if (!$y->equals($one) && !$y->equals($n_1)) {
3450
+ for ($j = 1; $j < $s && !$y->equals($n_1); ++$j) {
3451
+ $y = $y->modPow($two, $n);
3452
+ if ($y->equals($one)) {
3453
+ return false;
3454
+ }
3455
+ }
3456
+
3457
+ if (!$y->equals($n_1)) {
3458
+ return false;
3459
+ }
3460
+ }
3461
+ }
3462
+ return true;
3463
+ }
3464
+
3465
+ /**
3466
+ * Logical Left Shift
3467
+ *
3468
+ * Shifts BigInteger's by $shift bits.
3469
+ *
3470
+ * @param Integer $shift
3471
+ * @access private
3472
+ */
3473
+ function _lshift($shift)
3474
+ {
3475
+ if ( $shift == 0 ) {
3476
+ return;
3477
+ }
3478
+
3479
+ $num_digits = (int) ($shift / MATH_BIGINTEGER_BASE);
3480
+ $shift %= MATH_BIGINTEGER_BASE;
3481
+ $shift = 1 << $shift;
3482
+
3483
+ $carry = 0;
3484
+
3485
+ for ($i = 0; $i < count($this->value); ++$i) {
3486
+ $temp = $this->value[$i] * $shift + $carry;
3487
+ $carry = MATH_BIGINTEGER_BASE === 26 ? intval($temp / 0x4000000) : ($temp >> 31);
3488
+ $this->value[$i] = (int) ($temp - $carry * MATH_BIGINTEGER_BASE_FULL);
3489
+ }
3490
+
3491
+ if ( $carry ) {
3492
+ $this->value[count($this->value)] = $carry;
3493
+ }
3494
+
3495
+ while ($num_digits--) {
3496
+ array_unshift($this->value, 0);
3497
+ }
3498
+ }
3499
+
3500
+ /**
3501
+ * Logical Right Shift
3502
+ *
3503
+ * Shifts BigInteger's by $shift bits.
3504
+ *
3505
+ * @param Integer $shift
3506
+ * @access private
3507
+ */
3508
+ function _rshift($shift)
3509
+ {
3510
+ if ($shift == 0) {
3511
+ return;
3512
+ }
3513
+
3514
+ $num_digits = (int) ($shift / MATH_BIGINTEGER_BASE);
3515
+ $shift %= MATH_BIGINTEGER_BASE;
3516
+ $carry_shift = MATH_BIGINTEGER_BASE - $shift;
3517
+ $carry_mask = (1 << $shift) - 1;
3518
+
3519
+ if ( $num_digits ) {
3520
+ $this->value = array_slice($this->value, $num_digits);
3521
+ }
3522
+
3523
+ $carry = 0;
3524
+
3525
+ for ($i = count($this->value) - 1; $i >= 0; --$i) {
3526
+ $temp = $this->value[$i] >> $shift | $carry;
3527
+ $carry = ($this->value[$i] & $carry_mask) << $carry_shift;
3528
+ $this->value[$i] = $temp;
3529
+ }
3530
+
3531
+ $this->value = $this->_trim($this->value);
3532
+ }
3533
+
3534
+ /**
3535
+ * Normalize
3536
+ *
3537
+ * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision
3538
+ *
3539
+ * @param Math_BigInteger
3540
+ * @return Math_BigInteger
3541
+ * @see _trim()
3542
+ * @access private
3543
+ */
3544
+ function _normalize($result)
3545
+ {
3546
+ $result->precision = $this->precision;
3547
+ $result->bitmask = $this->bitmask;
3548
+
3549
+ switch ( MATH_BIGINTEGER_MODE ) {
3550
+ case MATH_BIGINTEGER_MODE_GMP:
3551
+ if (!empty($result->bitmask->value)) {
3552
+ $result->value = gmp_and($result->value, $result->bitmask->value);
3553
+ }
3554
+
3555
+ return $result;
3556
+ case MATH_BIGINTEGER_MODE_BCMATH:
3557
+ if (!empty($result->bitmask->value)) {
3558
+ $result->value = bcmod($result->value, $result->bitmask->value);
3559
+ }
3560
+
3561
+ return $result;
3562
+ }
3563
+
3564
+ $value = &$result->value;
3565
+
3566
+ if ( !count($value) ) {
3567
+ return $result;
3568
+ }
3569
+
3570
+ $value = $this->_trim($value);
3571
+
3572
+ if (!empty($result->bitmask->value)) {
3573
+ $length = min(count($value), count($this->bitmask->value));
3574
+ $value = array_slice($value, 0, $length);
3575
+
3576
+ for ($i = 0; $i < $length; ++$i) {
3577
+ $value[$i] = $value[$i] & $this->bitmask->value[$i];
3578
+ }
3579
+ }
3580
+
3581
+ return $result;
3582
+ }
3583
+
3584
+ /**
3585
+ * Trim
3586
+ *
3587
+ * Removes leading zeros
3588
+ *
3589
+ * @param Array $value
3590
+ * @return Math_BigInteger
3591
+ * @access private
3592
+ */
3593
+ function _trim($value)
3594
+ {
3595
+ for ($i = count($value) - 1; $i >= 0; --$i) {
3596
+ if ( $value[$i] ) {
3597
+ break;
3598
+ }
3599
+ unset($value[$i]);
3600
+ }
3601
+
3602
+ return $value;
3603
+ }
3604
+
3605
+ /**
3606
+ * Array Repeat
3607
+ *
3608
+ * @param $input Array
3609
+ * @param $multiplier mixed
3610
+ * @return Array
3611
+ * @access private
3612
+ */
3613
+ function _array_repeat($input, $multiplier)
3614
+ {
3615
+ return ($multiplier) ? array_fill(0, $multiplier, $input) : array();
3616
+ }
3617
+
3618
+ /**
3619
+ * Logical Left Shift
3620
+ *
3621
+ * Shifts binary strings $shift bits, essentially multiplying by 2**$shift.
3622
+ *
3623
+ * @param $x String
3624
+ * @param $shift Integer
3625
+ * @return String
3626
+ * @access private
3627
+ */
3628
+ function _base256_lshift(&$x, $shift)
3629
+ {
3630
+ if ($shift == 0) {
3631
+ return;
3632
+ }
3633
+
3634
+ $num_bytes = $shift >> 3; // eg. floor($shift/8)
3635
+ $shift &= 7; // eg. $shift % 8
3636
+
3637
+ $carry = 0;
3638
+ for ($i = strlen($x) - 1; $i >= 0; --$i) {
3639
+ $temp = ord($x[$i]) << $shift | $carry;
3640
+ $x[$i] = chr($temp);
3641
+ $carry = $temp >> 8;
3642
+ }
3643
+ $carry = ($carry != 0) ? chr($carry) : '';
3644
+ $x = $carry . $x . str_repeat(chr(0), $num_bytes);
3645
+ }
3646
+
3647
+ /**
3648
+ * Logical Right Shift
3649
+ *
3650
+ * Shifts binary strings $shift bits, essentially dividing by 2**$shift and returning the remainder.
3651
+ *
3652
+ * @param $x String
3653
+ * @param $shift Integer
3654
+ * @return String
3655
+ * @access private
3656
+ */
3657
+ function _base256_rshift(&$x, $shift)
3658
+ {
3659
+ if ($shift == 0) {
3660
+ $x = ltrim($x, chr(0));
3661
+ return '';
3662
+ }
3663
+
3664
+ $num_bytes = $shift >> 3; // eg. floor($shift/8)
3665
+ $shift &= 7; // eg. $shift % 8
3666
+
3667
+ $remainder = '';
3668
+ if ($num_bytes) {
3669
+ $start = $num_bytes > strlen($x) ? -strlen($x) : -$num_bytes;
3670
+ $remainder = substr($x, $start);
3671
+ $x = substr($x, 0, -$num_bytes);
3672
+ }
3673
+
3674
+ $carry = 0;
3675
+ $carry_shift = 8 - $shift;
3676
+ for ($i = 0; $i < strlen($x); ++$i) {
3677
+ $temp = (ord($x[$i]) >> $shift) | $carry;
3678
+ $carry = (ord($x[$i]) << $carry_shift) & 0xFF;
3679
+ $x[$i] = chr($temp);
3680
+ }
3681
+ $x = ltrim($x, chr(0));
3682
+
3683
+ $remainder = chr($carry >> $carry_shift) . $remainder;
3684
+
3685
+ return ltrim($remainder, chr(0));
3686
+ }
3687
+
3688
+ // one quirk about how the following functions are implemented is that PHP defines N to be an unsigned long
3689
+ // at 32-bits, while java's longs are 64-bits.
3690
+
3691
+ /**
3692
+ * Converts 32-bit integers to bytes.
3693
+ *
3694
+ * @param Integer $x
3695
+ * @return String
3696
+ * @access private
3697
+ */
3698
+ function _int2bytes($x)
3699
+ {
3700
+ return ltrim(pack('N', $x), chr(0));
3701
+ }
3702
+
3703
+ /**
3704
+ * Converts bytes to 32-bit integers
3705
+ *
3706
+ * @param String $x
3707
+ * @return Integer
3708
+ * @access private
3709
+ */
3710
+ function _bytes2int($x)
3711
+ {
3712
+ $temp = unpack('Nint', str_pad($x, 4, chr(0), STR_PAD_LEFT));
3713
+ return $temp['int'];
3714
+ }
3715
+
3716
+ /**
3717
+ * DER-encode an integer
3718
+ *
3719
+ * The ability to DER-encode integers is needed to create RSA public keys for use with OpenSSL
3720
+ *
3721
+ * @see modPow()
3722
+ * @access private
3723
+ * @param Integer $length
3724
+ * @return String
3725
+ */
3726
+ function _encodeASN1Length($length)
3727
+ {
3728
+ if ($length <= 0x7F) {
3729
+ return chr($length);
3730
+ }
3731
+
3732
+ $temp = ltrim(pack('N', $length), chr(0));
3733
+ return pack('Ca*', 0x80 | strlen($temp), $temp);
3734
+ }
3735
+
3736
+ /**
3737
+ * Single digit division
3738
+ *
3739
+ * Even if int64 is being used the division operator will return a float64 value
3740
+ * if the dividend is not evenly divisible by the divisor. Since a float64 doesn't
3741
+ * have the precision of int64 this is a problem so, when int64 is being used,
3742
+ * we'll guarantee that the dividend is divisible by first subtracting the remainder.
3743
+ *
3744
+ * @access private
3745
+ * @param Integer $x
3746
+ * @param Integer $y
3747
+ * @return Integer
3748
+ */
3749
+ function _safe_divide($x, $y)
3750
+ {
3751
+ if (MATH_BIGINTEGER_BASE === 26) {
3752
+ return (int) ($x / $y);
3753
+ }
3754
+
3755
+ // MATH_BIGINTEGER_BASE === 31
3756
+ return ($x - ($x % $y)) / $y;
3757
+ }
3758
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AppInfo.php ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Your app's API key and secret.
6
+ */
7
+ final class AppInfo
8
+ {
9
+ /**
10
+ * Your Dropbox <em>app key</em> (OAuth calls this the <em>consumer key</em>). You can
11
+ * create an app key and secret on the <a href="http://dropbox.com/developers/apps">Dropbox developer website</a>.
12
+ *
13
+ * @return string
14
+ */
15
+ function getKey() { return $this->key; }
16
+
17
+ /** @var string */
18
+ private $key;
19
+
20
+ /**
21
+ * Your Dropbox <em>app secret</em> (OAuth calls this the <em>consumer secret</em>). You can
22
+ * create an app key and secret on the <a href="http://dropbox.com/developers/apps">Dropbox developer website</a>.
23
+ *
24
+ * Make sure that this is kept a secret. Someone with your app secret can impesonate your
25
+ * application. People sometimes ask for help on the Dropbox API forums and
26
+ * copy/paste code that includes their app secret. Do not do that.
27
+ *
28
+ * @return string
29
+ */
30
+ function getSecret() { return $this->secret; }
31
+
32
+ /** @var string */
33
+ private $secret;
34
+
35
+ /**
36
+ * The set of servers your app will use. This defaults to the standard Dropbox servers
37
+ * {@link Host::getDefault}.
38
+ *
39
+ * @return Host
40
+ *
41
+ * @internal
42
+ */
43
+ function getHost() { return $this->host; }
44
+
45
+ /** @var Host */
46
+ private $host;
47
+
48
+ /**
49
+ * Constructor.
50
+ *
51
+ * @param string $key
52
+ * See {@link getKey()}
53
+ * @param string $secret
54
+ * See {@link getSecret()}
55
+ */
56
+ function __construct($key, $secret)
57
+ {
58
+ self::checkKeyArg($key);
59
+ self::checkSecretArg($secret);
60
+
61
+ $this->key = $key;
62
+ $this->secret = $secret;
63
+
64
+ // The $host parameter is sort of internal. We don't include it in the param list because
65
+ // we don't want it to be included in the documentation. Use PHP arg list hacks to get at
66
+ // it.
67
+ $host = null;
68
+ if (\func_num_args() == 3) {
69
+ $host = \func_get_arg(2);
70
+ Host::checkArgOrNull("host", $host);
71
+ }
72
+ if ($host === null) {
73
+ $host = Host::getDefault();
74
+ }
75
+ $this->host = $host;
76
+ }
77
+
78
+ /**
79
+ * Loads a JSON file containing information about your app. At a minimum, the file must include
80
+ * the "key" and "secret" fields. Run 'php authorize.php' in the examples directory
81
+ * for details about what this file should look like.
82
+ *
83
+ * @param string $path
84
+ * Path to a JSON file
85
+ *
86
+ * @return AppInfo
87
+ *
88
+ * @throws AppInfoLoadException
89
+ */
90
+ static function loadFromJsonFile($path)
91
+ {
92
+ list($rawJson, $appInfo) = self::loadFromJsonFileWithRaw($path);
93
+ return $appInfo;
94
+ }
95
+
96
+ /**
97
+ * Loads a JSON file containing information about your app. At a minimum, the file must include
98
+ * the "key" and "secret" fields. Run 'php authorize.php' in the examples directory
99
+ * for details about what this file should look like.
100
+ *
101
+ * @param string $path
102
+ * Path to a JSON file
103
+ *
104
+ * @return array
105
+ * A list of two items. The first is a PHP array representation of the raw JSON, the second
106
+ * is an AppInfo object that is the parsed version of the JSON.
107
+ *
108
+ * @throws AppInfoLoadException
109
+ *
110
+ * @internal
111
+ */
112
+ static function loadFromJsonFileWithRaw($path)
113
+ {
114
+ if (!file_exists($path)) {
115
+ throw new AppInfoLoadException("File doesn't exist: \"$path\"");
116
+ }
117
+
118
+ $str = Util::stripUtf8Bom(file_get_contents($path));
119
+ $jsonArr = json_decode($str, true, 10);
120
+
121
+ if (is_null($jsonArr)) {
122
+ throw new AppInfoLoadException("JSON parse error: \"$path\"");
123
+ }
124
+
125
+ $appInfo = self::loadFromJson($jsonArr);
126
+
127
+ return array($jsonArr, $appInfo);
128
+ }
129
+
130
+ /**
131
+ * Parses a JSON object to build an AppInfo object. If you would like to load this from a file,
132
+ * use the loadFromJsonFile() method.
133
+ *
134
+ * @param array $jsonArr Output from json_decode($str, true)
135
+ *
136
+ * @return AppInfo
137
+ *
138
+ * @throws AppInfoLoadException
139
+ */
140
+ static function loadFromJson($jsonArr)
141
+ {
142
+ if (!is_array($jsonArr)) {
143
+ throw new AppInfoLoadException("Expecting JSON object, got something else");
144
+ }
145
+
146
+ $requiredKeys = array("key", "secret");
147
+ foreach ($requiredKeys as $key) {
148
+ if (!array_key_exists($key, $jsonArr)) {
149
+ throw new AppInfoLoadException("Missing field \"$key\"");
150
+ }
151
+
152
+ if (!is_string($jsonArr[$key])) {
153
+ throw new AppInfoLoadException("Expecting field \"$key\" to be a string");
154
+ }
155
+ }
156
+
157
+ // Check app_key and app_secret
158
+ $appKey = $jsonArr["key"];
159
+ $appSecret = $jsonArr["secret"];
160
+
161
+ $tokenErr = self::getTokenPartError($appKey);
162
+ if (!is_null($tokenErr)) {
163
+ throw new AppInfoLoadException("Field \"key\" doesn't look like a valid app key: $tokenErr");
164
+ }
165
+
166
+ $tokenErr = self::getTokenPartError($appSecret);
167
+ if (!is_null($tokenErr)) {
168
+ throw new AppInfoLoadException("Field \"secret\" doesn't look like a valid app secret: $tokenErr");
169
+ }
170
+
171
+ // Check for the optional 'host' field
172
+ if (!array_key_exists('host', $jsonArr)) {
173
+ $host = null;
174
+ }
175
+ else {
176
+ $baseHost = $jsonArr["host"];
177
+ if (!is_string($baseHost)) {
178
+ throw new AppInfoLoadException("Optional field \"host\" must be a string");
179
+ }
180
+
181
+ $api = "api-$baseHost";
182
+ $content = "api-content-$baseHost";
183
+ $web = "meta-$baseHost";
184
+
185
+ $host = new Host($api, $content, $web);
186
+ }
187
+
188
+ return new AppInfo($appKey, $appSecret, $host);
189
+ }
190
+
191
+ /**
192
+ * Use this to check that a function argument is of type <code>AppInfo</code>
193
+ *
194
+ * @internal
195
+ */
196
+ static function checkArg($argName, $argValue)
197
+ {
198
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
199
+ }
200
+
201
+ /**
202
+ * Use this to check that a function argument is either <code>null</code> or of type
203
+ * <code>AppInfo</code>.
204
+ *
205
+ * @internal
206
+ */
207
+ static function checkArgOrNull($argName, $argValue)
208
+ {
209
+ if ($argValue === null) return;
210
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
211
+ }
212
+
213
+ /** @internal */
214
+ static function getTokenPartError($s)
215
+ {
216
+ if ($s === null) return "can't be null";
217
+ if (strlen($s) === 0) return "can't be empty";
218
+ if (strstr($s, ' ')) return "can't contain a space";
219
+ return null; // 'null' means "no error"
220
+ }
221
+
222
+ /** @internal */
223
+ static function checkKeyArg($key)
224
+ {
225
+ $error = self::getTokenPartError($key);
226
+ if ($error === null) return;
227
+ throw new \InvalidArgumentException("Bad 'key': \"$key\": $error.");
228
+ }
229
+
230
+ /** @internal */
231
+ static function checkSecretArg($secret)
232
+ {
233
+ $error = self::getTokenPartError($secret);
234
+ if ($error === null) return;
235
+ throw new \InvalidArgumentException("Bad 'secret': \"$secret\": $error.");
236
+ }
237
+
238
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AppInfoLoadException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown by the <code>AppInfo::loadXXX</code> methods if something goes wrong.
6
+ */
7
+ final class AppInfoLoadException extends \Exception
8
+ {
9
+ /**
10
+ * @param string $message
11
+ *
12
+ * @internal
13
+ */
14
+ function __construct($message)
15
+ {
16
+ parent::__construct($message);
17
+ }
18
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/ArrayEntryStore.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * A class that gives get/put/clear access to a single entry in an array.
6
+ */
7
+ class ArrayEntryStore implements ValueStore
8
+ {
9
+ /** @var array */
10
+ private $array;
11
+
12
+ /** @var mixed */
13
+ private $key;
14
+
15
+ /**
16
+ * Constructor.
17
+ *
18
+ * @param array $array
19
+ * The array that we'll be accessing.
20
+ *
21
+ * @param mixed $key
22
+ * The key for the array element we'll be accessing.
23
+ */
24
+ function __construct(&$array, $key)
25
+ {
26
+ $this->array = &$array;
27
+ $this->key = $key;
28
+ }
29
+
30
+ /**
31
+ * Returns the entry's current value or <code>null</code> if nothing is set.
32
+ *
33
+ * @return object
34
+ */
35
+ function get()
36
+ {
37
+ if (isset($this->array[$this->key])) {
38
+ return $this->array[$this->key];
39
+ } else {
40
+ return null;
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Set the array entry to the given value.
46
+ *
47
+ * @param object $value
48
+ */
49
+ function set($value)
50
+ {
51
+ $this->array[$this->key] = $value;
52
+ }
53
+
54
+ /**
55
+ * Clear the entry.
56
+ */
57
+ function clear()
58
+ {
59
+ unset($this->array[$this->key]);
60
+ }
61
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AuthBase.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Base class for API authorization-related classes.
6
+ */
7
+ class AuthBase
8
+ {
9
+ /**
10
+ * Whatever AppInfo was passed into the constructor.
11
+ *
12
+ * @return AppInfo
13
+ */
14
+ function getAppInfo() { return $this->appInfo; }
15
+
16
+ /** @var AppInfo */
17
+ protected $appInfo;
18
+
19
+ /**
20
+ * An identifier for the API client, typically of the form "Name/Version".
21
+ * This is used to set the HTTP <code>User-Agent</code> header when making API requests.
22
+ * Example: <code>"PhotoEditServer/1.3"</code>
23
+ *
24
+ * If you're the author a higher-level library on top of the basic SDK, and the
25
+ * "Photo Edit" app's server code is using your library to access Dropbox, you should append
26
+ * your library's name and version to form the full identifier. For example,
27
+ * if your library is called "File Picker", you might set this field to:
28
+ * <code>"PhotoEditServer/1.3 FilePicker/0.1-beta"</code>
29
+ *
30
+ * The exact format of the <code>User-Agent</code> header is described in
31
+ * <a href="http://tools.ietf.org/html/rfc2616#section-3.8">section 3.8 of the HTTP specification</a>.
32
+ *
33
+ * Note that underlying HTTP client may append other things to the <code>User-Agent</code>, such as
34
+ * the name of the library being used to actually make the HTTP request (such as cURL).
35
+ *
36
+ * @return string
37
+ */
38
+ function getClientIdentifier() { return $this->clientIdentifier; }
39
+
40
+ /** @var string */
41
+ protected $clientIdentifier;
42
+
43
+ /**
44
+ * The locale of the user of your application. Some API calls return localized
45
+ * data and error messages; this "user locale" setting determines which locale
46
+ * the server should use to localize those strings.
47
+ *
48
+ * @return null|string
49
+ */
50
+ function getUserLocale() { return $this->userLocale; }
51
+
52
+ /** @var string */
53
+ protected $userLocale;
54
+
55
+ /**
56
+ * Constructor.
57
+ *
58
+ * @param AppInfo $appInfo
59
+ * See {@link getAppInfo()}
60
+ * @param string $clientIdentifier
61
+ * See {@link getClientIdentifier()}
62
+ * @param null|string $userLocale
63
+ * See {@link getUserLocale()}
64
+ */
65
+ function __construct($appInfo, $clientIdentifier, $userLocale = null)
66
+ {
67
+ AppInfo::checkArg("appInfo", $appInfo);
68
+ Client::checkClientIdentifierArg("clientIdentifier", $clientIdentifier);
69
+ Checker::argStringNonEmptyOrNull("userLocale", $userLocale);
70
+
71
+ $this->appInfo = $appInfo;
72
+ $this->clientIdentifier = $clientIdentifier;
73
+ $this->userLocale = $userLocale;
74
+ }
75
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AuthInfo.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * This class contains methods to load an AppInfo and AccessToken from a JSON file.
6
+ * This can help simplify simple scripts (such as the example programs that come with the
7
+ * SDK) but is probably not useful in typical Dropbox API apps.
8
+ *
9
+ */
10
+ final class AuthInfo
11
+ {
12
+ /**
13
+ * Loads a JSON file containing authorization information for your app. 'php authorize.php'
14
+ * in the examples directory for details about what this file should look like.
15
+ *
16
+ * @param string $path
17
+ * Path to a JSON file
18
+ * @return array
19
+ * A <code>list(string $accessToken, Host $host)</code>.
20
+ *
21
+ * @throws AuthInfoLoadException
22
+ */
23
+ static function loadFromJsonFile($path)
24
+ {
25
+ if (!file_exists($path)) {
26
+ throw new AuthInfoLoadException("File doesn't exist: \"$path\"");
27
+ }
28
+
29
+ $str = Util::stripUtf8Bom(file_get_contents($path));
30
+ $jsonArr = json_decode($str, true, 10);
31
+
32
+ if (is_null($jsonArr)) {
33
+ throw new AuthInfoLoadException("JSON parse error: \"$path\"");
34
+ }
35
+
36
+ return self::loadFromJson($jsonArr);
37
+ }
38
+
39
+ /**
40
+ * Parses a JSON object to build an AuthInfo object. If you would like to load this from a file,
41
+ * please use the @see loadFromJsonFile method.
42
+ *
43
+ * @param array $jsonArr
44
+ * A parsed JSON object, typcally the result of json_decode(..., true).
45
+ * @return array
46
+ * A <code>list(string $accessToken, Host $host)</code>.
47
+ *
48
+ * @throws AuthInfoLoadException
49
+ */
50
+ private static function loadFromJson($jsonArr)
51
+ {
52
+ if (!is_array($jsonArr)) {
53
+ throw new AuthInfoLoadException("Expecting JSON object, found something else");
54
+ }
55
+
56
+ // Check access_token
57
+ if (!array_key_exists('access_token', $jsonArr)) {
58
+ throw new AuthInfoLoadException("Missing field \"access_token\"");
59
+ }
60
+
61
+ $accessToken = $jsonArr['access_token'];
62
+ if (!is_string($accessToken)) {
63
+ throw new AuthInfoLoadException("Expecting field \"access_token\" to be a string");
64
+ }
65
+
66
+ // Check for the optional 'host' field
67
+ if (!array_key_exists('host', $jsonArr)) {
68
+ $host = null;
69
+ }
70
+ else {
71
+ $baseHost = $jsonArr["host"];
72
+ if (!is_string($baseHost)) {
73
+ throw new AuthInfoLoadException("Optional field \"host\" must be a string");
74
+ }
75
+
76
+ $api = "api-$baseHost";
77
+ $content = "api-content-$baseHost";
78
+ $web = "meta-$baseHost";
79
+
80
+ $host = new Host($api, $content, $web);
81
+ }
82
+
83
+ return array($accessToken, $host);
84
+ }
85
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/AuthInfoLoadException.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown by the <code>AuthInfo::loadXXX</code> methods if something goes wrong.
6
+ */
7
+ final class AuthInfoLoadException extends \Exception
8
+ {
9
+ /**
10
+ * @param string $message
11
+ *
12
+ * @internal
13
+ */
14
+ function __construct($message)
15
+ {
16
+ parent::__construct($message);
17
+ }
18
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Checker.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Helper functions to validate arguments.
6
+ *
7
+ * @internal
8
+ */
9
+ class Checker
10
+ {
11
+ static function throwError($argName, $argValue, $expectedTypeName)
12
+ {
13
+ if ($argValue === null) throw new \InvalidArgumentException("'$argName' must not be null");
14
+
15
+ if (is_object($argValue)) {
16
+ // Class type.
17
+ $argTypeName = get_class($argValue);
18
+ } else {
19
+ // Built-in type.
20
+ $argTypeName = gettype($argValue);
21
+ }
22
+ throw new \InvalidArgumentException("'$argName' has bad type; expecting $expectedTypeName, got $argTypeName");
23
+ }
24
+
25
+ static function argResource($argName, $argValue)
26
+ {
27
+ if (!is_resource($argValue)) self::throwError($argName, $argValue, "resource");
28
+ }
29
+
30
+ static function argCallable($argName, $argValue)
31
+ {
32
+ if (!is_callable($argValue)) self::throwError($argName, $argValue, "callable");
33
+ }
34
+
35
+ static function argBool($argName, $argValue)
36
+ {
37
+ if (!is_bool($argValue)) self::throwError($argName, $argValue, "boolean");
38
+ }
39
+
40
+ static function argArray($argName, $argValue)
41
+ {
42
+ if (!is_array($argValue)) self::throwError($argName, $argValue, "array");
43
+ }
44
+
45
+ static function argString($argName, $argValue)
46
+ {
47
+ if (!is_string($argValue)) self::throwError($argName, $argValue, "string");
48
+ }
49
+
50
+ static function argStringOrNull($argName, $argValue)
51
+ {
52
+ if ($argValue === null) return;
53
+ if (!is_string($argValue)) self::throwError($argName, $argValue, "string");
54
+ }
55
+
56
+ static function argStringNonEmpty($argName, $argValue)
57
+ {
58
+ if (!is_string($argValue)) self::throwError($argName, $argValue, "string");
59
+ if (strlen($argValue) === 0) throw new \InvalidArgumentException("'$argName' must be non-empty");
60
+ }
61
+
62
+ static function argStringNonEmptyOrNull($argName, $argValue)
63
+ {
64
+ if ($argValue === null) return;
65
+ if (!is_string($argValue)) self::throwError($argName, $argValue, "string");
66
+ if (strlen($argValue) === 0) throw new \InvalidArgumentException("'$argName' must be non-empty");
67
+ }
68
+
69
+ static function argNat($argName, $argValue)
70
+ {
71
+ if (!is_int($argValue)) self::throwError($argName, $argValue, "int");
72
+ if ($argValue < 0) throw new \InvalidArgumentException("'$argName' must be non-negative (you passed in $argValue)");
73
+ }
74
+
75
+ static function argNatOrNull($argName, $argValue)
76
+ {
77
+ if ($argValue === null) return;
78
+ if (!is_int($argValue)) self::throwError($argName, $argValue, "int");
79
+ if ($argValue < 0) throw new \InvalidArgumentException("'$argName' must be non-negative (you passed in $argValue)");
80
+ }
81
+
82
+ static function argIntPositive($argName, $argValue)
83
+ {
84
+ if (!is_int($argValue)) self::throwError($argName, $argValue, "int");
85
+ if ($argValue < 1) throw new \InvalidArgumentException("'$argName' must be positive (you passed in $argValue)");
86
+ }
87
+
88
+ static function argIntPositiveOrNull($argName, $argValue)
89
+ {
90
+ if ($argValue === null) return;
91
+ if (!is_int($argValue)) self::throwError($argName, $argValue, "int");
92
+ if ($argValue < 1) throw new \InvalidArgumentException("'$argName' must be positive (you passed in $argValue)");
93
+ }
94
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Client.php ADDED
@@ -0,0 +1,1509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The class used to make most Dropbox API calls. You can use this once you've gotten an
6
+ * {@link AccessToken} via {@link WebAuth}.
7
+ *
8
+ * This class is stateless so it can be shared/reused.
9
+ */
10
+ class Client
11
+ {
12
+ /**
13
+ * The access token used by this client to make authenticated API calls. You can get an
14
+ * access token via {@link WebAuth}.
15
+ *
16
+ * @return AccessToken
17
+ */
18
+ function getAccessToken() { return $this->accessToken; }
19
+
20
+ /** @var AccessToken */
21
+ private $accessToken;
22
+
23
+ /**
24
+ * An identifier for the API client, typically of the form "Name/Version".
25
+ * This is used to set the HTTP <code>User-Agent</code> header when making API requests.
26
+ * Example: <code>"PhotoEditServer/1.3"</code>
27
+ *
28
+ * If you're the author a higher-level library on top of the basic SDK, and the
29
+ * "Photo Edit" app's server code is using your library to access Dropbox, you should append
30
+ * your library's name and version to form the full identifier. For example,
31
+ * if your library is called "File Picker", you might set this field to:
32
+ * <code>"PhotoEditServer/1.3 FilePicker/0.1-beta"</code>
33
+ *
34
+ * The exact format of the <code>User-Agent</code> header is described in
35
+ * <a href="http://tools.ietf.org/html/rfc2616#section-3.8">section 3.8 of the HTTP specification</a>.
36
+ *
37
+ * Note that underlying HTTP client may append other things to the <code>User-Agent</code>, such as
38
+ * the name of the library being used to actually make the HTTP request (such as cURL).
39
+ *
40
+ * @return string
41
+ */
42
+ function getClientIdentifier() { return $this->clientIdentifier; }
43
+
44
+ /** @var string */
45
+ private $clientIdentifier;
46
+
47
+ /**
48
+ * The locale of the user of your application. Some API calls return localized
49
+ * data and error messages; this "user locale" setting determines which locale
50
+ * the server should use to localize those strings.
51
+ *
52
+ * @return null|string
53
+ */
54
+ function getUserLocale() { return $this->userLocale; }
55
+
56
+ /** @var null|string */
57
+ private $userLocale;
58
+
59
+ /**
60
+ * The {@link Host} object that determines the hostnames we make requests to.
61
+ *
62
+ * @return Host
63
+ */
64
+ function getHost() { return $this->host; }
65
+
66
+ private $delegate;
67
+
68
+ function setDelegate($delegate) { $this->delegate = $delegate; }
69
+
70
+ /**
71
+ * Constructor.
72
+ *
73
+ * @param string $accessToken
74
+ * See {@link getAccessToken()}
75
+ * @param string $clientIdentifier
76
+ * See {@link getClientIdentifier()}
77
+ * @param null|string $userLocale
78
+ * See {@link getUserLocale()}
79
+ */
80
+ function __construct($accessToken, $clientIdentifier, $userLocale = null)
81
+ {
82
+ self::checkAccessTokenArg("accessToken", $accessToken);
83
+ self::checkClientIdentifierArg("clientIdentifier", $clientIdentifier);
84
+ Checker::argStringNonEmptyOrNull("userLocale", $userLocale);
85
+
86
+ $this->accessToken = $accessToken;
87
+ $this->clientIdentifier = $clientIdentifier;
88
+ $this->userLocale = $userLocale;
89
+
90
+ // The $host parameter is sort of internal. We don't include it in the param list because
91
+ // we don't want it to be included in the documentation. Use PHP arg list hacks to get at
92
+ // it.
93
+ $host = null;
94
+ if (\func_num_args() == 4) {
95
+ $host = \func_get_arg(3);
96
+ Host::checkArgOrNull("host", $host);
97
+ }
98
+ if ($host === null) {
99
+ $host = Host::getDefault();
100
+ }
101
+ $this->host = $host;
102
+
103
+ // These fields are redundant, but it makes these values a little more convenient
104
+ // to access.
105
+ $this->apiHost = $host->getApi();
106
+ $this->contentHost = $host->getContent();
107
+ }
108
+
109
+ /** @var string */
110
+ private $apiHost;
111
+ /** @var string */
112
+ private $contentHost;
113
+
114
+ /**
115
+ * Given a <code>$base</code> path for an API endpoint (for example, "/files"), append
116
+ * a Dropbox API file path to the end of that URL. Special characters in the file will
117
+ * be encoded properly.
118
+ *
119
+ * This is for endpoints like "/files" takes the path on the URL and not as a separate
120
+ * query or POST parameter.
121
+ *
122
+ * @param string $base
123
+ * @param string $path
124
+ * @return string
125
+ */
126
+ function appendFilePath($base, $path)
127
+ {
128
+ return $base . "/auto/" . rawurlencode(substr($path, 1));
129
+ }
130
+
131
+ /**
132
+ * Make an API call to disable the access token that you constructed this <code>Client</code>
133
+ * with. After calling this, API calls made with this <code>Client</code> will fail.
134
+ *
135
+ * See <a href="https://www.dropbox.com/developers/core/docs#disable-token">/disable_access_token</a>.
136
+ *
137
+ * @throws Exception
138
+ */
139
+ function disableAccessToken()
140
+ {
141
+ $response = $this->doPost($this->apiHost, "1/disable_access_token");
142
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
143
+ }
144
+
145
+ /**
146
+ * Make an API call to get basic account and quota information.
147
+ *
148
+ * <code>
149
+ * $client = ...
150
+ * $accountInfo = $client->getAccountInfo();
151
+ * print_r($accountInfo);
152
+ * </code>
153
+ *
154
+ * @return array
155
+ * See <a href="https://www.dropbox.com/developers/core/docs#account-info">/account/info</a>.
156
+ *
157
+ * @throws Exception
158
+ */
159
+ function getAccountInfo()
160
+ {
161
+ $response = $this->doGet($this->apiHost, "1/account/info");
162
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
163
+ return RequestUtil::parseResponseJson($response->body);
164
+ }
165
+
166
+ /**
167
+ * Downloads a file from Dropbox. The file's contents are written to the
168
+ * given <code>$outStream</code> and the file's metadata is returned.
169
+ *
170
+ * <code>
171
+ * $client = ...;
172
+ * $fd = fopen("./Frog.jpeg", "wb");
173
+ * $metadata = $client->getFile("/Photos/Frog.jpeg", $fd);
174
+ * fclose($fd);
175
+ * print_r($metadata);
176
+ * </code>
177
+ *
178
+ * @param string $path
179
+ * The path to the file on Dropbox (UTF-8).
180
+ *
181
+ * @param resource $outStream
182
+ * If the file exists, the file contents will be written to this stream.
183
+ *
184
+ * @param string|null $rev
185
+ * If you want the latest revision of the file at the given path, pass in <code>null</code>.
186
+ * If you want a specific version of a file, pass in value of the file metadata's "rev" field.
187
+ *
188
+ * @return null|array
189
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
190
+ * object</a> for the file at the given $path and $rev, or <code>null</code> if the file
191
+ * doesn't exist,
192
+ *
193
+ * @throws Exception
194
+ */
195
+ function getFile($path, $outStream, $rev = null)
196
+ {
197
+ Path::checkArgNonRoot("path", $path);
198
+ Checker::argResource("outStream", $outStream);
199
+ Checker::argStringNonEmptyOrNull("rev", $rev);
200
+
201
+ $url = $this->buildUrlForGetOrPut(
202
+ $this->contentHost,
203
+ $this->appendFilePath("1/files", $path),
204
+ array("rev" => $rev));
205
+
206
+ $curl = $this->mkCurl($url);
207
+ $metadataCatcher = new DropboxMetadataHeaderCatcher($curl->handle);
208
+ $streamRelay = new CurlStreamRelay($curl->handle, $outStream);
209
+
210
+ $response = $curl->exec();
211
+
212
+ if ($response->statusCode === 404) return null;
213
+
214
+ if ($response->statusCode !== 200) {
215
+ $response->body = $streamRelay->getErrorBody();
216
+ throw RequestUtil::unexpectedStatus($response);
217
+ }
218
+
219
+ return $metadataCatcher->getMetadata();
220
+ }
221
+
222
+ /**
223
+ * Calling 'uploadFile' with <code>$numBytes</code> less than this value, will cause this SDK
224
+ * to use the standard /files_put endpoint. When <code>$numBytes</code> is greater than this
225
+ * value, we'll use the /chunked_upload endpoint.
226
+ *
227
+ * @var int
228
+ */
229
+ private static $AUTO_CHUNKED_UPLOAD_THRESHOLD = 9863168; // 8 MB
230
+
231
+ /**
232
+ * @var int
233
+ */
234
+ private static $DEFAULT_CHUNK_SIZE = 4194304; // 4 MB
235
+
236
+ /**
237
+ * Creates a file on Dropbox, using the data from <code>$inStream</code> for the file contents.
238
+ *
239
+ * <code>
240
+ * use \Dropbox as dbx;
241
+ * $client = ...;
242
+ * $fd = fopen("./frog.jpeg", "rb");
243
+ * $md1 = $client->uploadFile("/Photos/Frog.jpeg",
244
+ * dbx\WriteMode::add(), $fd);
245
+ * fclose($fd);
246
+ * print_r($md1);
247
+ * $rev = $md1["rev"];
248
+ *
249
+ * // Re-upload with WriteMode::update(...), which will overwrite the
250
+ * // file if it hasn't been modified from our original upload.
251
+ * $fd = fopen("./frog-new.jpeg", "rb");
252
+ * $md2 = $client->uploadFile("/Photos/Frog.jpeg",
253
+ * dbx\WriteMode::update($rev), $fd);
254
+ * fclose($fd);
255
+ * print_r($md2);
256
+ * </code>
257
+ *
258
+ * @param string $path
259
+ * The Dropbox path to save the file to (UTF-8).
260
+ *
261
+ * @param WriteMode $writeMode
262
+ * What to do if there's already a file at the given path.
263
+ *
264
+ * @param resource $inStream
265
+ * The data to use for the file contents.
266
+ *
267
+ * @param int|null $numBytes
268
+ * You can pass in <code>null</code> if you don't know. If you do provide the size, we can
269
+ * perform a slightly more efficient upload (fewer network round-trips) for files smaller
270
+ * than 8 MB.
271
+ *
272
+ * @return mixed
273
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details>metadata
274
+ * object</a> for the newly-added file.
275
+ *
276
+ * @throws Exception
277
+ */
278
+ function uploadFile($path, $writeMode, $inStream, $numBytes = null)
279
+ {
280
+ Path::checkArgNonRoot("path", $path);
281
+ WriteMode::checkArg("writeMode", $writeMode);
282
+ Checker::argResource("inStream", $inStream);
283
+ Checker::argNatOrNull("numBytes", $numBytes);
284
+
285
+ // If we don't know how many bytes are coming, we have to use chunked upload.
286
+ // If $numBytes is large, we elect to use chunked upload.
287
+ // In all other cases, use regular upload.
288
+ if ($numBytes === null || $numBytes > self::$AUTO_CHUNKED_UPLOAD_THRESHOLD) {
289
+ $metadata = $this->_uploadFileChunked($path, $writeMode, $inStream, $numBytes,
290
+ self::$DEFAULT_CHUNK_SIZE);
291
+ } else {
292
+ $metadata = $this->_uploadFile($path, $writeMode,
293
+ function(Curl $curl) use ($inStream, $numBytes) {
294
+ $curl->set(CURLOPT_PUT, true);
295
+ $curl->set(CURLOPT_INFILE, $inStream);
296
+ $curl->set(CURLOPT_INFILESIZE, $numBytes);
297
+ });
298
+ }
299
+
300
+ return $metadata;
301
+ }
302
+
303
+ /**
304
+ * Creates a file on Dropbox, using the given $data string as the file contents.
305
+ *
306
+ * <code>
307
+ * use \Dropbox as dbx;
308
+ * $client = ...;
309
+ * $md = $client->uploadFileFromString("/Grocery List.txt",
310
+ * dbx\WriteMode::add(),
311
+ * "1. Coke\n2. Popcorn\n3. Toothpaste\n");
312
+ * print_r($md);
313
+ * </code>
314
+ *
315
+ * @param string $path
316
+ * The Dropbox path to save the file to (UTF-8).
317
+ *
318
+ * @param WriteMode $writeMode
319
+ * What to do if there's already a file at the given path.
320
+ *
321
+ * @param string $data
322
+ * The data to use for the contents of the file.
323
+ *
324
+ * @return mixed
325
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details>metadata
326
+ * object</a> for the newly-added file.
327
+ *
328
+ * @throws Exception
329
+ */
330
+ function uploadFileFromString($path, $writeMode, $data)
331
+ {
332
+ Path::checkArgNonRoot("path", $path);
333
+ WriteMode::checkArg("writeMode", $writeMode);
334
+ Checker::argString("data", $data);
335
+
336
+ return $this->_uploadFile($path, $writeMode, function(Curl $curl) use ($data) {
337
+ $curl->set(CURLOPT_CUSTOMREQUEST, "PUT");
338
+ $curl->set(CURLOPT_POSTFIELDS, $data);
339
+ $curl->addHeader("Content-Type: application/octet-stream");
340
+ });
341
+ }
342
+
343
+ /**
344
+ * Creates a file on Dropbox, using the data from $inStream as the file contents.
345
+ *
346
+ * This version of <code>uploadFile</code> splits uploads the file ~4MB chunks at a time and
347
+ * will retry a few times if one chunk fails to upload. Uses {@link chunkedUploadStart()},
348
+ * {@link chunkedUploadContinue()}, and {@link chunkedUploadFinish()}.
349
+ *
350
+ * @param string $path
351
+ * The Dropbox path to save the file to (UTF-8).
352
+ *
353
+ * @param WriteMode $writeMode
354
+ * What to do if there's already a file at the given path.
355
+ *
356
+ * @param resource $inStream
357
+ * The data to use for the file contents.
358
+ *
359
+ * @param int|null $numBytes
360
+ * The number of bytes available from $inStream.
361
+ * You can pass in <code>null</code> if you don't know.
362
+ *
363
+ * @param int|null $chunkSize
364
+ * The number of bytes to upload in each chunk. You can omit this (or pass in
365
+ * <code>null</code> and the library will use a reasonable default.
366
+ *
367
+ * @return mixed
368
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details>metadata
369
+ * object</a> for the newly-added file.
370
+ *
371
+ * @throws Exception
372
+ */
373
+ function uploadFileChunked($path, $writeMode, $inStream, $numBytes = null, $chunkSize = null)
374
+ {
375
+ if ($chunkSize === null) {
376
+ $chunkSize = self::$DEFAULT_CHUNK_SIZE;
377
+ }
378
+
379
+ Path::checkArgNonRoot("path", $path);
380
+ WriteMode::checkArg("writeMode", $writeMode);
381
+ Checker::argResource("inStream", $inStream);
382
+ Checker::argNatOrNull("numBytes", $numBytes);
383
+ Checker::argIntPositive("chunkSize", $chunkSize);
384
+
385
+ return $this->_uploadFileChunked($path, $writeMode, $inStream, $numBytes, $chunkSize);
386
+ }
387
+
388
+ /**
389
+ * @param string $path
390
+ *
391
+ * @param WriteMode $writeMode
392
+ * What to do if there's already a file at the given path (UTF-8).
393
+ *
394
+ * @param resource $inStream
395
+ * The source of data to upload.
396
+ *
397
+ * @param int|null $numBytes
398
+ * You can pass in <code>null</code>. But if you know how many bytes you expect, pass in
399
+ * that value and this function will do a sanity check at the end to make sure the number of
400
+ * bytes read from $inStream matches up.
401
+ *
402
+ * @param int $chunkSize
403
+ *
404
+ * @return array
405
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details>metadata
406
+ * object</a> for the newly-added file.
407
+ */
408
+ private function _uploadFileChunked($path, $writeMode, $inStream, $numBytes, $chunkSize)
409
+ {
410
+ Path::checkArg("path", $path);
411
+ WriteMode::checkArg("writeMode", $writeMode);
412
+ Checker::argResource("inStream", $inStream);
413
+ Checker::argNatOrNull("numBytes", $numBytes);
414
+ Checker::argNat("chunkSize", $chunkSize);
415
+
416
+ // NOTE: This function performs 3 retries on every call. This is maybe not the right
417
+ // layer to make retry decisions. It's also awkward because none of the other calls
418
+ // perform retries.
419
+
420
+ assert($chunkSize > 0);
421
+
422
+ $data = self::readFully($inStream, $chunkSize);
423
+ $len = strlen($data);
424
+
425
+ $client = $this;
426
+ $uploadId = RequestUtil::runWithRetry(3, function() use ($data, $client) {
427
+ return $client->chunkedUploadStart($data);
428
+ });
429
+
430
+ if ($this->delegate && !$this->delegate->shouldUploadNextChunk())
431
+ {
432
+ return;
433
+ }
434
+
435
+ $byteOffset = $len;
436
+
437
+ while (!feof($inStream)) {
438
+ $data = self::readFully($inStream, $chunkSize);
439
+ $len = strlen($data);
440
+
441
+ while (true) {
442
+ $r = RequestUtil::runWithRetry(3,
443
+ function() use ($client, $uploadId, $byteOffset, $data) {
444
+ return $client->chunkedUploadContinue($uploadId, $byteOffset, $data);
445
+ });
446
+
447
+ if ($r === true) { // Chunk got uploaded!
448
+ $byteOffset += $len;
449
+ break;
450
+ }
451
+ if ($r === false) { // Server didn't recognize our upload ID
452
+ // This is very unlikely since we're uploading all the chunks in sequence.
453
+ throw new Exception_BadResponse("Server forgot our uploadId");
454
+ }
455
+
456
+ // Otherwise, the server is at a different byte offset from us.
457
+ $serverByteOffset = $r;
458
+ assert($serverByteOffset !== $byteOffset); // chunkedUploadContinue ensures this.
459
+ // An earlier byte offset means the server has lost data we sent earlier.
460
+ if ($serverByteOffset < $byteOffset) throw new Exception_BadResponse(
461
+ "Server is at an ealier byte offset: us=$byteOffset, server=$serverByteOffset");
462
+ $diff = $serverByteOffset - $byteOffset;
463
+ // If the server is past where we think it could possibly be, something went wrong.
464
+ if ($diff > $len) throw new Exception_BadResponse(
465
+ "Server is more than a chunk ahead: us=$byteOffset, server=$serverByteOffset");
466
+ // The normal case is that the server is a bit further along than us because of a
467
+ // partially-uploaded chunk. Finish it off.
468
+ $byteOffset += $diff;
469
+ if ($diff === $len) break; // If the server is at the end, we're done.
470
+ $data = substr($data, $diff);
471
+ }
472
+
473
+ if ($this->delegate && !$this->delegate->shouldUploadNextChunk())
474
+ {
475
+ break;
476
+ }
477
+ }
478
+
479
+ if ($numBytes !== null && $byteOffset !== $numBytes) throw new \InvalidArgumentException(
480
+ "You passed numBytes=$numBytes but the stream had $byteOffset bytes.");
481
+
482
+ $metadata = RequestUtil::runWithRetry(3,
483
+ function() use ($client, $uploadId, $path, $writeMode) {
484
+ return $client->chunkedUploadFinish($uploadId, $path, $writeMode);
485
+ });
486
+
487
+ return $metadata;
488
+ }
489
+
490
+ /**
491
+ * Sometimes fread() returns less than the request number of bytes (for example, when reading
492
+ * from network streams). This function repeatedly calls fread until the requested number of
493
+ * bytes have been read or we've reached EOF.
494
+ *
495
+ * @param resource $inStream
496
+ * @param int $numBytes
497
+ * @throws StreamReadException
498
+ * @return string
499
+ */
500
+ private static function readFully($inStream, $numBytes)
501
+ {
502
+ Checker::argNat("numBytes", $numBytes);
503
+
504
+ $full = '';
505
+ $bytesRemaining = $numBytes;
506
+ while (!feof($inStream) && $bytesRemaining > 0) {
507
+ $part = fread($inStream, $bytesRemaining);
508
+ if ($part === false) throw new StreamReadException("Error reading from \$inStream.");
509
+ $full .= $part;
510
+ $bytesRemaining -= strlen($part);
511
+ }
512
+ return $full;
513
+ }
514
+
515
+ /**
516
+ * @param string $path
517
+ * @param WriteMode $writeMode
518
+ * @param callable $curlConfigClosure
519
+ * @return array
520
+ */
521
+ private function _uploadFile($path, $writeMode, $curlConfigClosure)
522
+ {
523
+ Path::checkArg("path", $path);
524
+ WriteMode::checkArg("writeMode", $writeMode);
525
+ Checker::argCallable("curlConfigClosure", $curlConfigClosure);
526
+
527
+ $url = $this->buildUrlForGetOrPut(
528
+ $this->contentHost,
529
+ $this->appendFilePath("1/files_put", $path),
530
+ $writeMode->getExtraParams());
531
+
532
+ $curl = $this->mkCurl($url);
533
+
534
+ $curlConfigClosure($curl);
535
+
536
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
537
+ $response = $curl->exec();
538
+
539
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
540
+
541
+ return RequestUtil::parseResponseJson($response->body);
542
+ }
543
+
544
+ /**
545
+ * Start a new chunked upload session and upload the first chunk of data.
546
+ *
547
+ * @param string $data
548
+ * The data to start off the chunked upload session.
549
+ *
550
+ * @return array
551
+ * A pair of <code>(string $uploadId, int $byteOffset)</code>. <code>$uploadId</code>
552
+ * is a unique identifier for this chunked upload session. You pass this in to
553
+ * {@link chunkedUploadContinue} and {@link chuunkedUploadFinish}. <code>$byteOffset</code>
554
+ * is the number of bytes that were successfully uploaded.
555
+ *
556
+ * @throws Exception
557
+ */
558
+ function chunkedUploadStart($data)
559
+ {
560
+ Checker::argString("data", $data);
561
+
562
+ $response = $this->_chunkedUpload(array(), $data);
563
+
564
+ if ($response->statusCode === 404) {
565
+ throw new Exception_BadResponse("Got a 404, but we didn't send up an 'upload_id'");
566
+ }
567
+
568
+ $correction = self::_chunkedUploadCheckForOffsetCorrection($response);
569
+ if ($correction !== null) throw new Exception_BadResponse(
570
+ "Got an offset-correcting 400 response, but we didn't send an offset");
571
+
572
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
573
+
574
+ list($uploadId, $byteOffset) = self::_chunkedUploadParse200Response($response->body);
575
+ $len = strlen($data);
576
+ if ($byteOffset !== $len) throw new Exception_BadResponse(
577
+ "We sent $len bytes, but server returned an offset of $byteOffset");
578
+
579
+ return $uploadId;
580
+ }
581
+
582
+ /**
583
+ * Append another chunk data to a previously-started chunked upload session.
584
+ *
585
+ * @param string $uploadId
586
+ * The unique identifier for the chunked upload session. This is obtained via
587
+ * {@link chunkedUploadStart}.
588
+ *
589
+ * @param int $byteOffset
590
+ * The number of bytes you think you've already uploaded to the given chunked upload
591
+ * session. The server will append the new chunk of data after that point.
592
+ *
593
+ * @param string $data
594
+ * The data to append to the existing chunked upload session.
595
+ *
596
+ * @return int|bool
597
+ * If <code>false</code>, it means the server didn't know about the given
598
+ * <code>$uploadId</code>. This may be because the chunked upload session has expired
599
+ * (they last around 24 hours).
600
+ * If <code>true</code>, the chunk was successfully uploaded. If an integer, it means
601
+ * you and the server don't agree on the current <code>$byteOffset</code>. The returned
602
+ * integer is the server's internal byte offset for the chunked upload session. You need
603
+ * to adjust your input to match.
604
+ *
605
+ * @throws Exception
606
+ */
607
+ function chunkedUploadContinue($uploadId, $byteOffset, $data)
608
+ {
609
+ Checker::argStringNonEmpty("uploadId", $uploadId);
610
+ Checker::argNat("byteOffset", $byteOffset);
611
+ Checker::argString("data", $data);
612
+
613
+ $response = $this->_chunkedUpload(
614
+ array("upload_id" => $uploadId, "offset" => $byteOffset), $data);
615
+
616
+ if ($response->statusCode === 404) {
617
+ // The server doesn't know our upload ID. Maybe it expired?
618
+ return false;
619
+ }
620
+
621
+ $correction = self::_chunkedUploadCheckForOffsetCorrection($response);
622
+ if ($correction !== null) {
623
+ list($correctedUploadId, $correctedByteOffset) = $correction;
624
+ if ($correctedUploadId !== $uploadId) throw new Exception_BadResponse(
625
+ "Corrective 400 upload_id mismatch: us=".
626
+ Util::q($uploadId)." server=".Util::q($correctedUploadId));
627
+ if ($correctedByteOffset === $byteOffset) throw new Exception_BadResponse(
628
+ "Corrective 400 offset is the same as ours: $byteOffset");
629
+ return $correctedByteOffset;
630
+ }
631
+
632
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
633
+ list($retUploadId, $retByteOffset) = self::_chunkedUploadParse200Response($response->body);
634
+
635
+ $nextByteOffset = $byteOffset + strlen($data);
636
+ if ($uploadId !== $retUploadId) throw new Exception_BadResponse(
637
+ "upload_id mismatch: us=".Util::q($uploadId) .", server=".Util::q($uploadId));
638
+ if ($nextByteOffset !== $retByteOffset) throw new Exception_BadResponse(
639
+ "next-offset mismatch: us=$nextByteOffset, server=$retByteOffset");
640
+
641
+ return true;
642
+ }
643
+
644
+ /**
645
+ * @param string $body
646
+ * @return array
647
+ */
648
+ private static function _chunkedUploadParse200Response($body)
649
+ {
650
+ $j = RequestUtil::parseResponseJson($body);
651
+ $uploadId = self::getField($j, "upload_id");
652
+ $byteOffset = self::getField($j, "offset");
653
+ return array($uploadId, $byteOffset);
654
+ }
655
+
656
+ /**
657
+ * @param HttpResponse $response
658
+ * @return array|null
659
+ */
660
+ private static function _chunkedUploadCheckForOffsetCorrection($response)
661
+ {
662
+ if ($response->statusCode !== 400) return null;
663
+ $j = json_decode($response->body, true, 10);
664
+ if ($j === null) return null;
665
+ if (!array_key_exists("upload_id", $j) || !array_key_exists("offset", $j)) return null;
666
+ $uploadId = $j["upload_id"];
667
+ $byteOffset = $j["offset"];
668
+ return array($uploadId, $byteOffset);
669
+ }
670
+
671
+ /**
672
+ * Creates a file on Dropbox using the accumulated contents of the given chunked upload session.
673
+ *
674
+ * See <a href="https://www.dropbox.com/developers/core/docs#commit-chunked-upload">/commit_chunked_upload</a>.
675
+ *
676
+ * @param string $uploadId
677
+ * The unique identifier for the chunked upload session. This is obtained via
678
+ * {@link chunkedUploadStart}.
679
+ *
680
+ * @param string $path
681
+ * The Dropbox path to save the file to ($path).
682
+ *
683
+ * @param WriteMode $writeMode
684
+ * What to do if there's already a file at the given path.
685
+ *
686
+ * @return array|null
687
+ * If <code>null</code>, it means the Dropbox server wasn't aware of the
688
+ * <code>$uploadId</code> you gave it.
689
+ * Otherwise, you get back the
690
+ * <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
691
+ * for the newly-created file.
692
+ *
693
+ * @throws Exception
694
+ */
695
+ function chunkedUploadFinish($uploadId, $path, $writeMode)
696
+ {
697
+ Checker::argStringNonEmpty("uploadId", $uploadId);
698
+ Path::checkArgNonRoot("path", $path);
699
+ WriteMode::checkArg("writeMode", $writeMode);
700
+
701
+ $params = array_merge(array("upload_id" => $uploadId), $writeMode->getExtraParams());
702
+
703
+ $response = $this->doPost(
704
+ $this->contentHost,
705
+ $this->appendFilePath("1/commit_chunked_upload", $path),
706
+ $params);
707
+
708
+ if ($response->statusCode === 404) return null;
709
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
710
+
711
+ return RequestUtil::parseResponseJson($response->body);
712
+ }
713
+
714
+ /**
715
+ * @param array $params
716
+ * @param string $data
717
+ * @return HttpResponse
718
+ */
719
+ protected function _chunkedUpload($params, $data)
720
+ // Marked 'protected' so I can override it in testing.
721
+ {
722
+ $url = $this->buildUrlForGetOrPut(
723
+ $this->contentHost, "1/chunked_upload", $params);
724
+
725
+ $curl = $this->mkCurl($url);
726
+
727
+ // We can't use CURLOPT_PUT because it wants a stream, but we already have $data in memory.
728
+ $curl->set(CURLOPT_CUSTOMREQUEST, "PUT");
729
+ $curl->set(CURLOPT_POSTFIELDS, $data);
730
+ $curl->addHeader("Content-Type: application/octet-stream");
731
+
732
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
733
+ return $curl->exec();
734
+ }
735
+
736
+ /**
737
+ * Returns the metadata for whatever file or folder is at the given path.
738
+ *
739
+ * <code>
740
+ * $client = ...;
741
+ * $md = $client->getMetadata("/Photos/Frog.jpeg");
742
+ * print_r($md);
743
+ * </code>
744
+ *
745
+ * @param string $path
746
+ * The Dropbox path to a file or folder (UTF-8).
747
+ *
748
+ * @return array|null
749
+ * If there is a file or folder at the given path, you'll get back the
750
+ * <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
751
+ * for that file or folder. If not, you'll get back <code>null</code>.
752
+ *
753
+ * @throws Exception
754
+ */
755
+ function getMetadata($path)
756
+ {
757
+ Path::checkArg("path", $path);
758
+
759
+ return $this->_getMetadata($path, array("list" => "false"));
760
+ }
761
+
762
+ /**
763
+ * Returns the metadata for whatever file or folder is at the given path and, if it's a folder,
764
+ * also include the metadata for all the immediate children of that folder.
765
+ *
766
+ * <code>
767
+ * $client = ...;
768
+ * $md = $client->getMetadataWithChildren("/Photos");
769
+ * print_r($md);
770
+ * </code>
771
+ *
772
+ * @param string $path
773
+ * The Dropbox path to a file or folder (UTF-8).
774
+ *
775
+ * @return array|null
776
+ * If there is a file or folder at the given path, you'll get back the
777
+ * <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
778
+ * for that file or folder, along with all immediate children if it's a folder. If not,
779
+ * you'll get back <code>null</code>.
780
+ *
781
+ * @throws Exception
782
+ */
783
+ function getMetadataWithChildren($path)
784
+ {
785
+ Path::checkArg("path", $path);
786
+
787
+ return $this->_getMetadata($path, array("list" => "true", "file_limit" => "25000"));
788
+ }
789
+
790
+ /**
791
+ * @param string $path
792
+ * @param array $params
793
+ * @return array
794
+ */
795
+ private function _getMetadata($path, $params)
796
+ {
797
+ $response = $this->doGet(
798
+ $this->apiHost,
799
+ $this->appendFilePath("1/metadata", $path),
800
+ $params);
801
+
802
+ if ($response->statusCode === 404) return null;
803
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
804
+
805
+ $metadata = RequestUtil::parseResponseJson($response->body);
806
+ if (array_key_exists("is_deleted", $metadata) && $metadata["is_deleted"]) return null;
807
+ return $metadata;
808
+ }
809
+
810
+ /**
811
+ * If you've previously retrieved the metadata for a folder and its children, this method will
812
+ * retrieve updated metadata only if something has changed. This is more efficient than
813
+ * calling {@link getMetadataWithChildren} if you have a cache of previous results.
814
+ *
815
+ * <code>
816
+ * $client = ...;
817
+ * $md = $client->getMetadataWithChildren("/Photos");
818
+ * print_r($md);
819
+ * assert($md["is_dir"], "expecting \"/Photos\" to be a folder");
820
+ *
821
+ * sleep(10);
822
+ *
823
+ * // Now see if anything changed...
824
+ * list($changed, $new_md) = $client->getMetadataWithChildrenIfChanged(
825
+ * "/Photos", $md["hash"]);
826
+ * if ($changed) {
827
+ * echo "Folder changed.\n";
828
+ * print_r($new_md);
829
+ * } else {
830
+ * echo "Folder didn't change.\n";
831
+ * }
832
+ * </code>
833
+ *
834
+ * @param string $path
835
+ * The Dropbox path to a folder (UTF-8).
836
+ *
837
+ * @param string $previousFolderHash
838
+ * The "hash" field from the previously retrieved folder metadata.
839
+ *
840
+ * @return array
841
+ * A <code>list(boolean $changed, array $metadata)</code>. If the metadata hasn't changed,
842
+ * you'll get <code>list(false, null)</code>. If the metadata of the folder or any of its
843
+ * children has changed, you'll get <code>list(true, $newMetadata)</code>. $metadata is a
844
+ * <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>.
845
+ *
846
+ * @throws Exception
847
+ */
848
+ function getMetadataWithChildrenIfChanged($path, $previousFolderHash)
849
+ {
850
+ Path::checkArg("path", $path);
851
+ Checker::argStringNonEmpty("previousFolderHash", $previousFolderHash);
852
+
853
+ $params = array("list" => "true", "file_limit" => "25000", "hash" => $previousFolderHash);
854
+
855
+ $response = $this->doGet(
856
+ $this->apiHost,
857
+ $this->appendFilePath("1/metadata", $path),
858
+ $params);
859
+
860
+ if ($response->statusCode === 304) return array(false, null);
861
+ if ($response->statusCode === 404) return array(true, null);
862
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
863
+
864
+ $metadata = RequestUtil::parseResponseJson($response->body);
865
+ if (array_key_exists("is_deleted", $metadata) && $metadata["is_deleted"]) {
866
+ return array(true, null);
867
+ }
868
+ return array(true, $metadata);
869
+ }
870
+
871
+ /**
872
+ * A way of letting you keep up with changes to files and folders in a user's Dropbox.
873
+ *
874
+ * @param string|null $cursor
875
+ * If this is the first time you're calling this, pass in <code>null</code>. Otherwise,
876
+ * pass in whatever cursor was returned by the previous call.
877
+ *
878
+ * @param string|null $pathPrefix
879
+ * If <code>null</code>, you'll get results for the entire folder (either the user's
880
+ * entire Dropbox or your App Folder). If you set <code>$path_prefix</code> to
881
+ * "/Photos/Vacation", you'll only get results for that path and any files and folders
882
+ * under it.
883
+ *
884
+ * @return array
885
+ * A <a href="https://www.dropbox.com/developers/core/docs#delta">delta page</a>, which
886
+ * contains a list of changes to apply along with a new "cursor" that should be passed into
887
+ * future <code>getDelta</code> calls. If the "reset" field is <code>true</code>, you
888
+ * should clear your local state before applying the changes. If the "has_more" field is
889
+ * <code>true</code>, call <code>getDelta</code> immediately to get more results, otherwise
890
+ * wait a while (at least 5 minutes) before calling <code>getDelta</code> again.
891
+ *
892
+ * @throws Exception
893
+ */
894
+ function getDelta($cursor = null, $pathPrefix = null)
895
+ {
896
+ Checker::argStringNonEmptyOrNull("cursor", $cursor);
897
+ Path::checkArgOrNull("pathPrefix", $pathPrefix);
898
+
899
+ $response = $this->doPost($this->apiHost, "1/delta", array(
900
+ "cursor" => $cursor,
901
+ "path_prefix" => $pathPrefix));
902
+
903
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
904
+
905
+ return RequestUtil::parseResponseJson($response->body);
906
+ }
907
+
908
+ /**
909
+ * Gets the metadata for all the file revisions (up to a limit) for a given path.
910
+ *
911
+ * See <a href="https://www.dropbox.com/developers/core/docs#revisions">/revisions</a>.
912
+ *
913
+ * @param string path
914
+ * The Dropbox path that you want file revision metadata for (UTF-8).
915
+ *
916
+ * @param int|null limit
917
+ * The maximum number of revisions to return.
918
+ *
919
+ * @return array|null
920
+ * A list of <a href="https://www.dropbox.com/developers/core/docs#metadata-details>metadata
921
+ * objects</a>, one for each file revision. The later revisions appear first in the list.
922
+ * If <code>null</code>, then there were too many revisions at that path.
923
+ *
924
+ * @throws Exception
925
+ */
926
+ function getRevisions($path, $limit = null)
927
+ {
928
+ Path::checkArgNonRoot("path", $path);
929
+ Checker::argIntPositiveOrNull("limit", $limit);
930
+
931
+ $response = $this->doGet(
932
+ $this->apiHost,
933
+ $this->appendFilePath("1/revisions", $path),
934
+ array("rev_limit" => $limit));
935
+
936
+ if ($response->statusCode === 406) return null;
937
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
938
+
939
+ return RequestUtil::parseResponseJson($response->body);
940
+ }
941
+
942
+ /**
943
+ * Takes a copy of the file at the given revision and saves it over the current copy. This
944
+ * will create a new revision, but the file contents will match the revision you specified.
945
+ *
946
+ * See <a href="https://www.dropbox.com/developers/core/docs#restore">/restore</a>.
947
+ *
948
+ * @param string $path
949
+ * The Dropbox path of the file to restore (UTF-8).
950
+ *
951
+ * @param string $rev
952
+ * The revision to restore the contents to.
953
+ *
954
+ * @return mixed
955
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
956
+ * object</a>
957
+ *
958
+ * @throws Exception
959
+ */
960
+ function restoreFile($path, $rev)
961
+ {
962
+ Path::checkArgNonRoot("path", $path);
963
+ Checker::argStringNonEmpty("rev", $rev);
964
+
965
+ $response = $this->doPost(
966
+ $this->apiHost,
967
+ $this->appendFilePath("1/restore", $path),
968
+ array("rev" => $rev));
969
+
970
+ if ($response->statusCode === 404) return null;
971
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
972
+
973
+ return RequestUtil::parseResponseJson($response->body);
974
+ }
975
+
976
+ /**
977
+ * Returns metadata for all files and folders whose filename matches the query string.
978
+ *
979
+ * See <a href="https://www.dropbox.com/developers/core/docs#search">/search</a>.
980
+ *
981
+ * @param string $basePath
982
+ * The path to limit the search to (UTF-8). Pass in "/" to search everything.
983
+ *
984
+ * @param string $query
985
+ * A space-separated list of substrings to search for. A file matches only if it contains
986
+ * all the substrings.
987
+ *
988
+ * @param int|null $limit
989
+ * The maximum number of results to return.
990
+ *
991
+ * @param bool $includeDeleted
992
+ * Whether to include deleted files in the results.
993
+ *
994
+ * @return mixed
995
+ * A list of <a href="https://www.dropbox.com/developers/core/docs#metadata-details>metadata
996
+ * objects</a> of files that match the search query.
997
+ *
998
+ * @throws Exception
999
+ */
1000
+ function searchFileNames($basePath, $query, $limit = null, $includeDeleted = false)
1001
+ {
1002
+ Path::checkArg("basePath", $basePath);
1003
+ Checker::argStringNonEmpty("query", $query);
1004
+ Checker::argNatOrNull("limit", $limit);
1005
+ Checker::argBool("includeDeleted", $includeDeleted);
1006
+
1007
+ $response = $this->doPost(
1008
+ $this->apiHost,
1009
+ $this->appendFilePath("1/search", $basePath),
1010
+ array(
1011
+ "query" => $query,
1012
+ "file_limit" => $limit,
1013
+ "include_deleted" => $includeDeleted,
1014
+ ));
1015
+
1016
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1017
+
1018
+ return RequestUtil::parseResponseJson($response->body);
1019
+ }
1020
+
1021
+ /**
1022
+ * Creates and returns a public link to a file or folder's "preview page". This link can be
1023
+ * used without authentication. The preview page may contain a thumbnail or some other
1024
+ * preview of the file, along with a download link to download the actual file.
1025
+ *
1026
+ * See <a href="https://www.dropbox.com/developers/core/docs#shares">/shares</a>.
1027
+ *
1028
+ * @param string $path
1029
+ * The Dropbox path to the file or folder you want to create a shareable link to (UTF-8).
1030
+ *
1031
+ * @return string
1032
+ * The URL of the preview page.
1033
+ *
1034
+ * @throws Exception
1035
+ */
1036
+ function createShareableLink($path)
1037
+ {
1038
+ Path::checkArg("path", $path);
1039
+
1040
+ $response = $this->doPost(
1041
+ $this->apiHost,
1042
+ $this->appendFilePath("1/shares", $path),
1043
+ array(
1044
+ "short_url" => "false",
1045
+ ));
1046
+
1047
+ if ($response->statusCode === 404) return null;
1048
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1049
+
1050
+ $j = RequestUtil::parseResponseJson($response->body);
1051
+ return self::getField($j, "url");
1052
+ }
1053
+
1054
+ /**
1055
+ * Creates and returns a direct link to a file. This link can be used without authentication.
1056
+ * This link will expire in a few hours.
1057
+ *
1058
+ * See <a href="https://www.dropbox.com/developers/core/docs#media">/media</a>.
1059
+ *
1060
+ * @param string $path
1061
+ * The Dropbox path to a file or folder (UTF-8).
1062
+ *
1063
+ * @return array
1064
+ * A <code>list(string $url, \DateTime $expires)</code> where <code>$url</code> is a direct
1065
+ * link to the requested file and <code>$expires</code> is a standard PHP
1066
+ * <code>\DateTime</code> representing when <code>$url</code> will stop working.
1067
+ *
1068
+ * @throws Exception
1069
+ */
1070
+ function createTemporaryDirectLink($path)
1071
+ {
1072
+ Path::checkArgNonRoot("path", $path);
1073
+
1074
+ $response = $this->doPost(
1075
+ $this->apiHost,
1076
+ $this->appendFilePath("1/media", $path));
1077
+
1078
+ if ($response->statusCode === 404) return null;
1079
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1080
+
1081
+ $j = RequestUtil::parseResponseJson($response->body);
1082
+ $url = self::getField($j, "url");
1083
+ $expires = self::parseDateTime(self::getField($j, "expires"));
1084
+ return array($url, $expires);
1085
+ }
1086
+
1087
+ /**
1088
+ * Creates and returns a "copy ref" to a file. A copy ref can be used to copy a file across
1089
+ * different Dropbox accounts without downloading and re-uploading.
1090
+ *
1091
+ * For example: Create a <code>Client</code> using the access token from one account and call
1092
+ * <code>createCopyRef</code>. Then, create a <code>Client</code> using the access token for
1093
+ * another account and call <code>copyFromCopyRef</code> using the copy ref. (You need to use
1094
+ * the same app key both times.)
1095
+ *
1096
+ * See <a href="https://www.dropbox.com/developers/core/docs#copy_ref">/copy_ref</a>.
1097
+ *
1098
+ * @param string path
1099
+ * The Dropbox path of the file or folder you want to create a copy ref for (UTF-8).
1100
+ *
1101
+ * @return string
1102
+ * The copy ref (just a string that you keep track of).
1103
+ *
1104
+ * @throws Exception
1105
+ */
1106
+ function createCopyRef($path)
1107
+ {
1108
+ Path::checkArg("path", $path);
1109
+
1110
+ $response = $this->doGet(
1111
+ $this->apiHost,
1112
+ $this->appendFilePath("1/copy_ref", $path));
1113
+
1114
+ if ($response->statusCode === 404) return null;
1115
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1116
+
1117
+ $j = RequestUtil::parseResponseJson($response->body);
1118
+ return self::getField($j, "copy_ref");
1119
+ }
1120
+
1121
+ /**
1122
+ * Gets a thumbnail image representation of the file at the given path.
1123
+ *
1124
+ * See <a href="https://www.dropbox.com/developers/core/docs#thumbnails">/thumbnails</a>.
1125
+ *
1126
+ * @param string $path
1127
+ * The path to the file you want a thumbnail for (UTF-8).
1128
+ *
1129
+ * @param string $format
1130
+ * One of the two image formats: "jpeg" or "png".
1131
+ *
1132
+ * @param string $size
1133
+ * One of the predefined image size names, as a string:
1134
+ * <ul>
1135
+ * <li>"xs" - 32x32</li>
1136
+ * <li>"s" - 64x64</li>
1137
+ * <li>"m" - 128x128</li>
1138
+ * <li>"l" - 640x480</li>
1139
+ * <li>"xl" - 1024x768</li>
1140
+ * </ul>
1141
+ *
1142
+ * @return array|null
1143
+ * If the file exists, you'll get <code>list(array $metadata, string $data)</code> where
1144
+ * <code>$metadata</code> is the file's
1145
+ * <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
1146
+ * and $data is the raw data for the thumbnail image. If the file doesn't exist, you'll
1147
+ * get <code>null</code>.
1148
+ *
1149
+ * @throws Exception
1150
+ */
1151
+ function getThumbnail($path, $format, $size)
1152
+ {
1153
+ Path::checkArgNonRoot("path", $path);
1154
+ Checker::argString("format", $format);
1155
+ Checker::argString("size", $size);
1156
+ if (!in_array($format, array("jpeg", "png"))) {
1157
+ throw new \InvalidArgumentException("Invalid 'format': ".Util::q($format));
1158
+ }
1159
+ if (!in_array($size, array("xs", "s", "m", "l", "xl"))) {
1160
+ throw new \InvalidArgumentException("Invalid 'size': ".Util::q($format));
1161
+ }
1162
+
1163
+ $url = $this->buildUrlForGetOrPut(
1164
+ $this->contentHost,
1165
+ $this->appendFilePath("1/thumbnails", $path),
1166
+ array("size" => $size, "format" => $format));
1167
+
1168
+ $curl = $this->mkCurl($url);
1169
+ $metadataCatcher = new DropboxMetadataHeaderCatcher($curl->handle);
1170
+
1171
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
1172
+ $response = $curl->exec();
1173
+
1174
+ if ($response->statusCode === 404) return null;
1175
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1176
+
1177
+ $metadata = $metadataCatcher->getMetadata();
1178
+ return array($metadata, $response->body);
1179
+ }
1180
+
1181
+ /**
1182
+ * Copies a file or folder to a new location
1183
+ *
1184
+ * See <a href="https://www.dropbox.com/developers/core/docs#fileops-copy">/fileops/copy</a>.
1185
+ *
1186
+ * @param string $fromPath
1187
+ * The Dropbox path of the file or folder you want to copy (UTF-8).
1188
+ *
1189
+ * @param string $toPath
1190
+ * The destination Dropbox path (UTF-8).
1191
+ *
1192
+ * @return mixed
1193
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
1194
+ * object</a> for the new file or folder.
1195
+ *
1196
+ * @throws Exception
1197
+ */
1198
+ function copy($fromPath, $toPath)
1199
+ {
1200
+ Path::checkArg("fromPath", $fromPath);
1201
+ Path::checkArgNonRoot("toPath", $toPath);
1202
+
1203
+ $response = $this->doPost(
1204
+ $this->apiHost,
1205
+ "1/fileops/copy",
1206
+ array(
1207
+ "root" => "auto",
1208
+ "from_path" => $fromPath,
1209
+ "to_path" => $toPath,
1210
+ ));
1211
+
1212
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1213
+
1214
+ return RequestUtil::parseResponseJson($response->body);
1215
+ }
1216
+
1217
+ /**
1218
+ * Creates a file or folder based on an existing copy ref (possibly from a different Dropbox
1219
+ * account).
1220
+ *
1221
+ * See <a href="https://www.dropbox.com/developers/core/docs#fileops-copy">/fileops/copy</a>.
1222
+ *
1223
+ * @param string $copyRef
1224
+ * A copy ref obtained via the {@link createCopyRef()} call.
1225
+ *
1226
+ * @param string $toPath
1227
+ * The Dropbox path you want to copy the file or folder to (UTF-8).
1228
+ *
1229
+ * @return mixed
1230
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
1231
+ * object</a> for the new file or folder.
1232
+ *
1233
+ * @throws Exception
1234
+ */
1235
+ function copyFromCopyRef($copyRef, $toPath)
1236
+ {
1237
+ Checker::argStringNonEmpty("copyRef", $copyRef);
1238
+ Path::checkArgNonRoot("toPath", $toPath);
1239
+
1240
+ $response = $this->doPost(
1241
+ $this->apiHost,
1242
+ "1/fileops/copy",
1243
+ array(
1244
+ "root" => "auto",
1245
+ "from_copy_ref" => $copyRef,
1246
+ "to_path" => $toPath,
1247
+ )
1248
+ );
1249
+
1250
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1251
+
1252
+ return RequestUtil::parseResponseJson($response->body);
1253
+ }
1254
+
1255
+ /**
1256
+ * Creates a folder.
1257
+ *
1258
+ * See <a href="https://www.dropbox.com/developers/core/docs#fileops-create-folder">/fileops/create_folder</a>.
1259
+ *
1260
+ * @param string $path
1261
+ * The Dropbox path at which to create the folder (UTF-8).
1262
+ *
1263
+ * @return array|null
1264
+ * If successful, you'll get back the
1265
+ * <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata object</a>
1266
+ * for the newly-created folder. If not successful, you'll get <code>null</code>.
1267
+ *
1268
+ * @throws Exception
1269
+ */
1270
+ function createFolder($path)
1271
+ {
1272
+ Path::checkArgNonRoot("path", $path);
1273
+
1274
+ $response = $this->doPost(
1275
+ $this->apiHost,
1276
+ "1/fileops/create_folder",
1277
+ array(
1278
+ "root" => "auto",
1279
+ "path" => $path,
1280
+ ));
1281
+
1282
+ if ($response->statusCode === 403) return null;
1283
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1284
+
1285
+ return RequestUtil::parseResponseJson($response->body);
1286
+ }
1287
+
1288
+ /**
1289
+ * Deletes a file or folder
1290
+ *
1291
+ * See <a href="https://www.dropbox.com/developers/core/docs#fileops-delete">/fileops/delete</a>.
1292
+ *
1293
+ * @param string $path
1294
+ * The Dropbox path of the file or folder to delete (UTF-8).
1295
+ *
1296
+ * @return mixed
1297
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
1298
+ * object</a> for the deleted file or folder.
1299
+ *
1300
+ * @throws Exception
1301
+ */
1302
+ function delete($path)
1303
+ {
1304
+ Path::checkArgNonRoot("path", $path);
1305
+
1306
+ $response = $this->doPost(
1307
+ $this->apiHost,
1308
+ "1/fileops/delete",
1309
+ array(
1310
+ "root" => "auto",
1311
+ "path" => $path,
1312
+ ));
1313
+
1314
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1315
+
1316
+ return RequestUtil::parseResponseJson($response->body);
1317
+ }
1318
+
1319
+ /**
1320
+ * Moves a file or folder to a new location.
1321
+ *
1322
+ * See <a href="https://www.dropbox.com/developers/core/docs#fileops-move">/fileops/move</a>.
1323
+ *
1324
+ * @param string $fromPath
1325
+ * The source Dropbox path (UTF-8).
1326
+ *
1327
+ * @param string $toPath
1328
+ * The destination Dropbox path (UTF-8).
1329
+ *
1330
+ * @return mixed
1331
+ * The <a href="https://www.dropbox.com/developers/core/docs#metadata-details">metadata
1332
+ * object</a> for the destination file or folder.
1333
+ *
1334
+ * @throws Exception
1335
+ */
1336
+ function move($fromPath, $toPath)
1337
+ {
1338
+ Path::checkArgNonRoot("fromPath", $fromPath);
1339
+ Path::checkArgNonRoot("toPath", $toPath);
1340
+
1341
+ $response = $this->doPost(
1342
+ $this->apiHost,
1343
+ "1/fileops/move",
1344
+ array(
1345
+ "root" => "auto",
1346
+ "from_path" => $fromPath,
1347
+ "to_path" => $toPath,
1348
+ ));
1349
+
1350
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
1351
+
1352
+ return RequestUtil::parseResponseJson($response->body);
1353
+ }
1354
+
1355
+ /**
1356
+ * Build a URL for making a GET or PUT request. Will add the "locale"
1357
+ * parameter.
1358
+ *
1359
+ * @param string $host
1360
+ * Either the "API" or "API content" hostname from {@link getHost()}.
1361
+ * @param string $path
1362
+ * The "path" part of the URL. For example, "/account/info".
1363
+ * @param array|null $params
1364
+ * URL parameters. For POST requests, do not put the parameters here.
1365
+ * Include them in the request body instead.
1366
+ *
1367
+ * @return string
1368
+ */
1369
+ function buildUrlForGetOrPut($host, $path, $params = null)
1370
+ {
1371
+ return RequestUtil::buildUrlForGetOrPut($this->userLocale, $host, $path, $params);
1372
+ }
1373
+
1374
+ /**
1375
+ * Perform an OAuth-2-authorized GET request to the Dropbox API. Will automatically
1376
+ * fill in "User-Agent" and "locale" as well.
1377
+ *
1378
+ * @param string $host
1379
+ * Either the "API" or "API content" hostname from {@link getHost()}.
1380
+ * @param string $path
1381
+ * The "path" part of the URL. For example, "/account/info".
1382
+ * @param array|null $params
1383
+ * GET parameters.
1384
+ * @return HttpResponse
1385
+ *
1386
+ * @throws Exception
1387
+ */
1388
+ function doGet($host, $path, $params = null)
1389
+ {
1390
+ Checker::argString("host", $host);
1391
+ Checker::argString("path", $path);
1392
+ return RequestUtil::doGet($this->clientIdentifier, $this->accessToken, $this->userLocale,
1393
+ $host, $path, $params);
1394
+ }
1395
+
1396
+ /**
1397
+ * Perform an OAuth-2-authorized POST request to the Dropbox API. Will automatically
1398
+ * fill in "User-Agent" and "locale" as well.
1399
+ *
1400
+ * @param string $host
1401
+ * Either the "API" or "API content" hostname from {@link getHost()}.
1402
+ * @param string $path
1403
+ * The "path" part of the URL. For example, "/commit_chunked_upload".
1404
+ * @param array|null $params
1405
+ * POST parameters.
1406
+ * @return HttpResponse
1407
+ *
1408
+ * @throws Exception
1409
+ */
1410
+ function doPost($host, $path, $params = null)
1411
+ {
1412
+ Checker::argString("host", $host);
1413
+ Checker::argString("path", $path);
1414
+ return RequestUtil::doPost($this->clientIdentifier, $this->accessToken, $this->userLocale,
1415
+ $host, $path, $params);
1416
+ }
1417
+
1418
+ /**
1419
+ * Create a {@link Curl} object that is pre-configured with {@link getClientIdentifier()},
1420
+ * and the proper OAuth 2 "Authorization" header.
1421
+ *
1422
+ * @param string $url
1423
+ * Generate this URL using {@link buildUrl()}.
1424
+ *
1425
+ * @return Curl
1426
+ */
1427
+ function mkCurl($url)
1428
+ {
1429
+ return RequestUtil::mkCurlWithOAuth($this->clientIdentifier, $url, $this->accessToken);
1430
+ }
1431
+
1432
+ /**
1433
+ * Parses date/time strings returned by the Dropbox API. The Dropbox API returns date/times
1434
+ * formatted like: <code>"Sat, 21 Aug 2010 22:31:20 +0000"</code>.
1435
+ *
1436
+ * @param string $apiDateTimeString
1437
+ * A date/time string returned by the API.
1438
+ *
1439
+ * @return \DateTime
1440
+ * A standard PHP <code>\DateTime</code> instance.
1441
+ *
1442
+ * @throws Exception_BadResponse
1443
+ * Thrown if <code>$apiDateTimeString</code> isn't correctly formatted.
1444
+ */
1445
+ static function parseDateTime($apiDateTimeString)
1446
+ {
1447
+ $dt = \DateTime::createFromFormat(self::$dateTimeFormat, $apiDateTimeString);
1448
+ if ($dt === false) throw new Exception_BadResponse(
1449
+ "Bad date/time from server: ".Util::q($apiDateTimeString));
1450
+ return $dt;
1451
+ }
1452
+
1453
+ private static $dateTimeFormat = "D, d M Y H:i:s T";
1454
+
1455
+ /**
1456
+ * @internal
1457
+ */
1458
+ static function getField($j, $fieldName)
1459
+ {
1460
+ if (!array_key_exists($fieldName, $j)) throw new Exception_BadResponse(
1461
+ "missing field \"$fieldName\" in ".Util::q($j));
1462
+ return $j[$fieldName];
1463
+ }
1464
+
1465
+ /**
1466
+ * Given an OAuth 2 access token, returns <code>null</code> if it is well-formed (though
1467
+ * not necessarily valid). Otherwise, returns a string describing what's wrong with it.
1468
+ *
1469
+ * @param string $s
1470
+ *
1471
+ * @return string
1472
+ */
1473
+ static function getAccessTokenError($s)
1474
+ {
1475
+ if ($s === null) return "can't be null";
1476
+ if (strlen($s) === 0) return "can't be empty";
1477
+ if (preg_match('@[^-=_~/A-Za-z0-9\.\+]@', $s) === 1) return "contains invalid character";
1478
+ return null;
1479
+ }
1480
+
1481
+ /**
1482
+ * @internal
1483
+ */
1484
+ static function checkAccessTokenArg($argName, $accessToken)
1485
+ {
1486
+ $error = self::getAccessTokenError($accessToken);
1487
+ if ($error !== null) throw new \InvalidArgumentException("'$argName' invalid: $error");
1488
+ }
1489
+
1490
+ /**
1491
+ * @internal
1492
+ */
1493
+ static function getClientIdentifierError($s)
1494
+ {
1495
+ if ($s === null) return "can't be null";
1496
+ if (strlen($s) === 0) return "can't be empty";
1497
+ if (preg_match('@[\x00-\x1f\x7f]@', $s) === 1) return "contains control character";
1498
+ return null;
1499
+ }
1500
+
1501
+ /**
1502
+ * @internal
1503
+ */
1504
+ static function checkClientIdentifierArg($argName, $accessToken)
1505
+ {
1506
+ $error = self::getClientIdentifierError($accessToken);
1507
+ if ($error !== null) throw new \InvalidArgumentException("'$argName' invalid: $error");
1508
+ }
1509
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Curl.php ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * A minimal wrapper around a cURL handle.
6
+ *
7
+ * @internal
8
+ */
9
+ final class Curl
10
+ {
11
+ /** @var resource */
12
+ public $handle;
13
+
14
+ /** @var string[] */
15
+ private $headers = array();
16
+
17
+ /**
18
+ * @param string $url
19
+ */
20
+ function __construct($url)
21
+ {
22
+ // Make sure there aren't any spaces in the URL (i.e. the caller forgot to URL-encode).
23
+ if (strpos($url, ' ') !== false) {
24
+ throw new \InvalidArgumentException("Found space in \$url; it should be encoded");
25
+ }
26
+
27
+ $this->handle = curl_init($url);
28
+
29
+ // NOTE: Though we turn on all the correct SSL settings, many PHP installations
30
+ // don't respect these settings. Run "examples/test-ssl.php" to run some basic
31
+ // SSL tests to see how well your PHP implementation behaves.
32
+
33
+ // Use our own certificate list.
34
+ $this->set(CURLOPT_SSL_VERIFYPEER, true); // Enforce certificate validation
35
+ $this->set(CURLOPT_SSL_VERIFYHOST, 2); // Enforce hostname validation
36
+
37
+ // Force the use of TLS (SSL v2 and v3 are not secure).
38
+ // TODO: Use "CURL_SSLVERSION_TLSv1" instead of "1" once we can rely on PHP 5.5+.
39
+ $this->set(CURLOPT_SSLVERSION, 1);
40
+
41
+ // Limit the set of ciphersuites used.
42
+ global $sslCiphersuiteList;
43
+ if ($sslCiphersuiteList !== null) {
44
+ $this->set(CURLOPT_SSL_CIPHER_LIST, $sslCiphersuiteList);
45
+ }
46
+
47
+ list($rootCertsFilePath, $rootCertsFolderPath) = RootCertificates::getPaths();
48
+ // Certificate file.
49
+ $this->set(CURLOPT_CAINFO, $rootCertsFilePath);
50
+ // Certificate folder. If not specified, some PHP installations will use
51
+ // the system default, even when CURLOPT_CAINFO is specified.
52
+ $this->set(CURLOPT_CAPATH, $rootCertsFolderPath);
53
+
54
+ // Limit vulnerability surface area. Supported in cURL 7.19.4+
55
+ if (defined('CURLOPT_PROTOCOLS')) $this->set(CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
56
+ if (defined('CURLOPT_REDIR_PROTOCOLS')) $this->set(CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
57
+ }
58
+
59
+ /**
60
+ * @param string $header
61
+ */
62
+ function addHeader($header)
63
+ {
64
+ $this->headers[] = $header;
65
+ }
66
+
67
+ function exec()
68
+ {
69
+ $this->set(CURLOPT_HTTPHEADER, $this->headers);
70
+
71
+ $body = curl_exec($this->handle);
72
+ if ($body === false) {
73
+ throw new Exception_NetworkIO("Error executing HTTP request: " . curl_error($this->handle));
74
+ }
75
+
76
+ $statusCode = curl_getinfo($this->handle, CURLINFO_HTTP_CODE);
77
+
78
+ return new HttpResponse($statusCode, $body);
79
+ }
80
+
81
+ /**
82
+ * @param int $option
83
+ * @param mixed $value
84
+ */
85
+ function set($option, $value)
86
+ {
87
+ curl_setopt($this->handle, $option, $value);
88
+ }
89
+
90
+ function __destruct()
91
+ {
92
+ curl_close($this->handle);
93
+ }
94
+ }
95
+
96
+ // Different cURL SSL backends use different names for ciphersuites.
97
+ $curlVersion = \curl_version();
98
+ $curlSslBackend = $curlVersion['ssl_version'];
99
+ if (\substr_compare($curlSslBackend, "NSS/", 0, strlen("NSS/")) === 0) {
100
+ // Can't figure out how to reliably set ciphersuites for NSS.
101
+ $sslCiphersuiteList = null;
102
+ }
103
+ else {
104
+ // Use the OpenSSL names for all other backends. We may have to
105
+ // refine this if users report errors.
106
+ $sslCiphersuiteList =
107
+ 'ECDHE-RSA-AES256-GCM-SHA384:'.
108
+ 'ECDHE-RSA-AES128-GCM-SHA256:'.
109
+ 'ECDHE-RSA-AES256-SHA384:'.
110
+ 'ECDHE-RSA-AES128-SHA256:'.
111
+ 'ECDHE-RSA-AES256-SHA:'.
112
+ 'ECDHE-RSA-AES128-SHA:'.
113
+ 'ECDHE-RSA-RC4-SHA:'.
114
+ 'DHE-RSA-AES256-GCM-SHA384:'.
115
+ 'DHE-RSA-AES128-GCM-SHA256:'.
116
+ 'DHE-RSA-AES256-SHA256:'.
117
+ 'DHE-RSA-AES128-SHA256:'.
118
+ 'DHE-RSA-AES256-SHA:'.
119
+ 'DHE-RSA-AES128-SHA:'.
120
+ 'AES256-GCM-SHA384:'.
121
+ 'AES128-GCM-SHA256:'.
122
+ 'AES256-SHA256:'.
123
+ 'AES128-SHA256:'.
124
+ 'AES256-SHA:'.
125
+ 'AES128-SHA';
126
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/CurlStreamRelay.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * A CURLOPT_WRITEFUNCTION that will write HTTP response data to $outStream if
6
+ * it's an HTTP 200 response. For all other HTTP status codes, it'll save the
7
+ * output in a string, which you can retrieve it via {@link getErrorBody}.
8
+ *
9
+ * @internal
10
+ */
11
+ class CurlStreamRelay
12
+ {
13
+ var $outStream;
14
+ var $errorData;
15
+ var $isError;
16
+
17
+ function __construct($ch, $outStream)
18
+ {
19
+ $this->outStream = $outStream;
20
+ $this->errorData = array();
21
+ $isError = null;
22
+ curl_setopt($ch, CURLOPT_WRITEFUNCTION, array($this, 'writeData'));
23
+ }
24
+
25
+ function writeData($ch, $data)
26
+ {
27
+ if ($this->isError === null) {
28
+ $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
29
+ $this->isError = ($statusCode !== 200);
30
+ }
31
+
32
+ if ($this->isError) {
33
+ $this->errorData[] = $data;
34
+ } else {
35
+ fwrite($this->outStream, $data);
36
+ }
37
+
38
+ return strlen($data);
39
+ }
40
+
41
+ function getErrorBody()
42
+ {
43
+ return implode($this->errorData);
44
+ }
45
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/DeserializeException.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * If, when loading a serialized {@link RequestToken} or {@link AccessToken}, the input string is
6
+ * malformed, this exception will be thrown.
7
+ */
8
+ final class DeserializeException extends \Exception
9
+ {
10
+ /**
11
+ * @param string $message
12
+ *
13
+ * @internal
14
+ */
15
+ function __construct($message)
16
+ {
17
+ parent::__construct($message);
18
+ }
19
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/DropboxMetadataHeaderCatcher.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * @internal
6
+ */
7
+ final class DropboxMetadataHeaderCatcher
8
+ {
9
+ /**
10
+ * @var mixed
11
+ */
12
+ var $metadata = null;
13
+
14
+ /**
15
+ * @var string
16
+ */
17
+ var $error = null;
18
+
19
+ /**
20
+ * @var bool
21
+ */
22
+ var $skippedFirstLine = false;
23
+
24
+ /**
25
+ * @param resource $ch
26
+ */
27
+ function __construct($ch)
28
+ {
29
+ curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'headerFunction'));
30
+ }
31
+
32
+ /**
33
+ * @param resource $ch
34
+ * @param string $header
35
+ * @return int
36
+ * @throws Exception_BadResponse
37
+ */
38
+ function headerFunction($ch, $header)
39
+ {
40
+ // The first line is the HTTP status line (Ex: "HTTP/1.1 200 OK").
41
+ if (!$this->skippedFirstLine) {
42
+ $this->skippedFirstLine = true;
43
+ return strlen($header);
44
+ }
45
+
46
+ // If we've encountered an error on a previous callback, then there's nothing left to do.
47
+ if ($this->error !== null) {
48
+ return strlen($header);
49
+ }
50
+
51
+ // case-insensitive starts-with check.
52
+ if (\substr_compare($header, "x-dropbox-metadata:", 0, 19, true) !== 0) {
53
+ return strlen($header);
54
+ }
55
+
56
+ if ($this->metadata !== null) {
57
+ $this->error = "Duplicate X-Dropbox-Metadata header";
58
+ return strlen($header);
59
+ }
60
+
61
+ $headerValue = substr($header, 19);
62
+ $parsed = json_decode($headerValue, true, 10);
63
+
64
+ if ($parsed === null) {
65
+ $this->error = "Bad JSON in X-Dropbox-Metadata header";
66
+ return strlen($header);
67
+ }
68
+
69
+ $this->metadata = $parsed;
70
+ return strlen($header);
71
+ }
72
+
73
+ function getMetadata()
74
+ {
75
+ if ($this->error !== null) {
76
+ throw new Exception_BadResponse($this->error);
77
+ }
78
+ if ($this->metadata === null) {
79
+ throw new Exception_BadResponse("Missing X-Dropbox-Metadata header");
80
+ }
81
+ return $this->metadata;
82
+ }
83
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The base class for all API call exceptions.
6
+ */
7
+ class Exception extends \Exception
8
+ {
9
+ /**
10
+ * @internal
11
+ */
12
+ function __construct($message, $cause = null)
13
+ {
14
+ parent::__construct($message, 0, $cause);
15
+ }
16
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/BadRequest.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown when the server tells us that our request was invalid. This is typically due to an
6
+ * HTTP 400 response from the server.
7
+ */
8
+ final class Exception_BadRequest extends Exception_ProtocolError
9
+ {
10
+ /**
11
+ * @internal
12
+ */
13
+ function __construct($message = "")
14
+ {
15
+ parent::__construct($message);
16
+ }
17
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/BadResponse.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * When this SDK can't understand the response from the server. This could be due to a bug in this
6
+ * SDK or a buggy response from the Dropbox server.
7
+ */
8
+ class Exception_BadResponse extends Exception_ProtocolError
9
+ {
10
+ /**
11
+ * @internal
12
+ */
13
+ function __construct($message)
14
+ {
15
+ parent::__construct($message);
16
+ }
17
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/BadResponseCode.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown when the the Dropbox server responds with an HTTP status code we didn't expect.
6
+ */
7
+ final class Exception_BadResponseCode extends Exception_BadResponse
8
+ {
9
+ /** @var int */
10
+ private $statusCode;
11
+
12
+ /**
13
+ * @param string $message
14
+ * @param int $statusCode
15
+ *
16
+ * @internal
17
+ */
18
+ function __construct($message, $statusCode)
19
+ {
20
+ parent::__construct($message);
21
+ $this->statusCode = $statusCode;
22
+ }
23
+
24
+ /**
25
+ * The HTTP status code returned by the Dropbox server.
26
+ *
27
+ * @return int
28
+ */
29
+ public function getStatusCode()
30
+ {
31
+ return $this->statusCode;
32
+ }
33
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/InvalidAccessToken.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The Dropbox server said that the access token you used is invalid or expired. You should
6
+ * probably ask the user to go through the OAuth authorization flow again to get a new access
7
+ * token.
8
+ */
9
+ final class Exception_InvalidAccessToken extends Exception
10
+ {
11
+ /**
12
+ * @internal
13
+ */
14
+ function __construct($message = "")
15
+ {
16
+ parent::__construct($message);
17
+ }
18
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/NetworkIO.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * There was a network I/O error when making the request.
6
+ */
7
+ final class Exception_NetworkIO extends Exception
8
+ {
9
+ /**
10
+ * @internal
11
+ */
12
+ function __construct($message, $cause = null)
13
+ {
14
+ parent::__construct($message, $cause);
15
+ }
16
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/ProtocolError.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * There was an protocol misunderstanding between this SDK and the server. One of us didn't
6
+ * understand what the other one was saying.
7
+ */
8
+ class Exception_ProtocolError extends Exception
9
+ {
10
+ /**
11
+ * @internal
12
+ */
13
+ function __construct($message)
14
+ {
15
+ parent::__construct($message);
16
+ }
17
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/RetryLater.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The Dropbox server said it couldn't fulfil our request right now, but that we should try
6
+ * again later.
7
+ */
8
+ final class Exception_RetryLater extends Exception
9
+ {
10
+ /**
11
+ * @internal
12
+ */
13
+ function __construct($message)
14
+ {
15
+ parent::__construct($message);
16
+ }
17
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Exception/ServerError.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The Dropbox server said that there was an internal error when trying to fulfil our request.
6
+ * This usually corresponds to an HTTP 500 response.
7
+ */
8
+ final class Exception_ServerError extends Exception
9
+ {
10
+ /** @internal */
11
+ function __construct($message = "")
12
+ {
13
+ parent::__construct($message);
14
+ }
15
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Host.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The Dropbox web API accesses three hosts; this structure holds the
6
+ * names of those three hosts. This is primarily for mocking things out
7
+ * during testing. Most of the time you won't have to deal with this class
8
+ * directly, and even when you do, you'll just use the default
9
+ * value: {@link Host::getDefault()}.
10
+ *
11
+ * @internal
12
+ */
13
+ final class Host
14
+ {
15
+ /**
16
+ * Returns a Host object configured with the three standard Dropbox host: "api.dropbox.com",
17
+ * "api-content.dropbox.com", and "www.dropbox.com"
18
+ *
19
+ * @return Host
20
+ */
21
+ static function getDefault()
22
+ {
23
+ if (!self::$defaultValue) {
24
+ self::$defaultValue = new Host("api.dropbox.com", "api-content.dropbox.com", "www.dropbox.com");
25
+ }
26
+ return self::$defaultValue;
27
+ }
28
+ private static $defaultValue;
29
+
30
+ /** @var string */
31
+ private $api;
32
+ /** @var string */
33
+ private $content;
34
+ /** @var string */
35
+ private $web;
36
+
37
+ /**
38
+ * Constructor.
39
+ *
40
+ * @param string $api
41
+ * See {@link getApi()}
42
+ * @param string $content
43
+ * See {@link getContent()}
44
+ * @param string $web
45
+ * See {@link getWeb()}
46
+ */
47
+ function __construct($api, $content, $web)
48
+ {
49
+ $this->api = $api;
50
+ $this->content = $content;
51
+ $this->web = $web;
52
+ }
53
+
54
+ /**
55
+ * Returns the host name of the main Dropbox API server.
56
+ * The default is "api.dropbox.com".
57
+ *
58
+ * @return string
59
+ */
60
+ function getApi() { return $this->api; }
61
+
62
+ /**
63
+ * Returns the host name of the Dropbox API content server.
64
+ * The default is "api-content.dropbox.com".
65
+ *
66
+ * @return string
67
+ */
68
+ function getContent() { return $this->content; }
69
+
70
+ /**
71
+ * Returns the host name of the Dropbox web server. Used during user authorization.
72
+ * The default is "www.dropbox.com".
73
+ *
74
+ * @return string
75
+ */
76
+ function getWeb() { return $this->web; }
77
+
78
+ /**
79
+ * Check that a function argument is of type <code>Host</code>.
80
+ *
81
+ * @internal
82
+ */
83
+ static function checkArg($argName, $argValue)
84
+ {
85
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
86
+ }
87
+
88
+ /**
89
+ * Check that a function argument is either <code>null</code> or of type
90
+ * <code>Host</code>.
91
+ *
92
+ * @internal
93
+ */
94
+ static function checkArgOrNull($argName, $argValue)
95
+ {
96
+ if ($argValue === null) return;
97
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
98
+ }
99
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/HttpResponse.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * @internal
6
+ */
7
+ final class HttpResponse
8
+ {
9
+ public $statusCode;
10
+ public $body;
11
+
12
+ function __construct($statusCode, $body)
13
+ {
14
+ $this->statusCode = $statusCode;
15
+ $this->body = $body;
16
+ }
17
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/OAuth1AccessToken.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Use with {@link OAuth1Upgrader} to convert old OAuth 1 access tokens
6
+ * to OAuth 2 access tokens. This SDK doesn't support using OAuth 1
7
+ * access tokens for regular API calls.
8
+ */
9
+ class OAuth1AccessToken
10
+ {
11
+ /**
12
+ * The OAuth 1 access token key.
13
+ *
14
+ * @return string
15
+ */
16
+ function getKey() { return $this->key; }
17
+
18
+ /** @var string */
19
+ private $key;
20
+
21
+ /**
22
+ * The OAuth 1 access token secret.
23
+ *
24
+ * Make sure that this is kept a secret. Someone with your app secret can impesonate your
25
+ * application. People sometimes ask for help on the Dropbox API forums and
26
+ * copy/paste code that includes their app secret. Do not do that.
27
+ *
28
+ * @return string
29
+ */
30
+ function getSecret() { return $this->secret; }
31
+
32
+ /** @var secret */
33
+ private $secret;
34
+
35
+ /**
36
+ * Constructor.
37
+ *
38
+ * @param string $key
39
+ * {@link getKey()}
40
+ * @param string $secret
41
+ * {@link getSecret()}
42
+ */
43
+ function __construct($key, $secret)
44
+ {
45
+ AppInfo::checkKeyArg($key);
46
+ AppInfo::checkSecretArg($secret);
47
+
48
+ $this->key = $key;
49
+ $this->secret = $secret;
50
+ }
51
+
52
+ /**
53
+ * Use this to check that a function argument is of type <code>AppInfo</code>
54
+ *
55
+ * @internal
56
+ */
57
+ static function checkArg($argName, $argValue)
58
+ {
59
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
60
+ }
61
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/OAuth1Upgrader.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Lets you convert OAuth 1 access tokens to OAuth 2 access tokens. First call {@link
6
+ * OAuth1AccessTokenUpgrader::createOAuth2AccessToken()} to get an OAuth 2 access token.
7
+ * If that succeeds, call {@link OAuth1AccessTokenUpgrader::disableOAuth1AccessToken()}
8
+ * to disable the OAuth 1 access token.
9
+ *
10
+ * <code>
11
+ * use \Dropbox as dbx;
12
+ * $appInfo = dbx\AppInfo::loadFromJsonFile(...);
13
+ * $clientIdentifier = "my-app/1.0";
14
+ * $oauth1AccessToken = dbx\OAuth1AccessToken(...);
15
+ *
16
+ * $upgrader = new dbx\OAuth1AccessTokenUpgrader($appInfo, $clientIdentifier, ...);
17
+ * $oauth2AccessToken = $upgrader->getOAuth2AccessToken($oauth1AccessToken);
18
+ * $upgrader->disableOAuth1AccessToken($oauth1AccessToken);
19
+ * </code>
20
+ */
21
+ class OAuth1Upgrader extends AuthBase
22
+ {
23
+ /**
24
+ * Given an existing active OAuth 1 access token, make a Dropbox API call to get a new OAuth 2
25
+ * access token that represents the same user and app.
26
+ *
27
+ * See <a href="https://www.dropbox.com/developers/core/docs#oa1-from-oa1">/oauth2/token_from_oauth1</a>.
28
+ *
29
+ * @param OAuth1AccessToken $oauth1AccessToken
30
+ *
31
+ * @return string
32
+ * The OAuth 2 access token.
33
+ *
34
+ * @throws Exception
35
+ */
36
+ function createOAuth2AccessToken($oauth1AccessToken)
37
+ {
38
+ OAuth1AccessToken::checkArg("oauth1AccessToken", $oauth1AccessToken);
39
+
40
+ $response = self::doPost($oauth1AccessToken, "1/oauth2/token_from_oauth1");
41
+
42
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
43
+
44
+ $parts = RequestUtil::parseResponseJson($response->body);
45
+
46
+ if (!array_key_exists('token_type', $parts) || !is_string($parts['token_type'])) {
47
+ throw new Exception_BadResponse("Missing \"token_type\" field.");
48
+ }
49
+ $tokenType = $parts['token_type'];
50
+ if (!array_key_exists('access_token', $parts) || !is_string($parts['access_token'])) {
51
+ throw new Exception_BadResponse("Missing \"access_token\" field.");
52
+ }
53
+ $accessToken = $parts['access_token'];
54
+
55
+ if ($tokenType !== "Bearer" && $tokenType !== "bearer") {
56
+ throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got "
57
+ . Util::q($tokenType));
58
+ }
59
+
60
+ return $accessToken;
61
+ }
62
+
63
+ /**
64
+ * Make a Dropbox API call to disable the given OAuth 1 access token.
65
+ *
66
+ * See <a href="https://www.dropbox.com/developers/core/docs#disable-token">/disable_access_token</a>.
67
+ *
68
+ * @param OAuth1AccessToken $oauth1AccessToken
69
+ *
70
+ * @throws Exception
71
+ */
72
+ function disableOAuth1AccessToken($oauth1AccessToken)
73
+ {
74
+ OAuth1AccessToken::checkArg("oauth1AccessToken", $oauth1AccessToken);
75
+
76
+ $response = self::doPost($oauth1AccessToken, "1/disable_access_token");
77
+
78
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
79
+ }
80
+
81
+ /**
82
+ * @param OAuth1AccessToken $oauth1AccessToken
83
+ * @param string $path
84
+ *
85
+ * @return HttpResponse
86
+ *
87
+ * @throws Exception
88
+ */
89
+ private function doPost($oauth1AccessToken, $path)
90
+ {
91
+ // Construct the OAuth 1 header.
92
+ $signature = rawurlencode($this->appInfo->getSecret()) . "&" . rawurlencode($oauth1AccessToken->getSecret());
93
+ $authHeaderValue = "OAuth oauth_signature_method=\"PLAINTEXT\""
94
+ . ", oauth_consumer_key=\"" . rawurlencode($this->appInfo->getKey()) . "\""
95
+ . ", oauth_token=\"" . rawurlencode($oauth1AccessToken->getKey()) . "\""
96
+ . ", oauth_signature=\"" . $signature . "\"";
97
+
98
+ return RequestUtil::doPostWithSpecificAuth(
99
+ $this->clientIdentifier, $authHeaderValue, $this->userLocale,
100
+ $this->appInfo->getHost()->getApi(),
101
+ $path,
102
+ null);
103
+ }
104
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Path.php ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Path validation functions.
6
+ */
7
+ final class Path
8
+ {
9
+ /**
10
+ * Return whether the given path is a valid Dropbox path.
11
+ *
12
+ * @param string $path
13
+ * The path you want to check for validity.
14
+ *
15
+ * @return bool
16
+ * Whether the path was valid or not.
17
+ */
18
+ static function isValid($path)
19
+ {
20
+ $error = self::findError($path);
21
+ return ($error === null);
22
+ }
23
+
24
+ /**
25
+ * Return whether the given path is a valid non-root Dropbox path.
26
+ * This is the same as {@link isValid} except <code>"/"</code> is not allowed.
27
+ *
28
+ * @param string $path
29
+ * The path you want to check for validity.
30
+ *
31
+ * @return bool
32
+ * Whether the path was valid or not.
33
+ */
34
+ static function isValidNonRoot($path)
35
+ {
36
+ $error = self::findErrorNonRoot($path);
37
+ return ($error === null);
38
+ }
39
+
40
+ /**
41
+ * If the given path is a valid Dropbox path, return <code>null</code>,
42
+ * otherwise return an English string error message describing what is wrong with the path.
43
+ *
44
+ * @param string $path
45
+ * The path you want to check for validity.
46
+ *
47
+ * @return string|null
48
+ * If the path was valid, return <code>null</code>. Otherwise, returns
49
+ * an English string describing the problem.
50
+ */
51
+ static function findError($path)
52
+ {
53
+ Checker::argString("path", $path);
54
+
55
+ $matchResult = preg_match('%^(?:
56
+ [\x09\x0A\x0D\x20-\x7E] # ASCII
57
+ | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
58
+ | \xE0[\xA0-\xBF][\x80-\xBD] # excluding overlongs, FFFE, and FFFF
59
+ | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
60
+ | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
61
+ )*$%xs', $path);
62
+
63
+ if ($matchResult !== 1) {
64
+ return "must be valid UTF-8; BMP only, no surrogates, no U+FFFE or U+FFFF";
65
+ }
66
+
67
+ if (\substr_compare($path, "/", 0, 1) !== 0) return "must start with \"/\"";
68
+ $l = strlen($path);
69
+ if ($l === 1) return null; // Special case for "/"
70
+
71
+ if ($path[$l-1] === "/") return "must not end with \"/\"";
72
+
73
+ // TODO: More checks.
74
+
75
+ return null;
76
+ }
77
+
78
+ /**
79
+ * If the given path is a valid non-root Dropbox path, return <code>null</code>,
80
+ * otherwise return an English string error message describing what is wrong with the path.
81
+ * This is the same as {@link findError} except <code>"/"</code> will yield an error message.
82
+ *
83
+ * @param string $path
84
+ * The path you want to check for validity.
85
+ *
86
+ * @return string|null
87
+ * If the path was valid, return <code>null</code>. Otherwise, returns
88
+ * an English string describing the problem.
89
+ */
90
+ static function findErrorNonRoot($path)
91
+ {
92
+ if ($path == "/") return "root path not allowed";
93
+ return self::findError($path);
94
+ }
95
+
96
+ /**
97
+ * Return the last component of a path (the file or folder name).
98
+ *
99
+ * <code>
100
+ * Path::getName("/Misc/Notes.txt") // "Notes.txt"
101
+ * Path::getName("/Misc") // "Misc"
102
+ * Path::getName("/") // null
103
+ * </code>
104
+ *
105
+ * @param string $path
106
+ * The full path you want to get the last component of.
107
+ *
108
+ * @return null|string
109
+ * The last component of <code>$path</code> or <code>null</code> if the given
110
+ * <code>$path</code> was <code>"/"<code>.
111
+ */
112
+ static function getName($path)
113
+ {
114
+ Checker::argString("path", $path);
115
+
116
+ if (\substr_compare($path, "/", 0, 1) !== 0) {
117
+ throw new \InvalidArgumentException("'path' must start with \"/\"");
118
+ }
119
+ $l = strlen($path);
120
+ if ($l === 1) return null;
121
+ if ($path[$l-1] === "/") {
122
+ throw new \InvalidArgumentException("'path' must not end with \"/\"");
123
+ }
124
+
125
+ $lastSlash = strrpos($path, "/");
126
+ return substr($path, $lastSlash+1);
127
+ }
128
+
129
+ /**
130
+ * @internal
131
+ *
132
+ * @param string $argName
133
+ * @param mixed $value
134
+ * @throws \InvalidArgumentException
135
+ */
136
+ static function checkArg($argName, $value)
137
+ {
138
+ if ($value === null) throw new \InvalidArgumentException("'$argName' must not be null");
139
+ if (!is_string($value)) throw new \InvalidArgumentException("'$argName' must be a string");
140
+ $error = self::findError($value);
141
+ if ($error !== null) throw new \InvalidArgumentException("'$argName'': bad path: $error: ".var_export($value, true));
142
+ }
143
+
144
+ /**
145
+ * @internal
146
+ *
147
+ * @param string $argName
148
+ * @param mixed $value
149
+ * @throws \InvalidArgumentException
150
+ */
151
+ static function checkArgOrNull($argName, $value)
152
+ {
153
+ if ($value === null) return;
154
+ self::checkArg($argName, $value);
155
+ }
156
+
157
+ /**
158
+ * @internal
159
+ *
160
+ * @param string $argName
161
+ * @param mixed $value
162
+ * @throws \InvalidArgumentException
163
+ */
164
+ static function checkArgNonRoot($argName, $value)
165
+ {
166
+ if ($value === null) throw new \InvalidArgumentException("'$argName' must not be null");
167
+ if (!is_string($value)) throw new \InvalidArgumentException("'$argName' must be a string");
168
+ $error = self::findErrorNonRoot($value);
169
+ if ($error !== null) throw new \InvalidArgumentException("'$argName'': bad path: $error: ".var_export($value, true));
170
+ }
171
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/RequestUtil.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ if (!function_exists('curl_init')) {
5
+ throw new \Exception("The Dropbox SDK requires the cURL PHP extension, but it looks like you don't have it (couldn't find function \"curl_init\"). Library: \"" . __FILE__ . "\".");
6
+ }
7
+
8
+ if (!function_exists('json_decode')) {
9
+ throw new \Exception("The Dropbox SDK requires the JSON PHP extension, but it looks like you don't have it (couldn't find function \"json_decode\"). Library: \"" . __FILE__ . "\".");
10
+ }
11
+
12
+ // If mbstring.func_overload is set, it changes the behavior of the standard string functions in
13
+ // ways that makes this library break.
14
+ $mbstring_func_overload = ini_get("mbstring.func_overload");
15
+ if ($mbstring_func_overload & 2 == 2) {
16
+ throw new \Exception("The Dropbox SDK doesn't work when mbstring.func_overload is set to overload the standard string functions (value = ".var_export($mbstring_func_overload, true)."). Library: \"" . __FILE__ . "\".");
17
+ }
18
+
19
+ if (strlen((string) PHP_INT_MAX) < 19) {
20
+ // Looks like we're running on a 32-bit build of PHP. This could cause problems because some of the numbers
21
+ // we use (file sizes, quota, etc) can be larger than 32-bit ints can handle.
22
+ throw new \Exception("The Dropbox SDK uses 64-bit integers, but it looks like we're running on a version of PHP that doesn't support 64-bit integers (PHP_INT_MAX=" . ((string) PHP_INT_MAX) . "). Library: \"" . __FILE__ . "\"");
23
+ }
24
+
25
+ /**
26
+ * @internal
27
+ */
28
+ final class RequestUtil
29
+ {
30
+ /**
31
+ * @param string $userLocale
32
+ * @param string $host
33
+ * @param string $path
34
+ * @param array $params
35
+ * @return string
36
+ */
37
+ static function buildUrlForGetOrPut($userLocale, $host, $path, $params = null)
38
+ {
39
+ $url = self::buildUri($host, $path);
40
+ $url .= "?locale=" . rawurlencode($userLocale);
41
+
42
+ if ($params !== null) {
43
+ foreach ($params as $key => $value) {
44
+ Checker::argStringNonEmpty("key in 'params'", $key);
45
+ if ($value !== null) {
46
+ if (is_bool($value)) {
47
+ $value = $value ? "true" : "false";
48
+ }
49
+ else if (is_int($value)) {
50
+ $value = (string) $value;
51
+ }
52
+ else if (!is_string($value)) {
53
+ throw new \InvalidArgumentException("params['$key'] is not a string, int, or bool");
54
+ }
55
+ $url .= "&" . rawurlencode($key) . "=" . rawurlencode($value);
56
+ }
57
+ }
58
+ }
59
+ return $url;
60
+ }
61
+
62
+ /**
63
+ * @param string $host
64
+ * @param string $path
65
+ * @return string
66
+ */
67
+ static function buildUri($host, $path)
68
+ {
69
+ Checker::argStringNonEmpty("host", $host);
70
+ Checker::argStringNonEmpty("path", $path);
71
+ return "https://" . $host . "/" . $path;
72
+ }
73
+
74
+ /**
75
+ * @param string $clientIdentifier
76
+ * @param string $url
77
+ * @return Curl
78
+ */
79
+ static function mkCurl($clientIdentifier, $url)
80
+ {
81
+ $curl = new Curl($url);
82
+
83
+ $curl->set(CURLOPT_CONNECTTIMEOUT, 10);
84
+
85
+ // If the transfer speed is below 1kB/sec for 10 sec, abort.
86
+ $curl->set(CURLOPT_LOW_SPEED_LIMIT, 1024);
87
+ $curl->set(CURLOPT_LOW_SPEED_TIME, 10);
88
+
89
+ //$curl->set(CURLOPT_VERBOSE, true); // For debugging.
90
+ // TODO: Figure out how to encode clientIdentifier (urlencode?)
91
+ $curl->addHeader("User-Agent: ".$clientIdentifier." Dropbox-PHP-SDK");
92
+
93
+ return $curl;
94
+ }
95
+
96
+ /**
97
+ * @param string $clientIdentifier
98
+ * @param string $url
99
+ * @param string $authHeaderValue
100
+ * @return Curl
101
+ */
102
+ static function mkCurlWithAuth($clientIdentifier, $url, $authHeaderValue)
103
+ {
104
+ $curl = self::mkCurl($clientIdentifier, $url);
105
+ $curl->addHeader("Authorization: $authHeaderValue");
106
+ return $curl;
107
+ }
108
+
109
+ /**
110
+ * @param string $clientIdentifier
111
+ * @param string $url
112
+ * @param string $accessToken
113
+ * @return Curl
114
+ */
115
+ static function mkCurlWithOAuth($clientIdentifier, $url, $accessToken)
116
+ {
117
+ return self::mkCurlWithAuth($clientIdentifier, $url, "Bearer $accessToken");
118
+ }
119
+
120
+ static function buildPostBody($params)
121
+ {
122
+ if ($params === null) return "";
123
+
124
+ $pairs = array();
125
+ foreach ($params as $key => $value) {
126
+ Checker::argStringNonEmpty("key in 'params'", $key);
127
+ if ($value !== null) {
128
+ if (is_bool($value)) {
129
+ $value = $value ? "true" : "false";
130
+ }
131
+ else if (is_int($value)) {
132
+ $value = (string) $value;
133
+ }
134
+ else if (!is_string($value)) {
135
+ throw new \InvalidArgumentException("params['$key'] is not a string, int, or bool");
136
+ }
137
+ $pairs[] = rawurlencode($key) . "=" . rawurlencode((string) $value);
138
+ }
139
+ }
140
+ return implode("&", $pairs);
141
+ }
142
+
143
+ /**
144
+ * @param string $clientIdentifier
145
+ * @param string $accessToken
146
+ * @param string $userLocale
147
+ * @param string $host
148
+ * @param string $path
149
+ * @param array|null $params
150
+ *
151
+ * @return HttpResponse
152
+ *
153
+ * @throws Exception
154
+ */
155
+ static function doPost($clientIdentifier, $accessToken, $userLocale, $host, $path, $params = null)
156
+ {
157
+ Checker::argStringNonEmpty("accessToken", $accessToken);
158
+
159
+ $url = self::buildUri($host, $path);
160
+
161
+ if ($params === null) $params = array();
162
+ $params['locale'] = $userLocale;
163
+
164
+ $curl = self::mkCurlWithOAuth($clientIdentifier, $url, $accessToken);
165
+ $curl->set(CURLOPT_POST, true);
166
+ $curl->set(CURLOPT_POSTFIELDS, self::buildPostBody($params));
167
+
168
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
169
+ return $curl->exec();
170
+ }
171
+
172
+ /**
173
+ * @param string $clientIdentifier
174
+ * @param string $authHeaderValue
175
+ * @param string $userLocale
176
+ * @param string $host
177
+ * @param string $path
178
+ * @param array|null $params
179
+ *
180
+ * @return HttpResponse
181
+ *
182
+ * @throws Exception
183
+ */
184
+ static function doPostWithSpecificAuth($clientIdentifier, $authHeaderValue, $userLocale, $host, $path, $params = null)
185
+ {
186
+ Checker::argStringNonEmpty("authHeaderValue", $authHeaderValue);
187
+
188
+ $url = self::buildUri($host, $path);
189
+
190
+ if ($params === null) $params = array();
191
+ $params['locale'] = $userLocale;
192
+
193
+ $curl = self::mkCurlWithAuth($clientIdentifier, $url, $authHeaderValue);
194
+ $curl->set(CURLOPT_POST, true);
195
+ $curl->set(CURLOPT_POSTFIELDS, self::buildPostBody($params));
196
+
197
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
198
+ return $curl->exec();
199
+ }
200
+
201
+ /**
202
+ * @param string $clientIdentifier
203
+ * @param string $accessToken
204
+ * @param string $userLocale
205
+ * @param string $host
206
+ * @param string $path
207
+ * @param array|null $params
208
+ *
209
+ * @return HttpResponse
210
+ *
211
+ * @throws Exception
212
+ */
213
+ static function doGet($clientIdentifier, $accessToken, $userLocale, $host, $path, $params = null)
214
+ {
215
+ Checker::argStringNonEmpty("accessToken", $accessToken);
216
+
217
+ $url = self::buildUrlForGetOrPut($userLocale, $host, $path, $params);
218
+
219
+ $curl = self::mkCurlWithOAuth($clientIdentifier, $url, $accessToken);
220
+ $curl->set(CURLOPT_HTTPGET, true);
221
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
222
+
223
+ return $curl->exec();
224
+ }
225
+
226
+ /**
227
+ * @param string $responseBody
228
+ * @return mixed
229
+ * @throws Exception_BadResponse
230
+ */
231
+ static function parseResponseJson($responseBody)
232
+ {
233
+ $obj = json_decode($responseBody, true, 10);
234
+ if ($obj === null) {
235
+ throw new Exception_BadResponse("Got bad JSON from server: $responseBody");
236
+ }
237
+ return $obj;
238
+ }
239
+
240
+ static function unexpectedStatus($httpResponse)
241
+ {
242
+ $sc = $httpResponse->statusCode;
243
+
244
+ $message = "HTTP status $sc";
245
+ if (is_string($httpResponse->body)) {
246
+ // TODO: Maybe only include the first ~200 chars of the body?
247
+ $message .= "\n".$httpResponse->body;
248
+ }
249
+
250
+ if ($sc === 400) return new Exception_BadRequest($message);
251
+ if ($sc === 401) return new Exception_InvalidAccessToken($message);
252
+ if ($sc === 500 || $sc === 502) return new Exception_ServerError($message);
253
+ if ($sc === 503) return new Exception_RetryLater($message);
254
+
255
+ return new Exception_BadResponseCode("Unexpected $message", $sc);
256
+ }
257
+
258
+ /**
259
+ * @param int $maxRetries
260
+ * The number of times to retry it the action if it fails with one of the transient
261
+ * API errors. A value of 1 means we'll try the action once and if it fails, we
262
+ * will retry once.
263
+ *
264
+ * @param callable $action
265
+ * The the action you want to retry.
266
+ *
267
+ * @return mixed
268
+ * Whatever is returned by the $action callable.
269
+ */
270
+ static function runWithRetry($maxRetries, $action)
271
+ {
272
+ Checker::argNat("maxRetries", $maxRetries);
273
+
274
+ $retryDelay = 1;
275
+ $numRetries = 0;
276
+ while (true) {
277
+ try {
278
+ return $action();
279
+ }
280
+ // These exception types are the ones we think are possibly transient errors.
281
+ catch (Exception_NetworkIO $ex) {
282
+ $savedEx = $ex;
283
+ }
284
+ catch (Exception_ServerError $ex) {
285
+ $savedEx = $ex;
286
+ }
287
+ catch (Exception_RetryLater $ex) {
288
+ $savedEx = $ex;
289
+ }
290
+
291
+ // We maxed out our retries. Propagate the last exception we got.
292
+ if ($numRetries >= $maxRetries) throw $savedEx;
293
+
294
+ $numRetries++;
295
+ sleep($retryDelay);
296
+ $retryDelay *= 2; // Exponential back-off.
297
+ }
298
+ throw new \RuntimeException("unreachable");
299
+ }
300
+
301
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/RootCertificates.php ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * See: {@link RootCertificates::useExternalPaths()}
6
+ */
7
+ class RootCertificates
8
+ {
9
+ /* @var boolean */
10
+ private static $useExternalFile = false;
11
+
12
+ /* @var string[]|null */
13
+ private static $paths = null; // A tuple of (rootCertsFilePath, rootCertsFolderPath)
14
+
15
+ /**
16
+ * If you're running within a PHAR, call this method before you use the SDK
17
+ * to make any network requests.
18
+ *
19
+ * Normally, the SDK tells cURL to look in the "certs" folder for root certificate
20
+ * information. But this won't work if this SDK is running from within a PHAR because
21
+ * cURL won't read files that are packaged in a PHAR.
22
+ */
23
+ static function useExternalPaths()
24
+ {
25
+ if (!self::$useExternalFile and self::$paths !== null) {
26
+ throw new \Exception("You called \"useExternalFile\" too late. The SDK already used the root ".
27
+ "certificate file (probably to make an API call).");
28
+ }
29
+
30
+ self::$useExternalFile = true;
31
+ }
32
+
33
+ private static $originalPath = '/certs/trusted-certs.crt';
34
+
35
+ /**
36
+ * @internal
37
+ *
38
+ * @return string[]
39
+ * A tuple of (rootCertsFilePath, rootCertsFolderPath). To be used with cURL options CAINFO and CAPATH.
40
+ */
41
+ static function getPaths()
42
+ {
43
+ if (self::$paths === null) {
44
+ if (self::$useExternalFile) {
45
+ try {
46
+ $baseFolder = sys_get_temp_dir();
47
+ $file = self::createExternalCaFile($baseFolder);
48
+ $folder = self::createExternalCaFolder($baseFolder);
49
+ }
50
+ catch (\Exception $ex) {
51
+ throw new \Exception("Unable to create external root certificate file and folder: ".$ex->getMessage());
52
+ }
53
+ }
54
+ else {
55
+ if (substr(__DIR__, 0, 7) === 'phar://') {
56
+ throw new \Exception("The code appears to be running in a PHAR. You need to call \\Dropbox\\RootCertificates\\useExternalPaths() before making any API calls.");
57
+ }
58
+ $file = __DIR__.self::$originalPath;
59
+ $folder = \dirname($file);
60
+ }
61
+ self::$paths = array($file, $folder);
62
+ }
63
+
64
+ return self::$paths;
65
+ }
66
+
67
+ /**
68
+ * @param string $baseFolder
69
+ *
70
+ * @return string
71
+ */
72
+ private static function createExternalCaFolder($baseFolder)
73
+ {
74
+ // This is hacky, but I can't find a simple way to do this.
75
+
76
+ // This process isn't atomic, so give it three tries.
77
+ for ($i = 0; $i < 3; $i++) {
78
+ $path = \tempnam($baseFolder, "dropbox-php-sdk-trusted-certs-empty-dir");
79
+ if ($path === false) {
80
+ throw new \Exception("Couldn't create temp file in folder ".Util::q($baseFolder).".");
81
+ }
82
+ if (!\unlink($path)) {
83
+ throw new \Exception("Couldn't remove temp file to make way for temp dir: ".Util::q($path));
84
+ }
85
+ // TODO: Figure out how to make the folder private on Windows. The '700' only works on Unix.
86
+ if (!\mkdir($path, 700)) {
87
+ // Someone snuck in between the unlink() and the mkdir() and stole our path.
88
+ throw new \Exception("Couldn't create temp dir: ".Util::q($path));
89
+ }
90
+ \register_shutdown_function(function() use ($path) {
91
+ \rmdir($path);
92
+ });
93
+ return $path;
94
+ }
95
+
96
+ throw new \Exception("Unable to create temp dir in ".Util::q($baseFolder).", there's always something in the way.");
97
+ }
98
+
99
+ /**
100
+ * @param string $baseFolder
101
+ *
102
+ * @return string
103
+ */
104
+ private static function createExternalCaFile($baseFolder)
105
+ {
106
+ $path = \tempnam($baseFolder, "dropbox-php-sdk-trusted-certs");
107
+ if ($path === false) {
108
+ throw new \Exception("Couldn't create temp file in folder ".Util::q($baseFolder).".");
109
+ }
110
+ \register_shutdown_function(function() use ($path) {
111
+ \unlink($path);
112
+ });
113
+
114
+ // NOTE: Can't use the standard PHP copy(). That would clobber the locked-down
115
+ // permissions set by tempnam().
116
+ self::copyInto(__DIR__.self::$originalPath, $path);
117
+
118
+ return $path;
119
+ }
120
+
121
+ /**
122
+ * @param string $src
123
+ * @param string $dest
124
+ */
125
+ private static function copyInto($src, $dest)
126
+ {
127
+ $srcFd = \fopen($src, "r");
128
+ if ($srcFd === false) {
129
+ throw new \Exception("Couldn't open " . Util::q($src) . " for reading.");
130
+ }
131
+ $destFd = \fopen($dest, "w");
132
+ if ($destFd === false) {
133
+ \fclose($srcFd);
134
+ throw new \Exception("Couldn't open " . Util::q($dest) . " for writing.");
135
+ }
136
+
137
+ \stream_copy_to_stream($srcFd, $destFd);
138
+
139
+ fclose($srcFd);
140
+ if (!\fclose($destFd)) {
141
+ throw new \Exception("Error closing file ".Util::q($dest).".");
142
+ }
143
+ }
144
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/SSLTester.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Dropbox;
4
+
5
+ /**
6
+ * Call the <code>test()</code> method.
7
+ */
8
+ class SSLTester
9
+ {
10
+ /**
11
+ * Peforms a few basic tests of your PHP installation's SSL implementation to see
12
+ * if it insecure in an obvious way. Results are written with "echo" and the output
13
+ * is HTML-safe.
14
+ *
15
+ * @return bool
16
+ * Returns <code>true</code> if all the tests passed.
17
+ */
18
+ static function test()
19
+ {
20
+ $hostOs = php_uname('s').' '.php_uname('r');
21
+ $phpVersion = phpversion();
22
+ $curlVersionInfo = \curl_version();
23
+ $curlVersion = $curlVersionInfo['version'];
24
+ $curlSslBackend = $curlVersionInfo['ssl_version'];
25
+
26
+ echo "-----------------------------------------------------------------------------\n";
27
+ echo "Testing your PHP installation's SSL implementation for a few obvious problems...\n";
28
+ echo "-----------------------------------------------------------------------------\n";
29
+ echo "- Host OS: $hostOs\n";
30
+ echo "- PHP version: $phpVersion\n";
31
+ echo "- cURL version: $curlVersion\n";
32
+ echo "- cURL SSL backend: $curlSslBackend\n";
33
+
34
+ echo "Basic SSL tests\n";
35
+ $basicFailures = self::testMulti(array(
36
+ array("www.dropbox.com", 'testAllowed'),
37
+ array("www.digicert.com", 'testAllowed'),
38
+ array("www.v.dropbox.com", 'testHostnameMismatch'),
39
+ array("testssl-expire.disig.sk", 'testUntrustedCert'),
40
+ ));
41
+
42
+ echo "Pinned certificate tests\n";
43
+ $pinnedCertFailures = self::testMulti(array(
44
+ array("www.verisign.com", 'testUntrustedCert'),
45
+ array("www.globalsign.fr", 'testUntrustedCert'),
46
+ ));
47
+
48
+ if ($basicFailures) {
49
+ echo "-----------------------------------------------------------------------------\n";
50
+ echo "WARNING: Your PHP installation's SSL support is COMPLETELY INSECURE.\n";
51
+ echo "Your app's communication with the Dropbox API servers can be viewed and\n";
52
+ echo "manipulated by others. Try upgrading your version of PHP.\n";
53
+ echo "-----------------------------------------------------------------------------\n";
54
+ return false;
55
+ }
56
+ else if ($pinnedCertFailures) {
57
+ echo "-----------------------------------------------------------------------------\n";
58
+ echo "WARNING: Your PHP installation's cURL module doesn't support SSL certificate\n";
59
+ echo "pinning, which is an important security feature of the Dropbox SDK.\n";
60
+ echo "\n";
61
+ echo "This SDK uses CURLOPT_CAINFO and CURLOPT_CAPATH to tell PHP cURL to only trust\n";
62
+ echo "our custom certificate list. But your PHP installation's cURL module seems to\n";
63
+ echo "trust certificates that aren't on that list.\n";
64
+ echo "\n";
65
+ echo "More information on SSL certificate pinning:\n";
66
+ echo "https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning#What_Is_Pinning.3F\n";
67
+ echo "-----------------------------------------------------------------------------\n";
68
+ return false;
69
+ }
70
+ else {
71
+ return true;
72
+ }
73
+ }
74
+
75
+ private static function testMulti($tests)
76
+ {
77
+ $anyFailed = false;
78
+ foreach ($tests as $test) {
79
+ list($host, $testType) = $test;
80
+
81
+ echo " - ".str_pad("$testType ($host) ", 50, ".");
82
+ $url = "https://$host/";
83
+ $passed = self::$testType($url);
84
+ if ($passed) {
85
+ echo " ok\n";
86
+ } else {
87
+ echo " FAILED\n";
88
+ $anyFailed = true;
89
+ }
90
+ }
91
+ return $anyFailed;
92
+ }
93
+
94
+ private static function testAllowed($url)
95
+ {
96
+ $curl = RequestUtil::mkCurl("test-ssl", $url);
97
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
98
+ $curl->exec();
99
+ return true;
100
+ }
101
+
102
+ private static function testUntrustedCert($url)
103
+ {
104
+ return self::testDisallowed($url, 'Error executing HTTP request: SSL certificate problem, verify that the CA cert is OK');
105
+ }
106
+
107
+ private static function testHostnameMismatch($url)
108
+ {
109
+ return self::testDisallowed($url, 'Error executing HTTP request: SSL certificate problem: Invalid certificate chain');
110
+ }
111
+
112
+ private static function testDisallowed($url, $expectedExceptionMessage)
113
+ {
114
+ $curl = RequestUtil::mkCurl("test-ssl", $url);
115
+ $curl->set(CURLOPT_RETURNTRANSFER, true);
116
+ try {
117
+ $curl->exec();
118
+ }
119
+ catch (Exception_NetworkIO $ex) {
120
+ if (strpos($ex->getMessage(), $expectedExceptionMessage) == 0) {
121
+ return true;
122
+ } else {
123
+ throw $ex;
124
+ }
125
+ }
126
+ return false;
127
+ }
128
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Security.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Helper functions for security-related things.
6
+ */
7
+ class Security
8
+ {
9
+ /**
10
+ * A string equality function that compares strings in a way that isn't suceptible to timing
11
+ * attacks. An attacker can figure out the length of the string, but not the string's value.
12
+ *
13
+ * Use this when comparing two strings where:
14
+ * - one string could be influenced by an attacker
15
+ * - the other string contains data an attacker shouldn't know
16
+ *
17
+ * @param string $a
18
+ * @param string $b
19
+ * @return bool
20
+ */
21
+ static function stringEquals($a, $b)
22
+ {
23
+ // Be strict with arguments. PHP's liberal types could get us pwned.
24
+ if (func_num_args() !== 2) {
25
+ throw new \InvalidArgumentException("Expecting 2 args, got ".func_num_args().".");
26
+ }
27
+ Checker::argString("a", $a);
28
+ Checker::argString("b", $b);
29
+
30
+ $len = strlen($a);
31
+ if (strlen($b) !== $len) return false;
32
+
33
+ $result = 0;
34
+ for ($i = 0; $i < $len; $i++) {
35
+ $result |= ord($a[$i]) ^ ord($b[$i]);
36
+ }
37
+ return $result === 0;
38
+ }
39
+
40
+ /**
41
+ * Returns cryptographically strong secure random bytes (as a PHP string).
42
+ *
43
+ * @param int $numBytes
44
+ * The number of bytes of random data to return.
45
+ *
46
+ * @return string
47
+ */
48
+ static function getRandomBytes($numBytes)
49
+ {
50
+ Checker::argIntPositive("numBytes", $numBytes);
51
+
52
+ // openssl_random_pseudo_bytes had some issues prior to PHP 5.3.4
53
+ if (function_exists('openssl_random_pseudo_bytes')
54
+ && version_compare(PHP_VERSION, '5.3.4') >= 0) {
55
+ $s = openssl_random_pseudo_bytes($numBytes, $isCryptoStrong);
56
+ if ($isCryptoStrong) return $s;
57
+ }
58
+
59
+ if (function_exists('mcrypt_create_iv')) {
60
+ return mcrypt_create_iv($numBytes);
61
+ }
62
+
63
+ // Hopefully the above two options cover all our users. But if not, there are
64
+ // other platform-specific options we could add.
65
+ throw new \Exception("no suitable random number source available");
66
+ }
67
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/StreamReadException.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown when there's an error reading from a stream that was passed in by the caller.
6
+ */
7
+ class StreamReadException extends \Exception
8
+ {
9
+ /**
10
+ * @internal
11
+ */
12
+ function __construct($message, $cause = null)
13
+ {
14
+ parent::__construct($message, 0, $cause);
15
+ }
16
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/Util.php ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ class Util
5
+ {
6
+ /**
7
+ * @internal
8
+ */
9
+ public static function q($object)
10
+ {
11
+ return var_export($object, true);
12
+ }
13
+
14
+ /**
15
+ * If the given string begins with the UTF-8 BOM (byte order mark), remove it and
16
+ * return whatever is left. Otherwise, return the original string untouched.
17
+ *
18
+ * Though it's not recommended for UTF-8 to have a BOM, the standard allows it to
19
+ * support software that isn't Unicode-aware.
20
+ *
21
+ * @param string $string
22
+ * A UTF-8 encoded string.
23
+ *
24
+ * @return string
25
+ */
26
+ public static function stripUtf8Bom($string)
27
+ {
28
+ if (\substr_compare($string, "\xEF\xBB\xBF", 0, 3) === 0) {
29
+ $string = \substr($string, 3);
30
+ }
31
+ return $string;
32
+ }
33
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/ValueStore.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * A contract for a class which provides simple get/set/clear access to a single string
6
+ * value. {@link ArrayEntryStore} provides an implementation of this for storing a value
7
+ * in a single array element.
8
+ *
9
+ * Example implementation for a Memcache-based backing store:
10
+ *
11
+ * <code>
12
+ * class MemcacheValueStore implements ValueStore
13
+ * {
14
+ * private $key;
15
+ * private $memcache;
16
+ *
17
+ * function __construct($memcache, $key)
18
+ * {
19
+ * $this->memcache = $memcache;
20
+ * $this->key = $key;
21
+ * }
22
+ *
23
+ * function get()
24
+ * {
25
+ * $value = $this->memcache->get($this->getKey());
26
+ * return $value === false ? null : base64_decode($value);
27
+ * }
28
+ *
29
+ * function set($value)
30
+ * {
31
+ * $this->memcache->set($this->key, base64_encode($value));
32
+ * }
33
+ *
34
+ * function clear()
35
+ * {
36
+ * $this->memcache->delete($this->key);
37
+ * }
38
+ * }
39
+ * </code>
40
+ */
41
+ interface ValueStore
42
+ {
43
+ /**
44
+ * Returns the entry's current value or <code>null</code> if nothing is set.
45
+ *
46
+ * @return string
47
+ */
48
+ function get();
49
+
50
+ /**
51
+ * Set the entry to the given value.
52
+ *
53
+ * @param string $value
54
+ */
55
+ function set($value);
56
+
57
+ /**
58
+ * Remove the value.
59
+ */
60
+ function clear();
61
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuth.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * OAuth 2 "authorization code" flow. (This SDK does not support the "token" flow.)
6
+ *
7
+ * Use {@link WebAuth::start()} and {@link WebAuth::finish()} to guide your
8
+ * user through the process of giving your app access to their Dropbox account.
9
+ * At the end, you will have an access token, which you can pass to {@link Client}
10
+ * and start making API calls.
11
+ *
12
+ * Example:
13
+ *
14
+ * <code>
15
+ * use \Dropbox as dbx;
16
+ *
17
+ * function getWebAuth()
18
+ * {
19
+ * $appInfo = dbx\AppInfo::loadFromJsonFile(...);
20
+ * $clientIdentifier = "my-app/1.0";
21
+ * $redirectUri = "https://example.org/dropbox-auth-finish";
22
+ * $csrfTokenStore = new dbx\ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token');
23
+ * return new dbx\WebAuth($appInfo, $clientIdentifier, $redirectUri, $csrfTokenStore, ...);
24
+ * }
25
+ *
26
+ * // ----------------------------------------------------------
27
+ * // In the URL handler for "/dropbox-auth-start"
28
+ *
29
+ * $authorizeUrl = getWebAuth()->start();
30
+ * header("Location: $authorizeUrl");
31
+ *
32
+ * // ----------------------------------------------------------
33
+ * // In the URL handler for "/dropbox-auth-finish"
34
+ *
35
+ * try {
36
+ * list($accessToken, $userId, $urlState) = getWebAuth()->finish($_GET);
37
+ * assert($urlState === null); // Since we didn't pass anything in start()
38
+ * }
39
+ * catch (dbx\WebAuthException_BadRequest $ex) {
40
+ * error_log("/dropbox-auth-finish: bad request: " . $ex->getMessage());
41
+ * // Respond with an HTTP 400 and display error page...
42
+ * }
43
+ * catch (dbx\WebAuthException_BadState $ex) {
44
+ * // Auth session expired. Restart the auth process.
45
+ * header('Location: /dropbox-auth-start');
46
+ * }
47
+ * catch (dbx\WebAuthException_Csrf $ex) {
48
+ * error_log("/dropbox-auth-finish: CSRF mismatch: " . $ex->getMessage());
49
+ * // Respond with HTTP 403 and display error page...
50
+ * }
51
+ * catch (dbx\WebAuthException_NotApproved $ex) {
52
+ * error_log("/dropbox-auth-finish: not approved: " . $ex->getMessage());
53
+ * }
54
+ * catch (dbx\WebAuthException_Provider $ex) {
55
+ * error_log("/dropbox-auth-finish: error redirect from Dropbox: " . $ex->getMessage());
56
+ * }
57
+ * catch (dbx\Exception $ex) {
58
+ * error_log("/dropbox-auth-finish: error communicating with Dropbox API: " . $ex->getMessage());
59
+ * }
60
+ *
61
+ * // We can now use $accessToken to make API requests.
62
+ * $client = dbx\Client($accessToken, ...);
63
+ * </code>
64
+ *
65
+ */
66
+ class WebAuth extends WebAuthBase
67
+ {
68
+ /**
69
+ * The URI that the Dropbox server will redirect the user to after the user finishes
70
+ * authorizing your app. This URI must be HTTPS-based and
71
+ * <a href="https://www.dropbox.com/developers/apps">pre-registered with Dropbox</a>,
72
+ * though "localhost"-based and "127.0.0.1"-based URIs are allowed without pre-registration
73
+ * and can be either HTTP or HTTPS.
74
+ *
75
+ * @return string
76
+ */
77
+ function getRedirectUri() { return $this->redirectUri; }
78
+
79
+ /** @var string */
80
+ private $redirectUri;
81
+
82
+ /**
83
+ * A object that lets us save CSRF token string to the user's session. If you're using the
84
+ * standard PHP <code>$_SESSION</code>, you can pass in something like
85
+ * <code>new ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token')</code>.
86
+ *
87
+ * If you're not using $_SESSION, you might have to create your own class that provides
88
+ * the same <code>get()</code>/<code>set()</code>/<code>clear()</code> methods as
89
+ * {@link ArrayEntryStore}.
90
+ *
91
+ * @return ValueStore
92
+ */
93
+ function getCsrfTokenStore() { return $this->csrfTokenStore; }
94
+
95
+ /** @var object */
96
+ private $csrfTokenStore;
97
+
98
+ /**
99
+ * Constructor.
100
+ *
101
+ * @param AppInfo $appInfo
102
+ * See {@link getAppInfo()}
103
+ * @param string $clientIdentifier
104
+ * See {@link getClientIdentifier()}
105
+ * @param null|string $redirectUri
106
+ * See {@link getRedirectUri()}
107
+ * @param null|ValueStore $csrfTokenStore
108
+ * See {@link getCsrfTokenStore()}
109
+ * @param null|string $userLocale
110
+ * See {@link getUserLocale()}
111
+ */
112
+ function __construct($appInfo, $clientIdentifier, $redirectUri, $csrfTokenStore, $userLocale = null)
113
+ {
114
+ parent::__construct($appInfo, $clientIdentifier, $userLocale);
115
+
116
+ Checker::argStringNonEmpty("redirectUri", $redirectUri);
117
+
118
+ $this->csrfTokenStore = $csrfTokenStore;
119
+ $this->redirectUri = $redirectUri;
120
+ }
121
+
122
+ /**
123
+ * Starts the OAuth 2 authorization process, which involves redirecting the user to the
124
+ * returned authorization URL (a URL on the Dropbox website). When the user then
125
+ * either approves or denies your app access, Dropbox will redirect them to the
126
+ * <code>$redirectUri</code> given to constructor, at which point you should
127
+ * call {@link finish()} to complete the authorization process.
128
+ *
129
+ * This function will also save a CSRF token using the <code>$csrfTokenStore</code> given to
130
+ * the constructor. This CSRF token will be checked on {@link finish()} to prevent
131
+ * request forgery.
132
+ *
133
+ * See <a href="https://www.dropbox.com/developers/core/docs#oa2-authorize">/oauth2/authorize</a>.
134
+ *
135
+ * @param string|null $urlState
136
+ * Any data you would like to keep in the URL through the authorization process.
137
+ * This exact state will be returned to you by {@link finish()}.
138
+ *
139
+ * @return array
140
+ * The URL to redirect the user to.
141
+ *
142
+ * @throws Exception
143
+ */
144
+ function start($urlState = null)
145
+ {
146
+ Checker::argStringOrNull("urlState", $urlState);
147
+
148
+ $csrfToken = self::encodeCsrfToken(Security::getRandomBytes(16));
149
+ $state = $csrfToken;
150
+ if ($urlState !== null) {
151
+ $state .= "|";
152
+ $state .= $urlState;
153
+ }
154
+ $this->csrfTokenStore->set($csrfToken);
155
+
156
+ return $this->_getAuthorizeUrl($this->redirectUri, $state);
157
+ }
158
+
159
+ private static function encodeCsrfToken($string)
160
+ {
161
+ return strtr(base64_encode($string), '+/', '-_');
162
+ }
163
+
164
+ /**
165
+ * Call this after the user has visited the authorize URL ({@link start()}), approved your app,
166
+ * and was redirected to your redirect URI.
167
+ *
168
+ * See <a href="https://www.dropbox.com/developers/core/docs#oa2-token">/oauth2/token</a>.
169
+ *
170
+ * @param array $queryParams
171
+ * The query parameters on the GET request to your redirect URI.
172
+ *
173
+ * @return array
174
+ * A <code>list(string $accessToken, string $userId, string $urlState)</code>, where
175
+ * <code>$accessToken</code> can be used to construct a {@link Client}, <code>$userId</code>
176
+ * is the user ID of the user's Dropbox account, and <code>$urlState</code> is the
177
+ * value you originally passed in to {@link start()}.
178
+ *
179
+ * @throws Exception
180
+ * Thrown if there's an error getting the access token from Dropbox.
181
+ * @throws WebAuthException_BadRequest
182
+ * @throws WebAuthException_BadState
183
+ * @throws WebAuthException_Csrf
184
+ * @throws WebAuthException_NotApproved
185
+ * @throws WebAuthException_Provider
186
+ */
187
+ function finish($queryParams)
188
+ {
189
+ Checker::argArray("queryParams", $queryParams);
190
+
191
+ $csrfTokenFromSession = $this->csrfTokenStore->get();
192
+ Checker::argStringOrNull("this->csrfTokenStore->get()", $csrfTokenFromSession);
193
+
194
+ // Check well-formedness of request.
195
+
196
+ if (!isset($queryParams['state'])) {
197
+ throw new WebAuthException_BadRequest("Missing query parameter 'state'.");
198
+ }
199
+ $state = $queryParams['state'];
200
+ Checker::argString("queryParams['state']", $state);
201
+
202
+ $error = null;
203
+ $errorDescription = null;
204
+ if (isset($queryParams['error'])) {
205
+ $error = $queryParams['error'];
206
+ Checker::argString("queryParams['error']", $error);
207
+ if (isset($queryParams['error_description'])) {
208
+ $errorDescription = $queryParams['error_description'];
209
+ Checker::argString("queryParams['error_description']", $errorDescription);
210
+ }
211
+ }
212
+
213
+ $code = null;
214
+ if (isset($queryParams['code'])) {
215
+ $code = $queryParams['code'];
216
+ Checker::argString("queryParams['code']", $code);
217
+ }
218
+
219
+ if ($code !== null && $error !== null) {
220
+ throw new WebAuthException_BadRequest("Query parameters 'code' and 'error' are both set;".
221
+ " only one must be set.");
222
+ }
223
+ if ($code === null && $error === null) {
224
+ throw new WebAuthException_BadRequest("Neither query parameter 'code' or 'error' is set.");
225
+ }
226
+
227
+ // Check CSRF token
228
+
229
+ if ($csrfTokenFromSession === null) {
230
+ throw new WebAuthException_BadState();
231
+ }
232
+
233
+ $splitPos = strpos($state, "|");
234
+ if ($splitPos === false) {
235
+ $givenCsrfToken = $state;
236
+ $urlState = null;
237
+ } else {
238
+ $givenCsrfToken = substr($state, 0, $splitPos);
239
+ $urlState = substr($state, $splitPos + 1);
240
+ }
241
+ if (!Security::stringEquals($csrfTokenFromSession, $givenCsrfToken)) {
242
+ throw new WebAuthException_Csrf("Expected ".Util::q($csrfTokenFromSession) .
243
+ ", got ".Util::q($givenCsrfToken) .".");
244
+ }
245
+ $this->csrfTokenStore->clear();
246
+
247
+ // Check for error identifier
248
+
249
+ if ($error !== null) {
250
+ if ($error === 'access_denied') {
251
+ // When the user clicks "Deny".
252
+ if ($errorDescription === null) {
253
+ throw new WebAuthException_NotApproved("No additional description from Dropbox.");
254
+ } else {
255
+ throw new WebAuthException_NotApproved("Additional description from Dropbox: $errorDescription");
256
+ }
257
+ } else {
258
+ // All other errors.
259
+ $fullMessage = $error;
260
+ if ($errorDescription !== null) {
261
+ $fullMessage .= ": ";
262
+ $fullMessage .= $errorDescription;
263
+ }
264
+ throw new WebAuthException_Provider($fullMessage);
265
+ }
266
+ }
267
+
268
+ // If everything went ok, make the network call to get an access token.
269
+
270
+ list($accessToken, $userId) = $this->_finish($code, $this->redirectUri);
271
+ return array($accessToken, $userId, $urlState);
272
+ }
273
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthBase.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * The base class for the two auth options.
6
+ */
7
+ class WebAuthBase extends AuthBase
8
+ {
9
+ protected function _getAuthorizeUrl($redirectUri, $state)
10
+ {
11
+ return RequestUtil::buildUrlForGetOrPut(
12
+ $this->userLocale,
13
+ $this->appInfo->getHost()->getWeb(),
14
+ "1/oauth2/authorize",
15
+ array(
16
+ "client_id" => $this->appInfo->getKey(),
17
+ "response_type" => "code",
18
+ "redirect_uri" => $redirectUri,
19
+ "state" => $state,
20
+ ));
21
+ }
22
+
23
+ protected function _finish($code, $originalRedirectUri)
24
+ {
25
+ // This endpoint requires "Basic" auth.
26
+ $clientCredentials = $this->appInfo->getKey().":".$this->appInfo->getSecret();
27
+ $authHeaderValue = "Basic ".base64_encode($clientCredentials);
28
+
29
+ $response = RequestUtil::doPostWithSpecificAuth(
30
+ $this->clientIdentifier, $authHeaderValue, $this->userLocale,
31
+ $this->appInfo->getHost()->getApi(),
32
+ "1/oauth2/token",
33
+ array(
34
+ "grant_type" => "authorization_code",
35
+ "code" => $code,
36
+ "redirect_uri" => $originalRedirectUri,
37
+ ));
38
+
39
+ if ($response->statusCode !== 200) throw RequestUtil::unexpectedStatus($response);
40
+
41
+ $parts = RequestUtil::parseResponseJson($response->body);
42
+
43
+ if (!array_key_exists('token_type', $parts) || !is_string($parts['token_type'])) {
44
+ throw new Exception_BadResponse("Missing \"token_type\" field.");
45
+ }
46
+ $tokenType = $parts['token_type'];
47
+ if (!array_key_exists('access_token', $parts) || !is_string($parts['access_token'])) {
48
+ throw new Exception_BadResponse("Missing \"access_token\" field.");
49
+ }
50
+ $accessToken = $parts['access_token'];
51
+ if (!array_key_exists('uid', $parts) || !is_string($parts['uid'])) {
52
+ throw new Exception_BadResponse("Missing \"uid\" string field.");
53
+ }
54
+ $userId = $parts['uid'];
55
+
56
+ if ($tokenType !== "Bearer" && $tokenType !== "bearer") {
57
+ throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got "
58
+ .Util::q($tokenType));
59
+ }
60
+
61
+ return array($accessToken, $userId);
62
+ }
63
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/BadRequest.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown if the redirect URL was missing parameters or if the given parameters were not valid.
6
+ *
7
+ * The recommended action is to show an HTTP 400 error page.
8
+ */
9
+ class WebAuthException_BadRequest extends \Exception
10
+ {
11
+ /**
12
+ * @param string $message
13
+ *
14
+ * @internal
15
+ */
16
+ function __construct($message)
17
+ {
18
+ parent::__construct($message);
19
+ }
20
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/BadState.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown if all the parameters are correct, but there's no CSRF token in the session. This
6
+ * probably means that the session expired.
7
+ *
8
+ * The recommended action is to redirect the user's browser to try the approval process again.
9
+ */
10
+ class WebAuthException_BadState extends \Exception
11
+ {
12
+ /**
13
+ * @internal
14
+ */
15
+ function __construct()
16
+ {
17
+ parent::__construct("Missing CSRF token in session.");
18
+ }
19
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/Csrf.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown if the given 'state' parameter doesn't contain the CSRF token from the user's session.
6
+ * This is blocked to prevent CSRF attacks.
7
+ *
8
+ * The recommended action is to respond with an HTTP 403 error page.
9
+ */
10
+ class WebAuthException_Csrf extends \Exception
11
+ {
12
+ /**
13
+ * @param string $message
14
+ *
15
+ * @internal
16
+ */
17
+ function __construct($message)
18
+ {
19
+ parent::__construct($message);
20
+ }
21
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/NotApproved.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown if the user chose not to grant your app access to their Dropbox account.
6
+ */
7
+ class WebAuthException_NotApproved extends \Exception
8
+ {
9
+ /**
10
+ * @param string $message
11
+ *
12
+ * @internal
13
+ */
14
+ function __construct($message)
15
+ {
16
+ parent::__construct($message);
17
+ }
18
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthException/Provider.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Thrown if Dropbox returns some other error about the authorization request.
6
+ */
7
+ class WebAuthException_Provider extends \Exception
8
+ {
9
+ /**
10
+ * @param string $message
11
+ *
12
+ * @internal
13
+ */
14
+ function __construct($message)
15
+ {
16
+ parent::__construct($message);
17
+ }
18
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WebAuthNoRedirect.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * OAuth 2 code-based authorization for apps that can't provide a redirect URI, typically
6
+ * command-line example apps.
7
+ *
8
+ * Use {@link WebAuth::start()} and {@link WebAuth::getToken()} to guide your
9
+ * user through the process of giving your app access to their Dropbox account. At the end, you
10
+ * will have an {@link AccessToken}, which you can pass to {@link Client} and start making
11
+ * API calls.
12
+ *
13
+ * Example:
14
+ *
15
+ * <code>
16
+ * use \Dropbox as dbx;
17
+ * $appInfo = dbx\AppInfo::loadFromJsonFile(...);
18
+ * $clientIdentifier = "my-app/1.0";
19
+ * $webAuth = new dbx\WebAuthNoRedirect($appInfo, $clientIdentifier, ...);
20
+ *
21
+ * $authorizeUrl = $webAuth->start();
22
+ *
23
+ * print("1. Go to: $authorizeUrl\n");
24
+ * print("2. Click "Allow" (you might have to log in first).\n");
25
+ * print("3. Copy the authorization code.\n");
26
+ * print("Enter the authorization code here: ");
27
+ * $code = \trim(\fgets(STDIN));
28
+ *
29
+ * try {
30
+ * list($accessToken, $userId) = $webAuth->finish($code);
31
+ * }
32
+ * catch (dbx\Exception $ex) {
33
+ * print("Error communicating with Dropbox API: " . $ex->getMessage() . "\n");
34
+ * }
35
+ *
36
+ * $client = dbx\Client($accessToken, $clientIdentifier, ...);
37
+ * </code>
38
+ */
39
+ class WebAuthNoRedirect extends WebAuthBase
40
+ {
41
+ /**
42
+ * Returns the URL of the authorization page the user must visit. If the user approves
43
+ * your app, they will be shown the authorization code on the web page. They will need to
44
+ * copy/paste that code into your application so your app can pass it to
45
+ * {@link finish}.
46
+ *
47
+ * See <a href="https://www.dropbox.com/developers/core/docs#oa2-authorize">/oauth2/authorize</a>.
48
+ *
49
+ * @return string
50
+ * An authorization URL. Direct the user's browser to this URL. After the user decides
51
+ * whether to authorize your app or not, Dropbox will show the user an authorization code,
52
+ * which the user will need to give to your application (e.g. via copy/paste).
53
+ */
54
+ function start()
55
+ {
56
+ return $this->_getAuthorizeUrl(null, null);
57
+ }
58
+
59
+ /**
60
+ * Call this after the user has visited the authorize URL returned by {@link start()},
61
+ * approved your app, was presented with an authorization code by Dropbox, and has copy/paste'd
62
+ * that authorization code into your app.
63
+ *
64
+ * See <a href="https://www.dropbox.com/developers/core/docs#oa2-token">/oauth2/token</a>.
65
+ *
66
+ * @param string $code
67
+ * The authorization code provided to the user by Dropbox.
68
+ *
69
+ * @return array
70
+ * A <code>list(string $accessToken, string $userId)</code>, where
71
+ * <code>$accessToken</code> can be used to construct a {@link Client} and
72
+ * <code>$userId</code> is the user ID of the user's Dropbox account.
73
+ *
74
+ * @throws Exception
75
+ * Thrown if there's an error getting the access token from Dropbox.
76
+ */
77
+ function finish($code)
78
+ {
79
+ Checker::argStringNonEmpty("code", $code);
80
+ return $this->_finish($code, null);
81
+ }
82
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/WriteMode.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ /**
5
+ * Describes how a file should be saved when it is written to Dropbox.
6
+ */
7
+ final class WriteMode
8
+ {
9
+ /**
10
+ * The URL parameters to pass to the file uploading endpoint to achieve the
11
+ * desired write mode.
12
+ *
13
+ * @var array
14
+ */
15
+ private $extraParams;
16
+
17
+ /**
18
+ * @internal
19
+ */
20
+ private function __construct($extraParams)
21
+ {
22
+ $this->extraParams = $extraParams;
23
+ }
24
+
25
+ /**
26
+ * @internal
27
+ */
28
+ function getExtraParams()
29
+ {
30
+ return $this->extraParams;
31
+ }
32
+
33
+ /**
34
+ * Returns a {@link WriteMode} for adding a new file. If a file at the specified path already
35
+ * exists, the new file will be renamed automatically.
36
+ *
37
+ * For example, if you're trying to upload a file to "/Notes/Groceries.txt", but there's
38
+ * already a file there, your file will be written to "/Notes/Groceries (1).txt".
39
+ *
40
+ * You can determine whether your file was renamed by checking the "path" field of the
41
+ * metadata object returned by the API call.
42
+ *
43
+ * @return WriteMode
44
+ */
45
+ static function add()
46
+ {
47
+ if (self::$addInstance === null) {
48
+ self::$addInstance = new WriteMode(array("overwrite" => "false"));
49
+ }
50
+ return self::$addInstance;
51
+ }
52
+ private static $addInstance = null;
53
+
54
+ /**
55
+ * Returns a {@link WriteMode} for forcing a file to be at a certain path. If there's already
56
+ * a file at that path, the existing file will be overwritten. If there's a folder at that
57
+ * path, however, it will not be overwritten and the API call will fail.
58
+ *
59
+ * @return WriteMode
60
+ */
61
+ static function force()
62
+ {
63
+ if (self::$forceInstance === null) {
64
+ self::$forceInstance = new WriteMode(array("overwrite" => "true"));
65
+ }
66
+ return self::$forceInstance;
67
+ }
68
+ private static $forceInstance = null;
69
+
70
+ /**
71
+ * Returns a {@link WriteMode} for updating an existing file. This is useful for when you
72
+ * have downloaded a file, made modifications, and want to save your modifications back to
73
+ * Dropbox. You need to specify the revision of the copy of the file you downloaded (it's
74
+ * the "rev" parameter of the file's metadata object).
75
+ *
76
+ * If, when you attempt to save, the revision of the file currently on Dropbox matches
77
+ * $revToReplace, the file on Dropbox will be overwritten with the new contents you provide.
78
+ *
79
+ * If the revision of the file currently on Dropbox doesn't match $revToReplace, Dropbox will
80
+ * create a new file and save your contents to that file. For example, if the original file
81
+ * path is "/Notes/Groceries.txt", the new file's path might be
82
+ * "/Notes/Groceries (conflicted copy).txt".
83
+ *
84
+ * You can determine whether your file was renamed by checking the "path" field of the
85
+ * metadata object returned by the API call.
86
+ *
87
+ * @param string $revToReplace
88
+ * @return WriteMode
89
+ */
90
+ static function update($revToReplace)
91
+ {
92
+ return new WriteMode(array("parent_rev" => $revToReplace));
93
+ }
94
+
95
+ /**
96
+ * Check that a function argument is of type <code>WriteMode</code>.
97
+ *
98
+ * @internal
99
+ */
100
+ static function checkArg($argName, $argValue)
101
+ {
102
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
103
+ }
104
+
105
+ /**
106
+ * Check that a function argument is either <code>null</code> or of type
107
+ * <code>WriteMode</code>.
108
+ *
109
+ * @internal
110
+ */
111
+ static function checkArgOrNull($argName, $argValue)
112
+ {
113
+ if ($argValue === null) return;
114
+ if (!($argValue instanceof self)) Checker::throwError($argName, $argValue, __CLASS__);
115
+ }
116
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/autoload.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Dropbox;
3
+
4
+ // The Dropbox SDK autoloader. You probably shouldn't be using this. Instead,
5
+ // use a global autoloader, like the Composer autoloader.
6
+ //
7
+ // But if you really don't want to use a global autoloader, do this:
8
+ //
9
+ // require_once "<path-to-here>/Dropbox/autoload.php"
10
+
11
+ /**
12
+ * @internal
13
+ */
14
+ function autoload($name)
15
+ {
16
+ // If the name doesn't start with "Dropbox\", then its not once of our classes.
17
+ if (\substr_compare($name, "Dropbox\\", 0, 8) !== 0) return;
18
+
19
+ // Take the "Dropbox\" prefix off.
20
+ $stem = \substr($name, 8);
21
+
22
+ // Convert "\" and "_" to path separators.
23
+ $pathified_stem = \str_replace(array("\\", "_"), '/', $stem);
24
+
25
+ $path = __DIR__ . "/" . $pathified_stem . ".php";
26
+ if (\is_file($path)) {
27
+ require_once $path;
28
+ }
29
+ }
30
+
31
+ \spl_autoload_register('Dropbox\autoload');
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/certs/trusted-certs.crt ADDED
@@ -0,0 +1,1396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DigiCert Assured ID Root CA.pem
2
+ # Certificate:
3
+ # Data:
4
+ # Version: 3 (0x2)
5
+ # Serial Number:
6
+ # 0c:e7:e0:e5:17:d8:46:fe:8f:e5:60:fc:1b:f0:30:39
7
+ # Signature Algorithm: sha1WithRSAEncryption
8
+ # Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
9
+ # Validity
10
+ # Not Before: Nov 10 00:00:00 2006 GMT
11
+ # Not After : Nov 10 00:00:00 2031 GMT
12
+ # Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
13
+ # Subject Public Key Info:
14
+ # Public Key Algorithm: rsaEncryption
15
+ # Public-Key: (2048 bit)
16
+ # Modulus:
17
+ # 00:ad:0e:15:ce:e4:43:80:5c:b1:87:f3:b7:60:f9:
18
+ # 71:12:a5:ae:dc:26:94:88:aa:f4:ce:f5:20:39:28:
19
+ # 58:60:0c:f8:80:da:a9:15:95:32:61:3c:b5:b1:28:
20
+ # 84:8a:8a:dc:9f:0a:0c:83:17:7a:8f:90:ac:8a:e7:
21
+ # 79:53:5c:31:84:2a:f6:0f:98:32:36:76:cc:de:dd:
22
+ # 3c:a8:a2:ef:6a:fb:21:f2:52:61:df:9f:20:d7:1f:
23
+ # e2:b1:d9:fe:18:64:d2:12:5b:5f:f9:58:18:35:bc:
24
+ # 47:cd:a1:36:f9:6b:7f:d4:b0:38:3e:c1:1b:c3:8c:
25
+ # 33:d9:d8:2f:18:fe:28:0f:b3:a7:83:d6:c3:6e:44:
26
+ # c0:61:35:96:16:fe:59:9c:8b:76:6d:d7:f1:a2:4b:
27
+ # 0d:2b:ff:0b:72:da:9e:60:d0:8e:90:35:c6:78:55:
28
+ # 87:20:a1:cf:e5:6d:0a:c8:49:7c:31:98:33:6c:22:
29
+ # e9:87:d0:32:5a:a2:ba:13:82:11:ed:39:17:9d:99:
30
+ # 3a:72:a1:e6:fa:a4:d9:d5:17:31:75:ae:85:7d:22:
31
+ # ae:3f:01:46:86:f6:28:79:c8:b1:da:e4:57:17:c4:
32
+ # 7e:1c:0e:b0:b4:92:a6:56:b3:bd:b2:97:ed:aa:a7:
33
+ # f0:b7:c5:a8:3f:95:16:d0:ff:a1:96:eb:08:5f:18:
34
+ # 77:4f
35
+ # Exponent: 65537 (0x10001)
36
+ # X509v3 extensions:
37
+ # X509v3 Key Usage: critical
38
+ # Digital Signature, Certificate Sign, CRL Sign
39
+ # X509v3 Basic Constraints: critical
40
+ # CA:TRUE
41
+ # X509v3 Subject Key Identifier:
42
+ # 45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F
43
+ # X509v3 Authority Key Identifier:
44
+ # keyid:45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F
45
+ #
46
+ # Signature Algorithm: sha1WithRSAEncryption
47
+ # a2:0e:bc:df:e2:ed:f0:e3:72:73:7a:64:94:bf:f7:72:66:d8:
48
+ # 32:e4:42:75:62:ae:87:eb:f2:d5:d9:de:56:b3:9f:cc:ce:14:
49
+ # 28:b9:0d:97:60:5c:12:4c:58:e4:d3:3d:83:49:45:58:97:35:
50
+ # 69:1a:a8:47:ea:56:c6:79:ab:12:d8:67:81:84:df:7f:09:3c:
51
+ # 94:e6:b8:26:2c:20:bd:3d:b3:28:89:f7:5f:ff:22:e2:97:84:
52
+ # 1f:e9:65:ef:87:e0:df:c1:67:49:b3:5d:eb:b2:09:2a:eb:26:
53
+ # ed:78:be:7d:3f:2b:f3:b7:26:35:6d:5f:89:01:b6:49:5b:9f:
54
+ # 01:05:9b:ab:3d:25:c1:cc:b6:7f:c2:f1:6f:86:c6:fa:64:68:
55
+ # eb:81:2d:94:eb:42:b7:fa:8c:1e:dd:62:f1:be:50:67:b7:6c:
56
+ # bd:f3:f1:1f:6b:0c:36:07:16:7f:37:7c:a9:5b:6d:7a:f1:12:
57
+ # 46:60:83:d7:27:04:be:4b:ce:97:be:c3:67:2a:68:11:df:80:
58
+ # e7:0c:33:66:bf:13:0d:14:6e:f3:7f:1f:63:10:1e:fa:8d:1b:
59
+ # 25:6d:6c:8f:a5:b7:61:01:b1:d2:a3:26:a1:10:71:9d:ad:e2:
60
+ # c3:f9:c3:99:51:b7:2b:07:08:ce:2e:e6:50:b2:a7:fa:0a:45:
61
+ # 2f:a2:f0:f2
62
+ -----BEGIN CERTIFICATE-----
63
+ MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
64
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
65
+ d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
66
+ b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
67
+ EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
68
+ cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
69
+ MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
70
+ JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP
71
+ mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+
72
+ wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4
73
+ VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/
74
+ AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB
75
+ AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
76
+ BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun
77
+ pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC
78
+ dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf
79
+ fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm
80
+ NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx
81
+ H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
82
+ +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
83
+ -----END CERTIFICATE-----
84
+ # DigiCert Global Root CA.pem
85
+ # Certificate:
86
+ # Data:
87
+ # Version: 3 (0x2)
88
+ # Serial Number:
89
+ # 08:3b:e0:56:90:42:46:b1:a1:75:6a:c9:59:91:c7:4a
90
+ # Signature Algorithm: sha1WithRSAEncryption
91
+ # Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
92
+ # Validity
93
+ # Not Before: Nov 10 00:00:00 2006 GMT
94
+ # Not After : Nov 10 00:00:00 2031 GMT
95
+ # Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
96
+ # Subject Public Key Info:
97
+ # Public Key Algorithm: rsaEncryption
98
+ # Public-Key: (2048 bit)
99
+ # Modulus:
100
+ # 00:e2:3b:e1:11:72:de:a8:a4:d3:a3:57:aa:50:a2:
101
+ # 8f:0b:77:90:c9:a2:a5:ee:12:ce:96:5b:01:09:20:
102
+ # cc:01:93:a7:4e:30:b7:53:f7:43:c4:69:00:57:9d:
103
+ # e2:8d:22:dd:87:06:40:00:81:09:ce:ce:1b:83:bf:
104
+ # df:cd:3b:71:46:e2:d6:66:c7:05:b3:76:27:16:8f:
105
+ # 7b:9e:1e:95:7d:ee:b7:48:a3:08:da:d6:af:7a:0c:
106
+ # 39:06:65:7f:4a:5d:1f:bc:17:f8:ab:be:ee:28:d7:
107
+ # 74:7f:7a:78:99:59:85:68:6e:5c:23:32:4b:bf:4e:
108
+ # c0:e8:5a:6d:e3:70:bf:77:10:bf:fc:01:f6:85:d9:
109
+ # a8:44:10:58:32:a9:75:18:d5:d1:a2:be:47:e2:27:
110
+ # 6a:f4:9a:33:f8:49:08:60:8b:d4:5f:b4:3a:84:bf:
111
+ # a1:aa:4a:4c:7d:3e:cf:4f:5f:6c:76:5e:a0:4b:37:
112
+ # 91:9e:dc:22:e6:6d:ce:14:1a:8e:6a:cb:fe:cd:b3:
113
+ # 14:64:17:c7:5b:29:9e:32:bf:f2:ee:fa:d3:0b:42:
114
+ # d4:ab:b7:41:32:da:0c:d4:ef:f8:81:d5:bb:8d:58:
115
+ # 3f:b5:1b:e8:49:28:a2:70:da:31:04:dd:f7:b2:16:
116
+ # f2:4c:0a:4e:07:a8:ed:4a:3d:5e:b5:7f:a3:90:c3:
117
+ # af:27
118
+ # Exponent: 65537 (0x10001)
119
+ # X509v3 extensions:
120
+ # X509v3 Key Usage: critical
121
+ # Digital Signature, Certificate Sign, CRL Sign
122
+ # X509v3 Basic Constraints: critical
123
+ # CA:TRUE
124
+ # X509v3 Subject Key Identifier:
125
+ # 03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
126
+ # X509v3 Authority Key Identifier:
127
+ # keyid:03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55
128
+ #
129
+ # Signature Algorithm: sha1WithRSAEncryption
130
+ # cb:9c:37:aa:48:13:12:0a:fa:dd:44:9c:4f:52:b0:f4:df:ae:
131
+ # 04:f5:79:79:08:a3:24:18:fc:4b:2b:84:c0:2d:b9:d5:c7:fe:
132
+ # f4:c1:1f:58:cb:b8:6d:9c:7a:74:e7:98:29:ab:11:b5:e3:70:
133
+ # a0:a1:cd:4c:88:99:93:8c:91:70:e2:ab:0f:1c:be:93:a9:ff:
134
+ # 63:d5:e4:07:60:d3:a3:bf:9d:5b:09:f1:d5:8e:e3:53:f4:8e:
135
+ # 63:fa:3f:a7:db:b4:66:df:62:66:d6:d1:6e:41:8d:f2:2d:b5:
136
+ # ea:77:4a:9f:9d:58:e2:2b:59:c0:40:23:ed:2d:28:82:45:3e:
137
+ # 79:54:92:26:98:e0:80:48:a8:37:ef:f0:d6:79:60:16:de:ac:
138
+ # e8:0e:cd:6e:ac:44:17:38:2f:49:da:e1:45:3e:2a:b9:36:53:
139
+ # cf:3a:50:06:f7:2e:e8:c4:57:49:6c:61:21:18:d5:04:ad:78:
140
+ # 3c:2c:3a:80:6b:a7:eb:af:15:14:e9:d8:89:c1:b9:38:6c:e2:
141
+ # 91:6c:8a:ff:64:b9:77:25:57:30:c0:1b:24:a3:e1:dc:e9:df:
142
+ # 47:7c:b5:b4:24:08:05:30:ec:2d:bd:0b:bf:45:bf:50:b9:a9:
143
+ # f3:eb:98:01:12:ad:c8:88:c6:98:34:5f:8d:0a:3c:c6:e9:d5:
144
+ # 95:95:6d:de
145
+ -----BEGIN CERTIFICATE-----
146
+ MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
147
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
148
+ d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
149
+ QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
150
+ MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
151
+ b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
152
+ 9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
153
+ CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
154
+ nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
155
+ 43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
156
+ T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
157
+ gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
158
+ BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
159
+ TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
160
+ DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
161
+ hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
162
+ 06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
163
+ PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
164
+ YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
165
+ CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
166
+ -----END CERTIFICATE-----
167
+ # DigiCert High Assurance EV Root CA.pem
168
+ # Certificate:
169
+ # Data:
170
+ # Version: 3 (0x2)
171
+ # Serial Number:
172
+ # 02:ac:5c:26:6a:0b:40:9b:8f:0b:79:f2:ae:46:25:77
173
+ # Signature Algorithm: sha1WithRSAEncryption
174
+ # Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
175
+ # Validity
176
+ # Not Before: Nov 10 00:00:00 2006 GMT
177
+ # Not After : Nov 10 00:00:00 2031 GMT
178
+ # Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
179
+ # Subject Public Key Info:
180
+ # Public Key Algorithm: rsaEncryption
181
+ # Public-Key: (2048 bit)
182
+ # Modulus:
183
+ # 00:c6:cc:e5:73:e6:fb:d4:bb:e5:2d:2d:32:a6:df:
184
+ # e5:81:3f:c9:cd:25:49:b6:71:2a:c3:d5:94:34:67:
185
+ # a2:0a:1c:b0:5f:69:a6:40:b1:c4:b7:b2:8f:d0:98:
186
+ # a4:a9:41:59:3a:d3:dc:94:d6:3c:db:74:38:a4:4a:
187
+ # cc:4d:25:82:f7:4a:a5:53:12:38:ee:f3:49:6d:71:
188
+ # 91:7e:63:b6:ab:a6:5f:c3:a4:84:f8:4f:62:51:be:
189
+ # f8:c5:ec:db:38:92:e3:06:e5:08:91:0c:c4:28:41:
190
+ # 55:fb:cb:5a:89:15:7e:71:e8:35:bf:4d:72:09:3d:
191
+ # be:3a:38:50:5b:77:31:1b:8d:b3:c7:24:45:9a:a7:
192
+ # ac:6d:00:14:5a:04:b7:ba:13:eb:51:0a:98:41:41:
193
+ # 22:4e:65:61:87:81:41:50:a6:79:5c:89:de:19:4a:
194
+ # 57:d5:2e:e6:5d:1c:53:2c:7e:98:cd:1a:06:16:a4:
195
+ # 68:73:d0:34:04:13:5c:a1:71:d3:5a:7c:55:db:5e:
196
+ # 64:e1:37:87:30:56:04:e5:11:b4:29:80:12:f1:79:
197
+ # 39:88:a2:02:11:7c:27:66:b7:88:b7:78:f2:ca:0a:
198
+ # a8:38:ab:0a:64:c2:bf:66:5d:95:84:c1:a1:25:1e:
199
+ # 87:5d:1a:50:0b:20:12:cc:41:bb:6e:0b:51:38:b8:
200
+ # 4b:cb
201
+ # Exponent: 65537 (0x10001)
202
+ # X509v3 extensions:
203
+ # X509v3 Key Usage: critical
204
+ # Digital Signature, Certificate Sign, CRL Sign
205
+ # X509v3 Basic Constraints: critical
206
+ # CA:TRUE
207
+ # X509v3 Subject Key Identifier:
208
+ # B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3
209
+ # X509v3 Authority Key Identifier:
210
+ # keyid:B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3
211
+ #
212
+ # Signature Algorithm: sha1WithRSAEncryption
213
+ # 1c:1a:06:97:dc:d7:9c:9f:3c:88:66:06:08:57:21:db:21:47:
214
+ # f8:2a:67:aa:bf:18:32:76:40:10:57:c1:8a:f3:7a:d9:11:65:
215
+ # 8e:35:fa:9e:fc:45:b5:9e:d9:4c:31:4b:b8:91:e8:43:2c:8e:
216
+ # b3:78:ce:db:e3:53:79:71:d6:e5:21:94:01:da:55:87:9a:24:
217
+ # 64:f6:8a:66:cc:de:9c:37:cd:a8:34:b1:69:9b:23:c8:9e:78:
218
+ # 22:2b:70:43:e3:55:47:31:61:19:ef:58:c5:85:2f:4e:30:f6:
219
+ # a0:31:16:23:c8:e7:e2:65:16:33:cb:bf:1a:1b:a0:3d:f8:ca:
220
+ # 5e:8b:31:8b:60:08:89:2d:0c:06:5c:52:b7:c4:f9:0a:98:d1:
221
+ # 15:5f:9f:12:be:7c:36:63:38:bd:44:a4:7f:e4:26:2b:0a:c4:
222
+ # 97:69:0d:e9:8c:e2:c0:10:57:b8:c8:76:12:91:55:f2:48:69:
223
+ # d8:bc:2a:02:5b:0f:44:d4:20:31:db:f4:ba:70:26:5d:90:60:
224
+ # 9e:bc:4b:17:09:2f:b4:cb:1e:43:68:c9:07:27:c1:d2:5c:f7:
225
+ # ea:21:b9:68:12:9c:3c:9c:bf:9e:fc:80:5c:9b:63:cd:ec:47:
226
+ # aa:25:27:67:a0:37:f3:00:82:7d:54:d7:a9:f8:e9:2e:13:a3:
227
+ # 77:e8:1f:4a
228
+ -----BEGIN CERTIFICATE-----
229
+ MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs
230
+ MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
231
+ d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j
232
+ ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL
233
+ MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3
234
+ LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug
235
+ RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm
236
+ +9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW
237
+ PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM
238
+ xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB
239
+ Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3
240
+ hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg
241
+ EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF
242
+ MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA
243
+ FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec
244
+ nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z
245
+ eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF
246
+ hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2
247
+ Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
248
+ vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep
249
+ +OkuE6N36B9K
250
+ -----END CERTIFICATE-----
251
+ # Entrust Root Certification Authority - EC1.pem
252
+ # Certificate:
253
+ # Data:
254
+ # Version: 3 (0x2)
255
+ # Serial Number:
256
+ # a6:8b:79:29:00:00:00:00:50:d0:91:f9
257
+ # Signature Algorithm: ecdsa-with-SHA384
258
+ # Issuer: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2012 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - EC1
259
+ # Validity
260
+ # Not Before: Dec 18 15:25:36 2012 GMT
261
+ # Not After : Dec 18 15:55:36 2037 GMT
262
+ # Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2012 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - EC1
263
+ # Subject Public Key Info:
264
+ # Public Key Algorithm: id-ecPublicKey
265
+ # Public-Key: (384 bit)
266
+ # pub:
267
+ # 04:84:13:c9:d0:ba:6d:41:7b:e2:6c:d0:eb:55:5f:
268
+ # 66:02:1a:24:f4:5b:89:69:47:e3:b8:c2:7d:f1:f2:
269
+ # 02:c5:9f:a0:f6:5b:d5:8b:06:19:86:4f:53:10:6d:
270
+ # 07:24:27:a1:a0:f8:d5:47:19:61:4c:7d:ca:93:27:
271
+ # ea:74:0c:ef:6f:96:09:fe:63:ec:70:5d:36:ad:67:
272
+ # 77:ae:c9:9d:7c:55:44:3a:a2:63:51:1f:f5:e3:62:
273
+ # d4:a9:47:07:3e:cc:20
274
+ # ASN1 OID: secp384r1
275
+ # X509v3 extensions:
276
+ # X509v3 Key Usage: critical
277
+ # Certificate Sign, CRL Sign
278
+ # X509v3 Basic Constraints: critical
279
+ # CA:TRUE
280
+ # X509v3 Subject Key Identifier:
281
+ # B7:63:E7:1A:DD:8D:E9:08:A6:55:83:A4:E0:6A:50:41:65:11:42:49
282
+ # Signature Algorithm: ecdsa-with-SHA384
283
+ # 30:64:02:30:61:79:d8:e5:42:47:df:1c:ae:53:99:17:b6:6f:
284
+ # 1c:7d:e1:bf:11:94:d1:03:88:75:e4:8d:89:a4:8a:77:46:de:
285
+ # 6d:61:ef:02:f5:fb:b5:df:cc:fe:4e:ff:fe:a9:e6:a7:02:30:
286
+ # 5b:99:d7:85:37:06:b5:7b:08:fd:eb:27:8b:4a:94:f9:e1:fa:
287
+ # a7:8e:26:08:e8:7c:92:68:6d:73:d8:6f:26:ac:21:02:b8:99:
288
+ # b7:26:41:5b:25:60:ae:d0:48:1a:ee:06
289
+ -----BEGIN CERTIFICATE-----
290
+ MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG
291
+ A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3
292
+ d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu
293
+ dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq
294
+ RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy
295
+ MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD
296
+ VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
297
+ L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g
298
+ Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD
299
+ ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi
300
+ A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt
301
+ ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH
302
+ Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
303
+ BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC
304
+ R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX
305
+ hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
306
+ -----END CERTIFICATE-----
307
+ # Entrust Root Certification Authority - G2.pem
308
+ # Certificate:
309
+ # Data:
310
+ # Version: 3 (0x2)
311
+ # Serial Number: 1246989352 (0x4a538c28)
312
+ # Signature Algorithm: sha256WithRSAEncryption
313
+ # Issuer: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2009 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - G2
314
+ # Validity
315
+ # Not Before: Jul 7 17:25:54 2009 GMT
316
+ # Not After : Dec 7 17:55:54 2030 GMT
317
+ # Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2009 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - G2
318
+ # Subject Public Key Info:
319
+ # Public Key Algorithm: rsaEncryption
320
+ # Public-Key: (2048 bit)
321
+ # Modulus:
322
+ # 00:ba:84:b6:72:db:9e:0c:6b:e2:99:e9:30:01:a7:
323
+ # 76:ea:32:b8:95:41:1a:c9:da:61:4e:58:72:cf:fe:
324
+ # f6:82:79:bf:73:61:06:0a:a5:27:d8:b3:5f:d3:45:
325
+ # 4e:1c:72:d6:4e:32:f2:72:8a:0f:f7:83:19:d0:6a:
326
+ # 80:80:00:45:1e:b0:c7:e7:9a:bf:12:57:27:1c:a3:
327
+ # 68:2f:0a:87:bd:6a:6b:0e:5e:65:f3:1c:77:d5:d4:
328
+ # 85:8d:70:21:b4:b3:32:e7:8b:a2:d5:86:39:02:b1:
329
+ # b8:d2:47:ce:e4:c9:49:c4:3b:a7:de:fb:54:7d:57:
330
+ # be:f0:e8:6e:c2:79:b2:3a:0b:55:e2:50:98:16:32:
331
+ # 13:5c:2f:78:56:c1:c2:94:b3:f2:5a:e4:27:9a:9f:
332
+ # 24:d7:c6:ec:d0:9b:25:82:e3:cc:c2:c4:45:c5:8c:
333
+ # 97:7a:06:6b:2a:11:9f:a9:0a:6e:48:3b:6f:db:d4:
334
+ # 11:19:42:f7:8f:07:bf:f5:53:5f:9c:3e:f4:17:2c:
335
+ # e6:69:ac:4e:32:4c:62:77:ea:b7:e8:e5:bb:34:bc:
336
+ # 19:8b:ae:9c:51:e7:b7:7e:b5:53:b1:33:22:e5:6d:
337
+ # cf:70:3c:1a:fa:e2:9b:67:b6:83:f4:8d:a5:af:62:
338
+ # 4c:4d:e0:58:ac:64:34:12:03:f8:b6:8d:94:63:24:
339
+ # a4:71
340
+ # Exponent: 65537 (0x10001)
341
+ # X509v3 extensions:
342
+ # X509v3 Key Usage: critical
343
+ # Certificate Sign, CRL Sign
344
+ # X509v3 Basic Constraints: critical
345
+ # CA:TRUE
346
+ # X509v3 Subject Key Identifier:
347
+ # 6A:72:26:7A:D0:1E:EF:7D:E7:3B:69:51:D4:6C:8D:9F:90:12:66:AB
348
+ # Signature Algorithm: sha256WithRSAEncryption
349
+ # 79:9f:1d:96:c6:b6:79:3f:22:8d:87:d3:87:03:04:60:6a:6b:
350
+ # 9a:2e:59:89:73:11:ac:43:d1:f5:13:ff:8d:39:2b:c0:f2:bd:
351
+ # 4f:70:8c:a9:2f:ea:17:c4:0b:54:9e:d4:1b:96:98:33:3c:a8:
352
+ # ad:62:a2:00:76:ab:59:69:6e:06:1d:7e:c4:b9:44:8d:98:af:
353
+ # 12:d4:61:db:0a:19:46:47:f3:eb:f7:63:c1:40:05:40:a5:d2:
354
+ # b7:f4:b5:9a:36:bf:a9:88:76:88:04:55:04:2b:9c:87:7f:1a:
355
+ # 37:3c:7e:2d:a5:1a:d8:d4:89:5e:ca:bd:ac:3d:6c:d8:6d:af:
356
+ # d5:f3:76:0f:cd:3b:88:38:22:9d:6c:93:9a:c4:3d:bf:82:1b:
357
+ # 65:3f:a6:0f:5d:aa:fc:e5:b2:15:ca:b5:ad:c6:bc:3d:d0:84:
358
+ # e8:ea:06:72:b0:4d:39:32:78:bf:3e:11:9c:0b:a4:9d:9a:21:
359
+ # f3:f0:9b:0b:30:78:db:c1:dc:87:43:fe:bc:63:9a:ca:c5:c2:
360
+ # 1c:c9:c7:8d:ff:3b:12:58:08:e6:b6:3d:ec:7a:2c:4e:fb:83:
361
+ # 96:ce:0c:3c:69:87:54:73:a4:73:c2:93:ff:51:10:ac:15:54:
362
+ # 01:d8:fc:05:b1:89:a1:7f:74:83:9a:49:d7:dc:4e:7b:8a:48:
363
+ # 6f:8b:45:f6
364
+ -----BEGIN CERTIFICATE-----
365
+ MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC
366
+ VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50
367
+ cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs
368
+ IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz
369
+ dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy
370
+ NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu
371
+ dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt
372
+ dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0
373
+ aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj
374
+ YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
375
+ AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T
376
+ RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN
377
+ cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW
378
+ wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1
379
+ U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0
380
+ jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP
381
+ BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN
382
+ BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/
383
+ jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
384
+ Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v
385
+ 1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R
386
+ nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH
387
+ VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g==
388
+ -----END CERTIFICATE-----
389
+ # Entrust Root Certification Authority.pem
390
+ # Certificate:
391
+ # Data:
392
+ # Version: 3 (0x2)
393
+ # Serial Number: 1164660820 (0x456b5054)
394
+ # Signature Algorithm: sha1WithRSAEncryption
395
+ # Issuer: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority
396
+ # Validity
397
+ # Not Before: Nov 27 20:23:42 2006 GMT
398
+ # Not After : Nov 27 20:53:42 2026 GMT
399
+ # Subject: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority
400
+ # Subject Public Key Info:
401
+ # Public Key Algorithm: rsaEncryption
402
+ # Public-Key: (2048 bit)
403
+ # Modulus:
404
+ # 00:b6:95:b6:43:42:fa:c6:6d:2a:6f:48:df:94:4c:
405
+ # 39:57:05:ee:c3:79:11:41:68:36:ed:ec:fe:9a:01:
406
+ # 8f:a1:38:28:fc:f7:10:46:66:2e:4d:1e:1a:b1:1a:
407
+ # 4e:c6:d1:c0:95:88:b0:c9:ff:31:8b:33:03:db:b7:
408
+ # 83:7b:3e:20:84:5e:ed:b2:56:28:a7:f8:e0:b9:40:
409
+ # 71:37:c5:cb:47:0e:97:2a:68:c0:22:95:62:15:db:
410
+ # 47:d9:f5:d0:2b:ff:82:4b:c9:ad:3e:de:4c:db:90:
411
+ # 80:50:3f:09:8a:84:00:ec:30:0a:3d:18:cd:fb:fd:
412
+ # 2a:59:9a:23:95:17:2c:45:9e:1f:6e:43:79:6d:0c:
413
+ # 5c:98:fe:48:a7:c5:23:47:5c:5e:fd:6e:e7:1e:b4:
414
+ # f6:68:45:d1:86:83:5b:a2:8a:8d:b1:e3:29:80:fe:
415
+ # 25:71:88:ad:be:bc:8f:ac:52:96:4b:aa:51:8d:e4:
416
+ # 13:31:19:e8:4e:4d:9f:db:ac:b3:6a:d5:bc:39:54:
417
+ # 71:ca:7a:7a:7f:90:dd:7d:1d:80:d9:81:bb:59:26:
418
+ # c2:11:fe:e6:93:e2:f7:80:e4:65:fb:34:37:0e:29:
419
+ # 80:70:4d:af:38:86:2e:9e:7f:57:af:9e:17:ae:eb:
420
+ # 1c:cb:28:21:5f:b6:1c:d8:e7:a2:04:22:f9:d3:da:
421
+ # d8:cb
422
+ # Exponent: 65537 (0x10001)
423
+ # X509v3 extensions:
424
+ # X509v3 Key Usage: critical
425
+ # Certificate Sign, CRL Sign
426
+ # X509v3 Basic Constraints: critical
427
+ # CA:TRUE
428
+ # X509v3 Private Key Usage Period:
429
+ # Not Before: Nov 27 20:23:42 2006 GMT, Not After: Nov 27 20:53:42 2026 GMT
430
+ # X509v3 Authority Key Identifier:
431
+ # keyid:68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
432
+ #
433
+ # X509v3 Subject Key Identifier:
434
+ # 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
435
+ # 1.2.840.113533.7.65.0:
436
+ # 0...V7.1:4.0....
437
+ # Signature Algorithm: sha1WithRSAEncryption
438
+ # 93:d4:30:b0:d7:03:20:2a:d0:f9:63:e8:91:0c:05:20:a9:5f:
439
+ # 19:ca:7b:72:4e:d4:b1:db:d0:96:fb:54:5a:19:2c:0c:08:f7:
440
+ # b2:bc:85:a8:9d:7f:6d:3b:52:b3:2a:db:e7:d4:84:8c:63:f6:
441
+ # 0f:cb:26:01:91:50:6c:f4:5f:14:e2:93:74:c0:13:9e:30:3a:
442
+ # 50:e3:b4:60:c5:1c:f0:22:44:8d:71:47:ac:c8:1a:c9:e9:9b:
443
+ # 9a:00:60:13:ff:70:7e:5f:11:4d:49:1b:b3:15:52:7b:c9:54:
444
+ # da:bf:9d:95:af:6b:9a:d8:9e:e9:f1:e4:43:8d:e2:11:44:3a:
445
+ # bf:af:bd:83:42:73:52:8b:aa:bb:a7:29:cf:f5:64:1c:0a:4d:
446
+ # d1:bc:aa:ac:9f:2a:d0:ff:7f:7f:da:7d:ea:b1:ed:30:25:c1:
447
+ # 84:da:34:d2:5b:78:83:56:ec:9c:36:c3:26:e2:11:f6:67:49:
448
+ # 1d:92:ab:8c:fb:eb:ff:7a:ee:85:4a:a7:50:80:f0:a7:5c:4a:
449
+ # 94:2e:5f:05:99:3c:52:41:e0:cd:b4:63:cf:01:43:ba:9c:83:
450
+ # dc:8f:60:3b:f3:5a:b4:b4:7b:ae:da:0b:90:38:75:ef:81:1d:
451
+ # 66:d2:f7:57:70:36:b3:bf:fc:28:af:71:25:85:5b:13:fe:1e:
452
+ # 7f:5a:b4:3c
453
+ -----BEGIN CERTIFICATE-----
454
+ MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC
455
+ VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0
456
+ Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW
457
+ KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl
458
+ cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw
459
+ NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw
460
+ NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy
461
+ ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV
462
+ BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ
463
+ KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo
464
+ Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4
465
+ 4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9
466
+ KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI
467
+ rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi
468
+ 94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB
469
+ sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi
470
+ gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo
471
+ kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE
472
+ vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
473
+ A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t
474
+ O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua
475
+ AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP
476
+ 9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/
477
+ eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m
478
+ 0vdXcDazv/wor3ElhVsT/h5/WrQ8
479
+ -----END CERTIFICATE-----
480
+ # Entrust.net Certification Authority (2048).pem
481
+ # Certificate:
482
+ # Data:
483
+ # Version: 3 (0x2)
484
+ # Serial Number: 946069240 (0x3863def8)
485
+ # Signature Algorithm: sha1WithRSAEncryption
486
+ # Issuer: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
487
+ # Validity
488
+ # Not Before: Dec 24 17:50:51 1999 GMT
489
+ # Not After : Jul 24 14:15:12 2029 GMT
490
+ # Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048)
491
+ # Subject Public Key Info:
492
+ # Public Key Algorithm: rsaEncryption
493
+ # Public-Key: (2048 bit)
494
+ # Modulus:
495
+ # 00:ad:4d:4b:a9:12:86:b2:ea:a3:20:07:15:16:64:
496
+ # 2a:2b:4b:d1:bf:0b:4a:4d:8e:ed:80:76:a5:67:b7:
497
+ # 78:40:c0:73:42:c8:68:c0:db:53:2b:dd:5e:b8:76:
498
+ # 98:35:93:8b:1a:9d:7c:13:3a:0e:1f:5b:b7:1e:cf:
499
+ # e5:24:14:1e:b1:81:a9:8d:7d:b8:cc:6b:4b:03:f1:
500
+ # 02:0c:dc:ab:a5:40:24:00:7f:74:94:a1:9d:08:29:
501
+ # b3:88:0b:f5:87:77:9d:55:cd:e4:c3:7e:d7:6a:64:
502
+ # ab:85:14:86:95:5b:97:32:50:6f:3d:c8:ba:66:0c:
503
+ # e3:fc:bd:b8:49:c1:76:89:49:19:fd:c0:a8:bd:89:
504
+ # a3:67:2f:c6:9f:bc:71:19:60:b8:2d:e9:2c:c9:90:
505
+ # 76:66:7b:94:e2:af:78:d6:65:53:5d:3c:d6:9c:b2:
506
+ # cf:29:03:f9:2f:a4:50:b2:d4:48:ce:05:32:55:8a:
507
+ # fd:b2:64:4c:0e:e4:98:07:75:db:7f:df:b9:08:55:
508
+ # 60:85:30:29:f9:7b:48:a4:69:86:e3:35:3f:1e:86:
509
+ # 5d:7a:7a:15:bd:ef:00:8e:15:22:54:17:00:90:26:
510
+ # 93:bc:0e:49:68:91:bf:f8:47:d3:9d:95:42:c1:0e:
511
+ # 4d:df:6f:26:cf:c3:18:21:62:66:43:70:d6:d5:c0:
512
+ # 07:e1
513
+ # Exponent: 65537 (0x10001)
514
+ # X509v3 extensions:
515
+ # X509v3 Key Usage: critical
516
+ # Certificate Sign, CRL Sign
517
+ # X509v3 Basic Constraints: critical
518
+ # CA:TRUE
519
+ # X509v3 Subject Key Identifier:
520
+ # 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70
521
+ # Signature Algorithm: sha1WithRSAEncryption
522
+ # 3b:9b:8f:56:9b:30:e7:53:99:7c:7a:79:a7:4d:97:d7:19:95:
523
+ # 90:fb:06:1f:ca:33:7c:46:63:8f:96:66:24:fa:40:1b:21:27:
524
+ # ca:e6:72:73:f2:4f:fe:31:99:fd:c8:0c:4c:68:53:c6:80:82:
525
+ # 13:98:fa:b6:ad:da:5d:3d:f1:ce:6e:f6:15:11:94:82:0c:ee:
526
+ # 3f:95:af:11:ab:0f:d7:2f:de:1f:03:8f:57:2c:1e:c9:bb:9a:
527
+ # 1a:44:95:eb:18:4f:a6:1f:cd:7d:57:10:2f:9b:04:09:5a:84:
528
+ # b5:6e:d8:1d:3a:e1:d6:9e:d1:6c:79:5e:79:1c:14:c5:e3:d0:
529
+ # 4c:93:3b:65:3c:ed:df:3d:be:a6:e5:95:1a:c3:b5:19:c3:bd:
530
+ # 5e:5b:bb:ff:23:ef:68:19:cb:12:93:27:5c:03:2d:6f:30:d0:
531
+ # 1e:b6:1a:ac:de:5a:f7:d1:aa:a8:27:a6:fe:79:81:c4:79:99:
532
+ # 33:57:ba:12:b0:a9:e0:42:6c:93:ca:56:de:fe:6d:84:0b:08:
533
+ # 8b:7e:8d:ea:d7:98:21:c6:f3:e7:3c:79:2f:5e:9c:d1:4c:15:
534
+ # 8d:e1:ec:22:37:cc:9a:43:0b:97:dc:80:90:8d:b3:67:9b:6f:
535
+ # 48:08:15:56:cf:bf:f1:2b:7c:5e:9a:76:e9:59:90:c5:7c:83:
536
+ # 35:11:65:51
537
+ -----BEGIN CERTIFICATE-----
538
+ MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML
539
+ RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp
540
+ bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5
541
+ IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp
542
+ ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3
543
+ MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3
544
+ LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp
545
+ YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG
546
+ A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp
547
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq
548
+ K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe
549
+ sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX
550
+ MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT
551
+ XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/
552
+ HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH
553
+ 4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV
554
+ HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub
555
+ j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo
556
+ U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
557
+ zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b
558
+ u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+
559
+ bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er
560
+ fF6adulZkMV8gzURZVE=
561
+ -----END CERTIFICATE-----
562
+ # GeoTrust Global CA.pem
563
+ # Certificate:
564
+ # Data:
565
+ # Version: 3 (0x2)
566
+ # Serial Number: 144470 (0x23456)
567
+ # Signature Algorithm: sha1WithRSAEncryption
568
+ # Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
569
+ # Validity
570
+ # Not Before: May 21 04:00:00 2002 GMT
571
+ # Not After : May 21 04:00:00 2022 GMT
572
+ # Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA
573
+ # Subject Public Key Info:
574
+ # Public Key Algorithm: rsaEncryption
575
+ # Public-Key: (2048 bit)
576
+ # Modulus:
577
+ # 00:da:cc:18:63:30:fd:f4:17:23:1a:56:7e:5b:df:
578
+ # 3c:6c:38:e4:71:b7:78:91:d4:bc:a1:d8:4c:f8:a8:
579
+ # 43:b6:03:e9:4d:21:07:08:88:da:58:2f:66:39:29:
580
+ # bd:05:78:8b:9d:38:e8:05:b7:6a:7e:71:a4:e6:c4:
581
+ # 60:a6:b0:ef:80:e4:89:28:0f:9e:25:d6:ed:83:f3:
582
+ # ad:a6:91:c7:98:c9:42:18:35:14:9d:ad:98:46:92:
583
+ # 2e:4f:ca:f1:87:43:c1:16:95:57:2d:50:ef:89:2d:
584
+ # 80:7a:57:ad:f2:ee:5f:6b:d2:00:8d:b9:14:f8:14:
585
+ # 15:35:d9:c0:46:a3:7b:72:c8:91:bf:c9:55:2b:cd:
586
+ # d0:97:3e:9c:26:64:cc:df:ce:83:19:71:ca:4e:e6:
587
+ # d4:d5:7b:a9:19:cd:55:de:c8:ec:d2:5e:38:53:e5:
588
+ # 5c:4f:8c:2d:fe:50:23:36:fc:66:e6:cb:8e:a4:39:
589
+ # 19:00:b7:95:02:39:91:0b:0e:fe:38:2e:d1:1d:05:
590
+ # 9a:f6:4d:3e:6f:0f:07:1d:af:2c:1e:8f:60:39:e2:
591
+ # fa:36:53:13:39:d4:5e:26:2b:db:3d:a8:14:bd:32:
592
+ # eb:18:03:28:52:04:71:e5:ab:33:3d:e1:38:bb:07:
593
+ # 36:84:62:9c:79:ea:16:30:f4:5f:c0:2b:e8:71:6b:
594
+ # e4:f9
595
+ # Exponent: 65537 (0x10001)
596
+ # X509v3 extensions:
597
+ # X509v3 Basic Constraints: critical
598
+ # CA:TRUE
599
+ # X509v3 Subject Key Identifier:
600
+ # C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E
601
+ # X509v3 Authority Key Identifier:
602
+ # keyid:C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E
603
+ #
604
+ # Signature Algorithm: sha1WithRSAEncryption
605
+ # 35:e3:29:6a:e5:2f:5d:54:8e:29:50:94:9f:99:1a:14:e4:8f:
606
+ # 78:2a:62:94:a2:27:67:9e:d0:cf:1a:5e:47:e9:c1:b2:a4:cf:
607
+ # dd:41:1a:05:4e:9b:4b:ee:4a:6f:55:52:b3:24:a1:37:0a:eb:
608
+ # 64:76:2a:2e:2c:f3:fd:3b:75:90:bf:fa:71:d8:c7:3d:37:d2:
609
+ # b5:05:95:62:b9:a6:de:89:3d:36:7b:38:77:48:97:ac:a6:20:
610
+ # 8f:2e:a6:c9:0c:c2:b2:99:45:00:c7:ce:11:51:22:22:e0:a5:
611
+ # ea:b6:15:48:09:64:ea:5e:4f:74:f7:05:3e:c7:8a:52:0c:db:
612
+ # 15:b4:bd:6d:9b:e5:c6:b1:54:68:a9:e3:69:90:b6:9a:a5:0f:
613
+ # b8:b9:3f:20:7d:ae:4a:b5:b8:9c:e4:1d:b6:ab:e6:94:a5:c1:
614
+ # c7:83:ad:db:f5:27:87:0e:04:6c:d5:ff:dd:a0:5d:ed:87:52:
615
+ # b7:2b:15:02:ae:39:a6:6a:74:e9:da:c4:e7:bc:4d:34:1e:a9:
616
+ # 5c:4d:33:5f:92:09:2f:88:66:5d:77:97:c7:1d:76:13:a9:d5:
617
+ # e5:f1:16:09:11:35:d5:ac:db:24:71:70:2c:98:56:0b:d9:17:
618
+ # b4:d1:e3:51:2b:5e:75:e8:d5:d0:dc:4f:34:ed:c2:05:66:80:
619
+ # a1:cb:e6:33
620
+ -----BEGIN CERTIFICATE-----
621
+ MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
622
+ MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
623
+ YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
624
+ EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
625
+ R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
626
+ 9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
627
+ fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
628
+ iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
629
+ 1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
630
+ bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
631
+ MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
632
+ ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
633
+ uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
634
+ Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
635
+ tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
636
+ PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
637
+ hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
638
+ 5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
639
+ -----END CERTIFICATE-----
640
+ # GeoTrust Primary Certification Authority - G2.pem
641
+ # Certificate:
642
+ # Data:
643
+ # Version: 3 (0x2)
644
+ # Serial Number:
645
+ # 3c:b2:f4:48:0a:00:e2:fe:eb:24:3b:5e:60:3e:c3:6b
646
+ # Signature Algorithm: ecdsa-with-SHA384
647
+ # Issuer: C=US, O=GeoTrust Inc., OU=(c) 2007 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G2
648
+ # Validity
649
+ # Not Before: Nov 5 00:00:00 2007 GMT
650
+ # Not After : Jan 18 23:59:59 2038 GMT
651
+ # Subject: C=US, O=GeoTrust Inc., OU=(c) 2007 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G2
652
+ # Subject Public Key Info:
653
+ # Public Key Algorithm: id-ecPublicKey
654
+ # Public-Key: (384 bit)
655
+ # pub:
656
+ # 04:15:b1:e8:fd:03:15:43:e5:ac:eb:87:37:11:62:
657
+ # ef:d2:83:36:52:7d:45:57:0b:4a:8d:7b:54:3b:3a:
658
+ # 6e:5f:15:02:c0:50:a6:cf:25:2f:7d:ca:48:b8:c7:
659
+ # 50:63:1c:2a:21:08:7c:9a:36:d8:0b:fe:d1:26:c5:
660
+ # 58:31:30:28:25:f3:5d:5d:a3:b8:b6:a5:b4:92:ed:
661
+ # 6c:2c:9f:eb:dd:43:89:a2:3c:4b:48:91:1d:50:ec:
662
+ # 26:df:d6:60:2e:bd:21
663
+ # ASN1 OID: secp384r1
664
+ # X509v3 extensions:
665
+ # X509v3 Basic Constraints: critical
666
+ # CA:TRUE
667
+ # X509v3 Key Usage: critical
668
+ # Certificate Sign, CRL Sign
669
+ # X509v3 Subject Key Identifier:
670
+ # 15:5F:35:57:51:55:FB:25:B2:AD:03:69:FC:01:A3:FA:BE:11:55:D5
671
+ # Signature Algorithm: ecdsa-with-SHA384
672
+ # 30:64:02:30:64:96:59:a6:e8:09:de:8b:ba:fa:5a:88:88:f0:
673
+ # 1f:91:d3:46:a8:f2:4a:4c:02:63:fb:6c:5f:38:db:2e:41:93:
674
+ # a9:0e:e6:9d:dc:31:1c:b2:a0:a7:18:1c:79:e1:c7:36:02:30:
675
+ # 3a:56:af:9a:74:6c:f6:fb:83:e0:33:d3:08:5f:a1:9c:c2:5b:
676
+ # 9f:46:d6:b6:cb:91:06:63:a2:06:e7:33:ac:3e:a8:81:12:d0:
677
+ # cb:ba:d0:92:0b:b6:9e:96:aa:04:0f:8a
678
+ -----BEGIN CERTIFICATE-----
679
+ MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL
680
+ MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj
681
+ KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2
682
+ MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
683
+ eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV
684
+ BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw
685
+ NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV
686
+ BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH
687
+ MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL
688
+ So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal
689
+ tJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
690
+ BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+EVXVMAoG
691
+ CCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGT
692
+ qQ7mndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBucz
693
+ rD6ogRLQy7rQkgu2npaqBA+K
694
+ -----END CERTIFICATE-----
695
+ # GeoTrust Primary Certification Authority - G3.pem
696
+ # Certificate:
697
+ # Data:
698
+ # Version: 3 (0x2)
699
+ # Serial Number:
700
+ # 15:ac:6e:94:19:b2:79:4b:41:f6:27:a9:c3:18:0f:1f
701
+ # Signature Algorithm: sha256WithRSAEncryption
702
+ # Issuer: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3
703
+ # Validity
704
+ # Not Before: Apr 2 00:00:00 2008 GMT
705
+ # Not After : Dec 1 23:59:59 2037 GMT
706
+ # Subject: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3
707
+ # Subject Public Key Info:
708
+ # Public Key Algorithm: rsaEncryption
709
+ # Public-Key: (2048 bit)
710
+ # Modulus:
711
+ # 00:dc:e2:5e:62:58:1d:33:57:39:32:33:fa:eb:cb:
712
+ # 87:8c:a7:d4:4a:dd:06:88:ea:64:8e:31:98:a5:38:
713
+ # 90:1e:98:cf:2e:63:2b:f0:46:bc:44:b2:89:a1:c0:
714
+ # 28:0c:49:70:21:95:9f:64:c0:a6:93:12:02:65:26:
715
+ # 86:c6:a5:89:f0:fa:d7:84:a0:70:af:4f:1a:97:3f:
716
+ # 06:44:d5:c9:eb:72:10:7d:e4:31:28:fb:1c:61:e6:
717
+ # 28:07:44:73:92:22:69:a7:03:88:6c:9d:63:c8:52:
718
+ # da:98:27:e7:08:4c:70:3e:b4:c9:12:c1:c5:67:83:
719
+ # 5d:33:f3:03:11:ec:6a:d0:53:e2:d1:ba:36:60:94:
720
+ # 80:bb:61:63:6c:5b:17:7e:df:40:94:1e:ab:0d:c2:
721
+ # 21:28:70:88:ff:d6:26:6c:6c:60:04:25:4e:55:7e:
722
+ # 7d:ef:bf:94:48:de:b7:1d:dd:70:8d:05:5f:88:a5:
723
+ # 9b:f2:c2:ee:ea:d1:40:41:6d:62:38:1d:56:06:c5:
724
+ # 03:47:51:20:19:fc:7b:10:0b:0e:62:ae:76:55:bf:
725
+ # 5f:77:be:3e:49:01:53:3d:98:25:03:76:24:5a:1d:
726
+ # b4:db:89:ea:79:e5:b6:b3:3b:3f:ba:4c:28:41:7f:
727
+ # 06:ac:6a:8e:c1:d0:f6:05:1d:7d:e6:42:86:e3:a5:
728
+ # d5:47
729
+ # Exponent: 65537 (0x10001)
730
+ # X509v3 extensions:
731
+ # X509v3 Basic Constraints: critical
732
+ # CA:TRUE
733
+ # X509v3 Key Usage: critical
734
+ # Certificate Sign, CRL Sign
735
+ # X509v3 Subject Key Identifier:
736
+ # C4:79:CA:8E:A1:4E:03:1D:1C:DC:6B:DB:31:5B:94:3E:3F:30:7F:2D
737
+ # Signature Algorithm: sha256WithRSAEncryption
738
+ # 2d:c5:13:cf:56:80:7b:7a:78:bd:9f:ae:2c:99:e7:ef:da:df:
739
+ # 94:5e:09:69:a7:e7:6e:68:8c:bd:72:be:47:a9:0e:97:12:b8:
740
+ # 4a:f1:64:d3:39:df:25:34:d4:c1:cd:4e:81:f0:0f:04:c4:24:
741
+ # b3:34:96:c6:a6:aa:30:df:68:61:73:d7:f9:8e:85:89:ef:0e:
742
+ # 5e:95:28:4a:2a:27:8f:10:8e:2e:7c:86:c4:02:9e:da:0c:77:
743
+ # 65:0e:44:0d:92:fd:fd:b3:16:36:fa:11:0d:1d:8c:0e:07:89:
744
+ # 6a:29:56:f7:72:f4:dd:15:9c:77:35:66:57:ab:13:53:d8:8e:
745
+ # c1:40:c5:d7:13:16:5a:72:c7:b7:69:01:c4:7a:b1:83:01:68:
746
+ # 7d:8d:41:a1:94:18:c1:25:5c:fc:f0:fe:83:02:87:7c:0d:0d:
747
+ # cf:2e:08:5c:4a:40:0d:3e:ec:81:61:e6:24:db:ca:e0:0e:2d:
748
+ # 07:b2:3e:56:dc:8d:f5:41:85:07:48:9b:0c:0b:cb:49:3f:7d:
749
+ # ec:b7:fd:cb:8d:67:89:1a:ab:ed:bb:1e:a3:00:08:08:17:2a:
750
+ # 82:5c:31:5d:46:8a:2d:0f:86:9b:74:d9:45:fb:d4:40:b1:7a:
751
+ # aa:68:2d:86:b2:99:22:e1:c1:2b:c7:9c:f8:f3:5f:a8:82:12:
752
+ # eb:19:11:2d
753
+ -----BEGIN CERTIFICATE-----
754
+ MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCB
755
+ mDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsT
756
+ MChjKSAyMDA4IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s
757
+ eTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhv
758
+ cml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIzNTk1OVowgZgxCzAJ
759
+ BgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
760
+ MjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0
761
+ BgNVBAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg
762
+ LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz
763
+ +uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5jK/BGvESyiaHAKAxJcCGVn2TAppMSAmUm
764
+ hsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdEc5IiaacDiGydY8hS2pgn
765
+ 5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3CIShwiP/W
766
+ JmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exAL
767
+ DmKudlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZC
768
+ huOl1UcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
769
+ HQYDVR0OBBYEFMR5yo6hTgMdHNxr2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IB
770
+ AQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9cr5HqQ6XErhK8WTTOd8lNNTB
771
+ zU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbEAp7aDHdlDkQN
772
+ kv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
773
+ AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUH
774
+ SJsMC8tJP33st/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2G
775
+ spki4cErx5z481+oghLrGREt
776
+ -----END CERTIFICATE-----
777
+ # GeoTrust Primary Certification Authority.pem
778
+ # Certificate:
779
+ # Data:
780
+ # Version: 3 (0x2)
781
+ # Serial Number:
782
+ # 18:ac:b5:6a:fd:69:b6:15:3a:63:6c:af:da:fa:c4:a1
783
+ # Signature Algorithm: sha1WithRSAEncryption
784
+ # Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority
785
+ # Validity
786
+ # Not Before: Nov 27 00:00:00 2006 GMT
787
+ # Not After : Jul 16 23:59:59 2036 GMT
788
+ # Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority
789
+ # Subject Public Key Info:
790
+ # Public Key Algorithm: rsaEncryption
791
+ # Public-Key: (2048 bit)
792
+ # Modulus:
793
+ # 00:be:b8:15:7b:ff:d4:7c:7d:67:ad:83:64:7b:c8:
794
+ # 42:53:2d:df:f6:84:08:20:61:d6:01:59:6a:9c:44:
795
+ # 11:af:ef:76:fd:95:7e:ce:61:30:bb:7a:83:5f:02:
796
+ # bd:01:66:ca:ee:15:8d:6f:a1:30:9c:bd:a1:85:9e:
797
+ # 94:3a:f3:56:88:00:31:cf:d8:ee:6a:96:02:d9:ed:
798
+ # 03:8c:fb:75:6d:e7:ea:b8:55:16:05:16:9a:f4:e0:
799
+ # 5e:b1:88:c0:64:85:5c:15:4d:88:c7:b7:ba:e0:75:
800
+ # e9:ad:05:3d:9d:c7:89:48:e0:bb:28:c8:03:e1:30:
801
+ # 93:64:5e:52:c0:59:70:22:35:57:88:8a:f1:95:0a:
802
+ # 83:d7:bc:31:73:01:34:ed:ef:46:71:e0:6b:02:a8:
803
+ # 35:72:6b:97:9b:66:e0:cb:1c:79:5f:d8:1a:04:68:
804
+ # 1e:47:02:e6:9d:60:e2:36:97:01:df:ce:35:92:df:
805
+ # be:67:c7:6d:77:59:3b:8f:9d:d6:90:15:94:bc:42:
806
+ # 34:10:c1:39:f9:b1:27:3e:7e:d6:8a:75:c5:b2:af:
807
+ # 96:d3:a2:de:9b:e4:98:be:7d:e1:e9:81:ad:b6:6f:
808
+ # fc:d7:0e:da:e0:34:b0:0d:1a:77:e7:e3:08:98:ef:
809
+ # 58:fa:9c:84:b7:36:af:c2:df:ac:d2:f4:10:06:70:
810
+ # 71:35
811
+ # Exponent: 65537 (0x10001)
812
+ # X509v3 extensions:
813
+ # X509v3 Basic Constraints: critical
814
+ # CA:TRUE
815
+ # X509v3 Key Usage: critical
816
+ # Certificate Sign, CRL Sign
817
+ # X509v3 Subject Key Identifier:
818
+ # 2C:D5:50:41:97:15:8B:F0:8F:36:61:5B:4A:FB:6B:D9:99:C9:33:92
819
+ # Signature Algorithm: sha1WithRSAEncryption
820
+ # 5a:70:7f:2c:dd:b7:34:4f:f5:86:51:a9:26:be:4b:b8:aa:f1:
821
+ # 71:0d:dc:61:c7:a0:ea:34:1e:7a:77:0f:04:35:e8:27:8f:6c:
822
+ # 90:bf:91:16:24:46:3e:4a:4e:ce:2b:16:d5:0b:52:1d:fc:1f:
823
+ # 67:a2:02:45:31:4f:ce:f3:fa:03:a7:79:9d:53:6a:d9:da:63:
824
+ # 3a:f8:80:d7:d3:99:e1:a5:e1:be:d4:55:71:98:35:3a:be:93:
825
+ # ea:ae:ad:42:b2:90:6f:e0:fc:21:4d:35:63:33:89:49:d6:9b:
826
+ # 4e:ca:c7:e7:4e:09:00:f7:da:c7:ef:99:62:99:77:b6:95:22:
827
+ # 5e:8a:a0:ab:f4:b8:78:98:ca:38:19:99:c9:72:9e:78:cd:4b:
828
+ # ac:af:19:a0:73:12:2d:fc:c2:41:ba:81:91:da:16:5a:31:b7:
829
+ # f9:b4:71:80:12:48:99:72:73:5a:59:53:c1:63:52:33:ed:a7:
830
+ # c9:d2:39:02:70:fa:e0:b1:42:66:29:aa:9b:51:ed:30:54:22:
831
+ # 14:5f:d9:ab:1d:c1:e4:94:f0:f8:f5:2b:f7:ea:ca:78:46:d6:
832
+ # b8:91:fd:a6:0d:2b:1a:14:01:3e:80:f0:42:a0:95:07:5e:6d:
833
+ # cd:cc:4b:a4:45:8d:ab:12:e8:b3:de:5a:e5:a0:7c:e8:0f:22:
834
+ # 1d:5a:e9:59
835
+ -----BEGIN CERTIFICATE-----
836
+ MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBY
837
+ MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMo
838
+ R2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEx
839
+ MjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
840
+ Ew1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQcmltYXJ5IENlcnRp
841
+ ZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
842
+ AQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9
843
+ AWbK7hWNb6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjA
844
+ ZIVcFU2Ix7e64HXprQU9nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE0
845
+ 7e9GceBrAqg1cmuXm2bgyxx5X9gaBGgeRwLmnWDiNpcB3841kt++Z8dtd1k7j53W
846
+ kBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGttm/81w7a4DSwDRp35+MI
847
+ mO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G
848
+ A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJ
849
+ KoZIhvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ1
850
+ 6CePbJC/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl
851
+ 4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K
852
+ oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj
853
+ UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU
854
+ AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
855
+ -----END CERTIFICATE-----
856
+ # Go Daddy Class 2 Certification Authority.pem
857
+ # Certificate:
858
+ # Data:
859
+ # Version: 3 (0x2)
860
+ # Serial Number: 0 (0x0)
861
+ # Signature Algorithm: sha1WithRSAEncryption
862
+ # Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority
863
+ # Validity
864
+ # Not Before: Jun 29 17:06:20 2004 GMT
865
+ # Not After : Jun 29 17:06:20 2034 GMT
866
+ # Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority
867
+ # Subject Public Key Info:
868
+ # Public Key Algorithm: rsaEncryption
869
+ # Public-Key: (2048 bit)
870
+ # Modulus:
871
+ # 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86:
872
+ # ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0:
873
+ # 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f:
874
+ # da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4:
875
+ # c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20:
876
+ # 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45:
877
+ # 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7:
878
+ # 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2:
879
+ # fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2:
880
+ # 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6:
881
+ # 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5:
882
+ # 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8:
883
+ # ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a:
884
+ # fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee:
885
+ # 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0:
886
+ # 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf:
887
+ # 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97:
888
+ # 1b:af
889
+ # Exponent: 3 (0x3)
890
+ # X509v3 extensions:
891
+ # X509v3 Subject Key Identifier:
892
+ # D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
893
+ # X509v3 Authority Key Identifier:
894
+ # keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
895
+ # DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
896
+ # serial:00
897
+ #
898
+ # X509v3 Basic Constraints:
899
+ # CA:TRUE
900
+ # Signature Algorithm: sha1WithRSAEncryption
901
+ # 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06:
902
+ # 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4:
903
+ # 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4:
904
+ # 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45:
905
+ # 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d:
906
+ # ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5:
907
+ # 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85:
908
+ # e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef:
909
+ # 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb:
910
+ # 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3:
911
+ # f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e:
912
+ # cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac:
913
+ # 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4:
914
+ # 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d:
915
+ # 7f:db:bd:9f
916
+ -----BEGIN CERTIFICATE-----
917
+ MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh
918
+ MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE
919
+ YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3
920
+ MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo
921
+ ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg
922
+ MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN
923
+ ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA
924
+ PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w
925
+ wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi
926
+ EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY
927
+ avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+
928
+ YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE
929
+ sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h
930
+ /t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5
931
+ IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
932
+ YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD
933
+ ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy
934
+ OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P
935
+ TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
936
+ HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER
937
+ dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf
938
+ ReYNnyicsbkqWletNw+vHX/bvZ8=
939
+ -----END CERTIFICATE-----
940
+ # Go Daddy Root Certificate Authority - G2.pem
941
+ # Certificate:
942
+ # Data:
943
+ # Version: 3 (0x2)
944
+ # Serial Number: 0 (0x0)
945
+ # Signature Algorithm: sha256WithRSAEncryption
946
+ # Issuer: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2
947
+ # Validity
948
+ # Not Before: Sep 1 00:00:00 2009 GMT
949
+ # Not After : Dec 31 23:59:59 2037 GMT
950
+ # Subject: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2
951
+ # Subject Public Key Info:
952
+ # Public Key Algorithm: rsaEncryption
953
+ # Public-Key: (2048 bit)
954
+ # Modulus:
955
+ # 00:bf:71:62:08:f1:fa:59:34:f7:1b:c9:18:a3:f7:
956
+ # 80:49:58:e9:22:83:13:a6:c5:20:43:01:3b:84:f1:
957
+ # e6:85:49:9f:27:ea:f6:84:1b:4e:a0:b4:db:70:98:
958
+ # c7:32:01:b1:05:3e:07:4e:ee:f4:fa:4f:2f:59:30:
959
+ # 22:e7:ab:19:56:6b:e2:80:07:fc:f3:16:75:80:39:
960
+ # 51:7b:e5:f9:35:b6:74:4e:a9:8d:82:13:e4:b6:3f:
961
+ # a9:03:83:fa:a2:be:8a:15:6a:7f:de:0b:c3:b6:19:
962
+ # 14:05:ca:ea:c3:a8:04:94:3b:46:7c:32:0d:f3:00:
963
+ # 66:22:c8:8d:69:6d:36:8c:11:18:b7:d3:b2:1c:60:
964
+ # b4:38:fa:02:8c:ce:d3:dd:46:07:de:0a:3e:eb:5d:
965
+ # 7c:c8:7c:fb:b0:2b:53:a4:92:62:69:51:25:05:61:
966
+ # 1a:44:81:8c:2c:a9:43:96:23:df:ac:3a:81:9a:0e:
967
+ # 29:c5:1c:a9:e9:5d:1e:b6:9e:9e:30:0a:39:ce:f1:
968
+ # 88:80:fb:4b:5d:cc:32:ec:85:62:43:25:34:02:56:
969
+ # 27:01:91:b4:3b:70:2a:3f:6e:b1:e8:9c:88:01:7d:
970
+ # 9f:d4:f9:db:53:6d:60:9d:bf:2c:e7:58:ab:b8:5f:
971
+ # 46:fc:ce:c4:1b:03:3c:09:eb:49:31:5c:69:46:b3:
972
+ # e0:47
973
+ # Exponent: 65537 (0x10001)
974
+ # X509v3 extensions:
975
+ # X509v3 Basic Constraints: critical
976
+ # CA:TRUE
977
+ # X509v3 Key Usage: critical
978
+ # Certificate Sign, CRL Sign
979
+ # X509v3 Subject Key Identifier:
980
+ # 3A:9A:85:07:10:67:28:B6:EF:F6:BD:05:41:6E:20:C1:94:DA:0F:DE
981
+ # Signature Algorithm: sha256WithRSAEncryption
982
+ # 99:db:5d:79:d5:f9:97:59:67:03:61:f1:7e:3b:06:31:75:2d:
983
+ # a1:20:8e:4f:65:87:b4:f7:a6:9c:bc:d8:e9:2f:d0:db:5a:ee:
984
+ # cf:74:8c:73:b4:38:42:da:05:7b:f8:02:75:b8:fd:a5:b1:d7:
985
+ # ae:f6:d7:de:13:cb:53:10:7e:8a:46:d1:97:fa:b7:2e:2b:11:
986
+ # ab:90:b0:27:80:f9:e8:9f:5a:e9:37:9f:ab:e4:df:6c:b3:85:
987
+ # 17:9d:3d:d9:24:4f:79:91:35:d6:5f:04:eb:80:83:ab:9a:02:
988
+ # 2d:b5:10:f4:d8:90:c7:04:73:40:ed:72:25:a0:a9:9f:ec:9e:
989
+ # ab:68:12:99:57:c6:8f:12:3a:09:a4:bd:44:fd:06:15:37:c1:
990
+ # 9b:e4:32:a3:ed:38:e8:d8:64:f3:2c:7e:14:fc:02:ea:9f:cd:
991
+ # ff:07:68:17:db:22:90:38:2d:7a:8d:d1:54:f1:69:e3:5f:33:
992
+ # ca:7a:3d:7b:0a:e3:ca:7f:5f:39:e5:e2:75:ba:c5:76:18:33:
993
+ # ce:2c:f0:2f:4c:ad:f7:b1:e7:ce:4f:a8:c4:9b:4a:54:06:c5:
994
+ # 7f:7d:d5:08:0f:e2:1c:fe:7e:17:b8:ac:5e:f6:d4:16:b2:43:
995
+ # 09:0c:4d:f6:a7:6b:b4:99:84:65:ca:7a:88:e2:e2:44:be:5c:
996
+ # f7:ea:1c:f5
997
+ -----BEGIN CERTIFICATE-----
998
+ MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx
999
+ EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT
1000
+ EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp
1001
+ ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz
1002
+ NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH
1003
+ EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE
1004
+ AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw
1005
+ DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD
1006
+ E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH
1007
+ /PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy
1008
+ DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh
1009
+ GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR
1010
+ tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA
1011
+ AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
1012
+ FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX
1013
+ WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu
1014
+ 9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr
1015
+ gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo
1016
+ 2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
1017
+ LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI
1018
+ 4uJEvlz36hz1
1019
+ -----END CERTIFICATE-----
1020
+ # Go Daddy Secure Certification Authority serialNumber=07969287.pem
1021
+ # Certificate:
1022
+ # Data:
1023
+ # Version: 3 (0x2)
1024
+ # Serial Number: 769 (0x301)
1025
+ # Signature Algorithm: sha1WithRSAEncryption
1026
+ # Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority
1027
+ # Validity
1028
+ # Not Before: Nov 16 01:54:37 2006 GMT
1029
+ # Not After : Nov 16 01:54:37 2026 GMT
1030
+ # Subject: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., OU=http://certificates.godaddy.com/repository, CN=Go Daddy Secure Certification Authority/serialNumber=07969287
1031
+ # Subject Public Key Info:
1032
+ # Public Key Algorithm: rsaEncryption
1033
+ # Public-Key: (2048 bit)
1034
+ # Modulus:
1035
+ # 00:c4:2d:d5:15:8c:9c:26:4c:ec:32:35:eb:5f:b8:
1036
+ # 59:01:5a:a6:61:81:59:3b:70:63:ab:e3:dc:3d:c7:
1037
+ # 2a:b8:c9:33:d3:79:e4:3a:ed:3c:30:23:84:8e:b3:
1038
+ # 30:14:b6:b2:87:c3:3d:95:54:04:9e:df:99:dd:0b:
1039
+ # 25:1e:21:de:65:29:7e:35:a8:a9:54:eb:f6:f7:32:
1040
+ # 39:d4:26:55:95:ad:ef:fb:fe:58:86:d7:9e:f4:00:
1041
+ # 8d:8c:2a:0c:bd:42:04:ce:a7:3f:04:f6:ee:80:f2:
1042
+ # aa:ef:52:a1:69:66:da:be:1a:ad:5d:da:2c:66:ea:
1043
+ # 1a:6b:bb:e5:1a:51:4a:00:2f:48:c7:98:75:d8:b9:
1044
+ # 29:c8:ee:f8:66:6d:0a:9c:b3:f3:fc:78:7c:a2:f8:
1045
+ # a3:f2:b5:c3:f3:b9:7a:91:c1:a7:e6:25:2e:9c:a8:
1046
+ # ed:12:65:6e:6a:f6:12:44:53:70:30:95:c3:9c:2b:
1047
+ # 58:2b:3d:08:74:4a:f2:be:51:b0:bf:87:d0:4c:27:
1048
+ # 58:6b:b5:35:c5:9d:af:17:31:f8:0b:8f:ee:ad:81:
1049
+ # 36:05:89:08:98:cf:3a:af:25:87:c0:49:ea:a7:fd:
1050
+ # 67:f7:45:8e:97:cc:14:39:e2:36:85:b5:7e:1a:37:
1051
+ # fd:16:f6:71:11:9a:74:30:16:fe:13:94:a3:3f:84:
1052
+ # 0d:4f
1053
+ # Exponent: 65537 (0x10001)
1054
+ # X509v3 extensions:
1055
+ # X509v3 Subject Key Identifier:
1056
+ # FD:AC:61:32:93:6C:45:D6:E2:EE:85:5F:9A:BA:E7:76:99:68:CC:E7
1057
+ # X509v3 Authority Key Identifier:
1058
+ # keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
1059
+ #
1060
+ # X509v3 Basic Constraints: critical
1061
+ # CA:TRUE, pathlen:0
1062
+ # Authority Information Access:
1063
+ # OCSP - URI:http://ocsp.godaddy.com
1064
+ #
1065
+ # X509v3 CRL Distribution Points:
1066
+ #
1067
+ # Full Name:
1068
+ # URI:http://certificates.godaddy.com/repository/gdroot.crl
1069
+ #
1070
+ # X509v3 Certificate Policies:
1071
+ # Policy: X509v3 Any Policy
1072
+ # CPS: http://certificates.godaddy.com/repository
1073
+ #
1074
+ # X509v3 Key Usage: critical
1075
+ # Certificate Sign, CRL Sign
1076
+ # Signature Algorithm: sha1WithRSAEncryption
1077
+ # d2:86:c0:ec:bd:f9:a1:b6:67:ee:66:0b:a2:06:3a:04:50:8e:
1078
+ # 15:72:ac:4a:74:95:53:cb:37:cb:44:49:ef:07:90:6b:33:d9:
1079
+ # 96:f0:94:56:a5:13:30:05:3c:85:32:21:7b:c9:c7:0a:a8:24:
1080
+ # a4:90:de:46:d3:25:23:14:03:67:c2:10:d6:6f:0f:5d:7b:7a:
1081
+ # cc:9f:c5:58:2a:c1:c4:9e:21:a8:5a:f3:ac:a4:46:f3:9e:e4:
1082
+ # 63:cb:2f:90:a4:29:29:01:d9:72:2c:29:df:37:01:27:bc:4f:
1083
+ # ee:68:d3:21:8f:c0:b3:e4:f5:09:ed:d2:10:aa:53:b4:be:f0:
1084
+ # cc:59:0b:d6:3b:96:1c:95:24:49:df:ce:ec:fd:a7:48:91:14:
1085
+ # 45:0e:3a:36:6f:da:45:b3:45:a2:41:c9:d4:d7:44:4e:3e:b9:
1086
+ # 74:76:d5:a2:13:55:2c:c6:87:a3:b5:99:ac:06:84:87:7f:75:
1087
+ # 06:fc:bf:14:4c:0e:cc:6e:c4:df:3d:b7:12:71:f4:e8:f1:51:
1088
+ # 40:22:28:49:e0:1d:4b:87:a8:34:cc:06:a2:dd:12:5a:d1:86:
1089
+ # 36:64:03:35:6f:6f:77:6e:eb:f2:85:50:98:5e:ab:03:53:ad:
1090
+ # 91:23:63:1f:16:9c:cd:b9:b2:05:63:3a:e1:f4:68:1b:17:05:
1091
+ # 35:95:53:ee
1092
+ -----BEGIN CERTIFICATE-----
1093
+ MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVMx
1094
+ ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
1095
+ RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYw
1096
+ MTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UECBMH
1097
+ QXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5j
1098
+ b20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j
1099
+ b20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmlj
1100
+ YXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJKoZIhvcN
1101
+ AQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTtwY6vj3D3H
1102
+ KrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQm
1103
+ VZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu75RpR
1104
+ SgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo7RJlbmr2EkRT
1105
+ cDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ
1106
+ 6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEu
1107
+ MB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGDAWgBTSxLDS
1108
+ kdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB
1109
+ BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f
1110
+ BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv
1111
+ c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH
1112
+ AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO
1113
+ BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG
1114
+ OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU
1115
+ A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o
1116
+ 0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX
1117
+ RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH
1118
+ qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV
1119
+ U+4=
1120
+ -----END CERTIFICATE-----
1121
+ # Thawte Premium Server CA.pem
1122
+ # Certificate:
1123
+ # Data:
1124
+ # Version: 3 (0x2)
1125
+ # Serial Number: 1 (0x1)
1126
+ # Signature Algorithm: md5WithRSAEncryption
1127
+ # Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
1128
+ # Validity
1129
+ # Not Before: Aug 1 00:00:00 1996 GMT
1130
+ # Not After : Dec 31 23:59:59 2020 GMT
1131
+ # Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
1132
+ # Subject Public Key Info:
1133
+ # Public Key Algorithm: rsaEncryption
1134
+ # Public-Key: (1024 bit)
1135
+ # Modulus:
1136
+ # 00:d2:36:36:6a:8b:d7:c2:5b:9e:da:81:41:62:8f:
1137
+ # 38:ee:49:04:55:d6:d0:ef:1c:1b:95:16:47:ef:18:
1138
+ # 48:35:3a:52:f4:2b:6a:06:8f:3b:2f:ea:56:e3:af:
1139
+ # 86:8d:9e:17:f7:9e:b4:65:75:02:4d:ef:cb:09:a2:
1140
+ # 21:51:d8:9b:d0:67:d0:ba:0d:92:06:14:73:d4:93:
1141
+ # cb:97:2a:00:9c:5c:4e:0c:bc:fa:15:52:fc:f2:44:
1142
+ # 6e:da:11:4a:6e:08:9f:2f:2d:e3:f9:aa:3a:86:73:
1143
+ # b6:46:53:58:c8:89:05:bd:83:11:b8:73:3f:aa:07:
1144
+ # 8d:f4:42:4d:e7:40:9d:1c:37
1145
+ # Exponent: 65537 (0x10001)
1146
+ # X509v3 extensions:
1147
+ # X509v3 Basic Constraints: critical
1148
+ # CA:TRUE
1149
+ # Signature Algorithm: md5WithRSAEncryption
1150
+ # 26:48:2c:16:c2:58:fa:e8:16:74:0c:aa:aa:5f:54:3f:f2:d7:
1151
+ # c9:78:60:5e:5e:6e:37:63:22:77:36:7e:b2:17:c4:34:b9:f5:
1152
+ # 08:85:fc:c9:01:38:ff:4d:be:f2:16:42:43:e7:bb:5a:46:fb:
1153
+ # c1:c6:11:1f:f1:4a:b0:28:46:c9:c3:c4:42:7d:bc:fa:ab:59:
1154
+ # 6e:d5:b7:51:88:11:e3:a4:85:19:6b:82:4c:a4:0c:12:ad:e9:
1155
+ # a4:ae:3f:f1:c3:49:65:9a:8c:c5:c8:3e:25:b7:94:99:bb:92:
1156
+ # 32:71:07:f0:86:5e:ed:50:27:a6:0d:a6:23:f9:bb:cb:a6:07:
1157
+ # 14:42
1158
+ -----BEGIN CERTIFICATE-----
1159
+ MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx
1160
+ FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD
1161
+ VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv
1162
+ biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy
1163
+ dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t
1164
+ MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB
1165
+ MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG
1166
+ A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp
1167
+ b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl
1168
+ cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv
1169
+ bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE
1170
+ VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ
1171
+ ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR
1172
+ uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG
1173
+ 9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI
1174
+ hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM
1175
+ pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg==
1176
+ -----END CERTIFICATE-----
1177
+ # Thawte Primary Root CA - G2.pem
1178
+ # Certificate:
1179
+ # Data:
1180
+ # Version: 3 (0x2)
1181
+ # Serial Number:
1182
+ # 35:fc:26:5c:d9:84:4f:c9:3d:26:3d:57:9b:ae:d7:56
1183
+ # Signature Algorithm: ecdsa-with-SHA384
1184
+ # Issuer: C=US, O=thawte, Inc., OU=(c) 2007 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G2
1185
+ # Validity
1186
+ # Not Before: Nov 5 00:00:00 2007 GMT
1187
+ # Not After : Jan 18 23:59:59 2038 GMT
1188
+ # Subject: C=US, O=thawte, Inc., OU=(c) 2007 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G2
1189
+ # Subject Public Key Info:
1190
+ # Public Key Algorithm: id-ecPublicKey
1191
+ # Public-Key: (384 bit)
1192
+ # pub:
1193
+ # 04:a2:d5:9c:82:7b:95:9d:f1:52:78:87:fe:8a:16:
1194
+ # bf:05:e6:df:a3:02:4f:0d:07:c6:00:51:ba:0c:02:
1195
+ # 52:2d:22:a4:42:39:c4:fe:8f:ea:c9:c1:be:d4:4d:
1196
+ # ff:9f:7a:9e:e2:b1:7c:9a:ad:a7:86:09:73:87:d1:
1197
+ # e7:9a:e3:7a:a5:aa:6e:fb:ba:b3:70:c0:67:88:a2:
1198
+ # 35:d4:a3:9a:b1:fd:ad:c2:ef:31:fa:a8:b9:f3:fb:
1199
+ # 08:c6:91:d1:fb:29:95
1200
+ # ASN1 OID: secp384r1
1201
+ # X509v3 extensions:
1202
+ # X509v3 Basic Constraints: critical
1203
+ # CA:TRUE
1204
+ # X509v3 Key Usage: critical
1205
+ # Certificate Sign, CRL Sign
1206
+ # X509v3 Subject Key Identifier:
1207
+ # 9A:D8:00:30:00:E7:6B:7F:85:18:EE:8B:B6:CE:8A:0C:F8:11:E1:BB
1208
+ # Signature Algorithm: ecdsa-with-SHA384
1209
+ # 30:66:02:31:00:dd:f8:e0:57:47:5b:a7:e6:0a:c3:bd:f5:80:
1210
+ # 8a:97:35:0d:1b:89:3c:54:86:77:28:ca:a1:f4:79:de:b5:e6:
1211
+ # 38:b0:f0:65:70:8c:7f:02:54:c2:bf:ff:d8:a1:3e:d9:cf:02:
1212
+ # 31:00:c4:8d:94:fc:dc:53:d2:dc:9d:78:16:1f:15:33:23:53:
1213
+ # 52:e3:5a:31:5d:9d:ca:ae:bd:13:29:44:0d:27:5b:a8:e7:68:
1214
+ # 9c:12:f7:58:3f:2e:72:02:57:a3:8f:a1:14:2e
1215
+ -----BEGIN CERTIFICATE-----
1216
+ MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDEL
1217
+ MAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMp
1218
+ IDIwMDcgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAi
1219
+ BgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMjAeFw0wNzExMDUwMDAw
1220
+ MDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
1221
+ d3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBGb3Ig
1222
+ YXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v
1223
+ dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/
1224
+ BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6
1225
+ papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E
1226
+ BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K
1227
+ DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3
1228
+ KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox
1229
+ XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
1230
+ -----END CERTIFICATE-----
1231
+ # Thawte Primary Root CA - G3.pem
1232
+ # Certificate:
1233
+ # Data:
1234
+ # Version: 3 (0x2)
1235
+ # Serial Number:
1236
+ # 60:01:97:b7:46:a7:ea:b4:b4:9a:d6:4b:2f:f7:90:fb
1237
+ # Signature Algorithm: sha256WithRSAEncryption
1238
+ # Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2008 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G3
1239
+ # Validity
1240
+ # Not Before: Apr 2 00:00:00 2008 GMT
1241
+ # Not After : Dec 1 23:59:59 2037 GMT
1242
+ # Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2008 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G3
1243
+ # Subject Public Key Info:
1244
+ # Public Key Algorithm: rsaEncryption
1245
+ # Public-Key: (2048 bit)
1246
+ # Modulus:
1247
+ # 00:b2:bf:27:2c:fb:db:d8:5b:dd:78:7b:1b:9e:77:
1248
+ # 66:81:cb:3e:bc:7c:ae:f3:a6:27:9a:34:a3:68:31:
1249
+ # 71:38:33:62:e4:f3:71:66:79:b1:a9:65:a3:a5:8b:
1250
+ # d5:8f:60:2d:3f:42:cc:aa:6b:32:c0:23:cb:2c:41:
1251
+ # dd:e4:df:fc:61:9c:e2:73:b2:22:95:11:43:18:5f:
1252
+ # c4:b6:1f:57:6c:0a:05:58:22:c8:36:4c:3a:7c:a5:
1253
+ # d1:cf:86:af:88:a7:44:02:13:74:71:73:0a:42:59:
1254
+ # 02:f8:1b:14:6b:42:df:6f:5f:ba:6b:82:a2:9d:5b:
1255
+ # e7:4a:bd:1e:01:72:db:4b:74:e8:3b:7f:7f:7d:1f:
1256
+ # 04:b4:26:9b:e0:b4:5a:ac:47:3d:55:b8:d7:b0:26:
1257
+ # 52:28:01:31:40:66:d8:d9:24:bd:f6:2a:d8:ec:21:
1258
+ # 49:5c:9b:f6:7a:e9:7f:55:35:7e:96:6b:8d:93:93:
1259
+ # 27:cb:92:bb:ea:ac:40:c0:9f:c2:f8:80:cf:5d:f4:
1260
+ # 5a:dc:ce:74:86:a6:3e:6c:0b:53:ca:bd:92:ce:19:
1261
+ # 06:72:e6:0c:5c:38:69:c7:04:d6:bc:6c:ce:5b:f6:
1262
+ # f7:68:9c:dc:25:15:48:88:a1:e9:a9:f8:98:9c:e0:
1263
+ # f3:d5:31:28:61:11:6c:67:96:8d:39:99:cb:c2:45:
1264
+ # 24:39
1265
+ # Exponent: 65537 (0x10001)
1266
+ # X509v3 extensions:
1267
+ # X509v3 Basic Constraints: critical
1268
+ # CA:TRUE
1269
+ # X509v3 Key Usage: critical
1270
+ # Certificate Sign, CRL Sign
1271
+ # X509v3 Subject Key Identifier:
1272
+ # AD:6C:AA:94:60:9C:ED:E4:FF:FA:3E:0A:74:2B:63:03:F7:B6:59:BF
1273
+ # Signature Algorithm: sha256WithRSAEncryption
1274
+ # 1a:40:d8:95:65:ac:09:92:89:c6:39:f4:10:e5:a9:0e:66:53:
1275
+ # 5d:78:de:fa:24:91:bb:e7:44:51:df:c6:16:34:0a:ef:6a:44:
1276
+ # 51:ea:2b:07:8a:03:7a:c3:eb:3f:0a:2c:52:16:a0:2b:43:b9:
1277
+ # 25:90:3f:70:a9:33:25:6d:45:1a:28:3b:27:cf:aa:c3:29:42:
1278
+ # 1b:df:3b:4c:c0:33:34:5b:41:88:bf:6b:2b:65:af:28:ef:b2:
1279
+ # f5:c3:aa:66:ce:7b:56:ee:b7:c8:cb:67:c1:c9:9c:1a:18:b8:
1280
+ # c4:c3:49:03:f1:60:0e:50:cd:46:c5:f3:77:79:f7:b6:15:e0:
1281
+ # 38:db:c7:2f:28:a0:0c:3f:77:26:74:d9:25:12:da:31:da:1a:
1282
+ # 1e:dc:29:41:91:22:3c:69:a7:bb:02:f2:b6:5c:27:03:89:f4:
1283
+ # 06:ea:9b:e4:72:82:e3:a1:09:c1:e9:00:19:d3:3e:d4:70:6b:
1284
+ # ba:71:a6:aa:58:ae:f4:bb:e9:6c:b6:ef:87:cc:9b:bb:ff:39:
1285
+ # e6:56:61:d3:0a:a7:c4:5c:4c:60:7b:05:77:26:7a:bf:d8:07:
1286
+ # 52:2c:62:f7:70:63:d9:39:bc:6f:1c:c2:79:dc:76:29:af:ce:
1287
+ # c5:2c:64:04:5e:88:36:6e:31:d4:40:1a:62:34:36:3f:35:01:
1288
+ # ae:ac:63:a0
1289
+ -----BEGIN CERTIFICATE-----
1290
+ MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCB
1291
+ rjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf
1292
+ Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw
1293
+ MDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNV
1294
+ BAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0wODA0MDIwMDAwMDBa
1295
+ Fw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3Rl
1296
+ LCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9u
1297
+ MTgwNgYDVQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXpl
1298
+ ZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEcz
1299
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr8nLPvb2FvdeHsbnndm
1300
+ gcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2AtP0LMqmsywCPLLEHd5N/8
1301
+ YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC+BsUa0Lf
1302
+ b1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS9
1303
+ 9irY7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2S
1304
+ zhkGcuYMXDhpxwTWvGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUk
1305
+ OQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV
1306
+ HQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJKoZIhvcNAQELBQADggEBABpA
1307
+ 2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweKA3rD6z8KLFIW
1308
+ oCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
1309
+ t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7c
1310
+ KUGRIjxpp7sC8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fM
1311
+ m7v/OeZWYdMKp8RcTGB7BXcmer/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZu
1312
+ MdRAGmI0Nj81Aa6sY6A=
1313
+ -----END CERTIFICATE-----
1314
+ # Thawte Primary Root CA.pem
1315
+ # Certificate:
1316
+ # Data:
1317
+ # Version: 3 (0x2)
1318
+ # Serial Number:
1319
+ # 34:4e:d5:57:20:d5:ed:ec:49:f4:2f:ce:37:db:2b:6d
1320
+ # Signature Algorithm: sha1WithRSAEncryption
1321
+ # Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA
1322
+ # Validity
1323
+ # Not Before: Nov 17 00:00:00 2006 GMT
1324
+ # Not After : Jul 16 23:59:59 2036 GMT
1325
+ # Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA
1326
+ # Subject Public Key Info:
1327
+ # Public Key Algorithm: rsaEncryption
1328
+ # Public-Key: (2048 bit)
1329
+ # Modulus:
1330
+ # 00:ac:a0:f0:fb:80:59:d4:9c:c7:a4:cf:9d:a1:59:
1331
+ # 73:09:10:45:0c:0d:2c:6e:68:f1:6c:5b:48:68:49:
1332
+ # 59:37:fc:0b:33:19:c2:77:7f:cc:10:2d:95:34:1c:
1333
+ # e6:eb:4d:09:a7:1c:d2:b8:c9:97:36:02:b7:89:d4:
1334
+ # 24:5f:06:c0:cc:44:94:94:8d:02:62:6f:eb:5a:dd:
1335
+ # 11:8d:28:9a:5c:84:90:10:7a:0d:bd:74:66:2f:6a:
1336
+ # 38:a0:e2:d5:54:44:eb:1d:07:9f:07:ba:6f:ee:e9:
1337
+ # fd:4e:0b:29:f5:3e:84:a0:01:f1:9c:ab:f8:1c:7e:
1338
+ # 89:a4:e8:a1:d8:71:65:0d:a3:51:7b:ee:bc:d2:22:
1339
+ # 60:0d:b9:5b:9d:df:ba:fc:51:5b:0b:af:98:b2:e9:
1340
+ # 2e:e9:04:e8:62:87:de:2b:c8:d7:4e:c1:4c:64:1e:
1341
+ # dd:cf:87:58:ba:4a:4f:ca:68:07:1d:1c:9d:4a:c6:
1342
+ # d5:2f:91:cc:7c:71:72:1c:c5:c0:67:eb:32:fd:c9:
1343
+ # 92:5c:94:da:85:c0:9b:bf:53:7d:2b:09:f4:8c:9d:
1344
+ # 91:1f:97:6a:52:cb:de:09:36:a4:77:d8:7b:87:50:
1345
+ # 44:d5:3e:6e:29:69:fb:39:49:26:1e:09:a5:80:7b:
1346
+ # 40:2d:eb:e8:27:85:c9:fe:61:fd:7e:e6:7c:97:1d:
1347
+ # d5:9d
1348
+ # Exponent: 65537 (0x10001)
1349
+ # X509v3 extensions:
1350
+ # X509v3 Basic Constraints: critical
1351
+ # CA:TRUE
1352
+ # X509v3 Key Usage: critical
1353
+ # Certificate Sign, CRL Sign
1354
+ # X509v3 Subject Key Identifier:
1355
+ # 7B:5B:45:CF:AF:CE:CB:7A:FD:31:92:1A:6A:B6:F3:46:EB:57:48:50
1356
+ # Signature Algorithm: sha1WithRSAEncryption
1357
+ # 79:11:c0:4b:b3:91:b6:fc:f0:e9:67:d4:0d:6e:45:be:55:e8:
1358
+ # 93:d2:ce:03:3f:ed:da:25:b0:1d:57:cb:1e:3a:76:a0:4c:ec:
1359
+ # 50:76:e8:64:72:0c:a4:a9:f1:b8:8b:d6:d6:87:84:bb:32:e5:
1360
+ # 41:11:c0:77:d9:b3:60:9d:eb:1b:d5:d1:6e:44:44:a9:a6:01:
1361
+ # ec:55:62:1d:77:b8:5c:8e:48:49:7c:9c:3b:57:11:ac:ad:73:
1362
+ # 37:8e:2f:78:5c:90:68:47:d9:60:60:e6:fc:07:3d:22:20:17:
1363
+ # c4:f7:16:e9:c4:d8:72:f9:c8:73:7c:df:16:2f:15:a9:3e:fd:
1364
+ # 6a:27:b6:a1:eb:5a:ba:98:1f:d5:e3:4d:64:0a:9d:13:c8:61:
1365
+ # ba:f5:39:1c:87:ba:b8:bd:7b:22:7f:f6:fe:ac:40:79:e5:ac:
1366
+ # 10:6f:3d:8f:1b:79:76:8b:c4:37:b3:21:18:84:e5:36:00:eb:
1367
+ # 63:20:99:b9:e9:fe:33:04:bb:41:c8:c1:02:f9:44:63:20:9e:
1368
+ # 81:ce:42:d3:d6:3f:2c:76:d3:63:9c:59:dd:8f:a6:e1:0e:a0:
1369
+ # 2e:41:f7:2e:95:47:cf:bc:fd:33:f3:f6:0b:61:7e:7e:91:2b:
1370
+ # 81:47:c2:27:30:ee:a7:10:5d:37:8f:5c:39:2b:e4:04:f0:7b:
1371
+ # 8d:56:8c:68
1372
+ -----BEGIN CERTIFICATE-----
1373
+ MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB
1374
+ qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf
1375
+ Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw
1376
+ MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV
1377
+ BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw
1378
+ NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j
1379
+ LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG
1380
+ A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
1381
+ IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG
1382
+ SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs
1383
+ W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta
1384
+ 3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk
1385
+ 6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6
1386
+ Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J
1387
+ NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA
1388
+ MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP
1389
+ r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU
1390
+ DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz
1391
+ YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
1392
+ xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2
1393
+ /qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/
1394
+ LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7
1395
+ jVaMaA==
1396
+ -----END CERTIFICATE-----
app/code/community/BackupGuard/BackupGuardFree/com/lib/Dropbox/strict.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Throw exceptions on all PHP errors/warnings/notices.
3
+ // We'd like to do this in all situations (and not just when running tests), but
4
+ // this is a global setting and other code might not be ready for it.
5
+ /** @internal */
6
+ function error_to_exception($errno, $errstr, $errfile, $errline, $context)
7
+ {
8
+ // If the error is being suppressed with '@', don't throw an exception.
9
+ if (error_reporting() === 0) return;
10
+
11
+ throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
12
+ }
13
+ set_error_handler('error_to_exception');
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/.DS_Store ADDED
Binary file
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/Google_Client.php ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ // Check for the json extension, the Google APIs PHP Client won't function
19
+ // without it.
20
+ if (! function_exists('json_decode')) {
21
+ throw new Exception('Google PHP API Client requires the JSON PHP extension');
22
+ }
23
+
24
+ if (! function_exists('http_build_query')) {
25
+ throw new Exception('Google PHP API Client requires http_build_query()');
26
+ }
27
+
28
+ if (! ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
29
+ date_default_timezone_set('UTC');
30
+ }
31
+
32
+ // hack around with the include paths a bit so the library 'just works'
33
+ set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
34
+
35
+ require_once "config.php";
36
+ // If a local configuration file is found, merge it's values with the default configuration
37
+ if (file_exists(dirname(__FILE__) . '/local_config.php')) {
38
+ $defaultConfig = $apiConfig;
39
+ require_once (dirname(__FILE__) . '/local_config.php');
40
+ $apiConfig = array_merge($defaultConfig, $apiConfig);
41
+ }
42
+
43
+ // Include the top level classes, they each include their own dependencies
44
+ require_once 'service/Google_Model.php';
45
+ require_once 'service/Google_Service.php';
46
+ require_once 'service/Google_ServiceResource.php';
47
+ require_once 'auth/Google_AssertionCredentials.php';
48
+ require_once 'auth/Google_Signer.php';
49
+ require_once 'auth/Google_P12Signer.php';
50
+ require_once 'service/Google_BatchRequest.php';
51
+ require_once 'external/URITemplateParser.php';
52
+ require_once 'auth/Google_Auth.php';
53
+ require_once 'cache/Google_Cache.php';
54
+ require_once 'io/Google_IO.php';
55
+ require_once('service/Google_MediaFileUpload.php');
56
+
57
+ /**
58
+ * The Google API Client
59
+ * http://code.google.com/p/google-api-php-client/
60
+ *
61
+ * @author Chris Chabot <chabotc@google.com>
62
+ * @author Chirag Shah <chirags@google.com>
63
+ */
64
+ class Google_Client {
65
+ /**
66
+ * @static
67
+ * @var Google_Auth $auth
68
+ */
69
+ static $auth;
70
+
71
+ /**
72
+ * @static
73
+ * @var Google_IO $io
74
+ */
75
+ static $io;
76
+
77
+ /**
78
+ * @static
79
+ * @var Google_Cache $cache
80
+ */
81
+ static $cache;
82
+
83
+ /**
84
+ * @static
85
+ * @var boolean $useBatch
86
+ */
87
+ static $useBatch = false;
88
+
89
+ /** @var array $scopes */
90
+ protected $scopes = array();
91
+
92
+ /** @var bool $useObjects */
93
+ protected $useObjects = false;
94
+
95
+ // definitions of services that are discovered.
96
+ protected $services = array();
97
+
98
+ // Used to track authenticated state, can't discover services after doing authenticate()
99
+ private $authenticated = false;
100
+
101
+ public function __construct($config = array()) {
102
+ global $apiConfig;
103
+ $apiConfig = array_merge($apiConfig, $config);
104
+ self::$cache = new $apiConfig['cacheClass']();
105
+ self::$auth = new $apiConfig['authClass']();
106
+ self::$io = new $apiConfig['ioClass']();
107
+ }
108
+
109
+ /**
110
+ * Add a service
111
+ */
112
+ public function addService($service, $version = false) {
113
+ global $apiConfig;
114
+ if ($this->authenticated) {
115
+ throw new Google_Exception('Cant add services after having authenticated');
116
+ }
117
+ $this->services[$service] = array();
118
+ if (isset($apiConfig['services'][$service])) {
119
+ // Merge the service descriptor with the default values
120
+ $this->services[$service] = array_merge($this->services[$service], $apiConfig['services'][$service]);
121
+ }
122
+ }
123
+
124
+ public function authenticate($code = null) {
125
+ $service = $this->prepareService();
126
+ $this->authenticated = true;
127
+ return self::$auth->authenticate($service, $code);
128
+ }
129
+
130
+ /**
131
+ * @return array
132
+ * @visible For Testing
133
+ */
134
+ public function prepareService() {
135
+ $service = array();
136
+ $scopes = array();
137
+ if ($this->scopes) {
138
+ $scopes = $this->scopes;
139
+ } else {
140
+ foreach ($this->services as $key => $val) {
141
+ if (isset($val['scope'])) {
142
+ if (is_array($val['scope'])) {
143
+ $scopes = array_merge($val['scope'], $scopes);
144
+ } else {
145
+ $scopes[] = $val['scope'];
146
+ }
147
+ } else {
148
+ $scopes[] = 'https://www.googleapis.com/auth/' . $key;
149
+ }
150
+ unset($val['discoveryURI']);
151
+ unset($val['scope']);
152
+ $service = array_merge($service, $val);
153
+ }
154
+ }
155
+ $service['scope'] = implode(' ', $scopes);
156
+ return $service;
157
+ }
158
+
159
+ /**
160
+ * Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
161
+ * or Google_Client#getAccessToken().
162
+ * @param string $accessToken JSON encoded string containing in the following format:
163
+ * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
164
+ * "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
165
+ */
166
+ public function setAccessToken($accessToken) {
167
+ if ($accessToken == null || 'null' == $accessToken) {
168
+ $accessToken = null;
169
+ }
170
+ self::$auth->setAccessToken($accessToken);
171
+ }
172
+
173
+ /**
174
+ * Set the type of Auth class the client should use.
175
+ * @param string $authClassName
176
+ */
177
+ public function setAuthClass($authClassName) {
178
+ self::$auth = new $authClassName();
179
+ }
180
+
181
+ /**
182
+ * Construct the OAuth 2.0 authorization request URI.
183
+ * @return string
184
+ */
185
+ public function createAuthUrl() {
186
+ $service = $this->prepareService();
187
+ return self::$auth->createAuthUrl($service['scope']);
188
+ }
189
+
190
+ /**
191
+ * Get the OAuth 2.0 access token.
192
+ * @return string $accessToken JSON encoded string in the following format:
193
+ * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
194
+ * "expires_in":3600,"id_token":"TOKEN", "created":1320790426}
195
+ */
196
+ public function getAccessToken() {
197
+ $token = self::$auth->getAccessToken();
198
+ return (null == $token || 'null' == $token) ? null : $token;
199
+ }
200
+
201
+ /**
202
+ * Returns if the access_token is expired.
203
+ * @return bool Returns True if the access_token is expired.
204
+ */
205
+ public function isAccessTokenExpired() {
206
+ return self::$auth->isAccessTokenExpired();
207
+ }
208
+
209
+ /**
210
+ * Set the developer key to use, these are obtained through the API Console.
211
+ * @see http://code.google.com/apis/console-help/#generatingdevkeys
212
+ * @param string $developerKey
213
+ */
214
+ public function setDeveloperKey($developerKey) {
215
+ self::$auth->setDeveloperKey($developerKey);
216
+ }
217
+
218
+ /**
219
+ * Set OAuth 2.0 "state" parameter to achieve per-request customization.
220
+ * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2
221
+ * @param string $state
222
+ */
223
+ public function setState($state) {
224
+ self::$auth->setState($state);
225
+ }
226
+
227
+ /**
228
+ * @param string $accessType Possible values for access_type include:
229
+ * {@code "offline"} to request offline access from the user. (This is the default value)
230
+ * {@code "online"} to request online access from the user.
231
+ */
232
+ public function setAccessType($accessType) {
233
+ self::$auth->setAccessType($accessType);
234
+ }
235
+
236
+ /**
237
+ * @param string $approvalPrompt Possible values for approval_prompt include:
238
+ * {@code "force"} to force the approval UI to appear. (This is the default value)
239
+ * {@code "auto"} to request auto-approval when possible.
240
+ */
241
+ public function setApprovalPrompt($approvalPrompt) {
242
+ self::$auth->setApprovalPrompt($approvalPrompt);
243
+ }
244
+
245
+ /**
246
+ * Set the application name, this is included in the User-Agent HTTP header.
247
+ * @param string $applicationName
248
+ */
249
+ public function setApplicationName($applicationName) {
250
+ global $apiConfig;
251
+ $apiConfig['application_name'] = $applicationName;
252
+ }
253
+
254
+ /**
255
+ * Set the OAuth 2.0 Client ID.
256
+ * @param string $clientId
257
+ */
258
+ public function setClientId($clientId) {
259
+ global $apiConfig;
260
+ $apiConfig['oauth2_client_id'] = $clientId;
261
+ self::$auth->clientId = $clientId;
262
+ }
263
+
264
+ /**
265
+ * Get the OAuth 2.0 Client ID.
266
+ */
267
+ public function getClientId() {
268
+ return self::$auth->clientId;
269
+ }
270
+
271
+ /**
272
+ * Set the OAuth 2.0 Client Secret.
273
+ * @param string $clientSecret
274
+ */
275
+ public function setClientSecret($clientSecret) {
276
+ global $apiConfig;
277
+ $apiConfig['oauth2_client_secret'] = $clientSecret;
278
+ self::$auth->clientSecret = $clientSecret;
279
+ }
280
+
281
+ /**
282
+ * Get the OAuth 2.0 Client Secret.
283
+ */
284
+ public function getClientSecret() {
285
+ return self::$auth->clientSecret;
286
+ }
287
+
288
+ /**
289
+ * Set the OAuth 2.0 Redirect URI.
290
+ * @param string $redirectUri
291
+ */
292
+ public function setRedirectUri($redirectUri) {
293
+ global $apiConfig;
294
+ $apiConfig['oauth2_redirect_uri'] = $redirectUri;
295
+ self::$auth->redirectUri = $redirectUri;
296
+ }
297
+
298
+ /**
299
+ * Get the OAuth 2.0 Redirect URI.
300
+ */
301
+ public function getRedirectUri() {
302
+ return self::$auth->redirectUri;
303
+ }
304
+
305
+ /**
306
+ * Fetches a fresh OAuth 2.0 access token with the given refresh token.
307
+ * @param string $refreshToken
308
+ * @return void
309
+ */
310
+ public function refreshToken($refreshToken) {
311
+ self::$auth->refreshToken($refreshToken);
312
+ }
313
+
314
+ /**
315
+ * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
316
+ * token, if a token isn't provided.
317
+ * @throws Google_AuthException
318
+ * @param string|null $token The token (access token or a refresh token) that should be revoked.
319
+ * @return boolean Returns True if the revocation was successful, otherwise False.
320
+ */
321
+ public function revokeToken($token = null) {
322
+ self::$auth->revokeToken($token);
323
+ }
324
+
325
+ /**
326
+ * Verify an id_token. This method will verify the current id_token, if one
327
+ * isn't provided.
328
+ * @throws Google_AuthException
329
+ * @param string|null $token The token (id_token) that should be verified.
330
+ * @return Google_LoginTicket Returns an apiLoginTicket if the verification was
331
+ * successful.
332
+ */
333
+ public function verifyIdToken($token = null) {
334
+ return self::$auth->verifyIdToken($token);
335
+ }
336
+
337
+ /**
338
+ * @param Google_AssertionCredentials $creds
339
+ * @return void
340
+ */
341
+ public function setAssertionCredentials(Google_AssertionCredentials $creds) {
342
+ self::$auth->setAssertionCredentials($creds);
343
+ }
344
+
345
+ /**
346
+ * This function allows you to overrule the automatically generated scopes,
347
+ * so that you can ask for more or less permission in the auth flow
348
+ * Set this before you call authenticate() though!
349
+ * @param array $scopes, ie: array('https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/moderator')
350
+ */
351
+ public function setScopes($scopes) {
352
+ $this->scopes = is_string($scopes) ? explode(" ", $scopes) : $scopes;
353
+ }
354
+
355
+ /**
356
+ * Returns the list of scopes set on the client
357
+ * @return array the list of scopes
358
+ *
359
+ */
360
+ public function getScopes() {
361
+ return $this->scopes;
362
+ }
363
+
364
+ /**
365
+ * If 'plus.login' is included in the list of requested scopes, you can use
366
+ * this method to define types of app activities that your app will write.
367
+ * You can find a list of available types here:
368
+ * @link https://developers.google.com/+/api/moment-types
369
+ *
370
+ * @param array $requestVisibleActions Array of app activity types
371
+ */
372
+ public function setRequestVisibleActions($requestVisibleActions) {
373
+ self::$auth->requestVisibleActions =
374
+ join(" ", $requestVisibleActions);
375
+ }
376
+
377
+ /**
378
+ * Declare if objects should be returned by the api service classes.
379
+ *
380
+ * @param boolean $useObjects True if objects should be returned by the service classes.
381
+ * False if associative arrays should be returned (default behavior).
382
+ * @experimental
383
+ */
384
+ public function setUseObjects($useObjects) {
385
+ global $apiConfig;
386
+ $apiConfig['use_objects'] = $useObjects;
387
+ }
388
+
389
+ /**
390
+ * Declare if objects should be returned by the api service classes.
391
+ *
392
+ * @param boolean $useBatch True if the experimental batch support should
393
+ * be enabled. Defaults to False.
394
+ * @experimental
395
+ */
396
+ public function setUseBatch($useBatch) {
397
+ self::$useBatch = $useBatch;
398
+ }
399
+
400
+ /**
401
+ * @static
402
+ * @return Google_Auth the implementation of apiAuth.
403
+ */
404
+ public static function getAuth() {
405
+ return Google_Client::$auth;
406
+ }
407
+
408
+ /**
409
+ * @static
410
+ * @return Google_IO the implementation of apiIo.
411
+ */
412
+ public static function getIo() {
413
+ return Google_Client::$io;
414
+ }
415
+
416
+ /**
417
+ * @return Google_Cache the implementation of apiCache.
418
+ */
419
+ public function getCache() {
420
+ return Google_Client::$cache;
421
+ }
422
+ }
423
+
424
+ // Exceptions that the Google PHP API Library can throw
425
+ class Google_Exception extends Exception {}
426
+ class Google_AuthException extends Google_Exception {}
427
+ class Google_CacheException extends Google_Exception {}
428
+ class Google_IOException extends Google_Exception {}
429
+ class Google_ServiceException extends Google_Exception {
430
+ /**
431
+ * Optional list of errors returned in a JSON body of an HTTP error response.
432
+ */
433
+ protected $errors = array();
434
+
435
+ /**
436
+ * Override default constructor to add ability to set $errors.
437
+ *
438
+ * @param string $message
439
+ * @param int $code
440
+ * @param Exception|null $previous
441
+ * @param [{string, string}] errors List of errors returned in an HTTP
442
+ * response. Defaults to [].
443
+ */
444
+ public function __construct($message, $code = 0, Exception $previous = null,
445
+ $errors = array()) {
446
+ if(version_compare(PHP_VERSION, '5.3.0') >= 0) {
447
+ parent::__construct($message, $code, $previous);
448
+ } else {
449
+ parent::__construct($message, $code);
450
+ }
451
+
452
+ $this->errors = $errors;
453
+ }
454
+
455
+ /**
456
+ * An example of the possible errors returned.
457
+ *
458
+ * {
459
+ * "domain": "global",
460
+ * "reason": "authError",
461
+ * "message": "Invalid Credentials",
462
+ * "locationType": "header",
463
+ * "location": "Authorization",
464
+ * }
465
+ *
466
+ * @return [{string, string}] List of errors return in an HTTP response or [].
467
+ */
468
+ public function getErrors() {
469
+ return $this->errors;
470
+ }
471
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_AssertionCredentials.php ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
19
+ * Credentials object used for OAuth 2.0 Signed JWT assertion grants.
20
+ *
21
+ * @author Chirag Shah <chirags@google.com>
22
+ */
23
+ class Google_AssertionCredentials {
24
+ const MAX_TOKEN_LIFETIME_SECS = 3600;
25
+
26
+ public $serviceAccountName;
27
+ public $scopes;
28
+ public $privateKey;
29
+ public $privateKeyPassword;
30
+ public $assertionType;
31
+ public $sub;
32
+ /**
33
+ * @deprecated
34
+ * @link http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
35
+ */
36
+ public $prn;
37
+
38
+ /**
39
+ * @param $serviceAccountName
40
+ * @param $scopes array List of scopes
41
+ * @param $privateKey
42
+ * @param string $privateKeyPassword
43
+ * @param string $assertionType
44
+ * @param bool|string $sub The email address of the user for which the
45
+ * application is requesting delegated access.
46
+ */
47
+ public function __construct(
48
+ $serviceAccountName,
49
+ $scopes,
50
+ $privateKey,
51
+ $privateKeyPassword = 'notasecret',
52
+ $assertionType = 'http://oauth.net/grant_type/jwt/1.0/bearer',
53
+ $sub = false) {
54
+ $this->serviceAccountName = $serviceAccountName;
55
+ $this->scopes = is_string($scopes) ? $scopes : implode(' ', $scopes);
56
+ $this->privateKey = $privateKey;
57
+ $this->privateKeyPassword = $privateKeyPassword;
58
+ $this->assertionType = $assertionType;
59
+ $this->sub = $sub;
60
+ $this->prn = $sub;
61
+ }
62
+
63
+ public function generateAssertion() {
64
+ $now = time();
65
+
66
+ $jwtParams = array(
67
+ 'aud' => Google_OAuth2::OAUTH2_TOKEN_URI,
68
+ 'scope' => $this->scopes,
69
+ 'iat' => $now,
70
+ 'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
71
+ 'iss' => $this->serviceAccountName,
72
+ );
73
+
74
+ if ($this->sub !== false) {
75
+ $jwtParams['sub'] = $this->sub;
76
+ } else if ($this->prn !== false) {
77
+ $jwtParams['prn'] = $this->prn;
78
+ }
79
+
80
+ return $this->makeSignedJwt($jwtParams);
81
+ }
82
+
83
+ /**
84
+ * Creates a signed JWT.
85
+ * @param array $payload
86
+ * @return string The signed JWT.
87
+ */
88
+ private function makeSignedJwt($payload) {
89
+ $header = array('typ' => 'JWT', 'alg' => 'RS256');
90
+
91
+ $segments = array(
92
+ Google_Utils::urlSafeB64Encode(json_encode($header)),
93
+ Google_Utils::urlSafeB64Encode(json_encode($payload))
94
+ );
95
+
96
+ $signingInput = implode('.', $segments);
97
+ $signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword);
98
+ $signature = $signer->sign($signingInput);
99
+ $segments[] = Google_Utils::urlSafeB64Encode($signature);
100
+
101
+ return implode(".", $segments);
102
+ }
103
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_Auth.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ require_once "Google_AuthNone.php";
19
+ require_once "Google_OAuth2.php";
20
+
21
+ /**
22
+ * Abstract class for the Authentication in the API client
23
+ * @author Chris Chabot <chabotc@google.com>
24
+ *
25
+ */
26
+ abstract class Google_Auth {
27
+ abstract public function authenticate($service);
28
+ abstract public function sign(Google_HttpRequest $request);
29
+ abstract public function createAuthUrl($scope);
30
+
31
+ abstract public function getAccessToken();
32
+ abstract public function setAccessToken($accessToken);
33
+ abstract public function setDeveloperKey($developerKey);
34
+ abstract public function refreshToken($refreshToken);
35
+ abstract public function revokeToken();
36
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_AuthNone.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
19
+ * Do-nothing authentication implementation, use this if you want to make un-authenticated calls
20
+ * @author Chris Chabot <chabotc@google.com>
21
+ * @author Chirag Shah <chirags@google.com>
22
+ */
23
+ class Google_AuthNone extends Google_Auth {
24
+ public $key = null;
25
+
26
+ public function __construct() {
27
+ global $apiConfig;
28
+ if (!empty($apiConfig['developer_key'])) {
29
+ $this->setDeveloperKey($apiConfig['developer_key']);
30
+ }
31
+ }
32
+
33
+ public function setDeveloperKey($key) {$this->key = $key;}
34
+ public function authenticate($service) {/*noop*/}
35
+ public function setAccessToken($accessToken) {/* noop*/}
36
+ public function getAccessToken() {return null;}
37
+ public function createAuthUrl($scope) {return null;}
38
+ public function refreshToken($refreshToken) {/* noop*/}
39
+ public function revokeToken() {/* noop*/}
40
+
41
+ public function sign(Google_HttpRequest $request) {
42
+ if ($this->key) {
43
+ $request->setUrl($request->getUrl() . ((strpos($request->getUrl(), '?') === false) ? '?' : '&')
44
+ . 'key='.urlencode($this->key));
45
+ }
46
+ return $request;
47
+ }
48
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_LoginTicket.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Class to hold information about an authenticated login.
20
+ *
21
+ * @author Brian Eaton <beaton@google.com>
22
+ */
23
+ class Google_LoginTicket {
24
+ const USER_ATTR = "id";
25
+
26
+ // Information from id token envelope.
27
+ private $envelope;
28
+
29
+ // Information from id token payload.
30
+ private $payload;
31
+
32
+ /**
33
+ * Creates a user based on the supplied token.
34
+ *
35
+ * @param string $envelope Header from a verified authentication token.
36
+ * @param string $payload Information from a verified authentication token.
37
+ */
38
+ public function __construct($envelope, $payload) {
39
+ $this->envelope = $envelope;
40
+ $this->payload = $payload;
41
+ }
42
+
43
+ /**
44
+ * Returns the numeric identifier for the user.
45
+ * @throws Google_AuthException
46
+ * @return
47
+ */
48
+ public function getUserId() {
49
+ if (array_key_exists(self::USER_ATTR, $this->payload)) {
50
+ return $this->payload[self::USER_ATTR];
51
+ }
52
+ throw new Google_AuthException("No user_id in token");
53
+ }
54
+
55
+ /**
56
+ * Returns attributes from the login ticket. This can contain
57
+ * various information about the user session.
58
+ * @return array
59
+ */
60
+ public function getAttributes() {
61
+ return array("envelope" => $this->envelope, "payload" => $this->payload);
62
+ }
63
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_OAuth2.php ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 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
+ require_once "Google_Verifier.php";
19
+ require_once "Google_LoginTicket.php";
20
+ require_once "service/Google_Utils.php";
21
+
22
+ /**
23
+ * Authentication class that deals with the OAuth 2 web-server authentication flow
24
+ *
25
+ * @author Chris Chabot <chabotc@google.com>
26
+ * @author Chirag Shah <chirags@google.com>
27
+ *
28
+ */
29
+ class Google_OAuth2 extends Google_Auth {
30
+ public $clientId;
31
+ public $clientSecret;
32
+ public $developerKey;
33
+ public $token;
34
+ public $redirectUri;
35
+ public $state;
36
+ public $accessType = 'offline';
37
+ public $approvalPrompt = 'force';
38
+ public $requestVisibleActions;
39
+
40
+ /** @var Google_AssertionCredentials $assertionCredentials */
41
+ public $assertionCredentials;
42
+
43
+ const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
44
+ const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
45
+ const OAUTH2_AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';
46
+ const OAUTH2_FEDERATED_SIGNON_CERTS_URL = 'https://www.googleapis.com/oauth2/v1/certs';
47
+ const CLOCK_SKEW_SECS = 300; // five minutes in seconds
48
+ const AUTH_TOKEN_LIFETIME_SECS = 300; // five minutes in seconds
49
+ const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
50
+
51
+ /**
52
+ * Instantiates the class, but does not initiate the login flow, leaving it
53
+ * to the discretion of the caller (which is done by calling authenticate()).
54
+ */
55
+ public function __construct() {
56
+ global $apiConfig;
57
+
58
+ if (! empty($apiConfig['developer_key'])) {
59
+ $this->developerKey = $apiConfig['developer_key'];
60
+ }
61
+
62
+ if (! empty($apiConfig['oauth2_client_id'])) {
63
+ $this->clientId = $apiConfig['oauth2_client_id'];
64
+ }
65
+
66
+ if (! empty($apiConfig['oauth2_client_secret'])) {
67
+ $this->clientSecret = $apiConfig['oauth2_client_secret'];
68
+ }
69
+
70
+ if (! empty($apiConfig['oauth2_redirect_uri'])) {
71
+ $this->redirectUri = $apiConfig['oauth2_redirect_uri'];
72
+ }
73
+
74
+ if (! empty($apiConfig['oauth2_access_type'])) {
75
+ $this->accessType = $apiConfig['oauth2_access_type'];
76
+ }
77
+
78
+ if (! empty($apiConfig['oauth2_approval_prompt'])) {
79
+ $this->approvalPrompt = $apiConfig['oauth2_approval_prompt'];
80
+ }
81
+
82
+ }
83
+
84
+ /**
85
+ * @param $service
86
+ * @param string|null $code
87
+ * @throws Google_AuthException
88
+ * @return string
89
+ */
90
+ public function authenticate($service, $code = null) {
91
+ if (!$code && isset($_GET['code'])) {
92
+ $code = $_GET['code'];
93
+ }
94
+
95
+ if ($code) {
96
+ // We got here from the redirect from a successful authorization grant, fetch the access token
97
+ $request = Google_Client::$io->makeRequest(new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), array(
98
+ 'code' => $code,
99
+ 'grant_type' => 'authorization_code',
100
+ 'redirect_uri' => $this->redirectUri,
101
+ 'client_id' => $this->clientId,
102
+ 'client_secret' => $this->clientSecret
103
+ )));
104
+
105
+ if ($request->getResponseHttpCode() == 200) {
106
+ $this->setAccessToken($request->getResponseBody());
107
+ $this->token['created'] = time();
108
+ return $this->getAccessToken();
109
+ } else {
110
+ $response = $request->getResponseBody();
111
+ $decodedResponse = json_decode($response, true);
112
+ if ($decodedResponse != null && $decodedResponse['error']) {
113
+ $response = $decodedResponse['error'];
114
+ }
115
+ throw new Google_AuthException("Error fetching OAuth2 access token, message: '$response'", $request->getResponseHttpCode());
116
+ }
117
+ }
118
+
119
+ $authUrl = $this->createAuthUrl($service['scope']);
120
+ header('Location: ' . $authUrl);
121
+ return true;
122
+ }
123
+
124
+ /**
125
+ * Create a URL to obtain user authorization.
126
+ * The authorization endpoint allows the user to first
127
+ * authenticate, and then grant/deny the access request.
128
+ * @param string $scope The scope is expressed as a list of space-delimited strings.
129
+ * @return string
130
+ */
131
+ public function createAuthUrl($scope) {
132
+ $params = array(
133
+ 'response_type=code',
134
+ 'redirect_uri=' . urlencode($this->redirectUri),
135
+ 'client_id=' . urlencode($this->clientId),
136
+ 'scope=' . urlencode($scope),
137
+ 'access_type=' . urlencode($this->accessType),
138
+ 'approval_prompt=' . urlencode($this->approvalPrompt),
139
+ );
140
+
141
+ // if the list of scopes contains plus.login, add request_visible_actions
142
+ // to auth URL
143
+ if(strpos($scope, 'plus.login') && count($this->requestVisibleActions) > 0) {
144
+ $params[] = 'request_visible_actions=' .
145
+ urlencode($this->requestVisibleActions);
146
+ }
147
+
148
+ if (isset($this->state)) {
149
+ $params[] = 'state=' . urlencode($this->state);
150
+ }
151
+ $params = implode('&', $params);
152
+ return self::OAUTH2_AUTH_URL . "?$params";
153
+ }
154
+
155
+ /**
156
+ * @param string $token
157
+ * @throws Google_AuthException
158
+ */
159
+ public function setAccessToken($token) {
160
+ $token = json_decode($token, true);
161
+ if ($token == null) {
162
+ throw new Google_AuthException('Could not json decode the token');
163
+ }
164
+ if (! isset($token['access_token'])) {
165
+ throw new Google_AuthException("Invalid token format");
166
+ }
167
+ $this->token = $token;
168
+ }
169
+
170
+ public function getAccessToken() {
171
+ return json_encode($this->token);
172
+ }
173
+
174
+ public function setDeveloperKey($developerKey) {
175
+ $this->developerKey = $developerKey;
176
+ }
177
+
178
+ public function setState($state) {
179
+ $this->state = $state;
180
+ }
181
+
182
+ public function setAccessType($accessType) {
183
+ $this->accessType = $accessType;
184
+ }
185
+
186
+ public function setApprovalPrompt($approvalPrompt) {
187
+ $this->approvalPrompt = $approvalPrompt;
188
+ }
189
+
190
+ public function setAssertionCredentials(Google_AssertionCredentials $creds) {
191
+ $this->assertionCredentials = $creds;
192
+ }
193
+
194
+ /**
195
+ * Include an accessToken in a given apiHttpRequest.
196
+ * @param Google_HttpRequest $request
197
+ * @return Google_HttpRequest
198
+ * @throws Google_AuthException
199
+ */
200
+ public function sign(Google_HttpRequest $request) {
201
+ // add the developer key to the request before signing it
202
+ if ($this->developerKey) {
203
+ $requestUrl = $request->getUrl();
204
+ $requestUrl .= (strpos($request->getUrl(), '?') === false) ? '?' : '&';
205
+ $requestUrl .= 'key=' . urlencode($this->developerKey);
206
+ $request->setUrl($requestUrl);
207
+ }
208
+
209
+ // Cannot sign the request without an OAuth access token.
210
+ if (null == $this->token && null == $this->assertionCredentials) {
211
+ return $request;
212
+ }
213
+
214
+ // Check if the token is set to expire in the next 30 seconds
215
+ // (or has already expired).
216
+ if ($this->isAccessTokenExpired()) {
217
+ if ($this->assertionCredentials) {
218
+ $this->refreshTokenWithAssertion();
219
+ } else {
220
+ if (! array_key_exists('refresh_token', $this->token)) {
221
+ throw new Google_AuthException("The OAuth 2.0 access token has expired, "
222
+ . "and a refresh token is not available. Refresh tokens are not "
223
+ . "returned for responses that were auto-approved.");
224
+ }
225
+ $this->refreshToken($this->token['refresh_token']);
226
+ }
227
+ }
228
+
229
+ // Add the OAuth2 header to the request
230
+ $request->setRequestHeaders(
231
+ array('Authorization' => 'Bearer ' . $this->token['access_token'])
232
+ );
233
+
234
+ return $request;
235
+ }
236
+
237
+ /**
238
+ * Fetches a fresh access token with the given refresh token.
239
+ * @param string $refreshToken
240
+ * @return void
241
+ */
242
+ public function refreshToken($refreshToken) {
243
+ $this->refreshTokenRequest(array(
244
+ 'client_id' => $this->clientId,
245
+ 'client_secret' => $this->clientSecret,
246
+ 'refresh_token' => $refreshToken,
247
+ 'grant_type' => 'refresh_token'
248
+ ));
249
+ }
250
+
251
+ /**
252
+ * Fetches a fresh access token with a given assertion token.
253
+ * @param Google_AssertionCredentials $assertionCredentials optional.
254
+ * @return void
255
+ */
256
+ public function refreshTokenWithAssertion($assertionCredentials = null) {
257
+ if (!$assertionCredentials) {
258
+ $assertionCredentials = $this->assertionCredentials;
259
+ }
260
+
261
+ $this->refreshTokenRequest(array(
262
+ 'grant_type' => 'assertion',
263
+ 'assertion_type' => $assertionCredentials->assertionType,
264
+ 'assertion' => $assertionCredentials->generateAssertion(),
265
+ ));
266
+ }
267
+
268
+ private function refreshTokenRequest($params) {
269
+ $http = new Google_HttpRequest(self::OAUTH2_TOKEN_URI, 'POST', array(), $params);
270
+ $request = Google_Client::$io->makeRequest($http);
271
+
272
+ $code = $request->getResponseHttpCode();
273
+ $body = $request->getResponseBody();
274
+ if (200 == $code) {
275
+ $token = json_decode($body, true);
276
+ if ($token == null) {
277
+ throw new Google_AuthException("Could not json decode the access token");
278
+ }
279
+
280
+ if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
281
+ throw new Google_AuthException("Invalid token format");
282
+ }
283
+
284
+ $this->token['access_token'] = $token['access_token'];
285
+ $this->token['expires_in'] = $token['expires_in'];
286
+ $this->token['created'] = time();
287
+ } else {
288
+ throw new Google_AuthException("Error refreshing the OAuth2 token, message: '$body'", $code);
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
294
+ * token, if a token isn't provided.
295
+ * @throws Google_AuthException
296
+ * @param string|null $token The token (access token or a refresh token) that should be revoked.
297
+ * @return boolean Returns True if the revocation was successful, otherwise False.
298
+ */
299
+ public function revokeToken($token = null) {
300
+ if (!$token) {
301
+ $token = $this->token['access_token'];
302
+ }
303
+ $request = new Google_HttpRequest(self::OAUTH2_REVOKE_URI, 'POST', array(), "token=$token");
304
+ $response = Google_Client::$io->makeRequest($request);
305
+ $code = $response->getResponseHttpCode();
306
+ if ($code == 200) {
307
+ $this->token = null;
308
+ return true;
309
+ }
310
+
311
+ return false;
312
+ }
313
+
314
+ /**
315
+ * Returns if the access_token is expired.
316
+ * @return bool Returns True if the access_token is expired.
317
+ */
318
+ public function isAccessTokenExpired() {
319
+ if (null == $this->token) {
320
+ return true;
321
+ }
322
+
323
+ // If the token is set to expire in the next 30 seconds.
324
+ $expired = ($this->token['created']
325
+ + ($this->token['expires_in'] - 30)) < time();
326
+
327
+ return $expired;
328
+ }
329
+
330
+ // Gets federated sign-on certificates to use for verifying identity tokens.
331
+ // Returns certs as array structure, where keys are key ids, and values
332
+ // are PEM encoded certificates.
333
+ private function getFederatedSignOnCerts() {
334
+ // This relies on makeRequest caching certificate responses.
335
+ $request = Google_Client::$io->makeRequest(new Google_HttpRequest(
336
+ self::OAUTH2_FEDERATED_SIGNON_CERTS_URL));
337
+ if ($request->getResponseHttpCode() == 200) {
338
+ $certs = json_decode($request->getResponseBody(), true);
339
+ if ($certs) {
340
+ return $certs;
341
+ }
342
+ }
343
+ throw new Google_AuthException(
344
+ "Failed to retrieve verification certificates: '" .
345
+ $request->getResponseBody() . "'.",
346
+ $request->getResponseHttpCode());
347
+ }
348
+
349
+ /**
350
+ * Verifies an id token and returns the authenticated apiLoginTicket.
351
+ * Throws an exception if the id token is not valid.
352
+ * The audience parameter can be used to control which id tokens are
353
+ * accepted. By default, the id token must have been issued to this OAuth2 client.
354
+ *
355
+ * @param $id_token
356
+ * @param $audience
357
+ * @return Google_LoginTicket
358
+ */
359
+ public function verifyIdToken($id_token = null, $audience = null) {
360
+ if (!$id_token) {
361
+ $id_token = $this->token['id_token'];
362
+ }
363
+
364
+ $certs = $this->getFederatedSignonCerts();
365
+ if (!$audience) {
366
+ $audience = $this->clientId;
367
+ }
368
+ return $this->verifySignedJwtWithCerts($id_token, $certs, $audience);
369
+ }
370
+
371
+ // Verifies the id token, returns the verified token contents.
372
+ // Visible for testing.
373
+ function verifySignedJwtWithCerts($jwt, $certs, $required_audience) {
374
+ $segments = explode(".", $jwt);
375
+ if (count($segments) != 3) {
376
+ throw new Google_AuthException("Wrong number of segments in token: $jwt");
377
+ }
378
+ $signed = $segments[0] . "." . $segments[1];
379
+ $signature = Google_Utils::urlSafeB64Decode($segments[2]);
380
+
381
+ // Parse envelope.
382
+ $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
383
+ if (!$envelope) {
384
+ throw new Google_AuthException("Can't parse token envelope: " . $segments[0]);
385
+ }
386
+
387
+ // Parse token
388
+ $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
389
+ $payload = json_decode($json_body, true);
390
+ if (!$payload) {
391
+ throw new Google_AuthException("Can't parse token payload: " . $segments[1]);
392
+ }
393
+
394
+ // Check signature
395
+ $verified = false;
396
+ foreach ($certs as $keyName => $pem) {
397
+ $public_key = new Google_PemVerifier($pem);
398
+ if ($public_key->verify($signed, $signature)) {
399
+ $verified = true;
400
+ break;
401
+ }
402
+ }
403
+
404
+ if (!$verified) {
405
+ throw new Google_AuthException("Invalid token signature: $jwt");
406
+ }
407
+
408
+ // Check issued-at timestamp
409
+ $iat = 0;
410
+ if (array_key_exists("iat", $payload)) {
411
+ $iat = $payload["iat"];
412
+ }
413
+ if (!$iat) {
414
+ throw new Google_AuthException("No issue time in token: $json_body");
415
+ }
416
+ $earliest = $iat - self::CLOCK_SKEW_SECS;
417
+
418
+ // Check expiration timestamp
419
+ $now = time();
420
+ $exp = 0;
421
+ if (array_key_exists("exp", $payload)) {
422
+ $exp = $payload["exp"];
423
+ }
424
+ if (!$exp) {
425
+ throw new Google_AuthException("No expiration time in token: $json_body");
426
+ }
427
+ if ($exp >= $now + self::MAX_TOKEN_LIFETIME_SECS) {
428
+ throw new Google_AuthException(
429
+ "Expiration time too far in future: $json_body");
430
+ }
431
+
432
+ $latest = $exp + self::CLOCK_SKEW_SECS;
433
+ if ($now < $earliest) {
434
+ throw new Google_AuthException(
435
+ "Token used too early, $now < $earliest: $json_body");
436
+ }
437
+ if ($now > $latest) {
438
+ throw new Google_AuthException(
439
+ "Token used too late, $now > $latest: $json_body");
440
+ }
441
+
442
+ // TODO(beaton): check issuer field?
443
+
444
+ // Check audience
445
+ $aud = $payload["aud"];
446
+ if ($aud != $required_audience) {
447
+ throw new Google_AuthException("Wrong recipient, $aud != $required_audience: $json_body");
448
+ }
449
+
450
+ // All good.
451
+ return new Google_LoginTicket($envelope, $payload);
452
+ }
453
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_P12Signer.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Signs data.
20
+ *
21
+ * Only used for testing.
22
+ *
23
+ * @author Brian Eaton <beaton@google.com>
24
+ */
25
+ class Google_P12Signer extends Google_Signer {
26
+ // OpenSSL private key resource
27
+ private $privateKey;
28
+
29
+ // Creates a new signer from a .p12 file.
30
+ function __construct($p12, $password) {
31
+ if (!function_exists('openssl_x509_read')) {
32
+ throw new Exception(
33
+ 'The Google PHP API library needs the openssl PHP extension');
34
+ }
35
+
36
+ // This throws on error
37
+ $certs = array();
38
+ if (!openssl_pkcs12_read($p12, $certs, $password)) {
39
+ throw new Google_AuthException("Unable to parse the p12 file. " .
40
+ "Is this a .p12 file? Is the password correct? OpenSSL error: " .
41
+ openssl_error_string());
42
+ }
43
+ // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
44
+ // method? What happens if there are multiple private keys? Do we care?
45
+ if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
46
+ throw new Google_AuthException("No private key found in p12 file.");
47
+ }
48
+ $this->privateKey = openssl_pkey_get_private($certs["pkey"]);
49
+ if (!$this->privateKey) {
50
+ throw new Google_AuthException("Unable to load private key in ");
51
+ }
52
+ }
53
+
54
+ function __destruct() {
55
+ if ($this->privateKey) {
56
+ openssl_pkey_free($this->privateKey);
57
+ }
58
+ }
59
+
60
+ function sign($data) {
61
+ if(version_compare(PHP_VERSION, '5.3.0') < 0) {
62
+ throw new Google_AuthException(
63
+ "PHP 5.3.0 or higher is required to use service accounts.");
64
+ }
65
+ if (!openssl_sign($data, $signature, $this->privateKey, "sha256")) {
66
+ throw new Google_AuthException("Unable to sign data");
67
+ }
68
+ return $signature;
69
+ }
70
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_PemVerifier.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Verifies signatures using PEM encoded certificates.
20
+ *
21
+ * @author Brian Eaton <beaton@google.com>
22
+ */
23
+ class Google_PemVerifier extends Google_Verifier {
24
+ private $publicKey;
25
+
26
+ /**
27
+ * Constructs a verifier from the supplied PEM-encoded certificate.
28
+ *
29
+ * $pem: a PEM encoded certificate (not a file).
30
+ * @param $pem
31
+ * @throws Google_AuthException
32
+ * @throws Google_Exception
33
+ */
34
+ function __construct($pem) {
35
+ if (!function_exists('openssl_x509_read')) {
36
+ throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
37
+ }
38
+ $this->publicKey = openssl_x509_read($pem);
39
+ if (!$this->publicKey) {
40
+ throw new Google_AuthException("Unable to parse PEM: $pem");
41
+ }
42
+ }
43
+
44
+ function __destruct() {
45
+ if ($this->publicKey) {
46
+ openssl_x509_free($this->publicKey);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Verifies the signature on data.
52
+ *
53
+ * Returns true if the signature is valid, false otherwise.
54
+ * @param $data
55
+ * @param $signature
56
+ * @throws Google_AuthException
57
+ * @return bool
58
+ */
59
+ function verify($data, $signature) {
60
+ $status = openssl_verify($data, $signature, $this->publicKey, "sha256");
61
+ if ($status === -1) {
62
+ throw new Google_AuthException('Signature verification error: ' . openssl_error_string());
63
+ }
64
+ return $status === 1;
65
+ }
66
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_Signer.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ require_once "Google_P12Signer.php";
19
+
20
+ /**
21
+ * Signs data.
22
+ *
23
+ * @author Brian Eaton <beaton@google.com>
24
+ */
25
+ abstract class Google_Signer {
26
+ /**
27
+ * Signs data, returns the signature as binary data.
28
+ */
29
+ abstract public function sign($data);
30
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/auth/Google_Verifier.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ require_once "Google_PemVerifier.php";
19
+
20
+ /**
21
+ * Verifies signatures.
22
+ *
23
+ * @author Brian Eaton <beaton@google.com>
24
+ */
25
+ abstract class Google_Verifier {
26
+ /**
27
+ * Checks a signature, returns true if the signature is correct,
28
+ * false otherwise.
29
+ */
30
+ abstract public function verify($data, $signature);
31
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_ApcCache.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
19
+ * A persistent storage class based on the APC cache, which is not
20
+ * really very persistent, as soon as you restart your web server
21
+ * the storage will be wiped, however for debugging and/or speed
22
+ * it can be useful, kinda, and cache is a lot cheaper then storage.
23
+ *
24
+ * @author Chris Chabot <chabotc@google.com>
25
+ */
26
+ class Google_APCCache extends Google_Cache {
27
+
28
+ public function __construct() {
29
+ if (! function_exists('apc_add')) {
30
+ throw new Google_CacheException("Apc functions not available");
31
+ }
32
+ }
33
+
34
+ private function isLocked($key) {
35
+ if ((@apc_fetch($key . '.lock')) === false) {
36
+ return false;
37
+ }
38
+ return true;
39
+ }
40
+
41
+ private function createLock($key) {
42
+ // the interesting thing is that this could fail if the lock was created in the meantime..
43
+ // but we'll ignore that out of convenience
44
+ @apc_add($key . '.lock', '', 5);
45
+ }
46
+
47
+ private function removeLock($key) {
48
+ // suppress all warnings, if some other process removed it that's ok too
49
+ @apc_delete($key . '.lock');
50
+ }
51
+
52
+ private function waitForLock($key) {
53
+ // 20 x 250 = 5 seconds
54
+ $tries = 20;
55
+ $cnt = 0;
56
+ do {
57
+ // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
58
+ usleep(250);
59
+ $cnt ++;
60
+ } while ($cnt <= $tries && $this->isLocked($key));
61
+ if ($this->isLocked($key)) {
62
+ // 5 seconds passed, assume the owning process died off and remove it
63
+ $this->removeLock($key);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ public function get($key, $expiration = false) {
71
+
72
+ if (($ret = @apc_fetch($key)) === false) {
73
+ return false;
74
+ }
75
+ if (!$expiration || (time() - $ret['time'] > $expiration)) {
76
+ $this->delete($key);
77
+ return false;
78
+ }
79
+ return unserialize($ret['data']);
80
+ }
81
+
82
+ /**
83
+ * @inheritDoc
84
+ */
85
+ public function set($key, $value) {
86
+ if (@apc_store($key, array('time' => time(), 'data' => serialize($value))) == false) {
87
+ throw new Google_CacheException("Couldn't store data");
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @inheritDoc
93
+ * @param String $key
94
+ */
95
+ public function delete($key) {
96
+ @apc_delete($key);
97
+ }
98
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_Cache.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 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
+ require_once "Google_FileCache.php";
19
+ require_once "Google_MemcacheCache.php";
20
+
21
+ /**
22
+ * Abstract storage class
23
+ *
24
+ * @author Chris Chabot <chabotc@google.com>
25
+ */
26
+ abstract class Google_Cache {
27
+
28
+ /**
29
+ * Retrieves the data for the given key, or false if they
30
+ * key is unknown or expired
31
+ *
32
+ * @param String $key The key who's data to retrieve
33
+ * @param boolean|int $expiration Expiration time in seconds
34
+ *
35
+ */
36
+ abstract function get($key, $expiration = false);
37
+
38
+ /**
39
+ * Store the key => $value set. The $value is serialized
40
+ * by this function so can be of any type
41
+ *
42
+ * @param string $key Key of the data
43
+ * @param string $value data
44
+ */
45
+ abstract function set($key, $value);
46
+
47
+ /**
48
+ * Removes the key/data pair for the given $key
49
+ *
50
+ * @param String $key
51
+ */
52
+ abstract function delete($key);
53
+ }
54
+
55
+
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_FileCache.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 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 implements a basic on disk storage. While that does
20
+ * work quite well it's not the most elegant and scalable solution.
21
+ * It will also get you into a heap of trouble when you try to run
22
+ * this in a clustered environment. In those cases please use the
23
+ * MySql back-end
24
+ *
25
+ * @author Chris Chabot <chabotc@google.com>
26
+ */
27
+ class Google_FileCache extends Google_Cache {
28
+ private $path;
29
+
30
+ public function __construct() {
31
+ global $apiConfig;
32
+ $this->path = $apiConfig['ioFileCache_directory'];
33
+ }
34
+
35
+ private function isLocked($storageFile) {
36
+ // our lock file convention is simple: /the/file/path.lock
37
+ return file_exists($storageFile . '.lock');
38
+ }
39
+
40
+ private function createLock($storageFile) {
41
+ $storageDir = dirname($storageFile);
42
+ if (! is_dir($storageDir)) {
43
+ // @codeCoverageIgnoreStart
44
+ if (! @mkdir($storageDir, 0755, true)) {
45
+ // make sure the failure isn't because of a concurrency issue
46
+ if (! is_dir($storageDir)) {
47
+ throw new Google_CacheException("Could not create storage directory: $storageDir");
48
+ }
49
+ }
50
+ // @codeCoverageIgnoreEnd
51
+ }
52
+ @touch($storageFile . '.lock');
53
+ }
54
+
55
+ private function removeLock($storageFile) {
56
+ // suppress all warnings, if some other process removed it that's ok too
57
+ @unlink($storageFile . '.lock');
58
+ }
59
+
60
+ private function waitForLock($storageFile) {
61
+ // 20 x 250 = 5 seconds
62
+ $tries = 20;
63
+ $cnt = 0;
64
+ do {
65
+ // make sure PHP picks up on file changes. This is an expensive action but really can't be avoided
66
+ clearstatcache();
67
+ // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
68
+ usleep(250);
69
+ $cnt ++;
70
+ } while ($cnt <= $tries && $this->isLocked($storageFile));
71
+ if ($this->isLocked($storageFile)) {
72
+ // 5 seconds passed, assume the owning process died off and remove it
73
+ $this->removeLock($storageFile);
74
+ }
75
+ }
76
+
77
+ private function getCacheDir($hash) {
78
+ // use the first 2 characters of the hash as a directory prefix
79
+ // this should prevent slowdowns due to huge directory listings
80
+ // and thus give some basic amount of scalability
81
+ return $this->path . '/' . substr($hash, 0, 2);
82
+ }
83
+
84
+ private function getCacheFile($hash) {
85
+ return $this->getCacheDir($hash) . '/' . $hash;
86
+ }
87
+
88
+ public function get($key, $expiration = false) {
89
+ $storageFile = $this->getCacheFile(md5($key));
90
+ // See if this storage file is locked, if so we wait up to 5 seconds for the lock owning process to
91
+ // complete it's work. If the lock is not released within that time frame, it's cleaned up.
92
+ // This should give us a fair amount of 'Cache Stampeding' protection
93
+ if ($this->isLocked($storageFile)) {
94
+ $this->waitForLock($storageFile);
95
+ }
96
+ if (file_exists($storageFile) && is_readable($storageFile)) {
97
+ $now = time();
98
+ if (! $expiration || (($mtime = @filemtime($storageFile)) !== false && ($now - $mtime) < $expiration)) {
99
+ if (($data = @file_get_contents($storageFile)) !== false) {
100
+ $data = unserialize($data);
101
+ return $data;
102
+ }
103
+ }
104
+ }
105
+ return false;
106
+ }
107
+
108
+ public function set($key, $value) {
109
+ $storageDir = $this->getCacheDir(md5($key));
110
+ $storageFile = $this->getCacheFile(md5($key));
111
+ if ($this->isLocked($storageFile)) {
112
+ // some other process is writing to this file too, wait until it's done to prevent hiccups
113
+ $this->waitForLock($storageFile);
114
+ }
115
+ if (! is_dir($storageDir)) {
116
+ if (! @mkdir($storageDir, 0755, true)) {
117
+ throw new Google_CacheException("Could not create storage directory: $storageDir");
118
+ }
119
+ }
120
+ // we serialize the whole request object, since we don't only want the
121
+ // responseContent but also the postBody used, headers, size, etc
122
+ $data = serialize($value);
123
+ $this->createLock($storageFile);
124
+ if (! @file_put_contents($storageFile, $data)) {
125
+ $this->removeLock($storageFile);
126
+ throw new Google_CacheException("Could not store data in the file");
127
+ }
128
+ $this->removeLock($storageFile);
129
+ }
130
+
131
+ public function delete($key) {
132
+ $file = $this->getCacheFile(md5($key));
133
+ if (! @unlink($file)) {
134
+ throw new Google_CacheException("Cache file could not be deleted");
135
+ }
136
+ }
137
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/cache/Google_MemcacheCache.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Copyright 2008 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 persistent storage class based on the memcache, which is not
20
+ * really very persistent, as soon as you restart your memcache daemon
21
+ * the storage will be wiped, however for debugging and/or speed
22
+ * it can be useful, kinda, and cache is a lot cheaper then storage.
23
+ *
24
+ * @author Chris Chabot <chabotc@google.com>
25
+ */
26
+ class Google_MemcacheCache extends Google_Cache {
27
+ private $connection = false;
28
+
29
+ public function __construct() {
30
+ global $apiConfig;
31
+ if (! function_exists('memcache_connect')) {
32
+ throw new Google_CacheException("Memcache functions not available");
33
+ }
34
+ $this->host = $apiConfig['ioMemCacheCache_host'];
35
+ $this->port = $apiConfig['ioMemCacheCache_port'];
36
+ if (empty($this->host) || empty($this->port)) {
37
+ throw new Google_CacheException("You need to supply a valid memcache host and port");
38
+ }
39
+ }
40
+
41
+ private function isLocked($key) {
42
+ $this->check();
43
+ if ((@memcache_get($this->connection, $key . '.lock')) === false) {
44
+ return false;
45
+ }
46
+ return true;
47
+ }
48
+
49
+ private function createLock($key) {
50
+ $this->check();
51
+ // the interesting thing is that this could fail if the lock was created in the meantime..
52
+ // but we'll ignore that out of convenience
53
+ @memcache_add($this->connection, $key . '.lock', '', 0, 5);
54
+ }
55
+
56
+ private function removeLock($key) {
57
+ $this->check();
58
+ // suppress all warnings, if some other process removed it that's ok too
59
+ @memcache_delete($this->connection, $key . '.lock');
60
+ }
61
+
62
+ private function waitForLock($key) {
63
+ $this->check();
64
+ // 20 x 250 = 5 seconds
65
+ $tries = 20;
66
+ $cnt = 0;
67
+ do {
68
+ // 250 ms is a long time to sleep, but it does stop the server from burning all resources on polling locks..
69
+ usleep(250);
70
+ $cnt ++;
71
+ } while ($cnt <= $tries && $this->isLocked($key));
72
+ if ($this->isLocked($key)) {
73
+ // 5 seconds passed, assume the owning process died off and remove it
74
+ $this->removeLock($key);
75
+ }
76
+ }
77
+
78
+ // I prefer lazy initialization since the cache isn't used every request
79
+ // so this potentially saves a lot of overhead
80
+ private function connect() {
81
+ if (! $this->connection = @memcache_pconnect($this->host, $this->port)) {
82
+ throw new Google_CacheException("Couldn't connect to memcache server");
83
+ }
84
+ }
85
+
86
+ private function check() {
87
+ if (! $this->connection) {
88
+ $this->connect();
89
+ }
90
+ }
91
+
92
+ /**
93
+ * @inheritDoc
94
+ */
95
+ public function get($key, $expiration = false) {
96
+ $this->check();
97
+ if (($ret = @memcache_get($this->connection, $key)) === false) {
98
+ return false;
99
+ }
100
+ if (is_numeric($expiration) && (time() - $ret['time'] > $expiration)) {
101
+ $this->delete($key);
102
+ return false;
103
+ }
104
+ return $ret['data'];
105
+ }
106
+
107
+ /**
108
+ * @inheritDoc
109
+ * @param string $key
110
+ * @param string $value
111
+ * @throws Google_CacheException
112
+ */
113
+ public function set($key, $value) {
114
+ $this->check();
115
+ // we store it with the cache_time default expiration so objects will at least get cleaned eventually.
116
+ if (@memcache_set($this->connection, $key, array('time' => time(),
117
+ 'data' => $value), false) == false) {
118
+ throw new Google_CacheException("Couldn't store data in cache");
119
+ }
120
+ }
121
+
122
+ /**
123
+ * @inheritDoc
124
+ * @param String $key
125
+ */
126
+ public function delete($key) {
127
+ $this->check();
128
+ @memcache_delete($this->connection, $key);
129
+ }
130
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/config.php ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ global $apiConfig;
19
+ $apiConfig = array(
20
+ // True if objects should be returned by the service classes.
21
+ // False if associative arrays should be returned (default behavior).
22
+ 'use_objects' => false,
23
+
24
+ // The application_name is included in the User-Agent HTTP header.
25
+ 'application_name' => '',
26
+
27
+ // OAuth2 Settings, you can get these keys at https://code.google.com/apis/console
28
+ 'oauth2_client_id' => '',
29
+ 'oauth2_client_secret' => '',
30
+ 'oauth2_redirect_uri' => '',
31
+
32
+ // The developer key, you get this at https://code.google.com/apis/console
33
+ 'developer_key' => '',
34
+
35
+ // Site name to show in the Google's OAuth 1 authentication screen.
36
+ 'site_name' => 'www.example.org',
37
+
38
+ // Which Authentication, Storage and HTTP IO classes to use.
39
+ 'authClass' => 'Google_OAuth2',
40
+ 'ioClass' => 'Google_CurlIO',
41
+ 'cacheClass' => 'Google_FileCache',
42
+
43
+ // Don't change these unless you're working against a special development or testing environment.
44
+ 'basePath' => 'https://www.googleapis.com',
45
+
46
+ // IO Class dependent configuration, you only have to configure the values
47
+ // for the class that was configured as the ioClass above
48
+ 'ioFileCache_directory' =>
49
+ (function_exists('sys_get_temp_dir') ?
50
+ sys_get_temp_dir() . '/Google_Client' :
51
+ '/tmp/Google_Client'),
52
+
53
+ // Definition of service specific values like scopes, oauth token URLs, etc
54
+ 'services' => array(
55
+ 'analytics' => array('scope' => 'https://www.googleapis.com/auth/analytics.readonly'),
56
+ 'calendar' => array(
57
+ 'scope' => array(
58
+ "https://www.googleapis.com/auth/calendar",
59
+ "https://www.googleapis.com/auth/calendar.readonly",
60
+ )
61
+ ),
62
+ 'books' => array('scope' => 'https://www.googleapis.com/auth/books'),
63
+ 'latitude' => array(
64
+ 'scope' => array(
65
+ 'https://www.googleapis.com/auth/latitude.all.best',
66
+ 'https://www.googleapis.com/auth/latitude.all.city',
67
+ )
68
+ ),
69
+ 'moderator' => array('scope' => 'https://www.googleapis.com/auth/moderator'),
70
+ 'oauth2' => array(
71
+ 'scope' => array(
72
+ 'https://www.googleapis.com/auth/userinfo.profile',
73
+ 'https://www.googleapis.com/auth/userinfo.email',
74
+ )
75
+ ),
76
+ 'plus' => array('scope' => 'https://www.googleapis.com/auth/plus.login'),
77
+ 'siteVerification' => array('scope' => 'https://www.googleapis.com/auth/siteverification'),
78
+ 'tasks' => array('scope' => 'https://www.googleapis.com/auth/tasks'),
79
+ 'urlshortener' => array('scope' => 'https://www.googleapis.com/auth/urlshortener')
80
+ )
81
+ );
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdExchangeSellerService.php ADDED
@@ -0,0 +1,1262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "accounts" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
22
+ * $accounts = $adexchangesellerService->accounts;
23
+ * </code>
24
+ */
25
+ class google_AccountsServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Get information about the selected Ad Exchange account. (accounts.get)
29
+ *
30
+ * @param string $accountId Account to get information about. Tip: 'myaccount' is a valid ID.
31
+ * @param array $optParams Optional parameters.
32
+ * @return google_Account
33
+ */
34
+ public function get($accountId, $optParams = array()) {
35
+ $params = array('accountId' => $accountId);
36
+ $params = array_merge($params, $optParams);
37
+ $data = $this->__call('get', array($params));
38
+ if ($this->useObjects()) {
39
+ return new google_Account($data);
40
+ } else {
41
+ return $data;
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * The "adclients" collection of methods.
48
+ * Typical usage is:
49
+ * <code>
50
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
51
+ * $adclients = $adexchangesellerService->adclients;
52
+ * </code>
53
+ */
54
+ class google_AdclientsServiceResource extends Google_ServiceResource {
55
+
56
+ /**
57
+ * List all ad clients in this Ad Exchange account. (adclients.list)
58
+ *
59
+ * @param array $optParams Optional parameters.
60
+ *
61
+ * @opt_param string maxResults The maximum number of ad clients to include in the response, used for paging.
62
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
63
+ * @return google_AdClients
64
+ */
65
+ public function listAdclients($optParams = array()) {
66
+ $params = array();
67
+ $params = array_merge($params, $optParams);
68
+ $data = $this->__call('list', array($params));
69
+ if ($this->useObjects()) {
70
+ return new google_AdClients($data);
71
+ } else {
72
+ return $data;
73
+ }
74
+ }
75
+ }
76
+
77
+ /**
78
+ * The "adunits" collection of methods.
79
+ * Typical usage is:
80
+ * <code>
81
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
82
+ * $adunits = $adexchangesellerService->adunits;
83
+ * </code>
84
+ */
85
+ class google_AdunitsServiceResource extends Google_ServiceResource {
86
+
87
+ /**
88
+ * Gets the specified ad unit in the specified ad client. (adunits.get)
89
+ *
90
+ * @param string $adClientId Ad client for which to get the ad unit.
91
+ * @param string $adUnitId Ad unit to retrieve.
92
+ * @param array $optParams Optional parameters.
93
+ * @return google_AdUnit
94
+ */
95
+ public function get($adClientId, $adUnitId, $optParams = array()) {
96
+ $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
97
+ $params = array_merge($params, $optParams);
98
+ $data = $this->__call('get', array($params));
99
+ if ($this->useObjects()) {
100
+ return new google_AdUnit($data);
101
+ } else {
102
+ return $data;
103
+ }
104
+ }
105
+ /**
106
+ * List all ad units in the specified ad client for this Ad Exchange account.
107
+ * (adunits.list)
108
+ *
109
+ * @param string $adClientId Ad client for which to list ad units.
110
+ * @param array $optParams Optional parameters.
111
+ *
112
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
113
+ * @opt_param string maxResults The maximum number of ad units to include in the response, used for paging.
114
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
115
+ * @return google_AdUnits
116
+ */
117
+ public function listAdunits($adClientId, $optParams = array()) {
118
+ $params = array('adClientId' => $adClientId);
119
+ $params = array_merge($params, $optParams);
120
+ $data = $this->__call('list', array($params));
121
+ if ($this->useObjects()) {
122
+ return new google_AdUnits($data);
123
+ } else {
124
+ return $data;
125
+ }
126
+ }
127
+ }
128
+
129
+ /**
130
+ * The "customchannels" collection of methods.
131
+ * Typical usage is:
132
+ * <code>
133
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
134
+ * $customchannels = $adexchangesellerService->customchannels;
135
+ * </code>
136
+ */
137
+ class google_AdunitsCustomchannelsServiceResource extends Google_ServiceResource {
138
+
139
+ /**
140
+ * List all custom channels which the specified ad unit belongs to.
141
+ * (customchannels.list)
142
+ *
143
+ * @param string $adClientId Ad client which contains the ad unit.
144
+ * @param string $adUnitId Ad unit for which to list custom channels.
145
+ * @param array $optParams Optional parameters.
146
+ *
147
+ * @opt_param string maxResults The maximum number of custom channels to include in the response, used for paging.
148
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
149
+ * @return google_CustomChannels
150
+ */
151
+ public function listAdunitsCustomchannels($adClientId, $adUnitId, $optParams = array()) {
152
+ $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
153
+ $params = array_merge($params, $optParams);
154
+ $data = $this->__call('list', array($params));
155
+ if ($this->useObjects()) {
156
+ return new google_CustomChannels($data);
157
+ } else {
158
+ return $data;
159
+ }
160
+ }
161
+ }
162
+
163
+ /**
164
+ * The "alerts" collection of methods.
165
+ * Typical usage is:
166
+ * <code>
167
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
168
+ * $alerts = $adexchangesellerService->alerts;
169
+ * </code>
170
+ */
171
+ class google_AlertsServiceResource extends Google_ServiceResource {
172
+
173
+ /**
174
+ * List the alerts for this Ad Exchange account. (alerts.list)
175
+ *
176
+ * @param array $optParams Optional parameters.
177
+ *
178
+ * @opt_param string locale The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.
179
+ * @return google_Alerts
180
+ */
181
+ public function listAlerts($optParams = array()) {
182
+ $params = array();
183
+ $params = array_merge($params, $optParams);
184
+ $data = $this->__call('list', array($params));
185
+ if ($this->useObjects()) {
186
+ return new google_Alerts($data);
187
+ } else {
188
+ return $data;
189
+ }
190
+ }
191
+ }
192
+
193
+ /**
194
+ * The "customchannels" collection of methods.
195
+ * Typical usage is:
196
+ * <code>
197
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
198
+ * $customchannels = $adexchangesellerService->customchannels;
199
+ * </code>
200
+ */
201
+ class google_CustomchannelsServiceResource extends Google_ServiceResource {
202
+
203
+ /**
204
+ * Get the specified custom channel from the specified ad client.
205
+ * (customchannels.get)
206
+ *
207
+ * @param string $adClientId Ad client which contains the custom channel.
208
+ * @param string $customChannelId Custom channel to retrieve.
209
+ * @param array $optParams Optional parameters.
210
+ * @return google_CustomChannel
211
+ */
212
+ public function get($adClientId, $customChannelId, $optParams = array()) {
213
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
214
+ $params = array_merge($params, $optParams);
215
+ $data = $this->__call('get', array($params));
216
+ if ($this->useObjects()) {
217
+ return new google_CustomChannel($data);
218
+ } else {
219
+ return $data;
220
+ }
221
+ }
222
+ /**
223
+ * List all custom channels in the specified ad client for this Ad Exchange
224
+ * account. (customchannels.list)
225
+ *
226
+ * @param string $adClientId Ad client for which to list custom channels.
227
+ * @param array $optParams Optional parameters.
228
+ *
229
+ * @opt_param string maxResults The maximum number of custom channels to include in the response, used for paging.
230
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
231
+ * @return google_CustomChannels
232
+ */
233
+ public function listCustomchannels($adClientId, $optParams = array()) {
234
+ $params = array('adClientId' => $adClientId);
235
+ $params = array_merge($params, $optParams);
236
+ $data = $this->__call('list', array($params));
237
+ if ($this->useObjects()) {
238
+ return new google_CustomChannels($data);
239
+ } else {
240
+ return $data;
241
+ }
242
+ }
243
+ }
244
+
245
+ /**
246
+ * The "adunits" collection of methods.
247
+ * Typical usage is:
248
+ * <code>
249
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
250
+ * $adunits = $adexchangesellerService->adunits;
251
+ * </code>
252
+ */
253
+ class google_CustomchannelsAdunitsServiceResource extends Google_ServiceResource {
254
+
255
+ /**
256
+ * List all ad units in the specified custom channel. (adunits.list)
257
+ *
258
+ * @param string $adClientId Ad client which contains the custom channel.
259
+ * @param string $customChannelId Custom channel for which to list ad units.
260
+ * @param array $optParams Optional parameters.
261
+ *
262
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
263
+ * @opt_param string maxResults The maximum number of ad units to include in the response, used for paging.
264
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
265
+ * @return google_AdUnits
266
+ */
267
+ public function listCustomchannelsAdunits($adClientId, $customChannelId, $optParams = array()) {
268
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
269
+ $params = array_merge($params, $optParams);
270
+ $data = $this->__call('list', array($params));
271
+ if ($this->useObjects()) {
272
+ return new google_AdUnits($data);
273
+ } else {
274
+ return $data;
275
+ }
276
+ }
277
+ }
278
+
279
+ /**
280
+ * The "metadata" collection of methods.
281
+ * Typical usage is:
282
+ * <code>
283
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
284
+ * $metadata = $adexchangesellerService->metadata;
285
+ * </code>
286
+ */
287
+ class google_MetadataServiceResource extends Google_ServiceResource {
288
+
289
+ }
290
+
291
+ /**
292
+ * The "dimensions" collection of methods.
293
+ * Typical usage is:
294
+ * <code>
295
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
296
+ * $dimensions = $adexchangesellerService->dimensions;
297
+ * </code>
298
+ */
299
+ class google_MetadataDimensionsServiceResource extends Google_ServiceResource {
300
+
301
+ /**
302
+ * List the metadata for the dimensions available to this AdExchange account.
303
+ * (dimensions.list)
304
+ *
305
+ * @param array $optParams Optional parameters.
306
+ * @return google_Metadata
307
+ */
308
+ public function listMetadataDimensions($optParams = array()) {
309
+ $params = array();
310
+ $params = array_merge($params, $optParams);
311
+ $data = $this->__call('list', array($params));
312
+ if ($this->useObjects()) {
313
+ return new google_Metadata($data);
314
+ } else {
315
+ return $data;
316
+ }
317
+ }
318
+ }
319
+ /**
320
+ * The "metrics" collection of methods.
321
+ * Typical usage is:
322
+ * <code>
323
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
324
+ * $metrics = $adexchangesellerService->metrics;
325
+ * </code>
326
+ */
327
+ class google_MetadataMetricsServiceResource extends Google_ServiceResource {
328
+
329
+ /**
330
+ * List the metadata for the metrics available to this AdExchange account.
331
+ * (metrics.list)
332
+ *
333
+ * @param array $optParams Optional parameters.
334
+ * @return google_Metadata
335
+ */
336
+ public function listMetadataMetrics($optParams = array()) {
337
+ $params = array();
338
+ $params = array_merge($params, $optParams);
339
+ $data = $this->__call('list', array($params));
340
+ if ($this->useObjects()) {
341
+ return new google_Metadata($data);
342
+ } else {
343
+ return $data;
344
+ }
345
+ }
346
+ }
347
+
348
+ /**
349
+ * The "preferreddeals" collection of methods.
350
+ * Typical usage is:
351
+ * <code>
352
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
353
+ * $preferreddeals = $adexchangesellerService->preferreddeals;
354
+ * </code>
355
+ */
356
+ class google_PreferreddealsServiceResource extends Google_ServiceResource {
357
+
358
+ /**
359
+ * Get information about the selected Ad Exchange Preferred Deal.
360
+ * (preferreddeals.get)
361
+ *
362
+ * @param string $dealId Preferred deal to get information about.
363
+ * @param array $optParams Optional parameters.
364
+ * @return google_PreferredDeal
365
+ */
366
+ public function get($dealId, $optParams = array()) {
367
+ $params = array('dealId' => $dealId);
368
+ $params = array_merge($params, $optParams);
369
+ $data = $this->__call('get', array($params));
370
+ if ($this->useObjects()) {
371
+ return new google_PreferredDeal($data);
372
+ } else {
373
+ return $data;
374
+ }
375
+ }
376
+ /**
377
+ * List the preferred deals for this Ad Exchange account. (preferreddeals.list)
378
+ *
379
+ * @param array $optParams Optional parameters.
380
+ * @return google_PreferredDeals
381
+ */
382
+ public function listPreferreddeals($optParams = array()) {
383
+ $params = array();
384
+ $params = array_merge($params, $optParams);
385
+ $data = $this->__call('list', array($params));
386
+ if ($this->useObjects()) {
387
+ return new google_PreferredDeals($data);
388
+ } else {
389
+ return $data;
390
+ }
391
+ }
392
+ }
393
+
394
+ /**
395
+ * The "reports" collection of methods.
396
+ * Typical usage is:
397
+ * <code>
398
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
399
+ * $reports = $adexchangesellerService->reports;
400
+ * </code>
401
+ */
402
+ class google_ReportsServiceResource extends Google_ServiceResource {
403
+
404
+ /**
405
+ * Generate an Ad Exchange report based on the report request sent in the query
406
+ * parameters. Returns the result as JSON; to retrieve output in CSV format
407
+ * specify "alt=csv" as a query parameter. (reports.generate)
408
+ *
409
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
410
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
411
+ * @param array $optParams Optional parameters.
412
+ *
413
+ * @opt_param string dimension Dimensions to base the report on.
414
+ * @opt_param string filter Filters to be run on the report.
415
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
416
+ * @opt_param string maxResults The maximum number of rows of report data to return.
417
+ * @opt_param string metric Numeric columns to include in the report.
418
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
419
+ * @opt_param string startIndex Index of the first row of report data to return.
420
+ * @return google_Report
421
+ */
422
+ public function generate($startDate, $endDate, $optParams = array()) {
423
+ $params = array('startDate' => $startDate, 'endDate' => $endDate);
424
+ $params = array_merge($params, $optParams);
425
+ $data = $this->__call('generate', array($params));
426
+ if ($this->useObjects()) {
427
+ return new google_Report($data);
428
+ } else {
429
+ return $data;
430
+ }
431
+ }
432
+ }
433
+
434
+ /**
435
+ * The "saved" collection of methods.
436
+ * Typical usage is:
437
+ * <code>
438
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
439
+ * $saved = $adexchangesellerService->saved;
440
+ * </code>
441
+ */
442
+ class google_ReportsSavedServiceResource extends Google_ServiceResource {
443
+
444
+ /**
445
+ * Generate an Ad Exchange report based on the saved report ID sent in the query
446
+ * parameters. (saved.generate)
447
+ *
448
+ * @param string $savedReportId The saved report to retrieve.
449
+ * @param array $optParams Optional parameters.
450
+ *
451
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
452
+ * @opt_param int maxResults The maximum number of rows of report data to return.
453
+ * @opt_param int startIndex Index of the first row of report data to return.
454
+ * @return google_Report
455
+ */
456
+ public function generate($savedReportId, $optParams = array()) {
457
+ $params = array('savedReportId' => $savedReportId);
458
+ $params = array_merge($params, $optParams);
459
+ $data = $this->__call('generate', array($params));
460
+ if ($this->useObjects()) {
461
+ return new google_Report($data);
462
+ } else {
463
+ return $data;
464
+ }
465
+ }
466
+ /**
467
+ * List all saved reports in this Ad Exchange account. (saved.list)
468
+ *
469
+ * @param array $optParams Optional parameters.
470
+ *
471
+ * @opt_param int maxResults The maximum number of saved reports to include in the response, used for paging.
472
+ * @opt_param string pageToken A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
473
+ * @return google_SavedReports
474
+ */
475
+ public function listReportsSaved($optParams = array()) {
476
+ $params = array();
477
+ $params = array_merge($params, $optParams);
478
+ $data = $this->__call('list', array($params));
479
+ if ($this->useObjects()) {
480
+ return new google_SavedReports($data);
481
+ } else {
482
+ return $data;
483
+ }
484
+ }
485
+ }
486
+
487
+ /**
488
+ * The "urlchannels" collection of methods.
489
+ * Typical usage is:
490
+ * <code>
491
+ * $adexchangesellerService = new google_AdExchangeSellerService(...);
492
+ * $urlchannels = $adexchangesellerService->urlchannels;
493
+ * </code>
494
+ */
495
+ class google_UrlchannelsServiceResource extends Google_ServiceResource {
496
+
497
+ /**
498
+ * List all URL channels in the specified ad client for this Ad Exchange
499
+ * account. (urlchannels.list)
500
+ *
501
+ * @param string $adClientId Ad client for which to list URL channels.
502
+ * @param array $optParams Optional parameters.
503
+ *
504
+ * @opt_param string maxResults The maximum number of URL channels to include in the response, used for paging.
505
+ * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
506
+ * @return google_UrlChannels
507
+ */
508
+ public function listUrlchannels($adClientId, $optParams = array()) {
509
+ $params = array('adClientId' => $adClientId);
510
+ $params = array_merge($params, $optParams);
511
+ $data = $this->__call('list', array($params));
512
+ if ($this->useObjects()) {
513
+ return new google_UrlChannels($data);
514
+ } else {
515
+ return $data;
516
+ }
517
+ }
518
+ }
519
+
520
+ /**
521
+ * Service definition for google_AdExchangeSeller (v1.1).
522
+ *
523
+ * <p>
524
+ * Gives Ad Exchange seller users access to their inventory and the ability to generate reports
525
+ * </p>
526
+ *
527
+ * <p>
528
+ * For more information about this service, see the
529
+ * <a href="https://developers.google.com/ad-exchange/seller-rest/" target="_blank">API Documentation</a>
530
+ * </p>
531
+ *
532
+ * @author Google, Inc.
533
+ */
534
+ class google_AdExchangeSellerService extends Google_Service {
535
+ public $accounts;
536
+ public $adclients;
537
+ public $adunits;
538
+ public $adunits_customchannels;
539
+ public $alerts;
540
+ public $customchannels;
541
+ public $customchannels_adunits;
542
+ public $metadata_dimensions;
543
+ public $metadata_metrics;
544
+ public $preferreddeals;
545
+ public $reports;
546
+ public $reports_saved;
547
+ public $urlchannels;
548
+ /**
549
+ * Constructs the internal representation of the AdExchangeSeller service.
550
+ *
551
+ * @param Google_Client $client
552
+ */
553
+ public function __construct(Google_Client $client) {
554
+ $this->servicePath = 'adexchangeseller/v1.1/';
555
+ $this->version = 'v1.1';
556
+ $this->serviceName = 'adexchangeseller';
557
+
558
+ $client->addService($this->serviceName, $this->version);
559
+ $this->accounts = new google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"get": {"id": "adexchangeseller.accounts.get", "path": "accounts/{accountId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Account"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
560
+ $this->adclients = new google_AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"id": "adexchangeseller.adclients.list", "path": "adclients", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdClients"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
561
+ $this->adunits = new google_AdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"get": {"id": "adexchangeseller.adunits.get", "path": "adclients/{adClientId}/adunits/{adUnitId}", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}, "list": {"id": "adexchangeseller.adunits.list", "path": "adclients/{adClientId}/adunits", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
562
+ $this->adunits_customchannels = new google_AdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"id": "adexchangeseller.adunits.customchannels.list", "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
563
+ $this->alerts = new google_AlertsServiceResource($this, $this->serviceName, 'alerts', json_decode('{"methods": {"list": {"id": "adexchangeseller.alerts.list", "path": "alerts", "httpMethod": "GET", "parameters": {"locale": {"type": "string", "location": "query"}}, "response": {"$ref": "Alerts"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
564
+ $this->customchannels = new google_CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"get": {"id": "adexchangeseller.customchannels.get", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}, "list": {"id": "adexchangeseller.customchannels.list", "path": "adclients/{adClientId}/customchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
565
+ $this->customchannels_adunits = new google_CustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"id": "adexchangeseller.customchannels.adunits.list", "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
566
+ $this->metadata_dimensions = new google_MetadataDimensionsServiceResource($this, $this->serviceName, 'dimensions', json_decode('{"methods": {"list": {"id": "adexchangeseller.metadata.dimensions.list", "path": "metadata/dimensions", "httpMethod": "GET", "response": {"$ref": "Metadata"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
567
+ $this->metadata_metrics = new google_MetadataMetricsServiceResource($this, $this->serviceName, 'metrics', json_decode('{"methods": {"list": {"id": "adexchangeseller.metadata.metrics.list", "path": "metadata/metrics", "httpMethod": "GET", "response": {"$ref": "Metadata"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
568
+ $this->preferreddeals = new google_PreferreddealsServiceResource($this, $this->serviceName, 'preferreddeals', json_decode('{"methods": {"get": {"id": "adexchangeseller.preferreddeals.get", "path": "preferreddeals/{dealId}", "httpMethod": "GET", "parameters": {"dealId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "PreferredDeal"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}, "list": {"id": "adexchangeseller.preferreddeals.list", "path": "preferreddeals", "httpMethod": "GET", "response": {"$ref": "PreferredDeals"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
569
+ $this->reports = new google_ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"id": "adexchangeseller.reports.generate", "path": "reports", "httpMethod": "GET", "parameters": {"dimension": {"type": "string", "repeated": true, "location": "query"}, "endDate": {"type": "string", "required": true, "location": "query"}, "filter": {"type": "string", "repeated": true, "location": "query"}, "locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "50000", "location": "query"}, "metric": {"type": "string", "repeated": true, "location": "query"}, "sort": {"type": "string", "repeated": true, "location": "query"}, "startDate": {"type": "string", "required": true, "location": "query"}, "startIndex": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "5000", "location": "query"}}, "response": {"$ref": "Report"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"], "supportsMediaDownload": true}}}', true));
570
+ $this->reports_saved = new google_ReportsSavedServiceResource($this, $this->serviceName, 'saved', json_decode('{"methods": {"generate": {"id": "adexchangeseller.reports.saved.generate", "path": "reports/{savedReportId}", "httpMethod": "GET", "parameters": {"locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "50000", "location": "query"}, "savedReportId": {"type": "string", "required": true, "location": "path"}, "startIndex": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "5000", "location": "query"}}, "response": {"$ref": "Report"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}, "list": {"id": "adexchangeseller.reports.saved.list", "path": "reports/saved", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "SavedReports"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
571
+ $this->urlchannels = new google_UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"id": "adexchangeseller.urlchannels.list", "path": "adclients/{adClientId}/urlchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "UrlChannels"}, "scopes": ["https://www.googleapis.com/auth/adexchange.seller", "https://www.googleapis.com/auth/adexchange.seller.readonly"]}}}', true));
572
+
573
+ }
574
+ }
575
+
576
+
577
+
578
+ class google_Account extends Google_Model {
579
+ public $id;
580
+ public $kind;
581
+ public $name;
582
+ public function setId( $id) {
583
+ $this->id = $id;
584
+ }
585
+ public function getId() {
586
+ return $this->id;
587
+ }
588
+ public function setKind( $kind) {
589
+ $this->kind = $kind;
590
+ }
591
+ public function getKind() {
592
+ return $this->kind;
593
+ }
594
+ public function setName( $name) {
595
+ $this->name = $name;
596
+ }
597
+ public function getName() {
598
+ return $this->name;
599
+ }
600
+ }
601
+
602
+ class google_AdClient extends Google_Model {
603
+ public $arcOptIn;
604
+ public $id;
605
+ public $kind;
606
+ public $productCode;
607
+ public $supportsReporting;
608
+ public function setArcOptIn( $arcOptIn) {
609
+ $this->arcOptIn = $arcOptIn;
610
+ }
611
+ public function getArcOptIn() {
612
+ return $this->arcOptIn;
613
+ }
614
+ public function setId( $id) {
615
+ $this->id = $id;
616
+ }
617
+ public function getId() {
618
+ return $this->id;
619
+ }
620
+ public function setKind( $kind) {
621
+ $this->kind = $kind;
622
+ }
623
+ public function getKind() {
624
+ return $this->kind;
625
+ }
626
+ public function setProductCode( $productCode) {
627
+ $this->productCode = $productCode;
628
+ }
629
+ public function getProductCode() {
630
+ return $this->productCode;
631
+ }
632
+ public function setSupportsReporting( $supportsReporting) {
633
+ $this->supportsReporting = $supportsReporting;
634
+ }
635
+ public function getSupportsReporting() {
636
+ return $this->supportsReporting;
637
+ }
638
+ }
639
+
640
+ class google_AdClients extends Google_Model {
641
+ public $etag;
642
+ protected $__itemsType = 'Google_AdClient';
643
+ protected $__itemsDataType = 'array';
644
+ public $items;
645
+ public $kind;
646
+ public $nextPageToken;
647
+ public function setEtag( $etag) {
648
+ $this->etag = $etag;
649
+ }
650
+ public function getEtag() {
651
+ return $this->etag;
652
+ }
653
+ public function setItems(/* array(google_AdClient) */ $items) {
654
+ $this->assertIsArray($items, 'google_AdClient', __METHOD__);
655
+ $this->items = $items;
656
+ }
657
+ public function getItems() {
658
+ return $this->items;
659
+ }
660
+ public function setKind( $kind) {
661
+ $this->kind = $kind;
662
+ }
663
+ public function getKind() {
664
+ return $this->kind;
665
+ }
666
+ public function setNextPageToken( $nextPageToken) {
667
+ $this->nextPageToken = $nextPageToken;
668
+ }
669
+ public function getNextPageToken() {
670
+ return $this->nextPageToken;
671
+ }
672
+ }
673
+
674
+ class google_AdUnit extends Google_Model {
675
+ public $code;
676
+ public $id;
677
+ public $kind;
678
+ public $name;
679
+ public $status;
680
+ public function setCode( $code) {
681
+ $this->code = $code;
682
+ }
683
+ public function getCode() {
684
+ return $this->code;
685
+ }
686
+ public function setId( $id) {
687
+ $this->id = $id;
688
+ }
689
+ public function getId() {
690
+ return $this->id;
691
+ }
692
+ public function setKind( $kind) {
693
+ $this->kind = $kind;
694
+ }
695
+ public function getKind() {
696
+ return $this->kind;
697
+ }
698
+ public function setName( $name) {
699
+ $this->name = $name;
700
+ }
701
+ public function getName() {
702
+ return $this->name;
703
+ }
704
+ public function setStatus( $status) {
705
+ $this->status = $status;
706
+ }
707
+ public function getStatus() {
708
+ return $this->status;
709
+ }
710
+ }
711
+
712
+ class google_AdUnits extends Google_Model {
713
+ public $etag;
714
+ protected $__itemsType = 'Google_AdUnit';
715
+ protected $__itemsDataType = 'array';
716
+ public $items;
717
+ public $kind;
718
+ public $nextPageToken;
719
+ public function setEtag( $etag) {
720
+ $this->etag = $etag;
721
+ }
722
+ public function getEtag() {
723
+ return $this->etag;
724
+ }
725
+ public function setItems(/* array(google_AdUnit) */ $items) {
726
+ $this->assertIsArray($items, 'google_AdUnit', __METHOD__);
727
+ $this->items = $items;
728
+ }
729
+ public function getItems() {
730
+ return $this->items;
731
+ }
732
+ public function setKind( $kind) {
733
+ $this->kind = $kind;
734
+ }
735
+ public function getKind() {
736
+ return $this->kind;
737
+ }
738
+ public function setNextPageToken( $nextPageToken) {
739
+ $this->nextPageToken = $nextPageToken;
740
+ }
741
+ public function getNextPageToken() {
742
+ return $this->nextPageToken;
743
+ }
744
+ }
745
+
746
+ class google_Alert extends Google_Model {
747
+ public $id;
748
+ public $kind;
749
+ public $message;
750
+ public $severity;
751
+ public $type;
752
+ public function setId( $id) {
753
+ $this->id = $id;
754
+ }
755
+ public function getId() {
756
+ return $this->id;
757
+ }
758
+ public function setKind( $kind) {
759
+ $this->kind = $kind;
760
+ }
761
+ public function getKind() {
762
+ return $this->kind;
763
+ }
764
+ public function setMessage( $message) {
765
+ $this->message = $message;
766
+ }
767
+ public function getMessage() {
768
+ return $this->message;
769
+ }
770
+ public function setSeverity( $severity) {
771
+ $this->severity = $severity;
772
+ }
773
+ public function getSeverity() {
774
+ return $this->severity;
775
+ }
776
+ public function setType( $type) {
777
+ $this->type = $type;
778
+ }
779
+ public function getType() {
780
+ return $this->type;
781
+ }
782
+ }
783
+
784
+ class google_Alerts extends Google_Model {
785
+ protected $__itemsType = 'Google_Alert';
786
+ protected $__itemsDataType = 'array';
787
+ public $items;
788
+ public $kind;
789
+ public function setItems(/* array(google_Alert) */ $items) {
790
+ $this->assertIsArray($items, 'google_Alert', __METHOD__);
791
+ $this->items = $items;
792
+ }
793
+ public function getItems() {
794
+ return $this->items;
795
+ }
796
+ public function setKind( $kind) {
797
+ $this->kind = $kind;
798
+ }
799
+ public function getKind() {
800
+ return $this->kind;
801
+ }
802
+ }
803
+
804
+ class google_CustomChannel extends Google_Model {
805
+ public $code;
806
+ public $id;
807
+ public $kind;
808
+ public $name;
809
+ protected $__targetingInfoType = 'Google_CustomChannelTargetingInfo';
810
+ protected $__targetingInfoDataType = '';
811
+ public $targetingInfo;
812
+ public function setCode( $code) {
813
+ $this->code = $code;
814
+ }
815
+ public function getCode() {
816
+ return $this->code;
817
+ }
818
+ public function setId( $id) {
819
+ $this->id = $id;
820
+ }
821
+ public function getId() {
822
+ return $this->id;
823
+ }
824
+ public function setKind( $kind) {
825
+ $this->kind = $kind;
826
+ }
827
+ public function getKind() {
828
+ return $this->kind;
829
+ }
830
+ public function setName( $name) {
831
+ $this->name = $name;
832
+ }
833
+ public function getName() {
834
+ return $this->name;
835
+ }
836
+ public function setTargetingInfo(Google_CustomChannelTargetingInfo $targetingInfo) {
837
+ $this->targetingInfo = $targetingInfo;
838
+ }
839
+ public function getTargetingInfo() {
840
+ return $this->targetingInfo;
841
+ }
842
+ }
843
+
844
+ class google_CustomChannelTargetingInfo extends Google_Model {
845
+ public $adsAppearOn;
846
+ public $description;
847
+ public $location;
848
+ public $siteLanguage;
849
+ public function setAdsAppearOn( $adsAppearOn) {
850
+ $this->adsAppearOn = $adsAppearOn;
851
+ }
852
+ public function getAdsAppearOn() {
853
+ return $this->adsAppearOn;
854
+ }
855
+ public function setDescription( $description) {
856
+ $this->description = $description;
857
+ }
858
+ public function getDescription() {
859
+ return $this->description;
860
+ }
861
+ public function setLocation( $location) {
862
+ $this->location = $location;
863
+ }
864
+ public function getLocation() {
865
+ return $this->location;
866
+ }
867
+ public function setSiteLanguage( $siteLanguage) {
868
+ $this->siteLanguage = $siteLanguage;
869
+ }
870
+ public function getSiteLanguage() {
871
+ return $this->siteLanguage;
872
+ }
873
+ }
874
+
875
+ class google_CustomChannels extends Google_Model {
876
+ public $etag;
877
+ protected $__itemsType = 'Google_CustomChannel';
878
+ protected $__itemsDataType = 'array';
879
+ public $items;
880
+ public $kind;
881
+ public $nextPageToken;
882
+ public function setEtag( $etag) {
883
+ $this->etag = $etag;
884
+ }
885
+ public function getEtag() {
886
+ return $this->etag;
887
+ }
888
+ public function setItems(/* array(google_CustomChannel) */ $items) {
889
+ $this->assertIsArray($items, 'google_CustomChannel', __METHOD__);
890
+ $this->items = $items;
891
+ }
892
+ public function getItems() {
893
+ return $this->items;
894
+ }
895
+ public function setKind( $kind) {
896
+ $this->kind = $kind;
897
+ }
898
+ public function getKind() {
899
+ return $this->kind;
900
+ }
901
+ public function setNextPageToken( $nextPageToken) {
902
+ $this->nextPageToken = $nextPageToken;
903
+ }
904
+ public function getNextPageToken() {
905
+ return $this->nextPageToken;
906
+ }
907
+ }
908
+
909
+ class google_Metadata extends Google_Model {
910
+ protected $__itemsType = 'Google_ReportingMetadataEntry';
911
+ protected $__itemsDataType = 'array';
912
+ public $items;
913
+ public $kind;
914
+ public function setItems(/* array(google_ReportingMetadataEntry) */ $items) {
915
+ $this->assertIsArray($items, 'google_ReportingMetadataEntry', __METHOD__);
916
+ $this->items = $items;
917
+ }
918
+ public function getItems() {
919
+ return $this->items;
920
+ }
921
+ public function setKind( $kind) {
922
+ $this->kind = $kind;
923
+ }
924
+ public function getKind() {
925
+ return $this->kind;
926
+ }
927
+ }
928
+
929
+ class google_PreferredDeal extends Google_Model {
930
+ public $advertiserName;
931
+ public $buyerNetworkName;
932
+ public $currencyCode;
933
+ public $endTime;
934
+ public $fixedCpm;
935
+ public $id;
936
+ public $kind;
937
+ public $startTime;
938
+ public function setAdvertiserName( $advertiserName) {
939
+ $this->advertiserName = $advertiserName;
940
+ }
941
+ public function getAdvertiserName() {
942
+ return $this->advertiserName;
943
+ }
944
+ public function setBuyerNetworkName( $buyerNetworkName) {
945
+ $this->buyerNetworkName = $buyerNetworkName;
946
+ }
947
+ public function getBuyerNetworkName() {
948
+ return $this->buyerNetworkName;
949
+ }
950
+ public function setCurrencyCode( $currencyCode) {
951
+ $this->currencyCode = $currencyCode;
952
+ }
953
+ public function getCurrencyCode() {
954
+ return $this->currencyCode;
955
+ }
956
+ public function setEndTime( $endTime) {
957
+ $this->endTime = $endTime;
958
+ }
959
+ public function getEndTime() {
960
+ return $this->endTime;
961
+ }
962
+ public function setFixedCpm( $fixedCpm) {
963
+ $this->fixedCpm = $fixedCpm;
964
+ }
965
+ public function getFixedCpm() {
966
+ return $this->fixedCpm;
967
+ }
968
+ public function setId( $id) {
969
+ $this->id = $id;
970
+ }
971
+ public function getId() {
972
+ return $this->id;
973
+ }
974
+ public function setKind( $kind) {
975
+ $this->kind = $kind;
976
+ }
977
+ public function getKind() {
978
+ return $this->kind;
979
+ }
980
+ public function setStartTime( $startTime) {
981
+ $this->startTime = $startTime;
982
+ }
983
+ public function getStartTime() {
984
+ return $this->startTime;
985
+ }
986
+ }
987
+
988
+ class google_PreferredDeals extends Google_Model {
989
+ protected $__itemsType = 'Google_PreferredDeal';
990
+ protected $__itemsDataType = 'array';
991
+ public $items;
992
+ public $kind;
993
+ public function setItems(/* array(google_PreferredDeal) */ $items) {
994
+ $this->assertIsArray($items, 'google_PreferredDeal', __METHOD__);
995
+ $this->items = $items;
996
+ }
997
+ public function getItems() {
998
+ return $this->items;
999
+ }
1000
+ public function setKind( $kind) {
1001
+ $this->kind = $kind;
1002
+ }
1003
+ public function getKind() {
1004
+ return $this->kind;
1005
+ }
1006
+ }
1007
+
1008
+ class google_Report extends Google_Model {
1009
+ public $averages;
1010
+ protected $__headersType = 'Google_ReportHeaders';
1011
+ protected $__headersDataType = 'array';
1012
+ public $headers;
1013
+ public $kind;
1014
+ public $rows;
1015
+ public $totalMatchedRows;
1016
+ public $totals;
1017
+ public $warnings;
1018
+ public function setAverages(/* array(google_string) */ $averages) {
1019
+ $this->assertIsArray($averages, 'google_string', __METHOD__);
1020
+ $this->averages = $averages;
1021
+ }
1022
+ public function getAverages() {
1023
+ return $this->averages;
1024
+ }
1025
+ public function setHeaders(/* array(google_ReportHeaders) */ $headers) {
1026
+ $this->assertIsArray($headers, 'google_ReportHeaders', __METHOD__);
1027
+ $this->headers = $headers;
1028
+ }
1029
+ public function getHeaders() {
1030
+ return $this->headers;
1031
+ }
1032
+ public function setKind( $kind) {
1033
+ $this->kind = $kind;
1034
+ }
1035
+ public function getKind() {
1036
+ return $this->kind;
1037
+ }
1038
+ public function setRows(/* array(google_string) */ $rows) {
1039
+ $this->assertIsArray($rows, 'google_string', __METHOD__);
1040
+ $this->rows = $rows;
1041
+ }
1042
+ public function getRows() {
1043
+ return $this->rows;
1044
+ }
1045
+ public function setTotalMatchedRows( $totalMatchedRows) {
1046
+ $this->totalMatchedRows = $totalMatchedRows;
1047
+ }
1048
+ public function getTotalMatchedRows() {
1049
+ return $this->totalMatchedRows;
1050
+ }
1051
+ public function setTotals(/* array(google_string) */ $totals) {
1052
+ $this->assertIsArray($totals, 'google_string', __METHOD__);
1053
+ $this->totals = $totals;
1054
+ }
1055
+ public function getTotals() {
1056
+ return $this->totals;
1057
+ }
1058
+ public function setWarnings(/* array(google_string) */ $warnings) {
1059
+ $this->assertIsArray($warnings, 'google_string', __METHOD__);
1060
+ $this->warnings = $warnings;
1061
+ }
1062
+ public function getWarnings() {
1063
+ return $this->warnings;
1064
+ }
1065
+ }
1066
+
1067
+ class google_ReportHeaders extends Google_Model {
1068
+ public $currency;
1069
+ public $name;
1070
+ public $type;
1071
+ public function setCurrency( $currency) {
1072
+ $this->currency = $currency;
1073
+ }
1074
+ public function getCurrency() {
1075
+ return $this->currency;
1076
+ }
1077
+ public function setName( $name) {
1078
+ $this->name = $name;
1079
+ }
1080
+ public function getName() {
1081
+ return $this->name;
1082
+ }
1083
+ public function setType( $type) {
1084
+ $this->type = $type;
1085
+ }
1086
+ public function getType() {
1087
+ return $this->type;
1088
+ }
1089
+ }
1090
+
1091
+ class google_ReportingMetadataEntry extends Google_Model {
1092
+ public $compatibleDimensions;
1093
+ public $compatibleMetrics;
1094
+ public $id;
1095
+ public $kind;
1096
+ public $requiredDimensions;
1097
+ public $requiredMetrics;
1098
+ public $supportedProducts;
1099
+ public function setCompatibleDimensions(/* array(google_string) */ $compatibleDimensions) {
1100
+ $this->assertIsArray($compatibleDimensions, 'google_string', __METHOD__);
1101
+ $this->compatibleDimensions = $compatibleDimensions;
1102
+ }
1103
+ public function getCompatibleDimensions() {
1104
+ return $this->compatibleDimensions;
1105
+ }
1106
+ public function setCompatibleMetrics(/* array(google_string) */ $compatibleMetrics) {
1107
+ $this->assertIsArray($compatibleMetrics, 'google_string', __METHOD__);
1108
+ $this->compatibleMetrics = $compatibleMetrics;
1109
+ }
1110
+ public function getCompatibleMetrics() {
1111
+ return $this->compatibleMetrics;
1112
+ }
1113
+ public function setId( $id) {
1114
+ $this->id = $id;
1115
+ }
1116
+ public function getId() {
1117
+ return $this->id;
1118
+ }
1119
+ public function setKind( $kind) {
1120
+ $this->kind = $kind;
1121
+ }
1122
+ public function getKind() {
1123
+ return $this->kind;
1124
+ }
1125
+ public function setRequiredDimensions(/* array(google_string) */ $requiredDimensions) {
1126
+ $this->assertIsArray($requiredDimensions, 'google_string', __METHOD__);
1127
+ $this->requiredDimensions = $requiredDimensions;
1128
+ }
1129
+ public function getRequiredDimensions() {
1130
+ return $this->requiredDimensions;
1131
+ }
1132
+ public function setRequiredMetrics(/* array(google_string) */ $requiredMetrics) {
1133
+ $this->assertIsArray($requiredMetrics, 'google_string', __METHOD__);
1134
+ $this->requiredMetrics = $requiredMetrics;
1135
+ }
1136
+ public function getRequiredMetrics() {
1137
+ return $this->requiredMetrics;
1138
+ }
1139
+ public function setSupportedProducts(/* array(google_string) */ $supportedProducts) {
1140
+ $this->assertIsArray($supportedProducts, 'google_string', __METHOD__);
1141
+ $this->supportedProducts = $supportedProducts;
1142
+ }
1143
+ public function getSupportedProducts() {
1144
+ return $this->supportedProducts;
1145
+ }
1146
+ }
1147
+
1148
+ class google_SavedReport extends Google_Model {
1149
+ public $id;
1150
+ public $kind;
1151
+ public $name;
1152
+ public function setId( $id) {
1153
+ $this->id = $id;
1154
+ }
1155
+ public function getId() {
1156
+ return $this->id;
1157
+ }
1158
+ public function setKind( $kind) {
1159
+ $this->kind = $kind;
1160
+ }
1161
+ public function getKind() {
1162
+ return $this->kind;
1163
+ }
1164
+ public function setName( $name) {
1165
+ $this->name = $name;
1166
+ }
1167
+ public function getName() {
1168
+ return $this->name;
1169
+ }
1170
+ }
1171
+
1172
+ class google_SavedReports extends Google_Model {
1173
+ public $etag;
1174
+ protected $__itemsType = 'Google_SavedReport';
1175
+ protected $__itemsDataType = 'array';
1176
+ public $items;
1177
+ public $kind;
1178
+ public $nextPageToken;
1179
+ public function setEtag( $etag) {
1180
+ $this->etag = $etag;
1181
+ }
1182
+ public function getEtag() {
1183
+ return $this->etag;
1184
+ }
1185
+ public function setItems(/* array(google_SavedReport) */ $items) {
1186
+ $this->assertIsArray($items, 'google_SavedReport', __METHOD__);
1187
+ $this->items = $items;
1188
+ }
1189
+ public function getItems() {
1190
+ return $this->items;
1191
+ }
1192
+ public function setKind( $kind) {
1193
+ $this->kind = $kind;
1194
+ }
1195
+ public function getKind() {
1196
+ return $this->kind;
1197
+ }
1198
+ public function setNextPageToken( $nextPageToken) {
1199
+ $this->nextPageToken = $nextPageToken;
1200
+ }
1201
+ public function getNextPageToken() {
1202
+ return $this->nextPageToken;
1203
+ }
1204
+ }
1205
+
1206
+ class google_UrlChannel extends Google_Model {
1207
+ public $id;
1208
+ public $kind;
1209
+ public $urlPattern;
1210
+ public function setId( $id) {
1211
+ $this->id = $id;
1212
+ }
1213
+ public function getId() {
1214
+ return $this->id;
1215
+ }
1216
+ public function setKind( $kind) {
1217
+ $this->kind = $kind;
1218
+ }
1219
+ public function getKind() {
1220
+ return $this->kind;
1221
+ }
1222
+ public function setUrlPattern( $urlPattern) {
1223
+ $this->urlPattern = $urlPattern;
1224
+ }
1225
+ public function getUrlPattern() {
1226
+ return $this->urlPattern;
1227
+ }
1228
+ }
1229
+
1230
+ class google_UrlChannels extends Google_Model {
1231
+ public $etag;
1232
+ protected $__itemsType = 'Google_UrlChannel';
1233
+ protected $__itemsDataType = 'array';
1234
+ public $items;
1235
+ public $kind;
1236
+ public $nextPageToken;
1237
+ public function setEtag( $etag) {
1238
+ $this->etag = $etag;
1239
+ }
1240
+ public function getEtag() {
1241
+ return $this->etag;
1242
+ }
1243
+ public function setItems(/* array(google_UrlChannel) */ $items) {
1244
+ $this->assertIsArray($items, 'google_UrlChannel', __METHOD__);
1245
+ $this->items = $items;
1246
+ }
1247
+ public function getItems() {
1248
+ return $this->items;
1249
+ }
1250
+ public function setKind( $kind) {
1251
+ $this->kind = $kind;
1252
+ }
1253
+ public function getKind() {
1254
+ return $this->kind;
1255
+ }
1256
+ public function setNextPageToken( $nextPageToken) {
1257
+ $this->nextPageToken = $nextPageToken;
1258
+ }
1259
+ public function getNextPageToken() {
1260
+ return $this->nextPageToken;
1261
+ }
1262
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdSenseService.php ADDED
@@ -0,0 +1,2054 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "accounts" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $adsenseService = new Google_AdSenseService(...);
22
+ * $accounts = $adsenseService->accounts;
23
+ * </code>
24
+ */
25
+ class Google_AccountsServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Get information about the selected AdSense account. (accounts.get)
29
+ *
30
+ * @param string $accountId Account to get information about.
31
+ * @param array $optParams Optional parameters.
32
+ *
33
+ * @opt_param bool tree Whether the tree of sub accounts should be returned.
34
+ * @return Google_Account
35
+ */
36
+ public function get($accountId, $optParams = array()) {
37
+ $params = array('accountId' => $accountId);
38
+ $params = array_merge($params, $optParams);
39
+ $data = $this->__call('get', array($params));
40
+ if ($this->useObjects()) {
41
+ return new Google_Account($data);
42
+ } else {
43
+ return $data;
44
+ }
45
+ }
46
+ /**
47
+ * List all accounts available to this AdSense account. (accounts.list)
48
+ *
49
+ * @param array $optParams Optional parameters.
50
+ *
51
+ * @opt_param int maxResults The maximum number of accounts to include in the response, used for paging.
52
+ * @opt_param string pageToken A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
53
+ * @return Google_Accounts
54
+ */
55
+ public function listAccounts($optParams = array()) {
56
+ $params = array();
57
+ $params = array_merge($params, $optParams);
58
+ $data = $this->__call('list', array($params));
59
+ if ($this->useObjects()) {
60
+ return new Google_Accounts($data);
61
+ } else {
62
+ return $data;
63
+ }
64
+ }
65
+ }
66
+
67
+ /**
68
+ * The "adclients" collection of methods.
69
+ * Typical usage is:
70
+ * <code>
71
+ * $adsenseService = new Google_AdSenseService(...);
72
+ * $adclients = $adsenseService->adclients;
73
+ * </code>
74
+ */
75
+ class Google_AccountsAdclientsServiceResource extends Google_ServiceResource {
76
+
77
+ /**
78
+ * List all ad clients in the specified account. (adclients.list)
79
+ *
80
+ * @param string $accountId Account for which to list ad clients.
81
+ * @param array $optParams Optional parameters.
82
+ *
83
+ * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging.
84
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
85
+ * @return Google_AdClients
86
+ */
87
+ public function listAccountsAdclients($accountId, $optParams = array()) {
88
+ $params = array('accountId' => $accountId);
89
+ $params = array_merge($params, $optParams);
90
+ $data = $this->__call('list', array($params));
91
+ if ($this->useObjects()) {
92
+ return new Google_AdClients($data);
93
+ } else {
94
+ return $data;
95
+ }
96
+ }
97
+ }
98
+ /**
99
+ * The "adunits" collection of methods.
100
+ * Typical usage is:
101
+ * <code>
102
+ * $adsenseService = new Google_AdSenseService(...);
103
+ * $adunits = $adsenseService->adunits;
104
+ * </code>
105
+ */
106
+ class Google_AccountsAdunitsServiceResource extends Google_ServiceResource {
107
+
108
+ /**
109
+ * Gets the specified ad unit in the specified ad client for the specified account. (adunits.get)
110
+ *
111
+ * @param string $accountId Account to which the ad client belongs.
112
+ * @param string $adClientId Ad client for which to get the ad unit.
113
+ * @param string $adUnitId Ad unit to retrieve.
114
+ * @param array $optParams Optional parameters.
115
+ * @return Google_AdUnit
116
+ */
117
+ public function get($accountId, $adClientId, $adUnitId, $optParams = array()) {
118
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
119
+ $params = array_merge($params, $optParams);
120
+ $data = $this->__call('get', array($params));
121
+ if ($this->useObjects()) {
122
+ return new Google_AdUnit($data);
123
+ } else {
124
+ return $data;
125
+ }
126
+ }
127
+ /**
128
+ * Get ad code for the specified ad unit. (adunits.getAdCode)
129
+ *
130
+ * @param string $accountId Account which contains the ad client.
131
+ * @param string $adClientId Ad client with contains the ad unit.
132
+ * @param string $adUnitId Ad unit to get the code for.
133
+ * @param array $optParams Optional parameters.
134
+ * @return Google_AdCode
135
+ */
136
+ public function getAdCode($accountId, $adClientId, $adUnitId, $optParams = array()) {
137
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
138
+ $params = array_merge($params, $optParams);
139
+ $data = $this->__call('getAdCode', array($params));
140
+ if ($this->useObjects()) {
141
+ return new Google_AdCode($data);
142
+ } else {
143
+ return $data;
144
+ }
145
+ }
146
+ /**
147
+ * List all ad units in the specified ad client for the specified account. (adunits.list)
148
+ *
149
+ * @param string $accountId Account to which the ad client belongs.
150
+ * @param string $adClientId Ad client for which to list ad units.
151
+ * @param array $optParams Optional parameters.
152
+ *
153
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
154
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
155
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
156
+ * @return Google_AdUnits
157
+ */
158
+ public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) {
159
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
160
+ $params = array_merge($params, $optParams);
161
+ $data = $this->__call('list', array($params));
162
+ if ($this->useObjects()) {
163
+ return new Google_AdUnits($data);
164
+ } else {
165
+ return $data;
166
+ }
167
+ }
168
+ }
169
+
170
+ /**
171
+ * The "customchannels" collection of methods.
172
+ * Typical usage is:
173
+ * <code>
174
+ * $adsenseService = new Google_AdSenseService(...);
175
+ * $customchannels = $adsenseService->customchannels;
176
+ * </code>
177
+ */
178
+ class Google_AccountsAdunitsCustomchannelsServiceResource extends Google_ServiceResource {
179
+
180
+ /**
181
+ * List all custom channels which the specified ad unit belongs to. (customchannels.list)
182
+ *
183
+ * @param string $accountId Account to which the ad client belongs.
184
+ * @param string $adClientId Ad client which contains the ad unit.
185
+ * @param string $adUnitId Ad unit for which to list custom channels.
186
+ * @param array $optParams Optional parameters.
187
+ *
188
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
189
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
190
+ * @return Google_CustomChannels
191
+ */
192
+ public function listAccountsAdunitsCustomchannels($accountId, $adClientId, $adUnitId, $optParams = array()) {
193
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
194
+ $params = array_merge($params, $optParams);
195
+ $data = $this->__call('list', array($params));
196
+ if ($this->useObjects()) {
197
+ return new Google_CustomChannels($data);
198
+ } else {
199
+ return $data;
200
+ }
201
+ }
202
+ }
203
+ /**
204
+ * The "alerts" collection of methods.
205
+ * Typical usage is:
206
+ * <code>
207
+ * $adsenseService = new Google_AdSenseService(...);
208
+ * $alerts = $adsenseService->alerts;
209
+ * </code>
210
+ */
211
+ class Google_AccountsAlertsServiceResource extends Google_ServiceResource {
212
+
213
+ /**
214
+ * List the alerts for the specified AdSense account. (alerts.list)
215
+ *
216
+ * @param string $accountId Account for which to retrieve the alerts.
217
+ * @param array $optParams Optional parameters.
218
+ *
219
+ * @opt_param string locale The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.
220
+ * @return Google_Alerts
221
+ */
222
+ public function listAccountsAlerts($accountId, $optParams = array()) {
223
+ $params = array('accountId' => $accountId);
224
+ $params = array_merge($params, $optParams);
225
+ $data = $this->__call('list', array($params));
226
+ if ($this->useObjects()) {
227
+ return new Google_Alerts($data);
228
+ } else {
229
+ return $data;
230
+ }
231
+ }
232
+ }
233
+ /**
234
+ * The "customchannels" collection of methods.
235
+ * Typical usage is:
236
+ * <code>
237
+ * $adsenseService = new Google_AdSenseService(...);
238
+ * $customchannels = $adsenseService->customchannels;
239
+ * </code>
240
+ */
241
+ class Google_AccountsCustomchannelsServiceResource extends Google_ServiceResource {
242
+
243
+ /**
244
+ * Get the specified custom channel from the specified ad client for the specified account.
245
+ * (customchannels.get)
246
+ *
247
+ * @param string $accountId Account to which the ad client belongs.
248
+ * @param string $adClientId Ad client which contains the custom channel.
249
+ * @param string $customChannelId Custom channel to retrieve.
250
+ * @param array $optParams Optional parameters.
251
+ * @return Google_CustomChannel
252
+ */
253
+ public function get($accountId, $adClientId, $customChannelId, $optParams = array()) {
254
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'customChannelId' => $customChannelId);
255
+ $params = array_merge($params, $optParams);
256
+ $data = $this->__call('get', array($params));
257
+ if ($this->useObjects()) {
258
+ return new Google_CustomChannel($data);
259
+ } else {
260
+ return $data;
261
+ }
262
+ }
263
+ /**
264
+ * List all custom channels in the specified ad client for the specified account.
265
+ * (customchannels.list)
266
+ *
267
+ * @param string $accountId Account to which the ad client belongs.
268
+ * @param string $adClientId Ad client for which to list custom channels.
269
+ * @param array $optParams Optional parameters.
270
+ *
271
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
272
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
273
+ * @return Google_CustomChannels
274
+ */
275
+ public function listAccountsCustomchannels($accountId, $adClientId, $optParams = array()) {
276
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
277
+ $params = array_merge($params, $optParams);
278
+ $data = $this->__call('list', array($params));
279
+ if ($this->useObjects()) {
280
+ return new Google_CustomChannels($data);
281
+ } else {
282
+ return $data;
283
+ }
284
+ }
285
+ }
286
+
287
+ /**
288
+ * The "adunits" collection of methods.
289
+ * Typical usage is:
290
+ * <code>
291
+ * $adsenseService = new Google_AdSenseService(...);
292
+ * $adunits = $adsenseService->adunits;
293
+ * </code>
294
+ */
295
+ class Google_AccountsCustomchannelsAdunitsServiceResource extends Google_ServiceResource {
296
+
297
+ /**
298
+ * List all ad units in the specified custom channel. (adunits.list)
299
+ *
300
+ * @param string $accountId Account to which the ad client belongs.
301
+ * @param string $adClientId Ad client which contains the custom channel.
302
+ * @param string $customChannelId Custom channel for which to list ad units.
303
+ * @param array $optParams Optional parameters.
304
+ *
305
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
306
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
307
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
308
+ * @return Google_AdUnits
309
+ */
310
+ public function listAccountsCustomchannelsAdunits($accountId, $adClientId, $customChannelId, $optParams = array()) {
311
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'customChannelId' => $customChannelId);
312
+ $params = array_merge($params, $optParams);
313
+ $data = $this->__call('list', array($params));
314
+ if ($this->useObjects()) {
315
+ return new Google_AdUnits($data);
316
+ } else {
317
+ return $data;
318
+ }
319
+ }
320
+ }
321
+ /**
322
+ * The "reports" collection of methods.
323
+ * Typical usage is:
324
+ * <code>
325
+ * $adsenseService = new Google_AdSenseService(...);
326
+ * $reports = $adsenseService->reports;
327
+ * </code>
328
+ */
329
+ class Google_AccountsReportsServiceResource extends Google_ServiceResource {
330
+
331
+ /**
332
+ * Generate an AdSense report based on the report request sent in the query parameters. Returns the
333
+ * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
334
+ * (reports.generate)
335
+ *
336
+ * @param string $accountId Account upon which to report.
337
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
338
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
339
+ * @param array $optParams Optional parameters.
340
+ *
341
+ * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
342
+ * @opt_param string dimension Dimensions to base the report on.
343
+ * @opt_param string filter Filters to be run on the report.
344
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
345
+ * @opt_param int maxResults The maximum number of rows of report data to return.
346
+ * @opt_param string metric Numeric columns to include in the report.
347
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
348
+ * @opt_param int startIndex Index of the first row of report data to return.
349
+ * @opt_param bool useTimezoneReporting Whether the report should be generated in the AdSense account's local timezone. If false default PST/PDT timezone will be used.
350
+ * @return Google_AdsenseReportsGenerateResponse
351
+ */
352
+ public function generate($accountId, $startDate, $endDate, $optParams = array()) {
353
+ $params = array('accountId' => $accountId, 'startDate' => $startDate, 'endDate' => $endDate);
354
+ $params = array_merge($params, $optParams);
355
+ $data = $this->__call('generate', array($params));
356
+ if ($this->useObjects()) {
357
+ return new Google_AdsenseReportsGenerateResponse($data);
358
+ } else {
359
+ return $data;
360
+ }
361
+ }
362
+ }
363
+
364
+ /**
365
+ * The "saved" collection of methods.
366
+ * Typical usage is:
367
+ * <code>
368
+ * $adsenseService = new Google_AdSenseService(...);
369
+ * $saved = $adsenseService->saved;
370
+ * </code>
371
+ */
372
+ class Google_AccountsReportsSavedServiceResource extends Google_ServiceResource {
373
+
374
+ /**
375
+ * Generate an AdSense report based on the saved report ID sent in the query parameters.
376
+ * (saved.generate)
377
+ *
378
+ * @param string $accountId Account to which the saved reports belong.
379
+ * @param string $savedReportId The saved report to retrieve.
380
+ * @param array $optParams Optional parameters.
381
+ *
382
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
383
+ * @opt_param int maxResults The maximum number of rows of report data to return.
384
+ * @opt_param int startIndex Index of the first row of report data to return.
385
+ * @return Google_AdsenseReportsGenerateResponse
386
+ */
387
+ public function generate($accountId, $savedReportId, $optParams = array()) {
388
+ $params = array('accountId' => $accountId, 'savedReportId' => $savedReportId);
389
+ $params = array_merge($params, $optParams);
390
+ $data = $this->__call('generate', array($params));
391
+ if ($this->useObjects()) {
392
+ return new Google_AdsenseReportsGenerateResponse($data);
393
+ } else {
394
+ return $data;
395
+ }
396
+ }
397
+ /**
398
+ * List all saved reports in the specified AdSense account. (saved.list)
399
+ *
400
+ * @param string $accountId Account to which the saved reports belong.
401
+ * @param array $optParams Optional parameters.
402
+ *
403
+ * @opt_param int maxResults The maximum number of saved reports to include in the response, used for paging.
404
+ * @opt_param string pageToken A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
405
+ * @return Google_SavedReports
406
+ */
407
+ public function listAccountsReportsSaved($accountId, $optParams = array()) {
408
+ $params = array('accountId' => $accountId);
409
+ $params = array_merge($params, $optParams);
410
+ $data = $this->__call('list', array($params));
411
+ if ($this->useObjects()) {
412
+ return new Google_SavedReports($data);
413
+ } else {
414
+ return $data;
415
+ }
416
+ }
417
+ }
418
+ /**
419
+ * The "savedadstyles" collection of methods.
420
+ * Typical usage is:
421
+ * <code>
422
+ * $adsenseService = new Google_AdSenseService(...);
423
+ * $savedadstyles = $adsenseService->savedadstyles;
424
+ * </code>
425
+ */
426
+ class Google_AccountsSavedadstylesServiceResource extends Google_ServiceResource {
427
+
428
+ /**
429
+ * List a specific saved ad style for the specified account. (savedadstyles.get)
430
+ *
431
+ * @param string $accountId Account for which to get the saved ad style.
432
+ * @param string $savedAdStyleId Saved ad style to retrieve.
433
+ * @param array $optParams Optional parameters.
434
+ * @return Google_SavedAdStyle
435
+ */
436
+ public function get($accountId, $savedAdStyleId, $optParams = array()) {
437
+ $params = array('accountId' => $accountId, 'savedAdStyleId' => $savedAdStyleId);
438
+ $params = array_merge($params, $optParams);
439
+ $data = $this->__call('get', array($params));
440
+ if ($this->useObjects()) {
441
+ return new Google_SavedAdStyle($data);
442
+ } else {
443
+ return $data;
444
+ }
445
+ }
446
+ /**
447
+ * List all saved ad styles in the specified account. (savedadstyles.list)
448
+ *
449
+ * @param string $accountId Account for which to list saved ad styles.
450
+ * @param array $optParams Optional parameters.
451
+ *
452
+ * @opt_param int maxResults The maximum number of saved ad styles to include in the response, used for paging.
453
+ * @opt_param string pageToken A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
454
+ * @return Google_SavedAdStyles
455
+ */
456
+ public function listAccountsSavedadstyles($accountId, $optParams = array()) {
457
+ $params = array('accountId' => $accountId);
458
+ $params = array_merge($params, $optParams);
459
+ $data = $this->__call('list', array($params));
460
+ if ($this->useObjects()) {
461
+ return new Google_SavedAdStyles($data);
462
+ } else {
463
+ return $data;
464
+ }
465
+ }
466
+ }
467
+ /**
468
+ * The "urlchannels" collection of methods.
469
+ * Typical usage is:
470
+ * <code>
471
+ * $adsenseService = new Google_AdSenseService(...);
472
+ * $urlchannels = $adsenseService->urlchannels;
473
+ * </code>
474
+ */
475
+ class Google_AccountsUrlchannelsServiceResource extends Google_ServiceResource {
476
+
477
+ /**
478
+ * List all URL channels in the specified ad client for the specified account. (urlchannels.list)
479
+ *
480
+ * @param string $accountId Account to which the ad client belongs.
481
+ * @param string $adClientId Ad client for which to list URL channels.
482
+ * @param array $optParams Optional parameters.
483
+ *
484
+ * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging.
485
+ * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
486
+ * @return Google_UrlChannels
487
+ */
488
+ public function listAccountsUrlchannels($accountId, $adClientId, $optParams = array()) {
489
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
490
+ $params = array_merge($params, $optParams);
491
+ $data = $this->__call('list', array($params));
492
+ if ($this->useObjects()) {
493
+ return new Google_UrlChannels($data);
494
+ } else {
495
+ return $data;
496
+ }
497
+ }
498
+ }
499
+
500
+ /**
501
+ * The "adclients" collection of methods.
502
+ * Typical usage is:
503
+ * <code>
504
+ * $adsenseService = new Google_AdSenseService(...);
505
+ * $adclients = $adsenseService->adclients;
506
+ * </code>
507
+ */
508
+ class Google_AdclientsServiceResource extends Google_ServiceResource {
509
+
510
+ /**
511
+ * List all ad clients in this AdSense account. (adclients.list)
512
+ *
513
+ * @param array $optParams Optional parameters.
514
+ *
515
+ * @opt_param int maxResults The maximum number of ad clients to include in the response, used for paging.
516
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
517
+ * @return Google_AdClients
518
+ */
519
+ public function listAdclients($optParams = array()) {
520
+ $params = array();
521
+ $params = array_merge($params, $optParams);
522
+ $data = $this->__call('list', array($params));
523
+ if ($this->useObjects()) {
524
+ return new Google_AdClients($data);
525
+ } else {
526
+ return $data;
527
+ }
528
+ }
529
+ }
530
+
531
+ /**
532
+ * The "adunits" collection of methods.
533
+ * Typical usage is:
534
+ * <code>
535
+ * $adsenseService = new Google_AdSenseService(...);
536
+ * $adunits = $adsenseService->adunits;
537
+ * </code>
538
+ */
539
+ class Google_AdunitsServiceResource extends Google_ServiceResource {
540
+
541
+ /**
542
+ * Gets the specified ad unit in the specified ad client. (adunits.get)
543
+ *
544
+ * @param string $adClientId Ad client for which to get the ad unit.
545
+ * @param string $adUnitId Ad unit to retrieve.
546
+ * @param array $optParams Optional parameters.
547
+ * @return Google_AdUnit
548
+ */
549
+ public function get($adClientId, $adUnitId, $optParams = array()) {
550
+ $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
551
+ $params = array_merge($params, $optParams);
552
+ $data = $this->__call('get', array($params));
553
+ if ($this->useObjects()) {
554
+ return new Google_AdUnit($data);
555
+ } else {
556
+ return $data;
557
+ }
558
+ }
559
+ /**
560
+ * Get ad code for the specified ad unit. (adunits.getAdCode)
561
+ *
562
+ * @param string $adClientId Ad client with contains the ad unit.
563
+ * @param string $adUnitId Ad unit to get the code for.
564
+ * @param array $optParams Optional parameters.
565
+ * @return Google_AdCode
566
+ */
567
+ public function getAdCode($adClientId, $adUnitId, $optParams = array()) {
568
+ $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
569
+ $params = array_merge($params, $optParams);
570
+ $data = $this->__call('getAdCode', array($params));
571
+ if ($this->useObjects()) {
572
+ return new Google_AdCode($data);
573
+ } else {
574
+ return $data;
575
+ }
576
+ }
577
+ /**
578
+ * List all ad units in the specified ad client for this AdSense account. (adunits.list)
579
+ *
580
+ * @param string $adClientId Ad client for which to list ad units.
581
+ * @param array $optParams Optional parameters.
582
+ *
583
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
584
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
585
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
586
+ * @return Google_AdUnits
587
+ */
588
+ public function listAdunits($adClientId, $optParams = array()) {
589
+ $params = array('adClientId' => $adClientId);
590
+ $params = array_merge($params, $optParams);
591
+ $data = $this->__call('list', array($params));
592
+ if ($this->useObjects()) {
593
+ return new Google_AdUnits($data);
594
+ } else {
595
+ return $data;
596
+ }
597
+ }
598
+ }
599
+
600
+ /**
601
+ * The "customchannels" collection of methods.
602
+ * Typical usage is:
603
+ * <code>
604
+ * $adsenseService = new Google_AdSenseService(...);
605
+ * $customchannels = $adsenseService->customchannels;
606
+ * </code>
607
+ */
608
+ class Google_AdunitsCustomchannelsServiceResource extends Google_ServiceResource {
609
+
610
+ /**
611
+ * List all custom channels which the specified ad unit belongs to. (customchannels.list)
612
+ *
613
+ * @param string $adClientId Ad client which contains the ad unit.
614
+ * @param string $adUnitId Ad unit for which to list custom channels.
615
+ * @param array $optParams Optional parameters.
616
+ *
617
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
618
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
619
+ * @return Google_CustomChannels
620
+ */
621
+ public function listAdunitsCustomchannels($adClientId, $adUnitId, $optParams = array()) {
622
+ $params = array('adClientId' => $adClientId, 'adUnitId' => $adUnitId);
623
+ $params = array_merge($params, $optParams);
624
+ $data = $this->__call('list', array($params));
625
+ if ($this->useObjects()) {
626
+ return new Google_CustomChannels($data);
627
+ } else {
628
+ return $data;
629
+ }
630
+ }
631
+ }
632
+
633
+ /**
634
+ * The "alerts" collection of methods.
635
+ * Typical usage is:
636
+ * <code>
637
+ * $adsenseService = new Google_AdSenseService(...);
638
+ * $alerts = $adsenseService->alerts;
639
+ * </code>
640
+ */
641
+ class Google_AlertsServiceResource extends Google_ServiceResource {
642
+
643
+ /**
644
+ * List the alerts for this AdSense account. (alerts.list)
645
+ *
646
+ * @param array $optParams Optional parameters.
647
+ *
648
+ * @opt_param string locale The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.
649
+ * @return Google_Alerts
650
+ */
651
+ public function listAlerts($optParams = array()) {
652
+ $params = array();
653
+ $params = array_merge($params, $optParams);
654
+ $data = $this->__call('list', array($params));
655
+ if ($this->useObjects()) {
656
+ return new Google_Alerts($data);
657
+ } else {
658
+ return $data;
659
+ }
660
+ }
661
+ }
662
+
663
+ /**
664
+ * The "customchannels" collection of methods.
665
+ * Typical usage is:
666
+ * <code>
667
+ * $adsenseService = new Google_AdSenseService(...);
668
+ * $customchannels = $adsenseService->customchannels;
669
+ * </code>
670
+ */
671
+ class Google_CustomchannelsServiceResource extends Google_ServiceResource {
672
+
673
+ /**
674
+ * Get the specified custom channel from the specified ad client. (customchannels.get)
675
+ *
676
+ * @param string $adClientId Ad client which contains the custom channel.
677
+ * @param string $customChannelId Custom channel to retrieve.
678
+ * @param array $optParams Optional parameters.
679
+ * @return Google_CustomChannel
680
+ */
681
+ public function get($adClientId, $customChannelId, $optParams = array()) {
682
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
683
+ $params = array_merge($params, $optParams);
684
+ $data = $this->__call('get', array($params));
685
+ if ($this->useObjects()) {
686
+ return new Google_CustomChannel($data);
687
+ } else {
688
+ return $data;
689
+ }
690
+ }
691
+ /**
692
+ * List all custom channels in the specified ad client for this AdSense account.
693
+ * (customchannels.list)
694
+ *
695
+ * @param string $adClientId Ad client for which to list custom channels.
696
+ * @param array $optParams Optional parameters.
697
+ *
698
+ * @opt_param int maxResults The maximum number of custom channels to include in the response, used for paging.
699
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
700
+ * @return Google_CustomChannels
701
+ */
702
+ public function listCustomchannels($adClientId, $optParams = array()) {
703
+ $params = array('adClientId' => $adClientId);
704
+ $params = array_merge($params, $optParams);
705
+ $data = $this->__call('list', array($params));
706
+ if ($this->useObjects()) {
707
+ return new Google_CustomChannels($data);
708
+ } else {
709
+ return $data;
710
+ }
711
+ }
712
+ }
713
+
714
+ /**
715
+ * The "adunits" collection of methods.
716
+ * Typical usage is:
717
+ * <code>
718
+ * $adsenseService = new Google_AdSenseService(...);
719
+ * $adunits = $adsenseService->adunits;
720
+ * </code>
721
+ */
722
+ class Google_CustomchannelsAdunitsServiceResource extends Google_ServiceResource {
723
+
724
+ /**
725
+ * List all ad units in the specified custom channel. (adunits.list)
726
+ *
727
+ * @param string $adClientId Ad client which contains the custom channel.
728
+ * @param string $customChannelId Custom channel for which to list ad units.
729
+ * @param array $optParams Optional parameters.
730
+ *
731
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
732
+ * @opt_param int maxResults The maximum number of ad units to include in the response, used for paging.
733
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
734
+ * @return Google_AdUnits
735
+ */
736
+ public function listCustomchannelsAdunits($adClientId, $customChannelId, $optParams = array()) {
737
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
738
+ $params = array_merge($params, $optParams);
739
+ $data = $this->__call('list', array($params));
740
+ if ($this->useObjects()) {
741
+ return new Google_AdUnits($data);
742
+ } else {
743
+ return $data;
744
+ }
745
+ }
746
+ }
747
+
748
+ /**
749
+ * The "metadata" collection of methods.
750
+ * Typical usage is:
751
+ * <code>
752
+ * $adsenseService = new Google_AdSenseService(...);
753
+ * $metadata = $adsenseService->metadata;
754
+ * </code>
755
+ */
756
+ class Google_MetadataServiceResource extends Google_ServiceResource {
757
+
758
+ }
759
+
760
+ /**
761
+ * The "dimensions" collection of methods.
762
+ * Typical usage is:
763
+ * <code>
764
+ * $adsenseService = new Google_AdSenseService(...);
765
+ * $dimensions = $adsenseService->dimensions;
766
+ * </code>
767
+ */
768
+ class Google_MetadataDimensionsServiceResource extends Google_ServiceResource {
769
+
770
+ /**
771
+ * List the metadata for the dimensions available to this AdSense account. (dimensions.list)
772
+ *
773
+ * @param array $optParams Optional parameters.
774
+ * @return Google_Metadata
775
+ */
776
+ public function listMetadataDimensions($optParams = array()) {
777
+ $params = array();
778
+ $params = array_merge($params, $optParams);
779
+ $data = $this->__call('list', array($params));
780
+ if ($this->useObjects()) {
781
+ return new Google_Metadata($data);
782
+ } else {
783
+ return $data;
784
+ }
785
+ }
786
+ }
787
+ /**
788
+ * The "metrics" collection of methods.
789
+ * Typical usage is:
790
+ * <code>
791
+ * $adsenseService = new Google_AdSenseService(...);
792
+ * $metrics = $adsenseService->metrics;
793
+ * </code>
794
+ */
795
+ class Google_MetadataMetricsServiceResource extends Google_ServiceResource {
796
+
797
+ /**
798
+ * List the metadata for the metrics available to this AdSense account. (metrics.list)
799
+ *
800
+ * @param array $optParams Optional parameters.
801
+ * @return Google_Metadata
802
+ */
803
+ public function listMetadataMetrics($optParams = array()) {
804
+ $params = array();
805
+ $params = array_merge($params, $optParams);
806
+ $data = $this->__call('list', array($params));
807
+ if ($this->useObjects()) {
808
+ return new Google_Metadata($data);
809
+ } else {
810
+ return $data;
811
+ }
812
+ }
813
+ }
814
+
815
+ /**
816
+ * The "reports" collection of methods.
817
+ * Typical usage is:
818
+ * <code>
819
+ * $adsenseService = new Google_AdSenseService(...);
820
+ * $reports = $adsenseService->reports;
821
+ * </code>
822
+ */
823
+ class Google_ReportsServiceResource extends Google_ServiceResource {
824
+
825
+ /**
826
+ * Generate an AdSense report based on the report request sent in the query parameters. Returns the
827
+ * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
828
+ * (reports.generate)
829
+ *
830
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
831
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
832
+ * @param array $optParams Optional parameters.
833
+ *
834
+ * @opt_param string accountId Accounts upon which to report.
835
+ * @opt_param string currency Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
836
+ * @opt_param string dimension Dimensions to base the report on.
837
+ * @opt_param string filter Filters to be run on the report.
838
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
839
+ * @opt_param int maxResults The maximum number of rows of report data to return.
840
+ * @opt_param string metric Numeric columns to include in the report.
841
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
842
+ * @opt_param int startIndex Index of the first row of report data to return.
843
+ * @opt_param bool useTimezoneReporting Whether the report should be generated in the AdSense account's local timezone. If false default PST/PDT timezone will be used.
844
+ * @return Google_AdsenseReportsGenerateResponse
845
+ */
846
+ public function generate($startDate, $endDate, $optParams = array()) {
847
+ $params = array('startDate' => $startDate, 'endDate' => $endDate);
848
+ $params = array_merge($params, $optParams);
849
+ $data = $this->__call('generate', array($params));
850
+ if ($this->useObjects()) {
851
+ return new Google_AdsenseReportsGenerateResponse($data);
852
+ } else {
853
+ return $data;
854
+ }
855
+ }
856
+ }
857
+
858
+ /**
859
+ * The "saved" collection of methods.
860
+ * Typical usage is:
861
+ * <code>
862
+ * $adsenseService = new Google_AdSenseService(...);
863
+ * $saved = $adsenseService->saved;
864
+ * </code>
865
+ */
866
+ class Google_ReportsSavedServiceResource extends Google_ServiceResource {
867
+
868
+ /**
869
+ * Generate an AdSense report based on the saved report ID sent in the query parameters.
870
+ * (saved.generate)
871
+ *
872
+ * @param string $savedReportId The saved report to retrieve.
873
+ * @param array $optParams Optional parameters.
874
+ *
875
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
876
+ * @opt_param int maxResults The maximum number of rows of report data to return.
877
+ * @opt_param int startIndex Index of the first row of report data to return.
878
+ * @return Google_AdsenseReportsGenerateResponse
879
+ */
880
+ public function generate($savedReportId, $optParams = array()) {
881
+ $params = array('savedReportId' => $savedReportId);
882
+ $params = array_merge($params, $optParams);
883
+ $data = $this->__call('generate', array($params));
884
+ if ($this->useObjects()) {
885
+ return new Google_AdsenseReportsGenerateResponse($data);
886
+ } else {
887
+ return $data;
888
+ }
889
+ }
890
+ /**
891
+ * List all saved reports in this AdSense account. (saved.list)
892
+ *
893
+ * @param array $optParams Optional parameters.
894
+ *
895
+ * @opt_param int maxResults The maximum number of saved reports to include in the response, used for paging.
896
+ * @opt_param string pageToken A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
897
+ * @return Google_SavedReports
898
+ */
899
+ public function listReportsSaved($optParams = array()) {
900
+ $params = array();
901
+ $params = array_merge($params, $optParams);
902
+ $data = $this->__call('list', array($params));
903
+ if ($this->useObjects()) {
904
+ return new Google_SavedReports($data);
905
+ } else {
906
+ return $data;
907
+ }
908
+ }
909
+ }
910
+
911
+ /**
912
+ * The "savedadstyles" collection of methods.
913
+ * Typical usage is:
914
+ * <code>
915
+ * $adsenseService = new Google_AdSenseService(...);
916
+ * $savedadstyles = $adsenseService->savedadstyles;
917
+ * </code>
918
+ */
919
+ class Google_SavedadstylesServiceResource extends Google_ServiceResource {
920
+
921
+ /**
922
+ * Get a specific saved ad style from the user's account. (savedadstyles.get)
923
+ *
924
+ * @param string $savedAdStyleId Saved ad style to retrieve.
925
+ * @param array $optParams Optional parameters.
926
+ * @return Google_SavedAdStyle
927
+ */
928
+ public function get($savedAdStyleId, $optParams = array()) {
929
+ $params = array('savedAdStyleId' => $savedAdStyleId);
930
+ $params = array_merge($params, $optParams);
931
+ $data = $this->__call('get', array($params));
932
+ if ($this->useObjects()) {
933
+ return new Google_SavedAdStyle($data);
934
+ } else {
935
+ return $data;
936
+ }
937
+ }
938
+ /**
939
+ * List all saved ad styles in the user's account. (savedadstyles.list)
940
+ *
941
+ * @param array $optParams Optional parameters.
942
+ *
943
+ * @opt_param int maxResults The maximum number of saved ad styles to include in the response, used for paging.
944
+ * @opt_param string pageToken A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
945
+ * @return Google_SavedAdStyles
946
+ */
947
+ public function listSavedadstyles($optParams = array()) {
948
+ $params = array();
949
+ $params = array_merge($params, $optParams);
950
+ $data = $this->__call('list', array($params));
951
+ if ($this->useObjects()) {
952
+ return new Google_SavedAdStyles($data);
953
+ } else {
954
+ return $data;
955
+ }
956
+ }
957
+ }
958
+
959
+ /**
960
+ * The "urlchannels" collection of methods.
961
+ * Typical usage is:
962
+ * <code>
963
+ * $adsenseService = new Google_AdSenseService(...);
964
+ * $urlchannels = $adsenseService->urlchannels;
965
+ * </code>
966
+ */
967
+ class Google_UrlchannelsServiceResource extends Google_ServiceResource {
968
+
969
+ /**
970
+ * List all URL channels in the specified ad client for this AdSense account. (urlchannels.list)
971
+ *
972
+ * @param string $adClientId Ad client for which to list URL channels.
973
+ * @param array $optParams Optional parameters.
974
+ *
975
+ * @opt_param int maxResults The maximum number of URL channels to include in the response, used for paging.
976
+ * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
977
+ * @return Google_UrlChannels
978
+ */
979
+ public function listUrlchannels($adClientId, $optParams = array()) {
980
+ $params = array('adClientId' => $adClientId);
981
+ $params = array_merge($params, $optParams);
982
+ $data = $this->__call('list', array($params));
983
+ if ($this->useObjects()) {
984
+ return new Google_UrlChannels($data);
985
+ } else {
986
+ return $data;
987
+ }
988
+ }
989
+ }
990
+
991
+ /**
992
+ * Service definition for Google_AdSense (v1.3).
993
+ *
994
+ * <p>
995
+ * Gives AdSense publishers access to their inventory and the ability to generate reports
996
+ * </p>
997
+ *
998
+ * <p>
999
+ * For more information about this service, see the
1000
+ * <a href="https://developers.google.com/adsense/management/" target="_blank">API Documentation</a>
1001
+ * </p>
1002
+ *
1003
+ * @author Google, Inc.
1004
+ */
1005
+ class Google_AdSenseService extends Google_Service {
1006
+ public $accounts;
1007
+ public $accounts_adclients;
1008
+ public $accounts_adunits;
1009
+ public $accounts_adunits_customchannels;
1010
+ public $accounts_alerts;
1011
+ public $accounts_customchannels;
1012
+ public $accounts_customchannels_adunits;
1013
+ public $accounts_reports;
1014
+ public $accounts_reports_saved;
1015
+ public $accounts_savedadstyles;
1016
+ public $accounts_urlchannels;
1017
+ public $adclients;
1018
+ public $adunits;
1019
+ public $adunits_customchannels;
1020
+ public $alerts;
1021
+ public $customchannels;
1022
+ public $customchannels_adunits;
1023
+ public $metadata_dimensions;
1024
+ public $metadata_metrics;
1025
+ public $reports;
1026
+ public $reports_saved;
1027
+ public $savedadstyles;
1028
+ public $urlchannels;
1029
+ /**
1030
+ * Constructs the internal representation of the AdSense service.
1031
+ *
1032
+ * @param Google_Client $client
1033
+ */
1034
+ public function __construct(Google_Client $client) {
1035
+ $this->servicePath = 'adsense/v1.3/';
1036
+ $this->version = 'v1.3';
1037
+ $this->serviceName = 'adsense';
1038
+
1039
+ $client->addService($this->serviceName, $this->version);
1040
+ $this->accounts = new Google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"get": {"id": "adsense.accounts.get", "path": "accounts/{accountId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "tree": {"type": "boolean", "location": "query"}}, "response": {"$ref": "Account"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.accounts.list", "path": "accounts", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "Accounts"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1041
+ $this->accounts_adclients = new Google_AccountsAdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"id": "adsense.accounts.adclients.list", "path": "accounts/{accountId}/adclients", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdClients"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1042
+ $this->accounts_adunits = new Google_AccountsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"get": {"id": "adsense.accounts.adunits.get", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "getAdCode": {"id": "adsense.accounts.adunits.getAdCode", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdCode"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.accounts.adunits.list", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1043
+ $this->accounts_adunits_customchannels = new Google_AccountsAdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"id": "adsense.accounts.adunits.customchannels.list", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1044
+ $this->accounts_alerts = new Google_AccountsAlertsServiceResource($this, $this->serviceName, 'alerts', json_decode('{"methods": {"list": {"id": "adsense.accounts.alerts.list", "path": "accounts/{accountId}/alerts", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "locale": {"type": "string", "location": "query"}}, "response": {"$ref": "Alerts"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1045
+ $this->accounts_customchannels = new Google_AccountsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"get": {"id": "adsense.accounts.customchannels.get", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.accounts.customchannels.list", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1046
+ $this->accounts_customchannels_adunits = new Google_AccountsCustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"id": "adsense.accounts.customchannels.adunits.list", "path": "accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1047
+ $this->accounts_reports = new Google_AccountsReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"id": "adsense.accounts.reports.generate", "path": "accounts/{accountId}/reports", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "currency": {"type": "string", "location": "query"}, "dimension": {"type": "string", "repeated": true, "location": "query"}, "endDate": {"type": "string", "required": true, "location": "query"}, "filter": {"type": "string", "repeated": true, "location": "query"}, "locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "50000", "location": "query"}, "metric": {"type": "string", "repeated": true, "location": "query"}, "sort": {"type": "string", "repeated": true, "location": "query"}, "startDate": {"type": "string", "required": true, "location": "query"}, "startIndex": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "5000", "location": "query"}, "useTimezoneReporting": {"type": "boolean", "location": "query"}}, "response": {"$ref": "AdsenseReportsGenerateResponse"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "supportsMediaDownload": true}}}', true));
1048
+ $this->accounts_reports_saved = new Google_AccountsReportsSavedServiceResource($this, $this->serviceName, 'saved', json_decode('{"methods": {"generate": {"id": "adsense.accounts.reports.saved.generate", "path": "accounts/{accountId}/reports/{savedReportId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "50000", "location": "query"}, "savedReportId": {"type": "string", "required": true, "location": "path"}, "startIndex": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "5000", "location": "query"}}, "response": {"$ref": "AdsenseReportsGenerateResponse"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.accounts.reports.saved.list", "path": "accounts/{accountId}/reports/saved", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "SavedReports"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1049
+ $this->accounts_savedadstyles = new Google_AccountsSavedadstylesServiceResource($this, $this->serviceName, 'savedadstyles', json_decode('{"methods": {"get": {"id": "adsense.accounts.savedadstyles.get", "path": "accounts/{accountId}/savedadstyles/{savedAdStyleId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "savedAdStyleId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "SavedAdStyle"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.accounts.savedadstyles.list", "path": "accounts/{accountId}/savedadstyles", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "SavedAdStyles"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1050
+ $this->accounts_urlchannels = new Google_AccountsUrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"id": "adsense.accounts.urlchannels.list", "path": "accounts/{accountId}/adclients/{adClientId}/urlchannels", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "UrlChannels"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1051
+ $this->adclients = new Google_AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"list": {"id": "adsense.adclients.list", "path": "adclients", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdClients"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1052
+ $this->adunits = new Google_AdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"get": {"id": "adsense.adunits.get", "path": "adclients/{adClientId}/adunits/{adUnitId}", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "getAdCode": {"id": "adsense.adunits.getAdCode", "path": "adclients/{adClientId}/adunits/{adUnitId}/adcode", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdCode"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.adunits.list", "path": "adclients/{adClientId}/adunits", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1053
+ $this->adunits_customchannels = new Google_AdunitsCustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"list": {"id": "adsense.adunits.customchannels.list", "path": "adclients/{adClientId}/adunits/{adUnitId}/customchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1054
+ $this->alerts = new Google_AlertsServiceResource($this, $this->serviceName, 'alerts', json_decode('{"methods": {"list": {"id": "adsense.alerts.list", "path": "alerts", "httpMethod": "GET", "parameters": {"locale": {"type": "string", "location": "query"}}, "response": {"$ref": "Alerts"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1055
+ $this->customchannels = new Google_CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"get": {"id": "adsense.customchannels.get", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.customchannels.list", "path": "adclients/{adClientId}/customchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1056
+ $this->customchannels_adunits = new Google_CustomchannelsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"list": {"id": "adsense.customchannels.adunits.list", "path": "adclients/{adClientId}/customchannels/{customChannelId}/adunits", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1057
+ $this->metadata_dimensions = new Google_MetadataDimensionsServiceResource($this, $this->serviceName, 'dimensions', json_decode('{"methods": {"list": {"id": "adsense.metadata.dimensions.list", "path": "metadata/dimensions", "httpMethod": "GET", "response": {"$ref": "Metadata"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1058
+ $this->metadata_metrics = new Google_MetadataMetricsServiceResource($this, $this->serviceName, 'metrics', json_decode('{"methods": {"list": {"id": "adsense.metadata.metrics.list", "path": "metadata/metrics", "httpMethod": "GET", "response": {"$ref": "Metadata"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1059
+ $this->reports = new Google_ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"id": "adsense.reports.generate", "path": "reports", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "repeated": true, "location": "query"}, "currency": {"type": "string", "location": "query"}, "dimension": {"type": "string", "repeated": true, "location": "query"}, "endDate": {"type": "string", "required": true, "location": "query"}, "filter": {"type": "string", "repeated": true, "location": "query"}, "locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "50000", "location": "query"}, "metric": {"type": "string", "repeated": true, "location": "query"}, "sort": {"type": "string", "repeated": true, "location": "query"}, "startDate": {"type": "string", "required": true, "location": "query"}, "startIndex": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "5000", "location": "query"}, "useTimezoneReporting": {"type": "boolean", "location": "query"}}, "response": {"$ref": "AdsenseReportsGenerateResponse"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"], "supportsMediaDownload": true}}}', true));
1060
+ $this->reports_saved = new Google_ReportsSavedServiceResource($this, $this->serviceName, 'saved', json_decode('{"methods": {"generate": {"id": "adsense.reports.saved.generate", "path": "reports/{savedReportId}", "httpMethod": "GET", "parameters": {"locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "50000", "location": "query"}, "savedReportId": {"type": "string", "required": true, "location": "path"}, "startIndex": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "5000", "location": "query"}}, "response": {"$ref": "AdsenseReportsGenerateResponse"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.reports.saved.list", "path": "reports/saved", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "100", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "SavedReports"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1061
+ $this->savedadstyles = new Google_SavedadstylesServiceResource($this, $this->serviceName, 'savedadstyles', json_decode('{"methods": {"get": {"id": "adsense.savedadstyles.get", "path": "savedadstyles/{savedAdStyleId}", "httpMethod": "GET", "parameters": {"savedAdStyleId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "SavedAdStyle"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}, "list": {"id": "adsense.savedadstyles.list", "path": "savedadstyles", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "SavedAdStyles"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1062
+ $this->urlchannels = new Google_UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"list": {"id": "adsense.urlchannels.list", "path": "adclients/{adClientId}/urlchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "UrlChannels"}, "scopes": ["https://www.googleapis.com/auth/adsense", "https://www.googleapis.com/auth/adsense.readonly"]}}}', true));
1063
+
1064
+ }
1065
+ }
1066
+
1067
+
1068
+
1069
+ class Google_Account extends Google_Model {
1070
+ public $id;
1071
+ public $kind;
1072
+ public $name;
1073
+ public $premium;
1074
+ protected $__subAccountsType = 'Google_Account';
1075
+ protected $__subAccountsDataType = 'array';
1076
+ public $subAccounts;
1077
+ public function setId( $id) {
1078
+ $this->id = $id;
1079
+ }
1080
+ public function getId() {
1081
+ return $this->id;
1082
+ }
1083
+ public function setKind( $kind) {
1084
+ $this->kind = $kind;
1085
+ }
1086
+ public function getKind() {
1087
+ return $this->kind;
1088
+ }
1089
+ public function setName( $name) {
1090
+ $this->name = $name;
1091
+ }
1092
+ public function getName() {
1093
+ return $this->name;
1094
+ }
1095
+ public function setPremium( $premium) {
1096
+ $this->premium = $premium;
1097
+ }
1098
+ public function getPremium() {
1099
+ return $this->premium;
1100
+ }
1101
+ public function setSubAccounts(/* array(Google_Account) */ $subAccounts) {
1102
+ $this->assertIsArray($subAccounts, 'Google_Account', __METHOD__);
1103
+ $this->subAccounts = $subAccounts;
1104
+ }
1105
+ public function getSubAccounts() {
1106
+ return $this->subAccounts;
1107
+ }
1108
+ }
1109
+
1110
+ class Google_Accounts extends Google_Model {
1111
+ public $etag;
1112
+ protected $__itemsType = 'Google_Account';
1113
+ protected $__itemsDataType = 'array';
1114
+ public $items;
1115
+ public $kind;
1116
+ public $nextPageToken;
1117
+ public function setEtag( $etag) {
1118
+ $this->etag = $etag;
1119
+ }
1120
+ public function getEtag() {
1121
+ return $this->etag;
1122
+ }
1123
+ public function setItems(/* array(Google_Account) */ $items) {
1124
+ $this->assertIsArray($items, 'Google_Account', __METHOD__);
1125
+ $this->items = $items;
1126
+ }
1127
+ public function getItems() {
1128
+ return $this->items;
1129
+ }
1130
+ public function setKind( $kind) {
1131
+ $this->kind = $kind;
1132
+ }
1133
+ public function getKind() {
1134
+ return $this->kind;
1135
+ }
1136
+ public function setNextPageToken( $nextPageToken) {
1137
+ $this->nextPageToken = $nextPageToken;
1138
+ }
1139
+ public function getNextPageToken() {
1140
+ return $this->nextPageToken;
1141
+ }
1142
+ }
1143
+
1144
+ class Google_AdClient extends Google_Model {
1145
+ public $arcOptIn;
1146
+ public $id;
1147
+ public $kind;
1148
+ public $productCode;
1149
+ public $supportsReporting;
1150
+ public function setArcOptIn( $arcOptIn) {
1151
+ $this->arcOptIn = $arcOptIn;
1152
+ }
1153
+ public function getArcOptIn() {
1154
+ return $this->arcOptIn;
1155
+ }
1156
+ public function setId( $id) {
1157
+ $this->id = $id;
1158
+ }
1159
+ public function getId() {
1160
+ return $this->id;
1161
+ }
1162
+ public function setKind( $kind) {
1163
+ $this->kind = $kind;
1164
+ }
1165
+ public function getKind() {
1166
+ return $this->kind;
1167
+ }
1168
+ public function setProductCode( $productCode) {
1169
+ $this->productCode = $productCode;
1170
+ }
1171
+ public function getProductCode() {
1172
+ return $this->productCode;
1173
+ }
1174
+ public function setSupportsReporting( $supportsReporting) {
1175
+ $this->supportsReporting = $supportsReporting;
1176
+ }
1177
+ public function getSupportsReporting() {
1178
+ return $this->supportsReporting;
1179
+ }
1180
+ }
1181
+
1182
+ class Google_AdClients extends Google_Model {
1183
+ public $etag;
1184
+ protected $__itemsType = 'Google_AdClient';
1185
+ protected $__itemsDataType = 'array';
1186
+ public $items;
1187
+ public $kind;
1188
+ public $nextPageToken;
1189
+ public function setEtag( $etag) {
1190
+ $this->etag = $etag;
1191
+ }
1192
+ public function getEtag() {
1193
+ return $this->etag;
1194
+ }
1195
+ public function setItems(/* array(Google_AdClient) */ $items) {
1196
+ $this->assertIsArray($items, 'Google_AdClient', __METHOD__);
1197
+ $this->items = $items;
1198
+ }
1199
+ public function getItems() {
1200
+ return $this->items;
1201
+ }
1202
+ public function setKind( $kind) {
1203
+ $this->kind = $kind;
1204
+ }
1205
+ public function getKind() {
1206
+ return $this->kind;
1207
+ }
1208
+ public function setNextPageToken( $nextPageToken) {
1209
+ $this->nextPageToken = $nextPageToken;
1210
+ }
1211
+ public function getNextPageToken() {
1212
+ return $this->nextPageToken;
1213
+ }
1214
+ }
1215
+
1216
+ class Google_AdCode extends Google_Model {
1217
+ public $adCode;
1218
+ public $kind;
1219
+ public function setAdCode( $adCode) {
1220
+ $this->adCode = $adCode;
1221
+ }
1222
+ public function getAdCode() {
1223
+ return $this->adCode;
1224
+ }
1225
+ public function setKind( $kind) {
1226
+ $this->kind = $kind;
1227
+ }
1228
+ public function getKind() {
1229
+ return $this->kind;
1230
+ }
1231
+ }
1232
+
1233
+ class Google_AdStyle extends Google_Model {
1234
+ protected $__colorsType = 'Google_AdStyleColors';
1235
+ protected $__colorsDataType = '';
1236
+ public $colors;
1237
+ public $corners;
1238
+ protected $__fontType = 'Google_AdStyleFont';
1239
+ protected $__fontDataType = '';
1240
+ public $font;
1241
+ public $kind;
1242
+ public function setColors(Google_AdStyleColors $colors) {
1243
+ $this->colors = $colors;
1244
+ }
1245
+ public function getColors() {
1246
+ return $this->colors;
1247
+ }
1248
+ public function setCorners( $corners) {
1249
+ $this->corners = $corners;
1250
+ }
1251
+ public function getCorners() {
1252
+ return $this->corners;
1253
+ }
1254
+ public function setFont(Google_AdStyleFont $font) {
1255
+ $this->font = $font;
1256
+ }
1257
+ public function getFont() {
1258
+ return $this->font;
1259
+ }
1260
+ public function setKind( $kind) {
1261
+ $this->kind = $kind;
1262
+ }
1263
+ public function getKind() {
1264
+ return $this->kind;
1265
+ }
1266
+ }
1267
+
1268
+ class Google_AdStyleColors extends Google_Model {
1269
+ public $background;
1270
+ public $border;
1271
+ public $text;
1272
+ public $title;
1273
+ public $url;
1274
+ public function setBackground( $background) {
1275
+ $this->background = $background;
1276
+ }
1277
+ public function getBackground() {
1278
+ return $this->background;
1279
+ }
1280
+ public function setBorder( $border) {
1281
+ $this->border = $border;
1282
+ }
1283
+ public function getBorder() {
1284
+ return $this->border;
1285
+ }
1286
+ public function setText( $text) {
1287
+ $this->text = $text;
1288
+ }
1289
+ public function getText() {
1290
+ return $this->text;
1291
+ }
1292
+ public function setTitle( $title) {
1293
+ $this->title = $title;
1294
+ }
1295
+ public function getTitle() {
1296
+ return $this->title;
1297
+ }
1298
+ public function setUrl( $url) {
1299
+ $this->url = $url;
1300
+ }
1301
+ public function getUrl() {
1302
+ return $this->url;
1303
+ }
1304
+ }
1305
+
1306
+ class Google_AdStyleFont extends Google_Model {
1307
+ public $family;
1308
+ public $size;
1309
+ public function setFamily( $family) {
1310
+ $this->family = $family;
1311
+ }
1312
+ public function getFamily() {
1313
+ return $this->family;
1314
+ }
1315
+ public function setSize( $size) {
1316
+ $this->size = $size;
1317
+ }
1318
+ public function getSize() {
1319
+ return $this->size;
1320
+ }
1321
+ }
1322
+
1323
+ class Google_AdUnit extends Google_Model {
1324
+ public $code;
1325
+ protected $__contentAdsSettingsType = 'Google_AdUnitContentAdsSettings';
1326
+ protected $__contentAdsSettingsDataType = '';
1327
+ public $contentAdsSettings;
1328
+ protected $__customStyleType = 'Google_AdStyle';
1329
+ protected $__customStyleDataType = '';
1330
+ public $customStyle;
1331
+ protected $__feedAdsSettingsType = 'Google_AdUnitFeedAdsSettings';
1332
+ protected $__feedAdsSettingsDataType = '';
1333
+ public $feedAdsSettings;
1334
+ public $id;
1335
+ public $kind;
1336
+ protected $__mobileContentAdsSettingsType = 'Google_AdUnitMobileContentAdsSettings';
1337
+ protected $__mobileContentAdsSettingsDataType = '';
1338
+ public $mobileContentAdsSettings;
1339
+ public $name;
1340
+ public $savedStyleId;
1341
+ public $status;
1342
+ public function setCode( $code) {
1343
+ $this->code = $code;
1344
+ }
1345
+ public function getCode() {
1346
+ return $this->code;
1347
+ }
1348
+ public function setContentAdsSettings(Google_AdUnitContentAdsSettings $contentAdsSettings) {
1349
+ $this->contentAdsSettings = $contentAdsSettings;
1350
+ }
1351
+ public function getContentAdsSettings() {
1352
+ return $this->contentAdsSettings;
1353
+ }
1354
+ public function setCustomStyle(Google_AdStyle $customStyle) {
1355
+ $this->customStyle = $customStyle;
1356
+ }
1357
+ public function getCustomStyle() {
1358
+ return $this->customStyle;
1359
+ }
1360
+ public function setFeedAdsSettings(Google_AdUnitFeedAdsSettings $feedAdsSettings) {
1361
+ $this->feedAdsSettings = $feedAdsSettings;
1362
+ }
1363
+ public function getFeedAdsSettings() {
1364
+ return $this->feedAdsSettings;
1365
+ }
1366
+ public function setId( $id) {
1367
+ $this->id = $id;
1368
+ }
1369
+ public function getId() {
1370
+ return $this->id;
1371
+ }
1372
+ public function setKind( $kind) {
1373
+ $this->kind = $kind;
1374
+ }
1375
+ public function getKind() {
1376
+ return $this->kind;
1377
+ }
1378
+ public function setMobileContentAdsSettings(Google_AdUnitMobileContentAdsSettings $mobileContentAdsSettings) {
1379
+ $this->mobileContentAdsSettings = $mobileContentAdsSettings;
1380
+ }
1381
+ public function getMobileContentAdsSettings() {
1382
+ return $this->mobileContentAdsSettings;
1383
+ }
1384
+ public function setName( $name) {
1385
+ $this->name = $name;
1386
+ }
1387
+ public function getName() {
1388
+ return $this->name;
1389
+ }
1390
+ public function setSavedStyleId( $savedStyleId) {
1391
+ $this->savedStyleId = $savedStyleId;
1392
+ }
1393
+ public function getSavedStyleId() {
1394
+ return $this->savedStyleId;
1395
+ }
1396
+ public function setStatus( $status) {
1397
+ $this->status = $status;
1398
+ }
1399
+ public function getStatus() {
1400
+ return $this->status;
1401
+ }
1402
+ }
1403
+
1404
+ class Google_AdUnitContentAdsSettings extends Google_Model {
1405
+ protected $__backupOptionType = 'Google_AdUnitContentAdsSettingsBackupOption';
1406
+ protected $__backupOptionDataType = '';
1407
+ public $backupOption;
1408
+ public $size;
1409
+ public $type;
1410
+ public function setBackupOption(Google_AdUnitContentAdsSettingsBackupOption $backupOption) {
1411
+ $this->backupOption = $backupOption;
1412
+ }
1413
+ public function getBackupOption() {
1414
+ return $this->backupOption;
1415
+ }
1416
+ public function setSize( $size) {
1417
+ $this->size = $size;
1418
+ }
1419
+ public function getSize() {
1420
+ return $this->size;
1421
+ }
1422
+ public function setType( $type) {
1423
+ $this->type = $type;
1424
+ }
1425
+ public function getType() {
1426
+ return $this->type;
1427
+ }
1428
+ }
1429
+
1430
+ class Google_AdUnitContentAdsSettingsBackupOption extends Google_Model {
1431
+ public $color;
1432
+ public $type;
1433
+ public $url;
1434
+ public function setColor( $color) {
1435
+ $this->color = $color;
1436
+ }
1437
+ public function getColor() {
1438
+ return $this->color;
1439
+ }
1440
+ public function setType( $type) {
1441
+ $this->type = $type;
1442
+ }
1443
+ public function getType() {
1444
+ return $this->type;
1445
+ }
1446
+ public function setUrl( $url) {
1447
+ $this->url = $url;
1448
+ }
1449
+ public function getUrl() {
1450
+ return $this->url;
1451
+ }
1452
+ }
1453
+
1454
+ class Google_AdUnitFeedAdsSettings extends Google_Model {
1455
+ public $adPosition;
1456
+ public $frequency;
1457
+ public $minimumWordCount;
1458
+ public $type;
1459
+ public function setAdPosition( $adPosition) {
1460
+ $this->adPosition = $adPosition;
1461
+ }
1462
+ public function getAdPosition() {
1463
+ return $this->adPosition;
1464
+ }
1465
+ public function setFrequency( $frequency) {
1466
+ $this->frequency = $frequency;
1467
+ }
1468
+ public function getFrequency() {
1469
+ return $this->frequency;
1470
+ }
1471
+ public function setMinimumWordCount( $minimumWordCount) {
1472
+ $this->minimumWordCount = $minimumWordCount;
1473
+ }
1474
+ public function getMinimumWordCount() {
1475
+ return $this->minimumWordCount;
1476
+ }
1477
+ public function setType( $type) {
1478
+ $this->type = $type;
1479
+ }
1480
+ public function getType() {
1481
+ return $this->type;
1482
+ }
1483
+ }
1484
+
1485
+ class Google_AdUnitMobileContentAdsSettings extends Google_Model {
1486
+ public $markupLanguage;
1487
+ public $scriptingLanguage;
1488
+ public $size;
1489
+ public $type;
1490
+ public function setMarkupLanguage( $markupLanguage) {
1491
+ $this->markupLanguage = $markupLanguage;
1492
+ }
1493
+ public function getMarkupLanguage() {
1494
+ return $this->markupLanguage;
1495
+ }
1496
+ public function setScriptingLanguage( $scriptingLanguage) {
1497
+ $this->scriptingLanguage = $scriptingLanguage;
1498
+ }
1499
+ public function getScriptingLanguage() {
1500
+ return $this->scriptingLanguage;
1501
+ }
1502
+ public function setSize( $size) {
1503
+ $this->size = $size;
1504
+ }
1505
+ public function getSize() {
1506
+ return $this->size;
1507
+ }
1508
+ public function setType( $type) {
1509
+ $this->type = $type;
1510
+ }
1511
+ public function getType() {
1512
+ return $this->type;
1513
+ }
1514
+ }
1515
+
1516
+ class Google_AdUnits extends Google_Model {
1517
+ public $etag;
1518
+ protected $__itemsType = 'Google_AdUnit';
1519
+ protected $__itemsDataType = 'array';
1520
+ public $items;
1521
+ public $kind;
1522
+ public $nextPageToken;
1523
+ public function setEtag( $etag) {
1524
+ $this->etag = $etag;
1525
+ }
1526
+ public function getEtag() {
1527
+ return $this->etag;
1528
+ }
1529
+ public function setItems(/* array(Google_AdUnit) */ $items) {
1530
+ $this->assertIsArray($items, 'Google_AdUnit', __METHOD__);
1531
+ $this->items = $items;
1532
+ }
1533
+ public function getItems() {
1534
+ return $this->items;
1535
+ }
1536
+ public function setKind( $kind) {
1537
+ $this->kind = $kind;
1538
+ }
1539
+ public function getKind() {
1540
+ return $this->kind;
1541
+ }
1542
+ public function setNextPageToken( $nextPageToken) {
1543
+ $this->nextPageToken = $nextPageToken;
1544
+ }
1545
+ public function getNextPageToken() {
1546
+ return $this->nextPageToken;
1547
+ }
1548
+ }
1549
+
1550
+ class Google_AdsenseReportsGenerateResponse extends Google_Model {
1551
+ public $averages;
1552
+ protected $__headersType = 'Google_AdsenseReportsGenerateResponseHeaders';
1553
+ protected $__headersDataType = 'array';
1554
+ public $headers;
1555
+ public $kind;
1556
+ public $rows;
1557
+ public $totalMatchedRows;
1558
+ public $totals;
1559
+ public $warnings;
1560
+ public function setAverages(/* array(Google_string) */ $averages) {
1561
+ $this->assertIsArray($averages, 'Google_string', __METHOD__);
1562
+ $this->averages = $averages;
1563
+ }
1564
+ public function getAverages() {
1565
+ return $this->averages;
1566
+ }
1567
+ public function setHeaders(/* array(Google_AdsenseReportsGenerateResponseHeaders) */ $headers) {
1568
+ $this->assertIsArray($headers, 'Google_AdsenseReportsGenerateResponseHeaders', __METHOD__);
1569
+ $this->headers = $headers;
1570
+ }
1571
+ public function getHeaders() {
1572
+ return $this->headers;
1573
+ }
1574
+ public function setKind( $kind) {
1575
+ $this->kind = $kind;
1576
+ }
1577
+ public function getKind() {
1578
+ return $this->kind;
1579
+ }
1580
+ public function setRows(/* array(Google_string) */ $rows) {
1581
+ $this->assertIsArray($rows, 'Google_string', __METHOD__);
1582
+ $this->rows = $rows;
1583
+ }
1584
+ public function getRows() {
1585
+ return $this->rows;
1586
+ }
1587
+ public function setTotalMatchedRows( $totalMatchedRows) {
1588
+ $this->totalMatchedRows = $totalMatchedRows;
1589
+ }
1590
+ public function getTotalMatchedRows() {
1591
+ return $this->totalMatchedRows;
1592
+ }
1593
+ public function setTotals(/* array(Google_string) */ $totals) {
1594
+ $this->assertIsArray($totals, 'Google_string', __METHOD__);
1595
+ $this->totals = $totals;
1596
+ }
1597
+ public function getTotals() {
1598
+ return $this->totals;
1599
+ }
1600
+ public function setWarnings(/* array(Google_string) */ $warnings) {
1601
+ $this->assertIsArray($warnings, 'Google_string', __METHOD__);
1602
+ $this->warnings = $warnings;
1603
+ }
1604
+ public function getWarnings() {
1605
+ return $this->warnings;
1606
+ }
1607
+ }
1608
+
1609
+ class Google_AdsenseReportsGenerateResponseHeaders extends Google_Model {
1610
+ public $currency;
1611
+ public $name;
1612
+ public $type;
1613
+ public function setCurrency( $currency) {
1614
+ $this->currency = $currency;
1615
+ }
1616
+ public function getCurrency() {
1617
+ return $this->currency;
1618
+ }
1619
+ public function setName( $name) {
1620
+ $this->name = $name;
1621
+ }
1622
+ public function getName() {
1623
+ return $this->name;
1624
+ }
1625
+ public function setType( $type) {
1626
+ $this->type = $type;
1627
+ }
1628
+ public function getType() {
1629
+ return $this->type;
1630
+ }
1631
+ }
1632
+
1633
+ class Google_Alert extends Google_Model {
1634
+ public $id;
1635
+ public $kind;
1636
+ public $message;
1637
+ public $severity;
1638
+ public $type;
1639
+ public function setId( $id) {
1640
+ $this->id = $id;
1641
+ }
1642
+ public function getId() {
1643
+ return $this->id;
1644
+ }
1645
+ public function setKind( $kind) {
1646
+ $this->kind = $kind;
1647
+ }
1648
+ public function getKind() {
1649
+ return $this->kind;
1650
+ }
1651
+ public function setMessage( $message) {
1652
+ $this->message = $message;
1653
+ }
1654
+ public function getMessage() {
1655
+ return $this->message;
1656
+ }
1657
+ public function setSeverity( $severity) {
1658
+ $this->severity = $severity;
1659
+ }
1660
+ public function getSeverity() {
1661
+ return $this->severity;
1662
+ }
1663
+ public function setType( $type) {
1664
+ $this->type = $type;
1665
+ }
1666
+ public function getType() {
1667
+ return $this->type;
1668
+ }
1669
+ }
1670
+
1671
+ class Google_Alerts extends Google_Model {
1672
+ protected $__itemsType = 'Google_Alert';
1673
+ protected $__itemsDataType = 'array';
1674
+ public $items;
1675
+ public $kind;
1676
+ public function setItems(/* array(Google_Alert) */ $items) {
1677
+ $this->assertIsArray($items, 'Google_Alert', __METHOD__);
1678
+ $this->items = $items;
1679
+ }
1680
+ public function getItems() {
1681
+ return $this->items;
1682
+ }
1683
+ public function setKind( $kind) {
1684
+ $this->kind = $kind;
1685
+ }
1686
+ public function getKind() {
1687
+ return $this->kind;
1688
+ }
1689
+ }
1690
+
1691
+ class Google_CustomChannel extends Google_Model {
1692
+ public $code;
1693
+ public $id;
1694
+ public $kind;
1695
+ public $name;
1696
+ protected $__targetingInfoType = 'Google_CustomChannelTargetingInfo';
1697
+ protected $__targetingInfoDataType = '';
1698
+ public $targetingInfo;
1699
+ public function setCode( $code) {
1700
+ $this->code = $code;
1701
+ }
1702
+ public function getCode() {
1703
+ return $this->code;
1704
+ }
1705
+ public function setId( $id) {
1706
+ $this->id = $id;
1707
+ }
1708
+ public function getId() {
1709
+ return $this->id;
1710
+ }
1711
+ public function setKind( $kind) {
1712
+ $this->kind = $kind;
1713
+ }
1714
+ public function getKind() {
1715
+ return $this->kind;
1716
+ }
1717
+ public function setName( $name) {
1718
+ $this->name = $name;
1719
+ }
1720
+ public function getName() {
1721
+ return $this->name;
1722
+ }
1723
+ public function setTargetingInfo(Google_CustomChannelTargetingInfo $targetingInfo) {
1724
+ $this->targetingInfo = $targetingInfo;
1725
+ }
1726
+ public function getTargetingInfo() {
1727
+ return $this->targetingInfo;
1728
+ }
1729
+ }
1730
+
1731
+ class Google_CustomChannelTargetingInfo extends Google_Model {
1732
+ public $adsAppearOn;
1733
+ public $description;
1734
+ public $location;
1735
+ public $siteLanguage;
1736
+ public function setAdsAppearOn( $adsAppearOn) {
1737
+ $this->adsAppearOn = $adsAppearOn;
1738
+ }
1739
+ public function getAdsAppearOn() {
1740
+ return $this->adsAppearOn;
1741
+ }
1742
+ public function setDescription( $description) {
1743
+ $this->description = $description;
1744
+ }
1745
+ public function getDescription() {
1746
+ return $this->description;
1747
+ }
1748
+ public function setLocation( $location) {
1749
+ $this->location = $location;
1750
+ }
1751
+ public function getLocation() {
1752
+ return $this->location;
1753
+ }
1754
+ public function setSiteLanguage( $siteLanguage) {
1755
+ $this->siteLanguage = $siteLanguage;
1756
+ }
1757
+ public function getSiteLanguage() {
1758
+ return $this->siteLanguage;
1759
+ }
1760
+ }
1761
+
1762
+ class Google_CustomChannels extends Google_Model {
1763
+ public $etag;
1764
+ protected $__itemsType = 'Google_CustomChannel';
1765
+ protected $__itemsDataType = 'array';
1766
+ public $items;
1767
+ public $kind;
1768
+ public $nextPageToken;
1769
+ public function setEtag( $etag) {
1770
+ $this->etag = $etag;
1771
+ }
1772
+ public function getEtag() {
1773
+ return $this->etag;
1774
+ }
1775
+ public function setItems(/* array(Google_CustomChannel) */ $items) {
1776
+ $this->assertIsArray($items, 'Google_CustomChannel', __METHOD__);
1777
+ $this->items = $items;
1778
+ }
1779
+ public function getItems() {
1780
+ return $this->items;
1781
+ }
1782
+ public function setKind( $kind) {
1783
+ $this->kind = $kind;
1784
+ }
1785
+ public function getKind() {
1786
+ return $this->kind;
1787
+ }
1788
+ public function setNextPageToken( $nextPageToken) {
1789
+ $this->nextPageToken = $nextPageToken;
1790
+ }
1791
+ public function getNextPageToken() {
1792
+ return $this->nextPageToken;
1793
+ }
1794
+ }
1795
+
1796
+ class Google_Metadata extends Google_Model {
1797
+ protected $__itemsType = 'Google_ReportingMetadataEntry';
1798
+ protected $__itemsDataType = 'array';
1799
+ public $items;
1800
+ public $kind;
1801
+ public function setItems(/* array(Google_ReportingMetadataEntry) */ $items) {
1802
+ $this->assertIsArray($items, 'Google_ReportingMetadataEntry', __METHOD__);
1803
+ $this->items = $items;
1804
+ }
1805
+ public function getItems() {
1806
+ return $this->items;
1807
+ }
1808
+ public function setKind( $kind) {
1809
+ $this->kind = $kind;
1810
+ }
1811
+ public function getKind() {
1812
+ return $this->kind;
1813
+ }
1814
+ }
1815
+
1816
+ class Google_ReportingMetadataEntry extends Google_Model {
1817
+ public $compatibleDimensions;
1818
+ public $compatibleMetrics;
1819
+ public $id;
1820
+ public $kind;
1821
+ public $requiredDimensions;
1822
+ public $requiredMetrics;
1823
+ public $supportedProducts;
1824
+ public function setCompatibleDimensions(/* array(Google_string) */ $compatibleDimensions) {
1825
+ $this->assertIsArray($compatibleDimensions, 'Google_string', __METHOD__);
1826
+ $this->compatibleDimensions = $compatibleDimensions;
1827
+ }
1828
+ public function getCompatibleDimensions() {
1829
+ return $this->compatibleDimensions;
1830
+ }
1831
+ public function setCompatibleMetrics(/* array(Google_string) */ $compatibleMetrics) {
1832
+ $this->assertIsArray($compatibleMetrics, 'Google_string', __METHOD__);
1833
+ $this->compatibleMetrics = $compatibleMetrics;
1834
+ }
1835
+ public function getCompatibleMetrics() {
1836
+ return $this->compatibleMetrics;
1837
+ }
1838
+ public function setId( $id) {
1839
+ $this->id = $id;
1840
+ }
1841
+ public function getId() {
1842
+ return $this->id;
1843
+ }
1844
+ public function setKind( $kind) {
1845
+ $this->kind = $kind;
1846
+ }
1847
+ public function getKind() {
1848
+ return $this->kind;
1849
+ }
1850
+ public function setRequiredDimensions(/* array(Google_string) */ $requiredDimensions) {
1851
+ $this->assertIsArray($requiredDimensions, 'Google_string', __METHOD__);
1852
+ $this->requiredDimensions = $requiredDimensions;
1853
+ }
1854
+ public function getRequiredDimensions() {
1855
+ return $this->requiredDimensions;
1856
+ }
1857
+ public function setRequiredMetrics(/* array(Google_string) */ $requiredMetrics) {
1858
+ $this->assertIsArray($requiredMetrics, 'Google_string', __METHOD__);
1859
+ $this->requiredMetrics = $requiredMetrics;
1860
+ }
1861
+ public function getRequiredMetrics() {
1862
+ return $this->requiredMetrics;
1863
+ }
1864
+ public function setSupportedProducts(/* array(Google_string) */ $supportedProducts) {
1865
+ $this->assertIsArray($supportedProducts, 'Google_string', __METHOD__);
1866
+ $this->supportedProducts = $supportedProducts;
1867
+ }
1868
+ public function getSupportedProducts() {
1869
+ return $this->supportedProducts;
1870
+ }
1871
+ }
1872
+
1873
+ class Google_SavedAdStyle extends Google_Model {
1874
+ protected $__adStyleType = 'Google_AdStyle';
1875
+ protected $__adStyleDataType = '';
1876
+ public $adStyle;
1877
+ public $id;
1878
+ public $kind;
1879
+ public $name;
1880
+ public function setAdStyle(Google_AdStyle $adStyle) {
1881
+ $this->adStyle = $adStyle;
1882
+ }
1883
+ public function getAdStyle() {
1884
+ return $this->adStyle;
1885
+ }
1886
+ public function setId( $id) {
1887
+ $this->id = $id;
1888
+ }
1889
+ public function getId() {
1890
+ return $this->id;
1891
+ }
1892
+ public function setKind( $kind) {
1893
+ $this->kind = $kind;
1894
+ }
1895
+ public function getKind() {
1896
+ return $this->kind;
1897
+ }
1898
+ public function setName( $name) {
1899
+ $this->name = $name;
1900
+ }
1901
+ public function getName() {
1902
+ return $this->name;
1903
+ }
1904
+ }
1905
+
1906
+ class Google_SavedAdStyles extends Google_Model {
1907
+ public $etag;
1908
+ protected $__itemsType = 'Google_SavedAdStyle';
1909
+ protected $__itemsDataType = 'array';
1910
+ public $items;
1911
+ public $kind;
1912
+ public $nextPageToken;
1913
+ public function setEtag( $etag) {
1914
+ $this->etag = $etag;
1915
+ }
1916
+ public function getEtag() {
1917
+ return $this->etag;
1918
+ }
1919
+ public function setItems(/* array(Google_SavedAdStyle) */ $items) {
1920
+ $this->assertIsArray($items, 'Google_SavedAdStyle', __METHOD__);
1921
+ $this->items = $items;
1922
+ }
1923
+ public function getItems() {
1924
+ return $this->items;
1925
+ }
1926
+ public function setKind( $kind) {
1927
+ $this->kind = $kind;
1928
+ }
1929
+ public function getKind() {
1930
+ return $this->kind;
1931
+ }
1932
+ public function setNextPageToken( $nextPageToken) {
1933
+ $this->nextPageToken = $nextPageToken;
1934
+ }
1935
+ public function getNextPageToken() {
1936
+ return $this->nextPageToken;
1937
+ }
1938
+ }
1939
+
1940
+ class Google_SavedReport extends Google_Model {
1941
+ public $id;
1942
+ public $kind;
1943
+ public $name;
1944
+ public function setId( $id) {
1945
+ $this->id = $id;
1946
+ }
1947
+ public function getId() {
1948
+ return $this->id;
1949
+ }
1950
+ public function setKind( $kind) {
1951
+ $this->kind = $kind;
1952
+ }
1953
+ public function getKind() {
1954
+ return $this->kind;
1955
+ }
1956
+ public function setName( $name) {
1957
+ $this->name = $name;
1958
+ }
1959
+ public function getName() {
1960
+ return $this->name;
1961
+ }
1962
+ }
1963
+
1964
+ class Google_SavedReports extends Google_Model {
1965
+ public $etag;
1966
+ protected $__itemsType = 'Google_SavedReport';
1967
+ protected $__itemsDataType = 'array';
1968
+ public $items;
1969
+ public $kind;
1970
+ public $nextPageToken;
1971
+ public function setEtag( $etag) {
1972
+ $this->etag = $etag;
1973
+ }
1974
+ public function getEtag() {
1975
+ return $this->etag;
1976
+ }
1977
+ public function setItems(/* array(Google_SavedReport) */ $items) {
1978
+ $this->assertIsArray($items, 'Google_SavedReport', __METHOD__);
1979
+ $this->items = $items;
1980
+ }
1981
+ public function getItems() {
1982
+ return $this->items;
1983
+ }
1984
+ public function setKind( $kind) {
1985
+ $this->kind = $kind;
1986
+ }
1987
+ public function getKind() {
1988
+ return $this->kind;
1989
+ }
1990
+ public function setNextPageToken( $nextPageToken) {
1991
+ $this->nextPageToken = $nextPageToken;
1992
+ }
1993
+ public function getNextPageToken() {
1994
+ return $this->nextPageToken;
1995
+ }
1996
+ }
1997
+
1998
+ class Google_UrlChannel extends Google_Model {
1999
+ public $id;
2000
+ public $kind;
2001
+ public $urlPattern;
2002
+ public function setId( $id) {
2003
+ $this->id = $id;
2004
+ }
2005
+ public function getId() {
2006
+ return $this->id;
2007
+ }
2008
+ public function setKind( $kind) {
2009
+ $this->kind = $kind;
2010
+ }
2011
+ public function getKind() {
2012
+ return $this->kind;
2013
+ }
2014
+ public function setUrlPattern( $urlPattern) {
2015
+ $this->urlPattern = $urlPattern;
2016
+ }
2017
+ public function getUrlPattern() {
2018
+ return $this->urlPattern;
2019
+ }
2020
+ }
2021
+
2022
+ class Google_UrlChannels extends Google_Model {
2023
+ public $etag;
2024
+ protected $__itemsType = 'Google_UrlChannel';
2025
+ protected $__itemsDataType = 'array';
2026
+ public $items;
2027
+ public $kind;
2028
+ public $nextPageToken;
2029
+ public function setEtag( $etag) {
2030
+ $this->etag = $etag;
2031
+ }
2032
+ public function getEtag() {
2033
+ return $this->etag;
2034
+ }
2035
+ public function setItems(/* array(Google_UrlChannel) */ $items) {
2036
+ $this->assertIsArray($items, 'Google_UrlChannel', __METHOD__);
2037
+ $this->items = $items;
2038
+ }
2039
+ public function getItems() {
2040
+ return $this->items;
2041
+ }
2042
+ public function setKind( $kind) {
2043
+ $this->kind = $kind;
2044
+ }
2045
+ public function getKind() {
2046
+ return $this->kind;
2047
+ }
2048
+ public function setNextPageToken( $nextPageToken) {
2049
+ $this->nextPageToken = $nextPageToken;
2050
+ }
2051
+ public function getNextPageToken() {
2052
+ return $this->nextPageToken;
2053
+ }
2054
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdexchangebuyerService.php ADDED
@@ -0,0 +1,867 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "accounts" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $adexchangebuyerService = new Google_AdexchangebuyerService(...);
22
+ * $accounts = $adexchangebuyerService->accounts;
23
+ * </code>
24
+ */
25
+ class Google_AccountsServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Gets one account by ID. (accounts.get)
29
+ *
30
+ * @param int $id The account id
31
+ * @param array $optParams Optional parameters.
32
+ * @return Google_Account
33
+ */
34
+ public function get($id, $optParams = array()) {
35
+ $params = array('id' => $id);
36
+ $params = array_merge($params, $optParams);
37
+ $data = $this->__call('get', array($params));
38
+ if ($this->useObjects()) {
39
+ return new Google_Account($data);
40
+ } else {
41
+ return $data;
42
+ }
43
+ }
44
+ /**
45
+ * Retrieves the authenticated user's list of accounts. (accounts.list)
46
+ *
47
+ * @param array $optParams Optional parameters.
48
+ * @return Google_AccountsList
49
+ */
50
+ public function listAccounts($optParams = array()) {
51
+ $params = array();
52
+ $params = array_merge($params, $optParams);
53
+ $data = $this->__call('list', array($params));
54
+ if ($this->useObjects()) {
55
+ return new Google_AccountsList($data);
56
+ } else {
57
+ return $data;
58
+ }
59
+ }
60
+ /**
61
+ * Updates an existing account. This method supports patch semantics.
62
+ * (accounts.patch)
63
+ *
64
+ * @param int $id The account id
65
+ * @param Google_Account $postBody
66
+ * @param array $optParams Optional parameters.
67
+ * @return Google_Account
68
+ */
69
+ public function patch($id, Google_Account $postBody, $optParams = array()) {
70
+ $params = array('id' => $id, 'postBody' => $postBody);
71
+ $params = array_merge($params, $optParams);
72
+ $data = $this->__call('patch', array($params));
73
+ if ($this->useObjects()) {
74
+ return new Google_Account($data);
75
+ } else {
76
+ return $data;
77
+ }
78
+ }
79
+ /**
80
+ * Updates an existing account. (accounts.update)
81
+ *
82
+ * @param int $id The account id
83
+ * @param Google_Account $postBody
84
+ * @param array $optParams Optional parameters.
85
+ * @return Google_Account
86
+ */
87
+ public function update($id, Google_Account $postBody, $optParams = array()) {
88
+ $params = array('id' => $id, 'postBody' => $postBody);
89
+ $params = array_merge($params, $optParams);
90
+ $data = $this->__call('update', array($params));
91
+ if ($this->useObjects()) {
92
+ return new Google_Account($data);
93
+ } else {
94
+ return $data;
95
+ }
96
+ }
97
+ }
98
+
99
+ /**
100
+ * The "creatives" collection of methods.
101
+ * Typical usage is:
102
+ * <code>
103
+ * $adexchangebuyerService = new Google_AdexchangebuyerService(...);
104
+ * $creatives = $adexchangebuyerService->creatives;
105
+ * </code>
106
+ */
107
+ class Google_CreativesServiceResource extends Google_ServiceResource {
108
+
109
+ /**
110
+ * Gets the status for a single creative. (creatives.get)
111
+ *
112
+ * @param int $accountId The id for the account that will serve this creative.
113
+ * @param string $buyerCreativeId The buyer-specific id for this creative.
114
+ * @param array $optParams Optional parameters.
115
+ * @return Google_Creative
116
+ */
117
+ public function get($accountId, $buyerCreativeId, $optParams = array()) {
118
+ $params = array('accountId' => $accountId, 'buyerCreativeId' => $buyerCreativeId);
119
+ $params = array_merge($params, $optParams);
120
+ $data = $this->__call('get', array($params));
121
+ if ($this->useObjects()) {
122
+ return new Google_Creative($data);
123
+ } else {
124
+ return $data;
125
+ }
126
+ }
127
+ /**
128
+ * Submit a new creative. (creatives.insert)
129
+ *
130
+ * @param Google_Creative $postBody
131
+ * @param array $optParams Optional parameters.
132
+ * @return Google_Creative
133
+ */
134
+ public function insert(Google_Creative $postBody, $optParams = array()) {
135
+ $params = array('postBody' => $postBody);
136
+ $params = array_merge($params, $optParams);
137
+ $data = $this->__call('insert', array($params));
138
+ if ($this->useObjects()) {
139
+ return new Google_Creative($data);
140
+ } else {
141
+ return $data;
142
+ }
143
+ }
144
+ /**
145
+ * Retrieves a list of the authenticated user's active creatives.
146
+ * (creatives.list)
147
+ *
148
+ * @param array $optParams Optional parameters.
149
+ *
150
+ * @opt_param string maxResults Maximum number of entries returned on one result page. If not set, the default is 100. Optional.
151
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. Optional.
152
+ * @opt_param string statusFilter When specified, only creatives having the given status are returned.
153
+ * @return Google_CreativesList
154
+ */
155
+ public function listCreatives($optParams = array()) {
156
+ $params = array();
157
+ $params = array_merge($params, $optParams);
158
+ $data = $this->__call('list', array($params));
159
+ if ($this->useObjects()) {
160
+ return new Google_CreativesList($data);
161
+ } else {
162
+ return $data;
163
+ }
164
+ }
165
+ }
166
+
167
+ /**
168
+ * The "directDeals" collection of methods.
169
+ * Typical usage is:
170
+ * <code>
171
+ * $adexchangebuyerService = new Google_AdexchangebuyerService(...);
172
+ * $directDeals = $adexchangebuyerService->directDeals;
173
+ * </code>
174
+ */
175
+ class Google_DirectDealsServiceResource extends Google_ServiceResource {
176
+
177
+ /**
178
+ * Gets one direct deal by ID. (directDeals.get)
179
+ *
180
+ * @param string $id The direct deal id
181
+ * @param array $optParams Optional parameters.
182
+ * @return Google_DirectDeal
183
+ */
184
+ public function get($id, $optParams = array()) {
185
+ $params = array('id' => $id);
186
+ $params = array_merge($params, $optParams);
187
+ $data = $this->__call('get', array($params));
188
+ if ($this->useObjects()) {
189
+ return new Google_DirectDeal($data);
190
+ } else {
191
+ return $data;
192
+ }
193
+ }
194
+ /**
195
+ * Retrieves the authenticated user's list of direct deals. (directDeals.list)
196
+ *
197
+ * @param array $optParams Optional parameters.
198
+ * @return Google_DirectDealsList
199
+ */
200
+ public function listDirectDeals($optParams = array()) {
201
+ $params = array();
202
+ $params = array_merge($params, $optParams);
203
+ $data = $this->__call('list', array($params));
204
+ if ($this->useObjects()) {
205
+ return new Google_DirectDealsList($data);
206
+ } else {
207
+ return $data;
208
+ }
209
+ }
210
+ }
211
+
212
+ /**
213
+ * The "performanceReport" collection of methods.
214
+ * Typical usage is:
215
+ * <code>
216
+ * $adexchangebuyerService = new Google_AdexchangebuyerService(...);
217
+ * $performanceReport = $adexchangebuyerService->performanceReport;
218
+ * </code>
219
+ */
220
+ class Google_PerformanceReportServiceResource extends Google_ServiceResource {
221
+
222
+ /**
223
+ * Retrieves the authenticated user's list of performance metrics.
224
+ * (performanceReport.list)
225
+ *
226
+ * @param string $accountId The account id to get the reports.
227
+ * @param string $endDateTime The end time of the report in ISO 8601 timestamp format using UTC.
228
+ * @param string $startDateTime The start time of the report in ISO 8601 timestamp format using UTC.
229
+ * @param array $optParams Optional parameters.
230
+ *
231
+ * @opt_param string maxResults Maximum number of entries returned on one result page. If not set, the default is 100. Optional.
232
+ * @opt_param string pageToken A continuation token, used to page through performance reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response. Optional.
233
+ * @return Google_PerformanceReportList
234
+ */
235
+ public function listPerformanceReport($accountId, $endDateTime, $startDateTime, $optParams = array()) {
236
+ $params = array('accountId' => $accountId, 'endDateTime' => $endDateTime, 'startDateTime' => $startDateTime);
237
+ $params = array_merge($params, $optParams);
238
+ $data = $this->__call('list', array($params));
239
+ if ($this->useObjects()) {
240
+ return new Google_PerformanceReportList($data);
241
+ } else {
242
+ return $data;
243
+ }
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Service definition for Google_Adexchangebuyer (v1.3).
249
+ *
250
+ * <p>
251
+ * Lets you manage your Ad Exchange Buyer account.
252
+ * </p>
253
+ *
254
+ * <p>
255
+ * For more information about this service, see the
256
+ * <a href="https://developers.google.com/ad-exchange/buyer-rest" target="_blank">API Documentation</a>
257
+ * </p>
258
+ *
259
+ * @author Google, Inc.
260
+ */
261
+ class Google_AdexchangebuyerService extends Google_Service {
262
+ public $accounts;
263
+ public $creatives;
264
+ public $directDeals;
265
+ public $performanceReport;
266
+ /**
267
+ * Constructs the internal representation of the Adexchangebuyer service.
268
+ *
269
+ * @param Google_Client $client
270
+ */
271
+ public function __construct(Google_Client $client) {
272
+ $this->servicePath = 'adexchangebuyer/v1.3/';
273
+ $this->version = 'v1.3';
274
+ $this->serviceName = 'adexchangebuyer';
275
+
276
+ $client->addService($this->serviceName, $this->version);
277
+ $this->accounts = new Google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"get": {"id": "adexchangebuyer.accounts.get", "path": "accounts/{id}", "httpMethod": "GET", "parameters": {"id": {"type": "integer", "required": true, "format": "int32", "location": "path"}}, "response": {"$ref": "Account"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}, "list": {"id": "adexchangebuyer.accounts.list", "path": "accounts", "httpMethod": "GET", "response": {"$ref": "AccountsList"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}, "patch": {"id": "adexchangebuyer.accounts.patch", "path": "accounts/{id}", "httpMethod": "PATCH", "parameters": {"id": {"type": "integer", "required": true, "format": "int32", "location": "path"}}, "request": {"$ref": "Account"}, "response": {"$ref": "Account"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}, "update": {"id": "adexchangebuyer.accounts.update", "path": "accounts/{id}", "httpMethod": "PUT", "parameters": {"id": {"type": "integer", "required": true, "format": "int32", "location": "path"}}, "request": {"$ref": "Account"}, "response": {"$ref": "Account"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}}}', true));
278
+ $this->creatives = new Google_CreativesServiceResource($this, $this->serviceName, 'creatives', json_decode('{"methods": {"get": {"id": "adexchangebuyer.creatives.get", "path": "creatives/{accountId}/{buyerCreativeId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "integer", "required": true, "format": "int32", "location": "path"}, "buyerCreativeId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Creative"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}, "insert": {"id": "adexchangebuyer.creatives.insert", "path": "creatives", "httpMethod": "POST", "request": {"$ref": "Creative"}, "response": {"$ref": "Creative"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}, "list": {"id": "adexchangebuyer.creatives.list", "path": "creatives", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "uint32", "minimum": "1", "maximum": "1000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "statusFilter": {"type": "string", "enum": ["approved", "disapproved", "not_checked"], "location": "query"}}, "response": {"$ref": "CreativesList"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}}}', true));
279
+ $this->directDeals = new Google_DirectDealsServiceResource($this, $this->serviceName, 'directDeals', json_decode('{"methods": {"get": {"id": "adexchangebuyer.directDeals.get", "path": "directdeals/{id}", "httpMethod": "GET", "parameters": {"id": {"type": "string", "required": true, "format": "int64", "location": "path"}}, "response": {"$ref": "DirectDeal"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}, "list": {"id": "adexchangebuyer.directDeals.list", "path": "directdeals", "httpMethod": "GET", "response": {"$ref": "DirectDealsList"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}}}', true));
280
+ $this->performanceReport = new Google_PerformanceReportServiceResource($this, $this->serviceName, 'performanceReport', json_decode('{"methods": {"list": {"id": "adexchangebuyer.performanceReport.list", "path": "performancereport", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "format": "int64", "location": "query"}, "endDateTime": {"type": "string", "required": true, "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "1", "maximum": "1000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "startDateTime": {"type": "string", "required": true, "location": "query"}}, "response": {"$ref": "PerformanceReportList"}, "scopes": ["https://www.googleapis.com/auth/adexchange.buyer"]}}}', true));
281
+
282
+ }
283
+ }
284
+
285
+
286
+
287
+ class Google_Account extends Google_Model {
288
+ protected $__bidderLocationType = 'Google_AccountBidderLocation';
289
+ protected $__bidderLocationDataType = 'array';
290
+ public $bidderLocation;
291
+ public $cookieMatchingNid;
292
+ public $cookieMatchingUrl;
293
+ public $id;
294
+ public $kind;
295
+ public $maximumTotalQps;
296
+ public function setBidderLocation(/* array(Google_AccountBidderLocation) */ $bidderLocation) {
297
+ $this->assertIsArray($bidderLocation, 'Google_AccountBidderLocation', __METHOD__);
298
+ $this->bidderLocation = $bidderLocation;
299
+ }
300
+ public function getBidderLocation() {
301
+ return $this->bidderLocation;
302
+ }
303
+ public function setCookieMatchingNid( $cookieMatchingNid) {
304
+ $this->cookieMatchingNid = $cookieMatchingNid;
305
+ }
306
+ public function getCookieMatchingNid() {
307
+ return $this->cookieMatchingNid;
308
+ }
309
+ public function setCookieMatchingUrl( $cookieMatchingUrl) {
310
+ $this->cookieMatchingUrl = $cookieMatchingUrl;
311
+ }
312
+ public function getCookieMatchingUrl() {
313
+ return $this->cookieMatchingUrl;
314
+ }
315
+ public function setId( $id) {
316
+ $this->id = $id;
317
+ }
318
+ public function getId() {
319
+ return $this->id;
320
+ }
321
+ public function setKind( $kind) {
322
+ $this->kind = $kind;
323
+ }
324
+ public function getKind() {
325
+ return $this->kind;
326
+ }
327
+ public function setMaximumTotalQps( $maximumTotalQps) {
328
+ $this->maximumTotalQps = $maximumTotalQps;
329
+ }
330
+ public function getMaximumTotalQps() {
331
+ return $this->maximumTotalQps;
332
+ }
333
+ }
334
+
335
+ class Google_AccountBidderLocation extends Google_Model {
336
+ public $maximumQps;
337
+ public $region;
338
+ public $url;
339
+ public function setMaximumQps( $maximumQps) {
340
+ $this->maximumQps = $maximumQps;
341
+ }
342
+ public function getMaximumQps() {
343
+ return $this->maximumQps;
344
+ }
345
+ public function setRegion( $region) {
346
+ $this->region = $region;
347
+ }
348
+ public function getRegion() {
349
+ return $this->region;
350
+ }
351
+ public function setUrl( $url) {
352
+ $this->url = $url;
353
+ }
354
+ public function getUrl() {
355
+ return $this->url;
356
+ }
357
+ }
358
+
359
+ class Google_AccountsList extends Google_Model {
360
+ protected $__itemsType = 'Google_Account';
361
+ protected $__itemsDataType = 'array';
362
+ public $items;
363
+ public $kind;
364
+ public function setItems(/* array(Google_Account) */ $items) {
365
+ $this->assertIsArray($items, 'Google_Account', __METHOD__);
366
+ $this->items = $items;
367
+ }
368
+ public function getItems() {
369
+ return $this->items;
370
+ }
371
+ public function setKind( $kind) {
372
+ $this->kind = $kind;
373
+ }
374
+ public function getKind() {
375
+ return $this->kind;
376
+ }
377
+ }
378
+
379
+ class Google_Creative extends Google_Model {
380
+ public $HTMLSnippet;
381
+ public $accountId;
382
+ public $advertiserId;
383
+ public $advertiserName;
384
+ public $agencyId;
385
+ public $attribute;
386
+ public $buyerCreativeId;
387
+ public $clickThroughUrl;
388
+ protected $__correctionsType = 'Google_CreativeCorrections';
389
+ protected $__correctionsDataType = 'array';
390
+ public $corrections;
391
+ protected $__disapprovalReasonsType = 'Google_CreativeDisapprovalReasons';
392
+ protected $__disapprovalReasonsDataType = 'array';
393
+ public $disapprovalReasons;
394
+ protected $__filteringReasonsType = 'Google_CreativeFilteringReasons';
395
+ protected $__filteringReasonsDataType = '';
396
+ public $filteringReasons;
397
+ public $height;
398
+ public $kind;
399
+ public $productCategories;
400
+ public $restrictedCategories;
401
+ public $sensitiveCategories;
402
+ public $status;
403
+ public $vendorType;
404
+ public $videoURL;
405
+ public $width;
406
+ public function setHTMLSnippet( $HTMLSnippet) {
407
+ $this->HTMLSnippet = $HTMLSnippet;
408
+ }
409
+ public function getHTMLSnippet() {
410
+ return $this->HTMLSnippet;
411
+ }
412
+ public function setAccountId( $accountId) {
413
+ $this->accountId = $accountId;
414
+ }
415
+ public function getAccountId() {
416
+ return $this->accountId;
417
+ }
418
+ public function setAdvertiserId(/* array(Google_string) */ $advertiserId) {
419
+ $this->assertIsArray($advertiserId, 'Google_string', __METHOD__);
420
+ $this->advertiserId = $advertiserId;
421
+ }
422
+ public function getAdvertiserId() {
423
+ return $this->advertiserId;
424
+ }
425
+ public function setAdvertiserName( $advertiserName) {
426
+ $this->advertiserName = $advertiserName;
427
+ }
428
+ public function getAdvertiserName() {
429
+ return $this->advertiserName;
430
+ }
431
+ public function setAgencyId( $agencyId) {
432
+ $this->agencyId = $agencyId;
433
+ }
434
+ public function getAgencyId() {
435
+ return $this->agencyId;
436
+ }
437
+ public function setAttribute(/* array(Google_int) */ $attribute) {
438
+ $this->assertIsArray($attribute, 'Google_int', __METHOD__);
439
+ $this->attribute = $attribute;
440
+ }
441
+ public function getAttribute() {
442
+ return $this->attribute;
443
+ }
444
+ public function setBuyerCreativeId( $buyerCreativeId) {
445
+ $this->buyerCreativeId = $buyerCreativeId;
446
+ }
447
+ public function getBuyerCreativeId() {
448
+ return $this->buyerCreativeId;
449
+ }
450
+ public function setClickThroughUrl(/* array(Google_string) */ $clickThroughUrl) {
451
+ $this->assertIsArray($clickThroughUrl, 'Google_string', __METHOD__);
452
+ $this->clickThroughUrl = $clickThroughUrl;
453
+ }
454
+ public function getClickThroughUrl() {
455
+ return $this->clickThroughUrl;
456
+ }
457
+ public function setCorrections(/* array(Google_CreativeCorrections) */ $corrections) {
458
+ $this->assertIsArray($corrections, 'Google_CreativeCorrections', __METHOD__);
459
+ $this->corrections = $corrections;
460
+ }
461
+ public function getCorrections() {
462
+ return $this->corrections;
463
+ }
464
+ public function setDisapprovalReasons(/* array(Google_CreativeDisapprovalReasons) */ $disapprovalReasons) {
465
+ $this->assertIsArray($disapprovalReasons, 'Google_CreativeDisapprovalReasons', __METHOD__);
466
+ $this->disapprovalReasons = $disapprovalReasons;
467
+ }
468
+ public function getDisapprovalReasons() {
469
+ return $this->disapprovalReasons;
470
+ }
471
+ public function setFilteringReasons(Google_CreativeFilteringReasons $filteringReasons) {
472
+ $this->filteringReasons = $filteringReasons;
473
+ }
474
+ public function getFilteringReasons() {
475
+ return $this->filteringReasons;
476
+ }
477
+ public function setHeight( $height) {
478
+ $this->height = $height;
479
+ }
480
+ public function getHeight() {
481
+ return $this->height;
482
+ }
483
+ public function setKind( $kind) {
484
+ $this->kind = $kind;
485
+ }
486
+ public function getKind() {
487
+ return $this->kind;
488
+ }
489
+ public function setProductCategories(/* array(Google_int) */ $productCategories) {
490
+ $this->assertIsArray($productCategories, 'Google_int', __METHOD__);
491
+ $this->productCategories = $productCategories;
492
+ }
493
+ public function getProductCategories() {
494
+ return $this->productCategories;
495
+ }
496
+ public function setRestrictedCategories(/* array(Google_int) */ $restrictedCategories) {
497
+ $this->assertIsArray($restrictedCategories, 'Google_int', __METHOD__);
498
+ $this->restrictedCategories = $restrictedCategories;
499
+ }
500
+ public function getRestrictedCategories() {
501
+ return $this->restrictedCategories;
502
+ }
503
+ public function setSensitiveCategories(/* array(Google_int) */ $sensitiveCategories) {
504
+ $this->assertIsArray($sensitiveCategories, 'Google_int', __METHOD__);
505
+ $this->sensitiveCategories = $sensitiveCategories;
506
+ }
507
+ public function getSensitiveCategories() {
508
+ return $this->sensitiveCategories;
509
+ }
510
+ public function setStatus( $status) {
511
+ $this->status = $status;
512
+ }
513
+ public function getStatus() {
514
+ return $this->status;
515
+ }
516
+ public function setVendorType(/* array(Google_int) */ $vendorType) {
517
+ $this->assertIsArray($vendorType, 'Google_int', __METHOD__);
518
+ $this->vendorType = $vendorType;
519
+ }
520
+ public function getVendorType() {
521
+ return $this->vendorType;
522
+ }
523
+ public function setVideoURL( $videoURL) {
524
+ $this->videoURL = $videoURL;
525
+ }
526
+ public function getVideoURL() {
527
+ return $this->videoURL;
528
+ }
529
+ public function setWidth( $width) {
530
+ $this->width = $width;
531
+ }
532
+ public function getWidth() {
533
+ return $this->width;
534
+ }
535
+ }
536
+
537
+ class Google_CreativeCorrections extends Google_Model {
538
+ public $details;
539
+ public $reason;
540
+ public function setDetails(/* array(Google_string) */ $details) {
541
+ $this->assertIsArray($details, 'Google_string', __METHOD__);
542
+ $this->details = $details;
543
+ }
544
+ public function getDetails() {
545
+ return $this->details;
546
+ }
547
+ public function setReason( $reason) {
548
+ $this->reason = $reason;
549
+ }
550
+ public function getReason() {
551
+ return $this->reason;
552
+ }
553
+ }
554
+
555
+ class Google_CreativeDisapprovalReasons extends Google_Model {
556
+ public $details;
557
+ public $reason;
558
+ public function setDetails(/* array(Google_string) */ $details) {
559
+ $this->assertIsArray($details, 'Google_string', __METHOD__);
560
+ $this->details = $details;
561
+ }
562
+ public function getDetails() {
563
+ return $this->details;
564
+ }
565
+ public function setReason( $reason) {
566
+ $this->reason = $reason;
567
+ }
568
+ public function getReason() {
569
+ return $this->reason;
570
+ }
571
+ }
572
+
573
+ class Google_CreativeFilteringReasons extends Google_Model {
574
+ public $date;
575
+ protected $__reasonsType = 'Google_CreativeFilteringReasonsReasons';
576
+ protected $__reasonsDataType = 'array';
577
+ public $reasons;
578
+ public function setDate( $date) {
579
+ $this->date = $date;
580
+ }
581
+ public function getDate() {
582
+ return $this->date;
583
+ }
584
+ public function setReasons(/* array(Google_CreativeFilteringReasonsReasons) */ $reasons) {
585
+ $this->assertIsArray($reasons, 'Google_CreativeFilteringReasonsReasons', __METHOD__);
586
+ $this->reasons = $reasons;
587
+ }
588
+ public function getReasons() {
589
+ return $this->reasons;
590
+ }
591
+ }
592
+
593
+ class Google_CreativeFilteringReasonsReasons extends Google_Model {
594
+ public $filteringCount;
595
+ public $filteringStatus;
596
+ public function setFilteringCount( $filteringCount) {
597
+ $this->filteringCount = $filteringCount;
598
+ }
599
+ public function getFilteringCount() {
600
+ return $this->filteringCount;
601
+ }
602
+ public function setFilteringStatus( $filteringStatus) {
603
+ $this->filteringStatus = $filteringStatus;
604
+ }
605
+ public function getFilteringStatus() {
606
+ return $this->filteringStatus;
607
+ }
608
+ }
609
+
610
+ class Google_CreativesList extends Google_Model {
611
+ protected $__itemsType = 'Google_Creative';
612
+ protected $__itemsDataType = 'array';
613
+ public $items;
614
+ public $kind;
615
+ public $nextPageToken;
616
+ public function setItems(/* array(Google_Creative) */ $items) {
617
+ $this->assertIsArray($items, 'Google_Creative', __METHOD__);
618
+ $this->items = $items;
619
+ }
620
+ public function getItems() {
621
+ return $this->items;
622
+ }
623
+ public function setKind( $kind) {
624
+ $this->kind = $kind;
625
+ }
626
+ public function getKind() {
627
+ return $this->kind;
628
+ }
629
+ public function setNextPageToken( $nextPageToken) {
630
+ $this->nextPageToken = $nextPageToken;
631
+ }
632
+ public function getNextPageToken() {
633
+ return $this->nextPageToken;
634
+ }
635
+ }
636
+
637
+ class Google_DirectDeal extends Google_Model {
638
+ public $accountId;
639
+ public $advertiser;
640
+ public $currencyCode;
641
+ public $endTime;
642
+ public $fixedCpm;
643
+ public $id;
644
+ public $kind;
645
+ public $privateExchangeMinCpm;
646
+ public $sellerNetwork;
647
+ public $startTime;
648
+ public function setAccountId( $accountId) {
649
+ $this->accountId = $accountId;
650
+ }
651
+ public function getAccountId() {
652
+ return $this->accountId;
653
+ }
654
+ public function setAdvertiser( $advertiser) {
655
+ $this->advertiser = $advertiser;
656
+ }
657
+ public function getAdvertiser() {
658
+ return $this->advertiser;
659
+ }
660
+ public function setCurrencyCode( $currencyCode) {
661
+ $this->currencyCode = $currencyCode;
662
+ }
663
+ public function getCurrencyCode() {
664
+ return $this->currencyCode;
665
+ }
666
+ public function setEndTime( $endTime) {
667
+ $this->endTime = $endTime;
668
+ }
669
+ public function getEndTime() {
670
+ return $this->endTime;
671
+ }
672
+ public function setFixedCpm( $fixedCpm) {
673
+ $this->fixedCpm = $fixedCpm;
674
+ }
675
+ public function getFixedCpm() {
676
+ return $this->fixedCpm;
677
+ }
678
+ public function setId( $id) {
679
+ $this->id = $id;
680
+ }
681
+ public function getId() {
682
+ return $this->id;
683
+ }
684
+ public function setKind( $kind) {
685
+ $this->kind = $kind;
686
+ }
687
+ public function getKind() {
688
+ return $this->kind;
689
+ }
690
+ public function setPrivateExchangeMinCpm( $privateExchangeMinCpm) {
691
+ $this->privateExchangeMinCpm = $privateExchangeMinCpm;
692
+ }
693
+ public function getPrivateExchangeMinCpm() {
694
+ return $this->privateExchangeMinCpm;
695
+ }
696
+ public function setSellerNetwork( $sellerNetwork) {
697
+ $this->sellerNetwork = $sellerNetwork;
698
+ }
699
+ public function getSellerNetwork() {
700
+ return $this->sellerNetwork;
701
+ }
702
+ public function setStartTime( $startTime) {
703
+ $this->startTime = $startTime;
704
+ }
705
+ public function getStartTime() {
706
+ return $this->startTime;
707
+ }
708
+ }
709
+
710
+ class Google_DirectDealsList extends Google_Model {
711
+ protected $__directDealsType = 'Google_DirectDeal';
712
+ protected $__directDealsDataType = 'array';
713
+ public $directDeals;
714
+ public $kind;
715
+ public function setDirectDeals(/* array(Google_DirectDeal) */ $directDeals) {
716
+ $this->assertIsArray($directDeals, 'Google_DirectDeal', __METHOD__);
717
+ $this->directDeals = $directDeals;
718
+ }
719
+ public function getDirectDeals() {
720
+ return $this->directDeals;
721
+ }
722
+ public function setKind( $kind) {
723
+ $this->kind = $kind;
724
+ }
725
+ public function getKind() {
726
+ return $this->kind;
727
+ }
728
+ }
729
+
730
+ class Google_PerformanceReport extends Google_Model {
731
+ public $calloutStatusRate;
732
+ public $cookieMatcherStatusRate;
733
+ public $creativeStatusRate;
734
+ public $hostedMatchStatusRate;
735
+ public $kind;
736
+ public $latency50thPercentile;
737
+ public $latency85thPercentile;
738
+ public $latency95thPercentile;
739
+ public $noQuotaInRegion;
740
+ public $outOfQuota;
741
+ public $pixelMatchRequests;
742
+ public $pixelMatchResponses;
743
+ public $quotaConfiguredLimit;
744
+ public $quotaThrottledLimit;
745
+ public $region;
746
+ public $timestamp;
747
+ public function setCalloutStatusRate(/* array(Google_object) */ $calloutStatusRate) {
748
+ $this->assertIsArray($calloutStatusRate, 'Google_object', __METHOD__);
749
+ $this->calloutStatusRate = $calloutStatusRate;
750
+ }
751
+ public function getCalloutStatusRate() {
752
+ return $this->calloutStatusRate;
753
+ }
754
+ public function setCookieMatcherStatusRate(/* array(Google_object) */ $cookieMatcherStatusRate) {
755
+ $this->assertIsArray($cookieMatcherStatusRate, 'Google_object', __METHOD__);
756
+ $this->cookieMatcherStatusRate = $cookieMatcherStatusRate;
757
+ }
758
+ public function getCookieMatcherStatusRate() {
759
+ return $this->cookieMatcherStatusRate;
760
+ }
761
+ public function setCreativeStatusRate(/* array(Google_object) */ $creativeStatusRate) {
762
+ $this->assertIsArray($creativeStatusRate, 'Google_object', __METHOD__);
763
+ $this->creativeStatusRate = $creativeStatusRate;
764
+ }
765
+ public function getCreativeStatusRate() {
766
+ return $this->creativeStatusRate;
767
+ }
768
+ public function setHostedMatchStatusRate(/* array(Google_object) */ $hostedMatchStatusRate) {
769
+ $this->assertIsArray($hostedMatchStatusRate, 'Google_object', __METHOD__);
770
+ $this->hostedMatchStatusRate = $hostedMatchStatusRate;
771
+ }
772
+ public function getHostedMatchStatusRate() {
773
+ return $this->hostedMatchStatusRate;
774
+ }
775
+ public function setKind( $kind) {
776
+ $this->kind = $kind;
777
+ }
778
+ public function getKind() {
779
+ return $this->kind;
780
+ }
781
+ public function setLatency50thPercentile( $latency50thPercentile) {
782
+ $this->latency50thPercentile = $latency50thPercentile;
783
+ }
784
+ public function getLatency50thPercentile() {
785
+ return $this->latency50thPercentile;
786
+ }
787
+ public function setLatency85thPercentile( $latency85thPercentile) {
788
+ $this->latency85thPercentile = $latency85thPercentile;
789
+ }
790
+ public function getLatency85thPercentile() {
791
+ return $this->latency85thPercentile;
792
+ }
793
+ public function setLatency95thPercentile( $latency95thPercentile) {
794
+ $this->latency95thPercentile = $latency95thPercentile;
795
+ }
796
+ public function getLatency95thPercentile() {
797
+ return $this->latency95thPercentile;
798
+ }
799
+ public function setNoQuotaInRegion( $noQuotaInRegion) {
800
+ $this->noQuotaInRegion = $noQuotaInRegion;
801
+ }
802
+ public function getNoQuotaInRegion() {
803
+ return $this->noQuotaInRegion;
804
+ }
805
+ public function setOutOfQuota( $outOfQuota) {
806
+ $this->outOfQuota = $outOfQuota;
807
+ }
808
+ public function getOutOfQuota() {
809
+ return $this->outOfQuota;
810
+ }
811
+ public function setPixelMatchRequests( $pixelMatchRequests) {
812
+ $this->pixelMatchRequests = $pixelMatchRequests;
813
+ }
814
+ public function getPixelMatchRequests() {
815
+ return $this->pixelMatchRequests;
816
+ }
817
+ public function setPixelMatchResponses( $pixelMatchResponses) {
818
+ $this->pixelMatchResponses = $pixelMatchResponses;
819
+ }
820
+ public function getPixelMatchResponses() {
821
+ return $this->pixelMatchResponses;
822
+ }
823
+ public function setQuotaConfiguredLimit( $quotaConfiguredLimit) {
824
+ $this->quotaConfiguredLimit = $quotaConfiguredLimit;
825
+ }
826
+ public function getQuotaConfiguredLimit() {
827
+ return $this->quotaConfiguredLimit;
828
+ }
829
+ public function setQuotaThrottledLimit( $quotaThrottledLimit) {
830
+ $this->quotaThrottledLimit = $quotaThrottledLimit;
831
+ }
832
+ public function getQuotaThrottledLimit() {
833
+ return $this->quotaThrottledLimit;
834
+ }
835
+ public function setRegion( $region) {
836
+ $this->region = $region;
837
+ }
838
+ public function getRegion() {
839
+ return $this->region;
840
+ }
841
+ public function setTimestamp( $timestamp) {
842
+ $this->timestamp = $timestamp;
843
+ }
844
+ public function getTimestamp() {
845
+ return $this->timestamp;
846
+ }
847
+ }
848
+
849
+ class Google_PerformanceReportList extends Google_Model {
850
+ public $kind;
851
+ protected $__performanceReportType = 'Google_PerformanceReport';
852
+ protected $__performanceReportDataType = 'array';
853
+ public $performanceReport;
854
+ public function setKind( $kind) {
855
+ $this->kind = $kind;
856
+ }
857
+ public function getKind() {
858
+ return $this->kind;
859
+ }
860
+ public function setPerformanceReport(/* array(Google_PerformanceReport) */ $performanceReport) {
861
+ $this->assertIsArray($performanceReport, 'Google_PerformanceReport', __METHOD__);
862
+ $this->performanceReport = $performanceReport;
863
+ }
864
+ public function getPerformanceReport() {
865
+ return $this->performanceReport;
866
+ }
867
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AdsensehostService.php ADDED
@@ -0,0 +1,1376 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "accounts" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $adsensehostService = new Google_AdSenseHostService(...);
22
+ * $accounts = $adsensehostService->accounts;
23
+ * </code>
24
+ */
25
+ class Google_AccountsServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Get information about the selected associated AdSense account. (accounts.get)
29
+ *
30
+ * @param string $accountId Account to get information about.
31
+ * @param array $optParams Optional parameters.
32
+ * @return Google_Account
33
+ */
34
+ public function get($accountId, $optParams = array()) {
35
+ $params = array('accountId' => $accountId);
36
+ $params = array_merge($params, $optParams);
37
+ $data = $this->__call('get', array($params));
38
+ if ($this->useObjects()) {
39
+ return new Google_Account($data);
40
+ } else {
41
+ return $data;
42
+ }
43
+ }
44
+ /**
45
+ * List hosted accounts associated with this AdSense account by ad client id. (accounts.list)
46
+ *
47
+ * @param string $filterAdClientId Ad clients to list accounts for.
48
+ * @param array $optParams Optional parameters.
49
+ * @return Google_Accounts
50
+ */
51
+ public function listAccounts($filterAdClientId, $optParams = array()) {
52
+ $params = array('filterAdClientId' => $filterAdClientId);
53
+ $params = array_merge($params, $optParams);
54
+ $data = $this->__call('list', array($params));
55
+ if ($this->useObjects()) {
56
+ return new Google_Accounts($data);
57
+ } else {
58
+ return $data;
59
+ }
60
+ }
61
+ }
62
+
63
+ /**
64
+ * The "adclients" collection of methods.
65
+ * Typical usage is:
66
+ * <code>
67
+ * $adsensehostService = new Google_AdSenseHostService(...);
68
+ * $adclients = $adsensehostService->adclients;
69
+ * </code>
70
+ */
71
+ class Google_AccountsAdclientsServiceResource extends Google_ServiceResource {
72
+
73
+ /**
74
+ * Get information about one of the ad clients in the specified publisher's AdSense account.
75
+ * (adclients.get)
76
+ *
77
+ * @param string $accountId Account which contains the ad client.
78
+ * @param string $adClientId Ad client to get.
79
+ * @param array $optParams Optional parameters.
80
+ * @return Google_AdClient
81
+ */
82
+ public function get($accountId, $adClientId, $optParams = array()) {
83
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
84
+ $params = array_merge($params, $optParams);
85
+ $data = $this->__call('get', array($params));
86
+ if ($this->useObjects()) {
87
+ return new Google_AdClient($data);
88
+ } else {
89
+ return $data;
90
+ }
91
+ }
92
+ /**
93
+ * List all hosted ad clients in the specified hosted account. (adclients.list)
94
+ *
95
+ * @param string $accountId Account for which to list ad clients.
96
+ * @param array $optParams Optional parameters.
97
+ *
98
+ * @opt_param string maxResults The maximum number of ad clients to include in the response, used for paging.
99
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
100
+ * @return Google_AdClients
101
+ */
102
+ public function listAccountsAdclients($accountId, $optParams = array()) {
103
+ $params = array('accountId' => $accountId);
104
+ $params = array_merge($params, $optParams);
105
+ $data = $this->__call('list', array($params));
106
+ if ($this->useObjects()) {
107
+ return new Google_AdClients($data);
108
+ } else {
109
+ return $data;
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * The "adunits" collection of methods.
115
+ * Typical usage is:
116
+ * <code>
117
+ * $adsensehostService = new Google_AdSenseHostService(...);
118
+ * $adunits = $adsensehostService->adunits;
119
+ * </code>
120
+ */
121
+ class Google_AccountsAdunitsServiceResource extends Google_ServiceResource {
122
+
123
+ /**
124
+ * Delete the specified ad unit from the specified publisher AdSense account. (adunits.delete)
125
+ *
126
+ * @param string $accountId Account which contains the ad unit.
127
+ * @param string $adClientId Ad client for which to get ad unit.
128
+ * @param string $adUnitId Ad unit to delete.
129
+ * @param array $optParams Optional parameters.
130
+ * @return Google_AdUnit
131
+ */
132
+ public function delete($accountId, $adClientId, $adUnitId, $optParams = array()) {
133
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
134
+ $params = array_merge($params, $optParams);
135
+ $data = $this->__call('delete', array($params));
136
+ if ($this->useObjects()) {
137
+ return new Google_AdUnit($data);
138
+ } else {
139
+ return $data;
140
+ }
141
+ }
142
+ /**
143
+ * Get the specified host ad unit in this AdSense account. (adunits.get)
144
+ *
145
+ * @param string $accountId Account which contains the ad unit.
146
+ * @param string $adClientId Ad client for which to get ad unit.
147
+ * @param string $adUnitId Ad unit to get.
148
+ * @param array $optParams Optional parameters.
149
+ * @return Google_AdUnit
150
+ */
151
+ public function get($accountId, $adClientId, $adUnitId, $optParams = array()) {
152
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
153
+ $params = array_merge($params, $optParams);
154
+ $data = $this->__call('get', array($params));
155
+ if ($this->useObjects()) {
156
+ return new Google_AdUnit($data);
157
+ } else {
158
+ return $data;
159
+ }
160
+ }
161
+ /**
162
+ * Get ad code for the specified ad unit, attaching the specified host custom channels.
163
+ * (adunits.getAdCode)
164
+ *
165
+ * @param string $accountId Account which contains the ad client.
166
+ * @param string $adClientId Ad client with contains the ad unit.
167
+ * @param string $adUnitId Ad unit to get the code for.
168
+ * @param array $optParams Optional parameters.
169
+ *
170
+ * @opt_param string hostCustomChannelId Host custom channel to attach to the ad code.
171
+ * @return Google_AdCode
172
+ */
173
+ public function getAdCode($accountId, $adClientId, $adUnitId, $optParams = array()) {
174
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId);
175
+ $params = array_merge($params, $optParams);
176
+ $data = $this->__call('getAdCode', array($params));
177
+ if ($this->useObjects()) {
178
+ return new Google_AdCode($data);
179
+ } else {
180
+ return $data;
181
+ }
182
+ }
183
+ /**
184
+ * Insert the supplied ad unit into the specified publisher AdSense account. (adunits.insert)
185
+ *
186
+ * @param string $accountId Account which will contain the ad unit.
187
+ * @param string $adClientId Ad client into which to insert the ad unit.
188
+ * @param Google_AdUnit $postBody
189
+ * @param array $optParams Optional parameters.
190
+ * @return Google_AdUnit
191
+ */
192
+ public function insert($accountId, $adClientId, Google_AdUnit $postBody, $optParams = array()) {
193
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody);
194
+ $params = array_merge($params, $optParams);
195
+ $data = $this->__call('insert', array($params));
196
+ if ($this->useObjects()) {
197
+ return new Google_AdUnit($data);
198
+ } else {
199
+ return $data;
200
+ }
201
+ }
202
+ /**
203
+ * List all ad units in the specified publisher's AdSense account. (adunits.list)
204
+ *
205
+ * @param string $accountId Account which contains the ad client.
206
+ * @param string $adClientId Ad client for which to list ad units.
207
+ * @param array $optParams Optional parameters.
208
+ *
209
+ * @opt_param bool includeInactive Whether to include inactive ad units. Default: true.
210
+ * @opt_param string maxResults The maximum number of ad units to include in the response, used for paging.
211
+ * @opt_param string pageToken A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
212
+ * @return Google_AdUnits
213
+ */
214
+ public function listAccountsAdunits($accountId, $adClientId, $optParams = array()) {
215
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId);
216
+ $params = array_merge($params, $optParams);
217
+ $data = $this->__call('list', array($params));
218
+ if ($this->useObjects()) {
219
+ return new Google_AdUnits($data);
220
+ } else {
221
+ return $data;
222
+ }
223
+ }
224
+ /**
225
+ * Update the supplied ad unit in the specified publisher AdSense account. This method supports
226
+ * patch semantics. (adunits.patch)
227
+ *
228
+ * @param string $accountId Account which contains the ad client.
229
+ * @param string $adClientId Ad client which contains the ad unit.
230
+ * @param string $adUnitId Ad unit to get.
231
+ * @param Google_AdUnit $postBody
232
+ * @param array $optParams Optional parameters.
233
+ * @return Google_AdUnit
234
+ */
235
+ public function patch($accountId, $adClientId, $adUnitId, Google_AdUnit $postBody, $optParams = array()) {
236
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId, 'postBody' => $postBody);
237
+ $params = array_merge($params, $optParams);
238
+ $data = $this->__call('patch', array($params));
239
+ if ($this->useObjects()) {
240
+ return new Google_AdUnit($data);
241
+ } else {
242
+ return $data;
243
+ }
244
+ }
245
+ /**
246
+ * Update the supplied ad unit in the specified publisher AdSense account. (adunits.update)
247
+ *
248
+ * @param string $accountId Account which contains the ad client.
249
+ * @param string $adClientId Ad client which contains the ad unit.
250
+ * @param Google_AdUnit $postBody
251
+ * @param array $optParams Optional parameters.
252
+ * @return Google_AdUnit
253
+ */
254
+ public function update($accountId, $adClientId, Google_AdUnit $postBody, $optParams = array()) {
255
+ $params = array('accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody);
256
+ $params = array_merge($params, $optParams);
257
+ $data = $this->__call('update', array($params));
258
+ if ($this->useObjects()) {
259
+ return new Google_AdUnit($data);
260
+ } else {
261
+ return $data;
262
+ }
263
+ }
264
+ }
265
+ /**
266
+ * The "reports" collection of methods.
267
+ * Typical usage is:
268
+ * <code>
269
+ * $adsensehostService = new Google_AdSenseHostService(...);
270
+ * $reports = $adsensehostService->reports;
271
+ * </code>
272
+ */
273
+ class Google_AccountsReportsServiceResource extends Google_ServiceResource {
274
+
275
+ /**
276
+ * Generate an AdSense report based on the report request sent in the query parameters. Returns the
277
+ * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
278
+ * (reports.generate)
279
+ *
280
+ * @param string $accountId Hosted account upon which to report.
281
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
282
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
283
+ * @param array $optParams Optional parameters.
284
+ *
285
+ * @opt_param string dimension Dimensions to base the report on.
286
+ * @opt_param string filter Filters to be run on the report.
287
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
288
+ * @opt_param string maxResults The maximum number of rows of report data to return.
289
+ * @opt_param string metric Numeric columns to include in the report.
290
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
291
+ * @opt_param string startIndex Index of the first row of report data to return.
292
+ * @return Google_Report
293
+ */
294
+ public function generate($accountId, $startDate, $endDate, $optParams = array()) {
295
+ $params = array('accountId' => $accountId, 'startDate' => $startDate, 'endDate' => $endDate);
296
+ $params = array_merge($params, $optParams);
297
+ $data = $this->__call('generate', array($params));
298
+ if ($this->useObjects()) {
299
+ return new Google_Report($data);
300
+ } else {
301
+ return $data;
302
+ }
303
+ }
304
+ }
305
+
306
+ /**
307
+ * The "adclients" collection of methods.
308
+ * Typical usage is:
309
+ * <code>
310
+ * $adsensehostService = new Google_AdSenseHostService(...);
311
+ * $adclients = $adsensehostService->adclients;
312
+ * </code>
313
+ */
314
+ class Google_AdclientsServiceResource extends Google_ServiceResource {
315
+
316
+ /**
317
+ * Get information about one of the ad clients in the Host AdSense account. (adclients.get)
318
+ *
319
+ * @param string $adClientId Ad client to get.
320
+ * @param array $optParams Optional parameters.
321
+ * @return Google_AdClient
322
+ */
323
+ public function get($adClientId, $optParams = array()) {
324
+ $params = array('adClientId' => $adClientId);
325
+ $params = array_merge($params, $optParams);
326
+ $data = $this->__call('get', array($params));
327
+ if ($this->useObjects()) {
328
+ return new Google_AdClient($data);
329
+ } else {
330
+ return $data;
331
+ }
332
+ }
333
+ /**
334
+ * List all host ad clients in this AdSense account. (adclients.list)
335
+ *
336
+ * @param array $optParams Optional parameters.
337
+ *
338
+ * @opt_param string maxResults The maximum number of ad clients to include in the response, used for paging.
339
+ * @opt_param string pageToken A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
340
+ * @return Google_AdClients
341
+ */
342
+ public function listAdclients($optParams = array()) {
343
+ $params = array();
344
+ $params = array_merge($params, $optParams);
345
+ $data = $this->__call('list', array($params));
346
+ if ($this->useObjects()) {
347
+ return new Google_AdClients($data);
348
+ } else {
349
+ return $data;
350
+ }
351
+ }
352
+ }
353
+
354
+ /**
355
+ * The "associationsessions" collection of methods.
356
+ * Typical usage is:
357
+ * <code>
358
+ * $adsensehostService = new Google_AdSenseHostService(...);
359
+ * $associationsessions = $adsensehostService->associationsessions;
360
+ * </code>
361
+ */
362
+ class Google_AssociationsessionsServiceResource extends Google_ServiceResource {
363
+
364
+ /**
365
+ * Create an association session for initiating an association with an AdSense user.
366
+ * (associationsessions.start)
367
+ *
368
+ * @param string $productCode Products to associate with the user.
369
+ * @param string $websiteUrl The URL of the user's hosted website.
370
+ * @param array $optParams Optional parameters.
371
+ *
372
+ * @opt_param string userLocale The preferred locale of the user.
373
+ * @opt_param string websiteLocale The locale of the user's hosted website.
374
+ * @return Google_AssociationSession
375
+ */
376
+ public function start($productCode, $websiteUrl, $optParams = array()) {
377
+ $params = array('productCode' => $productCode, 'websiteUrl' => $websiteUrl);
378
+ $params = array_merge($params, $optParams);
379
+ $data = $this->__call('start', array($params));
380
+ if ($this->useObjects()) {
381
+ return new Google_AssociationSession($data);
382
+ } else {
383
+ return $data;
384
+ }
385
+ }
386
+ /**
387
+ * Verify an association session after the association callback returns from AdSense signup.
388
+ * (associationsessions.verify)
389
+ *
390
+ * @param string $token The token returned to the association callback URL.
391
+ * @param array $optParams Optional parameters.
392
+ * @return Google_AssociationSession
393
+ */
394
+ public function verify($token, $optParams = array()) {
395
+ $params = array('token' => $token);
396
+ $params = array_merge($params, $optParams);
397
+ $data = $this->__call('verify', array($params));
398
+ if ($this->useObjects()) {
399
+ return new Google_AssociationSession($data);
400
+ } else {
401
+ return $data;
402
+ }
403
+ }
404
+ }
405
+
406
+ /**
407
+ * The "customchannels" collection of methods.
408
+ * Typical usage is:
409
+ * <code>
410
+ * $adsensehostService = new Google_AdSenseHostService(...);
411
+ * $customchannels = $adsensehostService->customchannels;
412
+ * </code>
413
+ */
414
+ class Google_CustomchannelsServiceResource extends Google_ServiceResource {
415
+
416
+ /**
417
+ * Delete a specific custom channel from the host AdSense account. (customchannels.delete)
418
+ *
419
+ * @param string $adClientId Ad client from which to delete the custom channel.
420
+ * @param string $customChannelId Custom channel to delete.
421
+ * @param array $optParams Optional parameters.
422
+ * @return Google_CustomChannel
423
+ */
424
+ public function delete($adClientId, $customChannelId, $optParams = array()) {
425
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
426
+ $params = array_merge($params, $optParams);
427
+ $data = $this->__call('delete', array($params));
428
+ if ($this->useObjects()) {
429
+ return new Google_CustomChannel($data);
430
+ } else {
431
+ return $data;
432
+ }
433
+ }
434
+ /**
435
+ * Get a specific custom channel from the host AdSense account. (customchannels.get)
436
+ *
437
+ * @param string $adClientId Ad client from which to get the custom channel.
438
+ * @param string $customChannelId Custom channel to get.
439
+ * @param array $optParams Optional parameters.
440
+ * @return Google_CustomChannel
441
+ */
442
+ public function get($adClientId, $customChannelId, $optParams = array()) {
443
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId);
444
+ $params = array_merge($params, $optParams);
445
+ $data = $this->__call('get', array($params));
446
+ if ($this->useObjects()) {
447
+ return new Google_CustomChannel($data);
448
+ } else {
449
+ return $data;
450
+ }
451
+ }
452
+ /**
453
+ * Add a new custom channel to the host AdSense account. (customchannels.insert)
454
+ *
455
+ * @param string $adClientId Ad client to which the new custom channel will be added.
456
+ * @param Google_CustomChannel $postBody
457
+ * @param array $optParams Optional parameters.
458
+ * @return Google_CustomChannel
459
+ */
460
+ public function insert($adClientId, Google_CustomChannel $postBody, $optParams = array()) {
461
+ $params = array('adClientId' => $adClientId, 'postBody' => $postBody);
462
+ $params = array_merge($params, $optParams);
463
+ $data = $this->__call('insert', array($params));
464
+ if ($this->useObjects()) {
465
+ return new Google_CustomChannel($data);
466
+ } else {
467
+ return $data;
468
+ }
469
+ }
470
+ /**
471
+ * List all host custom channels in this AdSense account. (customchannels.list)
472
+ *
473
+ * @param string $adClientId Ad client for which to list custom channels.
474
+ * @param array $optParams Optional parameters.
475
+ *
476
+ * @opt_param string maxResults The maximum number of custom channels to include in the response, used for paging.
477
+ * @opt_param string pageToken A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
478
+ * @return Google_CustomChannels
479
+ */
480
+ public function listCustomchannels($adClientId, $optParams = array()) {
481
+ $params = array('adClientId' => $adClientId);
482
+ $params = array_merge($params, $optParams);
483
+ $data = $this->__call('list', array($params));
484
+ if ($this->useObjects()) {
485
+ return new Google_CustomChannels($data);
486
+ } else {
487
+ return $data;
488
+ }
489
+ }
490
+ /**
491
+ * Update a custom channel in the host AdSense account. This method supports patch semantics.
492
+ * (customchannels.patch)
493
+ *
494
+ * @param string $adClientId Ad client in which the custom channel will be updated.
495
+ * @param string $customChannelId Custom channel to get.
496
+ * @param Google_CustomChannel $postBody
497
+ * @param array $optParams Optional parameters.
498
+ * @return Google_CustomChannel
499
+ */
500
+ public function patch($adClientId, $customChannelId, Google_CustomChannel $postBody, $optParams = array()) {
501
+ $params = array('adClientId' => $adClientId, 'customChannelId' => $customChannelId, 'postBody' => $postBody);
502
+ $params = array_merge($params, $optParams);
503
+ $data = $this->__call('patch', array($params));
504
+ if ($this->useObjects()) {
505
+ return new Google_CustomChannel($data);
506
+ } else {
507
+ return $data;
508
+ }
509
+ }
510
+ /**
511
+ * Update a custom channel in the host AdSense account. (customchannels.update)
512
+ *
513
+ * @param string $adClientId Ad client in which the custom channel will be updated.
514
+ * @param Google_CustomChannel $postBody
515
+ * @param array $optParams Optional parameters.
516
+ * @return Google_CustomChannel
517
+ */
518
+ public function update($adClientId, Google_CustomChannel $postBody, $optParams = array()) {
519
+ $params = array('adClientId' => $adClientId, 'postBody' => $postBody);
520
+ $params = array_merge($params, $optParams);
521
+ $data = $this->__call('update', array($params));
522
+ if ($this->useObjects()) {
523
+ return new Google_CustomChannel($data);
524
+ } else {
525
+ return $data;
526
+ }
527
+ }
528
+ }
529
+
530
+ /**
531
+ * The "reports" collection of methods.
532
+ * Typical usage is:
533
+ * <code>
534
+ * $adsensehostService = new Google_AdSenseHostService(...);
535
+ * $reports = $adsensehostService->reports;
536
+ * </code>
537
+ */
538
+ class Google_ReportsServiceResource extends Google_ServiceResource {
539
+
540
+ /**
541
+ * Generate an AdSense report based on the report request sent in the query parameters. Returns the
542
+ * result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.
543
+ * (reports.generate)
544
+ *
545
+ * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
546
+ * @param string $endDate End of the date range to report on in "YYYY-MM-DD" format, inclusive.
547
+ * @param array $optParams Optional parameters.
548
+ *
549
+ * @opt_param string dimension Dimensions to base the report on.
550
+ * @opt_param string filter Filters to be run on the report.
551
+ * @opt_param string locale Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
552
+ * @opt_param string maxResults The maximum number of rows of report data to return.
553
+ * @opt_param string metric Numeric columns to include in the report.
554
+ * @opt_param string sort The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
555
+ * @opt_param string startIndex Index of the first row of report data to return.
556
+ * @return Google_Report
557
+ */
558
+ public function generate($startDate, $endDate, $optParams = array()) {
559
+ $params = array('startDate' => $startDate, 'endDate' => $endDate);
560
+ $params = array_merge($params, $optParams);
561
+ $data = $this->__call('generate', array($params));
562
+ if ($this->useObjects()) {
563
+ return new Google_Report($data);
564
+ } else {
565
+ return $data;
566
+ }
567
+ }
568
+ }
569
+
570
+ /**
571
+ * The "urlchannels" collection of methods.
572
+ * Typical usage is:
573
+ * <code>
574
+ * $adsensehostService = new Google_AdSenseHostService(...);
575
+ * $urlchannels = $adsensehostService->urlchannels;
576
+ * </code>
577
+ */
578
+ class Google_UrlchannelsServiceResource extends Google_ServiceResource {
579
+
580
+ /**
581
+ * Delete a URL channel from the host AdSense account. (urlchannels.delete)
582
+ *
583
+ * @param string $adClientId Ad client from which to delete the URL channel.
584
+ * @param string $urlChannelId URL channel to delete.
585
+ * @param array $optParams Optional parameters.
586
+ * @return Google_UrlChannel
587
+ */
588
+ public function delete($adClientId, $urlChannelId, $optParams = array()) {
589
+ $params = array('adClientId' => $adClientId, 'urlChannelId' => $urlChannelId);
590
+ $params = array_merge($params, $optParams);
591
+ $data = $this->__call('delete', array($params));
592
+ if ($this->useObjects()) {
593
+ return new Google_UrlChannel($data);
594
+ } else {
595
+ return $data;
596
+ }
597
+ }
598
+ /**
599
+ * Add a new URL channel to the host AdSense account. (urlchannels.insert)
600
+ *
601
+ * @param string $adClientId Ad client to which the new URL channel will be added.
602
+ * @param Google_UrlChannel $postBody
603
+ * @param array $optParams Optional parameters.
604
+ * @return Google_UrlChannel
605
+ */
606
+ public function insert($adClientId, Google_UrlChannel $postBody, $optParams = array()) {
607
+ $params = array('adClientId' => $adClientId, 'postBody' => $postBody);
608
+ $params = array_merge($params, $optParams);
609
+ $data = $this->__call('insert', array($params));
610
+ if ($this->useObjects()) {
611
+ return new Google_UrlChannel($data);
612
+ } else {
613
+ return $data;
614
+ }
615
+ }
616
+ /**
617
+ * List all host URL channels in the host AdSense account. (urlchannels.list)
618
+ *
619
+ * @param string $adClientId Ad client for which to list URL channels.
620
+ * @param array $optParams Optional parameters.
621
+ *
622
+ * @opt_param string maxResults The maximum number of URL channels to include in the response, used for paging.
623
+ * @opt_param string pageToken A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
624
+ * @return Google_UrlChannels
625
+ */
626
+ public function listUrlchannels($adClientId, $optParams = array()) {
627
+ $params = array('adClientId' => $adClientId);
628
+ $params = array_merge($params, $optParams);
629
+ $data = $this->__call('list', array($params));
630
+ if ($this->useObjects()) {
631
+ return new Google_UrlChannels($data);
632
+ } else {
633
+ return $data;
634
+ }
635
+ }
636
+ }
637
+
638
+ /**
639
+ * Service definition for Google_AdSenseHost (v4.1).
640
+ *
641
+ * <p>
642
+ * Gives AdSense Hosts access to report generation, ad code generation, and publisher management capabilities.
643
+ * </p>
644
+ *
645
+ * <p>
646
+ * For more information about this service, see the
647
+ * <a href="https://developers.google.com/adsense/host/" target="_blank">API Documentation</a>
648
+ * </p>
649
+ *
650
+ * @author Google, Inc.
651
+ */
652
+ class Google_AdSenseHostService extends Google_Service {
653
+ public $accounts;
654
+ public $accounts_adclients;
655
+ public $accounts_adunits;
656
+ public $accounts_reports;
657
+ public $adclients;
658
+ public $associationsessions;
659
+ public $customchannels;
660
+ public $reports;
661
+ public $urlchannels;
662
+ /**
663
+ * Constructs the internal representation of the AdSenseHost service.
664
+ *
665
+ * @param Google_Client $client
666
+ */
667
+ public function __construct(Google_Client $client) {
668
+ $this->servicePath = 'adsensehost/v4.1/';
669
+ $this->version = 'v4.1';
670
+ $this->serviceName = 'adsensehost';
671
+
672
+ $client->addService($this->serviceName, $this->version);
673
+ $this->accounts = new Google_AccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"get": {"id": "adsensehost.accounts.get", "path": "accounts/{accountId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Account"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "list": {"id": "adsensehost.accounts.list", "path": "accounts", "httpMethod": "GET", "parameters": {"filterAdClientId": {"type": "string", "required": true, "repeated": true, "location": "query"}}, "response": {"$ref": "Accounts"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
674
+ $this->accounts_adclients = new Google_AccountsAdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"get": {"id": "adsensehost.accounts.adclients.get", "path": "accounts/{accountId}/adclients/{adClientId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdClient"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "list": {"id": "adsensehost.accounts.adclients.list", "path": "accounts/{accountId}/adclients", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdClients"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
675
+ $this->accounts_adunits = new Google_AccountsAdunitsServiceResource($this, $this->serviceName, 'adunits', json_decode('{"methods": {"delete": {"id": "adsensehost.accounts.adunits.delete", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "get": {"id": "adsensehost.accounts.adunits.get", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "getAdCode": {"id": "adsensehost.accounts.adunits.getAdCode", "path": "accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "path"}, "hostCustomChannelId": {"type": "string", "repeated": true, "location": "query"}}, "response": {"$ref": "AdCode"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "insert": {"id": "adsensehost.accounts.adunits.insert", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "AdUnit"}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "list": {"id": "adsensehost.accounts.adunits.list", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "includeInactive": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdUnits"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "patch": {"id": "adsensehost.accounts.adunits.patch", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "httpMethod": "PATCH", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}, "adUnitId": {"type": "string", "required": true, "location": "query"}}, "request": {"$ref": "AdUnit"}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "update": {"id": "adsensehost.accounts.adunits.update", "path": "accounts/{accountId}/adclients/{adClientId}/adunits", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "adClientId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "AdUnit"}, "response": {"$ref": "AdUnit"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
676
+ $this->accounts_reports = new Google_AccountsReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"id": "adsensehost.accounts.reports.generate", "path": "accounts/{accountId}/reports", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "dimension": {"type": "string", "repeated": true, "location": "query"}, "endDate": {"type": "string", "required": true, "location": "query"}, "filter": {"type": "string", "repeated": true, "location": "query"}, "locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "50000", "location": "query"}, "metric": {"type": "string", "repeated": true, "location": "query"}, "sort": {"type": "string", "repeated": true, "location": "query"}, "startDate": {"type": "string", "required": true, "location": "query"}, "startIndex": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "5000", "location": "query"}}, "response": {"$ref": "Report"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
677
+ $this->adclients = new Google_AdclientsServiceResource($this, $this->serviceName, 'adclients', json_decode('{"methods": {"get": {"id": "adsensehost.adclients.get", "path": "adclients/{adClientId}", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "AdClient"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "list": {"id": "adsensehost.adclients.list", "path": "adclients", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "AdClients"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
678
+ $this->associationsessions = new Google_AssociationsessionsServiceResource($this, $this->serviceName, 'associationsessions', json_decode('{"methods": {"start": {"id": "adsensehost.associationsessions.start", "path": "associationsessions/start", "httpMethod": "GET", "parameters": {"productCode": {"type": "string", "required": true, "enum": ["AFC", "AFG", "AFMC", "AFS", "AFV"], "repeated": true, "location": "query"}, "userLocale": {"type": "string", "location": "query"}, "websiteLocale": {"type": "string", "location": "query"}, "websiteUrl": {"type": "string", "required": true, "location": "query"}}, "response": {"$ref": "AssociationSession"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "verify": {"id": "adsensehost.associationsessions.verify", "path": "associationsessions/verify", "httpMethod": "GET", "parameters": {"token": {"type": "string", "required": true, "location": "query"}}, "response": {"$ref": "AssociationSession"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
679
+ $this->customchannels = new Google_CustomchannelsServiceResource($this, $this->serviceName, 'customchannels', json_decode('{"methods": {"delete": {"id": "adsensehost.customchannels.delete", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "httpMethod": "DELETE", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "get": {"id": "adsensehost.customchannels.get", "path": "adclients/{adClientId}/customchannels/{customChannelId}", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "insert": {"id": "adsensehost.customchannels.insert", "path": "adclients/{adClientId}/customchannels", "httpMethod": "POST", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CustomChannel"}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "list": {"id": "adsensehost.customchannels.list", "path": "adclients/{adClientId}/customchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "CustomChannels"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "patch": {"id": "adsensehost.customchannels.patch", "path": "adclients/{adClientId}/customchannels", "httpMethod": "PATCH", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "customChannelId": {"type": "string", "required": true, "location": "query"}}, "request": {"$ref": "CustomChannel"}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "update": {"id": "adsensehost.customchannels.update", "path": "adclients/{adClientId}/customchannels", "httpMethod": "PUT", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "CustomChannel"}, "response": {"$ref": "CustomChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
680
+ $this->reports = new Google_ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"generate": {"id": "adsensehost.reports.generate", "path": "reports", "httpMethod": "GET", "parameters": {"dimension": {"type": "string", "repeated": true, "location": "query"}, "endDate": {"type": "string", "required": true, "location": "query"}, "filter": {"type": "string", "repeated": true, "location": "query"}, "locale": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "50000", "location": "query"}, "metric": {"type": "string", "repeated": true, "location": "query"}, "sort": {"type": "string", "repeated": true, "location": "query"}, "startDate": {"type": "string", "required": true, "location": "query"}, "startIndex": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "5000", "location": "query"}}, "response": {"$ref": "Report"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
681
+ $this->urlchannels = new Google_UrlchannelsServiceResource($this, $this->serviceName, 'urlchannels', json_decode('{"methods": {"delete": {"id": "adsensehost.urlchannels.delete", "path": "adclients/{adClientId}/urlchannels/{urlChannelId}", "httpMethod": "DELETE", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "urlChannelId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "UrlChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "insert": {"id": "adsensehost.urlchannels.insert", "path": "adclients/{adClientId}/urlchannels", "httpMethod": "POST", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "UrlChannel"}, "response": {"$ref": "UrlChannel"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}, "list": {"id": "adsensehost.urlchannels.list", "path": "adclients/{adClientId}/urlchannels", "httpMethod": "GET", "parameters": {"adClientId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "minimum": "0", "maximum": "10000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "UrlChannels"}, "scopes": ["https://www.googleapis.com/auth/adsensehost"]}}}', true));
682
+
683
+ }
684
+ }
685
+
686
+
687
+
688
+ class Google_Account extends Google_Model {
689
+ public $id;
690
+ public $kind;
691
+ public $name;
692
+ public $status;
693
+ public function setId( $id) {
694
+ $this->id = $id;
695
+ }
696
+ public function getId() {
697
+ return $this->id;
698
+ }
699
+ public function setKind( $kind) {
700
+ $this->kind = $kind;
701
+ }
702
+ public function getKind() {
703
+ return $this->kind;
704
+ }
705
+ public function setName( $name) {
706
+ $this->name = $name;
707
+ }
708
+ public function getName() {
709
+ return $this->name;
710
+ }
711
+ public function setStatus( $status) {
712
+ $this->status = $status;
713
+ }
714
+ public function getStatus() {
715
+ return $this->status;
716
+ }
717
+ }
718
+
719
+ class Google_Accounts extends Google_Model {
720
+ public $etag;
721
+ protected $__itemsType = 'Google_Account';
722
+ protected $__itemsDataType = 'array';
723
+ public $items;
724
+ public $kind;
725
+ public function setEtag( $etag) {
726
+ $this->etag = $etag;
727
+ }
728
+ public function getEtag() {
729
+ return $this->etag;
730
+ }
731
+ public function setItems(/* array(Google_Account) */ $items) {
732
+ $this->assertIsArray($items, 'Google_Account', __METHOD__);
733
+ $this->items = $items;
734
+ }
735
+ public function getItems() {
736
+ return $this->items;
737
+ }
738
+ public function setKind( $kind) {
739
+ $this->kind = $kind;
740
+ }
741
+ public function getKind() {
742
+ return $this->kind;
743
+ }
744
+ }
745
+
746
+ class Google_AdClient extends Google_Model {
747
+ public $arcOptIn;
748
+ public $id;
749
+ public $kind;
750
+ public $productCode;
751
+ public $supportsReporting;
752
+ public function setArcOptIn( $arcOptIn) {
753
+ $this->arcOptIn = $arcOptIn;
754
+ }
755
+ public function getArcOptIn() {
756
+ return $this->arcOptIn;
757
+ }
758
+ public function setId( $id) {
759
+ $this->id = $id;
760
+ }
761
+ public function getId() {
762
+ return $this->id;
763
+ }
764
+ public function setKind( $kind) {
765
+ $this->kind = $kind;
766
+ }
767
+ public function getKind() {
768
+ return $this->kind;
769
+ }
770
+ public function setProductCode( $productCode) {
771
+ $this->productCode = $productCode;
772
+ }
773
+ public function getProductCode() {
774
+ return $this->productCode;
775
+ }
776
+ public function setSupportsReporting( $supportsReporting) {
777
+ $this->supportsReporting = $supportsReporting;
778
+ }
779
+ public function getSupportsReporting() {
780
+ return $this->supportsReporting;
781
+ }
782
+ }
783
+
784
+ class Google_AdClients extends Google_Model {
785
+ public $etag;
786
+ protected $__itemsType = 'Google_AdClient';
787
+ protected $__itemsDataType = 'array';
788
+ public $items;
789
+ public $kind;
790
+ public $nextPageToken;
791
+ public function setEtag( $etag) {
792
+ $this->etag = $etag;
793
+ }
794
+ public function getEtag() {
795
+ return $this->etag;
796
+ }
797
+ public function setItems(/* array(Google_AdClient) */ $items) {
798
+ $this->assertIsArray($items, 'Google_AdClient', __METHOD__);
799
+ $this->items = $items;
800
+ }
801
+ public function getItems() {
802
+ return $this->items;
803
+ }
804
+ public function setKind( $kind) {
805
+ $this->kind = $kind;
806
+ }
807
+ public function getKind() {
808
+ return $this->kind;
809
+ }
810
+ public function setNextPageToken( $nextPageToken) {
811
+ $this->nextPageToken = $nextPageToken;
812
+ }
813
+ public function getNextPageToken() {
814
+ return $this->nextPageToken;
815
+ }
816
+ }
817
+
818
+ class Google_AdCode extends Google_Model {
819
+ public $adCode;
820
+ public $kind;
821
+ public function setAdCode( $adCode) {
822
+ $this->adCode = $adCode;
823
+ }
824
+ public function getAdCode() {
825
+ return $this->adCode;
826
+ }
827
+ public function setKind( $kind) {
828
+ $this->kind = $kind;
829
+ }
830
+ public function getKind() {
831
+ return $this->kind;
832
+ }
833
+ }
834
+
835
+ class Google_AdStyle extends Google_Model {
836
+ protected $__colorsType = 'Google_AdStyleColors';
837
+ protected $__colorsDataType = '';
838
+ public $colors;
839
+ public $corners;
840
+ protected $__fontType = 'Google_AdStyleFont';
841
+ protected $__fontDataType = '';
842
+ public $font;
843
+ public $kind;
844
+ public function setColors(Google_AdStyleColors $colors) {
845
+ $this->colors = $colors;
846
+ }
847
+ public function getColors() {
848
+ return $this->colors;
849
+ }
850
+ public function setCorners( $corners) {
851
+ $this->corners = $corners;
852
+ }
853
+ public function getCorners() {
854
+ return $this->corners;
855
+ }
856
+ public function setFont(Google_AdStyleFont $font) {
857
+ $this->font = $font;
858
+ }
859
+ public function getFont() {
860
+ return $this->font;
861
+ }
862
+ public function setKind( $kind) {
863
+ $this->kind = $kind;
864
+ }
865
+ public function getKind() {
866
+ return $this->kind;
867
+ }
868
+ }
869
+
870
+ class Google_AdStyleColors extends Google_Model {
871
+ public $background;
872
+ public $border;
873
+ public $text;
874
+ public $title;
875
+ public $url;
876
+ public function setBackground( $background) {
877
+ $this->background = $background;
878
+ }
879
+ public function getBackground() {
880
+ return $this->background;
881
+ }
882
+ public function setBorder( $border) {
883
+ $this->border = $border;
884
+ }
885
+ public function getBorder() {
886
+ return $this->border;
887
+ }
888
+ public function setText( $text) {
889
+ $this->text = $text;
890
+ }
891
+ public function getText() {
892
+ return $this->text;
893
+ }
894
+ public function setTitle( $title) {
895
+ $this->title = $title;
896
+ }
897
+ public function getTitle() {
898
+ return $this->title;
899
+ }
900
+ public function setUrl( $url) {
901
+ $this->url = $url;
902
+ }
903
+ public function getUrl() {
904
+ return $this->url;
905
+ }
906
+ }
907
+
908
+ class Google_AdStyleFont extends Google_Model {
909
+ public $family;
910
+ public $size;
911
+ public function setFamily( $family) {
912
+ $this->family = $family;
913
+ }
914
+ public function getFamily() {
915
+ return $this->family;
916
+ }
917
+ public function setSize( $size) {
918
+ $this->size = $size;
919
+ }
920
+ public function getSize() {
921
+ return $this->size;
922
+ }
923
+ }
924
+
925
+ class Google_AdUnit extends Google_Model {
926
+ public $code;
927
+ protected $__contentAdsSettingsType = 'Google_AdUnitContentAdsSettings';
928
+ protected $__contentAdsSettingsDataType = '';
929
+ public $contentAdsSettings;
930
+ protected $__customStyleType = 'Google_AdStyle';
931
+ protected $__customStyleDataType = '';
932
+ public $customStyle;
933
+ public $id;
934
+ public $kind;
935
+ protected $__mobileContentAdsSettingsType = 'Google_AdUnitMobileContentAdsSettings';
936
+ protected $__mobileContentAdsSettingsDataType = '';
937
+ public $mobileContentAdsSettings;
938
+ public $name;
939
+ public $status;
940
+ public function setCode( $code) {
941
+ $this->code = $code;
942
+ }
943
+ public function getCode() {
944
+ return $this->code;
945
+ }
946
+ public function setContentAdsSettings(Google_AdUnitContentAdsSettings $contentAdsSettings) {
947
+ $this->contentAdsSettings = $contentAdsSettings;
948
+ }
949
+ public function getContentAdsSettings() {
950
+ return $this->contentAdsSettings;
951
+ }
952
+ public function setCustomStyle(Google_AdStyle $customStyle) {
953
+ $this->customStyle = $customStyle;
954
+ }
955
+ public function getCustomStyle() {
956
+ return $this->customStyle;
957
+ }
958
+ public function setId( $id) {
959
+ $this->id = $id;
960
+ }
961
+ public function getId() {
962
+ return $this->id;
963
+ }
964
+ public function setKind( $kind) {
965
+ $this->kind = $kind;
966
+ }
967
+ public function getKind() {
968
+ return $this->kind;
969
+ }
970
+ public function setMobileContentAdsSettings(Google_AdUnitMobileContentAdsSettings $mobileContentAdsSettings) {
971
+ $this->mobileContentAdsSettings = $mobileContentAdsSettings;
972
+ }
973
+ public function getMobileContentAdsSettings() {
974
+ return $this->mobileContentAdsSettings;
975
+ }
976
+ public function setName( $name) {
977
+ $this->name = $name;
978
+ }
979
+ public function getName() {
980
+ return $this->name;
981
+ }
982
+ public function setStatus( $status) {
983
+ $this->status = $status;
984
+ }
985
+ public function getStatus() {
986
+ return $this->status;
987
+ }
988
+ }
989
+
990
+ class Google_AdUnitContentAdsSettings extends Google_Model {
991
+ protected $__backupOptionType = 'Google_AdUnitContentAdsSettingsBackupOption';
992
+ protected $__backupOptionDataType = '';
993
+ public $backupOption;
994
+ public $size;
995
+ public $type;
996
+ public function setBackupOption(Google_AdUnitContentAdsSettingsBackupOption $backupOption) {
997
+ $this->backupOption = $backupOption;
998
+ }
999
+ public function getBackupOption() {
1000
+ return $this->backupOption;
1001
+ }
1002
+ public function setSize( $size) {
1003
+ $this->size = $size;
1004
+ }
1005
+ public function getSize() {
1006
+ return $this->size;
1007
+ }
1008
+ public function setType( $type) {
1009
+ $this->type = $type;
1010
+ }
1011
+ public function getType() {
1012
+ return $this->type;
1013
+ }
1014
+ }
1015
+
1016
+ class Google_AdUnitContentAdsSettingsBackupOption extends Google_Model {
1017
+ public $color;
1018
+ public $type;
1019
+ public $url;
1020
+ public function setColor( $color) {
1021
+ $this->color = $color;
1022
+ }
1023
+ public function getColor() {
1024
+ return $this->color;
1025
+ }
1026
+ public function setType( $type) {
1027
+ $this->type = $type;
1028
+ }
1029
+ public function getType() {
1030
+ return $this->type;
1031
+ }
1032
+ public function setUrl( $url) {
1033
+ $this->url = $url;
1034
+ }
1035
+ public function getUrl() {
1036
+ return $this->url;
1037
+ }
1038
+ }
1039
+
1040
+ class Google_AdUnitMobileContentAdsSettings extends Google_Model {
1041
+ public $markupLanguage;
1042
+ public $scriptingLanguage;
1043
+ public $size;
1044
+ public $type;
1045
+ public function setMarkupLanguage( $markupLanguage) {
1046
+ $this->markupLanguage = $markupLanguage;
1047
+ }
1048
+ public function getMarkupLanguage() {
1049
+ return $this->markupLanguage;
1050
+ }
1051
+ public function setScriptingLanguage( $scriptingLanguage) {
1052
+ $this->scriptingLanguage = $scriptingLanguage;
1053
+ }
1054
+ public function getScriptingLanguage() {
1055
+ return $this->scriptingLanguage;
1056
+ }
1057
+ public function setSize( $size) {
1058
+ $this->size = $size;
1059
+ }
1060
+ public function getSize() {
1061
+ return $this->size;
1062
+ }
1063
+ public function setType( $type) {
1064
+ $this->type = $type;
1065
+ }
1066
+ public function getType() {
1067
+ return $this->type;
1068
+ }
1069
+ }
1070
+
1071
+ class Google_AdUnits extends Google_Model {
1072
+ public $etag;
1073
+ protected $__itemsType = 'Google_AdUnit';
1074
+ protected $__itemsDataType = 'array';
1075
+ public $items;
1076
+ public $kind;
1077
+ public $nextPageToken;
1078
+ public function setEtag( $etag) {
1079
+ $this->etag = $etag;
1080
+ }
1081
+ public function getEtag() {
1082
+ return $this->etag;
1083
+ }
1084
+ public function setItems(/* array(Google_AdUnit) */ $items) {
1085
+ $this->assertIsArray($items, 'Google_AdUnit', __METHOD__);
1086
+ $this->items = $items;
1087
+ }
1088
+ public function getItems() {
1089
+ return $this->items;
1090
+ }
1091
+ public function setKind( $kind) {
1092
+ $this->kind = $kind;
1093
+ }
1094
+ public function getKind() {
1095
+ return $this->kind;
1096
+ }
1097
+ public function setNextPageToken( $nextPageToken) {
1098
+ $this->nextPageToken = $nextPageToken;
1099
+ }
1100
+ public function getNextPageToken() {
1101
+ return $this->nextPageToken;
1102
+ }
1103
+ }
1104
+
1105
+ class Google_AssociationSession extends Google_Model {
1106
+ public $accountId;
1107
+ public $id;
1108
+ public $kind;
1109
+ public $productCodes;
1110
+ public $redirectUrl;
1111
+ public $status;
1112
+ public $userLocale;
1113
+ public $websiteLocale;
1114
+ public $websiteUrl;
1115
+ public function setAccountId( $accountId) {
1116
+ $this->accountId = $accountId;
1117
+ }
1118
+ public function getAccountId() {
1119
+ return $this->accountId;
1120
+ }
1121
+ public function setId( $id) {
1122
+ $this->id = $id;
1123
+ }
1124
+ public function getId() {
1125
+ return $this->id;
1126
+ }
1127
+ public function setKind( $kind) {
1128
+ $this->kind = $kind;
1129
+ }
1130
+ public function getKind() {
1131
+ return $this->kind;
1132
+ }
1133
+ public function setProductCodes(/* array(Google_string) */ $productCodes) {
1134
+ $this->assertIsArray($productCodes, 'Google_string', __METHOD__);
1135
+ $this->productCodes = $productCodes;
1136
+ }
1137
+ public function getProductCodes() {
1138
+ return $this->productCodes;
1139
+ }
1140
+ public function setRedirectUrl( $redirectUrl) {
1141
+ $this->redirectUrl = $redirectUrl;
1142
+ }
1143
+ public function getRedirectUrl() {
1144
+ return $this->redirectUrl;
1145
+ }
1146
+ public function setStatus( $status) {
1147
+ $this->status = $status;
1148
+ }
1149
+ public function getStatus() {
1150
+ return $this->status;
1151
+ }
1152
+ public function setUserLocale( $userLocale) {
1153
+ $this->userLocale = $userLocale;
1154
+ }
1155
+ public function getUserLocale() {
1156
+ return $this->userLocale;
1157
+ }
1158
+ public function setWebsiteLocale( $websiteLocale) {
1159
+ $this->websiteLocale = $websiteLocale;
1160
+ }
1161
+ public function getWebsiteLocale() {
1162
+ return $this->websiteLocale;
1163
+ }
1164
+ public function setWebsiteUrl( $websiteUrl) {
1165
+ $this->websiteUrl = $websiteUrl;
1166
+ }
1167
+ public function getWebsiteUrl() {
1168
+ return $this->websiteUrl;
1169
+ }
1170
+ }
1171
+
1172
+ class Google_CustomChannel extends Google_Model {
1173
+ public $code;
1174
+ public $id;
1175
+ public $kind;
1176
+ public $name;
1177
+ public function setCode( $code) {
1178
+ $this->code = $code;
1179
+ }
1180
+ public function getCode() {
1181
+ return $this->code;
1182
+ }
1183
+ public function setId( $id) {
1184
+ $this->id = $id;
1185
+ }
1186
+ public function getId() {
1187
+ return $this->id;
1188
+ }
1189
+ public function setKind( $kind) {
1190
+ $this->kind = $kind;
1191
+ }
1192
+ public function getKind() {
1193
+ return $this->kind;
1194
+ }
1195
+ public function setName( $name) {
1196
+ $this->name = $name;
1197
+ }
1198
+ public function getName() {
1199
+ return $this->name;
1200
+ }
1201
+ }
1202
+
1203
+ class Google_CustomChannels extends Google_Model {
1204
+ public $etag;
1205
+ protected $__itemsType = 'Google_CustomChannel';
1206
+ protected $__itemsDataType = 'array';
1207
+ public $items;
1208
+ public $kind;
1209
+ public $nextPageToken;
1210
+ public function setEtag( $etag) {
1211
+ $this->etag = $etag;
1212
+ }
1213
+ public function getEtag() {
1214
+ return $this->etag;
1215
+ }
1216
+ public function setItems(/* array(Google_CustomChannel) */ $items) {
1217
+ $this->assertIsArray($items, 'Google_CustomChannel', __METHOD__);
1218
+ $this->items = $items;
1219
+ }
1220
+ public function getItems() {
1221
+ return $this->items;
1222
+ }
1223
+ public function setKind( $kind) {
1224
+ $this->kind = $kind;
1225
+ }
1226
+ public function getKind() {
1227
+ return $this->kind;
1228
+ }
1229
+ public function setNextPageToken( $nextPageToken) {
1230
+ $this->nextPageToken = $nextPageToken;
1231
+ }
1232
+ public function getNextPageToken() {
1233
+ return $this->nextPageToken;
1234
+ }
1235
+ }
1236
+
1237
+ class Google_Report extends Google_Model {
1238
+ public $averages;
1239
+ protected $__headersType = 'Google_ReportHeaders';
1240
+ protected $__headersDataType = 'array';
1241
+ public $headers;
1242
+ public $kind;
1243
+ public $rows;
1244
+ public $totalMatchedRows;
1245
+ public $totals;
1246
+ public $warnings;
1247
+ public function setAverages(/* array(Google_string) */ $averages) {
1248
+ $this->assertIsArray($averages, 'Google_string', __METHOD__);
1249
+ $this->averages = $averages;
1250
+ }
1251
+ public function getAverages() {
1252
+ return $this->averages;
1253
+ }
1254
+ public function setHeaders(/* array(Google_ReportHeaders) */ $headers) {
1255
+ $this->assertIsArray($headers, 'Google_ReportHeaders', __METHOD__);
1256
+ $this->headers = $headers;
1257
+ }
1258
+ public function getHeaders() {
1259
+ return $this->headers;
1260
+ }
1261
+ public function setKind( $kind) {
1262
+ $this->kind = $kind;
1263
+ }
1264
+ public function getKind() {
1265
+ return $this->kind;
1266
+ }
1267
+ public function setRows(/* array(Google_string) */ $rows) {
1268
+ $this->assertIsArray($rows, 'Google_string', __METHOD__);
1269
+ $this->rows = $rows;
1270
+ }
1271
+ public function getRows() {
1272
+ return $this->rows;
1273
+ }
1274
+ public function setTotalMatchedRows( $totalMatchedRows) {
1275
+ $this->totalMatchedRows = $totalMatchedRows;
1276
+ }
1277
+ public function getTotalMatchedRows() {
1278
+ return $this->totalMatchedRows;
1279
+ }
1280
+ public function setTotals(/* array(Google_string) */ $totals) {
1281
+ $this->assertIsArray($totals, 'Google_string', __METHOD__);
1282
+ $this->totals = $totals;
1283
+ }
1284
+ public function getTotals() {
1285
+ return $this->totals;
1286
+ }
1287
+ public function setWarnings(/* array(Google_string) */ $warnings) {
1288
+ $this->assertIsArray($warnings, 'Google_string', __METHOD__);
1289
+ $this->warnings = $warnings;
1290
+ }
1291
+ public function getWarnings() {
1292
+ return $this->warnings;
1293
+ }
1294
+ }
1295
+
1296
+ class Google_ReportHeaders extends Google_Model {
1297
+ public $currency;
1298
+ public $name;
1299
+ public $type;
1300
+ public function setCurrency( $currency) {
1301
+ $this->currency = $currency;
1302
+ }
1303
+ public function getCurrency() {
1304
+ return $this->currency;
1305
+ }
1306
+ public function setName( $name) {
1307
+ $this->name = $name;
1308
+ }
1309
+ public function getName() {
1310
+ return $this->name;
1311
+ }
1312
+ public function setType( $type) {
1313
+ $this->type = $type;
1314
+ }
1315
+ public function getType() {
1316
+ return $this->type;
1317
+ }
1318
+ }
1319
+
1320
+ class Google_UrlChannel extends Google_Model {
1321
+ public $id;
1322
+ public $kind;
1323
+ public $urlPattern;
1324
+ public function setId( $id) {
1325
+ $this->id = $id;
1326
+ }
1327
+ public function getId() {
1328
+ return $this->id;
1329
+ }
1330
+ public function setKind( $kind) {
1331
+ $this->kind = $kind;
1332
+ }
1333
+ public function getKind() {
1334
+ return $this->kind;
1335
+ }
1336
+ public function setUrlPattern( $urlPattern) {
1337
+ $this->urlPattern = $urlPattern;
1338
+ }
1339
+ public function getUrlPattern() {
1340
+ return $this->urlPattern;
1341
+ }
1342
+ }
1343
+
1344
+ class Google_UrlChannels extends Google_Model {
1345
+ public $etag;
1346
+ protected $__itemsType = 'Google_UrlChannel';
1347
+ protected $__itemsDataType = 'array';
1348
+ public $items;
1349
+ public $kind;
1350
+ public $nextPageToken;
1351
+ public function setEtag( $etag) {
1352
+ $this->etag = $etag;
1353
+ }
1354
+ public function getEtag() {
1355
+ return $this->etag;
1356
+ }
1357
+ public function setItems(/* array(Google_UrlChannel) */ $items) {
1358
+ $this->assertIsArray($items, 'Google_UrlChannel', __METHOD__);
1359
+ $this->items = $items;
1360
+ }
1361
+ public function getItems() {
1362
+ return $this->items;
1363
+ }
1364
+ public function setKind( $kind) {
1365
+ $this->kind = $kind;
1366
+ }
1367
+ public function getKind() {
1368
+ return $this->kind;
1369
+ }
1370
+ public function setNextPageToken( $nextPageToken) {
1371
+ $this->nextPageToken = $nextPageToken;
1372
+ }
1373
+ public function getNextPageToken() {
1374
+ return $this->nextPageToken;
1375
+ }
1376
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AnalyticsService.php ADDED
@@ -0,0 +1,4336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "data" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $analyticsService = new Google_AnalyticsService(...);
22
+ * $data = $analyticsService->data;
23
+ * </code>
24
+ */
25
+ class Google_DataServiceResource extends Google_ServiceResource {
26
+
27
+ }
28
+
29
+ /**
30
+ * The "ga" collection of methods.
31
+ * Typical usage is:
32
+ * <code>
33
+ * $analyticsService = new Google_AnalyticsService(...);
34
+ * $ga = $analyticsService->ga;
35
+ * </code>
36
+ */
37
+ class Google_DataGaServiceResource extends Google_ServiceResource {
38
+
39
+ /**
40
+ * Returns Analytics data for a view (profile). (ga.get)
41
+ *
42
+ * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
43
+ * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD.
44
+ * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD.
45
+ * @param string $metrics A comma-separated list of Analytics metrics. E.g., 'ga:visits,ga:pageviews'. At least one metric must be specified.
46
+ * @param array $optParams Optional parameters.
47
+ *
48
+ * @opt_param string dimensions A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'.
49
+ * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to Analytics data.
50
+ * @opt_param int max-results The maximum number of entries to include in this feed.
51
+ * @opt_param string segment An Analytics advanced segment to be applied to data.
52
+ * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for Analytics data.
53
+ * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
54
+ * @return Google_GaData
55
+ */
56
+ public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) {
57
+ $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
58
+ $params = array_merge($params, $optParams);
59
+ $data = $this->__call('get', array($params));
60
+ if ($this->useObjects()) {
61
+ return new Google_GaData($data);
62
+ } else {
63
+ return $data;
64
+ }
65
+ }
66
+ }
67
+ /**
68
+ * The "mcf" collection of methods.
69
+ * Typical usage is:
70
+ * <code>
71
+ * $analyticsService = new Google_AnalyticsService(...);
72
+ * $mcf = $analyticsService->mcf;
73
+ * </code>
74
+ */
75
+ class Google_DataMcfServiceResource extends Google_ServiceResource {
76
+
77
+ /**
78
+ * Returns Analytics Multi-Channel Funnels data for a view (profile). (mcf.get)
79
+ *
80
+ * @param string $ids Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
81
+ * @param string $start_date Start date for fetching Analytics data. All requests should specify a start date formatted as YYYY-MM-DD.
82
+ * @param string $end_date End date for fetching Analytics data. All requests should specify an end date formatted as YYYY-MM-DD.
83
+ * @param string $metrics A comma-separated list of Multi-Channel Funnels metrics. E.g., 'mcf:totalConversions,mcf:totalConversionValue'. At least one metric must be specified.
84
+ * @param array $optParams Optional parameters.
85
+ *
86
+ * @opt_param string dimensions A comma-separated list of Multi-Channel Funnels dimensions. E.g., 'mcf:source,mcf:medium'.
87
+ * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to the Analytics data.
88
+ * @opt_param int max-results The maximum number of entries to include in this feed.
89
+ * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for the Analytics data.
90
+ * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
91
+ * @return Google_McfData
92
+ */
93
+ public function get($ids, $start_date, $end_date, $metrics, $optParams = array()) {
94
+ $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
95
+ $params = array_merge($params, $optParams);
96
+ $data = $this->__call('get', array($params));
97
+ if ($this->useObjects()) {
98
+ return new Google_McfData($data);
99
+ } else {
100
+ return $data;
101
+ }
102
+ }
103
+ }
104
+ /**
105
+ * The "realtime" collection of methods.
106
+ * Typical usage is:
107
+ * <code>
108
+ * $analyticsService = new Google_AnalyticsService(...);
109
+ * $realtime = $analyticsService->realtime;
110
+ * </code>
111
+ */
112
+ class Google_DataRealtimeServiceResource extends Google_ServiceResource {
113
+
114
+ /**
115
+ * Returns real time data for a view (profile). (realtime.get)
116
+ *
117
+ * @param string $ids Unique table ID for retrieving real time data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID.
118
+ * @param string $metrics A comma-separated list of real time metrics. E.g., 'ga:activeVisitors'. At least one metric must be specified.
119
+ * @param array $optParams Optional parameters.
120
+ *
121
+ * @opt_param string dimensions A comma-separated list of real time dimensions. E.g., 'ga:medium,ga:city'.
122
+ * @opt_param string filters A comma-separated list of dimension or metric filters to be applied to real time data.
123
+ * @opt_param int max-results The maximum number of entries to include in this feed.
124
+ * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for real time data.
125
+ * @return Google_RealtimeData
126
+ */
127
+ public function get($ids, $metrics, $optParams = array()) {
128
+ $params = array('ids' => $ids, 'metrics' => $metrics);
129
+ $params = array_merge($params, $optParams);
130
+ $data = $this->__call('get', array($params));
131
+ if ($this->useObjects()) {
132
+ return new Google_RealtimeData($data);
133
+ } else {
134
+ return $data;
135
+ }
136
+ }
137
+ }
138
+
139
+ /**
140
+ * The "management" collection of methods.
141
+ * Typical usage is:
142
+ * <code>
143
+ * $analyticsService = new Google_AnalyticsService(...);
144
+ * $management = $analyticsService->management;
145
+ * </code>
146
+ */
147
+ class Google_ManagementServiceResource extends Google_ServiceResource {
148
+
149
+ }
150
+
151
+ /**
152
+ * The "accountUserLinks" collection of methods.
153
+ * Typical usage is:
154
+ * <code>
155
+ * $analyticsService = new Google_AnalyticsService(...);
156
+ * $accountUserLinks = $analyticsService->accountUserLinks;
157
+ * </code>
158
+ */
159
+ class Google_ManagementAccountUserLinksServiceResource extends Google_ServiceResource {
160
+
161
+ /**
162
+ * Removes a user from the given account. (accountUserLinks.delete)
163
+ *
164
+ * @param string $accountId Account ID to delete the user link for.
165
+ * @param string $linkId Link ID to delete the user link for.
166
+ * @param array $optParams Optional parameters.
167
+ */
168
+ public function delete($accountId, $linkId, $optParams = array()) {
169
+ $params = array('accountId' => $accountId, 'linkId' => $linkId);
170
+ $params = array_merge($params, $optParams);
171
+ $data = $this->__call('delete', array($params));
172
+ return $data;
173
+ }
174
+ /**
175
+ * Adds a new user to the given account. (accountUserLinks.insert)
176
+ *
177
+ * @param string $accountId Account ID to create the user link for.
178
+ * @param Google_EntityUserLink $postBody
179
+ * @param array $optParams Optional parameters.
180
+ * @return Google_EntityUserLink
181
+ */
182
+ public function insert($accountId, Google_EntityUserLink $postBody, $optParams = array()) {
183
+ $params = array('accountId' => $accountId, 'postBody' => $postBody);
184
+ $params = array_merge($params, $optParams);
185
+ $data = $this->__call('insert', array($params));
186
+ if ($this->useObjects()) {
187
+ return new Google_EntityUserLink($data);
188
+ } else {
189
+ return $data;
190
+ }
191
+ }
192
+ /**
193
+ * Lists account-user links for a given account. (accountUserLinks.list)
194
+ *
195
+ * @param string $accountId Account ID to retrieve the user links for.
196
+ * @param array $optParams Optional parameters.
197
+ *
198
+ * @opt_param int max-results The maximum number of account-user links to include in this response.
199
+ * @opt_param int start-index An index of the first account-user link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
200
+ * @return Google_EntityUserLinks
201
+ */
202
+ public function listManagementAccountUserLinks($accountId, $optParams = array()) {
203
+ $params = array('accountId' => $accountId);
204
+ $params = array_merge($params, $optParams);
205
+ $data = $this->__call('list', array($params));
206
+ if ($this->useObjects()) {
207
+ return new Google_EntityUserLinks($data);
208
+ } else {
209
+ return $data;
210
+ }
211
+ }
212
+ /**
213
+ * Updates permissions for an existing user on the given account.
214
+ * (accountUserLinks.update)
215
+ *
216
+ * @param string $accountId Account ID to update the account-user link for.
217
+ * @param string $linkId Link ID to update the account-user link for.
218
+ * @param Google_EntityUserLink $postBody
219
+ * @param array $optParams Optional parameters.
220
+ * @return Google_EntityUserLink
221
+ */
222
+ public function update($accountId, $linkId, Google_EntityUserLink $postBody, $optParams = array()) {
223
+ $params = array('accountId' => $accountId, 'linkId' => $linkId, 'postBody' => $postBody);
224
+ $params = array_merge($params, $optParams);
225
+ $data = $this->__call('update', array($params));
226
+ if ($this->useObjects()) {
227
+ return new Google_EntityUserLink($data);
228
+ } else {
229
+ return $data;
230
+ }
231
+ }
232
+ }
233
+ /**
234
+ * The "accounts" collection of methods.
235
+ * Typical usage is:
236
+ * <code>
237
+ * $analyticsService = new Google_AnalyticsService(...);
238
+ * $accounts = $analyticsService->accounts;
239
+ * </code>
240
+ */
241
+ class Google_ManagementAccountsServiceResource extends Google_ServiceResource {
242
+
243
+ /**
244
+ * Lists all accounts to which the user has access. (accounts.list)
245
+ *
246
+ * @param array $optParams Optional parameters.
247
+ *
248
+ * @opt_param int max-results The maximum number of accounts to include in this response.
249
+ * @opt_param int start-index An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
250
+ * @return Google_Accounts
251
+ */
252
+ public function listManagementAccounts($optParams = array()) {
253
+ $params = array();
254
+ $params = array_merge($params, $optParams);
255
+ $data = $this->__call('list', array($params));
256
+ if ($this->useObjects()) {
257
+ return new Google_Accounts($data);
258
+ } else {
259
+ return $data;
260
+ }
261
+ }
262
+ }
263
+ /**
264
+ * The "customDataSources" collection of methods.
265
+ * Typical usage is:
266
+ * <code>
267
+ * $analyticsService = new Google_AnalyticsService(...);
268
+ * $customDataSources = $analyticsService->customDataSources;
269
+ * </code>
270
+ */
271
+ class Google_ManagementCustomDataSourcesServiceResource extends Google_ServiceResource {
272
+
273
+ /**
274
+ * List custom data sources to which the user has access.
275
+ * (customDataSources.list)
276
+ *
277
+ * @param string $accountId Account Id for the custom data sources to retrieve.
278
+ * @param string $webPropertyId Web property Id for the custom data sources to retrieve.
279
+ * @param array $optParams Optional parameters.
280
+ *
281
+ * @opt_param int max-results The maximum number of custom data sources to include in this response.
282
+ * @opt_param int start-index A 1-based index of the first custom data source to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
283
+ * @return Google_CustomDataSources
284
+ */
285
+ public function listManagementCustomDataSources($accountId, $webPropertyId, $optParams = array()) {
286
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId);
287
+ $params = array_merge($params, $optParams);
288
+ $data = $this->__call('list', array($params));
289
+ if ($this->useObjects()) {
290
+ return new Google_CustomDataSources($data);
291
+ } else {
292
+ return $data;
293
+ }
294
+ }
295
+ }
296
+ /**
297
+ * The "dailyUploads" collection of methods.
298
+ * Typical usage is:
299
+ * <code>
300
+ * $analyticsService = new Google_AnalyticsService(...);
301
+ * $dailyUploads = $analyticsService->dailyUploads;
302
+ * </code>
303
+ */
304
+ class Google_ManagementDailyUploadsServiceResource extends Google_ServiceResource {
305
+
306
+ /**
307
+ * Delete uploaded data for the given date. (dailyUploads.delete)
308
+ *
309
+ * @param string $accountId Account Id associated with daily upload delete.
310
+ * @param string $webPropertyId Web property Id associated with daily upload delete.
311
+ * @param string $customDataSourceId Custom data source Id associated with daily upload delete.
312
+ * @param string $date Date for which data is to be deleted. Date should be formatted as YYYY-MM-DD.
313
+ * @param string $type Type of data for this delete.
314
+ * @param array $optParams Optional parameters.
315
+ */
316
+ public function delete($accountId, $webPropertyId, $customDataSourceId, $date, $type, $optParams = array()) {
317
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId, 'date' => $date, 'type' => $type);
318
+ $params = array_merge($params, $optParams);
319
+ $data = $this->__call('delete', array($params));
320
+ return $data;
321
+ }
322
+ /**
323
+ * List daily uploads to which the user has access. (dailyUploads.list)
324
+ *
325
+ * @param string $accountId Account Id for the daily uploads to retrieve.
326
+ * @param string $webPropertyId Web property Id for the daily uploads to retrieve.
327
+ * @param string $customDataSourceId Custom data source Id for daily uploads to retrieve.
328
+ * @param string $start_date Start date of the form YYYY-MM-DD.
329
+ * @param string $end_date End date of the form YYYY-MM-DD.
330
+ * @param array $optParams Optional parameters.
331
+ *
332
+ * @opt_param int max-results The maximum number of custom data sources to include in this response.
333
+ * @opt_param int start-index A 1-based index of the first daily upload to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
334
+ * @return Google_DailyUploads
335
+ */
336
+ public function listManagementDailyUploads($accountId, $webPropertyId, $customDataSourceId, $start_date, $end_date, $optParams = array()) {
337
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId, 'start-date' => $start_date, 'end-date' => $end_date);
338
+ $params = array_merge($params, $optParams);
339
+ $data = $this->__call('list', array($params));
340
+ if ($this->useObjects()) {
341
+ return new Google_DailyUploads($data);
342
+ } else {
343
+ return $data;
344
+ }
345
+ }
346
+ /**
347
+ * Update/Overwrite data for a custom data source. (dailyUploads.upload)
348
+ *
349
+ * @param string $accountId Account Id associated with daily upload.
350
+ * @param string $webPropertyId Web property Id associated with daily upload.
351
+ * @param string $customDataSourceId Custom data source Id to which the data being uploaded belongs.
352
+ * @param string $date Date for which data is uploaded. Date should be formatted as YYYY-MM-DD.
353
+ * @param int $appendNumber Append number for this upload indexed from 1.
354
+ * @param string $type Type of data for this upload.
355
+ * @param array $optParams Optional parameters.
356
+ *
357
+ * @opt_param bool reset Reset/Overwrite all previous appends for this date and start over with this file as the first upload.
358
+ * @return Google_DailyUploadAppend
359
+ */
360
+ public function upload($accountId, $webPropertyId, $customDataSourceId, $date, $appendNumber, $type, $optParams = array()) {
361
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId, 'date' => $date, 'appendNumber' => $appendNumber, 'type' => $type);
362
+ $params = array_merge($params, $optParams);
363
+ $data = $this->__call('upload', array($params));
364
+ if ($this->useObjects()) {
365
+ return new Google_DailyUploadAppend($data);
366
+ } else {
367
+ return $data;
368
+ }
369
+ }
370
+ }
371
+ /**
372
+ * The "experiments" collection of methods.
373
+ * Typical usage is:
374
+ * <code>
375
+ * $analyticsService = new Google_AnalyticsService(...);
376
+ * $experiments = $analyticsService->experiments;
377
+ * </code>
378
+ */
379
+ class Google_ManagementExperimentsServiceResource extends Google_ServiceResource {
380
+
381
+ /**
382
+ * Delete an experiment. (experiments.delete)
383
+ *
384
+ * @param string $accountId Account ID to which the experiment belongs
385
+ * @param string $webPropertyId Web property ID to which the experiment belongs
386
+ * @param string $profileId View (Profile) ID to which the experiment belongs
387
+ * @param string $experimentId ID of the experiment to delete
388
+ * @param array $optParams Optional parameters.
389
+ */
390
+ public function delete($accountId, $webPropertyId, $profileId, $experimentId, $optParams = array()) {
391
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'experimentId' => $experimentId);
392
+ $params = array_merge($params, $optParams);
393
+ $data = $this->__call('delete', array($params));
394
+ return $data;
395
+ }
396
+ /**
397
+ * Returns an experiment to which the user has access. (experiments.get)
398
+ *
399
+ * @param string $accountId Account ID to retrieve the experiment for.
400
+ * @param string $webPropertyId Web property ID to retrieve the experiment for.
401
+ * @param string $profileId View (Profile) ID to retrieve the experiment for.
402
+ * @param string $experimentId Experiment ID to retrieve the experiment for.
403
+ * @param array $optParams Optional parameters.
404
+ * @return Google_Experiment
405
+ */
406
+ public function get($accountId, $webPropertyId, $profileId, $experimentId, $optParams = array()) {
407
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'experimentId' => $experimentId);
408
+ $params = array_merge($params, $optParams);
409
+ $data = $this->__call('get', array($params));
410
+ if ($this->useObjects()) {
411
+ return new Google_Experiment($data);
412
+ } else {
413
+ return $data;
414
+ }
415
+ }
416
+ /**
417
+ * Create a new experiment. (experiments.insert)
418
+ *
419
+ * @param string $accountId Account ID to create the experiment for.
420
+ * @param string $webPropertyId Web property ID to create the experiment for.
421
+ * @param string $profileId View (Profile) ID to create the experiment for.
422
+ * @param Google_Experiment $postBody
423
+ * @param array $optParams Optional parameters.
424
+ * @return Google_Experiment
425
+ */
426
+ public function insert($accountId, $webPropertyId, $profileId, Google_Experiment $postBody, $optParams = array()) {
427
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'postBody' => $postBody);
428
+ $params = array_merge($params, $optParams);
429
+ $data = $this->__call('insert', array($params));
430
+ if ($this->useObjects()) {
431
+ return new Google_Experiment($data);
432
+ } else {
433
+ return $data;
434
+ }
435
+ }
436
+ /**
437
+ * Lists experiments to which the user has access. (experiments.list)
438
+ *
439
+ * @param string $accountId Account ID to retrieve experiments for.
440
+ * @param string $webPropertyId Web property ID to retrieve experiments for.
441
+ * @param string $profileId View (Profile) ID to retrieve experiments for.
442
+ * @param array $optParams Optional parameters.
443
+ *
444
+ * @opt_param int max-results The maximum number of experiments to include in this response.
445
+ * @opt_param int start-index An index of the first experiment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
446
+ * @return Google_Experiments
447
+ */
448
+ public function listManagementExperiments($accountId, $webPropertyId, $profileId, $optParams = array()) {
449
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
450
+ $params = array_merge($params, $optParams);
451
+ $data = $this->__call('list', array($params));
452
+ if ($this->useObjects()) {
453
+ return new Google_Experiments($data);
454
+ } else {
455
+ return $data;
456
+ }
457
+ }
458
+ /**
459
+ * Update an existing experiment. This method supports patch semantics.
460
+ * (experiments.patch)
461
+ *
462
+ * @param string $accountId Account ID of the experiment to update.
463
+ * @param string $webPropertyId Web property ID of the experiment to update.
464
+ * @param string $profileId View (Profile) ID of the experiment to update.
465
+ * @param string $experimentId Experiment ID of the experiment to update.
466
+ * @param Google_Experiment $postBody
467
+ * @param array $optParams Optional parameters.
468
+ * @return Google_Experiment
469
+ */
470
+ public function patch($accountId, $webPropertyId, $profileId, $experimentId, Google_Experiment $postBody, $optParams = array()) {
471
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'experimentId' => $experimentId, 'postBody' => $postBody);
472
+ $params = array_merge($params, $optParams);
473
+ $data = $this->__call('patch', array($params));
474
+ if ($this->useObjects()) {
475
+ return new Google_Experiment($data);
476
+ } else {
477
+ return $data;
478
+ }
479
+ }
480
+ /**
481
+ * Update an existing experiment. (experiments.update)
482
+ *
483
+ * @param string $accountId Account ID of the experiment to update.
484
+ * @param string $webPropertyId Web property ID of the experiment to update.
485
+ * @param string $profileId View (Profile) ID of the experiment to update.
486
+ * @param string $experimentId Experiment ID of the experiment to update.
487
+ * @param Google_Experiment $postBody
488
+ * @param array $optParams Optional parameters.
489
+ * @return Google_Experiment
490
+ */
491
+ public function update($accountId, $webPropertyId, $profileId, $experimentId, Google_Experiment $postBody, $optParams = array()) {
492
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'experimentId' => $experimentId, 'postBody' => $postBody);
493
+ $params = array_merge($params, $optParams);
494
+ $data = $this->__call('update', array($params));
495
+ if ($this->useObjects()) {
496
+ return new Google_Experiment($data);
497
+ } else {
498
+ return $data;
499
+ }
500
+ }
501
+ }
502
+ /**
503
+ * The "goals" collection of methods.
504
+ * Typical usage is:
505
+ * <code>
506
+ * $analyticsService = new Google_AnalyticsService(...);
507
+ * $goals = $analyticsService->goals;
508
+ * </code>
509
+ */
510
+ class Google_ManagementGoalsServiceResource extends Google_ServiceResource {
511
+
512
+ /**
513
+ * Gets a goal to which the user has access. (goals.get)
514
+ *
515
+ * @param string $accountId Account ID to retrieve the goal for.
516
+ * @param string $webPropertyId Web property ID to retrieve the goal for.
517
+ * @param string $profileId View (Profile) ID to retrieve the goal for.
518
+ * @param string $goalId Goal ID to retrieve the goal for.
519
+ * @param array $optParams Optional parameters.
520
+ * @return Google_Goal
521
+ */
522
+ public function get($accountId, $webPropertyId, $profileId, $goalId, $optParams = array()) {
523
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'goalId' => $goalId);
524
+ $params = array_merge($params, $optParams);
525
+ $data = $this->__call('get', array($params));
526
+ if ($this->useObjects()) {
527
+ return new Google_Goal($data);
528
+ } else {
529
+ return $data;
530
+ }
531
+ }
532
+ /**
533
+ * Create a new goal. (goals.insert)
534
+ *
535
+ * @param string $accountId Account ID to create the goal for.
536
+ * @param string $webPropertyId Web property ID to create the goal for.
537
+ * @param string $profileId View (Profile) ID to create the goal for.
538
+ * @param Google_Goal $postBody
539
+ * @param array $optParams Optional parameters.
540
+ * @return Google_Goal
541
+ */
542
+ public function insert($accountId, $webPropertyId, $profileId, Google_Goal $postBody, $optParams = array()) {
543
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'postBody' => $postBody);
544
+ $params = array_merge($params, $optParams);
545
+ $data = $this->__call('insert', array($params));
546
+ if ($this->useObjects()) {
547
+ return new Google_Goal($data);
548
+ } else {
549
+ return $data;
550
+ }
551
+ }
552
+ /**
553
+ * Lists goals to which the user has access. (goals.list)
554
+ *
555
+ * @param string $accountId Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
556
+ * @param string $webPropertyId Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
557
+ * @param string $profileId View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to.
558
+ * @param array $optParams Optional parameters.
559
+ *
560
+ * @opt_param int max-results The maximum number of goals to include in this response.
561
+ * @opt_param int start-index An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
562
+ * @return Google_Goals
563
+ */
564
+ public function listManagementGoals($accountId, $webPropertyId, $profileId, $optParams = array()) {
565
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
566
+ $params = array_merge($params, $optParams);
567
+ $data = $this->__call('list', array($params));
568
+ if ($this->useObjects()) {
569
+ return new Google_Goals($data);
570
+ } else {
571
+ return $data;
572
+ }
573
+ }
574
+ /**
575
+ * Updates an existing view (profile). This method supports patch semantics.
576
+ * (goals.patch)
577
+ *
578
+ * @param string $accountId Account ID to update the goal.
579
+ * @param string $webPropertyId Web property ID to update the goal.
580
+ * @param string $profileId View (Profile) ID to update the goal.
581
+ * @param string $goalId Index of the goal to be updated.
582
+ * @param Google_Goal $postBody
583
+ * @param array $optParams Optional parameters.
584
+ * @return Google_Goal
585
+ */
586
+ public function patch($accountId, $webPropertyId, $profileId, $goalId, Google_Goal $postBody, $optParams = array()) {
587
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'goalId' => $goalId, 'postBody' => $postBody);
588
+ $params = array_merge($params, $optParams);
589
+ $data = $this->__call('patch', array($params));
590
+ if ($this->useObjects()) {
591
+ return new Google_Goal($data);
592
+ } else {
593
+ return $data;
594
+ }
595
+ }
596
+ /**
597
+ * Updates an existing view (profile). (goals.update)
598
+ *
599
+ * @param string $accountId Account ID to update the goal.
600
+ * @param string $webPropertyId Web property ID to update the goal.
601
+ * @param string $profileId View (Profile) ID to update the goal.
602
+ * @param string $goalId Index of the goal to be updated.
603
+ * @param Google_Goal $postBody
604
+ * @param array $optParams Optional parameters.
605
+ * @return Google_Goal
606
+ */
607
+ public function update($accountId, $webPropertyId, $profileId, $goalId, Google_Goal $postBody, $optParams = array()) {
608
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'goalId' => $goalId, 'postBody' => $postBody);
609
+ $params = array_merge($params, $optParams);
610
+ $data = $this->__call('update', array($params));
611
+ if ($this->useObjects()) {
612
+ return new Google_Goal($data);
613
+ } else {
614
+ return $data;
615
+ }
616
+ }
617
+ }
618
+ /**
619
+ * The "profileUserLinks" collection of methods.
620
+ * Typical usage is:
621
+ * <code>
622
+ * $analyticsService = new Google_AnalyticsService(...);
623
+ * $profileUserLinks = $analyticsService->profileUserLinks;
624
+ * </code>
625
+ */
626
+ class Google_ManagementProfileUserLinksServiceResource extends Google_ServiceResource {
627
+
628
+ /**
629
+ * Removes a user from the given view (profile). (profileUserLinks.delete)
630
+ *
631
+ * @param string $accountId Account ID to delete the user link for.
632
+ * @param string $webPropertyId Web Property ID to delete the user link for.
633
+ * @param string $profileId View (Profile) ID to delete the user link for.
634
+ * @param string $linkId Link ID to delete the user link for.
635
+ * @param array $optParams Optional parameters.
636
+ */
637
+ public function delete($accountId, $webPropertyId, $profileId, $linkId, $optParams = array()) {
638
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'linkId' => $linkId);
639
+ $params = array_merge($params, $optParams);
640
+ $data = $this->__call('delete', array($params));
641
+ return $data;
642
+ }
643
+ /**
644
+ * Adds a new user to the given view (profile). (profileUserLinks.insert)
645
+ *
646
+ * @param string $accountId Account ID to create the user link for.
647
+ * @param string $webPropertyId Web Property ID to create the user link for.
648
+ * @param string $profileId View (Profile) ID to create the user link for.
649
+ * @param Google_EntityUserLink $postBody
650
+ * @param array $optParams Optional parameters.
651
+ * @return Google_EntityUserLink
652
+ */
653
+ public function insert($accountId, $webPropertyId, $profileId, Google_EntityUserLink $postBody, $optParams = array()) {
654
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'postBody' => $postBody);
655
+ $params = array_merge($params, $optParams);
656
+ $data = $this->__call('insert', array($params));
657
+ if ($this->useObjects()) {
658
+ return new Google_EntityUserLink($data);
659
+ } else {
660
+ return $data;
661
+ }
662
+ }
663
+ /**
664
+ * Lists profile-user links for a given view (profile). (profileUserLinks.list)
665
+ *
666
+ * @param string $accountId Account ID which the given view (profile) belongs to.
667
+ * @param string $webPropertyId Web Property ID which the given view (profile) belongs to.
668
+ * @param string $profileId View (Profile) ID to retrieve the profile-user links for
669
+ * @param array $optParams Optional parameters.
670
+ *
671
+ * @opt_param int max-results The maximum number of profile-user links to include in this response.
672
+ * @opt_param int start-index An index of the first profile-user link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
673
+ * @return Google_EntityUserLinks
674
+ */
675
+ public function listManagementProfileUserLinks($accountId, $webPropertyId, $profileId, $optParams = array()) {
676
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
677
+ $params = array_merge($params, $optParams);
678
+ $data = $this->__call('list', array($params));
679
+ if ($this->useObjects()) {
680
+ return new Google_EntityUserLinks($data);
681
+ } else {
682
+ return $data;
683
+ }
684
+ }
685
+ /**
686
+ * Updates permissions for an existing user on the given view (profile).
687
+ * (profileUserLinks.update)
688
+ *
689
+ * @param string $accountId Account ID to update the user link for.
690
+ * @param string $webPropertyId Web Property ID to update the user link for.
691
+ * @param string $profileId View (Profile ID) to update the user link for.
692
+ * @param string $linkId Link ID to update the user link for.
693
+ * @param Google_EntityUserLink $postBody
694
+ * @param array $optParams Optional parameters.
695
+ * @return Google_EntityUserLink
696
+ */
697
+ public function update($accountId, $webPropertyId, $profileId, $linkId, Google_EntityUserLink $postBody, $optParams = array()) {
698
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'linkId' => $linkId, 'postBody' => $postBody);
699
+ $params = array_merge($params, $optParams);
700
+ $data = $this->__call('update', array($params));
701
+ if ($this->useObjects()) {
702
+ return new Google_EntityUserLink($data);
703
+ } else {
704
+ return $data;
705
+ }
706
+ }
707
+ }
708
+ /**
709
+ * The "profiles" collection of methods.
710
+ * Typical usage is:
711
+ * <code>
712
+ * $analyticsService = new Google_AnalyticsService(...);
713
+ * $profiles = $analyticsService->profiles;
714
+ * </code>
715
+ */
716
+ class Google_ManagementProfilesServiceResource extends Google_ServiceResource {
717
+
718
+ /**
719
+ * Deletes a view (profile). (profiles.delete)
720
+ *
721
+ * @param string $accountId Account ID to delete the view (profile) for.
722
+ * @param string $webPropertyId Web property ID to delete the view (profile) for.
723
+ * @param string $profileId ID of the view (profile) to be deleted.
724
+ * @param array $optParams Optional parameters.
725
+ */
726
+ public function delete($accountId, $webPropertyId, $profileId, $optParams = array()) {
727
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
728
+ $params = array_merge($params, $optParams);
729
+ $data = $this->__call('delete', array($params));
730
+ return $data;
731
+ }
732
+ /**
733
+ * Gets a view (profile) to which the user has access. (profiles.get)
734
+ *
735
+ * @param string $accountId Account ID to retrieve the goal for.
736
+ * @param string $webPropertyId Web property ID to retrieve the goal for.
737
+ * @param string $profileId View (Profile) ID to retrieve the goal for.
738
+ * @param array $optParams Optional parameters.
739
+ * @return Google_Profile
740
+ */
741
+ public function get($accountId, $webPropertyId, $profileId, $optParams = array()) {
742
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId);
743
+ $params = array_merge($params, $optParams);
744
+ $data = $this->__call('get', array($params));
745
+ if ($this->useObjects()) {
746
+ return new Google_Profile($data);
747
+ } else {
748
+ return $data;
749
+ }
750
+ }
751
+ /**
752
+ * Create a new view (profile). (profiles.insert)
753
+ *
754
+ * @param string $accountId Account ID to create the view (profile) for.
755
+ * @param string $webPropertyId Web property ID to create the view (profile) for.
756
+ * @param Google_Profile $postBody
757
+ * @param array $optParams Optional parameters.
758
+ * @return Google_Profile
759
+ */
760
+ public function insert($accountId, $webPropertyId, Google_Profile $postBody, $optParams = array()) {
761
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody);
762
+ $params = array_merge($params, $optParams);
763
+ $data = $this->__call('insert', array($params));
764
+ if ($this->useObjects()) {
765
+ return new Google_Profile($data);
766
+ } else {
767
+ return $data;
768
+ }
769
+ }
770
+ /**
771
+ * Lists views (profiles) to which the user has access. (profiles.list)
772
+ *
773
+ * @param string $accountId Account ID for the view (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
774
+ * @param string $webPropertyId Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
775
+ * @param array $optParams Optional parameters.
776
+ *
777
+ * @opt_param int max-results The maximum number of views (profiles) to include in this response.
778
+ * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
779
+ * @return Google_Profiles
780
+ */
781
+ public function listManagementProfiles($accountId, $webPropertyId, $optParams = array()) {
782
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId);
783
+ $params = array_merge($params, $optParams);
784
+ $data = $this->__call('list', array($params));
785
+ if ($this->useObjects()) {
786
+ return new Google_Profiles($data);
787
+ } else {
788
+ return $data;
789
+ }
790
+ }
791
+ /**
792
+ * Updates an existing view (profile). This method supports patch semantics.
793
+ * (profiles.patch)
794
+ *
795
+ * @param string $accountId Account ID to which the view (profile) belongs
796
+ * @param string $webPropertyId Web property ID to which the view (profile) belongs
797
+ * @param string $profileId ID of the view (profile) to be updated.
798
+ * @param Google_Profile $postBody
799
+ * @param array $optParams Optional parameters.
800
+ * @return Google_Profile
801
+ */
802
+ public function patch($accountId, $webPropertyId, $profileId, Google_Profile $postBody, $optParams = array()) {
803
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'postBody' => $postBody);
804
+ $params = array_merge($params, $optParams);
805
+ $data = $this->__call('patch', array($params));
806
+ if ($this->useObjects()) {
807
+ return new Google_Profile($data);
808
+ } else {
809
+ return $data;
810
+ }
811
+ }
812
+ /**
813
+ * Updates an existing view (profile). (profiles.update)
814
+ *
815
+ * @param string $accountId Account ID to which the view (profile) belongs
816
+ * @param string $webPropertyId Web property ID to which the view (profile) belongs
817
+ * @param string $profileId ID of the view (profile) to be updated.
818
+ * @param Google_Profile $postBody
819
+ * @param array $optParams Optional parameters.
820
+ * @return Google_Profile
821
+ */
822
+ public function update($accountId, $webPropertyId, $profileId, Google_Profile $postBody, $optParams = array()) {
823
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'profileId' => $profileId, 'postBody' => $postBody);
824
+ $params = array_merge($params, $optParams);
825
+ $data = $this->__call('update', array($params));
826
+ if ($this->useObjects()) {
827
+ return new Google_Profile($data);
828
+ } else {
829
+ return $data;
830
+ }
831
+ }
832
+ }
833
+ /**
834
+ * The "segments" collection of methods.
835
+ * Typical usage is:
836
+ * <code>
837
+ * $analyticsService = new Google_AnalyticsService(...);
838
+ * $segments = $analyticsService->segments;
839
+ * </code>
840
+ */
841
+ class Google_ManagementSegmentsServiceResource extends Google_ServiceResource {
842
+
843
+ /**
844
+ * Lists advanced segments to which the user has access. (segments.list)
845
+ *
846
+ * @param array $optParams Optional parameters.
847
+ *
848
+ * @opt_param int max-results The maximum number of advanced segments to include in this response.
849
+ * @opt_param int start-index An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
850
+ * @return Google_Segments
851
+ */
852
+ public function listManagementSegments($optParams = array()) {
853
+ $params = array();
854
+ $params = array_merge($params, $optParams);
855
+ $data = $this->__call('list', array($params));
856
+ if ($this->useObjects()) {
857
+ return new Google_Segments($data);
858
+ } else {
859
+ return $data;
860
+ }
861
+ }
862
+ }
863
+ /**
864
+ * The "uploads" collection of methods.
865
+ * Typical usage is:
866
+ * <code>
867
+ * $analyticsService = new Google_AnalyticsService(...);
868
+ * $uploads = $analyticsService->uploads;
869
+ * </code>
870
+ */
871
+ class Google_ManagementUploadsServiceResource extends Google_ServiceResource {
872
+
873
+ /**
874
+ * Delete data associated with a previous upload. (uploads.deleteUploadData)
875
+ *
876
+ * @param string $accountId Account Id for the uploads to be deleted.
877
+ * @param string $webPropertyId Web property Id for the uploads to be deleted.
878
+ * @param string $customDataSourceId Custom data source Id for the uploads to be deleted.
879
+ * @param Google_AnalyticsDataimportDeleteUploadDataRequest $postBody
880
+ * @param array $optParams Optional parameters.
881
+ */
882
+ public function deleteUploadData($accountId, $webPropertyId, $customDataSourceId, Google_AnalyticsDataimportDeleteUploadDataRequest $postBody, $optParams = array()) {
883
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId, 'postBody' => $postBody);
884
+ $params = array_merge($params, $optParams);
885
+ $data = $this->__call('deleteUploadData', array($params));
886
+ return $data;
887
+ }
888
+ /**
889
+ * List uploads to which the user has access. (uploads.get)
890
+ *
891
+ * @param string $accountId Account Id for the upload to retrieve.
892
+ * @param string $webPropertyId Web property Id for the upload to retrieve.
893
+ * @param string $customDataSourceId Custom data source Id for upload to retrieve.
894
+ * @param string $uploadId Upload Id to retrieve.
895
+ * @param array $optParams Optional parameters.
896
+ * @return Google_Upload
897
+ */
898
+ public function get($accountId, $webPropertyId, $customDataSourceId, $uploadId, $optParams = array()) {
899
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId, 'uploadId' => $uploadId);
900
+ $params = array_merge($params, $optParams);
901
+ $data = $this->__call('get', array($params));
902
+ if ($this->useObjects()) {
903
+ return new Google_Upload($data);
904
+ } else {
905
+ return $data;
906
+ }
907
+ }
908
+ /**
909
+ * List uploads to which the user has access. (uploads.list)
910
+ *
911
+ * @param string $accountId Account Id for the uploads to retrieve.
912
+ * @param string $webPropertyId Web property Id for the uploads to retrieve.
913
+ * @param string $customDataSourceId Custom data source Id for uploads to retrieve.
914
+ * @param array $optParams Optional parameters.
915
+ *
916
+ * @opt_param int max-results The maximum number of uploads to include in this response.
917
+ * @opt_param int start-index A 1-based index of the first upload to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
918
+ * @return Google_Uploads
919
+ */
920
+ public function listManagementUploads($accountId, $webPropertyId, $customDataSourceId, $optParams = array()) {
921
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId);
922
+ $params = array_merge($params, $optParams);
923
+ $data = $this->__call('list', array($params));
924
+ if ($this->useObjects()) {
925
+ return new Google_Uploads($data);
926
+ } else {
927
+ return $data;
928
+ }
929
+ }
930
+ /**
931
+ * Upload/Overwrite data for a custom data source. (uploads.uploadData)
932
+ *
933
+ * @param string $accountId Account Id associated with the upload.
934
+ * @param string $webPropertyId Web property UA-string associated with the upload.
935
+ * @param string $customDataSourceId Custom data source Id to which the data being uploaded belongs.
936
+ * @param array $optParams Optional parameters.
937
+ * @return Google_Upload
938
+ */
939
+ public function uploadData($accountId, $webPropertyId, $customDataSourceId, $optParams = array()) {
940
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDataSourceId' => $customDataSourceId);
941
+ $params = array_merge($params, $optParams);
942
+ $data = $this->__call('uploadData', array($params));
943
+ if ($this->useObjects()) {
944
+ return new Google_Upload($data);
945
+ } else {
946
+ return $data;
947
+ }
948
+ }
949
+ }
950
+ /**
951
+ * The "webproperties" collection of methods.
952
+ * Typical usage is:
953
+ * <code>
954
+ * $analyticsService = new Google_AnalyticsService(...);
955
+ * $webproperties = $analyticsService->webproperties;
956
+ * </code>
957
+ */
958
+ class Google_ManagementWebpropertiesServiceResource extends Google_ServiceResource {
959
+
960
+ /**
961
+ * Gets a web property to which the user has access. (webproperties.get)
962
+ *
963
+ * @param string $accountId Account ID to retrieve the web property for.
964
+ * @param string $webPropertyId ID to retrieve the web property for.
965
+ * @param array $optParams Optional parameters.
966
+ * @return Google_Webproperty
967
+ */
968
+ public function get($accountId, $webPropertyId, $optParams = array()) {
969
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId);
970
+ $params = array_merge($params, $optParams);
971
+ $data = $this->__call('get', array($params));
972
+ if ($this->useObjects()) {
973
+ return new Google_Webproperty($data);
974
+ } else {
975
+ return $data;
976
+ }
977
+ }
978
+ /**
979
+ * Create a new property if the account has fewer than 20 properties.
980
+ * (webproperties.insert)
981
+ *
982
+ * @param string $accountId Account ID to create the web property for.
983
+ * @param Google_Webproperty $postBody
984
+ * @param array $optParams Optional parameters.
985
+ * @return Google_Webproperty
986
+ */
987
+ public function insert($accountId, Google_Webproperty $postBody, $optParams = array()) {
988
+ $params = array('accountId' => $accountId, 'postBody' => $postBody);
989
+ $params = array_merge($params, $optParams);
990
+ $data = $this->__call('insert', array($params));
991
+ if ($this->useObjects()) {
992
+ return new Google_Webproperty($data);
993
+ } else {
994
+ return $data;
995
+ }
996
+ }
997
+ /**
998
+ * Lists web properties to which the user has access. (webproperties.list)
999
+ *
1000
+ * @param string $accountId Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
1001
+ * @param array $optParams Optional parameters.
1002
+ *
1003
+ * @opt_param int max-results The maximum number of web properties to include in this response.
1004
+ * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
1005
+ * @return Google_Webproperties
1006
+ */
1007
+ public function listManagementWebproperties($accountId, $optParams = array()) {
1008
+ $params = array('accountId' => $accountId);
1009
+ $params = array_merge($params, $optParams);
1010
+ $data = $this->__call('list', array($params));
1011
+ if ($this->useObjects()) {
1012
+ return new Google_Webproperties($data);
1013
+ } else {
1014
+ return $data;
1015
+ }
1016
+ }
1017
+ /**
1018
+ * Updates an existing web property. This method supports patch semantics.
1019
+ * (webproperties.patch)
1020
+ *
1021
+ * @param string $accountId Account ID to which the web property belongs
1022
+ * @param string $webPropertyId Web property ID
1023
+ * @param Google_Webproperty $postBody
1024
+ * @param array $optParams Optional parameters.
1025
+ * @return Google_Webproperty
1026
+ */
1027
+ public function patch($accountId, $webPropertyId, Google_Webproperty $postBody, $optParams = array()) {
1028
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody);
1029
+ $params = array_merge($params, $optParams);
1030
+ $data = $this->__call('patch', array($params));
1031
+ if ($this->useObjects()) {
1032
+ return new Google_Webproperty($data);
1033
+ } else {
1034
+ return $data;
1035
+ }
1036
+ }
1037
+ /**
1038
+ * Updates an existing web property. (webproperties.update)
1039
+ *
1040
+ * @param string $accountId Account ID to which the web property belongs
1041
+ * @param string $webPropertyId Web property ID
1042
+ * @param Google_Webproperty $postBody
1043
+ * @param array $optParams Optional parameters.
1044
+ * @return Google_Webproperty
1045
+ */
1046
+ public function update($accountId, $webPropertyId, Google_Webproperty $postBody, $optParams = array()) {
1047
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody);
1048
+ $params = array_merge($params, $optParams);
1049
+ $data = $this->__call('update', array($params));
1050
+ if ($this->useObjects()) {
1051
+ return new Google_Webproperty($data);
1052
+ } else {
1053
+ return $data;
1054
+ }
1055
+ }
1056
+ }
1057
+ /**
1058
+ * The "webpropertyUserLinks" collection of methods.
1059
+ * Typical usage is:
1060
+ * <code>
1061
+ * $analyticsService = new Google_AnalyticsService(...);
1062
+ * $webpropertyUserLinks = $analyticsService->webpropertyUserLinks;
1063
+ * </code>
1064
+ */
1065
+ class Google_ManagementWebpropertyUserLinksServiceResource extends Google_ServiceResource {
1066
+
1067
+ /**
1068
+ * Removes a user from the given web property. (webpropertyUserLinks.delete)
1069
+ *
1070
+ * @param string $accountId Account ID to delete the user link for.
1071
+ * @param string $webPropertyId Web Property ID to delete the user link for.
1072
+ * @param string $linkId Link ID to delete the user link for.
1073
+ * @param array $optParams Optional parameters.
1074
+ */
1075
+ public function delete($accountId, $webPropertyId, $linkId, $optParams = array()) {
1076
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'linkId' => $linkId);
1077
+ $params = array_merge($params, $optParams);
1078
+ $data = $this->__call('delete', array($params));
1079
+ return $data;
1080
+ }
1081
+ /**
1082
+ * Adds a new user to the given web property. (webpropertyUserLinks.insert)
1083
+ *
1084
+ * @param string $accountId Account ID to create the user link for.
1085
+ * @param string $webPropertyId Web Property ID to create the user link for.
1086
+ * @param Google_EntityUserLink $postBody
1087
+ * @param array $optParams Optional parameters.
1088
+ * @return Google_EntityUserLink
1089
+ */
1090
+ public function insert($accountId, $webPropertyId, Google_EntityUserLink $postBody, $optParams = array()) {
1091
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody);
1092
+ $params = array_merge($params, $optParams);
1093
+ $data = $this->__call('insert', array($params));
1094
+ if ($this->useObjects()) {
1095
+ return new Google_EntityUserLink($data);
1096
+ } else {
1097
+ return $data;
1098
+ }
1099
+ }
1100
+ /**
1101
+ * Lists webProperty-user links for a given web property.
1102
+ * (webpropertyUserLinks.list)
1103
+ *
1104
+ * @param string $accountId Account ID which the given web property belongs to.
1105
+ * @param string $webPropertyId Web Property ID for the webProperty-user links to retrieve.
1106
+ * @param array $optParams Optional parameters.
1107
+ *
1108
+ * @opt_param int max-results The maximum number of webProperty-user Links to include in this response.
1109
+ * @opt_param int start-index An index of the first webProperty-user link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
1110
+ * @return Google_EntityUserLinks
1111
+ */
1112
+ public function listManagementWebpropertyUserLinks($accountId, $webPropertyId, $optParams = array()) {
1113
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId);
1114
+ $params = array_merge($params, $optParams);
1115
+ $data = $this->__call('list', array($params));
1116
+ if ($this->useObjects()) {
1117
+ return new Google_EntityUserLinks($data);
1118
+ } else {
1119
+ return $data;
1120
+ }
1121
+ }
1122
+ /**
1123
+ * Updates permissions for an existing user on the given web property.
1124
+ * (webpropertyUserLinks.update)
1125
+ *
1126
+ * @param string $accountId Account ID to update the account-user link for.
1127
+ * @param string $webPropertyId Web property ID to update the account-user link for.
1128
+ * @param string $linkId Link ID to update the account-user link for.
1129
+ * @param Google_EntityUserLink $postBody
1130
+ * @param array $optParams Optional parameters.
1131
+ * @return Google_EntityUserLink
1132
+ */
1133
+ public function update($accountId, $webPropertyId, $linkId, Google_EntityUserLink $postBody, $optParams = array()) {
1134
+ $params = array('accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'linkId' => $linkId, 'postBody' => $postBody);
1135
+ $params = array_merge($params, $optParams);
1136
+ $data = $this->__call('update', array($params));
1137
+ if ($this->useObjects()) {
1138
+ return new Google_EntityUserLink($data);
1139
+ } else {
1140
+ return $data;
1141
+ }
1142
+ }
1143
+ }
1144
+
1145
+ /**
1146
+ * The "metadata" collection of methods.
1147
+ * Typical usage is:
1148
+ * <code>
1149
+ * $analyticsService = new Google_AnalyticsService(...);
1150
+ * $metadata = $analyticsService->metadata;
1151
+ * </code>
1152
+ */
1153
+ class Google_MetadataServiceResource extends Google_ServiceResource {
1154
+
1155
+ }
1156
+
1157
+ /**
1158
+ * The "columns" collection of methods.
1159
+ * Typical usage is:
1160
+ * <code>
1161
+ * $analyticsService = new Google_AnalyticsService(...);
1162
+ * $columns = $analyticsService->columns;
1163
+ * </code>
1164
+ */
1165
+ class Google_MetadataColumnsServiceResource extends Google_ServiceResource {
1166
+
1167
+ /**
1168
+ * Lists all columns for a report type (columns.list)
1169
+ *
1170
+ * @param string $reportType Report type. Allowed Values: 'ga'. Where 'ga' corresponds to the Core Reporting API
1171
+ * @param array $optParams Optional parameters.
1172
+ * @return Google_Columns
1173
+ */
1174
+ public function listMetadataColumns($reportType, $optParams = array()) {
1175
+ $params = array('reportType' => $reportType);
1176
+ $params = array_merge($params, $optParams);
1177
+ $data = $this->__call('list', array($params));
1178
+ if ($this->useObjects()) {
1179
+ return new Google_Columns($data);
1180
+ } else {
1181
+ return $data;
1182
+ }
1183
+ }
1184
+ }
1185
+
1186
+ /**
1187
+ * Service definition for Google_Analytics (v3).
1188
+ *
1189
+ * <p>
1190
+ * View and manage your Google Analytics data
1191
+ * </p>
1192
+ *
1193
+ * <p>
1194
+ * For more information about this service, see the
1195
+ * <a href="https://developers.google.com/analytics/" target="_blank">API Documentation</a>
1196
+ * </p>
1197
+ *
1198
+ * @author Google, Inc.
1199
+ */
1200
+ class Google_AnalyticsService extends Google_Service {
1201
+ public $data_ga;
1202
+ public $data_mcf;
1203
+ public $data_realtime;
1204
+ public $management_accountUserLinks;
1205
+ public $management_accounts;
1206
+ public $management_customDataSources;
1207
+ public $management_dailyUploads;
1208
+ public $management_experiments;
1209
+ public $management_goals;
1210
+ public $management_profileUserLinks;
1211
+ public $management_profiles;
1212
+ public $management_segments;
1213
+ public $management_uploads;
1214
+ public $management_webproperties;
1215
+ public $management_webpropertyUserLinks;
1216
+ public $metadata_columns;
1217
+ /**
1218
+ * Constructs the internal representation of the Analytics service.
1219
+ *
1220
+ * @param Google_Client $client
1221
+ */
1222
+ public function __construct(Google_Client $client) {
1223
+ $this->servicePath = 'analytics/v3/';
1224
+ $this->version = 'v3';
1225
+ $this->serviceName = 'analytics';
1226
+
1227
+ $client->addService($this->serviceName, $this->version);
1228
+ $this->data_ga = new Google_DataGaServiceResource($this, $this->serviceName, 'ga', json_decode('{"methods": {"get": {"id": "analytics.data.ga.get", "path": "data/ga", "httpMethod": "GET", "parameters": {"dimensions": {"type": "string", "location": "query"}, "end-date": {"type": "string", "required": true, "location": "query"}, "filters": {"type": "string", "location": "query"}, "ids": {"type": "string", "required": true, "location": "query"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "metrics": {"type": "string", "required": true, "location": "query"}, "segment": {"type": "string", "location": "query"}, "sort": {"type": "string", "location": "query"}, "start-date": {"type": "string", "required": true, "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "GaData"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1229
+ $this->data_mcf = new Google_DataMcfServiceResource($this, $this->serviceName, 'mcf', json_decode('{"methods": {"get": {"id": "analytics.data.mcf.get", "path": "data/mcf", "httpMethod": "GET", "parameters": {"dimensions": {"type": "string", "location": "query"}, "end-date": {"type": "string", "required": true, "location": "query"}, "filters": {"type": "string", "location": "query"}, "ids": {"type": "string", "required": true, "location": "query"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "metrics": {"type": "string", "required": true, "location": "query"}, "sort": {"type": "string", "location": "query"}, "start-date": {"type": "string", "required": true, "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "McfData"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1230
+ $this->data_realtime = new Google_DataRealtimeServiceResource($this, $this->serviceName, 'realtime', json_decode('{"methods": {"get": {"id": "analytics.data.realtime.get", "path": "data/realtime", "httpMethod": "GET", "parameters": {"dimensions": {"type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "ids": {"type": "string", "required": true, "location": "query"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "metrics": {"type": "string", "required": true, "location": "query"}, "sort": {"type": "string", "location": "query"}}, "response": {"$ref": "RealtimeData"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1231
+ $this->management_accountUserLinks = new Google_ManagementAccountUserLinksServiceResource($this, $this->serviceName, 'accountUserLinks', json_decode('{"methods": {"delete": {"id": "analytics.management.accountUserLinks.delete", "path": "management/accounts/{accountId}/entityUserLinks/{linkId}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "linkId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "insert": {"id": "analytics.management.accountUserLinks.insert", "path": "management/accounts/{accountId}/entityUserLinks", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "EntityUserLink"}, "response": {"$ref": "EntityUserLink"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "list": {"id": "analytics.management.accountUserLinks.list", "path": "management/accounts/{accountId}/entityUserLinks", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "EntityUserLinks"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "update": {"id": "analytics.management.accountUserLinks.update", "path": "management/accounts/{accountId}/entityUserLinks/{linkId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "linkId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "EntityUserLink"}, "response": {"$ref": "EntityUserLink"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}}}', true));
1232
+ $this->management_accounts = new Google_ManagementAccountsServiceResource($this, $this->serviceName, 'accounts', json_decode('{"methods": {"list": {"id": "analytics.management.accounts.list", "path": "management/accounts", "httpMethod": "GET", "parameters": {"max-results": {"type": "integer", "format": "int32", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "Accounts"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1233
+ $this->management_customDataSources = new Google_ManagementCustomDataSourcesServiceResource($this, $this->serviceName, 'customDataSources', json_decode('{"methods": {"list": {"id": "analytics.management.customDataSources.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "CustomDataSources"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1234
+ $this->management_dailyUploads = new Google_ManagementDailyUploadsServiceResource($this, $this->serviceName, 'dailyUploads', json_decode('{"methods": {"delete": {"id": "analytics.management.dailyUploads.delete", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/dailyUploads/{date}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "date": {"type": "string", "required": true, "location": "path"}, "type": {"type": "string", "required": true, "enum": ["cost"], "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "list": {"id": "analytics.management.dailyUploads.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/dailyUploads", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "end-date": {"type": "string", "required": true, "location": "query"}, "max-results": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "start-date": {"type": "string", "required": true, "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "DailyUploads"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "upload": {"id": "analytics.management.dailyUploads.upload", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/dailyUploads/{date}/uploads", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "appendNumber": {"type": "integer", "required": true, "format": "int32", "minimum": "1", "maximum": "20", "location": "query"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "date": {"type": "string", "required": true, "location": "path"}, "reset": {"type": "boolean", "default": "false", "location": "query"}, "type": {"type": "string", "required": true, "enum": ["cost"], "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "DailyUploadAppend"}, "scopes": ["https://www.googleapis.com/auth/analytics"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["application/octet-stream"], "maxSize": "5MB", "protocols": {"simple": {"multipart": true, "path": "/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/dailyUploads/{date}/uploads"}, "resumable": {"multipart": true, "path": "/resumable/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/dailyUploads/{date}/uploads"}}}}}}', true));
1235
+ $this->management_experiments = new Google_ManagementExperimentsServiceResource($this, $this->serviceName, 'experiments', json_decode('{"methods": {"delete": {"id": "analytics.management.experiments.delete", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "experimentId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "get": {"id": "analytics.management.experiments.get", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "experimentId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Experiment"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "insert": {"id": "analytics.management.experiments.insert", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Experiment"}, "response": {"$ref": "Experiment"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "list": {"id": "analytics.management.experiments.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "profileId": {"type": "string", "required": true, "location": "path"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Experiments"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "patch": {"id": "analytics.management.experiments.patch", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}", "httpMethod": "PATCH", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "experimentId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Experiment"}, "response": {"$ref": "Experiment"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "update": {"id": "analytics.management.experiments.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "experimentId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Experiment"}, "response": {"$ref": "Experiment"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}}}', true));
1236
+ $this->management_goals = new Google_ManagementGoalsServiceResource($this, $this->serviceName, 'goals', json_decode('{"methods": {"get": {"id": "analytics.management.goals.get", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "goalId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Goal"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "insert": {"id": "analytics.management.goals.insert", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Goal"}, "response": {"$ref": "Goal"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "list": {"id": "analytics.management.goals.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "profileId": {"type": "string", "required": true, "location": "path"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Goals"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "patch": {"id": "analytics.management.goals.patch", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}", "httpMethod": "PATCH", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "goalId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Goal"}, "response": {"$ref": "Goal"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "update": {"id": "analytics.management.goals.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "goalId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Goal"}, "response": {"$ref": "Goal"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}}}', true));
1237
+ $this->management_profileUserLinks = new Google_ManagementProfileUserLinksServiceResource($this, $this->serviceName, 'profileUserLinks', json_decode('{"methods": {"delete": {"id": "analytics.management.profileUserLinks.delete", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks/{linkId}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "linkId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "insert": {"id": "analytics.management.profileUserLinks.insert", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "EntityUserLink"}, "response": {"$ref": "EntityUserLink"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "list": {"id": "analytics.management.profileUserLinks.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "profileId": {"type": "string", "required": true, "location": "path"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "EntityUserLinks"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "update": {"id": "analytics.management.profileUserLinks.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks/{linkId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "linkId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "EntityUserLink"}, "response": {"$ref": "EntityUserLink"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}}}', true));
1238
+ $this->management_profiles = new Google_ManagementProfilesServiceResource($this, $this->serviceName, 'profiles', json_decode('{"methods": {"delete": {"id": "analytics.management.profiles.delete", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "get": {"id": "analytics.management.profiles.get", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Profile"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "insert": {"id": "analytics.management.profiles.insert", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Profile"}, "response": {"$ref": "Profile"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "list": {"id": "analytics.management.profiles.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Profiles"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "patch": {"id": "analytics.management.profiles.patch", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}", "httpMethod": "PATCH", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Profile"}, "response": {"$ref": "Profile"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "update": {"id": "analytics.management.profiles.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "profileId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Profile"}, "response": {"$ref": "Profile"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}}}', true));
1239
+ $this->management_segments = new Google_ManagementSegmentsServiceResource($this, $this->serviceName, 'segments', json_decode('{"methods": {"list": {"id": "analytics.management.segments.list", "path": "management/segments", "httpMethod": "GET", "parameters": {"max-results": {"type": "integer", "format": "int32", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "Segments"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1240
+ $this->management_uploads = new Google_ManagementUploadsServiceResource($this, $this->serviceName, 'uploads', json_decode('{"methods": {"deleteUploadData": {"id": "analytics.management.uploads.deleteUploadData", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/deleteUploadData", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "AnalyticsDataimportDeleteUploadDataRequest"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "get": {"id": "analytics.management.uploads.get", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads/{uploadId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "uploadId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Upload"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "list": {"id": "analytics.management.uploads.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Uploads"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "uploadData": {"id": "analytics.management.uploads.uploadData", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "customDataSourceId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Upload"}, "scopes": ["https://www.googleapis.com/auth/analytics"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["application/octet-stream"], "maxSize": "1GB", "protocols": {"simple": {"multipart": true, "path": "/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads"}, "resumable": {"multipart": true, "path": "/resumable/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads"}}}}}}', true));
1241
+ $this->management_webproperties = new Google_ManagementWebpropertiesServiceResource($this, $this->serviceName, 'webproperties', json_decode('{"methods": {"get": {"id": "analytics.management.webproperties.get", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Webproperty"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "insert": {"id": "analytics.management.webproperties.insert", "path": "management/accounts/{accountId}/webproperties", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Webproperty"}, "response": {"$ref": "Webproperty"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "list": {"id": "analytics.management.webproperties.list", "path": "management/accounts/{accountId}/webproperties", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "Webproperties"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}, "patch": {"id": "analytics.management.webproperties.patch", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}", "httpMethod": "PATCH", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Webproperty"}, "response": {"$ref": "Webproperty"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}, "update": {"id": "analytics.management.webproperties.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Webproperty"}, "response": {"$ref": "Webproperty"}, "scopes": ["https://www.googleapis.com/auth/analytics"]}}}', true));
1242
+ $this->management_webpropertyUserLinks = new Google_ManagementWebpropertyUserLinksServiceResource($this, $this->serviceName, 'webpropertyUserLinks', json_decode('{"methods": {"delete": {"id": "analytics.management.webpropertyUserLinks.delete", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks/{linkId}", "httpMethod": "DELETE", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "linkId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "insert": {"id": "analytics.management.webpropertyUserLinks.insert", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks", "httpMethod": "POST", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "EntityUserLink"}, "response": {"$ref": "EntityUserLink"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "list": {"id": "analytics.management.webpropertyUserLinks.list", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks", "httpMethod": "GET", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "max-results": {"type": "integer", "format": "int32", "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "EntityUserLinks"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}, "update": {"id": "analytics.management.webpropertyUserLinks.update", "path": "management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks/{linkId}", "httpMethod": "PUT", "parameters": {"accountId": {"type": "string", "required": true, "location": "path"}, "linkId": {"type": "string", "required": true, "location": "path"}, "webPropertyId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "EntityUserLink"}, "response": {"$ref": "EntityUserLink"}, "scopes": ["https://www.googleapis.com/auth/analytics.manage.users"]}}}', true));
1243
+ $this->metadata_columns = new Google_MetadataColumnsServiceResource($this, $this->serviceName, 'columns', json_decode('{"methods": {"list": {"id": "analytics.metadata.columns.list", "path": "metadata/{reportType}/columns", "httpMethod": "GET", "parameters": {"reportType": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Columns"}, "scopes": ["https://www.googleapis.com/auth/analytics", "https://www.googleapis.com/auth/analytics.readonly"]}}}', true));
1244
+
1245
+ }
1246
+ }
1247
+
1248
+
1249
+
1250
+ class Google_Account extends Google_Model {
1251
+ protected $__childLinkType = 'Google_AccountChildLink';
1252
+ protected $__childLinkDataType = '';
1253
+ public $childLink;
1254
+ public $created;
1255
+ public $id;
1256
+ public $kind;
1257
+ public $name;
1258
+ protected $__permissionsType = 'Google_AccountPermissions';
1259
+ protected $__permissionsDataType = '';
1260
+ public $permissions;
1261
+ public $selfLink;
1262
+ public $updated;
1263
+ public function setChildLink(Google_AccountChildLink $childLink) {
1264
+ $this->childLink = $childLink;
1265
+ }
1266
+ public function getChildLink() {
1267
+ return $this->childLink;
1268
+ }
1269
+ public function setCreated( $created) {
1270
+ $this->created = $created;
1271
+ }
1272
+ public function getCreated() {
1273
+ return $this->created;
1274
+ }
1275
+ public function setId( $id) {
1276
+ $this->id = $id;
1277
+ }
1278
+ public function getId() {
1279
+ return $this->id;
1280
+ }
1281
+ public function setKind( $kind) {
1282
+ $this->kind = $kind;
1283
+ }
1284
+ public function getKind() {
1285
+ return $this->kind;
1286
+ }
1287
+ public function setName( $name) {
1288
+ $this->name = $name;
1289
+ }
1290
+ public function getName() {
1291
+ return $this->name;
1292
+ }
1293
+ public function setPermissions(Google_AccountPermissions $permissions) {
1294
+ $this->permissions = $permissions;
1295
+ }
1296
+ public function getPermissions() {
1297
+ return $this->permissions;
1298
+ }
1299
+ public function setSelfLink( $selfLink) {
1300
+ $this->selfLink = $selfLink;
1301
+ }
1302
+ public function getSelfLink() {
1303
+ return $this->selfLink;
1304
+ }
1305
+ public function setUpdated( $updated) {
1306
+ $this->updated = $updated;
1307
+ }
1308
+ public function getUpdated() {
1309
+ return $this->updated;
1310
+ }
1311
+ }
1312
+
1313
+ class Google_AccountChildLink extends Google_Model {
1314
+ public $href;
1315
+ public $type;
1316
+ public function setHref( $href) {
1317
+ $this->href = $href;
1318
+ }
1319
+ public function getHref() {
1320
+ return $this->href;
1321
+ }
1322
+ public function setType( $type) {
1323
+ $this->type = $type;
1324
+ }
1325
+ public function getType() {
1326
+ return $this->type;
1327
+ }
1328
+ }
1329
+
1330
+ class Google_AccountPermissions extends Google_Model {
1331
+ public $effective;
1332
+ public function setEffective(/* array(Google_string) */ $effective) {
1333
+ $this->assertIsArray($effective, 'Google_string', __METHOD__);
1334
+ $this->effective = $effective;
1335
+ }
1336
+ public function getEffective() {
1337
+ return $this->effective;
1338
+ }
1339
+ }
1340
+
1341
+ class Google_AccountRef extends Google_Model {
1342
+ public $href;
1343
+ public $id;
1344
+ public $kind;
1345
+ public $name;
1346
+ public function setHref( $href) {
1347
+ $this->href = $href;
1348
+ }
1349
+ public function getHref() {
1350
+ return $this->href;
1351
+ }
1352
+ public function setId( $id) {
1353
+ $this->id = $id;
1354
+ }
1355
+ public function getId() {
1356
+ return $this->id;
1357
+ }
1358
+ public function setKind( $kind) {
1359
+ $this->kind = $kind;
1360
+ }
1361
+ public function getKind() {
1362
+ return $this->kind;
1363
+ }
1364
+ public function setName( $name) {
1365
+ $this->name = $name;
1366
+ }
1367
+ public function getName() {
1368
+ return $this->name;
1369
+ }
1370
+ }
1371
+
1372
+ class Google_Accounts extends Google_Model {
1373
+ protected $__itemsType = 'Google_Account';
1374
+ protected $__itemsDataType = 'array';
1375
+ public $items;
1376
+ public $itemsPerPage;
1377
+ public $kind;
1378
+ public $nextLink;
1379
+ public $previousLink;
1380
+ public $startIndex;
1381
+ public $totalResults;
1382
+ public $username;
1383
+ public function setItems(/* array(Google_Account) */ $items) {
1384
+ $this->assertIsArray($items, 'Google_Account', __METHOD__);
1385
+ $this->items = $items;
1386
+ }
1387
+ public function getItems() {
1388
+ return $this->items;
1389
+ }
1390
+ public function setItemsPerPage( $itemsPerPage) {
1391
+ $this->itemsPerPage = $itemsPerPage;
1392
+ }
1393
+ public function getItemsPerPage() {
1394
+ return $this->itemsPerPage;
1395
+ }
1396
+ public function setKind( $kind) {
1397
+ $this->kind = $kind;
1398
+ }
1399
+ public function getKind() {
1400
+ return $this->kind;
1401
+ }
1402
+ public function setNextLink( $nextLink) {
1403
+ $this->nextLink = $nextLink;
1404
+ }
1405
+ public function getNextLink() {
1406
+ return $this->nextLink;
1407
+ }
1408
+ public function setPreviousLink( $previousLink) {
1409
+ $this->previousLink = $previousLink;
1410
+ }
1411
+ public function getPreviousLink() {
1412
+ return $this->previousLink;
1413
+ }
1414
+ public function setStartIndex( $startIndex) {
1415
+ $this->startIndex = $startIndex;
1416
+ }
1417
+ public function getStartIndex() {
1418
+ return $this->startIndex;
1419
+ }
1420
+ public function setTotalResults( $totalResults) {
1421
+ $this->totalResults = $totalResults;
1422
+ }
1423
+ public function getTotalResults() {
1424
+ return $this->totalResults;
1425
+ }
1426
+ public function setUsername( $username) {
1427
+ $this->username = $username;
1428
+ }
1429
+ public function getUsername() {
1430
+ return $this->username;
1431
+ }
1432
+ }
1433
+
1434
+ class Google_AnalyticsDataimportDeleteUploadDataRequest extends Google_Model {
1435
+ public $customDataImportUids;
1436
+ public function setCustomDataImportUids(/* array(Google_string) */ $customDataImportUids) {
1437
+ $this->assertIsArray($customDataImportUids, 'Google_string', __METHOD__);
1438
+ $this->customDataImportUids = $customDataImportUids;
1439
+ }
1440
+ public function getCustomDataImportUids() {
1441
+ return $this->customDataImportUids;
1442
+ }
1443
+ }
1444
+
1445
+ class Google_Column extends Google_Model {
1446
+ public $attributes;
1447
+ public $id;
1448
+ public $kind;
1449
+ public function setAttributes( $attributes) {
1450
+ $this->attributes = $attributes;
1451
+ }
1452
+ public function getAttributes() {
1453
+ return $this->attributes;
1454
+ }
1455
+ public function setId( $id) {
1456
+ $this->id = $id;
1457
+ }
1458
+ public function getId() {
1459
+ return $this->id;
1460
+ }
1461
+ public function setKind( $kind) {
1462
+ $this->kind = $kind;
1463
+ }
1464
+ public function getKind() {
1465
+ return $this->kind;
1466
+ }
1467
+ }
1468
+
1469
+ class Google_Columns extends Google_Model {
1470
+ public $attributeNames;
1471
+ public $etag;
1472
+ protected $__itemsType = 'Google_Column';
1473
+ protected $__itemsDataType = 'array';
1474
+ public $items;
1475
+ public $kind;
1476
+ public $totalResults;
1477
+ public function setAttributeNames(/* array(Google_string) */ $attributeNames) {
1478
+ $this->assertIsArray($attributeNames, 'Google_string', __METHOD__);
1479
+ $this->attributeNames = $attributeNames;
1480
+ }
1481
+ public function getAttributeNames() {
1482
+ return $this->attributeNames;
1483
+ }
1484
+ public function setEtag( $etag) {
1485
+ $this->etag = $etag;
1486
+ }
1487
+ public function getEtag() {
1488
+ return $this->etag;
1489
+ }
1490
+ public function setItems(/* array(Google_Column) */ $items) {
1491
+ $this->assertIsArray($items, 'Google_Column', __METHOD__);
1492
+ $this->items = $items;
1493
+ }
1494
+ public function getItems() {
1495
+ return $this->items;
1496
+ }
1497
+ public function setKind( $kind) {
1498
+ $this->kind = $kind;
1499
+ }
1500
+ public function getKind() {
1501
+ return $this->kind;
1502
+ }
1503
+ public function setTotalResults( $totalResults) {
1504
+ $this->totalResults = $totalResults;
1505
+ }
1506
+ public function getTotalResults() {
1507
+ return $this->totalResults;
1508
+ }
1509
+ }
1510
+
1511
+ class Google_CustomDataSource extends Google_Model {
1512
+ public $accountId;
1513
+ protected $__childLinkType = 'Google_CustomDataSourceChildLink';
1514
+ protected $__childLinkDataType = '';
1515
+ public $childLink;
1516
+ public $created;
1517
+ public $description;
1518
+ public $id;
1519
+ public $kind;
1520
+ public $name;
1521
+ protected $__parentLinkType = 'Google_CustomDataSourceParentLink';
1522
+ protected $__parentLinkDataType = '';
1523
+ public $parentLink;
1524
+ public $profilesLinked;
1525
+ public $selfLink;
1526
+ public $type;
1527
+ public $updated;
1528
+ public $webPropertyId;
1529
+ public function setAccountId( $accountId) {
1530
+ $this->accountId = $accountId;
1531
+ }
1532
+ public function getAccountId() {
1533
+ return $this->accountId;
1534
+ }
1535
+ public function setChildLink(Google_CustomDataSourceChildLink $childLink) {
1536
+ $this->childLink = $childLink;
1537
+ }
1538
+ public function getChildLink() {
1539
+ return $this->childLink;
1540
+ }
1541
+ public function setCreated( $created) {
1542
+ $this->created = $created;
1543
+ }
1544
+ public function getCreated() {
1545
+ return $this->created;
1546
+ }
1547
+ public function setDescription( $description) {
1548
+ $this->description = $description;
1549
+ }
1550
+ public function getDescription() {
1551
+ return $this->description;
1552
+ }
1553
+ public function setId( $id) {
1554
+ $this->id = $id;
1555
+ }
1556
+ public function getId() {
1557
+ return $this->id;
1558
+ }
1559
+ public function setKind( $kind) {
1560
+ $this->kind = $kind;
1561
+ }
1562
+ public function getKind() {
1563
+ return $this->kind;
1564
+ }
1565
+ public function setName( $name) {
1566
+ $this->name = $name;
1567
+ }
1568
+ public function getName() {
1569
+ return $this->name;
1570
+ }
1571
+ public function setParentLink(Google_CustomDataSourceParentLink $parentLink) {
1572
+ $this->parentLink = $parentLink;
1573
+ }
1574
+ public function getParentLink() {
1575
+ return $this->parentLink;
1576
+ }
1577
+ public function setProfilesLinked(/* array(Google_string) */ $profilesLinked) {
1578
+ $this->assertIsArray($profilesLinked, 'Google_string', __METHOD__);
1579
+ $this->profilesLinked = $profilesLinked;
1580
+ }
1581
+ public function getProfilesLinked() {
1582
+ return $this->profilesLinked;
1583
+ }
1584
+ public function setSelfLink( $selfLink) {
1585
+ $this->selfLink = $selfLink;
1586
+ }
1587
+ public function getSelfLink() {
1588
+ return $this->selfLink;
1589
+ }
1590
+ public function setType( $type) {
1591
+ $this->type = $type;
1592
+ }
1593
+ public function getType() {
1594
+ return $this->type;
1595
+ }
1596
+ public function setUpdated( $updated) {
1597
+ $this->updated = $updated;
1598
+ }
1599
+ public function getUpdated() {
1600
+ return $this->updated;
1601
+ }
1602
+ public function setWebPropertyId( $webPropertyId) {
1603
+ $this->webPropertyId = $webPropertyId;
1604
+ }
1605
+ public function getWebPropertyId() {
1606
+ return $this->webPropertyId;
1607
+ }
1608
+ }
1609
+
1610
+ class Google_CustomDataSourceChildLink extends Google_Model {
1611
+ public $href;
1612
+ public $type;
1613
+ public function setHref( $href) {
1614
+ $this->href = $href;
1615
+ }
1616
+ public function getHref() {
1617
+ return $this->href;
1618
+ }
1619
+ public function setType( $type) {
1620
+ $this->type = $type;
1621
+ }
1622
+ public function getType() {
1623
+ return $this->type;
1624
+ }
1625
+ }
1626
+
1627
+ class Google_CustomDataSourceParentLink extends Google_Model {
1628
+ public $href;
1629
+ public $type;
1630
+ public function setHref( $href) {
1631
+ $this->href = $href;
1632
+ }
1633
+ public function getHref() {
1634
+ return $this->href;
1635
+ }
1636
+ public function setType( $type) {
1637
+ $this->type = $type;
1638
+ }
1639
+ public function getType() {
1640
+ return $this->type;
1641
+ }
1642
+ }
1643
+
1644
+ class Google_CustomDataSources extends Google_Model {
1645
+ protected $__itemsType = 'Google_CustomDataSource';
1646
+ protected $__itemsDataType = 'array';
1647
+ public $items;
1648
+ public $itemsPerPage;
1649
+ public $kind;
1650
+ public $nextLink;
1651
+ public $previousLink;
1652
+ public $startIndex;
1653
+ public $totalResults;
1654
+ public $username;
1655
+ public function setItems(/* array(Google_CustomDataSource) */ $items) {
1656
+ $this->assertIsArray($items, 'Google_CustomDataSource', __METHOD__);
1657
+ $this->items = $items;
1658
+ }
1659
+ public function getItems() {
1660
+ return $this->items;
1661
+ }
1662
+ public function setItemsPerPage( $itemsPerPage) {
1663
+ $this->itemsPerPage = $itemsPerPage;
1664
+ }
1665
+ public function getItemsPerPage() {
1666
+ return $this->itemsPerPage;
1667
+ }
1668
+ public function setKind( $kind) {
1669
+ $this->kind = $kind;
1670
+ }
1671
+ public function getKind() {
1672
+ return $this->kind;
1673
+ }
1674
+ public function setNextLink( $nextLink) {
1675
+ $this->nextLink = $nextLink;
1676
+ }
1677
+ public function getNextLink() {
1678
+ return $this->nextLink;
1679
+ }
1680
+ public function setPreviousLink( $previousLink) {
1681
+ $this->previousLink = $previousLink;
1682
+ }
1683
+ public function getPreviousLink() {
1684
+ return $this->previousLink;
1685
+ }
1686
+ public function setStartIndex( $startIndex) {
1687
+ $this->startIndex = $startIndex;
1688
+ }
1689
+ public function getStartIndex() {
1690
+ return $this->startIndex;
1691
+ }
1692
+ public function setTotalResults( $totalResults) {
1693
+ $this->totalResults = $totalResults;
1694
+ }
1695
+ public function getTotalResults() {
1696
+ return $this->totalResults;
1697
+ }
1698
+ public function setUsername( $username) {
1699
+ $this->username = $username;
1700
+ }
1701
+ public function getUsername() {
1702
+ return $this->username;
1703
+ }
1704
+ }
1705
+
1706
+ class Google_DailyUpload extends Google_Model {
1707
+ public $accountId;
1708
+ public $appendCount;
1709
+ public $createdTime;
1710
+ public $customDataSourceId;
1711
+ public $date;
1712
+ public $kind;
1713
+ public $modifiedTime;
1714
+ protected $__parentLinkType = 'Google_DailyUploadParentLink';
1715
+ protected $__parentLinkDataType = '';
1716
+ public $parentLink;
1717
+ protected $__recentChangesType = 'Google_DailyUploadRecentChanges';
1718
+ protected $__recentChangesDataType = 'array';
1719
+ public $recentChanges;
1720
+ public $selfLink;
1721
+ public $webPropertyId;
1722
+ public function setAccountId( $accountId) {
1723
+ $this->accountId = $accountId;
1724
+ }
1725
+ public function getAccountId() {
1726
+ return $this->accountId;
1727
+ }
1728
+ public function setAppendCount( $appendCount) {
1729
+ $this->appendCount = $appendCount;
1730
+ }
1731
+ public function getAppendCount() {
1732
+ return $this->appendCount;
1733
+ }
1734
+ public function setCreatedTime( $createdTime) {
1735
+ $this->createdTime = $createdTime;
1736
+ }
1737
+ public function getCreatedTime() {
1738
+ return $this->createdTime;
1739
+ }
1740
+ public function setCustomDataSourceId( $customDataSourceId) {
1741
+ $this->customDataSourceId = $customDataSourceId;
1742
+ }
1743
+ public function getCustomDataSourceId() {
1744
+ return $this->customDataSourceId;
1745
+ }
1746
+ public function setDate( $date) {
1747
+ $this->date = $date;
1748
+ }
1749
+ public function getDate() {
1750
+ return $this->date;
1751
+ }
1752
+ public function setKind( $kind) {
1753
+ $this->kind = $kind;
1754
+ }
1755
+ public function getKind() {
1756
+ return $this->kind;
1757
+ }
1758
+ public function setModifiedTime( $modifiedTime) {
1759
+ $this->modifiedTime = $modifiedTime;
1760
+ }
1761
+ public function getModifiedTime() {
1762
+ return $this->modifiedTime;
1763
+ }
1764
+ public function setParentLink(Google_DailyUploadParentLink $parentLink) {
1765
+ $this->parentLink = $parentLink;
1766
+ }
1767
+ public function getParentLink() {
1768
+ return $this->parentLink;
1769
+ }
1770
+ public function setRecentChanges(/* array(Google_DailyUploadRecentChanges) */ $recentChanges) {
1771
+ $this->assertIsArray($recentChanges, 'Google_DailyUploadRecentChanges', __METHOD__);
1772
+ $this->recentChanges = $recentChanges;
1773
+ }
1774
+ public function getRecentChanges() {
1775
+ return $this->recentChanges;
1776
+ }
1777
+ public function setSelfLink( $selfLink) {
1778
+ $this->selfLink = $selfLink;
1779
+ }
1780
+ public function getSelfLink() {
1781
+ return $this->selfLink;
1782
+ }
1783
+ public function setWebPropertyId( $webPropertyId) {
1784
+ $this->webPropertyId = $webPropertyId;
1785
+ }
1786
+ public function getWebPropertyId() {
1787
+ return $this->webPropertyId;
1788
+ }
1789
+ }
1790
+
1791
+ class Google_DailyUploadAppend extends Google_Model {
1792
+ public $accountId;
1793
+ public $appendNumber;
1794
+ public $customDataSourceId;
1795
+ public $date;
1796
+ public $kind;
1797
+ public $nextAppendLink;
1798
+ public $webPropertyId;
1799
+ public function setAccountId( $accountId) {
1800
+ $this->accountId = $accountId;
1801
+ }
1802
+ public function getAccountId() {
1803
+ return $this->accountId;
1804
+ }
1805
+ public function setAppendNumber( $appendNumber) {
1806
+ $this->appendNumber = $appendNumber;
1807
+ }
1808
+ public function getAppendNumber() {
1809
+ return $this->appendNumber;
1810
+ }
1811
+ public function setCustomDataSourceId( $customDataSourceId) {
1812
+ $this->customDataSourceId = $customDataSourceId;
1813
+ }
1814
+ public function getCustomDataSourceId() {
1815
+ return $this->customDataSourceId;
1816
+ }
1817
+ public function setDate( $date) {
1818
+ $this->date = $date;
1819
+ }
1820
+ public function getDate() {
1821
+ return $this->date;
1822
+ }
1823
+ public function setKind( $kind) {
1824
+ $this->kind = $kind;
1825
+ }
1826
+ public function getKind() {
1827
+ return $this->kind;
1828
+ }
1829
+ public function setNextAppendLink( $nextAppendLink) {
1830
+ $this->nextAppendLink = $nextAppendLink;
1831
+ }
1832
+ public function getNextAppendLink() {
1833
+ return $this->nextAppendLink;
1834
+ }
1835
+ public function setWebPropertyId( $webPropertyId) {
1836
+ $this->webPropertyId = $webPropertyId;
1837
+ }
1838
+ public function getWebPropertyId() {
1839
+ return $this->webPropertyId;
1840
+ }
1841
+ }
1842
+
1843
+ class Google_DailyUploadParentLink extends Google_Model {
1844
+ public $href;
1845
+ public $type;
1846
+ public function setHref( $href) {
1847
+ $this->href = $href;
1848
+ }
1849
+ public function getHref() {
1850
+ return $this->href;
1851
+ }
1852
+ public function setType( $type) {
1853
+ $this->type = $type;
1854
+ }
1855
+ public function getType() {
1856
+ return $this->type;
1857
+ }
1858
+ }
1859
+
1860
+ class Google_DailyUploadRecentChanges extends Google_Model {
1861
+ public $change;
1862
+ public $time;
1863
+ public function setChange( $change) {
1864
+ $this->change = $change;
1865
+ }
1866
+ public function getChange() {
1867
+ return $this->change;
1868
+ }
1869
+ public function setTime( $time) {
1870
+ $this->time = $time;
1871
+ }
1872
+ public function getTime() {
1873
+ return $this->time;
1874
+ }
1875
+ }
1876
+
1877
+ class Google_DailyUploads extends Google_Model {
1878
+ protected $__itemsType = 'Google_DailyUpload';
1879
+ protected $__itemsDataType = 'array';
1880
+ public $items;
1881
+ public $itemsPerPage;
1882
+ public $kind;
1883
+ public $nextLink;
1884
+ public $previousLink;
1885
+ public $startIndex;
1886
+ public $totalResults;
1887
+ public $username;
1888
+ public function setItems(/* array(Google_DailyUpload) */ $items) {
1889
+ $this->assertIsArray($items, 'Google_DailyUpload', __METHOD__);
1890
+ $this->items = $items;
1891
+ }
1892
+ public function getItems() {
1893
+ return $this->items;
1894
+ }
1895
+ public function setItemsPerPage( $itemsPerPage) {
1896
+ $this->itemsPerPage = $itemsPerPage;
1897
+ }
1898
+ public function getItemsPerPage() {
1899
+ return $this->itemsPerPage;
1900
+ }
1901
+ public function setKind( $kind) {
1902
+ $this->kind = $kind;
1903
+ }
1904
+ public function getKind() {
1905
+ return $this->kind;
1906
+ }
1907
+ public function setNextLink( $nextLink) {
1908
+ $this->nextLink = $nextLink;
1909
+ }
1910
+ public function getNextLink() {
1911
+ return $this->nextLink;
1912
+ }
1913
+ public function setPreviousLink( $previousLink) {
1914
+ $this->previousLink = $previousLink;
1915
+ }
1916
+ public function getPreviousLink() {
1917
+ return $this->previousLink;
1918
+ }
1919
+ public function setStartIndex( $startIndex) {
1920
+ $this->startIndex = $startIndex;
1921
+ }
1922
+ public function getStartIndex() {
1923
+ return $this->startIndex;
1924
+ }
1925
+ public function setTotalResults( $totalResults) {
1926
+ $this->totalResults = $totalResults;
1927
+ }
1928
+ public function getTotalResults() {
1929
+ return $this->totalResults;
1930
+ }
1931
+ public function setUsername( $username) {
1932
+ $this->username = $username;
1933
+ }
1934
+ public function getUsername() {
1935
+ return $this->username;
1936
+ }
1937
+ }
1938
+
1939
+ class Google_EntityUserLink extends Google_Model {
1940
+ protected $__entityType = 'Google_EntityUserLinkEntity';
1941
+ protected $__entityDataType = '';
1942
+ public $entity;
1943
+ public $id;
1944
+ public $kind;
1945
+ protected $__permissionsType = 'Google_EntityUserLinkPermissions';
1946
+ protected $__permissionsDataType = '';
1947
+ public $permissions;
1948
+ public $selfLink;
1949
+ protected $__userRefType = 'Google_UserRef';
1950
+ protected $__userRefDataType = '';
1951
+ public $userRef;
1952
+ public function setEntity(Google_EntityUserLinkEntity $entity) {
1953
+ $this->entity = $entity;
1954
+ }
1955
+ public function getEntity() {
1956
+ return $this->entity;
1957
+ }
1958
+ public function setId( $id) {
1959
+ $this->id = $id;
1960
+ }
1961
+ public function getId() {
1962
+ return $this->id;
1963
+ }
1964
+ public function setKind( $kind) {
1965
+ $this->kind = $kind;
1966
+ }
1967
+ public function getKind() {
1968
+ return $this->kind;
1969
+ }
1970
+ public function setPermissions(Google_EntityUserLinkPermissions $permissions) {
1971
+ $this->permissions = $permissions;
1972
+ }
1973
+ public function getPermissions() {
1974
+ return $this->permissions;
1975
+ }
1976
+ public function setSelfLink( $selfLink) {
1977
+ $this->selfLink = $selfLink;
1978
+ }
1979
+ public function getSelfLink() {
1980
+ return $this->selfLink;
1981
+ }
1982
+ public function setUserRef(Google_UserRef $userRef) {
1983
+ $this->userRef = $userRef;
1984
+ }
1985
+ public function getUserRef() {
1986
+ return $this->userRef;
1987
+ }
1988
+ }
1989
+
1990
+ class Google_EntityUserLinkEntity extends Google_Model {
1991
+ protected $__accountRefType = 'Google_AccountRef';
1992
+ protected $__accountRefDataType = '';
1993
+ public $accountRef;
1994
+ protected $__profileRefType = 'Google_ProfileRef';
1995
+ protected $__profileRefDataType = '';
1996
+ public $profileRef;
1997
+ protected $__webPropertyRefType = 'Google_WebPropertyRef';
1998
+ protected $__webPropertyRefDataType = '';
1999
+ public $webPropertyRef;
2000
+ public function setAccountRef(Google_AccountRef $accountRef) {
2001
+ $this->accountRef = $accountRef;
2002
+ }
2003
+ public function getAccountRef() {
2004
+ return $this->accountRef;
2005
+ }
2006
+ public function setProfileRef(Google_ProfileRef $profileRef) {
2007
+ $this->profileRef = $profileRef;
2008
+ }
2009
+ public function getProfileRef() {
2010
+ return $this->profileRef;
2011
+ }
2012
+ public function setWebPropertyRef(Google_WebPropertyRef $webPropertyRef) {
2013
+ $this->webPropertyRef = $webPropertyRef;
2014
+ }
2015
+ public function getWebPropertyRef() {
2016
+ return $this->webPropertyRef;
2017
+ }
2018
+ }
2019
+
2020
+ class Google_EntityUserLinkPermissions extends Google_Model {
2021
+ public $effective;
2022
+ public $local;
2023
+ public function setEffective(/* array(Google_string) */ $effective) {
2024
+ $this->assertIsArray($effective, 'Google_string', __METHOD__);
2025
+ $this->effective = $effective;
2026
+ }
2027
+ public function getEffective() {
2028
+ return $this->effective;
2029
+ }
2030
+ public function setLocal(/* array(Google_string) */ $local) {
2031
+ $this->assertIsArray($local, 'Google_string', __METHOD__);
2032
+ $this->local = $local;
2033
+ }
2034
+ public function getLocal() {
2035
+ return $this->local;
2036
+ }
2037
+ }
2038
+
2039
+ class Google_EntityUserLinks extends Google_Model {
2040
+ protected $__itemsType = 'Google_EntityUserLink';
2041
+ protected $__itemsDataType = 'array';
2042
+ public $items;
2043
+ public $itemsPerPage;
2044
+ public $kind;
2045
+ public $nextLink;
2046
+ public $previousLink;
2047
+ public $startIndex;
2048
+ public $totalResults;
2049
+ public function setItems(/* array(Google_EntityUserLink) */ $items) {
2050
+ $this->assertIsArray($items, 'Google_EntityUserLink', __METHOD__);
2051
+ $this->items = $items;
2052
+ }
2053
+ public function getItems() {
2054
+ return $this->items;
2055
+ }
2056
+ public function setItemsPerPage( $itemsPerPage) {
2057
+ $this->itemsPerPage = $itemsPerPage;
2058
+ }
2059
+ public function getItemsPerPage() {
2060
+ return $this->itemsPerPage;
2061
+ }
2062
+ public function setKind( $kind) {
2063
+ $this->kind = $kind;
2064
+ }
2065
+ public function getKind() {
2066
+ return $this->kind;
2067
+ }
2068
+ public function setNextLink( $nextLink) {
2069
+ $this->nextLink = $nextLink;
2070
+ }
2071
+ public function getNextLink() {
2072
+ return $this->nextLink;
2073
+ }
2074
+ public function setPreviousLink( $previousLink) {
2075
+ $this->previousLink = $previousLink;
2076
+ }
2077
+ public function getPreviousLink() {
2078
+ return $this->previousLink;
2079
+ }
2080
+ public function setStartIndex( $startIndex) {
2081
+ $this->startIndex = $startIndex;
2082
+ }
2083
+ public function getStartIndex() {
2084
+ return $this->startIndex;
2085
+ }
2086
+ public function setTotalResults( $totalResults) {
2087
+ $this->totalResults = $totalResults;
2088
+ }
2089
+ public function getTotalResults() {
2090
+ return $this->totalResults;
2091
+ }
2092
+ }
2093
+
2094
+ class Google_Experiment extends Google_Model {
2095
+ public $accountId;
2096
+ public $created;
2097
+ public $description;
2098
+ public $editableInGaUi;
2099
+ public $endTime;
2100
+ public $id;
2101
+ public $internalWebPropertyId;
2102
+ public $kind;
2103
+ public $minimumExperimentLengthInDays;
2104
+ public $name;
2105
+ public $objectiveMetric;
2106
+ public $optimizationType;
2107
+ protected $__parentLinkType = 'Google_ExperimentParentLink';
2108
+ protected $__parentLinkDataType = '';
2109
+ public $parentLink;
2110
+ public $profileId;
2111
+ public $reasonExperimentEnded;
2112
+ public $rewriteVariationUrlsAsOriginal;
2113
+ public $selfLink;
2114
+ public $servingFramework;
2115
+ public $snippet;
2116
+ public $startTime;
2117
+ public $status;
2118
+ public $trafficCoverage;
2119
+ public $updated;
2120
+ protected $__variationsType = 'Google_ExperimentVariations';
2121
+ protected $__variationsDataType = 'array';
2122
+ public $variations;
2123
+ public $webPropertyId;
2124
+ public $winnerConfidenceLevel;
2125
+ public $winnerFound;
2126
+ public function setAccountId( $accountId) {
2127
+ $this->accountId = $accountId;
2128
+ }
2129
+ public function getAccountId() {
2130
+ return $this->accountId;
2131
+ }
2132
+ public function setCreated( $created) {
2133
+ $this->created = $created;
2134
+ }
2135
+ public function getCreated() {
2136
+ return $this->created;
2137
+ }
2138
+ public function setDescription( $description) {
2139
+ $this->description = $description;
2140
+ }
2141
+ public function getDescription() {
2142
+ return $this->description;
2143
+ }
2144
+ public function setEditableInGaUi( $editableInGaUi) {
2145
+ $this->editableInGaUi = $editableInGaUi;
2146
+ }
2147
+ public function getEditableInGaUi() {
2148
+ return $this->editableInGaUi;
2149
+ }
2150
+ public function setEndTime( $endTime) {
2151
+ $this->endTime = $endTime;
2152
+ }
2153
+ public function getEndTime() {
2154
+ return $this->endTime;
2155
+ }
2156
+ public function setId( $id) {
2157
+ $this->id = $id;
2158
+ }
2159
+ public function getId() {
2160
+ return $this->id;
2161
+ }
2162
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
2163
+ $this->internalWebPropertyId = $internalWebPropertyId;
2164
+ }
2165
+ public function getInternalWebPropertyId() {
2166
+ return $this->internalWebPropertyId;
2167
+ }
2168
+ public function setKind( $kind) {
2169
+ $this->kind = $kind;
2170
+ }
2171
+ public function getKind() {
2172
+ return $this->kind;
2173
+ }
2174
+ public function setMinimumExperimentLengthInDays( $minimumExperimentLengthInDays) {
2175
+ $this->minimumExperimentLengthInDays = $minimumExperimentLengthInDays;
2176
+ }
2177
+ public function getMinimumExperimentLengthInDays() {
2178
+ return $this->minimumExperimentLengthInDays;
2179
+ }
2180
+ public function setName( $name) {
2181
+ $this->name = $name;
2182
+ }
2183
+ public function getName() {
2184
+ return $this->name;
2185
+ }
2186
+ public function setObjectiveMetric( $objectiveMetric) {
2187
+ $this->objectiveMetric = $objectiveMetric;
2188
+ }
2189
+ public function getObjectiveMetric() {
2190
+ return $this->objectiveMetric;
2191
+ }
2192
+ public function setOptimizationType( $optimizationType) {
2193
+ $this->optimizationType = $optimizationType;
2194
+ }
2195
+ public function getOptimizationType() {
2196
+ return $this->optimizationType;
2197
+ }
2198
+ public function setParentLink(Google_ExperimentParentLink $parentLink) {
2199
+ $this->parentLink = $parentLink;
2200
+ }
2201
+ public function getParentLink() {
2202
+ return $this->parentLink;
2203
+ }
2204
+ public function setProfileId( $profileId) {
2205
+ $this->profileId = $profileId;
2206
+ }
2207
+ public function getProfileId() {
2208
+ return $this->profileId;
2209
+ }
2210
+ public function setReasonExperimentEnded( $reasonExperimentEnded) {
2211
+ $this->reasonExperimentEnded = $reasonExperimentEnded;
2212
+ }
2213
+ public function getReasonExperimentEnded() {
2214
+ return $this->reasonExperimentEnded;
2215
+ }
2216
+ public function setRewriteVariationUrlsAsOriginal( $rewriteVariationUrlsAsOriginal) {
2217
+ $this->rewriteVariationUrlsAsOriginal = $rewriteVariationUrlsAsOriginal;
2218
+ }
2219
+ public function getRewriteVariationUrlsAsOriginal() {
2220
+ return $this->rewriteVariationUrlsAsOriginal;
2221
+ }
2222
+ public function setSelfLink( $selfLink) {
2223
+ $this->selfLink = $selfLink;
2224
+ }
2225
+ public function getSelfLink() {
2226
+ return $this->selfLink;
2227
+ }
2228
+ public function setServingFramework( $servingFramework) {
2229
+ $this->servingFramework = $servingFramework;
2230
+ }
2231
+ public function getServingFramework() {
2232
+ return $this->servingFramework;
2233
+ }
2234
+ public function setSnippet( $snippet) {
2235
+ $this->snippet = $snippet;
2236
+ }
2237
+ public function getSnippet() {
2238
+ return $this->snippet;
2239
+ }
2240
+ public function setStartTime( $startTime) {
2241
+ $this->startTime = $startTime;
2242
+ }
2243
+ public function getStartTime() {
2244
+ return $this->startTime;
2245
+ }
2246
+ public function setStatus( $status) {
2247
+ $this->status = $status;
2248
+ }
2249
+ public function getStatus() {
2250
+ return $this->status;
2251
+ }
2252
+ public function setTrafficCoverage( $trafficCoverage) {
2253
+ $this->trafficCoverage = $trafficCoverage;
2254
+ }
2255
+ public function getTrafficCoverage() {
2256
+ return $this->trafficCoverage;
2257
+ }
2258
+ public function setUpdated( $updated) {
2259
+ $this->updated = $updated;
2260
+ }
2261
+ public function getUpdated() {
2262
+ return $this->updated;
2263
+ }
2264
+ public function setVariations(/* array(Google_ExperimentVariations) */ $variations) {
2265
+ $this->assertIsArray($variations, 'Google_ExperimentVariations', __METHOD__);
2266
+ $this->variations = $variations;
2267
+ }
2268
+ public function getVariations() {
2269
+ return $this->variations;
2270
+ }
2271
+ public function setWebPropertyId( $webPropertyId) {
2272
+ $this->webPropertyId = $webPropertyId;
2273
+ }
2274
+ public function getWebPropertyId() {
2275
+ return $this->webPropertyId;
2276
+ }
2277
+ public function setWinnerConfidenceLevel( $winnerConfidenceLevel) {
2278
+ $this->winnerConfidenceLevel = $winnerConfidenceLevel;
2279
+ }
2280
+ public function getWinnerConfidenceLevel() {
2281
+ return $this->winnerConfidenceLevel;
2282
+ }
2283
+ public function setWinnerFound( $winnerFound) {
2284
+ $this->winnerFound = $winnerFound;
2285
+ }
2286
+ public function getWinnerFound() {
2287
+ return $this->winnerFound;
2288
+ }
2289
+ }
2290
+
2291
+ class Google_ExperimentParentLink extends Google_Model {
2292
+ public $href;
2293
+ public $type;
2294
+ public function setHref( $href) {
2295
+ $this->href = $href;
2296
+ }
2297
+ public function getHref() {
2298
+ return $this->href;
2299
+ }
2300
+ public function setType( $type) {
2301
+ $this->type = $type;
2302
+ }
2303
+ public function getType() {
2304
+ return $this->type;
2305
+ }
2306
+ }
2307
+
2308
+ class Google_ExperimentVariations extends Google_Model {
2309
+ public $name;
2310
+ public $status;
2311
+ public $url;
2312
+ public $weight;
2313
+ public $won;
2314
+ public function setName( $name) {
2315
+ $this->name = $name;
2316
+ }
2317
+ public function getName() {
2318
+ return $this->name;
2319
+ }
2320
+ public function setStatus( $status) {
2321
+ $this->status = $status;
2322
+ }
2323
+ public function getStatus() {
2324
+ return $this->status;
2325
+ }
2326
+ public function setUrl( $url) {
2327
+ $this->url = $url;
2328
+ }
2329
+ public function getUrl() {
2330
+ return $this->url;
2331
+ }
2332
+ public function setWeight( $weight) {
2333
+ $this->weight = $weight;
2334
+ }
2335
+ public function getWeight() {
2336
+ return $this->weight;
2337
+ }
2338
+ public function setWon( $won) {
2339
+ $this->won = $won;
2340
+ }
2341
+ public function getWon() {
2342
+ return $this->won;
2343
+ }
2344
+ }
2345
+
2346
+ class Google_Experiments extends Google_Model {
2347
+ protected $__itemsType = 'Google_Experiment';
2348
+ protected $__itemsDataType = 'array';
2349
+ public $items;
2350
+ public $itemsPerPage;
2351
+ public $kind;
2352
+ public $nextLink;
2353
+ public $previousLink;
2354
+ public $startIndex;
2355
+ public $totalResults;
2356
+ public $username;
2357
+ public function setItems(/* array(Google_Experiment) */ $items) {
2358
+ $this->assertIsArray($items, 'Google_Experiment', __METHOD__);
2359
+ $this->items = $items;
2360
+ }
2361
+ public function getItems() {
2362
+ return $this->items;
2363
+ }
2364
+ public function setItemsPerPage( $itemsPerPage) {
2365
+ $this->itemsPerPage = $itemsPerPage;
2366
+ }
2367
+ public function getItemsPerPage() {
2368
+ return $this->itemsPerPage;
2369
+ }
2370
+ public function setKind( $kind) {
2371
+ $this->kind = $kind;
2372
+ }
2373
+ public function getKind() {
2374
+ return $this->kind;
2375
+ }
2376
+ public function setNextLink( $nextLink) {
2377
+ $this->nextLink = $nextLink;
2378
+ }
2379
+ public function getNextLink() {
2380
+ return $this->nextLink;
2381
+ }
2382
+ public function setPreviousLink( $previousLink) {
2383
+ $this->previousLink = $previousLink;
2384
+ }
2385
+ public function getPreviousLink() {
2386
+ return $this->previousLink;
2387
+ }
2388
+ public function setStartIndex( $startIndex) {
2389
+ $this->startIndex = $startIndex;
2390
+ }
2391
+ public function getStartIndex() {
2392
+ return $this->startIndex;
2393
+ }
2394
+ public function setTotalResults( $totalResults) {
2395
+ $this->totalResults = $totalResults;
2396
+ }
2397
+ public function getTotalResults() {
2398
+ return $this->totalResults;
2399
+ }
2400
+ public function setUsername( $username) {
2401
+ $this->username = $username;
2402
+ }
2403
+ public function getUsername() {
2404
+ return $this->username;
2405
+ }
2406
+ }
2407
+
2408
+ class Google_GaData extends Google_Model {
2409
+ protected $__columnHeadersType = 'Google_GaDataColumnHeaders';
2410
+ protected $__columnHeadersDataType = 'array';
2411
+ public $columnHeaders;
2412
+ public $containsSampledData;
2413
+ public $id;
2414
+ public $itemsPerPage;
2415
+ public $kind;
2416
+ public $nextLink;
2417
+ public $previousLink;
2418
+ protected $__profileInfoType = 'Google_GaDataProfileInfo';
2419
+ protected $__profileInfoDataType = '';
2420
+ public $profileInfo;
2421
+ protected $__queryType = 'Google_GaDataQuery';
2422
+ protected $__queryDataType = '';
2423
+ public $query;
2424
+ public $rows;
2425
+ public $selfLink;
2426
+ public $totalResults;
2427
+ public $totalsForAllResults;
2428
+ public function setColumnHeaders(/* array(Google_GaDataColumnHeaders) */ $columnHeaders) {
2429
+ $this->assertIsArray($columnHeaders, 'Google_GaDataColumnHeaders', __METHOD__);
2430
+ $this->columnHeaders = $columnHeaders;
2431
+ }
2432
+ public function getColumnHeaders() {
2433
+ return $this->columnHeaders;
2434
+ }
2435
+ public function setContainsSampledData( $containsSampledData) {
2436
+ $this->containsSampledData = $containsSampledData;
2437
+ }
2438
+ public function getContainsSampledData() {
2439
+ return $this->containsSampledData;
2440
+ }
2441
+ public function setId( $id) {
2442
+ $this->id = $id;
2443
+ }
2444
+ public function getId() {
2445
+ return $this->id;
2446
+ }
2447
+ public function setItemsPerPage( $itemsPerPage) {
2448
+ $this->itemsPerPage = $itemsPerPage;
2449
+ }
2450
+ public function getItemsPerPage() {
2451
+ return $this->itemsPerPage;
2452
+ }
2453
+ public function setKind( $kind) {
2454
+ $this->kind = $kind;
2455
+ }
2456
+ public function getKind() {
2457
+ return $this->kind;
2458
+ }
2459
+ public function setNextLink( $nextLink) {
2460
+ $this->nextLink = $nextLink;
2461
+ }
2462
+ public function getNextLink() {
2463
+ return $this->nextLink;
2464
+ }
2465
+ public function setPreviousLink( $previousLink) {
2466
+ $this->previousLink = $previousLink;
2467
+ }
2468
+ public function getPreviousLink() {
2469
+ return $this->previousLink;
2470
+ }
2471
+ public function setProfileInfo(Google_GaDataProfileInfo $profileInfo) {
2472
+ $this->profileInfo = $profileInfo;
2473
+ }
2474
+ public function getProfileInfo() {
2475
+ return $this->profileInfo;
2476
+ }
2477
+ public function setQuery(Google_GaDataQuery $query) {
2478
+ $this->query = $query;
2479
+ }
2480
+ public function getQuery() {
2481
+ return $this->query;
2482
+ }
2483
+ public function setRows(/* array(Google_string) */ $rows) {
2484
+ $this->assertIsArray($rows, 'Google_string', __METHOD__);
2485
+ $this->rows = $rows;
2486
+ }
2487
+ public function getRows() {
2488
+ return $this->rows;
2489
+ }
2490
+ public function setSelfLink( $selfLink) {
2491
+ $this->selfLink = $selfLink;
2492
+ }
2493
+ public function getSelfLink() {
2494
+ return $this->selfLink;
2495
+ }
2496
+ public function setTotalResults( $totalResults) {
2497
+ $this->totalResults = $totalResults;
2498
+ }
2499
+ public function getTotalResults() {
2500
+ return $this->totalResults;
2501
+ }
2502
+ public function setTotalsForAllResults( $totalsForAllResults) {
2503
+ $this->totalsForAllResults = $totalsForAllResults;
2504
+ }
2505
+ public function getTotalsForAllResults() {
2506
+ return $this->totalsForAllResults;
2507
+ }
2508
+ }
2509
+
2510
+ class Google_GaDataColumnHeaders extends Google_Model {
2511
+ public $columnType;
2512
+ public $dataType;
2513
+ public $name;
2514
+ public function setColumnType( $columnType) {
2515
+ $this->columnType = $columnType;
2516
+ }
2517
+ public function getColumnType() {
2518
+ return $this->columnType;
2519
+ }
2520
+ public function setDataType( $dataType) {
2521
+ $this->dataType = $dataType;
2522
+ }
2523
+ public function getDataType() {
2524
+ return $this->dataType;
2525
+ }
2526
+ public function setName( $name) {
2527
+ $this->name = $name;
2528
+ }
2529
+ public function getName() {
2530
+ return $this->name;
2531
+ }
2532
+ }
2533
+
2534
+ class Google_GaDataProfileInfo extends Google_Model {
2535
+ public $accountId;
2536
+ public $internalWebPropertyId;
2537
+ public $profileId;
2538
+ public $profileName;
2539
+ public $tableId;
2540
+ public $webPropertyId;
2541
+ public function setAccountId( $accountId) {
2542
+ $this->accountId = $accountId;
2543
+ }
2544
+ public function getAccountId() {
2545
+ return $this->accountId;
2546
+ }
2547
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
2548
+ $this->internalWebPropertyId = $internalWebPropertyId;
2549
+ }
2550
+ public function getInternalWebPropertyId() {
2551
+ return $this->internalWebPropertyId;
2552
+ }
2553
+ public function setProfileId( $profileId) {
2554
+ $this->profileId = $profileId;
2555
+ }
2556
+ public function getProfileId() {
2557
+ return $this->profileId;
2558
+ }
2559
+ public function setProfileName( $profileName) {
2560
+ $this->profileName = $profileName;
2561
+ }
2562
+ public function getProfileName() {
2563
+ return $this->profileName;
2564
+ }
2565
+ public function setTableId( $tableId) {
2566
+ $this->tableId = $tableId;
2567
+ }
2568
+ public function getTableId() {
2569
+ return $this->tableId;
2570
+ }
2571
+ public function setWebPropertyId( $webPropertyId) {
2572
+ $this->webPropertyId = $webPropertyId;
2573
+ }
2574
+ public function getWebPropertyId() {
2575
+ return $this->webPropertyId;
2576
+ }
2577
+ }
2578
+
2579
+ class Google_GaDataQuery extends Google_Model {
2580
+ public $dimensions;
2581
+ public $end_date;
2582
+ public $filters;
2583
+ public $ids;
2584
+ public $max_results;
2585
+ public $metrics;
2586
+ public $segment;
2587
+ public $sort;
2588
+ public $start_date;
2589
+ public $start_index;
2590
+ public function setDimensions( $dimensions) {
2591
+ $this->dimensions = $dimensions;
2592
+ }
2593
+ public function getDimensions() {
2594
+ return $this->dimensions;
2595
+ }
2596
+ public function setEnd_date( $end_date) {
2597
+ $this->end_date = $end_date;
2598
+ }
2599
+ public function getEnd_date() {
2600
+ return $this->end_date;
2601
+ }
2602
+ public function setFilters( $filters) {
2603
+ $this->filters = $filters;
2604
+ }
2605
+ public function getFilters() {
2606
+ return $this->filters;
2607
+ }
2608
+ public function setIds( $ids) {
2609
+ $this->ids = $ids;
2610
+ }
2611
+ public function getIds() {
2612
+ return $this->ids;
2613
+ }
2614
+ public function setMax_results( $max_results) {
2615
+ $this->max_results = $max_results;
2616
+ }
2617
+ public function getMax_results() {
2618
+ return $this->max_results;
2619
+ }
2620
+ public function setMetrics(/* array(Google_string) */ $metrics) {
2621
+ $this->assertIsArray($metrics, 'Google_string', __METHOD__);
2622
+ $this->metrics = $metrics;
2623
+ }
2624
+ public function getMetrics() {
2625
+ return $this->metrics;
2626
+ }
2627
+ public function setSegment( $segment) {
2628
+ $this->segment = $segment;
2629
+ }
2630
+ public function getSegment() {
2631
+ return $this->segment;
2632
+ }
2633
+ public function setSort(/* array(Google_string) */ $sort) {
2634
+ $this->assertIsArray($sort, 'Google_string', __METHOD__);
2635
+ $this->sort = $sort;
2636
+ }
2637
+ public function getSort() {
2638
+ return $this->sort;
2639
+ }
2640
+ public function setStart_date( $start_date) {
2641
+ $this->start_date = $start_date;
2642
+ }
2643
+ public function getStart_date() {
2644
+ return $this->start_date;
2645
+ }
2646
+ public function setStart_index( $start_index) {
2647
+ $this->start_index = $start_index;
2648
+ }
2649
+ public function getStart_index() {
2650
+ return $this->start_index;
2651
+ }
2652
+ }
2653
+
2654
+ class Google_Goal extends Google_Model {
2655
+ public $accountId;
2656
+ public $active;
2657
+ public $created;
2658
+ protected $__eventDetailsType = 'Google_GoalEventDetails';
2659
+ protected $__eventDetailsDataType = '';
2660
+ public $eventDetails;
2661
+ public $id;
2662
+ public $internalWebPropertyId;
2663
+ public $kind;
2664
+ public $name;
2665
+ protected $__parentLinkType = 'Google_GoalParentLink';
2666
+ protected $__parentLinkDataType = '';
2667
+ public $parentLink;
2668
+ public $profileId;
2669
+ public $selfLink;
2670
+ public $type;
2671
+ public $updated;
2672
+ protected $__urlDestinationDetailsType = 'Google_GoalUrlDestinationDetails';
2673
+ protected $__urlDestinationDetailsDataType = '';
2674
+ public $urlDestinationDetails;
2675
+ public $value;
2676
+ protected $__visitNumPagesDetailsType = 'Google_GoalVisitNumPagesDetails';
2677
+ protected $__visitNumPagesDetailsDataType = '';
2678
+ public $visitNumPagesDetails;
2679
+ protected $__visitTimeOnSiteDetailsType = 'Google_GoalVisitTimeOnSiteDetails';
2680
+ protected $__visitTimeOnSiteDetailsDataType = '';
2681
+ public $visitTimeOnSiteDetails;
2682
+ public $webPropertyId;
2683
+ public function setAccountId( $accountId) {
2684
+ $this->accountId = $accountId;
2685
+ }
2686
+ public function getAccountId() {
2687
+ return $this->accountId;
2688
+ }
2689
+ public function setActive( $active) {
2690
+ $this->active = $active;
2691
+ }
2692
+ public function getActive() {
2693
+ return $this->active;
2694
+ }
2695
+ public function setCreated( $created) {
2696
+ $this->created = $created;
2697
+ }
2698
+ public function getCreated() {
2699
+ return $this->created;
2700
+ }
2701
+ public function setEventDetails(Google_GoalEventDetails $eventDetails) {
2702
+ $this->eventDetails = $eventDetails;
2703
+ }
2704
+ public function getEventDetails() {
2705
+ return $this->eventDetails;
2706
+ }
2707
+ public function setId( $id) {
2708
+ $this->id = $id;
2709
+ }
2710
+ public function getId() {
2711
+ return $this->id;
2712
+ }
2713
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
2714
+ $this->internalWebPropertyId = $internalWebPropertyId;
2715
+ }
2716
+ public function getInternalWebPropertyId() {
2717
+ return $this->internalWebPropertyId;
2718
+ }
2719
+ public function setKind( $kind) {
2720
+ $this->kind = $kind;
2721
+ }
2722
+ public function getKind() {
2723
+ return $this->kind;
2724
+ }
2725
+ public function setName( $name) {
2726
+ $this->name = $name;
2727
+ }
2728
+ public function getName() {
2729
+ return $this->name;
2730
+ }
2731
+ public function setParentLink(Google_GoalParentLink $parentLink) {
2732
+ $this->parentLink = $parentLink;
2733
+ }
2734
+ public function getParentLink() {
2735
+ return $this->parentLink;
2736
+ }
2737
+ public function setProfileId( $profileId) {
2738
+ $this->profileId = $profileId;
2739
+ }
2740
+ public function getProfileId() {
2741
+ return $this->profileId;
2742
+ }
2743
+ public function setSelfLink( $selfLink) {
2744
+ $this->selfLink = $selfLink;
2745
+ }
2746
+ public function getSelfLink() {
2747
+ return $this->selfLink;
2748
+ }
2749
+ public function setType( $type) {
2750
+ $this->type = $type;
2751
+ }
2752
+ public function getType() {
2753
+ return $this->type;
2754
+ }
2755
+ public function setUpdated( $updated) {
2756
+ $this->updated = $updated;
2757
+ }
2758
+ public function getUpdated() {
2759
+ return $this->updated;
2760
+ }
2761
+ public function setUrlDestinationDetails(Google_GoalUrlDestinationDetails $urlDestinationDetails) {
2762
+ $this->urlDestinationDetails = $urlDestinationDetails;
2763
+ }
2764
+ public function getUrlDestinationDetails() {
2765
+ return $this->urlDestinationDetails;
2766
+ }
2767
+ public function setValue( $value) {
2768
+ $this->value = $value;
2769
+ }
2770
+ public function getValue() {
2771
+ return $this->value;
2772
+ }
2773
+ public function setVisitNumPagesDetails(Google_GoalVisitNumPagesDetails $visitNumPagesDetails) {
2774
+ $this->visitNumPagesDetails = $visitNumPagesDetails;
2775
+ }
2776
+ public function getVisitNumPagesDetails() {
2777
+ return $this->visitNumPagesDetails;
2778
+ }
2779
+ public function setVisitTimeOnSiteDetails(Google_GoalVisitTimeOnSiteDetails $visitTimeOnSiteDetails) {
2780
+ $this->visitTimeOnSiteDetails = $visitTimeOnSiteDetails;
2781
+ }
2782
+ public function getVisitTimeOnSiteDetails() {
2783
+ return $this->visitTimeOnSiteDetails;
2784
+ }
2785
+ public function setWebPropertyId( $webPropertyId) {
2786
+ $this->webPropertyId = $webPropertyId;
2787
+ }
2788
+ public function getWebPropertyId() {
2789
+ return $this->webPropertyId;
2790
+ }
2791
+ }
2792
+
2793
+ class Google_GoalEventDetails extends Google_Model {
2794
+ protected $__eventConditionsType = 'Google_GoalEventDetailsEventConditions';
2795
+ protected $__eventConditionsDataType = 'array';
2796
+ public $eventConditions;
2797
+ public $useEventValue;
2798
+ public function setEventConditions(/* array(Google_GoalEventDetailsEventConditions) */ $eventConditions) {
2799
+ $this->assertIsArray($eventConditions, 'Google_GoalEventDetailsEventConditions', __METHOD__);
2800
+ $this->eventConditions = $eventConditions;
2801
+ }
2802
+ public function getEventConditions() {
2803
+ return $this->eventConditions;
2804
+ }
2805
+ public function setUseEventValue( $useEventValue) {
2806
+ $this->useEventValue = $useEventValue;
2807
+ }
2808
+ public function getUseEventValue() {
2809
+ return $this->useEventValue;
2810
+ }
2811
+ }
2812
+
2813
+ class Google_GoalEventDetailsEventConditions extends Google_Model {
2814
+ public $comparisonType;
2815
+ public $comparisonValue;
2816
+ public $expression;
2817
+ public $matchType;
2818
+ public $type;
2819
+ public function setComparisonType( $comparisonType) {
2820
+ $this->comparisonType = $comparisonType;
2821
+ }
2822
+ public function getComparisonType() {
2823
+ return $this->comparisonType;
2824
+ }
2825
+ public function setComparisonValue( $comparisonValue) {
2826
+ $this->comparisonValue = $comparisonValue;
2827
+ }
2828
+ public function getComparisonValue() {
2829
+ return $this->comparisonValue;
2830
+ }
2831
+ public function setExpression( $expression) {
2832
+ $this->expression = $expression;
2833
+ }
2834
+ public function getExpression() {
2835
+ return $this->expression;
2836
+ }
2837
+ public function setMatchType( $matchType) {
2838
+ $this->matchType = $matchType;
2839
+ }
2840
+ public function getMatchType() {
2841
+ return $this->matchType;
2842
+ }
2843
+ public function setType( $type) {
2844
+ $this->type = $type;
2845
+ }
2846
+ public function getType() {
2847
+ return $this->type;
2848
+ }
2849
+ }
2850
+
2851
+ class Google_GoalParentLink extends Google_Model {
2852
+ public $href;
2853
+ public $type;
2854
+ public function setHref( $href) {
2855
+ $this->href = $href;
2856
+ }
2857
+ public function getHref() {
2858
+ return $this->href;
2859
+ }
2860
+ public function setType( $type) {
2861
+ $this->type = $type;
2862
+ }
2863
+ public function getType() {
2864
+ return $this->type;
2865
+ }
2866
+ }
2867
+
2868
+ class Google_GoalUrlDestinationDetails extends Google_Model {
2869
+ public $caseSensitive;
2870
+ public $firstStepRequired;
2871
+ public $matchType;
2872
+ protected $__stepsType = 'Google_GoalUrlDestinationDetailsSteps';
2873
+ protected $__stepsDataType = 'array';
2874
+ public $steps;
2875
+ public $url;
2876
+ public function setCaseSensitive( $caseSensitive) {
2877
+ $this->caseSensitive = $caseSensitive;
2878
+ }
2879
+ public function getCaseSensitive() {
2880
+ return $this->caseSensitive;
2881
+ }
2882
+ public function setFirstStepRequired( $firstStepRequired) {
2883
+ $this->firstStepRequired = $firstStepRequired;
2884
+ }
2885
+ public function getFirstStepRequired() {
2886
+ return $this->firstStepRequired;
2887
+ }
2888
+ public function setMatchType( $matchType) {
2889
+ $this->matchType = $matchType;
2890
+ }
2891
+ public function getMatchType() {
2892
+ return $this->matchType;
2893
+ }
2894
+ public function setSteps(/* array(Google_GoalUrlDestinationDetailsSteps) */ $steps) {
2895
+ $this->assertIsArray($steps, 'Google_GoalUrlDestinationDetailsSteps', __METHOD__);
2896
+ $this->steps = $steps;
2897
+ }
2898
+ public function getSteps() {
2899
+ return $this->steps;
2900
+ }
2901
+ public function setUrl( $url) {
2902
+ $this->url = $url;
2903
+ }
2904
+ public function getUrl() {
2905
+ return $this->url;
2906
+ }
2907
+ }
2908
+
2909
+ class Google_GoalUrlDestinationDetailsSteps extends Google_Model {
2910
+ public $name;
2911
+ public $number;
2912
+ public $url;
2913
+ public function setName( $name) {
2914
+ $this->name = $name;
2915
+ }
2916
+ public function getName() {
2917
+ return $this->name;
2918
+ }
2919
+ public function setNumber( $number) {
2920
+ $this->number = $number;
2921
+ }
2922
+ public function getNumber() {
2923
+ return $this->number;
2924
+ }
2925
+ public function setUrl( $url) {
2926
+ $this->url = $url;
2927
+ }
2928
+ public function getUrl() {
2929
+ return $this->url;
2930
+ }
2931
+ }
2932
+
2933
+ class Google_GoalVisitNumPagesDetails extends Google_Model {
2934
+ public $comparisonType;
2935
+ public $comparisonValue;
2936
+ public function setComparisonType( $comparisonType) {
2937
+ $this->comparisonType = $comparisonType;
2938
+ }
2939
+ public function getComparisonType() {
2940
+ return $this->comparisonType;
2941
+ }
2942
+ public function setComparisonValue( $comparisonValue) {
2943
+ $this->comparisonValue = $comparisonValue;
2944
+ }
2945
+ public function getComparisonValue() {
2946
+ return $this->comparisonValue;
2947
+ }
2948
+ }
2949
+
2950
+ class Google_GoalVisitTimeOnSiteDetails extends Google_Model {
2951
+ public $comparisonType;
2952
+ public $comparisonValue;
2953
+ public function setComparisonType( $comparisonType) {
2954
+ $this->comparisonType = $comparisonType;
2955
+ }
2956
+ public function getComparisonType() {
2957
+ return $this->comparisonType;
2958
+ }
2959
+ public function setComparisonValue( $comparisonValue) {
2960
+ $this->comparisonValue = $comparisonValue;
2961
+ }
2962
+ public function getComparisonValue() {
2963
+ return $this->comparisonValue;
2964
+ }
2965
+ }
2966
+
2967
+ class Google_Goals extends Google_Model {
2968
+ protected $__itemsType = 'Google_Goal';
2969
+ protected $__itemsDataType = 'array';
2970
+ public $items;
2971
+ public $itemsPerPage;
2972
+ public $kind;
2973
+ public $nextLink;
2974
+ public $previousLink;
2975
+ public $startIndex;
2976
+ public $totalResults;
2977
+ public $username;
2978
+ public function setItems(/* array(Google_Goal) */ $items) {
2979
+ $this->assertIsArray($items, 'Google_Goal', __METHOD__);
2980
+ $this->items = $items;
2981
+ }
2982
+ public function getItems() {
2983
+ return $this->items;
2984
+ }
2985
+ public function setItemsPerPage( $itemsPerPage) {
2986
+ $this->itemsPerPage = $itemsPerPage;
2987
+ }
2988
+ public function getItemsPerPage() {
2989
+ return $this->itemsPerPage;
2990
+ }
2991
+ public function setKind( $kind) {
2992
+ $this->kind = $kind;
2993
+ }
2994
+ public function getKind() {
2995
+ return $this->kind;
2996
+ }
2997
+ public function setNextLink( $nextLink) {
2998
+ $this->nextLink = $nextLink;
2999
+ }
3000
+ public function getNextLink() {
3001
+ return $this->nextLink;
3002
+ }
3003
+ public function setPreviousLink( $previousLink) {
3004
+ $this->previousLink = $previousLink;
3005
+ }
3006
+ public function getPreviousLink() {
3007
+ return $this->previousLink;
3008
+ }
3009
+ public function setStartIndex( $startIndex) {
3010
+ $this->startIndex = $startIndex;
3011
+ }
3012
+ public function getStartIndex() {
3013
+ return $this->startIndex;
3014
+ }
3015
+ public function setTotalResults( $totalResults) {
3016
+ $this->totalResults = $totalResults;
3017
+ }
3018
+ public function getTotalResults() {
3019
+ return $this->totalResults;
3020
+ }
3021
+ public function setUsername( $username) {
3022
+ $this->username = $username;
3023
+ }
3024
+ public function getUsername() {
3025
+ return $this->username;
3026
+ }
3027
+ }
3028
+
3029
+ class Google_McfData extends Google_Model {
3030
+ protected $__columnHeadersType = 'Google_McfDataColumnHeaders';
3031
+ protected $__columnHeadersDataType = 'array';
3032
+ public $columnHeaders;
3033
+ public $containsSampledData;
3034
+ public $id;
3035
+ public $itemsPerPage;
3036
+ public $kind;
3037
+ public $nextLink;
3038
+ public $previousLink;
3039
+ protected $__profileInfoType = 'Google_McfDataProfileInfo';
3040
+ protected $__profileInfoDataType = '';
3041
+ public $profileInfo;
3042
+ protected $__queryType = 'Google_McfDataQuery';
3043
+ protected $__queryDataType = '';
3044
+ public $query;
3045
+ protected $__rowsType = 'Google_McfDataRows';
3046
+ protected $__rowsDataType = 'array';
3047
+ public $rows;
3048
+ public $selfLink;
3049
+ public $totalResults;
3050
+ public $totalsForAllResults;
3051
+ public function setColumnHeaders(/* array(Google_McfDataColumnHeaders) */ $columnHeaders) {
3052
+ $this->assertIsArray($columnHeaders, 'Google_McfDataColumnHeaders', __METHOD__);
3053
+ $this->columnHeaders = $columnHeaders;
3054
+ }
3055
+ public function getColumnHeaders() {
3056
+ return $this->columnHeaders;
3057
+ }
3058
+ public function setContainsSampledData( $containsSampledData) {
3059
+ $this->containsSampledData = $containsSampledData;
3060
+ }
3061
+ public function getContainsSampledData() {
3062
+ return $this->containsSampledData;
3063
+ }
3064
+ public function setId( $id) {
3065
+ $this->id = $id;
3066
+ }
3067
+ public function getId() {
3068
+ return $this->id;
3069
+ }
3070
+ public function setItemsPerPage( $itemsPerPage) {
3071
+ $this->itemsPerPage = $itemsPerPage;
3072
+ }
3073
+ public function getItemsPerPage() {
3074
+ return $this->itemsPerPage;
3075
+ }
3076
+ public function setKind( $kind) {
3077
+ $this->kind = $kind;
3078
+ }
3079
+ public function getKind() {
3080
+ return $this->kind;
3081
+ }
3082
+ public function setNextLink( $nextLink) {
3083
+ $this->nextLink = $nextLink;
3084
+ }
3085
+ public function getNextLink() {
3086
+ return $this->nextLink;
3087
+ }
3088
+ public function setPreviousLink( $previousLink) {
3089
+ $this->previousLink = $previousLink;
3090
+ }
3091
+ public function getPreviousLink() {
3092
+ return $this->previousLink;
3093
+ }
3094
+ public function setProfileInfo(Google_McfDataProfileInfo $profileInfo) {
3095
+ $this->profileInfo = $profileInfo;
3096
+ }
3097
+ public function getProfileInfo() {
3098
+ return $this->profileInfo;
3099
+ }
3100
+ public function setQuery(Google_McfDataQuery $query) {
3101
+ $this->query = $query;
3102
+ }
3103
+ public function getQuery() {
3104
+ return $this->query;
3105
+ }
3106
+ public function setRows(/* array(Google_McfDataRows) */ $rows) {
3107
+ $this->assertIsArray($rows, 'Google_McfDataRows', __METHOD__);
3108
+ $this->rows = $rows;
3109
+ }
3110
+ public function getRows() {
3111
+ return $this->rows;
3112
+ }
3113
+ public function setSelfLink( $selfLink) {
3114
+ $this->selfLink = $selfLink;
3115
+ }
3116
+ public function getSelfLink() {
3117
+ return $this->selfLink;
3118
+ }
3119
+ public function setTotalResults( $totalResults) {
3120
+ $this->totalResults = $totalResults;
3121
+ }
3122
+ public function getTotalResults() {
3123
+ return $this->totalResults;
3124
+ }
3125
+ public function setTotalsForAllResults( $totalsForAllResults) {
3126
+ $this->totalsForAllResults = $totalsForAllResults;
3127
+ }
3128
+ public function getTotalsForAllResults() {
3129
+ return $this->totalsForAllResults;
3130
+ }
3131
+ }
3132
+
3133
+ class Google_McfDataColumnHeaders extends Google_Model {
3134
+ public $columnType;
3135
+ public $dataType;
3136
+ public $name;
3137
+ public function setColumnType( $columnType) {
3138
+ $this->columnType = $columnType;
3139
+ }
3140
+ public function getColumnType() {
3141
+ return $this->columnType;
3142
+ }
3143
+ public function setDataType( $dataType) {
3144
+ $this->dataType = $dataType;
3145
+ }
3146
+ public function getDataType() {
3147
+ return $this->dataType;
3148
+ }
3149
+ public function setName( $name) {
3150
+ $this->name = $name;
3151
+ }
3152
+ public function getName() {
3153
+ return $this->name;
3154
+ }
3155
+ }
3156
+
3157
+ class Google_McfDataProfileInfo extends Google_Model {
3158
+ public $accountId;
3159
+ public $internalWebPropertyId;
3160
+ public $profileId;
3161
+ public $profileName;
3162
+ public $tableId;
3163
+ public $webPropertyId;
3164
+ public function setAccountId( $accountId) {
3165
+ $this->accountId = $accountId;
3166
+ }
3167
+ public function getAccountId() {
3168
+ return $this->accountId;
3169
+ }
3170
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
3171
+ $this->internalWebPropertyId = $internalWebPropertyId;
3172
+ }
3173
+ public function getInternalWebPropertyId() {
3174
+ return $this->internalWebPropertyId;
3175
+ }
3176
+ public function setProfileId( $profileId) {
3177
+ $this->profileId = $profileId;
3178
+ }
3179
+ public function getProfileId() {
3180
+ return $this->profileId;
3181
+ }
3182
+ public function setProfileName( $profileName) {
3183
+ $this->profileName = $profileName;
3184
+ }
3185
+ public function getProfileName() {
3186
+ return $this->profileName;
3187
+ }
3188
+ public function setTableId( $tableId) {
3189
+ $this->tableId = $tableId;
3190
+ }
3191
+ public function getTableId() {
3192
+ return $this->tableId;
3193
+ }
3194
+ public function setWebPropertyId( $webPropertyId) {
3195
+ $this->webPropertyId = $webPropertyId;
3196
+ }
3197
+ public function getWebPropertyId() {
3198
+ return $this->webPropertyId;
3199
+ }
3200
+ }
3201
+
3202
+ class Google_McfDataQuery extends Google_Model {
3203
+ public $dimensions;
3204
+ public $end_date;
3205
+ public $filters;
3206
+ public $ids;
3207
+ public $max_results;
3208
+ public $metrics;
3209
+ public $segment;
3210
+ public $sort;
3211
+ public $start_date;
3212
+ public $start_index;
3213
+ public function setDimensions( $dimensions) {
3214
+ $this->dimensions = $dimensions;
3215
+ }
3216
+ public function getDimensions() {
3217
+ return $this->dimensions;
3218
+ }
3219
+ public function setEnd_date( $end_date) {
3220
+ $this->end_date = $end_date;
3221
+ }
3222
+ public function getEnd_date() {
3223
+ return $this->end_date;
3224
+ }
3225
+ public function setFilters( $filters) {
3226
+ $this->filters = $filters;
3227
+ }
3228
+ public function getFilters() {
3229
+ return $this->filters;
3230
+ }
3231
+ public function setIds( $ids) {
3232
+ $this->ids = $ids;
3233
+ }
3234
+ public function getIds() {
3235
+ return $this->ids;
3236
+ }
3237
+ public function setMax_results( $max_results) {
3238
+ $this->max_results = $max_results;
3239
+ }
3240
+ public function getMax_results() {
3241
+ return $this->max_results;
3242
+ }
3243
+ public function setMetrics(/* array(Google_string) */ $metrics) {
3244
+ $this->assertIsArray($metrics, 'Google_string', __METHOD__);
3245
+ $this->metrics = $metrics;
3246
+ }
3247
+ public function getMetrics() {
3248
+ return $this->metrics;
3249
+ }
3250
+ public function setSegment( $segment) {
3251
+ $this->segment = $segment;
3252
+ }
3253
+ public function getSegment() {
3254
+ return $this->segment;
3255
+ }
3256
+ public function setSort(/* array(Google_string) */ $sort) {
3257
+ $this->assertIsArray($sort, 'Google_string', __METHOD__);
3258
+ $this->sort = $sort;
3259
+ }
3260
+ public function getSort() {
3261
+ return $this->sort;
3262
+ }
3263
+ public function setStart_date( $start_date) {
3264
+ $this->start_date = $start_date;
3265
+ }
3266
+ public function getStart_date() {
3267
+ return $this->start_date;
3268
+ }
3269
+ public function setStart_index( $start_index) {
3270
+ $this->start_index = $start_index;
3271
+ }
3272
+ public function getStart_index() {
3273
+ return $this->start_index;
3274
+ }
3275
+ }
3276
+
3277
+ class Google_McfDataRows extends Google_Model {
3278
+ protected $__conversionPathValueType = 'Google_McfDataRowsConversionPathValue';
3279
+ protected $__conversionPathValueDataType = 'array';
3280
+ public $conversionPathValue;
3281
+ public $primitiveValue;
3282
+ public function setConversionPathValue(/* array(Google_McfDataRowsConversionPathValue) */ $conversionPathValue) {
3283
+ $this->assertIsArray($conversionPathValue, 'Google_McfDataRowsConversionPathValue', __METHOD__);
3284
+ $this->conversionPathValue = $conversionPathValue;
3285
+ }
3286
+ public function getConversionPathValue() {
3287
+ return $this->conversionPathValue;
3288
+ }
3289
+ public function setPrimitiveValue( $primitiveValue) {
3290
+ $this->primitiveValue = $primitiveValue;
3291
+ }
3292
+ public function getPrimitiveValue() {
3293
+ return $this->primitiveValue;
3294
+ }
3295
+ }
3296
+
3297
+ class Google_McfDataRowsConversionPathValue extends Google_Model {
3298
+ public $interactionType;
3299
+ public $nodeValue;
3300
+ public function setInteractionType( $interactionType) {
3301
+ $this->interactionType = $interactionType;
3302
+ }
3303
+ public function getInteractionType() {
3304
+ return $this->interactionType;
3305
+ }
3306
+ public function setNodeValue( $nodeValue) {
3307
+ $this->nodeValue = $nodeValue;
3308
+ }
3309
+ public function getNodeValue() {
3310
+ return $this->nodeValue;
3311
+ }
3312
+ }
3313
+
3314
+ class Google_Profile extends Google_Model {
3315
+ public $accountId;
3316
+ protected $__childLinkType = 'Google_ProfileChildLink';
3317
+ protected $__childLinkDataType = '';
3318
+ public $childLink;
3319
+ public $created;
3320
+ public $currency;
3321
+ public $defaultPage;
3322
+ public $eCommerceTracking;
3323
+ public $excludeQueryParameters;
3324
+ public $id;
3325
+ public $internalWebPropertyId;
3326
+ public $kind;
3327
+ public $name;
3328
+ protected $__parentLinkType = 'Google_ProfileParentLink';
3329
+ protected $__parentLinkDataType = '';
3330
+ public $parentLink;
3331
+ protected $__permissionsType = 'Google_ProfilePermissions';
3332
+ protected $__permissionsDataType = '';
3333
+ public $permissions;
3334
+ public $selfLink;
3335
+ public $siteSearchCategoryParameters;
3336
+ public $siteSearchQueryParameters;
3337
+ public $timezone;
3338
+ public $type;
3339
+ public $updated;
3340
+ public $webPropertyId;
3341
+ public $websiteUrl;
3342
+ public function setAccountId( $accountId) {
3343
+ $this->accountId = $accountId;
3344
+ }
3345
+ public function getAccountId() {
3346
+ return $this->accountId;
3347
+ }
3348
+ public function setChildLink(Google_ProfileChildLink $childLink) {
3349
+ $this->childLink = $childLink;
3350
+ }
3351
+ public function getChildLink() {
3352
+ return $this->childLink;
3353
+ }
3354
+ public function setCreated( $created) {
3355
+ $this->created = $created;
3356
+ }
3357
+ public function getCreated() {
3358
+ return $this->created;
3359
+ }
3360
+ public function setCurrency( $currency) {
3361
+ $this->currency = $currency;
3362
+ }
3363
+ public function getCurrency() {
3364
+ return $this->currency;
3365
+ }
3366
+ public function setDefaultPage( $defaultPage) {
3367
+ $this->defaultPage = $defaultPage;
3368
+ }
3369
+ public function getDefaultPage() {
3370
+ return $this->defaultPage;
3371
+ }
3372
+ public function setECommerceTracking( $eCommerceTracking) {
3373
+ $this->eCommerceTracking = $eCommerceTracking;
3374
+ }
3375
+ public function getECommerceTracking() {
3376
+ return $this->eCommerceTracking;
3377
+ }
3378
+ public function setExcludeQueryParameters( $excludeQueryParameters) {
3379
+ $this->excludeQueryParameters = $excludeQueryParameters;
3380
+ }
3381
+ public function getExcludeQueryParameters() {
3382
+ return $this->excludeQueryParameters;
3383
+ }
3384
+ public function setId( $id) {
3385
+ $this->id = $id;
3386
+ }
3387
+ public function getId() {
3388
+ return $this->id;
3389
+ }
3390
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
3391
+ $this->internalWebPropertyId = $internalWebPropertyId;
3392
+ }
3393
+ public function getInternalWebPropertyId() {
3394
+ return $this->internalWebPropertyId;
3395
+ }
3396
+ public function setKind( $kind) {
3397
+ $this->kind = $kind;
3398
+ }
3399
+ public function getKind() {
3400
+ return $this->kind;
3401
+ }
3402
+ public function setName( $name) {
3403
+ $this->name = $name;
3404
+ }
3405
+ public function getName() {
3406
+ return $this->name;
3407
+ }
3408
+ public function setParentLink(Google_ProfileParentLink $parentLink) {
3409
+ $this->parentLink = $parentLink;
3410
+ }
3411
+ public function getParentLink() {
3412
+ return $this->parentLink;
3413
+ }
3414
+ public function setPermissions(Google_ProfilePermissions $permissions) {
3415
+ $this->permissions = $permissions;
3416
+ }
3417
+ public function getPermissions() {
3418
+ return $this->permissions;
3419
+ }
3420
+ public function setSelfLink( $selfLink) {
3421
+ $this->selfLink = $selfLink;
3422
+ }
3423
+ public function getSelfLink() {
3424
+ return $this->selfLink;
3425
+ }
3426
+ public function setSiteSearchCategoryParameters( $siteSearchCategoryParameters) {
3427
+ $this->siteSearchCategoryParameters = $siteSearchCategoryParameters;
3428
+ }
3429
+ public function getSiteSearchCategoryParameters() {
3430
+ return $this->siteSearchCategoryParameters;
3431
+ }
3432
+ public function setSiteSearchQueryParameters( $siteSearchQueryParameters) {
3433
+ $this->siteSearchQueryParameters = $siteSearchQueryParameters;
3434
+ }
3435
+ public function getSiteSearchQueryParameters() {
3436
+ return $this->siteSearchQueryParameters;
3437
+ }
3438
+ public function setTimezone( $timezone) {
3439
+ $this->timezone = $timezone;
3440
+ }
3441
+ public function getTimezone() {
3442
+ return $this->timezone;
3443
+ }
3444
+ public function setType( $type) {
3445
+ $this->type = $type;
3446
+ }
3447
+ public function getType() {
3448
+ return $this->type;
3449
+ }
3450
+ public function setUpdated( $updated) {
3451
+ $this->updated = $updated;
3452
+ }
3453
+ public function getUpdated() {
3454
+ return $this->updated;
3455
+ }
3456
+ public function setWebPropertyId( $webPropertyId) {
3457
+ $this->webPropertyId = $webPropertyId;
3458
+ }
3459
+ public function getWebPropertyId() {
3460
+ return $this->webPropertyId;
3461
+ }
3462
+ public function setWebsiteUrl( $websiteUrl) {
3463
+ $this->websiteUrl = $websiteUrl;
3464
+ }
3465
+ public function getWebsiteUrl() {
3466
+ return $this->websiteUrl;
3467
+ }
3468
+ }
3469
+
3470
+ class Google_ProfileChildLink extends Google_Model {
3471
+ public $href;
3472
+ public $type;
3473
+ public function setHref( $href) {
3474
+ $this->href = $href;
3475
+ }
3476
+ public function getHref() {
3477
+ return $this->href;
3478
+ }
3479
+ public function setType( $type) {
3480
+ $this->type = $type;
3481
+ }
3482
+ public function getType() {
3483
+ return $this->type;
3484
+ }
3485
+ }
3486
+
3487
+ class Google_ProfileParentLink extends Google_Model {
3488
+ public $href;
3489
+ public $type;
3490
+ public function setHref( $href) {
3491
+ $this->href = $href;
3492
+ }
3493
+ public function getHref() {
3494
+ return $this->href;
3495
+ }
3496
+ public function setType( $type) {
3497
+ $this->type = $type;
3498
+ }
3499
+ public function getType() {
3500
+ return $this->type;
3501
+ }
3502
+ }
3503
+
3504
+ class Google_ProfilePermissions extends Google_Model {
3505
+ public $effective;
3506
+ public function setEffective(/* array(Google_string) */ $effective) {
3507
+ $this->assertIsArray($effective, 'Google_string', __METHOD__);
3508
+ $this->effective = $effective;
3509
+ }
3510
+ public function getEffective() {
3511
+ return $this->effective;
3512
+ }
3513
+ }
3514
+
3515
+ class Google_ProfileRef extends Google_Model {
3516
+ public $accountId;
3517
+ public $href;
3518
+ public $id;
3519
+ public $internalWebPropertyId;
3520
+ public $kind;
3521
+ public $name;
3522
+ public $webPropertyId;
3523
+ public function setAccountId( $accountId) {
3524
+ $this->accountId = $accountId;
3525
+ }
3526
+ public function getAccountId() {
3527
+ return $this->accountId;
3528
+ }
3529
+ public function setHref( $href) {
3530
+ $this->href = $href;
3531
+ }
3532
+ public function getHref() {
3533
+ return $this->href;
3534
+ }
3535
+ public function setId( $id) {
3536
+ $this->id = $id;
3537
+ }
3538
+ public function getId() {
3539
+ return $this->id;
3540
+ }
3541
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
3542
+ $this->internalWebPropertyId = $internalWebPropertyId;
3543
+ }
3544
+ public function getInternalWebPropertyId() {
3545
+ return $this->internalWebPropertyId;
3546
+ }
3547
+ public function setKind( $kind) {
3548
+ $this->kind = $kind;
3549
+ }
3550
+ public function getKind() {
3551
+ return $this->kind;
3552
+ }
3553
+ public function setName( $name) {
3554
+ $this->name = $name;
3555
+ }
3556
+ public function getName() {
3557
+ return $this->name;
3558
+ }
3559
+ public function setWebPropertyId( $webPropertyId) {
3560
+ $this->webPropertyId = $webPropertyId;
3561
+ }
3562
+ public function getWebPropertyId() {
3563
+ return $this->webPropertyId;
3564
+ }
3565
+ }
3566
+
3567
+ class Google_Profiles extends Google_Model {
3568
+ protected $__itemsType = 'Google_Profile';
3569
+ protected $__itemsDataType = 'array';
3570
+ public $items;
3571
+ public $itemsPerPage;
3572
+ public $kind;
3573
+ public $nextLink;
3574
+ public $previousLink;
3575
+ public $startIndex;
3576
+ public $totalResults;
3577
+ public $username;
3578
+ public function setItems(/* array(Google_Profile) */ $items) {
3579
+ $this->assertIsArray($items, 'Google_Profile', __METHOD__);
3580
+ $this->items = $items;
3581
+ }
3582
+ public function getItems() {
3583
+ return $this->items;
3584
+ }
3585
+ public function setItemsPerPage( $itemsPerPage) {
3586
+ $this->itemsPerPage = $itemsPerPage;
3587
+ }
3588
+ public function getItemsPerPage() {
3589
+ return $this->itemsPerPage;
3590
+ }
3591
+ public function setKind( $kind) {
3592
+ $this->kind = $kind;
3593
+ }
3594
+ public function getKind() {
3595
+ return $this->kind;
3596
+ }
3597
+ public function setNextLink( $nextLink) {
3598
+ $this->nextLink = $nextLink;
3599
+ }
3600
+ public function getNextLink() {
3601
+ return $this->nextLink;
3602
+ }
3603
+ public function setPreviousLink( $previousLink) {
3604
+ $this->previousLink = $previousLink;
3605
+ }
3606
+ public function getPreviousLink() {
3607
+ return $this->previousLink;
3608
+ }
3609
+ public function setStartIndex( $startIndex) {
3610
+ $this->startIndex = $startIndex;
3611
+ }
3612
+ public function getStartIndex() {
3613
+ return $this->startIndex;
3614
+ }
3615
+ public function setTotalResults( $totalResults) {
3616
+ $this->totalResults = $totalResults;
3617
+ }
3618
+ public function getTotalResults() {
3619
+ return $this->totalResults;
3620
+ }
3621
+ public function setUsername( $username) {
3622
+ $this->username = $username;
3623
+ }
3624
+ public function getUsername() {
3625
+ return $this->username;
3626
+ }
3627
+ }
3628
+
3629
+ class Google_RealtimeData extends Google_Model {
3630
+ protected $__columnHeadersType = 'Google_RealtimeDataColumnHeaders';
3631
+ protected $__columnHeadersDataType = 'array';
3632
+ public $columnHeaders;
3633
+ public $id;
3634
+ public $kind;
3635
+ protected $__profileInfoType = 'Google_RealtimeDataProfileInfo';
3636
+ protected $__profileInfoDataType = '';
3637
+ public $profileInfo;
3638
+ protected $__queryType = 'Google_RealtimeDataQuery';
3639
+ protected $__queryDataType = '';
3640
+ public $query;
3641
+ public $rows;
3642
+ public $selfLink;
3643
+ public $totalResults;
3644
+ public $totalsForAllResults;
3645
+ public function setColumnHeaders(/* array(Google_RealtimeDataColumnHeaders) */ $columnHeaders) {
3646
+ $this->assertIsArray($columnHeaders, 'Google_RealtimeDataColumnHeaders', __METHOD__);
3647
+ $this->columnHeaders = $columnHeaders;
3648
+ }
3649
+ public function getColumnHeaders() {
3650
+ return $this->columnHeaders;
3651
+ }
3652
+ public function setId( $id) {
3653
+ $this->id = $id;
3654
+ }
3655
+ public function getId() {
3656
+ return $this->id;
3657
+ }
3658
+ public function setKind( $kind) {
3659
+ $this->kind = $kind;
3660
+ }
3661
+ public function getKind() {
3662
+ return $this->kind;
3663
+ }
3664
+ public function setProfileInfo(Google_RealtimeDataProfileInfo $profileInfo) {
3665
+ $this->profileInfo = $profileInfo;
3666
+ }
3667
+ public function getProfileInfo() {
3668
+ return $this->profileInfo;
3669
+ }
3670
+ public function setQuery(Google_RealtimeDataQuery $query) {
3671
+ $this->query = $query;
3672
+ }
3673
+ public function getQuery() {
3674
+ return $this->query;
3675
+ }
3676
+ public function setRows(/* array(Google_string) */ $rows) {
3677
+ $this->assertIsArray($rows, 'Google_string', __METHOD__);
3678
+ $this->rows = $rows;
3679
+ }
3680
+ public function getRows() {
3681
+ return $this->rows;
3682
+ }
3683
+ public function setSelfLink( $selfLink) {
3684
+ $this->selfLink = $selfLink;
3685
+ }
3686
+ public function getSelfLink() {
3687
+ return $this->selfLink;
3688
+ }
3689
+ public function setTotalResults( $totalResults) {
3690
+ $this->totalResults = $totalResults;
3691
+ }
3692
+ public function getTotalResults() {
3693
+ return $this->totalResults;
3694
+ }
3695
+ public function setTotalsForAllResults( $totalsForAllResults) {
3696
+ $this->totalsForAllResults = $totalsForAllResults;
3697
+ }
3698
+ public function getTotalsForAllResults() {
3699
+ return $this->totalsForAllResults;
3700
+ }
3701
+ }
3702
+
3703
+ class Google_RealtimeDataColumnHeaders extends Google_Model {
3704
+ public $columnType;
3705
+ public $dataType;
3706
+ public $name;
3707
+ public function setColumnType( $columnType) {
3708
+ $this->columnType = $columnType;
3709
+ }
3710
+ public function getColumnType() {
3711
+ return $this->columnType;
3712
+ }
3713
+ public function setDataType( $dataType) {
3714
+ $this->dataType = $dataType;
3715
+ }
3716
+ public function getDataType() {
3717
+ return $this->dataType;
3718
+ }
3719
+ public function setName( $name) {
3720
+ $this->name = $name;
3721
+ }
3722
+ public function getName() {
3723
+ return $this->name;
3724
+ }
3725
+ }
3726
+
3727
+ class Google_RealtimeDataProfileInfo extends Google_Model {
3728
+ public $accountId;
3729
+ public $internalWebPropertyId;
3730
+ public $profileId;
3731
+ public $profileName;
3732
+ public $tableId;
3733
+ public $webPropertyId;
3734
+ public function setAccountId( $accountId) {
3735
+ $this->accountId = $accountId;
3736
+ }
3737
+ public function getAccountId() {
3738
+ return $this->accountId;
3739
+ }
3740
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
3741
+ $this->internalWebPropertyId = $internalWebPropertyId;
3742
+ }
3743
+ public function getInternalWebPropertyId() {
3744
+ return $this->internalWebPropertyId;
3745
+ }
3746
+ public function setProfileId( $profileId) {
3747
+ $this->profileId = $profileId;
3748
+ }
3749
+ public function getProfileId() {
3750
+ return $this->profileId;
3751
+ }
3752
+ public function setProfileName( $profileName) {
3753
+ $this->profileName = $profileName;
3754
+ }
3755
+ public function getProfileName() {
3756
+ return $this->profileName;
3757
+ }
3758
+ public function setTableId( $tableId) {
3759
+ $this->tableId = $tableId;
3760
+ }
3761
+ public function getTableId() {
3762
+ return $this->tableId;
3763
+ }
3764
+ public function setWebPropertyId( $webPropertyId) {
3765
+ $this->webPropertyId = $webPropertyId;
3766
+ }
3767
+ public function getWebPropertyId() {
3768
+ return $this->webPropertyId;
3769
+ }
3770
+ }
3771
+
3772
+ class Google_RealtimeDataQuery extends Google_Model {
3773
+ public $dimensions;
3774
+ public $filters;
3775
+ public $ids;
3776
+ public $max_results;
3777
+ public $metrics;
3778
+ public $sort;
3779
+ public function setDimensions( $dimensions) {
3780
+ $this->dimensions = $dimensions;
3781
+ }
3782
+ public function getDimensions() {
3783
+ return $this->dimensions;
3784
+ }
3785
+ public function setFilters( $filters) {
3786
+ $this->filters = $filters;
3787
+ }
3788
+ public function getFilters() {
3789
+ return $this->filters;
3790
+ }
3791
+ public function setIds( $ids) {
3792
+ $this->ids = $ids;
3793
+ }
3794
+ public function getIds() {
3795
+ return $this->ids;
3796
+ }
3797
+ public function setMax_results( $max_results) {
3798
+ $this->max_results = $max_results;
3799
+ }
3800
+ public function getMax_results() {
3801
+ return $this->max_results;
3802
+ }
3803
+ public function setMetrics(/* array(Google_string) */ $metrics) {
3804
+ $this->assertIsArray($metrics, 'Google_string', __METHOD__);
3805
+ $this->metrics = $metrics;
3806
+ }
3807
+ public function getMetrics() {
3808
+ return $this->metrics;
3809
+ }
3810
+ public function setSort(/* array(Google_string) */ $sort) {
3811
+ $this->assertIsArray($sort, 'Google_string', __METHOD__);
3812
+ $this->sort = $sort;
3813
+ }
3814
+ public function getSort() {
3815
+ return $this->sort;
3816
+ }
3817
+ }
3818
+
3819
+ class Google_Segment extends Google_Model {
3820
+ public $created;
3821
+ public $definition;
3822
+ public $id;
3823
+ public $kind;
3824
+ public $name;
3825
+ public $segmentId;
3826
+ public $selfLink;
3827
+ public $updated;
3828
+ public function setCreated( $created) {
3829
+ $this->created = $created;
3830
+ }
3831
+ public function getCreated() {
3832
+ return $this->created;
3833
+ }
3834
+ public function setDefinition( $definition) {
3835
+ $this->definition = $definition;
3836
+ }
3837
+ public function getDefinition() {
3838
+ return $this->definition;
3839
+ }
3840
+ public function setId( $id) {
3841
+ $this->id = $id;
3842
+ }
3843
+ public function getId() {
3844
+ return $this->id;
3845
+ }
3846
+ public function setKind( $kind) {
3847
+ $this->kind = $kind;
3848
+ }
3849
+ public function getKind() {
3850
+ return $this->kind;
3851
+ }
3852
+ public function setName( $name) {
3853
+ $this->name = $name;
3854
+ }
3855
+ public function getName() {
3856
+ return $this->name;
3857
+ }
3858
+ public function setSegmentId( $segmentId) {
3859
+ $this->segmentId = $segmentId;
3860
+ }
3861
+ public function getSegmentId() {
3862
+ return $this->segmentId;
3863
+ }
3864
+ public function setSelfLink( $selfLink) {
3865
+ $this->selfLink = $selfLink;
3866
+ }
3867
+ public function getSelfLink() {
3868
+ return $this->selfLink;
3869
+ }
3870
+ public function setUpdated( $updated) {
3871
+ $this->updated = $updated;
3872
+ }
3873
+ public function getUpdated() {
3874
+ return $this->updated;
3875
+ }
3876
+ }
3877
+
3878
+ class Google_Segments extends Google_Model {
3879
+ protected $__itemsType = 'Google_Segment';
3880
+ protected $__itemsDataType = 'array';
3881
+ public $items;
3882
+ public $itemsPerPage;
3883
+ public $kind;
3884
+ public $nextLink;
3885
+ public $previousLink;
3886
+ public $startIndex;
3887
+ public $totalResults;
3888
+ public $username;
3889
+ public function setItems(/* array(Google_Segment) */ $items) {
3890
+ $this->assertIsArray($items, 'Google_Segment', __METHOD__);
3891
+ $this->items = $items;
3892
+ }
3893
+ public function getItems() {
3894
+ return $this->items;
3895
+ }
3896
+ public function setItemsPerPage( $itemsPerPage) {
3897
+ $this->itemsPerPage = $itemsPerPage;
3898
+ }
3899
+ public function getItemsPerPage() {
3900
+ return $this->itemsPerPage;
3901
+ }
3902
+ public function setKind( $kind) {
3903
+ $this->kind = $kind;
3904
+ }
3905
+ public function getKind() {
3906
+ return $this->kind;
3907
+ }
3908
+ public function setNextLink( $nextLink) {
3909
+ $this->nextLink = $nextLink;
3910
+ }
3911
+ public function getNextLink() {
3912
+ return $this->nextLink;
3913
+ }
3914
+ public function setPreviousLink( $previousLink) {
3915
+ $this->previousLink = $previousLink;
3916
+ }
3917
+ public function getPreviousLink() {
3918
+ return $this->previousLink;
3919
+ }
3920
+ public function setStartIndex( $startIndex) {
3921
+ $this->startIndex = $startIndex;
3922
+ }
3923
+ public function getStartIndex() {
3924
+ return $this->startIndex;
3925
+ }
3926
+ public function setTotalResults( $totalResults) {
3927
+ $this->totalResults = $totalResults;
3928
+ }
3929
+ public function getTotalResults() {
3930
+ return $this->totalResults;
3931
+ }
3932
+ public function setUsername( $username) {
3933
+ $this->username = $username;
3934
+ }
3935
+ public function getUsername() {
3936
+ return $this->username;
3937
+ }
3938
+ }
3939
+
3940
+ class Google_Upload extends Google_Model {
3941
+ public $accountId;
3942
+ public $customDataSourceId;
3943
+ public $errors;
3944
+ public $id;
3945
+ public $kind;
3946
+ public $status;
3947
+ public function setAccountId( $accountId) {
3948
+ $this->accountId = $accountId;
3949
+ }
3950
+ public function getAccountId() {
3951
+ return $this->accountId;
3952
+ }
3953
+ public function setCustomDataSourceId( $customDataSourceId) {
3954
+ $this->customDataSourceId = $customDataSourceId;
3955
+ }
3956
+ public function getCustomDataSourceId() {
3957
+ return $this->customDataSourceId;
3958
+ }
3959
+ public function setErrors(/* array(Google_string) */ $errors) {
3960
+ $this->assertIsArray($errors, 'Google_string', __METHOD__);
3961
+ $this->errors = $errors;
3962
+ }
3963
+ public function getErrors() {
3964
+ return $this->errors;
3965
+ }
3966
+ public function setId( $id) {
3967
+ $this->id = $id;
3968
+ }
3969
+ public function getId() {
3970
+ return $this->id;
3971
+ }
3972
+ public function setKind( $kind) {
3973
+ $this->kind = $kind;
3974
+ }
3975
+ public function getKind() {
3976
+ return $this->kind;
3977
+ }
3978
+ public function setStatus( $status) {
3979
+ $this->status = $status;
3980
+ }
3981
+ public function getStatus() {
3982
+ return $this->status;
3983
+ }
3984
+ }
3985
+
3986
+ class Google_Uploads extends Google_Model {
3987
+ protected $__itemsType = 'Google_Upload';
3988
+ protected $__itemsDataType = 'array';
3989
+ public $items;
3990
+ public $itemsPerPage;
3991
+ public $kind;
3992
+ public $nextLink;
3993
+ public $previousLink;
3994
+ public $startIndex;
3995
+ public $totalResults;
3996
+ public function setItems(/* array(Google_Upload) */ $items) {
3997
+ $this->assertIsArray($items, 'Google_Upload', __METHOD__);
3998
+ $this->items = $items;
3999
+ }
4000
+ public function getItems() {
4001
+ return $this->items;
4002
+ }
4003
+ public function setItemsPerPage( $itemsPerPage) {
4004
+ $this->itemsPerPage = $itemsPerPage;
4005
+ }
4006
+ public function getItemsPerPage() {
4007
+ return $this->itemsPerPage;
4008
+ }
4009
+ public function setKind( $kind) {
4010
+ $this->kind = $kind;
4011
+ }
4012
+ public function getKind() {
4013
+ return $this->kind;
4014
+ }
4015
+ public function setNextLink( $nextLink) {
4016
+ $this->nextLink = $nextLink;
4017
+ }
4018
+ public function getNextLink() {
4019
+ return $this->nextLink;
4020
+ }
4021
+ public function setPreviousLink( $previousLink) {
4022
+ $this->previousLink = $previousLink;
4023
+ }
4024
+ public function getPreviousLink() {
4025
+ return $this->previousLink;
4026
+ }
4027
+ public function setStartIndex( $startIndex) {
4028
+ $this->startIndex = $startIndex;
4029
+ }
4030
+ public function getStartIndex() {
4031
+ return $this->startIndex;
4032
+ }
4033
+ public function setTotalResults( $totalResults) {
4034
+ $this->totalResults = $totalResults;
4035
+ }
4036
+ public function getTotalResults() {
4037
+ return $this->totalResults;
4038
+ }
4039
+ }
4040
+
4041
+ class Google_UserRef extends Google_Model {
4042
+ public $email;
4043
+ public $id;
4044
+ public $kind;
4045
+ public function setEmail( $email) {
4046
+ $this->email = $email;
4047
+ }
4048
+ public function getEmail() {
4049
+ return $this->email;
4050
+ }
4051
+ public function setId( $id) {
4052
+ $this->id = $id;
4053
+ }
4054
+ public function getId() {
4055
+ return $this->id;
4056
+ }
4057
+ public function setKind( $kind) {
4058
+ $this->kind = $kind;
4059
+ }
4060
+ public function getKind() {
4061
+ return $this->kind;
4062
+ }
4063
+ }
4064
+
4065
+ class Google_WebPropertyRef extends Google_Model {
4066
+ public $accountId;
4067
+ public $href;
4068
+ public $id;
4069
+ public $internalWebPropertyId;
4070
+ public $kind;
4071
+ public $name;
4072
+ public function setAccountId( $accountId) {
4073
+ $this->accountId = $accountId;
4074
+ }
4075
+ public function getAccountId() {
4076
+ return $this->accountId;
4077
+ }
4078
+ public function setHref( $href) {
4079
+ $this->href = $href;
4080
+ }
4081
+ public function getHref() {
4082
+ return $this->href;
4083
+ }
4084
+ public function setId( $id) {
4085
+ $this->id = $id;
4086
+ }
4087
+ public function getId() {
4088
+ return $this->id;
4089
+ }
4090
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
4091
+ $this->internalWebPropertyId = $internalWebPropertyId;
4092
+ }
4093
+ public function getInternalWebPropertyId() {
4094
+ return $this->internalWebPropertyId;
4095
+ }
4096
+ public function setKind( $kind) {
4097
+ $this->kind = $kind;
4098
+ }
4099
+ public function getKind() {
4100
+ return $this->kind;
4101
+ }
4102
+ public function setName( $name) {
4103
+ $this->name = $name;
4104
+ }
4105
+ public function getName() {
4106
+ return $this->name;
4107
+ }
4108
+ }
4109
+
4110
+ class Google_Webproperties extends Google_Model {
4111
+ protected $__itemsType = 'Google_Webproperty';
4112
+ protected $__itemsDataType = 'array';
4113
+ public $items;
4114
+ public $itemsPerPage;
4115
+ public $kind;
4116
+ public $nextLink;
4117
+ public $previousLink;
4118
+ public $startIndex;
4119
+ public $totalResults;
4120
+ public $username;
4121
+ public function setItems(/* array(Google_Webproperty) */ $items) {
4122
+ $this->assertIsArray($items, 'Google_Webproperty', __METHOD__);
4123
+ $this->items = $items;
4124
+ }
4125
+ public function getItems() {
4126
+ return $this->items;
4127
+ }
4128
+ public function setItemsPerPage( $itemsPerPage) {
4129
+ $this->itemsPerPage = $itemsPerPage;
4130
+ }
4131
+ public function getItemsPerPage() {
4132
+ return $this->itemsPerPage;
4133
+ }
4134
+ public function setKind( $kind) {
4135
+ $this->kind = $kind;
4136
+ }
4137
+ public function getKind() {
4138
+ return $this->kind;
4139
+ }
4140
+ public function setNextLink( $nextLink) {
4141
+ $this->nextLink = $nextLink;
4142
+ }
4143
+ public function getNextLink() {
4144
+ return $this->nextLink;
4145
+ }
4146
+ public function setPreviousLink( $previousLink) {
4147
+ $this->previousLink = $previousLink;
4148
+ }
4149
+ public function getPreviousLink() {
4150
+ return $this->previousLink;
4151
+ }
4152
+ public function setStartIndex( $startIndex) {
4153
+ $this->startIndex = $startIndex;
4154
+ }
4155
+ public function getStartIndex() {
4156
+ return $this->startIndex;
4157
+ }
4158
+ public function setTotalResults( $totalResults) {
4159
+ $this->totalResults = $totalResults;
4160
+ }
4161
+ public function getTotalResults() {
4162
+ return $this->totalResults;
4163
+ }
4164
+ public function setUsername( $username) {
4165
+ $this->username = $username;
4166
+ }
4167
+ public function getUsername() {
4168
+ return $this->username;
4169
+ }
4170
+ }
4171
+
4172
+ class Google_Webproperty extends Google_Model {
4173
+ public $accountId;
4174
+ protected $__childLinkType = 'Google_WebpropertyChildLink';
4175
+ protected $__childLinkDataType = '';
4176
+ public $childLink;
4177
+ public $created;
4178
+ public $defaultProfileId;
4179
+ public $id;
4180
+ public $industryVertical;
4181
+ public $internalWebPropertyId;
4182
+ public $kind;
4183
+ public $level;
4184
+ public $name;
4185
+ protected $__parentLinkType = 'Google_WebpropertyParentLink';
4186
+ protected $__parentLinkDataType = '';
4187
+ public $parentLink;
4188
+ protected $__permissionsType = 'Google_WebpropertyPermissions';
4189
+ protected $__permissionsDataType = '';
4190
+ public $permissions;
4191
+ public $profileCount;
4192
+ public $selfLink;
4193
+ public $updated;
4194
+ public $websiteUrl;
4195
+ public function setAccountId( $accountId) {
4196
+ $this->accountId = $accountId;
4197
+ }
4198
+ public function getAccountId() {
4199
+ return $this->accountId;
4200
+ }
4201
+ public function setChildLink(Google_WebpropertyChildLink $childLink) {
4202
+ $this->childLink = $childLink;
4203
+ }
4204
+ public function getChildLink() {
4205
+ return $this->childLink;
4206
+ }
4207
+ public function setCreated( $created) {
4208
+ $this->created = $created;
4209
+ }
4210
+ public function getCreated() {
4211
+ return $this->created;
4212
+ }
4213
+ public function setDefaultProfileId( $defaultProfileId) {
4214
+ $this->defaultProfileId = $defaultProfileId;
4215
+ }
4216
+ public function getDefaultProfileId() {
4217
+ return $this->defaultProfileId;
4218
+ }
4219
+ public function setId( $id) {
4220
+ $this->id = $id;
4221
+ }
4222
+ public function getId() {
4223
+ return $this->id;
4224
+ }
4225
+ public function setIndustryVertical( $industryVertical) {
4226
+ $this->industryVertical = $industryVertical;
4227
+ }
4228
+ public function getIndustryVertical() {
4229
+ return $this->industryVertical;
4230
+ }
4231
+ public function setInternalWebPropertyId( $internalWebPropertyId) {
4232
+ $this->internalWebPropertyId = $internalWebPropertyId;
4233
+ }
4234
+ public function getInternalWebPropertyId() {
4235
+ return $this->internalWebPropertyId;
4236
+ }
4237
+ public function setKind( $kind) {
4238
+ $this->kind = $kind;
4239
+ }
4240
+ public function getKind() {
4241
+ return $this->kind;
4242
+ }
4243
+ public function setLevel( $level) {
4244
+ $this->level = $level;
4245
+ }
4246
+ public function getLevel() {
4247
+ return $this->level;
4248
+ }
4249
+ public function setName( $name) {
4250
+ $this->name = $name;
4251
+ }
4252
+ public function getName() {
4253
+ return $this->name;
4254
+ }
4255
+ public function setParentLink(Google_WebpropertyParentLink $parentLink) {
4256
+ $this->parentLink = $parentLink;
4257
+ }
4258
+ public function getParentLink() {
4259
+ return $this->parentLink;
4260
+ }
4261
+ public function setPermissions(Google_WebpropertyPermissions $permissions) {
4262
+ $this->permissions = $permissions;
4263
+ }
4264
+ public function getPermissions() {
4265
+ return $this->permissions;
4266
+ }
4267
+ public function setProfileCount( $profileCount) {
4268
+ $this->profileCount = $profileCount;
4269
+ }
4270
+ public function getProfileCount() {
4271
+ return $this->profileCount;
4272
+ }
4273
+ public function setSelfLink( $selfLink) {
4274
+ $this->selfLink = $selfLink;
4275
+ }
4276
+ public function getSelfLink() {
4277
+ return $this->selfLink;
4278
+ }
4279
+ public function setUpdated( $updated) {
4280
+ $this->updated = $updated;
4281
+ }
4282
+ public function getUpdated() {
4283
+ return $this->updated;
4284
+ }
4285
+ public function setWebsiteUrl( $websiteUrl) {
4286
+ $this->websiteUrl = $websiteUrl;
4287
+ }
4288
+ public function getWebsiteUrl() {
4289
+ return $this->websiteUrl;
4290
+ }
4291
+ }
4292
+
4293
+ class Google_WebpropertyChildLink extends Google_Model {
4294
+ public $href;
4295
+ public $type;
4296
+ public function setHref( $href) {
4297
+ $this->href = $href;
4298
+ }
4299
+ public function getHref() {
4300
+ return $this->href;
4301
+ }
4302
+ public function setType( $type) {
4303
+ $this->type = $type;
4304
+ }
4305
+ public function getType() {
4306
+ return $this->type;
4307
+ }
4308
+ }
4309
+
4310
+ class Google_WebpropertyParentLink extends Google_Model {
4311
+ public $href;
4312
+ public $type;
4313
+ public function setHref( $href) {
4314
+ $this->href = $href;
4315
+ }
4316
+ public function getHref() {
4317
+ return $this->href;
4318
+ }
4319
+ public function setType( $type) {
4320
+ $this->type = $type;
4321
+ }
4322
+ public function getType() {
4323
+ return $this->type;
4324
+ }
4325
+ }
4326
+
4327
+ class Google_WebpropertyPermissions extends Google_Model {
4328
+ public $effective;
4329
+ public function setEffective(/* array(Google_string) */ $effective) {
4330
+ $this->assertIsArray($effective, 'Google_string', __METHOD__);
4331
+ $this->effective = $effective;
4332
+ }
4333
+ public function getEffective() {
4334
+ return $this->effective;
4335
+ }
4336
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AndroidpublisherService.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "inapppurchases" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $androidpublisherService = new Google_AndroidPublisherService(...);
22
+ * $inapppurchases = $androidpublisherService->inapppurchases;
23
+ * </code>
24
+ */
25
+ class Google_InapppurchasesServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Checks the purchase and consumption status of an inapp item. (inapppurchases.get)
29
+ *
30
+ * @param string $packageName The package name of the application the inapp product was sold in (for example, 'com.some.thing').
31
+ * @param string $productId The inapp product SKU (for example, 'com.some.thing.inapp1').
32
+ * @param string $token The token provided to the user's device when the inapp product was purchased.
33
+ * @param array $optParams Optional parameters.
34
+ * @return Google_InappPurchase
35
+ */
36
+ public function get($packageName, $productId, $token, $optParams = array()) {
37
+ $params = array('packageName' => $packageName, 'productId' => $productId, 'token' => $token);
38
+ $params = array_merge($params, $optParams);
39
+ $data = $this->__call('get', array($params));
40
+ if ($this->useObjects()) {
41
+ return new Google_InappPurchase($data);
42
+ } else {
43
+ return $data;
44
+ }
45
+ }
46
+ }
47
+
48
+ /**
49
+ * The "purchases" collection of methods.
50
+ * Typical usage is:
51
+ * <code>
52
+ * $androidpublisherService = new Google_AndroidPublisherService(...);
53
+ * $purchases = $androidpublisherService->purchases;
54
+ * </code>
55
+ */
56
+ class Google_PurchasesServiceResource extends Google_ServiceResource {
57
+
58
+ /**
59
+ * Cancels a user's subscription purchase. The subscription remains valid until its expiration time.
60
+ * (purchases.cancel)
61
+ *
62
+ * @param string $packageName The package name of the application for which this subscription was purchased (for example, 'com.some.thing').
63
+ * @param string $subscriptionId The purchased subscription ID (for example, 'monthly001').
64
+ * @param string $token The token provided to the user's device when the subscription was purchased.
65
+ * @param array $optParams Optional parameters.
66
+ */
67
+ public function cancel($packageName, $subscriptionId, $token, $optParams = array()) {
68
+ $params = array('packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token);
69
+ $params = array_merge($params, $optParams);
70
+ $data = $this->__call('cancel', array($params));
71
+ return $data;
72
+ }
73
+ /**
74
+ * Checks whether a user's subscription purchase is valid and returns its expiry time.
75
+ * (purchases.get)
76
+ *
77
+ * @param string $packageName The package name of the application for which this subscription was purchased (for example, 'com.some.thing').
78
+ * @param string $subscriptionId The purchased subscription ID (for example, 'monthly001').
79
+ * @param string $token The token provided to the user's device when the subscription was purchased.
80
+ * @param array $optParams Optional parameters.
81
+ * @return Google_SubscriptionPurchase
82
+ */
83
+ public function get($packageName, $subscriptionId, $token, $optParams = array()) {
84
+ $params = array('packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token);
85
+ $params = array_merge($params, $optParams);
86
+ $data = $this->__call('get', array($params));
87
+ if ($this->useObjects()) {
88
+ return new Google_SubscriptionPurchase($data);
89
+ } else {
90
+ return $data;
91
+ }
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Service definition for Google_AndroidPublisher (v1.1).
97
+ *
98
+ * <p>
99
+ * Lets Android application developers access their Google Play accounts.
100
+ * </p>
101
+ *
102
+ * <p>
103
+ * For more information about this service, see the
104
+ * <a href="https://developers.google.com/android-publisher" target="_blank">API Documentation</a>
105
+ * </p>
106
+ *
107
+ * @author Google, Inc.
108
+ */
109
+ class Google_AndroidPublisherService extends Google_Service {
110
+ public $inapppurchases;
111
+ public $purchases;
112
+ /**
113
+ * Constructs the internal representation of the AndroidPublisher service.
114
+ *
115
+ * @param Google_Client $client
116
+ */
117
+ public function __construct(Google_Client $client) {
118
+ $this->servicePath = 'androidpublisher/v1.1/applications/';
119
+ $this->version = 'v1.1';
120
+ $this->serviceName = 'androidpublisher';
121
+
122
+ $client->addService($this->serviceName, $this->version);
123
+ $this->inapppurchases = new Google_InapppurchasesServiceResource($this, $this->serviceName, 'inapppurchases', json_decode('{"methods": {"get": {"id": "androidpublisher.inapppurchases.get", "path": "{packageName}/inapp/{productId}/purchases/{token}", "httpMethod": "GET", "parameters": {"packageName": {"type": "string", "required": true, "location": "path"}, "productId": {"type": "string", "required": true, "location": "path"}, "token": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "InappPurchase"}}}}', true));
124
+ $this->purchases = new Google_PurchasesServiceResource($this, $this->serviceName, 'purchases', json_decode('{"methods": {"cancel": {"id": "androidpublisher.purchases.cancel", "path": "{packageName}/subscriptions/{subscriptionId}/purchases/{token}/cancel", "httpMethod": "POST", "parameters": {"packageName": {"type": "string", "required": true, "location": "path"}, "subscriptionId": {"type": "string", "required": true, "location": "path"}, "token": {"type": "string", "required": true, "location": "path"}}}, "get": {"id": "androidpublisher.purchases.get", "path": "{packageName}/subscriptions/{subscriptionId}/purchases/{token}", "httpMethod": "GET", "parameters": {"packageName": {"type": "string", "required": true, "location": "path"}, "subscriptionId": {"type": "string", "required": true, "location": "path"}, "token": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "SubscriptionPurchase"}}}}', true));
125
+
126
+ }
127
+ }
128
+
129
+
130
+
131
+ class Google_InappPurchase extends Google_Model {
132
+ public $consumptionState;
133
+ public $developerPayload;
134
+ public $kind;
135
+ public $purchaseState;
136
+ public $purchaseTime;
137
+ public function setConsumptionState( $consumptionState) {
138
+ $this->consumptionState = $consumptionState;
139
+ }
140
+ public function getConsumptionState() {
141
+ return $this->consumptionState;
142
+ }
143
+ public function setDeveloperPayload( $developerPayload) {
144
+ $this->developerPayload = $developerPayload;
145
+ }
146
+ public function getDeveloperPayload() {
147
+ return $this->developerPayload;
148
+ }
149
+ public function setKind( $kind) {
150
+ $this->kind = $kind;
151
+ }
152
+ public function getKind() {
153
+ return $this->kind;
154
+ }
155
+ public function setPurchaseState( $purchaseState) {
156
+ $this->purchaseState = $purchaseState;
157
+ }
158
+ public function getPurchaseState() {
159
+ return $this->purchaseState;
160
+ }
161
+ public function setPurchaseTime( $purchaseTime) {
162
+ $this->purchaseTime = $purchaseTime;
163
+ }
164
+ public function getPurchaseTime() {
165
+ return $this->purchaseTime;
166
+ }
167
+ }
168
+
169
+ class Google_SubscriptionPurchase extends Google_Model {
170
+ public $autoRenewing;
171
+ public $initiationTimestampMsec;
172
+ public $kind;
173
+ public $validUntilTimestampMsec;
174
+ public function setAutoRenewing( $autoRenewing) {
175
+ $this->autoRenewing = $autoRenewing;
176
+ }
177
+ public function getAutoRenewing() {
178
+ return $this->autoRenewing;
179
+ }
180
+ public function setInitiationTimestampMsec( $initiationTimestampMsec) {
181
+ $this->initiationTimestampMsec = $initiationTimestampMsec;
182
+ }
183
+ public function getInitiationTimestampMsec() {
184
+ return $this->initiationTimestampMsec;
185
+ }
186
+ public function setKind( $kind) {
187
+ $this->kind = $kind;
188
+ }
189
+ public function getKind() {
190
+ return $this->kind;
191
+ }
192
+ public function setValidUntilTimestampMsec( $validUntilTimestampMsec) {
193
+ $this->validUntilTimestampMsec = $validUntilTimestampMsec;
194
+ }
195
+ public function getValidUntilTimestampMsec() {
196
+ return $this->validUntilTimestampMsec;
197
+ }
198
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AppstateService.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "states" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $appstateService = new Google_AppstateService(...);
22
+ * $states = $appstateService->states;
23
+ * </code>
24
+ */
25
+ class Google_StatesServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Clears (sets to empty) the data for the passed key if and only if the passed version matches the
29
+ * currently stored version. This method results in a conflict error on version mismatch.
30
+ * (states.clear)
31
+ *
32
+ * @param int $stateKey The key for the data to be retrieved.
33
+ * @param array $optParams Optional parameters.
34
+ *
35
+ * @opt_param string currentDataVersion The version of the data to be cleared. Version strings are returned by the server.
36
+ * @return Google_WriteResult
37
+ */
38
+ public function clear($stateKey, $optParams = array()) {
39
+ $params = array('stateKey' => $stateKey);
40
+ $params = array_merge($params, $optParams);
41
+ $data = $this->__call('clear', array($params));
42
+ if ($this->useObjects()) {
43
+ return new Google_WriteResult($data);
44
+ } else {
45
+ return $data;
46
+ }
47
+ }
48
+ /**
49
+ * Deletes a key and the data associated with it. The key is removed and no longer counts against
50
+ * the key quota. Note that since this method is not safe in the face of concurrent modifications,
51
+ * it should only be used for development and testing purposes. Invoking this method in shipping
52
+ * code can result in data loss and data corruption. (states.delete)
53
+ *
54
+ * @param int $stateKey The key for the data to be retrieved.
55
+ * @param array $optParams Optional parameters.
56
+ */
57
+ public function delete($stateKey, $optParams = array()) {
58
+ $params = array('stateKey' => $stateKey);
59
+ $params = array_merge($params, $optParams);
60
+ $data = $this->__call('delete', array($params));
61
+ return $data;
62
+ }
63
+ /**
64
+ * Retrieves the data corresponding to the passed key. (states.get)
65
+ *
66
+ * @param int $stateKey The key for the data to be retrieved.
67
+ * @param array $optParams Optional parameters.
68
+ * @return Google_GetResponse
69
+ */
70
+ public function get($stateKey, $optParams = array()) {
71
+ $params = array('stateKey' => $stateKey);
72
+ $params = array_merge($params, $optParams);
73
+ $data = $this->__call('get', array($params));
74
+ if ($this->useObjects()) {
75
+ return new Google_GetResponse($data);
76
+ } else {
77
+ return $data;
78
+ }
79
+ }
80
+ /**
81
+ * Lists all the states keys, and optionally the state data. (states.list)
82
+ *
83
+ * @param array $optParams Optional parameters.
84
+ *
85
+ * @opt_param bool includeData Whether to include the full data in addition to the version number
86
+ * @return Google_ListResponse
87
+ */
88
+ public function listStates($optParams = array()) {
89
+ $params = array();
90
+ $params = array_merge($params, $optParams);
91
+ $data = $this->__call('list', array($params));
92
+ if ($this->useObjects()) {
93
+ return new Google_ListResponse($data);
94
+ } else {
95
+ return $data;
96
+ }
97
+ }
98
+ /**
99
+ * Update the data associated with the input key if and only if the passed version matches the
100
+ * currently stored version. This method is safe in the face of concurrent writes. Maximum per-key
101
+ * size is 128KB. (states.update)
102
+ *
103
+ * @param int $stateKey The key for the data to be retrieved.
104
+ * @param Google_UpdateRequest $postBody
105
+ * @param array $optParams Optional parameters.
106
+ *
107
+ * @opt_param string currentStateVersion The version of the app state your application is attempting to update. If this does not match the current version, this method will return a conflict error. If there is no data stored on the server for this key, the update will succeed irrespective of the value of this parameter.
108
+ * @return Google_WriteResult
109
+ */
110
+ public function update($stateKey, Google_UpdateRequest $postBody, $optParams = array()) {
111
+ $params = array('stateKey' => $stateKey, 'postBody' => $postBody);
112
+ $params = array_merge($params, $optParams);
113
+ $data = $this->__call('update', array($params));
114
+ if ($this->useObjects()) {
115
+ return new Google_WriteResult($data);
116
+ } else {
117
+ return $data;
118
+ }
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Service definition for Google_Appstate (v1).
124
+ *
125
+ * <p>
126
+ * The Google App State API.
127
+ * </p>
128
+ *
129
+ * <p>
130
+ * For more information about this service, see the
131
+ * <a href="https://developers.google.com/games/services/web/api/states" target="_blank">API Documentation</a>
132
+ * </p>
133
+ *
134
+ * @author Google, Inc.
135
+ */
136
+ class Google_AppstateService extends Google_Service {
137
+ public $states;
138
+ /**
139
+ * Constructs the internal representation of the Appstate service.
140
+ *
141
+ * @param Google_Client $client
142
+ */
143
+ public function __construct(Google_Client $client) {
144
+ $this->servicePath = 'appstate/v1/';
145
+ $this->version = 'v1';
146
+ $this->serviceName = 'appstate';
147
+
148
+ $client->addService($this->serviceName, $this->version);
149
+ $this->states = new Google_StatesServiceResource($this, $this->serviceName, 'states', json_decode('{"methods": {"clear": {"id": "appstate.states.clear", "path": "states/{stateKey}/clear", "httpMethod": "POST", "parameters": {"currentDataVersion": {"type": "string", "location": "query"}, "stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "response": {"$ref": "WriteResult"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "delete": {"id": "appstate.states.delete", "path": "states/{stateKey}", "httpMethod": "DELETE", "parameters": {"stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "get": {"id": "appstate.states.get", "path": "states/{stateKey}", "httpMethod": "GET", "parameters": {"stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "response": {"$ref": "GetResponse"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "list": {"id": "appstate.states.list", "path": "states", "httpMethod": "GET", "parameters": {"includeData": {"type": "boolean", "default": "false", "location": "query"}}, "response": {"$ref": "ListResponse"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "update": {"id": "appstate.states.update", "path": "states/{stateKey}", "httpMethod": "PUT", "parameters": {"currentStateVersion": {"type": "string", "location": "query"}, "stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "request": {"$ref": "UpdateRequest"}, "response": {"$ref": "WriteResult"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}}}', true));
150
+
151
+ }
152
+ }
153
+
154
+
155
+
156
+ class Google_GetResponse extends Google_Model {
157
+ public $currentStateVersion;
158
+ public $data;
159
+ public $kind;
160
+ public $stateKey;
161
+ public function setCurrentStateVersion( $currentStateVersion) {
162
+ $this->currentStateVersion = $currentStateVersion;
163
+ }
164
+ public function getCurrentStateVersion() {
165
+ return $this->currentStateVersion;
166
+ }
167
+ public function setData( $data) {
168
+ $this->data = $data;
169
+ }
170
+ public function getData() {
171
+ return $this->data;
172
+ }
173
+ public function setKind( $kind) {
174
+ $this->kind = $kind;
175
+ }
176
+ public function getKind() {
177
+ return $this->kind;
178
+ }
179
+ public function setStateKey( $stateKey) {
180
+ $this->stateKey = $stateKey;
181
+ }
182
+ public function getStateKey() {
183
+ return $this->stateKey;
184
+ }
185
+ }
186
+
187
+ class Google_ListResponse extends Google_Model {
188
+ protected $__itemsType = 'Google_GetResponse';
189
+ protected $__itemsDataType = 'array';
190
+ public $items;
191
+ public $kind;
192
+ public $maximumKeyCount;
193
+ public function setItems(/* array(Google_GetResponse) */ $items) {
194
+ $this->assertIsArray($items, 'Google_GetResponse', __METHOD__);
195
+ $this->items = $items;
196
+ }
197
+ public function getItems() {
198
+ return $this->items;
199
+ }
200
+ public function setKind( $kind) {
201
+ $this->kind = $kind;
202
+ }
203
+ public function getKind() {
204
+ return $this->kind;
205
+ }
206
+ public function setMaximumKeyCount( $maximumKeyCount) {
207
+ $this->maximumKeyCount = $maximumKeyCount;
208
+ }
209
+ public function getMaximumKeyCount() {
210
+ return $this->maximumKeyCount;
211
+ }
212
+ }
213
+
214
+ class Google_UpdateRequest extends Google_Model {
215
+ public $data;
216
+ public $kind;
217
+ public function setData( $data) {
218
+ $this->data = $data;
219
+ }
220
+ public function getData() {
221
+ return $this->data;
222
+ }
223
+ public function setKind( $kind) {
224
+ $this->kind = $kind;
225
+ }
226
+ public function getKind() {
227
+ return $this->kind;
228
+ }
229
+ }
230
+
231
+ class Google_WriteResult extends Google_Model {
232
+ public $currentStateVersion;
233
+ public $kind;
234
+ public $stateKey;
235
+ public function setCurrentStateVersion( $currentStateVersion) {
236
+ $this->currentStateVersion = $currentStateVersion;
237
+ }
238
+ public function getCurrentStateVersion() {
239
+ return $this->currentStateVersion;
240
+ }
241
+ public function setKind( $kind) {
242
+ $this->kind = $kind;
243
+ }
244
+ public function getKind() {
245
+ return $this->kind;
246
+ }
247
+ public function setStateKey( $stateKey) {
248
+ $this->stateKey = $stateKey;
249
+ }
250
+ public function getStateKey() {
251
+ return $this->stateKey;
252
+ }
253
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_AuditService.php ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "activities" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $auditService = new Google_AuditService(...);
22
+ * $activities = $auditService->activities;
23
+ * </code>
24
+ */
25
+ class Google_ActivitiesServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Retrieves a list of activities for a specific customer and application. (activities.list)
29
+ *
30
+ * @param string $customerId Represents the customer who is the owner of target object on which action was performed.
31
+ * @param string $applicationId Application ID of the application on which the event was performed.
32
+ * @param array $optParams Optional parameters.
33
+ *
34
+ * @opt_param string actorApplicationId Application ID of the application which interacted on behalf of the user while performing the event.
35
+ * @opt_param string actorEmail Email address of the user who performed the action.
36
+ * @opt_param string actorIpAddress IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.
37
+ * @opt_param string caller Type of the caller.
38
+ * @opt_param string continuationToken Next page URL.
39
+ * @opt_param string endTime Return events which occured at or before this time.
40
+ * @opt_param string eventName Name of the event being queried.
41
+ * @opt_param int maxResults Number of activity records to be shown in each page.
42
+ * @opt_param string startTime Return events which occured at or after this time.
43
+ * @return Google_Activities
44
+ */
45
+ public function listActivities($customerId, $applicationId, $optParams = array()) {
46
+ $params = array('customerId' => $customerId, 'applicationId' => $applicationId);
47
+ $params = array_merge($params, $optParams);
48
+ $data = $this->__call('list', array($params));
49
+ if ($this->useObjects()) {
50
+ return new Google_Activities($data);
51
+ } else {
52
+ return $data;
53
+ }
54
+ }
55
+ }
56
+
57
+ /**
58
+ * Service definition for Google_Audit (v1).
59
+ *
60
+ * <p>
61
+ * Lets you access user activities in your enterprise made through various applications.
62
+ * </p>
63
+ *
64
+ * <p>
65
+ * For more information about this service, see the
66
+ * <a href="https://developers.google.com/google-apps/admin-audit/get_started" target="_blank">API Documentation</a>
67
+ * </p>
68
+ *
69
+ * @author Google, Inc.
70
+ */
71
+ class Google_AuditService extends Google_Service {
72
+ public $activities;
73
+ /**
74
+ * Constructs the internal representation of the Audit service.
75
+ *
76
+ * @param Google_Client $client
77
+ */
78
+ public function __construct(Google_Client $client) {
79
+ $this->servicePath = 'apps/reporting/audit/v1/';
80
+ $this->version = 'v1';
81
+ $this->serviceName = 'audit';
82
+
83
+ $client->addService($this->serviceName, $this->version);
84
+ $this->activities = new Google_ActivitiesServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods": {"list": {"id": "audit.activities.list", "path": "{customerId}/{applicationId}", "httpMethod": "GET", "parameters": {"actorApplicationId": {"type": "string", "format": "int64", "location": "query"}, "actorEmail": {"type": "string", "location": "query"}, "actorIpAddress": {"type": "string", "location": "query"}, "applicationId": {"type": "string", "required": true, "format": "int64", "location": "path"}, "caller": {"type": "string", "enum": ["application_owner", "customer"], "location": "query"}, "continuationToken": {"type": "string", "location": "query"}, "customerId": {"type": "string", "required": true, "location": "path"}, "endTime": {"type": "string", "location": "query"}, "eventName": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "1", "maximum": "1000", "location": "query"}, "startTime": {"type": "string", "location": "query"}}, "response": {"$ref": "Activities"}}}}', true));
85
+
86
+ }
87
+ }
88
+
89
+
90
+
91
+ class Google_Activities extends Google_Model {
92
+ protected $__itemsType = 'Google_Activity';
93
+ protected $__itemsDataType = 'array';
94
+ public $items;
95
+ public $kind;
96
+ public $next;
97
+ public function setItems(/* array(Google_Activity) */ $items) {
98
+ $this->assertIsArray($items, 'Google_Activity', __METHOD__);
99
+ $this->items = $items;
100
+ }
101
+ public function getItems() {
102
+ return $this->items;
103
+ }
104
+ public function setKind( $kind) {
105
+ $this->kind = $kind;
106
+ }
107
+ public function getKind() {
108
+ return $this->kind;
109
+ }
110
+ public function setNext( $next) {
111
+ $this->next = $next;
112
+ }
113
+ public function getNext() {
114
+ return $this->next;
115
+ }
116
+ }
117
+
118
+ class Google_Activity extends Google_Model {
119
+ protected $__actorType = 'Google_ActivityActor';
120
+ protected $__actorDataType = '';
121
+ public $actor;
122
+ protected $__eventsType = 'Google_ActivityEvents';
123
+ protected $__eventsDataType = 'array';
124
+ public $events;
125
+ protected $__idType = 'Google_ActivityId';
126
+ protected $__idDataType = '';
127
+ public $id;
128
+ public $ipAddress;
129
+ public $kind;
130
+ public $ownerDomain;
131
+ public function setActor(Google_ActivityActor $actor) {
132
+ $this->actor = $actor;
133
+ }
134
+ public function getActor() {
135
+ return $this->actor;
136
+ }
137
+ public function setEvents(/* array(Google_ActivityEvents) */ $events) {
138
+ $this->assertIsArray($events, 'Google_ActivityEvents', __METHOD__);
139
+ $this->events = $events;
140
+ }
141
+ public function getEvents() {
142
+ return $this->events;
143
+ }
144
+ public function setId(Google_ActivityId $id) {
145
+ $this->id = $id;
146
+ }
147
+ public function getId() {
148
+ return $this->id;
149
+ }
150
+ public function setIpAddress( $ipAddress) {
151
+ $this->ipAddress = $ipAddress;
152
+ }
153
+ public function getIpAddress() {
154
+ return $this->ipAddress;
155
+ }
156
+ public function setKind( $kind) {
157
+ $this->kind = $kind;
158
+ }
159
+ public function getKind() {
160
+ return $this->kind;
161
+ }
162
+ public function setOwnerDomain( $ownerDomain) {
163
+ $this->ownerDomain = $ownerDomain;
164
+ }
165
+ public function getOwnerDomain() {
166
+ return $this->ownerDomain;
167
+ }
168
+ }
169
+
170
+ class Google_ActivityActor extends Google_Model {
171
+ public $applicationId;
172
+ public $callerType;
173
+ public $email;
174
+ public $key;
175
+ public function setApplicationId( $applicationId) {
176
+ $this->applicationId = $applicationId;
177
+ }
178
+ public function getApplicationId() {
179
+ return $this->applicationId;
180
+ }
181
+ public function setCallerType( $callerType) {
182
+ $this->callerType = $callerType;
183
+ }
184
+ public function getCallerType() {
185
+ return $this->callerType;
186
+ }
187
+ public function setEmail( $email) {
188
+ $this->email = $email;
189
+ }
190
+ public function getEmail() {
191
+ return $this->email;
192
+ }
193
+ public function setKey( $key) {
194
+ $this->key = $key;
195
+ }
196
+ public function getKey() {
197
+ return $this->key;
198
+ }
199
+ }
200
+
201
+ class Google_ActivityEvents extends Google_Model {
202
+ public $eventType;
203
+ public $name;
204
+ protected $__parametersType = 'Google_ActivityEventsParameters';
205
+ protected $__parametersDataType = 'array';
206
+ public $parameters;
207
+ public function setEventType( $eventType) {
208
+ $this->eventType = $eventType;
209
+ }
210
+ public function getEventType() {
211
+ return $this->eventType;
212
+ }
213
+ public function setName( $name) {
214
+ $this->name = $name;
215
+ }
216
+ public function getName() {
217
+ return $this->name;
218
+ }
219
+ public function setParameters(/* array(Google_ActivityEventsParameters) */ $parameters) {
220
+ $this->assertIsArray($parameters, 'Google_ActivityEventsParameters', __METHOD__);
221
+ $this->parameters = $parameters;
222
+ }
223
+ public function getParameters() {
224
+ return $this->parameters;
225
+ }
226
+ }
227
+
228
+ class Google_ActivityEventsParameters extends Google_Model {
229
+ public $name;
230
+ public $value;
231
+ public function setName( $name) {
232
+ $this->name = $name;
233
+ }
234
+ public function getName() {
235
+ return $this->name;
236
+ }
237
+ public function setValue( $value) {
238
+ $this->value = $value;
239
+ }
240
+ public function getValue() {
241
+ return $this->value;
242
+ }
243
+ }
244
+
245
+ class Google_ActivityId extends Google_Model {
246
+ public $applicationId;
247
+ public $customerId;
248
+ public $time;
249
+ public $uniqQualifier;
250
+ public function setApplicationId( $applicationId) {
251
+ $this->applicationId = $applicationId;
252
+ }
253
+ public function getApplicationId() {
254
+ return $this->applicationId;
255
+ }
256
+ public function setCustomerId( $customerId) {
257
+ $this->customerId = $customerId;
258
+ }
259
+ public function getCustomerId() {
260
+ return $this->customerId;
261
+ }
262
+ public function setTime( $time) {
263
+ $this->time = $time;
264
+ }
265
+ public function getTime() {
266
+ return $this->time;
267
+ }
268
+ public function setUniqQualifier( $uniqQualifier) {
269
+ $this->uniqQualifier = $uniqQualifier;
270
+ }
271
+ public function getUniqQualifier() {
272
+ return $this->uniqQualifier;
273
+ }
274
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_BigqueryService.php ADDED
@@ -0,0 +1,2011 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "datasets" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $bigqueryService = new Google_BigqueryService(...);
22
+ * $datasets = $bigqueryService->datasets;
23
+ * </code>
24
+ */
25
+ class Google_DatasetsServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Deletes the dataset specified by datasetId value. Before you can delete a dataset, you must
29
+ * delete all its tables, either manually or by specifying deleteContents. Immediately after
30
+ * deletion, you can create another dataset with the same name. (datasets.delete)
31
+ *
32
+ * @param string $projectId Project ID of the dataset being deleted
33
+ * @param string $datasetId Dataset ID of dataset being deleted
34
+ * @param array $optParams Optional parameters.
35
+ *
36
+ * @opt_param bool deleteContents If True, delete all the tables in the dataset. If False and the dataset contains tables, the request will fail. Default is False
37
+ */
38
+ public function delete($projectId, $datasetId, $optParams = array()) {
39
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId);
40
+ $params = array_merge($params, $optParams);
41
+ $data = $this->__call('delete', array($params));
42
+ return $data;
43
+ }
44
+ /**
45
+ * Returns the dataset specified by datasetID. (datasets.get)
46
+ *
47
+ * @param string $projectId Project ID of the requested dataset
48
+ * @param string $datasetId Dataset ID of the requested dataset
49
+ * @param array $optParams Optional parameters.
50
+ * @return Google_Dataset
51
+ */
52
+ public function get($projectId, $datasetId, $optParams = array()) {
53
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId);
54
+ $params = array_merge($params, $optParams);
55
+ $data = $this->__call('get', array($params));
56
+ if ($this->useObjects()) {
57
+ return new Google_Dataset($data);
58
+ } else {
59
+ return $data;
60
+ }
61
+ }
62
+ /**
63
+ * Creates a new empty dataset. (datasets.insert)
64
+ *
65
+ * @param string $projectId Project ID of the new dataset
66
+ * @param Google_Dataset $postBody
67
+ * @param array $optParams Optional parameters.
68
+ * @return Google_Dataset
69
+ */
70
+ public function insert($projectId, Google_Dataset $postBody, $optParams = array()) {
71
+ $params = array('projectId' => $projectId, 'postBody' => $postBody);
72
+ $params = array_merge($params, $optParams);
73
+ $data = $this->__call('insert', array($params));
74
+ if ($this->useObjects()) {
75
+ return new Google_Dataset($data);
76
+ } else {
77
+ return $data;
78
+ }
79
+ }
80
+ /**
81
+ * Lists all the datasets in the specified project to which the caller has read access; however, a
82
+ * project owner can list (but not necessarily get) all datasets in his project. (datasets.list)
83
+ *
84
+ * @param string $projectId Project ID of the datasets to be listed
85
+ * @param array $optParams Optional parameters.
86
+ *
87
+ * @opt_param string maxResults The maximum number of results to return
88
+ * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
89
+ * @return Google_DatasetList
90
+ */
91
+ public function listDatasets($projectId, $optParams = array()) {
92
+ $params = array('projectId' => $projectId);
93
+ $params = array_merge($params, $optParams);
94
+ $data = $this->__call('list', array($params));
95
+ if ($this->useObjects()) {
96
+ return new Google_DatasetList($data);
97
+ } else {
98
+ return $data;
99
+ }
100
+ }
101
+ /**
102
+ * Updates information in an existing dataset, specified by datasetId. Properties not included in
103
+ * the submitted resource will not be changed. If you include the access property without any values
104
+ * assigned, the request will fail as you must specify at least one owner for a dataset. This method
105
+ * supports patch semantics. (datasets.patch)
106
+ *
107
+ * @param string $projectId Project ID of the dataset being updated
108
+ * @param string $datasetId Dataset ID of the dataset being updated
109
+ * @param Google_Dataset $postBody
110
+ * @param array $optParams Optional parameters.
111
+ * @return Google_Dataset
112
+ */
113
+ public function patch($projectId, $datasetId, Google_Dataset $postBody, $optParams = array()) {
114
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody);
115
+ $params = array_merge($params, $optParams);
116
+ $data = $this->__call('patch', array($params));
117
+ if ($this->useObjects()) {
118
+ return new Google_Dataset($data);
119
+ } else {
120
+ return $data;
121
+ }
122
+ }
123
+ /**
124
+ * Updates information in an existing dataset, specified by datasetId. Properties not included in
125
+ * the submitted resource will not be changed. If you include the access property without any values
126
+ * assigned, the request will fail as you must specify at least one owner for a dataset.
127
+ * (datasets.update)
128
+ *
129
+ * @param string $projectId Project ID of the dataset being updated
130
+ * @param string $datasetId Dataset ID of the dataset being updated
131
+ * @param Google_Dataset $postBody
132
+ * @param array $optParams Optional parameters.
133
+ * @return Google_Dataset
134
+ */
135
+ public function update($projectId, $datasetId, Google_Dataset $postBody, $optParams = array()) {
136
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody);
137
+ $params = array_merge($params, $optParams);
138
+ $data = $this->__call('update', array($params));
139
+ if ($this->useObjects()) {
140
+ return new Google_Dataset($data);
141
+ } else {
142
+ return $data;
143
+ }
144
+ }
145
+ }
146
+
147
+ /**
148
+ * The "jobs" collection of methods.
149
+ * Typical usage is:
150
+ * <code>
151
+ * $bigqueryService = new Google_BigqueryService(...);
152
+ * $jobs = $bigqueryService->jobs;
153
+ * </code>
154
+ */
155
+ class Google_JobsServiceResource extends Google_ServiceResource {
156
+
157
+ /**
158
+ * Retrieves the specified job by ID. (jobs.get)
159
+ *
160
+ * @param string $projectId Project ID of the requested job
161
+ * @param string $jobId Job ID of the requested job
162
+ * @param array $optParams Optional parameters.
163
+ * @return Google_Job
164
+ */
165
+ public function get($projectId, $jobId, $optParams = array()) {
166
+ $params = array('projectId' => $projectId, 'jobId' => $jobId);
167
+ $params = array_merge($params, $optParams);
168
+ $data = $this->__call('get', array($params));
169
+ if ($this->useObjects()) {
170
+ return new Google_Job($data);
171
+ } else {
172
+ return $data;
173
+ }
174
+ }
175
+ /**
176
+ * Retrieves the results of a query job. (jobs.getQueryResults)
177
+ *
178
+ * @param string $projectId Project ID of the query job
179
+ * @param string $jobId Job ID of the query job
180
+ * @param array $optParams Optional parameters.
181
+ *
182
+ * @opt_param string maxResults Maximum number of results to read
183
+ * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
184
+ * @opt_param string startIndex Zero-based index of the starting row
185
+ * @opt_param string timeoutMs How long to wait for the query to complete, in milliseconds, before returning. Default is to return immediately. If the timeout passes before the job completes, the request will fail with a TIMEOUT error
186
+ * @return Google_GetQueryResultsResponse
187
+ */
188
+ public function getQueryResults($projectId, $jobId, $optParams = array()) {
189
+ $params = array('projectId' => $projectId, 'jobId' => $jobId);
190
+ $params = array_merge($params, $optParams);
191
+ $data = $this->__call('getQueryResults', array($params));
192
+ if ($this->useObjects()) {
193
+ return new Google_GetQueryResultsResponse($data);
194
+ } else {
195
+ return $data;
196
+ }
197
+ }
198
+ /**
199
+ * Starts a new asynchronous job. (jobs.insert)
200
+ *
201
+ * @param string $projectId Project ID of the project that will be billed for the job
202
+ * @param Google_Job $postBody
203
+ * @param array $optParams Optional parameters.
204
+ * @return Google_Job
205
+ */
206
+ public function insert($projectId, Google_Job $postBody, $optParams = array()) {
207
+ $params = array('projectId' => $projectId, 'postBody' => $postBody);
208
+ $params = array_merge($params, $optParams);
209
+ $data = $this->__call('insert', array($params));
210
+ if ($this->useObjects()) {
211
+ return new Google_Job($data);
212
+ } else {
213
+ return $data;
214
+ }
215
+ }
216
+ /**
217
+ * Lists all the Jobs in the specified project that were started by the user. (jobs.list)
218
+ *
219
+ * @param string $projectId Project ID of the jobs to list
220
+ * @param array $optParams Optional parameters.
221
+ *
222
+ * @opt_param bool allUsers Whether to display jobs owned by all users in the project. Default false
223
+ * @opt_param string maxResults Maximum number of results to return
224
+ * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
225
+ * @opt_param string projection Restrict information returned to a set of selected fields
226
+ * @opt_param string stateFilter Filter for job state
227
+ * @return Google_JobList
228
+ */
229
+ public function listJobs($projectId, $optParams = array()) {
230
+ $params = array('projectId' => $projectId);
231
+ $params = array_merge($params, $optParams);
232
+ $data = $this->__call('list', array($params));
233
+ if ($this->useObjects()) {
234
+ return new Google_JobList($data);
235
+ } else {
236
+ return $data;
237
+ }
238
+ }
239
+ /**
240
+ * Runs a BigQuery SQL query synchronously and returns query results if the query completes within a
241
+ * specified timeout. (jobs.query)
242
+ *
243
+ * @param string $projectId Project ID of the project billed for the query
244
+ * @param Google_QueryRequest $postBody
245
+ * @param array $optParams Optional parameters.
246
+ * @return Google_QueryResponse
247
+ */
248
+ public function query($projectId, Google_QueryRequest $postBody, $optParams = array()) {
249
+ $params = array('projectId' => $projectId, 'postBody' => $postBody);
250
+ $params = array_merge($params, $optParams);
251
+ $data = $this->__call('query', array($params));
252
+ if ($this->useObjects()) {
253
+ return new Google_QueryResponse($data);
254
+ } else {
255
+ return $data;
256
+ }
257
+ }
258
+ }
259
+
260
+ /**
261
+ * The "projects" collection of methods.
262
+ * Typical usage is:
263
+ * <code>
264
+ * $bigqueryService = new Google_BigqueryService(...);
265
+ * $projects = $bigqueryService->projects;
266
+ * </code>
267
+ */
268
+ class Google_ProjectsServiceResource extends Google_ServiceResource {
269
+
270
+ /**
271
+ * Lists the projects to which you have at least read access. (projects.list)
272
+ *
273
+ * @param array $optParams Optional parameters.
274
+ *
275
+ * @opt_param string maxResults Maximum number of results to return
276
+ * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
277
+ * @return Google_ProjectList
278
+ */
279
+ public function listProjects($optParams = array()) {
280
+ $params = array();
281
+ $params = array_merge($params, $optParams);
282
+ $data = $this->__call('list', array($params));
283
+ if ($this->useObjects()) {
284
+ return new Google_ProjectList($data);
285
+ } else {
286
+ return $data;
287
+ }
288
+ }
289
+ }
290
+
291
+ /**
292
+ * The "tabledata" collection of methods.
293
+ * Typical usage is:
294
+ * <code>
295
+ * $bigqueryService = new Google_BigqueryService(...);
296
+ * $tabledata = $bigqueryService->tabledata;
297
+ * </code>
298
+ */
299
+ class Google_TabledataServiceResource extends Google_ServiceResource {
300
+
301
+ /**
302
+ * Retrieves table data from a specified set of rows. (tabledata.list)
303
+ *
304
+ * @param string $projectId Project ID of the table to read
305
+ * @param string $datasetId Dataset ID of the table to read
306
+ * @param string $tableId Table ID of the table to read
307
+ * @param array $optParams Optional parameters.
308
+ *
309
+ * @opt_param string maxResults Maximum number of results to return
310
+ * @opt_param string pageToken Page token, returned by a previous call, identifying the result set
311
+ * @opt_param string startIndex Zero-based index of the starting row to read
312
+ * @return Google_TableDataList
313
+ */
314
+ public function listTabledata($projectId, $datasetId, $tableId, $optParams = array()) {
315
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId);
316
+ $params = array_merge($params, $optParams);
317
+ $data = $this->__call('list', array($params));
318
+ if ($this->useObjects()) {
319
+ return new Google_TableDataList($data);
320
+ } else {
321
+ return $data;
322
+ }
323
+ }
324
+ }
325
+
326
+ /**
327
+ * The "tables" collection of methods.
328
+ * Typical usage is:
329
+ * <code>
330
+ * $bigqueryService = new Google_BigqueryService(...);
331
+ * $tables = $bigqueryService->tables;
332
+ * </code>
333
+ */
334
+ class Google_TablesServiceResource extends Google_ServiceResource {
335
+
336
+ /**
337
+ * Deletes the table specified by tableId from the dataset. If the table contains data, all the data
338
+ * will be deleted. (tables.delete)
339
+ *
340
+ * @param string $projectId Project ID of the table to delete
341
+ * @param string $datasetId Dataset ID of the table to delete
342
+ * @param string $tableId Table ID of the table to delete
343
+ * @param array $optParams Optional parameters.
344
+ */
345
+ public function delete($projectId, $datasetId, $tableId, $optParams = array()) {
346
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId);
347
+ $params = array_merge($params, $optParams);
348
+ $data = $this->__call('delete', array($params));
349
+ return $data;
350
+ }
351
+ /**
352
+ * Gets the specified table resource by table ID. This method does not return the data in the table,
353
+ * it only returns the table resource, which describes the structure of this table. (tables.get)
354
+ *
355
+ * @param string $projectId Project ID of the requested table
356
+ * @param string $datasetId Dataset ID of the requested table
357
+ * @param string $tableId Table ID of the requested table
358
+ * @param array $optParams Optional parameters.
359
+ * @return Google_Table
360
+ */
361
+ public function get($projectId, $datasetId, $tableId, $optParams = array()) {
362
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId);
363
+ $params = array_merge($params, $optParams);
364
+ $data = $this->__call('get', array($params));
365
+ if ($this->useObjects()) {
366
+ return new Google_Table($data);
367
+ } else {
368
+ return $data;
369
+ }
370
+ }
371
+ /**
372
+ * Creates a new, empty table in the dataset. (tables.insert)
373
+ *
374
+ * @param string $projectId Project ID of the new table
375
+ * @param string $datasetId Dataset ID of the new table
376
+ * @param Google_Table $postBody
377
+ * @param array $optParams Optional parameters.
378
+ * @return Google_Table
379
+ */
380
+ public function insert($projectId, $datasetId, Google_Table $postBody, $optParams = array()) {
381
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody);
382
+ $params = array_merge($params, $optParams);
383
+ $data = $this->__call('insert', array($params));
384
+ if ($this->useObjects()) {
385
+ return new Google_Table($data);
386
+ } else {
387
+ return $data;
388
+ }
389
+ }
390
+ /**
391
+ * Lists all tables in the specified dataset. (tables.list)
392
+ *
393
+ * @param string $projectId Project ID of the tables to list
394
+ * @param string $datasetId Dataset ID of the tables to list
395
+ * @param array $optParams Optional parameters.
396
+ *
397
+ * @opt_param string maxResults Maximum number of results to return
398
+ * @opt_param string pageToken Page token, returned by a previous call, to request the next page of results
399
+ * @return Google_TableList
400
+ */
401
+ public function listTables($projectId, $datasetId, $optParams = array()) {
402
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId);
403
+ $params = array_merge($params, $optParams);
404
+ $data = $this->__call('list', array($params));
405
+ if ($this->useObjects()) {
406
+ return new Google_TableList($data);
407
+ } else {
408
+ return $data;
409
+ }
410
+ }
411
+ /**
412
+ * Updates information in an existing table, specified by tableId. This method supports patch
413
+ * semantics. (tables.patch)
414
+ *
415
+ * @param string $projectId Project ID of the table to update
416
+ * @param string $datasetId Dataset ID of the table to update
417
+ * @param string $tableId Table ID of the table to update
418
+ * @param Google_Table $postBody
419
+ * @param array $optParams Optional parameters.
420
+ * @return Google_Table
421
+ */
422
+ public function patch($projectId, $datasetId, $tableId, Google_Table $postBody, $optParams = array()) {
423
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody);
424
+ $params = array_merge($params, $optParams);
425
+ $data = $this->__call('patch', array($params));
426
+ if ($this->useObjects()) {
427
+ return new Google_Table($data);
428
+ } else {
429
+ return $data;
430
+ }
431
+ }
432
+ /**
433
+ * Updates information in an existing table, specified by tableId. (tables.update)
434
+ *
435
+ * @param string $projectId Project ID of the table to update
436
+ * @param string $datasetId Dataset ID of the table to update
437
+ * @param string $tableId Table ID of the table to update
438
+ * @param Google_Table $postBody
439
+ * @param array $optParams Optional parameters.
440
+ * @return Google_Table
441
+ */
442
+ public function update($projectId, $datasetId, $tableId, Google_Table $postBody, $optParams = array()) {
443
+ $params = array('projectId' => $projectId, 'datasetId' => $datasetId, 'tableId' => $tableId, 'postBody' => $postBody);
444
+ $params = array_merge($params, $optParams);
445
+ $data = $this->__call('update', array($params));
446
+ if ($this->useObjects()) {
447
+ return new Google_Table($data);
448
+ } else {
449
+ return $data;
450
+ }
451
+ }
452
+ }
453
+
454
+ /**
455
+ * Service definition for Google_Bigquery (v2).
456
+ *
457
+ * <p>
458
+ * A data platform for customers to create, manage, share and query data.
459
+ * </p>
460
+ *
461
+ * <p>
462
+ * For more information about this service, see the
463
+ * <a href="https://developers.google.com/bigquery/docs/overview" target="_blank">API Documentation</a>
464
+ * </p>
465
+ *
466
+ * @author Google, Inc.
467
+ */
468
+ class Google_BigqueryService extends Google_Service {
469
+ public $datasets;
470
+ public $jobs;
471
+ public $projects;
472
+ public $tabledata;
473
+ public $tables;
474
+ /**
475
+ * Constructs the internal representation of the Bigquery service.
476
+ *
477
+ * @param Google_Client $client
478
+ */
479
+ public function __construct(Google_Client $client) {
480
+ $this->servicePath = 'bigquery/v2/';
481
+ $this->version = 'v2';
482
+ $this->serviceName = 'bigquery';
483
+
484
+ $client->addService($this->serviceName, $this->version);
485
+ $this->datasets = new Google_DatasetsServiceResource($this, $this->serviceName, 'datasets', json_decode('{"methods": {"delete": {"id": "bigquery.datasets.delete", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "DELETE", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "deleteContents": {"type": "boolean", "location": "query"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "get": {"id": "bigquery.datasets.get", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "GET", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Dataset"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "insert": {"id": "bigquery.datasets.insert", "path": "projects/{projectId}/datasets", "httpMethod": "POST", "parameters": {"projectId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Dataset"}, "response": {"$ref": "Dataset"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "list": {"id": "bigquery.datasets.list", "path": "projects/{projectId}/datasets", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "uint32", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "DatasetList"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "patch": {"id": "bigquery.datasets.patch", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "PATCH", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Dataset"}, "response": {"$ref": "Dataset"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "update": {"id": "bigquery.datasets.update", "path": "projects/{projectId}/datasets/{datasetId}", "httpMethod": "PUT", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Dataset"}, "response": {"$ref": "Dataset"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}}}', true));
486
+ $this->jobs = new Google_JobsServiceResource($this, $this->serviceName, 'jobs', json_decode('{"methods": {"get": {"id": "bigquery.jobs.get", "path": "projects/{projectId}/jobs/{jobId}", "httpMethod": "GET", "parameters": {"jobId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Job"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "getQueryResults": {"id": "bigquery.jobs.getQueryResults", "path": "projects/{projectId}/queries/{jobId}", "httpMethod": "GET", "parameters": {"jobId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projectId": {"type": "string", "required": true, "location": "path"}, "startIndex": {"type": "string", "format": "uint64", "location": "query"}, "timeoutMs": {"type": "integer", "format": "uint32", "location": "query"}}, "response": {"$ref": "GetQueryResultsResponse"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "insert": {"id": "bigquery.jobs.insert", "path": "projects/{projectId}/jobs", "httpMethod": "POST", "parameters": {"projectId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Job"}, "response": {"$ref": "Job"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/devstorage.full_control", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/devstorage.read_write"], "supportsMediaUpload": true, "mediaUpload": {"accept": ["application/octet-stream"], "protocols": {"simple": {"multipart": true, "path": "/upload/bigquery/v2/projects/{projectId}/jobs"}, "resumable": {"multipart": true, "path": "/resumable/upload/bigquery/v2/projects/{projectId}/jobs"}}}}, "list": {"id": "bigquery.jobs.list", "path": "projects/{projectId}/jobs", "httpMethod": "GET", "parameters": {"allUsers": {"type": "boolean", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projectId": {"type": "string", "required": true, "location": "path"}, "projection": {"type": "string", "enum": ["full", "minimal"], "location": "query"}, "stateFilter": {"type": "string", "enum": ["done", "pending", "running"], "repeated": true, "location": "query"}}, "response": {"$ref": "JobList"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "query": {"id": "bigquery.jobs.query", "path": "projects/{projectId}/queries", "httpMethod": "POST", "parameters": {"projectId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "QueryRequest"}, "response": {"$ref": "QueryResponse"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}}}', true));
487
+ $this->projects = new Google_ProjectsServiceResource($this, $this->serviceName, 'projects', json_decode('{"methods": {"list": {"id": "bigquery.projects.list", "path": "projects", "httpMethod": "GET", "parameters": {"maxResults": {"type": "integer", "format": "uint32", "location": "query"}, "pageToken": {"type": "string", "location": "query"}}, "response": {"$ref": "ProjectList"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}}}', true));
488
+ $this->tabledata = new Google_TabledataServiceResource($this, $this->serviceName, 'tabledata', json_decode('{"methods": {"list": {"id": "bigquery.tabledata.list", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}/data", "httpMethod": "GET", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projectId": {"type": "string", "required": true, "location": "path"}, "startIndex": {"type": "string", "format": "uint64", "location": "query"}, "tableId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "TableDataList"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}}}', true));
489
+ $this->tables = new Google_TablesServiceResource($this, $this->serviceName, 'tables', json_decode('{"methods": {"delete": {"id": "bigquery.tables.delete", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "DELETE", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}, "tableId": {"type": "string", "required": true, "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "get": {"id": "bigquery.tables.get", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "GET", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}, "tableId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Table"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "insert": {"id": "bigquery.tables.insert", "path": "projects/{projectId}/datasets/{datasetId}/tables", "httpMethod": "POST", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Table"}, "response": {"$ref": "Table"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "list": {"id": "bigquery.tables.list", "path": "projects/{projectId}/datasets/{datasetId}/tables", "httpMethod": "GET", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "maxResults": {"type": "integer", "format": "uint32", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "projectId": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "TableList"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "patch": {"id": "bigquery.tables.patch", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "PATCH", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}, "tableId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Table"}, "response": {"$ref": "Table"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}, "update": {"id": "bigquery.tables.update", "path": "projects/{projectId}/datasets/{datasetId}/tables/{tableId}", "httpMethod": "PUT", "parameters": {"datasetId": {"type": "string", "required": true, "location": "path"}, "projectId": {"type": "string", "required": true, "location": "path"}, "tableId": {"type": "string", "required": true, "location": "path"}}, "request": {"$ref": "Table"}, "response": {"$ref": "Table"}, "scopes": ["https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"]}}}', true));
490
+
491
+ }
492
+ }
493
+
494
+
495
+
496
+ class Google_Dataset extends Google_Model {
497
+ protected $__accessType = 'Google_DatasetAccess';
498
+ protected $__accessDataType = 'array';
499
+ public $access;
500
+ public $creationTime;
501
+ protected $__datasetReferenceType = 'Google_DatasetReference';
502
+ protected $__datasetReferenceDataType = '';
503
+ public $datasetReference;
504
+ public $description;
505
+ public $etag;
506
+ public $friendlyName;
507
+ public $id;
508
+ public $kind;
509
+ public $lastModifiedTime;
510
+ public $selfLink;
511
+ public function setAccess(/* array(Google_DatasetAccess) */ $access) {
512
+ $this->assertIsArray($access, 'Google_DatasetAccess', __METHOD__);
513
+ $this->access = $access;
514
+ }
515
+ public function getAccess() {
516
+ return $this->access;
517
+ }
518
+ public function setCreationTime( $creationTime) {
519
+ $this->creationTime = $creationTime;
520
+ }
521
+ public function getCreationTime() {
522
+ return $this->creationTime;
523
+ }
524
+ public function setDatasetReference(Google_DatasetReference $datasetReference) {
525
+ $this->datasetReference = $datasetReference;
526
+ }
527
+ public function getDatasetReference() {
528
+ return $this->datasetReference;
529
+ }
530
+ public function setDescription( $description) {
531
+ $this->description = $description;
532
+ }
533
+ public function getDescription() {
534
+ return $this->description;
535
+ }
536
+ public function setEtag( $etag) {
537
+ $this->etag = $etag;
538
+ }
539
+ public function getEtag() {
540
+ return $this->etag;
541
+ }
542
+ public function setFriendlyName( $friendlyName) {
543
+ $this->friendlyName = $friendlyName;
544
+ }
545
+ public function getFriendlyName() {
546
+ return $this->friendlyName;
547
+ }
548
+ public function setId( $id) {
549
+ $this->id = $id;
550
+ }
551
+ public function getId() {
552
+ return $this->id;
553
+ }
554
+ public function setKind( $kind) {
555
+ $this->kind = $kind;
556
+ }
557
+ public function getKind() {
558
+ return $this->kind;
559
+ }
560
+ public function setLastModifiedTime( $lastModifiedTime) {
561
+ $this->lastModifiedTime = $lastModifiedTime;
562
+ }
563
+ public function getLastModifiedTime() {
564
+ return $this->lastModifiedTime;
565
+ }
566
+ public function setSelfLink( $selfLink) {
567
+ $this->selfLink = $selfLink;
568
+ }
569
+ public function getSelfLink() {
570
+ return $this->selfLink;
571
+ }
572
+ }
573
+
574
+ class Google_DatasetAccess extends Google_Model {
575
+ public $domain;
576
+ public $groupByEmail;
577
+ public $role;
578
+ public $specialGroup;
579
+ public $userByEmail;
580
+ public function setDomain( $domain) {
581
+ $this->domain = $domain;
582
+ }
583
+ public function getDomain() {
584
+ return $this->domain;
585
+ }
586
+ public function setGroupByEmail( $groupByEmail) {
587
+ $this->groupByEmail = $groupByEmail;
588
+ }
589
+ public function getGroupByEmail() {
590
+ return $this->groupByEmail;
591
+ }
592
+ public function setRole( $role) {
593
+ $this->role = $role;
594
+ }
595
+ public function getRole() {
596
+ return $this->role;
597
+ }
598
+ public function setSpecialGroup( $specialGroup) {
599
+ $this->specialGroup = $specialGroup;
600
+ }
601
+ public function getSpecialGroup() {
602
+ return $this->specialGroup;
603
+ }
604
+ public function setUserByEmail( $userByEmail) {
605
+ $this->userByEmail = $userByEmail;
606
+ }
607
+ public function getUserByEmail() {
608
+ return $this->userByEmail;
609
+ }
610
+ }
611
+
612
+ class Google_DatasetList extends Google_Model {
613
+ protected $__datasetsType = 'Google_DatasetListDatasets';
614
+ protected $__datasetsDataType = 'array';
615
+ public $datasets;
616
+ public $etag;
617
+ public $kind;
618
+ public $nextPageToken;
619
+ public function setDatasets(/* array(Google_DatasetListDatasets) */ $datasets) {
620
+ $this->assertIsArray($datasets, 'Google_DatasetListDatasets', __METHOD__);
621
+ $this->datasets = $datasets;
622
+ }
623
+ public function getDatasets() {
624
+ return $this->datasets;
625
+ }
626
+ public function setEtag( $etag) {
627
+ $this->etag = $etag;
628
+ }
629
+ public function getEtag() {
630
+ return $this->etag;
631
+ }
632
+ public function setKind( $kind) {
633
+ $this->kind = $kind;
634
+ }
635
+ public function getKind() {
636
+ return $this->kind;
637
+ }
638
+ public function setNextPageToken( $nextPageToken) {
639
+ $this->nextPageToken = $nextPageToken;
640
+ }
641
+ public function getNextPageToken() {
642
+ return $this->nextPageToken;
643
+ }
644
+ }
645
+
646
+ class Google_DatasetListDatasets extends Google_Model {
647
+ protected $__datasetReferenceType = 'Google_DatasetReference';
648
+ protected $__datasetReferenceDataType = '';
649
+ public $datasetReference;
650
+ public $friendlyName;
651
+ public $id;
652
+ public $kind;
653
+ public function setDatasetReference(Google_DatasetReference $datasetReference) {
654
+ $this->datasetReference = $datasetReference;
655
+ }
656
+ public function getDatasetReference() {
657
+ return $this->datasetReference;
658
+ }
659
+ public function setFriendlyName( $friendlyName) {
660
+ $this->friendlyName = $friendlyName;
661
+ }
662
+ public function getFriendlyName() {
663
+ return $this->friendlyName;
664
+ }
665
+ public function setId( $id) {
666
+ $this->id = $id;
667
+ }
668
+ public function getId() {
669
+ return $this->id;
670
+ }
671
+ public function setKind( $kind) {
672
+ $this->kind = $kind;
673
+ }
674
+ public function getKind() {
675
+ return $this->kind;
676
+ }
677
+ }
678
+
679
+ class Google_DatasetReference extends Google_Model {
680
+ public $datasetId;
681
+ public $projectId;
682
+ public function setDatasetId( $datasetId) {
683
+ $this->datasetId = $datasetId;
684
+ }
685
+ public function getDatasetId() {
686
+ return $this->datasetId;
687
+ }
688
+ public function setProjectId( $projectId) {
689
+ $this->projectId = $projectId;
690
+ }
691
+ public function getProjectId() {
692
+ return $this->projectId;
693
+ }
694
+ }
695
+
696
+ class Google_ErrorProto extends Google_Model {
697
+ public $debugInfo;
698
+ public $location;
699
+ public $message;
700
+ public $reason;
701
+ public function setDebugInfo( $debugInfo) {
702
+ $this->debugInfo = $debugInfo;
703
+ }
704
+ public function getDebugInfo() {
705
+ return $this->debugInfo;
706
+ }
707
+ public function setLocation( $location) {
708
+ $this->location = $location;
709
+ }
710
+ public function getLocation() {
711
+ return $this->location;
712
+ }
713
+ public function setMessage( $message) {
714
+ $this->message = $message;
715
+ }
716
+ public function getMessage() {
717
+ return $this->message;
718
+ }
719
+ public function setReason( $reason) {
720
+ $this->reason = $reason;
721
+ }
722
+ public function getReason() {
723
+ return $this->reason;
724
+ }
725
+ }
726
+
727
+ class Google_GetQueryResultsResponse extends Google_Model {
728
+ public $cacheHit;
729
+ public $etag;
730
+ public $jobComplete;
731
+ protected $__jobReferenceType = 'Google_JobReference';
732
+ protected $__jobReferenceDataType = '';
733
+ public $jobReference;
734
+ public $kind;
735
+ public $pageToken;
736
+ protected $__rowsType = 'Google_TableRow';
737
+ protected $__rowsDataType = 'array';
738
+ public $rows;
739
+ protected $__schemaType = 'Google_TableSchema';
740
+ protected $__schemaDataType = '';
741
+ public $schema;
742
+ public $totalRows;
743
+ public function setCacheHit( $cacheHit) {
744
+ $this->cacheHit = $cacheHit;
745
+ }
746
+ public function getCacheHit() {
747
+ return $this->cacheHit;
748
+ }
749
+ public function setEtag( $etag) {
750
+ $this->etag = $etag;
751
+ }
752
+ public function getEtag() {
753
+ return $this->etag;
754
+ }
755
+ public function setJobComplete( $jobComplete) {
756
+ $this->jobComplete = $jobComplete;
757
+ }
758
+ public function getJobComplete() {
759
+ return $this->jobComplete;
760
+ }
761
+ public function setJobReference(Google_JobReference $jobReference) {
762
+ $this->jobReference = $jobReference;
763
+ }
764
+ public function getJobReference() {
765
+ return $this->jobReference;
766
+ }
767
+ public function setKind( $kind) {
768
+ $this->kind = $kind;
769
+ }
770
+ public function getKind() {
771
+ return $this->kind;
772
+ }
773
+ public function setPageToken( $pageToken) {
774
+ $this->pageToken = $pageToken;
775
+ }
776
+ public function getPageToken() {
777
+ return $this->pageToken;
778
+ }
779
+ public function setRows(/* array(Google_TableRow) */ $rows) {
780
+ $this->assertIsArray($rows, 'Google_TableRow', __METHOD__);
781
+ $this->rows = $rows;
782
+ }
783
+ public function getRows() {
784
+ return $this->rows;
785
+ }
786
+ public function setSchema(Google_TableSchema $schema) {
787
+ $this->schema = $schema;
788
+ }
789
+ public function getSchema() {
790
+ return $this->schema;
791
+ }
792
+ public function setTotalRows( $totalRows) {
793
+ $this->totalRows = $totalRows;
794
+ }
795
+ public function getTotalRows() {
796
+ return $this->totalRows;
797
+ }
798
+ }
799
+
800
+ class Google_Job extends Google_Model {
801
+ protected $__configurationType = 'Google_JobConfiguration';
802
+ protected $__configurationDataType = '';
803
+ public $configuration;
804
+ public $etag;
805
+ public $id;
806
+ protected $__jobReferenceType = 'Google_JobReference';
807
+ protected $__jobReferenceDataType = '';
808
+ public $jobReference;
809
+ public $kind;
810
+ public $selfLink;
811
+ protected $__statisticsType = 'Google_JobStatistics';
812
+ protected $__statisticsDataType = '';
813
+ public $statistics;
814
+ protected $__statusType = 'Google_JobStatus';
815
+ protected $__statusDataType = '';
816
+ public $status;
817
+ public function setConfiguration(Google_JobConfiguration $configuration) {
818
+ $this->configuration = $configuration;
819
+ }
820
+ public function getConfiguration() {
821
+ return $this->configuration;
822
+ }
823
+ public function setEtag( $etag) {
824
+ $this->etag = $etag;
825
+ }
826
+ public function getEtag() {
827
+ return $this->etag;
828
+ }
829
+ public function setId( $id) {
830
+ $this->id = $id;
831
+ }
832
+ public function getId() {
833
+ return $this->id;
834
+ }
835
+ public function setJobReference(Google_JobReference $jobReference) {
836
+ $this->jobReference = $jobReference;
837
+ }
838
+ public function getJobReference() {
839
+ return $this->jobReference;
840
+ }
841
+ public function setKind( $kind) {
842
+ $this->kind = $kind;
843
+ }
844
+ public function getKind() {
845
+ return $this->kind;
846
+ }
847
+ public function setSelfLink( $selfLink) {
848
+ $this->selfLink = $selfLink;
849
+ }
850
+ public function getSelfLink() {
851
+ return $this->selfLink;
852
+ }
853
+ public function setStatistics(Google_JobStatistics $statistics) {
854
+ $this->statistics = $statistics;
855
+ }
856
+ public function getStatistics() {
857
+ return $this->statistics;
858
+ }
859
+ public function setStatus(Google_JobStatus $status) {
860
+ $this->status = $status;
861
+ }
862
+ public function getStatus() {
863
+ return $this->status;
864
+ }
865
+ }
866
+
867
+ class Google_JobConfiguration extends Google_Model {
868
+ protected $__copyType = 'Google_JobConfigurationTableCopy';
869
+ protected $__copyDataType = '';
870
+ public $copy;
871
+ public $dryRun;
872
+ protected $__extractType = 'Google_JobConfigurationExtract';
873
+ protected $__extractDataType = '';
874
+ public $extract;
875
+ protected $__linkType = 'Google_JobConfigurationLink';
876
+ protected $__linkDataType = '';
877
+ public $link;
878
+ protected $__loadType = 'Google_JobConfigurationLoad';
879
+ protected $__loadDataType = '';
880
+ public $load;
881
+ protected $__queryType = 'Google_JobConfigurationQuery';
882
+ protected $__queryDataType = '';
883
+ public $query;
884
+ public function setCopy(Google_JobConfigurationTableCopy $copy) {
885
+ $this->copy = $copy;
886
+ }
887
+ public function getCopy() {
888
+ return $this->copy;
889
+ }
890
+ public function setDryRun( $dryRun) {
891
+ $this->dryRun = $dryRun;
892
+ }
893
+ public function getDryRun() {
894
+ return $this->dryRun;
895
+ }
896
+ public function setExtract(Google_JobConfigurationExtract $extract) {
897
+ $this->extract = $extract;
898
+ }
899
+ public function getExtract() {
900
+ return $this->extract;
901
+ }
902
+ public function setLink(Google_JobConfigurationLink $link) {
903
+ $this->link = $link;
904
+ }
905
+ public function getLink() {
906
+ return $this->link;
907
+ }
908
+ public function setLoad(Google_JobConfigurationLoad $load) {
909
+ $this->load = $load;
910
+ }
911
+ public function getLoad() {
912
+ return $this->load;
913
+ }
914
+ public function setQuery(Google_JobConfigurationQuery $query) {
915
+ $this->query = $query;
916
+ }
917
+ public function getQuery() {
918
+ return $this->query;
919
+ }
920
+ }
921
+
922
+ class Google_JobConfigurationExtract extends Google_Model {
923
+ public $destinationFormat;
924
+ public $destinationUri;
925
+ public $fieldDelimiter;
926
+ public $printHeader;
927
+ protected $__sourceTableType = 'Google_TableReference';
928
+ protected $__sourceTableDataType = '';
929
+ public $sourceTable;
930
+ public function setDestinationFormat( $destinationFormat) {
931
+ $this->destinationFormat = $destinationFormat;
932
+ }
933
+ public function getDestinationFormat() {
934
+ return $this->destinationFormat;
935
+ }
936
+ public function setDestinationUri( $destinationUri) {
937
+ $this->destinationUri = $destinationUri;
938
+ }
939
+ public function getDestinationUri() {
940
+ return $this->destinationUri;
941
+ }
942
+ public function setFieldDelimiter( $fieldDelimiter) {
943
+ $this->fieldDelimiter = $fieldDelimiter;
944
+ }
945
+ public function getFieldDelimiter() {
946
+ return $this->fieldDelimiter;
947
+ }
948
+ public function setPrintHeader( $printHeader) {
949
+ $this->printHeader = $printHeader;
950
+ }
951
+ public function getPrintHeader() {
952
+ return $this->printHeader;
953
+ }
954
+ public function setSourceTable(Google_TableReference $sourceTable) {
955
+ $this->sourceTable = $sourceTable;
956
+ }
957
+ public function getSourceTable() {
958
+ return $this->sourceTable;
959
+ }
960
+ }
961
+
962
+ class Google_JobConfigurationLink extends Google_Model {
963
+ public $createDisposition;
964
+ protected $__destinationTableType = 'Google_TableReference';
965
+ protected $__destinationTableDataType = '';
966
+ public $destinationTable;
967
+ public $sourceUri;
968
+ public $writeDisposition;
969
+ public function setCreateDisposition( $createDisposition) {
970
+ $this->createDisposition = $createDisposition;
971
+ }
972
+ public function getCreateDisposition() {
973
+ return $this->createDisposition;
974
+ }
975
+ public function setDestinationTable(Google_TableReference $destinationTable) {
976
+ $this->destinationTable = $destinationTable;
977
+ }
978
+ public function getDestinationTable() {
979
+ return $this->destinationTable;
980
+ }
981
+ public function setSourceUri(/* array(Google_string) */ $sourceUri) {
982
+ $this->assertIsArray($sourceUri, 'Google_string', __METHOD__);
983
+ $this->sourceUri = $sourceUri;
984
+ }
985
+ public function getSourceUri() {
986
+ return $this->sourceUri;
987
+ }
988
+ public function setWriteDisposition( $writeDisposition) {
989
+ $this->writeDisposition = $writeDisposition;
990
+ }
991
+ public function getWriteDisposition() {
992
+ return $this->writeDisposition;
993
+ }
994
+ }
995
+
996
+ class Google_JobConfigurationLoad extends Google_Model {
997
+ public $allowJaggedRows;
998
+ public $allowQuotedNewlines;
999
+ public $createDisposition;
1000
+ protected $__destinationTableType = 'Google_TableReference';
1001
+ protected $__destinationTableDataType = '';
1002
+ public $destinationTable;
1003
+ public $encoding;
1004
+ public $fieldDelimiter;
1005
+ public $maxBadRecords;
1006
+ public $quote;
1007
+ protected $__schemaType = 'Google_TableSchema';
1008
+ protected $__schemaDataType = '';
1009
+ public $schema;
1010
+ public $schemaInline;
1011
+ public $schemaInlineFormat;
1012
+ public $skipLeadingRows;
1013
+ public $sourceFormat;
1014
+ public $sourceUris;
1015
+ public $writeDisposition;
1016
+ public function setAllowJaggedRows( $allowJaggedRows) {
1017
+ $this->allowJaggedRows = $allowJaggedRows;
1018
+ }
1019
+ public function getAllowJaggedRows() {
1020
+ return $this->allowJaggedRows;
1021
+ }
1022
+ public function setAllowQuotedNewlines( $allowQuotedNewlines) {
1023
+ $this->allowQuotedNewlines = $allowQuotedNewlines;
1024
+ }
1025
+ public function getAllowQuotedNewlines() {
1026
+ return $this->allowQuotedNewlines;
1027
+ }
1028
+ public function setCreateDisposition( $createDisposition) {
1029
+ $this->createDisposition = $createDisposition;
1030
+ }
1031
+ public function getCreateDisposition() {
1032
+ return $this->createDisposition;
1033
+ }
1034
+ public function setDestinationTable(Google_TableReference $destinationTable) {
1035
+ $this->destinationTable = $destinationTable;
1036
+ }
1037
+ public function getDestinationTable() {
1038
+ return $this->destinationTable;
1039
+ }
1040
+ public function setEncoding( $encoding) {
1041
+ $this->encoding = $encoding;
1042
+ }
1043
+ public function getEncoding() {
1044
+ return $this->encoding;
1045
+ }
1046
+ public function setFieldDelimiter( $fieldDelimiter) {
1047
+ $this->fieldDelimiter = $fieldDelimiter;
1048
+ }
1049
+ public function getFieldDelimiter() {
1050
+ return $this->fieldDelimiter;
1051
+ }
1052
+ public function setMaxBadRecords( $maxBadRecords) {
1053
+ $this->maxBadRecords = $maxBadRecords;
1054
+ }
1055
+ public function getMaxBadRecords() {
1056
+ return $this->maxBadRecords;
1057
+ }
1058
+ public function setQuote( $quote) {
1059
+ $this->quote = $quote;
1060
+ }
1061
+ public function getQuote() {
1062
+ return $this->quote;
1063
+ }
1064
+ public function setSchema(Google_TableSchema $schema) {
1065
+ $this->schema = $schema;
1066
+ }
1067
+ public function getSchema() {
1068
+ return $this->schema;
1069
+ }
1070
+ public function setSchemaInline( $schemaInline) {
1071
+ $this->schemaInline = $schemaInline;
1072
+ }
1073
+ public function getSchemaInline() {
1074
+ return $this->schemaInline;
1075
+ }
1076
+ public function setSchemaInlineFormat( $schemaInlineFormat) {
1077
+ $this->schemaInlineFormat = $schemaInlineFormat;
1078
+ }
1079
+ public function getSchemaInlineFormat() {
1080
+ return $this->schemaInlineFormat;
1081
+ }
1082
+ public function setSkipLeadingRows( $skipLeadingRows) {
1083
+ $this->skipLeadingRows = $skipLeadingRows;
1084
+ }
1085
+ public function getSkipLeadingRows() {
1086
+ return $this->skipLeadingRows;
1087
+ }
1088
+ public function setSourceFormat( $sourceFormat) {
1089
+ $this->sourceFormat = $sourceFormat;
1090
+ }
1091
+ public function getSourceFormat() {
1092
+ return $this->sourceFormat;
1093
+ }
1094
+ public function setSourceUris(/* array(Google_string) */ $sourceUris) {
1095
+ $this->assertIsArray($sourceUris, 'Google_string', __METHOD__);
1096
+ $this->sourceUris = $sourceUris;
1097
+ }
1098
+ public function getSourceUris() {
1099
+ return $this->sourceUris;
1100
+ }
1101
+ public function setWriteDisposition( $writeDisposition) {
1102
+ $this->writeDisposition = $writeDisposition;
1103
+ }
1104
+ public function getWriteDisposition() {
1105
+ return $this->writeDisposition;
1106
+ }
1107
+ }
1108
+
1109
+ class Google_JobConfigurationQuery extends Google_Model {
1110
+ public $allowLargeResults;
1111
+ public $createDisposition;
1112
+ protected $__defaultDatasetType = 'Google_DatasetReference';
1113
+ protected $__defaultDatasetDataType = '';
1114
+ public $defaultDataset;
1115
+ protected $__destinationTableType = 'Google_TableReference';
1116
+ protected $__destinationTableDataType = '';
1117
+ public $destinationTable;
1118
+ public $minCompletionRatio;
1119
+ public $preserveNulls;
1120
+ public $priority;
1121
+ public $query;
1122
+ public $useQueryCache;
1123
+ public $writeDisposition;
1124
+ public function setAllowLargeResults( $allowLargeResults) {
1125
+ $this->allowLargeResults = $allowLargeResults;
1126
+ }
1127
+ public function getAllowLargeResults() {
1128
+ return $this->allowLargeResults;
1129
+ }
1130
+ public function setCreateDisposition( $createDisposition) {
1131
+ $this->createDisposition = $createDisposition;
1132
+ }
1133
+ public function getCreateDisposition() {
1134
+ return $this->createDisposition;
1135
+ }
1136
+ public function setDefaultDataset(Google_DatasetReference $defaultDataset) {
1137
+ $this->defaultDataset = $defaultDataset;
1138
+ }
1139
+ public function getDefaultDataset() {
1140
+ return $this->defaultDataset;
1141
+ }
1142
+ public function setDestinationTable(Google_TableReference $destinationTable) {
1143
+ $this->destinationTable = $destinationTable;
1144
+ }
1145
+ public function getDestinationTable() {
1146
+ return $this->destinationTable;
1147
+ }
1148
+ public function setMinCompletionRatio( $minCompletionRatio) {
1149
+ $this->minCompletionRatio = $minCompletionRatio;
1150
+ }
1151
+ public function getMinCompletionRatio() {
1152
+ return $this->minCompletionRatio;
1153
+ }
1154
+ public function setPreserveNulls( $preserveNulls) {
1155
+ $this->preserveNulls = $preserveNulls;
1156
+ }
1157
+ public function getPreserveNulls() {
1158
+ return $this->preserveNulls;
1159
+ }
1160
+ public function setPriority( $priority) {
1161
+ $this->priority = $priority;
1162
+ }
1163
+ public function getPriority() {
1164
+ return $this->priority;
1165
+ }
1166
+ public function setQuery( $query) {
1167
+ $this->query = $query;
1168
+ }
1169
+ public function getQuery() {
1170
+ return $this->query;
1171
+ }
1172
+ public function setUseQueryCache( $useQueryCache) {
1173
+ $this->useQueryCache = $useQueryCache;
1174
+ }
1175
+ public function getUseQueryCache() {
1176
+ return $this->useQueryCache;
1177
+ }
1178
+ public function setWriteDisposition( $writeDisposition) {
1179
+ $this->writeDisposition = $writeDisposition;
1180
+ }
1181
+ public function getWriteDisposition() {
1182
+ return $this->writeDisposition;
1183
+ }
1184
+ }
1185
+
1186
+ class Google_JobConfigurationTableCopy extends Google_Model {
1187
+ public $createDisposition;
1188
+ protected $__destinationTableType = 'Google_TableReference';
1189
+ protected $__destinationTableDataType = '';
1190
+ public $destinationTable;
1191
+ protected $__sourceTableType = 'Google_TableReference';
1192
+ protected $__sourceTableDataType = '';
1193
+ public $sourceTable;
1194
+ public $writeDisposition;
1195
+ public function setCreateDisposition( $createDisposition) {
1196
+ $this->createDisposition = $createDisposition;
1197
+ }
1198
+ public function getCreateDisposition() {
1199
+ return $this->createDisposition;
1200
+ }
1201
+ public function setDestinationTable(Google_TableReference $destinationTable) {
1202
+ $this->destinationTable = $destinationTable;
1203
+ }
1204
+ public function getDestinationTable() {
1205
+ return $this->destinationTable;
1206
+ }
1207
+ public function setSourceTable(Google_TableReference $sourceTable) {
1208
+ $this->sourceTable = $sourceTable;
1209
+ }
1210
+ public function getSourceTable() {
1211
+ return $this->sourceTable;
1212
+ }
1213
+ public function setWriteDisposition( $writeDisposition) {
1214
+ $this->writeDisposition = $writeDisposition;
1215
+ }
1216
+ public function getWriteDisposition() {
1217
+ return $this->writeDisposition;
1218
+ }
1219
+ }
1220
+
1221
+ class Google_JobList extends Google_Model {
1222
+ public $etag;
1223
+ protected $__jobsType = 'Google_JobListJobs';
1224
+ protected $__jobsDataType = 'array';
1225
+ public $jobs;
1226
+ public $kind;
1227
+ public $nextPageToken;
1228
+ public $totalItems;
1229
+ public function setEtag( $etag) {
1230
+ $this->etag = $etag;
1231
+ }
1232
+ public function getEtag() {
1233
+ return $this->etag;
1234
+ }
1235
+ public function setJobs(/* array(Google_JobListJobs) */ $jobs) {
1236
+ $this->assertIsArray($jobs, 'Google_JobListJobs', __METHOD__);
1237
+ $this->jobs = $jobs;
1238
+ }
1239
+ public function getJobs() {
1240
+ return $this->jobs;
1241
+ }
1242
+ public function setKind( $kind) {
1243
+ $this->kind = $kind;
1244
+ }
1245
+ public function getKind() {
1246
+ return $this->kind;
1247
+ }
1248
+ public function setNextPageToken( $nextPageToken) {
1249
+ $this->nextPageToken = $nextPageToken;
1250
+ }
1251
+ public function getNextPageToken() {
1252
+ return $this->nextPageToken;
1253
+ }
1254
+ public function setTotalItems( $totalItems) {
1255
+ $this->totalItems = $totalItems;
1256
+ }
1257
+ public function getTotalItems() {
1258
+ return $this->totalItems;
1259
+ }
1260
+ }
1261
+
1262
+ class Google_JobListJobs extends Google_Model {
1263
+ protected $__configurationType = 'Google_JobConfiguration';
1264
+ protected $__configurationDataType = '';
1265
+ public $configuration;
1266
+ protected $__errorResultType = 'Google_ErrorProto';
1267
+ protected $__errorResultDataType = '';
1268
+ public $errorResult;
1269
+ public $id;
1270
+ protected $__jobReferenceType = 'Google_JobReference';
1271
+ protected $__jobReferenceDataType = '';
1272
+ public $jobReference;
1273
+ public $kind;
1274
+ public $state;
1275
+ protected $__statisticsType = 'Google_JobStatistics';
1276
+ protected $__statisticsDataType = '';
1277
+ public $statistics;
1278
+ protected $__statusType = 'Google_JobStatus';
1279
+ protected $__statusDataType = '';
1280
+ public $status;
1281
+ public function setConfiguration(Google_JobConfiguration $configuration) {
1282
+ $this->configuration = $configuration;
1283
+ }
1284
+ public function getConfiguration() {
1285
+ return $this->configuration;
1286
+ }
1287
+ public function setErrorResult(Google_ErrorProto $errorResult) {
1288
+ $this->errorResult = $errorResult;
1289
+ }
1290
+ public function getErrorResult() {
1291
+ return $this->errorResult;
1292
+ }
1293
+ public function setId( $id) {
1294
+ $this->id = $id;
1295
+ }
1296
+ public function getId() {
1297
+ return $this->id;
1298
+ }
1299
+ public function setJobReference(Google_JobReference $jobReference) {
1300
+ $this->jobReference = $jobReference;
1301
+ }
1302
+ public function getJobReference() {
1303
+ return $this->jobReference;
1304
+ }
1305
+ public function setKind( $kind) {
1306
+ $this->kind = $kind;
1307
+ }
1308
+ public function getKind() {
1309
+ return $this->kind;
1310
+ }
1311
+ public function setState( $state) {
1312
+ $this->state = $state;
1313
+ }
1314
+ public function getState() {
1315
+ return $this->state;
1316
+ }
1317
+ public function setStatistics(Google_JobStatistics $statistics) {
1318
+ $this->statistics = $statistics;
1319
+ }
1320
+ public function getStatistics() {
1321
+ return $this->statistics;
1322
+ }
1323
+ public function setStatus(Google_JobStatus $status) {
1324
+ $this->status = $status;
1325
+ }
1326
+ public function getStatus() {
1327
+ return $this->status;
1328
+ }
1329
+ }
1330
+
1331
+ class Google_JobReference extends Google_Model {
1332
+ public $jobId;
1333
+ public $projectId;
1334
+ public function setJobId( $jobId) {
1335
+ $this->jobId = $jobId;
1336
+ }
1337
+ public function getJobId() {
1338
+ return $this->jobId;
1339
+ }
1340
+ public function setProjectId( $projectId) {
1341
+ $this->projectId = $projectId;
1342
+ }
1343
+ public function getProjectId() {
1344
+ return $this->projectId;
1345
+ }
1346
+ }
1347
+
1348
+ class Google_JobStatistics extends Google_Model {
1349
+ public $endTime;
1350
+ protected $__loadType = 'Google_JobStatistics3';
1351
+ protected $__loadDataType = '';
1352
+ public $load;
1353
+ protected $__queryType = 'Google_JobStatistics2';
1354
+ protected $__queryDataType = '';
1355
+ public $query;
1356
+ public $startTime;
1357
+ public $totalBytesProcessed;
1358
+ public function setEndTime( $endTime) {
1359
+ $this->endTime = $endTime;
1360
+ }
1361
+ public function getEndTime() {
1362
+ return $this->endTime;
1363
+ }
1364
+ public function setLoad(Google_JobStatistics3 $load) {
1365
+ $this->load = $load;
1366
+ }
1367
+ public function getLoad() {
1368
+ return $this->load;
1369
+ }
1370
+ public function setQuery(Google_JobStatistics2 $query) {
1371
+ $this->query = $query;
1372
+ }
1373
+ public function getQuery() {
1374
+ return $this->query;
1375
+ }
1376
+ public function setStartTime( $startTime) {
1377
+ $this->startTime = $startTime;
1378
+ }
1379
+ public function getStartTime() {
1380
+ return $this->startTime;
1381
+ }
1382
+ public function setTotalBytesProcessed( $totalBytesProcessed) {
1383
+ $this->totalBytesProcessed = $totalBytesProcessed;
1384
+ }
1385
+ public function getTotalBytesProcessed() {
1386
+ return $this->totalBytesProcessed;
1387
+ }
1388
+ }
1389
+
1390
+ class Google_JobStatistics2 extends Google_Model {
1391
+ public $cacheHit;
1392
+ public $completionRatio;
1393
+ public $totalBytesProcessed;
1394
+ public function setCacheHit( $cacheHit) {
1395
+ $this->cacheHit = $cacheHit;
1396
+ }
1397
+ public function getCacheHit() {
1398
+ return $this->cacheHit;
1399
+ }
1400
+ public function setCompletionRatio( $completionRatio) {
1401
+ $this->completionRatio = $completionRatio;
1402
+ }
1403
+ public function getCompletionRatio() {
1404
+ return $this->completionRatio;
1405
+ }
1406
+ public function setTotalBytesProcessed( $totalBytesProcessed) {
1407
+ $this->totalBytesProcessed = $totalBytesProcessed;
1408
+ }
1409
+ public function getTotalBytesProcessed() {
1410
+ return $this->totalBytesProcessed;
1411
+ }
1412
+ }
1413
+
1414
+ class Google_JobStatistics3 extends Google_Model {
1415
+ public $inputFileBytes;
1416
+ public $inputFiles;
1417
+ public $outputBytes;
1418
+ public $outputRows;
1419
+ public function setInputFileBytes( $inputFileBytes) {
1420
+ $this->inputFileBytes = $inputFileBytes;
1421
+ }
1422
+ public function getInputFileBytes() {
1423
+ return $this->inputFileBytes;
1424
+ }
1425
+ public function setInputFiles( $inputFiles) {
1426
+ $this->inputFiles = $inputFiles;
1427
+ }
1428
+ public function getInputFiles() {
1429
+ return $this->inputFiles;
1430
+ }
1431
+ public function setOutputBytes( $outputBytes) {
1432
+ $this->outputBytes = $outputBytes;
1433
+ }
1434
+ public function getOutputBytes() {
1435
+ return $this->outputBytes;
1436
+ }
1437
+ public function setOutputRows( $outputRows) {
1438
+ $this->outputRows = $outputRows;
1439
+ }
1440
+ public function getOutputRows() {
1441
+ return $this->outputRows;
1442
+ }
1443
+ }
1444
+
1445
+ class Google_JobStatus extends Google_Model {
1446
+ protected $__errorResultType = 'Google_ErrorProto';
1447
+ protected $__errorResultDataType = '';
1448
+ public $errorResult;
1449
+ protected $__errorsType = 'Google_ErrorProto';
1450
+ protected $__errorsDataType = 'array';
1451
+ public $errors;
1452
+ public $state;
1453
+ public function setErrorResult(Google_ErrorProto $errorResult) {
1454
+ $this->errorResult = $errorResult;
1455
+ }
1456
+ public function getErrorResult() {
1457
+ return $this->errorResult;
1458
+ }
1459
+ public function setErrors(/* array(Google_ErrorProto) */ $errors) {
1460
+ $this->assertIsArray($errors, 'Google_ErrorProto', __METHOD__);
1461
+ $this->errors = $errors;
1462
+ }
1463
+ public function getErrors() {
1464
+ return $this->errors;
1465
+ }
1466
+ public function setState( $state) {
1467
+ $this->state = $state;
1468
+ }
1469
+ public function getState() {
1470
+ return $this->state;
1471
+ }
1472
+ }
1473
+
1474
+ class Google_ProjectList extends Google_Model {
1475
+ public $etag;
1476
+ public $kind;
1477
+ public $nextPageToken;
1478
+ protected $__projectsType = 'Google_ProjectListProjects';
1479
+ protected $__projectsDataType = 'array';
1480
+ public $projects;
1481
+ public $totalItems;
1482
+ public function setEtag( $etag) {
1483
+ $this->etag = $etag;
1484
+ }
1485
+ public function getEtag() {
1486
+ return $this->etag;
1487
+ }
1488
+ public function setKind( $kind) {
1489
+ $this->kind = $kind;
1490
+ }
1491
+ public function getKind() {
1492
+ return $this->kind;
1493
+ }
1494
+ public function setNextPageToken( $nextPageToken) {
1495
+ $this->nextPageToken = $nextPageToken;
1496
+ }
1497
+ public function getNextPageToken() {
1498
+ return $this->nextPageToken;
1499
+ }
1500
+ public function setProjects(/* array(Google_ProjectListProjects) */ $projects) {
1501
+ $this->assertIsArray($projects, 'Google_ProjectListProjects', __METHOD__);
1502
+ $this->projects = $projects;
1503
+ }
1504
+ public function getProjects() {
1505
+ return $this->projects;
1506
+ }
1507
+ public function setTotalItems( $totalItems) {
1508
+ $this->totalItems = $totalItems;
1509
+ }
1510
+ public function getTotalItems() {
1511
+ return $this->totalItems;
1512
+ }
1513
+ }
1514
+
1515
+ class Google_ProjectListProjects extends Google_Model {
1516
+ public $friendlyName;
1517
+ public $id;
1518
+ public $kind;
1519
+ public $numericId;
1520
+ protected $__projectReferenceType = 'Google_ProjectReference';
1521
+ protected $__projectReferenceDataType = '';
1522
+ public $projectReference;
1523
+ public function setFriendlyName( $friendlyName) {
1524
+ $this->friendlyName = $friendlyName;
1525
+ }
1526
+ public function getFriendlyName() {
1527
+ return $this->friendlyName;
1528
+ }
1529
+ public function setId( $id) {
1530
+ $this->id = $id;
1531
+ }
1532
+ public function getId() {
1533
+ return $this->id;
1534
+ }
1535
+ public function setKind( $kind) {
1536
+ $this->kind = $kind;
1537
+ }
1538
+ public function getKind() {
1539
+ return $this->kind;
1540
+ }
1541
+ public function setNumericId( $numericId) {
1542
+ $this->numericId = $numericId;
1543
+ }
1544
+ public function getNumericId() {
1545
+ return $this->numericId;
1546
+ }
1547
+ public function setProjectReference(Google_ProjectReference $projectReference) {
1548
+ $this->projectReference = $projectReference;
1549
+ }
1550
+ public function getProjectReference() {
1551
+ return $this->projectReference;
1552
+ }
1553
+ }
1554
+
1555
+ class Google_ProjectReference extends Google_Model {
1556
+ public $projectId;
1557
+ public function setProjectId( $projectId) {
1558
+ $this->projectId = $projectId;
1559
+ }
1560
+ public function getProjectId() {
1561
+ return $this->projectId;
1562
+ }
1563
+ }
1564
+
1565
+ class Google_QueryRequest extends Google_Model {
1566
+ protected $__defaultDatasetType = 'Google_DatasetReference';
1567
+ protected $__defaultDatasetDataType = '';
1568
+ public $defaultDataset;
1569
+ public $dryRun;
1570
+ public $kind;
1571
+ public $maxResults;
1572
+ public $minCompletionRatio;
1573
+ public $preserveNulls;
1574
+ public $query;
1575
+ public $timeoutMs;
1576
+ public $useQueryCache;
1577
+ public function setDefaultDataset(Google_DatasetReference $defaultDataset) {
1578
+ $this->defaultDataset = $defaultDataset;
1579
+ }
1580
+ public function getDefaultDataset() {
1581
+ return $this->defaultDataset;
1582
+ }
1583
+ public function setDryRun( $dryRun) {
1584
+ $this->dryRun = $dryRun;
1585
+ }
1586
+ public function getDryRun() {
1587
+ return $this->dryRun;
1588
+ }
1589
+ public function setKind( $kind) {
1590
+ $this->kind = $kind;
1591
+ }
1592
+ public function getKind() {
1593
+ return $this->kind;
1594
+ }
1595
+ public function setMaxResults( $maxResults) {
1596
+ $this->maxResults = $maxResults;
1597
+ }
1598
+ public function getMaxResults() {
1599
+ return $this->maxResults;
1600
+ }
1601
+ public function setMinCompletionRatio( $minCompletionRatio) {
1602
+ $this->minCompletionRatio = $minCompletionRatio;
1603
+ }
1604
+ public function getMinCompletionRatio() {
1605
+ return $this->minCompletionRatio;
1606
+ }
1607
+ public function setPreserveNulls( $preserveNulls) {
1608
+ $this->preserveNulls = $preserveNulls;
1609
+ }
1610
+ public function getPreserveNulls() {
1611
+ return $this->preserveNulls;
1612
+ }
1613
+ public function setQuery( $query) {
1614
+ $this->query = $query;
1615
+ }
1616
+ public function getQuery() {
1617
+ return $this->query;
1618
+ }
1619
+ public function setTimeoutMs( $timeoutMs) {
1620
+ $this->timeoutMs = $timeoutMs;
1621
+ }
1622
+ public function getTimeoutMs() {
1623
+ return $this->timeoutMs;
1624
+ }
1625
+ public function setUseQueryCache( $useQueryCache) {
1626
+ $this->useQueryCache = $useQueryCache;
1627
+ }
1628
+ public function getUseQueryCache() {
1629
+ return $this->useQueryCache;
1630
+ }
1631
+ }
1632
+
1633
+ class Google_QueryResponse extends Google_Model {
1634
+ public $cacheHit;
1635
+ public $jobComplete;
1636
+ protected $__jobReferenceType = 'Google_JobReference';
1637
+ protected $__jobReferenceDataType = '';
1638
+ public $jobReference;
1639
+ public $kind;
1640
+ public $pageToken;
1641
+ protected $__rowsType = 'Google_TableRow';
1642
+ protected $__rowsDataType = 'array';
1643
+ public $rows;
1644
+ protected $__schemaType = 'Google_TableSchema';
1645
+ protected $__schemaDataType = '';
1646
+ public $schema;
1647
+ public $totalBytesProcessed;
1648
+ public $totalRows;
1649
+ public function setCacheHit( $cacheHit) {
1650
+ $this->cacheHit = $cacheHit;
1651
+ }
1652
+ public function getCacheHit() {
1653
+ return $this->cacheHit;
1654
+ }
1655
+ public function setJobComplete( $jobComplete) {
1656
+ $this->jobComplete = $jobComplete;
1657
+ }
1658
+ public function getJobComplete() {
1659
+ return $this->jobComplete;
1660
+ }
1661
+ public function setJobReference(Google_JobReference $jobReference) {
1662
+ $this->jobReference = $jobReference;
1663
+ }
1664
+ public function getJobReference() {
1665
+ return $this->jobReference;
1666
+ }
1667
+ public function setKind( $kind) {
1668
+ $this->kind = $kind;
1669
+ }
1670
+ public function getKind() {
1671
+ return $this->kind;
1672
+ }
1673
+ public function setPageToken( $pageToken) {
1674
+ $this->pageToken = $pageToken;
1675
+ }
1676
+ public function getPageToken() {
1677
+ return $this->pageToken;
1678
+ }
1679
+ public function setRows(/* array(Google_TableRow) */ $rows) {
1680
+ $this->assertIsArray($rows, 'Google_TableRow', __METHOD__);
1681
+ $this->rows = $rows;
1682
+ }
1683
+ public function getRows() {
1684
+ return $this->rows;
1685
+ }
1686
+ public function setSchema(Google_TableSchema $schema) {
1687
+ $this->schema = $schema;
1688
+ }
1689
+ public function getSchema() {
1690
+ return $this->schema;
1691
+ }
1692
+ public function setTotalBytesProcessed( $totalBytesProcessed) {
1693
+ $this->totalBytesProcessed = $totalBytesProcessed;
1694
+ }
1695
+ public function getTotalBytesProcessed() {
1696
+ return $this->totalBytesProcessed;
1697
+ }
1698
+ public function setTotalRows( $totalRows) {
1699
+ $this->totalRows = $totalRows;
1700
+ }
1701
+ public function getTotalRows() {
1702
+ return $this->totalRows;
1703
+ }
1704
+ }
1705
+
1706
+ class Google_Table extends Google_Model {
1707
+ public $creationTime;
1708
+ public $description;
1709
+ public $etag;
1710
+ public $expirationTime;
1711
+ public $friendlyName;
1712
+ public $id;
1713
+ public $kind;
1714
+ public $lastModifiedTime;
1715
+ public $numBytes;
1716
+ public $numRows;
1717
+ protected $__schemaType = 'Google_TableSchema';
1718
+ protected $__schemaDataType = '';
1719
+ public $schema;
1720
+ public $selfLink;
1721
+ protected $__tableReferenceType = 'Google_TableReference';
1722
+ protected $__tableReferenceDataType = '';
1723
+ public $tableReference;
1724
+ public function setCreationTime( $creationTime) {
1725
+ $this->creationTime = $creationTime;
1726
+ }
1727
+ public function getCreationTime() {
1728
+ return $this->creationTime;
1729
+ }
1730
+ public function setDescription( $description) {
1731
+ $this->description = $description;
1732
+ }
1733
+ public function getDescription() {
1734
+ return $this->description;
1735
+ }
1736
+ public function setEtag( $etag) {
1737
+ $this->etag = $etag;
1738
+ }
1739
+ public function getEtag() {
1740
+ return $this->etag;
1741
+ }
1742
+ public function setExpirationTime( $expirationTime) {
1743
+ $this->expirationTime = $expirationTime;
1744
+ }
1745
+ public function getExpirationTime() {
1746
+ return $this->expirationTime;
1747
+ }
1748
+ public function setFriendlyName( $friendlyName) {
1749
+ $this->friendlyName = $friendlyName;
1750
+ }
1751
+ public function getFriendlyName() {
1752
+ return $this->friendlyName;
1753
+ }
1754
+ public function setId( $id) {
1755
+ $this->id = $id;
1756
+ }
1757
+ public function getId() {
1758
+ return $this->id;
1759
+ }
1760
+ public function setKind( $kind) {
1761
+ $this->kind = $kind;
1762
+ }
1763
+ public function getKind() {
1764
+ return $this->kind;
1765
+ }
1766
+ public function setLastModifiedTime( $lastModifiedTime) {
1767
+ $this->lastModifiedTime = $lastModifiedTime;
1768
+ }
1769
+ public function getLastModifiedTime() {
1770
+ return $this->lastModifiedTime;
1771
+ }
1772
+ public function setNumBytes( $numBytes) {
1773
+ $this->numBytes = $numBytes;
1774
+ }
1775
+ public function getNumBytes() {
1776
+ return $this->numBytes;
1777
+ }
1778
+ public function setNumRows( $numRows) {
1779
+ $this->numRows = $numRows;
1780
+ }
1781
+ public function getNumRows() {
1782
+ return $this->numRows;
1783
+ }
1784
+ public function setSchema(Google_TableSchema $schema) {
1785
+ $this->schema = $schema;
1786
+ }
1787
+ public function getSchema() {
1788
+ return $this->schema;
1789
+ }
1790
+ public function setSelfLink( $selfLink) {
1791
+ $this->selfLink = $selfLink;
1792
+ }
1793
+ public function getSelfLink() {
1794
+ return $this->selfLink;
1795
+ }
1796
+ public function setTableReference(Google_TableReference $tableReference) {
1797
+ $this->tableReference = $tableReference;
1798
+ }
1799
+ public function getTableReference() {
1800
+ return $this->tableReference;
1801
+ }
1802
+ }
1803
+
1804
+ class Google_TableCell extends Google_Model {
1805
+ public $v;
1806
+ public function setV( $v) {
1807
+ $this->v = $v;
1808
+ }
1809
+ public function getV() {
1810
+ return $this->v;
1811
+ }
1812
+ }
1813
+
1814
+ class Google_TableDataList extends Google_Model {
1815
+ public $etag;
1816
+ public $kind;
1817
+ public $pageToken;
1818
+ protected $__rowsType = 'Google_TableRow';
1819
+ protected $__rowsDataType = 'array';
1820
+ public $rows;
1821
+ public $totalRows;
1822
+ public function setEtag( $etag) {
1823
+ $this->etag = $etag;
1824
+ }
1825
+ public function getEtag() {
1826
+ return $this->etag;
1827
+ }
1828
+ public function setKind( $kind) {
1829
+ $this->kind = $kind;
1830
+ }
1831
+ public function getKind() {
1832
+ return $this->kind;
1833
+ }
1834
+ public function setPageToken( $pageToken) {
1835
+ $this->pageToken = $pageToken;
1836
+ }
1837
+ public function getPageToken() {
1838
+ return $this->pageToken;
1839
+ }
1840
+ public function setRows(/* array(Google_TableRow) */ $rows) {
1841
+ $this->assertIsArray($rows, 'Google_TableRow', __METHOD__);
1842
+ $this->rows = $rows;
1843
+ }
1844
+ public function getRows() {
1845
+ return $this->rows;
1846
+ }
1847
+ public function setTotalRows( $totalRows) {
1848
+ $this->totalRows = $totalRows;
1849
+ }
1850
+ public function getTotalRows() {
1851
+ return $this->totalRows;
1852
+ }
1853
+ }
1854
+
1855
+ class Google_TableFieldSchema extends Google_Model {
1856
+ protected $__fieldsType = 'Google_TableFieldSchema';
1857
+ protected $__fieldsDataType = 'array';
1858
+ public $fields;
1859
+ public $mode;
1860
+ public $name;
1861
+ public $type;
1862
+ public function setFields(/* array(Google_TableFieldSchema) */ $fields) {
1863
+ $this->assertIsArray($fields, 'Google_TableFieldSchema', __METHOD__);
1864
+ $this->fields = $fields;
1865
+ }
1866
+ public function getFields() {
1867
+ return $this->fields;
1868
+ }
1869
+ public function setMode( $mode) {
1870
+ $this->mode = $mode;
1871
+ }
1872
+ public function getMode() {
1873
+ return $this->mode;
1874
+ }
1875
+ public function setName( $name) {
1876
+ $this->name = $name;
1877
+ }
1878
+ public function getName() {
1879
+ return $this->name;
1880
+ }
1881
+ public function setType( $type) {
1882
+ $this->type = $type;
1883
+ }
1884
+ public function getType() {
1885
+ return $this->type;
1886
+ }
1887
+ }
1888
+
1889
+ class Google_TableList extends Google_Model {
1890
+ public $etag;
1891
+ public $kind;
1892
+ public $nextPageToken;
1893
+ protected $__tablesType = 'Google_TableListTables';
1894
+ protected $__tablesDataType = 'array';
1895
+ public $tables;
1896
+ public $totalItems;
1897
+ public function setEtag( $etag) {
1898
+ $this->etag = $etag;
1899
+ }
1900
+ public function getEtag() {
1901
+ return $this->etag;
1902
+ }
1903
+ public function setKind( $kind) {
1904
+ $this->kind = $kind;
1905
+ }
1906
+ public function getKind() {
1907
+ return $this->kind;
1908
+ }
1909
+ public function setNextPageToken( $nextPageToken) {
1910
+ $this->nextPageToken = $nextPageToken;
1911
+ }
1912
+ public function getNextPageToken() {
1913
+ return $this->nextPageToken;
1914
+ }
1915
+ public function setTables(/* array(Google_TableListTables) */ $tables) {
1916
+ $this->assertIsArray($tables, 'Google_TableListTables', __METHOD__);
1917
+ $this->tables = $tables;
1918
+ }
1919
+ public function getTables() {
1920
+ return $this->tables;
1921
+ }
1922
+ public function setTotalItems( $totalItems) {
1923
+ $this->totalItems = $totalItems;
1924
+ }
1925
+ public function getTotalItems() {
1926
+ return $this->totalItems;
1927
+ }
1928
+ }
1929
+
1930
+ class Google_TableListTables extends Google_Model {
1931
+ public $friendlyName;
1932
+ public $id;
1933
+ public $kind;
1934
+ protected $__tableReferenceType = 'Google_TableReference';
1935
+ protected $__tableReferenceDataType = '';
1936
+ public $tableReference;
1937
+ public function setFriendlyName( $friendlyName) {
1938
+ $this->friendlyName = $friendlyName;
1939
+ }
1940
+ public function getFriendlyName() {
1941
+ return $this->friendlyName;
1942
+ }
1943
+ public function setId( $id) {
1944
+ $this->id = $id;
1945
+ }
1946
+ public function getId() {
1947
+ return $this->id;
1948
+ }
1949
+ public function setKind( $kind) {
1950
+ $this->kind = $kind;
1951
+ }
1952
+ public function getKind() {
1953
+ return $this->kind;
1954
+ }
1955
+ public function setTableReference(Google_TableReference $tableReference) {
1956
+ $this->tableReference = $tableReference;
1957
+ }
1958
+ public function getTableReference() {
1959
+ return $this->tableReference;
1960
+ }
1961
+ }
1962
+
1963
+ class Google_TableReference extends Google_Model {
1964
+ public $datasetId;
1965
+ public $projectId;
1966
+ public $tableId;
1967
+ public function setDatasetId( $datasetId) {
1968
+ $this->datasetId = $datasetId;
1969
+ }
1970
+ public function getDatasetId() {
1971
+ return $this->datasetId;
1972
+ }
1973
+ public function setProjectId( $projectId) {
1974
+ $this->projectId = $projectId;
1975
+ }
1976
+ public function getProjectId() {
1977
+ return $this->projectId;
1978
+ }
1979
+ public function setTableId( $tableId) {
1980
+ $this->tableId = $tableId;
1981
+ }
1982
+ public function getTableId() {
1983
+ return $this->tableId;
1984
+ }
1985
+ }
1986
+
1987
+ class Google_TableRow extends Google_Model {
1988
+ protected $__fType = 'Google_TableCell';
1989
+ protected $__fDataType = 'array';
1990
+ public $f;
1991
+ public function setF(/* array(Google_TableCell) */ $f) {
1992
+ $this->assertIsArray($f, 'Google_TableCell', __METHOD__);
1993
+ $this->f = $f;
1994
+ }
1995
+ public function getF() {
1996
+ return $this->f;
1997
+ }
1998
+ }
1999
+
2000
+ class Google_TableSchema extends Google_Model {
2001
+ protected $__fieldsType = 'Google_TableFieldSchema';
2002
+ protected $__fieldsDataType = 'array';
2003
+ public $fields;
2004
+ public function setFields(/* array(Google_TableFieldSchema) */ $fields) {
2005
+ $this->assertIsArray($fields, 'Google_TableFieldSchema', __METHOD__);
2006
+ $this->fields = $fields;
2007
+ }
2008
+ public function getFields() {
2009
+ return $this->fields;
2010
+ }
2011
+ }
app/code/community/BackupGuard/BackupGuardFree/com/lib/GoogleDrive/contrib/Google_BloggerService.php ADDED
@@ -0,0 +1,1389 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
+ * use this file except in compliance with the License. You may obtain a copy of
5
+ * the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+ * License for the specific language governing permissions and limitations under
13
+ * the License.
14
+ */
15
+
16
+
17
+ /**
18
+ * The "blogUserInfos" collection of methods.
19
+ * Typical usage is:
20
+ * <code>
21
+ * $bloggerService = new Google_BloggerService(...);
22
+ * $blogUserInfos = $bloggerService->blogUserInfos;
23
+ * </code>
24
+ */
25
+ class Google_BlogUserInfosServiceResource extends Google_ServiceResource {
26
+
27
+ /**
28
+ * Gets one blog and user info pair by blogId and userId. (blogUserInfos.get)
29
+ *
30
+ * @param string $userId ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.
31
+ * @param string $blogId The ID of the blog to get.
32
+ * @param array $optParams Optional parameters.
33
+ *
34
+ * @opt_param string maxPosts Maximum number of posts to pull back with the blog.
35
+ * @return Google_BlogUserInfo
36
+ */
37
+ public function get($userId, $blogId, $optParams = array()) {
38
+ $params = array('userId' => $userId, 'blogId' => $blogId);
39
+ $params = array_merge($params, $optParams);
40
+ $data = $this->__call('get', array($params));
41
+ if ($this->useObjects()) {
42
+ return new Google_BlogUserInfo($data);
43
+ } else {
44
+ return $data;
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * The "blogs" collection of methods.
51
+ * Typical usage is:
52
+ * <code>
53
+ * $bloggerService = new Google_BloggerService(...);
54
+ * $blogs = $bloggerService->blogs;
55
+ * </code>
56
+ */
57
+ class Google_BlogsServiceResource extends Google_ServiceResource {
58
+
59
+ /**
60
+ * Gets one blog by id. (blogs.get)
61
+ *
62
+ * @param string $blogId The ID of the blog to get.
63
+ * @param array $optParams Optional parameters.
64
+ *
65
+ * @opt_param string maxPosts Maximum number of posts to pull back with the blog.
66
+ * @return Google_Blog
67
+ */
68
+ public function get($blogId, $optParams = array()) {
69
+ $params = array('blogId' => $blogId);
70
+ $params = array_merge($params, $optParams);
71
+ $data = $this->__call('get', array($params));
72
+ if ($this->useObjects()) {
73
+ return new Google_Blog($data);
74
+ } else {
75
+ return $data;
76
+ }
77
+ }
78
+ /**
79
+ * Retrieve a Blog by URL. (blogs.getByUrl)
80
+ *
81
+ * @param string $url The URL of the blog to retrieve.
82
+ * @param array $optParams Optional parameters.
83
+ * @return Google_Blog
84
+ */
85
+ public function getByUrl($url, $optParams = array()) {
86
+ $params = array('url' => $url);
87
+ $params = array_merge($params, $optParams);
88
+ $data = $this->__call('getByUrl', array($params));
89
+ if ($this->useObjects()) {
90
+ return new Google_Blog($data);
91
+ } else {
92
+ return $data;
93
+ }
94
+ }
95
+ /**
96
+ * Retrieves a list of blogs, possibly filtered. (blogs.listByUser)
97
+ *
98
+ * @param string $userId ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.
99
+ * @param array $optParams Optional parameters.
100
+ * @return Google_BlogList
101
+ */
102
+ public function listByUser($userId, $optParams = array()) {
103
+ $params = array('userId' => $userId);
104
+ $params = array_merge($params, $optParams);
105
+ $data = $this->__call('listByUser', array($params));
106
+ if ($this->useObjects()) {
107
+ return new Google_BlogList($data);
108
+ } else {
109
+ return $data;
110
+ }
111
+ }
112
+ }
113
+
114
+ /**
115
+ * The "comments" collection of methods.
116
+ * Typical usage is:
117
+ * <code>
118
+ * $bloggerService = new Google_BloggerService(...);
119
+ * $comments = $bloggerService->comments;
120
+ * </code>
121
+ */
122
+ class Google_CommentsServiceResource extends Google_ServiceResource {
123
+
124
+ /**
125
+ * Gets one comment by id. (comments.get)
126
+ *
127
+ * @param string $blogId ID of the blog to containing the comment.
128
+ * @param string $postId ID of the post to fetch posts from.
129
+ * @param string $commentId The ID of the comment to get.
130
+ * @param array $optParams Optional parameters.
131
+ * @return Google_Comment
132
+ */
133
+ public function get($blogId, $postId, $commentId, $optParams = array()) {
134
+ $params = array('blogId' => $blogId, 'postId' => $postId, 'commentId' => $commentId);
135
+ $params = array_merge($params, $optParams);
136
+ $data = $this->__call('get', array($params));
137
+ if ($this->useObjects()) {
138
+ return new Google_Comment($data);
139
+ } else {
140
+ return $data;
141
+ }
142
+ }
143
+ /**
144
+ * Retrieves the comments for a blog, possibly filtered. (comments.list)
145
+ *
146
+ * @param string $blogId ID of the blog to fetch comments from.
147
+ * @param string $postId ID of the post to fetch posts from.
148
+ * @param array $optParams Optional parameters.
149
+ *
150
+ * @opt_param string endDate Latest date of comment to fetch, a date-time with RFC 3339 formatting.
151
+ * @opt_param bool fetchBodies Whether the body content of the comments is included.
152
+ * @opt_param string maxResults Maximum number of comments to include in the result.
153
+ * @opt_param string pageToken Continuation token if request is paged.
154
+ * @opt_param string startDate Earliest date of comment to fetch, a date-time with RFC 3339 formatting.
155
+ * @return Google_CommentList
156
+ */
157
+ public function listComments($blogId, $postId, $optParams = array()) {
158
+ $params = array('blogId' => $blogId, 'postId' => $postId);
159
+ $params = array_merge($params, $optParams);
160
+ $data = $this->__call('list', array($params));
161
+ if ($this->useObjects()) {
162
+ return new Google_CommentList($data);
163
+ } else {
164
+ return $data;
165
+ }
166
+ }
167
+ }
168
+
169
+ /**
170
+ * The "pages" collection of methods.
171
+ * Typical usage is:
172
+ * <code>
173
+ * $bloggerService = new Google_BloggerService(...);
174
+ * $pages = $bloggerService->pages;
175
+ * </code>
176
+ */
177
+ class Google_PagesServiceResource extends Google_ServiceResource {
178
+
179
+ /**
180
+ * Gets one blog page by id. (pages.get)
181
+ *
182
+ * @param string $blogId ID of the blog containing the page.
183
+ * @param string $pageId The ID of the page to get.
184
+ * @param array $optParams Optional parameters.
185
+ * @return Google_Page
186
+ */
187
+ public function get($blogId, $pageId, $optParams = array()) {
188
+ $params = array('blogId' => $blogId, 'pageId' => $pageId);
189
+ $params = array_merge($params, $optParams);
190
+ $data = $this->__call('get', array($params));
191
+ if ($this->useObjects()) {
192
+ return new Google_Page($data);
193
+ } else {
194
+ return $data;
195
+ }
196
+ }
197
+ /**
198
+ * Retrieves pages for a blog, possibly filtered. (pages.list)
199
+ *
200
+ * @param string $blogId ID of the blog to fetch pages from.
201
+ * @param array $optParams Optional parameters.
202
+ *
203
+ * @opt_param bool fetchBodies Whether to retrieve the Page bodies.
204
+ * @return Google_PageList
205
+ */
206
+ public function listPages($blogId, $optParams = array()) {
207
+ $params = array('blogId' => $blogId);
208
+ $params = array_merge($params, $optParams);
209
+ $data = $this->__call('list', array($params));
210
+ if ($this->useObjects()) {
211
+ return new Google_PageList($data);
212
+ } else {
213
+ return $data;
214
+ }
215
+ }
216
+ }
217
+
218
+ /**
219
+ * The "posts" collection of methods.
220
+ * Typical usage is:
221
+ * <code>
222
+ * $bloggerService = new Google_BloggerService(...);
223
+ * $posts = $bloggerService->posts;
224
+ * </code>
225
+ */
226
+ class Google_PostsServiceResource extends Google_ServiceResource {
227
+
228
+ /**
229
+ * Delete a post by id. (posts.delete)
230
+ *
231
+ * @param string $blogId The Id of the Blog.
232
+ * @param string $postId The ID of the Post.
233
+ * @param array $optParams Optional parameters.
234
+ */
235
+ public function delete($blogId, $postId, $optParams = array()) {
236
+ $params = array('blogId' => $blogId, 'postId' => $postId);
237
+ $params = array_merge($params, $optParams);
238
+ $data = $this->__call('delete', array($params));
239
+ return $data;
240
+ }
241
+ /**
242
+ * Get a post by id. (posts.get)
243
+ *
244
+ * @param string $blogId ID of the blog to fetch the post from.
245
+ * @param string $postId The ID of the post
246
+ * @param array $optParams Optional parameters.
247
+ *
248
+ * @opt_param string maxComments Maximum number of comments to pull back on a post.
249
+ * @return Google_Post
250
+ */
251
+ public function get($blogId, $postId, $optParams = array()) {
252
+ $params = array('blogId' => $blogId, 'postId' => $postId);
253
+ $params = array_merge($params, $optParams);
254
+ $data = $this->__call('get', array($params));
255
+ if ($this->useObjects()) {
256
+ return new Google_Post($data);
257
+ } else {
258
+ return $data;
259
+ }
260
+ }
261
+ /**
262
+ * Retrieve a Post by Path. (posts.getByPath)
263
+ *
264
+ * @param string $blogId ID of the blog to fetch the post from.
265
+ * @param string $path Path of the Post to retrieve.
266
+ * @param array $optParams Optional parameters.
267
+ *
268
+ * @opt_param string maxComments Maximum number of comments to pull back on a post.
269
+ * @return Google_Post
270
+ */
271
+ public function getByPath($blogId, $path, $optParams = array()) {
272
+ $params = array('blogId' => $blogId, 'path' => $path);
273
+ $params = array_merge($params, $optParams);
274
+ $data = $this->__call('getByPath', array($params));
275
+ if ($this->useObjects()) {
276
+ return new Google_Post($data);
277
+ } else {
278
+ return $data;
279
+ }
280
+ }
281
+ /**
282
+ * Add a post. (posts.insert)
283
+ *
284
+ * @param string $blogId ID of the blog to add the post to.
285
+ * @param Google_Post $postBody
286
+ * @param array $optParams Optional parameters.
287
+ * @return Google_Post
288
+ */
289
+ public function insert($blogId, Google_Post $postBody, $optParams = array()) {
290
+ $params = array('blogId' => $blogId, 'postBody' => $postBody);
291
+ $params = array_merge($params, $optParams);
292
+ $data = $this->__call('insert', array($params));
293
+ if ($this->useObjects()) {
294
+ return new Google_Post($data);
295
+ } else {
296
+ return $data;
297
+ }
298
+ }
299
+ /**
300
+ * Retrieves a list of posts, possibly filtered. (posts.list)
301
+ *
302
+ * @param string $blogId ID of the blog to fetch posts from.
303
+ * @param array $optParams Optional parameters.
304
+ *
305
+ * @opt_param string endDate Latest post date to fetch, a date-time with RFC 3339 formatting.
306
+ * @opt_param bool fetchBodies Whether the body content of posts is included.
307
+ * @opt_param string labels Comma-separated list of labels to search for.
308
+ * @opt_param string maxResults Maximum number of posts to fetch.
309
+ * @opt_param string pageToken Continuation token if the request is paged.
310
+ * @opt_param string startDate Earliest post date to fetch, a date-time with RFC 3339 formatting.
311
+ * @return Google_PostList
312
+ */
313
+ public function listPosts($blogId, $optParams = array()) {
314
+ $params = array('blogId' => $blogId);
315
+ $params = array_merge($params, $optParams);
316
+ $data = $this->__call('list', array($params));
317
+ if ($this->useObjects()) {
318
+ return new Google_