Completed
Pull Request — master (#1171)
by Zack
95:41 queued 34:43
created
includes/fields/class-gravityview-field-workflow_step.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) {
48 48
 
49 49
 		// If not set, the entry hasn't started a workflow
50
-		$has_workflow_step = isset( $entry['workflow_step'] );
50
+		$has_workflow_step = isset( $entry[ 'workflow_step' ] );
51 51
 
52
-		if( $has_workflow_step ) {
52
+		if ( $has_workflow_step ) {
53 53
 
54
-			$GFlow = new Gravity_Flow_API( $entry['form_id'] );
54
+			$GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] );
55 55
 
56 56
 			if ( $current_step = $GFlow->get_current_step( $entry ) ) {
57 57
 				$output = esc_html( $current_step->get_name() );
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		preg_match( '/workflow_step_status_(\d+)/', $key, $matches );
80 80
 
81 81
 		if ( ! empty( $matches ) ) {
82
-			$workflow_step_id = intval( $matches[1] );
82
+			$workflow_step_id = intval( $matches[ 1 ] );
83 83
 		}
84 84
 
85 85
 		return $workflow_step_id;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$return = $label;
100 100
 
101
-		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) {
101
+		if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) {
102 102
 
103 103
 			$step = $this->get_workflow_step( $workflow_step_id );
104 104
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$workflow_step = $GFlow->get_step( $workflow_step_id );
130 130
 
131
-		if( ! $GFlow || ! $workflow_step ) {
131
+		if ( ! $GFlow || ! $workflow_step ) {
132 132
 			return false;
133 133
 		}
134 134
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		
151 151
 		foreach ( $search_fields as & $search_field ) {
152 152
 
153
-			if ( $this->name === $search_field['key'] ) {
153
+			if ( $this->name === $search_field[ 'key' ] ) {
154 154
 
155 155
 				$form_id = GravityView_View::getInstance()->getFormId();
156 156
 
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
 				$choices = array();
160 160
 
161 161
 				foreach ( $workflow_steps as $step ) {
162
-					$choices[] = array(
162
+					$choices[ ] = array(
163 163
 						'text'   => $step->get_name(),
164 164
 						'value'   => $step->get_id(),
165 165
 					);
166 166
 				}
167 167
 
168
-				$search_field['choices'] = $choices;
168
+				$search_field[ 'choices' ] = $choices;
169 169
 			}
170 170
 
171 171
 			// Workflow Step Statuses
172
-			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) {
172
+			else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) {
173 173
 
174 174
 				$status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id );
175 175
 
176
-				$search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
176
+				$search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key );
177 177
 			}
178 178
 		}
179 179
 		
Please login to merge, or discard this patch.
includes/class-gravityview-image.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 
66 66
 		$atts = wp_parse_args( $atts, $defaults );
67 67
 
68
-		foreach( $atts as $key => $val ) {
68
+		foreach ( $atts as $key => $val ) {
69 69
 			$this->{$key} = $val;
70 70
 		}
71 71
 
72
-		$this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
72
+		$this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class;
73 73
 
74 74
 		$this->set_image_size();
75 75
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	function validate_image_src() {
87 87
 
88
-		if ( !$this->validate_src ) { return true; }
88
+		if ( ! $this->validate_src ) { return true; }
89 89
 
90 90
 		$info = pathinfo( $this->src );
91 91
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 		 * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag
94 94
 		 * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']`
95 95
 		 */
96
-		$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ));
96
+		$image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) );
97 97
 
98
-		return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts);
98
+		return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts );
99 99
 	}
100 100
 
101 101
 	/**
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 
112 112
 			// And there is no string size passed
113 113
 			// 		And we want to get the image size using PHP
114
-			if ( empty( $string ) && !empty( $this->getimagesize ) ) {
114
+			if ( empty( $string ) && ! empty( $this->getimagesize ) ) {
115 115
 
116 116
 				$image_size = @getimagesize( $this->src );
117 117
 
118 118
 				// If it didn't return a response, it may be a HTTPS/SSL error
119
-				if ( empty( $image_size[0] ) ) {
119
+				if ( empty( $image_size[ 0 ] ) ) {
120 120
 					$image_size = @getimagesize( set_url_scheme( $this->src, 'http' ) );
121 121
 				}
122 122
 
123
-				if ( !empty( $image_size ) ) {
123
+				if ( ! empty( $image_size ) ) {
124 124
 					list( $width, $height ) = $image_size;
125 125
 				}
126 126
 
@@ -133,33 +133,33 @@  discard block
 block discarded – undo
133 133
 				 * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels
134 134
 				 */
