getIncludePath example

// test if all registered template_dir are accessible         foreach($smarty->getTemplateDir() as $template_dir) {
            $_template_dir = $template_dir;
            $template_dir = realpath($template_dir);
            // resolve include_path or fail existance             if (!$template_dir) {
                if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_template_dir)) {
                    // try PHP include_path                     if ($_stream_resolve_include_path) {
                        $template_dir = stream_resolve_include_path($_template_dir);
                    } else {
                        $template_dir = Smarty_Internal_Get_Include_Path::getIncludePath($_template_dir);
                    }

                    if ($template_dir !== false) {
                        if ($errors === null) {
                            echo "$template_dir is OK.\n";
                        }

                        continue;
                    } else {
                        $status = false;
                        $message = "FAILED: $_template_dir does not exist (and couldn't be found in include_path either)";
                        
        if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $file)) {
            foreach ($_directories as $_directory) {
                $_filepath = $_directory . $file;
                if ($this->fileExists($source$_filepath)) {
                    return $this->normalizePath($_filepath);
                }
                if ($source->smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_directory)) {
                    // try PHP include_path                     // if ($_stream_resolve_include_path) {                     // $_filepath = stream_resolve_include_path($_filepath);                     //} else {                     $_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath);
                    //}
                    if ($_filepath !== false) {
                        if ($this->fileExists($source$_filepath)) {
                            return $this->normalizePath($_filepath);
                        }
                    }
                }
            }
        }

        

            foreach ($names as $file) {
                if (file_exists($file)) {
                    require_once($file);
                    return $file;
                }
                if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
                    // try PHP include_path                     if ($_stream_resolve_include_path) {
                        $file = stream_resolve_include_path($file);
                    } else {
                        $file = Smarty_Internal_Get_Include_Path::getIncludePath($file);
                    }

                    if ($file !== false) {
                        require_once($file);
                        return $file;
                    }
                }
            }
        }
        // no plugin loaded         return false;
    }
Home | Imprint | This part of the site doesn't use cookies.