@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
24 | 24 | |
25 | - unset( $field_options['show_as_link'] ); |
|
25 | + unset( $field_options[ 'show_as_link' ] ); |
|
26 | 26 | |
27 | - if( 'edit' === $context ) { |
|
27 | + if ( 'edit' === $context ) { |
|
28 | 28 | return $field_options; |
29 | 29 | } |
30 | 30 | |
31 | - $this->add_field_support('dynamic_data', $field_options ); |
|
31 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
32 | 32 | |
33 | 33 | return $field_options; |
34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field ) { |
46 | 46 | |
47 | - $id = (int) $field->id; |
|
47 | + $id = (int)$field->id; |
|
48 | 48 | $input_name = "input_{$id}"; |
49 | 49 | $class = esc_attr( $field->size ); |
50 | 50 | $tabindex = $field->get_tabindex(); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return GravityView_Field | bool |
43 | 43 | */ |
44 | 44 | public static function create( $properties ) { |
45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
48 | 48 | return new GravityView_Field( $properties ); |
49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return bool True: yes, it exists; False: nope |
63 | 63 | */ |
64 | 64 | public static function exists( $field_name ) { |
65 | - return isset( self::$_fields["{$field_name}"] ); |
|
65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | |
97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
98 | 98 | |
99 | - foreach( self::$_fields as $field ) { |
|
100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
99 | + foreach ( self::$_fields as $field ) { |
|
100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
101 | 101 | return $field; |
102 | 102 | } |
103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function get_all( $group = '' ) { |
118 | 118 | |
119 | - if( '' !== $group ) { |
|
119 | + if ( '' !== $group ) { |
|
120 | 120 | $return_fields = self::$_fields; |
121 | 121 | foreach ( $return_fields as $key => $field ) { |
122 | - if( $group !== $field->group ) { |
|
122 | + if ( $group !== $field->group ) { |
|
123 | 123 | unset( $return_fields[ $key ] ); |
124 | 124 | } |
125 | 125 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
61 | 61 | |
62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
101 | 101 | |
102 | 102 | // If the search is being sorted |
103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
104 | 104 | |
105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
109 | 109 | * @see modify_sort_id() |
110 | 110 | */ |
111 | - if( ! empty( $pieces[1] ) ) { |
|
111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
112 | 112 | |
113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
114 | - $this->_time_format = $pieces[1]; |
|
115 | - $this->_date_format = $pieces[2]; |
|
114 | + $this->_time_format = $pieces[ 1 ]; |
|
115 | + $this->_date_format = $pieces[ 2 ]; |
|
116 | 116 | |
117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
123 | 123 | */ |
124 | - $criteria['sorting']['is_numeric'] = true; |
|
124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
125 | 125 | |
126 | 126 | // Modify the Gravity Forms WP Query |
127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * then we want to modify the query. |
148 | 148 | * @see GFFormsModel::sort_by_field_query() |
149 | 149 | */ |
150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
151 | 151 | |
152 | - if( $this->_time_format === '24' ) { |
|
152 | + if ( $this->_time_format === '24' ) { |
|
153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
154 | 154 | } else { |
155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | // Set variables |
196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
197 | 197 | |
198 | - if( 'edit' === $context ) { |
|
198 | + if ( 'edit' === $context ) { |
|
199 | 199 | return $field_options; |
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Set default date format based on field ID and Form ID |
204 | 204 | */ |
205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
206 | 206 | |
207 | - $this->add_field_support('date_display', $field_options ); |
|
207 | + $this->add_field_support( 'date_display', $field_options ); |
|
208 | 208 | |
209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | 210 | |
211 | 211 | return $field_options; |
212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function _get_time_format() { |
222 | 222 | global $post; |
223 | 223 | |
224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
225 | 225 | |
226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // GF defaults to 12, so should we. |
241 | 241 | $time_format = '12'; |
242 | 242 | |
243 | - if( $form_id ) { |
|
243 | + if ( $form_id ) { |
|
244 | 244 | $form = GFAPI::get_form( $form_id ); |
245 | 245 | |
246 | 246 | if ( $form ) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $default = 'h:i A'; |
288 | 288 | |
289 | 289 | // This doesn't take into account 24-hour |
290 | - switch( $field_input_id ) { |
|
290 | + switch ( $field_input_id ) { |
|
291 | 291 | // Hours |
292 | 292 | case 1: |
293 | 293 | return ( $time_format === '12' ) ? 'h' : 'H'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
20 | 20 | |
21 | - if( 'edit' === $context ) { |
|
21 | + if ( 'edit' === $context ) { |
|
22 | 22 | return $field_options; |
23 | 23 | } |
24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | 'quiz_show_explanation' => array( |
27 | 27 | 'type' => 'checkbox', |
28 | 28 | 'label' => __( 'Show Answer Explanation?', 'gravityview' ), |
29 | - 'desc' => __('If the field has an answer explanation, show it?', 'gravityview'), |
|
29 | + 'desc' => __( 'If the field has an answer explanation, show it?', 'gravityview' ), |
|
30 | 30 | 'value' => false, |
31 | 31 | 'merge_tags' => false, |
32 | 32 | ), |
@@ -35,14 +35,14 @@ |
||
35 | 35 | */ |
36 | 36 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
37 | 37 | |
38 | - if( 'edit' === $context ) { |
|
38 | + if ( 'edit' === $context ) { |
|
39 | 39 | return $field_options; |
40 | 40 | } |
41 | 41 | |
42 | - $field_options['link_phone'] = array( |
|
42 | + $field_options[ 'link_phone' ] = array( |
|
43 | 43 | 'type' => 'checkbox', |
44 | 44 | 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview' ), |
|
46 | 46 | 'value' => true, |
47 | 47 | ); |
48 | 48 |
@@ -21,10 +21,10 @@ |
||
21 | 21 | {email_fields} |
22 | 22 | |
23 | 23 | <div class="gv-note-content-container"> |
24 | - <label for="gv-note-content-{entry_slug}" class="screen-reader-text"><?php echo GravityView_Field_Notes::strings('content-label'); ?></label> |
|
24 | + <label for="gv-note-content-{entry_slug}" class="screen-reader-text"><?php echo GravityView_Field_Notes::strings( 'content-label' ); ?></label> |
|
25 | 25 | <textarea name="gv-note-content" id="gv-note-content-{entry_slug}"></textarea> |
26 | 26 | </div> |
27 | 27 | |
28 | - <button type="submit" class="button gv-add-note-submit"><?php echo GravityView_Field_Notes::strings('add-note'); ?></button> |
|
28 | + <button type="submit" class="button gv-add-note-submit"><?php echo GravityView_Field_Notes::strings( 'add-note' ); ?></button> |
|
29 | 29 | </div> |
30 | 30 | </form> |
31 | 31 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function get_field_desc() { |
24 | - return !empty( $this->field['desc'] ) ? $this->field['desc'] : ''; |
|
24 | + return ! empty( $this->field[ 'desc' ] ) ? $this->field[ 'desc' ] : ''; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | function render_input( $override_input = null ) { |
25 | - if( isset( $override_input ) ) { |
|
25 | + if ( isset( $override_input ) ) { |
|
26 | 26 | echo $override_input; |
27 | 27 | return; |
28 | 28 | } |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | ?> |
31 | 31 | <ul class="gv-setting-list"> |
32 | 32 | <?php |
33 | - foreach( $this->field['options'] as $value => $label ) { ?> |
|
34 | - <li <?php if( isset( $label['requires'] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label['requires'] ); } ?>> |
|
33 | + foreach ( $this->field[ 'options' ] as $value => $label ) { ?> |
|
34 | + <li <?php if ( isset( $label[ 'requires' ] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label[ 'requires' ] ); } ?>> |
|
35 | 35 | <label> |
36 | 36 | <input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" type="hidden" |
37 | 37 | value="0"/> |
38 | 38 | <input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" |
39 | 39 | id="<?php echo $this->get_field_id(); ?>" type="checkbox" |
40 | 40 | value="1" <?php checked( ! empty( $this->value[ $value ] ) ); ?> /> |
41 | - <?php echo esc_html( $label['label'] ); ?> |
|
41 | + <?php echo esc_html( $label[ 'label' ] ); ?> |
|
42 | 42 | </label> |
43 | - <?php if( ! empty( $label['desc'] ) ) { |
|
44 | - printf( '<span class="howto">%s</span>', $label['desc'] ); |
|
43 | + <?php if ( ! empty( $label[ 'desc' ] ) ) { |
|
44 | + printf( '<span class="howto">%s</span>', $label[ 'desc' ] ); |
|
45 | 45 | } |
46 | 46 | ?> |
47 | 47 | </li> |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | 11 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
12 | -$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) ); |
|
12 | +$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) ); |
|
13 | 13 | |
14 | -if( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
14 | +if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | do_action( 'gravityview/field/notes/scripts' ); |
26 | 26 | |
27 | 27 | $entry = $gravityview_view->getCurrentEntry(); |
28 | -$notes = GravityView_Entry_Notes::get_notes( $entry['id'] ); |
|
28 | +$notes = GravityView_Entry_Notes::get_notes( $entry[ 'id' ] ); |
|
29 | 29 | $strings = GravityView_Field_Notes::strings(); |
30 | -$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
30 | +$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
31 | 31 | |
32 | -$show_add = ! empty( $visibility_settings['add'] ); |
|
33 | -$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
34 | -$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
32 | +$show_add = ! empty( $visibility_settings[ 'add' ] ); |
|
33 | +$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
34 | +$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
35 | 35 | |
36 | 36 | $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' ); |
37 | 37 | $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes'; |
38 | 38 | ?> |
39 | 39 | <div class="gv-notes <?php echo $container_class; ?>"> |
40 | 40 | <?php |
41 | - if( $show_notes ) { |
|
41 | + if ( $show_notes ) { |
|
42 | 42 | ?> |
43 | 43 | <form method="post" class="gv-notes-list"> |
44 | 44 | <?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?> |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | <input type="hidden" name="action" value="gv_delete_notes" /> |
47 | 47 | <input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" /> |
48 | 48 | <table> |
49 | - <caption><?php echo $strings['caption']; ?></caption> |
|
49 | + <caption><?php echo $strings[ 'caption' ]; ?></caption> |
|
50 | 50 | <?php |
51 | 51 | if ( $show_delete ) { |
52 | 52 | ?> |
53 | 53 | <thead> |
54 | 54 | <tr> |
55 | 55 | <th colspan="2"> |
56 | - <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label> |
|
57 | - <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button> |
|
56 | + <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label> |
|
57 | + <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button> |
|
58 | 58 | </th> |
59 | 59 | </tr> |
60 | 60 | </thead> |
61 | 61 | <?php } ?> |
62 | 62 | <tbody> |
63 | - <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr> |
|
63 | + <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr> |
|
64 | 64 | <?php |
65 | 65 | foreach ( $notes as $note ) { |
66 | 66 | echo GravityView_Field_Notes::display_note( $note, $show_delete ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | } // End if can view notes |
75 | 75 | |
76 | - if( $show_add ) { |
|
76 | + if ( $show_add ) { |
|
77 | 77 | echo do_shortcode( '[gv_note_add]' ); |
78 | 78 | } |
79 | 79 | ?> |