Passed
Push — master ( ad7989...648c0b )
by Paul
09:21 queued 04:46
created
plugin/Controllers/SettingsController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	public function callbackRegisterSettings( $input )
19 19
 	{
20
-		if( !is_array( $input )) {
20
+		if( !is_array( $input ) ) {
21 21
 			$input = ['settings' => []];
22 22
 		}
23 23
 		if( key( $input ) == 'settings' ) {
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			$options = $this->sanitizeSubmissions( $input, $options );
27 27
 			$options = $this->sanitizeTranslations( $input, $options );
28 28
 			if( filter_input( INPUT_POST, 'option_page' ) == Application::ID.'-settings' ) {
29
-				glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ));
29
+				glsr( Notice::class )->addSuccess( __( 'Settings updated.', 'site-reviews' ) );
30 30
 			}
31 31
 			return $options;
32 32
 		}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	{
42 42
 		register_setting( Application::ID.'-settings', OptionManager::databaseKey(), [
43 43
 			'sanitize_callback' => [$this, 'callbackRegisterSettings'],
44
-		]);
44
+		] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		if( trim( $inputForm['notification_message'] ) == '' ) {
57 57
 			$options['settings']['general']['notification_message'] = glsr()->defaults['settings']['general']['notification_message'];
58 58
 		}
59
-		$options['settings']['general']['notifications'] = isset( $inputForm['notifications'] )
59
+		$options['settings']['general']['notifications'] = isset($inputForm['notifications'])
60 60
 			? $inputForm['notifications']
61 61
 			: [];
62 62
 		return $options;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	protected function sanitizeSubmissions( array $input, array $options )
69 69
 	{
70 70
 		$inputForm = $input['settings']['submissions'];
71
-		$options['settings']['submissions']['required'] = isset( $inputForm['required'] )
71
+		$options['settings']['submissions']['required'] = isset($inputForm['required'])
72 72
 			? $inputForm['required']
73 73
 			: [];
74 74
 		return $options;
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	protected function sanitizeTranslations( array $input, array $options )
81 81
 	{
82
-		if( isset( $input['settings']['strings'] )) {
83
-			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ));
82
+		if( isset($input['settings']['strings']) ) {
83
+			$options['settings']['strings'] = array_values( array_filter( $input['settings']['strings'] ) );
84 84
 			$allowedTags = [
85 85
 				'a' => ['class' => [], 'href' => [], 'target' => []],
86 86
 				'span' => ['class' => []],
87 87
 			];
88
-			array_walk( $options['settings']['strings'], function( &$string ) use( $allowedTags ) {
89
-				if( isset( $string['s2'] )) {
88
+			array_walk( $options['settings']['strings'], function( &$string ) use($allowedTags) {
89
+				if( isset($string['s2']) ) {
90 90
 					$string['s2'] = wp_kses( $string['s2'], $allowedTags );
91 91
 				}
92
-				if( isset( $string['p2'] )) {
92
+				if( isset($string['p2']) ) {
93 93
 					$string['p2'] = wp_kses( $string['p2'], $allowedTags );
94 94
 				}
95 95
 			});
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	protected function isPolylangActiveAndSupported()
104 104
 	{
105 105
 		if( !glsr( Polylang::class )->isActive() ) {
106
-			glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ));
106
+			glsr( Notice::class )->addError( __( 'Please install/activate the Polylang plugin to enable integration.', 'site-reviews' ) );
107 107
 			return false;
108 108
 		}
109 109
 		else if( !glsr( Polylang::class )->isSupported() ) {
110
-			glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ));
110
+			glsr( Notice::class )->addError( __( 'Please update the Polylang plugin to v2.3.0 or greater to enable integration.', 'site-reviews' ) );
111 111
 			return false;
112 112
 		}
113 113
 		return true;
Please login to merge, or discard this patch.
plugin/Commands/CreateReview.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
31 31
 	public function __construct( $input )
32 32
 	{
33 33
 		$this->request = $input;
34
-		$this->ajax_request = isset( $input['_ajax_request'] );
34
+		$this->ajax_request = isset($input['_ajax_request']);
35 35
 		$this->assigned_to = $this->getNumeric( 'assign_to' );
36
-		$this->author = sanitize_text_field( $this->getUser( 'name' ));
36
+		$this->author = sanitize_text_field( $this->getUser( 'name' ) );
37 37
 		$this->avatar = $this->getAvatar();
38
-		$this->blacklisted = isset( $input['blacklisted'] );
39
-		$this->category = sanitize_key( $this->get( 'category' ));
40
-		$this->content = sanitize_textarea_field( $this->get( 'content' ));
38
+		$this->blacklisted = isset($input['blacklisted']);
39
+		$this->category = sanitize_key( $this->get( 'category' ) );
40
+		$this->content = sanitize_textarea_field( $this->get( 'content' ) );
41 41
 		$this->custom = $this->getCustom();
42 42
 		$this->date = $this->getDate( 'date' );
43
-		$this->email = sanitize_email( $this->getUser( 'email' ));
44
-		$this->form_id = sanitize_key( $this->get( 'form_id' ));
43
+		$this->email = sanitize_email( $this->getUser( 'email' ) );
44
+		$this->form_id = sanitize_key( $this->get( 'form_id' ) );
45 45
 		$this->ip_address = $this->get( 'ip_address' );
46
-		$this->post_id = intval( $this->get( '_post_id' ));
47
-		$this->rating = intval( $this->get( 'rating' ));
46
+		$this->post_id = intval( $this->get( '_post_id' ) );
47
+		$this->rating = intval( $this->get( 'rating' ) );
48 48
 		$this->referer = $this->get( '_referer' );
49
-		$this->response = sanitize_textarea_field( $this->get( 'response' ));
50
-		$this->terms = !empty( $input['terms'] );
51
-		$this->title = sanitize_text_field( $this->get( 'title' ));
52
-		$this->url = esc_url_raw( $this->get( 'url' ));
49
+		$this->response = sanitize_textarea_field( $this->get( 'response' ) );
50
+		$this->terms = !empty($input['terms']);
51
+		$this->title = sanitize_text_field( $this->get( 'title' ) );
52
+		$this->url = esc_url_raw( $this->get( 'url' ) );
53 53
 	}
54 54
 
55 55
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function get( $key )
60 60
 	{
61
-		return isset( $this->request[$key] )
61
+		return isset($this->request[$key])
62 62
 			? (string)$this->request[$key]
63 63
 			: '';
64 64
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		$avatar = $this->get( 'avatar' );
72 72
 		return !filter_var( $avatar, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED | FILTER_FLAG_HOST_REQUIRED | FILTER_FLAG_PATH_REQUIRED )
73
-			? (string)get_avatar_url( $this->get( 'email' ))
73
+			? (string)get_avatar_url( $this->get( 'email' ) )
74 74
 			: $avatar;
75 75
 	}
76 76
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$unset = apply_filters( 'site-reviews/create/unset-keys-from-custom', $unset );
88 88
 		$custom = $this->request;
89 89
 		foreach( $unset as $value ) {
90
-			unset( $custom[$value] );
90
+			unset($custom[$value]);
91 91
 		}
92 92
 		return $custom;
93 93
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	protected function getDate( $key )
100 100
 	{
101
-		$date = strtotime( $this->get( $key ));
101
+		$date = strtotime( $this->get( $key ) );
102 102
 		if( $date === false ) {
103 103
 			$date = time();
104 104
 		}
105
-		return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date ));
105
+		return get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $date ) );
106 106
 	}
107 107
 
108 108
 	/**
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 	protected function getUser( $key )
113 113
 	{
114 114
 		$value = $this->get( $key );
115
-		if( empty( $value )) {
115
+		if( empty($value) ) {
116 116
 			$user = wp_get_current_user();
117 117
 			$userValues = [
118 118
 				'email' => 'user_email',
119 119
 				'name' => 'display_name',
120 120
 			];
121
-			if( $user->exists() && array_key_exists( $key, $userValues )) {
121
+			if( $user->exists() && array_key_exists( $key, $userValues ) ) {
122 122
 				return $user->{$userValues[$key]};
123 123
 			}
124 124
 		}
Please login to merge, or discard this patch.