Completed
Pull Request — master (#51)
by Bui Quang
02:21
created
templates/admin/partials/header.blade.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <h2 class="nav-tab-wrapper">
2 2
     @foreach( $tabs as $tab => $name )
3
-        <?php $class = ( $tab == $current_tab ) ? ' nav-tab-active' : '';?>
3
+        <?php $class = ($tab == $current_tab) ? ' nav-tab-active' : ''; ?>
4 4
         <a class='nav-tab{{ $class }}' href='?page=wpdfi-settings.php&tab={{ $tab }}'>{{ $name }}</a>
5 5
     @endforeach
6 6
 </h2>
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
templates/admin/partials/content.blade.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1
-<form method="POST" action="<?php \admin_url( 'options-general.php?page=wpdfi-settings.php' ); ?>" id="wpdfi-form">
1
+<form method="POST" action="<?php \admin_url('options-general.php?page=wpdfi-settings.php'); ?>" id="wpdfi-form">
2 2
 	<div class="error-wrapper" id="error_wrapper"></div>
3
-	<?php wp_nonce_field( "wpdfi-settings-page" ); ?>
3
+	<?php wp_nonce_field("wpdfi-settings-page"); ?>
4 4
 	<div class="container">
5 5
 		<div class="option-container">
6 6
 			<div class="option-group" id="section_wrapper" class="list-group">
Please login to merge, or discard this patch.
src/Image.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 
48 48
 		$data = [];
49 49
 		// Default size
50
-		if ( in_array( $size_name, ['thumbnail', 'medium', 'medium_large', 'large'] ) ) {
51
-			$data['width']  = get_option( "{$size_name}_size_w" );
52
-			$data['height'] = get_option( "{$size_name}_size_h" );
50
+		if (in_array($size_name, ['thumbnail', 'medium', 'medium_large', 'large'])) {
51
+			$data['width']  = get_option("{$size_name}_size_w");
52
+			$data['height'] = get_option("{$size_name}_size_h");
53 53
 		// Additional size
54
-		} elseif ( isset( $_wp_additional_image_sizes[ $size_name ] ) ) {
55
-			$data['width'] = $_wp_additional_image_sizes[ $size_name ]['width'];
56
-			$data['height'] = $_wp_additional_image_sizes[ $size_name ]['height'];
54
+		} elseif (isset($_wp_additional_image_sizes[$size_name])) {
55
+			$data['width'] = $_wp_additional_image_sizes[$size_name]['width'];
56
+			$data['height'] = $_wp_additional_image_sizes[$size_name]['height'];
57 57
 		}
58 58
 
59 59
 		return $data;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	public function get_size_names_and_dimensions() {
69 69
 		$data = [];
70 70
 
71
-		foreach($this->get_size_names() as $size_name) {
71
+		foreach ($this->get_size_names() as $size_name) {
72 72
 			$data[$size_name] = $this->get_size_dimensions($size_name);
73 73
 		}
74 74
 
Please login to merge, or discard this patch.
src/Traits/HasModule.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function __get($name)
39 39
 	{
40
-		switch($name) {
40
+		switch ($name) {
41 41
 			// Load sub-module first
42 42
 			case isset($this->modules[$name]):
43 43
 				return $this->modules[$name];
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @return void
56 56
 	 */
57 57
 	public function moduleHooks() {
58
-		foreach($this->modules as $module) {
59
-			if(method_exists($module, 'hooks')) {
58
+		foreach ($this->modules as $module) {
59
+			if (method_exists($module, 'hooks')) {
60 60
 				$module->hooks();
61 61
 			}
62 62
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @return  mixed $handle
72 72
 	 */
73 73
 	public function module($name, $handle = null) {
74
-		if(!isset($this->modules[$name]))
74
+		if (!isset($this->modules[$name]))
75 75
 			$this->modules[$name] = $handle;
76 76
 		return $this->modules[$name];
77 77
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,8 +71,9 @@
 block discarded – undo
71 71
 	 * @return  mixed $handle
72 72
 	 */
73 73
 	public function module($name, $handle = null) {
74
-		if(!isset($this->modules[$name]))
75
-			$this->modules[$name] = $handle;
74
+		if(!isset($this->modules[$name])) {
75
+					$this->modules[$name] = $handle;
76
+		}
76 77
 		return $this->modules[$name];
77 78
 	}
78 79
 }
79 80
\ No newline at end of file
Please login to merge, or discard this patch.
src/Traits/Singleton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	 * @return  WPDFI\Traits\Singleton A single instance of this class.
37 37
 	 */
38 38
 	public static function instance() {
39
-		if ( null === self::$instance ) {
39
+		if (null === self::$instance) {
40 40
 			self::$instance = new self();
41 41
 		}
42 42
 		return self::$instance;
Please login to merge, or discard this patch.
src/PostType.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 		 * Check the post-after-updated (pau).
54 54
 		 * If the pau does not have a feature image.
55 55
 		 */
56
-		if(!\has_post_thumbnail($post_after)) {
56
+		if (!\has_post_thumbnail($post_after)) {
57 57
 
58 58
 			/* Check if the pau status match the Admin Setting option 'status_for_update'. */
59
-			if($status_for_update == $post_after->post_status) {
59
+			if ($status_for_update == $post_after->post_status) {
60 60
 
61 61
 				/* Get pau information about Terms */
62 62
 				$terms = $this->get_all_terms_post($post_id, $post_after->post_type);
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 
67 67
 				/* Loop through main Admin Setting to compare with pau information. */
68 68
 				$conditional_status = false; 
69
-				foreach($options as $option) {
69
+				foreach ($options as $option) {
70 70
 
71
-					if($option['post_type'] == $post_after->post_type) {
71
+					if ($option['post_type'] == $post_after->post_type) {
72 72
 						$option_taxonomy_not_exist = (!$option['taxonomy']);
73 73
 						$term_is_uncategorized = ($terms == ['category' => [1]]);
74 74
 						$posttype_is_post = ($post_after->post_type == 'post');
75 75
 						/* If two terms array match. */
76
-						if($terms == $option['taxonomy']) {
76
+						if ($terms == $option['taxonomy']) {
77 77
 
78 78
 							$conditional_status = true;
79 79
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
 					}
91 91
 					/* If match conditional, set the default feature image for the post. */
92
-					if($conditional_status == true) {
92
+					if ($conditional_status == true) {
93 93
 
94
-						\set_post_thumbnail( $post_id, $option['image_id'] );
94
+						\set_post_thumbnail($post_id, $option['image_id']);
95 95
 						return;
96 96
 					
97 97
 					}
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	public function get_name() {
110 110
 		$names = \get_post_types();
111 111
 
112
-		if(is_array($names)) {
112
+		if (is_array($names)) {
113 113
 
114
-			foreach($names as $name) {
114
+			foreach ($names as $name) {
115 115
 
116
-				if(!\post_type_supports( $name, 'thumbnail' )) {
116
+				if (!\post_type_supports($name, 'thumbnail')) {
117 117
 
118 118
 					unset($names[$name]);
119 119
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @return string
135 135
 	 */
136 136
 	public function get_singular_name($post_type) {
137
-		return \get_post_type_object( $post_type )->labels->singular_name;
137
+		return \get_post_type_object($post_type)->labels->singular_name;
138 138
 	}
139 139
 
140 140
 	/**
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$data = [];
148 148
 
149 149
 		$index = 0;
150
-		foreach($this->get_name() as $name => $value) {
150
+		foreach ($this->get_name() as $name => $value) {
151 151
 
152 152
 			$data[$index]['id'] = $name; 
153 153
 			$data[$index]['text'] = $this->get_singular_name($name);
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 		/* Get all taxonomies of a post type. */
174 174
 		$taxonomies = \wpdfi()->taxonomy->get($post_type);
175 175
 		/* Loop through all taxonomies of a post type. */
176
-		foreach($taxonomies as $taxonomy_id => $taxonomy_value) {
176
+		foreach ($taxonomies as $taxonomy_id => $taxonomy_value) {
177 177
 			/* Push all the terms of the post (detected via post_id) to terms variable. */
178
-			foreach(\wp_get_post_terms($post_id, $taxonomy_id) as $term) {
178
+			foreach (\wp_get_post_terms($post_id, $taxonomy_id) as $term) {
179 179
 
180 180
 				$terms[] = $term;
181 181
 
Please login to merge, or discard this patch.
src/Ajax.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@
 block discarded – undo
33 33
 		$actions = ['get_post_types', 'get_terms', 'get_image_size_names_and_dimensions', 
34 34
 					'get_default_layout', 'get_related_layout'];
35 35
 
36
-		foreach($actions as $action) {
37
-			\add_action('wp_ajax_wpdfi_'. $action, [$this, $action]);
38
-			\add_action('wp_ajax_nopriv_wpdfi'. $action, [$this, $action]);
36
+		foreach ($actions as $action) {
37
+			\add_action('wp_ajax_wpdfi_'.$action, [$this, $action]);
38
+			\add_action('wp_ajax_nopriv_wpdfi'.$action, [$this, $action]);
39 39
 		}
40 40
 	}
41 41
 
Please login to merge, or discard this patch.
src/Taxonomy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@
 block discarded – undo
33 33
 	public function get($post_type) {
34 34
 		$data = [];
35 35
 
36
-		if($post_type) {
36
+		if ($post_type) {
37 37
 			
38
-			foreach(\get_object_taxonomies($post_type, 'objects') as $index => $taxonomy) {
38
+			foreach (\get_object_taxonomies($post_type, 'objects') as $index => $taxonomy) {
39 39
 				// Only accept taxonomies which visible to admin and reader
40
-				if($taxonomy->show_ui and $taxonomy->show_in_menu) {
40
+				if ($taxonomy->show_ui and $taxonomy->show_in_menu) {
41 41
 
42 42
 					$data[$index]['name'] = $taxonomy->name;
43 43
 					$data[$index]['label'] = $taxonomy->label;
Please login to merge, or discard this patch.
src/Layout.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @return VA\Templater
35 35
 	 */
36 36
 	public function get_admin_layout($tabs, $current_tab, $options, $layout_name) {
37
-		return \wpdfi()->templater->render('admin.layout',[
37
+		return \wpdfi()->templater->render('admin.layout', [
38 38
 			'tabs' => $tabs, 'current_tab' => $current_tab,
39 39
 			'options' => $options, 'layout_name' => $layout_name,
40 40
 		]); 
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
 	public function get_related_layout($section_index, $post_type) {
77 77
 		$layout = '';
78 78
 		/* Get taxonomy layout */
79
-		$layout.= \wpdfi()->templater->render('admin.blocks.taxonomy.default', [
79
+		$layout .= \wpdfi()->templater->render('admin.blocks.taxonomy.default', [
80 80
 			'taxonomies' => \wpdfi()->taxonomy->get($post_type),
81 81
 			'section_index' => $section_index
82 82
 		]);
83
-		$layout.= \wpdfi()->templater->render('admin.blocks.imageupload.default', [
83
+		$layout .= \wpdfi()->templater->render('admin.blocks.imageupload.default', [
84 84
 			'section_index' => $section_index
85 85
 		]);
86 86
 		// $layout.= \wpdfi()->templater->render('admin.blocks.imagesize.default', [
Please login to merge, or discard this patch.