C:\xampp\htdocs\landing\wp-content\plugins\totalpoll\src\Limitations\Region.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

namespace TotalPoll\Limitations;
defined'ABSPATH' ) && exit();



use 
TotalPollVendors\TotalCore\Limitations\Limitation;

/**
 * Region Limitation
 * @package TotalPoll\Limitations
 */
class Region extends Limitation {
    
/**
     * Limitation check logic.
     *
     * @return bool|\WP_Error
     */
    
public function check() {
        
        foreach ( (array) 
$this->args['rules'] as $rule ):
            
$ip str_replace' ''', empty( $rule['ip'] ) ? '' $rule['ip'] );
            if ( empty( 
$ip ) ):
                continue;
            endif;

            
$regexp str_replace'\*''.+'preg_quote$ip'/' ) );
            
$result = (bool) preg_match"/{$regexp}/i"$this->args['ip'] );

            if ( ( 
$result && $rule['type'] === 'deny' ) || ( ! $result && $rule['type'] === 'allow' ) ):
                return new \
WP_Error'region'__'This poll is not available in your region.''totalpoll' ) );
            endif;
        endforeach;

        

        return 
true;
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586