@@ -19,12 +19,12 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | function render_input( $override_input = null ) { |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $this->field['options'] as $value => $label ) : ?> |
|
27 | + foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
28 | 28 | <label class="<?php echo $this->get_label_class(); ?>"> |
29 | 29 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> /> <?php echo esc_html( $label ); ?> |
30 | 30 | </label> |
@@ -38,8 +38,8 @@ |
||
38 | 38 | // Set the $_field_id var |
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | - if( $this->is_choice_value_enabled() ) { |
|
42 | - $field_options['choice_display'] = array( |
|
41 | + if ( $this->is_choice_value_enabled() ) { |
|
42 | + $field_options[ 'choice_display' ] = array( |
|
43 | 43 | 'type' => 'radio', |
44 | 44 | 'value' => 'value', |
45 | 45 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -48,25 +48,25 @@ |
||
48 | 48 | |
49 | 49 | $quiz_fields = GFAPI::get_fields_by_type( $form, 'quiz' ); |
50 | 50 | |
51 | - if( ! empty( $quiz_fields ) ) { |
|
51 | + if ( ! empty( $quiz_fields ) ) { |
|
52 | 52 | |
53 | - $fields['gquiz_score'] = array( |
|
53 | + $fields[ 'gquiz_score' ] = array( |
|
54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
55 | 55 | 'type' => 'quiz_score', |
56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
57 | 57 | ); |
58 | - $fields['gquiz_percent'] = array( |
|
58 | + $fields[ 'gquiz_percent' ] = array( |
|
59 | 59 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
60 | 60 | 'type' => 'quiz_percent', |
61 | 61 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
62 | 62 | ); |
63 | - $fields['gquiz_grade'] = array( |
|
63 | + $fields[ 'gquiz_grade' ] = array( |
|
64 | 64 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
65 | 65 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
66 | 66 | 'type' => 'quiz_grade', |
67 | 67 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
68 | 68 | ); |
69 | - $fields['gquiz_is_pass'] = array( |
|
69 | + $fields[ 'gquiz_is_pass' ] = array( |
|
70 | 70 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
71 | 71 | 'type' => 'quiz_is_pass', |
72 | 72 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |
@@ -24,8 +24,8 @@ discard block |
||
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 |
||
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 | ) |
@@ -30,7 +30,7 @@ discard block |
||
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 |
||
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 ) ) { |
@@ -49,17 +49,17 @@ discard block |
||
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 |
||
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; |
@@ -12,10 +12,10 @@ |
||
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 | } |
@@ -47,11 +47,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -65,11 +65,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |