Completed
Push — develop ( 2c713a...483098 )
by Paul
02:05
created
src/AliasLoader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	protected $registered = false;
27 27
 
28
-	private function __construct( array $aliases )
28
+	private function __construct(array $aliases)
29 29
 	{
30 30
 		$this->aliases = $aliases;
31 31
 	}
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return AliasLoader
40 40
 	 */
41
-	public static function getInstance( array $aliases = [] )
41
+	public static function getInstance(array $aliases = [])
42 42
 	{
43
-		if( is_null( static::$instance )) {
44
-			return static::$instance = new static( $aliases );
43
+		if (is_null(static::$instance)) {
44
+			return static::$instance = new static($aliases);
45 45
 		}
46 46
 
47
-		$aliases = array_merge( static::$instance->aliases, $aliases );
47
+		$aliases = array_merge(static::$instance->aliases, $aliases);
48 48
 
49 49
 		static::$instance->aliases = $aliases;
50 50
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return bool|null
60 60
 	 */
61
-	public function load( $alias )
61
+	public function load($alias)
62 62
 	{
63
-		if( isset( $this->aliases[$alias] )) {
64
-			return class_alias( $this->aliases[$alias], $alias );
63
+		if (isset($this->aliases[$alias])) {
64
+			return class_alias($this->aliases[$alias], $alias);
65 65
 		}
66 66
 	}
67 67
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function register()
74 74
 	{
75
-		if( !$this->registered ) {
76
-			spl_autoload_register( [$this, 'load'], true, true );
75
+		if (!$this->registered) {
76
+			spl_autoload_register([$this, 'load'], true, true);
77 77
 			$this->registered = true;
78 78
 		}
79 79
 	}
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/Helpers/Theme.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 {
9 9
 	public $postmeta;
10 10
 
11
-	public function __construct( PostMeta $postmeta )
11
+	public function __construct(PostMeta $postmeta)
12 12
 	{
13 13
 		$this->postmeta = $postmeta;
14 14
 	}
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return string
20 20
 	 */
21
-	public function assetPath( $asset )
21
+	public function assetPath($asset)
22 22
 	{
23
-		return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset;
23
+		return $this->paths('dir.stylesheet') . 'assets/' . $asset;
24 24
 	}
25 25
 
26 26
 	/**
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return string
30 30
 	 */
31
-	public function assetUri( $asset )
31
+	public function assetUri($asset)
32 32
 	{
33
-		return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset;
33
+		return $this->paths('uri.stylesheet') . 'assets/' . $asset;
34 34
 	}
35 35
 
36 36
 	/**
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 			is_single(),
45 45
 		];
46 46
 
47
-		$display = in_array( true, $conditions );
47
+		$display = in_array(true, $conditions);
48 48
 
49
-		return apply_filters( 'castor/display/sidebar', $display );
49
+		return apply_filters('castor/display/sidebar', $display);
50 50
 	}
51 51
 
52 52
 	/**
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return string
56 56
 	 */
57
-	public function imagePath( $asset )
57
+	public function imagePath($asset)
58 58
 	{
59
-		return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset;
59
+		return $this->paths('dir.stylesheet') . 'assets/img/' . $asset;
60 60
 	}
61 61
 
62 62
 	/**
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string
66 66
 	 */
67
-	public function imageUri( $asset )
67
+	public function imageUri($asset)
68 68
 	{
69
-		return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset;
69
+		return $this->paths('uri.stylesheet') . 'assets/img/' . $asset;
70 70
 	}
71 71
 
72 72
 	public function pageTitle()
73 73
 	{
74
-		foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) {
75
-			if( !$bool() )continue;
76
-			$method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool )));
74
+		foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) {
75
+			if (!$bool())continue;
76
+			$method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool)));
77 77
 			return $this->$method();
78 78
 		}
79 79
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return array|string
87 87
 	 */
