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


PHP wfUtils::errorsOn方法代码示例

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


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

示例1: fileTooBig

 public static function fileTooBig($file)
 {
     //Deals with files > 2 gigs on 32 bit systems which are reported with the wrong size due to integer overflow
     wfUtils::errorsOff();
     $fh = @fopen($file, 'r');
     wfUtils::errorsOn();
     if (!$fh) {
         return false;
     }
     $offset = WORDFENCE_MAX_FILE_SIZE_TO_PROCESS + 1;
     $tooBig = false;
     try {
         if (@fseek($fh, $offset, SEEK_SET) === 0) {
             if (strlen(fread($fh, 1)) === 1) {
                 $tooBig = true;
             }
         }
         //Otherwise we couldn't seek there so it must be smaller
         fclose($fh);
         return $tooBig;
     } catch (Exception $e) {
         return true;
     }
     //If we get an error don't scan this file, report it's too big.
 }
开发者ID:VizualAbstract,项目名称:Marilyn,代码行数:25,代码来源:wfUtils.php

示例2: wfHash

 public static function wfHash($file)
 {
     wfUtils::errorsOff();
     $md5 = @md5_file($file, false);
     wfUtils::errorsOn();
     if (!$md5) {
         return false;
     }
     $fp = @fopen($file, "rb");
     if (!$fp) {
         return false;
     }
     $ctx = hash_init('sha256');
     while (!feof($fp)) {
         hash_update($ctx, str_replace(array("\n", "\r", "\t", " "), "", fread($fp, 65536)));
     }
     $shac = hash_final($ctx, false);
     return array($md5, $shac);
 }
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:19,代码来源:wordfenceHash.php

示例3: scan_diskSpace

 private function scan_diskSpace()
 {
     $this->statusIDX['diskSpace'] = wordfence::statusStart("Scanning to check available disk space");
     wfUtils::errorsOff();
     $total = @disk_total_space('.');
     $free = @disk_free_space('.');
     wfUtils::errorsOn();
     if (!$total || !$free) {
         //If we get zeros it's probably not reading right. If free is zero then we're out of space and already in trouble.
         wordfence::statusEnd($this->statusIDX['diskSpace'], false);
         return;
     }
     $this->status(2, 'info', "Total disk space: " . sprintf('%.4f', $total / 1024 / 1024 / 1024) . "GB -- Free disk space: " . sprintf('%.4f', $free / 1024 / 1024 / 1024) . "GB");
     $freeMegs = sprintf('%.2f', $free / 1024 / 1024);
     $this->status(2, 'info', "The disk has {$freeMegs} MB space available");
     if ($freeMegs < 5) {
         $level = 1;
     } else {
         if ($freeMegs < 20) {
             $level = 2;
         } else {
             wordfence::statusEnd($this->statusIDX['diskSpace'], false);
             return;
         }
     }
     if ($this->addIssue('diskSpace', $level, 'diskSpace' . $level, 'diskSpace' . $level, "You have {$freeMegs}" . "MB disk space remaining", "You only have {$freeMegs}" . " Megabytes of your disk space remaining. Please free up disk space or your website may stop serving requests.", array('spaceLeft' => $freeMegs . "MB"))) {
         wordfence::statusEnd($this->statusIDX['diskSpace'], true);
     } else {
         wordfence::statusEnd($this->statusIDX['diskSpace'], false);
     }
 }
开发者ID:rinodung,项目名称:myfreetheme,代码行数:31,代码来源:wfScanEngine.php

示例4: getTempDir

 private static function getTempDir()
 {
     if (!self::$tmpDirCache) {
         $dirs = self::getPotentialTempDirs();
         $finalDir = 'notmp';
         wfUtils::errorsOff();
         foreach ($dirs as $dir) {
             $dir = rtrim($dir, '/') . '/';
             $fh = @fopen($dir . 'wftmptest.txt', 'w');
             if (!$fh) {
                 continue;
             }
             $bytes = @fwrite($fh, 'test');
             if ($bytes != 4) {
                 @fclose($fh);
                 continue;
             }
             @fclose($fh);
             if (!@unlink($dir . 'wftmptest.txt')) {
                 continue;
             }
             $finalDir = $dir;
             break;
         }
         wfUtils::errorsOn();
         self::$tmpDirCache = $finalDir;
     }
     if (self::$tmpDirCache == 'notmp') {
         return false;
     } else {
         return self::$tmpDirCache;
     }
 }
开发者ID:HandsomeDogStudio,项目名称:peanutbutterplan,代码行数:33,代码来源:wfConfig.php

示例5: getTempDir

 private static function getTempDir()
 {
     if (!self::$tmpDirCache) {
         $dirs = array(wfUtils::getPluginBaseDir() . 'wordfence/tmp/', sys_get_temp_dir(), ABSPATH . 'wp-content/uploads/');
         $finalDir = 'notmp';
         wfUtils::errorsOff();
         foreach ($dirs as $dir) {
             $dir = rtrim($dir, '/') . '/';
             $fh = @fopen($dir . 'wftmptest.txt', 'w');
             if (!$fh) {
                 continue;
             }
             $bytes = @fwrite($fh, 'test');
             if ($bytes != 4) {
                 @fclose($fh);
                 continue;
             }
             @fclose($fh);
             if (!@unlink($dir . 'wftmptest.txt')) {
                 continue;
             }
             $finalDir = $dir;
             break;
         }
         wfUtils::errorsOn();
         self::$tmpDirCache = $finalDir;
     }
     if (self::$tmpDirCache == 'notmp') {
         return false;
     } else {
         return self::$tmpDirCache;
     }
 }
开发者ID:Alpha7Sg,项目名称:wordpress-custom,代码行数:33,代码来源:wfConfig.php


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