aboutsummaryrefslogtreecommitdiff
path: root/includes/load-yourls.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/load-yourls.php')
-rw-r--r--includes/load-yourls.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/includes/load-yourls.php b/includes/load-yourls.php
new file mode 100644
index 0000000..ae630b1
--- /dev/null
+++ b/includes/load-yourls.php
@@ -0,0 +1,26 @@
+<?php
+/* Bootstrap YOURLS
+ *
+ * This file initialize everything needed for YOURLS
+ * If you need to bootstrap YOURLS (ie access its functions and features) simply include this file.
+ */
+
+require __DIR__ . '/vendor/autoload.php';
+
+// Set up YOURLS config
+
+$config = new \YOURLS\Config\Config;
+/* The following require has to be at global level so the variables inside config.php, including user defined if any,
+ * are registered in the global scope. If this require is moved in \YOURLS\Config\Config, $yourls_user_passwords for
+ * instance isn't registered.
+ */
+if (!defined('YOURLS_CONFIGFILE')) {
+ define('YOURLS_CONFIGFILE', $config->find_config());
+}
+require_once YOURLS_CONFIGFILE;
+$config->define_core_constants();
+
+// Initialize YOURLS with default behaviors
+
+$init_defaults = new \YOURLS\Config\InitDefaults;
+new \YOURLS\Config\Init($init_defaults);