W3 Total Cache - Version 0.9.5.1

Version Description

  • Fixed missing namespace, which caused issues with other implementations of Google APIs
  • Fixed handling Cloudflare zone list being incomplete for users with many zones
  • Added extension to support Accelerated Mobile Pages (AMP)
  • Added notification for users that are still using PHP 5.2 (end of life in 2011)
  • Improved default settings
  • Improved compatibility with Yoast SEO sitemap caching
  • Improved compatability with Jetpack
  • Improved directory handling on IIS
  • Improved backwards compatibility for 3rd party implementations against legacy W3TC functions
Download this release

Release Info

Developer fredericktownes
Plugin Icon 128x128 W3 Total Cache
Version 0.9.5.1
Comparing to
See all releases

Code changes from version 0.9.5 to 0.9.5.1

Files changed (154) hide show
  1. BrowserCache_ConfigLabels.php +1 -1
  2. BrowserCache_Environment.php +2 -2
  3. BrowserCache_Plugin.php +2 -2
  4. CacheFlush_Locally.php +3 -1
  5. CdnEngine_Base.php +1 -1
  6. CdnEngine_GoogleDrive.php +16 -14
  7. Cdn_GoogleDrive_AdminActions.php +4 -4
  8. Cdn_GoogleDrive_Popup_AuthReturn.php +2 -2
  9. ConfigKeys.php +1 -1
  10. Extension_Amp_Plugin.php +63 -0
  11. Extension_Amp_Plugin_Admin.php +32 -0
  12. Extension_CloudFlare_Api.php +58 -3
  13. Extension_CloudFlare_Page_View.js +13 -0
  14. Extension_CloudFlare_Page_View.php +60 -65
  15. Extension_CloudFlare_Plugin.php +5 -1
  16. Extension_CloudFlare_Plugin_Admin.php +1 -0
  17. Extension_CloudFlare_Popup.php +16 -10
  18. Extension_CloudFlare_Popup_View_Zones.php +17 -1
  19. Extension_CloudFlare_Widget.php +2 -1
  20. Extension_CloudFlare_Widget_Logo.png +0 -0
  21. Extension_CloudFlare_Widget_View.css +8 -0
  22. Extension_FeedBurner_Page_View.php +2 -2
  23. Extension_FeedBurner_Plugin_Admin.php +1 -0
  24. Extension_FragmentCache_Api.php +2 -4
  25. Extension_FragmentCache_Plugin_Admin.php +1 -0
  26. Extension_FragmentCache_WpObjectCache.php +2 -2
  27. Extension_Genesis_Plugin_Admin.php +2 -1
  28. Extension_NewRelic_Page_View_Apm.php +3 -3
  29. Extension_NewRelic_Plugin_Admin.php +1 -0
  30. Extension_WordPressSeo_Plugin_Admin.php +3 -2
  31. Extension_Wpml_Plugin_Admin.php +6 -5
  32. Extensions_Page.php +14 -1
  33. Extensions_Plugin_Admin.php +4 -0
  34. Generic_ConfigLabels.php +1 -1
  35. Generic_Page_Dashboard_View.css +7 -5
  36. Generic_Plugin_Admin.php +3 -0
  37. Generic_Plugin_AdminNotifications.php +1 -1
  38. Generic_Plugin_WidgetServices.php → Generic_WidgetServices.php +65 -90
  39. Generic_WidgetServices_View.php +35 -0
  40. Generic_WidgetSpreadTheWord_Plugin.php +3 -3
  41. Licensing_AdminActions.php +4 -4
  42. Licensing_Core.php +105 -0
  43. Licensing_Plugin_Admin.php +5 -5
  44. Minify_ConfigLabels.php +1 -1
  45. Minify_Environment.php +3 -3
  46. Minify_MinifiedFileRequestHandler.php +8 -2
  47. Minify_Plugin.php +164 -153
  48. ObjectCache_WpObjectCache_Regular.php +2 -2
  49. PgCache_ConfigLabels.php +5 -5
  50. PgCache_ContentGrabber.php +1 -1
  51. PgCache_Environment.php +3 -3
  52. PgCache_Plugin_Admin.php +1 -1
  53. Root_Loader.php +6 -1
  54. Support_Page.php +28 -0
  55. Support_Page_View_PageContent.php +8 -1
  56. SystemOpCache_GeneralPage_View.php +1 -1
  57. UsageStatistics_ConfigLabels.php +0 -10
  58. UsageStatistics_Plugin_Admin.php +0 -3
  59. UsageStatistics_View_General.php +14 -4
  60. UsageStatistics_Widget.php +5 -2
  61. UsageStatistics_Widget_View_Disabled.php +1 -1
  62. Util_Environment.php +10 -10
  63. Util_PageUrls.php +1 -1
  64. Util_Rule.php +9 -7
  65. Util_UsageStatistics.php +0 -10
  66. changelog.txt +1 -1
  67. extension-example/Extension_Example_Admin.php +1 -0
  68. inc/define.php +5 -17
  69. inc/lightbox/cdn_s3_bucket_location.php +1 -3
  70. inc/lightbox/edge.php +1 -1
  71. inc/lightbox/self_test.php +1 -1
  72. inc/lightbox/support_us.php +1 -1
  73. inc/lightbox/upgrade.php +28 -22
  74. inc/options/about.php +1 -1
  75. inc/options/browsercache.php +8 -9
  76. inc/options/dashboard.php +1 -1
  77. inc/options/dbcache.php +1 -1
  78. inc/options/extensions/list.php +10 -7
  79. inc/options/general.php +1 -1
  80. inc/options/pgcache.php +8 -8
  81. inc/widget/services.php +0 -19
  82. languages/faq-en_US.xml +8 -57
  83. languages/faq-pro-en_US.xml +93 -55
  84. lib/CSSTidy/class.csstidy.php +1 -1
  85. lib/CSSTidy/class.csstidy_optimise.php +1 -1
  86. lib/CSSTidy/class.csstidy_print.php +1 -1
  87. lib/EDD/EDD_SL_Plugin_Updater.php +0 -139
  88. lib/EDD/integration.php +0 -100
  89. lib/Google/Auth/Abstract.php +5 -5
  90. lib/Google/Auth/AppIdentity.php +7 -7
  91. lib/Google/Auth/AssertionCredentials.php +6 -6
  92. lib/Google/Auth/Exception.php +1 -1
  93. lib/Google/Auth/LoginTicket.php +3 -3
  94. lib/Google/Auth/OAuth2.php +49 -49
  95. lib/Google/Auth/Simple.php +6 -6
  96. lib/Google/Cache/Abstract.php +2 -2
  97. lib/Google/Cache/Apc.php +4 -4
  98. lib/Google/Cache/Exception.php +1 -1
  99. lib/Google/Cache/File.php +4 -4
  100. lib/Google/Cache/Memcache.php +7 -7
  101. lib/Google/Cache/Null.php +2 -2
  102. lib/Google/Client.php +42 -42
  103. lib/Google/Collection.php +2 -2
  104. lib/Google/Config.php +10 -10
  105. lib/Google/Exception.php +1 -1
  106. lib/Google/Http/Batch.php +10 -10
  107. lib/Google/Http/CacheParser.php +10 -10
  108. lib/Google/Http/MediaFileUpload.php +10 -10
  109. lib/Google/Http/REST.php +11 -11
  110. lib/Google/Http/Request.php +3 -3
  111. lib/Google/IO/Abstract.php +27 -27
  112. lib/Google/IO/Curl.php +8 -8
  113. lib/Google/IO/Exception.php +1 -1
  114. lib/Google/IO/Stream.php +8 -8
  115. lib/Google/Model.php +7 -7
  116. lib/Google/Service.php +4 -4
  117. lib/Google/Service/Drive.php +281 -281
  118. lib/Google/Service/Exception.php +1 -1
  119. lib/Google/Service/Oauth2.php +20 -20
  120. lib/Google/Service/Resource.php +12 -12
  121. lib/Google/Signer/Abstract.php +1 -1
  122. lib/Google/Signer/P12.php +7 -7
  123. lib/Google/Utils.php +1 -1
  124. lib/Google/Utils/URITemplate.php +1 -1
  125. lib/Google/Verifier/Abstract.php +1 -1
  126. lib/Google/Verifier/Pem.php +7 -7
  127. lib/Minify/HTTP/ConditionalGet.php +1 -1
  128. lib/Nusoap/class.nusoap_base.php +1 -1
  129. lib/Nusoap/class.soap_fault.php +1 -1
  130. lib/Nusoap/class.soap_parser.php +1 -1
  131. lib/Nusoap/class.soap_transport_http.php +1 -1
  132. lib/Nusoap/class.soap_val.php +1 -1
  133. lib/Nusoap/class.soapclient.php +1 -1
  134. lib/Nusoap/class.wsdl.php +1 -1
  135. lib/Nusoap/class.wsdlcache.php +1 -1
  136. lib/Nusoap/class.xmlschema.php +1 -1
  137. lib/Nusoap/nusoap.php +9 -9
  138. lib/S3.php +30 -30
  139. lib/SNS/sdk.class.php +2 -2
  140. pub/css/lightbox.css +59 -37
  141. pub/css/options.css +11 -7
  142. pub/css/widget.css +4 -7
  143. pub/js/lightbox.js +9 -7
  144. pub/js/options.js +10 -0
  145. pub/js/widget.js +5 -24
  146. pub/opcache.php +1 -1
  147. pub/sns.php +1 -1
  148. readme.txt +42 -37
  149. w3-total-cache-api.php +70 -15
  150. w3-total-cache-old-php.php +32 -0
  151. w3-total-cache.php +8 -7
  152. wp-content/advanced-cache.php +1 -1
  153. wp-content/db.php +1 -1
  154. wp-content/object-cache.php +1 -1
BrowserCache_ConfigLabels.php CHANGED
@@ -13,7 +13,7 @@ class BrowserCache_ConfigLabels {
13
  'browsercache.cssjs.lifetime' => __( 'Expires header lifetime:', 'w3-total-cache' ),
14
  'browsercache.cssjs.cache.control' => __( 'Set cache control header', 'w3-total-cache' ),
15
  'browsercache.cssjs.cache.policy' => __( 'Cache Control policy:', 'w3-total-cache' ),
16
- 'browsercache.cssjs.etag' => __( 'Set entity tag (ETag)', 'w3-total-cache' ),
17
  'browsercache.cssjs.w3tc' => __( 'Set W3 Total Cache header', 'w3-total-cache' ),
18
  'browsercache.cssjs.compression' => __( 'Enable <acronym title="Hypertext Transfer Protocol">HTTP</acronym> (gzip) compression', 'w3-total-cache' ),
19
  'browsercache.cssjs.replace' => __( 'Prevent caching of objects after settings change', 'w3-total-cache' ),
13
  'browsercache.cssjs.lifetime' => __( 'Expires header lifetime:', 'w3-total-cache' ),
14
  'browsercache.cssjs.cache.control' => __( 'Set cache control header', 'w3-total-cache' ),
15
  'browsercache.cssjs.cache.policy' => __( 'Cache Control policy:', 'w3-total-cache' ),
16
+ 'browsercache.cssjs.etag' => __( 'Set entity tag (eTag)', 'w3-total-cache' ),
17
  'browsercache.cssjs.w3tc' => __( 'Set W3 Total Cache header', 'w3-total-cache' ),
18
  'browsercache.cssjs.compression' => __( 'Enable <acronym title="Hypertext Transfer Protocol">HTTP</acronym> (gzip) compression', 'w3-total-cache' ),
19
  'browsercache.cssjs.replace' => __( 'Prevent caching of objects after settings change', 'w3-total-cache' ),
BrowserCache_Environment.php CHANGED
@@ -462,7 +462,7 @@ class BrowserCache_Environment {
462
 
463
  if ( $w3tc )
464
  $headers_rules .= " Header set X-Powered-By \"" .
465
- Util_Environment::w3tc_header( $config ) . "\"\n";
466
 
467
  if ( strlen( $headers_rules ) > 0 ) {
468
  $rules .= " <IfModule mod_headers.c>\n";
@@ -643,7 +643,7 @@ class BrowserCache_Environment {
643
 
644
  if ( $w3tc ) {
645
  $add_header_rules .= " add_header X-Powered-By \"" .
646
- Util_Environment::w3tc_header( $config ) . "\";\n";
647
  }
648
 
649
  $rules .= $add_header_rules;
462
 
463
  if ( $w3tc )
464
  $headers_rules .= " Header set X-Powered-By \"" .
465
+ Util_Environment::w3tc_header() . "\"\n";
466
 
467
  if ( strlen( $headers_rules ) > 0 ) {
468
  $rules .= " <IfModule mod_headers.c>\n";
643
 
644
  if ( $w3tc ) {
645
  $add_header_rules .= " add_header X-Powered-By \"" .
646
+ Util_Environment::w3tc_header() . "\";\n";
647
  }
648
 
649
  $rules .= $add_header_rules;
BrowserCache_Plugin.php CHANGED
@@ -214,7 +214,7 @@ class BrowserCache_Plugin {
214
 
215
  $test_url = Util_Environment::remove_query( $url );
216
  foreach ( $exceptions as $exception ) {
217
- if ( trim( $exception ) && preg_match( '/' . $exception . '/', $test_url ) )
218
  return false;
219
  }
220
 
@@ -266,7 +266,7 @@ class BrowserCache_Plugin {
266
  * Send headers
267
  */
268
  function send_headers() {
269
- @header( 'X-Powered-By: ' . Util_Environment::w3tc_header( $this->_config ) );
270
  }
271
 
272
  /**
214
 
215
  $test_url = Util_Environment::remove_query( $url );
216
  foreach ( $exceptions as $exception ) {
217
+ if ( trim( $exception ) && preg_match( '~' . $exception . '~', $test_url ) )
218
  return false;
219
  }
220
 
266
  * Send headers
267
  */
268
  function send_headers() {
269
+ @header( 'X-Powered-By: ' . Util_Environment::w3tc_header() );
270
  }
271
 
272
  /**
CacheFlush_Locally.php CHANGED
@@ -81,7 +81,9 @@ class CacheFlush_Locally {
81
  }
82
 
83
  function minifycache_flush_all( $extras = array() ) {
84
- delete_option( 'w3tc_minify' );
 
 
85
  $this->minifycache_flush( $extras );
86
  }
87
 
81
  }
82
 
83
  function minifycache_flush_all( $extras = array() ) {
84
+ if ( $extras['minify'] == 'purge_map' )
85
+ delete_option( 'w3tc_minify' );
86
+
87
  $this->minifycache_flush( $extras );
88
  }
89
 
CdnEngine_Base.php CHANGED
@@ -392,7 +392,7 @@ class CdnEngine_Base {
392
 
393
  if ( $this->cache_config[$mime_type]['w3tc'] ) {
394
  $headers['X-Powered-By'] =
395
- Util_Environment::w3tc_header( $this->_config );
396
  }
397
 
398
 
392
 
393
  if ( $this->cache_config[$mime_type]['w3tc'] ) {
394
  $headers['X-Powered-By'] =
395
+ Util_Environment::w3tc_header();
396
  }
397
 
398
 
CdnEngine_GoogleDrive.php CHANGED
@@ -28,16 +28,18 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
28
  $this->_root_url = rtrim( $config['root_url'], '/' ) . '/';
29
  $this->_new_access_token_callback = $config['new_access_token_callback'];
30
 
 
31
  $this->_init_service( $config['access_token'] );
 
32
  }
33
 
34
 
35
 
36
  private function _init_service( $access_token ) {
37
- $client = new \Google_Client();
38
  $client->setClientId( $this->_client_id );
39
  $client->setAccessToken( $access_token );
40
- $this->_service = new \Google_Service_Drive( $client );
41
  }
42
 
43
 
@@ -113,7 +115,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
113
  if ( $listed_files[$m]->title == $title_to_search ) {
114
  try {
115
  $this->_service->files->delete( $listed_files[$m]->id );
116
- } catch ( \Google_Service_Exception $e ) {
117
  $errors = $e->getErrors();
118
  $details = '';
119
  if ( count( $errors ) >= 1 ) {
@@ -156,7 +158,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
156
 
157
  $mtime = @filemtime( $local_path );
158
 
159
- $p = new \Google_Service_Drive_Property();
160
  $p->key = 'mtime';
161
  $p->value = $mtime;
162
  $properties[] = $p;
@@ -184,11 +186,11 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
184
  $content = file_get_contents( $local_path );
185
  }
186
 
187
- $file = new \Google_Service_Drive_DriveFile();
188
  $file->setTitle( $title );
189
  $file->setProperties( $properties );
190
 
191
- $parent = new \Google_Service_Drive_ParentReference();
192
  $parent->setId( $parent_id );
193
  $file->setParents( array( $parent ) );
194
 
@@ -209,7 +211,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
209
  'uploadType' => 'media'
210
  ) );
211
 
212
- $permission = new \Google_Service_Drive_Permission();
213
  $permission->setValue( '' );
214
  $permission->setType( 'anyone' );
215
  $permission->setRole( 'reader' );
@@ -217,7 +219,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
217
  $this->_service->permissions->insert( $created_file->id,
218
  $permission );
219
  }
220
- } catch ( \Google_Auth_Exception $e ) {
221
  if ( $allow_refresh_token )
222
  return 'refresh_required';
223
 
@@ -227,7 +229,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
227
  $results[] = $this->_get_result( $file_descriptor['local_path'],
228
  $file_descriptor['remote_path'], W3TC_CDN_RESULT_OK,
229
  'OK', $file_descriptor );
230
- } catch ( \Google_Service_Exception $e ) {
231
  $errors = $e->getErrors();
232
  $details = '';
233
  if ( count( $errors ) >= 1 ) {
@@ -332,7 +334,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
332
  if ( !is_null( $timeout_time ) && time() > $timeout_time )
333
  return array( 'timeout', array() );
334
  }
335
- } catch ( \Google_Auth_Exception $e ) {
336
  if ( $allow_refresh_token )
337
  return array( 'refresh_required', array() );
338
 
@@ -352,7 +354,7 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
352
  'and trashed = false'
353
  )
354
  );
355
- } catch ( \Google_Auth_Exception $e ) {
356
  if ( $allow_refresh_token )
357
  return array( 'refresh_required', array() );
358
 
@@ -426,18 +428,18 @@ class CdnEngine_GoogleDrive extends CdnEngine_Base {
426
  $id = $items[0]->id;
427
  } else {
428
  // create folder
429
- $file = new \Google_Service_Drive_DriveFile( array(
430
  'title' => $folder,
431
  'mimeType' => 'application/vnd.google-apps.folder' ) );
432
 
433
- $parent = new \Google_Service_Drive_ParentReference();
434
  $parent->setId( $root_id );
435
  $file->setParents( array( $parent ) );
436
 
437
  $created_file = $this->_service->files->insert( $file );
438
  $id = $created_file->id;
439
 
440
- $permission = new \Google_Service_Drive_Permission();
441
  $permission->setValue( '' );
442
  $permission->setType( 'anyone' );
443
  $permission->setRole( 'reader' );
28
  $this->_root_url = rtrim( $config['root_url'], '/' ) . '/';
29
  $this->_new_access_token_callback = $config['new_access_token_callback'];
30
 
31
+ try {
32
  $this->_init_service( $config['access_token'] );
33
+ } catch ( \Exception $e ) {}
34
  }
35
 
36
 
37
 
38
  private function _init_service( $access_token ) {
39
+ $client = new \W3TCG_Google_Client();
40
  $client->setClientId( $this->_client_id );
41
  $client->setAccessToken( $access_token );
42
+ $this->_service = new \W3TCG_Google_Service_Drive( $client );
43
  }
44
 
45
 
115
  if ( $listed_files[$m]->title == $title_to_search ) {
116
  try {
117
  $this->_service->files->delete( $listed_files[$m]->id );
118
+ } catch ( \W3TCG_Google_Service_Exception $e ) {
119
  $errors = $e->getErrors();
120
  $details = '';
121
  if ( count( $errors ) >= 1 ) {
158
 
159
  $mtime = @filemtime( $local_path );
160
 
161
+ $p = new \W3TCG_Google_Service_Drive_Property();
162
  $p->key = 'mtime';
163
  $p->value = $mtime;
164
  $properties[] = $p;
186
  $content = file_get_contents( $local_path );
187
  }
188
 
189
+ $file = new \W3TCG_Google_Service_Drive_DriveFile();
190
  $file->setTitle( $title );
191
  $file->setProperties( $properties );
192
 
193
+ $parent = new \W3TCG_Google_Service_Drive_ParentReference();
194
  $parent->setId( $parent_id );
195
  $file->setParents( array( $parent ) );
196
 
211
  'uploadType' => 'media'
212
  ) );
213
 
214
+ $permission = new \W3TCG_Google_Service_Drive_Permission();
215
  $permission->setValue( '' );
216
  $permission->setType( 'anyone' );
217
  $permission->setRole( 'reader' );
219
  $this->_service->permissions->insert( $created_file->id,
220
  $permission );
221
  }
222
+ } catch ( \W3TCG_Google_Auth_Exception $e ) {
223
  if ( $allow_refresh_token )
224
  return 'refresh_required';
225
 
229
  $results[] = $this->_get_result( $file_descriptor['local_path'],
230
  $file_descriptor['remote_path'], W3TC_CDN_RESULT_OK,
231
  'OK', $file_descriptor );
232
+ } catch ( \W3TCG_Google_Service_Exception $e ) {
233
  $errors = $e->getErrors();
234
  $details = '';
235
  if ( count( $errors ) >= 1 ) {
334
  if ( !is_null( $timeout_time ) && time() > $timeout_time )
335
  return array( 'timeout', array() );
336
  }
337
+ } catch ( \W3TCG_Google_Auth_Exception $e ) {
338
  if ( $allow_refresh_token )
339
  return array( 'refresh_required', array() );
340
 
354
  'and trashed = false'
355
  )
356
  );
357
+ } catch ( \W3TCG_Google_Auth_Exception $e ) {
358
  if ( $allow_refresh_token )
359
  return array( 'refresh_required', array() );
360
 
428
  $id = $items[0]->id;
429
  } else {
430
  // create folder
431
+ $file = new \W3TCG_Google_Service_Drive_DriveFile( array(
432
  'title' => $folder,
433
  'mimeType' => 'application/vnd.google-apps.folder' ) );
434
 
435
+ $parent = new \W3TCG_Google_Service_Drive_ParentReference();
436
  $parent->setId( $root_id );
437
  $file->setParents( array( $parent ) );
438
 
439
  $created_file = $this->_service->files->insert( $file );
440
  $id = $created_file->id;
441
 
442
+ $permission = new \W3TCG_Google_Service_Drive_Permission();
443
  $permission->setValue( '' );
444
  $permission->setType( 'anyone' );
445
  $permission->setRole( 'reader' );
Cdn_GoogleDrive_AdminActions.php CHANGED
@@ -26,17 +26,17 @@ class Cdn_GoogleDrive_AdminActions {
26
  $access_token = stripslashes( $_POST['access_token'] );
27
  $refresh_token = stripslashes( $_POST['refresh_token'] );
28
 
29
- $client = new \Google_Client();
30
  $client->setClientId( $client_id );
31
  $client->setAccessToken( $access_token );
32
 
33
  //
34
  // get folder details
35
  //
36
- $service = new \Google_Service_Drive( $client );
37
 
38
  if ( empty( $_POST['folder'] ) ) {
39
- $file = new \Google_Service_Drive_DriveFile( array(
40
  'title' => $_POST['folder_new'],
41
  'mimeType' => 'application/vnd.google-apps.folder' ) );
42
 
@@ -46,7 +46,7 @@ class Cdn_GoogleDrive_AdminActions {
46
  $used_folder_id = $_POST['folder'];
47
  }
48
 
49
- $permission = new \Google_Service_Drive_Permission();
50
  $permission->setValue( '' );
51
  $permission->setType( 'anyone' );
52
  $permission->setRole( 'reader' );
26
  $access_token = stripslashes( $_POST['access_token'] );
27
  $refresh_token = stripslashes( $_POST['refresh_token'] );
28
 
29
+ $client = new \W3TCG_Google_Client();
30
  $client->setClientId( $client_id );
31
  $client->setAccessToken( $access_token );
32
 
33
  //
34
  // get folder details
35
  //
36
+ $service = new \W3TCG_Google_Service_Drive( $client );
37
 
38
  if ( empty( $_POST['folder'] ) ) {
39
+ $file = new \W3TCG_Google_Service_Drive_DriveFile( array(
40
  'title' => $_POST['folder_new'],
41
  'mimeType' => 'application/vnd.google-apps.folder' ) );
42
 
46
  $used_folder_id = $_POST['folder'];
47
  }
48
 
49
+ $permission = new \W3TCG_Google_Service_Drive_Permission();
50
  $permission->setValue( '' );
51
  $permission->setType( 'anyone' );
52
  $permission->setRole( 'reader' );
Cdn_GoogleDrive_Popup_AuthReturn.php CHANGED
@@ -16,12 +16,12 @@ class Cdn_GoogleDrive_Popup_AuthReturn {
16
  );
17
  $access_token = json_encode( $token_array );
18
 
19
- $client = new \Google_Client();
20
  $client->setClientId( $client_id );
21
  $client->setAccessToken( $access_token );
22
 
23
 
24
- $service = new \Google_Service_Drive( $client );
25
 
26
  $items = $service->files->listFiles( array(
27
  'q' => "mimeType = 'application/vnd.google-apps.folder'"
16
  );
17
  $access_token = json_encode( $token_array );
18
 
19
+ $client = new \W3TCG_Google_Client();
20
  $client->setClientId( $client_id );
21
  $client->setAccessToken( $access_token );
22
 
23
 
24
+ $service = new \W3TCG_Google_Service_Drive( $client );
25
 
26
  $items = $service->files->listFiles( array(
27
  'q' => "mimeType = 'application/vnd.google-apps.folder'"
ConfigKeys.php CHANGED
@@ -878,7 +878,7 @@ $keys = array(
878
  ),
879
  'minify.cache.files' => array(
880
  'type' => 'array',
881
- 'default' => array( 'https://ajax.googleapis.com' )
882
  ),
883
 
884
  'cdn.configuration_overloaded' => array(
878
  ),
879
  'minify.cache.files' => array(
880
  'type' => 'array',
881
+ 'default' => array( '' )
882
  ),
883
 
884
  'cdn.configuration_overloaded' => array(
Extension_Amp_Plugin.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ class Extension_Amp_Plugin {
5
+ function __construct() {
6
+ $is_amp_endpoint = null;
7
+ }
8
+
9
+ public function run() {
10
+ add_filter( 'w3tc_minify_js_enable',
11
+ array( $this, 'w3tc_minify_jscss_enable' ) );
12
+ add_filter( 'w3tc_minify_css_enable',
13
+ array( $this, 'w3tc_minify_jscss_enable' ) );
14
+ add_filter( 'w3tc_footer_comment',
15
+ array( $this, 'w3tc_footer_comment' ) );
16
+
17
+ }
18
+
19
+
20
+
21
+ private function is_amp_endpoint() {
22
+ if ( is_null( $is_amp_endpoint ) && function_exists('is_amp_endpoint') ) {
23
+ $is_amp_endpoint = is_amp_endpoint();
24
+ }
25
+
26
+ return $is_amp_endpoint;
27
+ }
28
+
29
+
30
+
31
+ public function w3tc_minify_jscss_enable( $enabled ) {
32
+ $is_amp_endpoint = $this->is_amp_endpoint();
33
+
34
+ if ( !is_null( $is_amp_endpoint ) && $is_amp_endpoint ) {
35
+ // amp has own rules for CSS and JS files, don't touch them by default
36
+ return false;
37
+ }
38
+
39
+ return $enabled;
40
+ }
41
+
42
+
43
+
44
+ public function w3tc_footer_comment( $strings ) {
45
+ $is_amp_endpoint = $this->is_amp_endpoint();
46
+
47
+ if ( !is_null( $is_amp_endpoint ) && $is_amp_endpoint ) {
48
+ $strings[] = 'AMP page, minification is limited';
49
+ }
50
+
51
+ return $strings;
52
+ }
53
+ }
54
+
55
+
56
+
57
+ $p = new Extension_Amp_Plugin();
58
+ $p->run();
59
+
60
+ if ( is_admin() ) {
61
+ $p = new Extension_Amp_Plugin_Admin();
62
+ $p->run();
63
+ }
Extension_Amp_Plugin_Admin.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ class Extension_Amp_Plugin_Admin {
5
+ function run() {
6
+ }
7
+
8
+ static public function w3tc_extensions( $extensions, $config ) {
9
+ $enabled = true;
10
+ $disabled_message = '';
11
+
12
+ $requirements = array();
13
+
14
+ $extensions['amp'] = array(
15
+ 'name' => 'AMP',
16
+ 'author' => 'W3 EDGE',
17
+ 'description' => __( 'Adds compatibility for accelerated mobile pages (AMP) to minify.',
18
+ 'w3-total-cache' ),
19
+ 'author_uri' => 'https://www.w3-edge.com/',
20
+ 'extension_uri' => 'https://www.w3-edge.com/',
21
+ 'extension_id' => 'amp',
22
+ 'settings_exists' => false,
23
+ 'version' => '0.1',
24
+ 'enabled' => $enabled,
25
+ 'disabled_message' => $disabled_message,
26
+ 'requirements' => implode( ', ', $requirements ),
27
+ 'path' => 'w3-total-cache/Extension_Amp_Plugin.php'
28
+ );
29
+
30
+ return $extensions;
31
+ }
32
+ }
Extension_CloudFlare_Api.php CHANGED
@@ -107,9 +107,18 @@ class Extension_CloudFlare_Api {
107
 
108
 
109
 
110
- public function zones() {
111
- return $this->_wp_remote_request( 'GET',
112
- self::$_root_uri . '/zones' );
 
 
 
 
 
 
 
 
 
113
  }
114
 
115
 
@@ -196,4 +205,50 @@ class Extension_CloudFlare_Api {
196
 
197
  return array();
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
107
 
108
 
109
 
110
+ public function zones($page = 1) {
111
+ return $this->_wp_remote_request_with_meta( 'GET',
112
+ self::$_root_uri . '/zones?page=' . urlencode($page) );
113
+ }
114
+
115
+
116
+
117
+ public function zone($id) {
118
+ $a = $this->_wp_remote_request( 'GET',
119
+ self::$_root_uri . '/zones/' . $id );
120
+
121
+ return $a;
122
  }
123
 
124
 
205
 
206
  return array();
207
  }
208
+
209
+
210
+
211
+ private function _wp_remote_request_with_meta( $method, $url, $body = array() ) {
212
+ $result = wp_remote_request( $url, array(
213
+ 'method' => $method,
214
+ 'headers' => array(
215
+ 'Content-Type' => 'application/json',
216
+ 'X-Auth-Key' => $this->_key,
217
+ 'X-Auth-Email' => $this->_email
218
+ ),
219
+ 'timeout' => $this->_timelimit_api_request,
220
+ 'body' => $body
221
+ ) );
222
+
223
+ if ( is_wp_error( $result ) )
224
+ throw new \Exception( 'Failed to reach API endpoint' );
225
+
226
+ $response_json = @json_decode( $result['body'], true );
227
+ if ( is_null( $response_json ) || !isset( $response_json['success'] ) ) {
228
+ throw new \Exception(
229
+ 'Failed to reach API endpoint, got unexpected response ' .
230
+ $result['body'] );
231
+ }
232
+
233
+ if ( !$response_json['success'] ) {
234
+ $errors = array();
235
+ if ( isset( $response_json['errors'] ) ) {
236
+ foreach ( $response_json['errors'] as $e ) {
237
+ if ( !empty( $e['message'] ) )
238
+ $errors[] = $e['message'];
239
+ }
240
+ }
241
+
242
+ if ( empty( $errors ) )
243
+ $errors[] = 'Request failed';
244
+
245
+ throw new \Exception( implode( ', ', $errors ) );
246
+ }
247
+
248
+ if ( isset( $response_json['result'] ) ) {
249
+ return $response_json;
250
+ }
251
+
252
+ return array();
253
+ }
254
  }
Extension_CloudFlare_Page_View.js CHANGED
@@ -29,4 +29,17 @@ jQuery(function($) {
29
  W3tc_Lightbox.load_form(url, '.w3tc_extension_cloudflare_form',
30
  w3tc_extension_cloudflare_resize);
31
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  });
29
  W3tc_Lightbox.load_form(url, '.w3tc_extension_cloudflare_form',
30
  w3tc_extension_cloudflare_resize);
31
  })
32
+
33
+
34
+
35
+ .on('click', '.w3tc_cloudflare_zone_page', function() {
36
+ var page = jQuery(this).attr('data-page');
37
+ jQuery('input[name="w3tc_action"]').val('extension_cloudflare_intro_done');
38
+ jQuery('input[name="page"]').val(page);
39
+
40
+ var url = ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce;
41
+
42
+ W3tc_Lightbox.load_form(url, '.w3tc_extension_cloudflare_form',
43
+ w3tc_extension_cloudflare_resize);
44
+ })
45
  });
Extension_CloudFlare_Page_View.php CHANGED
@@ -77,7 +77,7 @@ _e( 'Specify account credentials:',
77
  <?php if ( $state == 'not_configured' ): ?>
78
  <table class="form-table">
79
  <tr><td colspan="2">
80
- CloudFlare credentials not specified yet
81
  </td></tr>
82
  </table>
83
  <?php endif ?>
@@ -111,25 +111,25 @@ CloudFlare not available: <?php echo $error_message; ?>
111
  )
112
  );
113
 
114
- Util_Ui::config_item( array(
115
- 'key' => array( 'cloudflare', 'widget_cache_mins' ),
116
- 'label' => __( 'Cache time:', 'w3-total-cache' ),
117
- 'control' => 'textbox',
118
- 'description' =>
119
- 'How many minutes data retrieved from CloudFlare ' .
120
- 'should be stored. Minimum is 1 minute.'
121
- )
122
- );
123
-
124
- Util_Ui::config_item( array(
125
- 'key' => array( 'cloudflare', 'pagecache' ),
126
- 'label' => __( 'Page Caching:', 'w3-total-cache' ),
127
- 'control' => 'checkbox',
128
- 'checkbox_label' => 'Flush CloudFlare on Post Modifications',
129
- 'description' =>
130
- 'Enable when you have html pages cached on CloudFlare level.'
131
- )
132
- );
133
 
134
  ?>
135
  </table>
@@ -163,12 +163,12 @@ self::cloudflare_selectbox( $settings, array(
163
  ) );
164
  self::cloudflare_checkbox( $settings, array(
165
  'key' => 'sort_query_string_for_cache',
166
- 'label' => 'Query String Sorting',
167
  'description' => 'CloudFlare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings.',
168
  ) );
169
  self::cloudflare_selectbox( $settings, array(
170
  'key' => 'browser_cache_ttl',
171
- 'label' => 'Browser Cache TTL',
172
  'values' => array(
173
  '' => '',
174
  '30' => '30',
@@ -198,11 +198,11 @@ self::cloudflare_selectbox( $settings, array(
198
  '16070400' => '16070400',
199
  '31536000' => '31536000'
200
  ),
201
- 'description' => 'Browser Cache TTL (in seconds) specifies how long CloudFlare-cached resources will remain on your visitors\' computers.',
202
  ) );
203
  self::cloudflare_selectbox( $settings, array(
204
  'key' => 'challenge_ttl',
205
- 'label' => ' Challenge TTL',
206
  'values' => array(
207
  '' => '',
208
  '300' => '300',
@@ -220,11 +220,11 @@ self::cloudflare_selectbox( $settings, array(
220
  '2592000' => '2592000',
221
  '31536000' => '31536000'
222
  ),
223
- 'description' => 'Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the visitor will have to complete a new challenge.',
224
  ) );
225
  self::cloudflare_selectbox( $settings, array(
226
  'key' => 'edge_cache_ttl',
227
- 'label' => 'Edge Cache TTL',
228
  'values' => array(
229
  '' => '',
230
  '300' => '300',
@@ -265,47 +265,47 @@ self::cloudflare_selectbox( $settings, array(
265
  ) );
266
  self::cloudflare_checkbox( $settings, array(
267
  'key' => 'minify_js',
268
- 'label' => 'Minify JS',
269
  'description' => 'Minify JavaScript files.',
270
  ) );
271
  self::cloudflare_checkbox( $settings, array(
272
  'key' => 'minify_css',
273
- 'label' => 'Minify CSS',
274
  'description' => 'Minify CSS files.',
275
  ) );
276
  self::cloudflare_checkbox( $settings, array(
277
  'key' => 'minify_html',
278
- 'label' => 'Minify HTML',
279
- 'description' => 'Minify HTML content.',
280
  ) );
281
  self::cloudflare_checkbox( $settings, array(
282
  'key' => 'server_side_exclude',
283
- 'label' => 'Server Side Exclude',
284
  'description' => 'If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do is wrap the content with CloudFlare SSE tags.',
285
  ) );
286
  self::cloudflare_checkbox( $settings, array(
287
  'key' => 'email_obfuscation',
288
- 'label' => 'Email obfuscation',
289
  'description' => 'Encrypt email adresses on your web page from bots, while keeping them visible to humans. ',
290
  ) );
291
  self::cloudflare_checkbox( $settings, array(
292
  'key' => 'response_buffering',
293
- 'label' => 'Response Buffering',
294
  'description' => 'CloudFlare may buffer the whole payload to deliver it at once to the client versus allowing it to be delivered in chunks.',
295
  ) );
296
  self::cloudflare_checkbox( $settings, array(
297
  'key' => 'prefetch_preload',
298
- 'label' => 'Prefetch Preload',
299
  'description' => 'CloudFlare will prefetch any URLs that are included in the response headers.',
300
  ) );
301
  self::cloudflare_checkbox( $settings, array(
302
  'key' => 'mobile_redirect',
303
- 'label' => 'Mobile Redirect',
304
  'description' => 'Automatically redirect visitors on mobile devices to a mobile-optimized subdomain',
305
  ) );
306
  self::cloudflare_checkbox( $settings, array(
307
  'key' => 'origin_error_page_pass_thru',
308
- 'label' => 'Enable Error Pages',
309
  'description' => 'CloudFlare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default CloudFlare error page. This does not apply to 522 errors and is limited to Enterprise Zones.',
310
  ) );
311
 
@@ -319,12 +319,12 @@ echo '<table class="form-table">';
319
 
320
  self::cloudflare_checkbox( $settings, array(
321
  'key' => 'hotlink_protection',
322
- 'label' => 'Hotlink Protection',
323
  'description' => 'When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site.',
324
  ) );
325
  self::cloudflare_checkbox( $settings, array(
326
  'key' => 'mirage',
327
- 'label' => 'Mirage',
328
  'description' => 'Automatically optimize image loading for website visitors on mobile devices',
329
  ) );
330
  self::cloudflare_selectbox( $settings, array(
@@ -349,7 +349,7 @@ echo '<table class="form-table">';
349
 
350
  self::cloudflare_selectbox( $settings, array(
351
  'key' => 'security_level',
352
- 'label' => __( 'Security Level:', 'w3-total-cache' ),
353
  'values' => array(
354
  '' => '',
355
  'essentially_off' => 'Off',
@@ -362,27 +362,27 @@ self::cloudflare_selectbox( $settings, array(
362
  ) );
363
  self::cloudflare_checkbox( $settings, array(
364
  'key' => 'browser_check',
365
- 'label' => 'Browser Integrity Check',
366
  'description' => 'Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors).',
367
  ) );
368
  self::cloudflare_checkbox( $settings, array(
369
  'key' => 'always_online',
370
- 'label' => 'Always Online',
371
  'description' => 'When enabled, Always Online will serve pages from our cache if your server is offline',
372
  ) );
373
  self::cloudflare_checkbox( $settings, array(
374
  'key' => 'waf',
375
- 'label' => 'Web Application Firewall',
376
- 'description' => 'The WAF examines HTTP requests to your website. It inspects both GET and POST requests and applies rules to help filter out illegitimate traffic from legitimate website visitors.'
377
  ) );
378
  self::cloudflare_checkbox( $settings, array(
379
  'key' => 'advanced_ddos',
380
- 'label' => 'Advanced DDOS Protection',
381
  'description' => 'Advanced protection from Distributed Denial of Service (DDoS) attacks on your website.',
382
  ) );
383
  self::cloudflare_textbox( $settings, array(
384
  'key' => 'max_upload',
385
- 'label' => 'Max Upload',
386
  'description' => 'Max size of file allowed for uploading',
387
  ) );
388
 
@@ -390,28 +390,23 @@ self::cloudflare_textbox( $settings, array(
390
  echo '</table>';
391
  self::cloudflare_button_save( 'protection' );
392
  Util_Ui::postbox_footer();
393
- Util_Ui::postbox_header( __( 'CloudFlare: IP', 'w3-total-cache' ), '', 'general' );
394
  echo '<table class="form-table">';
395
 
396
 
397
  self::cloudflare_checkbox( $settings, array(
398
  'key' => 'ip_geolocation',
399
- 'label' => 'IP Geolocation',
400
- 'description' => 'Enable IP Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you.',
401
  ) );
402
  self::cloudflare_checkbox( $settings, array(
403
  'key' => 'ipv6',
404
- 'label' => 'IPv6',
405
  'description' => 'Enable IPv6.',
406
  ) );
407
- self::cloudflare_checkbox( $settings, array(
408
- 'key' => 'pseudo_ipv4',
409
- 'label' => 'Pseudo IPv4',
410
- 'description' => 'Support for IPv6 addresses in legacy IPv4 applications.',
411
- ) );
412
  self::cloudflare_checkbox( $settings, array(
413
  'key' => 'true_client_ip_header',
414
- 'label' => 'True Client IP',
415
  'description' => 'Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin.',
416
  ) );
417
 
@@ -419,36 +414,36 @@ self::cloudflare_checkbox( $settings, array(
419
  echo '</table>';
420
  self::cloudflare_button_save( 'ip' );
421
  Util_Ui::postbox_footer();
422
- Util_Ui::postbox_header( __( 'CloudFlare: SSL', 'w3-total-cache' ), '', 'general' );
423
  echo '<table class="form-table">';
424
 
425
 
426
  self::cloudflare_selectbox( $settings, array(
427
  'key' => 'ssl',
428
- 'label' => 'SSL',
429
  'values' => array(
430
  '' => '',
431
  'off' => 'Off',
432
- 'flexible' => 'Flexible (https to end-user only)',
433
  'full' => 'Full (https everywhere)',
434
  'full_strict' => 'Strict'
435
  ),
436
- 'description' => 'SSL encrypts your visitor\'s connection and safeguards credit card numbers and other personal data to and from your website.',
437
  ) );
438
  self::cloudflare_checkbox( $settings, array(
439
  'key' => 'security_header',
440
- 'label' => 'Security Header (HSTS)',
441
- 'description' => 'Enables or disables HSTS header.',
442
  ) );
443
  self::cloudflare_checkbox( $settings, array(
444
  'key' => 'tls_1_2_only',
445
- 'label' => 'TLS 1.2 Only',
446
- 'description' => 'Enable Crypto TLS 1.2 feature for this zone and prevent use of previous versions.',
447
  ) );
448
  self::cloudflare_checkbox( $settings, array(
449
  'key' => 'tls_client_auth',
450
- 'label' => 'TLS Client Auth',
451
- 'description' => 'TLS Client Auth requires CloudFlare to connect to your origin server using a client certificate',
452
  ) );
453
 
454
  echo '</table>';
77
  <?php if ( $state == 'not_configured' ): ?>
78
  <table class="form-table">
79
  <tr><td colspan="2">
80
+ Authenticate your account in order to access settings.
81
  </td></tr>
82
  </table>
83
  <?php endif ?>
111
  )
112
  );
113
 
114
+ Util_Ui::config_item( array(
115
+ 'key' => array( 'cloudflare', 'widget_cache_mins' ),
116
+ 'label' => __( 'Cache time:', 'w3-total-cache' ),
117
+ 'control' => 'textbox',
118
+ 'description' =>
119
+ 'How many minutes data retrieved from CloudFlare:' .
120
+ 'should be stored. Minimum is 1 minute.'
121
+ )
122
+ );
123
+
124
+ Util_Ui::config_item( array(
125
+ 'key' => array( 'cloudflare', 'pagecache' ),
126
+ 'label' => __( 'Page caching:', 'w3-total-cache' ),
127
+ 'control' => 'checkbox',
128
+ 'checkbox_label' => 'Flush CloudFlare on Post Modifications:',
129
+ 'description' =>
130
+ 'Enable when you have html pages cached on CloudFlare level.'
131
+ )
132
+ );
133
 
134
  ?>
135
  </table>
163
  ) );
164
  self::cloudflare_checkbox( $settings, array(
165
  'key' => 'sort_query_string_for_cache',
166
+ 'label' => 'Query string sorting:',
167
  'description' => 'CloudFlare will treat files with the same query strings as the same file in cache, regardless of the order of the query strings.',
168
  ) );
169
  self::cloudflare_selectbox( $settings, array(
170
  'key' => 'browser_cache_ttl',
171
+ 'label' => 'Browser cache <acronym title="Time-to-Live ">TTL</acronym>:',
172
  'values' => array(
173
  '' => '',
174
  '30' => '30',
198
  '16070400' => '16070400',
199
  '31536000' => '31536000'
200
  ),
201
+ 'description' => 'Browser cache <acronym title="Time-to-Live ">TTL</acronym> (in seconds) specifies how long CloudFlare-cached resources will remain on your visitors\' computers.',
202
  ) );
203
  self::cloudflare_selectbox( $settings, array(
204
  'key' => 'challenge_ttl',
205
+ 'label' => 'Challenge <acronym title="Time-to-Live ">TTL</acronym>:',
206
  'values' => array(
207
  '' => '',
208
  '300' => '300',
220
  '2592000' => '2592000',
221
  '31536000' => '31536000'
222
  ),
223
+ 'description' => 'Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the <acronym title="Time-to-Live ">TTL</acronym> has expired the visitor will have to complete a new challenge.',
224
  ) );
225
  self::cloudflare_selectbox( $settings, array(
226
  'key' => 'edge_cache_ttl',
227
+ 'label' => 'Edge cache TTL:',
228
  'values' => array(
229
  '' => '',
230
  '300' => '300',
265
  ) );
266
  self::cloudflare_checkbox( $settings, array(
267
  'key' => 'minify_js',
268
+ 'label' => 'Minify <acronym title="JavaScript">JS</acronym>:',
269
  'description' => 'Minify JavaScript files.',
270
  ) );
271
  self::cloudflare_checkbox( $settings, array(
272
  'key' => 'minify_css',
273
+ 'label' => 'Minify <acronym title="Cascading Style Sheet">CSS</acronym>:',
274
  'description' => 'Minify CSS files.',
275
  ) );
276
  self::cloudflare_checkbox( $settings, array(
277
  'key' => 'minify_html',
278
+ 'label' => 'Minify <acronym title="HyperText Markup Language">HTML</acronym>:',
279
+ 'description' => 'Minify <acronym title="HyperText Markup Language">HTML</acronym> content.',
280
  ) );
281
  self::cloudflare_checkbox( $settings, array(
282
  'key' => 'server_side_exclude',
283
+ 'label' => 'Server side exclude:',
284
  'description' => 'If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do is wrap the content with CloudFlare SSE tags.',
285
  ) );
286
  self::cloudflare_checkbox( $settings, array(
287
  'key' => 'email_obfuscation',
288
+ 'label' => 'Email obfuscation:',
289
  'description' => 'Encrypt email adresses on your web page from bots, while keeping them visible to humans. ',
290
  ) );
291
  self::cloudflare_checkbox( $settings, array(
292
  'key' => 'response_buffering',
293
+ 'label' => 'Response buffering"',
294
  'description' => 'CloudFlare may buffer the whole payload to deliver it at once to the client versus allowing it to be delivered in chunks.',
295
  ) );
296
  self::cloudflare_checkbox( $settings, array(
297
  'key' => 'prefetch_preload',
298
+ 'label' => 'Prefetch preload:',
299
  'description' => 'CloudFlare will prefetch any URLs that are included in the response headers.',
300
  ) );
301
  self::cloudflare_checkbox( $settings, array(
302
  'key' => 'mobile_redirect',
303
+ 'label' => 'Mobile redirect:',
304
  'description' => 'Automatically redirect visitors on mobile devices to a mobile-optimized subdomain',
305
  ) );
306
  self::cloudflare_checkbox( $settings, array(
307
  'key' => 'origin_error_page_pass_thru',
308
+ 'label' => 'Enable error pages:',
309
  'description' => 'CloudFlare will proxy customer error pages on any 502,504 errors on origin server instead of showing a default CloudFlare error page. This does not apply to 522 errors and is limited to Enterprise Zones.',
310
  ) );
311
 
319
 
320
  self::cloudflare_checkbox( $settings, array(
321
  'key' => 'hotlink_protection',
322
+ 'label' => 'Hotlink protection:',
323
  'description' => 'When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site.',
324
  ) );
325
  self::cloudflare_checkbox( $settings, array(
326
  'key' => 'mirage',
327
+ 'label' => 'Mirage:',
328
  'description' => 'Automatically optimize image loading for website visitors on mobile devices',
329
  ) );
330
  self::cloudflare_selectbox( $settings, array(
349
 
350
  self::cloudflare_selectbox( $settings, array(
351
  'key' => 'security_level',
352
+ 'label' => __( 'Security level:', 'w3-total-cache' ),
353
  'values' => array(
354
  '' => '',
355
  'essentially_off' => 'Off',
362
  ) );
363
  self::cloudflare_checkbox( $settings, array(
364
  'key' => 'browser_check',
365
+ 'label' => 'Browser integrity check:',
366
  'description' => 'Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors).',
367
  ) );
368
  self::cloudflare_checkbox( $settings, array(
369
  'key' => 'always_online',
370
+ 'label' => 'Always online:',
371
  'description' => 'When enabled, Always Online will serve pages from our cache if your server is offline',
372
  ) );
373
  self::cloudflare_checkbox( $settings, array(
374
  'key' => 'waf',
375
+ 'label' => 'Web application firewall:',
376
+ 'description' => 'The Web Application Firewall (WAF) examines HTTP requests to your website. It inspects both GET and POST requests and applies rules to help filter out illegitimate traffic from legitimate website visitors.'
377
  ) );
378
  self::cloudflare_checkbox( $settings, array(
379
  'key' => 'advanced_ddos',
380
+ 'label' => 'Advanced <acronym title="Distributed Denial of Service">DDoS</acronym> protection:',
381
  'description' => 'Advanced protection from Distributed Denial of Service (DDoS) attacks on your website.',
382
  ) );
383
  self::cloudflare_textbox( $settings, array(
384
  'key' => 'max_upload',
385
+ 'label' => 'Max upload:',
386
  'description' => 'Max size of file allowed for uploading',
387
  ) );
388
 
390
  echo '</table>';
391
  self::cloudflare_button_save( 'protection' );
392
  Util_Ui::postbox_footer();
393
+ Util_Ui::postbox_header( __( 'CloudFlare: <acronym title="Internet Protocol">IP</acronym>', 'w3-total-cache' ), '', 'general' );
394
  echo '<table class="form-table">';
395
 
396
 
397
  self::cloudflare_checkbox( $settings, array(
398
  'key' => 'ip_geolocation',
399
+ 'label' => '<acronym title="Internet Protocol">IP</acronym> geolocation:',
400
+ 'description' => 'Enable <acronym title="Internet Protocol">IP</acronym> Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you.',
401
  ) );
402
  self::cloudflare_checkbox( $settings, array(
403
  'key' => 'ipv6',
404
+ 'label' => 'IPv6:',
405
  'description' => 'Enable IPv6.',
406
  ) );
 
 
 
 
 
407
  self::cloudflare_checkbox( $settings, array(
408
  'key' => 'true_client_ip_header',
409
+ 'label' => 'True client IP:',
410
  'description' => 'Allows customer to continue to use True Client IP (Akamai feature) in the headers we send to the origin.',
411
  ) );
412
 
414
  echo '</table>';
415
  self::cloudflare_button_save( 'ip' );
416
  Util_Ui::postbox_footer();
417
+ Util_Ui::postbox_header( __( 'CloudFlare: <acronym title="Secure Sockets Layer">SSL</acronym>', 'w3-total-cache' ), '', 'general' );
418
  echo '<table class="form-table">';
419
 
420
 
421
  self::cloudflare_selectbox( $settings, array(
422
  'key' => 'ssl',
423
+ 'label' => '<acronym title="Secure Sockets Layer">SSL</acronym>:',
424
  'values' => array(
425
  '' => '',
426
  'off' => 'Off',
427
+ 'flexible' => 'Flexible (HTTPS to end-user only)',
428
  'full' => 'Full (https everywhere)',
429
  'full_strict' => 'Strict'
430
  ),
431
+ 'description' => '<acronym title="Secure Sockets Layer">SSL</acronym> encrypts your visitor\'s connection and safeguards credit card numbers and other personal data to and from your website.',
432
  ) );
433
  self::cloudflare_checkbox( $settings, array(
434
  'key' => 'security_header',
435
+ 'label' => 'Security header (<acronym title="Secure Sockets Layer">SSL</acronym>):',
436
+ 'description' => 'Enables or disables <acronym title="Secure Sockets Layer">SSL</acronym> header.',
437
  ) );
438
  self::cloudflare_checkbox( $settings, array(
439
  'key' => 'tls_1_2_only',
440
+ 'label' => '<acronym title="Transport Layer Security">TLS</acronym> 1.2 only:',
441
+ 'description' => 'Enable Crypto <acronym title="Transport Layer Security">TLS</acronym> 1.2 feature for this zone and prevent use of previous versions.',
442
  ) );
443
  self::cloudflare_checkbox( $settings, array(
444
  'key' => 'tls_client_auth',
445
+ 'label' => '<acronym title="Transport Layer Security">TLS</acronym> client auth:',
446
+ 'description' => '<acronym title="Transport Layer Security">TLS</acronym> Client authentication requires CloudFlare to connect to your origin server using a client certificate',
447
  ) );
448
 
449
  echo '</table>';
Extension_CloudFlare_Plugin.php CHANGED
@@ -134,7 +134,11 @@ class Extension_CloudFlare_Plugin {
134
  array( 'cloudflare', 'timelimit.api_request' ) )
135
  )
136
  );
137
- $api->external_event( 'WP_SPAM', json_encode( $value ) );
 
 
 
 
138
  }
139
  }
140
 
134
  array( 'cloudflare', 'timelimit.api_request' ) )
135
  )
136
  );
137
+
138
+ try {
139
+ $api->external_event( 'WP_SPAM', json_encode( $value ) );
140
+ } catch ( \Exception $ex ) {
141
+ }
142
  }
143
  }
144
 
Extension_CloudFlare_Plugin_Admin.php CHANGED
@@ -32,6 +32,7 @@ class Extension_CloudFlare_Plugin_Admin {
32
  'author_uri' => 'https://www.w3-edge.com/',
33
  'extension_uri' => 'https://www.w3-edge.com/',
34
  'extension_id' => 'cloudflare',
 
35
  'version' => '0.3',
36
  'enabled' => true,
37
  'requirements' => implode( ', ', $message ),
32
  'author_uri' => 'https://www.w3-edge.com/',
33
  'extension_uri' => 'https://www.w3-edge.com/',
34
  'extension_id' => 'cloudflare',
35
+ 'settings_exists' => true,
36
  'version' => '0.3',
37
  'enabled' => true,
38
  'requirements' => implode( ', ', $message ),
Extension_CloudFlare_Popup.php CHANGED
@@ -34,7 +34,10 @@ class Extension_CloudFlare_Popup {
34
  public function w3tc_ajax_extension_cloudflare_intro_done() {
35
  $this->_render_extension_cloudflare_zones( array(
36
  'email' => $_REQUEST['email'],
37
- 'key' => $_REQUEST['key'] ) );
 
 
 
38
  }
39
 
40
 
@@ -42,17 +45,24 @@ class Extension_CloudFlare_Popup {
42
  private function _render_extension_cloudflare_zones( $details ) {
43
  $email = $details['email'];
44
  $key = $details['key'];
 
45
 
46
  $details = array(
47
  'email' => $email,
48
- 'key' => $key
 
 
 
49
  );
50
 
51
  try {
52
  $api = new Extension_CloudFlare_Api( array(
53
  'email' => $email,
54
  'key' => $key ) );
55
- $zones = $api->zones();
 
 
 
56
  } catch ( \Exception $ex ) {
57
  $details['error_message'] = 'Can\'t authenticate: ' .
58
  $ex->getMessage();
@@ -60,8 +70,6 @@ class Extension_CloudFlare_Popup {
60
  exit();
61
  }
62
 
63
- $details['zones'] = $zones;
64
-
65
  include W3TC_DIR . '/Extension_CloudFlare_Popup_View_Zones.php';
66
  exit();
67
  }
@@ -83,15 +91,13 @@ class Extension_CloudFlare_Popup {
83
 
84
  $zone_name = '';
85
 
 
86
  try {
87
  $api = new Extension_CloudFlare_Api( array(
88
  'email' => $email,
89
  'key' => $key ) );
90
- $zones = $api->zones();
91
- foreach ( $zones as $z ) {
92
- if ( $z['id'] == $zone_id )
93
- $zone_name = $z['name'];
94
- }
95
  } catch ( \Exception $ex ) {
96
  $details['error_message'] = 'Can\'t authenticate: ' .
97
  $ex->getMessage();
34
  public function w3tc_ajax_extension_cloudflare_intro_done() {
35
  $this->_render_extension_cloudflare_zones( array(
36
  'email' => $_REQUEST['email'],
37
+ 'key' => $_REQUEST['key'],
38
+ 'page' => empty( $_REQUEST['page'] ) ? 1 : (int) $_REQUEST['page']
39
+ )
40
+ );
41
  }
42
 
43
 
45
  private function _render_extension_cloudflare_zones( $details ) {
46
  $email = $details['email'];
47
  $key = $details['key'];
48
+ $page = $details['page'];
49
 
50
  $details = array(
51
  'email' => $email,
52
+ 'key' => $key,
53
+ 'page' => $page,
54
+ 'zones' => array(),
55
+ 'total_pages' => 1
56
  );
57
 
58
  try {
59
  $api = new Extension_CloudFlare_Api( array(
60
  'email' => $email,
61
  'key' => $key ) );
62
+ $r = $api->zones( $page );
63
+ $details['zones'] = $r['result'];
64
+
65
+ $details['total_pages'] = $r['result_info']['total_pages'];
66
  } catch ( \Exception $ex ) {
67
  $details['error_message'] = 'Can\'t authenticate: ' .
68
  $ex->getMessage();
70
  exit();
71
  }
72
 
 
 
73
  include W3TC_DIR . '/Extension_CloudFlare_Popup_View_Zones.php';
74
  exit();
75
  }
91
 
92
  $zone_name = '';
93
 
94
+ // get zone name
95
  try {
96
  $api = new Extension_CloudFlare_Api( array(
97
  'email' => $email,
98
  'key' => $key ) );
99
+ $zone = $api->zone($zone_id);
100
+ $zone_name = $zone['name'];
 
 
 
101
  } catch ( \Exception $ex ) {
102
  $details['error_message'] = 'Can\'t authenticate: ' .
103
  $ex->getMessage();
Extension_CloudFlare_Popup_View_Zones.php CHANGED
@@ -10,18 +10,20 @@ if ( !defined( 'W3TC' ) )
10
  Util_Ui::hidden( '', 'w3tc_action', 'extension_cloudflare_zones_done' );
11
  Util_Ui::hidden( '', 'email', $details['email'] );
12
  Util_Ui::hidden( '', 'key', $details['key'] );
 
13
  echo Util_Ui::nonce_field( 'w3tc' );
14
 
15
  ?>
16
  <?php
17
  if ( isset( $details['error_message'] ) )
18
  echo '<div class="error">' . $details['error_message'] . '</div>';
 
19
  ?>
20
  <div class="metabox-holder">
21
  <?php Util_Ui::postbox_header( __( 'Select zone', 'w3-total-cache' ) ); ?>
22
  <table class="form-table">
23
  <tr>
24
- <th>Zone:</td>
25
  <td>
26
  <?php foreach ( $details['zones'] as $z ): ?>
27
  <label>
@@ -31,6 +33,20 @@ if ( isset( $details['error_message'] ) )
31
  </label><br />
32
  <?php endforeach ?>
33
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  </table>
35
 
36
  <p class="submit">
10
  Util_Ui::hidden( '', 'w3tc_action', 'extension_cloudflare_zones_done' );
11
  Util_Ui::hidden( '', 'email', $details['email'] );
12
  Util_Ui::hidden( '', 'key', $details['key'] );
13
+ Util_Ui::hidden( '', 'page', '' );
14
  echo Util_Ui::nonce_field( 'w3tc' );
15
 
16
  ?>
17
  <?php
18
  if ( isset( $details['error_message'] ) )
19
  echo '<div class="error">' . $details['error_message'] . '</div>';
20
+
21
  ?>
22
  <div class="metabox-holder">
23
  <?php Util_Ui::postbox_header( __( 'Select zone', 'w3-total-cache' ) ); ?>
24
  <table class="form-table">
25
  <tr>
26
+ <td>Zone:</td>
27
  <td>
28
  <?php foreach ( $details['zones'] as $z ): ?>
29
  <label>
33
  </label><br />
34
  <?php endforeach ?>
35
  </tr>
36
+ <tr>
37
+ <td></td>
38
+ <td>
39
+ <?php
40
+ if ( $details['total_pages'] > 1 ):
41
+ for ( $page = 1; $page <= $details['total_pages']; $page++ ):
42
+ if ( $page == $details['page']):
43
+ echo $page;
44
+ else: ?>
45
+ <a href="#" class="w3tc_cloudflare_zone_page" data-page="<?php echo $page ?>"><?php echo $page ?></a>
46
+ <?php endif ?>
47
+ &nbsp;
48
+ <?php endfor ?>
49
+ <?php endif ?>
50
  </table>
51
 
52
  <p class="submit">
Extension_CloudFlare_Widget.php CHANGED
@@ -20,7 +20,8 @@ class Extension_CloudFlare_Widget {
20
 
21
 
22
  function w3tc_widget_setup() {
23
- Util_Widget::add( 'w3tc_cloudflare', __( 'CloudFlare', 'w3-total-cache' ),
 
24
  array( $this, 'widget_form' ),
25
  Util_Ui::admin_url( 'admin.php?page=w3tc_general#cloudflare' ),
26
  'normal' );
20
 
21
 
22
  function w3tc_widget_setup() {
23
+ Util_Widget::add( 'w3tc_cloudflare',
24
+ '<div class="w3tc_cloudflare_widget_logo"></div>',
25
  array( $this, 'widget_form' ),
26
  Util_Ui::admin_url( 'admin.php?page=w3tc_general#cloudflare' ),
27
  'normal' );
Extension_CloudFlare_Widget_Logo.png ADDED
Binary file
Extension_CloudFlare_Widget_View.css CHANGED
@@ -29,4 +29,12 @@ td.cloudflare_td_value {
29
  padding-right: 8px;
30
  text-align: right;
31
  color: #333;
 
 
 
 
 
 
 
 
32
  }
29
  padding-right: 8px;
30
  text-align: right;
31
  color: #333;
32
+ }
33
+
34
+ .w3tc_cloudflare_widget_logo {
35
+ float: left;
36
+ width: 220px;
37
+ height: 35px;
38
+ background: url("Extension_CloudFlare_Widget_Logo.png") no-repeat;
39
+ background-size: contain;
40
  }
Extension_FeedBurner_Page_View.php CHANGED
@@ -26,8 +26,8 @@ else
26
  Util_Ui::config_item( array(
27
  'key' => array( 'feedburner', 'urls' ),
28
  'control' => 'textarea',
29
- 'label' => __( 'Additional URLs:', 'w3-total-cache' ),
30
- 'description' => __( 'Specify any additional feed URLs to ping on FeedBurner.',
31
  'w3-total-cache' )
32
  ) )
33
  ?>
26
  Util_Ui::config_item( array(
27
  'key' => array( 'feedburner', 'urls' ),
28
  'control' => 'textarea',
29
+ 'label' => __( 'Additional <acronym title="Uniform Resource Locator">URL</acronym>s:', 'w3-total-cache' ),
30
+ 'description' => __( 'Specify any additional feed <acronym title="Uniform Resource Locator">URL</acronym>s to ping on FeedBurner.',
31
  'w3-total-cache' )
32
  ) )
33
  ?>
Extension_FeedBurner_Plugin_Admin.php CHANGED
@@ -44,6 +44,7 @@ class Extension_FeedBurner_Plugin_Admin {
44
  'author_uri' => 'https://www.w3-edge.com/',
45
  'extension_uri' => 'https://www.w3-edge.com/',
46
  'extension_id' => 'feedburner',
 
47
  'version' => '0.1',
48
  'enabled' => true,
49
  'requirements' => implode( ', ', $message ),
44
  'author_uri' => 'https://www.w3-edge.com/',
45
  'extension_uri' => 'https://www.w3-edge.com/',
46
  'extension_id' => 'feedburner',
47
+ 'settings_exists' => true,
48
  'version' => '0.1',
49
  'enabled' => true,
50
  'requirements' => implode( ', ', $message ),
Extension_FragmentCache_Api.php CHANGED
@@ -71,8 +71,7 @@ function w3tc_fragmentcache_start( $id, $group = '', $hook = '' ) {
71
  } else {
72
  echo $fragment;
73
  if ( $hook ) {
74
- global $wp_filter;
75
- $wp_filter[$hook] = array();
76
  }
77
  return true;
78
  }
@@ -93,8 +92,7 @@ function w3tc_fragmentcache_filter_start( $id, $group = '', $hook = '', $data )
93
  $fragment = w3tc_fragmentcache_get( $id, $group );
94
  if ( false !== $fragment ) {
95
  if ( $hook ) {
96
- global $wp_filter;
97
- $wp_filter[$hook] = array();
98
  }
99
  return $fragment;
100
  }
71
  } else {
72
  echo $fragment;
73
  if ( $hook ) {
74
+ remove_all_filters($hook);
 
75
  }
76
  return true;
77
  }
92
  $fragment = w3tc_fragmentcache_get( $id, $group );
93
  if ( false !== $fragment ) {
94
  if ( $hook ) {
95
+ remove_all_filters($hook);
 
96
  }
97
  return $fragment;
98
  }
Extension_FragmentCache_Plugin_Admin.php CHANGED
@@ -22,6 +22,7 @@ class Extension_FragmentCache_Plugin_Admin {
22
  'author_uri' => 'https://www.w3-edge.com/',
23
  'extension_uri' => 'https://www.w3-edge.com/',
24
  'extension_id' => 'fragmentcache',
 
25
  'version' => '1.0',
26
  'enabled' => empty( $requirements ),
27
  'requirements' => implode( ', ', $requirements ),
22
  'author_uri' => 'https://www.w3-edge.com/',
23
  'extension_uri' => 'https://www.w3-edge.com/',
24
  'extension_id' => 'fragmentcache',
25
+ 'settings_exists' => true,
26
  'version' => '1.0',
27
  'enabled' => empty( $requirements ),
28
  'requirements' => implode( ', ', $requirements ),
Extension_FragmentCache_WpObjectCache.php CHANGED
@@ -163,7 +163,7 @@ class Extension_FragmentCache_WpObjectCache {
163
  }
164
 
165
  if ( is_object( $value ) ) {
166
- $value = clone( $value );
167
  }
168
 
169
  $this->cache[$fragment_group][$key] = $value;
@@ -214,7 +214,7 @@ class Extension_FragmentCache_WpObjectCache {
214
  $key = $this->_get_cache_key( $id );
215
 
216
  if ( is_object( $data ) ) {
217
- $data = clone( $data );
218
  }
219
 
220
  list( $fragment_group, $fragment_group_expiration, $fragment_group_global ) =
163
  }
164
 
165
  if ( is_object( $value ) ) {
166
+ $value = clone $value;
167
  }
168
 
169
  $this->cache[$fragment_group][$key] = $value;
214
  $key = $this->_get_cache_key( $id );
215
 
216
  if ( is_object( $data ) ) {
217
+ $data = clone $data;
218
  }
219
 
220
  list( $fragment_group, $fragment_group_expiration, $fragment_group_global ) =
Extension_Genesis_Plugin_Admin.php CHANGED
@@ -42,6 +42,7 @@ class Extension_Genesis_Plugin_Admin {
42
  'author_uri' => 'https://www.w3-edge.com/',
43
  'extension_uri' => 'https://www.w3-edge.com/',
44
  'extension_id' => 'genesis.theme',
 
45
  'version' => '0.1',
46
  'enabled' => empty( $requirements ),
47
  'requirements' => implode( ', ', $requirements ),
@@ -121,7 +122,7 @@ class Extension_Genesis_Plugin_Admin {
121
  $extension_id = 'genesis.theme';
122
 
123
  $notes[$extension_id] = sprintf(
124
- __( 'It appears that activating the <a href="%s">Genesis Theme</a> extension for W3 Total Cache will be helpful for your site. <a href="%s">Click here</a> to try it. %s',
125
  'w3-total-cache' ),
126
  Util_Ui::admin_url( 'admin.php?page=w3tc_extensions#' . $extension_id ),
127
  Util_Ui::url( array( 'w3tc_extensions_activate' => $extension_id ) ),
42
  'author_uri' => 'https://www.w3-edge.com/',
43
  'extension_uri' => 'https://www.w3-edge.com/',
44
  'extension_id' => 'genesis.theme',
45
+ 'settings_exists' => true,
46
  'version' => '0.1',
47
  'enabled' => empty( $requirements ),
48
  'requirements' => implode( ', ', $requirements ),
122
  $extension_id = 'genesis.theme';
123
 
124
  $notes[$extension_id] = sprintf(
125
+ __( 'Activating the <a href="%s">Genesis Theme</a> extension for W3 Total Cache may be helpful for your site. <a href="%s">Click here</a> to try it. %s',
126
  'w3-total-cache' ),
127
  Util_Ui::admin_url( 'admin.php?page=w3tc_extensions#' . $extension_id ),
128
  Util_Ui::url( array( 'w3tc_extensions_activate' => $extension_id ) ),
Extension_NewRelic_Page_View_Apm.php CHANGED
@@ -151,7 +151,7 @@ _e( 'Select user roles that <acronym title="Real User Monitoring">RUM</acronym>
151
  <tr>
152
  <th>
153
  <label for="newrelic_include_rum"><?php
154
- _e( 'Include <acronym title="Real User Monitoring">RUM</acronym> in compressed or cached pages', 'w3-total-cache' )
155
  ?></label>
156
  </th>
157
  <td>
@@ -170,7 +170,7 @@ _e( 'Include <acronym title="Real User Monitoring">RUM</acronym> in compressed o
170
  <tr>
171
  <th>
172
  <label for="newrelic_use_php_function"><?php
173
- _e( 'Use PHP function to set application name:', 'w3-total-cache' )
174
  ?></label></th>
175
  <td>
176
  <?php if ( Util_Environment::is_wpmu() ): ?>
@@ -189,7 +189,7 @@ _e( 'Use PHP function to set application name:', 'w3-total-cache' )
189
  <tr>
190
  <th>
191
  <label for="newrelic_enable_xmit"><?php
192
- _e( 'Enable XMIT', 'w3-total-cache' )
193
  ?></label>
194
  </th>
195
  <td><input name="" type="hidden" value="0" />
151
  <tr>
152
  <th>
153
  <label for="newrelic_include_rum"><?php
154
+ _e( 'Include <acronym title="Real User Monitoring">RUM</acronym> in compressed or cached pages:', 'w3-total-cache' )
155
  ?></label>
156
  </th>
157
  <td>
170
  <tr>
171
  <th>
172
  <label for="newrelic_use_php_function"><?php
173
+ _e( 'Use <acronym title=\"Hypertext Preprocessor\">PHP</acronym> function to set application name:', 'w3-total-cache' )
174
  ?></label></th>
175
  <td>
176
  <?php if ( Util_Environment::is_wpmu() ): ?>
189
  <tr>
190
  <th>
191
  <label for="newrelic_enable_xmit"><?php
192
+ _e( 'Enable XMIT:', 'w3-total-cache' )
193
  ?></label>
194
  </th>
195
  <td><input name="" type="hidden" value="0" />
Extension_NewRelic_Plugin_Admin.php CHANGED
@@ -21,6 +21,7 @@ class Extension_NewRelic_Plugin_Admin {
21
  'author_uri' => 'https://www.w3-edge.com/',
22
  'extension_uri' => 'https://www.w3-edge.com/',
23
  'extension_id' => 'newrelic',
 
24
  'version' => '1.0',
25
  'enabled' => true,
26
  'requirements' => '',
21
  'author_uri' => 'https://www.w3-edge.com/',
22
  'extension_uri' => 'https://www.w3-edge.com/',
23
  'extension_id' => 'newrelic',
24
+ 'settings_exists' => true,
25
  'version' => '1.0',
26
  'enabled' => true,
27
  'requirements' => '',
Extension_WordPressSeo_Plugin_Admin.php CHANGED
@@ -44,13 +44,14 @@ class Extension_WordPressSeo_Plugin_Admin {
44
  $message[] = 'Optimizes "Yoast SEO" plugin, which is not active';
45
 
46
  $extensions['wordpress-seo'] = array (
47
- 'name' => 'WordPress SEO by Yoast',
48
  'author' => 'W3 EDGE',
49
  'description' => __( 'Configures W3 Total Cache to comply with Yoast SEO requirements automatically.', 'w3-total-cache' ),
50
 
51
  'author_uri' => 'https://www.w3-edge.com/',
52
  'extension_uri' => 'https://www.w3-edge.com/',
53
  'extension_id' => 'wordpress-seo',
 
54
  'version' => '0.1',
55
  'enabled' => self::criteria_match(),
56
  'requirements' => implode( ', ', $message ),
@@ -96,7 +97,7 @@ class Extension_WordPressSeo_Plugin_Admin {
96
  $extension_id = 'wordpress-seo';
97
 
98
  $notes[$extension_id] = sprintf(
99
- __( 'It appears that activating the <a href="%s">Yoast SEO</a> extension for W3 Total Cache will be helpful for your site. <a class="button" href="%s">Click here</a> to try it. %s',
100
  'w3-total-cache' ),
101
  Util_Ui::admin_url( 'admin.php?page=w3tc_extensions#' . $extension_id ),
102
  Util_Ui::url( array( 'w3tc_extensions_activate' => $extension_id ) ),
44
  $message[] = 'Optimizes "Yoast SEO" plugin, which is not active';
45
 
46
  $extensions['wordpress-seo'] = array (
47
+ 'name' => 'Yoast SEO',
48
  'author' => 'W3 EDGE',
49
  'description' => __( 'Configures W3 Total Cache to comply with Yoast SEO requirements automatically.', 'w3-total-cache' ),
50
 
51
  'author_uri' => 'https://www.w3-edge.com/',
52
  'extension_uri' => 'https://www.w3-edge.com/',
53
  'extension_id' => 'wordpress-seo',
54
+ 'settings_exists' => true,
55
  'version' => '0.1',
56
  'enabled' => self::criteria_match(),
57
  'requirements' => implode( ', ', $message ),
97
  $extension_id = 'wordpress-seo';
98
 
99
  $notes[$extension_id] = sprintf(
100
+ __( 'Activating the <a href="%s">Yoast SEO</a> extension for W3 Total Cache may be helpful for your site. <a class="button" href="%s">Click here</a> to try it. %s',
101
  'w3-total-cache' ),
102
  Util_Ui::admin_url( 'admin.php?page=w3tc_extensions#' . $extension_id ),
103
  Util_Ui::url( array( 'w3tc_extensions_activate' => $extension_id ) ),
Extension_Wpml_Plugin_Admin.php CHANGED
@@ -19,7 +19,7 @@ class Extension_Wpml_Plugin_Admin {
19
 
20
  if ( !$state->get_boolean( 'wpml.hide_note_language_negotiation_type' ) ) {
21
  $notes[] = sprintf(
22
- __( 'W3 Total Cache\'s Page caching can not work effectively when WPML Language URL format "Language name added as a parameter" used. Please consider another URL format, you may change it at WPML -&gt; Languages page. %s' ,
23
  'w3-total-cache' ),
24
  Util_Ui::button_hide_note2( array(
25
  'w3tc_default_config_state' => 'y',
@@ -39,7 +39,7 @@ class Extension_Wpml_Plugin_Admin {
39
 
40
  $requirements = array();
41
  if ( !$base_plugin_active )
42
- $requirements[] = 'Ensure "WPML" plugin compatibility, which is not active';
43
  if ( empty( $requirements ) && !Util_Environment::is_w3tc_pro( $config ) ) {
44
  $enabled = false;
45
  $requirements[] = 'Available after <a href="#" class="button-buy-plugin">upgrade</a>';
@@ -47,13 +47,14 @@ class Extension_Wpml_Plugin_Admin {
47
  }
48
 
49
  $extensions['wpml'] = array(
50
- 'name' => 'WPML.org',
51
  'author' => 'W3 EDGE',
52
- 'description' => __( 'Configures W3 Total Cache to comply with WPML requirements automatically.',
53
  'w3-total-cache' ),
54
  'author_uri' => 'https://www.w3-edge.com/',
55
  'extension_uri' => 'https://www.w3-edge.com/',
56
  'extension_id' => 'wpml',
 
57
  'version' => '0.1',
58
  'enabled' => $enabled,
59
  'disabled_message' => $disabled_message,
@@ -114,7 +115,7 @@ class Extension_Wpml_Plugin_Admin {
114
  }
115
 
116
  $notes[$extension_id] = sprintf(
117
- __( 'It appears that activating the <a href="%s">WPML</a> extension for W3 Total Cache will be helpful for your site. %s%s',
118
  'w3-total-cache' ),
119
  Util_Ui::admin_url( 'admin.php?page=w3tc_extensions#' . $extension_id ),
120
  $activate_text,
19
 
20
  if ( !$state->get_boolean( 'wpml.hide_note_language_negotiation_type' ) ) {
21
  $notes[] = sprintf(
22
+ __( 'W3 Total Cache\'s Page caching cannot work effectively when WPML Language URL formatis "Language name added as a parameter" used. Please consider another URL format. Visit the WPML -&gt; Languages settings. %s' ,
23
  'w3-total-cache' ),
24
  Util_Ui::button_hide_note2( array(
25
  'w3tc_default_config_state' => 'y',
39
 
40
  $requirements = array();
41
  if ( !$base_plugin_active )
42
+ $requirements[] = 'Ensure "WPML" plugin compatibility, which is not currently active.';
43
  if ( empty( $requirements ) && !Util_Environment::is_w3tc_pro( $config ) ) {
44
  $enabled = false;
45
  $requirements[] = 'Available after <a href="#" class="button-buy-plugin">upgrade</a>';
47
  }
48
 
49
  $extensions['wpml'] = array(
50
+ 'name' => 'WPML',
51
  'author' => 'W3 EDGE',
52
+ 'description' => __( 'Improves page caching interoperability with WPML.',
53
  'w3-total-cache' ),
54
  'author_uri' => 'https://www.w3-edge.com/',
55
  'extension_uri' => 'https://www.w3-edge.com/',
56
  'extension_id' => 'wpml',
57
+ 'settings_exists' => false,
58
  'version' => '0.1',
59
  'enabled' => $enabled,
60
  'disabled_message' => $disabled_message,
115
  }
116
 
117
  $notes[$extension_id] = sprintf(
118
+ __( 'Activating the <a href="%s">WPML</a> extension for W3 Total Cache may be helpful for your site. %s%s',
119
  'w3-total-cache' ),
120
  Util_Ui::admin_url( 'admin.php?page=w3tc_extensions#' . $extension_id ),
121
  $activate_text,
Extensions_Page.php CHANGED
@@ -3,6 +3,17 @@ namespace W3TC;
3
 
4
 
5
 
 
 
 
 
 
 
 
 
 
 
 
6
  class Extensions_Page extends Base_Page_Settings {
7
  /**
8
  * Current page
@@ -37,7 +48,6 @@ class Extensions_Page extends Base_Page_Settings {
37
 
38
  if ( $extension && $view ) {
39
  $all_settings = $this->_config->get_array( 'extensions.settings' );
40
- $extensions_active = Extensions_Util::get_active_extensions( $this->_config );
41
  $meta = $extensions_active[$extension];
42
  $sub_view = 'settings';
43
  } else {
@@ -45,6 +55,9 @@ class Extensions_Page extends Base_Page_Settings {
45
  $extensions_inactive = Extensions_Util::get_inactive_extensions( $this->_config );
46
  $var = "extensions_{$extension_status}";
47
  $extensions = $$var;
 
 
 
48
  $sub_view = 'list';
49
  $page = 1;
50
  }
3
 
4
 
5
 
6
+ /* todo - sort by name
7
+ function extensions_sort_cmp_name($a, $b)
8
+ {
9
+ if ($a['name'] == $b['name']) {
10
+ return 0;
11
+ }
12
+ return ($a['name'] < $b['name']) ? -1 : 1;
13
+ }*/
14
+
15
+
16
+
17
  class Extensions_Page extends Base_Page_Settings {
18
  /**
19
  * Current page
48
 
49
  if ( $extension && $view ) {
50
  $all_settings = $this->_config->get_array( 'extensions.settings' );
 
51
  $meta = $extensions_active[$extension];
52
  $sub_view = 'settings';
53
  } else {
55
  $extensions_inactive = Extensions_Util::get_inactive_extensions( $this->_config );
56
  $var = "extensions_{$extension_status}";
57
  $extensions = $$var;
58
+ $extension_keys = array_keys($extensions);
59
+ sort($extension_keys);
60
+
61
  $sub_view = 'list';
62
  $page = 1;
63
  }
Extensions_Plugin_Admin.php CHANGED
@@ -59,6 +59,10 @@ class Extensions_Plugin_Admin {
59
  '\W3TC\Extension_Wpml_Plugin_Admin',
60
  'w3tc_extensions' ),
61
  10, 2 );
 
 
 
 
62
  add_filter( 'w3tc_extensions_hooks', array(
63
  '\W3TC\Extension_Wpml_Plugin_Admin',
64
  'w3tc_extensions_hooks' ) );
59
  '\W3TC\Extension_Wpml_Plugin_Admin',
60
  'w3tc_extensions' ),
61
  10, 2 );
62
+ add_filter( 'w3tc_extensions', array(
63
+ '\W3TC\Extension_Amp_Plugin_Admin',
64
+ 'w3tc_extensions' ),
65
+ 10, 2 );
66
  add_filter( 'w3tc_extensions_hooks', array(
67
  '\W3TC\Extension_Wpml_Plugin_Admin',
68
  'w3tc_extensions_hooks' ) );
Generic_ConfigLabels.php CHANGED
@@ -14,7 +14,7 @@ class Generic_ConfigLabels {
14
  'common.force_master' => __( 'Use single network configuration file for all sites.', 'w3-total-cache' ),
15
  'config.path' => __( 'Nginx server configuration file path', 'w3-total-cache' ),
16
  'config.check' => __( 'Verify rewrite rules', 'w3-total-cache' ),
17
- 'plugin.license_key' => __( 'License', 'w3-total-cache' ),
18
 
19
  'referrer.enabled' => __( 'Referrers:', 'w3-total-cache' ),
20
  'referrer.rgroups' => __( 'Referrer groups', 'w3-total-cache' ),
14
  'common.force_master' => __( 'Use single network configuration file for all sites.', 'w3-total-cache' ),
15
  'config.path' => __( 'Nginx server configuration file path', 'w3-total-cache' ),
16
  'config.check' => __( 'Verify rewrite rules', 'w3-total-cache' ),
17
+ 'plugin.license_key' => __( 'License:', 'w3-total-cache' ),
18
 
19
  'referrer.enabled' => __( 'Referrers:', 'w3-total-cache' ),
20
  'referrer.rgroups' => __( 'Referrer groups', 'w3-total-cache' ),
Generic_Page_Dashboard_View.css CHANGED
@@ -2,11 +2,11 @@
2
  background-color: #FFF;
3
  margin:0;padding:0;
4
  }
5
- #w3tc-dashboard-widgets h3.hndle {
6
  height: 36px;
7
  line-height: 36px;
8
  }
9
- #w3tc-dashboard-widgets h3.hndle, #w3tc-dashboard-widgets h3.hndle span {
10
  font-family: Arial, sans-serif;
11
  font-weight: bold;
12
  text-shadow: none;
@@ -73,7 +73,7 @@
73
  padding-right: 10px;
74
  }
75
 
76
- .w3tc-widget-spreadtheword-logo {
77
  float: left;
78
  width: 50px;
79
  height: 35px;
@@ -102,10 +102,10 @@
102
  }
103
 
104
  .w3tc-widget-maxcdn-logo {
105
- float: left;
106
  width: 150px;
107
  height: 35px;
108
  background: url("pub/img/w3tc_maxcdn-logo.png") 0 5px no-repeat;
 
109
  }
110
 
111
  #normal-sortables .postbox {
@@ -115,6 +115,7 @@
115
  /**
116
  * HiDPI Displays
117
  */
 
118
  @media print,
119
  only screen and (-webkit-min-device-pixel-ratio: 2),
120
  only screen and ( min--moz-device-pixel-ratio: 2),
@@ -127,7 +128,7 @@ only screen and ( min-resolution: 2dppx) {
127
  background-size: 224px 44px;
128
  }
129
 
130
- .w3tc-widget-spreadtheword-logo {
131
  float: left;
132
  width: 50px;
133
  height: 90px;
@@ -167,3 +168,4 @@ only screen and ( min-resolution: 2dppx) {
167
  background-size: 468px 90px;
168
  }
169
  }
 
2
  background-color: #FFF;
3
  margin:0;padding:0;
4
  }
5
+ #w3tc-dashboard-widgets .hndle {
6
  height: 36px;
7
  line-height: 36px;
8
  }
9
+ #w3tc-dashboard-widgets .hndle, #w3tc-dashboard-widgets .hndle span {
10
  font-family: Arial, sans-serif;
11
  font-weight: bold;
12
  text-shadow: none;
73
  padding-right: 10px;
74
  }
75
 
76
+ .w3tc-widget-w3tc-logo {
77
  float: left;
78
  width: 50px;
79
  height: 35px;
102
  }
103
 
104
  .w3tc-widget-maxcdn-logo {
 
105
  width: 150px;
106
  height: 35px;
107
  background: url("pub/img/w3tc_maxcdn-logo.png") 0 5px no-repeat;
108
+ float: left;
109
  }
110
 
111
  #normal-sortables .postbox {
115
  /**
116
  * HiDPI Displays
117
  */
118
+ /* doesnt work
119
  @media print,
120
  only screen and (-webkit-min-device-pixel-ratio: 2),
121
  only screen and ( min--moz-device-pixel-ratio: 2),
128
  background-size: 224px 44px;
129
  }
130
 
131
+ .w3tc-widget-w3tc-logo {
132
  float: left;
133
  width: 50px;
134
  height: 90px;
168
  background-size: 468px 90px;
169
  }
170
  }
171
+ */
Generic_Plugin_Admin.php CHANGED
@@ -38,6 +38,9 @@ class Generic_Plugin_Admin {
38
  $this,
39
  'admin_init'
40
  ) );
 
 
 
41
 
42
  add_action( 'admin_enqueue_scripts', array(
43
  $this,
38
  $this,
39
  'admin_init'
40
  ) );
41
+ add_action( 'admin_init_w3tc_dashboard', array(
42
+ '\W3TC\Generic_WidgetServices',
43
+ 'admin_init_w3tc_dashboard' ) );
44
 
45
  add_action( 'admin_enqueue_scripts', array(
46
  $this,
Generic_Plugin_AdminNotifications.php CHANGED
@@ -110,7 +110,7 @@ class Generic_Plugin_AdminNotifications {
110
  public function w3tc_ajax_generic_support_us() {
111
  $supports = $this->get_supports();
112
  global $current_user;
113
- get_currentuserinfo();
114
  $email = $current_user->user_email;
115
  include W3TC_INC_DIR . '/lightbox/support_us.php';
116
  }
110
  public function w3tc_ajax_generic_support_us() {
111
  $supports = $this->get_supports();
112
  global $current_user;
113
+ wp_get_current_user();
114
  $email = $current_user->user_email;
115
  include W3TC_INC_DIR . '/lightbox/support_us.php';
116
  }
Generic_Plugin_WidgetServices.php → Generic_WidgetServices.php RENAMED
@@ -9,54 +9,79 @@ namespace W3TC;
9
  /**
10
  * Class Generic_Plugin_WidgetServices
11
  */
12
- class Generic_Plugin_WidgetServices {
13
- /**
14
- * Array of request types
15
- *
16
- * @var array
17
- */
18
- var $_request_types = array();
19
- var $_json_request_types = array();
20
 
21
  /**
22
- * Array of request groups
23
  *
24
- * @var array
25
  */
26
- var $_request_groups = array(
27
- 'email_support',
28
- 'phone_support',
29
- 'plugin_config',
30
- 'theme_config',
31
- 'linux_config'
32
- );
33
 
34
- /**
35
- * Request price list
36
- *
37
- * @var array
38
- */
39
- var $_request_prices = array(
40
- 'email_support' => 175,
41
- 'phone_support' => 250,
42
- 'plugin_config' => 200,
43
- 'theme_config' => 350,
44
- 'linux_config' => 450
45
- );
46
 
47
- /**
48
- * Config
49
- */
50
- private $_config = null;
 
 
 
 
 
51
 
52
- function __construct() {
53
- $this->_config = Dispatcher::config();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  }
55
 
56
- /**
57
- * Runs plugin
58
- */
59
- function run() {
 
 
 
 
 
 
 
 
 
60
  if ( Util_Admin::get_current_wp_page() == 'w3tc_dashboard' )
61
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
62
 
@@ -74,64 +99,14 @@ class Generic_Plugin_WidgetServices {
74
  'theme_config' => sprintf( __( 'Theme Performance Optimization & Plugin Configuration %s', 'w3-total-cache' ), '<br /><span>Starting @ $350 USD</span>' ),
75
  'linux_config' => sprintf( __( 'Linux Server Optimization & Plugin Configuration %s', 'w3-total-cache' ), '<br /><span>Starting @ $450 USD</span>' )
76
  );
77
- add_action( 'w3tc_widget_setup', array(
78
- $this,
79
- 'wp_dashboard_setup'
80
- ) );
81
- add_action( 'w3tc_network_dashboard_setup', array(
82
- $this,
83
- 'wp_dashboard_setup'
84
- ) );
85
-
86
- if ( is_admin() ) {
87
- add_action( 'wp_ajax_w3tc_action_payment_code', array( $this, 'action_payment_code' ) );
88
- }
89
- }
90
-
91
- /**
92
- * Dashboard setup action
93
- *
94
- * @return void
95
- */
96
- function wp_dashboard_setup() {
97
- Util_Widget::add( 'w3tc_services',
98
- '<div class="w3tc-widget-services-logo"></div>' .
99
- '<div class="w3tc-widget-text">' .
100
- __( 'Premium Services', 'w3-total-cache' ) .
101
- '</div>',
102
- array( $this, 'widget_form' ),
103
- null, 'normal' );
104
- }
105
 
106
  function widget_form() {
107
  include W3TC_INC_WIDGET_DIR . '/services.php';
108
  }
109
 
110
- function action_payment_code() {
111
-
112
-
113
- $request_type = Util_Request::get_string( 'request_type' );
114
-
115
- $request_id = date( 'YmdHi' );
116
- $return_url = admin_url( 'admin.php?page=w3tc_support&request_type=' . $request_type . '&payment=1&request_id=' . $request_id );
117
- $cancel_url = admin_url( 'admin.php?page=w3tc_dashboard' );
118
- $form_values = array(
119
- "cmd" => "_xclick",
120
- "business" => W3TC_PAYPAL_BUSINESS,
121
- "item_name" => esc_attr( sprintf( '%s: %s (#%s)', ucfirst( Util_Environment::host() ), $this->_json_request_types[$request_type], $request_id ) ),
122
- "amount" => sprintf( '%.2f', $this->_request_prices[$request_type] ),
123
- "currency_code" => "USD",
124
- "no_shipping" => "1",
125
- "rm" => "2",
126
- "return" => esc_attr( $return_url ),
127
- "cancel_return" => esc_attr( $cancel_url ) );
128
- echo json_encode( $form_values );
129
- die();
130
- }
131
-
132
  public function enqueue() {
133
  wp_enqueue_style( 'w3tc-widget' );
134
  wp_enqueue_script( 'w3tc-metadata' );
135
  wp_enqueue_script( 'w3tc-widget' );
136
- }
137
  }
9
  /**
10
  * Class Generic_Plugin_WidgetServices
11
  */
12
+ class Generic_WidgetServices {
13
+ function __construct() {
14
+ }
 
 
 
 
 
15
 
16
  /**
17
+ * Dashboard setup action
18
  *
19
+ * @return void
20
  */
21
+ static public function admin_init_w3tc_dashboard() {
22
+ $o = new Generic_WidgetServices();
 
 
 
 
 
23
 
24
+ add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 3 );
25
+ add_action( 'w3tc_network_dashboard_setup',
26
+ array( $o, 'wp_dashboard_setup' ), 3 );
27
+ }
 
 
 
 
 
 
 
 
28
 
29
+ function wp_dashboard_setup() {
30
+ Util_Widget::add( 'w3tc_services',
31
+ '<div class="w3tc-widget-w3tc-logo"></div>' .
32
+ '<div class="w3tc-widget-text">' .
33
+ __( 'Premium Services', 'w3-total-cache' ) .
34
+ '</div>',
35
+ array( $this, 'widget_form' ),
36
+ null, 'normal' );
37
+ }
38
 
39
+
40
+
41
+ public function load_request_types() {
42
+ $v = get_site_option( 'w3tc_generic_widgetservices' );
43
+ try {
44
+ $v = json_decode( $v, true );
45
+ if ( isset( $v['items'] ) && isset( $v['expires'] ) &&
46
+ $v['expires'] > time() )
47
+ return $v['items'];
48
+ } catch ( \Exception $e ) {
49
+ }
50
+
51
+
52
+ $result = wp_remote_request( W3TC_SUPPORT_SERVICES_URL,
53
+ array( 'method' => 'GET' ) );
54
+
55
+ if ( is_wp_error( $result ) )
56
+ return null;
57
+
58
+ $response_json = json_decode( $result['body'], true );
59
+
60
+ if ( is_null( $response_json ) || !isset( $response_json['items'] ) )
61
+ return null;
62
+
63
+ update_site_option( 'w3tc_generic_widgetservices',
64
+ json_encode( array(
65
+ 'items' => $response_json['items'],
66
+ 'expires' => time() + 3600 * 24 * 7
67
+ ) ) );
68
+
69
+ return $response_json['items'];
70
  }
71
 
72
+
73
+
74
+ public function widget_form() {
75
+ $items = $this->load_request_types();
76
+
77
+ include W3TC_DIR . '/Generic_WidgetServices_View.php';
78
+ }
79
+
80
+ /*
81
+ wp_enqueue_style( 'w3tc-widget-newrelic',
82
+ plugins_url( 'Extension_NewRelic_Widget_View.css', W3TC_FILE ),
83
+ array(), W3TC_VERSION );
84
+
85
  if ( Util_Admin::get_current_wp_page() == 'w3tc_dashboard' )
86
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
87
 
99
  'theme_config' => sprintf( __( 'Theme Performance Optimization & Plugin Configuration %s', 'w3-total-cache' ), '<br /><span>Starting @ $350 USD</span>' ),
100
  'linux_config' => sprintf( __( 'Linux Server Optimization & Plugin Configuration %s', 'w3-total-cache' ), '<br /><span>Starting @ $450 USD</span>' )
101
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
 
103
  function widget_form() {
104
  include W3TC_INC_WIDGET_DIR . '/services.php';
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  public function enqueue() {
108
  wp_enqueue_style( 'w3tc-widget' );
109
  wp_enqueue_script( 'w3tc-metadata' );
110
  wp_enqueue_script( 'w3tc-widget' );
111
+ }*/
112
  }
Generic_WidgetServices_View.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ if ( !defined( 'W3TC' ) )
5
+ die();
6
+
7
+ ?>
8
+ <form action="admin.php" xmlns="http://www.w3.org/1999/html" method="get">
9
+ <input type="hidden" name="page" value="w3tc_support" />
10
+
11
+ <ul>
12
+ <?php
13
+ for ( $n = 0; $n < count( $items ); $n++ ): ?>
14
+ <li>
15
+ <div class="w3tc_generic_widgetservice_radio_outer">
16
+ <input id="service<?php echo $n ?>"
17
+ type="radio"
18
+ class="w3tc_generic_widgetservice_radio w3tc-ignore-change"
19
+ name="service_item"
20
+ value="<?php echo $n ?>"
21
+ />
22
+ </div>
23
+ <label for="service<?php echo $n ?>" class="w3tc_generic_widgetservice_label">
24
+ <?php echo htmlspecialchars( $items[$n]['name'] ) ?>
25
+ </label>
26
+ </li>
27
+ <?php endfor ?>
28
+ </ul>
29
+ <div id="buy-w3-service-area"></div>
30
+ <p>
31
+ <input id="buy-w3-service" name="buy-w3-service" type="submit"
32
+ class="button button-primary button-large"
33
+ value="<?php _e( 'Buy now', 'w3-total-cache' ) ?>" />
34
+ </p>
35
+ </form>
Generic_WidgetSpreadTheWord_Plugin.php CHANGED
@@ -43,9 +43,9 @@ class Generic_WidgetSpreadTheWord_Plugin {
43
  */
44
  function wp_dashboard_setup() {
45
  Util_Widget::add( 'w3tc_spreadtheword',
46
- '<div class="w3tc-widget-spreadtheword-logo"></div>' .
47
  '<div class="w3tc-widget-text">' .
48
- __( 'Spread The Word', 'w3-total-cache' ) .
49
  '</div>',
50
  array( $this, 'widget_form' ),
51
  null,
@@ -90,7 +90,7 @@ class Generic_WidgetSpreadTheWord_Plugin {
90
  if ( $value ) {
91
  _e( 'Thank you for linking to us!', 'w3-total-cache' );
92
  } else {
93
- _e( 'You are no longer linking to us. Please support us in other ways instead.', 'w3-total-cache' );
94
  }
95
  die();
96
  }
43
  */
44
  function wp_dashboard_setup() {
45
  Util_Widget::add( 'w3tc_spreadtheword',
46
+ '<div class="w3tc-widget-w3tc-logo"></div>' .
47
  '<div class="w3tc-widget-text">' .
48
+ __( 'Spread the Word', 'w3-total-cache' ) .
49
  '</div>',
50
  array( $this, 'widget_form' ),
51
  null,
90
  if ( $value ) {
91
  _e( 'Thank you for linking to us!', 'w3-total-cache' );
92
  } else {
93
+ _e( 'You are no longer linking to us. Please support us in other ways instead!', 'w3-total-cache' );
94
  }
95
  die();
96
  }
Licensing_AdminActions.php CHANGED
@@ -27,7 +27,7 @@ class Licensing_AdminActions {
27
 
28
  function w3tc_licensing_check_key() {
29
  delete_transient( 'w3tc_license_status' );
30
- edd_w3edge_w3tc_activate_license( $this->_config->get_string( 'plugin.license_key' ), W3TC_VERSION );
31
  Util_Admin::redirect( array(), true );
32
  }
33
 
@@ -35,9 +35,9 @@ class Licensing_AdminActions {
35
  $license_key = $this->_config->get_string( 'plugin.license_key' );
36
 
37
  delete_transient( 'w3tc_license_status' );
38
- edd_w3edge_w3tc_activate_license( $license_key, W3TC_VERSION );
39
 
40
- $license = edd_w3edge_w3tc_check_license( $license_key, W3TC_VERSION );
41
  if ( $license ) {
42
  $status = $license->license_status;
43
  if ( substr( $status . '.', 0, 7 ) == 'active.' ) {
@@ -47,7 +47,7 @@ class Licensing_AdminActions {
47
  }
48
  }
49
 
50
- $r = edd_w3edge_w3tc_reset_rooturi(
51
  $this->_config->get_string( 'plugin.license_key' ), W3TC_VERSION );
52
 
53
  if ( isset( $r->status ) && $r->status == 'done' ) {
27
 
28
  function w3tc_licensing_check_key() {
29
  delete_transient( 'w3tc_license_status' );
30
+ Licensing_Core::activate_license( $this->_config->get_string( 'plugin.license_key' ), W3TC_VERSION );
31
  Util_Admin::redirect( array(), true );
32
  }
33
 
35
  $license_key = $this->_config->get_string( 'plugin.license_key' );
36
 
37
  delete_transient( 'w3tc_license_status' );
38
+ Licensing_Core::activate_license( $license_key, W3TC_VERSION );
39
 
40
+ $license = Licensing_Core::check_license( $license_key, W3TC_VERSION );
41
  if ( $license ) {
42
  $status = $license->license_status;
43
  if ( substr( $status . '.', 0, 7 ) == 'active.' ) {
47
  }
48
  }
49
 
50
+ $r = Licensing_Core::reset_rooturi(
51
  $this->_config->get_string( 'plugin.license_key' ), W3TC_VERSION );
52
 
53
  if ( isset( $r->status ) && $r->status == 'done' ) {
Licensing_Core.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+
5
+
6
+ class Licensing_Core {
7
+ /**
8
+ * Activates a license
9
+ */
10
+ static public function activate_license( $license, $version ) {
11
+ // data to send in our API request
12
+ $api_params = array(
13
+ 'edd_action'=> 'activate_license',
14
+ 'license' => $license, // legacy
15
+ 'license_key' => $license,
16
+ 'home_url' => network_home_url(),
17
+ 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ), // the name of our product in EDD
18
+ 'r' => rand(),
19
+ 'version' => $version
20
+ );
21
+
22
+ // Call the custom API.
23
+ $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
24
+ if ( is_wp_error( $response ) )
25
+ return false;
26
+
27
+ // decode the license data
28
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
29
+ return $license_data;
30
+ }
31
+
32
+ /**
33
+ * Deactivates a license
34
+ */
35
+ static public function deactivate_license( $license ) {
36
+ // data to send in our API request
37
+ $api_params = array(
38
+ 'edd_action'=> 'deactivate_license',
39
+ 'license' => $license, // legacy
40
+ 'license_key' => $license,
41
+ 'home_url' => network_home_url(),
42
+ 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ), // the name of our product in EDD,
43
+ 'r' => rand()
44
+ );
45
+
46
+ // Call the custom API.
47
+ $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
48
+
49
+ // make sure the response came back okay
50
+ if ( is_wp_error( $response ) )
51
+ return false;
52
+
53
+ // decode the license data
54
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
55
+
56
+ // $license_data->license will be either "deactivated" or "failed"
57
+ return $license_data->license == 'deactivated';
58
+ }
59
+
60
+ /**
61
+ * Checks if a license key is still valid
62
+ */
63
+ static public function check_license( $license, $version ) {
64
+ global $wp_version;
65
+
66
+ $api_params = array(
67
+ 'edd_action' => 'check_license',
68
+ 'license' => $license, // legacy
69
+ 'license_key' => $license,
70
+ 'home_url' => network_home_url(),
71
+ 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ),
72
+ 'r' => rand(),
73
+ 'version' => $version
74
+ );
75
+
76
+ // Call the custom API.
77
+ $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
78
+
79
+ if ( is_wp_error( $response ) )
80
+ return false;
81
+ $license_data = json_decode( wp_remote_retrieve_body( $response ) );
82
+ return $license_data;
83
+ }
84
+
85
+ static public function reset_rooturi( $license, $version ) {
86
+ // data to send in our API request
87
+ $api_params = array(
88
+ 'edd_action'=> 'reset_rooturi',
89
+ 'license_key' => $license,
90
+ 'home_url' => network_home_url(),
91
+ 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ), // the name of our product in EDD
92
+ 'r' => rand(),
93
+ 'version' => $version
94
+ );
95
+
96
+ // Call the custom API.
97
+ $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
98
+ if ( is_wp_error( $response ) )
99
+ return false;
100
+
101
+ // decode the license data
102
+ $status = json_decode( wp_remote_retrieve_body( $response ) );
103
+ return $status;
104
+ }
105
+ }
Licensing_Plugin_Admin.php CHANGED
@@ -69,20 +69,20 @@ class Licensing_Plugin_Admin {
69
  */
70
  function possible_state_change( $config, $old_config ) {
71
  if ( $old_config->get_string( 'plugin.license_key' ) !='' && $config->get_string( 'plugin.license_key' ) == '' ) {
72
- $result = edd_w3edge_w3tc_deactivate_license( $old_config->get_string( 'plugin.license_key' ) );
73
  if ( $result ) {
74
  $this->site_inactivated = true;
75
  }
76
  delete_transient( 'w3tc_license_status' );
77
  } elseif ( $old_config->get_string( 'plugin.license_key' ) =='' && $config->get_string( 'plugin.license_key' ) != '' ) {
78
- $result = edd_w3edge_w3tc_activate_license( $config->get_string( 'plugin.license_key' ), W3TC_VERSION );
79
  if ( $result ) {
80
  $this->site_activated = true;
81
  $config->set( 'common.track_usage', true );
82
  }
83
  delete_transient( 'w3tc_license_status' );
84
  } elseif ( $old_config->get_string( 'plugin.license_key' ) != $config->get_string( 'plugin.license_key' ) ) {
85
- $result = edd_w3edge_w3tc_activate_license( $config->get_string( 'plugin.license_key' ), W3TC_VERSION );
86
  if ( $result ) {
87
  $this->site_activated = true;
88
  }
@@ -194,7 +194,7 @@ class Licensing_Plugin_Admin {
194
  $plugin_type = '';
195
 
196
  if ( !empty( $license_key ) || defined( 'W3TC_LICENSE_CHECK' ) ) {
197
- $license = edd_w3edge_w3tc_check_license( $license_key, W3TC_VERSION );
198
 
199
  if ( $license ) {
200
  $status = $license->license_status;
@@ -238,7 +238,7 @@ class Licensing_Plugin_Admin {
238
  $license = Util_Request::get_string( 'license_key', '' );
239
 
240
  if ( $license ) {
241
- $status = edd_w3edge_w3tc_check_license( $license, W3TC_VERSION );
242
  echo $status->license_status;
243
  } else {
244
  echo 'invalid';
69
  */
70
  function possible_state_change( $config, $old_config ) {
71
  if ( $old_config->get_string( 'plugin.license_key' ) !='' && $config->get_string( 'plugin.license_key' ) == '' ) {
72
+ $result = Licensing_Core::deactivate_license( $old_config->get_string( 'plugin.license_key' ) );
73
  if ( $result ) {
74
  $this->site_inactivated = true;
75
  }
76
  delete_transient( 'w3tc_license_status' );
77
  } elseif ( $old_config->get_string( 'plugin.license_key' ) =='' && $config->get_string( 'plugin.license_key' ) != '' ) {
78
+ $result = Licensing_Core::activate_license( $config->get_string( 'plugin.license_key' ), W3TC_VERSION );
79
  if ( $result ) {
80
  $this->site_activated = true;
81
  $config->set( 'common.track_usage', true );
82
  }
83
  delete_transient( 'w3tc_license_status' );
84
  } elseif ( $old_config->get_string( 'plugin.license_key' ) != $config->get_string( 'plugin.license_key' ) ) {
85
+ $result = Licensing_Core::activate_license( $config->get_string( 'plugin.license_key' ), W3TC_VERSION );
86
  if ( $result ) {
87
  $this->site_activated = true;
88
  }
194
  $plugin_type = '';
195
 
196
  if ( !empty( $license_key ) || defined( 'W3TC_LICENSE_CHECK' ) ) {
197
+ $license = Licensing_Core::check_license( $license_key, W3TC_VERSION );
198
 
199
  if ( $license ) {
200
  $status = $license->license_status;
238
  $license = Util_Request::get_string( 'license_key', '' );
239
 
240
  if ( $license ) {
241
+ $status = Licensing_Core::check_license( $license, W3TC_VERSION );
242
  echo $status->license_status;
243
  } else {
244
  echo 'invalid';
Minify_ConfigLabels.php CHANGED
@@ -4,7 +4,7 @@ namespace W3TC;
4
  class Minify_ConfigLabels {
5
  public function config_labels( $config_labels ) {
6
  return array_merge( $config_labels, array(
7
- 'minify.engine' => __( 'Minify cache method:', 'w3-total-cache' ),
8
  'minify.enabled' => __( 'Minify:', 'w3-total-cache' ),
9
  'minify.debug' => __( 'Minify', 'w3-total-cache' ),
10
  'minify.html.engine' => __( '<acronym title="Hypertext Markup Language">HTML</acronym> minifier:', 'w3-total-cache' ),
4
  class Minify_ConfigLabels {
5
  public function config_labels( $config_labels ) {
6
  return array_merge( $config_labels, array(
7
+ 'minify.engine' => __( 'Minify Cache Method:', 'w3-total-cache' ),
8
  'minify.enabled' => __( 'Minify:', 'w3-total-cache' ),
9
  'minify.debug' => __( 'Minify', 'w3-total-cache' ),
10
  'minify.html.engine' => __( '<acronym title="Hypertext Markup Language">HTML</acronym> minifier:', 'w3-total-cache' ),
Minify_Environment.php CHANGED
@@ -269,7 +269,7 @@ class Minify_Environment {
269
 
270
  $is_ok = ( !is_wp_error( $response ) &&
271
  $response['response']['code'] == 200 &&
272
- trim( $response['body'] ) == 'OK' );
273
 
274
  if ( $is_ok )
275
  $result = 'ok';
@@ -575,7 +575,7 @@ class Minify_Environment {
575
 
576
  if ( $w3tc ) {
577
  $rules .= " Header set X-Powered-By \"" .
578
- Util_Environment::w3tc_header( $config ) . "\"\n";
579
  }
580
 
581
  if ( $compression ) {
@@ -663,7 +663,7 @@ class Minify_Environment {
663
 
664
  if ( $w3tc ) {
665
  $common_rules .= " add_header X-Powered-By \"" .
666
- Util_Environment::w3tc_header( $config ) . "\";\n";
667
  }
668
 
669
  if ( $compression ) {
269
 
270
  $is_ok = ( !is_wp_error( $response ) &&
271
  $response['response']['code'] == 200 &&
272
+ trim( $response['body'] ) == 'Minify OK' );
273
 
274
  if ( $is_ok )
275
  $result = 'ok';
575
 
576
  if ( $w3tc ) {
577
  $rules .= " Header set X-Powered-By \"" .
578
+ Util_Environment::w3tc_header() . "\"\n";
579
  }
580
 
581
  if ( $compression ) {
663
 
664
  if ( $w3tc ) {
665
  $common_rules .= " add_header X-Powered-By \"" .
666
+ Util_Environment::w3tc_header() . "\";\n";
667
  }
668
 
669
  if ( $compression ) {
Minify_MinifiedFileRequestHandler.php CHANGED
@@ -41,7 +41,7 @@ class Minify_MinifiedFileRequestHandler {
41
  $rewrite_marker = 'rewrite_test.css';
42
  if ( substr( $file, strlen( $file ) - strlen( $rewrite_marker ) ) ==
43
  $rewrite_marker ) {
44
- echo 'OK';
45
  exit();
46
  }
47
 
@@ -207,7 +207,7 @@ class Minify_MinifiedFileRequestHandler {
207
  * Send X-Powered-By header
208
  */
209
  if ( !$quiet && $browsercache && $this->_config->get_boolean( 'browsercache.cssjs.w3tc' ) ) {
210
- @header( 'X-Powered-By: ' . Util_Environment::w3tc_header( $this->_config ) );
211
  }
212
 
213
  if ( empty( $_GET['f_array'] ) && empty( $_GET['g'] ) ) {
@@ -281,6 +281,12 @@ class Minify_MinifiedFileRequestHandler {
281
  */
282
  function flush() {
283
  $cache = $this->_get_cache();
 
 
 
 
 
 
284
 
285
  return $cache->flush();
286
  }
41
  $rewrite_marker = 'rewrite_test.css';
42
  if ( substr( $file, strlen( $file ) - strlen( $rewrite_marker ) ) ==
43
  $rewrite_marker ) {
44
+ echo 'Minify OK';
45
  exit();
46
  }
47
 
207
  * Send X-Powered-By header
208
  */
209
  if ( !$quiet && $browsercache && $this->_config->get_boolean( 'browsercache.cssjs.w3tc' ) ) {
210
+ @header( 'X-Powered-By: ' . Util_Environment::w3tc_header() );
211
  }
212
 
213
  if ( empty( $_GET['f_array'] ) && empty( $_GET['g'] ) ) {
281
  */
282
  function flush() {
283
  $cache = $this->_get_cache();
284
+ // used to debug - which plugin calls flush all the time and breaks
285
+ // performance
286
+ if ( $this->_config->get_boolean( 'minify.debug' ) ) {
287
+ Minify_Core::log( 'Minify flush called from' );
288
+ Minify_Core::log( json_encode( debug_backtrace () ) );
289
+ }
290
 
291
  return $cache->flush();
292
  }
Minify_Plugin.php CHANGED
@@ -145,204 +145,215 @@ class Minify_Plugin {
145
  /**
146
  * Replace script and style tags
147
  */
148
- if ( function_exists( 'is_feed' ) && !is_feed() ) {
149
-
150
- $head_prepend = '';
151
- $body_prepend = '';
152
- $body_append = '';
153
- $embed_extsrcjs = false;
154
- $buffer = apply_filters( 'w3tc_minify_before', $buffer );
155
-
156
- if ( $this->_config->get_boolean( 'minify.auto' ) ) {
157
- if ( $this->_config->get_boolean( 'minify.js.enable' ) ) {
158
- $minifier = new _W3_MinifyJsAuto( $this->_config,
159
- $buffer, $this->minify_helpers );
160
- $buffer = $minifier->execute();
161
- $this->replaced_scripts =
162
- $minifier->get_debug_minified_urls();
163
- }
164
 
165
- if ( $this->_config->get_boolean( 'minify.css.enable' ) ) {
166
- $embed_to_html = $this->_config->get_boolean( 'minify.css.embed' );
167
- $ignore_css_files = $this->_config->get_array( 'minify.reject.files.css' );
168
- $files_to_minify = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
- $embed_pos = strpos( $buffer, '<!-- W3TC-include-css -->' );
 
 
 
171
 
 
172
 
173
- $buffer = str_replace( '<!-- W3TC-include-css -->', '', $buffer );
174
- if ( $embed_pos === false ) {
175
- if ( preg_match( '~<head(\s+[^>]*)*>~Ui', $buffer, $match, PREG_OFFSET_CAPTURE ) )
176
- $embed_pos = strlen( $match[0][0] ) + $match[0][1];
177
- else
178
- $embed_pos = 0;
179
- }
180
 
181
- $ignore_css_files = array_map( array( '\W3TC\Util_Environment', 'normalize_file' ), $ignore_css_files );
182
- $handled_styles = array();
183
- $style_tags = Minify_Extract::extract_css( $buffer );
184
- $previous_file_was_ignored = false;
185
- foreach ( $style_tags as $style_tag_tuple ) {
186
- $style_tag = $style_tag_tuple[0];
187
- $style_len = strlen( $style_tag );
188
- $tag_pos = strpos( $buffer, $style_tag );
189
- $match = array();
190
- $url = $style_tag_tuple[1];
191
- if ( $this->_config->get_boolean( 'minify.debug' ) ) {
192
- Minify_Core::log( 'adding ' . $url );
193
- }
 
 
 
 
 
 
 
 
194
 
195
- $url = Util_Environment::url_relative_to_full( $url );
196
- $file = Util_Environment::url_to_docroot_filename( $url );
197
-
198
- $do_tag_minification =
199
- $this->minify_helpers->is_file_for_minification( $file ) &&
200
- !in_array( $file, $handled_styles );
201
- $do_tag_minification = apply_filters( 'w3tc_minify_css_do_tag_minification',
202
- $do_tag_minification, $style_tag, $file );
203
-
204
- if ( !$do_tag_minification )
205
- continue;
206
-
207
- $handled_styles[] = $file;
208
- $this->replaced_styles[] = $file;
209
- if ( in_array( $file, $ignore_css_files ) ) {
210
- if ( $tag_pos > $embed_pos ) {
211
- if ( $files_to_minify ) {
212
- $data = array(
213
- 'files_to_minify' => $files_to_minify,
214
- 'embed_pos' => $embed_pos,
215
- 'embed_to_html' => $embed_to_html
216
- );
217
-
218
- $data = apply_filters(
219
- 'w3tc_minify_css_step',
220
- $data );
221
-
222
- $style = $this->get_style_custom(
223
- $data['files_to_minify'],
224
- $data['embed_to_html'] );
225
-
226
- $buffer = substr_replace( $buffer, $style, $embed_pos, 0 );
227
-
228
- $files_to_minify = array();
229
- $style_len = $style_len +strlen( $style );
230
- }
231
- $embed_pos = $embed_pos + $style_len;
232
- $previous_file_was_ignored = true;
233
  }
234
- } else {
235
- $buffer = substr_replace( $buffer, '', $tag_pos, $style_len );
236
- if ( $embed_pos > $tag_pos )
237
- $embed_pos -= $style_len;
238
- elseif ( $previous_file_was_ignored )
239
- $embed_pos = $tag_pos;
240
-
241
- $files_to_minify[] = $file;
242
  }
 
 
 
 
 
 
 
 
243
  }
 
244
 
245
- $data = array(
246
- 'files_to_minify' => $files_to_minify,
247
- 'embed_pos' => $embed_pos,
248
- 'embed_to_html' => $embed_to_html
249
- );
250
 
251
- $data = apply_filters( 'w3tc_minify_css_step',
252
- $data );
253
 
254
- $style = $this->get_style_custom(
255
- $data['files_to_minify'],
256
- $data['embed_to_html'] );
257
- $buffer = substr_replace( $buffer, $style,
258
- $data['embed_pos'], 0 );
259
- }
260
 
261
- $buffer = apply_filters( 'w3tc_minify_processed', $buffer );
262
- } else {
263
- if ( $this->_config->get_boolean( 'minify.css.enable' ) ) {
264
- $style = $this->get_style_group( 'include' );
265
 
266
- if ( $style ) {
267
- if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-css -->/', $buffer, $style ) )
268
- $head_prepend .= $style;
269
 
270
- $this->remove_styles_group( $buffer, 'include' );
271
- }
272
  }
 
273
 
274
- if ( $this->_config->get_boolean( 'minify.js.enable' ) ) {
275
-
276
- $embed_type = $this->_config->get_string( 'minify.js.header.embed_type' );
277
- $script = $this->get_script_group( 'include', $embed_type );
278
 
279
- if ( $script ) {
280
- $embed_extsrcjs = $embed_type == 'extsrc' || $embed_type == 'asyncsrc'?true:$embed_extsrcjs;
281
 
282
- if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-js-head -->/', $buffer, $script ) )
283
- $head_prepend .= $script;
284
 
285
- $this->remove_scripts_group( $buffer, 'include' );
286
- }
287
 
288
- $embed_type = $this->_config->get_string( 'minify.js.body.embed_type' );
289
- $script = $this->get_script_group( 'include-body', $embed_type );
290
 
291
- if ( $script ) {
292
- $embed_extsrcjs = $embed_type == 'extsrc' || $embed_type == 'asyncsrc'?true:$embed_extsrcjs;
293
 
294
- if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-js-body-start -->/', $buffer, $script ) )
295
- $body_prepend .= $script;
296
 
297
- $this->remove_scripts_group( $buffer, 'include-body' );
298
- }
299
 
300
- $embed_type = $this->_config->get_string( 'minify.js.footer.embed_type' );
301
- $script = $this->get_script_group( 'include-footer', $embed_type );
302
 
303
- if ( $script ) {
304
- $embed_extsrcjs = $embed_type == 'extsrc' || $embed_type == 'asyncsrc'?true:$embed_extsrcjs;
305
 
306
- if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-js-body-end -->/', $buffer, $script ) )
307
- $body_append .= $script;
308
 
309
- $this->remove_scripts_group( $buffer, 'include-footer' );
310
- }
311
  }
312
  }
 
313
 
314
- if ( $head_prepend != '' ) {
315
- $buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
316
- '\\0' . $head_prepend, $buffer, 1 );
317
- }
318
 
319
- if ( $body_prepend != '' ) {
320
- $buffer = preg_replace( '~<body(\s+[^>]*)*>~Ui',
321
- '\\0' . $body_prepend, $buffer, 1 );
322
- }
323
 
324
- if ( $body_append != '' ) {
325
- $buffer = preg_replace( '~<\\/body>~',
326
- $body_append . '\\0', $buffer, 1 );
327
- }
328
 
329
- if ( $embed_extsrcjs ) {
330
- $script = "
331
  <script type=\"text/javascript\">
332
  " ."var extsrc=null;
333
  ".'(function(){function j(){if(b&&g){document.write=k;document.writeln=l;var f=document.createElement("span");f.innerHTML=b;g.appendChild(f);b=""}}function d(){j();for(var f=document.getElementsByTagName("script"),c=0;c<f.length;c++){var e=f[c],h=e.getAttribute("asyncsrc");if(h){e.setAttribute("asyncsrc","");var a=document.createElement("script");a.async=!0;a.src=h;document.getElementsByTagName("head")[0].appendChild(a)}if(h=e.getAttribute("extsrc")){e.setAttribute("extsrc","");g=document.createElement("span");e.parentNode.insertBefore(g,e);document.write=function(a){b+=a};document.writeln=function(a){b+=a;b+="\n"};a=document.createElement("script");a.async=!0;a.src=h;/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?a.onreadystatechange=function(){("loaded"==this.readyState||"complete"==this.readyState)&&d()}:-1!=navigator.userAgent.indexOf("Firefox")||"onerror"in a?(a.onload=d,a.onerror=d):(a.onload=d,a.onreadystatechange=d);document.getElementsByTagName("head")[0].appendChild(a);return}}j();document.write=k;document.writeln=l;for(c=0;c<extsrc.complete.funcs.length;c++)extsrc.complete.funcs[c]()}function i(){arguments.callee.done||(arguments.callee.done=!0,d())}extsrc={complete:function(b){this.complete.funcs.push(b)}};extsrc.complete.funcs=[];var k=document.write,l=document.writeln,b="",g="";document.addEventListener&&document.addEventListener("DOMContentLoaded",i,!1);if(/WebKit/i.test(navigator.userAgent))var m=setInterval(function(){/loaded|complete/.test(document.readyState)&&(clearInterval(m),i())},10);window.onload=i})();' . "
334
  </script>
335
  ";
336
 
337
- $buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
338
- '\\0' . $script, $buffer, 1 );
339
- }
340
  }
341
 
342
  /**
343
  * Minify HTML/Feed
344
  */
345
- if ( $this->_config->get_boolean( 'minify.html.enable' ) ) {
346
  try {
347
  $buffer = $this->minify_html( $buffer );
348
  } catch ( \Exception $exception ) {
145
  /**
146
  * Replace script and style tags
147
  */
148
+ $js_enable = $this->_config->get_boolean( 'minify.js.enable' );
149
+ $css_enable = $this->_config->get_boolean( 'minify.css.enable' );
150
+ $html_enable = $this->_config->get_boolean( 'minify.html.enable' );
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
+ if ( function_exists( 'is_feed' ) && is_feed() ) {
153
+ $js_enable = false;
154
+ $css_enable = false;
155
+ }
156
+
157
+ $js_enable = apply_filters( 'w3tc_minify_js_enable', $js_enable );
158
+ $css_enable = apply_filters( 'w3tc_minify_css_enable', $css_enable );
159
+ $html_enable = apply_filters( 'w3tc_minify_html_enable', $html_enable );
160
+
161
+ $head_prepend = '';
162
+ $body_prepend = '';
163
+ $body_append = '';
164
+ $embed_extsrcjs = false;
165
+ $buffer = apply_filters( 'w3tc_minify_before', $buffer );
166
+
167
+
168
+
169
+ if ( $this->_config->get_boolean( 'minify.auto' ) ) {
170
+ if ( $js_enable ) {
171
+ $minifier = new _W3_MinifyJsAuto( $this->_config,
172
+ $buffer, $this->minify_helpers );
173
+ $buffer = $minifier->execute();
174
+ $this->replaced_scripts =
175
+ $minifier->get_debug_minified_urls();
176
+ }
177
 
178
+ if ( $css_enable ) {
179
+ $embed_to_html = $this->_config->get_boolean( 'minify.css.embed' );
180
+ $ignore_css_files = $this->_config->get_array( 'minify.reject.files.css' );
181
+ $files_to_minify = array();
182
 
183
+ $embed_pos = strpos( $buffer, '<!-- W3TC-include-css -->' );
184
 
 
 
 
 
 
 
 
185
 
186
+ $buffer = str_replace( '<!-- W3TC-include-css -->', '', $buffer );
187
+ if ( $embed_pos === false ) {
188
+ if ( preg_match( '~<head(\s+[^>]*)*>~Ui', $buffer, $match, PREG_OFFSET_CAPTURE ) )
189
+ $embed_pos = strlen( $match[0][0] ) + $match[0][1];
190
+ else
191
+ $embed_pos = 0;
192
+ }
193
+
194
+ $ignore_css_files = array_map( array( '\W3TC\Util_Environment', 'normalize_file' ), $ignore_css_files );
195
+ $handled_styles = array();
196
+ $style_tags = Minify_Extract::extract_css( $buffer );
197
+ $previous_file_was_ignored = false;
198
+ foreach ( $style_tags as $style_tag_tuple ) {
199
+ $style_tag = $style_tag_tuple[0];
200
+ $style_len = strlen( $style_tag );
201
+ $tag_pos = strpos( $buffer, $style_tag );
202
+ $match = array();
203
+ $url = $style_tag_tuple[1];
204
+ if ( $this->_config->get_boolean( 'minify.debug' ) ) {
205
+ Minify_Core::log( 'adding ' . $url );
206
+ }
207
 
208
+ $url = Util_Environment::url_relative_to_full( $url );
209
+ $file = Util_Environment::url_to_docroot_filename( $url );
210
+
211
+ $do_tag_minification =
212
+ $this->minify_helpers->is_file_for_minification( $file ) &&
213
+ !in_array( $file, $handled_styles );
214
+ $do_tag_minification = apply_filters( 'w3tc_minify_css_do_tag_minification',
215
+ $do_tag_minification, $style_tag, $file );
216
+
217
+ if ( !$do_tag_minification )
218
+ continue;
219
+
220
+ $handled_styles[] = $file;
221
+ $this->replaced_styles[] = $file;
222
+ if ( in_array( $file, $ignore_css_files ) ) {
223
+ if ( $tag_pos > $embed_pos ) {
224
+ if ( $files_to_minify ) {
225
+ $data = array(
226
+ 'files_to_minify' => $files_to_minify,
227
+ 'embed_pos' => $embed_pos,
228
+ 'embed_to_html' => $embed_to_html
229
+ );
230
+
231
+ $data = apply_filters(
232
+ 'w3tc_minify_css_step',
233
+ $data );
234
+
235
+ $style = $this->get_style_custom(
236
+ $data['files_to_minify'],
237
+ $data['embed_to_html'] );
238
+
239
+ $buffer = substr_replace( $buffer, $style, $embed_pos, 0 );
240
+
241
+ $files_to_minify = array();
242
+ $style_len = $style_len +strlen( $style );
 
 
 
243
  }
244
+ $embed_pos = $embed_pos + $style_len;
245
+ $previous_file_was_ignored = true;
 
 
 
 
 
 
246
  }
247
+ } else {
248
+ $buffer = substr_replace( $buffer, '', $tag_pos, $style_len );
249
+ if ( $embed_pos > $tag_pos )
250
+ $embed_pos -= $style_len;
251
+ elseif ( $previous_file_was_ignored )
252
+ $embed_pos = $tag_pos;
253
+
254
+ $files_to_minify[] = $file;
255
  }
256
+ }
257
 
258
+ $data = array(
259
+ 'files_to_minify' => $files_to_minify,
260
+ 'embed_pos' => $embed_pos,
261
+ 'embed_to_html' => $embed_to_html
262
+ );
263
 
264
+ $data = apply_filters( 'w3tc_minify_css_step',
265
+ $data );
266
 
267
+ $style = $this->get_style_custom(
268
+ $data['files_to_minify'],
269
+ $data['embed_to_html'] );
270
+ $buffer = substr_replace( $buffer, $style,
271
+ $data['embed_pos'], 0 );
272
+ }
273
 
274
+ $buffer = apply_filters( 'w3tc_minify_processed', $buffer );
275
+ } else {
276
+ if ( $css_enable ) {
277
+ $style = $this->get_style_group( 'include' );
278
 
279
+ if ( $style ) {
280
+ if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-css -->/', $buffer, $style ) )
281
+ $head_prepend .= $style;
282
 
283
+ $this->remove_styles_group( $buffer, 'include' );
 
284
  }
285
+ }
286
 
287
+ if ( $js_enable ) {
288
+ $embed_type = $this->_config->get_string( 'minify.js.header.embed_type' );
289
+ $script = $this->get_script_group( 'include', $embed_type );
 
290
 
291
+ if ( $script ) {
292
+ $embed_extsrcjs = $embed_type == 'extsrc' || $embed_type == 'asyncsrc'?true:$embed_extsrcjs;
293
 
294
+ if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-js-head -->/', $buffer, $script ) )
295
+ $head_prepend .= $script;
296
 
297
+ $this->remove_scripts_group( $buffer, 'include' );
298
+ }
299
 
300
+ $embed_type = $this->_config->get_string( 'minify.js.body.embed_type' );
301
+ $script = $this->get_script_group( 'include-body', $embed_type );
302
 
303
+ if ( $script ) {
304
+ $embed_extsrcjs = $embed_type == 'extsrc' || $embed_type == 'asyncsrc'?true:$embed_extsrcjs;
305
 
306
+ if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-js-body-start -->/', $buffer, $script ) )
307
+ $body_prepend .= $script;
308
 
309
+ $this->remove_scripts_group( $buffer, 'include-body' );
310
+ }
311
 
312
+ $embed_type = $this->_config->get_string( 'minify.js.footer.embed_type' );
313
+ $script = $this->get_script_group( 'include-footer', $embed_type );
314
 
315
+ if ( $script ) {
316
+ $embed_extsrcjs = $embed_type == 'extsrc' || $embed_type == 'asyncsrc'?true:$embed_extsrcjs;
317
 
318
+ if ( $this->_custom_location_does_not_exist( '/<!-- W3TC-include-js-body-end -->/', $buffer, $script ) )
319
+ $body_append .= $script;
320
 
321
+ $this->remove_scripts_group( $buffer, 'include-footer' );
 
322
  }
323
  }
324
+ }
325
 
326
+ if ( $head_prepend != '' ) {
327
+ $buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
328
+ '\\0' . $head_prepend, $buffer, 1 );
329
+ }
330
 
331
+ if ( $body_prepend != '' ) {
332
+ $buffer = preg_replace( '~<body(\s+[^>]*)*>~Ui',
333
+ '\\0' . $body_prepend, $buffer, 1 );
334
+ }
335
 
336
+ if ( $body_append != '' ) {
337
+ $buffer = preg_replace( '~<\\/body>~',
338
+ $body_append . '\\0', $buffer, 1 );
339
+ }
340
 
341
+ if ( $embed_extsrcjs ) {
342
+ $script = "
343
  <script type=\"text/javascript\">
344
  " ."var extsrc=null;
345
  ".'(function(){function j(){if(b&&g){document.write=k;document.writeln=l;var f=document.createElement("span");f.innerHTML=b;g.appendChild(f);b=""}}function d(){j();for(var f=document.getElementsByTagName("script"),c=0;c<f.length;c++){var e=f[c],h=e.getAttribute("asyncsrc");if(h){e.setAttribute("asyncsrc","");var a=document.createElement("script");a.async=!0;a.src=h;document.getElementsByTagName("head")[0].appendChild(a)}if(h=e.getAttribute("extsrc")){e.setAttribute("extsrc","");g=document.createElement("span");e.parentNode.insertBefore(g,e);document.write=function(a){b+=a};document.writeln=function(a){b+=a;b+="\n"};a=document.createElement("script");a.async=!0;a.src=h;/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent)?a.onreadystatechange=function(){("loaded"==this.readyState||"complete"==this.readyState)&&d()}:-1!=navigator.userAgent.indexOf("Firefox")||"onerror"in a?(a.onload=d,a.onerror=d):(a.onload=d,a.onreadystatechange=d);document.getElementsByTagName("head")[0].appendChild(a);return}}j();document.write=k;document.writeln=l;for(c=0;c<extsrc.complete.funcs.length;c++)extsrc.complete.funcs[c]()}function i(){arguments.callee.done||(arguments.callee.done=!0,d())}extsrc={complete:function(b){this.complete.funcs.push(b)}};extsrc.complete.funcs=[];var k=document.write,l=document.writeln,b="",g="";document.addEventListener&&document.addEventListener("DOMContentLoaded",i,!1);if(/WebKit/i.test(navigator.userAgent))var m=setInterval(function(){/loaded|complete/.test(document.readyState)&&(clearInterval(m),i())},10);window.onload=i})();' . "
346
  </script>
347
  ";
348
 
349
+ $buffer = preg_replace( '~<head(\s+[^>]*)*>~Ui',
350
+ '\\0' . $script, $buffer, 1 );
 
351
  }
352
 
353
  /**
354
  * Minify HTML/Feed
355
  */
356
+ if ( $html_enable ) {
357
  try {
358
  $buffer = $this->minify_html( $buffer );
359
  } catch ( \Exception $exception ) {
ObjectCache_WpObjectCache_Regular.php CHANGED
@@ -167,7 +167,7 @@ class ObjectCache_WpObjectCache_Regular {
167
  }
168
 
169
  if ( is_object( $value ) ) {
170
- $value = clone( $value );
171
  }
172
 
173
  $this->cache[$key] = $value;
@@ -218,7 +218,7 @@ class ObjectCache_WpObjectCache_Regular {
218
  $key = $this->_get_cache_key( $id, $group );
219
 
220
  if ( is_object( $data ) ) {
221
- $data = clone( $data );
222
  }
223
 
224
  $this->cache[$key] = $data;
167
  }
168
 
169
  if ( is_object( $value ) ) {
170
+ $value = clone $value;
171
  }
172
 
173
  $this->cache[$key] = $value;
218
  $key = $this->_get_cache_key( $id, $group );
219
 
220
  if ( is_object( $data ) ) {
221
+ $data = clone $data;
222
  }
223
 
224
  $this->cache[$key] = $data;
PgCache_ConfigLabels.php CHANGED
@@ -4,8 +4,8 @@ namespace W3TC;
4
  class PgCache_ConfigLabels {
5
  public function config_labels( $config_labels ) {
6
  return array_merge( $config_labels, array(
7
- 'pgcache.engine' => __( 'Page cache method:', 'w3-total-cache' ),
8
- 'pgcache.enabled' => __( 'Page cache:', 'w3-total-cache' ),
9
  'pgcache.debug' => __( 'Page Cache', 'w3-total-cache' ),
10
  'pgcache.cache.home' => get_option( 'show_on_front' ) == 'posts' ? __( 'Cache front page', 'w3-total-cache' ): __( 'Cache posts page', 'w3-total-cache' ),
11
  'pgcache.reject.front_page' => __( 'Don\'t cache front page', 'w3-total-cache' ),
@@ -19,7 +19,7 @@ class PgCache_ConfigLabels {
19
  'pgcache.prime.interval' => __( 'Update interval:', 'w3-total-cache' ),
20
  'pgcache.prime.limit' => __( 'Pages per interval:', 'w3-total-cache' ),
21
  'pgcache.prime.sitemap' =>__( 'Sitemap <acronym title="Uniform Resource Indicator">URL</acronym>:', 'w3-total-cache' ),
22
- 'pgcache.prime.post.enabled' => __( 'Preload the post cache upon publish events.', 'w3-total-cache' ),
23
  'pgcache.purge.front_page' => __( 'Front page', 'w3-total-cache' ),
24
  'pgcache.purge.home' => get_option( 'show_on_front' ) == 'posts' ? __( 'Front page', 'w3-total-cache' ): __( 'Posts page', 'w3-total-cache' ),
25
  'pgcache.purge.post' => __( 'Post page', 'w3-total-cache' ),
@@ -34,10 +34,10 @@ class PgCache_ConfigLabels {
34
  'pgcache.purge.archive.monthly' => __( 'Monthly archive pages', 'w3-total-cache' ),
35
  'pgcache.purge.archive.yearly' => __( 'Yearly archive pages', 'w3-total-cache' ),
36
  'pgcache.purge.feed.types' => __( 'Specify the feed types to purge:', 'w3-total-cache' ),
37
- 'pgcache.purge.postpages_limit' => __( 'Purge Limit:', 'w3-total-cache' ),
38
  'pgcache.purge.pages' => __( 'Additional pages:', 'w3-total-cache' ),
39
  'pgcache.purge.sitemap_regex' => __( 'Purge sitemaps:', 'w3-total-cache' ),
40
- 'pgcache.compatibility' => __( 'Enable compatibility mode', 'w3-total-cache' ),
41
  'pgcache.remove_charset' => __( 'Disable UTF-8 blog charset support' , 'w3-total-cache' ),
42
  'pgcache.reject.request_head' => __( ' Disable caching of HEAD <acronym title="Hypertext Transfer Protocol">HTTP</acronym> requests', 'w3-total-cache' ),
43
  'pgcache.lifetime' => __( 'Maximum lifetime of cache objects:', 'w3-total-cache' ),
4
  class PgCache_ConfigLabels {
5
  public function config_labels( $config_labels ) {
6
  return array_merge( $config_labels, array(
7
+ 'pgcache.engine' => __( 'Page Cache Method:', 'w3-total-cache' ),
8
+ 'pgcache.enabled' => __( 'Page Cache:', 'w3-total-cache' ),
9
  'pgcache.debug' => __( 'Page Cache', 'w3-total-cache' ),
10
  'pgcache.cache.home' => get_option( 'show_on_front' ) == 'posts' ? __( 'Cache front page', 'w3-total-cache' ): __( 'Cache posts page', 'w3-total-cache' ),
11
  'pgcache.reject.front_page' => __( 'Don\'t cache front page', 'w3-total-cache' ),
19
  'pgcache.prime.interval' => __( 'Update interval:', 'w3-total-cache' ),
20
  'pgcache.prime.limit' => __( 'Pages per interval:', 'w3-total-cache' ),
21
  'pgcache.prime.sitemap' =>__( 'Sitemap <acronym title="Uniform Resource Indicator">URL</acronym>:', 'w3-total-cache' ),
22
+ 'pgcache.prime.post.enabled' => __( 'Preload the post cache upon publish events', 'w3-total-cache' ),
23
  'pgcache.purge.front_page' => __( 'Front page', 'w3-total-cache' ),
24
  'pgcache.purge.home' => get_option( 'show_on_front' ) == 'posts' ? __( 'Front page', 'w3-total-cache' ): __( 'Posts page', 'w3-total-cache' ),
25
  'pgcache.purge.post' => __( 'Post page', 'w3-total-cache' ),
34
  'pgcache.purge.archive.monthly' => __( 'Monthly archive pages', 'w3-total-cache' ),
35
  'pgcache.purge.archive.yearly' => __( 'Yearly archive pages', 'w3-total-cache' ),
36
  'pgcache.purge.feed.types' => __( 'Specify the feed types to purge:', 'w3-total-cache' ),
37
+ 'pgcache.purge.postpages_limit' => __( 'Purge limit:', 'w3-total-cache' ),
38
  'pgcache.purge.pages' => __( 'Additional pages:', 'w3-total-cache' ),
39
  'pgcache.purge.sitemap_regex' => __( 'Purge sitemaps:', 'w3-total-cache' ),
40
+ 'pgcache.compatibility' => __( 'Enable', 'w3-total-cache' ),
41
  'pgcache.remove_charset' => __( 'Disable UTF-8 blog charset support' , 'w3-total-cache' ),
42
  'pgcache.reject.request_head' => __( ' Disable caching of HEAD <acronym title="Hypertext Transfer Protocol">HTTP</acronym> requests', 'w3-total-cache' ),
43
  'pgcache.lifetime' => __( 'Maximum lifetime of cache objects:', 'w3-total-cache' ),
PgCache_ContentGrabber.php CHANGED
@@ -1307,7 +1307,7 @@ class PgCache_ContentGrabber {
1307
 
1308
  if ( $this->_config->get_boolean( 'browsercache.html.w3tc' ) ) {
1309
  $headers = array_merge( $headers, array(
1310
- 'X-Powered-By' => Util_Environment::w3tc_header( $this->_config )
1311
  ) );
1312
  }
1313
  }
1307
 
1308
  if ( $this->_config->get_boolean( 'browsercache.html.w3tc' ) ) {
1309
  $headers = array_merge( $headers, array(
1310
+ 'X-Powered-By' => Util_Environment::w3tc_header()
1311
  ) );
1312
  }
1313
  }
PgCache_Environment.php CHANGED
@@ -529,7 +529,7 @@ class PgCache_Environment {
529
  $cache_dir = Util_Environment::normalize_path( W3TC_CACHE_PAGE_ENHANCED_DIR );
530
  $permalink_structure = get_option( 'permalink_structure' );
531
 
532
- $current_user = get_currentuserinfo();
533
 
534
  /**
535
  * Auto reject cookies
@@ -1177,7 +1177,7 @@ class PgCache_Environment {
1177
 
1178
  if ( $w3tc ) {
1179
  $header_rules .= " Header set X-Powered-By \"" .
1180
- Util_Environment::w3tc_header( $config ) . "\"\n";
1181
  }
1182
 
1183
  if ( $expires ) {
@@ -1276,7 +1276,7 @@ class PgCache_Environment {
1276
 
1277
  if ( $w3tc ) {
1278
  $common_rules .= " add_header X-Powered-By \"" .
1279
- Util_Environment::w3tc_header( $config ) . "\";\n";
1280
  }
1281
 
1282
  if ( $expires ) {
529
  $cache_dir = Util_Environment::normalize_path( W3TC_CACHE_PAGE_ENHANCED_DIR );
530
  $permalink_structure = get_option( 'permalink_structure' );
531
 
532
+ $current_user = wp_get_current_user();
533
 
534
  /**
535
  * Auto reject cookies
1177
 
1178
  if ( $w3tc ) {
1179
  $header_rules .= " Header set X-Powered-By \"" .
1180
+ Util_Environment::w3tc_header() . "\"\n";
1181
  }
1182
 
1183
  if ( $expires ) {
1276
 
1277
  if ( $w3tc ) {
1278
  $common_rules .= " add_header X-Powered-By \"" .
1279
+ Util_Environment::w3tc_header() . "\";\n";
1280
  }
1281
 
1282
  if ( $expires ) {
PgCache_Plugin_Admin.php CHANGED
@@ -186,7 +186,7 @@ class PgCache_Plugin_Admin {
186
 
187
  foreach ( $url_matches[1] as $url_match ) {
188
  $loc = '';
189
- $priority = 0;
190
 
191
  if ( preg_match( '~<loc>(.*?)</loc>~is', $url_match, $loc_matches ) ) {
192
  $loc = trim( $loc_matches[1] );
186
 
187
  foreach ( $url_matches[1] as $url_match ) {
188
  $loc = '';
189
+ $priority = 0.5;
190
 
191
  if ( preg_match( '~<loc>(.*?)</loc>~is', $url_match, $loc_matches ) ) {
192
  $loc = trim( $loc_matches[1] );
Root_Loader.php CHANGED
@@ -45,7 +45,6 @@ class Root_Loader {
45
  $plugins[] = new ObjectCache_Plugin_Admin();
46
  $plugins[] = new PgCache_Plugin_Admin();
47
  $plugins[] = new Minify_Plugin_Admin();
48
- $plugins[] = new Generic_Plugin_WidgetServices();
49
  $plugins[] = new Generic_WidgetSpreadTheWord_Plugin();
50
  $plugins[] = new Generic_Plugin_WidgetNews();
51
  $plugins[] = new Generic_Plugin_WidgetForum();
@@ -155,3 +154,9 @@ class Root_Loader {
155
  }
156
  }
157
  }
 
 
 
 
 
 
45
  $plugins[] = new ObjectCache_Plugin_Admin();
46
  $plugins[] = new PgCache_Plugin_Admin();
47
  $plugins[] = new Minify_Plugin_Admin();
 
48
  $plugins[] = new Generic_WidgetSpreadTheWord_Plugin();
49
  $plugins[] = new Generic_Plugin_WidgetNews();
50
  $plugins[] = new Generic_Plugin_WidgetForum();
154
  }
155
  }
156
  }
157
+
158
+ global $w3tc_root;
159
+ if ( is_null( $w3tc_root ) ) {
160
+ $w3tc_root = new \W3TC\Root_Loader();
161
+ $w3tc_root->run();
162
+ }
Support_Page.php CHANGED
@@ -27,6 +27,34 @@ class Support_Page {
27
  'w3tc_support_first_name', $u->first_name );
28
  wp_localize_script( 'w3tc-options',
29
  'w3tc_support_last_name', $u->last_name );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
  /**
32
  * Support tab
27
  'w3tc_support_first_name', $u->first_name );
28
  wp_localize_script( 'w3tc-options',
29
  'w3tc_support_last_name', $u->last_name );
30
+
31
+ // values from widget
32
+ $w3tc_support_form_hash = 'm5pom8z0qy59rm';
33
+ $w3tc_support_field_name = '';
34
+ $w3tc_support_field_value = '';
35
+
36
+ if ( isset( $_GET['service_item'] ) ) {
37
+ $pos = (int) $_GET['service_item'];
38
+
39
+ $v = get_site_option( 'w3tc_generic_widgetservices' );
40
+ try {
41
+ $v = json_decode( $v, true );
42
+ if ( isset( $v['items'] ) && isset( $v['items'][$pos] )) {
43
+ $i = $v['items'][$pos];
44
+ $w3tc_support_form_hash = $i['form_hash'];
45
+ $w3tc_support_field_name = $i['parameter_name'];
46
+ $w3tc_support_field_value = $i['parameter_value'];
47
+ }
48
+ } catch ( \Exception $e ) {
49
+ }
50
+ }
51
+
52
+ wp_localize_script( 'w3tc-options', 'w3tc_support_form_hash',
53
+ $w3tc_support_form_hash );
54
+ wp_localize_script( 'w3tc-options', 'w3tc_support_field_name',
55
+ $w3tc_support_field_name );
56
+ wp_localize_script( 'w3tc-options', 'w3tc_support_field_value',
57
+ $w3tc_support_field_value );
58
  }
59
  /**
60
  * Support tab
Support_Page_View_PageContent.php CHANGED
@@ -1,12 +1,13 @@
1
  <?php include W3TC_INC_DIR . '/options/common/header.php'; ?>
2
 
3
  <div id="wufoo-m5pom8z0qy59rm"></div>
 
4
 
5
  <script type="text/javascript">var m5pom8z0qy59rm;(function(d, t) {
6
  var s = d.createElement(t);
7
  var options = {
8
  'userName':'w3edge',
9
- 'formHash':'m5pom8z0qy59rm',
10
  'autoResize':true,
11
  'height':'1145',
12
  'async':true,
@@ -21,6 +22,12 @@ var options = {
21
  'ssl':true
22
  };
23
 
 
 
 
 
 
 
24
  s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js';
25
  s.onload = s.onreadystatechange = function() {
26
  var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
1
  <?php include W3TC_INC_DIR . '/options/common/header.php'; ?>
2
 
3
  <div id="wufoo-m5pom8z0qy59rm"></div>
4
+ <form>
5
 
6
  <script type="text/javascript">var m5pom8z0qy59rm;(function(d, t) {
7
  var s = d.createElement(t);
8
  var options = {
9
  'userName':'w3edge',
10
+ 'formHash': w3tc_support_form_hash,
11
  'autoResize':true,
12
  'height':'1145',
13
  'async':true,
22
  'ssl':true
23
  };
24
 
25
+ if (w3tc_support_field_name.length > 0)
26
+ options.defaultValues += '&' +
27
+ encodeURI(w3tc_support_field_name) + '=' +
28
+ encodeURI(w3tc_support_field_value);
29
+
30
+
31
  s.src = ('https:' == d.location.protocol ? 'https://' : 'http://') + 'www.wufoo.com/scripts/embed/form.js';
32
  s.onload = s.onreadystatechange = function() {
33
  var rs = this.readyState; if (rs) if (rs != 'complete') if (rs != 'loaded') return;
SystemOpCache_GeneralPage_View.php CHANGED
@@ -32,7 +32,7 @@ Util_Ui::config_item( array(
32
 
33
  Util_Ui::config_item( array(
34
  'key' => 'opcache.validate_timestamps',
35
- 'label' => 'Validate Timestamps',
36
  'control' => 'checkbox',
37
  'disabled' => true,
38
  'value' => $validate_timestamps,
32
 
33
  Util_Ui::config_item( array(
34
  'key' => 'opcache.validate_timestamps',
35
+ 'label' => 'Validate timestamps:',
36
  'control' => 'checkbox',
37
  'disabled' => true,
38
  'value' => $validate_timestamps,
UsageStatistics_ConfigLabels.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- namespace W3TC;
3
-
4
- class UsageStatistics_ConfigLabels {
5
- public function config_labels( $config_labels ) {
6
- return array_merge( $config_labels, array(
7
- 'stats.enabled' => __( 'Collect and display usage statistics', 'w3-total-cache' ),
8
- ) );
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
UsageStatistics_Plugin_Admin.php CHANGED
@@ -5,9 +5,6 @@ namespace W3TC;
5
 
6
  class UsageStatistics_Plugin_Admin {
7
  function run() {
8
- $config_labels = new UsageStatistics_ConfigLabels();
9
- add_filter( 'w3tc_config_labels', array( $config_labels, 'config_labels' ) );
10
-
11
  add_action( 'w3tc_settings_general_boxarea_miscellaneous_content',
12
  array( $this, 'w3tc_settings_general_boxarea_miscellaneous_content' ) );
13
 
5
 
6
  class UsageStatistics_Plugin_Admin {
7
  function run() {
 
 
 
8
  add_action( 'w3tc_settings_general_boxarea_miscellaneous_content',
9
  array( $this, 'w3tc_settings_general_boxarea_miscellaneous_content' ) );
10
 
UsageStatistics_View_General.php CHANGED
@@ -9,14 +9,24 @@ if ( !defined( 'W3TC' ) )
9
  <th colspan="2">
10
  <?php
11
 
12
- $key = 'stats.enabled';
13
  $c = Dispatcher::config();
 
 
 
14
  $value = $c->get( $key );
15
- $label = Util_Ui::config_label( $key );
 
 
16
  $name = Util_Ui::config_key_to_http_name( $key );
17
- Util_Ui::checkbox( $key, $name, $value, $c->is_sealed( 'common.' ),
18
- $label );
 
 
 
 
19
 
 
 
20
  ?>
21
  </th>
22
  </tr>
9
  <th colspan="2">
10
  <?php
11
 
 
12
  $c = Dispatcher::config();
13
+ $is_pro = Util_Environment::is_w3tc_pro( $c );
14
+
15
+ $key = 'stats.enabled';
16
  $value = $c->get( $key );
17
+ if ( !$is_pro )
18
+ $value = false;
19
+
20
  $name = Util_Ui::config_key_to_http_name( $key );
21
+ Util_Ui::checkbox( $key,
22
+ $name,
23
+ $value,
24
+ $c->is_sealed( 'common.' ) || !$is_pro,
25
+ __( 'Enable caching statistics (on dashboard)', 'w3-total-cache' )
26
+ );
27
 
28
+ if ( !$is_pro )
29
+ echo ' (Available after <a href="#" class="button-buy-plugin">upgrade</a>)';
30
  ?>
31
  </th>
32
  </tr>
UsageStatistics_Widget.php CHANGED
@@ -22,7 +22,10 @@ class UsageStatistics_Widget {
22
 
23
  function w3tc_widget_setup() {
24
  Util_Widget::add( 'w3tc_usage_statistics',
25
- __( 'Usage Statistics', 'w3-total-cache' ),
 
 
 
26
  array( $this, 'widget_form' ),
27
  Util_Ui::admin_url( 'admin.php?page=w3tc_general#miscellaneous' ),
28
  'normal' );
@@ -34,7 +37,7 @@ class UsageStatistics_Widget {
34
  $storage = new UsageStatistics_StorageReader();
35
  $summary_promise = $storage->get_history_summary_promise();
36
  $c = Dispatcher::config();
37
- if ( $c->get_boolean( 'stats.enabled' ) )
38
  include W3TC_DIR . '/UsageStatistics_Widget_View.php';
39
  else
40
  include W3TC_DIR . '/UsageStatistics_Widget_View_Disabled.php';
22
 
23
  function w3tc_widget_setup() {
24
  Util_Widget::add( 'w3tc_usage_statistics',
25
+ '<div class="w3tc-widget-w3tc-logo"></div>' .
26
+ '<div class="w3tc-widget-text">' .
27
+ __( 'Caching Statistics', 'w3-total-cache' ) .
28
+ '</div>',
29
  array( $this, 'widget_form' ),
30
  Util_Ui::admin_url( 'admin.php?page=w3tc_general#miscellaneous' ),
31
  'normal' );
37
  $storage = new UsageStatistics_StorageReader();
38
  $summary_promise = $storage->get_history_summary_promise();
39
  $c = Dispatcher::config();
40
+ if ( $c->get_boolean( 'stats.enabled' ) && Util_Environment::is_w3tc_pro( $c ) )
41
  include W3TC_DIR . '/UsageStatistics_Widget_View.php';
42
  else
43
  include W3TC_DIR . '/UsageStatistics_Widget_View_Disabled.php';
UsageStatistics_Widget_View_Disabled.php CHANGED
@@ -5,5 +5,5 @@ if ( !defined( 'W3TC' ) )
5
  die();
6
  ?>
7
  <p class="ustats_p ustats_top">
8
- Not active
9
  </p>
5
  die();
6
  ?>
7
  <p class="ustats_p ustats_top">
8
+ Not active. Activate <a href="?page=w3tc_general#common__track_usage">here</a>
9
  </p>
Util_Environment.php CHANGED
@@ -184,9 +184,8 @@ class Util_Environment {
184
  /**
185
  * Returns header W3TC adds to responses powered by itself
186
  */
187
- static public function w3tc_header( $config ) {
188
  return W3TC_POWERED_BY .
189
- ( Util_Environment::is_w3tc_pro( $config ) ? ' Pro' : '' ) .
190
  '/' . W3TC_VERSION;
191
  }
192
 
@@ -330,7 +329,7 @@ class Util_Environment {
330
  * @return string
331
  */
332
  static public function cache_dir( $section ) {
333
- return W3TC_CACHE_DIR . '/' . $section;
334
  }
335
 
336
  /**
@@ -347,11 +346,11 @@ class Util_Environment {
347
  if ( is_null( $blog_id ) )
348
  $blog_id = Util_Environment::blog_id();
349
 
350
- $postfix = '/' . sprintf( '%d', $blog_id );
351
 
352
  if ( defined( 'W3TC_BLOG_LEVELS' ) ) {
353
  for ( $n = 0; $n < W3TC_BLOG_LEVELS; $n++ )
354
- $postfix = '/' .
355
  substr( $postfix, strlen( $postfix ) - 1 - $n, 1 ) .
356
  $postfix;
357
  }
@@ -486,7 +485,7 @@ class Util_Environment {
486
  }
487
  }
488
 
489
- return str_replace( '\\', '/', $home_path );
490
  }
491
 
492
 
@@ -674,7 +673,7 @@ class Util_Environment {
674
  static public function wp_config_path() {
675
  $search = array(
676
  ABSPATH . 'wp-config.php',
677
- dirname( ABSPATH ) . '/wp-config.php'
678
  );
679
 
680
  foreach ( $search as $path ) {
@@ -805,7 +804,8 @@ class Util_Environment {
805
  // common encoded characters
806
  $path_relative_to_home = str_replace( '%20', ' ', $path_relative_to_home );
807
 
808
- $full_filename = $home_path . '/' . trim( $path_relative_to_home, '/' );
 
809
 
810
  $docroot = Util_Environment::document_root();
811
  if ( substr( $full_filename, 0, strlen( $docroot ) ) == $docroot )
@@ -817,9 +817,9 @@ class Util_Environment {
817
  // sometimes urls (coming from other plugins/themes)
818
  // contain multiple "/" like "my-folder//myfile.js" which
819
  // fails to recognize by filesystem, while url is accessible
820
- $docroot_filename = str_replace( '//', '/', $docroot_filename );
821
 
822
- return ltrim( $docroot_filename, '/' );
823
  }
824
 
825
  /**
184
  /**
185
  * Returns header W3TC adds to responses powered by itself
186
  */
187
+ static public function w3tc_header() {
188
  return W3TC_POWERED_BY .
 
189
  '/' . W3TC_VERSION;
190
  }
191
 
329
  * @return string
330
  */
331
  static public function cache_dir( $section ) {
332
+ return W3TC_CACHE_DIR . DIRECTORY_SEPARATOR . $section;
333
  }
334
 
335
  /**
346
  if ( is_null( $blog_id ) )
347
  $blog_id = Util_Environment::blog_id();
348
 
349
+ $postfix = DIRECTORY_SEPARATOR . sprintf( '%d', $blog_id );
350
 
351
  if ( defined( 'W3TC_BLOG_LEVELS' ) ) {
352
  for ( $n = 0; $n < W3TC_BLOG_LEVELS; $n++ )
353
+ $postfix = DIRECTORY_SEPARATOR .
354
  substr( $postfix, strlen( $postfix ) - 1 - $n, 1 ) .
355
  $postfix;
356
  }
485
  }
486
  }
487
 
488
+ return str_replace( '\\', DIRECTORY_SEPARATOR, $home_path );
489
  }
490
 
491
 
673
  static public function wp_config_path() {
674
  $search = array(
675
  ABSPATH . 'wp-config.php',
676
+ dirname( ABSPATH ) . DIRECTORY_SEPARATOR . 'wp-config.php'
677
  );
678
 
679
  foreach ( $search as $path ) {
804
  // common encoded characters
805
  $path_relative_to_home = str_replace( '%20', ' ', $path_relative_to_home );
806
 
807
+ $full_filename = $home_path . DIRECTORY_SEPARATOR .
808
+ trim( $path_relative_to_home, DIRECTORY_SEPARATOR );
809
 
810
  $docroot = Util_Environment::document_root();
811
  if ( substr( $full_filename, 0, strlen( $docroot ) ) == $docroot )
817
  // sometimes urls (coming from other plugins/themes)
818
  // contain multiple "/" like "my-folder//myfile.js" which
819
  // fails to recognize by filesystem, while url is accessible
820
+ $docroot_filename = str_replace( '//', DIRECTORY_SEPARATOR, $docroot_filename );
821
 
822
+ return ltrim( $docroot_filename, DIRECTORY_SEPARATOR );
823
  }
824
 
825
  /**
Util_PageUrls.php CHANGED
@@ -91,7 +91,7 @@ class Util_PageUrls {
91
 
92
  if ( !isset( $post_urls[$post_id] ) ) {
93
  $full_urls = array();
94
- $post_link = post_permalink( $post_id );
95
  $post_uri = str_replace( Util_Environment::home_domain_root_url(), '', $post_link );
96
 
97
  $full_urls[] = $post_link;
91
 
92
  if ( !isset( $post_urls[$post_id] ) ) {
93
  $full_urls = array();
94
+ $post_link = get_permalink( $post_id );
95
  $post_uri = str_replace( Util_Environment::home_domain_root_url(), '', $post_link );
96
 
97
  $full_urls[] = $post_link;
Util_Rule.php CHANGED
@@ -13,7 +13,7 @@ class Util_Rule {
13
  static public function filename_to_uri( $filename ) {
14
  $url = Util_Environment::filename_to_url( $filename );
15
  $parsed = parse_url( $url );
16
- $uri = isset( $parsed['path'] ) ? ltrim( $parsed['path'], '/' ) : '';
17
  $uri = '/' . $uri;
18
 
19
  return $uri;
@@ -107,7 +107,7 @@ class Util_Rule {
107
  switch ( true ) {
108
  case Util_Environment::is_apache():
109
  case Util_Environment::is_litespeed():
110
- return W3TC_CACHE_MINIFY_DIR . '/.htaccess';
111
 
112
  case Util_Environment::is_nginx():
113
  return Util_Rule::get_nginx_rules_path();
@@ -125,7 +125,7 @@ class Util_Rule {
125
  switch ( true ) {
126
  case Util_Environment::is_apache():
127
  case Util_Environment::is_litespeed():
128
- return W3TC_CACHE_MINIFY_DIR . '/.htaccess';
129
 
130
  case Util_Environment::is_nginx():
131
  return Util_Rule::get_nginx_rules_path();
@@ -218,7 +218,9 @@ class Util_Rule {
218
  * @return string
219
  */
220
  static public function erase_rules( $rules, $start, $end ) {
221
- $rules = preg_replace( '~' . Util_Environment::preg_quote( $start ) . "\n.*?" . Util_Environment::preg_quote( $end ) . "\n*~s", '', $rules );
 
 
222
  $rules = Util_Rule::trim_rules( $rules );
223
 
224
  return $rules;
@@ -380,12 +382,12 @@ class Util_Rule {
380
  if ( preg_match( '~http(s)?://(.+?)(/)?$~', $url, $match ) ) {
381
  $home_path = $match[2];
382
 
383
- return W3TC_CACHE_PAGE_ENHANCED_DIR . '/' .
384
- $home_path . '/.htaccess';
385
  }
386
  }
387
 
388
- return W3TC_CACHE_PAGE_ENHANCED_DIR . '/.htaccess';
389
 
390
  case Util_Environment::is_nginx():
391
  return Util_Rule::get_nginx_rules_path();
13
  static public function filename_to_uri( $filename ) {
14
  $url = Util_Environment::filename_to_url( $filename );
15
  $parsed = parse_url( $url );
16
+ $uri = isset( $parsed['path'] ) ? ltrim( $parsed['path'], DIRECTORY_SEPARATOR ) : '';
17
  $uri = '/' . $uri;
18
 
19
  return $uri;
107
  switch ( true ) {
108
  case Util_Environment::is_apache():
109
  case Util_Environment::is_litespeed():
110
+ return W3TC_CACHE_MINIFY_DIR . DIRECTORY_SEPARATOR . '.htaccess';
111
 
112
  case Util_Environment::is_nginx():
113
  return Util_Rule::get_nginx_rules_path();
125
  switch ( true ) {
126
  case Util_Environment::is_apache():
127
  case Util_Environment::is_litespeed():
128
+ return W3TC_CACHE_MINIFY_DIR . DIRECTORY_SEPARATOR . '.htaccess';
129
 
130
  case Util_Environment::is_nginx():
131
  return Util_Rule::get_nginx_rules_path();
218
  * @return string
219
  */
220
  static public function erase_rules( $rules, $start, $end ) {
221
+ $r = '~' . Util_Environment::preg_quote( $start ) . "\n.*?" . Util_Environment::preg_quote( $end ) . "\n*~s";
222
+
223
+ $rules = preg_replace( $r, '', $rules );
224
  $rules = Util_Rule::trim_rules( $rules );
225
 
226
  return $rules;
382
  if ( preg_match( '~http(s)?://(.+?)(/)?$~', $url, $match ) ) {
383
  $home_path = $match[2];
384
 
385
+ return W3TC_CACHE_PAGE_ENHANCED_DIR . DIRECTORY_SEPARATOR .
386
+ $home_path . DIRECTORY_SEPARATOR . '.htaccess';
387
  }
388
  }
389
 
390
+ return W3TC_CACHE_PAGE_ENHANCED_DIR . DIRECTORY_SEPARATOR . '.htaccess';
391
 
392
  case Util_Environment::is_nginx():
393
  return Util_Rule::get_nginx_rules_path();
Util_UsageStatistics.php CHANGED
@@ -25,16 +25,6 @@ class Util_UsageStatistics {
25
 
26
 
27
 
28
- static public function float( $a, $p1, $p2 = null ) {
29
- $v = self::v( $a, $p1, $p2 );
30
- if ( is_null( $v ) )
31
- return 'n/a';
32
- else
33
- return sprintf( '%.1f', $v );
34
- }
35
-
36
-
37
-
38
  static public function percent( $v1, $v2 ) {
39
  if ( $v2 == 0 )
40
  return '0 %';
25
 
26
 
27
 
 
 
 
 
 
 
 
 
 
 
28
  static public function percent( $v1, $v2 ) {
29
  if ( $v2 == 0 )
30
  return '0 %';
changelog.txt CHANGED
@@ -526,7 +526,7 @@
526
  * Added configuration file import / export
527
  * Database caching now disabled by default to improve compatibility with some shared hosting environments
528
  * Default page caching method now disk enhanced
529
- * Improved HTTP Compression inter-operability
530
  * Improved compatibility with Multi Site Manager
531
  * Improved apache compatibility
532
  * Improved .htaccess directives
526
  * Added configuration file import / export
527
  * Database caching now disabled by default to improve compatibility with some shared hosting environments
528
  * Default page caching method now disk enhanced
529
+ * Improved HTTP Compression interoperability
530
  * Improved compatibility with Multi Site Manager
531
  * Improved apache compatibility
532
  * Improved .htaccess directives
extension-example/Extension_Example_Admin.php CHANGED
@@ -23,6 +23,7 @@ class Extension_Example_Admin {
23
  'author_uri' => 'https://www.w3-edge.com/',
24
  'extension_uri' => 'https://www.w3-edge.com/',
25
  'extension_id' => 'example',
 
26
  'version' => '1.0',
27
  'enabled' => true,
28
  'requirements' => '',
23
  'author_uri' => 'https://www.w3-edge.com/',
24
  'extension_uri' => 'https://www.w3-edge.com/',
25
  'extension_id' => 'example',
26
+ 'settings_exists' => true,
27
  'version' => '1.0',
28
  'enabled' => true,
29
  'requirements' => '',
inc/define.php CHANGED
@@ -10,28 +10,16 @@ if (@is_dir(W3TC_DIR) && file_exists(W3TC_DIR . '/w3-total-cache-api.php')) {
10
 
11
  define('W3TC_LIB_W3_DIR', W3TC_DIR);
12
 
13
- function w3_instance($class) {
14
- $modified_class = null;
15
-
16
- if ($class == 'W3_Redirect')
17
- $modified_class = 'Mobile_Redirect';
18
- else if ($class == 'W3_Config')
19
- $modified_class = 'Config';
20
- else if ($class == 'W3_PgCache')
21
- $modified_class = 'PgCache_ContentGrabber';
22
- else if ($class == 'W3_PgCache')
23
- $modified_class = 'PgCache_ContentGrabber';
24
- else if ($class == 'W3_ObjectCacheBridge')
25
- $modified_class = 'ObjectCache_WpObjectCache';
26
-
27
- return \W3TC\Dispatcher::component($modified_class);
28
  }
29
 
30
- function w3_require_once($file) {
 
31
  }
32
 
33
  class W3_Db {
34
  static public function instance() {
35
  return \W3TC\DbCache_Wpdb::instance();
36
  }
37
- }
 
10
 
11
  define('W3TC_LIB_W3_DIR', W3TC_DIR);
12
 
13
+ function w3_require_once($file) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
 
16
+ function w3_is_dbcluster() {
17
+ return false;
18
  }
19
 
20
  class W3_Db {
21
  static public function instance() {
22
  return \W3TC\DbCache_Wpdb::instance();
23
  }
24
+ }
25
+
inc/lightbox/cdn_s3_bucket_location.php CHANGED
@@ -11,9 +11,7 @@
11
  </label>
12
  </p>
13
  <p>
 
14
  <input id="cdn_create_container" class="button-primary {type: '<?php echo $type; ?>', nonce: '<?php echo wp_create_nonce( 'w3tc' ); ?>'}" type="button" value="<?php _e( 'Create bucket', 'w3-total-cache' ); ?>" />
15
  <span id="cdn_create_container_status" class="w3tc-status w3tc-process"></span>
16
  </p>
17
- <p style="text-align: center;">
18
- <input class="button" type="button" value="<?php _e( 'Close', 'w3-total-cache' ); ?>" />
19
- </p>
11
  </label>
12
  </p>
13
  <p>
14
+ <input class="button" type="button" value="<?php _e( 'Close', 'w3-total-cache' ); ?>" style="float: right" />
15
  <input id="cdn_create_container" class="button-primary {type: '<?php echo $type; ?>', nonce: '<?php echo wp_create_nonce( 'w3tc' ); ?>'}" type="button" value="<?php _e( 'Create bucket', 'w3-total-cache' ); ?>" />
16
  <span id="cdn_create_container_status" class="w3tc-status w3tc-process"></span>
17
  </p>
 
 
 
inc/lightbox/edge.php CHANGED
@@ -13,7 +13,7 @@ if ( !defined( 'W3TC' ) )
13
  <p><strong><?php _e( 'Enable "Edge Mode" to opt-in to pre-release features or simply close this window to continue to enjoy bug fixes, security fixes and stable updates only.', 'w3-total-cache' ) ?></strong></p>
14
  <p><?php _e( 'We want to ensure that those who are interested in ongoing performance optimizations always have access to the latest functionality and optimization techniques. Those who enable edge mode should have experience in troubleshooting WordPress installations.', 'w3-total-cache' ) ?></p>
15
  </div>
16
- <div class="footer">
17
  <?php
18
  echo Util_Ui::action_button( __( 'Enable Edge Mode', 'w3-total-cache' ),
19
  Util_Ui::url( array( 'w3tc_edge_mode_enable' => 'y' ) ),
13
  <p><strong><?php _e( 'Enable "Edge Mode" to opt-in to pre-release features or simply close this window to continue to enjoy bug fixes, security fixes and stable updates only.', 'w3-total-cache' ) ?></strong></p>
14
  <p><?php _e( 'We want to ensure that those who are interested in ongoing performance optimizations always have access to the latest functionality and optimization techniques. Those who enable edge mode should have experience in troubleshooting WordPress installations.', 'w3-total-cache' ) ?></p>
15
  </div>
16
+ <div class="w3tc_overlay_footer">
17
  <?php
18
  echo Util_Ui::action_button( __( 'Enable Edge Mode', 'w3-total-cache' ),
19
  Util_Ui::url( array( 'w3tc_edge_mode_enable' => 'y' ) ),
inc/lightbox/self_test.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'W3TC' ) )
5
  die();
6
 
7
  ?>
8
- <h3><?php _e( 'Compatibility Test', 'w3-total-cache' ); ?></h3>
9
 
10
  <fieldset>
11
  <legend><?php _e( 'Legend', 'w3-total-cache' ); ?></legend>
5
  die();
6
 
7
  ?>
8
+ <h3><?php _e( 'Compatibility Check', 'w3-total-cache' ); ?></h3>
9
 
10
  <fieldset>
11
  <legend><?php _e( 'Legend', 'w3-total-cache' ); ?></legend>
inc/lightbox/support_us.php CHANGED
@@ -90,7 +90,7 @@ echo Util_Ui::action_button(
90
  </label>
91
  </p>
92
  </div>
93
- <div class="footer">
94
  <p>
95
  <?php wp_nonce_field( 'w3tc' ) ?>
96
  <input type="submit" class="btn w3tc-size image w3tc-button-save btn-primary outset save palette-turquoise " value="Save &amp; close">
90
  </label>
91
  </p>
92
  </div>
93
+ <div class="w3tc_overlay_footer">
94
  <p>
95
  <?php wp_nonce_field( 'w3tc' ) ?>
96
  <input type="submit" class="btn w3tc-size image w3tc-button-save btn-primary outset save palette-turquoise " value="Save &amp; close">
inc/lightbox/upgrade.php CHANGED
@@ -7,32 +7,38 @@ if ( !defined( 'W3TC' ) )
7
  ?>
8
  <div id="w3tc-upgrade">
9
  <div class="w3tc-overlay-logo"></div>
10
- <header>
11
  <div>
12
- <div class="left" style="float:left">
13
- <h2>W3 Total Cache Pro unlocks more performance options for your website!</h2>
 
 
 
 
14
  </div>
15
- <div class="right" style="float:right">
16
- <h2>only $99 <span>/year</span></h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  </div>
18
- </div>
19
- <div class="description">
20
- <img src="<?php echo plugins_url( 'pub/img/overlay/w3-meteor.png', W3TC_FILE ) ?>" />
21
- <ul>
22
- <li><strong>Fragment Caching Extension</strong><br>
23
- Unlocking the fragment caching module delivers enhanced performance for plugins and themes that use the WordPress Transient API. StudioPress' Genesis Framework is up to 60% faster with W3TC Pro.</li>
24
- <li>
25
- <strong>WPML Extension</strong><br>
26
- Improve the performance of your WPML-powered site by unlocking W3TC Pro. </li>
27
- <li>
28
- <strong>Full Site Delivery</strong><br>
29
- Provide the best user experience possible by enhancing by hosting HTML pages and RSS feeds with (supported) CDN's high speed global networks. </li>
30
- </ul>
31
- </div>
32
- </header>
33
- <div class="content">
34
  </div>
35
- <div class="footer">
 
36
  <input id="w3tc-purchase" type="button" class="btn w3tc-size image btn-default palette-turquoise secure" value="<?php _e( 'Subscribe to Go Faster Now', 'w3-total-cache' ) ?> " />
37
  </div>
 
38
  </div>
7
  ?>
8
  <div id="w3tc-upgrade">
9
  <div class="w3tc-overlay-logo"></div>
10
+ <div class="w3tc_overlay_upgrade_header">
11
  <div>
12
+ <div class="w3tc_overlay_upgrade_left_h">
13
+ W3 Total Cache Pro unlocks more performance options for any website!
14
+ </div>
15
+ <div class="w3tc_overlay_upgrade_right_h">
16
+ only $99 <span class="w3tc_overlay_upgrade_right_text">/year</span>
17
+ </div>
18
  </div>
19
+ <div class="w3tc_overlay_upgrade_description">
20
+ <div class="w3tc_overlay_upgrade_content_l">
21
+ <img src="<?php echo plugins_url( 'pub/img/overlay/w3-meteor.png', W3TC_FILE ) ?>"
22
+ width="238" height="178" />
23
+ </div>
24
+ <div class="w3tc_overlay_upgrade_content_r">
25
+ <ul>
26
+ <li>
27
+ <strong>Full Site Delivery (FSD)</strong><br>
28
+ Provide the best user experience possible by enhancing by hosting HTML pages and RSS feeds with (supported) CDN's high speed global networks.</li>
29
+ <li><strong>Fragment Caching Module</strong><br>
30
+ Unlocking the fragment caching module delivers enhanced performance for plugins and themes that use the WordPress Transient API. StudioPress' Genesis Framework is up to 60% faster with W3TC Pro.</li>
31
+ <li>
32
+ <strong>WPML Extension</strong><br>
33
+ Improve the performance of your WPML-powered site by unlocking W3TC Pro.</li>
34
+ </ul>
35
+ </div>
36
  </div>
37
+ <div style="clear: both"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  </div>
39
+ <div class="w3tc_overlay_content"></div>
40
+ <div class="w3tc_overlay_footer">
41
  <input id="w3tc-purchase" type="button" class="btn w3tc-size image btn-default palette-turquoise secure" value="<?php _e( 'Subscribe to Go Faster Now', 'w3-total-cache' ) ?> " />
42
  </div>
43
+ <div style="clear: both"></div>
44
  </div>
inc/options/about.php CHANGED
@@ -26,7 +26,7 @@ if ( !defined( 'W3TC' ) )
26
  <li><?php _e( 'Caching of search results pages (i.e. <acronym title="Uniform Resource Identifier">URI</acronym>s with query string variables) in memory or on disk', 'w3-total-cache' ); ?></li>
27
  <li><?php _e( 'Minification of posts / pages and feeds', 'w3-total-cache' ); ?></li>
28
  <li><?php _e( 'Minification (concatenation and white space removal) of inline, external or 3rd party JavaScript / <acronym title="Cascading Style Sheet">CSS</acronym> with automated updates', 'w3-total-cache' ); ?></li>
29
- <li><?php _e( 'Complete header management including <a href="http://en.wikipedia.org/wiki/HTTP_ETag">Etags</a>', 'w3-total-cache' ); ?></li>
30
  <li><?php _e( 'JavaScript embedding group and location management', 'w3-total-cache' ); ?></li>
31
  <li><?php _e( 'Import post attachments directly into the Media Library (and <acronym title="Content Delivery Network">CDN</acronym>)', 'w3-total-cache' ); ?></li>
32
  </ul>
26
  <li><?php _e( 'Caching of search results pages (i.e. <acronym title="Uniform Resource Identifier">URI</acronym>s with query string variables) in memory or on disk', 'w3-total-cache' ); ?></li>
27
  <li><?php _e( 'Minification of posts / pages and feeds', 'w3-total-cache' ); ?></li>
28
  <li><?php _e( 'Minification (concatenation and white space removal) of inline, external or 3rd party JavaScript / <acronym title="Cascading Style Sheet">CSS</acronym> with automated updates', 'w3-total-cache' ); ?></li>
29
+ <li><?php _e( 'Complete header management including <a href="http://en.wikipedia.org/wiki/HTTP_ETag">ETags</a>', 'w3-total-cache' ); ?></li>
30
  <li><?php _e( 'JavaScript embedding group and location management', 'w3-total-cache' ); ?></li>
31
  <li><?php _e( 'Import post attachments directly into the Media Library (and <acronym title="Content Delivery Network">CDN</acronym>)', 'w3-total-cache' ); ?></li>
32
  </ul>
inc/options/browsercache.php CHANGED
@@ -57,8 +57,8 @@ if ( !defined( 'W3TC' ) )
57
  <th colspan="2">
58
  <label><input id="browsercache_etag" type="checkbox"
59
  <?php Util_Ui::sealing_disabled( 'browsercache.' ) ?>
60
- name="etag" value="1"<?php checked( $browsercache_etag, true ); ?> /> <?php _e( 'Set entity tag (eTag)', 'w3-total-cache' ); ?></label>
61
- <br /><span class="description"><?php _e( 'Set the Etag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
62
  </th>
63
  </tr>
64
  <tr>
@@ -122,14 +122,13 @@ Util_Ui::config_item( array(
122
  'key' => 'browsercache.rewrite',
123
  'disabled' => Util_Ui::sealing_disabled( 'browsercache.' ),
124
  'control' => 'checkbox',
125
- 'checkbox_label' => __( 'Rewrite URL structure of objects', 'w3-total-cache' ),
126
- 'description' => __( 'Generate unique URI for each file protected from caching by browser.', 'w3-total-cache' ),
127
  'style' => '2'
128
  ) );
129
  Util_Ui::config_item( array(
130
  'key' => 'browsercache.hsts',
131
- 'disabled' => Util_Ui::sealing_disabled( 'browsercache.' ) || !Util_Environment::is_https(),
132
- 'value' => ( Util_Environment::is_https() ? null : false ),
133
  'control' => 'checkbox',
134
  'checkbox_label' => __( 'Apply <acronym title="Hypertext Transfer Protocol">HTTP</acronym> Strict Transport Security policy', 'w3-total-cache' ),
135
  'description' => __( 'Set the <acronym title="HTTP Strict Transport Security">HSTS</acronym> header to maximize <acronym title="Secure Sockets Layer">SSL</acronym> security.', 'w3-total-cache' ),
@@ -196,7 +195,7 @@ Util_Ui::config_item( array(
196
  <tr>
197
  <th colspan="2">
198
  <?php $this->checkbox( 'browsercache.cssjs.etag' ) ?> <?php Util_Ui::e_config_label( 'browsercache.cssjs.etag' ) ?></label>
199
- <br /><span class="description"><?php _e( 'Set the Etag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
200
  </th>
201
  </tr>
202
  <tr>
@@ -283,7 +282,7 @@ Util_Ui::config_item( array(
283
  <tr>
284
  <th colspan="2">
285
  <?php $this->checkbox( 'browsercache.html.etag' ) ?> <?php Util_Ui::e_config_label( 'browsercache.html.etag' ) ?></label>
286
- <br /><span class="description"><?php _e( 'Set the Etag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
287
  </th>
288
  </tr>
289
  <tr>
@@ -356,7 +355,7 @@ Util_Ui::config_item( array(
356
  <tr>
357
  <th colspan="2">
358
  <?php $this->checkbox( 'browsercache.other.etag' ) ?> <?php Util_Ui::e_config_label( 'browsercache.other.etag' ) ?></label>
359
- <br /><span class="description"><?php _e( 'Set the Etag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
360
  </th>
361
  </tr>
362
  <tr>
57
  <th colspan="2">
58
  <label><input id="browsercache_etag" type="checkbox"
59
  <?php Util_Ui::sealing_disabled( 'browsercache.' ) ?>
60
+ name="etag" value="1"<?php checked( $browsercache_etag, true ); ?> /> <?php _e( 'Set entity tag (ETag)', 'w3-total-cache' ); ?></label>
61
+ <br /><span class="description"><?php _e( 'Set the ETag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
62
  </th>
63
  </tr>
64
  <tr>
122
  'key' => 'browsercache.rewrite',
123
  'disabled' => Util_Ui::sealing_disabled( 'browsercache.' ),
124
  'control' => 'checkbox',
125
+ 'checkbox_label' => __( 'Rewrite <acronym title="Universal Resource Locator">URL</acronym> structure of objects', 'w3-total-cache' ),
126
+ 'description' => __( 'Generate unique <acronym title="Universal Resource Indicator">URI</acronym> for each file protected from caching by browser.', 'w3-total-cache' ),
127
  'style' => '2'
128
  ) );
129
  Util_Ui::config_item( array(
130
  'key' => 'browsercache.hsts',
131
+ 'disabled' => Util_Ui::sealing_disabled( 'browsercache.' ),
 
132
  'control' => 'checkbox',
133
  'checkbox_label' => __( 'Apply <acronym title="Hypertext Transfer Protocol">HTTP</acronym> Strict Transport Security policy', 'w3-total-cache' ),
134
  'description' => __( 'Set the <acronym title="HTTP Strict Transport Security">HSTS</acronym> header to maximize <acronym title="Secure Sockets Layer">SSL</acronym> security.', 'w3-total-cache' ),
195
  <tr>
196
  <th colspan="2">
197
  <?php $this->checkbox( 'browsercache.cssjs.etag' ) ?> <?php Util_Ui::e_config_label( 'browsercache.cssjs.etag' ) ?></label>
198
+ <br /><span class="description"><?php _e( 'Set the ETag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
199
  </th>
200
  </tr>
201
  <tr>
282
  <tr>
283
  <th colspan="2">
284
  <?php $this->checkbox( 'browsercache.html.etag' ) ?> <?php Util_Ui::e_config_label( 'browsercache.html.etag' ) ?></label>
285
+ <br /><span class="description"><?php _e( 'Set the ETag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
286
  </th>
287
  </tr>
288
  <tr>
355
  <tr>
356
  <th colspan="2">
357
  <?php $this->checkbox( 'browsercache.other.etag' ) ?> <?php Util_Ui::e_config_label( 'browsercache.other.etag' ) ?></label>
358
+ <br /><span class="description"><?php _e( 'Set the ETag header to encourage browser caching of files.', 'w3-total-cache' ); ?></span>
359
  </th>
360
  </tr>
361
  <tr>
inc/options/dashboard.php CHANGED
@@ -40,7 +40,7 @@ echo implode( " $string ", apply_filters( 'w3tc_dashboard_actions', array() ) )
40
  <div class="content">
41
  <div id="dashboard-text" style="display:inline-block;">
42
  <h1><?php _e( 'Dashboard', 'w3-total-cache' )?></h1>
43
- <p>Thanks for choosing W3TC as your Web Performance Optimization (<acronym title="Web Performance Optimization">WPO</acronym>) framework. Eventually, the dashboard will provide at-a-glance insight into key performance indicators for this WordPress installation. Please share <a href="admin.php?page=w3tc_support&amp;request_type=new_feature">your suggestions</a> about the statistics and reporting you would like to see here!</p>
44
  </div>
45
  <div id="widgets-container">
46
  <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
40
  <div class="content">
41
  <div id="dashboard-text" style="display:inline-block;">
42
  <h1><?php _e( 'Dashboard', 'w3-total-cache' )?></h1>
43
+ <p>Thanks for choosing W3TC as your Web Performance Optimization (<acronym title="Web Performance Optimization">WPO</acronym>) framework. Please share <a href="admin.php?page=w3tc_support&amp;request_type=new_feature">your suggestions</a> about the statistics and reporting you would like to see!</p>
44
  </div>
45
  <div id="widgets-container">
46
  <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
inc/options/dbcache.php CHANGED
@@ -89,7 +89,7 @@ if ( $this->_config->get_string( 'dbcache.engine' ) == 'memcached' ) {
89
  </td>
90
  </tr>
91
  <tr>
92
- <th><label for="dbcache_reject_constants"><?php _e( 'Reject Constants:' ) ?></label></th>
93
  <td>
94
  <textarea id="dbcache_reject_constants" name="dbcache__reject__constants"
95
  <?php Util_Ui::sealing_disabled( 'dbcache.' ) ?> cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'dbcache.reject.constants' ) ) ); ?></textarea><br />
89
  </td>
90
  </tr>
91
  <tr>
92
+ <th><label for="dbcache_reject_constants"><?php _e( 'Reject constants:' ) ?></label></th>
93
  <td>
94
  <textarea id="dbcache_reject_constants" name="dbcache__reject__constants"
95
  <?php Util_Ui::sealing_disabled( 'dbcache.' ) ?> cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'dbcache.reject.constants' ) ) ); ?></textarea><br />
inc/options/extensions/list.php CHANGED
@@ -40,21 +40,22 @@ if ( !defined( 'W3TC' ) )
40
  </div>
41
  <br class="clear">
42
  </div>
43
- <table class="wp-list-table widefat plugins extensions" cellspacing="0">
44
  <thead>
45
  <tr>
46
- <th scope="col" id="cb" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-1"><?php _e( 'Select All', 'w3-total-cache' )?></label><input id="cb-select-all-1" type="checkbox"></th><th scope="col" id="name" class="manage-column column-name" style=""><?php _e( 'Extension', 'w3-total-cache' )?></th><th scope="col" id="description" class="manage-column column-description" style=""><?php _e( 'Description', 'w3-total-cache' )?></th>
47
  </tr>
48
  </thead>
49
  <tfoot>
50
  <tr>
51
- <th scope="col" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-2"><?php _e( 'Select All', 'w3-total-cache' )?></label><input id="cb-select-all-2" type="checkbox"></th><th scope="col" class="manage-column column-name" style=""><?php _e( 'Extension', 'w3-total-cache' )?></th><th scope="col" class="manage-column column-description" style=""><?php _e( 'Description', 'w3-total-cache' )?></th>
52
  </tr>
53
  </tfoot>
54
  <tbody id="the-list">
55
  <?php
56
  $cb_id = 0;
57
- foreach ( $extensions as $extension => $meta ):
 
58
  $meta = $this->default_meta( $meta );
59
  $cb_id++;
60
  ?>
@@ -62,14 +63,16 @@ $cb_id++;
62
  <tr id="<?php echo esc_attr( $extension )?>" class="<?php echo $config->is_extension_active( $extension ) ? 'active' : 'inactive'?>">
63
  <th scope="row" class="check-column">
64
  <label class="screen-reader-text" for="checkbox_<?php echo $cb_id?>"><?php printf( __( 'Select %s' ), $meta['name'] ) ?></label>
65
- <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $extension ) ?>" id="checkbox_<?php echo $cb_id?>" <?php disabled( !$meta['enabled'] )?>>
66
  </th>
67
  <td class="plugin-title">
68
  <strong><?php esc_html_e( $meta['name'] ) ?></strong>
69
  <div class="row-actions-visible">
70
  <?php if ( $config->is_extension_active( $extension ) ):
71
- $settings = '<a class="edit" href="' . esc_attr( Util_Ui::admin_url( sprintf( 'admin.php?page=w3tc_extensions&extension=%s', $extension ) ) ).'&action=view">'. __( 'Settings' ).'</a>';
72
- $extra_links = apply_filters( "w3tc_extension_plugin_links_{$extension}", array( $settings ) );
 
 
73
  $links = implode( ' | ', $extra_links );
74
  if ( $links ) {
75
  echo $links;
40
  </div>
41
  <br class="clear">
42
  </div>
43
+ <table class="wp-list-table widefat plugins w3tc_extensions" cellspacing="0">
44
  <thead>
45
  <tr>
46
+ <th scope="col" id="cb" class="w3tc_extensions_manage_column_check"><label class="screen-reader-text" for="cb-select-all-1"><?php _e( 'Select All', 'w3-total-cache' )?></label><input id="cb-select-all-1" type="checkbox" class="w3tc_extensions_manage_input_checkall"></th><th scope="col" id="name" class="manage-column column-name" style=""><?php _e( 'Extension', 'w3-total-cache' )?></th><th scope="col" id="description" class="manage-column column-description" style=""><?php _e( 'Description', 'w3-total-cache' )?></th>
47
  </tr>
48
  </thead>
49
  <tfoot>
50
  <tr>
51
+ <th scope="col" class="w3tc_extensions_manage_column_check"><label class="screen-reader-text" for="cb-select-all-2"><?php _e( 'Select All', 'w3-total-cache' )?></label><input id="cb-select-all-2" type="checkbox" class="w3tc_extensions_manage_input_checkall"></th><th scope="col" class="manage-column column-name" style=""><?php _e( 'Extension', 'w3-total-cache' )?></th><th scope="col" class="manage-column column-description" style=""><?php _e( 'Description', 'w3-total-cache' )?></th>
52
  </tr>
53
  </tfoot>
54
  <tbody id="the-list">
55
  <?php
56
  $cb_id = 0;
57
+ foreach ( $extension_keys as $extension ):
58
+ $meta = $extensions[$extension];
59
  $meta = $this->default_meta( $meta );
60
  $cb_id++;
61
  ?>
63
  <tr id="<?php echo esc_attr( $extension )?>" class="<?php echo $config->is_extension_active( $extension ) ? 'active' : 'inactive'?>">
64
  <th scope="row" class="check-column">
65
  <label class="screen-reader-text" for="checkbox_<?php echo $cb_id?>"><?php printf( __( 'Select %s' ), $meta['name'] ) ?></label>
66
+ <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $extension ) ?>" id="checkbox_<?php echo $cb_id?>" class="w3tc_extensions_input_active" <?php disabled( !$meta['enabled'] )?>>
67
  </th>
68
  <td class="plugin-title">
69
  <strong><?php esc_html_e( $meta['name'] ) ?></strong>
70
  <div class="row-actions-visible">
71
  <?php if ( $config->is_extension_active( $extension ) ):
72
+ $extra_links = array();
73
+ if ( isset( $meta['settings_exists'] ) && $meta['settings_exists'] )
74
+ $extra_links[] = '<a class="edit" href="' . esc_attr( Util_Ui::admin_url( sprintf( 'admin.php?page=w3tc_extensions&extension=%s', $extension ) ) ).'&action=view">'. __( 'Settings' ).'</a>';
75
+ $extra_links = apply_filters( "w3tc_extension_plugin_links_{$extension}", $extra_links );
76
  $links = implode( ' | ', $extra_links );
77
  if ( $links ) {
78
  echo $links;
inc/options/general.php CHANGED
@@ -519,7 +519,7 @@ Util_Ui::config_item( array(
519
 
520
  <table class="form-table">
521
  <tr>
522
- <th><?php _e( 'Debug Mode:', 'w3-total-cache' ); ?></th>
523
  <td>
524
  <?php $this->checkbox_debug( 'pgcache.debug' ) ?> <?php Util_Ui::e_config_label( 'pgcache.debug' ) ?></label><br />
525
  <?php $this->checkbox_debug( 'minify.debug' ) ?> <?php Util_Ui::e_config_label( 'minify.debug' ) ?></label><br />
519
 
520
  <table class="form-table">
521
  <tr>
522
+ <th><?php _e( 'Debug mode:', 'w3-total-cache' ); ?></th>
523
  <td>
524
  <?php $this->checkbox_debug( 'pgcache.debug' ) ?> <?php Util_Ui::e_config_label( 'pgcache.debug' ) ?></label><br />
525
  <?php $this->checkbox_debug( 'minify.debug' ) ?> <?php Util_Ui::e_config_label( 'minify.debug' ) ?></label><br />
inc/options/pgcache.php CHANGED
@@ -101,7 +101,7 @@ echo sprintf( __( 'To rebuild the page cache use the %s operation', 'w3-total-ca
101
  Util_Ui::config_item( array(
102
  'key' => 'pgcache.mirrors.enabled',
103
  'control' => 'checkbox',
104
- 'label' => __( 'Cache Alias Hostnames:', 'w3-total-cache' ),
105
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
106
  'enabled' => !Util_Environment::is_wpmu_subdomain(),
107
  'description' => __( 'If the same Wordpress content is accessed from different domains',
@@ -110,9 +110,9 @@ Util_Ui::config_item( array(
110
  Util_Ui::config_item( array(
111
  'key' => 'pgcache.mirrors.home_urls',
112
  'control' => 'textarea',
113
- 'label' => __( 'Additional Home URLs:', 'w3-total-cache' ),
114
  'enabled' => !Util_Environment::is_wpmu_subdomain(),
115
- 'description' => __( 'Specify full home URLs of your mirrors so that plugin will flush it\'s cache when content is changed. For example:<br /> http://my-site.com<br />http://www.my-site.com<br />https://my-site.com',
116
  'w3-total-cache' )
117
  ) );
118
  ?>
@@ -151,7 +151,7 @@ Util_Ui::config_item( array(
151
  <input id="pgcache_prime_sitemap" type="text" name="pgcache__prime__sitemap"
152
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
153
  value="<?php echo esc_attr( $this->_config->get_string( 'pgcache.prime.sitemap' ) ); ?>" size="100" /><br />
154
- <span class="description"><?php _e( 'A <a href="http://www.xml-sitemaps.com/validate-xml-sitemap.html" target="_blank">compliant</a> sitemap can be used to specify the pages to maintain in the primed cache. Pages will be cached according to the priorities specified in the <acronym title="Extensible Markup Language">XML</acronym> file. Due to its completeness and integrations, <a href="http://wordpress.org/extend/plugins/wordpress-seo/" target="_blank">Yoast SEO</a> is recommended for use with this feature.', 'w3-total-cache' ); ?></span>
155
  </td>
156
  </tr>
157
  <tr>
@@ -262,7 +262,7 @@ Util_Ui::postbox_header( __( 'Purge Policy: ', 'w3-total-cache' ) . implode( ',
262
  <td>
263
  <input type="hidden" name="pgcache__late_caching" value="0" />
264
  <label><input id="pgcache_late_caching" type="checkbox" name="pgcache__late_caching" value="1"<?php checked( $this->_config->get_string( 'pgcache.engine' ) != 'file_generic' && $this->_config->get_boolean( 'pgcache.late_caching' ) ); ?> <?php disabled( $this->_config->get_string( 'pgcache.engine' ), 'file_generic' ) ?> /> <?php _e( 'Enable', 'w3-total-cache' ); ?></label>
265
- <br /><span class="description"><?php _e( 'Allows to overwrite page caching key via custom filters by postponing entry extraction to the init action', 'w3-total-cache' )?></span>
266
  </td>
267
  </tr>
268
  <?php
@@ -276,7 +276,7 @@ if ( $this->_config->get_string( 'pgcache.engine' ) == 'memcached' ) {
276
  ?>
277
  <?php if ( $this->_config->get_string( 'pgcache.engine' ) == 'file_generic' ): ?>
278
  <tr>
279
- <th><label><?php _e( 'Compatibility mode', 'w3-total-cache' ); ?></label></th>
280
  <td>
281
  <?php $this->checkbox( 'pgcache.compatibility' ) ?> <?php Util_Ui::e_config_label( 'pgcache.compatibility' ) ?></label><br />
282
  <span class="description"><?php _e( 'Decreases performance by ~20% at scale in exchange for increasing interoperability with more hosting environments and WordPress idiosyncrasies. This option should be enabled for most sites', 'w3-total-cache' ); ?></span>
@@ -299,7 +299,7 @@ if ( $this->_config->get_string( 'pgcache.engine' ) == 'memcached' ) {
299
  <?php else: ?>
300
  <?php $this->checkbox( 'pgcache.reject.request_head', false, '', false ) ?><?php Util_Ui::e_config_label( 'pgcache.reject.request_head' ) ?><br />
301
  <?php endif; ?>
302
- <span class="description"><?php _e( 'If disabled, HEAD requests can often be cached resulting in "empty pages" being returned for subsequent requests for a <acronym title="Uniform Resource Indicator">URL</acronym>.', 'w3-total-cache' ); ?></span>
303
  </td>
304
  </tr>
305
  <?php endif; ?>
@@ -336,7 +336,7 @@ if ( $this->_config->get_string( 'pgcache.engine' ) == 'memcached' ) {
336
  <textarea id="pgcache_accept_qs" name="pgcache__accept__qs"
337
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
338
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.accept.qs' ) ) ); ?></textarea><br />
339
- <span class="description"><?php _e( 'Always cache URLs with these query strings.', 'w3-total-cache' ); ?></span>
340
  </td>
341
  </tr>
342
  <tr>
101
  Util_Ui::config_item( array(
102
  'key' => 'pgcache.mirrors.enabled',
103
  'control' => 'checkbox',
104
+ 'label' => __( 'Cache alias hostnames:', 'w3-total-cache' ),
105
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
106
  'enabled' => !Util_Environment::is_wpmu_subdomain(),
107
  'description' => __( 'If the same Wordpress content is accessed from different domains',
110
  Util_Ui::config_item( array(
111
  'key' => 'pgcache.mirrors.home_urls',
112
  'control' => 'textarea',
113
+ 'label' => __( 'Additional home <acronym title="Uniform Resource Locator">URL</acronym>s:', 'w3-total-cache' ),
114
  'enabled' => !Util_Environment::is_wpmu_subdomain(),
115
+ 'description' => __( 'Specify full home <acronym title="Uniform Resource Locator">URL</acronym>s of your mirrors so that plugin will flush it\'s cache when content is changed. For example:<br /> http://my-site.com<br />http://www.my-site.com<br />https://my-site.com',
116
  'w3-total-cache' )
117
  ) );
118
  ?>
151
  <input id="pgcache_prime_sitemap" type="text" name="pgcache__prime__sitemap"
152
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
153
  value="<?php echo esc_attr( $this->_config->get_string( 'pgcache.prime.sitemap' ) ); ?>" size="100" /><br />
154
+ <span class="description"><?php _e( 'A <a href="http://www.xml-sitemaps.com/validate-xml-sitemap.html" target="_blank">compliant</a> sitemap can be used to specify the pages to maintain in the primed cache. Pages will be cached according to the priorities specified in the <acronym title="Extensible Markup Language">XML</acronym> file.', 'w3-total-cache' ); ?></span>
155
  </td>
156
  </tr>
157
  <tr>
262
  <td>
263
  <input type="hidden" name="pgcache__late_caching" value="0" />
264
  <label><input id="pgcache_late_caching" type="checkbox" name="pgcache__late_caching" value="1"<?php checked( $this->_config->get_string( 'pgcache.engine' ) != 'file_generic' && $this->_config->get_boolean( 'pgcache.late_caching' ) ); ?> <?php disabled( $this->_config->get_string( 'pgcache.engine' ), 'file_generic' ) ?> /> <?php _e( 'Enable', 'w3-total-cache' ); ?></label>
265
+ <br /><span class="description"><?php _e( 'Allows overwriting of page caching key via custom filters by postponing entry extraction in the init action.', 'w3-total-cache' )?></span>
266
  </td>
267
  </tr>
268
  <?php
276
  ?>
277
  <?php if ( $this->_config->get_string( 'pgcache.engine' ) == 'file_generic' ): ?>
278
  <tr>
279
+ <th><label><?php _e( 'Compatibility mode:', 'w3-total-cache' ); ?></label></th>
280
  <td>
281
  <?php $this->checkbox( 'pgcache.compatibility' ) ?> <?php Util_Ui::e_config_label( 'pgcache.compatibility' ) ?></label><br />
282
  <span class="description"><?php _e( 'Decreases performance by ~20% at scale in exchange for increasing interoperability with more hosting environments and WordPress idiosyncrasies. This option should be enabled for most sites', 'w3-total-cache' ); ?></span>
299
  <?php else: ?>
300
  <?php $this->checkbox( 'pgcache.reject.request_head', false, '', false ) ?><?php Util_Ui::e_config_label( 'pgcache.reject.request_head' ) ?><br />
301
  <?php endif; ?>
302
+ <span class="description"><?php _e( 'If disabled, HEAD requests can often be cached resulting in "empty pages" being returned for subsequent requests for a <acronym title="Uniform Resource Locator">URL</acronym>.', 'w3-total-cache' ); ?></span>
303
  </td>
304
  </tr>
305
  <?php endif; ?>
336
  <textarea id="pgcache_accept_qs" name="pgcache__accept__qs"
337
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
338
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.accept.qs' ) ) ); ?></textarea><br />
339
+ <span class="description"><?php _e( 'Always cache <acronym title="Uniform Resource Locator">URL</acronym>s with these query strings.', 'w3-total-cache' ); ?></span>
340
  </td>
341
  </tr>
342
  <tr>
inc/widget/services.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- namespace W3TC;
3
-
4
- if ( !defined( 'W3TC' ) )
5
- die();
6
-
7
- ?>
8
- <form action="<?php echo W3TC_PAYPAL_URL; ?>" xmlns="http://www.w3.org/1999/html" method="get">
9
- <ul>
10
- <?php $id =0;
11
- foreach ( $this->_request_types as $key => $desc ): $id++;?>
12
- <li><input id="service<?php echo $id?>"name="service" type="radio" class="w3tc-service w3tc-ignore-change {nonce: '<?php echo wp_create_nonce( 'w3tc' ); ?>'}" value="<?php esc_attr_e( $key )?>" /><label for="service<?php echo $id?>"><?php echo $desc ?></label></li>
13
- <?php endforeach; ?>
14
- </ul>
15
- <div id="buy-w3-service-area"></div>
16
- <p>
17
- <input id="buy-w3-service" name="buy-w3-service" type="submit" class="button button-primary button-large" value="<?php _e( 'Buy now', 'w3-total-cache' ) ?>" disabled="disabled"/>
18
- </p>
19
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/faq-en_US.xml CHANGED
@@ -35,7 +35,7 @@
35
  <li>Optional embedding of <acronym title="JavaScript">JS</acronym> just above &lt;/body&gt;</li>
36
  <li>Support for caching pages, posts, feeds, database objects, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> in memory with an opcode cache or memcached or both</li>
37
  <li>Caching of feeds (comments, page and site), <acronym title="Uniform Resource Indicator">URL</acronym>s with query string variables (like search result pages), Database queries, Pages, Posts, <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym></li>
38
- <li>Complete header management including Etags</li>
39
  <li>Increased web server concurrency and reduced resource consumption, increased scale</li>
40
  </ul>
41
  <p>In essence, anything that can be automated to squeeze out every bit of server performance and minimize bandwidth utilization has been done, leaving your readers with an optimized user experience.</p> ]]></answer>
@@ -420,17 +420,13 @@ Note: To disable page caching of specific theme templates or plugin files you ne
420
  </answer>
421
  </entry>
422
  <entry>
423
- <question><![CDATA[ How can I host my favicon with my <acronym title="Content Delivery Network">CDN</acronym>? ]]></question>
424
  <answer><![CDATA[ <p>If the file exists in your document root (i.e. http://domain.com/favicon.ico), the plugin can take care of that for you using custom upload options. If the file is in your theme directory you can also have the plugin uploaded from there.</p> ]]></answer>
425
  </entry>
426
  <entry>
427
  <question><![CDATA[ What about the wp-includes files, can those be served from the <acronym title="Content Delivery Network">CDN</acronym>? ]]></question>
428
  <answer><![CDATA[ <p>Yes, you can specify which file types you would like served by <acronym title="Content Delivery Network">CDN</acronym> and they will be uploaded and always downloaded from that location. This includes the smilies, JavaScript files et al. By default we take care of them all.</p> ]]></answer>
429
  </entry>
430
- <entry>
431
- <question><![CDATA[ What if I don't want to work with a <acronym title="Content Delivery Network">CDN</acronym> right now, is there any other use for this feature? ]]></question>
432
- <answer><![CDATA[ <p>Yes! You can take advantage of the <a href="http://www.mozilla.org/projects/netlib/http/pipelining-faq.html">pipelining</a> support in some browsers by creating a sub-domain for the static content for your site. So you could select the "Origin Push / Self-hosted" method of the General Settings tab. Create static.domain.com on your server (and update your <acronym title="Domain Name System">DNS</acronym> zone) and then specify the <acronym title="File Transfer Protocol">FTP</acronym> details for it in the plugin configuration panel and you're done. If you disable the scripting options on your server you'll find that your server will actually respond slightly faster from that sub-domain because it's just sending files and not processing them.</p> ]]></answer>
433
- </entry>
434
  <entry>
435
  <question><![CDATA[ Are minified files uploaded to my <acronym title="Content Delivery Network">CDN</acronym> provider? ]]></question>
436
  <answer><![CDATA[ <p>Yes, any <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> you manage with the plugin are minified before being uploaded to your <acronym title="Content Delivery Network">CDN</acronym>. You don't have to make any special changes to your theme. We encourage you to make sure that your provider supports <acronym title="Hypertext Transfer Protocol">HTTP</acronym> compression as the benefit of having your static assets available from more than one <acronym title="Point of Presence">POP</acronym> alone is not enough.</p> ]]></answer>
@@ -466,61 +462,15 @@ Note: To disable page caching of specific theme templates or plugin files you ne
466
  <p>As always, it never hurts to back up your database first.</p>
467
  ]]></answer>
468
  </entry>
469
- <entry>
470
- <tag>cdn-fsd-maxcdn</tag>
471
- <question><![CDATA[ How do I set up Full Site Delivery with MaxCDN? ]]></question>
472
- <answer><![CDATA[
473
- <p>
474
- Full site mirroring is available in Edge Mode, so make sure you have enabled it. If not - click on "Enable Edge Mode" link in General Settings page.
475
- Full site mirroring is available in Paid version only.
476
- </p>
477
-
478
- <p>
479
- <ol>
480
- <li>Select CDN provider of your choice in a "Full site mirroring" group of "CDN type" dropdown on "General Settings" page, select MaxCDN there.</li>
481
- <li>Go to "CDN" page.</li>
482
- <li>Click "Authorize" button</li>
483
- <li>Type in API key of your account. You can obtain by following a link in a popup. Opening that link will you will be prompted for your MaxCDN login and password.
484
- Select Zone from the list or choose "Add new" to create new zone (type in some friendly name of zone in that case)</li>
485
- <li>In a zone setup form you will be notified with the settings required for zone. Tou have only 1 editable field is IP address of your Wordpress host. W3 Total Cache tries to guess it, but its not possible to know that in all possible cases.</li>
486
- <li>You get success page with information about DNS changes. Now you need to change record of your wordpress host from IP address and replace it to CNAME to specified hostname.</li>
487
- <li>It works</li>
488
- </ol>
489
- </p>
490
- ]]></answer>
491
- </entry>
492
- <entry>
493
- <tag>cdn-fsd-cloudfront</tag>
494
- <question><![CDATA[ How do I set up Full Site Delivery with CloudFront? ]]></question>
495
- <answer><![CDATA[
496
- <p>
497
- Full site mirroring is available in Edge Mode, so make sure you have enabled it. If not - click on "Enable Edge Mode" link in General Settings page.
498
- Full site mirroring is available in Paid version only.
499
- </p>
500
-
501
- <p>
502
- <ol>
503
- <li>Select CDN provider of your choice in a "Full site mirroring" group of "CDN type" dropdown on "General Settings" page, select CloudFront there.</li>
504
- <li>Go to "CDN" page.</li>
505
- <li>Click "Authorize" button</li>
506
- <li>Type in Access Key and Secret Key of your account.</li>
507
- <li>Select Distribution from the list or choose "Add new" to create new zone (type in some friendly name of zone in that case - that will not be visible anywhere except your AWS control panel)</li>
508
- <li>In a distribution setup form you will be notified with the settings required. Tou have only 1 editable field is alternative hostname of your Wordpress host. For example if your have myblog.com website with A record pointint to 1.2.3.4 IP, create another one origin.myblog.com DNS record with A record pointint to 1.2.3.4 IP and type in "origin.myblog.com" in this form.</li>
509
- <li>You get success page with information about DNS changes. Now you need to change record of your wordpress host from IP address and replace it to CNAME to specified hostname.</li>
510
- <li>It works</li>
511
- </ol>
512
- </p>
513
- ]]></answer>
514
- </entry>
515
  </section>
516
  <section name="Browser Cache">
517
  <entry>
518
- <question><![CDATA[ What's an Etag and why do I need one? ]]></question>
519
- <answer><![CDATA[ <p>Entity tags were created to add more reliability to client side caching my providing a simple method for a browser to verify that a file had not changed since last it was downloaded. Using them helps enables your server return 304 or "not modified" responses instead of a 200 "ok" response which are much much slower (because the file is sent). The result is a visitor viewing multiple pages of your site would have that "instant loading" experience that we all definitely enjoy. Don't worry we don't use inodes to create our Etags so this solution is reliable for multi server hosting solutions.</p> ]]></answer>
520
  </entry>
521
  <entry>
522
- <question><![CDATA[ What about Etags? ]]></question>
523
- <answer><![CDATA[ <p>Yes, we have Etags covered. Even if you have a clustered hosting environment, your <a href="http://en.wikipedia.org/wiki/HTTP_ETag" target="_blank">Etags</a> will be consistent (across multiple servers in your cluster) so you don't have to worry about using special session cookies when you introduce our plugin. If you would like to specify headers for various reasons, you can do that as well.</p> ]]></answer>
524
  </entry>
525
  <entry>
526
  <question><![CDATA[ Which encodings do you support? ]]></question>
@@ -647,7 +597,7 @@ FacebookExternalHit/1.0</pre>
647
  </entry>
648
  <entry>
649
  <question><![CDATA[ What version of <acronym title="Hypertext Preprocessor">PHP</acronym> do I need for this thing? ]]></question>
650
- <answer><![CDATA[ <p> Version 5.2+ </p> ]]></answer>
651
  </entry>
652
  <entry>
653
  <question><![CDATA[ What version of mySQL is needed? ]]></question>
@@ -857,6 +807,7 @@ function custom_extension($extensions) {
857
  'author_uri' => 'http://example.com',
858
  'extension_uri' => 'http://example.com',
859
  'extension_id' => 'some.theme',
 
860
  'version' => '0.1',
861
  'enabled' => true,
862
  'requirements' => array(),
35
  <li>Optional embedding of <acronym title="JavaScript">JS</acronym> just above &lt;/body&gt;</li>
36
  <li>Support for caching pages, posts, feeds, database objects, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> in memory with an opcode cache or memcached or both</li>
37
  <li>Caching of feeds (comments, page and site), <acronym title="Uniform Resource Indicator">URL</acronym>s with query string variables (like search result pages), Database queries, Pages, Posts, <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym></li>
38
+ <li>Complete header management including ETags</li>
39
  <li>Increased web server concurrency and reduced resource consumption, increased scale</li>
40
  </ul>
41
  <p>In essence, anything that can be automated to squeeze out every bit of server performance and minimize bandwidth utilization has been done, leaving your readers with an optimized user experience.</p> ]]></answer>
420
  </answer>
421
  </entry>
422
  <entry>
423
+ <question><![CDATA[ How can I host my favicon with my (origin push) <acronym title="Content Delivery Network">CDN</acronym>? ]]></question>
424
  <answer><![CDATA[ <p>If the file exists in your document root (i.e. http://domain.com/favicon.ico), the plugin can take care of that for you using custom upload options. If the file is in your theme directory you can also have the plugin uploaded from there.</p> ]]></answer>
425
  </entry>
426
  <entry>
427
  <question><![CDATA[ What about the wp-includes files, can those be served from the <acronym title="Content Delivery Network">CDN</acronym>? ]]></question>
428
  <answer><![CDATA[ <p>Yes, you can specify which file types you would like served by <acronym title="Content Delivery Network">CDN</acronym> and they will be uploaded and always downloaded from that location. This includes the smilies, JavaScript files et al. By default we take care of them all.</p> ]]></answer>
429
  </entry>
 
 
 
 
430
  <entry>
431
  <question><![CDATA[ Are minified files uploaded to my <acronym title="Content Delivery Network">CDN</acronym> provider? ]]></question>
432
  <answer><![CDATA[ <p>Yes, any <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> you manage with the plugin are minified before being uploaded to your <acronym title="Content Delivery Network">CDN</acronym>. You don't have to make any special changes to your theme. We encourage you to make sure that your provider supports <acronym title="Hypertext Transfer Protocol">HTTP</acronym> compression as the benefit of having your static assets available from more than one <acronym title="Point of Presence">POP</acronym> alone is not enough.</p> ]]></answer>
462
  <p>As always, it never hurts to back up your database first.</p>
463
  ]]></answer>
464
  </entry>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  </section>
466
  <section name="Browser Cache">
467
  <entry>
468
+ <question><![CDATA[ What's an ETag and why do I need one? ]]></question>
469
+ <answer><![CDATA[ <p>Entity tags were created to add more reliability to client side caching my providing a simple method for a browser to verify that a file had not changed since last it was downloaded. Using them helps enables your server return 304 or "not modified" responses instead of a 200 "ok" response which are much much slower (because the file is sent). The result is a visitor viewing multiple pages of your site would have that "instant loading" experience that we all definitely enjoy. Don't worry we don't use inodes to create our ETags so this solution is reliable for multi server hosting solutions.</p> ]]></answer>
470
  </entry>
471
  <entry>
472
+ <question><![CDATA[ What about ETags? ]]></question>
473
+ <answer><![CDATA[ <p>Yes, we have ETags covered. Even if you have a clustered hosting environment, your <a href="http://en.wikipedia.org/wiki/HTTP_ETag" target="_blank">Etags</a> will be consistent (across multiple servers in your cluster) so you don't have to worry about using special session cookies when you introduce our plugin. If you would like to specify headers for various reasons, you can do that as well.</p> ]]></answer>
474
  </entry>
475
  <entry>
476
  <question><![CDATA[ Which encodings do you support? ]]></question>
597
  </entry>
598
  <entry>
599
  <question><![CDATA[ What version of <acronym title="Hypertext Preprocessor">PHP</acronym> do I need for this thing? ]]></question>
600
+ <answer><![CDATA[ <p> Version 5.3+ </p> ]]></answer>
601
  </entry>
602
  <entry>
603
  <question><![CDATA[ What version of mySQL is needed? ]]></question>
807
  'author_uri' => 'http://example.com',
808
  'extension_uri' => 'http://example.com',
809
  'extension_id' => 'some.theme',
810
+ 'settings_exists' => false,
811
  'version' => '0.1',
812
  'enabled' => true,
813
  'requirements' => array(),
languages/faq-pro-en_US.xml CHANGED
@@ -8,8 +8,11 @@
8
  <answer>
9
  <![CDATA[ <p>Pro features available:</p>
10
  <ul>
11
- <li>Fragment cache</li>
12
  <li>Genesis Extension</li>
 
 
 
13
  </ul>
14
  ]]>
15
  </answer>
@@ -24,11 +27,46 @@
24
  <section name="Usage">
25
  <section name="CDN">
26
  <entry>
27
- <question><![CDATA[ How do I get CloudFront Dynamic Caching to work with full page caching? ]]></question>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <answer><![CDATA[
29
  <p>
30
- To enable full page caching option you need to enable "edge mode". If not already enabled this will
31
- also enable Browser Cache and disable "Expires" header. This is because CloudFront does not cache properly
32
  when "Expires" headers are set. When using CloudFront and full page caching there are no purging of cached pages when posting
33
  new posts etc. Cache invalidations in CF is limited per month and also takes up to 15 minutes to complete. </p>
34
  <p>Since there is no purging and you want to people to be able to comment it is recommended to use a hosted
@@ -119,64 +157,64 @@
119
  </ul>
120
  <p>To make the plugin aware that you group transients see code examples below:</p>
121
  <pre>
122
- add_action('w3tc_register_fragment_groups', 'my_plugin_register_groups');
123
 
124
- function my_plugin_register_groups() {
125
- //blog specific group and an array of actions that will trigger a flush of the group
126
- w3tc_register_fragment_group('my_plugin_', array('publish_post'), 3600);
127
- //If using MultiSite Network/site wide specific group and an array of actions that will trigger a flush of the group
128
- w3tc_register_fragment_group_global('my_plugin_global_', array('edit_site'), 3600);
129
- }
130
- function my_plugin_flush_group() {
131
- //manually flush group.
132
- w3tc_fragmentcache_flush_group('my_plugin_');
133
- }
134
 
135
- //Set transients
136
- function on_some_event() {
137
- if (false === get_transient('my_plugin_some_key'))
138
- //my_plugin_ prefix is the group name we registered earlier
139
- set_transient('my_plugin_some_key', 'blog specific value');
140
- if (false === get_site_transient('my_plugin_some_key'))
141
- //my_plugin_site_ prefix is the group name we registered earlier
142
- set_site_transient('my_plugin_site_some_key', 'site wide specific value');
143
- }
144
 
145
- // Cache action example
146
- add_action('theme_post_loop', 'cache_theme_post_loop_start',-999999999);
147
- add_action('theme_post_loop', 'cache_theme_post_loop_end', 999999999);
148
 
149
- /**
150
- * Start outputbuffering
151
- */
152
- function cache_theme_post_loop_start() {
153
- w3tc_fragmentcache_start('example1', 'examples', 'theme_post_loop');
154
- }
155
 
156
- /**
157
- * Store the output buffer .
158
- */
159
- function cache_theme_post_loop_end() {
160
- w3tc_fragmentcache_end('example1', 'examples', false);
161
- }
162
 
163
- // Cache filter example
164
- add_filter('theme_filter', 'cache_theme_filter_start',-999999999);
165
- add_filter('theme_filter', 'cache_theme_filter_end', 999999999);
166
- /**
167
- * Start filter buffering and return filter result
168
- */
169
- function cache_theme_filter_start($data) {
170
- return w3tc_fragmentcache_filter_start('example_filter1', 'examples', $hook, $data);
171
- }
172
 
173
- /**
174
- * Store the filter result and return filter result.
175
- */
176
- function cache_theme_filter_end($data) {
177
- return w3tc_fragmentcache_filter_end('example_filter1', 'examples', $data);
178
- }
179
- </pre>
180
  ]]></answer>
181
  </entry>
182
  </section>
8
  <answer>
9
  <![CDATA[ <p>Pro features available:</p>
10
  <ul>
11
+ <li>Fragment Cache Extension</li>
12
  <li>Genesis Extension</li>
13
+ <li>WPML Extension</li>
14
+ <li>Full Site Delivery (FSD)</li>
15
+ <li>Cache Statistics</li>
16
  </ul>
17
  ]]>
18
  </answer>
27
  <section name="Usage">
28
  <section name="CDN">
29
  <entry>
30
+ <tag>cdn-fsd-maxcdn</tag>
31
+ <question><![CDATA[ How do I set up Full Site Delivery (FSD) with MaxCDN? ]]></question>
32
+ <answer><![CDATA[
33
+ <p>
34
+ <ol>
35
+ <li>Select CDN provider of your choice in a "Full site mirroring" group of "CDN type" dropdown on "General Settings" page, select MaxCDN there.</li>
36
+ <li>Go to "CDN" page.</li>
37
+ <li>Click "Authorize" button</li>
38
+ <li>Type in API key of your account. You can obtain by following a link in a popup. Opening that link will you will be prompted for your MaxCDN login and password.
39
+ Select Zone from the list or choose "Add new" to create new zone (type in some friendly name of zone in that case)</li>
40
+ <li>In a zone setup form you will be notified with the settings required for zone. Tou have only 1 editable field is IP address of your Wordpress host. W3 Total Cache tries to guess it, but its not possible to know that in all possible cases.</li>
41
+ <li>You get success page with information about DNS changes. Now you need to change record of your wordpress host from IP address and replace it to CNAME to specified hostname.</li>
42
+ <li>It works</li>
43
+ </ol>
44
+ </p>
45
+ ]]></answer>
46
+ </entry>
47
+ <entry>
48
+ <tag>cdn-fsd-cloudfront</tag>
49
+ <question><![CDATA[ How do I set up Full Site Delivery (FSD) with CloudFront? ]]></question>
50
+ <answer><![CDATA[
51
+ <p>
52
+ <ol>
53
+ <li>Select CDN provider of your choice in a "Full site mirroring" group of "CDN type" dropdown on "General Settings" page, select CloudFront there.</li>
54
+ <li>Go to "CDN" page.</li>
55
+ <li>Click "Authorize" button</li>
56
+ <li>Type in Access Key and Secret Key of your account.</li>
57
+ <li>Select Distribution from the list or choose "Add new" to create new zone (type in some friendly name of zone in that case - that will not be visible anywhere except your AWS control panel)</li>
58
+ <li>In a distribution setup form you will be notified with the settings required. Tou have only 1 editable field is alternative hostname of your Wordpress host. For example if your have myblog.com website with A record pointint to 1.2.3.4 IP, create another one origin.myblog.com DNS record with A record pointint to 1.2.3.4 IP and type in "origin.myblog.com" in this form.</li>
59
+ <li>You get success page with information about DNS changes. Now you need to change record of your wordpress host from IP address and replace it to CNAME to specified hostname.</li>
60
+ <li>It works</li>
61
+ </ol>
62
+ </p>
63
+ ]]></answer>
64
+ </entry>
65
+ <entry>
66
+ <question><![CDATA[ How do I get CloudFront Dynamic Caching to work with full site delivery (FSD)? ]]></question>
67
  <answer><![CDATA[
68
  <p>
69
+ First enable Browser Cache and disable "Expires" header. This is because CloudFront does not cache properly
 
70
  when "Expires" headers are set. When using CloudFront and full page caching there are no purging of cached pages when posting
71
  new posts etc. Cache invalidations in CF is limited per month and also takes up to 15 minutes to complete. </p>
72
  <p>Since there is no purging and you want to people to be able to comment it is recommended to use a hosted
157
  </ul>
158
  <p>To make the plugin aware that you group transients see code examples below:</p>
159
  <pre>
160
+ add_action('w3tc_register_fragment_groups', 'my_plugin_register_groups');
161
 
162
+ function my_plugin_register_groups() {
163
+ //blog specific group and an array of actions that will trigger a flush of the group
164
+ w3tc_register_fragment_group('my_plugin_', array('publish_post'), 3600);
165
+ //If using MultiSite Network/site wide specific group and an array of actions that will trigger a flush of the group
166
+ w3tc_register_fragment_group_global('my_plugin_global_', array('edit_site'), 3600);
167
+ }
168
+ function my_plugin_flush_group() {
169
+ //manually flush group.
170
+ w3tc_fragmentcache_flush_group('my_plugin_');
171
+ }
172
 
173
+ //Set transients
174
+ function on_some_event() {
175
+ if (false === get_transient('my_plugin_some_key'))
176
+ //my_plugin_ prefix is the group name we registered earlier
177
+ set_transient('my_plugin_some_key', 'blog specific value');
178
+ if (false === get_site_transient('my_plugin_some_key'))
179
+ //my_plugin_site_ prefix is the group name we registered earlier
180
+ set_site_transient('my_plugin_site_some_key', 'site wide specific value');
181
+ }
182
 
183
+ // Cache action example
184
+ add_action('theme_post_loop', 'cache_theme_post_loop_start',-999999999);
185
+ add_action('theme_post_loop', 'cache_theme_post_loop_end', 999999999);
186
 
187
+ /**
188
+ * Start outputbuffering
189
+ */
190
+ function cache_theme_post_loop_start() {
191
+ w3tc_fragmentcache_start('example1', 'examples', 'theme_post_loop');
192
+ }
193
 
194
+ /**
195
+ * Store the output buffer .
196
+ */
197
+ function cache_theme_post_loop_end() {
198
+ w3tc_fragmentcache_end('example1', 'examples', false);
199
+ }
200
 
201
+ // Cache filter example
202
+ add_filter('theme_filter', 'cache_theme_filter_start',-999999999);
203
+ add_filter('theme_filter', 'cache_theme_filter_end', 999999999);
204
+ /**
205
+ * Start filter buffering and return filter result
206
+ */
207
+ function cache_theme_filter_start($data) {
208
+ return w3tc_fragmentcache_filter_start('example_filter1', 'examples', $hook, $data);
209
+ }
210
 
211
+ /**
212
+ * Store the filter result and return filter result.
213
+ */
214
+ function cache_theme_filter_end($data) {
215
+ return w3tc_fragmentcache_filter_end('example_filter1', 'examples', $data);
216
+ }
217
+ </pre>
218
  ]]></answer>
219
  </entry>
220
  </section>
lib/CSSTidy/class.csstidy.php CHANGED
@@ -252,7 +252,7 @@ var $line = 1;
252
  * @access private
253
  * @version 1.3
254
  */
255
- function csstidy()
256
  {
257
  $this->settings['remove_bslash'] = true;
258
  $this->settings['compress_colors'] = true;
252
  * @access private
253
  * @version 1.3
254
  */
255
+ function __construct()
256
  {
257
  $this->settings['remove_bslash'] = true;
258
  $this->settings['compress_colors'] = true;
lib/CSSTidy/class.csstidy_optimise.php CHANGED
@@ -44,7 +44,7 @@ class csstidy_optimise
44
  * @access private
45
  * @version 1.0
46
  */
47
- function csstidy_optimise(&$css)
48
  {
49
  $this->parser =& $css;
50
  $this->css =& $css->css;
44
  * @access private
45
  * @version 1.0
46
  */
47
+ function __construct(&$css)
48
  {
49
  $this->parser =& $css;
50
  $this->css =& $css->css;
lib/CSSTidy/class.csstidy_print.php CHANGED
@@ -65,7 +65,7 @@ class csstidy_print
65
  * @access private
66
  * @version 1.0
67
  */
68
- function csstidy_print(&$css)
69
  {
70
  $this->parser =& $css;
71
  $this->css =& $css->css;
65
  * @access private
66
  * @version 1.0
67
  */
68
+ function __construct(&$css)
69
  {
70
  $this->parser =& $css;
71
  $this->css =& $css->css;
lib/EDD/EDD_SL_Plugin_Updater.php DELETED
@@ -1,139 +0,0 @@
1
- <?php
2
-
3
- // uncomment this line for testing
4
- //set_site_transient( 'update_plugins', null );
5
-
6
- /**
7
- * Allows plugins to use their own update API.
8
- *
9
- * @author Pippin Williamson
10
- * @version 1.0
11
- */
12
- class EDD_SL_Plugin_Updater {
13
- private $api_url = '';
14
- private $api_data = array();
15
- private $name = '';
16
- private $slug = '';
17
-
18
- /**
19
- * Class constructor.
20
- *
21
- * @uses plugin_basename()
22
- * @uses hook()
23
- *
24
- * @param string $_api_url The URL pointing to the custom API endpoint.
25
- * @param string $_plugin_file Path to the plugin file.
26
- * @param array $_api_data Optional data to send with API calls.
27
- */
28
- function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
29
- $this->api_url = trailingslashit( $_api_url );
30
- $this->api_data = urlencode_deep( $_api_data );
31
- $this->name = plugin_basename( $_plugin_file );
32
- $this->slug = basename( $_plugin_file, '.php');
33
- $this->version = $_api_data['version'];
34
-
35
- // Set up hooks.
36
- $this->hook();
37
- }
38
-
39
- /**
40
- * Set up Wordpress filters to hook into WP's update process.
41
- *
42
- * @uses add_filter()
43
- *
44
- * @return void
45
- */
46
- private function hook() {
47
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'pre_set_site_transient_update_plugins_filter' ) );
48
- add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3);
49
- }
50
-
51
- /**
52
- * Check for Updates at the defined API endpoint and modify the update array.
53
- *
54
- * This function dives into the update api just when Wordpress creates its update array,
55
- * then adds a custom API call and injects the custom plugin data retrieved from the API.
56
- * It is reassembled from parts of the native Wordpress plugin update code.
57
- * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
58
- *
59
- * @uses api_request()
60
- *
61
- * @param array $_transient_data Update array build by Wordpress.
62
- * @return array Modified update array with custom plugin data.
63
- */
64
- function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
65
-
66
-
67
- if( empty( $_transient_data ) ) return $_transient_data;
68
-
69
- $to_send = array( 'slug' => $this->slug );
70
-
71
- $api_response = $this->api_request( 'plugin_latest_version', $to_send );
72
-
73
- if( false !== $api_response && is_object( $api_response ) ) {
74
- if( version_compare( $this->version, $api_response->new_version, '<' ) )
75
- $_transient_data->response[$this->name] = $api_response;
76
- }
77
- return $_transient_data;
78
- }
79
-
80
-
81
- /**
82
- * Updates information on the "View version x.x details" page with custom data.
83
- *
84
- * @uses api_request()
85
- *
86
- * @param mixed $_data
87
- * @param string $_action
88
- * @param object $_args
89
- * @return object $_data
90
- */
91
- function plugins_api_filter( $_data, $_action = '', $_args = null ) {
92
- if ( ( $_action != 'plugin_information' ) || !isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) return $_data;
93
-
94
- $to_send = array( 'slug' => $this->slug );
95
-
96
- $api_response = $this->api_request( 'plugin_information', $to_send );
97
- if ( false !== $api_response ) $_data = $api_response;
98
-
99
- return $_data;
100
- }
101
-
102
- /**
103
- * Calls the API and, if successfull, returns the object delivered by the API.
104
- *
105
- * @uses get_bloginfo()
106
- * @uses wp_remote_post()
107
- * @uses is_wp_error()
108
- *
109
- * @param string $_action The requested action.
110
- * @param array $_data Parameters for the API action.
111
- * @return bool|object
112
- */
113
- private function api_request( $_action, $_data ) {
114
-
115
- global $wp_version;
116
-
117
- $data = array_merge( $this->api_data, $_data );
118
- if( $data['slug'] != $this->slug )
119
- return false;
120
-
121
- $api_params = array(
122
- 'edd_action' => 'get_version',
123
- 'license' => $data['license'],
124
- 'name' => $data['item_name'],
125
- 'slug' => $this->slug,
126
- 'author' => $data['author']
127
- );
128
- $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
129
-
130
- if ( !is_wp_error( $request ) ):
131
- $request = json_decode( wp_remote_retrieve_body( $request ) );
132
- if( $request )
133
- $request->sections = maybe_unserialize( $request->sections );
134
- return $request;
135
- else:
136
- return false;
137
- endif;
138
- }
139
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/EDD/integration.php DELETED
@@ -1,100 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Activates a license
5
- */
6
- function edd_w3edge_w3tc_activate_license( $license, $version ) {
7
- // data to send in our API request
8
- $api_params = array(
9
- 'edd_action'=> 'activate_license',
10
- 'license' => $license, // legacy
11
- 'license_key' => $license,
12
- 'home_url' => network_home_url(),
13
- 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ), // the name of our product in EDD
14
- 'r' => rand(),
15
- 'version' => $version
16
- );
17
-
18
- // Call the custom API.
19
- $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
20
- if ( is_wp_error( $response ) )
21
- return false;
22
-
23
- // decode the license data
24
- $license_data = json_decode( wp_remote_retrieve_body( $response ) );
25
- return $license_data;
26
- }
27
-
28
- /**
29
- * Deactivates a license
30
- */
31
- function edd_w3edge_w3tc_deactivate_license( $license ) {
32
- // data to send in our API request
33
- $api_params = array(
34
- 'edd_action'=> 'deactivate_license',
35
- 'license' => $license, // legacy
36
- 'license_key' => $license,
37
- 'home_url' => network_home_url(),
38
- 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ), // the name of our product in EDD,
39
- 'r' => rand()
40
- );
41
-
42
- // Call the custom API.
43
- $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
44
-
45
- // make sure the response came back okay
46
- if ( is_wp_error( $response ) )
47
- return false;
48
-
49
- // decode the license data
50
- $license_data = json_decode( wp_remote_retrieve_body( $response ) );
51
-
52
- // $license_data->license will be either "deactivated" or "failed"
53
- return $license_data->license == 'deactivated';
54
- }
55
-
56
- /**
57
- * Checks if a license key is still valid
58
- */
59
- function edd_w3edge_w3tc_check_license( $license, $version ) {
60
- global $wp_version;
61
-
62
- $api_params = array(
63
- 'edd_action' => 'check_license',
64
- 'license' => $license, // legacy
65
- 'license_key' => $license,
66
- 'home_url' => network_home_url(),
67
- 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ),
68
- 'r' => rand(),
69
- 'version' => $version
70
- );
71
-
72
- // Call the custom API.
73
- $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
74
-
75
- if ( is_wp_error( $response ) )
76
- return false;
77
- $license_data = json_decode( wp_remote_retrieve_body( $response ) );
78
- return $license_data;
79
- }
80
-
81
- function edd_w3edge_w3tc_reset_rooturi( $license, $version ) {
82
- // data to send in our API request
83
- $api_params = array(
84
- 'edd_action'=> 'reset_rooturi',
85
- 'license_key' => $license,
86
- 'home_url' => network_home_url(),
87
- 'item_name' => urlencode( EDD_W3EDGE_W3TC_NAME ), // the name of our product in EDD
88
- 'r' => rand(),
89
- 'version' => $version
90
- );
91
-
92
- // Call the custom API.
93
- $response = wp_remote_get( add_query_arg( $api_params, EDD_W3EDGE_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) );
94
- if ( is_wp_error( $response ) )
95
- return false;
96
-
97
- // decode the license data
98
- $status = json_decode( wp_remote_retrieve_body( $response ) );
99
- return $status;
100
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Google/Auth/Abstract.php CHANGED
@@ -20,15 +20,15 @@
20
  * @author Chris Chabot <chabotc@google.com>
21
  *
22
  */
23
- abstract class Google_Auth_Abstract
24
  {
25
  /**
26
  * An utility function that first calls $this->auth->sign($request) and then
27
  * executes makeRequest() on that signed request. Used for when a request
28
  * should be authenticated
29
- * @param Google_Http_Request $request
30
- * @return Google_Http_Request $request
31
  */
32
- abstract public function authenticatedRequest(Google_Http_Request $request);
33
- abstract public function sign(Google_Http_Request $request);
34
  }
20
  * @author Chris Chabot <chabotc@google.com>
21
  *
22
  */
23
+ abstract class W3TCG_Google_Auth_Abstract
24
  {
25
  /**
26
  * An utility function that first calls $this->auth->sign($request) and then
27
  * executes makeRequest() on that signed request. Used for when a request
28
  * should be authenticated
29
+ * @param W3TCG_Google_Http_Request $request
30
+ * @return W3TCG_Google_Http_Request $request
31
  */
32
+ abstract public function authenticatedRequest(W3TCG_Google_Http_Request $request);
33
+ abstract public function sign(W3TCG_Google_Http_Request $request);
34
  }
lib/Google/Auth/AppIdentity.php CHANGED
@@ -25,15 +25,15 @@ use google\appengine\api\app_identity\AppIdentityService;
25
  /**
26
  * Authentication via the Google App Engine App Identity service.
27
  */
28
- class Google_Auth_AppIdentity extends Google_Auth_Abstract
29
  {
30
- const CACHE_PREFIX = "Google_Auth_AppIdentity::";
31
  private $key = null;
32
  private $client;
33
  private $token = false;
34
  private $tokenScopes = false;
35
 
36
- public function __construct(Google_Client $client, $config = null)
37
  {
38
  $this->client = $client;
39
  }
@@ -74,17 +74,17 @@ class Google_Auth_AppIdentity extends Google_Auth_Abstract
74
  * (which can modify the request in what ever way fits the auth mechanism)
75
  * and then calls apiCurlIO::makeRequest on the signed request
76
  *
77
- * @param Google_Http_Request $request
78
- * @return Google_Http_Request The resulting HTTP response including the
79
  * responseHttpCode, responseHeaders and responseBody.
80
  */
81
- public function authenticatedRequest(Google_Http_Request $request)
82
  {
83
  $request = $this->sign($request);
84
  return $this->client->getIo()->makeRequest($request);
85
  }
86
 
87
- public function sign(Google_Http_Request $request)
88
  {
89
  if (!$this->token) {
90
  // No token, so nothing to do.
25
  /**
26
  * Authentication via the Google App Engine App Identity service.
27
  */
28
+ class W3TCG_Google_Auth_AppIdentity extends W3TCG_Google_Auth_Abstract
29
  {
30
+ const CACHE_PREFIX = "W3TCG_Google_Auth_AppIdentity::";
31
  private $key = null;
32
  private $client;
33
  private $token = false;
34
  private $tokenScopes = false;
35
 
36
+ public function __construct(W3TCG_Google_Client $client, $config = null)
37
  {
38
  $this->client = $client;
39
  }
74
  * (which can modify the request in what ever way fits the auth mechanism)
75
  * and then calls apiCurlIO::makeRequest on the signed request
76
  *
77
+ * @param W3TCG_Google_Http_Request $request
78
+ * @return W3TCG_Google_Http_Request The resulting HTTP response including the
79
  * responseHttpCode, responseHeaders and responseBody.
80
  */
81
+ public function authenticatedRequest(W3TCG_Google_Http_Request $request)
82
  {
83
  $request = $this->sign($request);
84
  return $this->client->getIo()->makeRequest($request);
85
  }
86
 
87
+ public function sign(W3TCG_Google_Http_Request $request)
88
  {
89
  if (!$this->token) {
90
  // No token, so nothing to do.
lib/Google/Auth/AssertionCredentials.php CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @author Chirag Shah <chirags@google.com>
22
  */
23
- class Google_Auth_AssertionCredentials
24
  {
25
  const MAX_TOKEN_LIFETIME_SECS = 3600;
26
 
@@ -89,7 +89,7 @@ class Google_Auth_AssertionCredentials
89
  $now = time();
90
 
91
  $jwtParams = array(
92
- 'aud' => Google_Auth_OAuth2::OAUTH2_TOKEN_URI,
93
  'scope' => $this->scopes,
94
  'iat' => $now,
95
  'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
@@ -120,14 +120,14 @@ class Google_Auth_AssertionCredentials
120
  $payload = str_replace('\/', '/', $payload);
121
 
122
  $segments = array(
123
- Google_Utils::urlSafeB64Encode(json_encode($header)),
124
- Google_Utils::urlSafeB64Encode($payload)
125
  );
126
 
127
  $signingInput = implode('.', $segments);
128
- $signer = new Google_Signer_P12($this->privateKey, $this->privateKeyPassword);
129
  $signature = $signer->sign($signingInput);
130
- $segments[] = Google_Utils::urlSafeB64Encode($signature);
131
 
132
  return implode(".", $segments);
133
  }
20
  *
21
  * @author Chirag Shah <chirags@google.com>
22
  */
23
+ class W3TCG_Google_Auth_AssertionCredentials
24
  {
25
  const MAX_TOKEN_LIFETIME_SECS = 3600;
26
 
89
  $now = time();
90
 
91
  $jwtParams = array(
92
+ 'aud' => W3TCG_Google_Auth_OAuth2::OAUTH2_TOKEN_URI,
93
  'scope' => $this->scopes,
94
  'iat' => $now,
95
  'exp' => $now + self::MAX_TOKEN_LIFETIME_SECS,
120
  $payload = str_replace('\/', '/', $payload);
121
 
122
  $segments = array(
123
+ W3TCG_Google_Utils::urlSafeB64Encode(json_encode($header)),
124
+ W3TCG_Google_Utils::urlSafeB64Encode($payload)
125
  );
126
 
127
  $signingInput = implode('.', $segments);
128
+ $signer = new W3TCG_Google_Signer_P12($this->privateKey, $this->privateKeyPassword);
129
  $signature = $signer->sign($signingInput);
130
+ $segments[] = W3TCG_Google_Utils::urlSafeB64Encode($signature);
131
 
132
  return implode(".", $segments);
133
  }
lib/Google/Auth/Exception.php CHANGED
@@ -15,6 +15,6 @@
15
  * limitations under the License.
16
  */
17
 
18
- class Google_Auth_Exception extends Google_Exception
19
  {
20
  }
15
  * limitations under the License.
16
  */
17
 
18
+ class W3TCG_Google_Auth_Exception extends W3TCG_Google_Exception
19
  {
20
  }
lib/Google/Auth/LoginTicket.php CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
- class Google_Auth_LoginTicket
24
  {
25
  const USER_ATTR = "sub";
26
 
@@ -44,7 +44,7 @@ class Google_Auth_LoginTicket
44
 
45
  /**
46
  * Returns the numeric identifier for the user.
47
- * @throws Google_Auth_Exception
48
  * @return
49
  */
50
  public function getUserId()
@@ -52,7 +52,7 @@ class Google_Auth_LoginTicket
52
  if (array_key_exists(self::USER_ATTR, $this->payload)) {
53
  return $this->payload[self::USER_ATTR];
54
  }
55
- throw new Google_Auth_Exception("No user_id in token");
56
  }
57
 
58
  /**
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
+ class W3TCG_Google_Auth_LoginTicket
24
  {
25
  const USER_ATTR = "sub";
26
 
44
 
45
  /**
46
  * Returns the numeric identifier for the user.
47
+ * @throws W3TCG_Google_Auth_Exception
48
  * @return
49
  */
50
  public function getUserId()
52
  if (array_key_exists(self::USER_ATTR, $this->payload)) {
53
  return $this->payload[self::USER_ATTR];
54
  }
55
+ throw new W3TCG_Google_Auth_Exception("No user_id in token");
56
  }
57
 
58
  /**
lib/Google/Auth/OAuth2.php CHANGED
@@ -22,7 +22,7 @@
22
  * @author Chirag Shah <chirags@google.com>
23
  *
24
  */
25
- class Google_Auth_OAuth2 extends Google_Auth_Abstract
26
  {
27
  const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
28
  const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
@@ -32,7 +32,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
32
  const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
33
  const OAUTH2_ISSUER = 'accounts.google.com';
34
 
35
- /** @var Google_Auth_AssertionCredentials $assertionCredentials */
36
  private $assertionCredentials;
37
 
38
  /**
@@ -46,7 +46,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
46
  private $token = array();
47
 
48
  /**
49
- * @var Google_Client the base client
50
  */
51
  private $client;
52
 
@@ -54,7 +54,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
54
  * Instantiates the class, but does not initiate the login flow, leaving it
55
  * to the discretion of the caller.
56
  */
57
- public function __construct(Google_Client $client)
58
  {
59
  $this->client = $client;
60
  }
@@ -65,11 +65,11 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
65
  * (which can modify the request in what ever way fits the auth mechanism)
66
  * and then calls apiCurlIO::makeRequest on the signed request
67
  *
68
- * @param Google_Http_Request $request
69
- * @return Google_Http_Request The resulting HTTP response including the
70
  * responseHttpCode, responseHeaders and responseBody.
71
  */
72
- public function authenticatedRequest(Google_Http_Request $request)
73
  {
74
  $request = $this->sign($request);
75
  return $this->client->getIo()->makeRequest($request);
@@ -77,18 +77,18 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
77
 
78
  /**
79
  * @param string $code
80
- * @throws Google_Auth_Exception
81
  * @return string
82
  */
83
  public function authenticate($code)
84
  {
85
  if (strlen($code) == 0) {
86
- throw new Google_Auth_Exception("Invalid code");
87
  }
88
 
89
  // We got here from the redirect from a successful authorization grant,
90
  // fetch the access token
91
- $request = new Google_Http_Request(
92
  self::OAUTH2_TOKEN_URI,
93
  'POST',
94
  array(),
@@ -115,7 +115,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
115
  $errorText .= ": " . $decodedResponse['error_description'];
116
  }
117
  }
118
- throw new Google_Auth_Exception(
119
  sprintf(
120
  "Error fetching OAuth2 access token, message: '%s'",
121
  $errorText
@@ -169,16 +169,16 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
169
 
170
  /**
171
  * @param string $token
172
- * @throws Google_Auth_Exception
173
  */
174
  public function setAccessToken($token)
175
  {
176
  $token = json_decode($token, true);
177
  if ($token == null) {
178
- throw new Google_Auth_Exception('Could not json decode the token');
179
  }
180
  if (! isset($token['access_token'])) {
181
- throw new Google_Auth_Exception("Invalid token format");
182
  }
183
  $this->token = $token;
184
  }
@@ -202,18 +202,18 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
202
  $this->state = $state;
203
  }
204
 
205
- public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
206
  {
207
  $this->assertionCredentials = $creds;
208
  }
209
 
210
  /**
211
  * Include an accessToken in a given apiHttpRequest.
212
- * @param Google_Http_Request $request
213
- * @return Google_Http_Request
214
- * @throws Google_Auth_Exception
215
  */
216
- public function sign(Google_Http_Request $request)
217
  {
218
  // add the developer key to the request before signing it
219
  if ($this->client->getClassConfig($this, 'developer_key')) {
@@ -232,7 +232,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
232
  $this->refreshTokenWithAssertion();
233
  } else {
234
  if (! array_key_exists('refresh_token', $this->token)) {
235
- throw new Google_Auth_Exception(
236
  "The OAuth 2.0 access token has expired,"
237
  ." and a refresh token is not available. Refresh tokens"
238
  ." are not returned for responses that were auto-approved."
@@ -269,7 +269,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
269
 
270
  /**
271
  * Fetches a fresh access token with a given assertion token.
272
- * @param Google_Auth_AssertionCredentials $assertionCredentials optional.
273
  * @return void
274
  */
275
  public function refreshTokenWithAssertion($assertionCredentials = null)
@@ -312,7 +312,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
312
 
313
  private function refreshTokenRequest($params)
314
  {
315
- $http = new Google_Http_Request(
316
  self::OAUTH2_TOKEN_URI,
317
  'POST',
318
  array(),
@@ -326,11 +326,11 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
326
  if (200 == $code) {
327
  $token = json_decode($body, true);
328
  if ($token == null) {
329
- throw new Google_Auth_Exception("Could not json decode the access token");
330
  }
331
 
332
  if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
333
- throw new Google_Auth_Exception("Invalid token format");
334
  }
335
 
336
  if (isset($token['id_token'])) {
@@ -340,14 +340,14 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
340
  $this->token['expires_in'] = $token['expires_in'];
341
  $this->token['created'] = time();
342
  } else {
343
- throw new Google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
344
  }
345
  }
346
 
347
  /**
348
  * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
349
  * token, if a token isn't provided.
350
- * @throws Google_Auth_Exception
351
  * @param string|null $token The token (access token or a refresh token) that should be revoked.
352
  * @return boolean Returns True if the revocation was successful, otherwise False.
353
  */
@@ -363,7 +363,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
363
  $token = $this->token['access_token'];
364
  }
365
  }
366
- $request = new Google_Http_Request(
367
  self::OAUTH2_REVOKE_URI,
368
  'POST',
369
  array(),
@@ -411,7 +411,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
411
  * Retrieve and cache a certificates file.
412
  *
413
  * @param $url string location
414
- * @throws Google_Auth_Exception
415
  * @return array certificates
416
  */
417
  public function retrieveCertsFromLocation($url)
@@ -422,7 +422,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
422
  if ($file) {
423
  return json_decode($file, true);
424
  } else {
425
- throw new Google_Auth_Exception(
426
  "Failed to retrieve verification certificates: '" .
427
  $url . "'."
428
  );
@@ -431,7 +431,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
431
 
432
  // This relies on makeRequest caching certificate responses.
433
  $request = $this->client->getIo()->makeRequest(
434
- new Google_Http_Request(
435
  $url
436
  )
437
  );
@@ -441,7 +441,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
441
  return $certs;
442
  }
443
  }
444
- throw new Google_Auth_Exception(
445
  "Failed to retrieve verification certificates: '" .
446
  $request->getResponseBody() . "'.",
447
  $request->getResponseHttpCode()
@@ -456,7 +456,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
456
  *
457
  * @param $id_token
458
  * @param $audience
459
- * @return Google_Auth_LoginTicket
460
  */
461
  public function verifyIdToken($id_token = null, $audience = null)
462
  {
@@ -479,7 +479,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
479
  * @param $required_audience string the expected consumer of the token
480
  * @param [$issuer] the expected issues, defaults to Google
481
  * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
482
- * @throws Google_Auth_Exception
483
  * @return mixed token information if valid, false if not
484
  */
485
  public function verifySignedJwtWithCerts(
@@ -496,28 +496,28 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
496
 
497
  $segments = explode(".", $jwt);
498
  if (count($segments) != 3) {
499
- throw new Google_Auth_Exception("Wrong number of segments in token: $jwt");
500
  }
501
  $signed = $segments[0] . "." . $segments[1];
502
- $signature = Google_Utils::urlSafeB64Decode($segments[2]);
503
 
504
  // Parse envelope.
505
- $envelope = json_decode(Google_Utils::urlSafeB64Decode($segments[0]), true);
506
  if (!$envelope) {
507
- throw new Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
508
  }
509
 
510
  // Parse token
511
- $json_body = Google_Utils::urlSafeB64Decode($segments[1]);
512
  $payload = json_decode($json_body, true);
513
  if (!$payload) {
514
- throw new Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
515
  }
516
 
517
  // Check signature
518
  $verified = false;
519
  foreach ($certs as $keyName => $pem) {
520
- $public_key = new Google_Verifier_Pem($pem);
521
  if ($public_key->verify($signed, $signature)) {
522
  $verified = true;
523
  break;
@@ -525,7 +525,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
525
  }
526
 
527
  if (!$verified) {
528
- throw new Google_Auth_Exception("Invalid token signature: $jwt");
529
  }
530
 
531
  // Check issued-at timestamp
@@ -534,7 +534,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
534
  $iat = $payload["iat"];
535
  }
536
  if (!$iat) {
537
- throw new Google_Auth_Exception("No issue time in token: $json_body");
538
  }
539
  $earliest = $iat - self::CLOCK_SKEW_SECS;
540
 
@@ -545,17 +545,17 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
545
  $exp = $payload["exp"];
546
  }
547
  if (!$exp) {
548
- throw new Google_Auth_Exception("No expiration time in token: $json_body");
549
  }
550
  if ($exp >= $now + $max_expiry) {
551
- throw new Google_Auth_Exception(
552
  sprintf("Expiration time too far in future: %s", $json_body)
553
  );
554
  }
555
 
556
  $latest = $exp + self::CLOCK_SKEW_SECS;
557
  if ($now < $earliest) {
558
- throw new Google_Auth_Exception(
559
  sprintf(
560
  "Token used too early, %s < %s: %s",
561
  $now,
@@ -565,7 +565,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
565
  );
566
  }
567
  if ($now > $latest) {
568
- throw new Google_Auth_Exception(
569
  sprintf(
570
  "Token used too late, %s > %s: %s",
571
  $now,
@@ -577,7 +577,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
577
 
578
  $iss = $payload['iss'];
579
  if ($issuer && $iss != $issuer) {
580
- throw new Google_Auth_Exception(
581
  sprintf(
582
  "Invalid issuer, %s != %s: %s",
583
  $iss,
@@ -590,7 +590,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
590
  // Check audience
591
  $aud = $payload["aud"];
592
  if ($aud != $required_audience) {
593
- throw new Google_Auth_Exception(
594
  sprintf(
595
  "Wrong recipient, %s != %s:",
596
  $aud,
@@ -601,7 +601,7 @@ class Google_Auth_OAuth2 extends Google_Auth_Abstract
601
  }
602
 
603
  // All good.
604
- return new Google_Auth_LoginTicket($envelope, $payload);
605
  }
606
 
607
  /**
22
  * @author Chirag Shah <chirags@google.com>
23
  *
24
  */
25
+ class W3TCG_Google_Auth_OAuth2 extends W3TCG_Google_Auth_Abstract
26
  {
27
  const OAUTH2_REVOKE_URI = 'https://accounts.google.com/o/oauth2/revoke';
28
  const OAUTH2_TOKEN_URI = 'https://accounts.google.com/o/oauth2/token';
32
  const MAX_TOKEN_LIFETIME_SECS = 86400; // one day in seconds
33
  const OAUTH2_ISSUER = 'accounts.google.com';
34
 
35
+ /** @var W3TCG_Google_Auth_AssertionCredentials $assertionCredentials */
36
  private $assertionCredentials;
37
 
38
  /**
46
  private $token = array();
47
 
48
  /**
49
+ * @var W3TCG_Google_Client the base client
50
  */
51
  private $client;
52
 
54
  * Instantiates the class, but does not initiate the login flow, leaving it
55
  * to the discretion of the caller.
56
  */
57
+ public function __construct(W3TCG_Google_Client $client)
58
  {
59
  $this->client = $client;
60
  }
65
  * (which can modify the request in what ever way fits the auth mechanism)
66
  * and then calls apiCurlIO::makeRequest on the signed request
67
  *
68
+ * @param W3TCG_Google_Http_Request $request
69
+ * @return W3TCG_Google_Http_Request The resulting HTTP response including the
70
  * responseHttpCode, responseHeaders and responseBody.
71
  */
72
+ public function authenticatedRequest(W3TCG_Google_Http_Request $request)
73
  {
74
  $request = $this->sign($request);
75
  return $this->client->getIo()->makeRequest($request);
77
 
78
  /**
79
  * @param string $code
80
+ * @throws W3TCG_Google_Auth_Exception
81
  * @return string
82
  */
83
  public function authenticate($code)
84
  {
85
  if (strlen($code) == 0) {
86
+ throw new W3TCG_Google_Auth_Exception("Invalid code");
87
  }
88
 
89
  // We got here from the redirect from a successful authorization grant,
90
  // fetch the access token
91
+ $request = new W3TCG_Google_Http_Request(
92
  self::OAUTH2_TOKEN_URI,
93
  'POST',
94
  array(),
115
  $errorText .= ": " . $decodedResponse['error_description'];
116
  }
117
  }
118
+ throw new W3TCG_Google_Auth_Exception(
119
  sprintf(
120
  "Error fetching OAuth2 access token, message: '%s'",
121
  $errorText
169
 
170
  /**
171
  * @param string $token
172
+ * @throws W3TCG_Google_Auth_Exception
173
  */
174
  public function setAccessToken($token)
175
  {
176
  $token = json_decode($token, true);
177
  if ($token == null) {
178
+ throw new W3TCG_Google_Auth_Exception('Could not json decode the token');
179
  }
180
  if (! isset($token['access_token'])) {
181
+ throw new W3TCG_Google_Auth_Exception("Invalid token format");
182
  }
183
  $this->token = $token;
184
  }
202
  $this->state = $state;
203
  }
204
 
205
+ public function setAssertionCredentials(W3TCG_Google_Auth_AssertionCredentials $creds)
206
  {
207
  $this->assertionCredentials = $creds;
208
  }
209
 
210
  /**
211
  * Include an accessToken in a given apiHttpRequest.
212
+ * @param W3TCG_Google_Http_Request $request
213
+ * @return W3TCG_Google_Http_Request
214
+ * @throws W3TCG_Google_Auth_Exception
215
  */
216
+ public function sign(W3TCG_Google_Http_Request $request)
217
  {
218
  // add the developer key to the request before signing it
219
  if ($this->client->getClassConfig($this, 'developer_key')) {
232
  $this->refreshTokenWithAssertion();
233
  } else {
234
  if (! array_key_exists('refresh_token', $this->token)) {
235
+ throw new W3TCG_Google_Auth_Exception(
236
  "The OAuth 2.0 access token has expired,"
237
  ." and a refresh token is not available. Refresh tokens"
238
  ." are not returned for responses that were auto-approved."
269
 
270
  /**
271
  * Fetches a fresh access token with a given assertion token.
272
+ * @param W3TCG_Google_Auth_AssertionCredentials $assertionCredentials optional.
273
  * @return void
274
  */
275
  public function refreshTokenWithAssertion($assertionCredentials = null)
312
 
313
  private function refreshTokenRequest($params)
314
  {
315
+ $http = new W3TCG_Google_Http_Request(
316
  self::OAUTH2_TOKEN_URI,
317
  'POST',
318
  array(),
326
  if (200 == $code) {
327
  $token = json_decode($body, true);
328
  if ($token == null) {
329
+ throw new W3TCG_Google_Auth_Exception("Could not json decode the access token");
330
  }
331
 
332
  if (! isset($token['access_token']) || ! isset($token['expires_in'])) {
333
+ throw new W3TCG_Google_Auth_Exception("Invalid token format");
334
  }
335
 
336
  if (isset($token['id_token'])) {
340
  $this->token['expires_in'] = $token['expires_in'];
341
  $this->token['created'] = time();
342
  } else {
343
+ throw new W3TCG_Google_Auth_Exception("Error refreshing the OAuth2 token, message: '$body'", $code);
344
  }
345
  }
346
 
347
  /**
348
  * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
349
  * token, if a token isn't provided.
350
+ * @throws W3TCG_Google_Auth_Exception
351
  * @param string|null $token The token (access token or a refresh token) that should be revoked.
352
  * @return boolean Returns True if the revocation was successful, otherwise False.
353
  */
363
  $token = $this->token['access_token'];
364
  }
365
  }
366
+ $request = new W3TCG_Google_Http_Request(
367
  self::OAUTH2_REVOKE_URI,
368
  'POST',
369
  array(),
411
  * Retrieve and cache a certificates file.
412
  *
413
  * @param $url string location
414
+ * @throws W3TCG_Google_Auth_Exception
415
  * @return array certificates
416
  */
417
  public function retrieveCertsFromLocation($url)
422
  if ($file) {
423
  return json_decode($file, true);
424
  } else {
425
+ throw new W3TCG_Google_Auth_Exception(
426
  "Failed to retrieve verification certificates: '" .
427
  $url . "'."
428
  );
431
 
432
  // This relies on makeRequest caching certificate responses.
433
  $request = $this->client->getIo()->makeRequest(
434
+ new W3TCG_Google_Http_Request(
435
  $url
436
  )
437
  );
441
  return $certs;
442
  }
443
  }
444
+ throw new W3TCG_Google_Auth_Exception(
445
  "Failed to retrieve verification certificates: '" .
446
  $request->getResponseBody() . "'.",
447
  $request->getResponseHttpCode()
456
  *
457
  * @param $id_token
458
  * @param $audience
459
+ * @return W3TCG_Google_Auth_LoginTicket
460
  */
461
  public function verifyIdToken($id_token = null, $audience = null)
462
  {
479
  * @param $required_audience string the expected consumer of the token
480
  * @param [$issuer] the expected issues, defaults to Google
481
  * @param [$max_expiry] the max lifetime of a token, defaults to MAX_TOKEN_LIFETIME_SECS
482
+ * @throws W3TCG_Google_Auth_Exception
483
  * @return mixed token information if valid, false if not
484
  */
485
  public function verifySignedJwtWithCerts(
496
 
497
  $segments = explode(".", $jwt);
498
  if (count($segments) != 3) {
499
+ throw new W3TCG_Google_Auth_Exception("Wrong number of segments in token: $jwt");
500
  }
501
  $signed = $segments[0] . "." . $segments[1];
502
+ $signature = W3TCG_Google_Utils::urlSafeB64Decode($segments[2]);
503
 
504
  // Parse envelope.
505
+ $envelope = json_decode(W3TCG_Google_Utils::urlSafeB64Decode($segments[0]), true);
506
  if (!$envelope) {
507
+ throw new W3TCG_Google_Auth_Exception("Can't parse token envelope: " . $segments[0]);
508
  }
509
 
510
  // Parse token
511
+ $json_body = W3TCG_Google_Utils::urlSafeB64Decode($segments[1]);
512
  $payload = json_decode($json_body, true);
513
  if (!$payload) {
514
+ throw new W3TCG_Google_Auth_Exception("Can't parse token payload: " . $segments[1]);
515
  }
516
 
517
  // Check signature
518
  $verified = false;
519
  foreach ($certs as $keyName => $pem) {
520
+ $public_key = new W3TCG_Google_Verifier_Pem($pem);
521
  if ($public_key->verify($signed, $signature)) {
522
  $verified = true;
523
  break;
525
  }
526
 
527
  if (!$verified) {
528
+ throw new W3TCG_Google_Auth_Exception("Invalid token signature: $jwt");
529
  }
530
 
531
  // Check issued-at timestamp
534
  $iat = $payload["iat"];
535
  }
536
  if (!$iat) {
537
+ throw new W3TCG_Google_Auth_Exception("No issue time in token: $json_body");
538
  }
539
  $earliest = $iat - self::CLOCK_SKEW_SECS;
540
 
545
  $exp = $payload["exp"];
546
  }
547
  if (!$exp) {
548
+ throw new W3TCG_Google_Auth_Exception("No expiration time in token: $json_body");
549
  }
550
  if ($exp >= $now + $max_expiry) {
551
+ throw new W3TCG_Google_Auth_Exception(
552
  sprintf("Expiration time too far in future: %s", $json_body)
553
  );
554
  }
555
 
556
  $latest = $exp + self::CLOCK_SKEW_SECS;
557
  if ($now < $earliest) {
558
+ throw new W3TCG_Google_Auth_Exception(
559
  sprintf(
560
  "Token used too early, %s < %s: %s",
561
  $now,
565
  );
566
  }
567
  if ($now > $latest) {
568
+ throw new W3TCG_Google_Auth_Exception(
569
  sprintf(
570
  "Token used too late, %s > %s: %s",
571
  $now,
577
 
578
  $iss = $payload['iss'];
579
  if ($issuer && $iss != $issuer) {
580
+ throw new W3TCG_Google_Auth_Exception(
581
  sprintf(
582
  "Invalid issuer, %s != %s: %s",
583
  $iss,
590
  // Check audience
591
  $aud = $payload["aud"];
592
  if ($aud != $required_audience) {
593
+ throw new W3TCG_Google_Auth_Exception(
594
  sprintf(
595
  "Wrong recipient, %s != %s:",
596
  $aud,
601
  }
602
 
603
  // All good.
604
+ return new W3TCG_Google_Auth_LoginTicket($envelope, $payload);
605
  }
606
 
607
  /**
lib/Google/Auth/Simple.php CHANGED
@@ -22,12 +22,12 @@
22
  * @author Chris Chabot <chabotc@google.com>
23
  * @author Chirag Shah <chirags@google.com>
24
  */
25
- class Google_Auth_Simple extends Google_Auth_Abstract
26
  {
27
  private $key = null;
28
  private $client;
29
 
30
- public function __construct(Google_Client $client, $config = null)
31
  {
32
  $this->client = $client;
33
  }
@@ -38,17 +38,17 @@ class Google_Auth_Simple extends Google_Auth_Abstract
38
  * (which can modify the request in what ever way fits the auth mechanism)
39
  * and then calls apiCurlIO::makeRequest on the signed request
40
  *
41
- * @param Google_Http_Request $request
42
- * @return Google_Http_Request The resulting HTTP response including the
43
  * responseHttpCode, responseHeaders and responseBody.
44
  */
45
- public function authenticatedRequest(Google_Http_Request $request)
46
  {
47
  $request = $this->sign($request);
48
  return $this->io->makeRequest($request);
49
  }
50
 
51
- public function sign(Google_Http_Request $request)
52
  {
53
  $key = $this->client->getClassConfig($this, 'developer_key');
54
  if ($key) {
22
  * @author Chris Chabot <chabotc@google.com>
23
  * @author Chirag Shah <chirags@google.com>
24
  */
25
+ class W3TCG_Google_Auth_Simple extends W3TCG_Google_Auth_Abstract
26
  {
27
  private $key = null;
28
  private $client;
29
 
30
+ public function __construct(W3TCG_Google_Client $client, $config = null)
31
  {
32
  $this->client = $client;
33
  }
38
  * (which can modify the request in what ever way fits the auth mechanism)
39
  * and then calls apiCurlIO::makeRequest on the signed request
40
  *
41
+ * @param W3TCG_Google_Http_Request $request
42
+ * @return W3TCG_Google_Http_Request The resulting HTTP response including the
43
  * responseHttpCode, responseHeaders and responseBody.
44
  */
45
+ public function authenticatedRequest(W3TCG_Google_Http_Request $request)
46
  {
47
  $request = $this->sign($request);
48
  return $this->io->makeRequest($request);
49
  }
50
 
51
+ public function sign(W3TCG_Google_Http_Request $request)
52
  {
53
  $key = $this->client->getClassConfig($this, 'developer_key');
54
  if ($key) {
lib/Google/Cache/Abstract.php CHANGED
@@ -20,10 +20,10 @@
20
  *
21
  * @author Chris Chabot <chabotc@google.com>
22
  */
23
- abstract class Google_Cache_Abstract
24
  {
25
 
26
- abstract public function __construct(Google_Client $client);
27
 
28
  /**
29
  * Retrieves the data for the given key, or false if they
20
  *
21
  * @author Chris Chabot <chabotc@google.com>
22
  */
23
+ abstract class W3TCG_Google_Cache_Abstract
24
  {
25
 
26
+ abstract public function __construct(W3TCG_Google_Client $client);
27
 
28
  /**
29
  * Retrieves the data for the given key, or false if they
lib/Google/Cache/Apc.php CHANGED
@@ -23,12 +23,12 @@
23
  *
24
  * @author Chris Chabot <chabotc@google.com>
25
  */
26
- class Google_Cache_Apc extends Google_Cache_Abstract
27
  {
28
- public function __construct(Google_Client $client)
29
  {
30
  if (! function_exists('apc_add') ) {
31
- throw new Google_Cache_Exception("Apc functions not available");
32
  }
33
  }
34
 
@@ -55,7 +55,7 @@ class Google_Cache_Apc extends Google_Cache_Abstract
55
  {
56
  $rc = apc_store($key, array('time' => time(), 'data' => $value));
57
  if ($rc == false) {
58
- throw new Google_Cache_Exception("Couldn't store data");
59
  }
60
  }
61
 
23
  *
24
  * @author Chris Chabot <chabotc@google.com>
25
  */
26
+ class W3TCG_Google_Cache_Apc extends W3TCG_Google_Cache_Abstract
27
  {
28
+ public function __construct(W3TCG_Google_Client $client)
29
  {
30
  if (! function_exists('apc_add') ) {
31
+ throw new W3TCG_Google_Cache_Exception("Apc functions not available");
32
  }
33
  }
34
 
55
  {
56
  $rc = apc_store($key, array('time' => time(), 'data' => $value));
57
  if ($rc == false) {
58
+ throw new W3TCG_Google_Cache_Exception("Couldn't store data");
59
  }
60
  }
61
 
lib/Google/Cache/Exception.php CHANGED
@@ -15,6 +15,6 @@
15
  * limitations under the License.
16
  */
17
 
18
- class Google_Cache_Exception extends Google_Exception
19
  {
20
  }
15
  * limitations under the License.
16
  */
17
 
18
+ class W3TCG_Google_Cache_Exception extends W3TCG_Google_Exception
19
  {
20
  }
lib/Google/Cache/File.php CHANGED
@@ -23,13 +23,13 @@
23
  *
24
  * @author Chris Chabot <chabotc@google.com>
25
  */
26
- class Google_Cache_File extends Google_Cache_Abstract
27
  {
28
  const MAX_LOCK_RETRIES = 10;
29
  private $path;
30
  private $fh;
31
 
32
- public function __construct(Google_Client $client)
33
  {
34
  $this->path = $client->getClassConfig($this, 'directory');
35
  }
@@ -76,7 +76,7 @@ class Google_Cache_File extends Google_Cache_Abstract
76
  {
77
  $file = $this->getCacheFile($key);
78
  if (file_exists($file) && !unlink($file)) {
79
- throw new Google_Cache_Exception("Cache file could not be deleted");
80
  }
81
  }
82
 
@@ -98,7 +98,7 @@ class Google_Cache_File extends Google_Cache_Abstract
98
  $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
99
  if ($forWrite && ! is_dir($storageDir)) {
100
  if (! mkdir($storageDir, 0755, true)) {
101
- throw new Google_Cache_Exception("Could not create storage directory: $storageDir");
102
  }
103
  }
104
  return $storageDir;
23
  *
24
  * @author Chris Chabot <chabotc@google.com>
25
  */
26
+ class W3TCG_Google_Cache_File extends W3TCG_Google_Cache_Abstract
27
  {
28
  const MAX_LOCK_RETRIES = 10;
29
  private $path;
30
  private $fh;
31
 
32
+ public function __construct(W3TCG_Google_Client $client)
33
  {
34
  $this->path = $client->getClassConfig($this, 'directory');
35
  }
76
  {
77
  $file = $this->getCacheFile($key);
78
  if (file_exists($file) && !unlink($file)) {
79
+ throw new W3TCG_Google_Cache_Exception("Cache file could not be deleted");
80
  }
81
  }
82
 
98
  $storageDir = $this->path . '/' . substr(md5($file), 0, 2);
99
  if ($forWrite && ! is_dir($storageDir)) {
100
  if (! mkdir($storageDir, 0755, true)) {
101
+ throw new W3TCG_Google_Cache_Exception("Could not create storage directory: $storageDir");
102
  }
103
  }
104
  return $storageDir;
lib/Google/Cache/Memcache.php CHANGED
@@ -25,17 +25,17 @@
25
  *
26
  * @author Chris Chabot <chabotc@google.com>
27
  */
28
- class Google_Cache_Memcache extends Google_Cache_Abstract
29
  {
30
  private $connection = false;
31
  private $mc = false;
32
  private $host;
33
  private $port;
34
 
35
- public function __construct(Google_Client $client)
36
  {
37
  if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
38
- throw new Google_Cache_Exception("Memcache functions not available");
39
  }
40
  if ($client->isAppEngine()) {
41
  // No credentials needed for GAE.
@@ -45,7 +45,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
45
  $this->host = $client->getClassConfig($this, 'host');
46
  $this->port = $client->getClassConfig($this, 'port');
47
  if (empty($this->host) || (empty($this->port) && (string) $this->port != "0")) {
48
- throw new Google_Cache_Exception("You need to supply a valid memcache host and port");
49
  }
50
  }
51
  }
@@ -76,7 +76,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
76
  * @inheritDoc
77
  * @param string $key
78
  * @param string $value
79
- * @throws Google_Cache_Exception
80
  */
81
  public function set($key, $value)
82
  {
@@ -91,7 +91,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
91
  $rc = memcache_set($this->connection, $key, $data, false);
92
  }
93
  if ($rc == false) {
94
- throw new Google_Cache_Exception("Couldn't store data in cache");
95
  }
96
  }
97
 
@@ -128,7 +128,7 @@ class Google_Cache_Memcache extends Google_Cache_Abstract
128
  }
129
 
130
  if (! $this->connection) {
131
- throw new Google_Cache_Exception("Couldn't connect to memcache server");
132
  }
133
  }
134
  }
25
  *
26
  * @author Chris Chabot <chabotc@google.com>
27
  */
28
+ class W3TCG_Google_Cache_Memcache extends W3TCG_Google_Cache_Abstract
29
  {
30
  private $connection = false;
31
  private $mc = false;
32
  private $host;
33
  private $port;
34
 
35
+ public function __construct(W3TCG_Google_Client $client)
36
  {
37
  if (!function_exists('memcache_connect') && !class_exists("Memcached")) {
38
+ throw new W3TCG_Google_Cache_Exception("Memcache functions not available");
39
  }
40
  if ($client->isAppEngine()) {
41
  // No credentials needed for GAE.
45
  $this->host = $client->getClassConfig($this, 'host');
46
  $this->port = $client->getClassConfig($this, 'port');
47
  if (empty($this->host) || (empty($this->port) && (string) $this->port != "0")) {
48
+ throw new W3TCG_Google_Cache_Exception("You need to supply a valid memcache host and port");
49
  }
50
  }
51
  }
76
  * @inheritDoc
77
  * @param string $key
78
  * @param string $value
79
+ * @throws W3TCG_Google_Cache_Exception
80
  */
81
  public function set($key, $value)
82
  {
91
  $rc = memcache_set($this->connection, $key, $data, false);
92
  }
93
  if ($rc == false) {
94
+ throw new W3TCG_Google_Cache_Exception("Couldn't store data in cache");
95
  }
96
  }
97
 
128
  }
129
 
130
  if (! $this->connection) {
131
+ throw new W3TCG_Google_Cache_Exception("Couldn't connect to memcache server");
132
  }
133
  }
134
  }
lib/Google/Cache/Null.php CHANGED
@@ -19,9 +19,9 @@
19
  * A blank storage class, for cases where caching is not
20
  * required.
21
  */
22
- class Google_Cache_Null extends Google_Cache_Abstract
23
  {
24
- public function __construct(Google_Client $client)
25
  {
26
 
27
  }
19
  * A blank storage class, for cases where caching is not
20
  * required.
21
  */
22
+ class W3TCG_Google_Cache_Null extends W3TCG_Google_Cache_Abstract
23
  {
24
+ public function __construct(W3TCG_Google_Client $client)
25
  {
26
 
27
  }
lib/Google/Client.php CHANGED
@@ -22,27 +22,27 @@
22
  * @author Chris Chabot <chabotc@google.com>
23
  * @author Chirag Shah <chirags@google.com>
24
  */
25
- class Google_Client
26
  {
27
  const LIBVER = "1.1.0-beta";
28
  const USER_AGENT_SUFFIX = "google-api-php-client/";
29
  /**
30
- * @var Google_Auth_Abstract $auth
31
  */
32
  private $auth;
33
 
34
  /**
35
- * @var Google_IO_Abstract $io
36
  */
37
  private $io;
38
 
39
  /**
40
- * @var Google_Cache_Abstract $cache
41
  */
42
  private $cache;
43
 
44
  /**
45
- * @var Google_Config $config
46
  */
47
  private $config;
48
 
@@ -64,31 +64,31 @@ class Google_Client
64
  /**
65
  * Construct the Google Client.
66
  *
67
- * @param $config Google_Config or string for the ini file to load
68
  */
69
  public function __construct($config = null)
70
  {
71
  if (is_string($config) && strlen($config)) {
72
- $config = new Google_Config($config);
73
- } else if ( !($config instanceof Google_Config)) {
74
- $config = new Google_Config();
75
 
76
  if ($this->isAppEngine()) {
77
  // Automatically use Memcache if we're in AppEngine.
78
- $config->setCacheClass('Google_Cache_Memcache');
79
  }
80
 
81
  if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
82
  // Automatically disable compress.zlib, as currently unsupported.
83
- $config->setClassConfig('Google_Http_Request', 'disable_gzip', true);
84
  }
85
  }
86
 
87
- if ($config->getIoClass() == Google_Config::USE_AUTO_IO_SELECTION) {
88
  if (function_exists('curl_version') && function_exists('curl_exec')) {
89
- $config->setIoClass("Google_IO_Curl");
90
  } else {
91
- $config->setIoClass("Google_IO_Stream");
92
  }
93
  }
94
 
@@ -124,14 +124,14 @@ class Google_Client
124
  * the "Download JSON" button on in the Google Developer
125
  * Console.
126
  * @param string $json the configuration json
127
- * @throws Google_Exception
128
  */
129
  public function setAuthConfig($json)
130
  {
131
  $data = json_decode($json);
132
  $key = isset($data->installed) ? 'installed' : 'web';
133
  if (!isset($data->$key)) {
134
- throw new Google_Exception("Invalid client secret JSON file.");
135
  }
136
  $this->setClientId($data->$key->client_id);
137
  $this->setClientSecret($data->$key->client_secret);
@@ -153,14 +153,14 @@ class Google_Client
153
  }
154
 
155
  /**
156
- * @throws Google_Auth_Exception
157
  * @return array
158
  * @visible For Testing
159
  */
160
  public function prepareScopes()
161
  {
162
  if (empty($this->requestedScopes)) {
163
- throw new Google_Auth_Exception("No scopes specified");
164
  }
165
  $scopes = implode(' ', $this->requestedScopes);
166
  return $scopes;
@@ -168,7 +168,7 @@ class Google_Client
168
 
169
  /**
170
  * Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
171
- * or Google_Client#getAccessToken().
172
  * @param string $accessToken JSON encoded string containing in the following format:
173
  * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
174
  * "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
@@ -185,9 +185,9 @@ class Google_Client
185
 
186
  /**
187
  * Set the authenticator object
188
- * @param Google_Auth_Abstract $auth
189
  */
190
- public function setAuth(Google_Auth_Abstract $auth)
191
  {
192
  $this->config->setAuthClass(get_class($auth));
193
  $this->auth = $auth;
@@ -195,9 +195,9 @@ class Google_Client
195
 
196
  /**
197
  * Set the IO object
198
- * @param Google_IO_Abstract $io
199
  */
200
- public function setIo(Google_IO_Abstract $io)
201
  {
202
  $this->config->setIoClass(get_class($io));
203
  $this->io = $io;
@@ -205,9 +205,9 @@ class Google_Client
205
 
206
  /**
207
  * Set the Cache object
208
- * @param Google_Cache_Abstract $cache
209
  */
210
- public function setCache(Google_Cache_Abstract $cache)
211
  {
212
  $this->config->setCacheClass(get_class($cache));
213
  $this->cache = $cache;
@@ -413,7 +413,7 @@ class Google_Client
413
  /**
414
  * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
415
  * token, if a token isn't provided.
416
- * @throws Google_Auth_Exception
417
  * @param string|null $token The token (access token or a refresh token) that should be revoked.
418
  * @return boolean Returns True if the revocation was successful, otherwise False.
419
  */
@@ -425,9 +425,9 @@ class Google_Client
425
  /**
426
  * Verify an id_token. This method will verify the current id_token, if one
427
  * isn't provided.
428
- * @throws Google_Auth_Exception
429
  * @param string|null $token The token (id_token) that should be verified.
430
- * @return Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
431
  * successful.
432
  */
433
  public function verifyIdToken($token = null)
@@ -447,15 +447,15 @@ class Google_Client
447
  */
448
  public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
449
  {
450
- $auth = new Google_Auth_OAuth2($this);
451
  $certs = $auth->retrieveCertsFromLocation($cert_location);
452
  return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
453
  }
454
 
455
  /**
456
- * @param $creds Google_Auth_AssertionCredentials
457
  */
458
- public function setAssertionCredentials(Google_Auth_AssertionCredentials $creds)
459
  {
460
  $this->getAuth()->setAssertionCredentials($creds);
461
  }
@@ -527,27 +527,27 @@ class Google_Client
527
  /**
528
  * Helper method to execute deferred HTTP requests.
529
  *
530
- * @param $request Google_Http_Request|Google_Http_Batch
531
- * @throws Google_Exception
532
  * @return object of the type of the expected class or array.
533
  */
534
  public function execute($request)
535
  {
536
- if ($request instanceof Google_Http_Request) {
537
  $request->setUserAgent(
538
  $this->getApplicationName()
539
  . " " . self::USER_AGENT_SUFFIX
540
  . $this->getLibraryVersion()
541
  );
542
- if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
543
  $request->enableGzip();
544
  }
545
  $request->maybeMoveParametersToBody();
546
- return Google_Http_REST::execute($this, $request);
547
- } else if ($request instanceof Google_Http_Batch) {
548
  return $request->execute();
549
  } else {
550
- throw new Google_Exception("Do not know how to execute this type of object.");
551
  }
552
  }
553
 
@@ -561,7 +561,7 @@ class Google_Client
561
  }
562
 
563
  /**
564
- * @return Google_Auth_Abstract Authentication implementation
565
  */
566
  public function getAuth()
567
  {
@@ -573,7 +573,7 @@ class Google_Client
573
  }
574
 
575
  /**
576
- * @return Google_IO_Abstract IO implementation
577
  */
578
  public function getIo()
579
  {
@@ -585,7 +585,7 @@ class Google_Client
585
  }
586
 
587
  /**
588
- * @return Google_Cache_Abstract Cache implementation
589
  */
590
  public function getCache()
591
  {
@@ -612,7 +612,7 @@ class Google_Client
612
 
613
  /**
614
  * Set configuration specific to a given class.
615
- * $config->setClassConfig('Google_Cache_File',
616
  * array('directory' => '/tmp/cache'));
617
  * @param $class string|object - The class name for the configuration
618
  * @param $config string key or an array of configuration values
22
  * @author Chris Chabot <chabotc@google.com>
23
  * @author Chirag Shah <chirags@google.com>
24
  */
25
+ class W3TCG_Google_Client
26
  {
27
  const LIBVER = "1.1.0-beta";
28
  const USER_AGENT_SUFFIX = "google-api-php-client/";
29
  /**
30
+ * @var W3TCG_Google_Auth_Abstract $auth
31
  */
32
  private $auth;
33
 
34
  /**
35
+ * @var W3TCG_Google_IO_Abstract $io
36
  */
37
  private $io;
38
 
39
  /**
40
+ * @var W3TCG_Google_Cache_Abstract $cache
41
  */
42
  private $cache;
43
 
44
  /**
45
+ * @var W3TCG_Google_Config $config
46
  */
47
  private $config;
48
 
64
  /**
65
  * Construct the Google Client.
66
  *
67
+ * @param $config W3TCG_Google_Config or string for the ini file to load
68
  */
69
  public function __construct($config = null)
70
  {
71
  if (is_string($config) && strlen($config)) {
72
+ $config = new W3TCG_Google_Config($config);
73
+ } else if ( !($config instanceof W3TCG_Google_Config)) {
74
+ $config = new W3TCG_Google_Config();
75
 
76
  if ($this->isAppEngine()) {
77
  // Automatically use Memcache if we're in AppEngine.
78
+ $config->setCacheClass('W3TCG_Google_Cache_Memcache');
79
  }
80
 
81
  if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
82
  // Automatically disable compress.zlib, as currently unsupported.
83
+ $config->setClassConfig('W3TCG_Google_Http_Request', 'disable_gzip', true);
84
  }
85
  }
86
 
87
+ if ($config->getIoClass() == W3TCG_Google_Config::USE_AUTO_IO_SELECTION) {
88
  if (function_exists('curl_version') && function_exists('curl_exec')) {
89
+ $config->setIoClass("W3TCG_Google_IO_Curl");
90
  } else {
91
+ $config->setIoClass("W3TCG_Google_IO_Stream");
92
  }
93
  }
94
 
124
  * the "Download JSON" button on in the Google Developer
125
  * Console.
126
  * @param string $json the configuration json
127
+ * @throws W3TCG_Google_Exception
128
  */
129
  public function setAuthConfig($json)
130
  {
131
  $data = json_decode($json);
132
  $key = isset($data->installed) ? 'installed' : 'web';
133
  if (!isset($data->$key)) {
134
+ throw new W3TCG_Google_Exception("Invalid client secret JSON file.");
135
  }
136
  $this->setClientId($data->$key->client_id);
137
  $this->setClientSecret($data->$key->client_secret);
153
  }
154
 
155
  /**
156
+ * @throws W3TCG_Google_Auth_Exception
157
  * @return array
158
  * @visible For Testing
159
  */
160
  public function prepareScopes()
161
  {
162
  if (empty($this->requestedScopes)) {
163
+ throw new W3TCG_Google_Auth_Exception("No scopes specified");
164
  }
165
  $scopes = implode(' ', $this->requestedScopes);
166
  return $scopes;
168
 
169
  /**
170
  * Set the OAuth 2.0 access token using the string that resulted from calling createAuthUrl()
171
+ * or W3TCG_Google_Client#getAccessToken().
172
  * @param string $accessToken JSON encoded string containing in the following format:
173
  * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
174
  * "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
185
 
186
  /**
187
  * Set the authenticator object
188
+ * @param W3TCG_Google_Auth_Abstract $auth
189
  */
190
+ public function setAuth(W3TCG_Google_Auth_Abstract $auth)
191
  {
192
  $this->config->setAuthClass(get_class($auth));
193
  $this->auth = $auth;
195
 
196
  /**
197
  * Set the IO object
198
+ * @param W3TCG_Google_IO_Abstract $io
199
  */
200
+ public function setIo(W3TCG_Google_IO_Abstract $io)
201
  {
202
  $this->config->setIoClass(get_class($io));
203
  $this->io = $io;
205
 
206
  /**
207
  * Set the Cache object
208
+ * @param W3TCG_Google_Cache_Abstract $cache
209
  */
210
+ public function setCache(W3TCG_Google_Cache_Abstract $cache)
211
  {
212
  $this->config->setCacheClass(get_class($cache));
213
  $this->cache = $cache;
413
  /**
414
  * Revoke an OAuth2 access token or refresh token. This method will revoke the current access
415
  * token, if a token isn't provided.
416
+ * @throws W3TCG_Google_Auth_Exception
417
  * @param string|null $token The token (access token or a refresh token) that should be revoked.
418
  * @return boolean Returns True if the revocation was successful, otherwise False.
419
  */
425
  /**
426
  * Verify an id_token. This method will verify the current id_token, if one
427
  * isn't provided.
428
+ * @throws W3TCG_Google_Auth_Exception
429
  * @param string|null $token The token (id_token) that should be verified.
430
+ * @return W3TCG_Google_Auth_LoginTicket Returns an apiLoginTicket if the verification was
431
  * successful.
432
  */
433
  public function verifyIdToken($token = null)
447
  */
448
  public function verifySignedJwt($id_token, $cert_location, $audience, $issuer, $max_expiry = null)
449
  {
450
+ $auth = new W3TCG_Google_Auth_OAuth2($this);
451
  $certs = $auth->retrieveCertsFromLocation($cert_location);
452
  return $auth->verifySignedJwtWithCerts($id_token, $certs, $audience, $issuer, $max_expiry);
453
  }
454
 
455
  /**
456
+ * @param $creds W3TCG_Google_Auth_AssertionCredentials
457
  */
458
+ public function setAssertionCredentials(W3TCG_Google_Auth_AssertionCredentials $creds)
459
  {
460
  $this->getAuth()->setAssertionCredentials($creds);
461
  }
527
  /**
528
  * Helper method to execute deferred HTTP requests.
529
  *
530
+ * @param $request W3TCG_Google_Http_Request|Google_Http_Batch
531
+ * @throws W3TCG_Google_Exception
532
  * @return object of the type of the expected class or array.
533
  */
534
  public function execute($request)
535
  {
536
+ if ($request instanceof W3TCG_Google_Http_Request) {
537
  $request->setUserAgent(
538
  $this->getApplicationName()
539
  . " " . self::USER_AGENT_SUFFIX
540
  . $this->getLibraryVersion()
541
  );
542
+ if (!$this->getClassConfig("W3TCG_Google_Http_Request", "disable_gzip")) {
543
  $request->enableGzip();
544
  }
545
  $request->maybeMoveParametersToBody();
546
+ return W3TCG_Google_Http_REST::execute($this, $request);
547
+ } else if ($request instanceof W3TCG_Google_Http_Batch) {
548
  return $request->execute();
549
  } else {
550
+ throw new W3TCG_Google_Exception("Do not know how to execute this type of object.");
551
  }
552
  }
553
 
561
  }
562
 
563
  /**
564
+ * @return W3TCG_Google_Auth_Abstract Authentication implementation
565
  */
566
  public function getAuth()
567
  {
573
  }
574
 
575
  /**
576
+ * @return W3TCG_Google_IO_Abstract IO implementation
577
  */
578
  public function getIo()
579
  {
585
  }
586
 
587
  /**
588
+ * @return W3TCG_Google_Cache_Abstract Cache implementation
589
  */
590
  public function getCache()
591
  {
612
 
613
  /**
614
  * Set configuration specific to a given class.
615
+ * $config->setClassConfig('W3TCG_Google_Cache_File',
616
  * array('directory' => '/tmp/cache'));
617
  * @param $class string|object - The class name for the configuration
618
  * @param $config string key or an array of configuration values
lib/Google/Collection.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
 
3
  /**
4
- * Extension to the regular Google_Model that automatically
5
  * exposes the items array for iteration, so you can just
6
  * iterate over the object rather than a reference inside.
7
  */
8
- class Google_Collection extends Google_Model implements Iterator, Countable
9
  {
10
  protected $collection_key = 'items';
11
 
1
  <?php
2
 
3
  /**
4
+ * Extension to the regular W3TCG_Google_Model that automatically
5
  * exposes the items array for iteration, so you can just
6
  * iterate over the object rather than a reference inside.
7
  */
8
+ class W3TCG_Google_Collection extends W3TCG_Google_Model implements Iterator, Countable
9
  {
10
  protected $collection_key = 'items';
11
 
lib/Google/Config.php CHANGED
@@ -18,7 +18,7 @@
18
  /**
19
  * A class to contain the library configuration for the Google API client.
20
  */
21
- class Google_Config
22
  {
23
  const GZIP_DISABLED = true;
24
  const GZIP_ENABLED = false;
@@ -28,7 +28,7 @@ class Google_Config
28
  protected $configuration;
29
 
30
  /**
31
- * Create a new Google_Config. Can accept an ini file location with the
32
  * local configuration. For example:
33
  * application_name="My App"
34
  *
@@ -41,9 +41,9 @@ class Google_Config
41
  'application_name' => '',
42
 
43
  // Which Authentication, Storage and HTTP IO classes to use.
44
- 'auth_class' => 'Google_Auth_OAuth2',
45
  'io_class' => self::USE_AUTO_IO_SELECTION,
46
- 'cache_class' => 'Google_Cache_File',
47
 
48
  // Don't change these unless you're working against a special development
49
  // or testing environment.
@@ -51,10 +51,10 @@ class Google_Config
51
 
52
  // Definition of class specific values, like file paths and so on.
53
  'classes' => array(
54
- 'Google_IO_Abstract' => array(
55
  'request_timeout_seconds' => 100,
56
  ),
57
- 'Google_Http_Request' => array(
58
  // Disable the use of gzip on calls if set to true. Defaults to false.
59
  'disable_gzip' => self::GZIP_ENABLED,
60
 
@@ -66,7 +66,7 @@ class Google_Config
66
  ),
67
  // If you want to pass in OAuth 2.0 settings, they will need to be
68
  // structured like this.
69
- 'Google_Auth_OAuth2' => array(
70
  // Keys for OAuth 2.0 access, see the API console at
71
  // https://developers.google.com/console
72
  'client_id' => '',
@@ -90,8 +90,8 @@ class Google_Config
90
  'https://www.googleapis.com/oauth2/v1/certs',
91
  ),
92
  // Set a default directory for the file cache.
93
- 'Google_Cache_File' => array(
94
- 'directory' => sys_get_temp_dir() . '/Google_Client'
95
  )
96
  ),
97
  );
@@ -105,7 +105,7 @@ class Google_Config
105
 
106
  /**
107
  * Set configuration specific to a given class.
108
- * $config->setClassConfig('Google_Cache_File',
109
  * array('directory' => '/tmp/cache'));
110
  * @param $class string The class name for the configuration
111
  * @param $config string key or an array of configuration values
18
  /**
19
  * A class to contain the library configuration for the Google API client.
20
  */
21
+ class W3TCG_Google_Config
22
  {
23
  const GZIP_DISABLED = true;
24
  const GZIP_ENABLED = false;
28
  protected $configuration;
29
 
30
  /**
31
+ * Create a new W3TCG_Google_Config. Can accept an ini file location with the
32
  * local configuration. For example:
33
  * application_name="My App"
34
  *
41
  'application_name' => '',
42
 
43
  // Which Authentication, Storage and HTTP IO classes to use.
44
+ 'auth_class' => 'W3TCG_Google_Auth_OAuth2',
45
  'io_class' => self::USE_AUTO_IO_SELECTION,
46
+ 'cache_class' => 'W3TCG_Google_Cache_File',
47
 
48
  // Don't change these unless you're working against a special development
49
  // or testing environment.
51
 
52
  // Definition of class specific values, like file paths and so on.
53
  'classes' => array(
54
+ 'W3TCG_Google_IO_Abstract' => array(
55
  'request_timeout_seconds' => 100,
56
  ),
57
+ 'W3TCG_Google_Http_Request' => array(
58
  // Disable the use of gzip on calls if set to true. Defaults to false.
59
  'disable_gzip' => self::GZIP_ENABLED,
60
 
66
  ),
67
  // If you want to pass in OAuth 2.0 settings, they will need to be
68
  // structured like this.
69
+ 'W3TCG_Google_Auth_OAuth2' => array(
70
  // Keys for OAuth 2.0 access, see the API console at
71
  // https://developers.google.com/console
72
  'client_id' => '',
90
  'https://www.googleapis.com/oauth2/v1/certs',
91
  ),
92
  // Set a default directory for the file cache.
93
+ 'W3TCG_Google_Cache_File' => array(
94
+ 'directory' => sys_get_temp_dir() . '/W3TCG_Google_Client'
95
  )
96
  ),
97
  );
105
 
106
  /**
107
  * Set configuration specific to a given class.
108
+ * $config->setClassConfig('W3TCG_Google_Cache_File',
109
  * array('directory' => '/tmp/cache'));
110
  * @param $class string The class name for the configuration
111
  * @param $config string key or an array of configuration values
lib/Google/Exception.php CHANGED
@@ -15,6 +15,6 @@
15
  * limitations under the License.
16
  */
17
 
18
- class Google_Exception extends Exception
19
  {
20
  }
15
  * limitations under the License.
16
  */
17
 
18
+ class W3TCG_Google_Exception extends Exception
19
  {
20
  }
lib/Google/Http/Batch.php CHANGED
@@ -18,7 +18,7 @@
18
  /**
19
  * @author Chirag Shah <chirags@google.com>
20
  */
21
- class Google_Http_Batch
22
  {
23
  /** @var string Multipart Boundary. */
24
  private $boundary;
@@ -26,14 +26,14 @@ class Google_Http_Batch
26
  /** @var array service requests to be executed. */
27
  private $requests = array();
28
 
29
- /** @var Google_Client */
30
  private $client;
31
 
32
  private $expected_classes = array();
33
 
34
  private $base_path;
35
 
36
- public function __construct(Google_Client $client, $boundary = false)
37
  {
38
  $this->client = $client;
39
  $this->base_path = $this->client->getBasePath();
@@ -42,7 +42,7 @@ class Google_Http_Batch
42
  $this->boundary = str_replace('"', '', $boundary);
43
  }
44
 
45
- public function add(Google_Http_Request $request, $key = false)
46
  {
47
  if (false == $key) {
48
  $key = mt_rand();
@@ -55,7 +55,7 @@ class Google_Http_Batch
55
  {
56
  $body = '';
57
 
58
- /** @var Google_Http_Request $req */
59
  foreach ($this->requests as $key => $req) {
60
  $body .= "--{$this->boundary}\n";
61
  $body .= $req->toBatchString($key) . "\n";
@@ -66,7 +66,7 @@ class Google_Http_Batch
66
  $body .= "\n--{$this->boundary}--";
67
 
68
  $url = $this->base_path . '/batch';
69
- $httpRequest = new Google_Http_Request($url, 'POST');
70
  $httpRequest->setRequestHeaders(
71
  array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
72
  );
@@ -77,7 +77,7 @@ class Google_Http_Batch
77
  return $this->parseResponse($response);
78
  }
79
 
80
- public function parseResponse(Google_Http_Request $response)
81
  {
82
  $contentType = $response->getResponseHeader('content-type');
83
  $contentType = explode(';', $contentType);
@@ -106,7 +106,7 @@ class Google_Http_Batch
106
  $status = $status[1];
107
 
108
  list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
109
- $response = new Google_Http_Request("");
110
  $response->setResponseHttpCode($status);
111
  $response->setResponseHeaders($partHeaders);
112
  $response->setResponseBody($partBody);
@@ -121,9 +121,9 @@ class Google_Http_Batch
121
  }
122
 
123
  try {
124
- $response = Google_Http_REST::decodeHttpResponse($response);
125
  $responses[$key] = $response;
126
- } catch (Google_Service_Exception $e) {
127
  // Store the exception as the response, so succesful responses
128
  // can be processed.
129
  $responses[$key] = $e;
18
  /**
19
  * @author Chirag Shah <chirags@google.com>
20
  */
21
+ class W3TCG_Google_Http_Batch
22
  {
23
  /** @var string Multipart Boundary. */
24
  private $boundary;
26
  /** @var array service requests to be executed. */
27
  private $requests = array();
28
 
29
+ /** @var W3TCG_Google_Client */
30
  private $client;
31
 
32
  private $expected_classes = array();
33
 
34
  private $base_path;
35
 
36
+ public function __construct(W3TCG_Google_Client $client, $boundary = false)
37
  {
38
  $this->client = $client;
39
  $this->base_path = $this->client->getBasePath();
42
  $this->boundary = str_replace('"', '', $boundary);
43
  }
44
 
45
+ public function add(W3TCG_Google_Http_Request $request, $key = false)
46
  {
47
  if (false == $key) {
48
  $key = mt_rand();
55
  {
56
  $body = '';
57
 
58
+ /** @var W3TCG_Google_Http_Request $req */
59
  foreach ($this->requests as $key => $req) {
60
  $body .= "--{$this->boundary}\n";
61
  $body .= $req->toBatchString($key) . "\n";
66
  $body .= "\n--{$this->boundary}--";
67
 
68
  $url = $this->base_path . '/batch';
69
+ $httpRequest = new W3TCG_Google_Http_Request($url, 'POST');
70
  $httpRequest->setRequestHeaders(
71
  array('Content-Type' => 'multipart/mixed; boundary=' . $this->boundary)
72
  );
77
  return $this->parseResponse($response);
78
  }
79
 
80
+ public function parseResponse(W3TCG_Google_Http_Request $response)
81
  {
82
  $contentType = $response->getResponseHeader('content-type');
83
  $contentType = explode(';', $contentType);
106
  $status = $status[1];
107
 
108
  list($partHeaders, $partBody) = $this->client->getIo()->ParseHttpResponse($part, false);
109
+ $response = new W3TCG_Google_Http_Request("");
110
  $response->setResponseHttpCode($status);
111
  $response->setResponseHeaders($partHeaders);
112
  $response->setResponseBody($partBody);
121
  }
122
 
123
  try {
124
+ $response = W3TCG_Google_Http_REST::decodeHttpResponse($response);
125
  $responses[$key] = $response;
126
+ } catch (W3TCG_Google_Service_Exception $e) {
127
  // Store the exception as the response, so succesful responses
128
  // can be processed.
129
  $responses[$key] = $e;
lib/Google/Http/CacheParser.php CHANGED
@@ -20,7 +20,7 @@
20
  * implementation is guided by the guidance offered in rfc2616-sec13.
21
  * @author Chirag Shah <chirags@google.com>
22
  */
23
- class Google_Http_CacheParser
24
  {
25
  public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
26
  public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
@@ -29,11 +29,11 @@ class Google_Http_CacheParser
29
  * Check if an HTTP request can be cached by a private local cache.
30
  *
31
  * @static
32
- * @param Google_Http_Request $resp
33
  * @return bool True if the request is cacheable.
34
  * False if the request is uncacheable.
35
  */
36
- public static function isRequestCacheable(Google_Http_Request $resp)
37
  {
38
  $method = $resp->getRequestMethod();
39
  if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
@@ -55,11 +55,11 @@ class Google_Http_CacheParser
55
  * Check if an HTTP response can be cached by a private local cache.
56
  *
57
  * @static
58
- * @param Google_Http_Request $resp
59
  * @return bool True if the response is cacheable.
60
  * False if the response is un-cacheable.
61
  */
62
- public static function isResponseCacheable(Google_Http_Request $resp)
63
  {
64
  // First, check if the HTTP request was cacheable before inspecting the
65
  // HTTP response.
@@ -107,11 +107,11 @@ class Google_Http_CacheParser
107
 
108
  /**
109
  * @static
110
- * @param Google_Http_Request $resp
111
  * @return bool True if the HTTP response is considered to be expired.
112
  * False if it is considered to be fresh.
113
  */
114
- public static function isExpired(Google_Http_Request $resp)
115
  {
116
  // HTTP/1.1 clients and caches MUST treat other invalid date formats,
117
  // especially including the value “0”, as in the past.
@@ -146,7 +146,7 @@ class Google_Http_CacheParser
146
  // We can't default this to now, as that means future cache reads
147
  // will always pass with the logic below, so we will require a
148
  // date be injected if not supplied.
149
- throw new Google_Exception("All cacheable requests must have creation dates.");
150
  }
151
 
152
  if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
@@ -169,10 +169,10 @@ class Google_Http_CacheParser
169
  /**
170
  * Determine if a cache entry should be revalidated with by the origin.
171
  *
172
- * @param Google_Http_Request $response
173
  * @return bool True if the entry is expired, else return false.
174
  */
175
- public static function mustRevalidate(Google_Http_Request $response)
176
  {
177
  // [13.3] When a cache has a stale entry that it would like to use as a
178
  // response to a client's request, it first has to check with the origin
20
  * implementation is guided by the guidance offered in rfc2616-sec13.
21
  * @author Chirag Shah <chirags@google.com>
22
  */
23
+ class W3TCG_Google_Http_CacheParser
24
  {
25
  public static $CACHEABLE_HTTP_METHODS = array('GET', 'HEAD');
26
  public static $CACHEABLE_STATUS_CODES = array('200', '203', '300', '301');
29
  * Check if an HTTP request can be cached by a private local cache.
30
  *
31
  * @static
32
+ * @param W3TCG_Google_Http_Request $resp
33
  * @return bool True if the request is cacheable.
34
  * False if the request is uncacheable.
35
  */
36
+ public static function isRequestCacheable(W3TCG_Google_Http_Request $resp)
37
  {
38
  $method = $resp->getRequestMethod();
39
  if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) {
55
  * Check if an HTTP response can be cached by a private local cache.
56
  *
57
  * @static
58
+ * @param W3TCG_Google_Http_Request $resp
59
  * @return bool True if the response is cacheable.
60
  * False if the response is un-cacheable.
61
  */
62
+ public static function isResponseCacheable(W3TCG_Google_Http_Request $resp)
63
  {
64
  // First, check if the HTTP request was cacheable before inspecting the
65
  // HTTP response.
107
 
108
  /**
109
  * @static
110
+ * @param W3TCG_Google_Http_Request $resp
111
  * @return bool True if the HTTP response is considered to be expired.
112
  * False if it is considered to be fresh.
113
  */
114
+ public static function isExpired(W3TCG_Google_Http_Request $resp)
115
  {
116
  // HTTP/1.1 clients and caches MUST treat other invalid date formats,
117
  // especially including the value “0”, as in the past.
146
  // We can't default this to now, as that means future cache reads
147
  // will always pass with the logic below, so we will require a
148
  // date be injected if not supplied.
149
+ throw new W3TCG_Google_Exception("All cacheable requests must have creation dates.");
150
  }
151
 
152
  if (false == $freshnessLifetime && isset($responseHeaders['expires'])) {
169
  /**
170
  * Determine if a cache entry should be revalidated with by the origin.
171
  *
172
+ * @param W3TCG_Google_Http_Request $response
173
  * @return bool True if the entry is expired, else return false.
174
  */
175
+ public static function mustRevalidate(W3TCG_Google_Http_Request $response)
176
  {
177
  // [13.3] When a cache has a stale entry that it would like to use as a
178
  // response to a client's request, it first has to check with the origin
lib/Google/Http/MediaFileUpload.php CHANGED
@@ -19,7 +19,7 @@
19
  * @author Chirag Shah <chirags@google.com>
20
  *
21
  */
22
- class Google_Http_MediaFileUpload
23
  {
24
  const UPLOAD_MEDIA_TYPE = 'media';
25
  const UPLOAD_MULTIPART_TYPE = 'multipart';
@@ -46,10 +46,10 @@ class Google_Http_MediaFileUpload
46
  /** @var int $progress */
47
  private $progress;
48
 
49
- /** @var Google_Client */
50
  private $client;
51
 
52
- /** @var Google_Http_Request */
53
  private $request;
54
 
55
  /** @var string */
@@ -69,8 +69,8 @@ class Google_Http_MediaFileUpload
69
  * only used if resumable=True
70
  */
71
  public function __construct(
72
- Google_Client $client,
73
- Google_Http_Request $request,
74
  $mimeType,
75
  $data,
76
  $resumable = false,
@@ -144,14 +144,14 @@ class Google_Http_MediaFileUpload
144
  'expect' => '',
145
  );
146
 
147
- $httpRequest = new Google_Http_Request(
148
  $this->resumeUri,
149
  'PUT',
150
  $headers,
151
  $chunk
152
  );
153
 
154
- if ($this->client->getClassConfig("Google_Http_Request", "enable_gzip_for_uploads")) {
155
  $httpRequest->enableGzip();
156
  } else {
157
  $httpRequest->disableGzip();
@@ -176,7 +176,7 @@ class Google_Http_MediaFileUpload
176
  // No problems, but upload not complete.
177
  return false;
178
  } else {
179
- return Google_Http_REST::decodeHttpResponse($response);
180
  }
181
  }
182
 
@@ -266,7 +266,7 @@ class Google_Http_MediaFileUpload
266
  if ($body) {
267
  $headers = array(
268
  'content-type' => 'application/json; charset=UTF-8',
269
- 'content-length' => Google_Utils::getStrLen($body),
270
  'x-upload-content-type' => $this->mimeType,
271
  'x-upload-content-length' => $this->size,
272
  'expect' => '',
@@ -290,6 +290,6 @@ class Google_Http_MediaFileUpload
290
  }
291
  $message = rtrim($message, ';');
292
  }
293
- throw new Google_Exception("Failed to start the resumable upload (HTTP {$message})");
294
  }
295
  }
19
  * @author Chirag Shah <chirags@google.com>
20
  *
21
  */
22
+ class W3TCG_Google_Http_MediaFileUpload
23
  {
24
  const UPLOAD_MEDIA_TYPE = 'media';
25
  const UPLOAD_MULTIPART_TYPE = 'multipart';
46
  /** @var int $progress */
47
  private $progress;
48
 
49
+ /** @var W3TCG_Google_Client */
50
  private $client;
51
 
52
+ /** @var W3TCG_Google_Http_Request */
53
  private $request;
54
 
55
  /** @var string */
69
  * only used if resumable=True
70
  */
71
  public function __construct(
72
+ W3TCG_Google_Client $client,
73
+ W3TCG_Google_Http_Request $request,
74
  $mimeType,
75
  $data,
76
  $resumable = false,
144
  'expect' => '',
145
  );
146
 
147
+ $httpRequest = new W3TCG_Google_Http_Request(
148
  $this->resumeUri,
149
  'PUT',
150
  $headers,
151
  $chunk
152
  );
153
 
154
+ if ($this->client->getClassConfig("W3TCG_Google_Http_Request", "enable_gzip_for_uploads")) {
155
  $httpRequest->enableGzip();
156
  } else {
157
  $httpRequest->disableGzip();
176
  // No problems, but upload not complete.
177
  return false;
178
  } else {
179
+ return W3TCG_Google_Http_REST::decodeHttpResponse($response);
180
  }
181
  }
182
 
266
  if ($body) {
267
  $headers = array(
268
  'content-type' => 'application/json; charset=UTF-8',
269
+ 'content-length' => W3TCG_Google_Utils::getStrLen($body),
270
  'x-upload-content-type' => $this->mimeType,
271
  'x-upload-content-length' => $this->size,
272
  'expect' => '',
290
  }
291
  $message = rtrim($message, ';');
292
  }
293
+ throw new W3TCG_Google_Exception("Failed to start the resumable upload (HTTP {$message})");
294
  }
295
  }
lib/Google/Http/REST.php CHANGED
@@ -21,18 +21,18 @@
21
  * @author Chris Chabot <chabotc@google.com>
22
  * @author Chirag Shah <chirags@google.com>
23
  */
24
- class Google_Http_REST
25
  {
26
  /**
27
- * Executes a Google_Http_Request
28
  *
29
- * @param Google_Client $client
30
- * @param Google_Http_Request $req
31
  * @return array decoded result
32
- * @throws Google_Service_Exception on server side error (ie: not authenticated,
33
  * invalid or malformed post body, invalid url)
34
  */
35
- public static function execute(Google_Client $client, Google_Http_Request $req)
36
  {
37
  $httpRequest = $client->getIo()->makeRequest($req);
38
  $httpRequest->setExpectedClass($req->getExpectedClass());
@@ -42,8 +42,8 @@ class Google_Http_REST
42
  /**
43
  * Decode an HTTP Response.
44
  * @static
45
- * @throws Google_Service_Exception
46
- * @param Google_Http_Request $response The http response to be decoded.
47
  * @return mixed|null
48
  */
49
  public static function decodeHttpResponse($response)
@@ -71,14 +71,14 @@ class Google_Http_REST
71
  $errors = $decoded['error']['errors'];
72
  }
73
 
74
- throw new Google_Service_Exception($err, $code, null, $errors);
75
  }
76
 
77
  // Only attempt to decode the response, if the response code wasn't (204) 'no content'
78
  if ($code != '204') {
79
  $decoded = json_decode($body, true);
80
  if ($decoded === null || $decoded === "") {
81
- throw new Google_Service_Exception("Invalid json in service response: $body");
82
  }
83
 
84
  if ($response->getExpectedClass()) {
@@ -121,7 +121,7 @@ class Google_Http_REST
121
  }
122
 
123
  if (count($uriTemplateVars)) {
124
- $uriTemplateParser = new Google_Utils_URITemplate();
125
  $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
126
  }
127
 
21
  * @author Chris Chabot <chabotc@google.com>
22
  * @author Chirag Shah <chirags@google.com>
23
  */
24
+ class W3TCG_Google_Http_REST
25
  {
26
  /**
27
+ * Executes a W3TCG_Google_Http_Request
28
  *
29
+ * @param W3TCG_Google_Client $client
30
+ * @param W3TCG_Google_Http_Request $req
31
  * @return array decoded result
32
+ * @throws W3TCG_Google_Service_Exception on server side error (ie: not authenticated,
33
  * invalid or malformed post body, invalid url)
34
  */
35
+ public static function execute(W3TCG_Google_Client $client, W3TCG_Google_Http_Request $req)
36
  {
37
  $httpRequest = $client->getIo()->makeRequest($req);
38
  $httpRequest->setExpectedClass($req->getExpectedClass());
42
  /**
43
  * Decode an HTTP Response.
44
  * @static
45
+ * @throws W3TCG_Google_Service_Exception
46
+ * @param W3TCG_Google_Http_Request $response The http response to be decoded.
47
  * @return mixed|null
48
  */
49
  public static function decodeHttpResponse($response)
71
  $errors = $decoded['error']['errors'];
72
  }
73
 
74
+ throw new W3TCG_Google_Service_Exception($err, $code, null, $errors);
75
  }
76
 
77
  // Only attempt to decode the response, if the response code wasn't (204) 'no content'
78
  if ($code != '204') {
79
  $decoded = json_decode($body, true);
80
  if ($decoded === null || $decoded === "") {
81
+ throw new W3TCG_Google_Service_Exception("Invalid json in service response: $body");
82
  }
83
 
84
  if ($response->getExpectedClass()) {
121
  }
122
 
123
  if (count($uriTemplateVars)) {
124
+ $uriTemplateParser = new W3TCG_Google_Utils_URITemplate();
125
  $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
126
  }
127
 
lib/Google/Http/Request.php CHANGED
@@ -23,7 +23,7 @@
23
  * @author Chirag Shah <chirags@google.com>
24
  *
25
  */
26
- class Google_Http_Request
27
  {
28
  const GZIP_UA = " (gzip)";
29
 
@@ -192,7 +192,7 @@ class Google_Http_Request
192
  */
193
  public function setResponseHeaders($headers)
194
  {
195
- $headers = Google_Utils::normalize($headers);
196
  if ($this->responseHeaders) {
197
  $headers = array_merge($this->responseHeaders, $headers);
198
  }
@@ -310,7 +310,7 @@ class Google_Http_Request
310
  */
311
  public function setRequestHeaders($headers)
312
  {
313
- $headers = Google_Utils::normalize($headers);
314
  if ($this->requestHeaders) {
315
  $headers = array_merge($this->requestHeaders, $headers);
316
  }
23
  * @author Chirag Shah <chirags@google.com>
24
  *
25
  */
26
+ class W3TCG_Google_Http_Request
27
  {
28
  const GZIP_UA = " (gzip)";
29
 
192
  */
193
  public function setResponseHeaders($headers)
194
  {
195
+ $headers = W3TCG_Google_Utils::normalize($headers);
196
  if ($this->responseHeaders) {
197
  $headers = array_merge($this->responseHeaders, $headers);
198
  }
310
  */
311
  public function setRequestHeaders($headers)
312
  {
313
+ $headers = W3TCG_Google_Utils::normalize($headers);
314
  if ($this->requestHeaders) {
315
  $headers = array_merge($this->requestHeaders, $headers);
316
  }
lib/Google/IO/Abstract.php CHANGED
@@ -19,7 +19,7 @@
19
  * Abstract IO base class
20
  */
21
 
22
- abstract class Google_IO_Abstract
23
  {
24
  const UNKNOWN_CODE = 0;
25
  const FORM_URLENCODED = 'application/x-www-form-urlencoded';
@@ -29,24 +29,24 @@ abstract class Google_IO_Abstract
29
  );
30
  private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
31
 
32
- /** @var Google_Client */
33
  protected $client;
34
 
35
- public function __construct(Google_Client $client)
36
  {
37
  $this->client = $client;
38
- $timeout = $client->getClassConfig('Google_IO_Abstract', 'request_timeout_seconds');
39
  if ($timeout > 0) {
40
  $this->setTimeout($timeout);
41
  }
42
  }
43
 
44
  /**
45
- * Executes a Google_Http_Request and returns the resulting populated Google_Http_Request
46
- * @param Google_Http_Request $request
47
- * @return Google_Http_Request $request
48
  */
49
- abstract public function executeRequest(Google_Http_Request $request);
50
 
51
  /**
52
  * Set options that update the transport implementation's behavior.
@@ -80,14 +80,14 @@ abstract class Google_IO_Abstract
80
  /**
81
  * @visible for testing.
82
  * Cache the response to an HTTP request if it is cacheable.
83
- * @param Google_Http_Request $request
84
  * @return bool Returns true if the insertion was successful.
85
  * Otherwise, return false.
86
  */
87
- public function setCachedRequest(Google_Http_Request $request)
88
  {
89
  // Determine if the request is cacheable.
90
- if (Google_Http_CacheParser::isResponseCacheable($request)) {
91
  $this->client->getCache()->set($request->getCacheKey(), $request);
92
  return true;
93
  }
@@ -98,16 +98,16 @@ abstract class Google_IO_Abstract
98
  /**
99
  * Execute an HTTP Request
100
  *
101
- * @param Google_HttpRequest $request the http request to be executed
102
- * @return Google_HttpRequest http request with the response http code,
103
  * response headers and response body filled in
104
- * @throws Google_IO_Exception on curl or IO error
105
  */
106
- public function makeRequest(Google_Http_Request $request)
107
  {
108
  // First, check to see if we have a valid cached version.
109
  $cached = $this->getCachedRequest($request);
110
- if ($cached !== false && $cached instanceof Google_Http_Request) {
111
  if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
112
  return $cached;
113
  }
@@ -140,13 +140,13 @@ abstract class Google_IO_Abstract
140
 
141
  /**
142
  * @visible for testing.
143
- * @param Google_Http_Request $request
144
- * @return Google_Http_Request|bool Returns the cached object or
145
  * false if the operation was unsuccessful.
146
  */
147
- public function getCachedRequest(Google_Http_Request $request)
148
  {
149
- if (false === Google_Http_CacheParser::isRequestCacheable($request)) {
150
  return false;
151
  }
152
 
@@ -156,10 +156,10 @@ abstract class Google_IO_Abstract
156
  /**
157
  * @visible for testing
158
  * Process an http request that contains an enclosed entity.
159
- * @param Google_Http_Request $request
160
- * @return Google_Http_Request Processed request with the enclosed entity.
161
  */
162
- public function processEntityRequest(Google_Http_Request $request)
163
  {
164
  $postBody = $request->getPostBody();
165
  $contentType = $request->getRequestHeader("content-type");
@@ -188,14 +188,14 @@ abstract class Google_IO_Abstract
188
  /**
189
  * Check if an already cached request must be revalidated, and if so update
190
  * the request with the correct ETag headers.
191
- * @param Google_Http_Request $cached A previously cached response.
192
- * @param Google_Http_Request $request The outbound request.
193
  * return bool If the cached object needs to be revalidated, false if it is
194
  * still current and can be re-used.
195
  */
196
  protected function checkMustRevalidateCachedRequest($cached, $request)
197
  {
198
- if (Google_Http_CacheParser::mustRevalidate($cached)) {
199
  $addHeaders = array();
200
  if ($cached->getResponseHeader('etag')) {
201
  // [13.3.4] If an entity tag has been provided by the origin server,
@@ -214,7 +214,7 @@ abstract class Google_IO_Abstract
214
 
215
  /**
216
  * Update a cached request, using the headers from the last response.
217
- * @param Google_HttpRequest $cached A previously cached response.
218
  * @param mixed Associative array of response headers from the last request.
219
  */
220
  protected function updateCachedRequest($cached, $responseHeaders)
19
  * Abstract IO base class
20
  */
21
 
22
+ abstract class W3TCG_Google_IO_Abstract
23
  {
24
  const UNKNOWN_CODE = 0;
25
  const FORM_URLENCODED = 'application/x-www-form-urlencoded';
29
  );
30
  private static $ENTITY_HTTP_METHODS = array("POST" => null, "PUT" => null);
31
 
32
+ /** @var W3TCG_Google_Client */
33
  protected $client;
34
 
35
+ public function __construct(W3TCG_Google_Client $client)
36
  {
37
  $this->client = $client;
38
+ $timeout = $client->getClassConfig('W3TCG_Google_IO_Abstract', 'request_timeout_seconds');
39
  if ($timeout > 0) {
40
  $this->setTimeout($timeout);
41
  }
42
  }
43
 
44
  /**
45
+ * Executes a W3TCG_Google_Http_Request and returns the resulting populated W3TCG_Google_Http_Request
46
+ * @param W3TCG_Google_Http_Request $request
47
+ * @return W3TCG_Google_Http_Request $request
48
  */
49
+ abstract public function executeRequest(W3TCG_Google_Http_Request $request);
50
 
51
  /**
52
  * Set options that update the transport implementation's behavior.
80
  /**
81
  * @visible for testing.
82
  * Cache the response to an HTTP request if it is cacheable.
83
+ * @param W3TCG_Google_Http_Request $request
84
  * @return bool Returns true if the insertion was successful.
85
  * Otherwise, return false.
86
  */
87
+ public function setCachedRequest(W3TCG_Google_Http_Request $request)
88
  {
89
  // Determine if the request is cacheable.
90
+ if (W3TCG_Google_Http_CacheParser::isResponseCacheable($request)) {
91
  $this->client->getCache()->set($request->getCacheKey(), $request);
92
  return true;
93
  }
98
  /**
99
  * Execute an HTTP Request
100
  *
101
+ * @param W3TCG_Google_HttpRequest $request the http request to be executed
102
+ * @return W3TCG_Google_HttpRequest http request with the response http code,
103
  * response headers and response body filled in
104
+ * @throws W3TCG_Google_IO_Exception on curl or IO error
105
  */
106
+ public function makeRequest(W3TCG_Google_Http_Request $request)
107
  {
108
  // First, check to see if we have a valid cached version.
109
  $cached = $this->getCachedRequest($request);
110
+ if ($cached !== false && $cached instanceof W3TCG_Google_Http_Request) {
111
  if (!$this->checkMustRevalidateCachedRequest($cached, $request)) {
112
  return $cached;
113
  }
140
 
141
  /**
142
  * @visible for testing.
143
+ * @param W3TCG_Google_Http_Request $request
144
+ * @return W3TCG_Google_Http_Request|bool Returns the cached object or
145
  * false if the operation was unsuccessful.
146
  */
147
+ public function getCachedRequest(W3TCG_Google_Http_Request $request)
148
  {
149
+ if (false === W3TCG_Google_Http_CacheParser::isRequestCacheable($request)) {
150
  return false;
151
  }
152
 
156
  /**
157
  * @visible for testing
158
  * Process an http request that contains an enclosed entity.
159
+ * @param W3TCG_Google_Http_Request $request
160
+ * @return W3TCG_Google_Http_Request Processed request with the enclosed entity.
161
  */
162
+ public function processEntityRequest(W3TCG_Google_Http_Request $request)
163
  {
164
  $postBody = $request->getPostBody();
165
  $contentType = $request->getRequestHeader("content-type");
188
  /**
189
  * Check if an already cached request must be revalidated, and if so update
190
  * the request with the correct ETag headers.
191
+ * @param W3TCG_Google_Http_Request $cached A previously cached response.
192
+ * @param W3TCG_Google_Http_Request $request The outbound request.
193
  * return bool If the cached object needs to be revalidated, false if it is
194
  * still current and can be re-used.
195
  */
196
  protected function checkMustRevalidateCachedRequest($cached, $request)
197
  {
198
+ if (W3TCG_Google_Http_CacheParser::mustRevalidate($cached)) {
199
  $addHeaders = array();
200
  if ($cached->getResponseHeader('etag')) {
201
  // [13.3.4] If an entity tag has been provided by the origin server,
214
 
215
  /**
216
  * Update a cached request, using the headers from the last response.
217
+ * @param W3TCG_Google_HttpRequest $cached A previously cached response.
218
  * @param mixed Associative array of response headers from the last request.
219
  */
220
  protected function updateCachedRequest($cached, $responseHeaders)
lib/Google/IO/Curl.php CHANGED
@@ -16,12 +16,12 @@
16
  */
17
 
18
  /**
19
- * Curl based implementation of Google_IO.
20
  *
21
  * @author Stuart Langley <slangley@google.com>
22
  */
23
 
24
- class Google_IO_Curl extends Google_IO_Abstract
25
  {
26
  // cURL hex representation of version 7.30.0
27
  const NO_QUIRK_VERSION = 0x071E00;
@@ -30,12 +30,12 @@ class Google_IO_Curl extends Google_IO_Abstract
30
  /**
31
  * Execute an HTTP Request
32
  *
33
- * @param Google_HttpRequest $request the http request to be executed
34
- * @return Google_HttpRequest http request with the response http code,
35
  * response headers and response body filled in
36
- * @throws Google_IO_Exception on curl or IO error
37
  */
38
- public function executeRequest(Google_Http_Request $request)
39
  {
40
  $curl = curl_init();
41
 
@@ -77,7 +77,7 @@ class Google_IO_Curl extends Google_IO_Abstract
77
 
78
  $response = curl_exec($curl);
79
  if ($response === false) {
80
- throw new Google_IO_Exception(curl_error($curl));
81
  }
82
  $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
83
 
@@ -131,6 +131,6 @@ class Google_IO_Curl extends Google_IO_Abstract
131
  {
132
  $ver = curl_version();
133
  $versionNum = $ver['version_number'];
134
- return $versionNum < Google_IO_Curl::NO_QUIRK_VERSION;
135
  }
136
  }
16
  */
17
 
18
  /**
19
+ * Curl based implementation of W3TCG_Google_IO.
20
  *
21
  * @author Stuart Langley <slangley@google.com>
22
  */
23
 
24
+ class W3TCG_Google_IO_Curl extends W3TCG_Google_IO_Abstract
25
  {
26
  // cURL hex representation of version 7.30.0
27
  const NO_QUIRK_VERSION = 0x071E00;
30
  /**
31
  * Execute an HTTP Request
32
  *
33
+ * @param W3TCG_Google_HttpRequest $request the http request to be executed
34
+ * @return W3TCG_Google_HttpRequest http request with the response http code,
35
  * response headers and response body filled in
36
+ * @throws W3TCG_Google_IO_Exception on curl or IO error
37
  */
38
+ public function executeRequest(W3TCG_Google_Http_Request $request)
39
  {
40
  $curl = curl_init();
41
 
77
 
78
  $response = curl_exec($curl);
79
  if ($response === false) {
80
+ throw new W3TCG_Google_IO_Exception(curl_error($curl));
81
  }
82
  $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
83
 
131
  {
132
  $ver = curl_version();
133
  $versionNum = $ver['version_number'];
134
+ return $versionNum < W3TCG_Google_IO_Curl::NO_QUIRK_VERSION;
135
  }
136
  }
lib/Google/IO/Exception.php CHANGED
@@ -15,6 +15,6 @@
15
  * limitations under the License.
16
  */
17
 
18
- class Google_IO_Exception extends Google_Exception
19
  {
20
  }
15
  * limitations under the License.
16
  */
17
 
18
+ class W3TCG_Google_IO_Exception extends W3TCG_Google_Exception
19
  {
20
  }
lib/Google/IO/Stream.php CHANGED
@@ -16,12 +16,12 @@
16
  */
17
 
18
  /**
19
- * Http Streams based implementation of Google_IO.
20
  *
21
  * @author Stuart Langley <slangley@google.com>
22
  */
23
 
24
- class Google_IO_Stream extends Google_IO_Abstract
25
  {
26
  const TIMEOUT = "timeout";
27
  const ZLIB = "compress.zlib://";
@@ -41,12 +41,12 @@ class Google_IO_Stream extends Google_IO_Abstract
41
  /**
42
  * Execute an HTTP Request
43
  *
44
- * @param Google_HttpRequest $request the http request to be executed
45
- * @return Google_HttpRequest http request with the response http code,
46
  * response headers and response body filled in
47
- * @throws Google_IO_Exception on curl or IO error
48
  */
49
- public function executeRequest(Google_Http_Request $request)
50
  {
51
  $default_options = stream_context_get_options(stream_context_get_default());
52
 
@@ -107,7 +107,7 @@ class Google_IO_Stream extends Google_IO_Abstract
107
  // END - error trap.
108
 
109
  if ($this->trappedErrorNumber) {
110
- throw new Google_IO_Exception(
111
  sprintf(
112
  "HTTP Error: Unable to connect: '%s'",
113
  $this->trappedErrorString
@@ -130,7 +130,7 @@ class Google_IO_Stream extends Google_IO_Abstract
130
  }
131
 
132
  if (false === $response_data) {
133
- throw new Google_IO_Exception(
134
  sprintf(
135
  "HTTP Error: Unable to connect: '%s'",
136
  $respHttpCode
16
  */
17
 
18
  /**
19
+ * Http Streams based implementation of W3TCG_Google_IO.
20
  *
21
  * @author Stuart Langley <slangley@google.com>
22
  */
23
 
24
+ class W3TCG_Google_IO_Stream extends W3TCG_Google_IO_Abstract
25
  {
26
  const TIMEOUT = "timeout";
27
  const ZLIB = "compress.zlib://";
41
  /**
42
  * Execute an HTTP Request
43
  *
44
+ * @param W3TCG_Google_HttpRequest $request the http request to be executed
45
+ * @return W3TCG_Google_HttpRequest http request with the response http code,
46
  * response headers and response body filled in
47
+ * @throws W3TCG_Google_IO_Exception on curl or IO error
48
  */
49
+ public function executeRequest(W3TCG_Google_Http_Request $request)
50
  {
51
  $default_options = stream_context_get_options(stream_context_get_default());
52
 
107
  // END - error trap.
108
 
109
  if ($this->trappedErrorNumber) {
110
+ throw new W3TCG_Google_IO_Exception(
111
  sprintf(
112
  "HTTP Error: Unable to connect: '%s'",
113
  $this->trappedErrorString
130
  }
131
 
132
  if (false === $response_data) {
133
+ throw new W3TCG_Google_IO_Exception(
134
  sprintf(
135
  "HTTP Error: Unable to connect: '%s'",
136
  $respHttpCode
lib/Google/Model.php CHANGED
@@ -23,7 +23,7 @@
23
  * @author Chirag Shah <chirags@google.com>
24
  *
25
  */
26
- class Google_Model implements ArrayAccess
27
  {
28
  protected $internal_gapi_mappings = array();
29
  protected $modelData = array();
@@ -99,9 +99,9 @@ class Google_Model implements ArrayAccess
99
  property_exists($this, $key)) {
100
  $this->$key = $val;
101
  unset($array[$key]);
102
- } elseif (property_exists($this, $camelKey = Google_Utils::camelCase($key))) {
103
- // This checks if property exists as camelCase, leaving it in array as snake_case
104
- // in case of backwards compatibility issues.
105
  $this->$camelKey = $val;
106
  }
107
  }
@@ -157,7 +157,7 @@ class Google_Model implements ArrayAccess
157
  */
158
  private function getSimpleValue($value)
159
  {
160
- if ($value instanceof Google_Model) {
161
  return $value->toSimpleObject();
162
  } else if (is_array($value)) {
163
  $return = array();
@@ -219,14 +219,14 @@ class Google_Model implements ArrayAccess
219
 
220
  /**
221
  * Verify if $obj is an array.
222
- * @throws Google_Exception Thrown if $obj isn't an array.
223
  * @param array $obj Items that should be validated.
224
  * @param string $method Method expecting an array as an argument.
225
  */
226
  public function assertIsArray($obj, $method)
227
  {
228
  if ($obj && !is_array($obj)) {
229
- throw new Google_Exception(
230
  "Incorrect parameter type passed to $method(). Expected an array."
231
  );
232
  }
23
  * @author Chirag Shah <chirags@google.com>
24
  *
25
  */
26
+ class W3TCG_Google_Model implements ArrayAccess
27
  {
28
  protected $internal_gapi_mappings = array();
29
  protected $modelData = array();
99
  property_exists($this, $key)) {
100
  $this->$key = $val;
101
  unset($array[$key]);
102
+ } elseif (property_exists($this, $camelKey = W3TCG_Google_Utils::camelCase($key))) {
103
+ // For backwards compatibility, this checks if property exists as camelCase, leaving
104
+ // it in array as snake_case
105
  $this->$camelKey = $val;
106
  }
107
  }
157
  */
158
  private function getSimpleValue($value)
159
  {
160
+ if ($value instanceof W3TCG_Google_Model) {
161
  return $value->toSimpleObject();
162
  } else if (is_array($value)) {
163
  $return = array();
219
 
220
  /**
221
  * Verify if $obj is an array.
222
+ * @throws W3TCG_Google_Exception Thrown if $obj isn't an array.
223
  * @param array $obj Items that should be validated.
224
  * @param string $method Method expecting an array as an argument.
225
  */
226
  public function assertIsArray($obj, $method)
227
  {
228
  if ($obj && !is_array($obj)) {
229
+ throw new W3TCG_Google_Exception(
230
  "Incorrect parameter type passed to $method(). Expected an array."
231
  );
232
  }
lib/Google/Service.php CHANGED
@@ -15,7 +15,7 @@
15
  * limitations under the License.
16
  */
17
 
18
- class Google_Service
19
  {
20
  public $version;
21
  public $servicePath;
@@ -23,14 +23,14 @@ class Google_Service
23
  public $resource;
24
  private $client;
25
 
26
- public function __construct(Google_Client $client)
27
  {
28
  $this->client = $client;
29
  }
30
 
31
  /**
32
- * Return the associated Google_Client class.
33
- * @return Google_Client
34
  */
35
  public function getClient()
36
  {
15
  * limitations under the License.
16
  */
17
 
18
+ class W3TCG_Google_Service
19
  {
20
  public $version;
21
  public $servicePath;
23
  public $resource;
24
  private $client;
25
 
26
+ public function __construct(W3TCG_Google_Client $client)
27
  {
28
  $this->client = $client;
29
  }
30
 
31
  /**
32
+ * Return the associated W3TCG_Google_Client class.
33
+ * @return W3TCG_Google_Client
34
  */
35
  public function getClient()
36
  {
lib/Google/Service/Drive.php CHANGED
@@ -29,7 +29,7 @@
29
  *
30
  * @author Google, Inc.
31
  */
32
- class Google_Service_Drive extends Google_Service
33
  {
34
  /** View and manage the files and documents in your Google Drive. */
35
  const DRIVE = "https://www.googleapis.com/auth/drive";
@@ -64,16 +64,16 @@ class Google_Service_Drive extends Google_Service
64
  /**
65
  * Constructs the internal representation of the Drive service.
66
  *
67
- * @param Google_Client $client
68
  */
69
- public function __construct(Google_Client $client)
70
  {
71
  parent::__construct($client);
72
  $this->servicePath = 'drive/v2/';
73
  $this->version = 'v2';
74
  $this->serviceName = 'drive';
75
 
76
- $this->about = new Google_Service_Drive_About_Resource(
77
  $this,
78
  $this->serviceName,
79
  'about',
@@ -100,7 +100,7 @@ class Google_Service_Drive extends Google_Service
100
  )
101
  )
102
  );
103
- $this->apps = new Google_Service_Drive_Apps_Resource(
104
  $this,
105
  $this->serviceName,
106
  'apps',
@@ -137,7 +137,7 @@ class Google_Service_Drive extends Google_Service
137
  )
138
  )
139
  );
140
- $this->changes = new Google_Service_Drive_Changes_Resource(
141
  $this,
142
  $this->serviceName,
143
  'changes',
@@ -207,7 +207,7 @@ class Google_Service_Drive extends Google_Service
207
  )
208
  )
209
  );
210
- $this->channels = new Google_Service_Drive_Channels_Resource(
211
  $this,
212
  $this->serviceName,
213
  'channels',
@@ -221,7 +221,7 @@ class Google_Service_Drive extends Google_Service
221
  )
222
  )
223
  );
224
- $this->children = new Google_Service_Drive_Children_Resource(
225
  $this,
226
  $this->serviceName,
227
  'children',
@@ -293,7 +293,7 @@ class Google_Service_Drive extends Google_Service
293
  )
294
  )
295
  );
296
- $this->comments = new Google_Service_Drive_Comments_Resource(
297
  $this,
298
  $this->serviceName,
299
  'comments',
@@ -403,7 +403,7 @@ class Google_Service_Drive extends Google_Service
403
  )
404
  )
405
  );
406
- $this->files = new Google_Service_Drive_Files_Resource(
407
  $this,
408
  $this->serviceName,
409
  'files',
@@ -717,7 +717,7 @@ class Google_Service_Drive extends Google_Service
717
  )
718
  )
719
  );
720
- $this->parents = new Google_Service_Drive_Parents_Resource(
721
  $this,
722
  $this->serviceName,
723
  'parents',
@@ -777,7 +777,7 @@ class Google_Service_Drive extends Google_Service
777
  )
778
  )
779
  );
780
- $this->permissions = new Google_Service_Drive_Permissions_Resource(
781
  $this,
782
  $this->serviceName,
783
  'permissions',
@@ -893,7 +893,7 @@ class Google_Service_Drive extends Google_Service
893
  )
894
  )
895
  );
896
- $this->properties = new Google_Service_Drive_Properties_Resource(
897
  $this,
898
  $this->serviceName,
899
  'properties',
@@ -999,7 +999,7 @@ class Google_Service_Drive extends Google_Service
999
  )
1000
  )
1001
  );
1002
- $this->realtime = new Google_Service_Drive_Realtime_Resource(
1003
  $this,
1004
  $this->serviceName,
1005
  'realtime',
@@ -1037,7 +1037,7 @@ class Google_Service_Drive extends Google_Service
1037
  )
1038
  )
1039
  );
1040
- $this->replies = new Google_Service_Drive_Replies_Resource(
1041
  $this,
1042
  $this->serviceName,
1043
  'replies',
@@ -1173,7 +1173,7 @@ class Google_Service_Drive extends Google_Service
1173
  )
1174
  )
1175
  );
1176
- $this->revisions = new Google_Service_Drive_Revisions_Resource(
1177
  $this,
1178
  $this->serviceName,
1179
  'revisions',
@@ -1261,11 +1261,11 @@ class Google_Service_Drive extends Google_Service
1261
  * The "about" collection of methods.
1262
  * Typical usage is:
1263
  * <code>
1264
- * $driveService = new Google_Service_Drive(...);
1265
  * $about = $driveService->about;
1266
  * </code>
1267
  */
1268
- class Google_Service_Drive_About_Resource extends Google_Service_Resource
1269
  {
1270
 
1271
  /**
@@ -1282,13 +1282,13 @@ class Google_Service_Drive_About_Resource extends Google_Service_Resource
1282
  * Maximum number of remaining change IDs to count
1283
  * @opt_param string startChangeId
1284
  * Change ID to start counting from when calculating number of remaining change IDs
1285
- * @return Google_Service_Drive_About
1286
  */
1287
  public function get($optParams = array())
1288
  {
1289
  $params = array();
1290
  $params = array_merge($params, $optParams);
1291
- return $this->call('get', array($params), "Google_Service_Drive_About");
1292
  }
1293
  }
1294
 
@@ -1296,11 +1296,11 @@ class Google_Service_Drive_About_Resource extends Google_Service_Resource
1296
  * The "apps" collection of methods.
1297
  * Typical usage is:
1298
  * <code>
1299
- * $driveService = new Google_Service_Drive(...);
1300
  * $apps = $driveService->apps;
1301
  * </code>
1302
  */
1303
- class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
1304
  {
1305
 
1306
  /**
@@ -1309,13 +1309,13 @@ class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
1309
  * @param string $appId
1310
  * The ID of the app.
1311
  * @param array $optParams Optional parameters.
1312
- * @return Google_Service_Drive_App
1313
  */
1314
  public function get($appId, $optParams = array())
1315
  {
1316
  $params = array('appId' => $appId);
1317
  $params = array_merge($params, $optParams);
1318
- return $this->call('get', array($params), "Google_Service_Drive_App");
1319
  }
1320
  /**
1321
  * Lists a user's installed apps. (apps.listApps)
@@ -1333,13 +1333,13 @@ class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
1333
  * A comma-separated list of MIME types for open with filtering. All apps within the given app
1334
  * query scope which can open any of the given MIME types will be included in the response. If
1335
  * appFilterExtensions are provided as well, the result is a union of the two resulting app lists.
1336
- * @return Google_Service_Drive_AppList
1337
  */
1338
  public function listApps($optParams = array())
1339
  {
1340
  $params = array();
1341
  $params = array_merge($params, $optParams);
1342
- return $this->call('list', array($params), "Google_Service_Drive_AppList");
1343
  }
1344
  }
1345
 
@@ -1347,11 +1347,11 @@ class Google_Service_Drive_Apps_Resource extends Google_Service_Resource
1347
  * The "changes" collection of methods.
1348
  * Typical usage is:
1349
  * <code>
1350
- * $driveService = new Google_Service_Drive(...);
1351
  * $changes = $driveService->changes;
1352
  * </code>
1353
  */
1354
- class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
1355
  {
1356
 
1357
  /**
@@ -1360,13 +1360,13 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
1360
  * @param string $changeId
1361
  * The ID of the change.
1362
  * @param array $optParams Optional parameters.
1363
- * @return Google_Service_Drive_Change
1364
  */
1365
  public function get($changeId, $optParams = array())
1366
  {
1367
  $params = array('changeId' => $changeId);
1368
  $params = array_merge($params, $optParams);
1369
- return $this->call('get', array($params), "Google_Service_Drive_Change");
1370
  }
1371
  /**
1372
  * Lists the changes for a user. (changes.listChanges)
@@ -1385,18 +1385,18 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
1385
  * Maximum number of changes to return.
1386
  * @opt_param string pageToken
1387
  * Page token for changes.
1388
- * @return Google_Service_Drive_ChangeList
1389
  */
1390
  public function listChanges($optParams = array())
1391
  {
1392
  $params = array();
1393
  $params = array_merge($params, $optParams);
1394
- return $this->call('list', array($params), "Google_Service_Drive_ChangeList");
1395
  }
1396
  /**
1397
  * Subscribe to changes for a user. (changes.watch)
1398
  *
1399
- * @param Google_Channel $postBody
1400
  * @param array $optParams Optional parameters.
1401
  *
1402
  * @opt_param bool includeSubscribed
@@ -1411,13 +1411,13 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
1411
  * Maximum number of changes to return.
1412
  * @opt_param string pageToken
1413
  * Page token for changes.
1414
- * @return Google_Service_Drive_Channel
1415
  */
1416
- public function watch(Google_Service_Drive_Channel $postBody, $optParams = array())
1417
  {
1418
  $params = array('postBody' => $postBody);
1419
  $params = array_merge($params, $optParams);
1420
- return $this->call('watch', array($params), "Google_Service_Drive_Channel");
1421
  }
1422
  }
1423
 
@@ -1425,20 +1425,20 @@ class Google_Service_Drive_Changes_Resource extends Google_Service_Resource
1425
  * The "channels" collection of methods.
1426
  * Typical usage is:
1427
  * <code>
1428
- * $driveService = new Google_Service_Drive(...);
1429
  * $channels = $driveService->channels;
1430
  * </code>
1431
  */
1432
- class Google_Service_Drive_Channels_Resource extends Google_Service_Resource
1433
  {
1434
 
1435
  /**
1436
  * Stop watching resources through this channel (channels.stop)
1437
  *
1438
- * @param Google_Channel $postBody
1439
  * @param array $optParams Optional parameters.
1440
  */
1441
- public function stop(Google_Service_Drive_Channel $postBody, $optParams = array())
1442
  {
1443
  $params = array('postBody' => $postBody);
1444
  $params = array_merge($params, $optParams);
@@ -1450,11 +1450,11 @@ class Google_Service_Drive_Channels_Resource extends Google_Service_Resource
1450
  * The "children" collection of methods.
1451
  * Typical usage is:
1452
  * <code>
1453
- * $driveService = new Google_Service_Drive(...);
1454
  * $children = $driveService->children;
1455
  * </code>
1456
  */
1457
- class Google_Service_Drive_Children_Resource extends Google_Service_Resource
1458
  {
1459
 
1460
  /**
@@ -1480,28 +1480,28 @@ class Google_Service_Drive_Children_Resource extends Google_Service_Resource
1480
  * @param string $childId
1481
  * The ID of the child.
1482
  * @param array $optParams Optional parameters.
1483
- * @return Google_Service_Drive_ChildReference
1484
  */
1485
  public function get($folderId, $childId, $optParams = array())
1486
  {
1487
  $params = array('folderId' => $folderId, 'childId' => $childId);
1488
  $params = array_merge($params, $optParams);
1489
- return $this->call('get', array($params), "Google_Service_Drive_ChildReference");
1490
  }
1491
  /**
1492
  * Inserts a file into a folder. (children.insert)
1493
  *
1494
  * @param string $folderId
1495
  * The ID of the folder.
1496
- * @param Google_ChildReference $postBody
1497
  * @param array $optParams Optional parameters.
1498
- * @return Google_Service_Drive_ChildReference
1499
  */
1500
- public function insert($folderId, Google_Service_Drive_ChildReference $postBody, $optParams = array())
1501
  {
1502
  $params = array('folderId' => $folderId, 'postBody' => $postBody);
1503
  $params = array_merge($params, $optParams);
1504
- return $this->call('insert', array($params), "Google_Service_Drive_ChildReference");
1505
  }
1506
  /**
1507
  * Lists a folder's children. (children.listChildren)
@@ -1516,13 +1516,13 @@ class Google_Service_Drive_Children_Resource extends Google_Service_Resource
1516
  * Page token for children.
1517
  * @opt_param int maxResults
1518
  * Maximum number of children to return.
1519
- * @return Google_Service_Drive_ChildList
1520
  */
1521
  public function listChildren($folderId, $optParams = array())
1522
  {
1523
  $params = array('folderId' => $folderId);
1524
  $params = array_merge($params, $optParams);
1525
- return $this->call('list', array($params), "Google_Service_Drive_ChildList");
1526
  }
1527
  }
1528
 
@@ -1530,11 +1530,11 @@ class Google_Service_Drive_Children_Resource extends Google_Service_Resource
1530
  * The "comments" collection of methods.
1531
  * Typical usage is:
1532
  * <code>
1533
- * $driveService = new Google_Service_Drive(...);
1534
  * $comments = $driveService->comments;
1535
  * </code>
1536
  */
1537
- class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
1538
  {
1539
 
1540
  /**
@@ -1564,28 +1564,28 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
1564
  * @opt_param bool includeDeleted
1565
  * If set, this will succeed when retrieving a deleted comment, and will include any deleted
1566
  * replies.
1567
- * @return Google_Service_Drive_Comment
1568
  */
1569
  public function get($fileId, $commentId, $optParams = array())
1570
  {
1571
  $params = array('fileId' => $fileId, 'commentId' => $commentId);
1572
  $params = array_merge($params, $optParams);
1573
- return $this->call('get', array($params), "Google_Service_Drive_Comment");
1574
  }
1575
  /**
1576
  * Creates a new comment on the given file. (comments.insert)
1577
  *
1578
  * @param string $fileId
1579
  * The ID of the file.
1580
- * @param Google_Comment $postBody
1581
  * @param array $optParams Optional parameters.
1582
- * @return Google_Service_Drive_Comment
1583
  */
1584
- public function insert($fileId, Google_Service_Drive_Comment $postBody, $optParams = array())
1585
  {
1586
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1587
  $params = array_merge($params, $optParams);
1588
- return $this->call('insert', array($params), "Google_Service_Drive_Comment");
1589
  }
1590
  /**
1591
  * Lists a file's comments. (comments.listComments)
@@ -1605,13 +1605,13 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
1605
  * will be returned.
1606
  * @opt_param int maxResults
1607
  * The maximum number of discussions to include in the response, used for paging.
1608
- * @return Google_Service_Drive_CommentList
1609
  */
1610
  public function listComments($fileId, $optParams = array())
1611
  {
1612
  $params = array('fileId' => $fileId);
1613
  $params = array_merge($params, $optParams);
1614
- return $this->call('list', array($params), "Google_Service_Drive_CommentList");
1615
  }
1616
  /**
1617
  * Updates an existing comment. This method supports patch semantics.
@@ -1621,15 +1621,15 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
1621
  * The ID of the file.
1622
  * @param string $commentId
1623
  * The ID of the comment.
1624
- * @param Google_Comment $postBody
1625
  * @param array $optParams Optional parameters.
1626
- * @return Google_Service_Drive_Comment
1627
  */
1628
- public function patch($fileId, $commentId, Google_Service_Drive_Comment $postBody, $optParams = array())
1629
  {
1630
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
1631
  $params = array_merge($params, $optParams);
1632
- return $this->call('patch', array($params), "Google_Service_Drive_Comment");
1633
  }
1634
  /**
1635
  * Updates an existing comment. (comments.update)
@@ -1638,15 +1638,15 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
1638
  * The ID of the file.
1639
  * @param string $commentId
1640
  * The ID of the comment.
1641
- * @param Google_Comment $postBody
1642
  * @param array $optParams Optional parameters.
1643
- * @return Google_Service_Drive_Comment
1644
  */
1645
- public function update($fileId, $commentId, Google_Service_Drive_Comment $postBody, $optParams = array())
1646
  {
1647
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
1648
  $params = array_merge($params, $optParams);
1649
- return $this->call('update', array($params), "Google_Service_Drive_Comment");
1650
  }
1651
  }
1652
 
@@ -1654,11 +1654,11 @@ class Google_Service_Drive_Comments_Resource extends Google_Service_Resource
1654
  * The "files" collection of methods.
1655
  * Typical usage is:
1656
  * <code>
1657
- * $driveService = new Google_Service_Drive(...);
1658
  * $files = $driveService->files;
1659
  * </code>
1660
  */
1661
- class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1662
  {
1663
 
1664
  /**
@@ -1666,7 +1666,7 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1666
  *
1667
  * @param string $fileId
1668
  * The ID of the file to copy.
1669
- * @param Google_DriveFile $postBody
1670
  * @param array $optParams Optional parameters.
1671
  *
1672
  * @opt_param bool convert
@@ -1685,13 +1685,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1685
  * The timed text track name.
1686
  * @opt_param string timedTextLanguage
1687
  * The language of the timed text.
1688
- * @return Google_Service_Drive_DriveFile
1689
  */
1690
- public function copy($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array())
1691
  {
1692
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1693
  $params = array_merge($params, $optParams);
1694
- return $this->call('copy', array($params), "Google_Service_Drive_DriveFile");
1695
  }
1696
  /**
1697
  * Permanently deletes a file by ID. Skips the trash. (files.delete)
@@ -1730,18 +1730,18 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1730
  * Whether to update the view date after successfully retrieving the file.
1731
  * @opt_param string projection
1732
  * This parameter is deprecated and has no function.
1733
- * @return Google_Service_Drive_DriveFile
1734
  */
1735
  public function get($fileId, $optParams = array())
1736
  {
1737
  $params = array('fileId' => $fileId);
1738
  $params = array_merge($params, $optParams);
1739
- return $this->call('get', array($params), "Google_Service_Drive_DriveFile");
1740
  }
1741
  /**
1742
  * Insert a new file. (files.insert)
1743
  *
1744
- * @param Google_DriveFile $postBody
1745
  * @param array $optParams Optional parameters.
1746
  *
1747
  * @opt_param bool convert
@@ -1761,13 +1761,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1761
  * The timed text track name.
1762
  * @opt_param string timedTextLanguage
1763
  * The language of the timed text.
1764
- * @return Google_Service_Drive_DriveFile
1765
  */
1766
- public function insert(Google_Service_Drive_DriveFile $postBody, $optParams = array())
1767
  {
1768
  $params = array('postBody' => $postBody);
1769
  $params = array_merge($params, $optParams);
1770
- return $this->call('insert', array($params), "Google_Service_Drive_DriveFile");
1771
  }
1772
  /**
1773
  * Lists the user's files. (files.listFiles)
@@ -1784,13 +1784,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1784
  * This parameter is deprecated and has no function.
1785
  * @opt_param int maxResults
1786
  * Maximum number of files to return.
1787
- * @return Google_Service_Drive_FileList
1788
  */
1789
  public function listFiles($optParams = array())
1790
  {
1791
  $params = array();
1792
  $params = array_merge($params, $optParams);
1793
- return $this->call('list', array($params), "Google_Service_Drive_FileList");
1794
  }
1795
  /**
1796
  * Updates file metadata and/or content. This method supports patch semantics.
@@ -1798,7 +1798,7 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1798
  *
1799
  * @param string $fileId
1800
  * The ID of the file to update.
1801
- * @param Google_DriveFile $postBody
1802
  * @param array $optParams Optional parameters.
1803
  *
1804
  * @opt_param string addParents
@@ -1827,13 +1827,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1827
  * The language of the timed text.
1828
  * @opt_param string timedTextTrackName
1829
  * The timed text track name.
1830
- * @return Google_Service_Drive_DriveFile
1831
  */
1832
- public function patch($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array())
1833
  {
1834
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1835
  $params = array_merge($params, $optParams);
1836
- return $this->call('patch', array($params), "Google_Service_Drive_DriveFile");
1837
  }
1838
  /**
1839
  * Set the file's updated time to the current server time. (files.touch)
@@ -1841,13 +1841,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1841
  * @param string $fileId
1842
  * The ID of the file to update.
1843
  * @param array $optParams Optional parameters.
1844
- * @return Google_Service_Drive_DriveFile
1845
  */
1846
  public function touch($fileId, $optParams = array())
1847
  {
1848
  $params = array('fileId' => $fileId);
1849
  $params = array_merge($params, $optParams);
1850
- return $this->call('touch', array($params), "Google_Service_Drive_DriveFile");
1851
  }
1852
  /**
1853
  * Moves a file to the trash. (files.trash)
@@ -1855,13 +1855,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1855
  * @param string $fileId
1856
  * The ID of the file to trash.
1857
  * @param array $optParams Optional parameters.
1858
- * @return Google_Service_Drive_DriveFile
1859
  */
1860
  public function trash($fileId, $optParams = array())
1861
  {
1862
  $params = array('fileId' => $fileId);
1863
  $params = array_merge($params, $optParams);
1864
- return $this->call('trash', array($params), "Google_Service_Drive_DriveFile");
1865
  }
1866
  /**
1867
  * Restores a file from the trash. (files.untrash)
@@ -1869,20 +1869,20 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1869
  * @param string $fileId
1870
  * The ID of the file to untrash.
1871
  * @param array $optParams Optional parameters.
1872
- * @return Google_Service_Drive_DriveFile
1873
  */
1874
  public function untrash($fileId, $optParams = array())
1875
  {
1876
  $params = array('fileId' => $fileId);
1877
  $params = array_merge($params, $optParams);
1878
- return $this->call('untrash', array($params), "Google_Service_Drive_DriveFile");
1879
  }
1880
  /**
1881
  * Updates file metadata and/or content. (files.update)
1882
  *
1883
  * @param string $fileId
1884
  * The ID of the file to update.
1885
- * @param Google_DriveFile $postBody
1886
  * @param array $optParams Optional parameters.
1887
  *
1888
  * @opt_param string addParents
@@ -1911,20 +1911,20 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1911
  * The language of the timed text.
1912
  * @opt_param string timedTextTrackName
1913
  * The timed text track name.
1914
- * @return Google_Service_Drive_DriveFile
1915
  */
1916
- public function update($fileId, Google_Service_Drive_DriveFile $postBody, $optParams = array())
1917
  {
1918
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1919
  $params = array_merge($params, $optParams);
1920
- return $this->call('update', array($params), "Google_Service_Drive_DriveFile");
1921
  }
1922
  /**
1923
  * Subscribe to changes on a file (files.watch)
1924
  *
1925
  * @param string $fileId
1926
  * The ID for the file in question.
1927
- * @param Google_Channel $postBody
1928
  * @param array $optParams Optional parameters.
1929
  *
1930
  * @opt_param bool acknowledgeAbuse
@@ -1933,13 +1933,13 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1933
  * Whether to update the view date after successfully retrieving the file.
1934
  * @opt_param string projection
1935
  * This parameter is deprecated and has no function.
1936
- * @return Google_Service_Drive_Channel
1937
  */
1938
- public function watch($fileId, Google_Service_Drive_Channel $postBody, $optParams = array())
1939
  {
1940
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1941
  $params = array_merge($params, $optParams);
1942
- return $this->call('watch', array($params), "Google_Service_Drive_Channel");
1943
  }
1944
  }
1945
 
@@ -1947,11 +1947,11 @@ class Google_Service_Drive_Files_Resource extends Google_Service_Resource
1947
  * The "parents" collection of methods.
1948
  * Typical usage is:
1949
  * <code>
1950
- * $driveService = new Google_Service_Drive(...);
1951
  * $parents = $driveService->parents;
1952
  * </code>
1953
  */
1954
- class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
1955
  {
1956
 
1957
  /**
@@ -1977,28 +1977,28 @@ class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
1977
  * @param string $parentId
1978
  * The ID of the parent.
1979
  * @param array $optParams Optional parameters.
1980
- * @return Google_Service_Drive_ParentReference
1981
  */
1982
  public function get($fileId, $parentId, $optParams = array())
1983
  {
1984
  $params = array('fileId' => $fileId, 'parentId' => $parentId);
1985
  $params = array_merge($params, $optParams);
1986
- return $this->call('get', array($params), "Google_Service_Drive_ParentReference");
1987
  }
1988
  /**
1989
  * Adds a parent folder for a file. (parents.insert)
1990
  *
1991
  * @param string $fileId
1992
  * The ID of the file.
1993
- * @param Google_ParentReference $postBody
1994
  * @param array $optParams Optional parameters.
1995
- * @return Google_Service_Drive_ParentReference
1996
  */
1997
- public function insert($fileId, Google_Service_Drive_ParentReference $postBody, $optParams = array())
1998
  {
1999
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
2000
  $params = array_merge($params, $optParams);
2001
- return $this->call('insert', array($params), "Google_Service_Drive_ParentReference");
2002
  }
2003
  /**
2004
  * Lists a file's parents. (parents.listParents)
@@ -2006,13 +2006,13 @@ class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
2006
  * @param string $fileId
2007
  * The ID of the file.
2008
  * @param array $optParams Optional parameters.
2009
- * @return Google_Service_Drive_ParentList
2010
  */
2011
  public function listParents($fileId, $optParams = array())
2012
  {
2013
  $params = array('fileId' => $fileId);
2014
  $params = array_merge($params, $optParams);
2015
- return $this->call('list', array($params), "Google_Service_Drive_ParentList");
2016
  }
2017
  }
2018
 
@@ -2020,11 +2020,11 @@ class Google_Service_Drive_Parents_Resource extends Google_Service_Resource
2020
  * The "permissions" collection of methods.
2021
  * Typical usage is:
2022
  * <code>
2023
- * $driveService = new Google_Service_Drive(...);
2024
  * $permissions = $driveService->permissions;
2025
  * </code>
2026
  */
2027
- class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2028
  {
2029
 
2030
  /**
@@ -2050,13 +2050,13 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2050
  * @param string $permissionId
2051
  * The ID for the permission.
2052
  * @param array $optParams Optional parameters.
2053
- * @return Google_Service_Drive_Permission
2054
  */
2055
  public function get($fileId, $permissionId, $optParams = array())
2056
  {
2057
  $params = array('fileId' => $fileId, 'permissionId' => $permissionId);
2058
  $params = array_merge($params, $optParams);
2059
- return $this->call('get', array($params), "Google_Service_Drive_Permission");
2060
  }
2061
  /**
2062
  * Returns the permission ID for an email address. (permissions.getIdForEmail)
@@ -2064,20 +2064,20 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2064
  * @param string $email
2065
  * The email address for which to return a permission ID
2066
  * @param array $optParams Optional parameters.
2067
- * @return Google_Service_Drive_PermissionId
2068
  */
2069
  public function getIdForEmail($email, $optParams = array())
2070
  {
2071
  $params = array('email' => $email);
2072
  $params = array_merge($params, $optParams);
2073
- return $this->call('getIdForEmail', array($params), "Google_Service_Drive_PermissionId");
2074
  }
2075
  /**
2076
  * Inserts a permission for a file. (permissions.insert)
2077
  *
2078
  * @param string $fileId
2079
  * The ID for the file.
2080
- * @param Google_Permission $postBody
2081
  * @param array $optParams Optional parameters.
2082
  *
2083
  * @opt_param string emailMessage
@@ -2085,13 +2085,13 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2085
  * @opt_param bool sendNotificationEmails
2086
  * Whether to send notification emails when sharing to users or groups. This parameter is ignored
2087
  * and an email is sent if the role is owner.
2088
- * @return Google_Service_Drive_Permission
2089
  */
2090
- public function insert($fileId, Google_Service_Drive_Permission $postBody, $optParams = array())
2091
  {
2092
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
2093
  $params = array_merge($params, $optParams);
2094
- return $this->call('insert', array($params), "Google_Service_Drive_Permission");
2095
  }
2096
  /**
2097
  * Lists a file's permissions. (permissions.listPermissions)
@@ -2099,13 +2099,13 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2099
  * @param string $fileId
2100
  * The ID for the file.
2101
  * @param array $optParams Optional parameters.
2102
- * @return Google_Service_Drive_PermissionList
2103
  */
2104
  public function listPermissions($fileId, $optParams = array())
2105
  {
2106
  $params = array('fileId' => $fileId);
2107
  $params = array_merge($params, $optParams);
2108
- return $this->call('list', array($params), "Google_Service_Drive_PermissionList");
2109
  }
2110
  /**
2111
  * Updates a permission. This method supports patch semantics.
@@ -2115,18 +2115,18 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2115
  * The ID for the file.
2116
  * @param string $permissionId
2117
  * The ID for the permission.
2118
- * @param Google_Permission $postBody
2119
  * @param array $optParams Optional parameters.
2120
  *
2121
  * @opt_param bool transferOwnership
2122
  * Whether changing a role to 'owner' should also downgrade the current owners to writers.
2123
- * @return Google_Service_Drive_Permission
2124
  */
2125
- public function patch($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array())
2126
  {
2127
  $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
2128
  $params = array_merge($params, $optParams);
2129
- return $this->call('patch', array($params), "Google_Service_Drive_Permission");
2130
  }
2131
  /**
2132
  * Updates a permission. (permissions.update)
@@ -2135,18 +2135,18 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2135
  * The ID for the file.
2136
  * @param string $permissionId
2137
  * The ID for the permission.
2138
- * @param Google_Permission $postBody
2139
  * @param array $optParams Optional parameters.
2140
  *
2141
  * @opt_param bool transferOwnership
2142
  * Whether changing a role to 'owner' should also downgrade the current owners to writers.
2143
- * @return Google_Service_Drive_Permission
2144
  */
2145
- public function update($fileId, $permissionId, Google_Service_Drive_Permission $postBody, $optParams = array())
2146
  {
2147
  $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
2148
  $params = array_merge($params, $optParams);
2149
- return $this->call('update', array($params), "Google_Service_Drive_Permission");
2150
  }
2151
  }
2152
 
@@ -2154,11 +2154,11 @@ class Google_Service_Drive_Permissions_Resource extends Google_Service_Resource
2154
  * The "properties" collection of methods.
2155
  * Typical usage is:
2156
  * <code>
2157
- * $driveService = new Google_Service_Drive(...);
2158
  * $properties = $driveService->properties;
2159
  * </code>
2160
  */
2161
- class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
2162
  {
2163
 
2164
  /**
@@ -2190,28 +2190,28 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
2190
  *
2191
  * @opt_param string visibility
2192
  * The visibility of the property.
2193
- * @return Google_Service_Drive_Property
2194
  */
2195
  public function get($fileId, $propertyKey, $optParams = array())
2196
  {
2197
  $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
2198
  $params = array_merge($params, $optParams);
2199
- return $this->call('get', array($params), "Google_Service_Drive_Property");
2200
  }
2201
  /**
2202
  * Adds a property to a file. (properties.insert)
2203
  *
2204
  * @param string $fileId
2205
  * The ID of the file.
2206
- * @param Google_Property $postBody
2207
  * @param array $optParams Optional parameters.
2208
- * @return Google_Service_Drive_Property
2209
  */
2210
- public function insert($fileId, Google_Service_Drive_Property $postBody, $optParams = array())
2211
  {
2212
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
2213
  $params = array_merge($params, $optParams);
2214
- return $this->call('insert', array($params), "Google_Service_Drive_Property");
2215
  }
2216
  /**
2217
  * Lists a file's properties. (properties.listProperties)
@@ -2219,13 +2219,13 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
2219
  * @param string $fileId
2220
  * The ID of the file.
2221
  * @param array $optParams Optional parameters.
2222
- * @return Google_Service_Drive_PropertyList
2223
  */
2224
  public function listProperties($fileId, $optParams = array())
2225
  {
2226
  $params = array('fileId' => $fileId);
2227
  $params = array_merge($params, $optParams);
2228
- return $this->call('list', array($params), "Google_Service_Drive_PropertyList");
2229
  }
2230
  /**
2231
  * Updates a property. This method supports patch semantics. (properties.patch)
@@ -2234,18 +2234,18 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
2234
  * The ID of the file.
2235
  * @param string $propertyKey
2236
  * The key of the property.
2237
- * @param Google_Property $postBody
2238
  * @param array $optParams Optional parameters.
2239
  *
2240
  * @opt_param string visibility
2241
  * The visibility of the property.
2242
- * @return Google_Service_Drive_Property
2243
  */
2244
- public function patch($fileId, $propertyKey, Google_Service_Drive_Property $postBody, $optParams = array())
2245
  {
2246
  $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
2247
  $params = array_merge($params, $optParams);
2248
- return $this->call('patch', array($params), "Google_Service_Drive_Property");
2249
  }
2250
  /**
2251
  * Updates a property. (properties.update)
@@ -2254,18 +2254,18 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
2254
  * The ID of the file.
2255
  * @param string $propertyKey
2256
  * The key of the property.
2257
- * @param Google_Property $postBody
2258
  * @param array $optParams Optional parameters.
2259
  *
2260
  * @opt_param string visibility
2261
  * The visibility of the property.
2262
- * @return Google_Service_Drive_Property
2263
  */
2264
- public function update($fileId, $propertyKey, Google_Service_Drive_Property $postBody, $optParams = array())
2265
  {
2266
  $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
2267
  $params = array_merge($params, $optParams);
2268
- return $this->call('update', array($params), "Google_Service_Drive_Property");
2269
  }
2270
  }
2271
 
@@ -2273,11 +2273,11 @@ class Google_Service_Drive_Properties_Resource extends Google_Service_Resource
2273
  * The "realtime" collection of methods.
2274
  * Typical usage is:
2275
  * <code>
2276
- * $driveService = new Google_Service_Drive(...);
2277
  * $realtime = $driveService->realtime;
2278
  * </code>
2279
  */
2280
- class Google_Service_Drive_Realtime_Resource extends Google_Service_Resource
2281
  {
2282
 
2283
  /**
@@ -2325,11 +2325,11 @@ class Google_Service_Drive_Realtime_Resource extends Google_Service_Resource
2325
  * The "replies" collection of methods.
2326
  * Typical usage is:
2327
  * <code>
2328
- * $driveService = new Google_Service_Drive(...);
2329
  * $replies = $driveService->replies;
2330
  * </code>
2331
  */
2332
- class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2333
  {
2334
 
2335
  /**
@@ -2362,13 +2362,13 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2362
  *
2363
  * @opt_param bool includeDeleted
2364
  * If set, this will succeed when retrieving a deleted reply.
2365
- * @return Google_Service_Drive_CommentReply
2366
  */
2367
  public function get($fileId, $commentId, $replyId, $optParams = array())
2368
  {
2369
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
2370
  $params = array_merge($params, $optParams);
2371
- return $this->call('get', array($params), "Google_Service_Drive_CommentReply");
2372
  }
2373
  /**
2374
  * Creates a new reply to the given comment. (replies.insert)
@@ -2377,15 +2377,15 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2377
  * The ID of the file.
2378
  * @param string $commentId
2379
  * The ID of the comment.
2380
- * @param Google_CommentReply $postBody
2381
  * @param array $optParams Optional parameters.
2382
- * @return Google_Service_Drive_CommentReply
2383
  */
2384
- public function insert($fileId, $commentId, Google_Service_Drive_CommentReply $postBody, $optParams = array())
2385
  {
2386
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
2387
  $params = array_merge($params, $optParams);
2388
- return $this->call('insert', array($params), "Google_Service_Drive_CommentReply");
2389
  }
2390
  /**
2391
  * Lists all of the replies to a comment. (replies.listReplies)
@@ -2403,13 +2403,13 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2403
  * If set, all replies, including deleted replies (with content stripped) will be returned.
2404
  * @opt_param int maxResults
2405
  * The maximum number of replies to include in the response, used for paging.
2406
- * @return Google_Service_Drive_CommentReplyList
2407
  */
2408
  public function listReplies($fileId, $commentId, $optParams = array())
2409
  {
2410
  $params = array('fileId' => $fileId, 'commentId' => $commentId);
2411
  $params = array_merge($params, $optParams);
2412
- return $this->call('list', array($params), "Google_Service_Drive_CommentReplyList");
2413
  }
2414
  /**
2415
  * Updates an existing reply. This method supports patch semantics.
@@ -2421,15 +2421,15 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2421
  * The ID of the comment.
2422
  * @param string $replyId
2423
  * The ID of the reply.
2424
- * @param Google_CommentReply $postBody
2425
  * @param array $optParams Optional parameters.
2426
- * @return Google_Service_Drive_CommentReply
2427
  */
2428
- public function patch($fileId, $commentId, $replyId, Google_Service_Drive_CommentReply $postBody, $optParams = array())
2429
  {
2430
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
2431
  $params = array_merge($params, $optParams);
2432
- return $this->call('patch', array($params), "Google_Service_Drive_CommentReply");
2433
  }
2434
  /**
2435
  * Updates an existing reply. (replies.update)
@@ -2440,15 +2440,15 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2440
  * The ID of the comment.
2441
  * @param string $replyId
2442
  * The ID of the reply.
2443
- * @param Google_CommentReply $postBody
2444
  * @param array $optParams Optional parameters.
2445
- * @return Google_Service_Drive_CommentReply
2446
  */
2447
- public function update($fileId, $commentId, $replyId, Google_Service_Drive_CommentReply $postBody, $optParams = array())
2448
  {
2449
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
2450
  $params = array_merge($params, $optParams);
2451
- return $this->call('update', array($params), "Google_Service_Drive_CommentReply");
2452
  }
2453
  }
2454
 
@@ -2456,11 +2456,11 @@ class Google_Service_Drive_Replies_Resource extends Google_Service_Resource
2456
  * The "revisions" collection of methods.
2457
  * Typical usage is:
2458
  * <code>
2459
- * $driveService = new Google_Service_Drive(...);
2460
  * $revisions = $driveService->revisions;
2461
  * </code>
2462
  */
2463
- class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
2464
  {
2465
 
2466
  /**
@@ -2486,13 +2486,13 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
2486
  * @param string $revisionId
2487
  * The ID of the revision.
2488
  * @param array $optParams Optional parameters.
2489
- * @return Google_Service_Drive_Revision
2490
  */
2491
  public function get($fileId, $revisionId, $optParams = array())
2492
  {
2493
  $params = array('fileId' => $fileId, 'revisionId' => $revisionId);
2494
  $params = array_merge($params, $optParams);
2495
- return $this->call('get', array($params), "Google_Service_Drive_Revision");
2496
  }
2497
  /**
2498
  * Lists a file's revisions. (revisions.listRevisions)
@@ -2500,13 +2500,13 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
2500
  * @param string $fileId
2501
  * The ID of the file.
2502
  * @param array $optParams Optional parameters.
2503
- * @return Google_Service_Drive_RevisionList
2504
  */
2505
  public function listRevisions($fileId, $optParams = array())
2506
  {
2507
  $params = array('fileId' => $fileId);
2508
  $params = array_merge($params, $optParams);
2509
- return $this->call('list', array($params), "Google_Service_Drive_RevisionList");
2510
  }
2511
  /**
2512
  * Updates a revision. This method supports patch semantics. (revisions.patch)
@@ -2515,15 +2515,15 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
2515
  * The ID for the file.
2516
  * @param string $revisionId
2517
  * The ID for the revision.
2518
- * @param Google_Revision $postBody
2519
  * @param array $optParams Optional parameters.
2520
- * @return Google_Service_Drive_Revision
2521
  */
2522
- public function patch($fileId, $revisionId, Google_Service_Drive_Revision $postBody, $optParams = array())
2523
  {
2524
  $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
2525
  $params = array_merge($params, $optParams);
2526
- return $this->call('patch', array($params), "Google_Service_Drive_Revision");
2527
  }
2528
  /**
2529
  * Updates a revision. (revisions.update)
@@ -2532,45 +2532,45 @@ class Google_Service_Drive_Revisions_Resource extends Google_Service_Resource
2532
  * The ID for the file.
2533
  * @param string $revisionId
2534
  * The ID for the revision.
2535
- * @param Google_Revision $postBody
2536
  * @param array $optParams Optional parameters.
2537
- * @return Google_Service_Drive_Revision
2538
  */
2539
- public function update($fileId, $revisionId, Google_Service_Drive_Revision $postBody, $optParams = array())
2540
  {
2541
  $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
2542
  $params = array_merge($params, $optParams);
2543
- return $this->call('update', array($params), "Google_Service_Drive_Revision");
2544
  }
2545
  }
2546
 
2547
 
2548
 
2549
 
2550
- class Google_Service_Drive_About extends Google_Collection
2551
  {
2552
  protected $collection_key = 'quotaBytesByService';
2553
  protected $internal_gapi_mappings = array(
2554
  );
2555
- protected $additionalRoleInfoType = 'Google_Service_Drive_AboutAdditionalRoleInfo';
2556
  protected $additionalRoleInfoDataType = 'array';
2557
  public $domainSharingPolicy;
2558
  public $etag;
2559
- protected $exportFormatsType = 'Google_Service_Drive_AboutExportFormats';
2560
  protected $exportFormatsDataType = 'array';
2561
- protected $featuresType = 'Google_Service_Drive_AboutFeatures';
2562
  protected $featuresDataType = 'array';
2563
- protected $importFormatsType = 'Google_Service_Drive_AboutImportFormats';
2564
  protected $importFormatsDataType = 'array';
2565
  public $isCurrentAppInstalled;
2566
  public $kind;
2567
  public $languageCode;
2568
  public $largestChangeId;
2569
- protected $maxUploadSizesType = 'Google_Service_Drive_AboutMaxUploadSizes';
2570
  protected $maxUploadSizesDataType = 'array';
2571
  public $name;
2572
  public $permissionId;
2573
- protected $quotaBytesByServiceType = 'Google_Service_Drive_AboutQuotaBytesByService';
2574
  protected $quotaBytesByServiceDataType = 'array';
2575
  public $quotaBytesTotal;
2576
  public $quotaBytesUsed;
@@ -2580,7 +2580,7 @@ class Google_Service_Drive_About extends Google_Collection
2580
  public $remainingChangeIds;
2581
  public $rootFolderId;
2582
  public $selfLink;
2583
- protected $userType = 'Google_Service_Drive_User';
2584
  protected $userDataType = '';
2585
 
2586
  public function setAdditionalRoleInfo($additionalRoleInfo)
@@ -2781,7 +2781,7 @@ class Google_Service_Drive_About extends Google_Collection
2781
  {
2782
  return $this->selfLink;
2783
  }
2784
- public function setUser(Google_Service_Drive_User $user)
2785
  {
2786
  $this->user = $user;
2787
  }
@@ -2793,12 +2793,12 @@ class Google_Service_Drive_About extends Google_Collection
2793
 
2794
  }
2795
 
2796
- class Google_Service_Drive_AboutAdditionalRoleInfo extends Google_Collection
2797
  {
2798
  protected $collection_key = 'roleSets';
2799
  protected $internal_gapi_mappings = array(
2800
  );
2801
- protected $roleSetsType = 'Google_Service_Drive_AboutAdditionalRoleInfoRoleSets';
2802
  protected $roleSetsDataType = 'array';
2803
  public $type;
2804
 
@@ -2823,7 +2823,7 @@ class Google_Service_Drive_AboutAdditionalRoleInfo extends Google_Collection
2823
 
2824
  }
2825
 
2826
- class Google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends Google_Collection
2827
  {
2828
  protected $collection_key = 'additionalRoles';
2829
  protected $internal_gapi_mappings = array(
@@ -2852,7 +2852,7 @@ class Google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends Google_Collec
2852
 
2853
  }
2854
 
2855
- class Google_Service_Drive_AboutExportFormats extends Google_Collection
2856
  {
2857
  protected $collection_key = 'targets';
2858
  protected $internal_gapi_mappings = array(
@@ -2881,7 +2881,7 @@ class Google_Service_Drive_AboutExportFormats extends Google_Collection
2881
 
2882
  }
2883
 
2884
- class Google_Service_Drive_AboutFeatures extends Google_Model
2885
  {
2886
  protected $internal_gapi_mappings = array(
2887
  );
@@ -2909,7 +2909,7 @@ class Google_Service_Drive_AboutFeatures extends Google_Model
2909
 
2910
  }
2911
 
2912
- class Google_Service_Drive_AboutImportFormats extends Google_Collection
2913
  {
2914
  protected $collection_key = 'targets';
2915
  protected $internal_gapi_mappings = array(
@@ -2938,7 +2938,7 @@ class Google_Service_Drive_AboutImportFormats extends Google_Collection
2938
 
2939
  }
2940
 
2941
- class Google_Service_Drive_AboutMaxUploadSizes extends Google_Model
2942
  {
2943
  protected $internal_gapi_mappings = array(
2944
  );
@@ -2966,7 +2966,7 @@ class Google_Service_Drive_AboutMaxUploadSizes extends Google_Model
2966
 
2967
  }
2968
 
2969
- class Google_Service_Drive_AboutQuotaBytesByService extends Google_Model
2970
  {
2971
  protected $internal_gapi_mappings = array(
2972
  );
@@ -2994,7 +2994,7 @@ class Google_Service_Drive_AboutQuotaBytesByService extends Google_Model
2994
 
2995
  }
2996
 
2997
- class Google_Service_Drive_App extends Google_Collection
2998
  {
2999
  protected $collection_key = 'secondaryMimeTypes';
3000
  protected $internal_gapi_mappings = array(
@@ -3003,7 +3003,7 @@ class Google_Service_Drive_App extends Google_Collection
3003
  public $createInFolderTemplate;
3004
  public $createUrl;
3005
  public $hasDriveWideScope;
3006
- protected $iconsType = 'Google_Service_Drive_AppIcons';
3007
  protected $iconsDataType = 'array';
3008
  public $id;
3009
  public $installed;
@@ -3244,7 +3244,7 @@ class Google_Service_Drive_App extends Google_Collection
3244
 
3245
  }
3246
 
3247
- class Google_Service_Drive_AppIcons extends Google_Model
3248
  {
3249
  protected $internal_gapi_mappings = array(
3250
  );
@@ -3282,14 +3282,14 @@ class Google_Service_Drive_AppIcons extends Google_Model
3282
 
3283
  }
3284
 
3285
- class Google_Service_Drive_AppList extends Google_Collection
3286
  {
3287
  protected $collection_key = 'items';
3288
  protected $internal_gapi_mappings = array(
3289
  );
3290
  public $defaultAppIds;
3291
  public $etag;
3292
- protected $itemsType = 'Google_Service_Drive_App';
3293
  protected $itemsDataType = 'array';
3294
  public $kind;
3295
  public $selfLink;
@@ -3342,12 +3342,12 @@ class Google_Service_Drive_AppList extends Google_Collection
3342
 
3343
  }
3344
 
3345
- class Google_Service_Drive_Change extends Google_Model
3346
  {
3347
  protected $internal_gapi_mappings = array(
3348
  );
3349
  public $deleted;
3350
- protected $fileType = 'Google_Service_Drive_DriveFile';
3351
  protected $fileDataType = '';
3352
  public $fileId;
3353
  public $id;
@@ -3364,7 +3364,7 @@ class Google_Service_Drive_Change extends Google_Model
3364
  {
3365
  return $this->deleted;
3366
  }
3367
- public function setFile(Google_Service_Drive_DriveFile $file)
3368
  {
3369
  $this->file = $file;
3370
  }
@@ -3421,13 +3421,13 @@ class Google_Service_Drive_Change extends Google_Model
3421
 
3422
  }
3423
 
3424
- class Google_Service_Drive_ChangeList extends Google_Collection
3425
  {
3426
  protected $collection_key = 'items';
3427
  protected $internal_gapi_mappings = array(
3428
  );
3429
  public $etag;
3430
- protected $itemsType = 'Google_Service_Drive_Change';
3431
  protected $itemsDataType = 'array';
3432
  public $kind;
3433
  public $largestChangeId;
@@ -3501,7 +3501,7 @@ class Google_Service_Drive_ChangeList extends Google_Collection
3501
 
3502
  }
3503
 
3504
- class Google_Service_Drive_Channel extends Google_Model
3505
  {
3506
  protected $internal_gapi_mappings = array(
3507
  );
@@ -3609,7 +3609,7 @@ class Google_Service_Drive_Channel extends Google_Model
3609
 
3610
  }
3611
 
3612
- class Google_Service_Drive_ChannelParams extends Google_Model
3613
  {
3614
  protected $internal_gapi_mappings = array(
3615
  );
@@ -3617,13 +3617,13 @@ class Google_Service_Drive_ChannelParams extends Google_Model
3617
 
3618
  }
3619
 
3620
- class Google_Service_Drive_ChildList extends Google_Collection
3621
  {
3622
  protected $collection_key = 'items';
3623
  protected $internal_gapi_mappings = array(
3624
  );
3625
  public $etag;
3626
- protected $itemsType = 'Google_Service_Drive_ChildReference';
3627
  protected $itemsDataType = 'array';
3628
  public $kind;
3629
  public $nextLink;
@@ -3687,7 +3687,7 @@ class Google_Service_Drive_ChildList extends Google_Collection
3687
 
3688
  }
3689
 
3690
- class Google_Service_Drive_ChildReference extends Google_Model
3691
  {
3692
  protected $internal_gapi_mappings = array(
3693
  );
@@ -3735,17 +3735,17 @@ class Google_Service_Drive_ChildReference extends Google_Model
3735
 
3736
  }
3737
 
3738
- class Google_Service_Drive_Comment extends Google_Collection
3739
  {
3740
  protected $collection_key = 'replies';
3741
  protected $internal_gapi_mappings = array(
3742
  );
3743
  public $anchor;
3744
- protected $authorType = 'Google_Service_Drive_User';
3745
  protected $authorDataType = '';
3746
  public $commentId;
3747
  public $content;
3748
- protected $contextType = 'Google_Service_Drive_CommentContext';
3749
  protected $contextDataType = '';
3750
  public $createdDate;
3751
  public $deleted;
@@ -3754,7 +3754,7 @@ class Google_Service_Drive_Comment extends Google_Collection
3754
  public $htmlContent;
3755
  public $kind;
3756
  public $modifiedDate;
3757
- protected $repliesType = 'Google_Service_Drive_CommentReply';
3758
  protected $repliesDataType = 'array';
3759
  public $selfLink;
3760
  public $status;
@@ -3768,7 +3768,7 @@ class Google_Service_Drive_Comment extends Google_Collection
3768
  {
3769
  return $this->anchor;
3770
  }
3771
- public function setAuthor(Google_Service_Drive_User $author)
3772
  {
3773
  $this->author = $author;
3774
  }
@@ -3795,7 +3795,7 @@ class Google_Service_Drive_Comment extends Google_Collection
3795
  {
3796
  return $this->content;
3797
  }
3798
- public function setContext(Google_Service_Drive_CommentContext $context)
3799
  {
3800
  $this->context = $context;
3801
  }
@@ -3897,7 +3897,7 @@ class Google_Service_Drive_Comment extends Google_Collection
3897
 
3898
  }
3899
 
3900
- class Google_Service_Drive_CommentContext extends Google_Model
3901
  {
3902
  protected $internal_gapi_mappings = array(
3903
  );
@@ -3925,12 +3925,12 @@ class Google_Service_Drive_CommentContext extends Google_Model
3925
 
3926
  }
3927
 
3928
- class Google_Service_Drive_CommentList extends Google_Collection
3929
  {
3930
  protected $collection_key = 'items';
3931
  protected $internal_gapi_mappings = array(
3932
  );
3933
- protected $itemsType = 'Google_Service_Drive_Comment';
3934
  protected $itemsDataType = 'array';
3935
  public $kind;
3936
  public $nextLink;
@@ -3985,11 +3985,11 @@ class Google_Service_Drive_CommentList extends Google_Collection
3985
 
3986
  }
3987
 
3988
- class Google_Service_Drive_CommentReply extends Google_Model
3989
  {
3990
  protected $internal_gapi_mappings = array(
3991
  );
3992
- protected $authorType = 'Google_Service_Drive_User';
3993
  protected $authorDataType = '';
3994
  public $content;
3995
  public $createdDate;
@@ -4000,7 +4000,7 @@ class Google_Service_Drive_CommentReply extends Google_Model
4000
  public $replyId;
4001
  public $verb;
4002
 
4003
- public function setAuthor(Google_Service_Drive_User $author)
4004
  {
4005
  $this->author = $author;
4006
  }
@@ -4084,12 +4084,12 @@ class Google_Service_Drive_CommentReply extends Google_Model
4084
 
4085
  }
4086
 
4087
- class Google_Service_Drive_CommentReplyList extends Google_Collection
4088
  {
4089
  protected $collection_key = 'items';
4090
  protected $internal_gapi_mappings = array(
4091
  );
4092
- protected $itemsType = 'Google_Service_Drive_CommentReply';
4093
  protected $itemsDataType = 'array';
4094
  public $kind;
4095
  public $nextLink;
@@ -4144,7 +4144,7 @@ class Google_Service_Drive_CommentReplyList extends Google_Collection
4144
 
4145
  }
4146
 
4147
- class Google_Service_Drive_DriveFile extends Google_Collection
4148
  {
4149
  protected $collection_key = 'properties';
4150
  protected $internal_gapi_mappings = array(
@@ -4166,14 +4166,14 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4166
  public $headRevisionId;
4167
  public $iconLink;
4168
  public $id;
4169
- protected $imageMediaMetadataType = 'Google_Service_Drive_DriveFileImageMediaMetadata';
4170
  protected $imageMediaMetadataDataType = '';
4171
- protected $indexableTextType = 'Google_Service_Drive_DriveFileIndexableText';
4172
  protected $indexableTextDataType = '';
4173
  public $kind;
4174
- protected $labelsType = 'Google_Service_Drive_DriveFileLabels';
4175
  protected $labelsDataType = '';
4176
- protected $lastModifyingUserType = 'Google_Service_Drive_User';
4177
  protected $lastModifyingUserDataType = '';
4178
  public $lastModifyingUserName;
4179
  public $lastViewedByMeDate;
@@ -4185,28 +4185,28 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4185
  public $openWithLinks;
4186
  public $originalFilename;
4187
  public $ownerNames;
4188
- protected $ownersType = 'Google_Service_Drive_User';
4189
  protected $ownersDataType = 'array';
4190
- protected $parentsType = 'Google_Service_Drive_ParentReference';
4191
  protected $parentsDataType = 'array';
4192
- protected $permissionsType = 'Google_Service_Drive_Permission';
4193
  protected $permissionsDataType = 'array';
4194
- protected $propertiesType = 'Google_Service_Drive_Property';
4195
  protected $propertiesDataType = 'array';
4196
  public $quotaBytesUsed;
4197
  public $selfLink;
4198
  public $shared;
4199
  public $sharedWithMeDate;
4200
- protected $sharingUserType = 'Google_Service_Drive_User';
4201
  protected $sharingUserDataType = '';
4202
- protected $thumbnailType = 'Google_Service_Drive_DriveFileThumbnail';
4203
  protected $thumbnailDataType = '';
4204
  public $thumbnailLink;
4205
  public $title;
4206
- protected $userPermissionType = 'Google_Service_Drive_Permission';
4207
  protected $userPermissionDataType = '';
4208
  public $version;
4209
- protected $videoMediaMetadataType = 'Google_Service_Drive_DriveFileVideoMediaMetadata';
4210
  protected $videoMediaMetadataDataType = '';
4211
  public $webContentLink;
4212
  public $webViewLink;
@@ -4365,7 +4365,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4365
  {
4366
  return $this->id;
4367
  }
4368
- public function setImageMediaMetadata(Google_Service_Drive_DriveFileImageMediaMetadata $imageMediaMetadata)
4369
  {
4370
  $this->imageMediaMetadata = $imageMediaMetadata;
4371
  }
@@ -4374,7 +4374,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4374
  {
4375
  return $this->imageMediaMetadata;
4376
  }
4377
- public function setIndexableText(Google_Service_Drive_DriveFileIndexableText $indexableText)
4378
  {
4379
  $this->indexableText = $indexableText;
4380
  }
@@ -4392,7 +4392,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4392
  {
4393
  return $this->kind;
4394
  }
4395
- public function setLabels(Google_Service_Drive_DriveFileLabels $labels)
4396
  {
4397
  $this->labels = $labels;
4398
  }
@@ -4401,7 +4401,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4401
  {
4402
  return $this->labels;
4403
  }
4404
- public function setLastModifyingUser(Google_Service_Drive_User $lastModifyingUser)
4405
  {
4406
  $this->lastModifyingUser = $lastModifyingUser;
4407
  }
@@ -4572,7 +4572,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4572
  {
4573
  return $this->sharedWithMeDate;
4574
  }
4575
- public function setSharingUser(Google_Service_Drive_User $sharingUser)
4576
  {
4577
  $this->sharingUser = $sharingUser;
4578
  }
@@ -4581,7 +4581,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4581
  {
4582
  return $this->sharingUser;
4583
  }
4584
- public function setThumbnail(Google_Service_Drive_DriveFileThumbnail $thumbnail)
4585
  {
4586
  $this->thumbnail = $thumbnail;
4587
  }
@@ -4608,7 +4608,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4608
  {
4609
  return $this->title;
4610
  }
4611
- public function setUserPermission(Google_Service_Drive_Permission $userPermission)
4612
  {
4613
  $this->userPermission = $userPermission;
4614
  }
@@ -4626,7 +4626,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4626
  {
4627
  return $this->version;
4628
  }
4629
- public function setVideoMediaMetadata(Google_Service_Drive_DriveFileVideoMediaMetadata $videoMediaMetadata)
4630
  {
4631
  $this->videoMediaMetadata = $videoMediaMetadata;
4632
  }
@@ -4665,7 +4665,7 @@ class Google_Service_Drive_DriveFile extends Google_Collection
4665
 
4666
  }
4667
 
4668
- class Google_Service_Drive_DriveFileExportLinks extends Google_Model
4669
  {
4670
  protected $internal_gapi_mappings = array(
4671
  );
@@ -4673,7 +4673,7 @@ class Google_Service_Drive_DriveFileExportLinks extends Google_Model
4673
 
4674
  }
4675
 
4676
- class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
4677
  {
4678
  protected $internal_gapi_mappings = array(
4679
  );
@@ -4690,7 +4690,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
4690
  public $height;
4691
  public $isoSpeed;
4692
  public $lens;
4693
- protected $locationType = 'Google_Service_Drive_DriveFileImageMediaMetadataLocation';
4694
  protected $locationDataType = '';
4695
  public $maxApertureValue;
4696
  public $meteringMode;
@@ -4817,7 +4817,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
4817
  {
4818
  return $this->lens;
4819
  }
4820
- public function setLocation(Google_Service_Drive_DriveFileImageMediaMetadataLocation $location)
4821
  {
4822
  $this->location = $location;
4823
  }
@@ -4892,7 +4892,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadata extends Google_Model
4892
 
4893
  }
4894
 
4895
- class Google_Service_Drive_DriveFileImageMediaMetadataLocation extends Google_Model
4896
  {
4897
  protected $internal_gapi_mappings = array(
4898
  );
@@ -4930,7 +4930,7 @@ class Google_Service_Drive_DriveFileImageMediaMetadataLocation extends Google_Mo
4930
 
4931
  }
4932
 
4933
- class Google_Service_Drive_DriveFileIndexableText extends Google_Model
4934
  {
4935
  protected $internal_gapi_mappings = array(
4936
  );
@@ -4948,7 +4948,7 @@ class Google_Service_Drive_DriveFileIndexableText extends Google_Model
4948
 
4949
  }
4950
 
4951
- class Google_Service_Drive_DriveFileLabels extends Google_Model
4952
  {
4953
  protected $internal_gapi_mappings = array(
4954
  );
@@ -5006,7 +5006,7 @@ class Google_Service_Drive_DriveFileLabels extends Google_Model
5006
 
5007
  }
5008
 
5009
- class Google_Service_Drive_DriveFileOpenWithLinks extends Google_Model
5010
  {
5011
  protected $internal_gapi_mappings = array(
5012
  );
@@ -5014,7 +5014,7 @@ class Google_Service_Drive_DriveFileOpenWithLinks extends Google_Model
5014
 
5015
  }
5016
 
5017
- class Google_Service_Drive_DriveFileThumbnail extends Google_Model
5018
  {
5019
  protected $internal_gapi_mappings = array(
5020
  );
@@ -5042,7 +5042,7 @@ class Google_Service_Drive_DriveFileThumbnail extends Google_Model
5042
 
5043
  }
5044
 
5045
- class Google_Service_Drive_DriveFileVideoMediaMetadata extends Google_Model
5046
  {
5047
  protected $internal_gapi_mappings = array(
5048
  );
@@ -5080,13 +5080,13 @@ class Google_Service_Drive_DriveFileVideoMediaMetadata extends Google_Model
5080
 
5081
  }
5082
 
5083
- class Google_Service_Drive_FileList extends Google_Collection
5084
  {
5085
  protected $collection_key = 'items';
5086
  protected $internal_gapi_mappings = array(
5087
  );
5088
  public $etag;
5089
- protected $itemsType = 'Google_Service_Drive_DriveFile';
5090
  protected $itemsDataType = 'array';
5091
  public $kind;
5092
  public $nextLink;
@@ -5150,13 +5150,13 @@ class Google_Service_Drive_FileList extends Google_Collection
5150
 
5151
  }
5152
 
5153
- class Google_Service_Drive_ParentList extends Google_Collection
5154
  {
5155
  protected $collection_key = 'items';
5156
  protected $internal_gapi_mappings = array(
5157
  );
5158
  public $etag;
5159
- protected $itemsType = 'Google_Service_Drive_ParentReference';
5160
  protected $itemsDataType = 'array';
5161
  public $kind;
5162
  public $selfLink;
@@ -5200,7 +5200,7 @@ class Google_Service_Drive_ParentList extends Google_Collection
5200
 
5201
  }
5202
 
5203
- class Google_Service_Drive_ParentReference extends Google_Model
5204
  {
5205
  protected $internal_gapi_mappings = array(
5206
  );
@@ -5258,7 +5258,7 @@ class Google_Service_Drive_ParentReference extends Google_Model
5258
 
5259
  }
5260
 
5261
- class Google_Service_Drive_Permission extends Google_Collection
5262
  {
5263
  protected $collection_key = 'additionalRoles';
5264
  protected $internal_gapi_mappings = array(
@@ -5407,7 +5407,7 @@ class Google_Service_Drive_Permission extends Google_Collection
5407
 
5408
  }
5409
 
5410
- class Google_Service_Drive_PermissionId extends Google_Model
5411
  {
5412
  protected $internal_gapi_mappings = array(
5413
  );
@@ -5435,13 +5435,13 @@ class Google_Service_Drive_PermissionId extends Google_Model
5435
 
5436
  }
5437
 
5438
- class Google_Service_Drive_PermissionList extends Google_Collection
5439
  {
5440
  protected $collection_key = 'items';
5441
  protected $internal_gapi_mappings = array(
5442
  );
5443
  public $etag;
5444
- protected $itemsType = 'Google_Service_Drive_Permission';
5445
  protected $itemsDataType = 'array';
5446
  public $kind;
5447
  public $selfLink;
@@ -5485,7 +5485,7 @@ class Google_Service_Drive_PermissionList extends Google_Collection
5485
 
5486
  }
5487
 
5488
- class Google_Service_Drive_Property extends Google_Model
5489
  {
5490
  protected $internal_gapi_mappings = array(
5491
  );
@@ -5553,13 +5553,13 @@ class Google_Service_Drive_Property extends Google_Model
5553
 
5554
  }
5555
 
5556
- class Google_Service_Drive_PropertyList extends Google_Collection
5557
  {
5558
  protected $collection_key = 'items';
5559
  protected $internal_gapi_mappings = array(
5560
  );
5561
  public $etag;
5562
- protected $itemsType = 'Google_Service_Drive_Property';
5563
  protected $itemsDataType = 'array';
5564
  public $kind;
5565
  public $selfLink;
@@ -5603,7 +5603,7 @@ class Google_Service_Drive_PropertyList extends Google_Collection
5603
 
5604
  }
5605
 
5606
- class Google_Service_Drive_Revision extends Google_Model
5607
  {
5608
  protected $internal_gapi_mappings = array(
5609
  );
@@ -5613,7 +5613,7 @@ class Google_Service_Drive_Revision extends Google_Model
5613
  public $fileSize;
5614
  public $id;
5615
  public $kind;
5616
- protected $lastModifyingUserType = 'Google_Service_Drive_User';
5617
  protected $lastModifyingUserDataType = '';
5618
  public $lastModifyingUserName;
5619
  public $md5Checksum;
@@ -5681,7 +5681,7 @@ class Google_Service_Drive_Revision extends Google_Model
5681
  {
5682
  return $this->kind;
5683
  }
5684
- public function setLastModifyingUser(Google_Service_Drive_User $lastModifyingUser)
5685
  {
5686
  $this->lastModifyingUser = $lastModifyingUser;
5687
  }
@@ -5792,7 +5792,7 @@ class Google_Service_Drive_Revision extends Google_Model
5792
 
5793
  }
5794
 
5795
- class Google_Service_Drive_RevisionExportLinks extends Google_Model
5796
  {
5797
  protected $internal_gapi_mappings = array(
5798
  );
@@ -5800,13 +5800,13 @@ class Google_Service_Drive_RevisionExportLinks extends Google_Model
5800
 
5801
  }
5802
 
5803
- class Google_Service_Drive_RevisionList extends Google_Collection
5804
  {
5805
  protected $collection_key = 'items';
5806
  protected $internal_gapi_mappings = array(
5807
  );
5808
  public $etag;
5809
- protected $itemsType = 'Google_Service_Drive_Revision';
5810
  protected $itemsDataType = 'array';
5811
  public $kind;
5812
  public $selfLink;
@@ -5850,7 +5850,7 @@ class Google_Service_Drive_RevisionList extends Google_Collection
5850
 
5851
  }
5852
 
5853
- class Google_Service_Drive_User extends Google_Model
5854
  {
5855
  protected $internal_gapi_mappings = array(
5856
  );
@@ -5859,7 +5859,7 @@ class Google_Service_Drive_User extends Google_Model
5859
  public $isAuthenticatedUser;
5860
  public $kind;
5861
  public $permissionId;
5862
- protected $pictureType = 'Google_Service_Drive_UserPicture';
5863
  protected $pictureDataType = '';
5864
 
5865
  public function setDisplayName($displayName)
@@ -5907,7 +5907,7 @@ class Google_Service_Drive_User extends Google_Model
5907
  {
5908
  return $this->permissionId;
5909
  }
5910
- public function setPicture(Google_Service_Drive_UserPicture $picture)
5911
  {
5912
  $this->picture = $picture;
5913
  }
@@ -5919,7 +5919,7 @@ class Google_Service_Drive_User extends Google_Model
5919
 
5920
  }
5921
 
5922
- class Google_Service_Drive_UserPicture extends Google_Model
5923
  {
5924
  protected $internal_gapi_mappings = array(
5925
  );
29
  *
30
  * @author Google, Inc.
31
  */
32
+ class W3TCG_Google_Service_Drive extends W3TCG_Google_Service
33
  {
34
  /** View and manage the files and documents in your Google Drive. */
35
  const DRIVE = "https://www.googleapis.com/auth/drive";
64
  /**
65
  * Constructs the internal representation of the Drive service.
66
  *
67
+ * @param W3TCG_Google_Client $client
68
  */
69
+ public function __construct(W3TCG_Google_Client $client)
70
  {
71
  parent::__construct($client);
72
  $this->servicePath = 'drive/v2/';
73
  $this->version = 'v2';
74
  $this->serviceName = 'drive';
75
 
76
+ $this->about = new W3TCG_Google_Service_Drive_About_Resource(
77
  $this,
78
  $this->serviceName,
79
  'about',
100
  )
101
  )
102
  );
103
+ $this->apps = new W3TCG_Google_Service_Drive_Apps_Resource(
104
  $this,
105
  $this->serviceName,
106
  'apps',
137
  )
138
  )
139
  );
140
+ $this->changes = new W3TCG_Google_Service_Drive_Changes_Resource(
141
  $this,
142
  $this->serviceName,
143
  'changes',
207
  )
208
  )
209
  );
210
+ $this->channels = new W3TCG_Google_Service_Drive_Channels_Resource(
211
  $this,
212
  $this->serviceName,
213
  'channels',
221
  )
222
  )
223
  );
224
+ $this->children = new W3TCG_Google_Service_Drive_Children_Resource(
225
  $this,
226
  $this->serviceName,
227
  'children',
293
  )
294
  )
295
  );
296
+ $this->comments = new W3TCG_Google_Service_Drive_Comments_Resource(
297
  $this,
298
  $this->serviceName,
299
  'comments',
403
  )
404
  )
405
  );
406
+ $this->files = new W3TCG_Google_Service_Drive_Files_Resource(
407
  $this,
408
  $this->serviceName,
409
  'files',
717
  )
718
  )
719
  );
720
+ $this->parents = new W3TCG_Google_Service_Drive_Parents_Resource(
721
  $this,
722
  $this->serviceName,
723
  'parents',
777
  )
778
  )
779
  );
780
+ $this->permissions = new W3TCG_Google_Service_Drive_Permissions_Resource(
781
  $this,
782
  $this->serviceName,
783
  'permissions',
893
  )
894
  )
895
  );
896
+ $this->properties = new W3TCG_Google_Service_Drive_Properties_Resource(
897
  $this,
898
  $this->serviceName,
899
  'properties',
999
  )
1000
  )
1001
  );
1002
+ $this->realtime = new W3TCG_Google_Service_Drive_Realtime_Resource(
1003
  $this,
1004
  $this->serviceName,
1005
  'realtime',
1037
  )
1038
  )
1039
  );
1040
+ $this->replies = new W3TCG_Google_Service_Drive_Replies_Resource(
1041
  $this,
1042
  $this->serviceName,
1043
  'replies',
1173
  )
1174
  )
1175
  );
1176
+ $this->revisions = new W3TCG_Google_Service_Drive_Revisions_Resource(
1177
  $this,
1178
  $this->serviceName,
1179
  'revisions',
1261
  * The "about" collection of methods.
1262
  * Typical usage is:
1263
  * <code>
1264
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1265
  * $about = $driveService->about;
1266
  * </code>
1267
  */
1268
+ class W3TCG_Google_Service_Drive_About_Resource extends W3TCG_Google_Service_Resource
1269
  {
1270
 
1271
  /**
1282
  * Maximum number of remaining change IDs to count
1283
  * @opt_param string startChangeId
1284
  * Change ID to start counting from when calculating number of remaining change IDs
1285
+ * @return W3TCG_Google_Service_Drive_About
1286
  */
1287
  public function get($optParams = array())
1288
  {
1289
  $params = array();
1290
  $params = array_merge($params, $optParams);
1291
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_About");
1292
  }
1293
  }
1294
 
1296
  * The "apps" collection of methods.
1297
  * Typical usage is:
1298
  * <code>
1299
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1300
  * $apps = $driveService->apps;
1301
  * </code>
1302
  */
1303
+ class W3TCG_Google_Service_Drive_Apps_Resource extends W3TCG_Google_Service_Resource
1304
  {
1305
 
1306
  /**
1309
  * @param string $appId
1310
  * The ID of the app.
1311
  * @param array $optParams Optional parameters.
1312
+ * @return W3TCG_Google_Service_Drive_App
1313
  */
1314
  public function get($appId, $optParams = array())
1315
  {
1316
  $params = array('appId' => $appId);
1317
  $params = array_merge($params, $optParams);
1318
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_App");
1319
  }
1320
  /**
1321
  * Lists a user's installed apps. (apps.listApps)
1333
  * A comma-separated list of MIME types for open with filtering. All apps within the given app
1334
  * query scope which can open any of the given MIME types will be included in the response. If
1335
  * appFilterExtensions are provided as well, the result is a union of the two resulting app lists.
1336
+ * @return W3TCG_Google_Service_Drive_AppList
1337
  */
1338
  public function listApps($optParams = array())
1339
  {
1340
  $params = array();
1341
  $params = array_merge($params, $optParams);
1342
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_AppList");
1343
  }
1344
  }
1345
 
1347
  * The "changes" collection of methods.
1348
  * Typical usage is:
1349
  * <code>
1350
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1351
  * $changes = $driveService->changes;
1352
  * </code>
1353
  */
1354
+ class W3TCG_Google_Service_Drive_Changes_Resource extends W3TCG_Google_Service_Resource
1355
  {
1356
 
1357
  /**
1360
  * @param string $changeId
1361
  * The ID of the change.
1362
  * @param array $optParams Optional parameters.
1363
+ * @return W3TCG_Google_Service_Drive_Change
1364
  */
1365
  public function get($changeId, $optParams = array())
1366
  {
1367
  $params = array('changeId' => $changeId);
1368
  $params = array_merge($params, $optParams);
1369
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_Change");
1370
  }
1371
  /**
1372
  * Lists the changes for a user. (changes.listChanges)
1385
  * Maximum number of changes to return.
1386
  * @opt_param string pageToken
1387
  * Page token for changes.
1388
+ * @return W3TCG_Google_Service_Drive_ChangeList
1389
  */
1390
  public function listChanges($optParams = array())
1391
  {
1392
  $params = array();
1393
  $params = array_merge($params, $optParams);
1394
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_ChangeList");
1395
  }
1396
  /**
1397
  * Subscribe to changes for a user. (changes.watch)
1398
  *
1399
+ * @param W3TCG_Google_Channel $postBody
1400
  * @param array $optParams Optional parameters.
1401
  *
1402
  * @opt_param bool includeSubscribed
1411
  * Maximum number of changes to return.
1412
  * @opt_param string pageToken
1413
  * Page token for changes.
1414
+ * @return W3TCG_Google_Service_Drive_Channel
1415
  */
1416
+ public function watch(W3TCG_Google_Service_Drive_Channel $postBody, $optParams = array())
1417
  {
1418
  $params = array('postBody' => $postBody);
1419
  $params = array_merge($params, $optParams);
1420
+ return $this->call('watch', array($params), "W3TCG_Google_Service_Drive_Channel");
1421
  }
1422
  }
1423
 
1425
  * The "channels" collection of methods.
1426
  * Typical usage is:
1427
  * <code>
1428
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1429
  * $channels = $driveService->channels;
1430
  * </code>
1431
  */
1432
+ class W3TCG_Google_Service_Drive_Channels_Resource extends W3TCG_Google_Service_Resource
1433
  {
1434
 
1435
  /**
1436
  * Stop watching resources through this channel (channels.stop)
1437
  *
1438
+ * @param W3TCG_Google_Channel $postBody
1439
  * @param array $optParams Optional parameters.
1440
  */
1441
+ public function stop(W3TCG_Google_Service_Drive_Channel $postBody, $optParams = array())
1442
  {
1443
  $params = array('postBody' => $postBody);
1444
  $params = array_merge($params, $optParams);
1450
  * The "children" collection of methods.
1451
  * Typical usage is:
1452
  * <code>
1453
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1454
  * $children = $driveService->children;
1455
  * </code>
1456
  */
1457
+ class W3TCG_Google_Service_Drive_Children_Resource extends W3TCG_Google_Service_Resource
1458
  {
1459
 
1460
  /**
1480
  * @param string $childId
1481
  * The ID of the child.
1482
  * @param array $optParams Optional parameters.
1483
+ * @return W3TCG_Google_Service_Drive_ChildReference
1484
  */
1485
  public function get($folderId, $childId, $optParams = array())
1486
  {
1487
  $params = array('folderId' => $folderId, 'childId' => $childId);
1488
  $params = array_merge($params, $optParams);
1489
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_ChildReference");
1490
  }
1491
  /**
1492
  * Inserts a file into a folder. (children.insert)
1493
  *
1494
  * @param string $folderId
1495
  * The ID of the folder.
1496
+ * @param W3TCG_Google_ChildReference $postBody
1497
  * @param array $optParams Optional parameters.
1498
+ * @return W3TCG_Google_Service_Drive_ChildReference
1499
  */
1500
+ public function insert($folderId, W3TCG_Google_Service_Drive_ChildReference $postBody, $optParams = array())
1501
  {
1502
  $params = array('folderId' => $folderId, 'postBody' => $postBody);
1503
  $params = array_merge($params, $optParams);
1504
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_ChildReference");
1505
  }
1506
  /**
1507
  * Lists a folder's children. (children.listChildren)
1516
  * Page token for children.
1517
  * @opt_param int maxResults
1518
  * Maximum number of children to return.
1519
+ * @return W3TCG_Google_Service_Drive_ChildList
1520
  */
1521
  public function listChildren($folderId, $optParams = array())
1522
  {
1523
  $params = array('folderId' => $folderId);
1524
  $params = array_merge($params, $optParams);
1525
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_ChildList");
1526
  }
1527
  }
1528
 
1530
  * The "comments" collection of methods.
1531
  * Typical usage is:
1532
  * <code>
1533
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1534
  * $comments = $driveService->comments;
1535
  * </code>
1536
  */
1537
+ class W3TCG_Google_Service_Drive_Comments_Resource extends W3TCG_Google_Service_Resource
1538
  {
1539
 
1540
  /**
1564
  * @opt_param bool includeDeleted
1565
  * If set, this will succeed when retrieving a deleted comment, and will include any deleted
1566
  * replies.
1567
+ * @return W3TCG_Google_Service_Drive_Comment
1568
  */
1569
  public function get($fileId, $commentId, $optParams = array())
1570
  {
1571
  $params = array('fileId' => $fileId, 'commentId' => $commentId);
1572
  $params = array_merge($params, $optParams);
1573
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_Comment");
1574
  }
1575
  /**
1576
  * Creates a new comment on the given file. (comments.insert)
1577
  *
1578
  * @param string $fileId
1579
  * The ID of the file.
1580
+ * @param W3TCG_Google_Comment $postBody
1581
  * @param array $optParams Optional parameters.
1582
+ * @return W3TCG_Google_Service_Drive_Comment
1583
  */
1584
+ public function insert($fileId, W3TCG_Google_Service_Drive_Comment $postBody, $optParams = array())
1585
  {
1586
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1587
  $params = array_merge($params, $optParams);
1588
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_Comment");
1589
  }
1590
  /**
1591
  * Lists a file's comments. (comments.listComments)
1605
  * will be returned.
1606
  * @opt_param int maxResults
1607
  * The maximum number of discussions to include in the response, used for paging.
1608
+ * @return W3TCG_Google_Service_Drive_CommentList
1609
  */
1610
  public function listComments($fileId, $optParams = array())
1611
  {
1612
  $params = array('fileId' => $fileId);
1613
  $params = array_merge($params, $optParams);
1614
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_CommentList");
1615
  }
1616
  /**
1617
  * Updates an existing comment. This method supports patch semantics.
1621
  * The ID of the file.
1622
  * @param string $commentId
1623
  * The ID of the comment.
1624
+ * @param W3TCG_Google_Comment $postBody
1625
  * @param array $optParams Optional parameters.
1626
+ * @return W3TCG_Google_Service_Drive_Comment
1627
  */
1628
+ public function patch($fileId, $commentId, W3TCG_Google_Service_Drive_Comment $postBody, $optParams = array())
1629
  {
1630
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
1631
  $params = array_merge($params, $optParams);
1632
+ return $this->call('patch', array($params), "W3TCG_Google_Service_Drive_Comment");
1633
  }
1634
  /**
1635
  * Updates an existing comment. (comments.update)
1638
  * The ID of the file.
1639
  * @param string $commentId
1640
  * The ID of the comment.
1641
+ * @param W3TCG_Google_Comment $postBody
1642
  * @param array $optParams Optional parameters.
1643
+ * @return W3TCG_Google_Service_Drive_Comment
1644
  */
1645
+ public function update($fileId, $commentId, W3TCG_Google_Service_Drive_Comment $postBody, $optParams = array())
1646
  {
1647
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
1648
  $params = array_merge($params, $optParams);
1649
+ return $this->call('update', array($params), "W3TCG_Google_Service_Drive_Comment");
1650
  }
1651
  }
1652
 
1654
  * The "files" collection of methods.
1655
  * Typical usage is:
1656
  * <code>
1657
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1658
  * $files = $driveService->files;
1659
  * </code>
1660
  */
1661
+ class W3TCG_Google_Service_Drive_Files_Resource extends W3TCG_Google_Service_Resource
1662
  {
1663
 
1664
  /**
1666
  *
1667
  * @param string $fileId
1668
  * The ID of the file to copy.
1669
+ * @param W3TCG_Google_DriveFile $postBody
1670
  * @param array $optParams Optional parameters.
1671
  *
1672
  * @opt_param bool convert
1685
  * The timed text track name.
1686
  * @opt_param string timedTextLanguage
1687
  * The language of the timed text.
1688
+ * @return W3TCG_Google_Service_Drive_DriveFile
1689
  */
1690
+ public function copy($fileId, W3TCG_Google_Service_Drive_DriveFile $postBody, $optParams = array())
1691
  {
1692
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1693
  $params = array_merge($params, $optParams);
1694
+ return $this->call('copy', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1695
  }
1696
  /**
1697
  * Permanently deletes a file by ID. Skips the trash. (files.delete)
1730
  * Whether to update the view date after successfully retrieving the file.
1731
  * @opt_param string projection
1732
  * This parameter is deprecated and has no function.
1733
+ * @return W3TCG_Google_Service_Drive_DriveFile
1734
  */
1735
  public function get($fileId, $optParams = array())
1736
  {
1737
  $params = array('fileId' => $fileId);
1738
  $params = array_merge($params, $optParams);
1739
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1740
  }
1741
  /**
1742
  * Insert a new file. (files.insert)
1743
  *
1744
+ * @param W3TCG_Google_DriveFile $postBody
1745
  * @param array $optParams Optional parameters.
1746
  *
1747
  * @opt_param bool convert
1761
  * The timed text track name.
1762
  * @opt_param string timedTextLanguage
1763
  * The language of the timed text.
1764
+ * @return W3TCG_Google_Service_Drive_DriveFile
1765
  */
1766
+ public function insert(W3TCG_Google_Service_Drive_DriveFile $postBody, $optParams = array())
1767
  {
1768
  $params = array('postBody' => $postBody);
1769
  $params = array_merge($params, $optParams);
1770
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1771
  }
1772
  /**
1773
  * Lists the user's files. (files.listFiles)
1784
  * This parameter is deprecated and has no function.
1785
  * @opt_param int maxResults
1786
  * Maximum number of files to return.
1787
+ * @return W3TCG_Google_Service_Drive_FileList
1788
  */
1789
  public function listFiles($optParams = array())
1790
  {
1791
  $params = array();
1792
  $params = array_merge($params, $optParams);
1793
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_FileList");
1794
  }
1795
  /**
1796
  * Updates file metadata and/or content. This method supports patch semantics.
1798
  *
1799
  * @param string $fileId
1800
  * The ID of the file to update.
1801
+ * @param W3TCG_Google_DriveFile $postBody
1802
  * @param array $optParams Optional parameters.
1803
  *
1804
  * @opt_param string addParents
1827
  * The language of the timed text.
1828
  * @opt_param string timedTextTrackName
1829
  * The timed text track name.
1830
+ * @return W3TCG_Google_Service_Drive_DriveFile
1831
  */
1832
+ public function patch($fileId, W3TCG_Google_Service_Drive_DriveFile $postBody, $optParams = array())
1833
  {
1834
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1835
  $params = array_merge($params, $optParams);
1836
+ return $this->call('patch', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1837
  }
1838
  /**
1839
  * Set the file's updated time to the current server time. (files.touch)
1841
  * @param string $fileId
1842
  * The ID of the file to update.
1843
  * @param array $optParams Optional parameters.
1844
+ * @return W3TCG_Google_Service_Drive_DriveFile
1845
  */
1846
  public function touch($fileId, $optParams = array())
1847
  {
1848
  $params = array('fileId' => $fileId);
1849
  $params = array_merge($params, $optParams);
1850
+ return $this->call('touch', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1851
  }
1852
  /**
1853
  * Moves a file to the trash. (files.trash)
1855
  * @param string $fileId
1856
  * The ID of the file to trash.
1857
  * @param array $optParams Optional parameters.
1858
+ * @return W3TCG_Google_Service_Drive_DriveFile
1859
  */
1860
  public function trash($fileId, $optParams = array())
1861
  {
1862
  $params = array('fileId' => $fileId);
1863
  $params = array_merge($params, $optParams);
1864
+ return $this->call('trash', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1865
  }
1866
  /**
1867
  * Restores a file from the trash. (files.untrash)
1869
  * @param string $fileId
1870
  * The ID of the file to untrash.
1871
  * @param array $optParams Optional parameters.
1872
+ * @return W3TCG_Google_Service_Drive_DriveFile
1873
  */
1874
  public function untrash($fileId, $optParams = array())
1875
  {
1876
  $params = array('fileId' => $fileId);
1877
  $params = array_merge($params, $optParams);
1878
+ return $this->call('untrash', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1879
  }
1880
  /**
1881
  * Updates file metadata and/or content. (files.update)
1882
  *
1883
  * @param string $fileId
1884
  * The ID of the file to update.
1885
+ * @param W3TCG_Google_DriveFile $postBody
1886
  * @param array $optParams Optional parameters.
1887
  *
1888
  * @opt_param string addParents
1911
  * The language of the timed text.
1912
  * @opt_param string timedTextTrackName
1913
  * The timed text track name.
1914
+ * @return W3TCG_Google_Service_Drive_DriveFile
1915
  */
1916
+ public function update($fileId, W3TCG_Google_Service_Drive_DriveFile $postBody, $optParams = array())
1917
  {
1918
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1919
  $params = array_merge($params, $optParams);
1920
+ return $this->call('update', array($params), "W3TCG_Google_Service_Drive_DriveFile");
1921
  }
1922
  /**
1923
  * Subscribe to changes on a file (files.watch)
1924
  *
1925
  * @param string $fileId
1926
  * The ID for the file in question.
1927
+ * @param W3TCG_Google_Channel $postBody
1928
  * @param array $optParams Optional parameters.
1929
  *
1930
  * @opt_param bool acknowledgeAbuse
1933
  * Whether to update the view date after successfully retrieving the file.
1934
  * @opt_param string projection
1935
  * This parameter is deprecated and has no function.
1936
+ * @return W3TCG_Google_Service_Drive_Channel
1937
  */
1938
+ public function watch($fileId, W3TCG_Google_Service_Drive_Channel $postBody, $optParams = array())
1939
  {
1940
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
1941
  $params = array_merge($params, $optParams);
1942
+ return $this->call('watch', array($params), "W3TCG_Google_Service_Drive_Channel");
1943
  }
1944
  }
1945
 
1947
  * The "parents" collection of methods.
1948
  * Typical usage is:
1949
  * <code>
1950
+ * $driveService = new W3TCG_Google_Service_Drive(...);
1951
  * $parents = $driveService->parents;
1952
  * </code>
1953
  */
1954
+ class W3TCG_Google_Service_Drive_Parents_Resource extends W3TCG_Google_Service_Resource
1955
  {
1956
 
1957
  /**
1977
  * @param string $parentId
1978
  * The ID of the parent.
1979
  * @param array $optParams Optional parameters.
1980
+ * @return W3TCG_Google_Service_Drive_ParentReference
1981
  */
1982
  public function get($fileId, $parentId, $optParams = array())
1983
  {
1984
  $params = array('fileId' => $fileId, 'parentId' => $parentId);
1985
  $params = array_merge($params, $optParams);
1986
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_ParentReference");
1987
  }
1988
  /**
1989
  * Adds a parent folder for a file. (parents.insert)
1990
  *
1991
  * @param string $fileId
1992
  * The ID of the file.
1993
+ * @param W3TCG_Google_ParentReference $postBody
1994
  * @param array $optParams Optional parameters.
1995
+ * @return W3TCG_Google_Service_Drive_ParentReference
1996
  */
1997
+ public function insert($fileId, W3TCG_Google_Service_Drive_ParentReference $postBody, $optParams = array())
1998
  {
1999
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
2000
  $params = array_merge($params, $optParams);
2001
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_ParentReference");
2002
  }
2003
  /**
2004
  * Lists a file's parents. (parents.listParents)
2006
  * @param string $fileId
2007
  * The ID of the file.
2008
  * @param array $optParams Optional parameters.
2009
+ * @return W3TCG_Google_Service_Drive_ParentList
2010
  */
2011
  public function listParents($fileId, $optParams = array())
2012
  {
2013
  $params = array('fileId' => $fileId);
2014
  $params = array_merge($params, $optParams);
2015
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_ParentList");
2016
  }
2017
  }
2018
 
2020
  * The "permissions" collection of methods.
2021
  * Typical usage is:
2022
  * <code>
2023
+ * $driveService = new W3TCG_Google_Service_Drive(...);
2024
  * $permissions = $driveService->permissions;
2025
  * </code>
2026
  */
2027
+ class W3TCG_Google_Service_Drive_Permissions_Resource extends W3TCG_Google_Service_Resource
2028
  {
2029
 
2030
  /**
2050
  * @param string $permissionId
2051
  * The ID for the permission.
2052
  * @param array $optParams Optional parameters.
2053
+ * @return W3TCG_Google_Service_Drive_Permission
2054
  */
2055
  public function get($fileId, $permissionId, $optParams = array())
2056
  {
2057
  $params = array('fileId' => $fileId, 'permissionId' => $permissionId);
2058
  $params = array_merge($params, $optParams);
2059
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_Permission");
2060
  }
2061
  /**
2062
  * Returns the permission ID for an email address. (permissions.getIdForEmail)
2064
  * @param string $email
2065
  * The email address for which to return a permission ID
2066
  * @param array $optParams Optional parameters.
2067
+ * @return W3TCG_Google_Service_Drive_PermissionId
2068
  */
2069
  public function getIdForEmail($email, $optParams = array())
2070
  {
2071
  $params = array('email' => $email);
2072
  $params = array_merge($params, $optParams);
2073
+ return $this->call('getIdForEmail', array($params), "W3TCG_Google_Service_Drive_PermissionId");
2074
  }
2075
  /**
2076
  * Inserts a permission for a file. (permissions.insert)
2077
  *
2078
  * @param string $fileId
2079
  * The ID for the file.
2080
+ * @param W3TCG_Google_Permission $postBody
2081
  * @param array $optParams Optional parameters.
2082
  *
2083
  * @opt_param string emailMessage
2085
  * @opt_param bool sendNotificationEmails
2086
  * Whether to send notification emails when sharing to users or groups. This parameter is ignored
2087
  * and an email is sent if the role is owner.
2088
+ * @return W3TCG_Google_Service_Drive_Permission
2089
  */
2090
+ public function insert($fileId, W3TCG_Google_Service_Drive_Permission $postBody, $optParams = array())
2091
  {
2092
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
2093
  $params = array_merge($params, $optParams);
2094
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_Permission");
2095
  }
2096
  /**
2097
  * Lists a file's permissions. (permissions.listPermissions)
2099
  * @param string $fileId
2100
  * The ID for the file.
2101
  * @param array $optParams Optional parameters.
2102
+ * @return W3TCG_Google_Service_Drive_PermissionList
2103
  */
2104
  public function listPermissions($fileId, $optParams = array())
2105
  {
2106
  $params = array('fileId' => $fileId);
2107
  $params = array_merge($params, $optParams);
2108
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_PermissionList");
2109
  }
2110
  /**
2111
  * Updates a permission. This method supports patch semantics.
2115
  * The ID for the file.
2116
  * @param string $permissionId
2117
  * The ID for the permission.
2118
+ * @param W3TCG_Google_Permission $postBody
2119
  * @param array $optParams Optional parameters.
2120
  *
2121
  * @opt_param bool transferOwnership
2122
  * Whether changing a role to 'owner' should also downgrade the current owners to writers.
2123
+ * @return W3TCG_Google_Service_Drive_Permission
2124
  */
2125
+ public function patch($fileId, $permissionId, W3TCG_Google_Service_Drive_Permission $postBody, $optParams = array())
2126
  {
2127
  $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
2128
  $params = array_merge($params, $optParams);
2129
+ return $this->call('patch', array($params), "W3TCG_Google_Service_Drive_Permission");
2130
  }
2131
  /**
2132
  * Updates a permission. (permissions.update)
2135
  * The ID for the file.
2136
  * @param string $permissionId
2137
  * The ID for the permission.
2138
+ * @param W3TCG_Google_Permission $postBody
2139
  * @param array $optParams Optional parameters.
2140
  *
2141
  * @opt_param bool transferOwnership
2142
  * Whether changing a role to 'owner' should also downgrade the current owners to writers.
2143
+ * @return W3TCG_Google_Service_Drive_Permission
2144
  */
2145
+ public function update($fileId, $permissionId, W3TCG_Google_Service_Drive_Permission $postBody, $optParams = array())
2146
  {
2147
  $params = array('fileId' => $fileId, 'permissionId' => $permissionId, 'postBody' => $postBody);
2148
  $params = array_merge($params, $optParams);
2149
+ return $this->call('update', array($params), "W3TCG_Google_Service_Drive_Permission");
2150
  }
2151
  }
2152
 
2154
  * The "properties" collection of methods.
2155
  * Typical usage is:
2156
  * <code>
2157
+ * $driveService = new W3TCG_Google_Service_Drive(...);
2158
  * $properties = $driveService->properties;
2159
  * </code>
2160
  */
2161
+ class W3TCG_Google_Service_Drive_Properties_Resource extends W3TCG_Google_Service_Resource
2162
  {
2163
 
2164
  /**
2190
  *
2191
  * @opt_param string visibility
2192
  * The visibility of the property.
2193
+ * @return W3TCG_Google_Service_Drive_Property
2194
  */
2195
  public function get($fileId, $propertyKey, $optParams = array())
2196
  {
2197
  $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey);
2198
  $params = array_merge($params, $optParams);
2199
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_Property");
2200
  }
2201
  /**
2202
  * Adds a property to a file. (properties.insert)
2203
  *
2204
  * @param string $fileId
2205
  * The ID of the file.
2206
+ * @param W3TCG_Google_Property $postBody
2207
  * @param array $optParams Optional parameters.
2208
+ * @return W3TCG_Google_Service_Drive_Property
2209
  */
2210
+ public function insert($fileId, W3TCG_Google_Service_Drive_Property $postBody, $optParams = array())
2211
  {
2212
  $params = array('fileId' => $fileId, 'postBody' => $postBody);
2213
  $params = array_merge($params, $optParams);
2214
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_Property");
2215
  }
2216
  /**
2217
  * Lists a file's properties. (properties.listProperties)
2219
  * @param string $fileId
2220
  * The ID of the file.
2221
  * @param array $optParams Optional parameters.
2222
+ * @return W3TCG_Google_Service_Drive_PropertyList
2223
  */
2224
  public function listProperties($fileId, $optParams = array())
2225
  {
2226
  $params = array('fileId' => $fileId);
2227
  $params = array_merge($params, $optParams);
2228
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_PropertyList");
2229
  }
2230
  /**
2231
  * Updates a property. This method supports patch semantics. (properties.patch)
2234
  * The ID of the file.
2235
  * @param string $propertyKey
2236
  * The key of the property.
2237
+ * @param W3TCG_Google_Property $postBody
2238
  * @param array $optParams Optional parameters.
2239
  *
2240
  * @opt_param string visibility
2241
  * The visibility of the property.
2242
+ * @return W3TCG_Google_Service_Drive_Property
2243
  */
2244
+ public function patch($fileId, $propertyKey, W3TCG_Google_Service_Drive_Property $postBody, $optParams = array())
2245
  {
2246
  $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
2247
  $params = array_merge($params, $optParams);
2248
+ return $this->call('patch', array($params), "W3TCG_Google_Service_Drive_Property");
2249
  }
2250
  /**
2251
  * Updates a property. (properties.update)
2254
  * The ID of the file.
2255
  * @param string $propertyKey
2256
  * The key of the property.
2257
+ * @param W3TCG_Google_Property $postBody
2258
  * @param array $optParams Optional parameters.
2259
  *
2260
  * @opt_param string visibility
2261
  * The visibility of the property.
2262
+ * @return W3TCG_Google_Service_Drive_Property
2263
  */
2264
+ public function update($fileId, $propertyKey, W3TCG_Google_Service_Drive_Property $postBody, $optParams = array())
2265
  {
2266
  $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey, 'postBody' => $postBody);
2267
  $params = array_merge($params, $optParams);
2268
+ return $this->call('update', array($params), "W3TCG_Google_Service_Drive_Property");
2269
  }
2270
  }
2271
 
2273
  * The "realtime" collection of methods.
2274
  * Typical usage is:
2275
  * <code>
2276
+ * $driveService = new W3TCG_Google_Service_Drive(...);
2277
  * $realtime = $driveService->realtime;
2278
  * </code>
2279
  */
2280
+ class W3TCG_Google_Service_Drive_Realtime_Resource extends W3TCG_Google_Service_Resource
2281
  {
2282
 
2283
  /**
2325
  * The "replies" collection of methods.
2326
  * Typical usage is:
2327
  * <code>
2328
+ * $driveService = new W3TCG_Google_Service_Drive(...);
2329
  * $replies = $driveService->replies;
2330
  * </code>
2331
  */
2332
+ class W3TCG_Google_Service_Drive_Replies_Resource extends W3TCG_Google_Service_Resource
2333
  {
2334
 
2335
  /**
2362
  *
2363
  * @opt_param bool includeDeleted
2364
  * If set, this will succeed when retrieving a deleted reply.
2365
+ * @return W3TCG_Google_Service_Drive_CommentReply
2366
  */
2367
  public function get($fileId, $commentId, $replyId, $optParams = array())
2368
  {
2369
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId);
2370
  $params = array_merge($params, $optParams);
2371
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_CommentReply");
2372
  }
2373
  /**
2374
  * Creates a new reply to the given comment. (replies.insert)
2377
  * The ID of the file.
2378
  * @param string $commentId
2379
  * The ID of the comment.
2380
+ * @param W3TCG_Google_CommentReply $postBody
2381
  * @param array $optParams Optional parameters.
2382
+ * @return W3TCG_Google_Service_Drive_CommentReply
2383
  */
2384
+ public function insert($fileId, $commentId, W3TCG_Google_Service_Drive_CommentReply $postBody, $optParams = array())
2385
  {
2386
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody);
2387
  $params = array_merge($params, $optParams);
2388
+ return $this->call('insert', array($params), "W3TCG_Google_Service_Drive_CommentReply");
2389
  }
2390
  /**
2391
  * Lists all of the replies to a comment. (replies.listReplies)
2403
  * If set, all replies, including deleted replies (with content stripped) will be returned.
2404
  * @opt_param int maxResults
2405
  * The maximum number of replies to include in the response, used for paging.
2406
+ * @return W3TCG_Google_Service_Drive_CommentReplyList
2407
  */
2408
  public function listReplies($fileId, $commentId, $optParams = array())
2409
  {
2410
  $params = array('fileId' => $fileId, 'commentId' => $commentId);
2411
  $params = array_merge($params, $optParams);
2412
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_CommentReplyList");
2413
  }
2414
  /**
2415
  * Updates an existing reply. This method supports patch semantics.
2421
  * The ID of the comment.
2422
  * @param string $replyId
2423
  * The ID of the reply.
2424
+ * @param W3TCG_Google_CommentReply $postBody
2425
  * @param array $optParams Optional parameters.
2426
+ * @return W3TCG_Google_Service_Drive_CommentReply
2427
  */
2428
+ public function patch($fileId, $commentId, $replyId, W3TCG_Google_Service_Drive_CommentReply $postBody, $optParams = array())
2429
  {
2430
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
2431
  $params = array_merge($params, $optParams);
2432
+ return $this->call('patch', array($params), "W3TCG_Google_Service_Drive_CommentReply");
2433
  }
2434
  /**
2435
  * Updates an existing reply. (replies.update)
2440
  * The ID of the comment.
2441
  * @param string $replyId
2442
  * The ID of the reply.
2443
+ * @param W3TCG_Google_CommentReply $postBody
2444
  * @param array $optParams Optional parameters.
2445
+ * @return W3TCG_Google_Service_Drive_CommentReply
2446
  */
2447
+ public function update($fileId, $commentId, $replyId, W3TCG_Google_Service_Drive_CommentReply $postBody, $optParams = array())
2448
  {
2449
  $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId, 'postBody' => $postBody);
2450
  $params = array_merge($params, $optParams);
2451
+ return $this->call('update', array($params), "W3TCG_Google_Service_Drive_CommentReply");
2452
  }
2453
  }
2454
 
2456
  * The "revisions" collection of methods.
2457
  * Typical usage is:
2458
  * <code>
2459
+ * $driveService = new W3TCG_Google_Service_Drive(...);
2460
  * $revisions = $driveService->revisions;
2461
  * </code>
2462
  */
2463
+ class W3TCG_Google_Service_Drive_Revisions_Resource extends W3TCG_Google_Service_Resource
2464
  {
2465
 
2466
  /**
2486
  * @param string $revisionId
2487
  * The ID of the revision.
2488
  * @param array $optParams Optional parameters.
2489
+ * @return W3TCG_Google_Service_Drive_Revision
2490
  */
2491
  public function get($fileId, $revisionId, $optParams = array())
2492
  {
2493
  $params = array('fileId' => $fileId, 'revisionId' => $revisionId);
2494
  $params = array_merge($params, $optParams);
2495
+ return $this->call('get', array($params), "W3TCG_Google_Service_Drive_Revision");
2496
  }
2497
  /**
2498
  * Lists a file's revisions. (revisions.listRevisions)
2500
  * @param string $fileId
2501
  * The ID of the file.
2502
  * @param array $optParams Optional parameters.
2503
+ * @return W3TCG_Google_Service_Drive_RevisionList
2504
  */
2505
  public function listRevisions($fileId, $optParams = array())
2506
  {
2507
  $params = array('fileId' => $fileId);
2508
  $params = array_merge($params, $optParams);
2509
+ return $this->call('list', array($params), "W3TCG_Google_Service_Drive_RevisionList");
2510
  }
2511
  /**
2512
  * Updates a revision. This method supports patch semantics. (revisions.patch)
2515
  * The ID for the file.
2516
  * @param string $revisionId
2517
  * The ID for the revision.
2518
+ * @param W3TCG_Google_Revision $postBody
2519
  * @param array $optParams Optional parameters.
2520
+ * @return W3TCG_Google_Service_Drive_Revision
2521
  */
2522
+ public function patch($fileId, $revisionId, W3TCG_Google_Service_Drive_Revision $postBody, $optParams = array())
2523
  {
2524
  $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
2525
  $params = array_merge($params, $optParams);
2526
+ return $this->call('patch', array($params), "W3TCG_Google_Service_Drive_Revision");
2527
  }
2528
  /**
2529
  * Updates a revision. (revisions.update)
2532
  * The ID for the file.
2533
  * @param string $revisionId
2534
  * The ID for the revision.
2535
+ * @param W3TCG_Google_Revision $postBody
2536
  * @param array $optParams Optional parameters.
2537
+ * @return W3TCG_Google_Service_Drive_Revision
2538
  */
2539
+ public function update($fileId, $revisionId, W3TCG_Google_Service_Drive_Revision $postBody, $optParams = array())
2540
  {
2541
  $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody);
2542
  $params = array_merge($params, $optParams);
2543
+ return $this->call('update', array($params), "W3TCG_Google_Service_Drive_Revision");
2544
  }
2545
  }
2546
 
2547
 
2548
 
2549
 
2550
+ class W3TCG_Google_Service_Drive_About extends W3TCG_Google_Collection
2551
  {
2552
  protected $collection_key = 'quotaBytesByService';
2553
  protected $internal_gapi_mappings = array(
2554
  );
2555
+ protected $additionalRoleInfoType = 'W3TCG_Google_Service_Drive_AboutAdditionalRoleInfo';
2556
  protected $additionalRoleInfoDataType = 'array';
2557
  public $domainSharingPolicy;
2558
  public $etag;
2559
+ protected $exportFormatsType = 'W3TCG_Google_Service_Drive_AboutExportFormats';
2560
  protected $exportFormatsDataType = 'array';
2561
+ protected $featuresType = 'W3TCG_Google_Service_Drive_AboutFeatures';
2562
  protected $featuresDataType = 'array';
2563
+ protected $importFormatsType = 'W3TCG_Google_Service_Drive_AboutImportFormats';
2564
  protected $importFormatsDataType = 'array';
2565
  public $isCurrentAppInstalled;
2566
  public $kind;
2567
  public $languageCode;
2568
  public $largestChangeId;
2569
+ protected $maxUploadSizesType = 'W3TCG_Google_Service_Drive_AboutMaxUploadSizes';
2570
  protected $maxUploadSizesDataType = 'array';
2571
  public $name;
2572
  public $permissionId;
2573
+ protected $quotaBytesByServiceType = 'W3TCG_Google_Service_Drive_AboutQuotaBytesByService';
2574
  protected $quotaBytesByServiceDataType = 'array';
2575
  public $quotaBytesTotal;
2576
  public $quotaBytesUsed;
2580
  public $remainingChangeIds;
2581
  public $rootFolderId;
2582
  public $selfLink;
2583
+ protected $userType = 'W3TCG_Google_Service_Drive_User';
2584
  protected $userDataType = '';
2585
 
2586
  public function setAdditionalRoleInfo($additionalRoleInfo)
2781
  {
2782
  return $this->selfLink;
2783
  }
2784
+ public function setUser(W3TCG_Google_Service_Drive_User $user)
2785
  {
2786
  $this->user = $user;
2787
  }
2793
 
2794
  }
2795
 
2796
+ class W3TCG_Google_Service_Drive_AboutAdditionalRoleInfo extends W3TCG_Google_Collection
2797
  {
2798
  protected $collection_key = 'roleSets';
2799
  protected $internal_gapi_mappings = array(
2800
  );
2801
+ protected $roleSetsType = 'W3TCG_Google_Service_Drive_AboutAdditionalRoleInfoRoleSets';
2802
  protected $roleSetsDataType = 'array';
2803
  public $type;
2804
 
2823
 
2824
  }
2825
 
2826
+ class W3TCG_Google_Service_Drive_AboutAdditionalRoleInfoRoleSets extends W3TCG_Google_Collection
2827
  {
2828
  protected $collection_key = 'additionalRoles';
2829
  protected $internal_gapi_mappings = array(
2852
 
2853
  }
2854
 
2855
+ class W3TCG_Google_Service_Drive_AboutExportFormats extends W3TCG_Google_Collection
2856
  {
2857
  protected $collection_key = 'targets';
2858
  protected $internal_gapi_mappings = array(
2881
 
2882
  }
2883
 
2884
+ class W3TCG_Google_Service_Drive_AboutFeatures extends W3TCG_Google_Model
2885
  {
2886
  protected $internal_gapi_mappings = array(
2887
  );
2909
 
2910
  }
2911
 
2912
+ class W3TCG_Google_Service_Drive_AboutImportFormats extends W3TCG_Google_Collection
2913
  {
2914
  protected $collection_key = 'targets';
2915
  protected $internal_gapi_mappings = array(
2938
 
2939
  }
2940
 
2941
+ class W3TCG_Google_Service_Drive_AboutMaxUploadSizes extends W3TCG_Google_Model
2942
  {
2943
  protected $internal_gapi_mappings = array(
2944
  );
2966
 
2967
  }
2968
 
2969
+ class W3TCG_Google_Service_Drive_AboutQuotaBytesByService extends W3TCG_Google_Model
2970
  {
2971
  protected $internal_gapi_mappings = array(
2972
  );
2994
 
2995
  }
2996
 
2997
+ class W3TCG_Google_Service_Drive_App extends W3TCG_Google_Collection
2998
  {
2999
  protected $collection_key = 'secondaryMimeTypes';
3000
  protected $internal_gapi_mappings = array(
3003
  public $createInFolderTemplate;
3004
  public $createUrl;
3005
  public $hasDriveWideScope;
3006
+ protected $iconsType = 'W3TCG_Google_Service_Drive_AppIcons';
3007
  protected $iconsDataType = 'array';
3008
  public $id;
3009
  public $installed;
3244
 
3245
  }
3246
 
3247
+ class W3TCG_Google_Service_Drive_AppIcons extends W3TCG_Google_Model
3248
  {
3249
  protected $internal_gapi_mappings = array(
3250
  );
3282
 
3283
  }
3284
 
3285
+ class W3TCG_Google_Service_Drive_AppList extends W3TCG_Google_Collection
3286
  {
3287
  protected $collection_key = 'items';
3288
  protected $internal_gapi_mappings = array(
3289
  );
3290
  public $defaultAppIds;
3291
  public $etag;
3292
+ protected $itemsType = 'W3TCG_Google_Service_Drive_App';
3293
  protected $itemsDataType = 'array';
3294
  public $kind;
3295
  public $selfLink;
3342
 
3343
  }
3344
 
3345
+ class W3TCG_Google_Service_Drive_Change extends W3TCG_Google_Model
3346
  {
3347
  protected $internal_gapi_mappings = array(
3348
  );
3349
  public $deleted;
3350
+ protected $fileType = 'W3TCG_Google_Service_Drive_DriveFile';
3351
  protected $fileDataType = '';
3352
  public $fileId;
3353
  public $id;
3364
  {
3365
  return $this->deleted;
3366
  }
3367
+ public function setFile(W3TCG_Google_Service_Drive_DriveFile $file)
3368
  {
3369
  $this->file = $file;
3370
  }
3421
 
3422
  }
3423
 
3424
+ class W3TCG_Google_Service_Drive_ChangeList extends W3TCG_Google_Collection
3425
  {
3426
  protected $collection_key = 'items';
3427
  protected $internal_gapi_mappings = array(
3428
  );
3429
  public $etag;
3430
+ protected $itemsType = 'W3TCG_Google_Service_Drive_Change';
3431
  protected $itemsDataType = 'array';
3432
  public $kind;
3433
  public $largestChangeId;
3501
 
3502
  }
3503
 
3504
+ class W3TCG_Google_Service_Drive_Channel extends W3TCG_Google_Model
3505
  {
3506
  protected $internal_gapi_mappings = array(
3507
  );
3609
 
3610
  }
3611
 
3612
+ class W3TCG_Google_Service_Drive_ChannelParams extends W3TCG_Google_Model
3613
  {
3614
  protected $internal_gapi_mappings = array(
3615
  );
3617
 
3618
  }
3619
 
3620
+ class W3TCG_Google_Service_Drive_ChildList extends W3TCG_Google_Collection
3621
  {
3622
  protected $collection_key = 'items';
3623
  protected $internal_gapi_mappings = array(
3624
  );
3625
  public $etag;
3626
+ protected $itemsType = 'W3TCG_Google_Service_Drive_ChildReference';
3627
  protected $itemsDataType = 'array';
3628
  public $kind;
3629
  public $nextLink;
3687
 
3688
  }
3689
 
3690
+ class W3TCG_Google_Service_Drive_ChildReference extends W3TCG_Google_Model
3691
  {
3692
  protected $internal_gapi_mappings = array(
3693
  );
3735
 
3736
  }
3737
 
3738
+ class W3TCG_Google_Service_Drive_Comment extends W3TCG_Google_Collection
3739
  {
3740
  protected $collection_key = 'replies';
3741
  protected $internal_gapi_mappings = array(
3742
  );
3743
  public $anchor;
3744
+ protected $authorType = 'W3TCG_Google_Service_Drive_User';
3745
  protected $authorDataType = '';
3746
  public $commentId;
3747
  public $content;
3748
+ protected $contextType = 'W3TCG_Google_Service_Drive_CommentContext';
3749
  protected $contextDataType = '';
3750
  public $createdDate;
3751
  public $deleted;
3754
  public $htmlContent;
3755
  public $kind;
3756
  public $modifiedDate;
3757
+ protected $repliesType = 'W3TCG_Google_Service_Drive_CommentReply';
3758
  protected $repliesDataType = 'array';
3759
  public $selfLink;
3760
  public $status;
3768
  {
3769
  return $this->anchor;
3770
  }
3771
+ public function setAuthor(W3TCG_Google_Service_Drive_User $author)
3772
  {
3773
  $this->author = $author;
3774
  }
3795
  {
3796
  return $this->content;
3797
  }
3798
+ public function setContext(W3TCG_Google_Service_Drive_CommentContext $context)
3799
  {
3800
  $this->context = $context;
3801
  }
3897
 
3898
  }
3899
 
3900
+ class W3TCG_Google_Service_Drive_CommentContext extends W3TCG_Google_Model
3901
  {
3902
  protected $internal_gapi_mappings = array(
3903
  );
3925
 
3926
  }
3927
 
3928
+ class W3TCG_Google_Service_Drive_CommentList extends W3TCG_Google_Collection
3929
  {
3930
  protected $collection_key = 'items';
3931
  protected $internal_gapi_mappings = array(
3932
  );
3933
+ protected $itemsType = 'W3TCG_Google_Service_Drive_Comment';
3934
  protected $itemsDataType = 'array';
3935
  public $kind;
3936
  public $nextLink;
3985
 
3986
  }
3987
 
3988
+ class W3TCG_Google_Service_Drive_CommentReply extends W3TCG_Google_Model
3989
  {
3990
  protected $internal_gapi_mappings = array(
3991
  );
3992
+ protected $authorType = 'W3TCG_Google_Service_Drive_User';
3993
  protected $authorDataType = '';
3994
  public $content;
3995
  public $createdDate;
4000
  public $replyId;
4001
  public $verb;
4002
 
4003
+ public function setAuthor(W3TCG_Google_Service_Drive_User $author)
4004
  {
4005
  $this->author = $author;
4006
  }
4084
 
4085
  }
4086
 
4087
+ class W3TCG_Google_Service_Drive_CommentReplyList extends W3TCG_Google_Collection
4088
  {
4089
  protected $collection_key = 'items';
4090
  protected $internal_gapi_mappings = array(
4091
  );
4092
+ protected $itemsType = 'W3TCG_Google_Service_Drive_CommentReply';
4093
  protected $itemsDataType = 'array';
4094
  public $kind;
4095
  public $nextLink;
4144
 
4145
  }
4146
 
4147
+ class W3TCG_Google_Service_Drive_DriveFile extends W3TCG_Google_Collection
4148
  {
4149
  protected $collection_key = 'properties';
4150
  protected $internal_gapi_mappings = array(
4166
  public $headRevisionId;
4167
  public $iconLink;
4168
  public $id;
4169
+ protected $imageMediaMetadataType = 'W3TCG_Google_Service_Drive_DriveFileImageMediaMetadata';
4170
  protected $imageMediaMetadataDataType = '';
4171
+ protected $indexableTextType = 'W3TCG_Google_Service_Drive_DriveFileIndexableText';
4172
  protected $indexableTextDataType = '';
4173
  public $kind;
4174
+ protected $labelsType = 'W3TCG_Google_Service_Drive_DriveFileLabels';
4175
  protected $labelsDataType = '';
4176
+ protected $lastModifyingUserType = 'W3TCG_Google_Service_Drive_User';
4177
  protected $lastModifyingUserDataType = '';
4178
  public $lastModifyingUserName;
4179
  public $lastViewedByMeDate;
4185
  public $openWithLinks;
4186
  public $originalFilename;
4187
  public $ownerNames;
4188
+ protected $ownersType = 'W3TCG_Google_Service_Drive_User';
4189
  protected $ownersDataType = 'array';
4190
+ protected $parentsType = 'W3TCG_Google_Service_Drive_ParentReference';
4191
  protected $parentsDataType = 'array';
4192
+ protected $permissionsType = 'W3TCG_Google_Service_Drive_Permission';
4193
  protected $permissionsDataType = 'array';
4194
+ protected $propertiesType = 'W3TCG_Google_Service_Drive_Property';
4195
  protected $propertiesDataType = 'array';
4196
  public $quotaBytesUsed;
4197
  public $selfLink;
4198
  public $shared;
4199
  public $sharedWithMeDate;
4200
+ protected $sharingUserType = 'W3TCG_Google_Service_Drive_User';
4201
  protected $sharingUserDataType = '';
4202
+ protected $thumbnailType = 'W3TCG_Google_Service_Drive_DriveFileThumbnail';
4203
  protected $thumbnailDataType = '';
4204
  public $thumbnailLink;
4205
  public $title;
4206
+ protected $userPermissionType = 'W3TCG_Google_Service_Drive_Permission';
4207
  protected $userPermissionDataType = '';
4208
  public $version;
4209
+ protected $videoMediaMetadataType = 'W3TCG_Google_Service_Drive_DriveFileVideoMediaMetadata';
4210
  protected $videoMediaMetadataDataType = '';
4211
  public $webContentLink;
4212
  public $webViewLink;
4365
  {
4366
  return $this->id;
4367
  }
4368
+ public function setImageMediaMetadata(W3TCG_Google_Service_Drive_DriveFileImageMediaMetadata $imageMediaMetadata)
4369
  {
4370
  $this->imageMediaMetadata = $imageMediaMetadata;
4371
  }
4374
  {
4375
  return $this->imageMediaMetadata;
4376
  }
4377
+ public function setIndexableText(W3TCG_Google_Service_Drive_DriveFileIndexableText $indexableText)
4378
  {
4379
  $this->indexableText = $indexableText;
4380
  }
4392
  {
4393
  return $this->kind;
4394
  }
4395
+ public function setLabels(W3TCG_Google_Service_Drive_DriveFileLabels $labels)
4396
  {
4397
  $this->labels = $labels;
4398
  }
4401
  {
4402
  return $this->labels;
4403
  }
4404
+ public function setLastModifyingUser(W3TCG_Google_Service_Drive_User $lastModifyingUser)
4405
  {
4406
  $this->lastModifyingUser = $lastModifyingUser;
4407
  }
4572
  {
4573
  return $this->sharedWithMeDate;
4574
  }
4575
+ public function setSharingUser(W3TCG_Google_Service_Drive_User $sharingUser)
4576
  {
4577
  $this->sharingUser = $sharingUser;
4578
  }
4581
  {
4582
  return $this->sharingUser;
4583
  }
4584
+ public function setThumbnail(W3TCG_Google_Service_Drive_DriveFileThumbnail $thumbnail)
4585
  {
4586
  $this->thumbnail = $thumbnail;
4587
  }
4608
  {
4609
  return $this->title;
4610
  }
4611
+ public function setUserPermission(W3TCG_Google_Service_Drive_Permission $userPermission)
4612
  {
4613
  $this->userPermission = $userPermission;
4614
  }
4626
  {
4627
  return $this->version;
4628
  }
4629
+ public function setVideoMediaMetadata(W3TCG_Google_Service_Drive_DriveFileVideoMediaMetadata $videoMediaMetadata)
4630
  {
4631
  $this->videoMediaMetadata = $videoMediaMetadata;
4632
  }
4665
 
4666
  }
4667
 
4668
+ class W3TCG_Google_Service_Drive_DriveFileExportLinks extends W3TCG_Google_Model
4669
  {
4670
  protected $internal_gapi_mappings = array(
4671
  );
4673
 
4674
  }
4675
 
4676
+ class W3TCG_Google_Service_Drive_DriveFileImageMediaMetadata extends W3TCG_Google_Model
4677
  {
4678
  protected $internal_gapi_mappings = array(
4679
  );
4690
  public $height;
4691
  public $isoSpeed;
4692
  public $lens;
4693
+ protected $locationType = 'W3TCG_Google_Service_Drive_DriveFileImageMediaMetadataLocation';
4694
  protected $locationDataType = '';
4695
  public $maxApertureValue;
4696
  public $meteringMode;
4817
  {
4818
  return $this->lens;
4819
  }
4820
+ public function setLocation(W3TCG_Google_Service_Drive_DriveFileImageMediaMetadataLocation $location)
4821
  {
4822
  $this->location = $location;
4823
  }
4892
 
4893
  }
4894
 
4895
+ class W3TCG_Google_Service_Drive_DriveFileImageMediaMetadataLocation extends W3TCG_Google_Model
4896
  {
4897
  protected $internal_gapi_mappings = array(
4898
  );
4930
 
4931
  }
4932
 
4933
+ class W3TCG_Google_Service_Drive_DriveFileIndexableText extends W3TCG_Google_Model
4934
  {
4935
  protected $internal_gapi_mappings = array(
4936
  );
4948
 
4949
  }
4950
 
4951
+ class W3TCG_Google_Service_Drive_DriveFileLabels extends W3TCG_Google_Model
4952
  {
4953
  protected $internal_gapi_mappings = array(
4954
  );
5006
 
5007
  }
5008
 
5009
+ class W3TCG_Google_Service_Drive_DriveFileOpenWithLinks extends W3TCG_Google_Model
5010
  {
5011
  protected $internal_gapi_mappings = array(
5012
  );
5014
 
5015
  }
5016
 
5017
+ class W3TCG_Google_Service_Drive_DriveFileThumbnail extends W3TCG_Google_Model
5018
  {
5019
  protected $internal_gapi_mappings = array(
5020
  );
5042
 
5043
  }
5044
 
5045
+ class W3TCG_Google_Service_Drive_DriveFileVideoMediaMetadata extends W3TCG_Google_Model
5046
  {
5047
  protected $internal_gapi_mappings = array(
5048
  );
5080
 
5081
  }
5082
 
5083
+ class W3TCG_Google_Service_Drive_FileList extends W3TCG_Google_Collection
5084
  {
5085
  protected $collection_key = 'items';
5086
  protected $internal_gapi_mappings = array(
5087
  );
5088
  public $etag;
5089
+ protected $itemsType = 'W3TCG_Google_Service_Drive_DriveFile';
5090
  protected $itemsDataType = 'array';
5091
  public $kind;
5092
  public $nextLink;
5150
 
5151
  }
5152
 
5153
+ class W3TCG_Google_Service_Drive_ParentList extends W3TCG_Google_Collection
5154
  {
5155
  protected $collection_key = 'items';
5156
  protected $internal_gapi_mappings = array(
5157
  );
5158
  public $etag;
5159
+ protected $itemsType = 'W3TCG_Google_Service_Drive_ParentReference';
5160
  protected $itemsDataType = 'array';
5161
  public $kind;
5162
  public $selfLink;
5200
 
5201
  }
5202
 
5203
+ class W3TCG_Google_Service_Drive_ParentReference extends W3TCG_Google_Model
5204
  {
5205
  protected $internal_gapi_mappings = array(
5206
  );
5258
 
5259
  }
5260
 
5261
+ class W3TCG_Google_Service_Drive_Permission extends W3TCG_Google_Collection
5262
  {
5263
  protected $collection_key = 'additionalRoles';
5264
  protected $internal_gapi_mappings = array(
5407
 
5408
  }
5409
 
5410
+ class W3TCG_Google_Service_Drive_PermissionId extends W3TCG_Google_Model
5411
  {
5412
  protected $internal_gapi_mappings = array(
5413
  );
5435
 
5436
  }
5437
 
5438
+ class W3TCG_Google_Service_Drive_PermissionList extends W3TCG_Google_Collection
5439
  {
5440
  protected $collection_key = 'items';
5441
  protected $internal_gapi_mappings = array(
5442
  );
5443
  public $etag;
5444
+ protected $itemsType = 'W3TCG_Google_Service_Drive_Permission';
5445
  protected $itemsDataType = 'array';
5446
  public $kind;
5447
  public $selfLink;
5485
 
5486
  }
5487
 
5488
+ class W3TCG_Google_Service_Drive_Property extends W3TCG_Google_Model
5489
  {
5490
  protected $internal_gapi_mappings = array(
5491
  );
5553
 
5554
  }
5555
 
5556
+ class W3TCG_Google_Service_Drive_PropertyList extends W3TCG_Google_Collection
5557
  {
5558
  protected $collection_key = 'items';
5559
  protected $internal_gapi_mappings = array(
5560
  );
5561
  public $etag;
5562
+ protected $itemsType = 'W3TCG_Google_Service_Drive_Property';
5563
  protected $itemsDataType = 'array';
5564
  public $kind;
5565
  public $selfLink;
5603
 
5604
  }
5605
 
5606
+ class W3TCG_Google_Service_Drive_Revision extends W3TCG_Google_Model
5607
  {
5608
  protected $internal_gapi_mappings = array(
5609
  );
5613
  public $fileSize;
5614
  public $id;
5615
  public $kind;
5616
+ protected $lastModifyingUserType = 'W3TCG_Google_Service_Drive_User';
5617
  protected $lastModifyingUserDataType = '';
5618
  public $lastModifyingUserName;
5619
  public $md5Checksum;
5681
  {
5682
  return $this->kind;
5683
  }
5684
+ public function setLastModifyingUser(W3TCG_Google_Service_Drive_User $lastModifyingUser)
5685
  {
5686
  $this->lastModifyingUser = $lastModifyingUser;
5687
  }
5792
 
5793
  }
5794
 
5795
+ class W3TCG_Google_Service_Drive_RevisionExportLinks extends W3TCG_Google_Model
5796
  {
5797
  protected $internal_gapi_mappings = array(
5798
  );
5800
 
5801
  }
5802
 
5803
+ class W3TCG_Google_Service_Drive_RevisionList extends W3TCG_Google_Collection
5804
  {
5805
  protected $collection_key = 'items';
5806
  protected $internal_gapi_mappings = array(
5807
  );
5808
  public $etag;
5809
+ protected $itemsType = 'W3TCG_Google_Service_Drive_Revision';
5810
  protected $itemsDataType = 'array';
5811
  public $kind;
5812
  public $selfLink;
5850
 
5851
  }
5852
 
5853
+ class W3TCG_Google_Service_Drive_User extends W3TCG_Google_Model
5854
  {
5855
  protected $internal_gapi_mappings = array(
5856
  );
5859
  public $isAuthenticatedUser;
5860
  public $kind;
5861
  public $permissionId;
5862
+ protected $pictureType = 'W3TCG_Google_Service_Drive_UserPicture';
5863
  protected $pictureDataType = '';
5864
 
5865
  public function setDisplayName($displayName)
5907
  {
5908
  return $this->permissionId;
5909
  }
5910
+ public function setPicture(W3TCG_Google_Service_Drive_UserPicture $picture)
5911
  {
5912
  $this->picture = $picture;
5913
  }
5919
 
5920
  }
5921
 
5922
+ class W3TCG_Google_Service_Drive_UserPicture extends W3TCG_Google_Model
5923
  {
5924
  protected $internal_gapi_mappings = array(
5925
  );
lib/Google/Service/Exception.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class Google_Service_Exception extends Google_Exception
4
  {
5
  /**
6
  * Optional list of errors returned in a JSON body of an HTTP error response.
1
  <?php
2
 
3
+ class W3TCG_Google_Service_Exception extends W3TCG_Google_Exception
4
  {
5
  /**
6
  * Optional list of errors returned in a JSON body of an HTTP error response.
lib/Google/Service/Oauth2.php CHANGED
@@ -29,7 +29,7 @@
29
  *
30
  * @author Google, Inc.
31
  */
32
- class Google_Service_Oauth2 extends Google_Service
33
  {
34
  /** Know your basic profile info and list of people in your circles.. */
35
  const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
@@ -47,16 +47,16 @@ class Google_Service_Oauth2 extends Google_Service
47
  /**
48
  * Constructs the internal representation of the Oauth2 service.
49
  *
50
- * @param Google_Client $client
51
  */
52
- public function __construct(Google_Client $client)
53
  {
54
  parent::__construct($client);
55
  $this->servicePath = '';
56
  $this->version = 'v2';
57
  $this->serviceName = 'oauth2';
58
 
59
- $this->userinfo = new Google_Service_Oauth2_Userinfo_Resource(
60
  $this,
61
  $this->serviceName,
62
  'userinfo',
@@ -70,7 +70,7 @@ class Google_Service_Oauth2 extends Google_Service
70
  )
71
  )
72
  );
73
- $this->userinfo_v2_me = new Google_Service_Oauth2_UserinfoV2Me_Resource(
74
  $this,
75
  $this->serviceName,
76
  'me',
@@ -84,7 +84,7 @@ class Google_Service_Oauth2 extends Google_Service
84
  )
85
  )
86
  );
87
- $this->base_methods = new Google_Service_Resource(
88
  $this,
89
  $this->serviceName,
90
  '',
@@ -117,13 +117,13 @@ class Google_Service_Oauth2 extends Google_Service
117
  *
118
  * @opt_param string id_token
119
  *
120
- * @return Google_Service_Oauth2_Tokeninfo
121
  */
122
  public function tokeninfo($optParams = array())
123
  {
124
  $params = array();
125
  $params = array_merge($params, $optParams);
126
- return $this->base_methods->call('tokeninfo', array($params), "Google_Service_Oauth2_Tokeninfo");
127
  }
128
  }
129
 
@@ -132,24 +132,24 @@ class Google_Service_Oauth2 extends Google_Service
132
  * The "userinfo" collection of methods.
133
  * Typical usage is:
134
  * <code>
135
- * $oauth2Service = new Google_Service_Oauth2(...);
136
  * $userinfo = $oauth2Service->userinfo;
137
  * </code>
138
  */
139
- class Google_Service_Oauth2_Userinfo_Resource extends Google_Service_Resource
140
  {
141
 
142
  /**
143
  * (userinfo.get)
144
  *
145
  * @param array $optParams Optional parameters.
146
- * @return Google_Service_Oauth2_Userinfoplus
147
  */
148
  public function get($optParams = array())
149
  {
150
  $params = array();
151
  $params = array_merge($params, $optParams);
152
- return $this->call('get', array($params), "Google_Service_Oauth2_Userinfoplus");
153
  }
154
  }
155
 
@@ -157,11 +157,11 @@ class Google_Service_Oauth2_Userinfo_Resource extends Google_Service_Resource
157
  * The "v2" collection of methods.
158
  * Typical usage is:
159
  * <code>
160
- * $oauth2Service = new Google_Service_Oauth2(...);
161
  * $v2 = $oauth2Service->v2;
162
  * </code>
163
  */
164
- class Google_Service_Oauth2_UserinfoV2_Resource extends Google_Service_Resource
165
  {
166
 
167
  }
@@ -170,31 +170,31 @@ class Google_Service_Oauth2_UserinfoV2_Resource extends Google_Service_Resource
170
  * The "me" collection of methods.
171
  * Typical usage is:
172
  * <code>
173
- * $oauth2Service = new Google_Service_Oauth2(...);
174
  * $me = $oauth2Service->me;
175
  * </code>
176
  */
177
- class Google_Service_Oauth2_UserinfoV2Me_Resource extends Google_Service_Resource
178
  {
179
 
180
  /**
181
  * (me.get)
182
  *
183
  * @param array $optParams Optional parameters.
184
- * @return Google_Service_Oauth2_Userinfoplus
185
  */
186
  public function get($optParams = array())
187
  {
188
  $params = array();
189
  $params = array_merge($params, $optParams);
190
- return $this->call('get', array($params), "Google_Service_Oauth2_Userinfoplus");
191
  }
192
  }
193
 
194
 
195
 
196
 
197
- class Google_Service_Oauth2_Tokeninfo extends Google_Model
198
  {
199
  protected $internal_gapi_mappings = array(
200
  "accessType" => "access_type",
@@ -287,7 +287,7 @@ class Google_Service_Oauth2_Tokeninfo extends Google_Model
287
 
288
  }
289
 
290
- class Google_Service_Oauth2_Userinfoplus extends Google_Model
291
  {
292
  protected $internal_gapi_mappings = array(
293
  "familyName" => "family_name",
29
  *
30
  * @author Google, Inc.
31
  */
32
+ class W3TCG_Google_Service_Oauth2 extends W3TCG_Google_Service
33
  {
34
  /** Know your basic profile info and list of people in your circles.. */
35
  const PLUS_LOGIN = "https://www.googleapis.com/auth/plus.login";
47
  /**
48
  * Constructs the internal representation of the Oauth2 service.
49
  *
50
+ * @param W3TCG_Google_Client $client
51
  */
52
+ public function __construct(W3TCG_Google_Client $client)
53
  {
54
  parent::__construct($client);
55
  $this->servicePath = '';
56
  $this->version = 'v2';
57
  $this->serviceName = 'oauth2';
58
 
59
+ $this->userinfo = new W3TCG_Google_Service_Oauth2_Userinfo_Resource(
60
  $this,
61
  $this->serviceName,
62
  'userinfo',
70
  )
71
  )
72
  );
73
+ $this->userinfo_v2_me = new W3TCG_Google_Service_Oauth2_UserinfoV2Me_Resource(
74
  $this,
75
  $this->serviceName,
76
  'me',
84
  )
85
  )
86
  );
87
+ $this->base_methods = new W3TCG_Google_Service_Resource(
88
  $this,
89
  $this->serviceName,
90
  '',
117
  *
118
  * @opt_param string id_token
119
  *
120
+ * @return W3TCG_Google_Service_Oauth2_Tokeninfo
121
  */
122
  public function tokeninfo($optParams = array())
123
  {
124
  $params = array();
125
  $params = array_merge($params, $optParams);
126
+ return $this->base_methods->call('tokeninfo', array($params), "W3TCG_Google_Service_Oauth2_Tokeninfo");
127
  }
128
  }
129
 
132
  * The "userinfo" collection of methods.
133
  * Typical usage is:
134
  * <code>
135
+ * $oauth2Service = new W3TCG_Google_Service_Oauth2(...);
136
  * $userinfo = $oauth2Service->userinfo;
137
  * </code>
138
  */
139
+ class W3TCG_Google_Service_Oauth2_Userinfo_Resource extends W3TCG_Google_Service_Resource
140
  {
141
 
142
  /**
143
  * (userinfo.get)
144
  *
145
  * @param array $optParams Optional parameters.
146
+ * @return W3TCG_Google_Service_Oauth2_Userinfoplus
147
  */
148
  public function get($optParams = array())
149
  {
150
  $params = array();
151
  $params = array_merge($params, $optParams);
152
+ return $this->call('get', array($params), "W3TCG_Google_Service_Oauth2_Userinfoplus");
153
  }
154
  }
155
 
157
  * The "v2" collection of methods.
158
  * Typical usage is:
159
  * <code>
160
+ * $oauth2Service = new W3TCG_Google_Service_Oauth2(...);
161
  * $v2 = $oauth2Service->v2;
162
  * </code>
163
  */
164
+ class W3TCG_Google_Service_Oauth2_UserinfoV2_Resource extends W3TCG_Google_Service_Resource
165
  {
166
 
167
  }
170
  * The "me" collection of methods.
171
  * Typical usage is:
172
  * <code>
173
+ * $oauth2Service = new W3TCG_Google_Service_Oauth2(...);
174
  * $me = $oauth2Service->me;
175
  * </code>
176
  */
177
+ class W3TCG_Google_Service_Oauth2_UserinfoV2Me_Resource extends W3TCG_Google_Service_Resource
178
  {
179
 
180
  /**
181
  * (me.get)
182
  *
183
  * @param array $optParams Optional parameters.
184
+ * @return W3TCG_Google_Service_Oauth2_Userinfoplus
185
  */
186
  public function get($optParams = array())
187
  {
188
  $params = array();
189
  $params = array_merge($params, $optParams);
190
+ return $this->call('get', array($params), "W3TCG_Google_Service_Oauth2_Userinfoplus");
191
  }
192
  }
193
 
194
 
195
 
196
 
197
+ class W3TCG_Google_Service_Oauth2_Tokeninfo extends W3TCG_Google_Model
198
  {
199
  protected $internal_gapi_mappings = array(
200
  "accessType" => "access_type",
287
 
288
  }
289
 
290
+ class W3TCG_Google_Service_Oauth2_Userinfoplus extends W3TCG_Google_Model
291
  {
292
  protected $internal_gapi_mappings = array(
293
  "familyName" => "family_name",
lib/Google/Service/Resource.php CHANGED
@@ -24,7 +24,7 @@
24
  * @author Chirag Shah <chirags@google.com>
25
  *
26
  */
27
- class Google_Service_Resource
28
  {
29
  // Valid query parameters that work, but don't appear in discovery.
30
  private $stackParameters = array(
@@ -40,10 +40,10 @@ class Google_Service_Resource
40
  'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
41
  );
42
 
43
- /** @var Google_Service $service */
44
  private $service;
45
 
46
- /** @var Google_Client $client */
47
  private $client;
48
 
49
  /** @var string $serviceName */
@@ -71,13 +71,13 @@ class Google_Service_Resource
71
  * @param $name
72
  * @param $arguments
73
  * @param $expected_class - optional, the expected class name
74
- * @return Google_Http_Request|expected_class
75
- * @throws Google_Exception
76
  */
77
  public function call($name, $arguments, $expected_class = null)
78
  {
79
  if (! isset($this->methods[$name])) {
80
- throw new Google_Exception(
81
  "Unknown function: " .
82
  "{$this->serviceName}->{$this->resourceName}->{$name}()"
83
  );
@@ -89,7 +89,7 @@ class Google_Service_Resource
89
  // document as parameter, but we abuse the param entry for storing it.
90
  $postBody = null;
91
  if (isset($parameters['postBody'])) {
92
- if ($parameters['postBody'] instanceof Google_Model) {
93
  // In the cases the post body is an existing object, we want
94
  // to use the smart method to create a simple object for
95
  // for JSONification.
@@ -122,7 +122,7 @@ class Google_Service_Resource
122
  );
123
  foreach ($parameters as $key => $val) {
124
  if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
125
- throw new Google_Exception("($name) unknown parameter: '$key'");
126
  }
127
  }
128
 
@@ -131,7 +131,7 @@ class Google_Service_Resource
131
  $paramSpec['required'] &&
132
  ! isset($parameters[$paramName])
133
  ) {
134
- throw new Google_Exception("($name) missing required param: '$paramName'");
135
  }
136
  if (isset($parameters[$paramName])) {
137
  $value = $parameters[$paramName];
@@ -146,12 +146,12 @@ class Google_Service_Resource
146
 
147
  $servicePath = $this->service->servicePath;
148
 
149
- $url = Google_Http_REST::createRequestUri(
150
  $servicePath,
151
  $method['path'],
152
  $parameters
153
  );
154
- $httpRequest = new Google_Http_Request(
155
  $url,
156
  $method['httpMethod'],
157
  null,
@@ -172,7 +172,7 @@ class Google_Service_Resource
172
  if (isset($parameters['data']) &&
173
  ($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) {
174
  // If we are doing a simple media upload, trigger that as a convenience.
175
- $mfu = new Google_Http_MediaFileUpload(
176
  $this->client,
177
  $httpRequest,
178
  isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream',
24
  * @author Chirag Shah <chirags@google.com>
25
  *
26
  */
27
+ class W3TCG_Google_Service_Resource
28
  {
29
  // Valid query parameters that work, but don't appear in discovery.
30
  private $stackParameters = array(
40
  'mediaUpload' => array('type' => 'complex', 'location' => 'query'),
41
  );
42
 
43
+ /** @var W3TCG_Google_Service $service */
44
  private $service;
45
 
46
+ /** @var W3TCG_Google_Client $client */
47
  private $client;
48
 
49
  /** @var string $serviceName */
71
  * @param $name
72
  * @param $arguments
73
  * @param $expected_class - optional, the expected class name
74
+ * @return W3TCG_Google_Http_Request|expected_class
75
+ * @throws W3TCG_Google_Exception
76
  */
77
  public function call($name, $arguments, $expected_class = null)
78
  {
79
  if (! isset($this->methods[$name])) {
80
+ throw new W3TCG_Google_Exception(
81
  "Unknown function: " .
82
  "{$this->serviceName}->{$this->resourceName}->{$name}()"
83
  );
89
  // document as parameter, but we abuse the param entry for storing it.
90
  $postBody = null;
91
  if (isset($parameters['postBody'])) {
92
+ if ($parameters['postBody'] instanceof W3TCG_Google_Model) {
93
  // In the cases the post body is an existing object, we want
94
  // to use the smart method to create a simple object for
95
  // for JSONification.
122
  );
123
  foreach ($parameters as $key => $val) {
124
  if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
125
+ throw new W3TCG_Google_Exception("($name) unknown parameter: '$key'");
126
  }
127
  }
128
 
131
  $paramSpec['required'] &&
132
  ! isset($parameters[$paramName])
133
  ) {
134
+ throw new W3TCG_Google_Exception("($name) missing required param: '$paramName'");
135
  }
136
  if (isset($parameters[$paramName])) {
137
  $value = $parameters[$paramName];
146
 
147
  $servicePath = $this->service->servicePath;
148
 
149
+ $url = W3TCG_Google_Http_REST::createRequestUri(
150
  $servicePath,
151
  $method['path'],
152
  $parameters
153
  );
154
+ $httpRequest = new W3TCG_Google_Http_Request(
155
  $url,
156
  $method['httpMethod'],
157
  null,
172
  if (isset($parameters['data']) &&
173
  ($parameters['uploadType']['value'] == 'media' || $parameters['uploadType']['value'] == 'multipart')) {
174
  // If we are doing a simple media upload, trigger that as a convenience.
175
+ $mfu = new W3TCG_Google_Http_MediaFileUpload(
176
  $this->client,
177
  $httpRequest,
178
  isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream',
lib/Google/Signer/Abstract.php CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
- abstract class Google_Signer_Abstract
24
  {
25
  /**
26
  * Signs data, returns the signature as binary data.
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
+ abstract class W3TCG_Google_Signer_Abstract
24
  {
25
  /**
26
  * Signs data, returns the signature as binary data.
lib/Google/Signer/P12.php CHANGED
@@ -22,7 +22,7 @@
22
  *
23
  * @author Brian Eaton <beaton@google.com>
24
  */
25
- class Google_Signer_P12 extends Google_Signer_Abstract
26
  {
27
  // OpenSSL private key resource
28
  private $privateKey;
@@ -31,7 +31,7 @@ class Google_Signer_P12 extends Google_Signer_Abstract
31
  public function __construct($p12, $password)
32
  {
33
  if (!function_exists('openssl_x509_read')) {
34
- throw new Google_Exception(
35
  'The Google PHP API library needs the openssl PHP extension'
36
  );
37
  }
@@ -46,7 +46,7 @@ class Google_Signer_P12 extends Google_Signer_Abstract
46
  // This throws on error
47
  $certs = array();
48
  if (!openssl_pkcs12_read($p12, $certs, $password)) {
49
- throw new Google_Auth_Exception(
50
  "Unable to parse the p12 file. " .
51
  "Is this a .p12 file? Is the password correct? OpenSSL error: " .
52
  openssl_error_string()
@@ -55,13 +55,13 @@ class Google_Signer_P12 extends Google_Signer_Abstract
55
  // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
56
  // method? What happens if there are multiple private keys? Do we care?
57
  if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
58
- throw new Google_Auth_Exception("No private key found in p12 file.");
59
  }
60
  $this->privateKey = openssl_pkey_get_private($certs['pkey']);
61
  }
62
 
63
  if (!$this->privateKey) {
64
- throw new Google_Auth_Exception("Unable to load private key");
65
  }
66
  }
67
 
@@ -75,13 +75,13 @@ class Google_Signer_P12 extends Google_Signer_Abstract
75
  public function sign($data)
76
  {
77
  if (version_compare(PHP_VERSION, '5.3.0') < 0) {
78
- throw new Google_Auth_Exception(
79
  "PHP 5.3.0 or higher is required to use service accounts."
80
  );
81
  }
82
  $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
83
  if (!openssl_sign($data, $signature, $this->privateKey, $hash)) {
84
- throw new Google_Auth_Exception("Unable to sign data");
85
  }
86
  return $signature;
87
  }
22
  *
23
  * @author Brian Eaton <beaton@google.com>
24
  */
25
+ class W3TCG_Google_Signer_P12 extends W3TCG_Google_Signer_Abstract
26
  {
27
  // OpenSSL private key resource
28
  private $privateKey;
31
  public function __construct($p12, $password)
32
  {
33
  if (!function_exists('openssl_x509_read')) {
34
+ throw new W3TCG_Google_Exception(
35
  'The Google PHP API library needs the openssl PHP extension'
36
  );
37
  }
46
  // This throws on error
47
  $certs = array();
48
  if (!openssl_pkcs12_read($p12, $certs, $password)) {
49
+ throw new W3TCG_Google_Auth_Exception(
50
  "Unable to parse the p12 file. " .
51
  "Is this a .p12 file? Is the password correct? OpenSSL error: " .
52
  openssl_error_string()
55
  // TODO(beaton): is this part of the contract for the openssl_pkcs12_read
56
  // method? What happens if there are multiple private keys? Do we care?
57
  if (!array_key_exists("pkey", $certs) || !$certs["pkey"]) {
58
+ throw new W3TCG_Google_Auth_Exception("No private key found in p12 file.");
59
  }
60
  $this->privateKey = openssl_pkey_get_private($certs['pkey']);
61
  }
62
 
63
  if (!$this->privateKey) {
64
+ throw new W3TCG_Google_Auth_Exception("Unable to load private key");
65
  }
66
  }
67
 
75
  public function sign($data)
76
  {
77
  if (version_compare(PHP_VERSION, '5.3.0') < 0) {
78
+ throw new W3TCG_Google_Auth_Exception(
79
  "PHP 5.3.0 or higher is required to use service accounts."
80
  );
81
  }
82
  $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
83
  if (!openssl_sign($data, $signature, $this->privateKey, $hash)) {
84
+ throw new W3TCG_Google_Auth_Exception("Unable to sign data");
85
  }
86
  return $signature;
87
  }
lib/Google/Utils.php CHANGED
@@ -21,7 +21,7 @@
21
  *
22
  * @author Chirag Shah <chirags@google.com>
23
  */
24
- class Google_Utils
25
  {
26
  public static function urlSafeB64Encode($data)
27
  {
21
  *
22
  * @author Chirag Shah <chirags@google.com>
23
  */
24
+ class W3TCG_Google_Utils
25
  {
26
  public static function urlSafeB64Encode($data)
27
  {
lib/Google/Utils/URITemplate.php CHANGED
@@ -19,7 +19,7 @@
19
  * Implementation of levels 1-3 of the URI Template spec.
20
  * @see http://tools.ietf.org/html/rfc6570
21
  */
22
- class Google_Utils_URITemplate
23
  {
24
  const TYPE_MAP = "1";
25
  const TYPE_LIST = "2";
19
  * Implementation of levels 1-3 of the URI Template spec.
20
  * @see http://tools.ietf.org/html/rfc6570
21
  */
22
+ class W3TCG_Google_Utils_URITemplate
23
  {
24
  const TYPE_MAP = "1";
25
  const TYPE_LIST = "2";
lib/Google/Verifier/Abstract.php CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
- abstract class Google_Verifier_Abstract
24
  {
25
  /**
26
  * Checks a signature, returns true if the signature is correct,
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
+ abstract class W3TCG_Google_Verifier_Abstract
24
  {
25
  /**
26
  * Checks a signature, returns true if the signature is correct,
lib/Google/Verifier/Pem.php CHANGED
@@ -20,7 +20,7 @@
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
- class Google_Verifier_Pem extends Google_Verifier_Abstract
24
  {
25
  private $publicKey;
26
 
@@ -29,17 +29,17 @@ class Google_Verifier_Pem extends Google_Verifier_Abstract
29
  *
30
  * $pem: a PEM encoded certificate (not a file).
31
  * @param $pem
32
- * @throws Google_Auth_Exception
33
- * @throws Google_Exception
34
  */
35
  public function __construct($pem)
36
  {
37
  if (!function_exists('openssl_x509_read')) {
38
- throw new Google_Exception('Google API PHP client needs the openssl PHP extension');
39
  }
40
  $this->publicKey = openssl_x509_read($pem);
41
  if (!$this->publicKey) {
42
- throw new Google_Auth_Exception("Unable to parse PEM: $pem");
43
  }
44
  }
45
 
@@ -56,7 +56,7 @@ class Google_Verifier_Pem extends Google_Verifier_Abstract
56
  * Returns true if the signature is valid, false otherwise.
57
  * @param $data
58
  * @param $signature
59
- * @throws Google_Auth_Exception
60
  * @return bool
61
  */
62
  public function verify($data, $signature)
@@ -64,7 +64,7 @@ class Google_Verifier_Pem extends Google_Verifier_Abstract
64
  $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
65
  $status = openssl_verify($data, $signature, $this->publicKey, $hash);
66
  if ($status === -1) {
67
- throw new Google_Auth_Exception('Signature verification error: ' . openssl_error_string());
68
  }
69
  return $status === 1;
70
  }
20
  *
21
  * @author Brian Eaton <beaton@google.com>
22
  */
23
+ class W3TCG_Google_Verifier_Pem extends W3TCG_Google_Verifier_Abstract
24
  {
25
  private $publicKey;
26
 
29
  *
30
  * $pem: a PEM encoded certificate (not a file).
31
  * @param $pem
32
+ * @throws W3TCG_Google_Auth_Exception
33
+ * @throws W3TCG_Google_Exception
34
  */
35
  public function __construct($pem)
36
  {
37
  if (!function_exists('openssl_x509_read')) {
38
+ throw new W3TCG_Google_Exception('Google API PHP client needs the openssl PHP extension');
39
  }
40
  $this->publicKey = openssl_x509_read($pem);
41
  if (!$this->publicKey) {
42
+ throw new W3TCG_Google_Auth_Exception("Unable to parse PEM: $pem");
43
  }
44
  }
45
 
56
  * Returns true if the signature is valid, false otherwise.
57
  * @param $data
58
  * @param $signature
59
+ * @throws W3TCG_Google_Auth_Exception
60
  * @return bool
61
  */
62
  public function verify($data, $signature)
64
  $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256";
65
  $status = openssl_verify($data, $signature, $this->publicKey, $hash);
66
  if ($status === -1) {
67
+ throw new W3TCG_Google_Auth_Exception('Signature verification error: ' . openssl_error_string());
68
  }
69
  return $status === 1;
70
  }
lib/Minify/HTTP/ConditionalGet.php CHANGED
@@ -117,7 +117,7 @@ class HTTP_ConditionalGet {
117
 
118
  $this->_headers['Pragma'] = $scope;
119
 
120
- // backwards compatibility (can be removed later)
121
  if (isset($spec['setExpires'])
122
  && is_numeric($spec['setExpires'])
123
  && ! isset($spec['maxAge'])) {
117
 
118
  $this->_headers['Pragma'] = $scope;
119
 
120
+ // For backwards compatibility (will be removed in the future)
121
  if (isset($spec['setExpires'])
122
  && is_numeric($spec['setExpires'])
123
  && ! isset($spec['maxAge'])) {
lib/Nusoap/class.nusoap_base.php CHANGED
@@ -222,7 +222,7 @@ class nusoap_base {
222
  *
223
  * @access public
224
  */
225
- function nusoap_base() {
226
  $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
227
  }
228
 
222
  *
223
  * @access public
224
  */
225
+ function __construct() {
226
  $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
227
  }
228
 
lib/Nusoap/class.soap_fault.php CHANGED
@@ -46,7 +46,7 @@ class nusoap_fault extends nusoap_base {
46
  * @param string $faultstring human readable error message
47
  * @param mixed $faultdetail detail, typically a string or array of string
48
  */
49
- function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
50
  parent::nusoap_base();
51
  $this->faultcode = $faultcode;
52
  $this->faultactor = $faultactor;
46
  * @param string $faultstring human readable error message
47
  * @param mixed $faultdetail detail, typically a string or array of string
48
  */
49
+ function __construct($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
50
  parent::nusoap_base();
51
  $this->faultcode = $faultcode;
52
  $this->faultactor = $faultactor;
lib/Nusoap/class.soap_parser.php CHANGED
@@ -58,7 +58,7 @@ class nusoap_parser extends nusoap_base {
58
  * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
59
  * @access public
60
  */
61
- function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
62
  parent::nusoap_base();
63
  $this->xml = $xml;
64
  $this->xml_encoding = $encoding;
58
  * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
59
  * @access public
60
  */
61
+ function __construct($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
62
  parent::nusoap_base();
63
  $this->xml = $xml;
64
  $this->xml_encoding = $encoding;
lib/Nusoap/class.soap_transport_http.php CHANGED
@@ -58,7 +58,7 @@ class soap_transport_http extends nusoap_base {
58
  * @param boolean $use_curl Whether to try to force cURL use
59
  * @access public
60
  */
61
- function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
62
  parent::nusoap_base();
63
  $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
64
  $this->appendDebug($this->varDump($curl_options));
58
  * @param boolean $use_curl Whether to try to force cURL use
59
  * @access public
60
  */
61
+ function __construct($url, $curl_options = NULL, $use_curl = false){
62
  parent::nusoap_base();
63
  $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
64
  $this->appendDebug($this->varDump($curl_options));
lib/Nusoap/class.soap_val.php CHANGED
@@ -70,7 +70,7 @@ class soapval extends nusoap_base {
70
  * @param mixed $attributes associative array of attributes to add to element serialization
71
  * @access public
72
  */
73
- function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
74
  parent::nusoap_base();
75
  $this->name = $name;
76
  $this->type = $type;
70
  * @param mixed $attributes associative array of attributes to add to element serialization
71
  * @access public
72
  */
73
+ function __construct($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
74
  parent::nusoap_base();
75
  $this->name = $name;
76
  $this->type = $type;
lib/Nusoap/class.soapclient.php CHANGED
@@ -96,7 +96,7 @@ class nusoap_client extends nusoap_base {
96
  * @param string $portName optional portName in WSDL document
97
  * @access public
98
  */
99
- function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
100
  parent::nusoap_base();
101
  $this->endpoint = $endpoint;
102
  $this->proxyhost = $proxyhost;
96
  * @param string $portName optional portName in WSDL document
97
  * @access public
98
  */
99
+ function __construct($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
100
  parent::nusoap_base();
101
  $this->endpoint = $endpoint;
102
  $this->proxyhost = $proxyhost;
lib/Nusoap/class.wsdl.php CHANGED
@@ -70,7 +70,7 @@ class wsdl extends nusoap_base {
70
  * @param boolean $use_curl try to use cURL
71
  * @access public
72
  */
73
- function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
74
  parent::nusoap_base();
75
  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
76
  $this->proxyhost = $proxyhost;
70
  * @param boolean $use_curl try to use cURL
71
  * @access public
72
  */
73
+ function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
74
  parent::nusoap_base();
75
  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
76
  $this->proxyhost = $proxyhost;
lib/Nusoap/class.wsdlcache.php CHANGED
@@ -47,7 +47,7 @@ class nusoap_wsdlcache {
47
  * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
48
  * @access public
49
  */
50
- function nusoap_wsdlcache($cache_dir='.', $cache_lifetime=0) {
51
  $this->fplock = array();
52
  $this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
53
  $this->cache_lifetime = $cache_lifetime;
47
  * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited
48
  * @access public
49
  */
50
+ function __construct($cache_dir='.', $cache_lifetime=0) {
51
  $this->fplock = array();
52
  $this->cache_dir = $cache_dir != '' ? $cache_dir : '.';
53
  $this->cache_lifetime = $cache_lifetime;
lib/Nusoap/class.xmlschema.php CHANGED
@@ -52,7 +52,7 @@ class nusoap_xmlschema extends nusoap_base {
52
  * @param string $namespaces namespaces defined in enclosing XML
53
  * @access public
54
  */
55
- function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
56
  parent::nusoap_base();
57
  $this->debug('nusoap_xmlschema class instantiated, inside constructor');
58
  // files
52
  * @param string $namespaces namespaces defined in enclosing XML
53
  * @access public
54
  */
55
+ function __construct($schema='',$xml='',$namespaces=array()){
56
  parent::nusoap_base();
57
  $this->debug('nusoap_xmlschema class instantiated, inside constructor');
58
  // files
lib/Nusoap/nusoap.php CHANGED
@@ -222,7 +222,7 @@ class nusoap_base {
222
  *
223
  * @access public
224
  */
225
- function nusoap_base() {
226
  $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
227
  }
228
 
@@ -1038,7 +1038,7 @@ class nusoap_fault extends nusoap_base {
1038
  * @param string $faultstring human readable error message
1039
  * @param mixed $faultdetail detail, typically a string or array of string
1040
  */
1041
- function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
1042
  parent::nusoap_base();
1043
  $this->faultcode = $faultcode;
1044
  $this->faultactor = $faultactor;
@@ -1131,7 +1131,7 @@ class nusoap_xmlschema extends nusoap_base {
1131
  * @param string $namespaces namespaces defined in enclosing XML
1132
  * @access public
1133
  */
1134
- function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
1135
  parent::nusoap_base();
1136
  $this->debug('nusoap_xmlschema class instantiated, inside constructor');
1137
  // files
@@ -2119,7 +2119,7 @@ class soapval extends nusoap_base {
2119
  * @param mixed $attributes associative array of attributes to add to element serialization
2120
  * @access public
2121
  */
2122
- function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
2123
  parent::nusoap_base();
2124
  $this->name = $name;
2125
  $this->type = $type;
@@ -2211,7 +2211,7 @@ class soap_transport_http extends nusoap_base {
2211
  * @param boolean $use_curl Whether to try to force cURL use
2212
  * @access public
2213
  */
2214
- function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
2215
  parent::nusoap_base();
2216
  $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
2217
  $this->appendDebug($this->varDump($curl_options));
@@ -3628,7 +3628,7 @@ class nusoap_server extends nusoap_base {
3628
  * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
3629
  * @access public
3630
  */
3631
- function nusoap_server($wsdl=false){
3632
  parent::nusoap_base();
3633
  // turn on debugging?
3634
  global $debug;
@@ -4651,7 +4651,7 @@ class wsdl extends nusoap_base {
4651
  * @param boolean $use_curl try to use cURL
4652
  * @access public
4653
  */
4654
- function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
4655
  parent::nusoap_base();
4656
  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4657
  $this->proxyhost = $proxyhost;
@@ -6574,7 +6574,7 @@ class nusoap_parser extends nusoap_base {
6574
  * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
6575
  * @access public
6576
  */
6577
- function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
6578
  parent::nusoap_base();
6579
  $this->xml = $xml;
6580
  $this->xml_encoding = $encoding;
@@ -7252,7 +7252,7 @@ class nusoap_client extends nusoap_base {
7252
  * @param string $portName optional portName in WSDL document
7253
  * @access public
7254
  */
7255
- function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
7256
  parent::nusoap_base();
7257
  $this->endpoint = $endpoint;
7258
  $this->proxyhost = $proxyhost;
222
  *
223
  * @access public
224
  */
225
+ function __construct() {
226
  $this->debugLevel = $GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'];
227
  }
228
 
1038
  * @param string $faultstring human readable error message
1039
  * @param mixed $faultdetail detail, typically a string or array of string
1040
  */
1041
+ function __construct($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
1042
  parent::nusoap_base();
1043
  $this->faultcode = $faultcode;
1044
  $this->faultactor = $faultactor;
1131
  * @param string $namespaces namespaces defined in enclosing XML
1132
  * @access public
1133
  */
1134
+ function __construct($schema='',$xml='',$namespaces=array()){
1135
  parent::nusoap_base();
1136
  $this->debug('nusoap_xmlschema class instantiated, inside constructor');
1137
  // files
2119
  * @param mixed $attributes associative array of attributes to add to element serialization
2120
  * @access public
2121
  */
2122
+ function __construct($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
2123
  parent::nusoap_base();
2124
  $this->name = $name;
2125
  $this->type = $type;
2211
  * @param boolean $use_curl Whether to try to force cURL use
2212
  * @access public
2213
  */
2214
+ function __construct($url, $curl_options = NULL, $use_curl = false){
2215
  parent::nusoap_base();
2216
  $this->debug("ctor url=$url use_curl=$use_curl curl_options:");
2217
  $this->appendDebug($this->varDump($curl_options));
3628
  * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
3629
  * @access public
3630
  */
3631
+ function __construct($wsdl=false){
3632
  parent::nusoap_base();
3633
  // turn on debugging?
3634
  global $debug;
4651
  * @param boolean $use_curl try to use cURL
4652
  * @access public
4653
  */
4654
+ function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
4655
  parent::nusoap_base();
4656
  $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
4657
  $this->proxyhost = $proxyhost;
6574
  * @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
6575
  * @access public
6576
  */
6577
+ function __construct($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
6578
  parent::nusoap_base();
6579
  $this->xml = $xml;
6580
  $this->xml_encoding = $encoding;
7252
  * @param string $portName optional portName in WSDL document
7253
  * @access public
7254
  */
7255
+ function __construct($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
7256
  parent::nusoap_base();
7257
  $this->endpoint = $endpoint;
7258
  $this->proxyhost = $proxyhost;
lib/S3.php CHANGED
@@ -231,7 +231,7 @@ class S3 {
231
  if (isset($requestHeaders['Content-Type']))
232
  $input['type'] =& $requestHeaders['Content-Type'];
233
  elseif (isset($input['file']))
234
- $input['type'] = self::__getMimeType($input['file']);
235
  else
236
  $input['type'] = 'application/octet-stream';
237
  }
@@ -395,11 +395,11 @@ class S3 {
395
  self::$use_ssl = true; // CloudFront requires SSL
396
  $rest = new S3Request('POST', '', '2010-11-01/distribution',
397
  'cloudfront.amazonaws.com');
398
- $rest->data = self::__getCloudFrontDistributionConfigXML($dnsName,
399
  $originType, $enabled, $comment, (string)microtime(true), $cnames);
400
  $rest->size = strlen($rest->data);
401
  $rest->setHeader('Content-Type', 'application/xml');
402
- $rest = self::__getCloudFrontResponse($rest);
403
 
404
  if ($rest->error === false && $rest->code !== 201)
405
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
@@ -415,7 +415,7 @@ class S3 {
415
  ), E_USER_WARNING);
416
  return false;
417
  } elseif ($rest->body instanceof SimpleXMLElement)
418
- return self::__parseCloudFrontDistributionConfig($rest->body);
419
  return false;
420
  }
421
 
@@ -430,7 +430,7 @@ class S3 {
430
  $rest = new S3Request('GET', '',
431
  '2010-11-01/distribution/' . $distributionId,
432
  'cloudfront.amazonaws.com');
433
- $rest = self::__getCloudFrontResponse($rest);
434
 
435
  if ($rest->error === false && $rest->code !== 200)
436
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
@@ -442,7 +442,7 @@ class S3 {
442
  ), E_USER_WARNING);
443
  return false;
444
  } elseif ($rest->body instanceof SimpleXMLElement) {
445
- $dist = self::__parseCloudFrontDistributionConfig($rest->body);
446
  $dist['hash'] = $rest->headers['hash'];
447
  return $dist;
448
  }
@@ -461,10 +461,10 @@ class S3 {
461
  $rest = new S3Request('PUT', '',
462
  '2010-11-01/distribution/' . $dist['id'] . '/config',
463
  'cloudfront.amazonaws.com');
464
- $rest->data = self::__getCloudFrontDistributionConfigXML($dist['origin'], $dist['type'], $dist['enabled'], $dist['comment'], $dist['callerReference'], $dist['cnames']);
465
  $rest->size = strlen($rest->data);
466
  $rest->setHeader('If-Match', $dist['hash']);
467
- $rest = self::__getCloudFrontResponse($rest);
468
 
469
  if ($rest->error === false && $rest->code !== 200)
470
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
@@ -476,7 +476,7 @@ class S3 {
476
  ), E_USER_WARNING);
477
  return false;
478
  } else {
479
- $dist = self::__parseCloudFrontDistributionConfig($rest->body);
480
  $dist['hash'] = $rest->headers['hash'];
481
  return $dist;
482
  }
@@ -493,7 +493,7 @@ class S3 {
493
  self::$use_ssl = true; // CloudFront requires SSL
494
  $rest = new S3Request('GET', '', '2010-11-01/distribution',
495
  'cloudfront.amazonaws.com');
496
- $rest = self::__getCloudFrontResponse($rest);
497
 
498
  if ($rest->error === false && $rest->code !== 200)
499
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
@@ -511,7 +511,7 @@ class S3 {
511
  //$info['isTruncated'] = (string)$rest->body->IsTruncated == 'true' ? true : false;
512
  }
513
  foreach ($rest->body->DistributionSummary as $summary) {
514
- $list[(string)$summary->Id] = self::__parseCloudFrontDistributionConfig($summary);
515
  }
516
  return $list;
517
  }
@@ -531,7 +531,7 @@ class S3 {
531
  * @param array $cnames Array of CNAME aliases
532
  * @return string
533
  */
534
- private static function __getCloudFrontDistributionConfigXML($dnsName, $originType, $enabled, $comment, $callerReference = '0', $cnames = array()) {
535
  $dom = new DOMDocument('1.0', 'UTF-8');
536
 
537
  $dom->formatOutput = true;
@@ -572,7 +572,7 @@ class S3 {
572
  * @param object &$node DOMNode
573
  * @return array
574
  */
575
- private static function __parseCloudFrontDistributionConfig(&$node) {
576
  $dist = array();
577
 
578
  if (isset($node->Id)) {
@@ -626,7 +626,7 @@ class S3 {
626
  }
627
 
628
  if (isset($node->DistributionConfig)) {
629
- $dist = array_merge($dist, self::__parseCloudFrontDistributionConfig($node->DistributionConfig));
630
  }
631
 
632
  return $dist;
@@ -648,11 +648,11 @@ class S3 {
648
  '2010-11-01/distribution/' . $distributionId . '/invalidation',
649
  'cloudfront.amazonaws.com');
650
 
651
- $rest->data = self::__getCloudFrontInvalidationBath($paths);
652
  $rest->size = strlen($rest->data);
653
  $rest->setHeader('Content-Type', 'application/xml');
654
 
655
- $rest = self::__getCloudFrontResponse($rest);
656
 
657
  if ($rest->error === false && $rest->code !== 201) {
658
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
@@ -667,7 +667,7 @@ class S3 {
667
  ), E_USER_WARNING);
668
  return false;
669
  } elseif ($rest->body instanceof SimpleXMLElement) {
670
- return self::__parseCloudFrontInvalidation($rest->body);
671
  }
672
 
673
  return false;
@@ -681,7 +681,7 @@ class S3 {
681
  * @param array $files
682
  * @return string
683
  */
684
- private static function __getCloudFrontInvalidationBath($paths) {
685
  $dom = new DOMDocument('1.0', 'UTF-8');
686
  $dom->formatOutput = true;
687
 
@@ -705,7 +705,7 @@ class S3 {
705
  * @param DOMNode $node
706
  * @return array
707
  */
708
- private static function __parseCloudFrontInvalidation(&$node) {
709
  $invalidation = array();
710
 
711
  if (isset($node->Id)) {
@@ -739,7 +739,7 @@ class S3 {
739
  * @param object &$rest S3Request instance
740
  * @return object
741
  */
742
- private static function __getCloudFrontResponse(&$rest) {
743
  $rest->getResponse();
744
  if ($rest->response->error === false && isset($rest->response->body) &&
745
  is_string($rest->response->body) && substr($rest->response->body, 0, 5) == '<?xml') {
@@ -765,7 +765,7 @@ class S3 {
765
  * @param string &$file File path
766
  * @return string
767
  */
768
- public static function __getMimeType(&$file) {
769
  $type = Util_Mime::get_mime_type($file);
770
  return $type;
771
  }
@@ -778,8 +778,8 @@ class S3 {
778
  * @param string $string String to sign
779
  * @return string
780
  */
781
- public static function __getSignature($string) {
782
- return 'AWS '.self::$__accessKey.':'.self::__getHash($string);
783
  }
784
 
785
 
@@ -788,11 +788,11 @@ class S3 {
788
  *
789
  * This uses the hash extension if loaded
790
  *
791
- * @internal Used by __getSignature()
792
  * @param string $string String to sign
793
  * @return string
794
  */
795
- private static function __getHash($string) {
796
  return base64_encode(extension_loaded('hash') ?
797
  hash_hmac('sha1', $string, self::$__secretKey, true) : pack('H*', sha1(
798
  (str_pad(self::$__secretKey, 64, chr(0x00)) ^ (str_repeat(chr(0x5c), 64))) .
@@ -943,7 +943,7 @@ class S3Request {
943
  } else $amz = '';
944
 
945
  // Authorization string (CloudFront stringToSign should only contain a date)
946
- $headers[] = 'Authorization: ' . S3::__getSignature(
947
  $this->headers['Host'] == 'cloudfront.amazonaws.com' ? $this->headers['Date'] :
948
  $this->verb . "\n" .
949
  $this->headers['Content-MD5'] . "\n" .
@@ -956,8 +956,8 @@ class S3Request {
956
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
957
  curl_setopt($curl, CURLOPT_HEADER, false);
958
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
959
- curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '__responseWriteCallback'));
960
- curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '__responseHeaderCallback'));
961
  @curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
962
 
963
  // Request types
@@ -1031,7 +1031,7 @@ class S3Request {
1031
  * @param string &$data Data
1032
  * @return integer
1033
  */
1034
- private function __responseWriteCallback(&$curl, &$data) {
1035
  if ($this->response->code == 200 && $this->fp !== false)
1036
  return fwrite($this->fp, $data);
1037
  else
@@ -1047,7 +1047,7 @@ class S3Request {
1047
  * @param string &$data Data
1048
  * @return integer
1049
  */
1050
- private function __responseHeaderCallback(&$curl, &$data) {
1051
  if (($strlen = strlen($data)) <= 2) return $strlen;
1052
  if (substr($data, 0, 4) == 'HTTP')
1053
  $this->response->code = (int)substr($data, 9, 3);
231
  if (isset($requestHeaders['Content-Type']))
232
  $input['type'] =& $requestHeaders['Content-Type'];
233
  elseif (isset($input['file']))
234
+ $input['type'] = self::_getMimeType($input['file']);
235
  else
236
  $input['type'] = 'application/octet-stream';
237
  }
395
  self::$use_ssl = true; // CloudFront requires SSL
396
  $rest = new S3Request('POST', '', '2010-11-01/distribution',
397
  'cloudfront.amazonaws.com');
398
+ $rest->data = self::_getCloudFrontDistributionConfigXML($dnsName,
399
  $originType, $enabled, $comment, (string)microtime(true), $cnames);
400
  $rest->size = strlen($rest->data);
401
  $rest->setHeader('Content-Type', 'application/xml');
402
+ $rest = self::_getCloudFrontResponse($rest);
403
 
404
  if ($rest->error === false && $rest->code !== 201)
405
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
415
  ), E_USER_WARNING);
416
  return false;
417
  } elseif ($rest->body instanceof SimpleXMLElement)
418
+ return self::_parseCloudFrontDistributionConfig($rest->body);
419
  return false;
420
  }
421
 
430
  $rest = new S3Request('GET', '',
431
  '2010-11-01/distribution/' . $distributionId,
432
  'cloudfront.amazonaws.com');
433
+ $rest = self::_getCloudFrontResponse($rest);
434
 
435
  if ($rest->error === false && $rest->code !== 200)
436
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
442
  ), E_USER_WARNING);
443
  return false;
444
  } elseif ($rest->body instanceof SimpleXMLElement) {
445
+ $dist = self::_parseCloudFrontDistributionConfig($rest->body);
446
  $dist['hash'] = $rest->headers['hash'];
447
  return $dist;
448
  }
461
  $rest = new S3Request('PUT', '',
462
  '2010-11-01/distribution/' . $dist['id'] . '/config',
463
  'cloudfront.amazonaws.com');
464
+ $rest->data = self::_getCloudFrontDistributionConfigXML($dist['origin'], $dist['type'], $dist['enabled'], $dist['comment'], $dist['callerReference'], $dist['cnames']);
465
  $rest->size = strlen($rest->data);
466
  $rest->setHeader('If-Match', $dist['hash']);
467
+ $rest = self::_getCloudFrontResponse($rest);
468
 
469
  if ($rest->error === false && $rest->code !== 200)
470
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
476
  ), E_USER_WARNING);
477
  return false;
478
  } else {
479
+ $dist = self::_parseCloudFrontDistributionConfig($rest->body);
480
  $dist['hash'] = $rest->headers['hash'];
481
  return $dist;
482
  }
493
  self::$use_ssl = true; // CloudFront requires SSL
494
  $rest = new S3Request('GET', '', '2010-11-01/distribution',
495
  'cloudfront.amazonaws.com');
496
+ $rest = self::_getCloudFrontResponse($rest);
497
 
498
  if ($rest->error === false && $rest->code !== 200)
499
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
511
  //$info['isTruncated'] = (string)$rest->body->IsTruncated == 'true' ? true : false;
512
  }
513
  foreach ($rest->body->DistributionSummary as $summary) {
514
+ $list[(string)$summary->Id] = self::_parseCloudFrontDistributionConfig($summary);
515
  }
516
  return $list;
517
  }
531
  * @param array $cnames Array of CNAME aliases
532
  * @return string
533
  */
534
+ private static function _getCloudFrontDistributionConfigXML($dnsName, $originType, $enabled, $comment, $callerReference = '0', $cnames = array()) {
535
  $dom = new DOMDocument('1.0', 'UTF-8');
536
 
537
  $dom->formatOutput = true;
572
  * @param object &$node DOMNode
573
  * @return array
574
  */
575
+ private static function _parseCloudFrontDistributionConfig(&$node) {
576
  $dist = array();
577
 
578
  if (isset($node->Id)) {
626
  }
627
 
628
  if (isset($node->DistributionConfig)) {
629
+ $dist = array_merge($dist, self::_parseCloudFrontDistributionConfig($node->DistributionConfig));
630
  }
631
 
632
  return $dist;
648
  '2010-11-01/distribution/' . $distributionId . '/invalidation',
649
  'cloudfront.amazonaws.com');
650
 
651
+ $rest->data = self::_getCloudFrontInvalidationBath($paths);
652
  $rest->size = strlen($rest->data);
653
  $rest->setHeader('Content-Type', 'application/xml');
654
 
655
+ $rest = self::_getCloudFrontResponse($rest);
656
 
657
  if ($rest->error === false && $rest->code !== 201) {
658
  $rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
667
  ), E_USER_WARNING);
668
  return false;
669
  } elseif ($rest->body instanceof SimpleXMLElement) {
670
+ return self::_parseCloudFrontInvalidation($rest->body);
671
  }
672
 
673
  return false;
681
  * @param array $files
682
  * @return string
683
  */
684
+ private static function _getCloudFrontInvalidationBath($paths) {
685
  $dom = new DOMDocument('1.0', 'UTF-8');
686
  $dom->formatOutput = true;
687
 
705
  * @param DOMNode $node
706
  * @return array
707
  */
708
+ private static function _parseCloudFrontInvalidation(&$node) {
709
  $invalidation = array();
710
 
711
  if (isset($node->Id)) {
739
  * @param object &$rest S3Request instance
740
  * @return object
741
  */
742
+ private static function _getCloudFrontResponse(&$rest) {
743
  $rest->getResponse();
744
  if ($rest->response->error === false && isset($rest->response->body) &&
745
  is_string($rest->response->body) && substr($rest->response->body, 0, 5) == '<?xml') {
765
  * @param string &$file File path
766
  * @return string
767
  */
768
+ public static function _getMimeType(&$file) {
769
  $type = Util_Mime::get_mime_type($file);
770
  return $type;
771
  }
778
  * @param string $string String to sign
779
  * @return string
780
  */
781
+ public static function _getSignature($string) {
782
+ return 'AWS '.self::$__accessKey.':'.self::_getHash($string);
783
  }
784
 
785
 
788
  *
789
  * This uses the hash extension if loaded
790
  *
791
+ * @internal Used by _getSignature()
792
  * @param string $string String to sign
793
  * @return string
794
  */
795
+ private static function _getHash($string) {
796
  return base64_encode(extension_loaded('hash') ?
797
  hash_hmac('sha1', $string, self::$__secretKey, true) : pack('H*', sha1(
798
  (str_pad(self::$__secretKey, 64, chr(0x00)) ^ (str_repeat(chr(0x5c), 64))) .
943
  } else $amz = '';
944
 
945
  // Authorization string (CloudFront stringToSign should only contain a date)
946
+ $headers[] = 'Authorization: ' . S3::_getSignature(
947
  $this->headers['Host'] == 'cloudfront.amazonaws.com' ? $this->headers['Date'] :
948
  $this->verb . "\n" .
949
  $this->headers['Content-MD5'] . "\n" .
956
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
957
  curl_setopt($curl, CURLOPT_HEADER, false);
958
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, false);
959
+ curl_setopt($curl, CURLOPT_WRITEFUNCTION, array(&$this, '_responseWriteCallback'));
960
+ curl_setopt($curl, CURLOPT_HEADERFUNCTION, array(&$this, '_responseHeaderCallback'));
961
  @curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
962
 
963
  // Request types
1031
  * @param string &$data Data
1032
  * @return integer
1033
  */
1034
+ private function _responseWriteCallback(&$curl, &$data) {
1035
  if ($this->response->code == 200 && $this->fp !== false)
1036
  return fwrite($this->fp, $data);
1037
  else
1047
  * @param string &$data Data
1048
  * @return integer
1049
  */
1050
+ private function _responseHeaderCallback(&$curl, &$data) {
1051
  if (($strlen = strlen($data)) <= 2) return $strlen;
1052
  if (substr($data, 0, 4) == 'HTTP')
1053
  $this->response->code = (int)substr($data, 9, 3);
lib/SNS/sdk.class.php CHANGED
@@ -50,7 +50,7 @@ class CFRuntime_Exception extends Exception {}
50
  so that forward-looking plans for the code can be made with more certainty (e.g. What
51
  version of PHP are most people running? Do they tend to have the latest PCRE?).
52
  */
53
- function __aws_sdk_ua_callback()
54
  {
55
  $ua_append = '';
56
  $extensions = get_loaded_extensions();
@@ -128,7 +128,7 @@ define('CFRUNTIME_NAME', 'aws-sdk-php');
128
  define('CFRUNTIME_VERSION', '1.4.3');
129
  // define('CFRUNTIME_BUILD', gmdate('YmdHis', filemtime(__FILE__))); // @todo: Hardcode for release.
130
  define('CFRUNTIME_BUILD', '20110930191027');
131
- define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());
132
 
133
 
134
  /*%******************************************************************************************%*/
50
  so that forward-looking plans for the code can be made with more certainty (e.g. What
51
  version of PHP are most people running? Do they tend to have the latest PCRE?).
52
  */
53
+ function w3tc_aws_sdk_ua_callback()
54
  {
55
  $ua_append = '';
56
  $extensions = get_loaded_extensions();
128
  define('CFRUNTIME_VERSION', '1.4.3');
129
  // define('CFRUNTIME_BUILD', gmdate('YmdHis', filemtime(__FILE__))); // @todo: Hardcode for release.
130
  define('CFRUNTIME_BUILD', '20110930191027');
131
+ define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . w3tc_aws_sdk_ua_callback());
132
 
133
 
134
  /*%******************************************************************************************%*/
pub/css/lightbox.css CHANGED
@@ -105,9 +105,6 @@ th.minify-files-add, td.minify-files-add {
105
  .w3tc-overlay .content {
106
  padding: 10px 10px 10px 10px;
107
  }
108
- .w3tc-overlay .footer {
109
- padding: 0 10px 10px 10px;
110
- }
111
  .w3tc-overlay p, .w3tc-overlay label, .w3tc-overlay input, .w3tc-overlay option {
112
  font-family:Arial, Verdana,sans-serif;
113
  color:#88898a;
@@ -216,7 +213,7 @@ fieldset[disabled] .btn {
216
  height:32px;
217
  width:250px;
218
  margin:0;
219
- padding:0px 5px 0 5px;
220
  font-weight: normal;
221
  border: 2px solid #bdc3c7;
222
  color: #34495e;
@@ -339,43 +336,12 @@ fieldset[disabled] .btn {
339
  margin-right: 20px;
340
  }
341
  .w3tc-overlay #w3tc-upgrade li {
342
- background: url(../img/overlay/list-check.png) no-repeat 0 3px;
343
  color: #444;
344
  list-style-type: none;
345
  padding: 0 0 1px 20px;
346
  }
347
 
348
- .w3tc-overlay #w3tc-upgrade header {
349
- height:265px;
350
- padding: 10px 10px 10px 10px;
351
- }
352
- .w3tc-overlay #w3tc-upgrade header img {
353
- margin-right:20px;
354
- }
355
- .w3tc-overlay #w3tc-upgrade header .description {
356
- clear: both;
357
- }
358
- .w3tc-overlay #w3tc-upgrade img {
359
- float:left;
360
- }
361
-
362
- .w3tc-overlay #w3tc-upgrade .left h2{
363
- font-weight: bold;
364
- font-size: 1.4em;
365
- }
366
-
367
- .w3tc-overlay #w3tc-upgrade .right h2{
368
- font-weight: bold;
369
- font-size: 2.0em;
370
- }
371
- .w3tc-overlay #w3tc-upgrade .right h2 span{
372
- font-weight: normal;
373
- }
374
-
375
- #w3tc-upgrade .footer {
376
- clear:both;
377
- }
378
-
379
  .w3tc-overlay #w3tc-support-us header h2, header h3 {
380
  margin:0;padding:0;
381
  }
@@ -443,4 +409,60 @@ padding: 10px 20px 20px 20px;
443
  font-family: Arial, Verdana,sans-serif;
444
  color: #88898a;
445
  font-size: 13px;
446
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  .w3tc-overlay .content {
106
  padding: 10px 10px 10px 10px;
107
  }
 
 
 
108
  .w3tc-overlay p, .w3tc-overlay label, .w3tc-overlay input, .w3tc-overlay option {
109
  font-family:Arial, Verdana,sans-serif;
110
  color:#88898a;
213
  height:32px;
214
  width:250px;
215
  margin:0;
216
+ padding:0px 5px 0px 5px;
217
  font-weight: normal;
218
  border: 2px solid #bdc3c7;
219
  color: #34495e;
336
  margin-right: 20px;
337
  }
338
  .w3tc-overlay #w3tc-upgrade li {
339
+ background: url(../img/overlay/list-check.png) no-repeat 0px 3px;
340
  color: #444;
341
  list-style-type: none;
342
  padding: 0 0 1px 20px;
343
  }
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  .w3tc-overlay #w3tc-support-us header h2, header h3 {
346
  margin:0;padding:0;
347
  }
409
  font-family: Arial, Verdana,sans-serif;
410
  color: #88898a;
411
  font-size: 13px;
412
+ }
413
+
414
+
415
+ /* isolated styles */
416
+ .w3tc_overlay_footer {
417
+ padding: 0 10px 10px 10px;
418
+ clear:both;
419
+ }
420
+
421
+ .w3tc_overlay_content {
422
+ padding: 10px 10px 10px 10px;
423
+ }
424
+ .w3tc_overlay_upgrade_header {
425
+ padding: 10px 10px 10px 10px;
426
+ background-color: #f3f3f3;
427
+ color: #cacaca;
428
+ border-bottom: dashed 1px #c0c0c0;
429
+ border-top-left-radius: 6px;
430
+ border-top-right-radius: 6px;
431
+ -webkit-border-top-left-radius: 6px;
432
+ -webkit-border-top-right-radius: 6px;
433
+ }
434
+
435
+ .w3tc_overlay_upgrade_content_l {
436
+ width: 290px;
437
+ float:left;
438
+ }
439
+ .w3tc_overlay_upgrade_content_r {
440
+ width: calc(100% - 310px);
441
+ padding-left: 20px;
442
+ float: left;
443
+ }
444
+
445
+ .w3tc_overlay_upgrade_description {
446
+ clear: both;
447
+ }
448
+
449
+ .w3tc_overlay_upgrade_left_h {
450
+ font-weight: bold;
451
+ font-size: 1.4em;
452
+ float: left;
453
+ margin: 1em 0;
454
+ color: #23282d;
455
+ line-height: 29px;
456
+ }
457
+
458
+ .w3tc_overlay_upgrade_right_h {
459
+ font-weight: bold;
460
+ float: right;
461
+ margin: 1em 0;
462
+ color: #23282d;
463
+ font-size: 2.0em;
464
+ }
465
+
466
+ .w3tc_overlay_upgrade_right_text {
467
+ font-weight: normal;
468
+ }
pub/css/options.css CHANGED
@@ -104,12 +104,6 @@ input.w3tc-error, textarea.w3tc-error {
104
  text-indent: 20px;
105
  }
106
 
107
- #w3tc h2 span {
108
- font-size: 0.6em;
109
- font-style: normal;
110
- text-shadow: none;
111
- }
112
-
113
  #w3tc h5 {
114
  margin: 0
115
  }
@@ -438,4 +432,14 @@ td.w3tc_config_value_text {
438
 
439
  .w3tc_popup_form {
440
  padding: 20px;
441
- }
 
 
 
 
 
 
 
 
 
 
104
  text-indent: 20px;
105
  }
106
 
 
 
 
 
 
 
107
  #w3tc h5 {
108
  margin: 0
109
  }
432
 
433
  .w3tc_popup_form {
434
  padding: 20px;
435
+ }
436
+
437
+
438
+ /*---*/
439
+ /* js bound to id */
440
+
441
+ th.w3tc_extensions_manage_column_check {
442
+ padding: 0 0 0 5px;
443
+ vertical-align: middle;
444
+ width: 2.2em;
445
+ }
pub/css/widget.css CHANGED
@@ -27,21 +27,18 @@
27
  margin-right:10px;
28
  }
29
 
30
- #w3tc_services label {
31
  font-weight: bold;
32
  margin-left: 10px;
33
  display: inline-block;
34
  width: 270px;
35
  }
36
 
37
- #w3tc_services label span {
38
- font-weight: normal;
39
- }
40
-
41
- #w3tc_services input.w3tc-service {
42
  float: left;
43
- line-height: 40px;
44
  }
 
45
  #w3tc_spreadtheword .inside {
46
  margin-right: 30px;
47
  }
27
  margin-right:10px;
28
  }
29
 
30
+ .w3tc_generic_widgetservice_label {
31
  font-weight: bold;
32
  margin-left: 10px;
33
  display: inline-block;
34
  width: 270px;
35
  }
36
 
37
+ .w3tc_generic_widgetservice_radio_outer {
 
 
 
 
38
  float: left;
39
+ margin-top: 1px;
40
  }
41
+
42
  #w3tc_spreadtheword .inside {
43
  margin-right: 30px;
44
  }
pub/js/lightbox.js CHANGED
@@ -378,13 +378,15 @@ function w3tc_lightbox_upgrade(nonce) {
378
  height: 350,
379
  url: 'admin.php?page=w3tc_dashboard&w3tc_licensing_upgrade&_wpnonce=' + nonce,
380
  callback: function(lightbox) {
381
- jQuery('.button-primary', lightbox.container).click(function() {
382
- lightbox.close();
383
- });
384
- jQuery('#w3tc-purchase', lightbox.container).click(function() {
385
- lightbox.close();
386
- w3tc_lightbox_buy_plugin(nonce);
387
- });
 
 
388
  }
389
  });
390
  }
378
  height: 350,
379
  url: 'admin.php?page=w3tc_dashboard&w3tc_licensing_upgrade&_wpnonce=' + nonce,
380
  callback: function(lightbox) {
381
+ lightbox.options.height = jQuery('#w3tc-upgrade').height() - 57;
382
+ jQuery('.button-primary', lightbox.container).click(function() {
383
+ lightbox.close();
384
+ });
385
+ jQuery('#w3tc-purchase', lightbox.container).click(function() {
386
+ lightbox.close();
387
+ w3tc_lightbox_buy_plugin(nonce);
388
+ });
389
+ lightbox.resize();
390
  }
391
  });
392
  }
pub/js/options.js CHANGED
@@ -1615,6 +1615,16 @@ jQuery(function() {
1615
  });
1616
  });
1617
 
 
 
 
 
 
 
 
 
 
 
1618
 
1619
  // google analytics events
1620
  if (typeof ga != 'undefined') {
1615
  });
1616
  });
1617
 
1618
+ // extensions page
1619
+ jQuery('.w3tc_extensions_manage_input_checkall').click(function(v) {
1620
+ var c = jQuery(this).is(':checked');
1621
+
1622
+ jQuery('.w3tc_extensions_manage_input_checkall').prop('checked', c);
1623
+ jQuery('.w3tc_extensions_input_active').each(function(index) {
1624
+ if (!jQuery(this).is(':disabled'))
1625
+ jQuery(this).prop('checked', c);
1626
+ });
1627
+ });
1628
 
1629
  // google analytics events
1630
  if (typeof ga != 'undefined') {
pub/js/widget.js CHANGED
@@ -33,27 +33,12 @@ jQuery(function() {
33
  }, 500);
34
  }
35
 
36
- jQuery('.w3tc-service').click(function () {
37
- var request_type = jQuery(this);
38
- var type = request_type.val();
39
- var service = jQuery('#buy-w3-service');
40
- service.attr("disabled", "disabled");
41
- jQuery.getJSON(ajaxurl +'?action=w3tc_action_payment_code&request_type=' + type + '&_wpnonce=' + request_type.metadata().nonce,
42
- function(data) {
43
- var area = jQuery('#buy-w3-service-area');
44
- area.empty();
45
- jQuery.each(data, function (key, val) {
46
- jQuery('<input>').attr({
47
- type: 'hidden',
48
- id: key,
49
- name: key,
50
- value: val.replace(/&amp;/g, '&')
51
- }).appendTo('#buy-w3-service-area');
52
- })
53
- }
54
- );
55
- service.removeAttr("disabled");
56
 
 
 
 
57
  });
58
 
59
  jQuery('#buy-w3-service-cancel').live('click', function() {
@@ -61,9 +46,5 @@ jQuery(function() {
61
  jQuery('#buy-w3-service-area').empty();
62
  jQuery('#buy-w3-service').attr("disabled", "disabled");
63
  });
64
-
65
- jQuery('#buy-w3-service').live('click', function() {
66
- alert('Do not forget to fill out the support form after purchasing.');
67
- });
68
  });
69
  });
33
  }, 500);
34
  }
35
 
36
+ jQuery('.w3tc_generic_widgetservice_radio').click(function () {
37
+ var o = jQuery(this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
+ jQuery('#w3tc_generic_widgetservices_name').val(o.attr('data-name'));
40
+ jQuery('#w3tc_generic_widgetservices_value').val(o.attr('data-value'));
41
+ jQuery('#w3tc_generic_widgetservices_form_hash').val(o.attr('data-form_hash'));
42
  });
43
 
44
  jQuery('#buy-w3-service-cancel').live('click', function() {
46
  jQuery('#buy-w3-service-area').empty();
47
  jQuery('#buy-w3-service').attr("disabled", "disabled");
48
  });
 
 
 
 
49
  });
50
  });
pub/opcache.php CHANGED
@@ -18,7 +18,7 @@ if ( !defined( 'W3TC_DIR' ) ) {
18
 
19
  if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
20
  @header( 'X-Robots-Tag: noarchive, noodp, nosnippet' );
21
- echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', dirname( __FILE__ ) );
22
  }
23
 
24
 
18
 
19
  if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
20
  @header( 'X-Robots-Tag: noarchive, noodp, nosnippet' );
21
+ echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.<br />', dirname( __FILE__ ) );
22
  }
23
 
24
 
pub/sns.php CHANGED
@@ -48,7 +48,7 @@ if ( !defined( 'W3TC_DIR' ) ) {
48
 
49
  if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
50
  @header( 'X-Robots-Tag: noarchive, noodp, nosnippet' );
51
- echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', dirname( __FILE__ ) );
52
  }
53
 
54
  require_once W3TC_DIR . '/w3-total-cache-api.php';
48
 
49
  if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
50
  @header( 'X-Robots-Tag: noarchive, noodp, nosnippet' );
51
+ echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>. <br />', dirname( __FILE__ ) );
52
  }
53
 
54
  require_once W3TC_DIR . '/w3-total-cache-api.php';
readme.txt CHANGED
@@ -1,47 +1,51 @@
1
  === Plugin Name ===
2
  Contributors: fredericktownes
3
- Tags: w3totalcache, w3 totalcache, w3total cache, wpo, web performance optimization, performance, availability, scaling, scalability, user experience, cache, caching, page cache, css cache, js cache, db cache, disk cache, disk caching, database cache, http compression, gzip, deflate, minify, cdn, content delivery network, media library, performance, speed, multiple hosts, css, merge, combine, unobtrusive javascript, compress, optimize, optimizer, javascript, js, cascading style sheet, plugin, yslow, yui, yui compressor, zend, opcache, apcu, google drive, highwinds, full site delivery, full site acceleration, google, google rank, google page speed, mod_pagespeed, new relic, newrelic, aws, s3, cloudfront, sns, elasticache, rds, flash media server, amazon web services, cloud files, rackspace, akamai, max cdn, limelight, cloudflare, mod_cloudflare, microsoft, microsoft azure, iis, nginx, litespeed, apache, varnish, xcache, apc, eacclerator, wincache, redis, narcissus, wpmml, mysql, w3 total cache, batcache, wp cache, wp super cache, quick cache, wp minify, bwp-minify, buddypress
4
  Requires at least: 3.2
5
  Tested up to: 4.6.1
6
- Stable tag: 0.9.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Easy Web Performance Optimization (WPO) using caching: browser, page, object, database, minify and content delivery network support.
11
 
12
  == Description ==
13
 
14
- W3 Total Cache improves the user experience of your site by increasing server performance, reducing download times and providing robust content delivery network (CDN) integration.
15
 
16
- The **only** WordPress Performance Optimization (WPO) framework; designed to improve user experience and page speed. Recommended by countless web hosts.
17
 
18
- Trusted by countless companies like: AT&T, stevesouders.com, mattcutts.com, mashable.com, smashingmagazine.com, makeuseof.com, kiss925.com, pearsonified.com, lockergnome.com, johnchow.com, ilovetypography.com, webdesignerdepot.com, css-tricks.com and tens of thousands of others.
19
 
20
  An inside look:
21
 
22
  http://www.youtube.com/watch?v=rkmrQP8S5KY
23
 
24
- Benefits:
25
 
26
- * At least 10x improvement in overall site performance (Grade A in [YSlow](http://developer.yahoo.com/yslow/) or significant [Google Page Speed](http://code.google.com/speed/page-speed/) improvements) **when fully configured**
 
27
  * Improved conversion rates and "[site performance](http://googlewebmastercentral.blogspot.com/2009/12/your-sites-performance-in-webmaster.html)" which [affect your site's rank](http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html) on Google.com
28
- * "Instant" subsequent page views: browser caching
29
- * Optimized progressive render: pages start rendering quickly
30
  * Reduced page load time: increased visitor time on site; visitors view more pages
31
  * Improved web server performance; sustain high traffic periods
32
  * Up to 80% bandwidth savings via minify and HTTP compression of HTML, CSS, JavaScript and feeds
33
 
34
- Features:
35
 
36
  * Compatible with shared hosting, virtual private / dedicated servers and dedicated servers / clusters
37
  * Transparent content delivery network (CDN) management with Media Library, theme files and WordPress itself
38
  * Mobile support: respective caching of pages by referrer or groups of user agents including theme switching for groups of referrers or user agents
39
- * Caching of (minified and compressed) pages and posts in memory or on disk or on CDN (mirror only)
 
 
40
  * Caching of (minified and compressed) CSS and JavaScript in memory, on disk or on CDN
41
- * Caching of feeds (site, categories, tags, comments, search results) in memory or on disk or on CDN (mirror only)
42
  * Caching of search results pages (i.e. URIs with query string variables) in memory or on disk
43
  * Caching of database objects in memory or on disk
44
  * Caching of objects in memory or on disk
 
45
  * Minification of posts and pages and feeds
46
  * Minification of inline, embedded or 3rd party JavaScript (with automated updates)
47
  * Minification of inline, embedded or 3rd party CSS (with automated updates)
@@ -50,6 +54,10 @@ Features:
50
  * Non-blocking JavaScript embedding
51
  * Import post attachments directly into the Media Library (and CDN)
52
  * WP-CLI support for cache purging, query string updating and more
 
 
 
 
53
 
54
  Improve the user experience for your readers without having to change WordPress, your theme, your plugins or how you produce your content.
55
 
@@ -57,6 +65,8 @@ Improve the user experience for your readers without having to change WordPress,
57
 
58
  = Why does speed matter? =
59
 
 
 
60
  Speed is among the most significant success factors web sites face. In fact, your site's speed directly affects your income (revenue) &mdash; it's a fact. Some high traffic sites conducted research and uncovered the following:
61
 
62
  * Google.com: **+500 ms** (speed decrease) -> **-20% traffic loss** [[1](http://home.blarg.net/~glinden/StanfordDataMining.2006-11-29.ppt)]
@@ -65,8 +75,6 @@ Speed is among the most significant success factors web sites face. In fact, you
65
 
66
  A thousandth of a second is not a long time, yet the impact is quite significant. Even if you're not a large company (or just hope to become one), a loss is still a loss. However, there is a solution to this problem, take advantage.
67
 
68
- Search engines like Google, measure and factor in the speed of web sites in their ranking algorithm. When they recommend a site they want to make sure users find what they're looking for quickly. So in effect you and Google should have the same objective.
69
-
70
  Many of the other consequences of poor performance were discovered more than a decade ago:
71
 
72
  * Lower perceived credibility (Fogg et al. 2001)
@@ -81,7 +89,7 @@ Many of the other consequences of poor performance were discovered more than a d
81
 
82
  There are a number of [resources](http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/) that have been documenting the role of performance in success on the web, W3 Total Cache exists to give you a framework to tune your application or site without having to do years of research.
83
 
84
- = Why is W3 Total Cache better than other cache plugins? =
85
 
86
  **It's a complete framework.** Most cache plugins available do a great job at achieving a couple of performance aims. Our plugin remedies numerous performance reducing aspects of any web site going far beyond merely reducing CPU usage (load) and bandwidth consumption for HTML pages alone. Equally important, the plugin requires no theme modifications, modifications to your .htaccess (mod_rewrite rules) or programming compromises to get started. Most importantly, it's the only plugin designed to optimize all practical hosting environments small or large. The options are many and setup is easy.
87
 
@@ -93,7 +101,7 @@ It's in every web site owner's best interest is to make sure that the performanc
93
 
94
  = Which WordPress versions are supported? =
95
 
96
- To use all features in the suite, a minimum of version WordPress 2.8 with PHP 5 is required. Earlier versions will benefit from our Media Library Importer to get them back on the upgrade path and into a CDN of their choosing.
97
 
98
  = Why doesn't minify work for me? =
99
 
@@ -138,7 +146,7 @@ Yes, indirectly - if you have a lot of bloggers working with you, you will find
138
 
139
  = Which web servers do you support? =
140
 
141
- We are aware of no incompatibilities with [apache](http://httpd.apache.org/) 1.3+, [nginx](https://www.nginx.com/solutions/web-server/) 0.7+, [IIS](http://www.iis.net/) 5+ or [litespeed](https://www.litespeedtech.com/products/litespeed-web-server/overview) 4.0.2+. If there's a web server you feel we should be actively testing (e.g. [lighttpd]https://www.lighttpd.net/)), we're [interested in hearing](https://www.w3-edge.com/contact/).
142
 
143
  = Is this plugin server cluster and load balancer friendly? =
144
 
@@ -160,10 +168,6 @@ Use the "Help" button available on the Minify settings tab. Once open, the tool
160
 
161
  Technically no, a CDN is a high performance cache that stores static assets (your theme files, media library etc) in various locations throughout the world in order to provide low latency access to them by readers in those regions.
162
 
163
- = What if I don't want to work with a CDN right now, is there any other use for this feature? =
164
-
165
- Yes! You can take advantage of the [pipelining](http://www.mozilla.org/projects/netlib/http/pipelining-faq.html) support in some browsers by creating a sub-domain for the static content for your site. So you could select the "Origin Push / Self-hosted" method of the General Settings tab. Create static.domain.com on your server (and update your DNS zone) and then specify the FTP details for it in the plugin configuration panel and you're done. If you disable the scripting options on your server you'll find that your server will actually respond slightly faster from that sub-domain because it's just sending files and not processing them.
166
-
167
  = How do I use an Origin Pull (Mirror) CDN? =
168
  Login to your CDN providers control panel or account management area. Following any set up steps they provide, create a new "pull zone" or "bucket" for your site's domain name. If there's a set up wizard or any troubleshooting tips your provider offers, be sure to review them. In the CDN tab of the plugin, enter the hostname your CDN provider provided in the "replace site's hostname with" field. You should always do a quick check by opening a test file from the CDN hostname, e.g. http://cdn.domain.com/favicon.ico. Troubleshoot with your CDN provider until this test is successful.
169
 
@@ -189,17 +193,6 @@ You may optionally, specify up to 10 hostnames to use rather than the default ho
189
 
190
  Now go to the General tab and click the "Enable" checkbox and save the settings to enable CDN functionality and empty the cache for the changes to take effect. If preview mode is active you will need to "deploy" your changes for them to take effect.
191
 
192
- = My YSlow score is low because it doesn't recognize my CDN, what can I do? =
193
-
194
- Rule 2 says to use a content delivery network (CDN). The score for this rule is computed by checking the hostname of each component against the list of known CDNs. Unfortunately, the list of "known CDNs" are the ones used by Yahoo!. Most likely these are not relevant to your web site, except for potentially yui.yahooapis.com. If you want an accurate score for your web site, you can add your CDN hostnames to YSlow using Firefox's preferences. Here are the steps to follow:
195
-
196
- * Go to about:config in Firefox. You'll see the current list of preferences.
197
- * Right-click in the window and choose New and String to create a new string preference.
198
- * Enter extensions.yslow.cdnHostnames for the preference name.
199
- * For the string value, enter the hostname of your CDN, for example, mycdn.com. Do not use quotes. If you have multiple CDN hostnames, separate them with commas.
200
-
201
- If you specify CDN hostnames in your preferences, they'll be shown under the details for Rule 2 in the Performance view.
202
-
203
  = What is the purpose of the "modify attachment URLs" button? =
204
 
205
  If the domain name of your site has changed, this tool is useful in updating your posts and pages to use the current addresses. For example, if your site used to be www.domain.com, and you decided to change it to domain.com, the result would either be many "broken" images or many unnecessary redirects (which slow down the visitor's browsing experience). You can use this tool to correct this and similar cases. Correcting the URLs of your images also allows the plugin to do a better job of determining which images are actually hosted with the CDN.
@@ -259,7 +252,7 @@ Install the plugin to read the full FAQ on the plugins FAQ tab.
259
  1. Login as an administrator to your WordPress Admin account. Using the "Add New" menu option under the "Plugins" section of the navigation, you can either search for: w3 total cache or if you've downloaded the plugin already, click the "Upload" link, find the .zip file you download and then click "Install Now". Or you can unzip and FTP upload the plugin to your plugins directory (wp-content/plugins/). In either case, when done wp-content/plugins/w3-total-cache/ should exist.
260
  1. Locate and activate the plugin on the "Plugins" page. Page caching will **automatically be running** in basic mode. Set the permissions of wp-content and wp-content/uploads back to 755, e.g. in the terminal: `# chmod 755 /var/www/vhosts/domain.com/httpdocs/wp-content/`.
261
  1. Now click the "Settings" link to proceed to the "General Settings" tab; in most cases, "disk enhanced" mode for page cache is a "good" starting point.
262
- 1. The "Compatibility Mode" option found in the advanced section of the "Page Cache Settings" tab will enable functionality that optimizes the interoperablity of caching with WordPress, is disabled by default, but highly recommended. Years of testing in hundreds of thousands of installations have helped us learn how to make caching behave well with WordPress. The tradeoff is that disk enhanced page cache performance under load tests will be decreased by ~20% at scale.
263
  1. *Recommended:* On the "Minify Settings" tab, all of the recommended settings are preset. If auto mode causes issues with your web site's layout, switch to manual mode and use the help button to simplify discovery of your CSS and JS files and groups. Pay close attention to the method and location of your JS group embeddings. See the plugin's FAQ for more information on usage.
264
  1. *Recommended:* On the "Browser Cache" tab, HTTP compression is enabled by default. Make sure to enable other options to suit your goals.
265
  1. *Recommended:* If you already have a content delivery network (CDN) provider, proceed to the "Content Delivery Network" tab and populate the fields and set your preferences. If you do not use the Media Library, you will need to import your images etc into the default locations. Use the Media Library Import Tool on the "Content Delivery Network" tab to perform this task. If you do not have a CDN provider, you can still improve your site's performance using the "Self-hosted" method. On your own server, create a subdomain and matching DNS Zone record; e.g. static.domain.com and configure FTP options on the "Content Delivery Network" tab accordingly. Be sure to FTP upload the appropriate files, using the available upload buttons.
@@ -778,6 +771,17 @@ Please reach out to all of these people and support their projects if you're so
778
 
779
  == Changelog ==
780
 
 
 
 
 
 
 
 
 
 
 
 
781
  = 0.9.5 =
782
  * Fixed XSS vulnerability
783
  * Fixed issues with dismissing overlays
@@ -808,20 +812,21 @@ Please reach out to all of these people and support their projects if you're so
808
  * Added more support for exclusions to database cache
809
  * Added more optionality to minifiers
810
  * Added WPML Performance Extension
 
811
  * Improved PHP 5.6 compatibility
812
  * Improved PHP 7 compatibility
813
  * Improved performance menu in admin bar, including purging of specific cache engines and more
814
- * Improved SSL inter-operability
815
  * Improved reliablity of test buttons
816
  * Improved nomenclature of caching files for higher cache hit rates
817
  * Improved nginx compatibility
818
  * Improved WP CLI support
819
- * Improved Cloudflare compatibility (now using latest APIs)
820
  * Improved AWS API compatibility (now using latest APIs)
821
  * Improved Rackspace Cloud Files compatibility (now using latest APIs)
822
  * Improved page cache purge for extensions like cloudflare and other reverse proxy use cases
823
  * Improved extension framework functionality
824
- * Improved compatibility of headers like eTag and content encoding
825
  * Improved template fragment caching
826
  * Improved notifications, warnings and errors
827
  * Improved moble user agents detection
1
  === Plugin Name ===
2
  Contributors: fredericktownes
3
+ Tags: seo, w3totalcache, w3 totalcache, w3total cache, wpo, web performance optimization, performance, availability, scaling, scalability, user experience, cache, caching, page cache, css cache, js cache, db cache, disk cache, disk caching, database cache, http compression, gzip, deflate, minify, cdn, content delivery network, media library, performance, speed, multiple hosts, css, merge, combine, unobtrusive javascript, compress, optimize, optimizer, javascript, js, cascading style sheet, plugin, yui, yui compressor, zend, opcache, apcu, google drive, highwinds, full site delivery, full site acceleration, google, google rank, google page speed, mod_pagespeed, new relic, newrelic, aws, s3, cloudfront, sns, elasticache, rds, flash media server, amazon web services, cloud files, rackspace, akamai, max cdn, limelight, cloudflare, mod_cloudflare, microsoft, microsoft azure, iis, nginx, litespeed, apache, varnish, xcache, apc, eacclerator, wincache, redis, narcissus, wpmml, mysql, w3 total cache, batcache, wp cache, wp super cache, quick cache, wp minify, bwp-minify, buddypress
4
  Requires at least: 3.2
5
  Tested up to: 4.6.1
6
+ Stable tag: 0.9.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ Search Engine (SEO) &amp; Performance Optimization (WPO) via caching. Integrated caching: CDN, Minify, Page, Object, Fragment, Database support.
11
 
12
  == Description ==
13
 
14
+ W3 Total Cache improves the user experience of your site by increasing website performance, reducing download times via features like content delivery network (CDN) integration.
15
 
16
+ The **only** WordPress Performance Optimization (WPO) framework; designed to improve user experience and Search Engine Optimization (SEO). Recommended by countless web hosts.
17
 
18
+ Trusted by numerous companies like: AT&T, stevesouders.com, mattcutts.com, mashable.com, smashingmagazine.com, makeuseof.com, kiss925.com, pearsonified.com, lockergnome.com, johnchow.com, ilovetypography.com, webdesignerdepot.com, css-tricks.com and tens of thousands of others.
19
 
20
  An inside look:
21
 
22
  http://www.youtube.com/watch?v=rkmrQP8S5KY
23
 
24
+ *BENEFITS*
25
 
26
+ * Improvements in search engine result page rankings, especially for mobile-friendly websites and sites that use SSL
27
+ * At least 10x improvement in overall site performance (Grade A in [WebPagetest](https://www.webpagetest.org/) or significant [Google Page Speed](http://code.google.com/speed/page-speed/) improvements) **when fully configured**
28
  * Improved conversion rates and "[site performance](http://googlewebmastercentral.blogspot.com/2009/12/your-sites-performance-in-webmaster.html)" which [affect your site's rank](http://googlewebmastercentral.blogspot.com/2010/04/using-site-speed-in-web-search-ranking.html) on Google.com
29
+ * "Instant" repeat page views: browser caching
30
+ * Optimized progressive render: pages start rendering quickly and can be interacted with more quickly
31
  * Reduced page load time: increased visitor time on site; visitors view more pages
32
  * Improved web server performance; sustain high traffic periods
33
  * Up to 80% bandwidth savings via minify and HTTP compression of HTML, CSS, JavaScript and feeds
34
 
35
+ *FEATURES*
36
 
37
  * Compatible with shared hosting, virtual private / dedicated servers and dedicated servers / clusters
38
  * Transparent content delivery network (CDN) management with Media Library, theme files and WordPress itself
39
  * Mobile support: respective caching of pages by referrer or groups of user agents including theme switching for groups of referrers or user agents
40
+ * Accelerated Mobile Pages (AMP) support
41
+ * Secure Socket Layer (SSL) support
42
+ * Caching of (minified and compressed) pages and posts in memory or on disk or on (FSD) CDN (by user agent group)
43
  * Caching of (minified and compressed) CSS and JavaScript in memory, on disk or on CDN
44
+ * Caching of feeds (site, categories, tags, comments, search results) in memory or on disk or on CDN
45
  * Caching of search results pages (i.e. URIs with query string variables) in memory or on disk
46
  * Caching of database objects in memory or on disk
47
  * Caching of objects in memory or on disk
48
+ * Caching of fragments in memory or on disk
49
  * Minification of posts and pages and feeds
50
  * Minification of inline, embedded or 3rd party JavaScript (with automated updates)
51
  * Minification of inline, embedded or 3rd party CSS (with automated updates)
54
  * Non-blocking JavaScript embedding
55
  * Import post attachments directly into the Media Library (and CDN)
56
  * WP-CLI support for cache purging, query string updating and more
57
+ * Various security features
58
+ * Caching statistics for performance insights
59
+ * Extension framework for customization or extensibility e.g. New Relic, Cloudflare, WPML and more
60
+ * Reverse proxy integration via Nginx or Varnish
61
 
62
  Improve the user experience for your readers without having to change WordPress, your theme, your plugins or how you produce your content.
63
 
65
 
66
  = Why does speed matter? =
67
 
68
+ Search engines like Google, measure and factor in the speed of web sites in their ranking algorithm. When they recommend a site they want to make sure users find what they're looking for quickly. So in effect you and Google should have the same objective.
69
+
70
  Speed is among the most significant success factors web sites face. In fact, your site's speed directly affects your income (revenue) &mdash; it's a fact. Some high traffic sites conducted research and uncovered the following:
71
 
72
  * Google.com: **+500 ms** (speed decrease) -> **-20% traffic loss** [[1](http://home.blarg.net/~glinden/StanfordDataMining.2006-11-29.ppt)]
75
 
76
  A thousandth of a second is not a long time, yet the impact is quite significant. Even if you're not a large company (or just hope to become one), a loss is still a loss. However, there is a solution to this problem, take advantage.
77
 
 
 
78
  Many of the other consequences of poor performance were discovered more than a decade ago:
79
 
80
  * Lower perceived credibility (Fogg et al. 2001)
89
 
90
  There are a number of [resources](http://www.websiteoptimization.com/speed/tweak/psychology-web-performance/) that have been documenting the role of performance in success on the web, W3 Total Cache exists to give you a framework to tune your application or site without having to do years of research.
91
 
92
+ = Why is W3 Total Cache better than other caching solutions? =
93
 
94
  **It's a complete framework.** Most cache plugins available do a great job at achieving a couple of performance aims. Our plugin remedies numerous performance reducing aspects of any web site going far beyond merely reducing CPU usage (load) and bandwidth consumption for HTML pages alone. Equally important, the plugin requires no theme modifications, modifications to your .htaccess (mod_rewrite rules) or programming compromises to get started. Most importantly, it's the only plugin designed to optimize all practical hosting environments small or large. The options are many and setup is easy.
95
 
101
 
102
  = Which WordPress versions are supported? =
103
 
104
+ To use all features in the suite, a minimum of version WordPress 2.8 with PHP 5.3 is required. Earlier versions will benefit from our Media Library Importer to get them back on the upgrade path and into a CDN of their choosing.
105
 
106
  = Why doesn't minify work for me? =
107
 
146
 
147
  = Which web servers do you support? =
148
 
149
+ We are aware of no incompatibilities with [apache](http://httpd.apache.org/) 1.3+, [nginx](https://www.nginx.com/solutions/web-server/) 0.7+, [IIS](http://www.iis.net/) 5+ or [litespeed](https://www.litespeedtech.com/products/litespeed-web-server/overview) 4.0.2+. If there's a web server you feel we should be actively testing (e.g. [lighttpd](https://www.lighttpd.net/)), we're [interested in hearing](https://www.w3-edge.com/contact/).
150
 
151
  = Is this plugin server cluster and load balancer friendly? =
152
 
168
 
169
  Technically no, a CDN is a high performance cache that stores static assets (your theme files, media library etc) in various locations throughout the world in order to provide low latency access to them by readers in those regions.
170
 
 
 
 
 
171
  = How do I use an Origin Pull (Mirror) CDN? =
172
  Login to your CDN providers control panel or account management area. Following any set up steps they provide, create a new "pull zone" or "bucket" for your site's domain name. If there's a set up wizard or any troubleshooting tips your provider offers, be sure to review them. In the CDN tab of the plugin, enter the hostname your CDN provider provided in the "replace site's hostname with" field. You should always do a quick check by opening a test file from the CDN hostname, e.g. http://cdn.domain.com/favicon.ico. Troubleshoot with your CDN provider until this test is successful.
173
 
193
 
194
  Now go to the General tab and click the "Enable" checkbox and save the settings to enable CDN functionality and empty the cache for the changes to take effect. If preview mode is active you will need to "deploy" your changes for them to take effect.
195
 
 
 
 
 
 
 
 
 
 
 
 
196
  = What is the purpose of the "modify attachment URLs" button? =
197
 
198
  If the domain name of your site has changed, this tool is useful in updating your posts and pages to use the current addresses. For example, if your site used to be www.domain.com, and you decided to change it to domain.com, the result would either be many "broken" images or many unnecessary redirects (which slow down the visitor's browsing experience). You can use this tool to correct this and similar cases. Correcting the URLs of your images also allows the plugin to do a better job of determining which images are actually hosted with the CDN.
252
  1. Login as an administrator to your WordPress Admin account. Using the "Add New" menu option under the "Plugins" section of the navigation, you can either search for: w3 total cache or if you've downloaded the plugin already, click the "Upload" link, find the .zip file you download and then click "Install Now". Or you can unzip and FTP upload the plugin to your plugins directory (wp-content/plugins/). In either case, when done wp-content/plugins/w3-total-cache/ should exist.
253
  1. Locate and activate the plugin on the "Plugins" page. Page caching will **automatically be running** in basic mode. Set the permissions of wp-content and wp-content/uploads back to 755, e.g. in the terminal: `# chmod 755 /var/www/vhosts/domain.com/httpdocs/wp-content/`.
254
  1. Now click the "Settings" link to proceed to the "General Settings" tab; in most cases, "disk enhanced" mode for page cache is a "good" starting point.
255
+ 1. The "Compatibility mode" option found in the advanced section of the "Page Cache Settings" tab will enable functionality that optimizes the interoperablity of caching with WordPress, is disabled by default, but highly recommended. Years of testing in hundreds of thousands of installations have helped us learn how to make caching behave well with WordPress. The tradeoff is that disk enhanced page cache performance under load tests will be decreased by ~20% at scale.
256
  1. *Recommended:* On the "Minify Settings" tab, all of the recommended settings are preset. If auto mode causes issues with your web site's layout, switch to manual mode and use the help button to simplify discovery of your CSS and JS files and groups. Pay close attention to the method and location of your JS group embeddings. See the plugin's FAQ for more information on usage.
257
  1. *Recommended:* On the "Browser Cache" tab, HTTP compression is enabled by default. Make sure to enable other options to suit your goals.
258
  1. *Recommended:* If you already have a content delivery network (CDN) provider, proceed to the "Content Delivery Network" tab and populate the fields and set your preferences. If you do not use the Media Library, you will need to import your images etc into the default locations. Use the Media Library Import Tool on the "Content Delivery Network" tab to perform this task. If you do not have a CDN provider, you can still improve your site's performance using the "Self-hosted" method. On your own server, create a subdomain and matching DNS Zone record; e.g. static.domain.com and configure FTP options on the "Content Delivery Network" tab accordingly. Be sure to FTP upload the appropriate files, using the available upload buttons.
771
 
772
  == Changelog ==
773
 
774
+ = 0.9.5.1 =
775
+ * Fixed missing namespace, which caused issues with other implementations of Google APIs
776
+ * Fixed handling Cloudflare zone list being incomplete for users with many zones
777
+ * Added extension to support Accelerated Mobile Pages (AMP)
778
+ * Added notification for users that are still using PHP 5.2 (end of life in 2011)
779
+ * Improved default settings
780
+ * Improved compatibility with Yoast SEO sitemap caching
781
+ * Improved compatability with Jetpack
782
+ * Improved directory handling on IIS
783
+ * Improved backwards compatibility for 3rd party implementations against legacy W3TC functions
784
+
785
  = 0.9.5 =
786
  * Fixed XSS vulnerability
787
  * Fixed issues with dismissing overlays
812
  * Added more support for exclusions to database cache
813
  * Added more optionality to minifiers
814
  * Added WPML Performance Extension
815
+ * Added use of [namespace](http://php.net/manual/en/language.namespaces.rationale.php) which creates mininum dependency on version PHP 5.3
816
  * Improved PHP 5.6 compatibility
817
  * Improved PHP 7 compatibility
818
  * Improved performance menu in admin bar, including purging of specific cache engines and more
819
+ * Improved SSL interoperability
820
  * Improved reliablity of test buttons
821
  * Improved nomenclature of caching files for higher cache hit rates
822
  * Improved nginx compatibility
823
  * Improved WP CLI support
824
+ * Improved Cloudflare compatibility (now using latest APIs), Cloudflare must be re-authorized
825
  * Improved AWS API compatibility (now using latest APIs)
826
  * Improved Rackspace Cloud Files compatibility (now using latest APIs)
827
  * Improved page cache purge for extensions like cloudflare and other reverse proxy use cases
828
  * Improved extension framework functionality
829
+ * Improved compatibility of headers like ETag and content encoding
830
  * Improved template fragment caching
831
  * Improved notifications, warnings and errors
832
  * Improved moble user agents detection
w3-total-cache-api.php CHANGED
@@ -5,12 +5,10 @@ if ( !defined( 'ABSPATH' ) ) {
5
  }
6
 
7
  define( 'W3TC', true );
8
- define( 'W3TC_VERSION', '0.9.5' );
9
  define( 'W3TC_POWERED_BY', 'W3 Total Cache' );
10
  define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' );
11
  define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' );
12
- define( 'W3TC_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr' );
13
- define( 'W3TC_PAYPAL_BUSINESS', 'w3tc-team@w3-edge.com' );
14
  define( 'W3TC_LINK_URL', 'https://www.w3-edge.com/wordpress-plugins/' );
15
  define( 'W3TC_LINK_NAME', 'W3 EDGE, Optimization Products for WordPress' );
16
  define( 'W3TC_FEED_URL', 'http://feeds.feedburner.com/W3TOTALCACHE' );
@@ -22,6 +20,7 @@ define( 'W3TC_SUPPORT_US_TIMEOUT', 2592000 ); // 30 days
22
  define( 'W3TC_SUPPORT_US_TWEET', 'YES! I optimized the user experience of my website with the W3 Total Cache #WordPress #plugin by @w3edge! http://bit.ly/TeSBL3' );
23
  define( 'W3TC_EDGE_TIMEOUT', 7 * 24 * 60 * 60 );
24
  define( 'W3TC_SUPPORT_REQUEST_URL', 'https://www.w3-edge.com/w3tc-support/extra' );
 
25
  define( 'W3TC_TRACK_URL', 'https://www.w3-edge.com/w3tc/track/' );
26
  define( 'W3TC_MAILLINGLIST_SIGNUP_URL', 'https://www.w3-edge.com/w3tc/emailsignup/' );
27
  define( 'NEWRELIC_SIGNUP_URL', 'http://bit.ly/w3tc-partner-newrelic-signup' );
@@ -129,10 +128,10 @@ function w3tc_class_autoload( $class ) {
129
  } elseif ( substr( $class, 0, 8 ) == 'Minify0_' ) {
130
  $base = W3TC_LIB_DIR . DIRECTORY_SEPARATOR . 'Minify' . DIRECTORY_SEPARATOR;
131
  $class = substr( $class, 8 );
132
- } elseif ( substr( $class, 0, 7 ) == 'Google_' &&
133
  ( !defined( 'W3TC_GOOGLE_LIBRARY' ) || W3TC_GOOGLE_LIBRARY ) ) {
134
  // Google library
135
- $classPath = explode( '_', $class );
136
  if ( count( $classPath ) > 3 ) {
137
  // Maximum class file path depth in this project is 3.
138
  $classPath = array_slice( $classPath, 0, 3 );
@@ -140,39 +139,49 @@ function w3tc_class_autoload( $class ) {
140
 
141
  $filePath = W3TC_LIB_DIR . DIRECTORY_SEPARATOR .
142
  implode( '/', $classPath ) . '.php';
143
- require $filePath;
 
 
144
  return;
145
  }
146
 
147
  if ( !is_null( $base ) ) {
148
  $file = $base . strtr( $class, "\\_",
149
  DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR ) . '.php';
150
- if ( is_readable( $file ) )
151
  require_once $file;
152
  } else if ( substr( $class, 0, 5 ) == 'W3TC\\' ) {
153
  $filename = W3TC_DIR . DIRECTORY_SEPARATOR . substr( $class, 5 ) . '.php';
154
 
155
- if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
156
- if ( !file_exists( $filename ) ) {
 
 
 
 
 
157
  debug_print_backtrace();
158
  }
159
  }
160
-
161
- require $filename;
162
  }
163
  }
164
 
165
  spl_autoload_register( 'w3tc_class_autoload' );
166
 
167
-
168
-
169
  /**
170
  * W3 Total Cache plugins API
171
  */
172
 
173
  /**
174
- * Returns config
175
- * */
 
 
 
 
 
 
 
176
  function w3tc_config() {
177
  $config = \W3TC\Dispatcher::config();
178
  return $config;
@@ -485,3 +494,49 @@ function w3tc_opcache_flush_file( $file, $http = false ) {
485
  return true;
486
  }
487
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  }
6
 
7
  define( 'W3TC', true );
8
+ define( 'W3TC_VERSION', '0.9.5.1' );
9
  define( 'W3TC_POWERED_BY', 'W3 Total Cache' );
10
  define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' );
11
  define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' );
 
 
12
  define( 'W3TC_LINK_URL', 'https://www.w3-edge.com/wordpress-plugins/' );
13
  define( 'W3TC_LINK_NAME', 'W3 EDGE, Optimization Products for WordPress' );
14
  define( 'W3TC_FEED_URL', 'http://feeds.feedburner.com/W3TOTALCACHE' );
20
  define( 'W3TC_SUPPORT_US_TWEET', 'YES! I optimized the user experience of my website with the W3 Total Cache #WordPress #plugin by @w3edge! http://bit.ly/TeSBL3' );
21
  define( 'W3TC_EDGE_TIMEOUT', 7 * 24 * 60 * 60 );
22
  define( 'W3TC_SUPPORT_REQUEST_URL', 'https://www.w3-edge.com/w3tc-support/extra' );
23
+ define( 'W3TC_SUPPORT_SERVICES_URL', 'https://www.w3-edge.com/w3tc/premium-widget.json' );
24
  define( 'W3TC_TRACK_URL', 'https://www.w3-edge.com/w3tc/track/' );
25
  define( 'W3TC_MAILLINGLIST_SIGNUP_URL', 'https://www.w3-edge.com/w3tc/emailsignup/' );
26
  define( 'NEWRELIC_SIGNUP_URL', 'http://bit.ly/w3tc-partner-newrelic-signup' );
128
  } elseif ( substr( $class, 0, 8 ) == 'Minify0_' ) {
129
  $base = W3TC_LIB_DIR . DIRECTORY_SEPARATOR . 'Minify' . DIRECTORY_SEPARATOR;
130
  $class = substr( $class, 8 );
131
+ } elseif ( substr( $class, 0, 13 ) == 'W3TCG_Google_' &&
132
  ( !defined( 'W3TC_GOOGLE_LIBRARY' ) || W3TC_GOOGLE_LIBRARY ) ) {
133
  // Google library
134
+ $classPath = explode( '_', substr( $class, 6 ) );
135
  if ( count( $classPath ) > 3 ) {
136
  // Maximum class file path depth in this project is 3.
137
  $classPath = array_slice( $classPath, 0, 3 );
139
 
140
  $filePath = W3TC_LIB_DIR . DIRECTORY_SEPARATOR .
141
  implode( '/', $classPath ) . '.php';
142
+
143
+ if ( file_exists( $filePath ) )
144
+ require $filePath;
145
  return;
146
  }
147
 
148
  if ( !is_null( $base ) ) {
149
  $file = $base . strtr( $class, "\\_",
150
  DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR ) . '.php';
151
+ if ( file_exists( $file ) )
152
  require_once $file;
153
  } else if ( substr( $class, 0, 5 ) == 'W3TC\\' ) {
154
  $filename = W3TC_DIR . DIRECTORY_SEPARATOR . substr( $class, 5 ) . '.php';
155
 
156
+ if ( file_exists( $filename ) ) {
157
+ require $filename;
158
+ } else {
159
+ if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
160
+ echo 'Attempt to create object of class ' .
161
+ $class . ' has been made, but file ' .
162
+ $filename . ' doesnt exists';
163
  debug_print_backtrace();
164
  }
165
  }
 
 
166
  }
167
  }
168
 
169
  spl_autoload_register( 'w3tc_class_autoload' );
170
 
 
 
171
  /**
172
  * W3 Total Cache plugins API
173
  */
174
 
175
  /**
176
+ * Returns config.
177
+ *
178
+ * !!! NOTICE !!!
179
+ * 3rd party developers, please do not modify the plugin's configuration without
180
+ * notifying the user beforehand. As an alternative, throw a notification to the
181
+ * user like: "Configure W3 Total Cache for me" and allow the user to dismiss
182
+ * the notification.
183
+ * !!! NOTICE !!!
184
+ */
185
  function w3tc_config() {
186
  $config = \W3TC\Dispatcher::config();
187
  return $config;
494
  return true;
495
  }
496
  }
497
+
498
+ /**
499
+ * Deprecated. Retained for 3rd parties that used it. see w3tc_config()
500
+ */
501
+ class W3_Config extends \W3TC\Config {
502
+ public function __construct( $master = false, $blog_id = null ) {
503
+ if ( $master )
504
+ $blog_id = 0;
505
+
506
+ return parent::__construct($blog_id);
507
+ }
508
+ }
509
+
510
+ /**
511
+ * Deprecated. Retained for 3rd parties that use it. see w3tc_config()
512
+ */
513
+ class W3_ConfigWriter {
514
+ public function __construct( $p1 = 0, $p2 = 0 ) {
515
+ }
516
+ public function set( $p1 = 0, $p2 = 0 ) {
517
+ }
518
+ public function save( $p1 = 0, $p2 = 0 ) {
519
+ }
520
+ public function refresh_w3tc() {
521
+ }
522
+ }
523
+
524
+ /**
525
+ Deprecated. Retained for 3rd parties that use it. see w3tc_config()
526
+ */
527
+ function w3_instance( $class ) {
528
+ $legacy_class_name = null;
529
+
530
+ if ( $class == 'W3_Config' )
531
+ $legacy_class_name = 'Config';
532
+ elseif ( $class == 'W3_ObjectCacheBridge' )
533
+ $legacy_class_name = 'ObjectCache_WpObjectCache';
534
+ elseif ( $class == 'W3_PgCache' )
535
+ $legacy_class_name = 'PgCache_ContentGrabber';
536
+ elseif ( $class == 'W3_Redirect' )
537
+ $legacy_class_name = 'Mobile_Redirect';
538
+ else
539
+ return null;
540
+
541
+ return \W3TC\Dispatcher::component( $legacy_class_name );
542
+ }
w3-total-cache-old-php.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ die();
5
+ }
6
+
7
+
8
+
9
+ function w3tc_old_php_message() {
10
+ $m = __( 'Please update your PHP. <strong>W3 Total Cache</strong> requires PHP version 5.3 or above',
11
+ 'w3-total-cache' );
12
+
13
+ return $m;
14
+ }
15
+
16
+
17
+ function w3tc_old_php_activate() {
18
+ echo w3tc_old_php_message();
19
+ exit();
20
+ }
21
+
22
+
23
+
24
+ function w3tc_old_php_admin_notices() {
25
+ ?>
26
+ <div class="notice error notice-error">
27
+ <p><?php echo w3tc_old_php_message(); ?></p>
28
+ </div>
29
+ <?php
30
+ }
31
+
32
+ add_action( 'admin_notices', 'w3tc_old_php_admin_notices' );
w3-total-cache.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: W3 Total Cache
4
  Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress.
5
- Version: 0.9.5
6
  Plugin URI: https://www.w3-edge.com/wordpress-plugins/w3-total-cache/
7
  Author: Frederick Townes
8
  Author URI: http://www.linkedin.com/in/fredericktownes
@@ -47,7 +47,11 @@ if ( !defined( 'ABSPATH' ) ) {
47
  if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING )
48
  return;
49
 
50
- include dirname( __FILE__ ) . '/lib/EDD/integration.php';
 
 
 
 
51
 
52
  if ( !defined( 'W3TC_IN_MINIFY' ) ) {
53
  /**
@@ -59,9 +63,6 @@ if ( !defined( 'W3TC_IN_MINIFY' ) ) {
59
  if ( defined( 'WP_CLI' ) && WP_CLI )
60
  require_once W3TC_DIR . '/Cli.php';
61
 
62
- /**
63
- * Run
64
- */
65
- $w3tc_root = new \W3TC\Root_Loader();
66
- $w3tc_root->run();
67
  }
2
  /*
3
  Plugin Name: W3 Total Cache
4
  Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress.
5
+ Version: 0.9.5.1
6
  Plugin URI: https://www.w3-edge.com/wordpress-plugins/w3-total-cache/
7
  Author: Frederick Townes
8
  Author URI: http://www.linkedin.com/in/fredericktownes
47
  if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING )
48
  return;
49
 
50
+ if ( version_compare( PHP_VERSION, '5.3.0', '<') ) {
51
+ require_once dirname( __FILE__ ) . '/w3-total-cache-old-php.php';
52
+ register_activation_hook( __FILE__, 'w3tc_old_php_activate' );
53
+ return;
54
+ }
55
 
56
  if ( !defined( 'W3TC_IN_MINIFY' ) ) {
57
  /**
63
  if ( defined( 'WP_CLI' ) && WP_CLI )
64
  require_once W3TC_DIR . '/Cli.php';
65
 
66
+ // include to prevent syntax error for older php
67
+ require_once dirname( __FILE__ ) . '/Root_Loader.php';
 
 
 
68
  }
wp-content/advanced-cache.php CHANGED
@@ -23,7 +23,7 @@ if ( !defined( 'W3TC_IN_MINIFY' ) ) {
23
 
24
  if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
25
  if ( defined( 'WP_ADMIN' ) ) { // lets don't show error on front end
26
- echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', __FILE__ );
27
  }
28
  } else {
29
  require_once W3TC_DIR . '/w3-total-cache-api.php';
23
 
24
  if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php' ) ) {
25
  if ( defined( 'WP_ADMIN' ) ) { // lets don't show error on front end
26
+ echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>. <br />', __FILE__ );
27
  }
28
  } else {
29
  require_once W3TC_DIR . '/w3-total-cache-api.php';
wp-content/db.php CHANGED
@@ -18,7 +18,7 @@ if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php'
18
  if ( !defined( 'WP_ADMIN' ) ) { // lets don't show error on front end
19
  require_once ABSPATH . WPINC . '/wp-db.php';
20
  } else {
21
- echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', __FILE__ );
22
  }
23
  } else {
24
  require_once W3TC_DIR . '/w3-total-cache-api.php';
18
  if ( !defined( 'WP_ADMIN' ) ) { // lets don't show error on front end
19
  require_once ABSPATH . WPINC . '/wp-db.php';
20
  } else {
21
+ echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>. <br />', __FILE__ );
22
  }
23
  } else {
24
  require_once W3TC_DIR . '/w3-total-cache-api.php';
wp-content/object-cache.php CHANGED
@@ -15,7 +15,7 @@ if ( !@is_dir( W3TC_DIR ) || !file_exists( W3TC_DIR . '/w3-total-cache-api.php'
15
  if ( !defined( 'WP_ADMIN' ) ) { // lets don't show error on front end
16
  require_once ABSPATH . WPINC . '/cache.php';
17
  } else {
18
- echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>.', __FILE__ );
19
  }
20
  } else {
21
  require_once W3TC_DIR . '/w3-total-cache-api.php';
15
  if ( !defined( 'WP_ADMIN' ) ) { // lets don't show error on front end
16
  require_once ABSPATH . WPINC . '/cache.php';
17
  } else {
18
+ echo sprintf( '<strong>W3 Total Cache Error:</strong> some files appear to be missing or out of place. Please re-install plugin or remove <strong>%s</strong>. <br />', __FILE__ );
19
  }
20
  } else {
21
  require_once W3TC_DIR . '/w3-total-cache-api.php';