@@ -45,7 +45,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -48,132 +48,132 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * Given information provided in an entry, get array of media IDs |
|
52 | - * |
|
53 | - * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
54 | - * |
|
55 | - * @see GFFormsModel::create_post() |
|
56 | - * |
|
57 | - * @since 1.17 |
|
58 | - * |
|
59 | - * @param array $form Gravity Forms form array |
|
60 | - * @param array $entry Gravity Forms entry array |
|
61 | - * |
|
62 | - * @return array Array of "Field ID" => "Media IDs" |
|
63 | - */ |
|
64 | - public static function get_post_field_images( $form, $entry ) { |
|
65 | - |
|
66 | - $post_data = self::get_post_fields( $form, $entry ); |
|
67 | - |
|
68 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
69 | - |
|
70 | - $post_images = array(); |
|
71 | - |
|
72 | - foreach ( $media as $media_item ) { |
|
73 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
74 | - if( |
|
75 | - \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
|
76 | - \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
|
77 | - \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
78 | - ) { |
|
79 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
83 | - |
|
84 | - return $post_images; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Alias of GFFormsModel::get_post_fields(); just making it public |
|
89 | - * |
|
90 | - * @see GFFormsModel::get_post_fields() |
|
91 | - * |
|
92 | - * @since 1.17 |
|
93 | - * |
|
94 | - * @param array $form Gravity Forms form array |
|
95 | - * @param array $entry Gravity Forms entry array |
|
96 | - * |
|
97 | - * @return array |
|
98 | - */ |
|
99 | - public static function get_post_fields( $form, $entry ) { |
|
100 | - |
|
101 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
102 | - |
|
103 | - /** |
|
104 | - * If the method changes to public, use Gravity Forms' method |
|
105 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
106 | - */ |
|
107 | - if( $reflection->isPublic() ) { |
|
108 | - return parent::get_post_fields( $form, $entry ); |
|
109 | - } |
|
110 | - |
|
111 | - // It was private; let's make it public |
|
112 | - $reflection->setAccessible( true ); |
|
113 | - |
|
114 | - return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
119 | - * |
|
120 | - * @since 1.16.2 |
|
121 | - * |
|
122 | - * @param string $url URL of the post image to update |
|
123 | - * @param int $post_id ID of the post image to update |
|
124 | - * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
125 | - */ |
|
126 | - public static function copy_post_image( $url, $post_id ) { |
|
127 | - |
|
128 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
129 | - |
|
130 | - /** |
|
131 | - * If the method changes to public, use Gravity Forms' method |
|
132 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
133 | - */ |
|
134 | - if( $reflection->isPublic() ) { |
|
135 | - return parent::copy_post_image( $url, $post_id ); |
|
136 | - } |
|
137 | - |
|
138 | - // It was private; let's make it public |
|
139 | - $reflection->setAccessible( true ); |
|
140 | - |
|
141 | - return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
146 | - * |
|
147 | - * Note: The method became public in GF 1.9.17.7 |
|
148 | - * |
|
149 | - * @see GFFormsModel::media_handle_upload |
|
150 | - * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
151 | - * |
|
152 | - * @uses copy_post_image |
|
153 | - * @uses wp_insert_attachment |
|
154 | - * @uses wp_update_attachment_metadata |
|
155 | - * |
|
156 | - * @param string $url URL of the post image to update |
|
157 | - * @param int $post_id ID of the post image to update |
|
158 | - * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
|
159 | - * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
160 | - */ |
|
161 | - public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
162 | - |
|
163 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
164 | - |
|
165 | - /** |
|
166 | - * If the method changes to public, use Gravity Forms' method |
|
167 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
168 | - */ |
|
169 | - if( $reflection->isPublic() ) { |
|
170 | - return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
171 | - } |
|
172 | - |
|
173 | - // It was private; let's make it public |
|
174 | - $reflection->setAccessible( true ); |
|
175 | - |
|
176 | - return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
177 | - } |
|
51 | + * Given information provided in an entry, get array of media IDs |
|
52 | + * |
|
53 | + * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
54 | + * |
|
55 | + * @see GFFormsModel::create_post() |
|
56 | + * |
|
57 | + * @since 1.17 |
|
58 | + * |
|
59 | + * @param array $form Gravity Forms form array |
|
60 | + * @param array $entry Gravity Forms entry array |
|
61 | + * |
|
62 | + * @return array Array of "Field ID" => "Media IDs" |
|
63 | + */ |
|
64 | + public static function get_post_field_images( $form, $entry ) { |
|
65 | + |
|
66 | + $post_data = self::get_post_fields( $form, $entry ); |
|
67 | + |
|
68 | + $media = get_attached_media( 'image', $entry['post_id'] ); |
|
69 | + |
|
70 | + $post_images = array(); |
|
71 | + |
|
72 | + foreach ( $media as $media_item ) { |
|
73 | + foreach( (array) $post_data['images'] as $post_data_item ) { |
|
74 | + if( |
|
75 | + \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
|
76 | + \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
|
77 | + \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
78 | + ) { |
|
79 | + $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | + |
|
84 | + return $post_images; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Alias of GFFormsModel::get_post_fields(); just making it public |
|
89 | + * |
|
90 | + * @see GFFormsModel::get_post_fields() |
|
91 | + * |
|
92 | + * @since 1.17 |
|
93 | + * |
|
94 | + * @param array $form Gravity Forms form array |
|
95 | + * @param array $entry Gravity Forms entry array |
|
96 | + * |
|
97 | + * @return array |
|
98 | + */ |
|
99 | + public static function get_post_fields( $form, $entry ) { |
|
100 | + |
|
101 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
102 | + |
|
103 | + /** |
|
104 | + * If the method changes to public, use Gravity Forms' method |
|
105 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
106 | + */ |
|
107 | + if( $reflection->isPublic() ) { |
|
108 | + return parent::get_post_fields( $form, $entry ); |
|
109 | + } |
|
110 | + |
|
111 | + // It was private; let's make it public |
|
112 | + $reflection->setAccessible( true ); |
|
113 | + |
|
114 | + return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
119 | + * |
|
120 | + * @since 1.16.2 |
|
121 | + * |
|
122 | + * @param string $url URL of the post image to update |
|
123 | + * @param int $post_id ID of the post image to update |
|
124 | + * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
125 | + */ |
|
126 | + public static function copy_post_image( $url, $post_id ) { |
|
127 | + |
|
128 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
129 | + |
|
130 | + /** |
|
131 | + * If the method changes to public, use Gravity Forms' method |
|
132 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
133 | + */ |
|
134 | + if( $reflection->isPublic() ) { |
|
135 | + return parent::copy_post_image( $url, $post_id ); |
|
136 | + } |
|
137 | + |
|
138 | + // It was private; let's make it public |
|
139 | + $reflection->setAccessible( true ); |
|
140 | + |
|
141 | + return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
146 | + * |
|
147 | + * Note: The method became public in GF 1.9.17.7 |
|
148 | + * |
|
149 | + * @see GFFormsModel::media_handle_upload |
|
150 | + * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
151 | + * |
|
152 | + * @uses copy_post_image |
|
153 | + * @uses wp_insert_attachment |
|
154 | + * @uses wp_update_attachment_metadata |
|
155 | + * |
|
156 | + * @param string $url URL of the post image to update |
|
157 | + * @param int $post_id ID of the post image to update |
|
158 | + * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
|
159 | + * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
160 | + */ |
|
161 | + public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
162 | + |
|
163 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
164 | + |
|
165 | + /** |
|
166 | + * If the method changes to public, use Gravity Forms' method |
|
167 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
168 | + */ |
|
169 | + if( $reflection->isPublic() ) { |
|
170 | + return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
171 | + } |
|
172 | + |
|
173 | + // It was private; let's make it public |
|
174 | + $reflection->setAccessible( true ); |
|
175 | + |
|
176 | + return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
177 | + } |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | \ No newline at end of file |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | public static function is_value_match( $field_value, $target_value, $operation = 'is', $source_field = null, $rule = null, $form = null ) { |
41 | 41 | |
42 | 42 | if ( in_array( $source_field, array( 'date_created', 'date_updated', 'payment_date' ), true ) ) { |
43 | - $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
|
44 | - $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
|
43 | + $field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value ); |
|
44 | + $target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value ); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | if ( $source_field instanceof GF_Field && $source_field->type == 'date' ) { |
48 | - $field_value = is_int( $field_value )? $field_value : strtotime( $field_value ); |
|
49 | - $target_value = is_int( $target_value )? $target_value : strtotime( $target_value ); |
|
48 | + $field_value = is_int( $field_value ) ? $field_value : strtotime( $field_value ); |
|
49 | + $target_value = is_int( $target_value ) ? $target_value : strtotime( $target_value ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ( in_array( $_operation = str_replace( ' ', '_', trim( $operation ) ), array( 'in', 'not_in' ) ) ) { |
53 | - return GVCommon::matches_operation( (array) $field_value, (array) $target_value, $_operation ); |
|
53 | + return GVCommon::matches_operation( (array)$field_value, (array)$target_value, $_operation ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return parent::is_value_match( $field_value, $target_value, $operation, $source_field, $rule, $form ); |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | |
75 | 75 | $post_data = self::get_post_fields( $form, $entry ); |
76 | 76 | |
77 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
77 | + $media = get_attached_media( 'image', $entry[ 'post_id' ] ); |
|
78 | 78 | |
79 | 79 | $post_images = array(); |
80 | 80 | |
81 | 81 | foreach ( $media as $media_item ) { |
82 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
83 | - if( |
|
82 | + foreach ( (array)$post_data[ 'images' ] as $post_data_item ) { |
|
83 | + if ( |
|
84 | 84 | \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title && |
85 | 85 | \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content && |
86 | 86 | \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt |
87 | 87 | ) { |
88 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
88 | + $post_images[ "{$post_data_item[ 'field_id' ]}" ] = $media_item->ID; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * If the method changes to public, use Gravity Forms' method |
114 | 114 | * @todo: If/when the method is public, remove the unneeded copied code. |
115 | 115 | */ |
116 | - if( $reflection->isPublic() ) { |
|
116 | + if ( $reflection->isPublic() ) { |
|
117 | 117 | return parent::get_post_fields( $form, $entry ); |
118 | 118 | } |
119 | 119 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * If the method changes to public, use Gravity Forms' method |
141 | 141 | * @todo: If/when the method is public, remove the unneeded copied code. |
142 | 142 | */ |
143 | - if( $reflection->isPublic() ) { |
|
143 | + if ( $reflection->isPublic() ) { |
|
144 | 144 | return parent::copy_post_image( $url, $post_id ); |
145 | 145 | } |
146 | 146 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * If the method changes to public, use Gravity Forms' method |
176 | 176 | * @todo: If/when the method is public, remove the unneeded copied code. |
177 | 177 | */ |
178 | - if( $reflection->isPublic() ) { |
|
178 | + if ( $reflection->isPublic() ) { |
|
179 | 179 | return parent::media_handle_upload( $url, $post_id, $post_data ); |
180 | 180 | } |
181 | 181 |
@@ -113,16 +113,16 @@ discard block |
||
113 | 113 | $new_value = $old_value; |
114 | 114 | |
115 | 115 | // Meta value does not exist yet |
116 | - if( false === $old_value ) { |
|
116 | + if ( false === $old_value ) { |
|
117 | 117 | return self::UNAPPROVED; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Meta value does not exist yet |
121 | - if( true === $old_value ) { |
|
121 | + if ( true === $old_value ) { |
|
122 | 122 | return self::APPROVED; |
123 | 123 | } |
124 | 124 | |
125 | - switch ( (string) $old_value ) { |
|
125 | + switch ( (string)$old_value ) { |
|
126 | 126 | |
127 | 127 | // Approved values |
128 | 128 | case 'Approved': |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | foreach ( $choices as $key => $choice ) { |
249 | 249 | |
250 | 250 | // Is the passed status value the same as the choice value or key? |
251 | - if ( $status === $choice['value'] || $status === $key ) { |
|
251 | + if ( $status === $choice[ 'value' ] || $status === $key ) { |
|
252 | 252 | |
253 | - if( 'key' === $attr_key ) { |
|
253 | + if ( 'key' === $attr_key ) { |
|
254 | 254 | return $key; |
255 | 255 | } else { |
256 | 256 | return \GV\Utils::get( $choice, $attr_key, false ); |
@@ -41,22 +41,22 @@ |
||
41 | 41 | |
42 | 42 | <?php |
43 | 43 | |
44 | - $search_value = \GV\Utils::_GET( $search_field['name'] ); |
|
44 | + $search_value = \GV\Utils::_GET( $search_field['name'] ); |
|
45 | 45 | |
46 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
46 | + foreach ( $search_field['choices'] as $k => $choice ) { |
|
47 | 47 | |
48 | - if ( 0 != $k ) { |
|
49 | - echo esc_html( $links_sep ); |
|
50 | - } |
|
48 | + if ( 0 != $k ) { |
|
49 | + echo esc_html( $links_sep ); |
|
50 | + } |
|
51 | 51 | |
52 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
52 | + $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
53 | 53 | |
54 | - if ( $active ) { |
|
55 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
56 | - } else { |
|
57 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
58 | - } |
|
59 | - ?> |
|
54 | + if ( $active ) { |
|
55 | + $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
56 | + } else { |
|
57 | + $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
58 | + } |
|
59 | + ?> |
|
60 | 60 | |
61 | 61 | <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
62 | 62 |
@@ -13,12 +13,12 @@ discard block |
||
13 | 13 | $base_url = GravityView_Widget_Search::get_search_form_action(); |
14 | 14 | |
15 | 15 | // Make sure that there are choices to display |
16 | -if ( empty( $search_field['choices'] ) ) { |
|
16 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
17 | 17 | gravityview()->log->debug( 'search-field-link.php - No choices for field' ); |
18 | 18 | return; |
19 | 19 | } |
20 | 20 | |
21 | -$links_label = empty( $search_field['label'] ) ? __( 'Show only:', 'gk-gravityview' ) : $search_field['label']; |
|
21 | +$links_label = empty( $search_field[ 'label' ] ) ? __( 'Show only:', 'gk-gravityview' ) : $search_field[ 'label' ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @filter `gravityview/extension/search/links_label` Change the label for the "Link" search bar input type |
@@ -41,24 +41,24 @@ discard block |
||
41 | 41 | |
42 | 42 | <?php |
43 | 43 | |
44 | - $search_value = \GV\Utils::_GET( $search_field['name'] ); |
|
44 | + $search_value = \GV\Utils::_GET( $search_field[ 'name' ] ); |
|
45 | 45 | |
46 | - foreach ( $search_field['choices'] as $k => $choice ) { |
|
46 | + foreach ( $search_field[ 'choices' ] as $k => $choice ) { |
|
47 | 47 | |
48 | 48 | if ( 0 != $k ) { |
49 | 49 | echo esc_html( $links_sep ); |
50 | 50 | } |
51 | 51 | |
52 | - $active = ( '' !== $search_value && in_array( $search_value, array( $choice['text'], $choice['value'] ) ) ) ? ' class="active"' : false; |
|
52 | + $active = ( '' !== $search_value && in_array( $search_value, array( $choice[ 'text' ], $choice[ 'value' ] ) ) ) ? ' class="active"' : false; |
|
53 | 53 | |
54 | 54 | if ( $active ) { |
55 | - $link = remove_query_arg( array( 'pagenum', $search_field['name'] ), $base_url ); |
|
55 | + $link = remove_query_arg( array( 'pagenum', $search_field[ 'name' ] ), $base_url ); |
|
56 | 56 | } else { |
57 | - $link = add_query_arg( array( $search_field['name'] => urlencode( $choice['value'] ) ), remove_query_arg( array('pagenum'), $base_url ) ); |
|
57 | + $link = add_query_arg( array( $search_field[ 'name' ] => urlencode( $choice[ 'value' ] ) ), remove_query_arg( array( 'pagenum' ), $base_url ) ); |
|
58 | 58 | } |
59 | 59 | ?> |
60 | 60 | |
61 | - <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice['text'] ); ?></a> |
|
61 | + <a href="<?php echo esc_url_raw( $link ); ?>" <?php echo $active; ?>><?php echo esc_html( $choice[ 'text' ] ); ?></a> |
|
62 | 62 | |
63 | 63 | <?php } ?> |
64 | 64 | </p> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | 14 | gravityview()->log->debug( 'search-field-checkbox.php - No choices for field' ); |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box gv-search-field-checkbox"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>[]" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php gv_selected( $choice['value'], $search_field['value'], true, 'checked' ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
27 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>[]" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php gv_selected( $choice[ 'value' ], $search_field[ 'value' ], true, 'checked' ); ?>> |
|
28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | 14 | gravityview()->log->debug( 'search-field-radio.php - No choices for field' ); |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box gv-search-field-radio"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
27 | + <input type="radio" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php checked( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>> |
|
28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -28,11 +28,11 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | - } |
|
34 | - $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
|
35 | - $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | + } |
|
34 | + $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
|
35 | + $placeholder = \GV\Utils::get( $this->field, 'placeholder' ); |
|
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
38 | 38 | <?php |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
10 | 10 | |
11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
12 | 12 | echo $this->get_tooltip() . $this->get_field_desc(); |
13 | 13 | ?><div> |
14 | 14 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | function render_input( $override_input = null ) { |
21 | 21 | |
22 | - if( isset( $override_input ) ) { |
|
22 | + if ( isset( $override_input ) ) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
31 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
33 | 33 | } |
34 | 34 | $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * @param array $callback_args Arguments passed to the callback |
98 | 98 | * @return void |
99 | 99 | */ |
100 | - function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
100 | + function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
101 | 101 | |
102 | - $this->id = $this->prefix.$id; |
|
102 | + $this->id = $this->prefix . $id; |
|
103 | 103 | $this->title = $title; |
104 | 104 | $this->render_template_file = $file; |
105 | 105 | $this->callback = $callback; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function parse_icon_class_name( $icon_class_name = '' ) { |
120 | 120 | |
121 | - if( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
121 | + if ( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
122 | 122 | $icon_class_name = 'dashicons ' . $icon_class_name; |
123 | 123 | } |
124 | 124 | |
@@ -142,29 +142,29 @@ discard block |
||
142 | 142 | */ |
143 | 143 | function render( $post ) { |
144 | 144 | |
145 | - if( !empty( $this->render_template_file ) ) { |
|
145 | + if ( ! empty( $this->render_template_file ) ) { |
|
146 | 146 | |
147 | 147 | $file = $this->render_template_file; |
148 | 148 | |
149 | 149 | // If the full path exists, use it |
150 | - if( file_exists( $file ) ) { |
|
150 | + if ( file_exists( $file ) ) { |
|
151 | 151 | $path = $file; |
152 | 152 | } else { |
153 | - $path = GRAVITYVIEW_DIR .'includes/admin/metaboxes/views/'.$file; |
|
153 | + $path = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/views/' . $file; |
|
154 | 154 | } |
155 | 155 | |
156 | - if( file_exists( $path ) ) { |
|
156 | + if ( file_exists( $path ) ) { |
|
157 | 157 | include $path; |
158 | 158 | } else { |
159 | 159 | gravityview()->log->error( 'Metabox template file not found', array( 'data' => $this ) ); |
160 | 160 | } |
161 | 161 | |
162 | - } else if( !empty( $this->callback ) ) { |
|
162 | + } else if ( ! empty( $this->callback ) ) { |
|
163 | 163 | |
164 | - if( is_callable( $this->callback ) ) { |
|
164 | + if ( is_callable( $this->callback ) ) { |
|
165 | 165 | |
166 | 166 | /** @see do_accordion_sections() */ |
167 | - call_user_func( $this->callback, $post, (array) $this ); |
|
167 | + call_user_func( $this->callback, $post, (array)$this ); |
|
168 | 168 | |
169 | 169 | } else { |
170 | 170 | gravityview()->log->error( 'Metabox callback was not callable', array( 'data' => $this ) ); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | static function getInstance() { |
43 | 43 | gravityview()->log->notice( '\GravityView_oEmbed is deprecated. Use \GV\oEmbed instead.' ); |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | self::$instance->initialize(); |
48 | 48 | } |