Changeset 1392442
- Timestamp:
- 04/11/2016 09:26:27 PM (10 years ago)
- Location:
- featured-image-caption/trunk
- Files:
-
- 3 added
- 9 edited
-
classes/Bootstrap.php (modified) (1 diff)
-
classes/Caption.php (modified) (1 diff)
-
classes/Hooks.php (modified) (3 diffs)
-
classes/RestApi.php (added)
-
featured-image-caption.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/bin (added)
-
vendor/composer/ClassLoader.php (modified) (3 diffs)
-
vendor/composer/LICENSE (added)
-
vendor/composer/autoload_classmap.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
featured-image-caption/trunk/classes/Bootstrap.php
r1184833 r1392442 4 4 * Plugin loader. 5 5 * 6 * @ since 0.7.06 * @filesource 7 7 */ 8 8 9 9 namespace cconover\FeaturedImageCaption; 10 10 11 /** 12 * Plugin loader 13 * 14 * When the plugin is loaded, the environment needs to be set up. This class 15 * bootstraps the plugin's classes and hooks. 16 * 17 * @since 0.7.0 18 */ 11 19 class Bootstrap { 12 20 /** 13 * Class constructor. 21 * Load the bootstrap processes. 22 * 23 * @api 14 24 * 15 25 * @since 0.7.0 16 26 */ 17 public function __construct() {27 public function load() { 18 28 // Hooks and filters 19 new Hooks(); 29 $hooks = new Hooks(); 30 $hooks->call(); 20 31 } 21 32 } -
featured-image-caption/trunk/classes/Caption.php
r1231382 r1392442 28 28 * @param bool $html Whether the result should be fully-formed HTML. 29 29 * True: create HTML. False: return raw data array. 30 * @param int $post_id The ID of the post for which caption data should 31 * be retrieved. 30 32 * 31 33 * @return array|null|string If successful, returns the requested result. If unsuccessful, returns null. 32 34 */ 33 public function caption( $html = true ) { 35 public function caption( $html = true, $post_id = null ) { 36 // Set the post ID 37 if ( empty( $post_id ) ) { 38 global $post; 39 $post_id = $post->ID; 40 } 41 34 42 // Get the caption data 35 global $post; 36 $captiondata = $this->caption_data( $post->ID ); 43 $captiondata = $this->caption_data( $post_id ); 37 44 38 45 // If there is no caption data, return empty. -
featured-image-caption/trunk/classes/Hooks.php
r1231382 r1392442 1 1 <?php 2 /** 3 * WordPress hooks and filters for the plugin. 4 * 5 * @filesource 6 */ 7 8 namespace cconover\FeaturedImageCaption; 2 9 3 10 /** 4 11 * WordPress hooks and filters for the plugin. 5 12 * 13 * The plugin depends on WordPress action and filter hooks. To make management 14 * of the hooks easier, they are organized inside this class. Each method inside 15 * this class handles the hooks for another class in this plugin. 16 * 6 17 * @since 0.7.0 7 18 */ 8 9 namespace cconover\FeaturedImageCaption;10 11 19 class Hooks { 12 20 /** 13 * Class constructor. 21 * Call the hooks. 22 * 23 * @api 14 24 * 15 25 * @since 0.7.0 16 26 */ 17 public function __construct() {27 public function call() { 18 28 // Admin 19 29 if ( is_admin() ) { … … 30 40 // Caption data 31 41 $this->caption(); 42 43 // REST API (if supported) 44 if ( class_exists( 'WP_Rest_Controller' ) ) { 45 $this->rest_api(); 46 } 32 47 33 48 // Shortcode … … 84 99 85 100 /** 101 * REST API support 102 * 103 * @internal 104 * 105 * @since 0.8.3 106 */ 107 private function rest_api() { 108 $rest_api = new RestApi(); 109 110 // Register the fields 111 add_action( 'rest_api_init', array( $rest_api, 'register_fields' ) ); 112 } 113 114 /** 86 115 * Shortcode for the caption data. 87 116 * -
featured-image-caption/trunk/featured-image-caption.php
r1231382 r1392442 4 4 Plugin URI: https://christiaanconover.com/code/wp-featured-image-caption?utm_source=wp-featured-image-caption 5 5 Description: Set a caption for the featured image of a post that can be displayed on your site. 6 Version: 0.8. 26 Version: 0.8.3 7 7 Author: Christiaan Conover 8 8 Author URI: https://christiaanconover.com?utm_source=wp-featured-image-caption-author … … 19 19 define( 'CCFIC_ID', 'ccfic' ); // Plugin ID 20 20 define( 'CCFIC_NAME', 'Featured Image Caption' ); // Plugin name 21 define( 'CCFIC_VERSION', '0.8. 2' ); // Plugin version21 define( 'CCFIC_VERSION', '0.8.3' ); // Plugin version 22 22 define( 'CCFIC_WPVER', '3.5' ); // Minimum required version of WordPress 23 23 define( 'CCFIC_KEY', 'cc_featured_image_caption' ); // Database key (legacy support, ID now used) … … 44 44 45 45 // Instantiate the plugin 46 new \cconover\FeaturedImageCaption\Bootstrap(); 46 $bootstrap = new \cconover\FeaturedImageCaption\Bootstrap(); 47 $bootstrap->load(); 47 48 } 48 49 add_action( 'plugins_loaded', 'cc_featured_image_caption_loader' ); -
featured-image-caption/trunk/readme.txt
r1246217 r1392442 4 4 Tags: image, caption, featured image, shortcode 5 5 Requires at least: 3.5 6 Tested up to: 4. 3.17 Stable tag: 0.8. 26 Tested up to: 4.5 7 Stable tag: 0.8.3 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 33 33 34 34 == Upgrade Notice == 35 36 = 0.8.3 = 37 Add support for the WordPress REST API. 35 38 36 39 = 0.8.2 = … … 92 95 93 96 == Changelog == 97 98 = 0.8.3 = 99 Add support for the WordPress REST API. The caption fields are added as properties in the `posts` response. See [plugin documentation for the REST API](https://github.com/cconover/featured-image-caption/wiki/REST-API) for usage information. 94 100 95 101 = 0.8.2 = -
featured-image-caption/trunk/vendor/autoload.php
r1231382 r1392442 5 5 require_once __DIR__ . '/composer' . '/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit 5682686e4d0f389e4e54424212d26e8f::getLoader();7 return ComposerAutoloaderInit78ef5e6b259a87591f2222bf862e0ee5::getLoader(); -
featured-image-caption/trunk/vendor/composer/ClassLoader.php
r1231382 r1392442 14 14 15 15 /** 16 * ClassLoader implements a PSR-0 class loader 17 * 18 * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md 16 * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. 19 17 * 20 18 * $loader = new \Composer\Autoload\ClassLoader(); … … 40 38 * @author Fabien Potencier <fabien@symfony.com> 41 39 * @author Jordi Boggiano <j.boggiano@seld.be> 40 * @see http://www.php-fig.org/psr/psr-0/ 41 * @see http://www.php-fig.org/psr/psr-4/ 42 42 */ 43 43 class ClassLoader … … 148 148 * 149 149 * @param string $prefix The prefix/namespace, with trailing '\\' 150 * @param array|string $paths The PSR- 0base directories150 * @param array|string $paths The PSR-4 base directories 151 151 * @param bool $prepend Whether to prepend the directories 152 152 * -
featured-image-caption/trunk/vendor/composer/autoload_classmap.php
r1231382 r1392442 69 69 'cconover\\FeaturedImageCaption\\MetaBox' => $baseDir . '/classes/MetaBox.php', 70 70 'cconover\\FeaturedImageCaption\\Option' => $baseDir . '/classes/Option.php', 71 'cconover\\FeaturedImageCaption\\RestApi' => $baseDir . '/classes/RestApi.php', 71 72 'cconover\\FeaturedImageCaption\\Shortcode' => $baseDir . '/classes/Shortcode.php', 72 73 'cconover\\FeaturedImageCaption\\Upgrade' => $baseDir . '/classes/Upgrade.php', -
featured-image-caption/trunk/vendor/composer/autoload_real.php
r1231382 r1392442 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 5682686e4d0f389e4e54424212d26e8f5 class ComposerAutoloaderInit78ef5e6b259a87591f2222bf862e0ee5 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit 5682686e4d0f389e4e54424212d26e8f', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit78ef5e6b259a87591f2222bf862e0ee5', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit 5682686e4d0f389e4e54424212d26e8f', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit78ef5e6b259a87591f2222bf862e0ee5', 'loadClassLoader')); 25 25 26 26 $map = require __DIR__ . '/autoload_namespaces.php'; … … 44 44 } 45 45 } 46 47 function composerRequire5682686e4d0f389e4e54424212d26e8f($file)48 {49 require $file;50 }
Note: See TracChangeset
for help on using the changeset viewer.