88
-	public function paths( $path = null )
88
+	public function paths($path = null)
89 89
 	{
90 90
 		$paths = [
91 91
 			'dir.stylesheet' => get_stylesheet_directory(),
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 			'uri.template'   => get_template_directory_uri(),
96 96
 		];
97 97
 
98
-		if( is_null( $path )) {
98
+		if (is_null($path)) {
99 99
 			return $paths;
100 100
 		}
101 101
 
102
-		return array_key_exists( $path, $paths )
103
-			? trailingslashit( $paths[$path] )
102
+		return array_key_exists($path, $paths)
103
+			? trailingslashit($paths[$path])
104 104
 			: '';
105 105
 	}
106 106
 
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string|null
111 111
 	 */
112
-	public function svg( $path = null )
112
+	public function svg($path = null)
113 113
 	{
114
-		if( $svg = file_get_contents( $this->imageUri( $path ))) {
114
+		if ($svg = file_get_contents($this->imageUri($path))) {
115 115
 			return $svg;
116 116
 		}
117 117
 	}
118 118
 
119 119
 	protected function get404Title()
120 120
 	{
121
-		return __( 'Not Found', 'castor' );
121
+		return __('Not Found', 'castor');
122 122
 	}
123 123
 
124 124
 	protected function getArchiveTitle()
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 
129 129
 	protected function getHomeTitle()
130 130
 	{
131
-		return ( $home = get_option( 'page_for_posts', true ))
132
-			? get_the_title( $home )
133
-			: __( 'Latest Posts', 'castor' );
131
+		return ($home = get_option('page_for_posts', true))
132
+			? get_the_title($home)
133
+			: __('Latest Posts', 'castor');
134 134
 	}
135 135
 
136 136
 	protected function getPageTitle()
137 137
 	{
138
-		return ($title = $this->postmeta->get( 'title' ))
138
+		return ($title = $this->postmeta->get('title'))
139 139
 			? $title
140 140
 			: get_the_title();
141 141
 	}
142 142
 
143 143
 	protected function getSearchTitle()
144 144
 	{
145
-		return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() );
145
+		return sprintf(__('Search Results for %s', 'castor'), get_search_query());
146 146
 	}
147 147
 }
Please login to merge, or discard this patch.
castor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@
 block discarded – undo
1
-<?php defined( 'WPINC' ) || die;
1
+<?php defined('WPINC') || die;
2 2
 
3 3
 global $wp_version;
4 4
 
5
-if( version_compare( '5.6.0', phpversion(), '>=' )) {
5
+if (version_compare('5.6.0', phpversion(), '>=')) {
6 6
 	wp_die(
7
-		__( 'You must be using PHP 5.6.0 or greater.', 'castor' ),
8
-		__( 'Unsupported PHP version', 'castor' )
7
+		__('You must be using PHP 5.6.0 or greater.', 'castor'),
8
+		__('Unsupported PHP version', 'castor')
9 9
 	);
10 10
 }
11 11
 
12
-if( version_compare( '4.7.0', $wp_version, '>=' )) {
12
+if (version_compare('4.7.0', $wp_version, '>=')) {
13 13
 	wp_die(
14
-		__( 'You must be using WordPress 4.7.0 or greater.', 'castor' ),
15
-		__( 'Unsupported WordPress version', 'castor' )
14
+		__('You must be using WordPress 4.7.0 or greater.', 'castor'),
15
+		__('Unsupported WordPress version', 'castor')
16 16
 	);
17 17
 }
18 18
 
19
-if( is_customize_preview() && filter_input( INPUT_GET, 'theme' )) {
19
+if (is_customize_preview() && filter_input(INPUT_GET, 'theme')) {
20 20
 	wp_die(
21
-		__( 'Theme must be activated prior to using the customizer.', 'castor' )
21
+		__('Theme must be activated prior to using the customizer.', 'castor')
22 22
 	);
23 23
 }
24 24
 
25
-require_once( ABSPATH . '/' . WPINC . '/class-oembed.php' );
25
+require_once(ABSPATH . '/' . WPINC . '/class-oembed.php');
26 26
 
27 27
 \GeminiLabs\Castor\Application::getInstance()->init();
Please login to merge, or discard this patch.
src/Helpers/Media.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	protected $image;
22 22
 	protected $video;
23 23
 
24
-	public function __construct( Gallery $gallery, Image $image, Video $video )
24
+	public function __construct(Gallery $gallery, Image $image, Video $video)
25 25
 	{
26 26
 		$this->gallery = $gallery;
27 27
 		$this->image   = $image;
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
 	 * @return string|void
35 35
 	 * @throws BadMethodCallException
36 36
 	 */
37
-	public function __call( $name, array $args )
37
+	public function __call($name, array $args)
38 38
 	{
39
-		$mediaType = $this->validateMethod( $name );
39
+		$mediaType = $this->validateMethod($name);
40 40
 
41
-		if( !count( $args )) {
42
-			throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name ));
41
+		if (!count($args)) {
42
+			throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name));
43 43
 		}
44
-		if( str_replace( $mediaType, '', strtolower( $name ))) {
45
-			return $this->$mediaType->get( $args[0] )->$mediaType;
44
+		if (str_replace($mediaType, '', strtolower($name))) {
45
+			return $this->$mediaType->get($args[0])->$mediaType;
46 46
 		}
47
-		return !empty( $args[1] )
48
-			? $this->$mediaType->get( $args[0] )->render( $args[1] )
49
-			: $this->$mediaType->get( $args[0] )->render();
47
+		return !empty($args[1])
48
+			? $this->$mediaType->get($args[0])->render($args[1])
49
+			: $this->$mediaType->get($args[0])->render();
50 50
 	}
51 51
 
52 52
 	/**
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	 * @return mixed
57 57
 	 * @throws BadMethodCallException
58 58
 	 */
59
-	public function get( $name, $args = [] )
59
+	public function get($name, $args = [])
60 60
 	{
61
-		$mediaType = $this->validateMethod( $name );
62
-		return $this->$mediaType->get( $args )->$mediaType;
61
+		$mediaType = $this->validateMethod($name);
62
+		return $this->$mediaType->get($args)->$mediaType;
63 63
 	}
64 64
 
65 65
 	/**
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 	 * @return string|false
69 69
 	 * @throws BadMethodCallException
70 70
 	 */
71
-	protected function validateMethod( $name )
71
+	protected function validateMethod($name)
72 72
 	{
73
-		foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) {
74
-			if( property_exists( $this, $method ) && is_object( $this->$method )) {
73
+		foreach ([$name, strtolower(substr($name, 3))] as $method) {
74
+			if (property_exists($this, $method) && is_object($this->$method)) {
75 75
 				return $method;
76 76
 			}
77 77
 		}
78
-		throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ));
78
+		throw new BadMethodCallException(sprintf('Not a valid method: %s', $name));
79 79
 	}
80 80
 }
