Plugin Directory

Changeset 2047243


Ignore:
Timestamp:
03/09/2019 05:25:39 PM (7 years ago)
Author:
cconover
Message:

Codebase for version 0.8.8

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

Legend:

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

    r2046347 r2047243  
    44Plugin URI: https://christiaanconover.com/code/wp-featured-image-caption?utm_source=wp-featured-image-caption
    55Description: Set a caption for the featured image of a post that can be displayed on your site.
    6 Version: 0.8.7
     6Version: 0.8.8
    77Author: Christiaan Conover
    88Author URI: https://christiaanconover.com?utm_source=wp-featured-image-caption-author
     
    1919define( 'CCFIC_ID', 'ccfic' ); // Plugin ID
    2020define( 'CCFIC_NAME', 'Featured Image Caption' ); // Plugin name
    21 define( 'CCFIC_VERSION', '0.8.7' ); // Plugin version
     21define( 'CCFIC_VERSION', '0.8.8' ); // Plugin version
    2222define( 'CCFIC_WPVER', '3.5' ); // Minimum required version of WordPress
    2323define( 'CCFIC_KEY', 'cc_featured_image_caption' ); // Database key (legacy support, ID now used)
     
    3636
    3737/**
     38 * Class autoloader
     39 *
     40 * Auto-loads classes for the plugin.
     41 *
     42 * @param string $class The fully-qualified class name.
     43 * @return void
     44 */
     45spl_autoload_register( function ( $class ) {
     46
     47    // project-specific namespace prefix
     48    $prefix = 'cconover\\FeaturedImageCaption\\';
     49
     50    // base directory for the namespace prefix
     51    $base_dir = __DIR__ . '/classes/';
     52
     53    // does the class use the namespace prefix?
     54    $len = strlen( $prefix );
     55    if ( strncmp( $prefix, $class, $len ) !== 0 ) {
     56        // no, move to the next registered autoloader
     57        return;
     58    }
     59
     60    // get the relative class name
     61    $relative_class = substr( $class, $len );
     62
     63    // replace the namespace prefix with the base directory, replace namespace
     64    // separators with directory separators in the relative class name, append
     65    // with .php
     66    $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
     67
     68    // if the file exists, require it
     69    if ( file_exists( $file ) ) {
     70        require $file;
     71    }
     72} );
     73
     74/**
    3875 * Plugin loader hook.
    3976 */
    4077function cc_featured_image_caption_loader()
    4178{
    42     // Composer autoloader
    43     require_once __DIR__ . '/vendor/autoload.php';
    44 
    4579    // Instantiate the plugin
    4680    $bootstrap = new \cconover\FeaturedImageCaption\Bootstrap();
  • featured-image-caption/trunk/readme.txt

    r2046347 r2047243  
    108108== Changelog ==
    109109
     110= 0.8.8 =
     111Replace the Composer autoloader with an inline autoloader, to reduce plugin size and improve performance.
     112
    110113= 0.8.7 =
    111114Fix an error caused by a relative include path.
Note: See TracChangeset for help on using the changeset viewer.