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


PHP wordfence::getWAFBootstrapPath方法代码示例

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


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

示例1: dataForFile

 /**
  * @param string $file
  * @return array
  */
 private function dataForFile($file, $fullPath = null)
 {
     $loader = $this->scanEngine->getKnownFilesLoader();
     $data = array();
     if ($isKnownFile = $loader->isKnownFile($file)) {
         if ($loader->isKnownCoreFile($file)) {
             $data['cType'] = 'core';
         } else {
             if ($loader->isKnownPluginFile($file)) {
                 $data['cType'] = 'plugin';
                 list($itemName, $itemVersion, $cKey) = $loader->getKnownPluginData($file);
                 $data = array_merge($data, array('cName' => $itemName, 'cVersion' => $itemVersion, 'cKey' => $cKey));
             } else {
                 if ($loader->isKnownThemeFile($file)) {
                     $data['cType'] = 'theme';
                     list($itemName, $itemVersion, $cKey) = $loader->getKnownThemeData($file);
                     $data = array_merge($data, array('cName' => $itemName, 'cVersion' => $itemVersion, 'cKey' => $cKey));
                 }
             }
         }
     }
     $suppressDelete = false;
     $canRegenerate = false;
     if ($fullPath !== null) {
         $bootstrapPath = wordfence::getWAFBootstrapPath();
         $htaccessPath = get_home_path() . '.htaccess';
         $userIni = ini_get('user_ini.filename');
         $userIniPath = false;
         if ($userIni) {
             $userIniPath = get_home_path() . $userIni;
         }
         if ($fullPath == $htaccessPath) {
             $suppressDelete = true;
         } else {
             if ($userIniPath !== false && $fullPath == $userIniPath) {
                 $suppressDelete = true;
             } else {
                 if ($fullPath == $bootstrapPath) {
                     $suppressDelete = true;
                     $canRegenerate = true;
                 }
             }
         }
     }
     $data['canDiff'] = $isKnownFile;
     $data['canFix'] = $isKnownFile;
     $data['canDelete'] = !$isKnownFile && !$canRegenerate && !$suppressDelete;
     $data['canRegenerate'] = $canRegenerate;
     return $data;
 }
开发者ID:VizualAbstract,项目名称:Marilyn,代码行数:54,代码来源:wordfenceScanner.php

示例2: uninstall

 public function uninstall()
 {
     /** @var WP_Filesystem_Base $wp_filesystem */
     global $wp_filesystem;
     $htaccessPath = $this->getHtaccessPath();
     $userIniPath = $this->getUserIniPath();
     $adminURL = admin_url('/');
     $allow_relaxed_file_ownership = true;
     $homePath = dirname($htaccessPath);
     ob_start();
     if (false === ($credentials = request_filesystem_credentials($adminURL, '', false, $homePath, array('version', 'locale'), $allow_relaxed_file_ownership))) {
         ob_end_clean();
         return false;
     }
     if (!WP_Filesystem($credentials, $homePath, $allow_relaxed_file_ownership)) {
         // Failed to connect, Error and request again
         request_filesystem_credentials($adminURL, '', true, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership);
         ob_end_clean();
         return false;
     }
     if ($wp_filesystem->errors->get_error_code()) {
         ob_end_clean();
         return false;
     }
     ob_end_clean();
     if ($wp_filesystem->is_file($htaccessPath)) {
         $htaccessContent = $wp_filesystem->get_contents($htaccessPath);
         $regex = '/# Wordfence WAF.*?# END Wordfence WAF/is';
         if (preg_match($regex, $htaccessContent, $matches)) {
             $htaccessContent = preg_replace($regex, '', $htaccessContent);
             if (!$wp_filesystem->put_contents($htaccessPath, $htaccessContent)) {
                 return false;
             }
         }
     }
     if ($wp_filesystem->is_file($userIniPath)) {
         $userIniContent = $wp_filesystem->get_contents($userIniPath);
         $regex = '/; Wordfence WAF.*?; END Wordfence WAF/is';
         if (preg_match($regex, $userIniContent, $matches)) {
             $userIniContent = preg_replace($regex, '', $userIniContent);
             if (!$wp_filesystem->put_contents($userIniPath, $userIniContent)) {
                 return false;
             }
         }
     }
     $bootstrapPath = wordfence::getWAFBootstrapPath();
     if ($wp_filesystem->is_file($bootstrapPath)) {
         $wp_filesystem->delete($bootstrapPath);
     }
     return true;
 }
开发者ID:ashenkar,项目名称:sanga,代码行数:51,代码来源:wordfenceClass.php

示例3: array

	<?php 
require 'menuHeader.php';
?>
	<?php 
$pageTitle = "Wordfence Web Application Firewall";
$helpLink = "http://docs.wordfence.com/en/WAF";
$helpLabel = "Learn more about the Wordfence Web Application Firewall";
include 'pageTitle.php';
?>
	<div class="wordfenceModeElem" id="wordfenceMode_waf"></div>

	<?php 
if (defined('WFWAF_ENABLED') && !WFWAF_ENABLED) {
    $message = 'To allow the firewall to re-enable, please remove this line from the appropriate file.';
    $pattern = '/define\\s*\\(\\s*(?:\'WFWAF_ENABLED\'|"WFWAF_ENABLED")\\s*,(.+?)\\)/x';
    $checkFiles = array(ABSPATH . 'wp-config.php', wordfence::getWAFBootstrapPath());
    foreach ($checkFiles as $path) {
        if (!file_exists($path)) {
            continue;
        }
        if (($contents = file_get_contents($path)) !== false) {
            if (preg_match($pattern, $contents, $matches) && (trim($matches[1]) == 'false' || trim($matches[1]) == '0')) {
                $message = "To allow the firewall to re-enable, please remove this line from the file '" . $path . "'.";
                break;
            }
        }
    }
    ?>
	<p class="wf-notice">The Wordfence Firewall is currently disabled because WFWAF_ENABLED is overridden and set to false. <?php 
    echo $message;
    ?>
开发者ID:VizualAbstract,项目名称:Marilyn,代码行数:31,代码来源:menu_waf.php


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