C:\xampp\htdocs\landing\wp-content\updraft\plugins-old\totalpoll\src\Limitations\Membership.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
41
42
43
44
45
46
47
48
49
50
51
<?php

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



use 
TotalPollVendors\TotalCore\Limitations\Limitation;

/**
 * Membership Limitation.
 * @package TotalPoll\Limitations
 */
class Membership extends Limitation {
    
/**
     * Limitation check logic.
     *
     * @return bool|\WP_Error
     */
    
public function check() {
        
        
$roles = empty( $this->args['roles'] ) ? [] : (array) $this->args['roles'];

        if ( 
is_user_logged_in() ):
            if ( ! empty( 
$roles ) && ! in_array$GLOBALS['current_user']->roles[0], $roles ) ):
                
$roles implode', 'array_map'translate_user_role'$roles ) );

                return new \
WP_Error(
                    
'membership_type',
                    
sprintf(
                        
__'To continue, you must be a part of these roles: %s.''totalpoll' ),
                        
$roles
                    
)
                );

            endif;
        else:
            return new \
WP_Error(
                
'logged_in',
                
sprintf(
                    
__'To continue, please <a href="%s">sign in</a> or <a href="%s">register</a>.''totalpoll' ),
                    
wp_login_urlhome_urladd_query_argnullnull ) ) ),
                    
wp_registration_url()
                )
            );
        endif;
        

        return 
true;
    }
}
x

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