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


PHP DevblocksPlatform::strAlphaNum方法代碼示例

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


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

示例1: readRequest

 /**
  * Reads the HTTP Request object.
  * 
  * @return DevblocksHttpRequest
  */
 static function readRequest()
 {
     $url = DevblocksPlatform::getUrlService();
     $location = self::getWebPath();
     $parts = $url->parseURL($location);
     // Add any query string arguments (?arg=value&arg=value)
     @($query = $_SERVER['QUERY_STRING']);
     $queryArgs = $url->parseQueryString($query);
     if (empty($parts)) {
         // Overrides (Form POST, etc.)
         // Controller (GET has precedence over POST)
         if (isset($_GET['c'])) {
             @($uri = DevblocksPlatform::importGPC($_GET['c']));
             // extension
         } elseif (isset($_POST['c'])) {
             @($uri = DevblocksPlatform::importGPC($_POST['c']));
             // extension
         }
         if (!empty($uri)) {
             $parts[] = DevblocksPlatform::strAlphaNum($uri);
         }
         // Action (GET has precedence over POST)
         if (isset($_GET['a'])) {
             @($listener = DevblocksPlatform::importGPC($_GET['a']));
             // listener
         } elseif (isset($_POST['a'])) {
             @($listener = DevblocksPlatform::importGPC($_POST['a']));
             // listener
         }
         if (!empty($listener)) {
             $parts[] = DevblocksPlatform::strAlphaNum($listener);
         }
     }
     // Controller XSS security (alphanum only)
     if (isset($parts[0])) {
         $parts[0] = DevblocksPlatform::strAlphaNum($parts[0]);
     }
     // Resource / Proxy
     /*
      * [TODO] Run this code through another audit.  Is it worth a tiny hit per resource 
      * to verify the plugin matches exactly in the DB?  If so, make sure we cache the 
      * resulting file.
      * 
      * [TODO] Make this a controller
      */
     $path = $parts;
     switch (array_shift($path)) {
         case "resource":
             $plugin_id = array_shift($path);
             if (null == ($plugin = DevblocksPlatform::getPlugin($plugin_id))) {
                 break;
             }
             $file = implode(DIRECTORY_SEPARATOR, $path);
             // combine path
             $dir = APP_PATH . '/' . $plugin->dir . '/' . 'resources';
             if (!is_dir($dir)) {
                 die("");
             }
             // basedir Security
             $resource = $dir . '/' . $file;
             if (0 != strstr($dir, $resource)) {
                 die("");
             }
             $ext = @array_pop(explode('.', $resource));
             if (!is_file($resource) || 'php' == $ext) {
                 die("");
             }
             // extension security
             // Caching
             switch ($ext) {
                 case 'css':
                 case 'gif':
                 case 'jpg':
                 case 'js':
                 case 'png':
                     header('Cache-control: max-age=604800', true);
                     // 1 wk // , must-revalidate
                     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT');
                     // 1 wk
                     break;
             }
             switch ($ext) {
                 case 'css':
                     header('Content-type: text/css;');
                     break;
                 case 'gif':
                     header('Content-type: image/gif;');
                     break;
                 case 'jpeg':
                 case 'jpg':
                     header('Content-type: image/jpeg;');
                     break;
                 case 'js':
                     header('Content-type: text/javascript;');
                     break;
//.........這裏部分代碼省略.........
開發者ID:jstanden,項目名稱:devblocks,代碼行數:101,代碼來源:Devblocks.class.php


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