forked from GlotPress/GlotPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gp-settings.php
137 lines (107 loc) · 4.69 KB
/
gp-settings.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
/**
* Used to set up variables, constants and to include the GlotPress
* procedural and class library.
*
* @package GlotPress
* @since 1.0.0
*/
require_once GP_PATH . GP_INC . '/system.php';
if ( ! defined( 'GP_LOCALES_PATH' ) ) {
define( 'GP_LOCALES_PATH', GP_PATH . 'locales/' );
}
if ( ! defined( 'DATE_MYSQL' ) ) {
define( 'DATE_MYSQL', 'Y-m-d H:i:s' );
}
if ( ! defined( 'GP_TESTS_PATH' ) ) {
define( 'GP_TESTS_PATH', GP_PATH . 't/' );
}
require_once GP_PATH . GP_INC . 'gp.php';
global $wpdb, $gp_table_prefix;
if ( ! isset( $gp_table_prefix ) ) {
$gp_table_prefix = $GLOBALS['table_prefix'] . 'gp_';
}
$table_names = array( 'translations', 'translation_sets', 'glossaries', 'glossary_entries', 'originals', 'projects', 'meta', 'permissions' );
foreach ( $table_names as $table ) {
$wpdb->{'gp_' . $table} = $gp_table_prefix . $table;
}
if ( defined( 'CUSTOM_PERMISSIONS_TABLE' ) ) {
$wpdb->gp_permissions = CUSTOM_PERMISSIONS_TABLE;
}
if ( ! defined( 'GP_TMPL_PATH' ) ) {
define( 'GP_TMPL_PATH', GP_PATH . 'gp-templates/' );
}
require_once GP_PATH . GP_INC . 'meta.php';
require_once GP_PATH . GP_INC . 'misc.php';
require_once GP_PATH . GP_INC . 'url.php';
require_once GP_PATH . GP_INC . 'strings.php';
require_once GP_PATH . GP_INC . 'template.php';
require_once GP_PATH . GP_INC . 'template-links.php';
require_once GP_PATH . GP_INC . 'cli.php';
require_once GP_PATH . GP_INC . 'assets-loader.php';
require_once GP_PATH . GP_INC . 'rewrite.php';
require_once GP_PATH . GP_INC . 'default-filters.php';
require_once ABSPATH . WPINC . '/pomo/mo.php';
require_once ABSPATH . WPINC . '/pomo/po.php';
if ( ! class_exists( 'GP_Locale' ) || ! class_exists( 'GP_Locales' ) ) {
require_once GP_LOCALES_PATH . 'locales.php';
}
/*
* We assume all variables set in this file will be global.
* If the file is invoked inside a function, we will lose them all.
* So, make all local variables, global.
*/
gp_set_globals( get_defined_vars() );
require_once GP_PATH . GP_INC . 'warnings.php';
require_once GP_PATH . GP_INC . 'validation.php';
require_once GP_PATH . GP_INC . 'advanced-permissions.php';
require_once GP_PATH . GP_INC . 'thing.php';
require_once GP_PATH . GP_INC . 'things/original.php';
require_once GP_PATH . GP_INC . 'things/permission.php';
require_once GP_PATH . GP_INC . 'things/project.php';
require_once GP_PATH . GP_INC . 'things/translation-set.php';
require_once GP_PATH . GP_INC . 'things/translation.php';
require_once GP_PATH . GP_INC . 'things/validator-permission.php';
require_once GP_PATH . GP_INC . 'things/administrator-permission.php';
require_once GP_PATH . GP_INC . 'things/glossary.php';
require_once GP_PATH . GP_INC . 'things/glossary-entry.php';
require_once GP_PATH . GP_INC . 'route.php';
require_once GP_PATH . GP_INC . 'router.php';
require_once GP_PATH . GP_INC . 'routes/_main.php';
require_once GP_PATH . GP_INC . 'routes/index.php';
require_once GP_PATH . GP_INC . 'routes/original.php';
require_once GP_PATH . GP_INC . 'routes/profile.php';
require_once GP_PATH . GP_INC . 'routes/settings.php';
require_once GP_PATH . GP_INC . 'routes/project.php';
require_once GP_PATH . GP_INC . 'routes/translation-set.php';
require_once GP_PATH . GP_INC . 'routes/translation.php';
require_once GP_PATH . GP_INC . 'routes/glossary.php';
require_once GP_PATH . GP_INC . 'routes/glossary-entry.php';
require_once GP_PATH . GP_INC . 'routes/locale.php';
GP::$translation_warnings = new GP_Translation_Warnings();
GP::$builtin_translation_warnings = new GP_Builtin_Translation_Warnings();
GP::$builtin_translation_warnings->add_all( GP::$translation_warnings );
GP::$router = new GP_Router();
GP::$formats = array();
require_once GP_PATH . GP_INC . 'format.php';
require_once GP_PATH . GP_INC . 'formats/format-android.php';
require_once GP_PATH . GP_INC . 'formats/format-pomo.php';
require_once GP_PATH . GP_INC . 'formats/format-resx.php';
require_once GP_PATH . GP_INC . 'formats/format-strings.php';
require_once GP_PATH . GP_INC . 'formats/format-properties.php';
require_once GP_PATH . GP_INC . 'formats/format-json.php';
require_once GP_PATH . GP_INC . 'formats/format-jed1x.php';
require_once GP_PATH . GP_INC . 'formats/format-ngx.php';
// Let's do it again, there are more variables added since last time we called it.
gp_set_globals( get_defined_vars() );
GP::$router->set_default_routes();
if ( ! defined( 'GP_ROUTING' ) ) {
define( 'GP_ROUTING', false );
}
// Let's check to see if we need to run the upgrade routine but only run it on the admin side.
if ( is_admin() && GP_DB_VERSION > get_option( 'gp_db_version' ) ) {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
require_once GP_PATH . GP_INC . 'install-upgrade.php';
require_once GP_PATH . GP_INC . 'schema.php';
gp_upgrade_db();
}