Completed
Pull Request — master (#1461)
by Zack
17:37 queued 14:56
created
includes/fields/class-gravityview-field-password.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string If a custom field label isn't set, return the field label for the password field
51 51
 	 */
52
-	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){
52
+	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) {
53 53
 
54 54
 		// If using a custom label, no need to fetch the parent label
55 55
 		if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string If a custom field label isn't set, return the field label for the password field
51 51
 	 */
52
-	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){
52
+	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) {
53 53
 
54 54
 		// If using a custom label, no need to fetch the parent label
55
-		if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) {
55
+		if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) {
56 56
 			return $label;
57 57
 		}
58 58
 
59
-		$field_object = GFFormsModel::get_field( $form, $field['id'] );
59
+		$field_object = GFFormsModel::get_field( $form, $field[ 'id' ] );
60 60
 
61
-		if( $field_object && 'password' === $field_object->type ) {
62
-			$label = $field['label'];
61
+		if ( $field_object && 'password' === $field_object->type ) {
62
+			$label = $field[ 'label' ];
63 63
 		}
64 64
 
65 65
 		return $label;
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) {
80 80
 
81 81
 		foreach ( $fields as $key => $field ) {
82
-			if( 'password' === $field['type'] ) {
82
+			if ( 'password' === $field[ 'type' ] ) {
83 83
 
84 84
 				// The Enter Password input
85
-				if( floor( $key ) === floatval( $key ) ) {
85
+				if ( floor( $key ) === floatval( $key ) ) {
86 86
 
87
-					if( ! empty( $field['parent'] ) ) {
88
-						$field['label']      = $field['parent']->label;
89
-						$field['adminOnly']  = $field['parent']->adminOnly;
90
-						$field['adminLabel'] = $field['parent']->adminLabel;
87
+					if ( ! empty( $field[ 'parent' ] ) ) {
88
+						$field[ 'label' ]      = $field[ 'parent' ]->label;
89
+						$field[ 'adminOnly' ]  = $field[ 'parent' ]->adminOnly;
90
+						$field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel;
91 91
 						// Don't show as a child input
92
-						unset( $field['parent'] );
92
+						unset( $field[ 'parent' ] );
93 93
 					}
94 94
 
95 95
 					$fields[ $key ] = $field;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 	 * @param \GV\Entry		$entry	The entry.
39 39
 	 * @param \GV\Request	$request The request context.
40 40
 	 *
41
-	 * @return mixed $value The filtered value.
41
+	 * @return string $value The filtered value.
42 42
 	 */
43 43
 	public function get_value( $value, $field, $view, $source, $entry, $request ) {
44 44
 		/** Passwords should never be exposed. */
Please login to merge, or discard this patch.
includes/presets/default-edit/class-gravityview-default-template-edit.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 			'slug' => 'edit',
25 25
 			'type' => 'internal',
26 26
 			'label' =>  __( 'Edit Table', 'gravityview' ),
27
-			'description' => __('Display items in a table view.', 'gravityview'),
28
-			'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE),
27
+			'description' => __( 'Display items in a table view.', 'gravityview' ),
28
+			'logo' => plugins_url( 'includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE ),
29 29
 			'css_source' => gravityview_css_url( 'table-view.css', GRAVITYVIEW_DIR . 'templates/css/' ),
30 30
 		);
31 31
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				'1-1' => array(
43 43
 					array(
44 44
 						'areaid' => 'edit-fields',
45
-						'title' => __('Visible Edit Fields', 'gravityview' )
45
+						'title' => __( 'Visible Edit Fields', 'gravityview' )
46 46
 					)
47 47
 				)
48 48
 			)
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-survey.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,6 @@
 block discarded – undo
36 36
 	 * @since 1.16.4
37 37
 	 * @since 1.17 Moved to GravityView_Plugin_Hooks_Gravity_Forms_Survey class
38 38
 	 *
39
-	 * @param array $form
40 39
 	 *
41 40
 	 * @return array Form, with all fields set to `allowsPrepopulate => true`
42 41
 	 */
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 		$return = $input_type;
47 47
 
48
-		if( 'survey' === $field_type ) {
48
+		if ( 'survey' === $field_type ) {
49 49
 			$return = 'select';
50 50
 		}
51 51
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	public function fix_survey_fields( $fields ) {
66 66
 
67 67
 		/** @var GF_Field $field */
68
-		foreach( $fields as &$field ) {
69
-			if( 'survey' === $field->type ) {
68
+		foreach ( $fields as &$field ) {
69
+			if ( 'survey' === $field->type ) {
70 70
 				$field->allowsPrepopulate = true;
71 71
 			}
72 72
 		}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @return void
83 83
 	 */
84 84
 	function add_render_hooks() {
85
-		add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 );
85
+		add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 );
86 86
 	}
87 87
 
88 88
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	function remove_render_hooks() {
98
-		remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 );
98
+		remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 );
99 99
 	}
100 100
 
101 101
 	/**
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function fix_survey_field_value( $value, $field, $name ) {
115 115
 
116
-		if( 'survey' === $field->type ) {
116
+		if ( 'survey' === $field->type ) {
117 117
 
118
-			$entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry();
118
+			$entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry();
119 119
 
120 120
 			// We need to run through each survey row until we find a match for expected values
121 121
 			foreach ( $entry as $field_id => $field_value ) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 					list( $row_val, $col_val ) = explode( ':', $field_value, 2 );
129 129
 
130 130
 					// If the $name matches the $row_val, we are processing the correct row
131
-					if( $row_val === $name ) {
131
+					if ( $row_val === $name ) {
132 132
 						$value = $field_value;
133 133
 						break;
134 134
 					}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-custom-field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return void
31 31
 	 */
32 32
 	private function add_hooks() {
33
-		add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value'), 10, 2 );
33
+		add_filter( 'gravityview/edit_entry/field_value_post_custom_field', array( $this, 'edit_entry_field_value' ), 10, 2 );
34 34
 	}
35 35
 
36 36
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function edit_entry_field_value( $field_value, $field ) {
47 47
 
48
-		if( 'list' === $field->inputType ) {
48
+		if ( 'list' === $field->inputType ) {
49 49
 			$field_value = is_string( $field_value ) ? json_decode( $field_value, true ) : $field_value;
50 50
 
51 51
 			if ( ! is_array( $field_value ) ) {
Please login to merge, or discard this patch.
includes/admin/class-gravityview-admin-view-widget.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 
13 13
 		$field_info_items = array();
14 14
 
15
-		if( !empty( $this->item['description'] ) ) {
15
+		if ( ! empty( $this->item[ 'description' ] ) ) {
16 16
 
17
-			$field_info_items[] = array(
18
-				'value' => $this->item['description']
17
+			$field_info_items[ ] = array(
18
+				'value' => $this->item[ 'description' ]
19 19
 			);
20 20
 
21 21
 		}
Please login to merge, or discard this patch.
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/fields/class-gravityview-field-is-approved.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,6 @@
 block discarded – undo
59 59
 	 *
60 60
 	 * @param string $output HTML value output
61 61
 	 * @param array  $entry The GF entry array
62
-	 * @param array  $field_settings Settings for the particular GV field
63 62
 	 * @param array  $field Field array, as fetched from GravityView_View::getCurrentField()
64 63
 	 *
65 64
 	 * @return string The field setting label for the current status. Uses defaults, if not configured.
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function add_default_field( $entry_default_fields, $form, $zone ) {
97 97
 
98
-		if( 'edit' !== $zone ) {
98
+		if ( 'edit' !== $zone ) {
99 99
 			$entry_default_fields[ $this->name ] = array(
100 100
 				'label' => $this->label,
101 101
 				'desc'  => $this->description,
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 		$merge_tags = array(
122 122
 			array(
123
-				'label' => __('Approval Status', 'gravityview'),
123
+				'label' => __( 'Approval Status', 'gravityview' ),
124 124
 				'tag' => '{approval_status}'
125 125
 			),
126 126
 		);
@@ -160,10 +160,10 @@  discard block
 block discarded – undo
160 160
 				gravityview()->log->error( 'No entry data available. Returning empty string.' );
161 161
 				$replacement = '';
162 162
 			} else {
163
-				$replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[1] );
163
+				$replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[ 1 ] );
164 164
 			}
165 165
 
166
-			$return = str_replace( $match[0], $replacement, $return );
166
+			$return = str_replace( $match[ 0 ], $replacement, $return );
167 167
 		}
168 168
 
169 169
 		return $return;
@@ -171,25 +171,25 @@  discard block
 block discarded – undo
171 171
 
172 172
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
173 173
 
174
-		$field_options['approved_label'] = array(
174
+		$field_options[ 'approved_label' ] = array(
175 175
 			'type' => 'text',
176 176
 			'label' => __( 'Approved Label', 'gravityview' ),
177 177
 			'desc' => __( 'If the entry is approved, display this value', 'gravityview' ),
178
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('approved'),
178
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'approved' ),
179 179
 		);
180 180
 
181
-		$field_options['disapproved_label'] = array(
181
+		$field_options[ 'disapproved_label' ] = array(
182 182
 			'type' => 'text',
183 183
 			'label' => __( 'Disapproved Label', 'gravityview' ),
184 184
 			'desc' => __( 'If the entry is not approved, display this value', 'gravityview' ),
185
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('disapproved'),
185
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'disapproved' ),
186 186
 		);
187 187
 
188
-		$field_options['unapproved_label'] = array(
188
+		$field_options[ 'unapproved_label' ] = array(
189 189
 			'type' => 'text',
190 190
 			'label' => __( 'Unapproved Label', 'gravityview' ),
191 191
 			'desc' => __( 'If the entry has not yet been approved or disapproved, display this value', 'gravityview' ),
192
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('unapproved'),
192
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'unapproved' ),
193 193
 		);
194 194
 
195 195
 		return $field_options;
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-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.