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


PHP wordfence::getWPFileContent方法代码示例

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


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

示例1: restore_file

 function restore_file()
 {
     $issueID = $_POST['issueID'];
     $wfIssues = new wfIssues();
     $issue = $wfIssues->getIssueByID($issueID);
     if (!$issue) {
         return array('cerrorMsg' => 'We could not find that issue in our database.');
     }
     $dat = $issue['data'];
     $result = wordfence::getWPFileContent($dat['file'], $dat['cType'], isset($dat['cName']) ? $dat['cName'] : '', isset($dat['cVersion']) ? $dat['cVersion'] : '');
     $file = $dat['file'];
     if (isset($result['cerrorMsg']) && $result['cerrorMsg']) {
         return $result;
     } else {
         if (!$result['fileContent']) {
             return array('cerrorMsg' => 'We could not get the original file to do a repair.');
         }
     }
     if (preg_match('/\\.\\./', $file)) {
         return array('cerrorMsg' => 'An invalid file was specified for repair.');
     }
     $localFile = ABSPATH . '/' . preg_replace('/^[\\.\\/]+/', '', $file);
     $fh = fopen($localFile, 'w');
     if (!$fh) {
         $err = error_get_last();
         if (preg_match('/Permission denied/i', $err['message'])) {
             $errMsg = "You don't have permission to repair that file. You need to either fix the file manually using FTP or change the file permissions and ownership so that your web server has write access to repair the file.";
         } else {
             $errMsg = 'We could not write to that file. The error was: ' . $err['message'];
         }
         return array('cerrorMsg' => $errMsg);
     }
     flock($fh, LOCK_EX);
     $bytes = fwrite($fh, $result['fileContent']);
     flock($fh, LOCK_UN);
     fclose($fh);
     if ($bytes < 1) {
         return array('cerrorMsg' => "We could not write to that file. ({$bytes} bytes written) You may not have permission to modify files on your WordPress server.");
     }
     $wfIssues->updateIssue($issueID, 'delete');
     return array('ok' => 1, 'file' => $localFile);
 }
开发者ID:jexmex,项目名称:mainwp-child,代码行数:42,代码来源:class-mainwp-child-wordfence.php


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