classes
13 years ago
lang
13 years ago
lib
13 years ago
samples
13 years ago
styles
13 years ago
vendor
13 years ago
.htaccess
13 years ago
init.php
13 years ago
license.txt
13 years ago
loader.php
13 years ago
loader.php
72 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Framework Loader. |
| 4 | * This file MUST always be included at startup when using the framework. |
| 5 | * |
| 6 | * @version $Rev: 203758 $ |
| 7 | * @author Jordi Canals |
| 8 | * @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals |
| 9 | * @license GNU General Public License version 2 |
| 10 | * @link http://alkivia.org |
| 11 | * @package Alkivia |
| 12 | * @subpackage Framework |
| 13 | * |
| 14 | |
| 15 | Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat> |
| 16 | |
| 17 | This program is free software; you can redistribute it and/or |
| 18 | modify it under the terms of the GNU General Public License |
| 19 | version 2 as published by the Free Software Foundation. |
| 20 | |
| 21 | This program is distributed in the hope that it will be useful, |
| 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 | GNU General Public License for more details. |
| 25 | |
| 26 | You should have received a copy of the GNU General Public License |
| 27 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 | */ |
| 29 | |
| 30 | // TODO: Bybapass framework loading if already loaded. |
| 31 | // TODO: Load Framework at plugins_loaded or init to allow filters on plugins? |
| 32 | // If loaded on plufins_loaded will not load for themes. |
| 33 | |
| 34 | $akf_version = '0.8'; |
| 35 | |
| 36 | if ( file_exists(WP_CONTENT_DIR . '/alkivia.php') ) { |
| 37 | /** Loads alkivia.php to override some default constants */ |
| 38 | include_once( WP_CONTENT_DIR . '/alkivia.php'); |
| 39 | } |
| 40 | |
| 41 | // Check version for installs and updates. |
| 42 | $akf_current = get_option('ak_framework_version'); |
| 43 | $akf_path = dirname(__FILE__); |
| 44 | |
| 45 | if ( false === $akf_current ) { |
| 46 | // Install the framework. Save version and path. |
| 47 | add_option('ak_framework_version', $akf_version); |
| 48 | add_option('ak_framework_path', $akf_path); |
| 49 | } elseif ( version_compare($akf_version, $akf_current, '>') ) { |
| 50 | // Update framework if newer. Save version and path. |
| 51 | update_option('ak_framework_version', $akf_version); |
| 52 | update_option('ak_framework_path', $akf_path); |
| 53 | } else { |
| 54 | // Using installed version. |
| 55 | $akf_db_path = get_option('ak_framework_path'); |
| 56 | if ( false !== $akf_db_path && is_dir($akf_db_path) ) { |
| 57 | // Only use current if still present. Could be from an uninstalled plugin. |
| 58 | $akf_path = $akf_db_path; |
| 59 | } else { |
| 60 | // If installed version not present, use current. |
| 61 | update_option('ak_framework_version', $akf_version); |
| 62 | update_option('ak_framework_path', $akf_path); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | if ( ! defined('AK_FRAMEWORK') ) { |
| 67 | // Define the framework path. |
| 68 | define ('AK_FRAMEWORK', $akf_path ); |
| 69 | } |
| 70 | |
| 71 | include_once( AK_FRAMEWORK . '/init.php'); |
| 72 |