Plugin Directory

Changeset 1187864


Ignore:
Timestamp:
06/26/2015 12:47:58 AM (11 years ago)
Author:
cconover
Message:

Updates code to version 0.8.1

Location:
featured-image-caption/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • featured-image-caption/trunk/classes/Caption.php

    r1184833 r1187864  
    188188    public function post_thumbnail_filter($html)
    189189    {
    190         // If automatic caption append is not enabled, return the HTML unchanged
    191         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() ) {
    192192            return $html;
    193193        }
  • featured-image-caption/trunk/classes/Manage.php

    r1184833 r1187864  
    1818        // Plugin upgrades
    1919        $this->upgrade();
    20     }
    21 
    22     /**
    23      * Plugin activation. This method is static because WordPress needs to be able
    24      * to access it directly, before the rest of the plugin is loaded.
    25      *
    26      * @since 0.7.0
    27      */
    28     public static function activate()
    29     {
    30         // Check to make sure the version of WordPress being used is compatible with the plugin
    31         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 images
    36         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 options
    41         $options = new \stdClass();
    42         $options->version = CCFIC_VERSION; // Current plugin version
    43         $options->auto_append = true; // Automatically append caption to featured image
    44         $options->container = true; // Wrap the caption HTML in a container div
    45 
    46         // Add options to database
    47         $result = add_option(CCFIC_KEY.'_options', $options);
    48 
    49         return $result;
    5020    }
    5121
  • featured-image-caption/trunk/featured-image-caption.php

    r1184833 r1187864  
    55 * Plugin URI: https://christiaanconover.com/code/wp-featured-image-caption?utm_source=wp-featured-image-caption
    66 * Description: Set a caption for the featured image of a post that can be displayed on your site.
    7  * Version: 0.8.0
     7 * Version: 0.8.1
    88 * Author: Christiaan Conover
    99 * Author URI: https://christiaanconover.com?utm_source=wp-featured-image-caption-author
     
    1212
    1313// Prevent direct access
    14 if ( ! defined( 'ABSPATH' ) ) {
    15     die( 'You cannot access this resource directly.' );
     14if (!defined('ABSPATH')) {
     15    die('You cannot access this resource directly.');
    1616}
    1717
    1818// 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 );
     19if (version_compare(phpversion(), '5.3', '<')) {
     20    trigger_error('PHP version '.phpversion().' is unsupported, must be version 5.3 or newer', E_USER_ERROR);
    2121
    2222    return;
     
    2424
    2525/* 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
     26define('CCFIC_ID', 'cc-featured-image-caption'); // Plugin ID
     27define('CCFIC_NAME', 'Featured Image Caption'); // Plugin name
     28define('CCFIC_VERSION', '0.8.1'); // Plugin version
     29define('CCFIC_WPVER', '3.5'); // Minimum required version of WordPress
     30define('CCFIC_KEY', 'cc_featured_image_caption'); // Database key
     31define('CCFIC_PATH', __FILE__); // Path to the primary plugin file
    3132
    32 
    33 // Plugin activation
    34 if( is_admin() ) {
    35     require_once 'classes/Manage.php';
     33if (is_admin()) {
    3634    // Plugin activation
    37     register_activation_hook( __FILE__, array( '\cconover\FeaturedImageCaption\Manage', 'activate' ) );
     35    register_activation_hook(__FILE__, 'ccfic_activate');
    3836}
    3937
     
    4139 * Plugin loader hook.
    4240 */
    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 
     41function cc_featured_image_caption_loader()
     42{
    4943    // Composer autoloader
    5044    require_once 'vendor/autoload.php';
     
    6761 * @return string The formatted caption.
    6862 */
    69 function cc_featured_image_caption( $echo = true, $html = true ) {
     63function cc_featured_image_caption($echo = true, $html = true)
     64{
    7065    // Call the caption data using the shortcode
    7166    $format = $html ? '' : ' format="plaintext"';
    72     $caption = do_shortcode( '[ccfic'.$format.']');
     67    $caption = do_shortcode('[ccfic'.$format.']');
    7368
    7469    // If the result should be printed to the screen.
    75     if ( $echo ) {
     70    if ($echo) {
    7671        echo $caption;
    7772    } else {
     
    9085 * @return bool
    9186 */
    92 function cc_has_featured_image_caption() {
     87function cc_has_featured_image_caption()
     88{
    9389    return true;
    9490}
     91
     92/**
     93 * Plugin activation.
     94 *
     95 * @since 0.8.1
     96 */
     97function 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  
    22Contributors: cconover
    33Donate link: https://christiaanconover.com/code/wp-featured-image-caption?ref=plugin-readme
    4 Tags: image, caption, featured image
     4Tags: image, caption, featured image, shortcode
    55Requires at least: 3.5
    66Tested up to: 4.2.2
    7 Stable tag: 0.8.0
     7Stable tag: 0.8.1
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Easily add and display a caption to the featured image of a post.
     11Easily add and display a caption for the featured image of a post.
    1212
    1313== Description ==
     
    9090== Changelog ==
    9191
     92= 0.8.1 =
     93Restricts the automatic caption insertion to only occur in The Loop.
     94
    9295= 0.8.0 =
    9396* 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  
    55require_once __DIR__ . '/composer' . '/autoload_real.php';
    66
    7 return ComposerAutoloaderIniteca468262d93b38e7a3bc5e61d940f43::getLoader();
     7return ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4::getLoader();
  • featured-image-caption/trunk/vendor/composer/autoload_real.php

    r1184833 r1187864  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderIniteca468262d93b38e7a3bc5e61d940f43
     5class ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4
    66{
    77    private static $loader;
     
    2020        }
    2121
    22         spl_autoload_register(array('ComposerAutoloaderIniteca468262d93b38e7a3bc5e61d940f43', 'loadClassLoader'), true, true);
     22        spl_autoload_register(array('ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4', 'loadClassLoader'), true, true);
    2323        self::$loader = $loader = new \Composer\Autoload\ClassLoader();
    24         spl_autoload_unregister(array('ComposerAutoloaderIniteca468262d93b38e7a3bc5e61d940f43', 'loadClassLoader'));
     24        spl_autoload_unregister(array('ComposerAutoloaderInitc91643edaea3771dd8e0cc942282d3a4', 'loadClassLoader'));
    2525
    2626        $map = require __DIR__ . '/autoload_namespaces.php';
     
    4545}
    4646
    47 function composerRequireeca468262d93b38e7a3bc5e61d940f43($file)
     47function composerRequirec91643edaea3771dd8e0cc942282d3a4($file)
    4848{
    4949    require $file;
Note: See TracChangeset for help on using the changeset viewer.