예제 #1
0
    function smarty_postfilter_prepend_load($compiled, &$smarty)
    {
        $instance =& SELanguageCompiler::getInstance();
        $prepend_compiled = '<?php';
        if (!empty($instance->_smarty_language_variables)) {
            $prepend_compiled .= '
SELanguage::_preload_multi(';
            // Remove duplicate values
            $instance->_smarty_language_variables = array_unique($instance->_smarty_language_variables);
            $count = 0;
            foreach ($instance->_smarty_language_variables as $preload_lang_id) {
                if ($count != 0) {
                    $prepend_compiled .= ',';
                }
                $prepend_compiled .= "{$preload_lang_id}";
                $count++;
            }
            $prepend_compiled .= ');';
        }
        $prepend_compiled .= '
SELanguage::load();
?>';
        // INDEXING
        if ($instance->use_indexing) {
            $index_file = NULL;
            if (strpos($smarty->_current_file, 'admin_header') !== FALSE || strpos($smarty->_current_file, 'admin_footer') !== FALSE) {
                $index_file = 'globals_admin';
            } elseif (strpos($smarty->_current_file, 'header') !== FALSE || strpos($smarty->_current_file, 'footer') !== FALSE) {
                $index_file = 'globals';
            } elseif ($instance->index_non_header_templates) {
                $index_file = $smarty->_current_file;
            }
            if (!is_null($index_file)) {
                SELanguage::_update_index_file($instance->_smarty_language_variables, $index_file);
            }
        }
        // EMPTY FOR THE NEXT TEMPLATE
        $instance->_smarty_language_variables = array();
        return $prepend_compiled . $compiled;
    }
예제 #2
0
 function _post_load_indexing()
 {
     global $page;
     $instance =& SELanguage::_init();
     $languagevar_ids = array_keys($instance->_storage->_language_variables);
     $non_globals = array_diff($languagevar_ids, $instance->_indexing_vars_global);
     echo 'test';
     if (!empty($non_globals)) {
         SELanguage::_update_index_file($non_globals, $page . '.tpl');
     }
 }