-
Notifications
You must be signed in to change notification settings - Fork 58
/
setup-theme.php
44 lines (36 loc) · 1.13 KB
/
setup-theme.php
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
/**
* Setup function that used for checking latest version of the core.
* It creates `$chery_core_version` global variable and writes the latest core version
* and it's path into it.
*
* @package Cherry_Framework
* @author Cherry Team <[email protected]>
* @copyright Copyright (c) 2012 - 2017, Cherry Team
* @link http://www.cherryframework.com/
* @license http://www.gnu.org/licenses/gpl-3.0.en.html
*/
return function () {
global $chery_core_version;
$path = get_template_directory() . '/cherry-framework/cherry-core.php';
$data = get_file_data( $path, array(
'version' => 'Version'
) );
if ( isset( $data['version'] ) ) {
$version = $data['version'];
}
$old_versions = null;
if ( null !== $chery_core_version ) {
$old_versions = array_keys( $chery_core_version );
}
if ( is_array( $old_versions ) && isset( $old_versions[0] ) ) {
$compare = version_compare( $old_versions[0], $version, '<' );
if ( $compare ) {
$chery_core_version = array();
$chery_core_version[ $version ] = $path;
}
} else {
$chery_core_version = array();
$chery_core_version[ $version ] = $path;
}
};