| 1 |
<?php |
| 2 |
/** |
| 3 |
* This is a file takes advantage of anonymous functions to to load the latest version of the AyeCode UI Settings. |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Bail if we are not in WP. |
| 8 |
*/ |
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
/** |
| 14 |
* Set the version only if its the current newest while loading. |
| 15 |
*/ |
| 16 |
add_action('after_setup_theme', function () { |
| 17 |
global $ayecode_ui_version,$ayecode_ui_file_key; |
| 18 |
$this_version = "0.2.51"; |
| 19 |
if(empty($ayecode_ui_version) || version_compare($this_version , $ayecode_ui_version, '>')){ |
| 20 |
$ayecode_ui_version = $this_version ; |
| 21 |
$ayecode_ui_file_key = wp_hash( __FILE__ ); |
| 22 |
} |
| 23 |
},0); |
| 24 |
|
| 25 |
/** |
| 26 |
* Load this version of WP Bootstrap Settings only if the file hash is the current one. |
| 27 |
*/ |
| 28 |
add_action('after_setup_theme', function () { |
| 29 |
global $ayecode_ui_file_key; |
| 30 |
if($ayecode_ui_file_key && $ayecode_ui_file_key == wp_hash( __FILE__ )){ |
| 31 |
include_once( dirname( __FILE__ ) . '/includes/class-aui.php' ); |
| 32 |
include_once( dirname( __FILE__ ) . '/includes/ayecode-ui-settings.php' ); |
| 33 |
} |
| 34 |
},1); |
| 35 |
|
| 36 |
/** |
| 37 |
* Add the function that calls the class. |
| 38 |
*/ |
| 39 |
if(!function_exists('aui')){ |
| 40 |
function aui(){ |
| 41 |
if(!class_exists("AUI",false)){ |
| 42 |
return false; |
| 43 |
} |
| 44 |
return AUI::instance(); |
| 45 |
} |
| 46 |
} |
| 47 |
|