Changeset 1187864
- Timestamp:
- 06/26/2015 12:47:58 AM (11 years ago)
- Location:
- featured-image-caption/trunk
- Files:
-
- 6 edited
-
classes/Caption.php (modified) (1 diff)
-
classes/Manage.php (modified) (1 diff)
-
featured-image-caption.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/autoload.php (modified) (1 diff)
-
vendor/composer/autoload_real.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
featured-image-caption/trunk/classes/Caption.php
r1184833 r1187864 188 188 public function post_thumbnail_filter($html) 189 189 { 190 // If automatic caption append is not enabled , return the HTML unchanged191 if ( empty($this->options->auto_append)) {190 // If automatic caption append is not enabled or we're not in The Loop, return the HTML unchanged 191 if ( empty( $this->options->auto_append ) || ! in_the_loop() ) { 192 192 return $html; 193 193 } -
featured-image-caption/trunk/classes/Manage.php
r1184833 r1187864 18 18 // Plugin upgrades 19 19 $this->upgrade(); 20 }21 22 /**23 * Plugin activation. This method is static because WordPress needs to be able24 * to access it directly, before the rest of the plugin is loaded.25 *26 * @since 0.7.027 */28 public static function activate()29 {30 // Check to make sure the version of WordPress being used is compatible with the plugin31 if (version_compare(get_bloginfo('version'), CCFIC_WPVER, '<')) {32 wp_die('Your version of WordPress is too old to use this plugin. Please upgrade to the latest version of WordPress.');33 }34 35 // Check that the current theme support featured images36 if (! current_theme_supports('post-thumbnails')) {37 wp_die('Your current theme does not have support for featured images, which is required to use this plugin. Please add support in your current theme, or activate a theme that already supports them.');38 }39 40 // Default plugin options41 $options = new \stdClass();42 $options->version = CCFIC_VERSION; // Current plugin version43 $options->auto_append = true; // Automatically append caption to featured image44 $options->container = true; // Wrap the caption HTML in a container div45 46 // Add options to database47 $result = add_option(CCFIC_KEY.'_options', $options);48 49 return $result;50 20 } 51 21 -
featured-image-caption/trunk/featured-image-caption.php
r1184833 r1187864 5 5 * Plugin URI: https://christiaanconover.com/code/wp-featured-image-caption?utm_source=wp-featured-image-caption 6 6 * Description: Set a caption for the featured image of a post that can be displayed on your site. 7 * Version: 0.8. 07 * Version: 0.8.1 8 8 * Author: Christiaan Conover 9 9 * Author URI: https://christiaanconover.com?utm_source=wp-featured-image-caption-author … … 12 12 13 13 // Prevent direct access 14 if ( ! defined( 'ABSPATH' )) {15 die( 'You cannot access this resource directly.');14 if (!defined('ABSPATH')) { 15 die('You cannot access this resource directly.'); 16 16 } 17 17 18 18 // Check that the version of PHP is sufficient 19 if ( version_compare( phpversion(), '5.3', '<' )) {20 trigger_error( 'PHP version ' . phpversion() . ' is unsupported, must be version 5.3 or newer', E_USER_ERROR);19 if (version_compare(phpversion(), '5.3', '<')) { 20 trigger_error('PHP version '.phpversion().' is unsupported, must be version 5.3 or newer', E_USER_ERROR); 21 21 22 22 return; … … 24 24 25 25 /* Define plugin constants */ 26 define( 'CCFIC_ID', 'cc-featured-image-caption' ); // Plugin ID 27 define( 'CCFIC_NAME', 'Featured Image Caption' ); // Plugin name 28 define( 'CCFIC_VERSION', '0.8.0' ); // Plugin version 29 define( 'CCFIC_WPVER', '3.5' ); // Minimum required version of WordPress 30 define( 'CCFIC_KEY', 'cc_featured_image_caption' ); // Database key 26 define('CCFIC_ID', 'cc-featured-image-caption'); // Plugin ID 27 define('CCFIC_NAME', 'Featured Image Caption'); // Plugin name 28 define('CCFIC_VERSION', '0.8.1'); // Plugin version 29 define('CCFIC_WPVER', '3.5'); // Minimum required version of WordPress 30 define('CCFIC_KEY', 'cc_featured_image_caption'); // Database key 31 define('CCFIC_PATH', __FILE__); // Path to the primary plugin file 31 32 32 33 // Plugin activation 34 if( is_admin() ) { 35 require_once 'classes/Manage.php'; 33 if (is_admin()) { 36 34 // Plugin activation 37 register_activation_hook( __FILE__, array( '\cconover\FeaturedImageCaption\Manage', 'activate' ));35 register_activation_hook(__FILE__, 'ccfic_activate'); 38 36 } 39 37 … … 41 39 * Plugin loader hook. 42 40 */ 43 function cc_featured_image_caption_loader() { 44 // Define the path to this file 45 if ( ! defined( 'CCFIC_PATH' ) ) { 46 define( 'CCFIC_PATH', __FILE__ ); 47 } 48 41 function cc_featured_image_caption_loader() 42 { 49 43 // Composer autoloader 50 44 require_once 'vendor/autoload.php'; … … 67 61 * @return string The formatted caption. 68 62 */ 69 function cc_featured_image_caption( $echo = true, $html = true ) { 63 function cc_featured_image_caption($echo = true, $html = true) 64 { 70 65 // Call the caption data using the shortcode 71 66 $format = $html ? '' : ' format="plaintext"'; 72 $caption = do_shortcode( '[ccfic'.$format.']');67 $caption = do_shortcode('[ccfic'.$format.']'); 73 68 74 69 // If the result should be printed to the screen. 75 if ( $echo) {70 if ($echo) { 76 71 echo $caption; 77 72 } else { … … 90 85 * @return bool 91 86 */ 92 function cc_has_featured_image_caption() { 87 function cc_has_featured_image_caption() 88 { 93 89 return true; 94 90 } 91 92 /** 93 * Plugin activation. 94 * 95 * @since 0.8.1 96 */ 97 function ccfic_activate() 98 { 99 // Check to make sure the version of WordPress being used is compatible with the plugin 100 if (version_compare(get_bloginfo('version'), CCFIC_WPVER, '<')) { 101 wp_die('Your version of WordPress is too old to use this plugin. Please upgrade to the latest version of WordPress.'); 102 } 103 104 // Default plugin options 105 $options = new \stdClass(); 106 $options->version = CCFIC_VERSION; // Current plugin version 107 $options->auto_append = true; // Automatically append caption to featured image 108 $options->container = true; // Wrap the caption HTML in a container div 109 110 // Add options to database 111 $result = add_option(CCFIC_KEY.'_options', $options); 112 113 return $result; 114 } -
featured-image-caption/trunk/readme.txt
r1184833 r1187864 2 2 Contributors: cconover 3 3 Donate link: https://christiaanconover.com/code/wp-featured-image-caption?ref=plugin-readme 4 Tags: image, caption, featured image 4 Tags: image, caption, featured image, shortcode 5 5 Requires at least: 3.5 6 6 Tested up to: 4.2.2 7 Stable tag: 0.8. 07 Stable tag: 0.8.1 8 8 License: GPLv2 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Easily add and display a caption tothe featured image of a post.11 Easily add and display a caption for the featured image of a post. 12 12 13 13 == Description == … … 90 90 == Changelog == 91 91 92 = 0.8.1 = 93 Restricts the automatic caption insertion to only occur in The Loop. 94 92 95 = 0.8.0 = 93 96 * Changes the name of the shortcode from `cc-featured-image-caption` to `ccfic`. This was done for a few reasons. First, WordPress documentation advises against hyphens in shortcode names, so in order to follow best practices the hyphens have been removed. Second, it's easier to type the abbreviation when using the shortcode. Please note, the old shortcode name still works for now, but you should expect that it will be removed entirely by the time this plugin reaches its 1.0.0 release. As such, please update all the locations that you use the shortcode. Please see the [shortcode documentation](https://github.com/cconover/wp-featured-image-caption/wiki/Shortcode) for usage information. -
featured-image-caption/trunk/vendor/autoload.php
r1184833 r1187864 5 5 require_once __DIR__ . '/composer' . '/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit eca468262d93b38e7a3bc5e61d940f43::getLoader();7 return ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4::getLoader(); -
featured-image-caption/trunk/vendor/composer/autoload_real.php
r1184833 r1187864 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit eca468262d93b38e7a3bc5e61d940f435 class ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit eca468262d93b38e7a3bc5e61d940f43', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit eca468262d93b38e7a3bc5e61d940f43', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4', 'loadClassLoader')); 25 25 26 26 $map = require __DIR__ . '/autoload_namespaces.php'; … … 45 45 } 46 46 47 function composerRequire eca468262d93b38e7a3bc5e61d940f43($file)47 function composerRequirec91643edaea3771dd8e0cc942282d3a4($file) 48 48 { 49 49 require $file;
Note: See TracChangeset
for help on using the changeset viewer.