Please login to merge, or discard this patch.
src/Image.php 1 patch
Spacing   +21 added lines, -21 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->post_type != 'attachment' )return;
62
+		if (is_null($attachment) || $attachment->post_type != 'attachment')return;
63 63
 
64 64
 		return $attachment->ID;
65 65
 	}
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return array
71 71
 	 */
72
-	protected function normalizeSrc( array $image, $fallback = false )
72
+	protected function normalizeSrc(array $image, $fallback = false)
73 73
 	{
74
-		if( is_array( $fallback ) && count( array_diff( $image, $fallback )) < 2 ) {
74
+		if (is_array($fallback) && count(array_diff($image, $fallback)) < 2) {
75 75
 			$image = $fallback;
76 76
 		}
77 77
 		return [
Please login to merge, or discard this patch.
src/Video.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	protected $theme;
21 21
 	protected $utility;
22 22
 
23
-	public function __construct( Image $image, Oembed $oembed, PostMeta $postmeta, Theme $theme, Utility $utility )
23
+	public function __construct(Image $image, Oembed $oembed, PostMeta $postmeta, Theme $theme, Utility $utility)
24 24
 	{
25 25
 		$this->image    = $image;
26 26
 		$this->oembed   = $oembed;
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 		$this->utility  = $utility;
30 30
 	}
31 31
 
32
-	public function get( $args = [] )
32
+	public function get($args = [])
33 33
 	{
34
-		$args = $this->normalize( $args );
35
-		$embed = $this->oembed->request( $args['url'], $args['player'] );
36
-		if( isset( $embed->type ) && $embed->type == 'video' ) {
34
+		$args = $this->normalize($args);
35
+		$embed = $this->oembed->request($args['url'], $args['player']);
36
+		if (isset($embed->type) && $embed->type == 'video') {
37 37
 			$this->video = $embed;
38 38
 		}
39 39
 		return $this;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	public function render()
43 43
 	{
44
-		if( !isset( $this->video->html ))return;
44
+		if (!isset($this->video->html))return;
45 45
 		return sprintf(
46 46
 			'<div class="video embed">%s%s</div>',
47 47
 			$this->renderScreenshot(),
@@ -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,28 +81,28 @@  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
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
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 ))continue;
118
-			call_user_func([ $this, $method ], $value );
115
+		foreach ($this->args as $key => $value) {
116
+			$method = $this->utility->buildMethodName($key, 'set');
117
+			if (!method_exists($this, $method))continue;
118
+			call_user_func([$this, $method], $value);
119 119
 		}
120 120
 		return $this->args;
121 121
 	}
Please login to merge, or discard this patch.
src/Oembed.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -22,69 +22,69 @@
 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 35
 		]);
36
-		$request = $this->oembed->fetch( $this->oembed->get_provider( $url ), $url, [
36
+		$request = $this->oembed->fetch($this->oembed->get_provider($url), $url, [
37 37
 			'width'  => 1280,
38 38
 			'height' => 1280,
39 39
 		]);
40
-		if( $request === false )return;
41
-		if( !empty( $args['embed_type'] ) && $args['embed_type'] != $request->type )return;
42
-		return $this->modifyRequest( $request, $args );
40
+		if ($request === false)return;
41
+		if (!empty($args['embed_type']) && $args['embed_type'] != $request->type)return;
42
+		return $this->modifyRequest($request, $args);
43 43
 	}
44 44
 
45
-	protected function domLoad( $html )
45
+	protected function domLoad($html)
46 46
 	{
47 47
 		$dom = new DomDocument;
48
-		$dom->loadHTML( $html );
48
+		$dom->loadHTML($html);
49 49
 		return $dom;
50 50
 	}
51 51
 
52
-	protected function modifyRequest( $request, $args )
52
+	protected function modifyRequest($request, $args)
53 53
 	{
54
-		$providerName = strtolower( $request->provider_name );
55
-		$provider = property_exists( $this, $providerName )
54
+		$providerName = strtolower($request->provider_name);
55
+		$provider = property_exists($this, $providerName)
56 56
 			? $this->$providerName
57 57
 			: [];
58 58
 
59
-		$method = $this->utility->buildMethodName( $providerName . '_request', 'modify' );
59
+		$method = $this->utility->buildMethodName($providerName . '_request', 'modify');
60 60
 
61
-		if( method_exists( $this, $method )) {
62
-			return call_user_func( [$this, $method], $request, array_intersect_key(
61
+		if (method_exists($this, $method)) {
62
+			return call_user_func([$this, $method], $request, array_intersect_key(
63 63
 				$args,
64
-				array_flip( $provider )
64
+				array_flip($provider)
65 65
 			));
66 66
 		}
67 67
 		return $request;
68 68
 	}
69 69
 
70
-	protected function modifyYoutubeRequest( $request, array $args )
70
+	protected function modifyYoutubeRequest($request, array $args)
71 71
 	{
72
-		$html = $this->domLoad( $request->html );
73
-		$node = $html->getElementsByTagName( 'iframe' )->item(0);
74
-		$url  = $node->getAttribute( 'src' );
72
+		$html = $this->domLoad($request->html);
73
+		$node = $html->getElementsByTagName('iframe')->item(0);
74
+		$url  = $node->getAttribute('src');
75 75
 
76
-		if( isset( $args['fs'] ) && $args['fs'] == 0 ) {
77
-			$node->removeAttribute( 'allowfullscreen' );
76
+		if (isset($args['fs']) && $args['fs'] == 0) {
77
+			$node->removeAttribute('allowfullscreen');
78 78
 		}
79 79
 
80
-		$args['origin'] = urlencode( get_bloginfo( 'url' ));
80
+		$args['origin'] = urlencode(get_bloginfo('url'));
81 81
 
82
-		$node->setAttribute( 'class', 'video-embed' );
83
-		$node->setAttribute( 'src',
84
-			add_query_arg( $args, remove_query_arg( 'feature', $url ))
82
+		$node->setAttribute('class', 'video-embed');
83
+		$node->setAttribute('src',
84
+			add_query_arg($args, remove_query_arg('feature', $url))
85 85
 		);
86 86
 
87
-		$request->html = $html->saveHTML( $node );
87
+		$request->html = $html->saveHTML($node);
88 88
 
89 89
 		return $request;
90 90
 	}
Please login to merge, or discard this patch.
templates/email.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( get_option( 'blogname' ), ENT_QUOTES ); ?></title>
5
+    <title><?= wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); ?></title>
6 6
 </head>
7 7
 <body>
8 8
 
Please login to merge, or discard this patch.