Completed
Push — develop ( 13bd87...d494ed )
by Paul
02:08
created
src/Facades/PostMeta.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 class PostMeta extends Facade
8 8
 {
9
-    /**
10
-     * Get the fully qualified class name of the component.
11
-     *
12
-     * @return string
13
-     */
14
-    protected static function getFacadeAccessor()
15
-    {
16
-        return \GeminiLabs\Castor\Helpers\PostMeta::class;
17
-    }
9
+	/**
10
+	 * Get the fully qualified class name of the component.
11
+	 *
12
+	 * @return string
13
+	 */
14
+	protected static function getFacadeAccessor()
15
+	{
16
+		return \GeminiLabs\Castor\Helpers\PostMeta::class;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Facades/Media.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 class Media extends Facade
8 8
 {
9
-    /**
10
-     * Get the fully qualified class name of the component.
11
-     *
12
-     * @return string
13
-     */
14
-    protected static function getFacadeAccessor()
15
-    {
16
-        return \GeminiLabs\Castor\Helpers\Media::class;
17
-    }
9
+	/**
10
+	 * Get the fully qualified class name of the component.
11
+	 *
12
+	 * @return string
13
+	 */
14
+	protected static function getFacadeAccessor()
15
+	{
16
+		return \GeminiLabs\Castor\Helpers\Media::class;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,29 +11,29 @@  discard block
 block discarded – undo
11 11
 	public function __construct()
12 12
 	{
13 13
 		Facade::clearResolvedInstances();
14
-		Facade::setFacadeApplication( $this );
14
+		Facade::setFacadeApplication($this);
15 15
 		$this->registerAliases();
16 16
 	}
17 17
 
18 18
 	public function init()
19 19
 	{
20
-		$controller = $this->make( 'Controller' );
20
+		$controller = $this->make('Controller');
21 21
 
22 22
 		// Action hooks
23
-		add_action( 'after_setup_theme',      [$controller, 'afterSetupTheme'], 20 );
24
-		add_action( 'login_head',             [$controller, 'login'] );
25
-		add_action( 'wp_enqueue_scripts',     [$controller, 'registerAssets'] );
26
-		add_action( 'customize_register',     [$controller, 'registerCustomizer'] );
27
-		add_action( 'customize_preview_init', [$controller, 'registerCustomizerAssets'] );
28
-		add_action( 'widgets_init',           [$controller, 'registerSidebars'] );
23
+		add_action('after_setup_theme', [$controller, 'afterSetupTheme'], 20);
24
+		add_action('login_head', [$controller, 'login']);
25
+		add_action('wp_enqueue_scripts', [$controller, 'registerAssets']);
26
+		add_action('customize_register', [$controller, 'registerCustomizer']);
27
+		add_action('customize_preview_init', [$controller, 'registerCustomizerAssets']);
28
+		add_action('widgets_init', [$controller, 'registerSidebars']);
29 29
 
30 30
 		// Filter hooks
31
-		add_filter( 'template_include',       [$controller, 'filterTemplate'] );
32
-		add_filter( 'login_headertitle',      [$controller, 'filterLoginTitle'] );
33
-		add_filter( 'login_headerurl',        [$controller, 'filterLoginUrl'] );
31
+		add_filter('template_include', [$controller, 'filterTemplate']);
32
+		add_filter('login_headertitle', [$controller, 'filterLoginTitle']);
33
+		add_filter('login_headerurl', [$controller, 'filterLoginUrl']);
34 34
 
35
-		foreach( $this->getTemplateTypes() as $type ) {
36
-			add_filter( "{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy'] );
35
+		foreach ($this->getTemplateTypes() as $type) {
36
+			add_filter("{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy']);
37 37
 		}
38 38
 	}
39 39
 
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 			'Utility'     => Facades\Utility::class,
52 52
 		];
53 53
 
54
-		$aliases = apply_filters( 'castor/register/aliases', $aliases );
54
+		$aliases = apply_filters('castor/register/aliases', $aliases);
55 55
 
56
-		AliasLoader::getInstance( $aliases )->register();
56
+		AliasLoader::getInstance($aliases)->register();
57 57
 	}
58 58
 
59 59
 	/**
Please login to merge, or discard this patch.
src/Controller.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@  discard block
 block discarded – undo
16 16
 	 */
17 17
 	public function afterSetupTheme()
18 18
 	{
19
-		add_editor_style( Theme::assetUri( 'css/editor.css' ));
20
-		add_theme_support( 'customize-selective-refresh-widgets' );
21
-		add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] );
22
-		add_theme_support( 'post-thumbnails' );
23
-		add_theme_support( 'soil-clean-up' );
24
-		add_theme_support( 'soil-jquery-cdn' );
25
-		add_theme_support( 'soil-nav-walker' );
26
-		add_theme_support( 'soil-nice-search' );
27
-		add_theme_support( 'soil-relative-urls' );
28
-		add_theme_support( 'title-tag' );
29
-		load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' );
30
-
31
-		$menus = apply_filters( 'castor/register/nav_menus', [
32
-			'main_menu' => __( 'Main Menu', 'castor' ),
19
+		add_editor_style(Theme::assetUri('css/editor.css'));
20
+		add_theme_support('customize-selective-refresh-widgets');
21
+		add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']);
22
+		add_theme_support('post-thumbnails');
23
+		add_theme_support('soil-clean-up');
24
+		add_theme_support('soil-jquery-cdn');
25
+		add_theme_support('soil-nav-walker');
26
+		add_theme_support('soil-nice-search');
27
+		add_theme_support('soil-relative-urls');
28
+		add_theme_support('title-tag');
29
+		load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages');
30
+
31
+		$menus = apply_filters('castor/register/nav_menus', [
32
+			'main_menu' => __('Main Menu', 'castor'),
33 33
 		]);
34 34
 
35
-		foreach( $menus as $location => $description ) {
36
-			register_nav_menu( $location, $description );
35
+		foreach ($menus as $location => $description) {
36
+			register_nav_menu($location, $description);
37 37
 		}
38 38
 	}
39 39
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function filterLoginTitle()
45 45
 	{
46
-		return get_bloginfo( 'name' );
46
+		return get_bloginfo('name');
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function filterLoginUrl()
54 54
 	{
55
-		return get_bloginfo( 'url' );
55
+		return get_bloginfo('url');
56 56
 	}
57 57
 
58 58
 	/**
59 59
 	 * @return string
60 60
 	 * @filter template_include
61 61
 	 */
62
-	public function filterTemplate( $template )
62
+	public function filterTemplate($template)
63 63
 	{
64
-		if( is_string( $template )) {
65
-			$template = Template::setLayout( $template );
66
-			Development::storeTemplatePath( $template );
64
+		if (is_string($template)) {
65
+			$template = Template::setLayout($template);
66
+			Development::storeTemplatePath($template);
67 67
 		}
68 68
 		return $template;
69 69
 	}
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 	 * @return array
73 73
 	 * @filter {$type}_template_hierarchy
74 74
 	 */
75
-	public function filterTemplateHierarchy( array $templates )
75
+	public function filterTemplateHierarchy(array $templates)
76 76
 	{
77
-		return array_map( function( $template ) {
78
-			return Utility::startWith( 'templates/', $template );
79
-		}, $templates );
77
+		return array_map(function($template) {
78
+			return Utility::startWith('templates/', $template);
79
+		}, $templates);
80 80
 	}
81 81
 
82 82
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function login()
87 87
 	{
88
-		if( file_exists( Theme::assetPath( 'css/login.css' ))) {
89
-			printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' ));
88
+		if (file_exists(Theme::assetPath('css/login.css'))) {
89
+			printf('<link rel="stylesheet" href="%s">', Theme::assetUri('css/login.css'));
90 90
 		}
91 91
 	}
92 92
 
@@ -96,21 +96,21 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function registerAssets()
98 98
 	{
99
-		wp_enqueue_style( 'castor/main.css', Theme::assetUri( 'css/main.css' ), [], null );
100
-		wp_enqueue_script( 'castor/main.js', Theme::assetUri( 'js/main.js' ), [], null, true );
99
+		wp_enqueue_style('castor/main.css', Theme::assetUri('css/main.css'), [], null);
100
+		wp_enqueue_script('castor/main.js', Theme::assetUri('js/main.js'), [], null, true);
101 101
 	}
102 102
 
103 103
 	/**
104 104
 	 * @return void
105 105
 	 * @action customize_register
106 106
 	 */
107
-	public function registerCustomizer( WP_Customize_Manager $manager )
107
+	public function registerCustomizer(WP_Customize_Manager $manager)
108 108
 	{
109
-		$manager->get_setting( 'blogname' )->transport = 'postMessage';
110
-		$manager->selective_refresh->add_partial( 'blogname', [
109
+		$manager->get_setting('blogname')->transport = 'postMessage';
110
+		$manager->selective_refresh->add_partial('blogname', [
111 111
 			'selector'        => '.brand',
112 112
 			'render_callback' => function() {
113
-				bloginfo( 'name' );
113
+				bloginfo('name');
114 114
 			},
115 115
 		]);
116 116
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function registerCustomizerAssets()
123 123
 	{
124
-		wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true );
124
+		wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true);
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function registerSidebars()
132 132
 	{
133
-		$defaults = apply_filters( 'castor/register/sidebars/defaults', [
133
+		$defaults = apply_filters('castor/register/sidebars/defaults', [
134 134
 			'before_widget' => '<div class="widget %1$s %2$s">',
135 135
 			'after_widget'  => '</div>',
136 136
 			'before_title'  => '<h4>',
137 137
 			'after_title'   => '</h4>',
138 138
 		]);
139 139
 
140
-		$sidebars = apply_filters( 'castor/register/sidebars', [
141
-			'sidebar-primary' => __( 'Primary Sidebar', 'castor' ),
142
-			'sidebar-footer'  => __( 'Footer Sidebar', 'castor' ),
140
+		$sidebars = apply_filters('castor/register/sidebars', [
141
+			'sidebar-primary' => __('Primary Sidebar', 'castor'),
142
+			'sidebar-footer'  => __('Footer Sidebar', 'castor'),
143 143
 		]);
144 144
 
145
-		foreach( $sidebars as $id => $name ) {
145
+		foreach ($sidebars as $id => $name) {
146 146
 			register_sidebar([
147 147
 				'id'   => $id,
148 148
 				'name' => $name,
149
-			] + $defaults );
149
+			] + $defaults);
150 150
 		}
151 151
 	}
152 152
 }
Please login to merge, or discard this patch.
src/Gallery.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,9 @@  discard block
 block discarded – undo
61 61
 	public function renderImage( WP_Post $attachment )
62 62
 	{
63 63
 		$image = $this->image->get( $attachment->ID );
64
-		if( !$image )return;
64
+		if( !$image ) {
65
+			return;
66
+		}
65 67
 		return sprintf(
66 68
 			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
67 69
 				'%s<figcaption itemprop="caption description">' .
@@ -82,7 +84,9 @@  discard block
 block discarded – undo
82 84
 	 */
83 85
 	public function renderPagination( WP_Query $query )
84 86
 	{
85
-		if( !$this->args['pagination'] )return;
87
+		if( !$this->args['pagination'] ) {
88
+			return;
89
+		}
86 90
 		return paginate_links([
87 91
 			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
88 92
 			'current'            => $query->query['paged'],
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected $args;
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,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	/**
30 30
 	 * @return WP_Query
31 31
 	 */
32
-	public function query( array $args = [] )
32
+	public function query(array $args = [])
33 33
 	{
34
-		$this->normalizeArgs( $args );
34
+		$this->normalizeArgs($args);
35 35
 
36 36
 		return new WP_Query([
37 37
 			'orderby'        => 'post__in',
@@ -47,21 +47,21 @@  discard block
 block discarded – undo
47 47
 	/**
48 48
 	 * @return string
49 49
 	 */
50
-	public function render( WP_Query $gallery )
50
+	public function render(WP_Query $gallery)
51 51
 	{
52
-		$images = array_reduce( $gallery->posts, function( $images, $attachment ) {
53
-			return $images . $this->renderImage( $attachment );
52
+		$images = array_reduce($gallery->posts, function($images, $attachment) {
53
+			return $images . $this->renderImage($attachment);
54 54
 		});
55
-		return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images );
55
+		return sprintf('<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images);
56 56
 	}
57 57
 
58 58
 	/**
59 59
 	 * @return null|string
60 60
 	 */
61
-	public function renderImage( WP_Post $attachment )
61
+	public function renderImage(WP_Post $attachment)
62 62
 	{
63
-		$image = $this->image->get( $attachment->ID );
64
-		if( !$image )return;
63
+		$image = $this->image->get($attachment->ID);
64
+		if (!$image)return;
65 65
 		return sprintf(
66 66
 			'<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' .
67 67
 				'%s<figcaption itemprop="caption description">' .
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 			'</figure>',
71 71
 			$image->thumbnail['width'],
72 72
 			$image->thumbnail['height'],
73
-			$this->getPhotoswipeData( $image ),
74
-			$this->renderImageTag( $image ),
73
+			$this->getPhotoswipeData($image),
74
+			$this->renderImageTag($image),
75 75
 			$image->caption,
76 76
 			$image->copyright
77 77
 		);
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	/**
81 81
 	 * @return null|string
82 82
 	 */
83
-	public function renderPagination( WP_Query $query )
83
+	public function renderPagination(WP_Query $query)
84 84
 	{
85
-		if( !$this->args['pagination'] )return;
85
+		if (!$this->args['pagination'])return;
86 86
 		return paginate_links([
87
-			'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>',
87
+			'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'castor') . ' </span>',
88 88
 			'current'            => $query->query['paged'],
89 89
 			'mid_size'           => 1,
90
-			'next_text'          => __( 'Next', 'castor' ),
91
-			'prev_text'          => __( 'Previous', 'castor' ),
90
+			'next_text'          => __('Next', 'castor'),
91
+			'prev_text'          => __('Previous', 'castor'),
92 92
 			'total'              => $query->max_num_pages,
93 93
 		]);
94 94
 	}
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return bool
101 101
 	 */
102
-	protected function getBoolValue( $key, $value = null )
102
+	protected function getBoolValue($key, $value = null)
103 103
 	{
104
-		$bool = $this->getValue( $key, $value );
104
+		$bool = $this->getValue($key, $value);
105 105
 
106
-		if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ))) {
107
-			$bool = $this->postmeta->get( $bool );
106
+		if (is_null(filter_var($bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) {
107
+			$bool = $this->postmeta->get($bool);
108 108
 		}
109
-		return wp_validate_boolean( $bool );
109
+		return wp_validate_boolean($bool);
110 110
 	}
111 111
 
112 112
 	/**
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return int
116 116
 	 */
117
-	protected function getGalleryArg( $value = null )
117
+	protected function getGalleryArg($value = null)
118 118
 	{
119
-		$gallery = $this->getValue( 'gallery', $value );
119
+		$gallery = $this->getValue('gallery', $value);
120 120
 
121
-		if( !is_numeric( $gallery ) && is_string( $gallery )) {
122
-			$gallery = intval( $this->postmeta->get( $gallery ));
121
+		if (!is_numeric($gallery) && is_string($gallery)) {
122
+			$gallery = intval($this->postmeta->get($gallery));
123 123
 		}
124
-		return !is_null( get_post( $gallery ))
125
-			? intval( $gallery )
124
+		return !is_null(get_post($gallery))
125
+			? intval($gallery)
126 126
 			: 0;
127 127
 	}
128 128
 
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return int
133 133
 	 */
134
-	protected function getImagesPerPageArg( $value = null )
134
+	protected function getImagesPerPageArg($value = null)
135 135
 	{
136
-		$perPage = $this->getValue( 'images_per_page', $value );
136
+		$perPage = $this->getValue('images_per_page', $value);
137 137
 
138
-		if( !is_numeric( $perPage ) && is_string( $perPage )) {
139
-			$perPage = $this->postmeta->get( $perPage );
138
+		if (!is_numeric($perPage) && is_string($perPage)) {
139
+			$perPage = $this->postmeta->get($perPage);
140 140
 		}
141
-		return !!intval( $perPage )
141
+		return !!intval($perPage)
142 142
 			? $perPage
143 143
 			: -1;
144 144
 	}
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return bool
150 150
 	 */
151
-	protected function getLazyloadArg( $value = null )
151
+	protected function getLazyloadArg($value = null)
152 152
 	{
153
-		return $this->getBoolValue( 'lazyload', $value );
153
+		return $this->getBoolValue('lazyload', $value);
154 154
 	}
155 155
 
156 156
 	/**
@@ -158,18 +158,18 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return array
160 160
 	 */
161
-	protected function getMediaArg( $value = null )
161
+	protected function getMediaArg($value = null)
162 162
 	{
163
-		$media = $this->getValue( 'media', $value );
163
+		$media = $this->getValue('media', $value);
164 164
 
165
-		if( is_string( $media )) {
166
-			$media = $this->postmeta->get( $media, [
165
+		if (is_string($media)) {
166
+			$media = $this->postmeta->get($media, [
167 167
 				'ID'     => $this->getGalleryArg(),
168 168
 				'single' => false,
169 169
 			]);
170 170
 		}
171
-		return is_array( $media )
172
-			? wp_parse_id_list( $media )
171
+		return is_array($media)
172
+			? wp_parse_id_list($media)
173 173
 			: [];
174 174
 	}
175 175
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function getPaged()
180 180
 	{
181
-		return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1;
181
+		return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1;
182 182
 	}
183 183
 
184 184
 	/**
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 *
187 187
 	 * @return bool
188 188
 	 */
189
-	protected function getPaginationArg( $value = null )
189
+	protected function getPaginationArg($value = null)
190 190
 	{
191
-		return $this->getBoolValue( 'pagination', $value );
191
+		return $this->getBoolValue('pagination', $value);
192 192
 	}
193 193
 
194 194
 	/**
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return bool
198 198
 	 */
199
-	protected function getPermalinksArg( $value = null )
199
+	protected function getPermalinksArg($value = null)
200 200
 	{
201
-		return $this->getBoolValue( 'permalinks', $value );
201
+		return $this->getBoolValue('permalinks', $value);
202 202
 	}
203 203
 
204 204
 	/**
205 205
 	 * @return string
206 206
 	 */
207
-	protected function getPhotoswipeData( $image )
207
+	protected function getPhotoswipeData($image)
208 208
 	{
209
-		return sprintf( '{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
209
+		return sprintf('{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}',
210 210
 			$image->large['url'],
211 211
 			$image->large['width'],
212 212
 			$image->large['height'],
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return mixed
224 224
 	 */
225
-	protected function getValue( $key, $value = null )
225
+	protected function getValue($key, $value = null)
226 226
 	{
227
-		if( is_null( $value ) && isset( $this->args[$key] )) {
227
+		if (is_null($value) && isset($this->args[$key])) {
228 228
 			$value = $this->args[$key];
229 229
 		}
230 230
 		return $value;
@@ -233,23 +233,23 @@  discard block
 block discarded – undo
233 233
 	/**
234 234
 	 * @return array
235 235
 	 */
236
-	protected function normalizeArgs( array $args = [] )
236
+	protected function normalizeArgs(array $args = [])
237 237
 	{
238 238
 		$defaults = [
239
-			'gallery',         // (string) meta_key | (int) post_id
240
-			'lazyload',        // (string) meta_key | (bool)
241
-			'media',           // (string) meta_key | (array) post_ids
242
-			'pagination',      // (string) meta_key | (bool)
239
+			'gallery', // (string) meta_key | (int) post_id
240
+			'lazyload', // (string) meta_key | (bool)
241
+			'media', // (string) meta_key | (array) post_ids
242
+			'pagination', // (string) meta_key | (bool)
243 243
 			'images_per_page', // (string) meta_key | (int) number
244
-			'permalinks',      // (string) meta_key | (bool)
244
+			'permalinks', // (string) meta_key | (bool)
245 245
 		];
246 246
 
247
-		$this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args );
247
+		$this->args = shortcode_atts(array_combine($defaults, $defaults), $args);
248 248
 
249
-		array_walk( $this->args, function( &$value, $key ) {
250
-			$method = $this->utility->buildMethodName( $key . '_arg' );
251
-			if( method_exists( $this, $method )) {
252
-				$value = call_user_func([ $this, $method ], $value );
249
+		array_walk($this->args, function(&$value, $key) {
250
+			$method = $this->utility->buildMethodName($key . '_arg');
251
+			if (method_exists($this, $method)) {
252
+				$value = call_user_func([$this, $method], $value);
253 253
 			}
254 254
 		});
255 255
 
@@ -261,20 +261,20 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return null|string
263 263
 	 */
264
-	protected function renderImageTag( $image )
264
+	protected function renderImageTag($image)
265 265
 	{
266 266
 		$imgSrc = $this->getLazyloadArg()
267
-			? $this->theme->imageUri( 'blank.gif' )
267
+			? $this->theme->imageUri('blank.gif')
268 268
 			: $image->thumbnail['url'];
269 269
 
270
-		$imgTag = sprintf( '<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
270
+		$imgTag = sprintf('<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>',
271 271
 			$imgSrc,
272 272
 			$image->thumbnail['url'],
273 273
 			$image->alt
274 274
 		);
275 275
 
276 276
 		return $this->getPermalinksArg()
277
-			? sprintf( '<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag )
277
+			? sprintf('<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag)
278 278
 			: $imgTag;
279 279
 	}
280 280
 }
Please login to merge, or discard this patch.
src/Helpers/Development.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 	public function capture()
10 10
 	{
11 11
 		ob_start();
12
-		call_user_func_array( [$this, 'print'], func_get_args() );
12
+		call_user_func_array([$this, 'print'], func_get_args());
13 13
 		return ob_get_clean();
14 14
 	}
15 15
 
16 16
 	public function className()
17 17
 	{
18
-		return $this->isDev() && in_array( DEV, ['css', true] )
18
+		return $this->isDev() && in_array(DEV, ['css', true])
19 19
 			? 'dev'
20 20
 			: '';
21 21
 	}
22 22
 
23 23
 	public function debug()
24 24
 	{
25
-		call_user_func_array( [$this, 'print'], func_get_args() );
25
+		call_user_func_array([$this, 'print'], func_get_args());
26 26
 	}
27 27
 
28 28
 	public function isDev()
29 29
 	{
30
-		return defined( 'DEV' ) && !!DEV && WP_ENV == 'development';
30
+		return defined('DEV') && !!DEV && WP_ENV == 'development';
31 31
 	}
32 32
 
33 33
 	public function isProduction()
@@ -39,44 +39,44 @@  discard block
 block discarded – undo
39 39
 	{
40 40
 		$args = func_num_args();
41 41
 
42
-		if( $args == 1 ) {
43
-			printf( '<div class="print__r"><pre>%s</pre></div>',
44
-				htmlspecialchars( print_r( func_get_arg(0), true ), ENT_QUOTES, 'UTF-8' )
42
+		if ($args == 1) {
43
+			printf('<div class="print__r"><pre>%s</pre></div>',
44
+				htmlspecialchars(print_r(func_get_arg(0), true), ENT_QUOTES, 'UTF-8')
45 45
 			);
46 46
 		}
47
-		else if( $args > 1 ) {
47
+		else if ($args > 1) {
48 48
 			echo '<div class="print__r_group">';
49
-			foreach( func_get_args() as $value ) {
50
-				$this->print( $value );
49
+			foreach (func_get_args() as $value) {
50
+				$this->print($value);
51 51
 			}
52 52
 			echo '</div>';
53 53
 		}
54 54
 	}
55 55
 
56
-	public function printFiltersFor( $hook = '' )
56
+	public function printFiltersFor($hook = '')
57 57
 	{
58 58
 		global $wp_filter;
59
-		if( empty( $hook ) || !isset( $wp_filter[$hook] ))return;
60
-		$this->print( $wp_filter[ $hook ] );
59
+		if (empty($hook) || !isset($wp_filter[$hook]))return;
60
+		$this->print($wp_filter[$hook]);
61 61
 	}
62 62
 
63 63
 	public function printTemplatePaths()
64 64
 	{
65
-		if( $this->isDev() && ( DEV == 'templates' || DEV === true )) {
66
-			$templates = array_keys( array_flip( $this->templatePaths ));
67
-			$templates = array_map( function( $key, $value ) {
68
-				return sprintf( '[%s] => %s', $key, $value );
69
-			}, array_keys( $templates ), $templates );
65
+		if ($this->isDev() && (DEV == 'templates' || DEV === true)) {
66
+			$templates = array_keys(array_flip($this->templatePaths));
67
+			$templates = array_map(function($key, $value) {
68
+				return sprintf('[%s] => %s', $key, $value);
69
+			}, array_keys($templates), $templates);
70 70
 
71
-			$this->print( implode( "\n", $templates ));
71
+			$this->print(implode("\n", $templates));
72 72
 		}
73 73
 	}
74 74
 
75
-	public function storeTemplatePath( $template )
75
+	public function storeTemplatePath($template)
76 76
 	{
77
-		if( is_string( $template )) {
78
-			$themeName = basename( strstr( $template, '/templates/', true ));
79
-			$this->templatePaths[] = $themeName . strstr( $template, '/templates/' );
77
+		if (is_string($template)) {
78
+			$themeName = basename(strstr($template, '/templates/', true));
79
+			$this->templatePaths[] = $themeName . strstr($template, '/templates/');
80 80
 		}
81 81
 	}
82 82
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 			printf( '<div class="print__r"><pre>%s</pre></div>',
44 44
 				htmlspecialchars( print_r( func_get_arg(0), true ), ENT_QUOTES, 'UTF-8' )
45 45
 			);
46
-		}
47
-		else if( $args > 1 ) {
46
+		} else if( $args > 1 ) {
48 47
 			echo '<div class="print__r_group">';
49 48
 			foreach( func_get_args() as $value ) {
50 49
 				$this->print( $value );
@@ -56,7 +55,9 @@  discard block
 block discarded – undo
56 55
 	public function printFiltersFor( $hook = '' )
57 56
 	{
58 57
 		global $wp_filter;
59
-		if( empty( $hook ) || !isset( $wp_filter[$hook] ))return;
58
+		if( empty( $hook ) || !isset( $wp_filter[$hook] )) {
59
+			return;
60
+		}
60 61
 		$this->print( $wp_filter[ $hook ] );
61 62
 	}
62 63
 
Please login to merge, or discard this patch.
src/Facades/Render.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
 
7 7
 class Render extends Facade
8 8
 {
9
-    /**
10
-     * Get the fully qualified class name of the component.
11
-     *
12
-     * @return string
13
-     */
14
-    protected static function getFacadeAccessor()
15
-    {
16
-        return \GeminiLabs\Castor\Helpers\Render::class;
17
-    }
9
+	/**
10
+	 * Get the fully qualified class name of the component.
11
+	 *
12
+	 * @return string
13
+	 */
14
+	protected static function getFacadeAccessor()
15
+	{
16
+		return \GeminiLabs\Castor\Helpers\Render::class;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Helpers/Utility.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
 	/**
8 8
 	 * @return string
9 9
 	 */
10
-	public function buildAttributes( array $atts = [] )
10
+	public function buildAttributes(array $atts = [])
11 11
 	{
12 12
 		$attributes = [];
13
-		foreach( $atts as $key => $value ) {
14
-			$attributes[] = sprintf( '%s="%s"', $key, $value );
13
+		foreach ($atts as $key => $value) {
14
+			$attributes[] = sprintf('%s="%s"', $key, $value);
15 15
 		}
16
-		return implode( ' ', $attributes );
16
+		return implode(' ', $attributes);
17 17
 	}
18 18
 
19 19
 	/**
20 20
 	 * @return string
21 21
 	 */
22
-	public function buildAttributesFor( $tag, array $atts = [] )
22
+	public function buildAttributesFor($tag, array $atts = [])
23 23
 	{
24 24
 		return $this->buildAttributes(
25
-			wp_parse_args( $atts, apply_filters( "castor/render/$tag/attributes", [] ))
25
+			wp_parse_args($atts, apply_filters("castor/render/$tag/attributes", []))
26 26
 		);
27 27
 	}
28 28
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @return string
34 34
 	 */
35
-	public function buildClassName( $name, $path = '' )
35
+	public function buildClassName($name, $path = '')
36 36
 	{
37
-		$className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name )));
38
-		$className = implode( '', $className );
37
+		$className = array_map('ucfirst', array_map('strtolower', preg_split('/[-_]/', $name)));
38
+		$className = implode('', $className);
39 39
 
40
-		return !empty( $path )
41
-			? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ))
40
+		return !empty($path)
41
+			? str_replace('\\\\', '\\', sprintf('%s\%s', $path, $className))
42 42
 			: $className;
43 43
 	}
44 44
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @return string
50 50
 	 */
51
-	public function buildMethodName( $name, $prefix = 'get' )
51
+	public function buildMethodName($name, $prefix = 'get')
52 52
 	{
53
-		return lcfirst( $this->buildClassName( $prefix . '-' . $name ));
53
+		return lcfirst($this->buildClassName($prefix . '-' . $name));
54 54
 	}
55 55
 
56 56
 	/**
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return string
62 62
 	 */
63
-	public function endWith( $suffix, $string, $unique = true )
63
+	public function endWith($suffix, $string, $unique = true)
64 64
 	{
65
-		return $unique && $this->endsWith( $suffix, $string )
65
+		return $unique && $this->endsWith($suffix, $string)
66 66
 			? $string
67 67
 			: $string . $suffix;
68 68
 	}
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-	public function endsWith( $needle, $haystack )
76
+	public function endsWith($needle, $haystack)
77 77
 	{
78
-		$length = strlen( $needle );
78
+		$length = strlen($needle);
79 79
 		return $length != 0
80
-			? substr( $haystack, -$length ) === $needle
80
+			? substr($haystack, -$length) === $needle
81 81
 			: true;
82 82
 	}
83 83
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return void
89 89
 	 */
90
-	public function printTag( $tag, $value, array $attributes = [] )
90
+	public function printTag($tag, $value, array $attributes = [])
91 91
 	{
92
-		$attributes = $this->buildAttributesFor( $tag, $attributes );
92
+		$attributes = $this->buildAttributesFor($tag, $attributes);
93 93
 
94
-		printf( '<%s>%s</%s>',
95
-			rtrim( sprintf( '%s %s', $tag, $attributes )),
94
+		printf('<%s>%s</%s>',
95
+			rtrim(sprintf('%s %s', $tag, $attributes)),
96 96
 			$value,
97 97
 			$tag
98 98
 		);
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return string
107 107
 	 */
108
-	public function startWith( $prefix, $string, $unique = true )
108
+	public function startWith($prefix, $string, $unique = true)
109 109
 	{
110
-		return $unique && $this->startsWith( $prefix, $string )
110
+		return $unique && $this->startsWith($prefix, $string)
111 111
 			? $string
112 112
 			: $prefix . $string;
113 113
 	}
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return string
120 120
 	 */
121
-	public function startsWith( $needle, $haystack )
121
+	public function startsWith($needle, $haystack)
122 122
 	{
123
-		return substr( $haystack, 0, strlen( $needle )) === $needle;
123
+		return substr($haystack, 0, strlen($needle)) === $needle;
124 124
 	}
125 125
 
126 126
 	/**
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return string
132 132
 	 */
133
-	public function trimLeft( $string, $needle, $caseSensitive = true )
133
+	public function trimLeft($string, $needle, $caseSensitive = true)
134 134
 	{
135 135
 		$strPos = $caseSensitive ? "strpos" : "stripos";
136
-		if( $strPos( $string, $needle ) === 0 ) {
137
-			$string = substr( $string, strlen( $needle ));
136
+		if ($strPos($string, $needle) === 0) {
137
+			$string = substr($string, strlen($needle));
138 138
 		}
139 139
 		return $string;
140 140
 	}
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return string
148 148
 	 */
149
-	public function trimRight( $string, $needle, $caseSensitive = true )
149
+	public function trimRight($string, $needle, $caseSensitive = true)
150 150
 	{
151 151
 		$strPos = $caseSensitive ? "strpos" : "stripos";
152
-		if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) {
153
-			$string = substr( $string, 0, -strlen( $needle ));
152
+		if ($strPos($string, $needle, strlen($string) - strlen($needle)) !== false) {
153
+			$string = substr($string, 0, -strlen($needle));
154 154
 		}
155 155
 		return $string;
156 156
 	}
Please login to merge, or discard this patch.
src/Oembed.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -22,65 +22,65 @@
 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
-		$request = $this->oembed->fetch( $this->oembed->get_provider( $url ), $url, [
33
+		$request = $this->oembed->fetch($this->oembed->get_provider($url), $url, [
34 34
 			'width'  => 1280,
35 35
 			'height' => 1280,
36 36
 		]);
37 37
 		return $request
38
-			? $this->modifyRequest( $request, $args )
38
+			? $this->modifyRequest($request, $args)
39 39
 			: $request;
40 40
 	}
41 41
 
42
-	protected function domLoad( $html )
42
+	protected function domLoad($html)
43 43
 	{
44 44
 		$dom = new DomDocument;
45
-		$dom->loadHTML( $html );
45
+		$dom->loadHTML($html);
46 46
 		return $dom;
47 47
 	}
48 48
 
49
-	protected function modifyRequest( $request, $args )
49
+	protected function modifyRequest($request, $args)
50 50
 	{
51
-		$providerName = strtolower( $request->provider_name );
52
-		$provider = property_exists( $this, $providerName )
51
+		$providerName = strtolower($request->provider_name);
52
+		$provider = property_exists($this, $providerName)
53 53
 			? $this->$providerName
54 54
 			: [];
55 55
 
56
-		$method = $this->utility->buildMethodName( $providerName . '_request', 'modify' );
56
+		$method = $this->utility->buildMethodName($providerName . '_request', 'modify');
57 57
 
58
-		if( method_exists( $this, $method )) {
59
-			return call_user_func( [$this, $method], $request, array_intersect_key(
60
-				wp_parse_args( $args ),
61
-				array_flip( $provider )
58
+		if (method_exists($this, $method)) {
59
+			return call_user_func([$this, $method], $request, array_intersect_key(
60
+				wp_parse_args($args),
61
+				array_flip($provider)
62 62
 			));
63 63
 		}
64 64
 		return $request;
65 65
 	}
66 66
 
67
-	protected function modifyYoutubeRequest( $request, array $args )
67
+	protected function modifyYoutubeRequest($request, array $args)
68 68
 	{
69
-		$html = $this->domLoad( $request->html );
70
-		$node = $html->getElementsByTagName( 'iframe' )->item(0);
71
-		$url  = $node->getAttribute( 'src' );
69
+		$html = $this->domLoad($request->html);
70
+		$node = $html->getElementsByTagName('iframe')->item(0);
71
+		$url  = $node->getAttribute('src');
72 72
 
73
-		if( isset( $args['fs'] ) && $args['fs'] == 0 ) {
74
-			$node->removeAttribute( 'allowfullscreen' );
73
+		if (isset($args['fs']) && $args['fs'] == 0) {
74
+			$node->removeAttribute('allowfullscreen');
75 75
 		}
76 76
 
77
-		$args['origin'] = urlencode( get_bloginfo( 'url' ));
77
+		$args['origin'] = urlencode(get_bloginfo('url'));
78 78
 
79
-		$node->setAttribute( 'src',
80
-			add_query_arg( $args, remove_query_arg( 'feature', $url ))
79
+		$node->setAttribute('src',
80
+			add_query_arg($args, remove_query_arg('feature', $url))
81 81
 		);
82 82
 
83
-		$request->html = $html->saveHTML( $node );
83
+		$request->html = $html->saveHTML($node);
84 84
 
85 85
 		return $request;
86 86
 	}
Please login to merge, or discard this patch.