135 135
 				$image_sizes = apply_filters( 'gravityview_image_sizes', array(
136
-					'tiny' => array('width' => 40, 'height' => 30),
137
-					'small' => array('width' => 100, 'height' => 75),
138
-					'medium' => array('width' => 250, 'height' => 188),
139
-					'large' => array('width' => 448, 'height' => 336),
136
+					'tiny' => array( 'width' => 40, 'height' => 30 ),
137
+					'small' => array( 'width' => 100, 'height' => 75 ),
138
+					'medium' => array( 'width' => 250, 'height' => 188 ),
139
+					'large' => array( 'width' => 448, 'height' => 336 ),
140 140
 				) );
141 141
 
142
-				switch( $this->size ) {
142
+				switch ( $this->size ) {
143 143
 					case 'tiny':
144
-						extract($image_sizes['tiny']);
144
+						extract( $image_sizes[ 'tiny' ] );
145 145
 						break;
146 146
 					case 'small':
147 147
 					case 's':
148 148
 					case 'thumb':
149
-						extract($image_sizes['small']);
149
+						extract( $image_sizes[ 'small' ] );
150 150
 						break;
151 151
 					case 'm':
152 152
 					case 'medium':
153
-						extract($image_sizes['medium']);
153
+						extract( $image_sizes[ 'medium' ] );
154 154
 						break;
155 155
 					case 'large':
156 156
 					case 'l':
157
-						extract($image_sizes['large']);
157
+						extract( $image_sizes[ 'large' ] );
158 158
 						break;
159 159
 					default:
160 160
 						// Verify that the passed sizes are integers.
161
-						$width = !empty( $width ) ? intval( $width ) : intval( $this->width );
162
-						$height = !empty( $height ) ? intval( $height ) : intval( $this->height );
161
+						$width = ! empty( $width ) ? intval( $width ) : intval( $this->width );
162
+						$height = ! empty( $height ) ? intval( $height ) : intval( $this->height );
163 163
 				}
164 164
 
165 165
 			}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-id.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = true;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with'  );
17
+	var $search_operators = array( 'is', 'isnot', 'starts_with', 'ends_with' );
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-checkbox.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
46 46
 
47 47
 		// It's not the parent field; it's an input
48
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
48
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
49 49
 
50
-			if( $this->is_choice_value_enabled() ) {
50
+			if ( $this->is_choice_value_enabled() ) {
51 51
 
52 52
 				$desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' );
53 53
 				$default = 'value';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 				);
66 66
 			}
67 67
 
