Completed
Push — develop ( b23320...2c048d )
by Paul
02:27 queued 31s
created
src/Helpers/Render.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	public $theme;
15 15
 	public $utility;
16 16
 
17
-	public function __construct( Media $media, PostMeta $postmeta, Theme $theme, Utility $utility )
17
+	public function __construct(Media $media, PostMeta $postmeta, Theme $theme, Utility $utility)
18 18
 	{
19 19
 		$this->media    = $media;
20 20
 		$this->postmeta = $postmeta;
@@ -22,148 +22,148 @@  discard block
 block discarded – undo
22 22
 		$this->utility  = $utility;
23 23
 	}
24 24
 
25
-	public function blockquote( $metaKey = false, array $attributes = [] )
25
+	public function blockquote($metaKey = false, array $attributes = [])
26 26
 	{
27
-		if( $value = $this->postmeta->get( $metaKey )) {
28
-			$this->utility->printTag( 'blockquote', wp_strip_all_tags( $value ), $attributes );
27
+		if ($value = $this->postmeta->get($metaKey)) {
28
+			$this->utility->printTag('blockquote', wp_strip_all_tags($value), $attributes);
29 29
 		}
30 30
 	}
31 31
 
32
-	public function button( $postId = 0, $title = false, $passthrough = false )
32
+	public function button($postId = 0, $title = false, $passthrough = false)
33 33
 	{
34
-		if( $passthrough ) {
34
+		if ($passthrough) {
35 35
 			$url = $postId;
36 36
 		}
37
-		if( !isset( $url )) {
38
-			$url = get_permalink( $postId );
39
-			if( !$title ) {
40
-				$title = get_the_title( $postId );
37
+		if (!isset($url)) {
38
+			$url = get_permalink($postId);
39
+			if (!$title) {
40
+				$title = get_the_title($postId);
41 41
 			}
42 42
 		}
43
-		if( !$title || !$url )return;
44
-		printf( '<a href="%s" class="button"><span>%s</span></a>', $url, $title );
43
+		if (!$title || !$url)return;
44
+		printf('<a href="%s" class="button"><span>%s</span></a>', $url, $title);
45 45
 	}
46 46
 
47
-	public function buttons( $postIds = [] )
47
+	public function buttons($postIds = [])
48 48
 	{
49
-		foreach( (array) $postIds as $postId ) {
50
-			$this->button( $postId );
49
+		foreach ((array) $postIds as $postId) {
50
+			$this->button($postId);
51 51
 		}
52 52
 	}
53 53
 
54
-	public function content( $metaKey = false, $passthrough = false )
54
+	public function content($metaKey = false, $passthrough = false)
55 55
 	{
56
-		if( $passthrough ) {
56
+		if ($passthrough) {
57 57
 			$content = $metaKey;
58 58
 		}
59
-		if( !isset( $content )) {
59
+		if (!isset($content)) {
60 60
 			$content = $metaKey
61
-				? $this->postmeta->get( $metaKey )
61
+				? $this->postmeta->get($metaKey)
62 62
 				: get_the_content();
63 63
 		}
64
-		echo str_replace( ']]>', ']]&gt;', apply_filters( 'the_content', $content ));
64
+		echo str_replace(']]>', ']]&gt;', apply_filters('the_content', $content));
65 65
 	}
66 66
 
67
-	public function copyright( array $args = [] )
67
+	public function copyright(array $args = [])
68 68
 	{
69 69
 		$args = shortcode_atts([
70
-			'copyright' => sprintf( '<span>%s </span>&copy;', __( 'Copyright', 'castor' )),
71
-			'date' => date( 'Y' ),
72
-			'name' => get_bloginfo( 'name' ),
70
+			'copyright' => sprintf('<span>%s </span>&copy;', __('Copyright', 'castor')),
71
+			'date' => date('Y'),
72
+			'name' => get_bloginfo('name'),
73 73
 			'separator' => '&mdash;',
74
-		], $args );
75
-		extract( $args );
76
-		if( $separator ) {
74
+		], $args);
75
+		extract($args);
76
+		if ($separator) {
77 77
 			$separator .= ' ';
78 78
 		}
79
-		printf( '%s %s %s%s', $copyright, $date, $separator, $name );
79
+		printf('%s %s %s%s', $copyright, $date, $separator, $name);
80 80
 	}
81 81
 
82
-	public function featured( $args = [] )
82
+	public function featured($args = [])
83 83
 	{
84
-		$args = wp_parse_args( $args, [
84
+		$args = wp_parse_args($args, [
85 85
 			'class'  => 'featured',
86 86
 			'image'  => get_post_thumbnail_id(),
87 87
 			'player' => '',
88 88
 			'video'  => 'featured_video',
89 89
 		]);
90
-		$featuredHtml = $this->media->video( wp_parse_args( $args, [
90
+		$featuredHtml = $this->media->video(wp_parse_args($args, [
91 91
 			'url' => $args['video'],
92 92
 		]));
93
-		if( empty( $featuredHtml ) && $featuredImage = $this->media->getImage( $args['image'] )) {
93
+		if (empty($featuredHtml) && $featuredImage = $this->media->getImage($args['image'])) {
94 94
 			$featuredCaption = $featuredImage->caption
95
-				? sprintf( '<figcaption>%s</figcaption>', $featuredImage->caption )
95
+				? sprintf('<figcaption>%s</figcaption>', $featuredImage->caption)
96 96
 				: '';
97
-			$featuredHtml = sprintf( '<div class="featured-image"><img src="%s" alt="%s"></div>%s',
97
+			$featuredHtml = sprintf('<div class="featured-image"><img src="%s" alt="%s"></div>%s',
98 98
 				$featuredImage->large['url'],
99 99
 				$featuredImage->alt,
100 100
 				$featuredCaption
101 101
 			);
102 102
 		}
103
-		if( !empty( $featuredHtml )) {
104
-			printf( '<figure class="%s">%s</figure>', $args['class'], $featuredHtml );
103
+		if (!empty($featuredHtml)) {
104
+			printf('<figure class="%s">%s</figure>', $args['class'], $featuredHtml);
105 105
 		}
106 106
 	}
107 107
 
108
-	public function field( $name, array $args = [] )
108
+	public function field($name, array $args = [])
109 109
 	{
110 110
 	}
111 111
 
112
-	public function form( $name, array $args = [] )
112
+	public function form($name, array $args = [])
113 113
 	{
114 114
 	}
115 115
 
116
-	public function gallery( array $args = [] )
116
+	public function gallery(array $args = [])
117 117
 	{
118
-		echo $this->media->gallery( $args );
118
+		echo $this->media->gallery($args);
119 119
 	}
120 120
 
121
-	public function h1( $string, array $attributes = [] ) {
122
-		$this->utility->printTag( 'h1', wp_strip_all_tags( $string ), $attributes );
121
+	public function h1($string, array $attributes = []) {
122
+		$this->utility->printTag('h1', wp_strip_all_tags($string), $attributes);
123 123
 	}
124 124
 
125
-	public function h2( $string, array $attributes = [] ) {
126
-		$this->utility->printTag( 'h2', wp_strip_all_tags( $string ), $attributes );
125
+	public function h2($string, array $attributes = []) {
126
+		$this->utility->printTag('h2', wp_strip_all_tags($string), $attributes);
127 127
 	}
128 128
 
129
-	public function h3( $string, array $attributes = [] ) {
130
-		$this->utility->printTag( 'h3', wp_strip_all_tags( $string ), $attributes );
129
+	public function h3($string, array $attributes = []) {
130
+		$this->utility->printTag('h3', wp_strip_all_tags($string), $attributes);
131 131
 	}
132 132
 
133
-	public function h4( $string, array $attributes = [] ) {
134
-		$this->utility->printTag( 'h4', wp_strip_all_tags( $string ), $attributes );
133
+	public function h4($string, array $attributes = []) {
134
+		$this->utility->printTag('h4', wp_strip_all_tags($string), $attributes);
135 135
 	}
136 136
 
137
-	public function h5( $string, array $attributes = [] ) {
138
-		$this->utility->printTag( 'h5', wp_strip_all_tags( $string ), $attributes );
137
+	public function h5($string, array $attributes = []) {
138
+		$this->utility->printTag('h5', wp_strip_all_tags($string), $attributes);
139 139
 	}
140 140
 
141
-	public function h6( $string, array $attributes = [] ) {
142
-		$this->utility->printTag( 'h6', wp_strip_all_tags( $string ), $attributes );
141
+	public function h6($string, array $attributes = []) {
142
+		$this->utility->printTag('h6', wp_strip_all_tags($string), $attributes);
143 143
 	}
144 144
 
145
-	public function madeWithLove( $name )
145
+	public function madeWithLove($name)
146 146
 	{
147
-		printf( __( 'Made with %s by %s', 'castor' ),
148
-			file_get_contents( sprintf( '%simg/heart.svg', \GeminiLabs\Castor\Application::getInstance()->assets )),
147
+		printf(__('Made with %s by %s', 'castor'),
148
+			file_get_contents(sprintf('%simg/heart.svg', \GeminiLabs\Castor\Application::getInstance()->assets)),
149 149
 			$name
150 150
 		);
151 151
 	}
152 152
 
153
-	public function p( $string, array $attributes = [] ) {
154
-		$this->utility->printTag( 'p', wp_strip_all_tags( $string ), $attributes );
153
+	public function p($string, array $attributes = []) {
154
+		$this->utility->printTag('p', wp_strip_all_tags($string), $attributes);
155 155
 	}
156 156
 
157
-	public function title( $metaKey = false, array $attributes = [] )
157
+	public function title($metaKey = false, array $attributes = [])
158 158
 	{
159
-		$tag = apply_filters( 'castor/render/title/tag', 'h2' );
159
+		$tag = apply_filters('castor/render/title/tag', 'h2');
160 160
 		$value = $metaKey
161
-			? $this->postmeta->get( $metaKey )
161
+			? $this->postmeta->get($metaKey)
162 162
 			: $this->theme->pageTitle();
163 163
 
164
-		if( !$value )return;
164
+		if (!$value)return;
165 165
 
166
-		$this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes );
166
+		$this->utility->printTag($tag, wp_strip_all_tags($value), $attributes);
167 167
 	}
168 168
 
169 169
 	/**
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @return string|null
173 173
 	 */
174
-	public function video( $args )
174
+	public function video($args)
175 175
 	{
176
-		echo $this->media->video( $args );
176
+		echo $this->media->video($args);
177 177
 	}
178 178
 }
Please login to merge, or discard this patch.