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


PHP Minify_Controller_Base::checkNotHidden方法代碼示例

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


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

示例1: setupSources


//.........這裏部分代碼省略.........
                 } else {
                     $this->log("The path \"{$file}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
                     if (null === $firstMissingResource) {
                         $firstMissingResource = basename($file);
                         continue;
                     } else {
                         $secondMissingResource = basename($file);
                         $this->log("More than one file was missing: '{$firstMissingResource}', '{$secondMissingResource}'");
                         return $options;
                     }
                 }
             }
             if ($sources) {
                 try {
                     $this->checkType($sources[0]);
                 } catch (Exception $e) {
                     $this->log($e->getMessage());
                     return $options;
                 }
             }
         }
     }
     if (!$cOptions['groupsOnly'] && isset($_GET['f'])) {
         // try user files
         // The following restrictions are to limit the URLs that minify will
         // respond to.
         if (!preg_match('/^[^,]+\\.(css|js)(?:,[^,]+\\.\\1)*$/', $_GET['f'], $m) || strpos($_GET['f'], '//') !== false || strpos($_GET['f'], '\\') !== false) {
             $this->log("GET param 'f' was invalid");
             return $options;
         }
         $ext = ".{$m[1]}";
         try {
             $this->checkType($m[1]);
         } catch (Exception $e) {
             $this->log($e->getMessage());
             return $options;
         }
         $files = explode(',', $_GET['f']);
         if ($files != array_unique($files)) {
             $this->log("Duplicate files were specified");
             return $options;
         }
         if (isset($_GET['b'])) {
             // check for validity
             if (preg_match('@^[^/]+(?:/[^/]+)*$@', $_GET['b']) && false === strpos($_GET['b'], '..') && $_GET['b'] !== '.') {
                 // valid base
                 $base = "/{$_GET['b']}/";
             } else {
                 $this->log("GET param 'b' was invalid");
                 return $options;
             }
         } else {
             $base = '/';
         }
         $allowDirs = array();
         foreach ((array) $cOptions['allowDirs'] as $allowDir) {
             $allowDirs[] = realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir));
         }
         $basenames = array();
         // just for cache id
         foreach ($files as $file) {
             $uri = $base . $file;
             $path = $_SERVER['DOCUMENT_ROOT'] . $uri;
             $realpath = realpath($path);
             if (false === $realpath || !is_file($realpath)) {
                 $this->log("The path \"{$path}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
                 if (null === $firstMissingResource) {
                     $firstMissingResource = $uri;
                     continue;
                 } else {
                     $secondMissingResource = $uri;
                     $this->log("More than one file was missing: '{$firstMissingResource}', '{$secondMissingResource}`'");
                     return $options;
                 }
             }
             try {
                 parent::checkNotHidden($realpath);
                 parent::checkAllowDirs($realpath, $allowDirs, $uri);
             } catch (Exception $e) {
                 $this->log($e->getMessage());
                 return $options;
             }
             $sources[] = $this->_getFileSource($realpath, $cOptions);
             $basenames[] = basename($realpath, $ext);
         }
         if ($this->selectionId) {
             $this->selectionId .= '_f=';
         }
         $this->selectionId .= implode(',', $basenames) . $ext;
     }
     if ($sources) {
         if (null !== $firstMissingResource) {
             array_unshift($sources, new Minify_Source(array('id' => 'missingFile', 'lastModified' => 0, 'content' => "/* Minify: at least one missing file. See " . Minify::URL_DEBUG . " */\n", 'minifier' => '')));
         }
         $this->sources = $sources;
     } else {
         $this->log("No sources to serve");
     }
     return $options;
 }
開發者ID:Bhaavya,項目名稱:OpenLorenz,代碼行數:101,代碼來源:MinApp.php

示例2: setupSources


//.........這裏部分代碼省略.........
                 $files = (array) $files;
             }
             foreach ($files as $file) {
                 if ($file instanceof Minify_Source) {
                     $sources[] = $file;
                     continue;
                 }
                 if (0 === strpos($file, '//')) {
                     $file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1);
                 }
                 $realpath = \W3TC\Util_Environment::realpath($file);
                 if ($realpath && is_file($realpath)) {
                     $sources[] = $this->_getFileSource($realpath, $cOptions);
                 } else {
                     $this->log("The path \"{$file}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
                     if (null === $firstMissingResource) {
                         $firstMissingResource = basename($file);
                         continue;
                     } else {
                         $secondMissingResource = basename($file);
                         $this->log("More than one file was missing: '{$firstMissingResource}', '{$secondMissingResource}'");
                         return $options;
                     }
                 }
             }
             if ($sources) {
                 try {
                     $this->checkType($sources[0]);
                 } catch (Exception $e) {
                     $this->log($e->getMessage());
                     return $options;
                 }
             }
         }
     }
     if (!$cOptions['groupsOnly'] && isset($_GET['f_array'])) {
         $files = $_GET['f_array'];
         $ext = $_GET['ext'];
         if (!empty($_GET['b'])) {
             // check for validity
             if (preg_match('@^[^/]+(?:/[^/]+)*$@', $_GET['b']) && false === strpos($_GET['b'], '..') && $_GET['b'] !== '.') {
                 // valid base
                 $base = "/{$_GET['b']}/";
             } else {
                 $this->log("GET param 'b' invalid (see MinApp.php line 84)");
                 return $options;
             }
         } else {
             $base = '/';
         }
         $allowDirs = array();
         foreach ((array) $cOptions['allowDirs'] as $allowDir) {
             $allowDirs[] = \W3TC\Util_Environment::realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir));
         }
         $basenames = array();
         // just for cache id
         foreach ($files as $file) {
             if ($file instanceof Minify_Source) {
                 $sources[] = $file;
                 continue;
             }
             $uri = $base . $file;
             $path = $_SERVER['DOCUMENT_ROOT'] . $uri;
             $realpath = \W3TC\Util_Environment::realpath($path);
             if (false === $realpath || !is_file($realpath)) {
                 $this->log("The path \"{$path}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
                 if (null === $firstMissingResource) {
                     $firstMissingResource = $uri;
                     continue;
                 } else {
                     $secondMissingResource = $uri;
                     $this->log("More than one file was missing: '{$firstMissingResource}', '{$secondMissingResource}`'");
                     return $options;
                 }
             }
             try {
                 parent::checkNotHidden($realpath);
                 parent::checkAllowDirs($realpath, $allowDirs, $uri);
             } catch (Exception $e) {
                 $this->log($e->getMessage());
                 return $options;
             }
             $sources[] = $this->_getFileSource($realpath, $cOptions);
             $basenames[] = basename($realpath, $ext);
         }
         if ($this->selectionId) {
             $this->selectionId .= '_f=';
         }
         $this->selectionId .= implode(',', $basenames) . $ext;
     }
     if ($sources) {
         if (null !== $firstMissingResource) {
             array_unshift($sources, new Minify_Source(array('id' => 'missingFile', 'lastModified' => 0, 'content' => "/* Minify: at least one missing file. See " . Minify0_Minify::URL_DEBUG . " */\n", 'minifier' => '')));
         }
         $this->sources = $sources;
     } else {
         $this->log("No sources to serve");
     }
     return $options;
 }
開發者ID:developmentDM2,項目名稱:Whohaha,代碼行數:101,代碼來源:MinApp.php


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