-
Notifications
You must be signed in to change notification settings - Fork 0
/
kojo.php
108 lines (89 loc) · 3.05 KB
/
kojo.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
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
<?php defined('JPATH_BASE') or die();
/**
* Kojo System plugin
*/
class plgSystemKojo extends JPlugin
{
public function InitializeKoJo()
{
if (defined('KOJO_INITIALIZED'))
{
return;
}
$application = JPATH_PLUGINS.DS.'system'.DS.'kojo'.DS.'kojo';
$modules = JPATH_PLUGINS.DS.'system'.DS.'kojo'.DS.'library';
$system = JPATH_PLUGINS.DS.'system'.DS.'kojo'.DS.'kohana';
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
*
* @see http://kohanaframework.org/guide/about.install#ext
*/
define('EXT', '.php');
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
// Make the application relative to the docroot
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
$application = DOCROOT.$application;
// Make the modules relative to the docroot
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
// Make the system relative to the docroot
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $system);
// Load the base, low-level functions
require APPPATH.'base'.EXT;
// Load the core Kohana class
require SYSPATH.'classes/kohana/core'.EXT;
require APPPATH.'classes/kojo'.EXT;
require SYSPATH.'classes/kohana'.EXT;
/**
* Enable the Kohana auto-loader.
*
* @see http://kohanaframework.org/guide/using.autoloading
* @see http://php.net/spl_autoload_register
*/
spl_autoload_register(array('KoJo', 'auto_load'));
/**
* Enable the Kohana auto-loader for unserialization.
*
* @see http://php.net/spl_autoload_call
* @see http://php.net/manual/var.configuration.php#unserialize-callback-func
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');
KoJo::init(array(
'base_url' => JURI::base(),
'index_file' => 'index.php',
'cache_dir' => JPATH_SITE.DS.'cache',
));
KoJo::$log->attach(
new Kohana_Log_File(
JFactory::getConfig()->getValue('log_path')
)
);
KoJo::$config->attach(new Kohana_Config_File);
KoJo::modules(array(
'cache' => MODPATH.'cache', // Caching with multiple backends
'magic' => MODPATH.'magic', // Classes for Auto-Magic patterns. Nooku style.
'kostache' => MODPATH.'kostache', // Logicless templates plus a nice View Class
'orm' => MODPATH.'orm', // Database access
'database' => MODPATH.'database', // Database access
'pagination' => MODPATH.'pagination', // Paging of results
'jelly' => MODPATH.'jelly', // The best ORM out there
));
define('KOJO_INITIALIZED', TRUE);
}
public function ExitKojo()
{
if (defined('KOJO_INITIALIZED'))
{
KoJo::deinit();
}
}
}