@@ -10,8 +10,8 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | return array( |
13 | - 'paths' => array( |
|
14 | - 'migrations' => __DIR__ . '/../database/migrations', |
|
15 | - 'seeds' => __DIR__ . '/../database/seeds', |
|
16 | - ), |
|
13 | + 'paths' => array( |
|
14 | + 'migrations' => __DIR__ . '/../database/migrations', |
|
15 | + 'seeds' => __DIR__ . '/../database/seeds', |
|
16 | + ), |
|
17 | 17 | ); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | return array( |
13 | 13 | 'paths' => array( |
14 | - 'migrations' => __DIR__ . '/../database/migrations', |
|
15 | - 'seeds' => __DIR__ . '/../database/seeds', |
|
14 | + 'migrations' => __DIR__.'/../database/migrations', |
|
15 | + 'seeds' => __DIR__.'/../database/seeds', |
|
16 | 16 | ), |
17 | 17 | ); |
@@ -22,107 +22,107 @@ |
||
22 | 22 | */ |
23 | 23 | class WPB_Loader { |
24 | 24 | |
25 | - /** |
|
26 | - * The array of actions registered with WordPress. |
|
27 | - * |
|
28 | - * @since 1.0.0 |
|
29 | - * @access protected |
|
30 | - * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
31 | - */ |
|
32 | - protected $actions; |
|
33 | - |
|
34 | - /** |
|
35 | - * The array of filters registered with WordPress. |
|
36 | - * |
|
37 | - * @since 1.0.0 |
|
38 | - * @access protected |
|
39 | - * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
40 | - */ |
|
41 | - protected $filters; |
|
42 | - |
|
43 | - /** |
|
44 | - * Initialize the collections used to maintain the actions and filters. |
|
45 | - * |
|
46 | - * @since 1.0.0 |
|
47 | - */ |
|
48 | - public function __construct() { |
|
49 | - |
|
50 | - $this->actions = array(); |
|
51 | - $this->filters = array(); |
|
52 | - |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Add a new action to the collection to be registered with WordPress. |
|
57 | - * |
|
58 | - * @since 1.0.0 |
|
59 | - * @param string $hook The name of the WordPress action that is being registered. |
|
60 | - * @param object $component A reference to the instance of the object on which the action is defined. |
|
61 | - * @param string $callback The name of the function definition on the $component. |
|
62 | - * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
63 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
64 | - */ |
|
65 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
66 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Add a new filter to the collection to be registered with WordPress. |
|
71 | - * |
|
72 | - * @since 1.0.0 |
|
73 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
74 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
75 | - * @param string $callback The name of the function definition on the $component. |
|
76 | - * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
77 | - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
78 | - */ |
|
79 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
80 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * A utility function that is used to register the actions and hooks into a single |
|
85 | - * collection. |
|
86 | - * |
|
87 | - * @since 1.0.0 |
|
88 | - * @access private |
|
89 | - * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
90 | - * @param string $hook The name of the WordPress filter that is being registered. |
|
91 | - * @param object $component A reference to the instance of the object on which the filter is defined. |
|
92 | - * @param string $callback The name of the function definition on the $component. |
|
93 | - * @param int $priority The priority at which the function should be fired. |
|
94 | - * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
95 | - * @return array The collection of actions and filters registered with WordPress. |
|
96 | - */ |
|
97 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
98 | - |
|
99 | - $hooks[] = array( |
|
100 | - 'hook' => $hook, |
|
101 | - 'component' => $component, |
|
102 | - 'callback' => $callback, |
|
103 | - 'priority' => $priority, |
|
104 | - 'accepted_args' => $accepted_args, |
|
105 | - ); |
|
106 | - |
|
107 | - return $hooks; |
|
108 | - |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Register the filters and actions with WordPress. |
|
113 | - * |
|
114 | - * @since 1.0.0 |
|
115 | - */ |
|
116 | - public function run() { |
|
117 | - |
|
118 | - foreach ( $this->filters as $hook ) { |
|
119 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
120 | - } |
|
121 | - |
|
122 | - foreach ( $this->actions as $hook ) { |
|
123 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
124 | - } |
|
125 | - |
|
126 | - } |
|
25 | + /** |
|
26 | + * The array of actions registered with WordPress. |
|
27 | + * |
|
28 | + * @since 1.0.0 |
|
29 | + * @access protected |
|
30 | + * @var array $actions The actions registered with WordPress to fire when the plugin loads. |
|
31 | + */ |
|
32 | + protected $actions; |
|
33 | + |
|
34 | + /** |
|
35 | + * The array of filters registered with WordPress. |
|
36 | + * |
|
37 | + * @since 1.0.0 |
|
38 | + * @access protected |
|
39 | + * @var array $filters The filters registered with WordPress to fire when the plugin loads. |
|
40 | + */ |
|
41 | + protected $filters; |
|
42 | + |
|
43 | + /** |
|
44 | + * Initialize the collections used to maintain the actions and filters. |
|
45 | + * |
|
46 | + * @since 1.0.0 |
|
47 | + */ |
|
48 | + public function __construct() { |
|
49 | + |
|
50 | + $this->actions = array(); |
|
51 | + $this->filters = array(); |
|
52 | + |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Add a new action to the collection to be registered with WordPress. |
|
57 | + * |
|
58 | + * @since 1.0.0 |
|
59 | + * @param string $hook The name of the WordPress action that is being registered. |
|
60 | + * @param object $component A reference to the instance of the object on which the action is defined. |
|
61 | + * @param string $callback The name of the function definition on the $component. |
|
62 | + * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
63 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
64 | + */ |
|
65 | + public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
66 | + $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Add a new filter to the collection to be registered with WordPress. |
|
71 | + * |
|
72 | + * @since 1.0.0 |
|
73 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
74 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
75 | + * @param string $callback The name of the function definition on the $component. |
|
76 | + * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
|
77 | + * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
|
78 | + */ |
|
79 | + public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
80 | + $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * A utility function that is used to register the actions and hooks into a single |
|
85 | + * collection. |
|
86 | + * |
|
87 | + * @since 1.0.0 |
|
88 | + * @access private |
|
89 | + * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). |
|
90 | + * @param string $hook The name of the WordPress filter that is being registered. |
|
91 | + * @param object $component A reference to the instance of the object on which the filter is defined. |
|
92 | + * @param string $callback The name of the function definition on the $component. |
|
93 | + * @param int $priority The priority at which the function should be fired. |
|
94 | + * @param int $accepted_args The number of arguments that should be passed to the $callback. |
|
95 | + * @return array The collection of actions and filters registered with WordPress. |
|
96 | + */ |
|
97 | + private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
98 | + |
|
99 | + $hooks[] = array( |
|
100 | + 'hook' => $hook, |
|
101 | + 'component' => $component, |
|
102 | + 'callback' => $callback, |
|
103 | + 'priority' => $priority, |
|
104 | + 'accepted_args' => $accepted_args, |
|
105 | + ); |
|
106 | + |
|
107 | + return $hooks; |
|
108 | + |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Register the filters and actions with WordPress. |
|
113 | + * |
|
114 | + * @since 1.0.0 |
|
115 | + */ |
|
116 | + public function run() { |
|
117 | + |
|
118 | + foreach ( $this->filters as $hook ) { |
|
119 | + add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
120 | + } |
|
121 | + |
|
122 | + foreach ( $this->actions as $hook ) { |
|
123 | + add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
124 | + } |
|
125 | + |
|
126 | + } |
|
127 | 127 | |
128 | 128 | } |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
63 | 63 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
64 | 64 | */ |
65 | - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
66 | - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); |
|
65 | + public function add_action($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
66 | + $this->actions = $this->add($this->actions, $hook, $component, $callback, $priority, $accepted_args); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param int $priority Optional. The priority at which the function should be fired. Default is 10. |
77 | 77 | * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. |
78 | 78 | */ |
79 | - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { |
|
80 | - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); |
|
79 | + public function add_filter($hook, $component, $callback, $priority = 10, $accepted_args = 1) { |
|
80 | + $this->filters = $this->add($this->filters, $hook, $component, $callback, $priority, $accepted_args); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param int $accepted_args The number of arguments that should be passed to the $callback. |
95 | 95 | * @return array The collection of actions and filters registered with WordPress. |
96 | 96 | */ |
97 | - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
|
97 | + private function add($hooks, $hook, $component, $callback, $priority, $accepted_args) { |
|
98 | 98 | |
99 | 99 | $hooks[] = array( |
100 | 100 | 'hook' => $hook, |
@@ -115,12 +115,12 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function run() { |
117 | 117 | |
118 | - foreach ( $this->filters as $hook ) { |
|
119 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
118 | + foreach ($this->filters as $hook) { |
|
119 | + add_filter($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
120 | 120 | } |
121 | 121 | |
122 | - foreach ( $this->actions as $hook ) { |
|
123 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
122 | + foreach ($this->actions as $hook) { |
|
123 | + add_action($hook['hook'], array($hook['component'], $hook['callback']), $hook['priority'], $hook['accepted_args']); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | } |
@@ -21,82 +21,82 @@ |
||
21 | 21 | */ |
22 | 22 | class WPB_Public { |
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 the 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 the 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 public-facing side of the site. |
|
58 | - * |
|
59 | - * @since 1.0.0 |
|
60 | - */ |
|
61 | - public function enqueue_styles() { |
|
56 | + /** |
|
57 | + * Register the stylesheets for the public-facing side of the site. |
|
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-public.css', array(), $this->version, 'all' ); |
|
75 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpb-public.css', array(), $this->version, 'all' ); |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Register the JavaScript for the public-facing side of the site. |
|
81 | - * |
|
82 | - * @since 1.0.0 |
|
83 | - */ |
|
84 | - public function enqueue_scripts() { |
|
79 | + /** |
|
80 | + * Register the JavaScript for the public-facing side of the site. |
|
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-public.js', array( 'jquery' ), $this->version, false ); |
|
98 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpb-public.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 the 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-public.css', array(), $this->version, 'all' ); |
|
75 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wpb-public.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-public.js', array( 'jquery' ), $this->version, false ); |
|
98 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wpb-public.js', array('jquery'), $this->version, false); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 |
@@ -23,32 +23,32 @@ |
||
23 | 23 | */ |
24 | 24 | class Create_Customers_Table extends Migration { |
25 | 25 | |
26 | - /** |
|
27 | - * Run the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function up() { |
|
32 | - Schema::create( |
|
33 | - 'customers', |
|
34 | - function ( Blueprint $table ) { |
|
35 | - $table->id(); |
|
36 | - $table->string( 'name' ); |
|
37 | - $table->string( 'email' )->unique(); |
|
38 | - $table->timestamp( 'email_verified_at' )->nullable(); |
|
39 | - $table->string( 'password' ); |
|
40 | - $table->rememberToken(); |
|
41 | - $table->timestamps(); |
|
42 | - } |
|
43 | - ); |
|
44 | - } |
|
26 | + /** |
|
27 | + * Run the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function up() { |
|
32 | + Schema::create( |
|
33 | + 'customers', |
|
34 | + function ( Blueprint $table ) { |
|
35 | + $table->id(); |
|
36 | + $table->string( 'name' ); |
|
37 | + $table->string( 'email' )->unique(); |
|
38 | + $table->timestamp( 'email_verified_at' )->nullable(); |
|
39 | + $table->string( 'password' ); |
|
40 | + $table->rememberToken(); |
|
41 | + $table->timestamps(); |
|
42 | + } |
|
43 | + ); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Reverse the migrations. |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function down() { |
|
52 | - Schema::dropIfExists( 'customers' ); |
|
53 | - } |
|
46 | + /** |
|
47 | + * Reverse the migrations. |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function down() { |
|
52 | + Schema::dropIfExists( 'customers' ); |
|
53 | + } |
|
54 | 54 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | public function up() { |
32 | 32 | Schema::create( |
33 | 33 | 'customers', |
34 | - function ( Blueprint $table ) { |
|
34 | + function(Blueprint $table) { |
|
35 | 35 | $table->id(); |
36 | - $table->string( 'name' ); |
|
37 | - $table->string( 'email' )->unique(); |
|
38 | - $table->timestamp( 'email_verified_at' )->nullable(); |
|
39 | - $table->string( 'password' ); |
|
36 | + $table->string('name'); |
|
37 | + $table->string('email')->unique(); |
|
38 | + $table->timestamp('email_verified_at')->nullable(); |
|
39 | + $table->string('password'); |
|
40 | 40 | $table->rememberToken(); |
41 | 41 | $table->timestamps(); |
42 | 42 | } |
@@ -49,6 +49,6 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function down() { |
52 | - Schema::dropIfExists( 'customers' ); |
|
52 | + Schema::dropIfExists('customers'); |
|
53 | 53 | } |
54 | 54 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | */ |
26 | 26 | class PostAuthorScope implements Scope { |
27 | 27 | |
28 | - /** |
|
29 | - * Apply the scope to a given Eloquent query builder. |
|
30 | - * |
|
31 | - * @param \Illuminate\Database\Eloquent\Builder $builder The eloquent builder. |
|
32 | - * @param \Illuminate\Database\Eloquent\Model $model The eloquent model. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function apply( Builder $builder, Model $model ) { |
|
37 | - $builder->whereNull( 'post_author' ); |
|
38 | - } |
|
28 | + /** |
|
29 | + * Apply the scope to a given Eloquent query builder. |
|
30 | + * |
|
31 | + * @param \Illuminate\Database\Eloquent\Builder $builder The eloquent builder. |
|
32 | + * @param \Illuminate\Database\Eloquent\Model $model The eloquent model. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function apply( Builder $builder, Model $model ) { |
|
37 | + $builder->whereNull( 'post_author' ); |
|
38 | + } |
|
39 | 39 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function apply( Builder $builder, Model $model ) { |
|
37 | - $builder->whereNull( 'post_author' ); |
|
36 | + public function apply(Builder $builder, Model $model) { |
|
37 | + $builder->whereNull('post_author'); |
|
38 | 38 | } |
39 | 39 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | */ |
26 | 26 | class PostTypeScope implements Scope { |
27 | 27 | |
28 | - /** |
|
29 | - * Apply the scope to a given Eloquent query builder. |
|
30 | - * |
|
31 | - * @param \Illuminate\Database\Eloquent\Builder $builder $builder The eloquent builder. |
|
32 | - * @param \Illuminate\Database\Eloquent\Model $model $model The eloquent model. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function apply( Builder $builder, Model $model ) { |
|
37 | - $builder->where( 'post_type', '=', 'post' ); |
|
38 | - } |
|
28 | + /** |
|
29 | + * Apply the scope to a given Eloquent query builder. |
|
30 | + * |
|
31 | + * @param \Illuminate\Database\Eloquent\Builder $builder $builder The eloquent builder. |
|
32 | + * @param \Illuminate\Database\Eloquent\Model $model $model The eloquent model. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function apply( Builder $builder, Model $model ) { |
|
37 | + $builder->where( 'post_type', '=', 'post' ); |
|
38 | + } |
|
39 | 39 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function apply( Builder $builder, Model $model ) { |
|
37 | - $builder->where( 'post_type', '=', 'post' ); |
|
36 | + public function apply(Builder $builder, Model $model) { |
|
37 | + $builder->where('post_type', '=', 'post'); |
|
38 | 38 | } |
39 | 39 | } |
@@ -25,15 +25,15 @@ |
||
25 | 25 | */ |
26 | 26 | class PostStatusScope implements Scope { |
27 | 27 | |
28 | - /** |
|
29 | - * Apply the scope to a given Eloquent query builder. |
|
30 | - * |
|
31 | - * @param \Illuminate\Database\Eloquent\Builder $builder $builder The eloquent builder. |
|
32 | - * @param \Illuminate\Database\Eloquent\Model $model $model The eloquent model. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function apply( Builder $builder, Model $model ) { |
|
37 | - $builder->where( 'post_status', '=', 'publish' ); |
|
38 | - } |
|
28 | + /** |
|
29 | + * Apply the scope to a given Eloquent query builder. |
|
30 | + * |
|
31 | + * @param \Illuminate\Database\Eloquent\Builder $builder $builder The eloquent builder. |
|
32 | + * @param \Illuminate\Database\Eloquent\Model $model $model The eloquent model. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function apply( Builder $builder, Model $model ) { |
|
37 | + $builder->where( 'post_status', '=', 'publish' ); |
|
38 | + } |
|
39 | 39 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * |
34 | 34 | * @return void |
35 | 35 | */ |
36 | - public function apply( Builder $builder, Model $model ) { |
|
37 | - $builder->where( 'post_status', '=', 'publish' ); |
|
36 | + public function apply(Builder $builder, Model $model) { |
|
37 | + $builder->where('post_status', '=', 'publish'); |
|
38 | 38 | } |
39 | 39 | } |
@@ -23,61 +23,61 @@ |
||
23 | 23 | */ |
24 | 24 | class DB extends Capsule { |
25 | 25 | |
26 | - /** |
|
27 | - * The database instance. |
|
28 | - * |
|
29 | - * @since 1.0.0 |
|
30 | - * @access protected |
|
31 | - * @var \WPB\Database\DB $instance The database instance. |
|
32 | - */ |
|
33 | - protected static $instance = false; |
|
26 | + /** |
|
27 | + * The database instance. |
|
28 | + * |
|
29 | + * @since 1.0.0 |
|
30 | + * @access protected |
|
31 | + * @var \WPB\Database\DB $instance The database instance. |
|
32 | + */ |
|
33 | + protected static $instance = false; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Return database instance. |
|
37 | - * |
|
38 | - * @since 1.0.0 |
|
39 | - * @access public |
|
40 | - * |
|
41 | - * @return null|\WPB\Database\DB |
|
42 | - */ |
|
43 | - public static function instance() { |
|
44 | - if ( ! static::$instance ) { |
|
45 | - static::$instance = new self(); |
|
46 | - } |
|
35 | + /** |
|
36 | + * Return database instance. |
|
37 | + * |
|
38 | + * @since 1.0.0 |
|
39 | + * @access public |
|
40 | + * |
|
41 | + * @return null|\WPB\Database\DB |
|
42 | + */ |
|
43 | + public static function instance() { |
|
44 | + if ( ! static::$instance ) { |
|
45 | + static::$instance = new self(); |
|
46 | + } |
|
47 | 47 | |
48 | - return static::$instance; |
|
49 | - } |
|
48 | + return static::$instance; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * The database constructor. |
|
53 | - * |
|
54 | - * @since 1.0.0 |
|
55 | - * @access public |
|
56 | - * |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - public function __construct() { |
|
60 | - parent::__construct(); |
|
51 | + /** |
|
52 | + * The database constructor. |
|
53 | + * |
|
54 | + * @since 1.0.0 |
|
55 | + * @access public |
|
56 | + * |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + public function __construct() { |
|
60 | + parent::__construct(); |
|
61 | 61 | |
62 | - global $wpdb; |
|
62 | + global $wpdb; |
|
63 | 63 | |
64 | - $this->addConnection( |
|
65 | - array( |
|
64 | + $this->addConnection( |
|
65 | + array( |
|
66 | 66 | |
67 | - 'driver' => 'mysql', |
|
68 | - 'host' => $wpdb->dbhost, |
|
69 | - 'database' => $wpdb->dbname, |
|
70 | - 'username' => $wpdb->dbuser, |
|
71 | - 'password' => $wpdb->dbpassword, |
|
72 | - 'prefix' => $wpdb->prefix, |
|
73 | - 'charset' => $wpdb->charset, |
|
74 | - 'collation' => $wpdb->collate, |
|
75 | - ) |
|
76 | - ); |
|
67 | + 'driver' => 'mysql', |
|
68 | + 'host' => $wpdb->dbhost, |
|
69 | + 'database' => $wpdb->dbname, |
|
70 | + 'username' => $wpdb->dbuser, |
|
71 | + 'password' => $wpdb->dbpassword, |
|
72 | + 'prefix' => $wpdb->prefix, |
|
73 | + 'charset' => $wpdb->charset, |
|
74 | + 'collation' => $wpdb->collate, |
|
75 | + ) |
|
76 | + ); |
|
77 | 77 | |
78 | - // Make this Capsule instance available globally. |
|
79 | - $this->setAsGlobal(); |
|
80 | - // Setup the Eloquent ORM. |
|
81 | - $this->bootEloquent(); |
|
82 | - } |
|
78 | + // Make this Capsule instance available globally. |
|
79 | + $this->setAsGlobal(); |
|
80 | + // Setup the Eloquent ORM. |
|
81 | + $this->bootEloquent(); |
|
82 | + } |
|
83 | 83 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return null|\WPB\Database\DB |
42 | 42 | */ |
43 | 43 | public static function instance() { |
44 | - if ( ! static::$instance ) { |
|
44 | + if (!static::$instance) { |
|
45 | 45 | static::$instance = new self(); |
46 | 46 | } |
47 | 47 |
@@ -28,342 +28,342 @@ |
||
28 | 28 | */ |
29 | 29 | class WPB { |
30 | 30 | |
31 | - /** |
|
32 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
33 | - * the plugin. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * @access protected |
|
37 | - * @var WPB_Loader $loader Maintains and registers all hooks for the plugin. |
|
38 | - */ |
|
39 | - protected $loader; |
|
40 | - |
|
41 | - /** |
|
42 | - * The unique identifier of this plugin. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * @access protected |
|
46 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
47 | - */ |
|
48 | - protected $plugin_name; |
|
49 | - |
|
50 | - /** |
|
51 | - * The current version of the plugin. |
|
52 | - * |
|
53 | - * @since 1.0.0 |
|
54 | - * @access protected |
|
55 | - * @var string $version The current version of the plugin. |
|
56 | - */ |
|
57 | - protected $version; |
|
58 | - |
|
59 | - /** |
|
60 | - * Define the core functionality of the plugin. |
|
61 | - * |
|
62 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
63 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
64 | - * the public-facing side of the site. |
|
65 | - * |
|
66 | - * @since 1.0.0 |
|
67 | - */ |
|
68 | - public function __construct() { |
|
69 | - |
|
70 | - $this->define_constants(); |
|
71 | - |
|
72 | - if ( defined( 'WPB_VERSION' ) ) { |
|
73 | - $this->version = WPB_VERSION; |
|
74 | - } else { |
|
75 | - $this->version = '1.0.0'; |
|
76 | - } |
|
77 | - $this->plugin_name = 'wpb'; |
|
78 | - $this->load_dependencies(); |
|
79 | - $this->set_locale(); |
|
80 | - $this->define_admin_hooks(); |
|
81 | - $this->define_public_hooks(); |
|
82 | - $this->register_assets(); |
|
83 | - |
|
84 | - $menu = new WPB_Admin_Menu( $this->plugin_name ); |
|
85 | - $menu->page_title = 'WPB'; |
|
86 | - $menu->menu_title = 'WPB'; |
|
87 | - $menu->capability = 'manage_options'; |
|
88 | - $menu->slug = 'wpb'; |
|
89 | - $menu->callback = function() { |
|
90 | - echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>'; |
|
91 | - }; |
|
92 | - $menu->icon = 'dashicons-text'; |
|
93 | - $menu->save(); |
|
94 | - |
|
95 | - $submenu = new WPB_Admin_SubMenu( $this->plugin_name ); |
|
96 | - $submenu->parent_slug = $menu->slug; |
|
97 | - $submenu->page_title = 'Settings'; |
|
98 | - $submenu->menu_title = 'Settings'; |
|
99 | - $submenu->capability = 'manage_options'; |
|
100 | - $submenu->slug = 'admin.php?page=' . $menu->slug . '#/settings'; |
|
101 | - $submenu->save(); |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * Load the required dependencies for this plugin. |
|
106 | - * |
|
107 | - * Include the following files that make up the plugin: |
|
108 | - * |
|
109 | - * - WPB_Loader. Orchestrates the hooks of the plugin. |
|
110 | - * - WPB_i18n. Defines internationalization functionality. |
|
111 | - * - WPB_Admin. Defines all hooks for the admin area. |
|
112 | - * - WPB_Public. Defines all hooks for the public side of the site. |
|
113 | - * |
|
114 | - * Create an instance of the loader which will be used to register the hooks |
|
115 | - * with WordPress. |
|
116 | - * |
|
117 | - * @since 1.0.0 |
|
118 | - * @access private |
|
119 | - */ |
|
120 | - private function load_dependencies() { |
|
121 | - |
|
122 | - /** |
|
123 | - * The class responsible for orchestrating the actions and filters of the |
|
124 | - * core plugin. |
|
125 | - */ |
|
126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php'; |
|
127 | - |
|
128 | - /** |
|
129 | - * The class responsible for defining internationalization functionality |
|
130 | - * of the plugin. |
|
131 | - */ |
|
132 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php'; |
|
133 | - |
|
134 | - /** |
|
135 | - * The class responsible for defining all actions that occur in the admin area. |
|
136 | - */ |
|
137 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php'; |
|
138 | - |
|
139 | - /** |
|
140 | - * The class responsible for defining all menu actions that occur in the admin area. |
|
141 | - */ |
|
142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php'; |
|
143 | - |
|
144 | - /** |
|
145 | - * The class responsible for defining all submenu actions that occur in the admin area. |
|
146 | - */ |
|
147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php'; |
|
148 | - |
|
149 | - /** |
|
150 | - * The class responsible for defining all actions that occur in the public-facing |
|
151 | - * side of the site. |
|
152 | - */ |
|
153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php'; |
|
154 | - |
|
155 | - $this->loader = new WPB_Loader(); |
|
156 | - |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Define the locale for this plugin for internationalization. |
|
161 | - * |
|
162 | - * Uses the WPB_i18n class in order to set the domain and to register the hook |
|
163 | - * with WordPress. |
|
164 | - * |
|
165 | - * @since 1.0.0 |
|
166 | - * @access private |
|
167 | - */ |
|
168 | - private function set_locale() { |
|
169 | - |
|
170 | - $plugin_i18n = new WPB_I18n(); |
|
171 | - |
|
172 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
173 | - |
|
174 | - } |
|
175 | - |
|
176 | - /** |
|
177 | - * Register all of the hooks related to the admin area functionality |
|
178 | - * of the plugin. |
|
179 | - * |
|
180 | - * @since 1.0.0 |
|
181 | - * @access private |
|
182 | - */ |
|
183 | - private function define_admin_hooks() { |
|
184 | - |
|
185 | - $plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
186 | - |
|
187 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
188 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
189 | - |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * Register all of the hooks related to the public-facing functionality |
|
194 | - * of the plugin. |
|
195 | - * |
|
196 | - * @since 1.0.0 |
|
197 | - * @access private |
|
198 | - */ |
|
199 | - private function define_public_hooks() { |
|
200 | - |
|
201 | - $plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() ); |
|
202 | - |
|
203 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
204 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
205 | - |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * Run the loader to execute all of the hooks with WordPress. |
|
210 | - * |
|
211 | - * @since 1.0.0 |
|
212 | - */ |
|
213 | - public function run() { |
|
214 | - $this->loader->run(); |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * The name of the plugin used to uniquely identify it within the context of |
|
219 | - * WordPress and to define internationalization functionality. |
|
220 | - * |
|
221 | - * @since 1.0.0 |
|
222 | - * @return string The name of the plugin. |
|
223 | - */ |
|
224 | - public function get_plugin_name() { |
|
225 | - return $this->plugin_name; |
|
226 | - } |
|
227 | - |
|
228 | - /** |
|
229 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
230 | - * |
|
231 | - * @since 1.0.0 |
|
232 | - * @return WPB_Loader Orchestrates the hooks of the plugin. |
|
233 | - */ |
|
234 | - public function get_loader() { |
|
235 | - return $this->loader; |
|
236 | - } |
|
237 | - |
|
238 | - /** |
|
239 | - * Retrieve the version number of the plugin. |
|
240 | - * |
|
241 | - * @since 1.0.0 |
|
242 | - * @return string The version number of the plugin. |
|
243 | - */ |
|
244 | - public function get_version() { |
|
245 | - return $this->version; |
|
246 | - } |
|
247 | - |
|
248 | - /** |
|
249 | - * Define the constants. |
|
250 | - * |
|
251 | - * @return void |
|
252 | - */ |
|
253 | - public function define_constants() { |
|
254 | - define( 'WPB_VERSION', $this->version ); |
|
255 | - } |
|
256 | - |
|
257 | - /** |
|
258 | - * Register our app scripts and styles. |
|
259 | - * |
|
260 | - * @return void |
|
261 | - */ |
|
262 | - public function register_assets() { |
|
263 | - $this->register_scripts( $this->get_scripts() ); |
|
264 | - $this->register_styles( $this->get_styles() ); |
|
265 | - } |
|
266 | - |
|
267 | - /** |
|
268 | - * Register scripts. |
|
269 | - * |
|
270 | - * @param array $scripts All Scripts as an array. |
|
271 | - * |
|
272 | - * @return void |
|
273 | - */ |
|
274 | - private function register_scripts( $scripts ) { |
|
275 | - foreach ( $scripts as $handle => $script ) { |
|
276 | - $deps = isset( $script['deps'] ) ? $script['deps'] : false; |
|
277 | - $in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false; |
|
278 | - $version = isset( $script['version'] ) ? $script['version'] : WPB_VERSION; |
|
279 | - |
|
280 | - wp_register_script( $handle, $script['src'], $deps, $version, $in_footer ); |
|
281 | - } |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * Register styles. |
|
286 | - * |
|
287 | - * @param array $styles All styles as an array. |
|
288 | - * |
|
289 | - * @return void |
|
290 | - */ |
|
291 | - public function register_styles( $styles ) { |
|
292 | - foreach ( $styles as $handle => $style ) { |
|
293 | - $deps = isset( $style['deps'] ) ? $style['deps'] : false; |
|
294 | - |
|
295 | - wp_register_style( $handle, $style['src'], $deps, WPB_VERSION ); |
|
296 | - } |
|
297 | - } |
|
298 | - |
|
299 | - /** |
|
300 | - * Get all registered scripts. |
|
301 | - * |
|
302 | - * @return array |
|
303 | - */ |
|
304 | - public function get_scripts() { |
|
305 | - |
|
306 | - $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : ''; |
|
307 | - |
|
308 | - $scripts = array( |
|
309 | - 'wpb-runtime' => array( |
|
310 | - 'src' => WPB_ASSETS . '/js/runtime.js', |
|
311 | - 'version' => filemtime( WPB_PATH . '/public/js/runtime.js' ), |
|
312 | - 'in_footer' => true, |
|
313 | - ), |
|
314 | - 'wpb-vendor' => array( |
|
315 | - 'src' => WPB_ASSETS . '/js/vendors.js', |
|
316 | - 'version' => filemtime( WPB_PATH . '/public/js/vendors.js' ), |
|
317 | - 'in_footer' => true, |
|
318 | - ), |
|
319 | - 'wpb-frontend' => array( |
|
320 | - 'src' => WPB_ASSETS . '/js/frontend.js', |
|
321 | - 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
322 | - 'version' => filemtime( WPB_PATH . '/public/js/frontend.js' ), |
|
323 | - 'in_footer' => true, |
|
324 | - ), |
|
325 | - 'wpb-admin' => array( |
|
326 | - 'src' => WPB_ASSETS . '/js/admin.js', |
|
327 | - 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
328 | - 'version' => filemtime( WPB_PATH . '/public/js/admin.js' ), |
|
329 | - 'in_footer' => true, |
|
330 | - ), |
|
331 | - 'wpb-spa' => array( |
|
332 | - 'src' => WPB_ASSETS . '/js/spa.js', |
|
333 | - 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
334 | - 'version' => filemtime( WPB_PATH . '/public/js/spa.js' ), |
|
335 | - 'in_footer' => true, |
|
336 | - ), |
|
337 | - ); |
|
338 | - |
|
339 | - return $scripts; |
|
340 | - } |
|
341 | - |
|
342 | - /** |
|
343 | - * Get registered styles. |
|
344 | - * |
|
345 | - * @return array |
|
346 | - */ |
|
347 | - public function get_styles() { |
|
348 | - |
|
349 | - $styles = array( |
|
350 | - 'wpb-style' => array( |
|
351 | - 'src' => WPB_ASSETS . '/css/style.css', |
|
352 | - ), |
|
353 | - 'wpb-frontend' => array( |
|
354 | - 'src' => WPB_ASSETS . '/css/frontend.css', |
|
355 | - ), |
|
356 | - 'wpb-admin' => array( |
|
357 | - 'src' => WPB_ASSETS . '/css/admin.css', |
|
358 | - ), |
|
359 | - 'wpb-spa' => array( |
|
360 | - 'src' => WPB_ASSETS . '/css/spa.css', |
|
361 | - ), |
|
362 | - 'wpb-vendors' => array( |
|
363 | - 'src' => WPB_ASSETS . '/css/vendors.css', |
|
364 | - ), |
|
365 | - ); |
|
366 | - |
|
367 | - return $styles; |
|
368 | - } |
|
31 | + /** |
|
32 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
33 | + * the plugin. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * @access protected |
|
37 | + * @var WPB_Loader $loader Maintains and registers all hooks for the plugin. |
|
38 | + */ |
|
39 | + protected $loader; |
|
40 | + |
|
41 | + /** |
|
42 | + * The unique identifier of this plugin. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * @access protected |
|
46 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
47 | + */ |
|
48 | + protected $plugin_name; |
|
49 | + |
|
50 | + /** |
|
51 | + * The current version of the plugin. |
|
52 | + * |
|
53 | + * @since 1.0.0 |
|
54 | + * @access protected |
|
55 | + * @var string $version The current version of the plugin. |
|
56 | + */ |
|
57 | + protected $version; |
|
58 | + |
|
59 | + /** |
|
60 | + * Define the core functionality of the plugin. |
|
61 | + * |
|
62 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
63 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
64 | + * the public-facing side of the site. |
|
65 | + * |
|
66 | + * @since 1.0.0 |
|
67 | + */ |
|
68 | + public function __construct() { |
|
69 | + |
|
70 | + $this->define_constants(); |
|
71 | + |
|
72 | + if ( defined( 'WPB_VERSION' ) ) { |
|
73 | + $this->version = WPB_VERSION; |
|
74 | + } else { |
|
75 | + $this->version = '1.0.0'; |
|
76 | + } |
|
77 | + $this->plugin_name = 'wpb'; |
|
78 | + $this->load_dependencies(); |
|
79 | + $this->set_locale(); |
|
80 | + $this->define_admin_hooks(); |
|
81 | + $this->define_public_hooks(); |
|
82 | + $this->register_assets(); |
|
83 | + |
|
84 | + $menu = new WPB_Admin_Menu( $this->plugin_name ); |
|
85 | + $menu->page_title = 'WPB'; |
|
86 | + $menu->menu_title = 'WPB'; |
|
87 | + $menu->capability = 'manage_options'; |
|
88 | + $menu->slug = 'wpb'; |
|
89 | + $menu->callback = function() { |
|
90 | + echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>'; |
|
91 | + }; |
|
92 | + $menu->icon = 'dashicons-text'; |
|
93 | + $menu->save(); |
|
94 | + |
|
95 | + $submenu = new WPB_Admin_SubMenu( $this->plugin_name ); |
|
96 | + $submenu->parent_slug = $menu->slug; |
|
97 | + $submenu->page_title = 'Settings'; |
|
98 | + $submenu->menu_title = 'Settings'; |
|
99 | + $submenu->capability = 'manage_options'; |
|
100 | + $submenu->slug = 'admin.php?page=' . $menu->slug . '#/settings'; |
|
101 | + $submenu->save(); |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * Load the required dependencies for this plugin. |
|
106 | + * |
|
107 | + * Include the following files that make up the plugin: |
|
108 | + * |
|
109 | + * - WPB_Loader. Orchestrates the hooks of the plugin. |
|
110 | + * - WPB_i18n. Defines internationalization functionality. |
|
111 | + * - WPB_Admin. Defines all hooks for the admin area. |
|
112 | + * - WPB_Public. Defines all hooks for the public side of the site. |
|
113 | + * |
|
114 | + * Create an instance of the loader which will be used to register the hooks |
|
115 | + * with WordPress. |
|
116 | + * |
|
117 | + * @since 1.0.0 |
|
118 | + * @access private |
|
119 | + */ |
|
120 | + private function load_dependencies() { |
|
121 | + |
|
122 | + /** |
|
123 | + * The class responsible for orchestrating the actions and filters of the |
|
124 | + * core plugin. |
|
125 | + */ |
|
126 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php'; |
|
127 | + |
|
128 | + /** |
|
129 | + * The class responsible for defining internationalization functionality |
|
130 | + * of the plugin. |
|
131 | + */ |
|
132 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php'; |
|
133 | + |
|
134 | + /** |
|
135 | + * The class responsible for defining all actions that occur in the admin area. |
|
136 | + */ |
|
137 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php'; |
|
138 | + |
|
139 | + /** |
|
140 | + * The class responsible for defining all menu actions that occur in the admin area. |
|
141 | + */ |
|
142 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php'; |
|
143 | + |
|
144 | + /** |
|
145 | + * The class responsible for defining all submenu actions that occur in the admin area. |
|
146 | + */ |
|
147 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php'; |
|
148 | + |
|
149 | + /** |
|
150 | + * The class responsible for defining all actions that occur in the public-facing |
|
151 | + * side of the site. |
|
152 | + */ |
|
153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php'; |
|
154 | + |
|
155 | + $this->loader = new WPB_Loader(); |
|
156 | + |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Define the locale for this plugin for internationalization. |
|
161 | + * |
|
162 | + * Uses the WPB_i18n class in order to set the domain and to register the hook |
|
163 | + * with WordPress. |
|
164 | + * |
|
165 | + * @since 1.0.0 |
|
166 | + * @access private |
|
167 | + */ |
|
168 | + private function set_locale() { |
|
169 | + |
|
170 | + $plugin_i18n = new WPB_I18n(); |
|
171 | + |
|
172 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
173 | + |
|
174 | + } |
|
175 | + |
|
176 | + /** |
|
177 | + * Register all of the hooks related to the admin area functionality |
|
178 | + * of the plugin. |
|
179 | + * |
|
180 | + * @since 1.0.0 |
|
181 | + * @access private |
|
182 | + */ |
|
183 | + private function define_admin_hooks() { |
|
184 | + |
|
185 | + $plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
186 | + |
|
187 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
188 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
189 | + |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * Register all of the hooks related to the public-facing functionality |
|
194 | + * of the plugin. |
|
195 | + * |
|
196 | + * @since 1.0.0 |
|
197 | + * @access private |
|
198 | + */ |
|
199 | + private function define_public_hooks() { |
|
200 | + |
|
201 | + $plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() ); |
|
202 | + |
|
203 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
204 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
205 | + |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * Run the loader to execute all of the hooks with WordPress. |
|
210 | + * |
|
211 | + * @since 1.0.0 |
|
212 | + */ |
|
213 | + public function run() { |
|
214 | + $this->loader->run(); |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * The name of the plugin used to uniquely identify it within the context of |
|
219 | + * WordPress and to define internationalization functionality. |
|
220 | + * |
|
221 | + * @since 1.0.0 |
|
222 | + * @return string The name of the plugin. |
|
223 | + */ |
|
224 | + public function get_plugin_name() { |
|
225 | + return $this->plugin_name; |
|
226 | + } |
|
227 | + |
|
228 | + /** |
|
229 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
230 | + * |
|
231 | + * @since 1.0.0 |
|
232 | + * @return WPB_Loader Orchestrates the hooks of the plugin. |
|
233 | + */ |
|
234 | + public function get_loader() { |
|
235 | + return $this->loader; |
|
236 | + } |
|
237 | + |
|
238 | + /** |
|
239 | + * Retrieve the version number of the plugin. |
|
240 | + * |
|
241 | + * @since 1.0.0 |
|
242 | + * @return string The version number of the plugin. |
|
243 | + */ |
|
244 | + public function get_version() { |
|
245 | + return $this->version; |
|
246 | + } |
|
247 | + |
|
248 | + /** |
|
249 | + * Define the constants. |
|
250 | + * |
|
251 | + * @return void |
|
252 | + */ |
|
253 | + public function define_constants() { |
|
254 | + define( 'WPB_VERSION', $this->version ); |
|
255 | + } |
|
256 | + |
|
257 | + /** |
|
258 | + * Register our app scripts and styles. |
|
259 | + * |
|
260 | + * @return void |
|
261 | + */ |
|
262 | + public function register_assets() { |
|
263 | + $this->register_scripts( $this->get_scripts() ); |
|
264 | + $this->register_styles( $this->get_styles() ); |
|
265 | + } |
|
266 | + |
|
267 | + /** |
|
268 | + * Register scripts. |
|
269 | + * |
|
270 | + * @param array $scripts All Scripts as an array. |
|
271 | + * |
|
272 | + * @return void |
|
273 | + */ |
|
274 | + private function register_scripts( $scripts ) { |
|
275 | + foreach ( $scripts as $handle => $script ) { |
|
276 | + $deps = isset( $script['deps'] ) ? $script['deps'] : false; |
|
277 | + $in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false; |
|
278 | + $version = isset( $script['version'] ) ? $script['version'] : WPB_VERSION; |
|
279 | + |
|
280 | + wp_register_script( $handle, $script['src'], $deps, $version, $in_footer ); |
|
281 | + } |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * Register styles. |
|
286 | + * |
|
287 | + * @param array $styles All styles as an array. |
|
288 | + * |
|
289 | + * @return void |
|
290 | + */ |
|
291 | + public function register_styles( $styles ) { |
|
292 | + foreach ( $styles as $handle => $style ) { |
|
293 | + $deps = isset( $style['deps'] ) ? $style['deps'] : false; |
|
294 | + |
|
295 | + wp_register_style( $handle, $style['src'], $deps, WPB_VERSION ); |
|
296 | + } |
|
297 | + } |
|
298 | + |
|
299 | + /** |
|
300 | + * Get all registered scripts. |
|
301 | + * |
|
302 | + * @return array |
|
303 | + */ |
|
304 | + public function get_scripts() { |
|
305 | + |
|
306 | + $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : ''; |
|
307 | + |
|
308 | + $scripts = array( |
|
309 | + 'wpb-runtime' => array( |
|
310 | + 'src' => WPB_ASSETS . '/js/runtime.js', |
|
311 | + 'version' => filemtime( WPB_PATH . '/public/js/runtime.js' ), |
|
312 | + 'in_footer' => true, |
|
313 | + ), |
|
314 | + 'wpb-vendor' => array( |
|
315 | + 'src' => WPB_ASSETS . '/js/vendors.js', |
|
316 | + 'version' => filemtime( WPB_PATH . '/public/js/vendors.js' ), |
|
317 | + 'in_footer' => true, |
|
318 | + ), |
|
319 | + 'wpb-frontend' => array( |
|
320 | + 'src' => WPB_ASSETS . '/js/frontend.js', |
|
321 | + 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
322 | + 'version' => filemtime( WPB_PATH . '/public/js/frontend.js' ), |
|
323 | + 'in_footer' => true, |
|
324 | + ), |
|
325 | + 'wpb-admin' => array( |
|
326 | + 'src' => WPB_ASSETS . '/js/admin.js', |
|
327 | + 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
328 | + 'version' => filemtime( WPB_PATH . '/public/js/admin.js' ), |
|
329 | + 'in_footer' => true, |
|
330 | + ), |
|
331 | + 'wpb-spa' => array( |
|
332 | + 'src' => WPB_ASSETS . '/js/spa.js', |
|
333 | + 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
334 | + 'version' => filemtime( WPB_PATH . '/public/js/spa.js' ), |
|
335 | + 'in_footer' => true, |
|
336 | + ), |
|
337 | + ); |
|
338 | + |
|
339 | + return $scripts; |
|
340 | + } |
|
341 | + |
|
342 | + /** |
|
343 | + * Get registered styles. |
|
344 | + * |
|
345 | + * @return array |
|
346 | + */ |
|
347 | + public function get_styles() { |
|
348 | + |
|
349 | + $styles = array( |
|
350 | + 'wpb-style' => array( |
|
351 | + 'src' => WPB_ASSETS . '/css/style.css', |
|
352 | + ), |
|
353 | + 'wpb-frontend' => array( |
|
354 | + 'src' => WPB_ASSETS . '/css/frontend.css', |
|
355 | + ), |
|
356 | + 'wpb-admin' => array( |
|
357 | + 'src' => WPB_ASSETS . '/css/admin.css', |
|
358 | + ), |
|
359 | + 'wpb-spa' => array( |
|
360 | + 'src' => WPB_ASSETS . '/css/spa.css', |
|
361 | + ), |
|
362 | + 'wpb-vendors' => array( |
|
363 | + 'src' => WPB_ASSETS . '/css/vendors.css', |
|
364 | + ), |
|
365 | + ); |
|
366 | + |
|
367 | + return $styles; |
|
368 | + } |
|
369 | 369 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $this->define_constants(); |
71 | 71 | |
72 | - if ( defined( 'WPB_VERSION' ) ) { |
|
72 | + if (defined('WPB_VERSION')) { |
|
73 | 73 | $this->version = WPB_VERSION; |
74 | 74 | } else { |
75 | 75 | $this->version = '1.0.0'; |
@@ -81,23 +81,23 @@ discard block |
||
81 | 81 | $this->define_public_hooks(); |
82 | 82 | $this->register_assets(); |
83 | 83 | |
84 | - $menu = new WPB_Admin_Menu( $this->plugin_name ); |
|
84 | + $menu = new WPB_Admin_Menu($this->plugin_name); |
|
85 | 85 | $menu->page_title = 'WPB'; |
86 | 86 | $menu->menu_title = 'WPB'; |
87 | 87 | $menu->capability = 'manage_options'; |
88 | 88 | $menu->slug = 'wpb'; |
89 | 89 | $menu->callback = function() { |
90 | - echo '<div class="wrap"><div id="wpb-admin" base-url="' . esc_attr( get_site_url() ) . '" csrf-token="' . esc_attr( wpb_csrf_token() ) . '"></div></div>'; |
|
90 | + echo '<div class="wrap"><div id="wpb-admin" base-url="'.esc_attr(get_site_url()).'" csrf-token="'.esc_attr(wpb_csrf_token()).'"></div></div>'; |
|
91 | 91 | }; |
92 | 92 | $menu->icon = 'dashicons-text'; |
93 | 93 | $menu->save(); |
94 | 94 | |
95 | - $submenu = new WPB_Admin_SubMenu( $this->plugin_name ); |
|
95 | + $submenu = new WPB_Admin_SubMenu($this->plugin_name); |
|
96 | 96 | $submenu->parent_slug = $menu->slug; |
97 | 97 | $submenu->page_title = 'Settings'; |
98 | 98 | $submenu->menu_title = 'Settings'; |
99 | 99 | $submenu->capability = 'manage_options'; |
100 | - $submenu->slug = 'admin.php?page=' . $menu->slug . '#/settings'; |
|
100 | + $submenu->slug = 'admin.php?page='.$menu->slug.'#/settings'; |
|
101 | 101 | $submenu->save(); |
102 | 102 | } |
103 | 103 | |
@@ -123,34 +123,34 @@ discard block |
||
123 | 123 | * The class responsible for orchestrating the actions and filters of the |
124 | 124 | * core plugin. |
125 | 125 | */ |
126 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-loader.php'; |
|
126 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wpb-loader.php'; |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * The class responsible for defining internationalization functionality |
130 | 130 | * of the plugin. |
131 | 131 | */ |
132 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpb-i18n.php'; |
|
132 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wpb-i18n.php'; |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * The class responsible for defining all actions that occur in the admin area. |
136 | 136 | */ |
137 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin.php'; |
|
137 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin.php'; |
|
138 | 138 | |
139 | 139 | /** |
140 | 140 | * The class responsible for defining all menu actions that occur in the admin area. |
141 | 141 | */ |
142 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-menu.php'; |
|
142 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin-menu.php'; |
|
143 | 143 | |
144 | 144 | /** |
145 | 145 | * The class responsible for defining all submenu actions that occur in the admin area. |
146 | 146 | */ |
147 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wpb-admin-submenu.php'; |
|
147 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wpb-admin-submenu.php'; |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * The class responsible for defining all actions that occur in the public-facing |
151 | 151 | * side of the site. |
152 | 152 | */ |
153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpb-public.php'; |
|
153 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wpb-public.php'; |
|
154 | 154 | |
155 | 155 | $this->loader = new WPB_Loader(); |
156 | 156 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $plugin_i18n = new WPB_I18n(); |
171 | 171 | |
172 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
172 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
173 | 173 | |
174 | 174 | } |
175 | 175 | |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | */ |
183 | 183 | private function define_admin_hooks() { |
184 | 184 | |
185 | - $plugin_admin = new WPB_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
185 | + $plugin_admin = new WPB_Admin($this->get_plugin_name(), $this->get_version()); |
|
186 | 186 | |
187 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
188 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
187 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
188 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | */ |
199 | 199 | private function define_public_hooks() { |
200 | 200 | |
201 | - $plugin_public = new WPB_Public( $this->get_plugin_name(), $this->get_version() ); |
|
201 | + $plugin_public = new WPB_Public($this->get_plugin_name(), $this->get_version()); |
|
202 | 202 | |
203 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
204 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
203 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
204 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
205 | 205 | |
206 | 206 | } |
207 | 207 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * @return void |
252 | 252 | */ |
253 | 253 | public function define_constants() { |
254 | - define( 'WPB_VERSION', $this->version ); |
|
254 | + define('WPB_VERSION', $this->version); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | * @return void |
261 | 261 | */ |
262 | 262 | public function register_assets() { |
263 | - $this->register_scripts( $this->get_scripts() ); |
|
264 | - $this->register_styles( $this->get_styles() ); |
|
263 | + $this->register_scripts($this->get_scripts()); |
|
264 | + $this->register_styles($this->get_styles()); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - private function register_scripts( $scripts ) { |
|
275 | - foreach ( $scripts as $handle => $script ) { |
|
276 | - $deps = isset( $script['deps'] ) ? $script['deps'] : false; |
|
277 | - $in_footer = isset( $script['in_footer'] ) ? $script['in_footer'] : false; |
|
278 | - $version = isset( $script['version'] ) ? $script['version'] : WPB_VERSION; |
|
274 | + private function register_scripts($scripts) { |
|
275 | + foreach ($scripts as $handle => $script) { |
|
276 | + $deps = isset($script['deps']) ? $script['deps'] : false; |
|
277 | + $in_footer = isset($script['in_footer']) ? $script['in_footer'] : false; |
|
278 | + $version = isset($script['version']) ? $script['version'] : WPB_VERSION; |
|
279 | 279 | |
280 | - wp_register_script( $handle, $script['src'], $deps, $version, $in_footer ); |
|
280 | + wp_register_script($handle, $script['src'], $deps, $version, $in_footer); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @return void |
290 | 290 | */ |
291 | - public function register_styles( $styles ) { |
|
292 | - foreach ( $styles as $handle => $style ) { |
|
293 | - $deps = isset( $style['deps'] ) ? $style['deps'] : false; |
|
291 | + public function register_styles($styles) { |
|
292 | + foreach ($styles as $handle => $style) { |
|
293 | + $deps = isset($style['deps']) ? $style['deps'] : false; |
|
294 | 294 | |
295 | - wp_register_style( $handle, $style['src'], $deps, WPB_VERSION ); |
|
295 | + wp_register_style($handle, $style['src'], $deps, WPB_VERSION); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -303,35 +303,35 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function get_scripts() { |
305 | 305 | |
306 | - $prefix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '.min' : ''; |
|
306 | + $prefix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.min' : ''; |
|
307 | 307 | |
308 | 308 | $scripts = array( |
309 | 309 | 'wpb-runtime' => array( |
310 | - 'src' => WPB_ASSETS . '/js/runtime.js', |
|
311 | - 'version' => filemtime( WPB_PATH . '/public/js/runtime.js' ), |
|
310 | + 'src' => WPB_ASSETS.'/js/runtime.js', |
|
311 | + 'version' => filemtime(WPB_PATH.'/public/js/runtime.js'), |
|
312 | 312 | 'in_footer' => true, |
313 | 313 | ), |
314 | 314 | 'wpb-vendor' => array( |
315 | - 'src' => WPB_ASSETS . '/js/vendors.js', |
|
316 | - 'version' => filemtime( WPB_PATH . '/public/js/vendors.js' ), |
|
315 | + 'src' => WPB_ASSETS.'/js/vendors.js', |
|
316 | + 'version' => filemtime(WPB_PATH.'/public/js/vendors.js'), |
|
317 | 317 | 'in_footer' => true, |
318 | 318 | ), |
319 | 319 | 'wpb-frontend' => array( |
320 | - 'src' => WPB_ASSETS . '/js/frontend.js', |
|
321 | - 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
322 | - 'version' => filemtime( WPB_PATH . '/public/js/frontend.js' ), |
|
320 | + 'src' => WPB_ASSETS.'/js/frontend.js', |
|
321 | + 'deps' => array('jquery', 'wpb-vendor', 'wpb-runtime'), |
|
322 | + 'version' => filemtime(WPB_PATH.'/public/js/frontend.js'), |
|
323 | 323 | 'in_footer' => true, |
324 | 324 | ), |
325 | 325 | 'wpb-admin' => array( |
326 | - 'src' => WPB_ASSETS . '/js/admin.js', |
|
327 | - 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
328 | - 'version' => filemtime( WPB_PATH . '/public/js/admin.js' ), |
|
326 | + 'src' => WPB_ASSETS.'/js/admin.js', |
|
327 | + 'deps' => array('jquery', 'wpb-vendor', 'wpb-runtime'), |
|
328 | + 'version' => filemtime(WPB_PATH.'/public/js/admin.js'), |
|
329 | 329 | 'in_footer' => true, |
330 | 330 | ), |
331 | 331 | 'wpb-spa' => array( |
332 | - 'src' => WPB_ASSETS . '/js/spa.js', |
|
333 | - 'deps' => array( 'jquery', 'wpb-vendor', 'wpb-runtime' ), |
|
334 | - 'version' => filemtime( WPB_PATH . '/public/js/spa.js' ), |
|
332 | + 'src' => WPB_ASSETS.'/js/spa.js', |
|
333 | + 'deps' => array('jquery', 'wpb-vendor', 'wpb-runtime'), |
|
334 | + 'version' => filemtime(WPB_PATH.'/public/js/spa.js'), |
|
335 | 335 | 'in_footer' => true, |
336 | 336 | ), |
337 | 337 | ); |
@@ -348,19 +348,19 @@ discard block |
||
348 | 348 | |
349 | 349 | $styles = array( |
350 | 350 | 'wpb-style' => array( |
351 | - 'src' => WPB_ASSETS . '/css/style.css', |
|
351 | + 'src' => WPB_ASSETS.'/css/style.css', |
|
352 | 352 | ), |
353 | 353 | 'wpb-frontend' => array( |
354 | - 'src' => WPB_ASSETS . '/css/frontend.css', |
|
354 | + 'src' => WPB_ASSETS.'/css/frontend.css', |
|
355 | 355 | ), |
356 | 356 | 'wpb-admin' => array( |
357 | - 'src' => WPB_ASSETS . '/css/admin.css', |
|
357 | + 'src' => WPB_ASSETS.'/css/admin.css', |
|
358 | 358 | ), |
359 | 359 | 'wpb-spa' => array( |
360 | - 'src' => WPB_ASSETS . '/css/spa.css', |
|
360 | + 'src' => WPB_ASSETS.'/css/spa.css', |
|
361 | 361 | ), |
362 | 362 | 'wpb-vendors' => array( |
363 | - 'src' => WPB_ASSETS . '/css/vendors.css', |
|
363 | + 'src' => WPB_ASSETS.'/css/vendors.css', |
|
364 | 364 | ), |
365 | 365 | ); |
366 | 366 |