@@ -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(); |
@@ -21,82 +21,82 @@ |
||
21 | 21 | */ |
22 | 22 | class WPB_Admin { |
23 | 23 | |
24 | - /** |
|
25 | - * The ID of this plugin. |
|
26 | - * |
|
27 | - * @since 1.0.0 |
|
28 | - * @access private |
|
29 | - * @var string $plugin_name The ID of this plugin. |
|
30 | - */ |
|
31 | - private $plugin_name; |
|
24 | + /** |
|
25 | + * The ID of this plugin. |
|
26 | + * |
|
27 | + * @since 1.0.0 |
|
28 | + * @access private |
|
29 | + * @var string $plugin_name The ID of this plugin. |
|
30 | + */ |
|
31 | + private $plugin_name; |
|
32 | 32 | |
33 | - /** |
|
34 | - * The version of this plugin. |
|
35 | - * |
|
36 | - * @since 1.0.0 |
|
37 | - * @access private |
|
38 | - * @var string $version The current version of this plugin. |
|
39 | - */ |
|
40 | - private $version; |
|
33 | + /** |
|
34 | + * The version of this plugin. |
|
35 | + * |
|
36 | + * @since 1.0.0 |
|
37 | + * @access private |
|
38 | + * @var string $version The current version of this plugin. |
|
39 | + */ |
|
40 | + private $version; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Initialize the class and set its properties. |
|
44 | - * |
|
45 | - * @since 1.0.0 |
|
46 | - * @param string $plugin_name The name of this plugin. |
|
47 | - * @param string $version The version of this plugin. |
|
48 | - */ |
|
49 | - public function __construct( $plugin_name, $version ) { |
|
42 | + /** |
|
43 | + * Initialize the class and set its properties. |
|
44 | + * |
|
45 | + * @since 1.0.0 |
|
46 | + * @param string $plugin_name The name of this plugin. |
|
47 | + * @param string $version The version of this plugin. |
|
48 | + */ |
|
49 | + public function __construct( $plugin_name, $version ) { |
|
50 | 50 | |
51 | - $this->plugin_name = $plugin_name; |
|
52 | - $this->version = $version; |
|
51 | + $this->plugin_name = $plugin_name; |
|
52 | + $this->version = $version; |
|
53 | 53 | |
54 | - } |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Register the stylesheets for the admin area. |
|
58 | - * |
|
59 | - * @since 1.0.0 |
|
60 | - */ |
|
61 | - public function enqueue_styles() { |
|
56 | + /** |
|
57 | + * Register the stylesheets for the admin area. |
|
58 | + * |
|
59 | + * @since 1.0.0 |
|
60 | + */ |
|
61 | + public function enqueue_styles() { |
|
62 | 62 | |
63 | - /** |
|
64 | - * This function is provided for demonstration purposes only. |
|
65 | - * |
|
66 | - * An instance of this class should be passed to the run() function |
|
67 | - * defined in WPB_Loader as all of the hooks are defined |
|
68 | - * in that particular class. |
|
69 | - * |
|
70 | - * The WPB_Loader will then create the relationship |
|
71 | - * between the defined hooks and the functions defined in this |
|
72 | - * class. |
|
73 | - */ |
|
63 | + /** |
|
64 | + * This function is provided for demonstration purposes only. |
|
65 | + * |
|
66 | + * An instance of this class should be passed to the run() function |
|
67 | + * defined in WPB_Loader as all of the hooks are defined |
|
68 | + * in that particular class. |
|
69 | + * |
|
70 | + * The WPB_Loader will then create the relationship |
|
71 | + * between the defined hooks and the functions defined in this |
|
72 | + * class. |
|
73 | + */ |
|
74 | 74 | |
75 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-admin.css', array(), $this->version, 'all' ); |
|
75 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-admin.css', array(), $this->version, 'all' ); |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Register the JavaScript for the admin area. |
|
81 | - * |
|
82 | - * @since 1.0.0 |
|
83 | - */ |
|
84 | - public function enqueue_scripts() { |
|
79 | + /** |
|
80 | + * Register the JavaScript for the admin area. |
|
81 | + * |
|
82 | + * @since 1.0.0 |
|
83 | + */ |
|
84 | + public function enqueue_scripts() { |
|
85 | 85 | |
86 | - /** |
|
87 | - * This function is provided for demonstration purposes only. |
|
88 | - * |
|
89 | - * An instance of this class should be passed to the run() function |
|
90 | - * defined in WPB_Loader as all of the hooks are defined |
|
91 | - * in that particular class. |
|
92 | - * |
|
93 | - * The WPB_Loader will then create the relationship |
|
94 | - * between the defined hooks and the functions defined in this |
|
95 | - * class. |
|
96 | - */ |
|
86 | + /** |
|
87 | + * This function is provided for demonstration purposes only. |
|
88 | + * |
|
89 | + * An instance of this class should be passed to the run() function |
|
90 | + * defined in WPB_Loader as all of the hooks are defined |
|
91 | + * in that particular class. |
|
92 | + * |
|
93 | + * The WPB_Loader will then create the relationship |
|
94 | + * between the defined hooks and the functions defined in this |
|
95 | + * class. |
|
96 | + */ |
|
97 | 97 | |
98 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-admin.js', array( 'jquery' ), $this->version, false ); |
|
98 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-admin.js', array( 'jquery' ), $this->version, false ); |
|
99 | 99 | |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string $plugin_name The name of this plugin. |
47 | 47 | * @param string $version The version of this plugin. |
48 | 48 | */ |
49 | - public function __construct( $plugin_name, $version ) { |
|
49 | + public function __construct($plugin_name, $version) { |
|
50 | 50 | |
51 | 51 | $this->plugin_name = $plugin_name; |
52 | 52 | $this->version = $version; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * class. |
73 | 73 | */ |
74 | 74 | |
75 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-admin.css', array(), $this->version, 'all' ); |
|
75 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wpb-admin.css', array(), $this->version, 'all'); |
|
76 | 76 | |
77 | 77 | } |
78 | 78 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * class. |
96 | 96 | */ |
97 | 97 | |
98 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-admin.js', array( 'jquery' ), $this->version, false ); |
|
98 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wpb-admin.js', array('jquery'), $this->version, false); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 |
@@ -16,9 +16,9 @@ |
||
16 | 16 | use Illuminate\Http\Request; |
17 | 17 | |
18 | 18 | $router->get( |
19 | - 'test', |
|
20 | - function( Request $request ) { |
|
21 | - echo 'API Test'; |
|
22 | - die(); |
|
23 | - } |
|
19 | + 'test', |
|
20 | + function( Request $request ) { |
|
21 | + echo 'API Test'; |
|
22 | + die(); |
|
23 | + } |
|
24 | 24 | ); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | $router->get( |
19 | 19 | 'test', |
20 | - function( Request $request ) { |
|
20 | + function(Request $request) { |
|
21 | 21 | echo 'API Test'; |
22 | 22 | die(); |
23 | 23 | } |
@@ -16,17 +16,17 @@ |
||
16 | 16 | use Illuminate\Http\Request; |
17 | 17 | |
18 | 18 | $router->get( |
19 | - 'test', |
|
20 | - function() { |
|
21 | - echo wpb_view( 'welcome' ); |
|
22 | - die(); |
|
23 | - } |
|
19 | + 'test', |
|
20 | + function() { |
|
21 | + echo wpb_view( 'welcome' ); |
|
22 | + die(); |
|
23 | + } |
|
24 | 24 | ); |
25 | 25 | |
26 | 26 | Route::get( |
27 | - 'test/facade', |
|
28 | - function( Request $request ) { |
|
29 | - echo 'This is a facade route'; |
|
30 | - die(); |
|
31 | - } |
|
27 | + 'test/facade', |
|
28 | + function( Request $request ) { |
|
29 | + echo 'This is a facade route'; |
|
30 | + die(); |
|
31 | + } |
|
32 | 32 | ); |
@@ -18,14 +18,14 @@ |
||
18 | 18 | $router->get( |
19 | 19 | 'test', |
20 | 20 | function() { |
21 | - echo wpb_view( 'welcome' ); |
|
21 | + echo wpb_view('welcome'); |
|
22 | 22 | die(); |
23 | 23 | } |
24 | 24 | ); |
25 | 25 | |
26 | 26 | Route::get( |
27 | 27 | 'test/facade', |
28 | - function( Request $request ) { |
|
28 | + function(Request $request) { |
|
29 | 29 | echo 'This is a facade route'; |
30 | 30 | die(); |
31 | 31 | } |