当前位置: 首页>>代码示例>>PHP>>正文


PHP wfUtils::fileOver2Gigs方法代码示例

本文整理汇总了PHP中wfUtils::fileOver2Gigs方法的典型用法代码示例。如果您正苦于以下问题:PHP wfUtils::fileOver2Gigs方法的具体用法?PHP wfUtils::fileOver2Gigs怎么用?PHP wfUtils::fileOver2Gigs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wfUtils的用法示例。


在下文中一共展示了wfUtils::fileOver2Gigs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wfFunc_view

 public static function wfFunc_view()
 {
     $localFile = ABSPATH . preg_replace('/^(?:\\.\\.|[\\/]+)/', '', sanitize_text_field($_GET['file']));
     if (strpos($localFile, '..') !== false) {
         echo "Invalid file requested. (Relative paths not allowed)";
         exit;
     }
     if (preg_match('/[\'\\"<>\\!\\{\\}\\(\\)\\&\\@\\%\\$\\*\\+\\[\\]\\?]+/', $localFile)) {
         echo "File contains illegal characters.";
         exit;
     }
     $cont = @file_get_contents($localFile);
     $isEmpty = false;
     if (!$cont) {
         if (file_exists($localFile) && filesize($localFile) === 0) {
             //There's a remote possibility that very large files on 32 bit systems will return 0 here, but it's about 1 in 2 billion
             $isEmpty = true;
         } else {
             $err = error_get_last();
             echo "We could not open the requested file for reading. The error was: " . $err['message'];
             exit(0);
         }
     }
     $fileMTime = @filemtime($localFile);
     $fileMTime = date('l jS \\of F Y h:i:s A', $fileMTime);
     try {
         if (wfUtils::fileOver2Gigs($localFile)) {
             $fileSize = "Greater than 2 Gigs";
         } else {
             $fileSize = @filesize($localFile);
             //Checked if over 2 gigs above
             $fileSize = number_format($fileSize, 0, '', ',') . ' bytes';
         }
     } catch (Exception $e) {
         $fileSize = 'Unknown file size.';
     }
     require 'wfViewResult.php';
     exit(0);
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:39,代码来源:wordfenceClass.php

示例2: wfFunc_view

 public static function wfFunc_view()
 {
     $localFile = ABSPATH . '/' . preg_replace('/^(?:\\.\\.|[\\/]+)/', '', $_GET['file']);
     if (strpos($localFile, '..') !== false) {
         echo "Invalid file requested. (Relative paths not allowed)";
         exit;
     }
     $lang = false;
     $cont = @file_get_contents($localFile);
     $isEmpty = false;
     if (!$cont) {
         if (file_exists($localFile) && filesize($localFile) === 0) {
             //There's a remote possibility that very large files on 32 bit systems will return 0 here, but it's about 1 in 2 billion
             $isEmpty = true;
         } else {
             $err = error_get_last();
             echo "We could not open the requested file for reading. The error was: " . $err['message'];
             exit(0);
         }
     }
     $fileMTime = @filemtime($localFile);
     $fileMTime = date('l jS \\of F Y h:i:s A', $fileMTime);
     if (wfUtils::fileOver2Gigs($localFile)) {
         $fileSize = "Greater than 2 Gigs";
     } else {
         $fileSize = @filesize($localFile);
         //Checked if over 2 gigs above
         $fileSize = number_format($fileSize, 0, '', ',') . ' bytes';
     }
     require 'wfViewResult.php';
     exit(0);
 }
开发者ID:verbazend,项目名称:AWFA,代码行数:32,代码来源:wordfenceClass.php


注:本文中的wfUtils::fileOver2Gigs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。