| @@ -2,15 +2,15 @@ | ||
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * Winter_MVC library |
| 5 | 5 | * |
| 6 | - * @version 2.5 | |
| 6 | + * @version 3.7 | |
| 7 | 7 | * |
| 8 | 8 | * @author SWIT |
| 9 | 9 | * @link https://github.com/sandiwinter/winter_mvc |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -$Winter_MVC_version_this = 2.5; | |
| 12 | +$Winter_MVC_version_this = 3.7; | |
| 13 | 13 | |
| 14 | 14 | global $Winter_MVC; |
| 15 | 15 | |
| 16 | 16 | $winter_mvc_active_plugins = get_option( 'winter_mvc_active_plugins', array() ); |
| @@ -16,17 +16,18 @@ | ||
| 16 | 16 | $winter_mvc_active_plugins = get_option( 'winter_mvc_active_plugins', array() ); |
| 17 | 17 | |
| 18 | 18 | $winter_mvc_active_plugins[dirname( __FILE__ )] = |
| 19 | 19 | array('winter_mvc_version' => $Winter_MVC_version_this, |
| 20 | - 'winter_mvc_file' => __FILE__ | |
| 20 | + 'winter_mvc_file' => substr(__FILE__, strripos(__FILE__, basename( plugin_dir_path( dirname( __FILE__ , 2 ) ) ))) | |
| 21 | 21 | ); |
| 22 | - | |
| 22 | + | |
| 23 | 23 | // get latest version |
| 24 | 24 | $winter_mvc_latest_version = array(); |
| 25 | 25 | |
| 26 | 26 | foreach($winter_mvc_active_plugins as $lib_dir => $lib_data) |
| 27 | -{ | |
| 28 | - if(file_exists($lib_data['winter_mvc_file']) && isset($lib_data['winter_mvc_version'])) | |
| 27 | +{ | |
| 28 | + /* compatible with old */ | |
| 29 | + if(stripos($lib_data['winter_mvc_file'], 'plugins') !== FALSE && file_exists($lib_data['winter_mvc_file']) && isset($lib_data['winter_mvc_version'])) | |
| 29 | 30 | { |
| 30 | 31 | if(empty($winter_mvc_latest_version) || $winter_mvc_latest_version['winter_mvc_version'] < $lib_data['winter_mvc_version']) |
| 31 | 32 | { |
| 32 | 33 | $winter_mvc_latest_version = $lib_data; |
| @@ -31,8 +32,15 @@ | ||
| 31 | 32 | { |
| 32 | 33 | $winter_mvc_latest_version = $lib_data; |
| 33 | 34 | } |
| 34 | 35 | } |
| 36 | + if(file_exists(WP_PLUGIN_DIR."/".$lib_data['winter_mvc_file']) && isset($lib_data['winter_mvc_version'])) | |
| 37 | + { | |
| 38 | + if(empty($winter_mvc_latest_version) || $winter_mvc_latest_version['winter_mvc_version'] < $lib_data['winter_mvc_version']) | |
| 39 | + { | |
| 40 | + $winter_mvc_latest_version = $lib_data; | |
| 41 | + } | |
| 42 | + } | |
| 35 | 43 | else |
| 36 | 44 | { |
| 37 | 45 | unset($winter_mvc_active_plugins[$lib_dir]); |
| 38 | 46 | } |
| @@ -46,11 +54,15 @@ | ||
| 46 | 54 | |
| 47 | 55 | require_once 'core/mvc_loader.php'; |
| 48 | 56 | $Winter_MVC = new MVC_Loader(); |
| 49 | 57 | } |
| 50 | -elseif(file_exists($winter_mvc_latest_version['winter_mvc_file'])) | |
| 58 | +elseif(stripos($winter_mvc_latest_version['winter_mvc_file'], 'plugins') !== FALSE && file_exists($winter_mvc_latest_version['winter_mvc_file'])) | |
| 51 | 59 | { |
| 52 | 60 | require_once $winter_mvc_latest_version['winter_mvc_file']; |
| 61 | +} | |
| 62 | +elseif(file_exists(WP_PLUGIN_DIR."/".$winter_mvc_latest_version['winter_mvc_file'])) | |
| 63 | +{ | |
| 64 | + require_once WP_PLUGIN_DIR."/".$winter_mvc_latest_version['winter_mvc_file']; | |
| 53 | 65 | } |
| 54 | 66 | else |
| 55 | 67 | { |
| 56 | 68 | define( 'WINTER_MVC_PATH', dirname( __FILE__ ) ); |