This repository was archived by the owner on Apr 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
127 lines (105 loc) · 3.65 KB
/
init.php
File metadata and controls
127 lines (105 loc) · 3.65 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
* Framework Initialization.
* This file is called at framework load time.
*
* @version $Rev: 199485 $
* @author Jordi Canals
* @copyright Copyright (C) 2008, 2009, 2010 Jordi Canals
* @license GNU General Public License version 2
* @link http://alkivia.org
* @package Alkivia
* @subpackage Framework
*
Copyright 2008, 2009, 2010 Jordi Canals <devel@jcanals.cat>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Creates and returns the framework URL.
*
* @return string Framework URL
*/
function ak_styles_url ()
{
$dir = str_replace('\\', '/', WP_CONTENT_DIR);
$fmw = str_replace('\\', '/', AK_FRAMEWORK);
return str_replace($dir, WP_CONTENT_URL, $fmw) . '/styles';
}
// ================================================= SET GLOBAL CONSTANTS =====
if ( ! defined('AK_STYLES_URL') ) {
/** Define the framework URL */
define ( 'AK_STYLES_URL', ak_styles_url() );
}
if ( ! defined('AK_INI_FILE') ) {
/** Define the alkivia.ini filename and absoilute location */
define ( 'AK_INI_FILE', WP_CONTENT_DIR . '/alkivia.ini');
}
if ( ! defined('AK_CLASSES') ) {
/** Define the classes folder */
define ( 'AK_CLASSES', AK_FRAMEWORK . '/classes');
}
if ( ! defined('AK_LIB') ) {
/** Library folder for functions files */
define ( 'AK_LIB', AK_FRAMEWORK . '/lib');
}
if ( ! defined('AK_VENDOR') ) {
/** Vendor classes and libs */
define ('AK_VENDOR', AK_FRAMEWORK . '/vendor');
}
$akf_uploads = wp_upload_dir();
if ( ! defined('AK_UPLOAD_DIR') ) {
/** Absolute path to upload folder */
define ( 'AK_UPLOAD_DIR', $akf_uploads['basedir'] . '/alkivia');
}
if ( ! defined('AK_UPLOAD_URL') ) {
/** URL to upload folder. This could be replaced by a download manager. */
define ( 'AK_UPLOAD_URL', $akf_uploads['baseurl'] . '/alkivia');
}
// ============================================== SET GLOBAL ACTION HOOKS =====
/**
* Adds meta name for Alkivia Framework to head.
*
* @hook action 'wp_head'
* @access private
* @return void
*/
function _ak_framework_meta_tags() {
echo '<meta name="framework" content="Alkivia Framework ' . get_option('ak_framework_version') . '" />' . PHP_EOL;
}
add_action('wp_head', '_ak_framework_meta_tags');
/**
* Loads the framework translations.
* Sets the translation text domain to 'akvf'.
*
* @return bool true on success, false on failure
*/
function _ak_framework_translation()
{
$locale = get_locale();
$mofile = AK_FRAMEWORK . "/lang/$locale.mo";
return load_textdomain('akfw', $mofile);
}
add_action('init', '_ak_framework_translation');
// ================================================ INCLUDE ALL LIBRARIES =====
// Create the upload folder if does not exist.
if ( ! is_dir(AK_UPLOAD_DIR) ) {
wp_mkdir_p(AK_UPLOAD_DIR);
}
// Prepare the settings and objects libraries.
require_once ( AK_CLASSES . '/settings.php');
require_once ( AK_LIB . '/filesystem.php' );
require_once ( AK_LIB . '/formating.php' );
require_once ( AK_LIB . '/modules.php' );
require_once ( AK_LIB . '/objects.php' );
require_once ( AK_LIB . '/system.php' );
require_once ( AK_LIB . '/themes.php' );
require_once ( AK_LIB . '/users.php' );
do_action('ak_framework_loaded');