function &_init() { global $smarty, $page; static $instance; // Create new singleton if (is_null($instance)) { $instance = new SELanguage(); // Get initial storage and compiler instances $instance->_storage =& $instance->getStorage(); //$instance->_compiler =& $instance->_getCompiler(); $smarty->register_prefilter(array(&$instance, '_dynamicCompilerLoader')); // Assign self to be referenced by smarty later $smarty->assign_by_ref($instance->_smarty_this_name, $instance); // Load indexed language vars if ($instance->_indexing) { $indexed_languagevars = array(); $index_path = SE_ROOT . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . 'indexes' . DIRECTORY_SEPARATOR; if (file_exists($index_path . 'globals.php')) { $instance->_indexing_vars_global = array_map('trim', array_filter((array) file($index_path . 'globals.php'))); $indexed_languagevars = array_merge($indexed_languagevars, $instance->_indexing_vars_global); } if (file_exists($index_path . $page . '.tpl.php')) { $instance->_indexing_vars_page = array_map('trim', array_filter((array) file($index_path . 'globals.php'))); $indexed_languagevars = array_merge($indexed_languagevars, $instance->_indexing_vars_page); } if (is_object($instance->_storage) && !empty($indexed_languagevars)) { $instance->_storage->preload($instance->_language, $indexed_languagevars); //$instance->_storage->load($this->_language); } // Post-load indexing if ($instance->_indexing_post_load) { register_shutdown_function(array(&$instance, '_post_load_indexing')); } } } return $instance; }