Changeset 2241
- Timestamp:
- 12/30/2015 10:55:01 PM (11 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins
- Files:
-
- 2 edited
-
wcorg-json-api.php (modified) (1 diff)
-
wp-cli-commands/rest-api.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-json-api.php
r2165 r2241 304 304 } 305 305 add_action( 'wp_json_server_before_serve', 'wcorg_json_avoid_nested_callback_conflicts', 11 ); // after the default endpoints are added in `json_api_default_filters()` 306 307 /** 308 * Tell WP Super Cache to cache API endpoints 309 * 310 * @param string $eof_pattern 311 * 312 * @return string 313 */ 314 function wcorg_json_cache_requests( $eof_pattern ) { 315 global $wp_super_cache_comments; 316 317 if ( defined( 'JSON_REQUEST' ) && JSON_REQUEST ) { 318 // Accept a JSON-formatted string as an end-of-file marker, so that the page will be cached 319 $json_object_pattern = '^[{].*[}]$'; 320 $json_collection_pattern = '^[\[].*[\]]$'; 321 322 $eof_pattern = str_replace( 323 '<\?xml', 324 sprintf( '<\?xml|%s|%s', $json_object_pattern, $json_collection_pattern ), 325 $eof_pattern 326 ); 327 328 // Don't append HTML comments to the JSON output, because that would invalidate it 329 $wp_super_cache_comments = false; 330 } 331 332 return $eof_pattern; 333 } 334 add_filter( 'wp_cache_eof_tags', 'wcorg_json_cache_requests' ); -
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wp-cli-commands/rest-api.php
r2178 r2241 15 15 $errors = false; 16 16 $start_timestamp = microtime( true ); 17 18 WP_CLI::line(); 19 WP_CLI::warning( "Make sure you clear WP Super Cache on the test sites before running this, to avoid testing old data." ); 17 20 18 21 // These calls are not formatted in a more compact way because we don't want to short-circuit any of them if one fails
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)