-
Notifications
You must be signed in to change notification settings - Fork 0
/
koowa.php
74 lines (57 loc) · 1.68 KB
/
koowa.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
<?php
/**
* @package Koowa
* @version .01
*/
/*
Plugin Name: Koowa for Wordpress
Plugin URI: http://github.com/raeldc/koowa-wordpress
Description: Use Koowa Framework to develop Plugins in Wordpress
Author: Israel D. Canasa
Version: 0.1
Author URI: http://israelcanasa.com/
*/
/**
* Initialize
*/
add_action('plugins_loaded', 'koowa_bootstrap');
function koowa_bootstrap()
{
$path = WP_PLUGIN_DIR.'/koowa/library/koowa.php';
if (!file_exists($path))
return false;
require_once $path;
$application = is_admin() ? 'admin' : 'site';
Koowa::getInstance(array(
'cache_namespace' => 'koowa-'.$application,
'cache_enabled' => extension_loaded('apc')
));
$manager = KObjectManager::getInstance();
$loader = $manager->getClassLoader();
//Application Basepaths
$loader->registerBasepath('site', 'site');
$loader->registerBasepath('admin', 'admin');
//Component Locator
require_once dirname(__FILE__).'/components/koowa/class/locator/component.php';
$loader->registerLocator(
new ComKoowaClassLocatorComponent(array(
'namespaces' => array(
'\\' => __DIR__,
)
))
);
$manager->registerLocator('lib:object.locator.component');
// Boostrap other koowa extensions
do_action('koowa_before_bootstrap');
// Call the Bootstrapper
$manager->getObject('com:application.bootstrapper')->bootstrap();
// Boostrap other koowa extensions
do_action('koowa_after_bootstrap');
//Setup the request
$manager->getObject('request')
->registerApplication('site', '')
->registerApplication('admin', '/wp-admin')
->setApplication($application);
add_action('init', array($manager->getObject('application'), 'run'));
KStringInflector::addWord('settings', 'settings');
}