Skip to content

Instantly share code, notes, and snippets.

@clrockwell
Created March 3, 2016 14:14
Show Gist options
  • Save clrockwell/3ed53f185052a421fc21 to your computer and use it in GitHub Desktop.
Save clrockwell/3ed53f185052a421fc21 to your computer and use it in GitHub Desktop.
<?php
$_full = TRUE;
if(!$this->drupal_bootstraped) {
$api_path = getcwd();
define('DRUPAL_ROOT', $this->drupal_root);
chdir($this->drupal_root);
//D7 is going to have GlobalRedirect interfere, set POST value to disabled it.
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
$_POST['X-MEDIQ_GLOBAL_REDIRECT_DISABLE'] = 'TRUE';
if ($_full) {
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
}
else {
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
require_once DRUPAL_ROOT . '/includes/path.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_LANGUAGE);
// Detect string handling method.
unicode_check();
// Undo magic quotes.
fix_gpc_magic();
file_get_stream_wrappers();
global $language;
if (!isset($language)) {
$language = language_default();
$types = language_types();
foreach ($types as $type) {
$GLOBALS[$type] = $language;
}
}
/**
* End check for required
*/
drupal_load('module', 'field');
drupal_load('module', 'ctools');
drupal_load('module', 'entity');
drupal_load('module', 'entityreference');
drupal_load('module', 'user');
drupal_load('module', 'usmlerx_com');
drupal_load('module', 'geofield');
module_invoke_all('init');
}
unset($_POST['X-MEDIQ_GLOBAL_REDIRECT_DISABLE']);
chdir($api_path);
$this->drupal_bootstraped = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment