當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Smarty_Internal_Get_Include_Path::isNewIncludePath方法代碼示例

本文整理匯總了PHP中Smarty_Internal_Get_Include_Path::isNewIncludePath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Smarty_Internal_Get_Include_Path::isNewIncludePath方法的具體用法?PHP Smarty_Internal_Get_Include_Path::isNewIncludePath怎麽用?PHP Smarty_Internal_Get_Include_Path::isNewIncludePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Smarty_Internal_Get_Include_Path的用法示例。


在下文中一共展示了Smarty_Internal_Get_Include_Path::isNewIncludePath方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getIncludePathDirs

 /**
  * return array with include path directories
  *
  * @return array
  */
 public static function getIncludePathDirs(Smarty $smarty)
 {
     Smarty_Internal_Get_Include_Path::isNewIncludePath($smarty);
     return self::$_include_dirs;
 }
開發者ID:redaxle,項目名稱:smarty,代碼行數:10,代碼來源:smarty_internal_get_include_path.php

示例2: loadPlugin

 /**
  * Takes unknown classes and loads plugin files for them
  * class name format: Smarty_PluginType_PluginName
  * plugin filename format: plugintype.pluginname.php
  *
  * @param \Smarty $smarty
  * @param  string $plugin_name class plugin name to load
  * @param  bool   $check       check if already loaded
  *
  * @return bool|string
  * @throws \SmartyException
  */
 public static function loadPlugin(Smarty $smarty, $plugin_name, $check)
 {
     // if function or class exists, exit silently (already loaded)
     if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
         return true;
     }
     if (!preg_match('#^smarty_((internal)|([^_]+))_(.+)$#i', $plugin_name, $match)) {
         throw new SmartyException("plugin {$plugin_name} is not a valid name format");
     }
     if (!empty($match[2])) {
         $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
         if (isset($smarty->_cache['plugin_files'][$file])) {
             if ($smarty->_cache['plugin_files'][$file] !== false) {
                 return $smarty->_cache['plugin_files'][$file];
             } else {
                 return false;
             }
         } else {
             if (is_file($file)) {
                 $smarty->_cache['plugin_files'][$file] = $file;
                 require_once $file;
                 return $file;
             } else {
                 $smarty->_cache['plugin_files'][$file] = false;
                 return false;
             }
         }
     }
     // plugin filename is expected to be: [type].[name].php
     $_plugin_filename = "{$match[1]}.{$match[4]}.php";
     $_lower_filename = strtolower($_plugin_filename);
     if (isset($smarty->_cache['plugin_files'])) {
         if (isset($smarty->_cache['plugin_files']['plugins_dir'][$_lower_filename])) {
             if (!$smarty->use_include_path || $smarty->_cache['plugin_files']['plugins_dir'][$_lower_filename] !== false) {
                 return $smarty->_cache['plugin_files']['plugins_dir'][$_lower_filename];
             }
         }
         if (!$smarty->use_include_path || Smarty_Internal_Get_Include_Path::isNewIncludePath($smarty)) {
             unset($smarty->_cache['plugin_files']['include_path']);
         } else {
             if (isset($smarty->_cache['plugin_files']['include_path'][$_lower_filename])) {
                 return $smarty->_cache['plugin_files']['include_path'][$_lower_filename];
             }
         }
     }
     $_file_names = array($_plugin_filename);
     if ($_lower_filename != $_plugin_filename) {
         $_file_names[] = $_lower_filename;
     }
     $_p_dirs = $smarty->getPluginsDir();
     if (!isset($smarty->_cache['plugin_files']['plugins_dir'][$_lower_filename])) {
         // loop through plugin dirs and find the plugin
         foreach ($_p_dirs as $_plugin_dir) {
             foreach ($_file_names as $name) {
                 $file = $_plugin_dir . $name;
                 if (is_file($file)) {
                     $smarty->_cache['plugin_files']['plugins_dir'][$_lower_filename] = $file;
                     require_once $file;
                     return $file;
                 }
                 $smarty->_cache['plugin_files']['plugins_dir'][$_lower_filename] = false;
             }
         }
     }
     if ($smarty->use_include_path) {
         foreach ($_file_names as $_file_name) {
             // try PHP include_path
             $file = Smarty_Internal_Get_Include_Path::getIncludePath($_p_dirs, $_file_name, $smarty);
             $smarty->_cache['plugin_files']['include_path'][$_lower_filename] = $file;
             if ($file !== false) {
                 require_once $file;
                 return $file;
             }
         }
     }
     // no plugin loaded
     return false;
 }
開發者ID:A111ex,項目名稱:adv-multilanding,代碼行數:90,代碼來源:smarty_internal_extension_loadplugin.php


注:本文中的Smarty_Internal_Get_Include_Path::isNewIncludePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。