當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。