Passed
Push — develop ( 0cea4c...71a67f )
by Paul
04:07
created
templates/email/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 <html>
3 3
 <head>
4 4
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
-    <title><?= wp_specialchars_decode((string) get_option('blogname'), ENT_QUOTES); ?></title>
5
+    <title><?= wp_specialchars_decode( (string) get_option( 'blogname' ), ENT_QUOTES ); ?></title>
6 6
 </head>
7 7
 <body>
8 8
 
Please login to merge, or discard this patch.
src/Image.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     protected $postmeta;
13 13
     protected $utility;
14 14
 
15
-    public function __construct(PostMeta $postmeta, Utility $utility)
15
+    public function __construct( PostMeta $postmeta, Utility $utility )
16 16
     {
17 17
         $this->postmeta = $postmeta;
18 18
         $this->utility = $utility;
@@ -23,43 +23,43 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return self
25 25
      */
26
-    public function get($attachment)
26
+    public function get( $attachment )
27 27
     {
28
-        $attachment = $this->normalize($attachment);
29
-        if ($attachment && $thumbnail = wp_get_attachment_image_src($attachment, 'thumbnail')) {
30
-            $medium = $this->normalizeSrc(wp_get_attachment_image_src($attachment, 'medium'), $thumbnail);
31
-            $large = $this->normalizeSrc(wp_get_attachment_image_src($attachment, 'large'), $medium);
28
+        $attachment = $this->normalize( $attachment );
29
+        if( $attachment && $thumbnail = wp_get_attachment_image_src( $attachment, 'thumbnail' ) ) {
30
+            $medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'medium' ), $thumbnail );
31
+            $large = $this->normalizeSrc( wp_get_attachment_image_src( $attachment, 'large' ), $medium );
32 32
 
33 33
             $this->image = (object) [
34
-                'alt' => wp_strip_all_tags(get_post_meta($attachment, '_wp_attachment_image_alt', true), true),
35
-                'caption' => wp_get_attachment_caption($attachment),
36
-                'copyright' => wp_strip_all_tags(get_post_meta($attachment, '_copyright', true), true),
34
+                'alt' => wp_strip_all_tags( get_post_meta( $attachment, '_wp_attachment_image_alt', true ), true ),
35
+                'caption' => wp_get_attachment_caption( $attachment ),
36
+                'copyright' => wp_strip_all_tags( get_post_meta( $attachment, '_copyright', true ), true ),
37 37
                 'ID' => $attachment,
38 38
                 'large' => $large,
39 39
                 'medium' => $medium,
40
-                'permalink' => get_attachment_link($attachment),
41
-                'thumbnail' => $this->normalizeSrc($thumbnail),
40
+                'permalink' => get_attachment_link( $attachment ),
41
+                'thumbnail' => $this->normalizeSrc( $thumbnail ),
42 42
             ];
43 43
         }
44 44
         return $this;
45 45
     }
46 46
 
