/**
  * Is the user allowed to access to frontend?
  *
  * @return bool
  * @since 1.0.0
  * @access protected
  */
 protected function _userIsAllowed()
 {
     //super admin
     if (current_user_can('manage_network') || current_user_can('administrator')) {
         return true;
     }
     $allowed = get_option('yith_maintenance_roles');
     $user_roles = yit_user_roles();
     $is_allowed = false;
     foreach ($user_roles as $role) {
         if (in_array($role, $allowed)) {
             $is_allowed = true;
             break;
         }
     }
     return $is_allowed;
 }
예제 #2
0
	/**
	 * Is the user allowed to access to frontend?
	 * 
	 * @return bool
	 * @since 1.0.0
	 * @access protected
	 */
	protected function _userIsAllowed() {
		//super admin
		if( current_user_can('manage_network') || current_user_can('administrator') ) {
			return true;
		}

		$roles = json_decode(stripslashes(yit_get_option('maintenance-allowed_roles')), true);
		$allowed = array_keys( (array)$roles['allowed'] );
		$user_roles = yit_user_roles();
		
		$is_allowed = false;
		
		foreach( $user_roles as $role ) {
			if( in_array( $role, $allowed ) ) {
				$is_allowed = true;
				break;
			}
		}
		
		return $is_allowed;
	}
예제 #3
0
 function yit_prelaunch_dequeue_script_and_style()
 {
     if (function_exists('YIT_Asset') && class_exists('YITH_Prelaunch_Frontend')) {
         if (method_exists('YITH_Prelaunch_Frontend', 'userIsAllowed') && !YITH_Prelaunch_Frontend::userIsAllowed()) {
             $is_allowed = true;
         } else {
             $is_allowed = false;
             //super admin
             if (current_user_can('manage_network') || current_user_can('administrator')) {
                 $is_allowed = true;
             }
             $allowed = get_option('yith_prelaunch_roles');
             $user_roles = yit_user_roles();
             foreach ($user_roles as $role) {
                 if (in_array($role, $allowed)) {
                     $is_allowed = true;
                     break;
                 }
             }
         }
         if (!$is_allowed) {
             YIT_Asset()->dequeue_all('style');
             YIT_Asset()->dequeue_all('script');
         }
     }
 }