Completed
Push — master ( 61a587...35416d )
by CodexShaper
03:28
created
admin/class-wpb-admin-submenu.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -22,153 +22,153 @@
 block discarded – undo
22 22
  */
23 23
 class WPB_Admin_SubMenu {
24 24
 
25
-	/**
26
-	 * The menu page title.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   public
30
-	 * @var      string    $page_title    The string used to set menu page title.
31
-	 */
32
-	public $page_title;
33
-
34
-	/**
35
-	 * The menu title.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   public
39
-	 * @var      string    $menu_title    The string used to set menu title.
40
-	 */
41
-	public $menu_title;
42
-
43
-	/**
44
-	 * The menu capability.
45
-	 *
46
-	 * @since    1.0.0
47
-	 * @access   public
48
-	 * @var      string    $capability    The string used to set menu capability.
49
-	 */
50
-	public $capability;
51
-
52
-	/**
53
-	 * The menu slug.
54
-	 *
55
-	 * @since    1.0.0
56
-	 * @access   public
57
-	 * @var      string    $slug    The string used to set menu slug.
58
-	 */
59
-	public $slug;
60
-
61
-	/**
62
-	 * The callback to render content.
63
-	 *
64
-	 * @since    1.0.0
65
-	 * @access   public
66
-	 * @var      callback    $callback    The callback used to render content.
67
-	 */
68
-	public $callback;
69
-
70
-	/**
71
-	 * The menu icon.
72
-	 *
73
-	 * @since    1.0.0
74
-	 * @access   public
75
-	 * @var      string    $icon    The string used to set menu icon.
76
-	 */
77
-	public $icon;
78
-
79
-	/**
80
-	 * The menu position.
81
-	 *
82
-	 * @since    1.0.0
83
-	 * @access   public
84
-	 * @var      int    $position    The string used to set menu position.
85
-	 */
86
-	public $position;
87
-
88
-	/**
89
-	 * The menu plugin name.
90
-	 *
91
-	 * @since    1.0.0
92
-	 * @access   private
93
-	 * @var      string    $plugin_name    The string used to uniquely identify this plugin.
94
-	 */
95
-	private $plugin_name;
96
-
97
-	/**
98
-	 * Boot Menu.
99
-	 *
100
-	 * @param  string $plugin_name The string used to uniquely identify this plugin.
101
-	 * @since    1.0.0
102
-	 * @access   public
103
-	 */
104
-	public function __construct( $plugin_name ) {
105
-		$this->plugin_name = $plugin_name;
106
-	}
107
-
108
-	/**
109
-	 * Create a new menu page.
110
-	 *
111
-	 * @since    1.0.0
112
-	 * @access   public
113
-	 */
114
-	public function save() {
115
-		add_action( 'admin_menu', array( $this, 'create_submenu' ) );
116
-	}
117
-
118
-	/**
119
-	 * Create a new submenu page.
120
-	 *
121
-	 * @since    1.0.0
122
-	 * @param    array $options Pass proprties as an array.
123
-	 * @access   public
124
-	 */
125
-	public function make( $options = array() ) {
126
-		foreach ( $options as $property => $value ) {
127
-			if ( property_exists( $this, $property ) ) {
128
-				$this->{$property} = $value;
129
-			}
130
-		}
131
-		add_action( 'admin_menu', array( $this, 'create_submenu' ) );
132
-	}
133
-
134
-	/**
135
-	 * Register new submenu page.
136
-	 *
137
-	 * @return void
138
-	 */
139
-	public function create_submenu() {
140
-		if ( current_user_can( $this->capability ) ) {
141
-			$hook = add_submenu_page(
142
-				$this->parent_slug,
143
-				$this->page_title,
144
-				$this->menu_title,
145
-				$this->capability,
146
-				$this->slug,
147
-				$this->callback,
148
-				$this->icon
149
-			);
150
-		}
151
-
152
-		add_action( 'load-' . $hook, array( $this, 'init_hooks' ) );
153
-	}
154
-
155
-	/**
156
-	 * Initialize hooks for the admin page.
157
-	 *
158
-	 * @return void
159
-	 */
160
-	public function init_hooks() {
161
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
162
-	}
163
-
164
-	/**
165
-	 * Load scripts and styles for the submenu page.
166
-	 *
167
-	 * @return void
168
-	 */
169
-	public function enqueue_scripts() {
170
-		wp_enqueue_style( $this->plugin_name . '-vendors' );
171
-		wp_enqueue_style( $this->plugin_name . '-admin' );
172
-		wp_enqueue_script( $this->plugin_name . '-admin' );
173
-	}
25
+    /**
26
+     * The menu page title.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   public
30
+     * @var      string    $page_title    The string used to set menu page title.
31
+     */
32
+    public $page_title;
33
+
34
+    /**
35
+     * The menu title.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   public
39
+     * @var      string    $menu_title    The string used to set menu title.
40
+     */
41
+    public $menu_title;
42
+
43
+    /**
44
+     * The menu capability.
45
+     *
46
+     * @since    1.0.0
47
+     * @access   public
48
+     * @var      string    $capability    The string used to set menu capability.
49
+     */
50
+    public $capability;
51
+
52
+    /**
53
+     * The menu slug.
54
+     *
55
+     * @since    1.0.0
56
+     * @access   public
57
+     * @var      string    $slug    The string used to set menu slug.
58
+     */
59
+    public $slug;
60
+
61
+    /**
62
+     * The callback to render content.
63
+     *
64
+     * @since    1.0.0
65
+     * @access   public
66
+     * @var      callback    $callback    The callback used to render content.
67
+     */
68
+    public $callback;
69
+
70
+    /**
71
+     * The menu icon.
72
+     *
73
+     * @since    1.0.0
74
+     * @access   public
75
+     * @var      string    $icon    The string used to set menu icon.
76
+     */
77
+    public $icon;
78
+
79
+    /**
80
+     * The menu position.
81
+     *
82
+     * @since    1.0.0
83
+     * @access   public
84
+     * @var      int    $position    The string used to set menu position.
85
+     */
86
+    public $position;
87
+
88
+    /**
89
+     * The menu plugin name.
90
+     *
91
+     * @since    1.0.0
92
+     * @access   private
93
+     * @var      string    $plugin_name    The string used to uniquely identify this plugin.
94
+     */
95
+    private $plugin_name;
96
+
97
+    /**
98
+     * Boot Menu.
99
+     *
100
+     * @param  string $plugin_name The string used to uniquely identify this plugin.
101
+     * @since    1.0.0
102
+     * @access   public
103
+     */
104
+    public function __construct( $plugin_name ) {
105
+        $this->plugin_name = $plugin_name;
106
+    }
107
+
108
+    /**
109
+     * Create a new menu page.
110
+     *
111
+     * @since    1.0.0
112
+     * @access   public
113
+     */
114
+    public function save() {
115
+        add_action( 'admin_menu', array( $this, 'create_submenu' ) );
116
+    }
117
+
118
+    /**
119
+     * Create a new submenu page.
120
+     *
121
+     * @since    1.0.0
122
+     * @param    array $options Pass proprties as an array.
123
+     * @access   public
124
+     */
125
+    public function make( $options = array() ) {
126
+        foreach ( $options as $property => $value ) {
127
+            if ( property_exists( $this, $property ) ) {
128
+                $this->{$property} = $value;
129
+            }
130
+        }
131
+        add_action( 'admin_menu', array( $this, 'create_submenu' ) );
132
+    }
133
+
134
+    /**
135
+     * Register new submenu page.
136
+     *
137
+     * @return void
138
+     */
139
+    public function create_submenu() {
140
+        if ( current_user_can( $this->capability ) ) {
141
+            $hook = add_submenu_page(
142
+                $this->parent_slug,
143
+                $this->page_title,
144
+                $this->menu_title,
145
+                $this->capability,
146
+                $this->slug,
147
+                $this->callback,
148
+                $this->icon
149
+            );
150
+        }
151
+
152
+        add_action( 'load-' . $hook, array( $this, 'init_hooks' ) );
153
+    }
154
+
155
+    /**
156
+     * Initialize hooks for the admin page.
157
+     *
158
+     * @return void
159
+     */
160
+    public function init_hooks() {
161
+        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
162
+    }
163
+
164
+    /**
165
+     * Load scripts and styles for the submenu page.
166
+     *
167
+     * @return void
168
+     */
169
+    public function enqueue_scripts() {
170
+        wp_enqueue_style( $this->plugin_name . '-vendors' );
171
+        wp_enqueue_style( $this->plugin_name . '-admin' );
172
+        wp_enqueue_script( $this->plugin_name . '-admin' );
173
+    }
174 174
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @since    1.0.0
102 102
 	 * @access   public
103 103
 	 */
104
-	public function __construct( $plugin_name ) {
104
+	public function __construct($plugin_name) {
105 105
 		$this->plugin_name = $plugin_name;
106 106
 	}
107 107
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 * @access   public
113 113
 	 */
114 114
 	public function save() {
115
-		add_action( 'admin_menu', array( $this, 'create_submenu' ) );
115
+		add_action('admin_menu', array($this, 'create_submenu'));
116 116
 	}
117 117
 
118 118
 	/**
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 * @param    array $options Pass proprties as an array.
123 123
 	 * @access   public
124 124
 	 */
125
-	public function make( $options = array() ) {
126
-		foreach ( $options as $property => $value ) {
127
-			if ( property_exists( $this, $property ) ) {
125
+	public function make($options = array()) {
126
+		foreach ($options as $property => $value) {
127
+			if (property_exists($this, $property)) {
128 128
 				$this->{$property} = $value;
129 129
 			}
130 130
 		}
131
-		add_action( 'admin_menu', array( $this, 'create_submenu' ) );
131
+		add_action('admin_menu', array($this, 'create_submenu'));
132 132
 	}
133 133
 
134 134
 	/**
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return void
138 138
 	 */
139 139
 	public function create_submenu() {
140
-		if ( current_user_can( $this->capability ) ) {
140
+		if (current_user_can($this->capability)) {
141 141
 			$hook = add_submenu_page(
142 142
 				$this->parent_slug,
143 143
 				$this->page_title,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 			);
150 150
 		}
151 151
 
152
-		add_action( 'load-' . $hook, array( $this, 'init_hooks' ) );
152
+		add_action('load-'.$hook, array($this, 'init_hooks'));
153 153
 	}
154 154
 
155 155
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return void
159 159
 	 */
160 160
 	public function init_hooks() {
161
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
161
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
162 162
 	}
163 163
 
164 164
 	/**
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @return void
168 168
 	 */
169 169
 	public function enqueue_scripts() {
170
-		wp_enqueue_style( $this->plugin_name . '-vendors' );
171
-		wp_enqueue_style( $this->plugin_name . '-admin' );
172
-		wp_enqueue_script( $this->plugin_name . '-admin' );
170
+		wp_enqueue_style($this->plugin_name.'-vendors');
171
+		wp_enqueue_style($this->plugin_name.'-admin');
172
+		wp_enqueue_script($this->plugin_name.'-admin');
173 173
 	}
174 174
 }
Please login to merge, or discard this patch.
app/Post.php 2 patches
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -24,108 +24,108 @@
 block discarded – undo
24 24
  */
25 25
 class Post extends Model {
26 26
 
27
-	protected $primaryKey = 'ID';
27
+    protected $primaryKey = 'ID';
28 28
 
29
-	/**
30
-	 *  The post type scope.
31
-	 *
32
-	 * @since    1.0.0
33
-	 * @access   protected
34
-	 * @var      string    $plugin_name    The post type scope.
35
-	 */
36
-	protected static $type_scope = 'post';
29
+    /**
30
+     *  The post type scope.
31
+     *
32
+     * @since    1.0.0
33
+     * @access   protected
34
+     * @var      string    $plugin_name    The post type scope.
35
+     */
36
+    protected static $type_scope = 'post';
37 37
 
38
-	/**
39
-	 * The post status scope.
40
-	 *
41
-	 * @since    1.0.0
42
-	 * @access   protected
43
-	 * @var      string    $status_scope    The post status scope.
44
-	 */
45
-	protected static $status_scope = 'publish';
38
+    /**
39
+     * The post status scope.
40
+     *
41
+     * @since    1.0.0
42
+     * @access   protected
43
+     * @var      string    $status_scope    The post status scope.
44
+     */
45
+    protected static $status_scope = 'publish';
46 46
 
47
-	/**
48
-	 * The unique identifier of this plugin.
49
-	 *
50
-	 * @since    1.0.0
51
-	 * @access   protected
52
-	 * @var      string    $author_scope    The author scope..
53
-	 */
54
-	protected static $author_scope = null;
47
+    /**
48
+     * The unique identifier of this plugin.
49
+     *
50
+     * @since    1.0.0
51
+     * @access   protected
52
+     * @var      string    $author_scope    The author scope..
53
+     */
54
+    protected static $author_scope = null;
55 55
 
56
-	/**
57
-	 * The constant used to modify default created at fields.
58
-	 *
59
-	 * @since    1.0.0
60
-	 * @access   protected
61
-	 * @var      string    CREATED_AT    The constant used to modify default created at fields.
62
-	 */
63
-	const CREATED_AT = 'post_date';
56
+    /**
57
+     * The constant used to modify default created at fields.
58
+     *
59
+     * @since    1.0.0
60
+     * @access   protected
61
+     * @var      string    CREATED_AT    The constant used to modify default created at fields.
62
+     */
63
+    const CREATED_AT = 'post_date';
64 64
 
65
-	/**
66
-	 * The constant used to modify default updated at fields.
67
-	 *
68
-	 * @since    1.0.0
69
-	 * @access   protected
70
-	 * @var      string    UPDATED_AT    The constant used to modify default updated at fields.
71
-	 */
72
-	const UPDATED_AT = 'post_modified';
65
+    /**
66
+     * The constant used to modify default updated at fields.
67
+     *
68
+     * @since    1.0.0
69
+     * @access   protected
70
+     * @var      string    UPDATED_AT    The constant used to modify default updated at fields.
71
+     */
72
+    const UPDATED_AT = 'post_modified';
73 73
 
74
-	/**
75
-	 * Boot the model.
76
-	 *
77
-	 * @since    1.0.0
78
-	 * @access   protected
79
-	 *
80
-	 * @return void
81
-	 */
82
-	protected static function boot() {
83
-		parent::boot();
84
-		static::addGlobalScope(
85
-			'type',
86
-			function ( Builder $builder ) {
87
-				$builder->where( 'post_type', '=', static::$type_scope );
88
-			}
89
-		);
74
+    /**
75
+     * Boot the model.
76
+     *
77
+     * @since    1.0.0
78
+     * @access   protected
79
+     *
80
+     * @return void
81
+     */
82
+    protected static function boot() {
83
+        parent::boot();
84
+        static::addGlobalScope(
85
+            'type',
86
+            function ( Builder $builder ) {
87
+                $builder->where( 'post_type', '=', static::$type_scope );
88
+            }
89
+        );
90 90
 
91
-	}
91
+    }
92 92
 
93
-	/**
94
-	 * Filter by post type.
95
-	 *
96
-	 * @param \Illuminate\Database\Eloquent\Builder $builder    The eloquent builder.
97
-	 * @param string                                $type       The post type scope.
98
-	 *
99
-	 * @return mixed
100
-	 */
101
-	public function scopeType( Builder $builder, $type ) {
102
-		self::$type_scope = $type;
103
-		return $builder->where( 'post_type', '=', $type );
104
-	}
93
+    /**
94
+     * Filter by post type.
95
+     *
96
+     * @param \Illuminate\Database\Eloquent\Builder $builder    The eloquent builder.
97
+     * @param string                                $type       The post type scope.
98
+     *
99
+     * @return mixed
100
+     */
101
+    public function scopeType( Builder $builder, $type ) {
102
+        self::$type_scope = $type;
103
+        return $builder->where( 'post_type', '=', $type );
104
+    }
105 105
 
106
-	/**
107
-	 * Filter by post status
108
-	 *
109
-	 * @param \Illuminate\Database\Eloquent\Builder $builder    The eloquent builder.
110
-	 * @param string                                $status     The post status scope.
111
-	 *
112
-	 * @return mixed
113
-	 */
114
-	public function scopeStatus( Builder $builder, $status ) {
115
-		return $builder->where( 'post_status', '=', $status );
116
-	}
106
+    /**
107
+     * Filter by post status
108
+     *
109
+     * @param \Illuminate\Database\Eloquent\Builder $builder    The eloquent builder.
110
+     * @param string                                $status     The post status scope.
111
+     *
112
+     * @return mixed
113
+     */
114
+    public function scopeStatus( Builder $builder, $status ) {
115
+        return $builder->where( 'post_status', '=', $status );
116
+    }
117 117
 
118
-	/**
119
-	 * Filter by post author
120
-	 *
121
-	 * @param \Illuminate\Database\Eloquent\Builder $builder    The eloquent builder.
122
-	 * @param string|null                           $author     The post status scope.
123
-	 *
124
-	 * @return mixed
125
-	 */
126
-	public function scopeAuthor( Builder $builder, $author ) {
127
-		if ( $author ) {
128
-			return $builder->where( 'post_author', '=', $author );
129
-		}
130
-	}
118
+    /**
119
+     * Filter by post author
120
+     *
121
+     * @param \Illuminate\Database\Eloquent\Builder $builder    The eloquent builder.
122
+     * @param string|null                           $author     The post status scope.
123
+     *
124
+     * @return mixed
125
+     */
126
+    public function scopeAuthor( Builder $builder, $author ) {
127
+        if ( $author ) {
128
+            return $builder->where( 'post_author', '=', $author );
129
+        }
130
+    }
131 131
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 		parent::boot();
84 84
 		static::addGlobalScope(
85 85
 			'type',
86
-			function ( Builder $builder ) {
87
-				$builder->where( 'post_type', '=', static::$type_scope );
86
+			function(Builder $builder) {
87
+				$builder->where('post_type', '=', static::$type_scope);
88 88
 			}
89 89
 		);
90 90
 
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return mixed
100 100
 	 */
101
-	public function scopeType( Builder $builder, $type ) {
101
+	public function scopeType(Builder $builder, $type) {
102 102
 		self::$type_scope = $type;
103
-		return $builder->where( 'post_type', '=', $type );
103
+		return $builder->where('post_type', '=', $type);
104 104
 	}
105 105
 
106 106
 	/**
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return mixed
113 113
 	 */
114
-	public function scopeStatus( Builder $builder, $status ) {
115
-		return $builder->where( 'post_status', '=', $status );
114
+	public function scopeStatus(Builder $builder, $status) {
115
+		return $builder->where('post_status', '=', $status);
116 116
 	}
117 117
 
118 118
 	/**
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @return mixed
125 125
 	 */
126
-	public function scopeAuthor( Builder $builder, $author ) {
127
-		if ( $author ) {
128
-			return $builder->where( 'post_author', '=', $author );
126
+	public function scopeAuthor(Builder $builder, $author) {
127
+		if ($author) {
128
+			return $builder->where('post_author', '=', $author);
129 129
 		}
130 130
 	}
131 131
 }
Please login to merge, or discard this patch.
app/Http/Middleware/AuthMiddleware.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -29,65 +29,65 @@
 block discarded – undo
29 29
  */
30 30
 class AuthMiddleware {
31 31
 
32
-	/**
33
-	 * Handle an incoming request.
34
-	 *
35
-	 * @param  \Illuminate\Http\Request $request The app http request.
36
-	 * @param  \Closure                 $next The next closure.
37
-	 * @param   array                    ...$guards The requested guards.
38
-	 *
39
-	 * @throws \Exception Throw the exception.
40
-	 *
41
-	 * @return mixed
42
-	 */
43
-	public function handle( Request $request, Closure $next, ...$guards ) {
44
-		foreach ( $guards as $guard ) {
45
-			if ( $guard == 'api' ) {
46
-				if ( ! Schema::hasTable( 'oauth_access_tokens' ) ||
47
-					! Schema::hasTable( 'oauth_refresh_tokens' ) ||
48
-					! Schema::hasTable( 'oauth_personal_access_clients' ) ||
49
-					! Schema::hasTable( 'oauth_clients' ) ||
50
-					! Schema::hasTable( 'oauth_auth_codes' )
51
-				) {
52
-					throw new \Exception( 'Please install OAuth2 Server Plugin (plugin link) or Implement OAuth2 Server from this link (https://github.com/Codexshaper/oauth2)', 1 );
53
-				}
32
+    /**
33
+     * Handle an incoming request.
34
+     *
35
+     * @param  \Illuminate\Http\Request $request The app http request.
36
+     * @param  \Closure                 $next The next closure.
37
+     * @param   array                    ...$guards The requested guards.
38
+     *
39
+     * @throws \Exception Throw the exception.
40
+     *
41
+     * @return mixed
42
+     */
43
+    public function handle( Request $request, Closure $next, ...$guards ) {
44
+        foreach ( $guards as $guard ) {
45
+            if ( $guard == 'api' ) {
46
+                if ( ! Schema::hasTable( 'oauth_access_tokens' ) ||
47
+                    ! Schema::hasTable( 'oauth_refresh_tokens' ) ||
48
+                    ! Schema::hasTable( 'oauth_personal_access_clients' ) ||
49
+                    ! Schema::hasTable( 'oauth_clients' ) ||
50
+                    ! Schema::hasTable( 'oauth_auth_codes' )
51
+                ) {
52
+                    throw new \Exception( 'Please install OAuth2 Server Plugin (plugin link) or Implement OAuth2 Server from this link (https://github.com/Codexshaper/oauth2)', 1 );
53
+                }
54 54
 
55
-				$manager         = new Manager();
56
-				$resource_server = $manager->getResourceServer();
57
-				$psr_request     = ServerRequest::getPsrServerRequest();
55
+                $manager         = new Manager();
56
+                $resource_server = $manager->getResourceServer();
57
+                $psr_request     = ServerRequest::getPsrServerRequest();
58 58
 
59
-				try {
60
-					$psr     = $resource_server->validateAuthenticatedRequest( $psr_request );
61
-					$user_id = $manager->validateUserForRequest( $psr );
59
+                try {
60
+                    $psr     = $resource_server->validateAuthenticatedRequest( $psr_request );
61
+                    $user_id = $manager->validateUserForRequest( $psr );
62 62
 
63
-					if ( $user_id ) {
64
-						$user = User::find( $user_id );
63
+                    if ( $user_id ) {
64
+                        $user = User::find( $user_id );
65 65
 
66
-						$request->merge( array( 'user' => $user ) );
67
-						$request->merge( array( 'scopes' => $psr->getAttribute( 'oauth_scopes' ) ) );
66
+                        $request->merge( array( 'user' => $user ) );
67
+                        $request->merge( array( 'scopes' => $psr->getAttribute( 'oauth_scopes' ) ) );
68 68
 
69
-						$request->setUserResolver(
70
-							function () use ( $user ) {
71
-								return $user;
72
-							}
73
-						);
69
+                        $request->setUserResolver(
70
+                            function () use ( $user ) {
71
+                                return $user;
72
+                            }
73
+                        );
74 74
 
75
-						return $next( $request );
76
-					}
77
-				} catch ( OAuthServerException $e ) {
78
-					throw new \Exception( $e->getMessage() );
75
+                        return $next( $request );
76
+                    }
77
+                } catch ( OAuthServerException $e ) {
78
+                    throw new \Exception( $e->getMessage() );
79 79
 
80
-				}
80
+                }
81 81
 
82
-				return $next( $request );
83
-			}
84
-		}
82
+                return $next( $request );
83
+            }
84
+        }
85 85
 
86
-		if ( \is_user_logged_in() ) {
87
-			return $next( $request );
88
-		}
86
+        if ( \is_user_logged_in() ) {
87
+            return $next( $request );
88
+        }
89 89
 
90
-		header( 'Location: ' . \get_site_url() . '/wp-admin' );
91
-		die();
92
-	}
90
+        header( 'Location: ' . \get_site_url() . '/wp-admin' );
91
+        die();
92
+    }
93 93
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @return mixed
42 42
 	 */
43
-	public function handle( Request $request, Closure $next, ...$guards ) {
44
-		foreach ( $guards as $guard ) {
45
-			if ( $guard == 'api' ) {
46
-				if ( ! Schema::hasTable( 'oauth_access_tokens' ) ||
47
-					! Schema::hasTable( 'oauth_refresh_tokens' ) ||
48
-					! Schema::hasTable( 'oauth_personal_access_clients' ) ||
49
-					! Schema::hasTable( 'oauth_clients' ) ||
50
-					! Schema::hasTable( 'oauth_auth_codes' )
43
+	public function handle(Request $request, Closure $next, ...$guards) {
44
+		foreach ($guards as $guard) {
45
+			if ($guard == 'api') {
46
+				if (!Schema::hasTable('oauth_access_tokens') ||
47
+					!Schema::hasTable('oauth_refresh_tokens') ||
48
+					!Schema::hasTable('oauth_personal_access_clients') ||
49
+					!Schema::hasTable('oauth_clients') ||
50
+					!Schema::hasTable('oauth_auth_codes')
51 51
 				) {
52
-					throw new \Exception( 'Please install OAuth2 Server Plugin (plugin link) or Implement OAuth2 Server from this link (https://github.com/Codexshaper/oauth2)', 1 );
52
+					throw new \Exception('Please install OAuth2 Server Plugin (plugin link) or Implement OAuth2 Server from this link (https://github.com/Codexshaper/oauth2)', 1);
53 53
 				}
54 54
 
55 55
 				$manager         = new Manager();
@@ -57,37 +57,37 @@  discard block
 block discarded – undo
57 57
 				$psr_request     = ServerRequest::getPsrServerRequest();
58 58
 
59 59
 				try {
60
-					$psr     = $resource_server->validateAuthenticatedRequest( $psr_request );
61
-					$user_id = $manager->validateUserForRequest( $psr );
60
+					$psr     = $resource_server->validateAuthenticatedRequest($psr_request);
61
+					$user_id = $manager->validateUserForRequest($psr);
62 62
 
63
-					if ( $user_id ) {
64
-						$user = User::find( $user_id );
63
+					if ($user_id) {
64
+						$user = User::find($user_id);
65 65
 
66
-						$request->merge( array( 'user' => $user ) );
67
-						$request->merge( array( 'scopes' => $psr->getAttribute( 'oauth_scopes' ) ) );
66
+						$request->merge(array('user' => $user));
67
+						$request->merge(array('scopes' => $psr->getAttribute('oauth_scopes')));
68 68
 
69 69
 						$request->setUserResolver(
70
-							function () use ( $user ) {
70
+							function() use ($user) {
71 71
 								return $user;
72 72
 							}
73 73
 						);
74 74
 
75
-						return $next( $request );
75
+						return $next($request);
76 76
 					}
77
-				} catch ( OAuthServerException $e ) {
78
-					throw new \Exception( $e->getMessage() );
77
+				} catch (OAuthServerException $e) {
78
+					throw new \Exception($e->getMessage());
79 79
 
80 80
 				}
81 81
 
82
-				return $next( $request );
82
+				return $next($request);
83 83
 			}
84 84
 		}
85 85
 
86
-		if ( \is_user_logged_in() ) {
87
-			return $next( $request );
86
+		if (\is_user_logged_in()) {
87
+			return $next($request);
88 88
 		}
89 89
 
90
-		header( 'Location: ' . \get_site_url() . '/wp-admin' );
90
+		header('Location: '.\get_site_url().'/wp-admin');
91 91
 		die();
92 92
 	}
93 93
 }
Please login to merge, or discard this patch.
app/Http/Middleware/VerifyCsrfToken.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -24,29 +24,29 @@
 block discarded – undo
24 24
  */
25 25
 class VerifyCsrfToken {
26 26
 
27
-	/**
28
-	 * Handle an incoming request.
29
-	 *
30
-	 * @param  \Illuminate\Http\Request $request The app http request.
31
-	 * @param  \Closure                 $next The next closure.
32
-	 *
33
-	 * @throws \Exception Throw the exception.
34
-	 *
35
-	 * @return mixed
36
-	 */
37
-	public function handle( Request $request, Closure $next ) {
38
-		$token  = $request->input( '_token' ) ?? $request->header( 'X-CSRF-TOKEN' );
39
-		$action = $request->wpb_nonce ?? 'wpb_nonce';
40
-
41
-		if ( ! wp_verify_nonce( $token, $action ) ) {
42
-			if ( $request->ajax() ) {
43
-				return wp_send_json( array( 'message' => 'CSRF Token mitchmatch' ), 403 );
44
-			}
45
-
46
-			throw new \Exception( 'CSRF Token mismatch' );
47
-
48
-		}
49
-
50
-		return $next( $request );
51
-	}
27
+    /**
28
+     * Handle an incoming request.
29
+     *
30
+     * @param  \Illuminate\Http\Request $request The app http request.
31
+     * @param  \Closure                 $next The next closure.
32
+     *
33
+     * @throws \Exception Throw the exception.
34
+     *
35
+     * @return mixed
36
+     */
37
+    public function handle( Request $request, Closure $next ) {
38
+        $token  = $request->input( '_token' ) ?? $request->header( 'X-CSRF-TOKEN' );
39
+        $action = $request->wpb_nonce ?? 'wpb_nonce';
40
+
41
+        if ( ! wp_verify_nonce( $token, $action ) ) {
42
+            if ( $request->ajax() ) {
43
+                return wp_send_json( array( 'message' => 'CSRF Token mitchmatch' ), 403 );
44
+            }
45
+
46
+            throw new \Exception( 'CSRF Token mismatch' );
47
+
48
+        }
49
+
50
+        return $next( $request );
51
+    }
52 52
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@
 block discarded – undo
34 34
 	 *
35 35
 	 * @return mixed
36 36
 	 */
37
-	public function handle( Request $request, Closure $next ) {
38
-		$token  = $request->input( '_token' ) ?? $request->header( 'X-CSRF-TOKEN' );
37
+	public function handle(Request $request, Closure $next) {
38
+		$token  = $request->input('_token') ?? $request->header('X-CSRF-TOKEN');
39 39
 		$action = $request->wpb_nonce ?? 'wpb_nonce';
40 40
 
41
-		if ( ! wp_verify_nonce( $token, $action ) ) {
42
-			if ( $request->ajax() ) {
43
-				return wp_send_json( array( 'message' => 'CSRF Token mitchmatch' ), 403 );
41
+		if (!wp_verify_nonce($token, $action)) {
42
+			if ($request->ajax()) {
43
+				return wp_send_json(array('message' => 'CSRF Token mitchmatch'), 403);
44 44
 			}
45 45
 
46
-			throw new \Exception( 'CSRF Token mismatch' );
46
+			throw new \Exception('CSRF Token mismatch');
47 47
 
48 48
 		}
49 49
 
50
-		return $next( $request );
50
+		return $next($request);
51 51
 	}
52 52
 }
Please login to merge, or discard this patch.
app/Http/Middleware/Scope.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@
 block discarded – undo
29 29
  */
30 30
 class Scope {
31 31
 
32
-	/**
33
-	 * Handle an incoming request.
34
-	 *
35
-	 * @param  \Illuminate\Http\Request $request The app http request.
36
-	 * @param  \Closure                 $next The next closure.
37
-	 * @param   array                    ...$scopes The requested guards.
38
-	 *
39
-	 * @throws \Exception Throw the exception.
40
-	 *
41
-	 * @return mixed
42
-	 */
43
-	public function handle( Request $request, Closure $next, ...$scopes ) {
44
-		foreach ( $scopes as $scope ) {
45
-			if ( ! in_array( $scope, $request->scopes ) ) {
46
-				wp_send_json( array( 'msg' => "You don't have enough permission" ), 400 );
47
-			}
48
-		}
32
+    /**
33
+     * Handle an incoming request.
34
+     *
35
+     * @param  \Illuminate\Http\Request $request The app http request.
36
+     * @param  \Closure                 $next The next closure.
37
+     * @param   array                    ...$scopes The requested guards.
38
+     *
39
+     * @throws \Exception Throw the exception.
40
+     *
41
+     * @return mixed
42
+     */
43
+    public function handle( Request $request, Closure $next, ...$scopes ) {
44
+        foreach ( $scopes as $scope ) {
45
+            if ( ! in_array( $scope, $request->scopes ) ) {
46
+                wp_send_json( array( 'msg' => "You don't have enough permission" ), 400 );
47
+            }
48
+        }
49 49
 
50
-		return $next( $request );
51
-	}
50
+        return $next( $request );
51
+    }
52 52
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@
 block discarded – undo
40 40
 	 *
41 41
 	 * @return mixed
42 42
 	 */
43
-	public function handle( Request $request, Closure $next, ...$scopes ) {
44
-		foreach ( $scopes as $scope ) {
45
-			if ( ! in_array( $scope, $request->scopes ) ) {
46
-				wp_send_json( array( 'msg' => "You don't have enough permission" ), 400 );
43
+	public function handle(Request $request, Closure $next, ...$scopes) {
44
+		foreach ($scopes as $scope) {
45
+			if (!in_array($scope, $request->scopes)) {
46
+				wp_send_json(array('msg' => "You don't have enough permission"), 400);
47 47
 			}
48 48
 		}
49 49
 
50
-		return $next( $request );
50
+		return $next($request);
51 51
 	}
52 52
 }
Please login to merge, or discard this patch.
app/Http/Kernel.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,39 +23,39 @@
 block discarded – undo
23 23
  */
24 24
 class Kernel extends HttpKernel {
25 25
 
26
-	/**
27
-	 * The application's global HTTP middleware stack.
28
-	 *
29
-	 * These middleware are run during every request to your application.
30
-	 *
31
-	 * @var array
32
-	 */
33
-	protected $middleware = array();
26
+    /**
27
+     * The application's global HTTP middleware stack.
28
+     *
29
+     * These middleware are run during every request to your application.
30
+     *
31
+     * @var array
32
+     */
33
+    protected $middleware = array();
34 34
 
35
-	/**
36
-	 * The application's route middleware groups.
37
-	 *
38
-	 * @var array
39
-	 */
40
-	protected $middleware_groups = array(
41
-		'web' => array(
42
-			\WPB\App\Http\Middleware\VerifyCsrfToken::class,
43
-		),
35
+    /**
36
+     * The application's route middleware groups.
37
+     *
38
+     * @var array
39
+     */
40
+    protected $middleware_groups = array(
41
+        'web' => array(
42
+            \WPB\App\Http\Middleware\VerifyCsrfToken::class,
43
+        ),
44 44
 
45
-		'api' => array(
46
-			'throttle:60,1',
47
-		),
48
-	);
45
+        'api' => array(
46
+            'throttle:60,1',
47
+        ),
48
+    );
49 49
 
50
-	/**
51
-	 * The application's route middleware.
52
-	 *
53
-	 * These middleware may be assigned to groups or used individually.
54
-	 *
55
-	 * @var array
56
-	 */
57
-	protected $route_middleware = array(
58
-		'auth'  => \WPB\App\Http\Middleware\AuthMiddleware::class,
59
-		'scope' => \WPB\App\Http\Middleware\Scope::class,
60
-	);
50
+    /**
51
+     * The application's route middleware.
52
+     *
53
+     * These middleware may be assigned to groups or used individually.
54
+     *
55
+     * @var array
56
+     */
57
+    protected $route_middleware = array(
58
+        'auth'  => \WPB\App\Http\Middleware\AuthMiddleware::class,
59
+        'scope' => \WPB\App\Http\Middleware\Scope::class,
60
+    );
61 61
 }
Please login to merge, or discard this patch.
app/User.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,41 +23,41 @@
 block discarded – undo
23 23
  */
24 24
 class User extends Model {
25 25
 
26
-	protected $primaryKey = 'ID';
26
+    protected $primaryKey = 'ID';
27 27
 
28
-	/**
29
-	 * The fillable fields for mass assignment.
30
-	 *
31
-	 * @since    1.0.0
32
-	 * @access   protected
33
-	 * @var      array    $fillable    The fillable fields.
34
-	 */
35
-	protected $fillable = array(
36
-		'name',
37
-		'email',
38
-		'password',
39
-	);
28
+    /**
29
+     * The fillable fields for mass assignment.
30
+     *
31
+     * @since    1.0.0
32
+     * @access   protected
33
+     * @var      array    $fillable    The fillable fields.
34
+     */
35
+    protected $fillable = array(
36
+        'name',
37
+        'email',
38
+        'password',
39
+    );
40 40
 
41
-	/**
42
-	 * The hidden fields.
43
-	 *
44
-	 * @since    1.0.0
45
-	 * @access   protected
46
-	 * @var      array    $hidden    The hidden fields.
47
-	 */
48
-	protected $hidden = array(
49
-		'password',
50
-		'remember_token',
51
-	);
41
+    /**
42
+     * The hidden fields.
43
+     *
44
+     * @since    1.0.0
45
+     * @access   protected
46
+     * @var      array    $hidden    The hidden fields.
47
+     */
48
+    protected $hidden = array(
49
+        'password',
50
+        'remember_token',
51
+    );
52 52
 
53
-	/**
54
-	 * The field cast.
55
-	 *
56
-	 * @since    1.0.0
57
-	 * @access   protected
58
-	 * @var      array    $casts    The field cast.
59
-	 */
60
-	protected $casts = array(
61
-		'email_verified_at' => 'datetime',
62
-	);
53
+    /**
54
+     * The field cast.
55
+     *
56
+     * @since    1.0.0
57
+     * @access   protected
58
+     * @var      array    $casts    The field cast.
59
+     */
60
+    protected $casts = array(
61
+        'email_verified_at' => 'datetime',
62
+    );
63 63
 }
Please login to merge, or discard this patch.
app/Commands/InstallComposer.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -9,43 +9,43 @@
 block discarded – undo
9 9
  * @subpackage WPB/app/Commands
10 10
  */
11 11
 
12
- /**
13
-  * Register all actions and filters for the plugin.
14
-  *
15
-  * Maintain a list of all hooks that are registered throughout
16
-  * the plugin, and register them with the WordPress API. Call the
17
-  * run function to execute the list of actions and filters.
18
-  *
19
-  * @package    WPB
20
-  * @subpackage WPB/app/Commands
21
-  * @author     Md Abu Ahsan basir <[email protected]>
22
-  */
12
+    /**
13
+     * Register all actions and filters for the plugin.
14
+     *
15
+     * Maintain a list of all hooks that are registered throughout
16
+     * the plugin, and register them with the WordPress API. Call the
17
+     * run function to execute the list of actions and filters.
18
+     *
19
+     * @package    WPB
20
+     * @subpackage WPB/app/Commands
21
+     * @author     Md Abu Ahsan basir <[email protected]>
22
+     */
23 23
 class InstallComposer {
24 24
 
25
-	/**
26
-	 * Install composer factory.
27
-	 *
28
-	 * @since    1.0.0
29
-	 */
30
-	public function __construct() {
31
-		if ( ! file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
25
+    /**
26
+     * Install composer factory.
27
+     *
28
+     * @since    1.0.0
29
+     */
30
+    public function __construct() {
31
+        if ( ! file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
32 32
 
33
-			require_once __DIR__ . '/../vendor/autoload.php';
33
+            require_once __DIR__ . '/../vendor/autoload.php';
34 34
 
35
-			$composer = 'composer';
35
+            $composer = 'composer';
36 36
 
37
-			try {
38
-				$process = \Symfony\Component\Process\Process::fromShellCommandline( $composer . ' install' );
39
-				$process->setEnv(
40
-					array(
41
-						'COMPOSER_HOME' => __DIR__ . '/../vendor/bin/composer',
42
-					)
43
-				);
44
-				$process->setTimeout( null ); // Setting timeout to null to prevent installation from stopping at a certain point in time.
45
-				$process->setWorkingDirectory( __DIR__ )->mustRun();
46
-			} catch ( \Exception $ex ) {
47
-				echo $ex->getMessage();
48
-			}
49
-		}
50
-	}
37
+            try {
38
+                $process = \Symfony\Component\Process\Process::fromShellCommandline( $composer . ' install' );
39
+                $process->setEnv(
40
+                    array(
41
+                        'COMPOSER_HOME' => __DIR__ . '/../vendor/bin/composer',
42
+                    )
43
+                );
44
+                $process->setTimeout( null ); // Setting timeout to null to prevent installation from stopping at a certain point in time.
45
+                $process->setWorkingDirectory( __DIR__ )->mustRun();
46
+            } catch ( \Exception $ex ) {
47
+                echo $ex->getMessage();
48
+            }
49
+        }
50
+    }
51 51
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,22 +28,22 @@
 block discarded – undo
28 28
 	 * @since    1.0.0
29 29
 	 */
30 30
 	public function __construct() {
31
-		if ( ! file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
31
+		if (!file_exists(__DIR__.'/../vendor/autoload.php')) {
32 32
 
33
-			require_once __DIR__ . '/../vendor/autoload.php';
33
+			require_once __DIR__.'/../vendor/autoload.php';
34 34
 
35 35
 			$composer = 'composer';
36 36
 
37 37
 			try {
38
-				$process = \Symfony\Component\Process\Process::fromShellCommandline( $composer . ' install' );
38
+				$process = \Symfony\Component\Process\Process::fromShellCommandline($composer.' install');
39 39
 				$process->setEnv(
40 40
 					array(
41
-						'COMPOSER_HOME' => __DIR__ . '/../vendor/bin/composer',
41
+						'COMPOSER_HOME' => __DIR__.'/../vendor/bin/composer',
42 42
 					)
43 43
 				);
44
-				$process->setTimeout( null ); // Setting timeout to null to prevent installation from stopping at a certain point in time.
45
-				$process->setWorkingDirectory( __DIR__ )->mustRun();
46
-			} catch ( \Exception $ex ) {
44
+				$process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time.
45
+				$process->setWorkingDirectory(__DIR__)->mustRun();
46
+			} catch (\Exception $ex) {
47 47
 				echo $ex->getMessage();
48 48
 			}
49 49
 		}
Please login to merge, or discard this patch.
app/Exceptions/Handler.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -24,45 +24,45 @@
 block discarded – undo
24 24
  */
25 25
 class Handler extends ExceptionHandler {
26 26
 
27
-	/**
28
-	 * A list of the exception types that are not reported.
29
-	 *
30
-	 * @var array
31
-	 */
32
-	protected $dont_report = array();
27
+    /**
28
+     * A list of the exception types that are not reported.
29
+     *
30
+     * @var array
31
+     */
32
+    protected $dont_report = array();
33 33
 
34
-	/**
35
-	 * A list of the inputs that are never flashed for validation exceptions.
36
-	 *
37
-	 * @var array
38
-	 */
39
-	protected $dont_flash = array(
40
-		'password',
41
-		'password_confirmation',
42
-	);
34
+    /**
35
+     * A list of the inputs that are never flashed for validation exceptions.
36
+     *
37
+     * @var array
38
+     */
39
+    protected $dont_flash = array(
40
+        'password',
41
+        'password_confirmation',
42
+    );
43 43
 
44
-	/**
45
-	 * Report or log an exception.
46
-	 *
47
-	 * @param  \Throwable $exception The throwable exception.
48
-	 * @return void
49
-	 *
50
-	 * @throws \Exception Throw the exception.
51
-	 */
52
-	public function report( Throwable $exception ) {
53
-		parent::report( $exception );
54
-	}
44
+    /**
45
+     * Report or log an exception.
46
+     *
47
+     * @param  \Throwable $exception The throwable exception.
48
+     * @return void
49
+     *
50
+     * @throws \Exception Throw the exception.
51
+     */
52
+    public function report( Throwable $exception ) {
53
+        parent::report( $exception );
54
+    }
55 55
 
56
-	/**
57
-	 * Render an exception into an HTTP response.
58
-	 *
59
-	 * @param  \Illuminate\Http\Request $request The app http request.
60
-	 * @param  \Throwable               $exception The throwable exception.
61
-	 * @return \Symfony\Component\HttpFoundation\Response
62
-	 *
63
-	 * @throws \Throwable Throw the nexception.
64
-	 */
65
-	public function render( $request, Throwable $exception ) {
66
-		return parent::render( $request, $exception );
67
-	}
56
+    /**
57
+     * Render an exception into an HTTP response.
58
+     *
59
+     * @param  \Illuminate\Http\Request $request The app http request.
60
+     * @param  \Throwable               $exception The throwable exception.
61
+     * @return \Symfony\Component\HttpFoundation\Response
62
+     *
63
+     * @throws \Throwable Throw the nexception.
64
+     */
65
+    public function render( $request, Throwable $exception ) {
66
+        return parent::render( $request, $exception );
67
+    }
68 68
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @throws \Exception Throw the exception.
51 51
 	 */
52
-	public function report( Throwable $exception ) {
53
-		parent::report( $exception );
52
+	public function report(Throwable $exception) {
53
+		parent::report($exception);
54 54
 	}
55 55
 
56 56
 	/**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @throws \Throwable Throw the nexception.
64 64
 	 */
65
-	public function render( $request, Throwable $exception ) {
66
-		return parent::render( $request, $exception );
65
+	public function render($request, Throwable $exception) {
66
+		return parent::render($request, $exception);
67 67
 	}
68 68
 }
Please login to merge, or discard this patch.