47
-    public function render($size = 'large')
47
+    public function render( $size = 'large' )
48 48
     {
49
-        if ($this->image) {
50
-            return wp_get_attachment_image($this->image->ID, $size);
49
+        if( $this->image ) {
50
+            return wp_get_attachment_image( $this->image->ID, $size );
51 51
         }
52 52
     }
53 53
 
54
-    protected function normalize($attachmentId)
54
+    protected function normalize( $attachmentId )
55 55
     {
56
-        if (!filter_var($attachmentId, FILTER_VALIDATE_INT)) {
57
-            $attachmentId = $this->postmeta->get($attachmentId);
56
+        if( !filter_var( $attachmentId, FILTER_VALIDATE_INT ) ) {
57
+            $attachmentId = $this->postmeta->get( $attachmentId );
58 58
         }
59 59
 
60
-        $attachment = get_post($attachmentId);
60
+        $attachment = get_post( $attachmentId );
61 61
 
62
-        if (is_null($attachment) || 'attachment' != $attachment->post_type) {
62
+        if( is_null( $attachment ) || 'attachment' != $attachment->post_type ) {
63 63
             return;
64 64
         }
65 65
 
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @return array
73 73
      */
74
-    protected function normalizeSrc(array $image, $fallback = false)
74
+    protected function normalizeSrc( array $image, $fallback = false )
75 75
     {
76
-        if (is_array($fallback) && count(array_diff($image, $fallback)) < 2) {
76
+        if( is_array( $fallback ) && count( array_diff( $image, $fallback ) ) < 2 ) {
77 77
             $image = $fallback;
78 78
         }
79
-        $image = array_pad($image, 3, '');
79
+        $image = array_pad( $image, 3, '' );
80 80
         return [
81
-            'url' => array_shift($image),
82
-            'width' => array_shift($image),
83
-            'height' => array_shift($image),
81
+            'url' => array_shift( $image ),
82
+            'width' => array_shift( $image ),
83
+            'height' => array_shift( $image ),
84 84
         ];
85 85
     }
86 86
 }
Please login to merge, or discard this patch.
src/Facade.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
      * @return mixed
30 30
      * @throws \RuntimeException
31 31
      */
32
-    public static function __callStatic($method, $args)
32
+    public static function __callStatic( $method, $args )
33 33
     {
34 34
         $instance = static::getFacadeRoot();
35 35
 
36
-        if (!$instance) {
37
-            throw new RuntimeException('A facade root has not been set.');
36
+        if( !$instance ) {
37
+            throw new RuntimeException( 'A facade root has not been set.' );
38 38
         }
39 39
 
40
-        return $instance->$method(...$args);
40
+        return $instance->$method( ...$args );
41 41
     }
42 42
 
43 43
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public static function getFacadeRoot()
69 69
     {
70
-        return static::resolveFacadeInstance(static::getFacadeAccessor());
70
+        return static::resolveFacadeInstance( static::getFacadeAccessor() );
71 71
     }
72 72
 
73 73
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @return void
77 77
      */
78
-    public static function setFacadeApplication(Application $app)
78
+    public static function setFacadeApplication( Application $app )
79 79
     {
80 80
         static::$app = $app;
81 81
     }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected static function getFacadeAccessor()
91 91
     {
92
-        throw new RuntimeException('Facade does not implement getFacadeAccessor method.');
92
+        throw new RuntimeException( 'Facade does not implement getFacadeAccessor method.' );
93 93
     }
94 94
 
95 95
     /**
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
      *
100 100
      * @return mixed
101 101
      */
102
-    protected static function resolveFacadeInstance($name)
102
+    protected static function resolveFacadeInstance( $name )
103 103
     {
104
-        if (is_object($name)) {
104
+        if( is_object( $name ) ) {
105 105
             return $name;
106 106
         }
107 107
 
108
-        if (isset(static::$resolvedInstance[$name])) {
108
+        if( isset( static::$resolvedInstance[$name] ) ) {
109 109
             return static::$resolvedInstance[$name];
110 110
         }
111 111
 
112
-        return static::$resolvedInstance[$name] = static::$app->make($name);
112
+        return static::$resolvedInstance[$name] = static::$app->make( $name );
113 113
     }
114 114
 }
Please login to merge, or discard this patch.
src/Container.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public static function getInstance()
39 39
     {
40
-        if (is_null(static::$instance)) {
40
+        if( is_null( static::$instance ) ) {
41 41
             static::$instance = new static();
42 42
         }
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      *
53 53
      * @return mixed
54 54
      */
55
-    public function bind($alias, $concrete)
55
+    public function bind( $alias, $concrete )
56 56
     {
57 57
         $this->services[$alias] = $concrete;
58 58
     }
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return mixed
68 68
      */
69
-    public function make($abstract)
69
+    public function make( $abstract )
70 70
     {
71
-        $service = isset($this->services[$abstract])
71
+        $service = isset( $this->services[$abstract] )
72 72
             ? $this->services[$abstract]
73
-            : $this->addNamespace($abstract);
73
+            : $this->addNamespace( $abstract );
74 74
 
75
-        if (is_callable($service)) {
76
-            return call_user_func_array($service, [$this]);
75
+        if( is_callable( $service ) ) {
76
+            return call_user_func_array( $service, [$this] );
77 77
         }
78
-        if (is_object($service)) {
78
+        if( is_object( $service ) ) {
79 79
             return $service;
80 80
         }
81 81
 
82
-        return $this->resolve($service);
82
+        return $this->resolve( $service );
83 83
     }
84 84
 
85 85
     /**
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return void
92 92
      */
93
-    public function singleton($abstract, $concrete)
93
+    public function singleton( $abstract, $concrete )
94 94
     {
95
-        $this->bind($abstract, $this->make($concrete));
95
+        $this->bind( $abstract, $this->make( $concrete ) );
96 96
     }
97 97
 
98 98
     /**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return mixed
104 104
      */
105
-    public function __get($item)
105
+    public function __get( $item )
106 106
     {
107
-        return isset($this->bucket[$item])
107
+        return isset( $this->bucket[$item] )
108 108
             ? $this->bucket[$item]
109 109
             : null;
110 110
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @return void
119 119
      */
120
-    public function __set($item, $value)
120
+    public function __set( $item, $value )
121 121
     {
122 122
         $this->bucket[$item] = $value;
123 123
     }
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
      *
130 130
      * @return string
131 131
      */
132
-    protected function addNamespace($abstract)
132
+    protected function addNamespace( $abstract )
133 133
     {
134
-        if (false === strpos($abstract, __NAMESPACE__) && !class_exists($abstract)) {
134
+        if( false === strpos( $abstract, __NAMESPACE__ ) && !class_exists( $abstract ) ) {
135 135
             $abstract = __NAMESPACE__."\\$abstract";
136 136
         }
137 137
 
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
      * @return void
147 147
      * @throws BindingResolutionException
148 148
      */
149
-    protected function notInstantiable($concrete)
149
+    protected function notInstantiable( $concrete )
150 150
     {
151 151
         $message = "Target [$concrete] is not instantiable.";
152 152
 
153
-        throw new BindingResolutionException($message);
153
+        throw new BindingResolutionException( $message );
154 154
     }
155 155
 
156 156
     /**
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
      * @return mixed
162 162
      * @throws BindingResolutionException
163 163
      */
164
-    protected function resolve($concrete)
164
+    protected function resolve( $concrete )
165 165
     {
166
-        if ($concrete instanceof Closure) {
167
-            return $concrete($this);
166
+        if( $concrete instanceof Closure ) {
167
+            return $concrete( $this );
168 168
         }
169 169
 
170
-        $reflector = new ReflectionClass($concrete);
170
+        $reflector = new ReflectionClass( $concrete );
171 171
 
172
-        if (!$reflector->isInstantiable()) {
173
-            return $this->notInstantiable($concrete);
172
+        if( !$reflector->isInstantiable() ) {
173
+            return $this->notInstantiable( $concrete );
174 174
         }
175 175
 
176
-        if (is_null(($constructor = $reflector->getConstructor()))) {
176
+        if( is_null( ( $constructor = $reflector->getConstructor() ) ) ) {
177 177
             return new $concrete();
178 178
         }
179 179
 
180 180
         return $reflector->newInstanceArgs(
181
-            $this->resolveDependencies($constructor->getParameters())
181
+            $this->resolveDependencies( $constructor->getParameters() )
182 182
         );
183 183
     }
184 184
 
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
      * @return mixed
189 189
      * @throws BindingResolutionException
190 190
      */
191
-    protected function resolveClass(ReflectionParameter $parameter)
191
+    protected function resolveClass( ReflectionParameter $parameter )
192 192
     {
193 193
         try {
194
-            return $this->make($parameter->getClass()->name);
195
-        } catch (BindingResolutionException $e) {
196
-            if ($parameter->isOptional()) {
194
+            return $this->make( $parameter->getClass()->name );
195
+        } catch( BindingResolutionException $e ) {
196
+            if( $parameter->isOptional() ) {
197 197
                 return $parameter->getDefaultValue();
198 198
             }
199 199
             throw $e;
@@ -205,14 +205,14 @@  discard block
 block discarded – undo
205 205
      *
206 206
      * @return array
207 207
      */
208
-    protected function resolveDependencies(array $dependencies)
208
+    protected function resolveDependencies( array $dependencies )
209 209
     {
210 210
         $results = [];
211 211
 
212
-        foreach ($dependencies as $dependency) {
212
+        foreach( $dependencies as $dependency ) {
213 213
             // If the class is null, the dependency is a string or some other primitive type
214
-            $results[] = !is_null($class = $dependency->getClass())
215
-                ? $this->resolveClass($dependency)
214
+            $results[] = !is_null( $class = $dependency->getClass() )
215
+                ? $this->resolveClass( $dependency )
216 216
                 : null;
217 217
         }
218 218
 
Please login to merge, or discard this patch.
src/Gallery.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     protected $theme;
19 19
     protected $utility;
20 20
 
21
-    public function __construct(Image $image, PostMeta $postmeta, Theme $theme, Utility $utility)
21
+    public function __construct( Image $image, PostMeta $postmeta, Theme $theme, Utility $utility )
22 22
     {
23 23
         $this->image = $image;
24 24
         $this->postmeta = $postmeta;
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * @return static
31 31
      */
32
-    public function get(array $args = [])
32
+    public function get( array $args = [] )
33 33
     {
34
-        $this->normalizeArgs($args);
34
+        $this->normalizeArgs( $args );
35 35
 
36
-        $this->gallery = new WP_Query([
36
+        $this->gallery = new WP_Query( [
37 37
             'orderby' => 'post__in',
38 38
             'paged' => $this->getPaged(),
39 39
             'post__in' => $this->args['media'],
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             'post_type' => 'attachment',
42 42
             'post_status' => 'inherit',
43 43
             'posts_per_page' => $this->args['images_per_page'],
44
-        ]);
44
+        ] );
45 45
         return $this;
46 46
     }
47 47
 
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function render()
52 52
     {
53
-        if (empty($this->args['media'])) {
53
+        if( empty( $this->args['media'] ) ) {
54 54
             return;
55 55
         }
56
-        $images = array_reduce($this->gallery->posts, function ($images, $attachment) {
57
-            return $images.$this->renderImage($attachment);
56
+        $images = array_reduce( $this->gallery->posts, function( $images, $attachment ) {
57
+            return $images.$this->renderImage( $attachment );
58 58
         });
59
-        return sprintf('<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>%s',
59
+        return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>%s',
60 60
             $images,
61 61
             $this->renderPagination()
62 62
         );
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
     /**
66 66
      * @return string|null
67 67
      */
68
-    public function renderImage(WP_Post $attachment)
68
+    public function renderImage( WP_Post $attachment )
69 69
     {
70
-        $image = $this->image->get($attachment->ID)->image;
70
+        $image = $this->image->get( $attachment->ID )->image;
71 71
 
72
-        if (!$image) {
72
+        if( !$image ) {
73 73
             return;
74 74
         }
75 75
         return sprintf(
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
             '</figure>',
79 79
             $image->thumbnail['width'],
80 80
             $image->thumbnail['height'],
81
-            $this->getPhotoswipeData($image),
82
-            $this->renderImageTag($image),
83
-            $this->renderImageCaption($image)
81
+            $this->getPhotoswipeData( $image ),
82
+            $this->renderImageTag( $image ),
83
+            $this->renderImageCaption( $image )
84 84
         );
85 85
     }
86 86
 
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function renderPagination()
91 91
     {
92
-        if (!$this->args['pagination']) {
92
+        if( !$this->args['pagination'] ) {
93 93
             return;
94 94
         }
95
-        return paginate_links([
96
-            'before_page_number' => '<span class="screen-reader-text">'.__('Page', 'castor').' </span>',
95
+        return paginate_links( [
96
+            'before_page_number' => '<span class="screen-reader-text">'.__( 'Page', 'castor' ).' </span>',
97 97
             'current' => $this->gallery->query['paged'],
98 98
             'mid_size' => 1,
99
-            'next_text' => __('Next', 'castor'),
100
-            'prev_text' => __('Previous', 'castor'),
99
+            'next_text' => __( 'Next', 'castor' ),
100
+            'prev_text' => __( 'Previous', 'castor' ),
101 101
             'total' => $this->gallery->max_num_pages,
102
-        ]);
102
+        ] );
103 103
     }
104 104
 
105 105
     /**
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
      *
109 109
      * @return bool
110 110
      */
111
-    protected function getBoolValue($key, $value = null)
111
+    protected function getBoolValue( $key, $value = null )
112 112
     {
113
-        $bool = $this->getValue($key, $value);
113
+        $bool = $this->getValue( $key, $value );
114 114
 
115
-        if (is_null(filter_var($bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
116
-            $bool = $this->postmeta->get($bool);
115
+        if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ) ) ) {
116
+            $bool = $this->postmeta->get( $bool );
117 117
         }
118
-        return wp_validate_boolean($bool);
118
+        return wp_validate_boolean( $bool );
119 119
     }
120 120
 
121 121
     /**
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
      *
124 124
      * @return int
125 125
      */
126
-    protected function getGalleryArg($value = null)
126
+    protected function getGalleryArg( $value = null )
127 127
     {
128
-        $gallery = $this->getValue('gallery', $value);
128
+        $gallery = $this->getValue( 'gallery', $value );
129 129
 
130
-        if (!is_numeric($gallery) && is_string($gallery)) {
131
-            $gallery = intval($this->postmeta->get($gallery));
130
+        if( !is_numeric( $gallery ) && is_string( $gallery ) ) {
131
+            $gallery = intval( $this->postmeta->get( $gallery ) );
132 132
         }
133
-        return !is_null(get_post($gallery))
134
-            ? intval($gallery)
133
+        return !is_null( get_post( $gallery ) )
134
+            ? intval( $gallery )
135 135
             : 0;
136 136
     }
137 137
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @return int
142 142
      */
143
-    protected function getImagesPerPageArg($value = null)
143
+    protected function getImagesPerPageArg( $value = null )
144 144
     {
145
-        $perPage = $this->getValue('images_per_page', $value);
145
+        $perPage = $this->getValue( 'images_per_page', $value );
146 146
 
147
-        if (!is_numeric($perPage) && is_string($perPage)) {
148
-            $perPage = $this->postmeta->get($perPage);
147
+        if( !is_numeric( $perPage ) && is_string( $perPage ) ) {
148
+            $perPage = $this->postmeta->get( $perPage );
149 149
         }
150
-        return (bool) intval($perPage)
150
+        return (bool) intval( $perPage )
151 151
             ? $perPage
152 152
             : -1;
153 153
     }
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
      *
158 158
      * @return bool
159 159
      */
160
-    protected function getLazyloadArg($value = null)
160
+    protected function getLazyloadArg( $value = null )
161 161
     {
162
-        return $this->getBoolValue('lazyload', $value);
162
+        return $this->getBoolValue( 'lazyload', $value );
163 163
     }
164 164
 
165 165
     /**
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @return array
169 169
      */
170
-    protected function getMediaArg($value = null)
170
+    protected function getMediaArg( $value = null )
171 171
     {
172
-        $media = $this->getValue('media', $value);
172
+        $media = $this->getValue( 'media', $value );
173 173
 
174
-        if (is_string($media)) {
175
-            $media = $this->postmeta->get($media, [
174
+        if( is_string( $media ) ) {
175
+            $media = $this->postmeta->get( $media, [
176 176
                 'ID' => $this->getGalleryArg(),
177 177
                 'single' => false,
178
-            ]);
178
+            ] );
179 179
         }
180
-        return is_array($media)
181
-            ? wp_parse_id_list($media)
180
+        return is_array( $media )
181
+            ? wp_parse_id_list( $media )
182 182
             : [];
183 183
     }
184 184
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     protected function getPaged()
189 189
     {
190
-        return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1;
190
+        return intval( get_query_var( ( is_front_page() ? 'page' : 'paged' ) ) ) ?: 1;
191 191
     }
192 192
 
193 193
     /**
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
      *
196 196
      * @return bool
197 197
      */
198
-    protected function getPaginationArg($value = null)
198
+    protected function getPaginationArg( $value = null )
199 199
     {
200
-        return $this->getBoolValue('pagination', $value);
200
+        return $this->getBoolValue( 'pagination', $value );
201 201
     }
202 202
 
203 203
     /**
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
      *
206 206
      * @return bool
207 207
      */
208
-    protected function getPermalinksArg($value = null)
208
+    protected function getPermalinksArg( $value = null )
209 209
     {
210
-        return $this->getBoolValue('permalinks', $value);
210
+        return $this->getBoolValue( 'permalinks', $value );
211 211
     }
212 212
 
213 213
     /**
214 214
      * @return string
215 215
      */
216
-    protected function getPhotoswipeData($image)
216
+    protected function getPhotoswipeData( $image )
217 217
     {
218
-        return sprintf('{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
218
+        return sprintf( '{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
219 219
             $image->large['url'],
220 220
             $image->large['width'],
221 221
             $image->large['height'],
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return mixed
233 233
      */
234
-    protected function getValue($key, $value = null)
234
+    protected function getValue( $key, $value = null )
235 235
     {
236
-        if (is_null($value) && isset($this->args[$key])) {
236
+        if( is_null( $value ) && isset( $this->args[$key] ) ) {
237 237
             $value = $this->args[$key];
238 238
         }
239 239
         return $value;
@@ -242,23 +242,23 @@  discard block
 block discarded – undo
242 242
     /**
243 243
      * @return array
244 244
      */
245
-    protected function normalizeArgs(array $args = [])
245
+    protected function normalizeArgs( array $args = [] )
246 246
     {
247 247
         $defaults = [
248
-            'gallery',         // (string) meta_key | (int) post_id
249
-            'lazyload',        // (string) meta_key | (bool)
250
-            'media',           // (string) meta_key | (array) post_ids
251
-            'pagination',      // (string) meta_key | (bool)
248
+            'gallery', // (string) meta_key | (int) post_id
249
+            'lazyload', // (string) meta_key | (bool)
250
+            'media', // (string) meta_key | (array) post_ids
251
+            'pagination', // (string) meta_key | (bool)
252 252
             'images_per_page', // (string) meta_key | (int) number
253
-            'permalinks',      // (string) meta_key | (bool)
253
+            'permalinks', // (string) meta_key | (bool)
254 254
         ];
255 255
 
256
-        $this->args = shortcode_atts(array_combine($defaults, $defaults), $args);
256
+        $this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args );
257 257
 
258
-        array_walk($this->args, function (&$value, $key) {
259
-            $method = $this->utility->buildMethodName($key.'_arg');
260
-            if (method_exists($this, $method)) {
261
-                $value = call_user_func([$this, $method], $value);
258
+        array_walk( $this->args, function( &$value, $key ) {
259
+            $method = $this->utility->buildMethodName( $key.'_arg' );
260
+            if( method_exists( $this, $method ) ) {
261
+                $value = call_user_func( [$this, $method], $value );
262 262
             }
263 263
         });
264 264
 
@@ -269,35 +269,35 @@  discard block
 block discarded – undo
269 269
      * @param object $image
270 270
      * @return string|null
271 271
      */
272
-    protected function renderImageCaption($image)
272
+    protected function renderImageCaption( $image )
273 273
     {
274
-        if (!empty($image->copyright)) {
275
-            $image->caption .= sprintf(' <span itemprop="copyrightHolder">%s</span>', $image->copyright);
274
+        if( !empty( $image->copyright ) ) {
275
+            $image->caption .= sprintf( ' <span itemprop="copyrightHolder">%s</span>', $image->copyright );
276 276
         }
277
-        if (empty($image->caption)) {
277
+        if( empty( $image->caption ) ) {
278 278
             return;
279 279
         }
280
-        return sprintf('<figcaption itemprop="caption description">%s</figcaption>', $image->caption);
280
+        return sprintf( '<figcaption itemprop="caption description">%s</figcaption>', $image->caption );
281 281
     }
282 282
 
283 283
     /**
284 284
      * @param object $image
285 285
      * @return string|null
286 286
      */
287
-    protected function renderImageTag($image)
287
+    protected function renderImageTag( $image )
288 288
     {
289 289
         $imgSrc = $this->getLazyloadArg()
290
-            ? $this->theme->imageUri('blank.gif')
290
+            ? $this->theme->imageUri( 'blank.gif' )
291 291
             : $image->thumbnail['url'];
292 292
 
293
-        $imgTag = sprintf('<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
293
+        $imgTag = sprintf( '<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
294 294
             $imgSrc,
295 295
             $image->thumbnail['url'],
296 296
             $image->alt
297 297
         );
298 298
 
299 299
         return $this->getPermalinksArg()
300
-            ? sprintf('<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag)
300
+            ? sprintf( '<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag )
301 301
             : $imgTag;
302 302
     }
303 303
 }
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@  discard block
 block discarded – undo
11 11
 
12 12
     public function __construct()
13 13
     {
14
-        $this->assets = sprintf('%s/assets/', dirname(__DIR__));
14
+        $this->assets = sprintf( '%s/assets/', dirname( __DIR__ ) );
15 15
         Facade::clearResolvedInstances();
16
-        Facade::setFacadeApplication($this);
16
+        Facade::setFacadeApplication( $this );
17 17
         $this->registerAliases();
18 18
         $this->registerBindings();
19 19
     }
20 20
 
21 21
     public function init()
22 22
     {
23
-        $controller = $this->make('Controller');
23
+        $controller = $this->make( 'Controller' );
24 24
 
25 25
         // Action hooks
26
-        add_action('after_setup_theme', [$controller, 'afterSetupTheme'], 20);
27
-        add_action('login_head', [$controller, 'loadAdminFavicon']);
28
-        add_action('admin_head', [$controller, 'loadAdminFavicon']);
29
-        add_action('login_head', [$controller, 'login']);
30
-        add_action('admin_enqueue_scripts', [$controller, 'registerAdminAssets']);
31
-        add_action('wp_enqueue_scripts', [$controller, 'registerAssets']);
32
-        add_action('customize_register', [$controller, 'registerCustomizer']);
33
-        add_action('customize_preview_init', [$controller, 'registerCustomizerAssets']);
34
-        add_action('widgets_init', [$controller, 'registerSidebars']);
26
+        add_action( 'after_setup_theme', [$controller, 'afterSetupTheme'], 20 );
27
+        add_action( 'login_head', [$controller, 'loadAdminFavicon'] );
28
+        add_action( 'admin_head', [$controller, 'loadAdminFavicon'] );
29
+        add_action( 'login_head', [$controller, 'login'] );
30
+        add_action( 'admin_enqueue_scripts', [$controller, 'registerAdminAssets'] );
31
+        add_action( 'wp_enqueue_scripts', [$controller, 'registerAssets'] );
32
+        add_action( 'customize_register', [$controller, 'registerCustomizer'] );
33
+        add_action( 'customize_preview_init', [$controller, 'registerCustomizerAssets'] );
34
+        add_action( 'widgets_init', [$controller, 'registerSidebars'] );
35 35
 
36 36
         // Filter hooks
37
-        add_filter('body_class', [$controller, 'filterBodyClasses']);
38
-        add_filter('template_include', [$controller, 'filterTemplate']);
39
-        add_filter('login_headertext', [$controller, 'filterLoginTitle']);
40
-        add_filter('login_headerurl', [$controller, 'filterLoginUrl']);
37
+        add_filter( 'body_class', [$controller, 'filterBodyClasses'] );
38
+        add_filter( 'template_include', [$controller, 'filterTemplate'] );
39
+        add_filter( 'login_headertext', [$controller, 'filterLoginTitle'] );
40
+        add_filter( 'login_headerurl', [$controller, 'filterLoginUrl'] );
41 41
 
42
-        foreach ($this->getTemplateTypes() as $type) {
43
-            add_filter("{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy']);
42
+        foreach( $this->getTemplateTypes() as $type ) {
43
+            add_filter( "{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy'] );
44 44
         }
45 45
     }
46 46
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
             'Theme' => Facades\Theme::class,
61 61
             'Utility' => Facades\Utility::class,
62 62
         ];
63
-        $aliases = apply_filters('castor/register/aliases', $aliases);
64
-        AliasLoader::getInstance($aliases)->register();
63
+        $aliases = apply_filters( 'castor/register/aliases', $aliases );
64
+        AliasLoader::getInstance( $aliases )->register();
65 65
     }
66 66
 
67 67
     /**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function registerBindings()
71 71
     {
72
-        $this->bind(Helpers\Log::class, function () {
73
-            return new Helpers\Log(trailingslashit(get_stylesheet_directory()).'castor-debug.log');
72
+        $this->bind( Helpers\Log::class, function() {
73
+            return new Helpers\Log( trailingslashit( get_stylesheet_directory() ).'castor-debug.log' );
74 74
         });
75 75
     }
76 76
 
Please login to merge, or discard this patch.
src/Oembed.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -22,73 +22,73 @@
 block discarded – undo
22 22
         'width',
23 23
     ];
24 24
 
25
-    public function __construct(Utility $utility)
25
+    public function __construct( Utility $utility )
26 26
     {
27 27
         $this->oembed = _wp_oembed_get_object();
28 28
         $this->utility = $utility;
29 29
     }
30 30
 
31
-    public function request($url, $args = '')
31
+    public function request( $url, $args = '' )
32 32
     {
33
-        $args = wp_parse_args($args, [
33
+        $args = wp_parse_args( $args, [
34 34
             'embed_type' => '',
35
-        ]);
36
-        $request = $this->oembed->fetch($this->oembed->get_provider($url), $url, [
35
+        ] );
36
+        $request = $this->oembed->fetch( $this->oembed->get_provider( $url ), $url, [
37 37
             'width' => 1280,
38 38
             'height' => 1280,
39
-        ]);
40
-        if (false === $request) {
39
+        ] );
40
+        if( false === $request ) {
41 41
             return;
42 42
         }
43
-        if (!empty($args['embed_type']) && $args['embed_type'] != $request->type) {
43
+        if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type ) {
44 44
             return;
45 45
         }
46
-        return $this->modifyRequest($request, $args);
46
+        return $this->modifyRequest( $request, $args );
47 47
     }
48 48
 
49
-    protected function domLoad($html)
49
+    protected function domLoad( $html )
50 50
     {
51 51
         $dom = new DomDocument();
52
-        $dom->loadHTML($html);
52
+        $dom->loadHTML( $html );
53 53
         return $dom;
54 54
     }
55 55
 
56
-    protected function modifyRequest($request, $args)
56
+    protected function modifyRequest( $request, $args )
57 57
     {
58
-        $providerName = strtolower($request->provider_name);
59
-        $provider = property_exists($this, $providerName)
58
+        $providerName = strtolower( $request->provider_name );
59
+        $provider = property_exists( $this, $providerName )
60 60
             ? $this->$providerName
61 61
             : [];
62 62
 
63
-        $method = $this->utility->buildMethodName($providerName.'_request', 'modify');
63
+        $method = $this->utility->buildMethodName( $providerName.'_request', 'modify' );
64 64
 
65
-        if (method_exists($this, $method)) {
66
-            return call_user_func([$this, $method], $request, array_intersect_key(
65
+        if( method_exists( $this, $method ) ) {
66
+            return call_user_func( [$this, $method], $request, array_intersect_key(
67 67
                 $args,
68
-                array_flip($provider)
69
-            ));
68
+                array_flip( $provider )
69
+            ) );
70 70
         }
71 71
         return $request;
72 72
     }
73 73
 
74
-    protected function modifyYoutubeRequest($request, array $args)
74
+    protected function modifyYoutubeRequest( $request, array $args )
75 75
     {
76
-        $html = $this->domLoad($request->html);
77
-        $node = $html->getElementsByTagName('iframe')->item(0);
78
-        $url = $node->getAttribute('src');
76
+        $html = $this->domLoad( $request->html );
77
+        $node = $html->getElementsByTagName( 'iframe' )->item( 0 );
78
+        $url = $node->getAttribute( 'src' );
79 79
 
80
-        if (isset($args['fs']) && 0 == $args['fs']) {
81
-            $node->removeAttribute('allowfullscreen');
80
+        if( isset( $args['fs'] ) && 0 == $args['fs'] ) {
81
+            $node->removeAttribute( 'allowfullscreen' );
82 82
         }
83 83
 
84
-        $args['origin'] = urlencode(get_bloginfo('url'));
84
+        $args['origin'] = urlencode( get_bloginfo( 'url' ) );
85 85
 
86
-        $node->setAttribute('class', 'video-embed');
87
-        $node->setAttribute('src',
88
-            add_query_arg($args, remove_query_arg('feature', $url))
86
+        $node->setAttribute( 'class', 'video-embed' );
87
+        $node->setAttribute( 'src',
88
+            add_query_arg( $args, remove_query_arg( 'feature', $url ) )
89 89
         );
90 90
 
91
-        $request->html = $html->saveHTML($node);
91
+        $request->html = $html->saveHTML( $node );
92 92
 
93 93
         return $request;
94 94
     }
Please login to merge, or discard this patch.
src/Video.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     protected $theme;
19 19
     protected $utility;
20 20
 
21
-    public function __construct(Image $image, Oembed $oembed, PostMeta $postmeta, Theme $theme, Utility $utility)
21
+    public function __construct( Image $image, Oembed $oembed, PostMeta $postmeta, Theme $theme, Utility $utility )
22 22
     {
23 23
         $this->image = $image;
24 24
         $this->oembed = $oembed;
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
         $this->utility = $utility;
28 28
     }
29 29
 
30
-    public function get($args = [])
30
+    public function get( $args = [] )
31 31
     {
32
-        $args = $this->normalize($args);
33
-        $embed = $this->oembed->request($args['url'], $args['player']);
34
-        if (isset($embed->type) && 'video' == $embed->type) {
32
+        $args = $this->normalize( $args );
33
+        $embed = $this->oembed->request( $args['url'], $args['player'] );
34
+        if( isset( $embed->type ) && 'video' == $embed->type ) {
35 35
             $this->video = $embed;
36 36
         }
37 37
         return $this;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function render()
41 41
     {
42
-        if (!isset($this->video->html)) {
42
+        if( !isset( $this->video->html ) ) {
43 43
             return;
44 44
         }
45 45
         return sprintf(
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
                 '<a href="%s" class="video-play-btn">%s</a>'.
60 60
             '</div>',
61 61
             $this->args['url'],
62
-            $this->theme->svg('play.svg')
62
+            $this->theme->svg( 'play.svg' )
63 63
         );
64 64
     }
65 65
 
66 66
     public function renderScreenshot()
67 67
     {
68
-        if ($this->args['image']
69
-            && in_array(strtolower($this->video->provider_name), $this->supported)) {
70
-            return sprintf('%s<div class="video-poster" style="background-image: url(%s)">%s</div>',
68
+        if( $this->args['image']
69
+            && in_array( strtolower( $this->video->provider_name ), $this->supported ) ) {
70
+            return sprintf( '%s<div class="video-poster" style="background-image: url(%s)">%s</div>',
71 71
                 $this->renderSpinner(),
72 72
                 $this->args['image'],
73 73
                 $this->renderPlayButton()
@@ -81,43 +81,43 @@  discard block
 block discarded – undo
81 81
             '<div class="video-spinner">'.
82 82
                 '<div class="spinner"><div class="spinner-dots">%s</div></div>'.
83 83
             '</div>',
84
-            implode('', array_fill(0, 8, '<div class="spinner-dot"></div>'))
84
+            implode( '', array_fill( 0, 8, '<div class="spinner-dot"></div>' ) )
85 85
         );
86 86
     }
87 87
 
88
-    protected function setImage($image)
88
+    protected function setImage( $image )
89 89
     {
90
-        $image = $this->image->get($image)->image;
91
-        $this->args['image'] = isset($image->large)
90
+        $image = $this->image->get( $image )->image;
91
+        $this->args['image'] = isset( $image->large )
92 92
             ? $image->large['url']
93 93
             : null;
94 94
     }
95 95
 
96
-    protected function setUrl($url)
96
+    protected function setUrl( $url )
97 97
     {
98
-        $this->args['url'] = !filter_var($url, FILTER_VALIDATE_URL)
99
-            ? $this->postmeta->get($url)
98
+        $this->args['url'] = !filter_var( $url, FILTER_VALIDATE_URL )
99
+            ? $this->postmeta->get( $url )
100 100
             : $url;
101 101
     }
102 102
 
103
-    protected function normalize($args)
103
+    protected function normalize( $args )
104 104
     {
105
-        if (is_string($args)) {
105
+        if( is_string( $args ) ) {
106 106
             $args = ['url' => $args];
107 107
         }
108 108
 
109
-        $this->args = shortcode_atts([
109
+        $this->args = shortcode_atts( [
110 110
             'image' => '', // string || int
111 111
             'player' => '', // string || array
112 112
             'url' => '', // string
113
-        ], $args);
113
+        ], $args );
114 114
 
115
-        foreach ($this->args as $key => $value) {
116
-            $method = $this->utility->buildMethodName($key, 'set');
117
-            if (!method_exists($this, $method)) {
115
+        foreach( $this->args as $key => $value ) {
116
+            $method = $this->utility->buildMethodName( $key, 'set' );
117
+            if( !method_exists( $this, $method ) ) {
118 118
                 continue;
119 119
             }
120
-            call_user_func([$this, $method], $value);
120
+            call_user_func( [$this, $method], $value );
121 121
         }
122 122
         return $this->args;
123 123
     }
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,28 +16,28 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function afterSetupTheme()
18 18
     {
19
-        castor_app()->cssDir = trailingslashit((string) apply_filters('castor/assets/styles/dir', 'css'));
20
-        castor_app()->imgDir = trailingslashit((string) apply_filters('castor/assets/images/dir', 'img'));
21
-        castor_app()->jsDir = trailingslashit((string) apply_filters('castor/assets/scripts/dir', 'js'));
22
-
23
-        add_editor_style(Theme::assetUri(castor_app()->cssDir.'editor.css'));
24
-        add_theme_support('customize-selective-refresh-widgets');
25
-        add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
26
-        add_theme_support('post-thumbnails');
27
-        add_theme_support('soil-clean-up');
28
-        add_theme_support('soil-jquery-cdn');
29
-        add_theme_support('soil-nav-walker');
30
-        add_theme_support('soil-nice-search');
31
-        add_theme_support('soil-relative-urls');
32
-        add_theme_support('title-tag');
33
-        load_theme_textdomain('castor', Theme::paths('dir.template').'/languages');
34
-
35
-        $menus = apply_filters('castor/register/nav_menus', [
36
-            'main_menu' => __('Main Menu', 'castor'),
37
-        ]);
38
-
39
-        foreach ($menus as $location => $description) {
40
-            register_nav_menu($location, $description);
19
+        castor_app()->cssDir = trailingslashit( (string) apply_filters( 'castor/assets/styles/dir', 'css' ) );
20
+        castor_app()->imgDir = trailingslashit( (string) apply_filters( 'castor/assets/images/dir', 'img' ) );
21
+        castor_app()->jsDir = trailingslashit( (string) apply_filters( 'castor/assets/scripts/dir', 'js' ) );
22
+
23
+        add_editor_style( Theme::assetUri( castor_app()->cssDir.'editor.css' ) );
24
+        add_theme_support( 'customize-selective-refresh-widgets' );
25
+        add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
26
+        add_theme_support( 'post-thumbnails' );
27
+        add_theme_support( 'soil-clean-up' );
28
+        add_theme_support( 'soil-jquery-cdn' );
29
+        add_theme_support( 'soil-nav-walker' );
30
+        add_theme_support( 'soil-nice-search' );
31
+        add_theme_support( 'soil-relative-urls' );
32
+        add_theme_support( 'title-tag' );
33
+        load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ).'/languages' );
34
+
35
+        $menus = apply_filters( 'castor/register/nav_menus', [
36
+            'main_menu' => __( 'Main Menu', 'castor' ),
37
+        ] );
38
+
39
+        foreach( $menus as $location => $description ) {
40
+            register_nav_menu( $location, $description );
41 41
         }
42 42
     }
43 43
 
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
      * @return array
46 46
      * @filter body_class
47 47
      */
48
-    public function filterBodyClasses(array $classes)
48
+    public function filterBodyClasses( array $classes )
49 49
     {
50
-        if (Theme::displaySidebar()) {
50
+        if( Theme::displaySidebar() ) {
51 51
             $classes[] = 'has-sidebar';
52 52
         }
53
-        return array_keys(array_flip($classes));
53
+        return array_keys( array_flip( $classes ) );
54 54
     }
55 55
 
56 56
     /**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function filterLoginTitle()
61 61
     {
62
-        return get_bloginfo('name');
62
+        return get_bloginfo( 'name' );
63 63
     }
64 64
 
65 65
     /**
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function filterLoginUrl()
70 70
     {
71
-        return get_bloginfo('url');
71
+        return get_bloginfo( 'url' );
72 72
     }
73 73
 
74 74
     /**
75 75
      * @return string
76 76
      * @filter template_include
77 77
      */
78
-    public function filterTemplate($template)
78
+    public function filterTemplate( $template )
79 79
     {
80
-        if (is_string($template)) {
81
-            $template = Template::setLayout($template);
82
-            Development::storeTemplatePath($template);
80
+        if( is_string( $template ) ) {
81
+            $template = Template::setLayout( $template );
82
+            Development::storeTemplatePath( $template );
83 83
         }
84 84
         return $template;
85 85
     }
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
      * @return array
89 89
      * @filter {$type}_template_hierarchy
90 90
      */
91
-    public function filterTemplateHierarchy(array $templates)
91
+    public function filterTemplateHierarchy( array $templates )
92 92
     {
93
-        return array_map(function ($template) {
94
-            return Utility::startWith('templates/', $template);
95
-        }, $templates);
93
+        return array_map( function( $template ) {
94
+            return Utility::startWith( 'templates/', $template );
95
+        }, $templates );
96 96
     }
97 97
 
98 98
     /**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function loadAdminFavicon()
104 104
     {
105
-        if (file_exists(Theme::assetPath('favicon/favicon-admin.ico'))) {
106
-            printf('<link rel="shortcut icon" href="%s">', Theme::assetUri('favicon/favicon-admin.ico'));
105
+        if( file_exists( Theme::assetPath( 'favicon/favicon-admin.ico' ) ) ) {
106
+            printf( '<link rel="shortcut icon" href="%s">', Theme::assetUri( 'favicon/favicon-admin.ico' ) );
107 107
         }
108 108
     }
109 109
 
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function login()
115 115
     {
116
-        if (file_exists(Theme::assetPath(castor_app()->cssDir.'login.css'))) {
117
-            printf('<link rel="stylesheet" href="%s">', Theme::assetUri(castor_app()->cssDir.'login.css'));
116
+        if( file_exists( Theme::assetPath( castor_app()->cssDir.'login.css' ) ) ) {
117
+            printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( castor_app()->cssDir.'login.css' ) );
118 118
         }
119 119
     }
120 120
 
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function registerAdminAssets()
126 126
     {
127
-        if (file_exists(Theme::assetPath(castor_app()->cssDir.'admin.css'))) {
128
-            wp_enqueue_style('castor/admin.css',
129
-                Theme::assetUri(castor_app()->cssDir.'admin.css'),
130
-                apply_filters('castor/enqueue/admin/css/deps', []),
127
+        if( file_exists( Theme::assetPath( castor_app()->cssDir.'admin.css' ) ) ) {
128
+            wp_enqueue_style( 'castor/admin.css',
129
+                Theme::assetUri( castor_app()->cssDir.'admin.css' ),
130
+                apply_filters( 'castor/enqueue/admin/css/deps', [] ),
131 131
                 null
132 132
             );
133 133
         }
134
-        if (file_exists(Theme::assetPath(castor_app()->jsDir.'admin.js'))) {
135
-            wp_enqueue_script('castor/admin.js',
136
-                Theme::assetUri(castor_app()->jsDir.'admin.js'),
137
-                apply_filters('castor/enqueue/admin/js/deps', []),
134
+        if( file_exists( Theme::assetPath( castor_app()->jsDir.'admin.js' ) ) ) {
135
+            wp_enqueue_script( 'castor/admin.js',
136
+                Theme::assetUri( castor_app()->jsDir.'admin.js' ),
137
+                apply_filters( 'castor/enqueue/admin/js/deps', [] ),
138 138
                 null,
139 139
                 true
140 140
             );
@@ -147,40 +147,40 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function registerAssets()
149 149
     {
150
-        wp_register_style('castor/main.css',
151
-            Theme::assetUri(castor_app()->cssDir.'main.css'),
152
-            apply_filters('castor/enqueue/css/deps', []),
150
+        wp_register_style( 'castor/main.css',
151
+            Theme::assetUri( castor_app()->cssDir.'main.css' ),
152
+            apply_filters( 'castor/enqueue/css/deps', [] ),
153 153
             null
154 154
         );
155
-        wp_register_script('castor/main.js',
156
-            Theme::assetUri(castor_app()->jsDir.'main.js'),
157
-            apply_filters('castor/enqueue/js/deps', []),
155
+        wp_register_script( 'castor/main.js',
156
+            Theme::assetUri( castor_app()->jsDir.'main.js' ),
157
+            apply_filters( 'castor/enqueue/js/deps', [] ),
158 158
             null,
159 159
             true
160 160
         );
161
-        wp_localize_script('castor/main.js', apply_filters('castor/enqueue/js/localize/variable', 'globals'),
162
-            apply_filters('castor/enqueue/js/localize/variables', [
163
-                'ajax' => admin_url('admin-ajax.php'),
164
-            ])
161
+        wp_localize_script( 'castor/main.js', apply_filters( 'castor/enqueue/js/localize/variable', 'globals' ),
162
+            apply_filters( 'castor/enqueue/js/localize/variables', [
163
+                'ajax' => admin_url( 'admin-ajax.php' ),
164
+            ] )
165 165
         );
166
-        do_action('castor/register/assets');
167
-        wp_enqueue_style('castor/main.css');
168
-        wp_enqueue_script('castor/main.js');
166
+        do_action( 'castor/register/assets' );
167
+        wp_enqueue_style( 'castor/main.css' );
168
+        wp_enqueue_script( 'castor/main.js' );
169 169
     }
170 170
 
171 171
     /**
172 172
      * @return void
173 173
      * @action customize_register
174 174
      */
175
-    public function registerCustomizer(WP_Customize_Manager $manager)
175
+    public function registerCustomizer( WP_Customize_Manager $manager )
176 176
     {
177
-        $manager->get_setting('blogname')->transport = 'postMessage';
178
-        $manager->selective_refresh->add_partial('blogname', [
177
+        $manager->get_setting( 'blogname' )->transport = 'postMessage';
178
+        $manager->selective_refresh->add_partial( 'blogname', [
179 179
             'selector' => '.brand',
180
-            'render_callback' => function () {
181
-                bloginfo('name');
180
+            'render_callback' => function() {
181
+                bloginfo( 'name' );
182 182
             },
183
-        ]);
183
+        ] );
184 184
     }
185 185
 
186 186
     /**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function registerCustomizerAssets()
191 191
     {
192
-        wp_enqueue_script('castor/customizer.js', Theme::assetUri(castor_app()->jsDir.'customizer.js'), ['customize-preview'], null, true);
192
+        wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( castor_app()->jsDir.'customizer.js' ), ['customize-preview'], null, true );
193 193
     }
194 194
 
195 195
     /**
@@ -198,23 +198,23 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public function registerSidebars()
200 200
     {
201
-        $defaults = apply_filters('castor/register/sidebars/defaults', [
201
+        $defaults = apply_filters( 'castor/register/sidebars/defaults', [
202 202
             'before_widget' => '<div class="widget %1$s %2$s">',
203 203
             'after_widget' => '</div>',
204 204
             'before_title' => '<h4>',
205 205
             'after_title' => '</h4>',
206
-        ]);
206
+        ] );
207 207
 
208
-        $sidebars = apply_filters('castor/register/sidebars', [
209
-            'sidebar-primary' => __('Primary Sidebar', 'castor'),
210
-            'sidebar-footer' => __('Footer Widgets', 'castor'),
211
-        ]);
208
+        $sidebars = apply_filters( 'castor/register/sidebars', [
209
+            'sidebar-primary' => __( 'Primary Sidebar', 'castor' ),
210
+            'sidebar-footer' => __( 'Footer Widgets', 'castor' ),
211
+        ] );
212 212
 
213
-        foreach ($sidebars as $id => $name) {
214
-            register_sidebar([
213
+        foreach( $sidebars as $id => $name ) {
214
+            register_sidebar( [
215 215
                 'id' => $id,
216 216
                 'name' => $name,
217
-            ] + $defaults);
217
+            ] + $defaults );
218 218
         }
219 219
     }
220 220
 }
Please login to merge, or discard this patch.