Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: af730fdcef
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 45 lines (42 sloc) 1.245 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<?php
/**
* Library Registration and Loader for WordPress
*
* @package Imperative
* @version 0.1
* @author Mike Schinkel <mike@newclarity.net>
* @author Micah Wood <micah@newclarity.net>
* @license http://opensource.org/licenses/gpl-2.0.php
* @copyright Copyright (c) 2012, NewClarity LLC
*
*/
define( 'IMPERATIVE_LIB', true );

if( ! function_exists( 'require_library' ) ) {
function require_library( $filepath ) {
global $wp_libraries;
if ( ! is_array( $wp_libraries ) )
$wp_libraries = array();
preg_match( '#/([-0-9a-zA-Z_]+)-([0-9.]+).php$#', $filepath, $match );
list( $major, $minor, $bugfix ) = explode( '.', "{$match[2]}.0.0" );
$version =
10000 * intval( $major ) +
100 * intval( $minor ) +
intval( $bugfix );
$wp_libraries[$match[1]][$version] = $filepath;
}
}

if( ! function_exists( 'load_libraries' ) ) {
add_action( 'after_setup_theme', 'load_libraries' );
function load_libraries() {
global $wp_libraries;
if ( is_array( $wp_libraries ) ) {
foreach ( $wp_libraries as $library ) {
if ( count( $library ) > 1 )
krsort( $library, SORT_NUMERIC );
$versions = array_values( $library );
if ( file_exists( $versions[0] ) )
require_once( $versions[0] );
}
}
}
}
Something went wrong with that request. Please try again.