diff --git a/docs/guides/upgrading.rst b/docs/guides/upgrading.rst index e02f423d163..8b3b088fef8 100644 --- a/docs/guides/upgrading.rst +++ b/docs/guides/upgrading.rst @@ -224,14 +224,27 @@ Messages will no longer get the metadata 'msg' for newly created messages. This Removed Classes --------------- + - ``ElggInspector`` - ``FilePluginFile``: replace with ``ElggFile`` (or load with ``get_entity()``) Removed keys available via ``elgg_get_config()`` ------------------------------------------------ + - ``allowed_ajax_views`` + - ``dataroot_in_settings`` + - ``externals`` + - ``externals_map`` + - ``i18n_loaded_from_cache`` + - ``language_paths`` + - ``pagesetupdone`` + - ``registered_tag_metadata_names`` + - ``simplecache_enabled_in_settings`` + - ``translations`` + - ``viewpath`` - ``views`` + - ``view_path`` - ``viewtype`` - - ``viewpath`` + - ``wordblacklist`` Also note that plugins should not be accessing the global ``$CONFIG`` variable except for in ``settings.php``. @@ -244,6 +257,7 @@ Removed Functions - ``get_db_link()`` - ``load_plugins()`` - ``mysql_*()``: Elgg :ref:`no longer uses ext/mysql` + - ``remove_blacklist()`` - ``set_template_handler()`` Removed Plugin Hooks diff --git a/docs/info/config.php b/docs/info/config.php index 186c47b5c34..a5d8f615728 100644 --- a/docs/info/config.php +++ b/docs/info/config.php @@ -8,56 +8,6 @@ * @subpackage Configuration */ -/** - * Paths to scan for autoloading languages. - * - * Languages are automatically loaded for the site or - * user's default language. Plugins can extend or override strings. - * language_paths is an array of paths to scan for PHP files matching - * the default language. The order of paths is determined by the plugin load order, - * with later entries overriding earlier. Language files within these paths are - * named as the two-letter ISO 639-1 country codes for the language they represent. - * - * Language paths are stored as array keys in the format: - * - * $CONFIG->language_paths[str $language_path] = true - * - * - * @link http://en.wikipedia.org/wiki/ISO_639-1 - * @see register_language() - * @global array $CONFIG->language_paths - */ -$CONFIG->language_paths; - - -/** - * String translations for the current language. - * - * Elgg uses a key-based system for string internationalization, which - * is accessed with {@link elgg_echo()}. - * - * Translations are stored as an array in the following format: - * - * $CONFIG->translations[str $language_code][str $string_key] = str 'Translated Language String'; - * - * - * @see register_translation() - * @see elgg_echo() - * @global array $CONFIG->translations - */ -$CONFIG->translations; - -/** - * An array of metadata names to be used as tags. - * - * Because tags are simply names of meatdata, This is used - * in search to prevent data exposure by searching on - * arbitrary metadata. - * - * @global array $CONFIG->registered_tag_metadata_names - */ -$CONFIG->registered_tag_metadata_names; - /** * The full path where Elgg is installed. * @@ -65,13 +15,6 @@ */ $CONFIG->path; -/** - * The full path for core views. - * - * @global string $CONFIG->view_path - */ -$CONFIG->view_path; - /** * The full path where plugins are stored. * @@ -235,13 +178,6 @@ */ $CONFIG->menu_items_custom_items; -/** - * A list of valid view types as discovered. - * - * @global array $CONFIG->view_types - */ -$CONFIG->view_types; - /** * A list of plugins and their load order * @@ -278,14 +214,6 @@ */ $CONFIG->servicehandler; -/** - * A list of stop works for search. Not currently used. - * - * @global array $CONFIG->wordblacklist - * @todo currently unused. - */ -$CONFIG->wordblacklist; - /** * A list of menu contexts for menus registered with {@link add_menu()}. Not currently used. * @@ -336,4 +264,72 @@ * * @global string $CONFIG->exception_include */ -$CONFIG->exception_include = ''; \ No newline at end of file +$CONFIG->exception_include = ''; + +/** + * Paths to scan for autoloading languages. + * + * Languages are automatically loaded for the site or + * user's default language. Plugins can extend or override strings. + * language_paths is an array of paths to scan for PHP files matching + * the default language. The order of paths is determined by the plugin load order, + * with later entries overriding earlier. Language files within these paths are + * named as the two-letter ISO 639-1 country codes for the language they represent. + * + * Language paths are stored as array keys in the format: + * + * $_ELGG->language_paths[str $language_path] = true + * + * + * @link http://en.wikipedia.org/wiki/ISO_639-1 + * @see register_language() + * @global array $_ELGG->language_paths + * @access private + */ +$_ELGG->language_paths; + +/** + * String translations for the current language. + * + * Elgg uses a key-based system for string internationalization, which + * is accessed with {@link elgg_echo()}. + * + * Translations are stored as an array in the following format: + * + * $_ELGG->translations[str $language_code][str $string_key] = str 'Translated Language String'; + * + * + * @see register_translation() + * @see elgg_echo() + * @global array $_ELGG->translations + * @access private + */ +$_ELGG->translations; + +/** + * An array of metadata names to be used as tags. + * + * Because tags are simply names of meatdata, This is used + * in search to prevent data exposure by searching on + * arbitrary metadata. + * + * @global array $_ELGG->registered_tag_metadata_names + * @access private + */ +$_ELGG->registered_tag_metadata_names; + +/** + * The full path for core views. + * + * @global string $_ELGG->view_path + * @access private + */ +$_ELGG->view_path; + +/** + * A list of valid view types as discovered. + * + * @global array $_ELGG->view_types + * @access private + */ +$_ELGG->view_types; diff --git a/engine/classes/Elgg/Application.php b/engine/classes/Elgg/Application.php index 5e1d5f12fa2..108b0ad3911 100644 --- a/engine/classes/Elgg/Application.php +++ b/engine/classes/Elgg/Application.php @@ -79,6 +79,18 @@ public function __construct(ServiceProvider $services = null) { $START_MICROTIME = microtime(true); } + /** + * This was introduced in 2.0 in order to remove all internal non-API state from $CONFIG. This will + * be a breaking change, but frees us to refactor in 2.x without fear of plugins depending on + * $CONFIG. + * + * @access private + */ + global $_ELGG; + if (!isset($_ELGG)) { + $_ELGG = new \stdClass(); + } + $this->engine_dir = dirname(dirname(__DIR__)); $this->install_dir = dirname($this->engine_dir); } diff --git a/engine/classes/Elgg/Application/CacheHandler.php b/engine/classes/Elgg/Application/CacheHandler.php index c8c2e811199..7abcc2e9f4c 100644 --- a/engine/classes/Elgg/Application/CacheHandler.php +++ b/engine/classes/Elgg/Application/CacheHandler.php @@ -311,13 +311,13 @@ protected function renderView($view, $viewtype) { // disable error reporting so we don't cache problems $this->config->set('debug', null); - // @todo elgg_view() checks if the page set is done (isset($CONFIG->pagesetupdone)) and + // @todo elgg_view() checks if the page set is done (isset($GLOBALS['_ELGG']->pagesetupdone)) and // triggers an event if it's not. Calling elgg_view() here breaks submenus // (at least) because the page setup hook is called before any // contexts can be correctly set (since this is called before page_handler()). // To avoid this, lie about $CONFIG->pagehandlerdone to force // the trigger correctly when the first view is actually being output. - $this->config->set('pagesetupdone', true); + $GLOBALS['_ELGG']->pagesetupdone = true; return elgg_view($view); } diff --git a/engine/classes/Elgg/Assets/ExternalFiles.php b/engine/classes/Elgg/Assets/ExternalFiles.php index 7b6e4c63d27..eb67e180961 100644 --- a/engine/classes/Elgg/Assets/ExternalFiles.php +++ b/engine/classes/Elgg/Assets/ExternalFiles.php @@ -64,7 +64,7 @@ public function register($type, $name, $url, $location, $priority = 500) { // no negative priorities right now. $priority = max((int)$priority, 0); - $item = elgg_extract($name, $this->CONFIG->externals_map[$type]); + $item = elgg_extract($name, $GLOBALS['_ELGG']->externals_map[$type]); if ($item) { // updating a registered item @@ -73,10 +73,10 @@ public function register($type, $name, $url, $location, $priority = 500) { $item->location = $location; // if loaded before registered, that means it hasn't been added to the list yet - if ($this->CONFIG->externals[$type]->contains($item)) { - $priority = $this->CONFIG->externals[$type]->move($item, $priority); + if ($GLOBALS['_ELGG']->externals[$type]->contains($item)) { + $priority = $GLOBALS['_ELGG']->externals[$type]->move($item, $priority); } else { - $priority = $this->CONFIG->externals[$type]->add($item, $priority); + $priority = $GLOBALS['_ELGG']->externals[$type]->add($item, $priority); } } else { $item = new \stdClass(); @@ -84,10 +84,10 @@ public function register($type, $name, $url, $location, $priority = 500) { $item->url = $url; $item->location = $location; - $priority = $this->CONFIG->externals[$type]->add($item, $priority); + $priority = $GLOBALS['_ELGG']->externals[$type]->add($item, $priority); } - - $this->CONFIG->externals_map[$type][$name] = $item; + + $GLOBALS['_ELGG']->externals_map[$type][$name] = $item; return $priority !== false; } @@ -105,11 +105,11 @@ public function unregister($type, $name) { $this->bootstrap($type); $name = trim(strtolower($name)); - $item = elgg_extract($name, $this->CONFIG->externals_map[$type]); + $item = elgg_extract($name, $GLOBALS['_ELGG']->externals_map[$type]); if ($item) { - unset($this->CONFIG->externals_map[$type][$name]); - return $this->CONFIG->externals[$type]->remove($item); + unset($GLOBALS['_ELGG']->externals_map[$type][$name]); + return $GLOBALS['_ELGG']->externals[$type]->remove($item); } return false; @@ -130,7 +130,7 @@ public function load($type, $name) { $name = trim(strtolower($name)); - $item = elgg_extract($name, $this->CONFIG->externals_map[$type]); + $item = elgg_extract($name, $GLOBALS['_ELGG']->externals_map[$type]); if ($item) { // update a registered item @@ -140,9 +140,9 @@ public function load($type, $name) { $item->loaded = true; $item->url = ''; $item->location = ''; - - $this->CONFIG->externals[$type]->add($item); - $this->CONFIG->externals_map[$type][$name] = $item; + + $GLOBALS['_ELGG']->externals[$type]->add($item); + $GLOBALS['_ELGG']->externals_map[$type][$name] = $item; } } @@ -158,11 +158,11 @@ public function getLoadedFiles($type, $location) { if ( - isset($this->CONFIG->externals) - && isset($this->CONFIG->externals[$type]) - && $this->CONFIG->externals[$type] instanceof \ElggPriorityList + isset($GLOBALS['_ELGG']->externals) + && isset($GLOBALS['_ELGG']->externals[$type]) + && $GLOBALS['_ELGG']->externals[$type] instanceof \ElggPriorityList ) { - $items = $this->CONFIG->externals[$type]->getElements(); + $items = $GLOBALS['_ELGG']->externals[$type]->getElements(); $items = array_filter($items, function($v) use ($location) { return $v->loaded == true && $v->location == $location; @@ -178,27 +178,27 @@ public function getLoadedFiles($type, $location) { } /** - * Bootstraps the externals data structure in $CONFIG. + * Bootstraps the externals data structure in $_ELGG. * * @param string $type The type of external, js or css. * @return null */ protected function bootstrap($type) { - if (!isset($this->CONFIG->externals)) { - $this->CONFIG->externals = array(); + if (!isset($GLOBALS['_ELGG']->externals)) { + $GLOBALS['_ELGG']->externals = array(); } - if (!isset($this->CONFIG->externals[$type]) || !$this->CONFIG->externals[$type] instanceof \ElggPriorityList) { - $this->CONFIG->externals[$type] = new \ElggPriorityList(); + if (!isset($GLOBALS['_ELGG']->externals[$type]) || !$GLOBALS['_ELGG']->externals[$type] instanceof \ElggPriorityList) { + $GLOBALS['_ELGG']->externals[$type] = new \ElggPriorityList(); } - if (!isset($this->CONFIG->externals_map)) { - $this->CONFIG->externals_map = array(); + if (!isset($GLOBALS['_ELGG']->externals_map)) { + $GLOBALS['_ELGG']->externals_map = array(); } - if (!isset($this->CONFIG->externals_map[$type])) { - $this->CONFIG->externals_map[$type] = array(); + if (!isset($GLOBALS['_ELGG']->externals_map[$type])) { + $GLOBALS['_ELGG']->externals_map[$type] = array(); } } } \ No newline at end of file diff --git a/engine/classes/Elgg/Cache/SystemCache.php b/engine/classes/Elgg/Cache/SystemCache.php index 6ce089267ca..d614936d1f0 100644 --- a/engine/classes/Elgg/Cache/SystemCache.php +++ b/engine/classes/Elgg/Cache/SystemCache.php @@ -144,7 +144,7 @@ function loadAll() { if (!is_string($data)) { return; } - $this->CONFIG->view_types = unserialize($data); + $GLOBALS['_ELGG']->view_types = unserialize($data); // Note: We don't need view_overrides for operation. Inspector can pull this from the cache @@ -164,16 +164,16 @@ function init() { // cache system data if enabled and not loaded if (!$this->CONFIG->system_cache_loaded) { - $this->save('view_types', serialize($this->CONFIG->view_types)); + $this->save('view_types', serialize($GLOBALS['_ELGG']->view_types)); _elgg_services()->views->cacheConfiguration($this); } - if (!$this->CONFIG->i18n_loaded_from_cache) { + if (!$GLOBALS['_ELGG']->i18n_loaded_from_cache) { _elgg_services()->translator->reloadAllTranslations(); - foreach ($this->CONFIG->translations as $lang => $map) { + foreach ($GLOBALS['_ELGG']->translations as $lang => $map) { $this->save("$lang.lang", serialize($map)); } } diff --git a/engine/classes/Elgg/Database/Plugins.php b/engine/classes/Elgg/Database/Plugins.php index 3eee010b9a8..d7b75ee7b2c 100644 --- a/engine/classes/Elgg/Database/Plugins.php +++ b/engine/classes/Elgg/Database/Plugins.php @@ -330,7 +330,7 @@ function load() { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_VIEWS; } - if (elgg_get_config('i18n_loaded_from_cache')) { + if (!empty($GLOBALS['_ELGG']->i18n_loaded_from_cache)) { $start_flags = $start_flags & ~ELGG_PLUGIN_REGISTER_LANGUAGES; } diff --git a/engine/classes/Elgg/I18n/Translator.php b/engine/classes/Elgg/I18n/Translator.php index af2d1733b63..f0661d8fc62 100644 --- a/engine/classes/Elgg/I18n/Translator.php +++ b/engine/classes/Elgg/I18n/Translator.php @@ -53,7 +53,7 @@ function translate($message_key, $args = array(), $language = "") { $args = array(); } - if (!isset($this->CONFIG->translations)) { + if (!isset($GLOBALS['_ELGG']->translations)) { // this means we probably had an exception before translations were initialized $this->registerTranslations($this->defaultPath); } @@ -65,7 +65,7 @@ function translate($message_key, $args = array(), $language = "") { $language = $CURRENT_LANGUAGE; } - if (!isset($this->CONFIG->translations[$language])) { + if (!isset($GLOBALS['_ELGG']->translations[$language])) { // The language being requested is not the same as the language of the // logged in user, so we will have to load it separately. (Most likely // we're sending a notification and the recipient is using a different @@ -73,10 +73,10 @@ function translate($message_key, $args = array(), $language = "") { _elgg_load_translations_for_language($language); } - if (isset($this->CONFIG->translations[$language][$message_key])) { - $string = $this->CONFIG->translations[$language][$message_key]; - } else if (isset($this->CONFIG->translations["en"][$message_key])) { - $string = $this->CONFIG->translations["en"][$message_key]; + if (isset($GLOBALS['_ELGG']->translations[$language][$message_key])) { + $string = $GLOBALS['_ELGG']->translations[$language][$message_key]; + } else if (isset($GLOBALS['_ELGG']->translations["en"][$message_key])) { + $string = $GLOBALS['_ELGG']->translations["en"][$message_key]; _elgg_services()->logger->notice(sprintf('Missing %s translation for "%s" language key', $language, $message_key)); } else { $string = $message_key; @@ -107,18 +107,18 @@ function translate($message_key, $args = array(), $language = "") { */ function addTranslation($country_code, $language_array) { - if (!isset($this->CONFIG->translations)) { - $this->CONFIG->translations = array(); + if (!isset($GLOBALS['_ELGG']->translations)) { + $GLOBALS['_ELGG']->translations = array(); } $country_code = strtolower($country_code); $country_code = trim($country_code); if (is_array($language_array) && $country_code != "") { if (sizeof($language_array) > 0) { - if (!isset($this->CONFIG->translations[$country_code])) { - $this->CONFIG->translations[$country_code] = $language_array; + if (!isset($GLOBALS['_ELGG']->translations[$country_code])) { + $GLOBALS['_ELGG']->translations[$country_code] = $language_array; } else { - $this->CONFIG->translations[$country_code] = $language_array + $this->CONFIG->translations[$country_code]; + $GLOBALS['_ELGG']->translations[$country_code] = $language_array + $GLOBALS['_ELGG']->translations[$country_code]; } } return true; @@ -189,9 +189,9 @@ function loadTranslations() { } if ($loaded) { - $this->CONFIG->i18n_loaded_from_cache = true; + $GLOBALS['_ELGG']->i18n_loaded_from_cache = true; // this is here to force - $this->CONFIG->language_paths[$this->defaultPath] = true; + $GLOBALS['_ELGG']->language_paths[$this->defaultPath] = true; return; } } @@ -215,10 +215,10 @@ function registerTranslations($path, $load_all = false) { $path = sanitise_filepath($path); // Make a note of this path just incase we need to register this language later - if (!isset($this->CONFIG->language_paths)) { - $this->CONFIG->language_paths = array(); + if (!isset($GLOBALS['_ELGG']->language_paths)) { + $GLOBALS['_ELGG']->language_paths = array(); } - $this->CONFIG->language_paths[$path] = true; + $GLOBALS['_ELGG']->language_paths[$path] = true; // Get the current language based on site defaults and user preference $current_language = $this->getCurrentLanguage(); @@ -276,7 +276,7 @@ function reloadAllTranslations() { return; } - if ($this->CONFIG->i18n_loaded_from_cache) { + if ($GLOBALS['_ELGG']->i18n_loaded_from_cache) { $cache = elgg_get_system_cache(); $cache_dir = $cache->getVariable("cache_path"); $filenames = elgg_get_file_list($cache_dir, array(), array(), array(".lang")); @@ -293,7 +293,7 @@ function reloadAllTranslations() { } } } else { - foreach ($this->CONFIG->language_paths as $path => $dummy) { + foreach ($GLOBALS['_ELGG']->language_paths as $path => $dummy) { $this->registerTranslations($path, true); } } @@ -317,7 +317,7 @@ function getInstalledTranslations() { $admin_logged_in = _elgg_services()->session->isAdminLoggedIn(); - foreach ($this->CONFIG->translations as $k => $v) { + foreach ($GLOBALS['_ELGG']->translations as $k => $v) { $installed[$k] = $this->translate($k, array(), $k); if ($admin_logged_in && ($k != 'en')) { $completeness = $this->getLanguageCompleteness($k); @@ -345,7 +345,7 @@ function getLanguageCompleteness($language) { $language = sanitise_string($language); - $en = count($this->CONFIG->translations['en']); + $en = count($GLOBALS['_ELGG']->translations['en']); $missing = $this->getMissingLanguageKeys($language); if ($missing) { @@ -354,7 +354,7 @@ function getLanguageCompleteness($language) { $missing = 0; } - //$lang = count($this->CONFIG->translations[$language]); + //$lang = count($GLOBALS['_ELGG']->translations[$language]); $lang = $en - $missing; return round(($lang / $en) * 100, 2); @@ -376,9 +376,9 @@ function getMissingLanguageKeys($language) { $missing = array(); - foreach ($this->CONFIG->translations['en'] as $k => $v) { - if ((!isset($this->CONFIG->translations[$language][$k])) - || ($this->CONFIG->translations[$language][$k] == $this->CONFIG->translations['en'][$k])) { + foreach ($GLOBALS['_ELGG']->translations['en'] as $k => $v) { + if ((!isset($GLOBALS['_ELGG']->translations[$language][$k])) + || ($GLOBALS['_ELGG']->translations[$language][$k] == $GLOBALS['_ELGG']->translations['en'][$k])) { $missing[] = $k; } } @@ -404,16 +404,16 @@ function languageKeyExists($key, $language = 'en') { return false; } - if (($language !== 'en') && !array_key_exists($language, $this->CONFIG->translations)) { + if (($language !== 'en') && !array_key_exists($language, $GLOBALS['_ELGG']->translations)) { // Ensure that all possible translations are loaded $this->reloadAllTranslations(); } - if (!array_key_exists($language, $this->CONFIG->translations)) { + if (!array_key_exists($language, $GLOBALS['_ELGG']->translations)) { return false; } - return array_key_exists($key, $this->CONFIG->translations[$language]); + return array_key_exists($key, $GLOBALS['_ELGG']->translations[$language]); } /** diff --git a/engine/classes/Elgg/Logger.php b/engine/classes/Elgg/Logger.php index caf3c07007d..88b2aa00bd6 100644 --- a/engine/classes/Elgg/Logger.php +++ b/engine/classes/Elgg/Logger.php @@ -207,7 +207,7 @@ protected function process($data, $display, $level) { // Do not want to write to screen before page creation has started. // This is not fool-proof but probably fixes 95% of the cases when logging // results in data sent to the browser before the page is begun. - if ($this->config->getVolatile('pagesetupdone') === null) { + if (!isset($GLOBALS['_ELGG']->pagesetupdone)) { $display = false; } diff --git a/engine/classes/Elgg/ViewsService.php b/engine/classes/Elgg/ViewsService.php index 38d2338761e..e2a398fb028 100644 --- a/engine/classes/Elgg/ViewsService.php +++ b/engine/classes/Elgg/ViewsService.php @@ -229,8 +229,8 @@ public function renderView($view, array $vars = array(), $bypass = false, $viewt $view_orig = $view; // Trigger the pagesetup event - if (!isset($this->CONFIG->pagesetupdone) && !empty($this->CONFIG->boot_complete)) { - $this->CONFIG->pagesetupdone = true; + if (!isset($GLOBALS['_ELGG']->pagesetupdone) && !empty($this->CONFIG->boot_complete)) { + $GLOBALS['_ELGG']->pagesetupdone = true; _elgg_services()->events->trigger('pagesetup', 'system'); } diff --git a/engine/classes/ElggInstaller.php b/engine/classes/ElggInstaller.php index 3a1ccc56ab4..45001309244 100644 --- a/engine/classes/ElggInstaller.php +++ b/engine/classes/ElggInstaller.php @@ -444,8 +444,8 @@ protected function settings($submissionVars) { // if Apache, we give user option of having Elgg create data directory //if (ElggRewriteTester::guessWebServer() == 'apache') { // $formVars['dataroot']['type'] = 'combo'; - // $this->CONFIG->translations['en']['install:settings:help:dataroot'] = - // $this->CONFIG->translations['en']['install:settings:help:dataroot:apache']; + // $GLOBALS['_ELGG']->translations['en']['install:settings:help:dataroot'] = + // $GLOBALS['_ELGG']->translations['en']['install:settings:help:dataroot:apache']; //} if ($this->isAction) { @@ -533,8 +533,8 @@ protected function admin($submissionVars) { // bit of a hack to get the password help to show right number of characters $lang = _elgg_services()->translator->getCurrentLanguage(); - $this->CONFIG->translations[$lang]['install:admin:help:password1'] = - sprintf($this->CONFIG->translations[$lang]['install:admin:help:password1'], + $GLOBALS['_ELGG']->translations[$lang]['install:admin:help:password1'] = + sprintf($GLOBALS['_ELGG']->translations[$lang]['install:admin:help:password1'], $this->CONFIG->min_password_length); $formVars = $this->makeFormSticky($formVars, $submissionVars); @@ -849,7 +849,7 @@ protected function bootstrapConfig() { $this->CONFIG->wwwroot = $this->getBaseUrl(); $this->CONFIG->url = $this->CONFIG->wwwroot; $this->CONFIG->path = "{$this->getElggRoot()}/"; - $this->CONFIG->view_path = $this->CONFIG->path . 'views/'; + $GLOBALS['_ELGG']->view_path = $this->CONFIG->path . 'views/'; $this->CONFIG->pluginspath = $this->CONFIG->path . 'mod/'; $this->CONFIG->context = array(); $this->CONFIG->entity_types = array('group', 'object', 'site', 'user'); diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php index 30611bba6b1..ab6270d1c8e 100644 --- a/engine/lib/configuration.php +++ b/engine/lib/configuration.php @@ -316,7 +316,6 @@ function _elgg_load_application_config() { $install_root = str_replace("\\", "/", dirname(dirname(dirname(__FILE__)))); $defaults = array( 'path' => "$install_root/", - 'view_path' => "$install_root/views/", 'plugins_path' => "$install_root/mod/", 'language' => 'en', @@ -330,6 +329,8 @@ function _elgg_load_application_config() { } } + $GLOBALS['_ELGG']->view_path = "$install_root/views/"; + // set cookie values for session and remember me _elgg_configure_cookies($CONFIG); @@ -340,16 +341,16 @@ function _elgg_load_application_config() { // allow sites to set dataroot and simplecache_enabled in settings.php if (isset($CONFIG->dataroot)) { $CONFIG->dataroot = sanitise_filepath($CONFIG->dataroot); - $CONFIG->dataroot_in_settings = true; + $GLOBALS['_ELGG']->dataroot_in_settings = true; } else { $dataroot = datalist_get('dataroot'); if (!empty($dataroot)) { $CONFIG->dataroot = $dataroot; } - $CONFIG->dataroot_in_settings = false; + $GLOBALS['_ELGG']->dataroot_in_settings = false; } if (isset($CONFIG->simplecache_enabled)) { - $CONFIG->simplecache_enabled_in_settings = true; + $GLOBALS['_ELGG']->simplecache_enabled_in_settings = true; } else { $simplecache_enabled = datalist_get('simplecache_enabled'); if ($simplecache_enabled !== false) { @@ -357,7 +358,7 @@ function _elgg_load_application_config() { } else { $CONFIG->simplecache_enabled = 1; } - $CONFIG->simplecache_enabled_in_settings = false; + $GLOBALS['_ELGG']->simplecache_enabled_in_settings = false; } $system_cache_enabled = datalist_get('system_cache_enabled'); @@ -370,7 +371,7 @@ function _elgg_load_application_config() { // needs to be set before system, init for links in html head $CONFIG->lastcache = (int)datalist_get("simplecache_lastupdate"); - $CONFIG->i18n_loaded_from_cache = false; + $GLOBALS['_ELGG']->i18n_loaded_from_cache = false; // this must be synced with the enum for the entities table $CONFIG->entity_types = array('group', 'object', 'site', 'user'); diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php index 81ed4f37bdf..65a3f16d3c6 100644 --- a/engine/lib/deprecated-1.8.php +++ b/engine/lib/deprecated-1.8.php @@ -1462,31 +1462,6 @@ function filter_string($string) { return $terms; } -/** - * Returns true if the word in $input is considered significant - * - * @deprecated 1.8 Don't use this. - * - * @param string $input A word - * - * @return true|false - */ -function remove_blacklist($input) { - elgg_deprecated_notice('remove_blacklist() was deprecated!', 1.8); - - global $CONFIG; - - if (!is_array($CONFIG->wordblacklist)) { - return $input; - } - - if (strlen($input) < 3 || in_array($input, $CONFIG->wordblacklist)) { - return false; - } - - return true; -} - /** * Gets the guid of the entity that owns the current page. * diff --git a/engine/lib/deprecated-1.9.php b/engine/lib/deprecated-1.9.php index 878406e5f15..35f1ffb4260 100644 --- a/engine/lib/deprecated-1.9.php +++ b/engine/lib/deprecated-1.9.php @@ -3045,7 +3045,7 @@ function elgg_view_tree($view_root, $viewtype = "") { } // Now examine core - $location = $CONFIG->view_path; + $location = $GLOBALS['_ELGG']->view_path; $viewtype = elgg_get_viewtype(); $root = $location . $viewtype . '/' . $view_root; diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 92e1823cebe..0a16cf5fa5d 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -813,7 +813,7 @@ function _elgg_php_exception_handler($exception) { // we don't want the 'pagesetup', 'system' event to fire global $CONFIG; - $CONFIG->pagesetupdone = true; + $GLOBALS['_ELGG']->pagesetupdone = true; try { // allow custom scripts to trigger on exception @@ -1483,7 +1483,7 @@ function _elgg_ajax_page_handler($segments) { $view = 'forms/' . implode('/', array_slice($segments, 1)); } - $allowed_views = elgg_get_config('allowed_ajax_views'); + $allowed_views = $GLOBALS['_ELGG']->allowed_ajax_views; if (!array_key_exists($view, $allowed_views)) { header('HTTP/1.1 403 Forbidden'); exit; @@ -1897,17 +1897,6 @@ function _elgg_init() { // Trigger the shutdown:system event upon PHP shutdown. register_shutdown_function('_elgg_shutdown_hook'); - - // Sets a blacklist of words in the current language. - // This is a comma separated list in word:blacklist. - // @todo possibly deprecate - $CONFIG->wordblacklist = array(); - $list = explode(',', elgg_echo('word:blacklist')); - if ($list) { - foreach ($list as $l) { - $CONFIG->wordblacklist[] = trim($l); - } - } } /** diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 2d6cd9be588..577b0fa3a4c 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -159,15 +159,13 @@ function register_translations($path, $load_all = false) { * @return bool success */ function _elgg_register_translations_for_language($path, $language) { - global $CONFIG; - $path = sanitise_filepath($path); // Make a note of this path just in case we need to register this language later - if (!isset($CONFIG->language_paths)) { - $CONFIG->language_paths = array(); + if (!isset($GLOBALS['_ELGG']->language_paths)) { + $GLOBALS['_ELGG']->language_paths = array(); } - $CONFIG->language_paths[$path] = true; + $GLOBALS['_ELGG']->language_paths[$path] = true; $language_file = "{$path}{$language}.php"; diff --git a/engine/lib/tags.php b/engine/lib/tags.php index c43b1d6d4b5..40c150d5e83 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -208,14 +208,12 @@ function elgg_get_tags(array $options = array()) { * @since 1.7.0 */ function elgg_register_tag_metadata_name($name) { - global $CONFIG; - - if (!isset($CONFIG->registered_tag_metadata_names)) { - $CONFIG->registered_tag_metadata_names = array(); + if (!isset($GLOBALS['_ELGG']->registered_tag_metadata_names)) { + $GLOBALS['_ELGG']->registered_tag_metadata_names = array(); } - if (!in_array($name, $CONFIG->registered_tag_metadata_names)) { - $CONFIG->registered_tag_metadata_names[] = $name; + if (!in_array($name, $GLOBALS['_ELGG']->registered_tag_metadata_names)) { + $GLOBALS['_ELGG']->registered_tag_metadata_names[] = $name; } return true; @@ -228,9 +226,7 @@ function elgg_register_tag_metadata_name($name) { * @since 1.7.0 */ function elgg_get_registered_tag_metadata_names() { - global $CONFIG; - - $names = (isset($CONFIG->registered_tag_metadata_names)) ? $CONFIG->registered_tag_metadata_names : array(); + $names = (isset($GLOBALS['_ELGG']->registered_tag_metadata_names)) ? $GLOBALS['_ELGG']->registered_tag_metadata_names : array(); return $names; } diff --git a/engine/lib/views.php b/engine/lib/views.php index 59a324e8e33..1e08c2f90a2 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -114,14 +114,12 @@ function elgg_get_viewtype() { * @return bool */ function elgg_register_viewtype($viewtype) { - global $CONFIG; - - if (!isset($CONFIG->view_types) || !is_array($CONFIG->view_types)) { - $CONFIG->view_types = array(); + if (!isset($GLOBALS['_ELGG']->view_types) || !is_array($GLOBALS['_ELGG']->view_types)) { + $GLOBALS['_ELGG']->view_types = array(); } - if (!in_array($viewtype, $CONFIG->view_types)) { - $CONFIG->view_types[] = $viewtype; + if (!in_array($viewtype, $GLOBALS['_ELGG']->view_types)) { + $GLOBALS['_ELGG']->view_types[] = $viewtype; } return true; @@ -136,13 +134,11 @@ function elgg_register_viewtype($viewtype) { * @since 1.9.0 */ function elgg_is_registered_viewtype($viewtype) { - global $CONFIG; - - if (!isset($CONFIG->view_types) || !is_array($CONFIG->view_types)) { + if (!isset($GLOBALS['_ELGG']->view_types) || !is_array($GLOBALS['_ELGG']->view_types)) { return false; } - return in_array($viewtype, $CONFIG->view_types); + return in_array($viewtype, $GLOBALS['_ELGG']->view_types); } @@ -229,13 +225,11 @@ function elgg_unregister_ajax_view($view) { * @since 1.9.0 */ function elgg_register_external_view($view, $cacheable = false) { - global $CONFIG; - - if (!isset($CONFIG->allowed_ajax_views)) { - $CONFIG->allowed_ajax_views = array(); + if (!isset($GLOBALS['_ELGG']->allowed_ajax_views)) { + $GLOBALS['_ELGG']->allowed_ajax_views = array(); } - $CONFIG->allowed_ajax_views[$view] = true; + $GLOBALS['_ELGG']->allowed_ajax_views[$view] = true; if ($cacheable) { _elgg_services()->views->registerCacheableView($view); @@ -262,10 +256,8 @@ function _elgg_is_view_cacheable($view) { * @since 1.9.0 */ function elgg_unregister_external_view($view) { - global $CONFIG; - - if (isset($CONFIG->allowed_ajax_views[$view])) { - unset($CONFIG->allowed_ajax_views[$view]); + if (isset($GLOBALS['_ELGG']->allowed_ajax_views[$view])) { + unset($GLOBALS['_ELGG']->allowed_ajax_views[$view]); } } @@ -1620,7 +1612,7 @@ function elgg_views_boot() { elgg_register_plugin_hook_handler('output:before', 'page', '_elgg_views_send_header_x_frame_options'); // @todo the cache is loaded in load_plugins() but we need to know viewtypes earlier - $view_path = $CONFIG->view_path; + $view_path = $GLOBALS['_ELGG']->view_path; $viewtype_dirs = scandir($view_path); foreach ($viewtype_dirs as $viewtype) { if (_elgg_is_valid_viewtype($viewtype) && is_dir($view_path . $viewtype)) { diff --git a/engine/tests/ElggCoreHelpersTest.php b/engine/tests/ElggCoreHelpersTest.php index 3341cefefc0..93bb80ba070 100644 --- a/engine/tests/ElggCoreHelpersTest.php +++ b/engine/tests/ElggCoreHelpersTest.php @@ -26,10 +26,8 @@ public function setUp() { * Called after each test method. */ public function tearDown() { - - global $CONFIG; - unset($CONFIG->externals); - unset($CONFIG->externals_map); + unset($GLOBALS['_ELGG']->externals); + unset($GLOBALS['_ELGG']->externals_map); } /** @@ -221,20 +219,18 @@ public function testElggFormatElement() { * Test elgg_register_js() */ public function testElggRegisterJS() { - global $CONFIG; - // specify name $result = elgg_register_js('key', 'http://test1.com', 'footer'); $this->assertTrue($result); - $this->assertTrue(isset($CONFIG->externals_map['js']['key'])); + $this->assertTrue(isset($GLOBALS['_ELGG']->externals_map['js']['key'])); - $item = $CONFIG->externals_map['js']['key']; - $this->assertTrue($CONFIG->externals['js']->contains($item)); + $item = $GLOBALS['_ELGG']->externals_map['js']['key']; + $this->assertTrue($GLOBALS['_ELGG']->externals['js']->contains($item)); - $priority = $CONFIG->externals['js']->getPriority($item); + $priority = $GLOBALS['_ELGG']->externals['js']->getPriority($item); $this->assertTrue($priority !== false); - $item = $CONFIG->externals['js']->getElement($priority); + $item = $GLOBALS['_ELGG']->externals['js']->getElement($priority); $this->assertIdentical('http://test1.com', $item->url); // send a bad url @@ -246,20 +242,18 @@ public function testElggRegisterJS() { * Test elgg_register_css() */ public function testElggRegisterCSS() { - global $CONFIG; - // specify name $result = elgg_register_css('key', 'http://test1.com'); $this->assertTrue($result); - $this->assertTrue(isset($CONFIG->externals_map['css']['key'])); + $this->assertTrue(isset($GLOBALS['_ELGG']->externals_map['css']['key'])); - $item = $CONFIG->externals_map['css']['key']; - $this->assertTrue($CONFIG->externals['css']->contains($item)); + $item = $GLOBALS['_ELGG']->externals_map['css']['key']; + $this->assertTrue($GLOBALS['_ELGG']->externals['css']->contains($item)); - $priority = $CONFIG->externals['css']->getPriority($item); + $priority = $GLOBALS['_ELGG']->externals['css']->getPriority($item); $this->assertTrue($priority !== false); - $item = $CONFIG->externals['css']->getElement($priority); + $item = $GLOBALS['_ELGG']->externals['css']->getElement($priority); $this->assertIdentical('http://test1.com', $item->url); } @@ -267,8 +261,6 @@ public function testElggRegisterCSS() { * Test elgg_unregister_js() */ public function testElggUnregisterJS() { - global $CONFIG; - $base = trim(elgg_get_site_url(), "/"); $urls = array('id1' => "$base/urla", 'id2' => "$base/urlb", 'id3' => "$base/urlc"); @@ -280,9 +272,9 @@ public function testElggUnregisterJS() { $result = elgg_unregister_js('id1'); $this->assertTrue($result); - $js = $CONFIG->externals['js']; + $js = $GLOBALS['_ELGG']->externals['js']; $elements = $js->getElements(); - $this->assertFalse(isset($CONFIG->externals_map['js']['id1'])); + $this->assertFalse(isset($GLOBALS['_ELGG']->externals_map['js']['id1'])); foreach ($elements as $element) { if (isset($element->name)) { @@ -299,19 +291,19 @@ public function testElggUnregisterJS() { $result = elgg_unregister_js('id2'); $elements = $js->getElements(); - $this->assertFalse(isset($CONFIG->externals_map['js']['id2'])); + $this->assertFalse(isset($GLOBALS['_ELGG']->externals_map['js']['id2'])); foreach ($elements as $element) { if (isset($element->name)) { $this->assertFalse($element->name == 'id2'); } } - $this->assertTrue(isset($CONFIG->externals_map['js']['id3'])); + $this->assertTrue(isset($GLOBALS['_ELGG']->externals_map['js']['id3'])); - $priority = $CONFIG->externals['js']->getPriority($CONFIG->externals_map['js']['id3']); + $priority = $GLOBALS['_ELGG']->externals['js']->getPriority($GLOBALS['_ELGG']->externals_map['js']['id3']); $this->assertTrue($priority !== false); - $item = $CONFIG->externals['js']->getElement($priority); + $item = $GLOBALS['_ELGG']->externals['js']->getElement($priority); $this->assertIdentical($urls['id3'], $item->url); } diff --git a/engine/tests/phpunit/Elgg/Assets/ExternalFilesTest.php b/engine/tests/phpunit/Elgg/Assets/ExternalFilesTest.php index d13f57369b6..7317b82258b 100644 --- a/engine/tests/phpunit/Elgg/Assets/ExternalFilesTest.php +++ b/engine/tests/phpunit/Elgg/Assets/ExternalFilesTest.php @@ -22,10 +22,10 @@ public function testPreservesInputConfigData() { $list->add($obj1, 600); $list->add($obj2, 300); - $config->externals = array( + $GLOBALS['_ELGG']->externals = array( 'foo' => $list ); - $config->externals_map = array( + $GLOBALS['_ELGG']->externals_map = array( 'foo' => array( 'bar1' => $obj1, 'bar2' => $obj2, diff --git a/engine/tests/phpunit/bootstrap.php b/engine/tests/phpunit/bootstrap.php index 5e836f346d6..922876a29e2 100644 --- a/engine/tests/phpunit/bootstrap.php +++ b/engine/tests/phpunit/bootstrap.php @@ -34,12 +34,15 @@ function _elgg_testing_application(\Elgg\Application $app = null) { 'wwwroot' => 'http://localhost/', 'path' => __DIR__ . '/../../../', 'dataroot' => __DIR__ . '/test_files/dataroot/', - 'view_path' => __DIR__ . '/../../../views/', 'site_guid' => 1, 'AutoloaderManager_skip_storage' => true, 'simplecache_enabled' => false, ]; +global $_ELGG; +$_ELGG = (object)[ + 'view_path' => __DIR__ . '/../../../views/', +]; function _elgg_testing_config(\Elgg\Config $config = null) { static $inst; diff --git a/mod/developers/classes/ElggInspector.php b/mod/developers/classes/ElggInspector.php deleted file mode 100644 index 1f5a4e8b60b..00000000000 --- a/mod/developers/classes/ElggInspector.php +++ /dev/null @@ -1,303 +0,0 @@ - array(handlers) - */ - public function getEvents() { - $tree = array(); - $events = _elgg_services()->events->getAllHandlers(); - foreach ($events as $event => $types) { - foreach ($types as $type => $priorities) { - foreach ($priorities as $priority => $handlers) { - $tree[$event . ',' . $type] = array_values($handlers); - } - } - } - - ksort($tree); - - return $tree; - } - - /** - * Get Elgg plugin hooks information - * - * returns [hook,type] => array(handlers) - */ - public function getPluginHooks() { - $tree = array(); - $hooks = _elgg_services()->hooks->getAllHandlers(); - foreach ($hooks as $hook => $types) { - foreach ($types as $type => $priorities) { - foreach ($priorities as $priority => $handlers) { - $tree[$hook . ',' . $type] = array_values($handlers); - } - } - } - - ksort($tree); - - return $tree; - } - - /** - * Get Elgg view information - * - * returns [view] => array(view location and extensions) - */ - public function getViews() { - global $CONFIG; - - $coreViews = $this->recurseFileTree($CONFIG->view_path . "default/"); - - // remove base path and php extension - array_walk($coreViews, create_function('&$v,$k', 'global $CONFIG; $v = substr($v, strlen($CONFIG->view_path . "default/"), -4);')); - - // setup views array before adding extensions and plugin views - $views = array(); - foreach ($coreViews as $view) { - $views[$view] = array($CONFIG->view_path . "default/" . $view . ".php"); - } - - // add plugins and handle overrides - foreach ($CONFIG->views->locations['default'] as $view => $location) { - $views[$view] = array($location . $view . ".php"); - } - - // now extensions - foreach ($CONFIG->views->extensions as $view => $extensions) { - $view_list = array(); - foreach ($extensions as $priority => $ext_view) { - if (isset($views[$ext_view])) { - $view_list[] = $views[$ext_view][0]; - } - } - if (count($view_list) > 0) { - $views[$view] = $view_list; - } - } - - ksort($views); - - return $views; - } - - /** - * Get Elgg widget information - * - * returns [widget] => array(name, contexts) - */ - public function getWidgets() { - $tree = array(); - foreach (_elgg_services()->widgets->getAllTypes() as $handler => $handler_obj) { - $tree[$handler] = array($handler_obj->name, implode(',', array_values($handler_obj->context))); - } - - ksort($tree); - - return $tree; - } - - - /** - * Get Elgg actions information - * - * returns [action] => array(file, access) - */ - public function getActions() { - $tree = array(); - $access = array( - 'public' => 'public', - 'logged_in' => 'logged in only', - 'admin' => 'admin only', - ); - foreach (_elgg_services()->actions->getAllActions() as $action => $info) { - - $tree[$action] = array($info['file'], $access[$info['access']]); - } - - ksort($tree); - - return $tree; - } - - /** - * Get simplecache information - * - * returns [views] - */ - public function getSimpleCache() { - global $CONFIG; - - $tree = array(); - foreach ($CONFIG->views->simplecache as $view => $foo) { - $tree[$view] = ""; - } - - ksort($tree); - - return $tree; - } - - /** - * Get Elgg web services API methods - * - * returns [method] => array(function, parameters, call_method, api auth, user auth) - */ - public function getWebServices() { - global $API_METHODS; - - $tree = array(); - foreach ($API_METHODS as $method => $info) { - $params = implode(', ', array_keys($info['parameters'])); - if (!$params) { - $params = 'none'; - } - $tree[$method] = array( - $info['function'], - "params: $params", - $info['call_method'], - ($info['require_api_auth']) ? 'API authentication required' : 'No API authentication required', - ($info['require_user_auth']) ? 'User authentication required' : 'No user authentication required', - ); - } - - ksort($tree); - - return $tree; - } - - /** - * Get information about registered menus - * - * @returns array [menu name] => array(item name => array(text, href, section, parent)) - * - */ - public function getMenus() { - - $menus = elgg_get_config('menus'); - - // get JIT menu items - // note that 'river' is absent from this list - hooks attempt to get object/subject entities cause problems - $jit_menus = array('annotation', 'entity', 'login', 'longtext', 'owner_block', 'user_hover', 'widget'); - - // create generic ElggEntity, ElggAnnotation, ElggUser, ElggWidget - $annotation = new ElggAnnotation(); - $annotation->id = 999; - $annotation->name = 'generic_comment'; - $annotation->value = 'testvalue'; - - $entity = new ElggObject(); - $entity->guid = 999; - $entity->subtype = 'blog'; - $entity->title = 'test entity'; - $entity->access_id = ACCESS_PUBLIC; - - $user = new ElggUser(); - $user->guid = 999; - $user->name = "Test User"; - $user->username = 'test_user'; - - $widget = new ElggWidget(); - $widget->guid = 999; - $widget->title = 'test widget'; - - // call plugin hooks - foreach ($jit_menus as $type) { - $params = array('entity' => $entity, 'annotation' => $annotation, 'user' => $user); - switch ($type){ - case 'owner_block': - case 'user_hover': - $params['entity'] = $user; - break; - case 'widget': - // this does not work because you cannot set a guid on an entity - $params['entity'] = $widget; - break; - default: - break; - } - $menus[$type] = elgg_trigger_plugin_hook('register', 'menu:'.$type, $params, array()); - } - - // put the menus in tree form for inspection - $tree = array(); - - foreach ($menus as $menu_name => $attributes) { - foreach ($attributes as $item) { - $name = $item->getName(); - $text = htmlspecialchars($item->getText(), ENT_QUOTES, 'UTF-8', false); - $href = $item->getHref(); - if ($href === false) { - $href = 'not a link'; - } elseif ($href === "") { - $href = 'not a direct link - possibly ajax'; - } - $section = $item->getSection(); - $parent = $item->getParentName(); - if (!$parent) { - $parent = 'none'; - } - - $tree[$menu_name][$name] = array( - "text: $text", - "href: $href", - "section: $section", - "parent: $parent", - ); - } - } - - ksort($tree); - - return $tree; - } - - /** - * Create array of all php files in directory and subdirectories - * - * @param $dir full path to directory to begin search - * @return array of every php file in $dir or below in file tree - */ - protected function recurseFileTree($dir) { - $view_list = array(); - - $handle = opendir($dir); - while ($file = readdir($handle)) { - if ($file[0] == '.') { - - } else if (is_dir($dir . $file)) { - $view_list = array_merge($view_list, $this->recurseFileTree($dir . $file. "/")); - } else { - $extension = strrchr(trim($file, "/"), '.'); - if ($extension === ".php") { - $view_list[] = $dir . $file; - } - } - } - closedir($handle); - - return $view_list; - } - -} diff --git a/mod/developers/start.php b/mod/developers/start.php index 5957ffbc304..bae8bf3f876 100644 --- a/mod/developers/start.php +++ b/mod/developers/start.php @@ -113,11 +113,9 @@ function developers_setup_menu() { * Clear all the strings so the raw descriptor strings are displayed */ function developers_clear_strings() { - global $CONFIG; - $language = get_language(); - $CONFIG->translations[$language] = array(); - $CONFIG->translations['en'] = array(); + $GLOBALS['_ELGG']->translations[$language] = array(); + $GLOBALS['_ELGG']->translations['en'] = array(); } /** diff --git a/mod/developers/views/default/admin/developers/settings.php b/mod/developers/views/default/admin/developers/settings.php index 03a614f6724..e9ebdc0c164 100644 --- a/mod/developers/views/default/admin/developers/settings.php +++ b/mod/developers/views/default/admin/developers/settings.php @@ -8,7 +8,7 @@ 'type' => 'checkbox', 'value' => 1, 'checked' => elgg_get_config('simplecache_enabled') == 1, - 'readonly' => elgg_get_config('simplecache_enabled_in_settings'), + 'readonly' => $GLOBALS['_ELGG']->simplecache_enabled_in_settings, ), 'system_cache' => array( diff --git a/mod/embed/start.php b/mod/embed/start.php index 5694b5a3409..81fcd49d8a6 100644 --- a/mod/embed/start.php +++ b/mod/embed/start.php @@ -59,7 +59,7 @@ function embed_longtext_menu($hook, $type, $items, $vars) { // if loaded through ajax (like on /activity), pull in JS libs manually // hack for #6422 because we haven't converted everything to amd yet if (elgg_in_context('ajax')) { - $externals = elgg_get_config('externals_map'); + $externals = $GLOBALS['_ELGG']->externals_map; $embed = elgg_extract('elgg.embed', $externals['js']); $lightbox_js = elgg_extract('lightbox', $externals['js']); $lightbox_css = elgg_extract('lightbox', $externals['css']); diff --git a/views/default/forms/admin/site/advanced/caching.php b/views/default/forms/admin/site/advanced/caching.php index d6bf52b38ca..b306524ef32 100644 --- a/views/default/forms/admin/site/advanced/caching.php +++ b/views/default/forms/admin/site/advanced/caching.php @@ -12,14 +12,14 @@ 'name' => 'simplecache_enabled', 'checked' => $is_simple_cache_on, ); -if (elgg_get_config('simplecache_enabled_in_settings')) { +if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) { $params['class'] = 'elgg-state-disabled'; $params['label_class'] = 'elgg-state-disabled'; } $simple_cache_input .= elgg_view("input/checkbox", $params); $simple_cache_warning = ''; -if (elgg_get_config('simplecache_enabled_in_settings')) { +if ($GLOBALS['_ELGG']->simplecache_enabled_in_settings) { $warning = elgg_echo('admin:settings:in_settings_file'); $simple_cache_warning .= "$warning"; } diff --git a/views/default/forms/admin/site/advanced/system.php b/views/default/forms/admin/site/advanced/system.php index d15e9318f5c..e0102f75bac 100644 --- a/views/default/forms/admin/site/advanced/system.php +++ b/views/default/forms/admin/site/advanced/system.php @@ -13,7 +13,7 @@ 'name' => $field, 'value' => elgg_get_config($field) ]; - if ($field == 'dataroot' && elgg_get_config('dataroot_in_settings')) { + if ($field == 'dataroot' && $GLOBALS['_ELGG']->dataroot_in_settings) { $params['readonly'] = true; $params['class'] = 'elgg-state-disabled'; $warning = elgg_echo('admin:settings:in_settings_file'); diff --git a/views/default/js/languages.php b/views/default/js/languages.php index d0f3c76dab2..7e5b6c65e3b 100644 --- a/views/default/js/languages.php +++ b/views/default/js/languages.php @@ -19,13 +19,13 @@ $language = 'en'; } -$all_translations = elgg_get_config('translations'); +$all_translations = $GLOBALS['_ELGG']->translations; $translations = $all_translations['en']; if ($language != 'en' && !isset($all_translations[$language])) { // try to reload missing translations reload_all_translations(); - $all_translations = elgg_get_config('translations'); + $all_translations = $GLOBALS['_ELGG']->translations; } if ($language != 'en' && isset($all_translations[$language])) {