本文整理汇总了PHP中wfUtils::cleanupOneEntryPerLine方法的典型用法代码示例。如果您正苦于以下问题:PHP wfUtils::cleanupOneEntryPerLine方法的具体用法?PHP wfUtils::cleanupOneEntryPerLine怎么用?PHP wfUtils::cleanupOneEntryPerLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wfUtils
的用法示例。
在下文中一共展示了wfUtils::cleanupOneEntryPerLine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExcludeFilePattern
/**
* Return regular expression to exclude files or false if
* there is no pattern
*
* @return string|boolean
*/
public static function getExcludeFilePattern()
{
if (self::$excludePattern !== NULL) {
return self::$excludePattern;
}
if (wfConfig::get('scan_exclude', false)) {
$exParts = explode("\n", wfUtils::cleanupOneEntryPerLine(wfConfig::get('scan_exclude')));
foreach ($exParts as &$exPart) {
$exPart = preg_quote(trim($exPart), '/');
$exPart = preg_replace('/\\\\\\*/', '.*', $exPart);
}
self::$excludePattern = '/^(?:' . implode('|', array_filter($exParts)) . ')$/i';
self::$excludePattern = '/(?:' . implode('|', array_filter($exParts)) . ')$/i';
} else {
self::$excludePattern = false;
}
return self::$excludePattern;
}
示例2:
href="http://docs.wordfence.com/en/Wordfence_options#Prevent_discovery_of_usernames_through_.27.3F.2Fauthor.3DN.27_scans"
target="_blank" class="wfhelp"></a></th>
<td><input type="checkbox" id="loginSec_disableAuthorScan" class="wfConfigElem"
name="loginSec_disableAuthorScan" <?php
$w->cb('loginSec_disableAuthorScan');
?>
/>
</td>
</tr>
<tr>
<th style="vertical-align: top;">Immediately block the IP of users who try to sign in as these usernames<a
href="http://docs.wordfence.com/en/Wordfence_options#Immediately_block_the_IP_of_users_who_try_to_sign_in_as_these_usernames"
target="_blank" class="wfhelp"></a></th>
<td>
<textarea name="loginSec_userBlacklist" cols="40" rows="4" id="loginSec_userBlacklist"><?php
echo wfUtils::cleanupOneEntryPerLine($w->getHTML('loginSec_userBlacklist'));
?>
</textarea><br/>
(One per line. Existing users won't be blocked.)
</td>
</tr>
<tr>
<td colspan="2">
<div class="wfMarker" id="wfMarkerOtherOptions"></div>
<h3 class="wfConfigHeading">Other Options<a
href="http://docs.wordfence.com/en/Wordfence_options#Other_Options" target="_blank"
class="wfhelp"></a></h3>
</td>
</tr>
<tr>
示例3: ajax_saveConfig_callback
public static function ajax_saveConfig_callback()
{
$reload = '';
$opts = wfConfig::parseOptions();
// These are now on the Diagnostics page, so they aren't sent across.
foreach (self::$diagnosticParams as $param) {
$opts[$param] = wfConfig::get($param);
}
$emails = array();
foreach (explode(',', preg_replace('/[\\r\\n\\s\\t]+/', '', $opts['alertEmails'])) as $email) {
if (strlen($email) > 0) {
$emails[] = $email;
}
}
if (sizeof($emails) > 0) {
$badEmails = array();
foreach ($emails as $email) {
if (!preg_match('/^[^@]+@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,11})$/i', $email)) {
$badEmails[] = $email;
}
}
if (sizeof($badEmails) > 0) {
return array('errorMsg' => "The following emails are invalid: " . wp_kses(implode(', ', $badEmails), array()));
}
$opts['alertEmails'] = implode(',', $emails);
} else {
$opts['alertEmails'] = '';
}
$opts['scan_exclude'] = wfUtils::cleanupOneEntryPerLine($opts['scan_exclude']);
foreach (explode("\n", $opts['scan_include_extra']) as $regex) {
if (@preg_match("/{$regex}/", "") === FALSE) {
return array('errorMsg' => "\"" . esc_html($regex) . "\" is not a valid regular expression");
}
}
$whiteIPs = array();
foreach (explode(',', preg_replace('/[\\r\\n\\s\\t]+/', '', $opts['whitelisted'])) as $whiteIP) {
if (strlen($whiteIP) > 0) {
$whiteIPs[] = $whiteIP;
}
}
if (sizeof($whiteIPs) > 0) {
$badWhiteIPs = array();
$range = new wfUserIPRange();
foreach ($whiteIPs as $whiteIP) {
$range->setIPString($whiteIP);
if (!$range->isValidRange()) {
$badWhiteIPs[] = $whiteIP;
}
}
if (sizeof($badWhiteIPs) > 0) {
return array('errorMsg' => "Please make sure you separate your IP addresses with commas. The following whitelisted IP addresses are invalid: " . wp_kses(implode(', ', $badWhiteIPs), array()));
}
$opts['whitelisted'] = implode(',', $whiteIPs);
} else {
$opts['whitelisted'] = '';
}
$validUsers = array();
$invalidUsers = array();
foreach (explode(',', $opts['liveTraf_ignoreUsers']) as $val) {
$val = trim($val);
if (strlen($val) > 0) {
if (get_user_by('login', $val)) {
$validUsers[] = $val;
} else {
$invalidUsers[] = $val;
}
}
}
$opts['loginSec_userBlacklist'] = wfUtils::cleanupOneEntryPerLine($opts['loginSec_userBlacklist']);
$opts['apiKey'] = trim($opts['apiKey']);
if ($opts['apiKey'] && !preg_match('/^[a-fA-F0-9]+$/', $opts['apiKey'])) {
//User entered something but it's garbage.
return array('errorMsg' => "You entered an API key but it is not in a valid format. It must consist only of characters A to F and 0 to 9.");
}
if (sizeof($invalidUsers) > 0) {
return array('errorMsg' => "The following users you selected to ignore in live traffic reports are not valid on this system: " . wp_kses(implode(', ', $invalidUsers), array()));
}
if (sizeof($validUsers) > 0) {
$opts['liveTraf_ignoreUsers'] = implode(',', $validUsers);
} else {
$opts['liveTraf_ignoreUsers'] = '';
}
$validIPs = array();
$invalidIPs = array();
foreach (explode(',', preg_replace('/[\\r\\n\\s\\t]+/', '', $opts['liveTraf_ignoreIPs'])) as $val) {
if (strlen($val) > 0) {
if (wfUtils::isValidIP($val)) {
$validIPs[] = $val;
} else {
$invalidIPs[] = $val;
}
}
}
if (sizeof($invalidIPs) > 0) {
return array('errorMsg' => "The following IPs you selected to ignore in live traffic reports are not valid: " . wp_kses(implode(', ', $invalidIPs), array()));
}
if (sizeof($validIPs) > 0) {
$opts['liveTraf_ignoreIPs'] = implode(',', $validIPs);
}
if (preg_match('/[a-zA-Z0-9\\d]+/', $opts['liveTraf_ignoreUA'])) {
//.........这里部分代码省略.........
示例4: getExcludeFilePattern
/**
* Return regular expression to exclude files or false if
* there is no pattern
*
* @param $whichPatterns int Bitmask indicating which patterns to include.
* @return string|boolean
*/
public static function getExcludeFilePattern($whichPatterns = self::EXCLUSION_PATTERNS_USER)
{
if (isset(self::$excludePatterns[$whichPatterns])) {
return self::$excludePatterns[$whichPatterns];
}
$exParts = array();
if (($whichPatterns & self::EXCLUSION_PATTERNS_USER) > 0) {
if (wfConfig::get('scan_exclude', false)) {
$exParts = explode("\n", wfUtils::cleanupOneEntryPerLine(wfConfig::get('scan_exclude')));
}
}
foreach (self::$builtinExclusions as $pattern) {
if (($pattern['include'] & $whichPatterns) > 0) {
$exParts[] = $pattern['pattern'];
}
}
if (!empty($exParts)) {
foreach ($exParts as &$exPart) {
$exPart = preg_quote(trim($exPart), '/');
$exPart = preg_replace('/\\\\\\*/', '.*', $exPart);
}
//self::$excludePattern = '/^(?:' . implode('|', array_filter($exParts)) . ')$/i';
self::$excludePatterns[$whichPatterns] = '/(?:' . implode('|', array_filter($exParts)) . ')$/i';
} else {
self::$excludePatterns[$whichPatterns] = false;
}
return self::$excludePatterns[$whichPatterns];
}
示例5:
target="_blank" class="wfhelp"></a></th>
<td><input type="checkbox" id="scansEnabled_highSense" class="wfConfigElem"
name="scansEnabled_highSense" value="1" <?php
$w->cb('scansEnabled_highSense');
?>
/>
</td>
</tr>
<tr>
<th>Exclude files from scan that match these wildcard patterns. (One per line).<a
href="http://docs.wordfence.com/en/Wordfence_options#Exclude_files_from_scan_that_match_these_wildcard_patterns."
target="_blank" class="wfhelp"></a></th>
<td>
<textarea id="scan_exclude" class="wfConfigElem" cols="40" rows="4"
name="scan_exclude"><?php
echo wfUtils::cleanupOneEntryPerLine($w->getHTML('scan_exclude'));
?>
</textarea>
</td>
</tr>
<tr>
<td colspan="2">
<div class="wfMarker" id="wfMarkerFirewallRules"></div>
<h3 class="wfConfigHeading">Firewall Rules<a
href="http://docs.wordfence.com/en/Wordfence_options#Firewall_Rules" target="_blank"
class="wfhelp"></a></h3>
</td>
</tr>
<tr>
<th>Immediately block fake Google crawlers:<a
href="http://docs.wordfence.com/en/Wordfence_options#Immediately_block_fake_Google_crawlers:"