68
-			$field_options['choice_display'] = array(
68
+			$field_options[ 'choice_display' ] = array(
69 69
 				'type'    => 'radio',
70 70
 				'class'   => 'vertical',
71 71
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-product.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	function clear_product_info_cache( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
51 51
 
52
-		if( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) {
52
+		if ( $this->should_hide_product_fields( $Edit_Entry_Render->entry ) ) {
53 53
 			return;
54 54
 		}
55 55
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 * @see GVCommon::entry_has_transaction_data()
102 102
 		 * @param boolean $hide_product_fields Whether to hide product fields in the editor. Uses $entry data to determine.
103 103
 		 */
104
-		$hide_product_fields = (bool) apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data );
104
+		$hide_product_fields = (bool)apply_filters( 'gravityview/edit_entry/hide-product-fields', $has_transaction_data );
105 105
 
106 106
 		return $hide_product_fields;
107 107
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-transaction-type.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) {
60 60
 
61 61
 		/** Overridden by a template. */
62
-		if( ! empty( $field['field_path'] ) ) { return $output; }
62
+		if ( ! empty( $field[ 'field_path' ] ) ) { return $output; }
63 63
 
64 64
 		return $this->get_string_from_value( $output );
65 65
 	}
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 		switch ( intval( $value ) ) {
79 79
 			case self::ONE_TIME_PAYMENT:
80 80
 			default:
81
-				$return = __('One-Time Payment', 'gravityview');
81
+				$return = __( 'One-Time Payment', 'gravityview' );
82 82
 				break;
83 83
 
84 84
 			case self::SUBSCRIPTION:
85
-				$return = __('Subscription', 'gravityview');
85
+				$return = __( 'Subscription', 'gravityview' );
86 86
 				break;
87 87
 		}
88 88
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-image.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 
24 24
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
25 25
 
26
-		unset ( $field_options['search_filter'] );
26
+		unset ( $field_options[ 'search_filter' ] );
27 27
 
28
-		if( 'edit' === $context ) {
28
+		if ( 'edit' === $context ) {
29 29
 			return $field_options;
30 30
 		}
31 31
 
32
-		$this->add_field_support('link_to_post', $field_options );
32
+		$this->add_field_support( 'link_to_post', $field_options );
33 33
 
34 34
 		// @since 1.5.4
35
-		$this->add_field_support('dynamic_data', $field_options );
35
+		$this->add_field_support( 'dynamic_data', $field_options );
36 36
 
37 37
 		return $field_options;
38 38
 	}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		$url = $title = $caption = $description = '';
60 60
 
61 61
 		// If there's a |:| match, process. Otherwise, empty array!
62
-		if( preg_match( '/\|\:\|/', $value ) ) {
62
+		if ( preg_match( '/\|\:\|/', $value ) ) {
63 63
 			list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false );
64 64
 		}
65 65
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field ) {
90 90
 
91
-		$id = (int) $field->id;
92
-		$form_id = $form['id'];
91
+		$id = (int)$field->id;
92
+		$form_id = $form[ 'id' ];
93 93
 		$input_name = "input_{$id}";
94 94
 		$field_id = sprintf( 'input_%d_%d', $form_id, $id );
95 95
 		$img_name = null;
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		// Convert |:| to associative array
98 98
 		$img_array = self::explode_value( $value );
99 99
 
100
-		if( ! empty( $img_array['url'] ) ) {
100
+		if ( ! empty( $img_array[ 'url' ] ) ) {
101 101
 
102
-			$img_name = basename( $img_array['url'] );
102
+			$img_name = basename( $img_array[ 'url' ] );
103 103
 
104 104
 			/**
105 105
 			 * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden
106 106
 			 * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code
107 107
 			 * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code
108 108
 			 */
109
-			if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
109
+			if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
110 110
 				GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name;
111 111
 			}
112 112
 		}
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 		 * @hack
136 136
 		 */
137 137
 		if ( null !== $img_name ) {
138
-			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) );
139
-			$gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output );
138
+			$current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) );
139
+			$gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output );
140 140
 		}
141 141
 
142 142
 		return $gf_post_image_field_output;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-radio.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 	var $is_searchable = true;
13 13
 
14
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
14
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
15 15
 
16 16
 	var $_gf_field_class_name = 'GF_Field_Radio';
17 17
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 		// Set the $_field_id var
41 41
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
42 42
 		
43
-		if( $this->is_choice_value_enabled() ) {
44
-			$field_options['choice_display'] = array(
43
+		if ( $this->is_choice_value_enabled() ) {
44
+			$field_options[ 'choice_display' ] = array(
45 45
 				'type'    => 'radio',
46 46
 				'value'   => 'value',
47 47
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-tags.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_searchable = true;
16 16
 
17
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
17
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
18 18
 
19 19
 	var $_gf_field_class_name = 'GF_Field_Post_Tags';
20 20
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
29 29
 
30
-		if( 'edit' === $context ) {
30
+		if ( 'edit' === $context ) {
31 31
 			return $field_options;
32 32
 		}
33 33
 
34
-		$this->add_field_support('dynamic_data', $field_options );
35
-		$this->add_field_support('link_to_term', $field_options );
34
+		$this->add_field_support( 'dynamic_data', $field_options );
35
+		$this->add_field_support( 'link_to_term', $field_options );
36 36
 
37 37
 		return $field_options;
38 38
 	}
Please login to merge, or discard this patch.