This repository has been archived by the owner on May 10, 2020. It is now read-only.
forked from Chemaclass/knob-mvc
/
functions.php
executable file
·70 lines (59 loc) · 2.13 KB
/
functions.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
<?php
/*
* This file is part of the Knob-mvc package.
*
* (c) José María Valera Reales <chemaclass@outlook.es>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once 'vendor/autoload.php';
use Libs\Actions;
use Libs\Filters;
use Libs\Widgets;
use Knob\Libs\Utils;
// --------------------------------------------------------------
// Some constants
// --------------------------------------------------------------
// BASE DIRECTORIES
define('PROJECT_DIR', dirname(__FILE__));
define('VENDOR_DIR', PROJECT_DIR . '/vendor');
define('VENDOR_KNOB_BASE_DIR', VENDOR_DIR . '/chemaclass/knob-base');
define('VENDOR_KNOB_BASE_WP_DIR', VENDOR_KNOB_BASE_DIR . '/wp');
define('APP_DIR', PROJECT_DIR . '/app');
define('PAGES_DIR', APP_DIR . '/pages');
define('CONFIG_DIR', APP_DIR . '/config');
$configFile = Utils::getConfigFile();
$env = isset($configFile['env']) ? $configFile['env'] : [];
$siteUrl = get_site_url();
// URL ENVEROMENTS
define('URL_PRO', isset($env['pro']) ? $env['pro'] : $siteUrl);
define('URL_DEV', isset($env['dev']) ? $env['dev'] : $siteUrl);
define('URL_LOC', isset($env['loc']) ? $env['loc'] : $siteUrl);
// SOME DIRECTORIES
define('PUBLIC_DIR', get_template_directory_uri() . '/public');
define('COMPONENTS_DIR', get_template_directory_uri() . '/vendor/components');
// BLOG_INFO
function getBlogTitle()
{
if (is_home()) {
return get_bloginfo('name');
} else {
return wp_title("-", false, "right") . " " . get_bloginfo('name');
}
}
define('BLOG_TITLE', getBlogTitle());
define('ADMIN_EMAIL', get_bloginfo('admin_email'));
// --------------------------------------------------------------
// Actions
// --------------------------------------------------------------
Actions::setup();
// --------------------------------------------------------------
// Filters
// --------------------------------------------------------------
Filters::setup();
// --------------------------------------------------------------
// WidgetController
// --------------------------------------------------------------
Widgets::setup();
@include_once 'test.php';