Changeset 1335458
- Timestamp:
- 01/25/2016 11:49:28 AM (10 years ago)
- Location:
- better-rest-api-featured-images
- Files:
-
- 8 added
- 4 edited
-
tags/1.1.0 (added)
-
tags/1.1.0/Gruntfile.js (added)
-
tags/1.1.0/better-rest-api-featured-images.php (added)
-
tags/1.1.0/languages (added)
-
tags/1.1.0/languages/better-rest-api-featured-images.pot (added)
-
tags/1.1.0/package.json (added)
-
tags/1.1.0/readme.md (added)
-
tags/1.1.0/readme.txt (added)
-
trunk/better-rest-api-featured-images.php (modified) (2 diffs)
-
trunk/languages/better-rest-api-featured-images.pot (modified) (1 diff)
-
trunk/readme.md (modified) (4 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
better-rest-api-featured-images/trunk/better-rest-api-featured-images.php
r1321789 r1335458 11 11 * Plugin URI: https://wordpress.org/plugins/better-rest-api-featured-images/ 12 12 * Description: Enhances the featured image data returned on the post object by the REST API to include urls for all available sizes and other useful image data. 13 * Version: 1. 0.213 * Version: 1.1.0 14 14 * Author: Braad Martin 15 15 * Author URI: http://braadmartin.com … … 110 110 } 111 111 112 return $featured_image;112 return apply_filters( 'better_rest_api_featured_image', $featured_image, $image_id ); 113 113 } -
better-rest-api-featured-images/trunk/languages/better-rest-api-featured-images.pot
r1274063 r1335458 1 # Copyright (C) 201 5Braad Martin1 # Copyright (C) 2016 Braad Martin 2 2 # This file is distributed under the GPL-2.0+. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Better REST API Featured Images 1. 0.1\n"5 "Project-Id-Version: Better REST API Featured Images 1.1.0\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/better-rest-api-featured-images\n" 8 "POT-Creation-Date: 201 5-10-27 15:40:55+00:00\n"8 "POT-Creation-Date: 2016-01-25 11:33:53+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "PO-Revision-Date: 201 5-MO-DA HO:MI+ZONE\n"12 "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 14 "Language-Team: LANGUAGE <[email protected]>\n" -
better-rest-api-featured-images/trunk/readme.md
r1321789 r1335458 5 5 **Requires at least:** 4.0 6 6 **Tested up to:** 4.4 7 **Stable tag:** 1. 0.27 **Stable tag:** 1.1.0 8 8 **License:** GPLv2 or later 9 9 **License URI:** http://www.gnu.org/licenses/gpl-2.0.html … … 90 90 I've done some basic performance tests that indicate the difference in response times with and without this plugin to be about 10-15ms for a collection of 10 posts and 0-5ms for a single post. For me this is much faster than making a second request to `/media/`, especially for multiple posts. 91 91 92 As of version 1.1.0, there is a filter `better_rest_api_featured_image` that allows you to add custom data to the better_featured_image field. The filter is directly on the return value of the function that returns the better_featured_image field. This can be used to do things like add custom image meta or an SVG version of the image to the response. Here's an example of how you might use it: 93 94 95 add_filter( 'better_rest_api_featured_image', 'xxx_modify_rest_api_featured_image', 10, 2 ); 96 /** 97 * Modify the Better REST API Featured Image response. 98 * 99 * @param array $featured_image The array of image data. 100 * @param int $image_id The image ID. 101 * 102 * @return array The modified image data. 103 */ 104 function xxx_modify_rest_api_featured_image( $featured_image, $image_id ) { 105 106 // Add an extra_data_string field with a string value. 107 $featured_image['extra_data_string'] = 'A custom value.'; 108 109 // Add an extra_data_array field with an array value. 110 $featured_image['extra_data_array'] = array( 111 'custom_key' => 'A custom value.', 112 ); 113 114 return $featured_image; 115 } 116 117 92 118 This plugin is on [on Github](https://github.com/BraadMartin/better-rest-api-featured-images "Better REST API Featured Images") and pull requests are always welcome. :) 93 119 … … 120 146 ## Changelog ## 121 147 148 ### 1.1.0 ### 149 * Add a better_rest_api_featured_image filter for adding custom data to the response. Props: avishayil 150 122 151 ### 1.0.2 ### 123 152 * Change register_api_field to register_rest_field for compatibility with the REST API v2 beta 9. Props: Soean … … 131 160 ## Upgrade Notice ## 132 161 162 ### 1.1.0 ### 163 * Add a better_rest_api_featured_image filter for adding custom data to the response. Props: avishayil 164 133 165 ### 1.0.2 ### 134 166 * Change register_api_field to register_rest_field for compatibility with the REST API v2 beta 9. Props: Soean -
better-rest-api-featured-images/trunk/readme.txt
r1321789 r1335458 5 5 Requires at least: 4.0 6 6 Tested up to: 4.4 7 Stable tag: 1. 0.27 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 90 90 I've done some basic performance tests that indicate the difference in response times with and without this plugin to be about 10-15ms for a collection of 10 posts and 0-5ms for a single post. For me this is much faster than making a second request to `/media/`, especially for multiple posts. 91 91 92 As of version 1.1.0, there is a filter `better_rest_api_featured_image` that allows you to add custom data to the better_featured_image field. The filter is directly on the return value of the function that returns the better_featured_image field. This can be used to do things like add custom image meta or an SVG version of the image to the response. Here's an example of how you might use it: 93 94 ` 95 add_filter( 'better_rest_api_featured_image', 'xxx_modify_rest_api_featured_image', 10, 2 ); 96 /** 97 * Modify the Better REST API Featured Image response. 98 * 99 * @param array $featured_image The array of image data. 100 * @param int $image_id The image ID. 101 * 102 * @return array The modified image data. 103 */ 104 function xxx_modify_rest_api_featured_image( $featured_image, $image_id ) { 105 106 // Add an extra_data_string field with a string value. 107 $featured_image['extra_data_string'] = 'A custom value.'; 108 109 // Add an extra_data_array field with an array value. 110 $featured_image['extra_data_array'] = array( 111 'custom_key' => 'A custom value.', 112 ); 113 114 return $featured_image; 115 } 116 ` 117 92 118 This plugin is on [on Github](https://github.com/BraadMartin/better-rest-api-featured-images "Better REST API Featured Images") and pull requests are always welcome. :) 93 119 … … 120 146 == Changelog == 121 147 148 = 1.1.0 = 149 * Add a better_rest_api_featured_image filter for adding custom data to the response. Props: avishayil 150 122 151 = 1.0.2 = 123 152 * Change register_api_field to register_rest_field for compatibility with the REST API v2 beta 9. Props: Soean … … 131 160 == Upgrade Notice == 132 161 162 = 1.1.0 = 163 * Add a better_rest_api_featured_image filter for adding custom data to the response. Props: avishayil 164 133 165 = 1.0.2 = 134 166 * Change register_api_field to register_rest_field for compatibility with the REST API v2 beta 9. Props: Soean
Note: See TracChangeset
for help on using the changeset viewer.