@@ -148,7 +148,7 @@ |
||
148 | 148 | */ |
149 | 149 | protected function dispatchToRouter() |
150 | 150 | { |
151 | - return function ($request) { |
|
151 | + return function($request) { |
|
152 | 152 | $this->app->instance('request', $request); |
153 | 153 | |
154 | 154 | return $this->router->dispatch($request); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | $router->get('test', function(Request $request){ |
11 | - echo "API Test"; |
|
12 | - die(); |
|
11 | + echo "API Test"; |
|
12 | + die(); |
|
13 | 13 | }); |
14 | 14 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * You can use either $router object or Route facate to create new route |
8 | 8 | */ |
9 | 9 | |
10 | -$router->get('test', function(Request $request){ |
|
10 | +$router->get('test', function(Request $request) { |
|
11 | 11 | echo "API Test"; |
12 | 12 | die(); |
13 | 13 | }); |
14 | 14 | \ No newline at end of file |
@@ -7,13 +7,13 @@ |
||
7 | 7 | * You can use either $router object or Route facate to create new route |
8 | 8 | */ |
9 | 9 | |
10 | -$router->get('test', function(){ |
|
10 | +$router->get('test', function() { |
|
11 | 11 | echo wpb_view('welcome'); |
12 | 12 | die(); |
13 | 13 | }); |
14 | 14 | |
15 | 15 | |
16 | -Route::get('route/facade', function(Request $request){ |
|
16 | +Route::get('route/facade', function(Request $request) { |
|
17 | 17 | echo "This is a facade route"; |
18 | 18 | die(); |
19 | 19 | }); |
20 | 20 | \ No newline at end of file |
@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | public function scopeType(Builder $builder, $type) |
73 | 73 | { |
74 | - self::$type_scope = $type; |
|
74 | + self::$type_scope = $type; |
|
75 | 75 | return $builder->where('post_type', '=', $type); |
76 | 76 | } |
77 | 77 |
@@ -45,7 +45,7 @@ |
||
45 | 45 | // static::addGlobalScope(new PostTypeScope); |
46 | 46 | // static::addGlobalScope(new PostStatusScope); |
47 | 47 | // static::addGlobalScope(new PostAuthorScope); |
48 | - static::addGlobalScope('type', function (Builder $builder) { |
|
48 | + static::addGlobalScope('type', function(Builder $builder) { |
|
49 | 49 | $builder->where('post_type', '=', static::$type_scope); |
50 | 50 | }); |
51 | 51 | // static::addGlobalScope('scope', function (Builder $builder) { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | !Schema::hasTable('oauth_clients') || |
32 | 32 | !Schema::hasTable('oauth_auth_codes') |
33 | 33 | ) { |
34 | - throw new \Exception("Please install OAuth2 Server Plugin (plugin link) or Implement OAuth2 Server from this link (https://github.com/Codexshaper/oauth2)", 1); |
|
34 | + throw new \Exception("Please install OAuth2 Server Plugin (plugin link) or Implement OAuth2 Server from this link (https://github.com/Codexshaper/oauth2)", 1); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $manager = new Manager; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function handle(Request $request, Closure $next, ...$guards) |
24 | 24 | { |
25 | - foreach($guards as $guard) { |
|
26 | - if($guard == 'api') { |
|
27 | - if( |
|
25 | + foreach ($guards as $guard) { |
|
26 | + if ($guard == 'api') { |
|
27 | + if ( |
|
28 | 28 | !Schema::hasTable('oauth_access_tokens') || |
29 | 29 | !Schema::hasTable('oauth_refresh_tokens') || |
30 | 30 | !Schema::hasTable('oauth_personal_access_clients') || |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $manager = new Manager; |
38 | 38 | $resourceServer = $manager->getResourceServer(); |
39 | - $psrRequest = ServerRequest::getPsrServerRequest(); |
|
39 | + $psrRequest = ServerRequest::getPsrServerRequest(); |
|
40 | 40 | |
41 | 41 | try { |
42 | 42 | $psr = $resourceServer->validateAuthenticatedRequest($psrRequest); |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | if ($user_id) { |
46 | 46 | $user = User::find($user_id); |
47 | 47 | |
48 | - $request->merge(['user' => $user ]); |
|
49 | - $request->merge(['scopes' => $psr->getAttribute('oauth_scopes') ]); |
|
48 | + $request->merge(['user' => $user]); |
|
49 | + $request->merge(['scopes' => $psr->getAttribute('oauth_scopes')]); |
|
50 | 50 | |
51 | - $request->setUserResolver(function () use ($user) { |
|
51 | + $request->setUserResolver(function() use ($user) { |
|
52 | 52 | return $user; |
53 | 53 | }); |
54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - if(\is_user_logged_in()) { |
|
67 | + if (\is_user_logged_in()) { |
|
68 | 68 | return $next($request); |
69 | 69 | } |
70 | 70 |
@@ -19,9 +19,9 @@ |
||
19 | 19 | $token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN'); |
20 | 20 | $action = $request->wpb_nonce ?: 'wpb_nonce'; |
21 | 21 | |
22 | - if ( !wp_verify_nonce( $token, $action ) ) { |
|
22 | + if (!wp_verify_nonce($token, $action)) { |
|
23 | 23 | if ($request->ajax()) { |
24 | - return wp_send_json(["message" => "CSRF Token mitchmatch"], 403 ); |
|
24 | + return wp_send_json(["message" => "CSRF Token mitchmatch"], 403); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | throw new \Exception("CSRF Token mismatch"); |
@@ -23,8 +23,8 @@ |
||
23 | 23 | public function handle(Request $request, Closure $next, ...$scopes) |
24 | 24 | { |
25 | 25 | foreach ($scopes as $scope) { |
26 | - if (! in_array($scope, $request->scopes)) { |
|
27 | - wp_send_json( ["msg" => "You don't have enough permission"], 400 ); |
|
26 | + if (!in_array($scope, $request->scopes)) { |
|
27 | + wp_send_json(["msg" => "You don't have enough permission"], 400); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 |
@@ -6,32 +6,32 @@ |
||
6 | 6 | |
7 | 7 | class User extends Model |
8 | 8 | { |
9 | - protected $primaryKey = 'ID'; |
|
9 | + protected $primaryKey = 'ID'; |
|
10 | 10 | |
11 | - /** |
|
12 | - * The attributes that are mass assignable. |
|
13 | - * |
|
14 | - * @var array |
|
15 | - */ |
|
16 | - protected $fillable = [ |
|
17 | - 'name', 'email', 'password', |
|
18 | - ]; |
|
11 | + /** |
|
12 | + * The attributes that are mass assignable. |
|
13 | + * |
|
14 | + * @var array |
|
15 | + */ |
|
16 | + protected $fillable = [ |
|
17 | + 'name', 'email', 'password', |
|
18 | + ]; |
|
19 | 19 | |
20 | - /** |
|
21 | - * The attributes that should be hidden for arrays. |
|
22 | - * |
|
23 | - * @var array |
|
24 | - */ |
|
25 | - protected $hidden = [ |
|
26 | - 'password', 'remember_token', |
|
27 | - ]; |
|
20 | + /** |
|
21 | + * The attributes that should be hidden for arrays. |
|
22 | + * |
|
23 | + * @var array |
|
24 | + */ |
|
25 | + protected $hidden = [ |
|
26 | + 'password', 'remember_token', |
|
27 | + ]; |
|
28 | 28 | |
29 | - /** |
|
30 | - * The attributes that should be cast to native types. |
|
31 | - * |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - protected $casts = [ |
|
35 | - 'email_verified_at' => 'datetime', |
|
36 | - ]; |
|
29 | + /** |
|
30 | + * The attributes that should be cast to native types. |
|
31 | + * |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + protected $casts = [ |
|
35 | + 'email_verified_at' => 'datetime', |
|
36 | + ]; |
|
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -2,37 +2,37 @@ |
||
2 | 2 | |
3 | 3 | class Install_Composer |
4 | 4 | { |
5 | - public function __construct() |
|
6 | - { |
|
7 | - if (! file_exists(__DIR__.'/vendor/autoload.php')) { |
|
5 | + public function __construct() |
|
6 | + { |
|
7 | + if (! file_exists(__DIR__.'/vendor/autoload.php')) { |
|
8 | 8 | |
9 | - require_once __DIR__.'/install/vendor/autoload.php'; |
|
9 | + require_once __DIR__.'/install/vendor/autoload.php'; |
|
10 | 10 | |
11 | - if(file_exists(__DIR__ . '/install/vendor/bin/composer')) { |
|
12 | - echo "composer file exists"; |
|
13 | - } |
|
11 | + if(file_exists(__DIR__ . '/install/vendor/bin/composer')) { |
|
12 | + echo "composer file exists"; |
|
13 | + } |
|
14 | 14 | |
15 | - // Composer\Factory::getHomeDir() method |
|
16 | - // needs COMPOSER_HOME environment variable set |
|
17 | - putenv('COMPOSER_HOME=' . __DIR__ . '/install/vendor/bin/composer'); |
|
15 | + // Composer\Factory::getHomeDir() method |
|
16 | + // needs COMPOSER_HOME environment variable set |
|
17 | + putenv('COMPOSER_HOME=' . __DIR__ . '/install/vendor/bin/composer'); |
|
18 | 18 | |
19 | - // call `composer install` command programmatically |
|
20 | - // if (file_exists(getcwd().'/composer.phar')) { |
|
21 | - // $composer = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
22 | - // } |
|
19 | + // call `composer install` command programmatically |
|
20 | + // if (file_exists(getcwd().'/composer.phar')) { |
|
21 | + // $composer = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
|
22 | + // } |
|
23 | 23 | |
24 | - $composer = 'composer'; |
|
24 | + $composer = 'composer'; |
|
25 | 25 | |
26 | - try { |
|
27 | - $process = \Symfony\Component\Process\Process::fromShellCommandline($composer.' install'); |
|
28 | - $process->setEnv([ |
|
29 | - 'COMPOSER_HOME' => __DIR__ . '/install/vendor/bin/composer', |
|
30 | - ]); |
|
31 | - $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
|
32 | - $process->setWorkingDirectory(__DIR__)->mustRun(); |
|
33 | - } catch (\Exception $ex) { |
|
34 | - echo $ex->getMessage(); |
|
35 | - } |
|
36 | - } |
|
37 | - } |
|
26 | + try { |
|
27 | + $process = \Symfony\Component\Process\Process::fromShellCommandline($composer.' install'); |
|
28 | + $process->setEnv([ |
|
29 | + 'COMPOSER_HOME' => __DIR__ . '/install/vendor/bin/composer', |
|
30 | + ]); |
|
31 | + $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
|
32 | + $process->setWorkingDirectory(__DIR__)->mustRun(); |
|
33 | + } catch (\Exception $ex) { |
|
34 | + echo $ex->getMessage(); |
|
35 | + } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -4,17 +4,17 @@ discard block |
||
4 | 4 | { |
5 | 5 | public function __construct() |
6 | 6 | { |
7 | - if (! file_exists(__DIR__.'/vendor/autoload.php')) { |
|
7 | + if (!file_exists(__DIR__.'/vendor/autoload.php')) { |
|
8 | 8 | |
9 | 9 | require_once __DIR__.'/install/vendor/autoload.php'; |
10 | 10 | |
11 | - if(file_exists(__DIR__ . '/install/vendor/bin/composer')) { |
|
11 | + if (file_exists(__DIR__.'/install/vendor/bin/composer')) { |
|
12 | 12 | echo "composer file exists"; |
13 | 13 | } |
14 | 14 | |
15 | 15 | // Composer\Factory::getHomeDir() method |
16 | 16 | // needs COMPOSER_HOME environment variable set |
17 | - putenv('COMPOSER_HOME=' . __DIR__ . '/install/vendor/bin/composer'); |
|
17 | + putenv('COMPOSER_HOME='.__DIR__.'/install/vendor/bin/composer'); |
|
18 | 18 | |
19 | 19 | // call `composer install` command programmatically |
20 | 20 | // if (file_exists(getcwd().'/composer.phar')) { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | try { |
27 | 27 | $process = \Symfony\Component\Process\Process::fromShellCommandline($composer.' install'); |
28 | 28 | $process->setEnv([ |
29 | - 'COMPOSER_HOME' => __DIR__ . '/install/vendor/bin/composer', |
|
29 | + 'COMPOSER_HOME' => __DIR__.'/install/vendor/bin/composer', |
|
30 | 30 | ]); |
31 | 31 | $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
32 | 32 | $process->setWorkingDirectory(__DIR__)->mustRun(); |